diff --git a/src/main/java/mekanism/common/item/ItemEnergized.java b/src/main/java/mekanism/common/item/ItemEnergized.java index 3fd22a98de8..d951f91c290 100644 --- a/src/main/java/mekanism/common/item/ItemEnergized.java +++ b/src/main/java/mekanism/common/item/ItemEnergized.java @@ -29,12 +29,12 @@ public class ItemEnergized extends Item implements ICustomCreativeTabContents, I protected final Predicate<@NotNull AutomationType> canInsert; public ItemEnergized(FloatingLongSupplier chargeRateSupplier, FloatingLongSupplier maxEnergySupplier, Properties properties) { - this(chargeRateSupplier, maxEnergySupplier, BasicEnergyContainer.manualOnly, BasicEnergyContainer.alwaysTrue, properties); + this(chargeRateSupplier, maxEnergySupplier, BasicEnergyContainer.manualOnly, BasicEnergyContainer.alwaysTrue, properties.stacksTo(1)); } public ItemEnergized(FloatingLongSupplier chargeRateSupplier, FloatingLongSupplier maxEnergySupplier, Predicate<@NotNull AutomationType> canExtract, Predicate<@NotNull AutomationType> canInsert, Properties properties) { - super(properties.stacksTo(1)); + super(properties); this.chargeRateSupplier = chargeRateSupplier; this.maxEnergySupplier = maxEnergySupplier; this.canExtract = canExtract; @@ -43,7 +43,8 @@ public ItemEnergized(FloatingLongSupplier chargeRateSupplier, FloatingLongSuppli @Override public boolean isBarVisible(@NotNull ItemStack stack) { - return true; + //If we are currently stacked, don't display the bar as it will overlap the stack count + return stack.getCount() == 1; } @Override diff --git a/src/main/java/mekanism/common/item/block/ItemBlockChemicalTank.java b/src/main/java/mekanism/common/item/block/ItemBlockChemicalTank.java index 118f6eb1e62..1bf346933e3 100644 --- a/src/main/java/mekanism/common/item/block/ItemBlockChemicalTank.java +++ b/src/main/java/mekanism/common/item/block/ItemBlockChemicalTank.java @@ -58,11 +58,6 @@ public boolean isBarVisible(@NotNull ItemStack stack) { @Override public int getBarWidth(@NotNull ItemStack stack) { - if (stack.getCount() > 1) { - //Note: Technically this is handled by the below check as the capability isn't exposed (so this isn't even visible), - // but we may as well short circuit it here - return 0; - } return StorageUtils.getBarWidth(stack); } diff --git a/src/main/java/mekanism/common/item/block/ItemBlockEnergyCube.java b/src/main/java/mekanism/common/item/block/ItemBlockEnergyCube.java index 9f1d6f3a042..3a9c81e9bb3 100644 --- a/src/main/java/mekanism/common/item/block/ItemBlockEnergyCube.java +++ b/src/main/java/mekanism/common/item/block/ItemBlockEnergyCube.java @@ -58,17 +58,12 @@ protected void addTypeDetails(@NotNull ItemStack stack, Level world, @NotNull Li @Override public boolean isBarVisible(@NotNull ItemStack stack) { - //If We are currently stacked, don't display the bar as it will overlap the stack count + //If we are currently stacked, don't display the bar as it will overlap the stack count return stack.getCount() == 1; } @Override public int getBarWidth(@NotNull ItemStack stack) { - if (stack.getCount() > 1) { - //Note: Technically this is handled by the below check as the capability isn't exposed (so this isn't even visible), - // but we may as well short circuit it here - return 0; - } return StorageUtils.getEnergyBarWidth(stack); } diff --git a/src/main/java/mekanism/common/util/StorageUtils.java b/src/main/java/mekanism/common/util/StorageUtils.java index 06daeaad775..97e0fcbe956 100644 --- a/src/main/java/mekanism/common/util/StorageUtils.java +++ b/src/main/java/mekanism/common/util/StorageUtils.java @@ -356,6 +356,11 @@ public static Component getStoragePercent(double ratio, boolean colorText) { } public static int getBarWidth(ItemStack stack) { + if (stack.getCount() > 1) { + //Note: Technically this is handled by the below check as the capability isn't exposed (so this isn't even visible), + // but we may as well short circuit it here + return 0; + } return MathUtils.clampToInt(Math.round(13.0F - 13.0F * getDurabilityForDisplay(stack))); } @@ -375,6 +380,11 @@ private static double getDurabilityForDisplay(ItemStack stack) { } public static int getEnergyBarWidth(ItemStack stack) { + if (stack.getCount() > 1) { + //Note: Technically this is handled by the below check as the capability isn't exposed (so this isn't even visible), + // but we may as well short circuit it here + return 0; + } return MathUtils.clampToInt(Math.round(13.0F - 13.0F * getEnergyDurabilityForDisplay(stack))); }