diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockBatteryBox.java b/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockBatteryBox.java index b236c5957..44ca79957 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockBatteryBox.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockBatteryBox.java @@ -61,11 +61,12 @@ public class BlockBatteryBox extends BlockContainerBase { protected ItemInteractionResult useItemOn(ItemStack pStack, BlockState pState, Level world, BlockPos pos, Player player, InteractionHand hand, BlockHitResult pHitResult) { BlockEntity tile = world.getBlockEntity(pos); if (tile instanceof TileEntityBatteryBox box) { - ItemStack stack = player.getItemInHand(hand); + ItemStack stack = player.getItemInHand(hand); if (!stack.isEmpty()) { if (stack.getItem() instanceof ItemBattery && box.inv.getStackInSlot(0).isEmpty()) { box.inv.setStackInSlot(0, stack.copy()); + box.invalidateCapabilities(); player.setItemInHand(hand, ItemStack.EMPTY); return ItemInteractionResult.SUCCESS; } @@ -74,6 +75,7 @@ public class BlockBatteryBox extends BlockContainerBase { if (!inSlot.isEmpty()) { player.setItemInHand(hand, inSlot.copy()); box.inv.setStackInSlot(0, ItemStack.EMPTY); + box.invalidateCapabilities(); return ItemInteractionResult.SUCCESS; } } diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityBatteryBox.java b/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityBatteryBox.java index 9ca8de363..fcd2bfb00 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityBatteryBox.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityBatteryBox.java @@ -135,7 +135,7 @@ public class TileEntityBatteryBox extends TileEntityInventoryBase implements ISh for (BlockEntity tile : startTile.tilesAround) { if (tile instanceof TileEntityBatteryBox box) { - if (!pushOffTo.contains(box)) { + if (!pushOffTo.contains(box)) { pushOffTo.add(box); this.energyPushOffLoop(box, pushOffTo);