aboutsummaryrefslogtreecommitdiff
path: root/src/Java/gtPlusPlus/xmod/gregtech
diff options
context:
space:
mode:
Diffstat (limited to 'src/Java/gtPlusPlus/xmod/gregtech')
-rw-r--r--src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/GregtechMetaTileEntity_IndustrialWashPlant.java149
1 files changed, 130 insertions, 19 deletions
diff --git a/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/GregtechMetaTileEntity_IndustrialWashPlant.java b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/GregtechMetaTileEntity_IndustrialWashPlant.java
index e9cc2323a7..a0f244ade3 100644
--- a/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/GregtechMetaTileEntity_IndustrialWashPlant.java
+++ b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/GregtechMetaTileEntity_IndustrialWashPlant.java
@@ -13,13 +13,17 @@ import gregtech.api.util.GT_Utility;
import gtPlusPlus.core.block.ModBlocks;
import gtPlusPlus.core.lib.CORE;
import gtPlusPlus.core.util.Utils;
+import gtPlusPlus.core.util.fluid.FluidUtils;
import gtPlusPlus.xmod.gregtech.api.gui.GUI_MultiMachine;
import gtPlusPlus.xmod.gregtech.api.metatileentity.implementations.base.GregtechMeta_MultiBlockBase;
+import ic2.core.init.BlocksItems;
+import ic2.core.init.InternalName;
import net.minecraft.block.Block;
import net.minecraft.entity.player.InventoryPlayer;
import net.minecraft.init.Blocks;
import net.minecraft.item.ItemStack;
import net.minecraftforge.common.util.ForgeDirection;
+import net.minecraftforge.fluids.FluidStack;
public class GregtechMetaTileEntity_IndustrialWashPlant
extends GregtechMeta_MultiBlockBase {
@@ -78,6 +82,11 @@ extends GregtechMeta_MultiBlockBase {
@Override
public boolean checkRecipe(final ItemStack aStack) {
+
+ if (!checkForWater()){
+ return false;
+ }
+
final ArrayList<ItemStack> tInputList = this.getStoredInputs();
for (final ItemStack tInput : tInputList) {
final long tVoltage = this.getMaxInputVoltage();
@@ -122,19 +131,19 @@ extends GregtechMeta_MultiBlockBase {
@Override
public boolean checkMachine(final IGregTechTileEntity aBaseMetaTileEntity, final ItemStack aStack) {
-
+
//Get Facing direction
int mDirectionX = ForgeDirection.getOrientation(aBaseMetaTileEntity.getBackFacing()).offsetX;
-
+
int mCurrentDirectionX;
int mCurrentDirectionZ;
int mOffsetX_Lower = 0;
int mOffsetX_Upper = 0;
int mOffsetZ_Lower = 0;
int mOffsetZ_Upper = 0;
-
- Utils.LOG_INFO("mDirectionX "+(mDirectionX));
+
+ Utils.LOG_WARNING("mDirectionX "+(mDirectionX));
if (mDirectionX == 0){
mCurrentDirectionX = 2;
mCurrentDirectionZ = 3;
@@ -142,7 +151,7 @@ extends GregtechMeta_MultiBlockBase {
mOffsetX_Upper = 2;
mOffsetZ_Lower = -3;
mOffsetZ_Upper = 3;
- Utils.LOG_INFO("Controler is facing Z direction.");
+ Utils.LOG_WARNING("Controler is facing Z direction.");
}
else {
mCurrentDirectionX = 3;
@@ -151,16 +160,16 @@ extends GregtechMeta_MultiBlockBase {
mOffsetX_Upper = 3;
mOffsetZ_Lower = -2;
mOffsetZ_Upper = 2;
- Utils.LOG_INFO("Controler is facing X direction.");
+ Utils.LOG_WARNING("Controler is facing X direction.");
}
-
+
//if (aBaseMetaTileEntity.fac)
-
+
final int xDir = ForgeDirection.getOrientation(aBaseMetaTileEntity.getBackFacing()).offsetX * mCurrentDirectionX;
final int zDir = ForgeDirection.getOrientation(aBaseMetaTileEntity.getBackFacing()).offsetZ * mCurrentDirectionZ;
-
- Utils.LOG_INFO("xDir"+(xDir));
- Utils.LOG_INFO("zDir"+(zDir));
+
+ Utils.LOG_WARNING("xDir"+(xDir));
+ Utils.LOG_WARNING("zDir"+(zDir));
/*if (!(aBaseMetaTileEntity.getAirOffset(xDir, 0, zDir))) {
return false;
}*/
@@ -172,25 +181,25 @@ extends GregtechMeta_MultiBlockBase {
IGregTechTileEntity tTileEntity = aBaseMetaTileEntity.getIGregTechTileEntityOffset(xDir + i, h,
zDir + j);
if (!addToMachineList(tTileEntity)) {
- Utils.LOG_INFO("X: "+i+" | Z: "+j);
+ Utils.LOG_WARNING("X: "+i+" | Z: "+j);
Block tBlock = aBaseMetaTileEntity.getBlockOffset(xDir + i, h, zDir + j);
byte tMeta = aBaseMetaTileEntity.getMetaIDOffset(xDir + i, h, zDir + j);
if ((tBlock != getCasingBlock()) && (tMeta != getCasingMeta())) {
if ((i != mOffsetX_Lower && j != mOffsetZ_Lower
&& i != mOffsetX_Upper && j != mOffsetZ_Upper) && (h == 0 || h == 1)){
if (tBlock == Blocks.air){
- Utils.LOG_INFO("Found Air");
+ Utils.LOG_WARNING("Found Air");
}
else if (tBlock == Blocks.water){
- Utils.LOG_INFO("Found Water");
+ Utils.LOG_WARNING("Found Water");
}
}
else {
- Utils.LOG_INFO("[x] Did not form - Found: "+tBlock.getLocalizedName() + " | "+tBlock.getDamageValue(aBaseMetaTileEntity.getWorld(), aBaseMetaTileEntity.getXCoord()+ i, aBaseMetaTileEntity.getYCoord(), aBaseMetaTileEntity.getZCoord() + j));
- Utils.LOG_INFO("[x] Did not form - Found: "+(aBaseMetaTileEntity.getXCoord()+xDir + i) +" | "+ aBaseMetaTileEntity.getYCoord()+" | "+ (aBaseMetaTileEntity.getZCoord()+zDir + j));
+ Utils.LOG_WARNING("[x] Did not form - Found: "+tBlock.getLocalizedName() + " | "+tBlock.getDamageValue(aBaseMetaTileEntity.getWorld(), aBaseMetaTileEntity.getXCoord()+ i, aBaseMetaTileEntity.getYCoord(), aBaseMetaTileEntity.getZCoord() + j));
+ Utils.LOG_WARNING("[x] Did not form - Found: "+(aBaseMetaTileEntity.getXCoord()+xDir + i) +" | "+ aBaseMetaTileEntity.getYCoord()+" | "+ (aBaseMetaTileEntity.getZCoord()+zDir + j));
return false;
}
-
+
}
++tAmount;
}
@@ -199,10 +208,10 @@ extends GregtechMeta_MultiBlockBase {
}
}
if ((tAmount >= 8)){
- Utils.LOG_INFO("Made structure.");
+ Utils.LOG_WARNING("Made structure.");
}
else {
- Utils.LOG_INFO("Did not make structure.");
+ Utils.LOG_WARNING("Did not make structure.");
}
return (tAmount >= 8);
}
@@ -249,4 +258,106 @@ extends GregtechMeta_MultiBlockBase {
|| (this.addEnergyInputToMachineList(tTileEntity, this.getCasingTextureIndex()))
|| (this.addDynamoToMachineList(tTileEntity, this.getCasingTextureIndex())));
}
+
+ public boolean checkForWater() {
+
+ //Get Facing direction
+ IGregTechTileEntity aBaseMetaTileEntity = this.getBaseMetaTileEntity();
+ int mDirectionX = ForgeDirection.getOrientation(aBaseMetaTileEntity.getBackFacing()).offsetX;
+ int mCurrentDirectionX;
+ int mCurrentDirectionZ;
+ int mOffsetX_Lower = 0;
+ int mOffsetX_Upper = 0;
+ int mOffsetZ_Lower = 0;
+ int mOffsetZ_Upper = 0;
+
+ if (mDirectionX == 0){
+ mCurrentDirectionX = 2;
+ mCurrentDirectionZ = 3;
+ mOffsetX_Lower = -2;
+ mOffsetX_Upper = 2;
+ mOffsetZ_Lower = -3;
+ mOffsetZ_Upper = 3;
+ }
+ else {
+ mCurrentDirectionX = 3;
+ mCurrentDirectionZ = 2;
+ mOffsetX_Lower = -3;
+ mOffsetX_Upper = 3;
+ mOffsetZ_Lower = -2;
+ mOffsetZ_Upper = 2;
+ }
+
+ //if (aBaseMetaTileEntity.fac)
+
+ final int xDir = ForgeDirection.getOrientation(aBaseMetaTileEntity.getBackFacing()).offsetX * mCurrentDirectionX;
+ final int zDir = ForgeDirection.getOrientation(aBaseMetaTileEntity.getBackFacing()).offsetZ * mCurrentDirectionZ;
+
+ int tAmount = 0;
+ for (int i = mOffsetX_Lower; i <=mOffsetX_Upper; ++i) {
+ for (int j = mOffsetZ_Lower; j <= mOffsetZ_Upper; ++j) {
+ for (int h = -1; h < 2; ++h) {
+ if ((h != 0) || ((((xDir + i != 0) || (zDir + j != 0))) && (((i != 0) || (j != 0))))) {
+ IGregTechTileEntity tTileEntity = aBaseMetaTileEntity.getIGregTechTileEntityOffset(xDir + i, h,
+ zDir + j);
+ if (!addToMachineList(tTileEntity)) {
+ Block tBlock = aBaseMetaTileEntity.getBlockOffset(xDir + i, h, zDir + j);
+ byte tMeta = aBaseMetaTileEntity.getMetaIDOffset(xDir + i, h, zDir + j);
+ if ((tBlock != getCasingBlock()) && (tMeta != getCasingMeta())) {
+ if ((i != mOffsetX_Lower && j != mOffsetZ_Lower
+ && i != mOffsetX_Upper && j != mOffsetZ_Upper) && (h == 0 || h == 1)){
+ if (tBlock == Blocks.air || tBlock == Blocks.flowing_water || tBlock == Blocks.water){
+ if (this.getStoredFluids() != null){
+ for (FluidStack stored : this.getStoredFluids()){
+ if (stored.isFluidEqual(FluidUtils.getFluidStack("water", 1))){
+ if (stored.amount >= 1000){
+ //Utils.LOG_INFO("Going to try swap an air block for water from inut bus.");
+ stored.amount -= 1000;
+ Block fluidUsed = null;
+ if (tBlock == Blocks.air || tBlock == Blocks.flowing_water){
+ fluidUsed = Blocks.water;
+ }
+ if (tBlock == Blocks.water){
+ fluidUsed = BlocksItems.getFluidBlock(InternalName.fluidDistilledWater);
+ }
+ aBaseMetaTileEntity.getWorld().setBlock(aBaseMetaTileEntity.getXCoord()+xDir + i, aBaseMetaTileEntity.getYCoord()+h, aBaseMetaTileEntity.getZCoord()+zDir + j, fluidUsed);
+
+
+
+ }
+ }
+ }
+ }
+ }
+ if (tBlock == Blocks.water){
+ ++tAmount;
+ //Utils.LOG_INFO("Found Water");
+ }
+ else if (tBlock == BlocksItems.getFluidBlock(InternalName.fluidDistilledWater)){
+ ++tAmount;
+ ++tAmount;
+ //Utils.LOG_INFO("Found Distilled Water");
+ }
+ }
+ else {
+ //Utils.LOG_WARNING("[x] Did not form - Found: "+tBlock.getLocalizedName() + " | "+tBlock.getDamageValue(aBaseMetaTileEntity.getWorld(), aBaseMetaTileEntity.getXCoord()+ i, aBaseMetaTileEntity.getYCoord(), aBaseMetaTileEntity.getZCoord() + j));
+ //Utils.LOG_WARNING("[x] Did not form - Found: "+(aBaseMetaTileEntity.getXCoord()+xDir + i) +" | "+ aBaseMetaTileEntity.getYCoord()+" | "+ (aBaseMetaTileEntity.getZCoord()+zDir + j));
+ return false;
+ }
+
+ }
+ }
+ }
+ }
+ }
+ }
+ if ((tAmount == 45)){
+ Utils.LOG_WARNING("Filled structure.");
+ }
+ else {
+ Utils.LOG_WARNING("Did not fill structure.");
+ }
+ return (tAmount == 45);
+ }
+
} \ No newline at end of file