From ae21012d216df71f31aed6fbc9d76215fc24ceed Mon Sep 17 00:00:00 2001 From: Draknyte1 Date: Sat, 4 Mar 2017 12:58:47 +1000 Subject: + New texture for the slow builders ring. + Added the Alkalus Disk. $ Fixed Frame Box Assembler Recipes. $ Fixed Missing 7Li material. $ Fixed Tiered Tanks not showing their capacity in the tooltip. $ Fixed tooltips for alloys containing Bronze or Steel. $ Fixed Clay Pipe Extruder Recipes. - Removed a handful of Plasma cells for misc. materials. % Changed the Industrial Coke Oven's tooltip, to better describe the input/output requirements. % Cleaned up The Entire Project. --- .../machines/multi/GregtechMTE_NuclearReactor.java | 233 ++++---- .../multi/GregtechMetaTileEntityAnimalFarm.java | 157 ++--- .../multi/GregtechMetaTileEntityTreeFarm.java | 404 ++++++------- .../GregtechMetaTileEntity_AlloyBlastSmelter.java | 405 +++++++------ ...regtechMetaTileEntity_IndustrialCentrifuge.java | 118 ++-- .../GregtechMetaTileEntity_IndustrialCokeOven.java | 406 ++++++------- ...gtechMetaTileEntity_IndustrialElectrolyzer.java | 255 ++++---- ...GregtechMetaTileEntity_IndustrialMacerator.java | 105 ++-- ...regtechMetaTileEntity_IndustrialPlatePress.java | 218 +++---- .../GregtechMetaTileEntity_IndustrialSinter.java | 115 ++-- .../GregtechMetaTileEntity_IndustrialWireMill.java | 139 +++-- .../GregtechMetaTileEntity_IronBlastFurnace.java | 660 ++++++++++----------- .../GregtechMetaTileEntity_MassFabricator.java | 131 ++-- .../multi/GregtechMetaTileEntity_MultiTank.java | 328 +++++----- ...chMetaTileEntity_PowerSubStationController.java | 82 +-- .../multi/GregtechMetaTileEntity_Refinery.java | 193 +++--- 16 files changed, 1982 insertions(+), 1967 deletions(-) (limited to 'src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi') diff --git a/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/GregtechMTE_NuclearReactor.java b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/GregtechMTE_NuclearReactor.java index 9b11e82dbd..33bfbc2f1f 100644 --- a/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/GregtechMTE_NuclearReactor.java +++ b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/GregtechMTE_NuclearReactor.java @@ -1,5 +1,8 @@ package gtPlusPlus.xmod.gregtech.common.tileentities.machines.multi; +import java.util.ArrayList; +import java.util.Collection; + import gregtech.api.enums.Materials; import gregtech.api.enums.Textures; import gregtech.api.interfaces.ITexture; @@ -19,10 +22,6 @@ import gtPlusPlus.core.material.nuclear.NUCLIDE; import gtPlusPlus.core.util.Utils; import gtPlusPlus.core.util.math.MathUtils; import gtPlusPlus.xmod.gregtech.api.gui.GUI_MultiMachine; - -import java.util.ArrayList; -import java.util.Collection; - import net.minecraft.entity.player.InventoryPlayer; import net.minecraft.item.ItemStack; import net.minecraftforge.common.util.ForgeDirection; @@ -42,17 +41,17 @@ public class GregtechMTE_NuclearReactor extends GT_MetaTileEntity_MultiBlockBase //public FluidStack mFluidOut = Materials.UUMatter.getFluid(1L); - public GregtechMTE_NuclearReactor(int aID, String aName, String aNameRegional) { + public GregtechMTE_NuclearReactor(final int aID, final String aName, final String aNameRegional) { super(aID, aName, aNameRegional); } - public GregtechMTE_NuclearReactor(String aName) { + public GregtechMTE_NuclearReactor(final String aName) { super(aName); } @Override public long maxEUStore() { - return 640000000L * (Math.min(16, this.mEnergyHatches.size())) / 16L; + return (640000000L * (Math.min(16, this.mEnergyHatches.size()))) / 16L; } @Override @@ -74,20 +73,20 @@ public class GregtechMTE_NuclearReactor extends GT_MetaTileEntity_MultiBlockBase @Override public String[] getInfoData() { - String tRunning = (mMaxProgresstime>0 ? "Reactor running":"Reactor stopped"); - String tMaintainance = (getIdealStatus() == getRepairStatus() ? "No Maintainance issues" : "Needs Maintainance"); + final String tRunning = (this.mMaxProgresstime>0 ? "Reactor running":"Reactor stopped"); + final String tMaintainance = (this.getIdealStatus() == this.getRepairStatus() ? "No Maintainance issues" : "Needs Maintainance"); return new String[]{ "Liquid Fluoride Thorium Reactor", tRunning, tMaintainance, - "Current Output: "+(mEUt*mEfficiency/10000)+" EU/t", - "Fuel Consumption: "+fuelConsumption+"L/t", - "Fuel Value: "+fuelValue+" EU/L", - "Fuel Remaining: "+fuelRemaining+" Litres", - "Current Efficiency: "+(mEfficiency/100)+"%", - "Optimal Fuel Flow: "+(int)realOptFlow+" L/t", - "Current Speed: "+(mEfficiency/100)+"%",}; + "Current Output: "+((this.mEUt*this.mEfficiency)/10000)+" EU/t", + "Fuel Consumption: "+this.fuelConsumption+"L/t", + "Fuel Value: "+this.fuelValue+" EU/L", + "Fuel Remaining: "+this.fuelRemaining+" Litres", + "Current Efficiency: "+(this.mEfficiency/100)+"%", + "Optimal Fuel Flow: "+(int)this.realOptFlow+" L/t", + "Current Speed: "+(this.mEfficiency/100)+"%",}; } @Override @@ -96,12 +95,12 @@ public class GregtechMTE_NuclearReactor extends GT_MetaTileEntity_MultiBlockBase } @Override - public boolean allowCoverOnSide(byte aSide, GT_ItemStack aStack) { - return aSide != getBaseMetaTileEntity().getFrontFacing(); + public boolean allowCoverOnSide(final byte aSide, final GT_ItemStack aStack) { + return aSide != this.getBaseMetaTileEntity().getFrontFacing(); } @Override - public ITexture[] getTexture(IGregTechTileEntity aBaseMetaTileEntity, byte aSide, byte aFacing, byte aColorIndex, boolean aActive, boolean aRedstone) { + public ITexture[] getTexture(final IGregTechTileEntity aBaseMetaTileEntity, final byte aSide, final byte aFacing, final byte aColorIndex, final boolean aActive, final boolean aRedstone) { if (aSide == aFacing) { return new ITexture[]{Textures.BlockIcons.CASING_BLOCKS[70], new GT_RenderedTexture(aActive ? Textures.BlockIcons.OVERLAY_FRONT_REPLICATOR_ACTIVE : Textures.BlockIcons.OVERLAY_FRONT_REPLICATOR)}; @@ -110,12 +109,12 @@ public class GregtechMTE_NuclearReactor extends GT_MetaTileEntity_MultiBlockBase } @Override - public Object getClientGUI(int aID, InventoryPlayer aPlayerInventory, IGregTechTileEntity aBaseMetaTileEntity) { - return new GUI_MultiMachine(aPlayerInventory, aBaseMetaTileEntity, getLocalName(), "MatterFabricator.png"); + public Object getClientGUI(final int aID, final InventoryPlayer aPlayerInventory, final IGregTechTileEntity aBaseMetaTileEntity) { + return new GUI_MultiMachine(aPlayerInventory, aBaseMetaTileEntity, this.getLocalName(), "MatterFabricator.png"); } @Override - public boolean checkMachine(IGregTechTileEntity aBaseMetaTileEntity, ItemStack aStack) { + public boolean checkMachine(final IGregTechTileEntity aBaseMetaTileEntity, final ItemStack aStack) { // Life Lessons from Greg. /** @@ -135,22 +134,22 @@ public class GregtechMTE_NuclearReactor extends GT_MetaTileEntity_MultiBlockBase [23:46:06] Noted, thanks :D */ - int xDir = ForgeDirection.getOrientation(aBaseMetaTileEntity.getBackFacing()).offsetX * 3; - int zDir = ForgeDirection.getOrientation(aBaseMetaTileEntity.getBackFacing()).offsetZ * 3; + final int xDir = ForgeDirection.getOrientation(aBaseMetaTileEntity.getBackFacing()).offsetX * 3; + final int zDir = ForgeDirection.getOrientation(aBaseMetaTileEntity.getBackFacing()).offsetZ * 3; for (int i = -3; i <= 3; i++) { for (int j = -3; j <= 3; j++) { for (int h = 0; h < 4; h++) { - IGregTechTileEntity tTileEntity = aBaseMetaTileEntity.getIGregTechTileEntityOffset(xDir + i, h, zDir + j); + final IGregTechTileEntity tTileEntity = aBaseMetaTileEntity.getIGregTechTileEntityOffset(xDir + i, h, zDir + j); // Reactor Floor/Roof inner 5x5 - if ((i != -3 && i != 3) && (j != -3 && j != 3)) { + if (((i != -3) && (i != 3)) && ((j != -3) && (j != 3))) { // Reactor Floor & Roof (Inner 5x5) + Mufflers, Dynamos and Fluid outputs. - if (h == 0 || h == 3) { + if ((h == 0) || (h == 3)) { //If not a hatch, continue, else add hatch and continue. - if ((!addMufflerToMachineList(tTileEntity, 70)) && (!addOutputToMachineList(tTileEntity, 70)) && (!addDynamoToMachineList(tTileEntity, 70))) { + if ((!this.addMufflerToMachineList(tTileEntity, 70)) && (!this.addOutputToMachineList(tTileEntity, 70)) && (!this.addDynamoToMachineList(tTileEntity, 70))) { if (aBaseMetaTileEntity.getBlockOffset(xDir + i, h, zDir + j) != ModBlocks.blockCasingsMisc) { Utils.LOG_INFO("LFTR Casing(s) Missing from one of the top layers inner 3x3."); Utils.LOG_INFO("Instead, found "+aBaseMetaTileEntity.getBlockOffset(xDir + i, h, zDir + j).getLocalizedName()); @@ -160,16 +159,16 @@ public class GregtechMTE_NuclearReactor extends GT_MetaTileEntity_MultiBlockBase Utils.LOG_INFO("LFTR Casing(s) Missing from one of the top layers inner 3x3. Wrong Meta for Casing."); return false; } - } - } + } + } // Inside 2 layers, mostly air - else { + else { // Reactor Inner 5x5 //if ((i != -1 && i != 1) && (j != -1 && j != 1)) { if (!aBaseMetaTileEntity.getAirOffset(xDir + i, h, zDir + j)) { - Utils.LOG_INFO("Make sure the inner 3x3 of the Multiblock is Air."); + Utils.LOG_INFO("Make sure the inner 3x3 of the Multiblock is Air."); return false; } @@ -187,7 +186,7 @@ public class GregtechMTE_NuclearReactor extends GT_MetaTileEntity_MultiBlockBase Utils.LOG_INFO("LFTR Casing(s) Missing from one of the top layers inner 3x3."); return false; } - }*/ + }*/ } @@ -195,7 +194,7 @@ public class GregtechMTE_NuclearReactor extends GT_MetaTileEntity_MultiBlockBase else { //Deal with all 4 sides (Reactor walls) - if (h == 1 || h == 2) { + if ((h == 1) || (h == 2)) { if (aBaseMetaTileEntity.getBlockOffset(xDir + i, h, zDir + j) != ModBlocks.blockCasingsMisc) { Utils.LOG_INFO("Glass Casings Missing from somewhere in the second layer."); Utils.LOG_INFO("Instead, found "+aBaseMetaTileEntity.getBlockOffset(xDir + i, h, zDir + j).getLocalizedName()); @@ -205,13 +204,13 @@ public class GregtechMTE_NuclearReactor extends GT_MetaTileEntity_MultiBlockBase Utils.LOG_INFO("Glass Casings Missing from somewhere in the second layer."); Utils.LOG_INFO("Instead, found "+aBaseMetaTileEntity.getBlockOffset(xDir + i, h, zDir + j).getLocalizedName()); return false; - } + } } //Deal with top and Bottom edges (Inner 5x5) - else if (h == 0 || h == 3) { - if ((!addToMachineList(tTileEntity, 70)) && (!addInputToMachineList(tTileEntity, 70)) && (!addOutputToMachineList(tTileEntity, 70)) && (!addDynamoToMachineList(tTileEntity, 70))) { - if ((xDir + i != 0) || (zDir + j != 0)) {//no controller + else if ((h == 0) || (h == 3)) { + if ((!this.addToMachineList(tTileEntity, 70)) && (!this.addInputToMachineList(tTileEntity, 70)) && (!this.addOutputToMachineList(tTileEntity, 70)) && (!this.addDynamoToMachineList(tTileEntity, 70))) { + if (((xDir + i) != 0) || ((zDir + j) != 0)) {//no controller if (aBaseMetaTileEntity.getBlockOffset(xDir + i, h, zDir + j) != ModBlocks.blockCasingsMisc) { Utils.LOG_INFO("LFTR Casing(s) Missing from one of the edges on the top layer."); @@ -254,7 +253,7 @@ public class GregtechMTE_NuclearReactor extends GT_MetaTileEntity_MultiBlockBase if (this.mOutputHatches != null) { for (int i = 0; i < this.mOutputHatches.size(); i++) { - if (this.mOutputHatches.get(i).mTier < 5 && (this.mOutputHatches.get(i).getBaseMetaTileEntity() instanceof GregtechMTE_NuclearReactor)){ + if ((this.mOutputHatches.get(i).mTier < 5) && (this.mOutputHatches.get(i).getBaseMetaTileEntity() instanceof GregtechMTE_NuclearReactor)){ Utils.LOG_INFO("You require at LEAST V tier Output Hatches."); Utils.LOG_INFO(this.mOutputHatches.get(i).getBaseMetaTileEntity().getXCoord()+","+this.mOutputHatches.get(i).getBaseMetaTileEntity().getYCoord()+","+this.mOutputHatches.get(i).getBaseMetaTileEntity().getZCoord()); Utils.LOG_INFO(this.mOutputHatches.get(i).getBaseMetaTileEntity().getInventoryName()); @@ -272,79 +271,79 @@ public class GregtechMTE_NuclearReactor extends GT_MetaTileEntity_MultiBlockBase } } } - mWrench = true; - mScrewdriver = true; - mSoftHammer = true; - mHardHammer = true; - mSolderingTool = true; - mCrowbar = true; - turnCasingActive(true); + this.mWrench = true; + this.mScrewdriver = true; + this.mSoftHammer = true; + this.mHardHammer = true; + this.mSolderingTool = true; + this.mCrowbar = true; + this.turnCasingActive(true); Utils.LOG_INFO("Multiblock Formed."); return true; } @Override - public boolean isCorrectMachinePart(ItemStack aStack) { + public boolean isCorrectMachinePart(final ItemStack aStack) { return true; } @Override - public int getMaxEfficiency(ItemStack aStack) { - return boostEu ? 30000 : 10000; + public int getMaxEfficiency(final ItemStack aStack) { + return this.boostEu ? 30000 : 10000; } @Override - public int getPollutionPerTick(ItemStack aStack) { + public int getPollutionPerTick(final ItemStack aStack) { return 5; } @Override - public int getDamageToComponent(ItemStack aStack) { + public int getDamageToComponent(final ItemStack aStack) { return 0; } @Override - public boolean explodesOnComponentBreak(ItemStack aStack) { + public boolean explodesOnComponentBreak(final ItemStack aStack) { return true; } @Override - public IMetaTileEntity newMetaEntity(IGregTechTileEntity aTileEntity) { + public IMetaTileEntity newMetaEntity(final IGregTechTileEntity aTileEntity) { return new GregtechMTE_NuclearReactor(this.mName); } - public static int overclock(int mStartEnergy) { + public static int overclock(final int mStartEnergy) { return mStartEnergy < 160000000 ? 4 : mStartEnergy < 320000000 ? 2 : 1; } - public boolean turnCasingActive(boolean status) { + public boolean turnCasingActive(final boolean status) { if (this.mDynamoHatches != null) { - for (GT_MetaTileEntity_Hatch_Dynamo hatch : this.mDynamoHatches) { + for (final GT_MetaTileEntity_Hatch_Dynamo hatch : this.mDynamoHatches) { hatch.mMachineBlock = status ? (byte) 70 : (byte) 71; } } if (this.mMufflerHatches != null) { - for (GT_MetaTileEntity_Hatch_Muffler hatch : this.mMufflerHatches) { + for (final GT_MetaTileEntity_Hatch_Muffler hatch : this.mMufflerHatches) { hatch.mMachineBlock = status ? (byte) 70 : (byte) 71; } } if (this.mOutputHatches != null) { - for (GT_MetaTileEntity_Hatch_Output hatch : this.mOutputHatches) { + for (final GT_MetaTileEntity_Hatch_Output hatch : this.mOutputHatches) { hatch.mMachineBlock = status ? (byte) 70 : (byte) 71; } } if (this.mInputHatches != null) { - for (GT_MetaTileEntity_Hatch_Input hatch : this.mInputHatches) { + for (final GT_MetaTileEntity_Hatch_Input hatch : this.mInputHatches) { hatch.mMachineBlock = status ? (byte) 70 : (byte) 71; } } if (this.mOutputBusses != null) { - for (GT_MetaTileEntity_Hatch_OutputBus hatch : this.mOutputBusses) { + for (final GT_MetaTileEntity_Hatch_OutputBus hatch : this.mOutputBusses) { hatch.mMachineBlock = status ? (byte) 70 : (byte) 71; } } if (this.mInputBusses != null) { - for (GT_MetaTileEntity_Hatch_InputBus hatch : this.mInputBusses) { + for (final GT_MetaTileEntity_Hatch_InputBus hatch : this.mInputBusses) { hatch.mMachineBlock = status ? (byte) 70 : (byte) 71; } } @@ -354,107 +353,107 @@ public class GregtechMTE_NuclearReactor extends GT_MetaTileEntity_MultiBlockBase @Override - public boolean checkRecipe(ItemStack aStack) { - ArrayList tFluids = getStoredFluids(); - Collection tRecipeList = Recipe_GT.Gregtech_Recipe_Map.sLiquidFluorineThoriumReactorRecipes.mRecipeList; - if(tFluids.size() > 0 && tRecipeList != null) { //Does input hatch have a LFTR fuel? + public boolean checkRecipe(final ItemStack aStack) { + final ArrayList tFluids = this.getStoredFluids(); + final Collection tRecipeList = Recipe_GT.Gregtech_Recipe_Map.sLiquidFluorineThoriumReactorRecipes.mRecipeList; + if((tFluids.size() > 0) && (tRecipeList != null)) { //Does input hatch have a LFTR fuel? Utils.LOG_INFO("Found more than one input fluid and a list of valid recipes."); - boolean containsFLIBE = false; - boolean containsPrimarySalt = false; - for (FluidStack hatchFluid1 : tFluids) { //Loops through hatches + final boolean containsFLIBE = false; + final boolean containsPrimarySalt = false; + for (final FluidStack hatchFluid1 : tFluids) { //Loops through hatches Utils.LOG_INFO("Looping through Input hatches - Found "+hatchFluid1.getLocalizedName()); - for(GT_Recipe aFuel : tRecipeList) { //Loops through LFTR fuel recipes + for(final GT_Recipe aFuel : tRecipeList) { //Loops through LFTR fuel recipes Utils.LOG_INFO("Looping through Recipes. "+aFuel.mSpecialValue); - FluidStack tLiquid; - FluidStack testStack = aFuel.mFluidInputs[1]; + FluidStack tLiquid; + final FluidStack testStack = aFuel.mFluidInputs[1]; if ((tLiquid = testStack) != null) { //Create fluidstack from current recipe Utils.LOG_INFO("Creating a fluidstack from the current recipe"); if (hatchFluid1.isFluidEqual(tLiquid)) { //Has a LFTR fluid - fuelConsumption = tLiquid.amount = boostEu ? (aFuel.mSpecialValue/4096) : (aFuel.mSpecialValue/2048); //Calc fuel consumption - Utils.LOG_INFO("Input hatch contains some FLiBe Fuel, using "+fuelConsumption); - if(depleteInput(tLiquid)) { //Deplete that amount + this.fuelConsumption = tLiquid.amount = this.boostEu ? (aFuel.mSpecialValue/4096) : (aFuel.mSpecialValue/2048); //Calc fuel consumption + Utils.LOG_INFO("Input hatch contains some FLiBe Fuel, using "+this.fuelConsumption); + if(this.depleteInput(tLiquid)) { //Deplete that amount Utils.LOG_INFO("Depleted some FLiBe fluid"); this.mMaxProgresstime = 500; - + if(tFluids.contains(NUCLIDE.LiFBeF2ThF4UF4.getFluid(1)) || tFluids.contains(NUCLIDE.LiFBeF2ZrF4UF4.getFluid(2)) || tFluids.contains(NUCLIDE.LiFBeF2ZrF4U235.getFluid(10))) { //Has a Primary fuel salt? //Deplete Primary Salt. 1000L should = 1 hour of runtime (if baseEU = 2048) && using 1l each time - if(mRuntime % 72 == 0 || mRuntime == 0){ + if(((this.mRuntime % 72) == 0) || (this.mRuntime == 0)){ //U235 fuel is 10x less efficient than UF4 with Thorium, UF4 with Zirconium is only 2x less efficient than UF4 with Thorium. //Most Efficient if(tFluids.contains(NUCLIDE.LiFBeF2ThF4UF4.getFluid(2))){ - depleteInput(NUCLIDE.LiFBeF2ThF4UF4.getFluid(boostEu ? 2 : 1)); - Utils.LOG_INFO("Depleted "+(boostEu ? 2 : 1)+"L of LiFBeF2ThF4UF4 fluid"); + this.depleteInput(NUCLIDE.LiFBeF2ThF4UF4.getFluid(this.boostEu ? 2 : 1)); + Utils.LOG_INFO("Depleted "+(this.boostEu ? 2 : 1)+"L of LiFBeF2ThF4UF4 fluid"); } //1/2 as Efficient if (tFluids.contains(NUCLIDE.LiFBeF2ZrF4UF4.getFluid(4))){ - depleteInput(NUCLIDE.LiFBeF2ZrF4UF4.getFluid(boostEu ? 4 : 2)); - Utils.LOG_INFO("Depleted "+(boostEu ? 4 : 2)+"L of LiFBeF2ZrF4UF4 fluid"); + this.depleteInput(NUCLIDE.LiFBeF2ZrF4UF4.getFluid(this.boostEu ? 4 : 2)); + Utils.LOG_INFO("Depleted "+(this.boostEu ? 4 : 2)+"L of LiFBeF2ZrF4UF4 fluid"); } //10x less Efficient. - if (tFluids.contains(NUCLIDE.LiFBeF2ZrF4U235.getFluid(20))) { - depleteInput(NUCLIDE.LiFBeF2ZrF4U235.getFluid(boostEu ? 20 : 10)); - Utils.LOG_INFO("Depleted "+(boostEu ? 20 : 10)+"L of LiFBeF2ZrF4U235 fluid"); + if (tFluids.contains(NUCLIDE.LiFBeF2ZrF4U235.getFluid(20))) { + this.depleteInput(NUCLIDE.LiFBeF2ZrF4U235.getFluid(this.boostEu ? 20 : 10)); + Utils.LOG_INFO("Depleted "+(this.boostEu ? 20 : 10)+"L of LiFBeF2ZrF4U235 fluid"); } } } else { return false; } - + //Try Sparge Noble Gases - if (depleteInput(Materials.Helium.getGas(1000L)) && heliumSparging){ + if (this.depleteInput(Materials.Helium.getGas(1000L)) && this.heliumSparging){ //Make an empty fluid stack for possible sparging output FluidStack[] spargeOutput = new FluidStack[]{}; Utils.LOG_INFO("Doing a Sparge with Helium"); - spargeOutput = getByproductsOfSparge(Materials.Helium.getGas(1000L)); - heliumSparging = false; + spargeOutput = this.getByproductsOfSparge(Materials.Helium.getGas(1000L)); + this.heliumSparging = false; //If Sparging occurred, try add the outputs to the output hatches. try { - if (spargeOutput.length >= 1){ - for (FluidStack F : spargeOutput){ - Utils.LOG_INFO("Adding Sparge Output - "+F.getLocalizedName()); - addOutput(F); + if (spargeOutput.length >= 1){ + for (final FluidStack F : spargeOutput){ + Utils.LOG_INFO("Adding Sparge Output - "+F.getLocalizedName()); + this.addOutput(F); + } } - } - } catch (Throwable T){} + } catch (final Throwable T){} } - + //Try Sparge Fluorides - if (depleteInput(Materials.Fluorine.getGas(100L)) && !heliumSparging){ + if (this.depleteInput(Materials.Fluorine.getGas(100L)) && !this.heliumSparging){ //Make an empty fluid stack for possible sparging output FluidStack[] spargeOutput = new FluidStack[]{}; Utils.LOG_INFO("Doing a Sparge with Fluorine"); - spargeOutput = getByproductsOfSparge(Materials.Fluorine.getGas(100L)); - heliumSparging = true; + spargeOutput = this.getByproductsOfSparge(Materials.Fluorine.getGas(100L)); + this.heliumSparging = true; //If Sparging occurred, try add the outputs to the output hatches. if (spargeOutput.length > 0){ - for (FluidStack F : spargeOutput){ + for (final FluidStack F : spargeOutput){ Utils.LOG_INFO("Adding Sparge Output - "+F.getLocalizedName()); - addOutput(F); + this.addOutput(F); } } } - + if (aFuel != null){ Utils.LOG_INFO("Saving previous Recipe."); - this.mLastRecipe = aFuel; + this.mLastRecipe = aFuel; } - - fuelValue = aFuel.mSpecialValue; - fuelRemaining = hatchFluid1.amount; //Record available fuel - + + this.fuelValue = aFuel.mSpecialValue; + this.fuelRemaining = hatchFluid1.amount; //Record available fuel + if (this.mEfficiency < 500){ this.mEfficiency++; } - - this.mEUt = (mEfficiency < 500 ? 2048 : (8196*4)); //Output 0 if startup is less than 20% + + this.mEUt = (this.mEfficiency < 500 ? 2048 : (8196*4)); //Output 0 if startup is less than 20% Utils.LOG_INFO("Generating "+this.mEUt+"EU/t @ an efficiency level of "+this.mEfficiency); - + this.mProgresstime = 1; this.mMaxProgresstime = 1; this.mEfficiencyIncrease = 15; @@ -522,18 +521,18 @@ public class GregtechMTE_NuclearReactor extends GT_MetaTileEntity_MultiBlockBase } - protected FluidStack[] getByproductsOfSparge(FluidStack spargeGas){ + protected FluidStack[] getByproductsOfSparge(final FluidStack spargeGas){ FluidStack[] outputArrayOfGases = new FluidStack[]{}; if (spargeGas != null){ if (spargeGas.isFluidEqual(Materials.Helium.getGas(1000))){ - int outputChances[] = { + final int outputChances[] = { MathUtils.roundToClosestInt(MathUtils.randInt(10, 1000)/10), MathUtils.roundToClosestInt(MathUtils.randInt(10, 600)/10), MathUtils.roundToClosestInt(MathUtils.randInt(10, 400)/10), MathUtils.roundToClosestInt(MathUtils.randInt(10, 1000)/10), - MathUtils.roundToClosestInt(MathUtils.randInt(10, 100)/10) + MathUtils.roundToClosestInt(MathUtils.randInt(10, 100)/10) }; - int heliumContent = (1000-outputChances[0]-outputChances[1]-outputChances[2]-outputChances[3]-outputChances[4]); + final int heliumContent = (1000-outputChances[0]-outputChances[1]-outputChances[2]-outputChances[3]-outputChances[4]); Utils.LOG_INFO("Helium remaining: "+heliumContent); outputArrayOfGases = new FluidStack[]{ ELEMENT.getInstance().XENON.getFluid(outputChances[0]), @@ -541,24 +540,24 @@ public class GregtechMTE_NuclearReactor extends GT_MetaTileEntity_MultiBlockBase ELEMENT.getInstance().ARGON.getFluid(outputChances[2]), ELEMENT.getInstance().KRYPTON.getFluid(outputChances[3]), ELEMENT.getInstance().RADON.getFluid(outputChances[4]), - Materials.Helium.getGas(heliumContent) + Materials.Helium.getGas(heliumContent) }; } else if (spargeGas.isFluidEqual(Materials.Fluorine.getGas(100))){ - int outputChances[] = { + final int outputChances[] = { MathUtils.roundToClosestInt(MathUtils.randDouble(10, 100)), MathUtils.roundToClosestInt(MathUtils.randDouble(1, 50)/10), MathUtils.roundToClosestInt(MathUtils.randDouble(1, 50)/10), - MathUtils.roundToClosestInt(MathUtils.randDouble(1, 50)/10) + MathUtils.roundToClosestInt(MathUtils.randDouble(1, 50)/10) }; - int fluorineContent = (100-outputChances[0]-outputChances[1]-outputChances[2]-outputChances[3]); + final int fluorineContent = (100-outputChances[0]-outputChances[1]-outputChances[2]-outputChances[3]); Utils.LOG_INFO("Fluorine remaining: "+fluorineContent); outputArrayOfGases = new FluidStack[]{ FLUORIDES.URANIUM_HEXAFLUORIDE.getFluid(outputChances[0]), FLUORIDES.NEPTUNIUM_HEXAFLUORIDE.getFluid(outputChances[1]), FLUORIDES.TECHNETIUM_HEXAFLUORIDE.getFluid(outputChances[2]), FLUORIDES.SELENIUM_HEXAFLUORIDE.getFluid(outputChances[3]), - Materials.Fluorine.getGas(fluorineContent) + Materials.Fluorine.getGas(fluorineContent) }; } } diff --git a/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/GregtechMetaTileEntityAnimalFarm.java b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/GregtechMetaTileEntityAnimalFarm.java index 5a165c4072..2114bd1af2 100644 --- a/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/GregtechMetaTileEntityAnimalFarm.java +++ b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/GregtechMetaTileEntityAnimalFarm.java @@ -1,5 +1,7 @@ package gtPlusPlus.xmod.gregtech.common.tileentities.machines.multi; +import java.lang.reflect.Field; + import gregtech.api.GregTech_API; import gregtech.api.enums.Textures; import gregtech.api.interfaces.ITexture; @@ -15,9 +17,6 @@ import gtPlusPlus.core.lib.LoadedMods; import gtPlusPlus.core.util.Utils; import gtPlusPlus.xmod.forestry.trees.TreefarmManager; import gtPlusPlus.xmod.gregtech.common.blocks.textures.TexturesGtBlock; - -import java.lang.reflect.Field; - import net.minecraft.block.Block; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.init.Blocks; @@ -33,20 +32,20 @@ public class GregtechMetaTileEntityAnimalFarm extends GT_MetaTileEntity_MultiBlo //public ArrayList mCasings = new ArrayList(); - private boolean running = false; + private final boolean running = false; private boolean p1, p2, p3, p4, p5, p6; public ItemStack mOutputItem1; public ItemStack mOutputItem2; private Block Humus; - private boolean isForestryLoaded = TreefarmManager.isForestryValid(); + private final boolean isForestryLoaded = TreefarmManager.isForestryValid(); - public GregtechMetaTileEntityAnimalFarm(int aID, String aName, String aNameRegional) { + public GregtechMetaTileEntityAnimalFarm(final int aID, final String aName, final String aNameRegional) { super(aID, aName, aNameRegional); } - public GregtechMetaTileEntityAnimalFarm(String aName) { + public GregtechMetaTileEntityAnimalFarm(final String aName) { super(aName); - } + } @Override public String[] getDescription() { @@ -55,11 +54,11 @@ public class GregtechMetaTileEntityAnimalFarm extends GT_MetaTileEntity_MultiBlo "How to get your first logs without an axe.", "Max Size(WxHxD): 9x1x9 (Controller, with upto 4 dirt out each direction on a flat plane.)", "Dirt for the rest! [D = Dirt, X = Controller]" - }; + }; } @Override - public ITexture[] getTexture(IGregTechTileEntity aBaseMetaTileEntity, byte aSide, byte aFacing, byte aColorIndex, boolean aActive, boolean aRedstone) { + public ITexture[] getTexture(final IGregTechTileEntity aBaseMetaTileEntity, final byte aSide, final byte aFacing, final byte aColorIndex, final boolean aActive, final boolean aRedstone) { if (aSide == 1) { return new ITexture[]{new GT_RenderedTexture(TexturesGtBlock.Casing_Machine_Acacia_Log), new GT_RenderedTexture(aActive ? TexturesGtBlock.Overlay_Machine_Vent_Fast : TexturesGtBlock.Overlay_Machine_Vent)}; } @@ -77,39 +76,41 @@ public class GregtechMetaTileEntityAnimalFarm extends GT_MetaTileEntity_MultiBlo } @Override - public boolean isFacingValid(byte aFacing) { + public boolean isFacingValid(final byte aFacing) { return aFacing > 1; } @Override - public boolean isAccessAllowed(EntityPlayer aPlayer) { + public boolean isAccessAllowed(final EntityPlayer aPlayer) { return true; } @Override - public boolean allowCoverOnSide(byte aSide, GT_ItemStack aCoverID) { + public boolean allowCoverOnSide(final byte aSide, final GT_ItemStack aCoverID) { return (GregTech_API.getCoverBehavior(aCoverID.toStack()).isSimpleCover()) && (super.allowCoverOnSide(aSide, aCoverID)); } @Override - public MetaTileEntity newMetaEntity(IGregTechTileEntity aTileEntity) { + public MetaTileEntity newMetaEntity(final IGregTechTileEntity aTileEntity) { return new GregtechMetaTileEntityAnimalFarm(this.mName); } @Override - public boolean onRightclick(IGregTechTileEntity aBaseMetaTileEntity, EntityPlayer aPlayer) { - if (aBaseMetaTileEntity.isClientSide()) return true; + public boolean onRightclick(final IGregTechTileEntity aBaseMetaTileEntity, final EntityPlayer aPlayer) { + if (aBaseMetaTileEntity.isClientSide()) { + return true; + } return true; } @Override - public boolean isCorrectMachinePart(ItemStack aStack) { + public boolean isCorrectMachinePart(final ItemStack aStack) { return true; } @Override - public boolean checkRecipe(ItemStack aStack) { + public boolean checkRecipe(final ItemStack aStack) { Utils.LOG_INFO("Working"); /*if (!checkRecursiveBlocks()) { this.mEfficiency = 0; @@ -137,16 +138,16 @@ public class GregtechMetaTileEntityAnimalFarm extends GT_MetaTileEntity_MultiBlo if (!LoadedMods.Forestry){ return null; } - return TreefarmManager.getHumus(); + return TreefarmManager.getHumus(); } @Override - public boolean checkMachine(IGregTechTileEntity aBaseMetaTileEntity, ItemStack aStack) { + public boolean checkMachine(final IGregTechTileEntity aBaseMetaTileEntity, final ItemStack aStack) { //this.mCasings.clear(); Utils.LOG_INFO("Step 1"); - int xDir = net.minecraftforge.common.util.ForgeDirection.getOrientation(aBaseMetaTileEntity.getBackFacing()).offsetX * 7; - int zDir = net.minecraftforge.common.util.ForgeDirection.getOrientation(aBaseMetaTileEntity.getBackFacing()).offsetZ * 7; + final int xDir = net.minecraftforge.common.util.ForgeDirection.getOrientation(aBaseMetaTileEntity.getBackFacing()).offsetX * 7; + final int zDir = net.minecraftforge.common.util.ForgeDirection.getOrientation(aBaseMetaTileEntity.getBackFacing()).offsetZ * 7; for (int i = -7; i <= 7; i++) { Utils.LOG_INFO("Step 2"); @@ -155,10 +156,10 @@ public class GregtechMetaTileEntityAnimalFarm extends GT_MetaTileEntity_MultiBlo for (int h = 0; h <= 1; h++) { Utils.LOG_INFO("Step 4"); - IGregTechTileEntity tTileEntity = aBaseMetaTileEntity.getIGregTechTileEntityOffset(xDir + i, h, zDir + j); + final IGregTechTileEntity tTileEntity = aBaseMetaTileEntity.getIGregTechTileEntityOffset(xDir + i, h, zDir + j); //Farm Floor inner 14x14 - if ((i != -7 && i != 7) && (j != -7 && j != 7)) { + if (((i != -7) && (i != 7)) && ((j != -7) && (j != 7))) { Utils.LOG_INFO("Step 5 - H:"+h); // Farm Dirt Floor and Inner Air/Log space. if (h == 0) { @@ -172,40 +173,40 @@ public class GregtechMetaTileEntityAnimalFarm extends GT_MetaTileEntity_MultiBlo (aBaseMetaTileEntity.getZCoord()+(zDir+j)), Blocks.melon_block); return false; - } - } + } + } // Inside fenced area, mostly air or trees or saplings - else if (h == 1){ + else if (h == 1){ //Farm Inner 14x14 /*if (!TreefarmManager.isWoodLog(aBaseMetaTileEntity.getBlockOffset(xDir + i, h, zDir + j)) || !TreefarmManager.isAirBlock(aBaseMetaTileEntity.getBlockOffset(xDir + i, h, zDir + j)) || !aBaseMetaTileEntity.getAirOffset(xDir+i, h, zDir+j)) { Utils.LOG_INFO("Wood like block missing from inner 14x14, layer 2."); //TODO - Utils.LOG_INFO("Instead, found "+aBaseMetaTileEntity.getBlockOffset(xDir + i, h, zDir + j).getLocalizedName()); + Utils.LOG_INFO("Instead, found "+aBaseMetaTileEntity.getBlockOffset(xDir + i, h, zDir + j).getLocalizedName()); Utils.LOG_INFO("Found at x:"+(xDir+i)+" y:"+h+" z:"+(zDir+j)); //return false; - }*/ - } + }*/ + } } //Dealt with inner 5x5, now deal with the exterior. else { Utils.LOG_INFO("Step 6 - H:"+h); //Deal with all 4 sides (Fenced area) - if (h == 1) { + if (h == 1) { if (!TreefarmManager.isFenceBlock(aBaseMetaTileEntity.getBlockOffset(xDir + i, h, zDir + j))) { Utils.LOG_INFO("Fence/Gate missing from outside the second layer."); Utils.LOG_INFO("Instead, found "+aBaseMetaTileEntity.getBlockOffset(xDir + i, h, zDir + j).getLocalizedName()); return false; - } + } } //Deal with Bottom edges (Add Hatches/Busses first, othercheck make sure it's dirt) //TODO change the casings to not dirt~ else if (h == 0) { try { - addCasingToCasingList(tTileEntity); - } catch (Throwable t){} + this.addCasingToCasingList(tTileEntity); + } catch (final Throwable t){} - if ((!addMaintenanceToMachineList(tTileEntity, 77)) && (!addInputToMachineList(tTileEntity, 77)) && (!addOutputToMachineList(tTileEntity, 77)) && (!addEnergyInputToMachineList(tTileEntity, 77))) { - if ((xDir + i != 0) || (zDir + j != 0)) {//no controller + if ((!this.addMaintenanceToMachineList(tTileEntity, 77)) && (!this.addInputToMachineList(tTileEntity, 77)) && (!this.addOutputToMachineList(tTileEntity, 77)) && (!this.addEnergyInputToMachineList(tTileEntity, 77))) { + if (((xDir + i) != 0) || ((zDir + j) != 0)) {//no controller if (!(aBaseMetaTileEntity.getMetaTileID() != 752)) { Utils.LOG_INFO("Fark Keeper Casings Missing from one of the edges on the bottom edge. x:"+(xDir+i)+" y:"+h+" z:"+(zDir+j)+" | "+aBaseMetaTileEntity.getClass()); @@ -241,7 +242,7 @@ public class GregtechMetaTileEntityAnimalFarm extends GT_MetaTileEntity_MultiBlo if (this.mOutputHatches != null) { for (int i = 0; i < this.mOutputHatches.size(); i++) { - if (this.mOutputHatches.get(i).mTier < 2 && (this.mOutputHatches.get(i).getBaseMetaTileEntity() instanceof GregtechMTE_NuclearReactor)){ + if ((this.mOutputHatches.get(i).mTier < 2) && (this.mOutputHatches.get(i).getBaseMetaTileEntity() instanceof GregtechMTE_NuclearReactor)){ Utils.LOG_INFO("You require at LEAST MV tier Output Hatches."); Utils.LOG_INFO(this.mOutputHatches.get(i).getBaseMetaTileEntity().getXCoord()+","+this.mOutputHatches.get(i).getBaseMetaTileEntity().getYCoord()+","+this.mOutputHatches.get(i).getBaseMetaTileEntity().getZCoord()); Utils.LOG_INFO(this.mOutputHatches.get(i).getBaseMetaTileEntity().getInventoryName()); @@ -260,24 +261,24 @@ public class GregtechMetaTileEntityAnimalFarm extends GT_MetaTileEntity_MultiBlo } } } - mSolderingTool = true; + this.mSolderingTool = true; //turnCasingActive(true); Utils.LOG_INFO("Multiblock Formed."); return true; } @Override - public int getMaxEfficiency(ItemStack aStack) { + public int getMaxEfficiency(final ItemStack aStack) { return 10000; } @Override - public int getPollutionPerTick(ItemStack aStack) { + public int getPollutionPerTick(final ItemStack aStack) { return 0; } @Override - public int getDamageToComponent(ItemStack aStack) { + public int getDamageToComponent(final ItemStack aStack) { return 0; } @@ -287,29 +288,31 @@ public class GregtechMetaTileEntityAnimalFarm extends GT_MetaTileEntity_MultiBlo } @Override - public boolean explodesOnComponentBreak(ItemStack aStack) { + public boolean explodesOnComponentBreak(final ItemStack aStack) { return false; } - public boolean addCasingToCasingList(IGregTechTileEntity aTileEntity) { - if (aTileEntity == null) + public boolean addCasingToCasingList(final IGregTechTileEntity aTileEntity) { + if (aTileEntity == null) { return false; - IMetaTileEntity aMetaTileEntity = aTileEntity.getMetaTileEntity(); - if (aMetaTileEntity == null) + } + final IMetaTileEntity aMetaTileEntity = aTileEntity.getMetaTileEntity(); + if (aMetaTileEntity == null) { return false; + } if (aMetaTileEntity instanceof GT_MetaTileEntity_TieredMachineBlock) { //return this.mCasings.add((GT_MetaTileEntity_TieredMachineBlock) aMetaTileEntity); } return false; } - private GT_MetaTileEntity_TieredMachineBlock changeTextureswithReflection(GT_MetaTileEntity_TieredMachineBlock casing, ITexture[][][] textureSet){ - GT_MetaTileEntity_TieredMachineBlock cv = casing; + private GT_MetaTileEntity_TieredMachineBlock changeTextureswithReflection(final GT_MetaTileEntity_TieredMachineBlock casing, final ITexture[][][] textureSet){ + final GT_MetaTileEntity_TieredMachineBlock cv = casing; //System.out.println("Before: "+cv.mTextures.hashCode()); //Get declared field from class Field f; try { - Field[] x = cv.getClass().getFields(); + final Field[] x = cv.getClass().getFields(); for (int i =0; i 0) { - for (final GT_MetaTileEntity_Hatch_Energy tHatch : mEnergyHatches){ + for (final GT_MetaTileEntity_Hatch_Energy tHatch : this.mEnergyHatches){ if (isValidMetaTileEntity(tHatch)) { - if (tHatch.getEUVar() >= 128) { + if (tHatch.getEUVar() >= 128) { for (int o=0;o<(tHatch.getEUVar()/128);o++){ - if (this.mInternalPower<(maxEUStore()-128)){ - tHatch.getBaseMetaTileEntity().decreaseStoredEnergyUnits(128, false); - this.mInternalPower = (this.mInternalPower+128); - //Utils.LOG_MACHINE_INFO("Increasing internal power storage by 128EU. Stored:"+this.mInternalPower); + if (this.mInternalPower<(this.maxEUStore()-128)){ + tHatch.getBaseMetaTileEntity().decreaseStoredEnergyUnits(128, false); + this.mInternalPower = (this.mInternalPower+128); + //Utils.LOG_MACHINE_INFO("Increasing internal power storage by 128EU. Stored:"+this.mInternalPower); } } } @@ -127,18 +126,18 @@ public class GregtechMetaTileEntityTreeFarm extends GT_MetaTileEntity_MultiBlock Utils.LOG_INFO("Bad Power hatch to obtain energy from."); } } - } - else { - if (energyHatchRetryCount <= 10){ - energyHatchRetryCount++; + } + else { + if (this.energyHatchRetryCount <= 10){ + this.energyHatchRetryCount++; Utils.LOG_INFO("No energy hatches found."); } else { Utils.LOG_MACHINE_INFO("Rechecking for Energy hatches."); - energyHatchRetryCount = 0; - this.mEnergyHatches = new ArrayList(); - checkMachine(aBaseMetaTileEntity, mInventory[1]); - } + this.energyHatchRetryCount = 0; + this.mEnergyHatches = new ArrayList<>(); + this.checkMachine(aBaseMetaTileEntity, this.mInventory[1]); + } } return true; } @@ -151,7 +150,7 @@ public class GregtechMetaTileEntityTreeFarm extends GT_MetaTileEntity_MultiBlock @Override public ITexture[] getTexture(final IGregTechTileEntity aBaseMetaTileEntity, final byte aSide, final byte aFacing, final byte aColorIndex, final boolean aActive, final boolean aRedstone) { if (aSide == 1) { - return new ITexture[]{new GT_RenderedTexture(TexturesGtBlock.Casing_Machine_Acacia_Log), new GT_RenderedTexture(canChop ? TexturesGtBlock.Overlay_Machine_Vent_Fast : TexturesGtBlock.Overlay_Machine_Vent)}; + return new ITexture[]{new GT_RenderedTexture(TexturesGtBlock.Casing_Machine_Acacia_Log), new GT_RenderedTexture(this.canChop ? TexturesGtBlock.Overlay_Machine_Vent_Fast : TexturesGtBlock.Overlay_Machine_Vent)}; } return new ITexture[]{new GT_RenderedTexture(TexturesGtBlock.Casing_Machine_Farm_Manager)}; } @@ -187,17 +186,17 @@ public class GregtechMetaTileEntityTreeFarm extends GT_MetaTileEntity_MultiBlock } @Override - public Object getClientGUI(int aID, InventoryPlayer aPlayerInventory, IGregTechTileEntity aBaseMetaTileEntity) { - return new GUI_TreeFarmer(aPlayerInventory, aBaseMetaTileEntity, getLocalName(), "TreeFarmer.png"); - } + public Object getClientGUI(final int aID, final InventoryPlayer aPlayerInventory, final IGregTechTileEntity aBaseMetaTileEntity) { + return new GUI_TreeFarmer(aPlayerInventory, aBaseMetaTileEntity, this.getLocalName(), "TreeFarmer.png"); + } @Override - public Object getServerGUI(int aID, InventoryPlayer aPlayerInventory, IGregTechTileEntity aBaseMetaTileEntity) { + public Object getServerGUI(final int aID, final InventoryPlayer aPlayerInventory, final IGregTechTileEntity aBaseMetaTileEntity) { return new CONTAINER_TreeFarmer(aPlayerInventory, aBaseMetaTileEntity); } @Override - public boolean onRightclick(IGregTechTileEntity aBaseMetaTileEntity, EntityPlayer aPlayer) { + public boolean onRightclick(final IGregTechTileEntity aBaseMetaTileEntity, final EntityPlayer aPlayer) { if (aBaseMetaTileEntity.isClientSide()) { return true; } @@ -208,13 +207,13 @@ public class GregtechMetaTileEntityTreeFarm extends GT_MetaTileEntity_MultiBlock @Override public boolean isCorrectMachinePart(final ItemStack aStack) { boolean isValid = false; - SAWTOOL currentInputItem = TreeFarmHelper.isCorrectMachinePart(aStack); + final SAWTOOL currentInputItem = TreeFarmHelper.isCorrectMachinePart(aStack); if (currentInputItem != SAWTOOL.NONE){ if (currentInputItem == SAWTOOL.SAW){ - mCurrentMachineTool = SAWTOOL.SAW; + this.mCurrentMachineTool = SAWTOOL.SAW; } else { - mCurrentMachineTool = SAWTOOL.BUZZSAW; + this.mCurrentMachineTool = SAWTOOL.BUZZSAW; } isValid = true; } @@ -226,7 +225,7 @@ public class GregtechMetaTileEntityTreeFarm extends GT_MetaTileEntity_MultiBlock @Override public boolean checkRecipe(final ItemStack aStack) { - Utils.LOG_MACHINE_INFO("Working"); + Utils.LOG_MACHINE_INFO("Working"); this.mEfficiency = 0; this.mEfficiencyIncrease = 0; this.mMaxProgresstime = 0; @@ -236,7 +235,7 @@ public class GregtechMetaTileEntityTreeFarm extends GT_MetaTileEntity_MultiBlock @Override public boolean checkMachine(final IGregTechTileEntity aBaseMetaTileEntity, final ItemStack aStack) { Utils.LOG_WARNING("Step 1"); - final int xDir = net.minecraftforge.common.util.ForgeDirection.getOrientation(aBaseMetaTileEntity.getBackFacing()).offsetX * 7; + final int xDir = net.minecraftforge.common.util.ForgeDirection.getOrientation(aBaseMetaTileEntity.getBackFacing()).offsetX * 7; final int zDir = net.minecraftforge.common.util.ForgeDirection.getOrientation(aBaseMetaTileEntity.getBackFacing()).offsetZ * 7; for (int i = -7; i <= 7; i++) { @@ -247,7 +246,7 @@ public class GregtechMetaTileEntityTreeFarm extends GT_MetaTileEntity_MultiBlock Utils.LOG_WARNING("Step 4"); final IGregTechTileEntity tTileEntity = aBaseMetaTileEntity.getIGregTechTileEntityOffset(xDir + i, h, zDir + j); //Farm Floor inner 14x14 - if ((i != -7 && i != 7) && (j != -7 && j != 7)) { + if (((i != -7) && (i != 7)) && ((j != -7) && (j != 7))) { Utils.LOG_WARNING("Step 5 - H:"+h); // Farm Dirt Floor and Inner Air/Log space. if (h == 0) { @@ -256,24 +255,24 @@ public class GregtechMetaTileEntityTreeFarm extends GT_MetaTileEntity_MultiBlock Utils.LOG_MACHINE_INFO("Dirt like block missing from inner 14x14."); Utils.LOG_MACHINE_INFO("Instead, found "+aBaseMetaTileEntity.getBlockOffset(xDir + i, h, zDir + j).getLocalizedName()); return false; - } + } } } //Dealt with inner 5x5, now deal with the exterior. else { Utils.LOG_WARNING("Step 6 - H:"+h); //Deal with all 4 sides (Fenced area) - if (h == 1) { + if (h == 1) { if (!TreefarmManager.isFenceBlock(aBaseMetaTileEntity.getBlockOffset(xDir + i, h, zDir + j))) { Utils.LOG_MACHINE_INFO("Fence/Gate missing from outside the second layer."); Utils.LOG_MACHINE_INFO("Instead, found "+aBaseMetaTileEntity.getBlockOffset(xDir + i, h, zDir + j).getLocalizedName()); return false; - } + } } //Deal with Bottom edges (Add Hatches/Busses first, othercheck make sure it's dirt) //TODO change the casings to not dirt~ else if (h == 0) { - if ((!addMaintenanceToMachineList(tTileEntity, 77)) && (!addInputToMachineList(tTileEntity, 77)) && (!addOutputToMachineList(tTileEntity, 77)) && (!addEnergyInputToMachineList(tTileEntity, 77))) { - if ((xDir + i != 0) || (zDir + j != 0)) {//no controller + if ((!this.addMaintenanceToMachineList(tTileEntity, 77)) && (!this.addInputToMachineList(tTileEntity, 77)) && (!this.addOutputToMachineList(tTileEntity, 77)) && (!this.addEnergyInputToMachineList(tTileEntity, 77))) { + if (((xDir + i) != 0) || ((zDir + j) != 0)) {//no controller if (tTileEntity.getMetaTileID() != 752) { Utils.LOG_MACHINE_INFO("Farm Keeper Casings Missing from one of the edges on the bottom edge. x:"+(xDir+i)+" y:"+h+" z:"+(zDir+j)+" | "+aBaseMetaTileEntity.getClass()); @@ -303,7 +302,7 @@ public class GregtechMetaTileEntityTreeFarm extends GT_MetaTileEntity_MultiBlock if (this.mOutputHatches != null) { for (int i = 0; i < this.mOutputHatches.size(); i++) { - if (this.mOutputHatches.get(i).mTier < 2 && (this.mOutputHatches.get(i).getBaseMetaTileEntity() instanceof GregtechMTE_NuclearReactor)){ + if ((this.mOutputHatches.get(i).mTier < 2) && (this.mOutputHatches.get(i).getBaseMetaTileEntity() instanceof GregtechMTE_NuclearReactor)){ Utils.LOG_INFO("You require at LEAST MV tier Output Hatches."); Utils.LOG_INFO(this.mOutputHatches.get(i).getBaseMetaTileEntity().getXCoord()+","+this.mOutputHatches.get(i).getBaseMetaTileEntity().getYCoord()+","+this.mOutputHatches.get(i).getBaseMetaTileEntity().getZCoord()); Utils.LOG_INFO(this.mOutputHatches.get(i).getBaseMetaTileEntity().getInventoryName()); @@ -357,7 +356,7 @@ public class GregtechMetaTileEntityTreeFarm extends GT_MetaTileEntity_MultiBlock private boolean isMachineRepaired(){ if (this.mSolderingTool || this.mCrowbar || this.mHardHammer || this.mScrewdriver || this.mSoftHammer || this.mWrench){ return true; - } + } return false; } @@ -368,12 +367,12 @@ public class GregtechMetaTileEntityTreeFarm extends GT_MetaTileEntity_MultiBlock Utils.LOG_MACHINE_INFO("called findLogs()"); int logsCut = 0; boolean stopCheck = false; - final int xDir = net.minecraftforge.common.util.ForgeDirection.getOrientation(aBaseMetaTileEntity.getBackFacing()).offsetX * 7; + final int xDir = net.minecraftforge.common.util.ForgeDirection.getOrientation(aBaseMetaTileEntity.getBackFacing()).offsetX * 7; final int zDir = net.minecraftforge.common.util.ForgeDirection.getOrientation(aBaseMetaTileEntity.getBackFacing()).offsetZ * 7; final World world = aBaseMetaTileEntity.getWorld(); int posX, posY, posZ; - if (mInternalPower >= 128) { + if (this.mInternalPower >= 128) { OUTER : for (int h=0;h<150;h++){ for (int i = -7; i <= 7; i++) { @@ -382,88 +381,88 @@ public class GregtechMetaTileEntityTreeFarm extends GT_MetaTileEntity_MultiBlock //Cut too many logs, do this to prevent lag. - if (logsCut >= logsToBreakAfter){ + if (logsCut >= this.logsToBreakAfter){ stopCheck = true; - } + } //Already Breaking but first two layers are empty, let's do a full check. - else if (logsCut == 0 && h == 2 && takingBreak){ + else if ((logsCut == 0) && (h == 2) && this.takingBreak){ stopCheck = false; } //No Trees Grown and not breaking, take a break, reduce lag. - else if (logsCut == 0 && h == 3 && !takingBreak){ + else if ((logsCut == 0) && (h == 3) && !this.takingBreak){ stopCheck = true; - } + } else { stopCheck = false; } if (stopCheck){ Utils.LOG_MACHINE_INFO("Either found too many logs, so taking a break mid cut for lag conservation, or found no trees to cut, so stopping"); - Utils.LOG_MACHINE_INFO("found: "+logsCut +" and check up to h:"+h+" - Taking Break:"+takingBreak); + Utils.LOG_MACHINE_INFO("found: "+logsCut +" and check up to h:"+h+" - Taking Break:"+this.takingBreak); stopCheck = false; break OUTER; } - if ((i != -7 && i != 7) && (j != -7 && j != 7)) { - Block loopBlock = aBaseMetaTileEntity.getBlockOffset(xDir + i, h, zDir + j); - if (TreefarmManager.isWoodLog(loopBlock) || TreefarmManager.isLeaves(loopBlock)){ - long tempStoredEU = mInternalPower; - if (tempStoredEU >= powerDrain){ - Utils.LOG_MACHINE_INFO("Cutting a "+loopBlock.getLocalizedName()+", currently stored:"+tempStoredEU+" | max:"+maxEUStore()); - drainEnergyInput(powerDrain); + if (((i != -7) && (i != 7)) && ((j != -7) && (j != 7))) { + final Block loopBlock = aBaseMetaTileEntity.getBlockOffset(xDir + i, h, zDir + j); + if (TreefarmManager.isWoodLog(loopBlock) || TreefarmManager.isLeaves(loopBlock)){ + final long tempStoredEU = this.mInternalPower; + if (tempStoredEU >= powerDrain){ + Utils.LOG_MACHINE_INFO("Cutting a "+loopBlock.getLocalizedName()+", currently stored:"+tempStoredEU+" | max:"+this.maxEUStore()); + this.drainEnergyInput(powerDrain); - long tempStoredEU2 = mInternalPower; + final long tempStoredEU2 = this.mInternalPower; if (tempStoredEU != tempStoredEU2){ if (tempStoredEU == (tempStoredEU2+powerDrain)){ - Utils.LOG_MACHINE_INFO(powerDrain+"EU was drained."); + Utils.LOG_MACHINE_INFO(powerDrain+"EU was drained."); } else { Utils.LOG_MACHINE_INFO(""+(tempStoredEU-tempStoredEU2)+"EU was drained."); } } else { - Utils.LOG_MACHINE_INFO("Stored EU did not change."); + Utils.LOG_MACHINE_INFO("Stored EU did not change."); } posX = aBaseMetaTileEntity.getXCoord()+xDir+i; posY = aBaseMetaTileEntity.getYCoord()+h; posZ = aBaseMetaTileEntity.getZCoord()+zDir+j; - cutLog(world, posX, posY, posZ); + this.cutLog(world, posX, posY, posZ); if (TreefarmManager.isWoodLog(loopBlock)){ - logsCut++; - } + logsCut++; + } } else { Utils.LOG_MACHINE_INFO("Not enough power to cut."); - } + } } } } } - } + } } else { - Utils.LOG_MACHINE_INFO("Not enough Power | can hold:"+maxEUStore()+" | holding:"+aBaseMetaTileEntity.getStoredEU()); + Utils.LOG_MACHINE_INFO("Not enough Power | can hold:"+this.maxEUStore()+" | holding:"+aBaseMetaTileEntity.getStoredEU()); } - canChop = false; - if (logsCut >= logsToBreakAfter){ + this.canChop = false; + if (logsCut >= this.logsToBreakAfter){ TreeFarmHelper.cleanUp(aBaseMetaTileEntity); } - return false; + return false; } private boolean growSaplingsWithBonemeal(final IGregTechTileEntity aBaseMetaTileEntity){ Utils.LOG_MACHINE_INFO("called growSaplingsWithBonemeal()"); int saplings = 0; - final int xDir = net.minecraftforge.common.util.ForgeDirection.getOrientation(aBaseMetaTileEntity.getBackFacing()).offsetX * 7; + final int xDir = net.minecraftforge.common.util.ForgeDirection.getOrientation(aBaseMetaTileEntity.getBackFacing()).offsetX * 7; final int zDir = net.minecraftforge.common.util.ForgeDirection.getOrientation(aBaseMetaTileEntity.getBackFacing()).offsetZ * 7; for (int i = -7; i <= 7; i++) { for (int j = -7; j <= 7; j++) { - int h = 1; + final int h = 1; //Utils.LOG_MACHINE_INFO("Looking for saplings."); if (TreefarmManager.isSapling(aBaseMetaTileEntity.getBlockOffset(xDir + i, h, zDir + j))){ int posiX, posiY, posiZ; @@ -473,10 +472,10 @@ public class GregtechMetaTileEntityTreeFarm extends GT_MetaTileEntity_MultiBlock //Utils.LOG_MACHINE_INFO("Found a sapling to grow."); saplings++; - if (depleteFertiliser()){ - if (drainEnergyInput(powerDrain)){ - short fertTier = getFertiliserTier(getCurrentFertiliserStack()); - TreeFarmHelper.applyBonemeal(getFakePlayer(), aBaseMetaTileEntity.getWorld(), posiX, posiY, posiZ, fertTier); + if (this.depleteFertiliser()){ + if (this.drainEnergyInput(powerDrain)){ + final short fertTier = this.getFertiliserTier(this.getCurrentFertiliserStack()); + TreeFarmHelper.applyBonemeal(this.getFakePlayer(), aBaseMetaTileEntity.getWorld(), posiX, posiY, posiZ, fertTier); } else { Utils.LOG_MACHINE_INFO("x3"); @@ -486,40 +485,40 @@ public class GregtechMetaTileEntityTreeFarm extends GT_MetaTileEntity_MultiBlock else { Utils.LOG_MACHINE_INFO("x2"); break; - } - } + } + } } } Utils.LOG_MACHINE_INFO("Tried to grow saplings: | "+saplings ); - return true; + return true; } private boolean plantSaplings(final IGregTechTileEntity aBaseMetaTileEntity){ Utils.LOG_MACHINE_INFO("called plantSaplings()"); - World world = aBaseMetaTileEntity.getWorld(); - ArrayList r = getStoredInputs(); - int saplings = 0; - final int xDir = net.minecraftforge.common.util.ForgeDirection.getOrientation(aBaseMetaTileEntity.getBackFacing()).offsetX * 7; + final World world = aBaseMetaTileEntity.getWorld(); + ArrayList r = this.getStoredInputs(); + final int saplings = 0; + final int xDir = net.minecraftforge.common.util.ForgeDirection.getOrientation(aBaseMetaTileEntity.getBackFacing()).offsetX * 7; final int zDir = net.minecraftforge.common.util.ForgeDirection.getOrientation(aBaseMetaTileEntity.getBackFacing()).offsetZ * 7; int counter = 0; if (r.size() > 0){ Utils.LOG_MACHINE_INFO("| r was not null. "+r.size()+" |"); - OUTER : for (ItemStack n : r){ + OUTER : for (final ItemStack n : r){ Utils.LOG_MACHINE_INFO("found "+n.getDisplayName()); if (OrePrefixes.sapling.contains(n) || n.getDisplayName().toLowerCase().contains("sapling")){ Utils.LOG_MACHINE_INFO(""+n.getDisplayName()); counter = n.stackSize; - Block saplingToPlace = Block.getBlockFromItem(n.getItem()); + final Block saplingToPlace = Block.getBlockFromItem(n.getItem()); //Find Gaps for Saplings after scanning Item Busses for (int i = -7; i <= 7; i++) { INNER : for (int j = -7; j <= 7; j++) { - int h = 1; - if (counter > 0){ - if ((i != -7 && i != 7) && (j != -7 && j != 7)) { - if (TreefarmManager.isAirBlock(aBaseMetaTileEntity.getBlockOffset(xDir + i, h, zDir + j))){ + final int h = 1; + if (counter > 0){ + if (((i != -7) && (i != 7)) && ((j != -7) && (j != 7))) { + if (TreefarmManager.isAirBlock(aBaseMetaTileEntity.getBlockOffset(xDir + i, h, zDir + j))){ //Get block location to place sapling block int posX, posY, posZ; @@ -528,7 +527,7 @@ public class GregtechMetaTileEntityTreeFarm extends GT_MetaTileEntity_MultiBlock posZ = aBaseMetaTileEntity.getZCoord()+zDir+j; //If sapling block is not null || Ignore if forestry is loaded. - if ((sapli