From 59c8976d8d4ac9801512506ccaad7a41ebaa69eb Mon Sep 17 00:00:00 2001 From: ASangarin Date: Wed, 21 Oct 2020 01:00:06 +0200 Subject: [PATCH] Fixed modifier weights and chances not being respected properly The system should now work as intended --- .../net/Indyuce/mmoitems/api/item/build/MMOItemBuilder.java | 4 ++-- .../Indyuce/mmoitems/api/item/template/TemplateModifier.java | 1 + 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/src/main/java/net/Indyuce/mmoitems/api/item/build/MMOItemBuilder.java b/src/main/java/net/Indyuce/mmoitems/api/item/build/MMOItemBuilder.java index 3eb14001..2bd3a9a0 100644 --- a/src/main/java/net/Indyuce/mmoitems/api/item/build/MMOItemBuilder.java +++ b/src/main/java/net/Indyuce/mmoitems/api/item/build/MMOItemBuilder.java @@ -64,12 +64,12 @@ public class MMOItemBuilder { mmoitem.setData(ItemStat.TIER, new StringData(tier.getId())); if (level > 0) mmoitem.setData(ItemStat.ITEM_LEVEL, new DoubleData(level)); - + // roll item gen modifiers for (TemplateModifier modifier : rollModifiers(template)) { // roll modifier chance // only apply if enough item weight - if (!modifier.rollChance() && modifier.getWeight() > capacity) + if (!modifier.rollChance() || modifier.getWeight() > capacity) continue; capacity -= modifier.getWeight(); diff --git a/src/main/java/net/Indyuce/mmoitems/api/item/template/TemplateModifier.java b/src/main/java/net/Indyuce/mmoitems/api/item/template/TemplateModifier.java index 1a4eb665..8a214d03 100644 --- a/src/main/java/net/Indyuce/mmoitems/api/item/template/TemplateModifier.java +++ b/src/main/java/net/Indyuce/mmoitems/api/item/template/TemplateModifier.java @@ -60,6 +60,7 @@ public class TemplateModifier { weight = config.getDouble("weight", parent.weight); nameModifier = parent.nameModifier; data = parent.data; + System.out.println("Got modifier from file."); return; }