aboutsummaryrefslogtreecommitdiff
path: root/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi
diff options
context:
space:
mode:
Diffstat (limited to 'src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi')
-rw-r--r--src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/GT4Entity_AutoCrafter.java1
-rw-r--r--src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/GT4Entity_ThermalBoiler.java1
-rw-r--r--src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/GregtechMetaTileEntityGeneratorArray.java236
-rw-r--r--src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/GregtechMetaTileEntityTreeFarm.java1
-rw-r--r--src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/GregtechMetaTileEntity_AlloyBlastSmelter.java51
-rw-r--r--src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/GregtechMetaTileEntity_IndustrialCentrifuge.java174
-rw-r--r--src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/GregtechMetaTileEntity_IndustrialCokeOven.java4
-rw-r--r--src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/GregtechMetaTileEntity_IndustrialCuttingMachine.java254
-rw-r--r--src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/GregtechMetaTileEntity_IndustrialElectrolyzer.java4
-rw-r--r--src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/GregtechMetaTileEntity_IndustrialMacerator.java4
-rw-r--r--src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/GregtechMetaTileEntity_IndustrialPlatePress.java4
-rw-r--r--src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/GregtechMetaTileEntity_IndustrialSifter.java111
-rw-r--r--src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/GregtechMetaTileEntity_IndustrialThermalCentrifuge.java34
-rw-r--r--src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/GregtechMetaTileEntity_IndustrialWashPlant.java283
-rw-r--r--src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/GregtechMetaTileEntity_IndustrialWireMill.java4
-rw-r--r--src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/GregtechMetaTileEntity_MassFabricator.java4
-rw-r--r--src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/GregtechMetaTileEntity_MultiTank.java1
-rw-r--r--src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/GregtechMetaTileEntity_PowerSubStationController.java132
-rw-r--r--src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/GregtechMetaTileEntity_Refinery.java1
19 files changed, 857 insertions, 447 deletions
diff --git a/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/GT4Entity_AutoCrafter.java b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/GT4Entity_AutoCrafter.java
index 4a299b4599..3dee1df0f0 100644
--- a/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/GT4Entity_AutoCrafter.java
+++ b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/GT4Entity_AutoCrafter.java
@@ -150,7 +150,6 @@ extends GT_MetaTileEntity_MultiBlockBase
"1x Maintenance Hatch",
"1x Energy Hatch",
"--------------------------------------",
- "Causes " + (20 * getPollutionPerTick(null)) + " Pollution per second",
CORE.GT_Tooltip
};
}
diff --git a/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/GT4Entity_ThermalBoiler.java b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/GT4Entity_ThermalBoiler.java
index e1a8e2fba8..f7940e3d68 100644
--- a/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/GT4Entity_ThermalBoiler.java
+++ b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/GT4Entity_ThermalBoiler.java
@@ -182,7 +182,6 @@ extends GT_MetaTileEntity_MultiBlockBase
"Place them in the middle block of the Back, Bottom and Sides",
"Use 2 Output Hatches by default, change one to a Bus if filtering Lava",
"Consult user manual for more information",
- "Causes " + (20 * getPollutionPerTick(null)) + " Pollution per second",
CORE.GT_Tooltip};
}
diff --git a/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/GregtechMetaTileEntityGeneratorArray.java b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/GregtechMetaTileEntityGeneratorArray.java
new file mode 100644
index 0000000000..3923f65f29
--- /dev/null
+++ b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/GregtechMetaTileEntityGeneratorArray.java
@@ -0,0 +1,236 @@
+package gtPlusPlus.xmod.gregtech.common.tileentities.machines.multi;
+
+import gregtech.api.GregTech_API;
+import gregtech.api.enums.Textures;
+import gregtech.api.gui.GT_GUIContainer_MultiMachine;
+import gregtech.api.interfaces.ITexture;
+import gregtech.api.interfaces.metatileentity.IMetaTileEntity;
+import gregtech.api.interfaces.tileentity.IGregTechTileEntity;
+import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_MultiBlockBase;
+import gregtech.api.objects.GT_RenderedTexture;
+import gregtech.api.util.GT_Recipe;
+import gregtech.api.util.Recipe_GT.Gregtech_Recipe_Map;
+import gtPlusPlus.core.util.Utils;
+import gtPlusPlus.core.util.fluid.FluidUtils;
+import net.minecraft.entity.player.InventoryPlayer;
+import net.minecraft.item.ItemStack;
+import net.minecraftforge.common.util.ForgeDirection;
+import net.minecraftforge.fluids.FluidStack;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.List;
+
+public class GregtechMetaTileEntityGeneratorArray extends GT_MetaTileEntity_MultiBlockBase {
+
+ GT_Recipe mLastRecipe;
+
+ public GregtechMetaTileEntityGeneratorArray(int aID, String aName, String aNameRegional) {
+ super(aID, aName, aNameRegional);
+ }
+
+ public GregtechMetaTileEntityGeneratorArray(String aName) {
+ super(aName);
+ }
+
+ public IMetaTileEntity newMetaEntity(IGregTechTileEntity aTileEntity) {
+ return new GregtechMetaTileEntityGeneratorArray(this.mName);
+ }
+
+ public String[] getDescription() {
+ return new String[]{
+ "Controller Block for the Generator Array",
+ "Runs supplied generators as if placed in the world",
+ "Size(WxHxD): 3x3x3 (Hollow), Controller (Front centered)",
+ "1x Input Hatch/Bus (Any casing)",
+ "1x Output Hatch/Bus (Any casing)",
+ "1x Maintenance Hatch (Any casing)",
+ "1x Energy Hatch (Any casing)",
+ "Robust Tungstensteel Machine Casings for the rest (16 at least!)",
+ "Place up to 16 Single Block GT Generators into the Controller Inventory"};
+ }
+
+ 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[48], new GT_RenderedTexture(aActive ? Textures.BlockIcons.OVERLAY_FRONT_PROCESSING_ARRAY_ACTIVE : Textures.BlockIcons.OVERLAY_FRONT_PROCESSING_ARRAY)};
+ }
+ return new ITexture[]{Textures.BlockIcons.CASING_BLOCKS[48]};
+ }
+
+ public Object getClientGUI(int aID, InventoryPlayer aPlayerInventory, IGregTechTileEntity aBaseMetaTileEntity) {
+ return new GT_GUIContainer_MultiMachine(aPlayerInventory, aBaseMetaTileEntity, getLocalName(), "ProcessingArray.png");
+ }
+
+ public GT_Recipe.GT_Recipe_Map getRecipeMap() {
+ if (mInventory[1] == null) return null;
+ String tmp = mInventory[1].getUnlocalizedName().replaceAll("gt\\.blockmachines\\.basicgenerator\\.", "");
+ if (tmp.startsWith("steamturbine")) {
+ return Gregtech_Recipe_Map.sSteamTurbineFuels;
+ }
+ else if (tmp.startsWith("diesel")) {
+ return GT_Recipe.GT_Recipe_Map.sDieselFuels;
+ }
+ else if (tmp.startsWith("gasturbine")) {
+ return GT_Recipe.GT_Recipe_Map.sTurbineFuels;
+ }
+ else if (tmp.startsWith("semifluid")) {
+ return GT_Recipe.GT_Recipe_Map.sDenseLiquidFuels;
+ }
+ else if (tmp.startsWith("rtg")) {
+ return Gregtech_Recipe_Map.sRTGFuels;
+ }
+
+
+ tmp = mInventory[1].getUnlocalizedName().replaceAll("gt\\.blockmachines\\.advancedgenerator\\.", "");
+ if (tmp.startsWith("rocket")) {
+ return GT_Recipe.GT_Recipe_Map.sDieselFuels;
+ }
+ else if (tmp.startsWith("geothermalFuel")) {
+ return Gregtech_Recipe_Map.sGeoThermalFuels;
+ }
+
+ return null;
+ }
+
+ public boolean isCorrectMachinePart(ItemStack aStack) {
+ if (aStack != null && aStack.getUnlocalizedName().startsWith("gt.blockmachines.")) {
+ return true;
+ }
+ return false;
+ }
+
+ public boolean isFacingValid(byte aFacing) {
+ return aFacing > 1;
+ }
+
+ public String mMachine = "";
+ public boolean checkRecipe(ItemStack aStack) {
+ if (!isCorrectMachinePart(mInventory[1])) {
+ return false;
+ }
+ GT_Recipe.GT_Recipe_Map map = getRecipeMap();
+ if (map == null) return false;
+ ArrayList<ItemStack> tInputList = getStoredInputs();
+ int tTier = 0;
+ if (mInventory[1].getUnlocalizedName().endsWith("1")) {
+ tTier = 1;
+ }else if (mInventory[1].getUnlocalizedName().endsWith("2")) {
+ tTier = 2;
+ }else if (mInventory[1].getUnlocalizedName().endsWith("3")) {
+ tTier = 3;
+ }else if (mInventory[1].getUnlocalizedName().endsWith("4")) {
+ tTier = 4;
+ }else if (mInventory[1].getUnlocalizedName().endsWith("5")) {
+ tTier = 5;
+ }else if (mInventory[1].getUnlocalizedName().endsWith("6")) {
+ tTier = 6;
+ }else if (mInventory[1].getUnlocalizedName().endsWith("7")) {
+ tTier = 7;
+ }else if (mInventory[1].getUnlocalizedName().endsWith("8")) {
+ tTier = 8;
+ }
+
+ int fuelConsumption = 0;
+ int fuelValue = 0;
+ int fuelRemaining = 0;
+ boolean boostEu = false;
+
+ if(!mMachine.equals(mInventory[1].getUnlocalizedName()))mLastRecipe=null;
+ mMachine = mInventory[1].getUnlocalizedName();
+ Utils.LOG_WARNING("mMachine: "+mMachine);
+ ArrayList<FluidStack> tFluids = getStoredFluids();
+ Collection<GT_Recipe> tRecipeList = this.getRecipeMap().mRecipeList;
+ Utils.LOG_WARNING("tRecipeList: "+tRecipeList);
+
+ if(tFluids.size() > 0 && tRecipeList != null) { //Does input hatch have a diesel fuel?
+ Utils.LOG_WARNING("1");
+ for (FluidStack hatchFluid1 : tFluids) { //Loops through hatches
+ Utils.LOG_WARNING("2");
+ for(GT_Recipe aFuel : tRecipeList) { //Loops through diesel fuel recipes
+ Utils.LOG_WARNING("3");
+ /*if (aFuel != null){
+ for (FluidStack x : aFuel.mFluidInputs){
+ if (x != null){
+ Utils.LOG_WARNING("Recipe: "+x.getLocalizedName());
+ }
+ }
+ }*/
+ FluidStack tLiquid;
+ tLiquid = FluidUtils.getFluidStack(aFuel.mFluidInputs[0], aFuel.mFluidInputs[0].amount);
+ Utils.LOG_WARNING("5");
+ fuelConsumption = aFuel.mFluidInputs[0].amount;
+ if(depleteInput(tLiquid)) { //Deplete that amount
+ Utils.LOG_WARNING("6");
+ boostEu = true;
+ Utils.LOG_WARNING("7");
+
+ fuelValue = aFuel.mEUt*aFuel.mDuration;
+ fuelRemaining = hatchFluid1.amount; //Record available fuel
+ this.mEUt = mEfficiency < 2000 ? 0 : 2048; //Output 0 if startup is less than 20%
+ //this.mProgresstime = 1;
+ this.mMaxProgresstime = 20;
+ this.mEfficiencyIncrease = 9500;
+ Utils.LOG_WARNING("9");
+ return true;
+ }
+ }
+ // }
+ //}
+ }
+ }
+ this.mEUt = 0;
+ this.mEfficiency = 0;
+ return false;
+ }
+
+ public static ItemStack[] clean(final ItemStack[] v) {
+ List<ItemStack> list = new ArrayList<ItemStack>(Arrays.asList(v));
+ list.removeAll(Collections.singleton(null));
+ return list.toArray(new ItemStack[list.size()]);
+ }
+
+ 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, 0, zDir)) {
+ return false;
+ }
+ int tAmount = 0;
+ for (int i = -1; i < 2; i++) {
+ for (int j = -1; j < 2; 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 ((!addMaintenanceToMachineList(tTileEntity, 48)) && (!addInputToMachineList(tTileEntity, 48)) && (!addOutputToMachineList(tTileEntity, 48)) && (!addDynamoToMachineList(tTileEntity, 48))) {
+ if (aBaseMetaTileEntity.getBlockOffset(xDir + i, h, zDir + j) != GregTech_API.sBlockCasings4) {
+ return false;
+ }
+ if (aBaseMetaTileEntity.getMetaIDOffset(xDir + i, h, zDir + j) != 0) {
+ return false;
+ }
+ tAmount++;
+ }
+ }
+ }
+ }
+ }
+ return tAmount >= 16;
+ }
+
+ public int getMaxEfficiency(ItemStack aStack) {
+ return 10000;
+ }
+
+ public int getPollutionPerTick(ItemStack aStack) {
+ return 0;
+ }
+
+ public int getDamageToComponent(ItemStack aStack) {
+ return 0;
+ }
+
+ public boolean explodesOnComponentBreak(ItemStack aStack) {
+ return false;
+ }
+}
diff --git a/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/GregtechMetaTileEntityTreeFarm.java b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/GregtechMetaTileEntityTreeFarm.java
index 2ea2d429e2..dd2837b021 100644
--- a/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/GregtechMetaTileEntityTreeFarm.java
+++ b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/GregtechMetaTileEntityTreeFarm.java
@@ -85,7 +85,6 @@ public class GregtechMetaTileEntityTreeFarm extends GT_MetaTileEntity_MultiBlock
"Dark Purple: Dirt/Grass/Podzol/Humus",
"Light Blue: Fence/Fence Gate",
"Blue/Yellow: Controller",
- "Causes " + (20 * getPollutionPerTick(null)) + " Pollution per second",
CORE.GT_Tooltip
};
}
diff --git a/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/GregtechMetaTileEntity_AlloyBlastSmelter.java b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/GregtechMetaTileEntity_AlloyBlastSmelter.java
index 155bb71aaa..bdb514ba84 100644
--- a/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/GregtechMetaTileEntity_AlloyBlastSmelter.java
+++ b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/GregtechMetaTileEntity_AlloyBlastSmelter.java
@@ -10,7 +10,6 @@ import gregtech.api.gui.GT_GUIContainer_MultiMachine;
import gregtech.api.interfaces.ITexture;
import gregtech.api.interfaces.metatileentity.IMetaTileEntity;
import gregtech.api.interfaces.tileentity.IGregTechTileEntity;
-import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_MultiBlockBase;
import gregtech.api.objects.GT_RenderedTexture;
import gregtech.api.util.GT_Recipe;
import gregtech.api.util.GT_Utility;
@@ -18,13 +17,14 @@ import gregtech.api.util.Recipe_GT;
import gtPlusPlus.core.block.ModBlocks;
import gtPlusPlus.core.lib.CORE;
import gtPlusPlus.core.util.Utils;
+import gtPlusPlus.xmod.gregtech.api.metatileentity.implementations.base.GregtechMeta_MultiBlockBase;
import net.minecraft.entity.player.InventoryPlayer;
import net.minecraft.item.ItemStack;
import net.minecraftforge.common.util.ForgeDirection;
import net.minecraftforge.fluids.FluidStack;
public class GregtechMetaTileEntity_AlloyBlastSmelter
-extends GT_MetaTileEntity_MultiBlockBase {
+extends GregtechMeta_MultiBlockBase {
private int mHeatingCapacity = 0;
public GregtechMetaTileEntity_AlloyBlastSmelter(final int aID, final String aName, final String aNameRegional) {
@@ -55,8 +55,8 @@ extends GT_MetaTileEntity_MultiBlockBase {
"1x Energy Hatch (one of bottom)",
"1x Maintenance Hatch (one of bottom)",
"1x Muffler Hatch (top middle)",
+ "1x Fluid Input Hatch (optional, top layer)",
"Blast Smelter Casings for the rest",
- "Causes " + (20 * getPollutionPerTick(null)) + " Pollution per second",
CORE.GT_Tooltip};
}
@@ -82,17 +82,19 @@ extends GT_MetaTileEntity_MultiBlockBase {
public boolean isCorrectMachinePart(final ItemStack aStack) {
return true;
}
-
- public void startSoundLoop(byte aIndex, double aX, double aY, double aZ) {
- super.startSoundLoop(aIndex, aX, aY, aZ);
- if (aIndex == 1) {
- GT_Utility.doSoundAtClient((String) GregTech_API.sSoundList.get(Integer.valueOf(208)), 10, 1.0F, aX, aY, aZ);
- }
- }
- public void startProcess() {
- sendLoopStart((byte) 1);
- }
+ @Override
+ public void startSoundLoop(final byte aIndex, final double aX, final double aY, final double aZ) {
+ super.startSoundLoop(aIndex, aX, aY, aZ);
+ if (aIndex == 1) {
+ GT_Utility.doSoundAtClient(GregTech_API.sSoundList.get(Integer.valueOf(208)), 10, 1.0F, aX, aY, aZ);
+ }
+ }
+
+ @Override
+ public void startProcess() {
+ this.sendLoopStart((byte) 1);
+ }
@Override
public boolean isFacingValid(final byte aFacing) {
@@ -193,11 +195,13 @@ extends GT_MetaTileEntity_MultiBlockBase {
if (aBaseMetaTileEntity.getMetaIDOffset(xDir + i, 1, zDir + j) != 14) {
return false;
}
- if (aBaseMetaTileEntity.getBlockOffset(xDir + i, 3, zDir + j) != ModBlocks.blockCasingsMisc) {
- return false;
- }
- if (aBaseMetaTileEntity.getMetaIDOffset(xDir + i, 3, zDir + j) != 15) {
- return false;
+ if (!this.addFluidInputToMachineList(aBaseMetaTileEntity.getIGregTechTileEntityOffset(xDir + i, 3, zDir + j), 11)) {
+ if (aBaseMetaTileEntity.getBlockOffset(xDir + i, 3, zDir + j) != ModBlocks.blockCasingsMisc) {
+ return false;
+ }
+ if (aBaseMetaTileEntity.getMetaIDOffset(xDir + i, 3, zDir + j) != 15) {
+ return false;
+ }
}
}
}
@@ -219,11 +223,11 @@ extends GT_MetaTileEntity_MultiBlockBase {
}
this.mHeatingCapacity += 100 * (GT_Utility.getTier(this.getMaxInputVoltage()) - 2);
- if ( this.mMaintenanceHatches.size() != 1 ||
- this.mMufflerHatches.size() != 1 ||
- this.mInputBusses.size() < 1 ||
- this.mOutputHatches.size() < 1 ||
- this.mEnergyHatches.size() != 1 ) {
+ if ( (this.mMaintenanceHatches.size() != 1) ||
+ (this.mMufflerHatches.size() != 1) ||
+ (this.mInputBusses.size() < 1) ||
+ (this.mOutputHatches.size() < 1) ||
+ (this.mEnergyHatches.size() != 1) ) {
return false;
}
@@ -245,6 +249,7 @@ extends GT_MetaTileEntity_MultiBlockBase {
return 0;
}
+ @Override
public int getAmountOfOutputs() {
return 2;
}
diff --git a/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/GregtechMetaTileEntity_IndustrialCentrifuge.java b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/GregtechMetaTileEntity_IndustrialCentrifuge.java
index ac288eb3ab..7a35f63605 100644
--- a/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/GregtechMetaTileEntity_IndustrialCentrifuge.java
+++ b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/GregtechMetaTileEntity_IndustrialCentrifuge.java
@@ -57,7 +57,7 @@ extends GregtechMeta_MultiBlockBase {
public String[] getDescription() {
return new String[]{
"Controller Block for the Industrial Centrifuge",
- "50% faster than using single block machines of the same voltage",
+ "40% faster than using single block machines of the same voltage",
"Size: 3x3x3 (Hollow)",
"Controller (Front Center) [Orange]",
"1x Maintenance Hatch (Rear Center) [Green]",
@@ -68,7 +68,6 @@ extends GregtechMeta_MultiBlockBase {
"1x Output Bus",
"1x [EV] Energy Hatch (Can be higher Tier) [Blue]",
"Centrifuge Casings for the rest (16 at least)",
- "Causes " + (20 * getPollutionPerTick(null)) + " Pollution per second",
CORE.GT_Tooltip};
}
@@ -76,12 +75,7 @@ extends GregtechMeta_MultiBlockBase {
@Override
public ITexture[] getTexture(final IGregTechTileEntity aBaseMetaTileEntity, final byte aSide, final byte aFacing, final byte aColorIndex, final boolean aActive, final boolean aRedstone) {
- try {
- return new ITexture[]{Textures.BlockIcons.MACHINE_CASINGS[TAE.GTPP_INDEX(0)][aColorIndex + 1], aFacing == aSide ? aActive ? frontFaceActive : frontFace : Textures.BlockIcons.CASING_BLOCKS[TAE.GTPP_INDEX(0)]};
- }
- catch (Throwable t){
- return new ITexture[]{Textures.BlockIcons.MACHINE_CASINGS[0][aColorIndex + 1], aFacing == aSide ? aActive ? frontFaceActive : frontFace : Textures.BlockIcons.CASING_BLOCKS[0]};
- }
+ return new ITexture[]{Textures.BlockIcons.MACHINE_CASINGS[1][aColorIndex + 1], aFacing == aSide ? aActive ? frontFaceActive : frontFace : Textures.BlockIcons.CASING_BLOCKS[TAE.GTPP_INDEX(0)]};
}
@@ -105,90 +99,123 @@ extends GregtechMeta_MultiBlockBase {
@Override
public boolean checkRecipe(final ItemStack aStack) {
- ArrayList<ItemStack> tInputList = getStoredInputs();
- int tInputList_sS = tInputList.size();
- for (int i = 0; i < tInputList_sS - 1; ++i) {
- for (int j = i + 1; j < tInputList_sS; ++j) {
- if (GT_Utility.areStacksEqual((ItemStack) tInputList.get(i), (ItemStack) tInputList.get(j))) {
- if (((ItemStack) tInputList.get(i)).stackSize >= ((ItemStack) tInputList.get(j)).stackSize) {
- tInputList.remove(j--);
- tInputList_sS = tInputList.size();
- } else {
- tInputList.remove(i--);
- tInputList_sS = tInputList.size();
- break;
- }
- }
- }
+ /*if (!isCorrectMachinePart(mInventory[1])) {
+ return false;
+ }*/
+
+ Utils.LOG_WARNING("Centrifuge Debug - 1");
+ final GT_Recipe.GT_Recipe_Map map = this.getRecipeMap();
+ if (map == null) {
+ Utils.LOG_WARNING("Centrifuge Debug - False - No recipe map");
+ return false;
}
- ItemStack[] tInputs = (ItemStack[]) tInputList.toArray(new ItemStack[tInputList.size()]);
-
- ArrayList<FluidStack> tFluidList = getStoredFluids();
- int tFluidList_sS = tFluidList.size();
- for (int i = 0; i < tFluidList_sS - 1; ++i) {
- for (int j = i + 1; j < tFluidList_sS; ++j) {
- if (GT_Utility.areFluidsEqual((FluidStack) tFluidList.get(i), (FluidStack) tFluidList.get(j))) {
- if (((FluidStack) tFluidList.get(i)).amount >= ((FluidStack) tFluidList.get(j)).amount) {
- tFluidList.remove(j--);
- tFluidList_sS = tFluidList.size();
- } else {
- tFluidList.remove(i--);
- tFluidList_sS = tFluidList.size();
- break;
- }
+ Utils.LOG_WARNING("Centrifuge Debug - 2");
+ final ArrayList<ItemStack> tInputList = this.getStoredInputs();
+ final long tVoltage = this.getMaxInputVoltage();
+ final byte tTier = (byte) Math.max(1, GT_Utility.getTier(tVoltage));
+ Utils.LOG_WARNING("Centrifuge Debug - Tier variable: "+tTier);
+ final ItemStack[] tInputs = tInputList.toArray(new ItemStack[tInputList.size()]);
+ final ArrayList<FluidStack> tFluidList = this.getStoredFluids();
+ final FluidStack[] tFluids = tFluidList.toArray(new FluidStack[tFluidList.size()]);
+ if ((tInputList.size() > 0) || (tFluids.length > 0)) {
+ GT_Recipe tRecipe = map.findRecipe(this.getBaseMetaTileEntity(), this.mLastRecipe, false, gregtech.api.enums.GT_Values.V[tTier], tFluids, tInputs);
+ tRecipe = this.reduceRecipeTimeByPercentage(tRecipe, 40F);
+ if (tRecipe != null) {
+ Utils.LOG_WARNING("Recipe was not invalid");
+ this.mLastRecipe = tRecipe;
+ this.mEUt = 0;
+ this.mOutputItems = null;
+ this.mOutputFluids = null;
+ if (!tRecipe.isRecipeInputEqual(true, tFluids, tInputs)) {
+
+ Utils.LOG_WARNING("False: 1");
+ return false;
}
- }
- }
- FluidStack[] tFluids = (FluidStack[]) tFluidList.toArray(new FluidStack[tFluidList.size()]);
- if (tInputList.size() > 0) {
- long tVoltage = getMaxInputVoltage();
- byte tTier = (byte) Math.max(1, GT_Utility.getTier(tVoltage));
- GT_Recipe tRecipe = GT_Recipe.GT_Recipe_Map.sCentrifugeRecipes.findRecipe(getBaseMetaTileEntity(), false,
- gregtech.api.enums.GT_Values.V[tTier], tFluids, tInputs);
- tRecipe = this.reduceRecipeTimeByPercentage(tRecipe, 50F);
- if ((tRecipe != null) && (tRecipe.isRecipeInputEqual(true, tFluids, tInputs))) {
- this.mEfficiency = (10000 - ((getIdealStatus() - getRepairStatus()) * 1000));
+
+ this.mMaxProgresstime = tRecipe.mDuration;
+ this.mEfficiency = (10000 - ((this.getIdealStatus() - this.getRepairStatus()) * 1000));
this.mEfficiencyIncrease = 10000;
- int tHeatCapacityDivTiers = (tRecipe.mSpecialValue) + 2;
+ Utils.LOG_WARNING("Centrifuge Debug - 2 - Max Progress Time: "+this.mMaxProgresstime);
if (tRecipe.mEUt <= 16) {
- this.mEUt = (tRecipe.mEUt * (1 << tTier - 1) * (1 << tTier - 1));
- this.mMaxProgresstime = (tRecipe.mDuration / (1 << tTier - 1));
+ Utils.LOG_WARNING("Centrifuge Debug - Using < 16eu/t");
+ this.mEUt = (tRecipe.mEUt * (1 << (tTier - 1)) * (1 << (tTier - 1)));
+ this.mMaxProgresstime = (tRecipe.mDuration / (1 << (tTier - 1)));
+ Utils.LOG_WARNING("Centrifuge Debug - 3.1 - Max Progress Time: "+this.mMaxProgresstime+" EU/t"+this.mEUt + " Obscure GT Value "+gregtech.api.enums.GT_Values.V[(tTier - 1)]);
} else {
+ Utils.LOG_WARNING("Centrifuge Debug - using > 16eu/t");
this.mEUt = tRecipe.mEUt;
this.mMaxProgresstime = tRecipe.mDuration;
- int i = 2;
+ Utils.LOG_WARNING("Centrifuge Debug - 3.2 - Max Progress Time: "+this.mMaxProgresstime+" EU/t"+this.mEUt + " Obscure GT Value "+gregtech.api.enums.GT_Values.V[(tTier - 1)]);
while (this.mEUt <= gregtech.api.enums.GT_Values.V[(tTier - 1)]) {
this.mEUt *= 4;
- this.mMaxProgresstime /= ((tHeatCapacityDivTiers >= i) ? 4 : 2);
- i += 2;
+ this.mMaxProgresstime /= 2;
+ Utils.LOG_WARNING("Centrifuge Debug - 4 - Max Progress Time: "+this.mMaxProgresstime+" EU/t"+this.mEUt);
}
}
- if (tHeatCapacityDivTiers > 0)
- this.mEUt = (int) (this.mEUt * Math.pow(0.95D, tHeatCapacityDivTiers));
+ this.mEUt *= 1;
if (this.mEUt > 0) {
this.mEUt = (-this.mEUt);
+ Utils.LOG_WARNING("Centrifuge Debug - 5 - Max Progress Time: "+this.mMaxProgresstime+" EU/t"+this.mEUt);
+ }
+ ItemStack[] tOut = new ItemStack[tRecipe.mOutputs.length];
+ for (int h = 0; h < tRecipe.mOutputs.length; h++) {
+ tOut[h] = tRecipe.getOutput(h).copy();
+ tOut[h].stackSize = 0;
+ }
+ FluidStack tFOut = null;
+ if (tRecipe.getFluidOutput(0) != null) {
+ tFOut = tRecipe.getFluidOutput(0).copy();
+ }
+ for (int f = 0; f < tOut.length; f++) {
+ if ((tRecipe.mOutputs[f] != null) && (tOut[f] != null)) {
+ for (int g = 0; g < 1; g++) {
+ if (this.getBaseMetaTileEntity().getRandomNumber(10000) < tRecipe.getOutputChance(f)) {
+ tOut[f].stackSize += tRecipe.mOutputs[f].stackSize;
+ }
+ }
+ }
+ }
+ if (tFOut != null) {
+ final int tSize = tFOut.amount;
+ tFOut.amount = tSize * 6;
}
this.mMaxProgresstime = Math.max(1, this.mMaxProgresstime);
-
- ItemStack mNewOutputs[] = new ItemStack[tRecipe.mOutputs.length];
-
- for (int i = 0; i < tRecipe.mOutputs.length; i++){
- if (this.getBaseMetaTileEntity().getRandomNumber(7500) < tRecipe.getOutputChance(i)){
- //Utils.LOG_INFO("Adding a bonus output | "+tRecipe.getOutputChance(i));
- mNewOutputs[i] = tRecipe.getOutput(i);
+ this.mMaxProgresstime /= 4;
+ if (this.mMaxProgresstime <= 0){
+ this.mMaxProgresstime++;
+ }
+ Utils.LOG_WARNING("Centrifuge Debug - 6 - Max Progress Time: "+this.mMaxProgresstime+" EU/t"+this.mEUt);
+ final List<ItemStack> overStacks = new ArrayList<>();
+ for (int f = 0; f < tOut.length; f++) {
+ if (tOut[f].getMaxStackSize() < tOut[f].stackSize) {
+ while (tOut[f].getMaxStackSize() < tOut[f].stackSize) {
+ final ItemStack tmp = tOut[f].copy();
+ tmp.stackSize = tmp.getMaxStackSize();
+ tOut[f].stackSize = tOut[f].stackSize - tOut[f].getMaxStackSize();
+ overStacks.add(tmp);
+ }
}
- else {
- //Utils.LOG_INFO("Adding null output");
- mNewOutputs[i] = null;
+ }
+ if (overStacks.size() > 0) {
+ ItemStack[] tmp = new ItemStack[overStacks.size()];
+ tmp = overStacks.toArray(tmp);
+ tOut = ArrayUtils.addAll(tOut, tmp);
+ }
+ final List<ItemStack> tSList = new ArrayList<>();
+ for (final ItemStack tS : tOut) {
+ if (tS.stackSize > 0) {
+ tSList.add(tS);
}
}
-
- this.mOutputItems = mNewOutputs;
- this.mOutputFluids = new FluidStack[] { tRecipe.getFluidOutput(0) };
- updateSlots();
+ tOut = tSList.toArray(new ItemStack[tSList.size()]);
+ this.mOutputItems = tOut;
+ this.mOutputFluids = new FluidStack[]{tFOut};
+ this.updateSlots();
+ Utils.LOG_WARNING("Centrifuge: True");
return true;
}
}
+ Utils.LOG_WARNING("Centrifuge: Recipe was invalid.");
return false;
}
@@ -231,7 +258,7 @@ extends GregtechMeta_MultiBlockBase {
final IGregTechTileEntity tTileEntity = aBaseMetaTileEntity.getIGregTechTileEntityOffset(xDir + i, h, zDir + j);
//Utils.LOG_WARNING("X:"+tTileEntity.getXCoord()+" Y:"+tTileEntity.getYCoord()+" Z:"+tTileEntity.getZCoord());
- if ((!this.addMaintenanceToMachineList(tTileEntity, TAE.GTPP_INDEX(0))) && (!this.addInputToMachineList(tTileEntity, TAE.GTPP_INDEX(0))) && (!this.addOutputToMachineList(tTileEntity, TAE.GTPP_INDEX(0))) && (!this.addEnergyInputToMachineList(tTileEntity, TAE.GTPP_INDEX(0)))) {
+ if ((!this.addMaintenanceToMachineList(tTileEntity, 57)) && (!this.addInputToMachineList(tTileEntity, 57)) && (!this.addOutputToMachineList(tTileEntity, 57)) && (!this.addEnergyInputToMachineList(tTileEntity, 57))) {
//Maintenance Hatch
if ((tTileEntity != null) && (tTileEntity.getMetaTileEntity() != null)) {
@@ -278,8 +305,9 @@ extends GregtechMeta_MultiBlockBase {
return 10000;
}
+ @Override
public int getPollutionPerTick(final ItemStack aStack) {
- return 13;
+ return 0;
}
@Override
diff --git a/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/GregtechMetaTileEntity_IndustrialCokeOven.java b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/GregtechMetaTileEntity_IndustrialCokeOven.java
index 6eb26eb668..acf05cfd0b 100644
--- a/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/GregtechMetaTileEntity_IndustrialCokeOven.java
+++ b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/GregtechMetaTileEntity_IndustrialCokeOven.java
@@ -55,7 +55,6 @@ extends GregtechMeta_MultiBlockBase {
"1x Maintenance Hatch (one of bottom)",
"1x Muffler Hatch (top middle)",
"Structural Coke Oven Casings for the rest",
- "Causes " + (20 * getPollutionPerTick(null)) + " Pollution per second",
CORE.GT_Tooltip};
}
@@ -255,8 +254,9 @@ extends GregtechMeta_MultiBlockBase {
return 10000;
}
+ @Override
public int getPollutionPerTick(final ItemStack aStack) {
- return 8;
+ return 0;
}
/* @Override
diff --git a/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/GregtechMetaTileEntity_IndustrialCuttingMachine.java b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/GregtechMetaTileEntity_IndustrialCuttingMachine.java
new file mode 100644
index 0000000000..ad1b9cc635
--- /dev/null
+++ b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/GregtechMetaTileEntity_IndustrialCuttingMachine.java
@@ -0,0 +1,254 @@
+package gtPlusPlus.xmod.gregtech.common.tileentities.machines.multi;
+
+import java.util.ArrayList;
+
+import gregtech.api.enums.TAE;
+import gregtech.api.enums.Textures;
+import gregtech.api.interfaces.ITexture;
+import gregtech.api.interfaces.metatileentity.IMetaTileEntity;
+import gregtech.api.interfaces.tileentity.IGregTechTileEntity;
+import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch;
+import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch_Maintenance;
+import gregtech.api.objects.GT_RenderedTexture;
+import gregtech.api.util.GT_Recipe;
+import gregtech.api.util.GT_Utility;
+import gtPlusPlus.core.block.ModBlocks;
+import gtPlusPlus.core.lib.CORE;
+import gtPlusPlus.core.util.Utils;
+import gtPlusPlus.xmod.gregtech.api.gui.GUI_MultiMachine;
+import gtPlusPlus.xmod.gregtech.api.metatileentity.implementations.base.GregtechMeta_MultiBlockBase;
+import net.minecraft.block.Block;
+import net.minecraft.entity.player.InventoryPlayer;
+import net.minecraft.item.ItemStack;
+import net.minecraftforge.fluids.FluidStack;
+
+public class GregtechMetaTileEntity_IndustrialCuttingMachine
+extends GregtechMeta_MultiBlockBase {
+ public GregtechMetaTileEntity_IndustrialCuttingMachine(final int aID, final String aName, final String aNameRegional) {
+ super(aID, aName, aNameRegional);
+ }
+
+ public GregtechMetaTileEntity_IndustrialCuttingMachine(final String aName) {
+ super(aName);
+ }
+
+ @Override
+ public IMetaTileEntity newMetaEntity(final IGregTechTileEntity aTileEntity) {
+ return new GregtechMetaTileEntity_IndustrialCuttingMachine(this.mName);
+ }
+
+ @Override
+ public String[] getDescription() {
+ return new String[]{
+ "Controller Block for the Industrial Cutting Factory",
+ "60% faster than using single block machines of the same voltage",
+ "Size: 3x3x5 [WxHxL] (Hollow)", "Controller (front centered)",
+ "2x Input Bus (side centered)",
+ "2x Output Bus (side centered)",
+ "1x Energy Hatch (top or bottom centered)",
+ "1x Input Hatch (top or bottom centered)",
+ "1x Maintenance Hatch (back centered)",
+ "Cutting Factory Frames for the rest (32 at least!)",
+ CORE.GT_Tooltip
+ };
+ }
+
+ @Override
+ public ITexture[] getTexture(final IGregTechTileEntity aBaseMetaTileEntity, final byte aSide, final byte aFacing, final byte aColorIndex, final boolean aActive, final boolean aRedstone) {
+ if (aSide == aFacing) {
+ return new ITexture[]{Textures.BlockIcons.CASING_BLOCKS[TAE.GTPP_INDEX(29)], new GT_RenderedTexture(aActive ? Textures.BlockIcons.OVERLAY_FRONT_VACUUM_FREEZER_ACTIVE : Textures.BlockIcons.OVERLAY_FRONT_VACUUM_FREEZER)};
+ }
+ return new ITexture[]{Textures.BlockIcons.CASING_BLOCKS[TAE.GTPP_INDEX(29)]};
+ }
+
+ @Override
+ public Object getClientGUI(final int aID, final InventoryPlayer aPlayerInventory, final IGregTechTileEntity aBaseMetaTileEntity) {
+ return new GUI_MultiMachine(aPlayerInventory, aBaseMetaTileEntity, this.getLocalName(), "WireFactory.png");
+ }
+
+ @Override
+ public GT_Recipe.GT_Recipe_Map getRecipeMap() {
+ return GT_Recipe.GT_Recipe_Map.sCutterRecipes;
+ }
+
+ @Override
+ public boolean isFacingValid(final byte aFacing) {
+ return aFacing > 1;
+ }
+
+ @Override
+ public boolean checkRecipe(final ItemStack aStack) {
+ final ArrayList<ItemStack> tInputList = this.getStoredInputs();
+ final ArrayList<FluidStack> tFluidList = this.getStoredFluids();
+ for (final ItemStack tInput : tInputList) {
+ for (final FluidStack tFluid : tFluidList) {
+ final long tVoltage = this.getMaxInputVoltage();
+ final byte tTier = (byte) Math.max(1, GT_Utility.getTier(tVoltage));
+
+ GT_Recipe tRecipe = GT_Recipe.GT_Recipe_Map.sCutterRecipes.findRecipe(this.getBaseMetaTileEntity(), false, gregtech.api.enums.GT_Values.V[tTier], new FluidStack[]{tFluid}, new ItemStack[]{tInput});
+ //tRecipe = this.reduceRecipeTimeByPercentage(tRecipe, 60F);
+ if (tRecipe != null) {
+
+ //More than or one input
+ if (tInputList.size() > 0) {
+
+ if (tRecipe.isRecipeInputEqual(true, new FluidStack[]{tFluid}, new ItemStack[]{tInput})) {
+ this.mEfficiency = (10000 - ((this.getIdealStatus() - this.getRepairStatus()) * 1000));
+ this.mEfficiencyIncrease = 10000;
+ if (tRecipe.mEUt <= 16) {
+ this.mEUt = (tRecipe.mEUt * (1 << (tTier - 1)) * (1 << (tTier - 1)));
+ this.mMaxProgresstime = (tRecipe.mDuration / (1 << (tTier - 1)));
+ } else {
+ this.mEUt = tRecipe.mEUt;
+ this.mMaxProgresstime = tRecipe.mDuration;
+ while (this.mEUt <= gregtech.api.enums.GT_Values.V[(tTier - 1)]) {
+ this.mEUt *= 4;
+ this.mMaxProgresstime /= 2;
+ }
+ }
+ if (this.mEUt > 0) {
+ this.mEUt = (-this.mEUt);
+ }
+ this.mMaxProgresstime = Math.max(1, this.mMaxProgresstime);
+ ItemStack[] mOutputStacks = new ItemStack[9];
+ for (int i=0;i<9;i++){
+ if (tRecipe.getOutput(i) != null){
+ mOutputStacks[i] = tRecipe.getOutput(i);
+ }
+ }
+ this.mOutputItems = mOutputStacks.clone();
+ //this.updateSlots();
+ return true;
+ }
+ }
+ }
+ }
+ }
+ return false;
+ }
+
+ @Override
+ public boolean checkMachine(final IGregTechTileEntity aBaseMetaTileEntity, final ItemStack aStack) {
+ final byte tSide = this.getBaseMetaTileEntity().getBackFacing();
+ if ((this.getBaseMetaTileEntity().getAirAtSideAndDistance(this.getBaseMetaTileEntity().getBackFacing(), 1)) && (this.getBaseMetaTileEntity().getAirAtSideAndDistance(this.getBaseMetaTileEntity().getBackFacing(), 2) && (this.getBaseMetaTileEntity().getAirAtSideAndDistance(this.getBaseMetaTileEntity().getBackFacing(), 3)))) {
+ int tAirCount = 0;
+ for (byte i = -1; i < 2; i = (byte) (i + 1)) {
+ for (byte j = -1; j < 2; j = (byte) (j + 1)) {
+ for (byte k = -1; k < 2; k = (byte) (k + 1)) {
+ if (this.getBaseMetaTileEntity().getAirOffset(i, j, k)) {
+ tAirCount++;
+ }
+ }
+ }
+ }
+ if (tAirCount != 10) {
+ Utils.LOG_INFO("False 1");
+ return false;
+ }
+ for (byte i = 2; i < 6; i = (byte) (i + 1)) {
+ IGregTechTileEntity tTileEntity;
+ if ((null != (tTileEntity = this.getBaseMetaTileEntity().getIGregTechTileEntityAtSideAndDistance(i, 2))) &&
+ (tTileEntity.getFrontFacing() == this.getBaseMetaTileEntity().getFrontFacing()) && (tTileEntity.getMetaTileEntity() != null) &&
+ ((tTileEntity.getMetaTileEntity() instanceof GregtechMetaTileEntity_IndustrialCuttingMachine))) {
+ //Utils.LOG_INFO("False 1");
+ return false;
+ }
+ }
+ final int tX = this.getBaseMetaTileEntity().getXCoord();
+ final int tY = this.getBaseMetaTileEntity().getYCoord();
+ final int tZ = this.getBaseMetaTileEntity().getZCoord();
+ for (byte i = -1; i < 2; i = (byte) (i + 1)) {
+ for (byte j = -1; j < 2; j = (byte) (j + 1)) {
+ if ((i != 0) || (j != 0)) {
+ for (byte k = 0; k < 5; k = (byte) (k + 1)) {
+ if (((i == 0) || (j == 0)) && ((k == 1) || (k == 2) || (k == 3))) {
+ if ((this.getBaseMetaTileEntity().getBlock(tX + (tSide == 5 ? k : tSide == 4 ? -k : i), tY + j, tZ + (tSide == 2 ? -k : tSide == 3 ? k : i)) == this.getCasingBlock()) && (this.getBaseMetaTileEntity().getMetaID(tX + (tSide == 5 ? k : tSide == 4 ? -k : i), tY + j, tZ + (tSide == 2 ? -k : tSide == 3 ? k : i)) == this.getCasingMeta())) {
+ }
+ else if (!this.addToMachineList(this.getBaseMetaTileEntity().getIGregTechTileEntity(tX + (tSide == 5 ? k : tSide == 4 ? -k : i), tY + j, tZ + (tSide == 2 ? -k : tSide == 3 ? k : i))) && (!this.addEnergyInputToMachineList(this.getBaseMetaTileEntity().getIGregTechTileEntity(tX + (tSide == 5 ? k : tSide == 4 ? -k : i), tY + j, tZ + (tSide == 2 ? -k : tSide == 3 ? k : i))))) {
+ Utils.LOG_INFO("False 2");
+ return false;
+ }
+ }
+ else if ((this.getBaseMetaTileEntity().getBlock(tX + (tSide == 5 ? k : tSide == 4 ? -k : i), tY + j, tZ + (tSide == 2 ? -k : tSide == 3 ? k : i)) == this.getCasingBlock()) && (this.getBaseMetaTileEntity().getMetaID(tX + (tSide == 5 ? k : tSide == 4 ? -k : i), tY + j, tZ + (tSide == 2 ? -k : tSide == 3 ? k : i)) == this.getCasingMeta())) {
+ }
+ else {
+ Utils.LOG_INFO("False 3");
+ return false;
+ }
+ }
+ }
+ }
+ }
+ if ((this.mOutputHatches.size() != 0) || (this.mInputHatches.size() < 0)) {
+ Utils.LOG_INFO("Use Busses, Not Hatches for Input/Output.");
+ return false;
+ }
+ if ((this.mInputBusses.size() != 2) || (this.mOutputBusses.size() != 2)) {
+ Utils.LOG_INFO("Incorrect amount of Input & Output busses.");
+ return false;
+ }
+ this.mMaintenanceHatches.clear();
+ final IGregTechTileEntity tTileEntity = this.getBaseMetaTileEntity().getIGregTechTileEntityAtSideAndDistance(this.getBaseMetaTileEntity().getBackFacing(), 4);
+ if ((tTileEntity != null) && (tTileEntity.getMetaTileEntity() != null)) {
+ if ((tTileEntity.getMetaTileEntity() instanceof GT_MetaTileEntity_Hatch_Maintenance)) {
+ this.mMaintenanceHatches.add((GT_MetaTileEntity_Hatch_Maintenance) tTileEntity.getMetaTileEntity());
+ ((GT_MetaTileEntity_Hatch) tTileEntity.getMetaTileEntity()).mMachineBlock = this.getCasingTextureIndex();
+ } else {
+ Utils.LOG_INFO("Maintenance hatch must be in the middle block on the back.");
+ return false;
+ }
+ }
+ if ((this.mMaintenanceHatches.size() != 1) || (this.mEnergyHatches.size() != 1)) {
+ Utils.LOG_INFO("Incorrect amount of Maintenance or Energy hatches.");
+ return false;
+ }
+ } else {
+ Utils.LOG_INFO("False 5");
+ return false;
+ }
+ Utils.LOG_INFO("True");
+ return true;
+ }
+
+ @Override
+ public int getMaxEfficiency(final ItemStack aStack) {
+ return 10000;
+ }
+
+ @Override
+ public int getPollutionPerTick(final ItemStack aStack) {
+ return 80;
+ }
+
+ @Override
+ public int getAmountOfOutputs() {
+ return 2;
+ }
+
+ @Override
+ public boolean explodesOnComponentBreak(final ItemStack aStack) {
+ return false;
+ }
+
+ public Block getCasingBlock() {
+ return ModBlocks.blockCasings2Misc;
+ }
+
+
+ public byte getCasingMeta() {
+ return 13;
+ }
+
+
+ public byte getCasingTextureIndex() {
+ return (byte) TAE.GTPP_INDEX(29);
+ }
+
+ private boolean addToMachineList(final IGregTechTileEntity tTileEntity) {
+ return ((this.addMaintenanceToMachineList(tTileEntity, this.getCasingTextureIndex())) || (this.addInputToMachineList(tTileEntity, this.getCasingTextureIndex())) || (this.addOutputToMachineList(tTileEntity, this.getCasingTextureIndex())) || (this.addMufflerToMachineList(tTileEntity, this.getCasingTextureIndex())));
+ }
+
+ private boolean addEnergyInputToMachineList(final IGregTechTileEntity tTileEntity) {
+ return ((this.addEnergyInputToMachineList(tTileEntity, this.getCasingTextureIndex())));
+ }
+} \ No newline at end of file
diff --git a/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/GregtechMetaTileEntity_IndustrialElectrolyzer.java b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/GregtechMetaTileEntity_IndustrialElectrolyzer.java
index 280af1d3f8..c07d331dbb 100644
--- a/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/GregtechMetaTileEntity_IndustrialElectrolyzer.java
+++ b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/GregtechMetaTileEntity_IndustrialElectrolyzer.java
@@ -55,7 +55,6 @@ extends GregtechMeta_MultiBlockBase {
"1x Maintenance Hatch (anywhere)",
"1x Muffler (anywhere)",
"Electrolyzer Casings for the rest (16 at least!)",
- "Causes " + (20 * getPollutionPerTick(null)) + " Pollution per second",
CORE.GT_Tooltip};
}
@@ -244,8 +243,9 @@ extends GregtechMeta_MultiBlockBase {
return 10000;
}
+ @Override
public int getPollutionPerTick(final ItemStack aStack) {
- return 20;
+ return 0;
}
@Override
diff --git a/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/GregtechMetaTileEntity_IndustrialMacerator.java b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/GregtechMetaTileEntity_IndustrialMacerator.java
index e61d18b184..48d5ee7452 100644
--- a/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/GregtechMetaTileEntity_IndustrialMacerator.java
+++ b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/GregtechMetaTileEntity_IndustrialMacerator.java
@@ -61,7 +61,6 @@ extends GregtechMeta_MultiBlockBase {
"1x Maintenance Hatch (Any casing)",
"1x Energy Hatch (Any casing)",
"Maceration Stack Casings for the rest (26 at least!)",
- "Causes " + (20 * getPollutionPerTick(null)) + " Pollution per second",
CORE.GT_Tooltip};
}
@@ -243,8 +242,9 @@ extends GregtechMeta_MultiBlockBase {
return 10000;
}
+ @Override
public int getPollutionPerTick(final ItemStack aStack) {
- return 25;
+ return 0;
}
@Override
diff --git a/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/GregtechMetaTileEntity_IndustrialPlatePress.java b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/GregtechMetaTileEntity_IndustrialPlatePress.java
index a5599522af..05454a37c7 100644
--- a/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/GregtechMetaTileEntity_IndustrialPlatePress.java
+++ b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/GregtechMetaTileEntity_IndustrialPlatePress.java
@@ -51,7 +51,6 @@ extends GregtechMeta_MultiBlockBase {
"1x Maintenance Hatch (anywhere)",
"1x Muffler (anywhere)",
"Material Press Machine Casings for the rest (16 at least!)",
- "Causes " + (20 * getPollutionPerTick(null)) + " Pollution per second",
CORE.GT_Tooltip};
}
@@ -185,8 +184,9 @@ extends GregtechMeta_MultiBlockBase {
return 10000;
}
+ @Override
public int getPollutionPerTick(final ItemStack aStack) {
- return 17;
+ return 0;
}
@Override
diff --git a/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/GregtechMetaTileEntity_IndustrialSifter.java b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/GregtechMetaTileEntity_IndustrialSifter.java
index 5fc1146bd1..d4272430de 100644
--- a/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/GregtechMetaTileEntity_IndustrialSifter.java
+++ b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/GregtechMetaTileEntity_IndustrialSifter.java
@@ -14,7 +14,6 @@ import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch_Outpu
import gregtech.api.objects.GT_RenderedTexture;
import gregtech.api.util.GT_Recipe;
import gregtech.api.util.GT_Utility;
-import gregtech.common.blocks.GT_Block_Machines;
import gtPlusPlus.core.block.ModBlocks;
import gtPlusPlus.core.lib.CORE;
import gtPlusPlus.core.util.Utils;
@@ -53,9 +52,8 @@ extends GregtechMeta_MultiBlockBase {
"4x Output Bus (Any top or bottom edge casing)",
"1x Maintenance Hatch (Any top or bottom edge casing)",
"1x Energy Hatch (Any top or bottom edge casing)",
- "9x Sieve Grate (Top and Middle 3x3)",
+ "18x Sieve Grate (Top and Middle 3x3)",
"Sieve Casings for the rest (47)",
- "Causes " + (20 * getPollutionPerTick(null)) + " Pollution per second",
CORE.GT_Tooltip};
}
@@ -152,24 +150,25 @@ extends GregtechMeta_MultiBlockBase {
//Make a recipe instance for the rest of the method.
final GT_Recipe tRecipe = GT_Recipe.GT_Recipe_Map.sSifterRecipes.findRecipe(this.getBaseMetaTileEntity(), false, 9223372036854775807L, null, tInputs);
- if (tRecipe != null)
- baseRecipe = tRecipe.copy();
+ if (tRecipe != null) {
+ this.baseRecipe = tRecipe.copy();
+ }
- if (cloneRecipe != tRecipe || cloneRecipe == null){
- cloneRecipe = tRecipe.copy();
+ if ((this.cloneRecipe != tRecipe) || (this.cloneRecipe == null)){
+ this.cloneRecipe = tRecipe.copy();
Utils.LOG_WARNING("Setting Recipe");
- }
- if (mInputStacks != tRecipe.mInputs || mInputStacks == null){
- mInputStacks = tRecipe.mInputs;
+ }
+ if ((this.mInputStacks != tRecipe.mInputs) || (this.mInputStacks == null)){
+ this.mInputStacks = tRecipe.mInputs;
Utils.LOG_WARNING("Setting Recipe Inputs");
}
- if (cloneChances != tRecipe.mChances || cloneChances == null){
- cloneChances = tRecipe.mChances.clone();
+ if ((this.cloneChances != tRecipe.mChances) || (this.cloneChances == null)){
+ this.cloneChances = tRecipe.mChances.clone();
Utils.LOG_WARNING("Setting Chances");
}
- for (int r=0;r<cloneChances.length;r++){
- Utils.LOG_WARNING("Original map Output["+r+"] chance = "+cloneChances[r]);
+ for (int r=0;r<this.cloneChances.length;r++){
+ Utils.LOG_WARNING("Original map Output["+r+"] chance = "+this.cloneChances[r]);
}
Utils.LOG_WARNING("3.1");
@@ -179,24 +178,24 @@ extends GregtechMeta_MultiBlockBase {
Utils.LOG_WARNING("3.2");
- if (cloneRecipe.mChances != null){
- outputChances = cloneRecipe.mChances.clone();
+ if (this.cloneRecipe.mChances != null){
+ outputChances = this.cloneRecipe.mChances.clone();
Utils.LOG_WARNING("3.3");
for (int r=0;r<outputChances.length;r++){
Utils.LOG_WARNING("Output["+r+"] chance = "+outputChances[r]);
if (outputChances[r]<10000){
- int temp = outputChances[r];
- if (outputChances[r] < 8000 && outputChances[r] >= 1){
+ final int temp = outputChances[r];
+ if ((outputChances[r] < 8000) && (outputChances[r] >= 1)){
outputChances[r] = temp+1200;
Utils.LOG_WARNING("Output["+r+"] chance now = "+outputChances[r]);
}
- else if (outputChances[r] < 9000 && outputChances[r] >= 8000){
+ else if ((outputChances[r] < 9000) && (outputChances[r] >= 8000)){
outputChances[r] = temp+400;
Utils.LOG_WARNING("Output["+r+"] chance now = "+outputChances[r]);
}
- else if (outputChances[r] <= 9900 && outputChances[r] >= 9000){
+ else if ((outputChances[r] <= 9900) && (outputChances[r] >= 9000)){
outputChances[r] = temp+100;
Utils.LOG_WARNING("Output["+r+"] chance now = "+outputChances[r]);
}
@@ -206,7 +205,7 @@ extends GregtechMeta_MultiBlockBase {
Utils.LOG_WARNING("3.4");
//Rebuff Drop Rates for % output
- cloneRecipe.mChances = outputChances;
+ this.cloneRecipe.mChances = outputChances;
}
@@ -214,24 +213,24 @@ extends GregtechMeta_MultiBlockBase {
Utils.LOG_WARNING("4");
- final int tValidOutputSlots = this.getValidOutputSlots(this.getBaseMetaTileEntity(), cloneRecipe, tInputs);
+ final int tValidOutputSlots = this.getValidOutputSlots(this.getBaseMetaTileEntity(), this.cloneRecipe, tInputs);
Utils.LOG_WARNING("Sifter - Valid Output Hatches: "+tValidOutputSlots);
//More than or one input
if ((tInputList.size() > 0) && (tValidOutputSlots >= 1)) {
- if ((cloneRecipe != null) && (cloneRecipe.isRecipeInputEqual(true, null, tInputs))) {
- Utils.LOG_WARNING("Valid Recipe found - size "+cloneRecipe.mOutputs.length);
+ if ((this.cloneRecipe != null) && (this.cloneRecipe.isRecipeInputEqual(true, null, tInputs))) {
+ Utils.LOG_WARNING("Valid Recipe found - size "+this.cloneRecipe.mOutputs.length);
this.mEfficiency = (10000 - ((this.getIdealStatus() - this.getRepairStatus()) * 1000));
this.mEfficiencyIncrease = 10000;
- this.mEUt = (-cloneRecipe.mEUt);
- this.mMaxProgresstime = Math.max(1, (cloneRecipe.mDuration/5));
- final ItemStack[] outputs = new ItemStack[cloneRecipe.mOutputs.length];
- for (int i = 0; i < cloneRecipe.mOutputs.length; i++){
- if (this.getBaseMetaTileEntity().getRandomNumber(7500) < cloneRecipe.getOutputChance(i)){
+ this.mEUt = (-this.cloneRecipe.mEUt);
+ this.mMaxProgresstime = Math.max(1, (this.cloneRecipe.mDuration/5));
+ final ItemStack[] outputs = new ItemStack[this.cloneRecipe.mOutputs.length];
+ for (int i = 0; i < this.cloneRecipe.mOutputs.length; i++){
+ if (this.getBaseMetaTileEntity().getRandomNumber(7500) < this.cloneRecipe.getOutputChance(i)){
Utils.LOG_WARNING("Adding a bonus output");
- outputs[i] = cloneRecipe.getOutput(i);
+ outputs[i] = this.cloneRecipe.getOutput(i);
}
else {
Utils.LOG_WARNING("Adding null output");
@@ -256,7 +255,7 @@ extends GregtechMeta_MultiBlockBase {
final int zDir = ForgeDirection.getOrientation(aBaseMetaTileEntity.getBackFacing()).offsetZ * 2;
int tAmount = 0;
- controller = false;
+ this.controller = false;
for (int i = -2; i < 3; i++) {
for (int j = -2; j < 3; j++) {
for (int h = 0; h < 3; h++) {
@@ -276,7 +275,7 @@ extends GregtechMeta_MultiBlockBase {
// Sifter Floor/Roof inner 3x3
if (((i != -2) && (i != 2)) && ((j != -2) && (j != 2))) {
- if (h != 0){
+ if (h != 0){
if (!this.addToMachineList(tTileEntity, TAE.GTPP_INDEX(21))) {
if (aBaseMetaTileEntity.getBlockOffset(xDir + i, h, zDir + j) != ModBlocks.blockCasings2Misc) {
Utils.LOG_MACHINE_INFO("Sifter Casing(s) Missing from one of the "+sHeight+" layers inner 3x3.");
@@ -303,12 +302,12 @@ extends GregtechMeta_MultiBlockBase {
tAmount++;
}
}
- }
+ }
else {
//Dealt with inner 5x5, now deal with the exterior.
//Deal with all 4 sides (Sifter walls)
boolean checkController = false;
- if (((xDir + i) != 0) || ((zDir + j) != 0) && h == 0) {//no controller
+ if (((xDir + i) != 0) || (((zDir + j) != 0) && (h == 0))) {//no controller
checkController = true;
}
else {
@@ -318,7 +317,7 @@ extends GregtechMeta_MultiBlockBase {
if (!this.addToMachineList(tTileEntity, TAE.GTPP_INDEX(21))) {
if (!checkController){
if (aBaseMetaTileEntity.getBlockOffset(xDir + i, h, zDir + j) != ModBlocks.blockCasings2Misc) {
- if (tTileEntity instanceof GregtechMetaTileEntity_IndustrialSifter || aBaseMetaTileEntity.getBlockOffset(xDir + i, h, zDir + j) == GregTech_API.sBlockMachines){
+ if ((tTileEntity instanceof GregtechMetaTileEntity_IndustrialSifter) || (aBaseMetaTileEntity.getBlockOffset(xDir + i, h, zDir + j) == GregTech_API.sBlockMachines)){
if (h != 0){
Utils.LOG_MACHINE_INFO("Found a secondary controller at the wrong Y level.");
return false;
@@ -329,36 +328,36 @@ extends GregtechMeta_MultiBlockBase {
Utils.LOG_MACHINE_INFO("Instead, found "+aBaseMetaTileEntity.getBlockOffset(xDir + i, h, zDir + j).getLocalizedName());
return false;
}
- }
-
- if (aBaseMetaTileEntity.getMetaIDOffset(xDir + i, h, zDir + j) != 5) {
- if (tTileEntity instanceof GregtechMetaTileEntity_IndustrialSifter || aBaseMetaTileEntity.getBlockOffset(xDir + i, h, zDir + j) == GregTech_API.sBlockMachines){
-
}
- else {
- Utils.LOG_MACHINE_INFO("Sifter Casings Missing from somewhere in the "+sHeight+" layer edge.");
- Utils.LOG_MACHINE_INFO("Incorrect Meta value for block, expected 5.");
- Utils.LOG_MACHINE_INFO("Instead, found "+aBaseMetaTileEntity.getMetaIDOffset(xDir + i, h, zDir + j)+".");
- return false;
+
+ if (aBaseMetaTileEntity.getMetaIDOffset(xDir + i, h, zDir + j) != 5) {
+ if ((tTileEntity instanceof GregtechMetaTileEntity_IndustrialSifter) || (aBaseMetaTileEntity.getBlockOffset(xDir + i, h, zDir + j) == GregTech_API.sBlockMachines)){
+
+ }
+ else {
+ Utils.LOG_MACHINE_INFO("Sifter Casings Missing from somewhere in the "+sHeight+" layer edge.");
+ Utils.LOG_MACHINE_INFO("Incorrect Meta value for block, expected 5.");
+ Utils.LOG_MACHINE_INFO("Instead, found "+aBaseMetaTileEntity.getMetaIDOffset(xDir + i, h, zDir + j)+".");
+ return false;
+ }
}
}
- }
- tAmount++;
+ tAmount++;
}
else {
- tAmount++;
+ tAmount++;
}
}
}
}
}
if ((this.mInputBusses.size() != 1) || (this.mOutputBusses.size() != 4)
- || (this.mMaintenanceHatches.size() != 1) || (this.mEnergyHatches.size() != 1)) {
- Utils.LOG_MACHINE_INFO("Returned False 3");
- Utils.LOG_MACHINE_INFO("Input Buses: "+this.mInputBusses.size()+" | expected: 1");
- Utils.LOG_MACHINE_INFO("Output Buses: "+this.mOutputBusses.size()+" | expected: 4");
- Utils.LOG_MACHINE_INFO("Energy Hatches: "+this.mEnergyHatches.size()+" | expected: 1");
- Utils.LOG_MACHINE_INFO("Maint. hatches: "+this.mMaintenanceHatches.size()+" | expected: 1");
+ || (this.mMaintenanceHatches.size() != 1) || (this.mEnergyHatches.size() < 1)) {
+ Utils.LOG_INFO("Returned False 3");
+ Utils.LOG_INFO("Input Buses: "+this.mInputBusses.size()+" | expected: 1");
+ Utils.LOG_INFO("Output Buses: "+this.mOutputBusses.size()+" | expected: 4");
+ Utils.LOG_INFO("Energy Hatches: "+this.mEnergyHatches.size()+" | expected: 1");
+ Utils.LOG_INFO("Maint. hatches: "+this.mMaintenanceHatches.size()+" | expected: 1");
return false;
}
final int height = this.getBaseMetaTileEntity().getYCoord();
@@ -384,7 +383,7 @@ extends GregtechMeta_MultiBlockBase {
}
public boolean ignoreController(final Block tTileEntity) {
- if (!controller && (tTileEntity == GregTech_API.sBlockMachines)) {
+ if (!this.controller && (tTileEntity == GregTech_API.sBlockMachines)) {
return true;
}
return false;
@@ -397,7 +396,7 @@ extends GregtechMeta_MultiBlockBase {
@Override
public int getPollutionPerTick(final ItemStack aStack) {
- return 12;
+ return 0;
}
@Override
diff --git a/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/GregtechMetaTileEntity_IndustrialThermalCentrifuge.java b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/GregtechMetaTileEntity_IndustrialThermalCentrifuge.java
index 5b8a3a30c9..2ffa242fc2 100644
--- a/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/GregtechMetaTileEntity_IndustrialThermalCentrifuge.java
+++ b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/GregtechMetaTileEntity_IndustrialThermalCentrifuge.java
@@ -44,7 +44,7 @@ extends GregtechMeta_MultiBlockBase {
return new String[]{
"Controller Block for the Industrial Thermal Centrifuge",
"60% faster than using single block machines of the same voltage",
- "Size: 3x2x3 [LxHxW]", "Controller (front centered)",
+ "Size: 3x2x3 [WxLxH] (Hollow)", "Controller (front centered)",
"1x Input Bus (Any casing)",
"1x Output Bus (Any casing)",
"1x Maintenance Hatch (Any casing)",
@@ -53,7 +53,7 @@ extends GregtechMeta_MultiBlockBase {
"Thermal processing Casings for the rest (8 at least!)",
"Causes " + (20 * getPollutionPerTick(null)) + " Pollution per second",
CORE.GT_Tooltip
-
+
};
}
@@ -75,17 +75,6 @@ extends GregtechMeta_MultiBlockBase {
return GT_Recipe.GT_Recipe_Map.sThermalCentrifugeRecipes;
}
- public void startSoundLoop(byte aIndex, double aX, double aY, double aZ) {
- super.startSoundLoop(aIndex, aX, aY, aZ);
- if (aIndex == 1) {
- GT_Utility.doSoundAtClient((String) GregTech_API.sSoundList.get(Integer.valueOf(207)), 10, 1.0F, aX, aY, aZ);
- }
- }
-
- public void startProcess() {
- sendLoopStart((byte) 1);
- }
-
@Override
public boolean isFacingValid(final byte aFacing) {
return aFacing > 1;
@@ -125,15 +114,15 @@ extends GregtechMeta_MultiBlockBase {
this.mEUt = (-this.mEUt);
}
this.mMaxProgresstime = Math.max(1, this.mMaxProgresstime);
-
+
ItemStack mNewOutputs[] = new ItemStack[16];
+
-
-
+
for (int f=0;f<tRecipe.mOutputs.length;f++){
mNewOutputs[f] = tRecipe.getOutput(f);
}
-
+
this.mOutputItems = mNewOutputs;
this.updateSlots();
return true;
@@ -172,17 +161,6 @@ extends GregtechMeta_MultiBlockBase {
}
}
}
- if ((this.mInputBusses.size() < 1) || (this.mOutputBusses.size() < 1)
- || (this.mMaintenanceHatches.size() != 1) || (this.mEnergyHatches.size() < 1)
- || (this.mMufflerHatches.size() < 1)) {
- Utils.LOG_MACHINE_INFO("Returned False");
- Utils.LOG_MACHINE_INFO("Input Buses: "+this.mInputBusses.size()+" | expected: >= 1 | "+(this.mInputBusses.size() >= 1));
- Utils.LOG_MACHINE_INFO("Output Buses: "+this.mOutputBusses.size()+" | expected: >= 1 | "+(this.mOutputBusses.size() >= 1));
- Utils.LOG_MACHINE_INFO("Energy Hatches: "+this.mEnergyHatches.size()+" | expected: >= 1 | "+(this.mEnergyHatches.size() >= 1));
- Utils.LOG_MACHINE_INFO("Muffler Hatches: "+this.mMufflerHatches.size()+" | expected: >= 1 | "+(this.mMufflerHatches.size() >= 1));
- Utils.LOG_MACHINE_INFO("Maint. Hatches: "+this.mMaintenanceHatches.size()+" | expected: 1 | "+(this.mMaintenanceHatches.size() != 1));
- return false;
- }
Utils.LOG_WARNING("Trying to assemble structure. Completed? "+(tAmount >= 8));
return (tAmount >= 8);
}
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 9dcd257944..9b7927c5ad 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
@@ -1,11 +1,6 @@
package gtPlusPlus.xmod.gregtech.common.tileentities.machines.multi;
import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.List;
-
-import org.apache.commons.lang3.ArrayUtils;
-
import gregtech.api.enums.TAE;
import gregtech.api.enums.Textures;
import gregtech.api.interfaces.ITexture;
@@ -14,7 +9,6 @@ import gregtech.api.interfaces.tileentity.IGregTechTileEntity;
import gregtech.api.objects.GT_RenderedTexture;
import gregtech.api.util.GT_Recipe;
import gregtech.api.util.GT_Utility;
-import gregtech.api.util.Recipe_GT;
import gtPlusPlus.core.block.ModBlocks;
import gtPlusPlus.core.lib.CORE;
import gtPlusPlus.core.util.Utils;
@@ -28,14 +22,13 @@ import net.minecraft.block.Block;
import net.minecraft.entity.player.InventoryPlayer;
import net.minecraft.init.Blocks;
import net.minecraft.item.ItemStack;
-import net.minecraft.nbt.NBTTagCompound;
import net.minecraftforge.common.util.ForgeDirection;
import net.minecraftforge.fluids.FluidStack;
public class GregtechMetaTileEntity_IndustrialWashPlant
extends GregtechMeta_MultiBlockBase {
- private int mFilledCount = 0;
+ public GT_Recipe mLastRecipe;
public GregtechMetaTileEntity_IndustrialWashPlant(final int aID, final String aName, final String aNameRegional) {
super(aID, aName, aNameRegional);
@@ -54,21 +47,19 @@ extends GregtechMeta_MultiBlockBase {
public String[] getDescription() {
return new String[]{
"Controller Block for the Industrial Ore Washing Plant",
- "60% faster than using single block machines of the same voltage",
- "Size: 5x3x7 [WxHxL] (open)",
- "The inner 3x2x5 is air or water",
+ "80% faster than using single block machines of the same voltage",
+ "Size: 7x2x5 [WxHxL] (open)",
+ "X X",
+ "X X",
+ "XXXXX",
"Controller (front centered)",
"1x Input Bus (Any casing)",
"1x Output Bus (Any casing)",
- "1x Input Hatch (Any casing)",
- "1x Output Hatch (Any casing)",
"1x Maintenance Hatch (Any casing)",
- "1x Muffler Hatch (Any casing)",
"1x Energy Hatch (Any casing)",
- "Wash Plant Casing (The rest)",
- "Causes " + (20 * getPollutionPerTick(null)) + " Pollution per second",
CORE.GT_Tooltip
- };
+
+ };
}
@Override
@@ -95,98 +86,31 @@ extends GregtechMeta_MultiBlockBase {
}
@Override
- public boolean checkRecipe(final ItemStack aStack) {
-
- if (!checkForWater()){
- Utils.LOG_WARNING("Did not find enough cleaning solution.");
- return false;
- }
- Utils.LOG_INFO("1");
-
- /*ArrayList<ItemStack> tInputList = getStoredInputs();
- ArrayList<FluidStack> tFluidInputs = getStoredFluids();
- for (ItemStack tInput : tInputList) {
- Utils.LOG_INFO("2");
- long tVoltage = getMaxInputVoltage();
- byte tTier = (byte) Math.max(1, GT_Utility.getTier(tVoltage));
- GT_Recipe tRecipe = GT_Recipe.GT_Recipe_Map.sOreWasherRecipes.findRecipe(getBaseMetaTileEntity(), false,
- gregtech.api.enums.GT_Values.V[tTier],
- new FluidStack[] { (tFluidInputs.isEmpty()) ? null : (FluidStack) tFluidInputs.get(0) },
- new ItemStack[] { tInput });
-
- tRecipe = this.reduceRecipeTimeByPercentage(tRecipe, 60);
-
- if (tRecipe != null) {
- Utils.LOG_INFO("3");
- this.mEfficiency = (10000 - ((getIdealStatus() - getRepairStatus()) * 1000));
- this.mEfficiencyIncrease = 10000;
-
- this.mEUt = tRecipe.mEUt;
- if (tRecipe.mEUt <= 16) {
- Utils.LOG_INFO("3.1");
- this.mEUt = (tRecipe.mEUt * (1 << tTier - 1) * (1 << tTier - 1));
- this.mMaxProgresstime = (tRecipe.mDuration / (1 << tTier - 1));
- } else {
- Utils.LOG_INFO("3.2");
- this.mEUt = tRecipe.mEUt;
- this.mMaxProgresstime = tRecipe.mDuration;
- while (this.mEUt <= gregtech.api.enums.GT_Values.V[(tTier - 1)]) {
- Utils.LOG_INFO("3.3");
- this.mEUt *= 4;
- this.mMaxProgresstime /= 2;
- }
- }
- Utils.LOG_INFO("4");
- if (this.mEUt > 0) {
- Utils.LOG_INFO("4.1");
- this.mEUt = (-this.mEUt);
- }
- this.mMaxProgresstime = (this.mMaxProgresstime * 2 / (1 + 3));
- this.mMaxProgresstime = Math.max(1, this.mMaxProgresstime);
- if (tRecipe.mOutputs.length > 0){
- //this.mOutputItems = new ItemStack[] { tRecipe.getOutput(0) };
- ItemStack mNewOutputs[] = new ItemStack[tRecipe.mOutputs.length];
- for (int f=0;f<tRecipe.mOutputs.length;f++){
- Utils.LOG_INFO("Step 5 - Adding Output");
- mNewOutputs[f] = tRecipe.mOutputs[f].copy();
- }
- this.mOutputItems = mNewOutputs;
- updateSlots();
- }
- if (tRecipe.mFluidOutputs.length >= 0){
- //this.mOutputFluids = new FluidStack[] { tRecipe.getFluidOutput(0) };
- FluidStack outputFluids[] = new FluidStack[1];
- if (true){
- Utils.LOG_INFO("Adding Sludge");
- outputFluids[0] = FluidUtils.getFluidStack("potion.poison", 10);
- }
- this.mOutputFluids = outputFluids;
- updateSlots();
- }
- updateSlots();
- Utils.LOG_INFO("5");
- return true;
- }
- }
- return false;*/
-
+ public boolean checkRecipe(final ItemStack aStack) { //TODO - Add Check to make sure Fluid output isn't full
ArrayList<ItemStack> tInputList = getStoredInputs();
ArrayList<FluidStack> tFluidInputs = getStoredFluids();
for (ItemStack tInput : tInputList) {
long tVoltage = getMaxInputVoltage();
byte tTier = (byte) Math.max(1, GT_Utility.getTier(tVoltage));
- GT_Recipe tRecipe = GT_Recipe.GT_Recipe_Map.sOreWasherRecipes.findRecipe(getBaseMetaTileEntity(), false,
- gregtech.api.enums.GT_Values.V[tTier],
- new FluidStack[] { (tFluidInputs.isEmpty()) ? null : (FluidStack) tFluidInputs.get(0) },
- new ItemStack[] { this.mInventory[1], tInput });
+ GT_Recipe tRecipe = GT_Recipe.GT_Recipe_Map.sOreWasherRecipes.findRecipe(getBaseMetaTileEntity(), this.mLastRecipe, false, gregtech.api.enums.GT_Values.V[tTier], tFluidInputs.isEmpty() ? null : new FluidStack[]{tFluidInputs.get(0)}, new ItemStack[]{tInput});
+
+ if ((tRecipe == null && !mRunningOnLoad)) {
+ this.mLastRecipe = null;
+ return false;
+ }
+
if (tRecipe != null) {
- if (tRecipe.isRecipeInputEqual(true,
- new FluidStack[] { (tFluidInputs.isEmpty()) ? null : (FluidStack) tFluidInputs.get(0) },
- new ItemStack[] { tInput, this.mInventory[1] })) {
- this.mEfficiency = (10000 - ((getIdealStatus() - getRepairStatus()) * 1000));
+ FluidStack[] mFluidInputList = new FluidStack[tFluidInputs.size()];
+ int tri = 0;
+ for (FluidStack f : tFluidInputs){
+ mFluidInputList[tri] = f;
+ tri++;
+ }
+ if (tRecipe.isRecipeInputEqual(true, mFluidInputList, tInput)) {
+ this.mEfficiency = (10000 - (getIdealStatus() - getRepairStatus()) * 1000);
this.mEfficiencyIncrease = 10000;
-
this.mEUt = tRecipe.mEUt;
+
if (tRecipe.mEUt <= 16) {
this.mEUt = (tRecipe.mEUt * (1 << tTier - 1) * (1 << tTier - 1));
this.mMaxProgresstime = (tRecipe.mDuration / (1 << tTier - 1));
@@ -201,22 +125,22 @@ extends GregtechMeta_MultiBlockBase {
if (this.mEUt > 0) {
this.mEUt = (-this.mEUt);
}
- this.mMaxProgresstime = (this.mMaxProgresstime * 2 / (1 + 5));
this.mMaxProgresstime = Math.max(1, this.mMaxProgresstime);
- if (tRecipe.mOutputs.length > 0){
- //this.mOutputItems = new ItemStack[] { tRecipe.getOutput(0) };
- ItemStack mNewOutputs[] = new ItemStack[tRecipe.mOutputs.length];
- for (int f=0;f<tRecipe.mOutputs.length;f++){
- Utils.LOG_INFO("Step 5 - Adding Output");
- mNewOutputs[f] = tRecipe.mOutputs[f].copy();
- }
- this.mOutputItems = mNewOutputs;
- updateSlots();
+
+ if (mRunningOnLoad || tRecipe.isRecipeInputEqual(true, mFluidInputList, new ItemStack[]{tInput})) {
+ Utils.LOG_INFO("Recipe Complete.");
+ this.mLastRecipe = tRecipe;
+ this.mEUt = MathUtils.findPercentageOfInt(this.mLastRecipe.mEUt, 80);
+ this.mMaxProgresstime = MathUtils.findPercentageOfInt(this.mLastRecipe.mDuration, 20);
+ this.mEfficiencyIncrease = 10000;
+ this.addOutput(tRecipe.getOutput(0));
+ this.addOutput(tRecipe.getOutput(0));
+ this.addOutput(tRecipe.getOutput(1));
+ this.addOutput(tRecipe.getOutput(1));
+ mRunningOnLoad = false;
+ return true;
}
- if (tRecipe.mFluidOutputs.length > 0)
- this.mOutputFluids = new FluidStack[] { tRecipe.getFluidOutput(0) };
- updateSlots();
- return true;
+
}
}
}
@@ -301,23 +225,6 @@ extends GregtechMeta_MultiBlockBase {
}
}
}
-
- if ((this.mInputBusses.size() < 1) || (this.mOutputBusses.size() < 1)
- || (this.mInputHatches.size() < 1) || (this.mOutputHatches.size() < 1)
- || (this.mMaintenanceHatches.size() != 1) || (this.mEnergyHatches.size() < 1)
- || (this.mMufflerHatches.size() < 1)) {
- Utils.LOG_MACHINE_INFO("Returned False");
- Utils.LOG_MACHINE_INFO("Input Buses: "+this.mInputBusses.size()+" | expected: >= 1 | "+(this.mInputBusses.size() >= 1));
- Utils.LOG_MACHINE_INFO("Output Buses: "+this.mOutputBusses.size()+" | expected: >= 1 | "+(this.mOutputBusses.size() >= 1));
- Utils.LOG_MACHINE_INFO("Input Hatches: "+this.mInputHatches.size()+" | expected: >= 1 | "+(this.mInputHatches.size() >= 1));
- Utils.LOG_MACHINE_INFO("Output Hatches: "+this.mOutputHatches.size()+" | expected: >= 1 | "+(this.mOutputHatches.size() >= 1));
- Utils.LOG_MACHINE_INFO("Energy Hatches: "+this.mEnergyHatches.size()+" | expected: >= 1 | "+(this.mEnergyHatches.size() >= 1));
- Utils.LOG_MACHINE_INFO("Muffler Hatches: "+this.mMufflerHatches.size()+" | expected: >= 1 | "+(this.mMufflerHatches.size() >= 1));
- Utils.LOG_MACHINE_INFO("Maint. Hatches: "+this.mMaintenanceHatches.size()+" | expected: 1 | "+(this.mMaintenanceHatches.size() != 1));
- return false;
- }
-
-
if ((tAmount >= 8)){
Utils.LOG_WARNING("Made structure.");
}
@@ -422,7 +329,7 @@ extends GregtechMeta_MultiBlockBase {
for (FluidStack stored : this.getStoredFluids()){
if (stored.isFluidEqual(FluidUtils.getFluidStack("water", 1))){
if (stored.amount >= 1000){
- //Utils.LOG_WARNING("Going to try swap an air block for water from inut bus.");
+ //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){
@@ -442,12 +349,12 @@ extends GregtechMeta_MultiBlockBase {
}
if (tBlock == Blocks.water){
++tAmount;
- //Utils.LOG_WARNING("Found Water");
+ //Utils.LOG_INFO("Found Water");
}
else if (tBlock == BlocksItems.getFluidBlock(InternalName.fluidDistilledWater)){
++tAmount;
++tAmount;
- //Utils.LOG_WARNING("Found Distilled Water");
+ //Utils.LOG_INFO("Found Distilled Water");
}
}
else {
@@ -462,115 +369,13 @@ extends GregtechMeta_MultiBlockBase {
}
}
}
- if ((tAmount >= 45)){
+ if ((tAmount == 45)){
Utils.LOG_WARNING("Filled structure.");
}
else {
Utils.LOG_WARNING("Did not fill structure.");
}
- this.mFilledCount = tAmount;
- return (tAmount >= 45);
- }
-
- public boolean removeWater() {
-
- //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.flowing_water || tBlock == Blocks.water || tBlock == BlocksItems.getFluidBlock(InternalName.fluidDistilledWater)){
- if (MathUtils.randInt(1, 20000) == 1){
- aBaseMetaTileEntity.getWorld().setBlock(aBaseMetaTileEntity.getXCoord()+xDir + i, aBaseMetaTileEntity.getYCoord()+h, aBaseMetaTileEntity.getZCoord()+zDir + j, Blocks.air);
-
- if (this.mOutputHatches.size() > 0){
- this.addOutput(FluidUtils.getFluidStack("fluid.sludge", 200));
- }
-
- }
- if (tBlock == Blocks.water || tBlock == Blocks.flowing_water){
- ++tAmount;
- }
- else if (tBlock == BlocksItems.getFluidBlock(InternalName.fluidDistilledWater)){
- ++tAmount;
- ++tAmount;
- }
- }
- }
- }
- }
- }
- }
- }
- }
- if ((tAmount < this.mFilledCount)){
- Utils.LOG_WARNING("Drained structure.");
- }
- else {
- Utils.LOG_WARNING("Did not drain structure.");
- }
- this.mFilledCount = tAmount;
- return (tAmount < this.mFilledCount);
- }
-
- @Override
- public void onPostTick(IGregTechTileEntity aBaseMetaTileEntity, long aTick) {
- if (aBaseMetaTileEntity.isActive()){
- removeWater();
- }
- super.onPostTick(aBaseMetaTileEntity, aTick);
- }
-
- @Override
- public void saveNBTData(NBTTagCompound aNBT) {
- aNBT.setInteger("mFilledCount", this.mFilledCount);
- super.saveNBTData(aNBT);
- }
-
- @Override
- public void loadNBTData(NBTTagCompound aNBT) {
- this.mFilledCount = aNBT.getInteger("mFilledCount");
- super.loadNBTData(aNBT);
+ return (tAmount == 45);
}
} \ No newline at end of file
diff --git a/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/GregtechMetaTileEntity_IndustrialWireMill.java b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/GregtechMetaTileEntity_IndustrialWireMill.java
index e4ab6a89e4..50dbed4fb9 100644
--- a/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/GregtechMetaTileEntity_IndustrialWireMill.java
+++ b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/GregtechMetaTileEntity_IndustrialWireMill.java
@@ -48,7 +48,6 @@ extends GregtechMeta_MultiBlockBase {
"1x Energy Hatch (top or bottom centered)",
"1x Maintenance Hatch (back centered)",
"Wire Factory Casings for the rest (32 at least!)",
- "Causes " + (20 * getPollutionPerTick(null)) + " Pollution per second",
CORE.GT_Tooltip
};
}
@@ -208,8 +207,9 @@ extends GregtechMeta_MultiBlockBase {
return 10000;
}
+ @Override
public int getPollutionPerTick(final ItemStack aStack) {
- return 15;
+ return 0;
}
@Override
diff --git a/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/GregtechMetaTileEntity_MassFabricator.java b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/GregtechMetaTileEntity_MassFabricator.java
index 612f820766..5fc5b9c3fb 100644
--- a/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/GregtechMetaTileEntity_MassFabricator.java
+++ b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/GregtechMetaTileEntity_MassFabricator.java
@@ -77,7 +77,6 @@ public class GregtechMetaTileEntity_MassFabricator extends GregtechMeta_MultiBlo
"1x Energy Hatch (Any bottom layer casing)",
"24x IC2 Reinforced Glass for the walls",
"Matter Fabricator Casings for the edges & top (40 at least!)",
- "Causes " + (20 * getPollutionPerTick(null)) + " Pollution per second",
CORE.GT_Tooltip};
}
@@ -387,8 +386,9 @@ public class GregtechMetaTileEntity_MassFabricator extends GregtechMeta_MultiBlo
return 10000;
}
+ @Override
public int getPollutionPerTick(final ItemStack aStack) {
- return 20;
+ return 0;
}
@Override
diff --git a/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/GregtechMetaTileEntity_MultiTank.java b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/GregtechMetaTileEntity_MultiTank.java
index 17ab4795df..b908e5439c 100644
--- a/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/GregtechMetaTileEntity_MultiTank.java
+++ b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/GregtechMetaTileEntity_MultiTank.java
@@ -211,7 +211,6 @@ extends GregtechMeta_MultiBlockBase {
"1x Energy Hatch (anywhere)",
"1x Maintenance Hatch (anywhere)",
"Multitank Exterior Casings for the rest (16 at least!)",
- "Causes " + (20 * getPollutionPerTick(null)) + " Pollution per second",
CORE.GT_Tooltip
};
}
diff --git a/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/GregtechMetaTileEntity_PowerSubStationController.java b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/GregtechMetaTileEntity_PowerSubStationController.java
index 9fc0870fb8..a163215459 100644
--- a/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/GregtechMetaTileEntity_PowerSubStationController.java
+++ b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/GregtechMetaTileEntity_PowerSubStationController.java
@@ -1,5 +1,7 @@
package gtPlusPlus.xmod.gregtech.common.tileentities.machines.multi;
+import java.util.concurrent.TimeUnit;
+
import gregtech.api.GregTech_API;
import gregtech.api.enums.TAE;
import gregtech.api.enums.Textures;
@@ -8,7 +10,6 @@ import gregtech.api.interfaces.metatileentity.IMetaTileEntity;
import gregtech.api.interfaces.tileentity.IGregTechTileEntity;
import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch_Dynamo;
import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch_Energy;
-import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_MultiBlockBase;
import gregtech.api.objects.GT_RenderedTexture;
import gregtech.api.util.GT_Config;
import gtPlusPlus.core.block.ModBlocks;
@@ -16,16 +17,23 @@ import gtPlusPlus.core.lib.CORE;
import gtPlusPlus.core.util.Utils;
import gtPlusPlus.core.util.math.MathUtils;
import gtPlusPlus.xmod.gregtech.api.gui.GUI_MultiMachine;
+import gtPlusPlus.xmod.gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch_InputBattery;
+import gtPlusPlus.xmod.gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch_OutputBattery;
+import gtPlusPlus.xmod.gregtech.api.metatileentity.implementations.base.GregtechMeta_MultiBlockBase;
import net.minecraft.block.Block;
import net.minecraft.entity.player.InventoryPlayer;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraftforge.common.util.ForgeDirection;
-public class GregtechMetaTileEntity_PowerSubStationController extends GT_MetaTileEntity_MultiBlockBase {
+public class GregtechMetaTileEntity_PowerSubStationController extends GregtechMeta_MultiBlockBase {
private static boolean controller;
protected int mAverageEuUsage = 0;
+ protected long mTotalEnergyAdded = 0;
+ protected long mTotalEnergyConsumed = 0;
+ protected long mTotalEnergyLost = 0;
+ protected long mTotalRunTime = 0;
public GregtechMetaTileEntity_PowerSubStationController(final int aID, final String aName, final String aNameRegional) {
super(aID, aName, aNameRegional);
@@ -52,11 +60,10 @@ public class GregtechMetaTileEntity_PowerSubStationController extends GT_MetaTil
"Hatches can be placed nearly anywhere",
"Minimum 1x Energy Input Hatch",
"Minimum 1x Energy Dynamo Hatch",
- "1x Input Bus",
- "1x Output Bus",
+ "1x Charge Bus",
+ "1x Discharge Bus",
"1x Maintenance hatch",
"--------------------------------------------------------------------------",
- "Causes " + (20 * getPollutionPerTick(null)) + " Pollution per second",
CORE.GT_Tooltip};
}
@@ -239,12 +246,12 @@ public class GregtechMetaTileEntity_PowerSubStationController extends GT_MetaTil
}
}
}
- if ((this.mInputBusses.size() != 1) || (this.mOutputBusses.size() != 1)
+ if ((this.mChargeHatches.size() < 1) || (this.mDischargeHatches.size() < 1)
|| (this.mMaintenanceHatches.size() != 1) || (this.mEnergyHatches.size() < 1)
|| (this.mDynamoHatches.size() < 1)) {
Utils.LOG_MACHINE_INFO("Returned False 3");
- Utils.LOG_MACHINE_INFO("Input Buses: "+this.mInputBusses.size()+" | expected: 1 | "+(this.mInputBusses.size() != 1));
- Utils.LOG_MACHINE_INFO("Output Buses: "+this.mOutputBusses.size()+" | expected: 1 | "+(this.mOutputBusses.size() != 1));
+ Utils.LOG_MACHINE_INFO("Charge Buses: "+this.mChargeHatches.size()+" | expected: 1 | "+(this.mChargeHatches.size() != 1));
+ Utils.LOG_MACHINE_INFO("Discharge Buses: "+this.mDischargeHatches.size()+" | expected: 1 | "+(this.mDischargeHatches.size() != 1));
Utils.LOG_MACHINE_INFO("Energy Hatches: "+this.mEnergyHatches.size()+" | expected: >= 1 | "+(this.mEnergyHatches.size() < 1));
Utils.LOG_MACHINE_INFO("Dynamo Hatches: "+this.mDynamoHatches.size()+" | expected: >= 1 | "+(this.mDynamoHatches.size() < 1));
Utils.LOG_MACHINE_INFO("Maint. Hatches: "+this.mMaintenanceHatches.size()+" | expected: 1 | "+(this.mMaintenanceHatches.size() != 1));
@@ -318,13 +325,19 @@ public class GregtechMetaTileEntity_PowerSubStationController extends GT_MetaTil
long mActualStoredEU = 0;
-
+ //mTotalEnergyAdded
@Override
public void saveNBTData(NBTTagCompound aNBT) {
aNBT.setLong("mPowerStorageBuffer", this.mPowerStorageBuffer);
aNBT.setInteger("mPowerStorageMultiplier", this.mPowerStorageMultiplier);
aNBT.setLong("mActualStoredEU", this.mActualStoredEU);
aNBT.setInteger("mAverageEuUsage", this.mAverageEuUsage);
+
+ //Usage Stats
+ aNBT.setLong("mTotalEnergyAdded", this.mTotalEnergyAdded);
+ aNBT.setLong("mTotalEnergyLost", this.mTotalEnergyLost);
+ aNBT.setLong("mTotalEnergyConsumed", this.mTotalEnergyConsumed);
+ aNBT.setLong("mTotalRunTime", this.mTotalRunTime);
super.saveNBTData(aNBT);
}
@@ -334,6 +347,13 @@ public class GregtechMetaTileEntity_PowerSubStationController extends GT_MetaTil
this.mPowerStorageMultiplier = aNBT.getInteger("mPowerStorageMultiplier");
this.mActualStoredEU = aNBT.getLong("mActualStoredEU");
this.mAverageEuUsage = aNBT.getInteger("mAverageEuUsage");
+
+ //Usage Stats
+ this.mTotalEnergyAdded = aNBT.getLong("mTotalEnergyAdded");
+ this.mTotalEnergyLost = aNBT.getLong("mTotalEnergyLost");
+ this.mTotalEnergyConsumed = aNBT.getLong("mTotalEnergyConsumed");
+ this.mTotalRunTime = aNBT.getLong("mTotalRunTime");
+
super.loadNBTData(aNBT);
}
@@ -345,14 +365,27 @@ public class GregtechMetaTileEntity_PowerSubStationController extends GT_MetaTil
@Override
public void onPostTick(IGregTechTileEntity aBaseMetaTileEntity, long aTick) {
this.mActualStoredEU = this.getEUVar();
+
+ if (this.mActualStoredEU < 0){
+ this.mActualStoredEU = 0;
+ }
+ if (this.getEUVar() < 0){
+ this.setEUVar(0);
+ }
+ if (aBaseMetaTileEntity.isServerSide()){
+ this.mTotalRunTime++;
+ }
//Handle Progress Time
if (this.mActualStoredEU >= 0 && this.getBaseMetaTileEntity().isAllowedToWork()){
this.mProgresstime = 20;
this.mMaxProgresstime = 40;
//Use 10% of average EU determined by adding in/output voltage of all hatches and averaging.
- this.getBaseMetaTileEntity().decreaseStoredEnergyUnits(MathUtils.roundToClosestInt(mAverageEuUsage/100), false);
+ int mDecrease = MathUtils.roundToClosestInt(mAverageEuUsage);
+ this.mTotalEnergyLost+=mDecrease;
+ this.setEUVar(this.getEUVar()-mDecrease);
+ //this.getBaseMetaTileEntity().decreaseStoredEnergyUnits(mDecrease, false);
}
else {
this.mProgresstime = 0;
@@ -367,11 +400,23 @@ public class GregtechMetaTileEntity_PowerSubStationController extends GT_MetaTil
if (this.getBaseMetaTileEntity().isAllowedToWork()){
this.getBaseMetaTileEntity().enableWorking();
}
+ for (GT_MetaTileEntity_Hatch_OutputBattery energy : this.mDischargeHatches){
+ long stored = energy.getEUVar();
+ long voltage = energy.maxEUInput();
+ if (stored > 0){
+ energy.setEUVar((stored-voltage));
+ this.mTotalEnergyAdded+=voltage;
+ if (this.getBaseMetaTileEntity().increaseStoredEnergyUnits(voltage, false)){
+ //Utils.LOG_INFO("Draining Discharge Hatch #1");
+ }
+ }
+ }
for (GT_MetaTileEntity_Hatch_Energy energy : this.mEnergyHatches){
long stored = energy.getEUVar();
long voltage = energy.maxEUInput();
if (stored > 0){
energy.setEUVar((stored-voltage));
+ this.mTotalEnergyAdded+=voltage;
this.getBaseMetaTileEntity().increaseStoredEnergyUnits(voltage, false);
}
}
@@ -406,14 +451,28 @@ public class GregtechMetaTileEntity_PowerSubStationController extends GT_MetaTil
public boolean drainEnergyInput(long aEU) {
if (aEU <= 0L)
return true;
+ long nStoredPower = this.getEUVar();
+ for (GT_MetaTileEntity_Hatch_OutputBattery tHatch : this.mDischargeHatches) {
+ if ((isValidMetaTileEntity(tHatch)) && (tHatch.getBaseMetaTileEntity().decreaseStoredEnergyUnits(aEU, false))){
+ if (this.mActualStoredEU<this.maxEUStore()){
+
+ }
+ Utils.LOG_INFO("Draining Discharge Hatch #2");
+ }
+ }
for (GT_MetaTileEntity_Hatch_Energy tHatch : this.mEnergyHatches) {
if ((isValidMetaTileEntity(tHatch)) && (tHatch.getBaseMetaTileEntity().decreaseStoredEnergyUnits(aEU, false))){
if (this.mActualStoredEU<this.maxEUStore()){
//this.getBaseMetaTileEntity().increaseStoredEnergyUnits(aEU, false);
}
- return true;
}
+ }
+ long nNewStoredPower = this.getEUVar();
+ if (nNewStoredPower < nStoredPower){
+ Utils.LOG_ERROR("Used "+(nStoredPower-nNewStoredPower)+"eu.");
+ return true;
}
+
return false;
}
@@ -423,9 +482,22 @@ public class GregtechMetaTileEntity_PowerSubStationController extends GT_MetaTil
return true;
long nStoredPower = this.getEUVar();
int hatchCount = 0;
+ //Utils.LOG_INFO("Charge Hatches: "+this.mChargeHatches.size());
+ for (GT_MetaTileEntity_Hatch_InputBattery tHatch : this.mChargeHatches) {
+ //Utils.LOG_INFO("Storing Power in a Charge Hatch");
+ if ((isValidMetaTileEntity(tHatch)) && (tHatch.getBaseMetaTileEntity().increaseStoredEnergyUnits(tHatch.maxEUInput(), false))) {
+ this.setEUVar(this.getEUVar()-(tHatch.maxEUInput()));
+ this.mTotalEnergyConsumed+=(tHatch.maxEUInput());
+ //this.getBaseMetaTileEntity().decreaseStoredEnergyUnits(tHatch.getOutputTier()*2, false);
+ //Utils.LOG_INFO("Hatch "+hatchCount+" has "+tHatch.getEUVar()+"eu stored. Avg used is "+(this.mAverageEuUsage));
+ }
+ hatchCount++;
+ }
for (GT_MetaTileEntity_Hatch_Dynamo tHatch : this.mDynamoHatches) {
+ //Utils.LOG_INFO("Storing Power in a Dynamo Hatch");
if ((isValidMetaTileEntity(tHatch)) && (tHatch.getBaseMetaTileEntity().increaseStoredEnergyUnits(tHatch.getOutputTier()*2, false))) {
this.setEUVar(this.getEUVar()-(tHatch.getOutputTier()*2));
+ this.mTotalEnergyConsumed+=(tHatch.getOutputTier()*2);
//this.getBaseMetaTileEntity().decreaseStoredEnergyUnits(tHatch.getOutputTier()*2, false);
//Utils.LOG_INFO("Hatch "+hatchCount+" has "+tHatch.getEUVar()+"eu stored. Avg used is "+(this.mAverageEuUsage));
}
@@ -449,4 +521,42 @@ public class GregtechMetaTileEntity_PowerSubStationController extends GT_MetaTil
return 0;
}
+ //mAverageEuUsage
+
+ @Override
+ public String[] getInfoData() {
+
+ long seconds = (this.mTotalRunTime/20);
+
+ int weeks = (int) (TimeUnit.SECONDS.toDays(seconds) / 7);
+ int days = (int) (TimeUnit.SECONDS.toDays(seconds) - 7 * weeks);
+ long hours = TimeUnit.SECONDS.toHours(seconds) - TimeUnit.DAYS.toHours(days) - TimeUnit.DAYS.toHours(7*weeks);
+ long minutes = TimeUnit.SECONDS.toMinutes(seconds) - (TimeUnit.SECONDS.toHours(seconds) * 60);
+ long second = TimeUnit.SECONDS.toSeconds(seconds) - (TimeUnit.SECONDS.toMinutes(seconds) *60);
+
+
+
+ return new String[]{
+ "Ergon Energy - District Sub-Station",
+ "EU Required: "+this.mAverageEuUsage+"EU/t",
+ "Stats for Nerds",
+ "Total Input: "+this.mTotalEnergyAdded+"EU",
+ "Total Output: "+this.mTotalEnergyConsumed+"EU",
+ "Total Wasted: "+this.mTotalEnergyLost+"EU",
+
+ "Total Time Since Build: ",
+ ""+weeks+" Weeks.",
+ ""+days+" Days.",
+ ""+hours+" Hours.",
+ ""+minutes+" Minutes.",
+ ""+second+" Seconds.",
+ "Total Time in ticks: "+this.mTotalRunTime};
+
+ };
+
+ @Override
+ public boolean isGivingInformation() {
+ return true;
+ }
+
} \ No newline at end of file
diff --git a/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/GregtechMetaTileEntity_Refinery.java b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/GregtechMetaTileEntity_Refinery.java
index 7d1fcee1e4..1c5930537e 100644
--- a/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/GregtechMetaTileEntity_Refinery.java
+++ b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/GregtechMetaTileEntity_Refinery.java
@@ -45,7 +45,6 @@ public class GregtechMetaTileEntity_Refinery extends GT_MetaTileEntity_MultiBloc
"1x Maintenance Hatch (One of base platform)",
"1x ZPM or better Muffler (One of base platform)",
"1x Energy Hatch (One of base platform)",
- "Causes " + (20 * getPollutionPerTick(null)) + " Pollution per second",
CORE.GT_Tooltip
};
}