Changed the Distillation Tower so that any height from 3 to 12 is

considered valid.
This commit is contained in:
Johannes Gäßler 2017-05-16 22:16:50 +02:00
parent 359e7e5905
commit 6bcdc3d157

View file

@ -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 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;
}
int y = 0; //height
int casingAmount = 0;
boolean reachedTop = false;
public boolean ignoreController(Block tTileEntity) {
if (!controller && tTileEntity == GregTech_API.sBlockMachines) {
return true;
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++;
}
return false;
return casingAmount >= 7 * y - 5 && y >= 3 && y <= 12 && reachedTop;
}
public int getMaxEfficiency(ItemStack aStack) {
return 10000;
}