diff options
author | Draknyte1 <Draknyte1@hotmail.com> | 2017-12-20 23:39:49 +1000 |
---|---|---|
committer | Draknyte1 <Draknyte1@hotmail.com> | 2017-12-20 23:39:49 +1000 |
commit | 5715a32d2901922503fd850f3a68503fb77467c3 (patch) | |
tree | 7e12520fbc23844e99493d55af4410a785538e35 /src/Java/gtPlusPlus/xmod/gregtech/api | |
parent | 2a4795f65d98ff60a177d7d6a5552fd687d9f6e8 (diff) | |
download | GT5-Unofficial-5715a32d2901922503fd850f3a68503fb77467c3.tar.gz GT5-Unofficial-5715a32d2901922503fd850f3a68503fb77467c3.tar.bz2 GT5-Unofficial-5715a32d2901922503fd850f3a68503fb77467c3.zip |
- Disabled some logging.
% Minor Project Clean-up, added missing Override annotations to 100+ methods & removed pointless casts.
% Moved Logging to it's own class.
$ Fixed Multi-block handling of Pollution.
$ Fixed the GT 5.09 material enabler system. (From My Side, it's still borked on GTs).
+ Added a Dynamic Proxy invocation for IMaterialHandler.
+ Added an AutoMap data type, which is a Auto-incremental ID'd Hashmap wrapper.
Diffstat (limited to 'src/Java/gtPlusPlus/xmod/gregtech/api')
12 files changed, 163 insertions, 119 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 fa5ff66310..5a1c305ab5 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,6 +122,7 @@ 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 89deeb931d..3d3dcee94c 100644 --- a/src/Java/gtPlusPlus/xmod/gregtech/api/items/Gregtech_MetaTool.java +++ b/src/Java/gtPlusPlus/xmod/gregtech/api/items/Gregtech_MetaTool.java @@ -1,7 +1,5 @@ package gtPlusPlus.xmod.gregtech.api.items; -import static gregtech.api.enums.GT_Values.MOD_ID_RC; - import java.util.*; import java.util.Map.Entry; @@ -147,6 +145,7 @@ public abstract class Gregtech_MetaTool extends GT_MetaGenerated_Tool implements } + @SuppressWarnings("unchecked") public void addAdditionalToolTips(final List aList, final ItemStack aStack) { final long tMaxDamage = getToolMaxDamage(aStack); final Materials tMaterial = getPrimaryMaterial(aStack); @@ -171,6 +170,8 @@ 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); final Materials tMaterial = getPrimaryMaterial(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 a980a299d5..cf167888f3 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,6 +339,7 @@ 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) { @@ -354,6 +355,7 @@ 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; @@ -367,14 +369,17 @@ 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/GT_MetaTileEntity_DeluxeMachine.java b/src/Java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_DeluxeMachine.java index 7b4cf471b0..83c2235d8c 100644 --- a/src/Java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_DeluxeMachine.java +++ b/src/Java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_DeluxeMachine.java @@ -14,7 +14,7 @@ import gregtech.api.util.GT_OreDictUnificator; import gregtech.api.util.GT_Recipe; import gregtech.api.util.GT_Recipe.GT_Recipe_Map; import gregtech.api.util.GT_Utility; -import gtPlusPlus.core.util.Utils; +import gtPlusPlus.api.objects.Logger; import gtPlusPlus.xmod.gregtech.api.objects.XSTR; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.player.InventoryPlayer; @@ -452,7 +452,7 @@ public abstract class GT_MetaTileEntity_DeluxeMachine extends GT_MetaTileEntity_ } boolean tRemovedOutputFluid = false; - Utils.LOG_WARNING("R0"); + Logger.WARNING("R0"); if (doesAutoOutputFluids() && getDrainableStack() != null && aBaseMetaTileEntity.getFrontFacing() != mMainFacing && (tSucceeded || aTick % 20 == 0)) { IFluidHandler tTank = aBaseMetaTileEntity.getITankContainerAtSide(aBaseMetaTileEntity.getFrontFacing()); @@ -477,27 +477,27 @@ public abstract class GT_MetaTileEntity_DeluxeMachine extends GT_MetaTileEntity_ if (mOutputBlocked != 0) if (isOutputEmpty()) mOutputBlocked = 0; else mOutputBlocked++; - Utils.LOG_WARNING("R1"); + Logger.WARNING("R1"); if (allowToCheckRecipe()) { - Utils.LOG_WARNING("R2--------------------------------------------------"); - Utils.LOG_WARNING("R2: (mMaxProgresstime <= 0 && aBaseMetaTileEntity.isAllowedToWork() && (tRemovedOutputFluid || tSucceeded || aBaseMetaTileEntity.hasInventoryBeenModified() || aTick % 600 == 0 || aBaseMetaTileEntity.hasWorkJustBeenEnabled()) && hasEnoughEnergyToCheckRecipe())"); - Utils.LOG_WARNING("R2--------------------------------------------------"); - Utils.LOG_WARNING("R2-mMaxProgresstime: "+mMaxProgresstime); - Utils.LOG_WARNING("R2-isAllowedToWork(): "+aBaseMetaTileEntity.isAllowedToWork()); - Utils.LOG_WARNING("R2--------------------------------------------------"); - Utils.LOG_WARNING("R2-tRemovedOutputFluid: "+tRemovedOutputFluid); - Utils.LOG_WARNING("R2-tSucceeded: "+tSucceeded); - Utils.LOG_WARNING("R2-hasInventoryBeenModified(): "+aBaseMetaTileEntity.hasInventoryBeenModified()); - Utils.LOG_WARNING("R2-(aTick % 600 == 0): "+(aTick % 600 == 0)); - Utils.LOG_WARNING("R2-hasWorkJustBeenEnabled(): "+aBaseMetaTileEntity.hasWorkJustBeenEnabled()); - Utils.LOG_WARNING("R2--------------------------------------------------"); - Utils.LOG_WARNING("R2-hasEnoughEnergyToCheckRecipe(): "+hasEnoughEnergyToCheckRecipe()); - Utils.LOG_WARNING("R2--------------------------------------------------"); + Logger.WARNING("R2--------------------------------------------------"); + Logger.WARNING("R2: (mMaxProgresstime <= 0 && aBaseMetaTileEntity.isAllowedToWork() && (tRemovedOutputFluid || tSucceeded || aBaseMetaTileEntity.hasInventoryBeenModified() || aTick % 600 == 0 || aBaseMetaTileEntity.hasWorkJustBeenEnabled()) && hasEnoughEnergyToCheckRecipe())"); + Logger.WARNING("R2--------------------------------------------------"); + Logger.WARNING("R2-mMaxProgresstime: "+mMaxProgresstime); + Logger.WARNING("R2-isAllowedToWork(): "+aBaseMetaTileEntity.isAllowedToWork()); + Logger.WARNING("R2--------------------------------------------------"); + Logger.WARNING("R2-tRemovedOutputFluid: "+tRemovedOutputFluid); + Logger.WARNING("R2-tSucceeded: "+tSucceeded); + Logger.WARNING("R2-hasInventoryBeenModified(): "+aBaseMetaTileEntity.hasInventoryBeenModified()); + Logger.WARNING("R2-(aTick % 600 == 0): "+(aTick % 600 == 0)); + Logger.WARNING("R2-hasWorkJustBeenEnabled(): "+aBaseMetaTileEntity.hasWorkJustBeenEnabled()); + Logger.WARNING("R2--------------------------------------------------"); + Logger.WARNING("R2-hasEnoughEnergyToCheckRecipe(): "+hasEnoughEnergyToCheckRecipe()); + Logger.WARNING("R2--------------------------------------------------"); if (mMaxProgresstime <= 0 && aBaseMetaTileEntity.isAllowedToWork() && (tRemovedOutputFluid || tSucceeded || aBaseMetaTileEntity.hasInventoryBeenModified() || aTick % 600 == 0 || aBaseMetaTileEntity.hasWorkJustBeenEnabled()) && hasEnoughEnergyToCheckRecipe()) { - Utils.LOG_WARNING("R3"); + Logger.WARNING("R3"); if (checkRecipe() == 2) { if (mInventory[3] != null && mInventory[3].stackSize <= 0) mInventory[3] = null; - Utils.LOG_WARNING("R4"); + Logger.WARNING("R4"); for (int i = getInputSlot(), j = i + mInputSlotCount; i < j; i++) if (mInventory[i] != null && mInventory[i].stackSize <= 0) mInventory[i] = null; for (int i = 0; i < mOutputItems.length; i++) { diff --git a/src/Java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_DeluxeTank.java b/src/Java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_DeluxeTank.java index 175869a1ac..b5e7d7d64c 100644 --- a/src/Java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_DeluxeTank.java +++ b/src/Java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_DeluxeTank.java @@ -5,7 +5,7 @@ import gregtech.api.interfaces.ITexture; import gregtech.api.interfaces.tileentity.IGregTechTileEntity; import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_BasicTank; import gregtech.api.util.GT_Utility; -import gtPlusPlus.core.util.Utils; +import gtPlusPlus.api.objects.Logger; import gtPlusPlus.xmod.gregtech.api.gui.CONTAINER_DeluxeTank; import gtPlusPlus.xmod.gregtech.api.gui.GUI_DeluxeTank; import net.minecraft.entity.player.InventoryPlayer; @@ -228,7 +228,7 @@ public abstract class GT_MetaTileEntity_DeluxeTank extends GT_MetaTileEntity_Bas } } else { - Utils.LOG_INFO("Something broke when trying to empty cells between two fluid tank areas."); + Logger.INFO("Something broke when trying to empty cells between two fluid tank areas."); } } } diff --git a/src/Java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_Hatch_InputBattery.java b/src/Java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_Hatch_InputBattery.java index 9c93ca3889..8b5a1e520b 100644 --- a/src/Java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_Hatch_InputBattery.java +++ b/src/Java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_Hatch_InputBattery.java @@ -3,21 +3,16 @@ package gtPlusPlus.xmod.gregtech.api.metatileentity.implementations; import static gregtech.api.enums.GT_Values.V; import gregtech.api.enums.GT_Values; -import gregtech.api.enums.Textures; import gregtech.api.interfaces.ITexture; import gregtech.api.interfaces.tileentity.IGregTechTileEntity; import gregtech.api.metatileentity.MetaTileEntity; import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch; import gregtech.api.objects.GT_RenderedTexture; -import gregtech.api.util.GT_Recipe.GT_Recipe_Map; import gregtech.api.util.GT_ModHandler; +import gregtech.api.util.GT_Recipe.GT_Recipe_Map; import gregtech.api.util.GT_Utility; import gtPlusPlus.core.lib.CORE; -import gtPlusPlus.core.util.Utils; -import gtPlusPlus.xmod.gregtech.api.gui.hatches.charge.CONTAINER_Electric_2by2; -import gtPlusPlus.xmod.gregtech.api.gui.hatches.charge.CONTAINER_Electric_4by4; -import gtPlusPlus.xmod.gregtech.api.gui.hatches.charge.GUI_Electric_2by2; -import gtPlusPlus.xmod.gregtech.api.gui.hatches.charge.GUI_Electric_4by4; +import gtPlusPlus.xmod.gregtech.api.gui.hatches.charge.*; import gtPlusPlus.xmod.gregtech.common.blocks.textures.TexturesGtBlock; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.player.InventoryPlayer; @@ -219,10 +214,12 @@ GT_MetaTileEntity_Hatch { && (mRecipeMap == null || mRecipeMap.containsInput(aStack)); } + @Override public int rechargerSlotStartIndex() { return 0; } + @Override public int rechargerSlotCount() { switch (mTier) { case 2 : @@ -234,10 +231,12 @@ GT_MetaTileEntity_Hatch { } } + @Override public int dechargerSlotStartIndex() { return 0; } + @Override public int dechargerSlotCount() { return 0; } diff --git a/src/Java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_Hatch_OutputBattery.java b/src/Java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_Hatch_OutputBattery.java index aa234a3dc9..29d32d4d9d 100644 --- a/src/Java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_Hatch_OutputBattery.java +++ b/src/Java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_Hatch_OutputBattery.java @@ -2,7 +2,6 @@ package gtPlusPlus.xmod.gregtech.api.metatileentity.implementations; import static gregtech.api.enums.GT_Values.V; -import gregtech.api.enums.Textures; import gregtech.api.interfaces.ITexture; import gregtech.api.interfaces.tileentity.IGregTechTileEntity; import gregtech.api.metatileentity.MetaTileEntity; @@ -10,12 +9,9 @@ import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch; import gregtech.api.objects.GT_RenderedTexture; import gregtech.api.util.GT_ModHandler; import gregtech.api.util.GT_Utility; +import gtPlusPlus.api.objects.Logger; import gtPlusPlus.core.lib.CORE; -import gtPlusPlus.core.util.Utils; -import gtPlusPlus.xmod.gregtech.api.gui.hatches.charge.CONTAINER_Electric_2by2; -import gtPlusPlus.xmod.gregtech.api.gui.hatches.charge.CONTAINER_Electric_4by4; -import gtPlusPlus.xmod.gregtech.api.gui.hatches.charge.GUI_Electric_2by2; -import gtPlusPlus.xmod.gregtech.api.gui.hatches.charge.GUI_Electric_4by4; +import gtPlusPlus.xmod.gregtech.api.gui.hatches.charge.*; import gtPlusPlus.xmod.gregtech.common.blocks.textures.TexturesGtBlock; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.player.InventoryPlayer; @@ -178,18 +174,22 @@ GT_MetaTileEntity_Hatch { } } + @Override public int rechargerSlotStartIndex() { return 0; } + @Override public int rechargerSlotCount() { return 0; } + @Override public int dechargerSlotStartIndex() { return 0; } + @Override public int dechargerSlotCount() { return mTier == 2 ? 4 : 16; } @@ -205,7 +205,7 @@ GT_MetaTileEntity_Hatch { if (aBaseMetaTileEntity.getMetaTileEntity() instanceof MetaTileEntity) { MetaTileEntity mMetaTileEntity = (MetaTileEntity) aBaseMetaTileEntity.getMetaTileEntity(); if (mMetaTileEntity.dechargerSlotCount() > 0 && mMetaTileEntity.getEUVar() < aBaseMetaTileEntity.getEUCapacity()) { - Utils.LOG_INFO("3"); + Logger.INFO("3"); for (int i = mMetaTileEntity.dechargerSlotStartIndex(), k = mMetaTileEntity.dechargerSlotCount() + i; i < k; i++) { if (mMetaTileEntity.mInventory[i] != null && mMetaTileEntity.getEUVar() < aBaseMetaTileEntity.getEUCapacity()) { aBaseMetaTileEntity.increaseStoredEnergyUnits(GT_ModHandler.dischargeElectricItem(mMetaTileEntity.mInventory[i], (int) Math.min(V[mTier] * 15, aBaseMetaTileEntity.getEUCapacity() - aBaseMetaTileEntity.getStoredEU()), (int) Math.min(Integer.MAX_VALUE, mMetaTileEntity.getInputTier()), true, false, false), true); diff --git a/src/Java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/base/GregtechMetaPipeEntityBase_Cable.java b/src/Java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/base/GregtechMetaPipeEntityBase_Cable.java index 6de1594b69..220e6eb4dc 100644 --- a/src/Java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/base/GregtechMetaPipeEntityBase_Cable.java +++ b/src/Java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/base/GregtechMetaPipeEntityBase_Cable.java @@ -19,8 +19,8 @@ import gregtech.api.metatileentity.MetaPipeEntity; import gregtech.api.objects.GT_RenderedTexture; import gregtech.api.util.GT_Utility; import gregtech.common.GT_Proxy; +import gtPlusPlus.api.objects.Logger; import gtPlusPlus.core.lib.CORE; -import gtPlusPlus.core.util.Utils; import gtPlusPlus.xmod.gregtech.api.enums.GregtechOrePrefixes.GT_Materials; import ic2.api.energy.tile.IEnergySink; import net.minecraft.entity.Entity; @@ -88,8 +88,8 @@ public class GregtechMetaPipeEntityBase_Cable extends MetaPipeEntity implements } catch (NoSuchFieldException | SecurityException | IllegalArgumentException | IllegalAccessException e) { // Utils.LOG_INFO("FATAL ERROR - REFLECTION FAILED FOR GT CABLES // - PLEASE REPORT THIS."); - Utils.LOG_WARNING("FATAL ERROR - REFLECTION FAILED FOR GT CABLES - PLEASE REPORT THIS."); - Utils.LOG_ERROR("FATAL ERROR - REFLECTION FAILED FOR GT CABLES - PLEASE REPORT THIS."); + Logger.WARNING("FATAL ERROR - REFLECTION FAILED FOR GT CABLES - PLEASE REPORT THIS."); + Logger.ERROR("FATAL ERROR - REFLECTION FAILED FOR GT CABLES - PLEASE REPORT THIS."); temp = 4; } } 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 484a156e0f..f6a8d55174 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 @@ -1,27 +1,24 @@ package gtPlusPlus.xmod.gregtech.api.metatileentity.implementations.base; -import java.lang.reflect.InvocationTargetException; -import java.lang.reflect.Method; +import java.lang.reflect.*; import java.util.ArrayList; import java.util.Iterator; +import org.apache.commons.lang3.reflect.FieldUtils; + import gregtech.api.enums.Materials; import gregtech.api.interfaces.metatileentity.IMetaTileEntity; import gregtech.api.interfaces.tileentity.IGregTechTileEntity; import gregtech.api.items.GT_MetaGenerated_Tool; import gregtech.api.metatileentity.MetaTileEntity; -import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch; -import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch_Input; -import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch_Output; -import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch_OutputBus; -import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_MultiBlockBase; +import gregtech.api.metatileentity.implementations.*; 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.Utils; import gtPlusPlus.core.util.math.MathUtils; import gtPlusPlus.xmod.gregtech.api.gui.CONTAINER_MultiMachine; import gtPlusPlus.xmod.gregtech.api.gui.GUI_MultiMachine; -import gtPlusPlus.xmod.gregtech.api.items.tools.GT_MetaGenTool; import gtPlusPlus.xmod.gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch_InputBattery; import gtPlusPlus.xmod.gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch_OutputBattery; import net.minecraft.entity.player.InventoryPlayer; @@ -105,7 +102,7 @@ GT_MetaTileEntity_MultiBlockBase { public int getValidOutputSlots(final IGregTechTileEntity machineCalling, final GT_Recipe sRecipes, final ItemStack[] sInputs) { - Utils.LOG_WARNING("Finding valid output slots for " + Logger.WARNING("Finding valid output slots for " + machineCalling.getInventoryName()); final ArrayList<ItemStack> tInputList = this.getStoredInputs(); final GT_Recipe tRecipe = sRecipes; @@ -148,11 +145,11 @@ GT_MetaTileEntity_MultiBlockBase { baseRecipe = tRecipe.copy(); if ((cloneRecipe != baseRecipe) || (cloneRecipe == null)) { cloneRecipe = baseRecipe.copy(); - Utils.LOG_WARNING("Setting Recipe"); + Logger.WARNING("Setting Recipe"); } if ((cloneTime != baseRecipe.mDuration) || (cloneTime == 0)) { cloneTime = baseRecipe.mDuration; - Utils.LOG_WARNING("Setting Time"); + Logger.WARNING("Setting Time"); } if (cloneRecipe.mDuration > 0) { @@ -161,16 +158,16 @@ GT_MetaTileEntity_MultiBlockBase { (100 - percentage)); cloneRecipe.mDuration = tempTime; if (cloneRecipe.mDuration < originalTime) { - Utils.LOG_MACHINE_INFO("Generated recipe with a smaller time. | " + Logger.MACHINE_INFO("Generated recipe with a smaller time. | " + originalTime + " | " + cloneRecipe.mDuration + " |"); return cloneRecipe; } else { - Utils.LOG_MACHINE_INFO("Did not generate recipe with a smaller time. | " + Logger.MACHINE_INFO("Did not generate recipe with a smaller time. | " + originalTime + " | " + cloneRecipe.mDuration + " |"); return tRecipe; } } - Utils.LOG_MACHINE_INFO("Error generating recipe, returning null."); + Logger.MACHINE_INFO("Error generating recipe, returning null."); return null; } @@ -413,4 +410,44 @@ GT_MetaTileEntity_MultiBlockBase { return super.addDynamoToMachineList(aTileEntity, aBaseCasingIndex); } + + /** + * Pollution Management + */ + + public int getPollutionPerTick(ItemStack arg0) { + return 0; + } + + public boolean polluteEnvironment(int aPollutionLevel) { + int mPollution = 0; + Field f = FieldUtils.getDeclaredField(this.getClass(), "mPollution", true); + if (f != null){ + try { + mPollution = (int) f.get(this); + } + catch (IllegalArgumentException | IllegalAccessException e) {} + } + + if (CORE.MAIN_GREGTECH_5U_EXPERIMENTAL_FORK && f != null){ + mPollution += aPollutionLevel; + for (final GT_MetaTileEntity_Hatch_Muffler tHatch : this.mMufflerHatches) { + if (isValidMetaTileEntity(tHatch)) { + if (mPollution < 10000) { + break; + } + if (!tHatch.polluteEnvironment()) { + continue; + } + mPollution -= 10000; + } + } + return mPollution < 10000; + } + else { + return false; + } + + } + } diff --git a/src/Java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/base/generators/GregtechDoubleFuelGeneratorBase.java b/src/Java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/base/generators/GregtechDoubleFuelGeneratorBase.java index 717616ff71..c499b38ce8 100644 --- a/src/Java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/base/generators/GregtechDoubleFuelGeneratorBase.java +++ b/src/Java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/base/generators/GregtechDoubleFuelGeneratorBase.java @@ -10,8 +10,8 @@ import gregtech.api.interfaces.tileentity.IGregTechTileEntity; import gregtech.api.util.GT_Recipe; import gregtech.api.util.GT_Recipe.GT_Recipe_Map; import gregtech.api.util.GT_Utility; +import gtPlusPlus.api.objects.Logger; import gtPlusPlus.core.lib.CORE; -import gtPlusPlus.core.util.Utils; import gtPlusPlus.xmod.gregtech.api.metatileentity.implementations.GT_MetaTileEntity_DeluxeTank; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.init.Blocks; @@ -70,10 +70,10 @@ public abstract class GregtechDoubleFuelGeneratorBase extends GT_MetaTileEntity_ @Override public boolean onRightclick(final IGregTechTileEntity aBaseMetaTileEntity, final EntityPlayer aPlayer) { if (aBaseMetaTileEntity.isClientSide()){ - Utils.LOG_WARNING("Entity is Client side, simply returning true"); + Logger.WARNING("Entity is Client side, simply returning true"); return true; } - Utils.LOG_WARNING("Entity is not Client side, opening entity Container and by extension, it's GUI, then returning true"); + Logger.WARNING("Entity is not Client side, opening entity Container and by extension, it's GUI, then returning true"); aBaseMetaTileEntity.openGUI(aPlayer); return true; } @@ -216,19 +216,19 @@ public abstract class GregtechDoubleFuelGeneratorBase extends GT_MetaTileEntity_ final int tFuelValue2 = this.getFuelValue(this.mFluid2), tConsumed2 = this.consumedFluidPerOperation(this.mFluid2); if (((tFuelValue > 0) && (tConsumed > 0) && (this.mFluid.amount > tConsumed))/* && (tFuelValue2 > 0 && tConsumed2 > 0 && mFluid2.amount > tConsumed2)*/) { - Utils.LOG_WARNING("tFuelValue: "+tFuelValue); - Utils.LOG_WARNING("tConsumed: "+tConsumed); - Utils.LOG_WARNING("mFluid.name: "+this.mFluid.getFluid().getName()); - Utils.LOG_WARNING("mFluid.amount: "+this.mFluid.amount); - Utils.LOG_WARNING("mFluid.amount > tConsumed: "+(this.mFluid.amount > tConsumed)); + Logger.WARNING("tFuelValue: "+tFuelValue); + Logger.WARNING("tConsumed: "+tConsumed); + Logger.WARNING("mFluid.name: "+this.mFluid.getFluid().getName()); + Logger.WARNING("mFluid.amount: "+this.mFluid.amount); + Logger.WARNING("mFluid.amount > tConsumed: "+(this.mFluid.amount > tConsumed)); - Utils.LOG_WARNING("========================================================="); + Logger.WARNING("========================================================="); - Utils.LOG_WARNING("tFuelValue2: "+tFuelValue2); - Utils.LOG_WARNING("tConsumed2: "+tConsumed2); - Utils.LOG_WARNING("mFluid2.name: "+this.mFluid2.getFluid().getName()); - Utils.LOG_WARNING("mFluid2.amount: "+this.mFluid2.amount); - Utils.LOG_WARNING("mFluid2.amount > tConsumed2: "+(this.mFluid2.amount > tConsumed2)); + Logger.WARNING("tFuelValue2: "+tFuelValue2); + Logger.WARNING("tConsumed2: "+tConsumed2); + Logger.WARNING("mFluid2.name: "+this.mFluid2.getFluid().getName()); + Logger.WARNING("mFluid2.amount: "+this.mFluid2.amount); + Logger.WARNING("mFluid2.amount > tConsumed2: "+(this.mFluid2.amount > tConsumed2)); long tFluidAmountToUse = Math.min(this.mFluid.amount / tConsumed, (((this.maxEUOutput() * 30) + this.getMinimumStoredEU()) - aBaseMetaTileEntity.getUniversalEnergyStored()) / tFuelValue); long tFluidAmountToUse2 = Math.min(this.mFluid2.amount / tConsumed2, (((this.maxEUOutput() * 30) + this.getMinimumStoredEU()) - aBaseMetaTileEntity.getUniversalEnergyStored()) / tFuelValue2); @@ -239,9 +239,9 @@ public abstract class GregtechDoubleFuelGeneratorBase extends GT_MetaTileEntity_ if (aBaseMetaTileEntity.getUniversalEnergyStored() <= (aBaseMetaTileEntity.getEUCapacity()-aBaseMetaTileEntity.getUniversalEnergyStored())){ tFluidAmountToUse = 1; - Utils.LOG_WARNING("========================================================="); - Utils.LOG_WARNING("tFluidAmountToUse - Updated: "+tFluidAmountToUse); - Utils.LOG_WARNING("========================================================="); + Logger.WARNING("========================================================="); + Logger.WARNING("tFluidAmountToUse - Updated: "+tFluidAmountToUse); + Logger.WARNING("========================================================="); } } @@ -251,15 +251,15 @@ public abstract class GregtechDoubleFuelGeneratorBase extends GT_MetaTileEntity_ }*/ if (aBaseMetaTileEntity.getUniversalEnergyStored() <= (aBaseMetaTileEntity.getEUCapacity()-aBaseMetaTileEntity.getUniversalEnergyStored())){ tFluidAmountToUse2 = 1; - Utils.LOG_WARNING("========================================================="); - Utils.LOG_WARNING("tFluidAmountToUse2 - Updated: "+tFluidAmountToUse2); - Utils.LOG_WARNING("========================================================="); + Logger.WARNING("========================================================="); + Logger.WARNING("tFluidAmountToUse2 - Updated: "+tFluidAmountToUse2); + Logger.WARNING("========================================================="); } } - Utils.LOG_WARNING("========================================================="); - Utils.LOG_WARNING("tFluidAmountToUse: "+tFluidAmountToUse); - Utils.LOG_WARNING("========================================================="); + Logger.WARNING("========================================================="); + Logger.WARNING("tFluidAmountToUse: "+tFluidAmountToUse); + Logger.WARNING("========================================================="); /*Utils.LOG_WARNING("mFluid.amount / tConsumed: "+("fluidAmount:"+mFluid.amount)+(" tConsumed:"+tConsumed)+" | "+(mFluid.amount / tConsumed)); Utils.LOG_WARNING("maxEUOutput() * 20 + getMinimumStoredEU(): "+(maxEUOutput() * 30 + getMinimumStoredEU())); @@ -272,9 +272,9 @@ public abstract class GregtechDoubleFuelGeneratorBase extends GT_MetaTileEntity_ Utils.LOG_WARNING("(maxEUOutput() * 20 + getMinimumStoredEU() - aBaseMetaTileEntity.getUniversalEnergyStored()) / tFuelValue): "+((maxEUOutput() * 30 + getMinimumStoredEU() - aBaseMetaTileEntity.getUniversalEnergyStored()) / tFuelValue)); */ - Utils.LOG_WARNING("========================================================="); - Utils.LOG_WARNING("tFluidAmountToUse2: "+tFluidAmountToUse2); - Utils.LOG_WARNING("========================================================="); + Logger.WARNING("========================================================="); + Logger.WARNING("tFluidAmountToUse2: "+tFluidAmountToUse2); + Logger.WARNING("========================================================="); /*Utils.LOG_WARNING("mFluid2.amount / tConsumed2: "+("fluidAmount2:"+mFluid2.amount)+(" tConsumed2:"+tConsumed2)+" | "+(mFluid2.amount / tConsumed2)); Utils.LOG_WARNING("maxEUOutput() * 20 + getMinimumStoredEU(): "+(maxEUOutput() * 30 + getMinimumStoredEU())); @@ -288,19 +288,19 @@ public abstract class GregtechDoubleFuelGeneratorBase extends GT_MetaTileEntity_ */ if (((tFluidAmountToUse > 0) && aBaseMetaTileEntity.increaseStoredEnergyUnits(tFluidAmountToUse * tFuelValue, true)) && ((tFluidAmountToUse2 > 0) && aBaseMetaTileEntity.increaseStoredEnergyUnits(tFluidAmountToUse2 * tFuelValue2, true))){ - Utils.LOG_WARNING("tFuelValue: "+tFuelValue); - Utils.LOG_WARNING("tConsumed: "+tConsumed); - Utils.LOG_WARNING("mFluid.name: "+this.mFluid.getFluid().getName()); - Utils.LOG_WARNING("mFluid.amount: "+this.mFluid.amount); - Utils.LOG_WARNING("mFluid.amount > tConsumed: "+(this.mFluid.amount > tConsumed)); + Logger.WARNING("tFuelValue: "+tFuelValue); + Logger.WARNING("tConsumed: "+tConsumed); + Logger.WARNING("mFluid.name: "+this.mFluid.getFluid().getName()); + Logger.WARNING("mFluid.amount: "+this.mFluid.amount); + Logger.WARNING("mFluid.amount > tConsumed: "+(this.mFluid.amount > tConsumed)); - Utils.LOG_WARNING("========================================================="); + Logger.WARNING("========================================================="); - Utils.LOG_WARNING("tFuelValue2: "+tFuelValue2); - Utils.LOG_WARNING("tConsumed2: "+tConsumed2); - Utils.LOG_WARNING("mFluid2.name: "+this.mFluid2.getFluid().getName()); - Utils.LOG_WARNING("mFluid2.amount: "+this.mFluid2.amount); - Utils.LOG_WARNING("mFluid2.amount > tConsumed2: "+(this.mFluid2.amount > tConsumed2)); + Logger.WARNING("tFuelValue2: "+tFuelValue2); + Logger.WARNING("tConsumed2: "+tConsumed2); + Logger.WARNING("mFluid2.name: "+this.mFluid2.getFluid().getName()); + Logger.WARNING("mFluid2.amount: "+this.mFluid2.amount); + Logger.WARNING("mFluid2.amount > tConsumed2: "+(this.mFluid2.amount > tConsumed2)); if (this.useFuel){ this.mFluid.amount -= tFluidAmountToUse * tConsumed; @@ -313,10 +313,10 @@ public abstract class GregtechDoubleFuelGeneratorBase extends GT_MetaTileEntity_ } else { - Utils.LOG_WARNING("========================================================="); - Utils.LOG_WARNING("Either tFluidAmountToUse1 <= 0, power cannot be increased of tFluidAmountToUse2 <= 0"); - Utils.LOG_WARNING("tFluidAmountToUse1: "+tFluidAmountToUse); - Utils.LOG_WARNING("tFluidAmountToUse2: "+tFluidAmountToUse2); + Logger.WARNING("========================================================="); + Logger.WARNING("Either tFluidAmountToUse1 <= 0, power cannot be increased of tFluidAmountToUse2 <= 0"); + Logger.WARNING("tFluidAmountToUse1: "+tFluidAmountToUse); + Logger.WARNING("tFluidAmountToUse2: "+tFluidAmountToUse2); } } else { @@ -335,12 +335,12 @@ public abstract class GregtechDoubleFuelGeneratorBase extends GT_MetaTileEntity_ } } else { - Utils.LOG_WARNING("One mFluid is null"); + Logger.WARNING("One mFluid is null"); if (this.mFluid != null) { - Utils.LOG_WARNING("mFluid1 is not null"); + Logger.WARNING("mFluid1 is not null"); } if (this.mFluid2 != null) { - Utils.LOG_WARNING("mFluid2 is not null"); + Logger.WARNING("mFluid2 is not null"); } } } diff --git a/src/Java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/base/machines/GregtechMetaSafeBlockBase.java b/src/Java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/base/machines/GregtechMetaSafeBlockBase.java index 289da38d53..058063a45f 100644 --- a/src/Java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/base/machines/GregtechMetaSafeBlockBase.java +++ b/src/Java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/base/machines/GregtechMetaSafeBlockBase.java @@ -10,7 +10,7 @@ import gregtech.api.interfaces.tileentity.IGregTechTileEntity; import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_TieredMachineBlock; import gregtech.api.objects.GT_RenderedTexture; import gregtech.api.util.GT_Utility; -import gtPlusPlus.core.util.Utils; +import gtPlusPlus.api.objects.Logger; import gtPlusPlus.core.util.player.PlayerCache; import gtPlusPlus.core.util.player.PlayerUtils; import net.minecraft.entity.player.EntityPlayer; @@ -201,35 +201,35 @@ public abstract class GregtechMetaSafeBlockBase extends GT_MetaTileEntity_Tiered }*/ //Utils.LOG_INFO("test"); if (this.ownerUUID == null){ - Utils.LOG_INFO("No owner yet for this block."); + Logger.INFO("No owner yet for this block."); } else { //Utils.LOG_INFO("test"); - Utils.LOG_INFO("Current Owner: "+PlayerCache.lookupPlayerByUUID(this.ownerUUID)+" - UUID: "+this.ownerUUID); + Logger.INFO("Current Owner: "+PlayerCache.lookupPlayerByUUID(this.ownerUUID)+" - UUID: "+this.ownerUUID); } - Utils.LOG_WARNING("Is ownerUUID Null"); + Logger.WARNING("Is ownerUUID Null"); if (this.ownerUUID == null){ - Utils.LOG_WARNING("OwnerUUID is Null, let's set it."); - Utils.LOG_WARNING("Accessing Players UUID is: "+tempUUID); + Logger.WARNING("OwnerUUID is Null, let's set it."); + Logger.WARNING("Accessing Players UUID is: "+tempUUID); this.ownerUUID = tempUUID; //Utils.messagePlayer(aPlayer, "Owner of this safe, now set. Try accessing it again."); - Utils.LOG_WARNING("Block Owner is now set to: "+this.ownerUUID); + Logger.WARNING("Block Owner is now set to: "+this.ownerUUID); } - Utils.LOG_WARNING("No, it is not."); - Utils.LOG_WARNING("Checking ownerUUID."); + Logger.WARNING("No, it is not."); + Logger.WARNING("Checking ownerUUID."); if (this.ownerUUID != null){ - Utils.LOG_WARNING("ownerUUID != Null, if accessor == owner."); - Utils.LOG_WARNING("Accessing is: "+PlayerCache.lookupPlayerByUUID(tempUUID)); + Logger.WARNING("ownerUUID != Null, if accessor == owner."); + Logger.WARNING("Accessing is: "+PlayerCache.lookupPlayerByUUID(tempUUID)); if (this.ownerUUID.equals(tempUUID)){ - Utils.LOG_WARNING("Owner's UUID: "+this.ownerUUID); + Logger.WARNING("Owner's UUID: "+this.ownerUUID); aBaseMetaTileEntity.openGUI(aPlayer); //Utils.LOG_WARNING("GUI should now be open for you sir."); } else { PlayerUtils.messagePlayer(aPlayer, "Access Denied, This does not belong to you."); PlayerUtils.messagePlayer(aPlayer, "it is owned by: "+PlayerCache.lookupPlayerByUUID(this.ownerUUID)); - Utils.LOG_WARNING("Expecting Player : "+PlayerCache.lookupPlayerByUUID(this.ownerUUID)); - Utils.LOG_ERROR("Access Denied."); + Logger.WARNING("Expecting Player : "+PlayerCache.lookupPlayerByUUID(this.ownerUUID)); + Logger.ERROR("Access Denied."); return true; } @@ -284,7 +284,7 @@ public abstract class GregtechMetaSafeBlockBase extends GT_MetaTileEntity_Tiered this.value_last = this.value_current; this.value_current = this.bUnbreakable; if (this.value_last != this.value_current){ - Utils.LOG_WARNING("VALUE CHANGE - Ticking for a moment."); + Logger.WARNING("VALUE CHANGE - Ticking for a moment."); if (this.bUnbreakable == true){ //Xasda.setmTileEntity((BaseMetaTileEntity) aBaseMetaTileEntity); //Utils.LOG_ERROR("Safe is Indestructible."); diff --git a/src/Java/gtPlusPlus/xmod/gregtech/api/world/GTPP_Worldgen_GT_Ore_Layer.java b/src/Java/gtPlusPlus/xmod/gregtech/api/world/GTPP_Worldgen_GT_Ore_Layer.java index 82048b17f7..d5ac473543 100644 --- a/src/Java/gtPlusPlus/xmod/gregtech/api/world/GTPP_Worldgen_GT_Ore_Layer.java +++ b/src/Java/gtPlusPlus/xmod/gregtech/api/world/GTPP_Worldgen_GT_Ore_Layer.java @@ -2,6 +2,11 @@ package gtPlusPlus.xmod.gregtech.api.world; import static gtPlusPlus.xmod.gregtech.HANDLER_GT.sCustomWorldgenFile; +import java.lang.reflect.InvocationTargetException; +import java.lang.reflect.Method; +import java.util.ArrayList; +import java.util.Random; + import gregtech.api.GregTech_API; import gregtech.api.enums.GT_Values; import gregtech.api.enums.Materials; @@ -13,11 +18,6 @@ import net.minecraft.util.MathHelper; import net.minecraft.world.World; import net.minecraft.world.chunk.IChunkProvider; -import java.lang.reflect.InvocationTargetException; -import java.lang.reflect.Method; -import java.util.ArrayList; -import java.util.Random; - public class GTPP_Worldgen_GT_Ore_Layer extends GTPP_Worldgen { public static ArrayList<GTPP_Worldgen_GT_Ore_Layer> sList = new ArrayList<GTPP_Worldgen_GT_Ore_Layer>(); @@ -83,6 +83,7 @@ extends GTPP_Worldgen { } } + @Override public boolean executeWorldgen(World aWorld, Random aRandom, String aBiome, int aDimensionType, int aChunkX, int aChunkZ, IChunkProvider aChunkGenerator, IChunkProvider aChunkProvider) { if (!this.mRestrictBiome.equals("None") && !(this.mRestrictBiome.equals(aBiome))) { return false; //Not the correct biome for ore mix |