From a8647b89297bdb1b36c1c19f66a4c7621cbfc449 Mon Sep 17 00:00:00 2001 From: OneEyeMaker Date: Wed, 27 Jul 2016 13:02:12 +0300 Subject: [PATCH 1/4] 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); + } + } + } + } + } } From 848f84f35c37ff05c234f0c60a8530e0d37075b5 Mon Sep 17 00:00:00 2001 From: OneEyeMaker Date: Wed, 27 Jul 2016 13:17:57 +0300 Subject: [PATCH 2/4] Added code for Multi Smelter to smoothly replace deprecated coils. --- .../multi/GT_MetaTileEntity_MultiFurnace.java | 20 ++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_MultiFurnace.java b/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_MultiFurnace.java index a1c18636..c9e03a5c 100644 --- a/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_MultiFurnace.java +++ b/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_MultiFurnace.java @@ -106,7 +106,7 @@ public class GT_MetaTileEntity_MultiFurnace return false; } addMufflerToMachineList(aBaseMetaTileEntity.getIGregTechTileEntityOffset(xDir, 2, zDir), 11); - + replaceDeprecatedCoils(aBaseMetaTileEntity); byte tUsedMeta = aBaseMetaTileEntity.getMetaIDOffset(xDir + 1, 1, zDir); switch (tUsedMeta) { case 0: @@ -195,4 +195,22 @@ public class GT_MetaTileEntity_MultiFurnace 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; + } + tUsedMeta = aBaseMetaTileEntity.getMetaID(xPos, y + 1, zPos); + if (tUsedMeta >= 12 && tUsedMeta <= 14 && aBaseMetaTileEntity.getBlock(xPos, y + 1, zPos) == GregTech_API.sBlockCasings1) { + aBaseMetaTileEntity.getWorld().setBlock(xPos, y + 1, zPos, GregTech_API.sBlockCasings5, tUsedMeta - 12, 3); + } + } + } + } } From 078a3bedde7d6cd0318e53792a5ca1c2338de407 Mon Sep 17 00:00:00 2001 From: OneEyeMaker Date: Wed, 27 Jul 2016 14:59:56 +0300 Subject: [PATCH 3/4] Added code for Oil Cracker to smoothly replace deprecated coils. --- ...T_MetaTileEntity_ElectricBlastFurnace.java | 16 +++++++------ .../multi/GT_MetaTileEntity_MultiFurnace.java | 20 +++++++++------- .../multi/GT_MetaTileEntity_OilCracker.java | 24 +++++++++++++++++-- 3 files changed, 42 insertions(+), 18 deletions(-) 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 0fa4142c..62189600 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 @@ -233,16 +233,18 @@ public class GT_MetaTileEntity_ElectricBlastFurnace } 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 xDir = ForgeDirection.getOrientation(aBaseMetaTileEntity.getBackFacing()).offsetX; + int zDir = ForgeDirection.getOrientation(aBaseMetaTileEntity.getBackFacing()).offsetZ; + int tX = aBaseMetaTileEntity.getXCoord() + xDir; + int tY = (int) aBaseMetaTileEntity.getYCoord(); + int tZ = aBaseMetaTileEntity.getZCoord() + zDir; 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)) { + for (int xPos = tX - 1; xPos <= tX + 1; xPos++) { + for (int zPos = tZ - 1; zPos <= tZ + 1; zPos++) { + if ((xPos == tX) && (zPos == tZ)) { continue; } - for (int yPos = y + 1; yPos <= y + 2; yPos++) { + for (int yPos = tY + 1; yPos <= tY + 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); diff --git a/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_MultiFurnace.java b/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_MultiFurnace.java index c9e03a5c..8a608bf8 100644 --- a/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_MultiFurnace.java +++ b/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_MultiFurnace.java @@ -197,18 +197,20 @@ public class GT_MetaTileEntity_MultiFurnace } 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 xDir = ForgeDirection.getOrientation(aBaseMetaTileEntity.getBackFacing()).offsetX; + int zDir = ForgeDirection.getOrientation(aBaseMetaTileEntity.getBackFacing()).offsetZ; + int tX = aBaseMetaTileEntity.getXCoord() + xDir; + int tY = (int) aBaseMetaTileEntity.getYCoord(); + int tZ = aBaseMetaTileEntity.getZCoord() + zDir; 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)) { + for (int xPos = tX - 1; xPos <= tX + 1; xPos++) { + for (int zPos = tZ - 1; zPos <= tZ + 1; zPos++) { + if ((xPos == tX) && (zPos == tZ)) { continue; } - tUsedMeta = aBaseMetaTileEntity.getMetaID(xPos, y + 1, zPos); - if (tUsedMeta >= 12 && tUsedMeta <= 14 && aBaseMetaTileEntity.getBlock(xPos, y + 1, zPos) == GregTech_API.sBlockCasings1) { - aBaseMetaTileEntity.getWorld().setBlock(xPos, y + 1, zPos, GregTech_API.sBlockCasings5, tUsedMeta - 12, 3); + tUsedMeta = aBaseMetaTileEntity.getMetaID(xPos, tY + 1, zPos); + if (tUsedMeta >= 12 && tUsedMeta <= 14 && aBaseMetaTileEntity.getBlock(xPos, tY + 1, zPos) == GregTech_API.sBlockCasings1) { + aBaseMetaTileEntity.getWorld().setBlock(xPos, tY + 1, zPos, GregTech_API.sBlockCasings5, tUsedMeta - 12, 3); } } } diff --git a/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_OilCracker.java b/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_OilCracker.java index 52936880..d0354dc1 100644 --- a/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_OilCracker.java +++ b/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_OilCracker.java @@ -113,13 +113,13 @@ public class GT_MetaTileEntity_OilCracker extends GT_MetaTileEntity_MultiBlockBa int xDir = ForgeDirection.getOrientation(aBaseMetaTileEntity.getBackFacing()).offsetX; int zDir = ForgeDirection.getOrientation(aBaseMetaTileEntity.getBackFacing()).offsetZ; int amount = 0; + replaceDeprecatedCoils(aBaseMetaTileEntity); if (xDir != 0) { for (int i = -1; i < 2; i++) {// xDirection for (int j = -1; j < 2; j++) {// height for (int h = -2; h < 3; h++) { if (!(j == 0 && i == 0 && (h == -1 || h == 0 || h == 1))) { if (h == 1 || h == -1) { - IGregTechTileEntity tTileEntity = aBaseMetaTileEntity.getIGregTechTileEntityOffset(xDir + i, j, h + zDir); if (aBaseMetaTileEntity.getBlockOffset(xDir + i, j, h + zDir) != GregTech_API.sBlockCasings5) { return false; } @@ -166,7 +166,6 @@ public class GT_MetaTileEntity_OilCracker extends GT_MetaTileEntity_MultiBlockBa for (int h = -2; h < 3; h++) { if (!(j == 0 && i == 0 && (h == -1 || h == 0 || h == 1))) { if (h == 1 || h == -1) { - IGregTechTileEntity tTileEntity = aBaseMetaTileEntity.getIGregTechTileEntityOffset(xDir + h, j, i + zDir); if (aBaseMetaTileEntity.getBlockOffset(xDir + h, j, i + zDir) != GregTech_API.sBlockCasings5) { return false; } @@ -246,4 +245,25 @@ public class GT_MetaTileEntity_OilCracker extends GT_MetaTileEntity_MultiBlockBa return new GT_MetaTileEntity_OilCracker(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; + int tY = (int) aBaseMetaTileEntity.getYCoord(); + int tZ = aBaseMetaTileEntity.getZCoord() + zDir; + for (int xPos = tX - 1; xPos <= tX + 1; xPos += (xDir != 0 ? 1 : 2)) { + for (int yPos = tY - 1; yPos <= tY + 1; yPos++) { + for (int zPos = tZ - 1; zPos <= tZ + 1; zPos += (xDir != 0 ? 2 : 1)) { + if ((yPos == tY) && (xPos == tX || zPos == tZ)) { + continue; + } + if (aBaseMetaTileEntity.getBlock(xPos, yPos, zPos) == GregTech_API.sBlockCasings1 && + aBaseMetaTileEntity.getMetaID(xPos, yPos, zPos) == 12) + { + aBaseMetaTileEntity.getWorld().setBlock(xPos, yPos, zPos, GregTech_API.sBlockCasings5, 0, 3); + } + } + } + } + } } From be79f288a8e058677d09c40e11524282d27dc313 Mon Sep 17 00:00:00 2001 From: OneEyeMaker Date: Wed, 27 Jul 2016 15:26:14 +0300 Subject: [PATCH 4/4] 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); + } + } + } + } }