diff options
author | boubou19 <miisterunknown@gmail.com> | 2023-04-01 18:11:43 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-04-01 18:11:43 +0200 |
commit | 5f50e4a36ec000657b0a1664784acf00275293c6 (patch) | |
tree | 5ef81441032735438c9fd9c620224ca58e46e537 /src/main/java/gregtech/common/tileentities/machines/basic | |
parent | 6b77557e0e87cf5afd9ebd3985323ff1249e615c (diff) | |
download | GT5-Unofficial-5f50e4a36ec000657b0a1664784acf00275293c6.tar.gz GT5-Unofficial-5f50e4a36ec000657b0a1664784acf00275293c6.tar.bz2 GT5-Unofficial-5f50e4a36ec000657b0a1664784acf00275293c6.zip |
update spotless formatting (#1827)
Diffstat (limited to 'src/main/java/gregtech/common/tileentities/machines/basic')
17 files changed, 1088 insertions, 496 deletions
diff --git a/src/main/java/gregtech/common/tileentities/machines/basic/GT_MetaTileEntity_AdvSeismicProspector.java b/src/main/java/gregtech/common/tileentities/machines/basic/GT_MetaTileEntity_AdvSeismicProspector.java index 34589d2c1c..ad55276576 100644 --- a/src/main/java/gregtech/common/tileentities/machines/basic/GT_MetaTileEntity_AdvSeismicProspector.java +++ b/src/main/java/gregtech/common/tileentities/machines/basic/GT_MetaTileEntity_AdvSeismicProspector.java @@ -56,28 +56,52 @@ public class GT_MetaTileEntity_AdvSeismicProspector extends GT_MetaTileEntity_Ba "", // NEI name TextureFactory.of( TextureFactory.of(OVERLAY_SIDE_ROCK_BREAKER_ACTIVE), - TextureFactory.builder().addIcon(OVERLAY_SIDE_ROCK_BREAKER_ACTIVE_GLOW).glow().build()), + TextureFactory.builder() + .addIcon(OVERLAY_SIDE_ROCK_BREAKER_ACTIVE_GLOW) + .glow() + .build()), TextureFactory.of( TextureFactory.of(OVERLAY_SIDE_ROCK_BREAKER), - TextureFactory.builder().addIcon(OVERLAY_SIDE_ROCK_BREAKER_GLOW).glow().build()), + TextureFactory.builder() + .addIcon(OVERLAY_SIDE_ROCK_BREAKER_GLOW) + .glow() + .build()), TextureFactory.of( TextureFactory.of(OVERLAY_TOP_ROCK_BREAKER_ACTIVE), - TextureFactory.builder().addIcon(OVERLAY_TOP_ROCK_BREAKER_ACTIVE_GLOW).glow().build()), + TextureFactory.builder() + .addIcon(OVERLAY_TOP_ROCK_BREAKER_ACTIVE_GLOW) + .glow() + .build()), TextureFactory.of( TextureFactory.of(OVERLAY_TOP_ROCK_BREAKER), - TextureFactory.builder().addIcon(OVERLAY_TOP_ROCK_BREAKER_GLOW).glow().build()), + TextureFactory.builder() + .addIcon(OVERLAY_TOP_ROCK_BREAKER_GLOW) + .glow() + .build()), TextureFactory.of( TextureFactory.of(OVERLAY_FRONT_ROCK_BREAKER_ACTIVE), - TextureFactory.builder().addIcon(OVERLAY_FRONT_ROCK_BREAKER_ACTIVE_GLOW).glow().build()), + TextureFactory.builder() + .addIcon(OVERLAY_FRONT_ROCK_BREAKER_ACTIVE_GLOW) + .glow() + .build()), TextureFactory.of( TextureFactory.of(OVERLAY_FRONT_ROCK_BREAKER), - TextureFactory.builder().addIcon(OVERLAY_FRONT_ROCK_BREAKER_GLOW).glow().build()), + TextureFactory.builder() + .addIcon(OVERLAY_FRONT_ROCK_BREAKER_GLOW) + .glow() + .build()), TextureFactory.of( TextureFactory.of(OVERLAY_BOTTOM_ROCK_BREAKER_ACTIVE), - TextureFactory.builder().addIcon(OVERLAY_BOTTOM_ROCK_BREAKER_ACTIVE_GLOW).glow().build()), + TextureFactory.builder() + .addIcon(OVERLAY_BOTTOM_ROCK_BREAKER_ACTIVE_GLOW) + .glow() + .build()), TextureFactory.of( TextureFactory.of(OVERLAY_BOTTOM_ROCK_BREAKER), - TextureFactory.builder().addIcon(OVERLAY_BOTTOM_ROCK_BREAKER_GLOW).glow().build())); + TextureFactory.builder() + .addIcon(OVERLAY_BOTTOM_ROCK_BREAKER_GLOW) + .glow() + .build())); radius = aRadius; step = aStep; } @@ -142,10 +166,14 @@ public class GT_MetaTileEntity_AdvSeismicProspector extends GT_MetaTileEntity_Ba GT_Utility.ItemNBT.setAdvancedProspectionData( mTier, aStack, - this.getBaseMetaTileEntity().getXCoord(), - this.getBaseMetaTileEntity().getYCoord(), - this.getBaseMetaTileEntity().getZCoord(), - this.getBaseMetaTileEntity().getWorld().provider.dimensionId, + this.getBaseMetaTileEntity() + .getXCoord(), + this.getBaseMetaTileEntity() + .getYCoord(), + this.getBaseMetaTileEntity() + .getZCoord(), + this.getBaseMetaTileEntity() + .getWorld().provider.dimensionId, tOils, GT_Utility.sortByValueToList(tOres), radius); @@ -173,9 +201,10 @@ public class GT_MetaTileEntity_AdvSeismicProspector extends GT_MetaTileEntity_Ba for (int i = 0; i < oilfieldSize; i++) { for (int j = 0; j < oilfieldSize; j++) { - Chunk tChunk = getBaseMetaTileEntity().getWorld().getChunkFromChunkCoords( - xChunk + i + x * oilfieldSize, - zChunk + j + z * oilfieldSize); + Chunk tChunk = getBaseMetaTileEntity().getWorld() + .getChunkFromChunkCoords( + xChunk + i + x * oilfieldSize, + zChunk + j + z * oilfieldSize); FluidStack tFluid = undergroundOilReadInformation(tChunk); if (tFluid != null) { if (tFluid.amount > max) max = tFluid.amount; @@ -187,17 +216,28 @@ public class GT_MetaTileEntity_AdvSeismicProspector extends GT_MetaTileEntity_Ba } } - aOils.add(++oilFieldCount + "," + min + "-" + max + "," + tFluids.get(cInts).getLocalizedName()); + aOils.add( + ++oilFieldCount + "," + + min + + "-" + + max + + "," + + tFluids.get(cInts) + .getLocalizedName()); } } } catch (Exception ignored) {} } private void prospectOres(Map<String, Integer> aOres) { - int tLeftXBound = this.getBaseMetaTileEntity().getXCoord() - radius; + int tLeftXBound = this.getBaseMetaTileEntity() + .getXCoord() + - radius; int tRightXBound = tLeftXBound + 2 * radius; - int tLeftZBound = this.getBaseMetaTileEntity().getZCoord() - radius; + int tLeftZBound = this.getBaseMetaTileEntity() + .getZCoord() + - radius; int tRightZBound = tLeftZBound + 2 * radius; for (int i = tLeftXBound; i <= tRightXBound; i += step) { @@ -217,17 +257,20 @@ public class GT_MetaTileEntity_AdvSeismicProspector extends GT_MetaTileEntity_Ba private void prospectHole(int i, int k, Map<String, Integer> aOres) { String tFoundOre; - for (int j = this.getBaseMetaTileEntity().getYCoord(); j > 0; j--) { + for (int j = this.getBaseMetaTileEntity() + .getYCoord(); j > 0; j--) { tFoundOre = checkForOre(i, j, k); if (tFoundOre != null) countOre(aOres, tFoundOre, cX, cZ); } } private String checkForOre(int x, int y, int z) { - Block tBlock = this.getBaseMetaTileEntity().getBlock(x, y, z); + Block tBlock = this.getBaseMetaTileEntity() + .getBlock(x, y, z); if (tBlock instanceof GT_Block_Ores_Abstract) { - TileEntity tTileEntity = getBaseMetaTileEntity().getWorld().getTileEntity(x, y, z); + TileEntity tTileEntity = getBaseMetaTileEntity().getWorld() + .getTileEntity(x, y, z); if ((tTileEntity instanceof GT_TileEntity_Ores) && (((GT_TileEntity_Ores) tTileEntity).mMetaData < 16000)) { // Filtering // small @@ -238,10 +281,12 @@ public class GT_MetaTileEntity_AdvSeismicProspector extends GT_MetaTileEntity_Ba if ((tMaterial != null) && (tMaterial != Materials._NULL)) return tMaterial.mDefaultLocalName; } } else { - int tMetaID = getBaseMetaTileEntity().getWorld().getBlockMetadata(x, y, z); + int tMetaID = getBaseMetaTileEntity().getWorld() + .getBlockMetadata(x, y, z); ItemStack is = new ItemStack(tBlock, 1, tMetaID); ItemData association = GT_OreDictUnificator.getAssociation(is); - if ((association != null) && (association.mPrefix.toString().startsWith("ore"))) + if ((association != null) && (association.mPrefix.toString() + .startsWith("ore"))) return association.mMaterial.mMaterial.mDefaultLocalName; else if (GT_Utility.isOre(tBlock, tMetaID)) return tBlock.getLocalizedName(); } diff --git a/src/main/java/gregtech/common/tileentities/machines/basic/GT_MetaTileEntity_Boxinator.java b/src/main/java/gregtech/common/tileentities/machines/basic/GT_MetaTileEntity_Boxinator.java index f94b8404fa..1b30282781 100644 --- a/src/main/java/gregtech/common/tileentities/machines/basic/GT_MetaTileEntity_Boxinator.java +++ b/src/main/java/gregtech/common/tileentities/machines/basic/GT_MetaTileEntity_Boxinator.java @@ -34,28 +34,52 @@ public class GT_MetaTileEntity_Boxinator extends GT_MetaTileEntity_BasicMachine "", TextureFactory.of( TextureFactory.of(OVERLAY_SIDE_BOXINATOR_ACTIVE), - TextureFactory.builder().addIcon(OVERLAY_SIDE_BOXINATOR_ACTIVE_GLOW).glow().build()), + TextureFactory.builder() + .addIcon(OVERLAY_SIDE_BOXINATOR_ACTIVE_GLOW) + .glow() + .build()), TextureFactory.of( TextureFactory.of(OVERLAY_SIDE_BOXINATOR), - TextureFactory.builder().addIcon(OVERLAY_SIDE_BOXINATOR_GLOW).glow().build()), + TextureFactory.builder() + .addIcon(OVERLAY_SIDE_BOXINATOR_GLOW) + .glow() + .build()), TextureFactory.of( TextureFactory.of(OVERLAY_FRONT_BOXINATOR_ACTIVE), - TextureFactory.builder().addIcon(OVERLAY_FRONT_BOXINATOR_ACTIVE_GLOW).glow().build()), + TextureFactory.builder() + .addIcon(OVERLAY_FRONT_BOXINATOR_ACTIVE_GLOW) + .glow() + .build()), TextureFactory.of( TextureFactory.of(OVERLAY_FRONT_BOXINATOR), - TextureFactory.builder().addIcon(OVERLAY_FRONT_BOXINATOR_GLOW).glow().build()), + TextureFactory.builder() + .addIcon(OVERLAY_FRONT_BOXINATOR_GLOW) + .glow() + .build()), TextureFactory.of( TextureFactory.of(OVERLAY_TOP_BOXINATOR_ACTIVE), - TextureFactory.builder().addIcon(OVERLAY_TOP_BOXINATOR_ACTIVE_GLOW).glow().build()), + TextureFactory.builder() + .addIcon(OVERLAY_TOP_BOXINATOR_ACTIVE_GLOW) + .glow() + .build()), TextureFactory.of( TextureFactory.of(OVERLAY_TOP_BOXINATOR), - TextureFactory.builder().addIcon(OVERLAY_TOP_BOXINATOR_GLOW).glow().build()), + TextureFactory.builder() + .addIcon(OVERLAY_TOP_BOXINATOR_GLOW) + .glow() + .build()), TextureFactory.of( TextureFactory.of(OVERLAY_BOTTOM_BOXINATOR_ACTIVE), - TextureFactory.builder().addIcon(OVERLAY_BOTTOM_BOXINATOR_ACTIVE_GLOW).glow().build()), + TextureFactory.builder() + .addIcon(OVERLAY_BOTTOM_BOXINATOR_ACTIVE_GLOW) + .glow() + .build()), TextureFactory.of( TextureFactory.of(OVERLAY_BOTTOM_BOXINATOR), - TextureFactory.builder().addIcon(OVERLAY_BOTTOM_BOXINATOR_GLOW).glow().build())); + TextureFactory.builder() + .addIcon(OVERLAY_BOTTOM_BOXINATOR_GLOW) + .glow() + .build())); } public GT_MetaTileEntity_Boxinator(String aName, int aTier, String aDescription, ITexture[][][] aTextures, @@ -203,8 +227,16 @@ public class GT_MetaTileEntity_Boxinator extends GT_MetaTileEntity_BasicMachine && GT_ModHandler.getRecipeOutput(aStack, aStack, null, aStack, aStack) != null) { return true; } - return ItemList.Schematic_3by3.isStackEqual(getInputAt(1)) && (GT_ModHandler - .getRecipeOutput(aStack, aStack, aStack, aStack, aStack, aStack, aStack, aStack, aStack) != null); + return ItemList.Schematic_3by3.isStackEqual(getInputAt(1)) && (GT_ModHandler.getRecipeOutput( + aStack, + aStack, + aStack, + aStack, + aStack, + aStack, + aStack, + aStack, + aStack) != null); } else { return GT_Recipe.GT_Recipe_Map.sBoxinatorRecipes.containsInput(aStack); } diff --git a/src/main/java/gregtech/common/tileentities/machines/basic/GT_MetaTileEntity_CuringOven.java b/src/main/java/gregtech/common/tileentities/machines/basic/GT_MetaTileEntity_CuringOven.java index 2cab223249..fb0bbfb4c2 100644 --- a/src/main/java/gregtech/common/tileentities/machines/basic/GT_MetaTileEntity_CuringOven.java +++ b/src/main/java/gregtech/common/tileentities/machines/basic/GT_MetaTileEntity_CuringOven.java @@ -31,16 +31,16 @@ public class GT_MetaTileEntity_CuringOven extends GT_MetaTileEntity_BasicMachine 1, "E_Oven.png", "", - TextureFactory - .of(new Textures.BlockIcons.CustomIcon("basicmachines/ELECTRIC_OVEN/OVERLAY_SIDE_ACTIVE")), + TextureFactory.of( + new Textures.BlockIcons.CustomIcon("basicmachines/ELECTRIC_OVEN/OVERLAY_SIDE_ACTIVE")), TextureFactory.of(new Textures.BlockIcons.CustomIcon("basicmachines/ELECTRIC_OVEN/OVERLAY_SIDE")), - TextureFactory - .of(new Textures.BlockIcons.CustomIcon("basicmachines/ELECTRIC_OVEN/OVERLAY_FRONT_ACTIVE")), + TextureFactory.of( + new Textures.BlockIcons.CustomIcon("basicmachines/ELECTRIC_OVEN/OVERLAY_FRONT_ACTIVE")), TextureFactory.of(new Textures.BlockIcons.CustomIcon("basicmachines/ELECTRIC_OVEN/OVERLAY_FRONT")), TextureFactory.of(new Textures.BlockIcons.CustomIcon("basicmachines/ELECTRIC_OVEN/OVERLAY_TOP_ACTIVE")), TextureFactory.of(new Textures.BlockIcons.CustomIcon("basicmachines/ELECTRIC_OVEN/OVERLAY_TOP")), - TextureFactory - .of(new Textures.BlockIcons.CustomIcon("basicmachines/ELECTRIC_OVEN/OVERLAY_BOTTOM_ACTIVE")), + TextureFactory.of( + new Textures.BlockIcons.CustomIcon("basicmachines/ELECTRIC_OVEN/OVERLAY_BOTTOM_ACTIVE")), TextureFactory.of(new Textures.BlockIcons.CustomIcon("basicmachines/ELECTRIC_OVEN/OVERLAY_BOTTOM"))); } @@ -86,7 +86,8 @@ public class GT_MetaTileEntity_CuringOven extends GT_MetaTileEntity_BasicMachine NBTTagCompound aNBT = tStack.getTagCompound(); if (aNBT != null) { int tHeat = 300; - long tWorldTime = getBaseMetaTileEntity().getWorld().getTotalWorldTime(); + long tWorldTime = getBaseMetaTileEntity().getWorld() + .getTotalWorldTime(); aNBT = aNBT.getCompoundTag("GT.ToolStats"); if (aNBT != null && aNBT.hasKey("Heat")) { tHeat = aNBT.getInteger("Heat"); diff --git a/src/main/java/gregtech/common/tileentities/machines/basic/GT_MetaTileEntity_Disassembler.java b/src/main/java/gregtech/common/tileentities/machines/basic/GT_MetaTileEntity_Disassembler.java index 595953c06f..a0d22efd5d 100644 --- a/src/main/java/gregtech/common/tileentities/machines/basic/GT_MetaTileEntity_Disassembler.java +++ b/src/main/java/gregtech/common/tileentities/machines/basic/GT_MetaTileEntity_Disassembler.java @@ -58,28 +58,52 @@ public class GT_MetaTileEntity_Disassembler extends GT_MetaTileEntity_BasicMachi // Textures TextureFactory.of( TextureFactory.of(OVERLAY_SIDE_DISASSEMBLER_ACTIVE), - TextureFactory.builder().addIcon(OVERLAY_SIDE_DISASSEMBLER_ACTIVE_GLOW).glow().build()), + TextureFactory.builder() + .addIcon(OVERLAY_SIDE_DISASSEMBLER_ACTIVE_GLOW) + .glow() + .build()), TextureFactory.of( TextureFactory.of(OVERLAY_SIDE_DISASSEMBLER), - TextureFactory.builder().addIcon(OVERLAY_SIDE_DISASSEMBLER_GLOW).glow().build()), + TextureFactory.builder() + .addIcon(OVERLAY_SIDE_DISASSEMBLER_GLOW) + .glow() + .build()), TextureFactory.of( TextureFactory.of(OVERLAY_FRONT_DISASSEMBLER_ACTIVE), - TextureFactory.builder().addIcon(OVERLAY_FRONT_DISASSEMBLER_ACTIVE_GLOW).glow().build()), + TextureFactory.builder() + .addIcon(OVERLAY_FRONT_DISASSEMBLER_ACTIVE_GLOW) + .glow() + .build()), TextureFactory.of( TextureFactory.of(OVERLAY_FRONT_DISASSEMBLER), - TextureFactory.builder().addIcon(OVERLAY_FRONT_DISASSEMBLER_GLOW).glow().build()), + TextureFactory.builder() + .addIcon(OVERLAY_FRONT_DISASSEMBLER_GLOW) + .glow() + .build()), TextureFactory.of( TextureFactory.of(OVERLAY_TOP_DISASSEMBLER_ACTIVE), - TextureFactory.builder().addIcon(OVERLAY_TOP_DISASSEMBLER_ACTIVE_GLOW).glow().build()), + TextureFactory.builder() + .addIcon(OVERLAY_TOP_DISASSEMBLER_ACTIVE_GLOW) + .glow() + .build()), TextureFactory.of( TextureFactory.of(OVERLAY_TOP_DISASSEMBLER), - TextureFactory.builder().addIcon(OVERLAY_TOP_DISASSEMBLER_GLOW).glow().build()), + TextureFactory.builder() + .addIcon(OVERLAY_TOP_DISASSEMBLER_GLOW) + .glow() + .build()), TextureFactory.of( TextureFactory.of(OVERLAY_BOTTOM_DISASSEMBLER_ACTIVE), - TextureFactory.builder().addIcon(OVERLAY_BOTTOM_DISASSEMBLER_ACTIVE_GLOW).glow().build()), + TextureFactory.builder() + .addIcon(OVERLAY_BOTTOM_DISASSEMBLER_ACTIVE_GLOW) + .glow() + .build()), TextureFactory.of( TextureFactory.of(OVERLAY_BOTTOM_DISASSEMBLER), - TextureFactory.builder().addIcon(OVERLAY_BOTTOM_DISASSEMBLER_GLOW).glow().build())); + TextureFactory.builder() + .addIcon(OVERLAY_BOTTOM_DISASSEMBLER_GLOW) + .glow() + .build())); } public GT_MetaTileEntity_Disassembler(String aName, int aTier, String aDescription, ITexture[][][] aTextures, @@ -184,7 +208,8 @@ public class GT_MetaTileEntity_Disassembler extends GT_MetaTileEntity_BasicMachi if (GT_Utility.isStackInvalid(is)) return DID_NOT_FIND_RECIPE; if (is.getItem() instanceof GT_MetaGenerated_Tool || isCircuit(is) - || blackList.stream().anyMatch(t -> GT_Utility.areStacksEqual(t.toStack(), is, true)) + || blackList.stream() + .anyMatch(t -> GT_Utility.areStacksEqual(t.toStack(), is, true)) || compareToUnpacker(is)) return DID_NOT_FIND_RECIPE; @@ -200,9 +225,10 @@ public class GT_MetaTileEntity_Disassembler extends GT_MetaTileEntity_BasicMachi ItemStack in = is.copy(); in.stackSize = 1; if (stack.isStackEqual(in) && stack.mStackSize <= is.stackSize) { - return setOutputsAndTime(outputHardOverrides.get(stack).toArray(new ItemStack[0]), stack.mStackSize) - ? FOUND_AND_SUCCESSFULLY_USED_RECIPE - : DID_NOT_FIND_RECIPE; + return setOutputsAndTime( + outputHardOverrides.get(stack) + .toArray(new ItemStack[0]), + stack.mStackSize) ? FOUND_AND_SUCCESSFULLY_USED_RECIPE : DID_NOT_FIND_RECIPE; } } return null; @@ -250,8 +276,12 @@ public class GT_MetaTileEntity_Disassembler extends GT_MetaTileEntity_BasicMachi } private int checkRecipeMap() { - GT_Recipe gt_recipe = GT_Recipe.GT_Recipe_Map.sDisassemblerRecipes - .findRecipe(this.getBaseMetaTileEntity(), true, this.maxEUInput(), null, this.getAllInputs()); + GT_Recipe gt_recipe = GT_Recipe.GT_Recipe_Map.sDisassemblerRecipes.findRecipe( + this.getBaseMetaTileEntity(), + true, + this.maxEUInput(), + null, + this.getAllInputs()); if (gt_recipe == null) return DID_NOT_FIND_RECIPE; if (gt_recipe.isRecipeInputEqual(false, null, this.getAllInputs())) { if (gt_recipe.mSpecialValue == -100) { @@ -285,17 +315,27 @@ public class GT_MetaTileEntity_Disassembler extends GT_MetaTileEntity_BasicMachi } private static DissassembleReference ensureDowncasting(Collection<? extends DissassembleReference> recipes) { - ItemStack[] inputs = recipes.stream().findFirst().orElseThrow(NullPointerException::new).inputs; - int EUt = recipes.stream().findFirst().orElseThrow(NullPointerException::new).EUt; + ItemStack[] inputs = recipes.stream() + .findFirst() + .orElseThrow(NullPointerException::new).inputs; + int EUt = recipes.stream() + .findFirst() + .orElseThrow(NullPointerException::new).EUt; ItemStack[] output = new ItemStack[inputs.length]; List<GT_Recipe> recipesColl = null; - if (recipes.size() > 1) recipesColl = recipes.stream().skip(1).map(x -> x.recipe).collect(Collectors.toList()); + if (recipes.size() > 1) recipesColl = recipes.stream() + .skip(1) + .map(x -> x.recipe) + .collect(Collectors.toList()); handleRecipeTransformation(inputs, output, recipesColl); return new DissassembleReference( - recipes.stream().mapToInt(x -> x.stackSize).min().orElseThrow(NumberFormatException::new), + recipes.stream() + .mapToInt(x -> x.stackSize) + .min() + .orElseThrow(NumberFormatException::new), output, null, EUt); @@ -305,8 +345,9 @@ public class GT_MetaTileEntity_Disassembler extends GT_MetaTileEntity_BasicMachi List<? extends GT_Recipe> recipesColl) { for (int i = 0, inputsLength = inputs.length; i < inputsLength; i++) { Set<ItemStack[]> inputsStacks = null; - if (recipesColl != null) - inputsStacks = recipesColl.stream().map(x -> x.mInputs).collect(Collectors.toSet()); + if (recipesColl != null) inputsStacks = recipesColl.stream() + .map(x -> x.mInputs) + .collect(Collectors.toSet()); handleRecipeTransformationInternal(inputs, output, inputsStacks, i); } addOthersAndHandleAlwaysReplace(inputs, output); @@ -360,25 +401,29 @@ public class GT_MetaTileEntity_Disassembler extends GT_MetaTileEntity_BasicMachi private static ItemStack handleUnification(ItemStack stack) { for (int oreID : OreDictionary.getOreIDs(stack)) { - for (int i = 0; i < OreDictionaryOverride[0].length; i++) - if (OreDictionary.getOreName(oreID).equals(OreDictionaryOverride[0][i])) { - ItemStack ret = ((ItemStack) OreDictionaryOverride[1][i]).copy(); - ret.stackSize = stack.stackSize; - return ret; - } + for (int i = 0; i < OreDictionaryOverride[0].length; i++) if (OreDictionary.getOreName(oreID) + .equals( + OreDictionaryOverride[0][i])) { + ItemStack ret = ((ItemStack) OreDictionaryOverride[1][i]).copy(); + ret.stackSize = stack.stackSize; + return ret; + } } return GT_OreDictUnificator.get(stack); } private static ItemStack handleWildcard(ItemStack stack) { - if (stack != null && stack.getItemDamage() == OreDictionary.WILDCARD_VALUE && !stack.getItem().isDamageable()) { + if (stack != null && stack.getItemDamage() == OreDictionary.WILDCARD_VALUE + && !stack.getItem() + .isDamageable()) { stack.setItemDamage(0); } return stack; } private static ItemStack handleContainerItem(ItemStack stack) { - if (stack != null && stack.getItem().hasContainerItem(stack)) { + if (stack != null && stack.getItem() + .hasContainerItem(stack)) { return null; } return stack; @@ -421,14 +466,20 @@ public class GT_MetaTileEntity_Disassembler extends GT_MetaTileEntity_BasicMachi } private static void handleAnyMaterials(Materials first, AtomicReference<? super Materials> toRpl) { - if (first.mOreReRegistrations.stream().anyMatch(y -> y.equals(Materials.AnyIron))) toRpl.set(Materials.Iron); - else if (first.mOreReRegistrations.stream().anyMatch(y -> y.equals(Materials.AnyCopper))) + if (first.mOreReRegistrations.stream() + .anyMatch(y -> y.equals(Materials.AnyIron))) + toRpl.set(Materials.Iron); + else if (first.mOreReRegistrations.stream() + .anyMatch(y -> y.equals(Materials.AnyCopper))) toRpl.set(Materials.Copper); - else if (first.mOreReRegistrations.stream().anyMatch(y -> y.equals(Materials.AnyRubber))) + else if (first.mOreReRegistrations.stream() + .anyMatch(y -> y.equals(Materials.AnyRubber))) toRpl.set(Materials.Rubber); - else if (first.mOreReRegistrations.stream().anyMatch(y -> y.equals(Materials.AnyBronze))) + else if (first.mOreReRegistrations.stream() + .anyMatch(y -> y.equals(Materials.AnyBronze))) toRpl.set(Materials.Bronze); - else if (first.mOreReRegistrations.stream().anyMatch(y -> y.equals(Materials.AnySyntheticRubber))) + else if (first.mOreReRegistrations.stream() + .anyMatch(y -> y.equals(Materials.AnySyntheticRubber))) toRpl.set(Materials.Rubber); } @@ -515,13 +566,31 @@ public class GT_MetaTileEntity_Disassembler extends GT_MetaTileEntity_BasicMachi AtomicInteger stacksize = new AtomicInteger(); // Check Recipe Maps for creation of Item List<DissassembleReference> possibleRecipes = GT_Recipe.GT_Recipe_Map.sAssemblerRecipes.mRecipeList.stream() - .filter(x -> Arrays.stream(x.mOutputs).anyMatch(y -> { - ItemStack out = is.copy(); - out.stackSize = y.stackSize; - boolean isDone = GT_Utility.areStacksEqual(y, out, true) && y.stackSize <= is.stackSize; - if (isDone) stacksize.set(y.stackSize); - return isDone; - })).map(x -> new DissassembleReference(stacksize.get(), x.mInputs, x)).collect(Collectors.toList()); + .filter( + x -> Arrays.stream( + x.mOutputs) + .anyMatch( + y -> { + ItemStack out = is.copy(); + out.stackSize = y.stackSize; + boolean isDone = GT_Utility.areStacksEqual( + y, + out, + true) + && y.stackSize + <= is.stackSize; + if (isDone) + stacksize.set( + y.stackSize); + return isDone; + })) + .map( + x -> new DissassembleReference( + stacksize.get(), + x.mInputs, + x)) + .collect( + Collectors.toList()); // Is there only one way to create it? if (possibleRecipes.size() == 1) return possibleRecipes; @@ -529,20 +598,26 @@ public class GT_MetaTileEntity_Disassembler extends GT_MetaTileEntity_BasicMachi // There are Multiple Ways -> Get recipe with cheapest inputs // More Inputs should mean cheaper Materials return possibleRecipes.stream() - .sorted(Comparator.comparingDouble(GT_MetaTileEntity_Disassembler::getCheaperInputs)) - .collect(Collectors.toList()); + .sorted(Comparator.comparingDouble(GT_MetaTileEntity_Disassembler::getCheaperInputs)) + .collect(Collectors.toList()); } private static double getCheaperInputs(GT_MetaTileEntity_Disassembler.DissassembleReference x) { - double fluidInputValueRaw = Arrays.stream(x.recipe.mFluidInputs).flatMapToInt(f -> IntStream.of(f.amount)) - .sum(); + double fluidInputValueRaw = Arrays.stream(x.recipe.mFluidInputs) + .flatMapToInt(f -> IntStream.of(f.amount)) + .sum(); fluidInputValueRaw = fluidInputValueRaw > 0 ? fluidInputValueRaw : 144D; - double inputValue = Arrays.stream(x.inputs).flatMapToInt(f -> IntStream.of(f.stackSize)).sum() + double inputValue = Arrays.stream(x.inputs) + .flatMapToInt(f -> IntStream.of(f.stackSize)) + .sum() + (fluidInputValueRaw / 144D); - double fluidOutputValueRaw = Arrays.stream(x.recipe.mFluidOutputs).flatMapToInt(f -> IntStream.of(f.amount)) - .sum(); + double fluidOutputValueRaw = Arrays.stream(x.recipe.mFluidOutputs) + .flatMapToInt(f -> IntStream.of(f.amount)) + .sum(); fluidOutputValueRaw = fluidOutputValueRaw > 0 ? fluidOutputValueRaw : 144D; - double outputValue = Arrays.stream(x.recipe.mOutputs).flatMapToInt(f -> IntStream.of(f.stackSize)).sum() + double outputValue = Arrays.stream(x.recipe.mOutputs) + .flatMapToInt(f -> IntStream.of(f.stackSize)) + .sum() + (fluidOutputValueRaw / 144D); return outputValue / inputValue; } @@ -556,7 +631,9 @@ public class GT_MetaTileEntity_Disassembler extends GT_MetaTileEntity_BasicMachi ItemStack aStack) { return super.allowPutStackValidated(aBaseMetaTileEntity, aIndex, aSide, aStack) && aStack.getTagCompound() != null - && aStack.getTagCompound().getCompoundTag("GT.CraftingComponents") != null; + && aStack.getTagCompound() + .getCompoundTag("GT.CraftingComponents") + != null; } @Override diff --git a/src/main/java/gregtech/common/tileentities/machines/basic/GT_MetaTileEntity_IndustrialApiary.java b/src/main/java/gregtech/common/tileentities/machines/basic/GT_MetaTileEntity_IndustrialApiary.java index d9dc75822d..70b9ecbc22 100644 --- a/src/main/java/gregtech/common/tileentities/machines/basic/GT_MetaTileEntity_IndustrialApiary.java +++ b/src/main/java/gregtech/common/tileentities/machines/basic/GT_MetaTileEntity_IndustrialApiary.java @@ -107,28 +107,52 @@ public class GT_MetaTileEntity_IndustrialApiary extends GT_MetaTileEntity_BasicM "", TextureFactory.of( TextureFactory.of(OVERLAY_SIDE_INDUSTRIAL_APIARY_ACTIVE), - TextureFactory.builder().addIcon(OVERLAY_SIDE_INDUSTRIAL_APIARY_ACTIVE_GLOW).glow().build()), + TextureFactory.builder() + .addIcon(OVERLAY_SIDE_INDUSTRIAL_APIARY_ACTIVE_GLOW) + .glow() + .build()), TextureFactory.of( TextureFactory.of(OVERLAY_SIDE_INDUSTRIAL_APIARY), - TextureFactory.builder().addIcon(OVERLAY_SIDE_INDUSTRIAL_APIARY_GLOW).glow().build()), + TextureFactory.builder() + .addIcon(OVERLAY_SIDE_INDUSTRIAL_APIARY_GLOW) + .glow() + .build()), TextureFactory.of( TextureFactory.of(OVERLAY_FRONT_INDUSTRIAL_APIARY_ACTIVE), - TextureFactory.builder().addIcon(OVERLAY_FRONT_INDUSTRIAL_APIARY_ACTIVE_GLOW).glow().build()), + TextureFactory.builder() + .addIcon(OVERLAY_FRONT_INDUSTRIAL_APIARY_ACTIVE_GLOW) + .glow() + .build()), TextureFactory.of( TextureFactory.of(OVERLAY_FRONT_INDUSTRIAL_APIARY), - TextureFactory.builder().addIcon(OVERLAY_FRONT_INDUSTRIAL_APIARY_GLOW).glow().build()), + TextureFactory.builder() + .addIcon(OVERLAY_FRONT_INDUSTRIAL_APIARY_GLOW) + .glow() + .build()), TextureFactory.of( TextureFactory.of(OVERLAY_TOP_INDUSTRIAL_APIARY_ACTIVE), - TextureFactory.builder().addIcon(OVERLAY_TOP_INDUSTRIAL_APIARY_ACTIVE_GLOW).glow().build()), + TextureFactory.builder() + .addIcon(OVERLAY_TOP_INDUSTRIAL_APIARY_ACTIVE_GLOW) + .glow() + .build()), TextureFactory.of( TextureFactory.of(OVERLAY_TOP_INDUSTRIAL_APIARY), - TextureFactory.builder().addIcon(OVERLAY_TOP_INDUSTRIAL_APIARY_GLOW).glow().build()), + TextureFactory.builder() + .addIcon(OVERLAY_TOP_INDUSTRIAL_APIARY_GLOW) + .glow() + .build()), TextureFactory.of( TextureFactory.of(OVERLAY_BOTTOM_INDUSTRIAL_APIARY_ACTIVE), - TextureFactory.builder().addIcon(OVERLAY_BOTTOM_INDUSTRIAL_APIARY_ACTIVE_GLOW).glow().build()), + TextureFactory.builder() + .addIcon(OVERLAY_BOTTOM_INDUSTRIAL_APIARY_ACTIVE_GLOW) + .glow() + .build()), TextureFactory.of( TextureFactory.of(OVERLAY_BOTTOM_INDUSTRIAL_APIARY), - TextureFactory.builder().addIcon(OVERLAY_BOTTOM_INDUSTRIAL_APIARY_GLOW).glow().build())); + TextureFactory.builder() + .addIcon(OVERLAY_BOTTOM_INDUSTRIAL_APIARY_GLOW) + .glow() + .build())); } public GT_MetaTileEntity_IndustrialApiary(String aName, int aTier, String aDescription, ITexture[][][] aTextures, @@ -236,8 +260,9 @@ public class GT_MetaTileEntity_IndustrialApiary extends GT_MetaTileEntity_BasicM for (int z = 0; z < icycles; z++) { final IIndividual p = bee.retrievePollen(this); if (p != null) { - final ItemStack s = p.getGenome().getSpeciesRoot() - .getMemberStack(p, EnumGermlingType.POLLEN.ordinal()); + final ItemStack s = p.getGenome() + .getSpeciesRoot() + .getMemberStack(p, EnumGermlingType.POLLEN.ordinal()); if (s != null) { final GT_Utility.ItemId id = GT_Utility.ItemId.createNoCopy(s); pollen.computeIfAbsent(id, k -> { @@ -264,7 +289,8 @@ public class GT_MetaTileEntity_IndustrialApiary extends GT_MetaTileEntity_BasicM final HashMap<GT_Utility.ItemId, Float> drops = new HashMap<>(); final HashMap<GT_Utility.ItemId, ItemStack> dropstacks = new HashMap<>(); - for (Map.Entry<ItemStack, Float> entry : primary.getProductChances().entrySet()) { + for (Map.Entry<ItemStack, Float> entry : primary.getProductChances() + .entrySet()) { final GT_Utility.ItemId id = GT_Utility.ItemId.createNoCopy(entry.getKey()); drops.merge( id, @@ -273,7 +299,8 @@ public class GT_MetaTileEntity_IndustrialApiary extends GT_MetaTileEntity_BasicM Float::sum); dropstacks.computeIfAbsent(id, k -> entry.getKey()); } - for (Map.Entry<ItemStack, Float> entry : secondary.getProductChances().entrySet()) { + for (Map.Entry<ItemStack, Float> entry : secondary.getProductChances() + .entrySet()) { final GT_Utility.ItemId id = GT_Utility.ItemId.createNoCopy(entry.getKey()); drops.merge( id, @@ -284,16 +311,24 @@ public class GT_MetaTileEntity_IndustrialApiary extends GT_MetaTileEntity_BasicM dropstacks.computeIfAbsent(id, k -> entry.getKey()); } if (primary.isJubilant(genome, this) && secondary.isJubilant(genome, this)) - for (Map.Entry<ItemStack, Float> entry : primary.getSpecialtyChances().entrySet()) { - final GT_Utility.ItemId id = GT_Utility.ItemId.createNoCopy(entry.getKey()); - drops.merge( - id, - Bee.getFinalChance(entry.getValue(), speed, prodMod, 8f) - * (float) entry.getKey().stackSize - * cycles, - Float::sum); - dropstacks.computeIfAbsent(id, k -> entry.getKey()); - } + for (Map.Entry<ItemStack, Float> entry : primary.getSpecialtyChances() + .entrySet()) { + final GT_Utility.ItemId id = GT_Utility.ItemId.createNoCopy( + entry.getKey()); + drops.merge( + id, + Bee.getFinalChance( + entry.getValue(), + speed, + prodMod, + 8f) + * (float) entry.getKey().stackSize + * cycles, + Float::sum); + dropstacks.computeIfAbsent( + id, + k -> entry.getKey()); + } int i = 0; final int imax = mOutputItems.length; @@ -334,11 +369,12 @@ public class GT_MetaTileEntity_IndustrialApiary extends GT_MetaTileEntity_BasicM setQueen(null); for (Map.Entry<GT_Utility.ItemId, Float> entry : drops.entrySet()) { - final ItemStack s = dropstacks.get(entry.getKey()).copy(); - s.stackSize = entry.getValue().intValue() - + (getWorld().rand.nextFloat() < (entry.getValue() - (float) entry.getValue().intValue()) - ? 1 - : 0); + final ItemStack s = dropstacks.get(entry.getKey()) + .copy(); + s.stackSize = entry.getValue() + .intValue() + + (getWorld().rand.nextFloat() < (entry.getValue() - (float) entry.getValue() + .intValue()) ? 1 : 0); if (s.stackSize > 0 && i < imax) while (true) { if (s.stackSize <= s.getMaxStackSize()) { this.mOutputItems[i++] = s; @@ -389,7 +425,8 @@ public class GT_MetaTileEntity_IndustrialApiary extends GT_MetaTileEntity_BasicM princess.writeToNBT(nbttagcompound); this.mOutputItems[0] = new ItemStack(PluginApiculture.items.beeQueenGE); this.mOutputItems[0].setTagCompound(nbttagcompound); - beeRoot.getBreedingTracker(getWorld(), getOwner()).registerQueen(princess); + beeRoot.getBreedingTracker(getWorld(), getOwner()) + .registerQueen(princess); setQueen(null); getDrone().stackSize -= 1; @@ -569,8 +606,9 @@ public class GT_MetaTileEntity_IndustrialApiary extends GT_MetaTileEntity_BasicM } else if (i == 0 && j == 0 && beeRoot.isMember(mOutputItems[0], EnumBeeType.QUEEN.ordinal())) if (aBaseMetaTileEntity.addStackToSlot(queen, mOutputItems[0])) break; - if (aBaseMetaTileEntity - .addStackToSlot(getOutputSlot() + ((j + i) % mOutputItems.length), mOutputItems[i])) + if (aBaseMetaTileEntity.addStackToSlot( + getOutputSlot() + ((j + i) % mOutputItems.length), + mOutputItems[i])) break; } Arrays.fill(mOutputItems, null); @@ -581,8 +619,8 @@ public class GT_MetaTileEntity_IndustrialApiary extends GT_MetaTileEntity_BasicM aBaseMetaTileEntity.setActive(false); if (doesAutoOutput() && !isOutputEmpty() && aBaseMetaTileEntity.getFrontFacing() != mMainFacing) { - final TileEntity tTileEntity2 = aBaseMetaTileEntity - .getTileEntityAtSide(aBaseMetaTileEntity.getFrontFacing()); + final TileEntity tTileEntity2 = aBaseMetaTileEntity.getTileEntityAtSide( + aBaseMetaTileEntity.getFrontFacing()); final long tStoredEnergy = aBaseMetaTileEntity.getUniversalEnergyStored(); int tMaxStacks = (int) (tStoredEnergy / 64L); if (tMaxStacks > mOutputItems.length) tMaxStacks = mOutputItems.length; @@ -609,7 +647,10 @@ public class GT_MetaTileEntity_IndustrialApiary extends GT_MetaTileEntity_BasicM } public void cancelProcess() { - if (this.getBaseMetaTileEntity().isActive() && this.getBaseMetaTileEntity().isServerSide() + if (this.getBaseMetaTileEntity() + .isActive() + && this.getBaseMetaTileEntity() + .isServerSide() && usedQueen != null && beeRoot.isMember(usedQueen, EnumBeeType.QUEEN.ordinal())) { Arrays.fill(mOutputItems, null); @@ -617,9 +658,11 @@ public class GT_MetaTileEntity_IndustrialApiary extends GT_MetaTileEntity_BasicM mProgresstime = 0; mMaxProgresstime = 0; mStuttering = false; - this.getBaseMetaTileEntity().setActive(false); + this.getBaseMetaTileEntity() + .setActive(false); setQueen(usedQueen); - this.getBaseMetaTileEntity().disableWorking(); + this.getBaseMetaTileEntity() + .disableWorking(); } } @@ -638,9 +681,13 @@ public class GT_MetaTileEntity_IndustrialApiary extends GT_MetaTileEntity_BasicM if (s == null) continue; if (GT_Utility.areStacksEqual(getStackInSlot(i), aStack)) return false; if (GT_ApiaryUpgrade.isUpgrade(aStack)) { - if (!GT_ApiaryUpgrade.getUpgrade(aStack).isAllowedToWorkWith(getStackInSlot(i))) return false; + if (!GT_ApiaryUpgrade.getUpgrade(aStack) + .isAllowedToWorkWith(getStackInSlot(i))) + return false; } else if (GT_ApiaryUpgrade.isUpgrade(s)) { - if (!GT_ApiaryUpgrade.getUpgrade(s).isAllowedToWorkWith(aStack)) return false; + if (!GT_ApiaryUpgrade.getUpgrade(s) + .isAllowedToWorkWith(aStack)) + return false; } } return true; @@ -687,17 +734,20 @@ public class GT_MetaTileEntity_IndustrialApiary extends GT_MetaTileEntity_BasicM @Override public int getBlockLightValue() { - return this.getBaseMetaTileEntity().getLightLevelAtSide((byte) 1); + return this.getBaseMetaTileEntity() + .getLightLevelAtSide((byte) 1); } @Override public boolean canBlockSeeTheSky() { - return this.getBaseMetaTileEntity().getSkyAtSide((byte) 1); + return this.getBaseMetaTileEntity() + .getSkyAtSide((byte) 1); } @Override public World getWorld() { - return this.getBaseMetaTileEntity().getWorld(); + return this.getBaseMetaTileEntity() + .getWorld(); } GameProfile owner = null; @@ -705,8 +755,10 @@ public class GT_MetaTileEntity_IndustrialApiary extends GT_MetaTileEntity_BasicM @Override public GameProfile getOwner() { if (owner == null) owner = new GameProfile( - this.getBaseMetaTileEntity().getOwnerUuid(), - this.getBaseMetaTileEntity().getOwnerName()); + this.getBaseMetaTileEntity() + .getOwnerUuid(), + this.getBaseMetaTileEntity() + .getOwnerName()); return owner; } @@ -720,7 +772,8 @@ public class GT_MetaTileEntity_IndustrialApiary extends GT_MetaTileEntity_BasicM @Override public BiomeGenBase getBiome() { - if (biomeOverride == null) return this.getBaseMetaTileEntity().getBiome(); + if (biomeOverride == null) return this.getBaseMetaTileEntity() + .getBiome(); return biomeOverride; } @@ -742,7 +795,8 @@ public class GT_MetaTileEntity_IndustrialApiary extends GT_MetaTileEntity_BasicM @Override public ChunkCoordinates getCoordinates() { - return this.getBaseMetaTileEntity().getCoords(); + return this.getBaseMetaTileEntity() + .getCoords(); } // endregion @@ -823,7 +877,9 @@ public class GT_MetaTileEntity_IndustrialApiary extends GT_MetaTileEntity_BasicM private int flowerBlockMeta; private boolean checkFlower(IBee bee) { - final String flowerType = bee.getGenome().getFlowerProvider().getFlowerType(); + final String flowerType = bee.getGenome() + .getFlowerProvider() + .getFlowerType(); if (!this.flowerType.equals(flowerType)) flowercoords = null; if (flowercoords != null) { if (getWorld().getBlock(flowercoords.posX, flowercoords.posY, flowercoords.posZ) != flowerBlock @@ -838,8 +894,10 @@ public class GT_MetaTileEntity_IndustrialApiary extends GT_MetaTileEntity_BasicM flowercoords = null; else { flowerBlock = getWorld().getBlock(flowercoords.posX, flowercoords.posY, flowercoords.posZ); - flowerBlockMeta = getWorld() - .getBlockMetadata(flowercoords.posX, flowercoords.posY, flowercoords.posZ); + flowerBlockMeta = getWorld().getBlockMetadata( + flowercoords.posX, + flowercoords.posY, + flowercoords.posZ); } } if (flowercoords == null) { @@ -1069,101 +1127,148 @@ public class GT_MetaTileEntity_IndustrialApiary extends GT_MetaTileEntity_BasicM public void addUIWidgets(ModularWindow.Builder builder, UIBuildContext buildContext) { builder.widget( new SlotWidget(new ApiarySlot(inventoryHandler, queen)) - .setBackground(getGUITextureSet().getItemSlot(), GT_UITextures.OVERLAY_SLOT_BEE_QUEEN) - .setPos(36, 21)) - .widget( - new SlotWidget(new ApiarySlot(inventoryHandler, drone)) - .setBackground(getGUITextureSet().getItemSlot(), GT_UITextures.OVERLAY_SLOT_BEE_DRONE) - .setPos(36, 41)) - .widget( - SlotGroup.ofItemHandler(inventoryHandler, 2).startFromSlot(7).endAtSlot(10) + .setBackground( + getGUITextureSet().getItemSlot(), + GT_UITextures.OVERLAY_SLOT_BEE_QUEEN) + .setPos(36, 21)) + .widget( + new SlotWidget(new ApiarySlot(inventoryHandler, drone)).setBackground( + getGUITextureSet().getItemSlot(), + GT_UITextures.OVERLAY_SLOT_BEE_DRONE) + .setPos(36, 41)) + .widget( + SlotGroup.ofItemHandler(inventoryHandler, 2) + .startFromSlot(7) + .endAtSlot(10) .slotCreator(i -> new ApiarySlot(inventoryHandler, i)) .applyForWidget( widget -> widget.setGTTooltip(() -> mTooltipCache.getData(UPGRADE_TOOLTIP)) - .setTooltipShowUpDelay(TOOLTIP_DELAY)) - .build().setPos(61, 23)); + .setTooltipShowUpDelay(TOOLTIP_DELAY)) + .build() + .setPos(61, 23)); super.addUIWidgets(builder, buildContext); builder.widget( new ProgressBar().setProgress(() -> (float) getProgresstime() / Math.max(maxProgresstime(), 1)) - .setTexture(GT_UITextures.PROGRESSBAR_ARROW, 20).setPos(70, 3).setSize(20, 18)) - .widget( - new ButtonWidget().setOnClick((clickData, widget) -> cancelProcess()) - .setBackground(GT_UITextures.BUTTON_STANDARD, GT_UITextures.OVERLAY_BUTTON_CROSS) - .setGTTooltip(() -> mTooltipCache.getData(CANCEL_PROCESS_TOOLTIP)) - .setTooltipShowUpDelay(TOOLTIP_DELAY).setPos(7, 26).setSize(18, 18)) - .widget(new DrawableWidget().setDrawable(GT_UITextures.PICTURE_INFORMATION).setGTTooltip(() -> { - final String energyreq = GT_Utility.formatNumbers( - (int) ((float) GT_MetaTileEntity_IndustrialApiary.baseEUtUsage * getEnergyModifier() - * getAcceleration()) + getAdditionalEnergyUsage()); - final String Temp = StatCollector.translateToLocal(getTemperature().getName()); - final String Hum = StatCollector.translateToLocal(getHumidity().getName()); - if (getUsedQueen() != null - && BeeManager.beeRoot.isMember(getUsedQueen(), EnumBeeType.QUEEN.ordinal())) { - final IBee bee = BeeManager.beeRoot.getMember(getUsedQueen()); - if (bee.isAnalyzed()) { - final IBeeGenome genome = bee.getGenome(); - final IBeeModifier mod = BeeManager.beeRoot.getBeekeepingMode(getWorld()).getBeeModifier(); - final float tmod = getTerritoryModifier(null, 1f) * mod.getTerritoryModifier(null, 1f); - final int[] t = Arrays.stream(genome.getTerritory()).map(i -> (int) ((float) i * tmod)) - .toArray(); - return mTooltipCache.getUncachedTooltipData( - INFO_WITH_BEE_TOOLTIP, - energyreq, - Temp, - Hum, - genome.getSpeed(), - getProductionModifier(null, 1f) * mod.getProductionModifier(null, 1f), - Math.round( - getFloweringModifier(null, 1f) * genome.getFlowering() - * mod.getFloweringModifier(null, 1f)), - Math.round( - getLifespanModifier(null, null, 1f) * genome.getLifespan() - * mod.getLifespanModifier(null, null, 1f)), - t[0], - t[1], - t[2]); - } - } - return mTooltipCache.getUncachedTooltipData(INFO_TOOLTIP, energyreq, Temp, Hum); - }).attachSyncer( - new FakeSyncWidget.ItemStackSyncer(() -> usedQueen, val -> usedQueen = val), - builder, - (widget, val) -> widget.notifyTooltipChange()).setPos(163, 5).setSize(7, 18)) - .widget(new ButtonWidget().setOnClick((clickData, widget) -> { - if (clickData.mouseButton == 0) { - if (mLockedSpeed) return; - if (!clickData.shift) { - mSpeed++; - if (mSpeed > getMaxSpeed()) mSpeed = 0; - } else { - mSpeed--; - if (mSpeed < 0) mSpeed = getMaxSpeed(); - } - } else if (clickData.mouseButton == 1) { - mLockedSpeed = !mLockedSpeed; - if (mLockedSpeed) mSpeed = getMaxSpeed(); - } - }).setGTTooltip( - () -> mTooltipCache.getUncachedTooltipData( - mLockedSpeed ? SPEED_LOCKED_TOOLTIP : SPEED_TOOLTIP, - getAcceleration(), - GT_Utility.formatNumbers(getAdditionalEnergyUsage()))) - .attachSyncer( - new FakeSyncWidget.IntegerSyncer(() -> mSpeed, val -> mSpeed = val), - builder, - (widget, val) -> widget.notifyTooltipChange()) - .attachSyncer( - new FakeSyncWidget.BooleanSyncer(() -> mLockedSpeed, val -> mLockedSpeed = val), - builder, - (widget, val) -> widget.notifyTooltipChange()) - .setTooltipShowUpDelay(TOOLTIP_DELAY).setBackground(GT_UITextures.PICTURE_SQUARE_LIGHT_GRAY) - .setPos(25, 62).setSize(18, 18)) - .widget(new TextWidget("x").setDefaultColor(COLOR_TEXT_GRAY.get()).setPos(30, 63)).widget( - TextWidget.dynamicString(() -> String.valueOf(1 << mSpeed)) - // mSpeed is already synced - .setSynced(false).setDefaultColor(COLOR_TEXT_GRAY.get()).setPos(26, 72)); + .setTexture(GT_UITextures.PROGRESSBAR_ARROW, 20) + .setPos(70, 3) + .setSize(20, 18)) + .widget( + new ButtonWidget().setOnClick((clickData, widget) -> cancelProcess()) + .setBackground( + GT_UITextures.BUTTON_STANDARD, + GT_UITextures.OVERLAY_BUTTON_CROSS) + .setGTTooltip(() -> mTooltipCache.getData(CANCEL_PROCESS_TOOLTIP)) + .setTooltipShowUpDelay(TOOLTIP_DELAY) + .setPos(7, 26) + .setSize(18, 18)) + .widget( + new DrawableWidget().setDrawable(GT_UITextures.PICTURE_INFORMATION) + .setGTTooltip(() -> { + final String energyreq = GT_Utility.formatNumbers( + (int) ((float) GT_MetaTileEntity_IndustrialApiary.baseEUtUsage + * getEnergyModifier() + * getAcceleration()) + getAdditionalEnergyUsage()); + final String Temp = StatCollector.translateToLocal( + getTemperature().getName()); + final String Hum = StatCollector.translateToLocal( + getHumidity().getName()); + if (getUsedQueen() != null && BeeManager.beeRoot.isMember( + getUsedQueen(), + EnumBeeType.QUEEN.ordinal())) { + final IBee bee = BeeManager.beeRoot.getMember(getUsedQueen()); + if (bee.isAnalyzed()) { + final IBeeGenome genome = bee.getGenome(); + final IBeeModifier mod = BeeManager.beeRoot.getBeekeepingMode( + getWorld()) + .getBeeModifier(); + final float tmod = getTerritoryModifier(null, 1f) + * mod.getTerritoryModifier(null, 1f); + final int[] t = Arrays.stream(genome.getTerritory()) + .map(i -> (int) ((float) i * tmod)) + .toArray(); + return mTooltipCache.getUncachedTooltipData( + INFO_WITH_BEE_TOOLTIP, + energyreq, + Temp, + Hum, + genome.getSpeed(), + getProductionModifier(null, 1f) + * mod.getProductionModifier(null, 1f), + Math.round( + getFloweringModifier(null, 1f) + * genome.getFlowering() + * mod.getFloweringModifier(null, 1f)), + Math.round( + getLifespanModifier(null, null, 1f) + * genome.getLifespan() + * mod.getLifespanModifier( + null, + null, + 1f)), + t[0], + t[1], + t[2]); + } + } + return mTooltipCache.getUncachedTooltipData( + INFO_TOOLTIP, + energyreq, + Temp, + Hum); + }) + .attachSyncer( + new FakeSyncWidget.ItemStackSyncer( + () -> usedQueen, + val -> usedQueen = val), + builder, + (widget, val) -> widget.notifyTooltipChange()) + .setPos(163, 5) + .setSize(7, 18)) + .widget(new ButtonWidget().setOnClick((clickData, widget) -> { + if (clickData.mouseButton == 0) { + if (mLockedSpeed) return; + if (!clickData.shift) { + mSpeed++; + if (mSpeed > getMaxSpeed()) mSpeed = 0; + } else { + mSpeed--; + if (mSpeed < 0) mSpeed = getMaxSpeed(); + } + } else if (clickData.mouseButton == 1) { + mLockedSpeed = !mLockedSpeed; + if (mLockedSpeed) mSpeed = getMaxSpeed(); + } + }) + .setGTTooltip( + () -> mTooltipCache.getUncachedTooltipData( + mLockedSpeed ? SPEED_LOCKED_TOOLTIP : SPEED_TOOLTIP, + getAcceleration(), + GT_Utility.formatNumbers(getAdditionalEnergyUsage()))) + .attachSyncer( + new FakeSyncWidget.IntegerSyncer(() -> mSpeed, val -> mSpeed = val), + builder, + (widget, val) -> widget.notifyTooltipChange()) + .attachSyncer( + new FakeSyncWidget.BooleanSyncer( + () -> mLockedSpeed, + val -> mLockedSpeed = val), + builder, + (widget, val) -> widget.notifyTooltipChange()) + .setTooltipShowUpDelay(TOOLTIP_DELAY) + .setBackground(GT_UITextures.PICTURE_SQUARE_LIGHT_GRAY) + .setPos(25, 62) + .setSize(18, 18)) + .widget( + new TextWidget("x").setDefaultColor(COLOR_TEXT_GRAY.get()) + .setPos(30, 63)) + .widget( + TextWidget.dynamicString(() -> String.valueOf(1 << mSpeed)) + // mSpeed is already synced + .setSynced(false) + .setDefaultColor(COLOR_TEXT_GRAY.get()) + .setPos(26, 72)); } @Override @@ -1189,26 +1294,38 @@ public class GT_MetaTileEntity_IndustrialApiary extends GT_MetaTileEntity_BasicM @Override protected DrawableWidget createErrorStatusArea(ModularWindow.Builder builder, IDrawable picture) { - return (DrawableWidget) super.createErrorStatusArea(builder, picture).setPos(100, 62).attachSyncer( - new FakeSyncWidget.ListSyncer<>(() -> Arrays.asList(mErrorStates.toArray(new IErrorState[0])), val -> { - mErrorStates.clear(); - mErrorStates.addAll(new HashSet<>(val)); - }, - (buffer, val) -> buffer.writeShort(val.getID()), - buffer -> ForestryAPI.errorStateRegistry.getErrorState(buffer.readShort())), - builder, - (widget, val) -> widget.notifyTooltipChange()); + return (DrawableWidget) super.createErrorStatusArea(builder, picture).setPos(100, 62) + .attachSyncer( + new FakeSyncWidget.ListSyncer<>( + () -> Arrays.asList( + mErrorStates.toArray( + new IErrorState[0])), + val -> { + mErrorStates.clear(); + mErrorStates.addAll( + new HashSet<>( + val)); + }, + (buffer, val) -> buffer.writeShort( + val.getID()), + buffer -> ForestryAPI.errorStateRegistry.getErrorState( + buffer.readShort())), + builder, + (widget, val) -> widget.notifyTooltipChange()); } @Override protected List<String> getErrorDescriptions() { if (!mErrorStates.isEmpty()) { - return mErrorStates.stream().map( - state -> EnumChatFormatting.RED + StatCollector.translateToLocal("for." + state.getDescription())) - .collect(Collectors.toList()); + return mErrorStates.stream() + .map( + state -> EnumChatFormatting.RED + + StatCollector.translateToLocal("for." + state.getDescription())) + .collect(Collectors.toList()); } else if (mStuttering) { - return mTooltipCache - .getData(STALLED_STUTTERING_TOOLTIP, StatCollector.translateToLocal(POWER_SOURCE_POWER)).text; + return mTooltipCache.getData( + STALLED_STUTTERING_TOOLTIP, + StatCollector.translateToLocal(POWER_SOURCE_POWER)).text; } else { return Collections.emptyList(); } @@ -1251,8 +1368,8 @@ public class GT_MetaTileEntity_IndustrialApiary extends GT_MetaTileEntity_BasicM } } - private static final UIInfo<?, ?> IndustrialApiaryUI = GT_UIInfos.GTTileEntityUIFactory - .apply(GT_ModularUIContainer_IndustrialApiary::new); + private static final UIInfo<?, ?> IndustrialApiaryUI = GT_UIInfos.GTTileEntityUIFactory.apply( + GT_ModularUIContainer_IndustrialApiary::new); private static class GT_ModularUIContainer_IndustrialApiary extends ModularUIContainer { @@ -1277,7 +1394,8 @@ public class GT_MetaTileEntity_IndustrialApiary extends GT_MetaTileEntity_BasicM if (slotStack == null && !slot.isItemValid(s)) return super.slotClick(aSlotNumber, aMouseclick, aShifthold, aPlayer); if (!GT_ApiaryUpgrade.isUpgrade(s)) return super.slotClick(aSlotNumber, aMouseclick, aShifthold, aPlayer); - int max = GT_ApiaryUpgrade.getUpgrade(s).getMaxNumber(); + int max = GT_ApiaryUpgrade.getUpgrade(s) + .getMaxNumber(); if (slotStack != null) max = Math.max(0, max - slotStack.stackSize); max = Math.min(max, s.stackSize); if (max == 0) return null; @@ -1305,7 +1423,8 @@ public class GT_MetaTileEntity_IndustrialApiary extends GT_MetaTileEntity_BasicM } else { if (!GT_Utility.areStacksEqual(aStack, iStack)) continue; } - int max = GT_ApiaryUpgrade.getUpgrade(aStack).getMaxNumber(); + int max = GT_ApiaryUpgrade.getUpgrade(aStack) + .getMaxNumber(); if (iStack == null) { max = Math.min(max, aStack.stackSize); final ItemStack newstack = aStack.splitStack(max); diff --git a/src/main/java/gregtech/common/tileentities/machines/basic/GT_MetaTileEntity_Massfabricator.java b/src/main/java/gregtech/common/tileentities/machines/basic/GT_MetaTileEntity_Massfabricator.java index d1c03e1527..2c1e46ea9e 100644 --- a/src/main/java/gregtech/common/tileentities/machines/basic/GT_MetaTileEntity_Massfabricator.java +++ b/src/main/java/gregtech/common/tileentities/machines/basic/GT_MetaTileEntity_Massfabricator.java @@ -44,28 +44,52 @@ public class GT_MetaTileEntity_Massfabricator extends GT_MetaTileEntity_BasicMac "", TextureFactory.of( TextureFactory.of(OVERLAY_SIDE_MASSFAB_ACTIVE), - TextureFactory.builder().addIcon(OVERLAY_SIDE_MASSFAB_ACTIVE_GLOW).glow().build()), + TextureFactory.builder() + .addIcon(OVERLAY_SIDE_MASSFAB_ACTIVE_GLOW) + .glow() + .build()), TextureFactory.of( TextureFactory.of(OVERLAY_SIDE_MASSFAB), - TextureFactory.builder().addIcon(OVERLAY_SIDE_MASSFAB_GLOW).glow().build()), + TextureFactory.builder() + .addIcon(OVERLAY_SIDE_MASSFAB_GLOW) + .glow() + .build()), TextureFactory.of( TextureFactory.of(OVERLAY_FRONT_MASSFAB_ACTIVE), - TextureFactory.builder().addIcon(OVERLAY_FRONT_MASSFAB_ACTIVE_GLOW).glow().build()), + TextureFactory.builder() + .addIcon(OVERLAY_FRONT_MASSFAB_ACTIVE_GLOW) + .glow() + .build()), TextureFactory.of( TextureFactory.of(OVERLAY_FRONT_MASSFAB), - TextureFactory.builder().addIcon(OVERLAY_FRONT_MASSFAB_GLOW).glow().build()), + TextureFactory.builder() + .addIcon(OVERLAY_FRONT_MASSFAB_GLOW) + .glow() + .build()), TextureFactory.of( TextureFactory.of(OVERLAY_TOP_MASSFAB_ACTIVE), - TextureFactory.builder().addIcon(OVERLAY_TOP_MASSFAB_ACTIVE_GLOW).glow().build()), + TextureFactory.builder() + .addIcon(OVERLAY_TOP_MASSFAB_ACTIVE_GLOW) + .glow() + .build()), TextureFactory.of( TextureFactory.of(OVERLAY_TOP_MASSFAB), - TextureFactory.builder().addIcon(OVERLAY_TOP_MASSFAB_GLOW).glow().build()), + TextureFactory.builder() + .addIcon(OVERLAY_TOP_MASSFAB_GLOW) + .glow() + .build()), TextureFactory.of( TextureFactory.of(OVERLAY_BOTTOM_MASSFAB_ACTIVE), - TextureFactory.builder().addIcon(OVERLAY_BOTTOM_MASSFAB_ACTIVE_GLOW).glow().build()), + TextureFactory.builder() + .addIcon(OVERLAY_BOTTOM_MASSFAB_ACTIVE_GLOW) + .glow() + .build()), TextureFactory.of( TextureFactory.of(OVERLAY_BOTTOM_MASSFAB), - TextureFactory.builder().addIcon(OVERLAY_BOTTOM_MASSFAB_GLOW).glow().build())); + TextureFactory.builder() + .addIcon(OVERLAY_BOTTOM_MASSFAB_GLOW) + .glow() + .build())); EUt = V[1] * (long) Math.pow(2, mTier + 2); } @@ -105,8 +129,10 @@ public class GT_MetaTileEntity_Massfabricator extends GT_MetaTileEntity_BasicMac @Override public void onConfigLoad(GT_Config aConfig) { super.onConfigLoad(aConfig); - sDurationMultiplier = aConfig - .get(ConfigCategories.machineconfig, "Massfabricator.UUM_Duration_Multiplier", sDurationMultiplier); + sDurationMultiplier = aConfig.get( + ConfigCategories.machineconfig, + "Massfabricator.UUM_Duration_Multiplier", + sDurationMultiplier); sUUAperUUM = aConfig.get(ConfigCategories.machineconfig, "Massfabricator.UUA_per_UUM", sUUAperUUM); sUUASpeedBonus = aConfig.get(ConfigCategories.machineconfig, "Massfabricator.UUA_Speed_Bonus", sUUASpeedBonus); sRequiresUUA = aConfig.get(ConfigCategories.machineconfig, "Massfabricator.UUA_Requirement", sRequiresUUA); @@ -139,9 +165,9 @@ public class GT_MetaTileEntity_Massfabricator extends GT_MetaTileEntity_BasicMac return FOUND_AND_SUCCESSFULLY_USED_RECIPE; } return sRequiresUUA || Arrays.stream(getAllInputs()) - .anyMatch(s -> ItemList.Circuit_Integrated.isStackEqual(s, true, true)) - ? FOUND_RECIPE_BUT_DID_NOT_MEET_REQUIREMENTS - : FOUND_AND_SUCCESSFULLY_USED_RECIPE; + .anyMatch(s -> ItemList.Circuit_Integrated.isStackEqual(s, true, true)) + ? FOUND_RECIPE_BUT_DID_NOT_MEET_REQUIREMENTS + : FOUND_AND_SUCCESSFULLY_USED_RECIPE; } return DID_NOT_FIND_RECIPE; } diff --git a/src/main/java/gregtech/common/tileentities/machines/basic/GT_MetaTileEntity_MicrowaveEnergyTransmitter.java b/src/main/java/gregtech/common/tileentities/machines/basic/GT_MetaTileEntity_MicrowaveEnergyTransmitter.java index 32a0ad8537..b72c456683 100644 --- a/src/main/java/gregtech/common/tileentities/machines/basic/GT_MetaTileEntity_MicrowaveEnergyTransmitter.java +++ b/src/main/java/gregtech/common/tileentities/machines/basic/GT_MetaTileEntity_MicrowaveEnergyTransmitter.java @@ -120,10 +120,15 @@ public class GT_MetaTileEntity_MicrowaveEnergyTransmitter extends GT_MetaTileEnt boolean aActive, boolean aRedstone) { if (aSide == 0) return new ITexture[] { MACHINE_CASINGS[mTier][aColorIndex + 1] }; if (aActive) return new ITexture[] { MACHINE_CASINGS[mTier][aColorIndex + 1], - TextureFactory.of(OVERLAY_TELEPORTER_ACTIVE), - TextureFactory.builder().addIcon(OVERLAY_TELEPORTER_ACTIVE_GLOW).glow().build() }; + TextureFactory.of(OVERLAY_TELEPORTER_ACTIVE), TextureFactory.builder() + .addIcon(OVERLAY_TELEPORTER_ACTIVE_GLOW) + .glow() + .build() }; return new ITexture[] { MACHINE_CASINGS[mTier][aColorIndex + 1], TextureFactory.of(OVERLAY_TELEPORTER), - TextureFactory.builder().addIcon(OVERLAY_TELEPORTER_GLOW).glow().build() }; + TextureFactory.builder() + .addIcon(OVERLAY_TELEPORTER_GLOW) + .glow() + .build() }; } @Override @@ -148,8 +153,10 @@ public class GT_MetaTileEntity_MicrowaveEnergyTransmitter extends GT_MetaTileEnt @Override public void onConfigLoad(GT_Config aConfig) { - sInterDimensionalTeleportAllowed = aConfig - .get(ConfigCategories.machineconfig, "Teleporter.Interdimensional", true); + sInterDimensionalTeleportAllowed = aConfig.get( + ConfigCategories.machineconfig, + "Teleporter.Interdimensional", + true); mMaxLoss = Math.max(aConfig.get(ConfigCategories.machineconfig, "MicrowaveTransmitter.MaxLoss", 50), 11); mMaxLossDistance = aConfig.get(ConfigCategories.machineconfig, "MicrowaveTransmitter.MaxLossDistance", 10000); mPassiveEnergyUse = aConfig.get(ConfigCategories.machineconfig, "MicrowaveTransmitter.PassiveEnergy", true); @@ -241,8 +248,8 @@ public class GT_MetaTileEntity_MicrowaveEnergyTransmitter extends GT_MetaTileEnt } long energyUse = 10; if (mMaxLossDistance != 0) { - energyUse = GT_Utility - .safeInt(10L + (tDistance * Math.max(mMaxLoss - 10L, 0) / mMaxLossDistance)); + energyUse = GT_Utility.safeInt( + 10L + (tDistance * Math.max(mMaxLoss - 10L, 0) / mMaxLossDistance)); } energyUse = packetSize + ((V[mTier] * energyUse) / 100); if (getBaseMetaTileEntity().isUniversalEnergyStored(energyUse)) { @@ -408,26 +415,32 @@ public class GT_MetaTileEntity_MicrowaveEnergyTransmitter extends GT_MetaTileEnt @Override public void addUIWidgets(ModularWindow.Builder builder, UIBuildContext buildContext) { builder.widget( - new DrawableWidget().setDrawable(GT_UITextures.PICTURE_SCREEN_BLACK).setSize(90, 72).setPos(43, 4)) - .widget( - TextWidget.dynamicString(() -> "X: " + GT_Utility.parseNumberToString(mTargetX)) - .setDefaultColor(COLOR_TEXT_WHITE.get()).setPos(46, 8)) - .widget( - TextWidget.dynamicString(() -> "Y: " + GT_Utility.parseNumberToString(mTargetY)) - .setDefaultColor(COLOR_TEXT_WHITE.get()).setPos(46, 16)) - .widget( - TextWidget.dynamicString(() -> "Z: " + GT_Utility.parseNumberToString(mTargetZ)) - .setDefaultColor(COLOR_TEXT_WHITE.get()).setPos(46, 24)) - .widget( - TextWidget.dynamicString(() -> "Dim: " + GT_Utility.parseNumberToString(mTargetD)) - .setDefaultColor(COLOR_TEXT_WHITE.get()).setPos(46, 32)) - .widget( - TextWidget - .dynamicString( - () -> "Dim Valid: " + (GT_Utility.isRealDimension(mTargetD) ? "Yes" : "No")) - .setDefaultColor(COLOR_TEXT_WHITE.get()) - .setEnabled(widget -> hasDimensionalTeleportCapability()).setPos(46, 40)) - .widget(new FakeSyncWidget.FluidStackSyncer(() -> mFluid, val -> mFluid = val)); + new DrawableWidget().setDrawable(GT_UITextures.PICTURE_SCREEN_BLACK) + .setSize(90, 72) + .setPos(43, 4)) + .widget( + TextWidget.dynamicString(() -> "X: " + GT_Utility.parseNumberToString(mTargetX)) + .setDefaultColor(COLOR_TEXT_WHITE.get()) + .setPos(46, 8)) + .widget( + TextWidget.dynamicString(() -> "Y: " + GT_Utility.parseNumberToString(mTargetY)) + .setDefaultColor(COLOR_TEXT_WHITE.get()) + .setPos(46, 16)) + .widget( + TextWidget.dynamicString(() -> "Z: " + GT_Utility.parseNumberToString(mTargetZ)) + .setDefaultColor(COLOR_TEXT_WHITE.get()) + .setPos(46, 24)) + .widget( + TextWidget.dynamicString(() -> "Dim: " + GT_Utility.parseNumberToString(mTargetD)) + .setDefaultColor(COLOR_TEXT_WHITE.get()) + .setPos(46, 32)) + .widget( + TextWidget.dynamicString( + () -> "Dim Valid: " + (GT_Utility.isRealDimension(mTargetD) ? "Yes" : "No")) + .setDefaultColor(COLOR_TEXT_WHITE.get()) + .setEnabled(widget -> hasDimensionalTeleportCapability()) + .setPos(46, 40)) + .widget(new FakeSyncWidget.FluidStackSyncer(() -> mFluid, val -> mFluid = val)); addChangeNumberButtons(builder, GT_UITextures.OVERLAY_BUTTON_MINUS_LARGE, -512, -64, 7); addChangeNumberButtons(builder, GT_UITextures.OVERLAY_BUTTON_MINUS_SMALL, -16, -1, 25); @@ -464,9 +477,11 @@ public class GT_MetaTileEntity_MicrowaveEnergyTransmitter extends GT_MetaTileEnt private void addChangeNumberButton(ModularWindow.Builder builder, IDrawable overlay, Consumer<Integer> setter, int addNumberShift, int addNumber, int xPos, int yPos) { builder.widget( - new ButtonWidget() - .setOnClick((clickData, widget) -> setter.accept(clickData.shift ? addNumberShift : addNumber)) - .setBackground(GT_UITextures.BUTTON_STANDARD, overlay).setSize(18, 18).setPos(xPos, yPos)); + new ButtonWidget().setOnClick( + (clickData, widget) -> setter.accept(clickData.shift ? addNumberShift : addNumber)) + .setBackground(GT_UITextures.BUTTON_STANDARD, overlay) + .setSize(18, 18) + .setPos(xPos, yPos)); } @Override @@ -477,6 +492,8 @@ public class GT_MetaTileEntity_MicrowaveEnergyTransmitter extends GT_MetaTileEnt @Override public void addGregTechLogo(ModularWindow.Builder builder) { builder.widget( - new DrawableWidget().setDrawable(getGUITextureSet().getGregTechLogo()).setSize(17, 17).setPos(113, 56)); + new DrawableWidget().setDrawable(getGUITextureSet().getGregTechLogo()) + .setSize(17, 17) + .setPos(113, 56)); } } diff --git a/src/main/java/gregtech/common/tileentities/machines/basic/GT_MetaTileEntity_Miner.java b/src/main/java/gregtech/common/tileentities/machines/basic/GT_MetaTileEntity_Miner.java index 7e4d5f8165..27dea9bd00 100644 --- a/src/main/java/gregtech/common/tileentities/machines/basic/GT_MetaTileEntity_Miner.java +++ b/src/main/java/gregtech/common/tileentities/machines/basic/GT_MetaTileEntity_Miner.java @@ -74,48 +74,72 @@ public class GT_MetaTileEntity_Miner extends GT_MetaTileEntity_BasicMachine "Miner.png", "", TextureFactory.of( - TextureFactory - .of(new Textures.BlockIcons.CustomIcon("basicmachines/miner/OVERLAY_SIDE_ACTIVE")), - TextureFactory.builder().addIcon( - new Textures.BlockIcons.CustomIcon("basicmachines/miner/OVERLAY_SIDE_ACTIVE_GLOW")) - .glow().build()), + TextureFactory.of( + new Textures.BlockIcons.CustomIcon("basicmachines/miner/OVERLAY_SIDE_ACTIVE")), + TextureFactory.builder() + .addIcon( + new Textures.BlockIcons.CustomIcon( + "basicmachines/miner/OVERLAY_SIDE_ACTIVE_GLOW")) + .glow() + .build()), TextureFactory.of( TextureFactory.of(new Textures.BlockIcons.CustomIcon("basicmachines/miner/OVERLAY_SIDE")), TextureFactory.builder() - .addIcon(new Textures.BlockIcons.CustomIcon("basicmachines/miner/OVERLAY_SIDE_GLOW")) - .glow().build()), + .addIcon( + new Textures.BlockIcons.CustomIcon( + "basicmachines/miner/OVERLAY_SIDE_GLOW")) + .glow() + .build()), TextureFactory.of( - TextureFactory - .of(new Textures.BlockIcons.CustomIcon("basicmachines/miner/OVERLAY_FRONT_ACTIVE")), - TextureFactory.builder().addIcon( - new Textures.BlockIcons.CustomIcon("basicmachines/miner/OVERLAY_FRONT_ACTIVE_GLOW")) - .glow().build()), + TextureFactory.of( + new Textures.BlockIcons.CustomIcon("basicmachines/miner/OVERLAY_FRONT_ACTIVE")), + TextureFactory.builder() + .addIcon( + new Textures.BlockIcons.CustomIcon( + "basicmachines/miner/OVERLAY_FRONT_ACTIVE_GLOW")) + .glow() + .build()), TextureFactory.of( TextureFactory.of(new Textures.BlockIcons.CustomIcon("basicmachines/miner/OVERLAY_FRONT")), TextureFactory.builder() - .addIcon(new Textures.BlockIcons.CustomIcon("basicmachines/miner/OVERLAY_FRONT_GLOW")) - .glow().build()), + .addIcon( + new Textures.BlockIcons.CustomIcon( + "basicmachines/miner/OVERLAY_FRONT_GLOW")) + .glow() + .build()), TextureFactory.of( TextureFactory.of(new Textures.BlockIcons.CustomIcon("basicmachines/miner/OVERLAY_TOP_ACTIVE")), - TextureFactory.builder().addIcon( - new Textures.BlockIcons.CustomIcon("basicmachines/miner/OVERLAY_TOP_ACTIVE_GLOW")) - .glow().build()), + TextureFactory.builder() + .addIcon( + new Textures.BlockIcons.CustomIcon( + "basicmachines/miner/OVERLAY_TOP_ACTIVE_GLOW")) + .glow() + .build()), TextureFactory.of( TextureFactory.of(new Textures.BlockIcons.CustomIcon("basicmachines/miner/OVERLAY_TOP")), TextureFactory.builder() - .addIcon(new Textures.BlockIcons.CustomIcon("basicmachines/miner/OVERLAY_TOP_GLOW")) - .glow().build()), + .addIcon( + new Textures.BlockIcons.CustomIcon( + "basicmachines/miner/OVERLAY_TOP_GLOW")) + .glow() + .build()), TextureFactory.of( - TextureFactory - .of(new Textures.BlockIcons.CustomIcon("basicmachines/miner/OVERLAY_BOTTOM_ACTIVE")), - TextureFactory.builder().addIcon( - new Textures.BlockIcons.CustomIcon("basicmachines/miner/OVERLAY_BOTTOM_ACTIVE_GLOW")) - .glow().build()), + TextureFactory.of( + new Textures.BlockIcons.CustomIcon("basicmachines/miner/OVERLAY_BOTTOM_ACTIVE")), + TextureFactory.builder() + .addIcon( + new Textures.BlockIcons.CustomIcon( + "basicmachines/miner/OVERLAY_BOTTOM_ACTIVE_GLOW")) + .glow() + .build()), TextureFactory.of( TextureFactory.of(new Textures.BlockIcons.CustomIcon("basicmachines/miner/OVERLAY_BOTTOM")), TextureFactory.builder() - .addIcon(new Textures.BlockIcons.CustomIcon("basicmachines/miner/OVERLAY_BOTTOM_GLOW")) - .glow().build())); + .addIcon( + new Textures.BlockIcons.CustomIcon( + "basicmachines/miner/OVERLAY_BOTTOM_GLOW")) + .glow() + .build())); mSpeed = SPEED[aTier]; radiusConfig = RADIUS[mTier]; } @@ -258,12 +282,17 @@ public class GT_MetaTileEntity_Miner extends GT_MetaTileEntity_BasicMachine boolean isOre; do { ChunkPosition oreBlockPos = oreBlockPositions.remove(0); - oreBlock = aBaseMetaTileEntity - .getBlockOffset(oreBlockPos.chunkPosX, oreBlockPos.chunkPosY, oreBlockPos.chunkPosZ); + oreBlock = aBaseMetaTileEntity.getBlockOffset( + oreBlockPos.chunkPosX, + oreBlockPos.chunkPosY, + oreBlockPos.chunkPosZ); x = aBaseMetaTileEntity.getXCoord() + oreBlockPos.chunkPosX; y = aBaseMetaTileEntity.getYCoord() + oreBlockPos.chunkPosY; z = aBaseMetaTileEntity.getZCoord() + oreBlockPos.chunkPosZ; - isOre = GT_Utility.isOre(oreBlock, aBaseMetaTileEntity.getWorld().getBlockMetadata(x, y, z)); + isOre = GT_Utility.isOre( + oreBlock, + aBaseMetaTileEntity.getWorld() + .getBlockMetadata(x, y, z)); } // someone else might have removed the block while (!isOre && !oreBlockPositions.isEmpty()); diff --git a/src/main/java/gregtech/common/tileentities/machines/basic/GT_MetaTileEntity_MonsterRepellent.java b/src/main/java/gregtech/common/tileentities/machines/basic/GT_MetaTileEntity_MonsterRepellent.java index 054ca1694a..7a786228e4 100644 --- a/src/main/java/gregtech/common/tileentities/machines/basic/GT_MetaTileEntity_MonsterRepellent.java +++ b/src/main/java/gregtech/common/tileentities/machines/basic/GT_MetaTileEntity_MonsterRepellent.java @@ -64,10 +64,15 @@ public class GT_MetaTileEntity_MonsterRepellent extends GT_MetaTileEntity_Tiered boolean aActive, boolean aRedstone) { if (aSide != ForgeDirection.UP.ordinal()) return new ITexture[] { MACHINE_CASINGS[mTier][aColorIndex + 1] }; if (aActive) return new ITexture[] { MACHINE_CASINGS[mTier][aColorIndex + 1], - TextureFactory.of(OVERLAY_TELEPORTER_ACTIVE), - TextureFactory.builder().addIcon(OVERLAY_TELEPORTER_ACTIVE_GLOW).glow().build() }; + TextureFactory.of(OVERLAY_TELEPORTER_ACTIVE), TextureFactory.builder() + .addIcon(OVERLAY_TELEPORTER_ACTIVE_GLOW) + .glow() + .build() }; return new ITexture[] { MACHINE_CASINGS[mTier][aColorIndex + 1], TextureFactory.of(OVERLAY_TELEPORTER), - TextureFactory.builder().addIcon(OVERLAY_TELEPORTER_GLOW).glow().build() }; + TextureFactory.builder() + .addIcon(OVERLAY_TELEPORTER_GLOW) + .glow() + .build() }; } @Override @@ -96,9 +101,14 @@ public class GT_MetaTileEntity_MonsterRepellent extends GT_MetaTileEntity_Tiered @Override public void onRemoval() { - int[] tCoords = { this.getBaseMetaTileEntity().getXCoord(), this.getBaseMetaTileEntity().getYCoord(), - this.getBaseMetaTileEntity().getZCoord(), - this.getBaseMetaTileEntity().getWorld().provider.dimensionId }; + int[] tCoords = { this.getBaseMetaTileEntity() + .getXCoord(), + this.getBaseMetaTileEntity() + .getYCoord(), + this.getBaseMetaTileEntity() + .getZCoord(), + this.getBaseMetaTileEntity() + .getWorld().provider.dimensionId }; GT_SpawnEventHandler.mobReps.removeIf(coords -> Arrays.equals(coords, tCoords)); } diff --git a/src/main/java/gregtech/common/tileentities/machines/basic/GT_MetaTileEntity_PotionBrewer.java b/src/main/java/gregtech/common/tileentities/machines/basic/GT_MetaTileEntity_PotionBrewer.java index f905717c5a..bae01940f9 100644 --- a/src/main/java/gregtech/common/tileentities/machines/basic/GT_MetaTileEntity_PotionBrewer.java +++ b/src/main/java/gregtech/common/tileentities/machines/basic/GT_MetaTileEntity_PotionBrewer.java @@ -34,28 +34,52 @@ public class GT_MetaTileEntity_PotionBrewer extends GT_MetaTileEntity_BasicMachi "", TextureFactory.of( TextureFactory.of(OVERLAY_SIDE_POTIONBREWER_ACTIVE), - TextureFactory.builder().addIcon(OVERLAY_SIDE_POTIONBREWER_ACTIVE_GLOW).glow().build()), + TextureFactory.builder() + .addIcon(OVERLAY_SIDE_POTIONBREWER_ACTIVE_GLOW) + .glow() + .build()), TextureFactory.of( TextureFactory.of(OVERLAY_SIDE_POTIONBREWER), - TextureFactory.builder().addIcon(OVERLAY_SIDE_POTIONBREWER_GLOW).glow().build()), + TextureFactory.builder() + .addIcon(OVERLAY_SIDE_POTIONBREWER_GLOW) + .glow() + .build()), TextureFactory.of( TextureFactory.of(OVERLAY_FRONT_POTIONBREWER_ACTIVE), - TextureFactory.builder().addIcon(OVERLAY_FRONT_POTIONBREWER_ACTIVE_GLOW).glow().build()), + TextureFactory.builder() + .addIcon(OVERLAY_FRONT_POTIONBREWER_ACTIVE_GLOW) + .glow() + .build()), TextureFactory.of( TextureFactory.of(OVERLAY_FRONT_POTIONBREWER), - TextureFactory.builder().addIcon(OVERLAY_FRONT_POTIONBREWER_GLOW).glow().build()), + TextureFactory.builder() + .addIcon(OVERLAY_FRONT_POTIONBREWER_GLOW) + .glow() + .build()), TextureFactory.of( TextureFactory.of(OVERLAY_TOP_POTIONBREWER_ACTIVE), - TextureFactory.builder().addIcon(OVERLAY_TOP_POTIONBREWER_ACTIVE_GLOW).glow().build()), + TextureFactory.builder() + .addIcon(OVERLAY_TOP_POTIONBREWER_ACTIVE_GLOW) + .glow() + .build()), TextureFactory.of( TextureFactory.of(OVERLAY_TOP_POTIONBREWER), - TextureFactory.builder().addIcon(OVERLAY_TOP_POTIONBREWER_GLOW).glow().build()), + TextureFactory.builder() + .addIcon(OVERLAY_TOP_POTIONBREWER_GLOW) + .glow() + .build()), TextureFactory.of( TextureFactory.of(OVERLAY_BOTTOM_POTIONBREWER_ACTIVE), - TextureFactory.builder().addIcon(OVERLAY_BOTTOM_POTIONBREWER_ACTIVE_GLOW).glow().build()), + TextureFactory.builder() + .addIcon(OVERLAY_BOTTOM_POTIONBREWER_ACTIVE_GLOW) + .glow() + .build()), TextureFactory.of( TextureFactory.of(OVERLAY_BOTTOM_POTIONBREWER), - TextureFactory.builder().addIcon(OVERLAY_BOTTOM_POTIONBREWER_GLOW).glow().build())); + TextureFactory.builder() + .addIcon(OVERLAY_BOTTOM_POTIONBREWER_GLOW) + .glow() + .build())); } public GT_MetaTileEntity_PotionBrewer(String aName, int aTier, String aDescription, ITexture[][][] aTextures, @@ -98,7 +122,8 @@ public class GT_MetaTileEntity_PotionBrewer extends GT_MetaTileEntity_BasicMachi FluidStack aFluid = getFillableStack(); if ((getDrainableStack() == null) && (aFluid != null) && (getInputAt(0) != null)) { - String tInputName = aFluid.getFluid().getName(); + String tInputName = aFluid.getFluid() + .getName(); if (tInputName.startsWith("potion.")) { tInputName = tInputName.replaceFirst("potion.", ""); int tFirstDot = tInputName.indexOf('.') + 1; @@ -194,7 +219,10 @@ public class GT_MetaTileEntity_PotionBrewer extends GT_MetaTileEntity_BasicMachi @Override public boolean isFluidInputAllowed(FluidStack aFluid) { - return (aFluid.getFluid().getName().startsWith("potion.")) || (super.isFluidInputAllowed(aFluid)); + return (aFluid.getFluid() + .getName() + .startsWith("potion.")) + || (super.isFluidInputAllowed(aFluid)); } @Override diff --git a/src/main/java/gregtech/common/tileentities/machines/basic/GT_MetaTileEntity_Printer.java b/src/main/java/gregtech/common/tileentities/machines/basic/GT_MetaTileEntity_Printer.java index 7da1ec5e43..71b01f4cc2 100644 --- a/src/main/java/gregtech/common/tileentities/machines/basic/GT_MetaTileEntity_Printer.java +++ b/src/main/java/gregtech/common/tileentities/machines/basic/GT_MetaTileEntity_Printer.java @@ -41,8 +41,8 @@ public class GT_MetaTileEntity_Printer extends GT_MetaTileEntity_BasicMachine { } else if ((GT_Utility.isStackValid(getInputAt(0))) && (getInputAt(0).stackSize > 0) && (GT_Utility.isStackInvalid(getSpecialSlot())) && (OrePrefixes.block.contains(getInputAt(0)))) { - ArrayList<ItemStack> tList = GT_OreDictUnificator - .getOres(GT_OreDictUnificator.getAssociation(getInputAt(0))); + ArrayList<ItemStack> tList = GT_OreDictUnificator.getOres( + GT_OreDictUnificator.getAssociation(getInputAt(0))); if (tList.size() > 1) { tList.add(tList.get(0)); int i = 0; diff --git a/src/main/java/gregtech/common/tileentities/machines/basic/GT_MetaTileEntity_Pump.java b/src/main/java/gregtech/common/tileentities/machines/basic/GT_MetaTileEntity_Pump.java index 012f6e547f..db9aedb9eb 100644 --- a/src/main/java/gregtech/common/tileentities/machines/basic/GT_MetaTileEntity_Pump.java +++ b/src/main/java/gregtech/common/tileentities/machines/basic/GT_MetaTileEntity_Pump.java @@ -39,8 +39,8 @@ public class GT_MetaTileEntity_Pump extends GT_MetaTileEntity_Hatch { private static final ItemStack MINING_PIPE = GT_ModHandler.getIC2Item("miningPipe", 0); private static final Block MINING_PIPE_BLOCK = GT_Utility.getBlockFromStack(MINING_PIPE); - private static final Block MINING_PIPE_TIP_BLOCK = GT_Utility - .getBlockFromStack(GT_ModHandler.getIC2Item("miningPipeTip", 0)); + private static final Block MINING_PIPE_TIP_BLOCK = GT_Utility.getBlockFromStack( + GT_ModHandler.getIC2Item("miningPipeTip", 0)); public static int getMaxDistanceForTier(int aTier) { return (10 * ((int) Math.pow(1.6D, aTier))); @@ -366,13 +366,20 @@ public class GT_MetaTileEntity_Pump extends GT_MetaTileEntity_Hatch { // 2. once per 5 tick // 3. can hold retracted pipe in inventory int tHeadY = getYOfPumpHead(); - if (tHeadY < this.getBaseMetaTileEntity().getYCoord()) { - final int tXCoord = this.getBaseMetaTileEntity().getXCoord(); - final int tZCoord = this.getBaseMetaTileEntity().getZCoord(); - this.getBaseMetaTileEntity().getWorld().setBlockToAir(tXCoord, tHeadY, tZCoord); - if (tHeadY < this.getBaseMetaTileEntity().getYCoord() - 1) { + if (tHeadY < this.getBaseMetaTileEntity() + .getYCoord()) { + final int tXCoord = this.getBaseMetaTileEntity() + .getXCoord(); + final int tZCoord = this.getBaseMetaTileEntity() + .getZCoord(); + this.getBaseMetaTileEntity() + .getWorld() + .setBlockToAir(tXCoord, tHeadY, tZCoord); + if (tHeadY < this.getBaseMetaTileEntity() + .getYCoord() + - 1) { getBaseMetaTileEntity().getWorld() - .setBlock(tXCoord, tHeadY + 1, tZCoord, MINING_PIPE_TIP_BLOCK); + .setBlock(tXCoord, tHeadY + 1, tZCoord, MINING_PIPE_TIP_BLOCK); } if (this.mInventory[0] == null) { final ItemStack copy = MINING_PIPE.copy(); @@ -443,7 +450,11 @@ public class GT_MetaTileEntity_Pump extends GT_MetaTileEntity_Hatch { int x = getBaseMetaTileEntity().getXCoord(), z = getBaseMetaTileEntity().getZCoord(); if ((!consumeFluid(x, yHead - 1, z)) && (!getBaseMetaTileEntity().getBlock(x, yHead - 1, z) - .isAir(getBaseMetaTileEntity().getWorld(), x, yHead - 1, z))) { + .isAir( + getBaseMetaTileEntity().getWorld(), + x, + yHead - 1, + z))) { // Either we didn't consume a fluid, or it's a non Air block if (debugBlockPump) { GT_Log.out.println("PUMP: Did not consume fluid, or non-airblock found"); @@ -466,7 +477,8 @@ public class GT_MetaTileEntity_Pump extends GT_MetaTileEntity_Hatch { } // And change the previous block to a pipe -- as long as it isn't the pump itself! if (yHead != getBaseMetaTileEntity().getYCoord()) { - getBaseMetaTileEntity().getWorld().setBlock(x, yHead, z, MINING_PIPE_BLOCK); + getBaseMetaTileEntity().getWorld() + .setBlock(x, yHead, z, MINING_PIPE_BLOCK); } getBaseMetaTileEntity().decrStackSize(0, 1); if (debugBlockPump) { @@ -491,7 +503,8 @@ public class GT_MetaTileEntity_Pump extends GT_MetaTileEntity_Hatch { if (nextBlock == MINING_PIPE_BLOCK || nextBlock == MINING_PIPE_TIP_BLOCK) { // We're running into an existing set of pipes -- Turn this block into a pipe and keep going this.clearQueue(true); - getBaseMetaTileEntity().getWorld().setBlock(x, y, z, MINING_PIPE_BLOCK); + getBaseMetaTileEntity().getWorld() + .setBlock(x, y, z, MINING_PIPE_BLOCK); if (debugBlockPump) { GT_Log.out.println("PUMP: Hit pipes already in place, trying to merge"); } @@ -509,7 +522,8 @@ public class GT_MetaTileEntity_Pump extends GT_MetaTileEntity_Hatch { // We're below the pump at the bottom of the pipes, we haven't found a tip; make the previous pipe a // tip! this.clearQueue(true); - getBaseMetaTileEntity().getWorld().setBlock(x, y + 1, z, MINING_PIPE_TIP_BLOCK); + getBaseMetaTileEntity().getWorld() + .setBlock(x, y + 1, z, MINING_PIPE_TIP_BLOCK); if (debugBlockPump) { GT_Log.out.println("PUMP: Did not find a tip at bottom, setting last pipe as tip"); } @@ -652,7 +666,9 @@ public class GT_MetaTileEntity_Pump extends GT_MetaTileEntity_Hatch { ((IFluidBlock) aBlock).drain(getBaseMetaTileEntity().getWorld(), aX, aY, aZ, false))) { if (!isWaterOrLava) { // Only set Block to Air for non lava/water fluids - this.getBaseMetaTileEntity().getWorld().setBlockToAir(aX, aY, aZ); + this.getBaseMetaTileEntity() + .getWorld() + .setBlockToAir(aX, aY, aZ); } this.mFluid.amount += 1000; @@ -665,7 +681,8 @@ public class GT_MetaTileEntity_Pump extends GT_MetaTileEntity_Hatch { } getBaseMetaTileEntity().decreaseStoredEnergyUnits(this.getEuUsagePerAction(), true); - getBaseMetaTileEntity().getWorld().setBlock(aX, aY, aZ, Blocks.air, 0, 2); + getBaseMetaTileEntity().getWorld() + .setBlock(aX, aY, aZ, Blocks.air, 0, 2); return true; } return false; diff --git a/src/main/java/gregtech/common/tileentities/machines/basic/GT_MetaTileEntity_Replicator.java b/src/main/java/gregtech/common/tileentities/machines/basic/GT_MetaTileEntity_Replicator.java index 6add532358..739db376c1 100644 --- a/src/main/java/gregtech/common/tileentities/machines/basic/GT_MetaTileEntity_Replicator.java +++ b/src/main/java/gregtech/common/tileentities/machines/basic/GT_MetaTileEntity_Replicator.java @@ -52,28 +52,52 @@ public class GT_MetaTileEntity_Replicator extends GT_MetaTileEntity_BasicMachine "", TextureFactory.of( TextureFactory.of(OVERLAY_SIDE_REPLICATOR_ACTIVE), - TextureFactory.builder().addIcon(OVERLAY_SIDE_REPLICATOR_ACTIVE_GLOW).glow().build()), + TextureFactory.builder() + .addIcon(OVERLAY_SIDE_REPLICATOR_ACTIVE_GLOW) + .glow() + .build()), TextureFactory.of( TextureFactory.of(OVERLAY_SIDE_REPLICATOR), - TextureFactory.builder().addIcon(OVERLAY_SIDE_REPLICATOR_GLOW).glow().build()), + TextureFactory.builder() + .addIcon(OVERLAY_SIDE_REPLICATOR_GLOW) + .glow() + .build()), TextureFactory.of( TextureFactory.of(OVERLAY_FRONT_REPLICATOR_ACTIVE), - TextureFactory.builder().addIcon(OVERLAY_FRONT_REPLICATOR_ACTIVE_GLOW).glow().build()), + TextureFactory.builder() + .addIcon(OVERLAY_FRONT_REPLICATOR_ACTIVE_GLOW) + .glow() + .build()), TextureFactory.of( TextureFactory.of(OVERLAY_FRONT_REPLICATOR), - TextureFactory.builder().addIcon(OVERLAY_FRONT_REPLICATOR_GLOW).glow().build()), + TextureFactory.builder() + .addIcon(OVERLAY_FRONT_REPLICATOR_GLOW) + .glow() + .build()), TextureFactory.of( TextureFactory.of(OVERLAY_TOP_REPLICATOR_ACTIVE), - TextureFactory.builder().addIcon(OVERLAY_TOP_REPLICATOR_ACTIVE_GLOW).glow().build()), + TextureFactory.builder() + .addIcon(OVERLAY_TOP_REPLICATOR_ACTIVE_GLOW) + .glow() + .build()), TextureFactory.of( TextureFactory.of(OVERLAY_TOP_REPLICATOR), - TextureFactory.builder().addIcon(OVERLAY_TOP_REPLICATOR_GLOW).glow().build()), + TextureFactory.builder() + .addIcon(OVERLAY_TOP_REPLICATOR_GLOW) + .glow() + .build()), TextureFactory.of( TextureFactory.of(OVERLAY_BOTTOM_REPLICATOR_ACTIVE), - TextureFactory.builder().addIcon(OVERLAY_BOTTOM_REPLICATOR_ACTIVE_GLOW).glow().build()), + TextureFactory.builder() + .addIcon(OVERLAY_BOTTOM_REPLICATOR_ACTIVE_GLOW) + .glow() + .build()), TextureFactory.of( TextureFactory.of(OVERLAY_BOTTOM_REPLICATOR), - TextureFactory.builder().addIcon(OVERLAY_BOTTOM_REPLICATOR_GLOW).glow().build())); + TextureFactory.builder() + .addIcon(OVERLAY_BOTTOM_REPLICATOR_GLOW) + .glow() + .build())); } public GT_MetaTileEntity_Replicator(String aName, int aTier, String aDescription, ITexture[][][] aTextures, @@ -106,8 +130,9 @@ public class GT_MetaTileEntity_Replicator extends GT_MetaTileEntity_BasicMachine FluidStack tFluid = getFillableStack(); if ((tFluid != null) && (tFluid.isFluidEqual(Materials.UUMatter.getFluid(1L)))) { ItemStack tDataOrb = getSpecialSlot(); - if ((ItemList.Tool_DataOrb.isStackEqual(tDataOrb, false, true)) - && (Behaviour_DataOrb.getDataTitle(tDataOrb).equals("Elemental-Scan"))) { + if ((ItemList.Tool_DataOrb.isStackEqual(tDataOrb, false, true)) && (Behaviour_DataOrb.getDataTitle(tDataOrb) + .equals( + "Elemental-Scan"))) { Materials tMaterial = Element.get(Behaviour_DataOrb.getDataName(tDataOrb)).mLinkedMaterials.get(0); long tMass = cubicFluidMultiplier(MASS_OVERRIDES.getOrDefault(tMaterial, tMaterial.getMass())); if ((tFluid.amount >= tMass) && (tMass > 0L)) { @@ -169,9 +194,12 @@ public class GT_MetaTileEntity_Replicator extends GT_MetaTileEntity_BasicMachine @Override public int getCapacity() { if ((sHeaviestElementMass == 0) && (GregTech_API.sPostloadFinished)) { - sHeaviestElementMass = Materials.getMaterialsMap().values().stream() - .mapToInt(material -> (int) cubicFluidMultiplier((int) material.getMass())).max() - .orElseThrow(NoSuchElementException::new); + sHeaviestElementMass = Materials.getMaterialsMap() + .values() + .stream() + .mapToInt(material -> (int) cubicFluidMultiplier((int) material.getMass())) + .max() + .orElseThrow(NoSuchElementException::new); // Make the Number nicer =) sHeaviestElementMass = 1000 * (sHeaviestElementMass / 1000 + 1); } diff --git a/src/main/java/gregtech/common/tileentities/machines/basic/GT_MetaTileEntity_RockBreaker.java b/src/main/java/gregtech/common/tileentities/machines/basic/GT_MetaTileEntity_RockBreaker.java index 584164fa94..ace1e90f71 100644 --- a/src/main/java/gregtech/common/tileentities/machines/basic/GT_MetaTileEntity_RockBreaker.java +++ b/src/main/java/gregtech/common/tileentities/machines/basic/GT_MetaTileEntity_RockBreaker.java @@ -32,28 +32,52 @@ public class GT_MetaTileEntity_RockBreaker extends GT_MetaTileEntity_BasicMachin "", TextureFactory.of( TextureFactory.of(OVERLAY_SIDE_ROCK_BREAKER_ACTIVE), - TextureFactory.builder().addIcon(OVERLAY_SIDE_ROCK_BREAKER_ACTIVE_GLOW).glow().build()), + TextureFactory.builder() + .addIcon(OVERLAY_SIDE_ROCK_BREAKER_ACTIVE_GLOW) + .glow() + .build()), TextureFactory.of( TextureFactory.of(OVERLAY_SIDE_ROCK_BREAKER), - TextureFactory.builder().addIcon(OVERLAY_SIDE_ROCK_BREAKER_GLOW).glow().build()), + TextureFactory.builder() + .addIcon(OVERLAY_SIDE_ROCK_BREAKER_GLOW) + .glow() + .build()), TextureFactory.of( TextureFactory.of(OVERLAY_FRONT_ROCK_BREAKER_ACTIVE), - TextureFactory.builder().addIcon(OVERLAY_FRONT_ROCK_BREAKER_ACTIVE_GLOW).glow().build()), + TextureFactory.builder() + .addIcon(OVERLAY_FRONT_ROCK_BREAKER_ACTIVE_GLOW) + .glow() + .build()), TextureFactory.of( TextureFactory.of(OVERLAY_FRONT_ROCK_BREAKER), - TextureFactory.builder().addIcon(OVERLAY_FRONT_ROCK_BREAKER_GLOW).glow().build()), + TextureFactory.builder() + .addIcon(OVERLAY_FRONT_ROCK_BREAKER_GLOW) + .glow() + .build()), TextureFactory.of( TextureFactory.of(OVERLAY_TOP_ROCK_BREAKER_ACTIVE), - TextureFactory.builder().addIcon(OVERLAY_TOP_ROCK_BREAKER_ACTIVE_GLOW).glow().build()), + TextureFactory.builder() + .addIcon(OVERLAY_TOP_ROCK_BREAKER_ACTIVE_GLOW) + .glow() + .build()), TextureFactory.of( TextureFactory.of(OVERLAY_TOP_ROCK_BREAKER), - TextureFactory.builder().addIcon(OVERLAY_TOP_ROCK_BREAKER_GLOW).glow().build()), + TextureFactory.builder() + .addIcon(OVERLAY_TOP_ROCK_BREAKER_GLOW) + .glow() + .build()), TextureFactory.of( TextureFactory.of(OVERLAY_BOTTOM_ROCK_BREAKER_ACTIVE), - TextureFactory.builder().addIcon(OVERLAY_BOTTOM_ROCK_BREAKER_ACTIVE_GLOW).glow().build()), + TextureFactory.builder() + .addIcon(OVERLAY_BOTTOM_ROCK_BREAKER_ACTIVE_GLOW) + .glow() + .build()), TextureFactory.of( TextureFactory.of(OVERLAY_BOTTOM_ROCK_BREAKER), - TextureFactory.builder().addIcon(OVERLAY_BOTTOM_ROCK_BREAKER_GLOW).glow().build())); + TextureFactory.builder() + .addIcon(OVERLAY_BOTTOM_ROCK_BREAKER_GLOW) + .glow() + .build())); } public GT_MetaTileEntity_RockBreaker(String aName, int aTier, String aDescription, ITexture[][][] aTextures, diff --git a/src/main/java/gregtech/common/tileentities/machines/basic/GT_MetaTileEntity_Scanner.java b/src/main/java/gregtech/common/tileentities/machines/basic/GT_MetaTileEntity_Scanner.java index 3f37effffa..dc3c4f7dc3 100644 --- a/src/main/java/gregtech/common/tileentities/machines/basic/GT_MetaTileEntity_Scanner.java +++ b/src/main/java/gregtech/common/tileentities/machines/basic/GT_MetaTileEntity_Scanner.java @@ -50,28 +50,52 @@ public class GT_MetaTileEntity_Scanner extends GT_MetaTileEntity_BasicMachine { "", TextureFactory.of( TextureFactory.of(OVERLAY_SIDE_SCANNER_ACTIVE), - TextureFactory.builder().addIcon(OVERLAY_SIDE_SCANNER_ACTIVE_GLOW).glow().build()), + TextureFactory.builder() + .addIcon(OVERLAY_SIDE_SCANNER_ACTIVE_GLOW) + .glow() + .build()), TextureFactory.of( TextureFactory.of(OVERLAY_SIDE_SCANNER), - TextureFactory.builder().addIcon(OVERLAY_SIDE_SCANNER_GLOW).glow().build()), + TextureFactory.builder() + .addIcon(OVERLAY_SIDE_SCANNER_GLOW) + .glow() + .build()), TextureFactory.of( TextureFactory.of(OVERLAY_FRONT_SCANNER_ACTIVE), - TextureFactory.builder().addIcon(OVERLAY_FRONT_SCANNER_ACTIVE_GLOW).glow().build()), + TextureFactory.builder() + .addIcon(OVERLAY_FRONT_SCANNER_ACTIVE_GLOW) + .glow() + .build()), TextureFactory.of( TextureFactory.of(OVERLAY_FRONT_SCANNER), - TextureFactory.builder().addIcon(OVERLAY_FRONT_SCANNER_GLOW).glow().build()), + TextureFactory.builder() + .addIcon(OVERLAY_FRONT_SCANNER_GLOW) + .glow() + .build()), TextureFactory.of( TextureFactory.of(OVERLAY_TOP_SCANNER_ACTIVE), - TextureFactory.builder().addIcon(OVERLAY_TOP_SCANNER_ACTIVE_GLOW).glow().build()), + TextureFactory.builder() + .addIcon(OVERLAY_TOP_SCANNER_ACTIVE_GLOW) + .glow() + .build()), TextureFactory.of( TextureFactory.of(OVERLAY_TOP_SCANNER), - TextureFactory.builder().addIcon(OVERLAY_TOP_SCANNER_GLOW).glow().build()), + TextureFactory.builder() + .addIcon(OVERLAY_TOP_SCANNER_GLOW) + .glow() + .build()), TextureFactory.of( TextureFactory.of(OVERLAY_BOTTOM_SCANNER_ACTIVE), - TextureFactory.builder().addIcon(OVERLAY_BOTTOM_SCANNER_ACTIVE_GLOW).glow().build()), + TextureFactory.builder() + .addIcon(OVERLAY_BOTTOM_SCANNER_ACTIVE_GLOW) + .glow() + .build()), TextureFactory.of( TextureFactory.of(OVERLAY_BOTTOM_SCANNER), - TextureFactory.builder().addIcon(OVERLAY_BOTTOM_SCANNER_GLOW).glow().build())); + TextureFactory.builder() + .addIcon(OVERLAY_BOTTOM_SCANNER_GLOW) + .glow() + .build())); } public GT_MetaTileEntity_Scanner(String aName, int aTier, String aDescription, ITexture[][][] aTextures, @@ -221,9 +245,15 @@ public class GT_MetaTileEntity_Scanner extends GT_MetaTileEntity_BasicMachine { return 2; } - if ((aStack.getItem().getUnlocalizedName().contains("Schematic") - || aStack.getItem().getUnlocalizedName().contains("schematic")) - && !aStack.getItem().getUnlocalizedName().contains("Schematics")) { + if ((aStack.getItem() + .getUnlocalizedName() + .contains("Schematic") + || aStack.getItem() + .getUnlocalizedName() + .contains("schematic")) + && !aStack.getItem() + .getUnlocalizedName() + .contains("Schematics")) { if (mTier < 3) return FOUND_RECIPE_BUT_DID_NOT_MEET_REQUIREMENTS; String sTier = ""; @@ -232,39 +262,71 @@ public class GT_MetaTileEntity_Scanner extends GT_MetaTileEntity_BasicMachine { if (stackItemID == Item.getIdFromItem( Objects.requireNonNull( GT_ModHandler.getModItem(GalacticraftCore.modID, "item.schematic", 1L, 0)) - .getItem())) { - if (stackItemDamage == 0 && aStack.toString().equals( - Objects.requireNonNull( - GT_ModHandler.getModItem(GalacticraftCore.modID, "item.schematic", 1L, 0)) - .copy().toString())) + .getItem())) { + if (stackItemDamage == 0 && aStack.toString() + .equals( + Objects.requireNonNull( + GT_ModHandler.getModItem( + GalacticraftCore.modID, + "item.schematic", + 1L, + 0)) + .copy() + .toString())) sTier = "100"; - else if (stackItemDamage == 1 && aStack.toString().equals( - Objects.requireNonNull( - GT_ModHandler.getModItem(GalacticraftCore.modID, "item.schematic", 1L, 1)) - .copy().toString())) + else if (stackItemDamage == 1 && aStack.toString() + .equals( + Objects.requireNonNull( + GT_ModHandler.getModItem( + GalacticraftCore.modID, + "item.schematic", + 1L, + 1)) + .copy() + .toString())) sTier = "2"; } else { if (stackItemID == Item.getIdFromItem( Objects.requireNonNull( GT_ModHandler.getModItem(GalacticraftMars.modID, "item.schematic", 1L, 0)) - .getItem())) { - if (stackItemDamage == 0 && aStack.toString().equals( - Objects.requireNonNull( - GT_ModHandler.getModItem(GalacticraftMars.modID, "item.schematic", 1L, 0)) - .copy().toString())) + .getItem())) { + if (stackItemDamage == 0 && aStack.toString() + .equals( + Objects.requireNonNull( + GT_ModHandler.getModItem( + GalacticraftMars.modID, + "item.schematic", + 1L, + 0)) + .copy() + .toString())) sTier = "3"; - else if (stackItemDamage == 1 && aStack.toString().equals( - Objects.requireNonNull( - GT_ModHandler.getModItem(GalacticraftMars.modID, "item.schematic", 1L, 1)) - .copy().toString())) + else if (stackItemDamage == 1 && aStack.toString() + .equals( + Objects.requireNonNull( + GT_ModHandler.getModItem( + GalacticraftMars.modID, + "item.schematic", + 1L, + 1)) + .copy() + .toString())) sTier = "101"; - else if (stackItemDamage == 2 && aStack.toString().equals( - Objects.requireNonNull( - GT_ModHandler.getModItem(GalacticraftMars.modID, "item.schematic", 1L, 2)) - .copy().toString())) + else if (stackItemDamage == 2 && aStack.toString() + .equals( + Objects.requireNonNull( + GT_ModHandler.getModItem( + GalacticraftMars.modID, + "item.schematic", + 1L, + 2)) + .copy() + .toString())) sTier = "102"; - } else if (aStack.getUnlocalizedName().matches(".*\\d+.*")) - sTier = aStack.getUnlocalizedName().split("(?<=\\D)(?=\\d)")[1].substring(0, 1); + } else if (aStack.getUnlocalizedName() + .matches(".*\\d+.*")) + sTier = aStack.getUnlocalizedName() + .split("(?<=\\D)(?=\\d)")[1].substring(0, 1); else sTier = "1"; } @@ -287,7 +349,8 @@ public class GT_MetaTileEntity_Scanner extends GT_MetaTileEntity_BasicMachine { } } if (getSpecialSlot() == null && ItemList.Tool_DataStick.isStackEqual(aStack, false, true)) { - if (GT_Utility.ItemNBT.getBookTitle(aStack).equals("Raw Prospection Data")) { + if (GT_Utility.ItemNBT.getBookTitle(aStack) + .equals("Raw Prospection Data")) { GT_Utility.ItemNBT.setBookTitle(aStack, "Analyzed Prospection Data"); GT_Utility.ItemNBT.convertProspectionData(aStack); aStack.stackSize -= 1; @@ -336,10 +399,11 @@ public class GT_MetaTileEntity_Scanner extends GT_MetaTileEntity_BasicMachine { @Override public void onPostTick(IGregTechTileEntity aBaseMetaTileEntity, long aTick) { if (mProgresstime >= (mMaxProgresstime - 1)) { - if ((this.mOutputItems[0] != null) - && (this.mOutputItems[0].getUnlocalizedName().equals("gt.metaitem.01.32707"))) { + if ((this.mOutputItems[0] != null) && (this.mOutputItems[0].getUnlocalizedName() + .equals("gt.metaitem.01.32707"))) { GT_Mod.achievements.issueAchievement( - aBaseMetaTileEntity.getWorld().getPlayerEntityByName(aBaseMetaTileEntity.getOwnerName()), + aBaseMetaTileEntity.getWorld() + .getPlayerEntityByName(aBaseMetaTileEntity.getOwnerName()), "scanning"); } } diff --git a/src/main/java/gregtech/common/tileentities/machines/basic/GT_MetaTileEntity_SeismicProspector.java b/src/main/java/gregtech/common/tileentities/machines/basic/GT_MetaTileEntity_SeismicProspector.java index 4e8af7d283..18929fcb55 100644 --- a/src/main/java/gregtech/common/tileentities/machines/basic/GT_MetaTileEntity_SeismicProspector.java +++ b/src/main/java/gregtech/common/tileentities/machines/basic/GT_MetaTileEntity_SeismicProspector.java @@ -47,28 +47,52 @@ public class GT_MetaTileEntity_SeismicProspector extends GT_MetaTileEntity_Basic "", TextureFactory.of( TextureFactory.of(OVERLAY_SIDE_ROCK_BREAKER_ACTIVE), - TextureFactory.builder().addIcon(OVERLAY_SIDE_ROCK_BREAKER_ACTIVE_GLOW).glow().build()), + TextureFactory.builder() + .addIcon(OVERLAY_SIDE_ROCK_BREAKER_ACTIVE_GLOW) + .glow() + .build()), TextureFactory.of( TextureFactory.of(OVERLAY_SIDE_ROCK_BREAKER), - TextureFactory.builder().addIcon(OVERLAY_SIDE_ROCK_BREAKER_GLOW).glow().build()), + TextureFactory.builder() + .addIcon(OVERLAY_SIDE_ROCK_BREAKER_GLOW) + .glow() + .build()), TextureFactory.of( TextureFactory.of(OVERLAY_TOP_ROCK_BREAKER_ACTIVE), - TextureFactory.builder().addIcon(OVERLAY_TOP_ROCK_BREAKER_ACTIVE_GLOW).glow().build()), + TextureFactory.builder() + .addIcon(OVERLAY_TOP_ROCK_BREAKER_ACTIVE_GLOW) + .glow() + .build()), TextureFactory.of( TextureFactory.of(OVERLAY_TOP_ROCK_BREAKER), - TextureFactory.builder().addIcon(OVERLAY_TOP_ROCK_BREAKER_GLOW).glow().build()), + TextureFactory.builder() + .addIcon(OVERLAY_TOP_ROCK_BREAKER_GLOW) + .glow() + .build()), TextureFactory.of( TextureFactory.of(OVERLAY_FRONT_ROCK_BREAKER_ACTIVE), - TextureFactory.builder().addIcon(OVERLAY_FRONT_ROCK_BREAKER_ACTIVE_GLOW).glow().build()), + TextureFactory.builder() + .addIcon(OVERLAY_FRONT_ROCK_BREAKER_ACTIVE_GLOW) + .glow() + .build()), TextureFactory.of( TextureFactory.of(OVERLAY_FRONT_ROCK_BREAKER), - TextureFactory.builder().addIcon(OVERLAY_FRONT_ROCK_BREAKER_GLOW).glow().build()), + TextureFactory.builder() + .addIcon(OVERLAY_FRONT_ROCK_BREAKER_GLOW) + .glow() + .build()), TextureFactory.of( TextureFactory.of(OVERLAY_BOTTOM_ROCK_BREAKER_ACTIVE), - TextureFactory.builder().addIcon(OVERLAY_BOTTOM_ROCK_BREAKER_ACTIVE_GLOW).glow().build()), + TextureFactory.builder() + .addIcon(OVERLAY_BOTTOM_ROCK_BREAKER_ACTIVE_GLOW) + .glow() + .build()), TextureFactory.of( TextureFactory.of(OVERLAY_BOTTOM_ROCK_BREAKER), - TextureFactory.builder().addIcon(OVERLAY_BOTTOM_ROCK_BREAKER_GLOW).glow().build())); + TextureFactory.builder() + .addIcon(OVERLAY_BOTTOM_ROCK_BREAKER_GLOW) + .glow() + .build())); } public GT_MetaTileEntity_SeismicProspector(String aName, int aTier, String aDescription, ITexture[][][] aTextures, @@ -104,7 +128,8 @@ public class GT_MetaTileEntity_SeismicProspector extends GT_MetaTileEntity_Basic || (stackData != null && stackData.mMaterial.mMaterial == Materials.Glyceryl && aStack.stackSize >= 1) || (aStack.getItem() == ItemList.Block_Powderbarrel.getItem() - && aStack.getItemDamage() == ItemList.Block_Powderbarrel.get(1).getItemDamage() + && aStack.getItemDamage() == ItemList.Block_Powderbarrel.get(1) + .getItemDamage() && aStack.stackSize >= 8))) { if ((!aPlayer.capabilities.isCreativeMode) && (aStack.stackSize != 111)) { if (aStack.getItem() == Item.getItemFromBlock(Blocks.tnt)) { @@ -114,11 +139,12 @@ public class GT_MetaTileEntity_SeismicProspector extends GT_MetaTileEntity_Basic } else if (aStack.getItem() == Ic2Items.dynamite.getItem()) { aStack.stackSize -= 4; } else if (aStack.getItem() == ItemList.Block_Powderbarrel.getItem() - && aStack.getItemDamage() == ItemList.Block_Powderbarrel.get(1).getItemDamage()) { - aStack.stackSize -= 8; - } else { - aStack.stackSize -= 1; - } + && aStack.getItemDamage() == ItemList.Block_Powderbarrel.get(1) + .getItemDamage()) { + aStack.stackSize -= 8; + } else { + aStack.stackSize -= 1; + } } this.ready = true; this.mMaxProgresstime = 200; @@ -135,15 +161,21 @@ public class GT_MetaTileEntity_SeismicProspector extends GT_MetaTileEntity_Basic int max = range(); int step = step(); - for (int i = this.getBaseMetaTileEntity().getYCoord(); i > 0; i--) { + for (int i = this.getBaseMetaTileEntity() + .getYCoord(); i > 0; i--) { for (int f = min; f <= max; f += step) { for (int g = min; g <= max; g += step) { - Block tBlock = this.getBaseMetaTileEntity().getBlockOffset(f, -i, g); + Block tBlock = this.getBaseMetaTileEntity() + .getBlockOffset(f, -i, g); if ((tBlock instanceof GT_Block_Ores_Abstract)) { - TileEntity tTileEntity = getBaseMetaTileEntity().getWorld().getTileEntity( - getBaseMetaTileEntity().getXCoord() + f, - getBaseMetaTileEntity().getYCoord() + (-i), - getBaseMetaTileEntity().getZCoord() + g); + TileEntity tTileEntity = getBaseMetaTileEntity().getWorld() + .getTileEntity( + getBaseMetaTileEntity().getXCoord() + + f, + getBaseMetaTileEntity().getYCoord() + + (-i), + getBaseMetaTileEntity().getZCoord() + + g); if ((tTileEntity instanceof GT_TileEntity_Ores)) { if (((GT_TileEntity_Ores) tTileEntity).mMetaData < 16000) { Materials tMaterial = GregTech_API.sGeneratedMaterials[(((GT_TileEntity_Ores) tTileEntity).mMetaData @@ -156,16 +188,20 @@ public class GT_MetaTileEntity_SeismicProspector extends GT_MetaTileEntity_Basic } } } else { - int tMetaID = getBaseMetaTileEntity().getWorld().getBlockMetadata( - getBaseMetaTileEntity().getXCoord() + f, - getBaseMetaTileEntity().getYCoord() + (-i), - getBaseMetaTileEntity().getZCoord() + g); - ItemData tAssotiation = GT_OreDictUnificator - .getAssociation(new ItemStack(tBlock, 1, tMetaID)); - if ((tAssotiation != null) - && (tAssotiation.mPrefix.toString().startsWith("ore"))) { - if (!tStringList - .contains(tAssotiation.mMaterial.mMaterial.mDefaultLocalName)) { + int tMetaID = getBaseMetaTileEntity().getWorld() + .getBlockMetadata( + getBaseMetaTileEntity().getXCoord() + + f, + getBaseMetaTileEntity().getYCoord() + + (-i), + getBaseMetaTileEntity().getZCoord() + + g); + ItemData tAssotiation = GT_OreDictUnificator.getAssociation( + new ItemStack(tBlock, 1, tMetaID)); + if ((tAssotiation != null) && (tAssotiation.mPrefix.toString() + .startsWith("ore"))) { + if (!tStringList.contains( + tAssotiation.mMaterial.mMaterial.mDefaultLocalName)) { tStringList.add(tAssotiation.mMaterial.mMaterial.mDefaultLocalName); } } @@ -185,10 +221,14 @@ public class GT_MetaTileEntity_SeismicProspector extends GT_MetaTileEntity_Basic } GT_Utility.ItemNBT.setProspectionData( aPlayer.getCurrentEquippedItem(), - this.getBaseMetaTileEntity().getXCoord(), - this.getBaseMetaTileEntity().getYCoord(), - this.getBaseMetaTileEntity().getZCoord(), - this.getBaseMetaTileEntity().getWorld().provider.dimensionId, + this.getBaseMetaTileEntity() + .getXCoord(), + this.getBaseMetaTileEntity() + .getYCoord(), + this.getBaseMetaTileEntity() + .getZCoord(), + this.getBaseMetaTileEntity() + .getWorld().provider.dimensionId, tFluid, tStringArray); } diff --git a/src/main/java/gregtech/common/tileentities/machines/basic/GT_MetaTileEntity_Teleporter.java b/src/main/java/gregtech/common/tileentities/machines/basic/GT_MetaTileEntity_Teleporter.java index 2b1f0fa349..210c55578f 100644 --- a/src/main/java/gregtech/common/tileentities/machines/basic/GT_MetaTileEntity_Teleporter.java +++ b/src/main/java/gregtech/common/tileentities/machines/basic/GT_MetaTileEntity_Teleporter.java @@ -116,9 +116,9 @@ public class GT_MetaTileEntity_Teleporter extends GT_MetaTileEntity_BasicTank int tCount = 64; for (int i = 0; i < 36; i++) { if (tPlayer.inventory.getStackInSlot(i) != null) { - tCount += (tPlayer.inventory.getStackInSlot(i).getMaxStackSize() > 1 - ? tPlayer.inventory.getStackInSlot(i).stackSize - : 64); + tCount += (tPlayer.inventory.getStackInSlot(i) + .getMaxStackSize() + > 1 ? tPlayer.inventory.getStackInSlot(i).stackSize : 64); } } for (int i = 0; i < 4; i++) { @@ -128,10 +128,12 @@ public class GT_MetaTileEntity_Teleporter extends GT_MetaTileEntity_BasicTank } return Math.min(5.0F, tCount / 666.6F); } - if (GT_Utility.getClassName(aEntity).equals("EntityItnt")) { + if (GT_Utility.getClassName(aEntity) + .equals("EntityItnt")) { return 5.0F; } - if (GT_Utility.getClassName(aEntity).equals("EntityNuke")) { + if (GT_Utility.getClassName(aEntity) + .equals("EntityNuke")) { return 50.0F; } if ((aEntity instanceof EntityArrow)) { @@ -212,14 +214,23 @@ public class GT_MetaTileEntity_Teleporter extends GT_MetaTileEntity_BasicTank @Override public ITexture[] getTexture(IGregTechTileEntity aBaseMetaTileEntity, byte aSide, byte aFacing, byte aColorIndex, boolean aActive, boolean aRedstone) { - if (aSide != this.getBaseMetaTileEntity().getFrontFacing()) return new ITexture[] { - MACHINE_CASINGS[mTier][aColorIndex + 1], TextureFactory.of(OVERLAY_TELEPORTER_SIDES), - TextureFactory.builder().addIcon(OVERLAY_TELEPORTER_SIDES_GLOW).glow().build() }; + if (aSide != this.getBaseMetaTileEntity() + .getFrontFacing()) + return new ITexture[] { MACHINE_CASINGS[mTier][aColorIndex + 1], + TextureFactory.of(OVERLAY_TELEPORTER_SIDES), TextureFactory.builder() + .addIcon(OVERLAY_TELEPORTER_SIDES_GLOW) + .glow() + .build() }; if (aActive) return new ITexture[] { MACHINE_CASINGS[mTier][aColorIndex + 1], - TextureFactory.of(OVERLAY_TELEPORTER_ACTIVE), - TextureFactory.builder().addIcon(OVERLAY_TELEPORTER_ACTIVE_GLOW).glow().build() }; + TextureFactory.of(OVERLAY_TELEPORTER_ACTIVE), TextureFactory.builder() + .addIcon(OVERLAY_TELEPORTER_ACTIVE_GLOW) + .glow() + .build() }; return new ITexture[] { MACHINE_CASINGS[mTier][aColorIndex + 1], TextureFactory.of(OVERLAY_TELEPORTER), - TextureFactory.builder().addIcon(OVERLAY_TELEPORTER_GLOW).glow().build() }; + TextureFactory.builder() + .addIcon(OVERLAY_TELEPORTER_GLOW) + .glow() + .build() }; } @Override @@ -244,10 +255,14 @@ public class GT_MetaTileEntity_Teleporter extends GT_MetaTileEntity_BasicTank @Override public void onConfigLoad(GT_Config aConfig) { - sInterDimensionalTeleportAllowed = aConfig - .get(ConfigCategories.machineconfig, "Teleporter.Interdimensional", true); - sPassiveEnergyDrain = aConfig - .get(ConfigCategories.machineconfig, "Teleporter.PassiveDrain", sPassiveEnergyDrain); + sInterDimensionalTeleportAllowed = aConfig.get( + ConfigCategories.machineconfig, + "Teleporter.Interdimensional", + true); + sPassiveEnergyDrain = aConfig.get( + ConfigCategories.machineconfig, + "Teleporter.PassiveDrain", + sPassiveEnergyDrain); sPowerMultiplyer = aConfig.get(ConfigCategories.machineconfig, "Teleporter.PowerMultipler", sPowerMultiplyer); sFPowerMultiplyer = sPowerMultiplyer / 100.0; } @@ -343,26 +358,36 @@ public class GT_MetaTileEntity_Teleporter extends GT_MetaTileEntity_BasicTank (byte) 64, (byte) 1); if (mInventory[0] == null || mInventory[0].stackSize < tStacksize) { - getBaseMetaTileEntity() - .decreaseStoredEnergyUnits( - (long) (Math.pow(tDistance, 1.5) * tDistance - * (tStacksize - - (mInventory[0] == null ? 0 : mInventory[0].stackSize)) - * sFPowerMultiplyer), - false); + getBaseMetaTileEntity().decreaseStoredEnergyUnits( + (long) (Math.pow(tDistance, 1.5) * tDistance + * (tStacksize - (mInventory[0] == null ? 0 : mInventory[0].stackSize)) + * sFPowerMultiplyer), + false); } } } - List entities_in_box = getBaseMetaTileEntity().getWorld().getEntitiesWithinAABB( - Entity.class, - AxisAlignedBB.getBoundingBox( - getBaseMetaTileEntity().getOffsetX(getBaseMetaTileEntity().getFrontFacing(), 2) - 1, - getBaseMetaTileEntity().getOffsetY(getBaseMetaTileEntity().getFrontFacing(), 2) - 1, - getBaseMetaTileEntity().getOffsetZ(getBaseMetaTileEntity().getFrontFacing(), 2) - 1, - getBaseMetaTileEntity().getOffsetX(getBaseMetaTileEntity().getFrontFacing(), 2) + 2, - getBaseMetaTileEntity().getOffsetY(getBaseMetaTileEntity().getFrontFacing(), 2) + 2, - getBaseMetaTileEntity().getOffsetZ(getBaseMetaTileEntity().getFrontFacing(), 2) - + 2)); + List entities_in_box = getBaseMetaTileEntity().getWorld() + .getEntitiesWithinAABB( + Entity.class, + AxisAlignedBB.getBoundingBox( + getBaseMetaTileEntity().getOffsetX( + getBaseMetaTileEntity().getFrontFacing(), + 2) - 1, + getBaseMetaTileEntity().getOffsetY( + getBaseMetaTileEntity().getFrontFacing(), + 2) - 1, + getBaseMetaTileEntity().getOffsetZ( + getBaseMetaTileEntity().getFrontFacing(), + 2) - 1, + getBaseMetaTileEntity().getOffsetX( + getBaseMetaTileEntity().getFrontFacing(), + 2) + 2, + getBaseMetaTileEntity().getOffsetY( + getBaseMetaTileEntity().getFrontFacing(), + 2) + 2, + getBaseMetaTileEntity().getOffsetZ( + getBaseMetaTileEntity().getFrontFacing(), + 2) + 2)); for (Object tObject : entities_in_box) { if (((tObject instanceof Entity)) && (!((Entity) tObject).isDead)) { @@ -568,26 +593,32 @@ public class GT_MetaTileEntity_Teleporter extends GT_MetaTileEntity_BasicTank @Override public void addUIWidgets(ModularWindow.Builder builder, UIBuildContext buildContext) { builder.widget( - new DrawableWidget().setDrawable(GT_UITextures.PICTURE_SCREEN_BLACK).setSize(90, 72).setPos(43, 4)) - .widget( - TextWidget.dynamicString(() -> "X: " + GT_Utility.parseNumberToString(mTargetX)) - .setDefaultColor(COLOR_TEXT_WHITE.get()).setPos(46, 8)) - .widget( - TextWidget.dynamicString(() -> "Y: " + GT_Utility.parseNumberToString(mTargetY)) - .setDefaultColor(COLOR_TEXT_WHITE.get()).setPos(46, 16)) - .widget( - TextWidget.dynamicString(() -> "Z: " + GT_Utility.parseNumberToString(mTargetZ)) - .setDefaultColor(COLOR_TEXT_WHITE.get()).setPos(46, 24)) - .widget( - TextWidget.dynamicString(() -> "Dim: " + GT_Utility.parseNumberToString(mTargetD)) - .setDefaultColor(COLOR_TEXT_WHITE.get()).setPos(46, 32)) - .widget( - TextWidget - .dynamicString( - () -> "Dim Valid: " + (GT_Utility.isRealDimension(mTargetD) ? "Yes" : "No")) - .setDefaultColor(COLOR_TEXT_WHITE.get()) - .setEnabled(widget -> hasDimensionalTeleportCapability()).setPos(46, 40)) - .widget(new FakeSyncWidget.FluidStackSyncer(() -> mFluid, val -> mFluid = val)); + new DrawableWidget().setDrawable(GT_UITextures.PICTURE_SCREEN_BLACK) + .setSize(90, 72) + .setPos(43, 4)) + .widget( + TextWidget.dynamicString(() -> "X: " + GT_Utility.parseNumberToString(mTargetX)) + .setDefaultColor(COLOR_TEXT_WHITE.get()) + .setPos(46, 8)) + .widget( + TextWidget.dynamicString(() -> "Y: " + GT_Utility.parseNumberToString(mTargetY)) + .setDefaultColor(COLOR_TEXT_WHITE.get()) + .setPos(46, 16)) + .widget( + TextWidget.dynamicString(() -> "Z: " + GT_Utility.parseNumberToString(mTargetZ)) + .setDefaultColor(COLOR_TEXT_WHITE.get()) + .setPos(46, 24)) + .widget( + TextWidget.dynamicString(() -> "Dim: " + GT_Utility.parseNumberToString(mTargetD)) + .setDefaultColor(COLOR_TEXT_WHITE.get()) + .setPos(46, 32)) + .widget( + TextWidget.dynamicString( + () -> "Dim Valid: " + (GT_Utility.isRealDimension(mTargetD) ? "Yes" : "No")) + .setDefaultColor(COLOR_TEXT_WHITE.get()) + .setEnabled(widget -> hasDimensionalTeleportCapability()) + .setPos(46, 40)) + .widget(new FakeSyncWidget.FluidStackSyncer(() -> mFluid, val -> mFluid = val)); addChangeNumberButtons(builder, GT_UITextures.OVERLAY_BUTTON_MINUS_LARGE, -512, -64, 7); addChangeNumberButtons(builder, GT_UITextures.OVERLAY_BUTTON_MINUS_SMALL, -16, -1, 25); @@ -624,9 +655,11 @@ public class GT_MetaTileEntity_Teleporter extends GT_MetaTileEntity_BasicTank private void addChangeNumberButton(ModularWindow.Builder builder, IDrawable overlay, Consumer<Integer> setter, int addNumberShift, int addNumber, int xPos, int yPos) { builder.widget( - new ButtonWidget() - .setOnClick((clickData, widget) -> setter.accept(clickData.shift ? addNumberShift : addNumber)) - .setBackground(GT_UITextures.BUTTON_STANDARD, overlay).setSize(18, 18).setPos(xPos, yPos)); + new ButtonWidget().setOnClick( + (clickData, widget) -> setter.accept(clickData.shift ? addNumberShift : addNumber)) + .setBackground(GT_UITextures.BUTTON_STANDARD, overlay) + .setSize(18, 18) + .setPos(xPos, yPos)); } @Override @@ -637,6 +670,8 @@ public class GT_MetaTileEntity_Teleporter extends GT_MetaTileEntity_BasicTank @Override public void addGregTechLogo(ModularWindow.Builder builder) { builder.widget( - new DrawableWidget().setDrawable(getGUITextureSet().getGregTechLogo()).setSize(17, 17).setPos(113, 56)); + new DrawableWidget().setDrawable(getGUITextureSet().getGregTechLogo()) + .setSize(17, 17) + .setPos(113, 56)); } } |