diff options
author | miozune <miozune@gmail.com> | 2023-05-11 17:44:36 +0900 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-05-11 10:44:36 +0200 |
commit | d755802d116daddc62b47679d7f65490c4bdd7d6 (patch) | |
tree | 9f23082f952b6dfd4be25e497b88129776f15180 /src/main/java/net/glease/ggfab/mte/MTE_AdvAssLine.java | |
parent | 3d3605a1f20bfcf164290b29c7632d3bdca00fe5 (diff) | |
download | GT5-Unofficial-d755802d116daddc62b47679d7f65490c4bdd7d6.tar.gz GT5-Unofficial-d755802d116daddc62b47679d7f65490c4bdd7d6.tar.bz2 GT5-Unofficial-d755802d116daddc62b47679d7f65490c4bdd7d6.zip |
spotlessApply (#10)
Diffstat (limited to 'src/main/java/net/glease/ggfab/mte/MTE_AdvAssLine.java')
-rw-r--r-- | src/main/java/net/glease/ggfab/mte/MTE_AdvAssLine.java | 361 |
1 files changed, 161 insertions, 200 deletions
diff --git a/src/main/java/net/glease/ggfab/mte/MTE_AdvAssLine.java b/src/main/java/net/glease/ggfab/mte/MTE_AdvAssLine.java index 1fa00f6532..c4eafa7fad 100644 --- a/src/main/java/net/glease/ggfab/mte/MTE_AdvAssLine.java +++ b/src/main/java/net/glease/ggfab/mte/MTE_AdvAssLine.java @@ -1,21 +1,17 @@ package net.glease.ggfab.mte; -import com.gtnewhorizon.structurelib.alignment.constructable.ISurvivalConstructable; -import com.gtnewhorizon.structurelib.structure.IStructureDefinition; -import com.gtnewhorizon.structurelib.structure.ISurvivalBuildEnvironment; -import com.gtnewhorizon.structurelib.structure.StructureDefinition; -import gregtech.api.GregTech_API; -import gregtech.api.enums.GT_Values; -import gregtech.api.enums.ItemList; -import gregtech.api.interfaces.IHatchElement; -import gregtech.api.interfaces.ITexture; -import gregtech.api.interfaces.metatileentity.IMetaTileEntity; -import gregtech.api.interfaces.tileentity.IGregTechTileEntity; -import gregtech.api.metatileentity.implementations.*; -import gregtech.api.render.TextureFactory; -import gregtech.api.util.*; -import mcp.mobius.waila.api.IWailaConfigHandler; -import mcp.mobius.waila.api.IWailaDataAccessor; +import static com.gtnewhorizon.structurelib.structure.StructureUtility.*; +import static gregtech.GT_Mod.GT_FML_LOGGER; +import static gregtech.api.enums.GT_HatchElement.*; +import static gregtech.api.enums.GT_Values.V; +import static gregtech.api.enums.Textures.BlockIcons.casingTexturePages; +import static gregtech.api.util.GT_StructureUtility.buildHatchAdder; +import static gregtech.api.util.GT_StructureUtility.ofHatchAdder; +import static net.glease.ggfab.BlockIcons.*; + +import java.util.*; +import java.util.stream.IntStream; + import net.glease.ggfab.ConfigurationHandler; import net.glease.ggfab.GGConstants; import net.glease.ggfab.util.OverclockHelper; @@ -33,92 +29,87 @@ import net.minecraftforge.common.util.Constants; import net.minecraftforge.common.util.ForgeDirection; import net.minecraftforge.fluids.FluidStack; -import java.util.*; -import java.util.stream.IntStream; +import com.gtnewhorizon.structurelib.alignment.constructable.ISurvivalConstructable; +import com.gtnewhorizon.structurelib.structure.IStructureDefinition; +import com.gtnewhorizon.structurelib.structure.ISurvivalBuildEnvironment; +import com.gtnewhorizon.structurelib.structure.StructureDefinition; -import static com.gtnewhorizon.structurelib.structure.StructureUtility.*; -import static gregtech.GT_Mod.GT_FML_LOGGER; -import static gregtech.api.enums.GT_HatchElement.*; -import static gregtech.api.enums.GT_Values.V; -import static gregtech.api.enums.Textures.BlockIcons.casingTexturePages; -import static gregtech.api.util.GT_StructureUtility.buildHatchAdder; -import static gregtech.api.util.GT_StructureUtility.ofHatchAdder; -import static net.glease.ggfab.BlockIcons.*; +import gregtech.api.GregTech_API; +import gregtech.api.enums.GT_Values; +import gregtech.api.enums.ItemList; +import gregtech.api.interfaces.IHatchElement; +import gregtech.api.interfaces.ITexture; +import gregtech.api.interfaces.metatileentity.IMetaTileEntity; +import gregtech.api.interfaces.tileentity.IGregTechTileEntity; +import gregtech.api.metatileentity.implementations.*; +import gregtech.api.render.TextureFactory; +import gregtech.api.util.*; +import mcp.mobius.waila.api.IWailaConfigHandler; +import mcp.mobius.waila.api.IWailaDataAccessor; /* -Dev note: -1. This multi will be an assline but with greater throughput. it will take one input every -2. + * Dev note: 1. This multi will be an assline but with greater throughput. it will take one input every 2. */ -public class MTE_AdvAssLine extends GT_MetaTileEntity_ExtendedPowerMultiBlockBase<MTE_AdvAssLine> implements ISurvivalConstructable { +public class MTE_AdvAssLine extends GT_MetaTileEntity_ExtendedPowerMultiBlockBase<MTE_AdvAssLine> + implements ISurvivalConstructable { + private static final String STRUCTURE_PIECE_FIRST = "first"; private static final String STRUCTURE_PIECE_LATER = "later"; private static final String STRUCTURE_PIECE_LAST = "last"; public static final String TAG_KEY_CURRENT_STICK = "mCurrentStick"; public static final String TAG_KEY_PROGRESS_TIMES = "mProgressTimeArray"; - private static final IStructureDefinition<MTE_AdvAssLine> STRUCTURE_DEFINITION = - StructureDefinition.<MTE_AdvAssLine>builder() - .addShape(STRUCTURE_PIECE_FIRST, transpose(new String[][]{ - {" ", "e", " "}, - {"~", "l", "G"}, - {"g", "m", "g"}, - {"b", "i", "b"}, - })) - .addShape(STRUCTURE_PIECE_LATER, transpose(new String[][]{ - {" ", "e", " "}, - {"d", "l", "d"}, - {"g", "m", "g"}, - {"b", "I", "b"}, - })) - .addShape(STRUCTURE_PIECE_LAST, transpose(new String[][]{ - {" ", "e", " "}, - {"d", "l", "d"}, - {"g", "m", "g"}, - {"o", "i", "b"}, - })) - .addElement('G', ofBlock(GregTech_API.sBlockCasings3, 10)) // grate machine casing - .addElement('l', ofBlock(GregTech_API.sBlockCasings2, 9)) // assembler machine casing - .addElement('m', ofBlock(GregTech_API.sBlockCasings2, 5)) // assembling line casing - .addElement( - 'g', - ofChain( - ofBlockUnlocalizedName("IC2", "blockAlloyGlass", 0, true), - ofBlockUnlocalizedName("bartworks", "BW_GlasBlocks", 0, true), - // warded glass - ofBlockUnlocalizedName("Thaumcraft", "blockCosmeticOpaque", 2, false))) - .addElement( - 'e', - ofChain( - Energy.or(ExoticEnergy).newAny(16, 1, ForgeDirection.UP, ForgeDirection.NORTH, ForgeDirection.SOUTH), - ofBlock(GregTech_API.sBlockCasings2, 0))) - .addElement( - 'd', - buildHatchAdder(MTE_AdvAssLine.class) - .atLeast(DataHatchElement.DataAccess) - .dot(2) - .casingIndex(42) - .allowOnly(ForgeDirection.NORTH) - .buildAndChain(GregTech_API.sBlockCasings3, 10)) - .addElement( - 'b', - buildHatchAdder(MTE_AdvAssLine.class) - .atLeast(InputHatch, InputHatch, InputHatch, InputHatch, Maintenance) - .casingIndex(16) - .dot(3) - .allowOnly(ForgeDirection.DOWN) - .buildAndChain( - ofBlock(GregTech_API.sBlockCasings2, 0), - ofHatchAdder( - MTE_AdvAssLine::addOutputToMachineList, 16, 4))) - .addElement( - 'I', - ofChain( - // all blocks nearby use solid steel casing, so let's use the texture of that - InputBus.newAny(16, 5, ForgeDirection.DOWN), + private static final IStructureDefinition<MTE_AdvAssLine> STRUCTURE_DEFINITION = StructureDefinition + .<MTE_AdvAssLine>builder() + .addShape( + STRUCTURE_PIECE_FIRST, + transpose( + new String[][] { { " ", "e", " " }, { "~", "l", "G" }, { "g", "m", "g" }, + { "b", "i", "b" }, })) + .addShape( + STRUCTURE_PIECE_LATER, + transpose( + new String[][] { { " ", "e", " " }, { "d", "l", "d" }, { "g", "m", "g" }, + { "b", "I", "b" }, })) + .addShape( + STRUCTURE_PIECE_LAST, + transpose( + new String[][] { { " ", "e", " " }, { "d", "l", "d" }, { "g", "m", "g" }, + { "o", "i", "b" }, })) + .addElement('G', ofBlock(GregTech_API.sBlockCasings3, 10)) // grate machine casing + .addElement('l', ofBlock(GregTech_API.sBlockCasings2, 9)) // assembler machine casing + .addElement('m', ofBlock(GregTech_API.sBlockCasings2, 5)) // assembling line casing + .addElement( + 'g', + ofChain( + ofBlockUnlocalizedName("IC2", "blockAlloyGlass", 0, true), + ofBlockUnlocalizedName("bartworks", "BW_GlasBlocks", 0, true), + // warded glass + ofBlockUnlocalizedName("Thaumcraft", "blockCosmeticOpaque", 2, false))) + .addElement( + 'e', + ofChain( + Energy.or(ExoticEnergy) + .newAny(16, 1, ForgeDirection.UP, ForgeDirection.NORTH, ForgeDirection.SOUTH), + ofBlock(GregTech_API.sBlockCasings2, 0))) + .addElement( + 'd', + buildHatchAdder(MTE_AdvAssLine.class).atLeast(DataHatchElement.DataAccess).dot(2).casingIndex(42) + .allowOnly(ForgeDirection.NORTH).buildAndChain(GregTech_API.sBlockCasings3, 10)) + .addElement( + 'b', + buildHatchAdder(MTE_AdvAssLine.class) + .atLeast(InputHatch, InputHatch, InputHatch, InputHatch, Maintenance).casingIndex(16).dot(3) + .allowOnly(ForgeDirection.DOWN).buildAndChain( + ofBlock(GregTech_API.sBlockCasings2, 0), ofHatchAdder(MTE_AdvAssLine::addOutputToMachineList, 16, 4))) - .addElement('i', InputBus.newAny(16, 5, ForgeDirection.DOWN)) - .addElement('o', OutputBus.newAny(16, 4, ForgeDirection.DOWN)) - .build(); + .addElement( + 'I', + ofChain( + // all blocks nearby use solid steel casing, so let's use the texture of that + InputBus.newAny(16, 5, ForgeDirection.DOWN), + ofHatchAdder(MTE_AdvAssLine::addOutputToMachineList, 16, 4))) + .addElement('i', InputBus.newAny(16, 5, ForgeDirection.DOWN)) + .addElement('o', OutputBus.newAny(16, 4, ForgeDirection.DOWN)).build(); private ItemStack currentStick; private GT_Recipe.GT_Recipe_AssemblyLine currentRecipe; private final Slice[] slices = IntStream.range(0, 16).mapToObj(Slice::new).toArray(Slice[]::new); @@ -164,7 +155,8 @@ public class MTE_AdvAssLine extends GT_MetaTileEntity_ExtendedPowerMultiBlockBas for (int i = 1; i < 16; i++) { if (!checkPiece(STRUCTURE_PIECE_LATER, leftToRight ? -i : i, 1, 0)) return false; if (!mOutputBusses.isEmpty()) - return (!mEnergyHatches.isEmpty() || !mExoticEnergyHatches.isEmpty()) && mMaintenanceHatches.size() == 1 && mDataAccessHatches.size() <= 1; + return (!mEnergyHatches.isEmpty() || !mExoticEnergyHatches.isEmpty()) && mMaintenanceHatches.size() == 1 + && mDataAccessHatches.size() <= 1; } return false; } @@ -197,13 +189,11 @@ public class MTE_AdvAssLine extends GT_MetaTileEntity_ExtendedPowerMultiBlockBas // blockrenderer6343 seems to place the block in a weird way, let's catch that if (getBaseMetaTileEntity() != null && getBaseMetaTileEntity().isServerSide()) { UUID ownerUuid = getBaseMetaTileEntity().getOwnerUuid(); - if (ownerUuid == null) - return; + if (ownerUuid == null) return; float factor = ConfigurationHandler.INSTANCE.getLaserOCPenaltyFactor(); MinecraftServer server = MinecraftServer.getServer(); // more blockrenderer6343 weirdness - if (server == null) - return; + if (server == null) return; @SuppressWarnings("unchecked") List<EntityPlayerMP> l = server.getConfigurationManager().playerEntityList; for (EntityPlayerMP p : l) { @@ -213,10 +203,12 @@ public class MTE_AdvAssLine extends GT_MetaTileEntity_ExtendedPowerMultiBlockBas Object[] args; switch (i) { case 7: - args = new Object[]{factor}; + args = new Object[] { factor }; break; case 8: - args = new Object[]{(int) (factor * 100) + 400, (int) ((4 + factor) * (4 + factor + factor) * 100), 4 + factor, 4 + factor + factor}; + args = new Object[] { (int) (factor * 100) + 400, + (int) ((4 + factor) * (4 + factor + factor) * 100), 4 + factor, + 4 + factor + factor }; break; default: args = new Object[0]; @@ -229,63 +221,35 @@ public class MTE_AdvAssLine extends GT_MetaTileEntity_ExtendedPowerMultiBlockBas } @Override - public ITexture[] getTexture(IGregTechTileEntity aBaseMetaTileEntity, ForgeDirection side, ForgeDirection facing, int colorIndex, boolean aActive, boolean aRedstone) { + public ITexture[] getTexture(IGregTechTileEntity aBaseMetaTileEntity, ForgeDirection side, ForgeDirection facing, + int colorIndex, boolean aActive, boolean aRedstone) { if (side == facing) { if (stuck) { - return new ITexture[]{ - casingTexturePages[0][16], - TextureFactory.builder() - .addIcon(OVERLAY_FRONT_ADV_ASSLINE_STUCK) - .extFacing() - .build(), - TextureFactory.builder() - .addIcon(OVERLAY_FRONT_ADV_ASSLINE_STUCK_GLOW) - .extFacing() - .glow() - .build() - }; + return new ITexture[] { casingTexturePages[0][16], + TextureFactory.builder().addIcon(OVERLAY_FRONT_ADV_ASSLINE_STUCK).extFacing().build(), + TextureFactory.builder().addIcon(OVERLAY_FRONT_ADV_ASSLINE_STUCK_GLOW).extFacing().glow() + .build() }; } - if (aActive) - return new ITexture[]{ - casingTexturePages[0][16], - TextureFactory.builder() - .addIcon(OVERLAY_FRONT_ADV_ASSLINE_ACTIVE) - .extFacing() - .build(), - TextureFactory.builder() - .addIcon(OVERLAY_FRONT_ADV_ASSLINE_ACTIVE_GLOW) - .extFacing() - .glow() - .build() - }; - return new ITexture[]{ - casingTexturePages[0][16], - TextureFactory.builder() - .addIcon(OVERLAY_FRONT_ADV_ASSLINE) - .extFacing() - .build(), - TextureFactory.builder() - .addIcon(OVERLAY_FRONT_ADV_ASSLINE_GLOW) - .extFacing() - .glow() - .build() - }; - } - return new ITexture[]{casingTexturePages[0][16]}; + if (aActive) return new ITexture[] { casingTexturePages[0][16], + TextureFactory.builder().addIcon(OVERLAY_FRONT_ADV_ASSLINE_ACTIVE).extFacing().build(), + TextureFactory.builder().addIcon(OVERLAY_FRONT_ADV_ASSLINE_ACTIVE_GLOW).extFacing().glow() + .build() }; + return new ITexture[] { casingTexturePages[0][16], + TextureFactory.builder().addIcon(OVERLAY_FRONT_ADV_ASSLINE).extFacing().build(), + TextureFactory.builder().addIcon(OVERLAY_FRONT_ADV_ASSLINE_GLOW).extFacing().glow().build() }; + } + return new ITexture[] { casingTexturePages[0][16] }; } @Override protected GT_Multiblock_Tooltip_Builder createTooltip() { final GT_Multiblock_Tooltip_Builder tt = new GT_Multiblock_Tooltip_Builder(); - tt.addMachineType("Assembling Line") - .addInfo("Controller block for the Advanced Assembling Line") + tt.addMachineType("Assembling Line").addInfo("Controller block for the Advanced Assembling Line") .addInfo("Built exactly the same as standard Assembling Line") .addInfo("Place in world to get more info. It will be a lengthy read.") - .addInfo("Assembling Line with item pipelining") - .addInfo("All fluids are however consumed at start") + .addInfo("Assembling Line with item pipelining").addInfo("All fluids are however consumed at start") .addInfo("Use voltage of worst energy hatch for overclocking") - .addInfo("EU/t is (number of slices working) * (overclocked EU/t)") - .addSeparator() + .addInfo("EU/t is (number of slices working) * (overclocked EU/t)").addSeparator() .beginVariableStructureBlock(5, 16, 4, 4, 3, 3, false) .addStructureInfo("From Bottom to Top, Left to Right") .addStructureInfo( @@ -295,10 +259,8 @@ public class MTE_AdvAssLine extends GT_MetaTileEntity_ExtendedPowerMultiBlockBas .addStructureInfo("Layer 3 - Grate Machine Casing, Assembler Machine Casing, Grate Machine Casing") .addStructureInfo("Layer 4 - Empty, Solid Steel Machine Casing, Empty") .addStructureInfo("Up to 16 repeating slices, each one allows for 1 more item in recipes") - .addController("Either Grate on layer 3 of the first slice") - .addEnergyHatch("Any layer 4 casing", 1) - .addMaintenanceHatch("Any layer 1 casing", 3) - .addInputBus("As specified on layer 1", 4, 5) + .addController("Either Grate on layer 3 of the first slice").addEnergyHatch("Any layer 4 casing", 1) + .addMaintenanceHatch("Any layer 1 casing", 3).addInputBus("As specified on layer 1", 4, 5) .addInputHatch("Any layer 1 casing", 3) .addOutputBus("Replaces Input Bus on final slice or on any solid steel casing on layer 1", 4) .addOtherStructurePart("Data Access Hatch", "Optional, next to controller", 2) @@ -332,7 +294,9 @@ public class MTE_AdvAssLine extends GT_MetaTileEntity_ExtendedPowerMultiBlockBas if (getBaseMetaTileEntity().isActive() && GT_Utility.isStackValid(currentStick)) { aNBT.setTag(TAG_KEY_CURRENT_STICK, currentStick.writeToNBT(new NBTTagCompound())); aNBT.setInteger("mRecipeHash", currentRecipe.getPersistentHash()); - aNBT.setIntArray(TAG_KEY_PROGRESS_TIMES, Arrays.stream(slices).limit(currentRecipe.mInputs.length).mapToInt(s -> s.progress).toArray()); + aNBT.setIntArray( + TAG_KEY_PROGRESS_TIMES, + Arrays.stream(slices).limit(currentRecipe.mInputs.length).mapToInt(s -> s.progress).toArray()); aNBT.setBoolean("stuck", stuck); aNBT.setLong("inputV", inputVoltage); aNBT.setLong("inputEU", inputEUt); @@ -353,13 +317,13 @@ public class MTE_AdvAssLine extends GT_MetaTileEntity_ExtendedPowerMultiBlockBas if (arr[i] == 0) // this will be synced to client by first MTE packet to client stuck = true; - } else - slices[i].reset(); + } else slices[i].reset(); } } if (aNBT.hasKey(TAG_KEY_CURRENT_STICK, Constants.NBT.TAG_COMPOUND)) { loadedStack = ItemStack.loadItemStackFromNBT(aNBT.getCompoundTag(TAG_KEY_CURRENT_STICK)); - GT_AssemblyLineUtils.LookupResult lookupResult = GT_AssemblyLineUtils.findAssemblyLineRecipeFromDataStick(loadedStack, false); + GT_AssemblyLineUtils.LookupResult lookupResult = GT_AssemblyLineUtils + .findAssemblyLineRecipeFromDataStick(loadedStack, false); switch (lookupResult.getType()) { case VALID_STACK_AND_VALID_HASH: recipe = lookupResult.getRecipe(); @@ -417,12 +381,10 @@ public class MTE_AdvAssLine extends GT_MetaTileEntity_ExtendedPowerMultiBlockBas } private void recordEnergySupplier(GT_MetaTileEntity_Hatch hatch) { - if (!isValidMetaTileEntity(hatch)) - return; + if (!isValidMetaTileEntity(hatch)) return; inputEUt += hatch.maxEUInput() * hatch.maxWorkingAmperesIn(); inputVoltage = Math.min(inputVoltage, hatch.maxEUInput()); - if (inputEUt < 0) - inputEUt = Long.MAX_VALUE; + if (inputEUt < 0) inputEUt = Long.MAX_VALUE; } @Override @@ -435,8 +397,7 @@ public class MTE_AdvAssLine extends GT_MetaTileEntity_ExtendedPowerMultiBlockBas @Override protected void endRecipeProcessing() { - if (!processing) - return; + if (!processing) return; super.endRecipeProcessing(); processing = false; } @@ -445,8 +406,7 @@ public class MTE_AdvAssLine extends GT_MetaTileEntity_ExtendedPowerMultiBlockBas public void onValueUpdate(byte aValue) { boolean oStuck = stuck; stuck = (aValue & 1) == 1; - if (oStuck != stuck) - getBaseMetaTileEntity().issueTextureUpdate(); + if (oStuck != stuck) getBaseMetaTileEntity().issueTextureUpdate(); } @Override @@ -488,8 +448,7 @@ public class MTE_AdvAssLine extends GT_MetaTileEntity_ExtendedPowerMultiBlockBas mProgresstime = (slice.id + 1) * (mMaxProgresstime / currentRecipe.mInputs.length) - slice.progress; } } - if (slice.progress > 0) - working++; + if (slice.progress > 0) working++; } lEUt = working * baseEUt; @@ -503,11 +462,9 @@ public class MTE_AdvAssLine extends GT_MetaTileEntity_ExtendedPowerMultiBlockBas } } } else { - if (!super.onRunningTick(aStack)) - return false; + if (!super.onRunningTick(aStack)) return false; } - if (getBaseMetaTileEntity().isAllowedToWork()) { if (hasAllFluids(currentRecipe) && slices[0].start()) { drainAllFluids(currentRecipe); @@ -520,8 +477,8 @@ public class MTE_AdvAssLine extends GT_MetaTileEntity_ExtendedPowerMultiBlockBas } private GT_Recipe.GT_Recipe_AssemblyLine findRecipe(ItemStack tDataStick) { - GT_AssemblyLineUtils.LookupResult tLookupResult = - GT_AssemblyLineUtils.findAssemblyLineRecipeFromDataStick(tDataStick, false); + GT_AssemblyLineUtils.LookupResult tLookupResult = GT_AssemblyLineUtils + .findAssemblyLineRecipeFromDataStick(tDataStick, false); if (tLookupResult.getType() == GT_AssemblyLineUtils.LookupResultType.INVALID_STICK) return null; @@ -541,8 +498,7 @@ public class MTE_AdvAssLine extends GT_MetaTileEntity_ExtendedPowerMultiBlockBas // Check Inputs align int aItemCount = tRecipe.mInputs.length; - if (mInputBusses.size() < aItemCount) - return null; + if (mInputBusses.size() < aItemCount) return null; for (int i = 0; i < aItemCount; i++) { GT_MetaTileEntity_Hatch_InputBus tInputBus = mInputBusses.get(i); if (tInputBus == null) { @@ -558,8 +514,7 @@ public class MTE_AdvAssLine extends GT_MetaTileEntity_ExtendedPowerMultiBlockBas } // Check Fluid Inputs align - if (!hasAllFluids(tRecipe)) - return null; + if (!hasAllFluids(tRecipe)) return null; if (GT_Values.D1) { GT_FML_LOGGER.info("Check overclock"); @@ -572,8 +527,7 @@ public class MTE_AdvAssLine extends GT_MetaTileEntity_ExtendedPowerMultiBlockBas private boolean hasAllFluids(GT_Recipe.GT_Recipe_AssemblyLine tRecipe) { int aFluidCount = tRecipe.mFluidInputs.length; - if (mInputHatches.size() < aFluidCount) - return false; + if (mInputHatches.size() < aFluidCount) return false; for (int i = 0; i < aFluidCount; i++) { GT_MetaTileEntity_Hatch_Input tInputHatch = mInputHatches.get(i); if (!isValidMetaTileEntity(tInputHatch)) { @@ -645,16 +599,18 @@ public class MTE_AdvAssLine extends GT_MetaTileEntity_ExtendedPowerMultiBlockBas // we use the new oc calculator instead // calculateOverclockedNessMulti from super class has a mysterious 5% cable loss thing at the moment // of writing - GT_OverclockCalculator ocCalc = new GT_OverclockCalculator() - .setRecipeEUt(currentRecipe.mEUt) - .setDuration(Math.max(recipe.mDuration / recipe.mInputs.length, 1)) - .setEUt(inputVoltage); + GT_OverclockCalculator ocCalc = new GT_OverclockCalculator().setRecipeEUt(currentRecipe.mEUt) + .setDuration(Math.max(recipe.mDuration / recipe.mInputs.length, 1)).setEUt(inputVoltage); // since we already checked mEUt <= inputVoltage, no need to check if recipe is too OP lEUt = ocCalc.getConsumption(); mMaxProgresstime = ocCalc.getDuration(); // then laser overclock if needed if (!mExoticEnergyHatches.isEmpty()) { - OverclockHelper.OverclockOutput laserOverclock = OverclockHelper.laserOverclock(lEUt, mMaxProgresstime, inputEUt / recipe.mInputs.length, ConfigurationHandler.INSTANCE.getLaserOCPenaltyFactor()); + OverclockHelper.OverclockOutput laserOverclock = OverclockHelper.laserOverclock( + lEUt, + mMaxProgresstime, + inputEUt / recipe.mInputs.length, + ConfigurationHandler.INSTANCE.getLaserOCPenaltyFactor()); if (laserOverclock != null) { lEUt = laserOverclock.getEUt(); mMaxProgresstime = laserOverclock.getDuration(); @@ -684,7 +640,7 @@ public class MTE_AdvAssLine extends GT_MetaTileEntity_ExtendedPowerMultiBlockBas } drainAllFluids(recipe); - mOutputItems = new ItemStack[]{recipe.mOutput}; + mOutputItems = new ItemStack[] { recipe.mOutput }; if (this.lEUt > 0) { this.lEUt = -this.lEUt; @@ -726,17 +682,21 @@ public class MTE_AdvAssLine extends GT_MetaTileEntity_ExtendedPowerMultiBlockBas } @Override - public void getWailaBody(ItemStack itemStack, List<String> currentTip, IWailaDataAccessor accessor, IWailaConfigHandler config) { + public void getWailaBody(ItemStack itemStack, List<String> currentTip, IWailaDataAccessor accessor, + IWailaConfigHandler config) { super.getWailaBody(itemStack, currentTip, accessor, config); NBTTagCompound tag = accessor.getNBTData(); String machineProgressString = GT_Waila.getMachineProgressString( - tag.getBoolean("isActive"), tag.getInteger("maxProgress"), tag.getInteger("progress")); + tag.getBoolean("isActive"), + tag.getInteger("maxProgress"), + tag.getInteger("progress")); currentTip.remove(machineProgressString); int duration = tag.getInteger("mDuration"); if (tag.hasKey(TAG_KEY_PROGRESS_TIMES, Constants.NBT.TAG_LIST)) { NBTTagList tl = tag.getTagList(TAG_KEY_PROGRESS_TIMES, Constants.NBT.TAG_INT); - @SuppressWarnings("unchecked") List<NBTTagInt> list = tl.tagList; + @SuppressWarnings("unchecked") + List<NBTTagInt> list = tl.tagList; for (int i = 0, listSize = list.size(); i < listSize; i++) { NBTTagInt t = list.get(i); int progress = t.func_150287_d(); @@ -745,16 +705,23 @@ public class MTE_AdvAssLine extends GT_MetaTileEntity_ExtendedPowerMultiBlockBas } else if (progress < 0) { currentTip.add(I18n.format("ggfab.waila.advassline.slice.idle", i + 1)); } else if (duration > 40) { - currentTip.add(I18n.format("ggfab.waila.advassline.slice", i + 1, (duration - progress) / 20, duration / 20)); + currentTip.add( + I18n.format( + "ggfab.waila.advassline.slice", + i + 1, + (duration - progress) / 20, + duration / 20)); } else { - currentTip.add(I18n.format("ggfab.waila.advassline.slice.small", i + 1, duration - progress, duration)); + currentTip.add( + I18n.format("ggfab.waila.advassline.slice.small", i + 1, duration - progress, duration)); } } } } @Override - public void getWailaNBTData(EntityPlayerMP player, TileEntity tile, NBTTagCompound tag, World world, int x, int y, int z) { + public void getWailaNBTData(EntityPlayerMP player, TileEntity tile, NBTTagCompound tag, World world, int x, int y, + int z) { super.getWailaNBTData(player, tile, tag, world, x, y, z); if (currentRecipe == null || !getBaseMetaTileEntity().isActive()) return; NBTTagList l = new NBTTagList(); @@ -793,6 +760,7 @@ public class MTE_AdvAssLine extends GT_MetaTileEntity_ExtendedPowerMultiBlockBas } private class Slice { + private final int id; private int progress = -1; @@ -805,31 +773,26 @@ public class MTE_AdvAssLine extends GT_MetaTileEntity_ExtendedPowerMultiBlockBas } public void tick() { - if (progress < 0) - return; + if (progress < 0) return; if (progress == 0 || --progress == 0) { // id==0 will be end of chain if 1 input, so we need a +1 here if (id + 1 >= currentRecipe.mInputs.length) { addOutput(currentRecipe.mOutput); reset(); } else { - if (slices[id + 1].start()) - reset(); - else - stuck = true; + if (slices[id + 1].start()) reset(); + else stuck = true; } } } public boolean start() { - if (progress >= 0) - return false; + if (progress >= 0) return false; startRecipeProcessing(); GT_MetaTileEntity_Hatch_InputBus bus = mInputBusses.get(id); ItemStack stack = bus.getStackInSlot(0); int size = isStackValidIngredient(stack, currentRecipe.mInputs[id], currentRecipe.mOreDictAlt[id]); - if (size < 0) - return false; + if (size < 0) return false; progress = mMaxProgresstime / currentRecipe.mInputs.length; stack.stackSize -= size; bus.updateSlots(); @@ -850,14 +813,12 @@ public class MTE_AdvAssLine extends GT_MetaTileEntity_ExtendedPowerMultiBlockBas @Override public String toString() { - return "Slice{" + - "id=" + id + - ", progress=" + progress + - '}'; + return "Slice{" + "id=" + id + ", progress=" + progress + '}'; } } private enum DataHatchElement implements IHatchElement<MTE_AdvAssLine> { + DataAccess; @Override |