parent
c63e9577fe
commit
6d46a03e5d
2 changed files with 37 additions and 14 deletions
|
@ -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()
|
private boolean canSmelt()
|
||||||
{
|
{
|
||||||
if (this.getStackInSlot(input1) == null || this.getStackInSlot(input2) == null)
|
if (this.getStackInSlot(input1) == null || this.getStackInSlot(input2) == null)
|
||||||
|
@ -112,13 +129,8 @@ public class TileAlloyFurnace extends TileMachineBase implements IWrenchable, II
|
||||||
{
|
{
|
||||||
ItemStack itemstack = null;
|
ItemStack itemstack = null;
|
||||||
for(IBaseRecipeType recipeType : RecipeHandler.getRecipeClassFromName(Reference.alloySmelteRecipe)){
|
for(IBaseRecipeType recipeType : RecipeHandler.getRecipeClassFromName(Reference.alloySmelteRecipe)){
|
||||||
for(ItemStack input : recipeType.getInputs()){
|
if(hasAllInputs(recipeType)){
|
||||||
if(ItemUtils.isItemEqual(input, getStackInSlot(input1), true, true, true) || ItemUtils.isItemEqual(input, getStackInSlot(input2), true, true, true)){
|
itemstack = recipeType.getOutput(0);
|
||||||
itemstack = recipeType.getOutput(0);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if(itemstack != null){
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -160,12 +172,19 @@ public class TileAlloyFurnace extends TileMachineBase implements IWrenchable, II
|
||||||
decrStackSize(output, -itemstack.stackSize);
|
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);
|
this.decrStackSize(input1, 1);
|
||||||
|
|
||||||
if (this.getStackInSlot(input1).stackSize <= 0)
|
|
||||||
{
|
|
||||||
setInventorySlotContents(0, null);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -87,13 +87,17 @@ public class TileBlastFurnace extends TilePowerAcceptor implements IWrenchable,
|
||||||
if (tileEntity instanceof TileMachineCasing) {
|
if (tileEntity instanceof TileMachineCasing) {
|
||||||
if (((TileMachineCasing) tileEntity).isConnected() && ((TileMachineCasing) tileEntity).getMultiblockController().isAssembled()) {
|
if (((TileMachineCasing) tileEntity).isConnected() && ((TileMachineCasing) tileEntity).getMultiblockController().isAssembled()) {
|
||||||
MultiBlockCasing casing = ((TileMachineCasing) tileEntity).getMultiblockController();
|
MultiBlockCasing casing = ((TileMachineCasing) tileEntity).getMultiblockController();
|
||||||
|
Location location = new Location(xCoord, yCoord, zCoord, direction);
|
||||||
|
location.modifyPositionFromSide(direction, 1);
|
||||||
int heat = 0;
|
int heat = 0;
|
||||||
|
if(worldObj.getBlock(location.getX(), location.getY() - 1, location.getZ()) == tileEntity.getBlockType()){
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
for (IMultiblockPart part : casing.connectedParts) {
|
for (IMultiblockPart part : casing.connectedParts) {
|
||||||
heat += BlockMachineCasing.getHeatFromMeta(part.getWorldObj().getBlockMetadata(part.getWorldLocation().x, part.getWorldLocation().y, part.getWorldLocation().z));
|
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")) {
|
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;
|
heat += 500;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue