If the treasure is an enchanted book, enchant it.

Added a bit of logic to check and see if the drop is an enchanted book, and if it is, force at least one enchantment to be applied.  As a warning, I'm not a programmer, so I could have incorrectly used the continue statement here.  This requires more experienced eyes and some testing, I'm sure.
This commit is contained in:
hoorigan 2017-10-30 20:25:19 -04:00 committed by GitHub
parent 307d483323
commit ec20d69feb
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -572,6 +572,11 @@ public class FishingManager extends SkillManager {
double dropRate = TreasureConfig.getInstance().getEnchantmentDropRate(getLootTier(), rarity); double dropRate = TreasureConfig.getInstance().getEnchantmentDropRate(getLootTier(), rarity);
if (diceRoll <= dropRate) { if (diceRoll <= dropRate) {
// Make sure enchanted books always get some kind of enchantment. --hoorigan
if (treasureDrop.getType() == Material.ENCHANTED_BOOK) {
diceRoll = dropRate;
continue;
}
fishingEnchantments = TreasureConfig.getInstance().fishingEnchantments.get(rarity); fishingEnchantments = TreasureConfig.getInstance().fishingEnchantments.get(rarity);
break; break;
} }