From 603d0fd7ea85392c16665ef4502bbf5037cfd6ca Mon Sep 17 00:00:00 2001 From: cp Date: Thu, 19 Sep 2013 02:15:49 +0800 Subject: [PATCH] Fixed bug that produced masses of painted items. --- .../machine/painter/TileEntityPainter.java | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/common/crazypants/enderio/machine/painter/TileEntityPainter.java b/common/crazypants/enderio/machine/painter/TileEntityPainter.java index cf99212b..cb7b4117 100644 --- a/common/crazypants/enderio/machine/painter/TileEntityPainter.java +++ b/common/crazypants/enderio/machine/painter/TileEntityPainter.java @@ -29,13 +29,13 @@ public class TileEntityPainter extends AbstractPoweredTaskEntity implements ISid @Override public boolean isMachineItemValidForSlot(int i, ItemStack itemStack) { - if (i > 1) { + if(i > 1) { return false; } - if (i == 0) { + if(i == 0) { return !MachineRecipeRegistry.instance.getRecipesForInput(getMachineName(), RecipeInput.create(i, itemStack)).isEmpty(); } - if (inventory[0] == null) { + if(inventory[0] == null) { return BasicPainterTemplate.isValidSourceDefault(itemStack); } return MachineRecipeRegistry.instance.getRecipeForInputs(getMachineName(), @@ -54,23 +54,22 @@ public class TileEntityPainter extends AbstractPoweredTaskEntity implements ISid private RecipeInput paintSource() { return RecipeInput.create(1, inventory[1]); } - - @Override protected int getNumCanMerge(ItemStack itemStack, ItemStack result) { - if (!result.isItemEqual(inventory[2])) { + if(!result.isItemEqual(inventory[2])) { // next result is a different item type return 0; } int cookedId = result.getTagCompound().getInteger(BlockPainter.KEY_SOURCE_BLOCK_ID); int invId = inventory[2].getTagCompound().getInteger(BlockPainter.KEY_SOURCE_BLOCK_ID); - if (cookedId != invId) { + if(cookedId != invId) { // next result has a different source item than the current one return 0; } - return itemStack.getMaxStackSize() - itemStack.stackSize; + + return Math.min(itemStack.getMaxStackSize() - itemStack.stackSize, result.stackSize); } }