Skip to content

Commit

Permalink
Only add material bonuses to the right material #247
Browse files Browse the repository at this point in the history
  • Loading branch information
Sentropic committed Jul 1, 2024
1 parent df02d62 commit e543cbd
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -620,9 +620,10 @@ public BiFunction<Boolean, Double, Double> getMaterialModifiers(@NotNull ItemSta
return (isBonus, result) -> result;
}

public Collection<StatBonus> getMaterialBonuses(ItemLoreStat<?> stat) {
public Collection<StatBonus> getMaterialBonuses(ItemStack item, ItemLoreStat<?> stat) {
List<StatBonus> list = new ArrayList<>();
for (Map.Entry<String, Map<ItemLoreStat<?>, String>> entry : this.materialBonuses.entrySet()) {
if (!ItemUtils.compareItemGroup(item, entry.getKey())) continue;
for (Map.Entry<ItemLoreStat<?>, String> entry1 : entry.getValue().entrySet()) {
if (entry1.getKey().equals(stat)) {
String sVal = entry1.getValue();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -266,7 +266,7 @@ public void generate(@NotNull ItemStack item, int itemLevel) {
((ItemLoreStat<StatBonus>) stat).add(item, statBonus, -1);
}

for (StatBonus statBonus : generatorItem.getMaterialBonuses(stat)) {
for (StatBonus statBonus : generatorItem.getMaterialBonuses(item, stat)) {
((ItemLoreStat<StatBonus>) stat).add(item, statBonus, -1);
}
}
Expand Down

0 comments on commit e543cbd

Please sign in to comment.