diff options
Diffstat (limited to 'src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi')
16 files changed, 1982 insertions, 1967 deletions
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] <Alkalus> 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<FluidStack> tFluids = getStoredFluids(); - Collection<GT_Recipe> 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<FluidStack> tFluids = this.getStoredFluids(); + final Collection<GT_Recipe> 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<GT_MetaTileEntity_TieredMachineBlock> 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){} + |
