Added code for Oil Cracker to smoothly replace deprecated coils.
This commit is contained in:
parent
848f84f35c
commit
078a3bedde
3 changed files with 42 additions and 18 deletions
|
@ -233,16 +233,18 @@ public class GT_MetaTileEntity_ElectricBlastFurnace
|
||||||
}
|
}
|
||||||
|
|
||||||
private void replaceDeprecatedCoils(IGregTechTileEntity aBaseMetaTileEntity) {
|
private void replaceDeprecatedCoils(IGregTechTileEntity aBaseMetaTileEntity) {
|
||||||
int x = aBaseMetaTileEntity.getXCoord() + ForgeDirection.getOrientation(aBaseMetaTileEntity.getBackFacing()).offsetX;
|
int xDir = ForgeDirection.getOrientation(aBaseMetaTileEntity.getBackFacing()).offsetX;
|
||||||
int y = (int) aBaseMetaTileEntity.getYCoord();
|
int zDir = ForgeDirection.getOrientation(aBaseMetaTileEntity.getBackFacing()).offsetZ;
|
||||||
int z = aBaseMetaTileEntity.getZCoord() + ForgeDirection.getOrientation(aBaseMetaTileEntity.getBackFacing()).offsetZ;
|
int tX = aBaseMetaTileEntity.getXCoord() + xDir;
|
||||||
|
int tY = (int) aBaseMetaTileEntity.getYCoord();
|
||||||
|
int tZ = aBaseMetaTileEntity.getZCoord() + zDir;
|
||||||
int tUsedMeta;
|
int tUsedMeta;
|
||||||
for (int xPos = x - 1; xPos <= x + 1; xPos++) {
|
for (int xPos = tX - 1; xPos <= tX + 1; xPos++) {
|
||||||
for (int zPos = z - 1; zPos <= z + 1; zPos++) {
|
for (int zPos = tZ - 1; zPos <= tZ + 1; zPos++) {
|
||||||
if ((xPos == x) && (zPos == z)) {
|
if ((xPos == tX) && (zPos == tZ)) {
|
||||||
continue;
|
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);
|
tUsedMeta = aBaseMetaTileEntity.getMetaID(xPos, yPos, zPos);
|
||||||
if (tUsedMeta >= 12 && tUsedMeta <= 14 && aBaseMetaTileEntity.getBlock(xPos, yPos, zPos) == GregTech_API.sBlockCasings1) {
|
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);
|
aBaseMetaTileEntity.getWorld().setBlock(xPos, yPos, zPos, GregTech_API.sBlockCasings5, tUsedMeta - 12, 3);
|
||||||
|
|
|
@ -197,18 +197,20 @@ public class GT_MetaTileEntity_MultiFurnace
|
||||||
}
|
}
|
||||||
|
|
||||||
private void replaceDeprecatedCoils(IGregTechTileEntity aBaseMetaTileEntity) {
|
private void replaceDeprecatedCoils(IGregTechTileEntity aBaseMetaTileEntity) {
|
||||||
int x = aBaseMetaTileEntity.getXCoord() + ForgeDirection.getOrientation(aBaseMetaTileEntity.getBackFacing()).offsetX;
|
int xDir = ForgeDirection.getOrientation(aBaseMetaTileEntity.getBackFacing()).offsetX;
|
||||||
int y = (int) aBaseMetaTileEntity.getYCoord();
|
int zDir = ForgeDirection.getOrientation(aBaseMetaTileEntity.getBackFacing()).offsetZ;
|
||||||
int z = aBaseMetaTileEntity.getZCoord() + ForgeDirection.getOrientation(aBaseMetaTileEntity.getBackFacing()).offsetZ;
|
int tX = aBaseMetaTileEntity.getXCoord() + xDir;
|
||||||
|
int tY = (int) aBaseMetaTileEntity.getYCoord();
|
||||||
|
int tZ = aBaseMetaTileEntity.getZCoord() + zDir;
|
||||||
int tUsedMeta;
|
int tUsedMeta;
|
||||||
for (int xPos = x - 1; xPos <= x + 1; xPos++) {
|
for (int xPos = tX - 1; xPos <= tX + 1; xPos++) {
|
||||||
for (int zPos = z - 1; zPos <= z + 1; zPos++) {
|
for (int zPos = tZ - 1; zPos <= tZ + 1; zPos++) {
|
||||||
if ((xPos == x) && (zPos == z)) {
|
if ((xPos == tX) && (zPos == tZ)) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
tUsedMeta = aBaseMetaTileEntity.getMetaID(xPos, y + 1, zPos);
|
tUsedMeta = aBaseMetaTileEntity.getMetaID(xPos, tY + 1, zPos);
|
||||||
if (tUsedMeta >= 12 && tUsedMeta <= 14 && aBaseMetaTileEntity.getBlock(xPos, y + 1, zPos) == GregTech_API.sBlockCasings1) {
|
if (tUsedMeta >= 12 && tUsedMeta <= 14 && aBaseMetaTileEntity.getBlock(xPos, tY + 1, zPos) == GregTech_API.sBlockCasings1) {
|
||||||
aBaseMetaTileEntity.getWorld().setBlock(xPos, y + 1, zPos, GregTech_API.sBlockCasings5, tUsedMeta - 12, 3);
|
aBaseMetaTileEntity.getWorld().setBlock(xPos, tY + 1, zPos, GregTech_API.sBlockCasings5, tUsedMeta - 12, 3);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -113,13 +113,13 @@ public class GT_MetaTileEntity_OilCracker extends GT_MetaTileEntity_MultiBlockBa
|
||||||
int xDir = ForgeDirection.getOrientation(aBaseMetaTileEntity.getBackFacing()).offsetX;
|
int xDir = ForgeDirection.getOrientation(aBaseMetaTileEntity.getBackFacing()).offsetX;
|
||||||
int zDir = ForgeDirection.getOrientation(aBaseMetaTileEntity.getBackFacing()).offsetZ;
|
int zDir = ForgeDirection.getOrientation(aBaseMetaTileEntity.getBackFacing()).offsetZ;
|
||||||
int amount = 0;
|
int amount = 0;
|
||||||
|
replaceDeprecatedCoils(aBaseMetaTileEntity);
|
||||||
if (xDir != 0) {
|
if (xDir != 0) {
|
||||||
for (int i = -1; i < 2; i++) {// xDirection
|
for (int i = -1; i < 2; i++) {// xDirection
|
||||||
for (int j = -1; j < 2; j++) {// height
|
for (int j = -1; j < 2; j++) {// height
|
||||||
for (int h = -2; h < 3; h++) {
|
for (int h = -2; h < 3; h++) {
|
||||||
if (!(j == 0 && i == 0 && (h == -1 || h == 0 || h == 1))) {
|
if (!(j == 0 && i == 0 && (h == -1 || h == 0 || h == 1))) {
|
||||||
if (h == 1 || 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) {
|
if (aBaseMetaTileEntity.getBlockOffset(xDir + i, j, h + zDir) != GregTech_API.sBlockCasings5) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -166,7 +166,6 @@ public class GT_MetaTileEntity_OilCracker extends GT_MetaTileEntity_MultiBlockBa
|
||||||
for (int h = -2; h < 3; h++) {
|
for (int h = -2; h < 3; h++) {
|
||||||
if (!(j == 0 && i == 0 && (h == -1 || h == 0 || h == 1))) {
|
if (!(j == 0 && i == 0 && (h == -1 || h == 0 || h == 1))) {
|
||||||
if (h == 1 || 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) {
|
if (aBaseMetaTileEntity.getBlockOffset(xDir + h, j, i + zDir) != GregTech_API.sBlockCasings5) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -246,4 +245,25 @@ public class GT_MetaTileEntity_OilCracker extends GT_MetaTileEntity_MultiBlockBa
|
||||||
return new GT_MetaTileEntity_OilCracker(this.mName);
|
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);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue