Fix(ItemElectricGoggles): ic2 energy bar not being displayed nor updated (#104)

Co-authored-by: sisyphussy <[email protected]>
This commit is contained in:
Woriveandsisyphussy authored and GitHub committed 2025-09-07 17:56:53 +00:00
1 parent 893d79e147
commit 46fa64f4f7
1 file changed
+20 -1
@@ -43,8 +43,27 @@ public class ItemElectricGoggles extends ItemArmor
this.setCreativeTab(EMT.TAB);
}
/**
* Allow damage to be set to avoid breaking IC2 Energy bar or other features, while preventing the item from
* breaking.
*
* @param stack the item stack
* @param damage the new damage value
*/
@Override
public void setDamage(ItemStack stack, int damage) {}
public void setDamage(ItemStack stack, int damage) {
int max = stack.getMaxDamage();
if (max > 0) {
if (damage >= max) {
damage = max - 1;
} else if (damage < 0) {
damage = 0;
}
}
super.setDamage(stack, damage);
}
@SideOnly(Side.CLIENT)
@Override