diff --git a/pom.xml b/pom.xml
index 7659f854e..2131ede7e 100644
--- a/pom.xml
+++ b/pom.xml
@@ -10,7 +10,7 @@
me.lokka30
LevelledMobs
- 3.3.2 b595
+ 3.3.2 b596
jar
LevelledMobs
diff --git a/src/main/java/me/lokka30/levelledmobs/customdrops/CustomDropsHandler.java b/src/main/java/me/lokka30/levelledmobs/customdrops/CustomDropsHandler.java
index c9c418cfd..47e66dd1d 100644
--- a/src/main/java/me/lokka30/levelledmobs/customdrops/CustomDropsHandler.java
+++ b/src/main/java/me/lokka30/levelledmobs/customdrops/CustomDropsHandler.java
@@ -99,7 +99,7 @@ public CustomDropResult getCustomItemDrops(final LivingEntityWrapper lmEntity, f
if (lmEntity.getLivingEntity().getLastDamageCause() != null)
processingInfo.deathCause = CauseOfDeathEnum.valueOf(lmEntity.getLivingEntity().getLastDamageCause().getCause().toString().toUpperCase());
- processingInfo.addition = BigDecimal.valueOf(main.mobDataManager.getAdditionsForLevel(lmEntity, Addition.CUSTOM_ITEM_DROP, 0.0))
+ processingInfo.addition = BigDecimal.valueOf(main.mobDataManager.getAdditionsForLevel(lmEntity, Addition.CUSTOM_ITEM_DROP, 2))
.setScale(0, RoundingMode.HALF_DOWN).intValueExact(); // truncate double to int
processingInfo.doNotMultiplyDrops = main.rulesManager.getRule_CheckIfNoDropMultiplierEntitiy(lmEntity);
@@ -112,7 +112,6 @@ public CustomDropResult getCustomItemDrops(final LivingEntityWrapper lmEntity, f
}
if (!equippedOnly && isCustomDropsDebuggingEnabled()) {
-
final String mobLevel = lmEntity.getMobLevel() > 0 ? "&r (level " + lmEntity.getMobLevel() + ")" : "";
processingInfo.addDebugMessage("&7Custom drops for &b" + lmEntity.getNameIfBaby() + mobLevel);
processingInfo.addDebugMessage("&8- &7Groups: &b" + String.join("&7, &b", lmEntity.getApplicableGroups()) + "&7.");
diff --git a/src/main/java/me/lokka30/levelledmobs/managers/LevelManager.java b/src/main/java/me/lokka30/levelledmobs/managers/LevelManager.java
index 0af357259..6531d4959 100644
--- a/src/main/java/me/lokka30/levelledmobs/managers/LevelManager.java
+++ b/src/main/java/me/lokka30/levelledmobs/managers/LevelManager.java
@@ -404,56 +404,64 @@ public int[] getMinAndMaxLevels(final @NotNull LivingEntityInterface lmInterface
}
// This sets the levelled currentDrops on a levelled mob that just died.
- public void setLevelledItemDrops(final LivingEntityWrapper lmEntity, final List currentDrops) {
+ public void setLevelledItemDrops(final LivingEntityWrapper lmEntity, final @NotNull List currentDrops) {
+ final int vanillaDrops = currentDrops.size();
// this accomodates chested animals, saddles and armor on ridable creatures
final List dropsToMultiply = getDropsToMultiply(lmEntity, currentDrops);
final List customDrops = new LinkedList<>();
currentDrops.clear();
- Utils.debugLog(main, DebugType.SET_LEVELLED_ITEM_DROPS, "&81:&7 Method called. &b" + dropsToMultiply.size() + "&7 drops will be analysed.");
-
- Utils.debugLog(main, DebugType.SET_LEVELLED_ITEM_DROPS, "&82:&7 Level of the &b" + lmEntity.getTypeName() + "&7 entity is &b" + lmEntity.getMobLevel() + "&7.");
-
final boolean doNotMultiplyDrops = main.rulesManager.getRule_CheckIfNoDropMultiplierEntitiy(lmEntity);
+ boolean hasOverride = false;
if (main.rulesManager.getRule_UseCustomDropsForMob(lmEntity).useDrops) {
// custom drops also get multiplied in the custom drops handler
final CustomDropResult dropResult = main.customDropsHandler.getCustomItemDrops(lmEntity, customDrops, false);
if (dropResult == CustomDropResult.HAS_OVERRIDE) {
- Utils.debugLog(main, DebugType.SET_LEVELLED_ITEM_DROPS, "&83:&7 Custom drop has override.");
+ hasOverride = true;
removeVanillaDrops(lmEntity, dropsToMultiply);
}
}
+ int additionUsed = 0;
+ int dropsChecked = 0;
+
if (!doNotMultiplyDrops && !dropsToMultiply.isEmpty()) {
// Get currentDrops added per level value
final int addition = BigDecimal.valueOf(main.mobDataManager.getAdditionsForLevel(lmEntity, Addition.CUSTOM_ITEM_DROP, 2.0))
.setScale(0, RoundingMode.HALF_DOWN).intValueExact(); // truncate double to int
- Utils.debugLog(main, DebugType.SET_LEVELLED_ITEM_DROPS, "&84:&7 Item drop addition is &b+" + addition + "&7.");
+ additionUsed = addition;
// Modify current drops
- Utils.debugLog(main, DebugType.SET_LEVELLED_ITEM_DROPS, "&85:&7 Scanning &b" + dropsToMultiply.size() + "&7 items...");
+ dropsChecked = dropsToMultiply.size();
for (final ItemStack currentDrop : dropsToMultiply)
multiplyDrop(lmEntity, currentDrop, addition, false);
}
if (!customDrops.isEmpty()) currentDrops.addAll(customDrops);
if (!dropsToMultiply.isEmpty()) currentDrops.addAll(dropsToMultiply);
+ final String nameWithOverride = hasOverride ?
+ lmEntity.getNameIfBaby() + " (override)" : lmEntity.getNameIfBaby();
+ Utils.debugLog(main, DebugType.SET_LEVELLED_ITEM_DROPS, String.format(
+ "&7Mob: &b%s&7, mob-lvl: &b%s&7, vanilla drops: &b%s&7, all drops: &b%s&7, addition: &b%s&7.",
+ nameWithOverride, lmEntity.getMobLevel(), vanillaDrops, currentDrops.size(), additionUsed));
}
public void multiplyDrop(final LivingEntityWrapper lmEntity, @NotNull final ItemStack currentDrop, final int addition, final boolean isCustomDrop){
- Utils.debugLog(main, DebugType.SET_LEVELLED_ITEM_DROPS, "&86:&7 Scanning drop &b" + currentDrop.getType() + "&7 with current amount &b" + currentDrop.getAmount() + "&7...");
+ final int oldAmount = currentDrop.getAmount();
if (isCustomDrop || main.mobDataManager.isLevelledDropManaged(lmEntity.getLivingEntity().getType(), currentDrop.getType())) {
int useAmount = currentDrop.getAmount() + (currentDrop.getAmount() * addition);
if (useAmount > currentDrop.getMaxStackSize()) useAmount = currentDrop.getMaxStackSize();
currentDrop.setAmount(useAmount);
- Utils.debugLog(main, DebugType.SET_LEVELLED_ITEM_DROPS, "&87:&7 Item was managed. New amount: &b" + currentDrop.getAmount() + "&7.");
- } else {
- Utils.debugLog(main, DebugType.SET_LEVELLED_ITEM_DROPS, "&87:&7 Item was unmanaged.");
+ Utils.debugLog(main, DebugType.SET_LEVELLED_ITEM_DROPS, String.format(
+ "&7Drop: &b%s&7, old amount: &b%s&7, addition value: &b%s&7, new amount: &b%s&7.",
+ currentDrop.getType(), oldAmount, addition, currentDrop.getAmount()));
}
+ else
+ Utils.debugLog(main, DebugType.SET_LEVELLED_ITEM_DROPS, "&7Item was unmanaged.");
}
@NotNull
@@ -517,7 +525,7 @@ public void removeVanillaDrops(@NotNull final LivingEntityWrapper lmEntity, fina
public int getLevelledExpDrops(@NotNull final LivingEntityWrapper lmEntity, final int xp) {
if (lmEntity.isLevelled()) {
final int newXp = (int) Math.round(xp + (xp * main.mobDataManager.getAdditionsForLevel(lmEntity, Addition.CUSTOM_XP_DROP, 3.0)));
- Utils.debugLog(main, DebugType.SET_LEVELLED_XP_DROPS, String.format("%s: lvl: %s, xp-vanilla: %s, new-xp: %s",
+ Utils.debugLog(main, DebugType.SET_LEVELLED_XP_DROPS, String.format("&7Mob: &b%s&7: lvl: &b%s&7, xp-vanilla: &b%s&7, new-xp: &b%s&7",
lmEntity.getNameIfBaby(), lmEntity.getMobLevel(), xp, newXp));
return newXp;
} else