diff options
Diffstat (limited to 'src/Java/gtPlusPlus/xmod/gregtech/common/tileentities')
28 files changed, 523 insertions, 195 deletions
diff --git a/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/automation/GT_MetaTileEntity_TesseractGenerator.java b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/automation/GT_MetaTileEntity_TesseractGenerator.java index 8f7539f268..c97723b042 100644 --- a/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/automation/GT_MetaTileEntity_TesseractGenerator.java +++ b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/automation/GT_MetaTileEntity_TesseractGenerator.java @@ -629,8 +629,7 @@ public class GT_MetaTileEntity_TesseractGenerator extends GT_MetaTileEntity_Basi "Generates a Tesseract for the attached Inventory", "Connect with pipes to insert items", "Consumes "+TESSERACT_ENERGY_COST+"EU/t for same dimension transfers", - "Consumes "+TESSERACT_ENERGY_COST_DIMENSIONAL+"EU/t for cross dimensional transfers", - CORE.GT_Tooltip }; + "Consumes "+TESSERACT_ENERGY_COST_DIMENSIONAL+"EU/t for cross dimensional transfers", }; } @Override diff --git a/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/automation/GT_MetaTileEntity_TesseractTerminal.java b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/automation/GT_MetaTileEntity_TesseractTerminal.java index f5cc4a0cd5..ed8b2db41f 100644 --- a/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/automation/GT_MetaTileEntity_TesseractTerminal.java +++ b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/automation/GT_MetaTileEntity_TesseractTerminal.java @@ -498,8 +498,7 @@ public class GT_MetaTileEntity_TesseractTerminal extends GT_MetaTileEntity_Basic "Connect with pipes to extract items or fluids", "Outputs from the back face", "Consumes "+TESSERACT_ENERGY_COST+"EU/t for same dimension transfers", - "Consumes "+TESSERACT_ENERGY_COST_DIMENSIONAL+"EU/t for cross dimensional transfers", - CORE.GT_Tooltip }; + "Consumes "+TESSERACT_ENERGY_COST_DIMENSIONAL+"EU/t for cross dimensional transfers", }; } @Override diff --git a/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/automation/GT_MetaTileEntity_ThreadedSuperBuffer.java b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/automation/GT_MetaTileEntity_ThreadedSuperBuffer.java index faefea6bba..282268fb3d 100644 --- a/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/automation/GT_MetaTileEntity_ThreadedSuperBuffer.java +++ b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/automation/GT_MetaTileEntity_ThreadedSuperBuffer.java @@ -1,6 +1,5 @@ package gtPlusPlus.xmod.gregtech.common.tileentities.automation; -import gtPlusPlus.core.lib.CORE; import gtPlusPlus.xmod.gregtech.api.gui.CONTAINER_ThreadedSuperBuffer; import gtPlusPlus.xmod.gregtech.api.gui.GUI_ThreadedSuperBuffer; import gtPlusPlus.xmod.gregtech.common.StaticFields59; @@ -22,7 +21,7 @@ public class GT_MetaTileEntity_ThreadedSuperBuffer extends GT_MetaTileEntity_Thr "Buffers up to 256 Item Stacks", "Use Screwdriver to regulate output stack size", "Consumes 1EU per moved Item", - CORE.GT_Tooltip}); + }); } public GT_MetaTileEntity_ThreadedSuperBuffer(final String aName, final int aTier, final int aInvSlotCount, diff --git a/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/generators/GT_MetaTileEntity_Boiler_Base.java b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/generators/GT_MetaTileEntity_Boiler_Base.java index 542c90d977..a0ca249aec 100644 --- a/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/generators/GT_MetaTileEntity_Boiler_Base.java +++ b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/generators/GT_MetaTileEntity_Boiler_Base.java @@ -53,7 +53,7 @@ public class GT_MetaTileEntity_Boiler_Base extends GT_MetaTileEntity_Boiler { return new String[]{ this.mDescription, "Consumes "+(mSteamPerSecond/160)+"L of water per second", - "Produces "+this.mPollutionPerSecond+" pollution/sec", CORE.GT_Tooltip}; + "Produces "+this.mPollutionPerSecond+" pollution/sec",}; } public ITexture getOverlayIcon() { diff --git a/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/generators/GT_MetaTileEntity_SemiFluidGenerator.java b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/generators/GT_MetaTileEntity_SemiFluidGenerator.java index 29c2eb963a..45a73f9e35 100644 --- a/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/generators/GT_MetaTileEntity_SemiFluidGenerator.java +++ b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/generators/GT_MetaTileEntity_SemiFluidGenerator.java @@ -68,7 +68,7 @@ public class GT_MetaTileEntity_SemiFluidGenerator extends GT_MetaTileEntity_Basi @Override public String[] getDescription() { - return new String[]{this.mDescription, "Produces "+(this.getPollution()*20)+" pollution/sec", "Fuel Efficiency: "+this.getEfficiency() + "%", CORE.GT_Tooltip}; + return new String[]{this.mDescription, "Produces "+(this.getPollution()*20)+" pollution/sec", "Fuel Efficiency: "+this.getEfficiency() + "%"}; } @Override diff --git a/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/generators/GregtechMetaTileEntityGeothermalGenerator.java b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/generators/GregtechMetaTileEntityGeothermalGenerator.java index 27a576da8a..5ebdbf0ef8 100644 --- a/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/generators/GregtechMetaTileEntityGeothermalGenerator.java +++ b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/generators/GregtechMetaTileEntityGeothermalGenerator.java @@ -38,7 +38,7 @@ extends GT_MetaTileEntity_BasicGenerator @Override public String[] getDescription() { - return new String[]{this.mDescription, "Generates power at " + this.getEfficiency() + "% Efficiency per tick", CORE.GT_Tooltip}; + return new String[]{this.mDescription, "Generates power at " + this.getEfficiency() + "% Efficiency per tick"}; } @Override diff --git a/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/generators/GregtechMetaTileEntity_RTG.java b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/generators/GregtechMetaTileEntity_RTG.java index 006d4b612c..f3fd95f0c1 100644 --- a/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/generators/GregtechMetaTileEntity_RTG.java +++ b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/generators/GregtechMetaTileEntity_RTG.java @@ -173,7 +173,7 @@ public class GregtechMetaTileEntity_RTG extends GT_MetaTileEntity_BasicGenerator "RTG changes output voltage depending on fuel", "Generates power at " + this.getEfficiency() + "% Efficiency per tick", "Output Voltage: "+this.getOutputTier()+" EU/t", - CORE.GT_Tooltip}; + }; } public GregtechMetaTileEntity_RTG(int aID, String aName, String aNameRegional, int aTier) { diff --git a/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/generators/creative/GregtechMetaCreativeEnergyBuffer.java b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/generators/creative/GregtechMetaCreativeEnergyBuffer.java index d557cbaa7d..1ee27afbf0 100644 --- a/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/generators/creative/GregtechMetaCreativeEnergyBuffer.java +++ b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/generators/creative/GregtechMetaCreativeEnergyBuffer.java @@ -9,7 +9,7 @@ import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.player.InventoryPlayer; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; - +import net.minecraft.util.EnumChatFormatting; import gregtech.api.enums.GT_Values; import gregtech.api.enums.Textures; import gregtech.api.interfaces.ITexture; @@ -48,7 +48,7 @@ public class GregtechMetaCreativeEnergyBuffer extends GregtechMetaEnergyBuffer { @Override public String[] getDescription() { - return new String[] {this.mDescription, "Use Screwdriver to change voltage", CORE.GT_Tooltip}; + return new String[] {this.mDescription, "Use Screwdriver to change voltage", EnumChatFormatting.GREEN+"CREATIVE MACHINE"}; } /* @@ -56,8 +56,8 @@ public class GregtechMetaCreativeEnergyBuffer extends GregtechMetaEnergyBuffer { */ @Override public ITexture[][][] getTextureSet(final ITexture[] aTextures) { - CustomIcon g = TexturesGtBlock.Casing_Material_RedSteel; - CustomIcon h = TexturesGtBlock.Casing_Material_Grisium; + CustomIcon h = TexturesGtBlock.Casing_Material_RedSteel; + CustomIcon g = TexturesGtBlock.Casing_Material_Grisium; CustomIcon k; boolean j = MathUtils.isNumberEven(this.mTier); final ITexture[][][] rTextures = new ITexture[2][17][]; diff --git a/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/basic/GT_MetaTileEntity_WorldAccelerator.java b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/basic/GT_MetaTileEntity_WorldAccelerator.java index e75106382a..129446c40d 100644 --- a/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/basic/GT_MetaTileEntity_WorldAccelerator.java +++ b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/basic/GT_MetaTileEntity_WorldAccelerator.java @@ -72,7 +72,7 @@ public class GT_MetaTileEntity_WorldAccelerator extends GT_MetaTileEntity_Tiered String.format("Accelerating things (Radius: %d EU/t: %d Speed Bonus: x%d)", mTier, getEnergyDemand(mTier, false), mAccelerateStatic[mTier]), "Use a screwdriver to change mode", "To accelerate TileEntities, this machine has to be adjacent to it", - "This machine accepts up to 8 Amps", "Accelerating TileEntities doubles Energy-Demand", CORE.GT_Tooltip}; + "This machine accepts up to 8 Amps", "Accelerating TileEntities doubles Energy-Demand"}; } 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 a55876ac35..022dcaaef2 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 @@ -2,19 +2,22 @@ package gtPlusPlus.xmod.gregtech.common.tileentities.machines.basic; import static gregtech.api.enums.GT_Values.V; +import gregtech.api.GregTech_API; +import gregtech.api.enums.Materials; import gregtech.api.enums.Textures; import gregtech.api.interfaces.ITexture; 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_BasicMachine; +import gregtech.api.objects.GT_ItemStack; import gregtech.api.objects.GT_RenderedTexture; import gregtech.api.util.GT_ModHandler; import gregtech.api.util.GT_Utility; import gregtech.common.items.GT_MetaGenerated_Tool_01; import gtPlusPlus.api.objects.Logger; +import gtPlusPlus.api.objects.data.AutoMap; import gtPlusPlus.core.item.general.ItemAirFilter; -import gtPlusPlus.core.lib.CORE; import gtPlusPlus.core.util.Utils; import gtPlusPlus.core.util.math.MathUtils; import gtPlusPlus.core.util.minecraft.PlayerUtils; @@ -26,10 +29,12 @@ import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.player.InventoryPlayer; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.world.World; +import net.minecraft.world.chunk.Chunk; public class GregtechMetaAtmosphericReconditioner extends GT_MetaTileEntity_BasicMachine { - protected int mPollutionReduction = 0; + public int mPollutionReduction = 0; protected int mBaseEff = 2500; protected int mOptimalAirFlow = 0; protected boolean mHasPollution = false; @@ -38,9 +43,6 @@ public class GregtechMetaAtmosphericReconditioner extends GT_MetaTileEntity_Basi protected boolean mSaveRotor = false; - private int mDamageFactorLow = 5; - private float mDamageFactorHigh = (float) 0.6000000238418579; - public GregtechMetaAtmosphericReconditioner(int aID, String aName, String aNameRegional, int aTier) { super(aID, aName, aNameRegional, aTier, 2, "Making sure you don't live in Gwalior - Uses 2A", 2, 0, "Recycler.png", "", new ITexture[]{ @@ -63,22 +65,31 @@ public class GregtechMetaAtmosphericReconditioner extends GT_MetaTileEntity_Basi super(aName, aTier, 2, aDescription, aTextures, 2, 0, aGUIName, aNEIName); }*/ + @SuppressWarnings("deprecation") @Override public MetaTileEntity newMetaEntity(IGregTechTileEntity aTileEntity) { return new GregtechMetaAtmosphericReconditioner(this.mName, this.mTier, this.mDescription, this.mTextures, this.mGUIName, this.mNEIName); } + @SuppressWarnings("deprecation") @Override public String[] getDescription() { + + boolean highTier = this.mTier >= 7; + + return new String[]{ this.mDescription, + highTier ? "Will attempt to remove 1/4 pollution from 8 surrounding chunks" : "", + highTier ? "If these chunks are not loaded, they will be ignored" : "", "Requires a turbine rotor and an Air Filter [T1/T2] to run.", "The turbine rotor must be manually inserted/replaced", - "Can be configured with a screwdriver to change modes", + "Can be configured with a soldering iron to change modes", "Low Efficiency: Removes half pollution, Turbine takes 50% dmg", "High Efficiency: Removes full pollution, Turbine takes 100% dmg", "Turbine Rotor will not break in LE mode", - CORE.GT_Tooltip}; + + }; } @Override @@ -97,7 +108,7 @@ public class GregtechMetaAtmosphericReconditioner extends GT_MetaTileEntity_Basi @Override public long maxAmperesIn() { - return 4; + return 2; } @Override @@ -129,42 +140,56 @@ public class GregtechMetaAtmosphericReconditioner extends GT_MetaTileEntity_Basi //Get Current Pollution Amount. int mCurrentPollution = getCurrentChunkPollution(); + boolean isIdle = true; //Get Inventory Item ItemStack stackRotor = this.mInventory[SLOT_ROTOR]; - ItemStack stackFilter = this.mInventory[SLOT_FILTER]; - - //Enable machine animation/graphic - if (this.mHasPollution && mCurrentPollution > 0 && hasRotor(stackRotor) && hasAirFilter(stackFilter)){ - aBaseMetaTileEntity.setActive(true); - } - else if (!this.mHasPollution || mCurrentPollution <= 0 || stackRotor == null || stackFilter == null || hasRotor(stackRotor) || !hasAirFilter(stackFilter)){ - aBaseMetaTileEntity.setActive(false); - } + ItemStack stackFilter = this.mInventory[SLOT_FILTER]; //Power Drain - long drainEU = V[mTier]; + long drainEU = maxEUInput() * maxAmperesIn(); if (aBaseMetaTileEntity.isActive() && aBaseMetaTileEntity.getStoredEU() >= drainEU){ if(aBaseMetaTileEntity.decreaseStoredEnergyUnits(drainEU, false)){ - //Utils.LOG_WARNING("Draining "+drainEU+" EU"); + isIdle = false; + } + else { + aBaseMetaTileEntity.setActive(false); + this.sendSound((byte) -122); } } else if (!aBaseMetaTileEntity.isActive() && aBaseMetaTileEntity.getStoredEU() >= drainEU/4){ if(aBaseMetaTileEntity.decreaseStoredEnergyUnits((drainEU/4), false)){ - //Utils.LOG_WARNING("Draining "+(drainEU/4)+" EU"); + isIdle = false; + } + else { + aBaseMetaTileEntity.setActive(false); + this.sendSound((byte) -122); } } else { aBaseMetaTileEntity.setActive(false); - } - - + this.sendSound((byte) -122); + } + //Only try once/sec. - if (aTick % 20L == 0L){ - + if (!isIdle && aTick % 20L == 0L){ + //Check if machine can work. if ((aBaseMetaTileEntity.isAllowedToWork())){ + //Enable machine animation/graphic + if (hasRotor(stackRotor) && hasAirFilter(stackFilter) && this.mHasPollution){ + if (!this.getBaseMetaTileEntity().isActive()) { + aBaseMetaTileEntity.setActive(true); + } + } + else if (!this.mHasPollution || mCurrentPollution <= 0 || stackRotor == null || stackFilter == null || !hasRotor(stackRotor) || !hasAirFilter(stackFilter)){ + if (!this.getBaseMetaTileEntity().isActive()) { + aBaseMetaTileEntity.setActive(false); + this.sendSound((byte) -122); + } + } + //If Active. if (aBaseMetaTileEntity.isActive()){ @@ -187,31 +212,35 @@ public class GregtechMetaAtmosphericReconditioner extends GT_MetaTileEntity_Basi Logger.WARNING("mOptimalAirFlow[1]:"+mOptimalAirFlow); //Calculate The Voltage we are running - long tVoltage = maxEUInput(); + long tVoltage = drainEU; byte tTier = (byte) Math.max(1, GT_Utility.getTier(tVoltage)); //Check Sides for Air, //More air means more pollution processing. int mAirSides = getFreeSpaces(); + int reduction = 0; + //If no sides are free, how will you process the atmosphere? if (mAirSides > 0){ - mPollutionReduction += (((mTier*2)*100)*mAirSides); //Was originally *100 - Logger.WARNING("mPollutionReduction[1]:"+mPollutionReduction); + reduction += (((Math.max((tTier-2), 1)*2)*50)*mAirSides); //Was originally *100 + Logger.WARNING("mPollutionReduction[1]:"+reduction); //I stole this code - mPollutionReduction = (MathUtils.safeInt((long)mPollutionReduction*this.mBaseEff)/100000)*mAirSides*tTier; - //Utils.LOG_WARNING("mPollutionReduction[2]:"+mPollutionReduction); - //mPollutionReduction = GT_Utility.safeInt((long)mPollutionReduction*this.mOptimalAirFlow/10000); - //Utils.LOG_WARNING("mPollutionReduction[3]:"+mPollutionReduction); + reduction = (MathUtils.safeInt((long)reduction*this.mBaseEff)/100000)*mAirSides*Math.max((tTier-2), 1); + Logger.WARNING("reduction[2]:"+reduction); + reduction = GT_Utility.safeInt(((long)reduction/100)*this.mOptimalAirFlow); + Logger.WARNING("reduction[3]:"+reduction); + mPollutionReduction = reduction; + //Set a temp to remove variable to aleviate duplicate code. int toRemove = 0; Logger.WARNING("mCurrentPollution[4]:"+mCurrentPollution); - if (mPollutionReduction <= mCurrentPollution){ + if (reduction <= mCurrentPollution){ //Clean some Air. - toRemove = mPollutionReduction; + toRemove = reduction; } else { //Makes sure we don't get negative pollution. @@ -236,22 +265,78 @@ public class GregtechMetaAtmosphericReconditioner extends GT_MetaTileEntity_Basi //Utils.LOG_WARNING("Wrong Tool metaitem Found."); } } - } + } + else if (!aBaseMetaTileEntity.isActive()) { + return; + } } //End of can work block. else { //Disable Machine. //aBaseMetaTileEntity.setActive(false); } } //End of 1/sec action block. + else { + + if (hasRotor(stackRotor) && hasAirFilter(stackFilter) && this.mHasPollution && !isIdle && aBaseMetaTileEntity.isAllowedToWork()){ + aBaseMetaTileEntity.setActive(true); + } + else if (isIdle || !this.mHasPollution || mCurrentPollution <= 0 || stackRotor == null || stackFilter == null || !hasRotor(stackRotor) || !hasAirFilter(stackFilter)){ + aBaseMetaTileEntity.setActive(false); + } + + } + if (this.getBaseMetaTileEntity().isActive()) { + if (MathUtils.randInt(0, 5) <= 2) { + this.sendSound((byte) -120); + } + } + } //End of is serverside block. } public int getCurrentChunkPollution(){ - return getCurrentChunkPollution(this.getBaseMetaTileEntity()); + int mCurrentChunkPollution = 0; + if (this.mTier < 7) { + mCurrentChunkPollution = PollutionUtils.getPollution(getBaseMetaTileEntity()); + } + else { + AutoMap<Chunk> aSurrounding = new AutoMap<Chunk>(); + World aWorld = this.getBaseMetaTileEntity().getWorld(); + int xPos = this.getBaseMetaTileEntity().getXCoord(); + int zPos = this.getBaseMetaTileEntity().getZCoord(); + Chunk a1 = aWorld.getChunkFromBlockCoords(xPos-32, zPos-32); + Chunk a2 = aWorld.getChunkFromBlockCoords(xPos-32, zPos); + Chunk a3 = aWorld.getChunkFromBlockCoords(xPos-32, zPos+32); + Chunk b1 = aWorld.getChunkFromBlockCoords(xPos, zPos-32); + Chunk b2 = aWorld.getChunkFromBlockCoords(xPos, zPos); + Chunk b3 = aWorld.getChunkFromBlockCoords(xPos, zPos+32); + Chunk c1 = aWorld.getChunkFromBlockCoords(xPos+32, zPos-32); + Chunk c2 = aWorld.getChunkFromBlockCoords(xPos+32, zPos); + Chunk c3 = aWorld.getChunkFromBlockCoords(xPos+32, zPos+32); + aSurrounding.put(a1); + aSurrounding.put(a2); + aSurrounding.put(a3); + aSurrounding.put(b1); + aSurrounding.put(b2); + aSurrounding.put(b3); + aSurrounding.put(c1); + aSurrounding.put(c2); + aSurrounding.put(c3); + for (Chunk r : aSurrounding) { + mCurrentChunkPollution += getPollutionInChunk(r); + } + } + if (mCurrentChunkPollution > 0){ + mHasPollution = true; + } + else { + mHasPollution = false; + } + return mCurrentChunkPollution; } - public int getCurrentChunkPollution(IGregTechTileEntity aBaseMetaTileEntity){ - int mCurrentChunkPollution = PollutionUtils.getPollution(aBaseMetaTileEntity); + public int getPollutionInChunk(Chunk aChunk){ + int mCurrentChunkPollution = PollutionUtils.getPollution(aChunk); if (mCurrentChunkPollution > 0){ mHasPollution = true; } @@ -260,7 +345,7 @@ public class GregtechMetaAtmosphericReconditioner extends GT_MetaTileEntity_Basi } return mCurrentChunkPollution; } - + public boolean hasRotor(ItemStack rotorStack){ if(rotorStack != null){ if (rotorStack.getItem() instanceof GT_MetaGenerated_Tool && rotorStack.getItemDamage() >= 170 && rotorStack.getItemDamage() <= 179){ @@ -272,6 +357,22 @@ public class GregtechMetaAtmosphericReconditioner extends GT_MetaTileEntity_Basi public boolean damageTurbineRotor(){ try{ + + boolean creativeRotor = false; + ItemStack rotorStack = this.mInventory[SLOT_ROTOR]; + if (rotorStack == null) { + return false; + } + else { + if(rotorStack.getItem() instanceof GT_MetaGenerated_Tool_01) { + Materials t1 = GT_MetaGenerated_Tool.getPrimaryMaterial(rotorStack); + Materials t2 = GT_MetaGenerated_Tool.getSecondaryMaterial(rotorStack); + if (t1 == Materials._NULL && t2 == Materials._NULL){ + creativeRotor = true; + } + } + } + if(mInventory[SLOT_ROTOR].getItem() instanceof GT_MetaGenerated_Tool_01 && ((GT_MetaGenerated_Tool) mInventory[SLOT_ROTOR].getItem()).getToolStats(mInventory[SLOT_ROTOR]).getSpeedMultiplier()>0 && GT_MetaGenerated_Tool.getPrimaryMaterial(mInventory[SLOT_ROTOR]).mToolSpeed>0 ) { @@ -280,16 +381,16 @@ 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.INFO("Trying to do "+damageValue+" damage to the rotor. ["+fDam+"]"); + //Logger.WARNING("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.INFO("Trying to do "+damageValue+" damage to the rotor. [2]");*/ + Logger.WARNING("Trying to do "+damageValue+" damage to the rotor. [2]");*/ //Damage Rotor //int rotorDurability = this.mInventory[this.SLOT_ROTOR].getItemDamage(); - long rotorDamage = GT_MetaGenerated_Tool.getToolDamage(this.mInventory[this.SLOT_ROTOR]); - long rotorDurabilityMax = GT_MetaGenerated_Tool.getToolMaxDamage(this.mInventory[this.SLOT_ROTOR]); + 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); if (rotorDurability >= damageValue){ @@ -297,6 +398,8 @@ public class GregtechMetaAtmosphericReconditioner extends GT_MetaTileEntity_Basi if (!mSaveRotor){ Logger.WARNING("Damaging Rotor."); + + if (!creativeRotor) GT_ModHandler.damageOrDechargeItem(this.mInventory[this.SLOT_ROTOR], (int) damageValue, 0, null); long tempDur = GT_MetaGenerated_Tool.getToolDamage(this.mInventory[this.SLOT_ROTOR]); @@ -310,6 +413,7 @@ public class GregtechMetaAtmosphericReconditioner extends GT_MetaTileEntity_Basi else { Logger.WARNING("Damaging Rotor."); if (rotorDurability > 1000){ + if (!creativeRotor) GT_ModHandler.damageOrDechargeItem(this.mInventory[this.SLOT_ROTOR], (int) damageValue/2, 0, null); long tempDur = GT_MetaGenerated_Tool.getToolDamage(this.mInventory[this.SLOT_ROTOR]); if (tempDur < rotorDurabilityMax){ @@ -324,7 +428,7 @@ public class GregtechMetaAtmosphericReconditioner extends GT_MetaTileEntity_Basi } - if (rotorDurability <= 0 && !mSaveRotor) { + if (rotorDurability <= 0 && !mSaveRotor && !creativeRotor) { Logger.WARNING("Destroying Rotor."); this.mInventory[this.SLOT_ROTOR] = null; return false; @@ -372,14 +476,92 @@ public class GregtechMetaAtmosphericReconditioner extends GT_MetaTileEntity_Basi } public boolean removePollution(int toRemove){ + + if (this == null || this.getBaseMetaTileEntity() == null || this.getBaseMetaTileEntity().getWorld() == null) { + return false; + } + + if (this.mTier < 7) { + int startPollution = getCurrentChunkPollution(); + PollutionUtils.removePollution(this.getBaseMetaTileEntity(), toRemove); + int after = getCurrentChunkPollution(); + return (after<startPollution); + } + else { + int chunksWithRemoval = 0; + int totalRemoved = 0; + AutoMap<Chunk> aSurrounding = new AutoMap<Chunk>(); + Chunk aThisChunk = this.getBaseMetaTileEntity().getWorld().getChunkFromBlockCoords(this.getBaseMetaTileEntity().getXCoord(), this.getBaseMetaTileEntity().getZCoord()); + int mainChunkX = aThisChunk.xPosition; + int mainChunkZ = aThisChunk.zPosition; + + World aWorld = this.getBaseMetaTileEntity().getWorld(); + int xPos = this.getBaseMetaTileEntity().getXCoord(); + int zPos = this.getBaseMetaTileEntity().getZCoord(); + + Chunk a1 = aWorld.getChunkFromBlockCoords(xPos-32, zPos-32); + Chunk a2 = aWorld.getChunkFromBlockCoords(xPos-32, zPos); + Chunk a3 = aWorld.getChunkFromBlockCoords(xPos-32, zPos+32); + Chunk b1 = aWorld.getChunkFromBlockCoords(xPos, zPos-32); + Chunk b2 = aWorld.getChunkFromBlockCoords(xPos, zPos); + Chunk b3 = aWorld.getChunkFromBlockCoords(xPos, zPos+32); + Chunk c1 = aWorld.getChunkFromBlockCoords(xPos+32, zPos-32); + Chunk c2 = aWorld.getChunkFromBlockCoords |
