aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorJohannes Gäßler <updrn@student.kit.edu>2017-05-16 22:16:50 +0200
committerJohannes Gäßler <updrn@student.kit.edu>2017-05-16 22:16:50 +0200
commit6bcdc3d1575501b5edb4cc1c91a3269429bf17a6 (patch)
tree74210c9292097fa83d8b75d31ed2081bfdf34e21 /src
parent359e7e59054f4c5f286404f6fd1c1e48c539f527 (diff)
downloadGT5-Unofficial-6bcdc3d1575501b5edb4cc1c91a3269429bf17a6.tar.gz
GT5-Unofficial-6bcdc3d1575501b5edb4cc1c91a3269429bf17a6.tar.bz2
GT5-Unofficial-6bcdc3d1575501b5edb4cc1c91a3269429bf17a6.zip
Changed the Distillation Tower so that any height from 3 to 12 is
considered valid.
Diffstat (limited to 'src')
-rw-r--r--src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_DistillationTower.java112
1 files changed, 56 insertions, 56 deletions
diff --git a/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_DistillationTower.java b/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_DistillationTower.java
index 3e962496e9..ed2188f535 100644
--- a/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_DistillationTower.java
+++ b/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_DistillationTower.java
@@ -23,6 +23,7 @@ import java.util.Arrays;
public class GT_MetaTileEntity_DistillationTower
extends GT_MetaTileEntity_MultiBlockBase {
+ private static final int CASING_INDEX = 49;
private static boolean controller;
public GT_MetaTileEntity_DistillationTower(int aID, String aName, String aNameRegional) {
@@ -51,9 +52,9 @@ public class GT_MetaTileEntity_DistillationTower
public ITexture[] getTexture(IGregTechTileEntity aBaseMetaTileEntity, byte aSide, byte aFacing, byte aColorIndex, boolean aActive, boolean aRedstone) {
if (aSide == aFacing) {
- return new ITexture[]{Textures.BlockIcons.CASING_BLOCKS[49], new GT_RenderedTexture(aActive ? Textures.BlockIcons.OVERLAY_FRONT_DISTILLATION_TOWER_ACTIVE : Textures.BlockIcons.OVERLAY_FRONT_DISTILLATION_TOWER)};
+ return new ITexture[]{Textures.BlockIcons.CASING_BLOCKS[CASING_INDEX], new GT_RenderedTexture(aActive ? Textures.BlockIcons.OVERLAY_FRONT_DISTILLATION_TOWER_ACTIVE : Textures.BlockIcons.OVERLAY_FRONT_DISTILLATION_TOWER)};
}
- return new ITexture[]{Textures.BlockIcons.CASING_BLOCKS[49]};
+ return new ITexture[]{Textures.BlockIcons.CASING_BLOCKS[CASING_INDEX]};
}
public Object getClientGUI(int aID, InventoryPlayer aPlayerInventory, IGregTechTileEntity aBaseMetaTileEntity) {
@@ -129,62 +130,61 @@ public class GT_MetaTileEntity_DistillationTower
public boolean checkMachine(IGregTechTileEntity aBaseMetaTileEntity, ItemStack aStack) {
int xDir = ForgeDirection.getOrientation(aBaseMetaTileEntity.getBackFacing()).offsetX;
int zDir = ForgeDirection.getOrientation(aBaseMetaTileEntity.getBackFacing()).offsetZ;
- if (!aBaseMetaTileEntity.getAirOffset(xDir, 1, zDir)) {
- return false;
+ int y = 0; //height
+ int casingAmount = 0;
+ boolean reachedTop = false;
+
+ for (int x = xDir - 1; x <= xDir + 1; x++) { //x=width
+ for (int z = zDir - 1; z <= zDir + 1; z++) { //z=depth
+ if (x != 0 || z != 0) {
+ IGregTechTileEntity tileEntity = aBaseMetaTileEntity.getIGregTechTileEntityOffset(x, y, z);
+ Block block = aBaseMetaTileEntity.getBlockOffset(x, y, z);
+ if (!addInputToMachineList(tileEntity, CASING_INDEX)
+ && !addOutputToMachineList(tileEntity, CASING_INDEX)
+ && !addMaintenanceToMachineList(tileEntity, CASING_INDEX)
+ && !addEnergyInputToMachineList(tileEntity, CASING_INDEX)) {
+ if (block == GregTech_API.sBlockCasings4 && aBaseMetaTileEntity.getMetaIDOffset(x, y, z) == 1) {
+ casingAmount++;
+ } else {
+ return false;
+ }
+ }
+ }
+ }
+ }
+ y++;
+
+ while (y < 12 && !reachedTop) {
+ for (int x = xDir - 1; x <= xDir + 1; x++) { //x=width
+ for (int z = zDir - 1; z <= zDir + 1; z++) { //z=depth
+ IGregTechTileEntity tileEntity = aBaseMetaTileEntity.getIGregTechTileEntityOffset(x, y, z);
+ Block block = aBaseMetaTileEntity.getBlockOffset(x, y, z);
+ if (aBaseMetaTileEntity.getAirOffset(x, y, z)) {
+ if (x != xDir || z != zDir) {
+ return false;
+ }
+ } else {
+ if (x == xDir && z == zDir) {
+ reachedTop = true;
+ }
+ if (!addOutputToMachineList(tileEntity, CASING_INDEX)
+ && !addMaintenanceToMachineList(tileEntity, CASING_INDEX)
+ && !addEnergyInputToMachineList(tileEntity, CASING_INDEX)) {
+ if (block == GregTech_API.sBlockCasings4 && aBaseMetaTileEntity.getMetaIDOffset(x, y, z) == 1) {
+ casingAmount++;
+ } else {
+ return false;
+ }
+ }
+ }
+ }
+ }
+ y++;
}
- int tAmount = 0;
- controller = false;
- for (int i = -1; i < 2; i++) {
- for (int j = -1; j < 2; j++) {
- for (int h = 0; h < 6; h++) {
- if (!(i == 0 && j == 0 && (h > 0 && h < 5)))//((h > 0)&&(h<5)) || (((xDir + i != 0) || (zDir + j != 0)) && ((i != 0) || (j != 0)))
- {
- IGregTechTileEntity tTileEntity = aBaseMetaTileEntity.getIGregTechTileEntityOffset(xDir + i, h, zDir + j);
- if ((!addMaintenanceToMachineList(tTileEntity, 49)) && (!addInputToMachineList(tTileEntity, 49)) && (!addOutputToMachineList(tTileEntity, 49)) && (!addEnergyInputToMachineList(tTileEntity, 49)) && (!ignoreController(aBaseMetaTileEntity.getBlockOffset(xDir + i, h, zDir + j)))) {
- if (aBaseMetaTileEntity.getBlockOffset(xDir + i, h, zDir + j) != GregTech_API.sBlockCasings4) {
- return false;
- }
- if (aBaseMetaTileEntity.getMetaIDOffset(xDir + i, h, zDir + j) != 1) {
- return false;
- }
- tAmount++;
- }
- }
- }
- }
- }
- if (this.mOutputBusses.size() != 1 || this.mInputBusses.size() != 0 || this.mOutputHatches.size() != 5) {
- return false;
- }
- int height = this.getBaseMetaTileEntity().getYCoord();
- if (this.mInputHatches.get(0).getBaseMetaTileEntity().getYCoord() != height || this.mOutputBusses.get(0).getBaseMetaTileEntity().getYCoord() != height) {
- return false;
- }
- GT_MetaTileEntity_Hatch_Output[] tmpHatches = new GT_MetaTileEntity_Hatch_Output[5];
- int mOutputHatches_sS=this.mOutputHatches.size();
- for (int i = 0; i < mOutputHatches_sS; i++) {
- int hatchNumber = this.mOutputHatches.get(i).getBaseMetaTileEntity().getYCoord() - 1 - height;
- if (tmpHatches[hatchNumber] == null) {
- tmpHatches[hatchNumber] = this.mOutputHatches.get(i);
- } else {
- return false;
- }
- }
- this.mOutputHatches.clear();
- for (int i = 0; i < tmpHatches.length; i++) {
- this.mOutputHatches.add(tmpHatches[i]);
- }
- if(this.mMaintenanceHatches.size()!=1)return false;
- return tAmount >= 36;
+
+ return casingAmount >= 7 * y - 5 && y >= 3 && y <= 12 && reachedTop;
}
-
- public boolean ignoreController(Block tTileEntity) {
- if (!controller && tTileEntity == GregTech_API.sBlockMachines) {
- return true;
- }
- return false;
- }
-
+
public int getMaxEfficiency(ItemStack aStack) {
return 10000;
}