The Large Chemical Reactor can now have its Cupronickel Coil on any side

This commit is contained in:
Johannes Gäßler 2017-11-22 22:43:11 +01:00
parent d83d52647a
commit b2374a5675

View file

@ -21,7 +21,7 @@ import java.util.ArrayList;
public class GT_MetaTileEntity_LargeChemicalReactor extends GT_MetaTileEntity_MultiBlockBase { public class GT_MetaTileEntity_LargeChemicalReactor extends GT_MetaTileEntity_MultiBlockBase {
private final int CASING_INDEX = 176; private final int CASING_INDEX = 176;
public GT_MetaTileEntity_LargeChemicalReactor(int aID, String aName, String aNameRegional) { public GT_MetaTileEntity_LargeChemicalReactor(int aID, String aName, String aNameRegional) {
super(aID, aName, aNameRegional); super(aID, aName, aNameRegional);
} }
@ -45,12 +45,12 @@ public class GT_MetaTileEntity_LargeChemicalReactor extends GT_MetaTileEntity_Mu
"Size(WxHxD): 3x3x3", "Size(WxHxD): 3x3x3",
"3x3x3 of Chemically Inert Machine Casings (hollow, min 8!)", "3x3x3 of Chemically Inert Machine Casings (hollow, min 8!)",
"Controller (Front centered)", "Controller (Front centered)",
"1x Cupronickel Coil Block (Bottom centered)",
"1x PTFE Pipe Machine Casing (inside the hollow casings)", "1x PTFE Pipe Machine Casing (inside the hollow casings)",
"1x Cupronickel Coil Block (next to PTFE Pipe Machine Casing)",
"1x Input Bus/Hatch (Any inert casing)", "1x Input Bus/Hatch (Any inert casing)",
"1x Output Bus/Hatch (Any inert casing)", "1x Output Bus/Hatch (Any inert casing)",
"1x Maintenance Hatch (Any inert casing)", "1x Maintenance Hatch (Any inert casing)",
"1x Energy Hatch (Any inert casing)"}; "1x Energy Hatch (Any inert casing)" };
} }
@Override @Override
@ -64,11 +64,11 @@ public class GT_MetaTileEntity_LargeChemicalReactor extends GT_MetaTileEntity_Mu
} }
return new ITexture[] { Textures.BlockIcons.casingTexturePages[1][48] }; return new ITexture[] { Textures.BlockIcons.casingTexturePages[1][48] };
} }
@Override @Override
public Object getClientGUI(int aID, InventoryPlayer aPlayerInventory, IGregTechTileEntity aBaseMetaTileEntity) { public Object getClientGUI(int aID, InventoryPlayer aPlayerInventory, IGregTechTileEntity aBaseMetaTileEntity) {
return new GT_GUIContainer_MultiMachine(aPlayerInventory, aBaseMetaTileEntity, getLocalName(), "LargeChemicalReactor.png"); return new GT_GUIContainer_MultiMachine(aPlayerInventory, aBaseMetaTileEntity, getLocalName(), "LargeChemicalReactor.png");
} }
@Override @Override
public boolean isCorrectMachinePart(ItemStack aStack) { public boolean isCorrectMachinePart(ItemStack aStack) {
@ -134,7 +134,7 @@ public class GT_MetaTileEntity_LargeChemicalReactor extends GT_MetaTileEntity_Mu
maxProgresstime = 2; maxProgresstime = 2;
EUt = recipe.mEUt * recipe.mDuration / 2; EUt = recipe.mEUt * recipe.mDuration / 2;
} }
this.mEUt = -EUt; this.mEUt = -EUt;
this.mMaxProgresstime = maxProgresstime; this.mMaxProgresstime = maxProgresstime;
this.mOutputItems = recipe.mOutputs; this.mOutputItems = recipe.mOutputs;
@ -151,28 +151,44 @@ public class GT_MetaTileEntity_LargeChemicalReactor extends GT_MetaTileEntity_Mu
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 casingAmount = 0; int casingAmount = 0;
boolean hasHeatingCoil = false;
// x=width, z=depth, y=height // x=width, z=depth, y=height
for (int x = -1 + xDir; x <= xDir + 1; x++) { for (int x = -1 + xDir; x <= xDir + 1; x++) {
for (int z = -1 + zDir; z <= zDir + 1; z++) { for (int z = -1 + zDir; z <= zDir + 1; z++) {
for (int y = -1; y <= 1; y++) { for (int y = -1; y <= 1; y++) {
if (x == 0 && y == 0 && z == 0) {
continue;
}
IGregTechTileEntity tileEntity = aBaseMetaTileEntity.getIGregTechTileEntityOffset(x, y, z); IGregTechTileEntity tileEntity = aBaseMetaTileEntity.getIGregTechTileEntityOffset(x, y, z);
Block block = aBaseMetaTileEntity.getBlockOffset(x, y, z); Block block = aBaseMetaTileEntity.getBlockOffset(x, y, z);
if (x == xDir && z == zDir && y <= 0) { int centerCoords = 0;
if ((y == -1) if (x == xDir) {
&& (block != GregTech_API.sBlockCasings5 || aBaseMetaTileEntity.getMetaIDOffset(x, y, z) != 0)) { centerCoords++;
return false; }
} else if (y == 0 && (block != GregTech_API.sBlockCasings8 || aBaseMetaTileEntity.getMetaIDOffset(x, y, z) != 1)) { if (y == 0) {
centerCoords++;
}
if (z == zDir) {
centerCoords++;
}
if (centerCoords == 3) {
if (block == GregTech_API.sBlockCasings8 && aBaseMetaTileEntity.getMetaIDOffset(x, y, z) == 1) {
continue;
} else {
return false; return false;
} }
} else if (x != 0 || y != 0 || z != 0) { }
if (!addInputToMachineList(tileEntity, CASING_INDEX) && !addOutputToMachineList(tileEntity, CASING_INDEX) if (centerCoords == 2 && block == GregTech_API.sBlockCasings5 && aBaseMetaTileEntity.getMetaIDOffset(x, y, z) == 0) {
&& !addMaintenanceToMachineList(tileEntity, CASING_INDEX) hasHeatingCoil = true;
&& !addEnergyInputToMachineList(tileEntity, CASING_INDEX)) { continue;
if (block == GregTech_API.sBlockCasings8 && aBaseMetaTileEntity.getMetaIDOffset(x, y, z) == 0) { }
casingAmount++; if (!addInputToMachineList(tileEntity, CASING_INDEX) && !addOutputToMachineList(tileEntity, CASING_INDEX)
} else { && !addMaintenanceToMachineList(tileEntity, CASING_INDEX)
return false; && !addEnergyInputToMachineList(tileEntity, CASING_INDEX)) {
} if (block == GregTech_API.sBlockCasings8 && aBaseMetaTileEntity.getMetaIDOffset(x, y, z) == 0) {
casingAmount++;
} else {
return false;
} }
} }
@ -180,7 +196,7 @@ public class GT_MetaTileEntity_LargeChemicalReactor extends GT_MetaTileEntity_Mu
} }
} }
return casingAmount >= 8; return casingAmount >= 8 && hasHeatingCoil;
} }
@Override @Override