From faa6aa30d04037f85ebc8df12587d34530028dfd Mon Sep 17 00:00:00 2001 From: Stuart Pomeroy Date: Tue, 29 Mar 2016 09:58:07 +0100 Subject: [PATCH] Closes #443, #466, #468 --- src/main/java/techreborn/items/tools/ItemWrench.java | 4 ++-- .../java/techreborn/tiles/storage/TileEnergyStorage.java | 6 ++++++ 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/src/main/java/techreborn/items/tools/ItemWrench.java b/src/main/java/techreborn/items/tools/ItemWrench.java index beac5f88d..57a4a1b04 100644 --- a/src/main/java/techreborn/items/tools/ItemWrench.java +++ b/src/main/java/techreborn/items/tools/ItemWrench.java @@ -26,7 +26,7 @@ import techreborn.blocks.storage.BlockBatBox; import techreborn.client.TechRebornCreativeTabMisc; import techreborn.items.ItemTR; import techreborn.lib.ModInfo; -import techreborn.tiles.storage.TileBatBox; +import techreborn.tiles.storage.TileEnergyStorage; import java.util.ArrayList; import java.util.List; @@ -60,7 +60,7 @@ public class ItemWrench extends ItemTR implements ITexturedItem if (!player.isSneaking()) { - if (tile instanceof TileBatBox) + if (tile instanceof TileEnergyStorage) { tile.getWorld().setBlockState(tile.getPos(), tile.getWorld().getBlockState(pos).withProperty(BlockBatBox.FACING, side.getOpposite())); diff --git a/src/main/java/techreborn/tiles/storage/TileEnergyStorage.java b/src/main/java/techreborn/tiles/storage/TileEnergyStorage.java index 55626fa84..e990844e2 100644 --- a/src/main/java/techreborn/tiles/storage/TileEnergyStorage.java +++ b/src/main/java/techreborn/tiles/storage/TileEnergyStorage.java @@ -65,6 +65,9 @@ public class TileEnergyStorage extends TilePowerAcceptor implements IWrenchable, if (inventory.getStackInSlot(0) != null) { ItemStack stack = inventory.getStackInSlot(0); + if(!(stack.getItem() instanceof IEnergyItemInfo)){ + return; + } IEnergyItemInfo item = (IEnergyItemInfo) inventory.getStackInSlot(0).getItem(); if (PoweredItem.getEnergy(stack) != PoweredItem.getMaxPower(stack)) { @@ -78,6 +81,9 @@ public class TileEnergyStorage extends TilePowerAcceptor implements IWrenchable, if (inventory.getStackInSlot(1) != null) { ItemStack stack = inventory.getStackInSlot(1); + if(!(stack.getItem() instanceof IEnergyItemInfo)){ + return; + } IEnergyItemInfo item = (IEnergyItemInfo) stack.getItem(); if (item.canProvideEnergy(stack)) {