Added code for Pyrolyse Oven to smoothly replace deprecated coils.

This commit is contained in:
OneEyeMaker 2016-07-27 15:26:14 +03:00
parent 078a3bedde
commit be79f288a8

View file

@ -99,6 +99,7 @@ public class GT_MetaTileEntity_PyrolyseOven extends GT_MetaTileEntity_MultiBlock
public boolean checkMachine(IGregTechTileEntity aBaseMetaTileEntity, ItemStack aStack) { public boolean checkMachine(IGregTechTileEntity aBaseMetaTileEntity, ItemStack aStack) {
int xDir = ForgeDirection.getOrientation(aBaseMetaTileEntity.getBackFacing()).offsetX * 2; int xDir = ForgeDirection.getOrientation(aBaseMetaTileEntity.getBackFacing()).offsetX * 2;
int zDir = ForgeDirection.getOrientation(aBaseMetaTileEntity.getBackFacing()).offsetZ * 2; int zDir = ForgeDirection.getOrientation(aBaseMetaTileEntity.getBackFacing()).offsetZ * 2;
replaceDeprecatedCoils(aBaseMetaTileEntity);
for (int i = -2; i < 3; i++) { for (int i = -2; i < 3; i++) {
for (int j = -2; j < 3; j++) { for (int j = -2; j < 3; j++) {
for (int h = 0; h < 4; h++) { 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); 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);
}
}
}
}
} }