diff --git a/src/main/java/techreborn/tiles/TileAlloyFurnace.java b/src/main/java/techreborn/tiles/TileAlloyFurnace.java index df3dcf151..8e9bc45e0 100644 --- a/src/main/java/techreborn/tiles/TileAlloyFurnace.java +++ b/src/main/java/techreborn/tiles/TileAlloyFurnace.java @@ -102,6 +102,23 @@ public class TileAlloyFurnace extends TileMachineBase implements IWrenchable, II } + public boolean hasAllInputs(IBaseRecipeType recipeType) { + if (recipeType == null) { + return false; + } + for (ItemStack input : recipeType.getInputs()) { + Boolean hasItem = false; + for (int inputslot = 0; inputslot < 2; inputslot++) { + if (ItemUtils.isItemEqual(input, inventory.getStackInSlot(inputslot), true, true, recipeType.useOreDic()) && inventory.getStackInSlot(inputslot).stackSize >= input.stackSize) { + hasItem = true; + } + } + if (!hasItem) + return false; + } + return true; + } + private boolean canSmelt() { if (this.getStackInSlot(input1) == null || this.getStackInSlot(input2) == null) @@ -112,13 +129,8 @@ public class TileAlloyFurnace extends TileMachineBase implements IWrenchable, II { ItemStack itemstack = null; for(IBaseRecipeType recipeType : RecipeHandler.getRecipeClassFromName(Reference.alloySmelteRecipe)){ - for(ItemStack input : recipeType.getInputs()){ - if(ItemUtils.isItemEqual(input, getStackInSlot(input1), true, true, true) || ItemUtils.isItemEqual(input, getStackInSlot(input2), true, true, true)){ - itemstack = recipeType.getOutput(0); - break; - } - } - if(itemstack != null){ + if(hasAllInputs(recipeType)){ + itemstack = recipeType.getOutput(0); break; } } @@ -160,12 +172,19 @@ public class TileAlloyFurnace extends TileMachineBase implements IWrenchable, II decrStackSize(output, -itemstack.stackSize); } + for(IBaseRecipeType recipeType : RecipeHandler.getRecipeClassFromName(Reference.alloySmelteRecipe)){ + for(ItemStack input : recipeType.getInputs()){ + if(ItemUtils.isItemEqual(input, getStackInSlot(input1), true, true, true)){ + this.decrStackSize(input1, input.stackSize); + } else if(ItemUtils.isItemEqual(input, getStackInSlot(input2), true, true, true)){ + this.decrStackSize(input2, input.stackSize); + } + } + } + this.decrStackSize(input1, 1); - if (this.getStackInSlot(input1).stackSize <= 0) - { - setInventorySlotContents(0, null); - } + } } diff --git a/src/main/java/techreborn/tiles/TileBlastFurnace.java b/src/main/java/techreborn/tiles/TileBlastFurnace.java index f7e3b4953..4aa781db7 100644 --- a/src/main/java/techreborn/tiles/TileBlastFurnace.java +++ b/src/main/java/techreborn/tiles/TileBlastFurnace.java @@ -87,13 +87,17 @@ public class TileBlastFurnace extends TilePowerAcceptor implements IWrenchable, if (tileEntity instanceof TileMachineCasing) { if (((TileMachineCasing) tileEntity).isConnected() && ((TileMachineCasing) tileEntity).getMultiblockController().isAssembled()) { MultiBlockCasing casing = ((TileMachineCasing) tileEntity).getMultiblockController(); + Location location = new Location(xCoord, yCoord, zCoord, direction); + location.modifyPositionFromSide(direction, 1); int heat = 0; - + if(worldObj.getBlock(location.getX(), location.getY() - 1, location.getZ()) == tileEntity.getBlockType()){ + return 0; + } + for (IMultiblockPart part : casing.connectedParts) { heat += BlockMachineCasing.getHeatFromMeta(part.getWorldObj().getBlockMetadata(part.getWorldLocation().x, part.getWorldLocation().y, part.getWorldLocation().z)); } - Location location = new Location(xCoord, yCoord, zCoord, direction); - location.modifyPositionFromSide(direction, 1); + if (worldObj.getBlock(location.getX(), location.getY(), location.getZ()).getUnlocalizedName().equals("tile.lava") && worldObj.getBlock(location.getX(), location.getY() + 1, location.getZ()).getUnlocalizedName().equals("tile.lava")) { heat += 500; }