From a8647b89297bdb1b36c1c19f66a4c7621cbfc449 Mon Sep 17 00:00:00 2001 From: OneEyeMaker Date: Wed, 27 Jul 2016 13:02:12 +0300 Subject: [PATCH] Added code for Electric Blast Furnace to smoothly replace deprecated coils. --- ...T_MetaTileEntity_ElectricBlastFurnace.java | 22 ++++++++++++++++++- 1 file changed, 21 insertions(+), 1 deletion(-) diff --git a/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_ElectricBlastFurnace.java b/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_ElectricBlastFurnace.java index 9d160416..0fa4142c 100644 --- a/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_ElectricBlastFurnace.java +++ b/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_ElectricBlastFurnace.java @@ -142,7 +142,7 @@ public class GT_MetaTileEntity_ElectricBlastFurnace return false; } addMufflerToMachineList(aBaseMetaTileEntity.getIGregTechTileEntityOffset(xDir, 3, zDir), 11); - + replaceDeprecatedCoils(aBaseMetaTileEntity); byte tUsedMeta = aBaseMetaTileEntity.getMetaIDOffset(xDir + 1, 2, zDir); switch (tUsedMeta) { case 0: @@ -231,4 +231,24 @@ public class GT_MetaTileEntity_ElectricBlastFurnace public boolean explodesOnComponentBreak(ItemStack aStack) { return false; } + + private void replaceDeprecatedCoils(IGregTechTileEntity aBaseMetaTileEntity) { + int x = aBaseMetaTileEntity.getXCoord() + ForgeDirection.getOrientation(aBaseMetaTileEntity.getBackFacing()).offsetX; + int y = (int) aBaseMetaTileEntity.getYCoord(); + int z = aBaseMetaTileEntity.getZCoord() + ForgeDirection.getOrientation(aBaseMetaTileEntity.getBackFacing()).offsetZ; + int tUsedMeta; + for (int xPos = x - 1; xPos <= x + 1; xPos++) { + for (int zPos = z - 1; zPos <= z + 1; zPos++) { + if ((xPos == x) && (zPos == z)) { + continue; + } + for (int yPos = y + 1; yPos <= y + 2; yPos++) { + tUsedMeta = aBaseMetaTileEntity.getMetaID(xPos, yPos, zPos); + if (tUsedMeta >= 12 && tUsedMeta <= 14 && aBaseMetaTileEntity.getBlock(xPos, yPos, zPos) == GregTech_API.sBlockCasings1) { + aBaseMetaTileEntity.getWorld().setBlock(xPos, yPos, zPos, GregTech_API.sBlockCasings5, tUsedMeta - 12, 3); + } + } + } + } + } }