diff options
Diffstat (limited to 'src/main/java/gregtech/api/util')
39 files changed, 2669 insertions, 1542 deletions
diff --git a/src/main/java/gregtech/api/util/ColorsMetadataSection.java b/src/main/java/gregtech/api/util/ColorsMetadataSection.java index d8ce59f42c..05d0bd4059 100644 --- a/src/main/java/gregtech/api/util/ColorsMetadataSection.java +++ b/src/main/java/gregtech/api/util/ColorsMetadataSection.java @@ -53,7 +53,8 @@ public class ColorsMetadataSection implements IMetadataSection { } private boolean isColorInMap(String key, Map<String, String> hexMap) { - return hexMap.containsKey(key) && !hexMap.get(key).isEmpty(); + return hexMap.containsKey(key) && !hexMap.get(key) + .isEmpty(); } public boolean sGuiTintingEnabled() { diff --git a/src/main/java/gregtech/api/util/ColorsMetadataSectionSerializer.java b/src/main/java/gregtech/api/util/ColorsMetadataSectionSerializer.java index cab41e0d3b..41b6e0013e 100644 --- a/src/main/java/gregtech/api/util/ColorsMetadataSectionSerializer.java +++ b/src/main/java/gregtech/api/util/ColorsMetadataSectionSerializer.java @@ -33,8 +33,12 @@ public class ColorsMetadataSectionSerializer extends BaseMetadataSectionSerializ if (jsonObject.has("textColor")) { JsonObject textColors = JsonUtils.func_152754_s(jsonObject, "textColor"); for (Map.Entry<String, JsonElement> entry : textColors.entrySet()) { - if (entry.getValue().isJsonPrimitive()) { - hexTextColorMap.put(entry.getKey(), entry.getValue().getAsString()); + if (entry.getValue() + .isJsonPrimitive()) { + hexTextColorMap.put( + entry.getKey(), + entry.getValue() + .getAsString()); } else { GT_Mod.GT_FML_LOGGER.warn("ColorOverride expects primitive value for key `textColor`"); } @@ -43,8 +47,10 @@ public class ColorsMetadataSectionSerializer extends BaseMetadataSectionSerializ if (jsonObject.has("guiTint")) { JsonObject guiTints = JsonUtils.func_152754_s(jsonObject, "guiTint"); - enableGuiTint = JsonUtils - .getJsonObjectBooleanFieldValueOrDefault(guiTints, "enableGuiTintWhenPainted", true); + enableGuiTint = JsonUtils.getJsonObjectBooleanFieldValueOrDefault( + guiTints, + "enableGuiTintWhenPainted", + true); for (Dyes dye : Dyes.values()) { hexGuiTintMap.put(dye.mName, GT_Util.toHexString(dye.getRGBA())); diff --git a/src/main/java/gregtech/api/util/GT_ApiaryUpgrade.java b/src/main/java/gregtech/api/util/GT_ApiaryUpgrade.java index f64f7e6a78..71c1e4716b 100644 --- a/src/main/java/gregtech/api/util/GT_ApiaryUpgrade.java +++ b/src/main/java/gregtech/api/util/GT_ApiaryUpgrade.java @@ -140,7 +140,8 @@ public enum GT_ApiaryUpgrade { SIEVE_UPGRADE,; void apply(Consumer<GT_ApiaryUpgrade> fn) { - UNIQUE_UPGRADE_LIST.get(this).forEach(fn); + UNIQUE_UPGRADE_LIST.get(this) + .forEach(fn); } } @@ -209,7 +210,8 @@ public enum GT_ApiaryUpgrade { private static final HashMap<Integer, GT_ApiaryUpgrade> quickLookup = new HashMap<>(); static { - EnumSet.allOf(GT_ApiaryUpgrade.class).forEach(GT_ApiaryUpgrade::setup_static_variables); + EnumSet.allOf(GT_ApiaryUpgrade.class) + .forEach(GT_ApiaryUpgrade::setup_static_variables); speed8upgraded.blacklistedUpgrades.add(production.id); production.blacklistedUpgrades.add(speed8upgraded.id); } diff --git a/src/main/java/gregtech/api/util/GT_AssemblyLineUtils.java b/src/main/java/gregtech/api/util/GT_AssemblyLineUtils.java index 218e5bffdc..9f648fa7e0 100644 --- a/src/main/java/gregtech/api/util/GT_AssemblyLineUtils.java +++ b/src/main/java/gregtech/api/util/GT_AssemblyLineUtils.java @@ -279,7 +279,8 @@ public class GT_AssemblyLineUtils { */ public static boolean doesDataStickHaveOutput(ItemStack aDataStick) { if (isItemDataStick(aDataStick) && aDataStick.hasTagCompound() - && aDataStick.getTagCompound().hasKey("output")) { + && aDataStick.getTagCompound() + .hasKey("output")) { return true; } return false; @@ -310,7 +311,8 @@ public class GT_AssemblyLineUtils { public static boolean doesDataStickHaveRecipeHash(ItemStack aDataStick) { if (isItemDataStick(aDataStick) && aDataStick.hasTagCompound()) { NBTTagCompound aNBT = aDataStick.getTagCompound(); - if (aNBT.hasKey("Data.Recipe.Hash") && !aNBT.getString("Data.Recipe.Hash").equals("Hash.0")) { + if (aNBT.hasKey("Data.Recipe.Hash") && !aNBT.getString("Data.Recipe.Hash") + .equals("Hash.0")) { return true; } } @@ -375,7 +377,9 @@ public class GT_AssemblyLineUtils { public static boolean setAssemblyLineRecipeOnDataStick(ItemStack aDataStick, GT_Recipe_AssemblyLine aNewRecipe) { if (isItemDataStick(aDataStick)) { String s = aNewRecipe.mOutput.getDisplayName(); - if (FMLCommonHandler.instance().getEffectiveSide().isServer()) { + if (FMLCommonHandler.instance() + .getEffectiveSide() + .isServer()) { s = GT_Assemblyline_Server.lServerNames.get(aNewRecipe.mOutput.getDisplayName()); if (s == null) { s = aNewRecipe.mOutput.getDisplayName(); @@ -440,7 +444,9 @@ public class GT_AssemblyLineUtils { tNBT.setString("author", author); NBTTagList tNBTList = new NBTTagList(); s = aNewRecipe.mOutput.getDisplayName(); - if (FMLCommonHandler.instance().getEffectiveSide().isServer()) { + if (FMLCommonHandler.instance() + .getEffectiveSide() + .isServer()) { s = GT_Assemblyline_Server.lServerNames.get(aNewRecipe.mOutput.getDisplayName()); if (s == null) s = aNewRecipe.mOutput.getDisplayName(); } @@ -460,19 +466,26 @@ public class GT_AssemblyLineUtils { for (ItemStack tStack : aNewRecipe.mOreDictAlt[i]) { if (tStack != null) { s = tStack.getDisplayName(); - if (FMLCommonHandler.instance().getEffectiveSide().isServer()) { + if (FMLCommonHandler.instance() + .getEffectiveSide() + .isServer()) { s = GT_Assemblyline_Server.lServerNames.get(tStack.getDisplayName()); if (s == null) s = tStack.getDisplayName(); } - tBuilder.append(count == 0 ? "" : "\nOr ").append(tStack.stackSize).append(" ").append(s); + tBuilder.append(count == 0 ? "" : "\nOr ") + .append(tStack.stackSize) + .append(" ") + .append(s); count++; } } if (count > 0) tNBTList.appendTag(new NBTTagString(tBuilder.toString())); } else if (aNewRecipe.mInputs[i] != null) { s = aNewRecipe.mInputs[i].getDisplayName(); - if (FMLCommonHandler.instance().getEffectiveSide().isServer()) { + if (FMLCommonHandler.instance() + .getEffectiveSide() + .isServer()) { s = GT_Assemblyline_Server.lServerNames.get(aNewRecipe.mInputs[i].getDisplayName()); if (s == null) s = aNewRecipe.mInputs[i].getDisplayName(); } @@ -484,7 +497,9 @@ public class GT_AssemblyLineUtils { for (int i = 0; i < aNewRecipe.mFluidInputs.length; i++) { if (aNewRecipe.mFluidInputs[i] != null) { s = aNewRecipe.mFluidInputs[i].getLocalizedName(); - if (FMLCommonHandler.instance().getEffectiveSide().isServer()) { + if (FMLCommonHandler.instance() + .getEffectiveSide() + .isServer()) { s = GT_Assemblyline_Server.lServerNames.get(aNewRecipe.mFluidInputs[i].getLocalizedName()); if (s == null) s = aNewRecipe.mFluidInputs[i].getLocalizedName(); } diff --git a/src/main/java/gregtech/api/util/GT_Assemblyline_Server.java b/src/main/java/gregtech/api/util/GT_Assemblyline_Server.java index a455fcf916..fa58c1d614 100644 --- a/src/main/java/gregtech/api/util/GT_Assemblyline_Server.java +++ b/src/main/java/gregtech/api/util/GT_Assemblyline_Server.java @@ -23,8 +23,14 @@ public class GT_Assemblyline_Server { public static void fillMap(FMLPreInitializationEvent aEvent) { - String s = new String(aEvent.getModConfigurationDirectory().getAbsolutePath()); - s = s.substring(0, aEvent.getModConfigurationDirectory().getAbsolutePath().length() - 6); + String s = new String( + aEvent.getModConfigurationDirectory() + .getAbsolutePath()); + s = s.substring( + 0, + aEvent.getModConfigurationDirectory() + .getAbsolutePath() + .length() - 6); s = s + "GregTech.lang"; File f = new File(s); s = ""; @@ -34,13 +40,24 @@ public class GT_Assemblyline_Server { internal.putAll(cat.getValues()); for (Map.Entry<String, Property> entry : internal.entrySet()) { try { - s = entry.getValue().getString().replaceAll("%", ""); + s = entry.getValue() + .getString() + .replaceAll("%", ""); - if (entry.getKey().contains("metaitem") && s.contains("material")) internal2.put(entry.getKey(), s); - else if (entry.getKey().contains("blockmachines") && s.contains("material")) + if (entry.getKey() + .contains("metaitem") + && s.contains("material")) + internal2.put(entry.getKey(), s); + else if (entry.getKey() + .contains("blockmachines") + && s.contains("material")) internal3.put(entry.getKey(), s); - else if ((entry.getKey().contains("blockores") - || (entry.getKey().contains("blockmetal") || entry.getKey().contains("blockgem"))) + else if ((entry.getKey() + .contains("blockores") + || (entry.getKey() + .contains("blockmetal") + || entry.getKey() + .contains("blockgem"))) && s.contains("material")) internal4.put(entry.getKey(), s); else lServerNames.put(entry.getKey(), s); @@ -48,195 +65,280 @@ public class GT_Assemblyline_Server { } for (Map.Entry<String, String> entry : internal2.entrySet()) { try { - if (entry.getKey().contains("name")) { + if (entry.getKey() + .contains("name")) { int i = Integer.parseInt( entry.getKey() - .substring("gt.metaitem.01.".length(), entry.getKey().length() - ".name".length())); + .substring( + "gt.metaitem.01.".length(), + entry.getKey() + .length() - ".name".length())); i = i % 1000; if (GregTech_API.sGeneratedMaterials[i] != null) lServerNames.put( entry.getKey(), - entry.getValue().replace("material", GregTech_API.sGeneratedMaterials[i].toString())); + entry.getValue() + .replace("material", GregTech_API.sGeneratedMaterials[i].toString())); else lServerNames.put(entry.getKey(), null); } } catch (Exception ignored) {} } for (Map.Entry<String, String> entry : internal3.entrySet()) { try { - if (entry.getKey().contains("cable")) lServerNames.put( - entry.getKey(), - entry.getValue().replace( - "material", - entry.getKey().substring( - "gt.blockmachines.cable.".length(), - entry.getKey().length() - ".01.name".length()))); - else if (entry.getKey().contains("gt_frame_")) lServerNames.put( - entry.getKey(), - entry.getValue().replace( - "material", - entry.getKey().substring( - "gt.blockmachines.gt_frame_".length(), - entry.getKey().length() - ".name".length()))); - else if (entry.getKey().contains("gt_pipe_")) { - if (!entry.getKey().contains("_huge") && !entry.getKey().contains("_large") - && !entry.getKey().contains("_nonuple") - && !entry.getKey().contains("_quadruple") - && !entry.getKey().contains("_small") - && !entry.getKey().contains("_tiny")) - lServerNames.put( - entry.getKey(), - entry.getValue().replace( - "material", - entry.getKey().substring( - "gt.blockmachines.gt_pipe_".length(), - entry.getKey().length() - ".name".length()))); - else if (entry.getKey().contains("_huge") || entry.getKey().contains("_tiny")) lServerNames.put( - entry.getKey(), - entry.getValue().replace( - "material", - entry.getKey().substring( - "gt.blockmachines.gt_pipe_".length(), - entry.getKey().length() - "_tiny.name".length()))); - else if (entry.getKey().contains("_large") || entry.getKey().contains("_small")) lServerNames.put( + if (entry.getKey() + .contains("cable")) + lServerNames.put( entry.getKey(), - entry.getValue().replace( - "material", - entry.getKey().substring( - "gt.blockmachines.gt_pipe_".length(), - entry.getKey().length() - "_large.name".length()))); - else if (entry.getKey().contains("_nonuple")) lServerNames.put( + entry.getValue() + .replace( + "material", + entry.getKey() + .substring( + "gt.blockmachines.cable.".length(), + entry.getKey() + .length() - ".01.name".length()))); + else if (entry.getKey() + .contains("gt_frame_")) + lServerNames.put( entry.getKey(), - entry.getValue().replace( - "material", - entry.getKey().substring( - "gt.blockmachines.gt_pipe_".length(), - entry.getKey().length() - "_nonuple.name".length()))); - else if (entry.getKey().contains("_quadruple")) lServerNames.put( - entry.getKey(), - entry.getValue().replace( - "material", - entry.getKey().substring( - "gt.blockmachines.gt_pipe_".length(), - entry.getKey().length() - "_quadruple.name".length()))); - } else if (entry.getKey().contains("wire")) lServerNames.put( - entry.getKey(), - entry.getValue().replace( - "material", - entry.getKey().substring( - "gt.blockmachines.wire.".length(), - entry.getKey().length() - ".01.name".length()))); - else lServerNames.put(entry.getKey(), entry.getValue()); + entry.getValue() + .replace( + "material", + entry.getKey() + .substring( + "gt.blockmachines.gt_frame_".length(), + entry.getKey() + .length() - ".name".length()))); + else if (entry.getKey() + .contains("gt_pipe_")) { + if (!entry.getKey() + .contains("_huge") + && !entry.getKey() + .contains("_large") + && !entry.getKey() + .contains("_nonuple") + && !entry.getKey() + .contains("_quadruple") + && !entry.getKey() + .contains("_small") + && !entry.getKey() + .contains("_tiny")) + lServerNames.put( + entry.getKey(), + entry.getValue() + .replace( + "material", + entry.getKey() + .substring( + "gt.blockmachines.gt_pipe_".length(), + entry.getKey() + .length() - ".name".length()))); + else if (entry.getKey() + .contains("_huge") + || entry.getKey() + .contains("_tiny")) + lServerNames.put( + entry.getKey(), + entry.getValue() + .replace( + "material", + entry.getKey() + .substring( + "gt.blockmachines.gt_pipe_".length(), + entry.getKey() + .length() - "_tiny.name".length()))); + else if (entry.getKey() + .contains("_large") + || entry.getKey() + .contains("_small")) + lServerNames.put( + entry.getKey(), + entry.getValue() + .replace( + "material", + entry.getKey() + .substring( + "gt.blockmachines.gt_pipe_".length(), + entry.getKey() + .length() - "_large.name".length()))); + else if (entry.getKey() + .contains("_nonuple")) + lServerNames.put( + entry.getKey(), + entry.getValue() + .replace( + "material", + entry.getKey() + .substring( + "gt.blockmachines.gt_pipe_".length(), + entry.getKey() + .length() - "_nonuple.name".length()))); + else if (entry.getKey() + .contains("_quadruple")) + lServerNames.put( + entry.getKey(), + entry.getValue() + .replace( + "material", + entry.getKey() + .substring( + "gt.blockmachines.gt_pipe_".length(), + entry.getKey() + .length() - "_quadruple.name".length()))); + } else + if (entry.getKey() + .contains("wire")) + lServerNames.put( + entry.getKey(), + entry.getValue() + .replace( + "material", + entry.getKey() + .substring( + "gt.blockmachines.wire.".length(), + entry.getKey() + .length() - ".01.name".length()))); + else lServerNames.put(entry.getKey(), entry.getValue()); } catch (Exception ignored) {} } for (Map.Entry<String, String> entry : internal4.entrySet()) { try { - if (entry.getKey().contains("blockores")) { + if (entry.getKey() + .contains("blockores")) { int i = Integer.parseInt( entry.getKey() - .substring("gt.blockores.".length(), entry.getKey().length() - ".name".length())); + .substring( + "gt.blockores.".length(), + entry.getKey() + .length() - ".name".length())); i = i % 1000; if (GregTech_API.sGeneratedMaterials[i] != null) lServerNames.put( entry.getKey(), - entry.getValue().replace("material", GregTech_API.sGeneratedMaterials[i].toString())); + entry.getValue() + .replace("material", GregTech_API.sGeneratedMaterials[i].toString())); else lServerNames.put(entry.getKey(), null); - } else if (entry.getKey().contains("blockmetal")) { - Materials[] mMats = null; - String t = entry.getKey().substring("gt.blockmetal".length()); - t = t.substring(0, 1); - int i = Integer.parseInt(t); - switch (i) { - case 1: - mMats = new Materials[] { Materials.Adamantium, Materials.Aluminium, Materials.Americium, - Materials.AnnealedCopper, Materials.Antimony, Materials.Arsenic, - Materials.AstralSilver, Materials.BatteryAlloy, Materials.Beryllium, - Materials.Bismuth, Materials.BismuthBronze, Materials.BlackBronze, - Materials.BlackSteel, Materials.BlueAlloy, Materials.BlueSteel, Materials.Brass }; - break; - case 2: - mMats = new Materials[] { Materials.Bronze, Materials.Caesium, Materials.Cerium, - Materials.Chrome, Materials.ChromiumDioxide, Materials.Cobalt, - Materials.CobaltBrass, Materials.Copper, Materials.Cupronickel, - Materials.DamascusSteel, Materials.DarkIron, Materials.DeepIron, Materials.Desh, - Materials.Duranium, Materials.Dysprosium, Materials.Electrum }; - break; - case 3: - mMats = new Materials[] { Materials.ElectrumFlux, Materials.Enderium, Materials.Erbium, - Materials.Europium, Materials.FierySteel, Materials.Gadolinium, Materials.Gallium, - Materials.Holmium, Materials.HSLA, Materials.Indium, Materials.InfusedGold, - Materials.Invar, Materials.Iridium, Materials.IronMagnetic, Materials.IronWood, - Materials.Kanthal }; - break; - case 4: - mMats = new Materials[] { Materials.Knightmetal, Materials.Lanthanum, Materials.Lead, - Materials.Lutetium, Materials.Magnalium, Materials.Magnesium, Materials.Manganese, - Materials.MeteoricIron, Materials.MeteoricSteel, Materials.Trinium, - Materials.Mithril, Materials.Molybdenum, Materials.Naquadah, - Materials.NaquadahAlloy, Materials.NaquadahEnriched, Materials.Naquadria }; - break; - case 5: - mMats = new Materials[] { Materials.Neodymium, Materials.NeodymiumMagnetic, - Materials.Neutronium, Materials.Nichrome, Materials.Nickel, Materials.Niobium, - Materials.NiobiumNitride, Materials.NiobiumTitanium, Materials.Osmiridium, - Materials.Osmium, Materials.Palladium, Materials.PigIron, Materials.Platinum, - Materials.Plutonium, Materials.Plutonium241, Materials.Praseodymium }; - break; - case 6: - mMats = new Materials[] { Materials.Promethium, Materials.RedAlloy, Materials.RedSteel, - Materials.RoseGold, Materials.Rubidium, Materials.Samarium, Materials.Scandium, - Materials.ShadowIron, Materials.ShadowSteel, Materials.Silicon, Materials.Silver, - Materials.SolderingAlloy, Materials.StainlessSteel, Materials.Steel, - Materials.SteelMagnetic, Materials.SterlingSilver }; - break; - case 7: - mMats = new Materials[] { Materials.Sunnarium, Materials.Tantalum, Materials.Tellurium, - Materials.Terbium, Materials.Thaumium, Materials.Thorium, Materials.Thulium, - Materials.Tin, Materials.TinAlloy, Materials.Titanium, Materials.Tritanium, - Materials.Tungsten, Materials.TungstenSteel, Materials.Ultimet, Materials.Uranium, - Materials.Uranium235 }; - break; - case 8: - mMats = new Materials[] { Materials.Vanadium, Materials.VanadiumGallium, - Materials.WroughtIron, Materials.Ytterbium, Materials.Yttrium, - Materials.YttriumBariumCuprate, Materials.Zinc, Materials.TungstenCarbide, - Materials.VanadiumSteel, Materials.HSSG, Materials.HSSE, Materials.HSSS, - Materials.Steeleaf, Materials.Ichorium, Materials.Firestone }; - break; - } - t = entry.getKey() - .substring("gt.blockmetal1.".length(), entry.getKey().length() - ".name".length()); - i = Integer.parseInt(t); - lServerNames.put(entry.getKey(), "Block of " + mMats[i].toString()); - mMats = null; - } else if (entry.getKey().contains("blockgem")) { - Materials[] mMats = null; - String t = entry.getKey().substring("gt.blockgem".length()); - t = t.substring(0, 1); - int i = Integer.parseInt(t); - switch (i) { - case 1: - mMats = new Materials[] { Materials.InfusedAir, Materials.Amber, Materials.Amethyst, - Materials.InfusedWater, Materials.BlueTopaz, Materials.CertusQuartz, - Materials.Dilithium, Materials.EnderEye, Materials.EnderPearl, Materials.FoolsRuby, - Materials.Force, Materials.Forcicium, Materials.Forcillium, Materials.GreenSapphire, - Materials.InfusedFire, Materials.Jasper, MaterialsBotania.ManaDiamond, - MaterialsBotania.BotaniaDragonstone }; - break; - case 2: - mMats = new Materials[] { Materials.Lazurite, Materials.Lignite, Materials.Monazite, - Materials.Niter, Materials.Olivine, Materials.Opal, Materials.InfusedOrder, - Materials.InfusedEntropy, Materials.Phosphorus, Materials.Quartzite, - Materials.GarnetRed, Materials.Ruby, Materials.Sapphire, Materials.Sodalite, - Materials.Tanzanite, Materials.InfusedEarth }; - break; - case 3: - mMats = new Materials[] { Materials.Topaz, Materials.Vinteum, Materials.GarnetYellow, - Materials.NetherStar, Materials.Charcoal, Materials.Blaze }; - break; - } - t = entry.getKey().substring("gt.blockgem1.".length(), entry.getKey().length() - ".name".length()); - i = Integer.parseInt(t); - lServerNames.put(entry.getKey(), "Block of " + mMats[i].toString()); - mMats = null; - } + } else if (entry.getKey() + .contains("blockmetal")) { + Materials[] mMats = null; + String t = entry.getKey() + .substring("gt.blockmetal".length()); + t = t.substring(0, 1); + int i = Integer.parseInt(t); + switch (i) { + case 1: + mMats = new Materials[] { Materials.Adamantium, Materials.Aluminium, + Materials.Americium, Materials.AnnealedCopper, Materials.Antimony, + Materials.Arsenic, Materials.AstralSilver, Materials.BatteryAlloy, + Materials.Beryllium, Materials.Bismuth, Materials.BismuthBronze, + Materials.BlackBronze, Materials.BlackSteel, Materials.BlueAlloy, + Materials.BlueSteel, Materials.Brass }; + break; + case 2: + mMats = new Materials[] { Materials.Bronze, Materials.Caesium, + Materials.Cerium, Materials.Chrome, Materials.ChromiumDioxide, + Materials.Cobalt, Materials.CobaltBrass, Materials.Copper, + Materials.Cupronickel, Materials.DamascusSteel, Materials.DarkIron, + Materials.DeepIron, Materials.Desh, Materials.Duranium, + Materials.Dysprosium, Materials.Electrum }; + break; + case 3: + mMats = new Materials[] { Materials.ElectrumFlux, Materials.Enderium, + Materials.Erbium, Materials.Europium, Materials.FierySteel, + Materials.Gadolinium, Materials.Gallium, Materials.Holmium, + Materials.HSLA, Materials.Indium, Materials.InfusedGold, + Materials.Invar, Materials.Iridium, Materials.IronMagnetic, + Materials.IronWood, Materials.Kanthal }; + break; + case 4: + mMats = new Materials[] { Materials.Knightmetal, Materials.Lanthanum, + Materials.Lead, Materials.Lutetium, Materials.Magnalium, + Materials.Magnesium, Materials.Manganese, Materials.MeteoricIron, + Materials.MeteoricSteel, Materials.Trinium, Materials.Mithril, + Materials.Molybdenum, Materials.Naquadah, Materials.NaquadahAlloy, + Materials.NaquadahEnriched, Materials.Naquadria }; + break; + case 5: + mMats = new Materials[] { Materials.Neodymium, Materials.NeodymiumMagnetic, + Materials.Neutronium, Materials.Nichrome, Materials.Nickel, + Materials.Niobium, Materials.NiobiumNitride, + Materials.NiobiumTitanium, Materials.Osmiridium, Materials.Osmium, + Materials.Palladium, Materials.PigIron, Materials.Platinum, + Materials.Plutonium, Materials.Plutonium241, + Materials.Praseodymium }; + break; + case 6: + mMats = new Materials[] { Materials.Promethium, Materials.RedAlloy, + Materials.RedSteel, Materials.RoseGold, Materials.Rubidium, + Materials.Samarium, Materials.Scandium, Materials.ShadowIron, + Materials.ShadowSteel, Materials.Silicon, Materials.Silver, + Materials.SolderingAlloy, Materials.StainlessSteel, Materials.Steel, + Materials.SteelMagnetic, Materials.SterlingSilver }; + break; + case 7: + mMats = new Materials[] { Materials.Sunnarium, Materials.Tantalum, + Materials.Tellurium, Materials.Terbium, Materials.Thaumium, + Materials.Thorium, Materials.Thulium, Materials.Tin, + Materials.TinAlloy, Materials.Titanium, Materials.Tritanium, + Materials.Tungsten, Materials.TungstenSteel, Materials.Ultimet, + Materials.Uranium, Materials.Uranium235 }; + break; + case 8: + mMats = new Materials[] { Materials.Vanadium, Materials.VanadiumGallium, + Materials.WroughtIron, Materials.Ytterbium, Materials.Yttrium, + Materials.YttriumBariumCuprate, Materials.Zinc, + Materials.TungstenCarbide, Materials.VanadiumSteel, Materials.HSSG, + Materials.HSSE, Materials.HSSS, Materials.Steeleaf, + Materials.Ichorium, Materials.Firestone }; + break; + } + t = entry.getKey() + .substring( + "gt.blockmetal1.".length(), + entry.getKey() + .length() - ".name".length()); + i = Integer.parseInt(t); + lServerNames.put(entry.getKey(), "Block of " + mMats[i].toString()); + mMats = null; + } else + if (entry.getKey() + .contains("blockgem")) { + Materials[] mMats = null; + String t = entry.getKey() + .substring("gt.blockgem".length()); + t = t.substring(0, 1); + int i = Integer.parseInt(t); + switch (i) { + case 1: + mMats = new Materials[] { Materials.InfusedAir, Materials.Amber, + Materials.Amethyst, Materials.InfusedWater, Materials.BlueTopaz, + Materials.CertusQuartz, Materials.Dilithium, Materials.EnderEye, + Materials.EnderPearl, Materials.FoolsRuby, Materials.Force, + Materials.Forcicium, Materials.Forcillium, Materials.GreenSapphire, + Materials.InfusedFire, Materials.Jasper, MaterialsBotania.ManaDiamond, + MaterialsBotania.BotaniaDragonstone }; + break; + case 2: + mMats = new Materials[] { Materials.Lazurite, Materials.Lignite, + Materials.Monazite, Materials.Niter, Materials.Olivine, Materials.Opal, + Materials.InfusedOrder, Materials.InfusedEntropy, Materials.Phosphorus, + Materials.Quartzite, Materials.GarnetRed, Materials.Ruby, + Materials.Sapphire, Materials.Sodalite, Materials.Tanzanite, + Materials.InfusedEarth }; + break; + case 3: + mMats = new Materials[] { Materials.Topaz, Materials.Vinteum, + Materials.GarnetYellow, Materials.NetherStar, Materials.Charcoal, + Materials.Blaze }; + break; + } + t = entry.getKey() + .substring( + "gt.blockgem1.".length(), + entry.getKey() + .length() - ".name".length()); + i = Integer.parseInt(t); + lServerNames.put(entry.getKey(), "Block of " + mMats[i].toString()); + mMats = null; + } } catch (Exception ignored) {} } diff --git a/src/main/java/gregtech/api/util/GT_BaseCrop.java b/src/main/java/gregtech/api/util/GT_BaseCrop.java index bfffbe8572..e66866cd8f 100644 --- a/src/main/java/gregtech/api/util/GT_BaseCrop.java +++ b/src/main/java/gregtech/api/util/GT_BaseCrop.java @@ -118,8 +118,11 @@ public class GT_BaseCrop extends CropCard implements ICropCardInfo { if (bIc2NeiLoaded) { try { Class.forName("speiger.src.crops.api.CropPluginAPI") - .getMethod("registerCropInfo", Class.forName("speiger.src.crops.api.ICropCardInfo")) - .invoke(Class.forName("speiger.src.crops.api.CropPluginAPI").getField("instance"), this); + .getMethod("registerCropInfo", Class.forName("speiger.src.crops.api.ICropCardInfo")) + .invoke( + Class.forName("speiger.src.crops.api.CropPluginAPI") + .getField("instance"), + this); } catch (IllegalAccessException ex) { bIc2NeiLoaded = false; } catch (IllegalArgumentException ex) { @@ -206,10 +209,12 @@ public class GT_BaseCrop extends CropCard implements ICropCardInfo { @Override public ItemStack getGain(ICropTile aCrop) { int tDrop = 0; - if (mSpecialDrops != null - && (tDrop = java.util.concurrent.ThreadLocalRandom.current().nextInt(0, (mSpecialDrops.length * 2) + 2)) - < mSpecialDrops.length - && mSpecialDrops[tDrop] != null) { + if (mSpecialDrops != null && (tDrop = java.util.concurrent.ThreadLocalRandom.current() + .nextInt( + 0, + (mSpecialDrops.length * 2) + + 2)) + < mSpecialDrops.length && mSpecialDrops[tDrop] != null) { return GT_Utility.copyOrNull(mSpecialDrops[tDrop]); } return GT_Utility.copyOrNull(mDrop); @@ -232,12 +237,16 @@ public class GT_BaseCrop extends CropCard implements ICropCardInfo { } for (int i = 1; i < this.getrootslength(aCrop); i++) { Block tBlock = aCrop.getWorld() - .getBlock(aCrop.getLocation().posX, aCrop.getLocation().posY - i, aCrop.getLocation().posZ); + .getBlock( + aCrop.getLocation().posX, + aCrop.getLocation().posY - i, + aCrop.getLocation().posZ); if ((tBlock instanceof GT_Block_Ores_Abstract)) { - TileEntity tTileEntity = aCrop.getWorld().getTileEntity( - aCrop.getLocation().posX, - aCrop.getLocation().posY - i, - aCrop.getLocation().posZ); + TileEntity tTileEntity = aCrop.getWorld() + .getTileEntity( + aCrop.getLocation().posX, + aCrop.getLocation().posY - i, + aCrop.getLocation().posZ); if ((tTileEntity instanceof GT_TileEntity_Ores)) { Materials tMaterial = GregTech_API.sGeneratedMaterials[(((GT_TileEntity_Ores) tTileEntity).mMetaData % 1000)]; @@ -250,12 +259,14 @@ public class GT_BaseCrop extends CropCard implements ICropCardInfo { } } } else { - int tMetaID = aCrop.getWorld().getBlockMetadata( - aCrop.getLocation().posX, - aCrop.getLocation().posY - i, - aCrop.getLocation().posZ); + int tMetaID = aCrop.getWorld() + .getBlockMetadata( + aCrop.getLocation().posX, + aCrop.getLocation().posY - i, + aCrop.getLocation().posZ); ItemData tAssotiation = GT_OreDictUnificator.getAssociation(new ItemStack(tBlock, 1, tMetaID)); - if ((tAssotiation != null) && (tAssotiation.mPrefix.toString().startsWith("ore")) + if ((tAssotiation != null) && (tAssotiation.mPrefix.toString() + .startsWith("ore")) && (tAssotiation.mMaterial.mMaterial == mBlock)) { return true; } diff --git a/src/main/java/gregtech/api/util/GT_CLS_Compat.java b/src/main/java/gregtech/api/util/GT_CLS_Compat.java index 7e3b7c424c..a7cae35d59 100644 --- a/src/main/java/gregtech/api/util/GT_CLS_Compat.java +++ b/src/main/java/gregtech/api/util/GT_CLS_Compat.java @@ -44,23 +44,25 @@ public class GT_CLS_Compat { GT_Mod.GT_FML_LOGGER.catching(ex); } - Optional.ofNullable(alexiilMinecraftDisplayer).ifPresent(e -> { - try { - getLastPercent = e.getMethod("getLastPercent"); - isReplacingVanillaMaterials = e.getField("isReplacingVanillaMaterials"); - isRegisteringGTmaterials = e.getField("isRegisteringGTmaterials"); - } catch (NoSuchMethodException | NoSuchFieldException ex) { - GT_Mod.GT_FML_LOGGER.catching(ex); - } - }); - - Optional.ofNullable(alexiilProgressDisplayer).ifPresent(e -> { - try { - displayProgress = e.getMethod("displayProgress", String.class, float.class); - } catch (NoSuchMethodException ex) { - GT_Mod.GT_FML_LOGGER.catching(ex); - } - }); + Optional.ofNullable(alexiilMinecraftDisplayer) + .ifPresent(e -> { + try { + getLastPercent = e.getMethod("getLastPercent"); + isReplacingVanillaMaterials = e.getField("isReplacingVanillaMaterials"); + isRegisteringGTmaterials = e.getField("isRegisteringGTmaterials"); + } catch (NoSuchMethodException | NoSuchFieldException ex) { + GT_Mod.GT_FML_LOGGER.catching(ex); + } + }); + + Optional.ofNullable(alexiilProgressDisplayer) + .ifPresent(e -> { + try { + displayProgress = e.getMethod("displayProgress", String.class, float.class); + } catch (NoSuchMethodException ex) { + GT_Mod.GT_FML_LOGGER.catching(ex); + } + }); try { progressBarStep = cpwProgressBar.getDeclaredField("step"); @@ -86,7 +88,8 @@ public class GT_CLS_Compat { if (nextProgressionReportAt < now) { nextProgressionReportAt = now + progressionReportsEvery; - String materialName = getName.apply(m).toString(); + String materialName = getName.apply(m) + .toString(); try { displayProgress.invoke(null, materialName, (float) currentStep / sizeStep); } catch (IllegalAccessException | InvocationTargetException iae) { diff --git a/src/main/java/gregtech/api/util/GT_ChunkAssociatedData.java b/src/main/java/gregtech/api/util/GT_ChunkAssociatedData.java index ea1ac73621..113d8cc420 100644 --- a/src/main/java/gregtech/api/util/GT_ChunkAssociatedData.java +++ b/src/main/java/gregtech/api/util/GT_ChunkAssociatedData.java @@ -64,8 +64,13 @@ import gregtech.api.interfaces.tileentity.IGregTechTileEntity; public abstract class GT_ChunkAssociatedData<T extends GT_ChunkAssociatedData.IData> { private static final Map<String, GT_ChunkAssociatedData<?>> instances = new ConcurrentHashMap<>(); - private static final int IO_PARALLELISM = Math - .min(8, Math.max(1, Runtime.getRuntime().availableProcessors() * 2 / 3)); + private static final int IO_PARALLELISM = Math.min( + 8, + Math.max( + 1, + Runtime.getRuntime() + .availableProcessors() * 2 + / 3)); private static final ExecutorService IO_WORKERS = Executors.newWorkStealingPool(IO_PARALLELISM); private static final Pattern FILE_PATTERN = Pattern.compile("(.+)\\.(-?\\d+)\\.(-?\\d+)\\.dat"); @@ -131,13 +136,13 @@ public abstract class GT_ChunkAssociatedData<T extends GT_ChunkAssociatedData.ID public final T get(World world, int chunkX, int chunkZ) { SuperRegion region = masterMap.computeIfAbsent(world.provider.dimensionId, ignored -> new ConcurrentHashMap<>()) - .computeIfAbsent(getRegionID(chunkX, chunkZ), c -> new SuperRegion(world, c)); + .computeIfAbsent(getRegionID(chunkX, chunkZ), c -> new SuperRegion(world, c)); return region.get(Math.floorMod(chunkX, regionLength), Math.floorMod(chunkZ, regionLength)); } protected final void set(World world, int chunkX, int chunkZ, T data) { SuperRegion region = masterMap.computeIfAbsent(world.provider.dimensionId, ignored -> new ConcurrentHashMap<>()) - .computeIfAbsent(getRegionID(chunkX, chunkZ), c -> new SuperRegion(world, c)); + .computeIfAbsent(getRegionID(chunkX, chunkZ), c -> new SuperRegion(world, c)); region.set(Math.floorMod(chunkX, regionLength), Math.floorMod(chunkZ, regionLength), data); } @@ -153,8 +158,13 @@ public abstract class GT_ChunkAssociatedData<T extends GT_ChunkAssociatedData.ID public void clear() { if (GT_Values.debugWorldData) { - long dirtyRegionCount = masterMap.values().stream().flatMap(m -> m.values().stream()) - .filter(SuperRegion::isDirty).count(); + long dirtyRegionCount = masterMap.values() + .stream() + .flatMap( + m -> m.values() + .stream()) + .filter(SuperRegion::isDirty) + .count(); if (dirtyRegionCount > 0) GT_Log.out.println( "Clearing ChunkAssociatedData with " + dirtyRegionCount + " regions dirty. Data might have been lost!"); @@ -163,24 +173,34 @@ public abstract class GT_ChunkAssociatedData<T extends GT_ChunkAssociatedData.ID } public void save() { - saveRegions(masterMap.values().stream().flatMap(m -> m.values().stream())); + saveRegions( + masterMap.values() + .stream() + .flatMap( + m -> m.values() + .stream())); } public void save(World world) { Map<ChunkCoordIntPair, SuperRegion> map = masterMap.get(world.provider.dimensionId); - if (map != null) saveRegions(map.values().stream()); + if (map != null) saveRegions( + map.values() + .stream()); } private void saveRegions(Stream<SuperRegion> stream) { - stream.filter(r -> r.isDirty()).map(c -> (Runnable) c::save).map(r -> CompletableFuture.runAsync(r, IO_WORKERS)) - .reduce(CompletableFuture::allOf).ifPresent(f -> { - try { - f.get(); - } catch (Exception e) { - GT_Log.err.println("Data save error: " + mId); - e.printStackTrace(GT_Log.err); - } - }); + stream.filter(r -> r.isDirty()) + .map(c -> (Runnable) c::save) + .map(r -> CompletableFuture.runAsync(r, IO_WORKERS)) + .reduce(CompletableFuture::allOf) + .ifPresent(f -> { + try { + f.get(); + } catch (Exception e) { + GT_Log.err.println("Data save error: " + mId); + e.printStackTrace(GT_Log.err); + } + }); } protected abstract void writeElement(DataOutput output, T element, World world, int chunkX, int chunkZ) @@ -222,21 +242,34 @@ public abstract class GT_ChunkAssociatedData<T extends GT_ChunkAssociatedData.ID return; try (Stream<Path> stream = Files.list(getSaveDirectory(w).toPath())) { Map<ChunkCoordIntPair, SuperRegion> worldData = stream.map(f -> { - Matcher matcher = FILE_PATTERN.matcher(f.getFileName().toString()); + Matcher matcher = FILE_PATTERN.matcher( + f.getFileName() + .toString()); return matcher.matches() ? matcher : null; - }).filter(Objects::nonNull).filter(m -> mId.equals(m.group(1))).map( - m -> CompletableFuture.supplyAsync( - () -> new SuperRegion(w, Integer.parseInt(m.group(2)), Integer.parseInt(m.group(3))), - IO_WORKERS)) - .map(f -> { - try { - return f.get(); - } catch (Exception e) { - GT_Log.err.println("Error loading region"); - e.printStackTrace(GT_Log.err); - return null; - } - }).filter(Objects::nonNull).collect(Collectors.toMap(SuperRegion::getCoord, Function.identity())); + }) + .filter(Objects::nonNull) + .filter(m -> mId.equals(m.group(1))) + .map( + m -> CompletableFuture.supplyAsync( + () -> new SuperRegion( + w, + Integer.parseInt(m.group(2)), + Integer.parseInt(m.group(3))), + IO_WORKERS)) + .map(f -> { + try { + return f.get(); + } catch (Exception e) { + GT_Log.err.println("Error loading region"); + e.printStackTrace(GT_Log.err); + return null; + } + }) + .filter(Objects::nonNull) + .collect( + Collectors.toMap( + SuperRegion::getCoord, + Function.identity())); masterMap.put(w.provider.dimensionId, worldData); } catch (IOException | UncheckedIOException e) { GT_Log.err.println("Error loading all region"); @@ -246,8 +279,12 @@ public abstract class GT_ChunkAssociatedData<T extends GT_ChunkAssociatedData.ID protected File getSaveDirectory(World w) { File base; - if (w.provider.getSaveFolder() == null) base = w.getSaveHandler().getWorldDirectory(); - else base = new File(w.getSaveHandler().getWorldDirectory(), w.provider.getSaveFolder()); + if (w.provider.getSaveFolder() == null) base = w.getSaveHandler() + .getWorldDirectory(); + else base = new File( + w.getSaveHandler() + .getWorldDirectory(), + w.provider.getSaveFolder()); return new File(base, "gregtech"); } @@ -347,7 +384,8 @@ public abstract class GT_ChunkAssociatedData<T extends GT_ChunkAssociatedData.ID private void save0() throws IOException { // noinspection ResultOfMethodCallIgnored - backingStorage.getParentFile().mkdirs(); + backingStorage.getParentFile() + .mkdirs(); File tmpFile = getTmpFile(); World world = Objects.requireNonNull(this.world.get(), "Attempting to save region of another world!"); try (DataOutputStream output = new DataOutputStream(new FileOutputStream(tmpFile))) { diff --git a/src/main/java/gregtech/api/util/GT_CircuitryBehavior.java b/src/main/java/gregtech/api/util/GT_CircuitryBehavior.java index 809c66d5d0..a8a39e341c 100644 --- a/src/main/java/gregtech/api/util/GT_CircuitryBehavior.java +++ b/src/main/java/gregtech/api/util/GT_CircuitryBehavior.java @@ -36,12 +36,14 @@ public abstract class GT_CircuitryBehavior { */ public static boolean getAnyRedstone(IRedstoneCircuitBlock aRedstoneCircuitBlock) { for (byte side : ALL_VALID_SIDES) { - if (side != aRedstoneCircuitBlock.getOutputFacing() - && aRedstoneCircuitBlock.getCover(side).letsRedstoneGoIn( - side, - aRedstoneCircuitBlock.getCoverID(side), - aRedstoneCircuitBlock.getCoverVariable(side), - aRedstoneCircuitBlock.getOwnTileEntity())) { + if (side != aRedstoneCircuitBlock.getOutputFacing() && aRedstoneCircuitBlock.getCover(side) + .letsRedstoneGoIn( + side, + aRedstoneCircuitBlock.getCoverID( + side), + aRedstoneCircuitBlock.getCoverVariable( + side), + aRedstoneCircuitBlock.getOwnTileEntity())) { if (aRedstoneCircuitBlock.getInputRedstone(side) > 0) { return true; } @@ -55,12 +57,14 @@ public abstract class GT_CircuitryBehavior { */ public static boolean getAllRedstone(IRedstoneCircuitBlock aRedstoneCircuitBlock) { for (byte side : ALL_VALID_SIDES) { - if (side != aRedstoneCircuitBlock.getOutputFacing() - && aRedstoneCircuitBlock.getCover(side).letsRedstoneGoIn( - side, - aRedstoneCircuitBlock.getCoverID(side), - aRedstoneCircuitBlock.getCoverVariable(side), - aRedstoneCircuitBlock.getOwnTileEntity())) { + if (side != aRedstoneCircuitBlock.getOutputFacing() && aRedstoneCircuitBlock.getCover(side) + .letsRedstoneGoIn( + side, + aRedstoneCircuitBlock.getCoverID( + side), + aRedstoneCircuitBlock.getCoverVariable( + side), + aRedstoneCircuitBlock.getOwnTileEntity())) { if (aRedstoneCircuitBlock.getInputRedstone(side) == 0) { return false; } @@ -75,12 +79,14 @@ public abstract class GT_CircuitryBehavior { public static boolean getOneRedstone(IRedstoneCircuitBlock aRedstoneCircuitBlock) { int tRedstoneAmount = 0; for (byte side : ALL_VALID_SIDES) { - if (side != aRedstoneCircuitBlock.getOutputFacing() - && aRedstoneCircuitBlock.getCover(side).letsRedstoneGoIn( - side, - aRedstoneCircuitBlock.getCoverID(side), - aRedstoneCircuitBlock.getCoverVariable(side), - aRedstoneCircuitBlock.getOwnTileEntity())) { + if (side != aRedstoneCircuitBlock.getOutputFacing() && aRedstoneCircuitBlock.getCover(side) + .letsRedstoneGoIn( + side, + aRedstoneCircuitBlock.getCoverID( + side), + aRedstoneCircuitBlock.getCoverVariable( + side), + aRedstoneCircuitBlock.getOwnTileEntity())) { if (aRedstoneCircuitBlock.getInputRedstone(side) > 0) { tRedstoneAmount++; } @@ -95,12 +101,14 @@ public abstract class GT_CircuitryBehavior { public static byte getStrongestRedstone(IRedstoneCircuitBlock aRedstoneCircuitBlock) { byte tRedstoneAmount = 0; for (byte side : ALL_VALID_SIDES) { - if (side != aRedstoneCircuitBlock.getOutputFacing() - && aRedstoneCircuitBlock.getCover(side).letsRedstoneGoIn( - side, - aRedstoneCircuitBlock.getCoverID(side), - aRedstoneCircuitBlock.getCoverVariable(side), - aRedstoneCircuitBlock.getOwnTileEntity())) { + if (side != aRedstoneCircuitBlock.getOutputFacing() && aRedstoneCircuitBlock.getCover(side) + .letsRedstoneGoIn( + side, + aRedstoneCircuitBlock.getCoverID( + side), + aRedstoneCircuitBlock.getCoverVariable( + side), + aRedstoneCircuitBlock.getOwnTileEntity())) { tRedstoneAmount = (byte) Math.max(tRedstoneAmount, aRedstoneCircuitBlock.getInputRedstone(side)); } } @@ -118,12 +126,14 @@ public abstract class GT_CircuitryBehavior { if (!getAnyRedstone(aRedstoneCircuitBlock)) return 0; byte tRedstoneAmount = 15; for (byte side : ALL_VALID_SIDES) { - if (side != aRedstoneCircuitBlock.getOutputFacing() - && aRedstoneCircuitBlock.getCover(side).letsRedstoneGoIn( - side, - aRedstoneCircuitBlock.getCoverID(side), - aRedstoneCircuitBlock.getCoverVariable(side), - aRedstoneCircuitBlock.getOwnTileEntity())) { + if (side != aRedstoneCircuitBlock.getOutputFacing() && aRedstoneCircuitBlock.getCover(side) + .letsRedstoneGoIn( + side, + aRedstoneCircuitBlock.getCoverID( + side), + aRedstoneCircuitBlock.getCoverVariable( + side), + aRedstoneCircuitBlock.getOwnTileEntity())) { if (aRedstoneCircuitBlock.getInputRedstone(side) > 0) tRedstoneAmount = (byte) Math.min(tRedstoneAmount, aRedstoneCircuitBlock.getInputRedstone(side)); } @@ -138,12 +148,14 @@ public abstract class GT_CircuitryBehavior { if (!getAnyRedstone(aRedstoneCircuitBlock)) return 0; byte tRedstoneAmount = 15; for (byte side : ALL_VALID_SIDES) { - if (side != aRedstoneCircuitBlock.getOutputFacing() - && aRedstoneCircuitBlock.getCover(side).letsRedstoneGoIn( - side, - aRedstoneCircuitBlock.getCoverID(side), - aRedstoneCircuitBlock.getCoverVariable(side), - aRedstoneCircuitBlock.getOwnTileEntity())) { + if (side != aRedstoneCircuitBlock.getOutputFacing() && aRedstoneCircuitBlock.getCover(side) + .letsRedstoneGoIn( + side, + aRedstoneCircuitBlock.getCoverID( + side), + aRedstoneCircuitBlock.getCoverVariable( + side), + aRedstoneCircuitBlock.getOwnTileEntity())) { tRedstoneAmount = (byte) Math.min(tRedstoneAmount, aRedstoneCircuitBlock.getInputRedstone(side)); } } diff --git a/src/main/java/gregtech/api/util/GT_ClientPreference.java b/src/main/java/gregtech/api/util/GT_ClientPreference.java index 34db521bd4..0d5e39c1a8 100644 --- a/src/main/java/gregtech/api/util/GT_ClientPreference.java +++ b/src/main/java/gregtech/api/util/GT_ClientPreference.java @@ -15,8 +15,10 @@ public class GT_ClientPreference { public GT_ClientPreference(GT_Config aClientDataFile) { this.mSingleBlockInitialFilter = aClientDataFile.get("preference", "mSingleBlockInitialFilter", false); - this.mSingleBlockInitialMultiStack = aClientDataFile - .get("preference", "mSingleBlockInitialAllowMultiStack", false); + this.mSingleBlockInitialMultiStack = aClientDataFile.get( + "preference", + "mSingleBlockInitialAllowMultiStack", + false); this.mInputBusInitialFilter = aClientDataFile.get("preference", "mInputBusInitialFilter", true); } diff --git a/src/main/java/gregtech/api/util/GT_Config.java b/src/main/java/gregtech/api/util/GT_Config.java index 337b3b7f68..40bff73ac7 100644 --- a/src/main/java/gregtech/api/util/GT_Config.java +++ b/src/main/java/gregtech/api/util/GT_Config.java @@ -32,8 +32,11 @@ public class GT_Config implements Runnable { public static int addIDConfig(Object aCategory, String aName, int aDefault) { if (GT_Utility.isStringInvalid(aName)) return aDefault; - Property tProperty = sConfigFileIDs - .get(aCategory.toString().replaceAll("\\|", "."), aName.replaceAll("\\|", "."), aDefault); + Property tProperty = sConfigFileIDs.get( + aCategory.toString() + .replaceAll("\\|", "."), + aName.replaceAll("\\|", "."), + aDefault); int rResult = tProperty.getInt(aDefault); if (!tProperty.wasRead() && shouldSave()) sConfigFileIDs.save(); return rResult; @@ -48,7 +51,8 @@ public class GT_Config implements Runnable { } catch (Throwable e) { /* Do nothing */ } - String sName = aStack.getItem().toString(); + String sName = aStack.getItem() + .toString(); String[] tmp = sName.split("@"); if (tmp.length > 0) sName = tmp[0]; return sName + "." + aStack.getItemDamage(); @@ -62,7 +66,8 @@ public class GT_Config implements Runnable { public boolean get(Object aCategory, String aName, boolean aDefault) { if (GT_Utility.isStringInvalid(aName)) return aDefault; Property tProperty = mConfig.get( - aCategory.toString().replaceAll("\\|", "_"), + aCategory.toString() + .replaceAll("\\|", "_"), (aName + "_" + aDefault).replaceAll("\\|", "_"), aDefault); boolean rResult = tProperty.getBoolean(aDefault); @@ -77,7 +82,8 @@ public class GT_Config implements Runnable { public int get(Object aCategory, String aName, int aDefault) { if (GT_Utility.isStringInvalid(aName)) return aDefault; Property tProperty = mConfig.get( - aCategory.toString().replaceAll("\\|", "_"), + aCategory.toString() + .replaceAll("\\|", "_"), (aName + "_" + aDefault).replaceAll("\\|", "_"), aDefault); int rResult = tProperty.getInt(aDefault); @@ -92,7 +98,8 @@ public class GT_Config implements Runnable { public double get(Object aCategory, String aName, double aDefault) { if (GT_Utility.isStringInvalid(aName)) return aDefault; Property tProperty = mConfig.get( - aCategory.toString().replaceAll("\\|", "_"), + aCategory.toString() + .replaceAll("\\|", "_"), (aName + "_" + aDefault).replaceAll("\\|", "_"), aDefault); double rResult = tProperty.getDouble(aDefault); @@ -107,7 +114,8 @@ public class GT_Config implements Runnable { public String get(Object aCategory, String aName, String aDefault) { if (GT_Utility.isStringInvalid(aName)) return aDefault; Property tProperty = mConfig.get( - aCategory.toString().replaceAll("\\|", "_"), + aCategory.toString() + .replaceAll("\\|", "_"), (aName + "_" + aDefault).replaceAll("\\|", "_"), aDefault); String rResult = tProperty.getString(); @@ -121,8 +129,11 @@ public class GT_Config implements Runnable { public String[] get(Object aCategory, String aName, String... aDefault) { if (GT_Utility.isStringInvalid(aName)) return aDefault; - Property tProperty = mConfig - .get(aCategory.toString().replaceAll("\\|", "_"), aName.replaceAll("\\|", "_"), aDefault); + Property tProperty = mConfig.get( + aCategory.toString() + .replaceAll("\\|", "_"), + aName.replaceAll("\\|", "_"), + aDefault); String[] rResult = tProperty.getStringList(); if (!tProperty.wasRead() && GregTech_API.sPostloadFinished) mConfig.save(); return rResult; diff --git a/src/main/java/gregtech/api/util/GT_CoverBehaviorBase.java b/src/main/java/gregtech/api/util/GT_CoverBehaviorBase.java index fed28825f3..33e8c9b1ce 100644 --- a/src/main/java/gregtech/api/util/GT_CoverBehaviorBase.java +++ b/src/main/java/gregtech/api/util/GT_CoverBehaviorBase.java @@ -449,7 +449,9 @@ public abstract class GT_CoverBehaviorBase<T extends ISerializableObject> { addTitleToUI(builder); addUIWidgets(builder); if (getUIBuildContext().isAnotherWindow()) { - builder.widget(ButtonWidget.closeWindowButton(true).setPos(getGUIWidth() - 15, 3)); + builder.widget( + ButtonWidget.closeWindowButton(true) + .setPos(getGUIWidth() - 15, 3)); } return builder.build(); } @@ -470,7 +472,8 @@ public abstract class GT_CoverBehaviorBase<T extends ISerializableObject> { public T getCoverData() { if (isCoverValid()) { return forceCast( - getUIBuildContext().getTile().getComplexCoverDataAtSide(getUIBuildContext().getCoverSide())); + getUIBuildContext().getTile() + .getComplexCoverDataAtSide(getUIBuildContext().getCoverSide())); } else { return null; } @@ -478,13 +481,14 @@ public abstract class GT_CoverBehaviorBase<T extends ISerializableObject> { public boolean setCoverData(T data) { if (isCoverValid()) { - getUIBuildContext().getTile().receiveCoverData( - getUIBuildContext().getCoverSide(), - getUIBuildContext().getCoverID(), - data, - getUIBuildContext().getPlayer() instanceof EntityPlayerMP - ? (EntityPlayerMP) getUIBuildContext().getPlayer() - : null); + getUIBuildContext().getTile() + .receiveCoverData( + getUIBuildContext().getCoverSide(), + getUIBuildContext().getCoverID(), + data, + getUIBuildContext().getPlayer() instanceof EntityPlayerMP + ? (EntityPlayerMP) getUIBuildContext().getPlayer() + : null); return true; } else { return false; @@ -492,16 +496,23 @@ public abstract class GT_CoverBehaviorBase<T extends ISerializableObject> { } public boolean isCoverValid() { - return !getUIBuildContext().getTile().isDead() - && getUIBuildContext().getTile().getCoverBehaviorAtSideNew(getUIBuildContext().getCoverSide()) + return !getUIBuildContext().getTile() + .isDead() + && getUIBuildContext().getTile() + .getCoverBehaviorAtSideNew(getUIBuildContext().getCoverSide()) != GregTech_API.sNoBehavior; } protected void addTitleToUI(ModularWindow.Builder builder) { ItemStack coverItem = GT_Utility.intToStack(getUIBuildContext().getCoverID()); if (coverItem != null) { - builder.widget(new ItemDrawable(coverItem).asWidget().setPos(5, 5).setSize(16, 16)).widget( - new TextWidget(coverItem.getDisplayName()).setDefaultColor(COLOR_TITLE.get()).setPos(25, 9)); + builder.widget( + new ItemDrawable(coverItem).asWidget() + .setPos(5, 5) + .setSize(16, 16)) + .widget( + new TextWidget(coverItem.getDisplayName()).setDefaultColor(COLOR_TITLE.get()) + .setPos(25, 9)); } } diff --git a/src/main/java/gregtech/api/util/GT_ExoticEnergyInputHelper.java b/src/main/java/gregtech/api/util/GT_ExoticEnergyInputHelper.java index 90430c9bcb..9ca7a16031 100644 --- a/src/main/java/gregtech/api/util/GT_ExoticEnergyInputHelper.java +++ b/src/main/java/gregtech/api/util/GT_ExoticEnergyInputHelper.java @@ -43,8 +43,12 @@ public class GT_ExoticEnergyInputHelper { public static boolean drainEnergy(long aEU, Collection<? extends GT_MetaTileEntity_Hatch> hatches) { for (GT_MetaTileEntity_Hatch tHatch : hatches) { - long tDrain = Math.min(tHatch.getBaseMetaTileEntity().getStoredEU(), aEU); - tHatch.getBaseMetaTileEntity().decreaseStoredEnergyUnits(tDrain, false); + long tDrain = Math.min( + tHatch.getBaseMetaTileEntity() + .getStoredEU(), + aEU); + tHatch.getBaseMetaTileEntity() + .decreaseStoredEnergyUnits(tDrain, false); aEU -= tDrain; } return aEU <= 0; @@ -59,15 +63,18 @@ public class GT_ExoticEnergyInputHelper { public static long getTotalEuMulti(Collection<? extends GT_MetaTileEntity_Hatch> hatches) { long rEU = 0L; - for (GT_MetaTileEntity_Hatch tHatch : hatches) if (isValidMetaTileEntity(tHatch)) - rEU += tHatch.getBaseMetaTileEntity().getInputVoltage() * tHatch.maxWorkingAmperesIn(); + for (GT_MetaTileEntity_Hatch tHatch : hatches) + if (isValidMetaTileEntity(tHatch)) rEU += tHatch.getBaseMetaTileEntity() + .getInputVoltage() + * tHatch.maxWorkingAmperesIn(); return rEU; } public static long getMaxInputVoltageMulti(Collection<? extends GT_MetaTileEntity_Hatch> hatches) { long rVoltage = 0; for (GT_MetaTileEntity_Hatch tHatch : hatches) - if (isValidMetaTileEntity(tHatch)) rVoltage += tHatch.getBaseMetaTileEntity().getInputVoltage(); + if (isValidMetaTileEntity(tHatch)) rVoltage += tHatch.getBaseMetaTileEntity() + .getInputVoltage(); return rVoltage; } @@ -77,14 +84,16 @@ public class GT_ExoticEnergyInputHelper { return rVoltage; } for (GT_MetaTileEntity_Hatch tHatch : hatches) - if (isValidMetaTileEntity(tHatch)) rVoltage += tHatch.getBaseMetaTileEntity().getInputVoltage(); + if (isValidMetaTileEntity(tHatch)) rVoltage += tHatch.getBaseMetaTileEntity() + .getInputVoltage(); return rVoltage / hatches.size(); } public static long getMaxInputAmpsMulti(Collection<? extends GT_MetaTileEntity_Hatch> hatches) { long rAmp = 0; for (GT_MetaTileEntity_Hatch tHatch : hatches) - if (isValidMetaTileEntity(tHatch)) rAmp += tHatch.getBaseMetaTileEntity().getInputAmperage(); + if (isValidMetaTileEntity(tHatch)) rAmp += tHatch.getBaseMetaTileEntity() + .getInputAmperage(); return rAmp; } diff --git a/src/main/java/gregtech/api/util/GT_FoodStat.java b/src/main/java/gregtech/api/util/GT_FoodStat.java index cc1616f866..b658f3abe5 100644 --- a/src/main/java/gregtech/api/util/GT_FoodStat.java +++ b/src/main/java/gregtech/api/util/GT_FoodStat.java @@ -72,8 +72,12 @@ public class GT_FoodStat implements IFoodStat { aPlayer.dropPlayerItemWithRandomChoice(tStack, true); new WorldSpawnedEventBuilder.SoundAtEntityEventBuilder().setIdentifier(SoundResource.RANDOM_BURP) - .setVolume(0.5F).setPitch(aPlayer.worldObj.rand.nextFloat() * 0.1F + 0.9F).setEntity(aPlayer) - .setWorld(aPlayer.worldObj).run(); + .setVolume(0.5F) + .setPitch( + aPlayer.worldObj.rand.nextFloat() * 0.1F + 0.9F) + .setEntity(aPlayer) + .setWorld(aPlayer.worldObj) + .run(); if (!aPlayer.worldObj.isRemote) { if (mMilk) { @@ -90,9 +94,16 @@ public class GT_FoodStat implements IFoodStat { } } if (mExplosive) { - new WorldSpawnedEventBuilder.ExplosionEffectEventBuilder().setSmoking(true).setFlaming(true) - .setStrength(4f).setPosition(aPlayer.posX, aPlayer.posY, aPlayer.posZ).setEntity(aPlayer) - .setWorld(aPlayer.worldObj).run(); + new WorldSpawnedEventBuilder.ExplosionEffectEventBuilder().setSmoking(true) + .setFlaming(true) + .setStrength(4f) + .setPosition( + aPlayer.posX, + aPlayer.posY, + aPlayer.posZ) + .setEntity(aPlayer) + .setWorld(aPlayer.worldObj) + .run(); aPlayer.attackEntityFrom(GT_DamageSources.getExplodingDamage(), Float.MAX_VALUE); } } diff --git a/src/main/java/gregtech/api/util/GT_Forestry_Compat.java b/src/main/java/gregtech/api/util/GT_Forestry_Compat.java index 68c20f7fa1..95efdf40f0 100644 --- a/src/main/java/gregtech/api/util/GT_Forestry_Compat.java +++ b/src/main/java/gregtech/api/util/GT_Forestry_Compat.java @@ -134,7 +134,8 @@ public class GT_Forestry_Compat { int i = 0; for (Map.Entry<ItemStack, Float> entry : outputs.entrySet()) { tChances[i] = (int) (entry.getValue() * 10000); - tOutputs[i] = entry.getKey().copy(); + tOutputs[i] = entry.getKey() + .copy(); i++; } GT_Recipe.GT_Recipe_Map.sCentrifugeRecipes.addRecipe( diff --git a/src/main/java/gregtech/api/util/GT_GC_Compat.java b/src/main/java/gregtech/api/util/GT_GC_Compat.java index 93c7f35746..23b4a42930 100644 --- a/src/main/java/gregtech/api/util/GT_GC_Compat.java +++ b/src/main/java/gregtech/api/util/GT_GC_Compat.java @@ -29,8 +29,10 @@ public class GT_GC_Compat { if (tReceived > 0) { tSizeToReceive -= tReceived; while (tSizeToReceive > 0) { - tReceived = ((IEnergyHandlerGC) tTileEntity) - .receiveEnergyGC(eSource, tSizeToReceive, false); + tReceived = ((IEnergyHandlerGC) tTileEntity).receiveEnergyGC( + eSource, + tSizeToReceive, + false); if (tReceived < 1) break; tSizeToReceive -= tReceived; } diff --git a/src/main/java/gregtech/api/util/GT_HatchElementBuilder.java b/src/main/java/gregtech/api/util/GT_HatchElementBuilder.java index 96e721e9be..6c6ac4bc62 100644 --- a/src/main/java/gregtech/api/util/GT_HatchElementBuilder.java +++ b/src/main/java/gregtech/api/util/GT_HatchElementBuilder.java @@ -57,13 +57,22 @@ public class GT_HatchElementBuilder<T> { @SafeVarargs public final GT_HatchElementBuilder<T> anyOf(IHatchElement<? super T>... elements) { if (elements == null || elements.length == 0) throw new IllegalArgumentException(); - return adder(Arrays.stream(elements).map(e -> e.adder().rebrand()).reduce(IGT_HatchAdder::orElse).get()) - .hatchClasses( - Arrays.stream(elements).map(IHatchElement::mteClasses).flatMap(Collection::stream) - .collect(Collectors.toList())) - .cacheHint( - () -> Arrays.stream(elements).map(IHatchElement::name).sorted() - .collect(Collectors.joining(" or ", "of type ", ""))); + return adder( + Arrays.stream(elements) + .map( + e -> e.adder() + .rebrand()) + .reduce(IGT_HatchAdder::orElse) + .get()).hatchClasses( + Arrays.stream(elements) + .map(IHatchElement::mteClasses) + .flatMap(Collection::stream) + .collect(Collectors.toList())) + .cacheHint( + () -> Arrays.stream(elements) + .map(IHatchElement::name) + .sorted() + .collect(Collectors.joining(" or ", "of type ", ""))); } /** @@ -75,8 +84,8 @@ public class GT_HatchElementBuilder<T> { public final GT_HatchElementBuilder<T> atLeast(IHatchElement<? super T>... elements) { if (elements == null || elements.length == 0) throw new IllegalArgumentException(); return atLeast( - Arrays.stream(elements).collect( - Collectors.groupingBy(Function.identity(), LinkedHashMap::new, Collectors.counting()))); + Arrays.stream(elements) + .collect(Collectors.groupingBy(Function.identity(), LinkedHashMap::new, Collectors.counting()))); } /** @@ -87,8 +96,9 @@ public class GT_HatchElementBuilder<T> { public final GT_HatchElementBuilder<T> atLeastList(List<IHatchElement<? super T>> elements) { if (elements == null || elements.isEmpty()) throw new IllegalArgumentException(); return atLeast( - elements.stream().collect( - Collectors.groupingBy(Function.identity(), LinkedHashMap::new, Collectors.counting()))); + elements.stream() + .collect( + Collectors.groupingBy(Function.identity(), LinkedHashMap::new, Collectors.counting()))); } /** @@ -97,27 +107,58 @@ public class GT_HatchElementBuilder<T> { public final GT_HatchElementBuilder<T> atLeast(Map<IHatchElement<? super T>, ? extends Number> elements) { if (elements == null || elements.isEmpty() || elements.containsKey(null) || elements.containsValue(null)) throw new IllegalArgumentException(); - List<Class<? extends IMetaTileEntity>> list = elements.keySet().stream().map(IHatchElement::mteClasses) - .flatMap(Collection::stream).collect(Collectors.toList()); + List<Class<? extends IMetaTileEntity>> list = elements.keySet() + .stream() + .map(IHatchElement::mteClasses) + .flatMap(Collection::stream) + .collect(Collectors.toList()); // map cannot be null or empty, so assert Optional isPresent return adder( - elements.keySet().stream().map(e -> e.adder().rebrand()).reduce(IGT_HatchAdder::orElse) - .orElseThrow(AssertionError::new)).hatchItemFilter( - obj -> GT_StructureUtility.filterByMTEClass( - elements.entrySet().stream().filter( - entry -> entry.getKey().count(obj) < entry.getValue().longValue()) - .flatMap(entry -> entry.getKey().mteClasses().stream()) - .collect(Collectors.toList()))) - .shouldReject( - obj -> elements.entrySet().stream() - .allMatch(e -> e.getKey().count(obj) >= e.getValue().longValue())) - .shouldSkip( - (BiPredicate<? super T, ? super IGregTechTileEntity> & Builtin) (c, - t) -> t != null && list.stream() - .anyMatch(clazz -> clazz.isInstance(t.getMetaTileEntity()))) - .cacheHint( - () -> elements.keySet().stream().map(IHatchElement::name).sorted() - .collect(Collectors.joining(" or ", "of type ", ""))); + elements.keySet() + .stream() + .map( + e -> e.adder() + .rebrand()) + .reduce(IGT_HatchAdder::orElse) + .orElseThrow(AssertionError::new)) + .hatchItemFilter( + obj -> GT_StructureUtility.filterByMTEClass( + elements.entrySet() + .stream() + .filter( + entry -> entry.getKey() + .count(obj) + < entry.getValue() + .longValue()) + .flatMap( + entry -> entry.getKey() + .mteClasses() + .stream()) + .collect(Collectors.toList()))) + .shouldReject( + obj -> elements.entrySet() + .stream() + .allMatch( + e -> e.getKey() + .count(obj) + >= e.getValue() + .longValue())) + .shouldSkip( + (BiPredicate<? super T, ? super IGregTechTileEntity> & Builtin) ( + c, t) -> t != null && list.stream() + .anyMatch( + clazz -> clazz.isInstance( + t.getMetaTileEntity()))) + .cacheHint( + () -> elements.keySet() + .stream() + .map(IHatchElement::name) + .sorted() + .collect( + Collectors.joining( + " or ", + "of type ", + ""))); } // endregion @@ -167,7 +208,8 @@ public class GT_HatchElementBuilder<T> { Function<? super T, ? extends Predicate<ItemStack>> aHatchItemFilter) { if (aHatchItemFilter == null) throw new IllegalArgumentException(); BiFunction<? super T, ItemStack, ? extends Predicate<ItemStack>> tOldFilter = mHatchItemFilter; - mHatchItemFilter = (t, s) -> tOldFilter.apply(t, s).and(aHatchItemFilter.apply(t)); + mHatchItemFilter = (t, s) -> tOldFilter.apply(t, s) + .and(aHatchItemFilter.apply(t)); return this; } @@ -182,7 +224,8 @@ public class GT_HatchElementBuilder<T> { BiFunction<? super T, ItemStack, ? extends Predicate<ItemStack>> aHatchItemFilter) { if (aHatchItemFilter == null) throw new IllegalArgumentException(); BiFunction<? super T, ItemStack, ? extends Predicate<ItemStack>> tOldFilter = mHatchItemFilter; - mHatchItemFilter = (t, s) -> tOldFilter.apply(t, s).and(aHatchItemFilter.apply(t, s)); + mHatchItemFilter = (t, s) -> tOldFilter.apply(t, s) + .and(aHatchItemFilter.apply(t, s)); return this; } @@ -254,10 +297,14 @@ public class GT_HatchElementBuilder<T> { // region intermediate public GT_HatchElementBuilder<T> hatchClass(Class<? extends IMetaTileEntity> clazz) { - return hatchItemFilter(c -> is -> clazz.isInstance(GT_Item_Machines.getMetaTileEntity(is))) - .cacheHint(() -> "of class " + clazz.getSimpleName()).shouldSkip( - (BiPredicate<? super T, ? super IGregTechTileEntity> & Builtin) (c, t) -> clazz - .isInstance(t.getMetaTileEntity())); + return hatchItemFilter( + c -> is -> clazz.isInstance(GT_Item_Machines.getMetaTileEntity(is))).cacheHint( + () -> "of class " + clazz.getSimpleName()) + .shouldSkip( + (BiPredicate<? super T, ? super IGregTechTileEntity> & Builtin) ( + c, + t) -> clazz.isInstance( + t.getMetaTileEntity())); } @SafeVarargs @@ -267,21 +314,27 @@ public class GT_HatchElementBuilder<T> { public final GT_HatchElementBuilder<T> hatchClasses(List<? extends Class<? extends IMetaTileEntity>> classes) { List<? extends Class<? extends IMetaTileEntity>> list = new ArrayList<>(classes); - return hatchItemFilter(obj -> GT_StructureUtility.filterByMTEClass(list)) - .cacheHint( - () -> list.stream().map(Class::getSimpleName).sorted() - .collect(Collectors.joining(" or ", "of class ", ""))) - .shouldSkip( - (BiPredicate<? super T, ? super IGregTechTileEntity> & Builtin) (c, t) -> t != null - && list.stream().anyMatch(clazz -> clazz.isInstance(t.getMetaTileEntity()))); + return hatchItemFilter(obj -> GT_StructureUtility.filterByMTEClass(list)).cacheHint( + () -> list.stream() + .map(Class::getSimpleName) + .sorted() + .collect(Collectors.joining(" or ", "of class ", ""))) + .shouldSkip( + (BiPredicate<? super T, ? super IGregTechTileEntity> & Builtin) ( + c, t) -> t != null + && list.stream() + .anyMatch( + clazz -> clazz.isInstance( + t.getMetaTileEntity()))); } public GT_HatchElementBuilder<T> hatchId(int aId) { return hatchItemFilter( c -> is -> GT_Utility.isStackValid(is) && is.getItem() instanceof GT_Item_Machines - && is.getItemDamage() == aId).cacheHint(() -> "of id " + aId).shouldSkip( - (BiPredicate<? super T, ? super IGregTechTileEntity> & Builtin) (c, t) -> t != null - && t.getMetaTileID() == aId); + && is.getItemDamage() == aId).cacheHint(() -> "of id " + aId) + .shouldSkip( + (BiPredicate<? super T, ? super IGregTechTileEntity> & Builtin) ( + c, t) -> t != null && t.getMetaTileID() == aId); } public GT_HatchElementBuilder<T> hatchIds(int... aIds) { @@ -290,13 +343,15 @@ public class GT_HatchElementBuilder<T> { TIntCollection coll = aIds.length < 16 ? new TIntArrayList(aIds) : new TIntHashSet(aIds); return hatchItemFilter( c -> is -> GT_Utility.isStackValid(is) && is.getItem() instanceof GT_Item_Machines - && coll.contains(is.getItemDamage())) - .cacheHint( - () -> Arrays.stream(coll.toArray()).sorted().mapToObj(String::valueOf) - .collect(Collectors.joining(" or ", "of id ", ""))) - .shouldSkip( - (BiPredicate<? super T, ? super IGregTechTileEntity> & Builtin) (c, - t) -> t != null && coll.contains(t.getMetaTileID())); + && coll.contains(is.getItemDamage())).cacheHint( + () -> Arrays.stream(coll.toArray()) + .sorted() + .mapToObj(String::valueOf) + .collect(Collectors.joining(" or ", "of id ", ""))) + .shouldSkip( + (BiPredicate<? super T, ? super IGregTechTileEntity> & Builtin) ( + c, t) -> t != null && coll.contains( + t.getMetaTileID())); } // endregion @@ -407,10 +462,12 @@ public class GT_HatchElementBuilder<T> { if (!StructureLibAPI.isBlockTriviallyReplaceable(world, x, y, z, env.getActor())) return PlaceResult.REJECT; if (mReject != null && mReject.test(t)) return PlaceResult.REJECT; - ItemStack taken = env.getSource().takeOne(mHatchItemFilter.apply(t, trigger), true); + ItemStack taken = env.getSource() + .takeOne(mHatchItemFilter.apply(t, trigger), true); if (GT_Utility.isStackInvalid(taken)) { String type = getHint(); - env.getChatter().accept(new ChatComponentTranslation("GT5U.autoplace.error.no_hatch", type)); + env.getChatter() + .accept(new ChatComponentTranslation("GT5U.autoplace.error.no_hatch", type)); return PlaceResult.REJECT; } if (StructureUtility.survivalPlaceBlock( @@ -440,7 +497,9 @@ public class GT_HatchElementBuilder<T> { // explicitly rejected, probably obstructed by another slice if (mDisallowedDirection.contains(direction)) continue; ForgeDirection rotated = env.getFacing() - .getWorldDirection(direction.offsetY != 0 ? direction.getOpposite() : direction); + .getWorldDirection( + direction.offsetY != 0 ? direction.getOpposite() + : direction); allowed.add(rotated); } } diff --git a/src/main/java/gregtech/api/util/GT_LanguageManager.java b/src/main/java/gregtech/api/util/GT_LanguageManager.java index ab077ff946..26651b42a3 100644 --- a/src/main/java/gregtech/api/util/GT_LanguageManager.java +++ b/src/main/java/gregtech/api/util/GT_LanguageManager.java @@ -36,13 +36,17 @@ public class GT_LanguageManager { static { try { - Field fieldStringTranslateLanguageList = ReflectionHelper - .findField(net.minecraft.util.StringTranslate.class, "languageList", "field_74816_c"); - Field fieldStringTranslateInstance = ReflectionHelper - .findField(net.minecraft.util.StringTranslate.class, "instance", "field_74817_a"); + Field fieldStringTranslateLanguageList = ReflectionHelper.findField( + net.minecraft.util.StringTranslate.class, + "languageList", + "field_74816_c"); + Field fieldStringTranslateInstance = ReflectionHelper.findField( + net.minecraft.util.StringTranslate.class, + "instance", + "field_74817_a"); // noinspection unchecked - stringTranslateLanguageList = (Map<String, String>) fieldStringTranslateLanguageList - .get(fieldStringTranslateInstance.get(null)); + stringTranslateLanguageList = (Map<String, String>) fieldStringTranslateLanguageList.get( + fieldStringTranslateInstance.get(null)); } catch (Exception e) { e.printStackTrace(); } @@ -62,7 +66,8 @@ public class GT_LanguageManager { } } TEMPMAP.put(aKey.trim(), aEnglish); - LanguageRegistry.instance().injectLanguage(sLanguage, TEMPMAP); + LanguageRegistry.instance() + .injectLanguage(sLanguage, TEMPMAP); TEMPMAP.clear(); if (sUseEnglishFile && !aWriteIntoLangFile) { if (!LANGMAP.containsKey(aKey)) { @@ -89,7 +94,8 @@ public class GT_LanguageManager { } Property tProperty = sEnglishFile.get("LanguageFile", aKey.trim(), aEnglish); if (!tProperty.wasRead() && GregTech_API.sPostloadFinished) sEnglishFile.save(); - if (sEnglishFile.get("EnableLangFile", "UseThisFileAsLanguageFile", false).getBoolean(false)) { + if (sEnglishFile.get("EnableLangFile", "UseThisFileAsLanguageFile", false) + .getBoolean(false)) { aEnglish = tProperty.getString(); sUseEnglishFile = true; } @@ -101,7 +107,8 @@ public class GT_LanguageManager { if (aKey == null) return E; String tTrimmedKey = aKey.trim(), rTranslation; if (sUseEnglishFile) { - rTranslation = LanguageRegistry.instance().getStringLocalization(tTrimmedKey); + rTranslation = LanguageRegistry.instance() + .getStringLocalization(tTrimmedKey); } else { rTranslation = StatCollector.translateToLocal(tTrimmedKey); } @@ -140,7 +147,8 @@ public class GT_LanguageManager { if (GT_Utility.isStackInvalid(aStack)) return "null"; NBTTagCompound tNBT = aStack.getTagCompound(); if (tNBT != null && tNBT.hasKey("display")) { - String tName = tNBT.getCompoundTag("display").getString("Name"); + String tName = tNBT.getCompoundTag("display") + .getString("Name"); if (GT_Utility.isStringValid(tName)) { return tName; } diff --git a/src/main/java/gregtech/api/util/GT_ModHandler.java b/src/main/java/gregtech/api/util/GT_ModHandler.java index c5060ff93f..ec3f8a2b70 100644 --- a/src/main/java/gregtech/api/util/GT_ModHandler.java +++ b/src/main/java/gregtech/api/util/GT_ModHandler.java @@ -445,8 +445,9 @@ public class GT_ModHandler { public static boolean addValuableOre(Block aBlock, int aMeta, int aValue) { if (aValue <= 0) return false; try { - Class.forName("ic2.core.IC2").getMethod("addValuableOre", IRecipeInput.class, int.class) - .invoke(null, new RecipeInputItemStack(new ItemStack(aBlock, 1, aMeta)), aValue); + Class.forName("ic2.core.IC2") + .getMethod("addValuableOre", IRecipeInput.class, int.class) + .invoke(null, new RecipeInputItemStack(new ItemStack(aBlock, 1, aMeta)), aValue); } catch (Throwable e) { /* Do nothing */ } @@ -506,7 +507,8 @@ public class GT_ModHandler { aOutput = GT_OreDictUnificator.get(true, aOutput); if (aInput == null || aOutput == null || GT_Utility.getContainerItem(aInput, false) != null) return false; if (!GregTech_API.sRecipeFile.get(ConfigCategories.Machines.smelting, aInput, true)) return false; - FurnaceRecipes.smelting().func_151394_a(aInput, GT_Utility.copyOrNull(aOutput), 0.0F); + FurnaceRecipes.smelting() + .func_151394_a(aInput, GT_Utility.copyOrNull(aOutput), 0.0F); return true; } @@ -675,7 +677,8 @@ public class GT_ModHandler { public static boolean addOreToIngotSmeltingRecipe(ItemStack aInput, ItemStack aOutput) { aOutput = GT_OreDictUnificator.get(true, aOutput); if (aInput == null || aOutput == null) return false; - FurnaceRecipes.smelting().func_151394_a(aInput, GT_Utility.copyOrNull(aOutput), 0.0F); + FurnaceRecipes.smelting() + .func_151394_a(aInput, GT_Utility.copyOrNull(aOutput), 0.0F); return true; } @@ -693,10 +696,14 @@ public class GT_ModHandler { if (aAddGTRecipe && (aGTRecipeMap.findRecipe(null, false, Long.MAX_VALUE, null, tStack) == null)) { try { - if (aExcludeGTIC2Items && ((tStack.getUnlocalizedName().contains("gt.metaitem.01") - || tStack.getUnlocalizedName().contains("gt.blockores") - || tStack.getUnlocalizedName().contains("ic2.itemCrushed") - || tStack.getUnlocalizedName().contains("ic2.itemPurifiedCrushed")))) + if (aExcludeGTIC2Items && ((tStack.getUnlocalizedName() + .contains("gt.metaitem.01") + || tStack.getUnlocalizedName() + .contains("gt.blockores") + || tStack.getUnlocalizedName() + .contains("ic2.itemCrushed") + || tStack.getUnlocalizedName() + .contains("ic2.itemPurifiedCrushed")))) continue; switch (aGTRecipeMap.mUnlocalizedName) { case "gt.recipe.macerator": @@ -705,10 +712,11 @@ public class GT_ModHandler { aGTRecipeMap.addRecipe( true, new ItemStack[] { GT_Utility.copyAmount( - iRecipeInputRecipeOutputEntry.getKey().getAmount(), + iRecipeInputRecipeOutputEntry.getKey() + .getAmount(), tStack) }, - iRecipeInputRecipeOutputEntry.getValue().items - .toArray(new ItemStack[0]), + iRecipeInputRecipeOutputEntry.getValue().items.toArray( + new ItemStack[0]), null, null, null, @@ -721,10 +729,11 @@ public class GT_ModHandler { aGTRecipeMap.addRecipe( true, new ItemStack[] { GT_Utility.copyAmount( - iRecipeInputRecipeOutputEntry.getKey().getAmount(), + iRecipeInputRecipeOutputEntry.getKey() + .getAmount(), tStack) }, - iRecipeInputRecipeOutputEntry.getValue().items - .toArray(new ItemStack[0]), + iRecipeInputRecipeOutputEntry.getValue().items.toArray( + new ItemStack[0]), null, null, null, @@ -929,7 +938,11 @@ public class GT_ModHandler { if (aResult == null || aRecipe == null || aResult.stackSize <= 0) return false; try { mods.railcraft.api.crafting.RailcraftCraftingManager.rollingMachine.getRecipeList() - .add(new ShapedOreRecipe(GT_Utility.copyOrNull(aResult), aRecipe)); + .add( + new ShapedOreRecipe( + GT_Utility.copyOrNull( + aResult), + aRecipe)); } catch (Throwable e) { return addCraftingRecipe(GT_Utility.copyOrNull(aResult), aRecipe); } @@ -1076,7 +1089,8 @@ public class GT_ModHandler { while (s.length() < 3) s.append(" "); if (s.length() > 3) throw new IllegalArgumentException(); - for (char c : s.toString().toCharArray()) { + for (char c : s.toString() + .toCharArray()) { switch (c) { case 'b': tRecipeList.add(c); @@ -1212,7 +1226,9 @@ public class GT_ModHandler { if (aReversible && aResult != null) { ItemData[] tData = new ItemData[9]; int x = -1; - for (char chr : shape.toString().toCharArray()) tData[++x] = tItemDataMap.get(chr); + for (char chr : shape.toString() + .toCharArray()) + tData[++x] = tItemDataMap.get(chr); if (GT_Utility.arrayContainsNonNull(tData)) GT_OreDictUnificator.addItemData(aResult, new ItemData(tData)); } @@ -1220,7 +1236,8 @@ public class GT_ModHandler { if (aCheckForCollisions && tRemoveRecipe) { ItemStack[] tRecipe = new ItemStack[9]; int x = -1; - for (char chr : shape.toString().toCharArray()) { + for (char chr : shape.toString() + .toCharArray()) { tRecipe[++x] = tItemStackMap.get(chr); if (tRecipe[x] != null && Items.feather.getDamage(tRecipe[x]) == W) Items.feather.setDamage(tRecipe[x], 0); @@ -1247,11 +1264,15 @@ public class GT_ModHandler { } if (aOnlyAddIfThereIsAnyRecipeOutputtingThis && !tDoWeCareIfThereWasARecipe && !tThereWasARecipe) { - ArrayList<IRecipe> tList = (ArrayList<IRecipe>) CraftingManager.getInstance().getRecipeList(); + ArrayList<IRecipe> tList = (ArrayList<IRecipe>) CraftingManager.getInstance() + .getRecipeList(); int tList_sS = tList.size(); for (int i = 0; i < tList_sS && !tThereWasARecipe; i++) { IRecipe tRecipe = tList.get(i); - if (sSpecialRecipeClasses.contains(tRecipe.getClass().getName())) continue; + if (sSpecialRecipeClasses.contains( + tRecipe.getClass() + .getName())) + continue; if (GT_Utility.areStacksEqual(GT_OreDictUnificator.get(tRecipe.getRecipeOutput()), aResult, true)) { tList.remove(i--); tList_sS = tList.size(); @@ -1403,9 +1424,13 @@ public class GT_ModHandler { */ public static boolean removeFurnaceSmelting(ItemStack aInput) { if (aInput != null) { - for (Object tInput : FurnaceRecipes.smelting().getSmeltingList().keySet()) { + for (Object tInput : FurnaceRecipes.smelting() + .getSmeltingList() + .keySet()) { if (GT_Utility.isStackValid(tInput) && GT_Utility.areStacksEqual(aInput, (ItemStack) tInput, true)) { - FurnaceRecipes.smelting().getSmeltingList().remove(tInput); + FurnaceRecipes.smelting() + .getSmeltingList() + .remove(tInput); return true; } } @@ -1418,9 +1443,12 @@ public class GT_ModHandler { */ public static boolean removeFurnaceSmeltingByOutput(ItemStack aOutput) { if (aOutput != null) { - return FurnaceRecipes.smelting().getSmeltingList().values().removeIf( - tOutput -> GT_Utility.isStackValid(tOutput) - && GT_Utility.areStacksEqual(aOutput, (ItemStack) tOutput, true)); + return FurnaceRecipes.smelting() + .getSmeltingList() + .values() + .removeIf( + tOutput -> GT_Utility.isStackValid(tOutput) + && GT_Utility.areStacksEqual(aOutput, (ItemStack) tOutput, true)); } return false; } @@ -1433,7 +1461,9 @@ public class GT_ModHandler { */ public static ItemStack removeRecipe(ItemStack... aRecipe) { if (aRecipe == null) return null; - if (Arrays.stream(aRecipe).noneMatch(Objects::nonNull)) return null; + if (Arrays.stream(aRecipe) + .noneMatch(Objects::nonNull)) + return null; ItemStack rReturn = null; InventoryCrafting aCrafting = new InventoryCrafting(new Container() { @@ -1444,15 +1474,17 @@ public class GT_ModHandler { } }, 3, 3); for (int i = 0; i < aRecipe.length && i < 9; i++) aCrafting.setInventorySlotContents(i, aRecipe[i]); - ArrayList<IRecipe> tList = (ArrayList<IRecipe>) CraftingManager.getInstance().getRecipeList(); + ArrayList<IRecipe> tList = (ArrayList<IRecipe>) CraftingManager.getInstance() + .getRecipeList(); int tList_sS = tList.size(); try { for (int i = 0; i < tList_sS; i++) { for (; i < tList_sS; i++) { if ((!(tList.get(i) instanceof IGT_CraftingRecipe) - || ((IGT_CraftingRecipe) tList.get(i)).isRemovable()) - && tList.get(i).matches(aCrafting, DW)) { - rReturn = tList.get(i).getCraftingResult(aCrafting); + || ((IGT_CraftingRecipe) tList.get(i)).isRemovable()) && tList.get(i) + .matches(aCrafting, DW)) { + rReturn = tList.get(i) + .getCraftingResult(aCrafting); if (rReturn != null) tList.remove(i--); tList_sS = tList.size(); } @@ -1471,7 +1503,9 @@ public class GT_ModHandler { } if (aRecipe == null) return; - if (Arrays.stream(aRecipe).noneMatch(Objects::nonNull)) return; + if (Arrays.stream(aRecipe) + .noneMatch(Objects::nonNull)) + return; InventoryCrafting aCrafting = new InventoryCrafting(new Container() { @@ -1486,13 +1520,19 @@ public class GT_ModHandler { @SuppressWarnings("unchecked") public static void bulkRemoveByRecipe(List<InventoryCrafting> toRemove) { - ArrayList<IRecipe> tList = (ArrayList<IRecipe>) CraftingManager.getInstance().getRecipeList(); + ArrayList<IRecipe> tList = (ArrayList<IRecipe>) CraftingManager.getInstance() + .getRecipeList(); GT_FML_LOGGER.info("BulkRemoveByRecipe: tList: " + tList.size() + " toRemove: " + toRemove.size()); - Set<IRecipe> tListToRemove = tList.parallelStream().filter(tRecipe -> { - if ((tRecipe instanceof IGT_CraftingRecipe) && !((IGT_CraftingRecipe) tRecipe).isRemovable()) return false; - return toRemove.stream().anyMatch(aCrafting -> tRecipe.matches(aCrafting, DW)); - }).collect(Collectors.toSet()); + Set<IRecipe> tListToRemove = tList.parallelStream() + .filter(tRecipe -> { + if ((tRecipe instanceof IGT_CraftingRecipe) + && !((IGT_CraftingRecipe) tRecipe).isRemovable()) + return false; + return toRemove.stream() + .anyMatch(aCrafting -> tRecipe.matches(aCrafting, DW)); + }) + .collect(Collectors.toSet()); tList.removeIf(tListToRemove::contains); } @@ -1524,7 +1564,8 @@ public class GT_ModHandler { boolean aNotRemoveShapelessRecipes, boolean aOnlyRemoveNativeHandlers) { if (aOutput == null) return false; boolean rReturn = false; - ArrayList<IRecipe> tList = (ArrayList<IRecipe>) CraftingManager.getInstance().getRecipeList(); + ArrayList<IRecipe> tList = (ArrayList<IRecipe>) CraftingManager.getInstance() + .getRecipeList(); aOutput = GT_OreDictUnificator.get(aOutput); int tList_sS = tList.size(); for (int i = 0; i < tList_sS; i++) { @@ -1533,9 +1574,15 @@ public class GT_ModHandler { && (tRecipe instanceof ShapelessRecipes || tRecipe instanceof ShapelessOreRecipe)) continue; if (aOnlyRemoveNativeHandlers) { - if (!sNativeRecipeClasses.contains(tRecipe.getClass().getName())) continue; + if (!sNativeRecipeClasses.contains( + tRecipe.getClass() + .getName())) + continue; } else { - if (sSpecialRecipeClasses.contains(tRecipe.getClass().getName())) continue; + if (sSpecialRecipeClasses.contains( + tRecipe.getClass() + .getName())) + continue; } ItemStack tStack = tRecipe.getRecipeOutput(); if ((!(tRecipe instanceof IGT_CraftingRecipe) || ((IGT_CraftingRecipe) tRecipe).isRemovable()) @@ -1549,19 +1596,34 @@ public class GT_ModHandler { } public static boolean bulkRemoveRecipeByOutput(List<ItemStack> toRemove) { - ArrayList<IRecipe> tList = (ArrayList<IRecipe>) CraftingManager.getInstance().getRecipeList(); + ArrayList<IRecipe> tList = (ArrayList<IRecipe>) CraftingManager.getInstance() + .getRecipeList(); - Set<ItemStack> setToRemove = toRemove.parallelStream().map(GT_OreDictUnificator::get_nocopy) - .collect(Collectors.toSet()); + Set<ItemStack> setToRemove = toRemove.parallelStream() + .map(GT_OreDictUnificator::get_nocopy) + .collect(Collectors.toSet()); GT_FML_LOGGER.info("BulkRemoveRecipeByOutput: tList: " + tList.size() + " setToRemove: " + setToRemove.size()); - Set<IRecipe> tListToRemove = tList.parallelStream().filter(tRecipe -> { - if ((tRecipe instanceof IGT_CraftingRecipe) && !((IGT_CraftingRecipe) tRecipe).isRemovable()) return false; - if (sSpecialRecipeClasses.contains(tRecipe.getClass().getName())) return false; - final ItemStack tStack = GT_OreDictUnificator.get_nocopy(tRecipe.getRecipeOutput()); - return setToRemove.stream().anyMatch(aOutput -> GT_Utility.areStacksEqual(tStack, aOutput, true)); - }).collect(Collectors.toSet()); + Set<IRecipe> tListToRemove = tList.parallelStream() + .filter(tRecipe -> { + if ((tRecipe instanceof IGT_CraftingRecipe) + && !((IGT_CraftingRecipe) tRecipe).isRemovable()) + return false; + if (sSpecialRecipeClasses.contains( + tRecipe.getClass() + .getName())) + return false; + final ItemStack tStack = GT_OreDictUnificator.get_nocopy( + tRecipe.getRecipeOutput()); + return setToRemove.stream() + .anyMatch( + aOutput -> GT_Utility.areStacksEqual( + tStack, + aOutput, + true)); + }) + .collect(Collectors.toSet()); tList.removeIf(tListToRemove::contains); return true; @@ -1591,7 +1653,8 @@ public class GT_ModHandler { } }, 3, 3); for (int i = 0; i < 9 && i < aRecipe.length; i++) aCrafting.setInventorySlotContents(i, aRecipe[i]); - List<IRecipe> tList = CraftingManager.getInstance().getRecipeList(); + List<IRecipe> tList = CraftingManager.getInstance() + .getRecipeList(); synchronized (sAllRecipeList) { if (sAllRecipeList.size() != tList.size()) { sAllRecipeList.clear(); @@ -1624,7 +1687,8 @@ public class GT_ModHandler { assert tStack1 != null && tStack2 != null; if (tStack1.getItem() == tStack2.getItem() && tStack1.stackSize == 1 && tStack2.stackSize == 1 - && tStack1.getItem().isRepairable()) { + && tStack1.getItem() + .isRepairable()) { int tNewDamage = tStack1.getMaxDamage() + tStack1.getItemDamage() - tStack2.getItemDamage() + tStack1.getMaxDamage() / 20; @@ -1655,7 +1719,9 @@ public class GT_ModHandler { */ @SuppressWarnings("unchecked") public static ItemStack getRecipeOutput(boolean aUncopiedStack, boolean allowOreDict, ItemStack... aRecipe) { - if (aRecipe == null || Arrays.stream(aRecipe).noneMatch(Objects::nonNull)) return null; + if (aRecipe == null || Arrays.stream(aRecipe) + .noneMatch(Objects::nonNull)) + return null; InventoryCrafting aCrafting = new InventoryCrafting(new Container() { @@ -1665,7 +1731,8 @@ public class GT_ModHandler { } }, 3, 3); for (int i = 0; i < 9 && i < aRecipe.length; i++) aCrafting.setInventorySlotContents(i, aRecipe[i]); - ArrayList<IRecipe> tList = (ArrayList<IRecipe>) CraftingManager.getInstance().getRecipeList(); + ArrayList<IRecipe> tList = (ArrayList<IRecipe>) CraftingManager.getInstance() + .getRecipeList(); boolean found = false; for (IRecipe iRecipe : tList) { @@ -1700,7 +1767,8 @@ public class GT_ModHandler { if (!GregTech_API.sPostloadStarted || GregTech_API.sPostloadFinished) sSingleNonBlockDamagableRecipeList.clear(); if (sSingleNonBlockDamagableRecipeList.isEmpty()) { - for (IRecipe tRecipe : (ArrayList<IRecipe>) CraftingManager.getInstance().getRecipeList()) { + for (IRecipe tRecipe : (ArrayList<IRecipe>) CraftingManager.getInstance() + .getRecipeList()) { ItemStack tStack = tRecipe.getRecipeOutput(); if (GT_Utility.isStackValid(tStack) && tStack.getMaxStackSize() == 1 && tStack.getMaxDamage() > 0 @@ -1760,7 +1828,11 @@ public class GT_ModHandler { * example */ public static List<ItemStack> getRecipeOutputs(ItemStack... aRecipe) { - return getRecipeOutputs(CraftingManager.getInstance().getRecipeList(), false, aRecipe); + return getRecipeOutputs( + CraftingManager.getInstance() + .getRecipeList(), + false, + aRecipe); } private static List<IRecipe> bufferedRecipes = null; @@ -1771,20 +1843,27 @@ public class GT_ModHandler { */ public static List<ItemStack> getRecipeOutputsBuffered(ItemStack... aRecipe) { - if (bufferedRecipes == null) bufferedRecipes = (List<IRecipe>) CraftingManager.getInstance().getRecipeList() - .stream() - .filter( - tRecipe -> !(tRecipe instanceof ShapelessRecipes) && !(tRecipe instanceof ShapelessOreRecipe) - && !(tRecipe instanceof IGT_CraftingRecipe)) - .filter(tRecipe -> { - try { - ItemStack tOutput = ((IRecipe) tRecipe).getRecipeOutput(); - if (tOutput.stackSize == 1 && tOutput.getMaxDamage() > 0 && tOutput.getMaxStackSize() == 1) { - return true; - } - } catch (Exception ignored) {} - return false; - }).collect(Collectors.toList()); + if (bufferedRecipes == null) bufferedRecipes = (List<IRecipe>) CraftingManager.getInstance() + .getRecipeList() + .stream() + .filter( + tRecipe -> !(tRecipe instanceof ShapelessRecipes) + && !(tRecipe instanceof ShapelessOreRecipe) + && !(tRecipe instanceof IGT_CraftingRecipe)) + .filter(tRecipe -> { + try { + ItemStack tOutput = ((IRecipe) tRecipe).getRecipeOutput(); + if (tOutput.stackSize == 1 + && tOutput.getMaxDamage() + > 0 + && tOutput.getMaxStackSize() + == 1) { + return true; + } + } catch (Exception ignored) {} + return false; + }) + .collect(Collectors.toList()); return getRecipeOutputs(bufferedRecipes, false, aRecipe); } @@ -1794,7 +1873,9 @@ public class GT_ModHandler { */ public static List<ItemStack> getRecipeOutputs(List<IRecipe> aList, boolean aDeleteFromList, ItemStack... aRecipe) { List<ItemStack> rList = new ArrayList<>(); - if (aRecipe == null || Arrays.stream(aRecipe).noneMatch(Objects::nonNull)) return rList; + if (aRecipe == null || Arrays.stream(aRecipe) + .noneMatch(Objects::nonNull)) + return rList; InventoryCrafting aCrafting = new InventoryCrafting(new Container() { @Override @@ -1805,20 +1886,24 @@ public class GT_ModHandler { for (int i = 0; i < 9 && i < aRecipe.length; i++) aCrafting.setInventorySlotContents(i, aRecipe[i]); if (!aDeleteFromList) { HashSet<ItemStack> stacks = new HashSet<>(); - aList.stream().filter(tRecipe -> { - if (tRecipe instanceof ShapelessRecipes || tRecipe instanceof ShapelessOreRecipe - || tRecipe instanceof IGT_CraftingRecipe) - return false; - try { - return tRecipe.matches(aCrafting, DW); - } catch (Throwable e) { - e.printStackTrace(GT_Log.err); - return false; - } - }).forEach(tRecipe -> stacks.add(tRecipe.getCraftingResult(aCrafting))); - rList = stacks.stream().filter( - tOutput -> tOutput.stackSize == 1 && tOutput.getMaxDamage() > 0 && tOutput.getMaxStackSize() == 1) - .collect(Collectors.toList()); + aList.stream() + .filter(tRecipe -> { + if (tRecipe instanceof ShapelessRecipes || tRecipe instanceof ShapelessOreRecipe + || tRecipe instanceof IGT_CraftingRecipe) + return false; + try { + return tRecipe.matches(aCrafting, DW); + } catch (Throwable e) { + e.printStackTrace(GT_Log.err); + return false; + } + }) + .forEach(tRecipe -> stacks.add(tRecipe.getCraftingResult(aCrafting))); + rList = stacks.stream() + .filter( + tOutput -> tOutput.stackSize == 1 && tOutput.getMaxDamage() > 0 + && tOutput.getMaxStackSize() == 1) + .collect(Collectors.toList()); } else for (Iterator<IRecipe> iterator = aList.iterator(); iterator.hasNext();) { IRecipe tRecipe = iterator.next(); boolean matched = false; @@ -1887,7 +1972,9 @@ public class GT_ModHandler { */ public static ItemStack getSmeltingOutput(ItemStack aInput, boolean aRemoveInput, ItemStack aOutputSlot) { if (aInput == null || aInput.stackSize < 1) return null; - ItemStack rStack = GT_OreDictUnificator.get(FurnaceRecipes.smelting().getSmeltingResult(aInput)); + ItemStack rStack = GT_OreDictUnificator.get( + FurnaceRecipes.smelting() + .getSmeltingResult(aInput)); if (rStack != null && (aOutputSlot == null || (GT_Utility.areStacksEqual(rStack, aOutputSlot) && rStack.stackSize + aOutputSlot.stackSize <= aOutputSlot.getMaxStackSize()))) { @@ -1908,8 +1995,11 @@ public class GT_ModHandler { if (aInput == null) return new ItemStack[aOutputSlots.length]; try { for (Entry<IRecipeInput, RecipeOutput> tEntry : aRecipeList.entrySet()) { - if (tEntry.getKey().matches(aInput)) { - if (tEntry.getKey().getAmount() <= aInput.stackSize) { + if (tEntry.getKey() + .matches(aInput)) { + if (tEntry.getKey() + .getAmount() + <= aInput.stackSize) { ItemStack[] tList = tEntry.getValue().items.toArray(new ItemStack[0]); if (tList.length == 0) break; ItemStack[] rList = new ItemStack[aOutputSlots.length]; @@ -1926,7 +2016,8 @@ public class GT_ModHandler { } } - if (aRemoveInput) aInput.stackSize -= tEntry.getKey().getAmount(); + if (aRemoveInput) aInput.stackSize -= tEntry.getKey() + .getAmount(); return rList; } break; @@ -2090,24 +2181,25 @@ public class GT_ModHandler { return GT_ModHandler.dischargeElectricItem(aStack, aDecharge, Integer.MAX_VALUE, true, false, true) >= aDecharge; } - } else if (aStack.getItem().isDamageable()) { - if (aPlayer == null) { - aStack.setItemDamage(aStack.getItemDamage() + aDamage); - } else { - aStack.damageItem(aDamage, aPlayer); - } - if (aStack.getItemDamage() >= aStack.getMaxDamage()) { - aStack.setItemDamage(aStack.getMaxDamage() + 1); - ItemStack tStack = GT_Utility.getContainerItem(aStack, true); - if (tStack != null) { - aStack.func_150996_a(tStack.getItem()); - aStack.setItemDamage(tStack.getItemDamage()); - aStack.stackSize = tStack.stackSize; - aStack.setTagCompound(tStack.getTagCompound()); - } - } - return true; - } + } else if (aStack.getItem() + .isDamageable()) { + if (aPlayer == null) { + aStack.setItemDamage(aStack.getItemDamage() + aDamage); + } else { + aStack.damageItem(aDamage, aPlayer); + } + if (aStack.getItemDamage() >= aStack.getMaxDamage()) { + aStack.setItemDamage(aStack.getMaxDamage() + 1); + ItemStack tStack = GT_Utility.getContainerItem(aStack, true); + if (tStack != null) { + aStack.func_150996_a(tStack.getItem()); + aStack.setItemDamage(tStack.getItemDamage()); + aStack.stackSize = tStack.stackSize; + aStack.setTagCompound(tStack.getTagCompound()); + } + } + return true; + } return false; } diff --git a/src/main/java/gregtech/api/util/GT_Multiblock_Tooltip_Builder.java b/src/main/java/gregtech/api/util/GT_Multiblock_Tooltip_Builder.java index abbe441a25..db997c3640 100644 --- a/src/main/java/gregtech/api/util/GT_Multiblock_Tooltip_Builder.java +++ b/src/main/java/gregtech/api/util/GT_Multiblock_Tooltip_Builder.java @@ -75,8 +75,10 @@ public class GT_Multiblock_Tooltip_Builder { private static final String TT_mod = StatCollector.translateToLocal("GT5U.MBTT.Mod"); private static final String TT_air = StatCollector.translateToLocal("GT5U.MBTT.Air"); private static final String[] TT_dots = IntStream.range(0, 16) - .mapToObj(i -> StatCollector.translateToLocal("structurelib.blockhint." + i + ".name")) - .toArray(String[]::new); + .mapToObj( + i -> StatCollector.translateToLocal( + "structurelib.blockhint." + i + ".name")) + .toArray(String[]::new); public GT_Multiblock_Tooltip_Builder() { iLines = new LinkedList<>(); @@ -567,12 +569,13 @@ public class GT_Multiblock_Tooltip_Builder { iArray = iLines.toArray(new String[0]); sArray = sLines.toArray(new String[0]); // e.getKey() - 1 because 1 dot is meta 0. - hArray = Stream - .concat( - hLines.stream(), - hBlocks.asMap().entrySet().stream() - .map(e -> TT_dots[e.getKey() - 1] + COLON + String.join(SEPARATOR, e.getValue()))) - .toArray(String[]::new); + hArray = Stream.concat( + hLines.stream(), + hBlocks.asMap() + .entrySet() + .stream() + .map(e -> TT_dots[e.getKey() - 1] + COLON + String.join(SEPARATOR, e.getValue()))) + .toArray(String[]::new); } public String[] getInformation() { diff --git a/src/main/java/gregtech/api/util/GT_OreDictUnificator.java b/src/main/java/gregtech/api/util/GT_OreDictUnificator.java index 47f70a9c35..6670b86363 100644 --- a/src/main/java/gregtech/api/util/GT_OreDictUnificator.java +++ b/src/main/java/gregtech/api/util/GT_OreDictUnificator.java @@ -84,8 +84,14 @@ public class GT_OreDictUnificator { aStack = GT_Utility.copyAmount(1, aStack); if (!aAlreadyRegistered) registerOre(aPrefix.get(aMaterial), aStack); addAssociation(aPrefix, aMaterial, aStack, isBlacklisted(aStack)); - if (aOverwrite || GT_Utility.isStackInvalid(sName2StackMap.get(aPrefix.get(aMaterial).toString()))) - sName2StackMap.put(aPrefix.get(aMaterial).toString(), aStack); + if (aOverwrite || GT_Utility.isStackInvalid( + sName2StackMap.get( + aPrefix.get(aMaterial) + .toString()))) + sName2StackMap.put( + aPrefix.get(aMaterial) + .toString(), + aStack); isAddingOre--; } @@ -342,10 +348,13 @@ public class GT_OreDictUnificator { if (mRunThroughTheList) { if (GregTech_API.sLoadStarted) { mRunThroughTheList = false; - for (Entry<GT_ItemStack2, ItemData> tEntry : sItemStack2DataMap.entrySet()) - if (!tEntry.getValue().hasValidPrefixData() || tEntry.getValue().mPrefix.mAllowNormalRecycling) - GT_RecipeRegistrator - .registerMaterialRecycling(tEntry.getKey().toStack(), tEntry.getValue()); + for (Entry<GT_ItemStack2, ItemData> tEntry : sItemStack2DataMap.entrySet()) if (!tEntry.getValue() + .hasValidPrefixData() + || tEntry.getValue().mPrefix.mAllowNormalRecycling) + GT_RecipeRegistrator.registerMaterialRecycling( + tEntry.getKey() + .toStack(), + tEntry.getValue()); } } else { if (!aData.hasValidPrefixData() || aData.mPrefix.mAllowNormalRecycling) diff --git a/src/main/java/gregtech/api/util/GT_PCBFactoryManager.java b/src/main/java/gregtech/api/util/GT_PCBFactoryManager.java index dfc2af49ff..52561a063d 100644 --- a/src/main/java/gregtech/api/util/GT_PCBFactoryManager.java +++ b/src/main/java/gregtech/api/util/GT_PCBFactoryManager.java @@ -18,6 +18,7 @@ public class GT_PCBFactoryManager { } public static Materials getPlasticMaterialFromTier(int aTier) { - return mPlasticTiers.inverse().get(aTier); + return mPlasticTiers.inverse() + .get(aTier); } } diff --git a/src/main/java/gregtech/api/util/GT_ParallelHelper.java b/src/main/java/gregtech/api/util/GT_ParallelHelper.java index df2d26fc04..c12f8ec378 100644 --- a/src/main/java/gregtech/api/util/GT_ParallelHelper.java +++ b/src/main/java/gregtech/api/util/GT_ParallelHelper.java @@ -319,7 +319,8 @@ public class GT_ParallelHelper { if (mRecipe.getOutput(i) == null) { mItemOutputs[i] = null; } else { - ItemStack tItem = mRecipe.getOutput(i).copy(); + ItemStack tItem = mRecipe.getOutput(i) + .copy(); tItem.stackSize *= mCurrentParallel; mItemOutputs[i] = tItem; } @@ -332,7 +333,8 @@ public class GT_ParallelHelper { if (mRecipe.getFluidOutput(i) == null) { mFluidOutputs[i] = null; } else { - FluidStack tFluid = mRecipe.getFluidOutput(i).copy(); + FluidStack tFluid = mRecipe.getFluidOutput(i) + .copy(); tFluid.amount *= mCurrentParallel; mFluidOutputs[i] = tFluid; } @@ -392,7 +394,9 @@ public class GT_ParallelHelper { continue; } if (tHatch.isFluidLocked() && tLockedFluidName != null - && !tLockedFluidName.equals(tFluidOutput.getFluid().getName())) { + && !tLockedFluidName.equals( + tFluidOutput.getFluid() + .getName())) { continue; } } diff --git a/src/main/java/gregtech/api/util/GT_Recipe.java b/src/main/java/gregtech/api/util/GT_Recipe.java index e7443a63b5..7f39ef694d 100644 --- a/src/main/java/gregtech/api/util/GT_Recipe.java +++ b/src/main/java/gregtech/api/util/GT_Recipe.java @@ -698,10 +698,14 @@ public class GT_Recipe implements Comparable<GT_Recipe> { if (GT_OreDictUnificator.isInputStackEqual(providedItem, unifiedItemCost)) { if (GTppRecipeHelper) { // Please see JavaDoc on GTppRecipeHelper for why this is here. if (GT_Utility.areStacksEqual(providedItem, Ic2Items.FluidCell.copy(), true) - || GT_Utility - .areStacksEqual(providedItem, ItemList.Tool_DataStick.get(1L), true) - || GT_Utility - .areStacksEqual(providedItem, ItemList.Tool_DataOrb.get(1L), true)) { + || GT_Utility.areStacksEqual( + providedItem, + ItemList.Tool_DataStick.get(1L), + true) + || GT_Utility.areStacksEqual( + providedItem, + ItemList.Tool_DataOrb.get(1L), + true)) { if (!GT_Utility.areStacksEqual(providedItem, recipeItemCost, false)) continue; } } @@ -806,7 +810,9 @@ public class GT_Recipe implements Comparable<GT_Recipe> { } public void reloadOwner() { - setOwner(Loader.instance().activeModContainer()); + setOwner( + Loader.instance() + .activeModContainer()); final List<String> excludedClasses = Arrays.asList( "java.lang.Thread", @@ -816,8 +822,12 @@ public class GT_Recipe implements Comparable<GT_Recipe> { "gregtech.common.GT_RecipeAdder"); if (GT_Mod.gregtechproxy.mNEIRecipeOwnerStackTrace) { List<StackTraceElement> toAdd = new ArrayList<>(); - for (StackTraceElement stackTrace : Thread.currentThread().getStackTrace()) { - if (excludedClasses.stream().noneMatch(c -> stackTrace.getClassName().equals(c))) { + for (StackTraceElement stackTrace : Thread.currentThread() + .getStackTrace()) { + if (excludedClasses.stream() + .noneMatch( + c -> stackTrace.getClassName() + .equals(c))) { toAdd.add(stackTrace); } } @@ -836,8 +846,10 @@ public class GT_Recipe implements Comparable<GT_Recipe> { * Use in case {@link Loader#activeModContainer()} isn't helpful */ public void setOwner(String modId) { - for (ModContainer mod : Loader.instance().getModList()) { - if (mod.getModId().equals(modId)) { + for (ModContainer mod : Loader.instance() + .getModList()) { + if (mod.getModId() + .equals(modId)) { setOwner(mod); return; } @@ -1094,9 +1106,9 @@ public class GT_Recipe implements Comparable<GT_Recipe> { E, true, true).setSlotOverlay(false, false, GT_UITextures.OVERLAY_SLOT_CRUSHED_ORE) - .setSlotOverlay(false, true, GT_UITextures.OVERLAY_SLOT_DUST) - .setRecipeConfigFile("orewasher", FIRST_ITEM_INPUT) - .setProgressBar(GT_UITextures.PROGRESSBAR_BATH, ProgressBar.Direction.CIRCULAR_CW); + .setSlotOverlay(false, true, GT_UITextures.OVERLAY_SLOT_DUST) + .setRecipeConfigFile("orewasher", FIRST_ITEM_INPUT) + .setProgressBar(GT_UITextures.PROGRESSBAR_BATH, ProgressBar.Direction.CIRCULAR_CW); public static final GT_Recipe_Map sThermalCentrifugeRecipes = new GT_Recipe_Map( new HashSet<>(1000), "gt.recipe.thermalcentrifuge", @@ -1113,9 +1125,9 @@ public class GT_Recipe implements Comparable<GT_Recipe> { E, true, true).setSlotOverlay(false, false, GT_UITextures.OVERLAY_SLOT_CRUSHED_ORE) - .setSlotOverlay(false, true, GT_UITextures.OVERLAY_SLOT_DUST) - .setRecipeConfigFile("thermalcentrifuge", FIRST_ITEM_INPUT) - .setProgressBar(GT_UITextures.PROGRESSBAR_ARROW, ProgressBar.Direction.RIGHT); + .setSlotOverlay(false, true, GT_UITextures.OVERLAY_SLOT_DUST) + .setRecipeConfigFile("thermalcentrifuge", FIRST_ITEM_INPUT) + .setProgressBar(GT_UITextures.PROGRESSBAR_ARROW, ProgressBar.Direction.RIGHT); public static final GT_Recipe_Map sCompressorRecipes = new GT_Recipe_Map( new HashSet<>(750), "gt.recipe.compressor", @@ -1132,10 +1144,10 @@ public class GT_Recipe implements Comparable<GT_Recipe> { E, true, true).setSlotOverlay(false, false, GT_UITextures.OVERLAY_SLOT_COMPRESSOR) - .setRecipeConfigFile("compressor", FIRST_ITEM_INPUT) - .setProgressBar(GT_UITextures.PROGRESSBAR_COMPRESS, ProgressBar.Direction.RIGHT) - .setSlotOverlaySteam(false, GT_UITextures.OVERLAY_SLOT_COMPRESSOR_STEAM) - .setProgressBarSteam(GT_UITextures.PROGRESSBAR_COMPRESS_STEAM); + .setRecipeConfigFile("compressor", FIRST_ITEM_INPUT) + .setProgressBar(GT_UITextures.PROGRESSBAR_COMPRESS, ProgressBar.Direction.RIGHT) + .setSlotOverlaySteam(false, GT_UITextures.OVERLAY_SLOT_COMPRESSOR_STEAM) + .setProgressBarSteam(GT_UITextures.PROGRESSBAR_COMPRESS_STEAM); public static final GT_Recipe_Map sExtractorRecipes = new GT_Recipe_Map( new HashSet<>(250), "gt.recipe.extractor", @@ -1152,10 +1164,10 @@ public class GT_Recipe implements Comparable<GT_Recipe> { E, true, true).setSlotOverlay(false, false, GT_UITextures.OVERLAY_SLOT_CENTRIFUGE) - .setRecipeConfigFile("extractor", FIRST_ITEM_INPUT) - .setProgressBar(GT_UITextures.PROGRESSBAR_EXTRACT, ProgressBar.Direction.RIGHT) - .setSlotOverlaySteam(false, GT_UITextures.OVERLAY_SLOT_CENTRIFUGE_STEAM) - .setProgressBarSteam(GT_UITextures.PROGRESSBAR_EXTRACT_STEAM); + .setRecipeConfigFile("extractor", FIRST_ITEM_INPUT) + .setProgressBar(GT_UITextures.PROGRESSBAR_EXTRACT, ProgressBar.Direction.RIGHT) + .setSlotOverlaySteam(false, GT_UITextures.OVERLAY_SLOT_CENTRIFUGE_STEAM) + .setProgressBarSteam(GT_UITextures.PROGRESSBAR_EXTRACT_STEAM); public static final GT_Recipe_Map sRecyclerRecipes = new GT_Recipe_Map_Recycler( new HashSet<>(0), "ic.recipe.recycler", @@ -1172,7 +1184,7 @@ public class GT_Recipe implements Comparable<GT_Recipe> { E, true, false).setSlotOverlay(false, false, GT_UITextures.OVERLAY_SLOT_RECYCLE) - .setProgressBar(GT_UITextures.PROGRESSBAR_RECYCLE, ProgressBar.Direction.CIRCULAR_CW); + .setProgressBar(GT_UITextures.PROGRESSBAR_RECYCLE, ProgressBar.Direction.CIRCULAR_CW); public static final GT_Recipe_Map sFurnaceRecipes = new GT_Recipe_Map_Furnace( new HashSet<>(0), "mc.recipe.furnace", @@ -1189,9 +1201,9 @@ public class GT_Recipe implements Comparable<GT_Recipe> { E, true, false).setSlotOverlay(false, false, GT_UITextures.OVERLAY_SLOT_FURNACE) - .setProgressBar(GT_UITextures.PROGRESSBAR_ARROW, ProgressBar.Direction.RIGHT) - .setSlotOverlaySteam(false, GT_UITextures.OVERLAY_SLOT_FURNACE_STEAM) - .setProgressBarSteam(GT_UITextures.PROGRESSBAR_ARROW_STEAM); + .setProgressBar(GT_UITextures.PROGRESSBAR_ARROW, ProgressBar.Direction.RIGHT) + .setSlotOverlaySteam(false, GT_UITextures.OVERLAY_SLOT_FURNACE_STEAM) + .setProgressBarSteam(GT_UITextures.PROGRESSBAR_ARROW_STEAM); public static final GT_Recipe_Map sMicrowaveRecipes = new GT_Recipe_Map_Microwave( new HashSet<>(0), "gt.recipe.microwave", @@ -1208,7 +1220,7 @@ public class GT_Recipe implements Comparable<GT_Recipe> { E, true, false).setSlotOverlay(false, false, GT_UITextures.OVERLAY_SLOT_FURNACE) - .setProgressBar(GT_UITextures.PROGRESSBAR_ARROW, ProgressBar.Direction.RIGHT); + .setProgressBar(GT_UITextures.PROGRESSBAR_ARROW, ProgressBar.Direction.RIGHT); /** Set {@code aSpecialValue = -100} to bypass the disassembler tier check and default recipe duration. */ public static final GT_Recipe_Map sDisassemblerRecipes = new GT_Recipe_Map( @@ -1244,7 +1256,7 @@ public class GT_Recipe implements Comparable<GT_Recipe> { return super.getOverlayForSlot(isFluid, isOutput, index, isSpecial); } }.setSlotOverlay(false, false, GT_UITextures.OVERLAY_SLOT_WRENCH) - .setProgressBar(GT_UITextures.PROGRESSBAR_ASSEMBLE, ProgressBar.Direction.RIGHT); + .setProgressBar(GT_UITextures.PROGRESSBAR_ASSEMBLE, ProgressBar.Direction.RIGHT); public static final GT_Recipe_Map sScannerFakeRecipes = new GT_Recipe_Map( new HashSet<>(300), @@ -1262,8 +1274,8 @@ public class GT_Recipe implements Comparable<GT_Recipe> { E, true, true).setSlotOverlay(false, false, GT_UITextures.OVERLAY_SLOT_MICROSCOPE) - .setSlotOverlay(false, false, true, true, GT_UITextures.OVERLAY_SLOT_DATA_ORB) - .setProgressBar(GT_UITextures.PROGRESSBAR_ARROW, ProgressBar.Direction.RIGHT); + .setSlotOverlay(false, false, true, true, GT_UITextures.OVERLAY_SLOT_DATA_ORB) + .setProgressBar(GT_UITextures.PROGRESSBAR_ARROW, ProgressBar.Direction.RIGHT); public static final GT_Recipe_Map sRockBreakerFakeRecipes = new GT_Recipe_Map( new HashSet<>(200), "gt.recipe.rockbreaker", @@ -1280,8 +1292,8 @@ public class GT_Recipe implements Comparable<GT_Recipe> { E, true, true).setSlotOverlay(false, false, GT_UITextures.OVERLAY_SLOT_DUST) - .setSlotOverlay(false, true, GT_UITextures.OVERLAY_SLOT_CRUSHED_ORE) - .setProgressBar(GT_UITextures.PROGRESSBAR_MACERATE, ProgressBar.Direction.RIGHT); + .setSlotOverlay(false, true, GT_UITextures.OVERLAY_SLOT_CRUSHED_ORE) + .setProgressBar(GT_UITextures.PROGRESSBAR_MACERATE, ProgressBar.Direction.RIGHT); public static final GT_Recipe_Map sByProductList = new GT_Recipe_Map( new HashSet<>(1000), "gt.recipe.byproductlist", @@ -1314,9 +1326,9 @@ public class GT_Recipe implements Comparable<GT_Recipe> { E, true, true).setSlotOverlay(false, false, GT_UITextures.OVERLAY_SLOT_CANISTER) - .setSlotOverlay(true, false, GT_UITextures.OVERLAY_SLOT_UUM) - .setSlotOverlay(false, false, true, true, GT_UITextures.OVERLAY_SLOT_DATA_ORB) - .setProgressBar(GT_UITextures.PROGRESSBAR_ARROW, ProgressBar.Direction.RIGHT); + .setSlotOverlay(true, false, GT_UITextures.OVERLAY_SLOT_UUM) + .setSlotOverlay(false, false, true, true, GT_UITextures.OVERLAY_SLOT_DATA_ORB) + .setProgressBar(GT_UITextures.PROGRESSBAR_ARROW, ProgressBar.Direction.RIGHT); // public static final GT_Recipe_Map sAssemblylineFakeRecipes = new GT_Recipe_Map(new HashSet<>(30), // "gt.recipe.scanner", "Scanner", null, RES_PATH_GUI + "basicmachines/Default", 1, 1, 1, 0, 1, E, 1, E, true, // true); @@ -1336,7 +1348,8 @@ public class GT_Recipe implements Comparable<GT_Recipe> { E, true, true).setSlotOverlay(false, false, true, true, GT_UITextures.OVERLAY_SLOT_DATA_ORB) - .setUsualFluidInputCount(4).setDisableOptimize(true); + .setUsualFluidInputCount(4) + .setDisableOptimize(true); public static final GT_Recipe_Map sPlasmaArcFurnaceRecipes = new GT_Recipe_Map( new HashSet<>(20000), "gt.recipe.plasmaarcfurnace", @@ -1353,7 +1366,7 @@ public class GT_Recipe implements Comparable<GT_Recipe> { E, true, true).setProgressBar(GT_UITextures.PROGRESSBAR_ARROW, ProgressBar.Direction.RIGHT) - .setRecipeConfigFile("arcfurnace", FIRST_ITEM_INPUT); + .setRecipeConfigFile("arcfurnace", FIRST_ITEM_INPUT); public static final GT_Recipe_Map sArcFurnaceRecipes = new GT_Recipe_Map( new HashSet<>(20000), "gt.recipe.arcfurnace", @@ -1370,7 +1383,7 @@ public class GT_Recipe implements Comparable<GT_Recipe> { E, true, true).setProgressBar(GT_UITextures.PROGRESSBAR_ARROW, ProgressBar.Direction.RIGHT) - .setRecipeConfigFile("arcfurnace", FIRST_ITEM_INPUT); + .setRecipeConfigFile("arcfurnace", FIRST_ITEM_INPUT); public static final GT_Recipe_Map sPrinterRecipes = new GT_Recipe_Map_Printer( new HashSet<>(5), "gt.recipe.printer", @@ -1387,10 +1400,10 @@ public class GT_Recipe implements Comparable<GT_Recipe> { E, true, true).setSlotOverlay(false, false, GT_UITextures.OVERLAY_SLOT_PAGE_BLANK) - .setSlotOverlay(false, true, GT_UITextures.OVERLAY_SLOT_PAGE_PRINTED) - .setSlotOverlay(false, false, true, true, GT_UITextures.OVERLAY_SLOT_DATA_STICK) - .setRecipeConfigFile("printer", FIRST_ITEM_INPUT) - .setProgressBar(GT_UITextures.PROGRESSBAR_ARROW, ProgressBar.Direction.RIGHT); + .setSlotOverlay(false, true, GT_UITextures.OVERLAY_SLOT_PAGE_PRINTED) + .setSlotOverlay(false, false, true, true, GT_UITextures.OVERLAY_SLOT_DATA_STICK) + .setRecipeConfigFile("printer", FIRST_ITEM_INPUT) + .setProgressBar(GT_UITextures.PROGRESSBAR_ARROW, ProgressBar.Direction.RIGHT); public static final GT_Recipe_Map sSifterRecipes = new GT_Recipe_Map( new HashSet<>(105), "gt.recipe.sifter", @@ -1407,7 +1420,7 @@ public class GT_Recipe implements Comparable<GT_Recipe> { E, true, true).setProgressBar(GT_UITextures.PROGRESSBAR_SIFT, ProgressBar.Direction.DOWN) - .setRecipeConfigFile("sifter", FIRST_ITEM_INPUT); + .setRecipeConfigFile("sifter", FIRST_ITEM_INPUT); public static final GT_Recipe_Map sPressRecipes = new GT_Recipe_Map_FormingPress( new HashSet<>(300), "gt.recipe.press", @@ -1424,10 +1437,10 @@ public class GT_Recipe implements Comparable<GT_Recipe> { E, true, true).setSlotOverlay(false, false, true, GT_UITextures.OVERLAY_SLOT_PRESS_1) - .setSlotOverlay(false, false, false, GT_UITextures.OVERLAY_SLOT_PRESS_2) - .setSlotOverlay(false, true, GT_UITextures.OVERLAY_SLOT_PRESS_3) - .setRecipeConfigFile("press", FIRST_ITEM_OUTPUT) - .setProgressBar(GT_UITextures.PROGRESSBAR_COMPRESS, ProgressBar.Direction.RIGHT); + .setSlotOverlay(false, false, false, GT_UITextures.OVERLAY_SLOT_PRESS_2) + .setSlotOverlay(false, true, GT_UITextures.OVERLAY_SLOT_PRESS_3) + .setRecipeConfigFile("press", FIRST_ITEM_OUTPUT) + .setProgressBar(GT_UITextures.PROGRESSBAR_COMPRESS, ProgressBar.Direction.RIGHT); public static final GT_Recipe_Map sLaserEngraverRecipes = new GT_Recipe_Map( new HashSet<>(810), "gt.recipe.laserengraver", @@ -1444,9 +1457,10 @@ public class GT_Recipe implements Comparable<GT_Recipe> { E, true, true).setSlotOverlay(false, false, false, GT_UITextures.OVERLAY_SLOT_LENS) - .setProgressBar(GT_UITextures.PROGRESSBAR_ARROW, ProgressBar.Direction.RIGHT) - .setRecipeConfigFile("laserengraving", FIRST_ITEM_OUTPUT).setUsualFluidInputCount(2) - .setUsualFluidOutputCount(2); + .setProgressBar(GT_UITextures.PROGRESSBAR_ARROW, ProgressBar.Direction.RIGHT) + .setRecipeConfigFile("laserengraving", FIRST_ITEM_OUTPUT) + .setUsualFluidInputCount(2) + .setUsualFluidOutputCount(2); public static final GT_Recipe_Map sMixerRecipes = new GT_Recipe_Map( new HashSet<>(900), "gt.recipe.mixer", @@ -1463,9 +1477,9 @@ public class GT_Recipe implements Comparable<GT_Recipe> { E, true, true).setSlotOverlay(false, false, GT_UITextures.OVERLAY_SLOT_DUST) - .setSlotOverlay(false, true, GT_UITextures.OVERLAY_SLOT_DUST) - .setRecipeConfigFile("mixer", FIRST_ITEM_OR_FLUID_OUTPUT) - .setProgressBar(GT_UITextures.PROGRESSBAR_MIXER, ProgressBar.Direction.CIRCULAR_CW); + .setSlotOverlay(false, true, GT_UITextures.OVERLAY_SLOT_DUST) + .setRecipeConfigFile("mixer", FIRST_ITEM_OR_FLUID_OUTPUT) + .setProgressBar(GT_UITextures.PROGRESSBAR_MIXER, ProgressBar.Direction.CIRCULAR_CW); public static final GT_Recipe_Map sAutoclaveRecipes = new GT_Recipe_Map( new HashSet<>(300), "gt.recipe.autoclave", @@ -1482,10 +1496,10 @@ public class GT_Recipe implements Comparable<GT_Recipe> { E, true, true).setSlotOverlay(false, false, GT_UITextures.OVERLAY_SLOT_DUST) - .setSlotOverlay(false, true, true, GT_UITextures.OVERLAY_SLOT_GEM) - .setSlotOverlay(false, true, false, GT_UITextures.OVERLAY_SLOT_DUST) - .setRecipeConfigFile("autoclave", FIRST_ITEM_INPUT) - .setProgressBar(GT_UITextures.PROGRESSBAR_ARROW, ProgressBar.Direction.RIGHT); + .setSlotOverlay(false, true, true, GT_UITextures.OVERLAY_SLOT_GEM) + .setSlotOverlay(false, true, false, GT_UITextures.OVERLAY_SLOT_DUST) + .setRecipeConfigFile("autoclave", FIRST_ITEM_INPUT) + .setProgressBar(GT_UITextures.PROGRESSBAR_ARROW, ProgressBar.Direction.RIGHT); public static final GT_Recipe_Map sElectroMagneticSeparatorRecipes = new GT_Recipe_Map( new HashSet<>(50), "gt.recipe.electromagneticseparator", @@ -1502,9 +1516,9 @@ public class GT_Recipe implements Comparable<GT_Recipe> { E, true, true).setSlotOverlay(false, false, GT_UITextures.OVERLAY_SLOT_CRUSHED_ORE) - .setSlotOverlay(false, true, GT_UITextures.OVERLAY_SLOT_DUST) - .setRecipeConfigFile("electromagneticseparator", FIRST_ITEM_INPUT) - .setProgressBar(GT_UITextures.PROGRESSBAR_MAGNET, ProgressBar.Direction.RIGHT); + .setSlotOverlay(false, true, GT_UITextures.OVERLAY_SLOT_DUST) + .setRecipeConfigFile("electromagneticseparator", FIRST_ITEM_INPUT) + .setProgressBar(GT_UITextures.PROGRESSBAR_MAGNET, ProgressBar.Direction.RIGHT); public static final GT_Recipe_Map sPolarizerRecipes = new GT_Recipe_Map( new HashSet<>(300), "gt.recipe.polarizer", @@ -1521,7 +1535,7 @@ public class GT_Recipe implements Comparable<GT_Recipe> { E, true, true).setProgressBar(GT_UITextures.PROGRESSBAR_MAGNET, ProgressBar.Direction.RIGHT) - .setRecipeConfigFile("polarizer", FIRST_ITEM_INPUT); + .setRecipeConfigFile("polarizer", FIRST_ITEM_INPUT); public static final GT_Recipe_Map sMaceratorRecipes = new GT_Recipe_Map_Macerator( new HashSet<>(16600), "gt.recipe.macerator", @@ -1538,12 +1552,12 @@ public class GT_Recipe implements Comparable<GT_Recipe> { E, true, true).setSlotOverlay(false, false, GT_UITextures.OVERLAY_SLOT_CRUSHED_ORE) - .setSlotOverlay(false, true, GT_UITextures.OVERLAY_SLOT_DUST) - .setProgressBar(GT_UITextures.PROGRESSBAR_MACERATE, ProgressBar.Direction.RIGHT) - .setRecipeConfigFile("pulveriser", FIRST_ITEM_INPUT) - .setSlotOverlaySteam(false, GT_UITextures.OVERLAY_SLOT_CRUSHED_ORE_STEAM) - .setSlotOverlaySteam(true, GT_UITextures.OVERLAY_SLOT_DUST_STEAM) - .setProgressBarSteam(GT_UITextures.PROGRESSBAR_MACERATE_STEAM); + .setSlotOverlay(false, true, GT_UITextures.OVERLAY_SLOT_DUST) + .setProgressBar(GT_UITextures.PROGRESSBAR_MACERATE, ProgressBar.Direction.RIGHT) + .setRecipeConfigFile("pulveriser", FIRST_ITEM_INPUT) + .setSlotOverlaySteam(false, GT_UITextures.OVERLAY_SLOT_CRUSHED_ORE_STEAM) + .setSlotOverlaySteam(true, GT_UITextures.OVERLAY_SLOT_DUST_STEAM) + .setProgressBarSteam(GT_UITextures.PROGRESSBAR_MACERATE_STEAM); public static final GT_Recipe_Map sChemicalBathRecipes = new GT_Recipe_Map( new HashSet<>(2550), "gt.recipe.chemicalbath", @@ -1560,7 +1574,7 @@ public class GT_Recipe implements Comparable<GT_Recipe> { E, true, true).setProgressBar(GT_UITextures.PROGRESSBAR_BATH, ProgressBar.Direction.CIRCULAR_CW) - .setRecipeConfigFile("chemicalbath", FIRST_ITEM_INPUT); + .setRecipeConfigFile("chemicalbath", FIRST_ITEM_INPUT); public static final GT_Recipe_Map sFluidCannerRecipes = new GT_Recipe_Map_FluidCanner( new HashSet<>(2100), "gt.recipe.fluidcanner", @@ -1577,9 +1591,9 @@ public class GT_Recipe implements Comparable<GT_Recipe> { E, true, true).setSlotOverlay(false, false, GT_UITextures.OVERLAY_SLOT_CANISTER) - .setSlotOverlay(false, true, GT_UITextures.OVERLAY_SLOT_CANISTER) - .setRecipeConfigFile("canning", FIRST_ITEM_INPUT) - .setProgressBar(GT_UITextures.PROGRESSBAR_CANNER, ProgressBar.Direction.RIGHT); + .setSlotOverlay(false, true, GT_UITextures.OVERLAY_SLOT_CANISTER) + .setRecipeConfigFile("canning", FIRST_ITEM_INPUT) + .setProgressBar(GT_UITextures.PROGRESSBAR_CANNER, ProgressBar.Direction.RIGHT); public static final GT_Recipe_Map sBrewingRecipes = new GT_Recipe_Map( new HashSet<>(450), "gt.recipe.brewer", @@ -1596,8 +1610,8 @@ public class GT_Recipe implements Comparable<GT_Recipe> { E, true, true).setSlotOverlay(false, false, GT_UITextures.OVERLAY_SLOT_CAULDRON) - .setRecipeConfigFile("brewing", FIRST_FLUIDSTACK_OUTPUT) - .setProgressBar(GT_UITextures.PROGRESSBAR_ARROW_MULTIPLE, ProgressBar.Direction.RIGHT); + .setRecipeConfigFile("brewing", FIRST_FLUIDSTACK_OUTPUT) + .setProgressBar(GT_UITextures.PROGRESSBAR_ARROW_MULTIPLE, ProgressBar.Direction.RIGHT); public static final GT_Recipe_Map sFluidHeaterRecipes = new GT_Recipe_Map( new HashSet<>(10), "gt.recipe.fluidheater", @@ -1614,9 +1628,9 @@ public class GT_Recipe implements Comparable<GT_Recipe> { E, true, true).setSlotOverlay(true, false, GT_UITextures.OVERLAY_SLOT_HEATER_1) - .setSlotOverlay(true, true, GT_UITextures.OVERLAY_SLOT_HEATER_2) - .setRecipeConfigFile("fluidheater", FIRST_FLUIDSTACK_OUTPUT) - .setProgressBar(GT_UITextures.PROGRESSBAR_ARROW_MULTIPLE, ProgressBar.Direction.RIGHT); + .setSlotOverlay(true, true, GT_UITextures.OVERLAY_SLOT_HEATER_2) + .setRecipeConfigFile("fluidheater", FIRST_FLUIDSTACK_OUTPUT) + .setProgressBar(GT_UITextures.PROGRESSBAR_ARROW_MULTIPLE, ProgressBar.Direction.RIGHT); public static final GT_Recipe_Map sDistilleryRecipes = new GT_Recipe_Map( new HashSet<>(400), "gt.recipe.distillery", @@ -1633,49 +1647,52 @@ public class GT_Recipe implements Comparable<GT_Recipe> { E, true, true).setSlotOverlay(true, false, GT_UITextures.OVERLAY_SLOT_BEAKER_1) - .setSlotOverlay(true, true, GT_UITextures.OVERLAY_SLOT_BEAKER_2) - .setRecipeConfigFile("distillery", FIRST_FLUIDSTACK_OUTPUT).setRecipeSpecialHandler(r -> { - int aInput = r.mFluidInputs[0].amount, aOutput = r.mFluidOutputs[0].amount, - aDuration = r.mDuration; - - // reduce the batch size if fluid amount is exceeding - int tScale = (Math.max(aInput, aOutput) + 999) / 1000; - if (tScale <= 0) tScale = 1; - if (tScale > 1) { - // trying to find whether there is a better factor - for (int i = tScale; i <= 5; i++) { - if (aInput % i == 0 && aDuration % i == 0) { - tScale = i; - break; - } - } - for (int i = tScale; i <= 5; i++) { - if (aInput % i == 0 && aDuration % i == 0 && aOutput % i == 0) { - tScale = i; - break; - } - } - aInput = (aInput + tScale - 1) / tScale; - aOutput = aOutput / tScale; - if (!isArrayEmptyOrNull(r.mOutputs)) { - ItemData tData = GT_OreDictUnificator.getItemData(r.mOutputs[0]); - if (tData != null && (tData.mPrefix == OrePrefixes.dust - || OrePrefixes.dust.mFamiliarPrefixes.contains(tData.mPrefix))) { - r.mOutputs[0] = GT_OreDictUnificator.getDust( - tData.mMaterial.mMaterial, - tData.mMaterial.mAmount * r.mOutputs[0].stackSize / tScale); - } else { - if (r.mOutputs[0].stackSize / tScale == 0) r.mOutputs[0] = GT_Values.NI; - else r.mOutputs[0] = GT_Utility - .copyAmount(r.mOutputs[0].stackSize / tScale, r.mOutputs[0]); - } - } - aDuration = (aDuration + tScale - 1) / tScale; - r.mFluidInputs[0] = GT_Utility.copyAmount(aInput, r.mFluidInputs[0]); - r.mFluidOutputs[0] = GT_Utility.copyAmount(aOutput, r.mFluidOutputs[0]); - r.mDuration = aDuration; - } - }).setProgressBar(GT_UITextures.PROGRESSBAR_ARROW_MULTIPLE, ProgressBar.Direction.RIGHT); + .setSlotOverlay(true, true, GT_UITextures.OVERLAY_SLOT_BEAKER_2) + .setRecipeConfigFile("distillery", FIRST_FLUIDSTACK_OUTPUT) + .setRecipeSpecialHandler(r -> { + int aInput = r.mFluidInputs[0].amount, aOutput = r.mFluidOutputs[0].amount, + aDuration = r.mDuration; + + // reduce the batch size if fluid amount is exceeding + int tScale = (Math.max(aInput, aOutput) + 999) / 1000; + if (tScale <= 0) tScale = 1; + if (tScale > 1) { + // trying to find whether there is a better factor + for (int i = tScale; i <= 5; i++) { + if (aInput % i == 0 && aDuration % i == 0) { + tScale = i; + break; + } + } + for (int i = tScale; i <= 5; i++) { + if (aInput % i == 0 && aDuration % i == 0 && aOutput % i == 0) { + tScale = i; + break; + } + } + aInput = (aInput + tScale - 1) / tScale; + aOutput = aOutput / tScale; + if (!isArrayEmptyOrNull(r.mOutputs)) { + ItemData tData = GT_OreDictUnificator.getItemData(r.mOutputs[0]); + if (tData != null && (tData.mPrefix == OrePrefixes.dust + || OrePrefixes.dust.mFamiliarPrefixes.contains(tData.mPrefix))) { + r.mOutputs[0] = GT_OreDictUnificator.getDust( + tData.mMaterial.mMaterial, + tData.mMaterial.mAmount * r.mOutputs[0].stackSize / tScale); + } else { + if (r.mOutputs[0].stackSize / tScale == 0) r.mOutputs[0] = GT_Values.NI; + else r.mOutputs[0] = GT_Utility.copyAmount( + r.mOutputs[0].stackSize / tScale, + r.mOutputs[0]); + } + } + aDuration = (aDuration + tScale - 1) / tScale; + r.mFluidInputs[0] = GT_Utility.copyAmount(aInput, r.mFluidInputs[0]); + r.mFluidOutputs[0] = GT_Utility.copyAmount(aOutput, r.mFluidOutputs[0]); + r.mDuration = aDuration; + } + }) + .setProgressBar(GT_UITextures.PROGRESSBAR_ARROW_MULTIPLE, ProgressBar.Direction.RIGHT); public static final GT_Recipe_Map sFermentingRecipes = new GT_Recipe_Map( new HashSet<>(50), "gt.recipe.fermenter", @@ -1692,7 +1709,7 @@ public class GT_Recipe implements Comparable<GT_Recipe> { E, true, true).setProgressBar(GT_UITextures.PROGRESSBAR_ARROW_MULTIPLE, ProgressBar.Direction.RIGHT) - .setRecipeConfigFile("fermenting", FIRST_FLUIDSTACK_OUTPUT); + .setRecipeConfigFile("fermenting", FIRST_FLUIDSTACK_OUTPUT); public static final GT_Recipe_Map sFluidSolidficationRecipes = new GT_Recipe_Map( new HashSet<>(35000), "gt.recipe.fluidsolidifier", @@ -1709,16 +1726,20 @@ public class GT_Recipe implements Comparable<GT_Recipe> { E, true, true).setSlotOverlay(false, false, GT_UITextures.OVERLAY_SLOT_MOLD) - .setRecipeConfigFile("fluidsolidifier", FIRST_ITEM_OUTPUT).setRecipeSpecialHandler(r -> { - if (ArrayUtils.isNotEmpty(r.mFluidInputs)) { - if (Materials.PhasedGold.getMolten(1).isFluidEqual(r.mFluidInputs[0])) - r.mFluidInputs = new FluidStack[] { - Materials.VibrantAlloy.getMolten(r.mFluidInputs[0].amount) }; - else if (Materials.PhasedIron.getMolten(1).isFluidEqual(r.mFluidInputs[0])) - r.mFluidInputs = new FluidStack[] { - Materials.PulsatingIron.getMolten(r.mFluidInputs[0].amount) }; - } - }).setProgressBar(GT_UITextures.PROGRESSBAR_ARROW, ProgressBar.Direction.RIGHT); + .setRecipeConfigFile("fluidsolidifier", FIRST_ITEM_OUTPUT) + .setRecipeSpecialHandler(r -> { + if (ArrayUtils.isNotEmpty(r.mFluidInputs)) { + if (Materials.PhasedGold.getMolten(1) + .isFluidEqual(r.mFluidInputs[0])) + r.mFluidInputs = new FluidStack[] { + Materials.VibrantAlloy.getMolten(r.mFluidInputs[0].amount) }; + else if (Materials.PhasedIron.getMolten(1) + .isFluidEqual(r.mFluidInputs[0])) + r.mFluidInputs = new FluidStack[] { + Materials.PulsatingIron.getMolten(r.mFluidInputs[0].amount) }; + } + }) + .setProgressBar(GT_UITextures.PROGRESSBAR_ARROW, ProgressBar.Direction.RIGHT); public static final GT_Recipe_Map sFluidExtractionRecipes = new GT_Recipe_Map( new HashSet<>(15000), "gt.recipe.fluidextractor", @@ -1735,16 +1756,20 @@ public class GT_Recipe implements Comparable<GT_Recipe> { E, true, true).setSlotOverlay(false, false, GT_UITextures.OVERLAY_SLOT_CENTRIFUGE) - .setRecipeConfigFile("fluidextractor", FIRST_ITEM_INPUT).setRecipeSpecialHandler(r -> { - if (ArrayUtils.isNotEmpty(r.mFluidInputs)) { - if (Materials.PhasedGold.getMolten(1).isFluidEqual(r.mFluidInputs[0])) - r.mFluidInputs = new FluidStack[] { - Materials.VibrantAlloy.getMolten(r.mFluidInputs[0].amount) }; - else if (Materials.PhasedIron.getMolten(1).isFluidEqual(r.mFluidInputs[0])) - r.mFluidInputs = new FluidStack[] { - Materials.PulsatingIron.getMolten(r.mFluidInputs[0].amount) }; - } - }).setProgressBar(GT_UITextures.PROGRESSBAR_EXTRACT, ProgressBar.Direction.RIGHT); + .setRecipeConfigFile("fluidextractor", FIRST_ITEM_INPUT) + .setRecipeSpecialHandler(r -> { + if (ArrayUtils.isNotEmpty(r.mFluidInputs)) { + if (Materials.PhasedGold.getMolten(1) + .isFluidEqual(r.mFluidInputs[0])) + r.mFluidInputs = new FluidStack[] { + Materials.VibrantAlloy.getMolten(r.mFluidInputs[0].amount) }; + else if (Materials.PhasedIron.getMolten(1) + .isFluidEqual(r.mFluidInputs[0])) + r.mFluidInputs = new FluidStack[] { + Materials.PulsatingIron.getMolten(r.mFluidInputs[0].amount) }; + } + }) + .setProgressBar(GT_UITextures.PROGRESSBAR_EXTRACT, ProgressBar.Direction.RIGHT); public static final GT_Recipe_Map sBoxinatorRecipes = new GT_Recipe_Map( new HashSet<>(2500), "gt.recipe.packager", @@ -1761,9 +1786,9 @@ public class GT_Recipe implements Comparable<GT_Recipe> { E, true, true).setSlotOverlay(false, false, false, GT_UITextures.OVERLAY_SLOT_BOX) - .setRecipeConfigFile("boxing", FIRST_ITEM_OUTPUT) - .setSlotOverlay(false, true, GT_UITextures.OVERLAY_SLOT_BOXED) - .setProgressBar(GT_UITextures.PROGRESSBAR_ARROW, ProgressBar.Direction.RIGHT); + .setRecipeConfigFile("boxing", FIRST_ITEM_OUTPUT) + .setSlotOverlay(false, true, GT_UITextures.OVERLAY_SLOT_BOXED) + .setProgressBar(GT_UITextures.PROGRESSBAR_ARROW, ProgressBar.Direction.RIGHT); public static final GT_Recipe_Map sUnboxinatorRecipes = new GT_Recipe_Map_Unboxinator( new HashSet<>(2500), "gt.recipe.unpackager", @@ -1780,8 +1805,8 @@ public class GT_Recipe implements Comparable<GT_Recipe> { E, true, true).setSlotOverlay(false, false, GT_UITextures.OVERLAY_SLOT_BOXED) - .setRecipeConfigFile("unboxing", FIRST_ITEM_OUTPUT) - .setProgressBar(GT_UITextures.PROGRESSBAR_ARROW, ProgressBar.Direction.RIGHT); + .setRecipeConfigFile("unboxing", FIRST_ITEM_OUTPUT) + .setProgressBar(GT_UITextures.PROGRESSBAR_ARROW, ProgressBar.Direction.RIGHT); public static final GT_Recipe_Map sFusionRecipes = new GT_Recipe_Map_FluidOnly( new HashSet<>(50), "gt.recipe.fusionreactor", @@ -1798,9 +1823,11 @@ public class GT_Recipe implements Comparable<GT_Recipe> { " EU", true, true).setProgressBar(GT_UITextures.PROGRESSBAR_ARROW, ProgressBar.Direction.RIGHT) - .useComparatorForNEI(true).setUsualFluidInputCount(2) - .setRecipeConfigFile("fusion", FIRST_FLUID_OUTPUT).setDisableOptimize(true) - .setNEISpecialInfoFormatter(FusionSpecialValueFormatter.INSTANCE); + .useComparatorForNEI(true) + .setUsualFluidInputCount(2) + .setRecipeConfigFile("fusion", FIRST_FLUID_OUTPUT) + .setDisableOptimize(true) + .setNEISpecialInfoFormatter(FusionSpecialValueFormatter.INSTANCE); public static final GT_Recipe_Map sComplexFusionRecipes = new GT_Recipe_Map_ComplexFusion( new HashSet<>(50), "gt.recipe.complexfusionreactor", @@ -1817,9 +1844,12 @@ public class GT_Recipe implements Comparable<GT_Recipe> { " EU", true, true).setProgressBar(GT_UITextures.PROGRESSBAR_ARROW, ProgressBar.Direction.RIGHT) - .setUsualFluidInputCount(16).setUsualFluidOutputCount(16) - .setNEITransferRect(new Rectangle(79, 34, 18, 18)).setLogoPos(80, 61) - .setNEISpecialInfoFormatter(FusionSpecialValueFormatter.INSTANCE).setDisableOptimize(true); + .setUsualFluidInputCount(16) + .setUsualFluidOutputCount(16) + .setNEITransferRect(new Rectangle(79, 34, 18, 18)) + .setLogoPos(80, 61) + .setNEISpecialInfoFormatter(FusionSpecialValueFormatter.INSTANCE) + .setDisableOptimize(true); public static final GT_Recipe_Map sCentrifugeRecipes = new GT_Recipe_Map( new HashSet<>(1200), "gt.recipe.centrifuge", @@ -1836,10 +1866,10 @@ public class GT_Recipe implements Comparable<GT_Recipe> { E, true, true).setSlotOverlay(false, false, true, GT_UITextures.OVERLAY_SLOT_CENTRIFUGE) - .setRecipeConfigFile("centrifuge", FIRST_ITEM_OR_FLUID_INPUT) - .setSlotOverlay(false, false, false, GT_UITextures.OVERLAY_SLOT_CANISTER) - .setSlotOverlay(true, false, GT_UITextures.OVERLAY_SLOT_CENTRIFUGE_FLUID) - .setProgressBar(GT_UITextures.PROGRESSBAR_EXTRACT, ProgressBar.Direction.RIGHT); + .setRecipeConfigFile("centrifuge", FIRST_ITEM_OR_FLUID_INPUT) + .setSlotOverlay(false, false, false, GT_UITextures.OVERLAY_SLOT_CANISTER) + .setSlotOverlay(true, false, GT_UITextures.OVERLAY_SLOT_CENTRIFUGE_FLUID) + .setProgressBar(GT_UITextures.PROGRESSBAR_EXTRACT, ProgressBar.Direction.RIGHT); public static final GT_Recipe_Map sElectrolyzerRecipes = new GT_Recipe_Map( new HashSet<>(300), "gt.recipe.electrolyzer", @@ -1856,10 +1886,10 @@ public class GT_Recipe implements Comparable<GT_Recipe> { E, true, true).setSlotOverlay(false, false, true, GT_UITextures.OVERLAY_SLOT_CHARGER) - .setRecipeConfigFile("electrolyzer", FIRST_ITEM_OR_FLUID_INPUT) - .setSlotOverlay(false, false, false, GT_UITextures.OVERLAY_SLOT_CANISTER) - .setSlotOverlay(true, false, GT_UITextures.OVERLAY_SLOT_CHARGER_FLUID) - .setProgressBar(GT_UITextures.PROGRESSBAR_EXTRACT, ProgressBar.Direction.RIGHT); + .setRecipeConfigFile("electrolyzer", FIRST_ITEM_OR_FLUID_INPUT) + .setSlotOverlay(false, false, false, GT_UITextures.OVERLAY_SLOT_CANISTER) + .setSlotOverlay(true, false, GT_UITextures.OVERLAY_SLOT_CHARGER_FLUID) + .setProgressBar(GT_UITextures.PROGRESSBAR_EXTRACT, ProgressBar.Direction.RIGHT); /** * Use special value as coil heat level. */ @@ -1879,8 +1909,8 @@ public class GT_Recipe implements Comparable<GT_Recipe> { " K", false, true).setProgressBar(GT_UITextures.PROGRESSBAR_ARROW, ProgressBar.Direction.RIGHT) - .setRecipeConfigFile("blastfurnace", FIRST_ITEM_INPUT) - .setNEISpecialInfoFormatter(HeatingCoilSpecialValueFormatter.INSTANCE); + .setRecipeConfigFile("blastfurnace", FIRST_ITEM_INPUT) + .setNEISpecialInfoFormatter(HeatingCoilSpecialValueFormatter.INSTANCE); /** * Use special value as coil heat level. */ @@ -1900,8 +1930,10 @@ public class GT_Recipe implements Comparable<GT_Recipe> { " K", false, true).setProgressBar(GT_UITextures.PROGRESSBAR_ARROW, ProgressBar.Direction.RIGHT) - .setUsualFluidInputCount(9).setUsualFluidOutputCount(9).setDisableOptimize(true) - .setNEISpecialInfoFormatter(HeatingCoilSpecialValueFormatter.INSTANCE); + .setUsualFluidInputCount(9) + .setUsualFluidOutputCount(9) + .setDisableOptimize(true) + .setNEISpecialInfoFormatter(HeatingCoilSpecialValueFormatter.INSTANCE); public static final GT_Recipe_Map sTranscendentPlasmaMixerRecipes = new TranscendentPlasmaMixerRecipeMap( new HashSet<>(20), @@ -2007,8 +2039,8 @@ public class GT_Recipe implements Comparable<GT_Recipe> { } } if (neiCachedRecipe.mRecipe instanceof GT_FakeSpaceProjectRecipe) { - ISpaceProject project = SpaceProjectManager - .getProject(((GT_FakeSpaceProjectRecipe) neiCachedRecipe.mRecipe).projectName); + ISpaceProject project = SpaceProjectManager.getProject( + ((GT_FakeSpaceProjectRecipe) neiCachedRecipe.mRecipe).projectName); if (project != null) { projectTexture = project.getTexture(); GuiDraw.drawStringC( @@ -2028,22 +2060,30 @@ public class GT_Recipe implements Comparable<GT_Recipe> { int bar2Width = 18; builder.widget( new ProgressBar().setTexture(GT_UITextures.PROGRESSBAR_ASSEMBLY_LINE_1, 17) - .setDirection(ProgressBar.Direction.RIGHT) - .setProgress( - () -> progressSupplier.get() * ((float) (bar1Width + bar2Width) / bar1Width)) - .setSynced(false, false).setPos(new Pos2d(70, 28).add(windowOffset)) - .setSize(bar1Width, 72)); + .setDirection(ProgressBar.Direction.RIGHT) + .setProgress( + () -> progressSupplier.get() + * ((float) (bar1Width + bar2Width) / bar1Width)) + .setSynced(false, false) + .setPos(new Pos2d(70, 28).add(windowOffset)) + .setSize(bar1Width, 72)); builder.widget( new ProgressBar().setTexture(GT_UITextures.PROGRESSBAR_ASSEMBLY_LINE_2, 18) - .setDirection(ProgressBar.Direction.RIGHT) - .setProgress( - () -> (progressSupplier.get() - ((float) bar1Width / (bar1Width + bar2Width))) - * ((float) (bar1Width + bar2Width) / bar2Width)) - .setSynced(false, false).setPos(new Pos2d(106, 28).add(windowOffset)) - .setSize(bar2Width, 72)); + .setDirection(ProgressBar.Direction.RIGHT) + .setProgress( + () -> (progressSupplier.get() + - ((float) bar1Width / (bar1Width + bar2Width))) + * ((float) (bar1Width + bar2Width) / bar2Width)) + .setSynced(false, false) + .setPos(new Pos2d(106, 28).add(windowOffset)) + .setSize(bar2Width, 72)); } - }.useModularUI(true).setRenderRealStackSizes(false).setUsualFluidInputCount(4).setNEIBackgroundOffset(2, 23) - .setLogoPos(152, 83).setDisableOptimize(true); + }.useModularUI(true) + .setRenderRealStackSizes(false) + .setUsualFluidInputCount(4) + .setNEIBackgroundOffset(2, 23) + .setLogoPos(152, 83) + .setDisableOptimize(true); public static class TranscendentPlasmaMixerRecipeMap extends GT_Recipe_Map { @@ -2119,70 +2159,84 @@ public class GT_Recipe implements Comparable<GT_Recipe> { E, false, true).setProgressBar(GT_UITextures.PROGRESSBAR_ARROW, ProgressBar.Direction.RIGHT) - .setRecipeEmitter(builder -> { - Optional<GT_Recipe> rr = builder.validateInputCount(1, 2).validateOutputCount(1, 2) - .validateNoInputFluid().validateNoOutputFluid().noOptimize().build(); - if (!rr.isPresent()) return Collections.emptyList(); - ItemStack aInput1 = builder.getItemInputBasic(0); - ItemStack aInput2 = builder.getItemInputBasic(1); - ItemStack aOutput1 = builder.getItemOutput(0); - ItemStack aOutput2 = builder.getItemOutput(1); - if ((aInput1 == null && aInput2 == null) || (aOutput1 == null && aOutput2 == null)) - return Collections.emptyList(); - int aCoalAmount = builder.getMetadata(ADDITIVE_AMOUNT); - if (aCoalAmount <= 0) return Collections.emptyList(); - GT_RecipeTemplate coll = asTemplate(rr.get()); - for (Materials coal : new Materials[] { Materials.Coal, Materials.Charcoal }) { - coll.derive().setInputs(aInput1, aInput2, coal.getGems(aCoalAmount)) - .setOutputs(aOutput1, aOutput2, Materials.DarkAsh.getDustTiny(aCoalAmount)); - coll.derive().setInputs(aInput1, aInput2, coal.getDust(aCoalAmount)) - .setOutputs(aOutput1, aOutput2, Materials.DarkAsh.getDustTiny(aCoalAmount)); - } - int aDuration = builder.duration; - if (Railcraft.isModLoaded()) { - coll.derive() - .setInputs(aInput1, aInput2, RailcraftToolItems.getCoalCoke(aCoalAmount / 2)) - .setOutputs(aOutput1, aOutput2, Materials.Ash.getDustTiny(aCoalAmount / 2)) - .setDuration(aDuration * 2 / 3); - } - if (GTPlusPlus.isModLoaded()) { - ItemStack cactusCoke = GT_ModHandler - .getModItem(GTPlusPlus.modID, "itemCactusCoke", aCoalAmount * 2L); - ItemStack sugarCoke = GT_ModHandler - .getModItem(GTPlusPlus.modID, "itemSugarCoke", aCoalAmount * 2L); - coll.derive().setInputs(aInput1, aInput2, cactusCoke) - .setOutputs(aOutput1, aOutput2, Materials.Ash.getDustTiny(aCoalAmount * 2)) - .setDuration(aDuration * 2 / 3); - coll.derive().setInputs(aInput1, aInput2, sugarCoke) - .setOutputs(aOutput1, aOutput2, Materials.Ash.getDustTiny(aCoalAmount * 2)) - .setDuration(aDuration * 2 / 3); - } - if ((aInput1 == null || aInput1.stackSize <= 6) - && (aInput2 == null || aInput2.stackSize <= 6) - && (aOutput1 == null || aOutput1.stackSize <= 6) - && (aOutput2 == null || aOutput2.stackSize <= 6)) { - // we don't use GT_Utility.mul() here. It does not have the truncating we need here. - aInput1 = GT_Utility.multiplyStack(10L, aInput1); - aInput2 = GT_Utility.multiplyStack(10L, aInput2); - aOutput1 = GT_Utility.multiplyStack(10L, aOutput1); - aOutput2 = GT_Utility.multiplyStack(10L, aOutput2); - for (Materials coal : new Materials[] { Materials.Coal, Materials.Charcoal }) { - coll.derive().setInputs(aInput1, aInput2, coal.getBlocks(aCoalAmount)) - .setOutputs(aOutput1, aOutput2, Materials.DarkAsh.getDust(aCoalAmount)) - .setDuration(aDuration * 10); - coll.derive().setInputs(aInput1, aInput2, coal.getBlocks(aCoalAmount)) - .setOutputs(aOutput1, aOutput2, Materials.DarkAsh.getDust(aCoalAmount)) - .setDuration(aDuration * 10); - } - if (Railcraft.isModLoaded()) { - coll.derive() - .setInputs(aInput1, aInput2, EnumCube.COKE_BLOCK.getItem(aCoalAmount / 2)) - .setOutputs(aOutput1, aOutput2, Materials.Ash.getDust(aCoalAmount / 2)) - .setDuration(aDuration * 20 / 3); - } - } - return coll.getAll(); - }).setRecipeConfigFile("primitiveblastfurnace", FIRST_ITEM_INPUT); + .setRecipeEmitter(builder -> { + Optional<GT_Recipe> rr = builder.validateInputCount(1, 2) + .validateOutputCount(1, 2) + .validateNoInputFluid() + .validateNoOutputFluid() + .noOptimize() + .build(); + if (!rr.isPresent()) return Collections.emptyList(); + ItemStack aInput1 = builder.getItemInputBasic(0); + ItemStack aInput2 = builder.getItemInputBasic(1); + ItemStack aOutput1 = builder.getItemOutput(0); + ItemStack aOutput2 = builder.getItemOutput(1); + if ((aInput1 == null && aInput2 == null) || (aOutput1 == null && aOutput2 == null)) + return Collections.emptyList(); + int aCoalAmount = builder.getMetadata(ADDITIVE_AMOUNT); + if (aCoalAmount <= 0) return Collections.emptyList(); + GT_RecipeTemplate coll = asTemplate(rr.get()); + for (Materials coal : new Materials[] { Materials.Coal, Materials.Charcoal }) { + coll.derive() + .setInputs(aInput1, aInput2, coal.getGems(aCoalAmount)) + .setOutputs(aOutput1, aOutput2, Materials.DarkAsh.getDustTiny(aCoalAmount)); + coll.derive() + .setInputs(aInput1, aInput2, coal.getDust(aCoalAmount)) + .setOutputs(aOutput1, aOutput2, Materials.DarkAsh.getDustTiny(aCoalAmount)); + } + int aDuration = builder.duration; + if (Railcraft.isModLoaded()) { + coll.derive() + .setInputs(aInput1, aInput2, RailcraftToolItems.getCoalCoke(aCoalAmount / 2)) + .setOutputs(aOutput1, aOutput2, Materials.Ash.getDustTiny(aCoalAmount / 2)) + .setDuration(aDuration * 2 / 3); + } + if (GTPlusPlus.isModLoaded()) { + ItemStack cactusCoke = GT_ModHandler.getModItem( + GTPlusPlus.modID, + "itemCactusCoke", + aCoalAmount * 2L); + ItemStack sugarCoke = GT_ModHandler.getModItem( + GTPlusPlus.modID, + "itemSugarCoke", + aCoalAmount * 2L); + coll.derive() + .setInputs(aInput1, aInput2, cactusCoke) + .setOutputs(aOutput1, aOutput2, Materials.Ash.getDustTiny(aCoalAmount * 2)) + .setDuration(aDuration * 2 / 3); + coll.derive() + .setInputs(aInput1, aInput2, sugarCoke) + .setOutputs(aOutput1, aOutput2, Materials.Ash.getDustTiny(aCoalAmount * 2)) + .setDuration(aDuration * 2 / 3); + } + if ((aInput1 == null || aInput1.stackSize <= 6) && (aInput2 == null || aInput2.stackSize <= 6) + && (aOutput1 == null || aOutput1.stackSize <= 6) + && (aOutput2 == null || aOutput2.stackSize <= 6)) { + // we don't use GT_Utility.mul() here. It does not have the truncating we need here. + aInput1 = GT_Utility.multiplyStack(10L, aInput1); + aInput2 = GT_Utility.multiplyStack(10L, aInput2); + aOutput1 = GT_Utility.multiplyStack(10L, aOutput1); + aOutput2 = GT_Utility.multiplyStack(10L, aOutput2); + for (Materials coal : new Materials[] { Materials.Coal, Materials.Charcoal }) { + coll.derive() + .setInputs(aInput1, aInput2, coal.getBlocks(aCoalAmount)) + .setOutputs(aOutput1, aOutput2, Materials.DarkAsh.getDust(aCoalAmount)) + .setDuration(aDuration * 10); + coll.derive() + .setInputs(aInput1, aInput2, coal.getBlocks(aCoalAmount)) + .setOutputs(aOutput1, aOutput2, Materials.DarkAsh.getDust(aCoalAmount)) + .setDuration(aDuration * 10); + } + if (Railcraft.isModLoaded()) { + coll.derive() + .setInputs(aInput1, aInput2, EnumCube.COKE_BLOCK.getItem(aCoalAmount / 2)) + .setOutputs(aOutput1, aOutput2, Materials.Ash.getDust(aCoalAmount / 2)) + .setDuration(aDuration * 20 / 3); + } + } + return coll.getAll(); + }) + .setRecipeConfigFile("primitiveblastfurnace", FIRST_ITEM_INPUT); public static final GT_Recipe_Map sImplosionRecipes = new GT_Recipe_Map( new HashSet<>(900), "gt.recipe.implosioncompressor", @@ -2199,35 +2253,47 @@ public class GT_Recipe implements Comparable<GT_Recipe> { E, true, true).setSlotOverlay(false, false, true, GT_UITextures.OVERLAY_SLOT_IMPLOSION) - .setSlotOverlay(false, false, false, GT_UITextures.OVERLAY_SLOT_EXPLOSIVE) - .setRecipeConfigFile("implosion", FIRST_ITEM_INPUT).setRecipeEmitter(b -> { - switch (b.getItemInputsBasic().length) { - case 0: - return Collections.emptyList(); - case 1: - break; - default: - return b.build().map(Collections::singletonList).orElse(Collections.emptyList()); - } - Optional<GT_Recipe> t = b.noOptimize().duration(20).eut(30).validateInputCount(1, 1) - .validateOutputCount(1, 1).build(); - if (!t.isPresent()) return Collections.emptyList(); - ItemStack input = b.getItemInputBasic(0); - GT_RecipeTemplate coll = asTemplate(t.get()); - int tExplosives = Math.min(b.getMetadata(ADDITIVE_AMOUNT), 64); - int tGunpowder = tExplosives << 1; // Worst - int tDynamite = Math.max(1, tExplosives >> 1); // good - int tTNT = tExplosives; // Slightly better - int tITNT = Math.max(1, tExplosives >> 2); // the best - if (tGunpowder < 65) - coll.derive().setInputs(input, ItemList.Block_Powderbarrel.get(tGunpowder)); - if (tDynamite < 17) - coll.derive().setInputs(input, GT_ModHandler.getIC2Item("dynamite", tDynamite, null)); - coll.derive().setInputs(input, new ItemStack(Blocks.tnt, tTNT)); - coll.derive().setInputs(input, GT_ModHandler.getIC2Item("industrialTnt", tITNT, null)); - return coll.getAll(); - }).setDisableOptimize(true) - .setProgressBar(GT_UITextures.PROGRESSBAR_COMPRESS, ProgressBar.Direction.RIGHT); + .setSlotOverlay(false, false, false, GT_UITextures.OVERLAY_SLOT_EXPLOSIVE) + .setRecipeConfigFile("implosion", FIRST_ITEM_INPUT) + .setRecipeEmitter(b -> { + switch (b.getItemInputsBasic().length) { + case 0: + return Collections.emptyList(); + case 1: + break; + default: + return b.build() + .map(Collections::singletonList) + .orElse(Collections.emptyList()); + } + Optional<GT_Recipe> t = b.noOptimize() + .duration(20) + .eut(30) + .validateInputCount(1, 1) + .validateOutputCount(1, 1) + .build(); + if (!t.isPresent()) return Collections.emptyList(); + ItemStack input = b.getItemInputBasic(0); + GT_RecipeTemplate coll = asTemplate(t.get()); + int tExplosives = Math.min(b.getMetadata(ADDITIVE_AMOUNT), 64); + int tGunpowder = tExplosives << 1; // Worst + int tDynamite = Math.max(1, tExplosives >> 1); // good + int tTNT = tExplosives; // Slightly better + int tITNT = Math.max(1, tExplosives >> 2); // the best + if (tGunpowder < 65) coll.derive() + .setInputs(input, ItemList.Block_Powderbarrel.get(tGunpowder)); + if (tDynamite < 17) coll.derive() + .setInputs( + input, + GT_ModHandler.getIC2Item("dynamite", tDynamite, null)); + coll.derive() + .setInputs(input, new ItemStack(Blocks.tnt, tTNT)); + coll.derive() + .setInputs(input, GT_ModHandler.getIC2Item("industrialTnt", tITNT, null)); + return coll.getAll(); + }) + .setDisableOptimize(true) + .setProgressBar(GT_UITextures.PROGRESSBAR_COMPRESS, ProgressBar.Direction.RIGHT); public static final GT_Recipe_Map sVacuumRecipes = new GT_Recipe_Map( new HashSet<>(305), "gt.recipe.vacuumfreezer", @@ -2244,21 +2310,28 @@ public class GT_Recipe implements Comparable<GT_Recipe> { E, false, true).setProgressBar(GT_UITextures.PROGRESSBAR_ARROW, ProgressBar.Direction.RIGHT) - .setRecipeConfigFile("vacuumfreezer", FIRST_ITEM_INPUT).setRecipeEmitter(b -> { - b.noOptimize(); - FluidStack in, out; - if (isArrayOfLength(b.getItemInputsBasic(), 1) && isArrayOfLength(b.getItemOutputs(), 1) - && isArrayEmptyOrNull(b.getFluidInputs()) - && isArrayEmptyOrNull(b.getFluidOutputs()) - && (in = GT_Utility.getFluidForFilledItem(b.getItemInputBasic(0), true)) != null - && (out = GT_Utility.getFluidForFilledItem(b.getItemOutput(0), true)) != null) { - return Arrays.asList( - b.build().get(), - b.fluidInputs(in).fluidOutputs(out).noItemInputs().noItemOutputs().build() - .get()); - } - return buildOrEmpty(b); - }).setUsualFluidInputCount(2); + .setRecipeConfigFile("vacuumfreezer", FIRST_ITEM_INPUT) + .setRecipeEmitter(b -> { + b.noOptimize(); + FluidStack in, out; + if (isArrayOfLength(b.getItemInputsBasic(), 1) && isArrayOfLength(b.getItemOutputs(), 1) + && isArrayEmptyOrNull(b.getFluidInputs()) + && isArrayEmptyOrNull(b.getFluidOutputs()) + && (in = GT_Utility.getFluidForFilledItem(b.getItemInputBasic(0), true)) != null + && (out = GT_Utility.getFluidForFilledItem(b.getItemOutput(0), true)) != null) { + return Arrays.asList( + b.build() + .get(), + b.fluidInputs(in) + .fluidOutputs(out) + .noItemInputs() + .noItemOutputs() + .build() + .get()); + } + return buildOrEmpty(b); + }) + .setUsualFluidInputCount(2); public static final GT_Recipe_Map sChemicalRecipes = new GT_Recipe_Map( new HashSet<>(1170), "gt.recipe.chemicalreactor", @@ -2275,23 +2348,37 @@ public class GT_Recipe implements Comparable<GT_Recipe> { E, true, true).setSlotOverlay(false, false, true, GT_UITextures.OVERLAY_SLOT_MOLECULAR_1) - .setSlotOverlay(false, false, false, GT_UITextures.OVERLAY_SLOT_MOLECULAR_2) - .setSlotOverlay(true, false, GT_UITextures.OVERLAY_SLOT_MOLECULAR_3) - .setSlotOverlay(false, true, GT_UITextures.OVERLAY_SLOT_VIAL_1) - .setSlotOverlay(true, true, GT_UITextures.OVERLAY_SLOT_VIAL_2) - .setRecipeConfigFile("chemicalreactor", FIRST_ITEM_OR_FLUID_OUTPUT) - .setProgressBar(GT_UITextures.PROGRESSBAR_ARROW_MULTIPLE, ProgressBar.Direction.RIGHT); - public static final GT_Recipe_Map sMultiblockChemicalRecipes = new GT_Recipe_Map_LargeChemicalReactor() - .setProgressBar(GT_UITextures.PROGRESSBAR_ARROW_MULTIPLE, ProgressBar.Direction.RIGHT) - .setUsualFluidInputCount(6).setUsualFluidOutputCount(6); - public static final GT_Recipe_Map sDistillationRecipes = new GT_Recipe_Map_DistillationTower() - .setRecipeConfigFile("distillation", FIRST_FLUIDSTACK_INPUT) - .setProgressBar(GT_UITextures.PROGRESSBAR_ARROW_MULTIPLE, ProgressBar.Direction.RIGHT) - .setUsualFluidOutputCount(11).setDisableOptimize(true); - public static final GT_Recipe_Map_OilCracker sCrackingRecipes = (GT_Recipe_Map_OilCracker) new GT_Recipe_Map_OilCracker() - .setRecipeConfigFile("cracking", FIRST_FLUIDSTACK_INPUT) - .setProgressBar(GT_UITextures.PROGRESSBAR_ARROW_MULTIPLE, ProgressBar.Direction.RIGHT) - .setUsualFluidInputCount(2); + .setSlotOverlay(false, false, false, GT_UITextures.OVERLAY_SLOT_MOLECULAR_2) + .setSlotOverlay(true, false, GT_UITextures.OVERLAY_SLOT_MOLECULAR_3) + .setSlotOverlay(false, true, GT_UITextures.OVERLAY_SLOT_VIAL_1) + .setSlotOverlay(true, true, GT_UITextures.OVERLAY_SLOT_VIAL_2) + .setRecipeConfigFile("chemicalreactor", FIRST_ITEM_OR_FLUID_OUTPUT) + .setProgressBar(GT_UITextures.PROGRESSBAR_ARROW_MULTIPLE, ProgressBar.Direction.RIGHT); + public static final GT_Recipe_Map sMultiblockChemicalRecipes = new GT_Recipe_Map_LargeChemicalReactor().setProgressBar( + GT_UITextures.PROGRESSBAR_ARROW_MULTIPLE, + ProgressBar.Direction.RIGHT) + .setUsualFluidInputCount( + 6) + .setUsualFluidOutputCount( + 6); + public static final GT_Recipe_Map sDistillationRecipes = new GT_Recipe_Map_DistillationTower().setRecipeConfigFile( + "distillation", + FIRST_FLUIDSTACK_INPUT) + .setProgressBar( + GT_UITextures.PROGRESSBAR_ARROW_MULTIPLE, + ProgressBar.Direction.RIGHT) + .setUsualFluidOutputCount( + 11) + .setDisableOptimize( + true); + public static final GT_Recipe_Map_OilCracker sCrackingRecipes = (GT_Recipe_Map_OilCracker) new GT_Recipe_Map_OilCracker().setRecipeConfigFile( + "cracking", + FIRST_FLUIDSTACK_INPUT) + .setProgressBar( + GT_UITextures.PROGRESSBAR_ARROW_MULTIPLE, + ProgressBar.Direction.RIGHT) + .setUsualFluidInputCount( + 2); /** * @deprecated Use sCrackingRecipes instead */ @@ -2314,7 +2401,8 @@ public class GT_Recipe implements Comparable<GT_Recipe> { E, true, true).setProgressBar(GT_UITextures.PROGRESSBAR_ARROW, ProgressBar.Direction.RIGHT) - .setDisableOptimize(true).setRecipeConfigFile("pyrolyse", FIRST_ITEM_INPUT); + .setDisableOptimize(true) + .setRecipeConfigFile("pyrolyse", FIRST_ITEM_INPUT); public static final GT_Recipe_Map sWiremillRecipes = new GT_Recipe_Map( new HashSet<>(450), "gt.recipe.wiremill", @@ -2331,8 +2419,8 @@ public class GT_Recipe implements Comparable<GT_Recipe> { E, true, true).setSlotOverlay(false, false, GT_UITextures.OVERLAY_SLOT_WIREMILL) - .setRecipeConfigFile("wiremill", FIRST_ITEM_INPUT) - .setProgressBar(GT_UITextures.PROGRESSBAR_WIREMILL, ProgressBar.Direction.RIGHT); + .setRecipeConfigFile("wiremill", FIRST_ITEM_INPUT) + .setProgressBar(GT_UITextures.PROGRESSBAR_WIREMILL, ProgressBar.Direction.RIGHT); public static final GT_Recipe_Map sBenderRecipes = new GT_Recipe_Map( new HashSet<>(5000), "gt.recipe.metalbender", @@ -2349,8 +2437,8 @@ public class GT_Recipe implements Comparable<GT_Recipe> { E, true, true).setSlotOverlay(false, false, GT_UITextures.OVERLAY_SLOT_BENDER) - .setRecipeConfigFile("bender", FIRST_ITEM_INPUT) - .setProgressBar(GT_UITextures.PROGRESSBAR_BENDING, ProgressBar.Direction.RIGHT); + .setRecipeConfigFile("bender", FIRST_ITEM_INPUT) + .setProgressBar(GT_UITextures.PROGRESSBAR_BENDING, ProgressBar.Direction.RIGHT); public static final GT_Recipe_Map sAlloySmelterRecipes = new GT_Recipe_Map( new HashSet<>(12000), "gt.recipe.alloysmelter", @@ -2366,24 +2454,28 @@ public class GT_Recipe implements Comparable<GT_Recipe> { 1, E, true, - true).setSlotOverlay(false, false, GT_UITextures.OVERLAY_SLOT_FURNACE).setRecipeEmitter(b -> { - if (Materials.Graphite.contains(b.getItemInputBasic(0))) return Collections.emptyList(); - if (GT_Utility.isArrayOfLength(b.getItemInputsBasic(), 1)) { - ItemStack aInput1 = b.getItemInputBasic(0); - if (((OrePrefixes.ingot.contains(aInput1)) || (OrePrefixes.dust.contains(aInput1)) - || (OrePrefixes.gem.contains(aInput1)))) - return Collections.emptyList(); - } - return buildOrEmpty( - b.validateNoInputFluid().validateNoOutputFluid().validateInputCount(1, 2) - .validateOutputCount(1, 1)); - }).setRecipeConfigFile( - "alloysmelting", - r -> GT_Config.getStackConfigName( - GT_Utility.isArrayOfLength(r.mInputs, 1) ? r.mInputs[0] : r.mOutputs[0])) - .setProgressBar(GT_UITextures.PROGRESSBAR_ARROW, ProgressBar.Direction.RIGHT) - .setSlotOverlaySteam(false, GT_UITextures.OVERLAY_SLOT_FURNACE_STEAM) - .setProgressBarSteam(GT_UITextures.PROGRESSBAR_ARROW_STEAM); + true).setSlotOverlay(false, false, GT_UITextures.OVERLAY_SLOT_FURNACE) + .setRecipeEmitter(b -> { + if (Materials.Graphite.contains(b.getItemInputBasic(0))) return Collections.emptyList(); + if (GT_Utility.isArrayOfLength(b.getItemInputsBasic(), 1)) { + ItemStack aInput1 = b.getItemInputBasic(0); + if (((OrePrefixes.ingot.contains(aInput1)) || (OrePrefixes.dust.contains(aInput1)) + || (OrePrefixes.gem.contains(aInput1)))) + return Collections.emptyList(); + } + return buildOrEmpty( + b.validateNoInputFluid() + .validateNoOutputFluid() + .validateInputCount(1, 2) + .validateOutputCount(1, 1)); + }) + .setRecipeConfigFile( + "alloysmelting", + r -> GT_Config.getStackConfigName( + GT_Utility.isArrayOfLength(r.mInputs, 1) ? r.mInputs[0] : r.mOutputs[0])) + .setProgressBar(GT_UITextures.PROGRESSBAR_ARROW, ProgressBar.Direction.RIGHT) + .setSlotOverlaySteam(false, GT_UITextures.OVERLAY_SLOT_FURNACE_STEAM) + .setProgressBarSteam(GT_UITextures.PROGRESSBAR_ARROW_STEAM); public static final GT_Recipe_Map sAssemblerRecipes = new GT_Recipe_Map_Assembler( new HashSet<>(8200), "gt.recipe.assembler", @@ -2400,8 +2492,8 @@ public class GT_Recipe implements Comparable<GT_Recipe> { E, true, true).setSlotOverlay(false, false, GT_UITextures.OVERLAY_SLOT_CIRCUIT) - .setRecipeConfigFile("assembling", FIRST_ITEM_OUTPUT) - .setProgressBar(GT_UITextures.PROGRESSBAR_ASSEMBLE, ProgressBar.Direction.RIGHT); + .setRecipeConfigFile("assembling", FIRST_ITEM_OUTPUT) + .setProgressBar(GT_UITextures.PROGRESSBAR_ASSEMBLE, ProgressBar.Direction.RIGHT); public static final GT_Recipe_Map sCircuitAssemblerRecipes = new GT_Recipe_Map_Assembler( new HashSet<>(605), "gt.recipe.circuitassembler", @@ -2418,9 +2510,9 @@ public class GT_Recipe implements Comparable<GT_Recipe> { E, true, true).setNEIUnificateOutput(!NEICustomDiagrams.isModLoaded()) - .setRecipeConfigFile("circuitassembler", FIRST_ITEM_OUTPUT) - .setSlotOverlay(false, false, GT_UITextures.OVERLAY_SLOT_CIRCUIT) - .setProgressBar(GT_UITextures.PROGRESSBAR_CIRCUIT_ASSEMBLER, ProgressBar.Direction.RIGHT); + .setRecipeConfigFile("circuitassembler", FIRST_ITEM_OUTPUT) + .setSlotOverlay(false, false, GT_UITextures.OVERLAY_SLOT_CIRCUIT) + .setProgressBar(GT_UITextures.PROGRESSBAR_CIRCUIT_ASSEMBLER, ProgressBar.Direction.RIGHT); public static final GT_Recipe_Map sCannerRecipes = new GT_Recipe_Map( new HashSet<>(900), "gt.recipe.canner", @@ -2437,9 +2529,9 @@ public class GT_Recipe implements Comparable<GT_Recipe> { E, true, true).setSlotOverlay(false, false, true, GT_UITextures.OVERLAY_SLOT_CANNER) - .setRecipeConfigFile("canning", FIRST_ITEM_INPUT) - .setSlotOverlay(false, false, false, GT_UITextures.OVERLAY_SLOT_CANISTER) - .setProgressBar(GT_UITextures.PROGRESSBAR_CANNER, ProgressBar.Direction.RIGHT); + .setRecipeConfigFile("canning", FIRST_ITEM_INPUT) + .setSlotOverlay(false, false, false, GT_UITextures.OVERLAY_SLOT_CANISTER) + .setProgressBar(GT_UITextures.PROGRESSBAR_CANNER, ProgressBar.Direction.RIGHT); @Deprecated public static final GT_Recipe_Map sCNCRecipes = new GT_Recipe_Map( new HashSet<>(100), @@ -2473,11 +2565,11 @@ public class GT_Recipe implements Comparable<GT_Recipe> { E, true, true).setSlotOverlay(false, false, GT_UITextures.OVERLAY_SLOT_ROD_1) - .setSlotOverlay(false, true, true, GT_UITextures.OVERLAY_SLOT_ROD_2) - .setSlotOverlay(false, true, false, GT_UITextures.OVERLAY_SLOT_DUST) - .setRecipeConfigFile("lathe", FIRST_ITEM_INPUT) - .setProgressBar(GT_UITextures.PROGRESSBAR_LATHE, ProgressBar.Direction.RIGHT) - .addSpecialTexture(5, 18, 98, 24, GT_UITextures.PROGRESSBAR_LATHE_BASE); + .setSlotOverlay(false, true, true, GT_UITextures.OVERLAY_SLOT_ROD_2) + .setSlotOverlay(false, true, false, GT_UITextures.OVERLAY_SLOT_DUST) + .setRecipeConfigFile("lathe", FIRST_ITEM_INPUT) + .setProgressBar(GT_UITextures.PROGRESSBAR_LATHE, ProgressBar.Direction.RIGHT) + .addSpecialTexture(5, 18, 98, 24, GT_UITextures.PROGRESSBAR_LATHE_BASE); public static final GT_Recipe_Map sCutterRecipes = new GT_Recipe_Map( new HashSet<>(5125), "gt.recipe.cuttingsaw", @@ -2494,25 +2586,35 @@ public class GT_Recipe implements Comparable<GT_Recipe> { E, true, true).setSlotOverlay(false, false, GT_UITextures.OVERLAY_SLOT_BOX) - .setSlotOverlay(false, true, true, GT_UITextures.OVERLAY_SLOT_CUTTER_SLICED) - .setSlotOverlay(false, true, false, GT_UITextures.OVERLAY_SLOT_DUST).setRecipeEmitter(b -> { - b.validateInputCount(1, 2).validateOutputCount(1, 4).validateNoOutputFluid(); - if (b.getFluidInputs() != null || !b.isValid()) - return buildOrEmpty(b.validateInputFluidCount(1, 1)); - int aDuration = b.getDuration(), aEUt = b.getEUt(); - Collection<GT_Recipe> ret = new ArrayList<>(); - b.copy().fluidInputs( - Materials.Water.getFluid(GT_Utility.clamp(aDuration * aEUt / 320, 4, 1000))) - .duration(aDuration * 2).build().ifPresent(ret::add); - b.copy().fluidInputs( - GT_ModHandler.getDistilledWater(GT_Utility.clamp(aDuration * aEUt / 426, 3, 750))) - .duration(aDuration * 2).build().ifPresent(ret::add); - b.fluidInputs( - Materials.Lubricant.getFluid(GT_Utility.clamp(aDuration * aEUt / 1280, 1, 250))) - .duration(aDuration).build().ifPresent(ret::add); - return ret; - }).setRecipeConfigFile("cutting", FIRST_ITEM_INPUT) - .setProgressBar(GT_UITextures.PROGRESSBAR_CUT, ProgressBar.Direction.RIGHT); + .setSlotOverlay(false, true, true, GT_UITextures.OVERLAY_SLOT_CUTTER_SLICED) + .setSlotOverlay(false, true, false, GT_UITextures.OVERLAY_SLOT_DUST) + .setRecipeEmitter(b -> { + b.validateInputCount(1, 2) + .validateOutputCount(1, 4) + .validateNoOutputFluid(); + if (b.getFluidInputs() != null || !b.isValid()) + return buildOrEmpty(b.validateInputFluidCount(1, 1)); + int aDuration = b.getDuration(), aEUt = b.getEUt(); + Collection<GT_Recipe> ret = new ArrayList<>(); + b.copy() + .fluidInputs(Materials.Water.getFluid(GT_Utility.clamp(aDuration * aEUt / 320, 4, 1000))) + .duration(aDuration * 2) + .build() + .ifPresent(ret::add); + b.copy() + .fluidInputs( + GT_ModHandler.getDistilledWater(GT_Utility.clamp(aDuration * aEUt / 426, 3, 750))) + .duration(aDuration * 2) + .build() + .ifPresent(ret::add); + b.fluidInputs(Materials.Lubricant.getFluid(GT_Utility.clamp(aDuration * aEUt / 1280, 1, 250))) + .duration(aDuration) + .build() + .ifPresent(ret::add); + return ret; + }) + .setRecipeConfigFile("cutting", FIRST_ITEM_INPUT) + .setProgressBar(GT_UITextures.PROGRESSBAR_CUT, ProgressBar.Direction.RIGHT); public static final GT_Recipe_Map sSlicerRecipes = new GT_Recipe_Map( new HashSet<>(20), "gt.recipe.slicer", @@ -2529,10 +2631,10 @@ public class GT_Recipe implements Comparable<GT_Recipe> { E, true, true).setSlotOverlay(false, false, true, GT_UITextures.OVERLAY_SLOT_SQUARE) - .setSlotOverlay(false, false, false, GT_UITextures.OVERLAY_SLOT_SLICE_SHAPE) - .setSlotOverlay(false, true, GT_UITextures.OVERLAY_SLOT_SLICER_SLICED) - .setRecipeConfigFile("slicer", FIRST_ITEM_OUTPUT) - .setProgressBar(GT_UITextures.PROGRESSBAR_SLICE, ProgressBar.Direction.RIGHT); + .setSlotOverlay(false, false, false, GT_UITextures.OVERLAY_SLOT_SLICE_SHAPE) + .setSlotOverlay(false, true, GT_UITextures.OVERLAY_SLOT_SLICER_SLICED) + .setRecipeConfigFile("slicer", FIRST_ITEM_OUTPUT) + .setProgressBar(GT_UITextures.PROGRESSBAR_SLICE, ProgressBar.Direction.RIGHT); public static final GT_Recipe_Map sExtruderRecipes = new GT_Recipe_Map( new HashSet<>(13000), "gt.recipe.extruder", @@ -2549,8 +2651,8 @@ public class GT_Recipe implements Comparable<GT_Recipe> { E, true, true).setSlotOverlay(false, false, false, GT_UITextures.OVERLAY_SLOT_EXTRUDER_SHAPE) - .setRecipeConfigFile("extruder", FIRST_ITEM_OUTPUT) - .setProgressBar(GT_UITextures.PROGRESSBAR_EXTRUDE, ProgressBar.Direction.RIGHT); + .setRecipeConfigFile("extruder", FIRST_ITEM_OUTPUT) + .setProgressBar(GT_UITextures.PROGRESSBAR_EXTRUDE, ProgressBar.Direction.RIGHT); public static final GT_Recipe_Map sHammerRecipes = new GT_Recipe_Map( new HashSet<>(3800), @@ -2567,14 +2669,15 @@ public class GT_Recipe implements Comparable<GT_Recipe> { 1, E, true, - true).setUsualFluidInputCount(2).setUsualFluidOutputCount(2) - .setSlotOverlay(false, false, GT_UITextures.OVERLAY_SLOT_HAMMER) - .setRecipeConfigFile("forgehammer", FIRST_ITEM_OUTPUT) - .setProgressBar(GT_UITextures.PROGRESSBAR_HAMMER, ProgressBar.Direction.DOWN) - .addSpecialTexture(20, 6, 78, 42, GT_UITextures.PROGRESSBAR_HAMMER_BASE) - .setSlotOverlaySteam(false, GT_UITextures.OVERLAY_SLOT_HAMMER_STEAM) - .setProgressBarSteam(GT_UITextures.PROGRESSBAR_HAMMER_STEAM) - .addSpecialTextureSteam(20, 6, 78, 42, GT_UITextures.PROGRESSBAR_HAMMER_BASE_STEAM); + true).setUsualFluidInputCount(2) + .setUsualFluidOutputCount(2) + .setSlotOverlay(false, false, GT_UITextures.OVERLAY_SLOT_HAMMER) + .setRecipeConfigFile("forgehammer", FIRST_ITEM_OUTPUT) + .setProgressBar(GT_UITextures.PROGRESSBAR_HAMMER, ProgressBar.Direction.DOWN) + .addSpecialTexture(20, 6, 78, 42, GT_UITextures.PROGRESSBAR_HAMMER_BASE) + .setSlotOverlaySteam(false, GT_UITextures.OVERLAY_SLOT_HAMMER_STEAM) + .setProgressBarSteam(GT_UITextures.PROGRESSBAR_HAMMER_STEAM) + .addSpecialTextureSteam(20, 6, 78, 42, GT_UITextures.PROGRESSBAR_HAMMER_BASE_STEAM); public static final GT_Recipe_Map sAmplifiers = new GT_Recipe_Map( new HashSet<>(2), "gt.recipe.uuamplifier", @@ -2591,9 +2694,9 @@ public class GT_Recipe implements Comparable<GT_Recipe> { E, true, true).setSlotOverlay(false, false, GT_UITextures.OVERLAY_SLOT_CENTRIFUGE) - .setSlotOverlay(true, true, GT_UITextures.OVERLAY_SLOT_UUA) - .setRecipeConfigFile("amplifier", FIRST_ITEM_INPUT) - .setProgressBar(GT_UITextures.PROGRESSBAR_EXTRACT, ProgressBar.Direction.RIGHT); + .setSlotOverlay(true, true, GT_UITextures.OVERLAY_SLOT_UUA) + .setRecipeConfigFile("amplifier", FIRST_ITEM_INPUT) + .setProgressBar(GT_UITextures.PROGRESSBAR_EXTRACT, ProgressBar.Direction.RIGHT); public static final GT_Recipe_Map sMassFabFakeRecipes = new GT_Recipe_Map( new HashSet<>(2), "gt.recipe.massfab", @@ -2610,8 +2713,8 @@ public class GT_Recipe implements Comparable<GT_Recipe> { E, true, true).setSlotOverlay(true, false, GT_UITextures.OVERLAY_SLOT_UUA) - .setSlotOverlay(true, true, GT_UITextures.OVERLAY_SLOT_UUM) - .setProgressBar(GT_UITextures.PROGRESSBAR_ARROW, ProgressBar.Direction.RIGHT); + .setSlotOverlay(true, true, GT_UITextures.OVERLAY_SLOT_UUM) + .setProgressBar(GT_UITextures.PROGRESSBAR_ARROW, ProgressBar.Direction.RIGHT); public static final GT_Recipe_Map_Fuel sDieselFuels = (GT_Recipe_Map_Fuel) new GT_Recipe_Map_Fuel( new HashSet<>(20), "gt.recipe.dieselgeneratorfuel", @@ -2852,7 +2955,8 @@ public class GT_Recipe implements Comparable<GT_Recipe> { 0, "", true, - false).setRecipeEmitter(GT_RecipeMapUtil::buildRecipeForMultiblock).setDisableOptimize(true); + false).setRecipeEmitter(GT_RecipeMapUtil::buildRecipeForMultiblock) + .setDisableOptimize(true); public static final GT_Recipe_Map sMultiblockMixerRecipes = new GT_Recipe_Map( new HashSet<>(900), "gt.recipe.largemixer", @@ -2868,9 +2972,13 @@ public class GT_Recipe implements Comparable<GT_Recipe> { 0, "", true, - false).setRecipeEmitter(GT_RecipeMapUtil::buildRecipeForMultiblock).setDisableOptimize(true); - public static final GT_Recipe_Map_LargeBoilerFakeFuels sLargeBoilerFakeFuels = (GT_Recipe_Map_LargeBoilerFakeFuels) new GT_Recipe_Map_LargeBoilerFakeFuels() - .setProgressBar(GT_UITextures.PROGRESSBAR_ARROW, ProgressBar.Direction.RIGHT).setDisableOptimize(true); + false).setRecipeEmitter(GT_RecipeMapUtil::buildRecipeForMultiblock) + .setDisableOptimize(true); + public static final GT_Recipe_Map_LargeBoilerFakeFuels sLargeBoilerFakeFuels = (GT_Recipe_Map_LargeBoilerFakeFuels) new GT_Recipe_Map_LargeBoilerFakeFuels().setProgressBar( + GT_UITextures.PROGRESSBAR_ARROW, + ProgressBar.Direction.RIGHT) + .setDisableOptimize( + true); public static final GT_Recipe_Map sNanoForge = new GT_Recipe_Map( new HashSet<>(10), @@ -2887,9 +2995,11 @@ public class GT_Recipe implements Comparable<GT_Recipe> { 1, "", false, - true).useModularUI(true).setUsualFluidInputCount(3).setDisableOptimize(true) - .setSlotOverlay(false, false, true, GT_UITextures.OVERLAY_SLOT_LENS) - .setProgressBar(GT_UITextures.PROGRESSBAR_ASSEMBLE, ProgressBar.Direction.RIGHT); + true).useModularUI(true) + .setUsualFluidInputCount(3) + .setDisableOptimize(true) + .setSlotOverlay(false, false, true, GT_UITextures.OVERLAY_SLOT_LENS) + .setProgressBar(GT_UITextures.PROGRESSBAR_ASSEMBLE, ProgressBar.Direction.RIGHT); public static final GT_Recipe_Map sPCBFactory = new GT_Recipe_Map( new HashSet<>(10), @@ -2906,27 +3016,29 @@ public class GT_Recipe implements Comparable<GT_Recipe> { 0, E, true, - true).useModularUI(true).setUsualFluidInputCount(3).setUsualFluidOutputCount(0).setDisableOptimize(true) - .setProgressBar(GT_UITextures.PROGRESSBAR_ASSEMBLE, ProgressBar.Direction.RIGHT) - .setNEISpecialInfoFormatter((recipeInfo, applyPrefixAndSuffix) -> { - List<String> result = new ArrayList<>(); - int bitmap = recipeInfo.recipe.mSpecialValue; - if ((bitmap & 0b1) > 0) { - result.add(GT_Utility.trans("336", "PCB Factory Tier: ") + 1); - } else if ((bitmap & 0b10) > 0) { - result.add(GT_Utility.trans("336", "PCB Factory Tier: ") + 2); - } else if ((bitmap & 0b100) > 0) { - result.add(GT_Utility.trans("336", "PCB Factory Tier: ") + 3); - } - if ((bitmap & 0b1000) > 0) { - result.add( - GT_Utility.trans("337", "Upgrade Required: ") + GT_Utility.trans("338", "Bio")); - } - return result; - }); - - public static final GT_Recipe_Map_IC2NuclearFake sIC2NuclearFakeRecipe = (GT_Recipe_Map_IC2NuclearFake) new GT_Recipe_Map_IC2NuclearFake() - .setDisableOptimize(true); + true).useModularUI(true) + .setUsualFluidInputCount(3) + .setUsualFluidOutputCount(0) + .setDisableOptimize(true) + .setProgressBar(GT_UITextures.PROGRESSBAR_ASSEMBLE, ProgressBar.Direction.RIGHT) + .setNEISpecialInfoFormatter((recipeInfo, applyPrefixAndSuffix) -> { + List<String> result = new ArrayList<>(); + int bitmap = recipeInfo.recipe.mSpecialValue; + if ((bitmap & 0b1) > 0) { + result.add(GT_Utility.trans("336", "PCB Factory Tier: ") + 1); + } else if ((bitmap & 0b10) > 0) { + result.add(GT_Utility.trans("336", "PCB Factory Tier: ") + 2); + } else if ((bitmap & 0b100) > 0) { + result.add(GT_Utility.trans("336", "PCB Factory Tier: ") + 3); + } + if ((bitmap & 0b1000) > 0) { + result.add(GT_Utility.trans("337", "Upgrade Required: ") + GT_Utility.trans("338", "Bio")); + } + return result; + }); + + public static final GT_Recipe_Map_IC2NuclearFake sIC2NuclearFakeRecipe = (GT_Recipe_Map_IC2NuclearFake) new GT_Recipe_Map_IC2NuclearFake().setDisableOptimize( + true); static { sCentrifugeRecipes.addDownstream(sMultiblockCentrifugeRecipes.deepCopyInput()); @@ -2934,12 +3046,16 @@ public class GT_Recipe implements Comparable<GT_Recipe> { sElectrolyzerRecipes.addDownstream(sMultiblockElectrolyzerRecipes.deepCopyInput()); sDieselFuels.addDownstream( IGT_RecipeMap.newRecipeMap( - b -> b.build().map(sLargeBoilerFakeFuels::addDieselRecipe).map(Collections::singletonList) - .orElse(Collections.emptyList()))); + b -> b.build() + .map(sLargeBoilerFakeFuels::addDieselRecipe) + .map(Collections::singletonList) + .orElse(Collections.emptyList()))); sDenseLiquidFuels.addDownstream( IGT_RecipeMap.newRecipeMap( - b -> b.build().map(sLargeBoilerFakeFuels::addDenseLiquidRecipe) - .map(Collections::singletonList).orElse(Collections.emptyList()))); + b -> b.build() + .map(sLargeBoilerFakeFuels::addDenseLiquidRecipe) + .map(Collections::singletonList) + .orElse(Collections.emptyList()))); } /** @@ -3216,8 +3332,11 @@ public class GT_Recipe implements Comparable<GT_Recipe> { } public GT_Recipe_Map setSlotOverlay(boolean isFluid, boolean isOutput, IDrawable slotOverlay) { - return setSlotOverlay(isFluid, isOutput, true, slotOverlay) - .setSlotOverlay(isFluid, isOutput, false, slotOverlay); + return setSlotOverlay(isFluid, isOutput, true, slotOverlay).setSlotOverlay( + isFluid, + isOutput, + false, + slotOverlay); } public GT_Recipe_Map setSlotOverlaySteam(boolean isFluid, boolean isOutput, boolean isFirst, boolean isSpecial, @@ -3234,8 +3353,12 @@ public class GT_Recipe implements Comparable<GT_Recipe> { } public GT_Recipe_Map setSlotOverlaySteam(boolean isOutput, SteamTexture slotOverlay) { - return setSlotOverlaySteam(false, isOutput, true, false, slotOverlay) - .setSlotOverlaySteam(false, isOutput, false, false, slotOverlay); + return setSlotOverlaySteam(false, isOutput, true, false, slotOverlay).setSlotOverlaySteam( + false, + isOutput, + false, + false, + slotOverlay); } public GT_Recipe_Map setProgressBar(UITexture progressBarTexture, ProgressBar.Direction progressBarDirection) { @@ -3300,15 +3423,15 @@ public class GT_Recipe implements Comparable<GT_Recipe> { public GT_Recipe_Map addSpecialTexture(int width, int height, int x, int y, IDrawable texture) { useModularUI(true); - specialTextures - .add(new ImmutablePair<>(texture, new ImmutablePair<>(new Size(width, height), new Pos2d(x, y)))); + specialTextures.add( + new ImmutablePair<>(texture, new ImmutablePair<>(new Size(width, height), new Pos2d(x, y)))); return this; } public GT_Recipe_Map addSpecialTextureSteam(int width, int height, int x, int y, SteamTexture texture) { useModularUI(true); - specialTexturesSteam - .add(new ImmutablePair<>(texture, new ImmutablePair<>(new Size(width, height), new Pos2d(x, y)))); + specialTexturesSteam.add( + new ImmutablePair<>(texture, new ImmutablePair<>(new Size(width, height), new Pos2d(x, y)))); return this; } @@ -3635,8 +3758,10 @@ public class GT_Recipe implements Comparable<GT_Recipe> { for (GT_Recipe r : recipes) { if (recipeConfigCategory != null) { String configKey = recipeConfigKeyConvertor.apply(r); - if (configKey != null && (r.mDuration = GregTech_API.sRecipeFile - .get(recipeConfigCategory, configKey, r.mDuration)) <= 0) { + if (configKey != null && (r.mDuration = GregTech_API.sRecipeFile.get( + recipeConfigCategory, + configKey, + r.mDuration)) <= 0) { continue; } } @@ -3672,8 +3797,9 @@ public class GT_Recipe implements Comparable<GT_Recipe> { public final Iterable<? extends GT_Recipe> defaultBuildRecipe(GT_RecipeBuilder builder) { // TODO sensible validation - if (!downstreams.isEmpty() && disableOptimize && !builder.optimize) - return buildOrEmpty(builder.copy().noOptimize()); + if (!downstreams.isEmpty() && disableOptimize && !builder.optimize) return buildOrEmpty( + builder.copy() + .noOptimize()); return buildOrEmpty(builder); } @@ -3681,10 +3807,13 @@ public class GT_Recipe implements Comparable<GT_Recipe> { mRecipeList.add(aRecipe); for (FluidStack aFluid : aRecipe.mFluidInputs) { if (aFluid != null) { - Collection<GT_Recipe> tList = mRecipeFluidMap - .computeIfAbsent(aFluid.getFluid(), k -> new HashSet<>(1)); + Collection<GT_Recipe> tList = mRecipeFluidMap.computeIfAbsent( + aFluid.getFluid(), + k -> new HashSet<>(1)); tList.add(aRecipe); - mRecipeFluidNameMap.add(aFluid.getFluid().getName()); + mRecipeFluidNameMap.add( + aFluid.getFluid() + .getName()); } } if (aRecipe.mFluidOutputs.length != 0) { @@ -3947,26 +4076,36 @@ public class GT_Recipe implements Comparable<GT_Recipe> { IItemHandlerModifiable fluidInputsInventory, IItemHandlerModifiable fluidOutputsInventory, Supplier<Float> progressSupplier, Pos2d windowOffset) { ModularWindow.Builder builder = ModularWindow.builder(neiBackgroundSize) - .setBackground(ModularUITextures.VANILLA_BACKGROUND); + .setBackground(ModularUITextures.VANILLA_BACKGROUND); UIHelper.forEachSlots( (i, backgrounds, pos) -> builder.widget( - SlotWidget.phantom(itemInputsInventory, i).setBackground(backgrounds).setPos(pos) - .setSize(18, 18)), + SlotWidget.phantom(itemInputsInventory, i) + .setBackground(backgrounds) + .setPos(pos) + .setSize(18, 18)), (i, backgrounds, pos) -> builder.widget( - SlotWidget.phantom(itemOutputsInventory, i).setBackground(backgrounds).setPos(pos) - .setSize(18, 18)), + SlotWidget.phantom(itemOutputsInventory, i) + .setBackground(backgrounds) + .setPos(pos) + .setSize(18, 18)), (i, backgrounds, pos) -> { if (usesSpecialSlot()) builder.widget( - SlotWidget.phantom(specialSlotInventory, 0).setBackground(backgrounds).setPos(pos) - .setSize(18, 18)); + SlotWidget.phantom(specialSlotInventory, 0) + .setBackground(backgrounds) + .setPos(pos) + .setSize(18, 18)); }, (i, backgrounds, pos) -> builder.widget( - SlotWidget.phantom(fluidInputsInventory, i).setBackground(backgrounds).setPos(pos) - .setSize(18, 18)), + SlotWidget.phantom(fluidInputsInventory, i) + .setBackground(backgrounds) + .setPos(pos) + .setSize(18, 18)), (i, backgrounds, pos) -> builder.widget( - SlotWidget.phantom(fluidOutputsInventory, i).setBackground(backgrounds).setPos(pos) - .setSize(18, 18)), + SlotWidget.phantom(fluidOutputsInventory, i) + .setBackground(backgrounds) + .setPos(pos) + .setSize(18, 18)), ModularUITextures.ITEM_SLOT, ModularUITextures.FLUID_SLOT, this, @@ -3983,8 +4122,13 @@ public class GT_Recipe implements Comparable<GT_Recipe> { for (Pair<IDrawable, Pair<Size, Pos2d>> specialTexture : specialTextures) { builder.widget( new DrawableWidget().setDrawable(specialTexture.getLeft()) - .setSize(specialTexture.getRight().getLeft()) - .setPos(specialTexture.getRight().getRight().add(windowOffset))); + .setSize( + specialTexture.getRight() + .getLeft()) + .setPos( + specialTexture.getRight() + .getRight() + .add(windowOffset))); } return builder; @@ -3993,18 +4137,27 @@ public class GT_Recipe implements Comparable<GT_Recipe> { public void addProgressBarUI(ModularWindow.Builder builder, Supplier<Float> progressSupplier, Pos2d windowOffset) { builder.widget( - new ProgressBar().setTexture(getProgressBarTexture(), 20).setDirection(progressBarDirection) - .setProgress(progressSupplier).setSynced(false, false) - .setPos(progressBarPos.add(windowOffset)).setSize(progressBarSize)); + new ProgressBar().setTexture(getProgressBarTexture(), 20) + .setDirection(progressBarDirection) + .setProgress(progressSupplier) + .setSynced(false, false) + .setPos(progressBarPos.add(windowOffset)) + .setSize(progressBarSize)); } public void addGregTechLogoUI(ModularWindow.Builder builder, Pos2d windowOffset) { - builder.widget(new DrawableWidget().setDrawable(logo).setSize(logoSize).setPos(logoPos.add(windowOffset))); + builder.widget( + new DrawableWidget().setDrawable(logo) + .setSize(logoSize) + .setPos(logoPos.add(windowOffset))); } public void addRecipeSpecificDrawable(ModularWindow.Builder builder, Pos2d windowOffset, Supplier<IDrawable> supplier, Pos2d pos, Size size) { - builder.widget(new DrawableWidget().setDrawable(supplier).setSize(size).setPos(pos.add(windowOffset))); + builder.widget( + new DrawableWidget().setDrawable(supplier) + .setSize(size) + .setPos(pos.add(windowOffset))); } /** @@ -4145,18 +4298,21 @@ public class GT_Recipe implements Comparable<GT_Recipe> { drawNEIText( recipeInfo, EnumChatFormatting.ITALIC + GT_Utility.trans("273", "Original Recipe by: ") - + recipe.owners.get(0).getName()); + + recipe.owners.get(0) + .getName()); for (int i = 1; i < recipe.owners.size(); i++) { drawNEIText( recipeInfo, EnumChatFormatting.ITALIC + GT_Utility.trans("274", "Modified by: ") - + recipe.owners.get(i).getName()); + + recipe.owners.get(i) + .getName()); } } else if (recipe.owners.size() > 0) { drawNEIText( recipeInfo, EnumChatFormatting.ITALIC + GT_Utility.trans("272", "Recipe by: ") - + recipe.owners.get(0).getName()); + + recipe.owners.get(0) + .getName()); } } if (GT_Mod.gregtechproxy.mNEIRecipeOwnerStackTrace && recipe.stackTraces != null @@ -5092,20 +5248,18 @@ public class GT_Recipe implements Comparable<GT_Recipe> { null, null, null); - return GT_Utility.arrayContainsNonNull(tOutputItems) - ? new GT_Recipe( - false, - new ItemStack[] { GT_Utility - .copyAmount(aInputs[0].stackSize - tComparedInput.stackSize, aInputs[0]) }, - tOutputItems, - null, - null, - null, - null, - 400, - 2, - 0) - : null; + return GT_Utility.arrayContainsNonNull(tOutputItems) ? new GT_Recipe( + false, + new ItemStack[] { + GT_Utility.copyAmount(aInputs[0].stackSize - tComparedInput.stackSize, aInputs[0]) }, + tOutputItems, + null, + null, + null, + null, + 400, + 2, + 0) : null; } @Override @@ -5164,20 +5318,18 @@ public class GT_Recipe implements Comparable<GT_Recipe> { null, null, null); - return GT_Utility.arrayContainsNonNull(tOutputItems) - ? new GT_Recipe( - false, - new ItemStack[] { GT_Utility - .copyAmount(aInputs[0].stackSize - tComparedInput.stackSize, aInputs[0]) }, - tOutputItems, - null, - null, - null, - null, - 400, - 2, - 0) - : null; + return GT_Utility.arrayContainsNonNull(tOutputItems) ? new GT_Recipe( + false, + new ItemStack[] { + GT_Utility.copyAmount(aInputs[0].stackSize - tComparedInput.stackSize, aInputs[0]) }, + tOutputItems, + null, + null, + null, + null, + 400, + 2, + 0) : null; } @Override @@ -5236,20 +5388,18 @@ public class GT_Recipe implements Comparable<GT_Recipe> { null, null, null); - return GT_Utility.arrayContainsNonNull(tOutputItems) - ? new GT_Recipe( - false, - new ItemStack[] { GT_Utility - .copyAmount(aInputs[0].stackSize - tComparedInput.stackSize, aInputs[0]) }, - tOutputItems, - null, - null, - null, - null, - 400, - 48, - 0) - : null; + return GT_Utility.arrayContainsNonNull(tOutputItems) ? new GT_Recipe( + false, + new ItemStack[] { + GT_Utility.copyAmount(aInputs[0].stackSize - tComparedInput.stackSize, aInputs[0]) }, + tOutputItems, + null, + null, + null, + null, + 400, + 48, + 0) : null; } @Override @@ -5314,22 +5464,20 @@ public class GT_Recipe implements Comparable<GT_Recipe> { null, null, null); - return GT_Utility.arrayContainsNonNull(tOutputItems) - ? new GT_Recipe( - false, - new ItemStack[] { GT_Utility - .copyAmount(aInputs[0].stackSize - tComparedInput.stackSize, aInputs[0]) }, - tOutputItems, - null, - null, - new FluidStack[] { new FluidStack( - aFluids[0].getFluid(), - ((NBTTagCompound) aRecipeMetaData.getTag("return")).getInteger("amount")) }, - null, - 400, - 16, - 0) - : null; + return GT_Utility.arrayContainsNonNull(tOutputItems) ? new GT_Recipe( + false, + new ItemStack[] { + GT_Utility.copyAmount(aInputs[0].stackSize - tComparedInput.stackSize, aInputs[0]) }, + tOutputItems, + null, + null, + new FluidStack[] { new FluidStack( + aFluids[0].getFluid(), + ((NBTTagCompound) aRecipeMetaData.getTag("return")).getInteger("amount")) }, + null, + 400, + 16, + 0) : null; } @Override @@ -5393,8 +5541,9 @@ public class GT_Recipe implements Comparable<GT_Recipe> { if (aRecipe != null) return aRecipe; try { - List<ItemStack> tRecipeOutputs = mods.railcraft.api.crafting.RailcraftCraftingManager.rockCrusher - .getRecipe(GT_Utility.copyAmount(1, aInputs[0])).getRandomizedOuputs(); + List<ItemStack> tRecipeOutputs = mods.railcraft.api.crafting.RailcraftCraftingManager.rockCrusher.getRecipe( + GT_Utility.copyAmount(1, aInputs[0])) + .getRandomizedOuputs(); if (tRecipeOutputs != null) { aRecipe = new GT_Recipe( false, @@ -5426,20 +5575,18 @@ public class GT_Recipe implements Comparable<GT_Recipe> { null, null, null); - return GT_Utility.arrayContainsNonNull(tOutputItems) - ? new GT_Recipe( - false, - new ItemStack[] { GT_Utility - .copyAmount(aInputs[0].stackSize - tComparedInput.stackSize, aInputs[0]) }, - tOutputItems, - null, - null, - null, - null, - 400, - 2, - 0) - : null; + return GT_Utility.arrayContainsNonNull(tOutputItems) ? new GT_Recipe( + false, + new ItemStack[] { + GT_Utility.copyAmount(aInputs[0].stackSize - tComparedInput.stackSize, aInputs[0]) }, + tOutputItems, + null, + null, + null, + null, + 400, + 2, + 0) : null; } @Override @@ -6031,7 +6178,9 @@ public class GT_Recipe implements Comparable<GT_Recipe> { FluidStack inputFluidContent = FluidContainerRegistry.getFluidForFilledItem(input); if (inputFluidContent != null) { inputFluidContent.amount *= input.stackSize; - if (inputFluidContent.getFluid().getName().equals("ic2steam")) { + if (inputFluidContent.getFluid() + .getName() + .equals("ic2steam")) { inputFluidContent = GT_ModHandler.getSteam(inputFluidContent.amount); } adjustedFluidInputs.add(inputFluidContent); @@ -6073,7 +6222,9 @@ public class GT_Recipe implements Comparable<GT_Recipe> { FluidStack outputFluidContent = FluidContainerRegistry.getFluidForFilledItem(output); if (outputFluidContent != null) { outputFluidContent.amount *= output.stackSize; - if (outputFluidContent.getFluid().getName().equals("ic2steam")) { + if (outputFluidContent.getFluid() + .getName() + .equals("ic2steam")) { outputFluidContent = GT_ModHandler.getSteam(outputFluidContent.amount); } adjustedFluidOutputs.add(outputFluidContent); @@ -6182,13 +6333,17 @@ public class GT_Recipe implements Comparable<GT_Recipe> { public GT_Recipe add(GT_Recipe aRecipe) { GT_Recipe ret = super.add(aRecipe); if (ret != null && ret.mFluidInputs != null && ret.mFluidInputs.length > 1 && ret.mFluidInputs[1] != null) { - mValidCatalystFluidNames.add(ret.mFluidInputs[1].getFluid().getName()); + mValidCatalystFluidNames.add( + ret.mFluidInputs[1].getFluid() + .getName()); } return ret; } public boolean isValidCatalystFluid(FluidStack aFluidStack) { - return mValidCatalystFluidNames.contains(aFluidStack.getFluid().getName()); + return mValidCatalystFluidNames.contains( + aFluidStack.getFluid() + .getName()); } } @@ -6282,9 +6437,12 @@ public class GT_Recipe implements Comparable<GT_Recipe> { Object aSpecial, FluidStack[] aFluidInputs, FluidStack[] aFluidOutputs, int aDuration, int aEUt, int aSpecialValue) { AtomicInteger ai = new AtomicInteger(); - Optional.ofNullable(GT_OreDictUnificator.getAssociation(aOutputs[0])).map(itemData -> itemData.mMaterial) - .map(materialsStack -> materialsStack.mMaterial).map(materials -> materials.mElement) - .map(Element::getMass).ifPresent(e -> { + Optional.ofNullable(GT_OreDictUnificator.getAssociation(aOutputs[0])) + .map(itemData -> itemData.mMaterial) + .map(materialsStack -> materialsStack.mMaterial) + .map(materials -> materials.mElement) + .map(Element::getMass) + .ifPresent(e -> { aFluidInputs[0].amount = (int) GT_MetaTileEntity_Replicator.cubicFluidMultiplier(e); ai.set(GT_Utility.safeInt(aFluidInputs[0].amount * 512L, 1)); }); @@ -6413,21 +6571,30 @@ public class GT_Recipe implements Comparable<GT_Recipe> { int bar2Width = 18; builder.widget( new ProgressBar().setTexture(GT_UITextures.PROGRESSBAR_ASSEMBLY_LINE_1, 17) - .setDirection(ProgressBar.Direction.RIGHT) - .setProgress(() -> progressSupplier.get() * ((float) (bar1Width + bar2Width) / bar1Width)) - .setSynced(false, false).setPos(new Pos2d(88, 8).add(windowOffset)).setSize(bar1Width, 72)); + .setDirection(ProgressBar.Direction.RIGHT) + .setProgress( + () -> progressSupplier.get() + * ((float) (bar1Width + bar2Width) / bar1Width)) + .setSynced(false, false) + .setPos(new Pos2d(88, 8).add(windowOffset)) + .setSize(bar1Width, 72)); builder.widget( new ProgressBar().setTexture(GT_UITextures.PROGRESSBAR_ASSEMBLY_LINE_2, 18) - .setDirection(ProgressBar.Direction.RIGHT) - .setProgress( - () -> (progressSupplier.get() - ((float) bar1Width / (bar1Width + bar2Width))) - * ((float) (bar1Width + bar2Width) / bar2Width)) - .setSynced(false, false).setPos(new Pos2d(124, 8).add(windowOffset)) - .setSize(bar2Width, 72)); + .setDirection(ProgressBar.Direction.RIGHT) + .setProgress( + () -> (progressSupplier.get() + - ((float) bar1Width / (bar1Width + bar2Width))) + * ((float) (bar1Width + bar2Width) / bar2Width)) + .setSynced(false, false) + .setPos(new Pos2d(124, 8).add(windowOffset)) + .setSize(bar2Width, 72)); builder.widget( new ProgressBar().setTexture(GT_UITextures.PROGRESSBAR_ASSEMBLY_LINE_3, 18) - .setDirection(ProgressBar.Direction.UP).setProgress(progressSupplier) - .setSynced(false, false).setPos(new Pos2d(146, 26).add(windowOffset)).setSize(10, 18)); + .setDirection(ProgressBar.Direction.UP) + .setProgress(progressSupplier) + .setSynced(false, false) + .setPos(new Pos2d(146, 26).add(windowOffset)) + .setSize(10, 18)); } } } diff --git a/src/main/java/gregtech/api/util/GT_RecipeBuilder.java b/src/main/java/gregtech/api/util/GT_RecipeBuilder.java index 199d79af84..dc3dd8bba1 100644 --- a/src/main/java/gregtech/api/util/GT_RecipeBuilder.java +++ b/src/main/java/gregtech/api/util/GT_RecipeBuilder.java @@ -95,7 +95,10 @@ public class GT_RecipeBuilder { } private static FluidStack[] fix(FluidStack[] fluidInputs) { - return Arrays.stream(fluidInputs).filter(Objects::nonNull).map(GT_FluidStack::new).toArray(FluidStack[]::new); + return Arrays.stream(fluidInputs) + .filter(Objects::nonNull) + .map(GT_FluidStack::new) + .toArray(FluidStack[]::new); } private static ItemStack[] fix(ItemStack[] inputs) { @@ -144,8 +147,10 @@ public class GT_RecipeBuilder { List<ItemStack> ores = GT_OreDictUnificator.getOres(arr[0]); if (ores.isEmpty()) continue; int size = ((Number) arr[1]).intValue(); - alts[i] = ores.stream().map(s -> GT_Utility.copyAmount(size, s)).filter(GT_Utility::isStackValid) - .toArray(ItemStack[]::new); + alts[i] = ores.stream() + .map(s -> GT_Utility.copyAmount(size, s)) + .filter(GT_Utility::isStackValid) + .toArray(ItemStack[]::new); } else if (input == null) { if (DEBUG_MODE) { throw new NullPointerException(); @@ -159,7 +164,9 @@ public class GT_RecipeBuilder { throw new IllegalArgumentException("index " + i + ", unexpected type: " + input.getClass()); } } - inputsBasic = Arrays.stream(alts).map(ss -> ss.length > 0 ? ss[0] : null).toArray(ItemStack[]::new); + inputsBasic = Arrays.stream(alts) + .map(ss -> ss.length > 0 ? ss[0] : null) + .toArray(ItemStack[]::new); // optimize cannot handle recipes with alts return noOptimize(); } @@ -673,8 +680,8 @@ public class GT_RecipeBuilder { public final static class MetadataIdentifier<T> { - private static final Map<MetadataIdentifier<?>, MetadataIdentifier<?>> allIdentifiers = Collections - .synchronizedMap(new HashMap<>()); + private static final Map<MetadataIdentifier<?>, MetadataIdentifier<?>> allIdentifiers = Collections.synchronizedMap( + new HashMap<>()); private final Class<T> clazz; private final String identifier; diff --git a/src/main/java/gregtech/api/util/GT_RecipeConstants.java b/src/main/java/gregtech/api/util/GT_RecipeConstants.java index 5ccb84da9a..701e1ee4a8 100644 --- a/src/main/java/gregtech/api/util/GT_RecipeConstants.java +++ b/src/main/java/gregtech/api/util/GT_RecipeConstants.java @@ -21,54 +21,64 @@ public class GT_RecipeConstants { * Set to true to signal the recipe require low gravity. do nothing if recipe set specialValue explicitly. Can * coexist with CLEANROOM just fine */ - public static final GT_RecipeBuilder.MetadataIdentifier<Boolean> LOW_GRAVITY = GT_RecipeBuilder.MetadataIdentifier - .create(Boolean.class, "low_gravity"); + public static final GT_RecipeBuilder.MetadataIdentifier<Boolean> LOW_GRAVITY = GT_RecipeBuilder.MetadataIdentifier.create( + Boolean.class, + "low_gravity"); /** * Set to true to signal the recipe require cleanroom. do nothing if recipe set specialValue explicitly. Can coexist * with LOW_GRAVITY just fine */ - public static final GT_RecipeBuilder.MetadataIdentifier<Boolean> CLEANROOM = GT_RecipeBuilder.MetadataIdentifier - .create(Boolean.class, "cleanroom"); + public static final GT_RecipeBuilder.MetadataIdentifier<Boolean> CLEANROOM = GT_RecipeBuilder.MetadataIdentifier.create( + Boolean.class, + "cleanroom"); /** * Common additive to use in recipe, e.g. for PBF, this is coal amount. */ - public static final GT_RecipeBuilder.MetadataIdentifier<Integer> ADDITIVE_AMOUNT = GT_RecipeBuilder.MetadataIdentifier - .create(Integer.class, "additives"); + public static final GT_RecipeBuilder.MetadataIdentifier<Integer> ADDITIVE_AMOUNT = GT_RecipeBuilder.MetadataIdentifier.create( + Integer.class, + "additives"); /** * Used for fusion reactor. Denotes ignition threshold. */ - public static final GT_RecipeBuilder.MetadataIdentifier<Integer> FUSION_THRESHOLD = GT_RecipeBuilder.MetadataIdentifier - .create(Integer.class, "fusion_threshold"); + public static final GT_RecipeBuilder.MetadataIdentifier<Integer> FUSION_THRESHOLD = GT_RecipeBuilder.MetadataIdentifier.create( + Integer.class, + "fusion_threshold"); /** * Research time in a scanner used in ticks. */ - public static final GT_RecipeBuilder.MetadataIdentifier<Integer> RESEARCH_TIME = GT_RecipeBuilder.MetadataIdentifier - .create(Integer.class, "research_time"); + public static final GT_RecipeBuilder.MetadataIdentifier<Integer> RESEARCH_TIME = GT_RecipeBuilder.MetadataIdentifier.create( + Integer.class, + "research_time"); /** * Fuel type. TODO should we use enum directly? */ - public static final GT_RecipeBuilder.MetadataIdentifier<Integer> FUEL_TYPE = GT_RecipeBuilder.MetadataIdentifier - .create(Integer.class, "fuel_type"); + public static final GT_RecipeBuilder.MetadataIdentifier<Integer> FUEL_TYPE = GT_RecipeBuilder.MetadataIdentifier.create( + Integer.class, + "fuel_type"); /** * Fuel value. */ - public static final GT_RecipeBuilder.MetadataIdentifier<Integer> FUEL_VALUE = GT_RecipeBuilder.MetadataIdentifier - .create(Integer.class, "fuel_value"); + public static final GT_RecipeBuilder.MetadataIdentifier<Integer> FUEL_VALUE = GT_RecipeBuilder.MetadataIdentifier.create( + Integer.class, + "fuel_value"); /** * Fuel value. */ - public static final GT_RecipeBuilder.MetadataIdentifier<Integer> COIL_HEAT = GT_RecipeBuilder.MetadataIdentifier - .create(Integer.class, "coil_heat"); + public static final GT_RecipeBuilder.MetadataIdentifier<Integer> COIL_HEAT = GT_RecipeBuilder.MetadataIdentifier.create( + Integer.class, + "coil_heat"); /** * Research item used by assline recipes. */ - public static final GT_RecipeBuilder.MetadataIdentifier<ItemStack> RESEARCH_ITEM = GT_RecipeBuilder.MetadataIdentifier - .create(ItemStack.class, "research_item"); + public static final GT_RecipeBuilder.MetadataIdentifier<ItemStack> RESEARCH_ITEM = GT_RecipeBuilder.MetadataIdentifier.create( + ItemStack.class, + "research_item"); /** * For assembler. It accepts a single item as oredict. It looks like no one uses this anyway... */ - public static final GT_RecipeBuilder.MetadataIdentifier<Object> OREDICT_INPUT = GT_RecipeBuilder.MetadataIdentifier - .create(Object.class, "oredict_input"); + public static final GT_RecipeBuilder.MetadataIdentifier<Object> OREDICT_INPUT = GT_RecipeBuilder.MetadataIdentifier.create( + Object.class, + "oredict_input"); public static final IGT_RecipeMap Fusion = IGT_RecipeMap.newRecipeMap(builder -> { if (GT_Utility.isArrayEmptyOrNull(builder.getFluidInputs()) @@ -92,27 +102,36 @@ public class GT_RecipeConstants { for (Materials mat : new Materials[] { Materials.Argon, Materials.Nitrogen }) { int tPlasmaAmount = (int) Math.max(1L, aDuration / (mat.getMass() * 16L)); GT_RecipeBuilder b2 = builder.copy(); - b2.fluidInputs(mat.getPlasma(tPlasmaAmount)).fluidOutputs(mat.getGas(tPlasmaAmount)); + b2.fluidInputs(mat.getPlasma(tPlasmaAmount)) + .fluidOutputs(mat.getGas(tPlasmaAmount)); ret.addAll(GT_Recipe_Map.sPlasmaArcFurnaceRecipes.doAdd(b2)); } ret.addAll( - GT_Recipe_Map.sArcFurnaceRecipes.doAdd(builder.copy().fluidInputs(Materials.Oxygen.getGas(aDuration)))); + GT_Recipe_Map.sArcFurnaceRecipes.doAdd( + builder.copy() + .fluidInputs(Materials.Oxygen.getGas(aDuration)))); return ret; }); public static final IGT_RecipeMap UniversalChemical = IGT_RecipeMap.newRecipeMap(builder -> { for (ItemStack input : builder.getItemInputsBasic()) { if (GT_Utility.isAnyIntegratedCircuit(input) && input.getItemDamage() >= 10) return GT_Utility.concat( - builder.copy().addTo(GT_Recipe_Map.sChemicalRecipes), + builder.copy() + .addTo(GT_Recipe_Map.sChemicalRecipes), // LCR does not need cleanroom, for now. - builder.metadata(CLEANROOM, false).addTo(GT_Recipe_Map.sMultiblockChemicalRecipes)); + builder.metadata(CLEANROOM, false) + .addTo(GT_Recipe_Map.sMultiblockChemicalRecipes)); } return builder.addTo(GT_Recipe_Map.sChemicalRecipes); }); public static final IGT_RecipeMap AssemblyLine = IGT_RecipeMap.newRecipeMap(builder -> { - Optional<GT_Recipe.GT_Recipe_WithAlt> rr = builder.forceOreDictInput().validateInputCount(4, 16) - .validateOutputCount(1, 1).validateOutputFluidCount(-1, 0).validateInputFluidCount(0, 4).buildWithAlt(); + Optional<GT_Recipe.GT_Recipe_WithAlt> rr = builder.forceOreDictInput() + .validateInputCount(4, 16) + .validateOutputCount(1, 1) + .validateOutputFluidCount(-1, 0) + .validateInputFluidCount(0, 4) + .buildWithAlt(); if (!rr.isPresent()) return Collections.emptyList(); GT_Recipe.GT_Recipe_WithAlt r = rr.get(); ItemStack[][] mOreDictAlt = r.mOreDictAlt; @@ -134,11 +153,11 @@ public class GT_RecipeConstants { Object[] objs = (Object[]) input; Arrays.sort( alts, - Comparator - .<ItemStack, String>comparing( - s -> GameRegistry.findUniqueIdentifierFor(s.getItem()).modId) - .thenComparing(s -> GameRegistry.findUniqueIdentifierFor(s.getItem()).name) - .thenComparingInt(Items.feather::getDamage).thenComparingInt(s -> s.stackSize)); + Comparator.<ItemStack, String>comparing( + s -> GameRegistry.findUniqueIdentifierFor(s.getItem()).modId) + .thenComparing(s -> GameRegistry.findUniqueIdentifierFor(s.getItem()).name) + .thenComparingInt(Items.feather::getDamage) + .thenComparingInt(s -> s.stackSize)); tPersistentHash = tPersistentHash * 31 + (objs[0] == null ? "" : objs[0].toString()).hashCode(); tPersistentHash = tPersistentHash * 31 + ((Number) objs[1]).intValue(); @@ -205,21 +224,29 @@ public class GT_RecipeConstants { Collection<GT_Recipe> ret = new ArrayList<>(); for (ItemStack input : GT_OreDictUnificator.getOresImmutable(builder.getMetadata(OREDICT_INPUT))) { ret.addAll( - builder.copy().itemInputs(GT_RecipeMapUtil.appendArray(builder.getItemInputsBasic(), input)) - .addTo(GT_Recipe_Map.sAssemblerRecipes)); + builder.copy() + .itemInputs(GT_RecipeMapUtil.appendArray(builder.getItemInputsBasic(), input)) + .addTo(GT_Recipe_Map.sAssemblerRecipes)); } return ret; }); public static IGT_RecipeMap Fuel = IGT_RecipeMap.newRecipeMap(builder -> { - builder.validateInputCount(1, 1).validateNoInputFluid().validateOutputCount(-1, 0).validateNoOutputFluid(); + builder.validateInputCount(1, 1) + .validateNoInputFluid() + .validateOutputCount(-1, 0) + .validateNoOutputFluid(); if (!builder.isValid()) return Collections.emptyList(); int fuelType = builder.getMetadata(FUEL_TYPE); builder.metadata( FUEL_VALUE, - GregTech_API.sRecipeFile - .get("fuel_" + fuelType, builder.getItemInputBasic(0), builder.getMetadata(FUEL_VALUE))); - return FuelType.get(fuelType).getTarget().doAdd(builder); + GregTech_API.sRecipeFile.get( + "fuel_" + fuelType, + builder.getItemInputBasic(0), + builder.getMetadata(FUEL_VALUE))); + return FuelType.get(fuelType) + .getTarget() + .doAdd(builder); }); public enum FuelType { diff --git a/src/main/java/gregtech/api/util/GT_RecipeMapUtil.java b/src/main/java/gregtech/api/util/GT_RecipeMapUtil.java index 7bb02a5681..54a2c5a692 100644 --- a/src/main/java/gregtech/api/util/GT_RecipeMapUtil.java +++ b/src/main/java/gregtech/api/util/GT_RecipeMapUtil.java @@ -28,9 +28,11 @@ public class GT_RecipeMapUtil { }; public static final Function<GT_Recipe, String> FIRST_FLUID_INPUT = r -> isArrayEmptyOrNull(r.mFluidInputs) ? null - : r.mFluidInputs[0].getFluid().getName(); + : r.mFluidInputs[0].getFluid() + .getName(); public static final Function<GT_Recipe, String> FIRST_FLUID_OUTPUT = r -> isArrayEmptyOrNull(r.mFluidInputs) ? null - : r.mFluidOutputs[0].getFluid().getName(); + : r.mFluidOutputs[0].getFluid() + .getName(); public static final Function<GT_Recipe, String> FIRST_FLUIDSTACK_INPUT = r -> isArrayEmptyOrNull(r.mFluidInputs) ? null : r.mFluidInputs[0].getUnlocalizedName(); @@ -42,10 +44,14 @@ public class GT_RecipeMapUtil { public static final Function<GT_Recipe, String> FIRST_ITEM_OUTPUT = r -> isArrayEmptyOrNull(r.mOutputs) ? null : getStackConfigName(r.mOutputs[0]); public static final Function<GT_Recipe, String> FIRST_ITEM_OR_FLUID_INPUT = r -> isArrayEmptyOrNull(r.mInputs) - ? isArrayEmptyOrNull(r.mFluidInputs) ? null : r.mFluidInputs[0].getFluid().getName() + ? isArrayEmptyOrNull(r.mFluidInputs) ? null + : r.mFluidInputs[0].getFluid() + .getName() : getStackConfigName(r.mInputs[0]); public static final Function<GT_Recipe, String> FIRST_ITEM_OR_FLUID_OUTPUT = r -> isArrayEmptyOrNull(r.mOutputs) - ? isArrayEmptyOrNull(r.mFluidOutputs) ? null : r.mFluidOutputs[0].getFluid().getName() + ? isArrayEmptyOrNull(r.mFluidOutputs) ? null + : r.mFluidOutputs[0].getFluid() + .getName() : getStackConfigName(r.mOutputs[0]); private static final Map<String, IGT_RecipeMap> addonRecipeMaps = new HashMap<>(); private static final Multimap<String, Consumer<IGT_RecipeMap>> delayedActions = ArrayListMultimap.create(); @@ -74,9 +80,10 @@ public class GT_RecipeMapUtil { cellToFluid(itemInputs, fluidInputs, true); cellToFluid(itemInputs, fluidInputs, false); return buildOrEmpty( - b.itemInputs(itemInputs.toArray(new ItemStack[0])).itemOutputs(itemOutputs.toArray(new ItemStack[0])) - .fluidInputs(fluidInputs.toArray(new FluidStack[0])) - .fluidOutputs(fluidOutputs.toArray(new FluidStack[0]))); + b.itemInputs(itemInputs.toArray(new ItemStack[0])) + .itemOutputs(itemOutputs.toArray(new ItemStack[0])) + .fluidInputs(fluidInputs.toArray(new FluidStack[0])) + .fluidOutputs(fluidOutputs.toArray(new FluidStack[0]))); } public static List<GT_Recipe> buildRecipeForMultiblockNoCircuit(GT_RecipeBuilder b) { @@ -87,9 +94,10 @@ public class GT_RecipeMapUtil { cellToFluid(itemInputs, fluidInputs, false); cellToFluid(itemInputs, fluidInputs, false); return buildOrEmpty( - b.itemInputs(itemInputs.toArray(new ItemStack[0])).itemOutputs(itemOutputs.toArray(new ItemStack[0])) - .fluidInputs(fluidInputs.toArray(new FluidStack[0])) - .fluidOutputs(fluidOutputs.toArray(new FluidStack[0]))); + b.itemInputs(itemInputs.toArray(new ItemStack[0])) + .itemOutputs(itemOutputs.toArray(new ItemStack[0])) + .fluidInputs(fluidInputs.toArray(new FluidStack[0])) + .fluidOutputs(fluidOutputs.toArray(new FluidStack[0]))); } private static void cellToFluid(List<ItemStack> items, List<FluidStack> fluids, boolean removeIntegratedCircuit) { @@ -104,7 +112,9 @@ public class GT_RecipeMapUtil { } public static List<GT_Recipe> buildOrEmpty(GT_RecipeBuilder builder) { - return builder.build().map(Collections::singletonList).orElse(Collections.emptyList()); + return builder.build() + .map(Collections::singletonList) + .orElse(Collections.emptyList()); } /** @@ -119,7 +129,9 @@ public class GT_RecipeMapUtil { */ public static void registerRecipeMap(String identifier, IGT_RecipeMap recipeMap, RecipeMapDependency... dependencies) { - String modId = Loader.instance().activeModContainer().getModId(); + String modId = Loader.instance() + .activeModContainer() + .getModId(); if ("gregtech".equals(modId)) throw new IllegalStateException( "do not register recipe map under the name of gregtech! do it in your own preinit!"); String id = modId + "@" + identifier; diff --git a/src/main/java/gregtech/api/util/GT_RecipeRegistrator.java b/src/main/java/gregtech/api/util/GT_RecipeRegistrator.java index 0b881ce477..b6a4b960c7 100644 --- a/src/main/java/gregtech/api/util/GT_RecipeRegistrator.java +++ b/src/main/java/gregtech/api/util/GT_RecipeRegistrator.java @@ -178,7 +178,8 @@ public class GT_RecipeRegistrator { || (L * aMaterialAmount) / (M * aStack.stackSize) <= 0) return; ItemData tData = GT_OreDictUnificator.getItemData(aStack); - boolean tHide = aStack.getUnlocalizedName().startsWith("gt.blockmachines") + boolean tHide = aStack.getUnlocalizedName() + .startsWith("gt.blockmachines") && (GT_Mod.gregtechproxy.mHideRecyclingRecipes); if (GT_Mod.gregtechproxy.mHideRecyclingRecipes && tData != null && tData.hasValidPrefixData() @@ -199,8 +200,9 @@ public class GT_RecipeRegistrator { : aByproduct.mMaterial.contains(SubTag.NO_SMELTING) || !aByproduct.mMaterial.contains(SubTag.METAL) ? aByproduct.mMaterial.contains(SubTag.FLAMMABLE) - ? GT_OreDictUnificator - .getDust(Materials.Ash, aByproduct.mAmount / 2) + ? GT_OreDictUnificator.getDust( + Materials.Ash, + aByproduct.mAmount / 2) : aByproduct.mMaterial.contains(SubTag.UNBURNABLE) ? GT_OreDictUnificator.getDustOrIngot( aByproduct.mMaterial.mSmeltInto, @@ -467,7 +469,8 @@ public class GT_RecipeRegistrator { private static Map<RecipeShape, List<IRecipe>> createIndexedRecipeListCache() { Map<RecipeShape, List<IRecipe>> result = new IdentityHashMap<>(); @SuppressWarnings("unchecked") - ArrayList<IRecipe> allRecipeList = (ArrayList<IRecipe>) CraftingManager.getInstance().getRecipeList(); + ArrayList<IRecipe> allRecipeList = (ArrayList<IRecipe>) CraftingManager.getInstance() + .getRecipeList(); // filter using the empty slots in the shape. // if the empty slots doesn't match, the recipe will definitely fail SetMultimap<List<Integer>, RecipeShape> filter = HashMultimap.create(); @@ -498,7 +501,8 @@ public class GT_RecipeRegistrator { getRecipeWidth(tShapedRecipe), getRecipeHeight(tShapedRecipe))) { for (RecipeShape s : filter.get(buffer)) { - result.computeIfAbsent(s, k -> new ArrayList<>()).add(tRecipe); + result.computeIfAbsent(s, k -> new ArrayList<>()) + .add(tRecipe); } } } else if (tRecipe instanceof ShapedRecipes) { @@ -509,14 +513,16 @@ public class GT_RecipeRegistrator { getRecipeWidth(tShapedRecipe), getRecipeHeight(tShapedRecipe))) { for (RecipeShape s : filter.get(buffer)) { - result.computeIfAbsent(s, k -> new ArrayList<>()).add(tRecipe); + result.computeIfAbsent(s, k -> new ArrayList<>()) + .add(tRecipe); } } } else { for (RecipeShape s : sShapes) { // unknown recipe type. cannot determine empty slots. we choose to add to the recipe list for // all shapes - result.computeIfAbsent(s, k -> new ArrayList<>()).add(tRecipe); + result.computeIfAbsent(s, k -> new ArrayList<>()) + .add(tRecipe); } } } @@ -563,8 +569,10 @@ public class GT_RecipeRegistrator { for (int i = 0; i < sShapes.length; i++) { RecipeShape tRecipe = sShapes[i]; - for (ItemStack tCrafted : GT_ModHandler - .getRecipeOutputs(getRecipeList(tRecipe), true, tRecipe.shape)) { + for (ItemStack tCrafted : GT_ModHandler.getRecipeOutputs( + getRecipeList(tRecipe), + true, + tRecipe.shape)) { if (aItemData != null && aItemData.hasValidPrefixMaterialData()) GT_OreDictUnificator.addItemData( tCrafted, @@ -735,7 +743,8 @@ public class GT_RecipeRegistrator { } public static boolean hasVanillaRecipes(Materials materials) { - return Arrays.stream(VANILLA_MATS).anyMatch(mat -> mat == materials); + return Arrays.stream(VANILLA_MATS) + .anyMatch(mat -> mat == materials); } private static int getRecipeWidth(ShapedOreRecipe r) { diff --git a/src/main/java/gregtech/api/util/GT_RenderingWorld.java b/src/main/java/gregtech/api/util/GT_RenderingWorld.java index bab2a30505..b8caa59554 100644 --- a/src/main/java/gregtech/api/util/GT_RenderingWorld.java +++ b/src/main/java/gregtech/api/util/GT_RenderingWorld.java @@ -59,7 +59,8 @@ public class GT_RenderingWorld implements IBlockAccess { public void register(int x, int y, int z, Block block, int meta) { ChunkPosition key = new ChunkPosition(x, y, z); infos.put(key, new BlockInfo(block, meta)); - index.computeIfAbsent(new ChunkCoordIntPair(x >> 4, z >> 4), p -> new HashSet<>()).add(key); + index.computeIfAbsent(new ChunkCoordIntPair(x >> 4, z >> 4), p -> new HashSet<>()) + .add(key); } public void unregister(int x, int y, int z, Block block, int meta) { @@ -127,7 +128,9 @@ public class GT_RenderingWorld implements IBlockAccess { public class FMLEventHandler { public FMLEventHandler() { - FMLCommonHandler.instance().bus().register(this); + FMLCommonHandler.instance() + .bus() + .register(this); } @SubscribeEvent(priority = EventPriority.HIGHEST) @@ -145,8 +148,11 @@ public class GT_RenderingWorld implements IBlockAccess { @SubscribeEvent public void onChunkUnloaded(ChunkEvent.Unload e) { if (!e.world.isRemote) return; - Set<ChunkPosition> set = index.remove(e.getChunk().getChunkCoordIntPair()); - if (set != null) infos.keySet().removeAll(set); + Set<ChunkPosition> set = index.remove( + e.getChunk() + .getChunkCoordIntPair()); + if (set != null) infos.keySet() + .removeAll(set); } @SubscribeEvent diff --git a/src/main/java/gregtech/api/util/GT_Shaped_Recipe.java b/src/main/java/gregtech/api/util/GT_Shaped_Recipe.java index 62096c1ebd..982c0e8f35 100644 --- a/src/main/java/gregtech/api/util/GT_Shaped_Recipe.java +++ b/src/main/java/gregtech/api/util/GT_Shaped_Recipe.java @@ -36,9 +36,12 @@ public class GT_Shaped_Recipe extends ShapedOreRecipe implements IGT_CraftingRec for (int i = 0; i < aGrid.getSizeInventory(); i++) { if (aGrid.getStackInSlot(i) != null) { if (tStack != null) { - if ((tStack.hasTagCompound() != aGrid.getStackInSlot(i).hasTagCompound()) - || (tStack.hasTagCompound() - && !tStack.getTagCompound().equals(aGrid.getStackInSlot(i).getTagCompound()))) + if ((tStack.hasTagCompound() != aGrid.getStackInSlot(i) + .hasTagCompound()) + || (tStack.hasTagCompound() && !tStack.getTagCompound() + .equals( + aGrid.getStackInSlot(i) + .getTagCompound()))) return false; } tStack = aGrid.getStackInSlot(i); @@ -57,8 +60,12 @@ public class GT_Shaped_Recipe extends ShapedOreRecipe implements IGT_CraftingRec // Keeping NBT if (mKeepingNBT) for (int i = 0; i < aGrid.getSizeInventory(); i++) { - if (aGrid.getStackInSlot(i) != null && aGrid.getStackInSlot(i).hasTagCompound()) { - rStack.setTagCompound((NBTTagCompound) aGrid.getStackInSlot(i).getTagCompound().copy()); + if (aGrid.getStackInSlot(i) != null && aGrid.getStackInSlot(i) + .hasTagCompound()) { + rStack.setTagCompound( + (NBTTagCompound) aGrid.getStackInSlot(i) + .getTagCompound() + .copy()); break; } } diff --git a/src/main/java/gregtech/api/util/GT_Shapeless_Recipe.java b/src/main/java/gregtech/api/util/GT_Shapeless_Recipe.java index 02c479cc94..fc1d523ecc 100644 --- a/src/main/java/gregtech/api/util/GT_Shapeless_Recipe.java +++ b/src/main/java/gregtech/api/util/GT_Shapeless_Recipe.java @@ -36,9 +36,12 @@ public class GT_Shapeless_Recipe extends ShapelessOreRecipe implements IGT_Craft for (int i = 0; i < aGrid.getSizeInventory(); i++) { if (aGrid.getStackInSlot(i) != null) { if (tStack != null) { - if ((tStack.hasTagCompound() != aGrid.getStackInSlot(i).hasTagCompound()) - || (tStack.hasTagCompound() - && !tStack.getTagCompound().equals(aGrid.getStackInSlot(i).getTagCompound()))) + if ((tStack.hasTagCompound() != aGrid.getStackInSlot(i) + .hasTagCompound()) + || (tStack.hasTagCompound() && !tStack.getTagCompound() + .equals( + aGrid.getStackInSlot(i) + .getTagCompound()))) return false; } tStack = aGrid.getStackInSlot(i); @@ -57,8 +60,12 @@ public class GT_Shapeless_Recipe extends ShapelessOreRecipe implements IGT_Craft // Keeping NBT if (mKeepingNBT) for (int i = 0; i < aGrid.getSizeInventory(); i++) { - if (aGrid.getStackInSlot(i) != null && aGrid.getStackInSlot(i).hasTagCompound()) { - rStack.setTagCompound((NBTTagCompound) aGrid.getStackInSlot(i).getTagCompound().copy()); + if (aGrid.getStackInSlot(i) != null && aGrid.getStackInSlot(i) + .hasTagCompound()) { + rStack.setTagCompound( + (NBTTagCompound) aGrid.getStackInSlot(i) + .getTagCompound() + .copy()); break; } } diff --git a/src/main/java/gregtech/api/util/GT_Single_Recipe_Check.java b/src/main/java/gregtech/api/util/GT_Single_Recipe_Check.java index 89a7fb371d..806d892365 100644 --- a/src/main/java/gregtech/api/util/GT_Single_Recipe_Check.java +++ b/src/main/java/gregtech/api/util/GT_Single_Recipe_Check.java @@ -42,8 +42,14 @@ public class GT_Single_Recipe_Check { this.itemCost = itemCost; this.fluidCost = fluidCost; - this.totalItemCost = itemCost.values().stream().mapToInt(Integer::intValue).sum(); - this.totalFluidCost = fluidCost.values().stream().mapToInt(Integer::intValue).sum(); + this.totalItemCost = itemCost.values() + .stream() + .mapToInt(Integer::intValue) + .sum(); + this.totalFluidCost = fluidCost.values() + .stream() + .mapToInt(Integer::intValue) + .sum(); } public GT_Recipe getRecipe() { @@ -208,13 +214,19 @@ public class GT_Single_Recipe_Check { tag.setInteger("specialValue", recipe.mSpecialValue); tag.setTag("itemCost", writeList(itemCost.entrySet(), e -> { NBTTagCompound ret = new NBTTagCompound(); - ret.setTag("id", e.getKey().writeToNBT()); + ret.setTag( + "id", + e.getKey() + .writeToNBT()); ret.setInteger("count", e.getValue()); return ret; })); tag.setTag("fluidCost", writeList(fluidCost.entrySet(), e -> { NBTTagCompound ret = new NBTTagCompound(); - ret.setString("id", e.getKey().getName()); + ret.setString( + "id", + e.getKey() + .getName()); ret.setInteger("count", e.getValue()); return ret; })); @@ -248,30 +260,36 @@ public class GT_Single_Recipe_Check { } protected static ImmutableMap<Fluid, Integer> loadFluidCost(NBTTagCompound tag) { - return GT_Utility.streamCompounds(tag.getTagList("fluidCost", Constants.NBT.TAG_COMPOUND)).collect( - GT_Utility.toImmutableMapSerial( - t -> FluidRegistry.getFluid(t.getString("id")), - t -> t.getInteger("count"))); + return GT_Utility.streamCompounds(tag.getTagList("fluidCost", Constants.NBT.TAG_COMPOUND)) + .collect( + GT_Utility.toImmutableMapSerial( + t -> FluidRegistry.getFluid(t.getString("id")), + t -> t.getInteger("count"))); } protected static ImmutableMap<GT_Utility.ItemId, Integer> loadItemCost(NBTTagCompound tag) { - return GT_Utility.streamCompounds(tag.getTagList("itemCost", Constants.NBT.TAG_COMPOUND)).collect( - GT_Utility.toImmutableMapSerial( - t -> GT_Utility.ItemId.create(t.getCompoundTag("id")), - t -> t.getInteger("count"))); + return GT_Utility.streamCompounds(tag.getTagList("itemCost", Constants.NBT.TAG_COMPOUND)) + .collect( + GT_Utility.toImmutableMapSerial( + t -> GT_Utility.ItemId.create(t.getCompoundTag("id")), + t -> t.getInteger("count"))); } protected static GT_Recipe tryFindRecipe(GT_MetaTileEntity_MultiBlockBase parent, GT_Recipe.GT_Recipe_Map recipeMap, NBTTagCompound tag) { if (tag == null || tag.hasNoTags()) return null; ItemStack[] inputs = GT_Utility.streamCompounds(tag.getTagList("inputs", Constants.NBT.TAG_COMPOUND)) - .map(GT_Utility::loadItem).toArray(ItemStack[]::new); + .map(GT_Utility::loadItem) + .toArray(ItemStack[]::new); ItemStack[] outputs = GT_Utility.streamCompounds(tag.getTagList("outputs", Constants.NBT.TAG_COMPOUND)) - .map(GT_Utility::loadItem).toArray(ItemStack[]::new); + .map(GT_Utility::loadItem) + .toArray(ItemStack[]::new); FluidStack[] fInputs = GT_Utility.streamCompounds(tag.getTagList("fInputs", Constants.NBT.TAG_COMPOUND)) - .map(FluidStack::loadFluidStackFromNBT).toArray(FluidStack[]::new); + .map(FluidStack::loadFluidStackFromNBT) + .toArray(FluidStack[]::new); FluidStack[] fOutputs = GT_Utility.streamCompounds(tag.getTagList("fOutputs", Constants.NBT.TAG_COMPOUND)) - .map(FluidStack::loadFluidStackFromNBT).toArray(FluidStack[]::new); + .map(FluidStack::loadFluidStackFromNBT) + .toArray(FluidStack[]::new); int eut = tag.getInteger("eut"); GT_Recipe found = recipeMap.findRecipe( parent.getBaseMetaTileEntity(), diff --git a/src/main/java/gregtech/api/util/GT_Single_Recipe_Check_Processing_Array.java b/src/main/java/gregtech/api/util/GT_Single_Recipe_Check_Processing_Array.java index 656c752ea6..3996484935 100644 --- a/src/main/java/gregtech/api/util/GT_Single_Recipe_Check_Processing_Array.java +++ b/src/main/java/gregtech/api/util/GT_Single_Recipe_Check_Processing_Array.java @@ -94,8 +94,13 @@ public class GT_Single_Recipe_Check_Processing_Array extends GT_Single_Recipe_Ch if (consumeInputs) { if (totalItemCost > 0) { int remainingItemCost = totalItemCost * finalParallel; - Map<GT_Utility.ItemId, Integer> runningItemCost = itemCost.entrySet().stream() - .collect(Collectors.toMap(Map.Entry::getKey, entry -> entry.getValue() * finalParallel)); + Map<GT_Utility.ItemId, Integer> runningItemCost = itemCost.entrySet() + .stream() + .collect( + Collectors.toMap( + Map.Entry::getKey, + entry -> entry.getValue() + * finalParallel)); for (ItemStack itemStack : items) { GT_Utility.ItemId key = GT_Utility.ItemId.createNoCopy(itemStack); @@ -113,8 +118,13 @@ public class GT_Single_Recipe_Check_Processing_Array extends GT_Single_Recipe_Ch if (totalFluidCost > 0) { int remainingFluidCost = totalFluidCost * finalParallel; - Map<Fluid, Integer> runningFluidCost = fluidCost.entrySet().stream() - .collect(Collectors.toMap(Map.Entry::getKey, entry -> entry.getValue() * finalParallel)); + Map<Fluid, Integer> runningFluidCost = fluidCost.entrySet() + .stream() + .collect( + Collectors.toMap( + Map.Entry::getKey, + entry -> entry.getValue() + * finalParallel)); for (FluidStack fluidStack : fluids) { Fluid key = fluidStack.getFluid(); diff --git a/src/main/java/gregtech/api/util/GT_SpawnEventHandler.java b/src/main/java/gregtech/api/util/GT_SpawnEventHandler.java index 7b03dd8884..c17f73a147 100644 --- a/src/main/java/gregtech/api/util/GT_SpawnEventHandler.java +++ b/src/main/java/gregtech/api/util/GT_SpawnEventHandler.java @@ -40,8 +40,9 @@ public class GT_SpawnEventHandler { public void denyMobSpawn(CheckSpawn event) { if (event.getResult() == Event.Result.DENY) return; - if (event.entityLiving instanceof EntitySlime - && !(((EntitySlime) event.entityLiving).getCustomNameTag().length() > 0)) { + if (event.entityLiving instanceof EntitySlime && !(((EntitySlime) event.entityLiving).getCustomNameTag() + .length() + > 0)) { if (event.getResult() == Event.Result.ALLOW) event.setResult(Event.Result.DEFAULT); } @@ -64,10 +65,9 @@ public class GT_SpawnEventHandler { if (check > maxRangeCheck) continue; final TileEntity tTile = event.entity.worldObj.getTileEntity(rep[0], rep[1], rep[2]); - if (tTile instanceof BaseMetaTileEntity && ((BaseMetaTileEntity) tTile) - .getMetaTileEntity() instanceof GT_MetaTileEntity_MonsterRepellent) { - final int r = ((GT_MetaTileEntity_MonsterRepellent) ((BaseMetaTileEntity) tTile) - .getMetaTileEntity()).mRange; + if (tTile instanceof BaseMetaTileEntity + && ((BaseMetaTileEntity) tTile).getMetaTileEntity() instanceof GT_MetaTileEntity_MonsterRepellent) { + final int r = ((GT_MetaTileEntity_MonsterRepellent) ((BaseMetaTileEntity) tTile).getMetaTileEntity()).mRange; if (check <= Math.pow(r, 2)) { if (event.entityLiving instanceof EntitySlime) ((EntitySlime) event.entityLiving).setCustomNameTag("DoNotSpawnSlimes"); diff --git a/src/main/java/gregtech/api/util/GT_StructureUtility.java b/src/main/java/gregtech/api/util/GT_StructureUtility.java index 25ba192794..80fc64a8c3 100644 --- a/src/main/java/gregtech/api/util/GT_StructureUtility.java +++ b/src/main/java/gregtech/api/util/GT_StructureUtility.java @@ -249,17 +249,26 @@ public class GT_StructureUtility { Class<? extends IMetaTileEntity> clazz = aMetaId.apply(t); if (clazz == null) return REJECT; ItemStack taken = env.getSource() - .takeOne(is -> clazz.isInstance(GT_Item_Machines.getMetaTileEntity(is)), true); + .takeOne(is -> clazz.isInstance(GT_Item_Machines.getMetaTileEntity(is)), true); if (GT_Utility.isStackInvalid(taken)) { - env.getChatter().accept( - new ChatComponentTranslation( - "GT5U.autoplace.error.no_mte.class_name", - clazz.getSimpleName())); + env.getChatter() + .accept( + new ChatComponentTranslation( + "GT5U.autoplace.error.no_mte.class_name", + clazz.getSimpleName())); return REJECT; } - if (StructureUtility - .survivalPlaceBlock(taken, EXACT, null, true, world, x, y, z, env.getSource(), env.getActor()) - == ACCEPT) + if (StructureUtility.survivalPlaceBlock( + taken, + EXACT, + null, + true, + world, + x, + y, + z, + env.getSource(), + env.getActor()) == ACCEPT) return acceptType; return REJECT; } @@ -298,7 +307,9 @@ public class GT_StructureUtility { GT_Item_Machines item = (GT_Item_Machines) Item.getItemFromBlock(GregTech_API.sBlockMachines); int meta = aMetaId.applyAsInt(t); if (meta < 0) return BlocksToPlace.createEmpty(); - return BlocksToPlace.create(ItemStackPredicate.from(item).setMeta(meta)); + return BlocksToPlace.create( + ItemStackPredicate.from(item) + .setMeta(meta)); } @Override @@ -327,14 +338,27 @@ public class GT_StructureUtility { GT_Item_Machines item = (GT_Item_Machines) Item.getItemFromBlock(GregTech_API.sBlockMachines); int meta = aMetaId.applyAsInt(t); if (meta < 0) return REJECT; - ItemStack taken = env.getSource().takeOne(ItemStackPredicate.from(item).setMeta(meta), true); + ItemStack taken = env.getSource() + .takeOne( + ItemStackPredicate.from(item) + .setMeta(meta), + true); if (GT_Utility.isStackInvalid(taken)) { - env.getChatter().accept(new ChatComponentTranslation("GT5U.autoplace.error.no_mte.id", meta)); + env.getChatter() + .accept(new ChatComponentTranslation("GT5U.autoplace.error.no_mte.id", meta)); return REJECT; } - return StructureUtility - .survivalPlaceBlock(taken, EXACT, null, true, world, x, y, z, env.getSource(), env.getActor()) - == ACCEPT ? ACCEPT_STOP : REJECT; + return StructureUtility.survivalPlaceBlock( + taken, + EXACT, + null, + true, + world, + x, + y, + z, + env.getSource(), + env.getActor()) == ACCEPT ? ACCEPT_STOP : REJECT; } }; } @@ -382,8 +406,16 @@ public class GT_StructureUtility { public PlaceResult survivalPlaceBlock(T t, World world, int x, int y, int z, ItemStack trigger, IItemSource s, EntityPlayerMP actor, Consumer<IChatComponent> chatter) { if (check(t, world, x, y, z)) return SKIP; - return StructureUtility - .survivalPlaceBlock(placeCasing, placeCasingMeta, world, x, y, z, s, actor, chatter); + return StructureUtility.survivalPlaceBlock( + placeCasing, + placeCasingMeta, + world, + x, + y, + z, + s, + actor, + chatter); } }; } @@ -494,7 +526,8 @@ public class GT_StructureUtility { public static Predicate<ItemStack> filterByMTEClass(List<? extends Class<? extends IMetaTileEntity>> list) { return is -> { IMetaTileEntity tile = GT_Item_Machines.getMetaTileEntity(is); - return tile != null && list.stream().anyMatch(c -> c.isInstance(tile)); + return tile != null && list.stream() + .anyMatch(c -> c.isInstance(tile)); }; } diff --git a/src/main/java/gregtech/api/util/GT_Util.java b/src/main/java/gregtech/api/util/GT_Util.java index 6e203a2682..177b391f5d 100644 --- a/src/main/java/gregtech/api/util/GT_Util.java +++ b/src/main/java/gregtech/api/util/GT_Util.java @@ -38,17 +38,47 @@ public class GT_Util { for (Tuple t : aTags) { if (t.getSecond() == null) continue; - if (t.getSecond() instanceof Boolean) rNBT.setBoolean(t.getFirst().toString(), (Boolean) t.getSecond()); - else if (t.getSecond() instanceof Byte) rNBT.setByte(t.getFirst().toString(), (Byte) t.getSecond()); - else if (t.getSecond() instanceof Short) rNBT.setShort(t.getFirst().toString(), (Short) t.getSecond()); - else if (t.getSecond() instanceof Integer) - rNBT.setInteger(t.getFirst().toString(), (Integer) t.getSecond()); - else if (t.getSecond() instanceof Long) rNBT.setLong(t.getFirst().toString(), (Long) t.getSecond()); - else if (t.getSecond() instanceof Float) rNBT.setFloat(t.getFirst().toString(), (Float) t.getSecond()); - else if (t.getSecond() instanceof Double) rNBT.setDouble(t.getFirst().toString(), (Double) t.getSecond()); - else if (t.getSecond() instanceof String) rNBT.setString(t.getFirst().toString(), (String) t.getSecond()); - else if (t.getSecond() instanceof NBTBase) rNBT.setTag(t.getFirst().toString(), (NBTBase) t.getSecond()); - else rNBT.setString(t.getFirst().toString(), t.getSecond().toString()); + if (t.getSecond() instanceof Boolean) rNBT.setBoolean( + t.getFirst() + .toString(), + (Boolean) t.getSecond()); + else if (t.getSecond() instanceof Byte) rNBT.setByte( + t.getFirst() + .toString(), + (Byte) t.getSecond()); + else if (t.getSecond() instanceof Short) rNBT.setShort( + t.getFirst() + .toString(), + (Short) t.getSecond()); + else if (t.getSecond() instanceof Integer) rNBT.setInteger( + t.getFirst() + .toString(), + (Integer) t.getSecond()); + else if (t.getSecond() instanceof Long) rNBT.setLong( + t.getFirst() + .toString(), + (Long) t.getSecond()); + else if (t.getSecond() instanceof Float) rNBT.setFloat( + t.getFirst() + .toString(), + (Float) t.getSecond()); + else if (t.getSecond() instanceof Double) rNBT.setDouble( + t.getFirst() + .toString(), + (Double) t.getSecond()); + else if (t.getSecond() instanceof String) rNBT.setString( + t.getFirst() + .toString(), + (String) t.getSecond()); + else if (t.getSecond() instanceof NBTBase) rNBT.setTag( + t.getFirst() + .toString(), + (NBTBase) t.getSecond()); + else rNBT.setString( + t.getFirst() + .toString(), + t.getSecond() + .toString()); } return rNBT; diff --git a/src/main/java/gregtech/api/util/GT_Utility.java b/src/main/java/gregtech/api/util/GT_Utility.java index 32ccca715a..859c1ab84b 100644 --- a/src/main/java/gregtech/api/util/GT_Utility.java +++ b/src/main/java/gregtech/api/util/GT_Utility.java @@ -169,8 +169,9 @@ public class GT_Utility { // 1 is the magic index to get the cobblestone block. // See: GT_Block_Stones.java, GT_Block_Granites.java - Function<Materials, Supplier<ItemStack>> materialToCobble = m -> Suppliers - .memoize(() -> GT_OreDictUnificator.getOres(OrePrefixes.stone, m).get(1))::get; + Function<Materials, Supplier<ItemStack>> materialToCobble = m -> Suppliers.memoize( + () -> GT_OreDictUnificator.getOres(OrePrefixes.stone, m) + .get(1))::get; sOreToCobble.put(OrePrefixes.oreBlackgranite, materialToCobble.apply(Materials.GraniteBlack)); sOreToCobble.put(OrePrefixes.oreRedgranite, materialToCobble.apply(Materials.GraniteRed)); sOreToCobble.put(OrePrefixes.oreMarble, materialToCobble.apply(Materials.Marble)); @@ -191,7 +192,8 @@ public class GT_Utility { public static Field getPublicField(Object aObject, String aField) { Field rField = null; try { - rField = aObject.getClass().getDeclaredField(aField); + rField = aObject.getClass() + .getDeclaredField(aField); } catch (Throwable e) { /* Do nothing */ } @@ -201,7 +203,8 @@ public class GT_Utility { public static Field getField(Object aObject, String aField) { Field rField = null; try { - rField = aObject.getClass().getDeclaredField(aField); + rField = aObject.getClass() + .getDeclaredField(aField); rField.setAccessible(true); } catch (Throwable e) { /* Do nothing */ @@ -234,7 +237,8 @@ public class GT_Utility { public static Method getMethod(Object aObject, String aMethod, Class<?>... aParameterTypes) { Method rMethod = null; try { - rMethod = aObject.getClass().getMethod(aMethod, aParameterTypes); + rMethod = aObject.getClass() + .getMethod(aMethod, aParameterTypes); rMethod.setAccessible(true); } catch (Throwable e) { /* Do nothing */ @@ -245,8 +249,10 @@ public class GT_Utility { public static Field getField(Object aObject, String aField, boolean aPrivate, boolean aLogErrors) { try { Field tField = (aObject instanceof Class) ? ((Class) aObject).getDeclaredField(aField) - : (aObject instanceof String) ? Class.forName((String) aObject).getDeclaredField(aField) - : aObject.getClass().getDeclaredField(aField); + : (aObject instanceof String) ? Class.forName((String) aObject) + .getDeclaredField(aField) + : aObject.getClass() + .getDeclaredField(aField); if (aPrivate) tField.setAccessible(true); return tField; } catch (Throwable e) { @@ -258,8 +264,10 @@ public class GT_Utility { public static Object getFieldContent(Object aObject, String aField, boolean aPrivate, boolean aLogErrors) { try { Field tField = (aObject instanceof Class) ? ((Class) aObject).getDeclaredField(aField) - : (aObject instanceof String) ? Class.forName((String) aObject).getDeclaredField(aField) - : aObject.getClass().getDeclaredField(aField); + : (aObject instanceof String) ? Class.forName((String) aObject) + .getDeclaredField(aField) + : aObject.getClass() + .getDeclaredField(aField); if (aPrivate) tField.setAccessible(true); return tField.get(aObject instanceof Class || aObject instanceof String ? null : aObject); } catch (Throwable e) { @@ -299,7 +307,8 @@ public class GT_Utility { } Method tMethod = (aObject instanceof Class) ? ((Class) aObject).getMethod(aMethod, tParameterTypes) - : aObject.getClass().getMethod(aMethod, tParameterTypes); + : aObject.getClass() + .getMethod(aMethod, tParameterTypes); if (aPrivate) tMethod.setAccessible(true); return tMethod.invoke(aObject, aParameters); } catch (Throwable e) { @@ -346,8 +355,9 @@ public class GT_Utility { } public static String capitalizeString(String aString) { - if (aString != null && aString.length() > 0) - return aString.substring(0, 1).toUpperCase() + aString.substring(1); + if (aString != null && aString.length() > 0) return aString.substring(0, 1) + .toUpperCase() + + aString.substring(1); return E; } @@ -374,7 +384,12 @@ public class GT_Utility { public static String getClassName(Object aObject) { if (aObject == null) return "null"; - return aObject.getClass().getName().substring(aObject.getClass().getName().lastIndexOf(".") + 1); + return aObject.getClass() + .getName() + .substring( + aObject.getClass() + .getName() + .lastIndexOf(".") + 1); } public static void removePotion(EntityLivingBase aPlayer, int aPotionIndex) { @@ -434,7 +449,9 @@ public class GT_Utility { } public static byte getOppositeSide(int aSide) { - return (byte) ForgeDirection.getOrientation(aSide).getOpposite().ordinal(); + return (byte) ForgeDirection.getOrientation(aSide) + .getOpposite() + .ordinal(); } public static byte getTier(long l) { @@ -489,8 +506,8 @@ public class GT_Utility { checkAvailabilities(); if (TE_CHECK && aTileEntity instanceof IItemDuct) return true; if (BC_CHECK && aTileEntity instanceof buildcraft.api.transport.IPipeTile) - return ((buildcraft.api.transport.IPipeTile) aTileEntity) - .isPipeConnected(ForgeDirection.getOrientation(aSide)); + return ((buildcraft.api.transport.IPipeTile) aTileEntity).isPipeConnected( + ForgeDirection.getOrientation(aSide)); return GregTech_API.mTranslocator && aTileEntity instanceof codechicken.translocator.TileItemTranslocator; } @@ -548,8 +565,9 @@ public class GT_Utility { aTileEntity1.getStackInSlot(aGrabSlot).stackSize, Math.min(aMaxMoveAtOnce, aMaxTargetStackSize)), aTileEntity1.getStackInSlot(aGrabSlot)); - ItemStack rStack = ((IItemDuct) aTileEntity2) - .insertItem(ForgeDirection.getOrientation(aPutTo), copyOrNull(tStack)); + ItemStack rStack = ((IItemDuct) aTileEntity2).insertItem( + ForgeDirection.getOrientation(aPutTo), + copyOrNull(tStack)); byte tMovedItemCount = (byte) (tStack.stackSize - (rStack == null ? 0 : rStack.stackSize)); if (tMovedItemCount >= 1 /* Math.max(aMinMoveAtOnce, aMinTargetStackSize) */) { @@ -580,14 +598,15 @@ public class GT_Utility { aTileEntity1.getStackInSlot(aGrabSlot).stackSize, Math.min(aMaxMoveAtOnce, aMaxTargetStackSize)), aTileEntity1.getStackInSlot(aGrabSlot)); - byte tMovedItemCount = (byte) ((buildcraft.api.transport.IPipeTile) aTileEntity2) - .injectItem(copyOrNull(tStack), false, ForgeDirection.getOrientation(aPutTo)); + byte tMovedItemCount = (byte) ((buildcraft.api.transport.IPipeTile) aTileEntity2).injectItem( + copyOrNull(tStack), + false, + ForgeDirection.getOrientation(aPutTo)); if (tMovedItemCount >= Math.max(aMinMoveAtOnce, aMinTargetStackSize)) { - tMovedItemCount = (byte) (((buildcraft.api.transport.IPipeTile) aTileEntity2) - .injectItem( - copyAmount(tMovedItemCount, tStack), - true, - ForgeDirection.getOrientation(aPutTo))); + tMovedItemCount = (byte) (((buildcraft.api.transport.IPipeTile) aTileEntity2).injectItem( + copyAmount(tMovedItemCount, tStack), + true, + ForgeDirection.getOrientation(aPutTo))); aTileEntity1.decrStackSize(aGrabSlot, tMovedItemCount); aTileEntity1.markDirty(); return tMovedItemCount; @@ -628,7 +647,8 @@ public class GT_Utility { tZ + 0.5, tStack); tEntity.motionX = tEntity.motionY = tEntity.motionZ = 0; - ((TileEntity) aTileEntity1).getWorldObj().spawnEntityInWorld(tEntity); + ((TileEntity) aTileEntity1).getWorldObj() + .spawnEntityInWorld(tEntity); aTileEntity1.decrStackSize(aGrabSlot, tStack.stackSize); aTileEntity1.markDirty(); return (byte) tStack.stackSize; @@ -669,8 +689,9 @@ public class GT_Utility { Math.min( tStack2 == null ? Integer.MAX_VALUE : tStack2.getMaxStackSize(), aTileEntity2.getInventoryStackLimit()))); - tStack3.stackSize = Math - .min(tStack3.stackSize, aMaxTargetStackSize - (tStack2 == null ? 0 : tStack2.stackSize)); + tStack3.stackSize = Math.min( + tStack3.stackSize, + aMaxTargetStackSize - (tStack2 == null ? 0 : tStack2.stackSize)); if (tStack3.stackSize > aMaxMoveAtOnce) tStack3.stackSize = aMaxMoveAtOnce; if (tStack3.stackSize + (tStack2 == null ? 0 : tStack2.stackSize) >= Math.min(tStack3.getMaxStackSize(), aMinTargetStackSize) @@ -831,7 +852,8 @@ public class GT_Utility { (Math.min(s.getMaxStackSize(), tPutInventory.getInventoryStackLimit()) - s.stackSize), Integer::sum); - tPutItemStacks.computeIfAbsent(sID, k -> new ArrayList<>()).add(s); + tPutItemStacks.computeIfAbsent(sID, k -> new ArrayList<>()) + .add(s); } } @@ -931,15 +953,16 @@ public class GT_Utility { if (s != null) { // s might be null if tPutInventory is very special, e.g. infinity chest // if s is null, we will not mark this slot as target candidate for anything - final int spare = Math - .min(s.getMaxStackSize(), tPutInventory.getInventoryStackLimit()) - - s.stackSize; + final int spare = Math.min( + s.getMaxStackSize(), + tPutInventory.getInventoryStackLimit()) - s.stackSize; if (spare > 0) { final ItemId ssID = ItemId.createNoCopy(s); // add back to spare space count tPutItems.merge(ssID, spare, Integer::sum); // add to partially filled slot list - tPutItemStacks.computeIfAbsent(ssID, k -> new ArrayList<>()).add(s); + tPutItemStacks.computeIfAbsent(ssID, k -> new ArrayList<>()) + .add(s); } // this is no longer free tPutFreeSlots.remove(i); @@ -1653,9 +1676,12 @@ public class GT_Utility { public static boolean areStacksOrToolsEqual(ItemStack aStack1, ItemStack aStack2) { if (aStack1 != null && aStack2 != null && aStack1.getItem() == aStack2.getItem()) { - if (aStack1.getItem().isDamageable()) return true; + if (aStack1.getItem() + .isDamageable()) + return true; return ((aStack1.getTagCompound() == null) == (aStack2.getTagCompound() == null)) - && (aStack1.getTagCompound() == null || aStack1.getTagCompound().equals(aStack2.getTagCompound())) + && (aStack1.getTagCompound() == null || aStack1.getTagCompound() + .equals(aStack2.getTagCompound())) && (Items.feather.getDamage(aStack1) == Items.feather.getDamage(aStack2) || Items.feather.getDamage(aStack1) == W || Items.feather.getDamage(aStack2) == W); @@ -1682,8 +1708,8 @@ public class GT_Utility { return aStack1 != null && aStack2 != null && aStack1.getItem() == aStack2.getItem() && (aIgnoreNBT || (((aStack1.getTagCompound() == null) == (aStack2.getTagCompound() == null)) - && (aStack1.getTagCompound() == null - || aStack1.getTagCompound().equals(aStack2.getTagCompound())))) + && (aStack1.getTagCompound() == null || aStack1.getTagCompound() + .equals(aStack2.getTagCompound())))) && (Items.feather.getDamage(aStack1) == Items.feather.getDamage(aStack2) || Items.feather.getDamage(aStack1) == W || Items.feather.getDamage(aStack2) == W); @@ -1728,8 +1754,9 @@ public class GT_Utility { public static String getFluidName(Fluid aFluid, boolean aLocalized) { if (aFluid == null) return E; String rName = aLocalized ? aFluid.getLocalizedName(new FluidStack(aFluid, 0)) : aFluid.getUnlocalizedName(); - if (rName.contains("fluid.") || rName.contains("tile.")) - return capitalizeString(rName.replaceAll("fluid.", E).replaceAll("tile.", E)); + if (rName.contains("fluid.") || rName.contains("tile.")) return capitalizeString( + rName.replaceAll("fluid.", E) + .replaceAll("tile.", E)); return rName; } @@ -1745,8 +1772,8 @@ public class GT_Utility { sFluidUnlocalizedNameToFluid.clear(); for (FluidContainerData tData : sFluidContainerList) { sFilledContainerToData.put(new GT_ItemStack(tData.filledContainer), tData); - Map<Fluid, FluidContainerData> tFluidToContainer = sEmptyContainerToFluidToData - .get(new GT_ItemStack(tData.emptyContainer)); + Map<Fluid, FluidContainerData> tFluidToContainer = sEmptyContainerToFluidToData.get( + new GT_ItemStack(tData.emptyContainer)); List<ItemStack> tContainers = sFluidToContainers.get(tData.fluid.getFluid()); if (tFluidToContainer == null) { sEmptyContainerToFluidToData.put( @@ -1761,7 +1788,8 @@ public class GT_Utility { sFluidToContainers.put(tData.fluid.getFluid(), tContainers); } else tContainers.add(tData.filledContainer); } - for (Fluid tFluid : FluidRegistry.getRegisteredFluids().values()) { + for (Fluid tFluid : FluidRegistry.getRegisteredFluids() + .values()) { sFluidUnlocalizedNameToFluid.put(tFluid.getUnlocalizedName(), tFluid); } } @@ -1773,12 +1801,13 @@ public class GT_Utility { public static void addFluidContainerData(FluidContainerData aData) { sFluidContainerList.add(aData); sFilledContainerToData.put(new GT_ItemStack(aData.filledContainer), aData); - Map<Fluid, FluidContainerData> tFluidToContainer = sEmptyContainerToFluidToData - .get(new GT_ItemStack(aData.emptyContainer)); + Map<Fluid, FluidContainerData> tFluidToContainer = sEmptyContainerToFluidToData.get( + new GT_ItemStack(aData.emptyContainer)); List<ItemStack> tContainers = sFluidToContainers.get(aData.fluid.getFluid()); if (tFluidToContainer == null) { - sEmptyContainerToFluidToData - .put(new GT_ItemStack(aData.emptyContainer), tFluidToContainer = new /* Concurrent */ HashMap<>()); + sEmptyContainerToFluidToData.put( + new GT_ItemStack(aData.emptyContainer), + tFluidToContainer = new /* Concurrent */ HashMap<>()); GregTech_API.sFluidMappings.add(tFluidToContainer); } tFluidToContainer.put(aData.fluid.getFluid(), aData); @@ -1811,8 +1840,10 @@ public class GT_Utility { if (aCheckIFluidContainerItems && aStack.getItem() instanceof IFluidContainerItem && ((IFluidContainerItem) aStack.getItem()).getFluid(aStack) == null && ((IFluidContainerItem) aStack.getItem()).getCapacity(aStack) <= aFluid.amount) { - if (aRemoveFluidDirectly) aFluid.amount -= ((IFluidContainerItem) aStack.getItem()) - .fill(aStack = copyAmount(1, aStack), aFluid, true); + if (aRemoveFluidDirectly) aFluid.amount -= ((IFluidContainerItem) aStack.getItem()).fill( + aStack = copyAmount(1, aStack), + aFluid, + true); else((IFluidContainerItem) aStack.getItem()).fill(aStack = copyAmount(1, aStack), aFluid, true); return aStack; } @@ -1841,15 +1872,22 @@ public class GT_Utility { if (aFluid == null || aFluid.getFluid() == null) return null; int tmp = 0; try { - tmp = aFluid.getFluid().getID(); + tmp = aFluid.getFluid() + .getID(); } catch (Exception e) { System.err.println(e); } ItemStack rStack = ItemList.Display_Fluid.getWithDamage(1, tmp); NBTTagCompound tNBT = new NBTTagCompound(); tNBT.setLong("mFluidDisplayAmount", aUseStackSize ? aFluid.amount : 0); - tNBT.setLong("mFluidDisplayHeat", aFluid.getFluid().getTemperature(aFluid)); - tNBT.setBoolean("mFluidState", aFluid.getFluid().isGaseous(aFluid)); + tNBT.setLong( + "mFluidDisplayHeat", + aFluid.getFluid() + .getTemperature(aFluid)); + tNBT.setBoolean( + "mFluidState", + aFluid.getFluid() + .isGaseous(aFluid)); tNBT.setBoolean("mHideStackSize", aHideStackSize); try { tNBT.setString("mFluidMaterialName", FLUID_MAP.get(aFluid.getFluid()).mName); @@ -1862,16 +1900,21 @@ public class GT_Utility { if (!isStackValid(aDisplayStack) || aDisplayStack.getItem() != ItemList.Display_Fluid.getItem() || !aDisplayStack.hasTagCompound()) return null; - Fluid tFluid = FluidRegistry.getFluid(ItemList.Display_Fluid.getItem().getDamage(aDisplayStack)); - return new FluidStack(tFluid, (int) aDisplayStack.getTagCompound().getLong("mFluidDisplayAmount")); + Fluid tFluid = FluidRegistry.getFluid( + ItemList.Display_Fluid.getItem() + .getDamage(aDisplayStack)); + return new FluidStack( + tFluid, + (int) aDisplayStack.getTagCompound() + .getLong("mFluidDisplayAmount")); } public static boolean containsFluid(ItemStack aStack, FluidStack aFluid, boolean aCheckIFluidContainerItems) { if (isStackInvalid(aStack) || aFluid == null) return false; if (aCheckIFluidContainerItems && aStack.getItem() instanceof IFluidContainerItem && ((IFluidContainerItem) aStack.getItem()).getCapacity(aStack) > 0) - return aFluid - .isFluidEqual(((IFluidContainerItem) aStack.getItem()).getFluid(aStack = copyAmount(1, aStack))); + return aFluid.isFluidEqual( + ((IFluidContainerItem) aStack.getItem()).getFluid(aStack = copyAmount(1, aStack))); FluidContainerData tData = sFilledContainerToData.get(new GT_ItemStack(aStack)); return tData != null && tData.fluid.isFluidEqual(aFluid); } @@ -1906,7 +1949,10 @@ public class GT_Utility { */ public static ItemStack getContainerItem(ItemStack aStack, boolean aCheckIFluidContainerItems) { if (isStackInvalid(aStack)) return null; - if (aStack.getItem().hasContainerItem(aStack)) return aStack.getItem().getContainerItem(aStack); + if (aStack.getItem() + .hasContainerItem(aStack)) + return aStack.getItem() + .getContainerItem(aStack); /** * These are all special Cases, in which it is intended to have only GT Blocks outputting those Container Items */ @@ -1945,12 +1991,13 @@ public class GT_Utility { if ((isStackInvalid(aInput) && isStackInvalid(aOutput) && isStackInvalid(aContainer)) || aRecipeList == null) return false; boolean rReturn = false; - Iterator<Map.Entry<ic2.api.recipe.ICannerBottleRecipeManager.Input, RecipeOutput>> tIterator = aRecipeList - .entrySet().iterator(); + Iterator<Map.Entry<ic2.api.recipe.ICannerBottleRecipeManager.Input, RecipeOutput>> tIterator = aRecipeList.entrySet() + .iterator(); aOutput = GT_OreDictUnificator.get(aOutput); while (tIterator.hasNext()) { Map.Entry<ic2.api.recipe.ICannerBottleRecipeManager.Input, RecipeOutput> tEntry = tIterator.next(); - if (aInput == null || tEntry.getKey().matches(aContainer, aInput)) { + if (aInput == null || tEntry.getKey() + .matches(aContainer, aInput)) { List<ItemStack> tList = tEntry.getValue().items; if (tList != null) for (ItemStack tOutput : tList) if (aOutput == null || areStacksEqual(GT_OreDictUnificator.get(tOutput), aOutput)) { @@ -1967,11 +2014,13 @@ public class GT_Utility { Map<IRecipeInput, RecipeOutput> aRecipeList, ItemStack aOutput) { if ((isStackInvalid(aInput) && isStackInvalid(aOutput)) || aRecipeList == null) return false; boolean rReturn = false; - Iterator<Map.Entry<IRecipeInput, RecipeOutput>> tIterator = aRecipeList.entrySet().iterator(); + Iterator<Map.Entry<IRecipeInput, RecipeOutput>> tIterator = aRecipeList.entrySet() + .iterator(); aOutput = GT_OreDictUnificator.get(aOutput); while (tIterator.hasNext()) { Map.Entry<IRecipeInput, RecipeOutput> tEntry = tIterator.next(); - if (aInput == null || tEntry.getKey().matches(aInput)) { + if (aInput == null || tEntry.getKey() + .matches(aInput)) { List<ItemStack> tList = tEntry.getValue().items; if (tList != null) for (ItemStack tOutput : tList) if (aOutput == null || areStacksEqual(GT_OreDictUnificator.get(tOutput), aOutput)) { @@ -1987,20 +2036,32 @@ public class GT_Utility { public static synchronized void bulkRemoveSimpleIC2MachineRecipe(Map<ItemStack, ItemStack> toRemove, Map<IRecipeInput, RecipeOutput> aRecipeList) { if (aRecipeList == null || aRecipeList.isEmpty()) return; - toRemove.entrySet().removeIf(aEntry -> (isStackInvalid(aEntry.getKey()) && isStackInvalid(aEntry.getValue()))); - final Map<ItemStack, ItemStack> finalToRemove = Maps - .transformValues(toRemove, GT_OreDictUnificator::get_nocopy); - - aRecipeList.entrySet().removeIf(tEntry -> finalToRemove.entrySet().stream().anyMatch(aEntry -> { - final ItemStack aInput = aEntry.getKey(), aOutput = aEntry.getValue(); - final List<ItemStack> tList = tEntry.getValue().items; - - if (tList == null) return false; - if (aInput != null && !tEntry.getKey().matches(aInput)) return false; - - return tList.stream().anyMatch( - tOutput -> (aOutput == null || areStacksEqual(GT_OreDictUnificator.get(tOutput), aOutput))); - })); + toRemove.entrySet() + .removeIf(aEntry -> (isStackInvalid(aEntry.getKey()) && isStackInvalid(aEntry.getValue()))); + final Map<ItemStack, ItemStack> finalToRemove = Maps.transformValues( + toRemove, + GT_OreDictUnificator::get_nocopy); + + aRecipeList.entrySet() + .removeIf( + tEntry -> finalToRemove.entrySet() + .stream() + .anyMatch(aEntry -> { + final ItemStack aInput = aEntry.getKey(), + aOutput = aEntry.getValue(); + final List<ItemStack> tList = tEntry.getValue().items; + + if (tList == null) return false; + if (aInput != null && !tEntry.getKey() + .matches(aInput)) + return false; + + return tList.stream() + .anyMatch( + tOutput -> (aOutput == null || areStacksEqual( + GT_OreDictUnificator.get(tOutput), + aOutput))); + })); } public static boolean addSimpleIC2MachineRecipe(ItemStack aInput, Map<IRecipeInput, RecipeOutput> aRecipeList, @@ -2016,10 +2077,14 @@ public class GT_Utility { ItemStack[] tStack = GT_OreDictUnificator.getStackArray(true, aOutput); if (tStack.length > 0 && areStacksEqual(aInput, tStack[0])) return false; if (tOreName != null) { - if (tOreName.toString().equals("dustAsh") && tStack[0].getUnlocalizedName().equals("tile.volcanicAsh")) + if (tOreName.toString() + .equals("dustAsh") + && tStack[0].getUnlocalizedName() + .equals("tile.volcanicAsh")) return false; - aRecipeList - .put(new RecipeInputOreDict(tOreName.toString(), aInput.stackSize), new RecipeOutput(aNBT, tStack)); + aRecipeList.put( + new RecipeInputOreDict(tOreName.toString(), aInput.stackSize), + new RecipeOutput(aNBT, tStack)); } else { aRecipeList.put( new RecipeInputItemStack(copyOrNull(aInput), aInput.stackSize), @@ -2051,8 +2116,9 @@ public class GT_Utility { tNBT.setString("author", aAuthor); NBTTagList tNBTList = new NBTTagList(); for (byte i = 0; i < aPages.length; i++) { - aPages[i] = GT_LanguageManager - .addStringLocalization("Book." + aTitle + ".Page" + ((i < 10) ? "0" + i : i), aPages[i]); + aPages[i] = GT_LanguageManager.addStringLocalization( + "Book." + aTitle + ".Page" + ((i < 10) ? "0" + i : i), + aPages[i]); if (i < 48) { if (aPages[i].length() < 256) tNBTList.appendTag(new NBTTagString(aPages[i])); else GT_Log.err.println("WARNING: String for written Book too long! -> " + aPages[i]); @@ -2160,7 +2226,10 @@ public class GT_Utility { public static boolean doSoundAtClient(ResourceLocation aSoundResourceLocation, int aTimeUntilNextSound, float aSoundStrength, float aSoundModulation, double aX, double aY, double aZ) { - if (!FMLCommonHandler.instance().getEffectiveSide().isClient() || GT.getThePlayer() == null + if (!FMLCommonHandler.instance() + .getEffectiveSide() + .isClient() + || GT.getThePlayer() == null || !GT.getThePlayer().worldObj.isRemote) return false; if (GregTech_API.sMultiThreadedSounds) new Thread( @@ -2328,11 +2397,13 @@ public class GT_Utility { } public static boolean isStringValid(Object aString) { - return aString != null && !aString.toString().isEmpty(); + return aString != null && !aString.toString() + .isEmpty(); } public static boolean isStringInvalid(Object aString) { - return aString == null || aString.toString().isEmpty(); + return aString == null || aString.toString() + .isEmpty(); } public static boolean isStackValid(Object aStack) { @@ -2360,31 +2431,49 @@ public class GT_Utility { } public static boolean isOpaqueBlock(World aWorld, int aX, int aY, int aZ) { - return aWorld.getBlock(aX, aY, aZ).isOpaqueCube(); + return aWorld.getBlock(aX, aY, aZ) + .isOpaqueCube(); } public static boolean isBlockAir(World aWorld, int aX, int aY, int aZ) { - return aWorld.getBlock(aX, aY, aZ).isAir(aWorld, aX, aY, aZ); + return aWorld.getBlock(aX, aY, aZ) + .isAir(aWorld, aX, aY, aZ); } public static boolean hasBlockHitBox(World aWorld, int aX, int aY, int aZ) { - return aWorld.getBlock(aX, aY, aZ).getCollisionBoundingBoxFromPool(aWorld, aX, aY, aZ) != null; + return aWorld.getBlock(aX, aY, aZ) + .getCollisionBoundingBoxFromPool(aWorld, aX, aY, aZ) + != null; } public static void setCoordsOnFire(World aWorld, int aX, int aY, int aZ, boolean aReplaceCenter) { - if (aReplaceCenter) if (aWorld.getBlock(aX, aY, aZ).getCollisionBoundingBoxFromPool(aWorld, aX, aY, aZ) == null) + if (aReplaceCenter) if (aWorld.getBlock(aX, aY, aZ) + .getCollisionBoundingBoxFromPool(aWorld, aX, aY, aZ) + == null) aWorld.setBlock(aX, aY, aZ, Blocks.fire); - if (aWorld.getBlock(aX + 1, aY, aZ).getCollisionBoundingBoxFromPool(aWorld, aX + 1, aY, aZ) == null) + if (aWorld.getBlock(aX + 1, aY, aZ) + .getCollisionBoundingBoxFromPool(aWorld, aX + 1, aY, aZ) + == null) aWorld.setBlock(aX + 1, aY, aZ, Blocks.fire); - if (aWorld.getBlock(aX - 1, aY, aZ).getCollisionBoundingBoxFromPool(aWorld, aX - 1, aY, aZ) == null) + if (aWorld.getBlock(aX - 1, aY, aZ) + .getCollisionBoundingBoxFromPool(aWorld, aX - 1, aY, aZ) + == null) aWorld.setBlock(aX - 1, aY, aZ, Blocks.fire); - if (aWorld.getBlock(aX, aY + 1, aZ).getCollisionBoundingBoxFromPool(aWorld, aX, aY + 1, aZ) == null) + if (aWorld.getBlock(aX, aY + 1, aZ) + .getCollisionBoundingBoxFromPool(aWorld, aX, aY + 1, aZ) + == null) aWorld.setBlock(aX, aY + 1, aZ, Blocks.fire); - if (aWorld.getBlock(aX, aY - 1, aZ).getCollisionBoundingBoxFromPool(aWorld, aX, aY - 1, aZ) == null) + if (aWorld.getBlock(aX, aY - 1, aZ) + .getCollisionBoundingBoxFromPool(aWorld, aX, aY - 1, aZ) + == null) aWorld.setBlock(aX, aY - 1, aZ, Blocks.fire); - if (aWorld.getBlock(aX, aY, aZ + 1).getCollisionBoundingBoxFromPool(aWorld, aX, aY, aZ + 1) == null) + if (aWorld.getBlock(aX, aY, aZ + 1) + .getCollisionBoundingBoxFromPool(aWorld, aX, aY, aZ + 1) + == null) aWorld.setBlock(aX, aY, aZ + 1, Blocks.fire); - if (aWorld.getBlock(aX, aY, aZ - 1).getCollisionBoundingBoxFromPool(aWorld, aX, aY, aZ - 1) == null) + if (aWorld.getBlock(aX, aY, aZ - 1) + .getCollisionBoundingBoxFromPool(aWorld, aX, aY, aZ - 1) + == null) aWorld.setBlock(aX, aY, aZ - 1, Blocks.fire); } @@ -2955,8 +3044,10 @@ public class GT_Utility { } public static <X, Y extends Comparable<Y>> LinkedHashMap<X, Y> sortMapByValuesAcending(Map<X, Y> map) { - return map.entrySet().stream().sorted(Entry.comparingByValue()) - .collect(CollectorUtils.entriesToMap(LinkedHashMap::new)); + return map.entrySet() + .stream() + .sorted(Entry.comparingByValue()) + .collect(CollectorUtils.entriesToMap(LinkedHashMap::new)); } /** @@ -2965,7 +3056,8 @@ public class GT_Utility { public static <X, Y extends Comparable> LinkedHashMap<X, Y> sortMapByValuesDescending(Map<X, Y> aMap) { List<Map.Entry<X, Y>> tEntrySet = new LinkedList<>(aMap.entrySet()); tEntrySet.sort((aValue1, aValue2) -> { - return aValue2.getValue().compareTo(aValue1.getValue()); // FB: RV - RV_NEGATING_RESULT_OF_COMPARETO + return aValue2.getValue() + .compareTo(aValue1.getValue()); // FB: RV - RV_NEGATING_RESULT_OF_COMPARETO }); LinkedHashMap<X, Y> rMap = new LinkedHashMap<>(); for (Map.Entry<X, Y> tEntry : tEntrySet) rMap.put(tEntry.getKey(), tEntry.getValue()); @@ -3009,8 +3101,9 @@ public class GT_Utility { if (entity.riddenByEntity != null) entity.riddenByEntity.mountEntity(null); World startWorld = entity.worldObj; - World destinationWorld = FMLCommonHandler.instance().getMinecraftServerInstance() - .worldServerForDimension(aDimension); + World destinationWorld = FMLCommonHandler.instance() + .getMinecraftServerInstance() + .worldServerForDimension(aDimension); if (destinationWorld == null) { return false; @@ -3028,16 +3121,20 @@ public class GT_Utility { new S07PacketRespawn( player.dimension, player.worldObj.difficultySetting, - destinationWorld.getWorldInfo().getTerrainType(), + destinationWorld.getWorldInfo() + .getTerrainType(), player.theItemInWorldManager.getGameType())); - ((WorldServer) startWorld).getPlayerManager().removePlayer(player); + ((WorldServer) startWorld).getPlayerManager() + .removePlayer(player); startWorld.playerEntities.remove(player); startWorld.updateAllPlayersSleepingFlag(); int i = entity.chunkCoordX; int j = entity.chunkCoordZ; - if ((entity.addedToChunk) && (startWorld.getChunkProvider().chunkExists(i, j))) { - startWorld.getChunkFromChunkCoords(i, j).removeEntity(entity); + if ((entity.addedToChunk) && (startWorld.getChunkProvider() + .chunkExists(i, j))) { + startWorld.getChunkFromChunkCoords(i, j) + .removeEntity(entity); startWorld.getChunkFromChunkCoords(i, j).isModified = true; } startWorld.loadedEntityList.remove(entity); @@ -3073,7 +3170,8 @@ public class GT_Utility { if ((entity instanceof EntityPlayerMP)) { EntityPlayerMP player = (EntityPlayerMP) entity; if (interDimensional) { - player.mcServer.getConfigurationManager().func_72375_a(player, (WorldServer) destinationWorld); + player.mcServer.getConfigurationManager() + .func_72375_a(player, (WorldServer) destinationWorld); } player.playerNetServerHandler.setPlayerLocation(aX, aY, aZ, player.rotationYaw, player.rotationPitch); } @@ -3084,8 +3182,9 @@ public class GT_Utility { EntityPlayerMP player = (EntityPlayerMP) entity; player.theItemInWorldManager.setWorld((WorldServer) destinationWorld); player.mcServer.getConfigurationManager() - .updateTimeAndWeatherForPlayer(player, (WorldServer) destinationWorld); - player.mcServer.getConfigurationManager().syncPlayerInventory(player); + .updateTimeAndWeatherForPlayer(player, (WorldServer) destinationWorld); + player.mcServer.getConfigurationManager() + .syncPlayerInventory(player); for (PotionEffect potionEffect : (Iterable<PotionEffect>) player.getActivePotionEffects()) { player.playerNetServerHandler.sendPacket(new S1DPacketEntityEffect(player.getEntityId(), potionEffect)); @@ -3093,10 +3192,11 @@ public class GT_Utility { player.playerNetServerHandler.sendPacket( new S1FPacketSetExperience(player.experience, player.experienceTotal, player.experienceLevel)); - FMLCommonHandler.instance().firePlayerChangedDimensionEvent( - player, - startWorld.provider.dimensionId, - destinationWorld.provider.dimensionId); + FMLCommonHandler.instance() + .firePlayerChangedDimensionEvent( + player, + startWorld.provider.dimensionId, + destinationWorld.provider.dimensionId); } entity.setLocationAndAngles(aX, aY, aZ, entity.rotationYaw, entity.rotationPitch); @@ -3181,8 +3281,8 @@ public class GT_Utility { try { if (tTileEntity instanceof IFluidHandler) { rEUAmount += 500; - final FluidTankInfo[] tTanks = ((IFluidHandler) tTileEntity) - .getTankInfo(ForgeDirection.getOrientation(aSide)); + final FluidTankInfo[] tTanks = ((IFluidHandler) tTileEntity).getTankInfo( + ForgeDirection.getOrientation(aSide)); if (tTanks != null) for (byte i = 0; i < tTanks.length; i++) { tList.add( GT_Utility.trans("167", "Tank ") + i @@ -3335,7 +3435,7 @@ public class GT_Utility { if (tTileEntity instanceof ICoverable) { rEUAmount += 300; final String tString = ((ICoverable) tTileEntity).getCoverInfoAtSide((byte) aSide) - .getBehaviorDescription(); + .getBehaviorDescription(); if (tString != null && !tString.equals(E)) tList.add(tString); } } catch (Throwable e) { @@ -3406,7 +3506,8 @@ public class GT_Utility { if (crop.getScanLevel() < 4) crop.setScanLevel((byte) 4); if (crop.getCrop() != null) { tList.add( - GT_Utility.trans("187", "Type -- Crop-Name: ") + crop.getCrop().name() + GT_Utility.trans("187", "Type -- Crop-Name: ") + crop.getCrop() + .name() + GT_Utility.trans("188", " Growth: ") + crop.getGrowth() + GT_Utility.trans("189", " Gain: ") @@ -3430,12 +3531,16 @@ public class GT_Utility { + crop.getAirQuality()); if (crop.getCrop() != null) { final StringBuilder tStringB = new StringBuilder(); - for (String tAttribute : crop.getCrop().attributes()) { - tStringB.append(", ").append(tAttribute); + for (String tAttribute : crop.getCrop() + .attributes()) { + tStringB.append(", ") + .append(tAttribute); } final String tString = tStringB.toString(); tList.add(GT_Utility.trans("198", "Attributes:") + tString.replaceFirst(",", E)); - tList.add(GT_Utility.trans("199", "Discovered by: ") + crop.getCrop().discoveredBy()); + tList.add( + GT_Utility.trans("199", "Discovered by: ") + crop.getCrop() + .discoveredBy()); } } } catch (Throwable e) { @@ -3677,7 +3782,8 @@ public class GT_Utility { } public static float getBlockHardnessAt(World aWorld, int aX, int aY, int aZ) { - return aWorld.getBlock(aX, aY, aZ).getBlockHardness(aWorld, aX, aY, aZ); + return aWorld.getBlock(aX, aY, aZ) + .getBlockHardness(aWorld, aX, aY, aZ); } public static FakePlayer getFakePlayer(IGregTechTileEntity aBaseMetaTileEntity) { @@ -3816,17 +3922,21 @@ public class GT_Utility { String... aOres) { NBTTagCompound tNBT = getNBT(aStack); StringBuilder tData = new StringBuilder(aX + "," + aY + "," + aZ + "," + aDim + ","); - if (aFluid != null) tData.append(aFluid.amount).append(",").append(aFluid.getLocalizedName()).append(","); // TODO - // CHECK - // IF - // THAT - // /5000 - // is - // needed - // (Not - // needed) + if (aFluid != null) tData.append(aFluid.amount) + .append(",") + .append(aFluid.getLocalizedName()) + .append(","); // TODO + // CHECK + // IF + // THAT + // /5000 + // is + // needed + // (Not + // needed) for (String tString : aOres) { - tData.append(tString).append(","); + tData.append(tString) + .append(","); } tNBT.setString("prospection", tData.toString()); setNBT(aStack, tNBT); @@ -3915,7 +4025,8 @@ public class GT_Utility { NBTTagList tNBTList = new NBTTagList(); StringBuilder tOres = new StringBuilder(" Prospected Ores: "); for (int i = 6; tDataArray.length > i; i++) { - tOres.append(tDataArray[i]).append(" "); + tOres.append(tDataArray[i]) + .append(" "); } tNBTList.appendTag( new NBTTagString( @@ -3994,7 +4105,8 @@ public class GT_Utility { do { tPageText = new StringBuilder(); for (int i = tPage * aItemsPerPage; i < (tPage + 1) * aItemsPerPage && i < list.length; i += 1) - tPageText.append((tPageText.length() == 0) ? "" : aListDelimiter).append(list[i]); + tPageText.append((tPageText.length() == 0) ? "" : aListDelimiter) + .append(list[i]); if (tPageText.length() > 0) { String tPageCounter = tTotalPages > 1 ? String.format(aPageFormatter, tPage + 1, tTotalPages) : ""; @@ -4047,8 +4159,10 @@ public class GT_Utility { if (nbttaglist != null) { try { for (int i = 0; i < nbttaglist.tagCount(); ++i) { - short short1 = nbttaglist.getCompoundTagAt(i).getShort("id"); - short short2 = nbttaglist.getCompoundTagAt(i).getShort("lvl"); + short short1 = nbttaglist.getCompoundTagAt(i) + .getShort("id"); + short short2 = nbttaglist.getCompoundTagAt(i) + .getShort("lvl"); if (Enchantment.enchantmentsList[short1] != null) aBullshitModifier.calculateModifier(Enchantment.enchantmentsList[short1], short2); } @@ -4115,7 +4229,8 @@ public class GT_Utility { } public static String toSubscript(long no) { - char[] chars = Long.toString(no).toCharArray(); + char[] chars = Long.toString(no) + .toCharArray(); for (int i = 0; i < chars.length; i++) { chars[i] += 8272; } @@ -4139,7 +4254,9 @@ public class GT_Utility { public static boolean isOre(Block aBlock, int aMeta) { return (aBlock instanceof GT_Block_Ores_Abstract) || isOre(new ItemStack(aBlock, 1, aMeta)) - || ORE_BLOCK_CLASSES.contains(aBlock.getClass().getName()); + || ORE_BLOCK_CLASSES.contains( + aBlock.getClass() + .getName()); } public static boolean isOre(ItemStack aStack) { @@ -4148,7 +4265,8 @@ public class GT_Utility { return sOreTable.get(tItem); } for (int id : OreDictionary.getOreIDs(aStack)) { - if (OreDictionary.getOreName(id).startsWith("ore")) { + if (OreDictionary.getOreName(id) + .startsWith("ore")) { sOreTable.put(tItem, true); return true; } @@ -4166,8 +4284,8 @@ public class GT_Utility { // We take the modulus of the metadata by 16000 because that is the magic number to convert small ores to // regular ores. // See: GT_TileEntity_Ores.java - ItemData association = GT_OreDictUnificator - .getAssociation(new ItemStack(Item.getItemFromBlock(ore), 1, metaData % 16000)); + ItemData association = GT_OreDictUnificator.getAssociation( + new ItemStack(Item.getItemFromBlock(ore), 1, metaData % 16000)); if (association != null) { Supplier<ItemStack> supplier = sOreToCobble.get(association.mPrefix); if (supplier != null) { @@ -4191,9 +4309,12 @@ public class GT_Utility { } else if (o instanceof String) { ItemStack stack = GT_OreDictUnificator.get(o, 1); if (stack == null) { - Optional<ItemStack> oStack = OreDictionary.getOres((String) o).stream().findAny(); + Optional<ItemStack> oStack = OreDictionary.getOres((String) o) + .stream() + .findAny(); if (oStack.isPresent()) { - ItemStack copy = oStack.get().copy(); + ItemStack copy = oStack.get() + .copy(); inputs.add(copy); } } else { @@ -4258,9 +4379,12 @@ public class GT_Utility { if (ToolDictNames.contains(dictName)) continue; ItemStack stack = GT_OreDictUnificator.get(dictName, null, amount, false, true); if (stack == null) { - Optional<ItemStack> oStack = OreDictionary.getOres(dictName).stream().findAny(); + Optional<ItemStack> oStack = OreDictionary.getOres(dictName) + .stream() + .findAny(); if (oStack.isPresent()) { - ItemStack copy = oStack.get().copy(); + ItemStack copy = oStack.get() + .copy(); copy.stackSize = amount; inputs.add(copy); } @@ -4304,7 +4428,9 @@ public class GT_Utility { } public static long getNonnullElementCount(Object[] tArray) { - return Arrays.stream(tArray).filter(Objects::nonNull).count(); + return Arrays.stream(tArray) + .filter(Objects::nonNull) + .count(); } public static int clamp(int val, int lo, int hi) { @@ -4337,7 +4463,9 @@ public class GT_Utility { */ public static int persistentHash(FluidStack aStack, boolean aUseStackSize, boolean aUseNBT) { if (aStack == null) return 0; - int base = Objects.hashCode(aStack.getFluid().getName()); + int base = Objects.hashCode( + aStack.getFluid() + .getName()); if (aUseStackSize) base = base * 31 + aStack.amount; if (aUseNBT) base = base * 31 + Objects.hashCode(aStack.tag); @@ -4418,7 +4546,8 @@ public class GT_Utility { public static Stream<NBTTagCompound> streamCompounds(NBTTagList list) { if (list == null) return Stream.empty(); - return IntStream.range(0, list.tagCount()).mapToObj(list::getCompoundTagAt); + return IntStream.range(0, list.tagCount()) + .mapToObj(list::getCompoundTagAt); } public static boolean equals(ItemStack[] a, ItemStack[] b) { @@ -4471,7 +4600,9 @@ public class GT_Utility { Collection<Collection<E>> colls1 = null; for (Collection<E> list : lists) { if (list == null || list.isEmpty()) { - colls1 = lists.stream().filter(c -> c != null && !c.isEmpty()).collect(Collectors.toList()); + colls1 = lists.stream() + .filter(c -> c != null && !c.isEmpty()) + .collect(Collectors.toList()); break; } } @@ -4486,7 +4617,9 @@ public class GT_Utility { @Override public Iterator<E> iterator() { - return colls.stream().flatMap(Collection::stream).iterator(); + return colls.stream() + .flatMap(Collection::stream) + .iterator(); } @Override diff --git a/src/main/java/gregtech/api/util/GT_UtilityClient.java b/src/main/java/gregtech/api/util/GT_UtilityClient.java index 22bf2b746e..2b4039a4c2 100644 --- a/src/main/java/gregtech/api/util/GT_UtilityClient.java +++ b/src/main/java/gregtech/api/util/GT_UtilityClient.java @@ -14,8 +14,10 @@ import cpw.mods.fml.relauncher.ReflectionHelper; public class GT_UtilityClient { - private static final Field isDrawingField = ReflectionHelper - .findField(Tessellator.class, "isDrawing", "field_78415_z"); + private static final Field isDrawingField = ReflectionHelper.findField( + Tessellator.class, + "isDrawing", + "field_78415_z"); public static boolean isDrawing(Tessellator tess) { try { diff --git a/src/main/java/gregtech/api/util/LightingHelper.java b/src/main/java/gregtech/api/util/LightingHelper.java index 36d8f4cda3..25897487d2 100644 --- a/src/main/java/gregtech/api/util/LightingHelper.java +++ b/src/main/java/gregtech/api/util/LightingHelper.java @@ -351,55 +351,96 @@ public class LightingHelper { brightness = mixedBrightness; float ratio = (float) (1.0F - renderBlocks.renderMinX); - float aoLightValue = renderBlocks.blockAccess.getBlock(x - 1, y, z).getAmbientOcclusionLightValue(); - - renderBlocks.aoBrightnessXYNN = block - .getMixedBrightnessForBlock(renderBlocks.blockAccess, xOffset, y - 1, z); - renderBlocks.aoBrightnessXZNN = block - .getMixedBrightnessForBlock(renderBlocks.blockAccess, xOffset, y, z - 1); - renderBlocks.aoBrightnessXZNP = block - .getMixedBrightnessForBlock(renderBlocks.blockAccess, xOffset, y, z + 1); - renderBlocks.aoBrightnessXYNP = block - .getMixedBrightnessForBlock(renderBlocks.blockAccess, xOffset, y + 1, z); - renderBlocks.aoBrightnessXYZNNN = block - .getMixedBrightnessForBlock(renderBlocks.blockAccess, xOffset, y - 1, z - 1); - renderBlocks.aoBrightnessXYZNNP = block - .getMixedBrightnessForBlock(renderBlocks.blockAccess, xOffset, y - 1, z + 1); - renderBlocks.aoBrightnessXYZNPN = block - .getMixedBrightnessForBlock(renderBlocks.blockAccess, xOffset, y + 1, z - 1); - renderBlocks.aoBrightnessXYZNPP = block - .getMixedBrightnessForBlock(renderBlocks.blockAccess, xOffset, y + 1, z + 1); + float aoLightValue = renderBlocks.blockAccess.getBlock(x - 1, y, z) + .getAmbientOcclusionLightValue(); + + renderBlocks.aoBrightnessXYNN = block.getMixedBrightnessForBlock( + renderBlocks.blockAccess, + xOffset, + y - 1, + z); + renderBlocks.aoBrightnessXZNN = block.getMixedBrightnessForBlock( + renderBlocks.blockAccess, + xOffset, + y, + z - 1); + renderBlocks.aoBrightnessXZNP = block.getMixedBrightnessForBlock( + renderBlocks.blockAccess, + xOffset, + y, + z + 1); + renderBlocks.aoBrightnessXYNP = block.getMixedBrightnessForBlock( + renderBlocks.blockAccess, + xOffset, + y + 1, + z); + renderBlocks.aoBrightnessXYZNNN = block.getMixedBrightnessForBlock( + renderBlocks.blockAccess, + xOffset, + y - 1, + z - 1); + renderBlocks.aoBrightnessXYZNNP = block.getMixedBrightnessForBlock( + renderBlocks.blockAccess, + xOffset, + y - 1, + z + 1); + renderBlocks.aoBrightnessXYZNPN = block.getMixedBrightnessForBlock( + renderBlocks.blockAccess, + xOffset, + y + 1, + z - 1); + renderBlocks.aoBrightnessXYZNPP = block.getMixedBrightnessForBlock( + renderBlocks.blockAccess, + xOffset, + y + 1, + z + 1); renderBlocks.aoLightValueScratchXYNN = getMixedAo( - renderBlocks.blockAccess.getBlock(x - 1, y - 1, z).getAmbientOcclusionLightValue(), - renderBlocks.blockAccess.getBlock(x, y - 1, z).getAmbientOcclusionLightValue(), + renderBlocks.blockAccess.getBlock(x - 1, y - 1, z) + .getAmbientOcclusionLightValue(), + renderBlocks.blockAccess.getBlock(x, y - 1, z) + .getAmbientOcclusionLightValue(), ratio); renderBlocks.aoLightValueScratchXZNN = getMixedAo( - renderBlocks.blockAccess.getBlock(x - 1, y, z - 1).getAmbientOcclusionLightValue(), - renderBlocks.blockAccess.getBlock(x, y, z - 1).getAmbientOcclusionLightValue(), + renderBlocks.blockAccess.getBlock(x - 1, y, z - 1) + .getAmbientOcclusionLightValue(), + renderBlocks.blockAccess.getBlock(x, y, z - 1) + .getAmbientOcclusionLightValue(), ratio); renderBlocks.aoLightValueScratchXZNP = getMixedAo( - renderBlocks.blockAccess.getBlock(x - 1, y, z + 1).getAmbientOcclusionLightValue(), - renderBlocks.blockAccess.getBlock(x, y, z + 1).getAmbientOcclusionLightValue(), + renderBlocks.blockAccess.getBlock(x - 1, y, z + 1) + .getAmbientOcclusionLightValue(), + renderBlocks.blockAccess.getBlock(x, y, z + 1) + .getAmbientOcclusionLightValue(), ratio); renderBlocks.aoLightValueScratchXYNP = getMixedAo( - renderBlocks.blockAccess.getBlock(x - 1, y + 1, z).getAmbientOcclusionLightValue(), - renderBlocks.blockAccess.getBlock(x, y + 1, z).getAmbientOcclusionLightValue(), + renderBlocks.blockAccess.getBlock(x - 1, y + 1, z) + .getAmbientOcclusionLightValue(), + renderBlocks.blockAccess.getBlock(x, y + 1, z) + .getAmbientOcclusionLightValue(), ratio); renderBlocks.aoLightValueScratchXYZNNN = getMixedAo( - renderBlocks.blockAccess.getBlock(x - 1, y - 1, z - 1).getAmbientOcclusionLightValue(), - renderBlocks.blockAccess.getBlock(x, y - 1, z - 1).getAmbientOcclusionLightValue(), + renderBlocks.blockAccess.getBlock(x - 1, y - 1, z - 1) + .getAmbientOcclusionLightValue(), + renderBlocks.blockAccess.getBlock(x, y - 1, z - 1) + .getAmbientOcclusionLightValue(), ratio); renderBlocks.aoLightValueScratchXYZNNP = getMixedAo( - renderBlocks.blockAccess.getBlock(x - 1, y - 1, z + 1).getAmbientOcclusionLightValue(), - renderBlocks.blockAccess.getBlock(x, y - 1, z + 1).getAmbientOcclusionLightValue(), + renderBlocks.blockAccess.getBlock(x - 1, y - 1, z + 1) + .getAmbientOcclusionLightValue(), + renderBlocks.blockAccess.getBlock(x, y - 1, z + 1) + .getAmbientOcclusionLightValue(), ratio); renderBlocks.aoLightValueScratchXYZNPN = getMixedAo( - renderBlocks.blockAccess.getBlock(x - 1, y + 1, z - 1).getAmbientOcclusionLightValue(), - renderBlocks.blockAccess.getBlock(x, y + 1, z - 1).getAmbientOcclusionLightValue(), + renderBlocks.blockAccess.getBlock(x - 1, y + 1, z - 1) + .getAmbientOcclusionLightValue(), + renderBlocks.blockAccess.getBlock(x, y + 1, z - 1) + .getAmbientOcclusionLightValue(), ratio); renderBlocks.aoLightValueScratchXYZNPP = getMixedAo( - renderBlocks.blockAccess.getBlock(x - 1, y + 1, z + 1).getAmbientOcclusionLightValue(), - renderBlocks.blockAccess.getBlock(x, y + 1, z + 1).getAmbientOcclusionLightValue(), + renderBlocks.blockAccess.getBlock(x - 1, y + 1, z + 1) + .getAmbientOcclusionLightValue(), + renderBlocks.blockAccess.getBlock(x, y + 1, z + 1) + .getAmbientOcclusionLightValue(), ratio); int brightnessMixedXYZNPN = renderBlocks.getAoBrightness( @@ -519,55 +560,96 @@ public class LightingHelper { int mixedBrightness = block.getMixedBrightnessForBlock(renderBlocks.blockAccess, xOffset, y, z); brightness = mixedBrightness; - float aoLightValue = renderBlocks.blockAccess.getBlock(x + 1, y, z).getAmbientOcclusionLightValue(); - - renderBlocks.aoBrightnessXYPN = block - .getMixedBrightnessForBlock(renderBlocks.blockAccess, xOffset, y - 1, z); - renderBlocks.aoBrightnessXZPN = block - .getMixedBrightnessForBlock(renderBlocks.blockAccess, xOffset, y, z - 1); - renderBlocks.aoBrightnessXZPP = block - .getMixedBrightnessForBlock(renderBlocks.blockAccess, xOffset, y, z + 1); - renderBlocks.aoBrightnessXYPP = block - .getMixedBrightnessForBlock(renderBlocks.blockAccess, xOffset, y + 1, z); - renderBlocks.aoBrightnessXYZPNN = block - .getMixedBrightnessForBlock(renderBlocks.blockAccess, xOffset, y - 1, z - 1); - renderBlocks.aoBrightnessXYZPNP = block - .getMixedBrightnessForBlock(renderBlocks.blockAccess, xOffset, y - 1, z + 1); - renderBlocks.aoBrightnessXYZPPN = block - .getMixedBrightnessForBlock(renderBlocks.blockAccess, xOffset, y + 1, z - 1); - renderBlocks.aoBrightnessXYZPPP = block - .getMixedBrightnessForBlock(renderBlocks.blockAccess, xOffset, y + 1, z + 1); + float aoLightValue = renderBlocks.blockAccess.getBlock(x + 1, y, z) + .getAmbientOcclusionLightValue(); + + renderBlocks.aoBrightnessXYPN = block.getMixedBrightnessForBlock( + renderBlocks.blockAccess, + xOffset, + y - 1, + z); + renderBlocks.aoBrightnessXZPN = block.getMixedBrightnessForBlock( + renderBlocks.blockAccess, + xOffset, + y, + z - 1); + renderBlocks.aoBrightnessXZPP = block.getMixedBrightnessForBlock( + renderBlocks.blockAccess, + xOffset, + y, + z + 1); + renderBlocks.aoBrightnessXYPP = block.getMixedBrightnessForBlock( + renderBlocks.blockAccess, + xOffset, + y + 1, + z); + renderBlocks.aoBrightnessXYZPNN = block.getMixedBrightnessForBlock( + renderBlocks.blockAccess, + xOffset, + y - 1, + z - 1); + renderBlocks.aoBrightnessXYZPNP = block.getMixedBrightnessForBlock( + renderBlocks.blockAccess, + xOffset, + y - 1, + z + 1); + renderBlocks.aoBrightnessXYZPPN = block.getMixedBrightnessForBlock( + renderBlocks.blockAccess, + xOffset, + y + 1, + z - 1); + renderBlocks.aoBrightnessXYZPPP = block.getMixedBrightnessForBlock( + renderBlocks.blockAccess, + xOffset, + y + 1, + z + 1); renderBlocks.aoLightValueScratchXYPN = getMixedAo( - renderBlocks.blockAccess.getBlock(x + 1, y - 1, z).getAmbientOcclusionLightValue(), - renderBlocks.blockAccess.getBlock(x, y - 1, z).getAmbientOcclusionLightValue(), + renderBlocks.blockAccess.getBlock(x + 1, y - 1, z) + .getAmbientOcclusionLightValue(), + renderBlocks.blockAccess.getBlock(x, y - 1, z) + .getAmbientOcclusionLightValue(), renderBlocks.renderMaxX); renderBlocks.aoLightValueScratchXZPN = getMixedAo( - renderBlocks.blockAccess.getBlock(x + 1, y, z - 1).getAmbientOcclusionLightValue(), - renderBlocks.blockAccess.getBlock(x, y, z - 1).getAmbientOcclusionLightValue(), + renderBlocks.blockAccess.getBlock(x + 1, y, z - 1) + .getAmbientOcclusionLightValue(), + renderBlocks.blockAccess.getBlock(x, y, z - 1) + .getAmbientOcclusionLightValue(), renderBlocks.renderMaxX); renderBlocks.aoLightValueScratchXZPP = getMixedAo( - renderBlocks.blockAccess.getBlock(x + 1, y, z + 1).getAmbientOcclusionLightValue(), - renderBlocks.blockAccess.getBlock(x, y, z + 1).getAmbientOcclusionLightValue(), + renderBlocks.blockAccess.getBlock(x + 1, y, z + 1) + .getAmbientOcclusionLightValue(), + renderBlocks.blockAccess.getBlock(x, y, z + 1) + .getAmbientOcclusionLightValue(), renderBlocks.renderMaxX); renderBlocks.aoLightValueScratchXYPP = getMixedAo( - renderBlocks.blockAccess.getBlock(x + 1, y + 1, z).getAmbientOcclusionLightValue(), - renderBlocks.blockAccess.getBlock(x, y + 1, z).getAmbientOcclusionLightValue(), + renderBlocks.blockAccess.getBlock(x + 1, y + 1, z) + .getAmbientOcclusionLightValue(), + renderBlocks.blockAccess.getBlock(x, y + 1, z) + .getAmbientOcclusionLightValue(), renderBlocks.renderMaxX); renderBlocks.aoLightValueScratchXYZPNN = getMixedAo( - renderBlocks.blockAccess.getBlock(x + 1, y - 1, z - 1).getAmbientOcclusionLightValue(), - renderBlocks.blockAccess.getBlock(x, y - 1, z - 1).getAmbientOcclusionLightValue(), + renderBlocks.blockAccess.getBlock(x + 1, y - 1, z - 1) + .getAmbientOcclusionLightValue(), + renderBlocks.blockAccess.getBlock(x, y - 1, z - 1) + .getAmbientOcclusionLightValue(), renderBlocks.renderMaxX); renderBlocks.aoLightValueScratchXYZPNP = getMixedAo( - renderBlocks.blockAccess.getBlock(x + 1, y - 1, z + 1).getAmbientOcclusionLightValue(), - renderBlocks.blockAccess.getBlock(x, y - 1, z + 1).getAmbientOcclusionLightValue(), + renderBlocks.blockAccess.getBlock(x + 1, y - 1, z + 1) + .getAmbientOcclusionLightValue(), + renderBlocks.blockAccess.getBlock(x, y - 1, z + 1) + .getAmbientOcclusionLightValue(), renderBlocks.renderMaxX); renderBlocks.aoLightValueScratchXYZPPN = getMixedAo( - renderBlocks.blockAccess.getBlock(x + 1, y + 1, z - 1).getAmbientOcclusionLightValue(), - renderBlocks.blockAccess.getBlock(x, y + 1, z - 1).getAmbientOcclusionLightValue(), + renderBlocks.blockAccess.getBlock(x + 1, y + 1, z - 1) + .getAmbientOcclusionLightValue(), + renderBlocks.blockAccess.getBlock(x, y + 1, z - 1) + .getAmbientOcclusionLightValue(), renderBlocks.renderMaxX); renderBlocks.aoLightValueScratchXYZPPP = getMixedAo( - renderBlocks.blockAccess.getBlock(x + 1, y + 1, z + 1).getAmbientOcclusionLightValue(), - renderBlocks.blockAccess.getBlock(x, y + 1, z + 1).getAmbientOcclusionLightValue(), + renderBlocks.blockAccess.getBlock(x + 1, y + 1, z + 1) + .getAmbientOcclusionLightValue(), + renderBlocks.blockAccess.getBlock(x, y + 1, z + 1) + .getAmbientOcclusionLightValue(), renderBlocks.renderMaxX); int brightnessMixedXYZPPP = renderBlocks.getAoBrightness( @@ -688,55 +770,96 @@ public class LightingHelper { brightness = mixedBrightness; float ratio = (float) (1.0F - renderBlocks.renderMinY); - float aoLightValue = renderBlocks.blockAccess.getBlock(x, y - 1, z).getAmbientOcclusionLightValue(); - - renderBlocks.aoBrightnessXYNN = block - .getMixedBrightnessForBlock(renderBlocks.blockAccess, x - 1, yOffset, z); - renderBlocks.aoBrightnessYZNN = block - .getMixedBrightnessForBlock(renderBlocks.blockAccess, x, yOffset, z - 1); - renderBlocks.aoBrightnessYZNP = block - .getMixedBrightnessForBlock(renderBlocks.blockAccess, x, yOffset, z + 1); - renderBlocks.aoBrightnessXYPN = block - .getMixedBrightnessForBlock(renderBlocks.blockAccess, x + 1, yOffset, z); - renderBlocks.aoBrightnessXYZNNN = block - .getMixedBrightnessForBlock(renderBlocks.blockAccess, x - 1, yOffset, z - 1); - renderBlocks.aoBrightnessXYZNNP = block - .getMixedBrightnessForBlock(renderBlocks.blockAccess, x - 1, yOffset, z + 1); - renderBlocks.aoBrightnessXYZPNN = block - .getMixedBrightnessForBlock(renderBlocks.blockAccess, x + 1, yOffset, z - 1); - renderBlocks.aoBrightnessXYZPNP = block - .getMixedBrightnessForBlock(renderBlocks.blockAccess, x + 1, yOffset, z + 1); + float aoLightValue = renderBlocks.blockAccess.getBlock(x, y - 1, z) + .getAmbientOcclusionLightValue(); + + renderBlocks.aoBrightnessXYNN = block.getMixedBrightnessForBlock( + renderBlocks.blockAccess, + x - 1, + yOffset, + z); + renderBlocks.aoBrightnessYZNN = block.getMixedBrightnessForBlock( + renderBlocks.blockAccess, + x, + yOffset, + z - 1); + renderBlocks.aoBrightnessYZNP = block.getMixedBrightnessForBlock( + renderBlocks.blockAccess, + x, + yOffset, + z + 1); + renderBlocks.aoBrightnessXYPN = block.getMixedBrightnessForBlock( + renderBlocks.blockAccess, + x + 1, + yOffset, + z); + renderBlocks.aoBrightnessXYZNNN = block.getMixedBrightnessForBlock( + renderBlocks.blockAccess, + x - 1, + yOffset, + z - 1); + renderBlocks.aoBrightnessXYZNNP = block.getMixedBrightnessForBlock( + renderBlocks.blockAccess, + x - 1, + yOffset, + z + 1); + renderBlocks.aoBrightnessXYZPNN = block.getMixedBrightnessForBlock( + renderBlocks.blockAccess, + x + 1, + yOffset, + z - 1); + renderBlocks.aoBrightnessXYZPNP = block.getMixedBrightnessForBlock( + renderBlocks.blockAccess, + x + 1, + yOffset, + z + 1); renderBlocks.aoLightValueScratchXYNN = getMixedAo( - renderBlocks.blockAccess.getBlock(x - 1, y - 1, z).getAmbientOcclusionLightValue(), - renderBlocks.blockAccess.getBlock(x - 1, y, z).getAmbientOcclusionLightValue(), + renderBlocks.blockAccess.getBlock(x - 1, y - 1, z) + .getAmbientOcclusionLightValue(), + renderBlocks.blockAccess.getBlock(x - 1, y, z) + .getAmbientOcclusionLightValue(), ratio); renderBlocks.aoLightValueScratchYZNN = getMixedAo( - renderBlocks.blockAccess.getBlock(x, y - 1, z - 1).getAmbientOcclusionLightValue(), - renderBlocks.blockAccess.getBlock(x, y, z - 1).getAmbientOcclusionLightValue(), + renderBlocks.blockAccess.getBlock(x, y - 1, z - 1) + .getAmbientOcclusionLightValue(), + renderBlocks.blockAccess.getBlock(x, y, z - 1) + .getAmbientOcclusionLightValue(), ratio); renderBlocks.aoLightValueScratchYZNP = getMixedAo( - renderBlocks.blockAccess.getBlock(x, y - 1, z + 1).getAmbientOcclusionLightValue(), - renderBlocks.blockAccess.getBlock(x, y, z + 1).getAmbientOcclusionLightValue(), + renderBlocks.blockAccess.getBlock(x, y - 1, z + 1) + .getAmbientOcclusionLightValue(), + renderBlocks.blockAccess.getBlock(x, y, z + 1) + .getAmbientOcclusionLightValue(), ratio); renderBlocks.aoLightValueScratchXYPN = getMixedAo( - renderBlocks.blockAccess.getBlock(x + 1, y - 1, z).getAmbientOcclusionLightValue(), - renderBlocks.blockAccess.getBlock(x + 1, y, z).getAmbientOcclusionLightValue(), + renderBlocks.blockAccess.getBlock(x + 1, y - 1, z) + .getAmbientOcclusionLightValue(), + renderBlocks.blockAccess.getBlock(x + 1, y, z) + .getAmbientOcclusionLightValue(), ratio); renderBlocks.aoLightValueScratchXYZNNN = getMixedAo( - renderBlocks.blockAccess.getBlock(x - 1, y - 1, z - 1).getAmbientOcclusionLightValue(), - renderBlocks.blockAccess.getBlock(x - 1, y, z - 1).getAmbientOcclusionLightValue(), + renderBlocks.blockAccess.getBlock(x - 1, y - 1, z - 1) + .getAmbientOcclusionLightValue(), + renderBlocks.blockAccess.getBlock(x - 1, y, z - 1) + .getAmbientOcclusionLightValue(), ratio); renderBlocks.aoLightValueScratchXYZNNP = getMixedAo( - renderBlocks.blockAccess.getBlock(x - 1, y - 1, z + 1).getAmbientOcclusionLightValue(), - renderBlocks.blockAccess.getBlock(x - 1, y, z + 1).getAmbientOcclusionLightValue(), + renderBlocks.blockAccess.getBlock(x - 1, y - 1, z + 1) + .getAmbientOcclusionLightValue(), + renderBlocks.blockAccess.getBlock(x - 1, y, z + 1) + .getAmbientOcclusionLightValue(), ratio); renderBlocks.aoLightValueScratchXYZPNN = getMixedAo( - renderBlocks.blockAccess.getBlock(x + 1, y - 1, z - 1).getAmbientOcclusionLightValue(), - renderBlocks.blockAccess.getBlock(x + 1, y, z - 1).getAmbientOcclusionLightValue(), + renderBlocks.blockAccess.getBlock(x + 1, y - 1, z - 1) + .getAmbientOcclusionLightValue(), + renderBlocks.blockAccess.getBlock(x + 1, y, z - 1) + .getAmbientOcclusionLightValue(), ratio); renderBlocks.aoLightValueScratchXYZPNP = getMixedAo( - renderBlocks.blockAccess.getBlock(x + 1, y - 1, z + 1).getAmbientOcclusionLightValue(), - renderBlocks.blockAccess.getBlock(x + 1, y, z + 1).getAmbientOcclusionLightValue(), + renderBlocks.blockAccess.getBlock(x + 1, y - 1, z + 1) + .getAmbientOcclusionLightValue(), + renderBlocks.blockAccess.getBlock(x + 1, y, z + 1) + .getAmbientOcclusionLightValue(), ratio); int brightnessMixedXYZPNP = renderBlocks.getAoBrightness( @@ -856,55 +979,96 @@ public class LightingHelper { int mixedBrightness = block.getMixedBrightnessForBlock(renderBlocks.blockAccess, x, yOffset, z); brightness = mixedBrightness; - float aoLightValue = renderBlocks.blockAccess.getBlock(x, y + 1, z).getAmbientOcclusionLightValue(); - - renderBlocks.aoBrightnessXYNP = block - .getMixedBrightnessForBlock(renderBlocks.blockAccess, x - 1, yOffset, z); - renderBlocks.aoBrightnessXYPP = block - .getMixedBrightnessForBlock(renderBlocks.blockAccess, x + 1, yOffset, z); - renderBlocks.aoBrightnessYZPN = block - .getMixedBrightnessForBlock(renderBlocks.blockAccess, x, yOffset, z - 1); - renderBlocks.aoBrightnessYZPP = block - .getMixedBrightnessForBlock(renderBlocks.blockAccess, x, yOffset, z + 1); - renderBlocks.aoBrightnessXYZNPN = block - .getMixedBrightnessForBlock(renderBlocks.blockAccess, x - 1, yOffset, z - 1); - renderBlocks.aoBrightnessXYZPPN = block - .getMixedBrightnessForBlock(renderBlocks.blockAccess, x + 1, yOffset, z - 1); - renderBlocks.aoBrightnessXYZNPP = block - .getMixedBrightnessForBlock(renderBlocks.blockAccess, x - 1, yOffset, z + 1); - renderBlocks.aoBrightnessXYZPPP = block - .getMixedBrightnessForBlock(renderBlocks.blockAccess, x + 1, yOffset, z + 1); + float aoLightValue = renderBlocks.blockAccess.getBlock(x, y + 1, z) + .getAmbientOcclusionLightValue(); + + renderBlocks.aoBrightnessXYNP = block.getMixedBrightnessForBlock( + renderBlocks.blockAccess, + x - 1, + yOffset, + z); + renderBlocks.aoBrightnessXYPP = block.getMixedBrightnessForBlock( + renderBlocks.blockAccess, + x + 1, + yOffset, + z); + renderBlocks.aoBrightnessYZPN = block.getMixedBrightnessForBlock( + renderBlocks.blockAccess, + x, + yOffset, + z - 1); + renderBlocks.aoBrightnessYZPP = block.getMixedBrightnessForBlock( + renderBlocks.blockAccess, + x, + yOffset, + z + 1); + renderBlocks.aoBrightnessXYZNPN = block.getMixedBrightnessForBlock( + renderBlocks.blockAccess, + x - 1, + yOffset, + z - 1); + renderBlocks.aoBrightnessXYZPPN = block.getMixedBrightnessForBlock( + renderBlocks.blockAccess, + x + 1, + yOffset, + z - 1); + renderBlocks.aoBrightnessXYZNPP = block.getMixedBrightnessForBlock( + renderBlocks.blockAccess, + x - 1, + yOffset, + z + 1); + renderBlocks.aoBrightnessXYZPPP = block.getMixedBrightnessForBlock( + renderBlocks.blockAccess, + x + 1, + yOffset, + z + 1); renderBlocks.aoLightValueScratchXYNP = getMixedAo( - renderBlocks.blockAccess.getBlock(x - 1, y + 1, z).getAmbientOcclusionLightValue(), - renderBlocks.blockAccess.getBlock(x - 1, y, z).getAmbientOcclusionLightValue(), + renderBlocks.blockAccess.getBlock(x - 1, y + 1, z) + .getAmbientOcclusionLightValue(), + renderBlocks.blockAccess.getBlock(x - 1, y, z) + .getAmbientOcclusionLightValue(), renderBlocks.renderMaxY); renderBlocks.aoLightValueScratchXYPP = getMixedAo( - renderBlocks.blockAccess.getBlock(x + 1, y + 1, z).getAmbientOcclusionLightValue(), - renderBlocks.blockAccess.getBlock(x + 1, y, z).getAmbientOcclusionLightValue(), + renderBlocks.blockAccess.getBlock(x + 1, y + 1, z) + .getAmbientOcclusionLightValue(), + renderBlocks.blockAccess.getBlock(x + 1, y, z) + .getAmbientOcclusionLightValue(), renderBlocks.renderMaxY); renderBlocks.aoLightValueScratchYZPN = getMixedAo( - renderBlocks.blockAccess.getBlock(x, y + 1, z - 1).getAmbientOcclusionLightValue(), - renderBlocks.blockAccess.getBlock(x, y, z - 1).getAmbientOcclusionLightValue(), + renderBlocks.blockAccess.getBlock(x, y + 1, z - 1) + .getAmbientOcclusionLightValue(), + renderBlocks.blockAccess.getBlock(x, y, z - 1) + .getAmbientOcclusionLightValue(), renderBlocks.renderMaxY); renderBlocks.aoLightValueScratchYZPP = getMixedAo( - renderBlocks.blockAccess.getBlock(x, y + 1, z + 1).getAmbientOcclusionLightValue(), - renderBlocks.blockAccess.getBlock(x, y, z + 1).getAmbientOcclusionLightValue(), + renderBlocks.blockAccess.getBlock(x, y + 1, z + 1) + .getAmbientOcclusionLightValue(), + renderBlocks.blockAccess.getBlock(x, y, z + 1) + .getAmbientOcclusionLightValue(), renderBlocks.renderMaxY); renderBlocks.aoLightValueScratchXYZNPN = getMixedAo( - renderBlocks.blockAccess.getBlock(x - 1, y + 1, z - 1).getAmbientOcclusionLightValue(), - renderBlocks.blockAccess.getBlock(x - 1, y, z - 1).getAmbientOcclusionLightValue(), + renderBlocks.blockAccess.getBlock(x - 1, y + 1, z - 1) + .getAmbientOcclusionLightValue(), + renderBlocks.blockAccess.getBlock(x - 1, y, z - 1) + .getAmbientOcclusionLightValue(), renderBlocks.renderMaxY); renderBlocks.aoLightValueScratchXYZPPN = getMixedAo( - renderBlocks.blockAccess.getBlock(x + 1, y + 1, z - 1).getAmbientOcclusionLightValue(), - renderBlocks.blockAccess.getBlock(x + 1, y, z - 1).getAmbientOcclusionLightValue(), + renderBlocks.blockAccess.getBlock(x + 1, y + 1, z - 1) + .getAmbientOcclusionLightValue(), + renderBlocks.blockAccess.getBlock(x + 1, y, z - 1) + .getAmbientOcclusionLightValue(), renderBlocks.renderMaxY); renderBlocks.aoLightValueScratchXYZNPP = getMixedAo( - renderBlocks.blockAccess.getBlock(x - 1, y + 1, z + 1).getAmbientOcclusionLightValue(), - renderBlocks.blockAccess.getBlock(x - 1, y, z + 1).getAmbientOcclusionLightValue(), + renderBlocks.blockAccess.getBlock(x - 1, y + 1, z + 1) + .getAmbientOcclusionLightValue(), + renderBlocks.blockAccess.getBlock(x - 1, y, z + 1) + .getAmbientOcclusionLightValue(), renderBlocks.renderMaxY); renderBlocks.aoLightValueScratchXYZPPP = getMixedAo( - renderBlocks.blockAccess.getBlock(x + 1, y + 1, z + 1).getAmbientOcclusionLightValue(), - renderBlocks.blockAccess.getBlock(x + 1, y, z + 1).getAmbientOcclusionLightValue(), + renderBlocks.blockAccess.getBlock(x + 1, y + 1, z + 1) + .getAmbientOcclusionLightValue(), + renderBlocks.blockAccess.getBlock(x + 1, y, z + 1) + .getAmbientOcclusionLightValue(), renderBlocks.renderMaxY); int brightnessMixedXYZPPP = renderBlocks.getAoBrightness( @@ -1025,55 +1189,96 @@ public class LightingHelper { brightness = mixedBrightness; float ratio = (float) (1.0F - renderBlocks.renderMinZ); - float aoLightValue = renderBlocks.blockAccess.getBlock(x, y, z - 1).getAmbientOcclusionLightValue(); - - renderBlocks.aoBrightnessXZNN = block - .getMixedBrightnessForBlock(renderBlocks.blockAccess, x - 1, y, zOffset); - renderBlocks.aoBrightnessYZNN = block - .getMixedBrightnessForBlock(renderBlocks.blockAccess, x, y - 1, zOffset); - renderBlocks.aoBrightnessYZPN = block - .getMixedBrightnessForBlock(renderBlocks.blockAccess, x, y + 1, zOffset); - renderBlocks.aoBrightnessXZPN = block - .getMixedBrightnessForBlock(renderBlocks.blockAccess, x + 1, y, zOffset); - renderBlocks.aoBrightnessXYZNNN = block - .getMixedBrightnessForBlock(renderBlocks.blockAccess, x - 1, y - 1, zOffset); - renderBlocks.aoBrightnessXYZNPN = block - .getMixedBrightnessForBlock(renderBlocks.blockAccess, x - 1, y + 1, zOffset); - renderBlocks.aoBrightnessXYZPNN = block - .getMixedBrightnessForBlock(renderBlocks.blockAccess, x + 1, y - 1, zOffset); - renderBlocks.aoBrightnessXYZPPN = block - .getMixedBrightnessForBlock(renderBlocks.blockAccess, x + 1, y + 1, zOffset); + float aoLightValue = renderBlocks.blockAccess.getBlock(x, y, z - 1) + .getAmbientOcclusionLightValue(); + + renderBlocks.aoBrightnessXZNN = block.getMixedBrightnessForBlock( + renderBlocks.blockAccess, + x - 1, + y, + zOffset); + renderBlocks.aoBrightnessYZNN = block.getMixedBrightnessForBlock( + renderBlocks.blockAccess, + x, + y - 1, + zOffset); + renderBlocks.aoBrightnessYZPN = block.getMixedBrightnessForBlock( + renderBlocks.blockAccess, + x, + y + 1, + zOffset); + renderBlocks.aoBrightnessXZPN = block.getMixedBrightnessForBlock( + renderBlocks.blockAccess, + x + 1, + y, + zOffset); + renderBlocks.aoBrightnessXYZNNN = block.getMixedBrightnessForBlock( + renderBlocks.blockAccess, + x - 1, + y - 1, + zOffset); + renderBlocks.aoBrightnessXYZNPN = block.getMixedBrightnessForBlock( + renderBlocks.blockAccess, + x - 1, + y + 1, + zOffset); + renderBlocks.aoBrightnessXYZPNN = block.getMixedBrightnessForBlock( + renderBlocks.blockAccess, + x + 1, + y - 1, + zOffset); + renderBlocks.aoBrightnessXYZPPN = block.getMixedBrightnessForBlock( + renderBlocks.blockAccess, + x + 1, + y + 1, + zOffset); renderBlocks.aoLightValueScratchXZNN = getMixedAo( - renderBlocks.blockAccess.getBlock(x - 1, y, z - 1).getAmbientOcclusionLightValue(), - renderBlocks.blockAccess.getBlock(x - 1, y, z).getAmbientOcclusionLightValue(), + renderBlocks.blockAccess.getBlock(x - 1, y, z - 1) + .getAmbientOcclusionLightValue(), + renderBlocks.blockAccess.getBlock(x - 1, y, z) + .getAmbientOcclusionLightValue(), ratio); renderBlocks.aoLightValueScratchYZNN = getMixedAo( - renderBlocks.blockAccess.getBlock(x, y - 1, z - 1).getAmbientOcclusionLightValue(), - renderBlocks.blockAccess.getBlock(x, y - 1, z).getAmbientOcclusionLightValue(), + renderBlocks.blockAccess.getBlock(x, y - 1, z - 1) + .getAmbientOcclusionLightValue(), + renderBlocks.blockAccess.getBlock(x, y - 1, z) + .getAmbientOcclusionLightValue(), ratio); renderBlocks.aoLightValueScratchYZPN = getMixedAo( - renderBlocks.blockAccess.getBlock(x, y + 1, z - 1).getAmbientOcclusionLightValue(), - renderBlocks.blockAccess.getBlock(x, y + 1, z).getAmbientOcclusionLightValue(), + renderBlocks.blockAccess.getBlock(x, y + 1, z - 1) + .getAmbientOcclusionLightValue(), + renderBlocks.blockAccess.getBlock(x, y + 1, z) + .getAmbientOcclusionLightValue(), ratio); renderBlocks.aoLightValueScratchXZPN = getMixedAo( - renderBlocks.blockAccess.getBlock(x + 1, y, z - 1).getAmbientOcclusionLightValue(), - renderBlocks.blockAccess.getBlock(x + 1, y, z).getAmbientOcclusionLightValue(), + renderBlocks.blockAccess.getBlock(x + 1, y, z - 1) + .getAmbientOcclusionLightValue(), + renderBlocks.blockAccess.getBlock(x + 1, y, z) + .getAmbientOcclusionLightValue(), ratio); renderBlocks.aoLightValueScratchXYZNNN = getMixedAo( - renderBlocks.blockAccess.getBlock(x - 1, y - 1, z - 1).getAmbientOcclusionLightValue(), - renderBlocks.blockAccess.getBlock(x - 1, y - 1, z).getAmbientOcclusionLightValue(), + renderBlocks.blockAccess.getBlock(x - 1, y - 1, z - 1) + .getAmbientOcclusionLightValue(), + renderBlocks.blockAccess.getBlock(x - 1, y - 1, z) + .getAmbientOcclusionLightValue(), ratio); renderBlocks.aoLightValueScratchXYZNPN = getMixedAo( - renderBlocks.blockAccess.getBlock(x - 1, y + 1, z - 1).getAmbientOcclusionLightValue(), - renderBlocks.blockAccess.getBlock(x - 1, y + 1, z).getAmbientOcclusionLightValue(), + renderBlocks.blockAccess.getBlock(x - 1, y + 1, z - 1) + .getAmbientOcclusionLightValue(), + renderBlocks.blockAccess.getBlock(x - 1, y + 1, z) + .getAmbientOcclusionLightValue(), ratio); renderBlocks.aoLightValueScratchXYZPNN = getMixedAo( - renderBlocks.blockAccess.getBlock(x + 1, y - 1, z - 1).getAmbientOcclusionLightValue(), - renderBlocks.blockAccess.getBlock(x + 1, y - 1, z).getAmbientOcclusionLightValue(), + renderBlocks.blockAccess.getBlock(x + 1, y - 1, z - 1) + .getAmbientOcclusionLightValue(), + renderBlocks.blockAccess.getBlock(x + 1, y - 1, z) + .getAmbientOcclusionLightValue(), ratio); renderBlocks.aoLightValueScratchXYZPPN = getMixedAo( - renderBlocks.blockAccess.getBlock(x + 1, y + 1, z - 1).getAmbientOcclusionLightValue(), - renderBlocks.blockAccess.getBlock(x + 1, y + 1, z).getAmbientOcclusionLightValue(), + renderBlocks.blockAccess.getBlock(x + 1, y + 1, z - 1) + .getAmbientOcclusionLightValue(), + renderBlocks.blockAccess.getBlock(x + 1, y + 1, z) + .getAmbientOcclusionLightValue(), ratio); int brightnessMixedXYZPPN = renderBlocks.getAoBrightness( @@ -1193,55 +1398,96 @@ public class LightingHelper { int mixedBrightness = block.getMixedBrightnessForBlock(renderBlocks.blockAccess, x, y, zOffset); brightness = mixedBrightness; - float aoLightValue = renderBlocks.blockAccess.getBlock(x, y, z + 1).getAmbientOcclusionLightValue(); - - renderBlocks.aoBrightnessXZNP = block - .getMixedBrightnessForBlock(renderBlocks.blockAccess, x - 1, y, zOffset); - renderBlocks.aoBrightnessXZPP = block - .getMixedBrightnessForBlock(renderBlocks.blockAccess, x + 1, y, zOffset); - renderBlocks.aoBrightnessYZNP = block - .getMixedBrightnessForBlock(renderBlocks.blockAccess, x, y - 1, zOffset); - renderBlocks.aoBrightnessYZPP = block - .getMixedBrightnessForBlock(renderBlocks.blockAccess, x, y + 1, zOffset); - renderBlocks.aoBrightnessXYZNNP = block - .getMixedBrightnessForBlock(renderBlocks.blockAccess, x - 1, y - 1, zOffset); - renderBlocks.aoBrightnessXYZNPP = block - .getMixedBrightnessForBlock(renderBlocks.blockAccess, x - 1, y + 1, zOffset); - renderBlocks.aoBrightnessXYZPNP = block - .getMixedBrightnessForBlock(renderBlocks.blockAccess, x + 1, y - 1, zOffset); - renderBlocks.aoBrightnessXYZPPP = block - .getMixedBrightnessForBlock(renderBlocks.blockAccess, x + 1, y + 1, zOffset); + float aoLightValue = renderBlocks.blockAccess.getBlock(x, y, z + 1) + .getAmbientOcclusionLightValue(); + + renderBlocks.aoBrightnessXZNP = block.getMixedBrightnessForBlock( + renderBlocks.blockAccess, + x - 1, + y, + zOffset); + renderBlocks.aoBrightnessXZPP = block.getMixedBrightnessForBlock( + renderBlocks.blockAccess, + x + 1, + y, + zOffset); + renderBlocks.aoBrightnessYZNP = block.getMixedBrightnessForBlock( + renderBlocks.blockAccess, + x, + y - 1, + zOffset); + renderBlocks.aoBrightnessYZPP = block.getMixedBrightnessForBlock( + renderBlocks.blockAccess, + x, + y + 1, + zOffset); + renderBlocks.aoBrightnessXYZNNP = block.getMixedBrightnessForBlock( + renderBlocks.blockAccess, + x - 1, + y - 1, + zOffset); + renderBlocks.aoBrightnessXYZNPP = block.getMixedBrightnessForBlock( + renderBlocks.blockAccess, + x - 1, + y + 1, + zOffset); + renderBlocks.aoBrightnessXYZPNP = block.getMixedBrightnessForBlock( + renderBlocks.blockAccess, + x + 1, + y - 1, + zOffset); + renderBlocks.aoBrightnessXYZPPP = block.getMixedBrightnessForBlock( + renderBlocks.blockAccess, + x + 1, + y + 1, + zOffset); renderBlocks.aoLightValueScratchXZNP = getMixedAo( - renderBlocks.blockAccess.getBlock(x - 1, y, z + 1).getAmbientOcclusionLightValue(), - renderBlocks.blockAccess.getBlock(x - 1, y, z).getAmbientOcclusionLightValue(), + renderBlocks.blockAccess.getBlock(x - 1, y, z + 1) + .getAmbientOcclusionLightValue(), + renderBlocks.blockAccess.getBlock(x - 1, y, z) + .getAmbientOcclusionLightValue(), renderBlocks.renderMaxZ); renderBlocks.aoLightValueScratchXZPP = getMixedAo( - renderBlocks.blockAccess.getBlock(x + 1, y, z + 1).getAmbientOcclusionLightValue(), - renderBlocks.blockAccess.getBlock(x + 1, y, z).getAmbientOcclusionLightValue(), + renderBlocks.blockAccess.getBlock(x + 1, y, z + 1) + .getAmbientOcclusionLightValue(), + renderBlocks.blockAccess.getBlock(x + 1, y, z) + .getAmbientOcclusionLightValue(), renderBlocks.renderMaxZ); renderBlocks.aoLightValueScratchYZNP = getMixedAo( - renderBlocks.blockAccess.getBlock(x, y - 1, z + 1).getAmbientOcclusionLightValue(), - renderBlocks.blockAccess.getBlock(x, y - 1, z).getAmbientOcclusionLightValue(), + renderBlocks.blockAccess.getBlock(x, y - 1, z + 1) + .getAmbientOcclusionLightValue(), + renderBlocks.blockAccess.getBlock(x, y - 1, z) + .getAmbientOcclusionLightValue(), renderBlocks.renderMaxZ); renderBlocks.aoLightValueScratchYZPP = getMixedAo( - renderBlocks.blockAccess.getBlock(x, y + 1, z + 1).getAmbientOcclusionLightValue(), - renderBlocks.blockAccess.getBlock(x, y + 1, z).getAmbientOcclusionLightValue(), + renderBlocks.blockAccess.getBlock(x, y + 1, z + 1) + .getAmbientOcclusionLightValue(), + renderBlocks.blockAccess.getBlock(x, y + 1, z) + .getAmbientOcclusionLightValue(), renderBlocks.renderMaxZ); renderBlocks.aoLightValueScratchXYZNNP = getMixedAo( - renderBlocks.blockAccess.getBlock(x - 1, y - 1, z + 1).getAmbientOcclusionLightValue(), - renderBlocks.blockAccess.getBlock(x - 1, y - 1, z).getAmbientOcclusionLightValue(), + renderBlocks.blockAccess.getBlock(x - 1, y - 1, z + 1) + .getAmbientOcclusionLightValue(), + renderBlocks.blockAccess.getBlock(x - 1, y - 1, z) + .getAmbientOcclusionLightValue(), renderBlocks.renderMaxZ); renderBlocks.aoLightValueScratchXYZNPP = getMixedAo( - renderBlocks.blockAccess.getBlock(x - 1, y + 1, z + 1).getAmbientOcclusionLightValue(), - renderBlocks.blockAccess.getBlock(x - 1, y + 1, z).getAmbientOcclusionLightValue(), + renderBlocks.blockAccess.getBlock(x - 1, y + 1, z + 1) + .getAmbientOcclusionLightValue(), + renderBlocks.blockAccess.getBlock(x - 1, y + 1, z) + .getAmbientOcclusionLightValue(), renderBlocks.renderMaxZ); renderBlocks.aoLightValueScratchXYZPNP = getMixedAo( - renderBlocks.blockAccess.getBlock(x + 1, y - 1, z + 1).getAmbientOcclusionLightValue(), - renderBlocks.blockAccess.getBlock(x + 1, y - 1, z).getAmbientOcclusionLightValue(), + renderBlocks.blockAccess.getBlock(x + 1, y - 1, z + 1) + .getAmbientOcclusionLightValue(), + renderBlocks.blockAccess.getBlock(x + 1, y - 1, z) + .getAmbientOcclusionLightValue(), renderBlocks.renderMaxZ); renderBlocks.aoLightValueScratchXYZPPP = getMixedAo( - renderBlocks.blockAccess.getBlock(x + 1, y + 1, z + 1).getAmbientOcclusionLightValue(), - renderBlocks.blockAccess.getBlock(x + 1, y + 1, z).getAmbientOcclusionLightValue(), + renderBlocks.blockAccess.getBlock(x + 1, y + 1, z + 1) + .getAmbientOcclusionLightValue(), + renderBlocks.blockAccess.getBlock(x + 1, y + 1, z) + .getAmbientOcclusionLightValue(), renderBlocks.renderMaxZ); int brightnessMixedXYZNPP = renderBlocks.getAoBrightness( |