diff --git a/buildnumber.txt b/buildnumber.txt index 5d0fcf63c..c53153b17 100644 --- a/buildnumber.txt +++ b/buildnumber.txt @@ -1 +1 @@ -51 +52 diff --git a/info.txt b/info.txt index 5f454570f..228216b48 100644 --- a/info.txt +++ b/info.txt @@ -45,3 +45,4 @@ Minecraft 1.4.5 @ AssemblyLine_v0.2.3.49.jar AssemblyLine_v0.2.3.49_api.zip @ AssemblyLine_v0.2.3.50.jar AssemblyLine_v0.2.3.50_api.zip @ AssemblyLine_v0.2.3.51.jar AssemblyLine_v0.2.3.51_api.zip +@ AssemblyLine_v0.2.3.52.jar AssemblyLine_v0.2.3.52_api.zip diff --git a/src/minecraft/assemblyline/common/machine/imprinter/SlotCraftingResult.java b/src/minecraft/assemblyline/common/machine/imprinter/SlotCraftingResult.java index 7954e73af..fdba224ca 100644 --- a/src/minecraft/assemblyline/common/machine/imprinter/SlotCraftingResult.java +++ b/src/minecraft/assemblyline/common/machine/imprinter/SlotCraftingResult.java @@ -9,9 +9,9 @@ public class SlotCraftingResult extends Slot { private ContainerImprinter container; - public SlotCraftingResult(ContainerImprinter container, IInventory par1iInventory, int par2, int par3, int par4) + public SlotCraftingResult(ContainerImprinter container, IInventory inventory, int par2, int par3, int par4) { - super(par1iInventory, par2, par3, par4); + super(inventory, par2, par3, par4); this.container = container; } @@ -24,8 +24,7 @@ public class SlotCraftingResult extends Slot @Override public boolean canTakeStack(EntityPlayer player) { - return playerHasRequiredIngredients(player, getStack()); - // return true; + return this.container.tileEntity.getIdealRecipe(this.getStack()) != null; } @Override @@ -41,15 +40,15 @@ public class SlotCraftingResult extends Slot { for (ItemStack searchStack : requiredItems) { - for (int i = 0; i < entityPlayer.inventory.getSizeInventory(); i++) + for (int i = 0; i < this.container.tileEntity.getSizeInventory(); i++) { - ItemStack checkStack = entityPlayer.inventory.getStackInSlot(i); + ItemStack checkStack = this.container.tileEntity.getStackInSlot(i); if (checkStack != null) { if (searchStack.isItemEqual(checkStack)) { - entityPlayer.inventory.decrStackSize(i, 1); + this.container.tileEntity.decrStackSize(i, 1); break; } } @@ -59,39 +58,18 @@ public class SlotCraftingResult extends Slot } } - private boolean playerHasRequiredIngredients(EntityPlayer player, ItemStack desiredItem) - { - if (this.getStack() != null) - { - ItemStack[] idealRecipe = this.container.tileEntity.getIdealRecipe(this.getStack()).getValue(); - if (idealRecipe != null) - { - ItemStack[] requiredItems = idealRecipe.clone(); - int foundItems = 0; - - if (requiredItems != null) - { - for (ItemStack searchStack : requiredItems) - { - for (int i = 0; i < player.inventory.getSizeInventory(); i++) - { - ItemStack checkStack = player.inventory.getStackInSlot(i); - - if (checkStack != null) - { - if (searchStack.isItemEqual(checkStack)) - { - foundItems++; - } - } - } - } - } - - if (foundItems >= requiredItems.length) - return true; - } - } - return false; - } + /* + * private boolean playerHasRequiredIngredients(EntityPlayer player, ItemStack desiredItem) { if + * (this.getStack() != null) { ItemStack[] idealRecipe = + * this.container.tileEntity.getIdealRecipe(this.getStack()).getValue(); if (idealRecipe != + * null) { ItemStack[] requiredItems = idealRecipe.clone(); int foundItems = 0; + * + * if (requiredItems != null) { for (ItemStack searchStack : requiredItems) { for (int i = 0; i + * < player.inventory.getSizeInventory(); i++) { ItemStack checkStack = + * player.inventory.getStackInSlot(i); + * + * if (checkStack != null) { if (searchStack.isItemEqual(checkStack)) { foundItems++; } } } } } + * + * if (foundItems >= requiredItems.length) return true; } } return false; } + */ } diff --git a/src/minecraft/assemblyline/common/machine/imprinter/TileEntityImprinter.java b/src/minecraft/assemblyline/common/machine/imprinter/TileEntityImprinter.java index 34f38e5ba..41d495015 100644 --- a/src/minecraft/assemblyline/common/machine/imprinter/TileEntityImprinter.java +++ b/src/minecraft/assemblyline/common/machine/imprinter/TileEntityImprinter.java @@ -67,13 +67,29 @@ public class TileEntityImprinter extends TileEntityAdvanced implements ISidedInv * returns them in a new stack. */ @Override - public ItemStack decrStackSize(int slot, int amount) + public ItemStack decrStackSize(int i, int amount) { - if (this.containingItems[slot] != null) + if (this.containingItems[i] != null) { - ItemStack var3 = this.containingItems[slot]; - this.containingItems[slot] = null; - return var3; + ItemStack var3; + + if (this.containingItems[i].stackSize <= amount) + { + var3 = this.containingItems[i]; + this.containingItems[i] = null; + return var3; + } + else + { + var3 = this.containingItems[i].splitStack(amount); + + if (this.containingItems[i].stackSize == 0) + { + this.containingItems[i] = null; + } + + return var3; + } } else { @@ -196,10 +212,8 @@ public class TileEntityImprinter extends TileEntityAdvanced implements ISidedInv { ArrayList filters = ItemImprinter.getFilters(this.getStackInSlot(3)); - if (filters.size() > 0) + for (ItemStack outputStack : filters) { - ItemStack outputStack = filters.get(0); - if (outputStack != null) { Pair idealRecipe = this.getIdealRecipe(outputStack); @@ -212,6 +226,7 @@ public class TileEntityImprinter extends TileEntityAdvanced implements ISidedInv { this.setInventorySlotContents(4, recipeOutput); didCraft = true; + break; } } } @@ -275,11 +290,11 @@ public class TileEntityImprinter extends TileEntityAdvanced implements ISidedInv } /** - * Returns if players has the following resource required. + * Returns if the following inventory has the following resource required. * * @param recipeItems - The items to be checked for the recipes. */ - private ArrayList hasResource(Object[] recipeItems) + public ArrayList hasResource(Object[] recipeItems) { /** * The actual amount of resource required. Each ItemStack will only have stacksize of 1.