From be79f288a8e058677d09c40e11524282d27dc313 Mon Sep 17 00:00:00 2001 From: OneEyeMaker Date: Wed, 27 Jul 2016 15:26:14 +0300 Subject: [PATCH] Added code for Pyrolyse Oven to smoothly replace deprecated coils. --- .../multi/GT_MetaTileEntity_PyrolyseOven.java | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_PyrolyseOven.java b/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_PyrolyseOven.java index 4e323439..e8b83825 100644 --- a/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_PyrolyseOven.java +++ b/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_PyrolyseOven.java @@ -99,6 +99,7 @@ public class GT_MetaTileEntity_PyrolyseOven extends GT_MetaTileEntity_MultiBlock public boolean checkMachine(IGregTechTileEntity aBaseMetaTileEntity, ItemStack aStack) { int xDir = ForgeDirection.getOrientation(aBaseMetaTileEntity.getBackFacing()).offsetX * 2; int zDir = ForgeDirection.getOrientation(aBaseMetaTileEntity.getBackFacing()).offsetZ * 2; + replaceDeprecatedCoils(aBaseMetaTileEntity); for (int i = -2; i < 3; i++) { for (int j = -2; j < 3; j++) { for (int h = 0; h < 4; h++) { @@ -186,4 +187,20 @@ public class GT_MetaTileEntity_PyrolyseOven extends GT_MetaTileEntity_MultiBlock return new GT_MetaTileEntity_PyrolyseOven(this.mName); } + private void replaceDeprecatedCoils(IGregTechTileEntity aBaseMetaTileEntity) { + int xDir = ForgeDirection.getOrientation(aBaseMetaTileEntity.getBackFacing()).offsetX; + int zDir = ForgeDirection.getOrientation(aBaseMetaTileEntity.getBackFacing()).offsetZ; + int tX = aBaseMetaTileEntity.getXCoord() + xDir * 2; + int tY = (int) aBaseMetaTileEntity.getYCoord(); + int tZ = aBaseMetaTileEntity.getZCoord() + zDir * 2; + for (int xPos = tX - 1; xPos <= tX + 1; xPos++) { + for (int zPos = tZ - 1; zPos <= tZ + 1; zPos++) { + if (aBaseMetaTileEntity.getBlock(xPos, tY, zPos) == GregTech_API.sBlockCasings1 && + aBaseMetaTileEntity.getMetaID(xPos, tY, zPos) == 13) + { + aBaseMetaTileEntity.getWorld().setBlock(xPos, tY, zPos, GregTech_API.sBlockCasings5, 1, 3); + } + } + } + } }