diff --git a/src/main/java/forestry/arboriculture/gadgets/TileLeaves.java b/src/main/java/forestry/arboriculture/gadgets/TileLeaves.java index 43aa22912..13078037a 100755 --- a/src/main/java/forestry/arboriculture/gadgets/TileLeaves.java +++ b/src/main/java/forestry/arboriculture/gadgets/TileLeaves.java @@ -96,7 +96,7 @@ public class TileLeaves extends TileTreeContainer implements IPollinatable, IFru maturationTime = nbttagcompound.getInteger("CATMAT"); caterpillar = (IButterfly)AlleleManager.alleleRegistry.getSpeciesRoot("rootButterflies").getMember(nbttagcompound.getCompoundTag("CATER")); } - + isDecorative = nbttagcompound.getBoolean("Decorative"); } @Override @@ -114,7 +114,7 @@ public class TileLeaves extends TileTreeContainer implements IPollinatable, IFru caterpillar.writeToNBT(subcompound); nbttagcompound.setTag("CATER", subcompound); } - + nbttagcompound.setBoolean("Decorative", isDecorative); } @Override diff --git a/src/main/java/forestry/core/utils/ShapedRecipeCustom.java b/src/main/java/forestry/core/utils/ShapedRecipeCustom.java index bb1460a45..5ca111b38 100755 --- a/src/main/java/forestry/core/utils/ShapedRecipeCustom.java +++ b/src/main/java/forestry/core/utils/ShapedRecipeCustom.java @@ -135,7 +135,7 @@ public class ShapedRecipeCustom implements IDescriptiveRecipe { if (resource == null && compare == null) return true; - if (resource == null && compare != null || resource != null && compare == null) + if (resource == null || compare == null) return false; if (compare.getItem() != resource.getItem()) diff --git a/src/main/java/forestry/factory/gadgets/MachineCentrifuge.java b/src/main/java/forestry/factory/gadgets/MachineCentrifuge.java index 587f62f8a..dbf8f03f2 100755 --- a/src/main/java/forestry/factory/gadgets/MachineCentrifuge.java +++ b/src/main/java/forestry/factory/gadgets/MachineCentrifuge.java @@ -64,9 +64,7 @@ public class MachineCentrifuge extends TilePowered implements ISidedInventory, I public boolean matches(ItemStack res) { if (res == null && resource == null) return true; - else if (res == null && resource != null) - return false; - else if (res != null && resource == null) + else if (res == null || resource == null) return false; else return resource.isItemEqual(res); @@ -428,10 +426,11 @@ public class MachineCentrifuge extends TilePowered implements ISidedInventory, I ItemStack product = null; for (int i = SLOT_PRODUCT_1; i < inventory.getSizeInventory(); i++) { - if (inventory.getStackInSlot(i) == null) + ItemStack stack = inventory.getStackInSlot(i); + if (stack == null) continue; - product = new ItemStack(inventory.getStackInSlot(i).getItem(), 1, inventory.getStackInSlot(i).getItemDamage()); + product = StackUtils.createSplitStack(stack, 1); if (doRemove) decrStackSize(i, 1); @@ -446,24 +445,25 @@ public class MachineCentrifuge extends TilePowered implements ISidedInventory, I @Override public int addItem(ItemStack stack, boolean doAdd, ForgeDirection from) { - if (inventory.getStackInSlot(SLOT_RESOURCE) == null) { + ItemStack resource = inventory.getStackInSlot(SLOT_RESOURCE); + if (resource == null) { if (doAdd) inventory.setInventorySlotContents(SLOT_RESOURCE, stack.copy()); return stack.stackSize; } - if (!inventory.getStackInSlot(SLOT_RESOURCE).isItemEqual(stack)) + if (!StackUtils.isIdenticalItem(resource, stack)) return 0; - int space = inventory.getStackInSlot(SLOT_RESOURCE).getMaxStackSize() - inventory.getStackInSlot(SLOT_RESOURCE).stackSize; + int space = resource.getMaxStackSize() - resource.stackSize; if (space <= 0) return 0; if (doAdd) if (stack.stackSize <= space) - inventory.getStackInSlot(SLOT_RESOURCE).stackSize += stack.stackSize; + resource.stackSize += stack.stackSize; else - inventory.getStackInSlot(SLOT_RESOURCE).stackSize += space; + resource.stackSize += space; return Math.min(stack.stackSize, space); }