mirror of
https://github.com/Ellpeck/ActuallyAdditions.git
synced 2024-11-21 23:13:28 +01:00
Fixed batbox capability invalidation.
This commit is contained in:
parent
9fe3fa1c7c
commit
6596a8e6f9
2 changed files with 4 additions and 2 deletions
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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);
|
||||
|
|
Loading…
Reference in a new issue