diff options
Diffstat (limited to 'src/main/java/gregtech/api')
164 files changed, 7222 insertions, 4010 deletions
diff --git a/src/main/java/gregtech/api/GregTech_API.java b/src/main/java/gregtech/api/GregTech_API.java index d8ad1ca07b..7a8b495a4b 100644 --- a/src/main/java/gregtech/api/GregTech_API.java +++ b/src/main/java/gregtech/api/GregTech_API.java @@ -185,12 +185,13 @@ public class GregTech_API { sHeatHazmatList = new GT_HashSet<>(), sRadioHazmatList = new GT_HashSet<>(), sElectroHazmatList = new GT_HashSet<>(); - private static final Multimap<Integer, ItemStack> sRealConfigurationList = Multimaps - .newListMultimap(new TreeMap<>(), ArrayList::new); + private static final Multimap<Integer, ItemStack> sRealConfigurationList = Multimaps.newListMultimap( + new TreeMap<>(), + ArrayList::new); private static final Map<Integer, List<ItemStack>> sConfigurationLists = new ConcurrentHashMap<>(); private static final Map<Predicate<ItemStack>, BiFunction<ItemStack, EntityPlayerMP, ItemStack>> sRealCircuitProgrammerList = new LinkedHashMap<>(); - public static final Map<Predicate<ItemStack>, BiFunction<ItemStack, EntityPlayerMP, ItemStack>> sCircuitProgrammerList = Collections - .unmodifiableMap(sRealCircuitProgrammerList); + public static final Map<Predicate<ItemStack>, BiFunction<ItemStack, EntityPlayerMP, ItemStack>> sCircuitProgrammerList = Collections.unmodifiableMap( + sRealCircuitProgrammerList); /** * The List of Dimensions, which are Whitelisted for the Teleporter. This list should not contain other Planets. @@ -455,34 +456,36 @@ public class GregTech_API { int aTier, int aDamageEnergyCost, int aSpecials, double aArmorAbsorbtionPercentage, boolean aChargeProvider, int aType, int aArmorIndex) { try { - return (Item) Class.forName("gregtechmod.api.items.GT_EnergyArmorIC_Item").getConstructors()[0].newInstance( - aUnlocalized, - aEnglish, - aCharge, - aTransfer, - aTier, - aDamageEnergyCost, - aSpecials, - aArmorAbsorbtionPercentage, - aChargeProvider, - aType, - aArmorIndex); + return (Item) Class.forName("gregtechmod.api.items.GT_EnergyArmorIC_Item") + .getConstructors()[0].newInstance( + aUnlocalized, + aEnglish, + aCharge, + aTransfer, + aTier, + aDamageEnergyCost, + aSpecials, + aArmorAbsorbtionPercentage, + aChargeProvider, + aType, + aArmorIndex); } catch (Throwable e) { /* Do nothing */ } try { - return (Item) Class.forName("gregtechmod.api.items.GT_EnergyArmor_Item").getConstructors()[0].newInstance( - aUnlocalized, - aEnglish, - aCharge, - aTransfer, - aTier, - aDamageEnergyCost, - aSpecials, - aArmorAbsorbtionPercentage, - aChargeProvider, - aType, - aArmorIndex); + return (Item) Class.forName("gregtechmod.api.items.GT_EnergyArmor_Item") + .getConstructors()[0].newInstance( + aUnlocalized, + aEnglish, + aCharge, + aTransfer, + aTier, + aDamageEnergyCost, + aSpecials, + aArmorAbsorbtionPercentage, + aChargeProvider, + aType, + aArmorIndex); } catch (Throwable e) { /* Do nothing */ } @@ -499,14 +502,28 @@ public class GregTech_API { public static Item constructElectricEnergyStorageItem(String aUnlocalized, String aEnglish, int aCharge, int aTransfer, int aTier, int aEmptyID, int aFullID) { try { - return (Item) Class.forName("gregtechmod.api.items.GT_EnergyStoreIC_Item").getConstructors()[0] - .newInstance(aUnlocalized, aEnglish, aCharge, aTransfer, aTier, aEmptyID, aFullID); + return (Item) Class.forName("gregtechmod.api.items.GT_EnergyStoreIC_Item") + .getConstructors()[0].newInstance( + aUnlocalized, + aEnglish, + aCharge, + aTransfer, + aTier, + aEmptyID, + aFullID); } catch (Throwable e) { /* Do nothing */ } try { - return (Item) Class.forName("gregtechmod.api.items.GT_EnergyStore_Item").getConstructors()[0] - .newInstance(aUnlocalized, aEnglish, aCharge, aTransfer, aTier, aEmptyID, aFullID); + return (Item) Class.forName("gregtechmod.api.items.GT_EnergyStore_Item") + .getConstructors()[0].newInstance( + aUnlocalized, + aEnglish, + aCharge, + aTransfer, + aTier, + aEmptyID, + aFullID); } catch (Throwable e) { /* Do nothing */ } @@ -523,8 +540,12 @@ public class GregTech_API { public static GT_Tool_Item constructHardHammerItem(String aUnlocalized, String aEnglish, int aMaxDamage, int aEntityDamage) { try { - return (GT_Tool_Item) Class.forName("gregtechmod.api.items.GT_HardHammer_Item").getConstructors()[0] - .newInstance(aUnlocalized, aEnglish, aMaxDamage, aEntityDamage); + return (GT_Tool_Item) Class.forName("gregtechmod.api.items.GT_HardHammer_Item") + .getConstructors()[0].newInstance( + aUnlocalized, + aEnglish, + aMaxDamage, + aEntityDamage); } catch (Throwable e) { /* Do nothing */ } @@ -543,14 +564,22 @@ public class GregTech_API { public static GT_Tool_Item constructCrowbarItem(String aUnlocalized, String aEnglish, int aMaxDamage, int aEntityDamage) { try { - return (GT_Tool_Item) Class.forName("gregtechmod.api.items.GT_CrowbarRC_Item").getConstructors()[0] - .newInstance(aUnlocalized, aEnglish, aMaxDamage, aEntityDamage); + return (GT_Tool_Item) Class.forName("gregtechmod.api.items.GT_CrowbarRC_Item") + .getConstructors()[0].newInstance( + aUnlocalized, + aEnglish, + aMaxDamage, + aEntityDamage); } catch (Throwable e) { /* Do nothing */ } try { - return (GT_Tool_Item) Class.forName("gregtechmod.api.items.GT_Crowbar_Item").getConstructors()[0] - .newInstance(aUnlocalized, aEnglish, aMaxDamage, aEntityDamage); + return (GT_Tool_Item) Class.forName("gregtechmod.api.items.GT_Crowbar_Item") + .getConstructors()[0].newInstance( + aUnlocalized, + aEnglish, + aMaxDamage, + aEntityDamage); } catch (Throwable e) { /* Do nothing */ } @@ -569,8 +598,13 @@ public class GregTech_API { public static GT_Tool_Item constructWrenchItem(String aUnlocalized, String aEnglish, int aMaxDamage, int aEntityDamage, int aDisChargedGTID) { try { - return (GT_Tool_Item) Class.forName("gregtechmod.api.items.GT_Wrench_Item").getConstructors()[0] - .newInstance(aUnlocalized, aEnglish, aMaxDamage, aEntityDamage, aDisChargedGTID); + return (GT_Tool_Item) Class.forName("gregtechmod.api.items.GT_Wrench_Item") + .getConstructors()[0].newInstance( + aUnlocalized, + aEnglish, + aMaxDamage, + aEntityDamage, + aDisChargedGTID); } catch (Throwable e) { /* Do nothing */ } @@ -589,8 +623,13 @@ public class GregTech_API { public static GT_Tool_Item constructElectricScrewdriverItem(String aUnlocalized, String aEnglish, int aMaxDamage, int aEntityDamage, int aDisChargedGTID) { try { - return (GT_Tool_Item) Class.forName("gregtechmod.api.items.GT_ScrewdriverIC_Item").getConstructors()[0] - .newInstance(aUnlocalized, aEnglish, aMaxDamage, aEntityDamage, aDisChargedGTID); + return (GT_Tool_Item) Class.forName("gregtechmod.api.items.GT_ScrewdriverIC_Item") + .getConstructors()[0].newInstance( + aUnlocalized, + aEnglish, + aMaxDamage, + aEntityDamage, + aDisChargedGTID); } catch (Throwable e) { /* Do nothing */ } @@ -609,8 +648,13 @@ public class GregTech_API { public static GT_Tool_Item constructElectricWrenchItem(String aUnlocalized, String aEnglish, int aMaxDamage, int aEntityDamage, int aDisChargedGTID) { try { - return (GT_Tool_Item) Class.forName("gregtechmod.api.items.GT_WrenchIC_Item").getConstructors()[0] - .newInstance(aUnlocalized, aEnglish, aMaxDamage, aEntityDamage, aDisChargedGTID); + return (GT_Tool_Item) Class.forName("gregtechmod.api.items.GT_WrenchIC_Item") + .getConstructors()[0].newInstance( + aUnlocalized, + aEnglish, + aMaxDamage, + aEntityDamage, + aDisChargedGTID); } catch (Throwable e) { /* Do nothing */ } @@ -630,15 +674,16 @@ public class GregTech_API { int aEntityDamage, int aToolQuality, float aToolStrength, int aEnergyConsumptionPerBlockBreak, int aDisChargedGTID) { try { - return (GT_Tool_Item) Class.forName("gregtechmod.api.items.GT_SawIC_Item").getConstructors()[0].newInstance( - aUnlocalized, - aEnglish, - aMaxDamage, - aEntityDamage, - aToolQuality, - aToolStrength, - aEnergyConsumptionPerBlockBreak, - aDisChargedGTID); + return (GT_Tool_Item) Class.forName("gregtechmod.api.items.GT_SawIC_Item") + .getConstructors()[0].newInstance( + aUnlocalized, + aEnglish, + aMaxDamage, + aEntityDamage, + aToolQuality, + aToolStrength, + aEnergyConsumptionPerBlockBreak, + aDisChargedGTID); } catch (Throwable e) { /* Do nothing */ } @@ -658,16 +703,16 @@ public class GregTech_API { int aEntityDamage, int aToolQuality, float aToolStrength, int aEnergyConsumptionPerBlockBreak, int aDisChargedGTID) { try { - return (GT_Tool_Item) Class.forName("gregtechmod.api.items.GT_DrillIC_Item").getConstructors()[0] - .newInstance( - aUnlocalized, - aEnglish, - aMaxDamage, - aEntityDamage, - aToolQuality, - aToolStrength, - aEnergyConsumptionPerBlockBreak, - aDisChargedGTID); + return (GT_Tool_Item) Class.forName("gregtechmod.api.items.GT_DrillIC_Item") + .getConstructors()[0].newInstance( + aUnlocalized, + aEnglish, + aMaxDamage, + aEntityDamage, + aToolQuality, + aToolStrength, + aEnergyConsumptionPerBlockBreak, + aDisChargedGTID); } catch (Throwable e) { /* Do nothing */ } @@ -686,8 +731,13 @@ public class GregTech_API { public static GT_Tool_Item constructElectricSolderingToolItem(String aUnlocalized, String aEnglish, int aMaxDamage, int aEntityDamage, int aDisChargedGTID) { try { - return (GT_Tool_Item) Class.forName("gregtechmod.api.items.GT_SolderingToolIC_Item").getConstructors()[0] - .newInstance(aUnlocalized, aEnglish, aMaxDamage, aEntityDamage, aDisChargedGTID); + return (GT_Tool_Item) Class.forName("gregtechmod.api.items.GT_SolderingToolIC_Item") + .getConstructors()[0].newInstance( + aUnlocalized, + aEnglish, + aMaxDamage, + aEntityDamage, + aDisChargedGTID); } catch (Throwable e) { /* Do nothing */ } @@ -706,8 +756,12 @@ public class GregTech_API { public static GT_Tool_Item constructEmptyElectricToolItem(String aUnlocalized, String aEnglish, int aMaxDamage, int aChargedGTID) { try { - return (GT_Tool_Item) Class.forName("gregtechmod.api.items.GT_EmptyToolIC_Item").getConstructors()[0] - .newInstance(aUnlocalized, aEnglish, aMaxDamage, aChargedGTID); + return (GT_Tool_Item) Class.forName("gregtechmod.api.items.GT_EmptyToolIC_Item") + .getConstructors()[0].newInstance( + aUnlocalized, + aEnglish, + aMaxDamage, + aChargedGTID); } catch (Throwable e) { /* Do nothing */ } @@ -763,8 +817,10 @@ public class GregTech_API { sRealConfigurationList.put(minTier, stack); for (Map.Entry<Integer, List<ItemStack>> e : sConfigurationLists.entrySet()) { if (e.getKey() >= minTier) { - e.getValue().add(stack); - e.getValue().sort(getConfigurationCircuitsComparator()); + e.getValue() + .add(stack); + e.getValue() + .sort(getConfigurationCircuitsComparator()); } } } @@ -780,9 +836,12 @@ public class GregTech_API { return Collections.unmodifiableList( sConfigurationLists.computeIfAbsent( machineTier, - (t) -> sRealConfigurationList.entries().stream().filter(e -> e.getKey() <= machineTier) - .map(Map.Entry::getValue).sorted(getConfigurationCircuitsComparator()) - .collect(Collectors.toList()))); + (t) -> sRealConfigurationList.entries() + .stream() + .filter(e -> e.getKey() <= machineTier) + .map(Map.Entry::getValue) + .sorted(getConfigurationCircuitsComparator()) + .collect(Collectors.toList()))); } public static Comparator<ItemStack> getConfigurationCircuitsComparator() { @@ -794,7 +853,9 @@ public class GregTech_API { return GT_Mod.gregtechproxy.mCircuitsOrder.getOrDefault( String.valueOf(GameRegistry.findUniqueIdentifierFor(is.getItem())), Integer.MAX_VALUE); - }).thenComparing(ItemStack::getUnlocalizedName).thenComparing(ItemStack::getItemDamage); + }) + .thenComparing(ItemStack::getUnlocalizedName) + .thenComparing(ItemStack::getItemDamage); } public static void registerCircuitProgrammer(ItemStack stack, boolean ignoreNBT, boolean useContainer) { @@ -802,8 +863,11 @@ public class GregTech_API { } public static void registerCircuitProgrammer(Predicate<ItemStack> predicate, boolean useContainer) { - sRealCircuitProgrammerList - .put(predicate, useContainer ? (s, p) -> s.getItem().getContainerItem(s) : (s, p) -> s); + sRealCircuitProgrammerList.put( + predicate, + useContainer ? (s, p) -> s.getItem() + .getContainerItem(s) + : (s, p) -> s); } public static void registerCircuitProgrammer(Predicate<ItemStack> predicate, @@ -994,7 +1058,9 @@ public class GregTech_API { */ public static boolean registerTool(ItemStack aTool, Collection<GT_ItemStack> aToolList) { if (aTool == null || GT_Utility.isStackInList(aTool, sToolList) - || (!aTool.getItem().isDamageable() && !GT_ModHandler.isElectricItem(aTool) + || (!aTool.getItem() + .isDamageable() + && !GT_ModHandler.isElectricItem(aTool) && !(aTool.getItem() instanceof IDamagableItem))) return false; aToolList.add(new GT_ItemStack(GT_Utility.copyAmount(1, aTool))); diff --git a/src/main/java/gregtech/api/enchants/Enchantment_EnderDamage.java b/src/main/java/gregtech/api/enchants/Enchantment_EnderDamage.java index 52fd3b1134..e48b3e5b19 100644 --- a/src/main/java/gregtech/api/enchants/Enchantment_EnderDamage.java +++ b/src/main/java/gregtech/api/enchants/Enchantment_EnderDamage.java @@ -46,14 +46,22 @@ public class Enchantment_EnderDamage extends EnchantmentDamage { @Override public void func_151367_b(EntityLivingBase aHurtEntity, Entity aDamagingEntity, int aLevel) { if ((aHurtEntity instanceof EntityEnderman || aHurtEntity instanceof EntityDragon - || (aHurtEntity.getClass().getName().contains(".") && aHurtEntity.getClass().getName() - .substring(aHurtEntity.getClass().getName().lastIndexOf(".")).contains("Ender")))) { + || (aHurtEntity.getClass() + .getName() + .contains(".") + && aHurtEntity.getClass() + .getName() + .substring( + aHurtEntity.getClass() + .getName() + .lastIndexOf(".")) + .contains("Ender")))) { // Weakness causes Endermen to not be able to teleport with GT being installed. - aHurtEntity - .addPotionEffect(new PotionEffect(Potion.weakness.id, aLevel * 200, Math.max(1, (5 * aLevel) / 7))); + aHurtEntity.addPotionEffect( + new PotionEffect(Potion.weakness.id, aLevel * 200, Math.max(1, (5 * aLevel) / 7))); // They also get Poisoned. If you have this Enchant on an Arrow, you can kill the Ender Dragon easier. - aHurtEntity - .addPotionEffect(new PotionEffect(Potion.poison.id, aLevel * 200, Math.max(1, (5 * aLevel) / 7))); + aHurtEntity.addPotionEffect( + new PotionEffect(Potion.poison.id, aLevel * 200, Math.max(1, (5 * aLevel) / 7))); } } diff --git a/src/main/java/gregtech/api/enchants/Enchantment_Radioactivity.java b/src/main/java/gregtech/api/enchants/Enchantment_Radioactivity.java index 34035c9457..bf4cc00be4 100644 --- a/src/main/java/gregtech/api/enchants/Enchantment_Radioactivity.java +++ b/src/main/java/gregtech/api/enchants/Enchantment_Radioactivity.java @@ -18,11 +18,16 @@ public class Enchantment_Radioactivity extends EnchantmentDamage { public Enchantment_Radioactivity() { super(GT_Config.addIDConfig(ConfigCategories.IDs.enchantments, "Radioactivity", 14), 0, -1); GT_LanguageManager.addStringLocalization(getName(), "Radioactivity"); - Materials.Plutonium.setEnchantmentForTools(this, 1).setEnchantmentForArmors(this, 1); - Materials.Uranium235.setEnchantmentForTools(this, 2).setEnchantmentForArmors(this, 2); - Materials.Plutonium241.setEnchantmentForTools(this, 3).setEnchantmentForArmors(this, 3); - Materials.NaquadahEnriched.setEnchantmentForTools(this, 4).setEnchantmentForArmors(this, 4); - Materials.Naquadria.setEnchantmentForTools(this, 5).setEnchantmentForArmors(this, 5); + Materials.Plutonium.setEnchantmentForTools(this, 1) + .setEnchantmentForArmors(this, 1); + Materials.Uranium235.setEnchantmentForTools(this, 2) + .setEnchantmentForArmors(this, 2); + Materials.Plutonium241.setEnchantmentForTools(this, 3) + .setEnchantmentForArmors(this, 3); + Materials.NaquadahEnriched.setEnchantmentForTools(this, 4) + .setEnchantmentForArmors(this, 4); + Materials.Naquadria.setEnchantmentForTools(this, 5) + .setEnchantmentForArmors(this, 5); INSTANCE = this; } diff --git a/src/main/java/gregtech/api/enums/GT_HatchElement.java b/src/main/java/gregtech/api/enums/GT_HatchElement.java index 8d8603a10e..ac8dc7c4dd 100644 --- a/src/main/java/gregtech/api/enums/GT_HatchElement.java +++ b/src/main/java/gregtech/api/enums/GT_HatchElement.java @@ -86,7 +86,8 @@ public enum GT_HatchElement implements IHatchElement<GT_MetaTileEntity_MultiBloc @Override public long count(GT_MetaTileEntity_MultiBlockBase t) { - return t.getExoticEnergyHatches().size(); + return t.getExoticEnergyHatches() + .size(); } },; diff --git a/src/main/java/gregtech/api/enums/GT_Values.java b/src/main/java/gregtech/api/enums/GT_Values.java index 6ccf092461..eb742c902f 100644 --- a/src/main/java/gregtech/api/enums/GT_Values.java +++ b/src/main/java/gregtech/api/enums/GT_Values.java @@ -86,9 +86,13 @@ public class GT_Values { * tier. These leave a bit of headroom for cable and transformer losses, but not enough to make it a great gain. */ // this will correctly map ULV to 7. - public static final long[] VP = Arrays.stream(V).map( - i -> BigInteger.valueOf(i).multiply(BigInteger.valueOf(30)).divide(BigInteger.valueOf(32)).longValueExact()) - .toArray(); + public static final long[] VP = Arrays.stream(V) + .map( + i -> BigInteger.valueOf(i) + .multiply(BigInteger.valueOf(30)) + .divide(BigInteger.valueOf(32)) + .longValueExact()) + .toArray(); // Why -7? Mystery of the universe. Something may break if you change this so please do not without extensive // testing. // TODO:Adding that in coremod!!! diff --git a/src/main/java/gregtech/api/enums/ItemList.java b/src/main/java/gregtech/api/enums/ItemList.java index 25957078aa..e1b6ada3e6 100644 --- a/src/main/java/gregtech/api/enums/ItemList.java +++ b/src/main/java/gregtech/api/enums/ItemList.java @@ -2163,8 +2163,12 @@ public enum ItemList implements IItemContainer { StringBuilder tCamelCasedDisplayNameBuilder = new StringBuilder(); final String[] tDisplayNameWords = aDisplayName.split("\\W"); for (String tWord : tDisplayNameWords) { - if (tWord.length() > 0) tCamelCasedDisplayNameBuilder.append(tWord.substring(0, 1).toUpperCase(Locale.US)); - if (tWord.length() > 1) tCamelCasedDisplayNameBuilder.append(tWord.substring(1).toLowerCase(Locale.US)); + if (tWord.length() > 0) tCamelCasedDisplayNameBuilder.append( + tWord.substring(0, 1) + .toUpperCase(Locale.US)); + if (tWord.length() > 1) tCamelCasedDisplayNameBuilder.append( + tWord.substring(1) + .toLowerCase(Locale.US)); } if (tCamelCasedDisplayNameBuilder.length() == 0) { // CamelCased DisplayName is empty, so use hash of aDisplayName diff --git a/src/main/java/gregtech/api/enums/MaterialBuilder.java b/src/main/java/gregtech/api/enums/MaterialBuilder.java index d265faae8e..fd131bbc8c 100644 --- a/src/main/java/gregtech/api/enums/MaterialBuilder.java +++ b/src/main/java/gregtech/api/enums/MaterialBuilder.java @@ -42,7 +42,8 @@ public class MaterialBuilder { public MaterialBuilder(int metaItemSubID, TextureSet iconSet, String defaultLocalName) { this.metaItemSubID = metaItemSubID; this.iconSet = iconSet; - this.name = defaultLocalName.replace(" ", "").replace("-", ""); + this.name = defaultLocalName.replace(" ", "") + .replace("-", ""); this.defaultLocalName = defaultLocalName; } @@ -72,7 +73,8 @@ public class MaterialBuilder { color, extraData, materialList, - aspects).setHasCorrespondingFluid(hasCorrespondingFluid).setHasCorrespondingGas(hasCorrespondingGas) + aspects).setHasCorrespondingFluid(hasCorrespondingFluid) + .setHasCorrespondingGas(hasCorrespondingGas) .setCanBeCracked(canBeCracked); } diff --git a/src/main/java/gregtech/api/enums/Materials.java b/src/main/java/gregtech/api/enums/Materials.java index 3ff4d70920..c64b7a6d14 100644 --- a/src/main/java/gregtech/api/enums/Materials.java +++ b/src/main/java/gregtech/api/enums/Materials.java @@ -1329,9 +1329,12 @@ public class Materials implements IColorModulationContainer, ISubTagContainer { aColor); mExtraData = aExtraData; mMaterialList.addAll(aMaterialList); - if (mMaterialList.size() == 1) mChemicalFormula = mMaterialList.get(0).toString(true); - else mChemicalFormula = mMaterialList.stream().map(MaterialStack::toString).collect(Collectors.joining()) - .replaceAll("_", "-"); + if (mMaterialList.size() == 1) mChemicalFormula = mMaterialList.get(0) + .toString(true); + else mChemicalFormula = mMaterialList.stream() + .map(MaterialStack::toString) + .collect(Collectors.joining()) + .replaceAll("_", "-"); int tAmountOfComponents = 0, tMeltingPoint = 0; for (MaterialStack tMaterial : mMaterialList) { @@ -1352,18 +1355,39 @@ public class Materials implements IColorModulationContainer, ISubTagContainer { } private static void setSmeltingInto() { - SamariumMagnetic.setSmeltingInto(Samarium).setMaceratingInto(Samarium).setArcSmeltingInto(Samarium); - NeodymiumMagnetic.setSmeltingInto(Neodymium).setMaceratingInto(Neodymium).setArcSmeltingInto(Neodymium); - SteelMagnetic.setSmeltingInto(Steel).setMaceratingInto(Steel).setArcSmeltingInto(Steel); - Iron.setSmeltingInto(Iron).setMaceratingInto(Iron).setArcSmeltingInto(WroughtIron); - AnyIron.setSmeltingInto(Iron).setMaceratingInto(Iron).setArcSmeltingInto(WroughtIron); - PigIron.setSmeltingInto(Iron).setMaceratingInto(Iron).setArcSmeltingInto(WroughtIron); - WroughtIron.setSmeltingInto(WroughtIron).setMaceratingInto(WroughtIron).setArcSmeltingInto(WroughtIron); - IronMagnetic.setSmeltingInto(Iron).setMaceratingInto(Iron).setArcSmeltingInto(WroughtIron); - Copper.setSmeltingInto(Copper).setMaceratingInto(Copper).setArcSmeltingInto(AnnealedCopper); - AnyCopper.setSmeltingInto(Copper).setMaceratingInto(Copper).setArcSmeltingInto(AnnealedCopper); - AnnealedCopper.setSmeltingInto(AnnealedCopper).setMaceratingInto(AnnealedCopper) - .setArcSmeltingInto(AnnealedCopper); + SamariumMagnetic.setSmeltingInto(Samarium) + .setMaceratingInto(Samarium) + .setArcSmeltingInto(Samarium); + NeodymiumMagnetic.setSmeltingInto(Neodymium) + .setMaceratingInto(Neodymium) + .setArcSmeltingInto(Neodymium); + SteelMagnetic.setSmeltingInto(Steel) + .setMaceratingInto(Steel) + .setArcSmeltingInto(Steel); + Iron.setSmeltingInto(Iron) + .setMaceratingInto(Iron) + .setArcSmeltingInto(WroughtIron); + AnyIron.setSmeltingInto(Iron) + .setMaceratingInto(Iron) + .setArcSmeltingInto(WroughtIron); + PigIron.setSmeltingInto(Iron) + .setMaceratingInto(Iron) + .setArcSmeltingInto(WroughtIron); + WroughtIron.setSmeltingInto(WroughtIron) + .setMaceratingInto(WroughtIron) + .setArcSmeltingInto(WroughtIron); + IronMagnetic.setSmeltingInto(Iron) + .setMaceratingInto(Iron) + .setArcSmeltingInto(WroughtIron); + Copper.setSmeltingInto(Copper) + .setMaceratingInto(Copper) + .setArcSmeltingInto(AnnealedCopper); + AnyCopper.setSmeltingInto(Copper) + .setMaceratingInto(Copper) + .setArcSmeltingInto(AnnealedCopper); + AnnealedCopper.setSmeltingInto(AnnealedCopper) + .setMaceratingInto(AnnealedCopper) + .setArcSmeltingInto(AnnealedCopper); Netherrack.setSmeltingInto(NetherBrick); MeatRaw.setSmeltingInto(MeatCooked); Sand.setSmeltingInto(Glass); @@ -1378,18 +1402,29 @@ public class Materials implements IColorModulationContainer, ISubTagContainer { } private static void setDirectSmelting() { - Cinnabar.setDirectSmelting(Mercury).add(SubTag.INDUCTIONSMELTING_LOW_OUTPUT).add(SubTag.SMELTING_TO_GEM); - Tetrahedrite.setDirectSmelting(Copper).add(SubTag.INDUCTIONSMELTING_LOW_OUTPUT) - .add(SubTag.DONT_ADD_DEFAULT_BBF_RECIPE); - Chalcopyrite.setDirectSmelting(Copper).add(SubTag.INDUCTIONSMELTING_LOW_OUTPUT) - .add(SubTag.DONT_ADD_DEFAULT_BBF_RECIPE); - Malachite.setDirectSmelting(Copper).add(SubTag.INDUCTIONSMELTING_LOW_OUTPUT); - Pentlandite.setDirectSmelting(Nickel).add(SubTag.INDUCTIONSMELTING_LOW_OUTPUT); - Sphalerite.setDirectSmelting(Zinc).add(SubTag.INDUCTIONSMELTING_LOW_OUTPUT); - Pyrite.setDirectSmelting(Iron).add(SubTag.INDUCTIONSMELTING_LOW_OUTPUT); - BasalticMineralSand.setDirectSmelting(Iron).add(SubTag.INDUCTIONSMELTING_LOW_OUTPUT); - GraniticMineralSand.setDirectSmelting(Iron).add(SubTag.INDUCTIONSMELTING_LOW_OUTPUT); - YellowLimonite.setDirectSmelting(Iron).add(SubTag.INDUCTIONSMELTING_LOW_OUTPUT); + Cinnabar.setDirectSmelting(Mercury) + .add(SubTag.INDUCTIONSMELTING_LOW_OUTPUT) + .add(SubTag.SMELTING_TO_GEM); + Tetrahedrite.setDirectSmelting(Copper) + .add(SubTag.INDUCTIONSMELTING_LOW_OUTPUT) + .add(SubTag.DONT_ADD_DEFAULT_BBF_RECIPE); + Chalcopyrite.setDirectSmelting(Copper) + .add(SubTag.INDUCTIONSMELTING_LOW_OUTPUT) + .add(SubTag.DONT_ADD_DEFAULT_BBF_RECIPE); + Malachite.setDirectSmelting(Copper) + .add(SubTag.INDUCTIONSMELTING_LOW_OUTPUT); + Pentlandite.setDirectSmelting(Nickel) + .add(SubTag.INDUCTIONSMELTING_LOW_OUTPUT); + Sphalerite.setDirectSmelting(Zinc) + .add(SubTag.INDUCTIONSMELTING_LOW_OUTPUT); + Pyrite.setDirectSmelting(Iron) + .add(SubTag.INDUCTIONSMELTING_LOW_OUTPUT); + BasalticMineralSand.setDirectSmelting(Iron) + .add(SubTag.INDUCTIONSMELTING_LOW_OUTPUT); + GraniticMineralSand.setDirectSmelting(Iron) + .add(SubTag.INDUCTIONSMELTING_LOW_OUTPUT); + YellowLimonite.setDirectSmelting(Iron) + .add(SubTag.INDUCTIONSMELTING_LOW_OUTPUT); BrownLimonite.setDirectSmelting(Iron); BandedIron.setDirectSmelting(Iron); Magnetite.setDirectSmelting(Iron); @@ -1399,8 +1434,10 @@ public class Materials implements IColorModulationContainer, ISubTagContainer { Garnierite.setDirectSmelting(Nickel); Cobaltite.setDirectSmelting(Cobalt); Stibnite.setDirectSmelting(Antimony); - Cooperite.setDirectSmelting(Platinum).add(SubTag.DONT_ADD_DEFAULT_BBF_RECIPE); - Molybdenite.setDirectSmelting(Molybdenum).add(SubTag.DONT_ADD_DEFAULT_BBF_RECIPE); + Cooperite.setDirectSmelting(Platinum) + .add(SubTag.DONT_ADD_DEFAULT_BBF_RECIPE); + Molybdenite.setDirectSmelting(Molybdenum) + .add(SubTag.DONT_ADD_DEFAULT_BBF_RECIPE); Galena.setDirectSmelting(Lead); RoastedIron.setDirectSmelting(Iron); RoastedAntimony.setDirectSmelting(Antimony); @@ -1413,35 +1450,69 @@ public class Materials implements IColorModulationContainer, ISubTagContainer { } private static void setMultipliers() { - Amber.setOreMultiplier(2).setSmeltingMultiplier(2); - InfusedAir.setOreMultiplier(2).setSmeltingMultiplier(2); - InfusedFire.setOreMultiplier(2).setSmeltingMultiplier(2); - InfusedEarth.setOreMultiplier(2).setSmeltingMultiplier(2); - InfusedWater.setOreMultiplier(2).setSmeltingMultiplier(2); - InfusedEntropy.setOreMultiplier(2).setSmeltingMultiplier(2); - InfusedOrder.setOreMultiplier(2).setSmeltingMultiplier(2); - InfusedVis.setOreMultiplier(2).setSmeltingMultiplier(2); - InfusedDull.setOreMultiplier(2).setSmeltingMultiplier(2); - Salt.setOreMultiplier(2).setSmeltingMultiplier(2); - RockSalt.setOreMultiplier(2).setSmeltingMultiplier(2); - Scheelite.setOreMultiplier(2).setSmeltingMultiplier(2); - Tungstate.setOreMultiplier(2).setSmeltingMultiplier(2); - Cassiterite.setOreMultiplier(2).setSmeltingMultiplier(2); - CassiteriteSand.setOreMultiplier(2).setSmeltingMultiplier(2); - NetherQuartz.setOreMultiplier(2).setSmeltingMultiplier(2); - CertusQuartz.setOreMultiplier(2).setSmeltingMultiplier(2); - TricalciumPhosphate.setOreMultiplier(3).setSmeltingMultiplier(3); - Saltpeter.setOreMultiplier(4).setSmeltingMultiplier(4); - Apatite.setOreMultiplier(4).setSmeltingMultiplier(4).setByProductMultiplier(2); - Electrotine.setOreMultiplier(5).setSmeltingMultiplier(5); - Teslatite.setOreMultiplier(5).setSmeltingMultiplier(5); - Redstone.setOreMultiplier(5).setSmeltingMultiplier(5); - Glowstone.setOreMultiplier(5).setSmeltingMultiplier(5); - Lapis.setOreMultiplier(6).setSmeltingMultiplier(6).setByProductMultiplier(4); - Sodalite.setOreMultiplier(6).setSmeltingMultiplier(6).setByProductMultiplier(4); - Lazurite.setOreMultiplier(6).setSmeltingMultiplier(6).setByProductMultiplier(4); - Monazite.setOreMultiplier(8).setSmeltingMultiplier(8).setByProductMultiplier(2); - Cryolite.setOreMultiplier(4).setByProductMultiplier(4); + Amber.setOreMultiplier(2) + .setSmeltingMultiplier(2); + InfusedAir.setOreMultiplier(2) + .setSmeltingMultiplier(2); + InfusedFire.setOreMultiplier(2) + .setSmeltingMultiplier(2); + InfusedEarth.setOreMultiplier(2) + .setSmeltingMultiplier(2); + InfusedWater.setOreMultiplier(2) + .setSmeltingMultiplier(2); + InfusedEntropy.setOreMultiplier(2) + .setSmeltingMultiplier(2); + InfusedOrder.setOreMultiplier(2) + .setSmeltingMultiplier(2); + InfusedVis.setOreMultiplier(2) + .setSmeltingMultiplier(2); + InfusedDull.setOreMultiplier(2) + .setSmeltingMultiplier(2); + Salt.setOreMultiplier(2) + .setSmeltingMultiplier(2); + RockSalt.setOreMultiplier(2) + .setSmeltingMultiplier(2); + Scheelite.setOreMultiplier(2) + .setSmeltingMultiplier(2); + Tungstate.setOreMultiplier(2) + .setSmeltingMultiplier(2); + Cassiterite.setOreMultiplier(2) + .setSmeltingMultiplier(2); + CassiteriteSand.setOreMultiplier(2) + .setSmeltingMultiplier(2); + NetherQuartz.setOreMultiplier(2) + .setSmeltingMultiplier(2); + CertusQuartz.setOreMultiplier(2) + .setSmeltingMultiplier(2); + TricalciumPhosphate.setOreMultiplier(3) + .setSmeltingMultiplier(3); + Saltpeter.setOreMultiplier(4) + .setSmeltingMultiplier(4); + Apatite.setOreMultiplier(4) + .setSmeltingMultiplier(4) + .setByProductMultiplier(2); + Electrotine.setOreMultiplier(5) + .setSmeltingMultiplier(5); + Teslatite.setOreMultiplier(5) + .setSmeltingMultiplier(5); + Redstone.setOreMultiplier(5) + .setSmeltingMultiplier(5); + Glowstone.setOreMultiplier(5) + .setSmeltingMultiplier(5); + Lapis.setOreMultiplier(6) + .setSmeltingMultiplier(6) + .setByProductMultiplier(4); + Sodalite.setOreMultiplier(6) + .setSmeltingMultiplier(6) + .setByProductMultiplier(4); + Lazurite.setOreMultiplier(6) + .setSmeltingMultiplier(6) + .setByProductMultiplier(4); + Monazite.setOreMultiplier(8) + .setSmeltingMultiplier(8) + .setByProductMultiplier(2); + Cryolite.setOreMultiplier(4) + .setByProductMultiplier(4); } private static void setEnchantmentKnockbackTools() { @@ -1630,7 +1701,8 @@ public class Materials implements IColorModulationContainer, ISubTagContainer { YellowLimonite.addOreByProducts(Nickel, BrownLimonite, Cobalt); Lepidolite.addOreByProducts(Lithium, Caesium); Andradite.addOreByProducts(GarnetYellow, Iron); - Pyrolusite.addOreByProducts(Manganese, Tantalite, Niobium).add(SubTag.DONT_ADD_DEFAULT_BBF_RECIPE); + Pyrolusite.addOreByProducts(Manganese, Tantalite, Niobium) + .add(SubTag.DONT_ADD_DEFAULT_BBF_RECIPE); TricalciumPhosphate.addOreByProducts(Apatite, Phosphate, Pyrochlore); Apatite.addOreByProducts(TricalciumPhosphate, Phosphate, Pyrochlore); Pyrochlore.addOreByProducts(Apatite, Calcite, Niobium); @@ -1838,8 +1910,11 @@ public class Materials implements IColorModulationContainer, ISubTagContainer { private static void initSubTags() { SubTag.ELECTROMAGNETIC_SEPERATION_NEODYMIUM.addTo(Bastnasite, Monazite, Forcicium, Forcillium); - SubTag.ELECTROMAGNETIC_SEPERATION_GOLD - .addTo(Magnetite, VanadiumMagnetite, BasalticMineralSand, GraniticMineralSand); + SubTag.ELECTROMAGNETIC_SEPERATION_GOLD.addTo( + Magnetite, + VanadiumMagnetite, + BasalticMineralSand, + GraniticMineralSand); SubTag.NO_RECIPES.addTo(MagnetohydrodynamicallyConstrainedStarMatter); @@ -1861,8 +1936,13 @@ public class Materials implements IColorModulationContainer, ISubTagContainer { Chromite, Andradite); - SubTag.BLASTFURNACE_CALCITE_DOUBLE - .addTo(Pyrite, BrownLimonite, YellowLimonite, BasalticMineralSand, GraniticMineralSand, Magnetite); + SubTag.BLASTFURNACE_CALCITE_DOUBLE.addTo( + Pyrite, + BrownLimonite, + YellowLimonite, + BasalticMineralSand, + GraniticMineralSand, + Magnetite); SubTag.BLASTFURNACE_CALCITE_TRIPLE.addTo(Iron, PigIron, DeepIron, ShadowIron, WroughtIron, MeteoricIron); @@ -2240,14 +2320,22 @@ public class Materials implements IColorModulationContainer, ISubTagContainer { Monazite.add(SubTag.CRYSTAL, SubTag.NO_SMASHING, SubTag.NO_SMELTING, SubTag.CRYSTALLISABLE); Quartzite.add(SubTag.CRYSTAL, SubTag.NO_SMASHING, SubTag.NO_SMELTING, SubTag.CRYSTALLISABLE, SubTag.QUARTZ); Quartz.add(SubTag.CRYSTAL, SubTag.NO_SMASHING, SubTag.NO_SMELTING, SubTag.CRYSTALLISABLE, SubTag.QUARTZ); - SiliconDioxide - .add(SubTag.CRYSTAL, SubTag.NO_SMASHING, SubTag.NO_SMELTING, SubTag.CRYSTALLISABLE, SubTag.QUARTZ); + SiliconDioxide.add( + SubTag.CRYSTAL, + SubTag.NO_SMASHING, + SubTag.NO_SMELTING, + SubTag.CRYSTALLISABLE, + SubTag.QUARTZ); Dilithium.add(SubTag.CRYSTAL, SubTag.NO_SMASHING, SubTag.NO_SMELTING, SubTag.CRYSTALLISABLE, SubTag.QUARTZ); NetherQuartz.add(SubTag.CRYSTAL, SubTag.NO_SMASHING, SubTag.NO_SMELTING, SubTag.CRYSTALLISABLE, SubTag.QUARTZ); CertusQuartz.add(SubTag.CRYSTAL, SubTag.NO_SMASHING, SubTag.NO_SMELTING, SubTag.CRYSTALLISABLE, SubTag.QUARTZ); Fluix.add(SubTag.CRYSTAL, SubTag.NO_SMASHING, SubTag.NO_SMELTING, SubTag.CRYSTALLISABLE, SubTag.QUARTZ); - TricalciumPhosphate - .add(SubTag.CRYSTAL, SubTag.NO_SMASHING, SubTag.NO_SMELTING, SubTag.FLAMMABLE, SubTag.EXPLOSIVE); + TricalciumPhosphate.add( + SubTag.CRYSTAL, + SubTag.NO_SMASHING, + SubTag.NO_SMELTING, + SubTag.FLAMMABLE, + SubTag.EXPLOSIVE); Phosphate.add(SubTag.CRYSTAL, SubTag.NO_SMASHING, SubTag.NO_SMELTING, SubTag.FLAMMABLE, SubTag.EXPLOSIVE); InfusedAir.add(SubTag.CRYSTAL, SubTag.NO_SMASHING, SubTag.NO_SMELTING, SubTag.MAGICAL, SubTag.UNBURNABLE); InfusedFire.add(SubTag.CRYSTAL, SubTag.NO_SMASHING, SubTag.NO_SMELTING, SubTag.MAGICAL, SubTag.UNBURNABLE); @@ -2313,16 +2401,19 @@ public class Materials implements IColorModulationContainer, ISubTagContainer { mMaterialHandlers.forEach(IMaterialHandler::onMaterialsInit); // This is where addon mods can add/manipulate // materials initMaterialProperties(); // No more material addition or manipulation should be done past this point! - MATERIALS_ARRAY = MATERIALS_MAP.values().toArray(new Materials[0]); // Generate standard object array. This is a - // lot faster to loop over. + MATERIALS_ARRAY = MATERIALS_MAP.values() + .toArray(new Materials[0]); // Generate standard object array. This is a + // lot faster to loop over. VALUES = Arrays.asList(MATERIALS_ARRAY); if (!NewHorizonsCoreMod.isModLoaded() && !GT_Mod.gregtechproxy.mEnableAllComponents) OrePrefixes.initMaterialComponents(); else { OrePrefixes.ingotHot.mDisabledItems.addAll( - Arrays.stream(Materials.values()).parallel().filter(OrePrefixes.ingotHot::doGenerateItem) - .filter(m -> m.mBlastFurnaceTemp < 1750 && m.mAutoGenerateBlastFurnaceRecipes) - .collect(Collectors.toSet())); + Arrays.stream(Materials.values()) + .parallel() + .filter(OrePrefixes.ingotHot::doGenerateItem) + .filter(m -> m.mBlastFurnaceTemp < 1750 && m.mAutoGenerateBlastFurnaceRecipes) + .collect(Collectors.toSet())); OrePrefixes.ingotHot.disableComponent(Materials.Reinforced); OrePrefixes.ingotHot.disableComponent(Materials.ConductiveIron); OrePrefixes.ingotHot.disableComponent(Materials.FierySteel); @@ -2384,22 +2475,32 @@ public class Materials implements IColorModulationContainer, ISubTagContainer { } private static void addTemperatureValues(Materials aMaterial, String aConfigPath) { - aMaterial.mMeltingPoint = GregTech_API.sMaterialProperties - .get(aConfigPath, "MeltingPoint", aMaterial.mMeltingPoint); - aMaterial.mBlastFurnaceRequired = GregTech_API.sMaterialProperties - .get(aConfigPath, "BlastFurnaceRequired", aMaterial.mBlastFurnaceRequired); - aMaterial.mBlastFurnaceTemp = (short) GregTech_API.sMaterialProperties - .get(aConfigPath, "BlastFurnaceTemp", aMaterial.mBlastFurnaceTemp); + aMaterial.mMeltingPoint = GregTech_API.sMaterialProperties.get( + aConfigPath, + "MeltingPoint", + aMaterial.mMeltingPoint); + aMaterial.mBlastFurnaceRequired = GregTech_API.sMaterialProperties.get( + aConfigPath, + "BlastFurnaceRequired", + aMaterial.mBlastFurnaceRequired); + aMaterial.mBlastFurnaceTemp = (short) GregTech_API.sMaterialProperties.get( + aConfigPath, + "BlastFurnaceTemp", + aMaterial.mBlastFurnaceTemp); aMaterial.mGasTemp = GregTech_API.sMaterialProperties.get(aConfigPath, "GasTemp", aMaterial.mGasTemp); aMaterial.setHeatDamage( (float) GregTech_API.sMaterialProperties.get(aConfigPath, "HeatDamage", aMaterial.mHeatDamage)); } private static void addDensityValues(Materials aMaterial, String aConfigPath) { - aMaterial.mDensityMultiplier = GregTech_API.sMaterialProperties - .get(aConfigPath, "DensityMultiplier", aMaterial.mDensityMultiplier); - aMaterial.mDensityDivider = GregTech_API.sMaterialProperties - .get(aConfigPath, "DensityDivider", aMaterial.mDensityDivider); + aMaterial.mDensityMultiplier = GregTech_API.sMaterialProperties.get( + aConfigPath, + "DensityMultiplier", + aMaterial.mDensityMultiplier); + aMaterial.mDensityDivider = GregTech_API.sMaterialProperties.get( + aConfigPath, + "DensityDivider", + aMaterial.mDensityDivider); aMaterial.mDensity = (long) GregTech_API.sMaterialProperties.get( aConfigPath, "Density", @@ -2408,10 +2509,14 @@ public class Materials implements IColorModulationContainer, ISubTagContainer { } private static void addColorValues(Materials aMaterial, String aConfigPath) { - aMaterial.mTransparent = GregTech_API.sMaterialProperties - .get(aConfigPath, "Transparent", aMaterial.mTransparent); - String aColor = GregTech_API.sMaterialProperties - .get(aConfigPath, "DyeColor", aMaterial.mColor == Dyes._NULL ? "None" : aMaterial.mColor.toString()); + aMaterial.mTransparent = GregTech_API.sMaterialProperties.get( + aConfigPath, + "Transparent", + aMaterial.mTransparent); + String aColor = GregTech_API.sMaterialProperties.get( + aConfigPath, + "DyeColor", + aMaterial.mColor == Dyes._NULL ? "None" : aMaterial.mColor.toString()); aMaterial.mColor = aColor.equals("None") ? Dyes._NULL : Dyes.get(aColor); String[] aRGBA = GregTech_API.sMaterialProperties.get( aConfigPath, @@ -2423,7 +2528,7 @@ public class Materials implements IColorModulationContainer, ISubTagContainer { + "," + aMaterial.mRGBa[3] + ",") - .split(","); + .split(","); aMaterial.mRGBa[0] = Short.parseShort(aRGBA[0]); aMaterial.mRGBa[1] = Short.parseShort(aRGBA[1]); aMaterial.mRGBa[2] = Short.parseShort(aRGBA[2]); @@ -2431,12 +2536,18 @@ public class Materials implements IColorModulationContainer, ISubTagContainer { } private static void addToolValues(Materials aMaterial, String aConfigPath) { - aMaterial.mDurability = GregTech_API.sMaterialProperties - .get(aConfigPath, "ToolDurability", aMaterial.mDurability); - aMaterial.mToolSpeed = (float) GregTech_API.sMaterialProperties - .get(aConfigPath, "ToolSpeed", aMaterial.mToolSpeed); - aMaterial.mToolQuality = (byte) GregTech_API.sMaterialProperties - .get(aConfigPath, "ToolQuality", aMaterial.mToolQuality); + aMaterial.mDurability = GregTech_API.sMaterialProperties.get( + aConfigPath, + "ToolDurability", + aMaterial.mDurability); + aMaterial.mToolSpeed = (float) GregTech_API.sMaterialProperties.get( + aConfigPath, + "ToolSpeed", + aMaterial.mToolSpeed); + aMaterial.mToolQuality = (byte) GregTech_API.sMaterialProperties.get( + aConfigPath, + "ToolQuality", + aMaterial.mToolQuality); // Moved from GT_Proxy? (Not sure) aMaterial.mHandleMaterial = (aMaterial == Desh ? aMaterial.mHandleMaterial : aMaterial == Diamond || aMaterial == Thaumium ? Wood @@ -2456,32 +2567,42 @@ public class Materials implements IColorModulationContainer, ISubTagContainer { } private static void addEnchantmentValues(Materials aMaterial, String aConfigPath) { - aMaterial.mEnchantmentToolsLevel = (byte) GregTech_API.sMaterialProperties - .get(aConfigPath, "EnchantmentLevel", aMaterial.mEnchantmentToolsLevel); + aMaterial.mEnchantmentToolsLevel = (byte) GregTech_API.sMaterialProperties.get( + aConfigPath, + "EnchantmentLevel", + aMaterial.mEnchantmentToolsLevel); String aEnchantmentName = GregTech_API.sMaterialProperties.get( aConfigPath, "Enchantment", aMaterial.mEnchantmentTools != null ? aMaterial.mEnchantmentTools.getName() : ""); if (aMaterial.mEnchantmentTools != null && !aEnchantmentName.equals(aMaterial.mEnchantmentTools.getName())) IntStream.range(0, Enchantment.enchantmentsList.length) - .filter(i -> aEnchantmentName.equals(Enchantment.enchantmentsList[i].getName())) - .forEach(i -> aMaterial.mEnchantmentTools = Enchantment.enchantmentsList[i]); + .filter(i -> aEnchantmentName.equals(Enchantment.enchantmentsList[i].getName())) + .forEach(i -> aMaterial.mEnchantmentTools = Enchantment.enchantmentsList[i]); } private static void addProcessingIntoValues(Materials aMaterial, String aConfigPath) { aMaterial.mSmeltInto = MATERIALS_MAP.get( GregTech_API.sMaterialProperties.get(aConfigPath, "MaterialSmeltInto", aMaterial.mSmeltInto.mName)); aMaterial.mMacerateInto = MATERIALS_MAP.get( - GregTech_API.sMaterialProperties - .get(aConfigPath, "MaterialMacerateInto", aMaterial.mMacerateInto.mName)); + GregTech_API.sMaterialProperties.get( + aConfigPath, + "MaterialMacerateInto", + aMaterial.mMacerateInto.mName)); aMaterial.mArcSmeltInto = MATERIALS_MAP.get( - GregTech_API.sMaterialProperties - .get(aConfigPath, "MaterialArcSmeltInto", aMaterial.mArcSmeltInto.mName)); + GregTech_API.sMaterialProperties.get( + aConfigPath, + "MaterialArcSmeltInto", + aMaterial.mArcSmeltInto.mName)); aMaterial.mDirectSmelting = MATERIALS_MAP.get( - GregTech_API.sMaterialProperties - .get(aConfigPath, "MaterialDirectSmeltInto", aMaterial.mDirectSmelting.mName)); - aMaterial.mAutoGenerateBlastFurnaceRecipes = GregTech_API.sMaterialProperties - .get(aConfigPath, "AutoGenerateBlastFurnaceRecipes", aMaterial.mAutoGenerateBlastFurnaceRecipes); + GregTech_API.sMaterialProperties.get( + aConfigPath, + "MaterialDirectSmeltInto", + aMaterial.mDirectSmelting.mName)); + aMaterial.mAutoGenerateBlastFurnaceRecipes = GregTech_API.sMaterialProperties.get( + aConfigPath, + "AutoGenerateBlastFurnaceRecipes", + aMaterial.mAutoGenerateBlastFurnaceRecipes); } private static void addMultiplierValues(Materials aMaterial, String aConfigPath) { @@ -2489,11 +2610,15 @@ public class Materials implements IColorModulationContainer, ISubTagContainer { aMaterial.setOreMultiplier( GregTech_API.sMaterialProperties.get(aConfigPath, "OreMultiplier", aMaterial.mOreMultiplier)); aMaterial.setSmeltingMultiplier( - GregTech_API.sMaterialProperties - .get(aConfigPath, "OreSmeltingMultiplier", aMaterial.mSmeltingMultiplier)); + GregTech_API.sMaterialProperties.get( + aConfigPath, + "OreSmeltingMultiplier", + aMaterial.mSmeltingMultiplier)); aMaterial.setByProductMultiplier( - GregTech_API.sMaterialProperties - .get(aConfigPath, "OreByProductMultiplier", aMaterial.mByProductMultiplier)); + GregTech_API.sMaterialProperties.get( + aConfigPath, + "OreByProductMultiplier", + aMaterial.mByProductMultiplier)); } private static void addHasGasFluid(Materials aMaterial, String aConfigPath) { @@ -2516,16 +2641,22 @@ public class Materials implements IColorModulationContainer, ISubTagContainer { } private static void addInternalStuff(Materials aMaterial, String aConfigPath) { - aMaterial.mMetaItemSubID = GregTech_API.sMaterialProperties - .get(aConfigPath, "MaterialID", aMaterial.mCustomOre ? -1 : aMaterial.mMetaItemSubID); + aMaterial.mMetaItemSubID = GregTech_API.sMaterialProperties.get( + aConfigPath, + "MaterialID", + aMaterial.mCustomOre ? -1 : aMaterial.mMetaItemSubID); aMaterial.mTypes = GregTech_API.sMaterialProperties.get( aConfigPath, "MaterialTypes", aMaterial.mCustomOre ? 1 | 2 | 4 | 8 | 16 | 32 | 64 | 128 : aMaterial.mTypes); - aMaterial.mUnificatable = GregTech_API.sMaterialProperties - .get(aConfigPath, "Unificatable", aMaterial.mUnificatable); - aMaterial.mHasParentMod = GregTech_API.sMaterialProperties - .get(aConfigPath, "HasParentMod", aMaterial.mHasParentMod); + aMaterial.mUnificatable = GregTech_API.sMaterialProperties.get( + aConfigPath, + "Unificatable", + aMaterial.mUnificatable); + aMaterial.mHasParentMod = GregTech_API.sMaterialProperties.get( + aConfigPath, + "HasParentMod", + aMaterial.mHasParentMod); } private static void addLocalisation(Materials aMaterial, String aConfigPath) { @@ -2533,8 +2664,10 @@ public class Materials implements IColorModulationContainer, ISubTagContainer { aConfigPath, "MaterialName", aMaterial.mCustomOre ? "CustomOre" + aMaterial.mCustomID : aMaterial.mDefaultLocalName); - aMaterial.mChemicalFormula = GregTech_API.sMaterialProperties - .get(aConfigPath, "ChemicalFormula", aMaterial.mChemicalFormula); + aMaterial.mChemicalFormula = GregTech_API.sMaterialProperties.get( + aConfigPath, + "ChemicalFormula", + aMaterial.mChemicalFormula); } private static String getConfigPath(Materials aMaterial) { @@ -2547,18 +2680,25 @@ public class Materials implements IColorModulationContainer, ISubTagContainer { if (GT_Mod.gregtechproxy.mChangeHarvestLevels && aMaterial.mToolQuality > 0 && aMaterial.mMetaItemSubID < GT_Mod.gregtechproxy.mHarvestLevel.length && aMaterial.mMetaItemSubID >= 0) { - GT_Mod.gregtechproxy.mHarvestLevel[aMaterial.mMetaItemSubID] = GregTech_API.sMaterialProperties - .get(aConfigPath, "HarvestLevel", aMaterial.mToolQuality); + GT_Mod.gregtechproxy.mHarvestLevel[aMaterial.mMetaItemSubID] = GregTech_API.sMaterialProperties.get( + aConfigPath, + "HarvestLevel", + aMaterial.mToolQuality); } } private static void addHarvestLevels() { - GT_Mod.gregtechproxy.mChangeHarvestLevels = GregTech_API.sMaterialProperties - .get("harvestlevel", "ActivateHarvestLevelChange", false); - GT_Mod.gregtechproxy.mMaxHarvestLevel = Math - .min(15, GregTech_API.sMaterialProperties.get("harvestlevel", "MaxHarvestLevel", 7)); - GT_Mod.gregtechproxy.mGraniteHavestLevel = GregTech_API.sMaterialProperties - .get("harvestlevel", "GraniteHarvestLevel", 3); + GT_Mod.gregtechproxy.mChangeHarvestLevels = GregTech_API.sMaterialProperties.get( + "harvestlevel", + "ActivateHarvestLevelChange", + false); + GT_Mod.gregtechproxy.mMaxHarvestLevel = Math.min( + 15, + GregTech_API.sMaterialProperties.get("harvestlevel", "MaxHarvestLevel", 7)); + GT_Mod.gregtechproxy.mGraniteHavestLevel = GregTech_API.sMaterialProperties.get( + "harvestlevel", + "GraniteHarvestLevel", + 3); } public static void initMaterialProperties() { @@ -2590,15 +2730,21 @@ public class Materials implements IColorModulationContainer, ISubTagContainer { private static void aspectCalculation(Materials aMaterial, String aConfigPath) { - String aDefaultAspectString = aMaterial.mAspects.stream().map(aAspectStack -> aAspectStack.mAspect.toString()) - .collect(Collectors.joining(",", ",", "")); + String aDefaultAspectString = aMaterial.mAspects.stream() + .map(aAspectStack -> aAspectStack.mAspect.toString()) + .collect(Collectors.joining(",", ",", "")); String aDefaultAspectAmountString = aMaterial.mAspects.stream() - .map(aAspectStack -> String.valueOf(aAspectStack.mAmount)).collect(Collectors.joining(",", ",", "")); + .map(aAspectStack -> String.valueOf(aAspectStack.mAmount)) + .collect(Collectors.joining(",", ",", "")); - String aConfigAspectString = GregTech_API.sMaterialProperties - .get(aConfigPath, "ListTCAspects", aDefaultAspectString); - String aConfigAspectAmountString = GregTech_API.sMaterialProperties - .get(aConfigPath, "ListTCAspectAmounts", aDefaultAspectAmountString); + String aConfigAspectString = GregTech_API.sMaterialProperties.get( + aConfigPath, + "ListTCAspects", + aDefaultAspectString); + String aConfigAspectAmountString = GregTech_API.sMaterialProperties.get( + aConfigPath, + "ListTCAspectAmounts", + aDefaultAspectAmountString); if (!aConfigAspectString.equals(aDefaultAspectString) || !aConfigAspectAmountString.equals(aDefaultAspectAmountString)) { @@ -2617,29 +2763,39 @@ public class Materials implements IColorModulationContainer, ISubTagContainer { } private static void OreReRegistrationsCalculation(Materials aMaterial, String aConfigPath) { - String aDefaultMatReRegString = aMaterial.mOreReRegistrations.stream().map(aTag -> aTag.mName) - .collect(Collectors.joining(",", ",", "")); - String aConfigMatMatReRegString = GregTech_API.sMaterialProperties - .get(aConfigPath, "ListMaterialReRegistrations", aDefaultMatReRegString); + String aDefaultMatReRegString = aMaterial.mOreReRegistrations.stream() + .map(aTag -> aTag.mName) + .collect(Collectors.joining(",", ",", "")); + String aConfigMatMatReRegString = GregTech_API.sMaterialProperties.get( + aConfigPath, + "ListMaterialReRegistrations", + aDefaultMatReRegString); if (!aConfigMatMatReRegString.equals(aDefaultMatReRegString)) { aMaterial.mOreReRegistrations.clear(); if (aConfigMatMatReRegString.length() > 0) { - Arrays.stream(aConfigMatMatReRegString.split(",")).map(MATERIALS_MAP::get).filter(Objects::nonNull) - .forEach(aMat -> aMaterial.mOreReRegistrations.add(aMat)); + Arrays.stream(aConfigMatMatReRegString.split(",")) + .map(MATERIALS_MAP::get) + .filter(Objects::nonNull) + .forEach(aMat -> aMaterial.mOreReRegistrations.add(aMat)); } } } private static void OreByProductsCalculation(Materials aMaterial, String aConfigPath) { - String aDefaultMatByProString = aMaterial.mOreByProducts.stream().map(aTag -> aTag.mName) - .collect(Collectors.joining(",", ",", "")); - String aConfigMatByProString = GregTech_API.sMaterialProperties - .get(aConfigPath, "ListMaterialByProducts", aDefaultMatByProString); + String aDefaultMatByProString = aMaterial.mOreByProducts.stream() + .map(aTag -> aTag.mName) + .collect(Collectors.joining(",", ",", "")); + String aConfigMatByProString = GregTech_API.sMaterialProperties.get( + aConfigPath, + "ListMaterialByProducts", + aDefaultMatByProString); if (!aConfigMatByProString.equals(aDefaultMatByProString)) { aMaterial.mOreByProducts.clear(); if (aConfigMatByProString.length() > 0) { - Arrays.stream(aConfigMatByProString.split(",")).map(MATERIALS_MAP::get).filter(Objects::nonNull) - .forEach(aMat -> aMaterial.mOreByProducts.add(aMat)); + Arrays.stream(aConfigMatByProString.split(",")) + .map(MATERIALS_MAP::get) + .filter(Objects::nonNull) + .forEach(aMat -> aMaterial.mOreByProducts.add(aMat)); } } } @@ -2651,14 +2807,17 @@ public class Materials implements IColorModulationContainer, ISubTagContainer { * from the config string. */ private static void SubTagCalculation(Materials aMaterial, String aConfigPath) { - String aDefaultTagString = aMaterial.mSubTags.stream().map(aTag -> aTag.mName) - .collect(Collectors.joining(",", ",", "")); + String aDefaultTagString = aMaterial.mSubTags.stream() + .map(aTag -> aTag.mName) + .collect(Collectors.joining(",", ",", "")); String aConfigTagString = GregTech_API.sMaterialProperties.get(aConfigPath, "ListSubTags", aDefaultTagString); if (!aConfigTagString.equals(aDefaultTagString)) { aMaterial.mSubTags.clear(); if (aConfigTagString.length() > 0) { - Arrays.stream(aConfigTagString.split(",")).map(SubTag.sSubTags::get).filter(Objects::nonNull) - .forEach(aTag -> aMaterial.mSubTags.add(aTag)); + Arrays.stream(aConfigTagString.split(",")) + .map(SubTag.sSubTags::get) + .filter(Objects::nonNull) + .forEach(aTag -> aMaterial.mSubTags.add(aTag)); } } } @@ -2751,7 +2910,9 @@ public class Materials implements IColorModulationContainer, ISubTagContainer { public boolean isRadioactive() { if (mElement != null) return mElement.mHalfLifeSeconds >= 0; - return mMaterialList.stream().map(stack -> stack.mMaterial).anyMatch(Materials::isRadioactive); + return mMaterialList.stream() + .map(stack -> stack.mMaterial) + .anyMatch(Materials::isRadioactive); } public long getProtons() { @@ -2826,9 +2987,14 @@ public class Materials implements IColorModulationContainer, ISubTagContainer { */ public boolean contains(ItemStack... aStacks) { if (aStacks == null || aStacks.length == 0) return false; - return mMaterialItems.stream().anyMatch( - tStack -> Arrays.stream(aStacks) - .anyMatch(aStack -> GT_Utility.areStacksEqual(aStack, tStack, !tStack.hasTagCompound()))); + return mMaterialItems.stream() + .anyMatch( + tStack -> Arrays.stream(aStacks) + .anyMatch( + aStack -> GT_Utility.areStacksEqual( + aStack, + tStack, + !tStack.hasTagCompound()))); } /** @@ -3018,13 +3184,19 @@ public class Materials implements IColorModulationContainer, ISubTagContainer { } public String getDefaultLocalizedNameForItem(String aFormat) { - return String.format(aFormat.replace("%s", "%temp").replace("%material", "%s"), this.mDefaultLocalName) - .replace("%temp", "%s"); + return String.format( + aFormat.replace("%s", "%temp") + .replace("%material", "%s"), + this.mDefaultLocalName) + .replace("%temp", "%s"); } public String getLocalizedNameForItem(String aFormat) { - return String.format(aFormat.replace("%s", "%temp").replace("%material", "%s"), this.mLocalizedName) - .replace("%temp", "%s"); + return String.format( + aFormat.replace("%s", "%temp") + .replace("%material", "%s"), + this.mLocalizedName) + .replace("%temp", "%s"); } public boolean hasCorrespondingFluid() { diff --git a/src/main/java/gregtech/api/enums/MaterialsBotania.java b/src/main/java/gregtech/api/enums/MaterialsBotania.java index f6ae06408e..d93b941e39 100644 --- a/src/main/java/gregtech/api/enums/MaterialsBotania.java +++ b/src/main/java/gregtech/api/enums/MaterialsBotania.java @@ -9,41 +9,86 @@ import gregtech.api.enums.TC_Aspects.TC_AspectStack; public class MaterialsBotania { // Botania materials. - public static Materials Manasteel = new MaterialBuilder(201, TextureSet.SET_METALLIC, "Manasteel") - .setName("Manasteel").setRGBA(150, 219, 252, 255).addDustItems().addMetalItems().addToolHeadItems() - .addGearItems().setToolSpeed(8.0F).setDurability(5120).setToolQuality(4).setMeltingPoint(1500) - .setBlastFurnaceTemp(1500).setBlastFurnaceRequired(true) - .setAspects( - Arrays.asList( - new TC_AspectStack(TC_Aspects.METALLUM, 3), - new TC_AspectStack(TC_Aspects.PRAECANTATIO, 1))) - .constructMaterial(); - public static Materials Terrasteel = new MaterialBuilder(202, TextureSet.SET_METALLIC, "Terrasteel") - .setName("Terrasteel").setRGBA(76, 191, 38, 255).addDustItems().addMetalItems().addToolHeadItems() - .addGearItems().setToolSpeed(32.0F).setDurability(10240).setToolQuality(5).setMeltingPoint(5400) - .setBlastFurnaceTemp(5400).setBlastFurnaceRequired(true) - .setAspects( - Arrays.asList( - new TC_AspectStack(TC_Aspects.METALLUM, 2), - new TC_AspectStack(TC_Aspects.TERRA, 1), - new TC_AspectStack(TC_Aspects.PRAECANTATIO, 1))) - .constructMaterial(); - public static Materials ElvenElementium = new MaterialBuilder(203, TextureSet.SET_METALLIC, "Elven Elementium") - .setName("ElvenElementium").setRGBA(219, 37, 205, 255).addDustItems().addMetalItems().addToolHeadItems() - .addGearItems().setToolSpeed(20.0F).setDurability(32768).setToolQuality(7).setMeltingPoint(7200) - .setBlastFurnaceTemp(7200).setBlastFurnaceRequired(true) - .setAspects( - Arrays.asList( - new TC_AspectStack(TC_Aspects.METALLUM, 3), - new TC_AspectStack(TC_Aspects.PRAECANTATIO, 2), - new TC_AspectStack(TC_Aspects.AURAM, 1))) - .constructMaterial(); - public static Materials Livingrock = new MaterialBuilder(204, new TextureSet("Livingrock", true), "Livingrock") - .setName("Livingrock").addDustItems().addToolHeadItems().addGearItems().setToolSpeed(1.0F).setDurability(0) - .setToolQuality(3).setOreValue(3).setDensityMultiplier(1).setDensityDivider(1) - .setAspects( - Arrays.asList(new TC_AspectStack(TC_Aspects.TERRA, 2), new TC_AspectStack(TC_Aspects.VICTUS, 2))) - .constructMaterial(); + public static Materials Manasteel = new MaterialBuilder( + 201, + TextureSet.SET_METALLIC, + "Manasteel").setName("Manasteel") + .setRGBA(150, 219, 252, 255) + .addDustItems() + .addMetalItems() + .addToolHeadItems() + .addGearItems() + .setToolSpeed(8.0F) + .setDurability(5120) + .setToolQuality(4) + .setMeltingPoint(1500) + .setBlastFurnaceTemp(1500) + .setBlastFurnaceRequired(true) + .setAspects( + Arrays.asList( + new TC_AspectStack(TC_Aspects.METALLUM, 3), + new TC_AspectStack(TC_Aspects.PRAECANTATIO, 1))) + .constructMaterial(); + public static Materials Terrasteel = new MaterialBuilder( + 202, + TextureSet.SET_METALLIC, + "Terrasteel").setName("Terrasteel") + .setRGBA(76, 191, 38, 255) + .addDustItems() + .addMetalItems() + .addToolHeadItems() + .addGearItems() + .setToolSpeed(32.0F) + .setDurability(10240) + .setToolQuality(5) + .setMeltingPoint(5400) + .setBlastFurnaceTemp(5400) + .setBlastFurnaceRequired(true) + .setAspects( + Arrays.asList( + new TC_AspectStack(TC_Aspects.METALLUM, 2), + new TC_AspectStack(TC_Aspects.TERRA, 1), + new TC_AspectStack(TC_Aspects.PRAECANTATIO, 1))) + .constructMaterial(); + public static Materials ElvenElementium = new MaterialBuilder( + 203, + TextureSet.SET_METALLIC, + "Elven Elementium").setName("ElvenElementium") + .setRGBA(219, 37, 205, 255) + .addDustItems() + .addMetalItems() + .addToolHeadItems() + .addGearItems() + .setToolSpeed(20.0F) + .setDurability(32768) + .setToolQuality(7) + .setMeltingPoint(7200) + .setBlastFurnaceTemp(7200) + .setBlastFurnaceRequired(true) + .setAspects( + Arrays.asList( + new TC_AspectStack(TC_Aspects.METALLUM, 3), + new TC_AspectStack(TC_Aspects.PRAECANTATIO, 2), + new TC_AspectStack(TC_Aspects.AURAM, 1))) + .constructMaterial(); + public static Materials Livingrock = new MaterialBuilder( + 204, + new TextureSet("Livingrock", true), + "Livingrock").setName("Livingrock") + .addDustItems() + .addToolHeadItems() + .addGearItems() + .setToolSpeed(1.0F) + .setDurability(0) + .setToolQuality(3) + .setOreValue(3) + .setDensityMultiplier(1) + .setDensityDivider(1) + .setAspects( + Arrays.asList( + new TC_AspectStack(TC_Aspects.TERRA, 2), + new TC_AspectStack(TC_Aspects.VICTUS, 2))) + .constructMaterial(); public static Materials GaiaSpirit = new Materials( 205, TextureSet.SET_METALLIC.withBlockTextures("GaiaSpirit"), @@ -72,21 +117,45 @@ public class MaterialsBotania { new TC_AspectStack(TC_Aspects.AURAM, 24), new TC_AspectStack(TC_Aspects.VICTUS, 24), new TC_AspectStack(TC_Aspects.METALLUM, 1))); - public static Materials Livingwood = new MaterialBuilder(206, new TextureSet("Livingwood", true), "Livingwood") - .setName("Livingwood").addDustItems().addMetalItems().addToolHeadItems().addGearItems().setToolSpeed(1.0F) - .setDurability(0).setToolQuality(3).setOreValue(3).setDensityMultiplier(1).setDensityDivider(1) - .setAspects( - Arrays.asList(new TC_AspectStack(TC_Aspects.ARBOR, 4), new TC_AspectStack(TC_Aspects.VICTUS, 2))) - .constructMaterial(); - public static Materials Dreamwood = new MaterialBuilder(207, new TextureSet("Dreamwood", true), "Dreamwood") - .setName("Dreamwood").addDustItems().addMetalItems().addToolHeadItems().addGearItems().setToolSpeed(1.0F) - .setDurability(0).setToolQuality(3).setOreValue(3).setDensityMultiplier(1).setDensityDivider(1) - .setAspects( - Arrays.asList( - new TC_AspectStack(TC_Aspects.ARBOR, 4), - new TC_AspectStack(TC_Aspects.AURAM, 2), - new TC_AspectStack(TC_Aspects.PRAECANTATIO, 1))) - .constructMaterial(); + public static Materials Livingwood = new MaterialBuilder( + 206, + new TextureSet("Livingwood", true), + "Livingwood").setName("Livingwood") + .addDustItems() + .addMetalItems() + .addToolHeadItems() + .addGearItems() + .setToolSpeed(1.0F) + .setDurability(0) + .setToolQuality(3) + .setOreValue(3) + .setDensityMultiplier(1) + .setDensityDivider(1) + .setAspects( + Arrays.asList( + new TC_AspectStack(TC_Aspects.ARBOR, 4), + new TC_AspectStack(TC_Aspects.VICTUS, 2))) + .constructMaterial(); + public static Materials Dreamwood = new MaterialBuilder( + 207, + new TextureSet("Dreamwood", true), + "Dreamwood").setName("Dreamwood") + .addDustItems() + .addMetalItems() + .addToolHeadItems() + .addGearItems() + .setToolSpeed(1.0F) + .setDurability(0) + .setToolQuality(3) + .setOreValue(3) + .setDensityMultiplier(1) + .setDensityDivider(1) + .setAspects( + Arrays.asList( + new TC_AspectStack(TC_Aspects.ARBOR, 4), + new TC_AspectStack(TC_Aspects.AURAM, 2), + new TC_AspectStack(TC_Aspects.PRAECANTATIO, 1))) + .constructMaterial(); public static Materials ManaDiamond = new Materials( 208, TextureSet.SET_DIAMOND, diff --git a/src/main/java/gregtech/api/enums/MaterialsKevlar.java b/src/main/java/gregtech/api/enums/MaterialsKevlar.java index 1c23f17698..a5c38b0f7a 100644 --- a/src/main/java/gregtech/api/enums/MaterialsKevlar.java +++ b/src/main/java/gregtech/api/enums/MaterialsKevlar.java @@ -9,394 +9,688 @@ public class MaterialsKevlar { public static Materials DiphenylmethaneDiisocyanate = new MaterialBuilder( 796, TextureSet.SET_DULL, - "4,4'-Diphenylmethane Diisocyanate").setName("DiphenylmethaneDiisocyanate").addDustItems() - .setRGB(255, 230, 50).setColor(Dyes.dyeYellow).setMeltingPoint(310) - .setMaterialList( - new MaterialStack(Materials.Carbon, 15), - new MaterialStack(Materials.Hydrogen, 10), - new MaterialStack(Materials.Nitrogen, 2), - new MaterialStack(Materials.Oxygen, 2)) - .setAspects( - Arrays.asList( - new TC_Aspects.TC_AspectStack(TC_Aspects.TERRA, 1), - new TC_Aspects.TC_AspectStack(TC_Aspects.VENENUM, 1))) - .constructMaterial(); // C15H10N2O2 + "4,4'-Diphenylmethane Diisocyanate").setName("DiphenylmethaneDiisocyanate") + .addDustItems() + .setRGB(255, 230, 50) + .setColor(Dyes.dyeYellow) + .setMeltingPoint(310) + .setMaterialList( + new MaterialStack(Materials.Carbon, 15), + new MaterialStack(Materials.Hydrogen, 10), + new MaterialStack(Materials.Nitrogen, 2), + new MaterialStack(Materials.Oxygen, 2)) + .setAspects( + Arrays.asList( + new TC_Aspects.TC_AspectStack(TC_Aspects.TERRA, 1), + new TC_Aspects.TC_AspectStack(TC_Aspects.VENENUM, 1))) + .constructMaterial(); // C15H10N2O2 public static Materials DiaminodiphenylmethanMixture = new MaterialBuilder( 795, TextureSet.SET_FLUID, - "Diaminodiphenylmethane Mixture").setName("DiaminodiphenylmethanMixture").addCell().addFluid() - .setRGB(255, 243, 122).setColor(Dyes.dyeYellow).setMeltingPoint(365) - .setMaterialList( - new MaterialStack(Materials.Carbon, 13), - new MaterialStack(Materials.Hydrogen, 14), - new MaterialStack(Materials.Nitrogen, 2)) - .setAspects( - Arrays.asList( - new TC_Aspects.TC_AspectStack(TC_Aspects.AQUA, 1), - new TC_Aspects.TC_AspectStack(TC_Aspects.VENENUM, 1))) - .constructMaterial(); // C13H14N2 + "Diaminodiphenylmethane Mixture").setName("DiaminodiphenylmethanMixture") + .addCell() + .addFluid() + .setRGB(255, 243, 122) + .setColor(Dyes.dyeYellow) + .setMeltingPoint(365) + .setMaterialList( + new MaterialStack(Materials.Carbon, 13), + new MaterialStack(Materials.Hydrogen, 14), + new MaterialStack(Materials.Nitrogen, 2)) + .setAspects( + Arrays.asList( + new TC_Aspects.TC_AspectStack(TC_Aspects.AQUA, 1), + new TC_Aspects.TC_AspectStack(TC_Aspects.VENENUM, 1))) + .constructMaterial(); // C13H14N2 public static Materials DiphenylmethaneDiisocyanateMixture = new MaterialBuilder( 794, TextureSet.SET_FLUID, - "Diphenylmethane Diisocyanate Mixture").setName("DiphenylmethaneDiisocyanateMixture").addCell().addFluid() - .setRGB(255, 230, 50).setColor(Dyes.dyeYellow).setMeltingPoint(310) - .setMaterialList( - new MaterialStack(Materials.Carbon, 15), - new MaterialStack(Materials.Hydrogen, 10), - new MaterialStack(Materials.Nitrogen, 2), - new MaterialStack(Materials.Oxygen, 2)) - .setAspects( - Arrays.asList( - new TC_Aspects.TC_AspectStack(TC_Aspects.AQUA, 1), - new TC_Aspects.TC_AspectStack(TC_Aspects.VENENUM, 1))) - .constructMaterial(); // C15H10N2O2 - public static Materials Butyraldehyde = new MaterialBuilder(793, TextureSet.SET_FLUID, "Butyraldehyde") - .setName("Butyraldehyde").addCell().addFluid().setRGB(255, 255, 255).setColor(Dyes.dyeWhite) - .setMeltingPoint(176) - .setMaterialList( - new MaterialStack(Materials.Carbon, 4), - new MaterialStack(Materials.Hydrogen, 8), - new MaterialStack(Materials.Oxygen, 1)) - .setAspects( - Arrays.asList( - new TC_Aspects.TC_AspectStack(TC_Aspects.AQUA, 1), - new TC_Aspects.TC_AspectStack(TC_Aspects.IGNIS, 1))) - .constructMaterial(); // C4H8O - public static Materials Isobutyraldehyde = new MaterialBuilder(792, TextureSet.SET_FLUID, "Isobutyraldehyde") - .setName("Isobutyraldehyde").addCell().addFluid().setRGB(255, 255, 255).setColor(Dyes.dyeWhite) - .setMeltingPoint(208).setExtraData(1) - .setMaterialList( - new MaterialStack(Materials.Carbon, 4), - new MaterialStack(Materials.Hydrogen, 8), - new MaterialStack(Materials.Oxygen, 1)) - .setAspects( - Arrays.asList( - new TC_Aspects.TC_AspectStack(TC_Aspects.AQUA, 1), - new TC_Aspects.TC_AspectStack(TC_Aspects.IGNIS, 1))) - .constructMaterial(); // C4H8O - public static Materials NickelTetracarbonyl = new MaterialBuilder(791, TextureSet.SET_FLUID, "Nickel Tetracarbonyl") - .setName("NickelTetracarbonyl").addCell().addFluid().setRGB(255, 255, 255).setColor(Dyes.dyeWhite) - .setMeltingPoint(256) - .setMaterialList( - new MaterialStack(Materials.Carbon, 4), - new MaterialStack(Materials.Nickel, 1), - new MaterialStack(Materials.Oxygen, 4)) - .setAspects( - Arrays.asList( - new TC_Aspects.TC_AspectStack(TC_Aspects.AQUA, 1), - new TC_Aspects.TC_AspectStack(TC_Aspects.METALLUM, 1))) - .constructMaterial(); // C4NiO4 - public static Materials KevlarCatalyst = new MaterialBuilder(790, TextureSet.SET_DULL, "Polyurethane Catalyst A") - .setName("PolyurethaneCatalystADust").addDustItems().setRGB(50, 50, 50).setColor(Dyes.dyeBlack) - .setMeltingPoint(300) - .setAspects( - Arrays.asList( - new TC_Aspects.TC_AspectStack(TC_Aspects.AQUA, 1), - new TC_Aspects.TC_AspectStack(TC_Aspects.LUCRUM, 1))) - .constructMaterial(); - public static Materials EthyleneOxide = new MaterialBuilder(789, TextureSet.SET_FLUID, "Ethylene Oxide") - .setName("EthyleneOxide").addCell().addGas().setRGB(255, 255, 255).setColor(Dyes.dyeWhite) - .setMeltingPoint(160) - .setMaterialList( - new MaterialStack(Materials.Carbon, 2), - new MaterialStack(Materials.Hydrogen, 4), - new MaterialStack(Materials.Oxygen, 1)) - .setAspects( - Arrays.asList( - new TC_Aspects.TC_AspectStack(TC_Aspects.AQUA, 1), - new TC_Aspects.TC_AspectStack(TC_Aspects.IGNIS, 1))) - .constructMaterial(); // C2H4O - public static Materials SiliconOil = new MaterialBuilder(788, TextureSet.SET_FLUID, "Silicon Oil") - .setName("SiliconOil").addCell().addFluid().setRGB(255, 255, 255).setColor(Dyes.dyeWhite) - .setMeltingPoint(473) - .setAspects( - Arrays.asList( - new TC_Aspects.TC_AspectStack(TC_Aspects.AQUA, 1), - new TC_Aspects.TC_AspectStack(TC_Aspects.MACHINA, 1))) - .constructMaterial(); - public static Materials Ethyleneglycol = new MaterialBuilder(787, TextureSet.SET_FLUID, "Ethylene Glycol") - .setName("EthyleneGlycol").addCell().addFluid().setRGB(255, 255, 255).setColor(Dyes.dyeWhite) - .setMeltingPoint(260) - .setMaterialList( - new MaterialStack(Materials.Carbon, 2), - new MaterialStack(Materials.Hydrogen, 6), - new MaterialStack(Materials.Oxygen, 2)) - .setAspects( - Arrays.asList( - new TC_Aspects.TC_AspectStack(TC_Aspects.AQUA, 1), - new TC_Aspects.TC_AspectStack(TC_Aspects.IGNIS, 1))) - .constructMaterial(); // C2H6O2 - public static Materials Acetaldehyde = new MaterialBuilder(786, TextureSet.SET_FLUID, "Acetaldehyde") - .setName("Acetaldehyde").addCell().addGas().setRGB(255, 255, 255).setColor(Dyes.dyeWhite) - .setMeltingPoint(150) - .setMaterialList( - new MaterialStack(Materials.Carbon, 2), - new MaterialStack(Materials.Hydrogen, 4), - new MaterialStack(Materials.Oxygen, 1)) - .setAspects( - Arrays.asList( - new TC_Aspects.TC_AspectStack(TC_Aspects.AQUA, 1), - new TC_Aspects.TC_AspectStack(TC_Aspects.IGNIS, 1))) - .constructMaterial(); // C2H4O - public static Materials Pentaerythritol = new MaterialBuilder(785, TextureSet.SET_DULL, "Pentaerythritol") - .setName("Pentaerythritol").addDustItems().setRGB(255, 255, 255).setColor(Dyes.dyeWhite) - .setMeltingPoint(533) - .setMaterialList( - new MaterialStack(Materials.Carbon, 5), - new MaterialStack(Materials.Hydrogen, 12), - new MaterialStack(Materials.Oxygen, 4)) - .setAspects( - Arrays.asList( - new TC_Aspects.TC_AspectStack(TC_Aspects.TERRA, 1), - new TC_Aspects.TC_AspectStack(TC_Aspects.LUCRUM, 1))) - .constructMaterial(); // C5H12O4 - public static Materials PolyurethaneResin = new MaterialBuilder(784, TextureSet.SET_FLUID, "Polyurethane Resin") - .setName("PolyurethaneResin").addCell().addFluid().setRGB(230, 230, 120).setColor(Dyes.dyeYellow) - .constructMaterial(); + "Diphenylmethane Diisocyanate Mixture").setName("DiphenylmethaneDiisocyanateMixture") + .addCell() + .addFluid() + .setRGB(255, 230, 50) + .setColor(Dyes.dyeYellow) + .setMeltingPoint(310) + .setMaterialList( + new MaterialStack(Materials.Carbon, 15), + new MaterialStack(Materials.Hydrogen, 10), + new MaterialStack(Materials.Nitrogen, 2), + new MaterialStack(Materials.Oxygen, 2)) + .setAspects( + Arrays.asList( + new TC_Aspects.TC_AspectStack(TC_Aspects.AQUA, 1), + new TC_Aspects.TC_AspectStack( + TC_Aspects.VENENUM, + 1))) + .constructMaterial(); // C15H10N2O2 + public static Materials Butyraldehyde = new MaterialBuilder( + 793, + TextureSet.SET_FLUID, + "Butyraldehyde").setName("Butyraldehyde") + .addCell() + .addFluid() + .setRGB(255, 255, 255) + .setColor(Dyes.dyeWhite) + .setMeltingPoint(176) + .setMaterialList( + new MaterialStack(Materials.Carbon, 4), + new MaterialStack(Materials.Hydrogen, 8), + new MaterialStack(Materials.Oxygen, 1)) + .setAspects( + Arrays.asList( + new TC_Aspects.TC_AspectStack(TC_Aspects.AQUA, 1), + new TC_Aspects.TC_AspectStack(TC_Aspects.IGNIS, 1))) + .constructMaterial(); // C4H8O + public static Materials Isobutyraldehyde = new MaterialBuilder( + 792, + TextureSet.SET_FLUID, + "Isobutyraldehyde").setName("Isobutyraldehyde") + .addCell() + .addFluid() + .setRGB(255, 255, 255) + .setColor(Dyes.dyeWhite) + .setMeltingPoint(208) + .setExtraData(1) + .setMaterialList( + new MaterialStack(Materials.Carbon, 4), + new MaterialStack(Materials.Hydrogen, 8), + new MaterialStack(Materials.Oxygen, 1)) + .setAspects( + Arrays.asList( + new TC_Aspects.TC_AspectStack(TC_Aspects.AQUA, 1), + new TC_Aspects.TC_AspectStack(TC_Aspects.IGNIS, 1))) + .constructMaterial(); // C4H8O + public static Materials NickelTetracarbonyl = new MaterialBuilder( + 791, + TextureSet.SET_FLUID, + "Nickel Tetracarbonyl").setName("NickelTetracarbonyl") + .addCell() + .addFluid() + .setRGB(255, 255, 255) + .setColor(Dyes.dyeWhite) + .setMeltingPoint(256) + .setMaterialList( + new MaterialStack(Materials.Carbon, 4), + new MaterialStack(Materials.Nickel, 1), + new MaterialStack(Materials.Oxygen, 4)) + .setAspects( + Arrays.asList( + new TC_Aspects.TC_AspectStack(TC_Aspects.AQUA, 1), + new TC_Aspects.TC_AspectStack(TC_Aspects.METALLUM, 1))) + .constructMaterial(); // C4NiO4 + public static Materials KevlarCatalyst = new MaterialBuilder( + 790, + TextureSet.SET_DULL, + "Polyurethane Catalyst A").setName("PolyurethaneCatalystADust") + .addDustItems() + .setRGB(50, 50, 50) + .setColor(Dyes.dyeBlack) + .setMeltingPoint(300) + .setAspects( + Arrays.asList( + new TC_Aspects.TC_AspectStack(TC_Aspects.AQUA, 1), + new TC_Aspects.TC_AspectStack(TC_Aspects.LUCRUM, 1))) + .constructMaterial(); + public static Materials EthyleneOxide = new MaterialBuilder( + 789, + TextureSet.SET_FLUID, + "Ethylene Oxide").setName("EthyleneOxide") + .addCell() + .addGas() + .setRGB(255, 255, 255) + .setColor(Dyes.dyeWhite) + .setMeltingPoint(160) + .setMaterialList( + new MaterialStack(Materials.Carbon, 2), + new MaterialStack(Materials.Hydrogen, 4), + new MaterialStack(Materials.Oxygen, 1)) + .setAspects( + Arrays.asList( + new TC_Aspects.TC_AspectStack(TC_Aspects.AQUA, 1), + new TC_Aspects.TC_AspectStack(TC_Aspects.IGNIS, 1))) + .constructMaterial(); // C2H4O + public static Materials SiliconOil = new MaterialBuilder( + 788, + TextureSet.SET_FLUID, + "Silicon Oil").setName("SiliconOil") + .addCell() + .addFluid() + .setRGB(255, 255, 255) + .setColor(Dyes.dyeWhite) + .setMeltingPoint(473) + .setAspects( + Arrays.asList( + new TC_Aspects.TC_AspectStack(TC_Aspects.AQUA, 1), + new TC_Aspects.TC_AspectStack(TC_Aspects.MACHINA, 1))) + .constructMaterial(); + public static Materials Ethyleneglycol = new MaterialBuilder( + 787, + TextureSet.SET_FLUID, + "Ethylene Glycol").setName("EthyleneGlycol") + .addCell() + .addFluid() + .setRGB(255, 255, 255) + .setColor(Dyes.dyeWhite) + .setMeltingPoint(260) + .setMaterialList( + new MaterialStack(Materials.Carbon, 2), + new MaterialStack(Materials.Hydrogen, 6), + new MaterialStack(Materials.Oxygen, 2)) + .setAspects( + Arrays.asList( + new TC_Aspects.TC_AspectStack(TC_Aspects.AQUA, 1), + new TC_Aspects.TC_AspectStack(TC_Aspects.IGNIS, 1))) + .constructMaterial(); // C2H6O2 + public static Materials Acetaldehyde = new MaterialBuilder( + 786, + TextureSet.SET_FLUID, + "Acetaldehyde").setName("Acetaldehyde") + .addCell() + .addGas() + .setRGB(255, 255, 255) + .setColor(Dyes.dyeWhite) + .setMeltingPoint(150) + .setMaterialList( + new MaterialStack(Materials.Carbon, 2), + new MaterialStack(Materials.Hydrogen, 4), + new MaterialStack(Materials.Oxygen, 1)) + .setAspects( + Arrays.asList( + new TC_Aspects.TC_AspectStack(TC_Aspects.AQUA, 1), + new TC_Aspects.TC_AspectStack(TC_Aspects.IGNIS, 1))) + .constructMaterial(); // C2H4O + public static Materials Pentaerythritol = new MaterialBuilder( + 785, + TextureSet.SET_DULL, + "Pentaerythritol").setName("Pentaerythritol") + .addDustItems() + .setRGB(255, 255, 255) + .setColor(Dyes.dyeWhite) + .setMeltingPoint(533) + .setMaterialList( + new MaterialStack(Materials.Carbon, 5), + new MaterialStack(Materials.Hydrogen, 12), + new MaterialStack(Materials.Oxygen, 4)) + .setAspects( + Arrays.asList( + new TC_Aspects.TC_AspectStack(TC_Aspects.TERRA, 1), + new TC_Aspects.TC_AspectStack(TC_Aspects.LUCRUM, 1))) + .constructMaterial(); // C5H12O4 + public static Materials PolyurethaneResin = new MaterialBuilder( + 784, + TextureSet.SET_FLUID, + "Polyurethane Resin").setName("PolyurethaneResin") + .addCell() + .addFluid() + .setRGB(230, 230, 120) + .setColor(Dyes.dyeYellow) + .constructMaterial(); public static Materials NMethylIIPyrrolidone = new MaterialBuilder( 783, TextureSet.SET_FLUID, - "N-Methyl-2-pyrrolidone").setName("NMethylpyrolidone").addCell().addFluid().setRGB(255, 255, 255) - .setColor(Dyes.dyeWhite).setMeltingPoint(249) - .setMaterialList( - new MaterialStack(Materials.Carbon, 5), - new MaterialStack(Materials.Hydrogen, 9), - new MaterialStack(Materials.Nitrogen, 1), - new MaterialStack(Materials.Oxygen, 1)) - .setAspects( - Arrays.asList( - new TC_Aspects.TC_AspectStack(TC_Aspects.TERRA, 1), - new TC_Aspects.TC_AspectStack(TC_Aspects.VENENUM, 1))) - .constructMaterial(); // C5H9NO + "N-Methyl-2-pyrrolidone").setName("NMethylpyrolidone") + .addCell() + .addFluid() + .setRGB(255, 255, 255) + .setColor(Dyes.dyeWhite) + .setMeltingPoint(249) + .setMaterialList( + new MaterialStack(Materials.Carbon, 5), + new MaterialStack(Materials.Hydrogen, 9), + new MaterialStack(Materials.Nitrogen, 1), + new MaterialStack(Materials.Oxygen, 1)) + .setAspects( + Arrays.asList( + new TC_Aspects.TC_AspectStack(TC_Aspects.TERRA, 1), + new TC_Aspects.TC_AspectStack(TC_Aspects.VENENUM, 1))) + .constructMaterial(); // C5H9NO public static Materials TerephthaloylChloride = new MaterialBuilder( 782, TextureSet.SET_POWDER, - "Terephthaloyl Chloride").setName("TerephthaloylChloride").addDustItems().setRGB(0, 255, 12) - .setColor(Dyes.dyeGreen).setMeltingPoint(355) - .setMaterialList( - new MaterialStack(Materials.Carbon, 8), - new MaterialStack(Materials.Hydrogen, 4), - new MaterialStack(Materials.Chlorine, 2), - new MaterialStack(Materials.Oxygen, 2)) - .setAspects( - Arrays.asList( - new TC_Aspects.TC_AspectStack(TC_Aspects.TERRA, 1), - new TC_Aspects.TC_AspectStack(TC_Aspects.VITREUS, 1))) - .constructMaterial(); // C8H4Cl2O2 + "Terephthaloyl Chloride").setName("TerephthaloylChloride") + .addDustItems() + .setRGB(0, 255, 12) + .setColor(Dyes.dyeGreen) + .setMeltingPoint(355) + .setMaterialList( + new MaterialStack(Materials.Carbon, 8), + new MaterialStack(Materials.Hydrogen, 4), + new MaterialStack(Materials.Chlorine, 2), + new MaterialStack(Materials.Oxygen, 2)) + .setAspects( + Arrays.asList( + new TC_Aspects.TC_AspectStack(TC_Aspects.TERRA, 1), + new TC_Aspects.TC_AspectStack(TC_Aspects.VITREUS, 1))) + .constructMaterial(); // C8H4Cl2O2 public static Materials Acetylene = new MaterialBuilder(781, TextureSet.SET_FLUID, "Acetylene").setName("Acetylene") - .addCell().addGas().setRGB(255, 255, 255).setColor(Dyes.dyeWhite).setMeltingPoint(192) - .setMaterialList(new MaterialStack(Materials.Carbon, 2), new MaterialStack(Materials.Hydrogen, 2)) - .constructMaterial(); // C2H2 TODO Add to JUPITER Athmosphere and Enceladus and to moon of Saturn - public static Materials IVNitroaniline = new MaterialBuilder(780, TextureSet.SET_FLUID, "4-Nitroaniline") - .setName("4Nitroaniline").addCell().addFluid().setRGB(255, 135, 51).setColor(Dyes.dyeOrange) - .setMeltingPoint(420) - .setMaterialList( - new MaterialStack(Materials.Carbon, 6), - new MaterialStack(Materials.Hydrogen, 6), - new MaterialStack(Materials.Nitrogen, 2), - new MaterialStack(Materials.Oxygen, 2)) - .setAspects( - Arrays.asList( - new TC_Aspects.TC_AspectStack(TC_Aspects.TERRA, 1), - new TC_Aspects.TC_AspectStack(TC_Aspects.VITREUS, 1))) - .constructMaterial(); // C6H6N2O2 + .addCell() + .addGas() + .setRGB( + 255, + 255, + 255) + .setColor( + Dyes.dyeWhite) + .setMeltingPoint(192) + .setMaterialList( + new MaterialStack( + Materials.Carbon, + 2), + new MaterialStack( + Materials.Hydrogen, + 2)) + .constructMaterial(); // C2H2 + // TODO + // Add + // to + // JUPITER + // Athmosphere + // and + // Enceladus + // and + // to + // moon + // of + // Saturn + public static Materials IVNitroaniline = new MaterialBuilder( + 780, + TextureSet.SET_FLUID, + "4-Nitroaniline").setName("4Nitroaniline") + .addCell() + .addFluid() + .setRGB(255, 135, 51) + .setColor(Dyes.dyeOrange) + .setMeltingPoint(420) + .setMaterialList( + new MaterialStack(Materials.Carbon, 6), + new MaterialStack(Materials.Hydrogen, 6), + new MaterialStack(Materials.Nitrogen, 2), + new MaterialStack(Materials.Oxygen, 2)) + .setAspects( + Arrays.asList( + new TC_Aspects.TC_AspectStack(TC_Aspects.TERRA, 1), + new TC_Aspects.TC_AspectStack(TC_Aspects.VITREUS, 1))) + .constructMaterial(); // C6H6N2O2 public static Materials ParaPhenylenediamine = new MaterialBuilder( 779, TextureSet.SET_POWDER, - "para-Phenylenediamine").setName("pPhenylenediamine").addDustItems().setRGB(251, 236, 93) - .setColor(Dyes.dyeYellow).setMeltingPoint(293) - .setMaterialList( - new MaterialStack(Materials.Carbon, 6), - new MaterialStack(Materials.Hydrogen, 8), - new MaterialStack(Materials.Nitrogen, 2)) - .setAspects( - Arrays.asList( - new TC_Aspects.TC_AspectStack(TC_Aspects.TERRA, 1), - new TC_Aspects.TC_AspectStack(TC_Aspects.VITREUS, 1))) - .constructMaterial(); // C6H6N2 - public static Materials Methylamine = new MaterialBuilder(778, TextureSet.SET_FLUID, "Methylamine") - .setName("Methylamine").addCell().addGas().setRGB(65, 68, 105).setColor(Dyes.dyeGray).setMeltingPoint(180) - .setExtraData(1) - .setMaterialList( - new MaterialStack(Materials.Carbon, 1), - new MaterialStack(Materials.Hydrogen, 5), - new MaterialStack(Materials.Nitrogen, 1)) - .constructMaterial(); // CH5N - public static Materials Trimethylamine = new MaterialBuilder(777, TextureSet.SET_FLUID, "Trimethylamine") - .setName("Trimethylamine").addCell().addGas().setRGB(105, 68, 105).setColor(Dyes.dyeGray) - .setMeltingPoint(156).setExtraData(1) - .setMaterialList( - new MaterialStack(Materials.Carbon, 3), - new MaterialStack(Materials.Hydrogen, 9), - new MaterialStack(Materials.Nitrogen, 1)) - .constructMaterial(); // C3H9N - public static Materials GammaButyrolactone = new MaterialBuilder(776, TextureSet.SET_FLUID, "gamma-Butyrolactone") - .setName("GammaButyrolactone").addCell().addFluid().setRGB(255, 255, 151).setColor(Dyes.dyeYellow) - .setMeltingPoint(229) - .setMaterialList( - new MaterialStack(Materials.Carbon, 4), - new MaterialStack(Materials.Hydrogen, 6), - new MaterialStack(Materials.Oxygen, 2)) - .constructMaterial(); // C4H6O2 - public static Materials CalciumCarbide = new MaterialBuilder(775, TextureSet.SET_DULL, "Calcium Carbide") - .setName("CacliumCarbide").addDustItems().setRGB(235, 235, 235).setColor(Dyes.dyeGray).setMeltingPoint(2430) - .setMaterialList(new MaterialStack(Materials.Calcium, 1), new MaterialStack(Materials.Carbon, 2)) - .constructMaterial(); // CaC2 + "para-Phenylenediamine").setName("pPhenylenediamine") + .addDustItems() + .setRGB(251, 236, 93) + .setColor(Dyes.dyeYellow) + .setMeltingPoint(293) + .setMaterialList( + new MaterialStack(Materials.Carbon, 6), + new MaterialStack(Materials.Hydrogen, 8), + new MaterialStack(Materials.Nitrogen, 2)) + .setAspects( + Arrays.asList( + new TC_Aspects.TC_AspectStack(TC_Aspects.TERRA, 1), + new TC_Aspects.TC_AspectStack(TC_Aspects.VITREUS, 1))) + .constructMaterial(); // C6H6N2 + public static Materials Methylamine = new MaterialBuilder( + 778, + TextureSet.SET_FLUID, + "Methylamine").setName("Methylamine") + .addCell() + .addGas() + .setRGB(65, 68, 105) + .setColor(Dyes.dyeGray) + .setMeltingPoint(180) + .setExtraData(1) + .setMaterialList( + new MaterialStack(Materials.Carbon, 1), + new MaterialStack(Materials.Hydrogen, 5), + new MaterialStack(Materials.Nitrogen, 1)) + .constructMaterial(); // CH5N + public static Materials Trimethylamine = new MaterialBuilder( + 777, + TextureSet.SET_FLUID, + "Trimethylamine").setName("Trimethylamine") + .addCell() + .addGas() + .setRGB(105, 68, 105) + .setColor(Dyes.dyeGray) + .setMeltingPoint(156) + .setExtraData(1) + .setMaterialList( + new MaterialStack(Materials.Carbon, 3), + new MaterialStack(Materials.Hydrogen, 9), + new MaterialStack(Materials.Nitrogen, 1)) + .constructMaterial(); // C3H9N + public static Materials GammaButyrolactone = new MaterialBuilder( + 776, + TextureSet.SET_FLUID, + "gamma-Butyrolactone").setName("GammaButyrolactone") + .addCell() + .addFluid() + .setRGB(255, 255, 151) + .setColor(Dyes.dyeYellow) + .setMeltingPoint(229) + .setMaterialList( + new MaterialStack(Materials.Carbon, 4), + new MaterialStack(Materials.Hydrogen, 6), + new MaterialStack(Materials.Oxygen, 2)) + .constructMaterial(); // C4H6O2 + public static Materials CalciumCarbide = new MaterialBuilder( + 775, + TextureSet.SET_DULL, + "Calcium Carbide").setName("CacliumCarbide") + .addDustItems() + .setRGB(235, 235, 235) + .setColor(Dyes.dyeGray) + .setMeltingPoint(2430) + .setMaterialList( + new MaterialStack(Materials.Calcium, 1), + new MaterialStack(Materials.Carbon, 2)) + .constructMaterial(); // CaC2 public static Materials LiquidCrystalKevlar = new MaterialBuilder( 774, TextureSet.SET_FLUID, - "Liquid Crystal Kevlar").setName("LiquidCrystalKevlar").addCell().addFluid().setRGB(240, 240, 120) - .setColor(Dyes.dyeYellow).constructMaterial(); // [-CO-C6H4-CO-NH-C6H4-NH-]n - public static Materials IIButinIIVdiol = new MaterialBuilder(773, TextureSet.SET_POWDER, "2-Butin-1,4-diol") - .setName("2Butin14diol").addDustItems().setRGB(247, 247, 180).setColor(Dyes.dyeYellow).setMeltingPoint(331) - .setMaterialList( - new MaterialStack(Materials.Carbon, 4), - new MaterialStack(Materials.Hydrogen, 6), - new MaterialStack(Materials.Oxygen, 2)) - .constructMaterial(); // C4H6O2 - public static Materials NickelAluminide = new MaterialBuilder(772, TextureSet.SET_METALLIC, "Nickel Aluminide") - .setName("NickelAluminide").addDustItems().addMetalItems().setRGB(230, 230, 230).setColor(Dyes.dyeGray) - .setMeltingPoint(1668).setBlastFurnaceTemp(1668).setBlastFurnaceRequired(true) - .setMaterialList(new MaterialStack(Materials.Nickel, 1), new MaterialStack(Materials.Aluminium, 3)) - .constructMaterial().disableAutoGeneratedBlastFurnaceRecipes(); // NiAl3 - public static Materials RaneyNickelActivated = new MaterialBuilder(771, TextureSet.SET_POWDER, "Raney Nickel") - .setName("RaneyNickelActivated").addDustItems().setRGB(230, 230, 230).setColor(Dyes.dyeGray) - .setMeltingPoint(1955) - .setMaterialList(new MaterialStack(Materials.Nickel, 1), new MaterialStack(Materials.Aluminium, 1)) - .constructMaterial(); // NiAl - public static Materials BismuthIIIOxide = new MaterialBuilder(769, TextureSet.SET_POWDER, "Bismuth Oxide") - .setName("BismuthIIIOxide").addDustItems().setRGB(50, 50, 50).setColor(Dyes.dyeBlack).setMeltingPoint(1090) - .setMaterialList(new MaterialStack(Materials.Bismuth, 2), new MaterialStack(Materials.Oxygen, 3)) - .constructMaterial(); // Bi2O3 - public static Materials ThionylChloride = new MaterialBuilder(768, TextureSet.SET_FLUID, "Thionyl Chloride") - .setName("ThionylChloride").addCell().addFluid().setRGB(255, 255, 255).setColor(Dyes.dyeWhite) - .constructMaterial(); // SOCl2 - public static Materials SulfurDichloride = new MaterialBuilder(767, TextureSet.SET_FLUID, "Sulfur Dichloride") - .setName("SulfurDichloride").addCell().addFluid().setRGB(200, 0, 0).setColor(Dyes.dyeRed) - .constructMaterial(); // SCl2 + "Liquid Crystal Kevlar").setName("LiquidCrystalKevlar") + .addCell() + .addFluid() + .setRGB(240, 240, 120) + .setColor(Dyes.dyeYellow) + .constructMaterial(); // [-CO-C6H4-CO-NH-C6H4-NH-]n + public static Materials IIButinIIVdiol = new MaterialBuilder( + 773, + TextureSet.SET_POWDER, + "2-Butin-1,4-diol").setName("2Butin14diol") + .addDustItems() + .setRGB(247, 247, 180) + .setColor(Dyes.dyeYellow) + .setMeltingPoint(331) + .setMaterialList( + new MaterialStack(Materials.Carbon, 4), + new MaterialStack(Materials.Hydrogen, 6), + new MaterialStack(Materials.Oxygen, 2)) + .constructMaterial(); // C4H6O2 + public static Materials NickelAluminide = new MaterialBuilder( + 772, + TextureSet.SET_METALLIC, + "Nickel Aluminide").setName("NickelAluminide") + .addDustItems() + .addMetalItems() + .setRGB(230, 230, 230) + .setColor(Dyes.dyeGray) + .setMeltingPoint(1668) + .setBlastFurnaceTemp(1668) + .setBlastFurnaceRequired(true) + .setMaterialList( + new MaterialStack(Materials.Nickel, 1), + new MaterialStack(Materials.Aluminium, 3)) + .constructMaterial() + .disableAutoGeneratedBlastFurnaceRecipes(); // NiAl3 + public static Materials RaneyNickelActivated = new MaterialBuilder( + 771, + TextureSet.SET_POWDER, + "Raney Nickel").setName("RaneyNickelActivated") + .addDustItems() + .setRGB(230, 230, 230) + .setColor(Dyes.dyeGray) + .setMeltingPoint(1955) + .setMaterialList( + new MaterialStack(Materials.Nickel, 1), + new MaterialStack(Materials.Aluminium, 1)) + .constructMaterial(); // NiAl + public static Materials BismuthIIIOxide = new MaterialBuilder( + 769, + TextureSet.SET_POWDER, + "Bismuth Oxide").setName("BismuthIIIOxide") + .addDustItems() + .setRGB(50, 50, 50) + .setColor(Dyes.dyeBlack) + .setMeltingPoint(1090) + .setMaterialList( + new MaterialStack(Materials.Bismuth, 2), + new MaterialStack(Materials.Oxygen, 3)) + .constructMaterial(); // Bi2O3 + public static Materials ThionylChloride = new MaterialBuilder( + 768, + TextureSet.SET_FLUID, + "Thionyl Chloride").setName("ThionylChloride") + .addCell() + .addFluid() + .setRGB(255, 255, 255) + .setColor(Dyes.dyeWhite) + .constructMaterial(); // SOCl2 + public static Materials SulfurDichloride = new MaterialBuilder( + 767, + TextureSet.SET_FLUID, + "Sulfur Dichloride").setName("SulfurDichloride") + .addCell() + .addFluid() + .setRGB(200, 0, 0) + .setColor(Dyes.dyeRed) + .constructMaterial(); // SCl2 public static Materials DimethylTerephthalate = new MaterialBuilder( 766, TextureSet.SET_FLUID, - "Dimethyl Terephthalate").setName("DimethylTerephthalate").addCell().addFluid().setRGB(255, 255, 255) - .setColor(Dyes.dyeWhite).setMeltingPoint(415) - .setMaterialList( - new MaterialStack(Materials.Carbon, 10), - new MaterialStack(Materials.Hydrogen, 10), - new MaterialStack(Materials.Oxygen, 4)) - .constructMaterial(); // C10H10O4 + "Dimethyl Terephthalate").setName("DimethylTerephthalate") + .addCell() + .addFluid() + .setRGB(255, 255, 255) + .setColor(Dyes.dyeWhite) + .setMeltingPoint(415) + .setMaterialList( + new MaterialStack(Materials.Carbon, 10), + new MaterialStack(Materials.Hydrogen, 10), + new MaterialStack(Materials.Oxygen, 4)) + .constructMaterial(); // C10H10O4 public static Materials Kevlar = new MaterialBuilder(765, TextureSet.SET_DULL, "Kevlar").setName("Kevlar") - .addDustItems().addMetalItems().addGearItems().setRGB(240, 240, 120).setColor(Dyes.dyeYellow) - .constructMaterial(); - public static Materials TerephthalicAcid = new MaterialBuilder(764, TextureSet.SET_FLUID, "Terephthalic Acid") - .setName("TerephthalicAcid").addCell().addFluid().setRGB(255, 255, 255).setColor(Dyes.dyeWhite) - .setMeltingPoint(480) - .setMaterialList( - new MaterialStack(Materials.Carbon, 8L), - new MaterialStack(Materials.Hydrogen, 6), - new MaterialStack(Materials.Oxygen, 4)) - .constructMaterial(); // C9H6O6 - public static Materials IIIDimethylbenzene = new MaterialBuilder(763, TextureSet.SET_FLUID, "1,3-Dimethylbenzen") - .addCell().addFluid().setRGB(112, 146, 74).setColor(Dyes.dyeLime).setMeltingPoint(225) - .setMaterialList(new MaterialStack(Materials.Carbon, 8), new MaterialStack(Materials.Hydrogen, 10)) - .addElectrolyzerRecipe().constructMaterial(); // C8H10 - public static Materials IVDimethylbenzene = new MaterialBuilder(762, TextureSet.SET_FLUID, "1,4-Dimethylbenzen") - .addCell().addFluid().setRGB(122, 136, 84).setColor(Dyes.dyeLime).setMeltingPoint(286) - .setMaterialList(new MaterialStack(Materials.Carbon, 8), new MaterialStack(Materials.Hydrogen, 10)) - .addElectrolyzerRecipe().constructMaterial(); // C8H10 - public static Materials CobaltIINaphthenate = new MaterialBuilder(761, TextureSet.SET_DULL, "Cobalt II Naphthenate") - .setName("Cobalt(II)Naphthenate").addDustItems().setRGB(143, 95, 39).setColor(Dyes.dyeBrown) - .setMeltingPoint(413) - .setMaterialList( - new MaterialStack(Materials.Cobalt, 1), - new MaterialStack(Materials.Carbon, 22), - new MaterialStack(Materials.Hydrogen, 14), - new MaterialStack(Materials.Oxygen, 4)) - .constructMaterial(); // CoC22H14O4 - public static Materials NaphthenicAcid = new MaterialBuilder(760, TextureSet.SET_FLUID, "Naphthenic Acid") - .setName("NaphthenicAcid").addCell().addFluid().setRGB(255, 255, 255).setColor(Dyes.dyeWhite) - .setFuelType(MaterialBuilder.SEMIFLUID).setFuelPower(80).constructMaterial(); - public static Materials CobaltIIHydroxide = new MaterialBuilder(759, TextureSet.SET_POWDER, "Cobalt II Hydroxide") - .setName("CobaltIIHydroxide").addDustItems().setRGB(229, 140, 239).setColor(Dyes.dyePurple) - .setMeltingPoint(441) - .setMaterialList( - new MaterialStack(Materials.Cobalt, 1), - new MaterialStack(Materials.Hydrogen, 2), - new MaterialStack(Materials.Oxygen, 2)) - .constructMaterial(); // CoH2O2 - public static Materials CobaltIIAcetate = new MaterialBuilder(758, TextureSet.SET_POWDER, "Cobalt II Acetate") - .setName("Cobalt(II)Acetate").addDustItems().setRGB(219, 162, 229).setColor(Dyes.dyePurple) - .setMeltingPoint(413) - .setMaterialList( - new MaterialStack(Materials.Carbon, 4L), - new MaterialStack(Materials.Hydrogen, 6), - new MaterialStack(Materials.Cobalt, 1), - new MaterialStack(Materials.Oxygen, 4)) - .constructMaterial(); // C4H6CoO4 - public static Materials CobaltIINitrate = new MaterialBuilder(757, TextureSet.SET_POWDER, "Cobalt II Nitrate") - .setName("Cobalt(II)Nitrate").addDustItems().setRGB(170, 0, 0).setColor(Dyes.dyeRed).setMeltingPoint(373) - .setMaterialList( - new MaterialStack(Materials.Cobalt, 1), - new MaterialStack(Materials.Nitrogen, 2), - new MaterialStack(Materials.Oxygen, 6)) - .constructMaterial(); // Co(NO3)2 + .addDustItems() + .addMetalItems() + .addGearItems() + .setRGB(240, 240, 120) + .setColor(Dyes.dyeYellow) + .constructMaterial(); + public static Materials TerephthalicAcid = new MaterialBuilder( + 764, + TextureSet.SET_FLUID, + "Terephthalic Acid").setName("TerephthalicAcid") + .addCell() + .addFluid() + .setRGB(255, 255, 255) + .setColor(Dyes.dyeWhite) + .setMeltingPoint(480) + .setMaterialList( + new MaterialStack(Materials.Carbon, 8L), + new MaterialStack(Materials.Hydrogen, 6), + new MaterialStack(Materials.Oxygen, 4)) + .constructMaterial(); // C9H6O6 + public static Materials IIIDimethylbenzene = new MaterialBuilder( + 763, + TextureSet.SET_FLUID, + "1,3-Dimethylbenzen").addCell() + .addFluid() + .setRGB(112, 146, 74) + .setColor(Dyes.dyeLime) + .setMeltingPoint(225) + .setMaterialList( + new MaterialStack(Materials.Carbon, 8), + new MaterialStack(Materials.Hydrogen, 10)) + .addElectrolyzerRecipe() + .constructMaterial(); // C8H10 + public static Materials IVDimethylbenzene = new MaterialBuilder( + 762, + TextureSet.SET_FLUID, + "1,4-Dimethylbenzen").addCell() + .addFluid() + .setRGB(122, 136, 84) + .setColor(Dyes.dyeLime) + .setMeltingPoint(286) + .setMaterialList( + new MaterialStack(Materials.Carbon, 8), + new MaterialStack(Materials.Hydrogen, 10)) + .addElectrolyzerRecipe() + .constructMaterial(); // C8H10 + public static Materials CobaltIINaphthenate = new MaterialBuilder( + 761, + TextureSet.SET_DULL, + "Cobalt II Naphthenate").setName("Cobalt(II)Naphthenate") + .addDustItems() + .setRGB(143, 95, 39) + .setColor(Dyes.dyeBrown) + .setMeltingPoint(413) + .setMaterialList( + new MaterialStack(Materials.Cobalt, 1), + new MaterialStack(Materials.Carbon, 22), + new MaterialStack(Materials.Hydrogen, 14), + new MaterialStack(Materials.Oxygen, 4)) + .constructMaterial(); // CoC22H14O4 + public static Materials NaphthenicAcid = new MaterialBuilder( + 760, + TextureSet.SET_FLUID, + "Naphthenic Acid").setName("NaphthenicAcid") + .addCell() + .addFluid() + .setRGB(255, 255, 255) + .setColor(Dyes.dyeWhite) + .setFuelType(MaterialBuilder.SEMIFLUID) + .setFuelPower(80) + .constructMaterial(); + public static Materials CobaltIIHydroxide = new MaterialBuilder( + 759, + TextureSet.SET_POWDER, + "Cobalt II Hydroxide").setName("CobaltIIHydroxide") + .addDustItems() + .setRGB(229, 140, 239) + .setColor(Dyes.dyePurple) + .setMeltingPoint(441) + .setMaterialList( + new MaterialStack(Materials.Cobalt, 1), + new MaterialStack(Materials.Hydrogen, 2), + new MaterialStack(Materials.Oxygen, 2)) + .constructMaterial(); // CoH2O2 + public static Materials CobaltIIAcetate = new MaterialBuilder( + 758, + TextureSet.SET_POWDER, + "Cobalt II Acetate").setName("Cobalt(II)Acetate") + .addDustItems() + .setRGB(219, 162, 229) + .setColor(Dyes.dyePurple) + .setMeltingPoint(413) + .setMaterialList( + new MaterialStack(Materials.Carbon, 4L), + new MaterialStack(Materials.Hydrogen, 6), + new MaterialStack(Materials.Cobalt, 1), + new MaterialStack(Materials.Oxygen, 4)) + .constructMaterial(); // C4H6CoO4 + public static Materials CobaltIINitrate = new MaterialBuilder( + 757, + TextureSet.SET_POWDER, + "Cobalt II Nitrate").setName("Cobalt(II)Nitrate") + .addDustItems() + .setRGB(170, 0, 0) + .setColor(Dyes.dyeRed) + .setMeltingPoint(373) + .setMaterialList( + new MaterialStack(Materials.Cobalt, 1), + new MaterialStack(Materials.Nitrogen, 2), + new MaterialStack(Materials.Oxygen, 6)) + .constructMaterial(); // Co(NO3)2 public static Materials OrganorhodiumCatalyst = new MaterialBuilder( 756, TextureSet.SET_POWDER, - "Organorhodium Catalyst").setName("OrganorhodiumCatalyst").addDustItems().setRGB(170, 0, 0) - .setColor(Dyes.dyeRed).setMeltingPoint(373) - .setMaterialList(new MaterialStack(Materials.Cobalt, 1), new MaterialStack(Materials.NitricAcid, 2)) - .constructMaterial(); // RhHCO(P(C6H5)3)3 - public static Materials SodiumBorohydride = new MaterialBuilder(755, TextureSet.SET_POWDER, "Sodium Borohydride") - .setName("SodiumBorohydride").addDustItems().setRGB(255, 255, 255).setColor(Dyes.dyeWhite) - .setMeltingPoint(673) - .setMaterialList( - new MaterialStack(Materials.Sodium, 1), - new MaterialStack(Materials.Boron, 1), - new MaterialStack(Materials.Hydrogen, 4)) - .constructMaterial(); // NaBH4 - public static Materials RhodiumChloride = new MaterialBuilder(754, TextureSet.SET_POWDER, "Rhodium Chloride") - .setName("RhodiumChloride").addDustItems().setRGB(128, 0, 0).setColor(Dyes.dyeRed).setMeltingPoint(723) - .constructMaterial(); // RHCL3 - public static Materials Triphenylphosphene = new MaterialBuilder(753, TextureSet.SET_POWDER, "Triphenylphosphine") - .setName("Triphenylphosphene").addDustItems().setRGB(255, 255, 255).setColor(Dyes.dyeWhite) - .setMeltingPoint(353) - .setMaterialList( - new MaterialStack(Materials.Carbon, 18L), - new MaterialStack(Materials.Hydrogen, 15L), - new MaterialStack(Materials.Phosphorus, 1L)) - .constructMaterial(); // C18H15P + "Organorhodium Catalyst").setName("OrganorhodiumCatalyst") + .addDustItems() + .setRGB(170, 0, 0) + .setColor(Dyes.dyeRed) + .setMeltingPoint(373) + .setMaterialList( + new MaterialStack(Materials.Cobalt, 1), + new MaterialStack(Materials.NitricAcid, 2)) + .constructMaterial(); // RhHCO(P(C6H5)3)3 + public static Materials SodiumBorohydride = new MaterialBuilder( + 755, + TextureSet.SET_POWDER, + "Sodium Borohydride").setName("SodiumBorohydride") + .addDustItems() + .setRGB(255, 255, 255) + .setColor(Dyes.dyeWhite) + .setMeltingPoint(673) + .setMaterialList( + new MaterialStack(Materials.Sodium, 1), + new MaterialStack(Materials.Boron, 1), + new MaterialStack(Materials.Hydrogen, 4)) + .constructMaterial(); // NaBH4 + public static Materials RhodiumChloride = new MaterialBuilder( + 754, + TextureSet.SET_POWDER, + "Rhodium Chloride").setName("RhodiumChloride") + .addDustItems() + .setRGB(128, 0, 0) + .setColor(Dyes.dyeRed) + .setMeltingPoint(723) + .constructMaterial(); // RHCL3 + public static Materials Triphenylphosphene = new MaterialBuilder( + 753, + TextureSet.SET_POWDER, + "Triphenylphosphine").setName("Triphenylphosphene") + .addDustItems() + .setRGB(255, 255, 255) + .setColor(Dyes.dyeWhite) + .setMeltingPoint(353) + .setMaterialList( + new MaterialStack(Materials.Carbon, 18L), + new MaterialStack(Materials.Hydrogen, 15L), + new MaterialStack(Materials.Phosphorus, 1L)) + .constructMaterial(); // C18H15P public static Materials PhosphorusTrichloride = new MaterialBuilder( 752, TextureSet.SET_FLUID, - "Phosphorus Trichloride").setName("PhosphorusTrichloride").addCell().addFluid().setRGB(255, 255, 255) - .setColor(Dyes.dyeWhite).setMeltingPoint(179) - .setMaterialList( - new MaterialStack(Materials.Phosphorus, 1L), - new MaterialStack(Materials.Chlorine, 3L)) - .constructMaterial(); // PCL3 - public static Materials SodiumHydride = new MaterialBuilder(751, TextureSet.SET_POWDER, "Sodium Hydride") - .setName("SodiumHydride").addDustItems().setRGB(192, 192, 192).setColor(Dyes.dyeLightGray) - .setMeltingPoint(911) - .setMaterialList(new MaterialStack(Materials.Sodium, 1L), new MaterialStack(Materials.Hydrogen, 1L)) - .constructMaterial(); // NaH - public static Materials TrimethylBorate = new MaterialBuilder(750, TextureSet.SET_FLUID, "Trimethyl Borate") - .setName("TrimethylBorate").addCell().addFluid().setRGB(255, 255, 255).setColor(Dyes.dyeWhite) - .setMeltingPoint(239) - .setMaterialList( - new MaterialStack(Materials.Carbon, 3L), - new MaterialStack(Materials.Hydrogen, 9L), - new MaterialStack(Materials.Boron, 1L), - new MaterialStack(Materials.Oxygen, 3L)) - .constructMaterial(); // C3H9BO3 - public static Materials SodiumMethoxide = new MaterialBuilder(749, TextureSet.SET_POWDER, "Sodium Methoxide") - .setName("SodiumMethoxide").addDustItems().setRGB(255, 255, 255).setColor(Dyes.dyeWhite) - .setMeltingPoint(400) - .setMaterialList( - new MaterialStack(Materials.Carbon, 1L), - new MaterialStack(Materials.Hydrogen, 3L), - new MaterialStack(Materials.Oxygen, 1L), - new MaterialStack(Materials.Sodium, 1L)) - .constructMaterial(); // CH3NaO + "Phosphorus Trichloride").setName("PhosphorusTrichloride") + .addCell() + .addFluid() + .setRGB(255, 255, 255) + .setColor(Dyes.dyeWhite) + .setMeltingPoint(179) + .setMaterialList( + new MaterialStack(Materials.Phosphorus, 1L), + new MaterialStack(Materials.Chlorine, 3L)) + .constructMaterial(); // PCL3 + public static Materials SodiumHydride = new MaterialBuilder( + 751, + TextureSet.SET_POWDER, + "Sodium Hydride").setName("SodiumHydride") + .addDustItems() + .setRGB(192, 192, 192) + .setColor(Dyes.dyeLightGray) + .setMeltingPoint(911) + .setMaterialList( + new MaterialStack(Materials.Sodium, 1L), + new MaterialStack(Materials.Hydrogen, 1L)) + .constructMaterial(); // NaH + public static Materials TrimethylBorate = new MaterialBuilder( + 750, + TextureSet.SET_FLUID, + "Trimethyl Borate").setName("TrimethylBorate") + .addCell() + .addFluid() + .setRGB(255, 255, 255) + .setColor(Dyes.dyeWhite) + .setMeltingPoint(239) + .setMaterialList( + new MaterialStack(Materials.Carbon, 3L), + new MaterialStack(Materials.Hydrogen, 9L), + new MaterialStack(Materials.Boron, 1L), + new MaterialStack(Materials.Oxygen, 3L)) + .constructMaterial(); // C3H9BO3 + public static Materials SodiumMethoxide = new MaterialBuilder( + 749, + TextureSet.SET_POWDER, + "Sodium Methoxide").setName("SodiumMethoxide") + .addDustItems() + .setRGB(255, 255, 255) + .setColor(Dyes.dyeWhite) + .setMeltingPoint(400) + .setMaterialList( + new MaterialStack(Materials.Carbon, 1L), + new MaterialStack(Materials.Hydrogen, 3L), + new MaterialStack(Materials.Oxygen, 1L), + new MaterialStack(Materials.Sodium, 1L)) + .constructMaterial(); // CH3NaO // H3RhCl6 diff --git a/src/main/java/gregtech/api/enums/MaterialsOreAlum.java b/src/main/java/gregtech/api/enums/MaterialsOreAlum.java index f90e39e493..12c03396fc 100644 --- a/src/main/java/gregtech/api/enums/MaterialsOreAlum.java +++ b/src/main/java/gregtech/api/enums/MaterialsOreAlum.java @@ -2,31 +2,89 @@ package gregtech.api.enums; public class MaterialsOreAlum { - public static Materials BauxiteSlurry = new MaterialBuilder(409, TextureSet.SET_FLUID, "Bauxite Slurry") - .setName("BauxiteSlurry").addCell().addFluid().setRGB(37, 67, 168).setMeltingPoint(295) - .setColor(Dyes.dyeBlue).constructMaterial(); + public static Materials BauxiteSlurry = new MaterialBuilder( + 409, + TextureSet.SET_FLUID, + "Bauxite Slurry").setName("BauxiteSlurry") + .addCell() + .addFluid() + .setRGB(37, 67, 168) + .setMeltingPoint(295) + .setColor(Dyes.dyeBlue) + .constructMaterial(); public static Materials HeatedBauxiteSlurry = new MaterialBuilder( 410, TextureSet.SET_FLUID, - "Heated Bauxite Slurry").setName("HeadedBauxiteSlurry").addCell().addFluid().setRGB(55, 92, 212) - .setLiquidTemperature(533).setMeltingPoint(295).setColor(Dyes.dyeBlue).constructMaterial(); - public static Materials SluiceJuice = new MaterialBuilder(411, TextureSet.SET_FLUID, "Sluice Juice") - .setName("SluiceJuice").addCell().addFluid().setRGB(92, 60, 36).setLiquidTemperature(295) - .setMeltingPoint(295).setColor(Dyes.dyeGray).constructMaterial(); - public static Materials SluiceSand = new MaterialBuilder(412, TextureSet.SET_FINE, "Sluice Sand") - .setName("SluiceSand").addDustItems().setRGB(165, 165, 120).setColor(Dyes.dyeGray).constructMaterial(); - public static Materials BauxiteSlag = new MaterialBuilder(413, TextureSet.SET_FINE, "Bauxite Slag") - .setName("BauxiteSlag").addDustItems().setRGB(110, 31, 31).setColor(Dyes.dyeRed).constructMaterial(); - public static Materials IlmeniteSlag = new MaterialBuilder(414, TextureSet.SET_FINE, "Ilmenite Slag") - .setName("IlmeniteSlag").addDustItems().setRGB(163, 38, 38).setColor(Dyes.dyeBrown).constructMaterial(); - public static Materials GreenSapphireJuice = new MaterialBuilder(415, TextureSet.SET_FLUID, "Green Sapphire Juice") - .setName("GreenSapphireJuice").addCell().addFluid().setRGB(100, 200, 130).setColor(Dyes.dyeGreen) - .constructMaterial(); - public static Materials SapphireJuice = new MaterialBuilder(416, TextureSet.SET_FLUID, "Sapphire Juice") - .setName("SapphireJuice").addCell().addFluid().setRGB(100, 100, 200).setColor(Dyes.dyeBlue) - .constructMaterial(); - public static Materials RubyJuice = new MaterialBuilder(417, TextureSet.SET_FLUID, "Ruby Juice") - .setName("RubyJuice").addCell().addFluid().setRGB(255, 100, 100).setColor(Dyes.dyeRed).constructMaterial(); + "Heated Bauxite Slurry").setName("HeadedBauxiteSlurry") + .addCell() + .addFluid() + .setRGB(55, 92, 212) + .setLiquidTemperature(533) + .setMeltingPoint(295) + .setColor(Dyes.dyeBlue) + .constructMaterial(); + public static Materials SluiceJuice = new MaterialBuilder( + 411, + TextureSet.SET_FLUID, + "Sluice Juice").setName("SluiceJuice") + .addCell() + .addFluid() + .setRGB(92, 60, 36) + .setLiquidTemperature(295) + .setMeltingPoint(295) + .setColor(Dyes.dyeGray) + .constructMaterial(); + public static Materials SluiceSand = new MaterialBuilder( + 412, + TextureSet.SET_FINE, + "Sluice Sand").setName("SluiceSand") + .addDustItems() + .setRGB(165, 165, 120) + .setColor(Dyes.dyeGray) + .constructMaterial(); + public static Materials BauxiteSlag = new MaterialBuilder( + 413, + TextureSet.SET_FINE, + "Bauxite Slag").setName("BauxiteSlag") + .addDustItems() + .setRGB(110, 31, 31) + .setColor(Dyes.dyeRed) + .constructMaterial(); + public static Materials IlmeniteSlag = new MaterialBuilder( + 414, + TextureSet.SET_FINE, + "Ilmenite Slag").setName("IlmeniteSlag") + .addDustItems() + .setRGB(163, 38, 38) + .setColor(Dyes.dyeBrown) + .constructMaterial(); + public static Materials GreenSapphireJuice = new MaterialBuilder( + 415, + TextureSet.SET_FLUID, + "Green Sapphire Juice").setName("GreenSapphireJuice") + .addCell() + .addFluid() + .setRGB(100, 200, 130) + .setColor(Dyes.dyeGreen) + .constructMaterial(); + public static Materials SapphireJuice = new MaterialBuilder( + 416, + TextureSet.SET_FLUID, + "Sapphire Juice").setName("SapphireJuice") + .addCell() + .addFluid() + .setRGB(100, 100, 200) + .setColor(Dyes.dyeBlue) + .constructMaterial(); + public static Materials RubyJuice = new MaterialBuilder( + 417, + TextureSet.SET_FLUID, + "Ruby Juice").setName("RubyJuice") + .addCell() + .addFluid() + .setRGB(255, 100, 100) + .setColor(Dyes.dyeRed) + .constructMaterial(); /** * called by Materials. Can be safely called multiple times. exists to allow Materials ensure this class is diff --git a/src/main/java/gregtech/api/enums/OrePrefixes.java b/src/main/java/gregtech/api/enums/OrePrefixes.java index 2bb2aaf402..4139f90db1 100644 --- a/src/main/java/gregtech/api/enums/OrePrefixes.java +++ b/src/main/java/gregtech/api/enums/OrePrefixes.java @@ -709,9 +709,11 @@ public enum OrePrefixes { ingot.addFamiliarPrefix(nugget); nugget.addFamiliarPrefix(ingot); - for (OrePrefixes tPrefix1 : values()) - if (tPrefix1.name().startsWith("ore")) for (OrePrefixes tPrefix2 : values()) - if (tPrefix2.name().startsWith("ore")) tPrefix1.addFamiliarPrefix(tPrefix2); + for (OrePrefixes tPrefix1 : values()) if (tPrefix1.name() + .startsWith("ore")) + for (OrePrefixes tPrefix2 : values()) if (tPrefix2.name() + .startsWith("ore")) + tPrefix1.addFamiliarPrefix(tPrefix2); // These are only the important ones. gem.mNotGeneratedItems.add(Materials.Coal); @@ -1137,59 +1139,109 @@ public enum OrePrefixes { public static void initMaterialComponents() { boolean enablePerItemSettings = GregTech_API.sMaterialComponents.get("general", "enablePerItemSettings", false); - boolean enableUnusedIngotHot = GregTech_API.sMaterialComponents - .get("globalcomponents", "enableUnusedIngotHot", false); - boolean enableUnusedPlates = GregTech_API.sMaterialComponents - .get("globalcomponents", "enableUnusedPlates", false); - boolean enableUnusedDoubleIngots = GregTech_API.sMaterialComponents - .get("globalcomponents", "enableUnusedDoubleIngots", false); - boolean enableUnusedTripleIngots = GregTech_API.sMaterialComponents - .get("globalcomponents", "enableUnusedTripleIngots", false); - boolean enableUnusedQuadIngots = GregTech_API.sMaterialComponents - .get("globalcomponents", "enableUnusedQuadIngots", false); - boolean enableUnusedQuinIngots = GregTech_API.sMaterialComponents - .get("globalcomponents", "enableUnusedQuinIngots", false); - boolean enableUnusedDoublePlates = GregTech_API.sMaterialComponents - .get("globalcomponents", "enableUnusedDoublePlates", false); - boolean enableUnusedTriplePlates = GregTech_API.sMaterialComponents - .get("globalcomponents", "enableUnusedTriplePlates", false); - boolean enableUnusedQuadPlates = GregTech_API.sMaterialComponents - .get("globalcomponents", "enableUnusedQuadPlates", false); - boolean enableUnusedQuinPlates = GregTech_API.sMaterialComponents - .get("globalcomponents", "enableUnusedQuinPlates", false); - boolean enableUnusedDensePlates = GregTech_API.sMaterialComponents - .get("globalcomponents", "enableUnusedDensePlates", false); - boolean enableUnusedGears = GregTech_API.sMaterialComponents - .get("globalcomponents", "enableUnusedGears", false); - boolean enableUnusedSmallGears = GregTech_API.sMaterialComponents - .get("globalcomponents", "enableUnusedSmallGears", false); - boolean enableUnusedRings = GregTech_API.sMaterialComponents - .get("globalcomponents", "enableUnusedRings", false); - boolean enableUnusedSprings = GregTech_API.sMaterialComponents - .get("globalcomponents", "enableUnusedSprings", false); - boolean enableUnusedSmallSprings = GregTech_API.sMaterialComponents - .get("globalcomponents", "enableUnusedSmallSprings", false); - boolean enableUnusedRounds = GregTech_API.sMaterialComponents - .get("globalcomponents", "enableUnusedRounds", false); - boolean enableUnusedRotors = GregTech_API.sMaterialComponents - .get("globalcomponents", "enableUnusedRotors", false); - boolean enableUnusedFineWires = GregTech_API.sMaterialComponents - .get("globalcomponents", "enableUnusedFineWires", false); + boolean enableUnusedIngotHot = GregTech_API.sMaterialComponents.get( + "globalcomponents", + "enableUnusedIngotHot", + false); + boolean enableUnusedPlates = GregTech_API.sMaterialComponents.get( + "globalcomponents", + "enableUnusedPlates", + false); + boolean enableUnusedDoubleIngots = GregTech_API.sMaterialComponents.get( + "globalcomponents", + "enableUnusedDoubleIngots", + false); + boolean enableUnusedTripleIngots = GregTech_API.sMaterialComponents.get( + "globalcomponents", + "enableUnusedTripleIngots", + false); + boolean enableUnusedQuadIngots = GregTech_API.sMaterialComponents.get( + "globalcomponents", + "enableUnusedQuadIngots", + false); + boolean enableUnusedQuinIngots = GregTech_API.sMaterialComponents.get( + "globalcomponents", + "enableUnusedQuinIngots", + false); + boolean enableUnusedDoublePlates = GregTech_API.sMaterialComponents.get( + "globalcomponents", + "enableUnusedDoublePlates", + false); + boolean enableUnusedTriplePlates = GregTech_API.sMaterialComponents.get( + "globalcomponents", + "enableUnusedTriplePlates", + false); + boolean enableUnusedQuadPlates = GregTech_API.sMaterialComponents.get( + "globalcomponents", + "enableUnusedQuadPlates", + false); + boolean enableUnusedQuinPlates = GregTech_API.sMaterialComponents.get( + "globalcomponents", + "enableUnusedQuinPlates", + false); + boolean enableUnusedDensePlates = GregTech_API.sMaterialComponents.get( + "globalcomponents", + "enableUnusedDensePlates", + false); + boolean enableUnusedGears = GregTech_API.sMaterialComponents.get( + "globalcomponents", + "enableUnusedGears", + false); + boolean enableUnusedSmallGears = GregTech_API.sMaterialComponents.get( + "globalcomponents", + "enableUnusedSmallGears", + false); + boolean enableUnusedRings = GregTech_API.sMaterialComponents.get( + "globalcomponents", + "enableUnusedRings", + false); + boolean enableUnusedSprings = GregTech_API.sMaterialComponents.get( + "globalcomponents", + "enableUnusedSprings", + false); + boolean enableUnusedSmallSprings = GregTech_API.sMaterialComponents.get( + "globalcomponents", + "enableUnusedSmallSprings", + false); + boolean enableUnusedRounds = GregTech_API.sMaterialComponents.get( + "globalcomponents", + "enableUnusedRounds", + false); + boolean enableUnusedRotors = GregTech_API.sMaterialComponents.get( + "globalcomponents", + "enableUnusedRotors", + false); + boolean enableUnusedFineWires = GregTech_API.sMaterialComponents.get( + "globalcomponents", + "enableUnusedFineWires", + false); boolean enableUnusedFoil = GregTech_API.sMaterialComponents.get("globalcomponents", "enableUnusedFoil", false); - boolean enableUnusedArrows = GregTech_API.sMaterialComponents - .get("globalcomponents", "enableUnusedArrowHeads", false); - boolean enableUnusedCrates = GregTech_API.sMaterialComponents - .get("globalcomponents", "enableUnusedCrates", false); - boolean enableUnusedBolts = GregTech_API.sMaterialComponents - .get("globalcomponents", "enableUnusedBolts", false); - boolean enableUnusedScrews = GregTech_API.sMaterialComponents - .get("globalcomponents", "enableUnusedScrews", false); + boolean enableUnusedArrows = GregTech_API.sMaterialComponents.get( + "globalcomponents", + "enableUnusedArrowHeads", + false); + boolean enableUnusedCrates = GregTech_API.sMaterialComponents.get( + "globalcomponents", + "enableUnusedCrates", + false); + boolean enableUnusedBolts = GregTech_API.sMaterialComponents.get( + "globalcomponents", + "enableUnusedBolts", + false); + boolean enableUnusedScrews = GregTech_API.sMaterialComponents.get( + "globalcomponents", + "enableUnusedScrews", + false); boolean enableUnusedRods = GregTech_API.sMaterialComponents.get("globalcomponents", "enableUnusedRods", false); - boolean enableUnusedLongRods = GregTech_API.sMaterialComponents - .get("globalcomponents", "enableUnusedLongRods", false); + boolean enableUnusedLongRods = GregTech_API.sMaterialComponents.get( + "globalcomponents", + "enableUnusedLongRods", + false); boolean enableUnusedGems = GregTech_API.sMaterialComponents.get("globalcomponents", "enableUnusedGems", false); - boolean enableUnusedItemCasing = GregTech_API.sMaterialComponents - .get("globalcomponents", "enableUnusedItemCasing", false); + boolean enableUnusedItemCasing = GregTech_API.sMaterialComponents.get( + "globalcomponents", + "enableUnusedItemCasing", + false); // TODO possibly use OrePrefix mNotGeneratedItems/mGeneratedItems instead of a static List for every material // instance? @@ -1512,12 +1564,16 @@ public enum OrePrefixes { } if (enablePerItemSettings) { StringBuilder aConfigPathSB = new StringBuilder(); - aConfigPathSB.append("materialcomponents.").append(aMaterial.mConfigSection).append(".") - .append(aMaterial.mName); + aConfigPathSB.append("materialcomponents.") + .append(aMaterial.mConfigSection) + .append(".") + .append(aMaterial.mName); String aConfigPath = aConfigPathSB.toString(); for (OrePrefixes aPrefix : mPreventableComponents) { - boolean aEnableComponent = GregTech_API.sMaterialComponents - .get(aConfigPath, aPrefix.toString(), !aPrefix.mDisabledItems.contains(aMaterial)); + boolean aEnableComponent = GregTech_API.sMaterialComponents.get( + aConfigPath, + aPrefix.toString(), + !aPrefix.mDisabledItems.contains(aMaterial)); if (!aEnableComponent) { // Disable component if false and is not already in disabled list aPrefix.disableComponent(aMaterial); } else if (aEnableComponent) { // Enable component if true and is not already in enabled list diff --git a/src/main/java/gregtech/api/enums/SoundResource.java b/src/main/java/gregtech/api/enums/SoundResource.java index 63a8331496..a0c039e48e 100644 --- a/src/main/java/gregtech/api/enums/SoundResource.java +++ b/src/main/java/gregtech/api/enums/SoundResource.java @@ -304,9 +304,10 @@ public enum SoundResource { private static final Map<String, SoundResource> RESOURCE_STR_SOUND_MAP = new ConcurrentHashMap<>(); static { - EnumSet.allOf(SoundResource.class).forEach(sound -> { if (sound.id >= 0) ID_SOUND_MAP.put(sound.id, sound); }); EnumSet.allOf(SoundResource.class) - .forEach(sound -> RESOURCE_STR_SOUND_MAP.put(sound.resourceLocation.toString(), sound)); + .forEach(sound -> { if (sound.id >= 0) ID_SOUND_MAP.put(sound.id, sound); }); + EnumSet.allOf(SoundResource.class) + .forEach(sound -> RESOURCE_STR_SOUND_MAP.put(sound.resourceLocation.toString(), sound)); } /** diff --git a/src/main/java/gregtech/api/enums/Textures.java b/src/main/java/gregtech/api/enums/Textures.java index ba76816b7a..b2a3090a14 100644 --- a/src/main/java/gregtech/api/enums/Textures.java +++ b/src/main/java/gregtech/api/enums/Textures.java @@ -1499,8 +1499,10 @@ public class Textures { BLOCK_TRANSCENDENTMETAL, BLOCK_ORIHARUKON, BLOCK_WHITEDWARFMATTER, BLOCK_BLACKDWARFMATTER, BLOCK_UNIVERSIUM }; - public static final ITexture[] HIDDEN_TEXTURE = { - TextureFactory.builder().addIcon(HIDDEN_FACE).stdOrient().build() }; + public static final ITexture[] HIDDEN_TEXTURE = { TextureFactory.builder() + .addIcon(HIDDEN_FACE) + .stdOrient() + .build() }; public static final ITexture[] ERROR_RENDERING = { TextureFactory.of(RENDERING_ERROR) }; public static final ITexture[] OVERLAYS_ENERGY_IN = { TextureFactory.of(OVERLAY_ENERGY_IN, new short[] { 180, 180, 180, 0 }), diff --git a/src/main/java/gregtech/api/enums/ToolDictNames.java b/src/main/java/gregtech/api/enums/ToolDictNames.java index 9b1c3e594a..bc27fe6923 100644 --- a/src/main/java/gregtech/api/enums/ToolDictNames.java +++ b/src/main/java/gregtech/api/enums/ToolDictNames.java @@ -34,7 +34,8 @@ public enum ToolDictNames { public static boolean contains(String aName) { if (!aName.startsWith("craftingTool")) return false; for (ToolDictNames tool : ToolDictNames.values()) { - if (tool.toString().equals(aName)) { + if (tool.toString() + .equals(aName)) { return true; } } diff --git a/src/main/java/gregtech/api/fluid/FluidTankGT.java b/src/main/java/gregtech/api/fluid/FluidTankGT.java index f10e65d100..0d21d7dd49 100644 --- a/src/main/java/gregtech/api/fluid/FluidTankGT.java +++ b/src/main/java/gregtech/api/fluid/FluidTankGT.java @@ -418,7 +418,9 @@ public class FluidTankGT implements IFluidTank { } public String name() { - return mFluid == null ? null : mFluid.getFluid().getName(); + return mFluid == null ? null + : mFluid.getFluid() + .getName(); } public FluidStack get() { diff --git a/src/main/java/gregtech/api/fluid/GT_FluidFactory.java b/src/main/java/gregtech/api/fluid/GT_FluidFactory.java index b392167147..ae57f47430 100644 --- a/src/main/java/gregtech/api/fluid/GT_FluidFactory.java +++ b/src/main/java/gregtech/api/fluid/GT_FluidFactory.java @@ -54,8 +54,11 @@ public class GT_FluidFactory { */ public static Fluid of(final String fluidName, final String localizedName, final Materials material, final FluidState state, final int temperature) { - return builder(fluidName).withLocalizedName(localizedName).withStateAndTemperature(state, temperature) - .buildAndRegister().configureMaterials(material).asFluid(); + return builder(fluidName).withLocalizedName(localizedName) + .withStateAndTemperature(state, temperature) + .buildAndRegister() + .configureMaterials(material) + .asFluid(); } /** @@ -69,8 +72,10 @@ public class GT_FluidFactory { */ public static Fluid of(final String fluidName, final String localizedName, final FluidState state, final int temperature) { - return builder(fluidName).withLocalizedName(localizedName).withStateAndTemperature(state, temperature) - .buildAndRegister().asFluid(); + return builder(fluidName).withLocalizedName(localizedName) + .withStateAndTemperature(state, temperature) + .buildAndRegister() + .asFluid(); } /** diff --git a/src/main/java/gregtech/api/graphs/GenerateNodeMapPower.java b/src/main/java/gregtech/api/graphs/GenerateNodeMapPower.java index 62dfa2d8ea..26c3c60ef1 100644 --- a/src/main/java/gregtech/api/graphs/GenerateNodeMapPower.java +++ b/src/main/java/gregtech/api/graphs/GenerateNodeMapPower.java @@ -62,8 +62,10 @@ public class GenerateNodeMapPower extends GenerateNodeMap { int dZ = aTileEntity.zCoord + ForgeDirection.getOrientation(aSide).offsetZ; boolean crossesChuncks = dX >> 4 != aTileEntity.xCoord >> 4 || dZ >> 4 != aTileEntity.zCoord >> 4; TileEntity tNextTo = null; - if (!crossesChuncks || !aTileEntity.getWorldObj().blockExists(dX, dY, dZ)) - tNextTo = aTileEntity.getWorldObj().getTileEntity(dX, dY, dZ); + if (!crossesChuncks || !aTileEntity.getWorldObj() + .blockExists(dX, dY, dZ)) + tNextTo = aTileEntity.getWorldObj() + .getTileEntity(dX, dY, dZ); if (((IEnergySink) aTileEntity).acceptsEnergyFrom(tNextTo, ForgeDirection.getOrientation(aSide))) { ConsumerNode tConsumerNode = new NodeEnergySink( diff --git a/src/main/java/gregtech/api/graphs/Node.java b/src/main/java/gregtech/api/graphs/Node.java index 21b9937191..38b3cd0e37 100644 --- a/src/main/java/gregtech/api/graphs/Node.java +++ b/src/main/java/gregtech/api/graphs/Node.java @@ -17,7 +17,8 @@ public class Node { this.mConsumers = aConsumers; mHighestNodeValue = aNodeValue; // you don't want to generate map multiple times in the same tick - mCreationTime = MinecraftServer.getServer().getTickCounter(); + mCreationTime = MinecraftServer.getServer() + .getTickCounter(); } public final TileEntity mTileEntity; diff --git a/src/main/java/gregtech/api/graphs/consumers/NodeEnergyReceiver.java b/src/main/java/gregtech/api/graphs/consumers/NodeEnergyReceiver.java index eec63cf935..c7c4cbeba5 100644 --- a/src/main/java/gregtech/api/graphs/consumers/NodeEnergyReceiver.java +++ b/src/main/java/gregtech/api/graphs/consumers/NodeEnergyReceiver.java @@ -86,11 +86,15 @@ public class NodeEnergyReceiver extends ConsumerNode { World tWorld = mTileEntity.getWorldObj(); GT_Utility.sendSoundToPlayers(tWorld, SoundResource.IC2_MACHINES_MACHINE_OVERLOAD, 1.0F, -1, tX, tY, tZ); tWorld.setBlock(tX, tY, tZ, Blocks.air); - if (GregTech_API.sMachineExplosions) if (GT_Mod.gregtechproxy.mPollution) GT_Pollution - .addPollution(tWorld.getChunkFromBlockCoords(tX, tZ), GT_Mod.gregtechproxy.mPollutionOnExplosion); + if (GregTech_API.sMachineExplosions) if (GT_Mod.gregtechproxy.mPollution) GT_Pollution.addPollution( + tWorld.getChunkFromBlockCoords(tX, tZ), + GT_Mod.gregtechproxy.mPollutionOnExplosion); - new WorldSpawnedEventBuilder.ExplosionEffectEventBuilder().setStrength(tStrength).setSmoking(true) - .setPosition(tX + 0.5, tY + 0.5, tZ + 0.5).setWorld(tWorld).run(); + new WorldSpawnedEventBuilder.ExplosionEffectEventBuilder().setStrength(tStrength) + .setSmoking(true) + .setPosition(tX + 0.5, tY + 0.5, tZ + 0.5) + .setWorld(tWorld) + .run(); } } } diff --git a/src/main/java/gregtech/api/graphs/paths/PowerNodePath.java b/src/main/java/gregtech/api/graphs/paths/PowerNodePath.java index 1601d3b28d..7d9a76524e 100644 --- a/src/main/java/gregtech/api/graphs/paths/PowerNodePath.java +++ b/src/main/java/gregtech/api/graphs/paths/PowerNodePath.java @@ -27,7 +27,8 @@ public class PowerNodePath extends NodePath { } public void applyVoltage(long aVoltage, boolean aCountUp) { - int tNewTime = MinecraftServer.getServer().getTickCounter(); + int tNewTime = MinecraftServer.getServer() + .getTickCounter(); if (mTick != tNewTime) { reset(tNewTime - mTick); mTick = tNewTime; @@ -76,7 +77,9 @@ public class PowerNodePath extends NodePath { // if no amps pass through for more than 0.5 second reduce them to minimize wrong results // but still allow the player to see if activity is happening public long getAmps() { - int tTime = MinecraftServer.getServer().getTickCounter() - 10; + int tTime = MinecraftServer.getServer() + .getTickCounter() + - 10; if (mTick < tTime) { reset(tTime - mTick); mTick = tTime; diff --git a/src/main/java/gregtech/api/gui/GT_Container.java b/src/main/java/gregtech/api/gui/GT_Container.java index 2c4d7292d0..1c6b4ff60a 100644 --- a/src/main/java/gregtech/api/gui/GT_Container.java +++ b/src/main/java/gregtech/api/gui/GT_Container.java @@ -139,7 +139,10 @@ public class GT_Container extends Container { aPlayerInventory.setItemStack(null); } if (aMouseclick == 1) { - aPlayer.dropPlayerItemWithRandomChoice(aPlayerInventory.getItemStack().splitStack(1), true); + aPlayer.dropPlayerItemWithRandomChoice( + aPlayerInventory.getItemStack() + .splitStack(1), + true); if (aPlayerInventory.getItemStack().stackSize == 0) { aPlayerInventory.setItemStack(null); } @@ -151,7 +154,9 @@ public class GT_Container extends Container { tTempStack = this.transferStackInSlot(aPlayer, aSlotIndex); if (tTempStack != null) { rStack = GT_Utility.copyOrNull(tTempStack); - if (aSlot.getStack() != null && aSlot.getStack().getItem() == tTempStack.getItem()) { + if (aSlot.getStack() != null && aSlot.getStack() + .getItem() + == tTempStack.getItem()) { slotClick(aSlotIndex, aMouseclick, aShifthold, aPlayer); } } @@ -667,7 +672,9 @@ public class GT_Container extends Container { protected static ItemStack fillFluid(IFluidAccess aFluidAccess, EntityPlayer aPlayer, FluidStack aFluidHeld, boolean aProcessFullStack) { // we are not using aMachine.fill() here any more, so we need to check for fluid type here ourselves - if (aFluidAccess.get() != null && !aFluidAccess.get().isFluidEqual(aFluidHeld)) return null; + if (aFluidAccess.get() != null && !aFluidAccess.get() + .isFluidEqual(aFluidHeld)) + return null; ItemStack tStackHeld = aPlayer.inventory.getItemStack(); ItemStack tStackSizedOne = GT_Utility.copyAmount(1, tStackHeld); if (tStackSizedOne == null) return null; diff --git a/src/main/java/gregtech/api/gui/GT_ContainerMetaTile_Machine.java b/src/main/java/gregtech/api/gui/GT_ContainerMetaTile_Machine.java index 3ce2a53fce..4627362e66 100644 --- a/src/main/java/gregtech/api/gui/GT_ContainerMetaTile_Machine.java +++ b/src/main/java/gregtech/api/gui/GT_ContainerMetaTile_Machine.java @@ -265,8 +265,9 @@ public class GT_ContainerMetaTile_Machine extends GT_Container { List<ItemStack> tCircuits = ccs.getConfigurationCircuits(); int index = GT_Utility.findMatchingStackInList(tCircuits, cursorStack); if (index < 0) { - int curIndex = GT_Utility - .findMatchingStackInList(tCircuits, machine.getStackInSlot(ccs.getCircuitSlot())) + 1; + int curIndex = GT_Utility.findMatchingStackInList( + tCircuits, + machine.getStackInSlot(ccs.getCircuitSlot())) + 1; if (aMouseclick == 0) { curIndex += 1; } else { diff --git a/src/main/java/gregtech/api/gui/GT_GUIColorOverride.java b/src/main/java/gregtech/api/gui/GT_GUIColorOverride.java index 795148ee25..06ddf16d02 100644 --- a/src/main/java/gregtech/api/gui/GT_GUIColorOverride.java +++ b/src/main/java/gregtech/api/gui/GT_GUIColorOverride.java @@ -21,17 +21,29 @@ import gregtech.api.util.ColorsMetadataSection; public class GT_GUIColorOverride { private static final Object NOT_FOUND = new Object(); - private static final LoadingCache<ResourceLocation, Object> cache = CacheBuilder.newBuilder().softValues() - .build(new CacheLoader<ResourceLocation, Object>() { - - @Override - public Object load(@Nonnull ResourceLocation key) throws Exception { - IResource ir = Minecraft.getMinecraft().getResourceManager().getResource(key); - if (ir.hasMetadata()) return ir.getMetadata("colors"); - // return a dummy object because LoadingCache doesn't like null - return NOT_FOUND; - } - }); + private static final LoadingCache<ResourceLocation, Object> cache = CacheBuilder.newBuilder() + .softValues() + .build( + new CacheLoader<ResourceLocation, Object>() { + + @Override + public Object load( + @Nonnull ResourceLocation key) + throws Exception { + IResource ir = Minecraft.getMinecraft() + .getResourceManager() + .getResource( + key); + if (ir.hasMetadata()) + return ir.getMetadata( + "colors"); + // return a dummy + // object because + // LoadingCache + // doesn't like null + return NOT_FOUND; + } + }); private static final GT_GUIColorOverride FALLBACK = new GT_GUIColorOverride(); private ColorsMetadataSection cmSection; diff --git a/src/main/java/gregtech/api/gui/GT_GUIContainerMetaTile_Machine.java b/src/main/java/gregtech/api/gui/GT_GUIContainerMetaTile_Machine.java index 7e072f0fe6..e44b4f0cbc 100644 --- a/src/main/java/gregtech/api/gui/GT_GUIContainerMetaTile_Machine.java +++ b/src/main/java/gregtech/api/gui/GT_GUIContainerMetaTile_Machine.java @@ -181,8 +181,7 @@ public class GT_GUIContainerMetaTile_Machine extends GT_GUIContainer implements */ protected void setupTooltips() { if (mContainer.mTileEntity.getMetaTileEntity() instanceof IConfigurationCircuitSupport) { - IConfigurationCircuitSupport ccs = (IConfigurationCircuitSupport) mContainer.mTileEntity - .getMetaTileEntity(); + IConfigurationCircuitSupport ccs = (IConfigurationCircuitSupport) mContainer.mTileEntity.getMetaTileEntity(); if (ccs.allowSelectCircuit()) addToolTip( new GT_GuiSlotTooltip( mContainer.getSlot(ccs.getCircuitGUISlot()), @@ -234,8 +233,7 @@ public class GT_GUIContainerMetaTile_Machine extends GT_GUIContainer implements @Override protected void onMouseWheel(int mx, int my, int delta) { if (mContainer.mTileEntity.getMetaTileEntity() instanceof IConfigurationCircuitSupport) { - IConfigurationCircuitSupport ccs = (IConfigurationCircuitSupport) mContainer.mTileEntity - .getMetaTileEntity(); + IConfigurationCircuitSupport ccs = (IConfigurationCircuitSupport) mContainer.mTileEntity.getMetaTileEntity(); Slot slotCircuit = mContainer.getSlot(ccs.getCircuitGUISlot()); if (slotCircuit != null && func_146978_c(slotCircuit.xDisplayPosition, slotCircuit.yDisplayPosition, 16, 16, mx, my)) { diff --git a/src/main/java/gregtech/api/gui/GT_GUIContainer_BasicMachine.java b/src/main/java/gregtech/api/gui/GT_GUIContainer_BasicMachine.java index 43943b49cb..899d8331bc 100644 --- a/src/main/java/gregtech/api/gui/GT_GUIContainer_BasicMachine.java +++ b/src/main/java/gregtech/api/gui/GT_GUIContainer_BasicMachine.java @@ -138,8 +138,8 @@ public class GT_GUIContainer_BasicMachine extends GT_GUIContainerMetaTile_Machin }, mTooltipCache.getData( STALLED_STUTTERING_TOOLTIP, - StatCollector - .translateToLocal(POWER_SOURCE_KEY + (machine.isSteampowered() ? "steam" : "power"))))); + StatCollector.translateToLocal( + POWER_SOURCE_KEY + (machine.isSteampowered() ? "steam" : "power"))))); } /** diff --git a/src/main/java/gregtech/api/gui/GT_GUIContainer_BasicTank.java b/src/main/java/gregtech/api/gui/GT_GUIContainer_BasicTank.java index 28075cabdb..99478667ec 100644 --- a/src/main/java/gregtech/api/gui/GT_GUIContainer_BasicTank.java +++ b/src/main/java/gregtech/api/gui/GT_GUIContainer_BasicTank.java @@ -22,8 +22,11 @@ public class GT_GUIContainer_BasicTank extends GT_GUIContainerMetaTile_Machine { @Override protected void drawGuiContainerForegroundLayer(int mouseX, int mouseY) { - fontRendererObj - .drawString(StatCollector.translateToLocal("container.inventory"), 8, ySize - 96 + 2, textColorTitle); + fontRendererObj.drawString( + StatCollector.translateToLocal("container.inventory"), + 8, + ySize - 96 + 2, + textColorTitle); fontRendererObj.drawString(mName, 8, 6, textColorTitle); if (mContainer != null) { fontRendererObj.drawString("Liquid Amount", 10, 20, textColor); diff --git a/src/main/java/gregtech/api/gui/GT_GUIContainer_MultiMachine.java b/src/main/java/gregtech/api/gui/GT_GUIContainer_MultiMachine.java index f2ea91571a..d9c971482c 100644 --- a/src/main/java/gregtech/api/gui/GT_GUIContainer_MultiMachine.java +++ b/src/main/java/gregtech/api/gui/GT_GUIContainer_MultiMachine.java @@ -64,7 +64,8 @@ public class GT_GUIContainer_MultiMachine extends GT_GUIContainerMetaTile_Machin if (index == 0) { current_line.append(str); } else { - current_line.append(" ").append(str); + current_line.append(" ") + .append(str); } index++; } @@ -93,33 +94,48 @@ public class GT_GUIContainer_MultiMachine extends GT_GUIContainerMetaTile_Machin } if ((mContainer.mDisplayErrorCode & 8) != 0) { - fontRendererObj - .drawString(GT_Utility.trans("135", "Platings are dented."), 10, line_counter, textColor); + fontRendererObj.drawString( + GT_Utility.trans("135", "Platings are dented."), + 10, + line_counter, + textColor); line_counter += 8; } if ((mContainer.mDisplayErrorCode & 16) != 0) { - fontRendererObj - .drawString(GT_Utility.trans("136", "Circuitry burned out."), 10, line_counter, textColor); + fontRendererObj.drawString( + GT_Utility.trans("136", "Circuitry burned out."), + 10, + line_counter, + textColor); line_counter += 8; } if ((mContainer.mDisplayErrorCode & 32) != 0) { - fontRendererObj - .drawString(GT_Utility.trans("137", "That doesn't belong there."), 10, line_counter, textColor); + fontRendererObj.drawString( + GT_Utility.trans("137", "That doesn't belong there."), + 10, + line_counter, + textColor); line_counter += 8; } if ((mContainer.mDisplayErrorCode & 64) != 0) { - fontRendererObj - .drawString(GT_Utility.trans("138", "Incomplete Structure."), 10, line_counter, textColor); + fontRendererObj.drawString( + GT_Utility.trans("138", "Incomplete Structure."), + 10, + line_counter, + textColor); line_counter += 8; } if (mContainer.mDisplayErrorCode == 0) { if (mContainer.mActive == 0) { - fontRendererObj - .drawString(GT_Utility.trans("139", "Hit with Soft Mallet"), 10, line_counter, textColor); + fontRendererObj.drawString( + GT_Utility.trans("139", "Hit with Soft Mallet"), + 10, + line_counter, + textColor); line_counter += 8; fontRendererObj.drawString( GT_Utility.trans("140", "to (re-)start the Machine"), @@ -127,15 +143,22 @@ public class GT_GUIContainer_MultiMachine extends GT_GUIContainerMetaTile_Machin line_counter, textColor); line_counter += 8; - fontRendererObj - .drawString(GT_Utility.trans("141", "if it doesn't start."), 10, line_counter, textColor); + fontRendererObj.drawString( + GT_Utility.trans("141", "if it doesn't start."), + 10, + line_counter, + textColor); } else { - fontRendererObj - .drawString(GT_Utility.trans("142", "Running perfectly."), 10, line_counter, textColor); + fontRendererObj.drawString( + GT_Utility.trans("142", "Running perfectly."), + 10, + line_counter, + textColor); } line_counter += 8; if (mContainer.mTileEntity.getMetaTileEntity() instanceof GT_MetaTileEntity_DrillerBase) { - ItemStack tItem = mContainer.mTileEntity.getMetaTileEntity().getStackInSlot(1); + ItemStack tItem = mContainer.mTileEntity.getMetaTileEntity() + .getStackInSlot(1); if (tItem == null || !GT_Utility.areStacksEqual(tItem, GT_ModHandler.getIC2Item("miningPipe", 1L))) { fontRendererObj.drawString( @@ -145,7 +168,8 @@ public class GT_GUIContainer_MultiMachine extends GT_GUIContainerMetaTile_Machin textColor); } } else if (mContainer.mTileEntity.getMetaTileEntity() instanceof GT_MetaTileEntity_LargeTurbine) { - ItemStack tItem = mContainer.mTileEntity.getMetaTileEntity().getStackInSlot(1); + ItemStack tItem = mContainer.mTileEntity.getMetaTileEntity() + .getStackInSlot(1); if (tItem == null || !(tItem.getItem() == GT_MetaGenerated_Tool_01.INSTANCE && tItem.getItemDamage() >= 170 && tItem.getItemDamage() <= 177)) { diff --git a/src/main/java/gregtech/api/gui/GT_GUIDialogSelectItem.java b/src/main/java/gregtech/api/gui/GT_GUIDialogSelectItem.java index f2352fb53d..fed1671484 100644 --- a/src/main/java/gregtech/api/gui/GT_GUIDialogSelectItem.java +++ b/src/main/java/gregtech/api/gui/GT_GUIDialogSelectItem.java @@ -28,8 +28,11 @@ public class GT_GUIDialogSelectItem extends GT_GUIScreen { // all slots not including btnCurrent private final List<GT_GuiFakeItemButton> slots = new ArrayList<>(); // the currently selected slot content - private final GT_GuiFakeItemButton btnCurrent = new GT_GuiFakeItemButton(this, 8, 25, GT_GuiIcon.SLOT_DARKGRAY) - .setMimicSlot(true); + private final GT_GuiFakeItemButton btnCurrent = new GT_GuiFakeItemButton( + this, + 8, + 25, + GT_GuiIcon.SLOT_DARKGRAY).setMimicSlot(true); private final boolean noDeselect; private int selected; private int scroll = 0; @@ -77,8 +80,8 @@ public class GT_GUIDialogSelectItem extends GT_GUIScreen { for (int i = 0; i < rows; i++) { for (int j = 0; j < cols; j++) { slots.add( - new GT_GuiFakeItemButton(this, 8 + 18 * j, 44 + 18 * i, GT_GuiIcon.SLOT_GRAY) - .setMimicSlot(true)); + new GT_GuiFakeItemButton(this, 8 + 18 * j, 44 + 18 * i, GT_GuiIcon.SLOT_GRAY).setMimicSlot( + true)); } } @@ -123,25 +126,29 @@ public class GT_GUIDialogSelectItem extends GT_GUIScreen { public void mouseClicked(int x, int y, int button) { int mx = x - guiLeft, my = y - guiTop; if (button == 0) { - if (btnCurrent.getBounds().contains(mx, my)) { + if (btnCurrent.getBounds() + .contains(mx, my)) { ensureSelectedDisplayed(); return; } for (int i = 0, slotsSize = slots.size(); i < slotsSize; i++) { GT_GuiFakeItemButton slot = slots.get(i); - if (slot.getBounds().contains(mx, my)) { + if (slot.getBounds() + .contains(mx, my)) { setSelected(slotIndexToListIndex(i)); return; } } } else if (button == 1 && getSelected() >= 0) { - if (btnCurrent.getBounds().contains(mx, my)) { + if (btnCurrent.getBounds() + .contains(mx, my)) { setSelected(UNSELECTED); return; } GT_GuiFakeItemButton slot = getSlot(listIndexToSlotIndex(getSelected())); - if (slot != null && slot.getBounds().contains(mx, my)) { + if (slot != null && slot.getBounds() + .contains(mx, my)) { setSelected(UNSELECTED); } } @@ -156,8 +163,9 @@ public class GT_GUIDialogSelectItem extends GT_GUIScreen { private void fillSlots() { for (int i = 0, j = scroll * cols; i < slots.size(); i++, j++) { - slots.get(i).setItem(getCandidate(j)) - .setBgIcon(j == getSelected() ? GT_GuiIcon.SLOT_DARKGRAY : GT_GuiIcon.SLOT_GRAY); + slots.get(i) + .setItem(getCandidate(j)) + .setBgIcon(j == getSelected() ? GT_GuiIcon.SLOT_DARKGRAY : GT_GuiIcon.SLOT_GRAY); } } diff --git a/src/main/java/gregtech/api/gui/GT_Slot_Armor.java b/src/main/java/gregtech/api/gui/GT_Slot_Armor.java index be9b0e5e00..9b4b81a31d 100644 --- a/src/main/java/gregtech/api/gui/GT_Slot_Armor.java +++ b/src/main/java/gregtech/api/gui/GT_Slot_Armor.java @@ -23,6 +23,8 @@ public class GT_Slot_Armor extends Slot { @Override public boolean isItemValid(ItemStack aStack) { - return aStack != null && aStack.getItem() != null && aStack.getItem().isValidArmor(aStack, mArmorType, mPlayer); + return aStack != null && aStack.getItem() != null + && aStack.getItem() + .isValidArmor(aStack, mArmorType, mPlayer); } } diff --git a/src/main/java/gregtech/api/gui/modularui/FallbackableSteamTexture.java b/src/main/java/gregtech/api/gui/modularui/FallbackableSteamTexture.java index f242aff0ed..43b7210758 100644 --- a/src/main/java/gregtech/api/gui/modularui/FallbackableSteamTexture.java +++ b/src/main/java/gregtech/api/gui/modularui/FallbackableSteamTexture.java @@ -55,7 +55,9 @@ public class FallbackableSteamTexture { useFallback = true; } else { try { - Minecraft.getMinecraft().getResourceManager().getResource(candidate.get(steamVariant).location); + Minecraft.getMinecraft() + .getResourceManager() + .getResource(candidate.get(steamVariant).location); useFallback = false; } catch (IOException e) { useFallback = true; diff --git a/src/main/java/gregtech/api/gui/modularui/GT_UIInfos.java b/src/main/java/gregtech/api/gui/modularui/GT_UIInfos.java index 32ed6442c1..e068cd967e 100644 --- a/src/main/java/gregtech/api/gui/modularui/GT_UIInfos.java +++ b/src/main/java/gregtech/api/gui/modularui/GT_UIInfos.java @@ -36,28 +36,46 @@ public class GT_UIInfos { * Do NOT run {@link UIBuilder#build} on-the-fly, otherwise MP client won't register UIs. Instead, store to static * field, just like {@link #GTTileEntityDefaultUI}. Such mistake can be easily overlooked by testing only SP. */ - public static final Function<ContainerConstructor, UIInfo<?, ?>> GTTileEntityUIFactory = containerConstructor -> UIBuilder - .of().container((player, world, x, y, z) -> { - TileEntity te = world.getTileEntity(x, y, z); - if (te instanceof ITileWithModularUI) { - return createTileEntityContainer( - player, - ((ITileWithModularUI) te)::createWindow, - te::markDirty, - containerConstructor); - } - return null; - }).gui(((player, world, x, y, z) -> { - if (!world.isRemote) return null; - TileEntity te = world.getTileEntity(x, y, z); - if (te instanceof ITileWithModularUI) { - return createTileEntityGuiContainer( - player, - ((ITileWithModularUI) te)::createWindow, - containerConstructor); - } - return null; - })).build(); + public static final Function<ContainerConstructor, UIInfo<?, ?>> GTTileEntityUIFactory = containerConstructor -> UIBuilder.of() + .container( + (player, world, + x, + y, + z) -> { + TileEntity te = world.getTileEntity( + x, + y, + z); + if (te instanceof ITileWithModularUI) { + return createTileEntityContainer( + player, + ((ITileWithModularUI) te)::createWindow, + te::markDirty, + containerConstructor); + } + return null; + }) + .gui( + ((player, + world, + x, + y, + z) -> { + if (!world.isRemote) + return null; + TileEntity te = world.getTileEntity( + x, + y, + z); + if (te instanceof ITileWithModularUI) { + return createTileEntityGuiContainer( + player, + ((ITileWithModularUI) te)::createWindow, + containerConstructor); + } + return null; + })) + .build(); private static final UIInfo<?, ?> GTTileEntityDefaultUI = GTTileEntityUIFactory.apply(ModularUIContainer::new); @@ -66,31 +84,36 @@ public class GT_UIInfos { static { for (byte i = 0; i < ForgeDirection.VALID_DIRECTIONS.length; i++) { final byte side = i; - coverUI.put(side, UIBuilder.of().container((player, world, x, y, z) -> { - final TileEntity te = world.getTileEntity(x, y, z); - if (!(te instanceof ICoverable)) return null; - final ICoverable gtTileEntity = (ICoverable) te; - GT_CoverBehaviorBase<?> cover = gtTileEntity.getCoverBehaviorAtSideNew(side); - return createCoverContainer( - player, - cover::createWindow, - te::markDirty, - gtTileEntity.getCoverIDAtSide(side), - side, - gtTileEntity); - }).gui((player, world, x, y, z) -> { - if (!world.isRemote) return null; - final TileEntity te = world.getTileEntity(x, y, z); - if (!(te instanceof ICoverable)) return null; - final ICoverable gtTileEntity = (ICoverable) te; - final GT_CoverBehaviorBase<?> cover = gtTileEntity.getCoverBehaviorAtSideNew(side); - return createCoverGuiContainer( - player, - cover::createWindow, - gtTileEntity.getCoverIDAtSide(side), - side, - gtTileEntity); - }).build()); + coverUI.put( + side, + UIBuilder.of() + .container((player, world, x, y, z) -> { + final TileEntity te = world.getTileEntity(x, y, z); + if (!(te instanceof ICoverable)) return null; + final ICoverable gtTileEntity = (ICoverable) te; + GT_CoverBehaviorBase<?> cover = gtTileEntity.getCoverBehaviorAtSideNew(side); + return createCoverContainer( + player, + cover::createWindow, + te::markDirty, + gtTileEntity.getCoverIDAtSide(side), + side, + gtTileEntity); + }) + .gui((player, world, x, y, z) -> { + if (!world.isRemote) return null; + final TileEntity te = world.getTileEntity(x, y, z); + if (!(te instanceof ICoverable)) return null; + final ICoverable gtTileEntity = (ICoverable) te; + final GT_CoverBehaviorBase<?> cover = gtTileEntity.getCoverBehaviorAtSideNew(side); + return createCoverGuiContainer( + player, + cover::createWindow, + gtTileEntity.getCoverIDAtSide(side), + side, + gtTileEntity); + }) + .build()); } } @@ -121,12 +144,13 @@ public class GT_UIInfos { tileEntity), (EntityPlayerMP) player); - coverUI.get(side).open( - player, - tileEntity.getWorld(), - tileEntity.getXCoord(), - tileEntity.getYCoord(), - tileEntity.getZCoord()); + coverUI.get(side) + .open( + player, + tileEntity.getWorld(), + tileEntity.getXCoord(), + tileEntity.getYCoord(), + tileEntity.getZCoord()); } /** diff --git a/src/main/java/gregtech/api/gui/modularui/GT_UITextures.java b/src/main/java/gregtech/api/gui/modularui/GT_UITextures.java index a1d1be02ac..590b14af29 100644 --- a/src/main/java/gregtech/api/gui/modularui/GT_UITextures.java +++ b/src/main/java/gregtech/api/gui/modularui/GT_UITextures.java @@ -13,23 +13,48 @@ public class GT_UITextures { public static final UITexture TRANSPARENT = UITexture.fullImage(MODID, "gui/picture/transparent"); - public static final AdaptableUITexture BACKGROUND_SINGLEBLOCK_DEFAULT = AdaptableUITexture - .of(MODID, "gui/background/singleblock_default", 176, 166, 4); - public static final SteamTexture BACKGROUND_STEAM = SteamTexture - .adaptableTexture(MODID, "gui/background/%s", 176, 166, 4); - public static final UITexture BACKGROUND_FUSION_COMPUTER = UITexture - .fullImage(MODID, "gui/background/fusion_computer"); - public static final AdaptableUITexture BACKGROUND_TEXT_FIELD = AdaptableUITexture - .of(MODID, "gui/background/text_field", 142, 28, 1); - public static final AdaptableUITexture BACKGROUND_TEXT_FIELD_LIGHT_GRAY = AdaptableUITexture - .of(MODID, "gui/background/text_field_light_gray", 61, 12, 1); + public static final AdaptableUITexture BACKGROUND_SINGLEBLOCK_DEFAULT = AdaptableUITexture.of( + MODID, + "gui/background/singleblock_default", + 176, + 166, + 4); + public static final SteamTexture BACKGROUND_STEAM = SteamTexture.adaptableTexture( + MODID, + "gui/background/%s", + 176, + 166, + 4); + public static final UITexture BACKGROUND_FUSION_COMPUTER = UITexture.fullImage( + MODID, + "gui/background/fusion_computer"); + public static final AdaptableUITexture BACKGROUND_TEXT_FIELD = AdaptableUITexture.of( + MODID, + "gui/background/text_field", + 142, + 28, + 1); + public static final AdaptableUITexture BACKGROUND_TEXT_FIELD_LIGHT_GRAY = AdaptableUITexture.of( + MODID, + "gui/background/text_field_light_gray", + 61, + 12, + 1); public static final SteamTexture SLOT_ITEM_STEAM = SteamTexture.fullImage(MODID, "gui/slot/item_%s"); public static final SteamTexture SLOT_FLUID_STEAM = SteamTexture.fullImage(MODID, "gui/slot/fluid_%s"); - public static final AdaptableUITexture SLOT_DARK_GRAY = AdaptableUITexture - .of(MODID, "gui/slot/dark_gray", 18, 18, 1); - public static final AdaptableUITexture SLOT_MAINTENANCE = AdaptableUITexture - .of(MODID, "gui/slot/maintenance", 20, 20, 1); + public static final AdaptableUITexture SLOT_DARK_GRAY = AdaptableUITexture.of( + MODID, + "gui/slot/dark_gray", + 18, + 18, + 1); + public static final AdaptableUITexture SLOT_MAINTENANCE = AdaptableUITexture.of( + MODID, + "gui/slot/maintenance", + 20, + 20, + 1); public static final AdaptableUITexture SLOT_UPLIFTED = AdaptableUITexture.of(MODID, "gui/slot/uplifted", 18, 18, 1); public static final UITexture OVERLAY_SLOT_ARROW_ME = UITexture.fullImage(MODID, "gui/overlay_slot/arrow_me"); @@ -41,53 +66,67 @@ public class GT_UITextures { public static final UITexture OVERLAY_SLOT_BOX = UITexture.fullImage(MODID, "gui/overlay_slot/box"); public static final UITexture OVERLAY_SLOT_BOXED = UITexture.fullImage(MODID, "gui/overlay_slot/boxed"); public static final UITexture OVERLAY_SLOT_CANISTER = UITexture.fullImage(MODID, "gui/overlay_slot/canister"); - public static final SteamTexture OVERLAY_SLOT_CANISTER_STEAM = SteamTexture - .fullImage(MODID, "gui/overlay_slot/canister_%s"); + public static final SteamTexture OVERLAY_SLOT_CANISTER_STEAM = SteamTexture.fullImage( + MODID, + "gui/overlay_slot/canister_%s"); public static final UITexture OVERLAY_SLOT_CANNER = UITexture.fullImage(MODID, "gui/overlay_slot/canner"); public static final UITexture OVERLAY_SLOT_CAULDRON = UITexture.fullImage(MODID, "gui/overlay_slot/cauldron"); public static final UITexture OVERLAY_SLOT_CENTRIFUGE = UITexture.fullImage(MODID, "gui/overlay_slot/centrifuge"); - public static final UITexture OVERLAY_SLOT_CENTRIFUGE_FLUID = UITexture - .fullImage(MODID, "gui/overlay_slot/centrifuge_fluid"); - public static final SteamTexture OVERLAY_SLOT_CENTRIFUGE_STEAM = SteamTexture - .fullImage(MODID, "gui/overlay_slot/centrifuge_%s"); + public static final UITexture OVERLAY_SLOT_CENTRIFUGE_FLUID = UITexture.fullImage( + MODID, + "gui/overlay_slot/centrifuge_fluid"); + public static final SteamTexture OVERLAY_SLOT_CENTRIFUGE_STEAM = SteamTexture.fullImage( + MODID, + "gui/overlay_slot/centrifuge_%s"); public static final UITexture OVERLAY_SLOT_CHARGER = UITexture.fullImage(MODID, "gui/overlay_slot/charger"); - public static final UITexture OVERLAY_SLOT_CHARGER_FLUID = UITexture - .fullImage(MODID, "gui/overlay_slot/charger_fluid"); + public static final UITexture OVERLAY_SLOT_CHARGER_FLUID = UITexture.fullImage( + MODID, + "gui/overlay_slot/charger_fluid"); public static final UITexture OVERLAY_SLOT_CIRCUIT = UITexture.fullImage(MODID, "gui/overlay_slot/circuit"); - public static final SteamTexture OVERLAY_SLOT_COAL_STEAM = SteamTexture - .fullImage(MODID, "gui/overlay_slot/coal_%s"); + public static final SteamTexture OVERLAY_SLOT_COAL_STEAM = SteamTexture.fullImage( + MODID, + "gui/overlay_slot/coal_%s"); public static final UITexture OVERLAY_SLOT_COMPRESSOR = UITexture.fullImage(MODID, "gui/overlay_slot/compressor"); - public static final SteamTexture OVERLAY_SLOT_COMPRESSOR_STEAM = SteamTexture - .fullImage(MODID, "gui/overlay_slot/compressor_%s"); + public static final SteamTexture OVERLAY_SLOT_COMPRESSOR_STEAM = SteamTexture.fullImage( + MODID, + "gui/overlay_slot/compressor_%s"); public static final UITexture OVERLAY_SLOT_CRUSHED_ORE = UITexture.fullImage(MODID, "gui/overlay_slot/crushed_ore"); - public static final SteamTexture OVERLAY_SLOT_CRUSHED_ORE_STEAM = SteamTexture - .fullImage(MODID, "gui/overlay_slot/crushed_ore_%s"); - public static final UITexture OVERLAY_SLOT_CUTTER_SLICED = UITexture - .fullImage(MODID, "gui/overlay_slot/cutter_sliced"); + public static final SteamTexture OVERLAY_SLOT_CRUSHED_ORE_STEAM = SteamTexture.fullImage( + MODID, + "gui/overlay_slot/crushed_ore_%s"); + public static final UITexture OVERLAY_SLOT_CUTTER_SLICED = UITexture.fullImage( + MODID, + "gui/overlay_slot/cutter_sliced"); public static final UITexture OVERLAY_SLOT_DATA_ORB = UITexture.fullImage(MODID, "gui/overlay_slot/data_orb"); public static final UITexture OVERLAY_SLOT_DATA_STICK = UITexture.fullImage(MODID, "gui/overlay_slot/data_stick"); public static final UITexture OVERLAY_SLOT_DUST = UITexture.fullImage(MODID, "gui/overlay_slot/dust"); - public static final SteamTexture OVERLAY_SLOT_DUST_STEAM = SteamTexture - .fullImage(MODID, "gui/overlay_slot/dust_%s"); - public static final SteamTexture OVERLAY_SLOT_BLOCK_STEAM = SteamTexture - .fullImage(MODID, "gui/overlay_slot/block_%s"); + public static final SteamTexture OVERLAY_SLOT_DUST_STEAM = SteamTexture.fullImage( + MODID, + "gui/overlay_slot/dust_%s"); + public static final SteamTexture OVERLAY_SLOT_BLOCK_STEAM = SteamTexture.fullImage( + MODID, + "gui/overlay_slot/block_%s"); public static final UITexture OVERLAY_SLOT_EXPLOSIVE = UITexture.fullImage(MODID, "gui/overlay_slot/explosive"); - public static final UITexture OVERLAY_SLOT_EXTRUDER_SHAPE = UITexture - .fullImage(MODID, "gui/overlay_slot/extruder_shape"); + public static final UITexture OVERLAY_SLOT_EXTRUDER_SHAPE = UITexture.fullImage( + MODID, + "gui/overlay_slot/extruder_shape"); public static final UITexture OVERLAY_SLOT_FURNACE = UITexture.fullImage(MODID, "gui/overlay_slot/furnace"); - public static final SteamTexture OVERLAY_SLOT_FURNACE_STEAM = SteamTexture - .fullImage(MODID, "gui/overlay_slot/furnace_%s"); + public static final SteamTexture OVERLAY_SLOT_FURNACE_STEAM = SteamTexture.fullImage( + MODID, + "gui/overlay_slot/furnace_%s"); public static final UITexture OVERLAY_SLOT_GEM = UITexture.fullImage(MODID, "gui/overlay_slot/gem"); public static final UITexture OVERLAY_SLOT_HAMMER = UITexture.fullImage(MODID, "gui/overlay_slot/hammer"); - public static final SteamTexture OVERLAY_SLOT_HAMMER_STEAM = SteamTexture - .fullImage(MODID, "gui/overlay_slot/hammer_%s"); + public static final SteamTexture OVERLAY_SLOT_HAMMER_STEAM = SteamTexture.fullImage( + MODID, + "gui/overlay_slot/hammer_%s"); public static final UITexture OVERLAY_SLOT_HEATER_1 = UITexture.fullImage(MODID, "gui/overlay_slot/heater_1"); public static final UITexture OVERLAY_SLOT_HEATER_2 = UITexture.fullImage(MODID, "gui/overlay_slot/heater_2"); public static final UITexture OVERLAY_SLOT_IMPLOSION = UITexture.fullImage(MODID, "gui/overlay_slot/implosion"); public static final UITexture OVERLAY_SLOT_IN = UITexture.fullImage(MODID, "gui/overlay_slot/in"); public static final SteamTexture OVERLAY_SLOT_IN_STEAM = SteamTexture.fullImage(MODID, "gui/overlay_slot/in_%s"); - public static final SteamTexture OVERLAY_SLOT_INGOT_STEAM = SteamTexture - .fullImage(MODID, "gui/overlay_slot/ingot_%s"); + public static final SteamTexture OVERLAY_SLOT_INGOT_STEAM = SteamTexture.fullImage( + MODID, + "gui/overlay_slot/ingot_%s"); public static final UITexture OVERLAY_SLOT_INT_CIRCUIT = UITexture.fullImage(MODID, "gui/overlay_slot/int_circuit"); public static final UITexture OVERLAY_SLOT_LENS = UITexture.fullImage(MODID, "gui/overlay_slot/lens"); public static final UITexture OVERLAY_SLOT_MICROSCOPE = UITexture.fullImage(MODID, "gui/overlay_slot/microscope"); @@ -98,8 +137,9 @@ public class GT_UITextures { public static final UITexture OVERLAY_SLOT_OUT = UITexture.fullImage(MODID, "gui/overlay_slot/out"); public static final SteamTexture OVERLAY_SLOT_OUT_STEAM = SteamTexture.fullImage(MODID, "gui/overlay_slot/out_%s"); public static final UITexture OVERLAY_SLOT_PAGE_BLANK = UITexture.fullImage(MODID, "gui/overlay_slot/page_blank"); - public static final UITexture OVERLAY_SLOT_PAGE_PRINTED = UITexture - .fullImage(MODID, "gui/overlay_slot/page_printed"); + public static final UITexture OVERLAY_SLOT_PAGE_PRINTED = UITexture.fullImage( + MODID, + "gui/overlay_slot/page_printed"); public static final UITexture OVERLAY_SLOT_PRESS_1 = UITexture.fullImage(MODID, "gui/overlay_slot/press_1"); public static final UITexture OVERLAY_SLOT_PRESS_2 = UITexture.fullImage(MODID, "gui/overlay_slot/press_2"); public static final UITexture OVERLAY_SLOT_PRESS_3 = UITexture.fullImage(MODID, "gui/overlay_slot/press_3"); @@ -107,8 +147,9 @@ public class GT_UITextures { public static final UITexture OVERLAY_SLOT_ROD_1 = UITexture.fullImage(MODID, "gui/overlay_slot/rod_1"); public static final UITexture OVERLAY_SLOT_ROD_2 = UITexture.fullImage(MODID, "gui/overlay_slot/rod_2"); public static final UITexture OVERLAY_SLOT_SLICE_SHAPE = UITexture.fullImage(MODID, "gui/overlay_slot/slice_shape"); - public static final UITexture OVERLAY_SLOT_SLICER_SLICED = UITexture - .fullImage(MODID, "gui/overlay_slot/slicer_sliced"); + public static final UITexture OVERLAY_SLOT_SLICER_SLICED = UITexture.fullImage( + MODID, + "gui/overlay_slot/slicer_sliced"); public static final UITexture OVERLAY_SLOT_SQUARE = UITexture.fullImage(MODID, "gui/overlay_slot/square"); public static final UITexture OVERLAY_SLOT_UUA = UITexture.fullImage(MODID, "gui/overlay_slot/uua"); public static final UITexture OVERLAY_SLOT_UUM = UITexture.fullImage(MODID, "gui/overlay_slot/uum"); @@ -117,53 +158,70 @@ public class GT_UITextures { public static final UITexture OVERLAY_SLOT_WIREMILL = UITexture.fullImage(MODID, "gui/overlay_slot/wiremill"); public static final UITexture OVERLAY_SLOT_WRENCH = UITexture.fullImage(MODID, "gui/overlay_slot/wrench"); public static final UITexture[] OVERLAY_SLOTS_NUMBER = IntStream.range(0, 12) - .mapToObj(i -> UITexture.fullImage(MODID, "gui/overlay_slot/number_" + i)).collect(Collectors.toList()) - .toArray(new UITexture[0]); + .mapToObj( + i -> UITexture.fullImage( + MODID, + "gui/overlay_slot/number_" + i)) + .collect(Collectors.toList()) + .toArray(new UITexture[0]); public static final UITexture PROGRESSBAR_ARROW = UITexture.fullImage(MODID, "gui/progressbar/arrow"); - public static final SteamTexture PROGRESSBAR_ARROW_STEAM = SteamTexture - .fullImage(MODID, "gui/progressbar/arrow_%s"); - public static final SteamTexture PROGRESSBAR_ARROW_2_STEAM = SteamTexture - .fullImage(MODID, "gui/progressbar/arrow_2_%s"); - public static final UITexture PROGRESSBAR_ARROW_MULTIPLE = UITexture - .fullImage(MODID, "gui/progressbar/arrow_multiple"); + public static final SteamTexture PROGRESSBAR_ARROW_STEAM = SteamTexture.fullImage( + MODID, + "gui/progressbar/arrow_%s"); + public static final SteamTexture PROGRESSBAR_ARROW_2_STEAM = SteamTexture.fullImage( + MODID, + "gui/progressbar/arrow_2_%s"); + public static final UITexture PROGRESSBAR_ARROW_MULTIPLE = UITexture.fullImage( + MODID, + "gui/progressbar/arrow_multiple"); public static final UITexture PROGRESSBAR_ASSEMBLE = UITexture.fullImage(MODID, "gui/progressbar/assemble"); - public static final UITexture PROGRESSBAR_ASSEMBLY_LINE_1 = UITexture - .fullImage(MODID, "gui/progressbar/assemblyline_1"); - public static final UITexture PROGRESSBAR_ASSEMBLY_LINE_2 = UITexture - .fullImage(MODID, "gui/progressbar/assemblyline_2"); - public static final UITexture PROGRESSBAR_ASSEMBLY_LINE_3 = UITexture - .fullImage(MODID, "gui/progressbar/assemblyline_3"); + public static final UITexture PROGRESSBAR_ASSEMBLY_LINE_1 = UITexture.fullImage( + MODID, + "gui/progressbar/assemblyline_1"); + public static final UITexture PROGRESSBAR_ASSEMBLY_LINE_2 = UITexture.fullImage( + MODID, + "gui/progressbar/assemblyline_2"); + public static final UITexture PROGRESSBAR_ASSEMBLY_LINE_3 = UITexture.fullImage( + MODID, + "gui/progressbar/assemblyline_3"); public static final UITexture PROGRESSBAR_BATH = UITexture.fullImage(MODID, "gui/progressbar/bath"); public static final UITexture PROGRESSBAR_BENDING = UITexture.fullImage(MODID, "gui/progressbar/bending"); - public static final SteamTexture PROGRESSBAR_BOILER_EMPTY_STEAM = SteamTexture - .fullImage(MODID, "gui/progressbar/boiler_empty_%s"); + public static final SteamTexture PROGRESSBAR_BOILER_EMPTY_STEAM = SteamTexture.fullImage( + MODID, + "gui/progressbar/boiler_empty_%s"); public static final UITexture PROGRESSBAR_BOILER_HEAT = UITexture.fullImage(MODID, "gui/progressbar/boiler_heat"); public static final UITexture PROGRESSBAR_BOILER_STEAM = UITexture.fullImage(MODID, "gui/progressbar/boiler_steam"); public static final UITexture PROGRESSBAR_BOILER_WATER = UITexture.fullImage(MODID, "gui/progressbar/boiler_water"); public static final UITexture PROGRESSBAR_CANNER = UITexture.fullImage(MODID, "gui/progressbar/canner"); - public static final UITexture PROGRESSBAR_CIRCUIT_ASSEMBLER = UITexture - .fullImage(MODID, "gui/progressbar/circuit_assembler"); + public static final UITexture PROGRESSBAR_CIRCUIT_ASSEMBLER = UITexture.fullImage( + MODID, + "gui/progressbar/circuit_assembler"); public static final UITexture PROGRESSBAR_COMPRESS = UITexture.fullImage(MODID, "gui/progressbar/compress"); - public static final SteamTexture PROGRESSBAR_COMPRESS_STEAM = SteamTexture - .fullImage(MODID, "gui/progressbar/compress_%s"); + public static final SteamTexture PROGRESSBAR_COMPRESS_STEAM = SteamTexture.fullImage( + MODID, + "gui/progressbar/compress_%s"); public static final UITexture PROGRESSBAR_CUT = UITexture.fullImage(MODID, "gui/progressbar/cut"); public static final UITexture PROGRESSBAR_EXTRACT = UITexture.fullImage(MODID, "gui/progressbar/extract"); - public static final SteamTexture PROGRESSBAR_EXTRACT_STEAM = SteamTexture - .fullImage(MODID, "gui/progressbar/extract_%s"); + public static final SteamTexture PROGRESSBAR_EXTRACT_STEAM = SteamTexture.fullImage( + MODID, + "gui/progressbar/extract_%s"); public static final UITexture PROGRESSBAR_EXTRUDE = UITexture.fullImage(MODID, "gui/progressbar/extrude"); public static final SteamTexture PROGRESSBAR_FUEL_STEAM = SteamTexture.fullImage(MODID, "gui/progressbar/fuel_%s"); public static final UITexture PROGRESSBAR_HAMMER = UITexture.fullImage(MODID, "gui/progressbar/hammer"); public static final UITexture PROGRESSBAR_HAMMER_BASE = UITexture.fullImage(MODID, "gui/progressbar/hammer_base"); - public static final SteamTexture PROGRESSBAR_HAMMER_STEAM = SteamTexture - .fullImage(MODID, "gui/progressbar/hammer_%s"); - public static final SteamTexture PROGRESSBAR_HAMMER_BASE_STEAM = SteamTexture - .fullImage(MODID, "gui/progressbar/hammer_base_%s"); + public static final SteamTexture PROGRESSBAR_HAMMER_STEAM = SteamTexture.fullImage( + MODID, + "gui/progressbar/hammer_%s"); + public static final SteamTexture PROGRESSBAR_HAMMER_BASE_STEAM = SteamTexture.fullImage( + MODID, + "gui/progressbar/hammer_base_%s"); public static final UITexture PROGRESSBAR_LATHE = UITexture.fullImage(MODID, "gui/progressbar/lathe"); public static final UITexture PROGRESSBAR_LATHE_BASE = UITexture.fullImage(MODID, "gui/progressbar/lathe_base"); public static final UITexture PROGRESSBAR_MACERATE = UITexture.fullImage(MODID, "gui/progressbar/macerate"); - public static final SteamTexture PROGRESSBAR_MACERATE_STEAM = SteamTexture - .fullImage(MODID, "gui/progressbar/macerate_%s"); + public static final SteamTexture PROGRESSBAR_MACERATE_STEAM = SteamTexture.fullImage( + MODID, + "gui/progressbar/macerate_%s"); public static final UITexture PROGRESSBAR_MAGNET = UITexture.fullImage(MODID, "gui/progressbar/magnet"); public static final UITexture PROGRESSBAR_MIXER = UITexture.fullImage(MODID, "gui/progressbar/mixer"); public static final UITexture PROGRESSBAR_RECYCLE = UITexture.fullImage(MODID, "gui/progressbar/recycle"); @@ -176,80 +234,138 @@ public class GT_UITextures { public static final UITexture TAB_COVER_HIGHLIGHT = UITexture.fullImage(MODID, "gui/tab/cover_highlight"); public static final UITexture TAB_COVER_DISABLED = UITexture.fullImage(MODID, "gui/tab/cover_disabled"); public static final SteamTexture TAB_COVER_STEAM_NORMAL = SteamTexture.fullImage(MODID, "gui/tab/cover_%s_normal"); - public static final SteamTexture TAB_COVER_STEAM_HIGHLIGHT = SteamTexture - .fullImage(MODID, "gui/tab/cover_%s_highlight"); - public static final SteamTexture TAB_COVER_STEAM_DISABLED = SteamTexture - .fullImage(MODID, "gui/tab/cover_%s_disabled"); + public static final SteamTexture TAB_COVER_STEAM_HIGHLIGHT = SteamTexture.fullImage( + MODID, + "gui/tab/cover_%s_highlight"); + public static final SteamTexture TAB_COVER_STEAM_DISABLED = SteamTexture.fullImage( + MODID, + "gui/tab/cover_%s_disabled"); public static final AdaptableUITexture TAB_TITLE = AdaptableUITexture.of(MODID, "gui/tab/title", 28, 28, 4); - public static final AdaptableUITexture TAB_TITLE_DARK = AdaptableUITexture - .of(MODID, "gui/tab/title_dark", 28, 28, 4); - public static final SteamTexture TAB_TITLE_STEAM = SteamTexture - .adaptableTexture(MODID, "gui/tab/title_%s", 28, 28, 4); - public static final SteamTexture TAB_TITLE_DARK_STEAM = SteamTexture - .adaptableTexture(MODID, "gui/tab/title_dark_%s", 28, 28, 4); - public static final AdaptableUITexture TAB_TITLE_ANGULAR = AdaptableUITexture - .of(MODID, "gui/tab/title_angular", 28, 28, 4); - public static final SteamTexture TAB_TITLE_ANGULAR_STEAM = SteamTexture - .adaptableTexture(MODID, "gui/tab/title_angular_%s", 28, 28, 4); + public static final AdaptableUITexture TAB_TITLE_DARK = AdaptableUITexture.of( + MODID, + "gui/tab/title_dark", + 28, + 28, + 4); + public static final SteamTexture TAB_TITLE_STEAM = SteamTexture.adaptableTexture( + MODID, + "gui/tab/title_%s", + 28, + 28, + 4); + public static final SteamTexture TAB_TITLE_DARK_STEAM = SteamTexture.adaptableTexture( + MODID, + "gui/tab/title_dark_%s", + 28, + 28, + 4); + public static final AdaptableUITexture TAB_TITLE_ANGULAR = AdaptableUITexture.of( + MODID, + "gui/tab/title_angular", + 28, + 28, + 4); + public static final SteamTexture TAB_TITLE_ANGULAR_STEAM = SteamTexture.adaptableTexture( + MODID, + "gui/tab/title_angular_%s", + 28, + 28, + 4); public static final UITexture BUTTON_STANDARD = AdaptableUITexture.of(MODID, "gui/button/standard", 18, 18, 1); - public static final UITexture BUTTON_STANDARD_DISABLED = AdaptableUITexture - .of(MODID, "gui/button/standard_disabled", 18, 18, 1); - public static final UITexture BUTTON_STANDARD_TOGGLE = AdaptableUITexture - .of(MODID, "gui/button/standard_toggle", 18, 18, 1); - public static final UITexture BUTTON_STANDARD_TOGGLE_DISABLED = AdaptableUITexture - .of(MODID, "gui/button/standard_toggle_disabled", 18, 18, 1); + public static final UITexture BUTTON_STANDARD_DISABLED = AdaptableUITexture.of( + MODID, + "gui/button/standard_disabled", + 18, + 18, + 1); + public static final UITexture BUTTON_STANDARD_TOGGLE = AdaptableUITexture.of( + MODID, + "gui/button/standard_toggle", + 18, + 18, + 1); + public static final UITexture BUTTON_STANDARD_TOGGLE_DISABLED = AdaptableUITexture.of( + MODID, + "gui/button/standard_toggle_disabled", + 18, + 18, + 1); public static final UITexture BUTTON_COVER_NORMAL = UITexture.fullImage(MODID, "gui/button/cover_normal"); - public static final UITexture BUTTON_COVER_NORMAL_HOVERED = UITexture - .fullImage(MODID, "gui/button/cover_normal_hovered"); - public static final UITexture BUTTON_COVER_NORMAL_DISABLED = UITexture - .fullImage(MODID, "gui/button/cover_normal_disabled"); + public static final UITexture BUTTON_COVER_NORMAL_HOVERED = UITexture.fullImage( + MODID, + "gui/button/cover_normal_hovered"); + public static final UITexture BUTTON_COVER_NORMAL_DISABLED = UITexture.fullImage( + MODID, + "gui/button/cover_normal_disabled"); public static final UITexture OVERLAY_BUTTON_DISABLE = UITexture.fullImage(MODID, "gui/overlay_button/disable"); - public static final UITexture OVERLAY_BUTTON_REDSTONE_OFF = UITexture - .fullImage(MODID, "gui/overlay_button/redstone_off"); - public static final UITexture OVERLAY_BUTTON_REDSTONE_ON = UITexture - .fullImage(MODID, "gui/overlay_button/redstone_on"); - public static final UITexture OVERLAY_BUTTON_POWER_SWITCH_ON = UITexture - .fullImage(MODID, "gui/overlay_button/power_switch_on"); - public static final UITexture OVERLAY_BUTTON_POWER_SWITCH_OFF = UITexture - .fullImage(MODID, "gui/overlay_button/power_switch_off"); - public static final UITexture OVERLAY_BUTTON_VOID_EXCESS_ON = UITexture - .fullImage(MODID, "gui/overlay_button/void_excess_on"); - public static final UITexture OVERLAY_BUTTON_VOID_EXCESS_ON_DISABLED = UITexture - .fullImage(MODID, "gui/overlay_button/void_excess_on_disabled"); - public static final UITexture OVERLAY_BUTTON_VOID_EXCESS_OFF = UITexture - .fullImage(MODID, "gui/overlay_button/void_excess_off"); - public static final UITexture OVERLAY_BUTTON_VOID_EXCESS_OFF_DISABLED = UITexture - .fullImage(MODID, "gui/overlay_button/void_excess_off_disabled"); - public static final UITexture OVERLAY_BUTTON_INPUT_SEPARATION_ON = UITexture - .fullImage(MODID, "gui/overlay_button/input_separation_on"); - public static final UITexture OVERLAY_BUTTON_INPUT_SEPARATION_ON_DISABLED = UITexture - .fullImage(MODID, "gui/overlay_button/input_separation_on_disabled"); - public static final UITexture OVERLAY_BUTTON_INPUT_SEPARATION_OFF = UITexture - .fullImage(MODID, "gui/overlay_button/input_separation_off"); - public static final UITexture OVERLAY_BUTTON_INPUT_SEPARATION_OFF_DISABLED = UITexture - .fullImage(MODID, "gui/overlay_button/input_separation_off_disabled"); - public static final UITexture OVERLAY_BUTTON_RECIPE_LOCKED = UITexture - .fullImage(MODID, "gui/overlay_button/recipe_locked"); - public static final UITexture OVERLAY_BUTTON_RECIPE_LOCKED_DISABLED = UITexture - .fullImage(MODID, "gui/overlay_button/recipe_locked_disabled"); - public static final UITexture OVERLAY_BUTTON_RECIPE_UNLOCKED = UITexture - .fullImage(MODID, "gui/overlay_button/recipe_unlocked"); - public static final UITexture OVERLAY_BUTTON_RECIPE_UNLOCKED_DISABLED = UITexture - .fullImage(MODID, "gui/overlay_button/recipe_unlocked_disabled"); - public static final UITexture OVERLAY_BUTTON_BATCH_MODE_ON = UITexture - .fullImage(MODID, "gui/overlay_button/batch_mode_on"); - public static final UITexture OVERLAY_BUTTON_BATCH_MODE_ON_DISABLED = UITexture - .fullImage(MODID, "gui/overlay_button/batch_mode_on_disabled"); - public static final UITexture OVERLAY_BUTTON_BATCH_MODE_OFF = UITexture - .fullImage(MODID, "gui/overlay_button/batch_mode_off"); - public static final UITexture OVERLAY_BUTTON_BATCH_MODE_OFF_DISABLED = UITexture - .fullImage(MODID, "gui/overlay_button/batch_mode_off_disabled"); - public static final UITexture OVERLAY_BUTTON_DOWN_TIERING_ON = UITexture - .fullImage(MODID, "gui/overlay_button/down_tiering_on"); - public static final UITexture OVERLAY_BUTTON_DOWN_TIERING_OFF = UITexture - .fullImage(MODID, "gui/overlay_button/down_tiering_off"); + public static final UITexture OVERLAY_BUTTON_REDSTONE_OFF = UITexture.fullImage( + MODID, + "gui/overlay_button/redstone_off"); + public static final UITexture OVERLAY_BUTTON_REDSTONE_ON = UITexture.fullImage( + MODID, + "gui/overlay_button/redstone_on"); + public static final UITexture OVERLAY_BUTTON_POWER_SWITCH_ON = UITexture.fullImage( + MODID, + "gui/overlay_button/power_switch_on"); + public static final UITexture OVERLAY_BUTTON_POWER_SWITCH_OFF = UITexture.fullImage( + MODID, + "gui/overlay_button/power_switch_off"); + public static final UITexture OVERLAY_BUTTON_VOID_EXCESS_ON = UITexture.fullImage( + MODID, + "gui/overlay_button/void_excess_on"); + public static final UITexture OVERLAY_BUTTON_VOID_EXCESS_ON_DISABLED = UITexture.fullImage( + MODID, + "gui/overlay_button/void_excess_on_disabled"); + public static final UITexture OVERLAY_BUTTON_VOID_EXCESS_OFF = UITexture.fullImage( + MODID, + "gui/overlay_button/void_excess_off"); + public static final UITexture OVERLAY_BUTTON_VOID_EXCESS_OFF_DISABLED = UITexture.fullImage( + MODID, + "gui/overlay_button/void_excess_off_disabled"); + public static final UITexture OVERLAY_BUTTON_INPUT_SEPARATION_ON = UITexture.fullImage( + MODID, + "gui/overlay_button/input_separation_on"); + public static final UITexture OVERLAY_BUTTON_INPUT_SEPARATION_ON_DISABLED = UITexture.fullImage( + MODID, + "gui/overlay_button/input_separation_on_disabled"); + public static final UITexture OVERLAY_BUTTON_INPUT_SEPARATION_OFF = UITexture.fullImage( + MODID, + "gui/overlay_button/input_separation_off"); + public static final UITexture OVERLAY_BUTTON_INPUT_SEPARATION_OFF_DISABLED = UITexture.fullImage( + MODID, + "gui/overlay_button/input_separation_off_disabled"); + public static final UITexture OVERLAY_BUTTON_RECIPE_LOCKED = UITexture.fullImage( + MODID, + "gui/overlay_button/recipe_locked"); + public static final UITexture OVERLAY_BUTTON_RECIPE_LOCKED_DISABLED = UITexture.fullImage( + MODID, + "gui/overlay_button/recipe_locked_disabled"); + public static final UITexture OVERLAY_BUTTON_RECIPE_UNLOCKED = UITexture.fullImage( + MODID, + "gui/overlay_button/recipe_unlocked"); + public static final UITexture OVERLAY_BUTTON_RECIPE_UNLOCKED_DISABLED = UITexture.fullImage( + MODID, + "gui/overlay_button/recipe_unlocked_disabled"); + public static final UITexture OVERLAY_BUTTON_BATCH_MODE_ON = UITexture.fullImage( + MODID, + "gui/overlay_button/batch_mode_on"); + public static final UITexture OVERLAY_BUTTON_BATCH_MODE_ON_DISABLED = UITexture.fullImage( + MODID, + "gui/overlay_button/batch_mode_on_disabled"); + public static final UITexture OVERLAY_BUTTON_BATCH_MODE_OFF = UITexture.fullImage( + MODID, + "gui/overlay_button/batch_mode_off"); + public static final UITexture OVERLAY_BUTTON_BATCH_MODE_OFF_DISABLED = UITexture.fullImage( + MODID, + "gui/overlay_button/batch_mode_off_disabled"); + public static final UITexture OVERLAY_BUTTON_DOWN_TIERING_ON = UITexture.fullImage( + MODID, + "gui/overlay_button/down_tiering_on"); + public static final UITexture OVERLAY_BUTTON_DOWN_TIERING_OFF = UITexture.fullImage( + MODID, + "gui/overlay_button/down_tiering_off"); public static final UITexture OVERLAY_BUTTON_CHECKMARK = UITexture.fullImage(MODID, "gui/overlay_button/checkmark"); public static final UITexture OVERLAY_BUTTON_CROSS = UITexture.fullImage(MODID, "gui/overlay_button/cross"); public static final UITexture OVERLAY_BUTTON_WHITELIST = UITexture.fullImage(MODID, "gui/overlay_button/whitelist"); @@ -257,81 +373,110 @@ public class GT_UITextures { public static final UITexture OVERLAY_BUTTON_PROGRESS = UITexture.fullImage(MODID, "gui/overlay_button/progress"); public static final UITexture OVERLAY_BUTTON_EXPORT = UITexture.fullImage(MODID, "gui/overlay_button/export"); public static final UITexture OVERLAY_BUTTON_IMPORT = UITexture.fullImage(MODID, "gui/overlay_button/import"); - public static final UITexture OVERLAY_BUTTON_AUTOOUTPUT_ITEM = UITexture - .fullImage(MODID, "gui/overlay_button/autooutput_item"); - public static final UITexture OVERLAY_BUTTON_AUTOOUTPUT_FLUID = UITexture - .fullImage(MODID, "gui/overlay_button/autooutput_fluid"); - public static final UITexture OVERLAY_BUTTON_ALLOW_INPUT = UITexture - .fullImage(MODID, "gui/overlay_button/allow_input"); - public static final UITexture OVERLAY_BUTTON_AUTOPULL_ME = UITexture - .fullImage(MODID, "gui/overlay_button/auto_pull_me"); - public static final UITexture OVERLAY_BUTTON_AUTOPULL_ME_DISABLED = UITexture - .fullImage(MODID, "gui/overlay_button/auto_pull_me_disabled"); - public static final UITexture OVERLAY_BUTTON_BLOCK_INPUT = UITexture - .fullImage(MODID, "gui/overlay_button/block_input"); - public static final UITexture OVERLAY_BUTTON_ARROW_GREEN_UP = UITexture - .fullImage(MODID, "gui/overlay_button/arrow_green_up"); - public static final UITexture OVERLAY_BUTTON_ARROW_GREEN_DOWN = UITexture - .fullImage(MODID, "gui/overlay_button/arrow_green_down"); + public static final UITexture OVERLAY_BUTTON_AUTOOUTPUT_ITEM = UITexture.fullImage( + MODID, + "gui/overlay_button/autooutput_item"); + public static final UITexture OVERLAY_BUTTON_AUTOOUTPUT_FLUID = UITexture.fullImage( + MODID, + "gui/overlay_button/autooutput_fluid"); + public static final UITexture OVERLAY_BUTTON_ALLOW_INPUT = UITexture.fullImage( + MODID, + "gui/overlay_button/allow_input"); + public static final UITexture OVERLAY_BUTTON_AUTOPULL_ME = UITexture.fullImage( + MODID, + "gui/overlay_button/auto_pull_me"); + public static final UITexture OVERLAY_BUTTON_AUTOPULL_ME_DISABLED = UITexture.fullImage( + MODID, + "gui/overlay_button/auto_pull_me_disabled"); + public static final UITexture OVERLAY_BUTTON_BLOCK_INPUT = UITexture.fullImage( + MODID, + "gui/overlay_button/block_input"); + public static final UITexture OVERLAY_BUTTON_ARROW_GREEN_UP = UITexture.fullImage( + MODID, + "gui/overlay_button/arrow_green_up"); + public static final UITexture OVERLAY_BUTTON_ARROW_GREEN_DOWN = UITexture.fullImage( + MODID, + "gui/overlay_button/arrow_green_down"); public static final UITexture OVERLAY_BUTTON_CYCLIC = UITexture.fullImage(MODID, "gui/overlay_button/cyclic"); - public static final UITexture OVERLAY_BUTTON_EMIT_ENERGY = UITexture - .fullImage(MODID, "gui/overlay_button/emit_energy"); - public static final UITexture OVERLAY_BUTTON_EMIT_REDSTONE = UITexture - .fullImage(MODID, "gui/overlay_button/emit_redstone"); - public static final UITexture OVERLAY_BUTTON_INVERT_REDSTONE = UITexture - .fullImage(MODID, "gui/overlay_button/invert_redstone"); - public static final UITexture OVERLAY_BUTTON_STOCKING_MODE = UITexture - .fullImage(MODID, "gui/overlay_button/stocking_mode"); - public static final UITexture OVERLAY_BUTTON_INVERT_FILTER = UITexture - .fullImage(MODID, "gui/overlay_button/invert_filter"); + public static final UITexture OVERLAY_BUTTON_EMIT_ENERGY = UITexture.fullImage( + MODID, + "gui/overlay_button/emit_energy"); + public static final UITexture OVERLAY_BUTTON_EMIT_REDSTONE = UITexture.fullImage( + MODID, + "gui/overlay_button/emit_redstone"); + public static final UITexture OVERLAY_BUTTON_INVERT_REDSTONE = UITexture.fullImage( + MODID, + "gui/overlay_button/invert_redstone"); + public static final UITexture OVERLAY_BUTTON_STOCKING_MODE = UITexture.fullImage( + MODID, + "gui/overlay_button/stocking_mode"); + public static final UITexture OVERLAY_BUTTON_INVERT_FILTER = UITexture.fullImage( + MODID, + "gui/overlay_button/invert_filter"); public static final UITexture OVERLAY_BUTTON_NBT = UITexture.fullImage(MODID, "gui/overlay_button/nbt"); public static final UITexture OVERLAY_BUTTON_PRINT = UITexture.fullImage(MODID, "gui/overlay_button/print"); public static final UITexture OVERLAY_BUTTON_TRANSPOSE = UITexture.fullImage(MODID, "gui/overlay_button/transpose"); - public static final UITexture OVERLAY_BUTTON_BOUNDING_BOX = UITexture - .fullImage(MODID, "gui/overlay_button/bounding_box"); - public static final UITexture OVERLAY_BUTTON_MINUS_SMALL = UITexture - .fullImage(MODID, "gui/overlay_button/minus_small"); - public static final UITexture OVERLAY_BUTTON_MINUS_LARGE = UITexture - .fullImage(MODID, "gui/overlay_button/minus_large"); - public static final UITexture OVERLAY_BUTTON_PLUS_SMALL = UITexture - .fullImage(MODID, "gui/overlay_button/plus_small"); - public static final UITexture OVERLAY_BUTTON_PLUS_LARGE = UITexture - .fullImage(MODID, "gui/overlay_button/plus_large"); + public static final UITexture OVERLAY_BUTTON_BOUNDING_BOX = UITexture.fullImage( + MODID, + "gui/overlay_button/bounding_box"); + public static final UITexture OVERLAY_BUTTON_MINUS_SMALL = UITexture.fullImage( + MODID, + "gui/overlay_button/minus_small"); + public static final UITexture OVERLAY_BUTTON_MINUS_LARGE = UITexture.fullImage( + MODID, + "gui/overlay_button/minus_large"); + public static final UITexture OVERLAY_BUTTON_PLUS_SMALL = UITexture.fullImage( + MODID, + "gui/overlay_button/plus_small"); + public static final UITexture OVERLAY_BUTTON_PLUS_LARGE = UITexture.fullImage( + MODID, + "gui/overlay_button/plus_large"); public static final UITexture OVERLAY_BUTTON_GATE_AND = UITexture.fullImage(MODID, "gui/overlay_button/gate_and"); public static final UITexture OVERLAY_BUTTON_GATE_NAND = UITexture.fullImage(MODID, "gui/overlay_button/gate_nand"); public static final UITexture OVERLAY_BUTTON_GATE_OR = UITexture.fullImage(MODID, "gui/overlay_button/gate_or"); public static final UITexture OVERLAY_BUTTON_GATE_NOR = UITexture.fullImage(MODID, "gui/overlay_button/gate_nor"); public static final UITexture OVERLAY_BUTTON_ANALOG = UITexture.fullImage(MODID, "gui/overlay_button/analog"); public static final UITexture OVERLAY_BUTTON_LOCK = UITexture.fullImage(MODID, "gui/overlay_button/lock"); - public static final UITexture OVERLAY_BUTTON_INPUT_FROM_OUTPUT_SIDE = UITexture - .fullImage(MODID, "gui/overlay_button/input_from_output_side"); - public static final UITexture OVERLAY_BUTTON_VOID_EXCESS = UITexture - .fullImage(MODID, "gui/overlay_button/void_excess"); + public static final UITexture OVERLAY_BUTTON_INPUT_FROM_OUTPUT_SIDE = UITexture.fullImage( + MODID, + "gui/overlay_button/input_from_output_side"); + public static final UITexture OVERLAY_BUTTON_VOID_EXCESS = UITexture.fullImage( + MODID, + "gui/overlay_button/void_excess"); public static final UITexture OVERLAY_BUTTON_VOID_ALL = UITexture.fullImage(MODID, "gui/overlay_button/void_all"); public static final UITexture OVERLAY_BUTTON_NEI = UITexture.fullImage(MODID, "gui/overlay_button/nei"); /** * Can adjust size as needed. */ - public static final AdaptableUITexture PICTURE_SCREEN_BLACK = AdaptableUITexture - .of(MODID, "gui/picture/screen_black", 16, 16, 2); + public static final AdaptableUITexture PICTURE_SCREEN_BLACK = AdaptableUITexture.of( + MODID, + "gui/picture/screen_black", + 16, + 16, + 2); - public static final UITexture PICTURE_RADIATION_WARNING = UITexture - .fullImage(MODID, "gui/picture/radiation_warning"); - public static final UITexture PICTURE_GT_LOGO_17x17_TRANSPARENT = UITexture - .fullImage(MODID, "gui/picture/gt_logo_17x17_transparent"); - public static final UITexture PICTURE_GT_LOGO_17x17_TRANSPARENT_GRAY = UITexture - .fullImage(MODID, "gui/picture/gt_logo_17x17_transparent_gray"); - public static final SteamTexture PICTURE_GT_LOGO_17x17_TRANSPARENT_STEAM = SteamTexture - .fullImage(MODID, "gui/picture/gt_logo_17x17_transparent_%s"); + public static final UITexture PICTURE_RADIATION_WARNING = UITexture.fullImage( + MODID, + "gui/picture/radiation_warning"); + public static final UITexture PICTURE_GT_LOGO_17x17_TRANSPARENT = UITexture.fullImage( + MODID, + "gui/picture/gt_logo_17x17_transparent"); + public static final UITexture PICTURE_GT_LOGO_17x17_TRANSPARENT_GRAY = UITexture.fullImage( + MODID, + "gui/picture/gt_logo_17x17_transparent_gray"); + public static final SteamTexture PICTURE_GT_LOGO_17x17_TRANSPARENT_STEAM = SteamTexture.fullImage( + MODID, + "gui/picture/gt_logo_17x17_transparent_%s"); public static final UITexture PICTURE_GT_LOGO_18x18 = UITexture.fullImage(MODID, "gui/picture/gt_logo_18x18"); public static final UITexture PICTURE_GT_LOGO_19x19 = UITexture.fullImage(MODID, "gui/picture/gt_logo_19x19"); public static final UITexture PICTURE_INFORMATION = UITexture.fullImage(MODID, "gui/picture/information"); - public static final UITexture PICTURE_STALLED_ELECTRICITY = UITexture - .fullImage(MODID, "gui/picture/stalled_electricity"); + public static final UITexture PICTURE_STALLED_ELECTRICITY = UITexture.fullImage( + MODID, + "gui/picture/stalled_electricity"); public static final UITexture PICTURE_STALLED_STEAM = UITexture.fullImage(MODID, "gui/picture/stalled_steam"); - public static final BiFunction<Integer, Boolean, UITexture> PICTURE_ARROW_22_RED = (width, fromRight) -> UITexture - .partly( + public static final BiFunction<Integer, Boolean, UITexture> PICTURE_ARROW_22_RED = (width, + fromRight) -> UITexture.partly( MODID, "gui/picture/arrow_22_red", 87, @@ -340,8 +485,8 @@ public class GT_UITextures { 0, fromRight ? 87 : width, 22); - public static final BiFunction<Integer, Boolean, UITexture> PICTURE_ARROW_22_BLUE = (width, fromRight) -> UITexture - .partly( + public static final BiFunction<Integer, Boolean, UITexture> PICTURE_ARROW_22_BLUE = (width, + fromRight) -> UITexture.partly( MODID, "gui/picture/arrow_22_blue", 87, @@ -350,8 +495,8 @@ public class GT_UITextures { 0, fromRight ? 87 : width, 22); - public static final BiFunction<Integer, Boolean, UITexture> PICTURE_ARROW_22_WHITE = (width, fromRight) -> UITexture - .partly( + public static final BiFunction<Integer, Boolean, UITexture> PICTURE_ARROW_22_WHITE = (width, + fromRight) -> UITexture.partly( MODID, "gui/picture/arrow_22_white", 87, @@ -360,8 +505,8 @@ public class GT_UITextures { 0, fromRight ? 87 : width, 22); - public static final BiFunction<Integer, Boolean, UITexture> PICTURE_ARROW_24_RED = (width, fromRight) -> UITexture - .partly( + public static final BiFunction<Integer, Boolean, UITexture> PICTURE_ARROW_24_RED = (width, + fromRight) -> UITexture.partly( MODID, "gui/picture/arrow_24_red", 69, @@ -370,8 +515,8 @@ public class GT_UITextures { 0, fromRight ? 69 : width, 24); - public static final BiFunction<Integer, Boolean, UITexture> PICTURE_ARROW_24_BLUE = (width, fromRight) -> UITexture - .partly( + public static final BiFunction<Integer, Boolean, UITexture> PICTURE_ARROW_24_BLUE = (width, + fromRight) -> UITexture.partly( MODID, "gui/picture/arrow_24_blue", 69, @@ -380,8 +525,8 @@ public class GT_UITextures { 0, fromRight ? 69 : width, 24); - public static final BiFunction<Integer, Boolean, UITexture> PICTURE_ARROW_24_WHITE = (width, fromRight) -> UITexture - .partly( + public static final BiFunction<Integer, Boolean, UITexture> PICTURE_ARROW_24_WHITE = (width, + fromRight) -> UITexture.partly( MODID, "gui/picture/arrow_24_white", 69, @@ -395,8 +540,9 @@ public class GT_UITextures { public static final UITexture PICTURE_SLOTS_HOLO_3BY3 = UITexture.fullImage(MODID, "gui/picture/slots_holo_3by3"); public static final UITexture PICTURE_ARROW_DOUBLE = UITexture.fullImage(MODID, "gui/picture/arrow_double"); public static final UITexture PICTURE_SUPER_BUFFER = UITexture.fullImage(MODID, "gui/picture/super_buffer"); - public static final UITexture PICTURE_SQUARE_LIGHT_GRAY = UITexture - .fullImage(MODID, "gui/picture/square_light_gray"); + public static final UITexture PICTURE_SQUARE_LIGHT_GRAY = UITexture.fullImage( + MODID, + "gui/picture/square_light_gray"); public static final UITexture PICTURE_GAUGE = UITexture.fullImage(MODID, "gui/picture/gauge"); public static final UITexture PICTURE_ITEM_IN = UITexture.fullImage(MODID, "gui/picture/item_in"); public static final UITexture PICTURE_ITEM_OUT = UITexture.fullImage(MODID, "gui/picture/item_out"); diff --git a/src/main/java/gregtech/api/gui/modularui/GUITextureSet.java b/src/main/java/gregtech/api/gui/modularui/GUITextureSet.java index 8b6e9f85ec..2799738344 100644 --- a/src/main/java/gregtech/api/gui/modularui/GUITextureSet.java +++ b/src/main/java/gregtech/api/gui/modularui/GUITextureSet.java @@ -28,29 +28,46 @@ public class GUITextureSet { private AdaptableUITexture titleTabAngular; private UITexture gregtechLogo; - public static final GUITextureSet DEFAULT = new GUITextureSet() - .setMainBackground(GT_UITextures.BACKGROUND_SINGLEBLOCK_DEFAULT).setItemSlot(ModularUITextures.ITEM_SLOT) - .setFluidSlot(ModularUITextures.FLUID_SLOT) - .setCoverTab( - GT_UITextures.TAB_COVER_NORMAL, - GT_UITextures.TAB_COVER_HIGHLIGHT, - GT_UITextures.TAB_COVER_DISABLED) - .setTitleTab(GT_UITextures.TAB_TITLE, GT_UITextures.TAB_TITLE_DARK, GT_UITextures.TAB_TITLE_ANGULAR) - .setGregTechLogo(GT_UITextures.PICTURE_GT_LOGO_17x17_TRANSPARENT); - - public static final Function<SteamVariant, GUITextureSet> STEAM = steamVariant -> new GUITextureSet() - .setMainBackground(GT_UITextures.BACKGROUND_STEAM.get(steamVariant)) - .setItemSlot(GT_UITextures.SLOT_ITEM_STEAM.get(steamVariant)) - .setFluidSlot(GT_UITextures.SLOT_FLUID_STEAM.get(steamVariant)) - .setCoverTab( - GT_UITextures.TAB_COVER_STEAM_NORMAL.get(steamVariant), - GT_UITextures.TAB_COVER_STEAM_HIGHLIGHT.get(steamVariant), - GT_UITextures.TAB_COVER_STEAM_DISABLED.get(steamVariant)) - .setTitleTab( - GT_UITextures.TAB_TITLE_STEAM.getAdaptable(steamVariant), - GT_UITextures.TAB_TITLE_DARK_STEAM.getAdaptable(steamVariant), - GT_UITextures.TAB_TITLE_ANGULAR_STEAM.getAdaptable(steamVariant)) - .setGregTechLogo(GT_UITextures.PICTURE_GT_LOGO_17x17_TRANSPARENT_STEAM.get(steamVariant)); + public static final GUITextureSet DEFAULT = new GUITextureSet().setMainBackground( + GT_UITextures.BACKGROUND_SINGLEBLOCK_DEFAULT) + .setItemSlot(ModularUITextures.ITEM_SLOT) + .setFluidSlot(ModularUITextures.FLUID_SLOT) + .setCoverTab( + GT_UITextures.TAB_COVER_NORMAL, + GT_UITextures.TAB_COVER_HIGHLIGHT, + GT_UITextures.TAB_COVER_DISABLED) + .setTitleTab( + GT_UITextures.TAB_TITLE, + GT_UITextures.TAB_TITLE_DARK, + GT_UITextures.TAB_TITLE_ANGULAR) + .setGregTechLogo( + GT_UITextures.PICTURE_GT_LOGO_17x17_TRANSPARENT); + + public static final Function<SteamVariant, GUITextureSet> STEAM = steamVariant -> new GUITextureSet().setMainBackground( + GT_UITextures.BACKGROUND_STEAM.get(steamVariant)) + .setItemSlot( + GT_UITextures.SLOT_ITEM_STEAM.get( + steamVariant)) + .setFluidSlot( + GT_UITextures.SLOT_FLUID_STEAM.get( + steamVariant)) + .setCoverTab( + GT_UITextures.TAB_COVER_STEAM_NORMAL.get( + steamVariant), + GT_UITextures.TAB_COVER_STEAM_HIGHLIGHT.get( + steamVariant), + GT_UITextures.TAB_COVER_STEAM_DISABLED.get( + steamVariant)) + .setTitleTab( + GT_UITextures.TAB_TITLE_STEAM.getAdaptable( + steamVariant), + GT_UITextures.TAB_TITLE_DARK_STEAM.getAdaptable( + steamVariant), + GT_UITextures.TAB_TITLE_ANGULAR_STEAM.getAdaptable( + steamVariant)) + .setGregTechLogo( + GT_UITextures.PICTURE_GT_LOGO_17x17_TRANSPARENT_STEAM.get( + steamVariant)); public GUITextureSet() {} diff --git a/src/main/java/gregtech/api/gui/widgets/GT_GuiCoverTabLine.java b/src/main/java/gregtech/api/gui/widgets/GT_GuiCoverTabLine.java index 639b402856..5cbee74335 100644 --- a/src/main/java/gregtech/api/gui/widgets/GT_GuiCoverTabLine.java +++ b/src/main/java/gregtech/api/gui/widgets/GT_GuiCoverTabLine.java @@ -106,7 +106,8 @@ public class GT_GuiCoverTabLine extends GT_GuiTabLine { * @param cover */ private void addCoverToTabs(byte side, ItemStack cover) { - final boolean enabled = this.tile.getCoverBehaviorAtSideNew(side).hasCoverGUI(); + final boolean enabled = this.tile.getCoverBehaviorAtSideNew(side) + .hasCoverGUI(); this.setTab(side, cover, null, getTooltipForCoverTab(side, cover, enabled)); this.setTabEnabled(side, enabled); } @@ -159,7 +160,8 @@ public class GT_GuiCoverTabLine extends GT_GuiTabLine { return false; } for (int i = 0; i < tabLine.mTabs.length; i++) { - if (tabLine.mTabs[i] != null && tabLine.mTabs[i].getBounds().intersects(neiSlotArea)) { + if (tabLine.mTabs[i] != null && tabLine.mTabs[i].getBounds() + .intersects(neiSlotArea)) { return true; } } diff --git a/src/main/java/gregtech/api/gui/widgets/GT_GuiFakeItemButton.java b/src/main/java/gregtech/api/gui/widgets/GT_GuiFakeItemButton.java index bfeb84d762..6d9b1c5db3 100644 --- a/src/main/java/gregtech/api/gui/widgets/GT_GuiFakeItemButton.java +++ b/src/main/java/gregtech/api/gui/widgets/GT_GuiFakeItemButton.java @@ -116,12 +116,14 @@ public class GT_GuiFakeItemButton implements IGuiScreen.IGuiElement { GL11.glPushAttrib(GL11.GL_ENABLE_BIT); GL11.glEnable(GL12.GL_RESCALE_NORMAL); } - gui.getItemRenderer().renderItemAndEffectIntoGUI( - gui.getFontRenderer(), - Minecraft.getMinecraft().getTextureManager(), - item, - xPosition, - yPosition); + gui.getItemRenderer() + .renderItemAndEffectIntoGUI( + gui.getFontRenderer(), + Minecraft.getMinecraft() + .getTextureManager(), + item, + xPosition, + yPosition); if (item.getItem() instanceof ItemBlock) GL11.glPopAttrib(); } diff --git a/src/main/java/gregtech/api/gui/widgets/GT_GuiTab.java b/src/main/java/gregtech/api/gui/widgets/GT_GuiTab.java index 661ed81fce..a434be47d3 100644 --- a/src/main/java/gregtech/api/gui/widgets/GT_GuiTab.java +++ b/src/main/java/gregtech/api/gui/widgets/GT_GuiTab.java @@ -130,12 +130,14 @@ public class GT_GuiTab { GL11.glEnable(GL12.GL_RESCALE_NORMAL); } int margin = (bounds.height - SLOT_SIZE); - gui.getItemRenderer().renderItemAndEffectIntoGUI( - gui.getFontRenderer(), - Minecraft.getMinecraft().getTextureManager(), - item, - bounds.x + (this.flipHorizontally ? 0 : margin), - bounds.y + margin); + gui.getItemRenderer() + .renderItemAndEffectIntoGUI( + gui.getFontRenderer(), + Minecraft.getMinecraft() + .getTextureManager(), + item, + bounds.x + (this.flipHorizontally ? 0 : margin), + bounds.y + margin); if (item.getItem() instanceof ItemBlock) GL11.glPopAttrib(); diff --git a/src/main/java/gregtech/api/gui/widgets/GT_GuiTabLine.java b/src/main/java/gregtech/api/gui/widgets/GT_GuiTabLine.java index cb94a81dfa..9caf51cd4b 100644 --- a/src/main/java/gregtech/api/gui/widgets/GT_GuiTabLine.java +++ b/src/main/java/gregtech/api/gui/widgets/GT_GuiTabLine.java @@ -220,7 +220,8 @@ public class GT_GuiTabLine { */ public void onMouseClicked(int mouseX, int mouseY, int mouseButton) { for (int tabId = 0; tabId < mTabs.length; tabId++) { - if (mTabs[tabId] != null && mTabs[tabId].getBounds().contains(mouseX, mouseY)) { + if (mTabs[tabId] != null && mTabs[tabId].getBounds() + .contains(mouseX, mouseY)) { tabClicked(tabId, mouseButton); return; } diff --git a/src/main/java/gregtech/api/gui/widgets/GT_GuiTooltipManager.java b/src/main/java/gregtech/api/gui/widgets/GT_GuiTooltipManager.java index a74f5adda5..81566de014 100644 --- a/src/main/java/gregtech/api/gui/widgets/GT_GuiTooltipManager.java +++ b/src/main/java/gregtech/api/gui/widgets/GT_GuiTooltipManager.java @@ -49,7 +49,9 @@ public class GT_GuiTooltipManager { for (GT_GuiTooltip tip : tips) { // Give the tooltip the opportunity to decide whether they should be enabled tip.onTick(); - if (tip.enabled && (!tip.isDelayed() || mouseStopped > DELAY) && tip.getBounds().contains(mouseX, mouseY)) { + if (tip.enabled && (!tip.isDelayed() || mouseStopped > DELAY) + && tip.getBounds() + .contains(mouseX, mouseY)) { tip.updateText(); drawTooltip(tip, mouseX, mouseY, render); break; @@ -64,7 +66,8 @@ public class GT_GuiTooltipManager { if (mouseX > render.getGuiLeft() + render.getXSize() / 2) { int maxWidth = 0; for (String s : text) { - int w = render.getFontRenderer().getStringWidth(s); + int w = render.getFontRenderer() + .getStringWidth(s); if (w > maxWidth) { maxWidth = w; } diff --git a/src/main/java/gregtech/api/interfaces/IGlobalWirelessEnergy.java b/src/main/java/gregtech/api/interfaces/IGlobalWirelessEnergy.java index 8bb0ed87aa..970b536a2c 100644 --- a/src/main/java/gregtech/api/interfaces/IGlobalWirelessEnergy.java +++ b/src/main/java/gregtech/api/interfaces/IGlobalWirelessEnergy.java @@ -25,7 +25,10 @@ public interface IGlobalWirelessEnergy { // tick of a machine being placed only. default void strongCheckOrAddUser(EntityPlayer user) { - strongCheckOrAddUser(user.getUniqueID().toString(), user.getDisplayName()); + strongCheckOrAddUser( + user.getUniqueID() + .toString(), + user.getDisplayName()); } default void strongCheckOrAddUser(UUID user_uuid, String user_name) { @@ -42,7 +45,8 @@ public interface IGlobalWirelessEnergy { // If the username linked to the users fixed uuid is not equal to their current name then remove it. // This indicates that their username has changed. - if (!(GlobalEnergyName.getOrDefault(user_uuid, "").equals(user_name))) { + if (!(GlobalEnergyName.getOrDefault(user_uuid, "") + .equals(user_name))) { String old_name = GlobalEnergyName.get(user_uuid); GlobalEnergyName.remove(old_name); } @@ -141,7 +145,8 @@ public interface IGlobalWirelessEnergy { default String processInitialSettings(final IGregTechTileEntity machine) { // UUID and username of the owner. - final String UUID = machine.getOwnerUuid().toString(); + final String UUID = machine.getOwnerUuid() + .toString(); final String name = machine.getOwnerName(); strongCheckOrAddUser(UUID, name); diff --git a/src/main/java/gregtech/api/interfaces/IHatchElement.java b/src/main/java/gregtech/api/interfaces/IHatchElement.java index 254d9562c2..5b825880ae 100644 --- a/src/main/java/gregtech/api/interfaces/IHatchElement.java +++ b/src/main/java/gregtech/api/interfaces/IHatchElement.java @@ -59,21 +59,35 @@ public interface IHatchElement<T> { default <T2 extends T> IStructureElement<T2> newAny(int aCasingIndex, int aDot) { if (aCasingIndex < 0 || aDot < 0) throw new IllegalArgumentException(); - return GT_StructureUtility.<T2>buildHatchAdder().anyOf(this).casingIndex(aCasingIndex).dot(aDot) - .continueIfSuccess().build(); + return GT_StructureUtility.<T2>buildHatchAdder() + .anyOf(this) + .casingIndex(aCasingIndex) + .dot(aDot) + .continueIfSuccess() + .build(); } default <T2 extends T> IStructureElement<T2> newAny(int aCasingIndex, int aDot, ForgeDirection... allowedFacings) { if (aCasingIndex < 0 || aDot < 0) throw new IllegalArgumentException(); - return GT_StructureUtility.<T2>buildHatchAdder().anyOf(this).casingIndex(aCasingIndex).dot(aDot) - .continueIfSuccess().allowOnly(allowedFacings).build(); + return GT_StructureUtility.<T2>buildHatchAdder() + .anyOf(this) + .casingIndex(aCasingIndex) + .dot(aDot) + .continueIfSuccess() + .allowOnly(allowedFacings) + .build(); } default <T2 extends T> IStructureElement<T2> newAny(int aCasingIndex, int aDot, BiPredicate<? super T2, ? super IGregTechTileEntity> aShouldSkip) { if (aCasingIndex < 0 || aDot < 0 || aShouldSkip == null) throw new IllegalArgumentException(); - return GT_StructureUtility.<T2>buildHatchAdder().anyOf(this).casingIndex(aCasingIndex).dot(aDot) - .shouldSkip(aShouldSkip).continueIfSuccess().build(); + return GT_StructureUtility.<T2>buildHatchAdder() + .anyOf(this) + .casingIndex(aCasingIndex) + .dot(aDot) + .shouldSkip(aShouldSkip) + .continueIfSuccess() + .build(); } default <T2 extends T> IHatchElement<T2> or(IHatchElement<? super T2> fallback) { @@ -95,13 +109,18 @@ class HatchElementEither<T> implements IHatchElement<T> { @Override public List<? extends Class<? extends IMetaTileEntity>> mteClasses() { if (mMteClasses == null) mMteClasses = ImmutableList.<Class<? extends IMetaTileEntity>>builder() - .addAll(first.mteClasses()).addAll(second.mteClasses()).build(); + .addAll(first.mteClasses()) + .addAll(second.mteClasses()) + .build(); return mMteClasses; } @Override public IGT_HatchAdder<? super T> adder() { - return ((t, te, i) -> first.adder().apply(t, te, i) || second.adder().apply(t, te, i)); + return ((t, te, i) -> first.adder() + .apply(t, te, i) + || second.adder() + .apply(t, te, i)); } @Override diff --git a/src/main/java/gregtech/api/interfaces/metatileentity/IMetaTileEntityItemPipe.java b/src/main/java/gregtech/api/interfaces/metatileentity/IMetaTileEntityItemPipe.java index b60088a41b..bc80eea1ad 100644 --- a/src/main/java/gregtech/api/interfaces/metatileentity/IMetaTileEntityItemPipe.java +++ b/src/main/java/gregtech/api/interfaces/metatileentity/IMetaTileEntityItemPipe.java @@ -66,9 +66,10 @@ public interface IMetaTileEntityItemPipe extends IMetaTileEntity { continue; oppositeSide = GT_Utility.getOppositeSide(side); if (aSuckItems) { - if (aBaseMetaTileEntity.getCoverInfoAtSide(side).letsItemsIn(-2)) { - final IGregTechTileEntity tItemPipe = aBaseMetaTileEntity - .getIGregTechTileEntityAtSide(side); + if (aBaseMetaTileEntity.getCoverInfoAtSide(side) + .letsItemsIn(-2)) { + final IGregTechTileEntity tItemPipe = aBaseMetaTileEntity.getIGregTechTileEntityAtSide( + side); if (aBaseMetaTileEntity.getColorization() >= 0) { final byte tColor = tItemPipe.getColorization(); if (tColor >= 0 && tColor != aBaseMetaTileEntity.getColorization()) { @@ -78,7 +79,8 @@ public interface IMetaTileEntityItemPipe extends IMetaTileEntity { if (tItemPipe instanceof BaseMetaPipeEntity) { final IMetaTileEntity tMetaTileEntity = tItemPipe.getMetaTileEntity(); if (tMetaTileEntity instanceof IMetaTileEntityItemPipe - && tItemPipe.getCoverInfoAtSide(oppositeSide).letsItemsOut(-2)) { + && tItemPipe.getCoverInfoAtSide(oppositeSide) + .letsItemsOut(-2)) { scanPipes( (IMetaTileEntityItemPipe) tMetaTileEntity, aMap, @@ -89,9 +91,10 @@ public interface IMetaTileEntityItemPipe extends IMetaTileEntity { } } } else { - if (aBaseMetaTileEntity.getCoverInfoAtSide(side).letsItemsOut(-2)) { - final IGregTechTileEntity tItemPipe = aBaseMetaTileEntity - .getIGregTechTileEntityAtSide(side); + if (aBaseMetaTileEntity.getCoverInfoAtSide(side) + .letsItemsOut(-2)) { + final IGregTechTileEntity tItemPipe = aBaseMetaTileEntity.getIGregTechTileEntityAtSide( + side); if (tItemPipe != null) { if (aBaseMetaTileEntity.getColorization() >= 0) { final byte tColor = tItemPipe.getColorization(); @@ -102,7 +105,8 @@ public interface IMetaTileEntityItemPipe extends IMetaTileEntity { if (tItemPipe instanceof BaseMetaPipeEntity) { final IMetaTileEntity tMetaTileEntity = tItemPipe.getMetaTileEntity(); if (tMetaTileEntity instanceof IMetaTileEntityItemPipe - && tItemPipe.getCoverInfoAtSide(oppositeSide).letsItemsIn(-2)) { + && tItemPipe.getCoverInfoAtSide(oppositeSide) + .letsItemsIn(-2)) { scanPipes( (IMetaTileEntityItemPipe) tMetaTileEntity, aMap, diff --git a/src/main/java/gregtech/api/interfaces/tileentity/IColoredTileEntity.java b/src/main/java/gregtech/api/interfaces/tileentity/IColoredTileEntity.java index 3a17df4717..d79367d252 100644 --- a/src/main/java/gregtech/api/interfaces/tileentity/IColoredTileEntity.java +++ b/src/main/java/gregtech/api/interfaces/tileentity/IColoredTileEntity.java @@ -21,7 +21,7 @@ public interface IColoredTileEntity { * @return Actual color shown on GUI */ default int getGUIColorization() { - return GT_Util - .getRGBInt((getColorization() != -1 ? Dyes.get(getColorization()) : Dyes.MACHINE_METAL).getRGBA()); + return GT_Util.getRGBInt( + (getColorization() != -1 ? Dyes.get(getColorization()) : Dyes.MACHINE_METAL).getRGBA()); } } diff --git a/src/main/java/gregtech/api/interfaces/tileentity/IEnergyConnected.java b/src/main/java/gregtech/api/interfaces/tileentity/IEnergyConnected.java index 92d2482014..37a7d2fc5c 100644 --- a/src/main/java/gregtech/api/interfaces/tileentity/IEnergyConnected.java +++ b/src/main/java/gregtech/api/interfaces/tileentity/IEnergyConnected.java @@ -86,19 +86,25 @@ public interface IEnergyConnected extends IColoredTileEntity { final byte tColor = ((IEnergyConnected) tTileEntity).getColorization(); if (tColor >= 0 && tColor != aEmitter.getColorization()) continue; } - rUsedAmperes += ((IEnergyConnected) tTileEntity) - .injectEnergyUnits(j, aVoltage, aAmperage - rUsedAmperes); + rUsedAmperes += ((IEnergyConnected) tTileEntity).injectEnergyUnits( + j, + aVoltage, + aAmperage - rUsedAmperes); } else if (tTileEntity instanceof IEnergySink) { - if (((IEnergySink) tTileEntity) - .acceptsEnergyFrom((TileEntity) aEmitter, ForgeDirection.getOrientation(j))) { + if (((IEnergySink) tTileEntity).acceptsEnergyFrom( + (TileEntity) aEmitter, + ForgeDirection.getOrientation(j))) { while (aAmperage > rUsedAmperes && ((IEnergySink) tTileEntity).getDemandedEnergy() > 0 - && ((IEnergySink) tTileEntity) - .injectEnergy(ForgeDirection.getOrientation(j), aVoltage, aVoltage) < aVoltage) + && ((IEnergySink) tTileEntity).injectEnergy( + ForgeDirection.getOrientation(j), + aVoltage, + aVoltage) < aVoltage) rUsedAmperes++; } } else if (GregTech_API.mOutputRF && tTileEntity instanceof IEnergyReceiver) { - final ForgeDirection tDirection = ForgeDirection.getOrientation(i).getOpposite(); + final ForgeDirection tDirection = ForgeDirection.getOrientation(i) + .getOpposite(); final int rfOut = GT_Utility.safeInt(aVoltage * GregTech_API.mEUtoRF / 100); if (((IEnergyReceiver) tTileEntity).receiveEnergy(tDirection, rfOut, true) == rfOut) { ((IEnergyReceiver) tTileEntity).receiveEnergy(tDirection, rfOut, false); diff --git a/src/main/java/gregtech/api/interfaces/tileentity/IExperimentalEnergyTileEntity.java b/src/main/java/gregtech/api/interfaces/tileentity/IExperimentalEnergyTileEntity.java index 8eb481f150..119a1af207 100644 --- a/src/main/java/gregtech/api/interfaces/tileentity/IExperimentalEnergyTileEntity.java +++ b/src/main/java/gregtech/api/interfaces/tileentity/IExperimentalEnergyTileEntity.java @@ -87,25 +87,32 @@ public interface IExperimentalEnergyTileEntity extends IColoredTileEntity, IHasW byte tColor = ((IExperimentalEnergyTileEntity) tTileEntity).getColorization(); if (tColor >= 0 && tColor != aEmitter.getColorization()) continue; } - rUsedSecondary += ((IExperimentalEnergyTileEntity) tTileEntity) - .injectEnergy(aEnergyType, j, aPrimary, aSecondary - rUsedSecondary); + rUsedSecondary += ((IExperimentalEnergyTileEntity) tTileEntity).injectEnergy( + aEnergyType, + j, + aPrimary, + aSecondary - rUsedSecondary); } else if (IC_ENERGY && aEnergyType == SubTag.ENERGY_ELECTRICITY && tTileEntity instanceof IEnergySink) { - if (((IEnergySink) tTileEntity) - .acceptsEnergyFrom((TileEntity) aEmitter, ForgeDirection.getOrientation(j))) { + if (((IEnergySink) tTileEntity).acceptsEnergyFrom( + (TileEntity) aEmitter, + ForgeDirection.getOrientation(j))) { while (aSecondary > rUsedSecondary && ((IEnergySink) tTileEntity).getDemandedEnergy() > 0 - && ((IEnergySink) tTileEntity) - .injectEnergy(ForgeDirection.getOrientation(j), aPrimary, aPrimary) - < aPrimary) + && ((IEnergySink) tTileEntity).injectEnergy( + ForgeDirection.getOrientation(j), + aPrimary, + aPrimary) < aPrimary) rUsedSecondary++; } } else if (RF_ENERGY && aEnergyType == SubTag.ENERGY_REDSTONE_FLUX && tTileEntity instanceof IEnergyReceiver && ((IEnergyReceiver) tTileEntity).canConnectEnergy(ForgeDirection.getOrientation(j))) { - rUsedSecondary += ((IEnergyReceiver) tTileEntity) - .receiveEnergy(ForgeDirection.getOrientation(j), (int) aSecondary, false); + rUsedSecondary += ((IEnergyReceiver) tTileEntity).receiveEnergy( + ForgeDirection.getOrientation(j), + (int) aSecondary, + false); } } return rUsedSecondary; diff --git a/src/main/java/gregtech/api/items/GT_Block_LongDistancePipe.java b/src/main/java/gregtech/api/items/GT_Block_LongDistancePipe.java index 1226520eff..3830ec6e52 100644 --- a/src/main/java/gregtech/api/items/GT_Block_LongDistancePipe.java +++ b/src/main/java/gregtech/api/items/GT_Block_LongDistancePipe.java @@ -118,7 +118,9 @@ public class GT_Block_LongDistancePipe extends GT_Generic_Block { public void getSubBlocks(Item aItem, CreativeTabs aCreativeTab, List aList) { for (int i = 0; i < 3; i++) { ItemStack aStack = new ItemStack(aItem, 1, i); - if (!aStack.getDisplayName().contains(".name")) aList.add(aStack); + if (!aStack.getDisplayName() + .contains(".name")) + aList.add(aStack); } } } diff --git a/src/main/java/gregtech/api/items/GT_EnergyArmor_Item.java b/src/main/java/gregtech/api/items/GT_EnergyArmor_Item.java index c31ba0cc82..d9c164f3ab 100644 --- a/src/main/java/gregtech/api/items/GT_EnergyArmor_Item.java +++ b/src/main/java/gregtech/api/items/GT_EnergyArmor_Item.java @@ -116,8 +116,10 @@ public class GT_EnergyArmor_Item extends ItemArmor implements ISpecialArmor { } if (!aPlayer.worldObj.isRemote && (mSpecials & 4) != 0) { - if (GT_ModHandler.canUseElectricItem(aStack, 50000) && aPlayer.getFoodStats().needFood()) { - aPlayer.getFoodStats().addStats(1, 0.0F); + if (GT_ModHandler.canUseElectricItem(aStack, 50000) && aPlayer.getFoodStats() + .needFood()) { + aPlayer.getFoodStats() + .addStats(1, 0.0F); GT_ModHandler.useElectricItem(aStack, 50000, aPlayer); } } @@ -296,8 +298,13 @@ public class GT_EnergyArmor_Item extends ItemArmor implements ISpecialArmor { if (armor != null && armor.getItem() == this && (mSpecials & 2) != 0) { int distanceFactor = (int) event.distance - 3; int energyCost = (this.mDamageEnergyCost * distanceFactor) / 4; - if (energyCost <= GT_ModHandler - .dischargeElectricItem(armor, Integer.MAX_VALUE, Integer.MAX_VALUE, true, true, true)) { + if (energyCost <= GT_ModHandler.dischargeElectricItem( + armor, + Integer.MAX_VALUE, + Integer.MAX_VALUE, + true, + true, + true)) { GT_ModHandler.dischargeElectricItem(armor, energyCost, Integer.MAX_VALUE, true, false, true); event.setCanceled(true); break; @@ -313,10 +320,15 @@ public class GT_EnergyArmor_Item extends ItemArmor implements ISpecialArmor { return new ISpecialArmor.ArmorProperties( (source == DamageSource.fall && (mSpecials & 2) != 0) ? 10 : 0, getBaseAbsorptionRatio() * mArmorAbsorbtionPercentage, - mDamageEnergyCost > 0 ? 25 - * GT_ModHandler - .dischargeElectricItem(armor, Integer.MAX_VALUE, Integer.MAX_VALUE, true, true, true) - / mDamageEnergyCost : 0); + mDamageEnergyCost > 0 + ? 25 * GT_ModHandler.dischargeElectricItem( + armor, + Integer.MAX_VALUE, + Integer.MAX_VALUE, + true, + true, + true) / mDamageEnergyCost + : 0); } @Override @@ -327,8 +339,13 @@ public class GT_EnergyArmor_Item extends ItemArmor implements ISpecialArmor { @Override public void damageArmor(EntityLivingBase entity, ItemStack itemStack, DamageSource source, int damage, int slotIndex) { - GT_ModHandler - .dischargeElectricItem(itemStack, damage * mDamageEnergyCost, Integer.MAX_VALUE, true, false, true); + GT_ModHandler.dischargeElectricItem( + itemStack, + damage * mDamageEnergyCost, + Integer.MAX_VALUE, + true, + false, + true); } private double getBaseAbsorptionRatio() { diff --git a/src/main/java/gregtech/api/items/GT_Generic_Item.java b/src/main/java/gregtech/api/items/GT_Generic_Item.java index 2f1e642e34..b8a348144c 100644 --- a/src/main/java/gregtech/api/items/GT_Generic_Item.java +++ b/src/main/java/gregtech/api/items/GT_Generic_Item.java @@ -49,8 +49,10 @@ public class GT_Generic_Item extends Item implements IProjectileItem { super(); mName = "gt." + aUnlocalized; GT_LanguageManager.addStringLocalization(mName + ".name", aEnglish); - if (GT_Utility.isStringValid(aEnglishTooltip)) GT_LanguageManager - .addStringLocalization(mTooltip = mName + ".tooltip_main", aEnglishTooltip, aWriteToolTipIntoLangFile); + if (GT_Utility.isStringValid(aEnglishTooltip)) GT_LanguageManager.addStringLocalization( + mTooltip = mName + ".tooltip_main", + aEnglishTooltip, + aWriteToolTipIntoLangFile); else mTooltip = null; setCreativeTab(GregTech_API.TAB_GREGTECH); GameRegistry.registerItem(this, mName, MOD_ID); diff --git a/src/main/java/gregtech/api/items/GT_MetaBase_Item.java b/src/main/java/gregtech/api/items/GT_MetaBase_Item.java index 42c356fd88..532b500d8f 100644 --- a/src/main/java/gregtech/api/items/GT_MetaBase_Item.java +++ b/src/main/java/gregtech/api/items/GT_MetaBase_Item.java @@ -61,8 +61,9 @@ public abstract class GT_MetaBase_Item extends GT_Generic_Item */ public final GT_MetaBase_Item addItemBehavior(int aMetaValue, IItemBehaviour<GT_MetaBase_Item> aBehavior) { if (aMetaValue < 0 || aMetaValue >= 32766 || aBehavior == null) return this; - ArrayList<IItemBehaviour<GT_MetaBase_Item>> tList = mItemBehaviors - .computeIfAbsent((short) aMetaValue, k -> new ArrayList<>(1)); + ArrayList<IItemBehaviour<GT_MetaBase_Item>> tList = mItemBehaviors.computeIfAbsent( + (short) aMetaValue, + k -> new ArrayList<>(1)); tList.add(aBehavior); return this; } @@ -200,7 +201,8 @@ public abstract class GT_MetaBase_Item extends GT_Generic_Item @Override public final void addInformation(ItemStack aStack, EntityPlayer aPlayer, List aList, boolean aF3_H) { String tKey = getUnlocalizedName(aStack) + ".tooltip"; - String[] tStrings = GT_LanguageManager.getTranslation(tKey).split("/n "); + String[] tStrings = GT_LanguageManager.getTranslation(tKey) + .split("/n "); for (String tString : tStrings) if (GT_Utility.isStringValid(tString) && !tKey.equals(tString)) aList.add(tString); @@ -208,10 +210,12 @@ public abstract class GT_MetaBase_Item extends GT_Generic_Item if (tStats != null) { if (tStats[3] > 0) { aList.add( - EnumChatFormatting.AQUA + String.format( - transItem("009", "Contains %s EU Tier: %s"), - formatNumbers(tStats[3]), - "" + (tStats[2] >= 0 ? tStats[2] : 0)) + EnumChatFormatting.GRAY); + EnumChatFormatting.AQUA + + String.format( + transItem("009", "Contains %s EU Tier: %s"), + formatNumbers(tStats[3]), + "" + (tStats[2] >= 0 ? tStats[2] : 0)) + + EnumChatFormatting.GRAY); } else { long tCharge = getRealCharge(aStack); if (tStats[3] == -2 && tCharge <= 0) { @@ -240,10 +244,12 @@ public abstract class GT_MetaBase_Item extends GT_Generic_Item EnumChatFormatting.BLUE + ((tFluid == null ? transItem("012", "No Fluids Contained") : GT_Utility.getFluidName(tFluid, true))) + EnumChatFormatting.GRAY); aList.add( - EnumChatFormatting.BLUE + String.format( - transItem("013", "%sL / %sL"), - "" + (tFluid == null ? 0 : formatNumbers(tFluid.amount)), - "" + formatNumbers(tStats[0])) + EnumChatFormatting.GRAY); + EnumChatFormatting.BLUE + + String.format( + transItem("013", "%sL / %sL"), + "" + (tFluid == null ? 0 : formatNumbers(tFluid.amount)), + "" + formatNumbers(tStats[0])) + + EnumChatFormatting.GRAY); } ArrayList<IItemBehaviour<GT_MetaBase_Item>> tList = mItemBehaviors.get((short) getDamage(aStack)); @@ -312,8 +318,9 @@ public abstract class GT_MetaBase_Item extends GT_Generic_Item if (!aSimulate) aStack.stackSize--; return tStats[3]; } - long tChargeBefore = getRealCharge(aStack), tNewCharge = Math - .max(0, tChargeBefore - (aIgnoreTransferLimit ? (long) aCharge : Math.min(tStats[1], (long) aCharge))); + long tChargeBefore = getRealCharge(aStack), tNewCharge = Math.max( + 0, + tChargeBefore - (aIgnoreTransferLimit ? (long) aCharge : Math.min(tStats[1], (long) aCharge))); if (!aSimulate) setCharge(aStack, tNewCharge); return tChargeBefore - tNewCharge; } @@ -464,12 +471,19 @@ public abstract class GT_MetaBase_Item extends GT_Generic_Item } Long[] tStats = getFluidContainerStats(aStack); - if (tStats == null || tStats[0] <= 0 || aFluid == null || aFluid.getFluid().getID() <= 0 || aFluid.amount <= 0) + if (tStats == null || tStats[0] <= 0 + || aFluid == null + || aFluid.getFluid() + .getID() + <= 0 + || aFluid.amount <= 0) return 0; FluidStack tFluid = getFluidContent(aStack); - if (tFluid == null || tFluid.getFluid().getID() <= 0) { + if (tFluid == null || tFluid.getFluid() + .getID() + <= 0) { if (aFluid.amount <= tStats[0]) { if (doFill) { setFluidContent(aStack, aFluid); diff --git a/src/main/java/gregtech/api/items/GT_MetaGenerated_Item.java b/src/main/java/gregtech/api/items/GT_MetaGenerated_Item.java index b6ea08213b..5f906d670d 100644 --- a/src/main/java/gregtech/api/items/GT_MetaGenerated_Item.java +++ b/src/main/java/gregtech/api/items/GT_MetaGenerated_Item.java @@ -230,8 +230,9 @@ public abstract class GT_MetaGenerated_Item extends GT_MetaBase_Item implements mElectricStats.put( (short) aMetaValue, new Long[] { aMaxCharge, Math.max(0, aTransferLimit), Math.max(-1, aTier), aSpecialData }); - if (aMetaValue >= mOffset && aUseAnimations) mIconList[aMetaValue - mOffset] = Arrays - .copyOf(mIconList[aMetaValue - mOffset], Math.max(9, mIconList[aMetaValue - mOffset].length)); + if (aMetaValue >= mOffset && aUseAnimations) mIconList[aMetaValue - mOffset] = Arrays.copyOf( + mIconList[aMetaValue - mOffset], + Math.max(9, mIconList[aMetaValue - mOffset].length)); } return this; } @@ -322,18 +323,18 @@ public abstract class GT_MetaGenerated_Item extends GT_MetaBase_Item implements IFoodStat tStat = mFoodStats.get((short) getDamage(aStack)); if (tStat != null) { if (AppleCore.isModLoaded()) { - aPlayer.getFoodStats().func_151686_a( - (ItemFood) GT_Utility.callConstructor( - "squeek.applecore.api.food.ItemFoodProxy.ItemFoodProxy", - 0, - null, - true, - this), - aStack); + aPlayer.getFoodStats() + .func_151686_a( + (ItemFood) GT_Utility.callConstructor( + "squeek.applecore.api.food.ItemFoodProxy.ItemFoodProxy", + 0, + null, + true, + this), + aStack); } else { - aPlayer.getFoodStats().addStats( - tStat.getFoodLevel(this, aStack, aPlayer), - tStat.getSaturation(this, aStack, aPlayer)); + aPlayer.getFoodStats() + .addStats(tStat.getFoodLevel(this, aStack, aPlayer), tStat.getSaturation(this, aStack, aPlayer)); } tStat.onEaten(this, aStack, aPlayer); } @@ -377,8 +378,8 @@ public abstract class GT_MetaGenerated_Item extends GT_MetaBase_Item implements mIconList[i][k] = aIconRegister.registerIcon( RES_PATH_ITEM + (GT_Config.troll ? "troll" : getUnlocalizedName() + "/" + i + "/" + k)); } - mIconList[i][0] = aIconRegister - .registerIcon(RES_PATH_ITEM + (GT_Config.troll ? "troll" : getUnlocalizedName() + "/" + i)); + mIconList[i][0] = aIconRegister.registerIcon( + RES_PATH_ITEM + (GT_Config.troll ? "troll" : getUnlocalizedName() + "/" + i)); } } diff --git a/src/main/java/gregtech/api/items/GT_MetaGenerated_Item_X01.java b/src/main/java/gregtech/api/items/GT_MetaGenerated_Item_X01.java index f33d7a4f2e..6615c6177b 100644 --- a/src/main/java/gregtech/api/items/GT_MetaGenerated_Item_X01.java +++ b/src/main/java/gregtech/api/items/GT_MetaGenerated_Item_X01.java @@ -115,7 +115,8 @@ public abstract class GT_MetaGenerated_Item_X01 extends GT_MetaGenerated_Item { * @return the name of the Item to be registered at the OreDict. */ public String getOreDictString(OrePrefixes aPrefix, Materials aMaterial) { - return aPrefix.get(aMaterial).toString(); + return aPrefix.get(aMaterial) + .toString(); } public IIconContainer getIconContainer(int aMetaData, Materials aMaterial) { diff --git a/src/main/java/gregtech/api/items/GT_MetaGenerated_Tool.java b/src/main/java/gregtech/api/items/GT_MetaGenerated_Tool.java index a0f1ea6ef1..592914a2ff 100644 --- a/src/main/java/gregtech/api/items/GT_MetaGenerated_Tool.java +++ b/src/main/java/gregtech/api/items/GT_MetaGenerated_Tool.java @@ -170,8 +170,9 @@ public abstract class GT_MetaGenerated_Tool extends GT_MetaBase_Item if (aID >= 0 && aID < 32766 && aID % 2 == 0) { GT_LanguageManager.addStringLocalization(getUnlocalizedName() + "." + aID + ".name", aEnglish); GT_LanguageManager.addStringLocalization(getUnlocalizedName() + "." + aID + ".tooltip", aToolTip); - GT_LanguageManager - .addStringLocalization(getUnlocalizedName() + "." + (aID + 1) + ".name", aEnglish + " (Empty)"); + GT_LanguageManager.addStringLocalization( + getUnlocalizedName() + "." + (aID + 1) + ".name", + aEnglish + " (Empty)"); GT_LanguageManager.addStringLocalization( getUnlocalizedName() + "." + (aID + 1) + ".tooltip", "You need to recharge it"); @@ -304,17 +305,16 @@ public abstract class GT_MetaGenerated_Tool extends GT_MetaBase_Item GT_Utility.doSoundAtClient(tStats.getEntityHitSound(), 1, 1.0F); if (super.onLeftClickEntity(aStack, aPlayer, aEntity)) return true; if (aEntity.canAttackWithItem() && !aEntity.hitByEntity(aPlayer)) { - float tMagicDamage = tStats - .getMagicDamageAgainstEntity( - aEntity instanceof EntityLivingBase - ? EnchantmentHelper - .getEnchantmentModifierLiving(aPlayer, (EntityLivingBase) aEntity) - : 0.0F, - aEntity, - aStack, - aPlayer), + float tMagicDamage = tStats.getMagicDamageAgainstEntity( + aEntity instanceof EntityLivingBase + ? EnchantmentHelper.getEnchantmentModifierLiving(aPlayer, (EntityLivingBase) aEntity) + : 0.0F, + aEntity, + aStack, + aPlayer), tDamage = tStats.getNormalDamageAgainstEntity( - (float) aPlayer.getEntityAttribute(SharedMonsterAttributes.attackDamage).getAttributeValue() + (float) aPlayer.getEntityAttribute(SharedMonsterAttributes.attackDamage) + .getAttributeValue() + getToolCombatDamage(aStack), aEntity, aStack, @@ -352,8 +352,9 @@ public abstract class GT_MetaGenerated_Tool extends GT_MetaBase_Item EnchantmentHelper.func_151385_b(aPlayer, aEntity); if (aEntity instanceof EntityLivingBase) aPlayer.addStat(StatList.damageDealtStat, Math.round(tDamage * 10.0F)); - aEntity.hurtResistantTime = Math - .max(1, tStats.getHurtResistanceTime(aEntity.hurtResistantTime, aEntity)); + aEntity.hurtResistantTime = Math.max( + 1, + tStats.getHurtResistanceTime(aEntity.hurtResistantTime, aEntity)); aPlayer.addExhaustion(0.3F); doDamage(aStack, tStats.getToolDamagePerEntityAttack()); } @@ -423,7 +424,8 @@ public abstract class GT_MetaGenerated_Tool extends GT_MetaBase_Item float aBaseEff = (5f + getToolCombatDamage(aStack)) * 1000f; float aOptFlow = (Math.max( Float.MIN_NORMAL, - ((GT_MetaGenerated_Tool) aStack.getItem()).getToolStats(aStack).getSpeedMultiplier() + ((GT_MetaGenerated_Tool) aStack.getItem()).getToolStats(aStack) + .getSpeedMultiplier() * ((GT_MetaGenerated_Tool) aStack.getItem()).getPrimaryMaterial(aStack).mToolSpeed * 50F)); aList.add( @@ -434,10 +436,12 @@ public abstract class GT_MetaGenerated_Tool extends GT_MetaBase_Item " " + formatNumbers(tMaxDamage)) + EnumChatFormatting.GRAY); aList.add( tOffset + 1, - EnumChatFormatting.GRAY + String.format( - transItem("002", "%s lvl %s"), - tMaterial.mLocalizedName + EnumChatFormatting.YELLOW, - "" + getHarvestLevel(aStack, "")) + EnumChatFormatting.GRAY); + EnumChatFormatting.GRAY + + String.format( + transItem("002", "%s lvl %s"), + tMaterial.mLocalizedName + EnumChatFormatting.YELLOW, + "" + getHarvestLevel(aStack, "")) + + EnumChatFormatting.GRAY); aList.add( tOffset + 2, EnumChatFormatting.WHITE @@ -570,10 +574,12 @@ public abstract class GT_MetaGenerated_Tool extends GT_MetaBase_Item " " + formatNumbers(tMaxDamage)) + EnumChatFormatting.GRAY); aList.add( tOffset + 1, - EnumChatFormatting.WHITE + String.format( - transItem("002", "%s lvl %s"), - tMaterial.mLocalizedName + EnumChatFormatting.YELLOW, - "" + getHarvestLevel(aStack, "")) + EnumChatFormatting.GRAY); + EnumChatFormatting.WHITE + + String.format( + transItem("002", "%s lvl %s"), + tMaterial.mLocalizedName + EnumChatFormatting.YELLOW, + "" + getHarvestLevel(aStack, "")) + + EnumChatFormatting.GRAY); aList.add( tOffset + 2, EnumChatFormatting.WHITE @@ -597,7 +603,8 @@ public abstract class GT_MetaGenerated_Tool extends GT_MetaBase_Item aNBT = aNBT.getCompoundTag("GT.ToolStats"); if (aNBT != null && aNBT.hasKey("Heat")) { int tHeat = aNBT.getInteger("Heat"); - long tWorldTime = aPlayer.getEntityWorld().getWorldTime(); + long tWorldTime = aPlayer.getEntityWorld() + .getWorldTime(); if (aNBT.hasKey("HeatTime")) { long tHeatTime = aNBT.getLong("HeatTime"); if (tWorldTime > (tHeatTime + 10)) { @@ -663,7 +670,9 @@ public abstract class GT_MetaGenerated_Tool extends GT_MetaBase_Item return true; } if (use(aStack, (int) aAmount, null)) { - if (java.util.concurrent.ThreadLocalRandom.current().nextInt(0, 25) == 0) { + if (java.util.concurrent.ThreadLocalRandom.current() + .nextInt(0, 25) + == 0) { long tNewDamage = getToolDamage(aStack) + aAmount; setToolDamage(aStack, tNewDamage); if (tNewDamage >= getToolMaxDamage(aStack)) { diff --git a/src/main/java/gregtech/api/items/GT_RadioactiveCellIC_Item.java b/src/main/java/gregtech/api/items/GT_RadioactiveCellIC_Item.java index 3abfad3347..da7a6bc984 100644 --- a/src/main/java/gregtech/api/items/GT_RadioactiveCellIC_Item.java +++ b/src/main/java/gregtech/api/items/GT_RadioactiveCellIC_Item.java @@ -50,8 +50,15 @@ public class GT_RadioactiveCellIC_Item extends GT_RadioactiveCell_Item implement private static int checkPulseable(IReactor reactor, int x, int y, ItemStack me, int mex, int mey, boolean heatrun) { ItemStack other = reactor.getItemAt(x, y); if ((other != null) && ((other.getItem() instanceof IReactorComponent)) - && (((IReactorComponent) other.getItem()) - .acceptUraniumPulse(reactor, other, me, x, y, mex, mey, heatrun))) { + && (((IReactorComponent) other.getItem()).acceptUraniumPulse( + reactor, + other, + me, + x, + y, + mex, + mey, + heatrun))) { return 1; } return 0; diff --git a/src/main/java/gregtech/api/items/GT_Spray_Foam_Item.java b/src/main/java/gregtech/api/items/GT_Spray_Foam_Item.java index ca77340b34..aa64476105 100644 --- a/src/main/java/gregtech/api/items/GT_Spray_Foam_Item.java +++ b/src/main/java/gregtech/api/items/GT_Spray_Foam_Item.java @@ -58,8 +58,11 @@ public class GT_Spray_Foam_Item extends GT_Tool_Item { TileEntity aTileEntity = aWorld.getTileEntity(aX, aY, aZ); try { - if (GT_Utility.getClassName(aTileEntity).startsWith("TileEntityCable")) { - if (GT_Utility.getPublicField(aTileEntity, "foamed").getByte(aTileEntity) == 0) { + if (GT_Utility.getClassName(aTileEntity) + .startsWith("TileEntityCable")) { + if (GT_Utility.getPublicField(aTileEntity, "foamed") + .getByte(aTileEntity) + == 0) { if (GT_ModHandler.damageOrDechargeItem(aStack, 1, 1000, aPlayer)) { GT_Utility.sendSoundToPlayers(aWorld, SoundResource.IC2_TOOLS_PAINTER, 1.0F, -1, aX, aY, aZ); GT_Utility.callPublicMethod(aTileEntity, "changeFoam", (byte) 1); @@ -121,8 +124,14 @@ public class GT_Spray_Foam_Item extends GT_Tool_Item { for (byte i = 0; i < 4; i++) { if (GT_Utility.isBlockAir(aWorld, aX, aY, aZ) && GT_ModHandler.damageOrDechargeItem(aStack, 1, 1000, aPlayer)) { - GT_Utility - .sendSoundToPlayers(aWorld, SoundResource.IC2_TOOLS_PAINTER, 1.0F, -1, aX, aY, aZ); + GT_Utility.sendSoundToPlayers( + aWorld, + SoundResource.IC2_TOOLS_PAINTER, + 1.0F, + -1, + aX, + aY, + aZ); aWorld.setBlock( aX, aY, diff --git a/src/main/java/gregtech/api/items/GT_Spray_Hardener_Item.java b/src/main/java/gregtech/api/items/GT_Spray_Hardener_Item.java index b5902f2d52..ae6dcdc5f8 100644 --- a/src/main/java/gregtech/api/items/GT_Spray_Hardener_Item.java +++ b/src/main/java/gregtech/api/items/GT_Spray_Hardener_Item.java @@ -43,8 +43,11 @@ public class GT_Spray_Hardener_Item extends GT_Tool_Item { TileEntity aTileEntity = aWorld.getTileEntity(aX, aY, aZ); try { - if (GT_Utility.getClassName(aTileEntity).startsWith("TileEntityCable")) { - if (GT_Utility.getPublicField(aTileEntity, "foamed").getByte(aTileEntity) == 1) { + if (GT_Utility.getClassName(aTileEntity) + .startsWith("TileEntityCable")) { + if (GT_Utility.getPublicField(aTileEntity, "foamed") + .getByte(aTileEntity) + == 1) { if (GT_ModHandler.damageOrDechargeItem(aStack, 1, 1000, aPlayer)) { GT_Utility.sendSoundToPlayers(aWorld, SoundResource.IC2_TOOLS_PAINTER, 1.0F, -1, aX, aY, aZ); GT_Utility.callPublicMethod(aTileEntity, "changeFoam", (byte) 2); diff --git a/src/main/java/gregtech/api/items/GT_Spray_Pepper_Item.java b/src/main/java/gregtech/api/items/GT_Spray_Pepper_Item.java index a70ebb4bfb..7d863c3e89 100644 --- a/src/main/java/gregtech/api/items/GT_Spray_Pepper_Item.java +++ b/src/main/java/gregtech/api/items/GT_Spray_Pepper_Item.java @@ -32,11 +32,13 @@ public class GT_Spray_Pepper_Item extends GT_Tool_Item { getUnlocalizedName() + ".tooltip_1", "especially Pedobears, Care Bears,")); aList.add( - GT_LanguageManager - .addStringLocalization(getUnlocalizedName() + ".tooltip_2", "Confession Bears, Bear Grylls")); + GT_LanguageManager.addStringLocalization( + getUnlocalizedName() + ".tooltip_2", + "Confession Bears, Bear Grylls")); aList.add( - GT_LanguageManager - .addStringLocalization(getUnlocalizedName() + ".tooltip_3", "And ofcourse Man-Bear-Pig")); + GT_LanguageManager.addStringLocalization( + getUnlocalizedName() + ".tooltip_3", + "And ofcourse Man-Bear-Pig")); } /* * @Override public void onHitEntity(Entity aEntity) { if (aEntity instanceof EntityLiving) { diff --git a/src/main/java/gregtech/api/metatileentity/BaseMetaPipeEntity.java b/src/main/java/gregtech/api/metatileentity/BaseMetaPipeEntity.java index 335639c9e3..e1a83f5cc6 100644 --- a/src/main/java/gregtech/api/metatileentity/BaseMetaPipeEntity.java +++ b/src/main/java/gregtech/api/metatileentity/BaseMetaPipeEntity.java @@ -943,7 +943,7 @@ public class BaseMetaPipeEntity extends CommonMetaTileEntity if (coverInfo.getCoverID() == 0) { if (GT_Utility.isStackInList(tCurrentItem, GregTech_API.sCovers.keySet())) { if (GregTech_API.getCoverBehaviorNew(tCurrentItem) - .isCoverPlaceable(coverSide, tCurrentItem, this) + .isCoverPlaceable(coverSide, tCurrentItem, this) && mMetaTileEntity.allowCoverOnSide(coverSide, new GT_ItemStack(tCurrentItem))) { setCoverItemAtSide(coverSide, tCurrentItem); mMetaTileEntity.markDirty(); @@ -1224,7 +1224,9 @@ public class BaseMetaPipeEntity extends CommonMetaTileEntity if (mTickTimer > 5 && canAccessData() && canMoveFluidOnSide( aSide, - mMetaTileEntity.getFluid() == null ? null : mMetaTileEntity.getFluid().getFluid(), + mMetaTileEntity.getFluid() == null ? null + : mMetaTileEntity.getFluid() + .getFluid(), false)) return mMetaTileEntity.drain(aSide, maxDrain, doDrain); return null; diff --git a/src/main/java/gregtech/api/metatileentity/BaseMetaTileEntity.java b/src/main/java/gregtech/api/metatileentity/BaseMetaTileEntity.java index 6b7368ae02..00e31ed9a0 100644 --- a/src/main/java/gregtech/api/metatileentity/BaseMetaTileEntity.java +++ b/src/main/java/gregtech/api/metatileentity/BaseMetaTileEntity.java @@ -82,8 +82,10 @@ import ic2.api.Direction; public class BaseMetaTileEntity extends CommonMetaTileEntity implements IGregTechTileEntity, IActionHost, IGridProxyable, IAlignmentProvider, IConstructableProvider, IDebugableTileEntity, IGregtechWailaProvider { - private static final Field ENTITY_ITEM_HEALTH_FIELD = ReflectionHelper - .findField(EntityItem.class, "health", "field_70291_e"); + private static final Field ENTITY_ITEM_HEALTH_FIELD = ReflectionHelper.findField( + EntityItem.class, + "health", + "field_70291_e"); private final boolean[] mActiveEUInputs = new boolean[] { false, false, false, false, false, false }; private final boolean[] mActiveEUOutputs = new boolean[] { false, false, false, false, false, false }; private final int[] mTimeStatistics = new int[GregTech_API.TICKS_FOR_LAG_AVERAGING]; @@ -384,8 +386,9 @@ public class BaseMetaTileEntity extends CommonMetaTileEntity implements IGregTec } if (mMetaTileEntity.isEnetOutput() && oOutput > 0) { - final long tOutputVoltage = Math - .max(oOutput, oOutput + (1L << Math.max(0, GT_Utility.getTier(oOutput) - 1))); + final long tOutputVoltage = Math.max( + oOutput, + oOutput + (1L << Math.max(0, GT_Utility.getTier(oOutput) - 1))); final long tUsableAmperage = Math.min( getOutputAmperage(), (getStoredEU() - mMetaTileEntity.getMinimumStoredEU()) / tOutputVoltage); @@ -415,7 +418,8 @@ public class BaseMetaTileEntity extends CommonMetaTileEntity implements IGregTec if (getRandomNumber(10) == 0) { try { GT_Mod.achievements.issueAchievement( - this.getWorldObj().getPlayerEntityByName(mOwnerName), + this.getWorldObj() + .getPlayerEntityByName(mOwnerName), "badweather"); } catch (Exception ignored) {} GT_Log.exp.println( @@ -449,7 +453,8 @@ public class BaseMetaTileEntity extends CommonMetaTileEntity implements IGregTec && getRandomNumber(3) == 0) { try { GT_Mod.achievements.issueAchievement( - this.getWorldObj().getPlayerEntityByName(mOwnerName), + this.getWorldObj() + .getPlayerEntityByName(mOwnerName), "badweather"); } catch (Exception ignored) {} GT_Log.exp.println( @@ -482,11 +487,11 @@ public class BaseMetaTileEntity extends CommonMetaTileEntity implements IGregTec if (mMetaTileEntity.mInventory[i] != null && getStoredEU() < getEUCapacity()) { dischargeItem(mMetaTileEntity.mInventory[i]); if (ic2.api.info.Info.itemEnergy.getEnergyValue(mMetaTileEntity.mInventory[i]) > 0) { - if ((getStoredEU() + ic2.api.info.Info.itemEnergy - .getEnergyValue(mMetaTileEntity.mInventory[i])) < getEUCapacity()) { + if ((getStoredEU() + ic2.api.info.Info.itemEnergy.getEnergyValue( + mMetaTileEntity.mInventory[i])) < getEUCapacity()) { increaseStoredEnergyUnits( - (long) ic2.api.info.Info.itemEnergy - .getEnergyValue(mMetaTileEntity.mInventory[i]), + (long) ic2.api.info.Info.itemEnergy.getEnergyValue( + mMetaTileEntity.mInventory[i]), false); mMetaTileEntity.mInventory[i].stackSize--; mInventoryChanged = true; @@ -1112,7 +1117,8 @@ public class BaseMetaTileEntity extends CommonMetaTileEntity implements IGregTec public void generatePowerNodes() { if (isServerSide() && (isEnetInput() || isEnetOutput())) { - final int time = MinecraftServer.getServer().getTickCounter(); + final int time = MinecraftServer.getServer() + .getTickCounter(); for (byte i : ALL_VALID_SIDES) { if (outputsEnergyTo(i, false) || inputEnergyFrom(i, false)) { final IGregTechTileEntity TE = getIGregTechTileEntityAtSide(i); @@ -1202,8 +1208,14 @@ public class BaseMetaTileEntity extends CommonMetaTileEntity implements IGregTec @Override public ITexture[] getTexture(Block aBlock, byte aSide) { final ITexture coverTexture = getCoverTexture(aSide); - final ITexture[] textureUncovered = hasValidMetaTileEntity() ? mMetaTileEntity - .getTexture(this, aSide, mFacing, (byte) (mColor - 1), mActive, getOutputRedstoneSignal(aSide) > 0) + final ITexture[] textureUncovered = hasValidMetaTileEntity() + ? mMetaTileEntity.getTexture( + this, + aSide, + mFacing, + (byte) (mColor - 1), + mActive, + getOutputRedstoneSignal(aSide) > 0) : Textures.BlockIcons.ERROR_RENDERING; final ITexture[] textureCovered; if (coverTexture != null) { @@ -1293,7 +1305,8 @@ public class BaseMetaTileEntity extends CommonMetaTileEntity implements IGregTec if ((mOwnerName.length() == 0) && isServerSide()) { setOwnerName(aPlayer.getDisplayName()); setOwnerUuid(aPlayer.getUniqueID()); - } else return !privateAccess() || aPlayer.getDisplayName().equals("Player") + } else return !privateAccess() || aPlayer.getDisplayName() + .equals("Player") || mOwnerName.equals("Player") || mOwnerName.equals(aPlayer.getDisplayName()); return true; @@ -1315,8 +1328,10 @@ public class BaseMetaTileEntity extends CommonMetaTileEntity implements IGregTec doExplosion( oOutput * (getUniversalEnergyStored() >= getUniversalEnergyCapacity() ? 4 : getUniversalEnergyStored() >= getUniversalEnergyCapacity() / 2 ? 2 : 1)); - GT_Mod.achievements - .issueAchievement(this.getWorldObj().getPlayerEntityByName(mOwnerName), "electricproblems"); + GT_Mod.achievements.issueAchievement( + this.getWorldObj() + .getPlayerEntityByName(mOwnerName), + "electricproblems"); } } @@ -1364,7 +1379,10 @@ public class BaseMetaTileEntity extends CommonMetaTileEntity implements IGregTec this.zCoord + XSTR_INSTANCE.nextFloat() * 0.8F + 0.1F, new ItemStack(tItem.getItem(), tItem.stackSize, tItem.getItemDamage())); if (tItem.hasTagCompound()) { - tItemEntity.getEntityItem().setTagCompound((NBTTagCompound) tItem.getTagCompound().copy()); + tItemEntity.getEntityItem() + .setTagCompound( + (NBTTagCompound) tItem.getTagCompound() + .copy()); } tItemEntity.motionX = (XSTR_INSTANCE.nextGaussian() * 0.0500000007450581D); tItemEntity.motionY = (XSTR_INSTANCE.nextGaussian() * 0.0500000007450581D + 0.2000000029802322D); @@ -1423,7 +1441,8 @@ public class BaseMetaTileEntity extends CommonMetaTileEntity implements IGregTec } if (isServerSide()) { - if (!privateAccess() || aPlayer.getDisplayName().equalsIgnoreCase(getOwnerName())) { + if (!privateAccess() || aPlayer.getDisplayName() + .equalsIgnoreCase(getOwnerName())) { final ItemStack tCurrentItem = aPlayer.inventory.getCurrentItem(); if (tCurrentItem != null) { if (getColorization() >= 0 @@ -1434,8 +1453,8 @@ public class BaseMetaTileEntity extends CommonMetaTileEntity implements IGregTec } if (GT_Utility.isStackInList(tCurrentItem, GregTech_API.sWrenchList)) { if (aPlayer.isSneaking() && mMetaTileEntity instanceof GT_MetaTileEntity_BasicMachine - && ((GT_MetaTileEntity_BasicMachine) mMetaTileEntity) - .setMainFacing(GT_Utility.determineWrenchingSide(aSide, aX, aY, aZ))) { + && ((GT_MetaTileEntity_BasicMachine) mMetaTileEntity).setMainFacing( + GT_Utility.determineWrenchingSide(aSide, aX, aY, aZ))) { GT_ModHandler.damageOrDechargeItem(tCurrentItem, 1, 1000, aPlayer); GT_Utility.sendSoundToPlayers( worldObj, @@ -1497,16 +1516,14 @@ public class BaseMetaTileEntity extends CommonMetaTileEntity implements IGregTec if (GT_ModHandler.damageOrDechargeItem(tCurrentItem, 1, 1000, aPlayer)) { mInputDisabled = !mInputDisabled; if (mInputDisabled) mOutputDisabled = !mOutputDisabled; - GT_Utility - .sendChatToPlayer( - aPlayer, - GT_Utility.trans("086", "Auto-Input: ") - + (mInputDisabled ? GT_Utility.trans("087", "Disabled") - : GT_Utility.trans("088", "Enabled") - + GT_Utility.trans("089", " Auto-Output: ") - + (mOutputDisabled - ? GT_Utility.trans("087", "Disabled") - : GT_Utility.trans("088", "Enabled")))); + GT_Utility.sendChatToPlayer( + aPlayer, + GT_Utility.trans("086", "Auto-Input: ") + + (mInputDisabled ? GT_Utility.trans("087", "Disabled") + : GT_Utility.trans("088", "Enabled") + + GT_Utility.trans("089", " Auto-Output: ") + + (mOutputDisabled ? GT_Utility.trans("087", "Disabled") + : GT_Utility.trans("088", "Enabled")))); GT_Utility.sendSoundToPlayers( worldObj, SoundResource.RANDOM_ANVIL_USE, @@ -1602,7 +1619,7 @@ public class BaseMetaTileEntity extends CommonMetaTileEntity implements IGregTec if (getCoverIDAtSide(coverSide) == 0) { if (GT_Utility.isStackInList(tCurrentItem, GregTech_API.sCovers.keySet())) { if (GregTech_API.getCoverBehaviorNew(tCurrentItem) - .isCoverPlaceable(coverSide, tCurrentItem, this) + .isCoverPlaceable(coverSide, tCurrentItem, this) && mMetaTileEntity.allowCoverOnSide(coverSide, new GT_ItemStack(tCurrentItem))) { setCoverItemAtSide(coverSide, tCurrentItem); if (!aPlayer.capabilities.isCreativeMode) tCurrentItem.stackSize--; @@ -1994,8 +2011,8 @@ public class BaseMetaTileEntity extends CommonMetaTileEntity implements IGregTec if (mTickTimer > 5 && canAccessData() && (mRunningThroughTick || !mInputDisabled) && (aSide == ForgeDirection.UNKNOWN || (mMetaTileEntity.isLiquidInput((byte) aSide.ordinal()) - && getCoverInfoAtSide((byte) aSide.ordinal()) - .letsFluidIn(aFluid == null ? null : aFluid.getFluid())))) + && getCoverInfoAtSide((byte) aSide.ordinal()).letsFluidIn( + aFluid == null ? null : aFluid.getFluid())))) return mMetaTileEntity.fill(aSide, aFluid, doFill); return 0; } @@ -2006,7 +2023,9 @@ public class BaseMetaTileEntity extends CommonMetaTileEntity implements IGregTec && (mRunningThroughTick || !mOutputDisabled) && (aSide == ForgeDirection.UNKNOWN || (mMetaTileEntity.isLiquidOutput((byte) aSide.ordinal()) && getCoverInfoAtSide((byte) aSide.ordinal()).letsFluidOut( - mMetaTileEntity.getFluid() == null ? null : mMetaTileEntity.getFluid().getFluid())))) + mMetaTileEntity.getFluid() == null ? null + : mMetaTileEntity.getFluid() + .getFluid())))) return mMetaTileEntity.drain(aSide, maxDrain, doDrain); return null; } @@ -2016,8 +2035,8 @@ public class BaseMetaTileEntity extends CommonMetaTileEntity implements IGregTec if (mTickTimer > 5 && canAccessData() && (mRunningThroughTick || !mOutputDisabled) && (aSide == ForgeDirection.UNKNOWN || (mMetaTileEntity.isLiquidOutput((byte) aSide.ordinal()) - && getCoverInfoAtSide((byte) aSide.ordinal()) - .letsFluidOut(aFluid == null ? null : aFluid.getFluid())))) + && getCoverInfoAtSide((byte) aSide.ordinal()).letsFluidOut( + aFluid == null ? null : aFluid.getFluid())))) return mMetaTileEntity.drain(aSide, aFluid, doDrain); return null; } diff --git a/src/main/java/gregtech/api/metatileentity/BaseTileEntity.java b/src/main/java/gregtech/api/metatileentity/BaseTileEntity.java index 31d388cf71..238dc6ba30 100644 --- a/src/main/java/gregtech/api/metatileentity/BaseTileEntity.java +++ b/src/main/java/gregtech/api/metatileentity/BaseTileEntity.java @@ -201,7 +201,8 @@ public abstract class BaseTileEntity extends TileEntity implements IHasWorldObje @Override public int getRandomNumber(int aRange) { - return ThreadLocalRandom.current().nextInt(aRange); + return ThreadLocalRandom.current() + .nextInt(aRange); } @Override @@ -530,8 +531,9 @@ public abstract class BaseTileEntity extends TileEntity implements IHasWorldObje // update if it was / is strong powered. if (((((mStrongRedstone | oStrongRedstone) >>> dir.ordinal()) & 1) != 0) && getBlock(x1, y1, z1).isNormalCube()) { - final int skipUpdateSide = dir.getOpposite().ordinal(); // Don't update this block. Still updates - // diagonal blocks twice if conditions + final int skipUpdateSide = dir.getOpposite() + .ordinal(); // Don't update this block. Still updates + // diagonal blocks twice if conditions // meet. for (final ForgeDirection dir2 : ForgeDirection.VALID_DIRECTIONS) { @@ -707,8 +709,9 @@ public abstract class BaseTileEntity extends TileEntity implements IHasWorldObje if (NetworkUtils.isClient()) { final FontRenderer fontRenderer = Minecraft.getMinecraft().fontRenderer; // noinspection unchecked - final List<String> titleLines = fontRenderer - .listFormattedStringToWidth(title, getGUIWidth() - (TAB_PADDING + TITLE_PADDING) * 2); + final List<String> titleLines = fontRenderer.listFormattedStringToWidth( + title, + getGUIWidth() - (TAB_PADDING + TITLE_PADDING) * 2); titleWidth = titleLines.size() > 1 ? getGUIWidth() - (TAB_PADDING + TITLE_PADDING) * 2 : fontRenderer.getStringWidth(title); // noinspection PointlessArithmeticExpression @@ -717,27 +720,35 @@ public abstract class BaseTileEntity extends TileEntity implements IHasWorldObje final DrawableWidget tab = new DrawableWidget(); final TextWidget text = new TextWidget(title).setDefaultColor(getTitleColor()) - .setTextAlignment(Alignment.CenterLeft).setMaxWidth(titleWidth); + .setTextAlignment(Alignment.CenterLeft) + .setMaxWidth(titleWidth); if (GT_Mod.gregtechproxy.mTitleTabStyle == 1) { - tab.setDrawable(getGUITextureSet().getTitleTabAngular()).setPos(0, -(titleHeight + TAB_PADDING) + 1) - .setSize(getGUIWidth(), titleHeight + TAB_PADDING * 2); + tab.setDrawable(getGUITextureSet().getTitleTabAngular()) + .setPos(0, -(titleHeight + TAB_PADDING) + 1) + .setSize(getGUIWidth(), titleHeight + TAB_PADDING * 2); text.setPos(TAB_PADDING + TITLE_PADDING, -titleHeight + TAB_PADDING); } else { - tab.setDrawable(getGUITextureSet().getTitleTabDark()).setPos(0, -(titleHeight + TAB_PADDING * 2) + 1) - .setSize(titleWidth + (TAB_PADDING + TITLE_PADDING) * 2, titleHeight + TAB_PADDING * 2 - 1); + tab.setDrawable(getGUITextureSet().getTitleTabDark()) + .setPos(0, -(titleHeight + TAB_PADDING * 2) + 1) + .setSize(titleWidth + (TAB_PADDING + TITLE_PADDING) * 2, titleHeight + TAB_PADDING * 2 - 1); text.setPos(TAB_PADDING + TITLE_PADDING, -titleHeight); } - builder.widget(tab).widget(text); + builder.widget(tab) + .widget(text); } protected void addTitleItemIconStyle(ModularWindow.Builder builder, String title) { builder.widget( - new MultiChildWidget() - .addChild( - new DrawableWidget().setDrawable(getGUITextureSet().getTitleTabNormal()).setPos(0, 0) - .setSize(24, 24)) - .addChild(new ItemDrawable(getStackForm(1)).asWidget().setPos(4, 4)).addTooltip(title) - .setTooltipShowUpDelay(TOOLTIP_DELAY).setPos(0, -24 + 3)); + new MultiChildWidget().addChild( + new DrawableWidget().setDrawable(getGUITextureSet().getTitleTabNormal()) + .setPos(0, 0) + .setSize(24, 24)) + .addChild( + new ItemDrawable(getStackForm(1)).asWidget() + .setPos(4, 4)) + .addTooltip(title) + .setTooltipShowUpDelay(TOOLTIP_DELAY) + .setPos(0, -24 + 3)); } @Override @@ -752,7 +763,9 @@ public abstract class BaseTileEntity extends TileEntity implements IHasWorldObje @Override public void addGregTechLogo(ModularWindow.Builder builder) { builder.widget( - new DrawableWidget().setDrawable(getGUITextureSet().getGregTechLogo()).setSize(17, 17).setPos(152, 63)); + new DrawableWidget().setDrawable(getGUITextureSet().getGregTechLogo()) + .setSize(17, 17) + .setPos(152, 63)); } protected int getGUIWidth() { @@ -776,8 +789,12 @@ public abstract class BaseTileEntity extends TileEntity implements IHasWorldObje background = new IDrawable[] { getGUITextureSet().getItemSlot() }; } builder.widget( - SlotGroup.ofItemHandler(inventoryHandler, 1).startFromSlot(0).endAtSlot(0).background(background) - .build().setPos(79, 34)); + SlotGroup.ofItemHandler(inventoryHandler, 1) + .startFromSlot(0) + .endAtSlot(0) + .background(background) + .build() + .setPos(79, 34)); } @Override @@ -789,8 +806,12 @@ public abstract class BaseTileEntity extends TileEntity implements IHasWorldObje background = new IDrawable[] { getGUITextureSet().getItemSlot() }; } builder.widget( - SlotGroup.ofItemHandler(inventoryHandler, 2).startFromSlot(0).endAtSlot(3).background(background) - .build().setPos(70, 25)); + SlotGroup.ofItemHandler(inventoryHandler, 2) + .startFromSlot(0) + .endAtSlot(3) + .background(background) + .build() + .setPos(70, 25)); } @Override @@ -802,8 +823,12 @@ public abstract class BaseTileEntity extends TileEntity implements IHasWorldObje background = new IDrawable[] { getGUITextureSet().getItemSlot() }; } builder.widget( - SlotGroup.ofItemHandler(inventoryHandler, 3).startFromSlot(0).endAtSlot(8).background(background) - .build().setPos(61, 16)); + SlotGroup.ofItemHandler(inventoryHandler, 3) + .startFromSlot(0) + .endAtSlot(8) + .background(background) + .build() + .setPos(61, 16)); } @Override @@ -815,8 +840,12 @@ public abstract class BaseTileEntity extends TileEntity implements IHasWorldObje background = new IDrawable[] { getGUITextureSet().getItemSlot() }; } builder.widget( - SlotGroup.ofItemHandler(inventoryHandler, 4).startFromSlot(0).endAtSlot(15).background(background) - .build().setPos(52, 7)); + SlotGroup.ofItemHandler(inventoryHandler, 4) + .startFromSlot(0) + .endAtSlot(15) + .background(background) + .build() + .setPos(52, 7)); } public void addCoverTabs(ModularWindow.Builder builder, UIBuildContext buildContext) { @@ -857,8 +886,9 @@ public abstract class BaseTileEntity extends TileEntity implements IHasWorldObje final List<ItemStack> tCircuits = ccs.getConfigurationCircuits(); final int index = GT_Utility.findMatchingStackInList(tCircuits, cursorStack); if (index < 0) { - int curIndex = GT_Utility - .findMatchingStackInList(tCircuits, inv.getStackInSlot(ccs.getCircuitSlot())) + 1; + int curIndex = GT_Utility.findMatchingStackInList( + tCircuits, + inv.getStackInSlot(ccs.getCircuitSlot())) + 1; if (clickData.mouseButton == 0) { curIndex += 1; } else { @@ -894,10 +924,13 @@ public abstract class BaseTileEntity extends TileEntity implements IHasWorldObje line -> line.contains(StatCollector.translateToLocal("gt.integrated_circuit.tooltip.0")) || line.contains(StatCollector.translateToLocal("gt.integrated_circuit.tooltip.1"))); return list; - }).disableShiftInsert().setHandlePhantomActionClient(true) - .setBackground(getGUITextureSet().getItemSlot(), GT_UITextures.OVERLAY_SLOT_INT_CIRCUIT) - .setGTTooltip(() -> mTooltipCache.getData("GT5U.machines.select_circuit.tooltip")) - .setTooltipShowUpDelay(TOOLTIP_DELAY).setPos(ccs.getCircuitSlotX() - 1, ccs.getCircuitSlotY() - 1)); + }) + .disableShiftInsert() + .setHandlePhantomActionClient(true) + .setBackground(getGUITextureSet().getItemSlot(), GT_UITextures.OVERLAY_SLOT_INT_CIRCUIT) + .setGTTooltip(() -> mTooltipCache.getData("GT5U.machines.select_circuit.tooltip")) + .setTooltipShowUpDelay(TOOLTIP_DELAY) + .setPos(ccs.getCircuitSlotX() - 1, ccs.getCircuitSlotY() - 1)); } protected void openSelectCircuitDialog(ModularUIContext uiContext, AtomicBoolean dialogOpened) { @@ -915,9 +948,17 @@ public abstract class BaseTileEntity extends TileEntity implements IHasWorldObje this::onCircuitSelected, circuits, GT_Utility.findMatchingStackInList(circuits, inv.getStackInSlot(ccs.getCircuitSlot()))) - .setAnotherWindow(true, dialogOpened).setGuiTint(getGUIColorization()) - .setCurrentGetter(() -> inv.getStackInSlot(ccs.getCircuitSlot())) - .createWindow(new UIBuildContext(player))); + .setAnotherWindow( + true, + dialogOpened) + .setGuiTint( + getGUIColorization()) + .setCurrentGetter( + () -> inv.getStackInSlot( + ccs.getCircuitSlot())) + .createWindow( + new UIBuildContext( + player))); } protected void onCircuitSelected(ItemStack selected) { diff --git a/src/main/java/gregtech/api/metatileentity/CommonMetaTileEntity.java b/src/main/java/gregtech/api/metatileentity/CommonMetaTileEntity.java index a49071cdcf..853dd3699a 100644 --- a/src/main/java/gregtech/api/metatileentity/CommonMetaTileEntity.java +++ b/src/main/java/gregtech/api/metatileentity/CommonMetaTileEntity.java @@ -34,7 +34,8 @@ public abstract class CommonMetaTileEntity extends CoverableTileEntity implement GT_Log.err.println("MetaID " + aID + " not loadable => locking TileEntity!"); } else { if (hasValidMetaTileEntity()) getMetaTileEntity().setBaseMetaTileEntity(null); - GregTech_API.METATILEENTITIES[aID].newMetaEntity(this).setBaseMetaTileEntity(this); + GregTech_API.METATILEENTITIES[aID].newMetaEntity(this) + .setBaseMetaTileEntity(this); mTickTimer = 0; mID = aID; return true; diff --git a/src/main/java/gregtech/api/metatileentity/CoverableTileEntity.java b/src/main/java/gregtech/api/metatileentity/CoverableTileEntity.java index 1228e3f668..f2929e7e1e 100644 --- a/src/main/java/gregtech/api/metatileentity/CoverableTileEntity.java +++ b/src/main/java/gregtech/api/metatileentity/CoverableTileEntity.java @@ -64,7 +64,9 @@ import gregtech.common.covers.GT_Cover_Fluidfilter; public abstract class CoverableTileEntity extends BaseTileEntity implements ICoverable, IGregtechWailaProvider { public static final String[] COVER_DATA_NBT_KEYS = Arrays.stream(ForgeDirection.VALID_DIRECTIONS) - .mapToInt(Enum::ordinal).mapToObj(i -> "mCoverData" + i).toArray(String[]::new); + .mapToInt(Enum::ordinal) + .mapToObj(i -> "mCoverData" + i) + .toArray(String[]::new); // New Cover Information protected final CoverInfo[] coverInfos = new CoverInfo[] { null, null, null, null, null, null }; @@ -102,7 +104,10 @@ public abstract class CoverableTileEntity extends BaseTileEntity implements ICov // Backwards compat, in case of a revert... for now tList.appendTag(coverInfo.writeToNBT(new NBTTagCompound())); - aNBT.setTag(COVER_DATA_NBT_KEYS[i], coverInfo.getCoverData().saveDataToNBT()); + aNBT.setTag( + COVER_DATA_NBT_KEYS[i], + coverInfo.getCoverData() + .saveDataToNBT()); } if (tList.tagCount() > 0) { aNBT.setTag(GT_Values.NBT.COVERS, tList); @@ -159,8 +164,11 @@ public abstract class CoverableTileEntity extends BaseTileEntity implements ICov if (coverBehavior instanceof GT_Cover_Fluidfilter) { final String filterKey = String.format("fluidFilter%d", i); if (aNBT.hasKey(filterKey)) { - coverData = coverInfo.getCoverBehavior().createDataObject( - (tOldData[i] & 7) | (FluidRegistry.getFluidID(aNBT.getString(filterKey)) << 3)); + coverData = coverInfo.getCoverBehavior() + .createDataObject( + (tOldData[i] & 7) + | (FluidRegistry.getFluidID(aNBT.getString(filterKey)) + << 3)); } } else { coverData = coverBehavior.createDataObject(tOldData[i]); @@ -290,7 +298,10 @@ public abstract class CoverableTileEntity extends BaseTileEntity implements ICov @Override public void setCoverDataAtSide(byte aSide, ISerializableObject aData) { final CoverInfo coverInfo = getCoverInfoAtSide(aSide); - if (coverInfo.isValid() && coverInfo.getCoverBehavior().cast(aData) != null) coverInfo.setCoverData(aData); + if (coverInfo.isValid() && coverInfo.getCoverBehavior() + .cast(aData) + != null) + coverInfo.setCoverData(aData); } @Override @@ -303,7 +314,8 @@ public abstract class CoverableTileEntity extends BaseTileEntity implements ICov @Override public void setCoverItemAtSide(byte aSide, ItemStack aCover) { - GregTech_API.getCoverBehaviorNew(aCover).placeCover(aSide, aCover, this); + GregTech_API.getCoverBehaviorNew(aCover) + .placeCover(aSide, aCover, this); } @Override @@ -426,14 +438,18 @@ public abstract class CoverableTileEntity extends BaseTileEntity implements ICov @Override public void setInternalOutputRedstoneSignal(byte aSide, byte aStrength) { - if (!getCoverBehaviorAtSideNew(aSide) - .manipulatesSidedRedstoneOutput(aSide, getCoverIDAtSide(aSide), getComplexCoverDataAtSide(aSide), this)) + if (!getCoverBehaviorAtSideNew(aSide).manipulatesSidedRedstoneOutput( + aSide, + getCoverIDAtSide(aSide), + getComplexCoverDataAtSide(aSide), + this)) setOutputRedstoneSignal(aSide, aStrength); } @Override public boolean getRedstone() { - return IntStream.range(1, 6).anyMatch(i -> getRedstone((byte) i)); + return IntStream.range(1, 6) + .anyMatch(i -> getRedstone((byte) i)); } @Override @@ -443,7 +459,10 @@ public abstract class CoverableTileEntity extends BaseTileEntity implements ICov @Override public byte getStrongestRedstone() { - return (byte) IntStream.range(1, 6).map(i -> getInternalInputRedstoneSignal((byte) i)).max().orElse(0); + return (byte) IntStream.range(1, 6) + .map(i -> getInternalInputRedstoneSignal((byte) i)) + .max() + .orElse(0); } @Override @@ -469,16 +488,20 @@ public abstract class CoverableTileEntity extends BaseTileEntity implements ICov @Override public byte getInputRedstoneSignal(byte aSide) { - return (byte) (worldObj - .getIndirectPowerLevelTo(getOffsetX(aSide, 1), getOffsetY(aSide, 1), getOffsetZ(aSide, 1), aSide) & 15); + return (byte) (worldObj.getIndirectPowerLevelTo( + getOffsetX(aSide, 1), + getOffsetY(aSide, 1), + getOffsetZ(aSide, 1), + aSide) & 15); } @Override public byte getOutputRedstoneSignal(byte aSide) { - return getCoverBehaviorAtSideNew(aSide) - .manipulatesSidedRedstoneOutput(aSide, getCoverIDAtSide(aSide), getComplexCoverDataAtSide(aSide), this) - ? mSidedRedstone[aSide] - : getGeneralRS(aSide); + return getCoverBehaviorAtSideNew(aSide).manipulatesSidedRedstoneOutput( + aSide, + getCoverIDAtSide(aSide), + getComplexCoverDataAtSide(aSide), + this) ? mSidedRedstone[aSide] : getGeneralRS(aSide); } protected void updateOutputRedstoneSignal(byte aSide) { @@ -531,7 +554,8 @@ public abstract class CoverableTileEntity extends BaseTileEntity implements ICov public void getWailaBody(ItemStack itemStack, List<String> currenttip, IWailaDataAccessor accessor, IWailaConfigHandler config) { final NBTTagCompound tag = accessor.getNBTData(); - final byte currentFacing = (byte) accessor.getSide().ordinal(); + final byte currentFacing = (byte) accessor.getSide() + .ordinal(); final NBTTagList tList = tag.getTagList(GT_Values.NBT.COVERS, 10); for (byte i = 0; i < tList.tagCount(); i++) { @@ -547,8 +571,10 @@ public abstract class CoverableTileEntity extends BaseTileEntity implements ICov currentFacing == coverInfo.getSide() ? StatCollector.translateToLocal("GT5U.waila.cover.current_facing") : StatCollector.translateToLocal( - "GT5U.interface.coverTabs." + ForgeDirection - .getOrientation(coverInfo.getSide()).toString().toLowerCase()), + "GT5U.interface.coverTabs." + + ForgeDirection.getOrientation(coverInfo.getSide()) + .toString() + .toLowerCase()), coverStack.getDisplayName())); final String behaviorDesc = coverInfo.getBehaviorDescription(); if (!Objects.equals(behaviorDesc, E)) currenttip.add(behaviorDesc); @@ -602,8 +628,8 @@ public abstract class CoverableTileEntity extends BaseTileEntity implements ICov final GT_CoverBehaviorBase<?> behavior = GregTech_API.getCoverBehaviorNew(coverId); if (behavior == null || behavior == GregTech_API.sNoBehavior) continue; if (!aNBT.hasKey(CoverableTileEntity.COVER_DATA_NBT_KEYS[tSide])) continue; - final ISerializableObject dataObject = behavior - .createDataObject(aNBT.getTag(CoverableTileEntity.COVER_DATA_NBT_KEYS[tSide])); + final ISerializableObject dataObject = behavior.createDataObject( + aNBT.getTag(CoverableTileEntity.COVER_DATA_NBT_KEYS[tSide])); final ItemStack coverStack = behavior.getDisplayStack(coverId, dataObject); if (coverStack != null) { aList.add( @@ -634,11 +660,15 @@ public abstract class CoverableTileEntity extends BaseTileEntity implements ICov final int xPos = flipHorizontally ? (getGUIWidth() - COVER_TAB_LEFT - COVER_TAB_WIDTH) : COVER_TAB_LEFT; if (GT_Mod.gregtechproxy.mCoverTabsVisible) { columnWidget.setPos(xPos, COVER_TAB_TOP) - .setEnabled(widget -> ((Column) widget).getChildren().stream().anyMatch(Widget::isEnabled)); + .setEnabled( + widget -> ((Column) widget).getChildren() + .stream() + .anyMatch(Widget::isEnabled)); } else { columnWidget.setEnabled(false); } - columnWidget.setAlignment(MainAxisAlignment.SPACE_BETWEEN).setSpace(COVER_TAB_SPACING); + columnWidget.setAlignment(MainAxisAlignment.SPACE_BETWEEN) + .setSpace(COVER_TAB_SPACING); for (ForgeDirection direction : ForgeDirection.VALID_DIRECTIONS) { final byte side = (byte) direction.ordinal(); @@ -668,12 +698,23 @@ public abstract class CoverableTileEntity extends BaseTileEntity implements ICov return backgrounds.toArray(new IDrawable[] {}); } }.setOnClick((clickData, widget) -> onTabClicked(clickData, widget, side)) - .dynamicTooltip(() -> getCoverTabTooltip(side)).setSize(COVER_TAB_WIDTH, COVER_TAB_HEIGHT)) - .addChild( - new ItemDrawable(() -> { return getCoverItemAtSide(side); }).asWidget().setPos( - (COVER_TAB_WIDTH - ICON_SIZE) / 2 + (flipHorizontally ? -1 : 1), - (COVER_TAB_HEIGHT - ICON_SIZE) / 2)) - .setEnabled(widget -> getCoverItemAtSide(side) != null)); + .dynamicTooltip(() -> getCoverTabTooltip(side)) + .setSize(COVER_TAB_WIDTH, COVER_TAB_HEIGHT)) + .addChild( + new ItemDrawable( + () -> { return getCoverItemAtSide(side); }) + .asWidget() + .setPos( + (COVER_TAB_WIDTH + - ICON_SIZE) + / 2 + + (flipHorizontally + ? -1 + : 1), + (COVER_TAB_HEIGHT + - ICON_SIZE) + / 2)) + .setEnabled(widget -> getCoverItemAtSide(side) != null)); } } @@ -708,14 +749,20 @@ public abstract class CoverableTileEntity extends BaseTileEntity implements ICov if (isClientSide()) return; final CoverInfo coverInfo = getCoverInfoAtSide(side); if (coverInfo.useModularUI()) { - widget.getContext().openSyncedWindow(side + COVER_WINDOW_ID_START); + widget.getContext() + .openSyncedWindow(side + COVER_WINDOW_ID_START); } else { final GT_Packet_TileEntityCoverGUI packet = new GT_Packet_TileEntityCoverGUI( coverInfo, getWorld().provider.dimensionId, - widget.getContext().getPlayer().getEntityId(), + widget.getContext() + .getPlayer() + .getEntityId(), 0); - GT_Values.NW.sendToPlayer(packet, (EntityPlayerMP) widget.getContext().getPlayer()); + GT_Values.NW.sendToPlayer( + packet, + (EntityPlayerMP) widget.getContext() + .getPlayer()); } } } diff --git a/src/main/java/gregtech/api/metatileentity/MetaPipeEntity.java b/src/main/java/gregtech/api/metatileentity/MetaPipeEntity.java index 3aa0cbfb32..cf1cb5dc1b 100644 --- a/src/main/java/gregtech/api/metatileentity/MetaPipeEntity.java +++ b/src/main/java/gregtech/api/metatileentity/MetaPipeEntity.java @@ -98,7 +98,8 @@ public abstract class MetaPipeEntity implements IMetaTileEntity, IConnectable { } else { throw new IllegalArgumentException("MetaMachine-Slot Nr. " + aID + " is already occupied!"); } - mName = aBasicName.replaceAll(" ", "_").toLowerCase(Locale.ENGLISH); + mName = aBasicName.replaceAll(" ", "_") + .toLowerCase(Locale.ENGLISH); setBaseMetaTileEntity(new BaseMetaPipeEntity()); getBaseMetaTileEntity().setMetaTileID((short) aID); GT_LanguageManager.addStringLocalization("gt.blockmachines." + mName + ".name", aRegionalName); @@ -113,7 +114,8 @@ public abstract class MetaPipeEntity implements IMetaTileEntity, IConnectable { if (!GT.isClientSide()) return; ItemStack tStack = new ItemStack(GregTech_API.sBlockMachines, 1, aID); - tStack.getItem().addInformation(tStack, null, new ArrayList<String>(), true); + tStack.getItem() + .addInformation(tStack, null, new ArrayList<String>(), true); } /** @@ -146,7 +148,8 @@ public abstract class MetaPipeEntity implements IMetaTileEntity, IConnectable { @Override public void setBaseMetaTileEntity(IGregTechTileEntity aBaseMetaTileEntity) { if (mBaseMetaTileEntity != null && aBaseMetaTileEntity == null) { - mBaseMetaTileEntity.getMetaTileEntity().inValidate(); + mBaseMetaTileEntity.getMetaTileEntity() + .inValidate(); mBaseMetaTileEntity.setMetaTileEntity(null); } mBaseMetaTileEntity = aBaseMetaTileEntity; @@ -786,8 +789,11 @@ public abstract class MetaPipeEntity implements IMetaTileEntity, IConnectable { World tWorld = getBaseMetaTileEntity().getWorld(); tWorld.setBlock(tX, tY, tZ, Blocks.air); if (GregTech_API.sMachineExplosions) { - new WorldSpawnedEventBuilder.ExplosionEffectEventBuilder().setStrength(tStrength).setSmoking(true) - .setPosition(tX + 0.5, tY + 0.5, tZ + 0.5).setWorld(tWorld).run(); + new WorldSpawnedEventBuilder.ExplosionEffectEventBuilder().setStrength(tStrength) + .setSmoking(true) + .setPosition(tX + 0.5, tY + 0.5, tZ + 0.5) + .setWorld(tWorld) + .run(); } } @@ -875,7 +881,8 @@ public abstract class MetaPipeEntity implements IMetaTileEntity, IConnectable { final IMetaTileEntity tPipe = tTileEntity instanceof IGregTechTileEntity ? ((IGregTechTileEntity) tTileEntity).getMetaTileEntity() : null; - if (getClass().isInstance(tPipe) || (tPipe != null && tPipe.getClass().isInstance(this))) { + if (getClass().isInstance(tPipe) || (tPipe != null && tPipe.getClass() + .isInstance(this))) { connectAtSide(aSide); if (!((MetaPipeEntity) tPipe).isConnectedAtSide(tSide)) { // Make sure pipes all get together -- connect back to us if we're connecting to a pipe @@ -890,8 +897,11 @@ public abstract class MetaPipeEntity implements IMetaTileEntity, IConnectable { connectAtSide(aSide); return 1; } - if (!baseMetaTile.getWorld().getChunkProvider() - .chunkExists(baseMetaTile.getOffsetX(aSide, 1) >> 4, baseMetaTile.getOffsetZ(aSide, 1) >> 4)) { + if (!baseMetaTile.getWorld() + .getChunkProvider() + .chunkExists( + baseMetaTile.getOffsetX(aSide, 1) >> 4, + baseMetaTile.getOffsetZ(aSide, 1) >> 4)) { // Target chunk unloaded return -1; } @@ -921,7 +931,10 @@ public abstract class MetaPipeEntity implements IMetaTileEntity, IConnectable { byte tSide = GT_Utility.getOppositeSide(aSide); IGregTechTileEntity tTileEntity = getBaseMetaTileEntity().getIGregTechTileEntityAtSide(aSide); IMetaTileEntity tPipe = tTileEntity == null ? null : tTileEntity.getMetaTileEntity(); - if ((this.getClass().isInstance(tPipe) || (tPipe != null && tPipe.getClass().isInstance(this))) + if ((this.getClass() + .isInstance(tPipe) + || (tPipe != null && tPipe.getClass() + .isInstance(this))) && ((MetaPipeEntity) tPipe).isConnectedAtSide(tSide)) ((MetaPipeEntity) tPipe).disconnect(tSide); } diff --git a/src/main/java/gregtech/api/metatileentity/MetaTileEntity.java b/src/main/java/gregtech/api/metatileentity/MetaTileEntity.java index 26caeaa416..a017fca2e0 100644 --- a/src/main/java/gregtech/api/metatileentity/MetaTileEntity.java +++ b/src/main/java/gregtech/api/metatileentity/MetaTileEntity.java @@ -129,7 +129,8 @@ public abstract class MetaTileEntity implements IMetaTileEntity, IMachineCallbac } else { throw new IllegalArgumentException("MetaMachine-Slot Nr. " + aID + " is already occupied!"); } - mName = aBasicName.replace(" ", "_").toLowerCase(Locale.ENGLISH); + mName = aBasicName.replace(" ", "_") + .toLowerCase(Locale.ENGLISH); setBaseMetaTileEntity(GregTech_API.constructBaseMetaTileEntity()); getBaseMetaTileEntity().setMetaTileID((short) aID); GT_LanguageManager.addStringLocalization("gt.blockmachines." + mName + ".name", aRegionalName); @@ -165,7 +166,8 @@ public abstract class MetaTileEntity implements IMetaTileEntity, IMachineCallbac @Override public void setBaseMetaTileEntity(IGregTechTileEntity aBaseMetaTileEntity) { if (mBaseMetaTileEntity != null && aBaseMetaTileEntity == null) { - mBaseMetaTileEntity.getMetaTileEntity().inValidate(); + mBaseMetaTileEntity.getMetaTileEntity() + .inValidate(); mBaseMetaTileEntity.setMetaTileEntity(null); } mBaseMetaTileEntity = aBaseMetaTileEntity; @@ -245,7 +247,13 @@ public abstract class MetaTileEntity implements IMetaTileEntity, IMachineCallbac && (((IGregTechTileEntity) tTileEntity).getMetaTileEntity() instanceof GT_MetaPipeEntity_Cable)) { // The tile entity we're facing is a cable, let's try to connect to it return ((IGregTechTileEntity) tTileEntity).getMetaTileEntity() - .onWireCutterRightClick(aWrenchingSide, tSide, aPlayer, aX, aY, aZ); + .onWireCutterRightClick( + aWrenchingSide, + tSide, + aPlayer, + aX, + aY, + aZ); } return false; } @@ -260,7 +268,13 @@ public abstract class MetaTileEntity implements IMetaTileEntity, IMachineCallbac && (((IGregTechTileEntity) tTileEntity).getMetaTileEntity() instanceof GT_MetaPipeEntity_Cable)) { // The tile entity we're facing is a cable, let's try to connect to it return ((IGregTechTileEntity) tTileEntity).getMetaTileEntity() - .onSolderingToolRightClick(aWrenchingSide, tSide, aPlayer, aX, aY, aZ); + .onSolderingToolRightClick( + aWrenchingSide, + tSide, + aPlayer, + aX, + aY, + aZ); } return false; } @@ -268,13 +282,17 @@ public abstract class MetaTileEntity implements IMetaTileEntity, IMachineCallbac @Override public void onExplosion() { GT_Log.exp.println( - "Machine at " + this.getBaseMetaTileEntity().getXCoord() + "Machine at " + this.getBaseMetaTileEntity() + .getXCoord() + " | " - + this.getBaseMetaTileEntity().getYCoord() + + this.getBaseMetaTileEntity() + .getYCoord() + " | " - + this.getBaseMetaTileEntity().getZCoord() + + this.getBaseMetaTileEntity() + .getZCoord() + " DIMID: " - + this.getBaseMetaTileEntity().getWorld().provider.dimensionId + + this.getBaseMetaTileEntity() + .getWorld().provider.dimensionId + " exploded."); } @@ -1180,7 +1198,8 @@ public abstract class MetaTileEntity implements IMetaTileEntity, IMachineCallbac currenttip.add( String.format( "Facing: %s", - ForgeDirection.getOrientation(mBaseMetaTileEntity.getFrontFacing()).name())); + ForgeDirection.getOrientation(mBaseMetaTileEntity.getFrontFacing()) + .name())); if (this instanceof IPowerChannelState) { // adapted from PowerStateWailaDataProvider @@ -1221,11 +1240,20 @@ public abstract class MetaTileEntity implements IMetaTileEntity, IMachineCallbac try { if (getProxy() == null) return "(proxy)"; if (getProxy().getNode() == null) return "(node)"; - if (getProxy().getNode().getGrid() == null) return "(grid)"; - if (!getProxy().getNode().meetsChannelRequirements()) return "(channels)"; - IPathingGrid pg = getProxy().getNode().getGrid().getCache(IPathingGrid.class); + if (getProxy().getNode() + .getGrid() + == null) + return "(grid)"; + if (!getProxy().getNode() + .meetsChannelRequirements()) + return "(channels)"; + IPathingGrid pg = getProxy().getNode() + .getGrid() + .getCache(IPathingGrid.class); if (!pg.isNetworkBooting()) return "(booting)"; - IEnergyGrid eg = getProxy().getNode().getGrid().getCache(IEnergyGrid.class); + IEnergyGrid eg = getProxy().getNode() + .getGrid() + .getCache(IEnergyGrid.class); if (!eg.isNetworkPowered()) return "(power)"; } catch (Throwable ex) { ex.printStackTrace(); diff --git a/src/main/java/gregtech/api/metatileentity/TileIC2EnergySink.java b/src/main/java/gregtech/api/metatileentity/TileIC2EnergySink.java index 6d6ec378d4..674ced4535 100644 --- a/src/main/java/gregtech/api/metatileentity/TileIC2EnergySink.java +++ b/src/main/java/gregtech/api/metatileentity/TileIC2EnergySink.java @@ -82,8 +82,9 @@ public class TileIC2EnergySink extends TileEntity implements IEnergySink { @Override public double injectEnergy(ForgeDirection directionFrom, double amount, double voltage) { - final long amps = (long) Math - .max(amount / (cableMeta != null ? cableMeta.mVoltage : myMeta.getInputVoltage() * 1.0), 1.0); + final long amps = (long) Math.max( + amount / (cableMeta != null ? cableMeta.mVoltage : myMeta.getInputVoltage() * 1.0), + 1.0); final long euPerAmp = (long) (amount / (amps * 1.0)); final IMetaTileEntity metaTile = myMeta.getMetaTileEntity(); @@ -97,8 +98,10 @@ public class TileIC2EnergySink extends TileEntity implements IEnergySink { amps, Sets.newHashSet((TileEntity) myMeta)); - } else usedAmps = myMeta - .injectEnergyUnits((byte) directionFrom.ordinal(), Math.min(euPerAmp, myMeta.getInputVoltage()), amps); + } else usedAmps = myMeta.injectEnergyUnits( + (byte) directionFrom.ordinal(), + Math.min(euPerAmp, myMeta.getInputVoltage()), + amps); return amount - (usedAmps * euPerAmp); // transferElectricity for cables diff --git a/src/main/java/gregtech/api/metatileentity/examples/GT_MetaTileEntity_E_Furnace.java b/src/main/java/gregtech/api/metatileentity/examples/GT_MetaTileEntity_E_Furnace.java index a372a37103..e8e313141d 100644 --- a/src/main/java/gregtech/api/metatileentity/examples/GT_MetaTileEntity_E_Furnace.java +++ b/src/main/java/gregtech/api/metatileentity/examples/GT_MetaTileEntity_E_Furnace.java @@ -32,28 +32,52 @@ public class GT_MetaTileEntity_E_Furnace extends GT_MetaTileEntity_BasicMachine "smelting", TextureFactory.of( TextureFactory.of(OVERLAY_SIDE_STEAM_FURNACE_ACTIVE), - TextureFactory.builder().addIcon(OVERLAY_SIDE_STEAM_FURNACE_ACTIVE_GLOW).glow().build()), + TextureFactory.builder() + .addIcon(OVERLAY_SIDE_STEAM_FURNACE_ACTIVE_GLOW) + .glow() + .build()), TextureFactory.of( TextureFactory.of(OVERLAY_SIDE_STEAM_FURNACE), - TextureFactory.builder().addIcon(OVERLAY_SIDE_STEAM_FURNACE_GLOW).glow().build()), + TextureFactory.builder() + .addIcon(OVERLAY_SIDE_STEAM_FURNACE_GLOW) + .glow() + .build()), TextureFactory.of( TextureFactory.of(OVERLAY_FRONT_STEAM_FURNACE_ACTIVE), - TextureFactory.builder().addIcon(OVERLAY_FRONT_STEAM_FURNACE_ACTIVE_GLOW).glow().build()), + TextureFactory.builder() + .addIcon(OVERLAY_FRONT_STEAM_FURNACE_ACTIVE_GLOW) + .glow() + .build()), TextureFactory.of( TextureFactory.of(OVERLAY_FRONT_STEAM_FURNACE), - TextureFactory.builder().addIcon(OVERLAY_FRONT_STEAM_FURNACE_GLOW).glow().build()), + TextureFactory.builder() + .addIcon(OVERLAY_FRONT_STEAM_FURNACE_GLOW) + .glow() + .build()), TextureFactory.of( TextureFactory.of(OVERLAY_TOP_STEAM_FURNACE_ACTIVE), - TextureFactory.builder().addIcon(OVERLAY_TOP_STEAM_FURNACE_ACTIVE_GLOW).glow().build()), + TextureFactory.builder() + .addIcon(OVERLAY_TOP_STEAM_FURNACE_ACTIVE_GLOW) + .glow() + .build()), TextureFactory.of( TextureFactory.of(OVERLAY_TOP_STEAM_FURNACE), - TextureFactory.builder().addIcon(OVERLAY_TOP_STEAM_FURNACE_GLOW).glow().build()), + TextureFactory.builder() + .addIcon(OVERLAY_TOP_STEAM_FURNACE_GLOW) + .glow() + .build()), TextureFactory.of( TextureFactory.of(OVERLAY_BOTTOM_STEAM_FURNACE_ACTIVE), - TextureFactory.builder().addIcon(OVERLAY_BOTTOM_STEAM_FURNACE_ACTIVE_GLOW).glow().build()), + TextureFactory.builder() + .addIcon(OVERLAY_BOTTOM_STEAM_FURNACE_ACTIVE_GLOW) + .glow() + .build()), TextureFactory.of( TextureFactory.of(OVERLAY_BOTTOM_STEAM_FURNACE), - TextureFactory.builder().addIcon(OVERLAY_BOTTOM_STEAM_FURNACE_GLOW).glow().build())); + TextureFactory.builder() + .addIcon(OVERLAY_BOTTOM_STEAM_FURNACE_GLOW) + .glow() + .build())); } public GT_MetaTileEntity_E_Furnace(String aName, int aTier, String aDescription, ITexture[][][] aTextures, diff --git a/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaPipeEntity_Cable.java b/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaPipeEntity_Cable.java index e2e0b13f12..790d4d6c1f 100644 --- a/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaPipeEntity_Cable.java +++ b/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaPipeEntity_Cable.java @@ -205,7 +205,9 @@ public class GT_MetaPipeEntity_Cable extends MetaPipeEntity implements IMetaTile @Override public long injectEnergyUnits(byte aSide, long aVoltage, long aAmperage) { if (!isConnectedAtSide(aSide) && aSide != 6) return 0; - if (!getBaseMetaTileEntity().getCoverInfoAtSide(aSide).letsEnergyIn()) return 0; + if (!getBaseMetaTileEntity().getCoverInfoAtSide(aSide) + .letsEnergyIn()) + return 0; final HashSet<TileEntity> nul = null; return transferElectricity(aSide, aVoltage, aAmperage, nul); } @@ -245,9 +247,11 @@ public class GT_MetaPipeEntity_Cable extends MetaPipeEntity implements IMetaTile public void onFirstTick(IGregTechTileEntity aBaseMetaTileEntity) { if (aBaseMetaTileEntity.isServerSide()) { lastAmperage = new int[16]; - lastWorldTick = aBaseMetaTileEntity.getWorld().getTotalWorldTime() - 1; // sets initial value -1 since it is - // in the same tick as first on post - // tick + lastWorldTick = aBaseMetaTileEntity.getWorld() + .getTotalWorldTime() + - 1; // sets initial value -1 since it is + // in the same tick as first on post + // tick } } @@ -546,8 +550,13 @@ public class GT_MetaPipeEntity_Cable extends MetaPipeEntity implements IMetaTile if ((tConn & (1 << ForgeDirection.WEST.ordinal())) != 0) tSide4 = 0f; if ((tConn & (1 << ForgeDirection.EAST.ordinal())) != 0) tSide5 = 1f; - return AxisAlignedBB - .getBoundingBox(aX + tSide4, aY + tSide0, aZ + tSide2, aX + tSide5, aY + tSide1, aZ + tSide3); + return AxisAlignedBB.getBoundingBox( + aX + tSide4, + aY + tSide0, + aZ + tSide2, + aX + tSide5, + aY + tSide1, + aZ + tSide3); } @Override diff --git a/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaPipeEntity_Fluid.java b/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaPipeEntity_Fluid.java index 29237218a1..a3e44640e8 100644 --- a/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaPipeEntity_Fluid.java +++ b/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaPipeEntity_Fluid.java @@ -263,7 +263,8 @@ public class GT_MetaPipeEntity_Fluid extends MetaPipeEntity { && aEntity instanceof EntityLivingBase) { for (FluidStack tFluid : mFluids) { if (tFluid != null) { - final int tTemperature = tFluid.getFluid().getTemperature(tFluid); + final int tTemperature = tFluid.getFluid() + .getTemperature(tFluid); if (tTemperature > 320 && !isCoverOnSide( (BaseMetaPipeEntity) getBaseMetaTileEntity(), (EntityLivingBase) aEntity)) { @@ -314,7 +315,8 @@ public class GT_MetaPipeEntity_Fluid extends MetaPipeEntity { final FluidStack tFluid = mFluids[index]; if (tFluid != null && tFluid.amount > 0) { - final int tTemperature = tFluid.getFluid().getTemperature(tFluid); + final int tTemperature = tFluid.getFluid() + .getTemperature(tFluid); if (tTemperature > mHeatResistance) { if (aBaseMetaTileEntity.getRandomNumber(100) == 0) { // Poof @@ -341,21 +343,28 @@ public class GT_MetaPipeEntity_Fluid extends MetaPipeEntity { + " DIMID: " + aBaseMetaTileEntity.getWorld().provider.dimensionId); } - if (!mGasProof && tFluid.getFluid().isGaseous(tFluid)) { + if (!mGasProof && tFluid.getFluid() + .isGaseous(tFluid)) { tFluid.amount -= 5; sendSound((byte) 9); if (tTemperature > 320) { try { for (EntityLivingBase tLiving : (ArrayList<EntityLivingBase>) getBaseMetaTileEntity().getWorld() - .getEntitiesWithinAABB( - EntityLivingBase.class, - AxisAlignedBB.getBoundingBox( - getBaseMetaTileEntity().getXCoord() - 2, - getBaseMetaTileEntity().getYCoord() - 2, - getBaseMetaTileEntity().getZCoord() - 2, - getBaseMetaTileEntity().getXCoord() + 3, - getBaseMetaTileEntity().getYCoord() + 3, - getBaseMetaTileEntity().getZCoord() + 3))) { + .getEntitiesWithinAABB( + EntityLivingBase.class, + AxisAlignedBB.getBoundingBox( + getBaseMetaTileEntity().getXCoord() + - 2, + getBaseMetaTileEntity().getYCoord() + - 2, + getBaseMetaTileEntity().getZCoord() + - 2, + getBaseMetaTileEntity().getXCoord() + + 3, + getBaseMetaTileEntity().getYCoord() + + 3, + getBaseMetaTileEntity().getZCoord() + + 3))) { GT_Utility.applyHeatDamage(tLiving, (tTemperature - 300) / 25.0F); } } catch (Throwable e) { @@ -364,15 +373,21 @@ public class GT_MetaPipeEntity_Fluid extends MetaPipeEntity { } else if (tTemperature < 260) { try { for (EntityLivingBase tLiving : (ArrayList<EntityLivingBase>) getBaseMetaTileEntity().getWorld() - .getEntitiesWithinAABB( - EntityLivingBase.class, - AxisAlignedBB.getBoundingBox( - getBaseMetaTileEntity().getXCoord() - 2, - getBaseMetaTileEntity().getYCoord() - 2, - getBaseMetaTileEntity().getZCoord() - 2, - getBaseMetaTileEntity().getXCoord() + 3, - getBaseMetaTileEntity().getYCoord() + 3, - getBaseMetaTileEntity().getZCoord() + 3))) { + .getEntitiesWithinAABB( + EntityLivingBase.class, + AxisAlignedBB.getBoundingBox( + getBaseMetaTileEntity().getXCoord() + - 2, + getBaseMetaTileEntity().getYCoord() + - 2, + getBaseMetaTileEntity().getZCoord() + - 2, + getBaseMetaTileEntity().getXCoord() + + 3, + getBaseMetaTileEntity().getYCoord() + + 3, + getBaseMetaTileEntity().getZCoord() + + 3))) { GT_Utility.applyFrostDamage(tLiving, (270 - tTemperature) / 12.5F); } } catch (Throwable e) { @@ -402,8 +417,10 @@ public class GT_MetaPipeEntity_Fluid extends MetaPipeEntity { if (isConnectedAtSide(aSide) && tTank != null && (mLastReceivedFrom & (1 << aSide)) == 0 - && getBaseMetaTileEntity().getCoverInfoAtSide(aSide).letsFluidOut(tFluid.getFluid()) - && (gTank == null || gTank.getCoverInfoAtSide(tSide).letsFluidIn(tFluid.getFluid()))) { + && getBaseMetaTileEntity().getCoverInfoAtSide(aSide) + .letsFluidOut(tFluid.getFluid()) + && (gTank == null || gTank.getCoverInfoAtSide(tSide) + .letsFluidIn(tFluid.getFluid()))) { if (tTank.fill(ForgeDirection.getOrientation(tSide), tFluid, false) > 0) { tTanks.add(new MutableTriple<>(tTank, ForgeDirection.getOrientation(tSide), 0)); } @@ -435,8 +452,10 @@ public class GT_MetaPipeEntity_Fluid extends MetaPipeEntity { if (tEntry.right <= 0) continue; - final int tFilledAmount = tEntry.left - .fill(tEntry.middle, drainFromIndex(tEntry.right, false, index), false); + final int tFilledAmount = tEntry.left.fill( + tEntry.middle, + drainFromIndex(tEntry.right, false, index), + false); if (tFilledAmount > 0) tEntry.left.fill(tEntry.middle, drainFromIndex(tFilledAmount, true, index), true); @@ -510,7 +529,9 @@ public class GT_MetaPipeEntity_Fluid extends MetaPipeEntity { public boolean canConnect(byte aSide, TileEntity tTileEntity) { if (tTileEntity == null) return false; - final byte tSide = (byte) ForgeDirection.getOrientation(aSide).getOpposite().ordinal(); + final byte tSide = (byte) ForgeDirection.getOrientation(aSide) + .getOpposite() + .ordinal(); final IGregTechTileEntity baseMetaTile = getBaseMetaTileEntity(); if (baseMetaTile == null) return false; @@ -559,19 +580,19 @@ public class GT_MetaPipeEntity_Fluid extends MetaPipeEntity { if (aIndex == 9) { GT_Utility.doSoundAtClient(SoundResource.RANDOM_FIZZ, 5, 1.0F, aX, aY, aZ); - new ParticleEventBuilder().setIdentifier(ParticleFX.CLOUD).setWorld(getBaseMetaTileEntity().getWorld()) - .<ParticleEventBuilder>times( - 6, - (x, i) -> x - .setMotion( - ForgeDirection.getOrientation(i).offsetX / 5.0, - ForgeDirection.getOrientation(i).offsetY / 5.0, - ForgeDirection.getOrientation(i).offsetZ / 5.0) - .setPosition( - aX - 0.5 + XSTR_INSTANCE.nextFloat(), - aY - 0.5 + XSTR_INSTANCE.nextFloat(), - aZ - 0.5 + XSTR_INSTANCE.nextFloat()) - .run()); + new ParticleEventBuilder().setIdentifier(ParticleFX.CLOUD) + .setWorld(getBaseMetaTileEntity().getWorld()) + .<ParticleEventBuilder>times( + 6, + (x, i) -> x.setMotion( + ForgeDirection.getOrientation(i).offsetX / 5.0, + ForgeDirection.getOrientation(i).offsetY / 5.0, + ForgeDirection.getOrientation(i).offsetZ / 5.0) + .setPosition( + aX - 0.5 + XSTR_INSTANCE.nextFloat(), + aY - 0.5 + XSTR_INSTANCE.nextFloat(), + aZ - 0.5 + XSTR_INSTANCE.nextFloat()) + .run()); } } @@ -625,16 +646,21 @@ public class GT_MetaPipeEntity_Fluid extends MetaPipeEntity { @Override public final int fill_default(ForgeDirection aSide, FluidStack aFluid, boolean doFill) { - if (aFluid == null || aFluid.getFluid().getID() <= 0) return 0; + if (aFluid == null || aFluid.getFluid() + .getID() + <= 0) + return 0; int index = -1; for (int i = 0; i < mPipeAmount; i++) { if (mFluids[i] != null && mFluids[i].isFluidEqual(aFluid)) { index = i; break; - } else if ((mFluids[i] == null || mFluids[i].getFluid().getID() <= 0) && index < 0) { - index = i; - } + } else if ((mFluids[i] == null || mFluids[i].getFluid() + .getID() + <= 0) && index < 0) { + index = i; + } } return fill_default_intoIndex(aSide, aFluid, doFill, index); @@ -642,9 +668,14 @@ public class GT_MetaPipeEntity_Fluid extends MetaPipeEntity { private int fill_default_intoIndex(ForgeDirection aSide, FluidStack aFluid, boolean doFill, int index) { if (index < 0 || index >= mPipeAmount) return 0; - if (aFluid == null || aFluid.getFluid().getID() <= 0) return 0; - - if (mFluids[index] == null || mFluids[index].getFluid().getID() <= 0) { + if (aFluid == null || aFluid.getFluid() + .getID() + <= 0) + return 0; + + if (mFluids[index] == null || mFluids[index].getFluid() + .getID() + <= 0) { if (aFluid.amount * mPipeAmount <= getCapacity()) { if (doFill) { mFluids[index] = aFluid.copy(); @@ -811,8 +842,13 @@ public class GT_MetaPipeEntity_Fluid extends MetaPipeEntity { if ((tConn & (1 << ForgeDirection.WEST.ordinal())) != 0) tSide4 = 0f; if ((tConn & (1 << ForgeDirection.EAST.ordinal())) != 0) tSide5 = 1f; - return AxisAlignedBB - .getBoundingBox(aX + tSide4, aY + tSide0, aZ + tSide2, aX + tSide5, aY + tSide1, aZ + tSide3); + return AxisAlignedBB.getBoundingBox( + aX + tSide4, + aY + tSide0, + aZ + tSide2, + aX + tSide5, + aY + tSide1, + aZ + tSide3); } @Override diff --git a/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaPipeEntity_Frame.java b/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaPipeEntity_Frame.java index e449921d1d..302155a186 100644 --- a/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaPipeEntity_Frame.java +++ b/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaPipeEntity_Frame.java @@ -19,8 +19,9 @@ import gregtech.api.util.GT_OreDictUnificator; public class GT_MetaPipeEntity_Frame extends MetaPipeEntity { - private static final String localizedDescFormat = GT_LanguageManager - .addStringLocalization("gt.blockmachines.gt_frame.desc.format", "Just something you can put covers on."); + private static final String localizedDescFormat = GT_LanguageManager.addStringLocalization( + "gt.blockmachines.gt_frame.desc.format", + "Just something you can put covers on."); public final Materials mMaterial; public GT_MetaPipeEntity_Frame(int aID, String aName, String aNameRegional, Materials aMaterial) { diff --git a/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaPipeEntity_Item.java b/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaPipeEntity_Item.java index 5d2211528b..9e55aa94c7 100644 --- a/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaPipeEntity_Item.java +++ b/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaPipeEntity_Item.java @@ -228,10 +228,9 @@ public class GT_MetaPipeEntity_Item extends MetaPipeEntity implements IMetaTileE for (boolean temp = true; temp && !isInventoryEmpty() && pipeCapacityCheck();) { temp = false; tPipeList.clear(); - for (IMetaTileEntityItemPipe tTileEntity : GT_Utility - .sortMapByValuesAcending( - IMetaTileEntityItemPipe.Util.scanPipes(this, new HashMap<>(), 0, false, false)) - .keySet()) { + for (IMetaTileEntityItemPipe tTileEntity : GT_Utility.sortMapByValuesAcending( + IMetaTileEntityItemPipe.Util.scanPipes(this, new HashMap<>(), 0, false, false)) + .keySet()) { if (temp) break; tPipeList.add(tTileEntity); while (!temp && !isInventoryEmpty() && tTileEntity.sendItemStack(aBaseMetaTileEntity)) @@ -308,7 +307,9 @@ public class GT_MetaPipeEntity_Item extends MetaPipeEntity implements IMetaTileE : null; if (gTileEntity != null) { if (gTileEntity.getMetaTileEntity() == null) return false; - if (gTileEntity.getMetaTileEntity().connectsToItemPipe(tSide)) return true; + if (gTileEntity.getMetaTileEntity() + .connectsToItemPipe(tSide)) + return true; connectable = true; } @@ -355,7 +356,8 @@ public class GT_MetaPipeEntity_Item extends MetaPipeEntity implements IMetaTileE @Override public boolean insertItemStackIntoTileEntity(Object aSender, byte aSide) { - if (getBaseMetaTileEntity().getCoverInfoAtSide(aSide).letsItemsOut(-1)) { + if (getBaseMetaTileEntity().getCoverInfoAtSide(aSide) + .letsItemsOut(-1)) { final TileEntity tInventory = getBaseMetaTileEntity().getTileEntityAtSide(aSide); if (tInventory != null && !(tInventory instanceof BaseMetaPipeEntity)) { if ((!(tInventory instanceof TileEntityHopper) && !(tInventory instanceof TileEntityDispenser)) @@ -510,8 +512,13 @@ public class GT_MetaPipeEntity_Item extends MetaPipeEntity implements IMetaTileE if ((tConn & (1 << ForgeDirection.WEST.ordinal())) != 0) tSide4 = 0f; if ((tConn & (1 << ForgeDirection.EAST.ordinal())) != 0) tSide5 = 1f; - return AxisAlignedBB - .getBoundingBox(aX + tSide4, aY + tSide0, aZ + tSide2, aX + tSide5, aY + tSide1, aZ + tSide3); + return AxisAlignedBB.getBoundingBox( + aX + tSide4, + aY + tSide0, + aZ + tSide2, + aX + tSide5, + aY + tSide1, + aZ + tSide3); } @Override diff --git a/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_BasicBatteryBuffer.java b/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_BasicBatteryBuffer.java index 7eb396a293..7b2a4fa232 100644 --- a/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_BasicBatteryBuffer.java +++ b/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_BasicBatteryBuffer.java @@ -237,7 +237,8 @@ public class GT_MetaTileEntity_BasicBatteryBuffer extends GT_MetaTileEntity_Tier @Override public boolean allowPullStack(IGregTechTileEntity aBaseMetaTileEntity, int aIndex, byte aSide, ItemStack aStack) { - if (GT_ModHandler.isElectricItem(aStack) && aStack.getUnlocalizedName().startsWith("gt.metaitem.01.")) { + if (GT_ModHandler.isElectricItem(aStack) && aStack.getUnlocalizedName() + .startsWith("gt.metaitem.01.")) { String name = aStack.getUnlocalizedName(); if (name.equals("gt.metaitem.01.32510") || name.equals("gt.metaitem.01.32511") || name.equals("gt.metaitem.01.32520") @@ -383,47 +384,67 @@ public class GT_MetaTileEntity_BasicBatteryBuffer extends GT_MetaTileEntity_Tier switch (mInventory.length) { case 4: builder.widget( - SlotGroup.ofItemHandler(inventoryHandler, 2).startFromSlot(0).endAtSlot(3) - .slotCreator(index -> new BaseSlot(inventoryHandler, index) { - - @Override - public int getSlotStackLimit() { - return 1; - } - }).background(getGUITextureSet().getItemSlot()).build().setPos(70, 25)); + SlotGroup.ofItemHandler(inventoryHandler, 2) + .startFromSlot(0) + .endAtSlot(3) + .slotCreator(index -> new BaseSlot(inventoryHandler, index) { + + @Override + public int getSlotStackLimit() { + return 1; + } + }) + .background(getGUITextureSet().getItemSlot()) + .build() + .setPos(70, 25)); break; case 9: builder.widget( - SlotGroup.ofItemHandler(inventoryHandler, 3).startFromSlot(0).endAtSlot(8) - .slotCreator(index -> new BaseSlot(inventoryHandler, index) { - - @Override - public int getSlotStackLimit() { - return 1; - } - }).background(getGUITextureSet().getItemSlot()).build().setPos(61, 16)); + SlotGroup.ofItemHandler(inventoryHandler, 3) + .startFromSlot(0) + .endAtSlot(8) + .slotCreator(index -> new BaseSlot(inventoryHandler, index) { + + @Override + public int getSlotStackLimit() { + return 1; + } + }) + .background(getGUITextureSet().getItemSlot()) + .build() + .setPos(61, 16)); break; case 16: builder.widget( - SlotGroup.ofItemHandler(inventoryHandler, 4).startFromSlot(0).endAtSlot(15) - .slotCreator(index -> new BaseSlot(inventoryHandler, index) { - - @Override - public int getSlotStackLimit() { - return 1; - } - }).background(getGUITextureSet().getItemSlot()).build().setPos(52, 7)); + SlotGroup.ofItemHandler(inventoryHandler, 4) + .startFromSlot(0) + .endAtSlot(15) + .slotCreator(index -> new BaseSlot(inventoryHandler, index) { + + @Override + public int getSlotStackLimit() { + return 1; + } + }) + .background(getGUITextureSet().getItemSlot()) + .build() + .setPos(52, 7)); break; default: builder.widget( - SlotGroup.ofItemHandler(inventoryHandler, 1).startFromSlot(0).endAtSlot(0) - .slotCreator(index -> new BaseSlot(inventoryHandler, index) { - - @Override - public int getSlotStackLimit() { - return 1; - } - }).background(getGUITextureSet().getItemSlot()).build().setPos(79, 34)); + SlotGroup.ofItemHandler(inventoryHandler, 1) + .startFromSlot(0) + .endAtSlot(0) + .slotCreator(index -> new BaseSlot(inventoryHandler, index) { + + @Override + public int getSlotStackLimit() { + return 1; + } + }) + .background(getGUITextureSet().getItemSlot()) + .build() + .setPos(79, 34)); break; } } diff --git a/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_BasicGenerator.java b/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_BasicGenerator.java index 669b3c9495..a71b94b916 100644 --- a/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_BasicGenerator.java +++ b/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_BasicGenerator.java @@ -278,8 +278,10 @@ public abstract class GT_MetaTileEntity_BasicGenerator extends GT_MetaTileEntity // solid... !(stack.getItem() instanceof IFluidHandler) && // when the item is a fluid handler its not a // solid... - !stack.getItem().getUnlocalizedName().contains("bucket"); // since we cant really check for - // buckets... + !stack.getItem() + .getUnlocalizedName() + .contains("bucket"); // since we cant really check for + // buckets... } } diff --git a/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_BasicMachine.java b/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_BasicMachine.java index 7ff173615a..78fc68ee81 100644 --- a/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_BasicMachine.java +++ b/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_BasicMachine.java @@ -503,8 +503,8 @@ public abstract class GT_MetaTileEntity_BasicMachine extends GT_MetaTileEntity_B public void initDefaultModes(NBTTagCompound aNBT) { mMainFacing = -1; if (!getBaseMetaTileEntity().getWorld().isRemote) { - GT_ClientPreference tPreference = GT_Mod.gregtechproxy - .getClientPreference(getBaseMetaTileEntity().getOwnerUuid()); + GT_ClientPreference tPreference = GT_Mod.gregtechproxy.getClientPreference( + getBaseMetaTileEntity().getOwnerUuid()); if (tPreference != null) { mDisableFilter = !tPreference.isSingleBlockInitialFilterEnabled(); mDisableMultiStack = !tPreference.isSingleBlockInitialMultiStackEnabled(); @@ -569,8 +569,9 @@ public abstract class GT_MetaTileEntity_BasicMachine extends GT_MetaTileEntity_B if (mProgresstime < 0 || drainEnergyForProcess(mEUt)) { if (++mProgresstime >= mMaxProgresstime) { for (int i = 0; i < mOutputItems.length; i++) - for (int j = 0; j < mOutputItems.length; j++) if (aBaseMetaTileEntity - .addStackToSlot(getOutputSlot() + ((j + i) % mOutputItems.length), mOutputItems[i])) + for (int j = 0; j < mOutputItems.length; j++) if (aBaseMetaTileEntity.addStackToSlot( + getOutputSlot() + ((j + i) % mOutputItems.length), + mOutputItems[i])) break; if (mOutputFluid != null) if (getDrainableStack() == null) setDrainableStack(mOutputFluid.copy()); @@ -731,8 +732,10 @@ public abstract class GT_MetaTileEntity_BasicMachine extends GT_MetaTileEntity_B if (ItemList.Display_Fluid.isStackEqual(mInventory[tDisplayStackSlot], true, true)) mInventory[tDisplayStackSlot] = null; } else { - mInventory[tDisplayStackSlot] = GT_Utility - .getFluidDisplayStack(getFillableStack(), true, !displaysStackSize()); + mInventory[tDisplayStackSlot] = GT_Utility.getFluidDisplayStack( + getFillableStack(), + true, + !displaysStackSize()); } } } @@ -1058,11 +1061,26 @@ public abstract class GT_MetaTileEntity_BasicMachine extends GT_MetaTileEntity_B public static boolean isValidForLowGravity(GT_Recipe tRecipe, int dimId) { return // TODO check or get a better solution - DimensionManager.getProvider(dimId).getClass().getName().contains("Orbit") - || DimensionManager.getProvider(dimId).getClass().getName().endsWith("Space") - || DimensionManager.getProvider(dimId).getClass().getName().endsWith("Asteroids") - || DimensionManager.getProvider(dimId).getClass().getName().endsWith("SS") - || DimensionManager.getProvider(dimId).getClass().getName().contains("SpaceStation"); + DimensionManager.getProvider(dimId) + .getClass() + .getName() + .contains("Orbit") + || DimensionManager.getProvider(dimId) + .getClass() + .getName() + .endsWith("Space") + || DimensionManager.getProvider(dimId) + .getClass() + .getName() + .endsWith("Asteroids") + || DimensionManager.getProvider(dimId) + .getClass() + .getName() + .endsWith("SS") + || DimensionManager.getProvider(dimId) + .getClass() + .getName() + .contains("SpaceStation"); } /** @@ -1213,12 +1231,14 @@ public abstract class GT_MetaTileEntity_BasicMachine extends GT_MetaTileEntity_B currenttip.add( String.format( "Machine Facing: %s", - ForgeDirection.getOrientation(tag.getInteger("mainFacingSingleBlock")).name())); + ForgeDirection.getOrientation(tag.getInteger("mainFacingSingleBlock")) + .name())); currenttip.add( String.format( "Output Facing: %s", - ForgeDirection.getOrientation(tag.getInteger("outputFacingSingleBlock")).name())); + ForgeDirection.getOrientation(tag.getInteger("outputFacingSingleBlock")) + .name())); } @Override @@ -1267,8 +1287,9 @@ public abstract class GT_MetaTileEntity_BasicMachine extends GT_MetaTileEntity_B getRecipeList().addGregTechLogoUI(builder, new Pos2d(0, 0)); } else { builder.widget( - new DrawableWidget().setDrawable(getGUITextureSet().getGregTechLogo()).setSize(17, 17) - .setPos(152, 63)); + new DrawableWidget().setDrawable(getGUITextureSet().getGregTechLogo()) + .setSize(17, 17) + .setPos(152, 63)); } } @@ -1331,7 +1352,8 @@ public abstract class GT_MetaTileEntity_BasicMachine extends GT_MetaTileEntity_B */ protected SlotWidget createItemInputSlot(int index, IDrawable[] backgrounds, Pos2d pos) { return (SlotWidget) new SlotWidget(inventoryHandler, getInputSlot() + index).setAccess(true, true) - .setBackground(backgrounds).setPos(pos); + .setBackground(backgrounds) + .setPos(pos); } /** @@ -1339,7 +1361,8 @@ public abstract class GT_MetaTileEntity_BasicMachine extends GT_MetaTileEntity_B */ protected SlotWidget createItemOutputSlot(int index, IDrawable[] backgrounds, Pos2d pos) { return (SlotWidget) new SlotWidget(inventoryHandler, getOutputSlot() + index).setAccess(true, false) - .setBackground(backgrounds).setPos(pos); + .setBackground(backgrounds) + .setPos(pos); } /** @@ -1347,46 +1370,71 @@ public abstract class GT_MetaTileEntity_BasicMachine extends GT_MetaTileEntity_B */ protected SlotWidget createSpecialSlot(IDrawable[] backgrounds, Pos2d pos) { return (SlotWidget) new SlotWidget(inventoryHandler, getSpecialSlotIndex()).setAccess(true, true) - .disableShiftInsert() - .setGTTooltip( - () -> mTooltipCache.getData( - getRecipeList() != null && getRecipeList().usesSpecialSlot() ? SPECIAL_SLOT_TOOLTIP - : UNUSED_SLOT_TOOLTIP)) - .setTooltipShowUpDelay(TOOLTIP_DELAY).setBackground(backgrounds).setPos(pos); + .disableShiftInsert() + .setGTTooltip( + () -> mTooltipCache.getData( + getRecipeList() + != null + && getRecipeList().usesSpecialSlot() + ? SPECIAL_SLOT_TOOLTIP + : UNUSED_SLOT_TOOLTIP)) + .setTooltipShowUpDelay(TOOLTIP_DELAY) + .setBackground(backgrounds) + .setPos(pos); } protected FluidDisplaySlotWidget createFluidInputSlot(IDrawable[] backgrounds, Pos2d pos) { return (FluidDisplaySlotWidget) new FluidDisplaySlotWidget( inventoryHandler, OTHER_SLOT_COUNT + mInputSlotCount + mOutputItems.length) - .setFluidAccessConstructor(() -> constructFluidAccess(true)).setIHasFluidDisplay(this) - .setCanDrain(true).setCanFill(true).setActionRealClick(FluidDisplaySlotWidget.Action.TRANSFER) - .setBeforeRealClick((clickData, widget) -> { - if (NetworkUtils.isClient()) { - // propagate display item content to actual fluid stored in this tank - setFillableStack(GT_Utility.getFluidFromDisplayStack(widget.getMcSlot().getStack())); - } - return true; - }).setUpdateFluidDisplayItem(this::updateFluidInputDisplayItem) - .setGTTooltip( - () -> mTooltipCache - .getData(FLUID_INPUT_TOOLTIP, GT_Utility.formatNumbers(getCapacity()))) - .setTooltipShowUpDelay(TOOLTIP_DELAY).setBackground(backgrounds).setPos(pos); + .setFluidAccessConstructor( + () -> constructFluidAccess(true)) + .setIHasFluidDisplay(this) + .setCanDrain(true) + .setCanFill(true) + .setActionRealClick( + FluidDisplaySlotWidget.Action.TRANSFER) + .setBeforeRealClick((clickData, widget) -> { + if (NetworkUtils.isClient()) { + // propagate display item content to + // actual fluid stored in this tank + setFillableStack( + GT_Utility.getFluidFromDisplayStack( + widget.getMcSlot() + .getStack())); + } + return true; + }) + .setUpdateFluidDisplayItem( + this::updateFluidInputDisplayItem) + .setGTTooltip( + () -> mTooltipCache.getData( + FLUID_INPUT_TOOLTIP, + GT_Utility.formatNumbers( + getCapacity()))) + .setTooltipShowUpDelay(TOOLTIP_DELAY) + .setBackground(backgrounds) + .setPos(pos); } protected FluidDisplaySlotWidget createFluidOutputSlot(IDrawable[] backgrounds, Pos2d pos) { - return (FluidDisplaySlotWidget) createDrainableFluidSlot() - .setUpdateFluidDisplayItem(this::updateFluidOutputDisplayItem) - .setGTTooltip( - () -> mTooltipCache.getData(FLUID_OUTPUT_TOOLTIP, GT_Utility.formatNumbers(getCapacity()))) - .setTooltipShowUpDelay(TOOLTIP_DELAY).setBackground(backgrounds).setPos(pos); + return (FluidDisplaySlotWidget) createDrainableFluidSlot().setUpdateFluidDisplayItem( + this::updateFluidOutputDisplayItem) + .setGTTooltip( + () -> mTooltipCache.getData( + FLUID_OUTPUT_TOOLTIP, + GT_Utility.formatNumbers( + getCapacity()))) + .setTooltipShowUpDelay(TOOLTIP_DELAY) + .setBackground(backgrounds) + .setPos(pos); } @Override protected SlotWidget createChargerSlot(int x, int y) { if (isSteampowered()) { - return (SlotWidget) createChargerSlot(x, y, UNUSED_SLOT_TOOLTIP, new String[0]) - .setBackground(getGUITextureSet().getItemSlot()); + return (SlotWidget) createChargerSlot(x, y, UNUSED_SLOT_TOOLTIP, new String[0]).setBackground( + getGUITextureSet().getItemSlot()); } else { return super.createChargerSlot(x, y); } @@ -1394,25 +1442,36 @@ public abstract class GT_MetaTileEntity_BasicMachine extends GT_MetaTileEntity_B protected CycleButtonWidget createItemAutoOutputButton() { return (CycleButtonWidget) new CycleButtonWidget().setToggle(() -> mItemTransfer, val -> mItemTransfer = val) - .setStaticTexture(GT_UITextures.OVERLAY_BUTTON_AUTOOUTPUT_ITEM) - .setVariableBackground(GT_UITextures.BUTTON_STANDARD_TOGGLE) - .setGTTooltip(() -> mTooltipCache.getData(ITEM_TRANSFER_TOOLTIP)).setTooltipShowUpDelay(TOOLTIP_DELAY) - .setPos(25, 62).setSize(18, 18); + .setStaticTexture( + GT_UITextures.OVERLAY_BUTTON_AUTOOUTPUT_ITEM) + .setVariableBackground(GT_UITextures.BUTTON_STANDARD_TOGGLE) + .setGTTooltip( + () -> mTooltipCache.getData(ITEM_TRANSFER_TOOLTIP)) + .setTooltipShowUpDelay(TOOLTIP_DELAY) + .setPos(25, 62) + .setSize(18, 18); } protected CycleButtonWidget createFluidAutoOutputButton() { return (CycleButtonWidget) new CycleButtonWidget().setToggle(() -> mFluidTransfer, val -> mFluidTransfer = val) - .setStaticTexture(GT_UITextures.OVERLAY_BUTTON_AUTOOUTPUT_FLUID) - .setVariableBackground(GT_UITextures.BUTTON_STANDARD_TOGGLE) - .setGTTooltip(() -> mTooltipCache.getData(FLUID_TRANSFER_TOOLTIP)).setTooltipShowUpDelay(TOOLTIP_DELAY) - .setPos(7, 62).setSize(18, 18); + .setStaticTexture( + GT_UITextures.OVERLAY_BUTTON_AUTOOUTPUT_FLUID) + .setVariableBackground(GT_UITextures.BUTTON_STANDARD_TOGGLE) + .setGTTooltip( + () -> mTooltipCache.getData(FLUID_TRANSFER_TOOLTIP)) + .setTooltipShowUpDelay(TOOLTIP_DELAY) + .setPos(7, 62) + .setSize(18, 18); } protected ProgressBar createProgressBar(UITexture texture, int imageSize, ProgressBar.Direction direction, Pos2d pos, Size size) { final ProgressBar ret = new ProgressBar(); ret.setProgress(() -> maxProgresstime() != 0 ? (float) getProgresstime() / maxProgresstime() : 0) - .setTexture(texture, imageSize).setDirection(direction).setPos(pos).setSize(size); + .setTexture(texture, imageSize) + .setDirection(direction) + .setPos(pos) + .setSize(size); return ret; } @@ -1425,11 +1484,13 @@ public abstract class GT_MetaTileEntity_BasicMachine extends GT_MetaTileEntity_B final Power powerInfo = getPower(); final String transferRectTooltip; if (isSteampowered()) { - transferRectTooltip = StatCollector - .translateToLocalFormatted(NEI_TRANSFER_STEAM_TOOLTIP, powerInfo.getTierString()); + transferRectTooltip = StatCollector.translateToLocalFormatted( + NEI_TRANSFER_STEAM_TOOLTIP, + powerInfo.getTierString()); } else { - transferRectTooltip = StatCollector - .translateToLocalFormatted(NEI_TRANSFER_VOLTAGE_TOOLTIP, powerInfo.getTierString()); + transferRectTooltip = StatCollector.translateToLocalFormatted( + NEI_TRANSFER_VOLTAGE_TOOLTIP, + powerInfo.getTierString()); } widget.setNEITransferRect(transferRectID, new Object[] { powerInfo }, transferRectTooltip); } @@ -1440,34 +1501,53 @@ public abstract class GT_MetaTileEntity_BasicMachine extends GT_MetaTileEntity_B if (isSteampowered()) { for (Pair<SteamTexture, Pair<Size, Pos2d>> specialTexture : getRecipeList().specialTexturesSteam) { builder.widget( - new DrawableWidget().setDrawable(specialTexture.getLeft().get(getSteamVariant())) - .setSize(specialTexture.getRight().getLeft()) - .setPos(specialTexture.getRight().getRight())); + new DrawableWidget().setDrawable( + specialTexture.getLeft() + .get(getSteamVariant())) + .setSize( + specialTexture.getRight() + .getLeft()) + .setPos( + specialTexture.getRight() + .getRight())); } } else { for (Pair<IDrawable, Pair<Size, Pos2d>> specialTexture : getRecipeList().specialTextures) { builder.widget( new DrawableWidget().setDrawable(specialTexture.getLeft()) - .setSize(specialTexture.getRight().getLeft()) - .setPos(specialTexture.getRight().getRight())); + .setSize( + specialTexture.getRight() + .getLeft()) + .setPos( + specialTexture.getRight() + .getRight())); } } } protected DrawableWidget createErrorStatusArea(ModularWindow.Builder builder, IDrawable picture) { - return (DrawableWidget) new DrawableWidget().setDrawable(picture).setTooltipShowUpDelay(TOOLTIP_DELAY) - .setEnabled(widget -> !widget.getTooltip().isEmpty()).dynamicTooltip(this::getErrorDescriptions) - .dynamicTooltipShift(this::getErrorDescriptionsShift).setPos(79, 44).setSize(18, 18) - .attachSyncer( - new FakeSyncWidget.BooleanSyncer(() -> mStuttering, val -> mStuttering = val), - builder, - (widget, val) -> widget.notifyTooltipChange()) - .attachSyncer( - new FakeSyncWidget.IntegerSyncer( - () -> getBaseMetaTileEntity().getErrorDisplayID(), - val -> getBaseMetaTileEntity().setErrorDisplayID(val)), - builder, - (widget, val) -> widget.notifyTooltipChange()); + return (DrawableWidget) new DrawableWidget().setDrawable(picture) + .setTooltipShowUpDelay(TOOLTIP_DELAY) + .setEnabled( + widget -> !widget.getTooltip() + .isEmpty()) + .dynamicTooltip(this::getErrorDescriptions) + .dynamicTooltipShift(this::getErrorDescriptionsShift) + .setPos(79, 44) + .setSize(18, 18) + .attachSyncer( + new FakeSyncWidget.BooleanSyncer( + () -> mStuttering, + val -> mStuttering = val), + builder, + (widget, val) -> widget.notifyTooltipChange()) + .attachSyncer( + new FakeSyncWidget.IntegerSyncer( + () -> getBaseMetaTileEntity().getErrorDisplayID(), + val -> getBaseMetaTileEntity().setErrorDisplayID( + val)), + builder, + (widget, val) -> widget.notifyTooltipChange()); } protected List<String> getErrorDescriptions() { diff --git a/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_BasicMachine_Bronze.java b/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_BasicMachine_Bronze.java index 4098831e48..934554dfbc 100644 --- a/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_BasicMachine_Bronze.java +++ b/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_BasicMachine_Bronze.java @@ -174,18 +174,30 @@ public abstract class GT_MetaTileEntity_BasicMachine_Bronze extends GT_MetaTileE mNeedsSteamVenting = false; try { for (EntityLivingBase tLiving : (ArrayList<EntityLivingBase>) getBaseMetaTileEntity().getWorld() - .getEntitiesWithinAABB( - EntityLivingBase.class, - AxisAlignedBB.getBoundingBox( - getBaseMetaTileEntity().getOffsetX(getBaseMetaTileEntity().getFrontFacing(), 1), - getBaseMetaTileEntity().getOffsetY(getBaseMetaTileEntity().getFrontFacing(), 1), - getBaseMetaTileEntity().getOffsetZ(getBaseMetaTileEntity().getFrontFacing(), 1), - getBaseMetaTileEntity().getOffsetX(getBaseMetaTileEntity().getFrontFacing(), 1) - + 1, - getBaseMetaTileEntity().getOffsetY(getBaseMetaTileEntity().getFrontFacing(), 1) - + 1, - getBaseMetaTileEntity().getOffsetZ(getBaseMetaTileEntity().getFrontFacing(), 1) - + 1))) { + .getEntitiesWithinAABB( + EntityLivingBase.class, + AxisAlignedBB.getBoundingBox( + getBaseMetaTileEntity().getOffsetX( + getBaseMetaTileEntity().getFrontFacing(), + 1), + getBaseMetaTileEntity().getOffsetY( + getBaseMetaTileEntity().getFrontFacing(), + 1), + getBaseMetaTileEntity().getOffsetZ( + getBaseMetaTileEntity().getFrontFacing(), + 1), + getBaseMetaTileEntity().getOffsetX( + getBaseMetaTileEntity().getFrontFacing(), + 1) + + 1, + getBaseMetaTileEntity().getOffsetY( + getBaseMetaTileEntity().getFrontFacing(), + 1) + + 1, + getBaseMetaTileEntity().getOffsetZ( + getBaseMetaTileEntity().getFrontFacing(), + 1) + + 1))) { GT_Utility.applyHeatDamage(tLiving, getSteamDamage()); } } catch (Throwable e) { @@ -230,17 +242,22 @@ public abstract class GT_MetaTileEntity_BasicMachine_Bronze extends GT_MetaTileE if (aIndex == 9) { GT_Utility.doSoundAtClient(SoundResource.RANDOM_FIZZ, 5, 1.0F, aX, aY, aZ); - new ParticleEventBuilder().setIdentifier(ParticleFX.CLOUD).setWorld(getBaseMetaTileEntity().getWorld()) - .setMotion( - ForgeDirection.getOrientation(getBaseMetaTileEntity().getFrontFacing()).offsetX / 5.0, - ForgeDirection.getOrientation(getBaseMetaTileEntity().getFrontFacing()).offsetY / 5.0, - ForgeDirection.getOrientation(getBaseMetaTileEntity().getFrontFacing()).offsetZ / 5.0) - .<ParticleEventBuilder>times( - 8, - x -> x.setPosition( - aX - 0.5 + XSTR_INSTANCE.nextFloat(), - aY - 0.5 + XSTR_INSTANCE.nextFloat(), - aZ - 0.5 + XSTR_INSTANCE.nextFloat()).run()); + new ParticleEventBuilder().setIdentifier(ParticleFX.CLOUD) + .setWorld(getBaseMetaTileEntity().getWorld()) + .setMotion( + ForgeDirection.getOrientation( + getBaseMetaTileEntity().getFrontFacing()).offsetX / 5.0, + ForgeDirection.getOrientation( + getBaseMetaTileEntity().getFrontFacing()).offsetY / 5.0, + ForgeDirection.getOrientation( + getBaseMetaTileEntity().getFrontFacing()).offsetZ / 5.0) + .<ParticleEventBuilder>times( + 8, + x -> x.setPosition( + aX - 0.5 + XSTR_INSTANCE.nextFloat(), + aY - 0.5 + XSTR_INSTANCE.nextFloat(), + aZ - 0.5 + XSTR_INSTANCE.nextFloat()) + .run()); } } @@ -251,7 +268,8 @@ public abstract class GT_MetaTileEntity_BasicMachine_Bronze extends GT_MetaTileE @Override public boolean allowCoverOnSide(byte aSide, GT_ItemStack aCoverID) { - return GregTech_API.getCoverBehaviorNew(aCoverID.toStack()).isSimpleCover() + return GregTech_API.getCoverBehaviorNew(aCoverID.toStack()) + .isSimpleCover() && super.allowCoverOnSide(aSide, aCoverID); } @@ -370,7 +388,9 @@ public abstract class GT_MetaTileEntity_BasicMachine_Bronze extends GT_MetaTileE @Override public void addGregTechLogo(ModularWindow.Builder builder) { builder.widget( - new DrawableWidget().setDrawable(getGUITextureSet().getGregTechLogo()).setSize(17, 17).setPos(152, 63)); + new DrawableWidget().setDrawable(getGUITextureSet().getGregTechLogo()) + .setSize(17, 17) + .setPos(152, 63)); } @Override diff --git a/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_BasicMachine_GT_Recipe.java b/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_BasicMachine_GT_Recipe.java index e51da3bbdc..5331f67dca 100644 --- a/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_BasicMachine_GT_Recipe.java +++ b/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_BasicMachine_GT_Recipe.java @@ -81,84 +81,92 @@ public class GT_MetaTileEntity_BasicMachine_GT_Recipe extends GT_MetaTileEntity_ "basicmachines/" + aOverlays.toLowerCase(Locale.ENGLISH) + "/OVERLAY_SIDE_ACTIVE")), TextureFactory.builder() - .addIcon( - (new CustomIcon( - "basicmachines/" + aOverlays.toLowerCase(Locale.ENGLISH) - + "/OVERLAY_SIDE_ACTIVE_GLOW"))) - .glow().build()), + .addIcon( + (new CustomIcon( + "basicmachines/" + aOverlays.toLowerCase(Locale.ENGLISH) + + "/OVERLAY_SIDE_ACTIVE_GLOW"))) + .glow() + .build()), TextureFactory.of( TextureFactory.of( new CustomIcon( "basicmachines/" + aOverlays.toLowerCase(Locale.ENGLISH) + "/OVERLAY_SIDE")), TextureFactory.builder() - .addIcon( - (new CustomIcon( - "basicmachines/" + aOverlays.toLowerCase(Locale.ENGLISH) - + "/OVERLAY_SIDE_GLOW"))) - .glow().build()), + .addIcon( + (new CustomIcon( + "basicmachines/" + aOverlays.toLowerCase(Locale.ENGLISH) + + "/OVERLAY_SIDE_GLOW"))) + .glow() + .build()), TextureFactory.of( TextureFactory.of( new CustomIcon( "basicmachines/" + aOverlays.toLowerCase(Locale.ENGLISH) + "/OVERLAY_FRONT_ACTIVE")), TextureFactory.builder() - .addIcon( - (new CustomIcon( - "basicmachines/" + aOverlays.toLowerCase(Locale.ENGLISH) - + "/OVERLAY_FRONT_ACTIVE_GLOW"))) - .glow().build()), + .addIcon( + (new CustomIcon( + "basicmachines/" + aOverlays.toLowerCase(Locale.ENGLISH) + + "/OVERLAY_FRONT_ACTIVE_GLOW"))) + .glow() + .build()), TextureFactory.of( TextureFactory.of( new CustomIcon( "basicmachines/" + aOverlays.toLowerCase(Locale.ENGLISH) + "/OVERLAY_FRONT")), TextureFactory.builder() - .addIcon( - (new CustomIcon( - "basicmachines/" + aOverlays.toLowerCase(Locale.ENGLISH) - + "/OVERLAY_FRONT_GLOW"))) - .glow().build()), + .addIcon( + (new CustomIcon( + "basicmachines/" + aOverlays.toLowerCase(Locale.ENGLISH) + + "/OVERLAY_FRONT_GLOW"))) + .glow() + .build()), TextureFactory.of( TextureFactory.of( new CustomIcon( "basicmachines/" + aOverlays.toLowerCase(Locale.ENGLISH) + "/OVERLAY_TOP_ACTIVE")), TextureFactory.builder() - .addIcon( - (new CustomIcon( - "basicmachines/" + aOverlays.toLowerCase(Locale.ENGLISH) - + "/OVERLAY_TOP_ACTIVE_GLOW"))) - .glow().build()), + .addIcon( + (new CustomIcon( + "basicmachines/" + aOverlays.toLowerCase(Locale.ENGLISH) + + "/OVERLAY_TOP_ACTIVE_GLOW"))) + .glow() + .build()), TextureFactory.of( TextureFactory.of( new CustomIcon( "basicmachines/" + aOverlays.toLowerCase(Locale.ENGLISH) + "/OVERLAY_TOP")), TextureFactory.builder() - .addIcon( - (new CustomIcon( - "basicmachines/" + aOverlays.toLowerCase(Locale.ENGLISH) - + "/OVERLAY_TOP_GLOW"))) - .glow().build()), + .addIcon( + (new CustomIcon( + "basicmachines/" + aOverlays.toLowerCase(Locale.ENGLISH) + + "/OVERLAY_TOP_GLOW"))) + .glow() + .build()), TextureFactory.of( TextureFactory.of( new CustomIcon( "basicmachines/" + aOverlays.toLowerCase(Locale.ENGLISH) + "/OVERLAY_BOTTOM_ACTIVE")), TextureFactory.builder() - .addIcon( - (new CustomIcon( - "basicmachines/" + aOverlays.toLowerCase(Locale.ENGLISH) - + "/OVERLAY_BOTTOM_ACTIVE_GLOW"))) - .glow().build()), + .addIcon( + (new CustomIcon( + "basicmachines/" + aOverlays.toLowerCase(Locale.ENGLISH) + + "/OVERLAY_BOTTOM_ACTIVE_GLOW"))) + .glow() + .build()), TextureFactory.of( TextureFactory.of( new CustomIcon( "basicmachines/" + aOverlays.toLowerCase(Locale.ENGLISH) + "/OVERLAY_BOTTOM")), TextureFactory.builder() - .addIcon( - (new CustomIcon( - "basicmachines/" + aOverlays.toLowerCase(Locale.ENGLISH) - + "/OVERLAY_BOTTOM_GLOW"))) - .glow().build())); + .addIcon( + (new CustomIcon( + "basicmachines/" + aOverlays.toLowerCase(Locale.ENGLISH) + + "/OVERLAY_BOTTOM_GLOW"))) + .glow() + .build())); this.mSharedTank = aSharedTank; this.mTankCapacity = aTankCapacity; this.mSpecialEffect = aSpecialEffect; @@ -1058,23 +1066,11 @@ public class GT_MetaTileEntity_BasicMachine_GT_Recipe extends GT_MetaTileEntity_ case 0: return false; case 1: - if (this.getFillableStack() == null) - return !this.mRequiresFluidForFiltering && this.getRecipeList().containsInput(aStack); - else return this.getRecipeList().findRecipe( - this.getBaseMetaTileEntity(), - this.mLastRecipe, - true, - true, - V[this.mTier], - new FluidStack[] { this.getFillableStack() }, - this.getSpecialSlot(), - appendSelectedCircuit(aStack)) != null; - case 2: - return (!this.mRequiresFluidForFiltering || this.getFillableStack() != null) && (((this.getInputAt(0) - != null && this.getInputAt(1) != null) - || (this.getInputAt(0) == null && this.getInputAt(1) == null - ? this.getRecipeList().containsInput(aStack) - : (this.getRecipeList().containsInput(aStack) && this.getRecipeList().findRecipe( + if (this.getFillableStack() == null) return !this.mRequiresFluidForFiltering && this.getRecipeList() + .containsInput( + aStack); + else return this.getRecipeList() + .findRecipe( this.getBaseMetaTileEntity(), this.mLastRecipe, true, @@ -1082,12 +1078,31 @@ public class GT_MetaTileEntity_BasicMachine_GT_Recipe extends GT_MetaTileEntity_ V[this.mTier], new FluidStack[] { this.getFillableStack() }, this.getSpecialSlot(), - aIndex == this.getInputSlot() - ? appendSelectedCircuit(aStack, this.getInputAt(1)) - : appendSelectedCircuit(this.getInputAt(0), aStack)) - != null)))); + appendSelectedCircuit(aStack)) + != null; + case 2: + return (!this.mRequiresFluidForFiltering || this.getFillableStack() != null) && (((this.getInputAt(0) + != null && this.getInputAt(1) != null) + || (this.getInputAt(0) == null && this.getInputAt(1) == null ? this.getRecipeList() + .containsInput(aStack) + : (this.getRecipeList() + .containsInput(aStack) + && this.getRecipeList() + .findRecipe( + this.getBaseMetaTileEntity(), + this.mLastRecipe, + true, + true, + V[this.mTier], + new FluidStack[] { this.getFillableStack() }, + this.getSpecialSlot(), + aIndex == this.getInputSlot() + ? appendSelectedCircuit(aStack, this.getInputAt(1)) + : appendSelectedCircuit(this.getInputAt(0), aStack)) + != null)))); default: { - int tID = this.getBaseMetaTileEntity().getMetaTileID(); + int tID = this.getBaseMetaTileEntity() + .getMetaTileID(); if (tID >= 211 && tID <= 218 || tID >= 1180 && tID <= 1187 || tID >= 10780 && tID <= 10786) { // assembler // lv-iv; // circuit @@ -1097,10 +1112,13 @@ public class GT_MetaTileEntity_BasicMachine_GT_Recipe extends GT_MetaTileEntity_ // assemblers // luv-uev if (GT_Utility.isStackValid(aStack)) for (int oreID : OreDictionary.getOreIDs(aStack)) { - if (OreDictionary.getOreName(oreID).startsWith("circuit")) return true; + if (OreDictionary.getOreName(oreID) + .startsWith("circuit")) + return true; } } - return this.getRecipeList().containsInput(aStack); + return this.getRecipeList() + .containsInput(aStack); } } } @@ -1124,12 +1142,22 @@ public class GT_MetaTileEntity_BasicMachine_GT_Recipe extends GT_MetaTileEntity_ && !aBaseMetaTileEntity.getOpacityAtSide(topFacing)) { new WorldSpawnedEventBuilder.ParticleEventBuilder().setMotion(0.0D, 0.0D, 0.0D) - .setIdentifier(ParticleFX.SMOKE) - .setPosition( - aBaseMetaTileEntity.getXCoord() + 0.8F - XSTR_INSTANCE.nextFloat() * 0.6F, - aBaseMetaTileEntity.getYCoord() + 0.9F + XSTR_INSTANCE.nextFloat() * 0.2F, - aBaseMetaTileEntity.getZCoord() + 0.8F - XSTR_INSTANCE.nextFloat() * 0.6F) - .setWorld(aBaseMetaTileEntity.getWorld()).run(); + .setIdentifier(ParticleFX.SMOKE) + .setPosition( + aBaseMetaTileEntity.getXCoord() + + 0.8F + - XSTR_INSTANCE.nextFloat() + * 0.6F, + aBaseMetaTileEntity.getYCoord() + + 0.9F + + XSTR_INSTANCE.nextFloat() + * 0.2F, + aBaseMetaTileEntity.getZCoord() + + 0.8F + - XSTR_INSTANCE.nextFloat() + * 0.6F) + .setWorld(aBaseMetaTileEntity.getWorld()) + .run(); } break; default: @@ -1192,8 +1220,11 @@ public class GT_MetaTileEntity_BasicMachine_GT_Recipe extends GT_MetaTileEntity_ } ParticleEventBuilder particleEventBuilder = (new ParticleEventBuilder()).setMotion(mX, 0, mZ) - .setPosition(x, y, z).setWorld(getBaseMetaTileEntity().getWorld()); - particleEventBuilder.setIdentifier(ParticleFX.LAVA).run(); + .setPosition(x, y, z) + .setWorld( + getBaseMetaTileEntity().getWorld()); + particleEventBuilder.setIdentifier(ParticleFX.LAVA) + .run(); } } break; @@ -1253,8 +1284,9 @@ public class GT_MetaTileEntity_BasicMachine_GT_Recipe extends GT_MetaTileEntity_ @Override protected ProgressBar createProgressBar(UITexture texture, int imageSize, ProgressBar.Direction direction, Pos2d pos, Size size) { - return super.createProgressBar(texture, imageSize, direction, pos, size) - .setTexture(progressBarTexture.get(), mRecipes.getProgressBarImageSize()); + return super.createProgressBar(texture, imageSize, direction, pos, size).setTexture( + progressBarTexture.get(), + mRecipes.getProgressBarImageSize()); } public enum X { diff --git a/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_BasicTank.java b/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_BasicTank.java index 1286c84c9b..193d654af6 100644 --- a/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_BasicTank.java +++ b/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_BasicTank.java @@ -208,8 +208,11 @@ public abstract class GT_MetaTileEntity_BasicTank extends GT_MetaTileEntity_Tier } if (doesFillContainers()) { - ItemStack tOutput = GT_Utility - .fillFluidContainer(getDrainableStack(), mInventory[getInputSlot()], false, true); + ItemStack tOutput = GT_Utility.fillFluidContainer( + getDrainableStack(), + mInventory[getInputSlot()], + false, + true); if (tOutput != null && aBaseMetaTileEntity.addStackToSlot(getOutputSlot(), tOutput, 1)) { FluidStack tFluid = GT_Utility.getFluidForFilledItem(tOutput, true); aBaseMetaTileEntity.decrStackSize(getInputSlot(), 1); @@ -227,8 +230,10 @@ public abstract class GT_MetaTileEntity_BasicTank extends GT_MetaTileEntity_Tier if (ItemList.Display_Fluid.isStackEqual(mInventory[getStackDisplaySlot()], true, true)) mInventory[getStackDisplaySlot()] = null; } else { - mInventory[getStackDisplaySlot()] = GT_Utility - .getFluidDisplayStack(getDisplayedFluid(), true, !displaysStackSize()); + mInventory[getStackDisplaySlot()] = GT_Utility.getFluidDisplayStack( + getDisplayedFluid(), + true, + !displaysStackSize()); } } } @@ -245,13 +250,14 @@ public abstract class GT_MetaTileEntity_BasicTank extends GT_MetaTileEntity_Tier @Override public int fill(FluidStack aFluid, boolean doFill) { - if (aFluid == null || aFluid.getFluid().getID() <= 0 - || aFluid.amount <= 0 - || !canTankBeFilled() - || !isFluidInputAllowed(aFluid)) + if (aFluid == null || aFluid.getFluid() + .getID() + <= 0 || aFluid.amount <= 0 || !canTankBeFilled() || !isFluidInputAllowed(aFluid)) return 0; - if (getFillableStack() == null || getFillableStack().getFluid().getID() <= 0) { + if (getFillableStack() == null || getFillableStack().getFluid() + .getID() + <= 0) { if (aFluid.amount <= getCapacity()) { if (doFill) { setFillableStack(aFluid.copy()); @@ -337,34 +343,56 @@ public abstract class GT_MetaTileEntity_BasicTank extends GT_MetaTileEntity_Tier @Override public void addUIWidgets(ModularWindow.Builder builder, UIBuildContext buildContext) { builder.widget( - new DrawableWidget().setDrawable(GT_UITextures.PICTURE_SCREEN_BLACK).setPos(7, 16).setSize(71, 45)) - .widget(new DrawableWidget().setDrawable(GT_UITextures.PICTURE_GAUGE).setPos(79, 34).setSize(18, 18)) - .widget( - new SlotWidget(inventoryHandler, getInputSlot()) - .setBackground(getGUITextureSet().getItemSlot(), GT_UITextures.OVERLAY_SLOT_IN) - .setPos(79, 16)) - .widget( - new SlotWidget(inventoryHandler, getOutputSlot()) - .setBackground(getGUITextureSet().getItemSlot(), GT_UITextures.OVERLAY_SLOT_OUT) - .setPos(79, 52)) - .widget(createDrainableFluidSlot().setBackground(GT_UITextures.TRANSPARENT).setPos(58, 41)) - .widget(new TextWidget("Liquid Amount").setDefaultColor(COLOR_TEXT_WHITE.get()).setPos(10, 20)).widget( - TextWidget - .dynamicString(() -> GT_Utility.parseNumberToString(mFluid != null ? mFluid.amount : 0)) - .setDefaultColor(COLOR_TEXT_WHITE.get()).setPos(10, 30)); + new DrawableWidget().setDrawable(GT_UITextures.PICTURE_SCREEN_BLACK) + .setPos(7, 16) + .setSize(71, 45)) + .widget( + new DrawableWidget().setDrawable(GT_UITextures.PICTURE_GAUGE) + .setPos(79, 34) + .setSize(18, 18)) + .widget( + new SlotWidget(inventoryHandler, getInputSlot()) + .setBackground( + getGUITextureSet().getItemSlot(), + GT_UITextures.OVERLAY_SLOT_IN) + .setPos(79, 16)) + .widget( + new SlotWidget(inventoryHandler, getOutputSlot()) + .setBackground( + getGUITextureSet().getItemSlot(), + GT_UITextures.OVERLAY_SLOT_OUT) + .setPos(79, 52)) + .widget( + createDrainableFluidSlot().setBackground(GT_UITextures.TRANSPARENT) + .setPos(58, 41)) + .widget( + new TextWidget("Liquid Amount").setDefaultColor(COLOR_TEXT_WHITE.get()) + .setPos(10, 20)) + .widget( + TextWidget.dynamicString( + () -> GT_Utility.parseNumberToString(mFluid != null ? mFluid.amount : 0)) + .setDefaultColor(COLOR_TEXT_WHITE.get()) + .setPos(10, 30)); } protected FluidDisplaySlotWidget createDrainableFluidSlot() { - return new FluidDisplaySlotWidget(inventoryHandler, getStackDisplaySlot()) - .setFluidAccessConstructor(() -> constructFluidAccess(false)).setIHasFluidDisplay(this) - .setCanDrain(true).setCanFill(!isDrainableStackSeparate()) - .setActionRealClick(FluidDisplaySlotWidget.Action.TRANSFER).setBeforeRealClick((clickData, widget) -> { - if (NetworkUtils.isClient()) { - // propagate display item content to actual fluid stored in this tank - setDrainableStack(GT_Utility.getFluidFromDisplayStack(widget.getMcSlot().getStack())); - } - return true; - }); + return new FluidDisplaySlotWidget( + inventoryHandler, + getStackDisplaySlot()).setFluidAccessConstructor(() -> constructFluidAccess(false)) + .setIHasFluidDisplay(this) + .setCanDrain(true) + .setCanFill(!isDrainableStackSeparate()) + .setActionRealClick(FluidDisplaySlotWidget.Action.TRANSFER) + .setBeforeRealClick((clickData, widget) -> { + if (NetworkUtils.isClient()) { + // propagate display item content to actual fluid stored in this tank + setDrainableStack( + GT_Utility.getFluidFromDisplayStack( + widget.getMcSlot() + .getStack())); + } + return true; + }); } protected IFluidAccess constructFluidAccess(boolean aIsFillableStack) { diff --git a/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_Buffer.java b/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_Buffer.java index 827f2b2ec9..1138b0a51d 100644 --- a/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_Buffer.java +++ b/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_Buffer.java @@ -61,14 +61,30 @@ public abstract class GT_MetaTileEntity_Buffer extends GT_MetaTileEntity_TieredM ITexture[][][] rTextures = new ITexture[ForgeDirection.VALID_DIRECTIONS.length][17][]; ITexture tIcon = getOverlayIcon(); ITexture tOut = TextureFactory.of(OVERLAY_PIPE_OUT); - ITexture tUp = TextureFactory - .of(TextureFactory.of(ARROW_UP), TextureFactory.builder().addIcon(ARROW_UP_GLOW).glow().build()); - ITexture tDown = TextureFactory - .of(TextureFactory.of(ARROW_DOWN), TextureFactory.builder().addIcon(ARROW_DOWN_GLOW).glow().build()); - ITexture tLeft = TextureFactory - .of(TextureFactory.of(ARROW_LEFT), TextureFactory.builder().addIcon(ARROW_LEFT_GLOW).glow().build()); - ITexture tRight = TextureFactory - .of(TextureFactory.of(ARROW_RIGHT), TextureFactory.builder().addIcon(ARROW_RIGHT_GLOW).glow().build()); + ITexture tUp = TextureFactory.of( + TextureFactory.of(ARROW_UP), + TextureFactory.builder() + .addIcon(ARROW_UP_GLOW) + .glow() + .build()); + ITexture tDown = TextureFactory.of( + TextureFactory.of(ARROW_DOWN), + TextureFactory.builder() + .addIcon(ARROW_DOWN_GLOW) + .glow() + .build()); + ITexture tLeft = TextureFactory.of( + TextureFactory.of(ARROW_LEFT), + TextureFactory.builder() + .addIcon(ARROW_LEFT_GLOW) + .glow() + .build()); + ITexture tRight = TextureFactory.of( + TextureFactory.of(ARROW_RIGHT), + TextureFactory.builder() + .addIcon(ARROW_RIGHT_GLOW) + .glow() + .build()); for (int i = 0; i < rTextures[0].length; i++) { rTextures[OUTPUT_INDEX][i] = new ITexture[] { MACHINE_CASINGS[mTier][i], tOut }; rTextures[ARROW_RIGHT_INDEX][i] = new ITexture[] { MACHINE_CASINGS[mTier][i], tRight, tIcon }; @@ -401,7 +417,8 @@ public abstract class GT_MetaTileEntity_Buffer extends GT_MetaTileEntity_TieredM if (toSet == 0) continue; int slot = validSlots.get(slotindex); slotindex++; - mInventory[slot] = stacks.get(sID).copy(); + mInventory[slot] = stacks.get(sID) + .copy(); toSet = Math.min(toSet, mInventory[slot].getMaxStackSize()); mInventory[slot].stackSize = toSet; slots.merge(sID, toSet, (a, b) -> a - b); @@ -433,15 +450,21 @@ public abstract class GT_MetaTileEntity_Buffer extends GT_MetaTileEntity_TieredM bOutput = !bOutput; if (bOutput) { GT_Utility.sendChatToPlayer( - widget.getContext().getPlayer(), + widget.getContext() + .getPlayer(), GT_Utility.trans("116", "Emit Energy to Outputside")); } else { GT_Utility.sendChatToPlayer( - widget.getContext().getPlayer(), + widget.getContext() + .getPlayer(), GT_Utility.trans("117", "Don't emit Energy")); } - }).setBackground(GT_UITextures.BUTTON_STANDARD, GT_UITextures.OVERLAY_BUTTON_EMIT_ENERGY).setPos(7, 62) - .setSize(18, 18)); + }) + .setBackground( + GT_UITextures.BUTTON_STANDARD, + GT_UITextures.OVERLAY_BUTTON_EMIT_ENERGY) + .setPos(7, 62) + .setSize(18, 18)); } protected void addEmitRedstoneButton(ModularWindow.Builder builder) { @@ -449,30 +472,43 @@ public abstract class GT_MetaTileEntity_Buffer extends GT_MetaTileEntity_TieredM bRedstoneIfFull = !bRedstoneIfFull; if (bRedstoneIfFull) { GT_Utility.sendChatToPlayer( - widget.getContext().getPlayer(), + widget.getContext() + .getPlayer(), GT_Utility.trans("118", "Emit Redstone if no Slot is free")); } else { GT_Utility.sendChatToPlayer( - widget.getContext().getPlayer(), + widget.getContext() + .getPlayer(), GT_Utility.trans("119", "Don't emit Redstone")); } - }).setBackground(GT_UITextures.BUTTON_STANDARD, GT_UITextures.OVERLAY_BUTTON_EMIT_REDSTONE).setPos(25, 62) - .setSize(18, 18)); + }) + .setBackground( + GT_UITextures.BUTTON_STANDARD, + GT_UITextures.OVERLAY_BUTTON_EMIT_REDSTONE) + .setPos(25, 62) + .setSize(18, 18)); } protected void addInvertRedstoneButton(ModularWindow.Builder builder) { builder.widget(new ButtonWidget().setOnClick((clickData, widget) -> { bInvert = !bInvert; if (bInvert) { - GT_Utility - .sendChatToPlayer(widget.getContext().getPlayer(), GT_Utility.trans("120", "Invert Redstone")); + GT_Utility.sendChatToPlayer( + widget.getContext() + .getPlayer(), + GT_Utility.trans("120", "Invert Redstone")); } else { GT_Utility.sendChatToPlayer( - widget.getContext().getPlayer(), + widget.getContext() + .getPlayer(), GT_Utility.trans("121", "Don't invert Redstone")); } - }).setBackground(GT_UITextures.BUTTON_STANDARD, GT_UITextures.OVERLAY_BUTTON_INVERT_REDSTONE).setPos(43, 62) - .setSize(18, 18)); + }) + .setBackground( + GT_UITextures.BUTTON_STANDARD, + GT_UITextures.OVERLAY_BUTTON_INVERT_REDSTONE) + .setPos(43, 62) + .setSize(18, 18)); } protected void addStockingModeButton(ModularWindow.Builder builder) { @@ -480,22 +516,32 @@ public abstract class GT_MetaTileEntity_Buffer extends GT_MetaTileEntity_TieredM bStockingMode = !bStockingMode; if (bStockingMode) { GT_Utility.sendChatToPlayer( - widget.getContext().getPlayer(), + widget.getContext() + .getPlayer(), GT_Utility.trans( "217", "Stocking mode. Keeps this many items in destination input slots. This mode can be server unfriendly.")); } else { GT_Utility.sendChatToPlayer( - widget.getContext().getPlayer(), + widget.getContext() + .getPlayer(), GT_Utility.trans( "218", "Transfer size mode. Add exactly this many items in destination input slots as long as there is room.")); } - }).setBackground(GT_UITextures.BUTTON_STANDARD, GT_UITextures.OVERLAY_BUTTON_STOCKING_MODE).setPos(61, 62) - .setSize(18, 18)); + }) + .setBackground( + GT_UITextures.BUTTON_STANDARD, + GT_UITextures.OVERLAY_BUTTON_STOCKING_MODE) + .setPos(61, 62) + .setSize(18, 18)); } protected void addInventorySlots(ModularWindow.Builder builder) { - builder.widget(SlotGroup.ofItemHandler(inventoryHandler, 9).endAtSlot(26).build().setPos(7, 4)); + builder.widget( + SlotGroup.ofItemHandler(inventoryHandler, 9) + .endAtSlot(26) + .build() + .setPos(7, 4)); } } diff --git a/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_CubicMultiBlockBase.java b/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_CubicMultiBlockBase.java index 830706f8fe..d9c32911b7 100644 --- a/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_CubicMultiBlockBase.java +++ b/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_CubicMultiBlockBase.java @@ -44,23 +44,27 @@ public abstract class GT_MetaTileEntity_CubicMultiBlockBase<T extends GT_MetaTil @Override protected IStructureDefinition<GT_MetaTileEntity_CubicMultiBlockBase<?>> computeValue(Class<?> type) { return StructureDefinition.<GT_MetaTileEntity_CubicMultiBlockBase<?>>builder() - .addShape( - STRUCTURE_PIECE_MAIN, - transpose( - new String[][] { { "hhh", "hhh", "hhh" }, { "h~h", "h-h", "hhh" }, - { "hhh", "hhh", "hhh" }, })) - .addElement( - 'h', - ofChain( - lazy( - t -> GT_StructureUtility - .<GT_MetaTileEntity_CubicMultiBlockBase<?>>buildHatchAdder() - .atLeastList(t.getAllowedHatches()) - .casingIndex(t.getHatchTextureIndex()).dot(1).build()), - onElementPass( - GT_MetaTileEntity_CubicMultiBlockBase::onCorrectCasingAdded, - lazy(GT_MetaTileEntity_CubicMultiBlockBase::getCasingElement)))) - .build(); + .addShape( + STRUCTURE_PIECE_MAIN, + transpose( + new String[][] { { "hhh", "hhh", "hhh" }, { "h~h", "h-h", "hhh" }, + { "hhh", "hhh", "hhh" }, })) + .addElement( + 'h', + ofChain( + lazy( + t -> GT_StructureUtility.<GT_MetaTileEntity_CubicMultiBlockBase<?>>buildHatchAdder() + .atLeastList( + t.getAllowedHatches()) + .casingIndex( + t.getHatchTextureIndex()) + .dot(1) + .build()), + onElementPass( + GT_MetaTileEntity_CubicMultiBlockBase::onCorrectCasingAdded, + lazy( + GT_MetaTileEntity_CubicMultiBlockBase::getCasingElement)))) + .build(); } }; private int mCasingAmount = 0; diff --git a/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_EnhancedMultiBlockBase.java b/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_EnhancedMultiBlockBase.java index e5cf3d5cc4..bd6facceee 100644 --- a/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_EnhancedMultiBlockBase.java +++ b/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_EnhancedMultiBlockBase.java @@ -131,8 +131,14 @@ public abstract class GT_MetaTileEntity_EnhancedMultiBlockBase<T extends GT_Meta @Override public void saveNBTData(NBTTagCompound aNBT) { super.saveNBTData(aNBT); - aNBT.setByte("eRotation", (byte) mExtendedFacing.getRotation().getIndex()); - aNBT.setByte("eFlip", (byte) mExtendedFacing.getFlip().getIndex()); + aNBT.setByte( + "eRotation", + (byte) mExtendedFacing.getRotation() + .getIndex()); + aNBT.setByte( + "eFlip", + (byte) mExtendedFacing.getFlip() + .getIndex()); } @Override diff --git a/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_ExtendedPowerMultiBlockBase.java b/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_ExtendedPowerMultiBlockBase.java index 9f75c283ec..cfc1ce6558 100644 --- a/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_ExtendedPowerMultiBlockBase.java +++ b/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_ExtendedPowerMultiBlockBase.java @@ -139,8 +139,10 @@ public abstract class GT_MetaTileEntity_ExtendedPowerMultiBlockBase<T extends GT long maxEnergy = 0; for (GT_MetaTileEntity_Hatch tHatch : getExoticAndNormalEnergyHatchList()) { if (isValidMetaTileEntity(tHatch)) { - storedEnergy += tHatch.getBaseMetaTileEntity().getStoredEU(); - maxEnergy += tHatch.getBaseMetaTileEntity().getEUCapacity(); + storedEnergy += tHatch.getBaseMetaTileEntity() + .getStoredEU(); + maxEnergy += tHatch.getBaseMetaTileEntity() + .getEUCapacity(); } } long voltage = getAverageInputVoltage(); diff --git a/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_Hatch_DataAccess.java b/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_Hatch_DataAccess.java index fc25a15beb..fc6dce9e70 100644 --- a/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_Hatch_DataAccess.java +++ b/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_Hatch_DataAccess.java @@ -145,12 +145,16 @@ public class GT_MetaTileEntity_Hatch_DataAccess extends GT_MetaTileEntity_Hatch public void addUIWidgets(ModularWindow.Builder builder, UIBuildContext buildContext) { switch (mTier) { case 4: - getBaseMetaTileEntity() - .add2by2Slots(builder, getGUITextureSet().getItemSlot(), GT_UITextures.OVERLAY_SLOT_CIRCUIT); + getBaseMetaTileEntity().add2by2Slots( + builder, + getGUITextureSet().getItemSlot(), + GT_UITextures.OVERLAY_SLOT_CIRCUIT); break; default: - getBaseMetaTileEntity() - .add4by4Slots(builder, getGUITextureSet().getItemSlot(), GT_UITextures.OVERLAY_SLOT_CIRCUIT); + getBaseMetaTileEntity().add4by4Slots( + builder, + getGUITextureSet().getItemSlot(), + GT_UITextures.OVERLAY_SLOT_CIRCUIT); break; } } diff --git a/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_Hatch_InputBus.java b/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_Hatch_InputBus.java index 959bcda530..42abf4839b 100644 --- a/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_Hatch_InputBus.java +++ b/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_Hatch_InputBus.java @@ -132,8 +132,8 @@ public class GT_MetaTileEntity_Hatch_InputBus extends GT_MetaTileEntity_Hatch @Override public void initDefaultModes(NBTTagCompound aNBT) { if (!getBaseMetaTileEntity().getWorld().isRemote) { - GT_ClientPreference tPreference = GT_Mod.gregtechproxy - .getClientPreference(getBaseMetaTileEntity().getOwnerUuid()); + GT_ClientPreference tPreference = GT_Mod.gregtechproxy.getClientPreference( + getBaseMetaTileEntity().getOwnerUuid()); if (tPreference != null) disableFilter = !tPreference.isInputBusInitialFilterEnabled(); } } @@ -174,7 +174,8 @@ public class GT_MetaTileEntity_Hatch_InputBus extends GT_MetaTileEntity_Hatch if (toSet == 0) continue; int slot = validSlots.get(slotindex); slotindex++; - mInventory[slot] = stacks.get(sID).copy(); + mInventory[slot] = stacks.get(sID) + .copy(); toSet = Math.min(toSet, mInventory[slot].getMaxStackSize()); mInventory[slot].stackSize = toSet; slots.merge(sID, toSet, (a, b) -> a - b); @@ -201,7 +202,9 @@ public class GT_MetaTileEntity_Hatch_InputBus extends GT_MetaTileEntity_Hatch @Override public void onScrewdriverRightClick(byte aSide, EntityPlayer aPlayer, float aX, float aY, float aZ) { - if (!getBaseMetaTileEntity().getCoverInfoAtSide(aSide).isGUIClickable()) return; + if (!getBaseMetaTileEntity().getCoverInfoAtSide(aSide) + .isGUIClickable()) + return; if (aPlayer.isSneaking()) { if (disableSort) { disableSort = false; diff --git a/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_Hatch_Maintenance.java b/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_Hatch_Maintenance.java index bcc260fd2e..d380baf8ed 100644 --- a/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_Hatch_Maintenance.java +++ b/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_Hatch_Maintenance.java @@ -96,14 +96,20 @@ public class GT_MetaTileEntity_Hatch_Maintenance extends GT_MetaTileEntity_Hatch @Override public ITexture[] getTexturesActive(ITexture aBaseTexture) { if (mAuto) return new ITexture[] { aBaseTexture, TextureFactory.of(OVERLAY_AUTOMAINTENANCE_IDLE), - TextureFactory.builder().addIcon(OVERLAY_AUTOMAINTENANCE_IDLE_GLOW).glow().build() }; + TextureFactory.builder() + .addIcon(OVERLAY_AUTOMAINTENANCE_IDLE_GLOW) + .glow() + .build() }; return new ITexture[] { aBaseTexture, TextureFactory.of(OVERLAY_MAINTENANCE) }; } @Override public ITexture[] getTexturesInactive(ITexture aBaseTexture) { if (mAuto) return new ITexture[] { aBaseTexture, TextureFactory.of(OVERLAY_AUTOMAINTENANCE), - TextureFactory.builder().addIcon(OVERLAY_AUTOMAINTENANCE_GLOW).glow().build() }; + TextureFactory.builder() + .addIcon(OVERLAY_AUTOMAINTENANCE_GLOW) + .glow() + .build() }; return new ITexture[] { aBaseTexture, TextureFactory.of(OVERLAY_MAINTENANCE), TextureFactory.of(OVERLAY_DUCTTAPE) }; } @@ -146,7 +152,10 @@ public class GT_MetaTileEntity_Hatch_Maintenance extends GT_MetaTileEntity_Hatch if (aBaseMetaTileEntity.isClientSide()) return true; if (aSide == aBaseMetaTileEntity.getFrontFacing()) { // only allow OC robot fake player - if (aPlayer instanceof FakePlayer && !aPlayer.getGameProfile().getName().endsWith(".robot")) return false; + if (aPlayer instanceof FakePlayer && !aPlayer.getGameProfile() + .getName() + .endsWith(".robot")) + return false; ItemStack tStack = aPlayer.getCurrentEquippedItem(); if (tStack != null) { if (tStack.getItem() instanceof ItemToolbox) { @@ -193,8 +202,10 @@ public class GT_MetaTileEntity_Hatch_Maintenance extends GT_MetaTileEntity_Hatch amt = tStack.stackSize; boolean temp = true; for (ItemStack aStack : mInventory) { - if ((GT_Utility.areUnificationsEqual(aStack, tStack, true) || GT_Utility - .areUnificationsEqual(GT_OreDictUnificator.get(false, aStack), tStack, true))) { + if ((GT_Utility.areUnificationsEqual(aStack, tStack, true) || GT_Utility.areUnificationsEqual( + GT_OreDictUnificator.get(false, aStack), + tStack, + true))) { amt -= aStack.stackSize; if (amt < 1) { temp = false; @@ -211,8 +222,10 @@ public class GT_MetaTileEntity_Hatch_Maintenance extends GT_MetaTileEntity_Hatch if (tStack != null) { amt = tStack.stackSize; for (ItemStack aStack : mInventory) { - if ((GT_Utility.areUnificationsEqual(aStack, tStack, true) || GT_Utility - .areUnificationsEqual(GT_OreDictUnificator.get(false, aStack), tStack, true))) { + if ((GT_Utility.areUnificationsEqual(aStack, tStack, true) || GT_Utility.areUnificationsEqual( + GT_OreDictUnificator.get(false, aStack), + tStack, + true))) { if (aStack.stackSize < amt) { amt -= aStack.stackSize; aStack.stackSize = 0; @@ -322,28 +335,33 @@ public class GT_MetaTileEntity_Hatch_Maintenance extends GT_MetaTileEntity_Hatch getBaseMetaTileEntity().add2by2Slots(builder); } else { builder.widget( - new DrawableWidget().setDrawable(GT_UITextures.SLOT_MAINTENANCE).setPos(78, 33).setSize(20, 20)) - .widget(new SlotWidget(BaseSlot.empty()) { - - @Override - public boolean handleDragAndDrop(ItemStack draggedStack, int button) { - return false; - } - - @Override - protected void phantomClick(ClickData clickData, ItemStack cursorStack) { - if (cursorStack == null) return; - onToolClick(cursorStack, getContext().getPlayer()); - if (cursorStack.stackSize < 1) { - getContext().getPlayer().inventory.setItemStack(null); - } - if (getContext().getPlayer() instanceof EntityPlayerMP) { - ((EntityPlayerMP) getContext().getPlayer()).updateHeldItem(); - } - } - }.disableShiftInsert().setBackground(GT_UITextures.TRANSPARENT).setPos(79, 34)).widget( - new TextWidget("Click with Tool to repair.").setDefaultColor(COLOR_TEXT_GRAY.get()) - .setPos(8, 12)); + new DrawableWidget().setDrawable(GT_UITextures.SLOT_MAINTENANCE) + .setPos(78, 33) + .setSize(20, 20)) + .widget(new SlotWidget(BaseSlot.empty()) { + + @Override + public boolean handleDragAndDrop(ItemStack draggedStack, int button) { + return false; + } + + @Override + protected void phantomClick(ClickData clickData, ItemStack cursorStack) { + if (cursorStack == null) return; + onToolClick(cursorStack, getContext().getPlayer()); + if (cursorStack.stackSize < 1) { + getContext().getPlayer().inventory.setItemStack(null); + } + if (getContext().getPlayer() instanceof EntityPlayerMP) { + ((EntityPlayerMP) getContext().getPlayer()).updateHeldItem(); + } + } + }.disableShiftInsert() + .setBackground(GT_UITextures.TRANSPARENT) + .setPos(79, 34)) + .widget( + new TextWidget("Click with Tool to repair.").setDefaultColor(COLOR_TEXT_GRAY.get()) + .setPos(8, 12)); } } } diff --git a/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_Hatch_Muffler.java b/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_Hatch_Muffler.java index b41f45e6d2..f0f1705b1f 100644 --- a/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_Hatch_Muffler.java +++ b/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_Hatch_Muffler.java @@ -34,7 +34,7 @@ public class GT_MetaTileEntity_Hatch_Muffler extends GT_MetaTileEntity_Hatch { private final int pollutionReduction = calculatePollutionReduction(100); private final int pollutionRecover = 100 - pollutionReduction; private final String[] description = String.format(localizedDescFormat, pollutionReduction, pollutionRecover) - .split("\\R"); + .split("\\R"); private final boolean[] facings = new boolean[ForgeDirection.VALID_DIRECTIONS.length]; public GT_MetaTileEntity_Hatch_Muffler(int aID, String aName, String aNameRegional, int aTier) { @@ -103,8 +103,12 @@ public class GT_MetaTileEntity_Hatch_Muffler extends GT_MetaTileEntity_Hatch { @Override public void onPostTick(IGregTechTileEntity aBaseMetaTileEntity, long aTick) { super.onPostTick(aBaseMetaTileEntity, aTick); - if (aBaseMetaTileEntity.isClientSide() && this.getBaseMetaTileEntity().isActive()) { - pollutionParticles(this.getBaseMetaTileEntity().getWorld(), ParticleFX.LARGE_SMOKE.toString()); + if (aBaseMetaTileEntity.isClientSide() && this.getBaseMetaTileEntity() + .isActive()) { + pollutionParticles( + this.getBaseMetaTileEntity() + .getWorld(), + ParticleFX.LARGE_SMOKE.toString()); } } @@ -159,26 +163,35 @@ public class GT_MetaTileEntity_Hatch_Muffler extends GT_MetaTileEntity_Hatch { zSpd = aDir.offsetZ * (0.1F + 0.2F * XSTR_INSTANCE.nextFloat()); } - WorldSpawnedEventBuilder.ParticleEventBuilder events = new WorldSpawnedEventBuilder.ParticleEventBuilder() - .setIdentifier(name).setWorld(aWorld).setMotion(xSpd, ySpd, zSpd); + WorldSpawnedEventBuilder.ParticleEventBuilder events = new WorldSpawnedEventBuilder.ParticleEventBuilder().setIdentifier( + name) + .setWorld( + aWorld) + .setMotion( + xSpd, + ySpd, + zSpd); if (chk1) { events.setPosition( xPos + ran1 * 0.5F, yPos + XSTR_INSTANCE.nextFloat() * 0.5F, - zPos + XSTR_INSTANCE.nextFloat() * 0.5F).run(); + zPos + XSTR_INSTANCE.nextFloat() * 0.5F) + .run(); } if (chk2) { events.setPosition( xPos + ran2 * 0.5F, yPos + XSTR_INSTANCE.nextFloat() * 0.5F, - zPos + XSTR_INSTANCE.nextFloat() * 0.5F).run(); + zPos + XSTR_INSTANCE.nextFloat() * 0.5F) + .run(); } if (chk3) { events.setPosition( xPos + ran3 * 0.5F, yPos + XSTR_INSTANCE.nextFloat() * 0.5F, - zPos + XSTR_INSTANCE.nextFloat() * 0.5F).run(); + zPos + XSTR_INSTANCE.nextFloat() * 0.5F) + .run(); } } @@ -217,6 +230,7 @@ public class GT_MetaTileEntity_Hatch_Muffler extends GT_MetaTileEntity_Hatch { */ public void setInValidFacings(ForgeDirection... aFacings) { Arrays.fill(facings, true); - Arrays.stream(aFacings).forEach(face -> facings[face.ordinal()] = false); + Arrays.stream(aFacings) + .forEach(face -> facings[face.ordinal()] = false); } } diff --git a/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_Hatch_MultiInput.java b/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_Hatch_MultiInput.java index 7d95e0b17c..1b7fedce22 100644 --- a/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_Hatch_MultiInput.java +++ b/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_Hatch_MultiInput.java @@ -171,10 +171,9 @@ public class GT_MetaTileEntity_Hatch_MultiInput extends GT_MetaTileEntity_Hatch_ @Override public int fill(FluidStack aFluid, boolean doFill) { - if (aFluid == null || aFluid.getFluid().getID() <= 0 - || aFluid.amount <= 0 - || !canTankBeFilled() - || !isFluidInputAllowed(aFluid)) + if (aFluid == null || aFluid.getFluid() + .getID() + <= 0 || aFluid.amount <= 0 || !canTankBeFilled() || !isFluidInputAllowed(aFluid)) return 0; if (!hasFluid(aFluid) && getFirstEmptySlot() != -1) { int tFilled = Math.min(aFluid.amount, mCapacityPer); @@ -304,21 +303,36 @@ public class GT_MetaTileEntity_Hatch_MultiInput extends GT_MetaTileEntity_Hatch_ final int slotId = i; builder.widget( new FluidDisplaySlotWidget(inventoryHandler, slotId) - .setFluidAccessConstructor(() -> constructFluidAccess(slotId)).setIHasFluidDisplay(this) - .setCanDrain(true).setCanFill(!isDrainableStackSeparate()) - .setActionRealClick(FluidDisplaySlotWidget.Action.TRANSFER) - .setBeforeRealClick((clickData, widget) -> { - if (NetworkUtils.isClient()) { - // propagate display item content to actual fluid stored in this tank - setFluid( - GT_Utility.getFluidFromDisplayStack(widget.getMcSlot().getStack()), - slotId); - } - ItemStack tStackHeld = widget.getContext().getPlayer().inventory.getItemStack(); - FluidStack tFluidHeld = GT_Utility.getFluidForFilledItem(tStackHeld, true); - return constructFluidAccess(slotId).isMatch(tFluidHeld, slotId); - }).setUpdateFluidDisplayItem(() -> updateFluidDisplayItem(slotId)) - .setBackground(ModularUITextures.FLUID_SLOT).setPos(positions[slotId])); + .setFluidAccessConstructor( + () -> constructFluidAccess(slotId)) + .setIHasFluidDisplay(this) + .setCanDrain(true) + .setCanFill(!isDrainableStackSeparate()) + .setActionRealClick( + FluidDisplaySlotWidget.Action.TRANSFER) + .setBeforeRealClick((clickData, widget) -> { + if (NetworkUtils.isClient()) { + // propagate display item content to + // actual fluid stored in this tank + setFluid( + GT_Utility.getFluidFromDisplayStack( + widget.getMcSlot() + .getStack()), + slotId); + } + ItemStack tStackHeld = widget.getContext() + .getPlayer().inventory.getItemStack(); + FluidStack tFluidHeld = GT_Utility.getFluidForFilledItem( + tStackHeld, + true); + return constructFluidAccess(slotId).isMatch( + tFluidHeld, + slotId); + }) + .setUpdateFluidDisplayItem( + () -> updateFluidDisplayItem(slotId)) + .setBackground(ModularUITextures.FLUID_SLOT) + .setPos(positions[slotId])); } } diff --git a/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_Hatch_Output.java b/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_Hatch_Output.java index ed29f8fe08..4a8e745a25 100644 --- a/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_Hatch_Output.java +++ b/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_Hatch_Output.java @@ -123,16 +123,18 @@ public class GT_MetaTileEntity_Hatch_Output extends GT_MetaTileEntity_Hatch impl public void onPostTick(IGregTechTileEntity aBaseMetaTileEntity, long aTick) { super.onPostTick(aBaseMetaTileEntity, aTick); if (aBaseMetaTileEntity.isServerSide() && aBaseMetaTileEntity.isAllowedToWork() && mFluid != null) { - IFluidHandler tTileEntity = aBaseMetaTileEntity - .getITankContainerAtSide(aBaseMetaTileEntity.getFrontFacing()); + IFluidHandler tTileEntity = aBaseMetaTileEntity.getITankContainerAtSide( + aBaseMetaTileEntity.getFrontFacing()); if (tTileEntity != null) { FluidStack tDrained = aBaseMetaTileEntity.drain( ForgeDirection.getOrientation(aBaseMetaTileEntity.getFrontFacing()), Math.max(1, mFluid.amount), false); if (tDrained != null) { - int tFilledAmount = tTileEntity - .fill(ForgeDirection.getOrientation(aBaseMetaTileEntity.getBackFacing()), tDrained, false); + int tFilledAmount = tTileEntity.fill( + ForgeDirection.getOrientation(aBaseMetaTileEntity.getBackFacing()), + tDrained, + false); if (tFilledAmount > 0) { tTileEntity.fill( ForgeDirection.getOrientation(aBaseMetaTileEntity.getBackFacing()), @@ -163,7 +165,8 @@ public class GT_MetaTileEntity_Hatch_Output extends GT_MetaTileEntity_Hatch impl lockedFluidName = aNBT.getString("lockedFluidName"); lockedFluidName = lockedFluidName.length() == 0 ? null : lockedFluidName; if (GT_Utility.getFluidFromUnlocalizedName(lockedFluidName) != null) { - lockedFluidName = GT_Utility.getFluidFromUnlocalizedName(lockedFluidName).getName(); + lockedFluidName = GT_Utility.getFluidFromUnlocalizedName(lockedFluidName) + .getName(); } } @@ -239,7 +242,9 @@ public class GT_MetaTileEntity_Hatch_Output extends GT_MetaTileEntity_Hatch impl @Override public void onScrewdriverRightClick(byte aSide, EntityPlayer aPlayer, float aX, float aY, float aZ) { - if (!getBaseMetaTileEntity().getCoverInfoAtSide(aSide).isGUIClickable()) return; + if (!getBaseMetaTileEntity().getCoverInfoAtSide(aSide) + .isGUIClickable()) + return; if (aPlayer.isSneaking()) { mMode = (byte) ((mMode + 9) % 10); } else { @@ -287,8 +292,12 @@ public class GT_MetaTileEntity_Hatch_Output extends GT_MetaTileEntity_Hatch impl "115.3", "currently none, will be locked to the next that is put in (or use fluid cell to lock)"); } else { - this.setLockedFluidName(this.getDrainableStack().getFluid().getName()); - inBrackets = this.getDrainableStack().getLocalizedName(); + this.setLockedFluidName( + this.getDrainableStack() + .getFluid() + .getName()); + inBrackets = this.getDrainableStack() + .getLocalizedName(); } GT_Utility.sendChatToPlayer( aPlayer, @@ -305,8 +314,12 @@ public class GT_MetaTileEntity_Hatch_Output extends GT_MetaTileEntity_Hatch impl "115.3", "currently none, will be locked to the next that is put in (or use fluid cell to lock)"); } else { - this.setLockedFluidName(this.getDrainableStack().getFluid().getName()); - inBrackets = this.getDrainableStack().getLocalizedName(); + this.setLockedFluidName( + this.getDrainableStack() + .getFluid() + .getName()); + inBrackets = this.getDrainableStack() + .getLocalizedName(); } GT_Utility.sendChatToPlayer( aPlayer, @@ -316,7 +329,9 @@ public class GT_MetaTileEntity_Hatch_Output extends GT_MetaTileEntity_Hatch impl } private boolean tryToLockHatch(EntityPlayer aPlayer, byte aSide) { - if (!getBaseMetaTileEntity().getCoverInfoAtSide(aSide).isGUIClickable()) return false; + if (!getBaseMetaTileEntity().getCoverInfoAtSide(aSide) + .isGUIClickable()) + return false; if (!isFluidLocked()) return false; final ItemStack tCurrentItem = aPlayer.inventory.getCurrentItem(); if (tCurrentItem == null) return false; @@ -324,7 +339,9 @@ public class GT_MetaTileEntity_Hatch_Output extends GT_MetaTileEntity_Hatch impl if (tFluid == null && tCurrentItem.getItem() instanceof IFluidContainerItem) tFluid = ((IFluidContainerItem) tCurrentItem.getItem()).getFluid(tCurrentItem); if (tFluid != null) { - if (getLockedFluidName() != null && !getLockedFluidName().equals(tFluid.getFluid().getName())) { + if (getLockedFluidName() != null && !getLockedFluidName().equals( + tFluid.getFluid() + .getName())) { GT_Utility.sendChatToPlayer( aPlayer, String.format( @@ -334,7 +351,9 @@ public class GT_MetaTileEntity_Hatch_Output extends GT_MetaTileEntity_Hatch impl "Hatch is locked to a different fluid. To change the locking, empty it and made it locked to the next fluid with a screwdriver. Currently locked to"), StatCollector.translateToLocal(getLockedFluidName()))); } else { - setLockedFluidName(tFluid.getFluid().getName()); + setLockedFluidName( + tFluid.getFluid() + .getName()); if (mMode == 8) GT_Utility.sendChatToPlayer( aPlayer, String.format( @@ -427,7 +446,9 @@ public class GT_MetaTileEntity_Hatch_Output extends GT_MetaTileEntity_Hatch impl @Override protected void onEmptyingContainerWhenEmpty() { if (this.lockedFluidName == null && this.mFluid != null && isFluidLocked()) { - this.setLockedFluidName(this.mFluid.getFluid().getName()); + this.setLockedFluidName( + this.mFluid.getFluid() + .getName()); final EntityPlayer player; if (playerThatLockedfluid == null || (player = playerThatLockedfluid.get()) == null) return; GT_Utility.sendChatToPlayer( @@ -459,7 +480,8 @@ public class GT_MetaTileEntity_Hatch_Output extends GT_MetaTileEntity_Hatch impl + EnumChatFormatting.RESET, (!isFluidLocked() || lockedFluidName == null) ? "Not Locked" : ("Locked to " + StatCollector.translateToLocal( - FluidRegistry.getFluidStack(lockedFluidName, 1).getUnlocalizedName())) }; + FluidRegistry.getFluidStack(lockedFluidName, 1) + .getUnlocalizedName())) }; } @Override @@ -471,28 +493,51 @@ public class GT_MetaTileEntity_Hatch_Output extends GT_MetaTileEntity_Hatch impl public void addUIWidgets(ModularWindow.Builder builder, UIBuildContext buildContext) { super.addUIWidgets(builder, buildContext); builder.widget( - new DrawableWidget().setDrawable(GT_UITextures.PICTURE_SCREEN_BLACK).setPos(98, 16).setSize(71, 45)) - .widget( - new FluidDisplaySlotWidget(inventoryHandler, getLockedDisplaySlot()).setIHasFluidDisplay(this) - .setActionRealClick(FluidDisplaySlotWidget.Action.LOCK) - .setActionDragAndDrop(FluidDisplaySlotWidget.Action.LOCK) - .setBeforeClick((clickData, widget) -> { - if (NetworkUtils.isClient()) { - // propagate display item content to actual fluid stored in this tank - setDrainableStack( - GT_Utility.getFluidFromDisplayStack(mInventory[getStackDisplaySlot()])); - } - return true; - }).setBackground(GT_UITextures.TRANSPARENT).setPos(149, 41)) - .widget(new TextWidget("Locked Fluid").setDefaultColor(COLOR_TEXT_WHITE.get()).setPos(101, 20)) - .widget(TextWidget.dynamicString(() -> { - final ItemStack lockedDisplayStack = mInventory[getLockedDisplaySlot()]; - return lockedDisplayStack == null ? "None" : lockedDisplayStack.getDisplayName(); - }).setSynced(false).setDefaultColor(COLOR_TEXT_WHITE.get()).setTextAlignment(Alignment.CenterLeft) - .setMaxWidth(65).setPos(101, 30)) - // #updateFluidDisplayItem invalidates locked fluid slot - // if lockedFluidName == null or mMode is incorrect - .widget(new FakeSyncWidget.StringSyncer(() -> lockedFluidName, val -> lockedFluidName = val)) - .widget(new FakeSyncWidget.ByteSyncer(() -> mMode, val -> mMode = val)); + new DrawableWidget().setDrawable(GT_UITextures.PICTURE_SCREEN_BLACK) + .setPos(98, 16) + .setSize(71, 45)) + .widget( + new FluidDisplaySlotWidget(inventoryHandler, getLockedDisplaySlot()).setIHasFluidDisplay(this) + .setActionRealClick( + FluidDisplaySlotWidget.Action.LOCK) + .setActionDragAndDrop( + FluidDisplaySlotWidget.Action.LOCK) + .setBeforeClick( + (clickData, + widget) -> { + if (NetworkUtils.isClient()) { + // propagate + // display + // item + // content to + // actual + // fluid + // stored in + // this tank + setDrainableStack( + GT_Utility.getFluidFromDisplayStack( + mInventory[getStackDisplaySlot()])); + } + return true; + }) + .setBackground( + GT_UITextures.TRANSPARENT) + .setPos(149, 41)) + .widget( + new TextWidget("Locked Fluid").setDefaultColor(COLOR_TEXT_WHITE.get()) + .setPos(101, 20)) + .widget(TextWidget.dynamicString(() -> { + final ItemStack lockedDisplayStack = mInventory[getLockedDisplaySlot()]; + return lockedDisplayStack == null ? "None" : lockedDisplayStack.getDisplayName(); + }) + .setSynced(false) + .setDefaultColor(COLOR_TEXT_WHITE.get()) + .setTextAlignment(Alignment.CenterLeft) + .setMaxWidth(65) + .setPos(101, 30)) + // #updateFluidDisplayItem invalidates locked fluid slot + // if lockedFluidName == null or mMode is incorrect + .widget(new FakeSyncWidget.StringSyncer(() -> lockedFluidName, val -> lockedFluidName = val)) + .widget(new FakeSyncWidget.ByteSyncer(() -> mMode, val -> mMode = val)); } } diff --git a/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_Hatch_OutputBus.java b/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_Hatch_OutputBus.java index 094ad29471..c970b64cb9 100644 --- a/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_Hatch_OutputBus.java +++ b/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_Hatch_OutputBus.java @@ -160,8 +160,8 @@ public class GT_MetaTileEntity_Hatch_OutputBus extends GT_MetaTileEntity_Hatch i public void onPostTick(IGregTechTileEntity aBaseMetaTileEntity, long aTick) { super.onPostTick(aBaseMetaTileEntity, aTick); if (aBaseMetaTileEntity.isServerSide() && aBaseMetaTileEntity.isAllowedToWork() && (aTick & 0x7) == 0) { - final IInventory tTileEntity = aBaseMetaTileEntity - .getIInventoryAtSide(aBaseMetaTileEntity.getFrontFacing()); + final IInventory tTileEntity = aBaseMetaTileEntity.getIInventoryAtSide( + aBaseMetaTileEntity.getFrontFacing()); if (tTileEntity != null) { moveMultipleItemStacks( aBaseMetaTileEntity, diff --git a/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_MultiBlockBase.java b/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_MultiBlockBase.java index 51086d806b..d2083fc87c 100644 --- a/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_MultiBlockBase.java +++ b/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_MultiBlockBase.java @@ -104,29 +104,43 @@ public abstract class GT_MetaTileEntity_MultiBlockBase extends MetaTileEntity public GT_MetaTileEntity_MultiBlockBase(int aID, String aName, String aNameRegional) { super(aID, aName, aNameRegional, 2); - GT_MetaTileEntity_MultiBlockBase.disableMaintenance = GregTech_API.sMachineFile - .get(ConfigCategories.machineconfig, "MultiBlockMachines.disableMaintenance", false); - this.damageFactorLow = GregTech_API.sMachineFile - .get(ConfigCategories.machineconfig, "MultiBlockMachines.damageFactorLow", 5); - this.damageFactorHigh = (float) GregTech_API.sMachineFile - .get(ConfigCategories.machineconfig, "MultiBlockMachines.damageFactorHigh", 0.6f); + GT_MetaTileEntity_MultiBlockBase.disableMaintenance = GregTech_API.sMachineFile.get( + ConfigCategories.machineconfig, + "MultiBlockMachines.disableMaintenance", + false); + this.damageFactorLow = GregTech_API.sMachineFile.get( + ConfigCategories.machineconfig, + "MultiBlockMachines.damageFactorLow", + 5); + this.damageFactorHigh = (float) GregTech_API.sMachineFile.get( + ConfigCategories.machineconfig, + "MultiBlockMachines.damageFactorHigh", + 0.6f); this.mNEI = ""; } public GT_MetaTileEntity_MultiBlockBase(String aName) { super(aName, 2); - GT_MetaTileEntity_MultiBlockBase.disableMaintenance = GregTech_API.sMachineFile - .get(ConfigCategories.machineconfig, "MultiBlockMachines.disableMaintenance", false); - this.damageFactorLow = GregTech_API.sMachineFile - .get(ConfigCategories.machineconfig, "MultiBlockMachines.damageFactorLow", 5); - this.damageFactorHigh = (float) GregTech_API.sMachineFile - .get(ConfigCategories.machineconfig, "MultiBlockMachines.damageFactorHigh", 0.6f); + GT_MetaTileEntity_MultiBlockBase.disableMaintenance = GregTech_API.sMachineFile.get( + ConfigCategories.machineconfig, + "MultiBlockMachines.disableMaintenance", + false); + this.damageFactorLow = GregTech_API.sMachineFile.get( + ConfigCategories.machineconfig, + "MultiBlockMachines.damageFactorLow", + 5); + this.damageFactorHigh = (float) GregTech_API.sMachineFile.get( + ConfigCategories.machineconfig, + "MultiBlockMachines.damageFactorHigh", + 0.6f); } public static boolean isValidMetaTileEntity(MetaTileEntity aMetaTileEntity) { - return aMetaTileEntity.getBaseMetaTileEntity() != null - && aMetaTileEntity.getBaseMetaTileEntity().getMetaTileEntity() == aMetaTileEntity - && !aMetaTileEntity.getBaseMetaTileEntity().isDead(); + return aMetaTileEntity.getBaseMetaTileEntity() != null && aMetaTileEntity.getBaseMetaTileEntity() + .getMetaTileEntity() + == aMetaTileEntity + && !aMetaTileEntity.getBaseMetaTileEntity() + .isDead(); } @Override @@ -433,7 +447,7 @@ public abstract class GT_MetaTileEntity_MultiBlockBase extends MetaTileEntity try { GT_Mod.achievements.issueAchivementHatch( aBaseMetaTileEntity.getWorld() - .getPlayerEntityByName(aBaseMetaTileEntity.getOwnerName()), + .getPlayerEntityByName(aBaseMetaTileEntity.getOwnerName()), tStack); } catch (Exception ignored) {} addOutput(tStack); @@ -458,7 +472,7 @@ public abstract class GT_MetaTileEntity_MultiBlockBase extends MetaTileEntity try { GT_Mod.achievements.issueAchievement( aBaseMetaTileEntity.getWorld() - .getPlayerEntityByName(aBaseMetaTileEntity.getOwnerName()), + .getPlayerEntityByName(aBaseMetaTileEntity.getOwnerName()), "oilplant"); } catch (Exception ignored) {} } @@ -523,7 +537,9 @@ public abstract class GT_MetaTileEntity_MultiBlockBase extends MetaTileEntity if (getBaseMetaTileEntity().isActive() && activitySound != null) { if (activitySoundLoop == null) { activitySoundLoop = new GT_SoundLoop(activitySound, getBaseMetaTileEntity(), false, true); - Minecraft.getMinecraft().getSoundHandler().playSound(activitySoundLoop); + Minecraft.getMinecraft() + .getSoundHandler() + .playSound(activitySoundLoop); } } else { if (activitySoundLoop != null) { @@ -683,13 +699,15 @@ public abstract class GT_MetaTileEntity_MultiBlockBase extends MetaTileEntity } } if (mInventory[1] != null && getBaseMetaTileEntity().getRandomNumber(2) == 0 - && !mInventory[1].getUnlocalizedName().startsWith("gt.blockmachines.basicmachine.")) { + && !mInventory[1].getUnlocalizedName() + .startsWith("gt.blockmachines.basicmachine.")) { if (mInventory[1].getItem() instanceof GT_MetaGenerated_Tool_01) { NBTTagCompound tNBT = mInventory[1].getTagCompound(); ((GT_MetaGenerated_Tool) mInventory[1].getItem()).doDamage( mInventory[1], - (long) getDamageToComponent(mInventory[1]) * (long) Math - .min(mEUt / this.damageFactorLow, Math.pow(mEUt, this.damageFactorHigh))); + (long) getDamageToComponent(mInventory[1]) * (long) Math.min( + mEUt / this.damageFactorLow, + Math.pow(mEUt, this.damageFactorHigh))); if (mInventory[1].stackSize == 0) mInventory[1] = null; } } @@ -700,13 +718,17 @@ public abstract class GT_MetaTileEntity_MultiBlockBase extends MetaTileEntity public void explodeMultiblock() { GT_Log.exp.println( - "MultiBlockExplosion at: " + this.getBaseMetaTileEntity().getXCoord() + "MultiBlockExplosion at: " + this.getBaseMetaTileEntity() + .getXCoord() + " | " - + this.getBaseMetaTileEntity().getYCoord() + + this.getBaseMetaTileEntity() + .getYCoord() + " | " - + this.getBaseMetaTileEntity().getZCoord() + + this.getBaseMetaTileEntity() + .getZCoord() + " DIMID: " - + this.getBaseMetaTileEntity().getWorld().provider.dimensionId + + this.getBaseMetaTileEntity() + .getWorld().provider.dimensionId + "."); GT_Pollution.addPollution(getBaseMetaTileEntity(), GT_Mod.gregtechproxy.mPollutionOnExplosion); @@ -722,7 +744,8 @@ public abstract class GT_MetaTileEntity_MultiBlockBase extends MetaTileEntity mMaintenanceHatches); for (MetaTileEntity tTileEntity : allHatches) { if (tTileEntity != null && tTileEntity.getBaseMetaTileEntity() != null) { - tTileEntity.getBaseMetaTileEntity().doExplosion(V[8]); + tTileEntity.getBaseMetaTileEntity() + .doExplosion(V[8]); } } getBaseMetaTileEntity().doExplosion(V[8]); @@ -780,11 +803,13 @@ public abstract class GT_MetaTileEntity_MultiBlockBase extends MetaTileEntity aRemainder = (int) (leftToInject - (aAmpsToInject * aVoltage)); ampsOnCurrentHatch = (int) Math.min(aDynamo.maxAmperesOut(), aAmpsToInject); for (int i = 0; i < ampsOnCurrentHatch; i++) { - aDynamo.getBaseMetaTileEntity().increaseStoredEnergyUnits(aVoltage, false); + aDynamo.getBaseMetaTileEntity() + .increaseStoredEnergyUnits(aVoltage, false); } injected += aVoltage * ampsOnCurrentHatch; if (aRemainder > 0 && ampsOnCurrentHatch < aDynamo.maxAmperesOut()) { - aDynamo.getBaseMetaTileEntity().increaseStoredEnergyUnits(aRemainder, false); + aDynamo.getBaseMetaTileEntity() + .increaseStoredEnergyUnits(aRemainder, false); injected += aRemainder; } } @@ -795,7 +820,8 @@ public abstract class GT_MetaTileEntity_MultiBlockBase extends MetaTileEntity public long getMaxInputVoltage() { long rVoltage = 0; for (GT_MetaTileEntity_Hatch_Energy tHatch : mEnergyHatches) - if (isValidMetaTileEntity(tHatch)) rVoltage += tHatch.getBaseMetaTileEntity().getInputVoltage(); + if (isValidMetaTileEntity(tHatch)) rVoltage += tHatch.getBaseMetaTileEntity() + .getInputVoltage(); return rVoltage; } @@ -877,7 +903,9 @@ public abstract class GT_MetaTileEntity_MultiBlockBase extends MetaTileEntity public boolean drainEnergyInput(long aEU) { if (aEU <= 0) return true; for (GT_MetaTileEntity_Hatch_Energy tHatch : mEnergyHatches) if (isValidMetaTileEntity(tHatch)) { - if (tHatch.getBaseMetaTileEntity().decreaseStoredEnergyUnits(aEU, false)) return true; + if (tHatch.getBaseMetaTileEntity() + .decreaseStoredEnergyUnits(aEU, false)) + return true; } return false; } @@ -946,7 +974,9 @@ public abstract class GT_MetaTileEntity_MultiBlockBase extends MetaTileEntity ItemStack single = aStack.splitStack(1); for (GT_MetaTileEntity_Hatch_Output tHatch : mOutputHatches) { if (!outputSuccess && isValidMetaTileEntity(tHatch) && tHatch.outputsItems()) { - if (tHatch.getBaseMetaTileEntity().addStackToSlot(1, single)) outputSuccess = true; + if (tHatch.getBaseMetaTileEntity() + .addStackToSlot(1, single)) + outputSuccess = true; } } } @@ -960,9 +990,15 @@ public abstract class GT_MetaTileEntity_MultiBlockBase extends MetaTileEntity for (GT_MetaTileEntity_Hatch_Input tHatch : mInputHatches) { tHatch.mRecipeMap = getRecipeMap(); if (isValidMetaTileEntity(tHatch)) { - if (GT_Utility.areStacksEqual(aStack, tHatch.getBaseMetaTileEntity().getStackInSlot(0))) { - if (tHatch.getBaseMetaTileEntity().getStackInSlot(0).stackSize >= aStack.stackSize) { - tHatch.getBaseMetaTileEntity().decrStackSize(0, aStack.stackSize); + if (GT_Utility.areStacksEqual( + aStack, + tHatch.getBaseMetaTileEntity() + .getStackInSlot(0))) { + if (tHatch.getBaseMetaTileEntity() + .getStackInSlot(0).stackSize + >= aStack.stackSize) { + tHatch.getBaseMetaTileEntity() + .decrStackSize(0, aStack.stackSize); return true; } } @@ -971,10 +1007,18 @@ public abstract class GT_MetaTileEntity_MultiBlockBase extends MetaTileEntity for (GT_MetaTileEntity_Hatch_InputBus tHatch : mInputBusses) { tHatch.mRecipeMap = getRecipeMap(); if (isValidMetaTileEntity(tHatch)) { - for (int i = tHatch.getBaseMetaTileEntity().getSizeInventory() - 1; i >= 0; i--) { - if (GT_Utility.areStacksEqual(aStack, tHatch.getBaseMetaTileEntity().getStackInSlot(i))) { - if (tHatch.getBaseMetaTileEntity().getStackInSlot(i).stackSize >= aStack.stackSize) { - tHatch.getBaseMetaTileEntity().decrStackSize(i, aStack.stackSize); + for (int i = tHatch.getBaseMetaTileEntity() + .getSizeInventory() + - 1; i >= 0; i--) { + if (GT_Utility.areStacksEqual( + aStack, + tHatch.getBaseMetaTileEntity() + .getStackInSlot(i))) { + if (tHatch.getBaseMetaTileEntity() + .getStackInSlot(i).stackSize + >= aStack.stackSize) { + tHatch.getBaseMetaTileEntity() + .decrStackSize(i, aStack.stackSize); return true; } } @@ -993,8 +1037,12 @@ public abstract class GT_MetaTileEntity_MultiBlockBase extends MetaTileEntity // } for (GT_MetaTileEntity_Hatch_OutputBus tHatch : mOutputBusses) { if (isValidMetaTileEntity(tHatch)) { - for (int i = tHatch.getBaseMetaTileEntity().getSizeInventory() - 1; i >= 0; i--) { - rList.add(tHatch.getBaseMetaTileEntity().getStackInSlot(i)); + for (int i = tHatch.getBaseMetaTileEntity() + .getSizeInventory() + - 1; i >= 0; i--) { + rList.add( + tHatch.getBaseMetaTileEntity() + .getStackInSlot(i)); } } } @@ -1029,13 +1077,20 @@ public abstract class GT_MetaTileEntity_MultiBlockBase extends MetaTileEntity for (GT_MetaTileEntity_Hatch_InputBus tHatch : mInputBusses) { tHatch.mRecipeMap = getRecipeMap(); if (isValidMetaTileEntity(tHatch)) { - for (int i = tHatch.getBaseMetaTileEntity().getSizeInventory() - 1; i >= 0; i--) { - if (tHatch.getBaseMetaTileEntity().getStackInSlot(i) != null) - rList.add(tHatch.getBaseMetaTileEntity().getStackInSlot(i)); + for (int i = tHatch.getBaseMetaTileEntity() + .getSizeInventory() + - 1; i >= 0; i--) { + if (tHatch.getBaseMetaTileEntity() + .getStackInSlot(i) + != null) + rList.add( + tHatch.getBaseMetaTileEntity() + .getStackInSlot(i)); } } } - if (getStackInSlot(1) != null && getStackInSlot(1).getUnlocalizedName().startsWith("gt.integrated_circuit")) + if (getStackInSlot(1) != null && getStackInSlot(1).getUnlocalizedName() + .startsWith("gt.integrated_circuit")) rList.add(getStackInSlot(1)); return rList; } @@ -1229,8 +1284,10 @@ public abstract class GT_MetaTileEntity_MultiBlockBase extends MetaTileEntity long maxEnergy = 0; for (GT_MetaTileEntity_Hatch_Energy tHatch : mEnergyHatches) { if (isValidMetaTileEntity(tHatch)) { - storedEnergy += tHatch.getBaseMetaTileEntity().getStoredEU(); - maxEnergy += tHatch.getBaseMetaTileEntity().getEUCapacity(); + storedEnergy += tHatch.getBaseMetaTileEntity() + .getStoredEU(); + maxEnergy += tHatch.getBaseMetaTileEntity() + .getEUCapacity(); } } @@ -1519,134 +1576,158 @@ public abstract class GT_MetaTileEntity_MultiBlockBase extends MetaTileEntity @Override public void addUIWidgets(ModularWindow.Builder builder, UIBuildContext buildContext) { builder.widget( - new DrawableWidget().setDrawable(GT_UITextures.PICTURE_SCREEN_BLACK).setPos(4, 4).setSize(190, 85)); + new DrawableWidget().setDrawable(GT_UITextures.PICTURE_SCREEN_BLACK) + .setPos(4, 4) + .setSize(190, 85)); final SlotWidget inventorySlot = new SlotWidget(inventoryHandler, 1); - builder.widget(inventorySlot.setPos(173, 167).setBackground(GT_UITextures.SLOT_DARK_GRAY)); + builder.widget( + inventorySlot.setPos(173, 167) + .setBackground(GT_UITextures.SLOT_DARK_GRAY)); final DynamicPositionedColumn screenElements = new DynamicPositionedColumn(); drawTexts(screenElements, inventorySlot); builder.widget(screenElements); builder.widget(createPowerSwitchButton()) - .widget(new FakeSyncWidget.BooleanSyncer(() -> getBaseMetaTileEntity().isAllowedToWork(), val -> { - if (val) getBaseMetaTileEntity().enableWorking(); - else getBaseMetaTileEntity().disableWorking(); - })); + .widget(new FakeSyncWidget.BooleanSyncer(() -> getBaseMetaTileEntity().isAllowedToWork(), val -> { + if (val) getBaseMetaTileEntity().enableWorking(); + else getBaseMetaTileEntity().disableWorking(); + })); builder.widget(createVoidExcessButton()) - .widget(new FakeSyncWidget.BooleanSyncer(() -> voidExcess, val -> voidExcess = val)); + .widget(new FakeSyncWidget.BooleanSyncer(() -> voidExcess, val -> voidExcess = val)); builder.widget(createInputSeparationButton()) - .widget(new FakeSyncWidget.BooleanSyncer(() -> inputSeparation, val -> inputSeparation = val)); + .widget(new FakeSyncWidget.BooleanSyncer(() -> inputSeparation, val -> inputSeparation = val)); builder.widget(createBatchModeButton()) - .widget(new FakeSyncWidget.BooleanSyncer(() -> batchMode, val -> batchMode = val)); + .widget(new FakeSyncWidget.BooleanSyncer(() -> batchMode, val -> batchMode = val)); - builder.widget(createLockToSingleRecipeButton()).widget( - new FakeSyncWidget.BooleanSyncer(() -> mLockedToSingleRecipe, val -> mLockedToSingleRecipe = val)); + builder.widget(createLockToSingleRecipeButton()) + .widget( + new FakeSyncWidget.BooleanSyncer( + () -> mLockedToSingleRecipe, + val -> mLockedToSingleRecipe = val)); } @Override public void addGregTechLogo(ModularWindow.Builder builder) {} protected void drawTexts(DynamicPositionedColumn screenElements, SlotWidget inventorySlot) { - screenElements.setSynced(false).setSpace(0).setPos(10, 7); - - screenElements - .widget( - new TextWidget(GT_Utility.trans("132", "Pipe is loose.")) - .setDefaultColor(COLOR_TEXT_WHITE.get()).setEnabled(widget -> !mWrench)) - .widget(new FakeSyncWidget.BooleanSyncer(() -> mWrench, val -> mWrench = val)); - screenElements - .widget( - new TextWidget(GT_Utility.trans("133", "Screws are loose.")) - .setDefaultColor(COLOR_TEXT_WHITE.get()).setEnabled(widget -> !mScrewdriver)) - .widget(new FakeSyncWidget.BooleanSyncer(() -> mScrewdriver, val -> mScrewdriver = val)); - screenElements - .widget( - new TextWidget(GT_Utility.trans("134", "Something is stuck.")) - .setDefaultColor(COLOR_TEXT_WHITE.get()).setEnabled(widget -> !mSoftHammer)) - .widget(new FakeSyncWidget.BooleanSyncer(() -> mSoftHammer, val -> mSoftHammer = val)); - screenElements - .widget( - new TextWidget(GT_Utility.trans("135", "Platings are dented.")) - .setDefaultColor(COLOR_TEXT_WHITE.get()).setEnabled(widget -> !mHardHammer)) - .widget(new FakeSyncWidget.BooleanSyncer(() -> mHardHammer, val -> mHardHammer = val)); - screenElements - .widget( - new TextWidget(GT_Utility.trans("136", "Circuitry burned out.")) - .setDefaultColor(COLOR_TEXT_WHITE.get()).setEnabled(widget -> !mSolderingTool)) - .widget(new FakeSyncWidget.BooleanSyncer(() -> mSolderingTool, val -> mSolderingTool = val)); - screenElements - .widget( - new TextWidget(GT_Utility.trans("137", "That doesn't belong there.")) - .setDefaultColor(COLOR_TEXT_WHITE.get()).setEnabled(widget -> !mCrowbar)) - .widget(new FakeSyncWidget.BooleanSyncer(() -> mCrowbar, val -> mCrowbar = val)); - screenElements - .widget( - new TextWidget(GT_Utility.trans("138", "Incomplete Structure.")) - .setDefaultColor(COLOR_TEXT_WHITE.get()).setEnabled(widget -> !mMachine)) - .widget(new FakeSyncWidget.BooleanSyncer(() -> mMachine, val -> mMachine = val)); + screenElements.setSynced(false) + .setSpace(0) + .setPos(10, 7); + + screenElements.widget( + new TextWidget(GT_Utility.trans("132", "Pipe is loose.")).setDefaultColor(COLOR_TEXT_WHITE.get()) + .setEnabled(widget -> !mWrench)) + .widget(new FakeSyncWidget.BooleanSyncer(() -> mWrench, val -> mWrench = val)); + screenElements.widget( + new TextWidget(GT_Utility.trans("133", "Screws are loose.")).setDefaultColor(COLOR_TEXT_WHITE.get()) + .setEnabled(widget -> !mScrewdriver)) + .widget(new FakeSyncWidget.BooleanSyncer(() -> mScrewdriver, val -> mScrewdriver = val)); + screenElements.widget( + new TextWidget(GT_Utility.trans("134", "Something is stuck.")).setDefaultColor(COLOR_TEXT_WHITE.get()) + .setEnabled(widget -> !mSoftHammer)) + .widget(new FakeSyncWidget.BooleanSyncer(() -> mSoftHammer, val -> mSoftHammer = val)); + screenElements.widget( + new TextWidget(GT_Utility.trans("135", "Platings are dented.")).setDefaultColor(COLOR_TEXT_WHITE.get()) + .setEnabled(widget -> !mHardHammer)) + .widget(new FakeSyncWidget.BooleanSyncer(() -> mHardHammer, val -> mHardHammer = val)); + screenElements.widget( + new TextWidget(GT_Utility.trans("136", "Circuitry burned out.")).setDefaultColor(COLOR_TEXT_WHITE.get()) + .setEnabled(widget -> !mSolderingTool)) + .widget(new FakeSyncWidget.BooleanSyncer(() -> mSolderingTool, val -> mSolderingTool = val)); + screenElements.widget( + new TextWidget(GT_Utility.trans("137", "That doesn't belong there.")) + .setDefaultColor( + COLOR_TEXT_WHITE.get()) + .setEnabled(widget -> !mCrowbar)) + .widget(new FakeSyncWidget.BooleanSyncer(() -> mCrowbar, val -> mCrowbar = val)); + screenElements.widget( + new TextWidget(GT_Utility.trans("138", "Incomplete Structure.")).setDefaultColor(COLOR_TEXT_WHITE.get()) + .setEnabled(widget -> !mMachine)) + .widget(new FakeSyncWidget.BooleanSyncer(() -> mMachine, val -> mMachine = val)); screenElements.widget( new TextWidget("Too Uncertain.").setDefaultColor(COLOR_TEXT_WHITE.get()) - .setEnabled(widget -> (getBaseMetaTileEntity().getErrorDisplayID() & 128) != 0)); + .setEnabled( + widget -> (getBaseMetaTileEntity().getErrorDisplayID() & 128) + != 0)); screenElements.widget( new TextWidget("Invalid Parameters.").setDefaultColor(COLOR_TEXT_WHITE.get()) - .setEnabled(widget -> (getBaseMetaTileEntity().getErrorDisplayID() & 256) != 0)); - - screenElements - .widget( - new TextWidget(GT_Utility.trans("139", "Hit with Soft Mallet")) - .setDefaultColor(COLOR_TEXT_WHITE.get()).setEnabled( - widget -> getBaseMetaTileEntity().getErrorDisplayID() == 0 - && !getBaseMetaTileEntity().isActive())) - .widget( - new FakeSyncWidget.IntegerSyncer( - () -> getBaseMetaTileEntity().getErrorDisplayID(), - val -> getBaseMetaTileEntity().setErrorDisplayID(val))) - .widget( - new FakeSyncWidget.BooleanSyncer( - () -> getBaseMetaTileEntity().isActive(), - val -> getBaseMetaTileEntity().setActive(val))); + .setEnabled( + widget -> (getBaseMetaTileEntity().getErrorDisplayID() + & 256) != 0)); + screenElements.widget( - new TextWidget(GT_Utility.trans("140", "to (re-)start the Machine")) - .setDefaultColor(COLOR_TEXT_WHITE.get()).setEnabled( - widget -> getBaseMetaTileEntity().getErrorDisplayID() == 0 - && !getBaseMetaTileEntity().isActive())); + new TextWidget(GT_Utility.trans("139", "Hit with Soft Mallet")).setDefaultColor(COLOR_TEXT_WHITE.get()) + .setEnabled( + widget -> getBaseMetaTileEntity().getErrorDisplayID() + == 0 + && !getBaseMetaTileEntity().isActive())) + .widget( + new FakeSyncWidget.IntegerSyncer( + () -> getBaseMetaTileEntity().getErrorDisplayID(), + val -> getBaseMetaTileEntity().setErrorDisplayID(val))) + .widget( + new FakeSyncWidget.BooleanSyncer( + () -> getBaseMetaTileEntity().isActive(), + val -> getBaseMetaTileEntity().setActive(val))); + screenElements.widget( + new TextWidget( + GT_Utility.trans("140", "to (re-)start the Machine")).setDefaultColor(COLOR_TEXT_WHITE.get()) + .setEnabled( + widget -> getBaseMetaTileEntity().getErrorDisplayID() + == 0 + && !getBaseMetaTileEntity().isActive())); screenElements.widget( new TextWidget(GT_Utility.trans("141", "if it doesn't start.")).setDefaultColor(COLOR_TEXT_WHITE.get()) - .setEnabled( - widget -> getBaseMetaTileEntity().getErrorDisplayID() == 0 - && !getBaseMetaTileEntity().isActive())); + .setEnabled( + widget -> getBaseMetaTileEntity().getErrorDisplayID() + == 0 + && !getBaseMetaTileEntity().isActive())); screenElements.widget( new TextWidget(GT_Utility.trans("142", "Running perfectly.")).setDefaultColor(COLOR_TEXT_WHITE.get()) - .setEnabled( - widget -> getBaseMetaTileEntity().getErrorDisplayID() == 0 - && getBaseMetaTileEntity().isActive())); + .setEnabled( + widget -> getBaseMetaTileEntity().getErrorDisplayID() + == 0 + && getBaseMetaTileEntity().isActive())); screenElements.widget( new TextWidget(GT_Utility.trans("143", "Missing Mining Pipe")).setDefaultColor(COLOR_TEXT_WHITE.get()) - .setEnabled(widget -> { - if (getBaseMetaTileEntity().getErrorDisplayID() == 0 - && this instanceof GT_MetaTileEntity_DrillerBase) { - final ItemStack tItem = inventorySlot.getMcSlot().getStack(); - return tItem == null || !GT_Utility - .areStacksEqual(tItem, GT_ModHandler.getIC2Item("miningPipe", 1L)); - } - return false; - })); + .setEnabled(widget -> { + if (getBaseMetaTileEntity().getErrorDisplayID() + == 0 + && this instanceof GT_MetaTileEntity_DrillerBase) { + final ItemStack tItem = inventorySlot.getMcSlot() + .getStack(); + return tItem == null + || !GT_Utility.areStacksEqual( + tItem, + GT_ModHandler.getIC2Item( + "miningPipe", + 1L)); + } + return false; + })); screenElements.widget( new TextWidget(GT_Utility.trans("144", "Missing Turbine Rotor")).setDefaultColor(COLOR_TEXT_WHITE.get()) - .setEnabled(widget -> { - if (getBaseMetaTileEntity().getErrorDisplayID() == 0 - && this instanceof GT_MetaTileEntity_LargeTurbine) { - final ItemStack tItem = inventorySlot.getMcSlot().getStack(); - return tItem == null || !(tItem.getItem() == GT_MetaGenerated_Tool_01.INSTANCE - && tItem.getItemDamage() >= 170 - && tItem.getItemDamage() <= 177); - } - return false; - })); + .setEnabled(widget -> { + if (getBaseMetaTileEntity().getErrorDisplayID() + == 0 + && this instanceof GT_MetaTileEntity_LargeTurbine) { + final ItemStack tItem = inventorySlot.getMcSlot() + .getStack(); + return tItem == null || !(tItem + .getItem() + == GT_MetaGenerated_Tool_01.INSTANCE + && tItem.getItemDamage() + >= 170 + && tItem.getItemDamage() + <= 177); + } + return false; + })); } protected ButtonWidget createPowerSwitchButton() { @@ -1656,21 +1737,25 @@ public abstract class GT_MetaTileEntity_MultiBlockBase extends MetaTileEntity } else { getBaseMetaTileEntity().enableWorking(); } - }).setPlayClickSoundResource( - () -> getBaseMetaTileEntity().isAllowedToWork() ? SoundResource.GUI_BUTTON_UP.resourceLocation - : SoundResource.GUI_BUTTON_DOWN.resourceLocation) - .setBackground(() -> { - List<UITexture> ret = new ArrayList<>(); - ret.add(GT_UITextures.BUTTON_STANDARD); - if (getBaseMetaTileEntity().isAllowedToWork()) { - ret.add(GT_UITextures.OVERLAY_BUTTON_POWER_SWITCH_ON); - } else { - ret.add(GT_UITextures.OVERLAY_BUTTON_POWER_SWITCH_OFF); - } - return ret.toArray(new IDrawable[0]); - }).setPos(174, 148).setSize(16, 16); + }) + .setPlayClickSoundResource( + () -> getBaseMetaTileEntity().isAllowedToWork() + ? SoundResource.GUI_BUTTON_UP.resourceLocation + : SoundResource.GUI_BUTTON_DOWN.resourceLocation) + .setBackground(() -> { + List<UITexture> ret = new ArrayList<>(); + ret.add(GT_UITextures.BUTTON_STANDARD); + if (getBaseMetaTileEntity().isAllowedToWork()) { + ret.add(GT_UITextures.OVERLAY_BUTTON_POWER_SWITCH_ON); + } else { + ret.add(GT_UITextures.OVERLAY_BUTTON_POWER_SWITCH_OFF); + } + return ret.toArray(new IDrawable[0]); + }) + .setPos(174, 148) + .setSize(16, 16); button.addTooltip(StatCollector.translateToLocal("GT5U.gui.button.power_switch")) - .setTooltipShowUpDelay(TOOLTIP_DELAY); + .setTooltipShowUpDelay(TOOLTIP_DELAY); return (ButtonWidget) button; } @@ -1679,26 +1764,30 @@ public abstract class GT_MetaTileEntity_MultiBlockBase extends MetaTileEntity if (isVoidExcessButtonEnabled()) { voidExcess = !voidExcess; } - }).setPlayClickSound(true).setBackground(() -> { - List<UITexture> ret = new ArrayList<>(); - ret.add(GT_UITextures.BUTTON_STANDARD); - if (isVoidExcessButtonEnabled()) { - if (isVoidExcessEnabled()) { - ret.add(GT_UITextures.OVERLAY_BUTTON_VOID_EXCESS_ON); - } else { - ret.add(GT_UITextures.OVERLAY_BUTTON_VOID_EXCESS_OFF); - } - } else { - if (isVoidExcessEnabled()) { - ret.add(GT_UITextures.OVERLAY_BUTTON_VOID_EXCESS_ON_DISABLED); - } else { - ret.add(GT_UITextures.OVERLAY_BUTTON_VOID_EXCESS_OFF_DISABLED); - } - } - return ret.toArray(new IDrawable[0]); - }).setPos(8, 91).setSize(16, 16); + }) + .setPlayClickSound(true) + .setBackground(() -> { + List<UITexture> ret = new ArrayList<>(); + ret.add(GT_UITextures.BUTTON_STANDARD); + if (isVoidExcessButtonEnabled()) { + if (isVoidExcessEnabled()) { + ret.add(GT_UITextures.OVERLAY_BUTTON_VOID_EXCESS_ON); + } else { + ret.add(GT_UITextures.OVERLAY_BUTTON_VOID_EXCESS_OFF); + } + } else { + if (isVoidExcessEnabled()) { + ret.add(GT_UITextures.OVERLAY_BUTTON_VOID_EXCESS_ON_DISABLED); + } else { + ret.add(GT_UITextures.OVERLAY_BUTTON_VOID_EXCESS_OFF_DISABLED); + } + } + return ret.toArray(new IDrawable[0]); + }) + .setPos(8, 91) + .setSize(16, 16); button.addTooltip(StatCollector.translateToLocal("GT5U.gui.button.void_excess")) - .setTooltipShowUpDelay(TOOLTIP_DELAY); + .setTooltipShowUpDelay(TOOLTIP_DELAY); return (ButtonWidget) button; } @@ -1707,26 +1796,32 @@ public abstract class GT_MetaTileEntity_MultiBlockBase extends MetaTileEntity if (isInputSeparationButtonEnabled()) { inputSeparation = !inputSeparation; } - }).setPlayClickSound(true).setBackground(() -> { - List<UITexture> ret = new ArrayList<>(); - ret.add(GT_UITextures.BUTTON_STANDARD); - if (isInputSeparationButtonEnabled()) { - if (isInputSeparationEnabled()) { - ret.add(GT_UITextures.OVERLAY_BUTTON_INPUT_SEPARATION_ON); - } else { - ret.add(GT_UITextures.OVERLAY_BUTTON_INPUT_SEPARATION_OFF); - } - } else { - if (isInputSeparationEnabled()) { - ret.add(GT_UITextures.OVERLAY_BUTTON_INPUT_SEPARATION_ON_DISABLED); - } else { - ret.add(GT_UITextures.OVERLAY_BUTTON_INPUT_SEPARATION_OFF_DISABLED); - } - } - return ret.toArray(new IDrawable[0]); - }).setPos(26, 91).setSize(16, 16); + }) + .setPlayClickSound(true) + .setBackground(() -> { + List<UITexture> ret = new ArrayList<>(); + ret.add(GT_UITextures.BUTTON_STANDARD); + if (isInputSeparationButtonEnabled()) { + if (isInputSeparationEnabled()) { + ret.add(GT_UITextures.OVERLAY_BUTTON_INPUT_SEPARATION_ON); + } else { + ret.add(GT_UITextures.OVERLAY_BUTTON_INPUT_SEPARATION_OFF); + } + } else { + if (isInputSeparationEnabled()) { + ret.add( + GT_UITextures.OVERLAY_BUTTON_INPUT_SEPARATION_ON_DISABLED); + } else { + ret.add( + GT_UITextures.OVERLAY_BUTTON_INPUT_SEPARATION_OFF_DISABLED); + } + } + return ret.toArray(new IDrawable[0]); + }) + .setPos(26, 91) + .setSize(16, 16); button.addTooltip(StatCollector.translateToLocal("GT5U.gui.button.input_separation")) - .setTooltipShowUpDelay(TOOLTIP_DELAY); + .setTooltipShowUpDelay(TOOLTIP_DELAY); return (ButtonWidget) button; } @@ -1735,26 +1830,30 @@ public abstract class GT_MetaTileEntity_MultiBlockBase extends MetaTileEntity if (isBatchModeButtonEnabled()) { batchMode = !batchMode; } - }).setPlayClickSound(true).setBackground(() -> { - List<UITexture> ret = new ArrayList<>(); - ret.add(GT_UITextures.BUTTON_STANDARD); - if (isBatchModeButtonEnabled()) { - if (isBatchModeEnabled()) { - ret.add(GT_UITextures.OVERLAY_BUTTON_BATCH_MODE_ON); - } else { - ret.add(GT_UITextures.OVERLAY_BUTTON_BATCH_MODE_OFF); - } - } else { - if (isBatchModeEnabled()) { - ret.add(GT_UITextures.OVERLAY_BUTTON_BATCH_MODE_ON_DISABLED); - } else { - ret.add(GT_UITextures.OVERLAY_BUTTON_BATCH_MODE_OFF_DISABLED); - } - } - return ret.toArray(new IDrawable[0]); - }).setPos(44, 91).setSize(16, 16); + }) + .setPlayClickSound(true) + .setBackground(() -> { + List<UITexture> ret = new ArrayList<>(); + ret.add(GT_UITextures.BUTTON_STANDARD); + if (isBatchModeButtonEnabled()) { + if (isBatchModeEnabled()) { + ret.add(GT_UITextures.OVERLAY_BUTTON_BATCH_MODE_ON); + } else { + ret.add(GT_UITextures.OVERLAY_BUTTON_BATCH_MODE_OFF); + } + } else { + if (isBatchModeEnabled()) { + ret.add(GT_UITextures.OVERLAY_BUTTON_BATCH_MODE_ON_DISABLED); + } else { + ret.add(GT_UITextures.OVERLAY_BUTTON_BATCH_MODE_OFF_DISABLED); + } + } + return ret.toArray(new IDrawable[0]); + }) + .setPos(44, 91) + .setSize(16, 16); button.addTooltip(StatCollector.translateToLocal("GT5U.gui.button.batch_mode")) - .setTooltipShowUpDelay(TOOLTIP_DELAY); + .setTooltipShowUpDelay(TOOLTIP_DELAY); return (ButtonWidget) button; } @@ -1763,26 +1862,30 @@ public abstract class GT_MetaTileEntity_MultiBlockBase extends MetaTileEntity if (supportsSingleRecipeLocking()) { mLockedToSingleRecipe = !mLockedToSingleRecipe; } - }).setPlayClickSound(true).setBackground(() -> { - List<UITexture> ret = new ArrayList<>(); - ret.add(GT_UITextures.BUTTON_STANDARD); - if (supportsSingleRecipeLocking()) { - if (isRecipeLockingEnabled()) { - ret.add(GT_UITextures.OVERLAY_BUTTON_RECIPE_LOCKED); - } else { - ret.add(GT_UITextures.OVERLAY_BUTTON_RECIPE_UNLOCKED); - } - } else { - if (isRecipeLockingEnabled()) { - ret.add(GT_UITextures.OVERLAY_BUTTON_RECIPE_LOCKED_DISABLED); - } else { - ret.add(GT_UITextures.OVERLAY_BUTTON_RECIPE_UNLOCKED_DISABLED); - } - } - return ret.toArray(new IDrawable[0]); - }).setPos(62, 91).setSize(16, 16); + }) + .setPlayClickSound(true) + .setBackground(() -> { + List<UITexture> ret = new ArrayList<>(); + ret.add(GT_UITextures.BUTTON_STANDARD); + if (supportsSingleRecipeLocking()) { + if (isRecipeLockingEnabled()) { + ret.add(GT_UITextures.OVERLAY_BUTTON_RECIPE_LOCKED); + } else { + ret.add(GT_UITextures.OVERLAY_BUTTON_RECIPE_UNLOCKED); + } + } else { + if (isRecipeLockingEnabled()) { + ret.add(GT_UITextures.OVERLAY_BUTTON_RECIPE_LOCKED_DISABLED); + } else { + ret.add(GT_UITextures.OVERLAY_BUTTON_RECIPE_UNLOCKED_DISABLED); + } + } + return ret.toArray(new IDrawable[0]); + }) + .setPos(62, 91) + .setSize(16, 16); button.addTooltip(StatCollector.translateToLocal("GT5U.gui.button.lock_recipe")) - .setTooltipShowUpDelay(TOOLTIP_DELAY); + .setTooltipShowUpDelay(TOOLTIP_DELAY); return (ButtonWidget) button; } } diff --git a/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_SpecialFilter.java b/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_SpecialFilter.java index 6becb5e806..890733e363 100644 --- a/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_SpecialFilter.java +++ b/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_SpecialFilter.java @@ -90,58 +90,80 @@ public abstract class GT_MetaTileEntity_SpecialFilter extends GT_MetaTileEntity_ builder.widget(new ButtonWidget().setOnClick((clickData, widget) -> { bInvertFilter = !bInvertFilter; if (bInvertFilter) { - GT_Utility.sendChatToPlayer(widget.getContext().getPlayer(), GT_Utility.trans("124", "Invert Filter")); + GT_Utility.sendChatToPlayer( + widget.getContext() + .getPlayer(), + GT_Utility.trans("124", "Invert Filter")); } else { GT_Utility.sendChatToPlayer( - widget.getContext().getPlayer(), + widget.getContext() + .getPlayer(), GT_Utility.trans("125", "Don't invert Filter")); } - }).setBackground(GT_UITextures.BUTTON_STANDARD, GT_UITextures.OVERLAY_BUTTON_INVERT_FILTER).setPos(61, 62) - .setSize(18, 18)).widget(new ButtonWidget().setOnClick((clickData, widget) -> { - bNBTAllowed = !bNBTAllowed; - if (bNBTAllowed) { - GT_Utility.sendChatToPlayer( - widget.getContext().getPlayer(), - GT_Utility.trans("126", "Ignore NBT")); - } else { - GT_Utility.sendChatToPlayer( - widget.getContext().getPlayer(), - GT_Utility.trans("127", "NBT has to match")); - } - }).setBackground(GT_UITextures.BUTTON_STANDARD, GT_UITextures.OVERLAY_BUTTON_NBT).setPos(79, 62) - .setSize(18, 18)) - .widget( - new DrawableWidget().setDrawable(GT_UITextures.PICTURE_ARROW_24_WHITE.apply(27, false)) - .setPos(6, 19).setSize(27, 24)) - .widget( - new DrawableWidget().setDrawable(GT_UITextures.PICTURE_ARROW_24_BLUE.apply(42, true)) - .setPos(53, 19).setSize(42, 24)) - .widget( - new DrawableWidget().setDrawable(GT_UITextures.PICTURE_ARROW_24_RED.apply(19, true)) - .setPos(152, 19).setSize(19, 24)) - .widget(new SlotWidget(BaseSlot.phantom(inventoryHandler, 9)) { - - @Override - protected void phantomClick(ClickData clickData, ItemStack cursorStack) { - clickTypeIcon(clickData.mouseButton != 0, cursorStack); - } - - @Override - public void buildTooltip(List<Text> tooltip) { - if (getEmptySlotTooltip() != null) { - tooltip.addAll(getEmptySlotTooltip()); - } - super.buildTooltip(tooltip); - } - - @Override - public List<String> getExtraTooltip() { - if (getItemExtraTooltip() != null) { - return getItemExtraTooltip(); - } - return Collections.emptyList(); - } - }.disableShiftInsert().setPos(34, 22).setBackground(GT_UITextures.BUTTON_STANDARD)) - .widget(SlotGroup.ofItemHandler(inventoryHandler, 3).endAtSlot(8).build().setPos(97, 4)); + }) + .setBackground( + GT_UITextures.BUTTON_STANDARD, + GT_UITextures.OVERLAY_BUTTON_INVERT_FILTER) + .setPos(61, 62) + .setSize(18, 18)) + .widget(new ButtonWidget().setOnClick((clickData, widget) -> { + bNBTAllowed = !bNBTAllowed; + if (bNBTAllowed) { + GT_Utility.sendChatToPlayer( + widget.getContext() + .getPlayer(), + GT_Utility.trans("126", "Ignore NBT")); + } else { + GT_Utility.sendChatToPlayer( + widget.getContext() + .getPlayer(), + GT_Utility.trans("127", "NBT has to match")); + } + }) + .setBackground(GT_UITextures.BUTTON_STANDARD, GT_UITextures.OVERLAY_BUTTON_NBT) + .setPos(79, 62) + .setSize(18, 18)) + .widget( + new DrawableWidget().setDrawable(GT_UITextures.PICTURE_ARROW_24_WHITE.apply(27, false)) + .setPos(6, 19) + .setSize(27, 24)) + .widget( + new DrawableWidget().setDrawable(GT_UITextures.PICTURE_ARROW_24_BLUE.apply(42, true)) + .setPos(53, 19) + .setSize(42, 24)) + .widget( + new DrawableWidget().setDrawable(GT_UITextures.PICTURE_ARROW_24_RED.apply(19, true)) + .setPos(152, 19) + .setSize(19, 24)) + .widget(new SlotWidget(BaseSlot.phantom(inventoryHandler, 9)) { + + @Override + protected void phantomClick(ClickData clickData, ItemStack cursorStack) { + clickTypeIcon(clickData.mouseButton != 0, cursorStack); + } + + @Override + public void buildTooltip(List<Text> tooltip) { + if (getEmptySlotTooltip() != null) { + tooltip.addAll(getEmptySlotTooltip()); + } + super.buildTooltip(tooltip); + } + + @Override + public List<String> getExtraTooltip() { + if (getItemExtraTooltip() != null) { + return getItemExtraTooltip(); + } + return Collections.emptyList(); + } + }.disableShiftInsert() + .setPos(34, 22) + .setBackground(GT_UITextures.BUTTON_STANDARD)) + .widget( + SlotGroup.ofItemHandler(inventoryHandler, 3) + .endAtSlot(8) + .build() + .setPos(97, 4)); } } diff --git a/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_TieredMachineBlock.java b/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_TieredMachineBlock.java index 9c069bbd5f..3424baca8b 100644 --- a/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_TieredMachineBlock.java +++ b/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_TieredMachineBlock.java @@ -124,7 +124,15 @@ public abstract class GT_MetaTileEntity_TieredMachineBlock extends MetaTileEntit protected SlotWidget createChargerSlot(int x, int y, String tooltipKey, Object[] tooltipArgs) { return (SlotWidget) new SlotWidget(inventoryHandler, rechargerSlotStartIndex()).disableShiftInsert() - .setGTTooltip(() -> mTooltipCache.getData(tooltipKey, tooltipArgs)).setTooltipShowUpDelay(TOOLTIP_DELAY) - .setBackground(getGUITextureSet().getItemSlot(), GT_UITextures.OVERLAY_SLOT_CHARGER).setPos(x, y); + .setGTTooltip( + () -> mTooltipCache.getData( + tooltipKey, + tooltipArgs)) + .setTooltipShowUpDelay( + TOOLTIP_DELAY) + .setBackground( + getGUITextureSet().getItemSlot(), + GT_UITextures.OVERLAY_SLOT_CHARGER) + .setPos(x, y); } } diff --git a/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_Transformer.java b/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_Transformer.java index a70ee0d5e7..cb98e202ad 100644 --- a/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_Transformer.java +++ b/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_Transformer.java @@ -175,9 +175,10 @@ public class GT_MetaTileEntity_Transformer extends GT_MetaTileEntity_TieredMachi for (byte i = 0; i < 6 && aBaseMetaTileEntity.getStoredEU() < aBaseMetaTileEntity.getEUCapacity(); i++) if (aBaseMetaTileEntity.inputEnergyFrom(i)) { TileEntity tTileEntity = aBaseMetaTileEntity.getTileEntityAtSide(i); - if (tTileEntity instanceof IEnergyProvider && ((IEnergyProvider) tTileEntity) - .extractEnergy(ForgeDirection.getOrientation(GT_Utility.getOppositeSide(i)), 1, true) - == 1) { + if (tTileEntity instanceof IEnergyProvider && ((IEnergyProvider) tTileEntity).extractEnergy( + ForgeDirection.getOrientation(GT_Utility.getOppositeSide(i)), + 1, + true) == 1) { long tEU = (long) ((IEnergyProvider) tTileEntity).extractEnergy( ForgeDirection.getOrientation(GT_Utility.getOppositeSide(i)), GT_Utility.safeInt(maxEUInput() * 100L / GregTech_API.mRFtoEU), @@ -271,7 +272,8 @@ public class GT_MetaTileEntity_Transformer extends GT_MetaTileEntity_TieredMachi IWailaConfigHandler config) { final int facing = getBaseMetaTileEntity().getFrontFacing(); final NBTTagCompound tag = accessor.getNBTData(); - final int side = (byte) accessor.getSide().ordinal(); + final int side = (byte) accessor.getSide() + .ordinal(); final boolean allowedToWork = tag.getBoolean("isAllowedToWork"); final byte inputTier = GT_Utility.getTier(tag.getLong("maxEUInput")); diff --git a/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_Wireless_Dynamo.java b/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_Wireless_Dynamo.java index 997898a34e..1c61f9ffa7 100644 --- a/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_Wireless_Dynamo.java +++ b/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_Wireless_Dynamo.java @@ -125,7 +125,8 @@ public class GT_MetaTileEntity_Wireless_Dynamo extends GT_MetaTileEntity_Hatch_D if (aTick == 1) { // UUID and username of the owner. - owner_uuid = aBaseMetaTileEntity.getOwnerUuid().toString(); + owner_uuid = aBaseMetaTileEntity.getOwnerUuid() + .toString(); owner_name = aBaseMetaTileEntity.getOwnerName(); strongCheckOrAddUser(owner_uuid, owner_name); diff --git a/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_Wireless_Hatch.java b/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_Wireless_Hatch.java index 756a1b138a..e17cc6fbfb 100644 --- a/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_Wireless_Hatch.java +++ b/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_Wireless_Hatch.java @@ -18,8 +18,8 @@ import gregtech.api.metatileentity.MetaTileEntity; public class GT_MetaTileEntity_Wireless_Hatch extends GT_MetaTileEntity_Hatch_Energy implements IGlobalWirelessEnergy, IWirelessEnergyHatchInformation { - private final BigInteger eu_transferred_per_operation = BigInteger - .valueOf(2 * V[mTier] * ticks_between_energy_addition); + private final BigInteger eu_transferred_per_operation = BigInteger.valueOf( + 2 * V[mTier] * ticks_between_energy_addition); private final long eu_transferred_per_operation_long = eu_transferred_per_operation.longValue(); private String owner_uuid; @@ -131,7 +131,8 @@ public class GT_MetaTileEntity_Wireless_Hatch extends GT_MetaTileEntity_Hatch_En if (aTick == 1) { // UUID and username of the owner. - owner_uuid = aBaseMetaTileEntity.getOwnerUuid().toString(); + owner_uuid = aBaseMetaTileEntity.getOwnerUuid() + .toString(); owner_name = aBaseMetaTileEntity.getOwnerName(); strongCheckOrAddUser(owner_uuid, owner_name); diff --git a/src/main/java/gregtech/api/multitileentity/MultiTileEntityBlock.java b/src/main/java/gregtech/api/multitileentity/MultiTileEntityBlock.java index 8eddd5980b..81997c1e76 100644 --- a/src/main/java/gregtech/api/multitileentity/MultiTileEntityBlock.java +++ b/src/main/java/gregtech/api/multitileentity/MultiTileEntityBlock.java @@ -448,13 +448,15 @@ public class MultiTileEntityBlock extends Block final byte aSide = (byte) side; final CoverableTileEntity tile = (CoverableTileEntity) tTileEntity; if (side != -1) { - final Block facadeBlock = tile.getCoverInfoAtSide(aSide).getFacadeBlock(); + final Block facadeBlock = tile.getCoverInfoAtSide(aSide) + .getFacadeBlock(); if (facadeBlock != null) return facadeBlock; } else { // we do not allow more than one type of facade per block, so no need to check every side // see comment in gregtech.common.covers.GT_Cover_FacadeBase.isCoverPlaceable for (byte tSide : ALL_VALID_SIDES) { - final Block facadeBlock = tile.getCoverInfoAtSide(tSide).getFacadeBlock(); + final Block facadeBlock = tile.getCoverInfoAtSide(tSide) + .getFacadeBlock(); if (facadeBlock != null) { return facadeBlock; } @@ -531,8 +533,8 @@ public class MultiTileEntityBlock extends Block return aTileEntity instanceof IMTE_GetComparatorInputOverride ? ((IMTE_GetComparatorInputOverride) aTileEntity).getComparatorInputOverride((byte) aSide) : aTileEntity instanceof IMTE_IsProvidingWeakPower - ? ((IMTE_IsProvidingWeakPower) aTileEntity) - .isProvidingWeakPower(GT_Utility.getOppositeSide(aSide)) + ? ((IMTE_IsProvidingWeakPower) aTileEntity).isProvidingWeakPower( + GT_Utility.getOppositeSide(aSide)) : super.getComparatorInputOverride(aWorld, aX, aY, aZ, aSide); } @@ -550,8 +552,8 @@ public class MultiTileEntityBlock extends Block public final boolean isSideSolid(IBlockAccess aWorld, int aX, int aY, int aZ, ForgeDirection aSide) { final TileEntity aTileEntity = aWorld.getTileEntity(aX, aY, aZ); return aTileEntity instanceof IMultiTileEntity - ? ((IMultiTileEntity) aTileEntity) - .isSideSolid((byte) (aSide != null ? aSide.ordinal() : GT_Values.SIDE_UNKNOWN)) + ? ((IMultiTileEntity) aTileEntity).isSideSolid( + (byte) (aSide != null ? aSide.ordinal() : GT_Values.SIDE_UNKNOWN)) : mOpaque; } @@ -595,8 +597,11 @@ public class MultiTileEntityBlock extends Block double aExplosionX, double aExplosionY, double aExplosionZ) { final TileEntity aTileEntity = aWorld.getTileEntity(aX, aY, aZ); return aTileEntity instanceof IMultiTileEntity - ? ((IMultiTileEntity) aTileEntity) - .getExplosionResistance(aExploder, aExplosionX, aExplosionY, aExplosionZ) + ? ((IMultiTileEntity) aTileEntity).getExplosionResistance( + aExploder, + aExplosionX, + aExplosionY, + aExplosionZ) : 1.0F; } diff --git a/src/main/java/gregtech/api/multitileentity/MultiTileEntityBlockInternal.java b/src/main/java/gregtech/api/multitileentity/MultiTileEntityBlockInternal.java index 3dcf5eded3..690430b673 100644 --- a/src/main/java/gregtech/api/multitileentity/MultiTileEntityBlockInternal.java +++ b/src/main/java/gregtech/api/multitileentity/MultiTileEntityBlockInternal.java @@ -51,8 +51,13 @@ public class MultiTileEntityBlockInternal extends Block implements IRenderedBloc public boolean placeBlock(World aWorld, int aX, int aY, int aZ, byte aSide, short aMetaData, NBTTagCompound aNBT, boolean aCauseBlockUpdates, boolean aForcePlacement) { - final MultiTileEntityContainer aMTEContainer = mMultiTileEntityRegistry - .getNewTileEntityContainer(aWorld, aX, aY, aZ, aMetaData, aNBT); + final MultiTileEntityContainer aMTEContainer = mMultiTileEntityRegistry.getNewTileEntityContainer( + aWorld, + aX, + aY, + aZ, + aMetaData, + aNBT); if (aMTEContainer == null) return false; final Block tReplacedBlock = aWorld.getBlock(aX, aY, aZ); @@ -85,8 +90,7 @@ public class MultiTileEntityBlockInternal extends Block implements IRenderedBloc try { if (aMTEContainer.mTileEntity instanceof IMTE_HasMultiBlockMachineRelevantData) { - if (((IMTE_HasMultiBlockMachineRelevantData) aMTEContainer.mTileEntity) - .hasMultiBlockMachineRelevantData()) + if (((IMTE_HasMultiBlockMachineRelevantData) aMTEContainer.mTileEntity).hasMultiBlockMachineRelevantData()) GregTech_API.causeMachineUpdate(aWorld, aX, aY, aZ); } } catch (Throwable e) { diff --git a/src/main/java/gregtech/api/multitileentity/MultiTileEntityClassContainer.java b/src/main/java/gregtech/api/multitileentity/MultiTileEntityClassContainer.java index 195fed3100..593a3c46e7 100644 --- a/src/main/java/gregtech/api/multitileentity/MultiTileEntityClassContainer.java +++ b/src/main/java/gregtech/api/multitileentity/MultiTileEntityClassContainer.java @@ -44,8 +44,11 @@ public class MultiTileEntityClassContainer { /* End and register the Builder with the registry */ final MultiTileEntityRegistry registry = mRegistry.get(); - if (mParameters.hasKey(NBT.MATERIAL) && !mParameters.hasKey(NBT.COLOR)) mParameters - .setInteger(NBT.COLOR, GT_Util.getRGBInt(Materials.get(mParameters.getString(NBT.MATERIAL)).getRGBA())); + if (mParameters.hasKey(NBT.MATERIAL) && !mParameters.hasKey(NBT.COLOR)) mParameters.setInteger( + NBT.COLOR, + GT_Util.getRGBInt( + Materials.get(mParameters.getString(NBT.MATERIAL)) + .getRGBA())); try { mCanonicalTileEntity = mClass.newInstance(); diff --git a/src/main/java/gregtech/api/multitileentity/MultiTileEntityItemInternal.java b/src/main/java/gregtech/api/multitileentity/MultiTileEntityItemInternal.java index aad842c68b..23ad00dabd 100644 --- a/src/main/java/gregtech/api/multitileentity/MultiTileEntityItemInternal.java +++ b/src/main/java/gregtech/api/multitileentity/MultiTileEntityItemInternal.java @@ -50,8 +50,8 @@ public class MultiTileEntityItemInternal extends ItemBlock implements IFluidCont @Override @SuppressWarnings("unchecked") public void addInformation(ItemStack aStack, EntityPlayer aPlayer, List aList, boolean aF3_H) { - final MultiTileEntityContainer tTileEntityContainer = mBlock.mMultiTileEntityRegistry - .getNewTileEntityContainer(aStack); + final MultiTileEntityContainer tTileEntityContainer = mBlock.mMultiTileEntityRegistry.getNewTileEntityContainer( + aStack); if (tTileEntityContainer == null) { aList.add("INVALID ITEM!"); return; @@ -74,8 +74,12 @@ public class MultiTileEntityItemInternal extends ItemBlock implements IFluidCont public void getSubItems(Item aItem, CreativeTabs aTab, List aList) { for (MultiTileEntityClassContainer tClass : mBlock.mMultiTileEntityRegistry.mRegistrations) { if (!tClass.mHidden) { - if (((IMultiTileEntity) tClass.mCanonicalTileEntity) - .getSubItems(mBlock, aItem, aTab, aList, tClass.mID)) { + if (((IMultiTileEntity) tClass.mCanonicalTileEntity).getSubItems( + mBlock, + aItem, + aTab, + aList, + tClass.mID)) { aList.add(mBlock.mMultiTileEntityRegistry.getItem(tClass.mID)); } } @@ -105,37 +109,56 @@ public class MultiTileEntityItemInternal extends ItemBlock implements IFluidCont if (aStack.stackSize == 0 || (aPlayer != null && !aPlayer.canPlayerEdit(aX, aY, aZ, aSide, aStack))) return false; - final MultiTileEntityContainer aMTEContainer = mBlock.mMultiTileEntityRegistry - .getNewTileEntityContainer(aWorld, aX, aY, aZ, aStack); + final MultiTileEntityContainer aMTEContainer = mBlock.mMultiTileEntityRegistry.getNewTileEntityContainer( + aWorld, + aX, + aY, + aZ, + aStack); - if (aMTEContainer != null - && (aPlayer == null || aPlayer.isSneaking() - || !(aMTEContainer.mTileEntity instanceof IMTE_OnlyPlaceableWhenSneaking) - || !((IMTE_OnlyPlaceableWhenSneaking) aMTEContainer.mTileEntity) - .onlyPlaceableWhenSneaking()) + if (aMTEContainer != null && (aPlayer == null || aPlayer.isSneaking() + || !(aMTEContainer.mTileEntity instanceof IMTE_OnlyPlaceableWhenSneaking) + || !((IMTE_OnlyPlaceableWhenSneaking) aMTEContainer.mTileEntity).onlyPlaceableWhenSneaking()) && (aWorld.checkNoEntityCollision(AxisAlignedBB.getBoundingBox(aX, aY, aZ, aX + 1, aY + 1, aZ + 1)) || (aMTEContainer.mTileEntity instanceof IMTE_IgnoreEntityCollisionWhenPlacing - && ((IMTE_IgnoreEntityCollisionWhenPlacing) aMTEContainer.mTileEntity) - .ignoreEntityCollisionWhenPlacing( - aStack, - aPlayer, - aWorld, - aX, - aY, - aZ, - (byte) aSide, - aHitX, - aHitY, - aHitZ))) + && ((IMTE_IgnoreEntityCollisionWhenPlacing) aMTEContainer.mTileEntity).ignoreEntityCollisionWhenPlacing( + aStack, + aPlayer, + aWorld, + aX, + aY, + aZ, + (byte) aSide, + aHitX, + aHitY, + aHitZ))) && (!(aMTEContainer.mTileEntity instanceof IMTE_CanPlace) - || ((IMTE_CanPlace) aMTEContainer.mTileEntity) - .canPlace(aStack, aPlayer, aWorld, aX, aY, aZ, (byte) aSide, aHitX, aHitY, aHitZ)) + || ((IMTE_CanPlace) aMTEContainer.mTileEntity).canPlace( + aStack, + aPlayer, + aWorld, + aX, + aY, + aZ, + (byte) aSide, + aHitX, + aHitY, + aHitZ)) && aWorld.setBlock(aX, aY, aZ, aMTEContainer.mBlock, 15 - aMTEContainer.mBlockMetaData, 2)) { aMTEContainer.setMultiTile(aWorld, aX, aY, aZ); try { - if (((IMultiTileEntity) aMTEContainer.mTileEntity) - .onPlaced(aStack, aPlayer, aWorld, aX, aY, aZ, (byte) aSide, aHitX, aHitY, aHitZ)) { + if (((IMultiTileEntity) aMTEContainer.mTileEntity).onPlaced( + aStack, + aPlayer, + aWorld, + aX, + aY, + aZ, + (byte) aSide, + aHitX, + aHitY, + aHitZ)) { aWorld.playSoundEffect( aX + 0.5, aY + 0.5, @@ -149,8 +172,7 @@ public class MultiTileEntityItemInternal extends ItemBlock implements IFluidCont } try { if (aMTEContainer.mTileEntity instanceof IMTE_HasMultiBlockMachineRelevantData - && (((IMTE_HasMultiBlockMachineRelevantData) aMTEContainer.mTileEntity) - .hasMultiBlockMachineRelevantData())) { + && (((IMTE_HasMultiBlockMachineRelevantData) aMTEContainer.mTileEntity).hasMultiBlockMachineRelevantData())) { GregTech_API.causeMachineUpdate(aWorld, aX, aY, aZ); } } catch (Throwable e) { @@ -188,8 +210,8 @@ public class MultiTileEntityItemInternal extends ItemBlock implements IFluidCont public void updateItemStack(ItemStack aStack) { final MultiTileEntityClassContainer tContainer = mBlock.mMultiTileEntityRegistry.getClassContainer(aStack); if (tContainer == null) return; - final MultiTileEntityContainer tTileEntityContainer = mBlock.mMultiTileEntityRegistry - .getNewTileEntityContainer(aStack); + final MultiTileEntityContainer tTileEntityContainer = mBlock.mMultiTileEntityRegistry.getNewTileEntityContainer( + aStack); if (tTileEntityContainer != null && tTileEntityContainer.mTileEntity instanceof IItemUpdatable) { ((IItemUpdatable) tTileEntityContainer.mTileEntity).updateItemStack(aStack); } @@ -199,8 +221,8 @@ public class MultiTileEntityItemInternal extends ItemBlock implements IFluidCont public void updateItemStack(ItemStack aStack, World aWorld, int aX, int aY, int aZ) { final MultiTileEntityClassContainer tContainer = mBlock.mMultiTileEntityRegistry.getClassContainer(aStack); if (tContainer == null) return; - final MultiTileEntityContainer tTileEntityContainer = mBlock.mMultiTileEntityRegistry - .getNewTileEntityContainer(aStack); + final MultiTileEntityContainer tTileEntityContainer = mBlock.mMultiTileEntityRegistry.getNewTileEntityContainer( + aStack); if (tTileEntityContainer != null && tTileEntityContainer.mTileEntity instanceof IItemUpdatable) { ((IItemUpdatable) tTileEntityContainer.mTileEntity).updateItemStack(aStack, aWorld, aX, aY, aZ); } @@ -210,11 +232,12 @@ public class MultiTileEntityItemInternal extends ItemBlock implements IFluidCont public int getItemStackLimit(ItemStack aStack) { final MultiTileEntityClassContainer tContainer = mBlock.mMultiTileEntityRegistry.getClassContainer(aStack); if (tContainer == null) return 1; - final MultiTileEntityContainer tTileEntityContainer = mBlock.mMultiTileEntityRegistry - .getNewTileEntityContainer(aStack); + final MultiTileEntityContainer tTileEntityContainer = mBlock.mMultiTileEntityRegistry.getNewTileEntityContainer( + aStack); if (tTileEntityContainer != null && tTileEntityContainer.mTileEntity instanceof IMTE_GetMaxStackSize) { - return ((IMTE_GetMaxStackSize) tTileEntityContainer.mTileEntity) - .getMaxStackSize(aStack, tContainer.mStackSize); + return ((IMTE_GetMaxStackSize) tTileEntityContainer.mTileEntity).getMaxStackSize( + aStack, + tContainer.mStackSize); } return tContainer.mStackSize; } @@ -226,8 +249,8 @@ public class MultiTileEntityItemInternal extends ItemBlock implements IFluidCont @Override public FluidStack getFluid(ItemStack aStack) { - final MultiTileEntityContainer tTileEntityContainer = mBlock.mMultiTileEntityRegistry - .getNewTileEntityContainer(aStack); + final MultiTileEntityContainer tTileEntityContainer = mBlock.mMultiTileEntityRegistry.getNewTileEntityContainer( + aStack); if (tTileEntityContainer != null && tTileEntityContainer.mTileEntity instanceof IFluidContainerItem) { final FluidStack rFluid = ((IFluidContainerItem) tTileEntityContainer.mTileEntity).getFluid(aStack); updateItemStack(aStack); @@ -238,8 +261,8 @@ public class MultiTileEntityItemInternal extends ItemBlock implements IFluidCont @Override public int getCapacity(ItemStack aStack) { - final MultiTileEntityContainer tTileEntityContainer = mBlock.mMultiTileEntityRegistry - .getNewTileEntityContainer(aStack); + final MultiTileEntityContainer tTileEntityContainer = mBlock.mMultiTileEntityRegistry.getNewTileEntityContainer( + aStack); if (tTileEntityContainer != null && tTileEntityContainer.mTileEntity instanceof IFluidContainerItem) { final int rCapacity = ((IFluidContainerItem) tTileEntityContainer.mTileEntity).getCapacity(aStack); updateItemStack(aStack); @@ -250,8 +273,8 @@ public class MultiTileEntityItemInternal extends ItemBlock implements IFluidCont @Override public int fill(ItemStack aStack, FluidStack aFluid, boolean aDoFill) { - final MultiTileEntityContainer tTileEntityContainer = mBlock.mMultiTileEntityRegistry - .getNewTileEntityContainer(aStack); + final MultiTileEntityContainer tTileEntityContainer = mBlock.mMultiTileEntityRegistry.getNewTileEntityContainer( + aStack); if (tTileEntityContainer != null && tTileEntityContainer.mTileEntity instanceof IFluidContainerItem) { final int tFilled = ((IFluidContainerItem) tTileEntityContainer.mTileEntity).fill(aStack, aFluid, aDoFill); updateItemStack(aStack); @@ -262,11 +285,13 @@ public class MultiTileEntityItemInternal extends ItemBlock implements IFluidCont @Override public FluidStack drain(ItemStack aStack, int aMaxDrain, boolean aDoDrain) { - final MultiTileEntityContainer tTileEntityContainer = mBlock.mMultiTileEntityRegistry - .getNewTileEntityContainer(aStack); + final MultiTileEntityContainer tTileEntityContainer = mBlock.mMultiTileEntityRegistry.getNewTileEntityContainer( + aStack); if (tTileEntityContainer != null && tTileEntityContainer.mTileEntity instanceof IFluidContainerItem) { - final FluidStack rFluid = ((IFluidContainerItem) tTileEntityContainer.mTileEntity) - .drain(aStack, aMaxDrain, aDoDrain); + final FluidStack rFluid = ((IFluidContainerItem) tTileEntityContainer.mTileEntity).drain( + aStack, + aMaxDrain, + aDoDrain); updateItemStack(aStack); return rFluid; } diff --git a/src/main/java/gregtech/api/multitileentity/MultiTileEntityRegistry.java b/src/main/java/gregtech/api/multitileentity/MultiTileEntityRegistry.java index 9fc35963b3..56414dfb4e 100644 --- a/src/main/java/gregtech/api/multitileentity/MultiTileEntityRegistry.java +++ b/src/main/java/gregtech/api/multitileentity/MultiTileEntityRegistry.java @@ -137,15 +137,19 @@ public class MultiTileEntityRegistry { if (tFailed) { GT_FML_LOGGER.error("MULTI-TILE REGISTRY ERROR: STACKTRACE START"); int i = 0; - for (StackTraceElement tElement : new Exception().getStackTrace()) - if (i++ < 5 && !tElement.getClassName().startsWith("sun")) GT_FML_LOGGER.error("\tat " + tElement); - else break; + for (StackTraceElement tElement : new Exception().getStackTrace()) if (i++ < 5 && !tElement.getClassName() + .startsWith( + "sun")) + GT_FML_LOGGER.error("\tat " + tElement); + else break; GT_FML_LOGGER.error("MULTI-TILE REGISTRY ERROR: STACKTRACE END"); return null; } - GT_LanguageManager - .addStringLocalization(mNameInternal + "." + aClassContainer.mID + ".name", aLocalised, false); + GT_LanguageManager.addStringLocalization( + mNameInternal + "." + aClassContainer.mID + ".name", + aLocalised, + false); mRegistry.put(aClassContainer.mID, aClassContainer); mLastRegisteredID = aClassContainer.mID; mRegistrations.add(aClassContainer); diff --git a/src/main/java/gregtech/api/multitileentity/base/MultiTileEntity.java b/src/main/java/gregtech/api/multitileentity/base/MultiTileEntity.java index fdf72b4eab..bff998aa89 100644 --- a/src/main/java/gregtech/api/multitileentity/base/MultiTileEntity.java +++ b/src/main/java/gregtech/api/multitileentity/base/MultiTileEntity.java @@ -137,8 +137,9 @@ public abstract class MultiTileEntity extends CoverableTileEntity implements IMu @Override public void copyTextures() { // Loading an instance - final TileEntity tCanonicalTileEntity = MultiTileEntityRegistry - .getCanonicalTileEntity(getMultiTileEntityRegistryID(), getMultiTileEntityID()); + final TileEntity tCanonicalTileEntity = MultiTileEntityRegistry.getCanonicalTileEntity( + getMultiTileEntityRegistryID(), + getMultiTileEntityID()); if (tCanonicalTileEntity instanceof MultiTileEntity) textures = ((MultiTileEntity) tCanonicalTileEntity).textures; } @@ -166,7 +167,8 @@ public abstract class MultiTileEntity extends CoverableTileEntity implements IMu if (nbt.hasKey("y")) yCoord = nbt.getInteger("y"); if (nbt.hasKey("z")) zCoord = nbt.getInteger("z"); // read the custom Name. - if (nbt.hasKey(NBT.DISPAY)) customName = nbt.getCompoundTag(NBT.DISPAY).getString(NBT.CUSTOM_NAME); + if (nbt.hasKey(NBT.DISPAY)) customName = nbt.getCompoundTag(NBT.DISPAY) + .getString(NBT.CUSTOM_NAME); // And now everything else. try { @@ -740,7 +742,8 @@ public abstract class MultiTileEntity extends CoverableTileEntity implements IMu if (!getCoverInfoAtSide(aSide).isGUIClickable()) return false; } if (isServerSide()) { - if (!privateAccess() || aPlayer.getDisplayName().equalsIgnoreCase(getOwnerName())) { + if (!privateAccess() || aPlayer.getDisplayName() + .equalsIgnoreCase(getOwnerName())) { final ItemStack tCurrentItem = aPlayer.inventory.getCurrentItem(); final byte wrenchSide = GT_Utility.determineWrenchingSide(aSide, aX, aY, aZ); @@ -767,7 +770,7 @@ public abstract class MultiTileEntity extends CoverableTileEntity implements IMu if (getCoverIDAtSide(coverSide) == 0) { if (GT_Utility.isStackInList(tCurrentItem, GregTech_API.sCovers.keySet())) { if (GregTech_API.getCoverBehaviorNew(tCurrentItem) - .isCoverPlaceable(coverSide, tCurrentItem, this) + .isCoverPlaceable(coverSide, tCurrentItem, this) && allowCoverOnSide(coverSide, new GT_ItemStack(tCurrentItem))) { setCoverItemAtSide(coverSide, tCurrentItem); if (!aPlayer.capabilities.isCreativeMode) tCurrentItem.stackSize--; @@ -953,7 +956,8 @@ public abstract class MultiTileEntity extends CoverableTileEntity implements IMu if ((ownerName.length() == 0) && isServerSide()) { setOwnerName(aPlayer.getDisplayName()); setOwnerUuid(aPlayer.getUniqueID()); - } else return !privateAccess() || aPlayer.getDisplayName().equals("Player") + } else return !privateAccess() || aPlayer.getDisplayName() + .equals("Player") || ownerName.equals("Player") || ownerName.equals(aPlayer.getDisplayName()); return true; @@ -1066,7 +1070,11 @@ public abstract class MultiTileEntity extends CoverableTileEntity implements IMu public void getWailaBody(ItemStack itemStack, List<String> currenttip, IWailaDataAccessor accessor, IWailaConfigHandler config) { super.getWailaBody(itemStack, currenttip, accessor, config); - currenttip.add(String.format("Facing: %s", ForgeDirection.getOrientation(getFrontFacing()).name())); + currenttip.add( + String.format( + "Facing: %s", + ForgeDirection.getOrientation(getFrontFacing()) + .name())); } @Override @@ -1143,7 +1151,8 @@ public abstract class MultiTileEntity extends CoverableTileEntity implements IMu final IFluidTank tTank = getFluidTankDrainable((byte) aDirection.ordinal(), aFluid); if (tTank == null || tTank.getFluid() == null || tTank.getFluidAmount() == 0 - || !tTank.getFluid().isFluidEqual(aFluid)) + || !tTank.getFluid() + .isFluidEqual(aFluid)) return null; return tTank.drain(aFluid.amount, aDoDrain); } @@ -1160,14 +1169,18 @@ public abstract class MultiTileEntity extends CoverableTileEntity implements IMu public boolean canFill(ForgeDirection aDirection, Fluid aFluid) { if (aFluid == null) return false; final IFluidTank tTank = getFluidTankFillable((byte) aDirection.ordinal(), new FluidStack(aFluid, 0)); - return tTank != null && (tTank.getFluid() == null || tTank.getFluid().getFluid() == aFluid); + return tTank != null && (tTank.getFluid() == null || tTank.getFluid() + .getFluid() + == aFluid); } @Override public boolean canDrain(ForgeDirection aDirection, Fluid aFluid) { if (aFluid == null) return false; final IFluidTank tTank = getFluidTankDrainable((byte) aDirection.ordinal(), new FluidStack(aFluid, 0)); - return tTank != null && (tTank.getFluid() != null && tTank.getFluid().getFluid() == aFluid); + return tTank != null && (tTank.getFluid() != null && tTank.getFluid() + .getFluid() + == aFluid); } @Override diff --git a/src/main/java/gregtech/api/multitileentity/machine/MultiTileBasicMachine.java b/src/main/java/gregtech/api/multitileentity/machine/MultiTileBasicMachine.java index a3d94bd97c..8d96ff58f5 100644 --- a/src/main/java/gregtech/api/multitileentity/machine/MultiTileBasicMachine.java +++ b/src/main/java/gregtech/api/multitileentity/machine/MultiTileBasicMachine.java @@ -218,7 +218,7 @@ public abstract class MultiTileBasicMachine extends TickableMultiTileEntity impl // `setCapacityMultiplier` for (int i = 0; i < inputTanks.length; i++) { inputTanks[i] = new FluidTankGT(capacity).setCapacityMultiplier(maxParallel * 2L) - .readFromNBT(nbt, NBT.TANK_IN + i); + .readFromNBT(nbt, NBT.TANK_IN + i); } for (int i = 0; i < outputTanks.length; i++) { outputTanks[i] = new FluidTankGT().readFromNBT(nbt, NBT.TANK_OUT + i); @@ -287,8 +287,9 @@ public abstract class MultiTileBasicMachine extends TickableMultiTileEntity impl @Override public void copyTextures() { // Loading an instance - final TileEntity tCanonicalTileEntity = MultiTileEntityRegistry - .getCanonicalTileEntity(getMultiTileEntityRegistryID(), getMultiTileEntityID()); + final TileEntity tCanonicalTileEntity = MultiTileEntityRegistry.getCanonicalTileEntity( + getMultiTileEntityRegistryID(), + getMultiTileEntityID()); if (tCanonicalTileEntity instanceof MultiTileBasicMachine) { textures = ((MultiTileBasicMachine) tCanonicalTileEntity).textures; texturesInactive = ((MultiTileBasicMachine) tCanonicalTileEntity).texturesInactive; @@ -301,13 +302,14 @@ public abstract class MultiTileBasicMachine extends TickableMultiTileEntity impl @Override public ITexture[] getTexture(Block aBlock, byte aSide, boolean isActive, int aRenderPass) { if (aSide != facing) { - return new ITexture[] { TextureFactory - .of(textures[GT_Values.FACING_ROTATIONS[facing][aSide]], GT_Util.getRGBaArray(rgba)) }; + return new ITexture[] { TextureFactory.of( + textures[GT_Values.FACING_ROTATIONS[facing][aSide]], + GT_Util.getRGBaArray(rgba)) }; } return new ITexture[] { TextureFactory.of(textures[GT_Values.FACING_ROTATIONS[facing][aSide]], GT_Util.getRGBaArray(rgba)), - TextureFactory - .of((active ? texturesActive : texturesInactive)[GT_Values.FACING_ROTATIONS[facing][aSide]]) }; + TextureFactory.of( + (active ? texturesActive : texturesInactive)[GT_Values.FACING_ROTATIONS[facing][aSide]]) }; } @Override @@ -518,8 +520,13 @@ public abstract class MultiTileBasicMachine extends TickableMultiTileEntity impl } ProcessingLogic logic = ((ProcessingLogicHost) this).getProcessingLogic(); logic.clear(); - boolean result = logic.setInputItems(inputInventory.getStacks().toArray(new ItemStack[0])) - .setCurrentOutputItems(outputInventory.getStacks().toArray(new ItemStack[0])).process(); + boolean result = logic.setInputItems( + inputInventory.getStacks() + .toArray(new ItemStack[0])) + .setCurrentOutputItems( + outputInventory.getStacks() + .toArray(new ItemStack[0])) + .process(); setDuration(logic.getDuration()); setEut(logic.getEut()); setItemOutputs(logic.getOutputItems()); @@ -591,7 +598,9 @@ public abstract class MultiTileBasicMachine extends TickableMultiTileEntity impl if (isActive() && activitySound != null) { if (activitySoundLoop == null) { activitySoundLoop = new GT_SoundLoop(activitySound, this, false, true); - Minecraft.getMinecraft().getSoundHandler().playSound(activitySoundLoop); + Minecraft.getMinecraft() + .getSoundHandler() + .playSound(activitySoundLoop); } } else { if (activitySoundLoop != null) { diff --git a/src/main/java/gregtech/api/multitileentity/multiblock/base/MultiBlockController.java b/src/main/java/gregtech/api/multitileentity/multiblock/base/MultiBlockController.java index f5f36a7b0f..72e766d54c 100644 --- a/src/main/java/gregtech/api/multitileentity/multiblock/base/MultiBlockController.java +++ b/src/main/java/gregtech/api/multitileentity/multiblock/base/MultiBlockController.java @@ -176,8 +176,14 @@ public abstract class MultiBlockController<T extends MultiBlockController<T>> ex super.writeMultiTileNBT(nbt); nbt.setBoolean(NBT.STRUCTURE_OK, structureOkay); - nbt.setByte(NBT.ROTATION, (byte) extendedFacing.getRotation().getIndex()); - nbt.setByte(NBT.FLIP, (byte) extendedFacing.getFlip().getIndex()); + nbt.setByte( + NBT.ROTATION, + (byte) extendedFacing.getRotation() + .getIndex()); + nbt.setByte( + NBT.FLIP, + (byte) extendedFacing.getFlip() + .getIndex()); saveUpgradeInventoriesToNBT(nbt); } @@ -684,8 +690,13 @@ public abstract class MultiBlockController<T extends MultiBlockController<T>> ex @Override public boolean placeBlock(S t, World world, int x, int y, int z, ItemStack trigger) { final MultiTileEntityRegistry tRegistry = MultiTileEntityRegistry.getRegistry(registryID); - final MultiTileEntityContainer tContainer = tRegistry - .getNewTileEntityContainer(world, x, y, z, meta, null); + final MultiTileEntityContainer tContainer = tRegistry.getNewTileEntityContainer( + world, + x, + y, + z, + meta, + null); if (tContainer == null) { GT_FML_LOGGER.error("NULL CONTAINER"); return false; @@ -751,7 +762,8 @@ public abstract class MultiBlockController<T extends MultiBlockController<T>> ex final IFluidTank tTank = getFluidTankDrainable(aPart, (byte) aDirection.ordinal(), aFluid); if (tTank == null || tTank.getFluid() == null || tTank.getFluidAmount() == 0 - || !tTank.getFluid().isFluidEqual(aFluid)) + || !tTank.getFluid() + .isFluidEqual(aFluid)) return null; final FluidStack rDrained = tTank.drain(aFluid.amount, aDoDrain); if (rDrained != null && aDoDrain) markInventoryBeenModified(); @@ -772,14 +784,18 @@ public abstract class MultiBlockController<T extends MultiBlockController<T>> ex public boolean canFill(MultiBlockPart aPart, ForgeDirection aDirection, Fluid aFluid) { if (aFluid == null) return false; final IFluidTank tTank = getFluidTankFillable(aPart, (byte) aDirection.ordinal(), new FluidStack(aFluid, 0)); - return tTank != null && (tTank.getFluid() == null || tTank.getFluid().getFluid() == aFluid); + return tTank != null && (tTank.getFluid() == null || tTank.getFluid() + .getFluid() + == aFluid); } @Override public boolean canDrain(MultiBlockPart aPart, ForgeDirection aDirection, Fluid aFluid) { if (aFluid == null) return false; final IFluidTank tTank = getFluidTankDrainable(aPart, (byte) aDirection.ordinal(), new FluidStack(aFluid, 0)); - return tTank != null && (tTank.getFluid() != null && tTank.getFluid().getFluid() == aFluid); + return tTank != null && (tTank.getFluid() != null && tTank.getFluid() + .getFluid() + == aFluid); } @Override @@ -1077,7 +1093,9 @@ public abstract class MultiBlockController<T extends MultiBlockController<T>> ex } final String lockedInventory = aPart.getLockedInventory(); if (lockedInventory != null && !lockedInventory.equals("")) { - str.append(" [Locked: ").append(lockedInventory).append("]"); + str.append(" [Locked: ") + .append(lockedInventory) + .append("]"); } return str.toString(); @@ -1127,17 +1145,25 @@ public abstract class MultiBlockController<T extends MultiBlockController<T>> ex */ protected ItemStack[] getAllItemInputs() { - return getInventoriesForInput().getStacks().toArray(new ItemStack[0]); + return getInventoriesForInput().getStacks() + .toArray(new ItemStack[0]); } protected ItemStack[] getAllOutputItems() { - return getInventoriesForOutput().getStacks().toArray(new ItemStack[0]); + return getInventoriesForOutput().getStacks() + .toArray(new ItemStack[0]); } protected Iterable<Pair<ItemStack[], String>> getItemInputsForEachInventory() { - return multiBlockInputInventory.entrySet().stream() - .map((entry) -> Pair.of(entry.getValue().getStacks().toArray(new ItemStack[0]), entry.getKey())) - .collect(Collectors.toList()); + return multiBlockInputInventory.entrySet() + .stream() + .map( + (entry) -> Pair.of( + entry.getValue() + .getStacks() + .toArray(new ItemStack[0]), + entry.getKey())) + .collect(Collectors.toList()); } protected void setItemOutputs(String inventory, ItemStack... itemOutputs) { @@ -1193,7 +1219,8 @@ public abstract class MultiBlockController<T extends MultiBlockController<T>> ex for (FluidStack fluid : fluidsToOutput) { int index = 0; while (fluid != null && fluid.amount > 0 && index < tanks.size()) { - int filled = tanks.get(index++).fill(fluid, true); + int filled = tanks.get(index++) + .fill(fluid, true); fluid.amount -= filled; } } @@ -1219,12 +1246,15 @@ public abstract class MultiBlockController<T extends MultiBlockController<T>> ex boolean result = false; if (isSeparateInputs()) { for (Pair<ItemStack[], String> inventory : getItemInputsForEachInventory()) { - IItemHandlerModifiable outputInventory = multiBlockOutputInventory - .getOrDefault(inventory.getLeft(), null); + IItemHandlerModifiable outputInventory = multiBlockOutputInventory.getOrDefault( + inventory.getLeft(), + null); result = logic.setInputItems(inventory.getLeft()) - .setCurrentOutputItems( - outputInventory != null ? outputInventory.getStacks().toArray(new ItemStack[0]) : null) - .process(); + .setCurrentOutputItems( + outputInventory != null ? outputInventory.getStacks() + .toArray(new ItemStack[0]) + : null) + .process(); if (result) { inventoryName = inventory.getRight(); break; @@ -1232,7 +1262,9 @@ public abstract class MultiBlockController<T extends MultiBlockController<T>> ex logic.clear(); } } else { - result = logic.setInputItems(getAllItemInputs()).setCurrentOutputItems(getAllOutputItems()).process(); + result = logic.setInputItems(getAllItemInputs()) + .setCurrentOutputItems(getAllOutputItems()) + .process(); } setDuration(logic.getDuration()); setEut(logic.getEut()); @@ -1283,7 +1315,8 @@ public abstract class MultiBlockController<T extends MultiBlockController<T>> ex } protected Widget getGregTechLogo() { - return new DrawableWidget().setDrawable(getGUITextureSet().getGregTechLogo()).setSize(17, 17); + return new DrawableWidget().setDrawable(getGUITextureSet().getGregTechLogo()) + .setSize(17, 17); } @Override @@ -1298,86 +1331,97 @@ public abstract class MultiBlockController<T extends MultiBlockController<T>> ex TabContainer tabs = new TabContainer().setButtonSize(20, 24); tabs.addTabButton( new TabButton(page++) - .setBackground( - false, - ModularUITextures.VANILLA_TAB_TOP_START.getSubArea(0, 0, 1f, 0.5f), - new ItemDrawable(getStackForm(1)).withFixedSize(16, 16).withOffset(2, 4)) - .setBackground( - true, - ModularUITextures.VANILLA_TAB_TOP_START.getSubArea(0, 0.5f, 1f, 1f), - new ItemDrawable(getStackForm(1)).withFixedSize(16, 16).withOffset(2, 4)) - .addTooltip(getLocalName()).setPos(20 * (page - 1), -20)) - .addPage(createMainPage().setSize(getGUIWidth(), getGUIHeight())); + .setBackground( + false, + ModularUITextures.VANILLA_TAB_TOP_START.getSubArea(0, 0, 1f, 0.5f), + new ItemDrawable(getStackForm(1)).withFixedSize(16, 16) + .withOffset(2, 4)) + .setBackground( + true, + ModularUITextures.VANILLA_TAB_TOP_START.getSubArea(0, 0.5f, 1f, 1f), + new ItemDrawable(getStackForm(1)).withFixedSize(16, 16) + .withOffset(2, 4)) + .addTooltip(getLocalName()) + .setPos(20 * (page - 1), -20)) + .addPage(createMainPage().setSize(getGUIWidth(), getGUIHeight())); if (hasItemInput()) { tabs.addTabButton( new TabButton(page++) - .setBackground( - false, - ModularUITextures.VANILLA_TAB_TOP_START.getSubArea(0, 0, 1f, 0.5f), - GT_UITextures.PICTURE_ITEM_IN.withFixedSize(16, 16).withOffset(2, 4)) - .setBackground( - true, - ModularUITextures.VANILLA_TAB_TOP_START.getSubArea(0, 0.5f, 1f, 1f), - GT_UITextures.PICTURE_ITEM_IN.withFixedSize(16, 16).withOffset(2, 4)) - .setPos(20 * (page - 1), -20)) - .addPage( - new MultiChildWidget().addChild(getItemInventoryInputGUI()) - .addChild(getGregTechLogo().setPos(147, 86)) - .setSize(getGUIWidth(), getGUIHeight())); + .setBackground( + false, + ModularUITextures.VANILLA_TAB_TOP_START.getSubArea(0, 0, 1f, 0.5f), + GT_UITextures.PICTURE_ITEM_IN.withFixedSize(16, 16) + .withOffset(2, 4)) + .setBackground( + true, + ModularUITextures.VANILLA_TAB_TOP_START.getSubArea(0, 0.5f, 1f, 1f), + GT_UITextures.PICTURE_ITEM_IN.withFixedSize(16, 16) + .withOffset(2, 4)) + .setPos(20 * (page - 1), -20)) + .addPage( + new MultiChildWidget().addChild(getItemInventoryInputGUI()) + .addChild(getGregTechLogo().setPos(147, 86)) + .setSize(getGUIWidth(), getGUIHeight())); } if (hasItemOutput()) { tabs.addTabButton( new TabButton(page++) - .setBackground( - false, - ModularUITextures.VANILLA_TAB_TOP_START.getSubArea(0, 0, 1f, 0.5f), - GT_UITextures.PICTURE_ITEM_OUT.withFixedSize(16, 16).withOffset(2, 4)) - .setBackground( - true, - ModularUITextures.VANILLA_TAB_TOP_START.getSubArea(0, 0.5f, 1f, 1f), - GT_UITextures.PICTURE_ITEM_OUT.withFixedSize(16, 16).withOffset(2, 4)) - .setPos(20 * (page - 1), -20)) - .addPage( - new MultiChildWidget().addChild(getItemInventoryOutputGUI()) - .addChild(getGregTechLogo().setPos(147, 86)) - .setSize(getGUIWidth(), getGUIHeight())); + .setBackground( + false, + ModularUITextures.VANILLA_TAB_TOP_START.getSubArea(0, 0, 1f, 0.5f), + GT_UITextures.PICTURE_ITEM_OUT.withFixedSize(16, 16) + .withOffset(2, 4)) + .setBackground( + true, + ModularUITextures.VANILLA_TAB_TOP_START.getSubArea(0, 0.5f, 1f, 1f), + GT_UITextures.PICTURE_ITEM_OUT.withFixedSize(16, 16) + .withOffset(2, 4)) + .setPos(20 * (page - 1), -20)) + .addPage( + new MultiChildWidget().addChild(getItemInventoryOutputGUI()) + .addChild(getGregTechLogo().setPos(147, 86)) + .setSize(getGUIWidth(), getGUIHeight())); } if (hasFluidInput()) { tabs.addTabButton( new TabButton(page++) - .setBackground( - false, - ModularUITextures.VANILLA_TAB_TOP_START.getSubArea(0, 0, 1f, 0.5f), - GT_UITextures.PICTURE_FLUID_IN.withFixedSize(16, 16).withOffset(2, 4)) - .setBackground( - true, - ModularUITextures.VANILLA_TAB_TOP_START.getSubArea(0, 0.5f, 1f, 1f), - GT_UITextures.PICTURE_FLUID_IN.withFixedSize(16, 16).withOffset(2, 4)) - .setPos(20 * (page - 1), -20)) - .addPage( - new MultiChildWidget().addChild(getFluidInventoryInputGUI()) - .addChild(getGregTechLogo().setPos(147, 86)) - .setSize(getGUIWidth(), getGUIHeight())); + .setBackground( + false, + ModularUITextures.VANILLA_TAB_TOP_START.getSubArea(0, 0, 1f, 0.5f), + GT_UITextures.PICTURE_FLUID_IN.withFixedSize(16, 16) + .withOffset(2, 4)) + .setBackground( + true, + ModularUITextures.VANILLA_TAB_TOP_START.getSubArea(0, 0.5f, 1f, 1f), + GT_UITextures.PICTURE_FLUID_IN.withFixedSize(16, 16) + .withOffset(2, 4)) + .setPos(20 * (page - 1), -20)) + .addPage( + new MultiChildWidget().addChild(getFluidInventoryInputGUI()) + .addChild(getGregTechLogo().setPos(147, 86)) + .setSize(getGUIWidth(), getGUIHeight())); } if (hasFluidOutput()) { tabs.addTabButton( new TabButton(page++) - .setBackground( - false, - ModularUITextures.VANILLA_TAB_TOP_START.getSubArea(0, 0, 1f, 0.5f), - GT_UITextures.PICTURE_FLUID_OUT.withFixedSize(16, 16).withOffset(2, 4)) - .setBackground( - true, - ModularUITextures.VANILLA_TAB_TOP_START.getSubArea(0, 0.5f, 1f, 1f), - GT_UITextures.PICTURE_FLUID_OUT.withFixedSize(16, 16).withOffset(2, 4)) - .setPos(20 * (page - 1), -20)) - .addPage( - new MultiChildWidget().addChild(getFluidInventoryOutputGUI()) - .addChild(getGregTechLogo().setPos(147, 86)) - .setSize(getGUIWidth(), getGUIHeight())); + .setBackground( + false, + ModularUITextures.VANILLA_TAB_TOP_START.getSubArea(0, 0, 1f, 0.5f), + GT_UITextures.PICTURE_FLUID_OUT.withFixedSize(16, 16) + .withOffset(2, 4)) + .setBackground( + true, + ModularUITextures.VANILLA_TAB_TOP_START.getSubArea(0, 0.5f, 1f, 1f), + GT_UITextures.PICTURE_FLUID_OUT.withFixedSize(16, 16) + .withOffset(2, 4)) + .setPos(20 * (page - 1), -20)) + .addPage( + new MultiChildWidget().addChild(getFluidInventoryOutputGUI()) + .addChild(getGregTechLogo().setPos(147, 86)) + .setSize(getGUIWidth(), getGUIHeight())); } builder.widget(tabs); } @@ -1385,26 +1429,30 @@ public abstract class MultiBlockController<T extends MultiBlockController<T>> ex protected MultiChildWidget createMainPage() { MultiChildWidget page = new MultiChildWidget(); page.addChild( - new DrawableWidget().setDrawable(GT_UITextures.PICTURE_SCREEN_BLACK).setPos(7, 4).setSize(160, 75)) - .addChild(createButtons()); + new DrawableWidget().setDrawable(GT_UITextures.PICTURE_SCREEN_BLACK) + .setPos(7, 4) + .setSize(160, 75)) + .addChild(createButtons()); return page; } protected MultiChildWidget createButtons() { MultiChildWidget buttons = new MultiChildWidget(); - buttons.setSize(16, 167).setPos(7, 86); + buttons.setSize(16, 167) + .setPos(7, 86); buttons.addChild(createPowerSwitchButton()) - .addChild(new FakeSyncWidget.BooleanSyncer(() -> isAllowedToWork(), val -> { - if (val) enableWorking(); - else disableWorking(); - })).addChild(createVoidExcessButton()) - .addChild(new FakeSyncWidget.BooleanSyncer(() -> voidExcess, val -> voidExcess = val)) - .addChild(createInputSeparationButton()) - .addChild(new FakeSyncWidget.BooleanSyncer(() -> separateInputs, val -> separateInputs = val)) - .addChild(createBatchModeButton()) - .addChild(new FakeSyncWidget.BooleanSyncer(() -> batchMode, val -> batchMode = val)) - .addChild(createLockToSingleRecipeButton()) - .addChild(new FakeSyncWidget.BooleanSyncer(() -> recipeLock, val -> recipeLock = val)); + .addChild(new FakeSyncWidget.BooleanSyncer(() -> isAllowedToWork(), val -> { + if (val) enableWorking(); + else disableWorking(); + })) + .addChild(createVoidExcessButton()) + .addChild(new FakeSyncWidget.BooleanSyncer(() -> voidExcess, val -> voidExcess = val)) + .addChild(createInputSeparationButton()) + .addChild(new FakeSyncWidget.BooleanSyncer(() -> separateInputs, val -> separateInputs = val)) + .addChild(createBatchModeButton()) + .addChild(new FakeSyncWidget.BooleanSyncer(() -> batchMode, val -> batchMode = val)) + .addChild(createLockToSingleRecipeButton()) + .addChild(new FakeSyncWidget.BooleanSyncer(() -> recipeLock, val -> recipeLock = val)); return buttons; } @@ -1415,11 +1463,13 @@ public abstract class MultiBlockController<T extends MultiBlockController<T>> ex for (int rows = 0; rows * 4 < Math.min(inv.getSlots(), 128); rows++) { final int columnsToMake = Math.min(Math.min(inv.getSlots(), 128) - rows * 4, 4); for (int column = 0; column < columnsToMake; column++) { - scrollable - .widget(new SlotWidget(inv, rows * 4 + column).setPos(column * 18, rows * 18).setSize(18, 18)); + scrollable.widget( + new SlotWidget(inv, rows * 4 + column).setPos(column * 18, rows * 18) + .setSize(18, 18)); } } - return scrollable.setSize(18 * 4 + 4, 18 * 5).setPos(52, 7); + return scrollable.setSize(18 * 4 + 4, 18 * 5) + .setPos(52, 7); } protected Widget getItemInventoryOutputGUI() { @@ -1428,11 +1478,13 @@ public abstract class MultiBlockController<T extends MultiBlockController<T>> ex for (int rows = 0; rows * 4 < Math.min(inv.getSlots(), 128); rows++) { final int columnsToMake = Math.min(Math.min(inv.getSlots(), 128) - rows * 4, 4); for (int column = 0; column < columnsToMake; column++) { - scrollable - .widget(new SlotWidget(inv, rows * 4 + column).setPos(column * 18, rows * 18).setSize(18, 18)); + scrollable.widget( + new SlotWidget(inv, rows * 4 + column).setPos(column * 18, rows * 18) + .setSize(18, 18)); } } - return scrollable.setSize(18 * 4 + 4, 18 * 5).setPos(52, 7); + return scrollable.setSize(18 * 4 + 4, 18 * 5) + .setPos(52, 7); } protected IItemHandlerModifiable getInventoriesForInput() { @@ -1450,10 +1502,13 @@ public abstract class MultiBlockController<T extends MultiBlockController<T>> ex final int columnsToMake = Math.min(tanks.length - rows * 4, 4); for (int column = 0; column < columnsToMake; column++) { final FluidSlotWidget fluidSlot = new FluidSlotWidget(tanks[rows * 4 + column]); - scrollable.widget(fluidSlot.setPos(column * 18, rows * 18).setSize(18, 18)); + scrollable.widget( + fluidSlot.setPos(column * 18, rows * 18) + .setSize(18, 18)); } } - return scrollable.setSize(18 * 4 + 4, 18 * 4).setPos(52, 7); + return scrollable.setSize(18 * 4 + 4, 18 * 4) + .setPos(52, 7); } protected Widget getFluidInventoryOutputGUI() { @@ -1464,10 +1519,13 @@ public abstract class MultiBlockController<T extends MultiBlockController<T>> ex for (int column = 0; column < columnsToMake; column++) { final FluidSlotWidget fluidSlot = new FluidSlotWidget(tanks[rows * 4 + column]); fluidSlot.setInteraction(true, false); - scrollable.widget(fluidSlot.setPos(column * 18, rows * 18).setSize(18, 18)); + scrollable.widget( + fluidSlot.setPos(column * 18, rows * 18) + .setSize(18, 18)); } } - return scrollable.setSize(18 * 4 + 4, 18 * 5).setPos(52, 7); + return scrollable.setSize(18 * 4 + 4, 18 * 5) + .setPos(52, 7); } protected ButtonWidget createPowerSwitchButton() { @@ -1477,7 +1535,8 @@ public abstract class MultiBlockController<T extends MultiBlockController<T>> ex } else { enableWorking(); } - }).setPlayClickSound(true); + }) + .setPlayClickSound(true); button.setBackground(() -> { List<UITexture> ret = new ArrayList<>(); ret.add(GT_UITextures.BUTTON_STANDARD); @@ -1487,9 +1546,11 @@ public abstract class MultiBlockController<T extends MultiBlockController<T>> ex ret.add(GT_UITextures.OVERLAY_BUTTON_POWER_SWITCH_OFF); } return ret.toArray(new IDrawable[0]); - }).setPos(144, 0).setSize(16, 16); + }) + .setPos(144, 0) + .setSize(16, 16); button.addTooltip(StatCollector.translateToLocal("GT5U.gui.button.power_switch")) - .setTooltipShowUpDelay(TOOLTIP_DELAY); + .setTooltipShowUpDelay(TOOLTIP_DELAY); return button; } @@ -1498,7 +1559,8 @@ public abstract class MultiBlockController<T extends MultiBlockController<T>> ex if (isVoidExcessButtonEnabled()) { voidExcess = !voidExcess; } - }).setPlayClickSound(true); + }) + .setPlayClickSound(true); button.setBackground(() -> { List<UITexture> ret = new ArrayList<>(); ret.add(GT_UITextures.BUTTON_STANDARD); @@ -1516,9 +1578,11 @@ public abstract class MultiBlockController<T extends MultiBlockController<T>> ex } } return ret.toArray(new IDrawable[0]); - }).setPos(54, 0).setSize(16, 16); + }) + .setPos(54, 0) + .setSize(16, 16); button.addTooltip(StatCollector.translateToLocal("GT5U.gui.button.void_excess")) - .setTooltipShowUpDelay(TOOLTIP_DELAY); + .setTooltipShowUpDelay(TOOLTIP_DELAY); return button; } @@ -1535,26 +1599,32 @@ public abstract class MultiBlockController<T extends MultiBlockController<T>> ex if (isInputSeparationButtonEnabled()) { separateInputs = !separateInputs; } - }).setPlayClickSound(true).setBackground(() -> { - List<UITexture> ret = new ArrayList<>(); - ret.add(GT_UITextures.BUTTON_STANDARD); - if (isInputSeparationButtonEnabled()) { - if (isInputSeparationEnabled()) { - ret.add(GT_UITextures.OVERLAY_BUTTON_INPUT_SEPARATION_ON); - } else { - ret.add(GT_UITextures.OVERLAY_BUTTON_INPUT_SEPARATION_OFF); - } - } else { - if (isInputSeparationEnabled()) { - ret.add(GT_UITextures.OVERLAY_BUTTON_INPUT_SEPARATION_ON_DISABLED); - } else { - ret.add(GT_UITextures.OVERLAY_BUTTON_INPUT_SEPARATION_OFF_DISABLED); - } - } - return ret.toArray(new IDrawable[0]); - }).setPos(36, 0).setSize(16, 16); + }) + .setPlayClickSound(true) + .setBackground(() -> { + List<UITexture> ret = new ArrayList<>(); + ret.add(GT_UITextures.BUTTON_STANDARD); + if (isInputSeparationButtonEnabled()) { + if (isInputSeparationEnabled()) { + ret.add(GT_UITextures.OVERLAY_BUTTON_INPUT_SEPARATION_ON); + } else { + ret.add(GT_UITextures.OVERLAY_BUTTON_INPUT_SEPARATION_OFF); + } + } else { + if (isInputSeparationEnabled()) { + ret.add( + GT_UITextures.OVERLAY_BUTTON_INPUT_SEPARATION_ON_DISABLED); + } else { + ret.add( + GT_UITextures.OVERLAY_BUTTON_INPUT_SEPARATION_OFF_DISABLED); + } + } + return ret.toArray(new IDrawable[0]); + }) + .setPos(36, 0) + .setSize(16, 16); button.addTooltip(StatCollector.translateToLocal("GT5U.gui.button.input_separation")) - .setTooltipShowUpDelay(TOOLTIP_DELAY); + .setTooltipShowUpDelay(TOOLTIP_DELAY); return (ButtonWidget) button; } @@ -1571,26 +1641,30 @@ public abstract class MultiBlockController<T extends MultiBlockController<T>> ex if (isBatchModeButtonEnabled()) { batchMode = !batchMode; } - }).setPlayClickSound(true).setBackground(() -> { - List<UITexture> ret = new ArrayList<>(); - ret.add(GT_UITextures.BUTTON_STANDARD); - if (isBatchModeButtonEnabled()) { - if (isBatchModeEnabled()) { - ret.add(GT_UITextures.OVERLAY_BUTTON_BATCH_MODE_ON); - } else { - ret.add(GT_UITextures.OVERLAY_BUTTON_BATCH_MODE_OFF); - } - } else { - if (isBatchModeEnabled()) { - ret.add(GT_UITextures.OVERLAY_BUTTON_BATCH_MODE_ON_DISABLED); - } else { - ret.add(GT_UITextures.OVERLAY_BUTTON_BATCH_MODE_OFF_DISABLED); - } - } - return ret.toArray(new IDrawable[0]); - }).setPos(18, 0).setSize(16, 16); + }) + .setPlayClickSound(true) + .setBackground(() -> { + List<UITexture> ret = new ArrayList<>(); + ret.add(GT_UITextures.BUTTON_STANDARD); + if (isBatchModeButtonEnabled()) { + if (isBatchModeEnabled()) { + ret.add(GT_UITextures.OVERLAY_BUTTON_BATCH_MODE_ON); + } else { + ret.add(GT_UITextures.OVERLAY_BUTTON_BATCH_MODE_OFF); + } + } else { + if (isBatchModeEnabled()) { + ret.add(GT_UITextures.OVERLAY_BUTTON_BATCH_MODE_ON_DISABLED); + } else { + ret.add(GT_UITextures.OVERLAY_BUTTON_BATCH_MODE_OFF_DISABLED); + } + } + return ret.toArray(new IDrawable[0]); + }) + .setPos(18, 0) + .setSize(16, 16); button.addTooltip(StatCollector.translateToLocal("GT5U.gui.button.batch_mode")) - .setTooltipShowUpDelay(TOOLTIP_DELAY); + .setTooltipShowUpDelay(TOOLTIP_DELAY); return (ButtonWidget) button; } @@ -1607,26 +1681,30 @@ public abstract class MultiBlockController<T extends MultiBlockController<T>> ex if (supportsSingleRecipeLocking()) { recipeLock = !recipeLock; } - }).setPlayClickSound(true).setBackground(() -> { - List<UITexture> ret = new ArrayList<>(); - ret.add(GT_UITextures.BUTTON_STANDARD); - if (supportsSingleRecipeLocking()) { - if (isRecipeLockingEnabled()) { - ret.add(GT_UITextures.OVERLAY_BUTTON_RECIPE_LOCKED); - } else { - ret.add(GT_UITextures.OVERLAY_BUTTON_RECIPE_UNLOCKED); - } - } else { - if (isRecipeLockingEnabled()) { - ret.add(GT_UITextures.OVERLAY_BUTTON_RECIPE_LOCKED_DISABLED); - } else { - ret.add(GT_UITextures.OVERLAY_BUTTON_RECIPE_UNLOCKED_DISABLED); - } - } - return ret.toArray(new IDrawable[0]); - }).setPos(0, 0).setSize(16, 16); + }) + .setPlayClickSound(true) + .setBackground(() -> { + List<UITexture> ret = new ArrayList<>(); + ret.add(GT_UITextures.BUTTON_STANDARD); + if (supportsSingleRecipeLocking()) { + if (isRecipeLockingEnabled()) { + ret.add(GT_UITextures.OVERLAY_BUTTON_RECIPE_LOCKED); + } else { + ret.add(GT_UITextures.OVERLAY_BUTTON_RECIPE_UNLOCKED); + } + } else { + if (isRecipeLockingEnabled()) { + ret.add(GT_UITextures.OVERLAY_BUTTON_RECIPE_LOCKED_DISABLED); + } else { + ret.add(GT_UITextures.OVERLAY_BUTTON_RECIPE_UNLOCKED_DISABLED); + } + } + return ret.toArray(new IDrawable[0]); + }) + .setPos(0, 0) + .setSize(16, 16); button.addTooltip(StatCollector.translateToLocal("GT5U.gui.button.lock_recipe")) - .setTooltipShowUpDelay(TOOLTIP_DELAY); + .setTooltipShowUpDelay(TOOLTIP_DELAY); return (ButtonWidget) button; } diff --git a/src/main/java/gregtech/api/multitileentity/multiblock/base/MultiBlockPart.java b/src/main/java/gregtech/api/multitileentity/multiblock/base/MultiBlockPart.java index 9d40732b74..0ea8cd77c8 100644 --- a/src/main/java/gregtech/api/multitileentity/multiblock/base/MultiBlockPart.java +++ b/src/main/java/gregtech/api/multitileentity/multiblock/base/MultiBlockPart.java @@ -335,8 +335,9 @@ public abstract class MultiBlockPart extends NonTickableMultiTileEntity @Override public void copyTextures() { // Loading an instance - final TileEntity tCanonicalTileEntity = MultiTileEntityRegistry - .getCanonicalTileEntity(getMultiTileEntityRegistryID(), getMultiTileEntityID()); + final TileEntity tCanonicalTileEntity = MultiTileEntityRegistry.getCanonicalTileEntity( + getMultiTileEntityRegistryID(), + getMultiTileEntityID()); if (tCanonicalTileEntity instanceof MultiBlockPart) textures = ((MultiBlockPart) tCanonicalTileEntity).textures; } @@ -662,11 +663,14 @@ public abstract class MultiBlockPart extends NonTickableMultiTileEntity for (int rows = 0; rows * 4 < Math.min(inv.getSlots(), 128); rows++) { int columnsToMake = Math.min(Math.min(inv.getSlots(), 128) - rows * 4, 4); for (int column = 0; column < columnsToMake; column++) { - scrollable - .widget(new SlotWidget(inv, rows * 4 + column).setPos(column * 18, rows * 18).setSize(18, 18)); + scrollable.widget( + new SlotWidget(inv, rows * 4 + column).setPos(column * 18, rows * 18) + .setSize(18, 18)); } } - builder.widget(scrollable.setSize(18 * 4 + 4, 18 * 4).setPos(52, 18)); + builder.widget( + scrollable.setSize(18 * 4 + 4, 18 * 4) + .setPos(52, 18)); DropDownWidget dropDown = new DropDownWidget(); dropDown.addDropDownItemsSimple( controller.getInventoryNames(this), @@ -684,8 +688,11 @@ public abstract class MultiBlockPart extends NonTickableMultiTileEntity }, true); builder.widget( - dropDown.setSelected(mLockedInventoryIndex).setExpandedMaxHeight(60) - .setDirection(DropDownWidget.Direction.DOWN).setPos(53, 5).setSize(70, 11)); + dropDown.setSelected(mLockedInventoryIndex) + .setExpandedMaxHeight(60) + .setDirection(DropDownWidget.Direction.DOWN) + .setPos(53, 5) + .setSize(70, 11)); } protected String getNameOfInventoryFromIndex(final IMultiBlockController controller, int index) { @@ -710,10 +717,14 @@ public abstract class MultiBlockPart extends NonTickableMultiTileEntity if (modeSelected(FLUID_OUT)) { fluidSlot.setInteraction(true, false); } - scrollable.widget(fluidSlot.setPos(column * 18, rows * 18).setSize(18, 18)); + scrollable.widget( + fluidSlot.setPos(column * 18, rows * 18) + .setSize(18, 18)); } } - builder.widget(scrollable.setSize(18 * 4 + 4, 18 * 4).setPos(52, 7)); + builder.widget( + scrollable.setSize(18 * 4 + 4, 18 * 4) + .setPos(52, 7)); } @Override @@ -747,8 +758,9 @@ public abstract class MultiBlockPart extends NonTickableMultiTileEntity public void addGregTechLogo(Builder builder) { if (modeSelected(ITEM_IN, ITEM_OUT)) { builder.widget( - new DrawableWidget().setDrawable(getGUITextureSet().getGregTechLogo()).setSize(17, 17) - .setPos(152, 74)); + new DrawableWidget().setDrawable(getGUITextureSet().getGregTechLogo()) + .setSize(17, 17) + .setPos(152, 74)); } else { super.addGregTechLogo(builder); } diff --git a/src/main/java/gregtech/api/net/GT_Packet_Pollution.java b/src/main/java/gregtech/api/net/GT_Packet_Pollution.java index b095dd6238..c298af2db4 100644 --- a/src/main/java/gregtech/api/net/GT_Packet_Pollution.java +++ b/src/main/java/gregtech/api/net/GT_Packet_Pollution.java @@ -25,7 +25,9 @@ public class GT_Packet_Pollution extends GT_Packet_New { @Override public void encode(ByteBuf aOut) { - aOut.writeInt(chunk.chunkXPos).writeInt(chunk.chunkZPos).writeInt(pollution); + aOut.writeInt(chunk.chunkXPos) + .writeInt(chunk.chunkZPos) + .writeInt(pollution); } @Override diff --git a/src/main/java/gregtech/api/net/GT_Packet_SendCoverData.java b/src/main/java/gregtech/api/net/GT_Packet_SendCoverData.java index 66faa2c7d7..971ed66aec 100644 --- a/src/main/java/gregtech/api/net/GT_Packet_SendCoverData.java +++ b/src/main/java/gregtech/api/net/GT_Packet_SendCoverData.java @@ -88,7 +88,9 @@ public class GT_Packet_SendCoverData extends GT_Packet_New { aData.readInt(), aData.readByte(), coverId = aData.readInt(), - GregTech_API.getCoverBehaviorNew(coverId).createDataObject().readFromPacket(aData, null)); + GregTech_API.getCoverBehaviorNew(coverId) + .createDataObject() + .readFromPacket(aData, null)); } @Override diff --git a/src/main/java/gregtech/api/net/GT_Packet_SetConfigurationCircuit.java b/src/main/java/gregtech/api/net/GT_Packet_SetConfigurationCircuit.java index 917e0865da..ac72730705 100644 --- a/src/main/java/gregtech/api/net/GT_Packet_SetConfigurationCircuit.java +++ b/src/main/java/gregtech/api/net/GT_Packet_SetConfigurationCircuit.java @@ -101,8 +101,10 @@ public class GT_Packet_SetConfigurationCircuit extends GT_Packet_New { final IConfigurationCircuitSupport machine = ((BaseTileEntity) tile).getConfigurationCircuitSupport(); if (machine == null) return; if (!machine.allowSelectCircuit()) return; - machine.getConfigurationCircuits().stream().filter(stack -> GT_Utility.areStacksEqual(stack, circuit)) - .findFirst() - .ifPresent(stack -> ((IHasInventory) tile).setInventorySlotContents(machine.getCircuitSlot(), stack)); + machine.getConfigurationCircuits() + .stream() + .filter(stack -> GT_Utility.areStacksEqual(stack, circuit)) + .findFirst() + .ifPresent(stack -> ((IHasInventory) tile).setInventorySlotContents(machine.getCircuitSlot(), stack)); } } diff --git a/src/main/java/gregtech/api/net/GT_Packet_TileEntity.java b/src/main/java/gregtech/api/net/GT_Packet_TileEntity.java index cb38ca5d32..99a5c55dc6 100644 --- a/src/main/java/gregtech/api/net/GT_Packet_TileEntity.java +++ b/src/main/java/gregtech/api/net/GT_Packet_TileEntity.java @@ -138,8 +138,19 @@ public class GT_Packet_TileEntity extends GT_Packet_New { mUpdate, mRedstone, mColor); - else if (tTileEntity instanceof BaseMetaPipeEntity) ((BaseMetaPipeEntity) tTileEntity) - .receiveMetaTileEntityData(mID, mC0, mC1, mC2, mC3, mC4, mC5, mTexture, mUpdate, mRedstone, mColor); + else if (tTileEntity instanceof BaseMetaPipeEntity) + ((BaseMetaPipeEntity) tTileEntity).receiveMetaTileEntityData( + mID, + mC0, + mC1, + mC2, + mC3, + mC4, + mC5, + mTexture, + mUpdate, + mRedstone, + mColor); } catch (Exception e) { GT_Mod.GT_FML_LOGGER.error( "Exception setting tile entity data for tile entity {} at ({}, {}, {})", diff --git a/src/main/java/gregtech/api/net/GT_Packet_TileEntityCoverGUI.java b/src/main/java/gregtech/api/net/GT_Packet_TileEntityCoverGUI.java index f14e000a3b..86321f9287 100644 --- a/src/main/java/gregtech/api/net/GT_Packet_TileEntityCoverGUI.java +++ b/src/main/java/gregtech/api/net/GT_Packet_TileEntityCoverGUI.java @@ -177,7 +177,9 @@ public class GT_Packet_TileEntityCoverGUI extends GT_Packet_New { aData.readInt(), aData.readByte(), coverID = aData.readInt(), - GregTech_API.getCoverBehaviorNew(coverID).createDataObject().readFromPacket(aData, null), + GregTech_API.getCoverBehaviorNew(coverID) + .createDataObject() + .readFromPacket(aData, null), aData.readInt(), aData.readInt(), aData.readInt()); @@ -207,7 +209,8 @@ public class GT_Packet_TileEntityCoverGUI extends GT_Packet_New { if (gui instanceof GT_GUICover) { ((GT_GUICover) gui).setParentGuiId(parentGuiId); } - Minecraft.getMinecraft().displayGuiScreen(gui); + Minecraft.getMinecraft() + .displayGuiScreen(gui); } } } diff --git a/src/main/java/gregtech/api/net/GT_Packet_TileEntityCoverNew.java b/src/main/java/gregtech/api/net/GT_Packet_TileEntityCoverNew.java index 562edc9770..453ed88e60 100644 --- a/src/main/java/gregtech/api/net/GT_Packet_TileEntityCoverNew.java +++ b/src/main/java/gregtech/api/net/GT_Packet_TileEntityCoverNew.java @@ -96,7 +96,9 @@ public class GT_Packet_TileEntityCoverNew extends GT_Packet_New { aData.readInt(), aData.readByte(), coverId = aData.readInt(), - GregTech_API.getCoverBehaviorNew(coverId).createDataObject().readFromPacket(aData, mPlayer), + GregTech_API.getCoverBehaviorNew(coverId) + .createDataObject() + .readFromPacket(aData, mPlayer), aData.readInt()); } diff --git a/src/main/java/gregtech/api/net/GT_Packet_WirelessRedstoneCover.java b/src/main/java/gregtech/api/net/GT_Packet_WirelessRedstoneCover.java index cac5405eec..6f0f8d215d 100644 --- a/src/main/java/gregtech/api/net/GT_Packet_WirelessRedstoneCover.java +++ b/src/main/java/gregtech/api/net/GT_Packet_WirelessRedstoneCover.java @@ -88,7 +88,9 @@ public class GT_Packet_WirelessRedstoneCover extends GT_Packet_TileEntityCover { if (world != null && world.blockExists(mX, mY, mZ)) { TileEntity tile = world.getTileEntity(mX, mY, mZ); if (tile instanceof IGregTechTileEntity && !((IGregTechTileEntity) tile).isDead()) { - int tPrivateChannel = (mCheckBoxValue > 0) ? mPlayer.getUniqueID().hashCode() & PRIVATE_MASK : 0; + int tPrivateChannel = (mCheckBoxValue > 0) ? mPlayer.getUniqueID() + .hashCode() + & PRIVATE_MASK : 0; int tCoverData = tPrivateChannel | (mCheckBoxValue & CHECKBOX_MASK) | (mPublicChannel & PUBLIC_MASK); ((IGregTechTileEntity) tile).receiveCoverData(side, coverID, tCoverData); } diff --git a/src/main/java/gregtech/api/objects/GT_ChunkManager.java b/src/main/java/gregtech/api/objects/GT_ChunkManager.java index 291e669741..6101deedbc 100644 --- a/src/main/java/gregtech/api/objects/GT_ChunkManager.java +++ b/src/main/java/gregtech/api/objects/GT_ChunkManager.java @@ -46,9 +46,12 @@ public class GT_ChunkManager List<Ticket> validTickets = new ArrayList<>(); if (GT_Values.alwaysReloadChunkloaders) { for (Ticket ticket : tickets) { - int x = ticket.getModData().getInteger("OwnerX"); - int y = ticket.getModData().getInteger("OwnerY"); - int z = ticket.getModData().getInteger("OwnerZ"); + int x = ticket.getModData() + .getInteger("OwnerX"); + int y = ticket.getModData() + .getInteger("OwnerY"); + int z = ticket.getModData() + .getInteger("OwnerZ"); if (y > 0) { TileEntity tile = world.getTileEntity(x, y, z); if (tile != null && tile instanceof IGregTechTileEntity @@ -59,8 +62,7 @@ public class GT_ChunkManager if (((IGregTechTileEntity) tile).getMetaTileEntity() instanceof IChunkLoader) ForgeChunkManager.forceChunk( ticket, - ((IChunkLoader) ((IGregTechTileEntity) tile).getMetaTileEntity()) - .getActiveChunk()); + ((IChunkLoader) ((IGregTechTileEntity) tile).getMetaTileEntity()).getActiveChunk()); validTickets.add(ticket); } } @@ -86,16 +88,21 @@ public class GT_ChunkManager public static boolean requestPlayerChunkLoad(TileEntity owner, ChunkCoordIntPair chunkXZ, String player) { if (!GT_Values.enableChunkloaders) return false; if (!GT_Values.alwaysReloadChunkloaders && chunkXZ == null) return false; - if (GT_Values.debugChunkloaders && chunkXZ != null) GT_Log.out - .println("GT_ChunkManager: Chunk request: (" + chunkXZ.chunkXPos + ", " + chunkXZ.chunkZPos + ")"); + if (GT_Values.debugChunkloaders && chunkXZ != null) GT_Log.out.println( + "GT_ChunkManager: Chunk request: (" + chunkXZ.chunkXPos + ", " + chunkXZ.chunkZPos + ")"); if (instance.registeredTickets.containsKey(owner)) { ForgeChunkManager.forceChunk(instance.registeredTickets.get(owner), chunkXZ); } else { Ticket ticket; - if (player.equals("")) ticket = ForgeChunkManager - .requestTicket(GT_Mod.instance, owner.getWorldObj(), ForgeChunkManager.Type.NORMAL); - else ticket = ForgeChunkManager - .requestPlayerTicket(GT_Mod.instance, player, owner.getWorldObj(), ForgeChunkManager.Type.NORMAL); + if (player.equals("")) ticket = ForgeChunkManager.requestTicket( + GT_Mod.instance, + owner.getWorldObj(), + ForgeChunkManager.Type.NORMAL); + else ticket = ForgeChunkManager.requestPlayerTicket( + GT_Mod.instance, + player, + owner.getWorldObj(), + ForgeChunkManager.Type.NORMAL); if (ticket == null) { if (GT_Values.debugChunkloaders) GT_Log.out.println("GT_ChunkManager: ForgeChunkManager.requestTicket failed"); @@ -128,8 +135,8 @@ public class GT_ChunkManager if (!GT_Values.enableChunkloaders) return; Ticket ticket = instance.registeredTickets.get(owner); if (ticket != null) { - if (GT_Values.debugChunkloaders) GT_Log.out - .println("GT_ChunkManager: Chunk release: (" + chunkXZ.chunkXPos + ", " + chunkXZ.chunkZPos + ")"); + if (GT_Values.debugChunkloaders) GT_Log.out.println( + "GT_ChunkManager: Chunk release: (" + chunkXZ.chunkXPos + ", " + chunkXZ.chunkZPos + ")"); ForgeChunkManager.unforceChunk(ticket, chunkXZ); } } @@ -146,8 +153,8 @@ public class GT_ChunkManager + ", " + owner.zCoord + ")"); - for (ChunkCoordIntPair chunk : ticket.getChunkList()) GT_Log.out - .println("GT_ChunkManager: Chunk release: (" + chunk.chunkXPos + ", " + chunk.chunkZPos + ")"); + for (ChunkCoordIntPair chunk : ticket.getChunkList()) GT_Log.out.println( + "GT_ChunkManager: Chunk release: (" + chunk.chunkXPos + ", " + chunk.chunkZPos + ")"); } ForgeChunkManager.releaseTicket(ticket); instance.registeredTickets.remove(owner); diff --git a/src/main/java/gregtech/api/objects/GT_FluidStack.java b/src/main/java/gregtech/api/objects/GT_FluidStack.java index 55bbf712fa..b5b6f6ff19 100644 --- a/src/main/java/gregtech/api/objects/GT_FluidStack.java +++ b/src/main/java/gregtech/api/objects/GT_FluidStack.java @@ -18,8 +18,8 @@ import gregtech.api.util.GT_Utility; */ public class GT_FluidStack extends FluidStack { - private static final Collection<GT_FluidStack> sAllFluidStacks = Collections - .newSetFromMap(new WeakHashMap<>(10000)); + private static final Collection<GT_FluidStack> sAllFluidStacks = Collections.newSetFromMap( + new WeakHashMap<>(10000)); private static volatile boolean lock = false; private Fluid mFluid; @@ -57,7 +57,8 @@ public class GT_FluidStack extends FluidStack { if (ForgeVersion.getBuildVersion() < 1355 && ForgeVersion.getRevisionVersion() < 4) { int fluidID; try { - fluidID = this.getFluid().getID(); + fluidID = this.getFluid() + .getID(); } catch (Throwable e) { System.err.println(e); } @@ -79,7 +80,11 @@ public class GT_FluidStack extends FluidStack { @Override public String toString() { - return String - .format("GT_FluidStack: %s x %s, ID:%s", this.amount, this.getFluid().getName(), this.getFluidID()); + return String.format( + "GT_FluidStack: %s x %s, ID:%s", + this.amount, + this.getFluid() + .getName(), + this.getFluidID()); } } diff --git a/src/main/java/gregtech/api/objects/GT_HashSet.java b/src/main/java/gregtech/api/objects/GT_HashSet.java index 578d22a4a3..1f12b669b3 100644 --- a/src/main/java/gregtech/api/objects/GT_HashSet.java +++ b/src/main/java/gregtech/api/objects/GT_HashSet.java @@ -44,7 +44,8 @@ public class GT_HashSet<E extends GT_ItemStack> extends AbstractSet<E> { @Override public Iterator<E> iterator() { - return (Iterator<E>) map.keySet().iterator(); + return (Iterator<E>) map.keySet() + .iterator(); } @Override diff --git a/src/main/java/gregtech/api/objects/GT_StdRenderedTexture.java b/src/main/java/gregtech/api/objects/GT_StdRenderedTexture.java index 079260c7dc..e40fb96ef2 100644 --- a/src/main/java/gregtech/api/objects/GT_StdRenderedTexture.java +++ b/src/main/java/gregtech/api/objects/GT_StdRenderedTexture.java @@ -35,7 +35,8 @@ public class GT_StdRenderedTexture extends GT_RenderedTexture { @Override public void renderYNeg(RenderBlocks aRenderer, Block aBlock, int aX, int aY, int aZ) { LightingHelper lighting = new LightingHelper(aRenderer); - lighting.setupLightingYNeg(aBlock, aX, aY, aZ).setupColor(ForgeDirection.DOWN.ordinal(), mRGBa); + lighting.setupLightingYNeg(aBlock, aX, aY, aZ) + .setupColor(ForgeDirection.DOWN.ordinal(), mRGBa); aRenderer.renderFaceYNeg(aBlock, aX, aY, aZ, mIconContainer.getIcon()); if (mIconContainer.getOverlayIcon() != null) { lighting.setupColor(ForgeDirection.DOWN.ordinal(), 0xffffff); diff --git a/src/main/java/gregtech/api/objects/GT_UO_Dimension.java b/src/main/java/gregtech/api/objects/GT_UO_Dimension.java index fffa68fadf..4f534956c7 100644 --- a/src/main/java/gregtech/api/objects/GT_UO_Dimension.java +++ b/src/main/java/gregtech/api/objects/GT_UO_Dimension.java @@ -17,12 +17,16 @@ public class GT_UO_Dimension { fFluids = HashBiMap.create(); if (aConfigCategory.containsKey("Dimension")) { aConfigCategory.get("Dimension").comment = "Dimension ID or Class Name"; - Dimension = aConfigCategory.get("Dimension").getString(); + Dimension = aConfigCategory.get("Dimension") + .getString(); } maxChance = 0; // GT_FML_LOGGER.info("GT UO "+aConfigCategory.getName()+" Dimension:"+Dimension); - for (int i = 0; i < aConfigCategory.getChildren().size(); i++) { - GT_UO_Fluid fluid = new GT_UO_Fluid((ConfigCategory) aConfigCategory.getChildren().toArray()[i]); + for (int i = 0; i < aConfigCategory.getChildren() + .size(); i++) { + GT_UO_Fluid fluid = new GT_UO_Fluid( + (ConfigCategory) aConfigCategory.getChildren() + .toArray()[i]); fFluids.put(fluid.Registry, fluid); maxChance += fluid.Chance; } @@ -40,7 +44,8 @@ public class GT_UO_Dimension { } public String getUOFluidKey(GT_UO_Fluid uoFluid) { - return fFluids.inverse().get(uoFluid); + return fFluids.inverse() + .get(uoFluid); } public GT_UO_Fluid getUOFluid(String key) { diff --git a/src/main/java/gregtech/api/objects/GT_UO_DimensionList.java b/src/main/java/gregtech/api/objects/GT_UO_DimensionList.java index e717f857d5..cd03380d8d 100644 --- a/src/main/java/gregtech/api/objects/GT_UO_DimensionList.java +++ b/src/main/java/gregtech/api/objects/GT_UO_DimensionList.java @@ -24,7 +24,10 @@ public class GT_UO_DimensionList { if (fDimensionList.containsKey(Integer.toString(aDimension))) return fDimensionList.get(Integer.toString(aDimension)); for (BiMap.Entry<String, GT_UO_Dimension> dl : fDimensionList.entrySet()) - if (DimensionManager.getProvider(aDimension).getClass().getName().contains(dl.getValue().Dimension)) + if (DimensionManager.getProvider(aDimension) + .getClass() + .getName() + .contains(dl.getValue().Dimension)) return dl.getValue(); return fDimensionList.get("Default"); } @@ -41,14 +44,19 @@ public class GT_UO_DimensionList { public void SetConfigValues(String aDimensionName, String aDimension, String aName, String aRegistry, int aMinAmount, int aMaxAmount, int aChance, int aDecreasePerOperationAmount) { String Category = fCategory + "." + aDimensionName; - fConfig.get(Category, "Dimension", aDimension).getString(); + fConfig.get(Category, "Dimension", aDimension) + .getString(); Category += "." + aName; - fConfig.get(Category, "Registry", aRegistry).getString(); - fConfig.get(Category, "MinAmount", aMinAmount).getInt(aMinAmount); - fConfig.get(Category, "MaxAmount", aMaxAmount).getInt(aMaxAmount); - fConfig.get(Category, "Chance", aChance).getInt(aChance); + fConfig.get(Category, "Registry", aRegistry) + .getString(); + fConfig.get(Category, "MinAmount", aMinAmount) + .getInt(aMinAmount); + fConfig.get(Category, "MaxAmount", aMaxAmount) + .getInt(aMaxAmount); + fConfig.get(Category, "Chance", aChance) + .getInt(aChance); fConfig.get(Category, "DecreasePerOperationAmount", aDecreasePerOperationAmount) - .getInt(aDecreasePerOperationAmount); + .getInt(aDecreasePerOperationAmount); // IT IS IN BUCKETS!!! } @@ -74,12 +82,17 @@ public class GT_UO_DimensionList { fConfig.setCategoryComment(fCategory + ".Moon", "Set Moon Generating"); blackList = new int[] { -1, 1 }; - blackList = aConfig.get(fCategory, "DimBlackList", blackList, "Dimension IDs Black List").getIntList(); + blackList = aConfig.get(fCategory, "DimBlackList", blackList, "Dimension IDs Black List") + .getIntList(); java.util.Arrays.sort(blackList); - for (int i = 0; i < fConfig.getCategory(fCategory).getChildren().size(); i++) { + for (int i = 0; i < fConfig.getCategory(fCategory) + .getChildren() + .size(); i++) { GT_UO_Dimension Dimension = new GT_UO_Dimension( - (ConfigCategory) fConfig.getCategory(fCategory).getChildren().toArray()[i]); + (ConfigCategory) fConfig.getCategory(fCategory) + .getChildren() + .toArray()[i]); fDimensionList.put(Dimension.Dimension, Dimension); } } diff --git a/src/main/java/gregtech/api/objects/GT_UO_Fluid.java b/src/main/java/gregtech/api/objects/GT_UO_Fluid.java index 7916131b63..555d8856b2 100644 --- a/src/main/java/gregtech/api/objects/GT_UO_Fluid.java +++ b/src/main/java/gregtech/api/objects/GT_UO_Fluid.java @@ -19,26 +19,31 @@ public class GT_UO_Fluid { public GT_UO_Fluid(ConfigCategory aConfigCategory) { // TODO CONFIGURE if (aConfigCategory.containsKey("Registry")) { aConfigCategory.get("Registry").comment = "Fluid registry name"; - Registry = aConfigCategory.get("Registry").getString(); + Registry = aConfigCategory.get("Registry") + .getString(); } if (aConfigCategory.containsKey("MaxAmount")) { - aConfigCategory - .get("MaxAmount").comment = "Max amount generation (per operation, sets the VeinData) 80000 MAX"; - MaxAmount = aConfigCategory.get("MaxAmount").getInt(0); + aConfigCategory.get( + "MaxAmount").comment = "Max amount generation (per operation, sets the VeinData) 80000 MAX"; + MaxAmount = aConfigCategory.get("MaxAmount") + .getInt(0); } if (aConfigCategory.containsKey("MinAmount")) { aConfigCategory.get("MinAmount").comment = "Min amount generation (per operation, sets the VeinData) 0 MIN"; - MinAmount = aConfigCategory.get("MinAmount").getInt(0); + MinAmount = aConfigCategory.get("MinAmount") + .getInt(0); } if (aConfigCategory.containsKey("Chance")) { aConfigCategory.get( "Chance").comment = "Chance generating (weighted chance!, there will be a fluid in chunk always!)"; - Chance = aConfigCategory.get("Chance").getInt(0); + Chance = aConfigCategory.get("Chance") + .getInt(0); } if (aConfigCategory.containsKey("DecreasePerOperationAmount")) { aConfigCategory.get( "DecreasePerOperationAmount").comment = "Decrease per operation (actual fluid gained works like (Litre)VeinData/5000)"; - DecreasePerOperationAmount = aConfigCategory.get("DecreasePerOperationAmount").getInt(5); + DecreasePerOperationAmount = aConfigCategory.get("DecreasePerOperationAmount") + .getInt(5); } // GT_FML_LOGGER.info("GT UO "+aConfigCategory.getName()+" Fluid:"+Registry+" Max:"+MaxAmount+" // Min:"+MinAmount+" Chance:"+Chance); diff --git a/src/main/java/gregtech/api/objects/ItemData.java b/src/main/java/gregtech/api/objects/ItemData.java index 52abab19cb..72d5cc5900 100644 --- a/src/main/java/gregtech/api/objects/ItemData.java +++ b/src/main/java/gregtech/api/objects/ItemData.java @@ -121,6 +121,8 @@ public class ItemData { @Override public String toString() { if (mPrefix == null || mMaterial == null || mMaterial.mMaterial == null) return ""; - return String.valueOf(new StringBuilder().append(mPrefix.name()).append(mMaterial.mMaterial.mName)); + return String.valueOf( + new StringBuilder().append(mPrefix.name()) + .append(mMaterial.mMaterial.mName)); } } diff --git a/src/main/java/gregtech/api/objects/ReverseShapedRecipe.java b/src/main/java/gregtech/api/objects/ReverseShapedRecipe.java index 5dd14186e1..9b0507402c 100644 --- a/src/main/java/gregtech/api/objects/ReverseShapedRecipe.java +++ b/src/main/java/gregtech/api/objects/ReverseShapedRecipe.java @@ -35,8 +35,10 @@ public class ReverseShapedRecipe { if (!recipeOptional.isPresent()) continue; GT_Recipe recipe = recipeOptional.get(); ItemStack[] replacement = new ItemStack[recipe.mOutputs.length]; - GT_MetaTileEntity_Disassembler - .handleRecipeTransformation(recipe.mOutputs, replacement, Collections.singleton(recipe.mOutputs)); + GT_MetaTileEntity_Disassembler.handleRecipeTransformation( + recipe.mOutputs, + replacement, + Collections.singleton(recipe.mOutputs)); recipe.mOutputs = replacement; sDisassemblerRecipes.add(recipe); diff --git a/src/main/java/gregtech/api/objects/ReverseShapelessRecipe.java b/src/main/java/gregtech/api/objects/ReverseShapelessRecipe.java index 656f7728c5..a872f2a8f0 100644 --- a/src/main/java/gregtech/api/objects/ReverseShapelessRecipe.java +++ b/src/main/java/gregtech/api/objects/ReverseShapelessRecipe.java @@ -35,8 +35,10 @@ public class ReverseShapelessRecipe { if (!recipeOptional.isPresent()) continue; GT_Recipe recipe = recipeOptional.get(); ItemStack[] replacement = new ItemStack[recipe.mOutputs.length]; - GT_MetaTileEntity_Disassembler - .handleRecipeTransformation(recipe.mOutputs, replacement, Collections.singleton(recipe.mOutputs)); + GT_MetaTileEntity_Disassembler.handleRecipeTransformation( + recipe.mOutputs, + replacement, + Collections.singleton(recipe.mOutputs)); recipe.mOutputs = replacement; sDisassemblerRecipes.add(recipe); diff --git a/src/main/java/gregtech/api/objects/XSTR.java b/src/main/java/gregtech/api/objects/XSTR.java index cd4f0e6bb4..d9c0b4bdb1 100644 --- a/src/main/java/gregtech/api/objects/XSTR.java +++ b/src/main/java/gregtech/api/objects/XSTR.java @@ -39,7 +39,9 @@ public class XSTR extends Random { @Override public synchronized void setSeed(long seed) { - if (!Thread.currentThread().getStackTrace()[2].getClassName().equals(Random.class.getName())) + if (!Thread.currentThread() + .getStackTrace()[2].getClassName() + .equals(Random.class.getName())) throw new NoSuchMethodError("This is meant to be shared!, leave seed state alone!"); } }; diff --git a/src/main/java/gregtech/api/render/TextureFactory.java b/src/main/java/gregtech/api/render/TextureFactory.java index 1cc5b51717..06a883bd1c 100644 --- a/src/main/java/gregtech/api/render/TextureFactory.java +++ b/src/main/java/gregtech/api/render/TextureFactory.java @@ -48,7 +48,8 @@ public final class TextureFactory { * @return The instance of an {@link ITexture} implementation */ public static ITexture of(final ITexture... textures) { - return builder().addLayer(textures).build(); + return builder().addLayer(textures) + .build(); } /** @@ -65,7 +66,10 @@ public final class TextureFactory { */ public static ITexture of(final IIconContainer bottom, final IIconContainer top, final IIconContainer north, final IIconContainer south, final IIconContainer west, final IIconContainer east, final short[] rgba) { - return builder().addIcon(bottom, top, north, south, west, east).setRGBA(rgba).setAllowAlpha(true).build(); + return builder().addIcon(bottom, top, north, south, west, east) + .setRGBA(rgba) + .setAllowAlpha(true) + .build(); } /** @@ -79,7 +83,10 @@ public final class TextureFactory { */ public static ITexture of(final IIconContainer bottom, final IIconContainer top, final IIconContainer sides, final short[] rgba) { - return builder().addIcon(bottom, top, sides, sides, sides, sides).setRGBA(rgba).setAllowAlpha(true).build(); + return builder().addIcon(bottom, top, sides, sides, sides, sides) + .setRGBA(rgba) + .setAllowAlpha(true) + .build(); } /** @@ -91,15 +98,21 @@ public final class TextureFactory { * @return The instance of an {@link ITexture} implementation */ public static ITexture of(final IIconContainer iconContainer, final short[] rgba, final boolean allowAlpha) { - return builder().addIcon(iconContainer).setRGBA(rgba).setAllowAlpha(allowAlpha).build(); + return builder().addIcon(iconContainer) + .setRGBA(rgba) + .setAllowAlpha(allowAlpha) + .build(); } public static ITexture of(final IIconContainer iconContainer, final short[] rgba) { - return builder().addIcon(iconContainer).setRGBA(rgba).build(); + return builder().addIcon(iconContainer) + .setRGBA(rgba) + .build(); } public static ITexture of(final IIconContainer iconContainer) { - return builder().addIcon(iconContainer).build(); + return builder().addIcon(iconContainer) + .build(); } /** @@ -112,15 +125,21 @@ public final class TextureFactory { * @return The instance of an {@link ITexture} implementation */ public static ITexture of(final Block block, final int meta, final ForgeDirection side, final short[] rgba) { - return builder().setFromBlock(block, meta).setFromSide(side).setRGBA(rgba).build(); + return builder().setFromBlock(block, meta) + .setFromSide(side) + .setRGBA(rgba) + .build(); } public static ITexture of(final Block block, final int meta, final ForgeDirection side) { - return builder().setFromBlock(block, meta).setFromSide(side).build(); + return builder().setFromBlock(block, meta) + .setFromSide(side) + .build(); } public static ITexture of(final Block block, final int meta) { - return builder().setFromBlock(block, meta).build(); + return builder().setFromBlock(block, meta) + .build(); } public static ITexture of(final Block block) { diff --git a/src/main/java/gregtech/api/threads/GT_Runnable_Cable_Update.java b/src/main/java/gregtech/api/threads/GT_Runnable_Cable_Update.java index ee555c2492..e4febba51f 100644 --- a/src/main/java/gregtech/api/threads/GT_Runnable_Cable_Update.java +++ b/src/main/java/gregtech/api/threads/GT_Runnable_Cable_Update.java @@ -55,8 +55,8 @@ public class GT_Runnable_Cable_Update extends GT_Runnable_MachineBlockUpdate { && ((BaseMetaPipeEntity) tTileEntity).getMetaTileEntity() instanceof GT_MetaPipeEntity_Cable) { ChunkCoordinates tCoords; for (byte tSide : ALL_VALID_SIDES) { - if (((GT_MetaPipeEntity_Cable) ((BaseMetaPipeEntity) tTileEntity).getMetaTileEntity()) - .isConnectedAtSide(tSide)) { + if (((GT_MetaPipeEntity_Cable) ((BaseMetaPipeEntity) tTileEntity).getMetaTileEntity()).isConnectedAtSide( + tSide)) { final ForgeDirection offset = ForgeDirection.getOrientation(tSide); if (visited.add( tCoords = new ChunkCoordinates( diff --git a/src/main/java/gregtech/api/threads/GT_Runnable_MachineBlockUpdate.java b/src/main/java/gregtech/api/threads/GT_Runnable_MachineBlockUpdate.java index 06553730da..f06c3ac06b 100644 --- a/src/main/java/gregtech/api/threads/GT_Runnable_MachineBlockUpdate.java +++ b/src/main/java/gregtech/api/threads/GT_Runnable_MachineBlockUpdate.java @@ -76,8 +76,13 @@ public class GT_Runnable_MachineBlockUpdate implements Runnable { } public static void initExecutorService() { - EXECUTOR_SERVICE = Executors - .newFixedThreadPool(Math.max(1, (Runtime.getRuntime().availableProcessors() * 2 / 3)), THREAD_FACTORY); + EXECUTOR_SERVICE = Executors.newFixedThreadPool( + Math.max( + 1, + (Runtime.getRuntime() + .availableProcessors() * 2 + / 3)), + THREAD_FACTORY); } public static void shutdownExecutorService() { @@ -98,7 +103,8 @@ public class GT_Runnable_MachineBlockUpdate implements Runnable { // (Re-)Cancel if current thread also interrupted EXECUTOR_SERVICE.shutdownNow(); // Preserve interrupt status - Thread.currentThread().interrupt(); + Thread.currentThread() + .interrupt(); } catch (Exception e) { GT_Mod.GT_FML_LOGGER.error("Well this didn't terminated well...", e); // (Re-)Cancel in case 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( diff --git a/src/main/java/gregtech/api/world/GT_Worldgen.java b/src/main/java/gregtech/api/world/GT_Worldgen.java index 3d2fe466c2..742651b02a 100644 --- a/src/main/java/gregtech/api/world/GT_Worldgen.java +++ b/src/main/java/gregtech/api/world/GT_Worldgen.java @@ -65,18 +65,25 @@ public abstract class GT_Worldgen { */ public boolean isGenerationAllowed(World aWorld, int aDimensionType, int aAllowedDimensionType) { - if (!((aWorld.provider.getDimensionName().equalsIgnoreCase("Overworld")) - || (aWorld.provider.getDimensionName().equalsIgnoreCase("Nether")) - || (aWorld.provider.getDimensionName().equalsIgnoreCase("The End")) - || (aWorld.provider.getDimensionName().equalsIgnoreCase("Twilight Forest")) - || (aWorld.provider.getDimensionName().equalsIgnoreCase("Underdark")))) + if (!((aWorld.provider.getDimensionName() + .equalsIgnoreCase("Overworld")) + || (aWorld.provider.getDimensionName() + .equalsIgnoreCase("Nether")) + || (aWorld.provider.getDimensionName() + .equalsIgnoreCase("The End")) + || (aWorld.provider.getDimensionName() + .equalsIgnoreCase("Twilight Forest")) + || (aWorld.provider.getDimensionName() + .equalsIgnoreCase("Underdark")))) return false; String aDimName = aWorld.provider.getDimensionName(); Boolean tAllowed = mDimensionMap.get(aDimName); if (tAllowed == null) { - boolean tValue = GregTech_API.sWorldgenFile - .get("worldgen." + mWorldGenName, aDimName, aDimensionType == aAllowedDimensionType); + boolean tValue = GregTech_API.sWorldgenFile.get( + "worldgen." + mWorldGenName, + aDimName, + aDimensionType == aAllowedDimensionType); mDimensionMap.put(aDimName, tValue); return tValue; } diff --git a/src/main/java/gregtech/api/world/GT_Worldgen_Ore_SingleBlock.java b/src/main/java/gregtech/api/world/GT_Worldgen_Ore_SingleBlock.java index 5916d04a49..79b9e1711f 100644 --- a/src/main/java/gregtech/api/world/GT_Worldgen_Ore_SingleBlock.java +++ b/src/main/java/gregtech/api/world/GT_Worldgen_Ore_SingleBlock.java @@ -38,7 +38,8 @@ public class GT_Worldgen_Ore_SingleBlock extends GT_Worldgen_Ore { int tX = aChunkX + aRandom.nextInt(16), tY = mMinY + aRandom.nextInt(mMaxY - mMinY), tZ = aChunkZ + aRandom.nextInt(16); Block tBlock = aWorld.getBlock(tX, tY, tZ); - if (((mAllowToGenerateinVoid && aWorld.getBlock(tX, tY, tZ).isAir(aWorld, tX, tY, tZ)) + if (((mAllowToGenerateinVoid && aWorld.getBlock(tX, tY, tZ) + .isAir(aWorld, tX, tY, tZ)) || (tBlock != null && (tBlock.isReplaceableOreGen(aWorld, tX, tY, tZ, Blocks.stone) || tBlock.isReplaceableOreGen(aWorld, tX, tY, tZ, Blocks.end_stone) || tBlock.isReplaceableOreGen(aWorld, tX, tY, tZ, Blocks.netherrack))))) { diff --git a/src/main/java/gregtech/api/world/GT_Worldgen_Ore_SingleBlock_UnderLava.java b/src/main/java/gregtech/api/world/GT_Worldgen_Ore_SingleBlock_UnderLava.java index a1bd913ace..2c35dbf27e 100644 --- a/src/main/java/gregtech/api/world/GT_Worldgen_Ore_SingleBlock_UnderLava.java +++ b/src/main/java/gregtech/api/world/GT_Worldgen_Ore_SingleBlock_UnderLava.java @@ -38,7 +38,8 @@ public class GT_Worldgen_Ore_SingleBlock_UnderLava extends GT_Worldgen_Ore { int tX = aChunkX + aRandom.nextInt(16), tY = mMinY + aRandom.nextInt(mMaxY - mMinY), tZ = aChunkZ + aRandom.nextInt(16); Block tBlock = aWorld.getBlock(tX, tY, tZ); - if (((mAllowToGenerateinVoid && aWorld.getBlock(tX, tY, tZ).isAir(aWorld, tX, tY, tZ)) + if (((mAllowToGenerateinVoid && aWorld.getBlock(tX, tY, tZ) + .isAir(aWorld, tX, tY, tZ)) || (tBlock != null && (tBlock.isReplaceableOreGen(aWorld, tX, tY, tZ, Blocks.stone) || tBlock.isReplaceableOreGen(aWorld, tX, tY, tZ, Blocks.end_stone) || tBlock.isReplaceableOreGen(aWorld, tX, tY, tZ, Blocks.netherrack))))) { |