From ff4ea7393bdd42415766109ea09efe658a1d476c Mon Sep 17 00:00:00 2001 From: Justin Vitale <4002351+justinvvitale@users.noreply.github.com> Date: Thu, 9 Jul 2020 17:00:08 +1000 Subject: [PATCH] fix accessing storage unit with nothing in hand --- .../java/techreborn/blocks/storage/item/StorageUnitBlock.java | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/main/java/techreborn/blocks/storage/item/StorageUnitBlock.java b/src/main/java/techreborn/blocks/storage/item/StorageUnitBlock.java index bc8c94cd9..fed5e112b 100644 --- a/src/main/java/techreborn/blocks/storage/item/StorageUnitBlock.java +++ b/src/main/java/techreborn/blocks/storage/item/StorageUnitBlock.java @@ -29,6 +29,7 @@ import net.minecraft.block.entity.BlockEntity; import net.minecraft.entity.player.PlayerEntity; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; +import net.minecraft.item.Items; import net.minecraft.item.ToolItem; import net.minecraft.util.ActionResult; import net.minecraft.util.Hand; @@ -69,7 +70,8 @@ public class StorageUnitBlock extends BlockMachineBase { ItemStack stackInHand = playerIn.getStackInHand(Hand.MAIN_HAND); Item itemInHand = stackInHand.getItem(); - if (storageEntity != null && (storageEntity.isSameType(stackInHand) || (!storageEntity.isLocked() && storageEntity.isEmpty() && !(itemInHand instanceof ToolItem)))) { + if (storageEntity != null && itemInHand != Items.AIR && (storageEntity.isSameType(stackInHand) && !storageEntity.isFull() || + (!storageEntity.isLocked() && storageEntity.isEmpty() && (!(itemInHand instanceof ToolItem))))) { // Add item which is the same type (in users inventory) into storage for (int i = 0; i < playerIn.inventory.size() && !storageEntity.isFull(); i++) {