From 44a21fd13d012a09cc35215fae9cb5d2b379410b Mon Sep 17 00:00:00 2001 From: modmuss50 Date: Sat, 16 May 2015 21:30:20 +0100 Subject: [PATCH] Fixed some things --- .../techreborn/api/recipe/RecipeCrafter.java | 26 ++++++++++++------- 1 file changed, 17 insertions(+), 9 deletions(-) diff --git a/src/main/java/techreborn/api/recipe/RecipeCrafter.java b/src/main/java/techreborn/api/recipe/RecipeCrafter.java index 4a60a949f..9ddea2a12 100644 --- a/src/main/java/techreborn/api/recipe/RecipeCrafter.java +++ b/src/main/java/techreborn/api/recipe/RecipeCrafter.java @@ -4,6 +4,9 @@ import ic2.api.energy.prefab.BasicSink; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.network.Packet; +import net.minecraft.network.play.server.S35PacketUpdateTileEntity; +import techreborn.packets.PacketHandler; import techreborn.tiles.TileMachineBase; import techreborn.util.Inventory; import techreborn.util.ItemUtils; @@ -124,11 +127,7 @@ public class RecipeCrafter { filledSlots.add(outputSlots[i]); } } - for (int i = 0; i < inputs; i++) { - if (!filledSlots.contains(inputSlots[i])) { - inventory.decrStackSize(inputSlots[i], currentRecipe.getInputs().get(i).stackSize); - } - } + useAllInputs(); currentRecipe = null; currentTickTime = 0; parentTile.syncWithAll(); @@ -178,6 +177,19 @@ public class RecipeCrafter { return true; } + public void useAllInputs(){ + if(currentRecipe == null){ + return; + } + for(ItemStack input : currentRecipe.getInputs()){ + for(int inputSlot : inputSlots){ + if(ItemUtils.isItemEqual(input, inventory.getStackInSlot(inputSlot), true, true, true)){ + inventory.decrStackSize(inputSlot, input.stackSize); + } + } + } + } + public boolean canFitStack(ItemStack stack, int slot) { if (stack == null) { return true; @@ -194,10 +206,6 @@ public class RecipeCrafter { } public void fitStack(ItemStack stack, int slot) { - //Don't do this on the client. - if (parentTile.getWorldObj().isRemote) { - return; - } if (stack == null) { return; }