aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlkalus <3060479+draknyte1@users.noreply.github.com>2021-12-14 13:21:43 +0000
committerAlkalus <3060479+draknyte1@users.noreply.github.com>2021-12-14 13:21:43 +0000
commit5d8163cffad0e1e65bcd93779aec38572c90ae78 (patch)
tree5bb542c7fcbad9abee5b7e779471e1d0929d9908
parent868ddab78797403d58dbc84d357f792926e94f42 (diff)
downloadGT5-Unofficial-5d8163cffad0e1e65bcd93779aec38572c90ae78.tar.gz
GT5-Unofficial-5d8163cffad0e1e65bcd93779aec38572c90ae78.tar.bz2
GT5-Unofficial-5d8163cffad0e1e65bcd93779aec38572c90ae78.zip
Fix Steam Grinder not forming.
Fix scrubbers using incorrect slots for turbines and filters. Cleaned up PollutionUtils.
-rw-r--r--src/Java/gtPlusPlus/core/util/minecraft/gregtech/PollutionUtils.java174
-rw-r--r--src/Java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/base/GregtechMeta_MultiBlockBase.java44
-rw-r--r--src/Java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/base/GregtechMeta_SteamMultiBase.java10
-rw-r--r--src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/basic/GregtechMetaAtmosphericReconditioner.java114
-rw-r--r--src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/basic/GregtechMetaPollutionCreator.java14
-rw-r--r--src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/basic/GregtechMetaPollutionDetector.java14
6 files changed, 152 insertions, 218 deletions
diff --git a/src/Java/gtPlusPlus/core/util/minecraft/gregtech/PollutionUtils.java b/src/Java/gtPlusPlus/core/util/minecraft/gregtech/PollutionUtils.java
index 2ae2a9f1de..242a63c712 100644
--- a/src/Java/gtPlusPlus/core/util/minecraft/gregtech/PollutionUtils.java
+++ b/src/Java/gtPlusPlus/core/util/minecraft/gregtech/PollutionUtils.java
@@ -2,17 +2,13 @@ package gtPlusPlus.core.util.minecraft.gregtech;
import static gtPlusPlus.core.lib.CORE.MAIN_GREGTECH_5U_EXPERIMENTAL_FORK;
-import java.lang.reflect.Field;
-import java.lang.reflect.InvocationTargetException;
-import java.lang.reflect.Method;
-
import org.apache.commons.lang3.ArrayUtils;
import gregtech.GT_Mod;
import gregtech.api.enums.OrePrefixes;
import gregtech.api.interfaces.tileentity.IGregTechTileEntity;
import gregtech.api.interfaces.tileentity.IHasWorldObjectAndCoords;
-import gregtech.common.GT_Proxy;
+import gregtech.common.GT_Pollution;
import gtPlusPlus.api.objects.Logger;
import gtPlusPlus.api.objects.data.AutoMap;
import gtPlusPlus.core.item.base.cell.BaseItemCell;
@@ -21,7 +17,6 @@ import gtPlusPlus.core.material.MISC_MATERIALS;
import gtPlusPlus.core.material.MaterialGenerator;
import gtPlusPlus.core.util.minecraft.FluidUtils;
import gtPlusPlus.core.util.minecraft.ItemUtils;
-import gtPlusPlus.core.util.reflect.ReflectionUtils;
import net.minecraft.item.ItemStack;
import net.minecraft.world.chunk.Chunk;
import net.minecraftforge.fluids.FluidStack;
@@ -30,12 +25,6 @@ public class PollutionUtils {
private static boolean mIsPollutionEnabled = true;
- private static Method mAddPollution;
- private static Method mAddPollution2;
-
- private static Method mGetPollution;
- private static Method mGetPollution2;
-
public static AutoMap<FluidStack> mPollutionFluidStacks = new AutoMap<FluidStack>();
static {
@@ -45,85 +34,37 @@ public class PollutionUtils {
mIsPollutionEnabled = false;
}
}
-
+
public static boolean isPollutionEnabled() {
return mIsPollutionEnabled;
}
- public static boolean mPollution() {
- try {
- GT_Proxy GT_Pollution = GT_Mod.gregtechproxy;
- if (GT_Pollution != null) {
- Field mPollution = ReflectionUtils.getField(GT_Pollution.getClass(), "mPollution");
- if (mPollution != null) {
- return mPollution.getBoolean(GT_Pollution);
- }
- }
- } catch (SecurityException | IllegalArgumentException | IllegalAccessException e) {
- }
- return false;
+ private static boolean mPollution() {
+ return GT_Mod.gregtechproxy.mPollution;
}
public static boolean addPollution(IGregTechTileEntity te, int pollutionValue) {
- if (mIsPollutionEnabled)
- try {
- if (te == null) {
- return false;
- }
- if (mAddPollution != null) {
- mAddPollution.invoke(null, te, pollutionValue);
- }
- Class<?> GT_Pollution = ReflectionUtils.getClass("gregtech.common.GT_Pollution");
- if (GT_Pollution != null) {
- Method addPollution = ReflectionUtils.getMethod(GT_Pollution, "addPollution", IGregTechTileEntity.class, int.class);
- if (addPollution != null) {
- mAddPollution = addPollution;
- addPollution.invoke(null, te, pollutionValue);
- return true;
- }
- }
- } catch (SecurityException | IllegalAccessException
- | IllegalArgumentException | InvocationTargetException e) {
- }
+ if (mIsPollutionEnabled) {
+ GT_Pollution.addPollution(te, pollutionValue);
+ return true;
+ }
return false;
}
public static boolean addPollution(IHasWorldObjectAndCoords aTileOfSomeSort, int pollutionValue) {
- if (mIsPollutionEnabled)
- try {
- if (aTileOfSomeSort == null) {
- return false;
- }
- IHasWorldObjectAndCoords j = (IHasWorldObjectAndCoords) aTileOfSomeSort;
- Chunk c = j.getWorld().getChunkFromBlockCoords(j.getXCoord(), j.getZCoord());
- return addPollution(c, pollutionValue);
- } catch (SecurityException | IllegalArgumentException e) {
- }
+ if (mIsPollutionEnabled) {
+ IHasWorldObjectAndCoords j = (IHasWorldObjectAndCoords) aTileOfSomeSort;
+ Chunk c = j.getWorld().getChunkFromBlockCoords(j.getXCoord(), j.getZCoord());
+ return addPollution(c, pollutionValue);
+ }
return false;
}
public static boolean addPollution(Chunk aChunk, int pollutionValue) {
- if (mIsPollutionEnabled)
- try {
- if (aChunk == null) {
- return false;
- }
- if (mAddPollution2 != null) {
- mAddPollution2.invoke(null, aChunk, pollutionValue);
- return true;
- }
- Class<?> GT_Pollution = ReflectionUtils.getClass("gregtech.common.GT_Pollution");
- if (GT_Pollution != null) {
- Method addPollution = ReflectionUtils.getMethod(GT_Pollution, "addPollution", Chunk.class, int.class);
- if (addPollution != null) {
- mAddPollution2 = addPollution;
- mAddPollution2.invoke(null, aChunk, pollutionValue);
- return true;
- }
- }
- } catch (SecurityException | IllegalAccessException
- | IllegalArgumentException | InvocationTargetException e) {
- }
+ if (mIsPollutionEnabled) {
+ GT_Pollution.addPollution(aChunk, pollutionValue);
+ return true;
+ }
return false;
}
@@ -155,85 +96,30 @@ public class PollutionUtils {
return nullifyPollution(c);
}
- public static boolean nullifyPollution(Chunk aChunk) {
- try {
+ public static boolean nullifyPollution(Chunk aChunk) {
+ if (mIsPollutionEnabled) {
if (aChunk == null) {
return false;
}
- long getCurrentPollution = getPollution(aChunk);
+ int getCurrentPollution = getPollution(aChunk);
if (getCurrentPollution <= 0) {
return false;
}
else {
- if (mAddPollution2 != null) {
- mAddPollution2.invoke(null, aChunk, -getCurrentPollution);
- return true;
- }
- else {
- Class<?> GT_Pollution = ReflectionUtils.getClass("gregtech.common.GT_Pollution");
- if (GT_Pollution != null) {
- Method addPollution = ReflectionUtils.getMethod(GT_Pollution, "addPollution", Chunk.class, int.class);
- if (addPollution != null) {
- mAddPollution2 = addPollution;
- mAddPollution2.invoke(null, aChunk, 0);
- return true;
- }
- }
- }
+ return removePollution(aChunk, getCurrentPollution);
}
-
- } catch (SecurityException | IllegalAccessException
- | IllegalArgumentException | InvocationTargetException e) {
- }
+ }
return false;
}
public static int getPollution(IGregTechTileEntity te) {
- if (MAIN_GREGTECH_5U_EXPERIMENTAL_FORK)
- try {
- if (te == null) {
- return 0;
- }
- if (mGetPollution != null) {
- mGetPollution.invoke(null, te);
- }
- Class<?> GT_Pollution = ReflectionUtils.getClass("gregtech.common.GT_Pollution");
- if (GT_Pollution != null) {
- Method addPollution = ReflectionUtils.getMethod(GT_Pollution, "getPollution", IGregTechTileEntity.class);
- if (addPollution != null) {
- mGetPollution = addPollution;
- return (int) addPollution.invoke(null, te);
- }
- }
- } catch (SecurityException | IllegalAccessException
- | IllegalArgumentException | InvocationTargetException e) {
- }
- return 0;
+ return GT_Pollution.getPollution(te);
}
public static int getPollution(Chunk te) {
- if (MAIN_GREGTECH_5U_EXPERIMENTAL_FORK)
- try {
- if (te == null) {
- return 0;
- }
- if (mGetPollution2 != null) {
- mGetPollution2.invoke(null, te);
- }
- Class<?> GT_Pollution = ReflectionUtils.getClass("gregtech.common.GT_Pollution");
- if (GT_Pollution != null) {
- Method addPollution = ReflectionUtils.getMethod(GT_Pollution, "getPollution", Chunk.class);
- if (addPollution != null) {
- mGetPollution2 = addPollution;
- return (int) addPollution.invoke(null, te);
- }
- }
- } catch (SecurityException | IllegalAccessException
- | IllegalArgumentException | InvocationTargetException e) {
- }
- return 0;
+ return GT_Pollution.getPollution(te);
}
-
+
public static boolean setPollutionFluids() {
if (mPollutionFluidStacks.isEmpty()) {
FluidStack CD, CM, SD;
@@ -258,7 +144,7 @@ public class PollutionUtils {
else {
MaterialGenerator.generate(MISC_MATERIALS.CARBON_DIOXIDE, false, false);
}
-
+
if (CM != null) {
Logger.INFO("[PollutionCompat] Found carbon monoxide fluid, registering it.");
PollutionUtils.mPollutionFluidStacks.put(CM);
@@ -276,7 +162,7 @@ public class PollutionUtils {
else {
MaterialGenerator.generate(MISC_MATERIALS.CARBON_MONOXIDE, false, false);
}
-
+
if (SD != null) {
Logger.INFO("[PollutionCompat] Found sulfur dioxide fluid, registering it.");
PollutionUtils.mPollutionFluidStacks.put(SD);
@@ -297,9 +183,9 @@ public class PollutionUtils {
return true;
}
}
-
-
-
+
+
+
}
}
diff --git a/src/Java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/base/GregtechMeta_MultiBlockBase.java b/src/Java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/base/GregtechMeta_MultiBlockBase.java
index d413ce44e4..356f96f7cc 100644
--- a/src/Java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/base/GregtechMeta_MultiBlockBase.java
+++ b/src/Java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/base/GregtechMeta_MultiBlockBase.java
@@ -39,6 +39,7 @@ import gtPlusPlus.xmod.gregtech.api.metatileentity.implementations.GT_MetaTileEn
import gtPlusPlus.xmod.gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch_ControlCore;
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.GT_MetaTileEntity_Hatch_Steam_BusInput;
import gtPlusPlus.xmod.gregtech.api.objects.MultiblockRequirements;
import net.minecraft.block.Block;
import net.minecraft.entity.player.EntityPlayer;
@@ -1681,12 +1682,17 @@ public abstract class GregtechMeta_MultiBlockBase<T extends GT_MetaTileEntity_En
// Try setRecipeMap
- if (aTileEntity instanceof GT_MetaTileEntity_Hatch_Input) {
- ((GT_MetaTileEntity_Hatch_Input) aTileEntity).mRecipeMap = getRecipeMap();
- }
- if (aTileEntity instanceof GT_MetaTileEntity_Hatch_InputBus) {
- ((GT_MetaTileEntity_Hatch_InputBus) aTileEntity).mRecipeMap = getRecipeMap();
- }
+ try {
+ if (aTileEntity instanceof GT_MetaTileEntity_Hatch_Input) {
+ resetRecipeMapForHatch((GT_MetaTileEntity_Hatch) aTileEntity, getRecipeMap());
+ }
+ if (aTileEntity instanceof GT_MetaTileEntity_Hatch_InputBus) {
+ resetRecipeMapForHatch((GT_MetaTileEntity_Hatch) aTileEntity, getRecipeMap());
+ }
+ }
+ catch (Throwable t) {
+ t.printStackTrace();
+ }
if (aList.isEmpty()) {
if (aTileEntity instanceof GT_MetaTileEntity_Hatch) {
@@ -1696,8 +1702,13 @@ public abstract class GregtechMeta_MultiBlockBase<T extends GT_MetaTileEntity_En
updateTexture(aTileEntity, aBaseCasingIndex);
return aList.add((E) aTileEntity);
}
- } else {
+ }
+ else {
IGregTechTileEntity aCur = aTileEntity.getBaseMetaTileEntity();
+ if (aList.contains(aTileEntity)) {
+ log("Found Duplicate "+aTileEntity.getInventoryName()+" @ " + new BlockPos(aCur).getLocationString());
+ return false;
+ }
BlockPos aCurPos = new BlockPos(aCur);
boolean aExists = false;
for (E m : aList) {
@@ -1946,7 +1957,7 @@ public abstract class GregtechMeta_MultiBlockBase<T extends GT_MetaTileEntity_En
if (aMetaTileEntity == null) {
return false;
}
- if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_Input || aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_InputBus) {
+ if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_Input || aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_InputBus || aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_Steam_BusInput) {
return resetRecipeMapForHatch((GT_MetaTileEntity_Hatch)aMetaTileEntity, aMap);
}
else {
@@ -1954,6 +1965,7 @@ public abstract class GregtechMeta_MultiBlockBase<T extends GT_MetaTileEntity_En
}
}
catch (Throwable t) {
+ t.printStackTrace();
return false;
}
}
@@ -1963,7 +1975,7 @@ public abstract class GregtechMeta_MultiBlockBase<T extends GT_MetaTileEntity_En
return false;
}
final IMetaTileEntity aMetaTileEntity = aTileEntity;
- if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_Input || aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_InputBus) {
+ if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_Input || aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_InputBus || aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_Steam_BusInput) {
if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_Input){
((GT_MetaTileEntity_Hatch_Input) aMetaTileEntity).mRecipeMap = null;
((GT_MetaTileEntity_Hatch_Input) aMetaTileEntity).mRecipeMap = aMap;
@@ -1974,7 +1986,7 @@ public abstract class GregtechMeta_MultiBlockBase<T extends GT_MetaTileEntity_En
log("Cleared Input Hatch.");
}
}
- else {
+ else if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_InputBus) {
((GT_MetaTileEntity_Hatch_InputBus) aMetaTileEntity).mRecipeMap = null;
((GT_MetaTileEntity_Hatch_InputBus) aMetaTileEntity).mRecipeMap = aMap;
if (aMap != null && aMap.mNEIName != null) {
@@ -1984,6 +1996,16 @@ public abstract class GregtechMeta_MultiBlockBase<T extends GT_MetaTileEntity_En
log("Cleared Input Bus.");
}
}
+ else {
+ ((GT_MetaTileEntity_Hatch_Steam_BusInput) aMetaTileEntity).mRecipeMap = null;
+ ((GT_MetaTileEntity_Hatch_Steam_BusInput) aMetaTileEntity).mRecipeMap = aMap;
+ if (aMap != null && aMap.mNEIName != null) {
+ log("Remapped Input Bus to "+aMap.mNEIName+".");
+ }
+ else {
+ log("Cleared Input Bus.");
+ }
+ }
return true;
}
else {
@@ -2032,7 +2054,7 @@ public abstract class GregtechMeta_MultiBlockBase<T extends GT_MetaTileEntity_En
if (GT_MetaTileEntity_Hatch.class.isInstance(aMetaTileEntity)){
mProper.setAccessible(true);
mProper.invoke(aMetaTileEntity, aCasingID);
- log("Good Method Call for updateTexture.");
+ //log("Good Method Call for updateTexture.");
return true;
}
}
diff --git a/src/Java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/base/GregtechMeta_SteamMultiBase.java b/src/Java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/base/GregtechMeta_SteamMultiBase.java
index 21b0efff99..7bc8e4733d 100644
--- a/src/Java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/base/GregtechMeta_SteamMultiBase.java
+++ b/src/Java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/base/GregtechMeta_SteamMultiBase.java
@@ -282,10 +282,12 @@ public abstract class GregtechMeta_SteamMultiBase extends GregtechMeta_MultiBloc
@Override
public boolean addToMachineList(final IGregTechTileEntity aTileEntity, final int aBaseCasingIndex) {
if (aTileEntity == null) {
+ log("Invalid IGregTechTileEntity");
return false;
}
final IMetaTileEntity aMetaTileEntity = aTileEntity.getMetaTileEntity();
if (aMetaTileEntity == null) {
+ log("Invalid IMetaTileEntity");
return false;
}
@@ -293,16 +295,20 @@ public abstract class GregtechMeta_SteamMultiBase extends GregtechMeta_MultiBloc
boolean aDidAdd = false;
if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_CustomFluidBase) {
+ log("Adding Steam Input Hatch");
aDidAdd = addToMachineListInternal(mSteamInputFluids, aMetaTileEntity, aBaseCasingIndex);
}
else if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_Steam_BusInput) {
- ((GT_MetaTileEntity_Hatch_InputBus) aTileEntity).mRecipeMap = getRecipeMap();
+ log("Trying to set recipe map. Type: "+(getRecipeMap() != null ? getRecipeMap().mNEIName : "Null"));
+ this.resetRecipeMapForHatch(aTileEntity, getRecipeMap());
+ log("Adding Steam Input Bus");
aDidAdd = addToMachineListInternal(mSteamInputs, aMetaTileEntity, aBaseCasingIndex);
}
else if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_Steam_BusOutput) {
+ log("Adding Steam Output Bus");
aDidAdd = addToMachineListInternal(mSteamOutputs, aMetaTileEntity, aBaseCasingIndex);
}
-
+
return aDidAdd;
}
diff --git a/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/basic/GregtechMetaAtmosphericReconditioner.java b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/basic/GregtechMetaAtmosphericReconditioner.java
index eb01823151..a4b4d902ed 100644
--- a/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/basic/GregtechMetaAtmosphericReconditioner.java
+++ b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/basic/GregtechMetaAtmosphericReconditioner.java
@@ -1,7 +1,6 @@
package gtPlusPlus.xmod.gregtech.common.tileentities.machines.basic;
import static gregtech.api.enums.GT_Values.V;
-import static gtPlusPlus.core.util.minecraft.gregtech.PollutionUtils.mPollution;
import org.apache.commons.lang3.ArrayUtils;
@@ -42,8 +41,8 @@ public class GregtechMetaAtmosphericReconditioner extends GT_MetaTileEntity_Basi
protected int mBaseEff = 2500;
protected int mOptimalAirFlow = 0;
protected boolean mHasPollution = false;
- protected int SLOT_ROTOR = 4;
- protected int SLOT_FILTER = 5;
+ protected int SLOT_ROTOR = 5;
+ protected int SLOT_FILTER = 6;
protected static boolean mPollutionEnabled = true;
protected boolean mSaveRotor = false;
@@ -60,12 +59,12 @@ public class GregtechMetaAtmosphericReconditioner extends GT_MetaTileEntity_Basi
new GT_RenderedTexture(Textures.BlockIcons.OVERLAY_BOTTOM_MASSFAB_ACTIVE),
new GT_RenderedTexture(Textures.BlockIcons.OVERLAY_BOTTOM_MASSFAB)
});
- mPollutionEnabled = PollutionUtils.mPollution();
+ mPollutionEnabled = PollutionUtils.isPollutionEnabled();
}
public GregtechMetaAtmosphericReconditioner(String aName, int aTier, String aDescription, ITexture[][][] aTextures, String aGUIName, String aNEIName) {
super(aName, aTier, 2, aDescription, aTextures, 2, 0, aGUIName, aNEIName);
- mPollutionEnabled = PollutionUtils.mPollution();
+ mPollutionEnabled = PollutionUtils.isPollutionEnabled();
}
/*public GregtechMetaAtmosphericReconditioner(String aName, int aTier, String[] aDescription, ITexture[][][] aTextures, String aGUIName, String aNEIName) {
@@ -148,12 +147,18 @@ public class GregtechMetaAtmosphericReconditioner extends GT_MetaTileEntity_Basi
//Get Current Pollution Amount.
int mCurrentPollution = getCurrentChunkPollution();
+ if (mCurrentPollution > 0) {
+ this.mHasPollution = true;
+ }
+ else {
+ this.mHasPollution = false;
+ }
boolean isIdle = true;
//Get Inventory Item
ItemStack stackRotor = this.mInventory[SLOT_ROTOR];
- ItemStack stackFilter = this.mInventory[SLOT_FILTER];
-
+ ItemStack stackFilter = this.mInventory[SLOT_FILTER];
+
//Power Drain
long drainEU = maxEUInput() * maxAmperesIn();
if (aBaseMetaTileEntity.isActive() && aBaseMetaTileEntity.getStoredEU() >= drainEU){
@@ -181,34 +186,52 @@ public class GregtechMetaAtmosphericReconditioner extends GT_MetaTileEntity_Basi
//Only try once/sec.
if (!isIdle && aTick % 20L == 0L){
+
+ for (int i=0;i<this.mInventory.length;i++) {
+ if (hasRotor(this.mInventory[i])) {
+ Logger.INFO("Found Rotor in slot "+i);
+ break;
+ }
+ }
+ for (int i=0;i<this.mInventory.length;i++) {
+ if (hasAirFilter(this.mInventory[i])) {
+ Logger.INFO("Found Filter in slot "+i);
+ break;
+ }
+ }
//Check if machine can work.
if ((aBaseMetaTileEntity.isAllowedToWork())){
+ Logger.INFO("Can work.");
//Enable machine animation/graphic
if (hasRotor(stackRotor) && hasAirFilter(stackFilter) && this.mHasPollution){
if (!this.getBaseMetaTileEntity().isActive()) {
+ Logger.INFO("Set Active.");
aBaseMetaTileEntity.setActive(true);
}
}
else if (!this.mHasPollution || mCurrentPollution <= 0 || stackRotor == null || stackFilter == null || !hasRotor(stackRotor) || !hasAirFilter(stackFilter)){
if (!this.getBaseMetaTileEntity().isActive()) {
+ Logger.INFO("Set Inactive.");
aBaseMetaTileEntity.setActive(false);
this.sendSound((byte) -122);
}
}
//If Active.
- if (aBaseMetaTileEntity.isActive()){
+ if (aBaseMetaTileEntity.isActive()){
+ Logger.INFO("Doing something.");
//Do nothing if there is no pollution.
if(this.mHasPollution && mCurrentPollution > 0){
+ Logger.INFO("Has Pollution? "+mHasPollution+", Current Pollution: "+mCurrentPollution);
//Only check every 30s.
if (!isIdle && aTick % (20L * 30) == 0L){
- mPollutionEnabled = PollutionUtils.mPollution();
+ mPollutionEnabled = PollutionUtils.isPollutionEnabled();
//Clear out pollution if it's disabled, because I am a nice gal.
- if (!mPollution()) {
+ if (!PollutionUtils.isPollutionEnabled()) {
PollutionUtils.nullifyPollution(this.getBaseMetaTileEntity());
}
}
@@ -218,7 +241,7 @@ public class GregtechMetaAtmosphericReconditioner extends GT_MetaTileEntity_Basi
//Use a Turbine
if(hasRotor(stackRotor) && hasAirFilter(stackFilter)){
- Logger.WARNING("Found Turbine.");
+ Logger.INFO("Found Turbine.");
mBaseEff = (int) ((50.0F + (10.0F * ((GT_MetaGenerated_Tool) stackRotor.getItem()).getToolCombatDamage(stackRotor))) * 100);
mOptimalAirFlow = (int) Math.max(Float.MIN_NORMAL, ((GT_MetaGenerated_Tool) stackRotor.getItem()).getToolStats(stackRotor).getSpeedMultiplier()
* GT_MetaGenerated_Tool.getPrimaryMaterial(stackRotor).mToolSpeed * 50);
@@ -228,8 +251,8 @@ public class GregtechMetaAtmosphericReconditioner extends GT_MetaTileEntity_Basi
//Utils.LOG_WARNING("Pollution Cleaner [5]");
//Log Debug information.
- Logger.WARNING("mBaseEff[1]:"+mBaseEff);
- Logger.WARNING("mOptimalAirFlow[1]:"+mOptimalAirFlow);
+ Logger.INFO("mBaseEff[1]:"+mBaseEff);
+ Logger.INFO("mOptimalAirFlow[1]:"+mOptimalAirFlow);
//Calculate The Voltage we are running
long tVoltage = drainEU;
@@ -244,20 +267,20 @@ public class GregtechMetaAtmosphericReconditioner extends GT_MetaTileEntity_Basi
//If no sides are free, how will you process the atmosphere?
if (mAirSides > 0){
reduction += (((Math.max((tTier-2), 1)*2)*50)*mAirSides); //Was originally *100
- Logger.WARNING("mPollutionReduction[1]:"+reduction);
+ Logger.INFO("mPollutionReduction[1]:"+reduction);
//I stole this code
reduction = (MathUtils.safeInt((long)reduction*this.mBaseEff)/100000)*mAirSides*Math.max((tTier-2), 1);
- Logger.WARNING("reduction[2]:"+reduction);
+ Logger.INFO("reduction[2]:"+reduction);
reduction = MathUtils.safeInt(((long)reduction/100)*this.mOptimalAirFlow);
- Logger.WARNING("reduction[3]:"+reduction);
+ Logger.INFO("reduction[3]:"+reduction);
mPollutionReduction = reduction;
//Set a temp to remove variable to aleviate duplicate code.
int toRemove = 0;
- Logger.WARNING("mCurrentPollution[4]:"+mCurrentPollution);
+ Logger.INFO("mCurrentPollution[4]:"+mCurrentPollution);
if (reduction <= mCurrentPollution){
//Clean some Air.
toRemove = reduction;
@@ -265,17 +288,17 @@ public class GregtechMetaAtmosphericReconditioner extends GT_MetaTileEntity_Basi
else {
//Makes sure we don't get negative pollution.
toRemove = mCurrentPollution;
- }
-
+ }
+
//We are good to clean
if (toRemove > 0){
if (damageTurbineRotor() && damageAirFilter()){
Logger.INFO("Removing "+toRemove+" pollution");
removePollution(mSaveRotor ? (toRemove/2) : toRemove);
- Logger.WARNING("mNewPollution[4]:"+getCurrentChunkPollution());
+ Logger.INFO("mNewPollution[4]:"+getCurrentChunkPollution());
}
else {
- Logger.WARNING("Could not damage turbine rotor or Air Filter.");
+ Logger.INFO("Could not damage turbine rotor or Air Filter.");
aBaseMetaTileEntity.setActive(false);
}
} //End of pollution removal block.
@@ -370,12 +393,18 @@ public class GregtechMetaAtmosphericReconditioner extends GT_MetaTileEntity_Basi
public boolean hasRotor(ItemStack rotorStack){
if(rotorStack != null){
if (rotorStack.getItem() instanceof ItemBasicScrubberTurbine) {
+ //Logger.INFO("Found Basic Turbine Rotor.");
return true;
}
- if (rotorStack.getItem() instanceof GT_MetaGenerated_Tool && rotorStack.getItemDamage() >= 170 && rotorStack.getItemDamage() <= 179){
+ else if (rotorStack.getItem() instanceof GT_MetaGenerated_Tool && rotorStack.getItemDamage() >= 170 && rotorStack.getItemDamage() <= 179){
+ //Logger.INFO("Found Turbine Rotor.");
return true;
}
+ else {
+ //Logger.INFO("Found: "+rotorStack.getDisplayName()+":"+rotorStack.getItemDamage());
+ }
}
+ //Logger.INFO("Found No Turbine Rotor.");
return false;
}
@@ -411,7 +440,7 @@ public class GregtechMetaAtmosphericReconditioner extends GT_MetaTileEntity_Basi
else {
//Do Damage
ItemAirFilter.setFilterDamage(rotorStack, currentUse+10);
- Logger.WARNING("Rotor Damage: "+currentUse);
+ Logger.INFO("Rotor Damage: "+currentUse);
return true;
}
}
@@ -424,23 +453,23 @@ public class GregtechMetaAtmosphericReconditioner extends GT_MetaTileEntity_Basi
double fDam = Math.floor(Math.abs(MathUtils.randFloat(1f, 2f) - MathUtils.randFloat(1f, 2f)) * (1f + 2f - 1f) + 1f);
damageValue -= fDam;
- //Logger.WARNING("Trying to do "+damageValue+" damage to the rotor. ["+fDam+"]");
+ //Logger.INFO("Trying to do "+damageValue+" damage to the rotor. ["+fDam+"]");
/*Materials M1 = GT_MetaGenerated_Tool.getPrimaryMaterial(this.mInventory[this.SLOT_ROTOR]);
Materials M2 = GT_MetaGenerated_Tool.getSecondaryMaterial(this.mInventory[this.SLOT_ROTOR]);
- Logger.WARNING("Trying to do "+damageValue+" damage to the rotor. [2]");*/
+ Logger.INFO("Trying to do "+damageValue+" damage to the rotor. [2]");*/
//Damage Rotor
//int rotorDurability = this.mInventory[this.SLOT_ROTOR].getItemDamage();
long rotorDamage = creativeRotor ? 0 : GT_MetaGenerated_Tool.getToolDamage(this.mInventory[this.SLOT_ROTOR]);
long rotorDurabilityMax = creativeRotor ? Integer.MAX_VALUE : GT_MetaGenerated_Tool.getToolMaxDamage(this.mInventory[this.SLOT_ROTOR]);
long rotorDurability = (rotorDurabilityMax - rotorDamage);
- Logger.WARNING("Rotor Damage: "+rotorDamage + " | Max Durability: "+rotorDurabilityMax+" | "+" Remaining Durability: "+rotorDurability);
+ Logger.INFO("Rotor Damage: "+rotorDamage + " | Max Durability: "+rotorDurabilityMax+" | "+" Remaining Durability: "+rotorDurability);
if (rotorDurability >= damageValue){
if (!mSaveRotor){
- Logger.WARNING("Damaging Rotor.");
+ Logger.INFO("Damaging Rotor.");
if (!creativeRotor)
GT_ModHandler.damageOrDechargeItem(this.mInventory[this.SLOT_ROTOR], (int) damageValue, 0, null);
@@ -454,7 +483,7 @@ public class GregtechMetaAtmosphericReconditioner extends GT_MetaTileEntity_Basi
}
}
else {
- Logger.WARNING("Damaging Rotor.");
+ Logger.INFO("Damaging Rotor.");
if (rotorDurability > 1000){
if (!creativeRotor)
GT_ModHandler.damageOrDechargeItem(this.mInventory[this.SLOT_ROTOR], (int) damageValue/2, 0, null);
@@ -472,18 +501,18 @@ public class GregtechMetaAtmosphericReconditioner extends GT_MetaTileEntity_Basi
}
if (rotorDurability <= 0 && !mSaveRotor && !creativeRotor) {
- Logger.WARNING("Destroying Rotor.");
+ Logger.INFO("Destroying Rotor.");
this.mInventory[this.SLOT_ROTOR] = null;
return false;
}
else if (rotorDurability <= 0 && mSaveRotor) {
- Logger.WARNING("Saving Rotor.");
+ Logger.INFO("Saving Rotor.");
return false;
}
}else {
- Logger.WARNING("Bad Rotor.");
+ Logger.INFO("Bad Rotor.");
return false;
}
}
@@ -494,25 +523,22 @@ public class GregtechMetaAtmosphericReconditioner extends GT_MetaTileEntity_Basi
public int getFreeSpaces(){
int mAir = 0;
IGregTechTileEntity aBaseMetaTileEntity = this.getBaseMetaTileEntity();
- int x = aBaseMetaTileEntity.getXCoord();
- int y = aBaseMetaTileEntity.getYCoord();
- int z = aBaseMetaTileEntity.getZCoord();
- if(aBaseMetaTileEntity.getAirOffset(x+1, y, z)){
+ if(aBaseMetaTileEntity.getAirOffset(1, 0, 0)){
mAir++;
}
- if(aBaseMetaTileEntity.getAirOffset(x-1, y, z)){
+ if(aBaseMetaTileEntity.getAirOffset(-1, 0, 0)){
mAir++;
}
- if(aBaseMetaTileEntity.getAirOffset(x, y, z+1)){
+ if(aBaseMetaTileEntity.getAirOffset(0, 0, 1)){
mAir++;
}
- if(aBaseMetaTileEntity.getAirOffset(x, y, z-1)){
+ if(aBaseMetaTileEntity.getAirOffset(0, 0, -1)){
mAir++;
}
- if(aBaseMetaTileEntity.getAirOffset(x, y+1, z)){
+ if(aBaseMetaTileEntity.getAirOffset(0, 1, 0)){
mAir++;
}
- if(aBaseMetaTileEntity.getAirOffset(x, y-1, z)){
+ if(aBaseMetaTileEntity.getAirOffset(0, -1, 0)){
mAir++;
}
return mAir;
@@ -526,8 +552,10 @@ public class GregtechMetaAtmosphericReconditioner extends GT_MetaTileEntity_Basi
if (this.mTier < 7) {
int startPollution = getCurrentChunkPollution();
+ Logger.INFO("Current Chunk Pollution: "+startPollution);
PollutionUtils.removePollution(this.getBaseMetaTileEntity(), toRemove);
int after = getCurrentChunkPollution();
+ Logger.INFO("Current Chunk Pollution: "+after);
return (after<startPollution);
}
else {
@@ -572,7 +600,7 @@ public class GregtechMetaAtmosphericReconditioner extends GT_MetaTileEntity_Basi
continue;
}
- Logger.WARNING("Trying to remove pollution from chunk "+r.xPosition+", "+r.zPosition+" | "+startPollution);
+ Logger.INFO("Trying to remove pollution from chunk "+r.xPosition+", "+r.zPosition+" | "+startPollution);
int after = 0;
boolean isMainChunk = r.isAtLocation(mainChunkX, mainChunkZ);
@@ -587,7 +615,7 @@ public class GregtechMetaAtmosphericReconditioner extends GT_MetaTileEntity_Basi
if (startPollution - after > 0) {
totalRemoved += (startPollution - after);
}
- Logger.WARNING("Removed "+(startPollution - after)+" pollution from chunk "+r.xPosition+", "+r.zPosition+" | "+after);
+ Logger.INFO("Removed "+(startPollution - after)+" pollution from chunk "+r.xPosition+", "+r.zPosition+" | "+after);
}
return totalRemoved > 0 && chunksWithRemoval > 0;
}
@@ -650,7 +678,7 @@ public class GregtechMetaAtmosphericReconditioner extends GT_MetaTileEntity_Basi
else {
//Do Damage
ItemAirFilter.setFilterDamage(filter, currentUse+1);
- Logger.WARNING("Filter Damage: "+currentUse);
+ Logger.INFO("Filter Damage: "+currentUse);
return true;
}
}
diff --git a/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/basic/GregtechMetaPollutionCreator.java b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/basic/GregtechMetaPollutionCreator.java
index 5f55e080ad..65217f9e53 100644
--- a/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/basic/GregtechMetaPollutionCreator.java
+++ b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/basic/GregtechMetaPollutionCreator.java
@@ -1,24 +1,20 @@
package gtPlusPlus.xmod.gregtech.common.tileentities.machines.basic;
-import net.minecraft.entity.player.EntityPlayer;
-import net.minecraft.item.ItemStack;
-import net.minecraft.nbt.NBTTagCompound;
-import net.minecraft.world.World;
-
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.objects.GT_RenderedTexture;
import gregtech.api.util.GT_Utility;
-
-import gtPlusPlus.api.objects.Logger;
import gtPlusPlus.core.lib.CORE;
-import gtPlusPlus.core.util.Utils;
import gtPlusPlus.core.util.minecraft.PlayerUtils;
import gtPlusPlus.core.util.minecraft.gregtech.PollutionUtils;
import gtPlusPlus.xmod.gregtech.api.metatileentity.implementations.base.GregtechMetaTileEntity;
import gtPlusPlus.xmod.gregtech.common.blocks.textures.TexturesGtBlock;
+import net.minecraft.entity.player.EntityPlayer;
+import net.minecraft.item.ItemStack;
+import net.minecraft.nbt.NBTTagCompound;
+import net.minecraft.world.World;
public class GregtechMetaPollutionCreator extends GregtechMetaTileEntity {
@@ -189,7 +185,7 @@ public class GregtechMetaPollutionCreator extends GregtechMetaTileEntity {
public int pollutionMultiplier = 1;
private void showPollution(final World worldIn, final EntityPlayer playerIn){
- if(!PollutionUtils.mPollution()){
+ if(!PollutionUtils.isPollutionEnabled()){
PlayerUtils.messagePlayer(playerIn, "This block is useless, Pollution is disabled.");
}
else {
diff --git a/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/basic/GregtechMetaPollutionDetector.java b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/basic/GregtechMetaPollutionDetector.java
index 10319f2269..69a4f96708 100644
--- a/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/basic/GregtechMetaPollutionDetector.java
+++ b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/basic/GregtechMetaPollutionDetector.java
@@ -1,25 +1,21 @@
package gtPlusPlus.xmod.gregtech.common.tileentities.machines.basic;
-import net.minecraft.entity.player.EntityPlayer;
-import net.minecraft.item.ItemStack;
-import net.minecraft.nbt.NBTTagCompound;
-import net.minecraft.world.World;
-
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.objects.GT_RenderedTexture;
import gregtech.api.util.GT_Utility;
-
-import gtPlusPlus.api.objects.Logger;
import gtPlusPlus.core.lib.CORE;
-import gtPlusPlus.core.util.Utils;
import gtPlusPlus.core.util.math.MathUtils;
import gtPlusPlus.core.util.minecraft.PlayerUtils;
import gtPlusPlus.core.util.minecraft.gregtech.PollutionUtils;
import gtPlusPlus.xmod.gregtech.api.metatileentity.implementations.base.GregtechMetaTileEntity;
import gtPlusPlus.xmod.gregtech.common.blocks.textures.TexturesGtBlock;
+import net.minecraft.entity.player.EntityPlayer;
+import net.minecraft.item.ItemStack;
+import net.minecraft.nbt.NBTTagCompound;
+import net.minecraft.world.World;
public class GregtechMetaPollutionDetector extends GregtechMetaTileEntity {
@@ -190,7 +186,7 @@ public class GregtechMetaPollutionDetector extends GregtechMetaTileEntity {
}
private void showPollution(final World worldIn, final EntityPlayer playerIn){
- if(!PollutionUtils.mPollution()){
+ if(!PollutionUtils.isPollutionEnabled()){
PlayerUtils.messagePlayer(playerIn, "This block is useless, Pollution is disabled.");
}
else {