Skip to content

Commit 5cf7cad

Browse files
committed
Fix providing an item energy cap that can't actually even be interacted with for laser amplifiers and tractor beams (#8097)
1 parent d91ea11 commit 5cf7cad

File tree

4 files changed

+20
-4
lines changed

4 files changed

+20
-4
lines changed

src/main/java/mekanism/common/item/block/ItemBlockInductionCell.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ protected void addStats(@NotNull ItemStack stack, @NotNull Item.TooltipContext c
3636
}
3737

3838
@Override
39-
protected boolean exposesEnergyCap() {
39+
protected boolean exposesEnergyCapOrTooltips() {
4040
return false;
4141
}
4242
}

src/main/java/mekanism/common/item/block/ItemBlockLaserAmplifier.java

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,4 +27,10 @@ public ItemBlockLaserAmplifier(BlockTileModel<TileEntityLaserAmplifier, BlockTyp
2727
//Don't allow charging laser amplifiers inside of energy storage devices
2828
return BasicEnergyContainer.manualOnly;
2929
}
30+
31+
@Override
32+
protected boolean exposesEnergyCap() {
33+
//Don't allow charging laser amplifiers inside of energy storage devices
34+
return false;
35+
}
3036
}

src/main/java/mekanism/common/item/block/ItemBlockTooltip.java

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -122,14 +122,14 @@ protected void addDetails(@NotNull ItemStack stack, @NotNull Item.TooltipContext
122122

123123
protected void addTypeDetails(@NotNull ItemStack stack, @NotNull Item.TooltipContext context, @NotNull List<Component> tooltip, @NotNull TooltipFlag flag) {
124124
//Put this here so that energy cubes can skip rendering energy here
125-
if (exposesEnergyCap()) {
125+
if (exposesEnergyCapOrTooltips()) {
126126
StorageUtils.addStoredEnergy(stack, tooltip, false);
127127
}
128128
}
129129

130130
@Override
131131
public boolean shouldCauseReequipAnimation(@NotNull ItemStack oldStack, @NotNull ItemStack newStack, boolean slotChanged) {
132-
if (exposesEnergyCap()) {
132+
if (exposesEnergyCapOrTooltips()) {
133133
//Ignore NBT for energized items causing re-equip animations
134134
//TODO: Only ignore the energy attachment?
135135
return slotChanged || oldStack.getItem() != newStack.getItem();
@@ -139,7 +139,7 @@ public boolean shouldCauseReequipAnimation(@NotNull ItemStack oldStack, @NotNull
139139

140140
@Override
141141
public boolean shouldCauseBlockBreakReset(@NotNull ItemStack oldStack, @NotNull ItemStack newStack) {
142-
if (exposesEnergyCap()) {
142+
if (exposesEnergyCapOrTooltips()) {
143143
//Ignore NBT for energized items causing block break reset
144144
//TODO: Only ignore the energy attachment?
145145
return oldStack.getItem() != newStack.getItem();
@@ -152,6 +152,10 @@ public boolean shouldCauseBlockBreakReset(@NotNull ItemStack oldStack, @NotNull
152152
}
153153

154154
protected boolean exposesEnergyCap() {
155+
return exposesEnergyCapOrTooltips();
156+
}
157+
158+
protected boolean exposesEnergyCapOrTooltips() {
155159
return Attribute.has(getBlock(), AttributeEnergy.class);
156160
}
157161

src/main/java/mekanism/common/item/block/machine/ItemBlockLaserTractorBeam.java

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,4 +19,10 @@ public ItemBlockLaserTractorBeam(BlockTile<?, ?> block, Item.Properties properti
1919
//Don't allow charging laser tractor beams inside of energy storage devices
2020
return BasicEnergyContainer.manualOnly;
2121
}
22+
23+
@Override
24+
protected boolean exposesEnergyCap() {
25+
//Don't allow charging laser amplifiers inside of energy storage devices
26+
return false;
27+
}
2228
}

0 commit comments

Comments
 (0)