mirror of
https://github.com/Auxilor/EcoEnchants.git
synced 2025-01-23 00:31:20 +01:00
Fixed natural loot generated items going above hard cap
This commit is contained in:
parent
32dd134372
commit
3542c1a62b
@ -88,6 +88,8 @@ public class LootPopulator extends BlockPopulator {
|
||||
multiplier /= plugin.getConfigYml().getDouble("loot.reduce-probability.factor");
|
||||
}
|
||||
|
||||
int cap = 0;
|
||||
|
||||
for (EcoEnchant enchantment : enchantments) {
|
||||
if (enchantment == null || enchantment.getRarity() == null) {
|
||||
continue;
|
||||
@ -145,6 +147,16 @@ public class LootPopulator extends BlockPopulator {
|
||||
if (plugin.getConfigYml().getBool("loot.reduce-probability.enabled")) {
|
||||
multiplier /= plugin.getConfigYml().getDouble("loot.reduce-probability.factor");
|
||||
}
|
||||
|
||||
if (!enchantment.hasFlag("hard-cap-ignore")) {
|
||||
cap++;
|
||||
}
|
||||
|
||||
if (plugin.getConfigYml().getBool("anvil.hard-cap.enabled")) {
|
||||
if (cap >= plugin.getConfigYml().getInt("anvil.hard-cap.cap")) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (item.getItemMeta() instanceof EnchantmentStorageMeta meta) {
|
||||
|
Loading…
Reference in New Issue
Block a user