Skip to content

Commit

Permalink
Improved Attribute Modifier Display on Items
Browse files Browse the repository at this point in the history
+If an Item has an entity attribute modifier value of zero that it would normally display, it no longer displays it.
  • Loading branch information
CleverNucleus committed Jun 26, 2021
1 parent c7438de commit 0e5880a
Showing 1 changed file with 3 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,9 @@ public static void tooltipModify(ItemStack stack, TooltipContext context, List<T
if(attribute == EntityAttributes.GENERIC_ATTACK_DAMAGE || attribute == EntityAttributes.GENERIC_ATTACK_SPEED) {
String prefix = d >= 0.0D ? "+" : "";

lines.add(lines.size() - index, (new LiteralText(" ")).append(new TranslatableText("attribute.modifier.equals." + modifier.getOperation().getId(), new Object[] {prefix + MODIFIER_FORMAT.format(d), new TranslatableText(((EntityAttribute)entry.getKey()).getTranslationKey())})).formatted(Formatting.DARK_GREEN));
if(d != 0.0D) {
lines.add(lines.size() - index, (new LiteralText(" ")).append(new TranslatableText("attribute.modifier.equals." + modifier.getOperation().getId(), new Object[] {prefix + MODIFIER_FORMAT.format(d), new TranslatableText(((EntityAttribute)entry.getKey()).getTranslationKey())})).formatted(Formatting.DARK_GREEN));
}
}
}
}
Expand Down

0 comments on commit 0e5880a

Please sign in to comment.