aboutsummaryrefslogtreecommitdiff
path: root/src/Java/gtPlusPlus/core/util/minecraft
diff options
context:
space:
mode:
authorAlkalus <3060479+draknyte1@users.noreply.github.com>2018-09-12 22:12:00 +1000
committerAlkalus <3060479+draknyte1@users.noreply.github.com>2018-09-12 22:12:00 +1000
commitfc3d445a23d8e6b4a6f87d7a9aeea3c8315aa9b6 (patch)
tree62a50989e8a5c08c9880dd3eb86c82d5e128d6a6 /src/Java/gtPlusPlus/core/util/minecraft
parented64f971b4298b186f2486dc553c9fab955d36b4 (diff)
downloadGT5-Unofficial-fc3d445a23d8e6b4a6f87d7a9aeea3c8315aa9b6.tar.gz
GT5-Unofficial-fc3d445a23d8e6b4a6f87d7a9aeea3c8315aa9b6.tar.bz2
GT5-Unofficial-fc3d445a23d8e6b4a6f87d7a9aeea3c8315aa9b6.zip
+ Added Advanced Mufflers.
+ Added custom overlay textures for new mufflers. % Logging changes. $ Fixed generation of recipes for pocket fusion.
Diffstat (limited to 'src/Java/gtPlusPlus/core/util/minecraft')
-rw-r--r--src/Java/gtPlusPlus/core/util/minecraft/gregtech/PollutionUtils.java57
1 files changed, 53 insertions, 4 deletions
diff --git a/src/Java/gtPlusPlus/core/util/minecraft/gregtech/PollutionUtils.java b/src/Java/gtPlusPlus/core/util/minecraft/gregtech/PollutionUtils.java
index 8ecdab4bbc..d4f217bbfd 100644
--- a/src/Java/gtPlusPlus/core/util/minecraft/gregtech/PollutionUtils.java
+++ b/src/Java/gtPlusPlus/core/util/minecraft/gregtech/PollutionUtils.java
@@ -6,12 +6,26 @@ import java.lang.reflect.Method;
import gregtech.GT_Mod;
import gregtech.api.interfaces.tileentity.IGregTechTileEntity;
+import gregtech.api.interfaces.tileentity.IHasWorldObjectAndCoords;
import gregtech.common.GT_Proxy;
-
+import gtPlusPlus.core.lib.CORE;
import gtPlusPlus.core.util.reflect.ReflectionUtils;
+import net.minecraft.tileentity.TileEntity;
+import net.minecraft.world.chunk.Chunk;
public class PollutionUtils {
+ private static boolean mIsPollutionEnabled = true;
+
+ static {
+ if (CORE.MAIN_GREGTECH_5U_EXPERIMENTAL_FORK || CORE.GTNH) {
+ mIsPollutionEnabled = mPollution();
+ }
+ else {
+ mIsPollutionEnabled = false;
+ }
+ }
+
public static boolean mPollution() {
try {
GT_Proxy GT_Pollution = GT_Mod.gregtechproxy;
@@ -21,11 +35,13 @@ public class PollutionUtils {
return mPollution.getBoolean(GT_Pollution);
}
}
- } catch (SecurityException | IllegalArgumentException | IllegalAccessException | NoSuchFieldException e) {}
+ } catch (SecurityException | IllegalArgumentException | IllegalAccessException | NoSuchFieldException e) {
+ }
return false;
}
public static boolean addPollution(IGregTechTileEntity te, int pollutionValue) {
+ if (mIsPollutionEnabled)
try {
Class<?> GT_Pollution = Class.forName("gregtech.common.GT_Pollution");
if (GT_Pollution != null) {
@@ -36,11 +52,13 @@ public class PollutionUtils {
}
}
} catch (ClassNotFoundException | SecurityException | NoSuchMethodException | IllegalAccessException
- | IllegalArgumentException | InvocationTargetException e) {}
+ | IllegalArgumentException | InvocationTargetException e) {
+ }
return false;
}
public static int getPollution(IGregTechTileEntity te) {
+ if (mIsPollutionEnabled)
try {
Class<?> GT_Pollution = Class.forName("gregtech.common.GT_Pollution");
if (GT_Pollution != null) {
@@ -50,8 +68,39 @@ public class PollutionUtils {
}
}
} catch (ClassNotFoundException | SecurityException | NoSuchMethodException | IllegalAccessException
- | IllegalArgumentException | InvocationTargetException e) {}
+ | IllegalArgumentException | InvocationTargetException e) {
+ }
return 0;
}
+ public static boolean addPollution(Object aTileOfSomeSort, int pollutionValue) {
+ if (mIsPollutionEnabled)
+ try {
+ Class<?> GT_Pollution = Class.forName("gregtech.common.GT_Pollution");
+ if (GT_Pollution != null) {
+ Method addPollution = GT_Pollution.getMethod("addPollution", Chunk.class, int.class);
+ if (addPollution != null) {
+ IHasWorldObjectAndCoords j = (IHasWorldObjectAndCoords) aTileOfSomeSort;
+ if (j != null) {
+ Chunk c = j.getWorld().getChunkFromBlockCoords(j.getXCoord(), j.getZCoord());
+ addPollution.invoke(null, c, pollutionValue);
+ return true;
+ } else {
+ TileEntity t = (TileEntity) aTileOfSomeSort;
+ if (t != null) {
+ Chunk c = t.getWorldObj().getChunkFromBlockCoords(t.xCoord, t.zCoord);
+ addPollution.invoke(null, c, pollutionValue);
+ return true;
+ }
+ }
+
+ }
+ }
+ } catch (ClassNotFoundException | SecurityException | NoSuchMethodException | IllegalAccessException
+ | IllegalArgumentException | InvocationTargetException e) {
+ }
+ return false;
+
+ }
+
}