Skip to content

Commit

Permalink
Merge pull request #1297 from JohannesGaessler/MoreFlexibleOilCracker…
Browse files Browse the repository at this point in the history
…Structure

More flexible Oil Cracker structure
  • Loading branch information
Blood-Asp authored Nov 25, 2017
2 parents eb7185c + a35965b commit d6cbc47
Showing 1 changed file with 37 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -38,12 +38,13 @@ public String[] getDescription() {
"Thermally cracks heavy hydrocarbons into lighter fractions",
"Size(WxHxD): 5x3x3 (Hollow), Controller (Front center)",
"Ring of 8 Cupronickel Coils (Each side of Controller)",
"1x Hydrocarbon Input Bus/Hatch (Any left side casing)",
"1x Hydrocarbon Input Bus/Hatch (Any left/right side casing)",
"1x Steam/Hydrogen Input Hatch (Any middle ring casing)",
"1x Cracked Hydrocarbon Output Hatch (Any right side casing)",
"1x Maintenance Hatch (Any middle ring casing)",
"1x Energy Hatch (Any middle ring casing)",
"Clean Stainless Steel Machine Casings for the rest (18 at least!)"};
"1x Cracked Hydrocarbon Output Hatch (Any left/right side casing)",
"1x Maintenance Hatch (Any casing)",
"1x Energy Hatch (Any casing)",
"Clean Stainless Steel Machine Casings for the rest (18 at least!)",
"Input/Output Hatches must be on opposite sides"};
}

public ITexture[] getTexture(IGregTechTileEntity aBaseMetaTileEntity, byte aSide, byte aFacing, byte aColorIndex, boolean aActive, boolean aRedstone) {
Expand Down Expand Up @@ -95,6 +96,7 @@ public boolean checkMachine(IGregTechTileEntity aBaseMetaTileEntity, ItemStack a
int zDir = this.orientation.offsetZ;
int amount = 0;
replaceDeprecatedCoils(aBaseMetaTileEntity);
boolean negSideInput = false, negSideOutput = false, posSideInput = false, posSideOutput = false;
if (xDir != 0) {
for (int i = -1; i < 2; i++) {// xDirection
for (int j = -1; j < 2; j++) {// height
Expand All @@ -110,8 +112,19 @@ public boolean checkMachine(IGregTechTileEntity aBaseMetaTileEntity, ItemStack a
}
if (h == 2 || h == -2) {
IGregTechTileEntity tTileEntity = aBaseMetaTileEntity.getIGregTechTileEntityOffset(xDir + i, j, h + zDir);
boolean tSide = ((aBaseMetaTileEntity.getBackFacing() == 4 && 2 == h) || (aBaseMetaTileEntity.getBackFacing() == 5 && -2 == h));
if (tSide ? !addInputToMachineList(tTileEntity, 49) : !addOutputToMachineList(tTileEntity, 49)) {
if (addInputToMachineList(tTileEntity, 49)) {
if (h == -2) {
negSideInput = true;
} else {
posSideInput = true;
}
} else if (addOutputToMachineList(tTileEntity, 49)) {
if (h == -2) {
negSideOutput = true;
} else {
posSideOutput = true;
}
} else if (!addEnergyInputToMachineList(tTileEntity, 49) && !addMaintenanceToMachineList(tTileEntity, 49)){
if (aBaseMetaTileEntity.getBlockOffset(xDir + i, j, h + zDir) != GregTech_API.sBlockCasings4) {
return false;
}
Expand Down Expand Up @@ -156,8 +169,19 @@ public boolean checkMachine(IGregTechTileEntity aBaseMetaTileEntity, ItemStack a
}
if (h == 2 || h == -2) {
IGregTechTileEntity tTileEntity = aBaseMetaTileEntity.getIGregTechTileEntityOffset(xDir + h, j, i + zDir);
boolean tSide = (aBaseMetaTileEntity.getBackFacing() == h || (aBaseMetaTileEntity.getBackFacing() == 3 && -2 == h));
if (tSide ? !addOutputToMachineList(tTileEntity, 49) : !addInputToMachineList(tTileEntity, 49)) {
if (addInputToMachineList(tTileEntity, 49)) {
if (h == -2) {
negSideInput = true;
} else {
posSideInput = true;
}
} else if (addOutputToMachineList(tTileEntity, 49)) {
if (h == -2) {
negSideOutput = true;
} else {
posSideOutput = true;
}
} else if (!addEnergyInputToMachineList(tTileEntity, 49) && !addMaintenanceToMachineList(tTileEntity, 49)){
if (aBaseMetaTileEntity.getBlockOffset(xDir + h, j, i + zDir) != GregTech_API.sBlockCasings4) {
return false;
}
Expand Down Expand Up @@ -188,6 +212,10 @@ public boolean checkMachine(IGregTechTileEntity aBaseMetaTileEntity, ItemStack a
}
}
}
if ((negSideInput && negSideOutput) || (posSideInput && posSideOutput)
|| (negSideInput && posSideInput) || (negSideOutput && posSideOutput)) {
return false;
}
if (amount < 18) return false;
return true;
}
Expand Down

0 comments on commit d6cbc47

Please sign in to comment.