diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/ContainerBioReactor.java b/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/ContainerBioReactor.java index 333067712..d738dca7a 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/ContainerBioReactor.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/ContainerBioReactor.java @@ -57,7 +57,7 @@ public class ContainerBioReactor extends Container{ //Other Slots in Inventory excluded if(slot >= inventoryStart){ //Shift from Inventory - if(TileEntityBioReactor.isValidItem(newStack.getItem())){ + if(TileEntityBioReactor.isValidItem(newStack)){ if(!this.mergeItemStack(newStack, 0, 8, false)){ return null; } diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityBioReactor.java b/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityBioReactor.java index e8db2f59b..2124d6b22 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityBioReactor.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityBioReactor.java @@ -11,8 +11,10 @@ package de.ellpeck.actuallyadditions.mod.tile; import cofh.api.energy.EnergyStorage; +import net.minecraft.block.Block; import net.minecraft.block.IGrowable; import net.minecraft.item.Item; +import net.minecraft.item.ItemBlock; import net.minecraft.item.ItemFood; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; @@ -49,7 +51,7 @@ public class TileEntityBioReactor extends TileEntityInventoryBase implements ISh ItemStack stack = this.slots[i]; if(stack != null){ Item item = stack.getItem(); - if(isValidItem(item) && (types == null || !types.contains(item))){ + if(isValidItem(stack) && (types == null || !types.contains(item))){ if(types == null){ types = new ArrayList(); } @@ -110,8 +112,21 @@ public class TileEntityBioReactor extends TileEntityInventoryBase implements ISh this.producePerTick = compound.getInteger("ProducePerTick"); } - public static boolean isValidItem(Item item){ - return item instanceof IPlantable || item instanceof IGrowable || item instanceof ItemFood; + public static boolean isValidItem(ItemStack stack){ + if(stack != null){ + Item item = stack.getItem(); + if(isValid(item)){ + return true; + } + else if(item instanceof ItemBlock){ + return isValid(Block.getBlockFromItem(item)); + } + } + return false; + } + + private static boolean isValid(Object o){ + return o instanceof IPlantable || o instanceof IGrowable || o instanceof ItemFood; } @Override @@ -126,7 +141,7 @@ public class TileEntityBioReactor extends TileEntityInventoryBase implements ISh @Override public boolean isItemValidForSlot(int index, ItemStack stack){ - return isValidItem(stack.getItem()); + return isValidItem(stack); } @Override