Fixed batbox capability invalidation.

This commit is contained in:
Flanks255 2024-10-30 11:09:31 -05:00
parent 9fe3fa1c7c
commit 6596a8e6f9
2 changed files with 4 additions and 2 deletions

View file

@ -66,6 +66,7 @@ public class BlockBatteryBox extends BlockContainerBase {
if (!stack.isEmpty()) { if (!stack.isEmpty()) {
if (stack.getItem() instanceof ItemBattery && box.inv.getStackInSlot(0).isEmpty()) { if (stack.getItem() instanceof ItemBattery && box.inv.getStackInSlot(0).isEmpty()) {
box.inv.setStackInSlot(0, stack.copy()); box.inv.setStackInSlot(0, stack.copy());
box.invalidateCapabilities();
player.setItemInHand(hand, ItemStack.EMPTY); player.setItemInHand(hand, ItemStack.EMPTY);
return ItemInteractionResult.SUCCESS; return ItemInteractionResult.SUCCESS;
} }
@ -74,6 +75,7 @@ public class BlockBatteryBox extends BlockContainerBase {
if (!inSlot.isEmpty()) { if (!inSlot.isEmpty()) {
player.setItemInHand(hand, inSlot.copy()); player.setItemInHand(hand, inSlot.copy());
box.inv.setStackInSlot(0, ItemStack.EMPTY); box.inv.setStackInSlot(0, ItemStack.EMPTY);
box.invalidateCapabilities();
return ItemInteractionResult.SUCCESS; return ItemInteractionResult.SUCCESS;
} }
} }