diff options
Diffstat (limited to 'src/Java/gtPlusPlus/xmod/gregtech/api')
4 files changed, 37 insertions, 12 deletions
diff --git a/src/Java/gtPlusPlus/xmod/gregtech/api/interfaces/internal/Interface_ToolStats.java b/src/Java/gtPlusPlus/xmod/gregtech/api/interfaces/internal/Interface_ToolStats.java index 5a1c305ab5..fa5ff66310 100644 --- a/src/Java/gtPlusPlus/xmod/gregtech/api/interfaces/internal/Interface_ToolStats.java +++ b/src/Java/gtPlusPlus/xmod/gregtech/api/interfaces/internal/Interface_ToolStats.java @@ -122,7 +122,6 @@ public interface Interface_ToolStats extends IToolStats{ /** * @return If this Tool can be used as an BC Wrench. */ - @Override public boolean isWrench(); /** diff --git a/src/Java/gtPlusPlus/xmod/gregtech/api/items/Gregtech_MetaTool.java b/src/Java/gtPlusPlus/xmod/gregtech/api/items/Gregtech_MetaTool.java index 3d3dcee94c..16123ce70d 100644 --- a/src/Java/gtPlusPlus/xmod/gregtech/api/items/Gregtech_MetaTool.java +++ b/src/Java/gtPlusPlus/xmod/gregtech/api/items/Gregtech_MetaTool.java @@ -170,7 +170,6 @@ public abstract class Gregtech_MetaTool extends GT_MetaGenerated_Tool implements } } - @Override @SuppressWarnings("unchecked") public void addAdditionalToolTips(final List aList, final ItemStack aStack, final EntityPlayer aPlayer) { final long tMaxDamage = getToolMaxDamage(aStack); diff --git a/src/Java/gtPlusPlus/xmod/gregtech/api/items/tools/GT_MetaGenTool.java b/src/Java/gtPlusPlus/xmod/gregtech/api/items/tools/GT_MetaGenTool.java index cf167888f3..a980a299d5 100644 --- a/src/Java/gtPlusPlus/xmod/gregtech/api/items/tools/GT_MetaGenTool.java +++ b/src/Java/gtPlusPlus/xmod/gregtech/api/items/tools/GT_MetaGenTool.java @@ -339,7 +339,6 @@ public abstract class GT_MetaGenTool extends GT_MetaGenerated_Tool { } } - @Override public boolean canWrench(final EntityPlayer player, final int x, final int y, final int z) { System.out.println("canWrench"); if(player==null) { @@ -355,7 +354,6 @@ public abstract class GT_MetaGenTool extends GT_MetaGenerated_Tool { return (tStats != null) && tStats.isWrench(); } - @Override public void wrenchUsed(final EntityPlayer player, final int x, final int y, final int z) { if(player==null) { return; @@ -369,17 +367,14 @@ public abstract class GT_MetaGenTool extends GT_MetaGenerated_Tool { } } - @Override public boolean canUse(final ItemStack stack, final EntityPlayer player, final int x, final int y, final int z){ return this.canWrench(player, x, y, z); } - @Override public void used(final ItemStack stack, final EntityPlayer player, final int x, final int y, final int z){ this.wrenchUsed(player, x, y, z); } - @Override public boolean shouldHideFacades(final ItemStack stack, final EntityPlayer player) { if(player==null) { return false; 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 f6a8d55174..79f5b22840 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 @@ -16,7 +16,9 @@ import gregtech.api.util.GT_Recipe; import gtPlusPlus.api.objects.Logger; import gtPlusPlus.core.lib.CORE; import gtPlusPlus.core.lib.LoadedMods; +import gtPlusPlus.core.util.PollutionUtils; import gtPlusPlus.core.util.math.MathUtils; +import gtPlusPlus.core.util.reflect.ReflectionUtils; import gtPlusPlus.xmod.gregtech.api.gui.CONTAINER_MultiMachine; import gtPlusPlus.xmod.gregtech.api.gui.GUI_MultiMachine; import gtPlusPlus.xmod.gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch_InputBattery; @@ -420,23 +422,35 @@ GT_MetaTileEntity_MultiBlockBase { } public boolean polluteEnvironment(int aPollutionLevel) { - int mPollution = 0; - Field f = FieldUtils.getDeclaredField(this.getClass(), "mPollution", true); + try { + Integer mPollution = 0; + Field f = ReflectionUtils.getField(this.getClass(), "mPollution"); if (f != null){ + Logger.REFLECTION("pollution field was not null"); try { - mPollution = (int) f.get(this); + mPollution = (Integer) f.get(this); + if (mPollution != null){ + Logger.REFLECTION("pollution field value was not null"); + } + else { + Logger.REFLECTION("pollution field value was null"); + } } catch (IllegalArgumentException | IllegalAccessException e) {} } + else { + Logger.REFLECTION("pollution field was null"); + } if (CORE.MAIN_GREGTECH_5U_EXPERIMENTAL_FORK && f != null){ + Logger.REFLECTION("doing pollution"); mPollution += aPollutionLevel; for (final GT_MetaTileEntity_Hatch_Muffler tHatch : this.mMufflerHatches) { if (isValidMetaTileEntity(tHatch)) { if (mPollution < 10000) { break; } - if (!tHatch.polluteEnvironment()) { + if (!polluteEnvironmentHatch(tHatch)) { continue; } mPollution -= 10000; @@ -447,7 +461,25 @@ GT_MetaTileEntity_MultiBlockBase { else { return false; } - + } + catch (Throwable t){ + Logger.REFLECTION("Failed to add pollution."); + t.printStackTrace(); + return false; + } + } + + public boolean polluteEnvironmentHatch(GT_MetaTileEntity_Hatch_Muffler tHatch) { + if (tHatch.getBaseMetaTileEntity().getAirAtSide(this.getBaseMetaTileEntity().getFrontFacing())) { + PollutionUtils.addPollution(tHatch.getBaseMetaTileEntity(), calculatePollutionReduction(tHatch, 10000)); + return true; + } else { + return false; + } + } + + public int calculatePollutionReduction(GT_MetaTileEntity_Hatch_Muffler tHatch, int aPollution) { + return (int) ((double) aPollution * Math.pow(0.7D, (double) (tHatch.mTier - 1))); } } |