diff options
Diffstat (limited to 'src/main/java/gregtech/api')
295 files changed, 46640 insertions, 14414 deletions
diff --git a/src/main/java/gregtech/api/GregTech_API.java b/src/main/java/gregtech/api/GregTech_API.java index 2400f1eef9..56e80d4971 100644 --- a/src/main/java/gregtech/api/GregTech_API.java +++ b/src/main/java/gregtech/api/GregTech_API.java @@ -1,5 +1,10 @@ package gregtech.api; +import static gregtech.api.enums.GT_Values.B; +import static gregtech.api.enums.GT_Values.L; +import static gregtech.api.enums.GT_Values.M; +import static gregtech.api.enums.GT_Values.MOD_ID_IC2; + import com.google.common.collect.Multimap; import com.google.common.collect.Multimaps; import cpw.mods.fml.common.registry.GameRegistry; @@ -37,16 +42,6 @@ import gregtech.api.util.GT_OreDictUnificator; import gregtech.api.util.GT_Utility; import gregtech.api.world.GT_Worldgen; import gregtech.common.items.GT_IntegratedCircuit_Item; -import net.minecraft.block.Block; -import net.minecraft.client.renderer.texture.IIconRegister; -import net.minecraft.creativetab.CreativeTabs; -import net.minecraft.entity.player.EntityPlayerMP; -import net.minecraft.item.Item; -import net.minecraft.item.ItemStack; -import net.minecraft.util.ChunkCoordinates; -import net.minecraft.world.World; -import net.minecraftforge.fluids.Fluid; - import java.util.ArrayList; import java.util.Collection; import java.util.Collections; @@ -62,11 +57,15 @@ import java.util.concurrent.ConcurrentHashMap; import java.util.function.BiFunction; import java.util.function.Predicate; import java.util.stream.Collectors; - -import static gregtech.api.enums.GT_Values.B; -import static gregtech.api.enums.GT_Values.L; -import static gregtech.api.enums.GT_Values.M; -import static gregtech.api.enums.GT_Values.MOD_ID_IC2; +import net.minecraft.block.Block; +import net.minecraft.client.renderer.texture.IIconRegister; +import net.minecraft.creativetab.CreativeTabs; +import net.minecraft.entity.player.EntityPlayerMP; +import net.minecraft.item.Item; +import net.minecraft.item.ItemStack; +import net.minecraft.util.ChunkCoordinates; +import net.minecraft.world.World; +import net.minecraftforge.fluids.Fluid; /** * Please do not include this File in your Mod-download as it ruins compatibility, like with the IC2-API @@ -84,7 +83,6 @@ import static gregtech.api.enums.GT_Values.MOD_ID_IC2; * * @author Gregorius Techneticies */ - @SuppressWarnings("unused") // API class has legitimately unused methods and members public class GregTech_API { @@ -102,6 +100,7 @@ public class GregTech_API { * Fixes the HashMap Mappings for ItemStacks once the Server started */ public static final Collection<Map<GT_ItemStack, ?>> sItemStackMappings = new ArrayList<>(); + public static final Collection<Map<Fluid, ?>> sFluidMappings = new ArrayList<>(); /** * The MetaTileEntity-ID-List-Length @@ -110,8 +109,7 @@ public class GregTech_API { /** * My Creative Tab */ - public static final CreativeTabs - TAB_GREGTECH = new GT_CreativeTab("Main", "Main"), + public static final CreativeTabs TAB_GREGTECH = new GT_CreativeTab("Main", "Main"), TAB_GREGTECH_MATERIALS = new GT_CreativeTab("Materials", "Materials"), TAB_GREGTECH_ORES = new GT_CreativeTab("Ores", "Ores"); /** @@ -189,8 +187,7 @@ public class GregTech_API { /** * The List of Tools, which can be used. Accepts regular damageable Items and Electric Items */ - public static final GT_HashSet<GT_ItemStack> - sToolList = new GT_HashSet<>(), + public static final GT_HashSet<GT_ItemStack> sToolList = new GT_HashSet<>(), sCrowbarList = new GT_HashSet<>(), sScrewdriverList = new GT_HashSet<>(), sWrenchList = new GT_HashSet<>(), @@ -202,17 +199,20 @@ public class GregTech_API { /** * The List of Hazmat Armors */ - public static final GT_HashSet<GT_ItemStack> - sGasHazmatList = new GT_HashSet<>(), + public static final GT_HashSet<GT_ItemStack> sGasHazmatList = new GT_HashSet<>(), sBioHazmatList = new GT_HashSet<>(), sFrostHazmatList = new GT_HashSet<>(), 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 HashMap<>(); - 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); + 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); /** * The List of Dimensions, which are Whitelisted for the Teleporter. This list should not contain other Planets. @@ -231,9 +231,7 @@ public class GregTech_API { /** * This is the generic Cover behavior. Used for the default Covers, which have no Behavior. */ - public static final GT_CoverBehavior - sDefaultBehavior = new GT_Cover_Default(), - sNoBehavior = new GT_Cover_None(); + public static final GT_CoverBehavior sDefaultBehavior = new GT_Cover_Default(), sNoBehavior = new GT_Cover_None(); /** * For the API Version check */ @@ -252,8 +250,7 @@ public class GregTech_API { /** * These Lists are getting executed at their respective timings. Useful if you have to do things right before/after I do them, without having to control the load order. Add your "Commands" in the Constructor or in a static Code Block of your Mods Main Class. These are not Threaded, I just use a native Java Interface for their execution. Implement just the Method run() and everything should work */ - public static List<Runnable> - sBeforeGTPreload = new ArrayList<>(), + public static List<Runnable> sBeforeGTPreload = new ArrayList<>(), sAfterGTPreload = new ArrayList<>(), sBeforeGTLoad = new ArrayList<>(), sAfterGTLoad = new ArrayList<>(), @@ -270,14 +267,11 @@ public class GregTech_API { * The Icon Registers from Blocks and Items. They will get set right before the corresponding Icon Load Phase as executed in the Runnable List above. */ @SideOnly(Side.CLIENT) - public static IIconRegister - sBlockIcons, - sItemIcons; + public static IIconRegister sBlockIcons, sItemIcons; /** * The Configuration Objects */ - public static GT_Config - sRecipeFile = null, + public static GT_Config sRecipeFile = null, sMachineFile = null, sWorldgenFile = null, sMaterialProperties = null, @@ -286,20 +280,18 @@ public class GregTech_API { sSpecialFile = null, sClientDataFile, sOPStuff = null; - public static int - TICKS_FOR_LAG_AVERAGING = 25, - MILLISECOND_THRESHOLD_UNTIL_LAG_WARNING = 100; + + public static int TICKS_FOR_LAG_AVERAGING = 25, MILLISECOND_THRESHOLD_UNTIL_LAG_WARNING = 100; /** * Initialized by the Block creation. */ public static Block sBlockMachines; - public static Block - sBlockOres1, + public static Block sBlockOres1, sBlockOresUb1, sBlockOresUb2, sBlockOresUb3, - /*sBlockGem,*/ + /*sBlockGem,*/ sBlockMetal1, sBlockMetal2, sBlockMetal3, @@ -313,25 +305,19 @@ public class GregTech_API { sBlockGem2, sBlockGem3, sBlockReinforced; - public static Block - sBlockGranites, - sBlockConcretes, - sBlockStones; - public static Block - sBlockCasings1, + public static Block sBlockGranites, sBlockConcretes, sBlockStones; + public static Block sBlockCasings1, sBlockCasings2, sBlockCasings3, sBlockCasings4, sBlockCasings5, sBlockCasings6, sBlockCasings8; - public static Block - sBlockLongDistancePipes; + public static Block sBlockLongDistancePipes; /** * Getting assigned by the Config */ - public static boolean - sTimber = true, + public static boolean sTimber = true, sDrinksAlwaysDrinkable = false, sMultiThreadedSounds = false, sDoShowAllItemsInCreative = false, @@ -358,31 +344,28 @@ public class GregTech_API { mTConstruct = false, mGalacticraft = false, mAE2 = false; - public static int - mEUtoRF = 360, - mRFtoEU = 20; + public static int mEUtoRF = 360, mRFtoEU = 20; /** * Option to not use MACHINE_METAL mixing into colors */ public static boolean sUseMachineMetal = false; - public static boolean mUseOnlyGoodSolderingMaterials = false; private static final String aTextIC2Lower = MOD_ID_IC2.toLowerCase(Locale.ENGLISH); /** * Getting assigned by the Mod loading */ - public static boolean - sUnificationEntriesRegistered = false, + public static boolean sUnificationEntriesRegistered = false, sPreloadStarted = false, sPreloadFinished = false, sLoadStarted = false, sLoadFinished = false, sPostloadStarted = false, sPostloadFinished = false; + private static Class<BaseMetaTileEntity> sBaseMetaTileEntityClass = null; static { @@ -408,7 +391,8 @@ public class GregTech_API { */ public static ItemStack getUnificatedOreDictStack(ItemStack aOreStack) { if (!GregTech_API.sPreloadFinished) - GT_Log.err.println("GregTech_API ERROR: " + aOreStack.getItem() + "." + aOreStack.getItemDamage() + " - OreDict Unification Entries are not registered now, please call it in the postload phase."); + GT_Log.err.println("GregTech_API ERROR: " + aOreStack.getItem() + "." + aOreStack.getItemDamage() + + " - OreDict Unification Entries are not registered now, please call it in the postload phase."); return GT_OreDictUnificator.get(true, aOreStack); } @@ -449,8 +433,7 @@ public class GregTech_API { */ @SuppressWarnings("UnusedReturnValue") // Retains API method signature public static boolean registerMachineBlock(Block aBlock, int aMeta) { - if (aBlock == null) - return false; + if (aBlock == null) return false; if (GregTech_API.sThaumcraftCompat != null) GregTech_API.sThaumcraftCompat.registerPortholeBlacklistedBlock(aBlock); sMachineIDs.put(aBlock, aMeta); @@ -461,8 +444,7 @@ public class GregTech_API { * Like above but with boolean Parameters instead of a BitMask */ public static boolean registerMachineBlock(Block aBlock, boolean... aMeta) { - if (aBlock == null || aMeta == null || aMeta.length == 0) - return false; + if (aBlock == null || aMeta == null || aMeta.length == 0) return false; if (GregTech_API.sThaumcraftCompat != null) GregTech_API.sThaumcraftCompat.registerPortholeBlacklistedBlock(aBlock); int rMeta = 0; @@ -488,132 +470,279 @@ public class GregTech_API { public static Item constructCoolantCellItem(String aUnlocalized, String aEnglish, int aMaxStore) { try { return new GT_CoolantCellIC_Item(aUnlocalized, aEnglish, aMaxStore); -// return (Item)Class.forName("gregtech.api.items.GT_CoolantCellIC_Item").getConstructors()[0].newInstance(aUnlocalized, aEnglish, aMaxStore); - } catch (Throwable e) {/*Do nothing*/} + // return + // (Item)Class.forName("gregtech.api.items.GT_CoolantCellIC_Item").getConstructors()[0].newInstance(aUnlocalized, aEnglish, aMaxStore); + } catch (Throwable e) { + /*Do nothing*/ + } try { return new GT_CoolantCell_Item(aUnlocalized, aEnglish, aMaxStore); -// return (Item)Class.forName("gregtech.api.items.GT_CoolantCell_Item").getConstructors()[0].newInstance(aUnlocalized, aEnglish, aMaxStore); - } catch (Throwable e) {/*Do nothing*/} - return new gregtech.api.items.GT_Generic_Item(aUnlocalized, aEnglish, "Doesn't work as intended, this is a Bug", false); + // return + // (Item)Class.forName("gregtech.api.items.GT_CoolantCell_Item").getConstructors()[0].newInstance(aUnlocalized, aEnglish, aMaxStore); + } catch (Throwable e) { + /*Do nothing*/ + } + return new gregtech.api.items.GT_Generic_Item( + aUnlocalized, aEnglish, "Doesn't work as intended, this is a Bug", false); } /** * Creates a new Energy Armor Item */ - public static Item constructElectricArmorItem(String aUnlocalized, String aEnglish, int aCharge, int aTransfer, int aTier, int aDamageEnergyCost, int aSpecials, double aArmorAbsorbtionPercentage, boolean aChargeProvider, int aType, int aArmorIndex) { + public static Item constructElectricArmorItem( + String aUnlocalized, + String aEnglish, + int aCharge, + int aTransfer, + 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); - } catch (Throwable e) {/*Do nothing*/} + 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); - } catch (Throwable e) {/*Do nothing*/} - return new gregtech.api.items.GT_Generic_Item(aUnlocalized, aEnglish, "Doesn't work as intended, this is a Bug", false); + 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*/ + } + return new gregtech.api.items.GT_Generic_Item( + aUnlocalized, aEnglish, "Doesn't work as intended, this is a Bug", false); } /** * Creates a new Energy Battery Item */ - public static Item constructElectricEnergyStorageItem(String aUnlocalized, String aEnglish, int aCharge, int aTransfer, int aTier, int aEmptyID, int aFullID) { + 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); - } catch (Throwable e) {/*Do nothing*/} + 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); - } catch (Throwable e) {/*Do nothing*/} - return new gregtech.api.items.GT_Generic_Item(aUnlocalized, aEnglish, "Doesn't work as intended, this is a Bug", false); + 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*/ + } + return new gregtech.api.items.GT_Generic_Item( + aUnlocalized, aEnglish, "Doesn't work as intended, this is a Bug", false); } /** * Creates a new Hard Hammer Item */ - public static GT_Tool_Item constructHardHammerItem(String aUnlocalized, String aEnglish, int aMaxDamage, int aEntityDamage) { + 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); - } catch (Throwable e) {/*Do nothing*/} - return new gregtech.api.items.GT_Tool_Item(aUnlocalized, aEnglish, "Doesn't work as intended, this is a Bug", aMaxDamage, aEntityDamage, false); + return (GT_Tool_Item) Class.forName("gregtechmod.api.items.GT_HardHammer_Item") + .getConstructors()[0] + .newInstance(aUnlocalized, aEnglish, aMaxDamage, aEntityDamage); + } catch (Throwable e) { + /*Do nothing*/ + } + return new gregtech.api.items.GT_Tool_Item( + aUnlocalized, aEnglish, "Doesn't work as intended, this is a Bug", aMaxDamage, aEntityDamage, false); } /** * Creates a new Crowbar Item */ - public static GT_Tool_Item constructCrowbarItem(String aUnlocalized, String aEnglish, int aMaxDamage, int aEntityDamage) { + 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); - } catch (Throwable e) {/*Do nothing*/} + 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); - } catch (Throwable e) {/*Do nothing*/} - return new gregtech.api.items.GT_Tool_Item(aUnlocalized, aEnglish, "Doesn't work as intended, this is a Bug", aMaxDamage, aEntityDamage, false); + return (GT_Tool_Item) Class.forName("gregtechmod.api.items.GT_Crowbar_Item") + .getConstructors()[0] + .newInstance(aUnlocalized, aEnglish, aMaxDamage, aEntityDamage); + } catch (Throwable e) { + /*Do nothing*/ + } + return new gregtech.api.items.GT_Tool_Item( + aUnlocalized, aEnglish, "Doesn't work as intended, this is a Bug", aMaxDamage, aEntityDamage, false); } /** * Creates a new Wrench Item */ - public static GT_Tool_Item constructWrenchItem(String aUnlocalized, String aEnglish, int aMaxDamage, int aEntityDamage, int aDisChargedGTID) { + 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); - } catch (Throwable e) {/*Do nothing*/} - return new gregtech.api.items.GT_Tool_Item(aUnlocalized, aEnglish, "Doesn't work as intended, this is a Bug", aMaxDamage, aEntityDamage, false); + 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*/ + } + return new gregtech.api.items.GT_Tool_Item( + aUnlocalized, aEnglish, "Doesn't work as intended, this is a Bug", aMaxDamage, aEntityDamage, false); } /** * Creates a new electric Screwdriver Item */ - public static GT_Tool_Item constructElectricScrewdriverItem(String aUnlocalized, String aEnglish, int aMaxDamage, int aEntityDamage, int aDisChargedGTID) { + 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); - } catch (Throwable e) {/*Do nothing*/} - return new gregtech.api.items.GT_Tool_Item(aUnlocalized, aEnglish, "Doesn't work as intended, this is a Bug", aMaxDamage, aEntityDamage, false); + 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*/ + } + return new gregtech.api.items.GT_Tool_Item( + aUnlocalized, aEnglish, "Doesn't work as intended, this is a Bug", aMaxDamage, aEntityDamage, false); } /** * Creates a new electric Wrench Item */ - public static GT_Tool_Item constructElectricWrenchItem(String aUnlocalized, String aEnglish, int aMaxDamage, int aEntityDamage, int aDisChargedGTID) { + 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); - } catch (Throwable e) {/*Do nothing*/} - return new gregtech.api.items.GT_Tool_Item(aUnlocalized, aEnglish, "Doesn't work as intended, this is a Bug", aMaxDamage, aEntityDamage, false); + 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*/ + } + return new gregtech.api.items.GT_Tool_Item( + aUnlocalized, aEnglish, "Doesn't work as intended, this is a Bug", aMaxDamage, aEntityDamage, false); } /** * Creates a new electric Saw Item */ - public static GT_Tool_Item constructElectricSawItem(String aUnlocalized, String aEnglish, int aMaxDamage, int aEntityDamage, int aToolQuality, float aToolStrength, int aEnergyConsumptionPerBlockBreak, int aDisChargedGTID) { + public static GT_Tool_Item constructElectricSawItem( + String aUnlocalized, + String aEnglish, + int aMaxDamage, + 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); - } catch (Throwable e) {/*Do nothing*/} - return new gregtech.api.items.GT_Tool_Item(aUnlocalized, aEnglish, "Doesn't work as intended, this is a Bug", aMaxDamage, aEntityDamage, false); + 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*/ + } + return new gregtech.api.items.GT_Tool_Item( + aUnlocalized, aEnglish, "Doesn't work as intended, this is a Bug", aMaxDamage, aEntityDamage, false); } /** * Creates a new electric Drill Item */ - public static GT_Tool_Item constructElectricDrillItem(String aUnlocalized, String aEnglish, int aMaxDamage, int aEntityDamage, int aToolQuality, float aToolStrength, int aEnergyConsumptionPerBlockBreak, int aDisChargedGTID) { + public static GT_Tool_Item constructElectricDrillItem( + String aUnlocalized, + String aEnglish, + int aMaxDamage, + 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); - } catch (Throwable e) {/*Do nothing*/} - return new gregtech.api.items.GT_Tool_Item(aUnlocalized, aEnglish, "Doesn't work as intended, this is a Bug", aMaxDamage, aEntityDamage, false); + 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*/ + } + return new gregtech.api.items.GT_Tool_Item( + aUnlocalized, aEnglish, "Doesn't work as intended, this is a Bug", aMaxDamage, aEntityDamage, false); } /** * Creates a new electric Soldering Tool */ - public static GT_Tool_Item constructElectricSolderingToolItem(String aUnlocalized, String aEnglish, int aMaxDamage, int aEntityDamage, int aDisChargedGTID) { + 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); - } catch (Throwable e) {/*Do nothing*/} - return new gregtech.api.items.GT_Tool_Item(aUnlocalized, aEnglish, "Doesn't work as intended, this is a Bug", aMaxDamage, aEntityDamage, false); + 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*/ + } + return new gregtech.api.items.GT_Tool_Item( + aUnlocalized, aEnglish, "Doesn't work as intended, this is a Bug", aMaxDamage, aEntityDamage, false); } /** * Creates a new empty electric Tool */ - public static GT_Tool_Item constructEmptyElectricToolItem(String aUnlocalized, String aEnglish, int aMaxDamage, int aChargedGTID) { + 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); - } catch (Throwable e) {/*Do nothing*/} - return new gregtech.api.items.GT_Tool_Item(aUnlocalized, aEnglish, "Doesn't work as intended, this is a Bug", aMaxDamage, 0, false); + return (GT_Tool_Item) Class.forName("gregtechmod.api.items.GT_EmptyToolIC_Item") + .getConstructors()[0] + .newInstance(aUnlocalized, aEnglish, aMaxDamage, aChargedGTID); + } catch (Throwable e) { + /*Do nothing*/ + } + return new gregtech.api.items.GT_Tool_Item( + aUnlocalized, aEnglish, "Doesn't work as intended, this is a Bug", aMaxDamage, 0, false); } /** @@ -623,7 +752,9 @@ public class GregTech_API { if (sBaseMetaTileEntityClass == null) { try { return (sBaseMetaTileEntityClass = BaseMetaTileEntity.class).newInstance(); - } catch (Throwable e) {/*Do nothing*/} + } catch (Throwable e) { + /*Do nothing*/ + } } try { @@ -650,11 +781,9 @@ public class GregTech_API { * in LV+ single blocks, GT++ breakthrough circuit is offered in HV+ single blocks */ public static void registerConfigurationCircuit(ItemStack aStack, int minTier) { - if (GT_Utility.isStackInvalid(aStack)) - return; + if (GT_Utility.isStackInvalid(aStack)) return; for (ItemStack tRegistered : sRealConfigurationList.values()) - if (GT_Utility.areStacksEqual(tRegistered, aStack)) - return; + if (GT_Utility.areStacksEqual(tRegistered, aStack)) return; ItemStack stack = GT_Utility.copyAmount(0, aStack); sRealConfigurationList.put(minTier, stack); sConfigurationLists.entrySet().stream() @@ -671,35 +800,40 @@ public class GregTech_API { * DO NOT MODIFY THE ItemStacks! */ public static List<ItemStack> getConfigurationCircuitList(int machineTier) { - return Collections.unmodifiableList( - sConfigurationLists.computeIfAbsent(machineTier, (t) -> sRealConfigurationList.entries().stream().filter(e -> e.getKey() <= machineTier).map(Map.Entry::getValue).collect(Collectors.toList())) + return Collections.unmodifiableList(sConfigurationLists + .computeIfAbsent(machineTier, (t) -> sRealConfigurationList.entries().stream() + .filter(e -> e.getKey() <= machineTier) + .map(Map.Entry::getValue) + .collect(Collectors.toList())) .stream() .sorted(getConfigurationCircuitsComparator()) - .collect(Collectors.toList()) - ); + .collect(Collectors.toList())); } public static Comparator<ItemStack> getConfigurationCircuitsComparator() { - return Comparator - .comparingInt((ItemStack is) -> { - // By default, the Programmed Circuit should be the earliest configuration circuit to which the player is exposed - if (GT_Mod.gregtechproxy.mCircuitsOrder.isEmpty()) - return is.getItem() instanceof GT_IntegratedCircuit_Item ? 0 : 1; - return GT_Mod.gregtechproxy.mCircuitsOrder.getOrDefault(GameRegistry.findUniqueIdentifierFor(is.getItem()).toString(), Integer.MAX_VALUE); - }) - .thenComparing(ItemStack::getUnlocalizedName) - .thenComparing(ItemStack::getItemDamage); + return Comparator.comparingInt((ItemStack is) -> { + // By default, the Programmed Circuit should be the earliest configuration circuit to which the + // player is exposed + if (GT_Mod.gregtechproxy.mCircuitsOrder.isEmpty()) + return is.getItem() instanceof GT_IntegratedCircuit_Item ? 0 : 1; + return GT_Mod.gregtechproxy.mCircuitsOrder.getOrDefault( + GameRegistry.findUniqueIdentifierFor(is.getItem()).toString(), Integer.MAX_VALUE); + }) + .thenComparing(ItemStack::getUnlocalizedName) + .thenComparing(ItemStack::getItemDamage); } public static void registerCircuitProgrammer(ItemStack stack, boolean ignoreNBT, boolean useContainer) { - registerCircuitProgrammer(rhs -> GT_Utility.areStacksEqual(stack, rhs, ignoreNBT), useContainer); + registerCircuitProgrammer(rhs -> GT_Utility.areStacksEqual(stack, rhs, ignoreNBT), useContainer); } 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, BiFunction<ItemStack, EntityPlayerMP, ItemStack> doDamage) { + public static void registerCircuitProgrammer( + Predicate<ItemStack> predicate, BiFunction<ItemStack, EntityPlayerMP, ItemStack> doDamage) { sRealCircuitProgrammerList.put(predicate, doDamage); } @@ -709,9 +843,10 @@ public class GregTech_API { public static void registerCover(ItemStack aStack, ITexture aCover, GT_CoverBehaviorBase<?> aBehavior) { if (!sCovers.containsKey(new GT_ItemStack(aStack))) - sCovers.put(new GT_ItemStack(aStack), aCover == null || !aCover.isValidTexture() ? Textures.BlockIcons.ERROR_RENDERING[0] : aCover); - if (aBehavior != null) - sCoverBehaviors.put(new GT_ItemStack(aStack), aBehavior); + sCovers.put( + new GT_ItemStack(aStack), + aCover == null || !aCover.isValidTexture() ? Textures.BlockIcons.ERROR_RENDERING[0] : aCover); + if (aBehavior != null) sCoverBehaviors.put(new GT_ItemStack(aStack), aBehavior); } public static void registerCoverBehavior(ItemStack aStack, GT_CoverBehavior aBehavior) { @@ -728,7 +863,7 @@ public class GregTech_API { * @param aBehavior can be null */ public static void registerCover(Collection<ItemStack> aStackList, ITexture aCover, GT_CoverBehavior aBehavior) { - registerCover(aStackList, aCover, (GT_CoverBehaviorBase<?>)aBehavior); + registerCover(aStackList, aCover, (GT_CoverBehaviorBase<?>) aBehavior); } /** @@ -736,7 +871,8 @@ public class GregTech_API { * * @param aBehavior can be null */ - public static void registerCover(Collection<ItemStack> aStackList, ITexture aCover, GT_CoverBehaviorBase<?> aBehavior) { + public static void registerCover( + Collection<ItemStack> aStackList, ITexture aCover, GT_CoverBehaviorBase<?> aBehavior) { if (aCover.isValidTexture()) aStackList.forEach(tStack -> GregTech_API.registerCover(tStack, aCover, aBehavior)); } @@ -746,11 +882,9 @@ public class GregTech_API { */ @Deprecated public static GT_CoverBehavior getCoverBehavior(ItemStack aStack) { - if (aStack == null || aStack.getItem() == null) - return sNoBehavior; + if (aStack == null || aStack.getItem() == null) return sNoBehavior; GT_CoverBehaviorBase<?> rCover = sCoverBehaviors.get(new GT_ItemStack(aStack)); - if (!(rCover instanceof GT_CoverBehavior)) - return sDefaultBehavior; + if (!(rCover instanceof GT_CoverBehavior)) return sDefaultBehavior; return (GT_CoverBehavior) rCover; } @@ -759,8 +893,7 @@ public class GregTech_API { * @return The Cover behavior */ public static GT_CoverBehaviorBase<?> getCoverBehaviorNew(ItemStack aStack) { - if (aStack == null || aStack.getItem() == null) - return sNoBehavior; + if (aStack == null || aStack.getItem() == null) return sNoBehavior; GT_CoverBehaviorBase<?> rCover = sCoverBehaviors.get(new GT_ItemStack(aStack)); if (rCover != null) return rCover; rCover = sCoverBehaviors.get(new GT_ItemStack(aStack, true)); @@ -773,8 +906,7 @@ public class GregTech_API { */ @Deprecated public static GT_CoverBehavior getCoverBehavior(int aStack) { - if (aStack == 0) - return sNoBehavior; + if (aStack == 0) return sNoBehavior; return getCoverBehavior(GT_Utility.intToStack(aStack)); } @@ -782,8 +914,7 @@ public class GregTech_API { * returns a Cover behavior, guaranteed to not return null */ public static GT_CoverBehaviorBase<?> getCoverBehaviorNew(int aStack) { - if (aStack == 0) - return sNoBehavior; + if (aStack == 0) return sNoBehavior; return getCoverBehaviorNew(GT_Utility.intToStack(aStack)); } @@ -881,8 +1012,11 @@ public class GregTech_API { * Contains all sanity Checks for Tools, like preventing one Tool from being registered for multiple purposes as controls would override each other. */ 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() instanceof IDamagableItem))) - return false; + if (aTool == null + || GT_Utility.isStackInList(aTool, sToolList) + || (!aTool.getItem().isDamageable() + && !GT_ModHandler.isElectricItem(aTool) + && !(aTool.getItem() instanceof IDamagableItem))) return false; aToolList.add(new GT_ItemStack(GT_Utility.copyAmount(1, aTool))); sToolList.add(new GT_ItemStack(GT_Utility.copyAmount(1, aTool))); return true; diff --git a/src/main/java/gregtech/api/damagesources/GT_DamageSources.java b/src/main/java/gregtech/api/damagesources/GT_DamageSources.java index 45f3fd5323..a012f030c5 100644 --- a/src/main/java/gregtech/api/damagesources/GT_DamageSources.java +++ b/src/main/java/gregtech/api/damagesources/GT_DamageSources.java @@ -1,11 +1,10 @@ package gregtech.api.damagesources; +import javax.annotation.Nullable; import net.minecraft.entity.EntityLivingBase; import net.minecraft.item.ItemStack; import net.minecraft.util.*; -import javax.annotation.Nullable; - public class GT_DamageSources { public static DamageSource getElectricDamage() { return ic2.api.info.Info.DMG_ELECTRIC; @@ -57,7 +56,8 @@ public class GT_DamageSources { @Override public IChatComponent func_151519_b(EntityLivingBase aTarget) { - return new ChatComponentText(EnumChatFormatting.RED + aTarget.getCommandSenderName() + EnumChatFormatting.WHITE + " got frozen"); + return new ChatComponentText( + EnumChatFormatting.RED + aTarget.getCommandSenderName() + EnumChatFormatting.WHITE + " got frozen"); } } @@ -69,7 +69,8 @@ public class GT_DamageSources { @Override public IChatComponent func_151519_b(EntityLivingBase aTarget) { - return new ChatComponentText(EnumChatFormatting.RED + aTarget.getCommandSenderName() + EnumChatFormatting.WHITE + " was boiled alive"); + return new ChatComponentText(EnumChatFormatting.RED + aTarget.getCommandSenderName() + + EnumChatFormatting.WHITE + " was boiled alive"); } } @@ -97,7 +98,8 @@ public class GT_DamageSources { @Override public IChatComponent func_151519_b(EntityLivingBase aTarget) { - return new ChatComponentText(EnumChatFormatting.RED + aTarget.getCommandSenderName() + EnumChatFormatting.WHITE + " exploded"); + return new ChatComponentText( + EnumChatFormatting.RED + aTarget.getCommandSenderName() + EnumChatFormatting.WHITE + " exploded"); } } } diff --git a/src/main/java/gregtech/api/enchants/Enchantment_EnderDamage.java b/src/main/java/gregtech/api/enchants/Enchantment_EnderDamage.java index 9a9521d130..a31b802219 100644 --- a/src/main/java/gregtech/api/enchants/Enchantment_EnderDamage.java +++ b/src/main/java/gregtech/api/enchants/Enchantment_EnderDamage.java @@ -43,11 +43,20 @@ 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")))) { + if ((aHurtEntity instanceof EntityEnderman + || aHurtEntity instanceof EntityDragon + || (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/enums/ConfigCategories.java b/src/main/java/gregtech/api/enums/ConfigCategories.java index 513872ce38..ae4b425e5e 100644 --- a/src/main/java/gregtech/api/enums/ConfigCategories.java +++ b/src/main/java/gregtech/api/enums/ConfigCategories.java @@ -15,7 +15,8 @@ public enum ConfigCategories { heatdamage, oreprocessingoutputmultiplier, blastfurnacerequirements, - blastinductionsmelter,; + blastinductionsmelter, + ; } public enum Recipes { @@ -25,7 +26,7 @@ public enum ConfigCategories { disabledrecipes, recipereplacements, storageblockcrafting, - storageblockdecrafting, + storageblockdecrafting, crops; } @@ -61,6 +62,6 @@ public enum ConfigCategories { hammertripleplate, hammerquadrupleplate, hammerquintupleplate, - scoop; + scoop; } } diff --git a/src/main/java/gregtech/api/enums/Dyes.java b/src/main/java/gregtech/api/enums/Dyes.java index 6b1ce244c0..46207ee781 100644 --- a/src/main/java/gregtech/api/enums/Dyes.java +++ b/src/main/java/gregtech/api/enums/Dyes.java @@ -3,11 +3,10 @@ package gregtech.api.enums; import gregtech.api.interfaces.IColorModulationContainer; import gregtech.api.objects.GT_ArrayList; import gregtech.api.util.GT_Utility; +import java.util.ArrayList; import net.minecraftforge.fluids.Fluid; import net.minecraftforge.fluids.FluidStack; -import java.util.ArrayList; - public enum Dyes implements IColorModulationContainer { /** * The valid Colors, see VALUES Array below @@ -39,7 +38,24 @@ public enum Dyes implements IColorModulationContainer { CONSTRUCTION_FOAM(-1, 64, 64, 64, "Construction Foam"), MACHINE_METAL(-1, 210, 220, 255, "Machine Metal"); - public static final Dyes[] VALUES = {dyeBlack, dyeRed, dyeGreen, dyeBrown, dyeBlue, dyePurple, dyeCyan, dyeLightGray, dyeGray, dyePink, dyeLime, dyeYellow, dyeLightBlue, dyeMagenta, dyeOrange, dyeWhite}; + public static final Dyes[] VALUES = { + dyeBlack, + dyeRed, + dyeGreen, + dyeBrown, + dyeBlue, + dyePurple, + dyeCyan, + dyeLightGray, + dyeGray, + dyePink, + dyeLime, + dyeYellow, + dyeLightBlue, + dyeMagenta, + dyeOrange, + dyeWhite + }; public final byte mIndex; public final String mName; @@ -50,7 +66,7 @@ public enum Dyes implements IColorModulationContainer { Dyes(int aIndex, int aR, int aG, int aB, String aName) { mIndex = (byte) aIndex; mName = aName; - mRGBa = new short[]{(short) aR, (short) aG, (short) aB, 0}; + mRGBa = new short[] {(short) aR, (short) aG, (short) aB, 0}; mOriginalRGBa = mRGBa.clone(); } diff --git a/src/main/java/gregtech/api/enums/Element.java b/src/main/java/gregtech/api/enums/Element.java index eddb9fbce5..d60a25024f 100644 --- a/src/main/java/gregtech/api/enums/Element.java +++ b/src/main/java/gregtech/api/enums/Element.java @@ -293,7 +293,14 @@ public enum Element { * @param aDecayTo String representing the Elements it decays to. Separated by an '&' Character. * @param aName Name of the Element */ - Element(long aProtons, long aNeutrons, long aAdditionalMass, long aHalfLifeSeconds, String aDecayTo, String aName, boolean aIsIsotope) { + Element( + long aProtons, + long aNeutrons, + long aAdditionalMass, + long aHalfLifeSeconds, + String aDecayTo, + String aName, + boolean aIsIsotope) { mProtons = aProtons; mNeutrons = aNeutrons; mAdditionalMass = aAdditionalMass; diff --git a/src/main/java/gregtech/api/enums/GTNH_ExtraMaterials.java b/src/main/java/gregtech/api/enums/GTNH_ExtraMaterials.java index 517b9beac8..c0a259197e 100644 --- a/src/main/java/gregtech/api/enums/GTNH_ExtraMaterials.java +++ b/src/main/java/gregtech/api/enums/GTNH_ExtraMaterials.java @@ -1,12 +1,12 @@ package gregtech.api.enums; -import gregtech.api.interfaces.IMaterialHandler; - import static gregtech.GT_Mod.GT_FML_LOGGER; +import gregtech.api.interfaces.IMaterialHandler; + public class GTNH_ExtraMaterials implements IMaterialHandler { - public GTNH_ExtraMaterials(){ + public GTNH_ExtraMaterials() { GT_FML_LOGGER.info("Registering GTNH-Materials (post Java 64kb limit)"); Materials.add(this); } @@ -14,33 +14,605 @@ public class GTNH_ExtraMaterials implements IMaterialHandler { /** * This Class is for adding new Materials since Java has a Limiation of 64kb per Method / Class header */ + public static Materials Signalum = new Materials( + -1, + TextureSet.SET_NONE, + 1.0F, + 0, + 2, + 1 | 2, + 255, + 255, + 255, + 0, + "Signalum", + "Signalum", + 0, + 0, + -1, + 0, + false, + false, + 3, + 1, + 1, + Dyes._NULL); - public static Materials Signalum = new Materials( -1, TextureSet.SET_NONE , 1.0F, 0, 2, 1|2 , 255, 255, 255, 0, "Signalum" , "Signalum" , 0, 0, -1, 0, false, false, 3, 1, 1, Dyes._NULL ); - public static Materials Lumium = new Materials( -1, TextureSet.SET_NONE , 1.0F, 0, 2, 1|2 , 255, 255, 255, 0, "Lumium" , "Lumium" , 0, 0, -1, 0, false, false, 3, 1, 1, Dyes._NULL ); - public static Materials EnrichedCopper = new Materials( -1, TextureSet.SET_NONE , 1.0F, 0, 2, 1|2 , 255, 255, 255, 0, "EnrichedCopper" , "Enriched Copper" , 0, 0, -1, 0, false, false, 3, 1, 1, Dyes._NULL ); - public static Materials DiamondCopper = new Materials( -1, TextureSet.SET_NONE , 1.0F, 0, 2, 1|2 , 255, 255, 255, 0, "DiamondCopper" , "Diamond Copper" , 0, 0, -1, 0, false, false, 3, 1, 1, Dyes._NULL ); - public static Materials TarPitch = new Materials( -1, TextureSet.SET_NONE , 1.0F, 0, 2, 1|2 , 255, 255, 255, 0, "TarPitch" , "Tar Pitch" , 0, 0, -1, 0, false, false, 3, 1, 1, Dyes._NULL ); - public static Materials LimePure = new Materials( -1, TextureSet.SET_NONE , 1.0F, 0, 0, 0 , 255, 255, 255, 0, "LimePure" , "Pure Lime" , 0, 0, -1, 0, false, false, 1, 1, 1, Dyes.dyeLime ); - public static Materials Wimalite = new Materials( -1, TextureSet.SET_NONE , 1.0F, 0, 2, 8 , 255, 255, 255, 0, "Wimalite" , "Wimalite" , 0, 0, -1, 0, false, false, 3, 1, 1, Dyes.dyeYellow ); - public static Materials Yellorite = new Materials( -1, TextureSet.SET_NONE , 1.0F, 0, 2, 8 , 255, 255, 255, 0, "Yellorite" , "Yellorite" , 0, 0, -1, 0, false, false, 3, 1, 1, Dyes.dyeYellow ); - public static Materials Quantum = new Materials( -1, TextureSet.SET_NONE , 1.0F, 0, 0, 0 , 255, 255, 255, 0, "Quantum" , "Quantum" , 0, 0, -1, 0, false, false, 1, 1, 1, Dyes.dyeWhite ); - public static Materials Turquoise = new Materials( -1, TextureSet.SET_NONE , 1.0F, 0, 1, 1 , 255, 255, 255, 0, "Turquoise" , "Turquoise" , 0, 0, -1, 0, false, false, 3, 1, 1, Dyes._NULL ); - public static Materials Tapazite = new Materials( -1, TextureSet.SET_NONE , 1.0F, 0, 1, 1 , 255, 255, 255, 0, "Tapazite" , "Tapazite" , 0, 0, -1, 0, false, false, 3, 1, 1, Dyes.dyeGreen ); - public static Materials Thyrium = new Materials( -1, TextureSet.SET_NONE , 1.0F, 0, 1, 1|2 |8 , 255, 255, 255, 0, "Thyrium" , "Thyrium" , 0, 0, -1, 0, false, false, 3, 1, 1, Dyes._NULL ); - public static Materials Tourmaline = new Materials( -1, TextureSet.SET_RUBY , 1.0F, 0, 1, 1 , 255, 255, 255, 0, "Tourmaline" , "Tourmaline" , 0, 0, -1, 0, false, false, 3, 1, 1, Dyes._NULL ); - public static Materials Spinel = new Materials( -1, TextureSet.SET_NONE , 1.0F, 0, 1, 0 , 255, 255, 255, 0, "Spinel" , "Spinel" , 0, 0, -1, 0, false, false, 3, 1, 1, Dyes._NULL ); - public static Materials Starconium = new Materials( -1, TextureSet.SET_NONE , 1.0F, 0, 1, 1|2 |8 , 255, 255, 255, 0, "Starconium" , "Starconium" , 0, 0, -1, 0, false, false, 3, 1, 1, Dyes._NULL ); - public static Materials Sugilite = new Materials( -1, TextureSet.SET_NONE , 1.0F, 0, 1, 1 , 255, 255, 255, 0, "Sugilite" , "Sugilite" , 0, 0, -1, 0, false, false, 3, 1, 1, Dyes._NULL ); - public static Materials Prismarine = new Materials( -1, TextureSet.SET_NONE , 1.0F, 0, 2, 1 |4 , 255, 255, 255, 0, "Prismarine" , "Prismarine" , 0, 0, -1, 0, false, false, 3, 1, 1, Dyes._NULL ); - public static Materials GraveyardDirt = new Materials( -1, TextureSet.SET_NONE , 1.0F, 0, 2, 1 , 255, 255, 255, 0, "GraveyardDirt" , "Graveyard Dirt" , 0, 0, -1, 0, false, false, 3, 1, 1, Dyes._NULL ); - public static Materials Tennantite = new Materials( -1, TextureSet.SET_NONE , 1.0F, 0, 2, 1 , 255, 255, 255, 0, "Tennantite" , "Tennantite" , 0, 0, -1, 0, false, false, 3, 1, 1, Dyes._NULL ); - public static Materials Fairy = new Materials( -1, TextureSet.SET_NONE , 1.0F, 0, 2, 1|2 , 255, 255, 255, 0, "Fairy" , "Fairy" , 0, 0, -1, 0, false, false, 3, 1, 1, Dyes._NULL ); - public static Materials Ludicrite = new Materials( -1, TextureSet.SET_NONE , 1.0F, 0, 2, 1|2 , 255, 255, 255, 0, "Ludicrite" , "Ludicrite" , 0, 0, -1, 0, false, false, 3, 1, 1, Dyes._NULL ); - public static Materials AquaRegia = new Materials( -1, TextureSet.SET_NONE , 1.0F, 0, 2, 0 , 255, 255, 255, 0, "AquaRegia" , "Aqua Regia" , 0, 0, -1, 0, false, false, 3, 1, 1, Dyes._NULL ); - public static Materials SolutionBlueVitriol = new Materials( -1, TextureSet.SET_NONE , 1.0F, 0, 2, 0 , 255, 255, 255, 0, "SolutionBlueVitriol" , "Blue Vitriol Solution" , 0, 0, -1, 0, false, false, 3, 1, 1, Dyes._NULL ); - public static Materials SolutionNickelSulfate = new Materials( -1, TextureSet.SET_NONE , 1.0F, 0, 2, 0 , 255, 255, 255, 0, "SolutionNickelSulfate" , "Nickel Sulfate Solution" , 0, 0, -1, 0, false, false, 3, 1, 1, Dyes._NULL ); - public static Materials Lodestone = new Materials( -1, TextureSet.SET_NONE , 1.0F, 0, 1, 1 |8 , 255, 255, 255, 0, "Lodestone" , "Lodestone" , 0, 0, -1, 0, false, false, 1, 1, 1, Dyes._NULL ); - public static Materials Luminite = new Materials( -1, TextureSet.SET_NONE , 1.0F, 0, 1, 1 |8 , 250, 250, 250, 0, "Luminite" , "Luminite" , 0, 0, -1, 0, false, false, 3, 1, 1, Dyes.dyeWhite ); + public static Materials Lumium = new Materials( + -1, + TextureSet.SET_NONE, + 1.0F, + 0, + 2, + 1 | 2, + 255, + 255, + 255, + 0, + "Lumium", + "Lumium", + 0, + 0, + -1, + 0, + false, + false, + 3, + 1, + 1, + Dyes._NULL); + public static Materials EnrichedCopper = new Materials( + -1, + TextureSet.SET_NONE, + 1.0F, + 0, + 2, + 1 | 2, + 255, + 255, + 255, + 0, + "EnrichedCopper", + "Enriched Copper", + 0, + 0, + -1, + 0, + false, + false, + 3, + 1, + 1, + Dyes._NULL); + public static Materials DiamondCopper = new Materials( + -1, + TextureSet.SET_NONE, + 1.0F, + 0, + 2, + 1 | 2, + 255, + 255, + 255, + 0, + "DiamondCopper", + "Diamond Copper", + 0, + 0, + -1, + 0, + false, + false, + 3, + 1, + 1, + Dyes._NULL); + public static Materials TarPitch = new Materials( + -1, + TextureSet.SET_NONE, + 1.0F, + 0, + 2, + 1 | 2, + 255, + 255, + 255, + 0, + "TarPitch", + "Tar Pitch", + 0, + 0, + -1, + 0, + false, + false, + 3, + 1, + 1, + Dyes._NULL); + public static Materials LimePure = new Materials( + -1, + TextureSet.SET_NONE, + 1.0F, + 0, + 0, + 0, + 255, + 255, + 255, + 0, + "LimePure", + "Pure Lime", + 0, + 0, + -1, + 0, + false, + false, + 1, + 1, + 1, + Dyes.dyeLime); + public static Materials Wimalite = new Materials( + -1, + TextureSet.SET_NONE, + 1.0F, + 0, + 2, + 8, + 255, + 255, + 255, + 0, + "Wimalite", + "Wimalite", + 0, + 0, + -1, + 0, + false, + false, + 3, + 1, + 1, + Dyes.dyeYellow); + public static Materials Yellorite = new Materials( + -1, + TextureSet.SET_NONE, + 1.0F, + 0, + 2, + 8, + 255, + 255, + 255, + 0, + "Yellorite", + "Yellorite", + 0, + 0, + -1, + 0, + false, + false, + 3, + 1, + 1, + Dyes.dyeYellow); + public static Materials Quantum = new Materials( + -1, + TextureSet.SET_NONE, + 1.0F, + 0, + 0, + 0, + 255, + 255, + 255, + 0, + "Quantum", + "Quantum", + 0, + 0, + -1, + 0, + false, + false, + 1, + 1, + 1, + Dyes.dyeWhite); + public static Materials Turquoise = new Materials( + -1, + TextureSet.SET_NONE, + 1.0F, + 0, + 1, + 1, + 255, + 255, + 255, + 0, + "Turquoise", + "Turquoise", + 0, + 0, + -1, + 0, + false, + false, + 3, + 1, + 1, + Dyes._NULL); + public static Materials Tapazite = new Materials( + -1, + TextureSet.SET_NONE, + 1.0F, + 0, + 1, + 1, + 255, + 255, + 255, + 0, + "Tapazite", + "Tapazite", + 0, + 0, + -1, + 0, + false, + false, + 3, + 1, + 1, + Dyes.dyeGreen); + public static Materials Thyrium = new Materials( + -1, + TextureSet.SET_NONE, + 1.0F, + 0, + 1, + 1 | 2 | 8, + 255, + 255, + 255, + 0, + "Thyrium", + "Thyrium", + 0, + 0, + -1, + 0, + false, + false, + 3, + 1, + 1, + Dyes._NULL); + public static Materials Tourmaline = new Materials( + -1, + TextureSet.SET_RUBY, + 1.0F, + 0, + 1, + 1, + 255, + 255, + 255, + 0, + "Tourmaline", + "Tourmaline", + 0, + 0, + -1, + 0, + false, + false, + 3, + 1, + 1, + Dyes._NULL); + public static Materials Spinel = new Materials( + -1, + TextureSet.SET_NONE, + 1.0F, + 0, + 1, + 0, + 255, + 255, + 255, + 0, + "Spinel", + "Spinel", + 0, + 0, + -1, + 0, + false, + false, + 3, + 1, + 1, + Dyes._NULL); + public static Materials Starconium = new Materials( + -1, + TextureSet.SET_NONE, + 1.0F, + 0, + 1, + 1 | 2 | 8, + 255, + 255, + 255, + 0, + "Starconium", + "Starconium", + 0, + 0, + -1, + 0, + false, + false, + 3, + 1, + 1, + Dyes._NULL); + public static Materials Sugilite = new Materials( + -1, + TextureSet.SET_NONE, + 1.0F, + 0, + 1, + 1, + 255, + 255, + 255, + 0, + "Sugilite", + "Sugilite", + 0, + 0, + -1, + 0, + false, + false, + 3, + 1, + 1, + Dyes._NULL); + public static Materials Prismarine = new Materials( + -1, + TextureSet.SET_NONE, + 1.0F, + 0, + 2, + 1 | 4, + 255, + 255, + 255, + 0, + "Prismarine", + "Prismarine", + 0, + 0, + -1, + 0, + false, + false, + 3, + 1, + 1, + Dyes._NULL); + public static Materials GraveyardDirt = new Materials( + -1, + TextureSet.SET_NONE, + 1.0F, + 0, + 2, + 1, + 255, + 255, + 255, + 0, + "GraveyardDirt", + "Graveyard Dirt", + 0, + 0, + -1, + 0, + false, + false, + 3, + 1, + 1, + Dyes._NULL); + public static Materials Tennantite = new Materials( + -1, + TextureSet.SET_NONE, + 1.0F, + 0, + 2, + 1, + 255, + 255, + 255, + 0, + "Tennantite", + "Tennantite", + 0, + 0, + -1, + 0, + false, + false, + 3, + 1, + 1, + Dyes._NULL); + public static Materials Fairy = new Materials( + -1, + TextureSet.SET_NONE, + 1.0F, + 0, + 2, + 1 | 2, + 255, + 255, + 255, + 0, + "Fairy", + "Fairy", + 0, + 0, + -1, + 0, + false, + false, + 3, + 1, + 1, + Dyes._NULL); + public static Materials Ludicrite = new Materials( + -1, + TextureSet.SET_NONE, + 1.0F, + 0, + 2, + 1 | 2, + 255, + 255, + 255, + 0, + "Ludicrite", + "Ludicrite", + 0, + 0, + -1, + 0, + false, + false, + 3, + 1, + 1, + Dyes._NULL); + public static Materials AquaRegia = new Materials( + -1, + TextureSet.SET_NONE, + 1.0F, + 0, + 2, + 0, + 255, + 255, + 255, + 0, + "AquaRegia", + "Aqua Regia", + 0, + 0, + -1, + 0, + false, + false, + 3, + 1, + 1, + Dyes._NULL); + public static Materials SolutionBlueVitriol = new Materials( + -1, + TextureSet.SET_NONE, + 1.0F, + 0, + 2, + 0, + 255, + 255, + 255, + 0, + "SolutionBlueVitriol", + "Blue Vitriol Solution", + 0, + 0, + -1, + 0, + false, + false, + 3, + 1, + 1, + Dyes._NULL); + public static Materials SolutionNickelSulfate = new Materials( + -1, + TextureSet.SET_NONE, + 1.0F, + 0, + 2, + 0, + 255, + 255, + 255, + 0, + "SolutionNickelSulfate", + "Nickel Sulfate Solution", + 0, + 0, + -1, + 0, + false, + false, + 3, + 1, + 1, + Dyes._NULL); + public static Materials Lodestone = new Materials( + -1, + TextureSet.SET_NONE, + 1.0F, + 0, + 1, + 1 | 8, + 255, + 255, + 255, + 0, + "Lodestone", + "Lodestone", + 0, + 0, + -1, + 0, + false, + false, + 1, + 1, + 1, + Dyes._NULL); + public static Materials Luminite = new Materials( + -1, + TextureSet.SET_NONE, + 1.0F, + 0, + 1, + 1 | 8, + 250, + 250, + 250, + 0, + "Luminite", + "Luminite", + 0, + 0, + -1, + 0, + false, + false, + 3, + 1, + 1, + Dyes.dyeWhite); private static void initSubTags() { SubTag.METAL.addTo(Signalum, Lumium, EnrichedCopper, DiamondCopper); @@ -53,11 +625,8 @@ public class GTNH_ExtraMaterials implements IMaterialHandler { } @Override - public void onComponentInit() { - } + public void onComponentInit() {} @Override - public void onComponentIteration(Materials aMaterial) { - - } + public void onComponentIteration(Materials aMaterial) {} } diff --git a/src/main/java/gregtech/api/enums/GT_HatchElement.java b/src/main/java/gregtech/api/enums/GT_HatchElement.java index 1bc94340bb..68702f5eb5 100644 --- a/src/main/java/gregtech/api/enums/GT_HatchElement.java +++ b/src/main/java/gregtech/api/enums/GT_HatchElement.java @@ -2,7 +2,6 @@ package gregtech.api.enums; import gregtech.api.interfaces.IHatchElement; import gregtech.api.interfaces.metatileentity.IMetaTileEntity; -import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_EnhancedMultiBlockBase; import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch_Dynamo; import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch_Energy; import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch_Input; @@ -14,7 +13,6 @@ import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch_Outpu import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_MultiBlockBase; import gregtech.api.util.GT_ExoticEnergyInputHelper; import gregtech.api.util.IGT_HatchAdder; - import java.util.Arrays; import java.util.Collections; import java.util.List; @@ -26,7 +24,8 @@ public enum GT_HatchElement implements IHatchElement<GT_MetaTileEntity_MultiBloc return t.mMufflerHatches.size(); } }, - Maintenance(GT_MetaTileEntity_MultiBlockBase::addMaintenanceToMachineList, GT_MetaTileEntity_Hatch_Maintenance.class) { + Maintenance( + GT_MetaTileEntity_MultiBlockBase::addMaintenanceToMachineList, GT_MetaTileEntity_Hatch_Maintenance.class) { @Override public long count(GT_MetaTileEntity_MultiBlockBase t) { return t.mMaintenanceHatches.size(); @@ -84,7 +83,8 @@ public enum GT_HatchElement implements IHatchElement<GT_MetaTileEntity_MultiBloc private final IGT_HatchAdder<GT_MetaTileEntity_MultiBlockBase> adder; @SafeVarargs - GT_HatchElement(IGT_HatchAdder<GT_MetaTileEntity_MultiBlockBase> adder, Class<? extends IMetaTileEntity>... mteClasses) { + GT_HatchElement( + IGT_HatchAdder<GT_MetaTileEntity_MultiBlockBase> adder, Class<? extends IMetaTileEntity>... mteClasses) { this.mteClasses = Collections.unmodifiableList(Arrays.asList(mteClasses)); this.adder = adder; } diff --git a/src/main/java/gregtech/api/enums/GT_Values.java b/src/main/java/gregtech/api/enums/GT_Values.java index 59cb64bce8..b3394ca2a1 100644 --- a/src/main/java/gregtech/api/enums/GT_Values.java +++ b/src/main/java/gregtech/api/enums/GT_Values.java @@ -5,6 +5,9 @@ import gregtech.api.interfaces.IIconContainer; import gregtech.api.interfaces.internal.IGT_Mod; import gregtech.api.interfaces.internal.IGT_RecipeAdder; import gregtech.api.net.IGT_NetworkHandler; +import java.util.HashSet; +import java.util.Locale; +import java.util.Set; import net.minecraft.item.ItemStack; import net.minecraft.util.EnumChatFormatting; import net.minecraft.world.World; @@ -13,10 +16,6 @@ import net.minecraftforge.fluids.FluidTankInfo; import net.minecraftforge.fluids.IFluidTank; import net.minecraftforge.oredict.OreDictionary; -import java.util.HashSet; -import java.util.Locale; -import java.util.Set; - /** * Made for static imports, this Class is just a Helper. * <p/> @@ -41,18 +40,19 @@ public class GT_Values { * The first 32 Bits */ @SuppressWarnings("PointlessBitwiseExpression") // Nicer source layout this way - public static final int[] B = new int[]{ - 1 << 0, 1 << 1, 1 << 2, - 1 << 3, 1 << 4, 1 << 5, - 1 << 6, 1 << 7, 1 << 8, - 1 << 9, 1 << 10, 1 << 11, - 1 << 12, 1 << 13, 1 << 14, - 1 << 15, 1 << 16, 1 << 17, - 1 << 18, 1 << 19, 1 << 20, - 1 << 21, 1 << 22, 1 << 23, - 1 << 24, 1 << 25, 1 << 26, - 1 << 27, 1 << 28, 1 << 29, - 1 << 30, 1 << 31}; + public static final int[] B = new int[] { + 1 << 0, 1 << 1, 1 << 2, + 1 << 3, 1 << 4, 1 << 5, + 1 << 6, 1 << 7, 1 << 8, + 1 << 9, 1 << 10, 1 << 11, + 1 << 12, 1 << 13, 1 << 14, + 1 << 15, 1 << 16, 1 << 17, + 1 << 18, 1 << 19, 1 << 20, + 1 << 21, 1 << 22, 1 << 23, + 1 << 24, 1 << 25, 1 << 26, + 1 << 27, 1 << 28, 1 << 29, + 1 << 30, 1 << 31 + }; /** * Renamed from "MATERIAL_UNIT" to just "M" @@ -83,103 +83,108 @@ public class GT_Values { /** * The Voltage Tiers. Use this Array instead of the old named Voltage Variables */ - public static final long[] V = - new long[]{ - 8L, 32L, 128L, - 512L, 2048L, 8192L, - 32_768L, 131_072L, 524_288L, - 2_097_152L, 8_388_608L, 33_554_432L, - 134_217_728L, 536_870_912L, Integer.MAX_VALUE - 7, - // Error tier to prevent out of bounds errors. Not really a real tier (for now). - 8_589_934_592L}; - // 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!!! - //TODO:tier 14,15 wires and transformers only (not even cables !!!) - //TODO:tier 12,13 the above + batteries, battery buffers, (maybe cables,12 also works for machines) - //TODO:tier 10,11 the above + chargers and other machines, (cables would be nice) - //TODO:tier 9 machines and batteries - - //TODO:AND ALL THE MATERIALS... for that - //TODO:LIST OF MACHINES WITH POINTLESS TIERS (unless you implement some other tiering mechanism like reducing eu cost if time=1tick) - //Macerator/Compressor/Furnace... and for cheap recipes any + public static final long[] V = new long[] { + 8L, 32L, 128L, + 512L, 2048L, 8192L, + 32_768L, 131_072L, 524_288L, + 2_097_152L, 8_388_608L, 33_554_432L, + 134_217_728L, 536_870_912L, Integer.MAX_VALUE - 7, + // Error tier to prevent out of bounds errors. Not really a real tier (for now). + 8_589_934_592L + }; + // 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!!! + // TODO:tier 14,15 wires and transformers only (not even cables !!!) + // TODO:tier 12,13 the above + batteries, battery buffers, (maybe cables,12 also works for machines) + // TODO:tier 10,11 the above + chargers and other machines, (cables would be nice) + // TODO:tier 9 machines and batteries + + // TODO:AND ALL THE MATERIALS... for that + // TODO:LIST OF MACHINES WITH POINTLESS TIERS (unless you implement some other tiering mechanism like reducing eu + // cost if time=1tick) + // Macerator/Compressor/Furnace... and for cheap recipes any /** * Array of Maximum Amperes at given Tier index * <p>keeping Voltage*Amps < Integer.MAX_VALUE-7 for machines (and tier logic 4x EUt 2/ time)</p> * <p>AMV[4]= max amps at tier 4</p> */ - public static final long[] AatV = - new long[]{ - 268435455, 67108863, 16777215, - 4194303, 1048575, 262143, - 65535, 16383, 4095, - 1023, 255, 63, - 15, 3, 1, - 1}; + public static final long[] AatV = new long[] { + 268435455, 67108863, 16777215, + 4194303, 1048575, 262143, + 65535, 16383, 4095, + 1023, 255, 63, + 15, 3, 1, + 1 + }; /** * The short Names for the Voltages */ - public static final String[] VN = - new String[]{ - "ULV", // 0 - "LV", // 1 - "MV", // 2 - "HV", // 3 - "EV", // 4 - "IV", // 5 - "LuV", // 6 - "ZPM", // 7 - "UV", // 8 - "UHV", // 9 - "UEV", // 10 - "UIV", // 11 - "UMV", // 12 - "UXV", // 13 - "MAX", // 14 - "ERROR VOLTAGE" // 15 + public static final String[] VN = new String[] { + "ULV", // 0 + "LV", // 1 + "MV", // 2 + "HV", // 3 + "EV", // 4 + "IV", // 5 + "LuV", // 6 + "ZPM", // 7 + "UV", // 8 + "UHV", // 9 + "UEV", // 10 + "UIV", // 11 + "UMV", // 12 + "UXV", // 13 + "MAX", // 14 + "ERROR VOLTAGE" // 15 }; /** * The long Names for the Voltages */ - public static final String[] VOLTAGE_NAMES = - new String[]{ - "Ultra Low Voltage", // 0 - "Low Voltage", // 1 - "Medium Voltage", // 2 - "High Voltage", // 3 - "Extreme Voltage", // 4 - "Insane Voltage", // 5 - "Ludicrous Voltage", // 6 - "ZPM Voltage", // 7 - "Ultimate Voltage", // 8 - "Ultimate High Voltage", // 9 - "Ultimate Extreme Voltage", // 10 - "Ultimate Insane Voltage", // 11 - "Ultimate Mega Voltage", // 12 - "Ultimate Extended Mega Voltage", // 13 - "Maximum Voltage", // 14 - "Error Voltage, report this" // 15 + public static final String[] VOLTAGE_NAMES = new String[] { + "Ultra Low Voltage", // 0 + "Low Voltage", // 1 + "Medium Voltage", // 2 + "High Voltage", // 3 + "Extreme Voltage", // 4 + "Insane Voltage", // 5 + "Ludicrous Voltage", // 6 + "ZPM Voltage", // 7 + "Ultimate Voltage", // 8 + "Ultimate High Voltage", // 9 + "Ultimate Extreme Voltage", // 10 + "Ultimate Insane Voltage", // 11 + "Ultimate Mega Voltage", // 12 + "Ultimate Extended Mega Voltage", // 13 + "Maximum Voltage", // 14 + "Error Voltage, report this" // 15 }; - public static final String[] TIER_COLORS = - new String[]{ - EnumChatFormatting.RED.toString(), // ULV, 0 - EnumChatFormatting.GRAY.toString(), // LV, 1 - EnumChatFormatting.GOLD.toString(), // MV, 2 - EnumChatFormatting.YELLOW.toString(), // HV, 3 - EnumChatFormatting.DARK_GRAY.toString(), // EV, 4 - EnumChatFormatting.GREEN.toString(), // IV, 5 - EnumChatFormatting.LIGHT_PURPLE.toString(), // LuV, 6 - EnumChatFormatting.AQUA.toString(), // ZPM, 7 - EnumChatFormatting.DARK_GREEN.toString(), // UV, 8 - EnumChatFormatting.DARK_RED.toString(), // UHV, 9 - EnumChatFormatting.DARK_PURPLE.toString(), // UEV, 10 - EnumChatFormatting.DARK_BLUE.toString() + EnumChatFormatting.BOLD.toString(), // UIV, 11 - EnumChatFormatting.RED.toString() + EnumChatFormatting.BOLD.toString() + EnumChatFormatting.UNDERLINE.toString(), // UMV, 12 - EnumChatFormatting.DARK_RED.toString() + EnumChatFormatting.BOLD.toString() + EnumChatFormatting.UNDERLINE.toString(), // UXV, 13 - EnumChatFormatting.WHITE.toString() + EnumChatFormatting.BOLD.toString() + EnumChatFormatting.UNDERLINE.toString(), // MAX, 14 - EnumChatFormatting.OBFUSCATED.toString() // ~~~, 15 + public static final String[] TIER_COLORS = new String[] { + EnumChatFormatting.RED.toString(), // ULV, 0 + EnumChatFormatting.GRAY.toString(), // LV, 1 + EnumChatFormatting.GOLD.toString(), // MV, 2 + EnumChatFormatting.YELLOW.toString(), // HV, 3 + EnumChatFormatting.DARK_GRAY.toString(), // EV, 4 + EnumChatFormatting.GREEN.toString(), // IV, 5 + EnumChatFormatting.LIGHT_PURPLE.toString(), // LuV, 6 + EnumChatFormatting.AQUA.toString(), // ZPM, 7 + EnumChatFormatting.DARK_GREEN.toString(), // UV, 8 + EnumChatFormatting.DARK_RED.toString(), // UHV, 9 + EnumChatFormatting.DARK_PURPLE.toString(), // UEV, 10 + EnumChatFormatting.DARK_BLUE.toString() + EnumChatFormatting.BOLD.toString(), // UIV, 11 + EnumChatFormatting.RED.toString() + + EnumChatFormatting.BOLD.toString() + + EnumChatFormatting.UNDERLINE.toString(), // UMV, 12 + EnumChatFormatting.DARK_RED.toString() + + EnumChatFormatting.BOLD.toString() + + EnumChatFormatting.UNDERLINE.toString(), // UXV, 13 + EnumChatFormatting.WHITE.toString() + + EnumChatFormatting.BOLD.toString() + + EnumChatFormatting.UNDERLINE.toString(), // MAX, 14 + EnumChatFormatting.OBFUSCATED.toString() // ~~~, 15 }; /** @@ -193,8 +198,7 @@ public class GT_Values { /** * MOD ID Strings, since they are very common Parameters. */ - public static final String - MOD_ID = "gregtech", + public static final String MOD_ID = "gregtech", MOD_ID_IC2 = "IC2", MOD_ID_NC = "IC2NuclearControl", MOD_ID_TC = "Thaumcraft", @@ -224,8 +228,7 @@ public class GT_Values { /** * File Paths and Resource Paths */ - public static final String - TEX_DIR = "textures/", + public static final String TEX_DIR = "textures/", TEX_DIR_GUI = TEX_DIR + "gui/", TEX_DIR_ITEM = TEX_DIR + "items/", TEX_DIR_BLOCK = TEX_DIR + "blocks/", @@ -244,45 +247,42 @@ public class GT_Values { * NBT String Keys */ public static class NBT { - public static final String - COLOR = "gt.color", // Integer - CUSTOM_NAME = "name", // String - DISPAY = "gt.display", // String - FACING = "gt.facing", // Byte - LOCK_UPGRADE = "gt.locked", // Boolean - MATERIAL = "gt.material", // String containing the Material Name. - MODE = "gt.mode", // Number - ALLOWED_MODES = "gt.amode", // Number - MTE_ID = "gt.mte.id", // Containing the MTE ID - MTE_REG = "gt.mte.reg", // Containing the MTE Registry ID - OWNER = "gt.owner", // String - OWNER_UUID = "gt.ownerUuid", // UUID (String) - - // Machines - ACTIVE = "gt.active", // Boolean - FLUID_OUT = "gt.fluidout", // Output Fluid - INV_OUT = "gt.invout", // ItemStack - PARALLEL = "gt.parallel", // Number - TANK_CAPACITY = "gt.tankcap", // Number - TANK_IN = "gt.tank.in.", // FluidStack - TANK_OUT = "gt.tank.out.", // FluidStack - TEXTURE = "gt.texture", // String - INV_SIZE = "gt.invsize", // Number - INV_LIST = "gt.invlist", // NBT List - - // MultiBlock - STRUCTURE_OK = "gt.structure.ok", - ROTATION = "gt.eRotation", - FLIP = "gt.eFlip", - TARGET = "gt.target", // Boolean - TARGET_X = "gt.target.x", // Number - TARGET_Y = "gt.target.y", // Number - TARGET_Z = "gt.target.z", // Number - - empty_ = ""; + public static final String COLOR = "gt.color", // Integer + CUSTOM_NAME = "name", // String + DISPAY = "gt.display", // String + FACING = "gt.facing", // Byte + LOCK_UPGRADE = "gt.locked", // Boolean + MATERIAL = "gt.material", // String containing the Material Name. + MODE = "gt.mode", // Number + ALLOWED_MODES = "gt.amode", // Number + MTE_ID = "gt.mte.id", // Containing the MTE ID + MTE_REG = "gt.mte.reg", // Containing the MTE Registry ID + OWNER = "gt.owner", // String + OWNER_UUID = "gt.ownerUuid", // UUID (String) + + // Machines + ACTIVE = "gt.active", // Boolean + FLUID_OUT = "gt.fluidout", // Output Fluid + INV_OUT = "gt.invout", // ItemStack + PARALLEL = "gt.parallel", // Number + TANK_CAPACITY = "gt.tankcap", // Number + TANK_IN = "gt.tank.in.", // FluidStack + TANK_OUT = "gt.tank.out.", // FluidStack + TEXTURE = "gt.texture", // String + INV_SIZE = "gt.invsize", // Number + INV_LIST = "gt.invlist", // NBT List + + // MultiBlock + STRUCTURE_OK = "gt.structure.ok", + ROTATION = "gt.eRotation", + FLIP = "gt.eFlip", + TARGET = "gt.target", // Boolean + TARGET_X = "gt.target.x", // Number + TARGET_Y = "gt.target.y", // Number + TARGET_Z = "gt.target.z", // Number + empty_ = ""; } - /** The Color White as RGB Short Array. */ public static final short[] UNCOLORED_RBGA = {255, 255, 255, 255}; /** The Color White as simple Integer (0x00ffffff). */ @@ -291,61 +291,58 @@ public class GT_Values { /** * Sides */ - public static final byte - SIDE_BOTTOM = 0, SIDE_DOWN = 0, - SIDE_TOP = 1, SIDE_UP = 1, - SIDE_NORTH = 2, // Also a Side with a stupidly mirrored Texture - SIDE_SOUTH = 3, - SIDE_WEST = 4, - SIDE_EAST = 5, // Also a Side with a stupidly mirrored Texture - SIDE_ANY = 6, SIDE_UNKNOWN = 6, SIDE_INVALID = 6, SIDE_INSIDE = 6, SIDE_UNDEFINED = 6; + public static final byte SIDE_BOTTOM = 0, + SIDE_DOWN = 0, + SIDE_TOP = 1, + SIDE_UP = 1, + SIDE_NORTH = 2, // Also a Side with a stupidly mirrored Texture + SIDE_SOUTH = 3, + SIDE_WEST = 4, + SIDE_EAST = 5, // Also a Side with a stupidly mirrored Texture + SIDE_ANY = 6, + SIDE_UNKNOWN = 6, + SIDE_INVALID = 6, + SIDE_INSIDE = 6, + SIDE_UNDEFINED = 6; /** Compass alike Array for the proper ordering of North, East, South and West. */ public static final byte[] COMPASS_DIRECTIONS = {SIDE_NORTH, SIDE_EAST, SIDE_SOUTH, SIDE_WEST}; - /** * An Array containing all Sides which follow the Condition, in order to iterate over them for example. */ - public static final byte[] - ALL_SIDES = {0,1,2,3,4,5,6}, - ALL_VALID_SIDES = {0,1,2,3,4,5 }; + public static final byte[] ALL_SIDES = {0, 1, 2, 3, 4, 5, 6}, ALL_VALID_SIDES = {0, 1, 2, 3, 4, 5}; /** * For Facing Checks. */ - - public static final boolean[] - INVALID_SIDES = { false, false, false, false, false, false, true }, - VALID_SIDES = { true, true, true, true, true, true, false }; - + public static final boolean[] INVALID_SIDES = {false, false, false, false, false, false, true}, + VALID_SIDES = {true, true, true, true, true, true, false}; /** * Side->Offset Mappings. */ - public static final byte[] - OFFX = { 0, 0, 0, 0,-1,+1, 0}, - OFFY = {-1,+1, 0, 0, 0, 0, 0}, - OFFZ = { 0, 0,-1,+1, 0, 0, 0}; + public static final byte[] OFFX = {0, 0, 0, 0, -1, +1, 0}, + OFFY = {-1, +1, 0, 0, 0, 0, 0}, + OFFZ = {0, 0, -1, +1, 0, 0, 0}; /** * Side->Opposite Mappings. **/ - public static final byte[] - OPOS = { 1, 0, 3, 2, 5, 4, 6}; + public static final byte[] OPOS = {1, 0, 3, 2, 5, 4, 6}; /** * [Facing,Side]->Side Mappings for Blocks, which don't face up- and downwards. * 0 = bottom, 1 = top, 2 = left, 3 = front, 4 = right, 5 = back, 6 = undefined. */ public static final byte[][] FACING_ROTATIONS = { - {0,1,2,3,4,5,6}, - {0,1,2,3,4,5,6}, - {0,1,3,5,4,2,6}, - {0,1,5,3,2,4,6}, - {0,1,2,4,3,5,6}, - {0,1,4,2,5,3,6}, - {0,1,2,3,4,5,6} + {0, 1, 2, 3, 4, 5, 6}, + {0, 1, 2, 3, 4, 5, 6}, + {0, 1, 3, 5, 4, 2, 6}, + {0, 1, 5, 3, 2, 4, 6}, + {0, 1, 2, 4, 3, 5, 6}, + {0, 1, 4, 2, 5, 3, 6}, + {0, 1, 2, 3, 4, 5, 6} }; /** @@ -464,12 +461,12 @@ public class GT_Values { * If true, then digital chest with AE2 storage bus will be accessible only through AE2 */ public static boolean disableDigitalChestsExternalAccess = false; + public static boolean lateConfigSave = true; public static boolean worldTickHappened = false; public static final int[] emptyIntArray = new int[0]; - public static final IFluidTank[] emptyFluidTank = new IFluidTank[0]; public static final FluidTankGT[] emptyFluidTankGT = new FluidTankGT[0]; public static final FluidTankInfo[] emptyFluidTankInfo = new FluidTankInfo[0]; @@ -480,11 +477,14 @@ public class GT_Values { /** * Pretty formatting for author names. */ - public static final String AuthorColen = "Author: " + - EnumChatFormatting.DARK_RED + EnumChatFormatting.BOLD + EnumChatFormatting.ITALIC + EnumChatFormatting.UNDERLINE + "C" + - EnumChatFormatting.GOLD + EnumChatFormatting.BOLD + EnumChatFormatting.ITALIC + EnumChatFormatting.UNDERLINE + "o" + - EnumChatFormatting.GREEN + EnumChatFormatting.BOLD + EnumChatFormatting.ITALIC + EnumChatFormatting.UNDERLINE + "l" + - EnumChatFormatting.DARK_AQUA + EnumChatFormatting.BOLD + EnumChatFormatting.ITALIC + EnumChatFormatting.UNDERLINE + "e" + - EnumChatFormatting.DARK_PURPLE + EnumChatFormatting.BOLD + EnumChatFormatting.ITALIC + EnumChatFormatting.UNDERLINE + "n"; - + public static final String AuthorColen = "Author: " + EnumChatFormatting.DARK_RED + + EnumChatFormatting.BOLD + EnumChatFormatting.ITALIC + EnumChatFormatting.UNDERLINE + "C" + + EnumChatFormatting.GOLD + + EnumChatFormatting.BOLD + EnumChatFormatting.ITALIC + EnumChatFormatting.UNDERLINE + "o" + + EnumChatFormatting.GREEN + + EnumChatFormatting.BOLD + EnumChatFormatting.ITALIC + EnumChatFormatting.UNDERLINE + "l" + + EnumChatFormatting.DARK_AQUA + + EnumChatFormatting.BOLD + EnumChatFormatting.ITALIC + EnumChatFormatting.UNDERLINE + "e" + + EnumChatFormatting.DARK_PURPLE + + EnumChatFormatting.BOLD + EnumChatFormatting.ITALIC + EnumChatFormatting.UNDERLINE + "n"; } diff --git a/src/main/java/gregtech/api/enums/HeatingCoilLevel.java b/src/main/java/gregtech/api/enums/HeatingCoilLevel.java index 0ee208658b..bce2925d7c 100644 --- a/src/main/java/gregtech/api/enums/HeatingCoilLevel.java +++ b/src/main/java/gregtech/api/enums/HeatingCoilLevel.java @@ -3,71 +3,69 @@ package gregtech.api.enums; import net.minecraft.util.StatCollector; public enum HeatingCoilLevel { - None, // 0 - ULV, //Not implemented 901 - LV, //Cupronickel 1801 - MV, //KANTHAL 2701 - HV, //NICHROME 3601 - EV, //TUNGSTENSTEEL 4501 - IV, //HSSG 5401 - LuV, //HSSS 6301 - ZPM, //NAQUADAH 7201 - UV, //NAQUADAHALLOY 8101 - UHV, //TRINIUM 9001 - UEV, //ELECTRUMFLUX 9901 - UIV, //AWAKENEDDRACONIUM 10801 - UMV, //INFINITY 11701 - UXV, //HYPOGEN 12601 - MAX, //ETERNAL 13501 - ; + None, // 0 + ULV, // Not implemented 901 + LV, // Cupronickel 1801 + MV, // KANTHAL 2701 + HV, // NICHROME 3601 + EV, // TUNGSTENSTEEL 4501 + IV, // HSSG 5401 + LuV, // HSSS 6301 + ZPM, // NAQUADAH 7201 + UV, // NAQUADAHALLOY 8101 + UHV, // TRINIUM 9001 + UEV, // ELECTRUMFLUX 9901 + UIV, // AWAKENEDDRACONIUM 10801 + UMV, // INFINITY 11701 + UXV, // HYPOGEN 12601 + MAX, // ETERNAL 13501 + ; + private static final HeatingCoilLevel[] VALUES = values(); - private static final HeatingCoilLevel[] VALUES = values(); + /** + * @return the coil heat, used for recipes in the Electronic Blast Furnace for example. + */ + public long getHeat() { + return this == None ? 0 : 1L + (900L * this.ordinal()); + } - /** - * @return the coil heat, used for recipes in the Electronic Blast Furnace for example. - */ - public long getHeat() { - return this == None ? 0 : 1L + (900L * this.ordinal()); - } + /** + * @return the coil tier, used for discount in the Pyrolyse Oven for example. + */ + public byte getTier() { + return (byte) (this.ordinal() - 2); + } - /** - * @return the coil tier, used for discount in the Pyrolyse Oven for example. - */ - public byte getTier() { - return (byte) (this.ordinal() - 2); - } + /** + * @return the coil Level, used for Parallels in the Multi Furnace for example. + */ + public byte getLevel() { + return (byte) (1 << Math.min(Math.max(0, this.ordinal() - 2), 4)); + } - /** - * @return the coil Level, used for Parallels in the Multi Furnace for example. - */ - public byte getLevel() { - return (byte) (1 << Math.min(Math.max(0, this.ordinal() - 2), 4)); - } + /** + * @return the coil Discount, used for discount in the Multi Furnace for example + */ + public int getCostDiscount() { + return 1 << Math.max(0, this.ordinal() - 5); + } - /** - * @return the coil Discount, used for discount in the Multi Furnace for example - */ - public int getCostDiscount() { - return 1 << Math.max(0, this.ordinal() - 5); - } + public String getName() { + return StatCollector.translateToLocal("GT5U.coil." + this); + } - public String getName() { - return StatCollector.translateToLocal("GT5U.coil." + this); - } + public static HeatingCoilLevel getFromTier(byte tier) { + if (tier < 0 || tier > getMaxTier()) return HeatingCoilLevel.None; - public static HeatingCoilLevel getFromTier(byte tier){ - if (tier < 0 || tier > getMaxTier()) - return HeatingCoilLevel.None; + return VALUES[tier + 2]; + } - return VALUES[tier+2]; - } + public static int size() { + return VALUES.length; + } - public static int size() { - return VALUES.length; - } - - public static int getMaxTier() { - return VALUES.length - 1 - 2; - } + public static int getMaxTier() { + return VALUES.length - 1 - 2; + } } diff --git a/src/main/java/gregtech/api/enums/ItemList.java b/src/main/java/gregtech/api/enums/ItemList.java index 6af3e75961..d517a6d50c 100644 --- a/src/main/java/gregtech/api/enums/ItemList.java +++ b/src/main/java/gregtech/api/enums/ItemList.java @@ -1,20 +1,19 @@ package gregtech.api.enums; +import static gregtech.api.enums.GT_Values.NI; +import static gregtech.api.enums.GT_Values.W; + import gregtech.api.interfaces.IItemContainer; import gregtech.api.util.GT_LanguageManager; import gregtech.api.util.GT_ModHandler; import gregtech.api.util.GT_OreDictUnificator; import gregtech.api.util.GT_Utility; +import java.util.Locale; import net.minecraft.block.Block; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; import net.minecraftforge.fluids.Fluid; -import java.util.Locale; - -import static gregtech.api.enums.GT_Values.NI; -import static gregtech.api.enums.GT_Values.W; - /** * Class containing all non-OreDict Items of GregTech. */ @@ -379,7 +378,7 @@ public enum ItemList implements IItemContainer { Circuit_Biowarecomputer, Circuit_Biowaresupercomputer, - Rotor_LV,//these aren't actually used + Rotor_LV, // these aren't actually used Rotor_MV, Rotor_HV, Rotor_EV, @@ -744,7 +743,7 @@ public enum ItemList implements IItemContainer { Generator_Naquadah_Mark_III, Generator_Naquadah_Mark_IV, Generator_Naquadah_Mark_V, - //Generator_Naquadah_Mark_VI, + // Generator_Naquadah_Mark_VI, Machine_Bronze_Boiler, Machine_Bronze_Boiler_Solar, Machine_HP_Solar, @@ -1903,171 +1902,156 @@ public enum ItemList implements IItemContainer { VOLUMETRIC_FLASK, Hatch_Input_Bus_ME, - Hatch_CraftingInput_Bus_ME - ; - + Hatch_CraftingInput_Bus_ME; public static final ItemList[] - DYE_ONLY_ITEMS = { - Color_00, - Color_01, - Color_02, - Color_03, - Color_04, - Color_05, - Color_06, - Color_07, - Color_08, - Color_09, - Color_10, - Color_11, - Color_12, - Color_13, - Color_14, - Color_15 - }, - SPRAY_CAN_DYES = { - Spray_Color_00, - Spray_Color_01, - Spray_Color_02, - Spray_Color_03, - Spray_Color_04, - Spray_Color_05, - Spray_Color_06, - Spray_Color_07, - Spray_Color_08, - Spray_Color_09, - Spray_Color_10, - Spray_Color_11, - Spray_Color_12, - Spray_Color_13, - Spray_Color_14, - Spray_Color_15 - }, - SPRAY_CAN_DYES_USED = { - Spray_Color_Used_00, - Spray_Color_Used_01, - Spray_Color_Used_02, - Spray_Color_Used_03, - Spray_Color_Used_04, - Spray_Color_Used_05, - Spray_Color_Used_06, - Spray_Color_Used_07, - Spray_Color_Used_08, - Spray_Color_Used_09, - Spray_Color_Used_10, - Spray_Color_Used_11, - Spray_Color_Used_12, - Spray_Color_Used_13, - Spray_Color_Used_14, - Spray_Color_Used_15 - }, - TRANSFORMERS = { - Transformer_LV_ULV, - Transformer_MV_LV, - Transformer_HV_MV, - Transformer_EV_HV, - Transformer_IV_EV, - Transformer_LuV_IV, - Transformer_ZPM_LuV, - Transformer_UV_ZPM, - Transformer_MAX_UV - }, - MACHINE_HULLS = { - Hull_ULV, - Hull_LV, - Hull_MV, - Hull_HV, - Hull_EV, - Hull_IV, - Hull_LuV, - Hull_ZPM, - Hull_UV, - Hull_MAX - }, - HATCHES_DYNAMO = { - Hatch_Dynamo_ULV, - Hatch_Dynamo_LV, - Hatch_Dynamo_MV, - Hatch_Dynamo_HV, - Hatch_Dynamo_EV, - Hatch_Dynamo_IV, - Hatch_Dynamo_LuV, - Hatch_Dynamo_ZPM, - Hatch_Dynamo_UV, - Hatch_Dynamo_MAX - }, - HATCHES_ENERGY = { - Hatch_Energy_ULV, - Hatch_Energy_LV, - Hatch_Energy_MV, - Hatch_Energy_HV, - Hatch_Energy_EV, - Hatch_Energy_IV, - Hatch_Energy_LuV, - Hatch_Energy_ZPM, - Hatch_Energy_UV, - Hatch_Energy_MAX - }, - HATCHES_INPUT = { - Hatch_Input_ULV, - Hatch_Input_LV, - Hatch_Input_MV, - Hatch_Input_HV, - Hatch_Input_EV, - Hatch_Input_IV, - Hatch_Input_LuV, - Hatch_Input_ZPM, - Hatch_Input_UV, - Hatch_Input_MAX - }, - HATCHES_INPUT_BUS = { - Hatch_Input_Bus_ULV, - Hatch_Input_Bus_LV, - Hatch_Input_Bus_MV, - Hatch_Input_Bus_HV, - Hatch_Input_Bus_EV, - Hatch_Input_Bus_IV, - Hatch_Input_Bus_LuV, - Hatch_Input_Bus_ZPM, - Hatch_Input_Bus_UV, - Hatch_Input_Bus_MAX - }, - HATCHES_OUTPUT = { - Hatch_Output_ULV, - Hatch_Output_LV, - Hatch_Output_MV, - Hatch_Output_HV, - Hatch_Output_EV, - Hatch_Output_IV, - Hatch_Output_LuV, - Hatch_Output_ZPM, - Hatch_Output_UV, - Hatch_Output_MAX - }, - HATCHES_OUTPUT_BUS = { - Hatch_Output_Bus_ULV, - Hatch_Output_Bus_LV, - Hatch_Output_Bus_MV, - Hatch_Output_Bus_HV, - Hatch_Output_Bus_EV, - Hatch_Output_Bus_IV, - Hatch_Output_Bus_LuV, - Hatch_Output_Bus_ZPM, - Hatch_Output_Bus_UV, - Hatch_Output_Bus_MAX - }, - HATCHES_MUFFLER = { - Hatch_Muffler_LV, - Hatch_Muffler_LV, - Hatch_Muffler_MV, - Hatch_Muffler_HV, - Hatch_Muffler_EV, - Hatch_Muffler_IV, - Hatch_Muffler_LuV, - Hatch_Muffler_ZPM, - Hatch_Muffler_UV, - Hatch_Muffler_MAX - }; + DYE_ONLY_ITEMS = + { + Color_00, Color_01, Color_02, Color_03, Color_04, Color_05, Color_06, Color_07, Color_08, + Color_09, Color_10, Color_11, Color_12, Color_13, Color_14, Color_15 + }, + SPRAY_CAN_DYES = + { + Spray_Color_00, + Spray_Color_01, + Spray_Color_02, + Spray_Color_03, + Spray_Color_04, + Spray_Color_05, + Spray_Color_06, + Spray_Color_07, + Spray_Color_08, + Spray_Color_09, + Spray_Color_10, + Spray_Color_11, + Spray_Color_12, + Spray_Color_13, + Spray_Color_14, + Spray_Color_15 + }, + SPRAY_CAN_DYES_USED = + { + Spray_Color_Used_00, + Spray_Color_Used_01, + Spray_Color_Used_02, + Spray_Color_Used_03, + Spray_Color_Used_04, + Spray_Color_Used_05, + Spray_Color_Used_06, + Spray_Color_Used_07, + Spray_Color_Used_08, + Spray_Color_Used_09, + Spray_Color_Used_10, + Spray_Color_Used_11, + Spray_Color_Used_12, + Spray_Color_Used_13, + Spray_Color_Used_14, + Spray_Color_Used_15 + }, + TRANSFORMERS = + { + Transformer_LV_ULV, + Transformer_MV_LV, + Transformer_HV_MV, + Transformer_EV_HV, + Transformer_IV_EV, + Transformer_LuV_IV, + Transformer_ZPM_LuV, + Transformer_UV_ZPM, + Transformer_MAX_UV + }, + MACHINE_HULLS = + {Hull_ULV, Hull_LV, Hull_MV, Hull_HV, Hull_EV, Hull_IV, Hull_LuV, Hull_ZPM, Hull_UV, Hull_MAX}, + HATCHES_DYNAMO = + { + Hatch_Dynamo_ULV, + Hatch_Dynamo_LV, + Hatch_Dynamo_MV, + Hatch_Dynamo_HV, + Hatch_Dynamo_EV, + Hatch_Dynamo_IV, + Hatch_Dynamo_LuV, + Hatch_Dynamo_ZPM, + Hatch_Dynamo_UV, + Hatch_Dynamo_MAX + }, + HATCHES_ENERGY = + { + Hatch_Energy_ULV, + Hatch_Energy_LV, + Hatch_Energy_MV, + Hatch_Energy_HV, + Hatch_Energy_EV, + Hatch_Energy_IV, + Hatch_Energy_LuV, + Hatch_Energy_ZPM, + Hatch_Energy_UV, + Hatch_Energy_MAX + }, + HATCHES_INPUT = + { + Hatch_Input_ULV, + Hatch_Input_LV, + Hatch_Input_MV, + Hatch_Input_HV, + Hatch_Input_EV, + Hatch_Input_IV, + Hatch_Input_LuV, + Hatch_Input_ZPM, + Hatch_Input_UV, + Hatch_Input_MAX + }, + HATCHES_INPUT_BUS = + { + Hatch_Input_Bus_ULV, + Hatch_Input_Bus_LV, + Hatch_Input_Bus_MV, + Hatch_Input_Bus_HV, + Hatch_Input_Bus_EV, + Hatch_Input_Bus_IV, + Hatch_Input_Bus_LuV, + Hatch_Input_Bus_ZPM, + Hatch_Input_Bus_UV, + Hatch_Input_Bus_MAX + }, + HATCHES_OUTPUT = + { + Hatch_Output_ULV, + Hatch_Output_LV, + Hatch_Output_MV, + Hatch_Output_HV, + Hatch_Output_EV, + Hatch_Output_IV, + Hatch_Output_LuV, + Hatch_Output_ZPM, + Hatch_Output_UV, + Hatch_Output_MAX + }, + HATCHES_OUTPUT_BUS = + { + Hatch_Output_Bus_ULV, + Hatch_Output_Bus_LV, + Hatch_Output_Bus_MV, + Hatch_Output_Bus_HV, + Hatch_Output_Bus_EV, + Hatch_Output_Bus_IV, + Hatch_Output_Bus_LuV, + Hatch_Output_Bus_ZPM, + Hatch_Output_Bus_UV, + Hatch_Output_Bus_MAX + }, + HATCHES_MUFFLER = + { + Hatch_Muffler_LV, + Hatch_Muffler_LV, + Hatch_Muffler_MV, + Hatch_Muffler_HV, + Hatch_Muffler_EV, + Hatch_Muffler_IV, + Hatch_Muffler_LuV, + Hatch_Muffler_ZPM, + Hatch_Muffler_UV, + Hatch_Muffler_MAX + }; public static Fluid sOilExtraHeavy, sEpichlorhydrin, sDrillingFluid, @@ -2086,8 +2070,7 @@ public enum ItemList implements IItemContainer { @Override public IItemContainer set(Item aItem) { mHasNotBeenSet = false; - if (aItem == null) - return this; + if (aItem == null) return this; ItemStack aStack = new ItemStack(aItem, 1, 0); mStack = GT_Utility.copyAmount(1, aStack); return this; @@ -2104,8 +2087,7 @@ public enum ItemList implements IItemContainer { public Item getItem() { if (mHasNotBeenSet) throw new IllegalAccessError("The Enum '" + name() + "' has not been set to an Item at this time!"); - if (GT_Utility.isStackInvalid(mStack)) - return null; + if (GT_Utility.isStackInvalid(mStack)) return null; return mStack.getItem(); } @@ -2128,8 +2110,7 @@ public enum ItemList implements IItemContainer { @Override public boolean isStackEqual(Object aStack, boolean aWildcard, boolean aIgnoreNBT) { - if (GT_Utility.isStackInvalid(aStack)) - return false; + if (GT_Utility.isStackInvalid(aStack)) return false; return GT_Utility.areUnificationsEqual((ItemStack) aStack, aWildcard ? getWildcard(1) : get(1), aIgnoreNBT); } @@ -2137,8 +2118,7 @@ public enum ItemList implements IItemContainer { public ItemStack get(long aAmount, Object... aReplacements) { if (mHasNotBeenSet) throw new IllegalAccessError("The Enum '" + name() + "' has not been set to an Item at this time!"); - if (GT_Utility.isStackInvalid(mStack)) - return GT_Utility.copyAmount(aAmount, aReplacements); + if (GT_Utility.isStackInvalid(mStack)) return GT_Utility.copyAmount(aAmount, aReplacements); return GT_Utility.copyAmount(aAmount, GT_OreDictUnificator.get(mStack)); } @@ -2146,8 +2126,7 @@ public enum ItemList implements IItemContainer { public ItemStack getWildcard(long aAmount, Object... aReplacements) { if (mHasNotBeenSet) throw new IllegalAccessError("The Enum '" + name() + "' has not been set to an Item at this time!"); - if (GT_Utility.isStackInvalid(mStack)) - return GT_Utility.copyAmount(aAmount, aReplacements); + if (GT_Utility.isStackInvalid(mStack)) return GT_Utility.copyAmount(aAmount, aReplacements); return GT_Utility.copyAmountAndMetaData(aAmount, W, GT_OreDictUnificator.get(mStack)); } @@ -2155,8 +2134,7 @@ public enum ItemList implements IItemContainer { public ItemStack getUndamaged(long aAmount, Object... aReplacements) { if (mHasNotBeenSet) throw new IllegalAccessError("The Enum '" + name() + "' has not been set to an Item at this time!"); - if (GT_Utility.isStackInvalid(mStack)) - return GT_Utility.copyAmount(aAmount, aReplacements); + if (GT_Utility.isStackInvalid(mStack)) return GT_Utility.copyAmount(aAmount, aReplacements); return GT_Utility.copyAmountAndMetaData(aAmount, 0, GT_OreDictUnificator.get(mStack)); } @@ -2164,23 +2142,23 @@ public enum ItemList implements IItemContainer { public ItemStack getAlmostBroken(long aAmount, Object... aReplacements) { if (mHasNotBeenSet) throw new IllegalAccessError("The Enum '" + name() + "' has not been set to an Item at this time!"); - if (GT_Utility.isStackInvalid(mStack)) - return GT_Utility.copyAmount(aAmount, aReplacements); + if (GT_Utility.isStackInvalid(mStack)) return GT_Utility.copyAmount(aAmount, aReplacements); return GT_Utility.copyAmountAndMetaData(aAmount, mStack.getMaxDamage() - 1, GT_OreDictUnificator.get(mStack)); } @Override public ItemStack getWithName(long aAmount, String aDisplayName, Object... aReplacements) { ItemStack rStack = get(1, aReplacements); - if (GT_Utility.isStackInvalid(rStack)) - return NI; + if (GT_Utility.isStackInvalid(rStack)) return NI; // CamelCase alphanumeric words from aDisplayName 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)); + 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 (tCamelCasedDisplayNameBuilder.length() == 0) { // CamelCased DisplayName is empty, so use hash of aDisplayName @@ -2197,8 +2175,7 @@ public enum ItemList implements IItemContainer { @Override public ItemStack getWithCharge(long aAmount, int aEnergy, Object... aReplacements) { ItemStack rStack = get(1, aReplacements); - if (GT_Utility.isStackInvalid(rStack)) - return null; + if (GT_Utility.isStackInvalid(rStack)) return null; GT_ModHandler.chargeElectricItem(rStack, aEnergy, Integer.MAX_VALUE, true, false); return GT_Utility.copyAmount(aAmount, rStack); } @@ -2207,8 +2184,7 @@ public enum ItemList implements IItemContainer { public ItemStack getWithDamage(long aAmount, long aMetaValue, Object... aReplacements) { if (mHasNotBeenSet) throw new IllegalAccessError("The Enum '" + name() + "' has not been set to an Item at this time!"); - if (GT_Utility.isStackInvalid(mStack)) - return GT_Utility.copyAmount(aAmount, aReplacements); + if (GT_Utility.isStackInvalid(mStack)) return GT_Utility.copyAmount(aAmount, aReplacements); return GT_Utility.copyAmountAndMetaData(aAmount, aMetaValue, GT_OreDictUnificator.get(mStack)); } @@ -2216,8 +2192,7 @@ public enum ItemList implements IItemContainer { public IItemContainer registerOre(Object... aOreNames) { if (mHasNotBeenSet) throw new IllegalAccessError("The Enum '" + name() + "' has not been set to an Item at this time!"); - for (Object tOreName : aOreNames) - GT_OreDictUnificator.registerOre(tOreName, get(1)); + for (Object tOreName : aOreNames) GT_OreDictUnificator.registerOre(tOreName, get(1)); return this; } @@ -2225,8 +2200,7 @@ public enum ItemList implements IItemContainer { public IItemContainer registerWildcardAsOre(Object... aOreNames) { if (mHasNotBeenSet) throw new IllegalAccessError("The Enum '" + name() + "' has not been set to an Item at this time!"); - for (Object tOreName : aOreNames) - GT_OreDictUnificator.registerOre(tOreName, getWildcard(1)); + for (Object tOreName : aOreNames) GT_OreDictUnificator.registerOre(tOreName, getWildcard(1)); return this; } diff --git a/src/main/java/gregtech/api/enums/MaterialBuilder.java b/src/main/java/gregtech/api/enums/MaterialBuilder.java index 94d0db1e35..5514b9382e 100644 --- a/src/main/java/gregtech/api/enums/MaterialBuilder.java +++ b/src/main/java/gregtech/api/enums/MaterialBuilder.java @@ -1,261 +1,275 @@ package gregtech.api.enums; import gregtech.api.objects.MaterialStack; - import java.util.ArrayList; import java.util.Arrays; import java.util.List; public class MaterialBuilder { - public static final int - DIESEL = 0, - GAS = 1, - THERMAL = 2, - SEMIFLUID = 3, - PLASMA = 4, - MAGIC = 5; - - private int metaItemSubID; - private TextureSet iconSet; - private float toolSpeed = 1.0f; - private int durability = 0; - private int toolQuality = 0; - private int types = 0; - private int r = 255, g = 255, b = 255, a = 0; - private String name; - private String defaultLocalName; - private int fuelType = 0; - private int fuelPower = 0; - private int meltingPoint = 0; - private int blastFurnaceTemp = 0; - private boolean blastFurnaceRequired = false; - private boolean transparent = false; - private int oreValue = 1; - private int densityMultiplier = 1; - private int densityDivider = 1; - private Dyes color = Dyes._NULL; - private int extraData = 0; - private List<MaterialStack> materialList = new ArrayList<>(); - private List<TC_Aspects.TC_AspectStack> aspects = new ArrayList<>(); - private boolean hasCorrespondingFluid = false; - private boolean hasCorrespondingGas = false; - private boolean canBeCracked = false; - private boolean canBeSteamCracked = false; - private int liquidTemperature = 300; - private int gasTemperature = 300; - - public MaterialBuilder(int metaItemSubID, TextureSet iconSet, String defaultLocalName) { - this.metaItemSubID = metaItemSubID; - this.iconSet = iconSet; - this.name = defaultLocalName.replace(" ", "").replace("-", ""); - this.defaultLocalName = defaultLocalName; - } - - public Materials constructMaterial() { - return new Materials(metaItemSubID, iconSet, toolSpeed, durability, toolQuality, types, r, g, b, a, name, defaultLocalName, fuelType, fuelPower, meltingPoint, blastFurnaceTemp, - blastFurnaceRequired, transparent, oreValue, densityMultiplier, densityDivider, color, extraData, materialList, aspects) - .setHasCorrespondingFluid(hasCorrespondingFluid) - .setHasCorrespondingGas(hasCorrespondingGas) - .setCanBeCracked(canBeCracked); - } - - public MaterialBuilder setName(String name){ - this.name = name; - return this; - } - - public MaterialBuilder setTypes(int types){ - this.types = types; - return this; - } - - public MaterialBuilder addDustItems(){ - types = types | 1; - return this; - } - - public MaterialBuilder addMetalItems(){ - types = types | 2; - return this; - } - - public MaterialBuilder addGemItems(){ - types = types | 4; - return this; - } - - public MaterialBuilder addOreItems(){ - types = types | 8; - return this; - } - - public MaterialBuilder addCell(){ - types = types | 16; - return this; - } - - public MaterialBuilder addPlasma(){ - types = types | 32; - return this; - } - - public MaterialBuilder addToolHeadItems(){ - types = types | 64; - return this; - } - - public MaterialBuilder addGearItems(){ - types = types | 128; - return this; - } - - public MaterialBuilder addFluid(){ - this.hasCorrespondingFluid = true; - return this; - } - - public MaterialBuilder addGas(){ - this.hasCorrespondingGas = true; - return this; - } - - public MaterialBuilder setRGBA(int r, int g, int b, int a){ - this.r = r; - this.g = g; - this.b = b; - this.a = a; - return this; - } - - public MaterialBuilder setRGB(int r, int g, int b){ - this.r = r; - this.g = g; - this.b = b; - return this; - } - - public MaterialBuilder setTransparent(boolean transparent){ - this.transparent = transparent; - return this; - } - - public MaterialBuilder setColor(Dyes color){ - this.color = color; - return this; - } - - - public MaterialBuilder setToolSpeed(float toolSpeed) { - this.toolSpeed = toolSpeed; - return this; - } - - public MaterialBuilder setDurability(int durability) { - this.durability = durability; - return this; - } - - public MaterialBuilder setToolQuality(int toolQuality) { - this.toolQuality = toolQuality; - return this; - } - - - public MaterialBuilder setFuelType(int fuelType) { - this.fuelType = fuelType; - return this; - } - - public MaterialBuilder setFuelPower(int fuelPower) { - this.fuelPower = fuelPower; - return this; - } - - public MaterialBuilder setMeltingPoint(int meltingPoint) { - this.meltingPoint = meltingPoint; - return this; - } - - public MaterialBuilder setBlastFurnaceTemp(int blastFurnaceTemp) { - this.blastFurnaceTemp = blastFurnaceTemp; - return this; - } - - public MaterialBuilder setBlastFurnaceRequired(boolean blastFurnaceRequired) { - this.blastFurnaceRequired = blastFurnaceRequired; - return this; - } - - public MaterialBuilder setOreValue(int oreValue) { - this.oreValue = oreValue; - return this; - } - - public MaterialBuilder setDensityMultiplier(int densityMultiplier) { - this.densityMultiplier = densityMultiplier; - return this; - } - - public MaterialBuilder setDensityDivider(int densityDivider) { - this.densityDivider = densityDivider; - return this; - } - - public MaterialBuilder setExtraData(int extraData) { - this.extraData = extraData; - return this; - } - - public MaterialBuilder addElectrolyzerRecipe(){ - extraData = extraData | 1; - return this; - } - - public MaterialBuilder addCentrifugeRecipe(){ - extraData = extraData | 2; - return this; - } - - public MaterialBuilder setMaterialList(List<MaterialStack> materialList) { - this.materialList = materialList; - return this; - } - - public MaterialBuilder setMaterialList(MaterialStack ... materials) { - this.materialList = Arrays.asList(materials); - return this; - } - - public MaterialBuilder setAspects(List<TC_Aspects.TC_AspectStack> aspects) { - this.aspects = aspects; - return this; - } - - public int getLiquidTemperature() { - return liquidTemperature; - } - - public MaterialBuilder setLiquidTemperature(int liquidTemperature) { - this.liquidTemperature = liquidTemperature; - return this; - } - - public int getGasTemperature() { - return gasTemperature; - } - - public MaterialBuilder setGasTemperature(int gasTemperature) { - this.gasTemperature = gasTemperature; - return this; - } - - public boolean canBeCracked() { - return canBeCracked; - } - - public MaterialBuilder setCanBeCracked(boolean canBeCracked) { - this.canBeCracked = canBeCracked; - return this; - } - + public static final int DIESEL = 0, GAS = 1, THERMAL = 2, SEMIFLUID = 3, PLASMA = 4, MAGIC = 5; + + private int metaItemSubID; + private TextureSet iconSet; + private float toolSpeed = 1.0f; + private int durability = 0; + private int toolQuality = 0; + private int types = 0; + private int r = 255, g = 255, b = 255, a = 0; + private String name; + private String defaultLocalName; + private int fuelType = 0; + private int fuelPower = 0; + private int meltingPoint = 0; + private int blastFurnaceTemp = 0; + private boolean blastFurnaceRequired = false; + private boolean transparent = false; + private int oreValue = 1; + private int densityMultiplier = 1; + private int densityDivider = 1; + private Dyes color = Dyes._NULL; + private int extraData = 0; + private List<MaterialStack> materialList = new ArrayList<>(); + private List<TC_Aspects.TC_AspectStack> aspects = new ArrayList<>(); + private boolean hasCorrespondingFluid = false; + private boolean hasCorrespondingGas = false; + private boolean canBeCracked = false; + private boolean canBeSteamCracked = false; + private int liquidTemperature = 300; + private int gasTemperature = 300; + + public MaterialBuilder(int metaItemSubID, TextureSet iconSet, String defaultLocalName) { + this.metaItemSubID = metaItemSubID; + this.iconSet = iconSet; + this.name = defaultLocalName.replace(" ", "").replace("-", ""); + this.defaultLocalName = defaultLocalName; + } + + public Materials constructMaterial() { + return new Materials( + metaItemSubID, + iconSet, + toolSpeed, + durability, + toolQuality, + types, + r, + g, + b, + a, + name, + defaultLocalName, + fuelType, + fuelPower, + meltingPoint, + blastFurnaceTemp, + blastFurnaceRequired, + transparent, + oreValue, + densityMultiplier, + densityDivider, + color, + extraData, + materialList, + aspects) + .setHasCorrespondingFluid(hasCorrespondingFluid) + .setHasCorrespondingGas(hasCorrespondingGas) + .setCanBeCracked(canBeCracked); + } + + public MaterialBuilder setName(String name) { + this.name = name; + return this; + } + + public MaterialBuilder setTypes(int types) { + this.types = types; + return this; + } + + public MaterialBuilder addDustItems() { + types = types | 1; + return this; + } + + public MaterialBuilder addMetalItems() { + types = types | 2; + return this; + } + + public MaterialBuilder addGemItems() { + types = types | 4; + return this; + } + + public MaterialBuilder addOreItems() { + types = types | 8; + return this; + } + + public MaterialBuilder addCell() { + types = types | 16; + return this; + } + + public MaterialBuilder addPlasma() { + types = types | 32; + return this; + } + + public MaterialBuilder addToolHeadItems() { + types = types | 64; + return this; + } + + public MaterialBuilder addGearItems() { + types = types | 128; + return this; + } + + public MaterialBuilder addFluid() { + this.hasCorrespondingFluid = true; + return this; + } + + public MaterialBuilder addGas() { + this.hasCorrespondingGas = true; + return this; + } + + public MaterialBuilder setRGBA(int r, int g, int b, int a) { + this.r = r; + this.g = g; + this.b = b; + this.a = a; + return this; + } + + public MaterialBuilder setRGB(int r, int g, int b) { + this.r = r; + this.g = g; + this.b = b; + return this; + } + + public MaterialBuilder setTransparent(boolean transparent) { + this.transparent = transparent; + return this; + } + + public MaterialBuilder setColor(Dyes color) { + this.color = color; + return this; + } + + public MaterialBuilder setToolSpeed(float toolSpeed) { + this.toolSpeed = toolSpeed; + return this; + } + + public MaterialBuilder setDurability(int durability) { + this.durability = durability; + return this; + } + + public MaterialBuilder setToolQuality(int toolQuality) { + this.toolQuality = toolQuality; + return this; + } + + public MaterialBuilder setFuelType(int fuelType) { + this.fuelType = fuelType; + return this; + } + + public MaterialBuilder setFuelPower(int fuelPower) { + this.fuelPower = fuelPower; + return this; + } + + public MaterialBuilder setMeltingPoint(int meltingPoint) { + this.meltingPoint = meltingPoint; + return this; + } + + public MaterialBuilder setBlastFurnaceTemp(int blastFurnaceTemp) { + this.blastFurnaceTemp = blastFurnaceTemp; + return this; + } + + public MaterialBuilder setBlastFurnaceRequired(boolean blastFurnaceRequired) { + this.blastFurnaceRequired = blastFurnaceRequired; + return this; + } + + public MaterialBuilder setOreValue(int oreValue) { + this.oreValue = oreValue; + return this; + } + + public MaterialBuilder setDensityMultiplier(int densityMultiplier) { + this.densityMultiplier = densityMultiplier; + return this; + } + + public MaterialBuilder setDensityDivider(int densityDivider) { + this.densityDivider = densityDivider; + return this; + } + + public MaterialBuilder setExtraData(int extraData) { + this.extraData = extraData; + return this; + } + + public MaterialBuilder addElectrolyzerRecipe() { + extraData = extraData | 1; + return this; + } + + public MaterialBuilder addCentrifugeRecipe() { + extraData = extraData | 2; + return this; + } + + public MaterialBuilder setMaterialList(List<MaterialStack> materialList) { + this.materialList = materialList; + return this; + } + + public MaterialBuilder setMaterialList(MaterialStack... materials) { + this.materialList = Arrays.asList(materials); + return this; + } + + public MaterialBuilder setAspects(List<TC_Aspects.TC_AspectStack> aspects) { + this.aspects = aspects; + return this; + } + + public int getLiquidTemperature() { + return liquidTemperature; + } + + public MaterialBuilder setLiquidTemperature(int liquidTemperature) { + this.liquidTemperature = liquidTemperature; + return this; + } + + public int getGasTemperature() { + return gasTemperature; + } + + public MaterialBuilder setGasTemperature(int gasTemperature) { + this.gasTemperature = gasTemperature; + return this; + } + + public boolean canBeCracked() { + return canBeCracked; + } + + public MaterialBuilder setCanBeCracked(boolean canBeCracked) { + this.canBeCracked = canBeCracked; + return this; + } } diff --git a/src/main/java/gregtech/api/enums/Materials.java b/src/main/java/gregtech/api/enums/Materials.java index caadfdb0a8..dac99a8630 100644 --- a/src/main/java/gregtech/api/enums/Materials.java +++ b/src/main/java/gregtech/api/enums/Materials.java @@ -1,5 +1,8 @@ package gregtech.api.enums; +import static gregtech.api.enums.GT_Values.M; +import static gregtech.api.enums.GT_Values.MOD_ID_DC; + import cpw.mods.fml.common.Loader; import gregtech.GT_Mod; import gregtech.api.GregTech_API; @@ -14,18 +17,14 @@ import gregtech.api.util.GT_Utility; import gregtech.common.render.items.GT_GeneratedMaterial_Renderer; import gregtech.loaders.materialprocessing.ProcessingConfig; import gregtech.loaders.materialprocessing.ProcessingModSupport; +import java.util.*; +import java.util.stream.Collectors; +import java.util.stream.IntStream; import net.minecraft.enchantment.Enchantment; import net.minecraft.item.ItemStack; import net.minecraftforge.fluids.Fluid; import net.minecraftforge.fluids.FluidStack; -import java.util.*; -import java.util.stream.Collectors; -import java.util.stream.IntStream; - -import static gregtech.api.enums.GT_Values.M; -import static gregtech.api.enums.GT_Values.MOD_ID_DC; - @SuppressWarnings("unused") // API Legitimately has unused Members and Methods public class Materials implements IColorModulationContainer, ISubTagContainer { @@ -40,855 +39,16849 @@ public class Materials implements IColorModulationContainer, ISubTagContainer { /** * This is the Default Material returned in case no Material has been found or a NullPointer has been inserted at a location where it shouldn't happen. */ - public static Materials _NULL = new Materials(-1, TextureSet.SET_NONE, 1.0F, 0, 0, 0, 255, 255, 255, 0, "NULL", "NULL", 0, 0, 0, 0, false, false, 1, 1, 1, Dyes._NULL, Element._NULL, Collections.singletonList(new TC_AspectStack(TC_Aspects.VACUOS, 1))); + public static Materials _NULL = new Materials( + -1, + TextureSet.SET_NONE, + 1.0F, + 0, + 0, + 0, + 255, + 255, + 255, + 0, + "NULL", + "NULL", + 0, + 0, + 0, + 0, + false, + false, + 1, + 1, + 1, + Dyes._NULL, + Element._NULL, + Collections.singletonList(new TC_AspectStack(TC_Aspects.VACUOS, 1))); /** * Direct Elements */ - public static Materials Aluminium = new Materials( 19, TextureSet.SET_DULL , 10.0F, 128, 2, 1|2 |8 |32|64|128 , 128, 200, 240, 0, "Aluminium" , "Aluminium" , 0, 0, 933, 1700, true, false, 3, 1, 1, Dyes.dyeLightBlue , Element.Al , Arrays.asList(new TC_AspectStack(TC_Aspects.METALLUM, 2), new TC_AspectStack(TC_Aspects.VOLATUS, 1))).disableAutoGeneratedBlastFurnaceRecipes(); - public static Materials Americium = new Materials( 103, TextureSet.SET_METALLIC , 1.0F, 0, 3, 1|2 |8 |32 , 200, 200, 200, 0, "Americium" , "Americium" , 0, 0, 1449, 0, false, false, 3, 1, 1, Dyes.dyeLightGray , Element.Am , Arrays.asList(new TC_AspectStack(TC_Aspects.METALLUM, 2), new TC_AspectStack(TC_Aspects.RADIO, 1))); - public static Materials Antimony = new Materials( 58, TextureSet.SET_SHINY , 1.0F, 0, 2, 1|2 |8 |32 , 220, 220, 240, 0, "Antimony" , "Antimony" , 0, 0, 903, 0, false, false, 2, 1, 1, Dyes.dyeLightGray , Element.Sb , Arrays.asList(new TC_AspectStack(TC_Aspects.METALLUM, 2), new TC_AspectStack(TC_Aspects.AQUA, 1))); - public static Materials Argon = new Materials( 24, TextureSet.SET_FLUID , 1.0F, 0, 2, 16|32 , 0, 255, 0, 240, "Argon" , "Argon" , 0, 0, 83, 0, false, true, 5, 1, 1, Dyes.dyeGreen , Element.Ar , Collections.singletonList(new TC_AspectStack(TC_Aspects.AER, 2))); - public static Materials Arsenic = new Materials( 39, TextureSet.SET_DULL , 1.0F, 0, 2, 1|2 |8|16|32 , 255, 255, 255, 0, "Arsenic" , "Arsenic" , 0, 0, 1090, 0, false, false, 3, 1, 1, Dyes.dyeOrange , Element.As , Collections.singletonList(new TC_AspectStack(TC_Aspects.VENENUM, 3))); - public static Materials Barium = new Materials( 63, TextureSet.SET_METALLIC , 1.0F, 0, 2, 1|2 |8 |32 , 255, 255, 255, 0, "Barium" , "Barium" , 0, 0, 1000, 0, false, false, 1, 1, 1, Dyes._NULL , Element.Ba , Collections.singletonList(new TC_AspectStack(TC_Aspects.VINCULUM, 3))); - public static Materials Beryllium = new Materials( 8, TextureSet.SET_METALLIC , 14.0F, 64, 2, 1|2 |8 |32|64 , 100, 180, 100, 0, "Beryllium" , "Beryllium" , 0, 0, 1560, 0, false, false, 6, 1, 1, Dyes.dyeGreen , Element.Be , Arrays.asList(new TC_AspectStack(TC_Aspects.METALLUM, 2), new TC_AspectStack(TC_Aspects.LUCRUM, 1))); - public static Materials Bismuth = new Materials( 90, TextureSet.SET_METALLIC , 6.0F, 64, 1, 1|2 |8 |32|64|128 , 100, 160, 160, 0, "Bismuth" , "Bismuth" , 0, 0, 544, 0, false, false, 2, 1, 1, Dyes.dyeCyan , Element.Bi , Arrays.asList(new TC_AspectStack(TC_Aspects.METALLUM, 2), new TC_AspectStack(TC_Aspects.INSTRUMENTUM, 1))); - public static Materials Boron = new Materials( 9, TextureSet.SET_DULL , 1.0F, 0, 2, 1|32 , 210, 250, 210, 0, "Boron" , "Boron" , 0, 0, 2349, 0, false, false, 1, 1, 1, Dyes.dyeWhite , Element.B , Collections.singletonList(new TC_AspectStack(TC_Aspects.VITREUS, 3))); - public static Materials Caesium = new Materials( 62, TextureSet.SET_METALLIC , 1.0F, 0, 2, 1|2 |8 |32 , 176, 196, 222, 0, "Caesium" , "Caesium" , 0, 0, 301, 0, false, false, 4, 1, 1, Dyes._NULL , Element.Cs , Arrays.asList(new TC_AspectStack(TC_Aspects.METALLUM, 2), new TC_AspectStack(TC_Aspects.RADIO, 1))); - public static Materials Calcium = new Materials( 26, TextureSet.SET_METALLIC , 1.0F, 0, 2, 1 |32 , 255, 245, 245, 0, "Calcium" , "Calcium" , 0, 0, 1115, 1115, true, false, 4, 1, 1, Dyes.dyePink , Element.Ca , Arrays.asList(new TC_AspectStack(TC_Aspects.SANO, 1), new TC_AspectStack(TC_Aspects.TUTAMEN, 1))); - public static Materials Carbon = new Materials( 10, TextureSet.SET_DULL , 1.0F, 64, 2, 1|2 |16|32|64|128 , 20, 20, 20, 0, "Carbon" , "Carbon" , 0, 0, 3800, 0, false, false, 2, 1, 1, Dyes.dyeBlack , Element.C , Arrays.asList(new TC_Aspects.TC_AspectStack(TC_Aspects.VITREUS, 1), new TC_AspectStack(TC_Aspects.IGNIS, 1))); - public static Materials Cadmium = new Materials( 55, TextureSet.SET_SHINY , 1.0F, 0, 2, 1 |8 |32 , 50, 50, 60, 0, "Cadmium" , "Cadmium" , 0, 0, 594, 0, false, false, 3, 1, 1, Dyes.dyeGray , Element.Cd , Arrays.asList(new TC_AspectStack(TC_Aspects.METALLUM, 1), new TC_AspectStack(TC_Aspects.POTENTIA, 1), new TC_AspectStack(TC_Aspects.VENENUM, 1))); - public static Materials Cerium = new Materials( 65, TextureSet.SET_METALLIC , 1.0F, 0, 2, 1|2 |8 |32 , 123, 212, 144, 0, "Cerium" , "Cerium" , 0, 0, 1068, 1068, true, false, 4, 1, 1, Dyes._NULL , Element.Ce , Arrays.asList(new TC_AspectStack(TC_Aspects.METALLUM, 2), new TC_AspectStack(TC_Aspects.RADIO, 1))); - public static Materials Chlorine = new Materials( 23, TextureSet.SET_FLUID , 1.0F, 0, 2, 16|32 , 255, 255, 255, 0, "Chlorine" , "Chlorine" , 0, 0, 171, 0, false, false, 2, 1, 1, Dyes.dyeCyan , Element.Cl , Arrays.asList(new TC_AspectStack(TC_Aspects.AQUA, 2), new TC_AspectStack(TC_Aspects.PANNUS, 1))); - public static Materials Chrome = new Materials( 30, TextureSet.SET_SHINY , 11.0F, 256, 3, 1|2 |8 |32|64|128 , 255, 230, 230, 0, "Chrome" , "Chrome" , 0, 0, 2180, 1700, true, false, 5, 1, 1, Dyes.dyePink , Element.Cr , Arrays.asList(new TC_AspectStack(TC_Aspects.METALLUM, 2), new TC_AspectStack(TC_Aspects.MACHINA, 1))); - public static Materials Cobalt = new Materials( 33, TextureSet.SET_METALLIC , 8.0F, 512, 3, 1|2 |8 |32|64|128 , 80, 80, 250, 0, "Cobalt" , "Cobalt" , 0, 0, 1768, 1700, true, false, 3, 1, 1, Dyes.dyeBlue , Element.Co , Arrays.asList(new TC_AspectStack(TC_Aspects.METALLUM, 2), new TC_AspectStack(TC_Aspects.INSTRUMENTUM, 1))).disableAutoGeneratedBlastFurnaceRecipes(); - public static Materials Copper = new Materials( 35, TextureSet.SET_DULL , 1.0F, 0, 1, 1|2 |8 |32 |128 , 255, 100, 0, 0, "Copper" , "Copper" , 0, 0, 1357, 0, false, false, 3, 1, 1, Dyes.dyeOrange , Element.Cu , Arrays.asList(new TC_AspectStack(TC_Aspects.METALLUM, 2), new TC_AspectStack(TC_Aspects.PERMUTATIO, 1))); - public static Materials Deuterium = new Materials( 2, TextureSet.SET_FLUID , 1.0F, 0, 2, 16|32 , 255, 255, 0, 240, "Deuterium" , "Deuterium" , 0, 0, 14, 0, false, true, 10, 1, 1, Dyes.dyeYellow , Element.D , Collections.singletonList(new TC_AspectStack(TC_Aspects.AQUA, 3))); - public static Materials Dysprosium = new Materials( 73, TextureSet.SET_METALLIC , 1.0F, 0, 2, 1|2 |8 |32 , 105, 209, 80, 0, "Dysprosium" , "Dysprosium" , 0, 0, 1680, 1680, true, false, 4, 1, 1, Dyes._NULL , Element.Dy , Collections.singletonList(new TC_AspectStack(TC_Aspects.METALLUM, 3))); - public static Materials Empty = new Materials( 0, TextureSet.SET_NONE , 1.0F, 0, 2, 256/*Only when needed*/ , 255, 255, 255, 255, "Empty" , "Empty" , 0, 0, -1, 0, false, true, 1, 1, 1, Dyes._NULL , Element._NULL , Collections.singletonList(new TC_AspectStack(TC_Aspects.VACUOS, 2))); - public static Materials Erbium = new Materials( 75, TextureSet.SET_SHINY , 1.0F, 0, 2, 1|2 |8 |32 , 176, 152, 81, 0, "Erbium" , "Erbium" , 0, 0, 1802, 1802, true, false, 4, 1, 1, Dyes._NULL , Element.Er , Arrays.asList(new TC_AspectStack(TC_Aspects.METALLUM, 2), new TC_AspectStack(TC_Aspects.RADIO, 1))); - public static Materials Europium = new Materials( 70, TextureSet.SET_SHINY , 1.0F, 0, 2, 1|2 |8 |32 , 246, 181, 255, 0, "Europium" , "Europium" , 0, 0, 1099, 1099, true, false, 4, 1, 1, Dyes._NULL , Element.Eu , Arrays.asList(new TC_AspectStack(TC_Aspects.METALLUM, 2), new TC_AspectStack(TC_Aspects.RADIO, 1))); - public static Materials Fluorine = new Materials( 14, TextureSet.SET_FLUID , 1.0F, 0, 2, 16|32 , 255, 255, 255, 127, "Fluorine" , "Fluorine" , 0, 0, 53, 0, false, true, 2, 1, 1, Dyes.dyeGreen , Element.F , Collections.singletonList(new TC_AspectStack(TC_Aspects.PERDITIO, 2))); - public static Materials Gadolinium = new Materials( 71, TextureSet.SET_METALLIC , 1.0F, 0, 2, 1|2 |8 |32 , 59, 186, 28, 0, "Gadolinium" , "Gadolinium" , 0, 0, 1585, 1585, true, false, 4, 1, 1, Dyes._NULL , Element.Gd , Arrays.asList(new TC_AspectStack(TC_Aspects.METALLUM, 2), new TC_AspectStack(TC_Aspects.RADIO, 1))); - public static Materials Gallium = new Materials( 37, TextureSet.SET_SHINY , 1.0F, 64, 2, 1|2 |8 |32 , 220, 220, 255, 0, "Gallium" , "Gallium" , 0, 0, 302, 0, false, false, 5, 1, 1, Dyes.dyeLightGray , Element.Ga , Arrays.asList(new TC_AspectStack(TC_Aspects.METALLUM, 2), new TC_AspectStack(TC_Aspects.ELECTRUM, 1))); - public static Materials Gold = new Materials( 86, TextureSet.SET_SHINY , 12.0F, 64, 2, 1|2 |8 |32|64|128 , 255, 255, 30, 0, "Gold" , "Gold" , 0, 0, 1337, 0, false, false, 4, 1, 1, Dyes.dyeYellow , Element.Au , Arrays.asList(new TC_AspectStack(TC_Aspects.METALLUM, 2), new TC_AspectStack(TC_Aspects.LUCRUM, 2))); - public static Materials Holmium = new Materials( 74, TextureSet.SET_SHINY , 1.0F, 0, 2, 1|2 |8 |32 , 22, 8, 166, 0, "Holmium" , "Holmium" , 0, 0, 1734, 1734, true, false, 4, 1, 1, Dyes._NULL , Element.Ho , Arrays.asList(new TC_AspectStack(TC_Aspects.METALLUM, 2), new TC_AspectStack(TC_Aspects.RADIO, 1))); - public static Materials Hydrogen = new Materials( 1, TextureSet.SET_FLUID , 1.0F, 0, 2, 16|32 , 0, 0, 255, 240, "Hydrogen" , "Hydrogen" , 1, 20, 14, 0, false, true, 2, 1, 1, Dyes.dyeBlue , Element.H , Collections.singletonList(new TC_AspectStack(TC_Aspects.AQUA, 1))); - public static Materials Helium = new Materials( 4, TextureSet.SET_FLUID , 1.0F, 0, 2, 16|32 , 255, 255, 0, 240, "Helium" , "Helium" , 0, 0, 1, 0, false, true, 5, 1, 1, Dyes.dyeYellow , Element.He , Collections.singletonList(new TC_AspectStack(TC_Aspects.AER, 2))); - public static Materials Helium_3 = new Materials( 5, TextureSet.SET_FLUID , 1.0F, 0, 2, 16|32 , 255, 255, 0, 240, "Helium_3" , "Helium-3" , 0, 0, 1, 0, false, true, 10, 1, 1, Dyes.dyeYellow , Element.He_3 , Collections.singletonList(new TC_AspectStack(TC_Aspects.AER, 3))); - public static Materials Indium = new Materials( 56, TextureSet.SET_METALLIC , 1.0F, 0, 2, 1|2 |8 |32 , 64, 0, 128, 0, "Indium" , "Indium" , 0, 0, 429, 0, false, false, 4, 1, 1, Dyes.dyeGray , Element.In , Arrays.asList(new TC_AspectStack(TC_Aspects.METALLUM, 2), new TC_AspectStack(TC_Aspects.RADIO, 1))); - public static Materials Iridium = new Materials( 84, TextureSet.SET_DULL , 6.0F, 2560, 3, 1|2 |8 |32|64|128 , 240, 240, 245, 0, "Iridium" , "Iridium" , 0, 0, 2719, 4500, true, false, 10, 1, 1, Dyes.dyeWhite , Element.Ir , Arrays.asList(new TC_AspectStack(TC_Aspects.METALLUM, 2), new TC_AspectStack(TC_Aspects.MACHINA, 1))).disableAutoGeneratedBlastFurnaceRecipes(); - public static Materials Iron = new Materials( 32, TextureSet.SET_METALLIC , 6.0F, 256, 2, 1|2 |8 |32|64|128 , 200, 200, 200, 0, "Iron" , "Iron" , 0, 0, 1811, 0, false, false, 3, 1, 1, Dyes.dyeLightGray , Element.Fe , Collections.singletonList(new TC_AspectStack(TC_Aspects.METALLUM, 3))); - public static Materials Lanthanum = new Materials( 64, TextureSet.SET_METALLIC , 1.0F, 0, 2, 1|2 |8 |32 , 138, 138, 138, 0, "Lanthanum" , "Lanthanum" , 0, 0, 1193, 1193, true, false, 4, 1, 1, Dyes._NULL , Element.La , Arrays.asList(new TC_AspectStack(TC_Aspects.METALLUM, 2), new TC_AspectStack(TC_Aspects.RADIO, 1))); - public static Materials Lead = new Materials( 89, TextureSet.SET_DULL , 8.0F, 64, 1, 1|2 |8 |32|64|128 , 140, 100, 140, 0, "Lead" , "Lead" , 0, 0, 600, 0, false, false, 3, 1, 1, Dyes.dyePurple , Element.Pb , Arrays.asList(new TC_AspectStack(TC_Aspects.METALLUM, 2), new TC_AspectStack(TC_Aspects.ORDO, 1))); - public static Materials Lithium = new Materials( 6, TextureSet.SET_DULL , 1.0F, 0, 2, 1|2 |8 |32 , 225, 220, 255, 0, "Lithium" , "Lithium" , 0, 0, 454, 0, false, false, 4, 1, 1, Dyes.dyeLightBlue , Element.Li , Arrays.asList(new TC_AspectStack(TC_Aspects.VITREUS, 1), new TC_AspectStack(TC_Aspects.POTENTIA, 2))); - public static Materials Lutetium = new Materials( 78, TextureSet.SET_SHINY , 1.0F, 0, 2, 1|2 |8 |32 , 188, 62, 199, 0, "Lutetium" , "Lutetium" , 0, 0, 1925, 1925, true, false, 4, 1, 1, Dyes._NULL , Element.Lu , Arrays.asList(new TC_AspectStack(TC_Aspects.METALLUM, 2), new TC_AspectStack(TC_Aspects.RADIO, 1))); - public static Materials Magic = new Materials(-128, TextureSet.SET_SHINY , 8.0F, 5120, 5, 1|2|4|8|16|32|64|128 , 100, 0, 200, 0, "Magic" , "Magic" , 5, 32, 5000, 0, false, false, 7, 1, 1, Dyes.dyePurple , Element.Ma , Collections.singletonList(new TC_AspectStack(TC_Aspects.PRAECANTATIO, 4))); - public static Materials Magnesium = new Materials( 18, TextureSet.SET_METALLIC , 1.0F, 0, 2, 1|2 |8 |32 , 255, 200, 200, 0, "Magnesium" , "Magnesium" , 0, 0, 923, 0, false, false, 3, 1, 1, Dyes.dyePink , Element.Mg , Arrays.asList(new TC_AspectStack(TC_Aspects.METALLUM, 2), new TC_AspectStack(TC_Aspects.SANO, 1))); - public static Materials Manganese = new Materials( 31, TextureSet.SET_DULL , 7.0F, 512, 2, 1|2 |8 |32|64 , 250, 250, 250, 0, "Manganese" , "Manganese" , 0, 0, 1519, 0, false, false, 3, 1, 1, Dyes.dyeWhite , Element.Mn , Collections.singletonList(new TC_AspectStack(TC_Aspects.METALLUM, 3))); - public static Materials Mercury = new Materials( 87, TextureSet.SET_SHINY , 1.0F, 0, 0, 16|32 , 255, 220, 220, 0, "Mercury" , "Mercury" , 5, 32, 234, 0, false, false, 3, 1, 1, Dyes.dyeLightGray , Element.Hg , Arrays.asList(new TC_AspectStack(TC_Aspects.METALLUM, 1), new TC_AspectStack(TC_Aspects.AQUA, 1), new TC_AspectStack(TC_Aspects.VENENUM, 1))); - public static Materials Molybdenum = new Materials( 48, TextureSet.SET_SHINY , 7.0F, 512, 2, 1|2 |8 |32|64 , 180, 180, 220, 0, "Molybdenum" , "Molybdenum" , 0, 0, 2896, 0, false, false, 1, 1, 1, Dyes.dyeBlue , Element.Mo , Arrays.asList(new TC_AspectStack(TC_Aspects.METALLUM, 2), new TC_AspectStack(TC_Aspects.INSTRUMENTUM, 1))); - public static Materials Neodymium = new Materials( 67, TextureSet.SET_METALLIC , 7.0F, 512, 2, 1|2 |8 |32|64|128 , 100, 100, 100, 0, "Neodymium" , "Neodymium" , 0, 0, 1297, 1297, true, false, 4, 1, 1, Dyes._NULL , Element.Nd , Arrays.asList(new TC_AspectStack(TC_Aspects.METALLUM, 2), new TC_AspectStack(TC_Aspects.MAGNETO, 2))); - public static Materials Neutronium = new Materials( 129, TextureSet.SET_DULL , 24.0F, 655360, 6, 1|2 |8 |32|64|128 , 250, 250, 250, 0, "Neutronium" , "Neutronium" , 0, 0, 10000, 10000, true, false, 20, 1, 1, Dyes.dyeWhite , Element.Nt , Arrays.asList(new TC_AspectStack(TC_Aspects.METALLUM, 4), new TC_AspectStack(TC_Aspects.VITREUS, 3), new TC_AspectStack(TC_Aspects.ALIENIS, 2))).disableAutoGeneratedBlastFurnaceRecipes(); - public static Materials Nickel = new Materials( 34, TextureSet.SET_METALLIC , 6.0F, 64, 2, 1|2 |8 |32|64|128 , 200, 200, 250, 0, "Nickel" , "Nickel" , 0, 0, 1728, 0, false, false, 4, 1, 1, Dyes.dyeLightBlue , Element.Ni , Arrays.asList(new TC_AspectStack(TC_Aspects.METALLUM, 2), new TC_AspectStack(TC_Aspects.IGNIS, 1))); - public static Materials Niobium = new Materials( 47, TextureSet.SET_METALLIC , 1.0F, 0, 2, 1|2 |8 |32 , 190, 180, 200, 0, "Niobium" , "Niobium" , 0, 0, 2750, 2750, true, false, 5, 1, 1, Dyes._NULL , Element.Nb , Arrays.asList(new TC_AspectStack(TC_Aspects.METALLUM, 2), new TC_AspectStack(TC_Aspects.ELECTRUM, 1))); - public static Materials Nitrogen = new Materials( 12, TextureSet.SET_FLUID , 1.0F, 0, 2, 16|32 , 0, 150, 200, 240, "Nitrogen" , "Nitrogen" , 0, 0, 63, 0, false, true, 2, 1, 1, Dyes.dyeCyan , Element.N , Collections.singletonList(new TC_AspectStack(TC_Aspects.AER, 2))); - public static Materials Osmium = new Materials( 83, TextureSet.SET_METALLIC , 16.0F, 1280, 4, 1|2 |8 |32|64|128 , 50, 50, 255, 0, "Osmium" , "Osmium" , 0, 0, 3306, 4500, true, false, 10, 1, 1, Dyes.dyeBlue , Element.Os , Arrays.asList(new TC_AspectStack(TC_Aspects.METALLUM, 2), new TC_AspectStack(TC_Aspects.MACHINA, 1), new TC_AspectStack(TC_Aspects.NEBRISUM, 1))).disableAutoGeneratedBlastFurnaceRecipes(); - public static Materials Oxygen = new Materials( 13, TextureSet.SET_FLUID , 1.0F, 0, 2, 16|32 , 0, 100, 200, 240, "Oxygen" , "Oxygen" , 0, 0, 54, 0, false, true, 1, 1, 1, Dyes.dyeWhite , Element.O , Collections.singletonList(new TC_AspectStack(TC_Aspects.AER, 1))); - public static Materials Palladium = new Materials( 52, TextureSet.SET_SHINY , 8.0F, 512, 4, 1|2 |8 |32|64|128 , 128, 128, 128, 0, "Palladium" , "Palladium" , 0, 0, 1828, 1828, true, false, 4, 1, 1, Dyes.dyeGray , Element.Pd , Collections.singletonList(new TC_AspectStack(TC_Aspects.METALLUM, 3))); - public static Materials Phosphorus = new Materials( 21, TextureSet.SET_DULL , 1.0F, 0, 2, 1 |32 , 255, 255, 0, 0, "Phosphorus" , "Phosphorus" , 0, 0, 317, 0, false, false, 2, 1, 1, Dyes.dyeYellow , Element.P , Arrays.asList(new TC_Aspects.TC_AspectStack(TC_Aspects.IGNIS, 2), new TC_AspectStack(TC_Aspects.POTENTIA, 1))); - public static Materials Platinum = new Materials( 85, TextureSet.SET_SHINY , 12.0F, 64, 4, 1|2 |8 |32|64|128 , 255, 255, 200, 0, "Platinum" , "Platinum" , 0, 0, 2041, 0, false, false, 6, 1, 1, Dyes.dyeOrange , Element.Pt , Arrays.asList(new TC_AspectStack(TC_Aspects.METALLUM, 2), new TC_AspectStack(TC_Aspects.NEBRISUM, 1))); - public static Materials Plutonium = new Materials( 100, TextureSet.SET_METALLIC , 6.0F, 512, 3, 1|2 |8 |32|64 , 240, 50, 50, 0, "Plutonium" , "Plutonium 239" , 0, 0, 912, 0, false, false, 6, 1, 1, Dyes.dyeLime , Element.Pu , Arrays.asList(new TC_AspectStack(TC_Aspects.METALLUM, 2), new TC_AspectStack(TC_Aspects.RADIO, 2))); - public static Materials Plutonium241 = new Materials( 101, TextureSet.SET_SHINY , 6.0F, 512, 3, 1|2 |8 |32|64 , 250, 70, 70, 0, "Plutonium241" , "Plutonium 241" , 0, 0, 912, 0, false, false, 6, 1, 1, Dyes.dyeLime , Element.Pu_241 , Arrays.asList(new TC_AspectStack(TC_Aspects.METALLUM, 2), new TC_AspectStack(TC_Aspects.RADIO, 3))); - public static Materials Potassium = new Materials( 25, TextureSet.SET_METALLIC , 1.0F, 0, 1, 1|2 |32 , 154, 172, 223, 0, "Potassium" , "Potassium" , 0, 0, 336, 0, false, false, 2, 1, 1, Dyes.dyeWhite , Element.K , Arrays.asList(new TC_AspectStack(TC_Aspects.VITREUS, 1), new TC_AspectStack(TC_Aspects.POTENTIA, 1))); - public static Materials Praseodymium = new Materials( 66, TextureSet.SET_DULL , 1.0F, 0, 2, 1|2 |8 |32 , 117, 214, 129, 0, "Praseodymium" , "Praseodymium" , 0, 0, 1208, 1208, true, false, 4, 1, 1, Dyes._NULL , Element.Pr , Arrays.asList(new TC_AspectStack(TC_Aspects.METALLUM, 2), new TC_AspectStack(TC_Aspects.RADIO, 1))); - public static Materials Promethium = new Materials( 68, TextureSet.SET_SHINY , 1.0F, 0, 2, 1|2 |8 |32 , 36, 181, 53, 0, "Promethium" , "Promethium" , 0, 0, 1315, 1315, true, false, 4, 1, 1, Dyes._NULL , Element.Pm , Arrays.asList(new TC_AspectStack(TC_Aspects.METALLUM, 2), new TC_AspectStack(TC_Aspects.RADIO, 1))); - public static Materials Radon = new Materials( 93, TextureSet.SET_FLUID , 1.0F, 0, 2, 16|32 , 255, 0, 255, 240, "Radon" , "Radon" , 0, 0, 202, 0, false, true, 5, 1, 1, Dyes.dyePurple , Element.Rn , Arrays.asList(new TC_AspectStack(TC_Aspects.AER, 1), new TC_AspectStack(TC_Aspects.RADIO, 1))); - public static Materials Rubidium = new Materials( 43, TextureSet.SET_METALLIC , 1.0F, 0, 2, 1|2 |8 |32 , 240, 30, 30, 0, "Rubidium" , "Rubidium" , 0, 0, 312, 0, false, false, 4, 1, 1, Dyes.dyeRed , Element.Rb , Arrays.asList(new TC_AspectStack(TC_Aspects.METALLUM, 2), new TC_AspectStack(TC_Aspects.VITREUS, 1))); - public static Materials Samarium = new Materials( 69, TextureSet.SET_METALLIC , 1.0F, 0, 2, 1|2 |8 |32 , 255, 255, 204, 0, "Samarium" , "Samarium" , 0, 0, 1345, 1345, true, false, 4, 1, 1, Dyes.dyeWhite , Element.Sm , Arrays.asList(new TC_AspectStack(TC_Aspects.METALLUM, 2), new TC_AspectStack(TC_Aspects.RADIO, 1), new TC_AspectStack(TC_Aspects.MAGNETO,10))); - public static Materials Scandium = new Materials( 27, TextureSet.SET_METALLIC , 1.0F, 0, 2, 1|2 |8 |32 , 204, 204, 204, 0, "Scandium" , "Scandium" , 0, 0, 1814, 1814, true, false, 2, 1, 1, Dyes.dyeYellow , Element.Sc , Arrays.asList(new TC_AspectStack(TC_Aspects.METALLUM, 2), new TC_AspectStack(TC_Aspects.RADIO, 1))); - public static Materials Silicon = new Materials( 20, TextureSet.SET_METALLIC , 1.0F, 0, 2, 1|2 |8 |32 , 60, 60, 80, 0, "Silicon" , "Raw Silicon" , 0, 0, 2273, 2273, true, false, 1, 1, 1, Dyes.dyeBlack , Element.Si , Arrays.asList(new TC_AspectStack(TC_Aspects.METALLUM, 2), new TC_AspectStack(TC_Aspects.TENEBRAE, 1))); - public static Materials Silver = new Materials( 54, TextureSet.SET_SHINY , 10.0F, 64, 2, 1|2 |8 |32|64|128 , 220, 220, 255, 0, "Silver" , "Silver" , 0, 0, 1234, 0, false, false, 3, 1, 1, Dyes.dyeLightGray , Element.Ag , Arrays.asList(new TC_AspectStack(TC_Aspects.METALLUM, 2), new TC_AspectStack(TC_Aspects.LUCRUM, 1))); - public static Materials Sodium = new Materials( 17, TextureSet.SET_METALLIC , 1.0F, 0, 2, 1 |32 , 0, 0, 150, 0, "Sodium" , "Sodium" , 0, 0, 370, 0, false, false, 1, 1, 1, Dyes.dyeBlue , Element.Na , Arrays.asList(new TC_AspectStack(TC_Aspects.VITREUS, 2), new TC_AspectStack(TC_Aspects.LUX, 1))); - public static Materials Strontium = new Materials( 44, TextureSet.SET_METALLIC , 1.0F, 0, 2, 1 |8 |32 , 200, 200, 200, 0, "Strontium" , "Strontium" , 0, 0, 1050, 0, false, false, 1, 1, 1, Dyes.dyeLightGray , Element.Sr , Arrays.asList(new TC_AspectStack(TC_Aspects.METALLUM, 2), new TC_AspectStack(TC_Aspects.STRONTIO, 1))); - public static Materials Sulfur = new Materials( 22, TextureSet.SET_DULL , 1.0F, 0, 2, 1 |8 |32 , 200, 200, 0, 0, "Sulfur" , "Sulfur" , 0, 0, 388, 0, false, false, 2, 1, 1, Dyes.dyeYellow , Element.S , Collections.singletonList(new TC_AspectStack(TC_Aspects.IGNIS, 1))); - public static Materials Tantalum = new Materials( 80, TextureSet.SET_SHINY , 6.0F, 2560, 3, 1|2 |8 |32 , 105, 183, 255, 0, "Tantalum" , "Tantalum" , 0, 0, 3290, 3290, true, false, 4, 1, 1, Dyes._NULL , Element.Ta , Arrays.asList(new TC_AspectStack(TC_Aspects.METALLUM, 2), new TC_AspectStack(TC_Aspects.VINCULUM, 1))).disableAutoGeneratedBlastFurnaceRecipes(); - public static Materials Tellurium = new Materials( 59, TextureSet.SET_DULL , 1.0F, 0, 2, 1|2 |8 |32 , 206, 277, 86, 0, "Tellurium" , "Tellurium" , 0, 0, 722, 0, false, false, 4, 1, 1, Dyes.dyeGray , Element.Te , Arrays.asList(new TC_AspectStack(TC_Aspects.METALLUM, 2), new TC_AspectStack(TC_Aspects.RADIO, 1))); - public static Materials Terbium = new Materials( 72, TextureSet.SET_METALLIC , 1.0F, 0, 2, 1|2 |8 |32 , 255, 255, 255, 0, "Terbium" , "Terbium" , 0, 0, 1629, 1629, true, false, 4, 1, 1, Dyes._NULL , Element.Tb , Arrays.asList(new TC_AspectStack(TC_Aspects.METALLUM, 2), new TC_AspectStack(TC_Aspects.RADIO, 1))); - public static Materials Thorium = new Materials( 96, TextureSet.SET_SHINY , 6.0F, 512, 2, 1|2 |8 |32|64 , 0, 30, 0, 0, "Thorium" , "Thorium" , 0, 0, 2115, 0, false, false, 4, 1, 1, Dyes.dyeBlack , Element.Th , Arrays.asList(new TC_AspectStack(TC_Aspects.METALLUM, 2), new TC_AspectStack(TC_Aspects.RADIO, 1))); - public static Materials Thulium = new Materials( 76, TextureSet.SET_SHINY , 1.0F, 0, 2, 1|2 |8 |32 , 89, 107, 194, 0, "Thulium" , "Thulium" , 0, 0, 1818, 1818, true, false, 4, 1, 1, Dyes._NULL , Element.Tm , Arrays.asList(new TC_AspectStack(TC_Aspects.METALLUM, 2), new TC_AspectStack(TC_Aspects.RADIO, 1))); - public static Materials Tin = new Materials( 57, TextureSet.SET_DULL , 1.0F, 0, 3, 1|2 |8 |32 |128 , 220, 220, 220, 0, "Tin" , "Tin" , 0, 0, 505, 505, false, false, 3, 1, 1, Dyes.dyeWhite , Element.Sn , Arrays.asList(new TC_AspectStack(TC_Aspects.METALLUM, 2), new TC_AspectStack(TC_Aspects.VITREUS, 1))); - public static Materials Titanium = new Materials( 28, TextureSet.SET_METALLIC , 7.0F, 1600, 3, 1|2 |8 |32|64|128 , 220, 160, 240, 0, "Titanium" , "Titanium" , 0, 0, 1941, 1940, true, false, 5, 1, 1, Dyes.dyePurple , Element.Ti , Arrays.asList(new TC_AspectStack(TC_Aspects.METALLUM, 2), new TC_AspectStack(TC_Aspects.TUTAMEN, 1))).disableAutoGeneratedBlastFurnaceRecipes(); - public static Materials Tritanium = new Materials( 329, TextureSet.SET_METALLIC , 20.0F,1435392, 6, 1|2 |64 , 96, 0, 0, 0, "Tritanium" , "Tritanium" , 0, 0, 9900, 9900, true, false, 1, 1, 1, Dyes.dyeWhite , Element.Tn ,Arrays.asList(new TC_AspectStack(TC_Aspects.METALLUM, 2), new TC_AspectStack(TC_Aspects.ORDO, 2))); - public static Materials Tritium = new Materials( 3, TextureSet.SET_METALLIC , 1.0F, 0, 2, 16|32 , 255, 0, 0, 240, "Tritium" , "Tritium" , 0, 0, 14, 0, false, true, 10, 1, 1, Dyes.dyeRed , Element.T , Collections.singletonList(new TC_AspectStack(TC_Aspects.AQUA, 4))); - public static Materials Tungsten = new Materials( 81, TextureSet.SET_METALLIC , 7.0F, 2560, 3, 1|2 |8 |32|64|128 , 50, 50, 50, 0, "Tungsten" , "Tungsten" , 0, 0, 3695, 3000, true, false, 4, 1, 1, Dyes.dyeBlack , Element.W , Arrays.asList(new TC_AspectStack(TC_Aspects.METALLUM, 3), new TC_AspectStack(TC_Aspects.TUTAMEN, 1))).disableAutoGeneratedBlastFurnaceRecipes(); - public static Materials Uranium = new Materials( 98, TextureSet.SET_METALLIC , 6.0F, 512, 3, 1|2 |8 |32|64 , 50, 240, 50, 0, "Uranium" , "Uranium 238" , 0, 0, 1405, 0, false, false, 4, 1, 1, Dyes.dyeGreen , Element.U , Arrays.asList(new TC_AspectStack(TC_Aspects.METALLUM, 2), new TC_AspectStack(TC_Aspects.RADIO, 1))); - public static Materials Uranium235 = new Materials( 97, TextureSet.SET_SHINY , 6.0F, 512, 3, 1|2 |8 |32|64 , 70, 250, 70, 0, "Uranium235" , "Uranium 235" , 0, 0, 1405, 0, false, false, 4, 1, 1, Dyes.dyeGreen , Element.U_235 , Arrays.asList(new TC_AspectStack(TC_Aspects.METALLUM, 2), new TC_AspectStack(TC_Aspects.RADIO, 2))); - public static Materials Vanadium = new Materials( 29, TextureSet.SET_METALLIC , 1.0F, 0, 2, 1|2 |8 |32 , 50, 50, 50, 0, "Vanadium" , "Vanadium" , 0, 0, 2183, 2183, true, false, 2, 1, 1, Dyes.dyeBlack , Element.V , Arrays.asList(new TC_AspectStack(TC_Aspects.METALLUM, 2), new TC_AspectStack(TC_Aspects.RADIO, 1))); - public static Materials Ytterbium = new Materials( 77, TextureSet.SET_SHINY , 1.0F, 0, 2, 1|2 |8 |32 , 44, 199, 80, 0, "Ytterbium" , "Ytterbium" , 0, 0, 1097, 1097, true, false, 4, 1, 1, Dyes._NULL , Element.Yb , Arrays.asList(new TC_AspectStack(TC_Aspects.METALLUM, 2), new TC_AspectStack(TC_Aspects.RADIO, 1))); - public static Materials Yttrium = new Materials( 45, TextureSet.SET_METALLIC , 1.0F, 0, 2, 1|2 |8 |32 , 220, 250, 220, 0, "Yttrium" , "Yttrium" , 0, 0, 1799, 1799, true, false, 4, 1, 1, Dyes._NULL , Element.Y , Arrays.asList(new TC_AspectStack(TC_Aspects.METALLUM, 2), new TC_AspectStack(TC_Aspects.RADIO, 1))); - public static Materials Zinc = new Materials( 36, TextureSet.SET_METALLIC , 1.0F, 0, 1, 1|2 |8 |32 , 250, 240, 240, 0, "Zinc" , "Zinc" , 0, 0, 692, 0, false, false, 2, 1, 1, Dyes.dyeWhite , Element.Zn , Arrays.asList(new TC_AspectStack(TC_Aspects.METALLUM, 2), new TC_AspectStack(TC_Aspects.SANO, 1))); - - //GT++ materials - public static Materials Flerovium = new Materials( 984, TextureSet.SET_SHINY , 1.0F, 0, 0, 1|2 |8 |32|64|128 , 255,255, 255, 0, "Flerovium_GT5U" , "Flerovium" , 0, 0, 0, 0, false, false, 1 , 1, 1, Dyes.dyeWhite , Element.Fl , Arrays.asList(new TC_Aspects.TC_AspectStack(TC_Aspects.METALLUM, 2), new TC_Aspects.TC_AspectStack(TC_Aspects.RADIO, 3))).disableAutoGeneratedBlastFurnaceRecipes(); + public static Materials Aluminium = new Materials( + 19, + TextureSet.SET_DULL, + 10.0F, + 128, + 2, + 1 | 2 | 8 | 32 | 64 | 128, + 128, + 200, + 240, + 0, + "Aluminium", + "Aluminium", + 0, + 0, + 933, + 1700, + true, + false, + 3, + 1, + 1, + Dyes.dyeLightBlue, + Element.Al, + Arrays.asList( + new TC_AspectStack(TC_Aspects.METALLUM, 2), new TC_AspectStack(TC_Aspects.VOLATUS, 1))) + .disableAutoGeneratedBlastFurnaceRecipes(); + + public static Materials Americium = new Materials( + 103, + TextureSet.SET_METALLIC, + 1.0F, + 0, + 3, + 1 | 2 | 8 | 32, + 200, + 200, + 200, + 0, + "Americium", + "Americium", + 0, + 0, + 1449, + 0, + false, + false, + 3, + 1, + 1, + Dyes.dyeLightGray, + Element.Am, + Arrays.asList(new TC_AspectStack(TC_Aspects.METALLUM, 2), new TC_AspectStack(TC_Aspects.RADIO, 1))); + public static Materials Antimony = new Materials( + 58, + TextureSet.SET_SHINY, + 1.0F, + 0, + 2, + 1 | 2 | 8 | 32, + 220, + 220, + 240, + 0, + "Antimony", + "Antimony", + 0, + 0, + 903, + 0, + false, + false, + 2, + 1, + 1, + Dyes.dyeLightGray, + Element.Sb, + Arrays.asList(new TC_AspectStack(TC_Aspects.METALLUM, 2), new TC_AspectStack(TC_Aspects.AQUA, 1))); + public static Materials Argon = new Materials( + 24, + TextureSet.SET_FLUID, + 1.0F, + 0, + 2, + 16 | 32, + 0, + 255, + 0, + 240, + "Argon", + "Argon", + 0, + 0, + 83, + 0, + false, + true, + 5, + 1, + 1, + Dyes.dyeGreen, + Element.Ar, + Collections.singletonList(new TC_AspectStack(TC_Aspects.AER, 2))); + public static Materials Arsenic = new Materials( + 39, + TextureSet.SET_DULL, + 1.0F, + 0, + 2, + 1 | 2 | 8 | 16 | 32, + 255, + 255, + 255, + 0, + "Arsenic", + "Arsenic", + 0, + 0, + 1090, + 0, + false, + false, + 3, + 1, + 1, + Dyes.dyeOrange, + Element.As, + Collections.singletonList(new TC_AspectStack(TC_Aspects.VENENUM, 3))); + public static Materials Barium = new Materials( + 63, + TextureSet.SET_METALLIC, + 1.0F, + 0, + 2, + 1 | 2 | 8 | 32, + 255, + 255, + 255, + 0, + "Barium", + "Barium", + 0, + 0, + 1000, + 0, + false, + false, + 1, + 1, + 1, + Dyes._NULL, + Element.Ba, + Collections.singletonList(new TC_AspectStack(TC_Aspects.VINCULUM, 3))); + public static Materials Beryllium = new Materials( + 8, + TextureSet.SET_METALLIC, + 14.0F, + 64, + 2, + 1 | 2 | 8 | 32 | 64, + 100, + 180, + 100, + 0, + "Beryllium", + "Beryllium", + 0, + 0, + 1560, + 0, + false, + false, + 6, + 1, + 1, + Dyes.dyeGreen, + Element.Be, + Arrays.asList(new TC_AspectStack(TC_Aspects.METALLUM, 2), new TC_AspectStack(TC_Aspects.LUCRUM, 1))); + public static Materials Bismuth = new Materials( + 90, + TextureSet.SET_METALLIC, + 6.0F, + 64, + 1, + 1 | 2 | 8 | 32 | 64 | 128, + 100, + 160, + 160, + 0, + "Bismuth", + "Bismuth", + 0, + 0, + 544, + 0, + false, + false, + 2, + 1, + 1, + Dyes.dyeCyan, + Element.Bi, + Arrays.asList(new TC_AspectStack(TC_Aspects.METALLUM, 2), new TC_AspectStack(TC_Aspects.INSTRUMENTUM, 1))); + public static Materials Boron = new Materials( + 9, + TextureSet.SET_DULL, + 1.0F, + 0, + 2, + 1 | 32, + 210, + 250, + 210, + 0, + "Boron", + "Boron", + 0, + 0, + 2349, + 0, + false, + false, + 1, + 1, + 1, + Dyes.dyeWhite, + Element.B, + Collections.singletonList(new TC_AspectStack(TC_Aspects.VITREUS, 3))); + public static Materials Caesium = new Materials( + 62, + TextureSet.SET_METALLIC, + 1.0F, + 0, + 2, + 1 | 2 | 8 | 32, + 176, + 196, + 222, + 0, + "Caesium", + "Caesium", + 0, + 0, + 301, + 0, + false, + false, + 4, + 1, + 1, + Dyes._NULL, + Element.Cs, + Arrays.asList(new TC_AspectStack(TC_Aspects.METALLUM, 2), new TC_AspectStack(TC_Aspects.RADIO, 1))); + public static Materials Calcium = new Materials( + 26, + TextureSet.SET_METALLIC, + 1.0F, + 0, + 2, + 1 | 32, + 255, + 245, + 245, + 0, + "Calcium", + "Calcium", + 0, + 0, + 1115, + 1115, + true, + false, + 4, + 1, + 1, + Dyes.dyePink, + Element.Ca, + Arrays.asList(new TC_AspectStack(TC_Aspects.SANO, 1), new TC_AspectStack(TC_Aspects.TUTAMEN, 1))); + public static Materials Carbon = new Materials( + 10, + TextureSet.SET_DULL, + 1.0F, + 64, + 2, + 1 | 2 | 16 | 32 | 64 | 128, + 20, + 20, + 20, + 0, + "Carbon", + "Carbon", + 0, + 0, + 3800, + 0, + false, + false, + 2, + 1, + 1, + Dyes.dyeBlack, + Element.C, + Arrays.asList( + new TC_Aspects.TC_AspectStack(TC_Aspects.VITREUS, 1), new TC_AspectStack(TC_Aspects.IGNIS, 1))); + public static Materials Cadmium = new Materials( + 55, + TextureSet.SET_SHINY, + 1.0F, + 0, + 2, + 1 | 8 | 32, + 50, + 50, + 60, + 0, + "Cadmium", + "Cadmium", + 0, + 0, + 594, + 0, + false, + false, + 3, + 1, + 1, + Dyes.dyeGray, + Element.Cd, + Arrays.asList( + new TC_AspectStack(TC_Aspects.METALLUM, 1), + new TC_AspectStack(TC_Aspects.POTENTIA, 1), + new TC_AspectStack(TC_Aspects.VENENUM, 1))); + public static Materials Cerium = new Materials( + 65, + TextureSet.SET_METALLIC, + 1.0F, + 0, + 2, + 1 | 2 | 8 | 32, + 123, + 212, + 144, + 0, + "Cerium", + "Cerium", + 0, + 0, + 1068, + 1068, + true, + false, + 4, + 1, + 1, + Dyes._NULL, + Element.Ce, + Arrays.asList(new TC_AspectStack(TC_Aspects.METALLUM, 2), new TC_AspectStack(TC_Aspects.RADIO, 1))); + public static Materials Chlorine = new Materials( + 23, + TextureSet.SET_FLUID, + 1.0F, + 0, + 2, + 16 | 32, + 255, + 255, + 255, + 0, + "Chlorine", + "Chlorine", + 0, + 0, + 171, + 0, + false, + false, + 2, + 1, + 1, + Dyes.dyeCyan, + Element.Cl, + Arrays.asList(new TC_AspectStack(TC_Aspects.AQUA, 2), new TC_AspectStack(TC_Aspects.PANNUS, 1))); + public static Materials Chrome = new Materials( + 30, + TextureSet.SET_SHINY, + 11.0F, + 256, + 3, + 1 | 2 | 8 | 32 | 64 | 128, + 255, + 230, + 230, + 0, + "Chrome", + "Chrome", + 0, + 0, + 2180, + 1700, + true, + false, + 5, + 1, + 1, + Dyes.dyePink, + Element.Cr, + Arrays.asList(new TC_AspectStack(TC_Aspects.METALLUM, 2), new TC_AspectStack(TC_Aspects.MACHINA, 1))); + public static Materials Cobalt = new Materials( + 33, + TextureSet.SET_METALLIC, + 8.0F, + 512, + 3, + 1 | 2 | 8 | 32 | 64 | 128, + 80, + 80, + 250, + 0, + "Cobalt", + "Cobalt", + 0, + 0, + 1768, + 1700, + true, + false, + 3, + 1, + 1, + Dyes.dyeBlue, + Element.Co, + Arrays.asList( + new TC_AspectStack(TC_Aspects.METALLUM, 2), new TC_AspectStack(TC_Aspects.INSTRUMENTUM, 1))) + .disableAutoGeneratedBlastFurnaceRecipes(); + public static Materials Copper = new Materials( + 35, + TextureSet.SET_DULL, + 1.0F, + 0, + 1, + 1 | 2 | 8 | 32 | 128, + 255, + 100, + 0, + 0, + "Copper", + "Copper", + 0, + 0, + 1357, + 0, + false, + false, + 3, + 1, + 1, + Dyes.dyeOrange, + Element.Cu, + Arrays.asList(new TC_AspectStack(TC_Aspects.METALLUM, 2), new TC_AspectStack(TC_Aspects.PERMUTATIO, 1))); + public static Materials Deuterium = new Materials( + 2, + TextureSet.SET_FLUID, + 1.0F, + 0, + 2, + 16 | 32, + 255, + 255, + 0, + 240, + "Deuterium", + "Deuterium", + 0, + 0, + 14, + 0, + false, + true, + 10, + 1, + 1, + Dyes.dyeYellow, + Element.D, + Collections.singletonList(new TC_AspectStack(TC_Aspects.AQUA, 3))); + public static Materials Dysprosium = new Materials( + 73, + TextureSet.SET_METALLIC, + 1.0F, + 0, + 2, + 1 | 2 | 8 | 32, + 105, + 209, + 80, + 0, + "Dysprosium", + "Dysprosium", + 0, + 0, + 1680, + 1680, + true, + false, + 4, + 1, + 1, + Dyes._NULL, + Element.Dy, + Collections.singletonList(new TC_AspectStack(TC_Aspects.METALLUM, 3))); + public static Materials Empty = new Materials( + 0, + TextureSet.SET_NONE, + 1.0F, + 0, + 2, + 256 /*Only when needed*/, + 255, + 255, + 255, + 255, + "Empty", + "Empty", + 0, + 0, + -1, + 0, + false, + true, + 1, + 1, + 1, + Dyes._NULL, + Element._NULL, + Collections.singletonList(new TC_AspectStack(TC_Aspects.VACUOS, 2))); + public static Materials Erbium = new Materials( + 75, + TextureSet.SET_SHINY, + 1.0F, + 0, + 2, + 1 | 2 | 8 | 32, + 176, + 152, + 81, + 0, + "Erbium", + "Erbium", + 0, + 0, + 1802, + 1802, + true, + false, + 4, + 1, + 1, + Dyes._NULL, + Element.Er, + Arrays.asList(new TC_AspectStack(TC_Aspects.METALLUM, 2), new TC_AspectStack(TC_Aspects.RADIO, 1))); + public static Materials Europium = new Materials( + 70, + TextureSet.SET_SHINY, + 1.0F, + 0, + 2, + 1 | 2 | 8 | 32, + 246, + 181, + 255, + 0, + "Europium", + "Europium", + 0, + 0, + 1099, + 1099, + true, + false, + 4, + 1, + 1, + Dyes._NULL, + Element.Eu, + Arrays.asList(new TC_AspectStack(TC_Aspects.METALLUM, 2), new TC_AspectStack(TC_Aspects.RADIO, 1))); + public static Materials Fluorine = new Materials( + 14, + TextureSet.SET_FLUID, + 1.0F, + 0, + 2, + 16 | 32, + 255, + 255, + 255, + 127, + "Fluorine", + "Fluorine", + 0, + 0, + 53, + 0, + false, + true, + 2, + 1, + 1, + Dyes.dyeGreen, + Element.F, + Collections.singletonList(new TC_AspectStack(TC_Aspects.PERDITIO, 2))); + public static Materials Gadolinium = new Materials( + 71, + TextureSet.SET_METALLIC, + 1.0F, + 0, + 2, + 1 | 2 | 8 | 32, + 59, + 186, + 28, + 0, + "Gadolinium", + "Gadolinium", + 0, + 0, + 1585, + 1585, + true, + false, + 4, + 1, + 1, + Dyes._NULL, + Element.Gd, + Arrays.asList(new TC_AspectStack(TC_Aspects.METALLUM, 2), new TC_AspectStack(TC_Aspects.RADIO, 1))); + public static Materials Gallium = new Materials( + 37, + TextureSet.SET_SHINY, + 1.0F, + 64, + 2, + 1 | 2 | 8 | 32, + 220, + 220, + 255, + 0, + "Gallium", + "Gallium", + 0, + 0, + 302, + 0, + false, + false, + 5, + 1, + 1, + Dyes.dyeLightGray, + Element.Ga, + Arrays.asList(new TC_AspectStack(TC_Aspects.METALLUM, 2), new TC_AspectStack(TC_Aspects.ELECTRUM, 1))); + public static Materials Gold = new Materials( + 86, + TextureSet.SET_SHINY, + 12.0F, + 64, + 2, + 1 | 2 | 8 | 32 | 64 | 128, + 255, + 255, + 30, + 0, + "Gold", + "Gold", + 0, + 0, + 1337, + 0, + false, + false, + 4, + 1, + 1, + Dyes.dyeYellow, + Element.Au, + Arrays.asList(new TC_AspectStack(TC_Aspects.METALLUM, 2), new TC_AspectStack(TC_Aspects.LUCRUM, 2))); + public static Materials Holmium = new Materials( + 74, + TextureSet.SET_SHINY, + 1.0F, + 0, + 2, + 1 | 2 | 8 | 32, + 22, + 8, + 166, + 0, + "Holmium", + "Holmium", + 0, + 0, + 1734, + 1734, + true, + false, + 4, + 1, + 1, + Dyes._NULL, + Element.Ho, + Arrays.asList(new TC_AspectStack(TC_Aspects.METALLUM, 2), new TC_AspectStack(TC_Aspects.RADIO, 1))); + public static Materials Hydrogen = new Materials( + 1, + TextureSet.SET_FLUID, + 1.0F, + 0, + 2, + 16 | 32, + 0, + 0, + 255, + 240, + "Hydrogen", + "Hydrogen", + 1, + 20, + 14, + 0, + false, + true, + 2, + 1, + 1, + Dyes.dyeBlue, + Element.H, + Collections.singletonList(new TC_AspectStack(TC_Aspects.AQUA, 1))); + public static Materials Helium = new Materials( + 4, + TextureSet.SET_FLUID, + 1.0F, + 0, + 2, + 16 | 32, + 255, + 255, + 0, + 240, + "Helium", + "Helium", + 0, + 0, + 1, + 0, + false, + true, + 5, + 1, + 1, + Dyes.dyeYellow, + Element.He, + Collections.singletonList(new TC_AspectStack(TC_Aspects.AER, 2))); + public static Materials Helium_3 = new Materials( + 5, + TextureSet.SET_FLUID, + 1.0F, + 0, + 2, + 16 | 32, + 255, + 255, + 0, + 240, + "Helium_3", + "Helium-3", + 0, + 0, + 1, + 0, + false, + true, + 10, + 1, + 1, + Dyes.dyeYellow, + Element.He_3, + Collections.singletonList(new TC_AspectStack(TC_Aspects.AER, 3))); + public static Materials Indium = new Materials( + 56, + TextureSet.SET_METALLIC, + 1.0F, + 0, + 2, + 1 | 2 | 8 | 32, + 64, + 0, + 128, + 0, + "Indium", + "Indium", + 0, + 0, + 429, + 0, + false, + false, + 4, + 1, + 1, + Dyes.dyeGray, + Element.In, + Arrays.asList(new TC_AspectStack(TC_Aspects.METALLUM, 2), new TC_AspectStack(TC_Aspects.RADIO, 1))); + public static Materials Iridium = new Materials( + 84, + TextureSet.SET_DULL, + 6.0F, + 2560, + 3, + 1 | 2 | 8 | 32 | 64 | 128, + 240, + 240, + 245, + 0, + "Iridium", + "Iridium", + 0, + 0, + 2719, + 4500, + true, + false, + 10, + 1, + 1, + Dyes.dyeWhite, + Element.Ir, + Arrays.asList( + new TC_AspectStack(TC_Aspects.METALLUM, 2), new TC_AspectStack(TC_Aspects.MACHINA, 1))) + .disableAutoGeneratedBlastFurnaceRecipes(); + public static Materials Iron = new Materials( + 32, + TextureSet.SET_METALLIC, + 6.0F, + 256, + 2, + 1 | 2 | 8 | 32 | 64 | 128, + 200, + 200, + 200, + 0, + "Iron", + "Iron", + 0, + 0, + 1811, + 0, + false, + false, + 3, + 1, + 1, + Dyes.dyeLightGray, + Element.Fe, + Collections.singletonList(new TC_AspectStack(TC_Aspects.METALLUM, 3))); + public static Materials Lanthanum = new Materials( + 64, + TextureSet.SET_METALLIC, + 1.0F, + 0, + 2, + 1 | 2 | 8 | 32, + 138, + 138, + 138, + 0, + "Lanthanum", + "Lanthanum", + 0, + 0, + 1193, + 1193, + true, + false, + 4, + 1, + 1, + Dyes._NULL, + Element.La, + Arrays.asList(new TC_AspectStack(TC_Aspects.METALLUM, 2), new TC_AspectStack(TC_Aspects.RADIO, 1))); + public static Materials Lead = new Materials( + 89, + TextureSet.SET_DULL, + 8.0F, + 64, + 1, + 1 | 2 | 8 | 32 | 64 | 128, + 140, + 100, + 140, + 0, + "Lead", + "Lead", + 0, + 0, + 600, + 0, + false, + false, + 3, + 1, + 1, + Dyes.dyePurple, + Element.Pb, + Arrays.asList(new TC_AspectStack(TC_Aspects.METALLUM, 2), new TC_AspectStack(TC_Aspects.ORDO, 1))); + public static Materials Lithium = new Materials( + 6, + TextureSet.SET_DULL, + 1.0F, + 0, + 2, + 1 | 2 | 8 | 32, + 225, + 220, + 255, + 0, + "Lithium", + "Lithium", + 0, + 0, + 454, + 0, + false, + false, + 4, + 1, + 1, + Dyes.dyeLightBlue, + Element.Li, + Arrays.asList(new TC_AspectStack(TC_Aspects.VITREUS, 1), new TC_AspectStack(TC_Aspects.POTENTIA, 2))); + public static Materials Lutetium = new Materials( + 78, + TextureSet.SET_SHINY, + 1.0F, + 0, + 2, + 1 | 2 | 8 | 32, + 188, + 62, + 199, + 0, + "Lutetium", + "Lutetium", + 0, + 0, + 1925, + 1925, + true, + false, + 4, + 1, + 1, + Dyes._NULL, + Element.Lu, + Arrays.asList(new TC_AspectStack(TC_Aspects.METALLUM, 2), new TC_AspectStack(TC_Aspects.RADIO, 1))); + public static Materials Magic = new Materials( + -128, + TextureSet.SET_SHINY, + 8.0F, + 5120, + 5, + 1 | 2 | 4 | 8 | 16 | 32 | 64 | 128, + 100, + 0, + 200, + 0, + "Magic", + "Magic", + 5, + 32, + 5000, + 0, + false, + false, + 7, + 1, + 1, + Dyes.dyePurple, + Element.Ma, + Collections.singletonList(new TC_AspectStack(TC_Aspects.PRAECANTATIO, 4))); + public static Materials Magnesium = new Materials( + 18, + TextureSet.SET_METALLIC, + 1.0F, + 0, + 2, + 1 | 2 | 8 | 32, + 255, + 200, + 200, + 0, + "Magnesium", + "Magnesium", + 0, + 0, + 923, + 0, + false, + false, + 3, + 1, + 1, + Dyes.dyePink, + Element.Mg, + Arrays.asList(new TC_AspectStack(TC_Aspects.METALLUM, 2), new TC_AspectStack(TC_Aspects.SANO, 1))); + public static Materials Manganese = new Materials( + 31, + TextureSet.SET_DULL, + 7.0F, + 512, + 2, + 1 | 2 | 8 | 32 | 64, + 250, + 250, + 250, + 0, + "Manganese", + "Manganese", + 0, + 0, + 1519, + 0, + false, + false, + 3, + 1, + 1, + Dyes.dyeWhite, + Element.Mn, + Collections.singletonList(new TC_AspectStack(TC_Aspects.METALLUM, 3))); + public static Materials Mercury = new Materials( + 87, + TextureSet.SET_SHINY, + 1.0F, + 0, + 0, + 16 | 32, + 255, + 220, + 220, + 0, + "Mercury", + "Mercury", + 5, + 32, + 234, + 0, + false, + false, + 3, + 1, + 1, + Dyes.dyeLightGray, + Element.Hg, + Arrays.asList( + new TC_AspectStack(TC_Aspects.METALLUM, 1), + new TC_AspectStack(TC_Aspects.AQUA, 1), + new TC_AspectStack(TC_Aspects.VENENUM, 1))); + public static Materials Molybdenum = new Materials( + 48, + TextureSet.SET_SHINY, + 7.0F, + 512, + 2, + 1 | 2 | 8 | 32 | 64, + 180, + 180, + 220, + 0, + "Molybdenum", + "Molybdenum", + 0, + 0, + 2896, + 0, + false, + false, + 1, + 1, + 1, + Dyes.dyeBlue, + Element.Mo, + Arrays.asList(new TC_AspectStack(TC_Aspects.METALLUM, 2), new TC_AspectStack(TC_Aspects.INSTRUMENTUM, 1))); + public static Materials Neodymium = new Materials( + 67, + TextureSet.SET_METALLIC, + 7.0F, + 512, + 2, + 1 | 2 | 8 | 32 | 64 | 128, + 100, + 100, + 100, + 0, + "Neodymium", + "Neodymium", + 0, + 0, + 1297, + 1297, + true, + false, + 4, + 1, + 1, + Dyes._NULL, + Element.Nd, + Arrays.asList(new TC_AspectStack(TC_Aspects.METALLUM, 2), new TC_AspectStack(TC_Aspects.MAGNETO, 2))); + public static Materials Neutronium = new Materials( + 129, + TextureSet.SET_DULL, + 24.0F, + 655360, + 6, + 1 | 2 | 8 | 32 | 64 | 128, + 250, + 250, + 250, + 0, + "Neutronium", + "Neutronium", + 0, + 0, + 10000, + 10000, + true, + false, + 20, + 1, + 1, + Dyes.dyeWhite, + Element.Nt, + Arrays.asList( + new TC_AspectStack(TC_Aspects.METALLUM, 4), + new TC_AspectStack(TC_Aspects.VITREUS, 3), + new TC_AspectStack(TC_Aspects.ALIENIS, 2))) + .disableAutoGeneratedBlastFurnaceRecipes(); + public static Materials Nickel = new Materials( + 34, + TextureSet.SET_METALLIC, + 6.0F, + 64, + 2, + 1 | 2 | 8 | 32 | 64 | 128, + 200, + 200, + 250, + 0, + "Nickel", + "Nickel", + 0, + 0, + 1728, + 0, + false, + false, + 4, + 1, + 1, + Dyes.dyeLightBlue, + Element.Ni, + Arrays.asList(new TC_AspectStack(TC_Aspects.METALLUM, 2), new TC_AspectStack(TC_Aspects.IGNIS, 1))); + public static Materials Niobium = new Materials( + 47, + TextureSet.SET_METALLIC, + 1.0F, + 0, + 2, + 1 | 2 | 8 | 32, + 190, + 180, + 200, + 0, + "Niobium", + "Niobium", + 0, + 0, + 2750, + 2750, + true, + false, + 5, + 1, + 1, + Dyes._NULL, + Element.Nb, + Arrays.asList(new TC_AspectStack(TC_Aspects.METALLUM, 2), new TC_AspectStack(TC_Aspects.ELECTRUM, 1))); + public static Materials Nitrogen = new Materials( + 12, + TextureSet.SET_FLUID, + 1.0F, + 0, + 2, + 16 | 32, + 0, + 150, + 200, + 240, + "Nitrogen", + "Nitrogen", + 0, + 0, + 63, + 0, + false, + true, + 2, + 1, + 1, + Dyes.dyeCyan, + Element.N, + Collections.singletonList(new TC_AspectStack(TC_Aspects.AER, 2))); + public static Materials Osmium = new Materials( + 83, + TextureSet.SET_METALLIC, + 16.0F, + 1280, + 4, + 1 | 2 | 8 | 32 | 64 | 128, + 50, + 50, + 255, + 0, + "Osmium", + "Osmium", + 0, + 0, + 3306, + 4500, + true, + false, + 10, + 1, + 1, + Dyes.dyeBlue, + Element.Os, + Arrays.asList( + new TC_AspectStack(TC_Aspects.METALLUM, 2), + new TC_AspectStack(TC_Aspects.MACHINA, 1), + new TC_AspectStack(TC_Aspects.NEBRISUM, 1))) + .disableAutoGeneratedBlastFurnaceRecipes(); + public static Materials Oxygen = new Materials( + 13, + TextureSet.SET_FLUID, + 1.0F, + 0, + 2, + 16 | 32, + 0, + 100, + 200, + 240, + "Oxygen", + "Oxygen", + 0, + 0, + 54, + 0, + false, + true, + 1, + 1, + 1, + Dyes.dyeWhite, + Element.O, + Collections.singletonList(new TC_AspectStack(TC_Aspects.AER, 1))); + public static Materials Palladium = new Materials( + 52, + TextureSet.SET_SHINY, + 8.0F, + 512, + 4, + 1 | 2 | 8 | 32 | 64 | 128, + 128, + 128, + 128, + 0, + "Palladium", + "Palladium", + 0, + 0, + 1828, + 1828, + true, + false, + 4, + 1, + 1, + Dyes.dyeGray, + Element.Pd, + Collections.singletonList(new TC_AspectStack(TC_Aspects.METALLUM, 3))); + public static Materials Phosphorus = new Materials( + 21, + TextureSet.SET_DULL, + 1.0F, + 0, + 2, + 1 | 32, + 255, + 255, + 0, + 0, + "Phosphorus", + "Phosphorus", + 0, + 0, + 317, + 0, + false, + false, + 2, + 1, + 1, + Dyes.dyeYellow, + Element.P, + Arrays.asList( + new TC_Aspects.TC_AspectStack(TC_Aspects.IGNIS, 2), new TC_AspectStack(TC_Aspects.POTENTIA, 1))); + public static Materials Platinum = new Materials( + 85, + TextureSet.SET_SHINY, + 12.0F, + 64, + 4, + 1 | 2 | 8 | 32 | 64 | 128, + 255, + 255, + 200, + 0, + "Platinum", + "Platinum", + 0, + 0, + 2041, + 0, + false, + false, + 6, + 1, + 1, + Dyes.dyeOrange, + Element.Pt, + Arrays.asList(new TC_AspectStack(TC_Aspects.METALLUM, 2), new TC_AspectStack(TC_Aspects.NEBRISUM, 1))); + public static Materials Plutonium = new Materials( + 100, + TextureSet.SET_METALLIC, + 6.0F, + 512, + 3, + 1 | 2 | 8 | 32 | 64, + 240, + 50, + 50, + 0, + "Plutonium", + "Plutonium 239", + 0, + 0, + 912, + 0, + false, + false, + 6, + 1, + 1, + Dyes.dyeLime, + Element.Pu, + Arrays.asList(new TC_AspectStack(TC_Aspects.METALLUM, 2), new TC_AspectStack(TC_Aspects.RADIO, 2))); + public static Materials Plutonium241 = new Materials( + 101, + TextureSet.SET_SHINY, + 6.0F, + 512, + 3, + 1 | 2 | 8 | 32 | 64, + 250, + 70, + 70, + 0, + "Plutonium241", + "Plutonium 241", + 0, + 0, + 912, + 0, + false, + false, + 6, + 1, + 1, + Dyes.dyeLime, + Element.Pu_241, + Arrays.asList(new TC_AspectStack(TC_Aspects.METALLUM, 2), new TC_AspectStack(TC_Aspects.RADIO, 3))); + public static Materials Potassium = new Materials( + 25, + TextureSet.SET_METALLIC, + 1.0F, + 0, + 1, + 1 | 2 | 32, + 154, + 172, + 223, + 0, + "Potassium", + "Potassium", + 0, + 0, + 336, + 0, + false, + false, + 2, + 1, + 1, + Dyes.dyeWhite, + Element.K, + Arrays.asList(new TC_AspectStack(TC_Aspects.VITREUS, 1), new TC_AspectStack(TC_Aspects.POTENTIA, 1))); + public static Materials Praseodymium = new Materials( + 66, + TextureSet.SET_DULL, + 1.0F, + 0, + 2, + 1 | 2 | 8 | 32, + 117, + 214, + 129, + 0, + "Praseodymium", + "Praseodymium", + 0, + 0, + 1208, + 1208, + true, + false, + 4, + 1, + 1, + Dyes._NULL, + Element.Pr, + Arrays.asList(new TC_AspectStack(TC_Aspects.METALLUM, 2), new TC_AspectStack(TC_Aspects.RADIO, 1))); + public static Materials Promethium = new Materials( + 68, + TextureSet.SET_SHINY, + 1.0F, + 0, + 2, + 1 | 2 | 8 | 32, + 36, + 181, + 53, + 0, + "Promethium", + "Promethium", + 0, + 0, + 1315, + 1315, + true, + false, + 4, + 1, + 1, + Dyes._NULL, + Element.Pm, + Arrays.asList(new TC_AspectStack(TC_Aspects.METALLUM, 2), new TC_AspectStack(TC_Aspects.RADIO, 1))); + public static Materials Radon = new Materials( + 93, + TextureSet.SET_FLUID, + 1.0F, + 0, + 2, + 16 | 32, + 255, + 0, + 255, + 240, + "Radon", + "Radon", + 0, + 0, + 202, + 0, + false, + true, + 5, + 1, + 1, + Dyes.dyePurple, + Element.Rn, + Arrays.asList(new TC_AspectStack(TC_Aspects.AER, 1), new TC_AspectStack(TC_Aspects.RADIO, 1))); + public static Materials Rubidium = new Materials( + 43, + TextureSet.SET_METALLIC, + 1.0F, + 0, + 2, + 1 | 2 | 8 | 32, + 240, + 30, + 30, + 0, + "Rubidium", + "Rubidium", + 0, + 0, + 312, + 0, + false, + false, + 4, + 1, + 1, + Dyes.dyeRed, + Element.Rb, + Arrays.asList(new TC_AspectStack(TC_Aspects.METALLUM, 2), new TC_AspectStack(TC_Aspects.VITREUS, 1))); + public static Materials Samarium = new Materials( + 69, + TextureSet.SET_METALLIC, + 1.0F, + 0, + 2, + 1 | 2 | 8 | 32, + 255, + 255, + 204, + 0, + "Samarium", + "Samarium", + 0, + 0, + 1345, + 1345, + true, + false, + 4, + 1, + 1, + Dyes.dyeWhite, + Element.Sm, + Arrays.asList( + new TC_AspectStack(TC_Aspects.METALLUM, 2), + new TC_AspectStack(TC_Aspects.RADIO, 1), + new TC_AspectStack(TC_Aspects.MAGNETO, 10))); + public static Materials Scandium = new Materials( + 27, + TextureSet.SET_METALLIC, + 1.0F, + 0, + 2, + 1 | 2 | 8 | 32, + 204, + 204, + 204, + 0, + "Scandium", + "Scandium", + 0, + 0, + 1814, + 1814, + true, + false, + 2, + 1, + 1, + Dyes.dyeYellow, + Element.Sc, + Arrays.asList(new TC_AspectStack(TC_Aspects.METALLUM, 2), new TC_AspectStack(TC_Aspects.RADIO, 1))); + public static Materials Silicon = new Materials( + 20, + TextureSet.SET_METALLIC, + 1.0F, + 0, + 2, + 1 | 2 | 8 | 32, + 60, + 60, + 80, + 0, + "Silicon", + "Raw Silicon", + 0, + 0, + 2273, + 2273, + true, + false, + 1, + 1, + 1, + Dyes.dyeBlack, + Element.Si, + Arrays.asList(new TC_AspectStack(TC_Aspects.METALLUM, 2), new TC_AspectStack(TC_Aspects.TENEBRAE, 1))); + public static Materials Silver = new Materials( + 54, + TextureSet.SET_SHINY, + 10.0F, + 64, + 2, + 1 | 2 | 8 | 32 | 64 | 128, + 220, + 220, + 255, + 0, + "Silver", + "Silver", + 0, + 0, + 1234, + 0, + false, + false, + 3, + 1, + 1, + Dyes.dyeLightGray, + Element.Ag, + Arrays.asList(new TC_AspectStack(TC_Aspects.METALLUM, 2), new TC_AspectStack(TC_Aspects.LUCRUM, 1))); + public static Materials Sodium = new Materials( + 17, + TextureSet.SET_METALLIC, + 1.0F, + 0, + 2, + 1 | 32, + 0, + 0, + 150, + 0, + "Sodium", + "Sodium", + 0, + 0, + 370, + 0, + false, + false, + 1, + 1, + 1, + Dyes.dyeBlue, + Element.Na, + Arrays.asList(new TC_AspectStack(TC_Aspects.VITREUS, 2), new TC_AspectStack(TC_Aspects.LUX, 1))); + public static Materials Strontium = new Materials( + 44, + TextureSet.SET_METALLIC, + 1.0F, + 0, + 2, + 1 | 8 | 32, + 200, + 200, + 200, + 0, + "Strontium", + "Strontium", + 0, + 0, + 1050, + 0, + false, + false, + 1, + 1, + 1, + Dyes.dyeLightGray, + Element.Sr, + Arrays.asList(new TC_AspectStack(TC_Aspects.METALLUM, 2), new TC_AspectStack(TC_Aspects.STRONTIO, 1))); + public static Materials Sulfur = new Materials( + 22, + TextureSet.SET_DULL, + 1.0F, + 0, + 2, + 1 | 8 | 32, + 200, + 200, + 0, + 0, + "Sulfur", + "Sulfur", + 0, + 0, + 388, + 0, + false, + false, + 2, + 1, + 1, + Dyes.dyeYellow, + Element.S, + Collections.singletonList(new TC_AspectStack(TC_Aspects.IGNIS, 1))); + public static Materials Tantalum = new Materials( + 80, + TextureSet.SET_SHINY, + 6.0F, + 2560, + 3, + 1 | 2 | 8 | 32, + 105, + 183, + 255, + 0, + "Tantalum", + "Tantalum", + 0, + 0, + 3290, + 3290, + true, + false, + 4, + 1, + 1, + Dyes._NULL, + Element.Ta, + Arrays.asList( + new TC_AspectStack(TC_Aspects.METALLUM, 2), new TC_AspectStack(TC_Aspects.VINCULUM, 1))) + .disableAutoGeneratedBlastFurnaceRecipes(); + public static Materials Tellurium = new Materials( + 59, + TextureSet.SET_DULL, + 1.0F, + 0, + 2, + 1 | 2 | 8 | 32, + 206, + 277, + 86, + 0, + "Tellurium", + "Tellurium", + 0, + 0, + 722, + 0, + false, + false, + 4, + 1, + 1, + Dyes.dyeGray, + Element.Te, + Arrays.asList(new TC_AspectStack(TC_Aspects.METALLUM, 2), new TC_AspectStack(TC_Aspects.RADIO, 1))); + public static Materials Terbium = new Materials( + 72, + TextureSet.SET_METALLIC, + 1.0F, + 0, + 2, + 1 | 2 | 8 | 32, + 255, + 255, + 255, + 0, + "Terbium", + "Terbium", + 0, + 0, + 1629, + 1629, + true, + false, + 4, + 1, + 1, + Dyes._NULL, + Element.Tb, + Arrays.asList(new TC_AspectStack(TC_Aspects.METALLUM, 2), new TC_AspectStack(TC_Aspects.RADIO, 1))); + public static Materials Thorium = new Materials( + 96, + TextureSet.SET_SHINY, + 6.0F, + 512, + 2, + 1 | 2 | 8 | 32 | 64, + 0, + 30, + 0, + 0, + "Thorium", + "Thorium", + 0, + 0, + 2115, + 0, + false, + false, + 4, + 1, + 1, + Dyes.dyeBlack, + Element.Th, + Arrays.asList(new TC_AspectStack(TC_Aspects.METALLUM, 2), new TC_AspectStack(TC_Aspects.RADIO, 1))); + public static Materials Thulium = new Materials( + 76, + TextureSet.SET_SHINY, + 1.0F, + 0, + 2, + 1 | 2 | 8 | 32, + 89, + 107, + 194, + 0, + "Thulium", + "Thulium", + 0, + 0, + 1818, + 1818, + true, + false, + 4, + 1, + 1, + Dyes._NULL, + Element.Tm, + Arrays.asList(new TC_AspectStack(TC_Aspects.METALLUM, 2), new TC_AspectStack(TC_Aspects.RADIO, 1))); + public static Materials Tin = new Materials( + 57, + TextureSet.SET_DULL, + 1.0F, + 0, + 3, + 1 | 2 | 8 | 32 | 128, + 220, + 220, + 220, + 0, + "Tin", + "Tin", + 0, + 0, + 505, + 505, + false, + false, + 3, + 1, + 1, + Dyes.dyeWhite, + Element.Sn, + Arrays.asList(new TC_AspectStack(TC_Aspects.METALLUM, 2), new TC_AspectStack(TC_Aspects.VITREUS, 1))); + public static Materials Titanium = new Materials( + 28, + TextureSet.SET_METALLIC, + 7.0F, + 1600, + 3, + 1 | 2 | 8 | 32 | 64 | 128, + 220, + 160, + 240, + 0, + "Titanium", + "Titanium", + 0, + 0, + 1941, + 1940, + true, + false, + 5, + 1, + 1, + Dyes.dyePurple, + Element.Ti, + Arrays.asList( + new TC_AspectStack(TC_Aspects.METALLUM, 2), new TC_AspectStack(TC_Aspects.TUTAMEN, 1))) + .disableAutoGeneratedBlastFurnaceRecipes(); + public static Materials Tritanium = new Materials( + 329, + TextureSet.SET_METALLIC, + 20.0F, + 1435392, + 6, + 1 | 2 | 64, + 96, + 0, + 0, + 0, + "Tritanium", + "Tritanium", + 0, + 0, + 9900, + 9900, + true, + false, + 1, + 1, + 1, + Dyes.dyeWhite, + Element.Tn, + Arrays.asList(new TC_AspectStack(TC_Aspects.METALLUM, 2), new TC_AspectStack(TC_Aspects.ORDO, 2))); + public static Materials Tritium = new Materials( + 3, + TextureSet.SET_METALLIC, + 1.0F, + 0, + 2, + 16 | 32, + 255, + 0, + 0, + 240, + "Tritium", + "Tritium", + 0, + 0, + 14, + 0, + false, + true, + 10, + 1, + 1, + Dyes.dyeRed, + Element.T, + Collections.singletonList(new TC_AspectStack(TC_Aspects.AQUA, 4))); + public static Materials Tungsten = new Materials( + 81, + TextureSet.SET_METALLIC, + 7.0F, + 2560, + 3, + 1 | 2 | 8 | 32 | 64 | 128, + 50, + 50, + 50, + 0, + "Tungsten", + "Tungsten", + 0, + 0, + 3695, + 3000, + true, + false, + 4, + 1, + 1, + Dyes.dyeBlack, + Element.W, + Arrays.asList( + new TC_AspectStack(TC_Aspects.METALLUM, 3), new TC_AspectStack(TC_Aspects.TUTAMEN, 1))) + .disableAutoGeneratedBlastFurnaceRecipes(); + public static Materials Uranium = new Materials( + 98, + TextureSet.SET_METALLIC, + 6.0F, + 512, + 3, + 1 | 2 | 8 | 32 | 64, + 50, + 240, + 50, + 0, + "Uranium", + "Uranium 238", + 0, + 0, + 1405, + 0, + false, + false, + 4, + 1, + 1, + Dyes.dyeGreen, + Element.U, + Arrays.asList(new TC_AspectStack(TC_Aspects.METALLUM, 2), new TC_AspectStack(TC_Aspects.RADIO, 1))); + public static Materials Uranium235 = new Materials( + 97, + TextureSet.SET_SHINY, + 6.0F, + 512, + 3, + 1 | 2 | 8 | 32 | 64, + 70, + 250, + 70, + 0, + "Uranium235", + "Uranium 235", + 0, + 0, + 1405, + 0, + false, + false, + 4, + 1, + 1, + Dyes.dyeGreen, + Element.U_235, + Arrays.asList(new TC_AspectStack(TC_Aspects.METALLUM, 2), new TC_AspectStack(TC_Aspects.RADIO, 2))); + public static Materials Vanadium = new Materials( + 29, + TextureSet.SET_METALLIC, + 1.0F, + 0, + 2, + 1 | 2 | 8 | 32, + 50, + 50, + 50, + 0, + "Vanadium", + "Vanadium", + 0, + 0, + 2183, + 2183, + true, + false, + 2, + 1, + 1, + Dyes.dyeBlack, + Element.V, + Arrays.asList(new TC_AspectStack(TC_Aspects.METALLUM, 2), new TC_AspectStack(TC_Aspects.RADIO, 1))); + public static Materials Ytterbium = new Materials( + 77, + TextureSet.SET_SHINY, + 1.0F, + 0, + 2, + 1 | 2 | 8 | 32, + 44, + 199, + 80, + 0, + "Ytterbium", + "Ytterbium", + 0, + 0, + 1097, + 1097, + true, + false, + 4, + 1, + 1, + Dyes._NULL, + Element.Yb, + Arrays.asList(new TC_AspectStack(TC_Aspects.METALLUM, 2), new TC_AspectStack(TC_Aspects.RADIO, 1))); + public static Materials Yttrium = new Materials( + 45, + TextureSet.SET_METALLIC, + 1.0F, + 0, + 2, + 1 | 2 | 8 | 32, + 220, + 250, + 220, + 0, + "Yttrium", + "Yttrium", + 0, + 0, + 1799, + 1799, + true, + false, + 4, + 1, + 1, + Dyes._NULL, + Element.Y, + Arrays.asList(new TC_AspectStack(TC_Aspects.METALLUM, 2), new TC_AspectStack(TC_Aspects.RADIO, 1))); + public static Materials Zinc = new Materials( + 36, + TextureSet.SET_METALLIC, + 1.0F, + 0, + 1, + 1 | 2 | 8 | 32, + 250, + 240, + 240, + 0, + "Zinc", + "Zinc", + 0, + 0, + 692, + 0, + false, + false, + 2, + 1, + 1, + Dyes.dyeWhite, + Element.Zn, + Arrays.asList(new TC_AspectStack(TC_Aspects.METALLUM, 2), new TC_AspectStack(TC_Aspects.SANO, 1))); + + // GT++ materials + public static Materials Flerovium = new Materials( + 984, + TextureSet.SET_SHINY, + 1.0F, + 0, + 0, + 1 | 2 | 8 | 32 | 64 | 128, + 255, + 255, + 255, + 0, + "Flerovium_GT5U", + "Flerovium", + 0, + 0, + 0, + 0, + false, + false, + 1, + 1, + 1, + Dyes.dyeWhite, + Element.Fl, + Arrays.asList( + new TC_Aspects.TC_AspectStack(TC_Aspects.METALLUM, 2), + new TC_Aspects.TC_AspectStack(TC_Aspects.RADIO, 3))) + .disableAutoGeneratedBlastFurnaceRecipes(); /** * The "Random Material" ones. */ - public static Materials Organic = new Materials( -1, TextureSet.SET_LEAF , 1.0F, 0, 1, false, "Organic" , "Organic" ); - public static Materials AnyCopper = new Materials( -1, TextureSet.SET_SHINY , 1.0F, 0, 3, false, "AnyCopper" , "AnyCopper" ); - public static Materials AnyBronze = new Materials( -1, TextureSet.SET_SHINY , 1.0F, 0, 3, false, "AnyBronze" , "AnyBronze" ); - public static Materials AnyIron = new Materials( -1, TextureSet.SET_SHINY , 1.0F, 0, 3, false, "AnyIron" , "AnyIron" ); - public static Materials AnyRubber = new Materials( -1, TextureSet.SET_SHINY , 1.0F, 0, 3, false, "AnyRubber" , "AnyRubber" ); - public static Materials AnySyntheticRubber = new Materials( -1, TextureSet.SET_SHINY , 1.0F, 0, 3, false, "AnySyntheticRubber" , "AnySyntheticRubber" ); - public static Materials Crystal = new Materials( -1, TextureSet.SET_SHINY , 1.0F, 0, 3, false, "Crystal" , "Crystal" ); - public static Materials Quartz = new Materials( -1, TextureSet.SET_QUARTZ , 1.0F, 0, 2, false, "Quartz" , "Quartz" ); - public static Materials Metal = new Materials( -1, TextureSet.SET_METALLIC , 1.0F, 0, 2, false, "Metal" , "Metal" ); - public static Materials Unknown = new Materials( -1, TextureSet.SET_DULL , 1.0F, 0, 2, false, "Unknown" , "Unknown" ); - public static Materials Cobblestone = new Materials( -1, TextureSet.SET_DULL , 1.0F, 0, 1, false, "Cobblestone" , "Cobblestone" ); - public static Materials BrickNether = new Materials( -1, TextureSet.SET_DULL , 1.0F, 0, 1, false, "BrickNether" , "BrickNether" ); + public static Materials Organic = new Materials(-1, TextureSet.SET_LEAF, 1.0F, 0, 1, false, "Organic", "Organic"); + + public static Materials AnyCopper = + new Materials(-1, TextureSet.SET_SHINY, 1.0F, 0, 3, false, "AnyCopper", "AnyCopper"); + public static Materials AnyBronze = + new Materials(-1, TextureSet.SET_SHINY, 1.0F, 0, 3, false, "AnyBronze", "AnyBronze"); + public static Materials AnyIron = new Materials(-1, TextureSet.SET_SHINY, 1.0F, 0, 3, false, "AnyIron", "AnyIron"); + public static Materials AnyRubber = + new Materials(-1, TextureSet.SET_SHINY, 1.0F, 0, 3, false, "AnyRubber", "AnyRubber"); + public static Materials AnySyntheticRubber = + new Materials(-1, TextureSet.SET_SHINY, 1.0F, 0, 3, false, "AnySyntheticRubber", "AnySyntheticRubber"); + public static Materials Crystal = new Materials(-1, TextureSet.SET_SHINY, 1.0F, 0, 3, false, "Crystal", "Crystal"); + public static Materials Quartz = new Materials(-1, TextureSet.SET_QUARTZ, 1.0F, 0, 2, false, "Quartz", "Quartz"); + public static Materials Metal = new Materials(-1, TextureSet.SET_METALLIC, 1.0F, 0, 2, false, "Metal", "Metal"); + public static Materials Unknown = new Materials(-1, TextureSet.SET_DULL, 1.0F, 0, 2, false, "Unknown", "Unknown"); + public static Materials Cobblestone = + new Materials(-1, TextureSet.SET_DULL, 1.0F, 0, 1, false, "Cobblestone", "Cobblestone"); + public static Materials BrickNether = + new Materials(-1, TextureSet.SET_DULL, 1.0F, 0, 1, false, "BrickNether", "BrickNether"); /** * The "I don't care" Section, everything I don't want to do anything with right now, is right here. Just to make the Material Finder shut up about them. * But I do see potential uses in some of these Materials. */ - public static Materials Serpentine = new Materials( -1, TextureSet.SET_NONE , 1.0F, 0, 2, 1|2 |8 , 255, 255, 255, 0, "Serpentine" , "Serpentine" , 0, 0, -1, 0, false, false, 3, 1, 1, Dyes._NULL ); - public static Materials Flux = new Materials( -1, TextureSet.SET_NONE , 1.0F, 0, 2, 1 , 255, 255, 255, 0, "Flux" , "Flux" , 0, 0, -1, 0, false, false, 3, 1, 1, Dyes._NULL ); - public static Materials OsmiumTetroxide = new Materials( -1, TextureSet.SET_NONE , 1.0F, 0, 2, 1 , 255, 255, 255, 0, "OsmiumTetroxide" , "Osmium Tetroxide" , 0, 0, -1, 0, false, false, 3, 1, 1, Dyes._NULL ); - public static Materials RubberTreeSap = new Materials( -1, TextureSet.SET_NONE , 1.0F, 0, 2, 0 , 255, 255, 255, 0, "RubberTreeSap" , "Rubber Tree Sap" , 0, 0, -1, 0, false, false, 3, 1, 1, Dyes._NULL ); - public static Materials PhasedIron = new Materials( -1, TextureSet.SET_NONE , 1.0F, 0, 2, 1|2 , 255, 255, 255, 0, "PhasedIron" , "Phased Iron" , 0, 0, 3300, 3300, true, false, 3, 1, 1, Dyes._NULL ); - public static Materials PhasedGold = new Materials( -1, TextureSet.SET_NONE , 1.0F, 0, 2, 1|2 , 255, 255, 255, 0, "PhasedGold" , "Phased Gold" , 0, 0, -1, 1800, true, false, 3, 1, 1, Dyes._NULL ); - public static Materials HeeEndium = new Materials( 770, TextureSet.SET_DULL , 16.0F, 1024, 4, 1|2 |8 |64|128 , 165, 220, 250, 0, "HeeEndium" , "Endium" , 0, 0, -1, 0, false, false, 3, 1, 1, Dyes.dyeLightBlue ); - public static Materials Teslatite = new Materials( -1, TextureSet.SET_NONE , 1.0F, 0, 2, 1 , 60, 180, 200, 0, "Teslatite" , "Teslatite" , 0, 0, -1, 0, false, false, 3, 1, 1, Dyes._NULL ); - public static Materials Fluix = new Materials( -1, TextureSet.SET_NONE , 1.0F, 0, 2, 1 |4 , 255, 255, 255, 0, "Fluix" , "Fluix" , 0, 0, -1, 0, false, false, 3, 1, 1, Dyes._NULL ); - public static Materials DarkThaumium = new Materials( -1, TextureSet.SET_NONE , 1.0F, 0, 2, 1|2 , 255, 255, 255, 0, "DarkThaumium" , "Dark Thaumium" , 0, 0, -1, 0, false, false, 3, 1, 1, Dyes._NULL ); - public static Materials Alfium = new Materials( -1, TextureSet.SET_NONE , 1.0F, 0, 2, 1 , 255, 255, 255, 0, "Alfium" , "Alfium" , 0, 0, -1, 0, false, false, 3, 1, 1, Dyes._NULL ); - public static Materials Mutation = new Materials( -1, TextureSet.SET_NONE , 1.0F, 0, 2, 1 , 255, 255, 255, 0, "Mutation" , "Mutation" , 0, 0, -1, 0, false, false, 3, 1, 1, Dyes._NULL ); - public static Materials Aquamarine = new Materials( -1, TextureSet.SET_NONE , 1.0F, 0, 2, 1 |4 , 255, 255, 255, 0, "Aquamarine" , "Aquamarine" , 0, 0, -1, 0, false, false, 3, 1, 1, Dyes._NULL ); - public static Materials Ender = new Materials( -1, TextureSet.SET_NONE , 1.0F, 0, 2, 1 , 255, 255, 255, 0, "Ender" , "Ender" , 0, 0, -1, 0, false, false, 3, 1, 1, Dyes._NULL ); - public static Materials SodiumPeroxide = new Materials( -1, TextureSet.SET_NONE , 1.0F, 0, 2, 1 , 255, 255, 255, 0, "SodiumPeroxide" , "Sodium Peroxide" , 0, 0, -1, 0, false, false, 3, 1, 1, Dyes._NULL ); - public static Materials IridiumSodiumOxide = new Materials( -1, TextureSet.SET_NONE , 1.0F, 0, 2, 1 , 255, 255, 255, 0, "IridiumSodiumOxide" , "Iridium Sodium Oxide" , 0, 0, -1, 0, false, false, 3, 1, 1, Dyes._NULL ); - public static Materials PlatinumGroupSludge = new Materials( 241, TextureSet.SET_POWDER , 1.0F, 0, 2, 1 , 0, 30, 0, 0, "PlatinumGroupSludge" , "Platinum Group Sludge" , 0, 0, -1, 0, false, false, 3, 1, 1, Dyes._NULL ); - public static Materials Draconium = new Materials( 975, TextureSet.SET_SHINY , 20.0F, 32768, 7, 1|2| 8| 32|64|128 , 122, 68, 176, 0, "Draconium" , "Draconium" , 0, 0, 5000, 7200, true, false, 3, 1, 1, Dyes.dyePink ).disableAutoGeneratedBlastFurnaceRecipes(); - public static Materials DraconiumAwakened = new Materials( 976, TextureSet.SET_SHINY , 40.0F, 65536, 9, 1|2| 8| 32|64|128 , 244, 78, 0, 0, "DraconiumAwakened" , "Awakened Draconium" , 0, 0, 9900,9900, true, false, 3, 1, 1, Dyes.dyeOrange ).disableAutoGeneratedBlastFurnaceRecipes(); - public static Materials PurpleAlloy = new Materials( -1, TextureSet.SET_NONE , 1.0F, 0, 2, 0 , 100, 180, 255, 0, "PurpleAlloy" , "Purple Alloy" , 0, 0, -1, 0, false, false, 3, 1, 1, Dyes._NULL ); - public static Materials InfusedTeslatite = new Materials( -1, TextureSet.SET_NONE , 1.0F, 0, 2, 0 , 100, 180, 255, 0, "InfusedTeslatite" , "Infused Teslatite" , 0, 0, -1, 0, false, false, 3, 1, 1, Dyes._NULL ); + public static Materials Serpentine = new Materials( + -1, + TextureSet.SET_NONE, + 1.0F, + 0, + 2, + 1 | 2 | 8, + 255, + 255, + 255, + 0, + "Serpentine", + "Serpentine", + 0, + 0, + -1, + 0, + false, + false, + 3, + 1, + 1, + Dyes._NULL); + + public static Materials Flux = new Materials( + -1, + TextureSet.SET_NONE, + 1.0F, + 0, + 2, + 1, + 255, + 255, + 255, + 0, + "Flux", + "Flux", + 0, + 0, + -1, + 0, + false, + false, + 3, + 1, + 1, + Dyes._NULL); + public static Materials OsmiumTetroxide = new Materials( + -1, + TextureSet.SET_NONE, + 1.0F, + 0, + 2, + 1, + 255, + 255, + 255, + 0, + "OsmiumTetroxide", + "Osmium Tetroxide", + 0, + 0, + -1, + 0, + false, + false, + 3, + 1, + 1, + Dyes._NULL); + public static Materials RubberTreeSap = new Materials( + -1, + TextureSet.SET_NONE, + 1.0F, + 0, + 2, + 0, + 255, + 255, + 255, + 0, + "RubberTreeSap", + "Rubber Tree Sap", + 0, + 0, + -1, + 0, + false, + false, + 3, + 1, + 1, + Dyes._NULL); + public static Materials PhasedIron = new Materials( + -1, + TextureSet.SET_NONE, + 1.0F, + 0, + 2, + 1 | 2, + 255, + 255, + 255, + 0, + "PhasedIron", + "Phased Iron", + 0, + 0, + 3300, + 3300, + true, + false, + 3, + 1, + 1, + Dyes._NULL); + public static Materials PhasedGold = new Materials( + -1, + TextureSet.SET_NONE, + 1.0F, + 0, + 2, + 1 | 2, + 255, + 255, + 255, + 0, + "PhasedGold", + "Phased Gold", + 0, + 0, + -1, + 1800, + true, + false, + 3, + 1, + 1, + Dyes._NULL); + public static Materials HeeEndium = new Materials( + 770, + TextureSet.SET_DULL, + 16.0F, + 1024, + 4, + 1 | 2 | 8 | 64 | 128, + 165, + 220, + 250, + 0, + "HeeEndium", + "Endium", + 0, + 0, + -1, + 0, + false, + false, + 3, + 1, + 1, + Dyes.dyeLightBlue); + public static Materials Teslatite = new Materials( + -1, + TextureSet.SET_NONE, + 1.0F, + 0, + 2, + 1, + 60, + 180, + 200, + 0, + "Teslatite", + "Teslatite", + 0, + 0, + -1, + 0, + false, + false, + 3, + 1, + 1, + Dyes._NULL); + public static Materials Fluix = new Materials( + -1, + TextureSet.SET_NONE, + 1.0F, + 0, + 2, + 1 | 4, + 255, + 255, + 255, + 0, + "Fluix", + "Fluix", + 0, + 0, + -1, + 0, + false, + false, + 3, + 1, + 1, + Dyes._NULL); + public static Materials DarkThaumium = new Materials( + -1, + TextureSet.SET_NONE, + 1.0F, + 0, + 2, + 1 | 2, + 255, + 255, + 255, + 0, + "DarkThaumium", + "Dark Thaumium", + 0, + 0, + -1, + 0, + false, + false, + 3, + 1, + 1, + Dyes._NULL); + public static Materials Alfium = new Materials( + -1, + TextureSet.SET_NONE, + 1.0F, + 0, + 2, + 1, + 255, + 255, + 255, + 0, + "Alfium", + "Alfium", + 0, + 0, + -1, + 0, + false, + false, + 3, + 1, + 1, + Dyes._NULL); + public static Materials Mutation = new Materials( + -1, + TextureSet.SET_NONE, + 1.0F, + 0, + 2, + 1, + 255, + 255, + 255, + 0, + "Mutation", + "Mutation", + 0, + 0, + -1, + 0, + false, + false, + 3, + 1, + 1, + Dyes._NULL); + public static Materials Aquamarine = new Materials( + -1, + TextureSet.SET_NONE, + 1.0F, + 0, + 2, + 1 | 4, + 255, + 255, + 255, + 0, + "Aquamarine", + "Aquamarine", + 0, + 0, + -1, + 0, + false, + false, + 3, + 1, + 1, + Dyes._NULL); + public static Materials Ender = new Materials( + -1, + TextureSet.SET_NONE, + 1.0F, + 0, + 2, + 1, + 255, + 255, + 255, + 0, + "Ender", + "Ender", + 0, + 0, + -1, + 0, + false, + false, + 3, + 1, + 1, + Dyes._NULL); + public static Materials SodiumPeroxide = new Materials( + -1, + TextureSet.SET_NONE, + 1.0F, + 0, + 2, + 1, + 255, + 255, + 255, + 0, + "SodiumPeroxide", + "Sodium Peroxide", + 0, + 0, + -1, + 0, + false, + false, + 3, + 1, + 1, + Dyes._NULL); + public static Materials IridiumSodiumOxide = new Materials( + -1, + TextureSet.SET_NONE, + 1.0F, + 0, + 2, + 1, + 255, + 255, + 255, + 0, + "IridiumSodiumOxide", + "Iridium Sodium Oxide", + 0, + 0, + -1, + 0, + false, + false, + 3, + 1, + 1, + Dyes._NULL); + public static Materials PlatinumGroupSludge = new Materials( + 241, + TextureSet.SET_POWDER, + 1.0F, + 0, + 2, + 1, + 0, + 30, + 0, + 0, + "PlatinumGroupSludge", + "Platinum Group Sludge", + 0, + 0, + -1, + 0, + false, + false, + 3, + 1, + 1, + Dyes._NULL); + public static Materials Draconium = new Materials( + 975, + TextureSet.SET_SHINY, + 20.0F, + 32768, + 7, + 1 | 2 | 8 | 32 | 64 | 128, + 122, + 68, + 176, + 0, + "Draconium", + "Draconium", + 0, + 0, + 5000, + 7200, + true, + false, + 3, + 1, + 1, + Dyes.dyePink) + .disableAutoGeneratedBlastFurnaceRecipes(); + public static Materials DraconiumAwakened = new Materials( + 976, + TextureSet.SET_SHINY, + 40.0F, + 65536, + 9, + 1 | 2 | 8 | 32 | 64 | 128, + 244, + 78, + 0, + 0, + "DraconiumAwakened", + "Awakened Draconium", + 0, + 0, + 9900, + 9900, + true, + false, + 3, + 1, + 1, + Dyes.dyeOrange) + .disableAutoGeneratedBlastFurnaceRecipes(); + public static Materials PurpleAlloy = new Materials( + -1, + TextureSet.SET_NONE, + 1.0F, + 0, + 2, + 0, + 100, + 180, + 255, + 0, + "PurpleAlloy", + "Purple Alloy", + 0, + 0, + -1, + 0, + false, + false, + 3, + 1, + 1, + Dyes._NULL); + public static Materials InfusedTeslatite = new Materials( + -1, + TextureSet.SET_NONE, + 1.0F, + 0, + 2, + 0, + 100, + 180, + 255, + 0, + "InfusedTeslatite", + "Infused Teslatite", + 0, + 0, + -1, + 0, + false, + false, + 3, + 1, + 1, + Dyes._NULL); /** * Unknown Material Components. Dead End Section. */ - public static Materials Adamantium = new Materials( 319, TextureSet.SET_SHINY , 32.0F, 8192, 10, 1|2 |8 |64|128 , 255, 255, 255, 0, "Adamantium" , "Adamantium" , 0, 0, 7200, 7200, true, false, 1, 1, 1, Dyes.dyeLightGray ).setTurbineMultipliers(1, 5, 1); - public static Materials Adamite = new Materials( -1, TextureSet.SET_NONE , 1.0F, 0, 3, 1 |8 , 255, 255, 255, 0, "Adamite" , "Adamite" , 0, 0, -1, 0, false, false, 1, 1, 1, Dyes.dyeLightGray ); - public static Materials Adluorite = new Materials( -1, TextureSet.SET_NONE , 1.0F, 0, 2, 1|2 |8 |64|128 , 255, 255, 255, 0, "Adluorite" , "Adluorite" , 0, 0, -1, 0, false, false, 1, 1, 1, Dyes.dyeLightBlue ); - public static Materials Agate = new Materials( -1, TextureSet.SET_NONE , 1.0F, 0, 2, 1 , 255, 255, 255, 0, "Agate" , "Agate" , 0, 0, -1, 0, false, false, 3, 1, 1, Dyes._NULL ); - public static Materials Alduorite = new Materials( 485, TextureSet.SET_SHINY , 32.0F, 8192, 1, 1|2 |8 |64|128 , 159, 180, 180, 0, "Alduorite" , "Alduorite" , 0, 0, -1, 0, false, false, 1, 1, 1, Dyes._NULL ).disableAutoGeneratedBlastFurnaceRecipes().setTurbineMultipliers(6, 1, 1); - public static Materials Amber = new Materials( 514, TextureSet.SET_RUBY , 4.0F, 128, 2, 1 |4|8 |64 , 255, 128, 0, 127, "Amber" , "Amber" , 5, 3, -1, 0, false, true, 1, 1, 1, Dyes.dyeOrange ,1, Arrays.asList(new MaterialStack(Carbon, 10), new MaterialStack(Hydrogen, 10), new MaterialStack(Oxygen, 16)), Arrays.asList(new TC_AspectStack(TC_Aspects.VINCULUM, 2), new TC_AspectStack(TC_Aspects.VITREUS, 1))); - public static Materials Ammonium = new Materials( -1, TextureSet.SET_NONE , 1.0F, 0, 2, 1 , 255, 255, 255, 0, "Ammonium" , "Ammonium" , 0, 0, -1, 0, false, false, 1, 1, 1, Dyes._NULL ); - public static Materials Amordrine = new Materials( -1, TextureSet.SET_NONE , 6.0F, 64, 2, 1|2 |8 |64 , 255, 255, 255, 0, "Amordrine" , "Amordrine" , 0, 0, -1, 0, false, false, 1, 1, 1, Dyes._NULL ); - public static Materials Andesite = new Materials( -1, TextureSet.SET_NONE , 1.0F, 0, 2, 1 |8 , 255, 255, 255, 0, "Andesite" , "Andesite" , 0, 0, -1, 0, false, false, 1, 1, 1, Dyes._NULL ); - public static Materials Angmallen = new Materials( 958, TextureSet.SET_METALLIC , 10.0F, 128, 2, 1|2 |8 |64 , 215, 225, 138, 0, "Angmallen" , "Angmallen" , 0, 0, -1, 0, false, false, 1, 1, 1, Dyes._NULL ); - public static Materials Ardite = new Materials( 382, TextureSet.SET_METALLIC , 18.0F, 1024, 4, 1|2 |8 |32|64|128 , 250, 129, 0, 0, "Ardite" , "Ardite" , 0, 0, 1600, 1600, true, false, 1, 1, 1, Dyes.dyeRed ).disableAutoGeneratedBlastFurnaceRecipes(); - public static Materials Aredrite = new Materials( -1, TextureSet.SET_NONE , 6.0F, 64, 2, 1|2 |8 |64 , 255, 0, 0, 0, "Aredrite" , "Aredrite" , 0, 0, -1, 0, false, false, 1, 1, 1, Dyes.dyeYellow ); - public static Materials Atlarus = new Materials( 965, TextureSet.SET_METALLIC , 6.0F, 64, 2, 1|2 |8 |64 , 255, 255, 255, 0, "Atlarus" , "Atlarus" , 0, 0, -1, 0, false, false, 1, 1, 1, Dyes._NULL ); - public static Materials Bitumen = new Materials( -1, TextureSet.SET_NONE , 1.0F, 0, 2, 1 |8 , 255, 255, 255, 0, "Bitumen" , "Bitumen" , 0, 0, -1, 0, false, false, 1, 1, 1, Dyes._NULL ); - public static Materials Black = new Materials( -1, TextureSet.SET_NONE , 1.0F, 0, 2, 0 , 0, 0, 0, 0, "Black" , "Black" , 0, 0, -1, 0, false, false, 3, 1, 1, Dyes.dyeBlack ); - public static Materials Blizz = new Materials( 851, TextureSet.SET_SHINY , 1.0F, 0, 2, 1 , 220, 233, 255, 0, "Blizz" , "Blizz" , 0, 0, -1, 0, false, false, 3, 1, 1, Dyes._NULL ); - public static Materials Blueschist = new Materials( 852, TextureSet.SET_DULL , 1.0F, 0, 2, 1 , 255, 255, 255, 0, "Blueschist" , "Blueschist" , 0, 0, -1, 0, false, false, 0, 1, 1, Dyes.dyeLightBlue ); - public static Materials Bluestone = new Materials( 813, TextureSet.SET_DULL , 1.0F, 0, 2, 1 , 255, 255, 255, 0, "Bluestone" , "Bluestone" , 0, 0, -1, 0, false, false, 1, 1, 1, Dyes.dyeBlue ); - public static Materials Bloodstone = new Materials( -1, TextureSet.SET_NONE , 1.0F, 0, 2, 1 , 255, 255, 255, 0, "Bloodstone" , "Bloodstone" , 0, 0, -1, 0, false, false, 3, 1, 1, Dyes.dyeRed ); - public static Materials Blutonium = new Materials( -1, TextureSet.SET_SHINY , 1.0F, 0, 2, 1|2 |8 , 0, 0, 255, 0, "Blutonium" , "Blutonium" , 0, 0, -1, 0, false, false, 3, 1, 1, Dyes.dyeBlue ); - public static Materials Carmot = new Materials( 962, TextureSet.SET_METALLIC , 16.0F, 128, 1, 1|2 |8 |64 , 217, 205, 140, 0, "Carmot" , "Carmot" , 0, 0, -1, 0, false, false, 1, 1, 1, Dyes._NULL ); - public static Materials Celenegil = new Materials( 964, TextureSet.SET_METALLIC , 10.0F, 4096, 2, 1|2 |8 |64 , 148, 204, 72, 0, "Celenegil" , "Celenegil" , 0, 0, -1, 0, false, false, 1, 1, 1, Dyes._NULL ); - public static Materials CertusQuartz = new Materials( 516, TextureSet.SET_QUARTZ , 5.0F, 32, 1, 1 |4|8 |64 , 210, 210, 230, 0, "CertusQuartz" , "Certus Quartz" , 0, 0, -1, 0, false, false, 3, 1, 1, Dyes.dyeLightGray , Arrays.asList(new TC_AspectStack(TC_Aspects.POTENTIA, 1), new TC_AspectStack(TC_Aspects.VITREUS, 1))); - public static Materials Ceruclase = new Materials( 952, TextureSet.SET_METALLIC , 32.0F, 1280, 2, 1|2 |8 |64|128 , 140, 189, 208, 0, "Ceruclase" , "Ceruclase" , 0, 0, -1, 0, false, false, 1, 1, 1, Dyes.dyeBlue ).disableAutoGeneratedBlastFurnaceRecipes().setTurbineMultipliers(1, 22, 1); - public static Materials Citrine = new Materials( -1, TextureSet.SET_NONE , 1.0F, 0, 2, 1 , 255, 255, 255, 0, "Citrine" , "Citrine" , 0, 0, -1, 0, false, false, 3, 1, 1, Dyes._NULL ); - public static Materials CobaltHexahydrate = new Materials( 853, TextureSet.SET_METALLIC , 1.0F, 0, 2, 1 |16 , 80, 80, 250, 0, "CobaltHexahydrate" , "Cobalt Hexahydrate" , 0, 0, -1, 0, false, false, 1, 1, 1, Dyes.dyeBlue ); - public static Materials ConstructionFoam = new Materials( 854, TextureSet.SET_DULL , 1.0F, 0, 2, 1 |16 |64|128 , 128, 128, 128, 0, "ConstructionFoam" , "Construction Foam" , 0, 0, -1, 0, false, false, 1, 1, 1, Dyes.dyeGray ); - public static Materials Chert = new Materials( 857, TextureSet.SET_DULL , 1.0F, 0, 2, 1 , 255, 255, 255, 0, "Chert" , "Chert" , 0, 0, -1, 0, false, false, 0, 1, 1, Dyes._NULL ); - public static Materials Chimerite = new Materials( -1, TextureSet.SET_NONE , 1.0F, 0, 2, 1 , 255, 255, 255, 0, "Chimerite" , "Chimerite" , 0, 0, -1, 0, false, false, 3, 1, 1, Dyes._NULL ); - public static Materials Coral = new Materials( -1, TextureSet.SET_NONE , 1.0F, 0, 1, 1 , 255, 128, 255, 0, "Coral" , "Coral" , 0, 0, -1, 0, false, false, 3, 1, 1, Dyes._NULL ); - public static Materials CrudeOil = new Materials( 858, TextureSet.SET_DULL , 1.0F, 0, 2, 1 , 10, 10, 10, 0, "CrudeOil" , "Crude Oil" , 0, 0, -1, 0, false, false, 1, 1, 1, Dyes.dyeBlack ); - public static Materials Chrysocolla = new Materials( -1, TextureSet.SET_NONE , 1.0F, 0, 2, 1 , 255, 255, 255, 0, "Chrysocolla" , "Chrysocolla" , 0, 0, -1, 0, false, false, 3, 1, 1, Dyes._NULL ); - public static Materials CrystalFlux = new Materials( -1, TextureSet.SET_QUARTZ , 1.0F, 0, 3, 1 |4 , 100, 50, 100, 0, "CrystalFlux" , "Flux Crystal" , 0, 0, -1, 0, false, false, 1, 1, 1, Dyes._NULL ); - public static Materials Cyanite = new Materials( -1, TextureSet.SET_NONE , 1.0F, 0, 2, 1 , 255, 255, 255, 0, "Cyanite" , "Cyanite" , 0, 0, -1, 0, false, false, 3, 1, 1, Dyes.dyeCyan ); - public static Materials Dacite = new Materials( 859, TextureSet.SET_DULL , 1.0F, 0, 2, 1 , 255, 255, 255, 0, "Dacite" , "Dacite" , 0, 0, -1, 0, false, false, 0, 1, 1, Dyes.dyeLightGray ); - public static Materials DarkIron = new Materials( 342, TextureSet.SET_DULL , 7.0F, 384, 3, 1|2 |8 |64 , 55, 40, 60, 0, "DarkIron" , "Dark Iron" , 0, 0, -1, 0, false, false, 5, 1, 1, Dyes.dyePurple ); - public static Materials DarkStone = new Materials( -1, TextureSet.SET_NONE , 1.0F, 0, 2, 1 , 255, 255, 255, 0, "DarkStone" , "Dark Stone" , 0, 0, -1, 0, false, false, 3, 1, 1, Dyes.dyeBlack ); - public static Materials Demonite = new Materials( -1, TextureSet.SET_NONE , 1.0F, 0, 2, 1 , 255, 255, 255, 0, "Demonite" , "Demonite" , 0, 0, -1, 0, false, false, 3, 1, 1, Dyes.dyeRed ); - public static Materials Desh = new Materials( 884, TextureSet.SET_DULL , 20.0F, 1280, 4, 1|2 |8 |64|128 , 40, 40, 40, 0, "Desh" , "Desh" , 0, 0, 2500, 2500, true, false, 1, 1, 1, Dyes.dyeBlack ,Element.De, Arrays.asList(new TC_AspectStack(TC_Aspects.METALLUM, 2), new TC_AspectStack(TC_Aspects.ALIENIS, 1))).disableAutoGeneratedBlastFurnaceRecipes(); - public static Materials Desichalkos = new Materials( -1, TextureSet.SET_NONE , 6.0F, 1280, 3, 1|2 |8 |64 , 255, 255, 255, 0, "Desichalkos" , "Desichalkos" , 0, 0, -1, 0, false, false, 1, 1, 1, Dyes._NULL ); - public static Materials Dilithium = new Materials( 515, TextureSet.SET_DIAMOND , 1.0F, 0, 1, 1 |4|8|16 , 255, 250, 250, 127, "Dilithium" , "Dilithium" , 0, 0, -1, 0, false, true, 1, 1, 1, Dyes.dyeWhite ); - public static Materials Draconic = new Materials( -1, TextureSet.SET_NONE , 1.0F, 0, 2, 1 , 255, 255, 255, 0, "Draconic" , "Draconic" , 0, 0, -1, 0, false, false, 1, 1, 1, Dyes.dyeRed ); - public static Materials Drulloy = new Materials( -1, TextureSet.SET_NONE , 1.0F, 0, 2, 1|16 , 255, 255, 255, 0, "Drulloy" , "Drulloy" , 0, 0, -1, 0, false, false, 1, 1, 1, Dyes.dyeRed ); - public static Materials Duranium = new Materials( 328, TextureSet.SET_METALLIC , 32.0F, 40960, 11, 1|2 |64 , 255, 255, 255, 0, "Duranium" , "Duranium" , 0, 0, -1, 0, false, false, 1, 1, 1, Dyes.dyeLightGray ).setTurbineMultipliers(16, 16, 1); - public static Materials Eclogite = new Materials( 860, TextureSet.SET_DULL , 1.0F, 0, 2, 1 , 255, 255, 255, 0, "Eclogite" , "Eclogite" , 0, 0, -1, 0, false, false, 1, 1, 1, Dyes._NULL ); - public static Materials ElectrumFlux = new Materials( 320, TextureSet.SET_SHINY , 16.0F, 512, 3, 1|2 |8 |64|128 , 255, 255, 120, 0, "ElectrumFlux" , "Fluxed Electrum" , 0, 0, 9000, 9000, true, false, 1, 1, 1, Dyes.dyeYellow ).disableAutoGeneratedBlastFurnaceRecipes(); - public static Materials Emery = new Materials( 861, TextureSet.SET_DULL , 1.0F, 0, 2, 1 |8 , 255, 255, 255, 0, "Emery" , "Emery" , 0, 0, -1, 0, false, false, 1, 1, 1, Dyes._NULL ); - public static Materials EnderiumBase = new Materials( 380, TextureSet.SET_DULL , 16.0F, 768, 4, 1|2 |64|128 , 72, 119, 153, 0, "EnderiumBase" , "Enderium Base" , 0, 0, 3600, 3600, true, false, 1, 1, 1, Dyes.dyeGreen , 1, Arrays.asList(new MaterialStack(Tin, 2), new MaterialStack(Silver, 1), new MaterialStack(Platinum, 1)), Arrays.asList(new TC_AspectStack(TC_Aspects.METALLUM, 2), new TC_AspectStack(TC_Aspects.ALIENIS, 1))).disableAutoGeneratedBlastFurnaceRecipes(); - public static Materials Energized = new Materials( -1, TextureSet.SET_NONE , 1.0F, 0, 2, 0 , 255, 255, 255, 0, "Energized" , "Energized" , 0, 0, -1, 0, false, false, 1, 1, 1, Dyes._NULL ); - public static Materials Epidote = new Materials( 862, TextureSet.SET_DULL , 1.0F, 0, 2, 1 , 255, 255, 255, 0, "Epidote" , "Epidote" , 0, 0, -1, 0, false, false, 0, 1, 1, Dyes._NULL ); - public static Materials Eximite = new Materials( 959, TextureSet.SET_METALLIC , 5.0F, 2560, 3, 1|2 |8 |64 , 124, 90, 150, 0, "Eximite" , "Eximite" , 0, 0, -1, 0, false, false, 1, 1, 1, Dyes._NULL ); - public static Materials FierySteel = new Materials( 346, TextureSet.SET_FIERY , 8.0F, 256, 3, 1|2 |64|128 , 64, 0, 0, 0, "FierySteel" , "Fiery Steel" , 5, 2048, 1811, 1800, true, false, 1, 1, 1, Dyes.dyeRed , Arrays.asList(new TC_AspectStack(TC_Aspects.PRAECANTATIO, 3), new TC_AspectStack(TC_Aspects.IGNIS, 3), new TC_AspectStack(TC_Aspects.CORPUS, 3))).disableAutoGeneratedBlastFurnaceRecipes(); - public static Materials Firestone = new Materials( 347, TextureSet.SET_QUARTZ , 6.0F, 1280, 3, 1 |4|8 |64 , 200, 20, 0, 0, "Firestone" , "Firestone" , 0, 0, -1, 0, false, false, 3, 1, 1, Dyes.dyeRed ); - public static Materials Fluorite = new Materials( -1, TextureSet.SET_NONE , 1.0F, 0, 2, 1 |8 , 255, 255, 255, 0, "Fluorite" , "Fluorite" , 0, 0, -1, 0, false, false, 3, 1, 1, Dyes.dyeGreen ); - public static Materials FoolsRuby = new Materials( 512, TextureSet.SET_RUBY , 1.0F, 0, 2, 1 |4|8 , 255, 100, 100, 127, "FoolsRuby" , "Ruby" , 0, 0, -1, 0, false, true, 3, 1, 1, Dyes.dyeRed , 1, Arrays.asList(new MaterialStack(Magnesium, 1), new MaterialStack(Aluminium, 2), new MaterialStack(Oxygen, 4)), Arrays.asList(new TC_AspectStack(TC_Aspects.LUCRUM, 2), new TC_AspectStack(TC_Aspects.VITREUS, 2))); - public static Materials Force = new Materials( 521, TextureSet.SET_DIAMOND , 10.0F, 128, 3, 1|2|4|8 |64|128 , 255, 255, 0, 0, "Force" , "Force" , 0, 0, -1, 0, false, false, 3, 1, 1, Dyes.dyeYellow , Collections.singletonList(new TC_AspectStack(TC_Aspects.POTENTIA, 5))); - public static Materials Forcicium = new Materials( 518, TextureSet.SET_DIAMOND , 1.0F, 0, 1, 1 |4|8|16 , 50, 50, 70, 0, "Forcicium" , "Forcicium" , 0, 0, -1, 0, false, false, 3, 1, 1, Dyes.dyeGreen , Collections.singletonList(new TC_AspectStack(TC_Aspects.POTENTIA, 2))); - public static Materials Forcillium = new Materials( 519, TextureSet.SET_DIAMOND , 1.0F, 0, 1, 1 |4|8|16 , 50, 50, 70, 0, "Forcillium" , "Forcillium" , 0, 0, -1, 0, false, false, 3, 1, 1, Dyes.dyeGreen , Collections.singletonList(new TC_AspectStack(TC_Aspects.POTENTIA, 2))); - public static Materials Gabbro = new Materials( 863, TextureSet.SET_DULL , 1.0F, 0, 1, 1 , 255, 255, 255, 0, "Gabbro" , "Gabbro" , 0, 0, -1, 0, false, false, 0, 1, 1, Dyes._NULL ); - public static Materials Glowstone = new Materials( 811, TextureSet.SET_SHINY , 1.0F, 0, 1, 1 |16 , 255, 255, 0, 0, "Glowstone" , "Glowstone" , 0, 0, -1, 0, false, false, 1, 1, 1, Dyes.dyeYellow , Arrays.asList(new TC_AspectStack(TC_Aspects.LUX, 2), new TC_AspectStack(TC_Aspects.SENSUS, 1))); - public static Materials Gneiss = new Materials( 864, TextureSet.SET_DULL , 1.0F, 0, 1, 1 , 255, 255, 255, 0, "Gneiss" , "Gneiss" , 0, 0, -1, 0, false, false, 0, 1, 1, Dyes._NULL ); - public static Materials Graphite = new Materials( 865, TextureSet.SET_DULL , 5.0F, 32, 2, 1 |8|16 |64 , 128, 128, 128, 0, "Graphite" , "Graphite" , 0, 0, -1, 0, false, false, 3, 1, 1, Dyes.dyeGray , 0, Collections.singletonList(new MaterialStack(Carbon, 1)), Arrays.asList(new TC_AspectStack(TC_Aspects.VITREUS, 2), new TC_AspectStack(TC_Aspects.IGNIS, 1))); - public static Materials Graphene = new Materials( 819, TextureSet.SET_DULL , 6.0F, 32, 1, 1 |64 , 128, 128, 128, 0, "Graphene" , "Graphene" , 0, 0, -1, 0, false, false, 3, 1, 1, Dyes.dyeGray , 0, Collections.singletonList(new MaterialStack(Carbon, 1)), Arrays.asList(new TC_AspectStack(TC_Aspects.VITREUS, 2), new TC_AspectStack(TC_Aspects.ELECTRUM, 1))); - public static Materials Greenschist = new Materials( 866, TextureSet.SET_DULL , 1.0F, 0, 1, 1 , 255, 255, 255, 0, "Greenschist" , "Green Schist" , 0, 0, -1, 0, false, false, 1, 1, 1, Dyes.dyeGreen ); - public static Materials Greenstone = new Materials( 867, TextureSet.SET_DULL , 1.0F, 0, 1, 1 , 255, 255, 255, 0, "Greenstone" , "Greenstone" , 0, 0, -1, 0, false, false, 1, 1, 1, Dyes.dyeGreen ); - public static Materials Greywacke = new Materials( 897, TextureSet.SET_DULL , 1.0F, 0, 1, 1 , 255, 255, 255, 0, "Greywacke" , "Greywacke" , 0, 0, -1, 0, false, false, 1, 1, 1, Dyes.dyeGray ); - public static Materials Haderoth = new Materials( 963, TextureSet.SET_METALLIC , 10.0F, 3200, 3, 1|2 |8 |64 , 119, 52, 30, 0, "Haderoth" , "Haderoth" , 0, 0, -1, 0, false, false, 1, 1, 1, Dyes._NULL ); - public static Materials Hematite = new Materials( -1, TextureSet.SET_NONE , 1.0F, 0, 2, 1|2 |8 , 255, 255, 255, 0, "Hematite" , "Hematite" , 0, 0, -1, 0, false, false, 3, 1, 1, Dyes._NULL ); - public static Materials Hepatizon = new Materials( 957, TextureSet.SET_METALLIC , 12.0F, 128, 2, 1|2 |8 |64 , 117, 94, 117, 0, "Hepatizon" , "Hepatizon" , 0, 0, -1, 0, false, false, 1, 1, 1, Dyes._NULL ); - public static Materials HSLA = new Materials( 322, TextureSet.SET_METALLIC , 6.0F, 500, 3, 1|2 |64|128 , 128, 128, 128, 0, "HSLA" , "HSLA Steel" , 0, 0, 1811, 1000, true, false, 3, 1, 1, Dyes._NULL , Arrays.asList(new TC_AspectStack(TC_Aspects.METALLUM, 1), new TC_AspectStack(TC_Aspects.ORDO, 1))); - public static Materials Ignatius = new Materials( 950, TextureSet.SET_METALLIC , 12.0F, 512, 2, 1|2 , 255, 169, 83, 0, "Ignatius" , "Ignatius" , 0, 0, -1, 0, false, false, 1, 1, 1, Dyes._NULL ); - public static Materials Infernal = new Materials( -1, TextureSet.SET_NONE , 1.0F, 0, 2, 0 , 255, 255, 255, 0, "Infernal" , "Infernal" , 0, 0, -1, 0, false, false, 1, 1, 1, Dyes._NULL ); - public static Materials Infuscolium = new Materials( 490, TextureSet.SET_METALLIC , 6.0F, 64, 2, 1|2 |8 |64 , 146, 33, 86, 0, "Infuscolium" , "Infuscolium" , 0, 0, -1, 0, false, false, 3, 1, 1, Dyes._NULL ); - public static Materials InfusedGold = new Materials( 323, TextureSet.SET_SHINY , 12.0F, 64, 3, 1|2 |8 |64|128 , 255, 200, 60, 0, "InfusedGold" , "Infused Gold" , 0, 0, -1, 0, false, false, 3, 1, 1, Dyes.dyeYellow ); - public static Materials InfusedAir = new Materials( 540, TextureSet.SET_SHARDS , 8.0F, 64, 3, 1 |4|8 |64|128 , 255, 255, 0, 0, "InfusedAir" , "Aer" , 5, 160, -1, 0, false, true, 3, 1, 1, Dyes.dyeYellow , Arrays.asList(new TC_AspectStack(TC_Aspects.PRAECANTATIO, 1), new TC_AspectStack(TC_Aspects.AER, 2))); - public static Materials InfusedFire = new Materials( 541, TextureSet.SET_SHARDS , 8.0F, 64, 3, 1 |4|8 |64|128 , 255, 0, 0, 0, "InfusedFire" , "Ignis" , 5, 320, -1, 0, false, true, 3, 1, 1, Dyes.dyeRed , Arrays.asList(new TC_AspectStack(TC_Aspects.PRAECANTATIO, 1), new TC_AspectStack(TC_Aspects.IGNIS, 2))); - public static Materials InfusedEarth = new Materials( 542, TextureSet.SET_SHARDS , 8.0F, 256, 3, 1 |4|8 |64|128 , 0, 255, 0, 0, "InfusedEarth" , "Terra" , 5, 160, -1, 0, false, true, 3, 1, 1, Dyes.dyeGreen , Arrays.asList(new TC_AspectStack(TC_Aspects.PRAECANTATIO, 1), new TC_AspectStack(TC_Aspects.TERRA, 2))); - public static Materials InfusedWater = new Materials( 543, TextureSet.SET_SHARDS , 8.0F, 64, 3, 1 |4|8 |64|128 , 0, 0, 255, 0, "InfusedWater" , "Aqua" , 5, 160, -1, 0, false, true, 3, 1, 1, Dyes.dyeBlue , Arrays.asList(new TC_AspectStack(TC_Aspects.PRAECANTATIO, 1), new TC_AspectStack(TC_Aspects.AQUA, 2))); - public static Materials InfusedEntropy = new Materials( 544, TextureSet.SET_SHARDS , 32.0F, 64, 4, 1 |4|8 |64|128 , 62, 62, 62, 0, "InfusedEntropy" , "Perditio" , 5, 320, -1, 0, false, true, 3, 1, 1, Dyes.dyeBlack , Arrays.asList(new TC_AspectStack(TC_Aspects.PRAECANTATIO, 1), new TC_AspectStack(TC_Aspects.PERDITIO, 2))); - public static Materials InfusedOrder = new Materials( 545, TextureSet.SET_SHARDS , 8.0F, 64, 3, 1 |4|8 |64|128 , 252, 252, 252, 0, "InfusedOrder" , "Ordo" , 5, 240, -1, 0, false, true, 3, 1, 1, Dyes.dyeWhite , Arrays.asList(new TC_AspectStack(TC_Aspects.PRAECANTATIO, 1), new TC_AspectStack(TC_Aspects.ORDO, 2))); - public static Materials InfusedVis = new Materials( -1, TextureSet.SET_SHARDS , 8.0F, 64, 3, 1 |4|8 |64|128 , 255, 0, 255, 0, "InfusedVis" , "Auram" , 5, 240, -1, 0, false, true, 3, 1, 1, Dyes.dyePurple , Arrays.asList(new TC_AspectStack(TC_Aspects.PRAECANTATIO, 1), new TC_AspectStack(TC_Aspects.AURAM, 2))); - public static Materials InfusedDull = new Materials( -1, TextureSet.SET_SHARDS , 32.0F, 64, 3, 1 |4|8 |64|128 , 100, 100, 100, 0, "InfusedDull" , "Vacuus" , 5, 160, -1, 0, false, true, 3, 1, 1, Dyes.dyeLightGray , Arrays.asList(new TC_AspectStack(TC_Aspects.PRAECANTATIO, 1), new TC_AspectStack(TC_Aspects.VACUOS, 2))); - public static Materials Inolashite = new Materials( 954, TextureSet.SET_NONE , 8.0F, 2304, 3, 1|2 |8 |64 , 148, 216, 187, 0, "Inolashite" , "Inolashite" , 0, 0, -1, 0, false, false, 1, 1, 1, Dyes.dyeGreen ); - public static Materials Invisium = new Materials( -1, TextureSet.SET_NONE , 1.0F, 0, 2, 1 , 255, 255, 255, 0, "Invisium" , "Invisium" , 0, 0, -1, 0, false, false, 3, 1, 1, Dyes._NULL ); - public static Materials Jade = new Materials( 537, TextureSet.SET_SHINY , 1.0F, 16, 2, 1 |4|8 |64 , 0, 100, 0, 0, "Jade" , "Jade" , 0, 0, -1, 0, false, false, 5, 1, 1, Dyes.dyeGreen ,1, Arrays.asList(new MaterialStack(Sodium, 1), new MaterialStack(Aluminium, 1), new MaterialStack(Silicon, 2), new MaterialStack(Oxygen, 6)), Arrays.asList(new TC_AspectStack(TC_Aspects.LUCRUM, 6), new TC_AspectStack(TC_Aspects.VITREUS, 3))); - public static Materials Kalendrite = new Materials( 953, TextureSet.SET_METALLIC , 5.0F, 2560, 3, 1|2 , 170, 91, 189, 0, "Kalendrite" , "Kalendrite" , 0, 0, -1, 0, false, false, 1, 1, 1, Dyes._NULL ); - public static Materials Komatiite = new Materials( 869, TextureSet.SET_DULL , 1.0F, 0, 1, 1 , 255, 255, 255, 0, "Komatiite" , "Komatiite" , 0, 0, -1, 0, false, false, 1, 1, 1, Dyes.dyeYellow ); - public static Materials Lava = new Materials( 700, TextureSet.SET_FLUID , 1.0F, 0, 1, 16 , 255, 64, 0, 0, "Lava" , "Lava" , 0, 0, -1, 0, false, false, 1, 1, 1, Dyes.dyeOrange ); - public static Materials Lemurite = new Materials( 486, TextureSet.SET_METALLIC , 1.0F, 0, 2, 1 , 219, 219, 219, 0, "Lemurite" , "Lemurite" , 0, 0, -1, 0, false, false, 1, 1, 1, Dyes._NULL ); - public static Materials Limestone = new Materials( -1, TextureSet.SET_NONE , 1.0F, 0, 1, 1 , 255, 255, 255, 0, "Limestone" , "Limestone" , 0, 0, -1, 0, false, false, 1, 1, 1, Dyes._NULL ); - public static Materials Magma = new Materials( -1, TextureSet.SET_NONE , 1.0F, 0, 1, 0 , 255, 64, 0, 0, "Magma" , "Magma" , 0, 0, -1, 0, false, false, 1, 1, 1, Dyes.dyeOrange ); - public static Materials Mawsitsit = new Materials( -1, TextureSet.SET_NONE , 1.0F, 0, 1, 1 , 255, 255, 255, 0, "Mawsitsit" , "Mawsitsit" , 0, 0, -1, 0, false, false, 3, 1, 1, Dyes._NULL ); - public static Materials Mercassium = new Materials( -1, TextureSet.SET_NONE , 6.0F, 64, 1, 1|2 |8 |64 , 255, 255, 255, 0, "Mercassium" , "Mercassium" , 0, 0, -1, 0, false, false, 1, 1, 1, Dyes._NULL ); - public static Materials MeteoricIron = new Materials( 340, TextureSet.SET_METALLIC , 6.0F, 384, 3, 1|2 |8 |64 , 100, 50, 80, 0, "MeteoricIron" , "Meteoric Iron" , 0, 0, 1811, 1000, true, false, 1, 1, 1, Dyes.dyeGray ,Element.SpFe, Arrays.asList(new TC_AspectStack(TC_Aspects.METALLUM, 2), new TC_AspectStack(TC_Aspects.MAGNETO, 1))); - public static Materials MeteoricSteel = new Materials( 341, TextureSet.SET_METALLIC , 6.0F, 768, 4, 1|2 |64 , 50, 25, 40, 0, "MeteoricSteel" , "Meteoric Steel" , 0, 0, 1811, 1000, true, false, 4, 51, 50, Dyes.dyeGray , 1, Arrays.asList(new MaterialStack(MeteoricIron, 50), new MaterialStack(Carbon, 1)), Arrays.asList(new TC_AspectStack(TC_Aspects.METALLUM, 2), new TC_AspectStack(TC_Aspects.MAGNETO, 1), new TC_AspectStack(TC_Aspects.ORDO, 1))); - public static Materials Meteorite = new Materials( -1, TextureSet.SET_NONE , 1.0F, 0, 1, 1 |8 , 80, 35, 60, 0, "Meteorite" , "Meteorite" , 0, 0, -1, 0, false, false, 1, 1, 1, Dyes.dyePurple ); - public static Materials Meutoite = new Materials( 487, TextureSet.SET_METALLIC , 1.0F, 0, 1, 1 |8 , 95, 82, 105, 0, "Meutoite" , "Meutoite" , 0, 0, -1, 0, false, false, 1, 1, 1, Dyes._NULL ); - public static Materials Migmatite = new Materials( 872, TextureSet.SET_DULL , 1.0F, 0, 1, 1 , 255, 255, 255, 0, "Migmatite" , "Migmatite" , 0, 0, -1, 0, false, false, 1, 1, 1, Dyes._NULL ); - public static Materials Mimichite = new Materials( -1, TextureSet.SET_GEM_VERTICAL , 1.0F, 0, 1, 1 |4|8 , 255, 255, 255, 0, "Mimichite" , "Mimichite" , 0, 0, -1, 0, false, false, 1, 1, 1, Dyes._NULL ); - public static Materials Moonstone = new Materials( -1, TextureSet.SET_NONE , 1.0F, 0, 1, 1 |8 , 255, 255, 255, 0, "Moonstone" , "Moonstone" , 0, 0, -1, 0, false, false, 3, 1, 1, Dyes.dyeWhite , Arrays.asList(new TC_AspectStack(TC_Aspects.VITREUS, 1), new TC_AspectStack(TC_Aspects.ALIENIS, 1))); - public static Materials Naquadah = new Materials( 324, TextureSet.SET_METALLIC , 6.0F, 1280, 4, 1|2 |8 |64|128 , 50, 50, 50, 0, "Naquadah" , "Naquadah" , 0, 0, 5400, 5400, true, false, 10, 1, 1, Dyes.dyeBlack , Element.Nq, Arrays.asList(new TC_AspectStack(TC_Aspects.METALLUM, 3), new TC_AspectStack(TC_Aspects.RADIO, 1), new TC_AspectStack(TC_Aspects.NEBRISUM, 1))).disableAutoGeneratedBlastFurnaceRecipes(); - public static Materials NaquadahAlloy = new Materials( 325, TextureSet.SET_METALLIC , 8.0F, 5120, 5, 1|2 |64|128 , 40, 40, 40, 0, "NaquadahAlloy" , "Naquadah Alloy" , 0, 0, 7200, 7200, true, false, 10, 1, 1, Dyes.dyeBlack , Arrays.asList(new TC_AspectStack(TC_Aspects.METALLUM, 4), new TC_AspectStack(TC_Aspects.NEBRISUM, 1))).disableAutoGeneratedBlastFurnaceRecipes(); - public static Materials NaquadahEnriched = new Materials( 326, TextureSet.SET_METALLIC , 6.0F, 1280, 4, 1|2 |8 |64 , 50, 50, 50, 0, "NaquadahEnriched" , "Enriched Naquadah" , 0, 0, 4500, 4500, true, false, 15, 1, 1, Dyes.dyeBlack , Arrays.asList(new TC_AspectStack(TC_Aspects.METALLUM, 3), new TC_AspectStack(TC_Aspects.RADIO, 2), new TC_AspectStack(TC_Aspects.NEBRISUM, 2))).disableAutoGeneratedBlastFurnaceRecipes(); - public static Materials Naquadria = new Materials( 327, TextureSet.SET_SHINY , 1.0F, 512, 4, 1|2 |8 |64 , 30, 30, 30, 0, "Naquadria" , "Naquadria" , 0, 0, 9000, 9000, true, false, 20, 1, 1, Dyes.dyeBlack , Arrays.asList(new TC_AspectStack(TC_Aspects.METALLUM, 4), new TC_AspectStack(TC_Aspects.RADIO, 3), new TC_AspectStack(TC_Aspects.NEBRISUM, 3))).disableAutoGeneratedBlastFurnaceRecipes(); - public static Materials Nether = new Materials( -1, TextureSet.SET_NONE , 1.0F, 0, 1, 0 , 255, 255, 255, 0, "Nether" , "Nether" , 0, 0, -1, 0, false, false, 3, 1, 1, Dyes._NULL ); - public static Materials NetherBrick = new Materials( 814, TextureSet.SET_DULL , 1.0F, 0, 1, 1 , 100, 0, 0, 0, "NetherBrick" , "Nether Brick" , 0, 0, -1, 0, false, false, 1, 1, 1, Dyes.dyeRed , Collections.singletonList(new TC_AspectStack(TC_Aspects.IGNIS, 1))); - public static Materials NetherQuartz = new Materials( 522, TextureSet.SET_QUARTZ , 1.0F, 32, 1, 1 |4|8 |64 , 230, 210, 210, 0, "NetherQuartz" , "Nether Quartz" , 0, 0, -1, 0, false, false, 2, 1, 1, Dyes.dyeWhite , Arrays.asList(new TC_AspectStack(TC_Aspects.POTENTIA, 1), new TC_AspectStack(TC_Aspects.VITREUS, 1))); - public static Materials NetherStar = new Materials( 506, TextureSet.SET_NETHERSTAR , 6.0F, 5120, 4, 1| 4|8 |64 , 255, 255, 255, 0, "NetherStar" , "Nether Star" , 5, 50000, -1, 0, false, false, 15, 1, 1, Dyes.dyeWhite ); - public static Materials ObsidianFlux = new Materials( -1, TextureSet.SET_DULL , 1.0F, 0, 1, 1|2 , 80, 50, 100, 0, "ObsidianFlux" , "Fluxed Obsidian" , 0, 0, -1, 0, false, false, 1, 1, 1, Dyes.dyePurple ); - public static Materials Oilsands = new Materials( 878, TextureSet.SET_NONE , 1.0F, 0, 1, 1 |8 , 10, 10, 10, 0, "Oilsands" , "Oilsands" , 0, 0, -1, 0, false, false, 1, 1, 1, Dyes._NULL ); - public static Materials Onyx = new Materials( -1, TextureSet.SET_NONE , 1.0F, 0, 1, 1 , 255, 255, 255, 0, "Onyx" , "Onyx" , 0, 0, -1, 0, false, false, 3, 1, 1, Dyes._NULL ); - public static Materials Orichalcum = new Materials( 966, TextureSet.SET_METALLIC , 32.0F, 20480, 1, 1|2 |8 |64|128 , 84, 122, 56, 0, "Orichalcum" , "Orichalcum" , 0, 0, -1, 0, false, false, 1, 1, 1, Dyes._NULL ).disableAutoGeneratedBlastFurnaceRecipes().setTurbineMultipliers(1, 6, 1); - public static Materials Osmonium = new Materials( -1, TextureSet.SET_NONE , 6.0F, 64, 1, 1|2 |8 |64 , 255, 255, 255, 0, "Osmonium" , "Osmonium" , 0, 0, -1, 0, false, false, 3, 1, 1, Dyes.dyeBlue ); - public static Materials Oureclase = new Materials( 961, TextureSet.SET_METALLIC , 6.0F, 1920, 3, 1|2 |8 |64 , 183, 98, 21, 0, "Oureclase" , "Oureclase" , 0, 0, -1, 0, false, false, 1, 1, 1, Dyes._NULL ); - public static Materials Painite = new Materials( -1, TextureSet.SET_NONE , 1.0F, 0, 1, 0 , 255, 255, 255, 0, "Painite" , "Painite" , 0, 0, -1, 0, false, false, 3, 1, 1, Dyes._NULL ); - public static Materials Peanutwood = new Materials( -1, TextureSet.SET_NONE , 1.0F, 0, 1, 0 , 255, 255, 255, 0, "Peanutwood" , "Peanut Wood" , 0, 0, -1, 0, false, false, 3, 1, 1, Dyes._NULL ); - public static Materials Petroleum = new Materials( -1, TextureSet.SET_NONE , 1.0F, 0, 1, 1 |8 , 255, 255, 255, 0, "Petroleum" , "Petroleum" , 0, 0, -1, 0, false, false, 1, 1, 1, Dyes._NULL ); - public static Materials Pewter = new Materials( -1, TextureSet.SET_NONE , 1.0F, 0, 1, 0 , 255, 255, 255, 0, "Pewter" , "Pewter" , 0, 0, -1, 0, false, false, 3, 1, 1, Dyes._NULL ); - public static Materials Phoenixite = new Materials( -1, TextureSet.SET_NONE , 6.0F, 64, 1, 1|2 |8 |64 , 255, 255, 255, 0, "Phoenixite" , "Phoenixite" , 0, 0, -1, 0, false, false, 3, 1, 1, Dyes._NULL ); - public static Materials Prometheum = new Materials( 960, TextureSet.SET_METALLIC , 8.0F, 512, 1, 1|2 |8 |64 , 90, 129, 86, 0, "Prometheum" , "Prometheum" , 0, 0, -1, 0, false, false, 1, 1, 1, Dyes._NULL ); - public static Materials Quartzite = new Materials( 523, TextureSet.SET_QUARTZ , 1.0F, 0, 1, 1 |4|8 , 210, 230, 210, 0, "Quartzite" , "Quartzite" , 0, 0, -1, 0, false, false, 3, 1, 1, Dyes.dyeWhite ); - public static Materials Randomite = new Materials( -1, TextureSet.SET_NONE , 1.0F, 0, 1, 1 |8 , 255, 255, 255, 0, "Randomite" , "Randomite" , 0, 0, -1, 0, false, false, 1, 1, 1, Dyes._NULL ); - public static Materials Rhyolite = new Materials( 875, TextureSet.SET_DULL , 1.0F, 0, 1, 1 , 255, 255, 255, 0, "Rhyolite" , "Rhyolite" , 0, 0, -1, 0, false, false, 1, 1, 1, Dyes._NULL ); - public static Materials Rubracium = new Materials( 488, TextureSet.SET_METALLIC , 1.0F, 128, 1, 1|2 |8 |64|128 , 151, 45, 45, 0, "Rubracium" , "Rubracium" , 0, 0, -1, 0, false, false, 1, 1, 1, Dyes.dyeRed ); - public static Materials Sand = new Materials( -1, TextureSet.SET_NONE , 1.0F, 0, 1, 0 , 255, 255, 255, 0, "Sand" , "Sand" , 0, 0, -1, 0, false, false, 1, 1, 1, Dyes.dyeYellow ); - public static Materials Sanguinite = new Materials( 955, TextureSet.SET_METALLIC , 3.0F, 4480, 4, 1|2 |8 , 185, 0, 0, 0, "Sanguinite" , "Sanguinite" , 0, 0, -1, 0, false, false, 1, 1, 1, Dyes._NULL ); - public static Materials Siltstone = new Materials( 876, TextureSet.SET_DULL , 1.0F, 0, 1, 1 , 255, 255, 255, 0, "Siltstone" , "Siltstone" , 0, 0, -1, 0, false, false, 1, 1, 1, Dyes._NULL ); - public static Materials Sunstone = new Materials( -1, TextureSet.SET_NONE , 1.0F, 0, 1, 1 |8 , 255, 255, 255, 0, "Sunstone" , "Sunstone" , 0, 0, -1, 0, false, false, 3, 1, 1, Dyes.dyeYellow , Arrays.asList(new TC_AspectStack(TC_Aspects.VITREUS, 1), new TC_AspectStack(TC_Aspects.ALIENIS, 1))); - public static Materials Tar = new Materials( -1, TextureSet.SET_NONE , 1.0F, 0, 1, 0 , 10, 10, 10, 0, "Tar" , "Tar" , 0, 0, -1, 0, false, false, 1, 1, 1, Dyes.dyeBlack ); - public static Materials Tartarite = new Materials( 956, TextureSet.SET_METALLIC , 32.0F, 20480, 3, 1|2 |8 , 255, 118, 60, 0, "Tartarite" , "Tartarite" , 0, 0, -1, 0, false, false, 1, 1, 1, Dyes._NULL ).disableAutoGeneratedBlastFurnaceRecipes().setTurbineMultipliers(1120, 1120, 1); - public static Materials UUAmplifier = new Materials( 721, TextureSet.SET_FLUID , 1.0F, 0, 1, 16 , 96, 0, 128, 0, "UUAmplifier" , "UU-Amplifier" , 0, 0, -1, 0, false, false, 10, 1, 1, Dyes.dyePink ); - public static Materials UUMatter = new Materials( 703, TextureSet.SET_FLUID , 1.0F, 0, 1, 16 , 128, 0, 196, 0, "UUMatter" , "UU-Matter" , 0, 0, -1, 0, false, false, 10, 1, 1, Dyes.dyePink ); - public static Materials Void = new Materials( 970, TextureSet.SET_METALLIC , 32.0F, 512, 4, 1|2 |64|128 , 28, 6, 57, 0, "Void" , "Void" , 5, 1500, -1, 0, false, true, 5, 2, 1, Dyes.dyeBlack , Collections.singletonList(new TC_AspectStack(TC_Aspects.VACUOS, 1))); - public static Materials Voidstone = new Materials( -1, TextureSet.SET_NONE , 1.0F, 0, 1, 0 , 255, 255, 255, 200, "Voidstone" , "Voidstone" , 0, 0, -1, 0, false, true, 1, 1, 1, Dyes._NULL , Arrays.asList(new TC_Aspects.TC_AspectStack(TC_Aspects.VITREUS, 1), new TC_AspectStack(TC_Aspects.VACUOS, 1))); - public static Materials Vulcanite = new Materials( 489, TextureSet.SET_METALLIC , 32.0F, 20480, 2, 1|2 |8 |64|128 , 255, 132, 72, 0, "Vulcanite" , "Vulcanite" , 0, 0, -1, 0, false, false, 1, 1, 1, Dyes._NULL ).disableAutoGeneratedBlastFurnaceRecipes().setTurbineMultipliers(40, 1, 1); - public static Materials Vyroxeres = new Materials( 951, TextureSet.SET_METALLIC , 32.0F, 7680, 1, 1|2 |8 |64 , 85, 224, 1, 0, "Vyroxeres" , "Vyroxeres" , 0, 0, -1, 0, false, false, 1, 1, 1, Dyes._NULL ).disableAutoGeneratedBlastFurnaceRecipes().setTurbineMultipliers(1, 3, 1); - public static Materials Yellorium = new Materials( -1, TextureSet.SET_NONE , 1.0F, 0, 2, 1|2 , 255, 255, 255, 0, "Yellorium" , "Yellorium" , 0, 0, -1, 0, false, false, 3, 1, 1, Dyes.dyeYellow ); - public static Materials Zectium = new Materials( -1, TextureSet.SET_NONE , 1.0F, 0, 2, 1|2 |8 , 255, 255, 255, 0, "Zectium" , "Zectium" , 0, 0, -1, 0, false, false, 3, 1, 1, Dyes.dyeBlack ); + public static Materials Adamantium = new Materials( + 319, + TextureSet.SET_SHINY, + 32.0F, + 8192, + 10, + 1 | 2 | 8 | 64 | 128, + 255, + 255, + 255, + 0, + "Adamantium", + "Adamantium", + 0, + 0, + 7200, + 7200, + true, + false, + 1, + 1, + 1, + Dyes.dyeLightGray) + .setTurbineMultipliers(1, 5, 1); + + public static Materials Adamite = new Materials( + -1, + TextureSet.SET_NONE, + 1.0F, + 0, + 3, + 1 | 8, + 255, + 255, + 255, + 0, + "Adamite", + "Adamite", + 0, + 0, + -1, + 0, + false, + false, + 1, + 1, + 1, + Dyes.dyeLightGray); + public static Materials Adluorite = new Materials( + -1, + TextureSet.SET_NONE, + 1.0F, + 0, + 2, + 1 | 2 | 8 | 64 | 128, + 255, + 255, + 255, + 0, + "Adluorite", + "Adluorite", + 0, + 0, + -1, + 0, + false, + false, + 1, + 1, + 1, + Dyes.dyeLightBlue); + public static Materials Agate = new Materials( + -1, + TextureSet.SET_NONE, + 1.0F, + 0, + 2, + 1, + 255, + 255, + 255, + 0, + "Agate", + "Agate", + 0, + 0, + -1, + 0, + false, + false, + 3, + 1, + 1, + Dyes._NULL); + public static Materials Alduorite = new Materials( + 485, + TextureSet.SET_SHINY, + 32.0F, + 8192, + 1, + 1 | 2 | 8 | 64 | 128, + 159, + 180, + 180, + 0, + "Alduorite", + "Alduorite", + 0, + 0, + -1, + 0, + false, + false, + 1, + 1, + 1, + Dyes._NULL) + .disableAutoGeneratedBlastFurnaceRecipes() + .setTurbineMultipliers(6, 1, 1); + public static Materials Amber = new Materials( + 514, + TextureSet.SET_RUBY, + 4.0F, + 128, + 2, + 1 | 4 | 8 | 64, + 255, + 128, + 0, + 127, + "Amber", + "Amber", + 5, + 3, + -1, + 0, + false, + true, + 1, + 1, + 1, + Dyes.dyeOrange, + 1, + Arrays.asList( + new MaterialStack(Carbon, 10), new MaterialStack(Hydrogen, 10), new MaterialStack(Oxygen, 16)), + Arrays.asList(new TC_AspectStack(TC_Aspects.VINCULUM, 2), new TC_AspectStack(TC_Aspects.VITREUS, 1))); + public static Materials Ammonium = new Materials( + -1, + TextureSet.SET_NONE, + 1.0F, + 0, + 2, + 1, + 255, + 255, + 255, + 0, + "Ammonium", + "Ammonium", + 0, + 0, + -1, + 0, + false, + false, + 1, + 1, + 1, + Dyes._NULL); + public static Materials Amordrine = new Materials( + -1, + TextureSet.SET_NONE, + 6.0F, + 64, + 2, + 1 | 2 | 8 | 64, + 255, + 255, + 255, + 0, + "Amordrine", + "Amordrine", + 0, + 0, + -1, + 0, + false, + false, + 1, + 1, + 1, + Dyes._NULL); + public static Materials Andesite = new Materials( + -1, + TextureSet.SET_NONE, + 1.0F, + 0, + 2, + 1 | 8, + 255, + 255, + 255, + 0, + "Andesite", + "Andesite", + 0, + 0, + -1, + 0, + false, + false, + 1, + 1, + 1, + Dyes._NULL); + public static Materials Angmallen = new Materials( + 958, + TextureSet.SET_METALLIC, + 10.0F, + 128, + 2, + 1 | 2 | 8 | 64, + 215, + 225, + 138, + 0, + "Angmallen", + "Angmallen", + 0, + 0, + -1, + 0, + false, + false, + 1, + 1, + 1, + Dyes._NULL); + public static Materials Ardite = new Materials( + 382, + TextureSet.SET_METALLIC, + 18.0F, + 1024, + 4, + 1 | 2 | 8 | 32 | 64 | 128, + 250, + 129, + 0, + 0, + "Ardite", + "Ardite", + 0, + 0, + 1600, + 1600, + true, + false, + 1, + 1, + 1, + Dyes.dyeRed) + .disableAutoGeneratedBlastFurnaceRecipes(); + public static Materials Aredrite = new Materials( + -1, + TextureSet.SET_NONE, + 6.0F, + 64, + 2, + 1 | 2 | 8 | 64, + 255, + 0, + 0, + 0, + "Aredrite", + "Aredrite", + 0, + 0, + -1, + 0, + false, + false, + 1, + 1, + 1, + Dyes.dyeYellow); + public static Materials Atlarus = new Materials( + 965, + TextureSet.SET_METALLIC, + 6.0F, + 64, + 2, + 1 | 2 | 8 | 64, + 255, + 255, + 255, + 0, + "Atlarus", + "Atlarus", + 0, + 0, + -1, + 0, + false, + false, + 1, + 1, + 1, + Dyes._NULL); + public static Materials Bitumen = new Materials( + -1, + TextureSet.SET_NONE, + 1.0F, + 0, + 2, + 1 | 8, + 255, + 255, + 255, + 0, + "Bitumen", + "Bitumen", + 0, + 0, + -1, + 0, + false, + false, + 1, + 1, + 1, + Dyes._NULL); + public static Materials Black = new Materials( + -1, + TextureSet.SET_NONE, + 1.0F, + 0, + 2, + 0, + 0, + 0, + 0, + 0, + "Black", + "Black", + 0, + 0, + -1, + 0, + false, + false, + 3, + 1, + 1, + Dyes.dyeBlack); + public static Materials Blizz = new Materials( + 851, + TextureSet.SET_SHINY, + 1.0F, + 0, + 2, + 1, + 220, + 233, + 255, + 0, + "Blizz", + "Blizz", + 0, + 0, + -1, + 0, + false, + false, + 3, + 1, + 1, + Dyes._NULL); + public static Materials Blueschist = new Materials( + 852, + TextureSet.SET_DULL, + 1.0F, + 0, + 2, + 1, + 255, + 255, + 255, + 0, + "Blueschist", + "Blueschist", + 0, + 0, + -1, + 0, + false, + false, + 0, + 1, + 1, + Dyes.dyeLightBlue); + public static Materials Bluestone = new Materials( + 813, + TextureSet.SET_DULL, + 1.0F, + 0, + 2, + 1, + 255, + 255, + 255, + 0, + "Bluestone", + "Bluestone", + 0, + 0, + -1, + 0, + false, + false, + 1, + 1, + 1, + Dyes.dyeBlue); + public static Materials Bloodstone = new Materials( + -1, + TextureSet.SET_NONE, + 1.0F, + 0, + 2, + 1, + 255, + 255, + 255, + 0, + "Bloodstone", + "Bloodstone", + 0, + 0, + -1, + 0, + false, + false, + 3, + 1, + 1, + Dyes.dyeRed); + public static Materials Blutonium = new Materials( + -1, + TextureSet.SET_SHINY, + 1.0F, + 0, + 2, + 1 | 2 | 8, + 0, + 0, + 255, + 0, + "Blutonium", + "Blutonium", + 0, + 0, + -1, + 0, + false, + false, + 3, + 1, + 1, + Dyes.dyeBlue); + public static Materials Carmot = new Materials( + 962, + TextureSet.SET_METALLIC, + 16.0F, + 128, + 1, + 1 | 2 | 8 | 64, + 217, + 205, + 140, + 0, + "Carmot", + "Carmot", + 0, + 0, + -1, + 0, + false, + false, + 1, + 1, + 1, + Dyes._NULL); + public static Materials Celenegil = new Materials( + 964, + TextureSet.SET_METALLIC, + 10.0F, + 4096, + 2, + 1 | 2 | 8 | 64, + 148, + 204, + 72, + 0, + "Celenegil", + "Celenegil", + 0, + 0, + -1, + 0, + false, + false, + 1, + 1, + 1, + Dyes._NULL); + public static Materials CertusQuartz = new Materials( + 516, + TextureSet.SET_QUARTZ, + 5.0F, + 32, + 1, + 1 | 4 | 8 | 64, + 210, + 210, + 230, + 0, + "CertusQuartz", + "Certus Quartz", + 0, + 0, + -1, + 0, + false, + false, + 3, + 1, + 1, + Dyes.dyeLightGray, + Arrays.asList(new TC_AspectStack(TC_Aspects.POTENTIA, 1), new TC_AspectStack(TC_Aspects.VITREUS, 1))); + public static Materials Ceruclase = new Materials( + 952, + TextureSet.SET_METALLIC, + 32.0F, + 1280, + 2, + 1 | 2 | 8 | 64 | 128, + 140, + 189, + 208, + 0, + "Ceruclase", + "Ceruclase", + 0, + 0, + -1, + 0, + false, + false, + 1, + 1, + 1, + Dyes.dyeBlue) + .disableAutoGeneratedBlastFurnaceRecipes() + .setTurbineMultipliers(1, 22, 1); + public static Materials Citrine = new Materials( + -1, + TextureSet.SET_NONE, + 1.0F, + 0, + 2, + 1, + 255, + 255, + 255, + 0, + "Citrine", + "Citrine", + 0, + 0, + -1, + 0, + false, + false, + 3, + 1, + 1, + Dyes._NULL); + public static Materials CobaltHexahydrate = new Materials( + 853, + TextureSet.SET_METALLIC, + 1.0F, + 0, + 2, + 1 | 16, + 80, + 80, + 250, + 0, + "CobaltHexahydrate", + "Cobalt Hexahydrate", + 0, + 0, + -1, + 0, + false, + false, + 1, + 1, + 1, + Dyes.dyeBlue); + public static Materials ConstructionFoam = new Materials( + 854, + TextureSet.SET_DULL, + 1.0F, + 0, + 2, + 1 | 16 | 64 | 128, + 128, + 128, + 128, + 0, + "ConstructionFoam", + "Construction Foam", + 0, + 0, + -1, + 0, + false, + false, + 1, + 1, + 1, + Dyes.dyeGray); + public static Materials Chert = new Materials( + 857, + TextureSet.SET_DULL, + 1.0F, + 0, + 2, + 1, + 255, + 255, + 255, + 0, + "Chert", + "Chert", + 0, + 0, + -1, + 0, + false, + false, + 0, + 1, + 1, + Dyes._NULL); + public static Materials Chimerite = new Materials( + -1, + TextureSet.SET_NONE, + 1.0F, + 0, + 2, + 1, + 255, + 255, + 255, + 0, + "Chimerite", + "Chimerite", + 0, + 0, + -1, + 0, + false, + false, + 3, + 1, + 1, + Dyes._NULL); + public static Materials Coral = new Materials( + -1, + TextureSet.SET_NONE, + 1.0F, + 0, + 1, + 1, + 255, + 128, + 255, + 0, + "Coral", + "Coral", + 0, + 0, + -1, + 0, + false, + false, + 3, + 1, + 1, + Dyes._NULL); + public static Materials CrudeOil = new Materials( + 858, + TextureSet.SET_DULL, + 1.0F, + 0, + 2, + 1, + 10, + 10, + 10, + 0, + "CrudeOil", + "Crude Oil", + 0, + 0, + -1, + 0, + false, + false, + 1, + 1, + 1, + Dyes.dyeBlack); + public static Materials Chrysocolla = new Materials( + -1, + TextureSet.SET_NONE, + 1.0F, + 0, + 2, + 1, + 255, + 255, + 255, + 0, + "Chrysocolla", + "Chrysocolla", + 0, + 0, + -1, + 0, + false, + false, + 3, + 1, + 1, + Dyes._NULL); + public static Materials CrystalFlux = new Materials( + -1, + TextureSet.SET_QUARTZ, + 1.0F, + 0, + 3, + 1 | 4, + 100, + 50, + 100, + 0, + "CrystalFlux", + "Flux Crystal", + 0, + 0, + -1, + 0, + false, + false, + 1, + 1, + 1, + Dyes._NULL); + public static Materials Cyanite = new Materials( + -1, + TextureSet.SET_NONE, + 1.0F, + 0, + 2, + 1, + 255, + 255, + 255, + 0, + "Cyanite", + "Cyanite", + 0, + 0, + -1, + 0, + false, + false, + 3, + 1, + 1, + Dyes.dyeCyan); + public static Materials Dacite = new Materials( + 859, + TextureSet.SET_DULL, + 1.0F, + 0, + 2, + 1, + 255, + 255, + 255, + 0, + "Dacite", + "Dacite", + 0, + 0, + -1, + 0, + false, + false, + 0, + 1, + 1, + Dyes.dyeLightGray); + public static Materials DarkIron = new Materials( + 342, + TextureSet.SET_DULL, + 7.0F, + 384, + 3, + 1 | 2 | 8 | 64, + 55, + 40, + 60, + 0, + "DarkIron", + "Dark Iron", + 0, + 0, + -1, + 0, + false, + false, + 5, + 1, + 1, + Dyes.dyePurple); + public static Materials DarkStone = new Materials( + -1, + TextureSet.SET_NONE, + 1.0F, + 0, + 2, + 1, + 255, + 255, + 255, + 0, + "DarkStone", + "Dark Stone", + 0, + 0, + -1, + 0, + false, + false, + 3, + 1, + 1, + Dyes.dyeBlack); + public static Materials Demonite = new Materials( + -1, + TextureSet.SET_NONE, + 1.0F, + 0, + 2, + 1, + 255, + 255, + 255, + 0, + "Demonite", + "Demonite", + 0, + 0, + -1, + 0, + false, + false, + 3, + 1, + 1, + Dyes.dyeRed); + public static Materials Desh = new Materials( + 884, + TextureSet.SET_DULL, + 20.0F, + 1280, + 4, + 1 | 2 | 8 | 64 | 128, + 40, + 40, + 40, + 0, + "Desh", + "Desh", + 0, + 0, + 2500, + 2500, + true, + false, + 1, + 1, + 1, + Dyes.dyeBlack, + Element.De, + Arrays.asList( + new TC_AspectStack(TC_Aspects.METALLUM, 2), new TC_AspectStack(TC_Aspects.ALIENIS, 1))) + .disableAutoGeneratedBlastFurnaceRecipes(); + public static Materials Desichalkos = new Materials( + -1, + TextureSet.SET_NONE, + 6.0F, + 1280, + 3, + 1 | 2 | 8 | 64, + 255, + 255, + 255, + 0, + "Desichalkos", + "Desichalkos", + 0, + 0, + -1, + 0, + false, + false, + 1, + 1, + 1, + Dyes._NULL); + public static Materials Dilithium = new Materials( + 515, + TextureSet.SET_DIAMOND, + 1.0F, + 0, + 1, + 1 | 4 | 8 | 16, + 255, + 250, + 250, + 127, + "Dilithium", + "Dilithium", + 0, + 0, + -1, + 0, + false, + true, + 1, + 1, + 1, + Dyes.dyeWhite); + public static Materials Draconic = new Materials( + -1, + TextureSet.SET_NONE, + 1.0F, + 0, + 2, + 1, + 255, + 255, + 255, + 0, + "Draconic", + "Draconic", + 0, + 0, + -1, + 0, + false, + false, + 1, + 1, + 1, + Dyes.dyeRed); + public static Materials Drulloy = new Materials( + -1, + TextureSet.SET_NONE, + 1.0F, + 0, + 2, + 1 | 16, + 255, + 255, + 255, + 0, + "Drulloy", + "Drulloy", + 0, + 0, + -1, + 0, + false, + false, + 1, + 1, + 1, + Dyes.dyeRed); + public static Materials Duranium = new Materials( + 328, + TextureSet.SET_METALLIC, + 32.0F, + 40960, + 11, + 1 | 2 | 64, + 255, + 255, + 255, + 0, + "Duranium", + "Duranium", + 0, + 0, + -1, + 0, + false, + false, + 1, + 1, + 1, + Dyes.dyeLightGray) + .setTurbineMultipliers(16, 16, 1); + public static Materials Eclogite = new Materials( + 860, + TextureSet.SET_DULL, + 1.0F, + 0, + 2, + 1, + 255, + 255, + 255, + 0, + "Eclogite", + "Eclogite", + 0, + 0, + -1, + 0, + false, + false, + 1, + 1, + 1, + Dyes._NULL); + public static Materials ElectrumFlux = new Materials( + 320, + TextureSet.SET_SHINY, + 16.0F, + 512, + 3, + 1 | 2 | 8 | 64 | 128, + 255, + 255, + 120, + 0, + "ElectrumFlux", + "Fluxed Electrum", + 0, + 0, + 9000, + 9000, + true, + false, + 1, + 1, + 1, + Dyes.dyeYellow) + .disableAutoGeneratedBlastFurnaceRecipes(); + public static Materials Emery = new Materials( + 861, + TextureSet.SET_DULL, + 1.0F, + 0, + 2, + 1 | 8, + 255, + 255, + 255, + 0, + "Emery", + "Emery", + 0, + 0, + -1, + 0, + false, + false, + 1, + 1, + 1, + Dyes._NULL); + public static Materials EnderiumBase = new Materials( + 380, + TextureSet.SET_DULL, + 16.0F, + 768, + 4, + 1 | 2 | 64 | 128, + 72, + 119, + 153, + 0, + "EnderiumBase", + "Enderium Base", + 0, + 0, + 3600, + 3600, + true, + false, + 1, + 1, + 1, + Dyes.dyeGreen, + 1, + Arrays.asList( + new MaterialStack(Tin, 2), new MaterialStack(Silver, 1), new MaterialStack(Platinum, 1)), + Arrays.asList( + new TC_AspectStack(TC_Aspects.METALLUM, 2), new TC_AspectStack(TC_Aspects.ALIENIS, 1))) + .disableAutoGeneratedBlastFurnaceRecipes(); + public static Materials Energized = new Materials( + -1, + TextureSet.SET_NONE, + 1.0F, + 0, + 2, + 0, + 255, + 255, + 255, + 0, + "Energized", + "Energized", + 0, + 0, + -1, + 0, + false, + false, + 1, + 1, + 1, + Dyes._NULL); + public static Materials Epidote = new Materials( + 862, + TextureSet.SET_DULL, + 1.0F, + 0, + 2, + 1, + 255, + 255, + 255, + 0, + "Epidote", + "Epidote", + 0, + 0, + -1, + 0, + false, + false, + 0, + 1, + 1, + Dyes._NULL); + public static Materials Eximite = new Materials( + 959, + TextureSet.SET_METALLIC, + 5.0F, + 2560, + 3, + 1 | 2 | 8 | 64, + 124, + 90, + 150, + 0, + "Eximite", + "Eximite", + 0, + 0, + -1, + 0, + false, + false, + 1, + 1, + 1, + Dyes._NULL); + public static Materials FierySteel = new Materials( + 346, + TextureSet.SET_FIERY, + 8.0F, + 256, + 3, + 1 | 2 | 64 | 128, + 64, + 0, + 0, + 0, + "FierySteel", + "Fiery Steel", + 5, + 2048, + 1811, + 1800, + true, + false, + 1, + 1, + 1, + Dyes.dyeRed, + Arrays.asList( + new TC_AspectStack(TC_Aspects.PRAECANTATIO, 3), + new TC_AspectStack(TC_Aspects.IGNIS, 3), + new TC_AspectStack(TC_Aspects.CORPUS, 3))) + .disableAutoGeneratedBlastFurnaceRecipes(); + public static Materials Firestone = new Materials( + 347, + TextureSet.SET_QUARTZ, + 6.0F, + 1280, + 3, + 1 | 4 | 8 | 64, + 200, + 20, + 0, + 0, + "Firestone", + "Firestone", + 0, + 0, + -1, + 0, + false, + false, + 3, + 1, + 1, + Dyes.dyeRed); + public static Materials Fluorite = new Materials( + -1, + TextureSet.SET_NONE, + 1.0F, + 0, + 2, + 1 | 8, + 255, + 255, + 255, + 0, + "Fluorite", + "Fluorite", + 0, + 0, + -1, + 0, + false, + false, + 3, + 1, + 1, + Dyes.dyeGreen); + public static Materials FoolsRuby = new Materials( + 512, + TextureSet.SET_RUBY, + 1.0F, + 0, + 2, + 1 | 4 | 8, + 255, + 100, + 100, + 127, + "FoolsRuby", + "Ruby", + 0, + 0, + -1, + 0, + false, + true, + 3, + 1, + 1, + Dyes.dyeRed, + 1, + Arrays.asList( + new MaterialStack(Magnesium, 1), new MaterialStack(Aluminium, 2), new MaterialStack(Oxygen, 4)), + Arrays.asList(new TC_AspectStack(TC_Aspects.LUCRUM, 2), new TC_AspectStack(TC_Aspects.VITREUS, 2))); + public static Materials Force = new Materials( + 521, + TextureSet.SET_DIAMOND, + 10.0F, + 128, + 3, + 1 | 2 | 4 | 8 | 64 | 128, + 255, + 255, + 0, + 0, + "Force", + "Force", + 0, + 0, + -1, + 0, + false, + false, + 3, + 1, + 1, + Dyes.dyeYellow, + Collections.singletonList(new TC_AspectStack(TC_Aspects.POTENTIA, 5))); + public static Materials Forcicium = new Materials( + 518, + TextureSet.SET_DIAMOND, + 1.0F, + 0, + 1, + 1 | 4 | 8 | 16, + 50, + 50, + 70, + 0, + "Forcicium", + "Forcicium", + 0, + 0, + -1, + 0, + false, + false, + 3, + 1, + 1, + Dyes.dyeGreen, + Collections.singletonList(new TC_AspectStack(TC_Aspects.POTENTIA, 2))); + public static Materials Forcillium = new Materials( + 519, + TextureSet.SET_DIAMOND, + 1.0F, + 0, + 1, + 1 | 4 | 8 | 16, + 50, + 50, + 70, + 0, + "Forcillium", + "Forcillium", + 0, + 0, + -1, + 0, + false, + false, + 3, + 1, + 1, + Dyes.dyeGreen, + Collections.singletonList(new TC_AspectStack(TC_Aspects.POTENTIA, 2))); + public static Materials Gabbro = new Materials( + 863, + TextureSet.SET_DULL, + 1.0F, + 0, + 1, + 1, + 255, + 255, + 255, + 0, + "Gabbro", + "Gabbro", + 0, + 0, + -1, + 0, + false, + false, + 0, + 1, + 1, + Dyes._NULL); + public static Materials Glowstone = new Materials( + 811, + TextureSet.SET_SHINY, + 1.0F, + 0, + 1, + 1 | 16, + 255, + 255, + 0, + 0, + "Glowstone", + "Glowstone", + 0, + 0, + -1, + 0, + false, + false, + 1, + 1, + 1, + Dyes.dyeYellow, + Arrays.asList(new TC_AspectStack(TC_Aspects.LUX, 2), new TC_AspectStack(TC_Aspects.SENSUS, 1))); + public static Materials Gneiss = new Materials( + 864, + TextureSet.SET_DULL, + 1.0F, + 0, + 1, + 1, + 255, + 255, + 255, + 0, + "Gneiss", + "Gneiss", + 0, + 0, + -1, + 0, + false, + false, + 0, + 1, + 1, + Dyes._NULL); + public static Materials Graphite = new Materials( + 865, + TextureSet.SET_DULL, + 5.0F, + 32, + 2, + 1 | 8 | 16 | 64, + 128, + 128, + 128, + 0, + "Graphite", + "Graphite", + 0, + 0, + -1, + 0, + false, + false, + 3, + 1, + 1, + Dyes.dyeGray, + 0, + Collections.singletonList(new MaterialStack(Carbon, 1)), + Arrays.asList(new TC_AspectStack(TC_Aspects.VITREUS, 2), new TC_AspectStack(TC_Aspects.IGNIS, 1))); + public static Materials Graphene = new Materials( + 819, + TextureSet.SET_DULL, + 6.0F, + 32, + 1, + 1 | 64, + 128, + 128, + 128, + 0, + "Graphene", + "Graphene", + 0, + 0, + -1, + 0, + false, + false, + 3, + 1, + 1, + Dyes.dyeGray, + 0, + Collections.singletonList(new MaterialStack(Carbon, 1)), + Arrays.asList(new TC_AspectStack(TC_Aspects.VITREUS, 2), new TC_AspectStack(TC_Aspects.ELECTRUM, 1))); + public static Materials Greenschist = new Materials( + 866, + TextureSet.SET_DULL, + 1.0F, + 0, + 1, + 1, + 255, + 255, + 255, + 0, + "Greenschist", + "Green Schist", + 0, + 0, + -1, + 0, + false, + false, + 1, + 1, + 1, + Dyes.dyeGreen); + public static Materials Greenstone = new Materials( + 867, + TextureSet.SET_DULL, + 1.0F, + 0, + 1, + 1, + 255, + 255, + 255, + 0, + "Greenstone", + "Greenstone", + 0, + 0, + -1, + 0, + false, + false, + 1, + 1, + 1, + Dyes.dyeGreen); + public static Materials Greywacke = new Materials( + 897, + TextureSet.SET_DULL, + 1.0F, + 0, + 1, + 1, + 255, + 255, + 255, + 0, + "Greywacke", + "Greywacke", + 0, + 0, + -1, + 0, + false, + false, + 1, + 1, + 1, + Dyes.dyeGray); + public static Materials Haderoth = new Materials( + 963, + TextureSet.SET_METALLIC, + 10.0F, + 3200, + 3, + 1 | 2 | 8 | 64, + 119, + 52, + 30, + 0, + "Haderoth", + "Haderoth", + 0, + 0, + -1, + 0, + false, + false, + 1, + 1, + 1, + Dyes._NULL); + public static Materials Hematite = new Materials( + -1, + TextureSet.SET_NONE, + 1.0F, + 0, + 2, + 1 | 2 | 8, + 255, + 255, + 255, + 0, + "Hematite", + "Hematite", + 0, + 0, + -1, + 0, + false, + false, + 3, + 1, + 1, + Dyes._NULL); + public static Materials Hepatizon = new Materials( + 957, + TextureSet.SET_METALLIC, + 12.0F, + 128, + 2, + 1 | 2 | 8 | 64, + 117, + 94, + 117, + 0, + "Hepatizon", + "Hepatizon", + 0, + 0, + -1, + 0, + false, + false, + 1, + 1, + 1, + Dyes._NULL); + public static Materials HSLA = new Materials( + 322, + TextureSet.SET_METALLIC, + 6.0F, + 500, + 3, + 1 | 2 | 64 | 128, + 128, + 128, + 128, + 0, + "HSLA", + "HSLA Steel", + 0, + 0, + 1811, + 1000, + true, + false, + 3, + 1, + 1, + Dyes._NULL, + Arrays.asList(new TC_AspectStack(TC_Aspects.METALLUM, 1), new TC_AspectStack(TC_Aspects.ORDO, 1))); + public static Materials Ignatius = new Materials( + 950, + TextureSet.SET_METALLIC, + 12.0F, + 512, + 2, + 1 | 2, + 255, + 169, + 83, + 0, + "Ignatius", + "Ignatius", + 0, + 0, + -1, + 0, + false, + false, + 1, + 1, + 1, + Dyes._NULL); + public static Materials Infernal = new Materials( + -1, + TextureSet.SET_NONE, + 1.0F, + 0, + 2, + 0, + 255, + 255, + 255, + 0, + "Infernal", + "Infernal", + 0, + 0, + -1, + 0, + false, + false, + 1, + 1, + 1, + Dyes._NULL); + public static Materials Infuscolium = new Materials( + 490, + TextureSet.SET_METALLIC, + 6.0F, + 64, + 2, + 1 | 2 | 8 | 64, + 146, + 33, + 86, + 0, + "Infuscolium", + "Infuscolium", + 0, + 0, + -1, + 0, + false, + false, + 3, + 1, + 1, + Dyes._NULL); + public static Materials InfusedGold = new Materials( + 323, + TextureSet.SET_SHINY, + 12.0F, + 64, + 3, + 1 | 2 | 8 | 64 | 128, + 255, + 200, + 60, + 0, + "InfusedGold", + "Infused Gold", + 0, + 0, + -1, + 0, + false, + false, + 3, + 1, + 1, + Dyes.dyeYellow); + public static Materials InfusedAir = new Materials( + 540, + TextureSet.SET_SHARDS, + 8.0F, + 64, + 3, + 1 | 4 | 8 | 64 | 128, + 255, + 255, + 0, + 0, + "InfusedAir", + "Aer", + 5, + 160, + -1, + 0, + false, + true, + 3, + 1, + 1, + Dyes.dyeYellow, + Arrays.asList(new TC_AspectStack(TC_Aspects.PRAECANTATIO, 1), new TC_AspectStack(TC_Aspects.AER, 2))); + public static Materials InfusedFire = new Materials( + 541, + TextureSet.SET_SHARDS, + 8.0F, + 64, + 3, + 1 | 4 | 8 | 64 | 128, + 255, + 0, + 0, + 0, + "InfusedFire", + "Ignis", + 5, + 320, + -1, + 0, + false, + true, + 3, + 1, + 1, + Dyes.dyeRed, + Arrays.asList(new TC_AspectStack(TC_Aspects.PRAECANTATIO, 1), new TC_AspectStack(TC_Aspects.IGNIS, 2))); + public static Materials InfusedEarth = new Materials( + 542, + TextureSet.SET_SHARDS, + 8.0F, + 256, + 3, + 1 | 4 | 8 | 64 | 128, + 0, + 255, + 0, + 0, + "InfusedEarth", + "Terra", + 5, + 160, + -1, + 0, + false, + true, + 3, + 1, + 1, + Dyes.dyeGreen, + Arrays.asList(new TC_AspectStack(TC_Aspects.PRAECANTATIO, 1), new TC_AspectStack(TC_Aspects.TERRA, 2))); + public static Materials InfusedWater = new Materials( + 543, + TextureSet.SET_SHARDS, + 8.0F, + 64, + 3, + 1 | 4 | 8 | 64 | 128, + 0, + 0, + 255, + 0, + "InfusedWater", + "Aqua", + 5, + 160, + -1, + 0, + false, + true, + 3, + 1, + 1, + Dyes.dyeBlue, + Arrays.asList(new TC_AspectStack(TC_Aspects.PRAECANTATIO, 1), new TC_AspectStack(TC_Aspects.AQUA, 2))); + public static Materials InfusedEntropy = new Materials( + 544, + TextureSet.SET_SHARDS, + 32.0F, + 64, + 4, + 1 | 4 | 8 | 64 | 128, + 62, + 62, + 62, + 0, + "InfusedEntropy", + "Perditio", + 5, + 320, + -1, + 0, + false, + true, + 3, + 1, + 1, + Dyes.dyeBlack, + Arrays.asList(new TC_AspectStack(TC_Aspects.PRAECANTATIO, 1), new TC_AspectStack(TC_Aspects.PERDITIO, 2))); + public static Materials InfusedOrder = new Materials( + 545, + TextureSet.SET_SHARDS, + 8.0F, + 64, + 3, + 1 | 4 | 8 | 64 | 128, + 252, + 252, + 252, + 0, + "InfusedOrder", + "Ordo", + 5, + 240, + -1, + 0, + false, + true, + 3, + 1, + 1, + Dyes.dyeWhite, + Arrays.asList(new TC_AspectStack(TC_Aspects.PRAECANTATIO, 1), new TC_AspectStack(TC_Aspects.ORDO, 2))); + public static Materials InfusedVis = new Materials( + -1, + TextureSet.SET_SHARDS, + 8.0F, + 64, + 3, + 1 | 4 | 8 | 64 | 128, + 255, + 0, + 255, + 0, + "InfusedVis", + "Auram", + 5, + 240, + -1, + 0, + false, + true, + 3, + 1, + 1, + Dyes.dyePurple, + Arrays.asList(new TC_AspectStack(TC_Aspects.PRAECANTATIO, 1), new TC_AspectStack(TC_Aspects.AURAM, 2))); + public static Materials InfusedDull = new Materials( + -1, + TextureSet.SET_SHARDS, + 32.0F, + 64, + 3, + 1 | 4 | 8 | 64 | 128, + 100, + 100, + 100, + 0, + "InfusedDull", + "Vacuus", + 5, + 160, + -1, + 0, + false, + true, + 3, + 1, + 1, + Dyes.dyeLightGray, + Arrays.asList(new TC_AspectStack(TC_Aspects.PRAECANTATIO, 1), new TC_AspectStack(TC_Aspects.VACUOS, 2))); + public static Materials Inolashite = new Materials( + 954, + TextureSet.SET_NONE, + 8.0F, + 2304, + 3, + 1 | 2 | 8 | 64, + 148, + 216, + 187, + 0, + "Inolashite", + "Inolashite", + 0, + 0, + -1, + 0, + false, + false, + 1, + 1, + 1, + Dyes.dyeGreen); + public static Materials Invisium = new Materials( + -1, + TextureSet.SET_NONE, + 1.0F, + 0, + 2, + 1, + 255, + 255, + 255, + 0, + "Invisium", + "Invisium", + 0, + 0, + -1, + 0, + false, + false, + 3, + 1, + 1, + Dyes._NULL); + public static Materials Jade = new Materials( + 537, + TextureSet.SET_SHINY, + 1.0F, + 16, + 2, + 1 | 4 | 8 | 64, + 0, + 100, + 0, + 0, + "Jade", + "Jade", + 0, + 0, + -1, + 0, + false, + false, + 5, + 1, + 1, + Dyes.dyeGreen, + 1, + Arrays.asList( + new MaterialStack(Sodium, 1), + new MaterialStack(Aluminium, 1), + new MaterialStack(Silicon, 2), + new MaterialStack(Oxygen, 6)), + Arrays.asList(new TC_AspectStack(TC_Aspects.LUCRUM, 6), new TC_AspectStack(TC_Aspects.VITREUS, 3))); + public static Materials Kalendrite = new Materials( + 953, + TextureSet.SET_METALLIC, + 5.0F, + 2560, + 3, + 1 | 2, + 170, + 91, + 189, + 0, + "Kalendrite", + "Kalendrite", + 0, + 0, + -1, + 0, + false, + false, + 1, + 1, + 1, + Dyes._NULL); + public static Materials Komatiite = new Materials( + 869, + TextureSet.SET_DULL, + 1.0F, + 0, + 1, + 1, + 255, + 255, + 255, + 0, + "Komatiite", + "Komatiite", + 0, + 0, + -1, + 0, + false, + false, + 1, + 1, + 1, + Dyes.dyeYellow); + public static Materials Lava = new Materials( + 700, + TextureSet.SET_FLUID, + 1.0F, + 0, + 1, + 16, + 255, + 64, + 0, + 0, + "Lava", + "Lava", + 0, + 0, + -1, + 0, + false, + false, + 1, + 1, + 1, + Dyes.dyeOrange); + public static Materials Lemurite = new Materials( + 486, + TextureSet.SET_METALLIC, + 1.0F, + 0, + 2, + 1, + 219, + 219, + 219, + 0, + "Lemurite", + "Lemurite", + 0, + 0, + -1, + 0, + false, + false, + 1, + 1, + 1, + Dyes._NULL); + public static Materials Limestone = new Materials( + -1, + TextureSet.SET_NONE, + 1.0F, + 0, + 1, + 1, + 255, + 255, + 255, + 0, + "Limestone", + "Limestone", + 0, + 0, + -1, + 0, + false, + false, + 1, + 1, + 1, + Dyes._NULL); + public static Materials Magma = new Materials( + -1, + TextureSet.SET_NONE, + 1.0F, + 0, + 1, + 0, + 255, + 64, + 0, + 0, + "Magma", + "Magma", + 0, + 0, + -1, + 0, + false, + false, + 1, + 1, + 1, + Dyes.dyeOrange); + public static Materials Mawsitsit = new Materials( + -1, + TextureSet.SET_NONE, + 1.0F, + 0, + 1, + 1, + 255, + 255, + 255, + 0, + "Mawsitsit", + "Mawsitsit", + 0, + 0, + -1, + 0, + false, + false, + 3, + 1, + 1, + Dyes._NULL); + public static Materials Mercassium = new Materials( + -1, + TextureSet.SET_NONE, + 6.0F, + 64, + 1, + 1 | 2 | 8 | 64, + 255, + 255, + 255, + 0, + "Mercassium", + "Mercassium", + 0, + 0, + -1, + 0, + false, + false, + 1, + 1, + 1, + Dyes._NULL); + public static Materials MeteoricIron = new Materials( + 340, + TextureSet.SET_METALLIC, + 6.0F, + 384, + 3, + 1 | 2 | 8 | 64, + 100, + 50, + 80, + 0, + "MeteoricIron", + "Meteoric Iron", + 0, + 0, + 1811, + 1000, + true, + false, + 1, + 1, + 1, + Dyes.dyeGray, + Element.SpFe, + Arrays.asList(new TC_AspectStack(TC_Aspects.METALLUM, 2), new TC_AspectStack(TC_Aspects.MAGNETO, 1))); + public static Materials MeteoricSteel = new Materials( + 341, + TextureSet.SET_METALLIC, + 6.0F, + 768, + 4, + 1 | 2 | 64, + 50, + 25, + 40, + 0, + "MeteoricSteel", + "Meteoric Steel", + 0, + 0, + 1811, + 1000, + true, + false, + 4, + 51, + 50, + Dyes.dyeGray, + 1, + Arrays.asList(new MaterialStack(MeteoricIron, 50), new MaterialStack(Carbon, 1)), + Arrays.asList( + new TC_AspectStack(TC_Aspects.METALLUM, 2), + new TC_AspectStack(TC_Aspects.MAGNETO, 1), + new TC_AspectStack(TC_Aspects.ORDO, 1))); + public static Materials Meteorite = new Materials( + -1, + TextureSet.SET_NONE, + 1.0F, + 0, + 1, + 1 | 8, + 80, + 35, + 60, + 0, + "Meteorite", + "Meteorite", + 0, + 0, + -1, + 0, + false, + false, + 1, + 1, + 1, + Dyes.dyePurple); + public static Materials Meutoite = new Materials( + 487, + TextureSet.SET_METALLIC, + 1.0F, + 0, + 1, + 1 | 8, + 95, + 82, + 105, + 0, + "Meutoite", + "Meutoite", + 0, + 0, + -1, + 0, + false, + false, + 1, + 1, + 1, + Dyes._NULL); + public static Materials Migmatite = new Materials( + 872, + TextureSet.SET_DULL, + 1.0F, + 0, + 1, + 1, + 255, + 255, + 255, + 0, + "Migmatite", + "Migmatite", + 0, + 0, + -1, + 0, + false, + false, + 1, + 1, + 1, + Dyes._NULL); + public static Materials Mimichite = new Materials( + -1, + TextureSet.SET_GEM_VERTICAL, + 1.0F, + 0, + 1, + 1 | 4 | 8, + 255, + 255, + 255, + 0, + "Mimichite", + "Mimichite", + 0, + 0, + -1, + 0, + false, + false, + 1, + 1, + 1, + Dyes._NULL); + public static Materials Moonstone = new Materials( + -1, + TextureSet.SET_NONE, + 1.0F, + 0, + 1, + 1 | 8, + 255, + 255, + 255, + 0, + "Moonstone", + "Moonstone", + 0, + 0, + -1, + 0, + false, + false, + 3, + 1, + 1, + Dyes.dyeWhite, + Arrays.asList(new TC_AspectStack(TC_Aspects.VITREUS, 1), new TC_AspectStack(TC_Aspects.ALIENIS, 1))); + public static Materials Naquadah = new Materials( + 324, + TextureSet.SET_METALLIC, + 6.0F, + 1280, + 4, + 1 | 2 | 8 | 64 | 128, + 50, + 50, + 50, + 0, + "Naquadah", + "Naquadah", + 0, + 0, + 5400, + 5400, + true, + false, + 10, + 1, + 1, + Dyes.dyeBlack, + Element.Nq, + Arrays.asList( + new TC_AspectStack(TC_Aspects.METALLUM, 3), + new TC_AspectStack(TC_Aspects.RADIO, 1), + new TC_AspectStack(TC_Aspects.NEBRISUM, 1))) + .disableAutoGeneratedBlastFurnaceRecipes(); + public static Materials NaquadahAlloy = new Materials( + 325, + TextureSet.SET_METALLIC, + 8.0F, + 5120, + 5, + 1 | 2 | 64 | 128, + 40, + 40, + 40, + 0, + "NaquadahAlloy", + "Naquadah Alloy", + 0, + 0, + 7200, + 7200, + true, + false, + 10, + 1, + 1, + Dyes.dyeBlack, + Arrays.asList( + new TC_AspectStack(TC_Aspects.METALLUM, 4), new TC_AspectStack(TC_Aspects.NEBRISUM, 1))) + .disableAutoGeneratedBlastFurnaceRecipes(); + public static Materials NaquadahEnriched = new Materials( + 326, + TextureSet.SET_METALLIC, + 6.0F, + 1280, + 4, + 1 | 2 | 8 | 64, + 50, + 50, + 50, + 0, + "NaquadahEnriched", + "Enriched Naquadah", + 0, + 0, + 4500, + 4500, + true, + false, + 15, + 1, + 1, + Dyes.dyeBlack, + Arrays.asList( + new TC_AspectStack(TC_Aspects.METALLUM, 3), + new TC_AspectStack(TC_Aspects.RADIO, 2), + new TC_AspectStack(TC_Aspects.NEBRISUM, 2))) + .disableAutoGeneratedBlastFurnaceRecipes(); + public static Materials Naquadria = new Materials( + 327, + TextureSet.SET_SHINY, + 1.0F, + 512, + 4, + 1 | 2 | 8 | 64, + 30, + 30, + 30, + 0, + "Naquadria", + "Naquadria", + 0, + 0, + 9000, + 9000, + true, + false, + 20, + 1, + 1, + Dyes.dyeBlack, + Arrays.asList( + new TC_AspectStack(TC_Aspects.METALLUM, 4), + new TC_AspectStack(TC_Aspects.RADIO, 3), + new TC_AspectStack(TC_Aspects.NEBRISUM, 3))) + .disableAutoGeneratedBlastFurnaceRecipes(); + public static Materials Nether = new Materials( + -1, + TextureSet.SET_NONE, + 1.0F, + 0, + 1, + 0, + 255, + 255, + 255, + 0, + "Nether", + "Nether", + 0, + 0, + -1, + 0, + false, + false, + 3, + 1, + 1, + Dyes._NULL); + public static Materials NetherBrick = new Materials( + 814, + TextureSet.SET_DULL, + 1.0F, + 0, + 1, + 1, + 100, + 0, + 0, + 0, + "NetherBrick", + "Nether Brick", + 0, + 0, + -1, + 0, + false, + false, + 1, + 1, + 1, + Dyes.dyeRed, + Collections.singletonList(new TC_AspectStack(TC_Aspects.IGNIS, 1))); + public static Materials NetherQuartz = new Materials( + 522, + TextureSet.SET_QUARTZ, + 1.0F, + 32, + 1, + 1 | 4 | 8 | 64, + 230, + 210, + 210, + 0, + "NetherQuartz", + "Nether Quartz", + 0, + 0, + -1, + 0, + false, + false, + 2, + 1, + 1, + Dyes.dyeWhite, + Arrays.asList(new TC_AspectStack(TC_Aspects.POTENTIA, 1), new TC_AspectStack(TC_Aspects.VITREUS, 1))); + public static Materials NetherStar = new Materials( + 506, + TextureSet.SET_NETHERSTAR, + 6.0F, + 5120, + 4, + 1 | 4 | 8 | 64, + 255, + 255, + 255, + 0, + "NetherStar", + "Nether Star", + 5, + 50000, + -1, + 0, + false, + false, + 15, + 1, + 1, + Dyes.dyeWhite); + public static Materials ObsidianFlux = new Materials( + -1, + TextureSet.SET_DULL, + 1.0F, + 0, + 1, + 1 | 2, + 80, + 50, + 100, + 0, + "ObsidianFlux", + "Fluxed Obsidian", + 0, + 0, + -1, + 0, + false, + false, + 1, + 1, + 1, + Dyes.dyePurple); + public static Materials Oilsands = new Materials( + 878, + TextureSet.SET_NONE, + 1.0F, + 0, + 1, + 1 | 8, + 10, + 10, + 10, + 0, + "Oilsands", + "Oilsands", + 0, + 0, + -1, + 0, + false, + false, + 1, + 1, + 1, + Dyes._NULL); + public static Materials Onyx = new Materials( + -1, + TextureSet.SET_NONE, + 1.0F, + 0, + 1, + 1, + 255, + 255, + 255, + 0, + "Onyx", + "Onyx", + 0, + 0, + -1, + 0, + false, + false, + 3, + 1, + 1, + Dyes._NULL); + public static Materials Orichalcum = new Materials( + 966, + TextureSet.SET_METALLIC, + 32.0F, + 20480, + 1, + 1 | 2 | 8 | 64 | 128, + 84, + 122, + 56, + 0, + "Orichalcum", + "Orichalcum", + 0, + 0, + -1, + 0, + false, + false, + 1, + 1, + 1, + Dyes._NULL) + .disableAutoGeneratedBlastFurnaceRecipes() + .setTurbineMultipliers(1, 6, 1); + public static Materials Osmonium = new Materials( + -1, + TextureSet.SET_NONE, + 6.0F, + 64, + 1, + 1 | 2 | 8 | 64, + 255, + 255, + 255, + 0, + "Osmonium", + "Osmonium", + 0, + 0, + -1, + 0, + false, + false, + 3, + 1, + 1, + Dyes.dyeBlue); + public static Materials Oureclase = new Materials( + 961, + TextureSet.SET_METALLIC, + 6.0F, + 1920, + 3, + 1 | 2 | 8 | 64, + 183, + 98, + 21, + 0, + "Oureclase", + "Oureclase", + 0, + 0, + -1, + 0, + false, + false, + 1, + 1, + 1, + Dyes._NULL); + public static Materials Painite = new Materials( + -1, + TextureSet.SET_NONE, + 1.0F, + 0, + 1, + 0, + 255, + 255, + 255, + 0, + "Painite", + "Painite", + 0, + 0, + -1, + 0, + false, + false, + 3, + 1, + 1, + Dyes._NULL); + public static Materials Peanutwood = new Materials( + -1, + TextureSet.SET_NONE, + 1.0F, + 0, + 1, + 0, + 255, + 255, + 255, + 0, + "Peanutwood", + "Peanut Wood", + 0, + 0, + -1, + 0, + false, + false, + 3, + 1, + 1, + Dyes._NULL); + public static Materials Petroleum = new Materials( + -1, + TextureSet.SET_NONE, + 1.0F, + 0, + 1, + 1 | 8, + 255, + 255, + 255, + 0, + "Petroleum", + "Petroleum", + 0, + 0, + -1, + 0, + false, + false, + 1, + 1, + 1, + Dyes._NULL); + public static Materials Pewter = new Materials( + -1, + TextureSet.SET_NONE, + 1.0F, + 0, + 1, + 0, + 255, + 255, + 255, + 0, + "Pewter", + "Pewter", + 0, + 0, + -1, + 0, + false, + false, + 3, + 1, + 1, + Dyes._NULL); + public static Materials Phoenixite = new Materials( + -1, + TextureSet.SET_NONE, + 6.0F, + 64, + 1, + 1 | 2 | 8 | 64, + 255, + 255, + 255, + 0, + "Phoenixite", + "Phoenixite", + 0, + 0, + -1, + 0, + false, + false, + 3, + 1, + 1, + Dyes._NULL); + public static Materials Prometheum = new Materials( + 960, + TextureSet.SET_METALLIC, + 8.0F, + 512, + 1, + 1 | 2 | 8 | 64, + 90, + 129, + 86, + 0, + "Prometheum", + "Prometheum", + 0, + 0, + -1, + 0, + false, + false, + 1, + 1, + 1, + Dyes._NULL); + public static Materials Quartzite = new Materials( + 523, + TextureSet.SET_QUARTZ, + 1.0F, + 0, + 1, + 1 | 4 | 8, + 210, + 230, + 210, + 0, + "Quartzite", + "Quartzite", + 0, + 0, + -1, + 0, + false, + false, + 3, + 1, + 1, + Dyes.dyeWhite); + public static Materials Randomite = new Materials( + -1, + TextureSet.SET_NONE, + 1.0F, + 0, + 1, + 1 | 8, + 255, + 255, + 255, + 0, + "Randomite", + "Randomite", + 0, + 0, + -1, + 0, + false, + false, + 1, + 1, + 1, + Dyes._NULL); + public static Materials Rhyolite = new Materials( + 875, + TextureSet.SET_DULL, + 1.0F, + 0, + 1, + 1, + 255, + 255, + 255, + 0, + "Rhyolite", + "Rhyolite", + 0, + 0, + -1, + 0, + false, + false, + 1, + 1, + 1, + Dyes._NULL); + public static Materials Rubracium = new Materials( + 488, + TextureSet.SET_METALLIC, + 1.0F, + 128, + 1, + 1 | 2 | 8 | 64 | 128, + 151, + 45, + 45, + 0, + "Rubracium", + "Rubracium", + 0, + 0, + -1, + 0, + false, + false, + 1, + 1, + 1, + Dyes.dyeRed); + public static Materials Sand = new Materials( + -1, + TextureSet.SET_NONE, + 1.0F, + 0, + 1, + 0, + 255, + 255, + 255, + 0, + "Sand", + "Sand", + 0, + 0, + -1, + 0, + false, + false, + 1, + 1, + 1, + Dyes.dyeYellow); + public static Materials Sanguinite = new Materials( + 955, + TextureSet.SET_METALLIC, + 3.0F, + 4480, + 4, + 1 | 2 | 8, + 185, + 0, + 0, + 0, + "Sanguinite", + "Sanguinite", + 0, + 0, + -1, + 0, + false, + false, + 1, + 1, + 1, + Dyes._NULL); + public static Materials Siltstone = new Materials( + 876, + TextureSet.SET_DULL, + 1.0F, + 0, + 1, + 1, + 255, + 255, + 255, + 0, + "Siltstone", + "Siltstone", + 0, + 0, + -1, + 0, + false, + false, + 1, + 1, + 1, + Dyes._NULL); + public static Materials Sunstone = new Materials( + -1, + TextureSet.SET_NONE, + 1.0F, + 0, + 1, + 1 | 8, + 255, + 255, + 255, + 0, + "Sunstone", + "Sunstone", + 0, + 0, + -1, + 0, + false, + false, + 3, + 1, + 1, + Dyes.dyeYellow, + Arrays.asList(new TC_AspectStack(TC_Aspects.VITREUS, 1), new TC_AspectStack(TC_Aspects.ALIENIS, 1))); + public static Materials Tar = new Materials( + -1, + TextureSet.SET_NONE, + 1.0F, + 0, + 1, + 0, + 10, + 10, + 10, + 0, + "Tar", + "Tar", + 0, + 0, + -1, + 0, + false, + false, + 1, + 1, + 1, + Dyes.dyeBlack); + public static Materials Tartarite = new Materials( + 956, + TextureSet.SET_METALLIC, + 32.0F, + 20480, + 3, + 1 | 2 | 8, + 255, + 118, + 60, + 0, + "Tartarite", + "Tartarite", + 0, + 0, + -1, + 0, + false, + false, + 1, + 1, + 1, + Dyes._NULL) + .disableAutoGeneratedBlastFurnaceRecipes() + .setTurbineMultipliers(1120, 1120, 1); + public static Materials UUAmplifier = new Materials( + 721, + TextureSet.SET_FLUID, + 1.0F, + 0, + 1, + 16, + 96, + 0, + 128, + 0, + "UUAmplifier", + "UU-Amplifier", + 0, + 0, + -1, + 0, + false, + false, + 10, + 1, + 1, + Dyes.dyePink); + public static Materials UUMatter = new Materials( + 703, + TextureSet.SET_FLUID, + 1.0F, + 0, + 1, + 16, + 128, + 0, + 196, + 0, + "UUMatter", + "UU-Matter", + 0, + 0, + -1, + 0, + false, + false, + 10, + 1, + 1, + Dyes.dyePink); + public static Materials Void = new Materials( + 970, + TextureSet.SET_METALLIC, + 32.0F, + 512, + 4, + 1 | 2 | 64 | 128, + 28, + 6, + 57, + 0, + "Void", + "Void", + 5, + 1500, + -1, + 0, + false, + true, + 5, + 2, + 1, + Dyes.dyeBlack, + Collections.singletonList(new TC_AspectStack(TC_Aspects.VACUOS, 1))); + public static Materials Voidstone = new Materials( + -1, + TextureSet.SET_NONE, + 1.0F, + 0, + 1, + 0, + 255, + 255, + 255, + 200, + "Voidstone", + "Voidstone", + 0, + 0, + -1, + 0, + false, + true, + 1, + 1, + 1, + Dyes._NULL, + Arrays.asList( + new TC_Aspects.TC_AspectStack(TC_Aspects.VITREUS, 1), new TC_AspectStack(TC_Aspects.VACUOS, 1))); + public static Materials Vulcanite = new Materials( + 489, + TextureSet.SET_METALLIC, + 32.0F, + 20480, + 2, + 1 | 2 | 8 | 64 | 128, + 255, + 132, + 72, + 0, + "Vulcanite", + "Vulcanite", + 0, + 0, + -1, + 0, + false, + false, + 1, + 1, + 1, + Dyes._NULL) + .disableAutoGeneratedBlastFurnaceRecipes() + .setTurbineMultipliers(40, 1, 1); + public static Materials Vyroxeres = new Materials( + 951, + TextureSet.SET_METALLIC, + 32.0F, + 7680, + 1, + 1 | 2 | 8 | 64, + 85, + 224, + 1, + 0, + "Vyroxeres", + "Vyroxeres", + 0, + 0, + -1, + 0, + false, + false, + 1, + 1, + 1, + Dyes._NULL) + .disableAutoGeneratedBlastFurnaceRecipes() + .setTurbineMultipliers(1, 3, 1); + public static Materials Yellorium = new Materials( + -1, + TextureSet.SET_NONE, + 1.0F, + 0, + 2, + 1 | 2, + 255, + 255, + 255, + 0, + "Yellorium", + "Yellorium", + 0, + 0, + -1, + 0, + false, + false, + 3, + 1, + 1, + Dyes.dyeYellow); + public static Materials Zectium = new Materials( + -1, + TextureSet.SET_NONE, + 1.0F, + 0, + 2, + 1 | 2 | 8, + 255, + 255, + 255, + 0, + "Zectium", + "Zectium", + 0, + 0, + -1, + 0, + false, + false, + 3, + 1, + 1, + Dyes.dyeBlack); /** * Circuitry, Batteries and other Technical things */ - public static Materials Primitive = new Materials( -1, TextureSet.SET_NONE , 1.0F, 0, 0, 0 , 255, 255, 255, 0, "Primitive" , "Primitive" , 0, 0, -1, 0, false, false, 1, 1, 1, Dyes.dyeLightGray , Collections.singletonList(new TC_AspectStack(TC_Aspects.MACHINA, 1))); - public static Materials Basic = new Materials( -1, TextureSet.SET_NONE , 1.0F, 0, 0, 0 , 255, 255, 255, 0, "Basic" , "Basic" , 0, 0, -1, 0, false, false, 1, 1, 1, Dyes.dyeLightGray , Collections.singletonList(new TC_AspectStack(TC_Aspects.MACHINA, 2))); - public static Materials Good = new Materials( -1, TextureSet.SET_NONE , 1.0F, 0, 0, 0 , 255, 255, 255, 0, "Good" , "Good" , 0, 0, -1, 0, false, false, 1, 1, 1, Dyes.dyeLightGray , Collections.singletonList(new TC_AspectStack(TC_Aspects.MACHINA, 3))); - public static Materials Advanced = new Materials( -1, TextureSet.SET_NONE , 1.0F, 0, 0, 0 , 255, 255, 255, 0, "Advanced" , "Advanced" , 0, 0, -1, 0, false, false, 1, 1, 1, Dyes.dyeLightGray , Collections.singletonList(new TC_AspectStack(TC_Aspects.MACHINA, 4))); - public static Materials Data = new Materials( -1, TextureSet.SET_NONE , 1.0F, 0, 0, 0 , 255, 255, 255, 0, "Data" , "Data" , 0, 0, -1, 0, false, false, 1, 1, 1, Dyes.dyeLightGray , Collections.singletonList(new TC_AspectStack(TC_Aspects.MACHINA, 5))); - public static Materials Elite = new Materials( -1, TextureSet.SET_NONE , 1.0F, 0, 0, 0 , 255, 255, 255, 0, "Elite" , "Elite" , 0, 0, -1, 0, false, false, 1, 1, 1, Dyes.dyeLightGray , Collections.singletonList(new TC_AspectStack(TC_Aspects.MACHINA, 6))); - public static Materials Master = new Materials( -1, TextureSet.SET_NONE , 1.0F, 0, 0, 0 , 255, 255, 255, 0, "Master" , "Master" , 0, 0, -1, 0, false, false, 1, 1, 1, Dyes.dyeLightGray , Collections.singletonList(new TC_AspectStack(TC_Aspects.MACHINA, 7))); - public static Materials Ultimate = new Materials( -1, TextureSet.SET_NONE , 1.0F, 0, 0, 0 , 255, 255, 255, 0, "Ultimate" , "Ultimate" , 0, 0, -1, 0, false, false, 1, 1, 1, Dyes.dyeLightGray , Collections.singletonList(new TC_AspectStack(TC_Aspects.MACHINA, 8))); - public static Materials Infinite = new Materials( -1, TextureSet.SET_NONE , 1.0F, 0, 0, 0 , 255, 255, 255, 0, "Infinite" , "Infinite" , 0, 0, -1, 0, false, false, 1, 1, 1, Dyes.dyeLightGray , Collections.singletonList(new TC_AspectStack(TC_Aspects.ELECTRUM, 9))); - public static Materials Bio = new Materials( -1, TextureSet.SET_NONE , 1.0F, 0, 0, 0 , 255, 255, 255, 0, "Bio" , "Bio" , 0, 0, -1, 0, false, false, 1, 1, 1, Dyes.dyeLightGray , Collections.singletonList(new TC_AspectStack(TC_Aspects.ELECTRUM, 10))); - public static Materials Nano = new Materials( -1, TextureSet.SET_NONE , 1.0F, 0, 0, 0 , 255, 255, 255, 0, "Nano" , "Bio" , 0, 0, -1, 0, false, false, 1, 1, 1, Dyes.dyeLightGray , Collections.singletonList(new TC_AspectStack(TC_Aspects.ELECTRUM, 11))); - public static Materials Piko = new Materials( -1, TextureSet.SET_NONE , 1.0F, 0, 0, 0 , 255, 255, 255, 0, "Piko" , "Bio" , 0, 0, -1, 0, false, false, 1, 1, 1, Dyes.dyeLightGray , Collections.singletonList(new TC_AspectStack(TC_Aspects.ELECTRUM, 12))); - public static Materials Quantum = new Materials( -1, TextureSet.SET_NONE , 1.0F, 0, 0, 0 , 255, 255, 255, 0, "Quantum" , "Bio" , 0, 0, -1, 0, false, false, 1, 1, 1, Dyes.dyeLightGray , Collections.singletonList(new TC_AspectStack(TC_Aspects.ELECTRUM, 13))); - public static Materials Optical = new Materials( -1, TextureSet.SET_NONE , 1.0F, 0, 0, 0 , 255, 255, 255, 0, "Optical" , "Optical" , 0, 0, -1, 0, false, false, 1, 1, 1, Dyes.dyeLightGray , Collections.singletonList(new TC_AspectStack(TC_Aspects.ELECTRUM, 13))); - public static Materials Exotic = new Materials( -1, TextureSet.SET_NONE , 1.0F, 0, 0, 0 , 255, 255, 255, 0, "Exotic" , "Exotic" , 0, 0, -1, 0, false, false, 1, 1, 1, Dyes.dyeLightGray , Collections.singletonList(new TC_AspectStack(TC_Aspects.ELECTRUM, 14))); - public static Materials Cosmic = new Materials( -1, TextureSet.SET_NONE , 1.0F, 0, 0, 0 , 255, 255, 255, 0, "Cosmic" , "Cosmic" , 0, 0, -1, 0, false, false, 1, 1, 1, Dyes.dyeLightGray , Collections.singletonList(new TC_AspectStack(TC_Aspects.ELECTRUM, 15))); - public static Materials Transcendent = new Materials( -1, TextureSet.SET_NONE , 1.0F, 0, 0, 0 , 255, 255, 255, 0, "Transcendent" , "Transcendent" , 0, 0, -1, 0, false, false, 1, 1, 1, Dyes.dyeLightGray , Collections.singletonList(new TC_AspectStack(TC_Aspects.ELECTRUM, 16))); - public static Materials Resistor = new Materials( -1, TextureSet.SET_NONE , 1.0F, 0, 0, 0 , 255, 255, 255, 0, "Resistor" , "Resistor" , 0, 0, -1, 0, false, false, 1, 1, 1, Dyes.dyeLightGray , Collections.singletonList(new TC_AspectStack(TC_Aspects.ELECTRUM, 1))); - public static Materials Diode = new Materials( -1, TextureSet.SET_NONE , 1.0F, 0, 0, 0 , 255, 255, 255, 0, "Diode" , "Diode" , 0, 0, -1, 0, false, false, 1, 1, 1, Dyes.dyeLightGray , Collections.singletonList(new TC_AspectStack(TC_Aspects.ELECTRUM, 1))); - public static Materials Transistor = new Materials( -1, TextureSet.SET_NONE , 1.0F, 0, 0, 0 , 255, 255, 255, 0, "Transistor" , "Transistor" , 0, 0, -1, 0, false, false, 1, 1, 1, Dyes.dyeLightGray , Collections.singletonList(new TC_AspectStack(TC_Aspects.ELECTRUM, 1))); - public static Materials Capacitor = new Materials( -1, TextureSet.SET_NONE , 1.0F, 0, 0, 0 , 255, 255, 255, 0, "Capacitor" , "Capacitor" , 0, 0, -1, 0, false, false, 1, 1, 1, Dyes.dyeLightGray , Collections.singletonList(new TC_AspectStack(TC_Aspects.ELECTRUM, 1))); - public static Materials Inductor = new Materials( -1, TextureSet.SET_NONE , 1.0F, 0, 0, 0 , 255, 255, 255, 0, "Inductor" , "Inductor" , 0, 0, -1, 0, false, false, 1, 1, 1, Dyes.dyeLightGray , Collections.singletonList(new TC_AspectStack(TC_Aspects.ELECTRUM, 1))); + public static Materials Primitive = new Materials( + -1, + TextureSet.SET_NONE, + 1.0F, + 0, + 0, + 0, + 255, + 255, + 255, + 0, + "Primitive", + "Primitive", + 0, + 0, + -1, + 0, + false, + false, + 1, + 1, + 1, + Dyes.dyeLightGray, + Collections.singletonList(new TC_AspectStack(TC_Aspects.MACHINA, 1))); + + public static Materials Basic = new Materials( + -1, + TextureSet.SET_NONE, + 1.0F, + 0, + 0, + 0, + 255, + 255, + 255, + 0, + "Basic", + "Basic", + 0, + 0, + -1, + 0, + false, + false, + 1, + 1, + 1, + Dyes.dyeLightGray, + Collections.singletonList(new TC_AspectStack(TC_Aspects.MACHINA, 2))); + public static Materials Good = new Materials( + -1, + TextureSet.SET_NONE, + 1.0F, + 0, + 0, + 0, + 255, + 255, + 255, + 0, + "Good", + "Good", + 0, + 0, + -1, + 0, + false, + false, + 1, + 1, + 1, + Dyes.dyeLightGray, + Collections.singletonList(new TC_AspectStack(TC_Aspects.MACHINA, 3))); + public static Materials Advanced = new Materials( + -1, + TextureSet.SET_NONE, + 1.0F, + 0, + 0, + 0, + 255, + 255, + 255, + 0, + "Advanced", + "Advanced", + 0, + 0, + -1, + 0, + false, + false, + 1, + 1, + 1, + Dyes.dyeLightGray, + Collections.singletonList(new TC_AspectStack(TC_Aspects.MACHINA, 4))); + public static Materials Data = new Materials( + -1, + TextureSet.SET_NONE, + 1.0F, + 0, + 0, + 0, + 255, + 255, + 255, + 0, + "Data", + "Data", + 0, + 0, + -1, + 0, + false, + false, + 1, + 1, + 1, + Dyes.dyeLightGray, + Collections.singletonList(new TC_AspectStack(TC_Aspects.MACHINA, 5))); + public static Materials Elite = new Materials( + -1, + TextureSet.SET_NONE, + 1.0F, + 0, + 0, + 0, + 255, + 255, + 255, + 0, + "Elite", + "Elite", + 0, + 0, + -1, + 0, + false, + false, + 1, + 1, + 1, + Dyes.dyeLightGray, + Collections.singletonList(new TC_AspectStack(TC_Aspects.MACHINA, 6))); + public static Materials Master = new Materials( + -1, + TextureSet.SET_NONE, + 1.0F, + 0, + 0, + 0, + 255, + 255, + 255, + 0, + "Master", + "Master", + 0, + 0, + -1, + 0, + false, + false, + 1, + 1, + 1, + Dyes.dyeLightGray, + Collections.singletonList(new TC_AspectStack(TC_Aspects.MACHINA, 7))); + public static Materials Ultimate = new Materials( + -1, + TextureSet.SET_NONE, + 1.0F, + 0, + 0, + 0, + 255, + 255, + 255, + 0, + "Ultimate", + "Ultimate", + 0, + 0, + -1, + 0, + false, + false, + 1, + 1, + 1, + Dyes.dyeLightGray, + Collections.singletonList(new TC_AspectStack(TC_Aspects.MACHINA, 8))); + public static Materials Infinite = new Materials( + -1, + TextureSet.SET_NONE, + 1.0F, + 0, + 0, + 0, + 255, + 255, + 255, + 0, + "Infinite", + "Infinite", + 0, + 0, + -1, + 0, + false, + false, + 1, + 1, + 1, + Dyes.dyeLightGray, + Collections.singletonList(new TC_AspectStack(TC_Aspects.ELECTRUM, 9))); + public static Materials Bio = new Materials( + -1, + TextureSet.SET_NONE, + 1.0F, + 0, + 0, + 0, + 255, + 255, + 255, + 0, + "Bio", + "Bio", + 0, + 0, + -1, + 0, + false, + false, + 1, + 1, + 1, + Dyes.dyeLightGray, + Collections.singletonList(new TC_AspectStack(TC_Aspects.ELECTRUM, 10))); + public static Materials Nano = new Materials( + -1, + TextureSet.SET_NONE, + 1.0F, + 0, + 0, + 0, + 255, + 255, + 255, + 0, + "Nano", + "Bio", + 0, + 0, + -1, + 0, + false, + false, + 1, + 1, + 1, + Dyes.dyeLightGray, + Collections.singletonList(new TC_AspectStack(TC_Aspects.ELECTRUM, 11))); + public static Materials Piko = new Materials( + -1, + TextureSet.SET_NONE, + 1.0F, + 0, + 0, + 0, + 255, + 255, + 255, + 0, + "Piko", + "Bio", + 0, + 0, + -1, + 0, + false, + false, + 1, + 1, + 1, + Dyes.dyeLightGray, + Collections.singletonList(new TC_AspectStack(TC_Aspects.ELECTRUM, 12))); + public static Materials Quantum = new Materials( + -1, + TextureSet.SET_NONE, + 1.0F, + 0, + 0, + 0, + 255, + 255, + 255, + 0, + "Quantum", + "Bio", + 0, + 0, + -1, + 0, + false, + false, + 1, + 1, + 1, + Dyes.dyeLightGray, + Collections.singletonList(new TC_AspectStack(TC_Aspects.ELECTRUM, 13))); + public static Materials Optical = new Materials( + -1, + TextureSet.SET_NONE, + 1.0F, + 0, + 0, + 0, + 255, + 255, + 255, + 0, + "Optical", + "Optical", + 0, + 0, + -1, + 0, + false, + false, + 1, + 1, + 1, + Dyes.dyeLightGray, + Collections.singletonList(new TC_AspectStack(TC_Aspects.ELECTRUM, 13))); + public static Materials Exotic = new Materials( + -1, + TextureSet.SET_NONE, + 1.0F, + 0, + 0, + 0, + 255, + 255, + 255, + 0, + "Exotic", + "Exotic", + 0, + 0, + -1, + 0, + false, + false, + 1, + 1, + 1, + Dyes.dyeLightGray, + Collections.singletonList(new TC_AspectStack(TC_Aspects.ELECTRUM, 14))); + public static Materials Cosmic = new Materials( + -1, + TextureSet.SET_NONE, + 1.0F, + 0, + 0, + 0, + 255, + 255, + 255, + 0, + "Cosmic", + "Cosmic", + 0, + 0, + -1, + 0, + false, + false, + 1, + 1, + 1, + Dyes.dyeLightGray, + Collections.singletonList(new TC_AspectStack(TC_Aspects.ELECTRUM, 15))); + public static Materials Transcendent = new Materials( + -1, + TextureSet.SET_NONE, + 1.0F, + 0, + 0, + 0, + 255, + 255, + 255, + 0, + "Transcendent", + "Transcendent", + 0, + 0, + -1, + 0, + false, + false, + 1, + 1, + 1, + Dyes.dyeLightGray, + Collections.singletonList(new TC_AspectStack(TC_Aspects.ELECTRUM, 16))); + public static Materials Resistor = new Materials( + -1, + TextureSet.SET_NONE, + 1.0F, + 0, + 0, + 0, + 255, + 255, + 255, + 0, + "Resistor", + "Resistor", + 0, + 0, + -1, + 0, + false, + false, + 1, + 1, + 1, + Dyes.dyeLightGray, + Collections.singletonList(new TC_AspectStack(TC_Aspects.ELECTRUM, 1))); + public static Materials Diode = new Materials( + -1, + TextureSet.SET_NONE, + 1.0F, + 0, + 0, + 0, + 255, + 255, + 255, + 0, + "Diode", + "Diode", + 0, + 0, + -1, + 0, + false, + false, + 1, + 1, + 1, + Dyes.dyeLightGray, + Collections.singletonList(new TC_AspectStack(TC_Aspects.ELECTRUM, 1))); + public static Materials Transistor = new Materials( + -1, + TextureSet.SET_NONE, + 1.0F, + 0, + 0, + 0, + 255, + 255, + 255, + 0, + "Transistor", + "Transistor", + 0, + 0, + -1, + 0, + false, + false, + 1, + 1, + 1, + Dyes.dyeLightGray, + Collections.singletonList(new TC_AspectStack(TC_Aspects.ELECTRUM, 1))); + public static Materials Capacitor = new Materials( + -1, + TextureSet.SET_NONE, + 1.0F, + 0, + 0, + 0, + 255, + 255, + 255, + 0, + "Capacitor", + "Capacitor", + 0, + 0, + -1, + 0, + false, + false, + 1, + 1, + 1, + Dyes.dyeLightGray, + Collections.singletonList(new TC_AspectStack(TC_Aspects.ELECTRUM, 1))); + public static Materials Inductor = new Materials( + -1, + TextureSet.SET_NONE, + 1.0F, + 0, + 0, + 0, + 255, + 255, + 255, + 0, + "Inductor", + "Inductor", + 0, + 0, + -1, + 0, + false, + false, + 1, + 1, + 1, + Dyes.dyeLightGray, + Collections.singletonList(new TC_AspectStack(TC_Aspects.ELECTRUM, 1))); /** * Not possible to determine exact Components */ - public static Materials Antimatter = new Materials( -1, TextureSet.SET_NONE , 1.0F, 0, 0, 0 , 255, 255, 255, 0, "Antimatter" , "Antimatter" , 0, 0, -1, 0, false, false, 1, 1, 1, Dyes.dyePink , Arrays.asList(new TC_AspectStack(TC_Aspects.POTENTIA, 9), new TC_AspectStack(TC_Aspects.PERFODIO, 8))); - public static Materials AdvancedGlue = new MaterialBuilder(567, TextureSet.SET_FLUID , "Advanced Glue").setName("AdvancedGlue").addCell().addFluid().setRGB(255, 255, 185).setColor(Dyes.dyeYellow).setAspects(Collections.singletonList(new TC_AspectStack(TC_Aspects.LIMUS, 5))).constructMaterial(); - public static Materials BioFuel = new Materials( 705, TextureSet.SET_FLUID , 1.0F, 0, 0, 16 , 255, 128, 0, 0, "BioFuel" , "Biofuel" , 0, 6, -1, 0, false, false, 1, 1, 1, Dyes.dyeOrange ); - public static Materials Biomass = new Materials( 704, TextureSet.SET_FLUID , 1.0F, 0, 0, 16 , 0, 255, 0, 0, "Biomass" , "Forestry Biomass" , 3, 8, -1, 0, false, false, 1, 1, 1, Dyes.dyeGreen ); - public static Materials CharcoalByproducts = new MaterialBuilder(675, TextureSet.SET_FLUID , "Charcoal Byproducts").addCell().setRGB(120, 68, 33).setColor(Dyes.dyeBrown).constructMaterial(); - public static Materials Cheese = new Materials( 894, TextureSet.SET_FINE , 1.0F, 0, 0, 1 |8 , 255, 255, 0, 0, "Cheese" , "Cheese" , 0, 0, 320, 0, false, false, 1, 1, 1, Dyes.dyeYellow ); - public static Materials Chili = new Materials( 895, TextureSet.SET_FINE , 1.0F, 0, 0, 1 , 200, 0, 0, 0, "Chili" , "Chili" , 0, 0, -1, 0, false, false, 1, 1, 1, Dyes.dyeRed ); - public static Materials Chocolate = new Materials( 886, TextureSet.SET_FINE , 1.0F, 0, 0, 1 , 190, 95, 0, 0, "Chocolate" , "Chocolate" , 0, 0, -1, 0, false, false, 1, 1, 1, Dyes.dyeBrown ); - public static Materials Cluster = new Materials( -1, TextureSet.SET_NONE , 1.0F, 0, 0, 0 , 255, 255, 255, 127, "Cluster" , "Cluster" , 0, 0, -1, 0, false, true, 1, 1, 1, Dyes.dyeWhite ); - public static Materials CoalFuel = new Materials( 710, TextureSet.SET_FLUID , 1.0F, 0, 0, 16 , 50, 50, 70, 0, "CoalFuel" , "Coalfuel" , 0, 16, -1, 0, false, false, 1, 1, 1, Dyes.dyeBlack ); - public static Materials Cocoa = new Materials( 887, TextureSet.SET_FINE , 1.0F, 0, 0, 1 , 190, 95, 0, 0, "Cocoa" , "Cocoa" , 0, 0, -1, 0, false, false, 1, 1, 1, Dyes.dyeBrown ); - public static Materials Coffee = new Materials( 888, TextureSet.SET_FINE , 1.0F, 0, 0, 1 , 150, 75, 0, 0, "Coffee" , "Coffee" , 0, 0, -1, 0, false, false, 1, 1, 1, Dyes.dyeBrown ); - public static Materials Creosote = new Materials( 712, TextureSet.SET_FLUID , 1.0F, 0, 0, 16 , 128, 64, 0, 0, "Creosote" , "Creosote" , 3, 8, -1, 0, false, false, 1, 1, 1, Dyes.dyeBrown ); - public static Materials Ethanol = new Materials( 706, TextureSet.SET_FLUID , 1.0F, 0, 0, 16 , 255, 128, 0, 0, "Ethanol" , "Ethanol" , 0, 192, -1, 0, false, false, 1, 1, 1, Dyes.dyeOrange , 1, Arrays.asList(new MaterialStack(Carbon, 2), new MaterialStack(Hydrogen, 6), new MaterialStack(Oxygen, 1)), Arrays.asList(new TC_AspectStack(TC_Aspects.VENENUM, 1), new TC_AspectStack(TC_Aspects.AQUA, 1))); - public static Materials FishOil = new Materials( 711, TextureSet.SET_FLUID , 1.0F, 0, 0, 16 , 255, 196, 0, 0, "FishOil" , "Fish Oil" , 3, 2, -1, 0, false, false, 1, 1, 1, Dyes.dyeYellow , Collections.singletonList(new TC_AspectStack(TC_Aspects.CORPUS, 2))); - public static Materials FermentedBiomass = new MaterialBuilder(691, TextureSet.SET_FLUID , "Fermented Biomass").addCell().addFluid().setRGB(68, 85, 0).setColor(Dyes.dyeBrown).constructMaterial(); - public static Materials Fuel = new Materials( 708, TextureSet.SET_FLUID , 1.0F, 0, 0, 16 , 255, 255, 0, 0, "Fuel" , "Diesel" , 0, 480, -1, 0, false, false, 1, 1, 1, Dyes.dyeYellow ); - public static Materials Glue = new Materials( 726, TextureSet.SET_FLUID , 1.0F, 0, 0, 16 , 200, 196, 0, 0, "Glue" , "Refined Glue" , 0, 0, -1, 0, false, false, 1, 1, 1, Dyes.dyeOrange , Collections.singletonList(new TC_AspectStack(TC_Aspects.LIMUS, 2))); - public static Materials Gunpowder = new Materials( 800, TextureSet.SET_DULL , 1.0F, 0, 0, 1 , 128, 128, 128, 0, "Gunpowder" , "Gunpowder" , 0, 0, -1, 0, false, false, 1, 1, 1, Dyes.dyeGray , Arrays.asList(new TC_AspectStack(TC_Aspects.PERDITIO, 3), new TC_AspectStack(TC_Aspects.IGNIS, 4))); - public static Materials FryingOilHot = new Materials( 727, TextureSet.SET_FLUID , 1.0F, 0, 0, 16 , 200, 196, 0, 0, "FryingOilHot" , "Hot Frying Oil" , 0, 0, -1, 0, false, false, 1, 1, 1, Dyes.dyeOrange , Arrays.asList(new TC_AspectStack(TC_Aspects.AQUA, 1), new TC_AspectStack(TC_Aspects.IGNIS, 1))); - public static Materials Honey = new Materials( 725, TextureSet.SET_FLUID , 1.0F, 0, 0, 16 , 210, 200, 0, 0, "Honey" , "Honey" , 0, 0, -1, 0, false, false, 1, 1, 1, Dyes.dyeYellow ); - public static Materials Leather = new Materials( -1, TextureSet.SET_ROUGH , 1.0F, 0, 0, 1 , 150, 150, 80, 127, "Leather" , "Leather" , 0, 0, -1, 0, false, false, 1, 1, 1, Dyes.dyeOrange ); - public static Materials Lubricant = new Materials( 724, TextureSet.SET_FLUID , 1.0F, 0, 0, 16 , 255, 196, 0, 0, "Lubricant" , "Lubricant" , 0, 0, -1, 0, false, false, 1, 1, 1, Dyes.dyeOrange , Arrays.asList(new TC_AspectStack(TC_Aspects.AQUA, 2), new TC_AspectStack(TC_Aspects.MACHINA, 1))); - public static Materials McGuffium239 = new Materials( 999, TextureSet.SET_FLUID , 1.0F, 0, 0, 16 , 200, 50, 150, 0, "McGuffium239" , "Mc Guffium 239" , 0, 0, -1, 0, false, false, 1, 1, 1, Dyes.dyePink , Arrays.asList(new TC_AspectStack(TC_Aspects.ALIENIS, 8), new TC_AspectStack(TC_Aspects.PERMUTATIO, 8), new TC_AspectStack(TC_Aspects.SPIRITUS, 8), new TC_AspectStack(TC_Aspects.AURAM, 8), new TC_AspectStack(TC_Aspects.VITIUM, 8), new TC_AspectStack(TC_Aspects.RADIO, 8), new TC_AspectStack(TC_Aspects.MAGNETO, 8), new TC_AspectStack(TC_Aspects.ELECTRUM, 8), new TC_AspectStack(TC_Aspects.NEBRISUM, 8), new TC_AspectStack(TC_Aspects.STRONTIO, 8))); - public static Materials MeatRaw = new Materials( 892, TextureSet.SET_FINE , 1.0F, 0, 0, 1 , 255, 100, 100, 0, "MeatRaw" , "Raw Meat" , 0, 0, -1, 0, false, false, 1, 1, 1, Dyes.dyePink ); - public static Materials MeatCooked = new Materials( 893, TextureSet.SET_FINE , 1.0F, 0, 0, 1 , 150, 60, 20, 0, "MeatCooked" , "Cooked Meat" , 0, 0, -1, 0, false, false, 1, 1, 1, Dyes.dyePink ); - public static Materials Milk = new Materials( 885, TextureSet.SET_FINE , 1.0F, 0, 0, 1 |16 , 254, 254, 254, 0, "Milk" , "Milk" , 0, 0, -1, 0, false, false, 1, 1, 1, Dyes.dyeWhite , Collections.singletonList(new TC_AspectStack(TC_Aspects.SANO, 2))); - public static Materials Mud = new Materials( -1, TextureSet.SET_NONE , 1.0F, 0, 0, 0 , 255, 255, 255, 0, "Mud" , "Mud" , 0, 0, -1, 0, false, false, 1, 1, 1, Dyes.dyeBrown ); - public static Materials Oil = new Materials( 707, TextureSet.SET_FLUID , 1.0F, 0, 0, 16 , 10, 10, 10, 0, "Oil" , "Oil" , 3, 20, -1, 0, false, false, 1, 1, 1, Dyes.dyeBlack ); - public static Materials Paper = new Materials( 879, TextureSet.SET_PAPER , 1.0F, 0, 0, 1 , 250, 250, 250, 0, "Paper" , "Paper" , 0, 0, -1, 0, false, false, 1, 1, 1, Dyes.dyeWhite , Collections.singletonList(new TC_AspectStack(TC_Aspects.COGNITIO, 1))); - public static Materials Peat = new Materials( -1, TextureSet.SET_NONE , 1.0F, 0, 0, 0 , 255, 255, 255, 0, "Peat" , "Peat" , 0, 0, -1, 0, false, false, 1, 1, 1, Dyes.dyeBrown , Arrays.asList(new TC_AspectStack(TC_Aspects.POTENTIA, 2), new TC_AspectStack(TC_Aspects.IGNIS, 2))); - public static Materials RareEarth = new Materials( 891, TextureSet.SET_FINE , 1.0F, 0, 0, 1 , 128, 128, 100, 0, "RareEarth" , "Rare Earth" , 0, 0, -1, 0, false, false, 1, 1, 1, Dyes.dyeGray , Arrays.asList(new TC_AspectStack(TC_Aspects.VITREUS, 1), new TC_AspectStack(TC_Aspects.LUCRUM, 1))); - public static Materials Red = new Materials( -1, TextureSet.SET_NONE , 1.0F, 0, 0, 0 , 255, 0, 0, 0, "Red" , "Red" , 0, 0, -1, 0, false, false, 1, 1, 1, Dyes.dyeRed ); - public static Materials Reinforced = new Materials( 383, TextureSet.SET_METALLIC , 7.0F, 480, 4, 1|2 |64|128 , 105, 141, 165, 0, "Reinforced" , "Reinforced" , 0, 0, -1, 1700, true, false, 1, 1, 1, Dyes.dyeBlue ).disableAutoGeneratedBlastFurnaceRecipes(); - public static Materials SeedOil = new Materials( 713, TextureSet.SET_FLUID , 1.0F, 0, 0, 16 , 196, 255, 0, 0, "SeedOil" , "Seed Oil" , 3, 2, -1, 0, false, false, 1, 1, 1, Dyes.dyeLime , Collections.singletonList(new TC_AspectStack(TC_Aspects.GRANUM, 2))); - public static Materials SeedOilHemp = new Materials( 722, TextureSet.SET_FLUID , 1.0F, 0, 0, 16 , 196, 255, 0, 0, "SeedOilHemp" , "Hemp Seed Oil" , 3, 2, -1, 0, false, false, 1, 1, 1, Dyes.dyeLime , Collections.singletonList(new TC_AspectStack(TC_Aspects.GRANUM, 2))); - public static Materials SeedOilLin = new Materials( 723, TextureSet.SET_FLUID , 1.0F, 0, 0, 16 , 196, 255, 0, 0, "SeedOilLin" , "Lin Seed Oil" , 3, 2, -1, 0, false, false, 1, 1, 1, Dyes.dyeLime , Collections.singletonList(new TC_AspectStack(TC_Aspects.GRANUM, 2))); - public static Materials Stone = new Materials( 299, TextureSet.SET_ROUGH , 4.0F, 32, 1, 1 |64|128 , 205, 205, 205, 0, "Stone" , "Stone" , 0, 0, -1, 0, false, false, 1, 1, 1, Dyes.dyeLightGray , Collections.singletonList(new TC_AspectStack(TC_Aspects.TERRA, 1))); - public static Materials TNT = new Materials( -1, TextureSet.SET_NONE , 1.0F, 0, 0, 0 , 255, 255, 255, 0, "TNT" , "TNT" , 0, 0, -1, 0, false, false, 1, 1, 1, Dyes.dyeRed , Arrays.asList(new TC_AspectStack(TC_Aspects.PERDITIO, 7), new TC_AspectStack(TC_Aspects.IGNIS, 4))); - public static Materials Unstable = new Materials( 396, TextureSet.SET_SHINY , 1.0F, 0, 4, 1 , 220, 220, 220, 127, "Unstable" , "Unstable" , 0, 0, -1, 0, false, true, 1, 1, 1, Dyes.dyeWhite , Collections.singletonList(new TC_AspectStack(TC_Aspects.PERDITIO, 4))); - public static Materials Unstableingot = new Materials( -1, TextureSet.SET_NONE , 1.0F, 0, 4, 0 , 255, 255, 255, 127, "Unstableingot" , "Unstable" , 0, 0, -1, 0, false, true, 1, 1, 1, Dyes.dyeWhite , Collections.singletonList(new TC_AspectStack(TC_Aspects.PERDITIO, 4))); - public static Materials Vinegar = new MaterialBuilder(690, TextureSet.SET_FLUID , "Vinegar").setColor(Dyes.dyeBrown).constructMaterial(); - public static Materials Wheat = new Materials( 881, TextureSet.SET_POWDER , 1.0F, 0, 0, 1 , 255, 255, 196, 0, "Wheat" , "Wheat" , 0, 0, -1, 0, false, false, 1, 1, 1, Dyes.dyeYellow , Collections.singletonList(new TC_AspectStack(TC_Aspects.MESSIS, 2))); - public static Materials WoodGas = new MaterialBuilder(660, TextureSet.SET_FLUID , "Wood Gas").addCell().addGas().setRGB(222, 205, 135).setColor(Dyes.dyeBrown).setFuelType(MaterialBuilder.GAS).setFuelPower(24).constructMaterial(); - public static Materials WoodTar = new MaterialBuilder(662, TextureSet.SET_FLUID , "Wood Tar").addCell().addFluid().setRGB(40, 23, 11).setColor(Dyes.dyeBrown).constructMaterial(); - public static Materials WoodVinegar = new MaterialBuilder(661, TextureSet.SET_FLUID , "Wood Vinegar").addCell().addFluid().setRGB(212, 85, 0).setColor(Dyes.dyeBrown).constructMaterial(); + public static Materials Antimatter = new Materials( + -1, + TextureSet.SET_NONE, + 1.0F, + 0, + 0, + 0, + 255, + 255, + 255, + 0, + "Antimatter", + "Antimatter", + 0, + 0, + -1, + 0, + false, + false, + 1, + 1, + 1, + Dyes.dyePink, + Arrays.asList(new TC_AspectStack(TC_Aspects.POTENTIA, 9), new TC_AspectStack(TC_Aspects.PERFODIO, 8))); + + public static Materials AdvancedGlue = new MaterialBuilder(567, TextureSet.SET_FLUID, "Advanced Glue") + .setName("AdvancedGlue") + .addCell() + .addFluid() + .setRGB(255, 255, 185) + .setColor(Dyes.dyeYellow) + .setAspects(Collections.singletonList(new TC_AspectStack(TC_Aspects.LIMUS, 5))) + .constructMaterial(); + public static Materials BioFuel = new Materials( + 705, + TextureSet.SET_FLUID, + 1.0F, + 0, + 0, + 16, + 255, + 128, + 0, + 0, + "BioFuel", + "Biofuel", + 0, + 6, + -1, + 0, + false, + false, + 1, + 1, + 1, + Dyes.dyeOrange); + public static Materials Biomass = new Materials( + 704, + TextureSet.SET_FLUID, + 1.0F, + 0, + 0, + 16, + 0, + 255, + 0, + 0, + "Biomass", + "Forestry Biomass", + 3, + 8, + -1, + 0, + false, + false, + 1, + 1, + 1, + Dyes.dyeGreen); + public static Materials CharcoalByproducts = new MaterialBuilder(675, TextureSet.SET_FLUID, "Charcoal Byproducts") + .addCell() + .setRGB(120, 68, 33) + .setColor(Dyes.dyeBrown) + .constructMaterial(); + public static Materials Cheese = new Materials( + 894, + TextureSet.SET_FINE, + 1.0F, + 0, + 0, + 1 | 8, + 255, + 255, + 0, + 0, + "Cheese", + "Cheese", + 0, + 0, + 320, + 0, + false, + false, + 1, + 1, + 1, + Dyes.dyeYellow); + public static Materials Chili = new Materials( + 895, + TextureSet.SET_FINE, + 1.0F, + 0, + 0, + 1, + 200, + 0, + 0, + 0, + "Chili", + "Chili", + 0, + 0, + -1, + 0, + false, + false, + 1, + 1, + 1, + Dyes.dyeRed); + public static Materials Chocolate = new Materials( + 886, + TextureSet.SET_FINE, + 1.0F, + 0, + 0, + 1, + 190, + 95, + 0, + 0, + "Chocolate", + "Chocolate", + 0, + 0, + -1, + 0, + false, + false, + 1, + 1, + 1, + Dyes.dyeBrown); + public static Materials Cluster = new Materials( + -1, + TextureSet.SET_NONE, + 1.0F, + 0, + 0, + 0, + 255, + 255, + 255, + 127, + "Cluster", + "Cluster", + 0, + 0, + -1, + 0, + false, + true, + 1, + 1, + 1, + Dyes.dyeWhite); + public static Materials CoalFuel = new Materials( + 710, + TextureSet.SET_FLUID, + 1.0F, + 0, + 0, + 16, + 50, + 50, + 70, + 0, + "CoalFuel", + "Coalfuel", + 0, + 16, + -1, + 0, + false, + false, + 1, + 1, + 1, + Dyes.dyeBlack); + public static Materials Cocoa = new Materials( + 887, + TextureSet.SET_FINE, + 1.0F, + 0, + 0, + 1, + 190, + 95, + 0, + 0, + "Cocoa", + "Cocoa", + 0, + 0, + -1, + 0, + false, + false, + 1, + 1, + 1, + Dyes.dyeBrown); + public static Materials Coffee = new Materials( + 888, + TextureSet.SET_FINE, + 1.0F, + 0, + 0, + 1, + 150, + 75, + 0, + 0, + "Coffee", + "Coffee", + 0, + 0, + -1, + 0, + false, + false, + 1, + 1, + 1, + Dyes.dyeBrown); + public static Materials Creosote = new Materials( + 712, + TextureSet.SET_FLUID, + 1.0F, + 0, + 0, + 16, + 128, + 64, + 0, + 0, + "Creosote", + "Creosote", + 3, + 8, + -1, + 0, + false, + false, + 1, + 1, + 1, + Dyes.dyeBrown); + public static Materials Ethanol = new Materials( + 706, + TextureSet.SET_FLUID, + 1.0F, + 0, + 0, + 16, + 255, + 128, + 0, + 0, + "Ethanol", + "Ethanol", + 0, + 192, + -1, + 0, + false, + false, + 1, + 1, + 1, + Dyes.dyeOrange, + 1, + Arrays.asList(new MaterialStack(Carbon, 2), new MaterialStack(Hydrogen, 6), new MaterialStack(Oxygen, 1)), + Arrays.asList(new TC_AspectStack(TC_Aspects.VENENUM, 1), new TC_AspectStack(TC_Aspects.AQUA, 1))); + public static Materials FishOil = new Materials( + 711, + TextureSet.SET_FLUID, + 1.0F, + 0, + 0, + 16, + 255, + 196, + 0, + 0, + "FishOil", + "Fish Oil", + 3, + 2, + -1, + 0, + false, + false, + 1, + 1, + 1, + Dyes.dyeYellow, + Collections.singletonList(new TC_AspectStack(TC_Aspects.CORPUS, 2))); + public static Materials FermentedBiomass = new MaterialBuilder(691, TextureSet.SET_FLUID, "Fermented Biomass") + .addCell() + .addFluid() + .setRGB(68, 85, 0) + .setColor(Dyes.dyeBrown) + .constructMaterial(); + public static Materials Fuel = new Materials( + 708, + TextureSet.SET_FLUID, + 1.0F, + 0, + 0, + 16, + 255, + 255, + 0, + 0, + "Fuel", + "Diesel", + 0, + 480, + -1, + 0, + false, + false, + 1, + 1, + 1, + Dyes.dyeYellow); + public static Materials Glue = new Materials( + 726, + TextureSet.SET_FLUID, + 1.0F, + 0, + 0, + 16, + 200, + 196, + 0, + 0, + "Glue", + "Refined Glue", + 0, + 0, + -1, + 0, + false, + false, + 1, + 1, + 1, + Dyes.dyeOrange, + Collections.singletonList(new TC_AspectStack(TC_Aspects.LIMUS, 2))); + public static Materials Gunpowder = new Materials( + 800, + TextureSet.SET_DULL, + 1.0F, + 0, + 0, + 1, + 128, + 128, + 128, + 0, + "Gunpowder", + "Gunpowder", + 0, + 0, + -1, + 0, + false, + false, + 1, + 1, + 1, + Dyes.dyeGray, + Arrays.asList(new TC_AspectStack(TC_Aspects.PERDITIO, 3), new TC_AspectStack(TC_Aspects.IGNIS, 4))); + public static Materials FryingOilHot = new Materials( + 727, + TextureSet.SET_FLUID, + 1.0F, + 0, + 0, + 16, + 200, + 196, + 0, + 0, + "FryingOilHot", + "Hot Frying Oil", + 0, + 0, + -1, + 0, + false, + false, + 1, + 1, + 1, + Dyes.dyeOrange, + Arrays.asList(new TC_AspectStack(TC_Aspects.AQUA, 1), new TC_AspectStack(TC_Aspects.IGNIS, 1))); + public static Materials Honey = new Materials( + 725, + TextureSet.SET_FLUID, + 1.0F, + 0, + 0, + 16, + 210, + 200, + 0, + 0, + "Honey", + "Honey", + 0, + 0, + -1, + 0, + false, + false, + 1, + 1, + 1, + Dyes.dyeYellow); + public static Materials Leather = new Materials( + -1, + TextureSet.SET_ROUGH, + 1.0F, + 0, + 0, + 1, + 150, + 150, + 80, + 127, + "Leather", + "Leather", + 0, + 0, + -1, + 0, + false, + false, + 1, + 1, + 1, + Dyes.dyeOrange); + public static Materials Lubricant = new Materials( + 724, + TextureSet.SET_FLUID, + 1.0F, + 0, + 0, + 16, + 255, + 196, + 0, + 0, + "Lubricant", + "Lubricant", + 0, + 0, + -1, + 0, + false, + false, + 1, + 1, + 1, + Dyes.dyeOrange, + Arrays.asList(new TC_AspectStack(TC_Aspects.AQUA, 2), new TC_AspectStack(TC_Aspects.MACHINA, 1))); + public static Materials McGuffium239 = new Materials( + 999, + TextureSet.SET_FLUID, + 1.0F, + 0, + 0, + 16, + 200, + 50, + 150, + 0, + "McGuffium239", + "Mc Guffium 239", + 0, + 0, + -1, + 0, + false, + false, + 1, + 1, + 1, + Dyes.dyePink, + Arrays.asList( + new TC_AspectStack(TC_Aspects.ALIENIS, 8), + new TC_AspectStack(TC_Aspects.PERMUTATIO, 8), + new TC_AspectStack(TC_Aspects.SPIRITUS, 8), + new TC_AspectStack(TC_Aspects.AURAM, 8), + new TC_AspectStack(TC_Aspects.VITIUM, 8), + new TC_AspectStack(TC_Aspects.RADIO, 8), + new TC_AspectStack(TC_Aspects.MAGNETO, 8), + new TC_AspectStack(TC_Aspects.ELECTRUM, 8), + new TC_AspectStack(TC_Aspects.NEBRISUM, 8), + new TC_AspectStack(TC_Aspects.STRONTIO, 8))); + public static Materials MeatRaw = new Materials( + 892, + TextureSet.SET_FINE, + 1.0F, + 0, + 0, + 1, + 255, + 100, + 100, + 0, + "MeatRaw", + "Raw Meat", + 0, + 0, + -1, + 0, + false, + false, + 1, + 1, + 1, + Dyes.dyePink); + public static Materials MeatCooked = new Materials( + 893, + TextureSet.SET_FINE, + 1.0F, + 0, + 0, + 1, + 150, + 60, + 20, + 0, + "MeatCooked", + "Cooked Meat", + 0, + 0, + -1, + 0, + false, + false, + 1, + 1, + 1, + Dyes.dyePink); + public static Materials Milk = new Materials( + 885, + TextureSet.SET_FINE, + 1.0F, + 0, + 0, + 1 | 16, + 254, + 254, + 254, + 0, + "Milk", + "Milk", + 0, + 0, + -1, + 0, + false, + false, + 1, + 1, + 1, + Dyes.dyeWhite, + Collections.singletonList(new TC_AspectStack(TC_Aspects.SANO, 2))); + public static Materials Mud = new Materials( + -1, + TextureSet.SET_NONE, + 1.0F, + 0, + 0, + 0, + 255, + 255, + 255, + 0, + "Mud", + "Mud", + 0, + 0, + -1, + 0, + false, + false, + 1, + 1, + 1, + Dyes.dyeBrown); + public static Materials Oil = new Materials( + 707, + TextureSet.SET_FLUID, + 1.0F, + 0, + 0, + 16, + 10, + 10, + 10, + 0, + "Oil", + "Oil", + 3, + 20, + -1, + 0, + false, + false, + 1, + 1, + 1, + Dyes.dyeBlack); + public static Materials Paper = new Materials( + 879, + TextureSet.SET_PAPER, + 1.0F, + 0, + 0, + 1, + 250, + 250, + 250, + 0, + "Paper", + "Paper", + 0, + 0, + -1, + 0, + false, + false, + 1, + 1, + 1, + Dyes.dyeWhite, + Collections.singletonList(new TC_AspectStack(TC_Aspects.COGNITIO, 1))); + public static Materials Peat = new Materials( + -1, + TextureSet.SET_NONE, + 1.0F, + 0, + 0, + 0, + 255, + 255, + 255, + 0, + "Peat", + "Peat", + 0, + 0, + -1, + 0, + false, + false, + 1, + 1, + 1, + Dyes.dyeBrown, + Arrays.asList(new TC_AspectStack(TC_Aspects.POTENTIA, 2), new TC_AspectStack(TC_Aspects.IGNIS, 2))); + public static Materials RareEarth = new Materials( + 891, + TextureSet.SET_FINE, + 1.0F, + 0, + 0, + 1, + 128, + 128, + 100, + 0, + "RareEarth", + "Rare Earth", + 0, + 0, + -1, + 0, + false, + false, + 1, + 1, + 1, + Dyes.dyeGray, + Arrays.asList(new TC_AspectStack(TC_Aspects.VITREUS, 1), new TC_AspectStack(TC_Aspects.LUCRUM, 1))); + public static Materials Red = new Materials( + -1, + TextureSet.SET_NONE, + 1.0F, + 0, + 0, + 0, + 255, + 0, + 0, + 0, + "Red", + "Red", + 0, + 0, + -1, + 0, + false, + false, + 1, + 1, + 1, + Dyes.dyeRed); + public static Materials Reinforced = new Materials( + 383, + TextureSet.SET_METALLIC, + 7.0F, + 480, + 4, + 1 | 2 | 64 | 128, + 105, + 141, + 165, + 0, + "Reinforced", + "Reinforced", + 0, + 0, + -1, + 1700, + true, + false, + 1, + 1, + 1, + Dyes.dyeBlue) + .disableAutoGeneratedBlastFurnaceRecipes(); + public static Materials SeedOil = new Materials( + 713, + TextureSet.SET_FLUID, + 1.0F, + 0, + 0, + 16, + 196, + 255, + 0, + 0, + "SeedOil", + "Seed Oil", + 3, + 2, + -1, + 0, + false, + false, + 1, + 1, + 1, + Dyes.dyeLime, + Collections.singletonList(new TC_AspectStack(TC_Aspects.GRANUM, 2))); + public static Materials SeedOilHemp = new Materials( + 722, + TextureSet.SET_FLUID, + 1.0F, + 0, + 0, + 16, + 196, + 255, + 0, + 0, + "SeedOilHemp", + "Hemp Seed Oil", + 3, + 2, + -1, + 0, + false, + false, + 1, + 1, + 1, + Dyes.dyeLime, + Collections.singletonList(new TC_AspectStack(TC_Aspects.GRANUM, 2))); + public static Materials SeedOilLin = new Materials( + 723, + TextureSet.SET_FLUID, + 1.0F, + 0, + 0, + 16, + 196, + 255, + 0, + 0, + "SeedOilLin", + "Lin Seed Oil", + 3, + 2, + -1, + 0, + false, + false, + 1, + 1, + 1, + Dyes.dyeLime, + Collections.singletonList(new TC_AspectStack(TC_Aspects.GRANUM, 2))); + public static Materials Stone = new Materials( + 299, + TextureSet.SET_ROUGH, + 4.0F, + 32, + 1, + 1 | 64 | 128, + 205, + 205, + 205, + 0, + "Stone", + "Stone", + 0, + 0, + -1, + 0, + false, + false, + 1, + 1, + 1, + Dyes.dyeLightGray, + Collections.singletonList(new TC_AspectStack(TC_Aspects.TERRA, 1))); + public static Materials TNT = new Materials( + -1, + TextureSet.SET_NONE, + 1.0F, + 0, + 0, + 0, + 255, + 255, + 255, + 0, + "TNT", + "TNT", + 0, + 0, + -1, + 0, + false, + false, + 1, + 1, + 1, + Dyes.dyeRed, + Arrays.asList(new TC_AspectStack(TC_Aspects.PERDITIO, 7), new TC_AspectStack(TC_Aspects.IGNIS, 4))); + public static Materials Unstable = new Materials( + 396, + TextureSet.SET_SHINY, + 1.0F, + 0, + 4, + 1, + 220, + 220, + 220, + 127, + "Unstable", + "Unstable", + 0, + 0, + -1, + 0, + false, + true, + 1, + 1, + 1, + Dyes.dyeWhite, + Collections.singletonList(new TC_AspectStack(TC_Aspects.PERDITIO, 4))); + public static Materials Unstableingot = new Materials( + -1, + TextureSet.SET_NONE, + 1.0F, + 0, + 4, + 0, + 255, + 255, + 255, + 127, + "Unstableingot", + "Unstable", + 0, + 0, + -1, + 0, + false, + true, + 1, + 1, + 1, + Dyes.dyeWhite, + Collections.singletonList(new TC_AspectStack(TC_Aspects.PERDITIO, 4))); + public static Materials Vinegar = new MaterialBuilder(690, TextureSet.SET_FLUID, "Vinegar") + .setColor(Dyes.dyeBrown) + .constructMaterial(); + public static Materials Wheat = new Materials( + 881, + TextureSet.SET_POWDER, + 1.0F, + 0, + 0, + 1, + 255, + 255, + 196, + 0, + "Wheat", + "Wheat", + 0, + 0, + -1, + 0, + false, + false, + 1, + 1, + 1, + Dyes.dyeYellow, + Collections.singletonList(new TC_AspectStack(TC_Aspects.MESSIS, 2))); + public static Materials WoodGas = new MaterialBuilder(660, TextureSet.SET_FLUID, "Wood Gas") + .addCell() + .addGas() + .setRGB(222, 205, 135) + .setColor(Dyes.dyeBrown) + .setFuelType(MaterialBuilder.GAS) + .setFuelPower(24) + .constructMaterial(); + public static Materials WoodTar = new MaterialBuilder(662, TextureSet.SET_FLUID, "Wood Tar") + .addCell() + .addFluid() + .setRGB(40, 23, 11) + .setColor(Dyes.dyeBrown) + .constructMaterial(); + public static Materials WoodVinegar = new MaterialBuilder(661, TextureSet.SET_FLUID, "Wood Vinegar") + .addCell() + .addFluid() + .setRGB(212, 85, 0) + .setColor(Dyes.dyeBrown) + .constructMaterial(); /** * TODO: This */ - public static Materials AluminiumBrass = new Materials( -1, TextureSet.SET_METALLIC , 6.0F, 64, 2, 1|2 |64 , 255, 255, 255, 0, "AluminiumBrass" , "Aluminium Brass" , 0, 0, -1, 0, false, false, 1, 1, 1, Dyes.dyeYellow ); - public static Materials Osmiridium = new Materials( 317, TextureSet.SET_METALLIC , 7.0F, 1600, 3, 1|2 |64|128 , 100, 100, 255, 0, "Osmiridium" , "Osmiridium" , 0, 0, 3500, 4500, true, false, 1, 1, 1, Dyes.dyeLightBlue , 1, Arrays.asList(new MaterialStack(Iridium, 3), new MaterialStack(Osmium, 1))).disableAutoGeneratedBlastFurnaceRecipes(); - public static Materials Sunnarium = new Materials( 318, TextureSet.SET_SHINY , 1.0F, 0, 1, 1|2 |64|128 , 255, 255, 0, 0, "Sunnarium" , "Sunnarium" , 0, 0, 4200, 4200, true, false, 1, 1, 1, Dyes.dyeYellow ).disableAutoGeneratedBlastFurnaceRecipes(); - public static Materials Endstone = new Materials( 808, TextureSet.SET_DULL , 1.0F, 0, 1, 1 , 255, 255, 255, 0, "Endstone" , "Endstone" , 0, 0, -1, 0, false, false, 0, 1, 1, Dyes.dyeYellow ); - public static Materials Netherrack = new Materials( 807, TextureSet.SET_DULL , 1.0F, 0, 0, 1 , 200, 0, 0, 0, "Netherrack" , "Netherrack" , 0, 0, -1, 0, false, false, 0, 1, 1, Dyes.dyeRed ); - public static Materials SoulSand = new Materials( -1, TextureSet.SET_DULL , 1.0F, 0, 0, 1 , 255, 255, 255, 0, "SoulSand" , "Soulsand" , 0, 0, -1, 0, false, false, 0, 1, 1, Dyes.dyeBrown ); + public static Materials AluminiumBrass = new Materials( + -1, + TextureSet.SET_METALLIC, + 6.0F, + 64, + 2, + 1 | 2 | 64, + 255, + 255, + 255, + 0, + "AluminiumBrass", + "Aluminium Brass", + 0, + 0, + -1, + 0, + false, + false, + 1, + 1, + 1, + Dyes.dyeYellow); + + public static Materials Osmiridium = new Materials( + 317, + TextureSet.SET_METALLIC, + 7.0F, + 1600, + 3, + 1 | 2 | 64 | 128, + 100, + 100, + 255, + 0, + "Osmiridium", + "Osmiridium", + 0, + 0, + 3500, + 4500, + true, + false, + 1, + 1, + 1, + Dyes.dyeLightBlue, + 1, + Arrays.asList(new MaterialStack(Iridium, 3), new MaterialStack(Osmium, 1))) + .disableAutoGeneratedBlastFurnaceRecipes(); + public static Materials Sunnarium = new Materials( + 318, + TextureSet.SET_SHINY, + 1.0F, + 0, + 1, + 1 | 2 | 64 | 128, + 255, + 255, + 0, + 0, + "Sunnarium", + "Sunnarium", + 0, + 0, + 4200, + 4200, + true, + false, + 1, + 1, + 1, + Dyes.dyeYellow) + .disableAutoGeneratedBlastFurnaceRecipes(); + public static Materials Endstone = new Materials( + 808, + TextureSet.SET_DULL, + 1.0F, + 0, + 1, + 1, + 255, + 255, + 255, + 0, + "Endstone", + "Endstone", + 0, + 0, + -1, + 0, + false, + false, + 0, + 1, + 1, + Dyes.dyeYellow); + public static Materials Netherrack = new Materials( + 807, + TextureSet.SET_DULL, + 1.0F, + 0, + 0, + 1, + 200, + 0, + 0, + 0, + "Netherrack", + "Netherrack", + 0, + 0, + -1, + 0, + false, + false, + 0, + 1, + 1, + Dyes.dyeRed); + public static Materials SoulSand = new Materials( + -1, + TextureSet.SET_DULL, + 1.0F, + 0, + 0, + 1, + 255, + 255, + 255, + 0, + "SoulSand", + "Soulsand", + 0, + 0, + -1, + 0, + false, + false, + 0, + 1, + 1, + Dyes.dyeBrown); /** * First Degree Compounds */ - public static Materials Methane = new Materials( 715, TextureSet.SET_FLUID , 1.0F, 0, 1, 16 , 255, 255, 255, 0, "Methane" , "Methane" , 1, 104, -1, 0, false, false, 3, 1, 1, Dyes.dyeMagenta , 1, Arrays.asList(new MaterialStack(Carbon, 1), new MaterialStack(Hydrogen, 4))); - public static Materials CarbonDioxide = new Materials( 497, TextureSet.SET_FLUID , 1.0F, 0, 2, 16|32 , 169, 208, 245, 240, "CarbonDioxide" , "Carbon Dioxide" , 0, 0, 25, 1, false, true, 1, 1, 1, Dyes.dyeLightBlue , 0, Arrays.asList(new MaterialStack(Carbon, 1), new MaterialStack(Oxygen, 2))).setHasCorrespondingGas(true); - public static Materials NobleGases = new Materials( 496, TextureSet.SET_FLUID , 1.0F, 0, 2, 16|32 , 169, 208, 245, 240, "NobleGases" , "Noble Gases" , 0, 0, 4, 0, false, true, 1, 1, 1, Dyes.dyeLightBlue , 2, Arrays.asList(new MaterialStack(CarbonDioxide,21),new MaterialStack(Helium, 9), new MaterialStack(Methane, 3), new MaterialStack(Deuterium, 1))).setHasCorrespondingGas(true); - public static Materials Air = new Materials( -1, TextureSet.SET_FLUID , 1.0F, 0, 2, 16|32 , 169, 208, 245, 240, "Air" , "Air" , 0, 0, -1, 0, false, true, 1, 1, 1, Dyes.dyeLightBlue , 0, Arrays.asList(new MaterialStack(Nitrogen, 40), new MaterialStack(Oxygen, 11), new MaterialStack(Argon, 1),new MaterialStack(NobleGases,1))); - public static Materials LiquidAir = new Materials( 495, TextureSet.SET_FLUID , 1.0F, 0, 2, 16|32 , 169, 208, 245, 240, "LiquidAir" , "Liquid Air" , 0, 0, 4, 0, false, true, 1, 1, 1, Dyes.dyeLightBlue , 2, Arrays.asList(new MaterialStack(Nitrogen, 40), new MaterialStack(Oxygen, 11), new MaterialStack(Argon, 1),new MaterialStack(NobleGases,1))); - public static Materials LiquidNitrogen = new Materials( 494, TextureSet.SET_FLUID , 1.0F, 0, 2, 16|32 , 169, 208, 245, 240, "LiquidNitrogen" , "Liquid Nitrogen" , 0, 0, 4, 0, false, true, 1, 1, 1, Dyes.dyeLightBlue , 1, Collections.singletonList(new MaterialStack(Nitrogen, 1))); - public static Materials LiquidOxygen = new Materials( 493, TextureSet.SET_FLUID , 1.0F, 0, 2, 16|32 , 169, 208, 245, 240, "LiquidOxygen" , "Liquid Oxygen" , 0, 0, 4, 0, false, true, 1, 1, 1, Dyes.dyeLightBlue , 1, Collections.singletonList(new MaterialStack(Oxygen, 1))); - public static Materials SiliconDioxide = new MaterialBuilder(837, TextureSet.SET_QUARTZ, "Silicon Dioxide").setToolSpeed(1.0F).setDurability(0).setToolQuality(1).addDustItems().setRGB(255, 255, 255).setColor(Dyes.dyeLightGray).setOreValue(1).setExtraData(0).setMaterialList(new MaterialStack(Silicon, 1), new MaterialStack(Oxygen, 2)).constructMaterial(); - public static Materials Jasper = new Materials( 511, TextureSet.SET_EMERALD , 1.0F, 0, 2, 1 |4|8 |64 , 200, 80, 80, 100, "Jasper" , "Jasper" , 0, 0, -1, 0, false, true, 3, 1, 1, Dyes.dyeRed , 1, Collections.singletonList(new MaterialStack(SiliconDioxide, 1)), Arrays.asList(new TC_AspectStack(TC_Aspects.LUCRUM, 4), new TC_AspectStack(TC_Aspects.VITREUS, 2))); - public static Materials Almandine = new Materials( 820, TextureSet.SET_ROUGH , 1.0F, 0, 1, 1 |8 , 255, 0, 0, 0, "Almandine" , "Almandine" , 0, 0, -1, 0, false, false, 3, 1, 1, Dyes.dyeRed , 1, Arrays.asList(new MaterialStack(Aluminium, 2), new MaterialStack(Iron, 3), new MaterialStack(Silicon, 3), new MaterialStack(Oxygen, 12))); - public static Materials Andradite = new Materials( 821, TextureSet.SET_ROUGH , 1.0F, 0, 1, 1 |8 , 150, 120, 0, 0, "Andradite" , "Andradite" , 0, 0, -1, 0, false, false, 3, 1, 1, Dyes.dyeYellow , 1, Arrays.asList(new MaterialStack(Calcium, 3), new MaterialStack(Iron, 2), new MaterialStack(Silicon, 3), new MaterialStack(Oxygen, 12))); - public static Materials AnnealedCopper = new Materials( 345, TextureSet.SET_SHINY , 1.0F, 0, 2, 1|2 |128 , 255, 120, 20, 0, "AnnealedCopper" , "Annealed Copper" , 0, 0, -1, 0, false, false, 3, 1, 1, Dyes.dyeOrange , 2, Collections.singletonList(new MaterialStack(Copper, 1))); - public static Materials Asbestos = new Materials( 946, TextureSet.SET_DULL , 1.0F, 0, 1, 1 |8 , 230, 230, 230, 0, "Asbestos" , "Asbestos" , 0, 0, -1, 0, false, false, 1, 1, 1, Dyes.dyeWhite , 1, Arrays.asList(new MaterialStack(Magnesium, 3), new MaterialStack(Silicon, 2), new MaterialStack(Hydrogen, 4), new MaterialStack(Oxygen, 9))); // Mg3Si2O5(OH)4 - public static Materials Ash = new Materials( 815, TextureSet.SET_DULL , 1.0F, 0, 1, 1 , 150, 150, 150, 0, "Ash" , "Ashes" , 0, 0, -1, 0, false, false, 1, 1, 1, Dyes.dyeLightGray , 2, Collections.singletonList(new MaterialStack(Carbon, 1)), Collections.singletonList(new TC_AspectStack(TC_Aspects.PERDITIO, 1))); - public static Materials BandedIron = new Materials( 917, TextureSet.SET_DULL , 1.0F, 0, 2, 1 |8 , 145, 90, 90, 0, "BandedIron" , "Banded Iron" , 0, 0, -1, 0, false, false, 1, 1, 1, Dyes.dyeBrown , 1, Arrays.asList(new MaterialStack(Iron, 2), new MaterialStack(Oxygen, 3))); - public static Materials BatteryAlloy = new Materials( 315, TextureSet.SET_DULL , 1.0F, 0, 1, 1|2 , 156, 124, 160, 0, "BatteryAlloy" , "Battery Alloy" , 0, 0, -1, 0, false, false, 1, 1, 1, Dyes.dyePurple , 2, Arrays.asList(new MaterialStack(Lead, 4), new MaterialStack(Antimony, 1))); - public static Materials BlueTopaz = new Materials( 513, TextureSet.SET_GEM_HORIZONTAL , 7.0F, 256, 3, 1 |4|8 |64 , 0, 0, 255, 127, "BlueTopaz" , "Blue Topaz" , 0, 0, -1, 0, false, true, 3, 1, 1, Dyes.dyeBlue , 1, Arrays.asList(new MaterialStack(Aluminium, 2), new MaterialStack(Silicon, 1), new MaterialStack(Fluorine, 2), new MaterialStack(Hydrogen, 2), new MaterialStack(Oxygen, 6)), Arrays.asList(new TC_AspectStack(TC_Aspects.LUCRUM, 6), new TC_AspectStack(TC_Aspects.VITREUS, 4))); - public static Materials Bone = new Materials( 806, TextureSet.SET_DULL , 1.0F, 0, 1, 1 , 250, 250, 250, 0, "Bone" , "Bone" , 0, 0, -1, 0, false, false, 1, 1, 1, Dyes.dyeWhite , 0, Collections.singletonList(new MaterialStack(Calcium, 1)), Arrays.asList(new TC_AspectStack(TC_Aspects.MORTUUS, 2), new TC_AspectStack(TC_Aspects.CORPUS, 1))); - public static Materials Brass = new Materials( 301, TextureSet.SET_METALLIC , 7.0F, 96, 1, 1|2 |64|128 , 255, 180, 0, 0, "Brass" , "Brass" , 0, 0, -1, 0, false, false, 1, 1, 1, Dyes.dyeYellow , 2, Arrays.asList(new MaterialStack(Zinc, 1), new MaterialStack(Copper, 3)), Arrays.asList(new TC_AspectStack(TC_Aspects.METALLUM, 2), new TC_AspectStack(TC_Aspects.INSTRUMENTUM, 1))); - public static Materials Bronze = new Materials( 300, TextureSet.SET_METALLIC , 6.0F, 192, 2, 1|2 |64|128 , 255, 128, 0, 0, "Bronze" , "Bronze" , 0, 0, -1, 0, false, false, 1, 1, 1, Dyes.dyeOrange , 2, Arrays.asList(new MaterialStack(Tin, 1), new MaterialStack(Copper, 3)), Arrays.asList(new TC_AspectStack(TC_Aspects.METALLUM, 2), new TC_AspectStack(TC_Aspects.INSTRUMENTUM, 1))); - public static Materials BrownLimonite = new Materials( 930, TextureSet.SET_METALLIC , 1.0F, 0, 1, 1 |8 , 200, 100, 0, 0, "BrownLimonite" , "Brown Limonite" , 0, 0, -1, 0, false, false, 1, 1, 1, Dyes.dyeBrown , 2, Arrays.asList(new MaterialStack(Iron, 1), new MaterialStack(Hydrogen, 1), new MaterialStack(Oxygen, 2))); // FeO(OH) - public static Materials Calcite = new Materials( 823, TextureSet.SET_DULL , 1.0F, 0, 1, 1 |8 , 250, 230, 220, 0, "Calcite" , "Calcite" , 0, 0, -1, 0, false, false, 1, 1, 1, Dyes.dyeOrange , 1, Arrays.asList(new MaterialStack(Calcium, 1), new MaterialStack(Carbon, 1), new MaterialStack(Oxygen, 3))); - public static Materials Cassiterite = new Materials( 824, TextureSet.SET_METALLIC , 1.0F, 0, 3, 1 |8 , 220, 220, 220, 0, "Cassiterite" , "Cassiterite" , 0, 0, -1, 0, false, false, 1, 1, 1, Dyes.dyeWhite , 1, Arrays.asList(new MaterialStack(Tin, 1), new MaterialStack(Oxygen, 2))); - public static Materials CassiteriteSand = new Materials( 937, TextureSet.SET_SAND , 1.0F, 0, 1, 1 |8 , 220, 220, 220, 0, "CassiteriteSand" , "Cassiterite Sand" , 0, 0, -1, 0, false, false, 4, 1, 1, Dyes.dyeWhite , 1, Arrays.asList(new MaterialStack(Tin, 1), new MaterialStack(Oxygen, 2))); - public static Materials Chalcopyrite = new Materials( 855, TextureSet.SET_DULL , 1.0F, 0, 1, 1 |8 , 160, 120, 40, 0, "Chalcopyrite" , "Chalcopyrite" , 0, 0, -1, 0, false, false, 1, 1, 1, Dyes.dyeYellow , 1, Arrays.asList(new MaterialStack(Copper, 1), new MaterialStack(Iron, 1), new MaterialStack(Sulfur, 2))); - public static Materials Charcoal = new Materials( 536, TextureSet.SET_FINE , 1.0F, 0, 1, 1 |4 , 100, 70, 70, 0, "Charcoal" , "Charcoal" , 0, 0, -1, 0, false, false, 1, 1, 1, Dyes.dyeBlack , 1, Collections.singletonList(new MaterialStack(Carbon, 1)), Arrays.asList(new TC_AspectStack(TC_Aspects.POTENTIA, 2), new TC_AspectStack(TC_Aspects.IGNIS, 2))); - public static Materials Chromite = new Materials( 825, TextureSet.SET_METALLIC , 1.0F, 0, 1, 1 |8 , 35, 20, 15, 0, "Chromite" , "Chromite" , 0, 0, 1700, 1700, true, false, 6, 1, 1, Dyes.dyePink , 1, Arrays.asList(new MaterialStack(Iron, 1), new MaterialStack(Chrome, 2), new MaterialStack(Oxygen, 4))); - public static Materials ChromiumDioxide = new Materials( 361, TextureSet.SET_DULL , 11.0F, 256, 3, 1|2 , 230, 200, 200, 0, "ChromiumDioxide" , "Chromium Dioxide" , 0, 0, 650, 650, false, false, 5, 3, 1, Dyes.dyePink , 1, Arrays.asList(new MaterialStack(Chrome, 1), new MaterialStack(Oxygen, 2)), Arrays.asList(new TC_AspectStack(TC_Aspects.METALLUM, 2), new TC_AspectStack(TC_Aspects.MACHINA, 1))); - public static Materials Cinnabar = new Materials( 826, TextureSet.SET_ROUGH , 1.0F, 0, 1, 1 |8 , 150, 0, 0, 0, "Cinnabar" , "Cinnabar" , 0, 0, -1, 0, false, false, 3, 1, 1, Dyes.dyeBrown , 2, Arrays.asList(new MaterialStack(Mercury, 1), new MaterialStack(Sulfur, 1))); - public static Materials Water = new Materials( 701, TextureSet.SET_FLUID , 1.0F, 0, 0, 16 , 0, 0, 255, 0, "Water" , "Water" , 0, 0, -1, 0, false, false, 1, 1, 1, Dyes.dyeBlue , 0, Arrays.asList(new MaterialStack(Hydrogen, 2), new MaterialStack(Oxygen, 1)), Collections.singletonList(new TC_AspectStack(TC_Aspects.AQUA, 2))); - public static Materials Clay = new Materials( 805, TextureSet.SET_ROUGH , 1.0F, 0, 1, 1 , 200, 200, 220, 0, "Clay" , "Clay" , 0, 0, -1, 0, false, false, 5, 1, 1, Dyes.dyeLightBlue , 0, Arrays.asList(new MaterialStack(Sodium, 2), new MaterialStack(Lithium, 1), new MaterialStack(Aluminium, 2), new MaterialStack(Silicon, 2),new MaterialStack(Water,6))); - public static Materials Coal = new Materials( 535, TextureSet.SET_ROUGH , 1.0F, 0, 1, 1 |4|8 , 70, 70, 70, 0, "Coal" , "Coal" , 0, 0, -1, 0, false, false, 2, 2, 1, Dyes.dyeBlack , 1, Collections.singletonList(new MaterialStack(Carbon, 1)), Arrays.asList(new TC_AspectStack(TC_Aspects.POTENTIA, 2), new TC_AspectStack(TC_Aspects.IGNIS, 2))); - public static Materials Cobaltite = new Materials( 827, TextureSet.SET_METALLIC , 1.0F, 0, 1, 1 |8 , 80, 80, 250, 0, "Cobaltite" , "Cobaltite" , 0, 0, -1, 0, false, false, 3, 1, 1, Dyes.dyeBlue , 1, Arrays.asList(new MaterialStack(Cobalt, 1), new MaterialStack(Arsenic, 1), new MaterialStack(Sulfur, 1))); - public static Materials Cooperite = new Materials( 828, TextureSet.SET_METALLIC , 1.0F, 0, 1, 1 |8 , 255, 255, 200, 0, "Cooperite" , "Sheldonite" , 0, 0, -1, 0, false, false, 5, 1, 1, Dyes.dyeYellow , 2, Arrays.asList(new MaterialStack(Platinum, 3), new MaterialStack(Nickel, 1), new MaterialStack(Sulfur, 1), new MaterialStack(Palladium, 1))); - public static Materials Cupronickel = new Materials( 310, TextureSet.SET_METALLIC , 6.0F, 64, 1, 1|2 |64 , 227, 150, 128, 0, "Cupronickel" , "Cupronickel" , 0, 0, -1, 0, false, false, 1, 1, 1, Dyes.dyeOrange , 2, Arrays.asList(new MaterialStack(Copper, 1), new MaterialStack(Nickel, 1))); - public static Materials DarkAsh = new Materials( 816, TextureSet.SET_DULL , 1.0F, 0, 1, 1 , 50, 50, 50, 0, "DarkAsh" , "Dark Ashes" , 0, 0, -1, 0, false, false, 1, 2, 1, Dyes.dyeGray , 1, Collections.singletonList(new MaterialStack(Carbon, 1)), Arrays.asList(new TC_AspectStack(TC_Aspects.IGNIS, 1), new TC_AspectStack(TC_Aspects.PERDITIO, 1))); - public static Materials DeepIron = new Materials( 829, TextureSet.SET_METALLIC , 6.0F, 384, 2, 1|2 |8 |64 , 150, 140, 140, 0, "DeepIron" , "Deep Iron" , 0, 0, 7500, 7500, true, false, 3, 1, 1, Dyes.dyePink , 2, Collections.singletonList(new MaterialStack(Iron, 1)), Arrays.asList(new TC_AspectStack(TC_Aspects.METALLUM, 2), new TC_AspectStack(TC_Aspects.MAGNETO, 1))); - public static Materials Diamond = new Materials( 500, TextureSet.SET_DIAMOND , 8.0F, 1280, 4, 1 |4|8 |64|128 , 200, 255, 255, 127, "Diamond" , "Diamond" , 0, 0, -1, 0, false, true, 5, 64, 1, Dyes.dyeWhite , 1, Collections.singletonList(new MaterialStack(Carbon, 1)), Arrays.asList(new TC_AspectStack(TC_Aspects.VITREUS, 3), new TC_AspectStack(TC_Aspects.LUCRUM, 4))); - public static Materials Electrum = new Materials( 303, TextureSet.SET_SHINY , 12.0F, 64, 2, 1|2 |8 |64|128 , 255, 255, 100, 0, "Electrum" , "Electrum" , 0, 0, -1, 0, false, false, 4, 1, 1, Dyes.dyeYellow , 2, Arrays.asList(new MaterialStack(Silver, 1), new MaterialStack(Gold, 1))); - public static Materials Emerald = new Materials( 501, TextureSet.SET_EMERALD , 7.0F, 256, 4, 1 |4|8 |64 , 80, 255, 80, 127, "Emerald" , "Emerald" , 0, 0, -1, 0, false, true, 5, 1, 1, Dyes.dyeGreen , 1, Arrays.asList(new MaterialStack(Beryllium, 3), new MaterialStack(Aluminium, 2), new MaterialStack(Silicon, 6), new MaterialStack(Oxygen, 18)), Arrays.asList(new TC_AspectStack(TC_Aspects.VITREUS, 3), new TC_AspectStack(TC_Aspects.LUCRUM, 5))); - public static Materials FreshWater = new Materials( -1, TextureSet.SET_FLUID , 1.0F, 0, 0, 16 , 0, 0, 255, 0, "FreshWater" , "Fresh Water" , 0, 0, -1, 0, false, false, 1, 1, 1, Dyes.dyeBlue , 0, Arrays.asList(new MaterialStack(Hydrogen, 2), new MaterialStack(Oxygen, 1)), Collections.singletonList(new TC_AspectStack(TC_Aspects.AQUA, 2))); - public static Materials Galena = new Materials( 830, TextureSet.SET_DULL , 1.0F, 0, 3, 1 |8 , 100, 60, 100, 0, "Galena" , "Galena" , 0, 0, -1, 0, false, false, 4, 1, 1, Dyes.dyePurple , 1, Arrays.asList(new MaterialStack(Lead, 1), new MaterialStack(Sulfur, 1))); - public static Materials Garnierite = new Materials( 906, TextureSet.SET_METALLIC , 1.0F, 0, 3, 1 |8 , 50, 200, 70, 0, "Garnierite" , "Garnierite" , 0, 0, -1, 0, false, false, 1, 1, 1, Dyes.dyeLightBlue , 1, Arrays.asList(new MaterialStack(Nickel, 1), new MaterialStack(Oxygen, 1))); - public static Materials Glyceryl = new Materials( 714, TextureSet.SET_FLUID , 1.0F, 0, 1, 16 , 0, 150, 150, 0, "Glyceryl" , "Glyceryl Trinitrate" , 0, 0, -1, 0, false, false, 1, 1, 1, Dyes.dyeCyan , 1, Arrays.asList(new MaterialStack(Carbon, 3), new MaterialStack(Hydrogen, 5), new MaterialStack(Nitrogen, 3), new MaterialStack(Oxygen, 9))); - public static Materials GreenSapphire = new MaterialBuilder(504, TextureSet.SET_GEM_HORIZONTAL, "Green Sapphire").setToolSpeed(7.0F).setDurability(256).setToolQuality(2).addDustItems().addGemItems().setTransparent(true).addOreItems().addToolHeadItems().setRGBA(100, 200, 130, 127).setColor(Dyes.dyeCyan).setOreValue(5).setExtraData(0).setMaterialList(new MaterialStack(Aluminium, 2), new MaterialStack(Oxygen, 3)).setAspects(Arrays.asList(new TC_AspectStack(TC_Aspects.LUCRUM, 5), new TC_AspectStack(TC_Aspects.VITREUS, 3))).constructMaterial().disableAutoGeneratedBlastFurnaceRecipes(); - public static Materials Grossular = new Materials( 831, TextureSet.SET_ROUGH , 1.0F, 0, 1, 1 |8 , 200, 100, 0, 0, "Grossular" , "Grossular" , 0, 0, -1, 0, false, false, 3, 1, 1, Dyes.dyeOrange , 1, Arrays.asList(new MaterialStack(Calcium, 3), new MaterialStack(Aluminium, 2), new MaterialStack(Silicon, 3), new MaterialStack(Oxygen, 12))); - public static Materials HolyWater = new Materials( 729, TextureSet.SET_FLUID , 1.0F, 0, 0, 16 , 0, 0, 255, 0, "HolyWater" , "Holy Water" , 0, 0, -1, 0, false, false, 1, 1, 1, Dyes.dyeBlue , 0, Arrays.asList(new MaterialStack(Hydrogen, 2), new MaterialStack(Oxygen, 1)), Arrays.asList(new TC_AspectStack(TC_Aspects.AQUA, 2), new TC_AspectStack(TC_Aspects.AURAM, 1))); - public static Materials Ice = new Materials( 702, TextureSet.SET_SHINY , 1.0F, 0, 0, 1| 16 , 200, 200, 255, 0, "Ice" , "Ice" , 0, 0, -1, 0, false, false, 1, 1, 1, Dyes.dyeBlue , 0, Arrays.asList(new MaterialStack(Hydrogen, 2), new MaterialStack(Oxygen, 1)), Collections.singletonList(new TC_AspectStack(TC_Aspects.GELUM, 2))); - public static Materials Ilmenite = new Materials( 918, TextureSet.SET_METALLIC , 1.0F, 0, 3, 1 |8 , 70, 55, 50, 0, "Ilmenite" , "Ilmenite" , 0, 0, -1, 0, false, false, 1, 2, 1, Dyes.dyePurple , 0, Arrays.asList(new MaterialStack(Iron, 1), new MaterialStack(Titanium, 1), new MaterialStack(Oxygen, 3))); - public static Materials Rutile = new Materials( 375, TextureSet.SET_GEM_HORIZONTAL , 1.0F, 0, 2, 1 |8 , 212, 13, 92, 0, "Rutile" , "Rutile" , 0, 0, -1, 0, false, false, 1, 2, 1, Dyes.dyeRed , 0, Arrays.asList(new MaterialStack(Titanium, 1), new MaterialStack(Oxygen, 2))); - public static Materials Bauxite = new Materials( 822, TextureSet.SET_DULL , 1.0F, 0, 1, 1 |8 , 200, 100, 0, 0, "Bauxite" , "Bauxite" , 0, 0, -1, 0, false, false, 3, 1, 1, Dyes.dyeBrown , 1, Arrays.asList(new MaterialStack(Rutile, 2), new MaterialStack(Aluminium, 16), new MaterialStack(Hydrogen, 10), new MaterialStack(Oxygen, 11))); - public static Materials Titaniumtetrachloride = new Materials( 376, TextureSet.SET_FLUID , 1.0F, 0, 2, 16 , 212, 13, 92, 0, "Titaniumtetrachloride" , "Titaniumtetrachloride" , 0, 0, -1, 0, false, false, 1, 1, 1, Dyes.dyeRed , 0, Arrays.asList(new MaterialStack(Titanium, 1), new MaterialStack(Chlorine, 4))); - public static Materials Magnesiumchloride = new Materials( 377, TextureSet.SET_DULL , 1.0F, 0, 2, 1|16 , 212, 13, 92, 0, "Magnesiumchloride" , "Magnesiumchloride" , 0, 0, -1, 0, false, false, 1, 1, 1, Dyes.dyeRed , 0, Arrays.asList(new MaterialStack(Magnesium, 1), new MaterialStack(Chlorine, 2))); - public static Materials Invar = new Materials( 302, TextureSet.SET_METALLIC , 6.0F, 256, 2, 1|2 |64|128 , 180, 180, 120, 0, "Invar" , "Invar" , 0, 0, -1, 0, false, false, 1, 1, 1, Dyes.dyeBrown , 2, Arrays.asList(new MaterialStack(Iron, 2), new MaterialStack(Nickel, 1)), Arrays.asList(new TC_AspectStack(TC_Aspects.METALLUM, 2), new TC_AspectStack(TC_Aspects.GELUM, 1))); - public static Materials Kanthal = new Materials( 312, TextureSet.SET_METALLIC , 6.0F, 64, 2, 1|2 |64 , 194, 210, 223, 0, "Kanthal" , "Kanthal" , 0, 0, 1800, 1800, true, false, 1, 1, 1, Dyes.dyeYellow , 2, Arrays.asList(new MaterialStack(Iron, 1), new MaterialStack(Aluminium, 1), new MaterialStack(Chrome, 1))).disableAutoGeneratedBlastFurnaceRecipes(); - public static Materials Lazurite = new Materials( 524, TextureSet.SET_LAPIS , 1.0F, 0, 1, 1 |4|8 , 100, 120, 255, 0, "Lazurite" , "Lazurite" , 0, 0, -1, 0, false, false, 3, 1, 1, Dyes.dyeCyan , 1, Arrays.asList(new MaterialStack(Aluminium, 6), new MaterialStack(Silicon, 6), new MaterialStack(Calcium, 8), new MaterialStack(Sodium, 8))); - public static Materials Magnalium = new Materials( 313, TextureSet.SET_DULL , 6.0F, 256, 2, 1|2 |64|128 , 200, 190, 255, 0, "Magnalium" , "Magnalium" , 0, 0, -1, 0, false, false, 1, 1, 1, Dyes.dyeLightBlue , 2, Arrays.asList(new MaterialStack(Magnesium, 1), new MaterialStack(Aluminium, 2))); - public static Materials Magnesite = new Materials( 908, TextureSet.SET_METALLIC , 1.0F, 0, 2, 1 |8 , 250, 250, 180, 0, "Magnesite" , "Magnesite" , 0, 0, -1, 0, false, false, 1, 1, 1, Dyes.dyePink , 1, Arrays.asList(new MaterialStack(Magnesium, 1), new MaterialStack(Carbon, 1), new MaterialStack(Oxygen, 3))); - public static Materials Magnetite = new Materials( 870, TextureSet.SET_METALLIC , 1.0F, 0, 2, 1 |8 , 30, 30, 30, 0, "Magnetite" , "Magnetite" , 0, 0, -1, 0, false, false, 1, 1, 1, Dyes.dyeGray , 1, Arrays.asList(new MaterialStack(Iron, 3), new MaterialStack(Oxygen, 4)), Arrays.asList(new TC_AspectStack(TC_Aspects.METALLUM, 2), new TC_AspectStack(TC_Aspects.MAGNETO, 1))); - public static Materials Molybdenite = new Materials( 942, TextureSet.SET_METALLIC , 1.0F, 0, 2, 1 |8 , 25, 25, 25, 0, "Molybdenite" , "Molybdenite" , 0, 0, -1, 0, false, false, 1, 1, 1, Dyes.dyeBlue , 1, Arrays.asList(new MaterialStack(Molybdenum, 1), new MaterialStack(Sulfur, 2))); // MoS2 (also source of Re) - public static Materials Nichrome = new Materials( 311, TextureSet.SET_METALLIC , 6.0F, 64, 2, 1|2 |64 , 205, 206, 246, 0, "Nichrome" , "Nichrome" , 0, 0, 2700, 2700, true, false, 1, 1, 1, Dyes.dyeRed , 2, Arrays.asList(new MaterialStack(Nickel, 4), new MaterialStack(Chrome, 1))).disableAutoGeneratedBlastFurnaceRecipes(); - public static Materials NiobiumNitride = new Materials( 359, TextureSet.SET_DULL , 1.0F, 0, 2, 1|2 , 29, 41, 29, 0, "NiobiumNitride" , "Niobium Nitride" , 0, 0, 2573, 2573, true, false, 1, 1, 1, Dyes.dyeBlack , 1, Arrays.asList(new MaterialStack(Niobium, 1), new MaterialStack(Nitrogen, 1))); // Anti-Reflective Material - public static Materials NiobiumTitanium = new Materials( 360, TextureSet.SET_DULL , 1.0F, 0, 2, 1|2 , 29, 29, 41, 0, "NiobiumTitanium" , "Niobium-Titanium" , 0, 0, 4500, 4500, true, false, 1, 1, 1, Dyes.dyeBlack , 2, Arrays.asList(new MaterialStack(Niobium, 1), new MaterialStack(Titanium, 1))).disableAutoGeneratedBlastFurnaceRecipes(); - public static Materials NitroCarbon = new Materials( 716, TextureSet.SET_FLUID , 1.0F, 0, 1, 16 , 0, 75, 100, 0, "NitroCarbon" , "Nitro-Carbon" , 0, 0, -1, 0, false, false, 1, 1, 1, Dyes.dyeCyan , 1, Arrays.asList(new MaterialStack(Nitrogen, 1), new MaterialStack(Carbon, 1))); - public static Materials NitrogenDioxide = new Materials( 717, TextureSet.SET_FLUID , 1.0F, 0, 1, 16 , 100, 175, 255, 0, "NitrogenDioxide" , "Nitrogen Dioxide" , 0, 0, -1, 0, false, false, 1, 1, 1, Dyes.dyeCyan , 1, Arrays.asList(new MaterialStack(Nitrogen, 1), new MaterialStack(Oxygen, 2))); - public static Materials Obsidian = new Materials( 804, TextureSet.SET_DULL , 1.0F, 0, 3, 1 , 80, 50, 100, 0, "Obsidian" , "Obsidian" , 0, 0, -1, 0, false, false, 1, 1, 1, Dyes.dyeBlack , 1, Arrays.asList(new MaterialStack(Magnesium, 1), new MaterialStack(Iron, 1), new MaterialStack(Silicon, 2), new MaterialStack(Oxygen, 8))); - public static Materials Phosphate = new Materials( 833, TextureSet.SET_DULL , 1.0F, 0, 1, 1 |8|16 , 255, 255, 0, 0, "Phosphate" , "Phosphate" , 0, 0, -1, 0, false, false, 2, 1, 1, Dyes.dyeYellow , 1, Arrays.asList(new MaterialStack(Phosphorus, 1), new MaterialStack(Oxygen, 4))); - public static Materials PigIron = new Materials( 307, TextureSet.SET_METALLIC , 6.0F, 384, 2, 1|2 |8 |64 , 200, 180, 180, 0, "PigIron" , "Pig Iron" , 0, 0, -1, 0, false, false, 3, 1, 1, Dyes.dyePink , 2, Collections.singletonList(new MaterialStack(Iron, 1))); - public static Materials Plastic = new Materials( 874, TextureSet.SET_DULL , 3.0F, 32, 1, 1|2 |64|128 , 200, 200, 200, 0, "Plastic" , "Polyethylene" , 0, 0, 400, 0, false, false, 1, 1, 1, Dyes.dyeWhite , 0, Arrays.asList(new MaterialStack(Carbon, 1), new MaterialStack(Hydrogen, 2)), Collections.singletonList(new TC_AspectStack(TC_Aspects.MOTUS, 2))); - public static Materials Epoxid = new Materials( 470, TextureSet.SET_DULL , 3.0F, 32, 1, 1|2 |64|128 , 200, 140, 20, 0, "Epoxid" , "Epoxid" , 0, 0, 400, 0, false, false, 1, 1, 1, Dyes.dyeWhite , 0, Arrays.asList(new MaterialStack(Carbon, 21), new MaterialStack(Hydrogen, 24), new MaterialStack(Oxygen, 4)), Collections.singletonList(new TC_AspectStack(TC_Aspects.MOTUS, 2))); - public static Materials Polydimethylsiloxane = new MaterialBuilder(633, TextureSet.SET_FLUID , "Polydimethylsiloxane").addDustItems().setRGB(245, 245, 245).setColor(Dyes.dyeWhite).setMaterialList(new MaterialStack(Carbon, 2), new MaterialStack(Hydrogen, 6), new MaterialStack(Oxygen, 1), new MaterialStack(Silicon, 1)).addElectrolyzerRecipe().constructMaterial(); - public static Materials Silicone = new Materials( 471, TextureSet.SET_DULL , 3.0F, 128, 1, 1|2 |64|128 , 220, 220, 220, 0, "Silicone" , "Silicone Rubber" , 0, 0, 900, 0, false, false, 1, 1, 1, Dyes.dyeWhite , 0, Arrays.asList(new MaterialStack(Carbon, 2), new MaterialStack(Hydrogen, 6), new MaterialStack(Oxygen, 1), new MaterialStack(Silicon, 1)), Collections.singletonList(new TC_AspectStack(TC_Aspects.MOTUS, 2))); - public static Materials Polycaprolactam = new Materials( 472, TextureSet.SET_DULL , 3.0F, 32, 1, 1|2 |64|128 , 50, 50, 50, 0, "Polycaprolactam" , "Polycaprolactam" , 0, 0, 500, 0, false, false, 1, 1, 1, Dyes.dyeWhite , 0, Arrays.asList(new MaterialStack(Carbon, 6), new MaterialStack(Hydrogen, 11), new MaterialStack(Nitrogen, 1), new MaterialStack(Oxygen, 1)), Collections.singletonList(new TC_AspectStack(TC_Aspects.MOTUS, 2))); - public static Materials Polytetrafluoroethylene = new Materials( 473, TextureSet.SET_DULL , 3.0F, 32, 1, 1|2 |64|128 , 100, 100, 100, 0, "Polytetrafluoroethylene" , "Polytetrafluoroethylene" , 0, 0, 1400, 0, false, false, 1, 1, 1, Dyes.dyeWhite , 0, Arrays.asList(new MaterialStack(Carbon, 2), new MaterialStack(Fluorine, 4)), Collections.singletonList(new TC_AspectStack(TC_Aspects.MOTUS, 2))); - public static Materials Powellite = new Materials( 883, TextureSet.SET_DULL , 1.0F, 0, 2, 1 |8 , 255, 255, 0, 0, "Powellite" , "Powellite" , 0, 0, -1, 0, false, false, 1, 1, 1, Dyes.dyeYellow , 2, Arrays.asList(new MaterialStack(Calcium, 1), new MaterialStack(Molybdenum, 1), new MaterialStack(Oxygen, 4))); - public static Materials Pumice = new Materials( 926, TextureSet.SET_DULL , 1.0F, 0, 2, 1 |8 , 230, 185, 185, 0, "Pumice" , "Pumice" , 0, 0, -1, 0, false, false, 1, 1, 1, Dyes.dyeGray , 2, Collections.singletonList(new MaterialStack(Stone, 1))); - public static Materials Pyrite = new Materials( 834, TextureSet.SET_ROUGH , 1.0F, 0, 1, 1 |8 , 150, 120, 40, 0, "Pyrite" , "Pyrite" , 0, 0, -1, 0, false, false, 2, 1, 1, Dyes.dyeOrange , 1, Arrays.asList(new MaterialStack(Iron, 1), new MaterialStack(Sulfur, 2))); - public static Materials Pyrolusite = new Materials( 943, TextureSet.SET_DULL , 1.0F, 0, 2, 1 |8 , 150, 150, 170, 0, "Pyrolusite" , "Pyrolusite" , 0, 0, -1, 0, false, false, 1, 1, 1, Dyes.dyeLightGray , 1, Arrays.asList(new MaterialStack(Manganese, 1), new MaterialStack(Oxygen, 2))); - public static Materials Pyrope = new Materials( 835, TextureSet.SET_METALLIC , 1.0F, 0, 2, 1 |8 , 120, 50, 100, 0, "Pyrope" , "Pyrope" , 0, 0, -1, 0, false, false, 3, 1, 1, Dyes.dyePurple , 1, Arrays.asList(new MaterialStack(Aluminium, 2), new MaterialStack(Magnesium, 3), new MaterialStack(Silicon, 3), new MaterialStack(Oxygen, 12))); - public static Materials RockSalt = new Materials( 944, TextureSet.SET_FINE , 1.0F, 0, 1, 1 |8 , 240, 200, 200, 0, "RockSalt" , "Rock Salt" , 0, 0, -1, 0, false, false, 2, 1, 1, Dyes.dyeWhite , 1, Arrays.asList(new MaterialStack(Potassium, 1), new MaterialStack(Chlorine, 1))); - public static Materials Rubber = new Materials( 880, TextureSet.SET_SHINY , 1.5F, 32, 0, 1|2 |64|128 , 0, 0, 0, 0, "Rubber" , "Rubber" , 0, 0, 400, 0, false, false, 1, 1, 1, Dyes.dyeBlack , 0, Arrays.asList(new MaterialStack(Carbon, 5), new MaterialStack(Hydrogen, 8)), Collections.singletonList(new TC_AspectStack(TC_Aspects.MOTUS, 2))); - public static Materials RawRubber = new Materials( 896, TextureSet.SET_DULL , 1.0F, 0, 0, 1 , 204, 199, 137, 0, "RawRubber" , "Raw Rubber" , 0, 0, 400, 0, false, false, 1, 1, 1, Dyes.dyeWhite , 0, Arrays.asList(new MaterialStack(Carbon, 5), new MaterialStack(Hydrogen, 8)), Collections.singletonList(new TC_AspectStack(TC_Aspects.MOTUS, 2))); - public static Materials Ruby = new Materials( 502, TextureSet.SET_RUBY , 7.0F, 256, 2, 1 |4|8 |64 , 255, 100, 100, 127, "Ruby" , "Ruby" , 0, 0, -1, 0, false, true, 5, 1, 1, Dyes.dyeRed , 1, Arrays.asList(new MaterialStack(Chrome, 1), new MaterialStack(Aluminium, 2), new MaterialStack(Oxygen, 3)), Arrays.asList(new TC_AspectStack(TC_Aspects.LUCRUM, 6), new TC_AspectStack(TC_Aspects.VITREUS, 4))).disableAutoGeneratedBlastFurnaceRecipes(); - public static Materials Salt = new Materials( 817, TextureSet.SET_FINE , 1.0F, 0, 1, 1 |8 , 250, 250, 250, 0, "Salt" , "Salt" , 0, 0, -1, 0, false, false, 2, 1, 1, Dyes.dyeWhite , 0, Arrays.asList(new MaterialStack(Sodium, 1), new MaterialStack(Chlorine, 1))); - public static Materials Saltpeter = new Materials( 836, TextureSet.SET_FINE , 1.0F, 0, 1, 1 |8 , 230, 230, 230, 0, "Saltpeter" , "Saltpeter" , 0, 0, -1, 0, false, false, 3, 1, 1, Dyes.dyeWhite , 1, Arrays.asList(new MaterialStack(Potassium, 1), new MaterialStack(Nitrogen, 1), new MaterialStack(Oxygen, 3))); - public static Materials Sapphire = new MaterialBuilder(503, TextureSet.SET_GEM_VERTICAL, "Sapphire").setToolSpeed(7.0F).setDurability(256).setToolQuality(2).addDustItems().addGemItems().setTransparent(true).addOreItems().addToolHeadItems().setRGBA(100, 100, 200, 127).setColor(Dyes.dyeBlue).setOreValue(5).setExtraData(0).setMaterialList(new MaterialStack(Aluminium, 2), new MaterialStack(Oxygen, 3)).setAspects(Arrays.asList(new TC_AspectStack(TC_Aspects.LUCRUM, 5), new TC_AspectStack(TC_Aspects.VITREUS, 3))).constructMaterial().disableAutoGeneratedBlastFurnaceRecipes(); - //public static Materials Sapphire = new Materials( 503, TextureSet.SET_GEM_VERTICAL , 7.0F, 256, 2, 1 |4|8 |64 , 100, 100, 200, 127, "Sapphire" , "Sapphire" , 0, 0, -1, 0, false, true, 5, 1, 1, Dyes.dyeBlue , 1, Arrays.asList(new MaterialStack(Aluminium, 2), new MaterialStack(Oxygen, 3)), Arrays.asList(new TC_AspectStack(TC_Aspects.LUCRUM, 5), new TC_AspectStack(TC_Aspects.VITREUS, 3))); - public static Materials Scheelite = new Materials( 910, TextureSet.SET_DULL , 1.0F, 0, 3, 1 |8 , 200, 140, 20, 0, "Scheelite" , "Scheelite" , 0, 0, 2500, 2500, false, false, 4, 1, 1, Dyes.dyeBlack , 0, Arrays.asList(new MaterialStack(Tungsten, 1), new MaterialStack(Calcium, 1), new MaterialStack(Oxygen, 4))); - public static Materials Snow = new Materials( 728, TextureSet.SET_FINE , 1.0F, 0, 0, 1| 16 , 250, 250, 250, 0, "Snow" , "Snow" , 0, 0, -1, 0, false, false, 1, 1, 1, Dyes.dyeWhite , 0, Arrays.asList(new MaterialStack(Hydrogen, 2), new MaterialStack(Oxygen, 1)), Collections.singletonList(new TC_AspectStack(TC_Aspects.GELUM, 1))); - public static Materials Sodalite = new Materials( 525, TextureSet.SET_LAPIS , 1.0F, 0, 1, 1 |4|8 , 20, 20, 255, 0, "Sodalite" , "Sodalite" , 0, 0, -1, 0, false, false, 3, 1, 1, Dyes.dyeBlue , 1, Arrays.asList(new MaterialStack(Aluminium, 3), new MaterialStack(Silicon, 3), new MaterialStack(Sodium, 4), new MaterialStack(Chlorine, 1))); - public static Materials SodiumPersulfate = new Materials( 718, TextureSet.SET_FLUID , 1.0F, 0, 2, 16 , 255, 255, 255, 0, "SodiumPersulfate" , "Sodium Persulfate" , 0, 0, -1, 0, false, false, 1, 1, 1, Dyes.dyeOrange , 1, Arrays.asList(new MaterialStack(Sodium, 2), new MaterialStack(Sulfur, 2), new MaterialStack(Oxygen, 8))); - public static Materials SodiumSulfide = new Materials( 719, TextureSet.SET_FLUID , 1.0F, 0, 2, 1 , 255, 230, 128, 0, "SodiumSulfide" , "Sodium Sulfide" , 0, 0, -1, 0, false, false, 1, 1, 1, Dyes.dyeOrange , 1, Arrays.asList(new MaterialStack(Sodium, 2), new MaterialStack(Sulfur, 1))); - public static Materials HydricSulfide = new Materials( 460, TextureSet.SET_FLUID , 1.0F, 0, 2, 16 , 255, 255, 255, 0, "HydricSulfide" , "Hydrogen Sulfide" , 0, 0, -1, 0, false, false, 1, 1, 1, Dyes.dyeOrange , 1, Arrays.asList(new MaterialStack(Hydrogen, 2), new MaterialStack(Sulfur, 1))); - - public static Materials OilHeavy = new Materials( 730, TextureSet.SET_FLUID , 1.0F, 0, 0, 16 , 10, 10, 10, 0, "OilHeavy" , "Heavy Oil" , 3, 40, -1, 0, false, false, 1, 1, 1, Dyes.dyeBlack ); - public static Materials OilMedium = new Materials( 731, TextureSet.SET_FLUID , 1.0F, 0, 0, 16 , 10, 10, 10, 0, "OilMedium" , "Raw Oil" , 3, 30, -1, 0, false, false, 1, 1, 1, Dyes.dyeBlack ); - public static Materials OilLight = new Materials( 732, TextureSet.SET_FLUID , 1.0F, 0, 0, 16 , 10, 10, 10, 0, "OilLight" , "Light Oil" , 3, 20, -1, 0, false, false, 1, 1, 1, Dyes.dyeBlack ); - - public static Materials NatruralGas = new Materials( 733, TextureSet.SET_FLUID , 1.0F, 0, 1, 16 , 255, 255, 255, 0, "NatruralGas" , "Natural Gas" , 1, 20, -1, 0, false, false, 3, 1, 1, Dyes.dyeWhite ); - public static Materials SulfuricGas = new Materials( 734, TextureSet.SET_FLUID , 1.0F, 0, 1, 16 , 255, 255, 255, 0, "SulfuricGas" , "Sulfuric Gas" , 1, 25, -1, 0, false, false, 3, 1, 1, Dyes.dyeWhite ); - public static Materials Gas = new Materials( 735, TextureSet.SET_FLUID , 1.0F, 0, 1, 16 , 255, 255, 255, 0, "Gas" , "Refinery Gas" , 1, 160, -1, 0, false, false, 3, 1, 1, Dyes.dyeWhite).setCanBeCracked(true); - public static Materials SulfuricNaphtha = new Materials( 736, TextureSet.SET_FLUID , 1.0F, 0, 0, 16 , 255, 255, 0, 0, "SulfuricNaphtha" , "Sulfuric Naphtha" , 1, 40, -1, 0, false, false, 1, 1, 1, Dyes.dyeYellow ); - public static Materials SulfuricLightFuel = new Materials( 737, TextureSet.SET_FLUID , 1.0F, 0, 0, 16 , 255, 255, 0, 0, "SulfuricLightFuel" , "Sulfuric Light Fuel" , 0, 40, -1, 0, false, false, 1, 1, 1, Dyes.dyeYellow ); - public static Materials SulfuricHeavyFuel = new Materials( 738, TextureSet.SET_FLUID , 1.0F, 0, 0, 16 , 255, 255, 0, 0, "SulfuricHeavyFuel" , "Sulfuric Heavy Fuel" , 3, 40, -1, 0, false, false, 1, 1, 1, Dyes.dyeBlack ); - public static Materials Naphtha = new Materials( 739, TextureSet.SET_FLUID , 1.0F, 0, 0, 16 , 255, 255, 0, 0, "Naphtha" , "Naphtha" , 1, 320, -1, 0, false, false, 1, 1, 1, Dyes.dyeYellow).setCanBeCracked(true); - public static Materials LightFuel = new Materials( 740, TextureSet.SET_FLUID , 1.0F, 0, 0, 16 , 255, 255, 0, 0, "LightFuel" , "Light Fuel" , 0, 305, -1, 0, false, false, 1, 1, 1, Dyes.dyeYellow).setCanBeCracked(true); - public static Materials HeavyFuel = new Materials( 741, TextureSet.SET_FLUID , 1.0F, 0, 0, 16 , 255, 255, 0, 0, "HeavyFuel" , "Heavy Fuel" , 3, 240, -1, 0, false, false, 1, 1, 1, Dyes.dyeBlack).setCanBeCracked(true); - public static Materials LPG = new Materials( 742, TextureSet.SET_FLUID , 1.0F, 0, 0, 16 , 255, 255, 0, 0, "LPG" , "LPG" , 1, 320, -1, 0, false, false, 1, 1, 1, Dyes.dyeYellow ); - - public static Materials FluidNaquadahFuel = new MaterialBuilder(600, TextureSet.SET_FLUID , "Naquadah Fuel").setName("FluidNaqudahFuel").addCell().addFluid().setRGB(62, 62, 62).setColor(Dyes.dyeBlack).constructMaterial(); - public static Materials EnrichedNaquadria = new MaterialBuilder(601, TextureSet.SET_FLUID , "Enriched Naquadria").setName("EnrichedNaquadria").addCell().addFluid().setRGB(52, 52, 52).setColor(Dyes.dyeBlack).constructMaterial(); - - public static Materials ReinforceGlass = new MaterialBuilder(602, TextureSet.SET_FLUID , "Molten Reinforced Glass").setName("ReinforcedGlass").addCell().addFluid().setRGB(192, 245, 254).setColor(Dyes.dyeWhite).setLiquidTemperature(2000).constructMaterial(); - public static Materials BioMediumRaw = new MaterialBuilder(603, TextureSet.SET_FLUID , "Raw Bio Catalyst Medium").setName("BioMediumRaw").addCell().addFluid().setRGB(97, 147, 46).setColor(Dyes.dyeLime).constructMaterial(); - public static Materials BioMediumSterilized = new MaterialBuilder(604, TextureSet.SET_FLUID , "Sterilized Bio Catalyst Medium").setName("BiohMediumSterilized").addCell().addFluid().setRGB(162, 253, 53).setColor(Dyes.dyeLime).constructMaterial(); - - public static Materials Chlorobenzene = new MaterialBuilder(605, TextureSet.SET_FLUID , "Chlorobenzene").addCell().addFluid().setRGB(0, 50, 65).setColor(Dyes.dyeGray).setMaterialList(new MaterialStack(Carbon, 6), new MaterialStack(Hydrogen, 5), new MaterialStack(Chlorine, 1)).addElectrolyzerRecipe().constructMaterial(); - public static Materials DilutedHydrochloricAcid = new MaterialBuilder(606, TextureSet.SET_FLUID , "Diluted Hydrochloric Acid").setName("DilutedHydrochloricAcid_GT5U").addCell().addFluid().setRGB(153, 167, 163).setColor(Dyes.dyeLightGray).setMaterialList(new MaterialStack(Hydrogen, 1), new MaterialStack(Chlorine, 1)).constructMaterial(); - public static Materials Pyrochlore = new MaterialBuilder(607, TextureSet.SET_METALLIC , "Pyrochlore").addDustItems().addOreItems().setRGB(43, 17, 0).setColor(Dyes.dyeBlack).setMaterialList(new MaterialStack(Calcium, 2), new MaterialStack(Niobium, 2), new MaterialStack(Oxygen, 7)).addElectrolyzerRecipe().constructMaterial(); - - public static Materials GrowthMediumRaw = new MaterialBuilder(608, TextureSet.SET_FLUID , "Raw Growth Catalyst Medium").setName("GrowthMediumRaw").addCell().addFluid().setRGB(211, 141, 95).setColor(Dyes.dyeOrange).constructMaterial(); - public static Materials GrowthMediumSterilized = new MaterialBuilder(609, TextureSet.SET_FLUID , "Growth Catalyst Medium").setName("GrowthMediumSterilized").addCell().addFluid().setRGB(222, 170, 135).setColor(Dyes.dyeOrange).constructMaterial(); - - public static Materials FerriteMixture = new MaterialBuilder(612, TextureSet.SET_METALLIC , "Ferrite Mixture").addDustItems().setRGB(180, 180, 180).setColor(Dyes.dyeGray).setMaterialList(new MaterialStack(Nickel, 1), new MaterialStack(Zinc, 1), new MaterialStack(Iron, 4)).constructMaterial(); - public static Materials NickelZincFerrite = new MaterialBuilder(613, TextureSet.SET_ROUGH , "Nickel-Zinc Ferrite").addDustItems().addMetalItems().addToolHeadItems().addGearItems().setToolSpeed(3.0f).setDurability(32).setRGB(60, 60, 60).setColor(Dyes.dyeBlack).setBlastFurnaceRequired(true).setBlastFurnaceTemp(1500).setMaterialList(new MaterialStack(Nickel, 1), new MaterialStack(Zinc, 1), new MaterialStack(Iron, 4), new MaterialStack(Oxygen, 8)).constructMaterial(); - - public static Materials Massicot = new MaterialBuilder(614, TextureSet.SET_DULL , "Massicot").addDustItems().setRGB(255, 221, 85).setColor(Dyes.dyeYellow).setMaterialList(new MaterialStack(Lead, 1), new MaterialStack(Oxygen, 1)).addElectrolyzerRecipe().constructMaterial(); - public static Materials ArsenicTrioxide = new MaterialBuilder(615, TextureSet.SET_SHINY , "Arsenic Trioxide").addDustItems().setRGB(255, 255, 255).setColor(Dyes.dyeGreen).setMaterialList(new MaterialStack(Arsenic, 2), new MaterialStack(Oxygen, 3)).addElectrolyzerRecipe().constructMaterial(); - public static Materials CobaltOxide = new MaterialBuilder(616, TextureSet.SET_DULL , "Cobalt Oxide").addDustItems().setRGB(102, 128, 0).setColor(Dyes.dyeGreen).setMaterialList(new MaterialStack(Cobalt, 1), new MaterialStack(Oxygen, 1)).addElectrolyzerRecipe().constructMaterial(); - public static Materials Zincite = new MaterialBuilder(617, TextureSet.SET_DULL , "Zincite").addDustItems().setRGB(255, 255, 245).setColor(Dyes.dyeWhite).setMaterialList(new MaterialStack(Zinc, 1), new MaterialStack(Oxygen, 1)).addElectrolyzerRecipe().constructMaterial(); - public static Materials AntimonyTrioxide = new MaterialBuilder(618, TextureSet.SET_DULL , "Antimony Trioxide").addDustItems().setRGB(230, 230, 240).setColor(Dyes.dyeWhite).setMaterialList(new MaterialStack(Antimony, 2), new MaterialStack(Oxygen, 3)).addElectrolyzerRecipe().constructMaterial(); - public static Materials CupricOxide = new MaterialBuilder(619, TextureSet.SET_DULL , "Cupric Oxide").addDustItems().setRGB(15, 15, 15).setColor(Dyes.dyeBlack).setMeltingPoint(1599).setMaterialList(new MaterialStack(Copper, 1), new MaterialStack(Oxygen, 1)).addElectrolyzerRecipe().constructMaterial(); - public static Materials Ferrosilite = new MaterialBuilder(620, TextureSet.SET_DULL , "Ferrosilite").addDustItems().setRGB(151, 99, 42).setColor(Dyes.dyeBrown).setMaterialList(new MaterialStack(Iron, 1), new MaterialStack(Silicon, 1), new MaterialStack(Oxygen, 3)).addElectrolyzerRecipe().constructMaterial(); - - public static Materials Magnesia = new MaterialBuilder(621, TextureSet.SET_DULL , "Magnesia").addDustItems().setRGB(255, 225, 225).setColor(Dyes.dyeWhite).setMaterialList(new MaterialStack(Magnesium, 1), new MaterialStack(Oxygen, 1)).addElectrolyzerRecipe().constructMaterial(); - public static Materials Quicklime = new MaterialBuilder(622, TextureSet.SET_DULL , "Quicklime").addDustItems().setRGB(240, 240, 240).setColor(Dyes.dyeWhite).setMaterialList(new MaterialStack(Calcium, 1), new MaterialStack(Oxygen, 1)).addElectrolyzerRecipe().constructMaterial(); - public static Materials Potash = new MaterialBuilder(623, TextureSet.SET_DULL , "Potash").addDustItems().setRGB(120, 66, 55).setColor(Dyes.dyeBrown).setMaterialList(new MaterialStack(Potassium, 2), new MaterialStack(Oxygen, 1)).addElectrolyzerRecipe().constructMaterial(); - public static Materials SodaAsh = new MaterialBuilder(624, TextureSet.SET_DULL , "Soda Ash").addDustItems().setRGB(220, 220, 255).setColor(Dyes.dyeWhite).setMaterialList(new MaterialStack(Sodium, 2), new MaterialStack(Carbon, 1), new MaterialStack(Oxygen, 3)).addElectrolyzerRecipe().constructMaterial(); - - public static Materials BioDiesel = new MaterialBuilder(627, TextureSet.SET_FLUID , "Bio Diesel").addCell().addFluid().setRGB(255, 128, 0).setColor(Dyes.dyeOrange).setFuelType(MaterialBuilder.DIESEL).setFuelPower(320).constructMaterial(); - public static Materials NitrationMixture = new MaterialBuilder(628, TextureSet.SET_FLUID , "Nitration Mixture").addCell().setRGB(230, 226, 171).setColor(Dyes.dyeBrown).constructMaterial(); - public static Materials Glycerol = new MaterialBuilder(629, TextureSet.SET_FLUID , "Glycerol").addCell().addFluid().setRGB(135, 222, 135).setColor(Dyes.dyeLime).setFuelType(MaterialBuilder.SEMIFLUID).setFuelType(164).setMaterialList(new MaterialStack(Carbon, 3), new MaterialStack(Hydrogen, 8), new MaterialStack(Oxygen, 3)).addElectrolyzerRecipe().constructMaterial(); - public static Materials SodiumBisulfate = new MaterialBuilder(630, TextureSet.SET_FLUID , "Sodium Bisulfate").addDustItems().setRGB(0, 68, 85).setColor(Dyes.dyeBlue).setMaterialList(new MaterialStack(Sodium, 1), new MaterialStack(Hydrogen, 1), new MaterialStack(Sulfur, 1), new MaterialStack(Oxygen, 4)).constructMaterial(); - public static Materials PolyphenyleneSulfide = new MaterialBuilder(631, TextureSet.SET_DULL , "Polyphenylene Sulfide").addDustItems().addMetalItems().addToolHeadItems().addGearItems().setToolSpeed(3.0f).setDurability(32).setToolQuality(1).setRGB(170, 136, 0).setColor(Dyes.dyeBrown).setMaterialList(new MaterialStack(Carbon, 6), new MaterialStack(Hydrogen, 4), new MaterialStack(Sulfur, 1)).constructMaterial(); - public static Materials Dichlorobenzene = new MaterialBuilder(632, TextureSet.SET_FLUID , "Dichlorobenzene").addCell().addFluid().setRGB(0, 68, 85).setColor(Dyes.dyeBlue).setMaterialList(new MaterialStack(Carbon, 6), new MaterialStack(Hydrogen, 4), new MaterialStack(Chlorine, 2)).addElectrolyzerRecipe().constructMaterial(); - public static Materials Polystyrene = new MaterialBuilder(636, TextureSet.SET_DULL , "Polystyrene").addDustItems().addMetalItems().addToolHeadItems().addGearItems().setToolSpeed(3.0f).setDurability(32).setToolQuality(1).setRGB(190, 180, 170).setColor(Dyes.dyeLightGray).setMaterialList(new MaterialStack(Carbon, 8), new MaterialStack(Hydrogen, 8)).constructMaterial(); - public static Materials Styrene = new MaterialBuilder(637, TextureSet.SET_FLUID , "Styrene").addCell().addFluid().setRGB(210, 200, 190).setColor(Dyes.dyeBlack).setMaterialList(new MaterialStack(Carbon, 8), new MaterialStack(Hydrogen, 8)).addElectrolyzerRecipe().constructMaterial(); - public static Materials Isoprene = new MaterialBuilder(638, TextureSet.SET_FLUID , "Isoprene").addCell().addFluid().setRGB(20, 20, 20).setColor(Dyes.dyeBlack).setMaterialList(new MaterialStack(Carbon, 5), new MaterialStack(Hydrogen, 8)).addElectrolyzerRecipe().constructMaterial(); - public static Materials Tetranitromethane = new MaterialBuilder(639, TextureSet.SET_FLUID , "Tetranitromethane").addCell().addFluid().setRGB(15, 40, 40).setColor(Dyes.dyeBlack).setMaterialList(new MaterialStack(Carbon, 1), new MaterialStack(Nitrogen, 4), new MaterialStack(Oxygen, 8)).addElectrolyzerRecipe().constructMaterial(); - public static Materials Ethenone = new MaterialBuilder(641, TextureSet.SET_FLUID , "Ethenone").addCell().addGas().setRGB(20, 20, 70).setColor(Dyes.dyeBlack).setMaterialList(new MaterialStack(Carbon, 2), new MaterialStack(Hydrogen, 2), new MaterialStack(Oxygen, 1)).addElectrolyzerRecipe().constructMaterial(); - public static Materials Ethane = new MaterialBuilder(642, TextureSet.SET_FLUID , "Ethane").addCell().addGas().setRGB(200, 200, 255).setColor(Dyes.dyeLightBlue).setFuelType(MaterialBuilder.GAS).setFuelPower(168).setMaterialList(new MaterialStack(Carbon, 2), new MaterialStack(Hydrogen, 6)).addElectrolyzerRecipe().setCanBeCracked(true).constructMaterial(); - public static Materials Propane = new MaterialBuilder(643, TextureSet.SET_FLUID , "Propane").addCell().addGas().setRGB(250, 226, 80).setColor(Dyes.dyeYellow).setFuelType(MaterialBuilder.GAS).setFuelPower(232).setMaterialList(new MaterialStack(Carbon, 3), new MaterialStack(Hydrogen, 8)).addElectrolyzerRecipe().setCanBeCracked(true).constructMaterial(); - public static Materials Butane = new MaterialBuilder(644, TextureSet.SET_FLUID , "Butane").addCell().addGas().setRGB(182, 55, 30).setColor(Dyes.dyeOrange).setFuelType(MaterialBuilder.GAS).setFuelPower(296).setMaterialList(new MaterialStack(Carbon, 4), new MaterialStack(Hydrogen, 10)).addElectrolyzerRecipe().setCanBeCracked(true).constructMaterial(); - public static Materials Butene = new MaterialBuilder(645, TextureSet.SET_FLUID , "Butene").addCell().addGas().setRGB(207, 80, 5).setColor(Dyes.dyeOrange).setFuelType(MaterialBuilder.GAS).setFuelPower(256).setMaterialList(new MaterialStack(Carbon, 4), new MaterialStack(Hydrogen, 8)).addElectrolyzerRecipe().setCanBeCracked(true).constructMaterial(); - public static Materials Butadiene = new MaterialBuilder(646, TextureSet.SET_FLUID , "Butadiene").addCell().addGas().setRGB(232, 105, 0).setColor(Dyes.dyeOrange).setFuelType(MaterialBuilder.GAS).setFuelPower(206).setMaterialList(new MaterialStack(Carbon, 4), new MaterialStack(Hydrogen, 6)).addElectrolyzerRecipe().setCanBeCracked(true).constructMaterial(); - public static Materials RawStyreneButadieneRubber = new MaterialBuilder(634, TextureSet.SET_SHINY , "Raw Styrene-Butadiene Rubber").addDustItems().setRGB(84, 64, 61).setColor(Dyes.dyeGray).setMaterialList(new MaterialStack(Styrene, 1), new MaterialStack(Butadiene, 3)).constructMaterial(); - public static Materials StyreneButadieneRubber = new MaterialBuilder(635, TextureSet.SET_SHINY , "Styrene-Butadiene Rubber").addDustItems().addMetalItems().addToolHeadItems().addGearItems().setToolSpeed(3.0f).setDurability(128).setToolQuality(1).setRGB(33, 26, 24).setColor(Dyes.dyeBlack).setMaterialList(new MaterialStack(Styrene, 1), new MaterialStack(Butadiene, 3)).constructMaterial(); - public static Materials Toluene = new MaterialBuilder(647, TextureSet.SET_FLUID , "Toluene").addCell().setRGB(80, 29, 5).setColor(Dyes.dyeBrown).setFuelType(MaterialBuilder.GAS).setFuelPower(328).setMaterialList(new MaterialStack(Carbon, 7), new MaterialStack(Hydrogen, 8)).addElectrolyzerRecipe().constructMaterial(); - public static Materials Epichlorohydrin = new MaterialBuilder(648, TextureSet.SET_FLUID , "Epichlorohydrin").addCell().setRGB(80, 29, 5).setColor(Dyes.dyeBrown).setMaterialList(new MaterialStack(Carbon, 3), new MaterialStack(Hydrogen, 5), new MaterialStack(Chlorine, 1), new MaterialStack(Oxygen, 1)).addElectrolyzerRecipe().constructMaterial(); - public static Materials PolyvinylChloride = new MaterialBuilder(649, TextureSet.SET_DULL , "Polyvinyl Chloride").addDustItems().addMetalItems().addToolHeadItems().addGearItems().setToolSpeed(3.0f).setDurability(32).setToolQuality(1).setRGB(215, 230, 230).setColor(Dyes.dyeLightGray).setMaterialList(new MaterialStack(Carbon, 2), new MaterialStack(Hydrogen, 3), new MaterialStack(Chlorine, 1)).constructMaterial(); - public static Materials VinylChloride = new MaterialBuilder(650, TextureSet.SET_FLUID , "Vinyl Chloride").addCell().addGas().setRGB(225, 240, 240).setColor(Dyes.dyeLightGray).setMaterialList(new MaterialStack(Carbon, 2), new MaterialStack(Hydrogen, 3), new MaterialStack(Chlorine, 1)).addElectrolyzerRecipe().constructMaterial(); - public static Materials SulfurDioxide = new MaterialBuilder(651, TextureSet.SET_FLUID , "Sulfur Dioxide").addCell().addGas().setRGB(200, 200, 25).setColor(Dyes.dyeYellow).setMaterialList(new MaterialStack(Sulfur, 1), new MaterialStack(Oxygen, 2)).constructMaterial(); - public static Materials SulfurTrioxide = new MaterialBuilder(652, TextureSet.SET_FLUID , "Sulfur Trioxide").addCell().addGas().setGasTemperature(344).setRGB(160, 160, 20).setColor(Dyes.dyeYellow).setMaterialList(new MaterialStack(Sulfur, 1), new MaterialStack(Oxygen, 3)).addElectrolyzerRecipe().constructMaterial(); - public static Materials NitricAcid = new MaterialBuilder(653, TextureSet.SET_FLUID , "Nitric Acid").addCell().addFluid().setRGB(230, 226, 171).setMaterialList(new MaterialStack(Hydrogen, 1), new MaterialStack(Nitrogen, 1), new MaterialStack(Oxygen, 3)).addElectrolyzerRecipe().constructMaterial(); - public static Materials Dimethylhydrazine = new MaterialBuilder(654, TextureSet.SET_FLUID , "1,1-Dimethylhydrazine").addCell().addFluid().setRGB(0, 0, 85).setColor(Dyes.dyeBlue).setMaterialList(new MaterialStack(Carbon, 2), new MaterialStack(Hydrogen, 8), new MaterialStack(Nitrogen, 2)).addElectrolyzerRecipe().constructMaterial(); - public static Materials Chloramine = new MaterialBuilder(655, TextureSet.SET_FLUID , "Chloramine").addCell().addFluid().setRGB(63, 159, 128).setColor(Dyes.dyeCyan).setMaterialList(new MaterialStack(Nitrogen, 1), new MaterialStack(Hydrogen, 2), new MaterialStack(Chlorine, 1)).addElectrolyzerRecipe().constructMaterial(); - public static Materials Dimethylamine = new MaterialBuilder(656, TextureSet.SET_FLUID , "Dimethylamine").addCell().addGas().setRGB(85, 68, 105).setColor(Dyes.dyeGray).setMaterialList(new MaterialStack(Carbon, 2), new MaterialStack(Hydrogen, 7), new MaterialStack(Nitrogen, 1)).addElectrolyzerRecipe().constructMaterial(); - public static Materials DinitrogenTetroxide = new MaterialBuilder(657, TextureSet.SET_FLUID , "Dinitrogen Tetroxide").addCell().addGas().setRGB(0, 65, 132).setColor(Dyes.dyeBlue).setMaterialList(new MaterialStack(Nitrogen, 2), new MaterialStack(Oxygen, 4)).addElectrolyzerRecipe().constructMaterial(); - public static Materials NitricOxide = new MaterialBuilder(658, TextureSet.SET_FLUID , "Nitric Oxide").addCell().addGas().setRGB(125, 200, 240).setColor(Dyes.dyeCyan).setMaterialList(new MaterialStack(Nitrogen, 1), new MaterialStack(Oxygen, 1)).addElectrolyzerRecipe().constructMaterial(); - public static Materials Ammonia = new MaterialBuilder(659, TextureSet.SET_FLUID , "Ammonia").addCell().addGas().setRGB(63, 52, 128).setColor(Dyes.dyeBlue).setMaterialList(new MaterialStack(Nitrogen, 1), new MaterialStack(Hydrogen, 3)).addElectrolyzerRecipe().constructMaterial(); - public static Materials Dimethyldichlorosilane = new MaterialBuilder(663, TextureSet.SET_FLUID , "Dimethyldichlorosilane").addCell().addFluid().setRGB(68, 22, 80).setColor(Dyes.dyePurple).setMaterialList(new MaterialStack(Carbon, 2), new MaterialStack(Hydrogen, 6), new MaterialStack(Chlorine, 2), new MaterialStack(Silicon, 1)).addElectrolyzerRecipe().constructMaterial(); - public static Materials Chloromethane = new MaterialBuilder(664, TextureSet.SET_FLUID , "Chloromethane").addCell().addGas().setRGB(200, 44, 160).setColor(Dyes.dyeMagenta).setMaterialList(new MaterialStack(Carbon, 1), new MaterialStack(Hydrogen, 3), new MaterialStack(Chlorine, 1)).addElectrolyzerRecipe().constructMaterial(); - public static Materials PhosphorousPentoxide = new MaterialBuilder(665, TextureSet.SET_FLUID , "Phosphorous Pentoxide").addCell().addDustItems().setRGB(220, 220, 0).setColor(Dyes.dyeYellow).setMaterialList(new MaterialStack(Phosphorus, 4), new MaterialStack(Oxygen, 10)).addElectrolyzerRecipe().constructMaterial(); - public static Materials Tetrafluoroethylene = new MaterialBuilder(666, TextureSet.SET_FLUID , "Tetrafluoroethylene").addCell().addGas().setRGB(125, 125, 125).setColor(Dyes.dyeGray).setMaterialList(new MaterialStack(Carbon, 2), new MaterialStack(Fluorine, 4)).addElectrolyzerRecipe().constructMaterial(); - public static Materials HydrofluoricAcid = new MaterialBuilder(667, TextureSet.SET_FLUID , "Hydrofluoric Acid").setName("HydrofluoricAcid_GT5U").addCell().addFluid().setRGB(0, 136, 170).setColor(Dyes.dyeLightBlue).setMaterialList(new MaterialStack(Hydrogen, 1), new MaterialStack(Fluorine, 1)).addElectrolyzerRecipe().constructMaterial(); - public static Materials Chloroform = new MaterialBuilder(668, TextureSet.SET_FLUID , "Chloroform").addCell().addFluid().setRGB(137, 44, 160).setColor(Dyes.dyePurple).setMaterialList(new MaterialStack(Carbon, 1), new MaterialStack(Hydrogen, 1), new MaterialStack(Chlorine, 3)).addElectrolyzerRecipe().constructMaterial(); - public static Materials BisphenolA = new MaterialBuilder(669, TextureSet.SET_FLUID , "Bisphenol A").addCell().setRGB(212, 170, 0).setColor(Dyes.dyeBrown).setMaterialList(new MaterialStack(Carbon, 15), new MaterialStack(Hydrogen, 16), new MaterialStack(Oxygen, 2)).addElectrolyzerRecipe().constructMaterial(); - public static Materials AceticAcid = new MaterialBuilder(670, TextureSet.SET_FLUID , "Acetic Acid").addCell().addFluid().setRGB(200, 180, 160).setColor(Dyes.dyeWhite).setMaterialList(new MaterialStack(Carbon, 2), new MaterialStack(Hydrogen, 4), new MaterialStack(Oxygen, 2)).addElectrolyzerRecipe().constructMaterial(); - public static Materials CalciumAcetateSolution = new MaterialBuilder(671, TextureSet.SET_RUBY , "Calcium Acetate Solution").addCell().addFluid().setRGB(220, 200, 180).setColor(Dyes.dyeCyan).setMaterialList(new MaterialStack(Calcium, 1), new MaterialStack(Carbon, 4), new MaterialStack(Oxygen, 4), new MaterialStack(Hydrogen, 6)).addElectrolyzerRecipe().constructMaterial(); - public static Materials Acetone = new MaterialBuilder(672, TextureSet.SET_FLUID , "Acetone").addCell().addFluid().setRGB(175, 175, 175).setColor(Dyes.dyeWhite).setMaterialList(new MaterialStack(Carbon, 3), new MaterialStack(Hydrogen, 6), new MaterialStack(Oxygen, 1)).addElectrolyzerRecipe().constructMaterial(); - public static Materials Methanol = new MaterialBuilder(673, TextureSet.SET_FLUID , "Methanol").addCell().addFluid().setRGB(170, 136, 0).setColor(Dyes.dyeBrown).setFuelPower(84).setMaterialList(new MaterialStack(Carbon, 1), new MaterialStack(Hydrogen, 4), new MaterialStack(Oxygen, 1)).addElectrolyzerRecipe().constructMaterial(); - public static Materials CarbonMonoxide = new MaterialBuilder(674, TextureSet.SET_FLUID , "Carbon Monoxide").addCell().addGas().setRGB(14, 72, 128).setColor(Dyes.dyeBrown).setFuelType(MaterialBuilder.GAS).setFuelPower(24).setMaterialList(new MaterialStack(Carbon, 1), new MaterialStack(Oxygen, 1)).addElectrolyzerRecipe().constructMaterial(); - public static Materials MetalMixture = new MaterialBuilder(676, TextureSet.SET_METALLIC , "Metal Mixture").addDustItems().setRGB(80, 45, 22).setColor(Dyes.dyeBrown).constructMaterial(); - public static Materials Ethylene = new MaterialBuilder(677, TextureSet.SET_FLUID , "Ethylene").addCell().addGas().setRGB(225, 225, 225).setColor(Dyes.dyeWhite).setFuelType(MaterialBuilder.GAS).setFuelPower(128).setMaterialList(new MaterialStack(Carbon, 2), new MaterialStack(Hydrogen, 4)).addElectrolyzerRecipe().setCanBeCracked(true).constructMaterial(); - public static Materials Propene = new MaterialBuilder(678, TextureSet.SET_FLUID , "Propene").addCell().addGas().setRGB(255, 221, 85).setColor(Dyes.dyeYellow).setFuelType(MaterialBuilder.GAS).setFuelPower(192).setMaterialList(new MaterialStack(Carbon, 3), new MaterialStack(Hydrogen, 6)).addElectrolyzerRecipe().setCanBeCracked(true).constructMaterial(); - public static Materials VinylAcetate = new MaterialBuilder(679, TextureSet.SET_FLUID , "Vinyl Acetate").addCell().addFluid().setRGB(255, 179, 128).setColor(Dyes.dyeOrange).setMaterialList(new MaterialStack(Carbon, 4), new MaterialStack(Hydrogen, 6), new MaterialStack(Oxygen, 2)).addElectrolyzerRecipe().constructMaterial(); - public static Materials PolyvinylAcetate = new MaterialBuilder(680, TextureSet.SET_FLUID , "Polyvinyl Acetate").addCell().addFluid().setRGB(255, 153, 85).setColor(Dyes.dyeOrange).setMaterialList(new MaterialStack(Carbon, 4), new MaterialStack(Hydrogen, 6), new MaterialStack(Oxygen, 2)).constructMaterial(); - public static Materials MethylAcetate = new MaterialBuilder(681, TextureSet.SET_FLUID , "Methyl Acetate").addCell().addFluid().setRGB(238, 198, 175).setColor(Dyes.dyeOrange).setMaterialList(new MaterialStack(Carbon, 3), new MaterialStack(Hydrogen, 6), new MaterialStack(Oxygen, 2)).addElectrolyzerRecipe().constructMaterial(); - public static Materials AllylChloride = new MaterialBuilder(682, TextureSet.SET_FLUID , "Allyl Chloride").addCell().addFluid().setRGB(135, 222, 170).setColor(Dyes.dyeCyan).setMaterialList(new MaterialStack(Carbon, 3), new MaterialStack(Hydrogen, 5), new MaterialStack(Chlorine, 1)).addElectrolyzerRecipe().constructMaterial(); - public static Materials HydrochloricAcid = new MaterialBuilder(683, TextureSet.SET_FLUID , "Hydrochloric Acid").setName("HydrochloricAcid_GT5U").addCell().addFluid().setRGB(183, 200, 196).setColor(Dyes.dyeLightGray).setMaterialList(new MaterialStack(Hydrogen, 1), new MaterialStack(Chlorine, 1)).constructMaterial(); - public static Materials HypochlorousAcid = new MaterialBuilder(684, TextureSet.SET_FLUID , "Hypochlorous Acid").addCell().addFluid().setRGB(111, 138, 145).setColor(Dyes.dyeGray).setMaterialList(new MaterialStack(Hydrogen, 1), new MaterialStack(Chlorine, 1), new MaterialStack(Oxygen, 1)).addElectrolyzerRecipe().constructMaterial(); - public static Materials SodiumOxide = new MaterialBuilder(744, TextureSet.SET_DULL , "Sodium Oxide").setName("SodiumOxide").addDustItems().setRGB(255, 255, 235).setColor(Dyes.dyeWhite).setMaterialList(new MaterialStack(Sodium, 2), new MaterialStack(Oxygen, 1)).addElectrolyzerRecipe().constructMaterial(); - public static Materials SodiumHydroxide = new MaterialBuilder(685, TextureSet.SET_DULL , "Sodium Hydroxide").setName("SodiumHydroxide_GT5U").addDustItems().setRGB(0, 51, 128).setColor(Dyes.dyeBlue).setMaterialList(new MaterialStack(Sodium, 1), new MaterialStack(Oxygen, 1), new MaterialStack(Hydrogen, 1)).constructMaterial(); - public static Materials Benzene = new MaterialBuilder(686, TextureSet.SET_FLUID , "Benzene").addCell().addFluid().setRGB(26, 26, 26).setColor(Dyes.dyeGray).setFuelType(MaterialBuilder.GAS).setFuelPower(360).setMaterialList(new MaterialStack(Carbon, 6), new MaterialStack(Hydrogen, 6)).addElectrolyzerRecipe().constructMaterial(); - public static Materials Phenol = new MaterialBuilder(687, TextureSet.SET_FLUID , "Phenol").addCell().addFluid().setRGB(120, 68, 33).setColor(Dyes.dyeBrown).setFuelType(MaterialBuilder.GAS).setFuelPower(288).setMaterialList(new MaterialStack(Carbon, 6), new MaterialStack(Hydrogen, 6), new MaterialStack(Oxygen, 1)).addElectrolyzerRecipe().constructMaterial(); - public static Materials Cumene = new MaterialBuilder(688, TextureSet.SET_FLUID , "Isopropylbenzene").addCell().addFluid().setRGB(85, 34, 0).setColor(Dyes.dyeBrown).setMaterialList(new MaterialStack(Carbon, 9), new MaterialStack(Hydrogen, 12)).addElectrolyzerRecipe().constructMaterial(); - public static Materials PhosphoricAcid = new MaterialBuilder(689, TextureSet.SET_FLUID , "Phosphoric Acid").setName("PhosphoricAcid_GT5U").addCell().addFluid().setRGB(220, 220, 0).setColor(Dyes.dyeYellow).setMaterialList(new MaterialStack(Hydrogen, 3), new MaterialStack(Phosphorus, 1), new MaterialStack(Oxygen, 4)).addElectrolyzerRecipe().constructMaterial(); - public static Materials SaltWater = new MaterialBuilder(692, TextureSet.SET_FLUID , "Salt Water").addCell().addFluid().setRGB(0, 0, 200).setColor(Dyes.dyeBlue).constructMaterial(); - public static Materials IronIIIChloride = new MaterialBuilder(693, TextureSet.SET_FLUID , "Iron III Chloride").setName("IronIIIChloride").addCell().addFluid().setRGB(22, 21, 14).setColor(Dyes.dyeBlack).setMaterialList(new MaterialStack(Chlorine, 3), new MaterialStack(Iron, 1)).addElectrolyzerRecipe().constructMaterial(); - public static Materials LifeEssence = new MaterialBuilder(694, TextureSet.SET_FLUID , "Life").setName("lifeessence").addCell().addFluid().setFuelPower(100).setFuelType(5).setRGB(110, 3, 3).setColor(Dyes.dyeRed).setMaterialList().constructMaterial(); - - //Roasted Ore Dust - public static Materials RoastedCopper = new MaterialBuilder(546, TextureSet.SET_DULL , "Roasted Copper").setName("RoastedCopper").addDustItems().setRGB(77, 18, 18).constructMaterial(); - public static Materials RoastedAntimony = new MaterialBuilder(547, TextureSet.SET_DULL , "Roasted Antimony").setName("RoastedAntimony").addDustItems().setRGB(196, 178, 194).constructMaterial(); - public static Materials RoastedIron = new MaterialBuilder(548, TextureSet.SET_DULL , "Roasted Iron").setName("RoastedIron").addDustItems().setRGB(148, 98, 98).addOreItems().constructMaterial(); - public static Materials RoastedNickel = new MaterialBuilder(549, TextureSet.SET_METALLIC, "Roasted Nickel").setName("RoastedNickel").addDustItems().setRGB(70, 140, 45).addOreItems().constructMaterial(); - public static Materials RoastedZinc = new MaterialBuilder(550, TextureSet.SET_DULL , "Roasted Zinc").setName("RoastedZinc").addDustItems().setRGB(209, 209, 209).constructMaterial(); - public static Materials RoastedCobalt = new MaterialBuilder(551, TextureSet.SET_METALLIC, "Roasted Cobalt").setName("RoastedCobalt").addDustItems().setRGB(8, 64, 9).constructMaterial(); - public static Materials RoastedArsenic = new MaterialBuilder(552, TextureSet.SET_SHINY , "Roasted Arsenic").setName("RoastedArsenic").addDustItems().setRGB(240, 240, 240).constructMaterial(); - public static Materials RoastedLead = new MaterialBuilder(553, TextureSet.SET_SHINY , "Roasted Lead").setName("RoastedLead").addDustItems().setRGB(168, 149, 43).constructMaterial(); - - //Silicon Line - public static Materials SiliconSG = new Materials( 856, TextureSet.SET_METALLIC , 1.0F, 0, 2, 1|2 |8 |32 , 80, 80, 100, 0, "SiliconSolarGrade" , "Silicon Solar Grade (Poly SI)" , 0, 0, 2273, 2273, true, false, 1, 1, 1, Dyes.dyeBlack , Arrays.asList(new TC_AspectStack(TC_Aspects.METALLUM, 4), new TC_AspectStack(TC_Aspects.TENEBRAE, 2))); - public static Materials CalciumDisilicide = new Materials( 971, TextureSet.SET_METALLIC , 1.0F, 0, 2, 1 |8 , 180, 180, 180, 0, "CalciumDisilicide" , "Calcium Disilicide" , 0, 0, 1313, -1, false, false, 1, 1, 1, Dyes.dyeGray ,1 , Arrays.asList(new MaterialStack(Calcium, 1), new MaterialStack(Silicon, 2)), Arrays.asList(new TC_AspectStack(TC_Aspects.TERRA, 1), new TC_AspectStack(TC_Aspects.ORDO, 1)));//CaSi2 - public static Materials SiliconTetrafluoride = new MaterialBuilder( 967, TextureSet.SET_FLUID , "Silicon Tetrafluoride" ).setName("SiliconTetrafluoride").addCell().addGas().setTransparent(true).setRGB(200, 200, 200).setColor(Dyes.dyeWhite).setMeltingPoint(178).setMaterialList(new MaterialStack(Silicon, 1), new MaterialStack(Fluorine, 4)).setAspects(Arrays.asList(new TC_AspectStack(TC_Aspects.AQUA, 1), new TC_AspectStack(TC_Aspects.VENENUM, 1))).constructMaterial();//SIF4 - public static Materials SiliconTetrachloride = new MaterialBuilder( 968, TextureSet.SET_FLUID , "Silicon Tetrachloride").setName("SiliconTetrachloride").addCell().addFluid().setRGB(220, 220, 220).setColor(Dyes.dyeWhite).setMeltingPoint(204).setMaterialList(new MaterialStack(Silicon, 1), new MaterialStack(Chlorine, 4)).setAspects(Arrays.asList(new TC_AspectStack(TC_Aspects.AQUA, 1), new TC_AspectStack(TC_Aspects.VENENUM, 1))).constructMaterial();//SICL4 - public static Materials Trichlorosilane = new MaterialBuilder( 972, TextureSet.SET_FLUID , "Trichlorosilane" ).setName("Trichlorosilane" ).addCell().addFluid().setRGB( 255, 255, 255).setColor(Dyes.dyeWhite).setMeltingPoint(139).setMaterialList(new MaterialStack(Hydrogen, 1), new MaterialStack(Silicon, 1), new MaterialStack(Chlorine, 3)).setAspects(Arrays.asList(new TC_AspectStack(TC_Aspects.AQUA, 1), new TC_AspectStack(TC_Aspects.VENENUM, 1))).constructMaterial();//HSICL3 - public static Materials Hexachlorodisilane = new MaterialBuilder( 973, TextureSet.SET_FLUID , "Hexachlorodisilane").setName("Hexachlorodisilane" ).addCell().addFluid().setRGB( 255, 255, 255).setColor(Dyes.dyeWhite).setMeltingPoint(272).setExtraData(1).setMaterialList(new MaterialStack(Silicon, 2), new MaterialStack(Chlorine, 6)).setAspects(Collections.singletonList(new TC_AspectStack(TC_Aspects.AQUA, 1))).constructMaterial();//SI2CL6 - public static Materials Dichlorosilane = new MaterialBuilder( 799, TextureSet.SET_FLUID , "Dichlorosilane").setName("Dichlorosilane").addCell().addGas().setTransparent(true).setRGB( 255, 255, 255).setColor(Dyes.dyeWhite).setMeltingPoint(151).setExtraData(1).setMaterialList(new MaterialStack(Silicon, 1), new MaterialStack(Hydrogen, 2), new MaterialStack(Chlorine, 2)).setAspects(Arrays.asList(new TC_AspectStack(TC_Aspects.AQUA, 1), new TC_AspectStack(TC_Aspects.VENENUM, 1))).constructMaterial();//SIH2CL2 - public static Materials Silane = new MaterialBuilder( 798, TextureSet.SET_FLUID , "Silane").setName( "Silane").addCell().addGas().setRGB( 255, 255, 255).setColor(Dyes.dyeWhite).setMeltingPoint(88).setMaterialList(new MaterialStack(Silicon, 1), new MaterialStack(Hydrogen, 4)).setAspects(Collections.singletonList(new TC_AspectStack(TC_Aspects.AQUA, 1))).constructMaterial();//SIH4 - public static Materials Calciumhydride = new Materials( 797, TextureSet.SET_METALLIC , 1.0F, 0, 2, 1 |8 , 220, 220, 220, 0, "CalciumHydride" , "Calcium Hydride" , 0, 0, 1089, -1, false, false, 1, 1, 1, Dyes.dyeGray ,1 , Arrays.asList(new MaterialStack(Calcium, 1), new MaterialStack(Hydrogen, 2)), Arrays.asList(new TC_AspectStack(TC_Aspects.TERRA, 1), new TC_AspectStack(TC_Aspects.ORDO, 1)));//CaH2 - public static Materials AluminiumFluoride = new Materials( 969, TextureSet.SET_METALLIC , 1.0F, 0, 2, 1 |8 , 255, 255, 255, 0, "Aluminiumfluoride" , "Aluminium Fluoride" , 0, 0, 1533, -1, false, false, 1, 1, 1, Dyes.dyeWhite ,1 , Arrays.asList(new MaterialStack(Aluminium, 1), new MaterialStack(Fluorine, 3)), Arrays.asList(new TC_AspectStack(TC_Aspects.TERRA, 1), new TC_AspectStack(TC_Aspects.ORDO, 1)));//ALF3 - - public static Materials SolderingAlloy = new Materials( 314, TextureSet.SET_DULL , 1.0F, 0, 1, 1|2 , 220, 220, 230, 0, "SolderingAlloy" , "Soldering Alloy" , 0, 0, 400, 400, false, false, 1, 1, 1, Dyes.dyeWhite , 2, Arrays.asList(new MaterialStack(Tin, 9), new MaterialStack(Antimony, 1))); - public static Materials GalliumArsenide = new Materials( 980, TextureSet.SET_DULL , 1.0F, 0, 1, 1|2 , 160, 160, 160, 0, "GalliumArsenide" , "Gallium Arsenide" , 0, 0, -1, 1200, true, false, 1, 1, 1, Dyes.dyeGray , 2, Arrays.asList(new MaterialStack(Arsenic, 1), new MaterialStack(Gallium, 1))); - public static Materials IndiumGalliumPhosphide = new Materials( 981, TextureSet.SET_DULL , 1.0F, 0, 1, 1|2 , 160, 140, 190, 0, "IndiumGalliumPhosphide" , "Indium Gallium Phosphide" , 0, 0, -1, 0, false, false, 1, 1, 1, Dyes.dyeLightGray , 2, Arrays.asList(new MaterialStack(Indium, 1), new MaterialStack(Gallium, 1), new MaterialStack(Phosphorus, 1))); - public static Materials Spessartine = new Materials( 838, TextureSet.SET_DULL , 1.0F, 0, 2, 1 |8 , 255, 100, 100, 0, "Spessartine" , "Spessartine" , 0, 0, -1, 0, false, false, 3, 1, 1, Dyes.dyeRed , 1, Arrays.asList(new MaterialStack(Aluminium, 2), new MaterialStack(Manganese, 3), new MaterialStack(Silicon, 3), new MaterialStack(Oxygen, 12))); - public static Materials Sphalerite = new Materials( 839, TextureSet.SET_DULL , 1.0F, 0, 1, 1 |8 , 255, 255, 255, 0, "Sphalerite" , "Sphalerite" , 0, 0, -1, 0, false, false, 2, 1, 1, Dyes.dyeYellow , 1, Arrays.asList(new MaterialStack(Zinc, 1), new MaterialStack(Sulfur, 1))); - public static Materials StainlessSteel = new Materials( 306, TextureSet.SET_SHINY , 7.0F, 480, 4, 1|2 |64|128 , 200, 200, 220, 0, "StainlessSteel" , "Stainless Steel" , 0, 0, -1, 1700, true, false, 1, 1, 1, Dyes.dyeWhite , 1, Arrays.asList(new MaterialStack(Iron, 6), new MaterialStack(Chrome, 1), new MaterialStack(Manganese, 1), new MaterialStack(Nickel, 1))); - public static Materials Steel = new Materials( 305, TextureSet.SET_METALLIC , 6.0F, 512, 3, 1|2 |64|128 , 128, 128, 128, 0, "Steel" , "Steel" , 0, 0, 1811, 1000, true, false, 4, 51, 50, Dyes.dyeGray , 1, Arrays.asList(new MaterialStack(Iron, 50), new MaterialStack(Carbon, 1)), Arrays.asList(new TC_AspectStack(TC_Aspects.METALLUM, 2), new TC_AspectStack(TC_Aspects.ORDO, 1))); - public static Materials Stibnite = new Materials( 945, TextureSet.SET_METALLIC , 1.0F, 0, 2, 1 |8 , 70, 70, 70, 0, "Stibnite" , "Stibnite" , 0, 0, -1, 0, false, false, 1, 1, 1, Dyes.dyeWhite , 2, Arrays.asList(new MaterialStack(Antimony, 2), new MaterialStack(Sulfur, 3))); - public static Materials SulfuricAcid = new Materials( 720, TextureSet.SET_FLUID , 1.0F, 0, 2, 16 , 255, 128, 0, 0, "SulfuricAcid" , "Sulfuric Acid" , 0, 0, -1, 0, false, false, 1, 1, 1, Dyes.dyeOrange , 1, Arrays.asList(new MaterialStack(Hydrogen, 2), new MaterialStack(Sulfur, 1), new MaterialStack(Oxygen, 4))); - public static Materials Tanzanite = new Materials( 508, TextureSet.SET_GEM_VERTICAL , 7.0F, 256, 2, 1 |4|8 |64 , 64, 0, 200, 127, "Tanzanite" , "Tanzanite" , 0, 0, -1, 0, false, true, 5, 1, 1, Dyes.dyePurple , 1, Arrays.asList(new MaterialStack(Calcium, 2), new MaterialStack(Aluminium, 3), new MaterialStack(Silicon, 3), new MaterialStack(Hydrogen, 1), new MaterialStack(Oxygen, 13)), Arrays.asList(new TC_AspectStack(TC_Aspects.LUCRUM, 5), new TC_AspectStack(TC_Aspects.VITREUS, 3))); - public static Materials Tetrahedrite = new Materials( 840, TextureSet.SET_DULL , 1.0F, 0, 2, 1 |8 , 200, 32, 0, 0, "Tetrahedrite" , "Tetrahedrite" , 0, 0, -1, 0, false, false, 3, 1, 1, Dyes.dyeRed , 2, Arrays.asList(new MaterialStack(Copper, 3), new MaterialStack(Antimony, 1), new MaterialStack(Sulfur, 3), new MaterialStack(Iron, 1))); //Cu3SbS3 + x(Fe,Zn)6Sb2S9 - public static Materials TinAlloy = new Materials( 363, TextureSet.SET_METALLIC , 6.5F, 96, 2, 1|2 |64|128 , 200, 200, 200, 0, "TinAlloy" , "Tin Alloy" , 0, 0, -1, 0, false, false, 1, 1, 1, Dyes.dyeWhite , 2, Arrays.asList(new MaterialStack(Tin, 1), new MaterialStack(Iron, 1)), Arrays.asList(new TC_AspectStack(TC_Aspects.METALLUM, 2), new TC_AspectStack(TC_Aspects.INSTRUMENTUM, 1))); - public static Materials Topaz = new Materials( 507, TextureSet.SET_GEM_HORIZONTAL , 7.0F, 256, 3, 1 |4|8 |64 , 255, 128, 0, 127, "Topaz" , "Topaz" , 0, 0, -1, 0, false, true, 5, 1, 1, Dyes.dyeOrange , 1, Arrays.asList(new MaterialStack(Aluminium, 2), new MaterialStack(Silicon, 1), new MaterialStack(Fluorine, 2), new MaterialStack(Hydrogen, 2), new MaterialStack(Oxygen, 6)), Arrays.asList(new TC_AspectStack(TC_Aspects.LUCRUM, 6), new TC_AspectStack(TC_Aspects.VITREUS, 4))); - public static Materials Tungstate = new Materials( 841, TextureSet.SET_DULL , 1.0F, 0, 3, 1 |8 , 55, 50, 35, 0, "Tungstate" , "Tungstate" , 0, 0, 2500, 2500, true, false, 4, 1, 1, Dyes.dyeBlack , 0, Arrays.asList(new MaterialStack(Tungsten, 1), new MaterialStack(Lithium, 2), new MaterialStack(Oxygen, 4))); - public static Materials Ultimet = new Materials( 344, TextureSet.SET_SHINY , 9.0F, 2048, 4, 1|2 |64|128 , 180, 180, 230, 0, "Ultimet" , "Ultimet" , 0, 0, 2700, 2700, true, false, 1, 1, 1, Dyes.dyeLightBlue , 1, Arrays.asList(new MaterialStack(Cobalt, 5), new MaterialStack(Chrome, 2), new MaterialStack(Nickel, 1), new MaterialStack(Molybdenum, 1))); // 54% Cobalt, 26% Chromium, 9% Nickel, 5% Molybdenum, 3% Iron, 2% Tungsten, 0.8% Manganese, 0.3% Silicon, 0.08% Nitrogen and 0.06% Carbon - public static Materials Uraninite = new Materials( 922, TextureSet.SET_METALLIC , 1.0F, 0, 3, 1 |8 , 35, 35, 35, 0, "Uraninite" , "Uraninite" , 0, 0, -1, 0, false, false, 1, 1, 1, Dyes.dyeLime , 2, Arrays.asList(new MaterialStack(Uranium, 1), new MaterialStack(Oxygen, 2))); - public static Materials Uvarovite = new Materials( 842, TextureSet.SET_DIAMOND , 1.0F, 0, 2, 1 |8 , 180, 255, 180, 0, "Uvarovite" , "Uvarovite" , 0, 0, -1, 0, false, false, 3, 1, 1, Dyes.dyeGreen , 1, Arrays.asList(new MaterialStack(Calcium, 3), new MaterialStack(Chrome, 2), new MaterialStack(Silicon, 3), new MaterialStack(Oxygen, 12))); - public static Materials VanadiumGallium = new Materials( 357, TextureSet.SET_SHINY , 1.0F, 0, 2, 1|2 |128 , 128, 128, 140, 0, "VanadiumGallium" , "Vanadium-Gallium" , 0, 0, 4500, 4500, true, false, 1, 1, 1, Dyes.dyeGray , 2, Arrays.asList(new MaterialStack(Vanadium, 3), new MaterialStack(Gallium, 1))).disableAutoGeneratedBlastFurnaceRecipes(); - public static Materials Wood = new Materials( 809, TextureSet.SET_WOOD , 2.0F, 16, 0, 1|2 |64|128 , 100, 50, 0, 0, "Wood" , "Wood" , 0, 0, -1, 0, false, false, 1, 1, 1, Dyes.dyeBrown , 0, Arrays.asList(new MaterialStack(Carbon, 1), new MaterialStack(Oxygen, 1), new MaterialStack(Hydrogen, 1)), Collections.singletonList(new TC_AspectStack(TC_Aspects.ARBOR, 2))); - public static Materials WroughtIron = new Materials( 304, TextureSet.SET_METALLIC , 6.0F, 384, 2, 1|2 |64|128 , 200, 180, 180, 0, "WroughtIron" , "Wrought Iron" , 0, 0, 1811, 0, false, false, 3, 1, 1, Dyes.dyeLightGray , 2, Collections.singletonList(new MaterialStack(Iron, 1))); - public static Materials Wulfenite = new Materials( 882, TextureSet.SET_DULL , 1.0F, 0, 3, 1 |8 , 255, 128, 0, 0, "Wulfenite" , "Wulfenite" , 0, 0, -1, 0, false, false, 1, 1, 1, Dyes.dyeOrange , 2, Arrays.asList(new MaterialStack(Lead, 1), new MaterialStack(Molybdenum, 1), new MaterialStack(Oxygen, 4))); - public static Materials YellowLimonite = new Materials( 931, TextureSet.SET_METALLIC , 1.0F, 0, 2, 1 |8 , 200, 200, 0, 0, "YellowLimonite" , "Yellow Limonite" , 0, 0, -1, 0, false, false, 1, 1, 1, Dyes.dyeYellow , 2, Arrays.asList(new MaterialStack(Iron, 1), new MaterialStack(Hydrogen, 1), new MaterialStack(Oxygen, 2))); // FeO(OH) + a bit of Ni and Co - public static Materials YttriumBariumCuprate = new Materials( 358, TextureSet.SET_METALLIC , 1.0F, 0, 2, 1|2 , 80, 64, 70, 0, "YttriumBariumCuprate" , "Yttrium Barium Cuprate" , 0, 0, 4500, 4500, true, false, 1, 1, 1, Dyes.dyeGray , 0, Arrays.asList(new MaterialStack(Yttrium, 1), new MaterialStack(Barium, 2), new MaterialStack(Copper, 3), new MaterialStack(Oxygen, 7))); + public static Materials Methane = new Materials( + 715, + TextureSet.SET_FLUID, + 1.0F, + 0, + 1, + 16, + 255, + 255, + 255, + 0, + "Methane", + "Methane", + 1, + 104, + -1, + 0, + false, + false, + 3, + 1, + 1, + Dyes.dyeMagenta, + 1, + Arrays.asList(new MaterialStack(Carbon, 1), new MaterialStack(Hydrogen, 4))); + + public static Materials CarbonDioxide = new Materials( + 497, + TextureSet.SET_FLUID, + 1.0F, + 0, + 2, + 16 | 32, + 169, + 208, + 245, + 240, + "CarbonDioxide", + "Carbon Dioxide", + 0, + 0, + 25, + 1, + false, + true, + 1, + 1, + 1, + Dyes.dyeLightBlue, + 0, + Arrays.asList(new MaterialStack(Carbon, 1), new MaterialStack(Oxygen, 2))) + .setHasCorrespondingGas(true); + public static Materials NobleGases = new Materials( + 496, + TextureSet.SET_FLUID, + 1.0F, + 0, + 2, + 16 | 32, + 169, + 208, + 245, + 240, + "NobleGases", + "Noble Gases", + 0, + 0, + 4, + 0, + false, + true, + 1, + 1, + 1, + Dyes.dyeLightBlue, + 2, + Arrays.asList( + new MaterialStack(CarbonDioxide, 21), + new MaterialStack(Helium, 9), + new MaterialStack(Methane, 3), + new MaterialStack(Deuterium, 1))) + .setHasCorrespondingGas(true); + public static Materials Air = new Materials( + -1, + TextureSet.SET_FLUID, + 1.0F, + 0, + 2, + 16 | 32, + 169, + 208, + 245, + 240, + "Air", + "Air", + 0, + 0, + -1, + 0, + false, + true, + 1, + 1, + 1, + Dyes.dyeLightBlue, + 0, + Arrays.asList( + new MaterialStack(Nitrogen, 40), + new MaterialStack(Oxygen, 11), + new MaterialStack(Argon, 1), + new MaterialStack(NobleGases, 1))); + public static Materials LiquidAir = new Materials( + 495, + TextureSet.SET_FLUID, + 1.0F, + 0, + 2, + 16 | 32, + 169, + 208, + 245, + 240, + "LiquidAir", + "Liquid Air", + 0, + 0, + 4, + 0, + false, + true, + 1, + 1, + 1, + Dyes.dyeLightBlue, + 2, + Arrays.asList( + new MaterialStack(Nitrogen, 40), + new MaterialStack(Oxygen, 11), + new MaterialStack(Argon, 1), + new MaterialStack(NobleGases, 1))); + public static Materials LiquidNitrogen = new Materials( + 494, + TextureSet.SET_FLUID, + 1.0F, + 0, + 2, + 16 | 32, + 169, + 208, + 245, + 240, + "LiquidNitrogen", + "Liquid Nitrogen", + 0, + 0, + 4, + 0, + false, + true, + 1, + 1, + 1, + Dyes.dyeLightBlue, + 1, + Collections.singletonList(new MaterialStack(Nitrogen, 1))); + public static Materials LiquidOxygen = new Materials( + 493, + TextureSet.SET_FLUID, + 1.0F, + 0, + 2, + 16 | 32, + 169, + 208, + 245, + 240, + "LiquidOxygen", + "Liquid Oxygen", + 0, + 0, + 4, + 0, + false, + true, + 1, + 1, + 1, + Dyes.dyeLightBlue, + 1, + Collections.singletonList(new MaterialStack(Oxygen, 1))); + public static Materials SiliconDioxide = new MaterialBuilder(837, TextureSet.SET_QUARTZ, "Silicon Dioxide") + .setToolSpeed(1.0F) + .setDurability(0) + .setToolQuality(1) + .addDustItems() + .setRGB(255, 255, 255) + .setColor(Dyes.dyeLightGray) + .setOreValue(1) + .setExtraData(0) + .setMaterialList(new MaterialStack(Silicon, 1), new MaterialStack(Oxygen, 2)) + .constructMaterial(); + public static Materials Jasper = new Materials( + 511, + TextureSet.SET_EMERALD, + 1.0F, + 0, + 2, + 1 | 4 | 8 | 64, + 200, + 80, + 80, + 100, + "Jasper", + "Jasper", + 0, + 0, + -1, + 0, + false, + true, + 3, + 1, + 1, + Dyes.dyeRed, + 1, + Collections.singletonList(new MaterialStack(SiliconDioxide, 1)), + Arrays.asList(new TC_AspectStack(TC_Aspects.LUCRUM, 4), new TC_AspectStack(TC_Aspects.VITREUS, 2))); + public static Materials Almandine = new Materials( + 820, + TextureSet.SET_ROUGH, + 1.0F, + 0, + 1, + 1 | 8, + 255, + 0, + 0, + 0, + "Almandine", + "Almandine", + 0, + 0, + -1, + 0, + false, + false, + 3, + 1, + 1, + Dyes.dyeRed, + 1, + Arrays.asList( + new MaterialStack(Aluminium, 2), + new MaterialStack(Iron, 3), + new MaterialStack(Silicon, 3), + new MaterialStack(Oxygen, 12))); + public static Materials Andradite = new Materials( + 821, + TextureSet.SET_ROUGH, + 1.0F, + 0, + 1, + 1 | 8, + 150, + 120, + 0, + 0, + "Andradite", + "Andradite", + 0, + 0, + -1, + 0, + false, + false, + 3, + 1, + 1, + Dyes.dyeYellow, + 1, + Arrays.asList( + new MaterialStack(Calcium, 3), + new MaterialStack(Iron, 2), + new MaterialStack(Silicon, 3), + new MaterialStack(Oxygen, 12))); + public static Materials AnnealedCopper = new Materials( + 345, + TextureSet.SET_SHINY, + 1.0F, + 0, + 2, + 1 | 2 | 128, + 255, + 120, + 20, + 0, + "AnnealedCopper", + "Annealed Copper", + 0, + 0, + -1, + 0, + false, + false, + 3, + 1, + 1, + Dyes.dyeOrange, + 2, + Collections.singletonList(new MaterialStack(Copper, 1))); + public static Materials Asbestos = new Materials( + 946, + TextureSet.SET_DULL, + 1.0F, + 0, + 1, + 1 | 8, + 230, + 230, + 230, + 0, + "Asbestos", + "Asbestos", + 0, + 0, + -1, + 0, + false, + false, + 1, + 1, + 1, + Dyes.dyeWhite, + 1, + Arrays.asList( + new MaterialStack(Magnesium, 3), + new MaterialStack(Silicon, 2), + new MaterialStack(Hydrogen, 4), + new MaterialStack(Oxygen, 9))); // Mg3Si2O5(OH)4 + public static Materials Ash = new Materials( + 815, + TextureSet.SET_DULL, + 1.0F, + 0, + 1, + 1, + 150, + 150, + 150, + 0, + "Ash", + "Ashes", + 0, + 0, + -1, + 0, + false, + false, + 1, + 1, + 1, + Dyes.dyeLightGray, + 2, + Collections.singletonList(new MaterialStack(Carbon, 1)), + Collections.singletonList(new TC_AspectStack(TC_Aspects.PERDITIO, 1))); + public static Materials BandedIron = new Materials( + 917, + TextureSet.SET_DULL, + 1.0F, + 0, + 2, + 1 | 8, + 145, + 90, + 90, + 0, + "BandedIron", + "Banded Iron", + 0, + 0, + -1, + 0, + false, + false, + 1, + 1, + 1, + Dyes.dyeBrown, + 1, + Arrays.asList(new MaterialStack(Iron, 2), new MaterialStack(Oxygen, 3))); + public static Materials BatteryAlloy = new Materials( + 315, + TextureSet.SET_DULL, + 1.0F, + 0, + 1, + 1 | 2, + 156, + 124, + 160, + 0, + "BatteryAlloy", + "Battery Alloy", + 0, + 0, + -1, + 0, + false, + false, + 1, + 1, + 1, + Dyes.dyePurple, + 2, + Arrays.asList(new MaterialStack(Lead, 4), new MaterialStack(Antimony, 1))); + public static Materials BlueTopaz = new Materials( + 513, + TextureSet.SET_GEM_HORIZONTAL, + 7.0F, + 256, + 3, + 1 | 4 | 8 | 64, + 0, + 0, + 255, + 127, + "BlueTopaz", + "Blue Topaz", + 0, + 0, + -1, + 0, + false, + true, + 3, + 1, + 1, + Dyes.dyeBlue, + 1, + Arrays.asList( + new MaterialStack(Aluminium, 2), + new MaterialStack(Silicon, 1), + new MaterialStack(Fluorine, 2), + new MaterialStack(Hydrogen, 2), + new MaterialStack(Oxygen, 6)), + Arrays.asList(new TC_AspectStack(TC_Aspects.LUCRUM, 6), new TC_AspectStack(TC_Aspects.VITREUS, 4))); + public static Materials Bone = new Materials( + 806, + TextureSet.SET_DULL, + 1.0F, + 0, + 1, + 1, + 250, + 250, + 250, + 0, + "Bone", + "Bone", + 0, + 0, + -1, + 0, + false, + false, + 1, + 1, + 1, + Dyes.dyeWhite, + 0, + Collections.singletonList(new MaterialStack(Calcium, 1)), + Arrays.asList(new TC_AspectStack(TC_Aspects.MORTUUS, 2), new TC_AspectStack(TC_Aspects.CORPUS, 1))); + public static Materials Brass = new Materials( + 301, + TextureSet.SET_METALLIC, + 7.0F, + 96, + 1, + 1 | 2 | 64 | 128, + 255, + 180, + 0, + 0, + "Brass", + "Brass", + 0, + 0, + -1, + 0, + false, + false, + 1, + 1, + 1, + Dyes.dyeYellow, + 2, + Arrays.asList(new MaterialStack(Zinc, 1), new MaterialStack(Copper, 3)), + Arrays.asList(new TC_AspectStack(TC_Aspects.METALLUM, 2), new TC_AspectStack(TC_Aspects.INSTRUMENTUM, 1))); + public static Materials Bronze = new Materials( + 300, + TextureSet.SET_METALLIC, + 6.0F, + 192, + 2, + 1 | 2 | 64 | 128, + 255, + 128, + 0, + 0, + "Bronze", + "Bronze", + 0, + 0, + -1, + 0, + false, + false, + 1, + 1, + 1, + Dyes.dyeOrange, + 2, + Arrays.asList(new MaterialStack(Tin, 1), new MaterialStack(Copper, 3)), + Arrays.asList(new TC_AspectStack(TC_Aspects.METALLUM, 2), new TC_AspectStack(TC_Aspects.INSTRUMENTUM, 1))); + public static Materials BrownLimonite = new Materials( + 930, + TextureSet.SET_METALLIC, + 1.0F, + 0, + 1, + 1 | 8, + 200, + 100, + 0, + 0, + "BrownLimonite", + "Brown Limonite", + 0, + 0, + -1, + 0, + false, + false, + 1, + 1, + 1, + Dyes.dyeBrown, + 2, + Arrays.asList( + new MaterialStack(Iron, 1), + new MaterialStack(Hydrogen, 1), + new MaterialStack(Oxygen, 2))); // FeO(OH) + public static Materials Calcite = new Materials( + 823, + TextureSet.SET_DULL, + 1.0F, + 0, + 1, + 1 | 8, + 250, + 230, + 220, + 0, + "Calcite", + "Calcite", + 0, + 0, + -1, + 0, + false, + false, + 1, + 1, + 1, + Dyes.dyeOrange, + 1, + Arrays.asList(new MaterialStack(Calcium, 1), new MaterialStack(Carbon, 1), new MaterialStack(Oxygen, 3))); + public static Materials Cassiterite = new Materials( + 824, + TextureSet.SET_METALLIC, + 1.0F, + 0, + 3, + 1 | 8, + 220, + 220, + 220, + 0, + "Cassiterite", + "Cassiterite", + 0, + 0, + -1, + 0, + false, + false, + 1, + 1, + 1, + Dyes.dyeWhite, + 1, + Arrays.asList(new MaterialStack(Tin, 1), new MaterialStack(Oxygen, 2))); + public static Materials CassiteriteSand = new Materials( + 937, + TextureSet.SET_SAND, + 1.0F, + 0, + 1, + 1 | 8, + 220, + 220, + 220, + 0, + "CassiteriteSand", + "Cassiterite Sand", + 0, + 0, + -1, + 0, + false, + false, + 4, + 1, + 1, + Dyes.dyeWhite, + 1, + Arrays.asList(new MaterialStack(Tin, 1), new MaterialStack(Oxygen, 2))); + public static Materials Chalcopyrite = new Materials( + 855, + TextureSet.SET_DULL, + 1.0F, + 0, + 1, + 1 | 8, + 160, + 120, + 40, + 0, + "Chalcopyrite", + "Chalcopyrite", + 0, + 0, + -1, + 0, + false, + false, + 1, + 1, + 1, + Dyes.dyeYellow, + 1, + Arrays.asList(new MaterialStack(Copper, 1), new MaterialStack(Iron, 1), new MaterialStack(Sulfur, 2))); + public static Materials Charcoal = new Materials( + 536, + TextureSet.SET_FINE, + 1.0F, + 0, + 1, + 1 | 4, + 100, + 70, + 70, + 0, + "Charcoal", + "Charcoal", + 0, + 0, + -1, + 0, + false, + false, + 1, + 1, + 1, + Dyes.dyeBlack, + 1, + Collections.singletonList(new MaterialStack(Carbon, 1)), + Arrays.asList(new TC_AspectStack(TC_Aspects.POTENTIA, 2), new TC_AspectStack(TC_Aspects.IGNIS, 2))); + public static Materials Chromite = new Materials( + 825, + TextureSet.SET_METALLIC, + 1.0F, + 0, + 1, + 1 | 8, + 35, + 20, + 15, + 0, + "Chromite", + "Chromite", + 0, + 0, + 1700, + 1700, + true, + false, + 6, + 1, + 1, + Dyes.dyePink, + 1, + Arrays.asList(new MaterialStack(Iron, 1), new MaterialStack(Chrome, 2), new MaterialStack(Oxygen, 4))); + public static Materials ChromiumDioxide = new Materials( + 361, + TextureSet.SET_DULL, + 11.0F, + 256, + 3, + 1 | 2, + 230, + 200, + 200, + 0, + "ChromiumDioxide", + "Chromium Dioxide", + 0, + 0, + 650, + 650, + false, + false, + 5, + 3, + 1, + Dyes.dyePink, + 1, + Arrays.asList(new MaterialStack(Chrome, 1), new MaterialStack(Oxygen, 2)), + Arrays.asList(new TC_AspectStack(TC_Aspects.METALLUM, 2), new TC_AspectStack(TC_Aspects.MACHINA, 1))); + public static Materials Cinnabar = new Materials( + 826, + TextureSet.SET_ROUGH, + 1.0F, + 0, + 1, + 1 | 8, + 150, + 0, + 0, + 0, + "Cinnabar", + "Cinnabar", + 0, + 0, + -1, + 0, + false, + false, + 3, + 1, + 1, + Dyes.dyeBrown, + 2, + Arrays.asList(new MaterialStack(Mercury, 1), new MaterialStack(Sulfur, 1))); + public static Materials Water = new Materials( + 701, + TextureSet.SET_FLUID, + 1.0F, + 0, + 0, + 16, + 0, + 0, + 255, + 0, + "Water", + "Water", + 0, + 0, + -1, + 0, + false, + false, + 1, + 1, + 1, + Dyes.dyeBlue, + 0, + Arrays.asList(new MaterialStack(Hydrogen, 2), new MaterialStack(Oxygen, 1)), + Collections.singletonList(new TC_AspectStack(TC_Aspects.AQUA, 2))); + public static Materials Clay = new Materials( + 805, + TextureSet.SET_ROUGH, + 1.0F, + 0, + 1, + 1, + 200, + 200, + 220, + 0, + "Clay", + "Clay", + 0, + 0, + -1, + 0, + false, + false, + 5, + 1, + 1, + Dyes.dyeLightBlue, + 0, + Arrays.asList( + new MaterialStack(Sodium, 2), + new MaterialStack(Lithium, 1), + new MaterialStack(Aluminium, 2), + new MaterialStack(Silicon, 2), + new MaterialStack(Water, 6))); + public static Materials Coal = new Materials( + 535, + TextureSet.SET_ROUGH, + 1.0F, + 0, + 1, + 1 | 4 | 8, + 70, + 70, + 70, + 0, + "Coal", + "Coal", + 0, + 0, + -1, + 0, + false, + false, + 2, + 2, + 1, + Dyes.dyeBlack, + 1, + Collections.singletonList(new MaterialStack(Carbon, 1)), + Arrays.asList(new TC_AspectStack(TC_Aspects.POTENTIA, 2), new TC_AspectStack(TC_Aspects.IGNIS, 2))); + public static Materials Cobaltite = new Materials( + 827, + TextureSet.SET_METALLIC, + 1.0F, + 0, + 1, + 1 | 8, + 80, + 80, + 250, + 0, + "Cobaltite", + "Cobaltite", + 0, + 0, + -1, + 0, + false, + false, + 3, + 1, + 1, + Dyes.dyeBlue, + 1, + Arrays.asList(new MaterialStack(Cobalt, 1), new MaterialStack(Arsenic, 1), new MaterialStack(Sulfur, 1))); + public static Materials Cooperite = new Materials( + 828, + TextureSet.SET_METALLIC, + 1.0F, + 0, + 1, + 1 | 8, + 255, + 255, + 200, + 0, + "Cooperite", + "Sheldonite", + 0, + 0, + -1, + 0, + false, + false, + 5, + 1, + 1, + Dyes.dyeYellow, + 2, + Arrays.asList( + new MaterialStack(Platinum, 3), + new MaterialStack(Nickel, 1), + new MaterialStack(Sulfur, 1), + new MaterialStack(Palladium, 1))); + public static Materials Cupronickel = new Materials( + 310, + TextureSet.SET_METALLIC, + 6.0F, + 64, + 1, + 1 | 2 | 64, + 227, + 150, + 128, + 0, + "Cupronickel", + "Cupronickel", + 0, + 0, + -1, + 0, + false, + false, + 1, + 1, + 1, + Dyes.dyeOrange, + 2, + Arrays.asList(new MaterialStack(Copper, 1), new MaterialStack(Nickel, 1))); + public static Materials DarkAsh = new Materials( + 816, + TextureSet.SET_DULL, + 1.0F, + 0, + 1, + 1, + 50, + 50, + 50, + 0, + "DarkAsh", + "Dark Ashes", + 0, + 0, + -1, + 0, + false, + false, + 1, + 2, + 1, + Dyes.dyeGray, + 1, + Collections.singletonList(new MaterialStack(Carbon, 1)), + Arrays.asList(new TC_AspectStack(TC_Aspects.IGNIS, 1), new TC_AspectStack(TC_Aspects.PERDITIO, 1))); + public static Materials DeepIron = new Materials( + 829, + TextureSet.SET_METALLIC, + 6.0F, + 384, + 2, + 1 | 2 | 8 | 64, + 150, + 140, + 140, + 0, + "DeepIron", + "Deep Iron", + 0, + 0, + 7500, + 7500, + true, + false, + 3, + 1, + 1, + Dyes.dyePink, + 2, + Collections.singletonList(new MaterialStack(Iron, 1)), + Arrays.asList(new TC_AspectStack(TC_Aspects.METALLUM, 2), new TC_AspectStack(TC_Aspects.MAGNETO, 1))); + public static Materials Diamond = new Materials( + 500, + TextureSet.SET_DIAMOND, + 8.0F, + 1280, + 4, + 1 | 4 | 8 | 64 | 128, + 200, + 255, + 255, + 127, + "Diamond", + "Diamond", + 0, + 0, + -1, + 0, + false, + true, + 5, + 64, + 1, + Dyes.dyeWhite, + 1, + Collections.singletonList(new MaterialStack(Carbon, 1)), + Arrays.asList(new TC_AspectStack(TC_Aspects.VITREUS, 3), new TC_AspectStack(TC_Aspects.LUCRUM, 4))); + public static Materials Electrum = new Materials( + 303, + TextureSet.SET_SHINY, + 12.0F, + 64, + 2, + 1 | 2 | 8 | 64 | 128, + 255, + 255, + 100, + 0, + "Electrum", + "Electrum", + 0, + 0, + -1, + 0, + false, + false, + 4, + 1, + 1, + Dyes.dyeYellow, + 2, + Arrays.asList(new MaterialStack(Silver, 1), new MaterialStack(Gold, 1))); + public static Materials Emerald = new Materials( + 501, + TextureSet.SET_EMERALD, + 7.0F, + 256, + 4, + 1 | 4 | 8 | 64, + 80, + 255, + 80, + 127, + "Emerald", + "Emerald", + 0, + 0, + -1, + 0, + false, + true, + 5, + 1, + 1, + Dyes.dyeGreen, + 1, + Arrays.asList( + new MaterialStack(Beryllium, 3), + new MaterialStack(Aluminium, 2), + new MaterialStack(Silicon, 6), + new MaterialStack(Oxygen, 18)), + Arrays.asList(new TC_AspectStack(TC_Aspects.VITREUS, 3), new TC_AspectStack(TC_Aspects.LUCRUM, 5))); + public static Materials FreshWater = new Materials( + -1, + TextureSet.SET_FLUID, + 1.0F, + 0, + 0, + 16, + 0, + 0, + 255, + 0, + "FreshWater", + "Fresh Water", + 0, + 0, + -1, + 0, + false, + false, + 1, + 1, + 1, + Dyes.dyeBlue, + 0, + Arrays.asList(new MaterialStack(Hydrogen, 2), new MaterialStack(Oxygen, 1)), + Collections.singletonList(new TC_AspectStack(TC_Aspects.AQUA, 2))); + public static Materials Galena = new Materials( + 830, + TextureSet.SET_DULL, + 1.0F, + 0, + 3, + 1 | 8, + 100, + 60, + 100, + 0, + "Galena", + "Galena", + 0, + 0, + -1, + 0, + false, + false, + 4, + 1, + 1, + Dyes.dyePurple, + 1, + Arrays.asList(new MaterialStack(Lead, 1), new MaterialStack(Sulfur, 1))); + public static Materials Garnierite = new Materials( + 906, + TextureSet.SET_METALLIC, + 1.0F, + 0, + 3, + 1 | 8, + 50, + 200, + 70, + 0, + "Garnierite", + "Garnierite", + 0, + 0, + -1, + 0, + false, + false, + 1, + 1, + 1, + Dyes.dyeLightBlue, + 1, + Arrays.asList(new MaterialStack(Nickel, 1), new MaterialStack(Oxygen, 1))); + public static Materials Glyceryl = new Materials( + 714, + TextureSet.SET_FLUID, + 1.0F, + 0, + 1, + 16, + 0, + 150, + 150, + 0, + "Glyceryl", + "Glyceryl Trinitrate", + 0, + 0, + -1, + 0, + false, + false, + 1, + 1, + 1, + Dyes.dyeCyan, + 1, + Arrays.asList( + new MaterialStack(Carbon, 3), + new MaterialStack(Hydrogen, 5), + new MaterialStack(Nitrogen, 3), + new MaterialStack(Oxygen, 9))); + public static Materials GreenSapphire = new MaterialBuilder(504, TextureSet.SET_GEM_HORIZONTAL, "Green Sapphire") + .setToolSpeed(7.0F) + .setDurability(256) + .setToolQuality(2) + .addDustItems() + .addGemItems() + .setTransparent(true) + .addOreItems() + .addToolHeadItems() + .setRGBA(100, 200, 130, 127) + .setColor(Dyes.dyeCyan) + .setOreValue(5) + .setExtraData(0) + .setMaterialList(new MaterialStack(Aluminium, 2), new MaterialStack(Oxygen, 3)) + .setAspects( + Arrays.asList(new TC_AspectStack(TC_Aspects.LUCRUM, 5), new TC_AspectStack(TC_Aspects.VITREUS, 3))) + .constructMaterial() + .disableAutoGeneratedBlastFurnaceRecipes(); + public static Materials Grossular = new Materials( + 831, + TextureSet.SET_ROUGH, + 1.0F, + 0, + 1, + 1 | 8, + 200, + 100, + 0, + 0, + "Grossular", + "Grossular", + 0, + 0, + -1, + 0, + false, + false, + 3, + 1, + 1, + Dyes.dyeOrange, + 1, + Arrays.asList( + new MaterialStack(Calcium, 3), + new MaterialStack(Aluminium, 2), + new MaterialStack(Silicon, 3), + new MaterialStack(Oxygen, 12))); + public static Materials HolyWater = new Materials( + 729, + TextureSet.SET_FLUID, + 1.0F, + 0, + 0, + 16, + 0, + 0, + 255, + 0, + "HolyWater", + "Holy Water", + 0, + 0, + -1, + 0, + false, + false, + 1, + 1, + 1, + Dyes.dyeBlue, + 0, + Arrays.asList(new MaterialStack(Hydrogen, 2), new MaterialStack(Oxygen, 1)), + Arrays.asList(new TC_AspectStack(TC_Aspects.AQUA, 2), new TC_AspectStack(TC_Aspects.AURAM, 1))); + public static Materials Ice = new Materials( + 702, + TextureSet.SET_SHINY, + 1.0F, + 0, + 0, + 1 | 16, + 200, + 200, + 255, + 0, + "Ice", + "Ice", + 0, + 0, + -1, + 0, + false, + false, + 1, + 1, + 1, + Dyes.dyeBlue, + 0, + Arrays.asList(new MaterialStack(Hydrogen, 2), new MaterialStack(Oxygen, 1)), + Collections.singletonList(new TC_AspectStack(TC_Aspects.GELUM, 2))); + public static Materials Ilmenite = new Materials( + 918, + TextureSet.SET_METALLIC, + 1.0F, + 0, + 3, + 1 | 8, + 70, + 55, + 50, + 0, + "Ilmenite", + "Ilmenite", + 0, + 0, + -1, + 0, + false, + false, + 1, + 2, + 1, + Dyes.dyePurple, + 0, + Arrays.asList(new MaterialStack(Iron, 1), new MaterialStack(Titanium, 1), new MaterialStack(Oxygen, 3))); + public static Materials Rutile = new Materials( + 375, + TextureSet.SET_GEM_HORIZONTAL, + 1.0F, + 0, + 2, + 1 | 8, + 212, + 13, + 92, + 0, + "Rutile", + "Rutile", + 0, + 0, + -1, + 0, + false, + false, + 1, + 2, + 1, + Dyes.dyeRed, + 0, + Arrays.asList(new MaterialStack(Titanium, 1), new MaterialStack(Oxygen, 2))); + public static Materials Bauxite = new Materials( + 822, + TextureSet.SET_DULL, + 1.0F, + 0, + 1, + 1 | 8, + 200, + 100, + 0, + 0, + "Bauxite", + "Bauxite", + 0, + 0, + -1, + 0, + false, + false, + 3, + 1, + 1, + Dyes.dyeBrown, + 1, + Arrays.asList( + new MaterialStack(Rutile, 2), + new MaterialStack(Aluminium, 16), + new MaterialStack(Hydrogen, 10), + new MaterialStack(Oxygen, 11))); + public static Materials Titaniumtetrachloride = new Materials( + 376, + TextureSet.SET_FLUID, + 1.0F, + 0, + 2, + 16, + 212, + 13, + 92, + 0, + "Titaniumtetrachloride", + "Titaniumtetrachloride", + 0, + 0, + -1, + 0, + false, + false, + 1, + 1, + 1, + Dyes.dyeRed, + 0, + Arrays.asList(new MaterialStack(Titanium, 1), new MaterialStack(Chlorine, 4))); + public static Materials Magnesiumchloride = new Materials( + 377, + TextureSet.SET_DULL, + 1.0F, + 0, + 2, + 1 | 16, + 212, + 13, + 92, + 0, + "Magnesiumchloride", + "Magnesiumchloride", + 0, + 0, + -1, + 0, + false, + false, + 1, + 1, + 1, + Dyes.dyeRed, + 0, + Arrays.asList(new MaterialStack(Magnesium, 1), new MaterialStack(Chlorine, 2))); + public static Materials Invar = new Materials( + 302, + TextureSet.SET_METALLIC, + 6.0F, + 256, + 2, + 1 | 2 | 64 | 128, + 180, + 180, + 120, + 0, + "Invar", + "Invar", + 0, + 0, + -1, + 0, + false, + false, + 1, + 1, + 1, + Dyes.dyeBrown, + 2, + Arrays.asList(new MaterialStack(Iron, 2), new MaterialStack(Nickel, 1)), + Arrays.asList(new TC_AspectStack(TC_Aspects.METALLUM, 2), new TC_AspectStack(TC_Aspects.GELUM, 1))); + public static Materials Kanthal = new Materials( + 312, + TextureSet.SET_METALLIC, + 6.0F, + 64, + 2, + 1 | 2 | 64, + 194, + 210, + 223, + 0, + "Kanthal", + "Kanthal", + 0, + 0, + 1800, + 1800, + true, + false, + 1, + 1, + 1, + Dyes.dyeYellow, + 2, + Arrays.asList( + new MaterialStack(Iron, 1), new MaterialStack(Aluminium, 1), new MaterialStack(Chrome, 1))) + .disableAutoGeneratedBlastFurnaceRecipes(); + public static Materials Lazurite = new Materials( + 524, + TextureSet.SET_LAPIS, + 1.0F, + 0, + 1, + 1 | 4 | 8, + 100, + 120, + 255, + 0, + "Lazurite", + "Lazurite", + 0, + 0, + -1, + 0, + false, + false, + 3, + 1, + 1, + Dyes.dyeCyan, + 1, + Arrays.asList( + new MaterialStack(Aluminium, 6), + new MaterialStack(Silicon, 6), + new MaterialStack(Calcium, 8), + new MaterialStack(Sodium, 8))); + public static Materials Magnalium = new Materials( + 313, + TextureSet.SET_DULL, + 6.0F, + 256, + 2, + 1 | 2 | 64 | 128, + 200, + 190, + 255, + 0, + "Magnalium", + "Magnalium", + 0, + 0, + -1, + 0, + false, + false, + 1, + 1, + 1, + Dyes.dyeLightBlue, + 2, + Arrays.asList(new MaterialStack(Magnesium, 1), new MaterialStack(Aluminium, 2))); + public static Materials Magnesite = new Materials( + 908, + TextureSet.SET_METALLIC, + 1.0F, + 0, + 2, + 1 | 8, + 250, + 250, + 180, + 0, + "Magnesite", + "Magnesite", + 0, + 0, + -1, + 0, + false, + false, + 1, + 1, + 1, + Dyes.dyePink, + 1, + Arrays.asList(new MaterialStack(Magnesium, 1), new MaterialStack(Carbon, 1), new MaterialStack(Oxygen, 3))); + public static Materials Magnetite = new Materials( + 870, + TextureSet.SET_METALLIC, + 1.0F, + 0, + 2, + 1 | 8, + 30, + 30, + 30, + 0, + "Magnetite", + "Magnetite", + 0, + 0, + -1, + 0, + false, + false, + 1, + 1, + 1, + Dyes.dyeGray, + 1, + Arrays.asList(new MaterialStack(Iron, 3), new MaterialStack(Oxygen, 4)), + Arrays.asList(new TC_AspectStack(TC_Aspects.METALLUM, 2), new TC_AspectStack(TC_Aspects.MAGNETO, 1))); + public static Materials Molybdenite = new Materials( + 942, + TextureSet.SET_METALLIC, + 1.0F, + 0, + 2, + 1 | 8, + 25, + 25, + 25, + 0, + "Molybdenite", + "Molybdenite", + 0, + 0, + -1, + 0, + false, + false, + 1, + 1, + 1, + Dyes.dyeBlue, + 1, + Arrays.asList(new MaterialStack(Molybdenum, 1), new MaterialStack(Sulfur, 2))); // MoS2 (also source of Re) + public static Materials Nichrome = new Materials( + 311, + TextureSet.SET_METALLIC, + 6.0F, + 64, + 2, + 1 | 2 | 64, + 205, + 206, + 246, + 0, + "Nichrome", + "Nichrome", + 0, + 0, + 2700, + 2700, + true, + false, + 1, + 1, + 1, + Dyes.dyeRed, + 2, + Arrays.asList(new MaterialStack(Nickel, 4), new MaterialStack(Chrome, 1))) + .disableAutoGeneratedBlastFurnaceRecipes(); + public static Materials NiobiumNitride = new Materials( + 359, + TextureSet.SET_DULL, + 1.0F, + 0, + 2, + 1 | 2, + 29, + 41, + 29, + 0, + "NiobiumNitride", + "Niobium Nitride", + 0, + 0, + 2573, + 2573, + true, + false, + 1, + 1, + 1, + Dyes.dyeBlack, + 1, + Arrays.asList(new MaterialStack(Niobium, 1), new MaterialStack(Nitrogen, 1))); // Anti-Reflective Material + public static Materials NiobiumTitanium = new Materials( + 360, + TextureSet.SET_DULL, + 1.0F, + 0, + 2, + 1 | 2, + 29, + 29, + 41, + 0, + "NiobiumTitanium", + "Niobium-Titanium", + 0, + 0, + 4500, + 4500, + true, + false, + 1, + 1, + 1, + Dyes.dyeBlack, + 2, + Arrays.asList(new MaterialStack(Niobium, 1), new MaterialStack(Titanium, 1))) + .disableAutoGeneratedBlastFurnaceRecipes(); + public static Materials NitroCarbon = new Materials( + 716, + TextureSet.SET_FLUID, + 1.0F, + 0, + 1, + 16, + 0, + 75, + 100, + 0, + "NitroCarbon", + "Nitro-Carbon", + 0, + 0, + -1, + 0, + false, + false, + 1, + 1, + 1, + Dyes.dyeCyan, + 1, + Arrays.asList(new MaterialStack(Nitrogen, 1), new MaterialStack(Carbon, 1))); + public static Materials NitrogenDioxide = new Materials( + 717, + TextureSet.SET_FLUID, + 1.0F, + 0, + 1, + 16, + 100, + 175, + 255, + 0, + "NitrogenDioxide", + "Nitrogen Dioxide", + 0, + 0, + -1, + 0, + false, + false, + 1, + 1, + 1, + Dyes.dyeCyan, + 1, + Arrays.asList(new MaterialStack(Nitrogen, 1), new MaterialStack(Oxygen, 2))); + public static Materials Obsidian = new Materials( + 804, + TextureSet.SET_DULL, + 1.0F, + 0, + 3, + 1, + 80, + 50, + 100, + 0, + "Obsidian", + "Obsidian", + 0, + 0, + -1, + 0, + false, + false, + 1, + 1, + 1, + Dyes.dyeBlack, + 1, + Arrays.asList( + new MaterialStack(Magnesium, 1), + new MaterialStack(Iron, 1), + new MaterialStack(Silicon, 2), + new MaterialStack(Oxygen, 8))); + public static Materials Phosphate = new Materials( + 833, + TextureSet.SET_DULL, + 1.0F, + 0, + 1, + 1 | 8 | 16, + 255, + 255, + 0, + 0, + "Phosphate", + "Phosphate", + 0, + 0, + -1, + 0, + false, + false, + 2, + 1, + 1, + Dyes.dyeYellow, + 1, + Arrays.asList(new MaterialStack(Phosphorus, 1), new MaterialStack(Oxygen, 4))); + public static Materials PigIron = new Materials( + 307, + TextureSet.SET_METALLIC, + 6.0F, + 384, + 2, + 1 | 2 | 8 | 64, + 200, + 180, + 180, + 0, + "PigIron", + "Pig Iron", + 0, + 0, + -1, + 0, + false, + false, + 3, + 1, + 1, + Dyes.dyePink, + 2, + Collections.singletonList(new MaterialStack(Iron, 1))); + public static Materials Plastic = new Materials( + 874, + TextureSet.SET_DULL, + 3.0F, + 32, + 1, + 1 | 2 | 64 | 128, + 200, + 200, + 200, + 0, + "Plastic", + "Polyethylene", + 0, + 0, + 400, + 0, + false, + false, + 1, + 1, + 1, + Dyes.dyeWhite, + 0, + Arrays.asList(new MaterialStack(Carbon, 1), new MaterialStack(Hydrogen, 2)), + Collections.singletonList(new TC_AspectStack(TC_Aspects.MOTUS, 2))); + public static Materials Epoxid = new Materials( + 470, + TextureSet.SET_DULL, + 3.0F, + 32, + 1, + 1 | 2 | 64 | 128, + 200, + 140, + 20, + 0, + "Epoxid", + "Epoxid", + 0, + 0, + 400, + 0, + false, + false, + 1, + 1, + 1, + Dyes.dyeWhite, + 0, + Arrays.asList(new MaterialStack(Carbon, 21), new MaterialStack(Hydrogen, 24), new MaterialStack(Oxygen, 4)), + Collections.singletonList(new TC_AspectStack(TC_Aspects.MOTUS, 2))); + public static Materials Polydimethylsiloxane = new MaterialBuilder( + 633, TextureSet.SET_FLUID, "Polydimethylsiloxane") + .addDustItems() + .setRGB(245, 245, 245) + .setColor(Dyes.dyeWhite) + .setMaterialList( + new MaterialStack(Carbon, 2), + new MaterialStack(Hydrogen, 6), + new MaterialStack(Oxygen, 1), + new MaterialStack(Silicon, 1)) + .addElectrolyzerRecipe() + .constructMaterial(); + public static Materials Silicone = new Materials( + 471, + TextureSet.SET_DULL, + 3.0F, + 128, + 1, + 1 | 2 | 64 | 128, + 220, + 220, + 220, + 0, + "Silicone", + "Silicone Rubber", + 0, + 0, + 900, + 0, + false, + false, + 1, + 1, + 1, + Dyes.dyeWhite, + 0, + Arrays.asList( + new MaterialStack(Carbon, 2), + new MaterialStack(Hydrogen, 6), + new MaterialStack(Oxygen, 1), + new MaterialStack(Silicon, 1)), + Collections.singletonList(new TC_AspectStack(TC_Aspects.MOTUS, 2))); + public static Materials Polycaprolactam = new Materials( + 472, + TextureSet.SET_DULL, + 3.0F, + 32, + 1, + 1 | 2 | 64 | 128, + 50, + 50, + 50, + 0, + "Polycaprolactam", + "Polycaprolactam", + 0, + 0, + 500, + 0, + false, + false, + 1, + 1, + 1, + Dyes.dyeWhite, + 0, + Arrays.asList( + new MaterialStack(Carbon, 6), + new MaterialStack(Hydrogen, 11), + new MaterialStack(Nitrogen, 1), + new MaterialStack(Oxygen, 1)), + Collections.singletonList(new TC_AspectStack(TC_Aspects.MOTUS, 2))); + public static Materials Polytetrafluoroethylene = new Materials( + 473, + TextureSet.SET_DULL, + 3.0F, + 32, + 1, + 1 | 2 | 64 | 128, + 100, + 100, + 100, + 0, + "Polytetrafluoroethylene", + "Polytetrafluoroethylene", + 0, + 0, + 1400, + 0, + false, + false, + 1, + 1, + 1, + Dyes.dyeWhite, + 0, + Arrays.asList(new MaterialStack(Carbon, 2), new MaterialStack(Fluorine, 4)), + Collections.singletonList(new TC_AspectStack(TC_Aspects.MOTUS, 2))); + public static Materials Powellite = new Materials( + 883, + TextureSet.SET_DULL, + 1.0F, + 0, + 2, + 1 | 8, + 255, + 255, + 0, + 0, + "Powellite", + "Powellite", + 0, + 0, + -1, + 0, + false, + false, + 1, + 1, + 1, + Dyes.dyeYellow, + 2, + Arrays.asList( + new MaterialStack(Calcium, 1), new MaterialStack(Molybdenum, 1), new MaterialStack(Oxygen, 4))); + public static Materials Pumice = new Materials( + 926, + TextureSet.SET_DULL, + 1.0F, + 0, + 2, + 1 | 8, + 230, + 185, + 185, + 0, + "Pumice", + "Pumice", + 0, + 0, + -1, + 0, + false, + false, + 1, + 1, + 1, + Dyes.dyeGray, + 2, + Collections.singletonList(new MaterialStack(Stone, 1))); + public static Materials Pyrite = new Materials( + 834, + TextureSet.SET_ROUGH, + 1.0F, + 0, + 1, + 1 | 8, + 150, + 120, + 40, + 0, + "Pyrite", + "Pyrite", + 0, + 0, + -1, + 0, + false, + false, + 2, + 1, + 1, + Dyes.dyeOrange, + 1, + Arrays.asList(new MaterialStack(Iron, 1), new MaterialStack(Sulfur, 2))); + public static Materials Pyrolusite = new Materials( + 943, + TextureSet.SET_DULL, + 1.0F, + 0, + 2, + 1 | 8, + 150, + 150, + 170, + 0, + "Pyrolusite", + "Pyrolusite", + 0, + 0, + -1, + 0, + false, + false, + 1, + 1, + 1, + Dyes.dyeLightGray, + 1, + Arrays.asList(new MaterialStack(Manganese, 1), new MaterialStack(Oxygen, 2))); + public static Materials Pyrope = new Materials( + 835, + TextureSet.SET_METALLIC, + 1.0F, + 0, + 2, + 1 | 8, + 120, + 50, + 100, + 0, + "Pyrope", + "Pyrope", + 0, + 0, + -1, + 0, + false, + false, + 3, + 1, + 1, + Dyes.dyePurple, + 1, + Arrays.asList( + new MaterialStack(Aluminium, 2), + new MaterialStack(Magnesium, 3), + new MaterialStack(Silicon, 3), + new MaterialStack(Oxygen, 12))); + public static Materials RockSalt = new Materials( + 944, + TextureSet.SET_FINE, + 1.0F, + 0, + 1, + 1 | 8, + 240, + 200, + 200, + 0, + "RockSalt", + "Rock Salt", + 0, + 0, + -1, + 0, + false, + false, + 2, + 1, + 1, + Dyes.dyeWhite, + 1, + Arrays.asList(new MaterialStack(Potassium, 1), new MaterialStack(Chlorine, 1))); + public static Materials Rubber = new Materials( + 880, + TextureSet.SET_SHINY, + 1.5F, + 32, + 0, + 1 | 2 | 64 | 128, + 0, + 0, + 0, + 0, + "Rubber", + "Rubber", + 0, + 0, + 400, + 0, + false, + false, + 1, + 1, + 1, + Dyes.dyeBlack, + 0, + Arrays.asList(new MaterialStack(Carbon, 5), new MaterialStack(Hydrogen, 8)), + Collections.singletonList(new TC_AspectStack(TC_Aspects.MOTUS, 2))); + public static Materials RawRubber = new Materials( + 896, + TextureSet.SET_DULL, + 1.0F, + 0, + 0, + 1, + 204, + 199, + 137, + 0, + "RawRubber", + "Raw Rubber", + 0, + 0, + 400, + 0, + false, + false, + 1, + 1, + 1, + Dyes.dyeWhite, + 0, + Arrays.asList(new MaterialStack(Carbon, 5), new MaterialStack(Hydrogen, 8)), + Collections.singletonList(new TC_AspectStack(TC_Aspects.MOTUS, 2))); + public static Materials Ruby = new Materials( + 502, + TextureSet.SET_RUBY, + 7.0F, + 256, + 2, + 1 | 4 | 8 | 64, + 255, + 100, + 100, + 127, + "Ruby", + "Ruby", + 0, + 0, + -1, + 0, + false, + true, + 5, + 1, + 1, + Dyes.dyeRed, + 1, + Arrays.asList( + new MaterialStack(Chrome, 1), + new MaterialStack(Aluminium, 2), + new MaterialStack(Oxygen, 3)), + Arrays.asList(new TC_AspectStack(TC_Aspects.LUCRUM, 6), new TC_AspectStack(TC_Aspects.VITREUS, 4))) + .disableAutoGeneratedBlastFurnaceRecipes(); + public static Materials Salt = new Materials( + 817, + TextureSet.SET_FINE, + 1.0F, + 0, + 1, + 1 | 8, + 250, + 250, + 250, + 0, + "Salt", + "Salt", + 0, + 0, + -1, + 0, + false, + false, + 2, + 1, + 1, + Dyes.dyeWhite, + 0, + Arrays.asList(new MaterialStack(Sodium, 1), new MaterialStack(Chlorine, 1))); + public static Materials Saltpeter = new Materials( + 836, + TextureSet.SET_FINE, + 1.0F, + 0, + 1, + 1 | 8, + 230, + 230, + 230, + 0, + "Saltpeter", + "Saltpeter", + 0, + 0, + -1, + 0, + false, + false, + 3, + 1, + 1, + Dyes.dyeWhite, + 1, + Arrays.asList( + new MaterialStack(Potassium, 1), new MaterialStack(Nitrogen, 1), new MaterialStack(Oxygen, 3))); + public static Materials Sapphire = new MaterialBuilder(503, TextureSet.SET_GEM_VERTICAL, "Sapphire") + .setToolSpeed(7.0F) + .setDurability(256) + .setToolQuality(2) + .addDustItems() + .addGemItems() + .setTransparent(true) + .addOreItems() + .addToolHeadItems() + .setRGBA(100, 100, 200, 127) + .setColor(Dyes.dyeBlue) + .setOreValue(5) + .setExtraData(0) + .setMaterialList(new MaterialStack(Aluminium, 2), new MaterialStack(Oxygen, 3)) + .setAspects( + Arrays.asList(new TC_AspectStack(TC_Aspects.LUCRUM, 5), new TC_AspectStack(TC_Aspects.VITREUS, 3))) + .constructMaterial() + .disableAutoGeneratedBlastFurnaceRecipes(); + // public static Materials Sapphire = new Materials( 503, TextureSet.SET_GEM_VERTICAL , 7.0F, + // 256, 2, 1 |4|8 |64 , 100, 100, 200, 127, "Sapphire" , "Sapphire" + // , 0, 0, -1, 0, false, true, 5, 1, 1, Dyes.dyeBlue , 1, Arrays.asList(new + // MaterialStack(Aluminium, 2), new MaterialStack(Oxygen, 3)), Arrays.asList(new TC_AspectStack(TC_Aspects.LUCRUM, + // 5), new TC_AspectStack(TC_Aspects.VITREUS, 3))); + public static Materials Scheelite = new Materials( + 910, + TextureSet.SET_DULL, + 1.0F, + 0, + 3, + 1 | 8, + 200, + 140, + 20, + 0, + "Scheelite", + "Scheelite", + 0, + 0, + 2500, + 2500, + false, + false, + 4, + 1, + 1, + Dyes.dyeBlack, + 0, + Arrays.asList(new MaterialStack(Tungsten, 1), new MaterialStack(Calcium, 1), new MaterialStack(Oxygen, 4))); + public static Materials Snow = new Materials( + 728, + TextureSet.SET_FINE, + 1.0F, + 0, + 0, + 1 | 16, + 250, + 250, + 250, + 0, + "Snow", + "Snow", + 0, + 0, + -1, + 0, + false, + false, + 1, + 1, + 1, + Dyes.dyeWhite, + 0, + Arrays.asList(new MaterialStack(Hydrogen, 2), new MaterialStack(Oxygen, 1)), + Collections.singletonList(new TC_AspectStack(TC_Aspects.GELUM, 1))); + public static Materials Sodalite = new Materials( + 525, + TextureSet.SET_LAPIS, + 1.0F, + 0, + 1, + 1 | 4 | 8, + 20, + 20, + 255, + 0, + "Sodalite", + "Sodalite", + 0, + 0, + -1, + 0, + false, + false, + 3, + 1, + 1, + Dyes.dyeBlue, + 1, + Arrays.asList( + new MaterialStack(Aluminium, 3), + new MaterialStack(Silicon, 3), + new MaterialStack(Sodium, 4), + new MaterialStack(Chlorine, 1))); + public static Materials SodiumPersulfate = new Materials( + 718, + TextureSet.SET_FLUID, + 1.0F, + 0, + 2, + 16, + 255, + 255, + 255, + 0, + "SodiumPersulfate", + "Sodium Persulfate", + 0, + 0, + -1, + 0, + false, + false, + 1, + 1, + 1, + Dyes.dyeOrange, + 1, + Arrays.asList(new MaterialStack(Sodium, 2), new MaterialStack(Sulfur, 2), new MaterialStack(Oxygen, 8))); + public static Materials SodiumSulfide = new Materials( + 719, + TextureSet.SET_FLUID, + 1.0F, + 0, + 2, + 1, + 255, + 230, + 128, + 0, + "SodiumSulfide", + "Sodium Sulfide", + 0, + 0, + -1, + 0, + false, + false, + 1, + 1, + 1, + Dyes.dyeOrange, + 1, + Arrays.asList(new MaterialStack(Sodium, 2), new MaterialStack(Sulfur, 1))); + public static Materials HydricSulfide = new Materials( + 460, + TextureSet.SET_FLUID, + 1.0F, + 0, + 2, + 16, + 255, + 255, + 255, + 0, + "HydricSulfide", + "Hydrogen Sulfide", + 0, + 0, + -1, + 0, + false, + false, + 1, + 1, + 1, + Dyes.dyeOrange, + 1, + Arrays.asList(new MaterialStack(Hydrogen, 2), new MaterialStack(Sulfur, 1))); + + public static Materials OilHeavy = new Materials( + 730, + TextureSet.SET_FLUID, + 1.0F, + 0, + 0, + 16, + 10, + 10, + 10, + 0, + "OilHeavy", + "Heavy Oil", + 3, + 40, + -1, + 0, + false, + false, + 1, + 1, + 1, + Dyes.dyeBlack); + public static Materials OilMedium = new Materials( + 731, + TextureSet.SET_FLUID, + 1.0F, + 0, + 0, + 16, + 10, + 10, + 10, + 0, + "OilMedium", + "Raw Oil", + 3, + 30, + -1, + 0, + false, + false, + 1, + 1, + 1, + Dyes.dyeBlack); + public static Materials OilLight = new Materials( + 732, + TextureSet.SET_FLUID, + 1.0F, + 0, + 0, + 16, + 10, + 10, + 10, + 0, + "OilLight", + "Light Oil", + 3, + 20, + -1, + 0, + false, + false, + 1, + 1, + 1, + Dyes.dyeBlack); + + public static Materials NatruralGas = new Materials( + 733, + TextureSet.SET_FLUID, + 1.0F, + 0, + 1, + 16, + 255, + 255, + 255, + 0, + "NatruralGas", + "Natural Gas", + 1, + 20, + -1, + 0, + false, + false, + 3, + 1, + 1, + Dyes.dyeWhite); + public static Materials SulfuricGas = new Materials( + 734, + TextureSet.SET_FLUID, + 1.0F, + 0, + 1, + 16, + 255, + 255, + 255, + 0, + "SulfuricGas", + "Sulfuric Gas", + 1, + 25, + -1, + 0, + false, + false, + 3, + 1, + 1, + Dyes.dyeWhite); + public static Materials Gas = new Materials( + 735, + TextureSet.SET_FLUID, + 1.0F, + 0, + 1, + 16, + 255, + 255, + 255, + 0, + "Gas", + "Refinery Gas", + 1, + 160, + -1, + 0, + false, + false, + 3, + 1, + 1, + Dyes.dyeWhite) + .setCanBeCracked(true); + public static Materials SulfuricNaphtha = new Materials( + 736, + TextureSet.SET_FLUID, + 1.0F, + 0, + 0, + 16, + 255, + 255, + 0, + 0, + "SulfuricNaphtha", + "Sulfuric Naphtha", + 1, + 40, + -1, + 0, + false, + false, + 1, + 1, + 1, + Dyes.dyeYellow); + public static Materials SulfuricLightFuel = new Materials( + 737, + TextureSet.SET_FLUID, + 1.0F, + 0, + 0, + 16, + 255, + 255, + 0, + 0, + "SulfuricLightFuel", + "Sulfuric Light Fuel", + 0, + 40, + -1, + 0, + false, + false, + 1, + 1, + 1, + Dyes.dyeYellow); + public static Materials SulfuricHeavyFuel = new Materials( + 738, + TextureSet.SET_FLUID, + 1.0F, + 0, + 0, + 16, + 255, + 255, + 0, + 0, + "SulfuricHeavyFuel", + "Sulfuric Heavy Fuel", + 3, + 40, + -1, + 0, + false, + false, + 1, + 1, + 1, + Dyes.dyeBlack); + public static Materials Naphtha = new Materials( + 739, + TextureSet.SET_FLUID, + 1.0F, + 0, + 0, + 16, + 255, + 255, + 0, + 0, + "Naphtha", + "Naphtha", + 1, + 320, + -1, + 0, + false, + false, + 1, + 1, + 1, + Dyes.dyeYellow) + .setCanBeCracked(true); + public static Materials LightFuel = new Materials( + 740, + TextureSet.SET_FLUID, + 1.0F, + 0, + 0, + 16, + 255, + 255, + 0, + 0, + "LightFuel", + "Light Fuel", + 0, + 305, + -1, + 0, + false, + false, + 1, + 1, + 1, + Dyes.dyeYellow) + .setCanBeCracked(true); + public static Materials HeavyFuel = new Materials( + 741, + TextureSet.SET_FLUID, + 1.0F, + 0, + 0, + 16, + 255, + 255, + 0, + 0, + "HeavyFuel", + "Heavy Fuel", + 3, + 240, + -1, + 0, + false, + false, + 1, + 1, + 1, + Dyes.dyeBlack) + .setCanBeCracked(true); + public static Materials LPG = new Materials( + 742, + TextureSet.SET_FLUID, + 1.0F, + 0, + 0, + 16, + 255, + 255, + 0, + 0, + "LPG", + "LPG", + 1, + 320, + -1, + 0, + false, + false, + 1, + 1, + 1, + Dyes.dyeYellow); + + public static Materials FluidNaquadahFuel = new MaterialBuilder(600, TextureSet.SET_FLUID, "Naquadah Fuel") + .setName("FluidNaqudahFuel") + .addCell() + .addFluid() + .setRGB(62, 62, 62) + .setColor(Dyes.dyeBlack) + .constructMaterial(); + public static Materials EnrichedNaquadria = new MaterialBuilder(601, TextureSet.SET_FLUID, "Enriched Naquadria") + .setName("EnrichedNaquadria") + .addCell() + .addFluid() + .setRGB(52, 52, 52) + .setColor(Dyes.dyeBlack) + .constructMaterial(); + + public static Materials ReinforceGlass = new MaterialBuilder(602, TextureSet.SET_FLUID, "Molten Reinforced Glass") + .setName("ReinforcedGlass") + .addCell() + .addFluid() + .setRGB(192, 245, 254) + .setColor(Dyes.dyeWhite) + .setLiquidTemperature(2000) + .constructMaterial(); + public static Materials BioMediumRaw = new MaterialBuilder(603, TextureSet.SET_FLUID, "Raw Bio Catalyst Medium") + .setName("BioMediumRaw") + .addCell() + .addFluid() + .setRGB(97, 147, 46) + .setColor(Dyes.dyeLime) + .constructMaterial(); + public static Materials BioMediumSterilized = new MaterialBuilder( + 604, TextureSet.SET_FLUID, "Sterilized Bio Catalyst Medium") + .setName("BiohMediumSterilized") + .addCell() + .addFluid() + .setRGB(162, 253, 53) + .setColor(Dyes.dyeLime) + .constructMaterial(); + + public static Materials Chlorobenzene = new MaterialBuilder(605, TextureSet.SET_FLUID, "Chlorobenzene") + .addCell() + .addFluid() + .setRGB(0, 50, 65) + .setColor(Dyes.dyeGray) + .setMaterialList( + new MaterialStack(Carbon, 6), new MaterialStack(Hydrogen, 5), new MaterialStack(Chlorine, 1)) + .addElectrolyzerRecipe() + .constructMaterial(); + public static Materials DilutedHydrochloricAcid = new MaterialBuilder( + 606, TextureSet.SET_FLUID, "Diluted Hydrochloric Acid") + .setName("DilutedHydrochloricAcid_GT5U") + .addCell() + .addFluid() + .setRGB(153, 167, 163) + .setColor(Dyes.dyeLightGray) + .setMaterialList(new MaterialStack(Hydrogen, 1), new MaterialStack(Chlorine, 1)) + .constructMaterial(); + public static Materials Pyrochlore = new MaterialBuilder(607, TextureSet.SET_METALLIC, "Pyrochlore") + .addDustItems() + .addOreItems() + .setRGB(43, 17, 0) + .setColor(Dyes.dyeBlack) + .setMaterialList(new MaterialStack(Calcium, 2), new MaterialStack(Niobium, 2), new MaterialStack(Oxygen, 7)) + .addElectrolyzerRecipe() + .constructMaterial(); + + public static Materials GrowthMediumRaw = new MaterialBuilder( + 608, TextureSet.SET_FLUID, "Raw Growth Catalyst Medium") + .setName("GrowthMediumRaw") + .addCell() + .addFluid() + .setRGB(211, 141, 95) + .setColor(Dyes.dyeOrange) + .constructMaterial(); + public static Materials GrowthMediumSterilized = new MaterialBuilder( + 609, TextureSet.SET_FLUID, "Growth Catalyst Medium") + .setName("GrowthMediumSterilized") + .addCell() + .addFluid() + .setRGB(222, 170, 135) + .setColor(Dyes.dyeOrange) + .constructMaterial(); + + public static Materials FerriteMixture = new MaterialBuilder(612, TextureSet.SET_METALLIC, "Ferrite Mixture") + .addDustItems() + .setRGB(180, 180, 180) + .setColor(Dyes.dyeGray) + .setMaterialList(new MaterialStack(Nickel, 1), new MaterialStack(Zinc, 1), new MaterialStack(Iron, 4)) + .constructMaterial(); + public static Materials NickelZincFerrite = new MaterialBuilder(613, TextureSet.SET_ROUGH, "Nickel-Zinc Ferrite") + .addDustItems() + .addMetalItems() + .addToolHeadItems() + .addGearItems() + .setToolSpeed(3.0f) + .setDurability(32) + .setRGB(60, 60, 60) + .setColor(Dyes.dyeBlack) + .setBlastFurnaceRequired(true) + .setBlastFurnaceTemp(1500) + .setMaterialList( + new MaterialStack(Nickel, 1), + new MaterialStack(Zinc, 1), + new MaterialStack(Iron, 4), + new MaterialStack(Oxygen, 8)) + .constructMaterial(); + + public static Materials Massicot = new MaterialBuilder(614, TextureSet.SET_DULL, "Massicot") + .addDustItems() + .setRGB(255, 221, 85) + .setColor(Dyes.dyeYellow) + .setMaterialList(new MaterialStack(Lead, 1), new MaterialStack(Oxygen, 1)) + .addElectrolyzerRecipe() + .constructMaterial(); + public static Materials ArsenicTrioxide = new MaterialBuilder(615, TextureSet.SET_SHINY, "Arsenic Trioxide") + .addDustItems() + .setRGB(255, 255, 255) + .setColor(Dyes.dyeGreen) + .setMaterialList(new MaterialStack(Arsenic, 2), new MaterialStack(Oxygen, 3)) + .addElectrolyzerRecipe() + .constructMaterial(); + public static Materials CobaltOxide = new MaterialBuilder(616, TextureSet.SET_DULL, "Cobalt Oxide") + .addDustItems() + .setRGB(102, 128, 0) + .setColor(Dyes.dyeGreen) + .setMaterialList(new MaterialStack(Cobalt, 1), new MaterialStack(Oxygen, 1)) + .addElectrolyzerRecipe() + .constructMaterial(); + public static Materials Zincite = new MaterialBuilder(617, TextureSet.SET_DULL, "Zincite") + .addDustItems() + .setRGB(255, 255, 245) + .setColor(Dyes.dyeWhite) + .setMaterialList(new MaterialStack(Zinc, 1), new MaterialStack(Oxygen, 1)) + .addElectrolyzerRecipe() + .constructMaterial(); + public static Materials AntimonyTrioxide = new MaterialBuilder(618, TextureSet.SET_DULL, "Antimony Trioxide") + .addDustItems() + .setRGB(230, 230, 240) + .setColor(Dyes.dyeWhite) + .setMaterialList(new MaterialStack(Antimony, 2), new MaterialStack(Oxygen, 3)) + .addElectrolyzerRecipe() + .constructMaterial(); + public static Materials CupricOxide = new MaterialBuilder(619, TextureSet.SET_DULL, "Cupric Oxide") + .addDustItems() + .setRGB(15, 15, 15) + .setColor(Dyes.dyeBlack) + .setMeltingPoint(1599) + .setMaterialList(new MaterialStack(Copper, 1), new MaterialStack(Oxygen, 1)) + .addElectrolyzerRecipe() + .constructMaterial(); + public static Materials Ferrosilite = new MaterialBuilder(620, TextureSet.SET_DULL, "Ferrosilite") + .addDustItems() + .setRGB(151, 99, 42) + .setColor(Dyes.dyeBrown) + .setMaterialList(new MaterialStack(Iron, 1), new MaterialStack(Silicon, 1), new MaterialStack(Oxygen, 3)) + .addElectrolyzerRecipe() + .constructMaterial(); + + public static Materials Magnesia = new MaterialBuilder(621, TextureSet.SET_DULL, "Magnesia") + .addDustItems() + .setRGB(255, 225, 225) + .setColor(Dyes.dyeWhite) + .setMaterialList(new MaterialStack(Magnesium, 1), new MaterialStack(Oxygen, 1)) + .addElectrolyzerRecipe() + .constructMaterial(); + public static Materials Quicklime = new MaterialBuilder(622, TextureSet.SET_DULL, "Quicklime") + .addDustItems() + .setRGB(240, 240, 240) + .setColor(Dyes.dyeWhite) + .setMaterialList(new MaterialStack(Calcium, 1), new MaterialStack(Oxygen, 1)) + .addElectrolyzerRecipe() + .constructMaterial(); + public static Materials Potash = new MaterialBuilder(623, TextureSet.SET_DULL, "Potash") + .addDustItems() + .setRGB(120, 66, 55) + .setColor(Dyes.dyeBrown) + .setMaterialList(new MaterialStack(Potassium, 2), new MaterialStack(Oxygen, 1)) + .addElectrolyzerRecipe() + .constructMaterial(); + public static Materials SodaAsh = new MaterialBuilder(624, TextureSet.SET_DULL, "Soda Ash") + .addDustItems() + .setRGB(220, 220, 255) + .setColor(Dyes.dyeWhite) + .setMaterialList(new MaterialStack(Sodium, 2), new MaterialStack(Carbon, 1), new MaterialStack(Oxygen, 3)) + .addElectrolyzerRecipe() + .constructMaterial(); + + public static Materials BioDiesel = new MaterialBuilder(627, TextureSet.SET_FLUID, "Bio Diesel") + .addCell() + .addFluid() + .setRGB(255, 128, 0) + .setColor(Dyes.dyeOrange) + .setFuelType(MaterialBuilder.DIESEL) + .setFuelPower(320) + .constructMaterial(); + public static Materials NitrationMixture = new MaterialBuilder(628, TextureSet.SET_FLUID, "Nitration Mixture") + .addCell() + .setRGB(230, 226, 171) + .setColor(Dyes.dyeBrown) + .constructMaterial(); + public static Materials Glycerol = new MaterialBuilder(629, TextureSet.SET_FLUID, "Glycerol") + .addCell() + .addFluid() + .setRGB(135, 222, 135) + .setColor(Dyes.dyeLime) + .setFuelType(MaterialBuilder.SEMIFLUID) + .setFuelType(164) + .setMaterialList(new MaterialStack(Carbon, 3), new MaterialStack(Hydrogen, 8), new MaterialStack(Oxygen, 3)) + .addElectrolyzerRecipe() + .constructMaterial(); + public static Materials SodiumBisulfate = new MaterialBuilder(630, TextureSet.SET_FLUID, "Sodium Bisulfate") + .addDustItems() + .setRGB(0, 68, 85) + .setColor(Dyes.dyeBlue) + .setMaterialList( + new MaterialStack(Sodium, 1), + new MaterialStack(Hydrogen, 1), + new MaterialStack(Sulfur, 1), + new MaterialStack(Oxygen, 4)) + .constructMaterial(); + public static Materials PolyphenyleneSulfide = new MaterialBuilder( + 631, TextureSet.SET_DULL, "Polyphenylene Sulfide") + .addDustItems() + .addMetalItems() + .addToolHeadItems() + .addGearItems() + .setToolSpeed(3.0f) + .setDurability(32) + .setToolQuality(1) + .setRGB(170, 136, 0) + .setColor(Dyes.dyeBrown) + .setMaterialList(new MaterialStack(Carbon, 6), new MaterialStack(Hydrogen, 4), new MaterialStack(Sulfur, 1)) + .constructMaterial(); + public static Materials Dichlorobenzene = new MaterialBuilder(632, TextureSet.SET_FLUID, "Dichlorobenzene") + .addCell() + .addFluid() + .setRGB(0, 68, 85) + .setColor(Dyes.dyeBlue) + .setMaterialList( + new MaterialStack(Carbon, 6), new MaterialStack(Hydrogen, 4), new MaterialStack(Chlorine, 2)) + .addElectrolyzerRecipe() + .constructMaterial(); + public static Materials Polystyrene = new MaterialBuilder(636, TextureSet.SET_DULL, "Polystyrene") + .addDustItems() + .addMetalItems() + .addToolHeadItems() + .addGearItems() + .setToolSpeed(3.0f) + .setDurability(32) + .setToolQuality(1) + .setRGB(190, 180, 170) + .setColor(Dyes.dyeLightGray) + .setMaterialList(new MaterialStack(Carbon, 8), new MaterialStack(Hydrogen, 8)) + .constructMaterial(); + public static Materials Styrene = new MaterialBuilder(637, TextureSet.SET_FLUID, "Styrene") + .addCell() + .addFluid() + .setRGB(210, 200, 190) + .setColor(Dyes.dyeBlack) + .setMaterialList(new MaterialStack(Carbon, 8), new MaterialStack(Hydrogen, 8)) + .addElectrolyzerRecipe() + .constructMaterial(); + public static Materials Isoprene = new MaterialBuilder(638, TextureSet.SET_FLUID, "Isoprene") + .addCell() + .addFluid() + .setRGB(20, 20, 20) + .setColor(Dyes.dyeBlack) + .setMaterialList(new MaterialStack(Carbon, 5), new MaterialStack(Hydrogen, 8)) + .addElectrolyzerRecipe() + .constructMaterial(); + public static Materials Tetranitromethane = new MaterialBuilder(639, TextureSet.SET_FLUID, "Tetranitromethane") + .addCell() + .addFluid() + .setRGB(15, 40, 40) + .setColor(Dyes.dyeBlack) + .setMaterialList(new MaterialStack(Carbon, 1), new MaterialStack(Nitrogen, 4), new MaterialStack(Oxygen, 8)) + .addElectrolyzerRecipe() + .constructMaterial(); + public static Materials Ethenone = new MaterialBuilder(641, TextureSet.SET_FLUID, "Ethenone") + .addCell() + .addGas() + .setRGB(20, 20, 70) + .setColor(Dyes.dyeBlack) + .setMaterialList(new MaterialStack(Carbon, 2), new MaterialStack(Hydrogen, 2), new MaterialStack(Oxygen, 1)) + .addElectrolyzerRecipe() + .constructMaterial(); + public static Materials Ethane = new MaterialBuilder(642, TextureSet.SET_FLUID, "Ethane") + .addCell() + .addGas() + .setRGB(200, 200, 255) + .setColor(Dyes.dyeLightBlue) + .setFuelType(MaterialBuilder.GAS) + .setFuelPower(168) + .setMaterialList(new MaterialStack(Carbon, 2), new MaterialStack(Hydrogen, 6)) + .addElectrolyzerRecipe() + .setCanBeCracked(true) + .constructMaterial(); + public static Materials Propane = new MaterialBuilder(643, TextureSet.SET_FLUID, "Propane") + .addCell() + .addGas() + .setRGB(250, 226, 80) + .setColor(Dyes.dyeYellow) + .setFuelType(MaterialBuilder.GAS) + .setFuelPower(232) + .setMaterialList(new MaterialStack(Carbon, 3), new MaterialStack(Hydrogen, 8)) + .addElectrolyzerRecipe() + .setCanBeCracked(true) + .constructMaterial(); + public static Materials Butane = new MaterialBuilder(644, TextureSet.SET_FLUID, "Butane") + .addCell() + .addGas() + .setRGB(182, 55, 30) + .setColor(Dyes.dyeOrange) + .setFuelType(MaterialBuilder.GAS) + .setFuelPower(296) + .setMaterialList(new MaterialStack(Carbon, 4), new MaterialStack(Hydrogen, 10)) + .addElectrolyzerRecipe() + .setCanBeCracked(true) + .constructMaterial(); + public static Materials Butene = new MaterialBuilder(645, TextureSet.SET_FLUID, "Butene") + .addCell() + .addGas() + .setRGB(207, 80, 5) + .setColor(Dyes.dyeOrange) + .setFuelType(MaterialBuilder.GAS) + .setFuelPower(256) + .setMaterialList(new MaterialStack(Carbon, 4), new MaterialStack(Hydrogen, 8)) + .addElectrolyzerRecipe() + .setCanBeCracked(true) + .constructMaterial(); + public static Materials Butadiene = new MaterialBuilder(646, TextureSet.SET_FLUID, "Butadiene") + .addCell() + .addGas() + .setRGB(232, 105, 0) + .setColor(Dyes.dyeOrange) + .setFuelType(MaterialBuilder.GAS) + .setFuelPower(206) + .setMaterialList(new MaterialStack(Carbon, 4), new MaterialStack(Hydrogen, 6)) + .addElectrolyzerRecipe() + .setCanBeCracked(true) + .constructMaterial(); + public static Materials RawStyreneButadieneRubber = new MaterialBuilder( + 634, TextureSet.SET_SHINY, "Raw Styrene-Butadiene Rubber") + .addDustItems() + .setRGB(84, 64, 61) + .setColor(Dyes.dyeGray) + .setMaterialList(new MaterialStack(Styrene, 1), new MaterialStack(Butadiene, 3)) + .constructMaterial(); + public static Materials StyreneButadieneRubber = new MaterialBuilder( + 635, TextureSet.SET_SHINY, "Styrene-Butadiene Rubber") + .addDustItems() + .addMetalItems() + .addToolHeadItems() + .addGearItems() + .setToolSpeed(3.0f) + .setDurability(128) + .setToolQuality(1) + .setRGB(33, 26, 24) + .setColor(Dyes.dyeBlack) + .setMaterialList(new MaterialStack(Styrene, 1), new MaterialStack(Butadiene, 3)) + .constructMaterial(); + public static Materials Toluene = new MaterialBuilder(647, TextureSet.SET_FLUID, "Toluene") + .addCell() + .setRGB(80, 29, 5) + .setColor(Dyes.dyeBrown) + .setFuelType(MaterialBuilder.GAS) + .setFuelPower(328) + .setMaterialList(new MaterialStack(Carbon, 7), new MaterialStack(Hydrogen, 8)) + .addElectrolyzerRecipe() + .constructMaterial(); + public static Materials Epichlorohydrin = new MaterialBuilder(648, TextureSet.SET_FLUID, "Epichlorohydrin") + .addCell() + .setRGB(80, 29, 5) + .setColor(Dyes.dyeBrown) + .setMaterialList( + new MaterialStack(Carbon, 3), + new MaterialStack(Hydrogen, 5), + new MaterialStack(Chlorine, 1), + new MaterialStack(Oxygen, 1)) + .addElectrolyzerRecipe() + .constructMaterial(); + public static Materials PolyvinylChloride = new MaterialBuilder(649, TextureSet.SET_DULL, "Polyvinyl Chloride") + .addDustItems() + .addMetalItems() + .addToolHeadItems() + .addGearItems() + .setToolSpeed(3.0f) + .setDurability(32) + .setToolQuality(1) + .setRGB(215, 230, 230) + .setColor(Dyes.dyeLightGray) + .setMaterialList( + new MaterialStack(Carbon, 2), new MaterialStack(Hydrogen, 3), new MaterialStack(Chlorine, 1)) + .constructMaterial(); + public static Materials VinylChloride = new MaterialBuilder(650, TextureSet.SET_FLUID, "Vinyl Chloride") + .addCell() + .addGas() + .setRGB(225, 240, 240) + .setColor(Dyes.dyeLightGray) + .setMaterialList( + new MaterialStack(Carbon, 2), new MaterialStack(Hydrogen, 3), new MaterialStack(Chlorine, 1)) + .addElectrolyzerRecipe() + .constructMaterial(); + public static Materials SulfurDioxide = new MaterialBuilder(651, TextureSet.SET_FLUID, "Sulfur Dioxide") + .addCell() + .addGas() + .setRGB(200, 200, 25) + .setColor(Dyes.dyeYellow) + .setMaterialList(new MaterialStack(Sulfur, 1), new MaterialStack(Oxygen, 2)) + .constructMaterial(); + public static Materials SulfurTrioxide = new MaterialBuilder(652, TextureSet.SET_FLUID, "Sulfur Trioxide") + .addCell() + .addGas() + .setGasTemperature(344) + .setRGB(160, 160, 20) + .setColor(Dyes.dyeYellow) + .setMaterialList(new MaterialStack(Sulfur, 1), new MaterialStack(Oxygen, 3)) + .addElectrolyzerRecipe() + .constructMaterial(); + public static Materials NitricAcid = new MaterialBuilder(653, TextureSet.SET_FLUID, "Nitric Acid") + .addCell() + .addFluid() + .setRGB(230, 226, 171) + .setMaterialList( + new MaterialStack(Hydrogen, 1), new MaterialStack(Nitrogen, 1), new MaterialStack(Oxygen, 3)) + .addElectrolyzerRecipe() + .constructMaterial(); + public static Materials Dimethylhydrazine = new MaterialBuilder(654, TextureSet.SET_FLUID, "1,1-Dimethylhydrazine") + .addCell() + .addFluid() + .setRGB(0, 0, 85) + .setColor(Dyes.dyeBlue) + .setMaterialList( + new MaterialStack(Carbon, 2), new MaterialStack(Hydrogen, 8), new MaterialStack(Nitrogen, 2)) + .addElectrolyzerRecipe() + .constructMaterial(); + public static Materials Chloramine = new MaterialBuilder(655, TextureSet.SET_FLUID, "Chloramine") + .addCell() + .addFluid() + .setRGB(63, 159, 128) + .setColor(Dyes.dyeCyan) + .setMaterialList( + new MaterialStack(Nitrogen, 1), new MaterialStack(Hydrogen, 2), new MaterialStack(Chlorine, 1)) + .addElectrolyzerRecipe() + .constructMaterial(); + public static Materials Dimethylamine = new MaterialBuilder(656, TextureSet.SET_FLUID, "Dimethylamine") + .addCell() + .addGas() + .setRGB(85, 68, 105) + .setColor(Dyes.dyeGray) + .setMaterialList( + new MaterialStack(Carbon, 2), new MaterialStack(Hydrogen, 7), new MaterialStack(Nitrogen, 1)) + .addElectrolyzerRecipe() + .constructMaterial(); + public static Materials DinitrogenTetroxide = new MaterialBuilder(657, TextureSet.SET_FLUID, "Dinitrogen Tetroxide") + .addCell() + .addGas() + .setRGB(0, 65, 132) + .setColor(Dyes.dyeBlue) + .setMaterialList(new MaterialStack(Nitrogen, 2), new MaterialStack(Oxygen, 4)) + .addElectrolyzerRecipe() + .constructMaterial(); + public static Materials NitricOxide = new MaterialBuilder(658, TextureSet.SET_FLUID, "Nitric Oxide") + .addCell() + .addGas() + .setRGB(125, 200, 240) + .setColor(Dyes.dyeCyan) + .setMaterialList(new MaterialStack(Nitrogen, 1), new MaterialStack(Oxygen, 1)) + .addElectrolyzerRecipe() + .constructMaterial(); + public static Materials Ammonia = new MaterialBuilder(659, TextureSet.SET_FLUID, "Ammonia") + .addCell() + .addGas() + .setRGB(63, 52, 128) + .setColor(Dyes.dyeBlue) + .setMaterialList(new MaterialStack(Nitrogen, 1), new MaterialStack(Hydrogen, 3)) + .addElectrolyzerRecipe() + .constructMaterial(); + public static Materials Dimethyldichlorosilane = new MaterialBuilder( + 663, TextureSet.SET_FLUID, "Dimethyldichlorosilane") + .addCell() + .addFluid() + .setRGB(68, 22, 80) + .setColor(Dyes.dyePurple) + .setMaterialList( + new MaterialStack(Carbon, 2), + new MaterialStack(Hydrogen, 6), + new MaterialStack(Chlorine, 2), + new MaterialStack(Silicon, 1)) + .addElectrolyzerRecipe() + .constructMaterial(); + public static Materials Chloromethane = new MaterialBuilder(664, TextureSet.SET_FLUID, "Chloromethane") + .addCell() + .addGas() + .setRGB(200, 44, 160) + .setColor(Dyes.dyeMagenta) + .setMaterialList( + new MaterialStack(Carbon, 1), new MaterialStack(Hydrogen, 3), new MaterialStack(Chlorine, 1)) + .addElectrolyzerRecipe() + .constructMaterial(); + public static Materials PhosphorousPentoxide = new MaterialBuilder( + 665, TextureSet.SET_FLUID, "Phosphorous Pentoxide") + .addCell() + .addDustItems() + .setRGB(220, 220, 0) + .setColor(Dyes.dyeYellow) + .setMaterialList(new MaterialStack(Phosphorus, 4), new MaterialStack(Oxygen, 10)) + .addElectrolyzerRecipe() + .constructMaterial(); + public static Materials Tetrafluoroethylene = new MaterialBuilder(666, TextureSet.SET_FLUID, "Tetrafluoroethylene") + .addCell() + .addGas() + .setRGB(125, 125, 125) + .setColor(Dyes.dyeGray) + .setMaterialList(new MaterialStack(Carbon, 2), new MaterialStack(Fluorine, 4)) + .addElectrolyzerRecipe() + .constructMaterial(); + public static Materials HydrofluoricAcid = new MaterialBuilder(667, TextureSet.SET_FLUID, "Hydrofluoric Acid") + .setName("HydrofluoricAcid_GT5U") + .addCell() + .addFluid() + .setRGB(0, 136, 170) + .setColor(Dyes.dyeLightBlue) + .setMaterialList(new MaterialStack(Hydrogen, 1), new MaterialStack(Fluorine, 1)) + .addElectrolyzerRecipe() + .constructMaterial(); + public static Materials Chloroform = new MaterialBuilder(668, TextureSet.SET_FLUID, "Chloroform") + .addCell() + .addFluid() + .setRGB(137, 44, 160) + .setColor(Dyes.dyePurple) + .setMaterialList( + new MaterialStack(Carbon, 1), new MaterialStack(Hydrogen, 1), new MaterialStack(Chlorine, 3)) + .addElectrolyzerRecipe() + .constructMaterial(); + public static Materials BisphenolA = new MaterialBuilder(669, TextureSet.SET_FLUID, "Bisphenol A") + .addCell() + .setRGB(212, 170, 0) + .setColor(Dyes.dyeBrown) + .setMaterialList( + new MaterialStack(Carbon, 15), new MaterialStack(Hydrogen, 16), new MaterialStack(Oxygen, 2)) + .addElectrolyzerRecipe() + .constructMaterial(); + public static Materials AceticAcid = new MaterialBuilder(670, TextureSet.SET_FLUID, "Acetic Acid") + .addCell() + .addFluid() + .setRGB(200, 180, 160) + .setColor(Dyes.dyeWhite) + .setMaterialList(new MaterialStack(Carbon, 2), new MaterialStack(Hydrogen, 4), new MaterialStack(Oxygen, 2)) + .addElectrolyzerRecipe() + .constructMaterial(); + public static Materials CalciumAcetateSolution = new MaterialBuilder( + 671, TextureSet.SET_RUBY, "Calcium Acetate Solution") + .addCell() + .addFluid() + .setRGB(220, 200, 180) + .setColor(Dyes.dyeCyan) + .setMaterialList( + new MaterialStack(Calcium, 1), + new MaterialStack(Carbon, 4), + new MaterialStack(Oxygen, 4), + new MaterialStack(Hydrogen, 6)) + .addElectrolyzerRecipe() + .constructMaterial(); + public static Materials Acetone = new MaterialBuilder(672, TextureSet.SET_FLUID, "Acetone") + .addCell() + .addFluid() + .setRGB(175, 175, 175) + .setColor(Dyes.dyeWhite) + .setMaterialList(new MaterialStack(Carbon, 3), new MaterialStack(Hydrogen, 6), new MaterialStack(Oxygen, 1)) + .addElectrolyzerRecipe() + .constructMaterial(); + public static Materials Methanol = new MaterialBuilder(673, TextureSet.SET_FLUID, "Methanol") + .addCell() + .addFluid() + .setRGB(170, 136, 0) + .setColor(Dyes.dyeBrown) + .setFuelPower(84) + .setMaterialList(new MaterialStack(Carbon, 1), new MaterialStack(Hydrogen, 4), new MaterialStack(Oxygen, 1)) + .addElectrolyzerRecipe() + .constructMaterial(); + public static Materials CarbonMonoxide = new MaterialBuilder(674, TextureSet.SET_FLUID, "Carbon Monoxide") + .addCell() + .addGas() + .setRGB(14, 72, 128) + .setColor(Dyes.dyeBrown) + .setFuelType(MaterialBuilder.GAS) + .setFuelPower(24) + .setMaterialList(new MaterialStack(Carbon, 1), new MaterialStack(Oxygen, 1)) + .addElectrolyzerRecipe() + .constructMaterial(); + public static Materials MetalMixture = new MaterialBuilder(676, TextureSet.SET_METALLIC, "Metal Mixture") + .addDustItems() + .setRGB(80, 45, 22) + .setColor(Dyes.dyeBrown) + .constructMaterial(); + public static Materials Ethylene = new MaterialBuilder(677, TextureSet.SET_FLUID, "Ethylene") + .addCell() + .addGas() + .setRGB(225, 225, 225) + .setColor(Dyes.dyeWhite) + .setFuelType(MaterialBuilder.GAS) + .setFuelPower(128) + .setMaterialList(new MaterialStack(Carbon, 2), new MaterialStack(Hydrogen, 4)) + .addElectrolyzerRecipe() + .setCanBeCracked(true) + .constructMaterial(); + public static Materials Propene = new MaterialBuilder(678, TextureSet.SET_FLUID, "Propene") + .addCell() + .addGas() + .setRGB(255, 221, 85) + .setColor(Dyes.dyeYellow) + .setFuelType(MaterialBuilder.GAS) + .setFuelPower(192) + .setMaterialList(new MaterialStack(Carbon, 3), new MaterialStack(Hydrogen, 6)) + .addElectrolyzerRecipe() + .setCanBeCracked(true) + .constructMaterial(); + public static Materials VinylAcetate = new MaterialBuilder(679, TextureSet.SET_FLUID, "Vinyl Acetate") + .addCell() + .addFluid() + .setRGB(255, 179, 128) + .setColor(Dyes.dyeOrange) + .setMaterialList(new MaterialStack(Carbon, 4), new MaterialStack(Hydrogen, 6), new MaterialStack(Oxygen, 2)) + .addElectrolyzerRecipe() + .constructMaterial(); + public static Materials PolyvinylAcetate = new MaterialBuilder(680, TextureSet.SET_FLUID, "Polyvinyl Acetate") + .addCell() + .addFluid() + .setRGB(255, 153, 85) + .setColor(Dyes.dyeOrange) + .setMaterialList(new MaterialStack(Carbon, 4), new MaterialStack(Hydrogen, 6), new MaterialStack(Oxygen, 2)) + .constructMaterial(); + public static Materials MethylAcetate = new MaterialBuilder(681, TextureSet.SET_FLUID, "Methyl Acetate") + .addCell() + .addFluid() + .setRGB(238, 198, 175) + .setColor(Dyes.dyeOrange) + .setMaterialList(new MaterialStack(Carbon, 3), new MaterialStack(Hydrogen, 6), new MaterialStack(Oxygen, 2)) + .addElectrolyzerRecipe() + .constructMaterial(); + public static Materials AllylChloride = new MaterialBuilder(682, TextureSet.SET_FLUID, "Allyl Chloride") + .addCell() + .addFluid() + .setRGB(135, 222, 170) + .setColor(Dyes.dyeCyan) + .setMaterialList( + new MaterialStack(Carbon, 3), new MaterialStack(Hydrogen, 5), new MaterialStack(Chlorine, 1)) + .addElectrolyzerRecipe() + .constructMaterial(); + public static Materials HydrochloricAcid = new MaterialBuilder(683, TextureSet.SET_FLUID, "Hydrochloric Acid") + .setName("HydrochloricAcid_GT5U") + .addCell() + .addFluid() + .setRGB(183, 200, 196) + .setColor(Dyes.dyeLightGray) + .setMaterialList(new MaterialStack(Hydrogen, 1), new MaterialStack(Chlorine, 1)) + .constructMaterial(); + public static Materials HypochlorousAcid = new MaterialBuilder(684, TextureSet.SET_FLUID, "Hypochlorous Acid") + .addCell() + .addFluid() + .setRGB(111, 138, 145) + .setColor(Dyes.dyeGray) + .setMaterialList( + new MaterialStack(Hydrogen, 1), new MaterialStack(Chlorine, 1), new MaterialStack(Oxygen, 1)) + .addElectrolyzerRecipe() + .constructMaterial(); + public static Materials SodiumOxide = new MaterialBuilder(744, TextureSet.SET_DULL, "Sodium Oxide") + .setName("SodiumOxide") + .addDustItems() + .setRGB(255, 255, 235) + .setColor(Dyes.dyeWhite) + .setMaterialList(new MaterialStack(Sodium, 2), new MaterialStack(Oxygen, 1)) + .addElectrolyzerRecipe() + .constructMaterial(); + public static Materials SodiumHydroxide = new MaterialBuilder(685, TextureSet.SET_DULL, "Sodium Hydroxide") + .setName("SodiumHydroxide_GT5U") + .addDustItems() + .setRGB(0, 51, 128) + .setColor(Dyes.dyeBlue) + .setMaterialList(new MaterialStack(Sodium, 1), new MaterialStack(Oxygen, 1), new MaterialStack(Hydrogen, 1)) + .constructMaterial(); + public static Materials Benzene = new MaterialBuilder(686, TextureSet.SET_FLUID, "Benzene") + .addCell() + .addFluid() + .setRGB(26, 26, 26) + .setColor(Dyes.dyeGray) + .setFuelType(MaterialBuilder.GAS) + .setFuelPower(360) + .setMaterialList(new MaterialStack(Carbon, 6), new MaterialStack(Hydrogen, 6)) + .addElectrolyzerRecipe() + .constructMaterial(); + public static Materials Phenol = new MaterialBuilder(687, TextureSet.SET_FLUID, "Phenol") + .addCell() + .addFluid() + .setRGB(120, 68, 33) + .setColor(Dyes.dyeBrown) + .setFuelType(MaterialBuilder.GAS) + .setFuelPower(288) + .setMaterialList(new MaterialStack(Carbon, 6), new MaterialStack(Hydrogen, 6), new MaterialStack(Oxygen, 1)) + .addElectrolyzerRecipe() + .constructMaterial(); + public static Materials Cumene = new MaterialBuilder(688, TextureSet.SET_FLUID, "Isopropylbenzene") + .addCell() + .addFluid() + .setRGB(85, 34, 0) + .setColor(Dyes.dyeBrown) + .setMaterialList(new MaterialStack(Carbon, 9), new MaterialStack(Hydrogen, 12)) + .addElectrolyzerRecipe() + .constructMaterial(); + public static Materials PhosphoricAcid = new MaterialBuilder(689, TextureSet.SET_FLUID, "Phosphoric Acid") + .setName("PhosphoricAcid_GT5U") + .addCell() + .addFluid() + .setRGB(220, 220, 0) + .setColor(Dyes.dyeYellow) + .setMaterialList( + new MaterialStack(Hydrogen, 3), new MaterialStack(Phosphorus, 1), new MaterialStack(Oxygen, 4)) + .addElectrolyzerRecipe() + .constructMaterial(); + public static Materials SaltWater = new MaterialBuilder(692, TextureSet.SET_FLUID, "Salt Water") + .addCell() + .addFluid() + .setRGB(0, 0, 200) + .setColor(Dyes.dyeBlue) + .constructMaterial(); + public static Materials IronIIIChloride = new MaterialBuilder(693, TextureSet.SET_FLUID, "Iron III Chloride") + .setName("IronIIIChloride") + .addCell() + .addFluid() + .setRGB(22, 21, 14) + .setColor(Dyes.dyeBlack) + .setMaterialList(new MaterialStack(Chlorine, 3), new MaterialStack(Iron, 1)) + .addElectrolyzerRecipe() + .constructMaterial(); + public static Materials LifeEssence = new MaterialBuilder(694, TextureSet.SET_FLUID, "Life") + .setName("lifeessence") + .addCell() + .addFluid() + .setFuelPower(100) + .setFuelType(5) + .setRGB(110, 3, 3) + .setColor(Dyes.dyeRed) + .setMaterialList() + .constructMaterial(); + + // Roasted Ore Dust + public static Materials RoastedCopper = new MaterialBuilder(546, TextureSet.SET_DULL, "Roasted Copper") + .setName("RoastedCopper") + .addDustItems() + .setRGB(77, 18, 18) + .constructMaterial(); + public static Materials RoastedAntimony = new MaterialBuilder(547, TextureSet.SET_DULL, "Roasted Antimony") + .setName("RoastedAntimony") + .addDustItems() + .setRGB(196, 178, 194) + .constructMaterial(); + public static Materials RoastedIron = new MaterialBuilder(548, TextureSet.SET_DULL, "Roasted Iron") + .setName("RoastedIron") + .addDustItems() + .setRGB(148, 98, 98) + .addOreItems() + .constructMaterial(); + public static Materials RoastedNickel = new MaterialBuilder(549, TextureSet.SET_METALLIC, "Roasted Nickel") + .setName("RoastedNickel") + .addDustItems() + .setRGB(70, 140, 45) + .addOreItems() + .constructMaterial(); + public static Materials RoastedZinc = new MaterialBuilder(550, TextureSet.SET_DULL, "Roasted Zinc") + .setName("RoastedZinc") + .addDustItems() + .setRGB(209, 209, 209) + .constructMaterial(); + public static Materials RoastedCobalt = new MaterialBuilder(551, TextureSet.SET_METALLIC, "Roasted Cobalt") + .setName("RoastedCobalt") + .addDustItems() + .setRGB(8, 64, 9) + .constructMaterial(); + public static Materials RoastedArsenic = new MaterialBuilder(552, TextureSet.SET_SHINY, "Roasted Arsenic") + .setName("RoastedArsenic") + .addDustItems() + .setRGB(240, 240, 240) + .constructMaterial(); + public static Materials RoastedLead = new MaterialBuilder(553, TextureSet.SET_SHINY, "Roasted Lead") + .setName("RoastedLead") + .addDustItems() + .setRGB(168, 149, 43) + .constructMaterial(); + + // Silicon Line + public static Materials SiliconSG = new Materials( + 856, + TextureSet.SET_METALLIC, + 1.0F, + 0, + 2, + 1 | 2 | 8 | 32, + 80, + 80, + 100, + 0, + "SiliconSolarGrade", + "Silicon Solar Grade (Poly SI)", + 0, + 0, + 2273, + 2273, + true, + false, + 1, + 1, + 1, + Dyes.dyeBlack, + Arrays.asList(new TC_AspectStack(TC_Aspects.METALLUM, 4), new TC_AspectStack(TC_Aspects.TENEBRAE, 2))); + public static Materials CalciumDisilicide = new Materials( + 971, + TextureSet.SET_METALLIC, + 1.0F, + 0, + 2, + 1 | 8, + 180, + 180, + 180, + 0, + "CalciumDisilicide", + "Calcium Disilicide", + 0, + 0, + 1313, + -1, + false, + false, + 1, + 1, + 1, + Dyes.dyeGray, + 1, + Arrays.asList(new MaterialStack(Calcium, 1), new MaterialStack(Silicon, 2)), + Arrays.asList(new TC_AspectStack(TC_Aspects.TERRA, 1), new TC_AspectStack(TC_Aspects.ORDO, 1))); // CaSi2 + public static Materials SiliconTetrafluoride = new MaterialBuilder( + 967, TextureSet.SET_FLUID, "Silicon Tetrafluoride") + .setName("SiliconTetrafluoride") + .addCell() + .addGas() + .setTransparent(true) + .setRGB(200, 200, 200) + .setColor(Dyes.dyeWhite) + .setMeltingPoint(178) + .setMaterialList(new MaterialStack(Silicon, 1), new MaterialStack(Fluorine, 4)) + .setAspects( + Arrays.asList(new TC_AspectStack(TC_Aspects.AQUA, 1), new TC_AspectStack(TC_Aspects.VENENUM, 1))) + .constructMaterial(); // SIF4 + public static Materials SiliconTetrachloride = new MaterialBuilder( + 968, TextureSet.SET_FLUID, "Silicon Tetrachloride") + .setName("SiliconTetrachloride") + .addCell() + .addFluid() + .setRGB(220, 220, 220) + .setColor(Dyes.dyeWhite) + .setMeltingPoint(204) + .setMaterialList(new MaterialStack(Silicon, 1), new MaterialStack(Chlorine, 4)) + .setAspects( + Arrays.asList(new TC_AspectStack(TC_Aspects.AQUA, 1), new TC_AspectStack(TC_Aspects.VENENUM, 1))) + .constructMaterial(); // SICL4 + public static Materials Trichlorosilane = new MaterialBuilder(972, TextureSet.SET_FLUID, "Trichlorosilane") + .setName("Trichlorosilane") + .addCell() + .addFluid() + .setRGB(255, 255, 255) + .setColor(Dyes.dyeWhite) + .setMeltingPoint(139) + .setMaterialList( + new MaterialStack(Hydrogen, 1), new MaterialStack(Silicon, 1), new MaterialStack(Chlorine, 3)) + .setAspects( + Arrays.asList(new TC_AspectStack(TC_Aspects.AQUA, 1), new TC_AspectStack(TC_Aspects.VENENUM, 1))) + .constructMaterial(); // HSICL3 + public static Materials Hexachlorodisilane = new MaterialBuilder(973, TextureSet.SET_FLUID, "Hexachlorodisilane") + .setName("Hexachlorodisilane") + .addCell() + .addFluid() + .setRGB(255, 255, 255) + .setColor(Dyes.dyeWhite) + .setMeltingPoint(272) + .setExtraData(1) + .setMaterialList(new MaterialStack(Silicon, 2), new MaterialStack(Chlorine, 6)) + .setAspects(Collections.singletonList(new TC_AspectStack(TC_Aspects.AQUA, 1))) + .constructMaterial(); // SI2CL6 + public static Materials Dichlorosilane = new MaterialBuilder(799, TextureSet.SET_FLUID, "Dichlorosilane") + .setName("Dichlorosilane") + .addCell() + .addGas() + .setTransparent(true) + .setRGB(255, 255, 255) + .setColor(Dyes.dyeWhite) + .setMeltingPoint(151) + .setExtraData(1) + .setMaterialList( + new MaterialStack(Silicon, 1), new MaterialStack(Hydrogen, 2), new MaterialStack(Chlorine, 2)) + .setAspects( + Arrays.asList(new TC_AspectStack(TC_Aspects.AQUA, 1), new TC_AspectStack(TC_Aspects.VENENUM, 1))) + .constructMaterial(); // SIH2CL2 + public static Materials Silane = new MaterialBuilder(798, TextureSet.SET_FLUID, "Silane") + .setName("Silane") + .addCell() + .addGas() + .setRGB(255, 255, 255) + .setColor(Dyes.dyeWhite) + .setMeltingPoint(88) + .setMaterialList(new MaterialStack(Silicon, 1), new MaterialStack(Hydrogen, 4)) + .setAspects(Collections.singletonList(new TC_AspectStack(TC_Aspects.AQUA, 1))) + .constructMaterial(); // SIH4 + public static Materials Calciumhydride = new Materials( + 797, + TextureSet.SET_METALLIC, + 1.0F, + 0, + 2, + 1 | 8, + 220, + 220, + 220, + 0, + "CalciumHydride", + "Calcium Hydride", + 0, + 0, + 1089, + -1, + false, + false, + 1, + 1, + 1, + Dyes.dyeGray, + 1, + Arrays.asList(new MaterialStack(Calcium, 1), new MaterialStack(Hydrogen, 2)), + Arrays.asList(new TC_AspectStack(TC_Aspects.TERRA, 1), new TC_AspectStack(TC_Aspects.ORDO, 1))); // CaH2 + public static Materials AluminiumFluoride = new Materials( + 969, + TextureSet.SET_METALLIC, + 1.0F, + 0, + 2, + 1 | 8, + 255, + 255, + 255, + 0, + "Aluminiumfluoride", + "Aluminium Fluoride", + 0, + 0, + 1533, + -1, + false, + false, + 1, + 1, + 1, + Dyes.dyeWhite, + 1, + Arrays.asList(new MaterialStack(Aluminium, 1), new MaterialStack(Fluorine, 3)), + Arrays.asList(new TC_AspectStack(TC_Aspects.TERRA, 1), new TC_AspectStack(TC_Aspects.ORDO, 1))); // ALF3 + + public static Materials SolderingAlloy = new Materials( + 314, + TextureSet.SET_DULL, + 1.0F, + 0, + 1, + 1 | 2, + 220, + 220, + 230, + 0, + "SolderingAlloy", + "Soldering Alloy", + 0, + 0, + 400, + 400, + false, + false, + 1, + 1, + 1, + Dyes.dyeWhite, + 2, + Arrays.asList(new MaterialStack(Tin, 9), new MaterialStack(Antimony, 1))); + public static Materials GalliumArsenide = new Materials( + 980, + TextureSet.SET_DULL, + 1.0F, + 0, + 1, + 1 | 2, + 160, + 160, + 160, + 0, + "GalliumArsenide", + "Gallium Arsenide", + 0, + 0, + -1, + 1200, + true, + false, + 1, + 1, + 1, + Dyes.dyeGray, + 2, + Arrays.asList(new MaterialStack(Arsenic, 1), new MaterialStack(Gallium, 1))); + public static Materials IndiumGalliumPhosphide = new Materials( + 981, + TextureSet.SET_DULL, + 1.0F, + 0, + 1, + 1 | 2, + 160, + 140, + 190, + 0, + "IndiumGalliumPhosphide", + "Indium Gallium Phosphide", + 0, + 0, + -1, + 0, + false, + false, + 1, + 1, + 1, + Dyes.dyeLightGray, + 2, + Arrays.asList( + new MaterialStack(Indium, 1), new MaterialStack(Gallium, 1), new MaterialStack(Phosphorus, 1))); + public static Materials Spessartine = new Materials( + 838, + TextureSet.SET_DULL, + 1.0F, + 0, + 2, + 1 | 8, + 255, + 100, + 100, + 0, + "Spessartine", + "Spessartine", + 0, + 0, + -1, + 0, + false, + false, + 3, + 1, + 1, + Dyes.dyeRed, + 1, + Arrays.asList( + new MaterialStack(Aluminium, 2), + new MaterialStack(Manganese, 3), + new MaterialStack(Silicon, 3), + new MaterialStack(Oxygen, 12))); + public static Materials Sphalerite = new Materials( + 839, + TextureSet.SET_DULL, + 1.0F, + 0, + 1, + 1 | 8, + 255, + 255, + 255, + 0, + "Sphalerite", + "Sphalerite", + 0, + 0, + -1, + 0, + false, + false, + 2, + 1, + 1, + Dyes.dyeYellow, + 1, + Arrays.asList(new MaterialStack(Zinc, 1), new MaterialStack(Sulfur, 1))); + public static Materials StainlessSteel = new Materials( + 306, + TextureSet.SET_SHINY, + 7.0F, + 480, + 4, + 1 | 2 | 64 | 128, + 200, + 200, + 220, + 0, + "StainlessSteel", + "Stainless Steel", + 0, + 0, + -1, + 1700, + true, + false, + 1, + 1, + 1, + Dyes.dyeWhite, + 1, + Arrays.asList( + new MaterialStack(Iron, 6), + new MaterialStack(Chrome, 1), + new MaterialStack(Manganese, 1), + new MaterialStack(Nickel, 1))); + public static Materials Steel = new Materials( + 305, + TextureSet.SET_METALLIC, + 6.0F, + 512, + 3, + 1 | 2 | 64 | 128, + 128, + 128, + 128, + 0, + "Steel", + "Steel", + 0, + 0, + 1811, + 1000, + true, + false, + 4, + 51, + 50, + Dyes.dyeGray, + 1, + Arrays.asList(new MaterialStack(Iron, 50), new MaterialStack(Carbon, 1)), + Arrays.asList(new TC_AspectStack(TC_Aspects.METALLUM, 2), new TC_AspectStack(TC_Aspects.ORDO, 1))); + public static Materials Stibnite = new Materials( + 945, + TextureSet.SET_METALLIC, + 1.0F, + 0, + 2, + 1 | 8, + 70, + 70, + 70, + 0, + "Stibnite", + "Stibnite", + 0, + 0, + -1, + 0, + false, + false, + 1, + 1, + 1, + Dyes.dyeWhite, + 2, + Arrays.asList(new MaterialStack(Antimony, 2), new MaterialStack(Sulfur, 3))); + public static Materials SulfuricAcid = new Materials( + 720, + TextureSet.SET_FLUID, + 1.0F, + 0, + 2, + 16, + 255, + 128, + 0, + 0, + "SulfuricAcid", + "Sulfuric Acid", + 0, + 0, + -1, + 0, + false, + false, + 1, + 1, + 1, + Dyes.dyeOrange, + 1, + Arrays.asList(new MaterialStack(Hydrogen, 2), new MaterialStack(Sulfur, 1), new MaterialStack(Oxygen, 4))); + public static Materials Tanzanite = new Materials( + 508, + TextureSet.SET_GEM_VERTICAL, + 7.0F, + 256, + 2, + 1 | 4 | 8 | 64, + 64, + 0, + 200, + 127, + "Tanzanite", + "Tanzanite", + 0, + 0, + -1, + 0, + false, + true, + 5, + 1, + 1, + Dyes.dyePurple, + 1, + Arrays.asList( + new MaterialStack(Calcium, 2), + new MaterialStack(Aluminium, 3), + new MaterialStack(Silicon, 3), + new MaterialStack(Hydrogen, 1), + new MaterialStack(Oxygen, 13)), + Arrays.asList(new TC_AspectStack(TC_Aspects.LUCRUM, 5), new TC_AspectStack(TC_Aspects.VITREUS, 3))); + public static Materials Tetrahedrite = new Materials( + 840, + TextureSet.SET_DULL, + 1.0F, + 0, + 2, + 1 | 8, + 200, + 32, + 0, + 0, + "Tetrahedrite", + "Tetrahedrite", + 0, + 0, + -1, + 0, + false, + false, + 3, + 1, + 1, + Dyes.dyeRed, + 2, + Arrays.asList( + new MaterialStack(Copper, 3), + new MaterialStack(Antimony, 1), + new MaterialStack(Sulfur, 3), + new MaterialStack(Iron, 1))); // Cu3SbS3 + x(Fe,Zn)6Sb2S9 + public static Materials TinAlloy = new Materials( + 363, + TextureSet.SET_METALLIC, + 6.5F, + 96, + 2, + 1 | 2 | 64 | 128, + 200, + 200, + 200, + 0, + "TinAlloy", + "Tin Alloy", + 0, + 0, + -1, + 0, + false, + false, + 1, + 1, + 1, + Dyes.dyeWhite, + 2, + Arrays.asList(new MaterialStack(Tin, 1), new MaterialStack(Iron, 1)), + Arrays.asList(new TC_AspectStack(TC_Aspects.METALLUM, 2), new TC_AspectStack(TC_Aspects.INSTRUMENTUM, 1))); + public static Materials Topaz = new Materials( + 507, + TextureSet.SET_GEM_HORIZONTAL, + 7.0F, + 256, + 3, + 1 | 4 | 8 | 64, + 255, + 128, + 0, + 127, + "Topaz", + "Topaz", + 0, + 0, + -1, + 0, + false, + true, + 5, + 1, + 1, + Dyes.dyeOrange, + 1, + Arrays.asList( + new MaterialStack(Aluminium, 2), + new MaterialStack(Silicon, 1), + new MaterialStack(Fluorine, 2), + new MaterialStack(Hydrogen, 2), + new MaterialStack(Oxygen, 6)), + Arrays.asList(new TC_AspectStack(TC_Aspects.LUCRUM, 6), new TC_AspectStack(TC_Aspects.VITREUS, 4))); + public static Materials Tungstate = new Materials( + 841, + TextureSet.SET_DULL, + 1.0F, + 0, + 3, + 1 | 8, + 55, + 50, + 35, + 0, + "Tungstate", + "Tungstate", + 0, + 0, + 2500, + 2500, + true, + false, + 4, + 1, + 1, + Dyes.dyeBlack, + 0, + Arrays.asList(new MaterialStack(Tungsten, 1), new MaterialStack(Lithium, 2), new MaterialStack(Oxygen, 4))); + public static Materials Ultimet = new Materials( + 344, + TextureSet.SET_SHINY, + 9.0F, + 2048, + 4, + 1 | 2 | 64 | 128, + 180, + 180, + 230, + 0, + "Ultimet", + "Ultimet", + 0, + 0, + 2700, + 2700, + true, + false, + 1, + 1, + 1, + Dyes.dyeLightBlue, + 1, + Arrays.asList( + new MaterialStack(Cobalt, 5), + new MaterialStack(Chrome, 2), + new MaterialStack(Nickel, 1), + new MaterialStack( + Molybdenum, + 1))); // 54% Cobalt, 26% Chromium, 9% Nickel, 5% Molybdenum, 3% Iron, 2% Tungsten, 0.8% + // Manganese, 0.3% Silicon, 0.08% Nitrogen and 0.06% Carbon + public static Materials Uraninite = new Materials( + 922, + TextureSet.SET_METALLIC, + 1.0F, + 0, + 3, + 1 | 8, + 35, + 35, + 35, + 0, + "Uraninite", + "Uraninite", + 0, + 0, + -1, + 0, + false, + false, + 1, + 1, + 1, + Dyes.dyeLime, + 2, + Arrays.asList(new MaterialStack(Uranium, 1), new MaterialStack(Oxygen, 2))); + public static Materials Uvarovite = new Materials( + 842, + TextureSet.SET_DIAMOND, + 1.0F, + 0, + 2, + 1 | 8, + 180, + 255, + 180, + 0, + "Uvarovite", + "Uvarovite", + 0, + 0, + -1, + 0, + false, + false, + 3, + 1, + 1, + Dyes.dyeGreen, + 1, + Arrays.asList( + new MaterialStack(Calcium, 3), + new MaterialStack(Chrome, 2), + new MaterialStack(Silicon, 3), + new MaterialStack(Oxygen, 12))); + public static Materials VanadiumGallium = new Materials( + 357, + TextureSet.SET_SHINY, + 1.0F, + 0, + 2, + 1 | 2 | 128, + 128, + 128, + 140, + 0, + "VanadiumGallium", + "Vanadium-Gallium", + 0, + 0, + 4500, + 4500, + true, + false, + 1, + 1, + 1, + Dyes.dyeGray, + 2, + Arrays.asList(new MaterialStack(Vanadium, 3), new MaterialStack(Gallium, 1))) + .disableAutoGeneratedBlastFurnaceRecipes(); + public static Materials Wood = new Materials( + 809, + TextureSet.SET_WOOD, + 2.0F, + 16, + 0, + 1 | 2 | 64 | 128, + 100, + 50, + 0, + 0, + "Wood", + "Wood", + 0, + 0, + -1, + 0, + false, + false, + 1, + 1, + 1, + Dyes.dyeBrown, + 0, + Arrays.asList(new MaterialStack(Carbon, 1), new MaterialStack(Oxygen, 1), new MaterialStack(Hydrogen, 1)), + Collections.singletonList(new TC_AspectStack(TC_Aspects.ARBOR, 2))); + public static Materials WroughtIron = new Materials( + 304, + TextureSet.SET_METALLIC, + 6.0F, + 384, + 2, + 1 | 2 | 64 | 128, + 200, + 180, + 180, + 0, + "WroughtIron", + "Wrought Iron", + 0, + 0, + 1811, + 0, + false, + false, + 3, + 1, + 1, + Dyes.dyeLightGray, + 2, + Collections.singletonList(new MaterialStack(Iron, 1))); + public static Materials Wulfenite = new Materials( + 882, + TextureSet.SET_DULL, + 1.0F, + 0, + 3, + 1 | 8, + 255, + 128, + 0, + 0, + "Wulfenite", + "Wulfenite", + 0, + 0, + -1, + 0, + false, + false, + 1, + 1, + 1, + Dyes.dyeOrange, + 2, + Arrays.asList(new MaterialStack(Lead, 1), new MaterialStack(Molybdenum, 1), new MaterialStack(Oxygen, 4))); + public static Materials YellowLimonite = new Materials( + 931, + TextureSet.SET_METALLIC, + 1.0F, + 0, + 2, + 1 | 8, + 200, + 200, + 0, + 0, + "YellowLimonite", + "Yellow Limonite", + 0, + 0, + -1, + 0, + false, + false, + 1, + 1, + 1, + Dyes.dyeYellow, + 2, + Arrays.asList( + new MaterialStack(Iron, 1), + new MaterialStack(Hydrogen, 1), + new MaterialStack(Oxygen, 2))); // FeO(OH) + a bit of Ni and Co + public static Materials YttriumBariumCuprate = new Materials( + 358, + TextureSet.SET_METALLIC, + 1.0F, + 0, + 2, + 1 | 2, + 80, + 64, + 70, + 0, + "YttriumBariumCuprate", + "Yttrium Barium Cuprate", + 0, + 0, + 4500, + 4500, + true, + false, + 1, + 1, + 1, + Dyes.dyeGray, + 0, + Arrays.asList( + new MaterialStack(Yttrium, 1), + new MaterialStack(Barium, 2), + new MaterialStack(Copper, 3), + new MaterialStack(Oxygen, 7))); /** * Second Degree Compounds */ - public static Materials WoodSealed = new Materials( 889, TextureSet.SET_WOOD , 3.0F, 24, 0, 1|2 |64|128 , 80, 40, 0, 0, "WoodSealed" , "Sealed Wood" , 0, 0, -1, 0, false, false, 1, 1, 1, Dyes.dyeBrown , 0, Collections.singletonList(new MaterialStack(Wood, 1)), Arrays.asList(new TC_AspectStack(TC_Aspects.ARBOR, 2), new TC_AspectStack(TC_Aspects.FABRICO, 1))); - public static Materials LiveRoot = new Materials( 832, TextureSet.SET_WOOD , 1.0F, 0, 1, 1 , 220, 200, 0, 0, "LiveRoot" , "Liveroot" , 5, 16, -1, 0, false, false, 2, 4, 3, Dyes.dyeBrown , 2, Arrays.asList(new MaterialStack(Wood, 3), new MaterialStack(Magic, 1)), Arrays.asList(new TC_AspectStack(TC_Aspects.ARBOR, 2), new TC_AspectStack(TC_Aspects.VICTUS, 2), new TC_AspectStack(TC_Aspects.PRAECANTATIO, 1))); - public static Materials IronWood = new Materials( 338, TextureSet.SET_WOOD , 6.0F, 384, 2, 1|2 |64|128 , 150, 140, 110, 0, "IronWood" , "Ironwood" , 5, 8, -1, 0, false, false, 2, 19, 18, Dyes.dyeBrown , 2, Arrays.asList(new MaterialStack(Iron, 9), new MaterialStack(LiveRoot, 9), new MaterialStack(Gold, 1))); - public static Materials Glass = new Materials( 890, TextureSet.SET_GLASS , 1.0F, 4, 0, 1 |4 , 250, 250, 250, 220, "Glass" , "Glass" , 0, 0, 1500, 0, false, true, 1, 1, 1, Dyes.dyeWhite , 2, Collections.singletonList(new MaterialStack(SiliconDioxide, 1)), Collections.singletonList(new TC_AspectStack(TC_Aspects.VITREUS, 2))); - public static Materials BorosilicateGlass = new MaterialBuilder(611, TextureSet.SET_GLASS , "Borosilicate Glass").addDustItems().addMetalItems().setRGB(230, 243, 230).setColor(Dyes.dyeWhite).setMaterialList(new MaterialStack(Boron, 1), new MaterialStack(Glass, 7)).addCentrifugeRecipe().constructMaterial(); - public static Materials Perlite = new Materials( 925, TextureSet.SET_DULL , 1.0F, 0, 1, 1 |8 , 30, 20, 30, 0, "Perlite" , "Perlite" , 0, 0, -1, 0, false, false, 1, 1, 1, Dyes.dyeBlack , 2, Arrays.asList(new MaterialStack(Obsidian, 2), new MaterialStack(Water, 1))); - public static Materials Borax = new Materials( 941, TextureSet.SET_FINE , 1.0F, 0, 1, 1 |8 , 250, 250, 250, 0, "Borax" , "Borax" , 0, 0, -1, 0, false, false, 1, 1, 1, Dyes.dyeWhite , 1, Arrays.asList(new MaterialStack(Sodium, 2), new MaterialStack(Boron, 4), new MaterialStack(Oxygen, 7), new MaterialStack(Water, 10))); - public static Materials Lignite = new Materials( 538, TextureSet.SET_LIGNITE , 1.0F, 0, 0, 1 |4|8 , 100, 70, 70, 0, "Lignite" , "Lignite Coal" , 0, 0, -1, 0, false, false, 1, 1, 1, Dyes.dyeBlack , 1, Arrays.asList(new MaterialStack(Carbon, 3), new MaterialStack(Water, 1))); - public static Materials Olivine = new Materials( 505, TextureSet.SET_RUBY , 7.0F, 256, 2, 1 |4|8 |64 , 150, 255, 150, 127, "Olivine" , "Olivine" , 0, 0, -1, 0, false, true, 5, 1, 1, Dyes.dyeLime , 1, Arrays.asList(new MaterialStack(Magnesium, 2), new MaterialStack(Iron, 1), new MaterialStack(SiliconDioxide, 2)), Arrays.asList(new TC_AspectStack(TC_Aspects.LUCRUM, 4), new TC_AspectStack(TC_Aspects.VITREUS, 2))); - public static Materials Opal = new Materials( 510, TextureSet.SET_OPAL , 7.0F, 256, 2, 1 |4|8 |64 , 0, 0, 255, 0, "Opal" , "Opal" , 0, 0, -1, 0, false, true, 3, 1, 1, Dyes.dyeBlue , 1, Collections.singletonList(new MaterialStack(SiliconDioxide, 1)), Arrays.asList(new TC_AspectStack(TC_Aspects.LUCRUM, 5), new TC_AspectStack(TC_Aspects.VITREUS, 3))); - public static Materials Amethyst = new Materials( 509, TextureSet.SET_FLINT , 7.0F, 256, 3, 1 |4|8 |64 , 210, 50, 210, 127, "Amethyst" , "Amethyst" , 0, 0, -1, 0, false, true, 3, 1, 1, Dyes.dyePink , 1, Arrays.asList(new MaterialStack(SiliconDioxide, 4), new MaterialStack(Iron, 1)), Arrays.asList(new TC_AspectStack(TC_Aspects.LUCRUM, 6), new TC_AspectStack(TC_Aspects.VITREUS, 4))); - public static Materials Redstone = new Materials( 810, TextureSet.SET_ROUGH , 1.0F, 0, 2, 1 |8 , 200, 0, 0, 0, "Redstone" , "Redstone" , 0, 0, 500, 0, false, false, 3, 1, 1, Dyes.dyeRed , 2, Arrays.asList(new MaterialStack(Silicon, 1), new MaterialStack(Pyrite, 5), new MaterialStack(Ruby, 1), new MaterialStack(Mercury, 3)), Arrays.asList(new TC_AspectStack(TC_Aspects.MACHINA, 1), new TC_AspectStack(TC_Aspects.POTENTIA, 2))); - public static Materials Lapis = new Materials( 526, TextureSet.SET_LAPIS , 1.0F, 0, 1, 1 |4|8 , 70, 70, 220, 0, "Lapis" , "Lapis" , 0, 0, -1, 0, false, false, 3, 1, 1, Dyes.dyeBlue , 2, Arrays.asList(new MaterialStack(Lazurite, 12), new MaterialStack(Sodalite, 2), new MaterialStack(Pyrite, 1), new MaterialStack(Calcite, 1)), Collections.singletonList(new TC_AspectStack(TC_Aspects.SENSUS, 1))); - public static Materials Blaze = new Materials( 801, TextureSet.SET_POWDER , 2.0F, 16, 1, 1 |64 , 255, 200, 0, 0, "Blaze" , "Blaze" , 0, 0, 6400, 0, false, false, 2, 3, 2, Dyes.dyeYellow , 2, Arrays.asList(new MaterialStack(DarkAsh, 1), new MaterialStack(Sulfur, 1), new MaterialStack(Magic, 1)), Arrays.asList(new TC_AspectStack(TC_Aspects.PRAECANTATIO, 2), new TC_AspectStack(TC_Aspects.IGNIS, 4))); - public static Materials EnderPearl = new Materials( 532, TextureSet.SET_SHINY , 1.0F, 16, 1, 1 |4 , 108, 220, 200, 0, "EnderPearl" , "Enderpearl" , 0, 0, -1, 0, false, false, 1, 16, 10, Dyes.dyeGreen , 1, Arrays.asList(new MaterialStack(Beryllium, 1), new MaterialStack(Potassium, 4), new MaterialStack(Nitrogen, 5), new MaterialStack(Magic, 6)), Arrays.asList(new TC_AspectStack(TC_Aspects.ALIENIS, 4), new TC_AspectStack(TC_Aspects.ITER, 4), new TC_AspectStack(TC_Aspects.PRAECANTATIO, 2))); - public static Materials EnderEye = new Materials( 533, TextureSet.SET_SHINY , 1.0F, 16, 1, 1 |4 , 160, 250, 230, 0, "EnderEye" , "Endereye" , 5, 10, -1, 0, false, false, 1, 2, 1, Dyes.dyeGreen , 2, Arrays.asList(new MaterialStack(EnderPearl, 1), new MaterialStack(Blaze, 1)), Arrays.asList(new TC_AspectStack(TC_Aspects.SENSUS, 4), new TC_AspectStack(TC_Aspects.ALIENIS, 4), new TC_AspectStack(TC_Aspects.ITER, 4), new TC_AspectStack(TC_Aspects.PRAECANTATIO, 3), new TC_AspectStack(TC_Aspects.IGNIS, 2))); - public static Materials Flint = new Materials( 802, TextureSet.SET_FLINT , 2.5F, 128, 1, 1 |64 , 0, 32, 64, 0, "Flint" , "Flint" , 0, 0, -1, 0, false, false, 1, 1, 1, Dyes.dyeGray , 2, Collections.singletonList(new MaterialStack(SiliconDioxide, 1)), Arrays.asList(new TC_AspectStack(TC_Aspects.TERRA, 1), new TC_AspectStack(TC_Aspects.INSTRUMENTUM, 1))); - public static Materials Diatomite = new Materials( 948, TextureSet.SET_DULL , 1.0F, 0, 1, 1 |8 , 225, 225, 225, 0, "Diatomite" , "Diatomite" , 0, 0, -1, 0, false, false, 1, 1, 1, Dyes.dyeGray , 2, Arrays.asList(new MaterialStack(Flint, 8), new MaterialStack(BandedIron, 1), new MaterialStack(Sapphire, 1))); - public static Materials VolcanicAsh = new Materials( 940, TextureSet.SET_FLINT , 1.0F, 0, 0, 1 , 60, 50, 50, 0, "VolcanicAsh" , "Volcanic Ashes" , 0, 0, -1, 0, false, false, 1, 1, 1, Dyes.dyeBlack , 2, Arrays.asList(new MaterialStack(Flint, 6), new MaterialStack(Iron, 1), new MaterialStack(Magnesium, 1))); - public static Materials Niter = new Materials( 531, TextureSet.SET_FLINT , 1.0F, 0, 1, 1 |4|8 , 255, 200, 200, 0, "Niter" , "Niter" , 0, 0, -1, 0, false, false, 1, 1, 1, Dyes.dyePink , 2, Collections.singletonList(new MaterialStack(Saltpeter, 1))); - public static Materials Pyrotheum = new Materials( 843, TextureSet.SET_FIERY , 1.0F, 0, 1, 1 , 255, 128, 0, 0, "Pyrotheum" , "Pyrotheum" , 2, 62, -1, 0, false, false, 2, 3, 1, Dyes.dyeYellow , 2, Arrays.asList(new MaterialStack(Coal, 1), new MaterialStack(Redstone, 1), new MaterialStack(Blaze, 1)), Arrays.asList(new TC_AspectStack(TC_Aspects.PRAECANTATIO, 2), new TC_AspectStack(TC_Aspects.IGNIS, 1))); - public static Materials Cryotheum = new Materials( 898, TextureSet.SET_SHINY , 1.0F, 0, 1, 1 , 0, 148, 203, 0, "Cryotheum" , "Cryotheum" , 2, 62, -1, 0, false, false, 2, 3, 1, Dyes.dyeLightBlue , 2, Arrays.asList(new MaterialStack(Saltpeter, 1), new MaterialStack(Redstone, 1), new MaterialStack(Snow, 1), new MaterialStack(Blizz, 1)), Arrays.asList(new TC_AspectStack(TC_Aspects.PRAECANTATIO, 2), new TC_AspectStack(TC_Aspects.ELECTRUM, 1), new TC_AspectStack(TC_Aspects.GELUM, 1))); - public static Materials HydratedCoal = new Materials( 818, TextureSet.SET_ROUGH , 1.0F, 0, 1, 1 , 70, 70, 100, 0, "HydratedCoal" , "Hydrated Coal" , 0, 0, -1, 0, false, false, 1, 9, 8, Dyes.dyeBlack , 2, Arrays.asList(new MaterialStack(Coal, 8), new MaterialStack(Water, 1))); - public static Materials Apatite = new Materials( 530, TextureSet.SET_DIAMOND , 1.0F, 0, 1, 1 |4|8 , 200, 200, 255, 0, "Apatite" , "Apatite" , 0, 0, -1, 0, false, false, 2, 1, 1, Dyes.dyeCyan , 1, Arrays.asList(new MaterialStack(Calcium, 5), new MaterialStack(Phosphate, 3), new MaterialStack(Chlorine, 1)), Collections.singletonList(new TC_AspectStack(TC_Aspects.MESSIS, 2))); - public static Materials Alumite = new Materials( 400, TextureSet.SET_METALLIC , 5.0F, 768, 2, 1|2 |64|128 , 255, 105, 180, 0, "Alumite" , "Alumite" , 0, 0, -1, 0, false, false, 1, 1, 1, Dyes.dyePink , 2, Arrays.asList(new MaterialStack(Aluminium, 5), new MaterialStack(Steel, 2), new MaterialStack(Obsidian, 2)), Collections.singletonList(new TC_AspectStack(TC_Aspects.STRONTIO, 2))); - public static Materials Manyullyn = new Materials( 386, TextureSet.SET_SHINY , 25.0F, 2048, 5, 1|2 |8 |64|128 , 154, 76, 185, 0, "Manyullyn" , "Manyullyn" , 0, 0, 3600, 3600, true, false, 1, 1, 1, Dyes.dyePurple , 2, Arrays.asList(new MaterialStack(Cobalt, 1), new MaterialStack(Ardite, 1)), Collections.singletonList(new TC_AspectStack(TC_Aspects.STRONTIO, 2))).disableAutoGeneratedBlastFurnaceRecipes(); - public static Materials Steeleaf = new Materials( 339, TextureSet.SET_LEAF , 8.0F, 768, 3, 1|2 |64|128 , 50, 127, 50, 0, "Steeleaf" , "Steeleaf" , 5, 24, -1, 0, false, false, 4, 1, 1, Dyes.dyeGreen , 2, Arrays.asList(new MaterialStack(Steel, 1), new MaterialStack(Magic, 1)), Arrays.asList(new TC_AspectStack(TC_Aspects.HERBA, 2), new TC_AspectStack(TC_Aspects.METALLUM, 2), new TC_AspectStack(TC_Aspects.PRAECANTATIO, 1))); - public static Materials Knightmetal = new Materials( 362, TextureSet.SET_METALLIC , 8.0F, 1024, 3, 1|2 |64|128 , 210, 240, 200, 0, "Knightmetal" , "Knightmetal" , 5, 24, -1, 0, false, false, 4, 1, 1, Dyes.dyeLime , 2, Arrays.asList(new MaterialStack(Steel, 2), new MaterialStack(Magic, 1)), Arrays.asList(new TC_AspectStack(TC_Aspects.LUCRUM, 1), new TC_AspectStack(TC_Aspects.METALLUM, 2))); - public static Materials SterlingSilver = new Materials( 350, TextureSet.SET_SHINY , 13.0F, 128, 2, 1|2 |64|128 , 250, 220, 225, 0, "SterlingSilver" , "Sterling Silver" , 0, 0, -1, 1700, true, false, 4, 1, 1, Dyes.dyeWhite , 2, Arrays.asList(new MaterialStack(Copper, 1), new MaterialStack(Silver, 4))); - public static Materials RoseGold = new Materials( 351, TextureSet.SET_SHINY , 14.0F, 128, 2, 1|2 |64|128 , 255, 230, 30, 0, "RoseGold" , "Rose Gold" , 0, 0, -1, 1600, true, false, 4, 1, 1, Dyes.dyeOrange , 2, Arrays.asList(new MaterialStack(Copper, 1), new MaterialStack(Gold, 4))); - public static Materials BlackBronze = new Materials( 352, TextureSet.SET_DULL , 12.0F, 256, 2, 1|2 |64|128 , 100, 50, 125, 0, "BlackBronze" , "Black Bronze" , 0, 0, -1, 2000, true, false, 4, 1, 1, Dyes.dyePurple , 2, Arrays.asList(new MaterialStack(Gold, 1), new MaterialStack(Silver, 1), new MaterialStack(Copper, 3))); - public static Materials BismuthBronze = new Materials( 353, TextureSet.SET_DULL , 8.0F, 256, 2, 1|2 |64|128 , 100, 125, 125, 0, "BismuthBronze" , "Bismuth Bronze" , 0, 0, -1, 1100, true, false, 4, 1, 1, Dyes.dyeCyan , 2, Arrays.asList(new MaterialStack(Bismuth, 1), new MaterialStack(Zinc, 1), new MaterialStack(Copper, 3))); - public static Materials BlackSteel = new Materials( 334, TextureSet.SET_METALLIC , 6.5F, 768, 3, 1|2 |64|128 , 100, 100, 100, 0, "BlackSteel" , "Black Steel" , 0, 0, -1, 1200, true, false, 4, 1, 1, Dyes.dyeBlack , 2, Arrays.asList(new MaterialStack(Nickel, 1), new MaterialStack(BlackBronze, 1), new MaterialStack(Steel, 3))).disableAutoGeneratedBlastFurnaceRecipes(); - public static Materials RedSteel = new Materials( 348, TextureSet.SET_METALLIC , 7.0F, 896, 4, 1|2 |64|128 , 140, 100, 100, 0, "RedSteel" , "Red Steel" , 0, 0, -1, 1300, true, false, 4, 1, 1, Dyes.dyeRed , 2, Arrays.asList(new MaterialStack(SterlingSilver, 1), new MaterialStack(BismuthBronze, 1), new MaterialStack(Steel, 2), new MaterialStack(BlackSteel, 4))); - public static Materials BlueSteel = new Materials( 349, TextureSet.SET_METALLIC , 7.5F, 1024, 4, 1|2 |64|128 , 100, 100, 140, 0, "BlueSteel" , "Blue Steel" , 0, 0, -1, 1400, true, false, 4, 1, 1, Dyes.dyeBlue , 2, Arrays.asList(new MaterialStack(RoseGold, 1), new MaterialStack(Brass, 1), new MaterialStack(Steel, 2), new MaterialStack(BlackSteel, 4))); - public static Materials DamascusSteel = new Materials( 335, TextureSet.SET_METALLIC , 8.0F, 1280, 3, 1|2 |64|128 , 110, 110, 110, 0, "DamascusSteel" , "Damascus Steel" , 0, 0, 2000, 1500, true, false, 4, 1, 1, Dyes.dyeGray , 2, Collections.singletonList(new MaterialStack(Steel, 1))).disableAutoGeneratedBlastFurnaceRecipes(); - public static Materials TungstenSteel = new Materials( 316, TextureSet.SET_METALLIC , 8.0F, 2560, 4, 1|2 |64|128 , 100, 100, 160, 0, "TungstenSteel" , "Tungstensteel" , 0, 0, -1, 3000, true, false, 4, 1, 1, Dyes.dyeBlue , 2, Arrays.asList(new MaterialStack(Steel, 1), new MaterialStack(Tungsten, 1))).disableAutoGeneratedBlastFurnaceRecipes(); - public static Materials NitroCoalFuel = new Materials( -1, TextureSet.SET_FLUID , 1.0F, 0, 2, 16 , 50, 70, 50, 0, "NitroCoalFuel" , "Nitro-Coalfuel" , 0, 48, -1, 0, false, false, 1, 1, 1, Dyes.dyeBlack , 0, Arrays.asList(new MaterialStack(Glyceryl, 1), new MaterialStack(CoalFuel, 4))); - public static Materials NitroFuel = new Materials( 709, TextureSet.SET_FLUID , 1.0F, 0, 2, 16 , 200, 255, 0, 0, "NitroFuel" , "Cetane-Boosted Diesel" , 0, 1000, -1, 0, false, false, 1, 1, 1, Dyes.dyeLime ); - public static Materials RedAlloy = new Materials( 308, TextureSet.SET_DULL , 1.0F, 0, 0, 1|2 , 200, 0, 0, 0, "RedAlloy" , "Red Alloy" , 0, 0, 500, 0, false, false, 3, 5, 1, Dyes.dyeRed , 2, Arrays.asList(new MaterialStack(Copper, 1), new MaterialStack(Redstone, 4)), Collections.singletonList(new TC_AspectStack(TC_Aspects.MACHINA, 3))); - public static Materials CobaltBrass = new Materials( 343, TextureSet.SET_METALLIC , 8.0F, 256, 2, 1|2 |64|128 , 180, 180, 160, 0, "CobaltBrass" , "Cobalt Brass" , 0, 0, -1, 0, false, false, 3, 1, 1, Dyes.dyeOrange , 2, Arrays.asList(new MaterialStack(Brass, 7), new MaterialStack(Aluminium, 1), new MaterialStack(Cobalt, 1))); - public static Materials TricalciumPhosphate = new Materials( 534, TextureSet.SET_FLINT , 1.0F, 0, 2, 1|4|8|16 , 255, 255, 0, 0, "TricalciumPhosphate" , "Tricalcium Phosphate" , 0, 0, -1, 0, false, false, 3, 1, 1, Dyes.dyeYellow , 2, Arrays.asList(new MaterialStack(Calcium, 3), new MaterialStack(Phosphate, 2))); - public static Materials Basalt = new Materials( 844, TextureSet.SET_ROUGH , 1.0F, 64, 1, 1 |64|128 , 30, 20, 20, 0, "Basalt" , "Basalt" , 0, 0, -1, 0, false, false, 2, 1, 1, Dyes.dyeBlack , 2, Arrays.asList(new MaterialStack(Olivine, 1), new MaterialStack(Calcite, 3), new MaterialStack(Flint, 8), new MaterialStack(DarkAsh, 4)), Collections.singletonList(new TC_AspectStack(TC_Aspects.TENEBRAE, 1))); - public static Materials GarnetRed = new Materials( 527, TextureSet.SET_RUBY , 7.0F, 128, 2, 1 |4|8 |64 , 200, 80, 80, 127, "GarnetRed" , "Red Garnet" , 0, 0, -1, 0, false, true, 4, 1, 1, Dyes.dyeRed , 2, Arrays.asList(new MaterialStack(Pyrope, 3), new MaterialStack(Almandine, 5), new MaterialStack(Spessartine, 8)), Collections.singletonList(new TC_AspectStack(TC_Aspects.VITREUS, 3))); - public static Materials GarnetYellow = new Materials( 528, TextureSet.SET_RUBY , 7.0F, 128, 2, 1 |4|8 |64 , 200, 200, 80, 127, "GarnetYellow" , "Yellow Garnet" , 0, 0, -1, 0, false, true, 4, 1, 1, Dyes.dyeYellow , 2, Arrays.asList(new MaterialStack(Andradite, 5), new MaterialStack(Grossular, 8), new MaterialStack(Uvarovite, 3)), Collections.singletonList(new TC_AspectStack(TC_Aspects.VITREUS, 3))); - public static Materials Marble = new Materials( 845, TextureSet.SET_FINE , 1.0F, 16, 1, 1 |64|128 , 200, 200, 200, 0, "Marble" , "Marble" , 0, 0, -1, 0, false, false, 1, 1, 1, Dyes.dyeWhite , 2, Arrays.asList(new MaterialStack(Magnesium, 1), new MaterialStack(Calcite, 7)), Collections.singletonList(new TC_AspectStack(TC_Aspects.PERFODIO, 1))); - public static Materials Sugar = new Materials( 803, TextureSet.SET_FINE , 1.0F, 0, 1, 1 , 250, 250, 250, 0, "Sugar" , "Sugar" , 0, 0, -1, 0, false, false, 1, 1, 1, Dyes.dyeWhite , 1, Arrays.asList(new MaterialStack(Carbon, 2), new MaterialStack(Water, 5), new MaterialStack(Oxygen, 25)), Arrays.asList(new TC_AspectStack(TC_Aspects.HERBA, 1), new TC_AspectStack(TC_Aspects.AQUA, 1), new TC_AspectStack(TC_Aspects.AER, 1))); - public static Materials Thaumium = new Materials( 330, TextureSet.SET_METALLIC , 12.0F, 256, 3, 1|2 |64|128 , 150, 100, 200, 0, "Thaumium" , "Thaumium" , 0, 0, -1, 0, false, false, 5, 2, 1, Dyes.dyePurple , 0, Arrays.asList(new MaterialStack(Iron, 1), new MaterialStack(Magic, 1)), Arrays.asList(new TC_AspectStack(TC_Aspects.METALLUM, 2), new TC_AspectStack(TC_Aspects.PRAECANTATIO, 1))); - public static Materials Vinteum = new Materials( 529, TextureSet.SET_METALLIC , 10.0F, 128, 3, 1|2 |8 |64|128 , 100, 200, 255, 0, "Vinteum" , "Vinteum" , 5, 32, -1, 0, false, false, 4, 1, 1, Dyes.dyeLightBlue , 2, Collections.singletonList(new MaterialStack(Thaumium, 1)), Arrays.asList(new TC_AspectStack(TC_Aspects.VITREUS, 2), new TC_AspectStack(TC_Aspects.PRAECANTATIO, 1))); - public static Materials Vis = new Materials( -1, TextureSet.SET_SHINY , 1.0F, 0, 3, 0 , 128, 0, 255, 0, "Vis" , "Vis" , 5, 32, -1, 0, false, false, 1, 1, 1, Dyes.dyePurple , 2, Collections.singletonList(new MaterialStack(Magic, 1)), Arrays.asList(new TC_AspectStack(TC_Aspects.AURAM, 2), new TC_AspectStack(TC_Aspects.PRAECANTATIO, 1))); - public static Materials Redrock = new Materials( 846, TextureSet.SET_ROUGH , 1.0F, 0, 1, 1 , 255, 80, 50, 0, "Redrock" , "Redrock" , 0, 0, -1, 0, false, false, 1, 1, 1, Dyes.dyeRed , 2, Arrays.asList(new MaterialStack(Calcite, 2), new MaterialStack(Flint, 1), new MaterialStack(Clay, 1))); - public static Materials PotassiumFeldspar = new Materials( 847, TextureSet.SET_FINE , 1.0F, 0, 1, 1 , 120, 40, 40, 0, "PotassiumFeldspar" , "Potassium Feldspar" , 0, 0, -1, 0, false, false, 1, 1, 1, Dyes.dyePink , 1, Arrays.asList(new MaterialStack(Potassium, 1), new MaterialStack(Aluminium, 1), new MaterialStack(Silicon, 3), new MaterialStack(Oxygen, 8))); - public static Materials Biotite = new Materials( 848, TextureSet.SET_METALLIC , 1.0F, 0, 1, 1 , 20, 30, 20, 0, "Biotite" , "Biotite" , 0, 0, -1, 0, false, false, 1, 1, 1, Dyes.dyeGray , 1, Arrays.asList(new MaterialStack(Potassium, 1), new MaterialStack(Magnesium, 3), new MaterialStack(Aluminium, 3), new MaterialStack(Fluorine, 2), new MaterialStack(Silicon, 3), new MaterialStack(Oxygen, 10))); - public static Materials GraniteBlack = new Materials( 849, TextureSet.SET_ROUGH , 4.0F, 64, 3, 1 |64|128 , 10, 10, 10, 0, "GraniteBlack" , "Black Granite" , 0, 0, -1, 0, false, false, 0, 1, 1, Dyes.dyeBlack , 2, Arrays.asList(new MaterialStack(SiliconDioxide, 4), new MaterialStack(Biotite, 1)), Collections.singletonList(new TC_AspectStack(TC_Aspects.TUTAMEN, 1))); - public static Materials GraniteRed = new Materials( 850, TextureSet.SET_ROUGH , 4.0F, 64, 3, 1 |64|128 , 255, 0, 128, 0, "GraniteRed" , "Red Granite" , 0, 0, -1, 0, false, false, 0, 1, 1, Dyes.dyeMagenta , 1, Arrays.asList(new MaterialStack(Aluminium, 2), new MaterialStack(PotassiumFeldspar, 1), new MaterialStack(Oxygen, 3)), Collections.singletonList(new TC_AspectStack(TC_Aspects.TUTAMEN, 1))); - public static Materials Chrysotile = new Materials( 912, TextureSet.SET_DULL , 32.0F, 10240, 3, 1|2 |8 |64|128 , 110, 140, 110, 0, "Chrysotile" , "Chrysotile" , 0, 0, -1, 0, false, false, 1, 1, 1, Dyes.dyeWhite , 2, Collections.singletonList(new MaterialStack(Asbestos, 1))).disableAutoGeneratedBlastFurnaceRecipes().setTurbineMultipliers(280, 280, 1); - public static Materials Realgar = new Materials( 913, TextureSet.SET_DULL , 1.0F, 32, 1, 1|2 |8 |64|128 , 140, 100, 100, 0, "Realgar" , "Realgar" , 0, 0, -1, 0, false, false, 1, 1, 1, Dyes.dyeWhite , 2, Arrays.asList(new MaterialStack(Arsenic, 4), new MaterialStack(Sulfur,4))); - public static Materials VanadiumMagnetite = new Materials( 923, TextureSet.SET_METALLIC , 1.0F, 0, 2, 1 |8 , 35, 35, 60, 0, "VanadiumMagnetite" , "Vanadium Magnetite" , 0, 0, -1, 0, false, false, 1, 1, 1, Dyes.dyeBlack , 2, Arrays.asList(new MaterialStack(Magnetite, 1), new MaterialStack(Vanadium, 1)), Arrays.asList(new TC_AspectStack(TC_Aspects.METALLUM, 2), new TC_AspectStack(TC_Aspects.MAGNETO, 1))); // Mixture of Fe3O4 and V2O5 - public static Materials BasalticMineralSand = new Materials( 935, TextureSet.SET_SAND , 1.0F, 0, 1, 1 |8 , 40, 50, 40, 0, "BasalticMineralSand" , "Basaltic Mineral Sand" , 0, 0, -1, 0, false, false, 1, 1, 1, Dyes.dyeBlack , 2, Arrays.asList(new MaterialStack(Magnetite, 1), new MaterialStack(Basalt, 1)), Arrays.asList(new TC_AspectStack(TC_Aspects.METALLUM, 2), new TC_AspectStack(TC_Aspects.MAGNETO, 1))); - public static Materials GraniticMineralSand = new Materials( 936, TextureSet.SET_SAND , 1.0F, 0, 1, 1 |8 , 40, 60, 60, 0, "GraniticMineralSand" , "Granitic Mineral Sand" , 0, 0, -1, 0, false, false, 1, 1, 1, Dyes.dyeBlack , 2, Arrays.asList(new MaterialStack(Magnetite, 1), new MaterialStack(GraniteBlack, 1)), Arrays.asList(new TC_AspectStack(TC_Aspects.METALLUM, 2), new TC_AspectStack(TC_Aspects.MAGNETO, 1))); - public static Materials GarnetSand = new Materials( 938, TextureSet.SET_SAND , 1.0F, 0, 1, 1 |8 , 200, 100, 0, 0, "GarnetSand" , "Garnet Sand" , 0, 0, -1, 0, false, false, 1, 1, 1, Dyes.dyeOrange , 2, Arrays.asList(new MaterialStack(GarnetRed, 1), new MaterialStack(GarnetYellow, 1))); - public static Materials QuartzSand = new Materials( 939, TextureSet.SET_SAND , 1.0F, 0, 1, 1 |8 , 194, 178, 128, 0, "QuartzSand" , "Quartz Sand" , 0, 0, -1, 0, false, false, 1, 1, 1, Dyes.dyeWhite , 2, Arrays.asList(new MaterialStack(CertusQuartz, 1), new MaterialStack(Quartzite, 1))); - public static Materials Bastnasite = new Materials( 905, TextureSet.SET_FINE , 1.0F, 0, 2, 1 |8 , 200, 110, 45, 0, "Bastnasite" , "Bastnasite" , 0, 0, -1, 0, false, false, 1, 1, 1, Dyes._NULL , 1, Arrays.asList(new MaterialStack(Cerium, 1), new MaterialStack(Carbon, 1), new MaterialStack(Fluorine, 1), new MaterialStack(Oxygen, 3))); // (Ce, La, Y)CO3F - public static Materials Pentlandite = new Materials( 909, TextureSet.SET_DULL , 1.0F, 0, 2, 1 |8 , 165, 150, 5, 0, "Pentlandite" , "Pentlandite" , 0, 0, -1, 0, false, false, 1, 1, 1, Dyes._NULL , 1, Arrays.asList(new MaterialStack(Nickel, 9), new MaterialStack(Sulfur, 8))); // (Fe,Ni)9S8 - public static Materials Spodumene = new Materials( 920, TextureSet.SET_DULL , 1.0F, 0, 2, 1 |8 , 190, 170, 170, 0, "Spodumene" , "Spodumene" , 0, 0, -1, 0, false, false, 1, 1, 1, Dyes._NULL , 1, Arrays.asList(new MaterialStack(Lithium, 1), new MaterialStack(Aluminium, 1), new MaterialStack(Silicon, 2), new MaterialStack(Oxygen, 6))); // LiAl(SiO3)2 - public static Materials Pollucite = new Materials( 919, TextureSet.SET_DULL , 1.0F, 0, 2, 1 |8 , 240, 210, 210, 0, "Pollucite" , "Pollucite" , 0, 0, -1, 0, false, false, 1, 1, 1, Dyes._NULL , 1, Arrays.asList(new MaterialStack(Caesium, 2), new MaterialStack(Aluminium, 2), new MaterialStack(Silicon, 4), new MaterialStack(Water, 2), new MaterialStack(Oxygen, 12))); // (Cs,Na)2Al2Si4O12 2H2O (also a source of Rb) - public static Materials Tantalite = new Materials( 921, TextureSet.SET_METALLIC , 1.0F, 0, 3, 1 |8 , 145, 80, 40, 0, "Tantalite" , "Tantalite" , 0, 0, -1, 0, false, false, 1, 1, 1, Dyes._NULL , 1, Arrays.asList(new MaterialStack(Manganese, 1), new MaterialStack(Tantalum, 2), new MaterialStack(Oxygen, 6))); // (Fe, Mn)Ta2O6 (also source of Nb) - public static Materials Lepidolite = new Materials( 907, TextureSet.SET_FINE , 1.0F, 0, 2, 1 |8 , 240, 50, 140, 0, "Lepidolite" , "Lepidolite" , 0, 0, -1, 0, false, false, 1, 1, 1, Dyes._NULL , 1, Arrays.asList(new MaterialStack(Potassium, 1), new MaterialStack(Lithium, 3), new MaterialStack(Aluminium, 4), new MaterialStack(Fluorine, 2), new MaterialStack(Oxygen, 10))); // K(Li,Al,Rb)3(Al,Si)4O10(F,OH)2 - public static Materials Glauconite = new Materials( 933, TextureSet.SET_DULL , 1.0F, 0, 2, 1 |8 , 130, 180, 60, 0, "Glauconite" , "Glauconite" , 0, 0, -1, 0, false, false, 1, 1, 1, Dyes._NULL , 1, Arrays.asList(new MaterialStack(Potassium, 1), new MaterialStack(Magnesium, 2), new MaterialStack(Aluminium, 4), new MaterialStack(Hydrogen, 2), new MaterialStack(Oxygen, 12))); // (K,Na)(Fe3+,Al,Mg)2(Si,Al)4O10(OH)2 - public static Materials GlauconiteSand = new Materials( 949, TextureSet.SET_DULL , 1.0F, 0, 2, 1 |8 , 130, 180, 60, 0, "GlauconiteSand" , "Glauconite Sand" , 0, 0, -1, 0, false, false, 1, 1, 1, Dyes._NULL , 1, Arrays.asList(new MaterialStack(Potassium, 1), new MaterialStack(Magnesium, 2), new MaterialStack(Aluminium, 4), new MaterialStack(Hydrogen, 2), new MaterialStack(Oxygen, 12))); // (K,Na)(Fe3+,Al,Mg)2(Si,Al)4O10(OH)2 - public static Materials Vermiculite = new Materials( 932, TextureSet.SET_METALLIC , 1.0F, 0, 2, 1 |8 , 200, 180, 15, 0, "Vermiculite" , "Vermiculite" , 0, 0, -1, 0, false, false, 1, 1, 1, Dyes._NULL , 1, Arrays.asList(new MaterialStack(Iron, 3), new MaterialStack(Aluminium, 4), new MaterialStack(Silicon, 4), new MaterialStack(Hydrogen, 2), new MaterialStack(Water, 4), new MaterialStack(Oxygen, 12))); // (Mg+2, Fe+2, Fe+3)3 [(AlSi)4O10] (OH)2 4H2O) - public static Materials Bentonite = new Materials( 927, TextureSet.SET_ROUGH , 1.0F, 0, 2, 1 |8 , 245, 215, 210, 0, "Bentonite" , "Bentonite" , 0, 0, -1, 0, false, false, 1, 1, 1, Dyes._NULL , 1, Arrays.asList(new MaterialStack(Sodium, 1), new MaterialStack(Magnesium, 6), new MaterialStack(Silicon, 12), new MaterialStack(Hydrogen, 6), new MaterialStack(Water, 5), new MaterialStack(Oxygen, 36))); // (Na,Ca)0.33(Al,Mg)2(Si4O10)(OH)2 nH2O - public static Materials FullersEarth = new Materials( 928, TextureSet.SET_FINE , 1.0F, 0, 2, 1 |8 , 160, 160, 120, 0, "FullersEarth" , "Fullers Earth" , 0, 0, -1, 0, false, false, 1, 1, 1, Dyes._NULL , 1, Arrays.asList(new MaterialStack(Magnesium, 1), new MaterialStack(Silicon, 4), new MaterialStack(Hydrogen, 1), new MaterialStack(Water, 4), new MaterialStack(Oxygen, 11))); // (Mg,Al)2Si4O10(OH) 4(H2O) - public static Materials Pitchblende = new Materials( 873, TextureSet.SET_DULL , 1.0F, 0, 3, 1 |8 , 200, 210, 0, 0, "Pitchblende" , "Pitchblende" , 0, 0, -1, 0, false, false, 5, 1, 1, Dyes.dyeYellow , 2, Arrays.asList(new MaterialStack(Uraninite, 3), new MaterialStack(Thorium, 1), new MaterialStack(Lead, 1))); - public static Materials Monazite = new Materials( 520, TextureSet.SET_DIAMOND , 1.0F, 0, 1, 1 |4|8 , 50, 70, 50, 0, "Monazite" , "Monazite" , 0, 0, -1, 0, false, false, 3, 1, 1, Dyes.dyeGreen , 1, Arrays.asList(new MaterialStack(RareEarth, 1), new MaterialStack(Phosphate, 1))); // Wikipedia: (Ce, La, Nd, Th, Sm, Gd)PO4 Monazite also smelt-extract to Helium, it is brown like the rare earth Item Monazite sand deposits are inevitably of the monazite-(Ce) composition. Typically, the lanthanides in such monazites contain about 45.8% cerium, about 24% lanthanum, about 17% neodymium, about 5% praseodymium, and minor quantities of samarium, gadolinium, and yttrium. Europium concentrations tend to be low, about 0.05% Thorium content of monazite is variable. - public static Materials Malachite = new Materials( 871, TextureSet.SET_DULL , 1.0F, 0, 1, 1 |8 , 5, 95, 5, 0, "Malachite" , "Malachite" , 0, 0, -1, 0, false, false, 3, 1, 1, Dyes.dyeGreen , 1, Arrays.asList(new MaterialStack(Copper, 2), new MaterialStack(Carbon, 1), new MaterialStack(Hydrogen, 2), new MaterialStack(Oxygen, 5))); // Cu2CO3(OH)2 - public static Materials Mirabilite = new Materials( 900, TextureSet.SET_DULL , 1.0F, 0, 2, 1 |8 , 240, 250, 210, 0, "Mirabilite" , "Mirabilite" , 0, 0, -1, 0, false, false, 1, 1, 1, Dyes._NULL , 1, Arrays.asList(new MaterialStack(Sodium, 2), new MaterialStack(Sulfur, 1), new MaterialStack(Water, 10), new MaterialStack(Oxygen, 4))); // Na2SO4 10H2O - public static Materials Mica = new Materials( 901, TextureSet.SET_FINE , 1.0F, 0, 1, 1 |8 , 195, 195, 205, 0, "Mica" , "Mica" , 0, 0, -1, 0, false, false, 1, 1, 1, Dyes._NULL , 1, Arrays.asList(new MaterialStack(Potassium, 1), new MaterialStack(Aluminium, 3), new MaterialStack(Silicon, 3), new MaterialStack(Fluorine, 2), new MaterialStack(Oxygen, 10))); // KAl2(AlSi3O10)(F,OH)2 - public static Materials Trona = new Materials( 903, TextureSet.SET_METALLIC , 1.0F, 0, 1, 1 |8 , 135, 135, 95, 0, "Trona" , "Trona" , 0, 0, -1, 0, false, false, 1, 1, 1, Dyes._NULL , 1, Arrays.asList(new MaterialStack(Sodium, 3), new MaterialStack(Carbon, 2), new MaterialStack(Hydrogen, 1), new MaterialStack(Water, 2), new MaterialStack(Oxygen, 6))); // Na3(CO3)(HCO3) 2H2O - public static Materials Barite = new Materials( 904, TextureSet.SET_DULL , 1.0F, 0, 2, 1 |8 , 230, 235, 255, 0, "Barite" , "Barite" , 0, 0, -1, 0, false, false, 1, 1, 1, Dyes._NULL , 1, Arrays.asList(new MaterialStack(Barium, 1), new MaterialStack(Sulfur, 1), new MaterialStack(Oxygen, 4))); - public static Materials Gypsum = new Materials( 934, TextureSet.SET_DULL , 1.0F, 0, 1, 1 |8 , 230, 230, 250, 0, "Gypsum" , "Gypsum" , 0, 0, -1, 0, false, false, 1, 1, 1, Dyes._NULL , 1, Arrays.asList(new MaterialStack(Calcium, 1), new MaterialStack(Sulfur, 1), new MaterialStack(Oxygen, 4), new MaterialStack(Water, 2))); // CaSO4 2H2O - public static Materials Alunite = new Materials( 911, TextureSet.SET_METALLIC , 1.0F, 0, 2, 1 |8 , 225, 180, 65, 0, "Alunite" , "Alunite" , 0, 0, -1, 0, false, false, 1, 1, 1, Dyes._NULL , 1, Arrays.asList(new MaterialStack(Potassium, 1), new MaterialStack(Aluminium, 3), new MaterialStack(Silicon, 2), new MaterialStack(Hydrogen, 6), new MaterialStack(Oxygen, 14))); // KAl3(SO4)2(OH)6 - public static Materials Dolomite = new Materials( 914, TextureSet.SET_FLINT , 1.0F, 0, 1, 1 |8 , 225, 205, 205, 0, "Dolomite" , "Dolomite" , 0, 0, -1, 0, false, false, 1, 1, 1, Dyes._NULL , 1, Arrays.asList(new MaterialStack(Calcium, 1), new MaterialStack(Magnesium, 1), new MaterialStack(Carbon, 2), new MaterialStack(Oxygen, 6))); // CaMg(CO3)2 - public static Materials Wollastonite = new Materials( 915, TextureSet.SET_DULL , 1.0F, 0, 2, 1 |8 , 240, 240, 240, 0, "Wollastonite" , "Wollastonite" , 0, 0, -1, 0, false, false, 1, 1, 1, Dyes._NULL , 1, Arrays.asList(new MaterialStack(Calcium, 1), new MaterialStack(Silicon, 1), new MaterialStack(Oxygen, 3))); // CaSiO3 - public static Materials Zeolite = new Materials( 916, TextureSet.SET_DULL , 1.0F, 0, 2, 1 |8 , 240, 230, 230, 0, "Zeolite" , "Zeolite" , 0, 0, -1, 0, false, false, 1, 1, 1, Dyes._NULL , 1, Arrays.asList(new MaterialStack(Sodium, 1), new MaterialStack(Calcium, 4), new MaterialStack(Silicon, 27), new MaterialStack(Aluminium, 9), new MaterialStack(Water, 28), new MaterialStack(Oxygen, 72))); // NaCa4(Si27Al9)O72 28(H2O) - public static Materials Kyanite = new Materials( 924, TextureSet.SET_FLINT , 1.0F, 0, 2, 1 |8 , 110, 110, 250, 0, "Kyanite" , "Kyanite" , 0, 0, -1, 0, false, false, 1, 1, 1, Dyes._NULL , 1, Arrays.asList(new MaterialStack(Aluminium, 2), new MaterialStack(Silicon, 1), new MaterialStack(Oxygen, 5))); // Al2SiO5 - public static Materials Kaolinite = new Materials( 929, TextureSet.SET_DULL , 1.0F, 0, 2, 1 |8 , 245, 235, 235, 0, "Kaolinite" , "Kaolinite" , 0, 0, -1, 0, false, false, 1, 1, 1, Dyes._NULL , 1, Arrays.asList(new MaterialStack(Aluminium, 2), new MaterialStack(Silicon, 2), new MaterialStack(Hydrogen, 4), new MaterialStack(Oxygen, 9))); // Al2Si2O5(OH)4 - public static Materials Talc = new Materials( 902, TextureSet.SET_DULL , 1.0F, 0, 2, 1 |8 , 90, 180, 90, 0, "Talc" , "Talc" , 0, 0, -1, 0, false, false, 1, 1, 1, Dyes._NULL , 1, Arrays.asList(new MaterialStack(Magnesium, 3), new MaterialStack(Silicon, 4), new MaterialStack(Hydrogen, 2), new MaterialStack(Oxygen, 12))); // H2Mg3(SiO3)4 - public static Materials Soapstone = new Materials( 877, TextureSet.SET_DULL , 1.0F, 0, 1, 1 |8 , 95, 145, 95, 0, "Soapstone" , "Soapstone" , 0, 0, -1, 0, false, false, 1, 1, 1, Dyes._NULL , 1, Arrays.asList(new MaterialStack(Magnesium, 3), new MaterialStack(Silicon, 4), new MaterialStack(Hydrogen, 2), new MaterialStack(Oxygen, 12))); // H2Mg3(SiO3)4 - public static Materials Concrete = new Materials( 947, TextureSet.SET_ROUGH , 1.0F, 0, 1, 1 , 100, 100, 100, 0, "Concrete" , "Concrete" , 0, 0, 300, 0, false, false, 0, 1, 1, Dyes.dyeGray , 0, Collections.singletonList(new MaterialStack(Stone, 1)), Collections.singletonList(new TC_AspectStack(TC_Aspects.TERRA, 1))); - public static Materials IronMagnetic = new Materials( 354, TextureSet.SET_MAGNETIC , 6.0F, 256, 2, 1|2 |64|128 , 200, 200, 200, 0, "IronMagnetic" , "Magnetic Iron" , 0, 0, -1, 0, false, false, 4, 51, 50, Dyes.dyeGray , 1, Collections.singletonList(new MaterialStack(Iron, 1)), Arrays.asList(new TC_AspectStack(TC_Aspects.METALLUM, 2), new TC_AspectStack(TC_Aspects.MAGNETO, 1))); - public static Materials SteelMagnetic = new Materials( 355, TextureSet.SET_MAGNETIC , 6.0F, 512, 3, 1|2 |64|128 , 128, 128, 128, 0, "SteelMagnetic" , "Magnetic Steel" , 0, 0, 1000, 1000, true, false, 4, 51, 50, Dyes.dyeGray , 1, Collections.singletonList(new MaterialStack(Steel, 1)), Arrays.asList(new TC_AspectStack(TC_Aspects.METALLUM, 1), new TC_AspectStack(TC_Aspects.ORDO, 1), new TC_AspectStack(TC_Aspects.MAGNETO, 1))); - public static Materials NeodymiumMagnetic = new Materials( 356, TextureSet.SET_MAGNETIC , 7.0F, 512, 2, 1|2 |64|128 , 100, 100, 100, 0, "NeodymiumMagnetic" , "Magnetic Neodymium" , 0, 0, 1297, 1297, true, false, 4, 51, 50, Dyes.dyeGray , 1, Collections.singletonList(new MaterialStack(Neodymium, 1)), Arrays.asList(new TC_AspectStack(TC_Aspects.METALLUM, 1), new TC_AspectStack(TC_Aspects.MAGNETO, 3))); - public static Materials SamariumMagnetic = new Materials( 399, TextureSet.SET_MAGNETIC , 1.0F, 0, 2, 1|2 |64|128 , 255, 255, 204, 0, "SamariumMagnetic" , "Magnetic Samarium" , 0, 0, 1345, 1345, true, false, 4, 1, 1, Dyes.dyeWhite , 1, Collections.singletonList(new MaterialStack(Samarium, 1)),Arrays.asList(new TC_AspectStack(TC_Aspects.METALLUM, 2), new TC_AspectStack(TC_Aspects.RADIO, 1), new TC_AspectStack(TC_Aspects.MAGNETO,10))); - public static Materials TungstenCarbide = new Materials( 370, TextureSet.SET_METALLIC , 14.0F, 1280, 4, 1|2 |64|128 , 51, 0, 102, 0, "TungstenCarbide" , "Tungstencarbide" , 0, 0, 2460, 2460, true, false, 4, 1, 1, Dyes.dyeBlack , 2, Arrays.asList(new MaterialStack(Tungsten, 1), new MaterialStack(Carbon, 1))); - public static Materials VanadiumSteel = new Materials( 371, TextureSet.SET_METALLIC , 3.0F, 1920, 3, 1|2 |64|128 , 192, 192, 192, 0, "VanadiumSteel" , "Vanadiumsteel" , 0, 0, 1453, 1453, true, false, 4, 1, 1, Dyes.dyeWhite , 2, Arrays.asList(new MaterialStack(Vanadium, 1), new MaterialStack(Chrome, 1), new MaterialStack(Steel, 7))).disableAutoGeneratedBlastFurnaceRecipes(); - public static Materials HSSG = new Materials( 372, TextureSet.SET_METALLIC , 10.0F, 4000, 3, 1|2 |64|128 , 153, 153, 0, 0, "HSSG" , "HSS-G" , 0, 0, 4500, 4500, true, false, 4, 1, 1, Dyes.dyeYellow , 2, Arrays.asList(new MaterialStack(TungstenSteel, 5), new MaterialStack(Chrome, 1), new MaterialStack(Molybdenum, 2), new MaterialStack(Vanadium, 1))).disableAutoGeneratedBlastFurnaceRecipes(); - public static Materials HSSE = new Materials( 373, TextureSet.SET_METALLIC , 32.0F, 10240, 7, 1|2 |64|128 , 51, 102, 0, 0, "HSSE" , "HSS-E" , 0, 0, 5400, 5400, true, false, 4, 1, 1, Dyes.dyeGreen , 2, Arrays.asList(new MaterialStack(HSSG, 6), new MaterialStack(Cobalt, 1),new MaterialStack(Manganese, 1), new MaterialStack(Silicon, 1))).disableAutoGeneratedBlastFurnaceRecipes(); - public static Materials HSSS = new Materials( 374, TextureSet.SET_METALLIC , 32.0F, 10240, 8, 1|2 |64|128 , 102, 0, 51, 0, "HSSS" , "HSS-S" , 0, 0, 5400, 5400, true, false, 4, 1, 1, Dyes.dyeRed , 2, Arrays.asList(new MaterialStack(HSSG, 6), new MaterialStack(Iridium, 2), new MaterialStack(Osmium, 1))).disableAutoGeneratedBlastFurnaceRecipes(); - public static Materials DilutedSulfuricAcid = new MaterialBuilder(640, TextureSet.SET_FLUID , "Diluted Sulfuric Acid").addCell().addFluid().setRGB(192, 120, 32).setColor(Dyes.dyeOrange).setMaterialList(new MaterialStack(SulfuricAcid, 1)).constructMaterial(); - public static Materials EpoxidFiberReinforced = new Materials( 610, TextureSet.SET_DULL ,3.0F, 64, 1, 1|2 |64|128 , 160, 112, 16, 0, "EpoxidFiberReinforced" , "Fiber-Reinforced Epoxy Resin" , 0, 0, 400, 0, false, false, 1, 1, 1, Dyes.dyeBrown , 2, Collections.singletonList(new MaterialStack(Epoxid, 1)), Collections.singletonList(new TC_AspectStack(TC_Aspects.MOTUS, 2))); - public static Materials SodiumCarbonate = new MaterialBuilder(695, TextureSet.SET_QUARTZ, "Sodium Carbonate").setToolSpeed(1.0F).setDurability(64).setToolQuality(1).addDustItems().setRGB(255, 255, 235).setColor(Dyes.dyeWhite).setBlastFurnaceTemp(851 ).setMeltingPoint(851 ).setBlastFurnaceRequired(false).setOreValue(1).setExtraData(1).setMaterialList(new MaterialStack(Sodium, 2), new MaterialStack(Carbon, 1), new MaterialStack(Oxygen, 3)).constructMaterial().disableAutoGeneratedBlastFurnaceRecipes(); - public static Materials SodiumAluminate = new MaterialBuilder(696, TextureSet.SET_QUARTZ, "Sodium Aluminate").setToolSpeed(1.0F).setDurability(64).setToolQuality(1).addDustItems().setRGB(255, 235, 255).setColor(Dyes.dyeWhite).setBlastFurnaceTemp(1800).setMeltingPoint(1800).setBlastFurnaceRequired(false).setOreValue(1).setExtraData(0).setMaterialList(new MaterialStack(Sodium, 1), new MaterialStack(Aluminium, 1), new MaterialStack(Oxygen, 2)).constructMaterial().disableAutoGeneratedBlastFurnaceRecipes(); - public static Materials Aluminiumoxide = new MaterialBuilder(697, TextureSet.SET_QUARTZ, "Alumina").setToolSpeed(1.0F).setDurability(64).setToolQuality(1).addDustItems().setRGB(235, 255, 255).setColor(Dyes.dyeWhite).setBlastFurnaceTemp(2054).setMeltingPoint(2054).setBlastFurnaceRequired(true).setOreValue(1).setExtraData(0).setMaterialList(new MaterialStack(Aluminium, 2), new MaterialStack(Oxygen, 3)).setAspects(Collections.singletonList(new TC_AspectStack(TC_Aspects.GELUM, 2))).constructMaterial().disableAutoGeneratedBlastFurnaceRecipes(); - public static Materials Aluminiumhydroxide = new MaterialBuilder(698, TextureSet.SET_QUARTZ, "Aluminium Hydroxide").setToolSpeed(1.0F).setDurability(64).setToolQuality(1).addDustItems().setRGB(235, 235, 255).setColor(Dyes.dyeWhite).setBlastFurnaceTemp(1200).setMeltingPoint(1200).setBlastFurnaceRequired(true).setOreValue(1).setExtraData(0).setMaterialList(new MaterialStack(Aluminium, 1), new MaterialStack(Oxygen, 3), new MaterialStack(Hydrogen, 3)).setAspects(Collections.singletonList(new TC_AspectStack(TC_Aspects.GELUM, 2))).constructMaterial().disableAutoGeneratedBlastFurnaceRecipes(); - public static Materials Cryolite = new MaterialBuilder(699, TextureSet.SET_QUARTZ, "Cryolite").setToolSpeed(1.0F).setDurability(64).setToolQuality(1).addOreItems().setRGB(191, 239, 255).setColor(Dyes.dyeLightBlue).setMeltingPoint(1012).setBlastFurnaceTemp(1012).setExtraData(1).setMaterialList(new MaterialStack(Sodium, 3), new MaterialStack(Aluminium, 1), new MaterialStack(Fluorine, 6)).constructMaterial().disableAutoGeneratedBlastFurnaceRecipes(); - public static Materials RedMud = new MaterialBuilder(743, TextureSet.SET_FLUID, "Red Mud").addCell().addFluid().setRGB(140, 22, 22).setColor(Dyes.dyeRed).constructMaterial(); - - public static Materials Brick = new MaterialBuilder(625, TextureSet.SET_ROUGH , "Brick").addDustItems().setRGB(155, 86, 67).setColor(Dyes.dyeBrown).setExtraData(2).setMaterialList(new MaterialStack(Aluminium, 4), new MaterialStack(Silicon, 3), new MaterialStack(Oxygen, 6)).constructMaterial(); - public static Materials Fireclay = new MaterialBuilder(626, TextureSet.SET_ROUGH , "Fireclay").addDustItems().setRGB(173, 160, 155).setExtraData(2).setColor(Dyes.dyeBrown).setMaterialList(new MaterialStack(Brick, 1)).constructMaterial(); + public static Materials WoodSealed = new Materials( + 889, + TextureSet.SET_WOOD, + 3.0F, + 24, + 0, + 1 | 2 | 64 | 128, + 80, + 40, + 0, + 0, + "WoodSealed", + "Sealed Wood", + 0, + 0, + -1, + 0, + false, + false, + 1, + 1, + 1, + Dyes.dyeBrown, + 0, + Collections.singletonList(new MaterialStack(Wood, 1)), + Arrays.asList(new TC_AspectStack(TC_Aspects.ARBOR, 2), new TC_AspectStack(TC_Aspects.FABRICO, 1))); + + public static Materials LiveRoot = new Materials( + 832, + TextureSet.SET_WOOD, + 1.0F, + 0, + 1, + 1, + 220, + 200, + 0, + 0, + "LiveRoot", + "Liveroot", + 5, + 16, + -1, + 0, + false, + false, + 2, + 4, + 3, + Dyes.dyeBrown, + 2, + Arrays.asList(new MaterialStack(Wood, 3), new MaterialStack(Magic, 1)), + Arrays.asList( + new TC_AspectStack(TC_Aspects.ARBOR, 2), + new TC_AspectStack(TC_Aspects.VICTUS, 2), + new TC_AspectStack(TC_Aspects.PRAECANTATIO, 1))); + public static Materials IronWood = new Materials( + 338, + TextureSet.SET_WOOD, + 6.0F, + 384, + 2, + 1 | 2 | 64 | 128, + 150, + 140, + 110, + 0, + "IronWood", + "Ironwood", + 5, + 8, + -1, + 0, + false, + false, + 2, + 19, + 18, + Dyes.dyeBrown, + 2, + Arrays.asList(new MaterialStack(Iron, 9), new MaterialStack(LiveRoot, 9), new MaterialStack(Gold, 1))); + public static Materials Glass = new Materials( + 890, + TextureSet.SET_GLASS, + 1.0F, + 4, + 0, + 1 | 4, + 250, + 250, + 250, + 220, + "Glass", + "Glass", + 0, + 0, + 1500, + 0, + false, + true, + 1, + 1, + 1, + Dyes.dyeWhite, + 2, + Collections.singletonList(new MaterialStack(SiliconDioxide, 1)), + Collections.singletonList(new TC_AspectStack(TC_Aspects.VITREUS, 2))); + public static Materials BorosilicateGlass = new MaterialBuilder(611, TextureSet.SET_GLASS, "Borosilicate Glass") + .addDustItems() + .addMetalItems() + .setRGB(230, 243, 230) + .setColor(Dyes.dyeWhite) + .setMaterialList(new MaterialStack(Boron, 1), new MaterialStack(Glass, 7)) + .addCentrifugeRecipe() + .constructMaterial(); + public static Materials Perlite = new Materials( + 925, + TextureSet.SET_DULL, + 1.0F, + 0, + 1, + 1 | 8, + 30, + 20, + 30, + 0, + "Perlite", + "Perlite", + 0, + 0, + -1, + 0, + false, + false, + 1, + 1, + 1, + Dyes.dyeBlack, + 2, + Arrays.asList(new MaterialStack(Obsidian, 2), new MaterialStack(Water, 1))); + public static Materials Borax = new Materials( + 941, + TextureSet.SET_FINE, + 1.0F, + 0, + 1, + 1 | 8, + 250, + 250, + 250, + 0, + "Borax", + "Borax", + 0, + 0, + -1, + 0, + false, + false, + 1, + 1, + 1, + Dyes.dyeWhite, + 1, + Arrays.asList( + new MaterialStack(Sodium, 2), + new MaterialStack(Boron, 4), + new MaterialStack(Oxygen, 7), + new MaterialStack(Water, 10))); + public static Materials Lignite = new Materials( + 538, + TextureSet.SET_LIGNITE, + 1.0F, + 0, + 0, + 1 | 4 | 8, + 100, + 70, + 70, + 0, + "Lignite", + "Lignite Coal", + 0, + 0, + -1, + 0, + false, + false, + 1, + 1, + 1, + Dyes.dyeBlack, + 1, + Arrays.asList(new MaterialStack(Carbon, 3), new MaterialStack(Water, 1))); + public static Materials Olivine = new Materials( + 505, + TextureSet.SET_RUBY, + 7.0F, + 256, + 2, + 1 | 4 | 8 | 64, + 150, + 255, + 150, + 127, + "Olivine", + "Olivine", + 0, + 0, + -1, + 0, + false, + true, + 5, + 1, + 1, + Dyes.dyeLime, + 1, + Arrays.asList( + new MaterialStack(Magnesium, 2), new MaterialStack(Iron, 1), new MaterialStack(SiliconDioxide, 2)), + Arrays.asList(new TC_AspectStack(TC_Aspects.LUCRUM, 4), new TC_AspectStack(TC_Aspects.VITREUS, 2))); + public static Materials Opal = new Materials( + 510, + TextureSet.SET_OPAL, + 7.0F, + 256, + 2, + 1 | 4 | 8 | 64, + 0, + 0, + 255, + 0, + "Opal", + "Opal", + 0, + 0, + -1, + 0, + false, + true, + 3, + 1, + 1, + Dyes.dyeBlue, + 1, + Collections.singletonList(new MaterialStack(SiliconDioxide, 1)), + Arrays.asList(new TC_AspectStack(TC_Aspects.LUCRUM, 5), new TC_AspectStack(TC_Aspects.VITREUS, 3))); + public static Materials Amethyst = new Materials( + 509, + TextureSet.SET_FLINT, + 7.0F, + 256, + 3, + 1 | 4 | 8 | 64, + 210, + 50, + 210, + 127, + "Amethyst", + "Amethyst", + 0, + 0, + -1, + 0, + false, + true, + 3, + 1, + 1, + Dyes.dyePink, + 1, + Arrays.asList(new MaterialStack(SiliconDioxide, 4), new MaterialStack(Iron, 1)), + Arrays.asList(new TC_AspectStack(TC_Aspects.LUCRUM, 6), new TC_AspectStack(TC_Aspects.VITREUS, 4))); + public static Materials Redstone = new Materials( + 810, + TextureSet.SET_ROUGH, + 1.0F, + 0, + 2, + 1 | 8, + 200, + 0, + 0, + 0, + "Redstone", + "Redstone", + 0, + 0, + 500, + 0, + false, + false, + 3, + 1, + 1, + Dyes.dyeRed, + 2, + Arrays.asList( + new MaterialStack(Silicon, 1), + new MaterialStack(Pyrite, 5), + new MaterialStack(Ruby, 1), + new MaterialStack(Mercury, 3)), + Arrays.asList(new TC_AspectStack(TC_Aspects.MACHINA, 1), new TC_AspectStack(TC_Aspects.POTENTIA, 2))); + public static Materials Lapis = new Materials( + 526, + TextureSet.SET_LAPIS, + 1.0F, + 0, + 1, + 1 | 4 | 8, + 70, + 70, + 220, + 0, + "Lapis", + "Lapis", + 0, + 0, + -1, + 0, + false, + false, + 3, + 1, + 1, + Dyes.dyeBlue, + 2, + Arrays.asList( + new MaterialStack(Lazurite, 12), + new MaterialStack(Sodalite, 2), + new MaterialStack(Pyrite, 1), + new MaterialStack(Calcite, 1)), + Collections.singletonList(new TC_AspectStack(TC_Aspects.SENSUS, 1))); + public static Materials Blaze = new Materials( + 801, + TextureSet.SET_POWDER, + 2.0F, + 16, + 1, + 1 | 64, + 255, + 200, + 0, + 0, + "Blaze", + "Blaze", + 0, + 0, + 6400, + 0, + false, + false, + 2, + 3, + 2, + Dyes.dyeYellow, + 2, + Arrays.asList(new MaterialStack(DarkAsh, 1), new MaterialStack(Sulfur, 1), new MaterialStack(Magic, 1)), + Arrays.asList(new TC_AspectStack(TC_Aspects.PRAECANTATIO, 2), new TC_AspectStack(TC_Aspects.IGNIS, 4))); + public static Materials EnderPearl = new Materials( + 532, + TextureSet.SET_SHINY, + 1.0F, + 16, + 1, + 1 | 4, + 108, + 220, + 200, + 0, + "EnderPearl", + "Enderpearl", + 0, + 0, + -1, + 0, + false, + false, + 1, + 16, + 10, + Dyes.dyeGreen, + 1, + Arrays.asList( + new MaterialStack(Beryllium, 1), + new MaterialStack(Potassium, 4), + new MaterialStack(Nitrogen, 5), + new MaterialStack(Magic, 6)), + Arrays.asList( + new TC_AspectStack(TC_Aspects.ALIENIS, 4), + new TC_AspectStack(TC_Aspects.ITER, 4), + new TC_AspectStack(TC_Aspects.PRAECANTATIO, 2))); + public static Materials EnderEye = new Materials( + 533, + TextureSet.SET_SHINY, + 1.0F, + 16, + 1, + 1 | 4, + 160, + 250, + 230, + 0, + "EnderEye", + "Endereye", + 5, + 10, + -1, + 0, + false, + false, + 1, + 2, + 1, + Dyes.dyeGreen, + 2, + Arrays.asList(new MaterialStack(EnderPearl, 1), new MaterialStack(Blaze, 1)), + Arrays.asList( + new TC_AspectStack(TC_Aspects.SENSUS, 4), + new TC_AspectStack(TC_Aspects.ALIENIS, 4), + new TC_AspectStack(TC_Aspects.ITER, 4), + new TC_AspectStack(TC_Aspects.PRAECANTATIO, 3), + new TC_AspectStack(TC_Aspects.IGNIS, 2))); + public static Materials Flint = new Materials( + 802, + TextureSet.SET_FLINT, + 2.5F, + 128, + 1, + 1 | 64, + 0, + 32, + 64, + 0, + "Flint", + "Flint", + 0, + 0, + -1, + 0, + false, + false, + 1, + 1, + 1, + Dyes.dyeGray, + 2, + Collections.singletonList(new MaterialStack(SiliconDioxide, 1)), + Arrays.asList(new TC_AspectStack(TC_Aspects.TERRA, 1), new TC_AspectStack(TC_Aspects.INSTRUMENTUM, 1))); + public static Materials Diatomite = new Materials( + 948, + TextureSet.SET_DULL, + 1.0F, + 0, + 1, + 1 | 8, + 225, + 225, + 225, + 0, + "Diatomite", + "Diatomite", + 0, + 0, + -1, + 0, + false, + false, + 1, + 1, + 1, + Dyes.dyeGray, + 2, + Arrays.asList( + new MaterialStack(Flint, 8), new MaterialStack(BandedIron, 1), new MaterialStack(Sapphire, 1))); + public static Materials VolcanicAsh = new Materials( + 940, + TextureSet.SET_FLINT, + 1.0F, + 0, + 0, + 1, + 60, + 50, + 50, + 0, + "VolcanicAsh", + "Volcanic Ashes", + 0, + 0, + -1, + 0, + false, + false, + 1, + 1, + 1, + Dyes.dyeBlack, + 2, + Arrays.asList(new MaterialStack(Flint, 6), new MaterialStack(Iron, 1), new MaterialStack(Magnesium, 1))); + public static Materials Niter = new Materials( + 531, + TextureSet.SET_FLINT, + 1.0F, + 0, + 1, + 1 | 4 | 8, + 255, + 200, + 200, + 0, + "Niter", + "Niter", + 0, + 0, + -1, + 0, + false, + false, + 1, + 1, + 1, + Dyes.dyePink, + 2, + Collections.singletonList(new MaterialStack(Saltpeter, 1))); + public static Materials Pyrotheum = new Materials( + 843, + TextureSet.SET_FIERY, + 1.0F, + 0, + 1, + 1, + 255, + 128, + 0, + 0, + "Pyrotheum", + "Pyrotheum", + 2, + 62, + -1, + 0, + false, + false, + 2, + 3, + 1, + Dyes.dyeYellow, + 2, + Arrays.asList(new MaterialStack(Coal, 1), new MaterialStack(Redstone, 1), new MaterialStack(Blaze, 1)), + Arrays.asList(new TC_AspectStack(TC_Aspects.PRAECANTATIO, 2), new TC_AspectStack(TC_Aspects.IGNIS, 1))); + public static Materials Cryotheum = new Materials( + 898, + TextureSet.SET_SHINY, + 1.0F, + 0, + 1, + 1, + 0, + 148, + 203, + 0, + "Cryotheum", + "Cryotheum", + 2, + 62, + -1, + 0, + false, + false, + 2, + 3, + 1, + Dyes.dyeLightBlue, + 2, + Arrays.asList( + new MaterialStack(Saltpeter, 1), + new MaterialStack(Redstone, 1), + new MaterialStack(Snow, 1), + new MaterialStack(Blizz, 1)), + Arrays.asList( + new TC_AspectStack(TC_Aspects.PRAECANTATIO, 2), + new TC_AspectStack(TC_Aspects.ELECTRUM, 1), + new TC_AspectStack(TC_Aspects.GELUM, 1))); + public static Materials HydratedCoal = new Materials( + 818, + TextureSet.SET_ROUGH, + 1.0F, + 0, + 1, + 1, + 70, + 70, + 100, + 0, + "HydratedCoal", + "Hydrated Coal", + 0, + 0, + -1, + 0, + false, + false, + 1, + 9, + 8, + Dyes.dyeBlack, + 2, + Arrays.asList(new MaterialStack(Coal, 8), new MaterialStack(Water, 1))); + public static Materials Apatite = new Materials( + 530, + TextureSet.SET_DIAMOND, + 1.0F, + 0, + 1, + 1 | 4 | 8, + 200, + 200, + 255, + 0, + "Apatite", + "Apatite", + 0, + 0, + -1, + 0, + false, + false, + 2, + 1, + 1, + Dyes.dyeCyan, + 1, + Arrays.asList( + new MaterialStack(Calcium, 5), new MaterialStack(Phosphate, 3), new MaterialStack(Chlorine, 1)), + Collections.singletonList(new TC_AspectStack(TC_Aspects.MESSIS, 2))); + public static Materials Alumite = new Materials( + 400, + TextureSet.SET_METALLIC, + 5.0F, + 768, + 2, + 1 | 2 | 64 | 128, + 255, + 105, + 180, + 0, + "Alumite", + "Alumite", + 0, + 0, + -1, + 0, + false, + false, + 1, + 1, + 1, + Dyes.dyePink, + 2, + Arrays.asList(new MaterialStack(Aluminium, 5), new MaterialStack(Steel, 2), new MaterialStack(Obsidian, 2)), + Collections.singletonList(new TC_AspectStack(TC_Aspects.STRONTIO, 2))); + public static Materials Manyullyn = new Materials( + 386, + TextureSet.SET_SHINY, + 25.0F, + 2048, + 5, + 1 | 2 | 8 | 64 | 128, + 154, + 76, + 185, + 0, + "Manyullyn", + "Manyullyn", + 0, + 0, + 3600, + 3600, + true, + false, + 1, + 1, + 1, + Dyes.dyePurple, + 2, + Arrays.asList(new MaterialStack(Cobalt, 1), new MaterialStack(Ardite, 1)), + Collections.singletonList(new TC_AspectStack(TC_Aspects.STRONTIO, 2))) + .disableAutoGeneratedBlastFurnaceRecipes(); + public static Materials Steeleaf = new Materials( + 339, + TextureSet.SET_LEAF, + 8.0F, + 768, + 3, + 1 | 2 | 64 | 128, + 50, + 127, + 50, + 0, + "Steeleaf", + "Steeleaf", + 5, + 24, + -1, + 0, + false, + false, + 4, + 1, + 1, + Dyes.dyeGreen, + 2, + Arrays.asList(new MaterialStack(Steel, 1), new MaterialStack(Magic, 1)), + Arrays.asList( + new TC_AspectStack(TC_Aspects.HERBA, 2), + new TC_AspectStack(TC_Aspects.METALLUM, 2), + new TC_AspectStack(TC_Aspects.PRAECANTATIO, 1))); + public static Materials Knightmetal = new Materials( + 362, + TextureSet.SET_METALLIC, + 8.0F, + 1024, + 3, + 1 | 2 | 64 | 128, + 210, + 240, + 200, + 0, + "Knightmetal", + "Knightmetal", + 5, + 24, + -1, + 0, + false, + false, + 4, + 1, + 1, + Dyes.dyeLime, + 2, + Arrays.asList(new MaterialStack(Steel, 2), new MaterialStack(Magic, 1)), + Arrays.asList(new TC_AspectStack(TC_Aspects.LUCRUM, 1), new TC_AspectStack(TC_Aspects.METALLUM, 2))); + public static Materials SterlingSilver = new Materials( + 350, + TextureSet.SET_SHINY, + 13.0F, + 128, + 2, + 1 | 2 | 64 | 128, + 250, + 220, + 225, + 0, + "SterlingSilver", + "Sterling Silver", + 0, + 0, + -1, + 1700, + true, + false, + 4, + 1, + 1, + Dyes.dyeWhite, + 2, + Arrays.asList(new MaterialStack(Copper, 1), new MaterialStack(Silver, 4))); + public static Materials RoseGold = new Materials( + 351, + TextureSet.SET_SHINY, + 14.0F, + 128, + 2, + 1 | 2 | 64 | 128, + 255, + 230, + 30, + 0, + "RoseGold", + "Rose Gold", + 0, + 0, + -1, + 1600, + true, + false, + 4, + 1, + 1, + Dyes.dyeOrange, + 2, + Arrays.asList(new MaterialStack(Copper, 1), new MaterialStack(Gold, 4))); + public static Materials BlackBronze = new Materials( + 352, + TextureSet.SET_DULL, + 12.0F, + 256, + 2, + 1 | 2 | 64 | 128, + 100, + 50, + 125, + 0, + "BlackBronze", + "Black Bronze", + 0, + 0, + -1, + 2000, + true, + false, + 4, + 1, + 1, + Dyes.dyePurple, + 2, + Arrays.asList(new MaterialStack(Gold, 1), new MaterialStack(Silver, 1), new MaterialStack(Copper, 3))); + public static Materials BismuthBronze = new Materials( + 353, + TextureSet.SET_DULL, + 8.0F, + 256, + 2, + 1 | 2 | 64 | 128, + 100, + 125, + 125, + 0, + "BismuthBronze", + "Bismuth Bronze", + 0, + 0, + -1, + 1100, + true, + false, + 4, + 1, + 1, + Dyes.dyeCyan, + 2, + Arrays.asList(new MaterialStack(Bismuth, 1), new MaterialStack(Zinc, 1), new MaterialStack(Copper, 3))); + public static Materials BlackSteel = new Materials( + 334, + TextureSet.SET_METALLIC, + 6.5F, + 768, + 3, + 1 | 2 | 64 | 128, + 100, + 100, + 100, + 0, + "BlackSteel", + "Black Steel", + 0, + 0, + -1, + 1200, + true, + false, + 4, + 1, + 1, + Dyes.dyeBlack, + 2, + Arrays.asList( + new MaterialStack(Nickel, 1), + new MaterialStack(BlackBronze, 1), + new MaterialStack(Steel, 3))) + .disableAutoGeneratedBlastFurnaceRecipes(); + public static Materials RedSteel = new Materials( + 348, + TextureSet.SET_METALLIC, + 7.0F, + 896, + 4, + 1 | 2 | 64 | 128, + 140, + 100, + 100, + 0, + "RedSteel", + "Red Steel", + 0, + 0, + -1, + 1300, + true, + false, + 4, + 1, + 1, + Dyes.dyeRed, + 2, + Arrays.asList( + new MaterialStack(SterlingSilver, 1), + new MaterialStack(BismuthBronze, 1), + new MaterialStack(Steel, 2), + new MaterialStack(BlackSteel, 4))); + public static Materials BlueSteel = new Materials( + 349, + TextureSet.SET_METALLIC, + 7.5F, + 1024, + 4, + 1 | 2 | 64 | 128, + 100, + 100, + 140, + 0, + "BlueSteel", + "Blue Steel", + 0, + 0, + -1, + 1400, + true, + false, + 4, + 1, + 1, + Dyes.dyeBlue, + 2, + Arrays.asList( + new MaterialStack(RoseGold, 1), + new MaterialStack(Brass, 1), + new MaterialStack(Steel, 2), + new MaterialStack(BlackSteel, 4))); + public static Materials DamascusSteel = new Materials( + 335, + TextureSet.SET_METALLIC, + 8.0F, + 1280, + 3, + 1 | 2 | 64 | 128, + 110, + 110, + 110, + 0, + "DamascusSteel", + "Damascus Steel", + 0, + 0, + 2000, + 1500, + true, + false, + 4, + 1, + 1, + Dyes.dyeGray, + 2, + Collections.singletonList(new MaterialStack(Steel, 1))) + .disableAutoGeneratedBlastFurnaceRecipes(); + public static Materials TungstenSteel = new Materials( + 316, + TextureSet.SET_METALLIC, + 8.0F, + 2560, + 4, + 1 | 2 | 64 | 128, + 100, + 100, + 160, + 0, + "TungstenSteel", + "Tungstensteel", + 0, + 0, + -1, + 3000, + true, + false, + 4, + 1, + 1, + Dyes.dyeBlue, + 2, + Arrays.asList(new MaterialStack(Steel, 1), new MaterialStack(Tungsten, 1))) + .disableAutoGeneratedBlastFurnaceRecipes(); + public static Materials NitroCoalFuel = new Materials( + -1, + TextureSet.SET_FLUID, + 1.0F, + 0, + 2, + 16, + 50, + 70, + 50, + 0, + "NitroCoalFuel", + "Nitro-Coalfuel", + 0, + 48, + -1, + 0, + false, + false, + 1, + 1, + 1, + Dyes.dyeBlack, + 0, + Arrays.asList(new MaterialStack(Glyceryl, 1), new MaterialStack(CoalFuel, 4))); + public static Materials NitroFuel = new Materials( + 709, + TextureSet.SET_FLUID, + 1.0F, + 0, + 2, + 16, + 200, + 255, + 0, + 0, + "NitroFuel", + "Cetane-Boosted Diesel", + 0, + 1000, + -1, + 0, + false, + false, + 1, + 1, + 1, + Dyes.dyeLime); + public static Materials RedAlloy = new Materials( + 308, + TextureSet.SET_DULL, + 1.0F, + 0, + 0, + 1 | 2, + 200, + 0, + 0, + 0, + "RedAlloy", + "Red Alloy", + 0, + 0, + 500, + 0, + false, + false, + 3, + 5, + 1, + Dyes.dyeRed, + 2, + Arrays.asList(new MaterialStack(Copper, 1), new MaterialStack(Redstone, 4)), + Collections.singletonList(new TC_AspectStack(TC_Aspects.MACHINA, 3))); + public static Materials CobaltBrass = new Materials( + 343, + TextureSet.SET_METALLIC, + 8.0F, + 256, + 2, + 1 | 2 | 64 | 128, + 180, + 180, + 160, + 0, + "CobaltBrass", + "Cobalt Brass", + 0, + 0, + -1, + 0, + false, + false, + 3, + 1, + 1, + Dyes.dyeOrange, + 2, + Arrays.asList(new MaterialStack(Brass, 7), new MaterialStack(Aluminium, 1), new MaterialStack(Cobalt, 1))); + public static Materials TricalciumPhosphate = new Materials( + 534, + TextureSet.SET_FLINT, + 1.0F, + 0, + 2, + 1 | 4 | 8 | 16, + 255, + 255, + 0, + 0, + "TricalciumPhosphate", + "Tricalcium Phosphate", + 0, + 0, + -1, + 0, + false, + false, + 3, + 1, + 1, + Dyes.dyeYellow, + 2, + Arrays.asList(new MaterialStack(Calcium, 3), new MaterialStack(Phosphate, 2))); + public static Materials Basalt = new Materials( + 844, + TextureSet.SET_ROUGH, + 1.0F, + 64, + 1, + 1 | 64 | 128, + 30, + 20, + 20, + 0, + "Basalt", + "Basalt", + 0, + 0, + -1, + 0, + false, + false, + 2, + 1, + 1, + Dyes.dyeBlack, + 2, + Arrays.asList( + new MaterialStack(Olivine, 1), + new MaterialStack(Calcite, 3), + new MaterialStack(Flint, 8), + new MaterialStack(DarkAsh, 4)), + Collections.singletonList(new TC_AspectStack(TC_Aspects.TENEBRAE, 1))); + public static Materials GarnetRed = new Materials( + 527, + TextureSet.SET_RUBY, + 7.0F, + 128, + 2, + 1 | 4 | 8 | 64, + 200, + 80, + 80, + 127, + "GarnetRed", + "Red Garnet", + 0, + 0, + -1, + 0, + false, + true, + 4, + 1, + 1, + Dyes.dyeRed, + 2, + Arrays.asList( + new MaterialStack(Pyrope, 3), new MaterialStack(Almandine, 5), new MaterialStack(Spessartine, 8)), + Collections.singletonList(new TC_AspectStack(TC_Aspects.VITREUS, 3))); + public static Materials GarnetYellow = new Materials( + 528, + TextureSet.SET_RUBY, + 7.0F, + 128, + 2, + 1 | 4 | 8 | 64, + 200, + 200, + 80, + 127, + "GarnetYellow", + "Yellow Garnet", + 0, + 0, + -1, + 0, + false, + true, + 4, + 1, + 1, + Dyes.dyeYellow, + 2, + Arrays.asList( + new MaterialStack(Andradite, 5), new MaterialStack(Grossular, 8), new MaterialStack(Uvarovite, 3)), + Collections.singletonList(new TC_AspectStack(TC_Aspects.VITREUS, 3))); + public static Materials Marble = new Materials( + 845, + TextureSet.SET_FINE, + 1.0F, + 16, + 1, + 1 | 64 | 128, + 200, + 200, + 200, + 0, + "Marble", + "Marble", + 0, + 0, + -1, + 0, + false, + false, + 1, + 1, + 1, + Dyes.dyeWhite, + 2, + Arrays.asList(new MaterialStack(Magnesium, 1), new MaterialStack(Calcite, 7)), + Collections.singletonList(new TC_AspectStack(TC_Aspects.PERFODIO, 1))); + public static Materials Sugar = new Materials( + 803, + TextureSet.SET_FINE, + 1.0F, + 0, + 1, + 1, + 250, + 250, + 250, + 0, + "Sugar", + "Sugar", + 0, + 0, + -1, + 0, + false, + false, + 1, + 1, + 1, + Dyes.dyeWhite, + 1, + Arrays.asList(new MaterialStack(Carbon, 2), new MaterialStack(Water, 5), new MaterialStack(Oxygen, 25)), + Arrays.asList( + new TC_AspectStack(TC_Aspects.HERBA, 1), + new TC_AspectStack(TC_Aspects.AQUA, 1), + new TC_AspectStack(TC_Aspects.AER, 1))); + public static Materials Thaumium = new Materials( + 330, + TextureSet.SET_METALLIC, + 12.0F, + 256, + 3, + 1 | 2 | 64 | 128, + 150, + 100, + 200, + 0, + "Thaumium", + "Thaumium", + 0, + 0, + -1, + 0, + false, + false, + 5, + 2, + 1, + Dyes.dyePurple, + 0, + Arrays.asList(new MaterialStack(Iron, 1), new MaterialStack(Magic, 1)), + Arrays.asList(new TC_AspectStack(TC_Aspects.METALLUM, 2), new TC_AspectStack(TC_Aspects.PRAECANTATIO, 1))); + public static Materials Vinteum = new Materials( + 529, + TextureSet.SET_METALLIC, + 10.0F, + 128, + 3, + 1 | 2 | 8 | 64 | 128, + 100, + 200, + 255, + 0, + "Vinteum", + "Vinteum", + 5, + 32, + -1, + 0, + false, + false, + 4, + 1, + 1, + Dyes.dyeLightBlue, + 2, + Collections.singletonList(new MaterialStack(Thaumium, 1)), + Arrays.asList(new TC_AspectStack(TC_Aspects.VITREUS, 2), new TC_AspectStack(TC_Aspects.PRAECANTATIO, 1))); + public static Materials Vis = new Materials( + -1, + TextureSet.SET_SHINY, + 1.0F, + 0, + 3, + 0, + 128, + 0, + 255, + 0, + "Vis", + "Vis", + 5, + 32, + -1, + 0, + false, + false, + 1, + 1, + 1, + Dyes.dyePurple, + 2, + Collections.singletonList(new MaterialStack(Magic, 1)), + Arrays.asList(new TC_AspectStack(TC_Aspects.AURAM, 2), new TC_AspectStack(TC_Aspects.PRAECANTATIO, 1))); + public static Materials Redrock = new Materials( + 846, + TextureSet.SET_ROUGH, + 1.0F, + 0, + 1, + 1, + 255, + 80, + 50, + 0, + "Redrock", + "Redrock", + 0, + 0, + -1, + 0, + false, + false, + 1, + 1, + 1, + Dyes.dyeRed, + 2, + Arrays.asList(new MaterialStack(Calcite, 2), new MaterialStack(Flint, 1), new MaterialStack(Clay, 1))); + public static Materials PotassiumFeldspar = new Materials( + 847, + TextureSet.SET_FINE, + 1.0F, + 0, + 1, + 1, + 120, + 40, + 40, + 0, + "PotassiumFeldspar", + "Potassium Feldspar", + 0, + 0, + -1, + 0, + false, + false, + 1, + 1, + 1, + Dyes.dyePink, + 1, + Arrays.asList( + new MaterialStack(Potassium, 1), + new MaterialStack(Aluminium, 1), + new MaterialStack(Silicon, 3), + new MaterialStack(Oxygen, 8))); + public static Materials Biotite = new Materials( + 848, + TextureSet.SET_METALLIC, + 1.0F, + 0, + 1, + 1, + 20, + 30, + 20, + 0, + "Biotite", + "Biotite", + 0, + 0, + -1, + 0, + false, + false, + 1, + 1, + 1, + Dyes.dyeGray, + 1, + Arrays.asList( + new MaterialStack(Potassium, 1), + new MaterialStack(Magnesium, 3), + new MaterialStack(Aluminium, 3), + new MaterialStack(Fluorine, 2), + new MaterialStack(Silicon, 3), + new MaterialStack(Oxygen, 10))); + public static Materials GraniteBlack = new Materials( + 849, + TextureSet.SET_ROUGH, + 4.0F, + 64, + 3, + 1 | 64 | 128, + 10, + 10, + 10, + 0, + "GraniteBlack", + "Black Granite", + 0, + 0, + -1, + 0, + false, + false, + 0, + 1, + 1, + Dyes.dyeBlack, + 2, + Arrays.asList(new MaterialStack(SiliconDioxide, 4), new MaterialStack(Biotite, 1)), + Collections.singletonList(new TC_AspectStack(TC_Aspects.TUTAMEN, 1))); + public static Materials GraniteRed = new Materials( + 850, + TextureSet.SET_ROUGH, + 4.0F, + 64, + 3, + 1 | 64 | 128, + 255, + 0, + 128, + 0, + "GraniteRed", + "Red Granite", + 0, + 0, + -1, + 0, + false, + false, + 0, + 1, + 1, + Dyes.dyeMagenta, + 1, + Arrays.asList( + new MaterialStack(Aluminium, 2), + new MaterialStack(PotassiumFeldspar, 1), + new MaterialStack(Oxygen, 3)), + Collections.singletonList(new TC_AspectStack(TC_Aspects.TUTAMEN, 1))); + public static Materials Chrysotile = new Materials( + 912, + TextureSet.SET_DULL, + 32.0F, + 10240, + 3, + 1 | 2 | 8 | 64 | 128, + 110, + 140, + 110, + 0, + "Chrysotile", + "Chrysotile", + 0, + 0, + -1, + 0, + false, + false, + 1, + 1, + 1, + Dyes.dyeWhite, + 2, + Collections.singletonList(new MaterialStack(Asbestos, 1))) + .disableAutoGeneratedBlastFurnaceRecipes() + .setTurbineMultipliers(280, 280, 1); + public static Materials Realgar = new Materials( + 913, + TextureSet.SET_DULL, + 1.0F, + 32, + 1, + 1 | 2 | 8 | 64 | 128, + 140, + 100, + 100, + 0, + "Realgar", + "Realgar", + 0, + 0, + -1, + 0, + false, + false, + 1, + 1, + 1, + Dyes.dyeWhite, + 2, + Arrays.asList(new MaterialStack(Arsenic, 4), new MaterialStack(Sulfur, 4))); + public static Materials VanadiumMagnetite = new Materials( + 923, + TextureSet.SET_METALLIC, + 1.0F, + 0, + 2, + 1 | 8, + 35, + 35, + 60, + 0, + "VanadiumMagnetite", + "Vanadium Magnetite", + 0, + 0, + -1, + 0, + false, + false, + 1, + 1, + 1, + Dyes.dyeBlack, + 2, + Arrays.asList(new MaterialStack(Magnetite, 1), new MaterialStack(Vanadium, 1)), + Arrays.asList( + new TC_AspectStack(TC_Aspects.METALLUM, 2), + new TC_AspectStack(TC_Aspects.MAGNETO, 1))); // Mixture of Fe3O4 and V2O5 + public static Materials BasalticMineralSand = new Materials( + 935, + TextureSet.SET_SAND, + 1.0F, + 0, + 1, + 1 | 8, + 40, + 50, + 40, + 0, + "BasalticMineralSand", + "Basaltic Mineral Sand", + 0, + 0, + -1, + 0, + false, + false, + 1, + 1, + 1, + Dyes.dyeBlack, + 2, + Arrays.asList(new MaterialStack(Magnetite, 1), new MaterialStack(Basalt, 1)), + Arrays.asList(new TC_AspectStack(TC_Aspects.METALLUM, 2), new TC_AspectStack(TC_Aspects.MAGNETO, 1))); + public static Materials GraniticMineralSand = new Materials( + 936, + TextureSet.SET_SAND, + 1.0F, + 0, + 1, + 1 | 8, + 40, + 60, + 60, + 0, + "GraniticMineralSand", + "Granitic Mineral Sand", + 0, + 0, + -1, + 0, + false, + false, + 1, + 1, + 1, + Dyes.dyeBlack, + 2, + Arrays.asList(new MaterialStack(Magnetite, 1), new MaterialStack(GraniteBlack, 1)), + Arrays.asList(new TC_AspectStack(TC_Aspects.METALLUM, 2), new TC_AspectStack(TC_Aspects.MAGNETO, 1))); + public static Materials GarnetSand = new Materials( + 938, + TextureSet.SET_SAND, + 1.0F, + 0, + 1, + 1 | 8, + 200, + 100, + 0, + 0, + "GarnetSand", + "Garnet Sand", + 0, + 0, + -1, + 0, + false, + false, + 1, + 1, + 1, + Dyes.dyeOrange, + 2, + Arrays.asList(new MaterialStack(GarnetRed, 1), new MaterialStack(GarnetYellow, 1))); + public static Materials QuartzSand = new Materials( + 939, + TextureSet.SET_SAND, + 1.0F, + 0, + 1, + 1 | 8, + 194, + 178, + 128, + 0, + "QuartzSand", + "Quartz Sand", + 0, + 0, + -1, + 0, + false, + false, + 1, + 1, + 1, + Dyes.dyeWhite, + 2, + Arrays.asList(new MaterialStack(CertusQuartz, 1), new MaterialStack(Quartzite, 1))); + public static Materials Bastnasite = new Materials( + 905, + TextureSet.SET_FINE, + 1.0F, + 0, + 2, + 1 | 8, + 200, + 110, + 45, + 0, + "Bastnasite", + "Bastnasite", + 0, + 0, + -1, + 0, + false, + false, + 1, + 1, + 1, + Dyes._NULL, + 1, + Arrays.asList( + new MaterialStack(Cerium, 1), + new MaterialStack(Carbon, 1), + new MaterialStack(Fluorine, 1), + new MaterialStack(Oxygen, 3))); // (Ce, La, Y)CO3F + public static Materials Pentlandite = new Materials( + 909, + TextureSet.SET_DULL, + 1.0F, + 0, + 2, + 1 | 8, + 165, + 150, + 5, + 0, + "Pentlandite", + "Pentlandite", + 0, + 0, + -1, + 0, + false, + false, + 1, + 1, + 1, + Dyes._NULL, + 1, + Arrays.asList(new MaterialStack(Nickel, 9), new MaterialStack(Sulfur, 8))); // (Fe,Ni)9S8 + public static Materials Spodumene = new Materials( + 920, + TextureSet.SET_DULL, + 1.0F, + 0, + 2, + 1 | 8, + 190, + 170, + 170, + 0, + "Spodumene", + "Spodumene", + 0, + 0, + -1, + 0, + false, + false, + 1, + 1, + 1, + Dyes._NULL, + 1, + Arrays.asList( + new MaterialStack(Lithium, 1), + new MaterialStack(Aluminium, 1), + new MaterialStack(Silicon, 2), + new MaterialStack(Oxygen, 6))); // LiAl(SiO3)2 + public static Materials Pollucite = new Materials( + 919, + TextureSet.SET_DULL, + 1.0F, + 0, + 2, + 1 | 8, + 240, + 210, + 210, + 0, + "Pollucite", + "Pollucite", + 0, + 0, + -1, + 0, + false, + false, + 1, + 1, + 1, + Dyes._NULL, + 1, + Arrays.asList( + new MaterialStack(Caesium, 2), + new MaterialStack(Aluminium, 2), + new MaterialStack(Silicon, 4), + new MaterialStack(Water, 2), + new MaterialStack(Oxygen, 12))); // (Cs,Na)2Al2Si4O12 2H2O (also a source of Rb) + public static Materials Tantalite = new Materials( + 921, + TextureSet.SET_METALLIC, + 1.0F, + 0, + 3, + 1 | 8, + 145, + 80, + 40, + 0, + "Tantalite", + "Tantalite", + 0, + 0, + -1, + 0, + false, + false, + 1, + 1, + 1, + Dyes._NULL, + 1, + Arrays.asList( + new MaterialStack(Manganese, 1), + new MaterialStack(Tantalum, 2), + new MaterialStack(Oxygen, 6))); // (Fe, Mn)Ta2O6 (also source of Nb) + public static Materials Lepidolite = new Materials( + 907, + TextureSet.SET_FINE, + 1.0F, + 0, + 2, + 1 | 8, + 240, + 50, + 140, + 0, + "Lepidolite", + "Lepidolite", + 0, + 0, + -1, + 0, + false, + false, + 1, + 1, + 1, + Dyes._NULL, + 1, + Arrays.asList( + new MaterialStack(Potassium, 1), + new MaterialStack(Lithium, 3), + new MaterialStack(Aluminium, 4), + new MaterialStack(Fluorine, 2), + new MaterialStack(Oxygen, 10))); // K(Li,Al,Rb)3(Al,Si)4O10(F,OH)2 + public static Materials Glauconite = new Materials( + 933, + TextureSet.SET_DULL, + 1.0F, + 0, + 2, + 1 | 8, + 130, + 180, + 60, + 0, + "Glauconite", + "Glauconite", + 0, + 0, + -1, + 0, + false, + false, + 1, + 1, + 1, + Dyes._NULL, + 1, + Arrays.asList( + new MaterialStack(Potassium, 1), + new MaterialStack(Magnesium, 2), + new MaterialStack(Aluminium, 4), + new MaterialStack(Hydrogen, 2), + new MaterialStack(Oxygen, 12))); // (K,Na)(Fe3+,Al,Mg)2(Si,Al)4O10(OH)2 + public static Materials GlauconiteSand = new Materials( + 949, + TextureSet.SET_DULL, + 1.0F, + 0, + 2, + 1 | 8, + 130, + 180, + 60, + 0, + "GlauconiteSand", + "Glauconite Sand", + 0, + 0, + -1, + 0, + false, + false, + 1, + 1, + 1, + Dyes._NULL, + 1, + Arrays.asList( + new MaterialStack(Potassium, 1), + new MaterialStack(Magnesium, 2), + new MaterialStack(Aluminium, 4), + new MaterialStack(Hydrogen, 2), + new MaterialStack(Oxygen, 12))); // (K,Na)(Fe3+,Al,Mg)2(Si,Al)4O10(OH)2 + public static Materials Vermiculite = new Materials( + 932, + TextureSet.SET_METALLIC, + 1.0F, + 0, + 2, + 1 | 8, + 200, + 180, + 15, + 0, + "Vermiculite", + "Vermiculite", + 0, + 0, + -1, + 0, + false, + false, + 1, + 1, + 1, + Dyes._NULL, + 1, + Arrays.asList( + new MaterialStack(Iron, 3), + new MaterialStack(Aluminium, 4), + new MaterialStack(Silicon, 4), + new MaterialStack(Hydrogen, 2), + new MaterialStack(Water, 4), + new MaterialStack(Oxygen, 12))); // (Mg+2, Fe+2, Fe+3)3 [(AlSi)4O10] (OH)2 4H2O) + public static Materials Bentonite = new Materials( + 927, + TextureSet.SET_ROUGH, + 1.0F, + 0, + 2, + 1 | 8, + 245, + 215, + 210, + 0, + "Bentonite", + "Bentonite", + 0, + 0, + -1, + 0, + false, + false, + 1, + 1, + 1, + Dyes._NULL, + 1, + Arrays.asList( + new MaterialStack(Sodium, 1), + new MaterialStack(Magnesium, 6), + new MaterialStack(Silicon, 12), + new MaterialStack(Hydrogen, 6), + new MaterialStack(Water, 5), + new MaterialStack(Oxygen, 36))); // (Na,Ca)0.33(Al,Mg)2(Si4O10)(OH)2 nH2O + public static Materials FullersEarth = new Materials( + 928, + TextureSet.SET_FINE, + 1.0F, + 0, + 2, + 1 | 8, + 160, + 160, + 120, + 0, + "FullersEarth", + "Fullers Earth", + 0, + 0, + -1, + 0, + false, + false, + 1, + 1, + 1, + Dyes._NULL, + 1, + Arrays.asList( + new MaterialStack(Magnesium, 1), + new MaterialStack(Silicon, 4), + new MaterialStack(Hydrogen, 1), + new MaterialStack(Water, 4), + new MaterialStack(Oxygen, 11))); // (Mg,Al)2Si4O10(OH) 4(H2O) + public static Materials Pitchblende = new Materials( + 873, + TextureSet.SET_DULL, + 1.0F, + 0, + 3, + 1 | 8, + 200, + 210, + 0, + 0, + "Pitchblende", + "Pitchblende", + 0, + 0, + -1, + 0, + false, + false, + 5, + 1, + 1, + Dyes.dyeYellow, + 2, + Arrays.asList(new MaterialStack(Uraninite, 3), new MaterialStack(Thorium, 1), new MaterialStack(Lead, 1))); + public static Materials Monazite = new Materials( + 520, + TextureSet.SET_DIAMOND, + 1.0F, + 0, + 1, + 1 | 4 | 8, + 50, + 70, + 50, + 0, + "Monazite", + "Monazite", + 0, + 0, + -1, + 0, + false, + false, + 3, + 1, + 1, + Dyes.dyeGreen, + 1, + Arrays.asList( + new MaterialStack(RareEarth, 1), + new MaterialStack( + Phosphate, + 1))); // Wikipedia: (Ce, La, Nd, Th, Sm, Gd)PO4 Monazite also smelt-extract to Helium, it is + // brown like the rare earth Item Monazite sand deposits are inevitably of the + // monazite-(Ce) composition. Typically, the lanthanides in such monazites contain + // about 45.8% cerium, about 24% lanthanum, about 17% neodymium, about 5% + // praseodymium, and minor quantities of samarium, gadolinium, and yttrium. Europium + // concentrations tend to be low, about 0.05% Thorium content of monazite is variable. + public static Materials Malachite = new Materials( + 871, + TextureSet.SET_DULL, + 1.0F, + 0, + 1, + 1 | 8, + 5, + 95, + 5, + 0, + "Malachite", + "Malachite", + 0, + 0, + -1, + 0, + false, + false, + 3, + 1, + 1, + Dyes.dyeGreen, + 1, + Arrays.asList( + new MaterialStack(Copper, 2), + new MaterialStack(Carbon, 1), + new MaterialStack(Hydrogen, 2), + new MaterialStack(Oxygen, 5))); // Cu2CO3(OH)2 + public static Materials Mirabilite = new Materials( + 900, + TextureSet.SET_DULL, + 1.0F, + 0, + 2, + 1 | 8, + 240, + 250, + 210, + 0, + "Mirabilite", + "Mirabilite", + 0, + 0, + -1, + 0, + false, + false, + 1, + 1, + 1, + Dyes._NULL, + 1, + Arrays.asList( + new MaterialStack(Sodium, 2), + new MaterialStack(Sulfur, 1), + new MaterialStack(Water, 10), + new MaterialStack(Oxygen, 4))); // Na2SO4 10H2O + public static Materials Mica = new Materials( + 901, + TextureSet.SET_FINE, + 1.0F, + 0, + 1, + 1 | 8, + 195, + 195, + 205, + 0, + "Mica", + "Mica", + 0, + 0, + -1, + 0, + false, + false, + 1, + 1, + 1, + Dyes._NULL, + 1, + Arrays.asList( + new MaterialStack(Potassium, 1), + new MaterialStack(Aluminium, 3), + new MaterialStack(Silicon, 3), + new MaterialStack(Fluorine, 2), + new MaterialStack(Oxygen, 10))); // KAl2(AlSi3O10)(F,OH)2 + public static Materials Trona = new Materials( + 903, + TextureSet.SET_METALLIC, + 1.0F, + 0, + 1, + 1 | 8, + 135, + 135, + 95, + 0, + "Trona", + "Trona", + 0, + 0, + -1, + 0, + false, + false, + 1, + 1, + 1, + Dyes._NULL, + 1, + Arrays.asList( + new MaterialStack(Sodium, 3), + new MaterialStack(Carbon, 2), + new MaterialStack(Hydrogen, 1), + new MaterialStack(Water, 2), + new MaterialStack(Oxygen, 6))); // Na3(CO3)(HCO3) 2H2O + public static Materials Barite = new Materials( + 904, + TextureSet.SET_DULL, + 1.0F, + 0, + 2, + 1 | 8, + 230, + 235, + 255, + 0, + "Barite", + "Barite", + 0, + 0, + -1, + 0, + false, + false, + 1, + 1, + 1, + Dyes._NULL, + 1, + Arrays.asList(new MaterialStack(Barium, 1), new MaterialStack(Sulfur, 1), new MaterialStack(Oxygen, 4))); + public static Materials Gypsum = new Materials( + 934, + TextureSet.SET_DULL, + 1.0F, + 0, + 1, + 1 | 8, + 230, + 230, + 250, + 0, + "Gypsum", + "Gypsum", + 0, + 0, + -1, + 0, + false, + false, + 1, + 1, + 1, + Dyes._NULL, + 1, + Arrays.asList( + new MaterialStack(Calcium, 1), + new MaterialStack(Sulfur, 1), + new MaterialStack(Oxygen, 4), + new MaterialStack(Water, 2))); // CaSO4 2H2O + public static Materials Alunite = new Materials( + 911, + TextureSet.SET_METALLIC, + 1.0F, + 0, + 2, + 1 | 8, + 225, + 180, + 65, + 0, + "Alunite", + "Alunite", + 0, + 0, + -1, + 0, + false, + false, + 1, + 1, + 1, + Dyes._NULL, + 1, + Arrays.asList( + new MaterialStack(Potassium, 1), + new MaterialStack(Aluminium, 3), + new MaterialStack(Silicon, 2), + new MaterialStack(Hydrogen, 6), + new MaterialStack(Oxygen, 14))); // KAl3(SO4)2(OH)6 + public static Materials Dolomite = new Materials( + 914, + TextureSet.SET_FLINT, + 1.0F, + 0, + 1, + 1 | 8, + 225, + 205, + 205, + 0, + "Dolomite", + "Dolomite", + 0, + 0, + -1, + 0, + false, + false, + 1, + 1, + 1, + Dyes._NULL, + 1, + Arrays.asList( + new MaterialStack(Calcium, 1), + new MaterialStack(Magnesium, 1), + new MaterialStack(Carbon, 2), + new MaterialStack(Oxygen, 6))); // CaMg(CO3)2 + public static Materials Wollastonite = new Materials( + 915, + TextureSet.SET_DULL, + 1.0F, + 0, + 2, + 1 | 8, + 240, + 240, + 240, + 0, + "Wollastonite", + "Wollastonite", + 0, + 0, + -1, + 0, + false, + false, + 1, + 1, + 1, + Dyes._NULL, + 1, + Arrays.asList( + new MaterialStack(Calcium, 1), + new MaterialStack(Silicon, 1), + new MaterialStack(Oxygen, 3))); // CaSiO3 + public static Materials Zeolite = new Materials( + 916, + TextureSet.SET_DULL, + 1.0F, + 0, + 2, + 1 | 8, + 240, + 230, + 230, + 0, + "Zeolite", + "Zeolite", + 0, + 0, + -1, + 0, + false, + false, + 1, + 1, + 1, + Dyes._NULL, + 1, + Arrays.asList( + new MaterialStack(Sodium, 1), + new MaterialStack(Calcium, 4), + new MaterialStack(Silicon, 27), + new MaterialStack(Aluminium, 9), + new MaterialStack(Water, 28), + new MaterialStack(Oxygen, 72))); // NaCa4(Si27Al9)O72 28(H2O) + public static Materials Kyanite = new Materials( + 924, + TextureSet.SET_FLINT, + 1.0F, + 0, + 2, + 1 | 8, + 110, + 110, + 250, + 0, + "Kyanite", + "Kyanite", + 0, + 0, + -1, + 0, + false, + false, + 1, + 1, + 1, + Dyes._NULL, + 1, + Arrays.asList( + new MaterialStack(Aluminium, 2), + new MaterialStack(Silicon, 1), + new MaterialStack(Oxygen, 5))); // Al2SiO5 + public static Materials Kaolinite = new Materials( + 929, + TextureSet.SET_DULL, + 1.0F, + 0, + 2, + 1 | 8, + 245, + 235, + 235, + 0, + "Kaolinite", + "Kaolinite", + 0, + 0, + -1, + 0, + false, + false, + 1, + 1, + 1, + Dyes._NULL, + 1, + Arrays.asList( + new MaterialStack(Aluminium, 2), + new MaterialStack(Silicon, 2), + new MaterialStack(Hydrogen, 4), + new MaterialStack(Oxygen, 9))); // Al2Si2O5(OH)4 + public static Materials Talc = new Materials( + 902, + TextureSet.SET_DULL, + 1.0F, + 0, + 2, + 1 | 8, + 90, + 180, + 90, + 0, + "Talc", + "Talc", + 0, + 0, + -1, + 0, + false, + false, + 1, + 1, + 1, + Dyes._NULL, + 1, + Arrays.asList( + new MaterialStack(Magnesium, 3), + new MaterialStack(Silicon, 4), + new MaterialStack(Hydrogen, 2), + new MaterialStack(Oxygen, 12))); // H2Mg3(SiO3)4 + public static Materials Soapstone = new Materials( + 877, + TextureSet.SET_DULL, + 1.0F, + 0, + 1, + 1 | 8, + 95, + 145, + 95, + 0, + "Soapstone", + "Soapstone", + 0, + 0, + -1, + 0, + false, + false, + 1, + 1, + 1, + Dyes._NULL, + 1, + Arrays.asList( + new MaterialStack(Magnesium, 3), + new MaterialStack(Silicon, 4), + new MaterialStack(Hydrogen, 2), + new MaterialStack(Oxygen, 12))); // H2Mg3(SiO3)4 + public static Materials Concrete = new Materials( + 947, + TextureSet.SET_ROUGH, + 1.0F, + 0, + 1, + 1, + 100, + 100, + 100, + 0, + "Concrete", + "Concrete", + 0, + 0, + 300, + 0, + false, + false, + 0, + 1, + 1, + Dyes.dyeGray, + 0, + Collections.singletonList(new MaterialStack(Stone, 1)), + Collections.singletonList(new TC_AspectStack(TC_Aspects.TERRA, 1))); + public static Materials IronMagnetic = new Materials( + 354, + TextureSet.SET_MAGNETIC, + 6.0F, + 256, + 2, + 1 | 2 | 64 | 128, + 200, + 200, + 200, + 0, + "IronMagnetic", + "Magnetic Iron", + 0, + 0, + -1, + 0, + false, + false, + 4, + 51, + 50, + Dyes.dyeGray, + 1, + Collections.singletonList(new MaterialStack(Iron, 1)), + Arrays.asList(new TC_AspectStack(TC_Aspects.METALLUM, 2), new TC_AspectStack(TC_Aspects.MAGNETO, 1))); + public static Materials SteelMagnetic = new Materials( + 355, + TextureSet.SET_MAGNETIC, + 6.0F, + 512, + 3, + 1 | 2 | 64 | 128, + 128, + 128, + 128, + 0, + "SteelMagnetic", + "Magnetic Steel", + 0, + 0, + 1000, + 1000, + true, + false, + 4, + 51, + 50, + Dyes.dyeGray, + 1, + Collections.singletonList(new MaterialStack(Steel, 1)), + Arrays.asList( + new TC_AspectStack(TC_Aspects.METALLUM, 1), + new TC_AspectStack(TC_Aspects.ORDO, 1), + new TC_AspectStack(TC_Aspects.MAGNETO, 1))); + public static Materials NeodymiumMagnetic = new Materials( + 356, + TextureSet.SET_MAGNETIC, + 7.0F, + 512, + 2, + 1 | 2 | 64 | 128, + 100, + 100, + 100, + 0, + "NeodymiumMagnetic", + "Magnetic Neodymium", + 0, + 0, + 1297, + 1297, + true, + false, + 4, + 51, + 50, + Dyes.dyeGray, + 1, + Collections.singletonList(new MaterialStack(Neodymium, 1)), + Arrays.asList(new TC_AspectStack(TC_Aspects.METALLUM, 1), new TC_AspectStack(TC_Aspects.MAGNETO, 3))); + public static Materials SamariumMagnetic = new Materials( + 399, + TextureSet.SET_MAGNETIC, + 1.0F, + 0, + 2, + 1 | 2 | 64 | 128, + 255, + 255, + 204, + 0, + "SamariumMagnetic", + "Magnetic Samarium", + 0, + 0, + 1345, + 1345, + true, + false, + 4, + 1, + 1, + Dyes.dyeWhite, + 1, + Collections.singletonList(new MaterialStack(Samarium, 1)), + Arrays.asList( + new TC_AspectStack(TC_Aspects.METALLUM, 2), + new TC_AspectStack(TC_Aspects.RADIO, 1), + new TC_AspectStack(TC_Aspects.MAGNETO, 10))); + public static Materials TungstenCarbide = new Materials( + 370, + TextureSet.SET_METALLIC, + 14.0F, + 1280, + 4, + 1 | 2 | 64 | 128, + 51, + 0, + 102, + 0, + "TungstenCarbide", + "Tungstencarbide", + 0, + 0, + 2460, + 2460, + true, + false, + 4, + 1, + 1, + Dyes.dyeBlack, + 2, + Arrays.asList(new MaterialStack(Tungsten, 1), new MaterialStack(Carbon, 1))); + public static Materials VanadiumSteel = new Materials( + 371, + TextureSet.SET_METALLIC, + 3.0F, + 1920, + 3, + 1 | 2 | 64 | 128, + 192, + 192, + 192, + 0, + "VanadiumSteel", + "Vanadiumsteel", + 0, + 0, + 1453, + 1453, + true, + false, + 4, + 1, + 1, + Dyes.dyeWhite, + 2, + Arrays.asList( + new MaterialStack(Vanadium, 1), new MaterialStack(Chrome, 1), new MaterialStack(Steel, 7))) + .disableAutoGeneratedBlastFurnaceRecipes(); + public static Materials HSSG = new Materials( + 372, + TextureSet.SET_METALLIC, + 10.0F, + 4000, + 3, + 1 | 2 | 64 | 128, + 153, + 153, + 0, + 0, + "HSSG", + "HSS-G", + 0, + 0, + 4500, + 4500, + true, + false, + 4, + 1, + 1, + Dyes.dyeYellow, + 2, + Arrays.asList( + new MaterialStack(TungstenSteel, 5), + new MaterialStack(Chrome, 1), + new MaterialStack(Molybdenum, 2), + new MaterialStack(Vanadium, 1))) + .disableAutoGeneratedBlastFurnaceRecipes(); + public static Materials HSSE = new Materials( + 373, + TextureSet.SET_METALLIC, + 32.0F, + 10240, + 7, + 1 | 2 | 64 | 128, + 51, + 102, + 0, + 0, + "HSSE", + "HSS-E", + 0, + 0, + 5400, + 5400, + true, + false, + 4, + 1, + 1, + Dyes.dyeGreen, + 2, + Arrays.asList( + new MaterialStack(HSSG, 6), + new MaterialStack(Cobalt, 1), + new MaterialStack(Manganese, 1), + new MaterialStack(Silicon, 1))) + .disableAutoGeneratedBlastFurnaceRecipes(); + public static Materials HSSS = new Materials( + 374, + TextureSet.SET_METALLIC, + 32.0F, + 10240, + 8, + 1 | 2 | 64 | 128, + 102, + 0, + 51, + 0, + "HSSS", + "HSS-S", + 0, + 0, + 5400, + 5400, + true, + false, + 4, + 1, + 1, + Dyes.dyeRed, + 2, + Arrays.asList( + new MaterialStack(HSSG, 6), new MaterialStack(Iridium, 2), new MaterialStack(Osmium, 1))) + .disableAutoGeneratedBlastFurnaceRecipes(); + public static Materials DilutedSulfuricAcid = new MaterialBuilder( + 640, TextureSet.SET_FLUID, "Diluted Sulfuric Acid") + .addCell() + .addFluid() + .setRGB(192, 120, 32) + .setColor(Dyes.dyeOrange) + .setMaterialList(new MaterialStack(SulfuricAcid, 1)) + .constructMaterial(); + public static Materials EpoxidFiberReinforced = new Materials( + 610, + TextureSet.SET_DULL, + 3.0F, + 64, + 1, + 1 | 2 | 64 | 128, + 160, + 112, + 16, + 0, + "EpoxidFiberReinforced", + "Fiber-Reinforced Epoxy Resin", + 0, + 0, + 400, + 0, + false, + false, + 1, + 1, + 1, + Dyes.dyeBrown, + 2, + Collections.singletonList(new MaterialStack(Epoxid, 1)), + Collections.singletonList(new TC_AspectStack(TC_Aspects.MOTUS, 2))); + public static Materials SodiumCarbonate = new MaterialBuilder(695, TextureSet.SET_QUARTZ, "Sodium Carbonate") + .setToolSpeed(1.0F) + .setDurability(64) + .setToolQuality(1) + .addDustItems() + .setRGB(255, 255, 235) + .setColor(Dyes.dyeWhite) + .setBlastFurnaceTemp(851) + .setMeltingPoint(851) + .setBlastFurnaceRequired(false) + .setOreValue(1) + .setExtraData(1) + .setMaterialList(new MaterialStack(Sodium, 2), new MaterialStack(Carbon, 1), new MaterialStack(Oxygen, 3)) + .constructMaterial() + .disableAutoGeneratedBlastFurnaceRecipes(); + public static Materials SodiumAluminate = new MaterialBuilder(696, TextureSet.SET_QUARTZ, "Sodium Aluminate") + .setToolSpeed(1.0F) + .setDurability(64) + .setToolQuality(1) + .addDustItems() + .setRGB(255, 235, 255) + .setColor(Dyes.dyeWhite) + .setBlastFurnaceTemp(1800) + .setMeltingPoint(1800) + .setBlastFurnaceRequired(false) + .setOreValue(1) + .setExtraData(0) + .setMaterialList( + new MaterialStack(Sodium, 1), new MaterialStack(Aluminium, 1), new MaterialStack(Oxygen, 2)) + .constructMaterial() + .disableAutoGeneratedBlastFurnaceRecipes(); + public static Materials Aluminiumoxide = new MaterialBuilder(697, TextureSet.SET_QUARTZ, "Alumina") + .setToolSpeed(1.0F) + .setDurability(64) + .setToolQuality(1) + .addDustItems() + .setRGB(235, 255, 255) + .setColor(Dyes.dyeWhite) + .setBlastFurnaceTemp(2054) + .setMeltingPoint(2054) + .setBlastFurnaceRequired(true) + .setOreValue(1) + .setExtraData(0) + .setMaterialList(new MaterialStack(Aluminium, 2), new MaterialStack(Oxygen, 3)) + .setAspects(Collections.singletonList(new TC_AspectStack(TC_Aspects.GELUM, 2))) + .constructMaterial() + .disableAutoGeneratedBlastFurnaceRecipes(); + public static Materials Aluminiumhydroxide = new MaterialBuilder(698, TextureSet.SET_QUARTZ, "Aluminium Hydroxide") + .setToolSpeed(1.0F) + .setDurability(64) + .setToolQuality(1) + .addDustItems() + .setRGB(235, 235, 255) + .setColor(Dyes.dyeWhite) + .setBlastFurnaceTemp(1200) + .setMeltingPoint(1200) + .setBlastFurnaceRequired(true) + .setOreValue(1) + .setExtraData(0) + .setMaterialList( + new MaterialStack(Aluminium, 1), new MaterialStack(Oxygen, 3), new MaterialStack(Hydrogen, 3)) + .setAspects(Collections.singletonList(new TC_AspectStack(TC_Aspects.GELUM, 2))) + .constructMaterial() + .disableAutoGeneratedBlastFurnaceRecipes(); + public static Materials Cryolite = new MaterialBuilder(699, TextureSet.SET_QUARTZ, "Cryolite") + .setToolSpeed(1.0F) + .setDurability(64) + .setToolQuality(1) + .addOreItems() + .setRGB(191, 239, 255) + .setColor(Dyes.dyeLightBlue) + .setMeltingPoint(1012) + .setBlastFurnaceTemp(1012) + .setExtraData(1) + .setMaterialList( + new MaterialStack(Sodium, 3), new MaterialStack(Aluminium, 1), new MaterialStack(Fluorine, 6)) + .constructMaterial() + .disableAutoGeneratedBlastFurnaceRecipes(); + public static Materials RedMud = new MaterialBuilder(743, TextureSet.SET_FLUID, "Red Mud") + .addCell() + .addFluid() + .setRGB(140, 22, 22) + .setColor(Dyes.dyeRed) + .constructMaterial(); + + public static Materials Brick = new MaterialBuilder(625, TextureSet.SET_ROUGH, "Brick") + .addDustItems() + .setRGB(155, 86, 67) + .setColor(Dyes.dyeBrown) + .setExtraData(2) + .setMaterialList( + new MaterialStack(Aluminium, 4), new MaterialStack(Silicon, 3), new MaterialStack(Oxygen, 6)) + .constructMaterial(); + public static Materials Fireclay = new MaterialBuilder(626, TextureSet.SET_ROUGH, "Fireclay") + .addDustItems() + .setRGB(173, 160, 155) + .setExtraData(2) + .setColor(Dyes.dyeBrown) + .setMaterialList(new MaterialStack(Brick, 1)) + .constructMaterial(); // Polybenzimidazole stuff - public static Materials PotassiumNitrade = new MaterialBuilder(590, TextureSet.SET_DULL , "Potassium Nitrate").setName("PotassiumNitrate").addDustItems().setRGB(129, 34, 141).setColor(Dyes.dyePurple).setMaterialList(new MaterialStack(Potassium, 1), new MaterialStack(Nitrogen, 1), new MaterialStack(Oxygen, 3)).addElectrolyzerRecipe().constructMaterial(); - public static Materials ChromiumTrioxide = new MaterialBuilder(591, TextureSet.SET_DULL , "Chromium Trioxide").setName("Chromiumtrioxide").addDustItems().setRGB(255, 228, 225).setColor(Dyes.dyePink).setMaterialList(new MaterialStack(Chrome, 1), new MaterialStack(Oxygen, 3)).addElectrolyzerRecipe().constructMaterial(); - public static Materials Nitrochlorobenzene = new MaterialBuilder(592, TextureSet.SET_FLUID , "2-Nitrochlorobenzene").addCell().addFluid().setRGB(143, 181, 26).setColor(Dyes.dyeLime).setMaterialList(new MaterialStack(Carbon, 6), new MaterialStack(Hydrogen, 4), new MaterialStack(Chlorine, 1), new MaterialStack(Nitrogen, 1), new MaterialStack(Oxygen, 2)).constructMaterial(); - public static Materials Dimethylbenzene = new MaterialBuilder(593, TextureSet.SET_FLUID , "1,2-Dimethylbenzen").setName("Dimethylbenzene").addCell().addFluid().setRGB(102, 156, 64).setColor(Dyes.dyeLime).setMeltingPoint(248).setMaterialList(new MaterialStack(Carbon, 8), new MaterialStack(Hydrogen, 10)).addElectrolyzerRecipe().constructMaterial(); - public static Materials Potassiumdichromate = new MaterialBuilder(594, TextureSet.SET_DULL , "Potassium Dichromate").setName("PotassiumDichromate").addDustItems().setRGB(255, 8, 127).setColor(Dyes.dyePink).setMaterialList(new MaterialStack(Potassium, 2), new MaterialStack(Chrome, 2), new MaterialStack(Oxygen, 7)).addElectrolyzerRecipe().constructMaterial(); - public static Materials PhthalicAcid = new MaterialBuilder(595, TextureSet.SET_FLUID , "Phthalic Acid").setName("phtalicacid").addCell().addFluid().setRGB(54, 133, 71).setColor(Dyes.dyeOrange).setMaterialList(new MaterialStack(Carbon, 8), new MaterialStack(Hydrogen, 6), new MaterialStack(Oxygen, 4)).constructMaterial(); - public static Materials Dichlorobenzidine = new MaterialBuilder(596, TextureSet.SET_FLUID , "3,3-Dichlorobenzidine").addCell().addFluid().setRGB(161, 222, 166).setColor(Dyes.dyeOrange).setMaterialList(new MaterialStack(Carbon, 12),new MaterialStack(Hydrogen, 10), new MaterialStack(Nitrogen, 2), new MaterialStack(Chlorine, 2)).constructMaterial(); - public static Materials Diaminobenzidin = new MaterialBuilder(597, TextureSet.SET_FLUID , "3,3-Diaminobenzidine").addCell().addFluid().setRGB(51, 125, 89).setColor(Dyes.dyeOrange).setMaterialList(new MaterialStack(Carbon, 12),new MaterialStack(Hydrogen, 14),new MaterialStack(Nitrogen, 4)).constructMaterial(); - public static Materials Diphenylisophthalate = new MaterialBuilder(598, TextureSet.SET_FLUID , "Diphenyl Isophtalate").addCell().addFluid().setRGB(36, 110, 87).setColor(Dyes.dyeOrange).setMaterialList(new MaterialStack(Carbon, 20),new MaterialStack(Hydrogen, 14),new MaterialStack(Oxygen, 4)).constructMaterial(); - public static Materials Polybenzimidazole = new Materials(599, TextureSet.SET_DULL ,3.0F, 64, 1, 1|2 |64|128 , 45, 45, 45, 0, "Polybenzimidazole" , "Polybenzimidazole" , 0, 0, 1450, 0, false, false, 1, 1, 1, Dyes.dyeBlack , 0, Arrays.asList(new MaterialStack(Carbon, 20), new MaterialStack(Nitrogen, 4), new MaterialStack(Hydrogen, 12)), Arrays.asList(new TC_AspectStack(TC_Aspects.ORDO, 2),new TC_AspectStack(TC_Aspects.VOLATUS, 1))); - - //Gasoline - public static Materials MTBEMixture = new MaterialBuilder(983, TextureSet.SET_FLUID , "MTBE Reaction Mixture").addCell().addGas().setRGB(255, 255, 255).setColor(Dyes.dyeWhite).setMaterialList(new MaterialStack(Carbon, 5), new MaterialStack(Hydrogen, 12), new MaterialStack(Oxygen, 1)).constructMaterial(); - public static Materials NitrousOxide = new MaterialBuilder(993, TextureSet.SET_FLUID , "Nitrous Oxide").addCell().addGas().setRGB(125, 200, 255).setColor(Dyes.dyeBlue).setMaterialList(new MaterialStack(Nitrogen, 2), new MaterialStack(Oxygen, 1)).addElectrolyzerRecipe().constructMaterial(); - public static Materials AntiKnock = new MaterialBuilder(994, TextureSet.SET_FLUID , "Anti-Knock Agent").setName("EthylTertButylEther").addCell().addFluid().setRGB(255, 255, 255).setColor(Dyes.dyeWhite).setMaterialList(new MaterialStack(Carbon, 6), new MaterialStack(Hydrogen, 14), new MaterialStack(Oxygen, 1)).constructMaterial(); - public static Materials Octane = new MaterialBuilder(995, TextureSet.SET_FLUID , "Octane").addCell().addFluid().setRGB(255, 255, 255).setColor(Dyes.dyeWhite).setFuelType(MaterialBuilder.DIESEL).setFuelPower(80).setMaterialList(new MaterialStack(Carbon, 8), new MaterialStack(Hydrogen, 18)).constructMaterial(); - public static Materials GasolineRaw = new MaterialBuilder(996, TextureSet.SET_FLUID , "Raw Gasoline").addCell().addFluid().setRGB(255,100,0).setColor(Dyes.dyeOrange).constructMaterial(); - public static Materials GasolineRegular = new MaterialBuilder(997, TextureSet.SET_FLUID , "Gasoline").addCell().addFluid().setRGB(255,165,0).setColor(Dyes.dyeOrange).setFuelType(MaterialBuilder.DIESEL).setFuelPower(576).constructMaterial(); - public static Materials GasolinePremium = new MaterialBuilder(998, TextureSet.SET_FLUID , "High Octane Gasoline").addCell().addFluid().setRGB(255,165,0).setColor(Dyes.dyeOrange).setFuelType(MaterialBuilder.DIESEL).setFuelPower(2500).constructMaterial(); - - //ADDED - public static Materials Electrotine = new Materials( 812, TextureSet.SET_SHINY , 1.0F, 0, 1, 1 |8 , 60, 180, 200, 0, "Electrotine" , "Electrotine" , 0, 0, -1, 0, false, false, 3, 1, 1, Dyes.dyeCyan , 0, Arrays.asList(new MaterialStack(Redstone, 1), new MaterialStack(Electrum, 1)), Collections.singletonList(new TC_AspectStack(TC_Aspects.ELECTRUM, 2))); - public static Materials Galgadorian = new Materials( 384, TextureSet.SET_METALLIC , 16.0F, 3600, 3, 1|2 |64|128 , 154, 105, 119, 0, "Galgadorian" , "Galgadorian" , 0, 0, 3000, 3000, true, false, 1, 1, 1, Dyes.dyePink ).disableAutoGeneratedBlastFurnaceRecipes(); - public static Materials EnhancedGalgadorian = new Materials( 385, TextureSet.SET_METALLIC , 32.0F, 7200, 5, 1|2| 64|128 , 152, 93, 133, 0, "EnhancedGalgadorian" , "Enhanced Galgadorian" , 0, 0, 4500, 4500, true, false, 1, 1, 1, Dyes.dyePink ).disableAutoGeneratedBlastFurnaceRecipes(); - public static Materials BloodInfusedIron = new Materials( 977, TextureSet.SET_METALLIC , 10.0F, 384, 2, 1|2 |64|128 , 69, 9, 10, 0, "BloodInfusedIron" , "Blood Infused Iron" , 0, 0, 2400, 0, false, false, 3, 1, 1, Dyes.dyeRed , Arrays.asList(new TC_AspectStack(TC_Aspects.METALLUM, 3), new TC_AspectStack(TC_Aspects.PRAECANTATIO, 1))); - public static Materials Shadow = new Materials( 368, TextureSet.SET_METALLIC , 32.0F, 8192, 4, 1|2 |8 |64|128 , 16, 3, 66, 0, "Shadow" , "Shadow Metal" , 0, 0, 1800, 1800, true, false, 3, 4, 3, Dyes.dyeBlue ); + public static Materials PotassiumNitrade = new MaterialBuilder(590, TextureSet.SET_DULL, "Potassium Nitrate") + .setName("PotassiumNitrate") + .addDustItems() + .setRGB(129, 34, 141) + .setColor(Dyes.dyePurple) + .setMaterialList( + new MaterialStack(Potassium, 1), new MaterialStack(Nitrogen, 1), new MaterialStack(Oxygen, 3)) + .addElectrolyzerRecipe() + .constructMaterial(); + public static Materials ChromiumTrioxide = new MaterialBuilder(591, TextureSet.SET_DULL, "Chromium Trioxide") + .setName("Chromiumtrioxide") + .addDustItems() + .setRGB(255, 228, 225) + .setColor(Dyes.dyePink) + .setMaterialList(new MaterialStack(Chrome, 1), new MaterialStack(Oxygen, 3)) + .addElectrolyzerRecipe() + .constructMaterial(); + public static Materials Nitrochlorobenzene = new MaterialBuilder(592, TextureSet.SET_FLUID, "2-Nitrochlorobenzene") + .addCell() + .addFluid() + .setRGB(143, 181, 26) + .setColor(Dyes.dyeLime) + .setMaterialList( + new MaterialStack(Carbon, 6), + new MaterialStack(Hydrogen, 4), + new MaterialStack(Chlorine, 1), + new MaterialStack(Nitrogen, 1), + new MaterialStack(Oxygen, 2)) + .constructMaterial(); + public static Materials Dimethylbenzene = new MaterialBuilder(593, TextureSet.SET_FLUID, "1,2-Dimethylbenzen") + .setName("Dimethylbenzene") + .addCell() + .addFluid() + .setRGB(102, 156, 64) + .setColor(Dyes.dyeLime) + .setMeltingPoint(248) + .setMaterialList(new MaterialStack(Carbon, 8), new MaterialStack(Hydrogen, 10)) + .addElectrolyzerRecipe() + .constructMaterial(); + public static Materials Potassiumdichromate = new MaterialBuilder(594, TextureSet.SET_DULL, "Potassium Dichromate") + .setName("PotassiumDichromate") + .addDustItems() + .setRGB(255, 8, 127) + .setColor(Dyes.dyePink) + .setMaterialList( + new MaterialStack(Potassium, 2), new MaterialStack(Chrome, 2), new MaterialStack(Oxygen, 7)) + .addElectrolyzerRecipe() + .constructMaterial(); + public static Materials PhthalicAcid = new MaterialBuilder(595, TextureSet.SET_FLUID, "Phthalic Acid") + .setName("phtalicacid") + .addCell() + .addFluid() + .setRGB(54, 133, 71) + .setColor(Dyes.dyeOrange) + .setMaterialList(new MaterialStack(Carbon, 8), new MaterialStack(Hydrogen, 6), new MaterialStack(Oxygen, 4)) + .constructMaterial(); + public static Materials Dichlorobenzidine = new MaterialBuilder(596, TextureSet.SET_FLUID, "3,3-Dichlorobenzidine") + .addCell() + .addFluid() + .setRGB(161, 222, 166) + .setColor(Dyes.dyeOrange) + .setMaterialList( + new MaterialStack(Carbon, 12), + new MaterialStack(Hydrogen, 10), + new MaterialStack(Nitrogen, 2), + new MaterialStack(Chlorine, 2)) + .constructMaterial(); + public static Materials Diaminobenzidin = new MaterialBuilder(597, TextureSet.SET_FLUID, "3,3-Diaminobenzidine") + .addCell() + .addFluid() + .setRGB(51, 125, 89) + .setColor(Dyes.dyeOrange) + .setMaterialList( + new MaterialStack(Carbon, 12), new MaterialStack(Hydrogen, 14), new MaterialStack(Nitrogen, 4)) + .constructMaterial(); + public static Materials Diphenylisophthalate = new MaterialBuilder( + 598, TextureSet.SET_FLUID, "Diphenyl Isophtalate") + .addCell() + .addFluid() + .setRGB(36, 110, 87) + .setColor(Dyes.dyeOrange) + .setMaterialList( + new MaterialStack(Carbon, 20), new MaterialStack(Hydrogen, 14), new MaterialStack(Oxygen, 4)) + .constructMaterial(); + public static Materials Polybenzimidazole = new Materials( + 599, + TextureSet.SET_DULL, + 3.0F, + 64, + 1, + 1 | 2 | 64 | 128, + 45, + 45, + 45, + 0, + "Polybenzimidazole", + "Polybenzimidazole", + 0, + 0, + 1450, + 0, + false, + false, + 1, + 1, + 1, + Dyes.dyeBlack, + 0, + Arrays.asList( + new MaterialStack(Carbon, 20), new MaterialStack(Nitrogen, 4), new MaterialStack(Hydrogen, 12)), + Arrays.asList(new TC_AspectStack(TC_Aspects.ORDO, 2), new TC_AspectStack(TC_Aspects.VOLATUS, 1))); + + // Gasoline + public static Materials MTBEMixture = new MaterialBuilder(983, TextureSet.SET_FLUID, "MTBE Reaction Mixture") + .addCell() + .addGas() + .setRGB(255, 255, 255) + .setColor(Dyes.dyeWhite) + .setMaterialList( + new MaterialStack(Carbon, 5), new MaterialStack(Hydrogen, 12), new MaterialStack(Oxygen, 1)) + .constructMaterial(); + public static Materials NitrousOxide = new MaterialBuilder(993, TextureSet.SET_FLUID, "Nitrous Oxide") + .addCell() + .addGas() + .setRGB(125, 200, 255) + .setColor(Dyes.dyeBlue) + .setMaterialList(new MaterialStack(Nitrogen, 2), new MaterialStack(Oxygen, 1)) + .addElectrolyzerRecipe() + .constructMaterial(); + public static Materials AntiKnock = new MaterialBuilder(994, TextureSet.SET_FLUID, "Anti-Knock Agent") + .setName("EthylTertButylEther") + .addCell() + .addFluid() + .setRGB(255, 255, 255) + .setColor(Dyes.dyeWhite) + .setMaterialList( + new MaterialStack(Carbon, 6), new MaterialStack(Hydrogen, 14), new MaterialStack(Oxygen, 1)) + .constructMaterial(); + public static Materials Octane = new MaterialBuilder(995, TextureSet.SET_FLUID, "Octane") + .addCell() + .addFluid() + .setRGB(255, 255, 255) + .setColor(Dyes.dyeWhite) + .setFuelType(MaterialBuilder.DIESEL) + .setFuelPower(80) + .setMaterialList(new MaterialStack(Carbon, 8), new MaterialStack(Hydrogen, 18)) + .constructMaterial(); + public static Materials GasolineRaw = new MaterialBuilder(996, TextureSet.SET_FLUID, "Raw Gasoline") + .addCell() + .addFluid() + .setRGB(255, 100, 0) + .setColor(Dyes.dyeOrange) + .constructMaterial(); + public static Materials GasolineRegular = new MaterialBuilder(997, TextureSet.SET_FLUID, "Gasoline") + .addCell() + .addFluid() + .setRGB(255, 165, 0) + .setColor(Dyes.dyeOrange) + .setFuelType(MaterialBuilder.DIESEL) + .setFuelPower(576) + .constructMaterial(); + public static Materials GasolinePremium = new MaterialBuilder(998, TextureSet.SET_FLUID, "High Octane Gasoline") + .addCell() + .addFluid() + .setRGB(255, 165, 0) + .setColor(Dyes.dyeOrange) + .setFuelType(MaterialBuilder.DIESEL) + .setFuelPower(2500) + .constructMaterial(); + + // ADDED + public static Materials Electrotine = new Materials( + 812, + TextureSet.SET_SHINY, + 1.0F, + 0, + 1, + 1 | 8, + 60, + 180, + 200, + 0, + "Electrotine", + "Electrotine", + 0, + 0, + -1, + 0, + false, + false, + 3, + 1, + 1, + Dyes.dyeCyan, + 0, + Arrays.asList(new MaterialStack(Redstone, 1), new MaterialStack(Electrum, 1)), + Collections.singletonList(new TC_AspectStack(TC_Aspects.ELECTRUM, 2))); + public static Materials Galgadorian = new Materials( + 384, + TextureSet.SET_METALLIC, + 16.0F, + 3600, + 3, + 1 | 2 | 64 | 128, + 154, + 105, + 119, + 0, + "Galgadorian", + "Galgadorian", + 0, + 0, + 3000, + 3000, + true, + false, + 1, + 1, + 1, + Dyes.dyePink) + .disableAutoGeneratedBlastFurnaceRecipes(); + public static Materials EnhancedGalgadorian = new Materials( + 385, + TextureSet.SET_METALLIC, + 32.0F, + 7200, + 5, + 1 | 2 | 64 | 128, + 152, + 93, + 133, + 0, + "EnhancedGalgadorian", + "Enhanced Galgadorian", + 0, + 0, + 4500, + 4500, + true, + false, + 1, + 1, + 1, + Dyes.dyePink) + .disableAutoGeneratedBlastFurnaceRecipes(); + public static Materials BloodInfusedIron = new Materials( + 977, + TextureSet.SET_METALLIC, + 10.0F, + 384, + 2, + 1 | 2 | 64 | 128, + 69, + 9, + 10, + 0, + "BloodInfusedIron", + "Blood Infused Iron", + 0, + 0, + 2400, + 0, + false, + false, + 3, + 1, + 1, + Dyes.dyeRed, + Arrays.asList(new TC_AspectStack(TC_Aspects.METALLUM, 3), new TC_AspectStack(TC_Aspects.PRAECANTATIO, 1))); + public static Materials Shadow = new Materials( + 368, + TextureSet.SET_METALLIC, + 32.0F, + 8192, + 4, + 1 | 2 | 8 | 64 | 128, + 16, + 3, + 66, + 0, + "Shadow", + "Shadow Metal", + 0, + 0, + 1800, + 1800, + true, + false, + 3, + 4, + 3, + Dyes.dyeBlue); /** * Galaxy Space 1.10 compat from Version 2.6 */ - public static Materials Ledox = new Materials( 390, TextureSet.SET_SHINY , 15.0F, 1024, 4, 1|2 |8 |64|128 , 0, 116, 255, 0, "Ledox" , "Ledox" , 0, 0, -1, 0, false, false, 4, 1, 1, Dyes.dyeBlue ); - public static Materials Quantium = new Materials( 391, TextureSet.SET_SHINY , 18.0F, 2048, 4, 1|2 |8 |64|128 , 0, 209, 11, 0, "Quantium" , "Quantium" , 0, 0, 9900, 9900, true, false, 4, 1, 1, Dyes.dyeLime ); - public static Materials Mytryl = new Materials( 387, TextureSet.SET_SHINY , 8.0F, 512, 4, 1|2 |8 |64|128 , 242, 100, 4, 0, "Mytryl" , "Mytryl" , 0, 0, 3600, 3600, true, false, 4, 1, 1, Dyes.dyeOrange ); - public static Materials BlackPlutonium = new Materials( 388, TextureSet.SET_DULL , 36.0F, 8192, 8, 1|2 |8 |64|128 , 50, 50, 50, 0, "BlackPlutonium" , "Black Plutonium" , 0, 0, 9000, 9000, true, false, 4, 1, 1, Dyes.dyeBlack ).disableAutoGeneratedBlastFurnaceRecipes(); - public static Materials CallistoIce = new Materials( 389, TextureSet.SET_SHINY , 9.0F, 1024, 4, 1|2 |8 |64|128 , 30, 177, 255, 0, "CallistoIce" , "Callisto Ice" , 0, 0, -1, 0, false, false, 4, 1, 1, Dyes.dyeLightBlue ); - public static Materials Duralumin = new Materials( 392, TextureSet.SET_SHINY , 16.0F, 512, 3, 1|2 |8 |64|128 , 235, 209, 160, 0, "Duralumin" , "Duralumin" , 0, 0, 1600, 1600, true, false, 4, 1, 1, Dyes.dyeOrange , 2, Arrays.asList(new MaterialStack(Aluminium, 6), new MaterialStack(Copper, 1), new MaterialStack(Manganese, 1), new MaterialStack(Magnesium, 1))); - public static Materials Oriharukon = new Materials( 393, TextureSet.SET_SHINY , 32.0F, 10240, 5, 1|2 |8 |64|128 , 103, 125, 104, 0, "Oriharukon" , "Oriharukon" , 0, 0, 5400, 5400, true, false, 4, 1, 1, Dyes.dyeLime , Element.Oh, Arrays.asList(new TC_AspectStack(TC_Aspects.METALLUM, 2),new TC_AspectStack(TC_Aspects.LUCRUM, 2), new TC_AspectStack(TC_Aspects.ALIENIS, 1))).disableAutoGeneratedBlastFurnaceRecipes(); - public static Materials MysteriousCrystal = new Materials( 398, TextureSet.SET_SHINY , 8.0F, 256, 6, 1|2 |8 |64|128 , 22, 133, 108, 0, "MysteriousCrystal" , "Mysterious Crystal" , 0, 0, 7200, 7200, true, false, 4, 1, 1, Dyes.dyeCyan ).disableAutoGeneratedBlastFurnaceRecipes(); - - //\/HAD TO MOVE DOWN SECTION - public static Materials RedstoneAlloy = new Materials( 381, TextureSet.SET_METALLIC , 3.0F, 128, 2, 1|2 |64|128 , 181, 51, 51, 0, "RedstoneAlloy" , "Redstone Alloy" , 0, 0, 671, 1000, true, false, 1, 1, 1, Dyes.dyeRed , 1, Arrays.asList(new MaterialStack(Redstone, 1), new MaterialStack(Silicon, 1), new MaterialStack(Coal, 1))).disableAutoGeneratedBlastFurnaceRecipes(); - public static Materials Soularium = new Materials( 379, TextureSet.SET_METALLIC , 8.0F, 256, 2, 1|2 |64|128 , 65, 46, 29, 0, "Soularium" , "Soularium" , 0, 0, 800, 1000, true, false, 3, 1, 1, Dyes.dyeBrown , 1, Arrays.asList(new MaterialStack(SoulSand, 1), new MaterialStack(Gold, 1), new MaterialStack(Ash, 1))).disableAutoGeneratedBlastFurnaceRecipes(); - public static Materials ConductiveIron = new Materials( 369, TextureSet.SET_METALLIC , 6.0F, 256, 3, 1|2 |64|128 , 217, 178, 171, 0, "ConductiveIron" , "Conductive Iron" , 0, 0, -1, 1200, true, false, 4, 1, 1, Dyes.dyeRed , 1, Arrays.asList(new MaterialStack(RedstoneAlloy, 1), new MaterialStack(Iron, 1), new MaterialStack(Silver, 1))).disableAutoGeneratedBlastFurnaceRecipes(); - public static Materials ElectricalSteel = new Materials( 365, TextureSet.SET_METALLIC , 6.0F, 512, 2, 1|2 |64|128 , 185, 185, 185, 0, "ElectricalSteel" , "Electrical Steel" , 0, 0, 1811, 1000, true, false, 4, 1, 1, Dyes.dyeGray , 1, Arrays.asList(new MaterialStack(Steel, 1), new MaterialStack(Coal, 1), new MaterialStack(Silicon, 1))).disableAutoGeneratedBlastFurnaceRecipes(); - public static Materials EnergeticAlloy = new Materials( 366, TextureSet.SET_METALLIC , 12.0F, 1024, 3, 1|2 |64|128 , 255, 170, 81, 0, "EnergeticAlloy" , "Energetic Alloy" , 0, 0, -1, 2200, true, false, 3, 1, 1, Dyes.dyeOrange , 1, Arrays.asList(new MaterialStack(ConductiveIron, 1), new MaterialStack(Gold, 1), new MaterialStack(BlackSteel, 1))).disableAutoGeneratedBlastFurnaceRecipes(); - public static Materials VibrantAlloy = new Materials( 367, TextureSet.SET_METALLIC , 18.0F, 4048, 4, 1|2 |64|128 , 157, 188, 53, 0, "VibrantAlloy" , "Vibrant Alloy" , 0, 0, 3300, 3300, true, false, 4, 1, 1, Dyes.dyeLime , 1, Arrays.asList(new MaterialStack(EnergeticAlloy, 1), new MaterialStack(EnderEye, 1), new MaterialStack(Chrome, 1))).disableAutoGeneratedBlastFurnaceRecipes(); - public static Materials PulsatingIron = new Materials( 378, TextureSet.SET_METALLIC , 6.0F, 256, 3, 1|2 |64|128 , 128, 246, 155, 0, "PulsatingIron" , "Pulsating Iron" , 0, 0, -1, 1800, true, false, 4, 1, 1, Dyes.dyeLime , 1, Arrays.asList(new MaterialStack(Iron, 1), new MaterialStack(EnderPearl, 1), new MaterialStack(RedstoneAlloy, 1))).disableAutoGeneratedBlastFurnaceRecipes(); - public static Materials DarkSteel = new Materials( 364, TextureSet.SET_METALLIC , 8.0F, 512, 3, 1|2 |64|128 , 80, 70, 80, 0, "DarkSteel" , "Dark Steel" , 0, 0, -1, 1800, true, false, 3, 1, 1, Dyes.dyePurple , 1, Arrays.asList(new MaterialStack(ElectricalSteel, 1), new MaterialStack(Coal, 1), new MaterialStack(Obsidian, 1))).disableAutoGeneratedBlastFurnaceRecipes(); - public static Materials EndSteel = new Materials( 401, TextureSet.SET_METALLIC , 12.0F, 2000, 4, 1|2 |64|128 , 223, 217, 165, 0, "EndSteel" , "End Steel" , 0, 0, 940, 3600, true, false, 3, 1, 1, Dyes.dyeYellow , 1, Arrays.asList(new MaterialStack(DarkSteel, 1), new MaterialStack(Tungsten, 1), new MaterialStack(Endstone, 1))).disableAutoGeneratedBlastFurnaceRecipes(); - public static Materials CrudeSteel = new Materials( 402, TextureSet.SET_METALLIC , 2.0F, 64, 2, 1|2 |64|128 , 163, 158, 154, 0, "CrudeSteel" , "Clay Compound" , 0, 0, -1, 1000, false,false, 4, 1, 1, Dyes.dyeGray , 1, Arrays.asList(new MaterialStack(Stone, 1), new MaterialStack(Clay, 1), new MaterialStack(Flint, 1))).disableAutoGeneratedBlastFurnaceRecipes(); - public static Materials CrystallineAlloy = new Materials( 403, TextureSet.SET_METALLIC , 18.0F, 768, 4, 1|2 |64|128 , 114, 197, 197, 0, "CrystallineAlloy" , "Crystalline Alloy" , 0, 0, 4500, 4500, true, false, 4, 1, 1, Dyes.dyeCyan , 1, Arrays.asList(new MaterialStack(Gold, 1), new MaterialStack(Diamond, 1), new MaterialStack(PulsatingIron, 1))).disableAutoGeneratedBlastFurnaceRecipes(); - public static Materials MelodicAlloy = new Materials( 404, TextureSet.SET_METALLIC , 24.0F, 1024, 5, 1|2 |64|128 , 136, 98, 136, 0, "MelodicAlloy" , "Melodic Alloy" , 0, 0, 5400, 5400, true, false, 4, 1, 1, Dyes.dyeMagenta , 1, Arrays.asList(new MaterialStack(EndSteel, 1), new MaterialStack(EnderEye, 1), new MaterialStack(Oriharukon, 1))).disableAutoGeneratedBlastFurnaceRecipes(); - public static Materials StellarAlloy = new Materials( 405, TextureSet.SET_METALLIC , 96.0F, 10240, 7, 1|2 |64|128 , 217, 220, 203, 0, "StellarAlloy" , "Stellar Alloy" , 0, 0, 7200, 7200, true, false, 4, 1, 1, Dyes.dyeWhite , 1, Arrays.asList(new MaterialStack(NetherStar, 1), new MaterialStack(MelodicAlloy, 1), new MaterialStack(Naquadah, 1))).disableAutoGeneratedBlastFurnaceRecipes(); - public static Materials CrystallinePinkSlime = new Materials( 406, TextureSet.SET_METALLIC , 6.0F, 128, 3, 1|2 |64|128 , 231, 158, 219, 0, "CrystallinePinkSlime" , "Crystalline Pink Slime" , 0, 0, 5000, 5000, true, false, 4, 1, 1, Dyes.dyePink , 1, Arrays.asList(new MaterialStack(CrystallineAlloy, 1), new MaterialStack(Diamond, 1))).disableAutoGeneratedBlastFurnaceRecipes(); - public static Materials EnergeticSilver = new Materials( 407, TextureSet.SET_METALLIC , 8.0F, 512, 3, 1|2 |64|128 , 149, 183, 205, 0, "EnergeticSilver" , "Energetic Silver" , 0, 0, -1, 2200, true, false, 4, 1, 1, Dyes.dyeLightBlue , 1, Arrays.asList(new MaterialStack(Silver, 1), new MaterialStack(ConductiveIron, 1), new MaterialStack(BlackSteel, 1))).disableAutoGeneratedBlastFurnaceRecipes(); - public static Materials VividAlloy = new Materials( 408, TextureSet.SET_METALLIC , 12.0F, 768, 4, 1|2 |64|128 , 70, 188, 219, 0, "VividAlloy" , "Vivid Alloy" , 0, 0, 3300, 3300, true, false, 4, 1, 1, Dyes.dyeBlue , 1, Arrays.asList(new MaterialStack(EnergeticSilver, 1), new MaterialStack(EnderEye, 1), new MaterialStack(Chrome, 1))).disableAutoGeneratedBlastFurnaceRecipes(); - public static Materials Enderium = new Materials( 321, TextureSet.SET_DULL , 8.0F, 1500, 3, 1|2 |64|128 , 89, 145, 135, 0, "Enderium" , "Enderium" , 0, 0, 4500, 4500, true, false, 1, 1, 1, Dyes.dyeGreen , 1, Arrays.asList(new MaterialStack(EnderiumBase, 2), new MaterialStack(Thaumium, 1), new MaterialStack(EnderPearl, 1)), Arrays.asList(new TC_AspectStack(TC_Aspects.METALLUM, 2), new TC_AspectStack(TC_Aspects.ALIENIS, 1))).disableAutoGeneratedBlastFurnaceRecipes(); - public static Materials Mithril = new Materials( 331, TextureSet.SET_SHINY , 32.0F, 64, 2, 1|2 |8 |64 , 255, 255, 210, 0, "Mithril" , "Mithril" , 0, 0, -1, 0, false, false, 4, 3, 2, Dyes.dyeLightBlue , 2, Arrays.asList(new MaterialStack(Platinum, 2), new MaterialStack(Thaumium, 1))).disableAutoGeneratedBlastFurnaceRecipes().setTurbineMultipliers(22, 1, 1); - public static Materials BlueAlloy = new Materials( 309, TextureSet.SET_DULL , 1.0F, 0, 0, 1|2 , 100, 180, 255, 0, "BlueAlloy" , "Blue Alloy" , 0, 0, -1, 0, false, false, 3, 5, 1, Dyes.dyeLightBlue , 2, Arrays.asList(new MaterialStack(Silver, 1), new MaterialStack(Electrotine, 4)), Collections.singletonList(new TC_AspectStack(TC_Aspects.ELECTRUM, 3))); - public static Materials ShadowIron = new Materials( 336, TextureSet.SET_METALLIC , 32.0F, 10240, 2, 1|2 |8 |64 , 120, 120, 120, 0, "ShadowIron" , "Shadow Iron" , 0, 0, -1, 0, false, false, 3, 4, 3, Dyes.dyeBlack , 2, Arrays.asList(new MaterialStack(Iron, 1), new MaterialStack(Thaumium, 3))).disableAutoGeneratedBlastFurnaceRecipes().setTurbineMultipliers(1, 76, 1); - public static Materials ShadowSteel = new Materials( 337, TextureSet.SET_METALLIC , 6.0F, 768, 4, 1|2 |64 , 90, 90, 90, 0, "ShadowSteel" , "Shadow Steel" , 0, 0, -1, 1700, true, false, 4, 4, 3, Dyes.dyeBlack , 2, Arrays.asList(new MaterialStack(Steel, 1), new MaterialStack(Thaumium, 3))); - public static Materials AstralSilver = new Materials( 333, TextureSet.SET_SHINY , 10.0F, 64, 2, 1|2 |64 , 230, 230, 255, 0, "AstralSilver" , "Astral Silver" , 0, 0, -1, 0, false, false, 4, 3, 2, Dyes.dyeWhite , 2, Arrays.asList(new MaterialStack(Silver, 2), new MaterialStack(Thaumium, 1))); - - /** + public static Materials Ledox = new Materials( + 390, + TextureSet.SET_SHINY, + 15.0F, + 1024, + 4, + 1 | 2 | 8 | 64 | 128, + 0, + 116, + 255, + 0, + "Ledox", + "Ledox", + 0, + 0, + -1, + 0, + false, + false, + 4, + 1, + 1, + Dyes.dyeBlue); + + public static Materials Quantium = new Materials( + 391, + TextureSet.SET_SHINY, + 18.0F, + 2048, + 4, + 1 | 2 | 8 | 64 | 128, + 0, + 209, + 11, + 0, + "Quantium", + "Quantium", + 0, + 0, + 9900, + 9900, + true, + false, + 4, + 1, + 1, + Dyes.dyeLime); + public static Materials Mytryl = new Materials( + 387, + TextureSet.SET_SHINY, + 8.0F, + 512, + 4, + 1 | 2 | 8 | 64 | 128, + 242, + 100, + 4, + 0, + "Mytryl", + "Mytryl", + 0, + 0, + 3600, + 3600, + true, + false, + 4, + 1, + 1, + Dyes.dyeOrange); + public static Materials BlackPlutonium = new Materials( + 388, + TextureSet.SET_DULL, + 36.0F, + 8192, + 8, + 1 | 2 | 8 | 64 | 128, + 50, + 50, + 50, + 0, + "BlackPlutonium", + "Black Plutonium", + 0, + 0, + 9000, + 9000, + true, + false, + 4, + 1, + 1, + Dyes.dyeBlack) + .disableAutoGeneratedBlastFurnaceRecipes(); + public static Materials CallistoIce = new Materials( + 389, + TextureSet.SET_SHINY, + 9.0F, + 1024, + 4, + 1 | 2 | 8 | 64 | 128, + 30, + 177, + 255, + 0, + "CallistoIce", + "Callisto Ice", + 0, + 0, + -1, + 0, + false, + false, + 4, + 1, + 1, + Dyes.dyeLightBlue); + public static Materials Duralumin = new Materials( + 392, + TextureSet.SET_SHINY, + 16.0F, + 512, + 3, + 1 | 2 | 8 | 64 | 128, + 235, + 209, + 160, + 0, + "Duralumin", + "Duralumin", + 0, + 0, + 1600, + 1600, + true, + false, + 4, + 1, + 1, + Dyes.dyeOrange, + 2, + Arrays.asList( + new MaterialStack(Aluminium, 6), + new MaterialStack(Copper, 1), + new MaterialStack(Manganese, 1), + new MaterialStack(Magnesium, 1))); + public static Materials Oriharukon = new Materials( + 393, + TextureSet.SET_SHINY, + 32.0F, + 10240, + 5, + 1 | 2 | 8 | 64 | 128, + 103, + 125, + 104, + 0, + "Oriharukon", + "Oriharukon", + 0, + 0, + 5400, + 5400, + true, + false, + 4, + 1, + 1, + Dyes.dyeLime, + Element.Oh, + Arrays.asList( + new TC_AspectStack(TC_Aspects.METALLUM, 2), + new TC_AspectStack(TC_Aspects.LUCRUM, 2), + new TC_AspectStack(TC_Aspects.ALIENIS, 1))) + .disableAutoGeneratedBlastFurnaceRecipes(); + public static Materials MysteriousCrystal = new Materials( + 398, + TextureSet.SET_SHINY, + 8.0F, + 256, + 6, + 1 | 2 | 8 | 64 | 128, + 22, + 133, + 108, + 0, + "MysteriousCrystal", + "Mysterious Crystal", + 0, + 0, + 7200, + 7200, + true, + false, + 4, + 1, + 1, + Dyes.dyeCyan) + .disableAutoGeneratedBlastFurnaceRecipes(); + + // \/HAD TO MOVE DOWN SECTION + public static Materials RedstoneAlloy = new Materials( + 381, + TextureSet.SET_METALLIC, + 3.0F, + 128, + 2, + 1 | 2 | 64 | 128, + 181, + 51, + 51, + 0, + "RedstoneAlloy", + "Redstone Alloy", + 0, + 0, + 671, + 1000, + true, + false, + 1, + 1, + 1, + Dyes.dyeRed, + 1, + Arrays.asList( + new MaterialStack(Redstone, 1), new MaterialStack(Silicon, 1), new MaterialStack(Coal, 1))) + .disableAutoGeneratedBlastFurnaceRecipes(); + public static Materials Soularium = new Materials( + 379, + TextureSet.SET_METALLIC, + 8.0F, + 256, + 2, + 1 | 2 | 64 | 128, + 65, + 46, + 29, + 0, + "Soularium", + "Soularium", + 0, + 0, + 800, + 1000, + true, + false, + 3, + 1, + 1, + Dyes.dyeBrown, + 1, + Arrays.asList( + new MaterialStack(SoulSand, 1), new MaterialStack(Gold, 1), new MaterialStack(Ash, 1))) + .disableAutoGeneratedBlastFurnaceRecipes(); + public static Materials ConductiveIron = new Materials( + 369, + TextureSet.SET_METALLIC, + 6.0F, + 256, + 3, + 1 | 2 | 64 | 128, + 217, + 178, + 171, + 0, + "ConductiveIron", + "Conductive Iron", + 0, + 0, + -1, + 1200, + true, + false, + 4, + 1, + 1, + Dyes.dyeRed, + 1, + Arrays.asList( + new MaterialStack(RedstoneAlloy, 1), + new MaterialStack(Iron, 1), + new MaterialStack(Silver, 1))) + .disableAutoGeneratedBlastFurnaceRecipes(); + public static Materials ElectricalSteel = new Materials( + 365, + TextureSet.SET_METALLIC, + 6.0F, + 512, + 2, + 1 | 2 | 64 | 128, + 185, + 185, + 185, + 0, + "ElectricalSteel", + "Electrical Steel", + 0, + 0, + 1811, + 1000, + true, + false, + 4, + 1, + 1, + Dyes.dyeGray, + 1, + Arrays.asList( + new MaterialStack(Steel, 1), new MaterialStack(Coal, 1), new MaterialStack(Silicon, 1))) + .disableAutoGeneratedBlastFurnaceRecipes(); + public static Materials EnergeticAlloy = new Materials( + 366, + TextureSet.SET_METALLIC, + 12.0F, + 1024, + 3, + 1 | 2 | 64 | 128, + 255, + 170, + 81, + 0, + "EnergeticAlloy", + "Energetic Alloy", + 0, + 0, + -1, + 2200, + true, + false, + 3, + 1, + 1, + Dyes.dyeOrange, + 1, + Arrays.asList( + new MaterialStack(ConductiveIron, 1), + new MaterialStack(Gold, 1), + new MaterialStack(BlackSteel, 1))) + .disableAutoGeneratedBlastFurnaceRecipes(); + public static Materials VibrantAlloy = new Materials( + 367, + TextureSet.SET_METALLIC, + 18.0F, + 4048, + 4, + 1 | 2 | 64 | 128, + 157, + 188, + 53, + 0, + "VibrantAlloy", + "Vibrant Alloy", + 0, + 0, + 3300, + 3300, + true, + false, + 4, + 1, + 1, + Dyes.dyeLime, + 1, + Arrays.asList( + new MaterialStack(EnergeticAlloy, 1), + new MaterialStack(EnderEye, 1), + new MaterialStack(Chrome, 1))) + .disableAutoGeneratedBlastFurnaceRecipes(); + public static Materials PulsatingIron = new Materials( + 378, + TextureSet.SET_METALLIC, + 6.0F, + 256, + 3, + 1 | 2 | 64 | 128, + 128, + 246, + 155, + 0, + "PulsatingIron", + "Pulsating Iron", + 0, + 0, + -1, + 1800, + true, + false, + 4, + 1, + 1, + Dyes.dyeLime, + 1, + Arrays.asList( + new MaterialStack(Iron, 1), + new MaterialStack(EnderPearl, 1), + new MaterialStack(RedstoneAlloy, 1))) + .disableAutoGeneratedBlastFurnaceRecipes(); + public static Materials DarkSteel = new Materials( + 364, + TextureSet.SET_METALLIC, + 8.0F, + 512, + 3, + 1 | 2 | 64 | 128, + 80, + 70, + 80, + 0, + "DarkSteel", + "Dark Steel", + 0, + 0, + -1, + 1800, + true, + false, + 3, + 1, + 1, + Dyes.dyePurple, + 1, + Arrays.asList( + new MaterialStack(ElectricalSteel, 1), + new MaterialStack(Coal, 1), + new MaterialStack(Obsidian, 1))) + .disableAutoGeneratedBlastFurnaceRecipes(); + public static Materials EndSteel = new Materials( + 401, + TextureSet.SET_METALLIC, + 12.0F, + 2000, + 4, + 1 | 2 | 64 | 128, + 223, + 217, + 165, + 0, + "EndSteel", + "End Steel", + 0, + 0, + 940, + 3600, + true, + false, + 3, + 1, + 1, + Dyes.dyeYellow, + 1, + Arrays.asList( + new MaterialStack(DarkSteel, 1), + new MaterialStack(Tungsten, 1), + new MaterialStack(Endstone, 1))) + .disableAutoGeneratedBlastFurnaceRecipes(); + public static Materials CrudeSteel = new Materials( + 402, + TextureSet.SET_METALLIC, + 2.0F, + 64, + 2, + 1 | 2 | 64 | 128, + 163, + 158, + 154, + 0, + "CrudeSteel", + "Clay Compound", + 0, + 0, + -1, + 1000, + false, + false, + 4, + 1, + 1, + Dyes.dyeGray, + 1, + Arrays.asList(new MaterialStack(Stone, 1), new MaterialStack(Clay, 1), new MaterialStack(Flint, 1))) + .disableAutoGeneratedBlastFurnaceRecipes(); + public static Materials CrystallineAlloy = new Materials( + 403, + TextureSet.SET_METALLIC, + 18.0F, + 768, + 4, + 1 | 2 | 64 | 128, + 114, + 197, + 197, + 0, + "CrystallineAlloy", + "Crystalline Alloy", + 0, + 0, + 4500, + 4500, + true, + false, + 4, + 1, + 1, + Dyes.dyeCyan, + 1, + Arrays.asList( + new MaterialStack(Gold, 1), + new MaterialStack(Diamond, 1), + new MaterialStack(PulsatingIron, 1))) + .disableAutoGeneratedBlastFurnaceRecipes(); + public static Materials MelodicAlloy = new Materials( + 404, + TextureSet.SET_METALLIC, + 24.0F, + 1024, + 5, + 1 | 2 | 64 | 128, + 136, + 98, + 136, + 0, + "MelodicAlloy", + "Melodic Alloy", + 0, + 0, + 5400, + 5400, + true, + false, + 4, + 1, + 1, + Dyes.dyeMagenta, + 1, + Arrays.asList( + new MaterialStack(EndSteel, 1), + new MaterialStack(EnderEye, 1), + new MaterialStack(Oriharukon, 1))) + .disableAutoGeneratedBlastFurnaceRecipes(); + public static Materials StellarAlloy = new Materials( + 405, + TextureSet.SET_METALLIC, + 96.0F, + 10240, + 7, + 1 | 2 | 64 | 128, + 217, + 220, + 203, + 0, + "StellarAlloy", + "Stellar Alloy", + 0, + 0, + 7200, + 7200, + true, + false, + 4, + 1, + 1, + Dyes.dyeWhite, + 1, + Arrays.asList( + new MaterialStack(NetherStar, 1), + new MaterialStack(MelodicAlloy, 1), + new MaterialStack(Naquadah, 1))) + .disableAutoGeneratedBlastFurnaceRecipes(); + public static Materials CrystallinePinkSlime = new Materials( + 406, + TextureSet.SET_METALLIC, + 6.0F, + 128, + 3, + 1 | 2 | 64 | 128, + 231, + 158, + 219, + 0, + "CrystallinePinkSlime", + "Crystalline Pink Slime", + 0, + 0, + 5000, + 5000, + true, + false, + 4, + 1, + 1, + Dyes.dyePink, + 1, + Arrays.asList(new MaterialStack(CrystallineAlloy, 1), new MaterialStack(Diamond, 1))) + .disableAutoGeneratedBlastFurnaceRecipes(); + public static Materials EnergeticSilver = new Materials( + 407, + TextureSet.SET_METALLIC, + 8.0F, + 512, + 3, + 1 | 2 | 64 | 128, + 149, + 183, + 205, + 0, + "EnergeticSilver", + "Energetic Silver", + 0, + 0, + -1, + 2200, + true, + false, + 4, + 1, + 1, + Dyes.dyeLightBlue, + 1, + Arrays.asList( + new MaterialStack(Silver, 1), + new MaterialStack(ConductiveIron, 1), + new MaterialStack(BlackSteel, 1))) + .disableAutoGeneratedBlastFurnaceRecipes(); + public static Materials VividAlloy = new Materials( + 408, + TextureSet.SET_METALLIC, + 12.0F, + 768, + 4, + 1 | 2 | 64 | 128, + 70, + 188, + 219, + 0, + "VividAlloy", + "Vivid Alloy", + 0, + 0, + 3300, + 3300, + true, + false, + 4, + 1, + 1, + Dyes.dyeBlue, + 1, + Arrays.asList( + new MaterialStack(EnergeticSilver, 1), + new MaterialStack(EnderEye, 1), + new MaterialStack(Chrome, 1))) + .disableAutoGeneratedBlastFurnaceRecipes(); + public static Materials Enderium = new Materials( + 321, + TextureSet.SET_DULL, + 8.0F, + 1500, + 3, + 1 | 2 | 64 | 128, + 89, + 145, + 135, + 0, + "Enderium", + "Enderium", + 0, + 0, + 4500, + 4500, + true, + false, + 1, + 1, + 1, + Dyes.dyeGreen, + 1, + Arrays.asList( + new MaterialStack(EnderiumBase, 2), + new MaterialStack(Thaumium, 1), + new MaterialStack(EnderPearl, 1)), + Arrays.asList( + new TC_AspectStack(TC_Aspects.METALLUM, 2), new TC_AspectStack(TC_Aspects.ALIENIS, 1))) + .disableAutoGeneratedBlastFurnaceRecipes(); + public static Materials Mithril = new Materials( + 331, + TextureSet.SET_SHINY, + 32.0F, + 64, + 2, + 1 | 2 | 8 | 64, + 255, + 255, + 210, + 0, + "Mithril", + "Mithril", + 0, + 0, + -1, + 0, + false, + false, + 4, + 3, + 2, + Dyes.dyeLightBlue, + 2, + Arrays.asList(new MaterialStack(Platinum, 2), new MaterialStack(Thaumium, 1))) + .disableAutoGeneratedBlastFurnaceRecipes() + .setTurbineMultipliers(22, 1, 1); + public static Materials BlueAlloy = new Materials( + 309, + TextureSet.SET_DULL, + 1.0F, + 0, + 0, + 1 | 2, + 100, + 180, + 255, + 0, + "BlueAlloy", + "Blue Alloy", + 0, + 0, + -1, + 0, + false, + false, + 3, + 5, + 1, + Dyes.dyeLightBlue, + 2, + Arrays.asList(new MaterialStack(Silver, 1), new MaterialStack(Electrotine, 4)), + Collections.singletonList(new TC_AspectStack(TC_Aspects.ELECTRUM, 3))); + public static Materials ShadowIron = new Materials( + 336, + TextureSet.SET_METALLIC, + 32.0F, + 10240, + 2, + 1 | 2 | 8 | 64, + 120, + 120, + 120, + 0, + "ShadowIron", + "Shadow Iron", + 0, + 0, + -1, + 0, + false, + false, + 3, + 4, + 3, + Dyes.dyeBlack, + 2, + Arrays.asList(new MaterialStack(Iron, 1), new MaterialStack(Thaumium, 3))) + .disableAutoGeneratedBlastFurnaceRecipes() + .setTurbineMultipliers(1, 76, 1); + public static Materials ShadowSteel = new Materials( + 337, + TextureSet.SET_METALLIC, + 6.0F, + 768, + 4, + 1 | 2 | 64, + 90, + 90, + 90, + 0, + "ShadowSteel", + "Shadow Steel", + 0, + 0, + -1, + 1700, + true, + false, + 4, + 4, + 3, + Dyes.dyeBlack, + 2, + Arrays.asList(new MaterialStack(Steel, 1), new MaterialStack(Thaumium, 3))); + public static Materials AstralSilver = new Materials( + 333, + TextureSet.SET_SHINY, + 10.0F, + 64, + 2, + 1 | 2 | 64, + 230, + 230, + 255, + 0, + "AstralSilver", + "Astral Silver", + 0, + 0, + -1, + 0, + false, + false, + 4, + 3, + 2, + Dyes.dyeWhite, + 2, + Arrays.asList(new MaterialStack(Silver, 2), new MaterialStack(Thaumium, 1))); + + /** * Op materials (draconic evolution above) */ - //TODO: add other op materials? maybe some new ores or new only fusion made op materials from op materials??? like neutronium bedrockium alloy etc. - public static Materials InfinityCatalyst = new Materials( 394, TextureSet.SET_SHINY , 64.0F,1310720, 10, 1|2 |8 |64|128 , 255, 255, 255, 0, "InfinityCatalyst" , "Infinity Catalyst" , 5, 500000, 10800, 10800, true, false, 20, 1, 1, Dyes.dyeLightGray ); - public static Materials Infinity = new Materials( 397, new TextureSet("infinity", true), 256.0F,2621440, 17, 1|2 |64|128 , 255, 255, 255, 0, "Infinity" , "Infinity" , 5, 5000000, 10800, 10800, true, false, 40, 1, 1, Dyes.dyeLightGray ); - public static Materials Bedrockium = new MaterialBuilder(395,TextureSet.SET_DULL, "Bedrockium").addOreItems().addDustItems().addMetalItems().setDurability(327680).setToolSpeed(8f).setToolQuality(9).setRGB(50,50,50).setName("Bedrockium").setBlastFurnaceRequired(true).setBlastFurnaceTemp(9900).setMeltingPoint(9900).setColor(Dyes.dyeBlack).setOreValue(4).setDensityDivider(1).setDensityMultiplier(1).constructMaterial(); - public static Materials Trinium = new Materials( 868, TextureSet.SET_SHINY , 128.0F, 51200, 8, 1|2 |8 |64|128 , 200, 200, 210, 0, "Trinium" , "Trinium" , 0, 0, 7200, 7200, true, false, 4, 1, 1, Dyes.dyeLightGray ).disableAutoGeneratedBlastFurnaceRecipes(); - public static Materials Ichorium = new Materials( 978, TextureSet.SET_SHINY , 32.0F, 850000, 12, 1|2 |8 |32|64|128 , 211, 120, 6, 0, "Ichorium" , "Ichorium" , 5, 250000, 9000, 9000, true, false, 4, 1, 1, Dyes.dyeOrange ).setTurbineMultipliers(30, 30, 3); - public static Materials CosmicNeutronium = new Materials( 982, TextureSet.SET_SHINY , 96.0F, 163840, 12, 1|2 |8 |32|64|128 , 50, 50, 50, 0, "CosmicNeutronium" , "Cosmic Neutronium" , 0, 0, 9900, 9900, true, false, 4, 1, 1, Dyes.dyeBlack ); + // TODO: add other op materials? maybe some new ores or new only fusion made op materials from op materials??? like + // neutronium bedrockium alloy etc. + public static Materials InfinityCatalyst = new Materials( + 394, + TextureSet.SET_SHINY, + 64.0F, + 1310720, + 10, + 1 | 2 | 8 | 64 | 128, + 255, + 255, + 255, + 0, + "InfinityCatalyst", + "Infinity Catalyst", + 5, + 500000, + 10800, + 10800, + true, + false, + 20, + 1, + 1, + Dyes.dyeLightGray); + + public static Materials Infinity = new Materials( + 397, + new TextureSet("infinity", true), + 256.0F, + 2621440, + 17, + 1 | 2 | 64 | 128, + 255, + 255, + 255, + 0, + "Infinity", + "Infinity", + 5, + 5000000, + 10800, + 10800, + true, + false, + 40, + 1, + 1, + Dyes.dyeLightGray); + public static Materials Bedrockium = new MaterialBuilder(395, TextureSet.SET_DULL, "Bedrockium") + .addOreItems() + .addDustItems() + .addMetalItems() + .setDurability(327680) + .setToolSpeed(8f) + .setToolQuality(9) + .setRGB(50, 50, 50) + .setName("Bedrockium") + .setBlastFurnaceRequired(true) + .setBlastFurnaceTemp(9900) + .setMeltingPoint(9900) + .setColor(Dyes.dyeBlack) + .setOreValue(4) + .setDensityDivider(1) + .setDensityMultiplier(1) + .constructMaterial(); + public static Materials Trinium = new Materials( + 868, + TextureSet.SET_SHINY, + 128.0F, + 51200, + 8, + 1 | 2 | 8 | 64 | 128, + 200, + 200, + 210, + 0, + "Trinium", + "Trinium", + 0, + 0, + 7200, + 7200, + true, + false, + 4, + 1, + 1, + Dyes.dyeLightGray) + .disableAutoGeneratedBlastFurnaceRecipes(); + public static Materials Ichorium = new Materials( + 978, + TextureSet.SET_SHINY, + 32.0F, + 850000, + 12, + 1 | 2 | 8 | 32 | 64 | 128, + 211, + 120, + 6, + 0, + "Ichorium", + "Ichorium", + 5, + 250000, + 9000, + 9000, + true, + false, + 4, + 1, + 1, + Dyes.dyeOrange) + .setTurbineMultipliers(30, 30, 3); + public static Materials CosmicNeutronium = new Materials( + 982, + TextureSet.SET_SHINY, + 96.0F, + 163840, + 12, + 1 | 2 | 8 | 32 | 64 | 128, + 50, + 50, + 50, + 0, + "CosmicNeutronium", + "Cosmic Neutronium", + 0, + 0, + 9900, + 9900, + true, + false, + 4, + 1, + 1, + Dyes.dyeBlack); // Superconductor base. - public static Materials Pentacadmiummagnesiumhexaoxid = new Materials( 987, TextureSet.SET_SHINY , 1.0F, 0, 3, 1|2 , 85, 85, 85, 0, "Pentacadmiummagnesiumhexaoxid" , "Superconductor Base MV" , 0, 0, 2500, 2500, true, false, 1, 1, 1, Dyes.dyeGray , 1, Arrays.asList(new MaterialStack(Cadmium, 5), new MaterialStack(Magnesium, 1), new MaterialStack(Oxygen, 6)), Collections.singletonList(new TC_AspectStack(TC_Aspects.ELECTRUM, 3))); - public static Materials Titaniumonabariumdecacoppereikosaoxid = new Materials( 988, TextureSet.SET_METALLIC , 1.0F, 0, 3, 1|2 , 51, 25, 0, 0, "Titaniumonabariumdecacoppereikosaoxid" , "Superconductor Base HV" , 0, 0, 3300, 3300, true, false, 1, 1, 1, Dyes.dyeBrown , 1, Arrays.asList(new MaterialStack(Titanium, 1), new MaterialStack(Barium, 9), new MaterialStack(Copper, 10), new MaterialStack(Oxygen, 20)), Collections.singletonList(new TC_AspectStack(TC_Aspects.ELECTRUM, 6))); - public static Materials Uraniumtriplatinid = new Materials( 989, TextureSet.SET_SHINY , 1.0F, 0, 3, 1|2 , 0,135, 0, 0, "Uraniumtriplatinid" , "Superconductor Base EV" , 0, 0, 4400, 4400, true, false, 1, 1, 1, Dyes.dyeLime , 1, Arrays.asList(new MaterialStack(Uranium, 1), new MaterialStack(Platinum, 3)), Collections.singletonList(new TC_AspectStack(TC_Aspects.ELECTRUM, 9))); - public static Materials Vanadiumtriindinid = new Materials( 990, TextureSet.SET_SHINY , 1.0F, 0, 3, 1|2 , 51, 0, 51, 0, "Vanadiumtriindinid" , "Superconductor Base IV" , 0, 0, 5200, 5200, true, false, 1, 1, 1, Dyes.dyeMagenta , 1, Arrays.asList(new MaterialStack(Vanadium , 1), new MaterialStack(Indium, 3)), Collections.singletonList(new TC_AspectStack(TC_Aspects.ELECTRUM, 12))); - public static Materials Tetraindiumditindibariumtitaniumheptacoppertetrakaidekaoxid = new Materials( 991, TextureSet.SET_METALLIC , 1.0F, 0, 3, 1|2 , 153, 76, 0, 0, "Tetraindiumditindibariumtitaniumheptacoppertetrakaidekaoxid" , "Superconductor Base LuV" , 0, 0, 6000, 6000, true, false, 1, 1, 1, Dyes.dyeBrown , 1, Arrays.asList(new MaterialStack(Indium, 4), new MaterialStack(Tin, 2), new MaterialStack(Barium, 2), new MaterialStack(Titanium, 1), new MaterialStack(Copper, 7), new MaterialStack(Oxygen, 14)), Collections.singletonList(new TC_AspectStack(TC_Aspects.ELECTRUM, 15))); - public static Materials Tetranaquadahdiindiumhexaplatiumosminid = new Materials( 992, TextureSet.SET_METALLIC , 1.0F, 0, 3, 1|2 , 10, 10, 10, 0, "Tetranaquadahdiindiumhexaplatiumosminid" , "Superconductor Base ZPM" , 0, 0, 9000, 9000, true, false, 1, 1, 1, Dyes.dyeBlack , 1, Arrays.asList(new MaterialStack(Naquadah, 4), new MaterialStack(Indium, 2), new MaterialStack(Palladium, 6), new MaterialStack(Osmium, 1)), Collections.singletonList(new TC_AspectStack(TC_Aspects.ELECTRUM, 18))); - public static Materials Longasssuperconductornameforuvwire = new Materials( 986, TextureSet.SET_METALLIC , 1.0F, 0, 3, 1|2 , 224,210, 7, 0, "Longasssuperconductornameforuvwire" , "Superconductor Base UV" , 0, 0, 9900, 9900, true, false, 1, 1, 1, Dyes.dyeYellow , 1, Arrays.asList(new MaterialStack(Naquadria, 4), new MaterialStack(Osmiridium, 3), new MaterialStack(Europium, 1), new MaterialStack(Samarium, 1)), Collections.singletonList(new TC_AspectStack(TC_Aspects.ELECTRUM, 21))); - public static Materials Longasssuperconductornameforuhvwire = new Materials( 985, TextureSet.SET_SHINY , 1.0F, 0, 3, 1|2 , 38,129, 189, 0, "Longasssuperconductornameforuhvwire" , "Superconductor Base UHV" , 0, 0, 10800, 10800, true, false, 1, 1, 1, Dyes.dyeWhite , 1, Arrays.asList(new MaterialStack(Draconium, 6), new MaterialStack(CosmicNeutronium, 7), new MaterialStack(Tritanium, 5), new MaterialStack(Americium, 6)), Collections.singletonList(new TC_AspectStack(TC_Aspects.ELECTRUM, 24))); - public static Materials SuperconductorUEVBase = new Materials( 974, TextureSet.SET_SHINY , 1.0F, 0, 3, 1|2 , 174, 8, 8, 0, "SuperconductorUEVBase" , "Superconductor Base UEV" , 0, 0, 11700, 11800, true, false, 1, 1, 1, Dyes.dyeWhite, Collections.singletonList(new TC_AspectStack(TC_Aspects.ELECTRUM, 27))); - public static Materials SuperconductorUIVBase = new Materials( 131, TextureSet.SET_SHINY , 1.0F, 0, 3, 1|2 , 229, 88, 177, 0, "SuperconductorUIVBase" , "Superconductor Base UIV" , 0, 0, 12700, 12700, true, false, 1, 1, 1, Dyes.dyeWhite, Collections.singletonList(new TC_AspectStack(TC_Aspects.ELECTRUM, 34))); - public static Materials SuperconductorUMVBase = new Materials( 134, TextureSet.SET_SHINY , 1.0F, 0, 3, 1|2 , 181, 38, 205, 0, "SuperconductorUMVBase" , "Superconductor Base UMV" , 0, 0, 13600, 13600, true, false, 1, 1, 1, Dyes.dyeWhite, Collections.singletonList(new TC_AspectStack(TC_Aspects.ELECTRUM, 40))); + public static Materials Pentacadmiummagnesiumhexaoxid = new Materials( + 987, + TextureSet.SET_SHINY, + 1.0F, + 0, + 3, + 1 | 2, + 85, + 85, + 85, + 0, + "Pentacadmiummagnesiumhexaoxid", + "Superconductor Base MV", + 0, + 0, + 2500, + 2500, + true, + false, + 1, + 1, + 1, + Dyes.dyeGray, + 1, + Arrays.asList(new MaterialStack(Cadmium, 5), new MaterialStack(Magnesium, 1), new MaterialStack(Oxygen, 6)), + Collections.singletonList(new TC_AspectStack(TC_Aspects.ELECTRUM, 3))); + public static Materials Titaniumonabariumdecacoppereikosaoxid = new Materials( + 988, + TextureSet.SET_METALLIC, + 1.0F, + 0, + 3, + 1 | 2, + 51, + 25, + 0, + 0, + "Titaniumonabariumdecacoppereikosaoxid", + "Superconductor Base HV", + 0, + 0, + 3300, + 3300, + true, + false, + 1, + 1, + 1, + Dyes.dyeBrown, + 1, + Arrays.asList( + new MaterialStack(Titanium, 1), + new MaterialStack(Barium, 9), + new MaterialStack(Copper, 10), + new MaterialStack(Oxygen, 20)), + Collections.singletonList(new TC_AspectStack(TC_Aspects.ELECTRUM, 6))); + public static Materials Uraniumtriplatinid = new Materials( + 989, + TextureSet.SET_SHINY, + 1.0F, + 0, + 3, + 1 | 2, + 0, + 135, + 0, + 0, + "Uraniumtriplatinid", + "Superconductor Base EV", + 0, + 0, + 4400, + 4400, + true, + false, + 1, + 1, + 1, + Dyes.dyeLime, + 1, + Arrays.asList(new MaterialStack(Uranium, 1), new MaterialStack(Platinum, 3)), + Collections.singletonList(new TC_AspectStack(TC_Aspects.ELECTRUM, 9))); + public static Materials Vanadiumtriindinid = new Materials( + 990, + TextureSet.SET_SHINY, + 1.0F, + 0, + 3, + 1 | 2, + 51, + 0, + 51, + 0, + "Vanadiumtriindinid", + "Superconductor Base IV", + 0, + 0, + 5200, + 5200, + true, + false, + 1, + 1, + 1, + Dyes.dyeMagenta, + 1, + Arrays.asList(new MaterialStack(Vanadium, 1), new MaterialStack(Indium, 3)), + Collections.singletonList(new TC_AspectStack(TC_Aspects.ELECTRUM, 12))); + public static Materials Tetraindiumditindibariumtitaniumheptacoppertetrakaidekaoxid = new Materials( + 991, + TextureSet.SET_METALLIC, + 1.0F, + 0, + 3, + 1 | 2, + 153, + 76, + 0, + 0, + "Tetraindiumditindibariumtitaniumheptacoppertetrakaidekaoxid", + "Superconductor Base LuV", + 0, + 0, + 6000, + 6000, + true, + false, + 1, + 1, + 1, + Dyes.dyeBrown, + 1, + Arrays.asList( + new MaterialStack(Indium, 4), + new MaterialStack(Tin, 2), + new MaterialStack(Barium, 2), + new MaterialStack(Titanium, 1), + new MaterialStack(Copper, 7), + new MaterialStack(Oxygen, 14)), + Collections.singletonList(new TC_AspectStack(TC_Aspects.ELECTRUM, 15))); + public static Materials Tetranaquadahdiindiumhexaplatiumosminid = new Materials( + 992, + TextureSet.SET_METALLIC, + 1.0F, + 0, + 3, + 1 | 2, + 10, + 10, + 10, + 0, + "Tetranaquadahdiindiumhexaplatiumosminid", + "Superconductor Base ZPM", + 0, + 0, + 9000, + 9000, + true, + false, + 1, + 1, + 1, + Dyes.dyeBlack, + 1, + Arrays.asList( + new MaterialStack(Naquadah, 4), + new MaterialStack(Indium, 2), + new MaterialStack(Palladium, 6), + new MaterialStack(Osmium, 1)), + Collections.singletonList(new TC_AspectStack(TC_Aspects.ELECTRUM, 18))); + public static Materials Longasssuperconductornameforuvwire = new Materials( + 986, + TextureSet.SET_METALLIC, + 1.0F, + 0, + 3, + 1 | 2, + 224, + 210, + 7, + 0, + "Longasssuperconductornameforuvwire", + "Superconductor Base UV", + 0, + 0, + 9900, + 9900, + true, + false, + 1, + 1, + 1, + Dyes.dyeYellow, + 1, + Arrays.asList( + new MaterialStack(Naquadria, 4), + new MaterialStack(Osmiridium, 3), + new MaterialStack(Europium, 1), + new MaterialStack(Samarium, 1)), + Collections.singletonList(new TC_AspectStack(TC_Aspects.ELECTRUM, 21))); + public static Materials Longasssuperconductornameforuhvwire = new Materials( + 985, + TextureSet.SET_SHINY, + 1.0F, + 0, + 3, + 1 | 2, + 38, + 129, + 189, + 0, + "Longasssuperconductornameforuhvwire", + "Superconductor Base UHV", + 0, + 0, + 10800, + 10800, + true, + false, + 1, + 1, + 1, + Dyes.dyeWhite, + 1, + Arrays.asList( + new MaterialStack(Draconium, 6), + new MaterialStack(CosmicNeutronium, 7), + new MaterialStack(Tritanium, 5), + new MaterialStack(Americium, 6)), + Collections.singletonList(new TC_AspectStack(TC_Aspects.ELECTRUM, 24))); + public static Materials SuperconductorUEVBase = new Materials( + 974, + TextureSet.SET_SHINY, + 1.0F, + 0, + 3, + 1 | 2, + 174, + 8, + 8, + 0, + "SuperconductorUEVBase", + "Superconductor Base UEV", + 0, + 0, + 11700, + 11800, + true, + false, + 1, + 1, + 1, + Dyes.dyeWhite, + Collections.singletonList(new TC_AspectStack(TC_Aspects.ELECTRUM, 27))); + public static Materials SuperconductorUIVBase = new Materials( + 131, + TextureSet.SET_SHINY, + 1.0F, + 0, + 3, + 1 | 2, + 229, + 88, + 177, + 0, + "SuperconductorUIVBase", + "Superconductor Base UIV", + 0, + 0, + 12700, + 12700, + true, + false, + 1, + 1, + 1, + Dyes.dyeWhite, + Collections.singletonList(new TC_AspectStack(TC_Aspects.ELECTRUM, 34))); + public static Materials SuperconductorUMVBase = new Materials( + 134, + TextureSet.SET_SHINY, + 1.0F, + 0, + 3, + 1 | 2, + 181, + 38, + 205, + 0, + "SuperconductorUMVBase", + "Superconductor Base UMV", + 0, + 0, + 13600, + 13600, + true, + false, + 1, + 1, + 1, + Dyes.dyeWhite, + Collections.singletonList(new TC_AspectStack(TC_Aspects.ELECTRUM, 40))); // Superconductors. - public static Materials SuperconductorMV = new Materials( -1, TextureSet.SET_SHINY , 1.0F, 0, 0, 0 , 85, 85, 85, 0, "SuperconductorMV" , "Superconductor MV" , 0, 0, -1, -1, false, false, 1, 1, 1, Dyes.dyeGray , Collections.singletonList(new TC_AspectStack(TC_Aspects.ELECTRUM, 6))); - public static Materials SuperconductorHV = new Materials( -1, TextureSet.SET_SHINY , 1.0F, 0, 0, 0 , 51, 25, 0, 0, "SuperconductorHV" , "Superconductor HV" , 0, 0, -1, -1, false, false, 1, 1, 1, Dyes.dyeBrown , Collections.singletonList(new TC_AspectStack(TC_Aspects.ELECTRUM, 12))); - public static Materials SuperconductorEV = new Materials( -1, TextureSet.SET_SHINY , 1.0F, 0, 0, 0 , 0,135, 0, 0, "SuperconductorEV" , "Superconductor EV" , 0, 0, -1, -1, false, false, 1, 1, 1, Dyes.dyeLime , Collections.singletonList(new TC_AspectStack(TC_Aspects.ELECTRUM, 18))); - public static Materials SuperconductorIV = new Materials( -1, TextureSet.SET_SHINY , 1.0F, 0, 0, 0 , 51, 0, 51, 0, "SuperconductorIV" , "Superconductor IV" , 0, 0, -1, -1, false, false, 1, 1, 1, Dyes.dyeMagenta , Collections.singletonList(new TC_AspectStack(TC_Aspects.ELECTRUM, 24))); - public static Materials SuperconductorLuV = new Materials( -1, TextureSet.SET_SHINY , 1.0F, 0, 0, 0 , 153, 76, 0, 0, "SuperconductorLuV" , "Superconductor LuV" , 0, 0, -1, -1, false, false, 1, 1, 1, Dyes.dyeBrown , Collections.singletonList(new TC_AspectStack(TC_Aspects.ELECTRUM, 30))); - public static Materials SuperconductorZPM = new Materials( -1, TextureSet.SET_SHINY , 1.0F, 0, 0, 0 , 10, 10, 10, 0, "SuperconductorZPM" , "Superconductor ZPM" , 0, 0, -1, -1, false, false, 1, 1, 1, Dyes.dyeBlack , Collections.singletonList(new TC_AspectStack(TC_Aspects.ELECTRUM, 36))); - public static Materials SuperconductorUV = new Materials( -1, TextureSet.SET_SHINY , 1.0F, 0, 0, 0 , 224,210, 7, 0, "SuperconductorUV" , "Superconductor UV" , 0, 0, -1, -1, false, false, 1, 1, 1, Dyes.dyeYellow , Collections.singletonList(new TC_AspectStack(TC_Aspects.ELECTRUM, 42))); - public static Materials SuperconductorUHV = new Materials( -1, TextureSet.SET_SHINY , 1.0F, 0, 0, 0 , 38,129, 189, 0, "Superconductor" , "Superconductor UHV" , 0, 0, -1, -1, false, false, 1, 1, 1, Dyes.dyeWhite , Collections.singletonList(new TC_AspectStack(TC_Aspects.ELECTRUM, 48))); - public static Materials SuperconductorUEV = new Materials( -1, TextureSet.SET_SHINY , 1.0F, 0, 0, 0 , 174, 8, 8, 0, "SuperconductorUEV" , "Superconductor UEV" , 0, 0, -1, -1, false, false, 1, 1, 1, Dyes.dyeWhite , Collections.singletonList(new TC_AspectStack(TC_Aspects.ELECTRUM, 54))); - public static Materials SuperconductorUIV = new Materials( -1, TextureSet.SET_SHINY , 1.0F, 0, 0, 0 , 229, 88, 177, 0, "SuperconductorUIV" , "Superconductor UIV" , 0, 0, -1, -1, false, false, 1, 1, 1, Dyes.dyeWhite , Collections.singletonList(new TC_AspectStack(TC_Aspects.ELECTRUM, 60))); - public static Materials SuperconductorUMV = new Materials( -1, TextureSet.SET_SHINY , 1.0F, 0, 0, 0 , 181, 38, 205, 0, "SuperconductorUMV" , "Superconductor UMV" , 0, 0, -1, -1, false, false, 1, 1, 1, Dyes.dyeWhite , Collections.singletonList(new TC_AspectStack(TC_Aspects.ELECTRUM, 66))); - - public static Materials SuperCoolant = new MaterialBuilder( -1, TextureSet.SET_DULL,"Super Coolant").setRGB(2, 91, 111).addFluid().constructMaterial().setLiquidTemperature(1); - - public static Materials DimensionallyTranscendentCrudeCatalyst = new Materials( 748, TextureSet.SET_FLUID , 1.0F, 0, 2, 16 , 10, 20, 20, 1, "DimensionallyTranscendentCrudeCatalyst" , "Dimensionally Transcendent Crude Catalyst" , 0, 0, 100000000, 1, false, true, 1, 1, 1, Dyes.dyeCyan).setHasCorrespondingFluid(true); - public static Materials DimensionallyTranscendentProsaicCatalyst = new Materials( 747, TextureSet.SET_FLUID , 1.0F, 0, 2, 16 , 10, 20, 20, 1, "DimensionallyTranscendentProsaicCatalyst" , "Dimensionally Transcendent Prosaic Catalyst" , 0, 0, 100000000, 1, false, true, 1, 1, 1, Dyes.dyeGreen).setHasCorrespondingFluid(true); - public static Materials DimensionallyTranscendentResplendentCatalyst = new Materials( 746, TextureSet.SET_FLUID , 1.0F, 0, 2, 16 , 10, 20, 20, 1, "DimensionallyTranscendentResplendentCatalyst" , "Dimensionally Transcendent Resplendent Catalyst" , 0, 0, 100000000, 1, false, true, 1, 1, 1, Dyes.dyeLime).setHasCorrespondingFluid(true); - public static Materials DimensionallyTranscendentExoticCatalyst = new Materials( 745, TextureSet.SET_FLUID , 1.0F, 0, 2, 16 , 10, 20, 20, 1, "DimensionallyTranscendentExoticCatalyst" , "Dimensionally Transcendent Exotic Catalyst" , 0, 0, 100000000, 1, false, true, 1, 1, 1, Dyes.dyeMagenta).setHasCorrespondingFluid(true); + public static Materials SuperconductorMV = new Materials( + -1, + TextureSet.SET_SHINY, + 1.0F, + 0, + 0, + 0, + 85, + 85, + 85, + 0, + "SuperconductorMV", + "Superconductor MV", + 0, + 0, + -1, + -1, + false, + false, + 1, + 1, + 1, + Dyes.dyeGray, + Collections.singletonList(new TC_AspectStack(TC_Aspects.ELECTRUM, 6))); + public static Materials SuperconductorHV = new Materials( + -1, + TextureSet.SET_SHINY, + 1.0F, + 0, + 0, + 0, + 51, + 25, + 0, + 0, + "SuperconductorHV", + "Superconductor HV", + 0, + 0, + -1, + -1, + false, + false, + 1, + 1, + 1, + Dyes.dyeBrown, + Collections.singletonList(new TC_AspectStack(TC_Aspects.ELECTRUM, 12))); + public static Materials SuperconductorEV = new Materials( + -1, + TextureSet.SET_SHINY, + 1.0F, + 0, + 0, + 0, + 0, + 135, + 0, + 0, + "SuperconductorEV", + "Superconductor EV", + 0, + 0, + -1, + -1, + false, + false, + 1, + 1, + 1, + Dyes.dyeLime, + Collections.singletonList(new TC_AspectStack(TC_Aspects.ELECTRUM, 18))); + public static Materials SuperconductorIV = new Materials( + -1, + TextureSet.SET_SHINY, + 1.0F, + 0, + 0, + 0, + 51, + 0, + 51, + 0, + "SuperconductorIV", + "Superconductor IV", + 0, + 0, + -1, + -1, + false, + false, + 1, + 1, + 1, + Dyes.dyeMagenta, + Collections.singletonList(new TC_AspectStack(TC_Aspects.ELECTRUM, 24))); + public static Materials SuperconductorLuV = new Materials( + -1, + TextureSet.SET_SHINY, + 1.0F, + 0, + 0, + 0, + 153, + 76, + 0, + 0, + "SuperconductorLuV", + "Superconductor LuV", + 0, + 0, + -1, + -1, + false, + false, + 1, + 1, + 1, + Dyes.dyeBrown, + Collections.singletonList(new TC_AspectStack(TC_Aspects.ELECTRUM, 30))); + public static Materials SuperconductorZPM = new Materials( + -1, + TextureSet.SET_SHINY, + 1.0F, + 0, + 0, + 0, + 10, + 10, + 10, + 0, + "SuperconductorZPM", + "Superconductor ZPM", + 0, + 0, + -1, + -1, + false, + false, + 1, + 1, + 1, + Dyes.dyeBlack, + Collections.singletonList(new TC_AspectStack(TC_Aspects.ELECTRUM, 36))); + public static Materials SuperconductorUV = new Materials( + -1, + TextureSet.SET_SHINY, + 1.0F, + 0, + 0, + 0, + 224, + 210, + 7, + 0, + "SuperconductorUV", + "Superconductor UV", + 0, + 0, + -1, + -1, + false, + false, + 1, + 1, + 1, + Dyes.dyeYellow, + Collections.singletonList(new TC_AspectStack(TC_Aspects.ELECTRUM, 42))); + public static Materials SuperconductorUHV = new Materials( + -1, + TextureSet.SET_SHINY, + 1.0F, + 0, + 0, + 0, + 38, + 129, + 189, + 0, + "Superconductor", + "Superconductor UHV", + 0, + 0, + -1, + -1, + false, + false, + 1, + 1, + 1, + Dyes.dyeWhite, + Collections.singletonList(new TC_AspectStack(TC_Aspects.ELECTRUM, 48))); + public static Materials SuperconductorUEV = new Materials( + -1, + TextureSet.SET_SHINY, + 1.0F, + 0, + 0, + 0, + 174, + 8, + 8, + 0, + "SuperconductorUEV", + "Superconductor UEV", + 0, + 0, + -1, + -1, + false, + false, + 1, + 1, + 1, + Dyes.dyeWhite, + Collections.singletonList(new TC_AspectStack(TC_Aspects.ELECTRUM, 54))); + public static Materials SuperconductorUIV = new Materials( + -1, + TextureSet.SET_SHINY, + 1.0F, + 0, + 0, + 0, + 229, + 88, + 177, + 0, + "SuperconductorUIV", + "Superconductor UIV", + 0, + 0, + -1, + -1, + false, + false, + 1, + 1, + 1, + Dyes.dyeWhite, + Collections.singletonList(new TC_AspectStack(TC_Aspects.ELECTRUM, 60))); + public static Materials SuperconductorUMV = new Materials( + -1, + TextureSet.SET_SHINY, + 1.0F, + 0, + 0, + 0, + 181, + 38, + 205, + 0, + "SuperconductorUMV", + "Superconductor UMV", + 0, + 0, + -1, + -1, + false, + false, + 1, + 1, + 1, + Dyes.dyeWhite, + Collections.singletonList(new TC_AspectStack(TC_Aspects.ELECTRUM, 66))); - public static Materials ExcitedDTCC = new Materials( 109, TextureSet.SET_FLUID , 1.0F, 0, 2, 16 , 10, 20, 20, 1, "ExcitedDTCC" , "Excited Dimensionally Transcendent Crude Catalyst" , -1, -1, 500000000, 1, false, true, 1, 1, 1, Dyes.dyeCyan); - public static Materials ExcitedDTPC = new Materials( 113, TextureSet.SET_FLUID , 1.0F, 0, 2, 16 , 35, 59, 41, 1, "ExcitedDTPC" , "Excited Dimensionally Transcendent Prosaic Catalyst" , -1, -1, 500000000, 1, false, true, 1, 1, 1, Dyes.dyeGreen); - public static Materials ExcitedDTRC = new Materials( 121, TextureSet.SET_FLUID , 1.0F, 0, 2, 16 , 38, 20, 56, 1, "ExcitedDTRC" , "Excited Dimensionally Transcendent Resplendent Catalyst" , -1, -1, 500000000, 1, false, true, 1, 1, 1, Dyes.dyeLime); - public static Materials ExcitedDTEC = new Materials( 126, TextureSet.SET_FLUID , 1.0F, 0, 2, 16 , 240, 240, 41, 1, "ExcitedDTEC" , "Excited Dimensionally Transcendent Exotic Catalyst" , -1, -1, 500000000, 1, false, true, 1, 1, 1, Dyes.dyeMagenta); + public static Materials SuperCoolant = new MaterialBuilder(-1, TextureSet.SET_DULL, "Super Coolant") + .setRGB(2, 91, 111) + .addFluid() + .constructMaterial() + .setLiquidTemperature(1); - public static Materials DimensionallyTranscendentResidue = new Materials( 589, TextureSet.SET_FLUID , 1.0F, 0, 2, 16 , 0, 0, 0, 1, "DimensionallyTranscendentResidue" , "Dimensionally Transcendent Residue" , -1, -1, 25, 1, false, true, 1, 1, 1, Dyes.dyeBlack); + public static Materials DimensionallyTranscendentCrudeCatalyst = new Materials( + 748, + TextureSet.SET_FLUID, + 1.0F, + 0, + 2, + 16, + 10, + 20, + 20, + 1, + "DimensionallyTranscendentCrudeCatalyst", + "Dimensionally Transcendent Crude Catalyst", + 0, + 0, + 100000000, + 1, + false, + true, + 1, + 1, + 1, + Dyes.dyeCyan) + .setHasCorrespondingFluid(true); + public static Materials DimensionallyTranscendentProsaicCatalyst = new Materials( + 747, + TextureSet.SET_FLUID, + 1.0F, + 0, + 2, + 16, + 10, + 20, + 20, + 1, + "DimensionallyTranscendentProsaicCatalyst", + "Dimensionally Transcendent Prosaic Catalyst", + 0, + 0, + 100000000, + 1, + false, + true, + 1, + 1, + 1, + Dyes.dyeGreen) + .setHasCorrespondingFluid(true); + public static Materials DimensionallyTranscendentResplendentCatalyst = new Materials( + 746, + TextureSet.SET_FLUID, + 1.0F, + 0, + 2, + 16, + 10, + 20, + 20, + 1, + "DimensionallyTranscendentResplendentCatalyst", + "Dimensionally Transcendent Resplendent Catalyst", + 0, + 0, + 100000000, + 1, + false, + true, + 1, + 1, + 1, + Dyes.dyeLime) + .setHasCorrespondingFluid(true); + public static Materials DimensionallyTranscendentExoticCatalyst = new Materials( + 745, + TextureSet.SET_FLUID, + 1.0F, + 0, + 2, + 16, + 10, + 20, + 20, + 1, + "DimensionallyTranscendentExoticCatalyst", + "Dimensionally Transcendent Exotic Catalyst", + 0, + 0, + 100000000, + 1, + false, + true, + 1, + 1, + 1, + Dyes.dyeMagenta) + .setHasCorrespondingFluid(true); - public static Materials SpaceTime = new Materials( 588, new TextureSet("spacetime", true) , 320.0F, 4*2621440, 25, 1|2|64|128, 255, 255, 255, 0, "SpaceTime" , "SpaceTime" , -1, -1, 0, 0, false, true, 2, 1, 1, Dyes._NULL , Collections.singletonList(new TC_AspectStack(TC_Aspects.AQUA, 1))); - public static Materials TranscendentMetal = new Materials( 581, new TextureSet("transcendentmetal", true) , 290.0F, 3*2621440, 22, 1|2|64|128, 50, 50, 50,255, "TranscendentMetal" , "Transcendent Metal" , -1, -1, 0, 3000, true, true, 200, 1000, 1000, Dyes.dyeBlack , Collections.singletonList(new TC_AspectStack(TC_Aspects.AQUA, 1))).disableAutoGeneratedBlastFurnaceRecipes().disableAutoGeneratedVacuumFreezerRecipe(); + public static Materials ExcitedDTCC = new Materials( + 109, + TextureSet.SET_FLUID, + 1.0F, + 0, + 2, + 16, + 10, + 20, + 20, + 1, + "ExcitedDTCC", + "Excited Dimensionally Transcendent Crude Catalyst", + -1, + -1, + 500000000, + 1, + false, + true, + 1, + 1, + 1, + Dyes.dyeCyan); + public static Materials ExcitedDTPC = new Materials( + 113, + TextureSet.SET_FLUID, + 1.0F, + 0, + 2, + 16, + 35, + 59, + 41, + 1, + "ExcitedDTPC", + "Excited Dimensionally Transcendent Prosaic Catalyst", + -1, + -1, + 500000000, + 1, + false, + true, + 1, + 1, + 1, + Dyes.dyeGreen); + public static Materials ExcitedDTRC = new Materials( + 121, + TextureSet.SET_FLUID, + 1.0F, + 0, + 2, + 16, + 38, + 20, + 56, + 1, + "ExcitedDTRC", + "Excited Dimensionally Transcendent Resplendent Catalyst", + -1, + -1, + 500000000, + 1, + false, + true, + 1, + 1, + 1, + Dyes.dyeLime); + public static Materials ExcitedDTEC = new Materials( + 126, + TextureSet.SET_FLUID, + 1.0F, + 0, + 2, + 16, + 240, + 240, + 41, + 1, + "ExcitedDTEC", + "Excited Dimensionally Transcendent Exotic Catalyst", + -1, + -1, + 500000000, + 1, + false, + true, + 1, + 1, + 1, + Dyes.dyeMagenta); + public static Materials DimensionallyTranscendentResidue = new Materials( + 589, + TextureSet.SET_FLUID, + 1.0F, + 0, + 2, + 16, + 0, + 0, + 0, + 1, + "DimensionallyTranscendentResidue", + "Dimensionally Transcendent Residue", + -1, + -1, + 25, + 1, + false, + true, + 1, + 1, + 1, + Dyes.dyeBlack); + public static Materials SpaceTime = new Materials( + 588, + new TextureSet("spacetime", true), + 320.0F, + 4 * 2621440, + 25, + 1 | 2 | 64 | 128, + 255, + 255, + 255, + 0, + "SpaceTime", + "SpaceTime", + -1, + -1, + 0, + 0, + false, + true, + 2, + 1, + 1, + Dyes._NULL, + Collections.singletonList(new TC_AspectStack(TC_Aspects.AQUA, 1))); + public static Materials TranscendentMetal = new Materials( + 581, + new TextureSet("transcendentmetal", true), + 290.0F, + 3 * 2621440, + 22, + 1 | 2 | 64 | 128, + 50, + 50, + 50, + 255, + "TranscendentMetal", + "Transcendent Metal", + -1, + -1, + 0, + 3000, + true, + true, + 200, + 1000, + 1000, + Dyes.dyeBlack, + Collections.singletonList(new TC_AspectStack(TC_Aspects.AQUA, 1))) + .disableAutoGeneratedBlastFurnaceRecipes() + .disableAutoGeneratedVacuumFreezerRecipe(); static { MaterialsBotania.init(); } - static { MaterialsKevlar.init(); } @@ -900,12 +16893,19 @@ public class Materials implements IColorModulationContainer, ISubTagContainer { * @deprecated Use {@link #SuperconductorUHV} instead */ @Deprecated - public static Materials Superconductor = new Materials(SuperconductorUHV, true);// new Materials( -1, TextureSet.SET_NONE , 1.0F, 0, 0, 0 , 255, 255, 255, 0, "Superconductor" , "Superconductor" , 0, 0, -1, 0, false, false, 1, 1, 1, Dyes.dyeLightGray , Arrays.asList(new TC_AspectStack(TC_Aspects.ELECTRUM, 9))); + public static Materials Superconductor = new Materials( + SuperconductorUHV, true); // new Materials( -1, TextureSet.SET_NONE , 1.0F, 0, 0, 0 + // , 255, 255, 255, 0, "Superconductor" , "Superconductor" , 0, + // 0, -1, 0, false, false, 1, 1, 1, Dyes.dyeLightGray , Arrays.asList(new + // TC_AspectStack(TC_Aspects.ELECTRUM, 9))); + @Deprecated public static Materials Nikolite = new Materials(Electrotine, false); + @Deprecated public static Materials Phosphor = new Materials(Phosphorus, false); - private static Materials[] MATERIALS_ARRAY = new Materials[]{}; + + private static Materials[] MATERIALS_ARRAY = new Materials[] {}; static { initSubTags(); @@ -924,23 +16924,16 @@ public class Materials implements IColorModulationContainer, ISubTagContainer { overrideChemicalFormulars(); } - public final short[] - mRGBa = new short[]{255, 255, 255, 0}, - mMoltenRGBa = new short[]{255, 255, 255, 0}; + public final short[] mRGBa = new short[] {255, 255, 255, 0}, mMoltenRGBa = new short[] {255, 255, 255, 0}; public TextureSet mIconSet; public GT_GeneratedMaterial_Renderer renderer; public List<MaterialStack> mMaterialList = new ArrayList<>(); - public List<Materials> - mOreByProducts = new ArrayList<>(), - mOreReRegistrations = new ArrayList<>(); + public List<Materials> mOreByProducts = new ArrayList<>(), mOreReRegistrations = new ArrayList<>(); public List<TC_Aspects.TC_AspectStack> mAspects = new ArrayList<>(); public ArrayList<ItemStack> mMaterialItems = new ArrayList<>(); public Collection<SubTag> mSubTags = new LinkedHashSet<>(); - public Enchantment - mEnchantmentTools = null, - mEnchantmentArmors = null; - public boolean - mUnificatable, + public Enchantment mEnchantmentTools = null, mEnchantmentArmors = null; + public boolean mUnificatable, mBlastFurnaceRequired = false, mAutoGenerateBlastFurnaceRecipes = true, mAutoGenerateVacuumFreezerRecipes = true, @@ -949,14 +16942,9 @@ public class Materials implements IColorModulationContainer, ISubTagContainer { mHasPlasma = false, mHasGas = false, mCustomOre = false; - public byte - mEnchantmentToolsLevel = 0, - mEnchantmentArmorsLevel = 0, - mToolQuality = 0; - public short - mBlastFurnaceTemp = 0; - public int - mMeltingPoint = 0, + public byte mEnchantmentToolsLevel = 0, mEnchantmentArmorsLevel = 0, mToolQuality = 0; + public short mBlastFurnaceTemp = 0; + public int mMeltingPoint = 0, mGasTemp = 0, mMetaItemSubID, mTypes = 0, @@ -971,14 +16959,12 @@ public class Materials implements IColorModulationContainer, ISubTagContainer { mDensityMultiplier = 1, mDensityDivider = 1; public long mDensity = M; - public float - mToolSpeed = 1.0F, + public float mToolSpeed = 1.0F, mHeatDamage = 0.0F, mSteamMultiplier = 1.0F, mGasMultiplier = 1.0F, mPlasmaMultiplier = 1.0F; - public String - mChemicalFormula = "?", + public String mChemicalFormula = "?", mName, mDefaultLocalName, mCustomID = "null", @@ -986,36 +16972,57 @@ public class Materials implements IColorModulationContainer, ISubTagContainer { mLocalizedName = "null"; public Dyes mColor = Dyes._NULL; public Element mElement = null; - public Materials - mDirectSmelting = this, + public Materials mDirectSmelting = this, mOreReplacement = this, mMacerateInto = this, mSmeltInto = this, mArcSmeltInto = this, mHandleMaterial = this, mMaterialInto; - public Fluid - mSolid = null, - mFluid = null, - mGas = null, - mPlasma = null; + public Fluid mSolid = null, mFluid = null, mGas = null, mPlasma = null; /** * This Fluid is used as standard Unit for Molten Materials. 1296 is a Molten Block, that means 144 is one Material Unit worth of fluid. */ public Fluid mStandardMoltenFluid = null; - private boolean - hasCorrespondingFluid = false, - hasCorrespondingGas = false, - canBeCracked = false; - private Fluid[] - hydroCrackedFluids = new Fluid[3], - steamCrackedFluids = new Fluid[3]; - public Materials(int aMetaItemSubID, TextureSet aIconSet, float aToolSpeed, int aDurability, int aToolQuality, boolean aUnificatable, String aName, String aDefaultLocalName) { - this(aMetaItemSubID, aIconSet, aToolSpeed, aDurability, aToolQuality, aUnificatable, aName, aDefaultLocalName, "ore", false, "null"); + private boolean hasCorrespondingFluid = false, hasCorrespondingGas = false, canBeCracked = false; + private Fluid[] hydroCrackedFluids = new Fluid[3], steamCrackedFluids = new Fluid[3]; + + public Materials( + int aMetaItemSubID, + TextureSet aIconSet, + float aToolSpeed, + int aDurability, + int aToolQuality, + boolean aUnificatable, + String aName, + String aDefaultLocalName) { + this( + aMetaItemSubID, + aIconSet, + aToolSpeed, + aDurability, + aToolQuality, + aUnificatable, + aName, + aDefaultLocalName, + "ore", + false, + "null"); } - public Materials(int aMetaItemSubID, TextureSet aIconSet, float aToolSpeed, int aDurability, int aToolQuality, boolean aUnificatable, String aName, String aDefaultLocalName, String aConfigSection, boolean aCustomOre, String aCustomID) { + public Materials( + int aMetaItemSubID, + TextureSet aIconSet, + float aToolSpeed, + int aDurability, + int aToolQuality, + boolean aUnificatable, + String aName, + String aDefaultLocalName, + String aConfigSection, + boolean aCustomOre, + String aCustomID) { mMetaItemSubID = aMetaItemSubID; mDefaultLocalName = aDefaultLocalName; mName = aName; @@ -1036,19 +17043,113 @@ public class Materials implements IColorModulationContainer, ISubTagContainer { mDefaultLocalName = aMaterialInto.mDefaultLocalName; mName = aMaterialInto.mName; mMaterialInto = aMaterialInto.mMaterialInto; - if (aReRegisterIntoThis) - mMaterialInto.mOreReRegistrations.add(this); + if (aReRegisterIntoThis) mMaterialInto.mOreReRegistrations.add(this); mChemicalFormula = aMaterialInto.mChemicalFormula; mMetaItemSubID = -1; mIconSet = TextureSet.SET_NONE; } - public Materials(int aMetaItemSubID, TextureSet aIconSet, float aToolSpeed, int aDurability, int aToolQuality, int aTypes, int aR, int aG, int aB, int aA, String aName, String aDefaultLocalName, int aFuelType, int aFuelPower, int aMeltingPoint, int aBlastFurnaceTemp, boolean aBlastFurnaceRequired, boolean aTransparent, int aOreValue, int aDensityMultiplier, int aDensityDivider, Dyes aColor) { - this(aMetaItemSubID, aIconSet, aToolSpeed, aDurability, aToolQuality, aTypes, aR, aG, aB, aA, aName, aDefaultLocalName, aFuelType, aFuelPower, aMeltingPoint, aBlastFurnaceTemp, aBlastFurnaceRequired, aTransparent, aOreValue, aDensityMultiplier, aDensityDivider, aColor, "ore", false, "null"); + public Materials( + int aMetaItemSubID, + TextureSet aIconSet, + float aToolSpeed, + int aDurability, + int aToolQuality, + int aTypes, + int aR, + int aG, + int aB, + int aA, + String aName, + String aDefaultLocalName, + int aFuelType, + int aFuelPower, + int aMeltingPoint, + int aBlastFurnaceTemp, + boolean aBlastFurnaceRequired, + boolean aTransparent, + int aOreValue, + int aDensityMultiplier, + int aDensityDivider, + Dyes aColor) { + this( + aMetaItemSubID, + aIconSet, + aToolSpeed, + aDurability, + aToolQuality, + aTypes, + aR, + aG, + aB, + aA, + aName, + aDefaultLocalName, + aFuelType, + aFuelPower, + aMeltingPoint, + aBlastFurnaceTemp, + aBlastFurnaceRequired, + aTransparent, + aOreValue, + aDensityMultiplier, + aDensityDivider, + aColor, + "ore", + false, + "null"); } - public Materials(int aMetaItemSubID, TextureSet aIconSet, float aToolSpeed, int aDurability, int aToolQuality, int aTypes, int aR, int aG, int aB, int aA, String aName, String aDefaultLocalName, int aFuelType, int aFuelPower, int aMeltingPoint, int aBlastFurnaceTemp, boolean aBlastFurnaceRequired, boolean aTransparent, int aOreValue, int aDensityMultiplier, int aDensityDivider, Dyes aColor, String aConfigSection) { - this(aMetaItemSubID, aIconSet, aToolSpeed, aDurability, aToolQuality, aTypes, aR, aG, aB, aA, aName, aDefaultLocalName, aFuelType, aFuelPower, aMeltingPoint, aBlastFurnaceTemp, aBlastFurnaceRequired, aTransparent, aOreValue, aDensityMultiplier, aDensityDivider, aColor, aConfigSection, false, "null"); + public Materials( + int aMetaItemSubID, + TextureSet aIconSet, + float aToolSpeed, + int aDurability, + int aToolQuality, + int aTypes, + int aR, + int aG, + int aB, + int aA, + String aName, + String aDefaultLocalName, + int aFuelType, + int aFuelPower, + int aMeltingPoint, + int aBlastFurnaceTemp, + boolean aBlastFurnaceRequired, + boolean aTransparent, + int aOreValue, + int aDensityMultiplier, + int aDensityDivider, + Dyes aColor, + String aConfigSection) { + this( + aMetaItemSubID, + aIconSet, + aToolSpeed, + aDurability, + aToolQuality, + aTypes, + aR, + aG, + aB, + aA, + aName, + aDefaultLocalName, + aFuelType, + aFuelPower, + aMeltingPoint, + aBlastFurnaceTemp, + aBlastFurnaceRequired, + aTransparent, + aOreValue, + aDensityMultiplier, + aDensityDivider, + aColor, + aConfigSection, + false, + "null"); } /** @@ -1073,8 +17174,44 @@ public class Materials implements IColorModulationContainer, ISubTagContainer { * @param aBlastFurnaceRequired If this requires a Blast Furnace. * @param aColor Vanilla MC Wool Color which comes the closest to this. */ - public Materials(int aMetaItemSubID, TextureSet aIconSet, float aToolSpeed, int aDurability, int aToolQuality, int aTypes, int aR, int aG, int aB, int aA, String aName, String aDefaultLocalName, int aFuelType, int aFuelPower, int aMeltingPoint, int aBlastFurnaceTemp, boolean aBlastFurnaceRequired, boolean aTransparent, int aOreValue, int aDensityMultiplier, int aDensityDivider, Dyes aColor, String aConfigSection, boolean aCustomOre, String aCustomID) { - this(aMetaItemSubID, aIconSet, aToolSpeed, aDurability, aToolQuality, true, aName, aDefaultLocalName, aConfigSection, aCustomOre, aCustomID); + public Materials( + int aMetaItemSubID, + TextureSet aIconSet, + float aToolSpeed, + int aDurability, + int aToolQuality, + int aTypes, + int aR, + int aG, + int aB, + int aA, + String aName, + String aDefaultLocalName, + int aFuelType, + int aFuelPower, + int aMeltingPoint, + int aBlastFurnaceTemp, + boolean aBlastFurnaceRequired, + boolean aTransparent, + int aOreValue, + int aDensityMultiplier, + int aDensityDivider, + Dyes aColor, + String aConfigSection, + boolean aCustomOre, + String aCustomID) { + this( + aMetaItemSubID, + aIconSet, + aToolSpeed, + aDurability, + aToolQuality, + true, + aName, + aDefaultLocalName, + aConfigSection, + aCustomOre, + aCustomID); mMeltingPoint = aMeltingPoint; mBlastFurnaceRequired = aBlastFurnaceRequired; mBlastFurnaceTemp = (short) aBlastFurnaceTemp; @@ -1091,21 +17228,109 @@ public class Materials implements IColorModulationContainer, ISubTagContainer { mRGBa[2] = mMoltenRGBa[2] = (short) aB; mRGBa[3] = mMoltenRGBa[3] = (short) aA; mTypes = aTypes; - if (mColor != null) - add(SubTag.HAS_COLOR); - if (mTransparent) - add(SubTag.TRANSPARENT); - if ((mTypes & 2) != 0) - add(SubTag.SMELTING_TO_FLUID); + if (mColor != null) add(SubTag.HAS_COLOR); + if (mTransparent) add(SubTag.TRANSPARENT); + if ((mTypes & 2) != 0) add(SubTag.SMELTING_TO_FLUID); } - public Materials(int aMetaItemSubID, TextureSet aIconSet, float aToolSpeed, int aDurability, int aToolQuality, int aTypes, int aR, int aG, int aB, int aA, String aName, String aDefaultLocalName, int aFuelType, int aFuelPower, int aMeltingPoint, int aBlastFurnaceTemp, boolean aBlastFurnaceRequired, boolean aTransparent, int aOreValue, int aDensityMultiplier, int aDensityDivider, Dyes aColor, List<TC_Aspects.TC_AspectStack> aAspects) { - this(aMetaItemSubID, aIconSet, aToolSpeed, aDurability, aToolQuality, aTypes, aR, aG, aB, aA, aName, aDefaultLocalName, aFuelType, aFuelPower, aMeltingPoint, aBlastFurnaceTemp, aBlastFurnaceRequired, aTransparent, aOreValue, aDensityMultiplier, aDensityDivider, aColor); + public Materials( + int aMetaItemSubID, + TextureSet aIconSet, + float aToolSpeed, + int aDurability, + int aToolQuality, + int aTypes, + int aR, + int aG, + int aB, + int aA, + String aName, + String aDefaultLocalName, + int aFuelType, + int aFuelPower, + int aMeltingPoint, + int aBlastFurnaceTemp, + boolean aBlastFurnaceRequired, + boolean aTransparent, + int aOreValue, + int aDensityMultiplier, + int aDensityDivider, + Dyes aColor, + List<TC_Aspects.TC_AspectStack> aAspects) { + this( + aMetaItemSubID, + aIconSet, + aToolSpeed, + aDurability, + aToolQuality, + aTypes, + aR, + aG, + aB, + aA, + aName, + aDefaultLocalName, + aFuelType, + aFuelPower, + aMeltingPoint, + aBlastFurnaceTemp, + aBlastFurnaceRequired, + aTransparent, + aOreValue, + aDensityMultiplier, + aDensityDivider, + aColor); mAspects.addAll(aAspects); } - public Materials(int aMetaItemSubID, TextureSet aIconSet, float aToolSpeed, int aDurability, int aToolQuality, int aTypes, int aR, int aG, int aB, int aA, String aName, String aDefaultLocalName, int aFuelType, int aFuelPower, int aMeltingPoint, int aBlastFurnaceTemp, boolean aBlastFurnaceRequired, boolean aTransparent, int aOreValue, int aDensityMultiplier, int aDensityDivider, Dyes aColor, Element aElement, List<TC_Aspects.TC_AspectStack> aAspects) { - this(aMetaItemSubID, aIconSet, aToolSpeed, aDurability, aToolQuality, aTypes, aR, aG, aB, aA, aName, aDefaultLocalName, aFuelType, aFuelPower, aMeltingPoint, aBlastFurnaceTemp, aBlastFurnaceRequired, aTransparent, aOreValue, aDensityMultiplier, aDensityDivider, aColor); + public Materials( + int aMetaItemSubID, + TextureSet aIconSet, + float aToolSpeed, + int aDurability, + int aToolQuality, + int aTypes, + int aR, + int aG, + int aB, + int aA, + String aName, + String aDefaultLocalName, + int aFuelType, + int aFuelPower, + int aMeltingPoint, + int aBlastFurnaceTemp, + boolean aBlastFurnaceRequired, + boolean aTransparent, + int aOreValue, + int aDensityMultiplier, + int aDensityDivider, + Dyes aColor, + Element aElement, + List<TC_Aspects.TC_AspectStack> aAspects) { + this( + aMetaItemSubID, + aIconSet, + aToolSpeed, + aDurability, + aToolQuality, + aTypes, + aR, + aG, + aB, + aA, + aName, + aDefaultLocalName, + aFuelType, + aFuelPower, + aMeltingPoint, + aBlastFurnaceTemp, + aBlastFurnaceRequired, + aTransparent, + aOreValue, + aDensityMultiplier, + aDensityDivider, + aColor); mElement = aElement; mElement.mLinkedMaterials.add(this); if (aElement == Element._NULL) { @@ -1117,18 +17342,116 @@ public class Materials implements IColorModulationContainer, ISubTagContainer { mAspects.addAll(aAspects); } - public Materials(int aMetaItemSubID, TextureSet aIconSet, float aToolSpeed, int aDurability, int aToolQuality, int aTypes, int aR, int aG, int aB, int aA, String aName, String aDefaultLocalName, int aFuelType, int aFuelPower, int aMeltingPoint, int aBlastFurnaceTemp, boolean aBlastFurnaceRequired, boolean aTransparent, int aOreValue, int aDensityMultiplier, int aDensityDivider, Dyes aColor, int aExtraData, List<MaterialStack> aMaterialList) { - this(aMetaItemSubID, aIconSet, aToolSpeed, aDurability, aToolQuality, aTypes, aR, aG, aB, aA, aName, aDefaultLocalName, aFuelType, aFuelPower, aMeltingPoint, aBlastFurnaceTemp, aBlastFurnaceRequired, aTransparent, aOreValue, aDensityMultiplier, aDensityDivider, aColor, aExtraData, aMaterialList, null); + public Materials( + int aMetaItemSubID, + TextureSet aIconSet, + float aToolSpeed, + int aDurability, + int aToolQuality, + int aTypes, + int aR, + int aG, + int aB, + int aA, + String aName, + String aDefaultLocalName, + int aFuelType, + int aFuelPower, + int aMeltingPoint, + int aBlastFurnaceTemp, + boolean aBlastFurnaceRequired, + boolean aTransparent, + int aOreValue, + int aDensityMultiplier, + int aDensityDivider, + Dyes aColor, + int aExtraData, + List<MaterialStack> aMaterialList) { + this( + aMetaItemSubID, + aIconSet, + aToolSpeed, + aDurability, + aToolQuality, + aTypes, + aR, + aG, + aB, + aA, + aName, + aDefaultLocalName, + aFuelType, + aFuelPower, + aMeltingPoint, + aBlastFurnaceTemp, + aBlastFurnaceRequired, + aTransparent, + aOreValue, + aDensityMultiplier, + aDensityDivider, + aColor, + aExtraData, + aMaterialList, + null); } - public Materials(int aMetaItemSubID, TextureSet aIconSet, float aToolSpeed, int aDurability, int aToolQuality, int aTypes, int aR, int aG, int aB, int aA, String aName, String aDefaultLocalName, int aFuelType, int aFuelPower, int aMeltingPoint, int aBlastFurnaceTemp, boolean aBlastFurnaceRequired, boolean aTransparent, int aOreValue, int aDensityMultiplier, int aDensityDivider, Dyes aColor, int aExtraData, List<MaterialStack> aMaterialList, List<TC_Aspects.TC_AspectStack> aAspects) { - this(aMetaItemSubID, aIconSet, aToolSpeed, aDurability, aToolQuality, aTypes, aR, aG, aB, aA, aName, aDefaultLocalName, aFuelType, aFuelPower, aMeltingPoint, aBlastFurnaceTemp, aBlastFurnaceRequired, aTransparent, aOreValue, aDensityMultiplier, aDensityDivider, aColor); + public Materials( + int aMetaItemSubID, + TextureSet aIconSet, + float aToolSpeed, + int aDurability, + int aToolQuality, + int aTypes, + int aR, + int aG, + int aB, + int aA, + String aName, + String aDefaultLocalName, + int aFuelType, + int aFuelPower, + int aMeltingPoint, + int aBlastFurnaceTemp, + boolean aBlastFurnaceRequired, + boolean aTransparent, + int aOreValue, + int aDensityMultiplier, + int aDensityDivider, + Dyes aColor, + int aExtraData, + List<MaterialStack> aMaterialList, + List<TC_Aspects.TC_AspectStack> aAspects) { + this( + aMetaItemSubID, + aIconSet, + aToolSpeed, + aDurability, + aToolQuality, + aTypes, + aR, + aG, + aB, + aA, + aName, + aDefaultLocalName, + aFuelType, + aFuelPower, + aMeltingPoint, + aBlastFurnaceTemp, + aBlastFurnaceRequired, + aTransparent, + aOreValue, + aDensityMultiplier, + aDensityDivider, + aColor); mExtraData = aExtraData; mMaterialList.addAll(aMaterialList); - mChemicalFormula = mMaterialList.stream().map(MaterialStack::toString).collect(Collectors.joining()).replaceAll("_", "-"); + mChemicalFormula = mMaterialList.stream() + .map(MaterialStack::toString) + .collect(Collectors.joining()) + .replaceAll("_", "-"); - int tAmountOfComponents = 0, - tMeltingPoint = 0; + int tAmountOfComponents = 0, tMeltingPoint = 0; for (MaterialStack tMaterial : mMaterialList) { tAmountOfComponents += tMaterial.mAmount; if (tMaterial.mMaterial.mMeltingPoint > 0) @@ -1138,8 +17461,7 @@ public class Materials implements IColorModulationContainer, ISubTagContainer { tAspect.addToAspectList(mAspects); } - if (mMeltingPoint < 0) - mMeltingPoint = (short) (tMeltingPoint / tAmountOfComponents); + if (mMeltingPoint < 0) mMeltingPoint = (short) (tMeltingPoint / tAmountOfComponents); tAmountOfComponents *= aDensityMultiplier; tAmountOfComponents /= aDensityDivider; @@ -1151,7 +17473,9 @@ public class Materials implements IColorModulationContainer, ISubTagContainer { private static void setSmeltingInto() { SamariumMagnetic.setSmeltingInto(Samarium).setMaceratingInto(Samarium).setArcSmeltingInto(Samarium); - NeodymiumMagnetic.setSmeltingInto(Neodymium).setMaceratingInto(Neodymium).setArcSmeltingInto(Neodymium); + 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); @@ -1160,7 +17484,9 @@ public class Materials implements IColorModulationContainer, ISubTagContainer { 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); + AnnealedCopper.setSmeltingInto(AnnealedCopper) + .setMaceratingInto(AnnealedCopper) + .setArcSmeltingInto(AnnealedCopper); Netherrack.setSmeltingInto(NetherBrick); MeatRaw.setSmeltingInto(MeatCooked); Sand.setSmeltingInto(Glass); @@ -1175,9 +17501,15 @@ 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); + 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); @@ -1616,25 +17948,18 @@ public class Materials implements IColorModulationContainer, ISubTagContainer { Longasssuperconductornameforuvwire.mChemicalFormula = "Nq*\u2084(Ir\u2083Os)\u2083EuSm"; Longasssuperconductornameforuhvwire.mChemicalFormula = "D\u2086(SpNt)\u2087Tn\u2085Am\u2086"; SuperconductorUEVBase.mChemicalFormula = "D*\u2085If*\u2085(✦◆✦)(⚷⚙⚷ Ni4Ti6)"; - SuperconductorUIVBase.mChemicalFormula = "(C\u2081\u2084Os\u2081\u2081O\u2087Ag\u2083SpH\u2082O)\u2084?\u2081\u2080(Fs⚶)\u2086(⌘☯☯⌘)\u2085"; - SuperconductorUMVBase.mChemicalFormula = "?\u2086Or\u2083(Hy⚶)\u2081\u2081(((CW)\u2087Ti\u2083)\u2083???)\u2085۞\u2082"; + SuperconductorUIVBase.mChemicalFormula = + "(C\u2081\u2084Os\u2081\u2081O\u2087Ag\u2083SpH\u2082O)\u2084?\u2081\u2080(Fs⚶)\u2086(⌘☯☯⌘)\u2085"; + SuperconductorUMVBase.mChemicalFormula = + "?\u2086Or\u2083(Hy⚶)\u2081\u2081(((CW)\u2087Ti\u2083)\u2083???)\u2085۞\u2082"; Diatomite.mChemicalFormula = "(SiO\u2082)\u2088Fe\u2082O\u2083(Al\u2082O\u2083)"; } private static void initSubTags() { - SubTag.ELECTROMAGNETIC_SEPERATION_NEODYMIUM.addTo( - Bastnasite, - Monazite, - Forcicium, - Forcillium - ); + SubTag.ELECTROMAGNETIC_SEPERATION_NEODYMIUM.addTo(Bastnasite, Monazite, Forcicium, Forcillium); SubTag.ELECTROMAGNETIC_SEPERATION_GOLD.addTo( - Magnetite, - VanadiumMagnetite, - BasalticMineralSand, - GraniticMineralSand - ); + Magnetite, VanadiumMagnetite, BasalticMineralSand, GraniticMineralSand); SubTag.ELECTROMAGNETIC_SEPERATION_IRON.addTo( YellowLimonite, @@ -1652,46 +17977,20 @@ public class Materials implements IColorModulationContainer, ISubTagContainer { Manganese, Chrome, Chromite, - Andradite - ); + Andradite); SubTag.BLASTFURNACE_CALCITE_DOUBLE.addTo( - Pyrite, - BrownLimonite, - YellowLimonite, - BasalticMineralSand, - GraniticMineralSand, - Magnetite) - ; + Pyrite, BrownLimonite, YellowLimonite, BasalticMineralSand, GraniticMineralSand, Magnetite); - SubTag.BLASTFURNACE_CALCITE_TRIPLE.addTo( - Iron, - PigIron, - DeepIron, - ShadowIron, - WroughtIron, - MeteoricIron - ); + SubTag.BLASTFURNACE_CALCITE_TRIPLE.addTo(Iron, PigIron, DeepIron, ShadowIron, WroughtIron, MeteoricIron); - SubTag.WASHING_MERCURY.addTo( - Gold, - Osmium, - Mithril, - Platinum, - Cooperite, - AstralSilver - ); + SubTag.WASHING_MERCURY.addTo(Gold, Osmium, Mithril, Platinum, Cooperite, AstralSilver); SubTag.WASHING_MERCURY_99_PERCENT.addTo(Silver); - SubTag.WASHING_SODIUMPERSULFATE.addTo( - Zinc, - Nickel, - Copper, - Cobalt, - Cobaltite, - Tetrahedrite); - SubTag.METAL.addTo(AnyIron, + SubTag.WASHING_SODIUMPERSULFATE.addTo(Zinc, Nickel, Copper, Cobalt, Cobaltite, Tetrahedrite); + SubTag.METAL.addTo( + AnyIron, AnyCopper, AnyBronze, Metal, @@ -1711,7 +18010,6 @@ public class Materials implements IColorModulationContainer, ISubTagContainer { Gadolinium, Gallium, Gold, - Holmium, Indium, Iridium, @@ -1732,7 +18030,6 @@ public class Materials implements IColorModulationContainer, ISubTagContainer { Platinum, Plutonium, Plutonium241, - Praseodymium, Promethium, Rubidium, @@ -1753,7 +18050,6 @@ public class Materials implements IColorModulationContainer, ISubTagContainer { Vanadium, Ytterbium, Yttrium, - Zinc, Flerovium, PhasedIron, @@ -1773,7 +18069,6 @@ public class Materials implements IColorModulationContainer, ISubTagContainer { CrudeSteel, EndSteel, PulsatingIron, - DarkThaumium, Adamantium, Amordrine, @@ -1785,7 +18080,6 @@ public class Materials implements IColorModulationContainer, ISubTagContainer { Celenegil, Ceruclase, DarkIron, - Desh, Desichalkos, Duranium, @@ -1805,7 +18099,6 @@ public class Materials implements IColorModulationContainer, ISubTagContainer { Mercassium, MeteoricIron, BloodInfusedIron, - MeteoricSteel, Naquadah, NaquadahAlloy, @@ -1914,7 +18207,8 @@ public class Materials implements IColorModulationContainer, ISubTagContainer { RedstoneAlloy, Bedrockium); - SubTag.FOOD.addTo(MeatRaw, + SubTag.FOOD.addTo( + MeatRaw, MeatCooked, Ice, Water, @@ -1933,14 +18227,19 @@ public class Materials implements IColorModulationContainer, ISubTagContainer { SeedOilHemp, Wheat, Sugar, - FreshWater - ); + FreshWater); -// TranscendentMetal.add(SubTag.NO_SMELTING); + // TranscendentMetal.add(SubTag.NO_SMELTING); Wood.add(SubTag.WOOD, SubTag.FLAMMABLE, SubTag.NO_SMELTING, SubTag.NO_SMASHING); WoodSealed.add(SubTag.WOOD, SubTag.FLAMMABLE, SubTag.NO_SMELTING, SubTag.NO_SMASHING, SubTag.NO_WORKING); Peanutwood.add(SubTag.WOOD, SubTag.FLAMMABLE, SubTag.NO_SMELTING, SubTag.NO_SMASHING); - LiveRoot.add(SubTag.WOOD, SubTag.FLAMMABLE, SubTag.NO_SMELTING, SubTag.NO_SMASHING, SubTag.MAGICAL, SubTag.MORTAR_GRINDABLE); + LiveRoot.add( + SubTag.WOOD, + SubTag.FLAMMABLE, + SubTag.NO_SMELTING, + SubTag.NO_SMASHING, + SubTag.MAGICAL, + SubTag.MORTAR_GRINDABLE); IronWood.add(SubTag.WOOD, SubTag.FLAMMABLE, SubTag.MAGICAL, SubTag.MORTAR_GRINDABLE); Steeleaf.add(SubTag.WOOD, SubTag.FLAMMABLE, SubTag.MAGICAL, SubTag.MORTAR_GRINDABLE, SubTag.NO_SMELTING); @@ -1982,7 +18281,12 @@ public class Materials implements IColorModulationContainer, ISubTagContainer { Concrete.add(SubTag.STONE, SubTag.NO_SMASHING, SubTag.SMELTING_TO_FLUID); ConstructionFoam.add(SubTag.STONE, SubTag.NO_SMASHING, SubTag.EXPLOSIVE, SubTag.NO_SMELTING); - Redstone.add(SubTag.STONE, SubTag.NO_SMASHING, SubTag.UNBURNABLE, SubTag.SMELTING_TO_FLUID, SubTag.PULVERIZING_CINNABAR); + Redstone.add( + SubTag.STONE, + SubTag.NO_SMASHING, + SubTag.UNBURNABLE, + SubTag.SMELTING_TO_FLUID, + SubTag.PULVERIZING_CINNABAR); Glowstone.add(SubTag.STONE, SubTag.NO_SMASHING, SubTag.UNBURNABLE, SubTag.SMELTING_TO_FLUID); Electrotine.add(SubTag.STONE, SubTag.NO_SMASHING, SubTag.UNBURNABLE, SubTag.SMELTING_TO_FLUID); Teslatite.add(SubTag.STONE, SubTag.NO_SMASHING, SubTag.UNBURNABLE, SubTag.SMELTING_TO_FLUID); @@ -2050,12 +18354,14 @@ 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); @@ -2068,7 +18374,15 @@ public class Materials implements IColorModulationContainer, ISubTagContainer { NetherStar.add(SubTag.CRYSTAL, SubTag.NO_SMASHING, SubTag.NO_SMELTING, SubTag.MAGICAL, SubTag.UNBURNABLE); EnderPearl.add(SubTag.CRYSTAL, SubTag.NO_SMASHING, SubTag.NO_SMELTING, SubTag.MAGICAL, SubTag.PEARL); EnderEye.add(SubTag.CRYSTAL, SubTag.NO_SMASHING, SubTag.NO_SMELTING, SubTag.MAGICAL, SubTag.PEARL); - Firestone.add(SubTag.CRYSTAL, SubTag.NO_SMASHING, SubTag.NO_SMELTING, SubTag.CRYSTALLISABLE, SubTag.MAGICAL, SubTag.QUARTZ, SubTag.UNBURNABLE, SubTag.BURNING); + Firestone.add( + SubTag.CRYSTAL, + SubTag.NO_SMASHING, + SubTag.NO_SMELTING, + SubTag.CRYSTALLISABLE, + SubTag.MAGICAL, + SubTag.QUARTZ, + SubTag.UNBURNABLE, + SubTag.BURNING); Forcicium.add(SubTag.CRYSTAL, SubTag.NO_SMASHING, SubTag.NO_SMELTING, SubTag.CRYSTALLISABLE, SubTag.MAGICAL); Forcillium.add(SubTag.CRYSTAL, SubTag.NO_SMASHING, SubTag.NO_SMELTING, SubTag.CRYSTALLISABLE, SubTag.MAGICAL); Force.add(SubTag.CRYSTAL, SubTag.MAGICAL, SubTag.UNBURNABLE); @@ -2091,7 +18405,7 @@ public class Materials implements IColorModulationContainer, ISubTagContainer { SuperconductorIV.add(SubTag.NO_SMASHING, SubTag.NO_SMELTING); SuperconductorLuV.add(SubTag.NO_SMASHING, SubTag.NO_SMELTING); SuperconductorZPM.add(SubTag.NO_SMASHING, SubTag.NO_SMELTING); - //SuperconductorUV .add(SubTag.NO_SMASHING, SubTag.NO_SMELTING); + // SuperconductorUV .add(SubTag.NO_SMASHING, SubTag.NO_SMELTING); SuperconductorUHV.add(SubTag.NO_SMASHING, SubTag.NO_SMELTING); Blaze.add(SubTag.MAGICAL, SubTag.SMELTING_TO_FLUID, SubTag.MORTAR_GRINDABLE, SubTag.UNBURNABLE, SubTag.BURNING); @@ -2104,26 +18418,26 @@ public class Materials implements IColorModulationContainer, ISubTagContainer { Mithril.add(SubTag.MAGICAL); Carbon.add(SubTag.NO_SMELTING); - } public static void init() { new ProcessingConfig(); - if (!GT_Mod.gregtechproxy.mEnableAllMaterials) - new ProcessingModSupport(); - 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. + if (!GT_Mod.gregtechproxy.mEnableAllMaterials) new ProcessingModSupport(); + 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. VALUES = Arrays.asList(MATERIALS_ARRAY); if (!Loader.isModLoaded(MOD_ID_DC) && !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()) - ); + OrePrefixes.ingotHot.mDisabledItems.addAll(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); @@ -2144,7 +18458,6 @@ public class Materials implements IColorModulationContainer, ISubTagContainer { } fillGeneratedMaterialsMap(); - } private static void fillGeneratedMaterialsMap() { @@ -2155,10 +18468,12 @@ public class Materials implements IColorModulationContainer, ISubTagContainer { if (GregTech_API.sGeneratedMaterials[aMaterial.mMetaItemSubID] == null) { GregTech_API.sGeneratedMaterials[aMaterial.mMetaItemSubID] = aMaterial; } else - throw new IllegalArgumentException("The Material Index " + aMaterial.mMetaItemSubID + " for " + aMaterial.mName + " is already used!"); + throw new IllegalArgumentException("The Material Index " + aMaterial.mMetaItemSubID + + " for " + aMaterial.mName + " is already used!"); } } else - throw new IllegalArgumentException("The Material Index " + aMaterial.mMetaItemSubID + " for " + aMaterial.mName + " is/over the maximum of 1000"); + throw new IllegalArgumentException("The Material Index " + aMaterial.mMetaItemSubID + " for " + + aMaterial.mName + " is/over the maximum of 1000"); } } } @@ -2169,24 +18484,42 @@ 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)); + 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.mDensity = (long) GregTech_API.sMaterialProperties.get(aConfigPath, "Density", ((double) M * aMaterial.mDensityMultiplier) / (aMaterial.mDensityDivider != 0 ? aMaterial.mDensityDivider : 1)); + 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", + ((double) M * aMaterial.mDensityMultiplier) + / (aMaterial.mDensityDivider != 0 ? aMaterial.mDensityDivider : 1)); } 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, "MatRGBA", aMaterial.mRGBa[0] + "," + aMaterial.mRGBa[1] + "," + aMaterial.mRGBa[2] + "," + aMaterial.mRGBa[3] + ",").split(","); + String[] aRGBA = GregTech_API.sMaterialProperties + .get( + aConfigPath, + "MatRGBA", + aMaterial.mRGBa[0] + "," + aMaterial.mRGBa[1] + "," + aMaterial.mRGBa[2] + "," + + aMaterial.mRGBa[3] + ",") + .split(","); aMaterial.mRGBa[0] = Short.parseShort(aRGBA[0]); aMaterial.mRGBa[1] = Short.parseShort(aRGBA[1]); aMaterial.mRGBa[2] = Short.parseShort(aRGBA[2]); @@ -2194,33 +18527,62 @@ 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 : aMaterial.contains(SubTag.BURNING) ? Blaze : aMaterial.contains(SubTag.MAGICAL) && aMaterial.contains(SubTag.CRYSTAL) && Loader.isModLoaded(GT_Values.MOD_ID_TC) ? Thaumium : aMaterial.getMass() > Element.Tc.getMass() * 2 ? TungstenSteel : aMaterial.getMass() > Element.Tc.getMass() ? Steel : Wood); + aMaterial.mHandleMaterial = (aMaterial == Desh + ? aMaterial.mHandleMaterial + : aMaterial == Diamond || aMaterial == Thaumium + ? Wood + : aMaterial.contains(SubTag.BURNING) + ? Blaze + : aMaterial.contains(SubTag.MAGICAL) + && aMaterial.contains(SubTag.CRYSTAL) + && Loader.isModLoaded(GT_Values.MOD_ID_TC) + ? Thaumium + : aMaterial.getMass() > Element.Tc.getMass() * 2 + ? TungstenSteel + : aMaterial.getMass() > Element.Tc.getMass() ? Steel : Wood); } private static void addEnchantmentValues(Materials aMaterial, String aConfigPath) { - 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() : ""); + 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]); + IntStream.range(0, Enchantment.enchantmentsList.length) + .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)); - aMaterial.mArcSmeltInto = MATERIALS_MAP.get(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); + 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)); + aMaterial.mArcSmeltInto = MATERIALS_MAP.get(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); } private static void addMultiplierValues(Materials aMaterial, String aConfigPath) { aMaterial.mOreValue = GregTech_API.sMaterialProperties.get(aConfigPath, "OreValue", aMaterial.mOreValue); - aMaterial.setOreMultiplier(GregTech_API.sMaterialProperties.get(aConfigPath, "OreMultiplier", aMaterial.mOreMultiplier)); - aMaterial.setSmeltingMultiplier(GregTech_API.sMaterialProperties.get(aConfigPath, "OreSmeltingMultiplier", aMaterial.mSmeltingMultiplier)); - aMaterial.setByProductMultiplier(GregTech_API.sMaterialProperties.get(aConfigPath, "OreByProductMultiplier", aMaterial.mByProductMultiplier)); + aMaterial.setOreMultiplier( + GregTech_API.sMaterialProperties.get(aConfigPath, "OreMultiplier", aMaterial.mOreMultiplier)); + aMaterial.setSmeltingMultiplier(GregTech_API.sMaterialProperties.get( + aConfigPath, "OreSmeltingMultiplier", aMaterial.mSmeltingMultiplier)); + aMaterial.setByProductMultiplier(GregTech_API.sMaterialProperties.get( + aConfigPath, "OreByProductMultiplier", aMaterial.mByProductMultiplier)); } private static void addHasGasFluid(Materials aMaterial, String aConfigPath) { @@ -2232,21 +18594,32 @@ public class Materials implements IColorModulationContainer, ISubTagContainer { } aMaterial.mHasGas = GregTech_API.sMaterialProperties.get(aConfigPath, "AddGas", aMaterial.mHasGas); if (aMaterial.mHasGas) { - GT_Mod.gregtechproxy.addFluid(aMaterial.mName.toLowerCase(), aMaterial.mDefaultLocalName, aMaterial, 2, aMaterial.mGasTemp); + GT_Mod.gregtechproxy.addFluid( + aMaterial.mName.toLowerCase(), aMaterial.mDefaultLocalName, aMaterial, 2, aMaterial.mGasTemp); } } } private static void addInternalStuff(Materials aMaterial, String aConfigPath) { - 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.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); } private static void addLocalisation(Materials aMaterial, String aConfigPath) { - aMaterial.mDefaultLocalName = GregTech_API.sMaterialProperties.get(aConfigPath, "MaterialName", aMaterial.mCustomOre ? "CustomOre" + aMaterial.mCustomID : aMaterial.mDefaultLocalName); - aMaterial.mChemicalFormula = GregTech_API.sMaterialProperties.get(aConfigPath, "ChemicalFormula", aMaterial.mChemicalFormula); + aMaterial.mDefaultLocalName = GregTech_API.sMaterialProperties.get( + aConfigPath, + "MaterialName", + aMaterial.mCustomOre ? "CustomOre" + aMaterial.mCustomID : aMaterial.mDefaultLocalName); + aMaterial.mChemicalFormula = + GregTech_API.sMaterialProperties.get(aConfigPath, "ChemicalFormula", aMaterial.mChemicalFormula); } private static String getConfigPath(Materials aMaterial) { @@ -2256,15 +18629,22 @@ public class Materials implements IColorModulationContainer, ISubTagContainer { private static void addHarvestLevelNerfs(Materials aMaterial, String aConfigPath) { /* Moved the harvest level changes from GT_Mod to have fewer things iterating over MATERIALS_ARRAY */ - 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); + 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); } } 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() { @@ -2296,13 +18676,20 @@ 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 aDefaultAspectAmountString = aMaterial.mAspects.stream().map(aAspectStack -> String.valueOf(aAspectStack.mAmount)).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(",", ",", "")); - 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)) { + if (!aConfigAspectString.equals(aDefaultAspectString) + || !aConfigAspectAmountString.equals(aDefaultAspectAmountString)) { aMaterial.mAspects.clear(); if (aConfigAspectString.length() > 0) { String[] aAspects = aConfigAspectString.split(","); @@ -2318,23 +18705,34 @@ 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)); } } } @@ -2345,12 +18743,16 @@ public class Materials implements IColorModulationContainer, ISubTagContainer { * If the config string is different from the default, we then want to clear the Materials SubTags and insert new ones 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)); } } } @@ -2379,8 +18781,7 @@ public class Materials implements IColorModulationContainer, ISubTagContainer { public static Materials get(String aMaterialName) { Materials aMaterial = getMaterialsMap().get(aMaterialName); - if (aMaterial != null) - return aMaterial; + if (aMaterial != null) return aMaterial; return Materials._NULL; } @@ -2392,16 +18793,14 @@ public class Materials implements IColorModulationContainer, ISubTagContainer { * Adds a Class implementing IMaterialRegistrator to the master list */ public static boolean add(IMaterialHandler aRegistrator) { - if (aRegistrator == null) - return false; + if (aRegistrator == null) return false; return mMaterialHandlers.add(aRegistrator); } public static String getLocalizedNameForItem(String aFormat, int aMaterialID) { if (aMaterialID >= 0 && aMaterialID < 1000) { Materials aMaterial = GregTech_API.sGeneratedMaterials[aMaterialID]; - if (aMaterial != null) - return aMaterial.getLocalizedNameForItem(aFormat); + if (aMaterial != null) return aMaterial.getLocalizedNameForItem(aFormat); } return aFormat; } @@ -2436,17 +18835,14 @@ public class Materials implements IColorModulationContainer, ISubTagContainer { } public boolean isRadioactive() { - if (mElement != null) - return mElement.mHalfLifeSeconds >= 0; + if (mElement != null) return mElement.mHalfLifeSeconds >= 0; return mMaterialList.stream().map(stack -> stack.mMaterial).anyMatch(Materials::isRadioactive); } public long getProtons() { - if (mElement != null) - return mElement.getProtons(); - if (mMaterialList.size() == 0) - return Element.Tc.getProtons(); + if (mElement != null) return mElement.getProtons(); + if (mMaterialList.size() == 0) return Element.Tc.getProtons(); long rAmount = 0, tAmount = 0; for (MaterialStack tMaterial : mMaterialList) { tAmount += tMaterial.mAmount; @@ -2456,10 +18852,8 @@ public class Materials implements IColorModulationContainer, ISubTagContainer { } public long getNeutrons() { - if (mElement != null) - return mElement.getNeutrons(); - if (mMaterialList.size() == 0) - return Element.Tc.getNeutrons(); + if (mElement != null) return mElement.getNeutrons(); + if (mMaterialList.size() == 0) return Element.Tc.getNeutrons(); long rAmount = 0, tAmount = 0; for (MaterialStack tMaterial : mMaterialList) { tAmount += tMaterial.mAmount; @@ -2469,10 +18863,8 @@ public class Materials implements IColorModulationContainer, ISubTagContainer { } public long getMass() { - if (mElement != null) - return mElement.getMass(); - if (mMaterialList.size() == 0) - return Element.Tc.getMass(); + if (mElement != null) return mElement.getMass(); + if (mMaterialList.size() == 0) return Element.Tc.getMass(); long rAmount = 0, tAmount = 0; for (MaterialStack tMaterial : mMaterialList) { tAmount += tMaterial.mAmount; @@ -2498,10 +18890,12 @@ public class Materials implements IColorModulationContainer, ISubTagContainer { } public String getToolTip(long aMultiplier, boolean aShowQuestionMarks) { - if (!aShowQuestionMarks && mChemicalFormula.equals("?")) - return ""; + if (!aShowQuestionMarks && mChemicalFormula.equals("?")) return ""; if (aMultiplier >= M * 2 && !mMaterialList.isEmpty()) { - return ((mElement != null || (mMaterialList.size() < 2 && mMaterialList.get(0).mAmount == 1)) ? mChemicalFormula : "(" + mChemicalFormula + ")") + aMultiplier; + return ((mElement != null || (mMaterialList.size() < 2 && mMaterialList.get(0).mAmount == 1)) + ? mChemicalFormula + : "(" + mChemicalFormula + ")") + + aMultiplier; } return mChemicalFormula; } @@ -2510,8 +18904,7 @@ public class Materials implements IColorModulationContainer, ISubTagContainer { * Adds an ItemStack to this Material. */ public Materials add(ItemStack aStack) { - if (aStack != null && !contains(aStack)) - mMaterialItems.add(aStack); + if (aStack != null && !contains(aStack)) mMaterialItems.add(aStack); return this; } @@ -2519,17 +18912,16 @@ public class Materials implements IColorModulationContainer, ISubTagContainer { * This is used to determine if any of the ItemStacks belongs to this Material. */ 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()))); + 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()))); } /** * This is used to determine if an ItemStack belongs to this Material. */ public boolean remove(ItemStack aStack) { - if (aStack == null) - return false; + if (aStack == null) return false; boolean temp = false; int mMaterialItems_sS = mMaterialItems.size(); for (int i = 0; i < mMaterialItems_sS; i++) @@ -2585,8 +18977,7 @@ public class Materials implements IColorModulationContainer, ISubTagContainer { */ @SuppressWarnings("UnusedReturnValue") // Maintains signature public Materials addOreByProduct(Materials aMaterial) { - if (!mOreByProducts.contains(aMaterial.mMaterialInto)) - mOreByProducts.add(aMaterial.mMaterialInto); + if (!mOreByProducts.contains(aMaterial.mMaterialInto)) mOreByProducts.add(aMaterial.mMaterialInto); return this; } @@ -2595,9 +18986,7 @@ public class Materials implements IColorModulationContainer, ISubTagContainer { * Is used for more precise Ore grinding, so that it is possible to choose between certain kinds of Materials. */ public Materials addOreByProducts(Materials... aMaterials) { - for (Materials tMaterial : aMaterials) - if (tMaterial != null) - addOreByProduct(tMaterial); + for (Materials tMaterial : aMaterials) if (tMaterial != null) addOreByProduct(tMaterial); return this; } @@ -2606,8 +18995,7 @@ public class Materials implements IColorModulationContainer, ISubTagContainer { * Lapis Ore for example gives about 6 drops. */ public Materials setOreMultiplier(int aOreMultiplier) { - if (aOreMultiplier > 0) - mOreMultiplier = aOreMultiplier; + if (aOreMultiplier > 0) mOreMultiplier = aOreMultiplier; return this; } @@ -2616,8 +19004,7 @@ public class Materials implements IColorModulationContainer, ISubTagContainer { */ @SuppressWarnings("UnusedReturnValue") // Maintains signature public Materials setByProductMultiplier(int aByProductMultiplier) { - if (aByProductMultiplier > 0) - mByProductMultiplier = aByProductMultiplier; + if (aByProductMultiplier > 0) mByProductMultiplier = aByProductMultiplier; return this; } @@ -2626,8 +19013,7 @@ public class Materials implements IColorModulationContainer, ISubTagContainer { * Lapis Ore for example gives about 6 drops. */ public Materials setSmeltingMultiplier(int aSmeltingMultiplier) { - if (aSmeltingMultiplier > 0) - mSmeltingMultiplier = aSmeltingMultiplier; + if (aSmeltingMultiplier > 0) mSmeltingMultiplier = aSmeltingMultiplier; return this; } @@ -2635,8 +19021,7 @@ public class Materials implements IColorModulationContainer, ISubTagContainer { * This Ore should be molten directly into an Ingot of this Material instead of an Ingot of itself. */ public Materials setDirectSmelting(Materials aMaterial) { - if (aMaterial != null) - mDirectSmelting = aMaterial.mMaterialInto.mDirectSmelting; + if (aMaterial != null) mDirectSmelting = aMaterial.mMaterialInto.mDirectSmelting; return this; } @@ -2646,8 +19031,7 @@ public class Materials implements IColorModulationContainer, ISubTagContainer { */ @SuppressWarnings("UnusedReturnValue") // Maintains signature public Materials setOreReplacement(Materials aMaterial) { - if (aMaterial != null) - mOreReplacement = aMaterial.mMaterialInto.mOreReplacement; + if (aMaterial != null) mOreReplacement = aMaterial.mMaterialInto.mOreReplacement; return this; } @@ -2655,8 +19039,7 @@ public class Materials implements IColorModulationContainer, ISubTagContainer { * This Material smelts always into an instance of aMaterial. Used for Magnets. */ public Materials setSmeltingInto(Materials aMaterial) { - if (aMaterial != null) - mSmeltInto = aMaterial.mMaterialInto.mSmeltInto; + if (aMaterial != null) mSmeltInto = aMaterial.mMaterialInto.mSmeltInto; return this; } @@ -2665,8 +19048,7 @@ public class Materials implements IColorModulationContainer, ISubTagContainer { */ @SuppressWarnings("UnusedReturnValue") // Maintains signature public Materials setArcSmeltingInto(Materials aMaterial) { - if (aMaterial != null) - mArcSmeltInto = aMaterial.mMaterialInto.mArcSmeltInto; + if (aMaterial != null) mArcSmeltInto = aMaterial.mMaterialInto.mArcSmeltInto; return this; } @@ -2674,8 +19056,7 @@ public class Materials implements IColorModulationContainer, ISubTagContainer { * This Material macerates always into an instance of aMaterial. */ public Materials setMaceratingInto(Materials aMaterial) { - if (aMaterial != null) - mMacerateInto = aMaterial.mMaterialInto.mMacerateInto; + if (aMaterial != null) mMacerateInto = aMaterial.mMaterialInto.mMacerateInto; return this; } @@ -2693,32 +19074,27 @@ public class Materials implements IColorModulationContainer, ISubTagContainer { } public FluidStack getSolid(long aAmount) { - if (mSolid == null) - return null; + if (mSolid == null) return null; return new GT_FluidStack(mSolid, (int) aAmount); } public FluidStack getFluid(long aAmount) { - if (mFluid == null) - return null; + if (mFluid == null) return null; return new GT_FluidStack(mFluid, (int) aAmount); } public FluidStack getGas(long aAmount) { - if (mGas == null) - return null; + if (mGas == null) return null; return new GT_FluidStack(mGas, (int) aAmount); } public FluidStack getPlasma(long aAmount) { - if (mPlasma == null) - return null; + if (mPlasma == null) return null; return new GT_FluidStack(mPlasma, (int) aAmount); } public FluidStack getMolten(long aAmount) { - if (mStandardMoltenFluid == null) - return null; + if (mStandardMoltenFluid == null) return null; return new GT_FluidStack(mStandardMoltenFluid, (int) aAmount); } @@ -2733,11 +19109,13 @@ 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() { @@ -2841,7 +19219,9 @@ public class Materials implements IColorModulationContainer, ISubTagContainer { ** @return true if Materials is a proper soldering fluid */ public boolean isProperSolderingFluid() { - return mStandardMoltenFluid != null && contains(SubTag.SOLDERING_MATERIAL) && !(GregTech_API.mUseOnlyGoodSolderingMaterials && !contains(SubTag.SOLDERING_MATERIAL_GOOD)); + return mStandardMoltenFluid != null + && contains(SubTag.SOLDERING_MATERIAL) + && !(GregTech_API.mUseOnlyGoodSolderingMaterials && !contains(SubTag.SOLDERING_MATERIAL_GOOD)); } public ItemStack getCells(int amount) { @@ -2879,5 +19259,4 @@ public class Materials implements IColorModulationContainer, ISubTagContainer { public ItemStack getPlates(int amount) { return GT_OreDictUnificator.get(OrePrefixes.plate, this, amount); } - } diff --git a/src/main/java/gregtech/api/enums/MaterialsBotania.java b/src/main/java/gregtech/api/enums/MaterialsBotania.java index c05e8c27db..f1ddb7e5d8 100644 --- a/src/main/java/gregtech/api/enums/MaterialsBotania.java +++ b/src/main/java/gregtech/api/enums/MaterialsBotania.java @@ -1,23 +1,193 @@ package gregtech.api.enums; -import gregtech.api.enums.TC_Aspects.TC_AspectStack; +import static gregtech.api.enums.OrePrefixes.*; +import gregtech.api.enums.TC_Aspects.TC_AspectStack; import java.util.Arrays; -import static gregtech.api.enums.OrePrefixes.*; - 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 GaiaSpirit = new Materials( 205, new TextureSet("GaiaSpirit", true), 32.0F, 850000, 12, 1|2|64|128, 255, 255, 255, 0, "GaiaSpirit" , "Gaia Spirit" , -1, -1, 0, 0, false, true, 2, 1, 1, Dyes._NULL , Arrays.asList(new TC_AspectStack(TC_Aspects.PRAECANTATIO, 27), 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 ManaDiamond = new Materials( 208, TextureSet.SET_DIAMOND, 16.0F, 2560, 8, 1|4, 38, 237, 224, 255, "ManaDiamond" , "Mana Diamond" , -1, -1, 0, 0, false, true, 2, 1, 1, Dyes._NULL , Arrays.asList(new TC_Aspects.TC_AspectStack(TC_Aspects.PRAECANTATIO, 4), new TC_Aspects.TC_AspectStack(TC_Aspects.VITREUS, 4), new TC_Aspects.TC_AspectStack(TC_Aspects.LUCRUM, 4))); - public static Materials BotaniaDragonstone = new Materials( 209, TextureSet.SET_DIAMOND, 24.0F, 3840, 12, 1|4, 242, 44, 239, 255, "BotaniaDragonstone" , "Dragonstone" , -1, -1, 0, 0, false, true, 2, 1, 1, Dyes._NULL , Arrays.asList(new TC_Aspects.TC_AspectStack(TC_Aspects.PRAECANTATIO, 6), new TC_Aspects.TC_AspectStack(TC_Aspects.VITREUS, 6), new TC_Aspects.TC_AspectStack(TC_Aspects.AURAM, 4))); + 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, + new TextureSet("GaiaSpirit", true), + 32.0F, + 850000, + 12, + 1 | 2 | 64 | 128, + 255, + 255, + 255, + 0, + "GaiaSpirit", + "Gaia Spirit", + -1, + -1, + 0, + 0, + false, + true, + 2, + 1, + 1, + Dyes._NULL, + Arrays.asList( + new TC_AspectStack(TC_Aspects.PRAECANTATIO, 27), + 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 ManaDiamond = new Materials( + 208, + TextureSet.SET_DIAMOND, + 16.0F, + 2560, + 8, + 1 | 4, + 38, + 237, + 224, + 255, + "ManaDiamond", + "Mana Diamond", + -1, + -1, + 0, + 0, + false, + true, + 2, + 1, + 1, + Dyes._NULL, + Arrays.asList( + new TC_Aspects.TC_AspectStack(TC_Aspects.PRAECANTATIO, 4), + new TC_Aspects.TC_AspectStack(TC_Aspects.VITREUS, 4), + new TC_Aspects.TC_AspectStack(TC_Aspects.LUCRUM, 4))); + public static Materials BotaniaDragonstone = new Materials( + 209, + TextureSet.SET_DIAMOND, + 24.0F, + 3840, + 12, + 1 | 4, + 242, + 44, + 239, + 255, + "BotaniaDragonstone", + "Dragonstone", + -1, + -1, + 0, + 0, + false, + true, + 2, + 1, + 1, + Dyes._NULL, + Arrays.asList( + new TC_Aspects.TC_AspectStack(TC_Aspects.PRAECANTATIO, 6), + new TC_Aspects.TC_AspectStack(TC_Aspects.VITREUS, 6), + new TC_Aspects.TC_AspectStack(TC_Aspects.AURAM, 4))); public static void init() { GaiaSpirit.mChemicalFormula = "Gs"; diff --git a/src/main/java/gregtech/api/enums/MaterialsKevlar.java b/src/main/java/gregtech/api/enums/MaterialsKevlar.java index 05f5252432..7ff50efeb5 100644 --- a/src/main/java/gregtech/api/enums/MaterialsKevlar.java +++ b/src/main/java/gregtech/api/enums/MaterialsKevlar.java @@ -1,59 +1,558 @@ package gregtech.api.enums; import gregtech.api.objects.MaterialStack; - import java.util.Arrays; 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 - 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 - 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(); - 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 - 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 - 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 - 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 - 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 - 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 - 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).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 - 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 + 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 + 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 + 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(); + 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 + 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 + 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 + 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 + 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 + 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 + 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) + .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 + 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 - //H3RhCl6 + // H3RhCl6 /** * called by Materials. Can be safely called multiple times. exists to allow Materials ensure this class is initialized diff --git a/src/main/java/gregtech/api/enums/OreDictNames.java b/src/main/java/gregtech/api/enums/OreDictNames.java index d1c84f7119..8bb86b5249 100644 --- a/src/main/java/gregtech/api/enums/OreDictNames.java +++ b/src/main/java/gregtech/api/enums/OreDictNames.java @@ -1,6 +1,5 @@ package gregtech.api.enums; - public enum OreDictNames { craftingAnvil, craftingBook, diff --git a/src/main/java/gregtech/api/enums/OrePrefixes.java b/src/main/java/gregtech/api/enums/OrePrefixes.java index 0811fdac40..6e727bd7af 100644 --- a/src/main/java/gregtech/api/enums/OrePrefixes.java +++ b/src/main/java/gregtech/api/enums/OrePrefixes.java @@ -1,5 +1,7 @@ package gregtech.api.enums; +import static gregtech.api.enums.GT_Values.*; + import com.google.common.collect.ImmutableList; import gregtech.api.GregTech_API; import gregtech.api.enums.TC_Aspects.TC_AspectStack; @@ -15,231 +17,2853 @@ import gregtech.api.objects.MaterialStack; import gregtech.api.util.GT_Log; import gregtech.api.util.GT_Utility; import gregtech.loaders.materialprocessing.ProcessingModSupport; -import net.minecraft.item.ItemStack; - import java.util.*; - -import static gregtech.api.enums.GT_Values.*; +import net.minecraft.item.ItemStack; public enum OrePrefixes { - @Deprecated pulp("Pulps", "", "", false, false, false, false, false, false, false, false, false, false, B[0] | B[1] | B[2] | B[3], -1, 64, -1), - @Deprecated leaves("Leaves", "", "", false, false, false, false, false, false, false, false, false, false, 0, -1, 64, -1), - @Deprecated sapling("Saplings", "", "", false, false, false, false, false, false, false, false, false, false, 0, -1, 64, -1), - @Deprecated itemDust("Dusts", "", "", false, false, false, false, false, false, false, false, false, false, B[0] | B[1] | B[2] | B[3], -1, 64, -1), - oreBlackgranite("Black Granite Ores", "Granite ", " Ore", true, true, false, false, false, true, false, false, false, true, B[3], -1, 64, -1), // In case of an End-Ores Mod. Ore -> Material is a Oneway Operation! - oreRedgranite("Red Granite Ores", "Granite ", " Ore", true, true, false, false, false, true, false, false, false, true, B[3], -1, 64, -1), // In case of an End-Ores Mod. Ore -> Material is a Oneway Operation! - oreMarble("Marble Ores", "Marble ", " Ore", true, true, false, false, false, true, false, false, false, true, B[3], -1, 64, -1), // In case of an End-Ores Mod. Ore -> Material is a Oneway Operation! - oreBasalt("Basalt Ores", "Basalt ", " Ore", true, true, false, false, false, true, false, false, false, true, B[3], -1, 64, -1), // In case of an End-Ores Mod. Ore -> Material is a Oneway Operation! - oreNetherrack("Netherrack Ores", "Nether ", " Ore", true, true, false, false, false, true, false, false, false, true, B[3], -1, 64, -1), // Prefix of the Nether-Ores Mod. Causes Ores to double. Ore -> Material is a Oneway Operation! - oreNether("Nether Ores", "Nether ", " Ore", true, true, false, false, false, true, false, false, false, true, B[3], -1, 64, -1), // Prefix of the Nether-Ores Mod. Causes Ores to double. Ore -> Material is a Oneway Operation! - @Deprecated denseore("Dense Ores", "", "", false, false, false, false, false, true, false, false, false, true, B[3], -1, 64, -1), - oreDense("Dense Ores", "Dense ", " Ore", true, true, false, false, false, true, false, false, false, true, B[3], -1, 64, -1), // Prefix of the Dense-Ores Mod. Causes Ores to double. Ore -> Material is a Oneway Operation! - oreRich("Rich Ores", "Rich ", " Ore", true, true, false, false, false, true, false, false, false, true, B[3], -1, 64, -1), // Prefix of TFC - oreNormal("Normal Ores", "Normal ", " Ore", true, true, false, false, false, true, false, false, false, true, B[3], -1, 64, -1), // Prefix of TFC - oreSmall("Small Ores", "Small ", " Ore", true, true, false, false, false, true, false, false, false, true, B[3], -1, 64, 67), // Prefix of Railcraft. - orePoor("Poor Ores", "Poor ", " Ore", true, true, false, false, false, true, false, false, false, true, B[3], -1, 64, -1), // Prefix of Railcraft. - oreEndstone("Endstone Ores", "End ", " Ore", true, true, false, false, false, true, false, false, false, true, B[3], -1, 64, -1), // In case of an End-Ores Mod. Ore -> Material is a Oneway Operation! - oreEnd("End Ores", "End ", " Ore", true, true, false, false, false, true, false, false, false, true, B[3], -1, 64, -1), // In case of an End-Ores Mod. Ore -> Material is a Oneway Operation! - @Deprecated oreGem("Ores", "", "", false, false, false, false, false, true, false, false, false, true, B[3], -1, 64, -1), - ore("Ores", "", " Ore", true, true, false, false, false, true, false, false, false, true, B[3], -1, 64, 68), // Regular Ore Prefix. Ore -> Material is a Oneway Operation! Introduced by Eloraam - crushedCentrifuged("Centrifuged Ores", "Centrifuged ", " Ore", true, true, false, false, false, false, false, true, false, true, B[3], -1, 64, 7), - crushedPurified("Purified Ores", "Purified ", " Ore", true, true, false, false, false, false, false, true, false, true, B[3], -1, 64, 6), - crushed("Crushed Ores", "Crushed ", " Ore", true, true, false, false, false, false, false, true, false, true, B[3], -1, 64, 5), - shard("Crystallised Shards", "", "", true, true, false, false, false, false, false, false, false, true, B[3], -1, 64, -1), // Introduced by Mekanism + @Deprecated + pulp( + "Pulps", + "", + "", + false, + false, + false, + false, + false, + false, + false, + false, + false, + false, + B[0] | B[1] | B[2] | B[3], + -1, + 64, + -1), + @Deprecated + leaves("Leaves", "", "", false, false, false, false, false, false, false, false, false, false, 0, -1, 64, -1), + @Deprecated + sapling("Saplings", "", "", false, false, false, false, false, false, false, false, false, false, 0, -1, 64, -1), + @Deprecated + itemDust( + "Dusts", + "", + "", + false, + false, + false, + false, + false, + false, + false, + false, + false, + false, + B[0] | B[1] | B[2] | B[3], + -1, + 64, + -1), + oreBlackgranite( + "Black Granite Ores", + "Granite ", + " Ore", + true, + true, + false, + false, + false, + true, + false, + false, + false, + true, + B[3], + -1, + 64, + -1), // In case of an End-Ores Mod. Ore -> Material is a Oneway Operation! + oreRedgranite( + "Red Granite Ores", + "Granite ", + " Ore", + true, + true, + false, + false, + false, + true, + false, + false, + false, + true, + B[3], + -1, + 64, + -1), // In case of an End-Ores Mod. Ore -> Material is a Oneway Operation! + oreMarble( + "Marble Ores", + "Marble ", + " Ore", + true, + true, + false, + false, + false, + true, + false, + false, + false, + true, + B[3], + -1, + 64, + -1), // In case of an End-Ores Mod. Ore -> Material is a Oneway Operation! + oreBasalt( + "Basalt Ores", + "Basalt ", + " Ore", + true, + true, + false, + false, + false, + true, + false, + false, + false, + true, + B[3], + -1, + 64, + -1), // In case of an End-Ores Mod. Ore -> Material is a Oneway Operation! + oreNetherrack( + "Netherrack Ores", + "Nether ", + " Ore", + true, + true, + false, + false, + false, + true, + false, + false, + false, + true, + B[3], + -1, + 64, + -1), // Prefix of the Nether-Ores Mod. Causes Ores to double. Ore -> Material is a Oneway Operation! + oreNether( + "Nether Ores", + "Nether ", + " Ore", + true, + true, + false, + false, + false, + true, + false, + false, + false, + true, + B[3], + -1, + 64, + -1), // Prefix of the Nether-Ores Mod. Causes Ores to double. Ore -> Material is a Oneway Operation! + @Deprecated + denseore( + "Dense Ores", "", "", false, false, false, false, false, true, false, false, false, true, B[3], -1, 64, -1), + oreDense( + "Dense Ores", + "Dense ", + " Ore", + true, + true, + false, + false, + false, + true, + false, + false, + false, + true, + B[3], + -1, + 64, + -1), // Prefix of the Dense-Ores Mod. Causes Ores to double. Ore -> Material is a Oneway Operation! + oreRich( + "Rich Ores", + "Rich ", + " Ore", + true, + true, + false, + false, + false, + true, + false, + false, + false, + true, + B[3], + -1, + 64, + -1), // Prefix of TFC + oreNormal( + "Normal Ores", + "Normal ", + " Ore", + true, + true, + false, + false, + false, + true, + false, + false, + false, + true, + B[3], + -1, + 64, + -1), // Prefix of TFC + oreSmall( + "Small Ores", + "Small ", + " Ore", + true, + true, + false, + false, + false, + true, + false, + false, + false, + true, + B[3], + -1, + 64, + 67), // Prefix of Railcraft. + orePoor( + "Poor Ores", + "Poor ", + " Ore", + true, + true, + false, + false, + false, + true, + false, + false, + false, + true, + B[3], + -1, + 64, + -1), // Prefix of Railcraft. + oreEndstone( + "Endstone Ores", + "End ", + " Ore", + true, + true, + false, + false, + false, + true, + false, + false, + false, + true, + B[3], + -1, + 64, + -1), // In case of an End-Ores Mod. Ore -> Material is a Oneway Operation! + oreEnd( + "End Ores", + "End ", + " Ore", + true, + true, + false, + false, + false, + true, + false, + false, + false, + true, + B[3], + -1, + 64, + -1), // In case of an End-Ores Mod. Ore -> Material is a Oneway Operation! + @Deprecated + oreGem("Ores", "", "", false, false, false, false, false, true, false, false, false, true, B[3], -1, 64, -1), + ore( + "Ores", "", " Ore", true, true, false, false, false, true, false, false, false, true, B[3], -1, 64, + 68), // Regular Ore Prefix. Ore -> Material is a Oneway Operation! Introduced by Eloraam + crushedCentrifuged( + "Centrifuged Ores", + "Centrifuged ", + " Ore", + true, + true, + false, + false, + false, + false, + false, + true, + false, + true, + B[3], + -1, + 64, + 7), + crushedPurified( + "Purified Ores", + "Purified ", + " Ore", + true, + true, + false, + false, + false, + false, + false, + true, + false, + true, + B[3], + -1, + 64, + 6), + crushed( + "Crushed Ores", + "Crushed ", + " Ore", + true, + true, + false, + false, + false, + false, + false, + true, + false, + true, + B[3], + -1, + 64, + 5), + shard( + "Crystallised Shards", + "", + "", + true, + true, + false, + false, + false, + false, + false, + false, + false, + true, + B[3], + -1, + 64, + -1), // Introduced by Mekanism clump("Clumps", "", "", true, true, false, false, false, false, false, false, false, true, B[3], -1, 64, -1), - reduced("Reduced Gravels", "", "", true, true, false, false, false, false, false, false, false, true, B[3], -1, 64, -1), - crystalline("Crystallised Metals", "", "", true, true, false, false, false, false, false, false, false, true, B[3], -1, 64, -1), - cleanGravel("Clean Gravels", "", "", true, true, false, false, false, false, false, false, false, true, B[3], -1, 64, -1), - dirtyGravel("Dirty Gravels", "", "", true, true, false, false, false, false, false, false, false, true, B[3], -1, 64, -1), - ingotQuintuple("5x Ingots", "Quintuple ", " Ingot", true, true, false, false, false, false, true, true, false, false, B[1], M * 5, 12, 16), // A quintuple Ingot. - ingotQuadruple("4x Ingots", "Quadruple ", " Ingot", true, true, false, false, false, false, true, true, false, false, B[1], M * 4, 16, 15), // A quadruple Ingot. - @Deprecated ingotQuad("4x Ingots", "Quadruple ", " Ingot", false, false, false, false, false, false, false, false, false, false, B[1], -1, 16, 15), - ingotTriple("3x Ingots", "Triple ", " Ingot", true, true, false, false, false, false, true, false, false, false, B[1], M * 3, 21, 14), // A triple Ingot. - ingotDouble("2x Ingots", "Double ", " Ingot", true, true, false, false, false, false, true, true, false, false, B[1], M * 2, 32, 13), // A double Ingot. Introduced by TerraFirmaCraft - ingotHot("Hot Ingots", "Hot ", " Ingot", true, true, false, false, false, false, false, true, false, false, B[1], M * 1, 64, 12), // A hot Ingot, which has to be cooled down by a Vacuum Freezer. - ingot("Ingots", "", " Ingot", true, true, false, false, false, false, false, true, false, false, B[1], M * 1, 64, 11), // A regular Ingot. Introduced by Eloraam - gemChipped("Chipped Gemstones", "Chipped ", "", true, true, true, false, false, false, true, true, false, false, B[2], M / 4, 64, 59), // A regular Gem worth one small Dust. Introduced by TerraFirmaCraft - gemFlawed("Flawed Gemstones", "Flawed ", "", true, true, true, false, false, false, true, true, false, false, B[2], M / 2, 64, 60), // A regular Gem worth two small Dusts. Introduced by TerraFirmaCraft - gemFlawless("Flawless Gemstones", "Flawless ", "", true, true, true, false, false, false, true, true, false, false, B[2], M * 2, 32, 61), // A regular Gem worth two Dusts. Introduced by TerraFirmaCraft - gemExquisite("Exquisite Gemstones", "Exquisite ", "", true, true, true, false, false, false, true, true, false, false, B[2], M * 4, 16, 62), // A regular Gem worth four Dusts. Introduced by TerraFirmaCraft - gem("Gemstones", "", "", true, true, true, false, false, false, true, true, false, false, B[2], M * 1, 64, 8), // A regular Gem worth one Dust. Introduced by Eloraam - @Deprecated dustDirty("Impure Dusts", "", "", false, false, false, false, false, false, false, false, false, true, B[3], -1, 64, 3), - dustTiny("Tiny Dusts", "Tiny Pile of ", " Dust", true, true, false, false, false, false, false, true, false, false, B[0] | B[1] | B[2] | B[3], M / 9, 64, 0), // 1/9th of a Dust. - dustSmall("Small Dusts", "Small Pile of ", " Dust", true, true, false, false, false, false, false, true, false, false, B[0] | B[1] | B[2] | B[3], M / 4, 64, 1), // 1/4th of a Dust. - dustImpure("Impure Dusts", "Impure Pile of ", " Dust", true, true, false, false, false, false, false, true, false, true, B[3], M * 1, 64, 3), // Dust with impurities. 1 Unit of Main Material and 1/9 - 1/4 Unit of secondary Material - dustRefined("Refined Dusts", "Refined Pile of ", " Dust", true, true, false, false, false, false, false, true, false, true, B[3], M * 1, 64, 2), - dustPure("Purified Dusts", "Purified Pile of ", " Dust", true, true, false, false, false, false, false, true, false, true, B[3], M * 1, 64, 4), - dust("Dusts", "", " Dust", true, true, false, false, false, false, false, true, false, false, B[0] | B[1] | B[2] | B[3], M * 1, 64, 2), // Pure Dust worth of one Ingot or Gem. Introduced by Alblaka. - nugget("Nuggets", "", " Nugget", true, true, false, false, false, false, false, true, false, false, B[1], M / 9, 64, 9), // A Nugget. Introduced by Eloraam - plateAlloy("Alloy Plates", "", "", true, false, false, false, false, false, false, false, false, false, B[1], -1, 64, 17), // Special Alloys have this prefix. - plateSteamcraft("Steamcraft Plates", "", "", false, false, false, false, false, false, false, false, false, false, B[1], -1, 64, 17), - plateDense("Dense Plates", "Dense ", " Plate", true, true, false, false, false, false, true, true, false, false, B[1], M * 9, 8, 22), // 9 Plates combined in one Item. - plateQuintuple("5x Plates", "Quintuple ", " Plate", true, true, false, false, false, false, true, true, false, false, B[1], M * 5, 12, 21), - plateQuadruple("4x Plates", "Quadruple ", " Plate", true, true, false, false, false, false, true, true, false, false, B[1], M * 4, 16, 20), - @Deprecated plateQuad("4x Plates", "", "", false, false, false, false, false, false, false, false, false, false, B[1], -1, 16, 20), - plateTriple("3x Plates", "Triple ", " Plate", true, true, false, false, false, false, true, true, false, false, B[1], M * 3, 21, 19), - plateDouble("2x Plates", "Double ", " Plate", true, true, false, false, false, false, true, true, false, false, B[1], M * 2, 32, 18), - plate("Plates", "", " Plate", true, true, false, false, false, false, true, true, false, false, B[1] | B[2], M * 1, 64, 17), // Regular Plate made of one Ingot/Dust. Introduced by Calclavia - itemCasing("Casings", "", " Casing", true, true, false, false, false, false, true, true, false, false, B[1] | B[2], M / 2, 64, 10), // Casing made of 1/2 Ingot/Dust - foil("Foils", "", " Foil", true, true, false, false, false, false, true, true, false, false, B[1], M / 4, 64, 29), // Foil made of 1/4 Ingot/Dust. - stickLong("Long Sticks/Rods", "Long ", " Rod", true, true, false, false, false, false, true, true, false, false, B[1] | B[2], M * 1, 64, 54), // Stick made of an Ingot. - stick("Sticks/Rods", "", " Rod", true, true, false, false, false, false, true, true, false, false, B[1] | B[2], M / 2, 64, 23), // Stick made of half an Ingot. Introduced by Eloraam - round("Rounds", "", " Round", true, true, false, false, false, false, true, true, false, false, B[1], M / 9, 64, 25), // consisting out of one Nugget. - bolt("Bolts", "", " Bolt", true, true, false, false, false, false, true, true, false, false, B[1] | B[2], M / 8, 64, 26), // consisting out of 1/8 Ingot or 1/4 Stick. - comb("Combs", "", " Comb", false, false, false, false, false, false, false, true, false, false, B[1] | B[2], M, 64, 101), // contain dusts - screw("Screws", "", " Screw", true, true, false, false, false, false, true, true, false, false, B[1] | B[2], M / 9, 64, 27), // consisting out of a Bolt. - ring("Rings", "", " Ring", true, true, false, false, false, false, true, true, false, false, B[1], M / 4, 64, 28), // consisting out of 1/2 Stick. - springSmall("Small Springs", "Small ", " Spring", true, true, false, false, false, false, true, true, false, false, B[1], M / 4, 64, 55), // consisting out of 1 Fine Wire. - spring("Springs", "", " Spring", true, true, false, false, false, false, true, true, false, false, B[1], M * 1, 64, 56), // consisting out of 2 Sticks. - wireFine("Fine Wires", "Fine ", " Wire", true, true, false, false, false, false, true, true, false, false, B[1], M / 8, 64, 51), // consisting out of 1/8 Ingot or 1/4 Wire. - rotor("Rotors", "", " Rotor", true, true, false, false, false, false, true, true, false, false, B[7], M * 4 + M / 4, 16, 53), // consisting out of 4 Plates, 1 Ring and 1 Screw. - gearGtSmall("Small Gears", "Small ", " Gear", true, true, false, false, false, false, true, true, false, false, B[7], M * 1, 64, 52), - gearGt("Gears", "", " Gear", true, true, false, false, false, false, true, true, false, false, B[7], M * 4, 16, 63), // Introduced by me because BuildCraft has ruined the gear Prefix... - lens("Lenses", "", " Lens", true, true, false, false, false, false, true, true, false, false, B[2], (M * 3) / 4, 64, 24), // 3/4 of a Plate or Gem used to shape a Lense. Normally only used on Transparent Materials. - crateGtDust("Crates of Dust", "Crate of ", " Dust", true, true, false, true, false, false, false, true, false, false, B[0] | B[1] | B[2] | B[3], -1, 64, 96), // consisting out of 16 Dusts. - crateGtPlate("Crates of Plates", "Crate of ", " Plate", true, true, false, true, false, false, false, true, false, false, B[1] | B[2], -1, 64, 99), // consisting out of 16 Plates. - crateGtIngot("Crates of Ingots", "Crate of ", " Ingot", true, true, false, true, false, false, false, true, false, false, B[1], -1, 64, 97), // consisting out of 16 Ingots. - crateGtGem("Crates of Gems", "Crate of ", " Gem", true, true, false, true, false, false, false, true, false, false, B[2], -1, 64, 98), // consisting out of 16 Gems. - cellPlasma("Cells of Plasma", "", " Plasma Cell" , true, true, true, true, false, false, false, true, false, false, B[5], M * 1, 64, 31), // Hot Cell full of Plasma, which can be used in the Plasma Generator. - cellMolten("Cells of Molten stuff", "Molten ", " Cell", true, true, true, true, false, false, false, true, false, false, 0, M * 1, 64, 31), // Hot Cell full of molten stuff, which can be used in the Plasma Generator. - cell("Cells", "", " Cell", true, true, true, true, false, false, true, true, false, false, B[4] | B[8], M * 1, 64, 30), // Regular Gas/Fluid Cell. Introduced by Calclavia - bucket("Buckets", "", " Bucket", true, true, true, true, false, false, true, false, false, false, B[4] | B[8], M * 1, 16, -1), // A vanilla Iron Bucket filled with the Material. - bucketClay("Clay Buckets", "", " Clay Bucket", true, true, true, true, false, false, true, false, false, false, B[4] | B[8], M * 1, 16, -1), // An Iguana Tweaks Clay Bucket filled with the Material. - bottle("Bottles", "", " Bottle", true, true, true, true, false, false, false, false, false, false, B[4] | B[8], -1, 16, -1), // Glass Bottle containing a Fluid. - capsule("Capsules", "", " Capsule", false, true, true, true, false, false, false, false, false, false, B[4] | B[8], M * 1, 16, -1), - crystal("Crystals", "", " Crystal", false, true, false, false, false, false, true, false, false, false, B[2], M * 1, 64, -1), - bulletGtSmall("Small Bullets", "Small ", " Bullet", true, true, false, false, true, false, true, false, true, false, B[6] | B[8], M / 9, 64, -1), - bulletGtMedium("Medium Bullets", "Medium ", " Bullet", true, true, false, false, true, false, true, false, true, false, B[6] | B[8], M / 6, 64, -1), - bulletGtLarge("Large Bullets", "Large ", " Bullet", true, true, false, false, true, false, true, false, true, false, B[6] | B[8], M / 3, 64, -1), - arrowGtWood("Regular Arrows", "", " Arrow", true, true, false, false, true, false, true, false, true, false, B[6], M / 4, 64, 57), // Arrow made of 1/4 Ingot/Dust + Wooden Stick. - arrowGtPlastic("Light Arrows", "Light ", " Arrow", true, true, false, false, true, false, true, false, true, false, B[6], M / 4, 64, 58), // Arrow made of 1/4 Ingot/Dust + Plastic Stick. + reduced( + "Reduced Gravels", + "", + "", + true, + true, + false, + false, + false, + false, + false, + false, + false, + true, + B[3], + -1, + 64, + -1), + crystalline( + "Crystallised Metals", + "", + "", + true, + true, + false, + false, + false, + false, + false, + false, + false, + true, + B[3], + -1, + 64, + -1), + cleanGravel( + "Clean Gravels", + "", + "", + true, + true, + false, + false, + false, + false, + false, + false, + false, + true, + B[3], + -1, + 64, + -1), + dirtyGravel( + "Dirty Gravels", + "", + "", + true, + true, + false, + false, + false, + false, + false, + false, + false, + true, + B[3], + -1, + 64, + -1), + ingotQuintuple( + "5x Ingots", + "Quintuple ", + " Ingot", + true, + true, + false, + false, + false, + false, + true, + true, + false, + false, + B[1], + M * 5, + 12, + 16), // A quintuple Ingot. + ingotQuadruple( + "4x Ingots", + "Quadruple ", + " Ingot", + true, + true, + false, + false, + false, + false, + true, + true, + false, + false, + B[1], + M * 4, + 16, + 15), // A quadruple Ingot. + @Deprecated + ingotQuad( + "4x Ingots", + "Quadruple ", + " Ingot", + false, + false, + false, + false, + false, + false, + false, + false, + false, + false, + B[1], + -1, + 16, + 15), + ingotTriple( + "3x Ingots", + "Triple ", + " Ingot", + true, + true, + false, + false, + false, + false, + true, + false, + false, + false, + B[1], + M * 3, + 21, + 14), // A triple Ingot. + ingotDouble( + "2x Ingots", + "Double ", + " Ingot", + true, + true, + false, + false, + false, + false, + true, + true, + false, + false, + B[1], + M * 2, + 32, + 13), // A double Ingot. Introduced by TerraFirmaCraft + ingotHot( + "Hot Ingots", + "Hot ", + " Ingot", + true, + true, + false, + false, + false, + false, + false, + true, + false, + false, + B[1], + M * 1, + 64, + 12), // A hot Ingot, which has to be cooled down by a Vacuum Freezer. + ingot( + "Ingots", "", " Ingot", true, true, false, false, false, false, false, true, false, false, B[1], M * 1, 64, + 11), // A regular Ingot. Introduced by Eloraam + gemChipped( + "Chipped Gemstones", + "Chipped ", + "", + true, + true, + true, + false, + false, + false, + true, + true, + false, + false, + B[2], + M / 4, + 64, + 59), // A regular Gem worth one small Dust. Introduced by TerraFirmaCraft + gemFlawed( + "Flawed Gemstones", + "Flawed ", + "", + true, + true, + true, + false, + false, + false, + true, + true, + false, + false, + B[2], + M / 2, + 64, + 60), // A regular Gem worth two small Dusts. Introduced by TerraFirmaCraft + gemFlawless( + "Flawless Gemstones", + "Flawless ", + "", + true, + true, + true, + false, + false, + false, + true, + true, + false, + false, + B[2], + M * 2, + 32, + 61), // A regular Gem worth two Dusts. Introduced by TerraFirmaCraft + gemExquisite( + "Exquisite Gemstones", + "Exquisite ", + "", + true, + true, + true, + false, + false, + false, + true, + true, + false, + false, + B[2], + M * 4, + 16, + 62), // A regular Gem worth four Dusts. Introduced by TerraFirmaCraft + gem( + "Gemstones", + "", + "", + true, + true, + true, + false, + false, + false, + true, + true, + false, + false, + B[2], + M * 1, + 64, + 8), // A regular Gem worth one Dust. Introduced by Eloraam + @Deprecated + dustDirty( + "Impure Dusts", + "", + "", + false, + false, + false, + false, + false, + false, + false, + false, + false, + true, + B[3], + -1, + 64, + 3), + dustTiny( + "Tiny Dusts", + "Tiny Pile of ", + " Dust", + true, + true, + false, + false, + false, + false, + false, + true, + false, + false, + B[0] | B[1] | B[2] | B[3], + M / 9, + 64, + 0), // 1/9th of a Dust. + dustSmall( + "Small Dusts", + "Small Pile of ", + " Dust", + true, + true, + false, + false, + false, + false, + false, + true, + false, + false, + B[0] | B[1] | B[2] | B[3], + M / 4, + 64, + 1), // 1/4th of a Dust. + dustImpure( + "Impure Dusts", + "Impure Pile of ", + " Dust", + true, + true, + false, + false, + false, + false, + false, + true, + false, + true, + B[3], + M * 1, + 64, + 3), // Dust with impurities. 1 Unit of Main Material and 1/9 - 1/4 Unit of secondary Material + dustRefined( + "Refined Dusts", + "Refined Pile of ", + " Dust", + true, + true, + false, + false, + false, + false, + false, + true, + false, + true, + B[3], + M * 1, + 64, + 2), + dustPure( + "Purified Dusts", + "Purified Pile of ", + " Dust", + true, + true, + false, + false, + false, + false, + false, + true, + false, + true, + B[3], + M * 1, + 64, + 4), + dust( + "Dusts", + "", + " Dust", + true, + true, + false, + false, + false, + false, + false, + true, + false, + false, + B[0] | B[1] | B[2] | B[3], + M * 1, + 64, + 2), // Pure Dust worth of one Ingot or Gem. Introduced by Alblaka. + nugget( + "Nuggets", "", " Nugget", true, true, false, false, false, false, false, true, false, false, B[1], M / 9, + 64, 9), // A Nugget. Introduced by Eloraam + plateAlloy( + "Alloy Plates", + "", + "", + true, + false, + false, + false, + false, + false, + false, + false, + false, + false, + B[1], + -1, + 64, + 17), // Special Alloys have this prefix. + plateSteamcraft( + "Steamcraft Plates", + "", + "", + false, + false, + false, + false, + false, + false, + false, + false, + false, + false, + B[1], + -1, + 64, + 17), + plateDense( + "Dense Plates", + "Dense ", + " Plate", + true, + true, + false, + false, + false, + false, + true, + true, + false, + false, + B[1], + M * 9, + 8, + 22), // 9 Plates combined in one Item. + plateQuintuple( + "5x Plates", + "Quintuple ", + " Plate", + true, + true, + false, + false, + false, + false, + true, + true, + false, + false, + B[1], + M * 5, + 12, + 21), + plateQuadruple( + "4x Plates", + "Quadruple ", + " Plate", + true, + true, + false, + false, + false, + false, + true, + true, + false, + false, + B[1], + M * 4, + 16, + 20), + @Deprecated + plateQuad( + "4x Plates", + "", + "", + false, + false, + false, + false, + false, + false, + false, + false, + false, + false, + B[1], + -1, + 16, + 20), + plateTriple( + "3x Plates", + "Triple ", + " Plate", + true, + true, + false, + false, + false, + false, + true, + true, + false, + false, + B[1], + M * 3, + 21, + 19), + plateDouble( + "2x Plates", + "Double ", + " Plate", + true, + true, + false, + false, + false, + false, + true, + true, + false, + false, + B[1], + M * 2, + 32, + 18), + plate( + "Plates", + "", + " Plate", + true, + true, + false, + false, + false, + false, + true, + true, + false, + false, + B[1] | B[2], + M * 1, + 64, + 17), // Regular Plate made of one Ingot/Dust. Introduced by Calclavia + itemCasing( + "Casings", + "", + " Casing", + true, + true, + false, + false, + false, + false, + true, + true, + false, + false, + B[1] | B[2], + M / 2, + 64, + 10), // Casing made of 1/2 Ingot/Dust + foil( + "Foils", "", " Foil", true, true, false, false, false, false, true, true, false, false, B[1], M / 4, 64, + 29), // Foil made of 1/4 Ingot/Dust. + stickLong( + "Long Sticks/Rods", + "Long ", + " Rod", + true, + true, + false, + false, + false, + false, + true, + true, + false, + false, + B[1] | B[2], + M * 1, + 64, + 54), // Stick made of an Ingot. + stick( + "Sticks/Rods", + "", + " Rod", + true, + true, + false, + false, + false, + false, + true, + true, + false, + false, + B[1] | B[2], + M / 2, + 64, + 23), // Stick made of half an Ingot. Introduced by Eloraam + round( + "Rounds", "", " Round", true, true, false, false, false, false, true, true, false, false, B[1], M / 9, 64, + 25), // consisting out of one Nugget. + bolt( + "Bolts", + "", + " Bolt", + true, + true, + false, + false, + false, + false, + true, + true, + false, + false, + B[1] | B[2], + M / 8, + 64, + 26), // consisting out of 1/8 Ingot or 1/4 Stick. + comb( + "Combs", + "", + " Comb", + false, + false, + false, + false, + false, + false, + false, + true, + false, + false, + B[1] | B[2], + M, + 64, + 101), // contain dusts + screw( + "Screws", + "", + " Screw", + true, + true, + false, + false, + false, + false, + true, + true, + false, + false, + B[1] | B[2], + M / 9, + 64, + 27), // consisting out of a Bolt. + ring( + "Rings", "", " Ring", true, true, false, false, false, false, true, true, false, false, B[1], M / 4, 64, + 28), // consisting out of 1/2 Stick. + springSmall( + "Small Springs", + "Small ", + " Spring", + true, + true, + false, + false, + false, + false, + true, + true, + false, + false, + B[1], + M / 4, + 64, + 55), // consisting out of 1 Fine Wire. + spring( + "Springs", "", " Spring", true, true, false, false, false, false, true, true, false, false, B[1], M * 1, 64, + 56), // consisting out of 2 Sticks. + wireFine( + "Fine Wires", + "Fine ", + " Wire", + true, + true, + false, + false, + false, + false, + true, + true, + false, + false, + B[1], + M / 8, + 64, + 51), // consisting out of 1/8 Ingot or 1/4 Wire. + rotor( + "Rotors", + "", + " Rotor", + true, + true, + false, + false, + false, + false, + true, + true, + false, + false, + B[7], + M * 4 + M / 4, + 16, + 53), // consisting out of 4 Plates, 1 Ring and 1 Screw. + gearGtSmall( + "Small Gears", + "Small ", + " Gear", + true, + true, + false, + false, + false, + false, + true, + true, + false, + false, + B[7], + M * 1, + 64, + 52), + gearGt( + "Gears", "", " Gear", true, true, false, false, false, false, true, true, false, false, B[7], M * 4, 16, + 63), // Introduced by me because BuildCraft has ruined the gear Prefix... + lens( + "Lenses", + "", + " Lens", + true, + true, + false, + false, + false, + false, + true, + true, + false, + false, + B[2], + (M * 3) / 4, + 64, + 24), // 3/4 of a Plate or Gem used to shape a Lense. Normally only used on Transparent Materials. + crateGtDust( + "Crates of Dust", + "Crate of ", + " Dust", + true, + true, + false, + true, + false, + false, + false, + true, + false, + false, + B[0] | B[1] | B[2] | B[3], + -1, + 64, + 96), // consisting out of 16 Dusts. + crateGtPlate( + "Crates of Plates", + "Crate of ", + " Plate", + true, + true, + false, + true, + false, + false, + false, + true, + false, + false, + B[1] | B[2], + -1, + 64, + 99), // consisting out of 16 Plates. + crateGtIngot( + "Crates of Ingots", + "Crate of ", + " Ingot", + true, + true, + false, + true, + false, + false, + false, + true, + false, + false, + B[1], + -1, + 64, + 97), // consisting out of 16 Ingots. + crateGtGem( + "Crates of Gems", + "Crate of ", + " Gem", + true, + true, + false, + true, + false, + false, + false, + true, + false, + false, + B[2], + -1, + 64, + 98), // consisting out of 16 Gems. + cellPlasma( + "Cells of Plasma", + "", + " Plasma Cell", + true, + true, + true, + true, + false, + false, + false, + true, + false, + false, + B[5], + M * 1, + 64, + 31), // Hot Cell full of Plasma, which can be used in the Plasma Generator. + cellMolten( + "Cells of Molten stuff", + "Molten ", + " Cell", + true, + true, + true, + true, + false, + false, + false, + true, + false, + false, + 0, + M * 1, + 64, + 31), // Hot Cell full of molten stuff, which can be used in the Plasma Generator. + cell( + "Cells", + "", + " Cell", + true, + true, + true, + true, + false, + false, + true, + true, + false, + false, + B[4] | B[8], + M * 1, + 64, + 30), // Regular Gas/Fluid Cell. Introduced by Calclavia + bucket( + "Buckets", + "", + " Bucket", + true, + true, + true, + true, + false, + false, + true, + false, + false, + false, + B[4] | B[8], + M * 1, + 16, + -1), // A vanilla Iron Bucket filled with the Material. + bucketClay( + "Clay Buckets", + "", + " Clay Bucket", + true, + true, + true, + true, + false, + false, + true, + false, + false, + false, + B[4] | B[8], + M * 1, + 16, + -1), // An Iguana Tweaks Clay Bucket filled with the Material. + bottle( + "Bottles", + "", + " Bottle", + true, + true, + true, + true, + false, + false, + false, + false, + false, + false, + B[4] | B[8], + -1, + 16, + -1), // Glass Bottle containing a Fluid. + capsule( + "Capsules", + "", + " Capsule", + false, + true, + true, + true, + false, + false, + false, + false, + false, + false, + B[4] | B[8], + M * 1, + 16, + -1), + crystal( + "Crystals", + "", + " Crystal", + false, + true, + false, + false, + false, + false, + true, + false, + false, + false, + B[2], + M * 1, + 64, + -1), + bulletGtSmall( + "Small Bullets", + "Small ", + " Bullet", + true, + true, + false, + false, + true, + false, + true, + false, + true, + false, + B[6] | B[8], + M / 9, + 64, + -1), + bulletGtMedium( + "Medium Bullets", + "Medium ", + " Bullet", + true, + true, + false, + false, + true, + false, + true, + false, + true, + false, + B[6] | B[8], + M / 6, + 64, + -1), + bulletGtLarge( + "Large Bullets", + "Large ", + " Bullet", + true, + true, + false, + false, + true, + false, + true, + false, + true, + false, + B[6] | B[8], + M / 3, + 64, + -1), + arrowGtWood( + "Regular Arrows", + "", + " Arrow", + true, + true, + false, + false, + true, + false, + true, + false, + true, + false, + B[6], + M / 4, + 64, + 57), // Arrow made of 1/4 Ingot/Dust + Wooden Stick. + arrowGtPlastic( + "Light Arrows", + "Light ", + " Arrow", + true, + true, + false, + false, + true, + false, + true, + false, + true, + false, + B[6], + M / 4, + 64, + 58), // Arrow made of 1/4 Ingot/Dust + Plastic Stick. arrow("Arrows", "", "", false, false, true, false, false, false, false, false, true, false, B[6], -1, 64, 57), - toolHeadArrow("Arrow Heads", "", " Arrow Head", true, true, false, false, false, false, true, true, false, false, B[6], M / 4, 64, 46), // consisting out of 1/4 Ingot. - toolHeadSword("Sword Blades", "", " Sword Blade", true, true, false, false, false, false, true, true, false, false, B[6], M * 2, 16, 32), // consisting out of 2 Ingots. - toolHeadPickaxe("Pickaxe Heads", "", " Pickaxe Head", true, true, false, false, false, false, true, true, false, false, B[6], M * 3, 16, 33), // consisting out of 3 Ingots. - toolHeadShovel("Shovel Heads", "", " Shovel Head", true, true, false, false, false, false, true, true, false, false, B[6], M * 1, 16, 34), // consisting out of 1 Ingots. - toolHeadUniversalSpade("Universal Spade Heads", "", " Universal Spade Head", true, true, false, false, false, false, true, true, false, false, B[6], M * 1, 16, 43), // consisting out of 1 Ingots. - toolHeadAxe("Axe Heads", "", " Axe Head", true, true, false, false, false, false, true, true, false, false, B[6], M * 3, 16, 35), // consisting out of 3 Ingots. - toolHeadHoe("Hoe Heads", "", " Hoe Head", true, true, false, false, false, false, true, true, false, false, B[6], M * 2, 16, 36), // consisting out of 2 Ingots. - toolHeadSense("Sense Blades", "", " Sense Blade", true, true, false, false, false, false, true, true, false, false, B[6], M * 3, 16, 44), // consisting out of 3 Ingots. - toolHeadFile("File Heads", "", " File Head", true, true, false, false, false, false, true, true, false, false, B[6], M * 2, 16, 38), // consisting out of 2 Ingots. - toolHeadHammer("Hammer Heads", "", " Hammer Head", true, true, false, false, false, false, true, true, false, false, B[6], M * 6, 16, 37), // consisting out of 6 Ingots. - toolHeadPlow("Plow Heads", "", " Plow Head", true, true, false, false, false, false, true, true, false, false, B[6], M * 4, 16, 45), // consisting out of 4 Ingots. - toolHeadSaw("Saw Blades", "", " Saw Blade", true, true, false, false, false, false, true, true, false, false, B[6], M * 2, 16, 39), // consisting out of 2 Ingots. - toolHeadBuzzSaw("Buzzsaw Blades", "", " Buzzsaw Blade", true, true, false, false, false, false, true, true, false, false, B[6], M * 4, 16, 48), // consisting out of 4 Ingots. - toolHeadScrewdriver("Screwdriver Tips", "", " Screwdriver Tip", true, true, false, false, false, false, true, false, false, false, B[6], M * 1, 16, 47), // consisting out of 1 Ingots. - toolHeadDrill("Drill Tips", "", " Drill Tip", true, true, false, false, false, false, true, true, false, false, B[6], M * 4, 16, 40), // consisting out of 4 Ingots. - toolHeadChainsaw("Chainsaw Tips", "", " Chainsaw Tip", true, true, false, false, false, false, true, true, false, false, B[6], M * 2, 16, 41), // consisting out of 2 Ingots. - toolHeadWrench("Wrench Tips", "", " Wrench Tip", true, true, false, false, false, false, true, true, false, false, B[6], M * 4, 16, 42), // consisting out of 4 Ingots. - turbineBlade("Turbine Blades", "", " Turbine Blade", true, true, false, false, false, false, true, true, false, false, B[6], M * 6, 64, 100), // consisting out of 6 Ingots. - toolSword("Swords", "", "", false, true, false, false, false, false, true, false, true, false, B[6], M * 2, 1, -1), // vanilly Sword - toolPickaxe("Pickaxes", "", "", false, true, false, false, false, false, true, false, true, false, B[6], M * 3, 1, -1), // vanilly Pickaxe - toolShovel("Shovels", "", "", false, true, false, false, false, false, true, false, true, false, B[6], M * 1, 1, -1), // vanilly Shovel - toolAxe("Axes", "", "", false, true, false, false, false, false, true, false, true, false, B[6], M * 3, 1, -1), // vanilly Axe - toolHoe("Hoes", "", "", false, true, false, false, false, false, true, false, true, false, B[6], M * 2, 1, -1), // vanilly Hoe - toolShears("Shears", "", "", false, true, false, false, false, false, true, false, true, false, B[6], M * 2, 1, -1), // vanilly Shears - tool("Tools", "", "", false, false, false, false, false, false, false, false, true, false, B[6], -1, 1, -1), // toolPot, toolSkillet, toolSaucepan, toolBakeware, toolCuttingboard, toolMortarandpestle, toolMixingbowl, toolJuicer - compressedCobblestone("9^X Compressed Cobblestones", "", "", false, false, false, false, false, false, false, false, false, false, 0, -1, 64, -1), - compressedStone("9^X Compressed Stones", "", "", false, false, false, false, false, false, false, false, false, false, 0, -1, 64, -1), - compressedDirt("9^X Compressed Dirt", "", "", false, false, false, false, false, false, false, false, false, false, 0, -1, 64, -1), - compressedGravel("9^X Compressed Gravel", "", "", false, false, false, false, false, false, false, false, false, false, 0, -1, 64, -1), - compressedSand("9^X Compressed Sand", "", "", false, false, false, false, false, false, false, false, false, false, 0, -1, 64, -1), - compressed("Compressed Materials", "Compressed ", "", true, true, false, false, false, false, true, false, false, false, 0, M * 3, 64, -1), // Compressed Material, worth 1 Unit. Introduced by Galacticraft + toolHeadArrow( + "Arrow Heads", + "", + " Arrow Head", + true, + true, + false, + false, + false, + false, + true, + true, + false, + false, + B[6], + M / 4, + 64, + 46), // consisting out of 1/4 Ingot. + toolHeadSword( + "Sword Blades", + "", + " Sword Blade", + true, + true, + false, + false, + false, + false, + true, + true, + false, + false, + B[6], + M * 2, + 16, + 32), // consisting out of 2 Ingots. + toolHeadPickaxe( + "Pickaxe Heads", + "", + " Pickaxe Head", + true, + true, + false, + false, + false, + false, + true, + true, + false, + false, + B[6], + M * 3, + 16, + 33), // consisting out of 3 Ingots. + toolHeadShovel( + "Shovel Heads", + "", + " Shovel Head", + true, + true, + false, + false, + false, + false, + true, + true, + false, + false, + B[6], + M * 1, + 16, + 34), // consisting out of 1 Ingots. + toolHeadUniversalSpade( + "Universal Spade Heads", + "", + " Universal Spade Head", + true, + true, + false, + false, + false, + false, + true, + true, + false, + false, + B[6], + M * 1, + 16, + 43), // consisting out of 1 Ingots. + toolHeadAxe( + "Axe Heads", + "", + " Axe Head", + true, + true, + false, + false, + false, + false, + true, + true, + false, + false, + B[6], + M * 3, + 16, + 35), // consisting out of 3 Ingots. + toolHeadHoe( + "Hoe Heads", + "", + " Hoe Head", + true, + true, + false, + false, + false, + false, + true, + true, + false, + false, + B[6], + M * 2, + 16, + 36), // consisting out of 2 Ingots. + toolHeadSense( + "Sense Blades", + "", + " Sense Blade", + true, + true, + false, + false, + false, + false, + true, + true, + false, + false, + B[6], + M * 3, + 16, + 44), // consisting out of 3 Ingots. + toolHeadFile( + "File Heads", + "", + " File Head", + true, + true, + false, + false, + false, + false, + true, + true, + false, + false, + B[6], + M * 2, + 16, + 38), // consisting out of 2 Ingots. + toolHeadHammer( + "Hammer Heads", + "", + " Hammer Head", + true, + true, + false, + false, + false, + false, + true, + true, + false, + false, + B[6], + M * 6, + 16, + 37), // consisting out of 6 Ingots. + toolHeadPlow( + "Plow Heads", + "", + " Plow Head", + true, + true, + false, + false, + false, + false, + true, + true, + false, + false, + B[6], + M * 4, + 16, + 45), // consisting out of 4 Ingots. + toolHeadSaw( + "Saw Blades", + "", + " Saw Blade", + true, + true, + false, + false, + false, + false, + true, + true, + false, + false, + B[6], + M * 2, + 16, + 39), // consisting out of 2 Ingots. + toolHeadBuzzSaw( + "Buzzsaw Blades", + "", + " Buzzsaw Blade", + true, + true, + false, + false, + false, + false, + true, + true, + false, + false, + B[6], + M * 4, + 16, + 48), // consisting out of 4 Ingots. + toolHeadScrewdriver( + "Screwdriver Tips", + "", + " Screwdriver Tip", + true, + true, + false, + false, + false, + false, + true, + false, + false, + false, + B[6], + M * 1, + 16, + 47), // consisting out of 1 Ingots. + toolHeadDrill( + "Drill Tips", + "", + " Drill Tip", + true, + true, + false, + false, + false, + false, + true, + true, + false, + false, + B[6], + M * 4, + 16, + 40), // consisting out of 4 Ingots. + toolHeadChainsaw( + "Chainsaw Tips", + "", + " Chainsaw Tip", + true, + true, + false, + false, + false, + false, + true, + true, + false, + false, + B[6], + M * 2, + 16, + 41), // consisting out of 2 Ingots. + toolHeadWrench( + "Wrench Tips", + "", + " Wrench Tip", + true, + true, + false, + false, + false, + false, + true, + true, + false, + false, + B[6], + M * 4, + 16, + 42), // consisting out of 4 Ingots. + turbineBlade( + "Turbine Blades", + "", + " Turbine Blade", + true, + true, + false, + false, + false, + false, + true, + true, + false, + false, + B[6], + M * 6, + 64, + 100), // consisting out of 6 Ingots. + toolSword( + "Swords", "", "", false, true, false, false, false, false, true, false, true, false, B[6], M * 2, 1, + -1), // vanilly Sword + toolPickaxe( + "Pickaxes", + "", + "", + false, + true, + false, + false, + false, + false, + true, + false, + true, + false, + B[6], + M * 3, + 1, + -1), // vanilly Pickaxe + toolShovel( + "Shovels", "", "", false, true, false, false, false, false, true, false, true, false, B[6], M * 1, 1, + -1), // vanilly Shovel + toolAxe( + "Axes", "", "", false, true, false, false, false, false, true, false, true, false, B[6], M * 3, 1, + -1), // vanilly Axe + toolHoe( + "Hoes", "", "", false, true, false, false, false, false, true, false, true, false, B[6], M * 2, 1, + -1), // vanilly Hoe + toolShears( + "Shears", "", "", false, true, false, false, false, false, true, false, true, false, B[6], M * 2, 1, + -1), // vanilly Shears + tool( + "Tools", "", "", false, false, false, false, false, false, false, false, true, false, B[6], -1, 1, + -1), // toolPot, toolSkillet, toolSaucepan, toolBakeware, toolCuttingboard, toolMortarandpestle, + // toolMixingbowl, toolJuicer + compressedCobblestone( + "9^X Compressed Cobblestones", + "", + "", + false, + false, + false, + false, + false, + false, + false, + false, + false, + false, + 0, + -1, + 64, + -1), + compressedStone( + "9^X Compressed Stones", + "", + "", + false, + false, + false, + false, + false, + false, + false, + false, + false, + false, + 0, + -1, + 64, + -1), + compressedDirt( + "9^X Compressed Dirt", + "", + "", + false, + false, + false, + false, + false, + false, + false, + false, + false, + false, + 0, + -1, + 64, + -1), + compressedGravel( + "9^X Compressed Gravel", + "", + "", + false, + false, + false, + false, + false, + false, + false, + false, + false, + false, + 0, + -1, + 64, + -1), + compressedSand( + "9^X Compressed Sand", + "", + "", + false, + false, + false, + false, + false, + false, + false, + false, + false, + false, + 0, + -1, + 64, + -1), + compressed( + "Compressed Materials", + "Compressed ", + "", + true, + true, + false, + false, + false, + false, + true, + false, + false, + false, + 0, + M * 3, + 64, + -1), // Compressed Material, worth 1 Unit. Introduced by Galacticraft glass("Glasses", "", "", false, false, true, false, true, false, false, false, false, false, 0, -1, 64, -1), paneGlass("Glass Panes", "", "", false, false, true, false, false, true, false, false, false, false, 0, -1, 64, -1), - blockGlass("Glass Blocks", "", "", false, false, true, false, false, true, false, false, false, false, 0, -1, 64, -1), + blockGlass( + "Glass Blocks", "", "", false, false, true, false, false, true, false, false, false, false, 0, -1, 64, -1), blockWool("Wool Blocks", "", "", false, false, true, false, false, true, false, false, false, false, 0, -1, 64, -1), - block_("Random Blocks", "", "", false, false, false, false, false, true, false, false, false, false, 0, -1, 64, -1), // IGNORE - block("Storage Blocks", "Block of ", "", true, true, false, false, false, true, true, false, false, false, 0, M * 9, 64, 71), // Storage Block consisting out of 9 Ingots/Gems/Dusts. Introduced by CovertJaguar - craftingTool("Crafting Tools", "", "", false, false, false, false, false, false, false, false, true, false, 0, -1, 64, -1), // Special Prefix used mainly for the Crafting Handler. - crafting("Crafting Ingredients", "", "", false, false, false, false, false, false, false, false, false, false, 0, -1, 64, -1), // Special Prefix used mainly for the Crafting Handler. - craft("Crafting Stuff?", "", "", false, false, false, false, false, false, false, false, false, false, 0, -1, 64, -1), // Special Prefix used mainly for the Crafting Handler. - log("Logs", "", "", false, false, false, false, false, true, false, false, false, false, 0, -1, 64, -1), // Prefix used for Logs. Usually as "logWood". Introduced by Eloraam - slab("Slabs", "", "", false, false, false, false, false, true, false, false, false, false, 0, -1, 64, -1), // Prefix used for Slabs. Usually as "slabWood" or "slabStone". Introduced by SirSengir - stair("Stairs", "", "", false, false, false, false, false, true, false, false, false, false, 0, -1, 64, -1), // Prefix used for Stairs. Usually as "stairWood" or "stairStone". Introduced by SirSengir - fence("Fences", "", "", false, false, false, false, false, false, false, false, false, false, 0, -1, 64, -1), // Prefix used for Fences. Usually as "fenceWood". Introduced by Forge - plank("Planks", "", "", false, false, false, false, false, true, false, false, false, false, 0, -1, 64, -1), // Prefix for Planks. Usually "plankWood". Introduced by Eloraam - treeSapling("Saplings", "", "", false, false, true, false, false, true, false, false, false, false, 0, -1, 64, -1), // Prefix for Saplings. - treeLeaves("Leaves", "", "", false, false, true, false, false, true, false, false, false, false, 0, -1, 64, -1), // Prefix for Leaves. - tree("Tree Parts", "", "", false, false, false, false, false, false, false, false, false, false, 0, -1, 64, -1), // Prefix for Tree Parts. - stoneCobble("Cobblestones", "", "", false, false, true, false, false, true, false, false, false, false, 0, -1, 64, -1), // Cobblestone Prefix for all Cobblestones. - stoneSmooth("Smoothstones", "", "", false, false, true, false, false, true, false, false, false, false, 0, -1, 64, -1), // Smoothstone Prefix. - stoneMossyBricks("mossy Stone Bricks", "", "", false, false, true, false, false, true, false, false, false, false, 0, -1, 64, -1), // Mossy Stone Bricks. - stoneMossy("Mossy Stones", "", "", false, false, true, false, false, true, false, false, false, false, 0, -1, 64, -1), // Mossy Cobble. - @Deprecated stoneBricksMossy("Mossy Stone Bricks", "", "", false, false, false, false, false, true, false, false, false, false, 0, -1, 64, -1), - stoneBricks("Stone Bricks", "", "", false, false, true, false, false, true, false, false, false, false, 0, -1, 64, -1), // Stone Bricks. - @Deprecated stoneBrick("Stone Bricks", "", "", false, false, false, false, false, true, false, false, false, false, 0, -1, 64, -1), - stoneCracked("Cracked Stones", "", "", false, false, true, false, false, true, false, false, false, false, 0, -1, 64, -1), // Cracked Bricks. - stoneChiseled("Chiseled Stones", "", "", false, false, true, false, false, true, false, false, false, false, 0, -1, 64, -1), // Chiseled Stone. - stone("Stones", "", "", false, true, true, false, true, true, false, false, false, false, 0, -1, 64, -1), // Prefix to determine which kind of Rock this is. - cobblestone("Cobblestones", "", "", false, true, true, false, false, true, false, false, false, false, 0, -1, 64, -1), - rock("Rocks", "", "", false, true, true, false, true, true, false, false, false, false, 0, -1, 64, -1), // Prefix to determine which kind of Rock this is. + block_( + "Random Blocks", + "", + "", + false, + false, + false, + false, + false, + true, + false, + false, + false, + false, + 0, + -1, + 64, + -1), // IGNORE + block( + "Storage Blocks", + "Block of ", + "", + true, + true, + false, + false, + false, + true, + true, + false, + false, + false, + 0, + M * 9, + 64, + 71), // Storage Block consisting out of 9 Ingots/Gems/Dusts. Introduced by CovertJaguar + craftingTool( + "Crafting Tools", + "", + "", + false, + false, + false, + false, + false, + false, + false, + false, + true, + false, + 0, + -1, + 64, + -1), // Special Prefix used mainly for the Crafting Handler. + crafting( + "Crafting Ingredients", + "", + "", + false, + false, + false, + false, + false, + false, + false, + false, + false, + false, + 0, + -1, + 64, + -1), // Special Prefix used mainly for the Crafting Handler. + craft( + "Crafting Stuff?", + "", + "", + false, + false, + false, + false, + false, + false, + false, + false, + false, + false, + 0, + -1, + 64, + -1), // Special Prefix used mainly for the Crafting Handler. + log( + "Logs", "", "", false, false, false, false, false, true, false, false, false, false, 0, -1, 64, + -1), // Prefix used for Logs. Usually as "logWood". Introduced by Eloraam + slab( + "Slabs", "", "", false, false, false, false, false, true, false, false, false, false, 0, -1, 64, + -1), // Prefix used for Slabs. Usually as "slabWood" or "slabStone". Introduced by SirSengir + stair( + "Stairs", "", "", false, false, false, false, false, true, false, false, false, false, 0, -1, 64, + -1), // Prefix used for Stairs. Usually as "stairWood" or "stairStone". Introduced by SirSengir + fence( + "Fences", "", "", false, false, false, false, false, false, false, false, false, false, 0, -1, 64, + -1), // Prefix used for Fences. Usually as "fenceWood". Introduced by Forge + plank( + "Planks", "", "", false, false, false, false, false, true, false, false, false, false, 0, -1, 64, + -1), // Prefix for Planks. Usually "plankWood". Introduced by Eloraam + treeSapling( + "Saplings", + "", + "", + false, + false, + true, + false, + false, + true, + false, + false, + false, + false, + 0, + -1, + 64, + -1), // Prefix for Saplings. + treeLeaves( + "Leaves", "", "", false, false, true, false, false, true, false, false, false, false, 0, -1, 64, + -1), // Prefix for Leaves. + tree( + "Tree Parts", + "", + "", + false, + false, + false, + false, + false, + false, + false, + false, + false, + false, + 0, + -1, + 64, + -1), // Prefix for Tree Parts. + stoneCobble( + "Cobblestones", + "", + "", + false, + false, + true, + false, + false, + true, + false, + false, + false, + false, + 0, + -1, + 64, + -1), // Cobblestone Prefix for all Cobblestones. + stoneSmooth( + "Smoothstones", + "", + "", + false, + false, + true, + false, + false, + true, + false, + false, + false, + false, + 0, + -1, + 64, + -1), // Smoothstone Prefix. + stoneMossyBricks( + "mossy Stone Bricks", + "", + "", + false, + false, + true, + false, + false, + true, + false, + false, + false, + false, + 0, + -1, + 64, + -1), // Mossy Stone Bricks. + stoneMossy( + "Mossy Stones", + "", + "", + false, + false, + true, + false, + false, + true, + false, + false, + false, + false, + 0, + -1, + 64, + -1), // Mossy Cobble. + @Deprecated + stoneBricksMossy( + "Mossy Stone Bricks", + "", + "", + false, + false, + false, + false, + false, + true, + false, + false, + false, + false, + 0, + -1, + 64, + -1), + stoneBricks( + "Stone Bricks", + "", + "", + false, + false, + true, + false, + false, + true, + false, + false, + false, + false, + 0, + -1, + 64, + -1), // Stone Bricks. + @Deprecated + stoneBrick( + "Stone Bricks", "", "", false, false, false, false, false, true, false, false, false, false, 0, -1, 64, -1), + stoneCracked( + "Cracked Stones", + "", + "", + false, + false, + true, + false, + false, + true, + false, + false, + false, + false, + 0, + -1, + 64, + -1), // Cracked Bricks. + stoneChiseled( + "Chiseled Stones", + "", + "", + false, + false, + true, + false, + false, + true, + false, + false, + false, + false, + 0, + -1, + 64, + -1), // Chiseled Stone. + stone( + "Stones", "", "", false, true, true, false, true, true, false, false, false, false, 0, -1, 64, + -1), // Prefix to determine which kind of Rock this is. + cobblestone( + "Cobblestones", "", "", false, true, true, false, false, true, false, false, false, false, 0, -1, 64, -1), + rock( + "Rocks", "", "", false, true, true, false, true, true, false, false, false, false, 0, -1, 64, + -1), // Prefix to determine which kind of Rock this is. record("Records", "", "", false, false, true, false, false, false, false, false, false, false, 0, -1, 1, -1), rubble("Rubbles", "", "", true, true, true, false, false, false, false, false, false, false, 0, -1, 64, -1), scraps("Scraps", "", "", true, true, false, false, false, false, false, false, false, false, 0, -1, 64, -1), scrap("Scraps", "", "", false, false, false, false, false, false, false, false, false, false, 0, -1, 64, -1), - item_("Items", "", "", false, false, false, false, false, false, false, false, false, false, 0, -1, 64, -1), // IGNORE - item("Items", "", "", false, false, false, false, false, false, false, false, false, false, 0, -1, 64, -1), // Random Item. Introduced by Alblaka - book("Books", "", "", false, false, false, false, false, false, false, false, false, false, 0, -1, 64, -1), // Used for Books of any kind. - paper("Papers", "", "", false, false, false, false, false, false, false, false, false, false, 0, -1, 64, -1), // Used for Papers of any kind. - dye("Dyes", "", "", false, false, true, false, false, false, false, false, false, false, 0, -1, 64, -1), // Used for the 16 dyes. Introduced by Eloraam - stainedClay("Stained Clays", "", "", false, false, true, false, false, true, false, false, false, false, 0, -1, 64, -1), // Used for the 16 colors of Stained Clay. Introduced by Forge - armorHelmet("Helmets", "", "", false, true, false, false, false, false, true, false, true, false, B[6], M * 5, 1, -1), // vanilly Helmet - armorChestplate("Chestplates", "", "", false, true, false, false, false, false, true, false, true, false, B[6], M * 8, 1, -1), // vanilly Chestplate - armorLeggings("Leggings", "", "", false, true, false, false, false, false, true, false, true, false, B[6], M * 7, 1, -1), // vanilly Pants - armorBoots("Boots", "", "", false, true, false, false, false, false, true, false, true, false, B[6], M * 4, 1, -1), // vanilly Boots + item_( + "Items", "", "", false, false, false, false, false, false, false, false, false, false, 0, -1, 64, + -1), // IGNORE + item( + "Items", "", "", false, false, false, false, false, false, false, false, false, false, 0, -1, 64, + -1), // Random Item. Introduced by Alblaka + book( + "Books", "", "", false, false, false, false, false, false, false, false, false, false, 0, -1, 64, + -1), // Used for Books of any kind. + paper( + "Papers", "", "", false, false, false, false, false, false, false, false, false, false, 0, -1, 64, + -1), // Used for Papers of any kind. + dye( + "Dyes", "", "", false, false, true, false, false, false, false, false, false, false, 0, -1, 64, + -1), // Used for the 16 dyes. Introduced by Eloraam + stainedClay( + "Stained Clays", + "", + "", + false, + false, + true, + false, + false, + true, + false, + false, + false, + false, + 0, + -1, + 64, + -1), // Used for the 16 colors of Stained Clay. Introduced by Forge + armorHelmet( + "Helmets", "", "", false, true, false, false, false, false, true, false, true, false, B[6], M * 5, 1, + -1), // vanilly Helmet + armorChestplate( + "Chestplates", + "", + "", + false, + true, + false, + false, + false, + false, + true, + false, + true, + false, + B[6], + M * 8, + 1, + -1), // vanilly Chestplate + armorLeggings( + "Leggings", + "", + "", + false, + true, + false, + false, + false, + false, + true, + false, + true, + false, + B[6], + M * 7, + 1, + -1), // vanilly Pants + armorBoots( + "Boots", "", "", false, true, false, false, false, false, true, false, true, false, B[6], M * 4, 1, + -1), // vanilly Boots armor("Armor Parts", "", "", false, false, false, false, false, false, false, false, true, false, B[6], -1, 1, -1), frameGt("Frame Boxes", "", "", true, true, false, false, true, false, true, false, false, false, 0, M * 2, 64, 83), - pipeTiny("Tiny Pipes", "Tiny ", " Pipe", true, true, false, false, true, false, true, false, false, false, 0, M / 2, 64, 78), - pipeSmall("Small Pipes", "Small ", " Pipe", true, true, false, false, true, false, true, false, false, false, 0, M * 1, 64, 79), - pipeMedium("Medium Pipes", "Medium ", " Pipe", true, true, false, false, true, false, true, false, false, false, 0, M * 3, 64, 80), - pipeLarge("Large pipes", "Large ", " Pipe", true, true, false, false, true, false, true, false, false, false, 0, M * 6, 64, 81), - pipeHuge("Huge Pipes", "Huge ", " Pipe", true, true, false, false, true, false, true, false, false, false, 0, M * 12, 64, 82), - pipeQuadruple("Quadruple Pipes", "Quadruple ", " Pipe", true, true, false, false, true, false, true, false, false, false, 0, M *12, 64, 84), - pipeNonuple("Nonuple Pipes", "Nonuple ", " Pipe", true, true, false, false, true, false, true, false, false, false, 0, M * 9, 64, 85), - pipeRestrictiveTiny("Tiny Restrictive Pipes", "Tiny Restrictive ", " Pipe", true, true, false, false, true, false, true, false, false, false, 0, M / 2, 64, 78), - pipeRestrictiveSmall("Small Restrictive Pipes", "Small Restrictive ", " Pipe", true, true, false, false, true, false, true, false, false, false, 0, M * 1, 64, 79), - pipeRestrictiveMedium("Medium Restrictive Pipes", "Medium Restrictive ", " Pipe", true, true, false, false, true, false, true, false, false, false, 0, M * 3, 64, 80), - pipeRestrictiveLarge("Large Restrictive Pipes", "Large Restrictive ", " Pipe", true, true, false, false, true, false, true, false, false, false, 0, M * 6, 64, 81), - pipeRestrictiveHuge("Huge Restrictive Pipes", "Huge Restrictive ", " Pipe", true, true, false, false, true, false, true, false, false, false, 0, M * 12, 64, 82), + pipeTiny( + "Tiny Pipes", + "Tiny ", + " Pipe", + true, + true, + false, + false, + true, + false, + true, + false, + false, + false, + 0, + M / 2, + 64, + 78), + pipeSmall( + "Small Pipes", + "Small ", + " Pipe", + true, + true, + false, + false, + true, + false, + true, + false, + false, + false, + 0, + M * 1, + 64, + 79), + pipeMedium( + "Medium Pipes", + "Medium ", + " Pipe", + true, + true, + false, + false, + true, + false, + true, + false, + false, + false, + 0, + M * 3, + 64, + 80), + pipeLarge( + "Large pipes", + "Large ", + " Pipe", + true, + true, + false, + false, + true, + false, + true, + false, + false, + false, + 0, + M * 6, + 64, + 81), + pipeHuge( + "Huge Pipes", + "Huge ", + " Pipe", + true, + true, + false, + false, + true, + false, + true, + false, + false, + false, + 0, + M * 12, + 64, + 82), + pipeQuadruple( + "Quadruple Pipes", + "Quadruple ", + " Pipe", + true, + true, + false, + false, + true, + false, + true, + false, + false, + false, + 0, + M * 12, + 64, + 84), + pipeNonuple( + "Nonuple Pipes", + "Nonuple ", + " Pipe", + true, + true, + false, + false, + true, + false, + true, + false, + false, + false, + 0, + M * 9, + 64, + 85), + pipeRestrictiveTiny( + "Tiny Restrictive Pipes", + "Tiny Restrictive ", + " Pipe", + true, + true, + false, + false, + true, + false, + true, + false, + false, + false, + 0, + M / 2, + 64, + 78), + pipeRestrictiveSmall( + "Small Restrictive Pipes", + "Small Restrictive ", + " Pipe", + true, + true, + false, + false, + true, + false, + true, + false, + false, + false, + 0, + M * 1, + 64, + 79), + pipeRestrictiveMedium( + "Medium Restrictive Pipes", + "Medium Restrictive ", + " Pipe", + true, + true, + false, + false, + true, + false, + true, + false, + false, + false, + 0, + M * 3, + 64, + 80), + pipeRestrictiveLarge( + "Large Restrictive Pipes", + "Large Restrictive ", + " Pipe", + true, + true, + false, + false, + true, + false, + true, + false, + false, + false, + 0, + M * 6, + 64, + 81), + pipeRestrictiveHuge( + "Huge Restrictive Pipes", + "Huge Restrictive ", + " Pipe", + true, + true, + false, + false, + true, + false, + true, + false, + false, + false, + 0, + M * 12, + 64, + 82), pipe("Pipes", "", " Pipe", true, false, false, false, false, false, false, false, false, false, 0, -1, 64, 77), - wireGt16("16x Wires", "16x ", " Wire", true, true, false, false, false, false, true, false, false, false, 0, M * 8, 64, -1), - wireGt12("12x Wires", "12x ", " Wire", true, true, false, false, false, false, true, false, false, false, 0, M * 6, 64, -1), - wireGt08("8x Wires", "8x ", " Wire", true, true, false, false, false, false, true, false, false, false, 0, M * 4, 64, -1), - wireGt04("4x Wires", "4x ", " Wire", true, true, false, false, false, false, true, false, false, false, 0, M * 2, 64, -1), - wireGt02("2x Wires", "2x ", " Wire", true, true, false, false, false, false, true, false, false, false, 0, M * 1, 64, -1), - wireGt01("1x Wires", "1x ", " Wire", true, true, false, false, false, false, true, false, false, false, 0, M / 2, 64, -1), - cableGt16("16x Cables", "16x ", " Cable", true, true, false, false, false, false, true, false, false, false, 0, M * 8, 64, -1), - cableGt12("12x Cables", "12x ", " Cable", true, true, false, false, false, false, true, false, false, false, 0, M * 6, 64, -1), - cableGt08("8x Cables", "8x ", " Cable", true, true, false, false, false, false, true, false, false, false, 0, M * 4, 64, -1), - cableGt04("4x Cables", "4x ", " Cable", true, true, false, false, false, false, true, false, false, false, 0, M * 2, 64, -1), - cableGt02("2x Cables", "2x ", " Cable", true, true, false, false, false, false, true, false, false, false, 0, M * 1, 64, -1), - cableGt01("1x Cables", "1x ", " Cable", true, true, false, false, false, false, true, false, false, false, 0, M / 2, 64, -1), + wireGt16( + "16x Wires", + "16x ", + " Wire", + true, + true, + false, + false, + false, + false, + true, + false, + false, + false, + 0, + M * 8, + 64, + -1), + wireGt12( + "12x Wires", + "12x ", + " Wire", + true, + true, + false, + false, + false, + false, + true, + false, + false, + false, + 0, + M * 6, + 64, + -1), + wireGt08( + "8x Wires", + "8x ", + " Wire", + true, + true, + false, + false, + false, + false, + true, + false, + false, + false, + 0, + M * 4, + 64, + -1), + wireGt04( + "4x Wires", + "4x ", + " Wire", + true, + true, + false, + false, + false, + false, + true, + false, + false, + false, + 0, + M * 2, + 64, + -1), + wireGt02( + "2x Wires", + "2x ", + " Wire", + true, + true, + false, + false, + false, + false, + true, + false, + false, + false, + 0, + M * 1, + 64, + -1), + wireGt01( + "1x Wires", + "1x ", + " Wire", + true, + true, + false, + false, + false, + false, + true, + false, + false, + false, + 0, + M / 2, + 64, + -1), + cableGt16( + "16x Cables", + "16x ", + " Cable", + true, + true, + false, + false, + false, + false, + true, + false, + false, + false, + 0, + M * 8, + 64, + -1), + cableGt12( + "12x Cables", + "12x ", + " Cable", + true, + true, + false, + false, + false, + false, + true, + false, + false, + false, + 0, + M * 6, + 64, + -1), + cableGt08( + "8x Cables", + "8x ", + " Cable", + true, + true, + false, + false, + false, + false, + true, + false, + false, + false, + 0, + M * 4, + 64, + -1), + cableGt04( + "4x Cables", + "4x ", + " Cable", + true, + true, + false, + false, + false, + false, + true, + false, + false, + false, + 0, + M * 2, + 64, + -1), + cableGt02( + "2x Cables", + "2x ", + " Cable", + true, + true, + false, + false, + false, + false, + true, + false, + false, + false, + 0, + M * 1, + 64, + -1), + cableGt01( + "1x Cables", + "1x ", + " Cable", + true, + true, + false, + false, + false, + false, + true, + false, + false, + false, + 0, + M / 2, + 64, + -1), /* Electric Components. * - * usual Materials for this are: - * Primitive (Tier 1) - * Basic (Tier 2) as used by UE as well : IC2 Circuit and RE-Battery - * Good (Tier 3) - * Advanced (Tier 4) as used by UE as well : Advanced Circuit, Advanced Battery and Lithium Battery - * Data (Tier 5) : Data Storage Circuit - * Elite (Tier 6) as used by UE as well : Energy Crystal and Data Control Circuit - * Master (Tier 7) : Energy Flow Circuit and Lapotron Crystal - * Ultimate (Tier 8) : Data Orb and Lapotronic Energy Orb - * Infinite (Cheaty) - */ - batterySingleuse("Single Use Batteries", "", "", false, true, false, false, false, false, false, false, false, false, 0, -1, 64, -1), - battery("Reusable Batteries", "", "", false, true, false, false, false, false, false, false, false, false, 0, -1, 64, -1), // Introduced by Calclavia - circuit("Circuits", "", "", true, true, false, false, false, false, false, false, false, false, 0, -1, 64, -1), // Introduced by Calclavia - chipset("Chipsets", "", "", true, true, false, false, false, false, false, false, false, false, 0, -1, 64, -1), // Introduced by Buildcraft - computer("Computers", "", "", true, true, false, false, true, false, false, false, false, false, 0, -1, 64, -1), // A whole Computer. "computerMaster" = ComputerCube + * usual Materials for this are: + * Primitive (Tier 1) + * Basic (Tier 2) as used by UE as well : IC2 Circuit and RE-Battery + * Good (Tier 3) + * Advanced (Tier 4) as used by UE as well : Advanced Circuit, Advanced Battery and Lithium Battery + * Data (Tier 5) : Data Storage Circuit + * Elite (Tier 6) as used by UE as well : Energy Crystal and Data Control Circuit + * Master (Tier 7) : Energy Flow Circuit and Lapotron Crystal + * Ultimate (Tier 8) : Data Orb and Lapotronic Energy Orb + * Infinite (Cheaty) + */ + batterySingleuse( + "Single Use Batteries", + "", + "", + false, + true, + false, + false, + false, + false, + false, + false, + false, + false, + 0, + -1, + 64, + -1), + battery( + "Reusable Batteries", + "", + "", + false, + true, + false, + false, + false, + false, + false, + false, + false, + false, + 0, + -1, + 64, + -1), // Introduced by Calclavia + circuit( + "Circuits", + "", + "", + true, + true, + false, + false, + false, + false, + false, + false, + false, + false, + 0, + -1, + 64, + -1), // Introduced by Calclavia + chipset( + "Chipsets", + "", + "", + true, + true, + false, + false, + false, + false, + false, + false, + false, + false, + 0, + -1, + 64, + -1), // Introduced by Buildcraft + computer( + "Computers", + "", + "", + true, + true, + false, + false, + true, + false, + false, + false, + false, + false, + 0, + -1, + 64, + -1), // A whole Computer. "computerMaster" = ComputerCube // random known prefixes without special abilities. skull("Skulls", "", "", false, false, false, false, false, false, false, false, false, false, 0, -1, 64, -1), plating("Platings", "", "", false, false, false, false, false, false, false, false, false, false, 0, -1, 64, -1), dinosaur("Dinosaurs", "", "", false, false, false, false, false, false, false, false, false, false, 0, -1, 64, -1), - travelgear("Travel Gear", "", "", false, false, false, false, false, false, false, false, false, false, 0, -1, 64, -1), + travelgear( + "Travel Gear", "", "", false, false, false, false, false, false, false, false, false, false, 0, -1, 64, -1), bauble("Baubles", "", "", false, false, false, false, false, false, false, false, false, false, 0, -1, 64, -1), cluster("Clusters", "", "", false, false, false, false, false, false, false, false, false, false, 0, -1, 64, -1), grafter("Grafters", "", "", false, false, false, false, false, false, false, false, false, false, 0, -1, 64, -1), @@ -254,7 +2878,9 @@ public enum OrePrefixes { grass("Grasses", "", "", false, false, false, false, false, false, false, false, false, false, 0, -1, 64, -1), gravel("Gravels", "", "", false, false, false, false, false, false, false, false, false, false, 0, -1, 64, -1), mushroom("Mushrooms", "", "", false, false, false, false, false, false, false, false, false, false, 0, -1, 64, -1), - wood("Woods", "", "", false, false, false, false, false, false, false, false, false, false, 0, -1, 64, -1), // Introduced by Eloraam + wood( + "Woods", "", "", false, false, false, false, false, false, false, false, false, false, 0, -1, 64, + -1), // Introduced by Eloraam drop("Drops", "", "", false, false, false, false, false, false, false, false, false, false, 0, -1, 64, -1), fuel("Fuels", "", "", false, false, false, false, false, false, false, false, false, false, 0, -1, 64, -1), panel("Panels", "", "", false, false, false, false, false, false, false, false, false, false, 0, -1, 64, -1), @@ -263,21 +2889,42 @@ public enum OrePrefixes { wire("Wires", "", "", false, false, false, false, true, false, false, false, false, false, 0, -1, 64, -1), seed("Seeds", "", "", false, false, false, false, false, false, false, false, false, false, 0, -1, 64, -1), reed("Reeds", "", "", false, false, false, false, false, false, false, false, false, false, 0, -1, 64, -1), - sheetDouble("2x Sheets", "", "", false, false, false, false, false, false, false, false, false, false, 0, -1, 64, -1), + sheetDouble( + "2x Sheets", "", "", false, false, false, false, false, false, false, false, false, false, 0, -1, 64, -1), sheet("Sheets", "", "", false, false, false, false, false, false, false, false, false, false, 0, -1, 64, -1), crop("Crops", "", "", false, false, false, false, false, false, false, false, false, false, 0, -1, 64, -1), plant("Plants", "", "", false, false, false, false, false, false, false, false, false, false, 0, -1, 64, -1), coin("Coins", "", "", false, false, false, false, false, false, false, false, false, false, 0, -1, 64, -1), lumar("Lumars", "", "", false, false, false, false, false, false, false, false, false, false, 0, -1, 64, -1), - ground("Grounded Stuff", "", "", false, false, false, false, false, false, false, false, false, false, 0, -1, 64, -1), + ground( + "Grounded Stuff", + "", + "", + false, + false, + false, + false, + false, + false, + false, + false, + false, + false, + 0, + -1, + 64, + -1), cable("Cables", "", "", false, false, false, false, false, false, false, false, false, false, 0, -1, 64, -1), - component("Components", "", "", false, false, false, false, false, false, false, false, false, false, 0, -1, 64, -1), + component( + "Components", "", "", false, false, false, false, false, false, false, false, false, false, 0, -1, 64, -1), wax("Waxes", "", "", false, false, false, false, false, false, false, false, false, false, 0, -1, 64, -1), wall("Walls", "", "", false, false, false, false, false, false, false, false, false, false, 0, -1, 64, -1), tube("Tubes", "", "", false, false, false, false, false, false, false, false, false, false, 0, -1, 64, -1), list("Lists", "", "", false, false, false, false, false, false, false, false, false, false, 0, -1, 64, -1), food("Foods", "", "", false, false, false, false, false, false, false, false, false, false, 0, -1, 64, -1), - gear("Gears", "", "", false, false, false, false, false, false, false, false, false, false, 0, -1, 64, -1), // Introduced by SirSengir + gear( + "Gears", "", "", false, false, false, false, false, false, false, false, false, false, 0, -1, 64, + -1), // Introduced by SirSengir coral("Corals", "", "", false, false, false, false, false, false, false, false, false, false, 0, -1, 64, -1), flower("Flowers", "", "", false, false, false, false, false, false, false, false, false, false, 0, -1, 64, -1), storage("Storages", "", "", false, false, false, false, false, false, false, false, false, false, 0, -1, 64, -1), @@ -294,10 +2941,28 @@ public enum OrePrefixes { bit("Bits", "", "", false, false, false, false, false, false, false, false, false, false, 0, -1, 64, -1), shears("Shears", "", "", false, false, false, false, false, false, false, false, false, false, 0, -1, 64, -1), turbine("Turbines", "", "", false, false, false, false, false, false, false, false, false, false, 0, -1, 64, -1), - fertilizer("Fertilizers", "", "", false, false, false, false, false, false, false, false, false, false, 0, -1, 64, -1), + fertilizer( + "Fertilizers", "", "", false, false, false, false, false, false, false, false, false, false, 0, -1, 64, -1), chest("Chests", "", "", false, false, false, false, false, false, false, false, false, false, 0, -1, 64, -1), raw("Raw Things", "", "", false, false, false, false, false, false, false, false, false, false, 0, -1, 64, -1), - stainedGlass("Stained Glasses", "", "", false, false, false, false, false, false, false, false, false, false, 0, -1, 64, -1), + stainedGlass( + "Stained Glasses", + "", + "", + false, + false, + false, + false, + false, + false, + false, + false, + false, + false, + 0, + -1, + 64, + -1), mystic("Mystic Stuff", "", "", false, false, false, false, false, false, false, false, false, false, 0, -1, 64, -1), mana("Mana Stuff", "", "", false, false, false, false, false, false, false, false, false, false, 0, -1, 64, -1), rune("Runes", "", "", false, false, false, false, false, false, false, false, false, false, 0, -1, 64, -1), @@ -306,12 +2971,30 @@ public enum OrePrefixes { powder("Powders", "", "", false, false, false, false, false, false, false, false, false, false, 0, -1, 64, -1), soulsand("Soulsands", "", "", false, false, false, false, false, false, false, false, false, false, 0, -1, 64, -1), obsidian("Obsidians", "", "", false, false, false, false, false, false, false, false, false, false, 0, -1, 64, -1), - glowstone("Glowstones", "", "", false, false, false, false, false, false, false, false, false, false, 0, -1, 64, -1), + glowstone( + "Glowstones", "", "", false, false, false, false, false, false, false, false, false, false, 0, -1, 64, -1), beans("Beans", "", "", false, false, false, false, false, false, false, false, false, false, 0, -1, 64, -1), br("br", "", "", false, false, false, false, false, false, false, false, false, false, 0, -1, 64, -1), essence("Essences", "", "", false, false, false, false, false, false, false, false, false, false, 0, -1, 64, -1), alloy("Alloys", "", "", false, false, false, false, false, false, false, false, false, false, 0, -1, 64, -1), - cooking("Cooked Things", "", "", false, false, false, false, false, false, false, false, false, false, 0, -1, 64, -1), + cooking( + "Cooked Things", + "", + "", + false, + false, + false, + false, + false, + false, + false, + false, + false, + false, + 0, + -1, + 64, + -1), elven("Elven Stuff", "", "", false, false, false, false, false, false, false, false, false, false, 0, -1, 64, -1), reactor("Reactors", "", "", false, false, false, false, false, false, false, false, false, false, 0, -1, 64, -1), mffs("MFFS", "", "", false, false, false, false, false, false, false, false, false, false, 0, -1, 64, -1), @@ -320,26 +3003,185 @@ public enum OrePrefixes { liquid("Liquids", "", "", false, false, false, false, false, false, false, false, false, false, 0, -1, 64, -1), bars("Bars", "", "", false, false, false, false, false, false, false, false, false, false, 0, -1, 64, -1), bar("Bars", "", "", false, false, false, false, false, false, false, false, false, false, 0, -1, 64, -1), - toolHeadMallet("Mallet Heads", "", " Mallet Head", true, true, false, false, false, false, true, true, false, false, B[6], M * 6, 16, 127), // Reverse Head consisting out of 6 Ingots. - handleMallet("Mallet Handle", "", " Handle", true, true, false, false, false, false, true, true, false, false, B[1] | B[2], M / 2, 64, 126), // Reverse Stick made of half an Ingot. Introduced by Eloraam + toolHeadMallet( + "Mallet Heads", + "", + " Mallet Head", + true, + true, + false, + false, + false, + false, + true, + true, + false, + false, + B[6], + M * 6, + 16, + 127), // Reverse Head consisting out of 6 Ingots. + handleMallet( + "Mallet Handle", + "", + " Handle", + true, + true, + false, + false, + false, + false, + true, + true, + false, + false, + B[1] | B[2], + M / 2, + 64, + 126), // Reverse Stick made of half an Ingot. Introduced by Eloraam // Cracked fluids - cellHydroCracked1("Cells", "Lightly Hydro-Cracked ", " Cell", true, true, true, true, false, false, false, true, false, false, 0, M * 1, 64, 30), - cellHydroCracked2("Cells", "Moderately Hydro-Cracked ", " Cell", true, true, true, true, false, false, false, true, false, false, 0, M * 1, 64, 30), - cellHydroCracked3("Cells", "Severely Hydro-Cracked ", " Cell", true, true, true, true, false, false, false, true, false, false, 0, M * 1, 64, 30), - cellSteamCracked1("Cells", "Lightly Steam-Cracked ", " Cell", true, true, true, true, false, false, false, true, false, false, 0, M * 1, 64, 30), - cellSteamCracked2("Cells", "Moderately Steam-Cracked ", " Cell", true, true, true, true, false, false, false, true, false, false, 0, M * 1, 64, 30), - cellSteamCracked3("Cells", "Severely Steam-Cracked ", " Cell", true, true, true, true, false, false, false, true, false, false, 0, M * 1, 64, 30), + cellHydroCracked1( + "Cells", + "Lightly Hydro-Cracked ", + " Cell", + true, + true, + true, + true, + false, + false, + false, + true, + false, + false, + 0, + M * 1, + 64, + 30), + cellHydroCracked2( + "Cells", + "Moderately Hydro-Cracked ", + " Cell", + true, + true, + true, + true, + false, + false, + false, + true, + false, + false, + 0, + M * 1, + 64, + 30), + cellHydroCracked3( + "Cells", + "Severely Hydro-Cracked ", + " Cell", + true, + true, + true, + true, + false, + false, + false, + true, + false, + false, + 0, + M * 1, + 64, + 30), + cellSteamCracked1( + "Cells", + "Lightly Steam-Cracked ", + " Cell", + true, + true, + true, + true, + false, + false, + false, + true, + false, + false, + 0, + M * 1, + 64, + 30), + cellSteamCracked2( + "Cells", + "Moderately Steam-Cracked ", + " Cell", + true, + true, + true, + true, + false, + false, + false, + true, + false, + false, + 0, + M * 1, + 64, + 30), + cellSteamCracked3( + "Cells", + "Severely Steam-Cracked ", + " Cell", + true, + true, + true, + true, + false, + false, + false, + true, + false, + false, + 0, + M * 1, + 64, + 30), - componentCircuit("Circuit Parts", "", "", true, true, false, false, false, false, false, false, false, false, 0, -1, 64, -1), + componentCircuit( + "Circuit Parts", "", "", true, true, false, false, false, false, false, false, false, false, 0, -1, 64, -1), - apiaryUpgrade("Industrial Apiary Upgrade", "", "", false, false, true, false, false, false, false, false, true, false, 0, -1, 64, -1); + apiaryUpgrade( + "Industrial Apiary Upgrade", + "", + "", + false, + false, + true, + false, + false, + false, + false, + false, + true, + false, + 0, + -1, + 64, + -1); - public static final ImmutableList<OrePrefixes> CELL_TYPES = - ImmutableList.of( - cell, cellMolten, cellPlasma, - cellHydroCracked1, cellHydroCracked2, cellHydroCracked3, - cellSteamCracked1, cellSteamCracked2, cellSteamCracked3); + public static final ImmutableList<OrePrefixes> CELL_TYPES = ImmutableList.of( + cell, + cellMolten, + cellPlasma, + cellHydroCracked1, + cellHydroCracked2, + cellHydroCracked3, + cellSteamCracked1, + cellSteamCracked2, + cellSteamCracked3); public static volatile int VERSION = 509; @@ -357,10 +3199,20 @@ public enum OrePrefixes { stoneBricksMossy.mPrefixInto = stoneMossyBricks; ingotHot.mHeatDamage = 3.0F; - cellMolten.mHeatDamage=3; + cellMolten.mHeatDamage = 3; cellPlasma.mHeatDamage = 6.0F; - block.ignoreMaterials(Materials.Ice, Materials.Snow, Materials.Concrete, Materials.Glass, Materials.Glowstone, Materials.DarkIron, Materials.Marble, Materials.Quartz, Materials.CertusQuartz, Materials.Limestone); + block.ignoreMaterials( + Materials.Ice, + Materials.Snow, + Materials.Concrete, + Materials.Glass, + Materials.Glowstone, + Materials.DarkIron, + Materials.Marble, + Materials.Quartz, + Materials.CertusQuartz, + Materials.Limestone); ingot.ignoreMaterials(Materials.Brick, Materials.NetherBrick); dust.addFamiliarPrefix(dustTiny); @@ -376,9 +3228,7 @@ public enum OrePrefixes { for (OrePrefixes tPrefix1 : values()) if (tPrefix1.name().startsWith("ore")) for (OrePrefixes tPrefix2 : values()) - if (tPrefix2.name().startsWith("ore")) - tPrefix1.addFamiliarPrefix(tPrefix2); - + if (tPrefix2.name().startsWith("ore")) tPrefix1.addFamiliarPrefix(tPrefix2); // These are only the important ones. gem.mNotGeneratedItems.add(Materials.Coal); @@ -397,9 +3247,9 @@ public enum OrePrefixes { dust.mNotGeneratedItems.add(Materials.Gunpowder); dust.mNotGeneratedItems.add(Materials.Sugar); dust.mNotGeneratedItems.add(Materials.Blaze); - //dust.mNotGeneratedItems.add(Materials.Ichorium); - //dustSmall.mNotGeneratedItems.add(Materials.Ichorium); - //dustTiny.mNotGeneratedItems.add(Materials.Ichorium); + // dust.mNotGeneratedItems.add(Materials.Ichorium); + // dustSmall.mNotGeneratedItems.add(Materials.Ichorium); + // dustTiny.mNotGeneratedItems.add(Materials.Ichorium); stick.mNotGeneratedItems.add(Materials.Wood); stick.mNotGeneratedItems.add(Materials.Bone); stick.mNotGeneratedItems.add(Materials.Blaze); @@ -409,7 +3259,7 @@ public enum OrePrefixes { ingot.mNotGeneratedItems.add(Materials.BrickNether); ingot.mNotGeneratedItems.add(Materials.WoodSealed); ingot.mNotGeneratedItems.add(Materials.Wood); - //ingot.mNotGeneratedItems.add(Materials.Ichorium); + // ingot.mNotGeneratedItems.add(Materials.Ichorium); nugget.mNotGeneratedItems.add(Materials.Gold); plate.mNotGeneratedItems.add(Materials.Paper); cell.mNotGeneratedItems.add(Materials.Empty); @@ -438,7 +3288,7 @@ public enum OrePrefixes { block.mNotGeneratedItems.add(Materials.Coal); toolHeadArrow.mNotGeneratedItems.add(Materials.Glass); - //----- + // ----- dustImpure.mGeneratedItems.add(Materials.GraniteRed); dustImpure.mGeneratedItems.add(Materials.GraniteBlack); @@ -475,7 +3325,7 @@ public enum OrePrefixes { stickLong.mGeneratedItems.add(Materials.Blaze); - //----- + // ----- dust.mGeneratedItems.addAll(dustPure.mGeneratedItems); dust.mGeneratedItems.addAll(dustImpure.mGeneratedItems); @@ -487,32 +3337,73 @@ public enum OrePrefixes { crateGtGem.mGeneratedItems.addAll(gem.mGeneratedItems); crateGtPlate.mGeneratedItems.addAll(plate.mGeneratedItems); itemCasing.mGeneratedItems.addAll(itemCasing.mGeneratedItems); - //----- + // ----- - toolHeadFile.mCondition = new ICondition.And<ISubTagContainer>(new ICondition.Not<ISubTagContainer>(SubTag.NO_SMASHING), new ICondition.Not<ISubTagContainer>(SubTag.BOUNCY)); - toolHeadSaw.mCondition = new ICondition.And<ISubTagContainer>(new ICondition.Not<ISubTagContainer>(SubTag.NO_SMASHING), new ICondition.Not<ISubTagContainer>(SubTag.BOUNCY)); - toolHeadDrill.mCondition = new ICondition.And<ISubTagContainer>(new ICondition.Not<ISubTagContainer>(SubTag.NO_SMASHING), new ICondition.Not<ISubTagContainer>(SubTag.BOUNCY)); - toolHeadChainsaw.mCondition = new ICondition.And<ISubTagContainer>(new ICondition.Not<ISubTagContainer>(SubTag.NO_SMASHING), new ICondition.Not<ISubTagContainer>(SubTag.BOUNCY)); - toolHeadWrench.mCondition = new ICondition.And<ISubTagContainer>(new ICondition.Not<ISubTagContainer>(SubTag.NO_SMASHING), new ICondition.Not<ISubTagContainer>(SubTag.BOUNCY)); - toolHeadBuzzSaw.mCondition = new ICondition.And<ISubTagContainer>(new ICondition.Not<ISubTagContainer>(SubTag.NO_SMASHING), new ICondition.Not<ISubTagContainer>(SubTag.BOUNCY)); - turbineBlade.mCondition = new ICondition.And<ISubTagContainer>(new ICondition.Not<ISubTagContainer>(SubTag.NO_SMASHING), new ICondition.Not<ISubTagContainer>(SubTag.BOUNCY)); + toolHeadFile.mCondition = new ICondition.And<ISubTagContainer>( + new ICondition.Not<ISubTagContainer>(SubTag.NO_SMASHING), + new ICondition.Not<ISubTagContainer>(SubTag.BOUNCY)); + toolHeadSaw.mCondition = new ICondition.And<ISubTagContainer>( + new ICondition.Not<ISubTagContainer>(SubTag.NO_SMASHING), + new ICondition.Not<ISubTagContainer>(SubTag.BOUNCY)); + toolHeadDrill.mCondition = new ICondition.And<ISubTagContainer>( + new ICondition.Not<ISubTagContainer>(SubTag.NO_SMASHING), + new ICondition.Not<ISubTagContainer>(SubTag.BOUNCY)); + toolHeadChainsaw.mCondition = new ICondition.And<ISubTagContainer>( + new ICondition.Not<ISubTagContainer>(SubTag.NO_SMASHING), + new ICondition.Not<ISubTagContainer>(SubTag.BOUNCY)); + toolHeadWrench.mCondition = new ICondition.And<ISubTagContainer>( + new ICondition.Not<ISubTagContainer>(SubTag.NO_SMASHING), + new ICondition.Not<ISubTagContainer>(SubTag.BOUNCY)); + toolHeadBuzzSaw.mCondition = new ICondition.And<ISubTagContainer>( + new ICondition.Not<ISubTagContainer>(SubTag.NO_SMASHING), + new ICondition.Not<ISubTagContainer>(SubTag.BOUNCY)); + turbineBlade.mCondition = new ICondition.And<ISubTagContainer>( + new ICondition.Not<ISubTagContainer>(SubTag.NO_SMASHING), + new ICondition.Not<ISubTagContainer>(SubTag.BOUNCY)); rotor.mCondition = new ICondition.Nor<ISubTagContainer>(SubTag.CRYSTAL, SubTag.STONE, SubTag.BOUNCY); - spring.mCondition = new ICondition.Or<ISubTagContainer>(SubTag.STRETCHY, SubTag.BOUNCY, new ICondition.Not<ISubTagContainer>(SubTag.NO_SMASHING)); - springSmall.mCondition = new ICondition.Or<ISubTagContainer>(SubTag.STRETCHY, SubTag.BOUNCY, new ICondition.Not<ISubTagContainer>(SubTag.NO_SMASHING)); + spring.mCondition = new ICondition.Or<ISubTagContainer>( + SubTag.STRETCHY, SubTag.BOUNCY, new ICondition.Not<ISubTagContainer>(SubTag.NO_SMASHING)); + springSmall.mCondition = new ICondition.Or<ISubTagContainer>( + SubTag.STRETCHY, SubTag.BOUNCY, new ICondition.Not<ISubTagContainer>(SubTag.NO_SMASHING)); - gemChipped.mCondition = new ICondition.And<ISubTagContainer>(SubTag.TRANSPARENT, SubTag.CRYSTAL, new ICondition.Not<ISubTagContainer>(SubTag.QUARTZ), new ICondition.Not<ISubTagContainer>(SubTag.PEARL), new ICondition.Not<ISubTagContainer>(SubTag.MAGICAL)); - gemFlawed.mCondition = new ICondition.And<ISubTagContainer>(SubTag.TRANSPARENT, SubTag.CRYSTAL, new ICondition.Not<ISubTagContainer>(SubTag.QUARTZ), new ICondition.Not<ISubTagContainer>(SubTag.PEARL), new ICondition.Not<ISubTagContainer>(SubTag.MAGICAL)); - gemFlawless.mCondition = new ICondition.And<ISubTagContainer>(SubTag.TRANSPARENT, SubTag.CRYSTAL, new ICondition.Not<ISubTagContainer>(SubTag.QUARTZ), new ICondition.Not<ISubTagContainer>(SubTag.PEARL), new ICondition.Not<ISubTagContainer>(SubTag.MAGICAL)); - gemExquisite.mCondition = new ICondition.And<ISubTagContainer>(SubTag.TRANSPARENT, SubTag.CRYSTAL, new ICondition.Not<ISubTagContainer>(SubTag.QUARTZ), new ICondition.Not<ISubTagContainer>(SubTag.PEARL), new ICondition.Not<ISubTagContainer>(SubTag.MAGICAL)); + gemChipped.mCondition = new ICondition.And<ISubTagContainer>( + SubTag.TRANSPARENT, + SubTag.CRYSTAL, + new ICondition.Not<ISubTagContainer>(SubTag.QUARTZ), + new ICondition.Not<ISubTagContainer>(SubTag.PEARL), + new ICondition.Not<ISubTagContainer>(SubTag.MAGICAL)); + gemFlawed.mCondition = new ICondition.And<ISubTagContainer>( + SubTag.TRANSPARENT, + SubTag.CRYSTAL, + new ICondition.Not<ISubTagContainer>(SubTag.QUARTZ), + new ICondition.Not<ISubTagContainer>(SubTag.PEARL), + new ICondition.Not<ISubTagContainer>(SubTag.MAGICAL)); + gemFlawless.mCondition = new ICondition.And<ISubTagContainer>( + SubTag.TRANSPARENT, + SubTag.CRYSTAL, + new ICondition.Not<ISubTagContainer>(SubTag.QUARTZ), + new ICondition.Not<ISubTagContainer>(SubTag.PEARL), + new ICondition.Not<ISubTagContainer>(SubTag.MAGICAL)); + gemExquisite.mCondition = new ICondition.And<ISubTagContainer>( + SubTag.TRANSPARENT, + SubTag.CRYSTAL, + new ICondition.Not<ISubTagContainer>(SubTag.QUARTZ), + new ICondition.Not<ISubTagContainer>(SubTag.PEARL), + new ICondition.Not<ISubTagContainer>(SubTag.MAGICAL)); - lens.mCondition = new ICondition.Or<ISubTagContainer>(SubTag.MAGICAL, new ICondition.And<ISubTagContainer>(SubTag.TRANSPARENT, SubTag.HAS_COLOR)); + lens.mCondition = new ICondition.Or<ISubTagContainer>( + SubTag.MAGICAL, new ICondition.And<ISubTagContainer>(SubTag.TRANSPARENT, SubTag.HAS_COLOR)); - plateDouble.mCondition = new ICondition.Or<ISubTagContainer>(SubTag.PAPER, new ICondition.Not<ISubTagContainer>(SubTag.NO_SMASHING)); - plateTriple.mCondition = new ICondition.Or<ISubTagContainer>(SubTag.PAPER, new ICondition.Not<ISubTagContainer>(SubTag.NO_SMASHING)); - plateQuadruple.mCondition = new ICondition.Or<ISubTagContainer>(SubTag.PAPER, new ICondition.Not<ISubTagContainer>(SubTag.NO_SMASHING)); - plateQuintuple.mCondition = new ICondition.Or<ISubTagContainer>(SubTag.PAPER, new ICondition.Not<ISubTagContainer>(SubTag.NO_SMASHING)); + plateDouble.mCondition = new ICondition.Or<ISubTagContainer>( + SubTag.PAPER, new ICondition.Not<ISubTagContainer>(SubTag.NO_SMASHING)); + plateTriple.mCondition = new ICondition.Or<ISubTagContainer>( + SubTag.PAPER, new ICondition.Not<ISubTagContainer>(SubTag.NO_SMASHING)); + plateQuadruple.mCondition = new ICondition.Or<ISubTagContainer>( + SubTag.PAPER, new ICondition.Not<ISubTagContainer>(SubTag.NO_SMASHING)); + plateQuintuple.mCondition = new ICondition.Or<ISubTagContainer>( + SubTag.PAPER, new ICondition.Not<ISubTagContainer>(SubTag.NO_SMASHING)); plateDense.mCondition = new ICondition.Not<ISubTagContainer>(SubTag.NO_SMASHING); @@ -523,7 +3414,7 @@ public enum OrePrefixes { wireFine.mCondition = SubTag.METAL; - //----- + // ----- pipeRestrictiveTiny.mSecondaryMaterial = new MaterialStack(Materials.Steel, ring.mMaterialAmount); pipeRestrictiveSmall.mSecondaryMaterial = new MaterialStack(Materials.Steel, ring.mMaterialAmount * 2); @@ -538,7 +3429,8 @@ public enum OrePrefixes { cableGt01.mSecondaryMaterial = new MaterialStack(Materials.Rubber, plate.mMaterialAmount); bucket.mSecondaryMaterial = new MaterialStack(Materials.Iron, ingot.mMaterialAmount * 3); bucketClay.mSecondaryMaterial = new MaterialStack(Materials.Clay, dust.mMaterialAmount * 5); - CELL_TYPES.forEach(prefix -> prefix.mSecondaryMaterial = new MaterialStack(Materials.Tin, plate.mMaterialAmount * 2)); + CELL_TYPES.forEach( + prefix -> prefix.mSecondaryMaterial = new MaterialStack(Materials.Tin, plate.mMaterialAmount * 2)); oreRedgranite.mSecondaryMaterial = new MaterialStack(Materials.GraniteRed, dust.mMaterialAmount); oreBlackgranite.mSecondaryMaterial = new MaterialStack(Materials.GraniteBlack, dust.mMaterialAmount); oreNetherrack.mSecondaryMaterial = new MaterialStack(Materials.Netherrack, dust.mMaterialAmount); @@ -555,8 +3447,10 @@ public enum OrePrefixes { ore.mSecondaryMaterial = new MaterialStack(Materials.Stone, dust.mMaterialAmount); crushed.mSecondaryMaterial = new MaterialStack(Materials.Stone, dust.mMaterialAmount); toolHeadDrill.mSecondaryMaterial = new MaterialStack(Materials.Steel, plate.mMaterialAmount * 4); - toolHeadChainsaw.mSecondaryMaterial = new MaterialStack(Materials.Steel, plate.mMaterialAmount * 4 + ring.mMaterialAmount * 2); - toolHeadWrench.mSecondaryMaterial = new MaterialStack(Materials.Steel, ring.mMaterialAmount + screw.mMaterialAmount * 2); + toolHeadChainsaw.mSecondaryMaterial = + new MaterialStack(Materials.Steel, plate.mMaterialAmount * 4 + ring.mMaterialAmount * 2); + toolHeadWrench.mSecondaryMaterial = + new MaterialStack(Materials.Steel, ring.mMaterialAmount + screw.mMaterialAmount * 2); arrowGtWood.mSecondaryMaterial = new MaterialStack(Materials.Wood, stick.mMaterialAmount); arrowGtPlastic.mSecondaryMaterial = new MaterialStack(Materials.Plastic, stick.mMaterialAmount); bulletGtSmall.mSecondaryMaterial = new MaterialStack(Materials.Brass, ingot.mMaterialAmount / 9); @@ -567,7 +3461,16 @@ public enum OrePrefixes { public final ArrayList<ItemStack> mPrefixedItems = new GT_ArrayList<>(false, 16); public final short mTextureIndex; public final String mRegularLocalName, mLocalizedMaterialPre, mLocalizedMaterialPost; - public final boolean mIsUsedForOreProcessing, mIsEnchantable, mIsUnificatable, mIsMaterialBased, mIsSelfReferencing, mIsContainer, mDontUnificateActively, mIsUsedForBlocks, mAllowNormalRecycling, mGenerateDefaultItem; + public final boolean mIsUsedForOreProcessing, + mIsEnchantable, + mIsUnificatable, + mIsMaterialBased, + mIsSelfReferencing, + mIsContainer, + mDontUnificateActively, + mIsUsedForBlocks, + mAllowNormalRecycling, + mGenerateDefaultItem; public final List<TC_AspectStack> mAspects = new ArrayList<TC_AspectStack>(); public final Collection<OrePrefixes> mFamiliarPrefixes = new HashSet<OrePrefixes>(); /** @@ -577,7 +3480,11 @@ public enum OrePrefixes { * Negative = Undefined Amount */ public final long mMaterialAmount; - public final Collection<Materials> mDisabledItems = new HashSet<Materials>(), mNotGeneratedItems = new HashSet<Materials>(), mIgnoredMaterials = new HashSet<Materials>(), mGeneratedItems = new HashSet<Materials>(); + + public final Collection<Materials> mDisabledItems = new HashSet<Materials>(), + mNotGeneratedItems = new HashSet<Materials>(), + mIgnoredMaterials = new HashSet<Materials>(), + mGeneratedItems = new HashSet<Materials>(); private final ArrayList<IOreRecipeRegistrator> mOreProcessing = new ArrayList<IOreRecipeRegistrator>(); public ItemStack mContainerItem = null; public ICondition<ISubTagContainer> mCondition = null; @@ -586,13 +3493,83 @@ public enum OrePrefixes { public OrePrefixes mPrefixInto = this; public float mHeatDamage = 0.0F; // Negative for Frost Damage private final GT_HashSet<GT_ItemStack2> mContainsTestCache = new GT_HashSet<>(512, 0.5f); - public static List<OrePrefixes> mPreventableComponents = new LinkedList<>(Arrays.asList(OrePrefixes.gem, OrePrefixes.ingotHot, OrePrefixes.ingotDouble, OrePrefixes.ingotTriple, OrePrefixes.ingotQuadruple, OrePrefixes.ingotQuintuple, OrePrefixes.plate, OrePrefixes.plateDouble, OrePrefixes.plateTriple, OrePrefixes.plateQuadruple, OrePrefixes.plateQuintuple, OrePrefixes.plateDense, OrePrefixes.stick, OrePrefixes.round, OrePrefixes.bolt, OrePrefixes.screw, OrePrefixes.ring, OrePrefixes.foil, OrePrefixes.toolHeadSword, OrePrefixes.toolHeadPickaxe, OrePrefixes.toolHeadShovel, OrePrefixes.toolHeadAxe, OrePrefixes.toolHeadHoe, OrePrefixes.toolHeadHammer, OrePrefixes.toolHeadFile, OrePrefixes.toolHeadSaw, OrePrefixes.toolHeadDrill, OrePrefixes.toolHeadChainsaw, OrePrefixes.toolHeadWrench, OrePrefixes.toolHeadUniversalSpade, OrePrefixes.toolHeadSense, OrePrefixes.toolHeadPlow, OrePrefixes.toolHeadArrow, OrePrefixes.toolHeadBuzzSaw, OrePrefixes.turbineBlade, OrePrefixes.wireFine, OrePrefixes.gearGtSmall, OrePrefixes.rotor, OrePrefixes.stickLong, OrePrefixes.springSmall, OrePrefixes.spring, OrePrefixes.arrowGtWood, OrePrefixes.arrowGtPlastic, OrePrefixes.gemChipped, OrePrefixes.gemFlawed, OrePrefixes.gemFlawless, OrePrefixes.gemExquisite, OrePrefixes.gearGt, OrePrefixes.crateGtDust, OrePrefixes.crateGtIngot, OrePrefixes.crateGtGem, OrePrefixes.crateGtPlate, OrePrefixes.itemCasing)); + public static List<OrePrefixes> mPreventableComponents = new LinkedList<>(Arrays.asList( + OrePrefixes.gem, + OrePrefixes.ingotHot, + OrePrefixes.ingotDouble, + OrePrefixes.ingotTriple, + OrePrefixes.ingotQuadruple, + OrePrefixes.ingotQuintuple, + OrePrefixes.plate, + OrePrefixes.plateDouble, + OrePrefixes.plateTriple, + OrePrefixes.plateQuadruple, + OrePrefixes.plateQuintuple, + OrePrefixes.plateDense, + OrePrefixes.stick, + OrePrefixes.round, + OrePrefixes.bolt, + OrePrefixes.screw, + OrePrefixes.ring, + OrePrefixes.foil, + OrePrefixes.toolHeadSword, + OrePrefixes.toolHeadPickaxe, + OrePrefixes.toolHeadShovel, + OrePrefixes.toolHeadAxe, + OrePrefixes.toolHeadHoe, + OrePrefixes.toolHeadHammer, + OrePrefixes.toolHeadFile, + OrePrefixes.toolHeadSaw, + OrePrefixes.toolHeadDrill, + OrePrefixes.toolHeadChainsaw, + OrePrefixes.toolHeadWrench, + OrePrefixes.toolHeadUniversalSpade, + OrePrefixes.toolHeadSense, + OrePrefixes.toolHeadPlow, + OrePrefixes.toolHeadArrow, + OrePrefixes.toolHeadBuzzSaw, + OrePrefixes.turbineBlade, + OrePrefixes.wireFine, + OrePrefixes.gearGtSmall, + OrePrefixes.rotor, + OrePrefixes.stickLong, + OrePrefixes.springSmall, + OrePrefixes.spring, + OrePrefixes.arrowGtWood, + OrePrefixes.arrowGtPlastic, + OrePrefixes.gemChipped, + OrePrefixes.gemFlawed, + OrePrefixes.gemFlawless, + OrePrefixes.gemExquisite, + OrePrefixes.gearGt, + OrePrefixes.crateGtDust, + OrePrefixes.crateGtIngot, + OrePrefixes.crateGtGem, + OrePrefixes.crateGtPlate, + OrePrefixes.itemCasing)); /** * Yes this Value can be changed to add Bits for the MetaGenerated-Item-Check. */ public int mMaterialGenerationBits = 0; - OrePrefixes(String aRegularLocalName, String aLocalizedMaterialPre, String aLocalizedMaterialPost, boolean aIsUnificatable, boolean aIsMaterialBased, boolean aIsSelfReferencing, boolean aIsContainer, boolean aDontUnificateActively, boolean aIsUsedForBlocks, boolean aAllowNormalRecycling, boolean aGenerateDefaultItem, boolean aIsEnchantable, boolean aIsUsedForOreProcessing, int aMaterialGenerationBits, long aMaterialAmount, int aDefaultStackSize, int aTextureindex) { + OrePrefixes( + String aRegularLocalName, + String aLocalizedMaterialPre, + String aLocalizedMaterialPost, + boolean aIsUnificatable, + boolean aIsMaterialBased, + boolean aIsSelfReferencing, + boolean aIsContainer, + boolean aDontUnificateActively, + boolean aIsUsedForBlocks, + boolean aAllowNormalRecycling, + boolean aGenerateDefaultItem, + boolean aIsEnchantable, + boolean aIsUsedForOreProcessing, + int aMaterialGenerationBits, + long aMaterialAmount, + int aDefaultStackSize, + int aTextureindex) { mIsUnificatable = aIsUnificatable; mIsMaterialBased = aIsMaterialBased; mIsSelfReferencing = aIsSelfReferencing; @@ -649,46 +3626,80 @@ 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? - //TODO Make sure stuff like gem plates / standard plates / paper plates all generate with the current condition + // TODO possibly use OrePrefix mNotGeneratedItems/mGeneratedItems instead of a static List for every material + // instance? + // TODO Make sure stuff like gem plates / standard plates / paper plates all generate with the current condition for (Materials aMaterial : Materials.values()) { if (aMaterial.mMetaItemSubID > 0) { - if (aMaterial.mBlastFurnaceTemp <= 1750) ingotHot.mDisabledItems.add(aMaterial); //Moved HotIngot code from GT_MetaGenerated_Item_01 so all this is in once place + if (aMaterial.mBlastFurnaceTemp <= 1750) + ingotHot.mDisabledItems.add( + aMaterial); // Moved HotIngot code from GT_MetaGenerated_Item_01 so all this is in once + // place if (!enableUnusedSprings && (aMaterial != Materials.Titanium)) spring.mDisabledItems.add(aMaterial); if (!enableUnusedSmallSprings) springSmall.mDisabledItems.add(aMaterial); - if (!enableUnusedRounds && !(aMaterial == Materials.HSSE || aMaterial == Materials.Neutronium || aMaterial == Materials.HSSG)) round.mDisabledItems.add(aMaterial); + if (!enableUnusedRounds + && !(aMaterial == Materials.HSSE + || aMaterial == Materials.Neutronium + || aMaterial == Materials.HSSG)) round.mDisabledItems.add(aMaterial); if (!enableUnusedCrates) { - if (!(aMaterial == Materials.DamascusSteel || aMaterial == Materials.Steel || aMaterial == Materials.Bronze || aMaterial == Materials.Manganese)) - crateGtIngot.mDisabledItems.add(aMaterial); + if (!(aMaterial == Materials.DamascusSteel + || aMaterial == Materials.Steel + || aMaterial == Materials.Bronze + || aMaterial == Materials.Manganese)) crateGtIngot.mDisabledItems.add(aMaterial); if (!(aMaterial == Materials.Neodymium || aMaterial == Materials.Chrome)) crateGtDust.mDisabledItems.add(aMaterial); crateGtGem.mDisabledItems.add(aMaterial); @@ -700,98 +3711,283 @@ public enum OrePrefixes { if (!(aMaterial == Materials.DamascusSteel || aMaterial == Materials.SterlingSilver)) arrowGtWood.mDisabledItems.add(aMaterial); } - //Plates - if (!enableUnusedPlates && ((aMaterial.mTypes & 0x40) == 0) && !(aMaterial == Materials.Silicon || aMaterial == Materials.Zinc || - aMaterial == Materials.Europium || aMaterial == Materials.Americium || aMaterial == Materials.RedAlloy || aMaterial == Materials.SolderingAlloy || aMaterial == Materials.BatteryAlloy || - aMaterial == Materials.AnnealedCopper || aMaterial == Materials.Firestone || aMaterial == Materials.VanadiumGallium || aMaterial == Materials.YttriumBariumCuprate || - aMaterial == Materials.NiobiumTitanium || aMaterial == Materials.CertusQuartz || aMaterial == Materials.NetherQuartz || aMaterial == Materials.Lazurite || aMaterial == Materials.Lapis || - aMaterial == Materials.Paper || aMaterial == Materials.Jasper || aMaterial == Materials.Dilithium || aMaterial == Materials.Forcicium || aMaterial == Materials.Forcillium || - aMaterial == Materials.EnderPearl || aMaterial == Materials.EnderEye || aMaterial == Materials.Glass || aMaterial == Materials.Copper || aMaterial == Materials.Tin || aMaterial == Materials.Redstone || - aMaterial == Materials.Sodalite || aMaterial == Materials.Gallium || aMaterial == Materials.GalliumArsenide || aMaterial == Materials.IndiumGalliumPhosphide)) - plate.mDisabledItems.add(aMaterial); + // Plates + if (!enableUnusedPlates + && ((aMaterial.mTypes & 0x40) == 0) + && !(aMaterial == Materials.Silicon + || aMaterial == Materials.Zinc + || aMaterial == Materials.Europium + || aMaterial == Materials.Americium + || aMaterial == Materials.RedAlloy + || aMaterial == Materials.SolderingAlloy + || aMaterial == Materials.BatteryAlloy + || aMaterial == Materials.AnnealedCopper + || aMaterial == Materials.Firestone + || aMaterial == Materials.VanadiumGallium + || aMaterial == Materials.YttriumBariumCuprate + || aMaterial == Materials.NiobiumTitanium + || aMaterial == Materials.CertusQuartz + || aMaterial == Materials.NetherQuartz + || aMaterial == Materials.Lazurite + || aMaterial == Materials.Lapis + || aMaterial == Materials.Paper + || aMaterial == Materials.Jasper + || aMaterial == Materials.Dilithium + || aMaterial == Materials.Forcicium + || aMaterial == Materials.Forcillium + || aMaterial == Materials.EnderPearl + || aMaterial == Materials.EnderEye + || aMaterial == Materials.Glass + || aMaterial == Materials.Copper + || aMaterial == Materials.Tin + || aMaterial == Materials.Redstone + || aMaterial == Materials.Sodalite + || aMaterial == Materials.Gallium + || aMaterial == Materials.GalliumArsenide + || aMaterial == Materials.IndiumGalliumPhosphide)) plate.mDisabledItems.add(aMaterial); if (!enableUnusedIngotHot) { ingotHot.mDisabledItems.add(aMaterial); } - //Ingot/Plate Storage + // Ingot/Plate Storage if (!enableUnusedDoubleIngots) ingotDouble.mDisabledItems.add(aMaterial); if (!enableUnusedTripleIngots) ingotTriple.mDisabledItems.add(aMaterial); if (!enableUnusedQuadIngots) ingotQuadruple.mDisabledItems.add(aMaterial); if (!enableUnusedQuinIngots) ingotQuintuple.mDisabledItems.add(aMaterial); - if (!enableUnusedDoublePlates && ((aMaterial.mTypes & 0x40) == 0) && !(aMaterial == Materials.Paper || aMaterial == Materials.Aluminium || aMaterial == Materials.Steel || aMaterial == Materials.TungstenSteel)) - plateDouble.mDisabledItems.add(aMaterial); - if (!enableUnusedTriplePlates && !(aMaterial == Materials.Paper)) plateTriple.mDisabledItems.add(aMaterial); - if (!enableUnusedQuadPlates && !(aMaterial == Materials.Paper)) plateQuadruple.mDisabledItems.add(aMaterial); - if (!enableUnusedQuinPlates && !(aMaterial == Materials.Paper)) plateQuintuple.mDisabledItems.add(aMaterial); - if (!(enableUnusedDensePlates || GregTech_API.mGTPlusPlus) && !(aMaterial == Materials.Iron || aMaterial == Materials.Copper || aMaterial == Materials.Lead || aMaterial == Materials.Paper || aMaterial == Materials.Thaumium || aMaterial == Materials.Titanium)) - plateDense.mDisabledItems.add(aMaterial); - //Rotors - if (!enableUnusedRotors && !(aMaterial == Materials.Titanium || aMaterial == Materials.Chrome || aMaterial == Materials.Tin || aMaterial == Materials.Osmium || - aMaterial == Materials.Iridium || aMaterial == Materials.Bronze || aMaterial == Materials.Steel || aMaterial == Materials.StainlessSteel || - aMaterial == Materials.TungstenSteel || aMaterial == Materials.HSSG || aMaterial == Materials.HSSE || aMaterial == Materials.Neutronium)) - rotor.mDisabledItems.add(aMaterial); - //Rings - if (!enableUnusedRings && !(aMaterial == Materials.Titanium || aMaterial == Materials.Chrome || aMaterial == Materials.Iron || aMaterial == Materials.Tin || - aMaterial == Materials.Osmium || aMaterial == Materials.Iridium || aMaterial == Materials.Bronze || aMaterial == Materials.WroughtIron || - aMaterial == Materials.Steel || aMaterial == Materials.StainlessSteel || aMaterial == Materials.PigIron || aMaterial == Materials.TungstenSteel || - aMaterial == Materials.Rubber || aMaterial == Materials.HSSE || aMaterial == Materials.Neutronium || aMaterial == Materials.HSSG || aMaterial == Materials.Aluminium || - aMaterial == Materials.Invar || aMaterial == Materials.Brass || aMaterial == Materials.Paper || aMaterial == Materials.Silicone || aMaterial == Materials.StyreneButadieneRubber)) - ring.mDisabledItems.add(aMaterial); - //Foil - if (!enableUnusedFoil && !(aMaterial == Materials.Zinc || aMaterial == Materials.Aluminium || aMaterial == Materials.Silicon || aMaterial == Materials.Gold || - aMaterial == Materials.Electrum || aMaterial == Materials.Platinum || aMaterial == Materials.Osmiridium || aMaterial == Materials.Osmium || - aMaterial == Materials.AnnealedCopper || aMaterial == Materials.Steel || aMaterial == Materials.Copper || aMaterial == Materials.YttriumBariumCuprate - || aMaterial == Materials.VanadiumGallium || aMaterial == Materials.NiobiumTitanium || aMaterial == Materials.Naquadah || aMaterial == Materials.Manganese || - aMaterial == Materials.Plastic || aMaterial == Materials.Silicone || aMaterial == Materials.PolyvinylChloride || aMaterial == Materials.PolyphenyleneSulfide || - aMaterial == Materials.Nichrome || aMaterial == Materials.BlackSteel || aMaterial == Materials.Titanium || aMaterial == Materials.TungstenSteel || - aMaterial == Materials.Tungsten || aMaterial == Materials.HSSG || aMaterial == Materials.NaquadahAlloy || aMaterial == Materials.Duranium || - aMaterial == Materials.Europium || aMaterial == Materials.Bedrockium)) - - foil.mDisabledItems.add(aMaterial); - //Fine Wire - if (!enableUnusedFineWires && !(aMaterial == Materials.Steel || aMaterial == Materials.AnnealedCopper || aMaterial == Materials.Platinum || aMaterial == Materials.Osmium || - aMaterial == Materials.Tin || aMaterial == Materials.Lead || aMaterial == Materials.SolderingAlloy || aMaterial == Materials.Copper || aMaterial == Materials.Electrum || - aMaterial == Materials.Gold || aMaterial == Materials.RedAlloy || aMaterial == Materials.Graphene || aMaterial == Materials.NiobiumTitanium || aMaterial == Materials.YttriumBariumCuprate || aMaterial == Materials.BloodInfusedIron)) - wireFine.mDisabledItems.add(aMaterial); - //Gears - if (!enableUnusedGears && !(aMaterial == Materials.Aluminium || aMaterial == Materials.Titanium || aMaterial == Materials.Iron || aMaterial == Materials.Copper || - aMaterial == Materials.Tin || aMaterial == Materials.Gold || aMaterial == Materials.Stone || aMaterial == Materials.Bronze || - aMaterial == Materials.Steel || aMaterial == Materials.StainlessSteel || aMaterial == Materials.TungstenSteel || aMaterial == Materials.CobaltBrass || - aMaterial == Materials.Diamond || aMaterial == Materials.Wood || aMaterial == Materials.HSSG || aMaterial == Materials.HSSE || aMaterial == Materials.Neutronium)) - gearGt.mDisabledItems.add(aMaterial); - //Small Gears - if (!enableUnusedSmallGears && !(aMaterial == Materials.Aluminium || aMaterial == Materials.Titanium || aMaterial == Materials.Steel || aMaterial == Materials.StainlessSteel || - aMaterial == Materials.TungstenSteel || aMaterial == Materials.HSSG || aMaterial == Materials.HSSE || aMaterial == Materials.Neutronium || aMaterial == Materials.VanadiumGallium || aMaterial == Materials.Naquadah)) - gearGtSmall.mDisabledItems.add(aMaterial); - //Bolts - if (!enableUnusedBolts && ((aMaterial.mTypes & 0x40) == 0) && !(aMaterial == Materials.Titanium || aMaterial == Materials.Chrome || aMaterial == Materials.Iron || - aMaterial == Materials.Tin || aMaterial == Materials.Osmium || aMaterial == Materials.Iridium || aMaterial == Materials.Neutronium || - aMaterial == Materials.Bronze || aMaterial == Materials.WroughtIron || aMaterial == Materials.Steel || aMaterial == Materials.StainlessSteel || - aMaterial == Materials.PigIron || aMaterial == Materials.TungstenSteel || aMaterial == Materials.Tungsten || aMaterial == Materials.HSSE || aMaterial == Materials.HSSG)) - bolt.mDisabledItems.add(aMaterial); - //Screws - if (!enableUnusedScrews && ((aMaterial.mTypes & 0x40) == 0) && !(aMaterial == Materials.Titanium || aMaterial == Materials.Chrome || aMaterial == Materials.Iron || - aMaterial == Materials.Tin || aMaterial == Materials.Osmium || aMaterial == Materials.Iridium || aMaterial == Materials.Neutronium || - aMaterial == Materials.Bronze || aMaterial == Materials.WroughtIron || aMaterial == Materials.Steel || aMaterial == Materials.StainlessSteel || - aMaterial == Materials.PigIron || aMaterial == Materials.TungstenSteel || aMaterial == Materials.HSSE || aMaterial == Materials.HSSG)) - screw.mDisabledItems.add(aMaterial); - //Rods - if (!enableUnusedRods && ((aMaterial.mTypes & 0x40) == 0) && !(aMaterial == Materials.Titanium || aMaterial == Materials.Chrome || aMaterial == Materials.Iron || - aMaterial == Materials.Tin || aMaterial == Materials.Osmium || aMaterial == Materials.Iridium || aMaterial == Materials.Neutronium || - aMaterial == Materials.Bronze || aMaterial == Materials.WroughtIron || aMaterial == Materials.Steel || aMaterial == Materials.StainlessSteel || - aMaterial == Materials.PigIron || aMaterial == Materials.TungstenSteel || aMaterial == Materials.HSSE || aMaterial == Materials.HSSG || - aMaterial == Materials.Aluminium || aMaterial == Materials.Copper || aMaterial == Materials.Neodymium || aMaterial == Materials.Europium || - aMaterial == Materials.Platinum || aMaterial == Materials.Gold || aMaterial == Materials.Uranium235 || aMaterial == Materials.Plutonium241 || - aMaterial == Materials.Americium || aMaterial == Materials.Neutronium || aMaterial == Materials.Bronze || aMaterial == Materials.Brass || - aMaterial == Materials.Electrum || aMaterial == Materials.NaquadahEnriched || aMaterial == Materials.CobaltBrass || aMaterial == Materials.IronMagnetic || - aMaterial == Materials.SteelMagnetic || aMaterial == Materials.NeodymiumMagnetic || aMaterial == Materials.Samarium || aMaterial == Materials.SamariumMagnetic || aMaterial == Materials.VanadiumGallium || aMaterial == Materials.Diamond || - aMaterial == Materials.Wood || aMaterial == Materials.Plastic || aMaterial == Materials.Lead || aMaterial == Materials.SolderingAlloy || aMaterial == Materials.Lapis || - aMaterial == Materials.Lazurite || aMaterial == Materials.Sodalite|| aMaterial == Materials.PolyvinylChloride)) - stick.mDisabledItems.add(aMaterial); - //Long Rods - if (!enableUnusedLongRods && ((aMaterial.mTypes & 0x40) == 0) && !(aMaterial == Materials.Titanium || aMaterial == Materials.NeodymiumMagnetic || aMaterial == Materials.SamariumMagnetic || aMaterial == Materials.HSSG || aMaterial == Materials.HSSE || - aMaterial == Materials.Neutronium || aMaterial == Materials.Americium || aMaterial == Materials.WroughtIron || aMaterial == Materials.Magnalium || - aMaterial == Materials.TungstenSteel)) - stickLong.mDisabledItems.add(aMaterial); + if (!enableUnusedDoublePlates + && ((aMaterial.mTypes & 0x40) == 0) + && !(aMaterial == Materials.Paper + || aMaterial == Materials.Aluminium + || aMaterial == Materials.Steel + || aMaterial == Materials.TungstenSteel)) plateDouble.mDisabledItems.add(aMaterial); + if (!enableUnusedTriplePlates && !(aMaterial == Materials.Paper)) + plateTriple.mDisabledItems.add(aMaterial); + if (!enableUnusedQuadPlates && !(aMaterial == Materials.Paper)) + plateQuadruple.mDisabledItems.add(aMaterial); + if (!enableUnusedQuinPlates && !(aMaterial == Materials.Paper)) + plateQuintuple.mDisabledItems.add(aMaterial); + if (!(enableUnusedDensePlates || GregTech_API.mGTPlusPlus) + && !(aMaterial == Materials.Iron + || aMaterial == Materials.Copper + || aMaterial == Materials.Lead + || aMaterial == Materials.Paper + || aMaterial == Materials.Thaumium + || aMaterial == Materials.Titanium)) plateDense.mDisabledItems.add(aMaterial); + // Rotors + if (!enableUnusedRotors + && !(aMaterial == Materials.Titanium + || aMaterial == Materials.Chrome + || aMaterial == Materials.Tin + || aMaterial == Materials.Osmium + || aMaterial == Materials.Iridium + || aMaterial == Materials.Bronze + || aMaterial == Materials.Steel + || aMaterial == Materials.StainlessSteel + || aMaterial == Materials.TungstenSteel + || aMaterial == Materials.HSSG + || aMaterial == Materials.HSSE + || aMaterial == Materials.Neutronium)) rotor.mDisabledItems.add(aMaterial); + // Rings + if (!enableUnusedRings + && !(aMaterial == Materials.Titanium + || aMaterial == Materials.Chrome + || aMaterial == Materials.Iron + || aMaterial == Materials.Tin + || aMaterial == Materials.Osmium + || aMaterial == Materials.Iridium + || aMaterial == Materials.Bronze + || aMaterial == Materials.WroughtIron + || aMaterial == Materials.Steel + || aMaterial == Materials.StainlessSteel + || aMaterial == Materials.PigIron + || aMaterial == Materials.TungstenSteel + || aMaterial == Materials.Rubber + || aMaterial == Materials.HSSE + || aMaterial == Materials.Neutronium + || aMaterial == Materials.HSSG + || aMaterial == Materials.Aluminium + || aMaterial == Materials.Invar + || aMaterial == Materials.Brass + || aMaterial == Materials.Paper + || aMaterial == Materials.Silicone + || aMaterial == Materials.StyreneButadieneRubber)) ring.mDisabledItems.add(aMaterial); + // Foil + if (!enableUnusedFoil + && !(aMaterial == Materials.Zinc + || aMaterial == Materials.Aluminium + || aMaterial == Materials.Silicon + || aMaterial == Materials.Gold + || aMaterial == Materials.Electrum + || aMaterial == Materials.Platinum + || aMaterial == Materials.Osmiridium + || aMaterial == Materials.Osmium + || aMaterial == Materials.AnnealedCopper + || aMaterial == Materials.Steel + || aMaterial == Materials.Copper + || aMaterial == Materials.YttriumBariumCuprate + || aMaterial == Materials.VanadiumGallium + || aMaterial == Materials.NiobiumTitanium + || aMaterial == Materials.Naquadah + || aMaterial == Materials.Manganese + || aMaterial == Materials.Plastic + || aMaterial == Materials.Silicone + || aMaterial == Materials.PolyvinylChloride + || aMaterial == Materials.PolyphenyleneSulfide + || aMaterial == Materials.Nichrome + || aMaterial == Materials.BlackSteel + || aMaterial == Materials.Titanium + || aMaterial == Materials.TungstenSteel + || aMaterial == Materials.Tungsten + || aMaterial == Materials.HSSG + || aMaterial == Materials.NaquadahAlloy + || aMaterial == Materials.Duranium + || aMaterial == Materials.Europium + || aMaterial == Materials.Bedrockium)) foil.mDisabledItems.add(aMaterial); + // Fine Wire + if (!enableUnusedFineWires + && !(aMaterial == Materials.Steel + || aMaterial == Materials.AnnealedCopper + || aMaterial == Materials.Platinum + || aMaterial == Materials.Osmium + || aMaterial == Materials.Tin + || aMaterial == Materials.Lead + || aMaterial == Materials.SolderingAlloy + || aMaterial == Materials.Copper + || aMaterial == Materials.Electrum + || aMaterial == Materials.Gold + || aMaterial == Materials.RedAlloy + || aMaterial == Materials.Graphene + || aMaterial == Materials.NiobiumTitanium + || aMaterial == Materials.YttriumBariumCuprate + || aMaterial == Materials.BloodInfusedIron)) wireFine.mDisabledItems.add(aMaterial); + // Gears + if (!enableUnusedGears + && !(aMaterial == Materials.Aluminium + || aMaterial == Materials.Titanium + || aMaterial == Materials.Iron + || aMaterial == Materials.Copper + || aMaterial == Materials.Tin + || aMaterial == Materials.Gold + || aMaterial == Materials.Stone + || aMaterial == Materials.Bronze + || aMaterial == Materials.Steel + || aMaterial == Materials.StainlessSteel + || aMaterial == Materials.TungstenSteel + || aMaterial == Materials.CobaltBrass + || aMaterial == Materials.Diamond + || aMaterial == Materials.Wood + || aMaterial == Materials.HSSG + || aMaterial == Materials.HSSE + || aMaterial == Materials.Neutronium)) gearGt.mDisabledItems.add(aMaterial); + // Small Gears + if (!enableUnusedSmallGears + && !(aMaterial == Materials.Aluminium + || aMaterial == Materials.Titanium + || aMaterial == Materials.Steel + || aMaterial == Materials.StainlessSteel + || aMaterial == Materials.TungstenSteel + || aMaterial == Materials.HSSG + || aMaterial == Materials.HSSE + || aMaterial == Materials.Neutronium + || aMaterial == Materials.VanadiumGallium + || aMaterial == Materials.Naquadah)) gearGtSmall.mDisabledItems.add(aMaterial); + // Bolts + if (!enableUnusedBolts + && ((aMaterial.mTypes & 0x40) == 0) + && !(aMaterial == Materials.Titanium + || aMaterial == Materials.Chrome + || aMaterial == Materials.Iron + || aMaterial == Materials.Tin + || aMaterial == Materials.Osmium + || aMaterial == Materials.Iridium + || aMaterial == Materials.Neutronium + || aMaterial == Materials.Bronze + || aMaterial == Materials.WroughtIron + || aMaterial == Materials.Steel + || aMaterial == Materials.StainlessSteel + || aMaterial == Materials.PigIron + || aMaterial == Materials.TungstenSteel + || aMaterial == Materials.Tungsten + || aMaterial == Materials.HSSE + || aMaterial == Materials.HSSG)) bolt.mDisabledItems.add(aMaterial); + // Screws + if (!enableUnusedScrews + && ((aMaterial.mTypes & 0x40) == 0) + && !(aMaterial == Materials.Titanium + || aMaterial == Materials.Chrome + || aMaterial == Materials.Iron + || aMaterial == Materials.Tin + || aMaterial == Materials.Osmium + || aMaterial == Materials.Iridium + || aMaterial == Materials.Neutronium + || aMaterial == Materials.Bronze + || aMaterial == Materials.WroughtIron + || aMaterial == Materials.Steel + || aMaterial == Materials.StainlessSteel + || aMaterial == Materials.PigIron + || aMaterial == Materials.TungstenSteel + || aMaterial == Materials.HSSE + || aMaterial == Materials.HSSG)) screw.mDisabledItems.add(aMaterial); + // Rods + if (!enableUnusedRods + && ((aMaterial.mTypes & 0x40) == 0) + && !(aMaterial == Materials.Titanium + || aMaterial == Materials.Chrome + || aMaterial == Materials.Iron + || aMaterial == Materials.Tin + || aMaterial == Materials.Osmium + || aMaterial == Materials.Iridium + || aMaterial == Materials.Neutronium + || aMaterial == Materials.Bronze + || aMaterial == Materials.WroughtIron + || aMaterial == Materials.Steel + || aMaterial == Materials.StainlessSteel + || aMaterial == Materials.PigIron + || aMaterial == Materials.TungstenSteel + || aMaterial == Materials.HSSE + || aMaterial == Materials.HSSG + || aMaterial == Materials.Aluminium + || aMaterial == Materials.Copper + || aMaterial == Materials.Neodymium + || aMaterial == Materials.Europium + || aMaterial == Materials.Platinum + || aMaterial == Materials.Gold + || aMaterial == Materials.Uranium235 + || aMaterial == Materials.Plutonium241 + || aMaterial == Materials.Americium + || aMaterial == Materials.Neutronium + || aMaterial == Materials.Bronze + || aMaterial == Materials.Brass + || aMaterial == Materials.Electrum + || aMaterial == Materials.NaquadahEnriched + || aMaterial == Materials.CobaltBrass + || aMaterial == Materials.IronMagnetic + || aMaterial == Materials.SteelMagnetic + || aMaterial == Materials.NeodymiumMagnetic + || aMaterial == Materials.Samarium + || aMaterial == Materials.SamariumMagnetic + || aMaterial == Materials.VanadiumGallium + || aMaterial == Materials.Diamond + || aMaterial == Materials.Wood + || aMaterial == Materials.Plastic + || aMaterial == Materials.Lead + || aMaterial == Materials.SolderingAlloy + || aMaterial == Materials.Lapis + || aMaterial == Materials.Lazurite + || aMaterial == Materials.Sodalite + || aMaterial == Materials.PolyvinylChloride)) stick.mDisabledItems.add(aMaterial); + // Long Rods + if (!enableUnusedLongRods + && ((aMaterial.mTypes & 0x40) == 0) + && !(aMaterial == Materials.Titanium + || aMaterial == Materials.NeodymiumMagnetic + || aMaterial == Materials.SamariumMagnetic + || aMaterial == Materials.HSSG + || aMaterial == Materials.HSSE + || aMaterial == Materials.Neutronium + || aMaterial == Materials.Americium + || aMaterial == Materials.WroughtIron + || aMaterial == Materials.Magnalium + || aMaterial == Materials.TungstenSteel)) stickLong.mDisabledItems.add(aMaterial); if (!enableUnusedGems && ((aMaterial.mTypes & 0x04) == 0)) { gem.mDisabledItems.add(aMaterial); @@ -800,10 +3996,10 @@ public enum OrePrefixes { gemFlawed.mDisabledItems.add(aMaterial); gemExquisite.mDisabledItems.add(aMaterial); } - //itemCasing + // itemCasing if (!enableUnusedItemCasing) itemCasing.mDisabledItems.add(aMaterial); - } } + } for (IMaterialHandler aRegistrator : Materials.mMaterialHandlers) { aRegistrator.onComponentInit(); } @@ -814,13 +4010,18 @@ 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)); - if (!aEnableComponent) { //Disable component if false and is not already in disabled list + 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 + } else if (aEnableComponent) { // Enable component if true and is not already in enabled list aPrefix.enableComponent(aMaterial); } } @@ -842,8 +4043,8 @@ public enum OrePrefixes { for (OrePrefixes tPrefix : values()) if (aOre.startsWith(tPrefix.toString())) { if (tPrefix == oreNether && aOre.equals("oreNetherQuartz")) return ore; - if (tPrefix == oreNether && aOre.equals("oreNetherStar")) return ore; - if (tPrefix == oreBasalt && aOre.equals("oreBasalticMineralSand")) return ore; + if (tPrefix == oreNether && aOre.equals("oreNetherStar")) return ore; + if (tPrefix == oreBasalt && aOre.equals("oreBasalticMineralSand")) return ore; if (tPrefix == stickLong && aOre.equals("stickLongasssuperconductornameforuvwire")) return stick; if (tPrefix == stickLong && aOre.equals("stickLongasssuperconductornameforuhvwire")) return stick; return tPrefix; @@ -911,8 +4112,8 @@ public enum OrePrefixes { public boolean containsUnCached(ItemStack aStack) { // In case someone needs this - for (ItemStack tStack : mPrefixedItems){ - if (GT_Utility.areStacksEqual(aStack, tStack, !tStack.hasTagCompound())){ + for (ItemStack tStack : mPrefixedItems) { + if (GT_Utility.areStacksEqual(aStack, tStack, !tStack.hasTagCompound())) { return true; } } @@ -920,7 +4121,13 @@ public enum OrePrefixes { } public boolean doGenerateItem(Materials aMaterial) { - return aMaterial != null && aMaterial != Materials._NULL && ((aMaterial.mTypes & mMaterialGenerationBits) != 0 || mGeneratedItems.contains(aMaterial) /*|| mDynamicItems.contains(aMaterial)*/) && !mNotGeneratedItems.contains(aMaterial) && !mDisabledItems.contains(aMaterial) && (mCondition == null || mCondition.isTrue(aMaterial)); + return aMaterial != null + && aMaterial != Materials._NULL + && ((aMaterial.mTypes & mMaterialGenerationBits) != 0 + || mGeneratedItems.contains(aMaterial) /*|| mDynamicItems.contains(aMaterial)*/) + && !mNotGeneratedItems.contains(aMaterial) + && !mDisabledItems.contains(aMaterial) + && (mCondition == null || mCondition.isTrue(aMaterial)); } public boolean ignoreMaterials(Materials... aMaterials) { @@ -944,10 +4151,15 @@ public enum OrePrefixes { } public void processOre(Materials aMaterial, String aOreDictName, String aModName, ItemStack aStack) { - if (aMaterial != null && (aMaterial != Materials._NULL || mIsSelfReferencing || !mIsMaterialBased) && GT_Utility.isStackValid(aStack)) { - //if (Materials.mPreventableComponents.contains(this) && !this.mDynamicItems.contains(aMaterial)) return; + if (aMaterial != null + && (aMaterial != Materials._NULL || mIsSelfReferencing || !mIsMaterialBased) + && GT_Utility.isStackValid(aStack)) { + // if (Materials.mPreventableComponents.contains(this) && !this.mDynamicItems.contains(aMaterial)) return; for (IOreRecipeRegistrator tRegistrator : mOreProcessing) { - if (D2) GT_Log.ore.println("Processing '" + aOreDictName + "' with the Prefix '" + name() + "' and the Material '" + aMaterial.mName + "' at " + GT_Utility.getClassName(tRegistrator)); + if (D2) + GT_Log.ore.println( + "Processing '" + aOreDictName + "' with the Prefix '" + name() + "' and the Material '" + + aMaterial.mName + "' at " + GT_Utility.getClassName(tRegistrator)); tRegistrator.registerOre(this, aMaterial, aOreDictName, aModName, GT_Utility.copyAmount(1, aStack)); } } @@ -959,7 +4171,7 @@ public enum OrePrefixes { } public String getDefaultLocalNameForItem(Materials aMaterial) { - return aMaterial.getDefaultLocalizedNameForItem(getDefaultLocalNameFormatForItem(aMaterial)); + return aMaterial.getDefaultLocalizedNameForItem(getDefaultLocalNameFormatForItem(aMaterial)); } @SuppressWarnings("incomplete-switch") @@ -1038,12 +4250,18 @@ public enum OrePrefixes { case "Paper": if (name().startsWith("dust")) return mLocalizedMaterialPre + "Chad"; switch (this) { - case plate: return "Sheet of Paper"; - case plateDouble: return "Paperboard"; - case plateTriple: return "Carton"; - case plateQuadruple: return "Cardboard"; - case plateQuintuple: return "Thick Cardboard"; - case plateDense: return "Strong Cardboard"; + case plate: + return "Sheet of Paper"; + case plateDouble: + return "Paperboard"; + case plateTriple: + return "Carton"; + case plateQuadruple: + return "Cardboard"; + case plateQuintuple: + return "Thick Cardboard"; + case plateDense: + return "Strong Cardboard"; } break; case "MeatRaw": @@ -1096,10 +4314,8 @@ public enum OrePrefixes { case "InfusedWater": if (name().startsWith("gem")) return mLocalizedMaterialPre + "Shard of " + "%material"; if (name().startsWith("crystal")) return mLocalizedMaterialPre + "Shard of " + "%material"; - if (name().startsWith("plate")) - return mLocalizedMaterialPre + "%material" + " Crystal Plate"; - if (name().startsWith("dust")) - return mLocalizedMaterialPre + "%material" + " Crystal Powder"; + if (name().startsWith("plate")) return mLocalizedMaterialPre + "%material" + " Crystal Plate"; + if (name().startsWith("dust")) return mLocalizedMaterialPre + "%material" + " Crystal Powder"; switch (this) { case crushedCentrifuged: case crushedPurified: diff --git a/src/main/java/gregtech/api/enums/ParticleFX.java b/src/main/java/gregtech/api/enums/ParticleFX.java index c07b1303b3..985ef3e4a8 100644 --- a/src/main/java/gregtech/api/enums/ParticleFX.java +++ b/src/main/java/gregtech/api/enums/ParticleFX.java @@ -50,4 +50,3 @@ public enum ParticleFX { return this.identifier; } } - diff --git a/src/main/java/gregtech/api/enums/SoundResource.java b/src/main/java/gregtech/api/enums/SoundResource.java index d0bfdc6a6b..193aad3002 100644 --- a/src/main/java/gregtech/api/enums/SoundResource.java +++ b/src/main/java/gregtech/api/enums/SoundResource.java @@ -1,14 +1,13 @@ package gregtech.api.enums; -import com.google.common.collect.Maps; -import net.minecraft.util.ResourceLocation; +import static gregtech.api.enums.GT_Values.MOD_ID_IC2; +import com.google.common.collect.Maps; import java.util.EnumSet; import java.util.Locale; import java.util.Map; import java.util.concurrent.ConcurrentHashMap; - -import static gregtech.api.enums.GT_Values.MOD_ID_IC2; +import net.minecraft.util.ResourceLocation; /** * Enumerates known sounds with id and resource-location @@ -17,7 +16,6 @@ import static gregtech.api.enums.GT_Values.MOD_ID_IC2; * a plausible yet unimplemented network packet weight optimization.</p> */ public enum SoundResource { - RANDOM_BREAK(0, "random.break"), RANDOM_ANVIL_USE(1, "random.anvil_use"), RANDOM_ANVIL_BREAK(2, "random.anvil_break"), @@ -296,8 +294,8 @@ public enum SoundResource { 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)); + EnumSet.allOf(SoundResource.class) + .forEach(sound -> RESOURCE_STR_SOUND_MAP.put(sound.resourceLocation.toString(), sound)); } /** diff --git a/src/main/java/gregtech/api/enums/SubTag.java b/src/main/java/gregtech/api/enums/SubTag.java index 681358f8f1..b1999de89b 100644 --- a/src/main/java/gregtech/api/enums/SubTag.java +++ b/src/main/java/gregtech/api/enums/SubTag.java @@ -2,7 +2,6 @@ package gregtech.api.enums; import gregtech.api.interfaces.ICondition; import gregtech.api.interfaces.ISubTagContainer; - import java.util.Collection; import java.util.HashMap; import java.util.HashSet; @@ -29,13 +28,13 @@ public final class SubTag implements ICondition<ISubTagContainer> { * Add this to your Material if you want to have its Ore Calcite heated in a Blast Furnace for more output. Already listed are: * Iron, Pyrite, PigIron, DeepIron, ShadowIron, WroughtIron and MeteoricIron. */ - public static final SubTag BLASTFURNACE_CALCITE_DOUBLE = getNewSubTag("BLASTFURNACE_CALCITE_DOUBLE"), BLASTFURNACE_CALCITE_TRIPLE = getNewSubTag("BLASTFURNACE_CALCITE_TRIPLE"); + public static final SubTag BLASTFURNACE_CALCITE_DOUBLE = getNewSubTag("BLASTFURNACE_CALCITE_DOUBLE"), + BLASTFURNACE_CALCITE_TRIPLE = getNewSubTag("BLASTFURNACE_CALCITE_TRIPLE"); /** * Add this to a material with Direct Smelting to prevent the automatic generation of a Bricked/Bronze Blast Furnace recipe. Already listed are: * Chalcopyrite, Tetrahedrite */ - public static final SubTag DONT_ADD_DEFAULT_BBF_RECIPE = getNewSubTag("DONT_ADD_DEFAULT_BBF_RECIPE"); /** @@ -54,9 +53,9 @@ public final class SubTag implements ICondition<ISubTagContainer> { */ public static final SubTag WASHING_MERCURY = getNewSubTag("WASHING_MERCURY"); /** - * Add this to your Material if you want to have its Ore Mercury washed with 99% output chance. Already listed are: - * Silver - */ + * Add this to your Material if you want to have its Ore Mercury washed with 99% output chance. Already listed are: + * Silver + */ public static final SubTag WASHING_MERCURY_99_PERCENT = getNewSubTag("WASHING_MERCURY_99_PERCENT"); /** * Add this to your Material if you want to have its Ore electromagnetically separated to give Gold. @@ -69,7 +68,8 @@ public final class SubTag implements ICondition<ISubTagContainer> { /** * Add this to your Material if you want to have its Ore electromagnetically separated to give Neodymium. */ - public static final SubTag ELECTROMAGNETIC_SEPERATION_NEODYMIUM = getNewSubTag("ELECTROMAGNETIC_SEPERATION_NEODYMIUM"); + public static final SubTag ELECTROMAGNETIC_SEPERATION_NEODYMIUM = + getNewSubTag("ELECTROMAGNETIC_SEPERATION_NEODYMIUM"); /** * Add this to your Material if you want to have its Ore giving Cinnabar Crystals on Pulverization. Already listed are: * Redstone @@ -239,6 +239,7 @@ public final class SubTag implements ICondition<ISubTagContainer> { * Projectile Tag for Arrows */ public static final SubTag PROJECTILE_ARROW = getNewSubTag("PROJECTILE_ARROW"); + public final Collection<ISubTagContainer> mRelevantTaggedItems = new HashSet<>(1); private SubTag(String aName) { @@ -248,9 +249,7 @@ public final class SubTag implements ICondition<ISubTagContainer> { } public static SubTag getNewSubTag(String aName) { - for (SubTag tSubTag : sSubTags.values()) - if (tSubTag.mName.equals(aName)) - return tSubTag; + for (SubTag tSubTag : sSubTags.values()) if (tSubTag.mName.equals(aName)) return tSubTag; return new SubTag(aName); } @@ -269,9 +268,7 @@ public final class SubTag implements ICondition<ISubTagContainer> { public SubTag addTo(ISubTagContainer... aContainers) { if (aContainers != null) - for (ISubTagContainer aContainer : aContainers) - if (aContainer != null) - aContainer.add(this); + for (ISubTagContainer aContainer : aContainers) if (aContainer != null) aContainer.add(this); return this; } diff --git a/src/main/java/gregtech/api/enums/TC_Aspects.java b/src/main/java/gregtech/api/enums/TC_Aspects.java index 582ffb86f6..cb578cf870 100644 --- a/src/main/java/gregtech/api/enums/TC_Aspects.java +++ b/src/main/java/gregtech/api/enums/TC_Aspects.java @@ -62,6 +62,7 @@ public enum TC_Aspects { * The Thaumcraft Aspect Object of the Mod itself. */ public Object mAspect; + public int mValue; TC_Aspects(int aValue) { @@ -72,7 +73,6 @@ public enum TC_Aspects { public TC_Aspects mAspect; public long mAmount; - public TC_AspectStack(TC_Aspects aAspect, long aAmount) { mAspect = aAspect; mAmount = aAmount; diff --git a/src/main/java/gregtech/api/enums/TextureSet.java b/src/main/java/gregtech/api/enums/TextureSet.java index c9ae82ca61..78864e1ca5 100644 --- a/src/main/java/gregtech/api/enums/TextureSet.java +++ b/src/main/java/gregtech/api/enums/TextureSet.java @@ -1,12 +1,12 @@ package gregtech.api.enums; + import gregtech.api.interfaces.IIconContainer; public class TextureSet { public boolean is_custom = false; - public static final TextureSet - SET_NONE = new TextureSet("NONE"), + public static final TextureSet SET_NONE = new TextureSet("NONE"), SET_DULL = new TextureSet("DULL"), SET_RUBY = new TextureSet("RUBY"), SET_OPAL = new TextureSet("OPAL"), @@ -37,8 +37,7 @@ public class TextureSet { /** * For the Indices of OrePrefixes you need to look into the OrePrefix Enum. */ - public static final short - INDEX_wire = 69, + public static final short INDEX_wire = 69, INDEX_foil = 70, INDEX_block1 = 71, INDEX_block2 = 72, diff --git a/src/main/java/gregtech/api/enums/Textures.java b/src/main/java/gregtech/api/enums/Textures.java index 666098b079..238ab4bf58 100644 --- a/src/main/java/gregtech/api/enums/Textures.java +++ b/src/main/java/gregtech/api/enums/Textures.java @@ -1,23 +1,22 @@ package gregtech.api.enums; +import static gregtech.api.enums.GT_Values.RES_PATH_BLOCK; +import static gregtech.api.enums.GT_Values.RES_PATH_ITEM; + import gregtech.api.GregTech_API; import gregtech.api.interfaces.IIconContainer; import gregtech.api.interfaces.ITexture; import gregtech.api.render.TextureFactory; import gregtech.api.util.GT_Utility; +import java.util.HashMap; +import java.util.Map; import net.minecraft.client.renderer.texture.TextureMap; import net.minecraft.util.IIcon; import net.minecraft.util.ResourceLocation; -import java.util.HashMap; -import java.util.Map; - -import static gregtech.api.enums.GT_Values.RES_PATH_BLOCK; -import static gregtech.api.enums.GT_Values.RES_PATH_ITEM; - public class Textures { public enum BlockIcons implements IIconContainer, Runnable { - //ADDED + // ADDED MACHINE_UEV_SIDE, MACHINE_UIV_SIDE, @@ -310,7 +309,7 @@ public class Textures { MACHINE_CASING_FIREBOX_STEEL, MACHINE_CASING_FIREBOX_TUNGSTENSTEEL, MACHINE_CASING_ENGINE_INTAKE, - MACHINE_CASING_EXTREME_ENGINE_INTAKE, //changed color in a terrible way + MACHINE_CASING_EXTREME_ENGINE_INTAKE, // changed color in a terrible way MACHINE_CASING_CHEMICALLY_INERT, MACHINE_COIL_CUPRONICKEL, @@ -1267,8 +1266,7 @@ public class Textures { OVERLAY_ME_INPUT_HATCH, OVERLAY_ME_INPUT_HATCH_ACTIVE, OVERLAY_ME_CRAFTING_HATCH, - OVERLAY_ME_CRAFTING_HATCH_ACTIVE - ; + OVERLAY_ME_CRAFTING_HATCH_ACTIVE; /** * Icon for Fresh CFoam @@ -1280,674 +1278,699 @@ public class Textures { * 1 - 16 = Colors */ public static final ITexture[][] HARDENEDFOAMS = { - new ITexture[]{TextureFactory.of(CFOAM_HARDENED, Dyes.CONSTRUCTION_FOAM.mRGBa)}, - new ITexture[]{TextureFactory.of(CFOAM_HARDENED, Dyes.VALUES[0].mRGBa)}, - new ITexture[]{TextureFactory.of(CFOAM_HARDENED, Dyes.VALUES[1].mRGBa)}, - new ITexture[]{TextureFactory.of(CFOAM_HARDENED, Dyes.VALUES[2].mRGBa)}, - new ITexture[]{TextureFactory.of(CFOAM_HARDENED, Dyes.VALUES[3].mRGBa)}, - new ITexture[]{TextureFactory.of(CFOAM_HARDENED, Dyes.VALUES[4].mRGBa)}, - new ITexture[]{TextureFactory.of(CFOAM_HARDENED, Dyes.VALUES[5].mRGBa)}, - new ITexture[]{TextureFactory.of(CFOAM_HARDENED, Dyes.VALUES[6].mRGBa)}, - new ITexture[]{TextureFactory.of(CFOAM_HARDENED, Dyes.VALUES[7].mRGBa)}, - new ITexture[]{TextureFactory.of(CFOAM_HARDENED, Dyes.VALUES[8].mRGBa)}, - new ITexture[]{TextureFactory.of(CFOAM_HARDENED, Dyes.VALUES[9].mRGBa)}, - new ITexture[]{TextureFactory.of(CFOAM_HARDENED, Dyes.VALUES[10].mRGBa)}, - new ITexture[]{TextureFactory.of(CFOAM_HARDENED, Dyes.VALUES[11].mRGBa)}, - new ITexture[]{TextureFactory.of(CFOAM_HARDENED, Dyes.VALUES[12].mRGBa)}, - new ITexture[]{TextureFactory.of(CFOAM_HARDENED, Dyes.VALUES[13].mRGBa)}, - new ITexture[]{TextureFactory.of(CFOAM_HARDENED, Dyes.VALUES[14].mRGBa)}, - new ITexture[]{TextureFactory.of(CFOAM_HARDENED, Dyes.VALUES[15].mRGBa)} + new ITexture[] {TextureFactory.of(CFOAM_HARDENED, Dyes.CONSTRUCTION_FOAM.mRGBa)}, + new ITexture[] {TextureFactory.of(CFOAM_HARDENED, Dyes.VALUES[0].mRGBa)}, + new ITexture[] {TextureFactory.of(CFOAM_HARDENED, Dyes.VALUES[1].mRGBa)}, + new ITexture[] {TextureFactory.of(CFOAM_HARDENED, Dyes.VALUES[2].mRGBa)}, + new ITexture[] {TextureFactory.of(CFOAM_HARDENED, Dyes.VALUES[3].mRGBa)}, + new ITexture[] {TextureFactory.of(CFOAM_HARDENED, Dyes.VALUES[4].mRGBa)}, + new ITexture[] {TextureFactory.of(CFOAM_HARDENED, Dyes.VALUES[5].mRGBa)}, + new ITexture[] {TextureFactory.of(CFOAM_HARDENED, Dyes.VALUES[6].mRGBa)}, + new ITexture[] {TextureFactory.of(CFOAM_HARDENED, Dyes.VALUES[7].mRGBa)}, + new ITexture[] {TextureFactory.of(CFOAM_HARDENED, Dyes.VALUES[8].mRGBa)}, + new ITexture[] {TextureFactory.of(CFOAM_HARDENED, Dyes.VALUES[9].mRGBa)}, + new ITexture[] {TextureFactory.of(CFOAM_HARDENED, Dyes.VALUES[10].mRGBa)}, + new ITexture[] {TextureFactory.of(CFOAM_HARDENED, Dyes.VALUES[11].mRGBa)}, + new ITexture[] {TextureFactory.of(CFOAM_HARDENED, Dyes.VALUES[12].mRGBa)}, + new ITexture[] {TextureFactory.of(CFOAM_HARDENED, Dyes.VALUES[13].mRGBa)}, + new ITexture[] {TextureFactory.of(CFOAM_HARDENED, Dyes.VALUES[14].mRGBa)}, + new ITexture[] {TextureFactory.of(CFOAM_HARDENED, Dyes.VALUES[15].mRGBa)} }; /** * Machine Casings by Tier * 0 = 8V, 1 = LV, 2 = MV, 3 = HV, 4 = EV, 5 = IV, 6 = IV, 7 = IV, 8 = IV, 9 = IV */ public static final IIconContainer[] - MACHINECASINGS_SIDE = { - MACHINE_8V_SIDE, - MACHINE_LV_SIDE, - MACHINE_MV_SIDE, - MACHINE_HV_SIDE, - MACHINE_EV_SIDE, - MACHINE_IV_SIDE, - MACHINE_LuV_SIDE, - MACHINE_ZPM_SIDE, - MACHINE_UV_SIDE, - MACHINE_MAX_SIDE, - MACHINE_UEV_SIDE, - MACHINE_UIV_SIDE, - MACHINE_UMV_SIDE, - MACHINE_UXV_SIDE, - MACHINE_MAXV_SIDE, - }, - MACHINECASINGS_TOP = { - MACHINE_8V_TOP, - MACHINE_LV_TOP, - MACHINE_MV_TOP, - MACHINE_HV_TOP, - MACHINE_EV_TOP, - MACHINE_IV_TOP, - MACHINE_LuV_TOP, - MACHINE_ZPM_TOP, - MACHINE_UV_TOP, - MACHINE_MAX_TOP, - MACHINE_UEV_TOP, - MACHINE_UIV_TOP, - MACHINE_UMV_TOP, - MACHINE_UXV_TOP, - MACHINE_MAXV_TOP, - }, - MACHINECASINGS_BOTTOM = { - MACHINE_8V_BOTTOM, - MACHINE_LV_BOTTOM, - MACHINE_MV_BOTTOM, - MACHINE_HV_BOTTOM, - MACHINE_EV_BOTTOM, - MACHINE_IV_BOTTOM, - MACHINE_LuV_BOTTOM, - MACHINE_ZPM_BOTTOM, - MACHINE_UV_BOTTOM, - MACHINE_MAX_BOTTOM, - MACHINE_UEV_BOTTOM, - MACHINE_UIV_BOTTOM, - MACHINE_UMV_BOTTOM, - MACHINE_UXV_BOTTOM, - MACHINE_MAXV_BOTTOM, - - }, - GRANITES = { - GRANITE_BLACK_STONE, - GRANITE_BLACK_COBBLE, - GRANITE_BLACK_COBBLE_MOSSY, - GRANITE_BLACK_BRICKS, - GRANITE_BLACK_BRICKS_CRACKED, - GRANITE_BLACK_BRICKS_MOSSY, - GRANITE_BLACK_BRICKS_CHISELED, - GRANITE_BLACK_SMOOTH, - GRANITE_RED_STONE, - GRANITE_RED_COBBLE, - GRANITE_RED_COBBLE_MOSSY, - GRANITE_RED_BRICKS, - GRANITE_RED_BRICKS_CRACKED, - GRANITE_RED_BRICKS_MOSSY, - GRANITE_RED_BRICKS_CHISELED, - GRANITE_RED_SMOOTH, - }, - CONCRETES = { - CONCRETE_DARK_STONE, - CONCRETE_DARK_COBBLE, - CONCRETE_DARK_COBBLE_MOSSY, - CONCRETE_DARK_BRICKS, - CONCRETE_DARK_BRICKS_CRACKED, - CONCRETE_DARK_BRICKS_MOSSY, - CONCRETE_DARK_BRICKS_CHISELED, - CONCRETE_DARK_SMOOTH, - CONCRETE_LIGHT_STONE, - CONCRETE_LIGHT_COBBLE, - CONCRETE_LIGHT_COBBLE_MOSSY, - CONCRETE_LIGHT_BRICKS, - CONCRETE_LIGHT_BRICKS_CRACKED, - CONCRETE_LIGHT_BRICKS_MOSSY, - CONCRETE_LIGHT_BRICKS_CHISELED, - CONCRETE_LIGHT_SMOOTH, - }, - STONES = { - MARBLE_STONE, - MARBLE_COBBLE, - MARBLE_COBBLE_MOSSY, - MARBLE_BRICKS, - MARBLE_BRICKS_CRACKED, - MARBLE_BRICKS_MOSSY, - MARBLE_BRICKS_CHISELED, - MARBLE_SMOOTH, - BASALT_STONE, - BASALT_COBBLE, - BASALT_COBBLE_MOSSY, - BASALT_BRICKS, - BASALT_BRICKS_CRACKED, - BASALT_BRICKS_MOSSY, - BASALT_BRICKS_CHISELED, - BASALT_SMOOTH, - }, - TURBINE = { - LARGETURBINE_ST1, - LARGETURBINE_ST2, - LARGETURBINE_ST3, - LARGETURBINE_ST4, - LARGETURBINE_ST5, - LARGETURBINE_ST6, - LARGETURBINE_ST7, - LARGETURBINE_ST8, - LARGETURBINE_ST9 - }, - TURBINE_ACTIVE = { - LARGETURBINE_ST_ACTIVE1, - LARGETURBINE_ST_ACTIVE2, - LARGETURBINE_ST_ACTIVE3, - LARGETURBINE_ST_ACTIVE4, - LARGETURBINE_ST_ACTIVE5, - LARGETURBINE_ST_ACTIVE6, - LARGETURBINE_ST_ACTIVE7, - LARGETURBINE_ST_ACTIVE8, - LARGETURBINE_ST_ACTIVE9 - }, - TURBINE_EMPTY = { - LARGETURBINE_ST_EMPTY1, - LARGETURBINE_ST_EMPTY2, - LARGETURBINE_ST_EMPTY3, - LARGETURBINE_ST_EMPTY4, - LARGETURBINE_ST_EMPTY5, - LARGETURBINE_ST_EMPTY6, - LARGETURBINE_ST_EMPTY7, - LARGETURBINE_ST_EMPTY8, - LARGETURBINE_ST_EMPTY9 - }, - TURBINE1 = { - LARGETURBINE_SS1, - LARGETURBINE_SS2, - LARGETURBINE_SS3, - LARGETURBINE_SS4, - LARGETURBINE_SS5, - LARGETURBINE_SS6, - LARGETURBINE_SS7, - LARGETURBINE_SS8, - LARGETURBINE_SS9 - }, - TURBINE_ACTIVE1 = { - LARGETURBINE_SS_ACTIVE1, - LARGETURBINE_SS_ACTIVE2, - LARGETURBINE_SS_ACTIVE3, - LARGETURBINE_SS_ACTIVE4, - LARGETURBINE_SS_ACTIVE5, - LARGETURBINE_SS_ACTIVE6, - LARGETURBINE_SS_ACTIVE7, - LARGETURBINE_SS_ACTIVE8, - LARGETURBINE_SS_ACTIVE9 - }, - TURBINE_EMPTY1 = { - LARGETURBINE_SS_EMPTY1, - LARGETURBINE_SS_EMPTY2, - LARGETURBINE_SS_EMPTY3, - LARGETURBINE_SS_EMPTY4, - LARGETURBINE_SS_EMPTY5, - LARGETURBINE_SS_EMPTY6, - LARGETURBINE_SS_EMPTY7, - LARGETURBINE_SS_EMPTY8, - LARGETURBINE_SS_EMPTY9 - }, - TURBINE2 = { - LARGETURBINE_TI1, - LARGETURBINE_TI2, - LARGETURBINE_TI3, - LARGETURBINE_TI4, - LARGETURBINE_TI5, - LARGETURBINE_TI6, - LARGETURBINE_TI7, - LARGETURBINE_TI8, - LARGETURBINE_TI9 - }, - TURBINE_ACTIVE2 = { - LARGETURBINE_TI_ACTIVE1, - LARGETURBINE_TI_ACTIVE2, - LARGETURBINE_TI_ACTIVE3, - LARGETURBINE_TI_ACTIVE4, - LARGETURBINE_TI_ACTIVE5, - LARGETURBINE_TI_ACTIVE6, - LARGETURBINE_TI_ACTIVE7, - LARGETURBINE_TI_ACTIVE8, - LARGETURBINE_TI_ACTIVE9 - }, - TURBINE_EMPTY2 = { - LARGETURBINE_TI_EMPTY1, - LARGETURBINE_TI_EMPTY2, - LARGETURBINE_TI_EMPTY3, - LARGETURBINE_TI_EMPTY4, - LARGETURBINE_TI_EMPTY5, - LARGETURBINE_TI_EMPTY6, - LARGETURBINE_TI_EMPTY7, - LARGETURBINE_TI_EMPTY8, - LARGETURBINE_TI_EMPTY9 - }, - TURBINE3 = { - LARGETURBINE_TU1, - LARGETURBINE_TU2, - LARGETURBINE_TU3, - LARGETURBINE_TU4, - LARGETURBINE_TU5, - LARGETURBINE_TU6, - LARGETURBINE_TU7, - LARGETURBINE_TU8, - LARGETURBINE_TU9 - }, - TURBINE_ACTIVE3 = { - LARGETURBINE_TU_ACTIVE1, - LARGETURBINE_TU_ACTIVE2, - LARGETURBINE_TU_ACTIVE3, - LARGETURBINE_TU_ACTIVE4, - LARGETURBINE_TU_ACTIVE5, - LARGETURBINE_TU_ACTIVE6, - LARGETURBINE_TU_ACTIVE7, - LARGETURBINE_TU_ACTIVE8, - LARGETURBINE_TU_ACTIVE9 - }, - TURBINE_EMPTY3 = { - LARGETURBINE_TU_EMPTY1, - LARGETURBINE_TU_EMPTY2, - LARGETURBINE_TU_EMPTY3, - LARGETURBINE_TU_EMPTY4, - LARGETURBINE_TU_EMPTY5, - LARGETURBINE_TU_EMPTY6, - LARGETURBINE_TU_EMPTY7, - LARGETURBINE_TU_EMPTY8, - LARGETURBINE_TU_EMPTY9 - }, - TURBINEADVGAS = { - LARGETURBINE_ADVGAS1, - LARGETURBINE_ADVGAS2, - LARGETURBINE_ADVGAS3, - LARGETURBINE_ADVGAS4, - LARGETURBINE_ADVGAS5, - LARGETURBINE_ADVGAS6, - LARGETURBINE_ADVGAS7, - LARGETURBINE_ADVGAS8, - LARGETURBINE_ADVGAS9 - }, - TURBINE_ADVGASACTIVE = { - LARGETURBINE_ADVGAS_ACTIVE1, - LARGETURBINE_ADVGAS_ACTIVE2, - LARGETURBINE_ADVGAS_ACTIVE3, - LARGETURBINE_ADVGAS_ACTIVE4, - LARGETURBINE_ADVGAS_ACTIVE5, - LARGETURBINE_ADVGAS_ACTIVE6, - LARGETURBINE_ADVGAS_ACTIVE7, - LARGETURBINE_ADVGAS_ACTIVE8, - LARGETURBINE_ADVGAS_ACTIVE9 - }, - TURBINE_ADVGASEMPTY = { - LARGETURBINE_ADVGAS_EMPTY1, - LARGETURBINE_ADVGAS_EMPTY2, - LARGETURBINE_ADVGAS_EMPTY3, - LARGETURBINE_ADVGAS_EMPTY4, - LARGETURBINE_ADVGAS_EMPTY5, - LARGETURBINE_ADVGAS_EMPTY6, - LARGETURBINE_ADVGAS_EMPTY7, - LARGETURBINE_ADVGAS_EMPTY8, - LARGETURBINE_ADVGAS_EMPTY9 - }, - CONNECTED_HULLS = { - CONCRETE_DARK_STONE, - FUSIONI_1, - FUSIONI_2, - FUSIONI_3, - FUSIONI_4, - FUSIONI_5, - FUSIONI_6, - FUSIONI_7, - FUSIONI_8, - FUSIONI_9, - FUSIONI_10, - FUSIONI_11, - FUSIONI_12, - FUSIONII_1, - FUSIONII_2, - FUSIONII_3, - FUSIONII_4, - FUSIONII_5, - FUSIONII_6, - FUSIONII_7, - FUSIONII_8, - FUSIONII_9, - FUSIONII_10, - FUSIONII_11, - FUSIONII_12, - }, - STORAGE_BLOCKS1 = { - BLOCK_ADAMANTIUM, - BLOCK_ALUMINIUM, - BLOCK_AMERICIUM, - BLOCK_ANNEALEDCOPPER, - BLOCK_ANTIMONY, - BLOCK_ARSENIC, - BLOCK_ASTRALSILVER, - BLOCK_BATTERYALLOY, - BLOCK_BERYLLIUM, - BLOCK_BISMUTH, - BLOCK_BISMUTHBRONZE, - BLOCK_BLACKBRONZE, - BLOCK_BLACKSTEEL, - BLOCK_BLUEALLOY, - BLOCK_BLUESTEEL, - BLOCK_BRASS - }, - STORAGE_BLOCKS2 = { - BLOCK_BRONZE, - BLOCK_CAESIUM, - BLOCK_CERIUM, - BLOCK_CHROME, - BLOCK_CHROMIUMDIOXIDE, - BLOCK_COBALT, - BLOCK_COBALTBRASS, - BLOCK_COPPER, - BLOCK_CUPRONICKEL, - BLOCK_DAMASCUSSTEEL, - BLOCK_DARKIRON, - BLOCK_DEEPIRON, - BLOCK_DESH, - BLOCK_DURANIUM, - BLOCK_DYSPROSIUM, - BLOCK_ELECTRUM - }, - STORAGE_BLOCKS3 = { - BLOCK_ELECTRUMFLUX, - BLOCK_ENDERIUM, - BLOCK_ERBIUM, - BLOCK_EUROPIUM, - BLOCK_FIERYSTEEL, - BLOCK_GADOLINIUM, - BLOCK_GALLIUM, - BLOCK_HOLMIUM, - BLOCK_HSLA, - BLOCK_INDIUM, - BLOCK_INFUSEDGOLD, - BLOCK_INVAR, - BLOCK_IRIDIUM, - BLOCK_IRONMAGNETIC, - BLOCK_IRONWOOD, - BLOCK_KANTHAL - }, - STORAGE_BLOCKS4 = { - BLOCK_KNIGHTMETAL, - BLOCK_LANTHANUM, - BLOCK_LEAD, - BLOCK_LUTETIUM, - BLOCK_MAGNALIUM, - BLOCK_MAGNESIUM, - BLOCK_MANGANESE, - BLOCK_METEORICIRON, - BLOCK_METEORICSTEEL, - BLOCK_TRINIUM, - BLOCK_MITHRIL, - BLOCK_MOLYBDENUM, - BLOCK_NAQUADAH, - BLOCK_NAQUADAHALLOY, - BLOCK_NAQUADAHENRICHED, - BLOCK_NAQUADRIA - }, - STORAGE_BLOCKS5 = { - BLOCK_NEODYMIUM, - BLOCK_NEODYMIUMMAGNETIC, - BLOCK_NEUTRONIUM, - BLOCK_NICHROME, - BLOCK_NICKEL, - BLOCK_NIOBIUM, - BLOCK_NIOBIUMNITRIDE, - BLOCK_NIOBIUMTITANIUM, - BLOCK_OSMIRIDIUM, - BLOCK_OSMIUM, - BLOCK_PALLADIUM, - BLOCK_PIGIRON, - BLOCK_PLATINUM, - BLOCK_PLUTONIUM, - BLOCK_PLUTONIUM241, - BLOCK_PRASEODYMIUM - }, - STORAGE_BLOCKS6 = { - BLOCK_PROMETHIUM, - BLOCK_REDALLOY, - BLOCK_REDSTEEL, - BLOCK_ROSEGOLD, - BLOCK_RUBIDIUM, - BLOCK_SAMARIUM, - BLOCK_SCANDIUM, - BLOCK_SHADOWIRON, - BLOCK_SHADOWSTEEL, - BLOCK_SILICON, - BLOCK_SILVER, - BLOCK_SOLDERINGALLOY, - BLOCK_STAINLESSSTEEL, - BLOCK_STEEL, - BLOCK_STEELMAGNETIC, - BLOCK_STERLINGSILVER - }, - STORAGE_BLOCKS7 = { - BLOCK_SUNNARIUM, - BLOCK_TANTALUM, - BLOCK_TELLURIUM, - BLOCK_TERBIUM, - BLOCK_THAUMIUM, - BLOCK_THORIUM, - BLOCK_THULIUM, - BLOCK_TIN, - BLOCK_TINALLOY, - BLOCK_TITANIUM, - BLOCK_TRITANIUM, - BLOCK_TUNGSTEN, - BLOCK_TUNGSTENSTEEL, - BLOCK_ULTIMET, - BLOCK_URANIUM, - BLOCK_URANIUM235 - }, - STORAGE_BLOCKS8 = { - BLOCK_VANADIUM, - BLOCK_VANADIUMGALLIUM, - BLOCK_WROUGHTIRON, - BLOCK_YTTRBIUM, - BLOCK_YTTRIUM, - BLOCK_YTTRIUMBARIUMCUPRATE, - BLOCK_ZINC, - BLOCK_TUNGSTENCARBIDE, - BLOCK_VANADIUMSTEEL, - BLOCK_HSSG, - BLOCK_HSSE, - BLOCK_HSSS, - BLOCK_STEELEAF, - BLOCK_ICHORIUM, - BLOCK_FIRESTONE, - BLOCK_SHADOW - }, - STORAGE_BLOCKS9 = { - BLOCK_AERCRYSTAL, - BLOCK_AMBER, - BLOCK_AMETHYST, - BLOCK_AQUACRYSTAL, - BLOCK_BLUETOPAZ, - BLOCK_CERTUSQUARTZ, - BLOCK_DILITHIUM, - BLOCK_ENDEREYE, - BLOCK_ENDERPEARL, - BLOCK_FOOLSRUBY, - BLOCK_FORCE, - BLOCK_FORCICIUM, - BLOCK_FORCILLIUM, - BLOCK_GREENSAPPHIRE, - BLOCK_IGNISCRYSTAL, - BLOCK_JASPER - }, - STORAGE_BLOCKS10 = { - BLOCK_LAZURITE, - BLOCK_LIGNITE, - BLOCK_MONAZITE, - BLOCK_NITER, - BLOCK_OLIVINE, - BLOCK_OPAL, - BLOCK_ORDOCRYSTAL, - BLOCK_PERDITIOCRYSTAL, - BLOCK_PHOSPHORUS, - BLOCK_QUARTZITE, - BLOCK_REDGARNET, - BLOCK_RUBY, - BLOCK_SAPPHIRE, - BLOCK_SODALITE, - BLOCK_TANZANITE, - BLOCK_TERRACRYSTAL - }, - STORAGE_BLOCKS11 = { - BLOCK_TOPAZ, - BLOCK_VINTEUM, - BLOCK_YELLOWGARNET, - BLOCK_NETHERSTAR, - BLOCK_CHARCOAL, - BLOCK_BLAZE, - }, - STORAGE_BLOCKS12 = { - BLOCK_CRYOLITE, - BLOCK_SILICONSG, - BLOCK_NICKELALUMINIUM, - BLOCK_SPACETIME - }; + MACHINECASINGS_SIDE = + { + MACHINE_8V_SIDE, + MACHINE_LV_SIDE, + MACHINE_MV_SIDE, + MACHINE_HV_SIDE, + MACHINE_EV_SIDE, + MACHINE_IV_SIDE, + MACHINE_LuV_SIDE, + MACHINE_ZPM_SIDE, + MACHINE_UV_SIDE, + MACHINE_MAX_SIDE, + MACHINE_UEV_SIDE, + MACHINE_UIV_SIDE, + MACHINE_UMV_SIDE, + MACHINE_UXV_SIDE, + MACHINE_MAXV_SIDE, + }, + MACHINECASINGS_TOP = + { + MACHINE_8V_TOP, + MACHINE_LV_TOP, + MACHINE_MV_TOP, + MACHINE_HV_TOP, + MACHINE_EV_TOP, + MACHINE_IV_TOP, + MACHINE_LuV_TOP, + MACHINE_ZPM_TOP, + MACHINE_UV_TOP, + MACHINE_MAX_TOP, + MACHINE_UEV_TOP, + MACHINE_UIV_TOP, + MACHINE_UMV_TOP, + MACHINE_UXV_TOP, + MACHINE_MAXV_TOP, + }, + MACHINECASINGS_BOTTOM = + { + MACHINE_8V_BOTTOM, + MACHINE_LV_BOTTOM, + MACHINE_MV_BOTTOM, + MACHINE_HV_BOTTOM, + MACHINE_EV_BOTTOM, + MACHINE_IV_BOTTOM, + MACHINE_LuV_BOTTOM, + MACHINE_ZPM_BOTTOM, + MACHINE_UV_BOTTOM, + MACHINE_MAX_BOTTOM, + MACHINE_UEV_BOTTOM, + MACHINE_UIV_BOTTOM, + MACHINE_UMV_BOTTOM, + MACHINE_UXV_BOTTOM, + MACHINE_MAXV_BOTTOM, + }, + GRANITES = + { + GRANITE_BLACK_STONE, + GRANITE_BLACK_COBBLE, + GRANITE_BLACK_COBBLE_MOSSY, + GRANITE_BLACK_BRICKS, + GRANITE_BLACK_BRICKS_CRACKED, + GRANITE_BLACK_BRICKS_MOSSY, + GRANITE_BLACK_BRICKS_CHISELED, + GRANITE_BLACK_SMOOTH, + GRANITE_RED_STONE, + GRANITE_RED_COBBLE, + GRANITE_RED_COBBLE_MOSSY, + GRANITE_RED_BRICKS, + GRANITE_RED_BRICKS_CRACKED, + GRANITE_RED_BRICKS_MOSSY, + GRANITE_RED_BRICKS_CHISELED, + GRANITE_RED_SMOOTH, + }, + CONCRETES = + { + CONCRETE_DARK_STONE, + CONCRETE_DARK_COBBLE, + CONCRETE_DARK_COBBLE_MOSSY, + CONCRETE_DARK_BRICKS, + CONCRETE_DARK_BRICKS_CRACKED, + CONCRETE_DARK_BRICKS_MOSSY, + CONCRETE_DARK_BRICKS_CHISELED, + CONCRETE_DARK_SMOOTH, + CONCRETE_LIGHT_STONE, + CONCRETE_LIGHT_COBBLE, + CONCRETE_LIGHT_COBBLE_MOSSY, + CONCRETE_LIGHT_BRICKS, + CONCRETE_LIGHT_BRICKS_CRACKED, + CONCRETE_LIGHT_BRICKS_MOSSY, + CONCRETE_LIGHT_BRICKS_CHISELED, + CONCRETE_LIGHT_SMOOTH, + }, + STONES = + { + MARBLE_STONE, + MARBLE_COBBLE, + MARBLE_COBBLE_MOSSY, + MARBLE_BRICKS, + MARBLE_BRICKS_CRACKED, + MARBLE_BRICKS_MOSSY, + MARBLE_BRICKS_CHISELED, + MARBLE_SMOOTH, + BASALT_STONE, + BASALT_COBBLE, + BASALT_COBBLE_MOSSY, + BASALT_BRICKS, + BASALT_BRICKS_CRACKED, + BASALT_BRICKS_MOSSY, + BASALT_BRICKS_CHISELED, + BASALT_SMOOTH, + }, + TURBINE = + { + LARGETURBINE_ST1, + LARGETURBINE_ST2, + LARGETURBINE_ST3, + LARGETURBINE_ST4, + LARGETURBINE_ST5, + LARGETURBINE_ST6, + LARGETURBINE_ST7, + LARGETURBINE_ST8, + LARGETURBINE_ST9 + }, + TURBINE_ACTIVE = + { + LARGETURBINE_ST_ACTIVE1, + LARGETURBINE_ST_ACTIVE2, + LARGETURBINE_ST_ACTIVE3, + LARGETURBINE_ST_ACTIVE4, + LARGETURBINE_ST_ACTIVE5, + LARGETURBINE_ST_ACTIVE6, + LARGETURBINE_ST_ACTIVE7, + LARGETURBINE_ST_ACTIVE8, + LARGETURBINE_ST_ACTIVE9 + }, + TURBINE_EMPTY = + { + LARGETURBINE_ST_EMPTY1, + LARGETURBINE_ST_EMPTY2, + LARGETURBINE_ST_EMPTY3, + LARGETURBINE_ST_EMPTY4, + LARGETURBINE_ST_EMPTY5, + LARGETURBINE_ST_EMPTY6, + LARGETURBINE_ST_EMPTY7, + LARGETURBINE_ST_EMPTY8, + LARGETURBINE_ST_EMPTY9 + }, + TURBINE1 = + { + LARGETURBINE_SS1, + LARGETURBINE_SS2, + LARGETURBINE_SS3, + LARGETURBINE_SS4, + LARGETURBINE_SS5, + LARGETURBINE_SS6, + LARGETURBINE_SS7, + LARGETURBINE_SS8, + LARGETURBINE_SS9 + }, + TURBINE_ACTIVE1 = + { + LARGETURBINE_SS_ACTIVE1, + LARGETURBINE_SS_ACTIVE2, + LARGETURBINE_SS_ACTIVE3, + LARGETURBINE_SS_ACTIVE4, + LARGETURBINE_SS_ACTIVE5, + LARGETURBINE_SS_ACTIVE6, + LARGETURBINE_SS_ACTIVE7, + LARGETURBINE_SS_ACTIVE8, + LARGETURBINE_SS_ACTIVE9 + }, + TURBINE_EMPTY1 = + { + LARGETURBINE_SS_EMPTY1, + LARGETURBINE_SS_EMPTY2, + LARGETURBINE_SS_EMPTY3, + LARGETURBINE_SS_EMPTY4, + LARGETURBINE_SS_EMPTY5, + LARGETURBINE_SS_EMPTY6, + LARGETURBINE_SS_EMPTY7, + LARGETURBINE_SS_EMPTY8, + LARGETURBINE_SS_EMPTY9 + }, + TURBINE2 = + { + LARGETURBINE_TI1, + LARGETURBINE_TI2, + LARGETURBINE_TI3, + LARGETURBINE_TI4, + LARGETURBINE_TI5, + LARGETURBINE_TI6, + LARGETURBINE_TI7, + LARGETURBINE_TI8, + LARGETURBINE_TI9 + }, + TURBINE_ACTIVE2 = + { + LARGETURBINE_TI_ACTIVE1, + LARGETURBINE_TI_ACTIVE2, + LARGETURBINE_TI_ACTIVE3, + LARGETURBINE_TI_ACTIVE4, + LARGETURBINE_TI_ACTIVE5, + LARGETURBINE_TI_ACTIVE6, + LARGETURBINE_TI_ACTIVE7, + LARGETURBINE_TI_ACTIVE8, + LARGETURBINE_TI_ACTIVE9 + }, + TURBINE_EMPTY2 = + { + LARGETURBINE_TI_EMPTY1, + LARGETURBINE_TI_EMPTY2, + LARGETURBINE_TI_EMPTY3, + LARGETURBINE_TI_EMPTY4, + LARGETURBINE_TI_EMPTY5, + LARGETURBINE_TI_EMPTY6, + LARGETURBINE_TI_EMPTY7, + LARGETURBINE_TI_EMPTY8, + LARGETURBINE_TI_EMPTY9 + }, + TURBINE3 = + { + LARGETURBINE_TU1, + LARGETURBINE_TU2, + LARGETURBINE_TU3, + LARGETURBINE_TU4, + LARGETURBINE_TU5, + LARGETURBINE_TU6, + LARGETURBINE_TU7, + LARGETURBINE_TU8, + LARGETURBINE_TU9 + }, + TURBINE_ACTIVE3 = + { + LARGETURBINE_TU_ACTIVE1, + LARGETURBINE_TU_ACTIVE2, + LARGETURBINE_TU_ACTIVE3, + LARGETURBINE_TU_ACTIVE4, + LARGETURBINE_TU_ACTIVE5, + LARGETURBINE_TU_ACTIVE6, + LARGETURBINE_TU_ACTIVE7, + LARGETURBINE_TU_ACTIVE8, + LARGETURBINE_TU_ACTIVE9 + }, + TURBINE_EMPTY3 = + { + LARGETURBINE_TU_EMPTY1, + LARGETURBINE_TU_EMPTY2, + LARGETURBINE_TU_EMPTY3, + LARGETURBINE_TU_EMPTY4, + LARGETURBINE_TU_EMPTY5, + LARGETURBINE_TU_EMPTY6, + LARGETURBINE_TU_EMPTY7, + LARGETURBINE_TU_EMPTY8, + LARGETURBINE_TU_EMPTY9 + }, + TURBINEADVGAS = + { + LARGETURBINE_ADVGAS1, + LARGETURBINE_ADVGAS2, + LARGETURBINE_ADVGAS3, + LARGETURBINE_ADVGAS4, + LARGETURBINE_ADVGAS5, + LARGETURBINE_ADVGAS6, + LARGETURBINE_ADVGAS7, + LARGETURBINE_ADVGAS8, + LARGETURBINE_ADVGAS9 + }, + TURBINE_ADVGASACTIVE = + { + LARGETURBINE_ADVGAS_ACTIVE1, + LARGETURBINE_ADVGAS_ACTIVE2, + LARGETURBINE_ADVGAS_ACTIVE3, + LARGETURBINE_ADVGAS_ACTIVE4, + LARGETURBINE_ADVGAS_ACTIVE5, + LARGETURBINE_ADVGAS_ACTIVE6, + LARGETURBINE_ADVGAS_ACTIVE7, + LARGETURBINE_ADVGAS_ACTIVE8, + LARGETURBINE_ADVGAS_ACTIVE9 + }, + TURBINE_ADVGASEMPTY = + { + LARGETURBINE_ADVGAS_EMPTY1, + LARGETURBINE_ADVGAS_EMPTY2, + LARGETURBINE_ADVGAS_EMPTY3, + LARGETURBINE_ADVGAS_EMPTY4, + LARGETURBINE_ADVGAS_EMPTY5, + LARGETURBINE_ADVGAS_EMPTY6, + LARGETURBINE_ADVGAS_EMPTY7, + LARGETURBINE_ADVGAS_EMPTY8, + LARGETURBINE_ADVGAS_EMPTY9 + }, + CONNECTED_HULLS = + { + CONCRETE_DARK_STONE, + FUSIONI_1, + FUSIONI_2, + FUSIONI_3, + FUSIONI_4, + FUSIONI_5, + FUSIONI_6, + FUSIONI_7, + FUSIONI_8, + FUSIONI_9, + FUSIONI_10, + FUSIONI_11, + FUSIONI_12, + FUSIONII_1, + FUSIONII_2, + FUSIONII_3, + FUSIONII_4, + FUSIONII_5, + FUSIONII_6, + FUSIONII_7, + FUSIONII_8, + FUSIONII_9, + FUSIONII_10, + FUSIONII_11, + FUSIONII_12, + }, + STORAGE_BLOCKS1 = + { + BLOCK_ADAMANTIUM, + BLOCK_ALUMINIUM, + BLOCK_AMERICIUM, + BLOCK_ANNEALEDCOPPER, + BLOCK_ANTIMONY, + BLOCK_ARSENIC, + BLOCK_ASTRALSILVER, + BLOCK_BATTERYALLOY, + BLOCK_BERYLLIUM, + BLOCK_BISMUTH, + BLOCK_BISMUTHBRONZE, + BLOCK_BLACKBRONZE, + BLOCK_BLACKSTEEL, + BLOCK_BLUEALLOY, + BLOCK_BLUESTEEL, + BLOCK_BRASS + }, + STORAGE_BLOCKS2 = + { + BLOCK_BRONZE, + BLOCK_CAESIUM, + BLOCK_CERIUM, + BLOCK_CHROME, + BLOCK_CHROMIUMDIOXIDE, + BLOCK_COBALT, + BLOCK_COBALTBRASS, + BLOCK_COPPER, + BLOCK_CUPRONICKEL, + BLOCK_DAMASCUSSTEEL, + BLOCK_DARKIRON, + BLOCK_DEEPIRON, + BLOCK_DESH, + BLOCK_DURANIUM, + BLOCK_DYSPROSIUM, + BLOCK_ELECTRUM + }, + STORAGE_BLOCKS3 = + { + BLOCK_ELECTRUMFLUX, + BLOCK_ENDERIUM, + BLOCK_ERBIUM, + BLOCK_EUROPIUM, + BLOCK_FIERYSTEEL, + BLOCK_GADOLINIUM, + BLOCK_GALLIUM, + BLOCK_HOLMIUM, + BLOCK_HSLA, + BLOCK_INDIUM, + BLOCK_INFUSEDGOLD, + BLOCK_INVAR, + BLOCK_IRIDIUM, + BLOCK_IRONMAGNETIC, + BLOCK_IRONWOOD, + BLOCK_KANTHAL + }, + STORAGE_BLOCKS4 = + { + BLOCK_KNIGHTMETAL, + BLOCK_LANTHANUM, + BLOCK_LEAD, + BLOCK_LUTETIUM, + BLOCK_MAGNALIUM, + BLOCK_MAGNESIUM, + BLOCK_MANGANESE, + BLOCK_METEORICIRON, + BLOCK_METEORICSTEEL, + BLOCK_TRINIUM, + BLOCK_MITHRIL, + BLOCK_MOLYBDENUM, + BLOCK_NAQUADAH, + BLOCK_NAQUADAHALLOY, + BLOCK_NAQUADAHENRICHED, + BLOCK_NAQUADRIA + }, + STORAGE_BLOCKS5 = + { + BLOCK_NEODYMIUM, + BLOCK_NEODYMIUMMAGNETIC, + BLOCK_NEUTRONIUM, + BLOCK_NICHROME, + BLOCK_NICKEL, + BLOCK_NIOBIUM, + BLOCK_NIOBIUMNITRIDE, + BLOCK_NIOBIUMTITANIUM, + BLOCK_OSMIRIDIUM, + BLOCK_OSMIUM, + BLOCK_PALLADIUM, + BLOCK_PIGIRON, + BLOCK_PLATINUM, + BLOCK_PLUTONIUM, + BLOCK_PLUTONIUM241, + BLOCK_PRASEODYMIUM + }, + STORAGE_BLOCKS6 = + { + BLOCK_PROMETHIUM, + BLOCK_REDALLOY, + BLOCK_REDSTEEL, + BLOCK_ROSEGOLD, + BLOCK_RUBIDIUM, + BLOCK_SAMARIUM, + BLOCK_SCANDIUM, + BLOCK_SHADOWIRON, + BLOCK_SHADOWSTEEL, + BLOCK_SILICON, + BLOCK_SILVER, + BLOCK_SOLDERINGALLOY, + BLOCK_STAINLESSSTEEL, + BLOCK_STEEL, + BLOCK_STEELMAGNETIC, + BLOCK_STERLINGSILVER + }, + STORAGE_BLOCKS7 = + { + BLOCK_SUNNARIUM, + BLOCK_TANTALUM, + BLOCK_TELLURIUM, + BLOCK_TERBIUM, + BLOCK_THAUMIUM, + BLOCK_THORIUM, + BLOCK_THULIUM, + BLOCK_TIN, + BLOCK_TINALLOY, + BLOCK_TITANIUM, + BLOCK_TRITANIUM, + BLOCK_TUNGSTEN, + BLOCK_TUNGSTENSTEEL, + BLOCK_ULTIMET, + BLOCK_URANIUM, + BLOCK_URANIUM235 + }, + STORAGE_BLOCKS8 = + { + BLOCK_VANADIUM, + BLOCK_VANADIUMGALLIUM, + BLOCK_WROUGHTIRON, + BLOCK_YTTRBIUM, + BLOCK_YTTRIUM, + BLOCK_YTTRIUMBARIUMCUPRATE, + BLOCK_ZINC, + BLOCK_TUNGSTENCARBIDE, + BLOCK_VANADIUMSTEEL, + BLOCK_HSSG, + BLOCK_HSSE, + BLOCK_HSSS, + BLOCK_STEELEAF, + BLOCK_ICHORIUM, + BLOCK_FIRESTONE, + BLOCK_SHADOW + }, + STORAGE_BLOCKS9 = + { + BLOCK_AERCRYSTAL, + BLOCK_AMBER, + BLOCK_AMETHYST, + BLOCK_AQUACRYSTAL, + BLOCK_BLUETOPAZ, + BLOCK_CERTUSQUARTZ, + BLOCK_DILITHIUM, + BLOCK_ENDEREYE, + BLOCK_ENDERPEARL, + BLOCK_FOOLSRUBY, + BLOCK_FORCE, + BLOCK_FORCICIUM, + BLOCK_FORCILLIUM, + BLOCK_GREENSAPPHIRE, + BLOCK_IGNISCRYSTAL, + BLOCK_JASPER + }, + STORAGE_BLOCKS10 = + { + BLOCK_LAZURITE, + BLOCK_LIGNITE, + BLOCK_MONAZITE, + BLOCK_NITER, + BLOCK_OLIVINE, + BLOCK_OPAL, + BLOCK_ORDOCRYSTAL, + BLOCK_PERDITIOCRYSTAL, + BLOCK_PHOSPHORUS, + BLOCK_QUARTZITE, + BLOCK_REDGARNET, + BLOCK_RUBY, + BLOCK_SAPPHIRE, + BLOCK_SODALITE, + BLOCK_TANZANITE, + BLOCK_TERRACRYSTAL + }, + STORAGE_BLOCKS11 = + { + BLOCK_TOPAZ, + BLOCK_VINTEUM, + BLOCK_YELLOWGARNET, + BLOCK_NETHERSTAR, + BLOCK_CHARCOAL, + BLOCK_BLAZE, + }, + STORAGE_BLOCKS12 = {BLOCK_CRYOLITE, BLOCK_SILICONSG, BLOCK_NICKELALUMINIUM, BLOCK_SPACETIME}; 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[] ERROR_RENDERING = {TextureFactory.of(RENDERING_ERROR)}; public static final ITexture[] OVERLAYS_ENERGY_IN = { - TextureFactory.of(OVERLAY_ENERGY_IN, new short[]{180, 180, 180, 0}), - TextureFactory.of(OVERLAY_ENERGY_IN, new short[]{220, 220, 220, 0}), - TextureFactory.of(OVERLAY_ENERGY_IN, new short[]{255, 100, 0, 0}), - TextureFactory.of(OVERLAY_ENERGY_IN, new short[]{255, 255, 30, 0}), - TextureFactory.of(OVERLAY_ENERGY_IN, new short[]{128, 128, 128, 0}), - TextureFactory.of(OVERLAY_ENERGY_IN, new short[]{240, 240, 245, 0}), - TextureFactory.of(OVERLAY_ENERGY_IN, new short[]{220, 220, 245, 0}), - TextureFactory.of(OVERLAY_ENERGY_IN, new short[]{200, 200, 245, 0}), - TextureFactory.of(OVERLAY_ENERGY_IN, new short[]{180, 180, 245, 0}), - TextureFactory.of(OVERLAY_ENERGY_IN, new short[]{160, 160, 245, 0}), - TextureFactory.of(OVERLAY_ENERGY_IN, new short[]{140, 140, 245, 0}), - TextureFactory.of(OVERLAY_ENERGY_IN, new short[]{120, 120, 245, 0}), - TextureFactory.of(OVERLAY_ENERGY_IN, new short[]{100, 100, 245, 0}), - TextureFactory.of(OVERLAY_ENERGY_IN, new short[]{80, 80, 245, 0}), - TextureFactory.of(OVERLAY_ENERGY_IN, new short[]{60, 60, 245, 0}), - TextureFactory.of(OVERLAY_ENERGY_IN, new short[]{40, 40, 245, 0}), + TextureFactory.of(OVERLAY_ENERGY_IN, new short[] {180, 180, 180, 0}), + TextureFactory.of(OVERLAY_ENERGY_IN, new short[] {220, 220, 220, 0}), + TextureFactory.of(OVERLAY_ENERGY_IN, new short[] {255, 100, 0, 0}), + TextureFactory.of(OVERLAY_ENERGY_IN, new short[] {255, 255, 30, 0}), + TextureFactory.of(OVERLAY_ENERGY_IN, new short[] {128, 128, 128, 0}), + TextureFactory.of(OVERLAY_ENERGY_IN, new short[] {240, 240, 245, 0}), + TextureFactory.of(OVERLAY_ENERGY_IN, new short[] {220, 220, 245, 0}), + TextureFactory.of(OVERLAY_ENERGY_IN, new short[] {200, 200, 245, 0}), + TextureFactory.of(OVERLAY_ENERGY_IN, new short[] {180, 180, 245, 0}), + TextureFactory.of(OVERLAY_ENERGY_IN, new short[] {160, 160, 245, 0}), + TextureFactory.of(OVERLAY_ENERGY_IN, new short[] {140, 140, 245, 0}), + TextureFactory.of(OVERLAY_ENERGY_IN, new short[] {120, 120, 245, 0}), + TextureFactory.of(OVERLAY_ENERGY_IN, new short[] {100, 100, 245, 0}), + TextureFactory.of(OVERLAY_ENERGY_IN, new short[] {80, 80, 245, 0}), + TextureFactory.of(OVERLAY_ENERGY_IN, new short[] {60, 60, 245, 0}), + TextureFactory.of(OVERLAY_ENERGY_IN, new short[] {40, 40, 245, 0}), }; public static ITexture[] OVERLAYS_ENERGY_OUT = { - TextureFactory.of(OVERLAY_ENERGY_OUT, new short[]{180, 180, 180, 0}), - TextureFactory.of(OVERLAY_ENERGY_OUT, new short[]{220, 220, 220, 0}), - TextureFactory.of(OVERLAY_ENERGY_OUT, new short[]{255, 100, 0, 0}), - TextureFactory.of(OVERLAY_ENERGY_OUT, new short[]{255, 255, 30, 0}), - TextureFactory.of(OVERLAY_ENERGY_OUT, new short[]{128, 128, 128, 0}), - TextureFactory.of(OVERLAY_ENERGY_OUT, new short[]{240, 240, 245, 0}), - TextureFactory.of(OVERLAY_ENERGY_OUT, new short[]{220, 220, 245, 0}), - TextureFactory.of(OVERLAY_ENERGY_OUT, new short[]{200, 200, 245, 0}), - TextureFactory.of(OVERLAY_ENERGY_OUT, new short[]{180, 180, 245, 0}), - TextureFactory.of(OVERLAY_ENERGY_OUT, new short[]{160, 160, 245, 0}), - TextureFactory.of(OVERLAY_ENERGY_OUT, new short[]{140, 140, 245, 0}), - TextureFactory.of(OVERLAY_ENERGY_OUT, new short[]{120, 120, 245, 0}), - TextureFactory.of(OVERLAY_ENERGY_OUT, new short[]{100, 100, 245, 0}), - TextureFactory.of(OVERLAY_ENERGY_OUT, new short[]{80, 80, 245, 0}), - TextureFactory.of(OVERLAY_ENERGY_OUT, new short[]{60, 60, 245, 0}), - TextureFactory.of(OVERLAY_ENERGY_OUT, new short[]{40, 40, 245, 0}), + TextureFactory.of(OVERLAY_ENERGY_OUT, new short[] {180, 180, 180, 0}), + TextureFactory.of(OVERLAY_ENERGY_OUT, new short[] {220, 220, 220, 0}), + TextureFactory.of(OVERLAY_ENERGY_OUT, new short[] {255, 100, 0, 0}), + TextureFactory.of(OVERLAY_ENERGY_OUT, new short[] {255, 255, 30, 0}), + TextureFactory.of(OVERLAY_ENERGY_OUT, new short[] {128, 128, 128, 0}), + TextureFactory.of(OVERLAY_ENERGY_OUT, new short[] {240, 240, 245, 0}), + TextureFactory.of(OVERLAY_ENERGY_OUT, new short[] {220, 220, 245, 0}), + TextureFactory.of(OVERLAY_ENERGY_OUT, new short[] {200, 200, 245, 0}), + TextureFactory.of(OVERLAY_ENERGY_OUT, new short[] {180, 180, 245, 0}), + TextureFactory.of(OVERLAY_ENERGY_OUT, new short[] {160, 160, 245, 0}), + TextureFactory.of(OVERLAY_ENERGY_OUT, new short[] {140, 140, 245, 0}), + TextureFactory.of(OVERLAY_ENERGY_OUT, new short[] {120, 120, 245, 0}), + TextureFactory.of(OVERLAY_ENERGY_OUT, new short[] {100, 100, 245, 0}), + TextureFactory.of(OVERLAY_ENERGY_OUT, new short[] {80, 80, 245, 0}), + TextureFactory.of(OVERLAY_ENERGY_OUT, new short[] {60, 60, 245, 0}), + TextureFactory.of(OVERLAY_ENERGY_OUT, new short[] {40, 40, 245, 0}), }; public static final ITexture[] OVERLAYS_ENERGY_IN_MULTI = { - TextureFactory.of(OVERLAY_ENERGY_IN_MULTI, new short[]{180, 180, 180, 0}), - TextureFactory.of(OVERLAY_ENERGY_IN_MULTI, new short[]{220, 220, 220, 0}), - TextureFactory.of(OVERLAY_ENERGY_IN_MULTI, new short[]{255, 100, 0, 0}), - TextureFactory.of(OVERLAY_ENERGY_IN_MULTI, new short[]{255, 255, 30, 0}), - TextureFactory.of(OVERLAY_ENERGY_IN_MULTI, new short[]{128, 128, 128, 0}), - TextureFactory.of(OVERLAY_ENERGY_IN_MULTI, new short[]{240, 240, 245, 0}), - TextureFactory.of(OVERLAY_ENERGY_IN_MULTI, new short[]{220, 220, 245, 0}), - TextureFactory.of(OVERLAY_ENERGY_IN_MULTI, new short[]{200, 200, 245, 0}), - TextureFactory.of(OVERLAY_ENERGY_IN_MULTI, new short[]{180, 180, 245, 0}), - TextureFactory.of(OVERLAY_ENERGY_IN_MULTI, new short[]{160, 160, 245, 0}), - TextureFactory.of(OVERLAY_ENERGY_IN_MULTI, new short[]{140, 140, 245, 0}), - TextureFactory.of(OVERLAY_ENERGY_IN_MULTI, new short[]{120, 120, 245, 0}), - TextureFactory.of(OVERLAY_ENERGY_IN_MULTI, new short[]{100, 100, 245, 0}), - TextureFactory.of(OVERLAY_ENERGY_IN_MULTI, new short[]{80, 80, 245, 0}), - TextureFactory.of(OVERLAY_ENERGY_IN_MULTI, new short[]{60, 60, 245, 0}), - TextureFactory.of(OVERLAY_ENERGY_IN_MULTI, new short[]{40, 40, 245, 0}), + TextureFactory.of(OVERLAY_ENERGY_IN_MULTI, new short[] {180, 180, 180, 0}), + TextureFactory.of(OVERLAY_ENERGY_IN_MULTI, new short[] {220, 220, 220, 0}), + TextureFactory.of(OVERLAY_ENERGY_IN_MULTI, new short[] {255, 100, 0, 0}), + TextureFactory.of(OVERLAY_ENERGY_IN_MULTI, new short[] {255, 255, 30, 0}), + TextureFactory.of(OVERLAY_ENERGY_IN_MULTI, new short[] {128, 128, 128, 0}), + TextureFactory.of(OVERLAY_ENERGY_IN_MULTI, new short[] {240, 240, 245, 0}), + TextureFactory.of(OVERLAY_ENERGY_IN_MULTI, new short[] {220, 220, 245, 0}), + TextureFactory.of(OVERLAY_ENERGY_IN_MULTI, new short[] {200, 200, 245, 0}), + TextureFactory.of(OVERLAY_ENERGY_IN_MULTI, new short[] {180, 180, 245, 0}), + TextureFactory.of(OVERLAY_ENERGY_IN_MULTI, new short[] {160, 160, 245, 0}), + TextureFactory.of(OVERLAY_ENERGY_IN_MULTI, new short[] {140, 140, 245, 0}), + TextureFactory.of(OVERLAY_ENERGY_IN_MULTI, new short[] {120, 120, 245, 0}), + TextureFactory.of(OVERLAY_ENERGY_IN_MULTI, new short[] {100, 100, 245, 0}), + TextureFactory.of(OVERLAY_ENERGY_IN_MULTI, new short[] {80, 80, 245, 0}), + TextureFactory.of(OVERLAY_ENERGY_IN_MULTI, new short[] {60, 60, 245, 0}), + TextureFactory.of(OVERLAY_ENERGY_IN_MULTI, new short[] {40, 40, 245, 0}), }; public static final ITexture[] OVERLAYS_ENERGY_IN_MULTI_WIRELESS_ON = { - TextureFactory.of(OVERLAY_ENERGY_ON_WIRELESS, new short[]{255, 255, 255, 0}), - TextureFactory.of(OVERLAY_ENERGY_ON_WIRELESS, new short[]{255, 255, 255, 0}), - TextureFactory.of(OVERLAY_ENERGY_ON_WIRELESS, new short[]{255, 255, 255, 0}), - TextureFactory.of(OVERLAY_ENERGY_ON_WIRELESS, new short[]{255, 255, 255, 0}), - TextureFactory.of(OVERLAY_ENERGY_ON_WIRELESS, new short[]{255, 255, 255, 0}), - TextureFactory.of(OVERLAY_ENERGY_ON_WIRELESS, new short[]{255, 255, 255, 0}), - TextureFactory.of(OVERLAY_ENERGY_ON_WIRELESS, new short[]{255, 255, 255, 0}), - TextureFactory.of(OVERLAY_ENERGY_ON_WIRELESS, new short[]{255, 255, 255, 0}), - TextureFactory.of(OVERLAY_ENERGY_ON_WIRELESS, new short[]{255, 255, 255, 0}), - TextureFactory.of(OVERLAY_ENERGY_ON_WIRELESS, new short[]{255, 255, 255, 0}), - TextureFactory.of(OVERLAY_ENERGY_ON_WIRELESS, new short[]{255, 255, 255, 0}), - TextureFactory.of(OVERLAY_ENERGY_ON_WIRELESS, new short[]{255, 255, 255, 0}), - TextureFactory.of(OVERLAY_ENERGY_ON_WIRELESS, new short[]{255, 255, 255, 0}), - TextureFactory.of(OVERLAY_ENERGY_ON_WIRELESS, new short[]{255, 255, 255, 0}), - TextureFactory.of(OVERLAY_ENERGY_ON_WIRELESS, new short[]{255, 255, 255, 0}), - TextureFactory.of(OVERLAY_ENERGY_ON_WIRELESS, new short[]{255, 255, 255, 0}), + TextureFactory.of(OVERLAY_ENERGY_ON_WIRELESS, new short[] {255, 255, 255, 0}), + TextureFactory.of(OVERLAY_ENERGY_ON_WIRELESS, new short[] {255, 255, 255, 0}), + TextureFactory.of(OVERLAY_ENERGY_ON_WIRELESS, new short[] {255, 255, 255, 0}), + TextureFactory.of(OVERLAY_ENERGY_ON_WIRELESS, new short[] {255, 255, 255, 0}), + TextureFactory.of(OVERLAY_ENERGY_ON_WIRELESS, new short[] {255, 255, 255, 0}), + TextureFactory.of(OVERLAY_ENERGY_ON_WIRELESS, new short[] {255, 255, 255, 0}), + TextureFactory.of(OVERLAY_ENERGY_ON_WIRELESS, new short[] {255, 255, 255, 0}), + TextureFactory.of(OVERLAY_ENERGY_ON_WIRELESS, new short[] {255, 255, 255, 0}), + TextureFactory.of(OVERLAY_ENERGY_ON_WIRELESS, new short[] {255, 255, 255, 0}), + TextureFactory.of(OVERLAY_ENERGY_ON_WIRELESS, new short[] {255, 255, 255, 0}), + TextureFactory.of(OVERLAY_ENERGY_ON_WIRELESS, new short[] {255, 255, 255, 0}), + TextureFactory.of(OVERLAY_ENERGY_ON_WIRELESS, new short[] {255, 255, 255, 0}), + TextureFactory.of(OVERLAY_ENERGY_ON_WIRELESS, new short[] {255, 255, 255, 0}), + TextureFactory.of(OVERLAY_ENERGY_ON_WIRELESS, new short[] {255, 255, 255, 0}), + TextureFactory.of(OVERLAY_ENERGY_ON_WIRELESS, new short[] {255, 255, 255, 0}), + TextureFactory.of(OVERLAY_ENERGY_ON_WIRELESS, new short[] {255, 255, 255, 0}), }; public static final ITexture[] OVERLAYS_ENERGY_IN_MULTI_WIRELESS_OFF = { - TextureFactory.of(OVERLAY_ENERGY_OFF_WIRELESS, new short[]{0, 0, 0, 0}), - TextureFactory.of(OVERLAY_ENERGY_OFF_WIRELESS, new short[]{0, 0, 0, 0}), - TextureFactory.of(OVERLAY_ENERGY_OFF_WIRELESS, new short[]{0, 0, 0, 0}), - TextureFactory.of(OVERLAY_ENERGY_OFF_WIRELESS, new short[]{0, 0, 0, 0}), - TextureFactory.of(OVERLAY_ENERGY_OFF_WIRELESS, new short[]{0, 0, 0, 0}), - TextureFactory.of(OVERLAY_ENERGY_OFF_WIRELESS, new short[]{0, 0, 0, 0}), - TextureFactory.of(OVERLAY_ENERGY_OFF_WIRELESS, new short[]{0, 0, 0, 0}), - TextureFactory.of(OVERLAY_ENERGY_OFF_WIRELESS, new short[]{0, 0, 0, 0}), - TextureFactory.of(OVERLAY_ENERGY_OFF_WIRELESS, new short[]{0, 0, 0, 0}), - TextureFactory.of(OVERLAY_ENERGY_OFF_WIRELESS, new short[]{0, 0, 0, 0}), - TextureFactory.of(OVERLAY_ENERGY_OFF_WIRELESS, new short[]{0, 0, 0, 0}), - TextureFactory.of(OVERLAY_ENERGY_OFF_WIRELESS, new short[]{0, 0, 0, 0}), - TextureFactory.of(OVERLAY_ENERGY_OFF_WIRELESS, new short[]{0, 0, 0, 0}), - TextureFactory.of(OVERLAY_ENERGY_OFF_WIRELESS, new short[]{0, 0, 0, 0}), - TextureFactory.of(OVERLAY_ENERGY_OFF_WIRELESS, new short[]{0, 0, 0, 0}), - TextureFactory.of(OVERLAY_ENERGY_OFF_WIRELESS, new short[]{0, 0, 0, 0}), + TextureFactory.of(OVERLAY_ENERGY_OFF_WIRELESS, new short[] {0, 0, 0, 0}), + TextureFactory.of(OVERLAY_ENERGY_OFF_WIRELESS, new short[] {0, 0, 0, 0}), + TextureFactory.of(OVERLAY_ENERGY_OFF_WIRELESS, new short[] {0, 0, 0, 0}), + TextureFactory.of(OVERLAY_ENERGY_OFF_WIRELESS, new short[] {0, 0, 0, 0}), + TextureFactory.of(OVERLAY_ENERGY_OFF_WIRELESS, new short[] {0, 0, 0, 0}), + TextureFactory.of(OVERLAY_ENERGY_OFF_WIRELESS, new short[] {0, 0, 0, 0}), + TextureFactory.of(OVERLAY_ENERGY_OFF_WIRELESS, new short[] {0, 0, 0, 0}), + TextureFactory.of(OVERLAY_ENERGY_OFF_WIRELESS, new short[] {0, 0, 0, 0}), + TextureFactory.of(OVERLAY_ENERGY_OFF_WIRELESS, new short[] {0, 0, 0, 0}), + TextureFactory.of(OVERLAY_ENERGY_OFF_WIRELESS, new short[] {0, 0, 0, 0}), + TextureFactory.of(OVERLAY_ENERGY_OFF_WIRELESS, new short[] {0, 0, 0, 0}), + TextureFactory.of(OVERLAY_ENERGY_OFF_WIRELESS, new short[] {0, 0, 0, 0}), + TextureFactory.of(OVERLAY_ENERGY_OFF_WIRELESS, new short[] {0, 0, 0, 0}), + TextureFactory.of(OVERLAY_ENERGY_OFF_WIRELESS, new short[] {0, 0, 0, 0}), + TextureFactory.of(OVERLAY_ENERGY_OFF_WIRELESS, new short[] {0, 0, 0, 0}), + TextureFactory.of(OVERLAY_ENERGY_OFF_WIRELESS, new short[] {0, 0, 0, 0}), }; public static final ITexture[] OVERLAYS_ENERGY_OUT_MULTI = { - TextureFactory.of(OVERLAY_ENERGY_OUT_MULTI, new short[]{180, 180, 180, 0}), - TextureFactory.of(OVERLAY_ENERGY_OUT_MULTI, new short[]{220, 220, 220, 0}), - TextureFactory.of(OVERLAY_ENERGY_OUT_MULTI, new short[]{255, 100, 0, 0}), - TextureFactory.of(OVERLAY_ENERGY_OUT_MULTI, new short[]{255, 255, 30, 0}), - TextureFactory.of(OVERLAY_ENERGY_OUT_MULTI, new short[]{128, 128, 128, 0}), - TextureFactory.of(OVERLAY_ENERGY_OUT_MULTI, new short[]{240, 240, 245, 0}), - TextureFactory.of(OVERLAY_ENERGY_OUT_MULTI, new short[]{220, 220, 245, 0}), - TextureFactory.of(OVERLAY_ENERGY_OUT_MULTI, new short[]{200, 200, 245, 0}), - TextureFactory.of(OVERLAY_ENERGY_OUT_MULTI, new short[]{180, 180, 245, 0}), - TextureFactory.of(OVERLAY_ENERGY_OUT_MULTI, new short[]{160, 160, 245, 0}), - TextureFactory.of(OVERLAY_ENERGY_OUT_MULTI, new short[]{140, 140, 245, 0}), - TextureFactory.of(OVERLAY_ENERGY_OUT_MULTI, new short[]{120, 120, 245, 0}), - TextureFactory.of(OVERLAY_ENERGY_OUT_MULTI, new short[]{100, 100, 245, 0}), - TextureFactory.of(OVERLAY_ENERGY_OUT_MULTI, new short[]{80, 80, 245, 0}), - TextureFactory.of(OVERLAY_ENERGY_OUT_MULTI, new short[]{60, 60, 245, 0}), - TextureFactory.of(OVERLAY_ENERGY_OUT_MULTI, new short[]{40, 40, 245, 0}), + TextureFactory.of(OVERLAY_ENERGY_OUT_MULTI, new short[] {180, 180, 180, 0}), + TextureFactory.of(OVERLAY_ENERGY_OUT_MULTI, new short[] {220, 220, 220, 0}), + TextureFactory.of(OVERLAY_ENERGY_OUT_MULTI, new short[] {255, 100, 0, 0}), + TextureFactory.of(OVERLAY_ENERGY_OUT_MULTI, new short[] {255, 255, 30, 0}), + TextureFactory.of(OVERLAY_ENERGY_OUT_MULTI, new short[] {128, 128, 128, 0}), + TextureFactory.of(OVERLAY_ENERGY_OUT_MULTI, new short[] {240, 240, 245, 0}), + TextureFactory.of(OVERLAY_ENERGY_OUT_MULTI, new short[] {220, 220, 245, 0}), + TextureFactory.of(OVERLAY_ENERGY_OUT_MULTI, new short[] {200, 200, 245, 0}), + TextureFactory.of(OVERLAY_ENERGY_OUT_MULTI, new short[] {180, 180, 245, 0}), + TextureFactory.of(OVERLAY_ENERGY_OUT_MULTI, new short[] {160, 160, 245, 0}), + TextureFactory.of(OVERLAY_ENERGY_OUT_MULTI, new short[] {140, 140, 245, 0}), + TextureFactory.of(OVERLAY_ENERGY_OUT_MULTI, new short[] {120, 120, 245, 0}), + TextureFactory.of(OVERLAY_ENERGY_OUT_MULTI, new short[] {100, 100, 245, 0}), + TextureFactory.of(OVERLAY_ENERGY_OUT_MULTI, new short[] {80, 80, 245, 0}), + TextureFactory.of(OVERLAY_ENERGY_OUT_MULTI, new short[] {60, 60, 245, 0}), + TextureFactory.of(OVERLAY_ENERGY_OUT_MULTI, new short[] {40, 40, 245, 0}), }; public static final ITexture[] OVERLAYS_ENERGY_IN_POWER = { - TextureFactory.of(OVERLAY_ENERGY_IN_POWER, new short[]{180, 180, 180, 0}), - TextureFactory.of(OVERLAY_ENERGY_IN_POWER, new short[]{220, 220, 220, 0}), - TextureFactory.of(OVERLAY_ENERGY_IN_POWER, new short[]{255, 100, 0, 0}), - TextureFactory.of(OVERLAY_ENERGY_IN_POWER, new short[]{255, 255, 30, 0}), - TextureFactory.of(OVERLAY_ENERGY_IN_POWER, new short[]{128, 128, 128, 0}), - TextureFactory.of(OVERLAY_ENERGY_IN_POWER, new short[]{240, 240, 245, 0}), - TextureFactory.of(OVERLAY_ENERGY_IN_POWER, new short[]{220, 220, 245, 0}), - TextureFactory.of(OVERLAY_ENERGY_IN_POWER, new short[]{200, 200, 245, 0}), - TextureFactory.of(OVERLAY_ENERGY_IN_POWER, new short[]{180, 180, 245, 0}), - TextureFactory.of(OVERLAY_ENERGY_IN_POWER, new short[]{160, 160, 245, 0}), - TextureFactory.of(OVERLAY_ENERGY_IN_POWER, new short[]{140, 140, 245, 0}), - TextureFactory.of(OVERLAY_ENERGY_IN_POWER, new short[]{120, 120, 245, 0}), - TextureFactory.of(OVERLAY_ENERGY_IN_POWER, new short[]{100, 100, 245, 0}), - TextureFactory.of(OVERLAY_ENERGY_IN_POWER, new short[]{80, 80, 245, 0}), - TextureFactory.of(OVERLAY_ENERGY_IN_POWER, new short[]{60, 60, 245, 0}), - TextureFactory.of(OVERLAY_ENERGY_IN_POWER, new short[]{40, 40, 245, 0}), + TextureFactory.of(OVERLAY_ENERGY_IN_POWER, new short[] {180, 180, 180, 0}), + TextureFactory.of(OVERLAY_ENERGY_IN_POWER, new short[] {220, 220, 220, 0}), + TextureFactory.of(OVERLAY_ENERGY_IN_POWER, new short[] {255, 100, 0, 0}), + TextureFactory.of(OVERLAY_ENERGY_IN_POWER, new short[] {255, 255, 30, 0}), + TextureFactory.of(OVERLAY_ENERGY_IN_POWER, new short[] {128, 128, 128, 0}), + TextureFactory.of(OVERLAY_ENERGY_IN_POWER, new short[] {240, 240, 245, 0}), + TextureFactory.of(OVERLAY_ENERGY_IN_POWER, new short[] {220, 220, 245, 0}), + TextureFactory.of(OVERLAY_ENERGY_IN_POWER, new short[] {200, 200, 245, 0}), + TextureFactory.of(OVERLAY_ENERGY_IN_POWER, new short[] {180, 180, 245, 0}), + TextureFactory.of(OVERLAY_ENERGY_IN_POWER, new short[] {160, 160, 245, 0}), + TextureFactory.of(OVERLAY_ENERGY_IN_POWER, new short[] {140, 140, 245, 0}), + TextureFactory.of(OVERLAY_ENERGY_IN_POWER, new short[] {120, 120, 245, 0}), + TextureFactory.of(OVERLAY_ENERGY_IN_POWER, new short[] {100, 100, 245, 0}), + TextureFactory.of(OVERLAY_ENERGY_IN_POWER, new short[] {80, 80, 245, 0}), + TextureFactory.of(OVERLAY_ENERGY_IN_POWER, new short[] {60, 60, 245, 0}), + TextureFactory.of(OVERLAY_ENERGY_IN_POWER, new short[] {40, 40, 245, 0}), }; public static final ITexture[] OVERLAYS_ENERGY_OUT_POWER = { - TextureFactory.of(OVERLAY_ENERGY_OUT_POWER, new short[]{180, 180, 180, 0}), - TextureFactory.of(OVERLAY_ENERGY_OUT_POWER, new short[]{220, 220, 220, 0}), - TextureFactory.of(OVERLAY_ENERGY_OUT_POWER, new short[]{255, 100, 0, 0}), - TextureFactory.of(OVERLAY_ENERGY_OUT_POWER, new short[]{255, 255, 30, 0}), - TextureFactory.of(OVERLAY_ENERGY_OUT_POWER, new short[]{128, 128, 128, 0}), - TextureFactory.of(OVERLAY_ENERGY_OUT_POWER, new short[]{240, 240, 245, 0}), - TextureFactory.of(OVERLAY_ENERGY_OUT_POWER, new short[]{220, 220, 245, 0}), - TextureFactory.of(OVERLAY_ENERGY_OUT_POWER, new short[]{200, 200, 245, 0}), - TextureFactory.of(OVERLAY_ENERGY_OUT_POWER, new short[]{180, 180, 245, 0}), - TextureFactory.of(OVERLAY_ENERGY_OUT_POWER, new short[]{160, 160, 245, 0}), - TextureFactory.of(OVERLAY_ENERGY_OUT_POWER, new short[]{140, 140, 245, 0}), - TextureFactory.of(OVERLAY_ENERGY_OUT_POWER, new short[]{120, 120, 245, 0}), - TextureFactory.of(OVERLAY_ENERGY_OUT_POWER, new short[]{100, 100, 245, 0}), - TextureFactory.of(OVERLAY_ENERGY_OUT_POWER, new short[]{80, 80, 245, 0}), - TextureFactory.of(OVERLAY_ENERGY_OUT_POWER, new short[]{60, 60, 245, 0}), - TextureFactory.of(OVERLAY_ENERGY_OUT_POWER, new short[]{40, 40, 245, 0}), + TextureFactory.of(OVERLAY_ENERGY_OUT_POWER, new short[] {180, 180, 180, 0}), + TextureFactory.of(OVERLAY_ENERGY_OUT_POWER, new short[] {220, 220, 220, 0}), + TextureFactory.of(OVERLAY_ENERGY_OUT_POWER, new short[] {255, 100, 0, 0}), + TextureFactory.of(OVERLAY_ENERGY_OUT_POWER, new short[] {255, 255, 30, 0}), + TextureFactory.of(OVERLAY_ENERGY_OUT_POWER, new short[] {128, 128, 128, 0}), + TextureFactory.of(OVERLAY_ENERGY_OUT_POWER, new short[] {240, 240, 245, 0}), + TextureFactory.of(OVERLAY_ENERGY_OUT_POWER, new short[] {220, 220, 245, 0}), + TextureFactory.of(OVERLAY_ENERGY_OUT_POWER, new short[] {200, 200, 245, 0}), + TextureFactory.of(OVERLAY_ENERGY_OUT_POWER, new short[] {180, 180, 245, 0}), + TextureFactory.of(OVERLAY_ENERGY_OUT_POWER, new short[] {160, 160, 245, 0}), + TextureFactory.of(OVERLAY_ENERGY_OUT_POWER, new short[] {140, 140, 245, 0}), + TextureFactory.of(OVERLAY_ENERGY_OUT_POWER, new short[] {120, 120, 245, 0}), + TextureFactory.of(OVERLAY_ENERGY_OUT_POWER, new short[] {100, 100, 245, 0}), + TextureFactory.of(OVERLAY_ENERGY_OUT_POWER, new short[] {80, 80, 245, 0}), + TextureFactory.of(OVERLAY_ENERGY_OUT_POWER, new short[] {60, 60, 245, 0}), + TextureFactory.of(OVERLAY_ENERGY_OUT_POWER, new short[] {40, 40, 245, 0}), }; public static final ITexture[] LOCKERS = { TextureFactory.of(OVERLAY_LOCKER_000), @@ -1969,7 +1992,8 @@ public class Textures { * USE casingTexturePages[page] instead of CASING_BLOCKS since it is casingTexturePages[0] */ @Deprecated - public static ITexture[] CASING_BLOCKS = new ITexture[128];//original variable still limited to 128 + public static ITexture[] CASING_BLOCKS = new ITexture[128]; // original variable still limited to 128 + public static ITexture[][] MACHINE_CASINGS = new ITexture[15][17]; /** * by Default pages are null @@ -1980,7 +2004,9 @@ public class Textures { * page 12: 0-127 GlodBlock * page 42: 0-126 glee8e, 127 KekzTech LSC base */ - public static ITexture[][] casingTexturePages = new ITexture[128][];//page holder so we don't make an short long array + public static ITexture[][] casingTexturePages = + new ITexture[128][]; // page holder so we don't make an short long array + public static final int ERROR_TEXTURE_INDEX = (1 << 7) + 97; private static final Map<ITexture, Integer> reverseMap = new HashMap<>(); @@ -1988,11 +2014,12 @@ public class Textures { for (byte i = 0; i < MACHINE_CASINGS.length; i++) for (byte j = 0; j < MACHINE_CASINGS[i].length; j++) MACHINE_CASINGS[i][j] = TextureFactory.of( - MACHINECASINGS_BOTTOM[i], - MACHINECASINGS_TOP[i], - MACHINECASINGS_SIDE[i], Dyes.getModulation(j - 1, Dyes.MACHINE_METAL.mRGBa)); + MACHINECASINGS_BOTTOM[i], + MACHINECASINGS_TOP[i], + MACHINECASINGS_SIDE[i], + Dyes.getModulation(j - 1, Dyes.MACHINE_METAL.mRGBa)); casingTexturePages[0] = new ITexture[128]; - //adds some known pages, modders also can do it... + // adds some known pages, modders also can do it... GT_Utility.addTexturePage((byte) 1); GT_Utility.addTexturePage((byte) 8); setCasingTextureForId(ERROR_TEXTURE_INDEX, ERROR_RENDERING[0]); @@ -2071,7 +2098,6 @@ public class Textures { public ResourceLocation getTextureFile() { return TextureMap.locationBlocksTexture; } - } } @@ -2122,30 +2148,31 @@ public class Textures { TURBINE_SMALL, TURBINE_LARGE, TURBINE_HUGE; - public static final IIconContainer[] - DURABILITY_BAR = { - DURABILITY_BAR_0, - DURABILITY_BAR_1, - DURABILITY_BAR_2, - DURABILITY_BAR_3, - DURABILITY_BAR_4, - DURABILITY_BAR_5, - DURABILITY_BAR_6, - DURABILITY_BAR_7, - DURABILITY_BAR_8, - }, - ENERGY_BAR = { - ENERGY_BAR_0, - ENERGY_BAR_1, - ENERGY_BAR_2, - ENERGY_BAR_3, - ENERGY_BAR_4, - ENERGY_BAR_5, - ENERGY_BAR_6, - ENERGY_BAR_7, - ENERGY_BAR_8, - }; + DURABILITY_BAR = + { + DURABILITY_BAR_0, + DURABILITY_BAR_1, + DURABILITY_BAR_2, + DURABILITY_BAR_3, + DURABILITY_BAR_4, + DURABILITY_BAR_5, + DURABILITY_BAR_6, + DURABILITY_BAR_7, + DURABILITY_BAR_8, + }, + ENERGY_BAR = + { + ENERGY_BAR_0, + ENERGY_BAR_1, + ENERGY_BAR_2, + ENERGY_BAR_3, + ENERGY_BAR_4, + ENERGY_BAR_5, + ENERGY_BAR_6, + ENERGY_BAR_7, + ENERGY_BAR_8, + }; public static final ITexture[] ERROR_RENDERING = {TextureFactory.of(RENDERING_ERROR)}; diff --git a/src/main/java/gregtech/api/enums/Tier.java b/src/main/java/gregtech/api/enums/Tier.java index c812fd6c08..bef43f92ae 100644 --- a/src/main/java/gregtech/api/enums/Tier.java +++ b/src/main/java/gregtech/api/enums/Tier.java @@ -7,64 +7,470 @@ import static gregtech.api.enums.GT_Values.V; */ public class Tier { public static final Tier[] - ELECTRIC = new Tier[]{ - new Tier(SubTag.ENERGY_ELECTRICITY, 0, V[0], 1, 1, 1, Materials.WroughtIron, ItemList.Hull_ULV, OrePrefixes.cableGt01.get(Materials.Lead), OrePrefixes.cableGt04.get(Materials.Lead), OrePrefixes.circuit.get(Materials.Primitive), OrePrefixes.circuit.get(Materials.Basic)), - new Tier(SubTag.ENERGY_ELECTRICITY, 1, V[1], 1, 1, 1, Materials.Steel, ItemList.Hull_LV, OrePrefixes.cableGt01.get(Materials.Tin), OrePrefixes.cableGt04.get(Materials.Tin), OrePrefixes.circuit.get(Materials.Basic), OrePrefixes.circuit.get(Materials.Good)), - new Tier(SubTag.ENERGY_ELECTRICITY, 2, V[2], 1, 1, 1, Materials.Aluminium, ItemList.Hull_MV, OrePrefixes.cableGt01.get(Materials.AnyCopper), OrePrefixes.cableGt04.get(Materials.AnyCopper), OrePrefixes.circuit.get(Materials.Good), OrePrefixes.circuit.get(Materials.Advanced)), - new Tier(SubTag.ENERGY_ELECTRICITY, 3, V[3], 1, 1, 1, Materials.StainlessSteel, ItemList.Hull_HV, OrePrefixes.cableGt01.get(Materials.Gold), OrePrefixes.cableGt04.get(Materials.Gold), OrePrefixes.circuit.get(Materials.Advanced), OrePrefixes.circuit.get(Materials.Data)), - new Tier(SubTag.ENERGY_ELECTRICITY, 4, V[4], 1, 1, 1, Materials.Titanium, ItemList.Hull_EV, OrePrefixes.cableGt01.get(Materials.Aluminium), OrePrefixes.cableGt04.get(Materials.Aluminium), OrePrefixes.circuit.get(Materials.Data), OrePrefixes.circuit.get(Materials.Elite)), - new Tier(SubTag.ENERGY_ELECTRICITY, 5, V[5], 1, 1, 1, Materials.TungstenSteel, ItemList.Hull_IV, OrePrefixes.cableGt01.get(Materials.Platinum), OrePrefixes.cableGt04.get(Materials.Platinum), OrePrefixes.circuit.get(Materials.Elite), OrePrefixes.circuit.get(Materials.Master)), - new Tier(SubTag.ENERGY_ELECTRICITY, 6, V[6], 1, 1, 1, Materials.Chrome, ItemList.Hull_LuV, OrePrefixes.cableGt01.get(Materials.NiobiumTitanium), OrePrefixes.cableGt04.get(Materials.NiobiumTitanium), OrePrefixes.circuit.get(Materials.Master), OrePrefixes.circuit.get(Materials.Ultimate)), - new Tier(SubTag.ENERGY_ELECTRICITY, 7, V[7], 1, 1, 1, Materials.Iridium, ItemList.Hull_ZPM, OrePrefixes.cableGt01.get(Materials.Naquadah), OrePrefixes.cableGt04.get(Materials.Naquadah), OrePrefixes.circuit.get(Materials.Ultimate), OrePrefixes.circuit.get(Materials.Superconductor)), - new Tier(SubTag.ENERGY_ELECTRICITY, 8, V[8], 1, 1, 1, Materials.Osmium, ItemList.Hull_UV, OrePrefixes.cableGt04.get(Materials.NaquadahAlloy), OrePrefixes.wireGt01.get(Materials.SuperconductorUHV), OrePrefixes.circuit.get(Materials.Superconductor), OrePrefixes.circuit.get(Materials.Infinite)), - new Tier(SubTag.ENERGY_ELECTRICITY, 9, V[9], 1, 1, 1, Materials.Neutronium, ItemList.Hull_MAX, OrePrefixes.wireGt01.get(Materials.SuperconductorUHV), OrePrefixes.wireGt04.get(Materials.SuperconductorUHV), OrePrefixes.circuit.get(Materials.Infinite), OrePrefixes.circuit.get(Materials.Infinite)), - new Tier(SubTag.ENERGY_ELECTRICITY,10, V[10], 1, 1, 1, Materials.Neutronium, ItemList.Hull_MAX, OrePrefixes.wireGt01.get(Materials.SuperconductorUHV), OrePrefixes.wireGt04.get(Materials.SuperconductorUHV), OrePrefixes.circuit.get(Materials.Infinite), OrePrefixes.circuit.get(Materials.Infinite)), - new Tier(SubTag.ENERGY_ELECTRICITY,11, V[11], 1, 1, 1, Materials.Neutronium, ItemList.Hull_MAX, OrePrefixes.wireGt01.get(Materials.SuperconductorUHV), OrePrefixes.wireGt04.get(Materials.SuperconductorUHV), OrePrefixes.circuit.get(Materials.Infinite), OrePrefixes.circuit.get(Materials.Infinite)), - new Tier(SubTag.ENERGY_ELECTRICITY,12, V[12], 1, 1, 1, Materials.Neutronium, ItemList.Hull_MAX, OrePrefixes.wireGt01.get(Materials.SuperconductorUHV), OrePrefixes.wireGt04.get(Materials.SuperconductorUHV), OrePrefixes.circuit.get(Materials.Infinite), OrePrefixes.circuit.get(Materials.Infinite)), - new Tier(SubTag.ENERGY_ELECTRICITY,13, V[13], 1, 1, 1, Materials.Neutronium, ItemList.Hull_MAX, OrePrefixes.wireGt01.get(Materials.SuperconductorUHV), OrePrefixes.wireGt04.get(Materials.SuperconductorUHV), OrePrefixes.circuit.get(Materials.Infinite), OrePrefixes.circuit.get(Materials.Infinite)), - new Tier(SubTag.ENERGY_ELECTRICITY,14, V[14], 1, 1, 1, Materials.Neutronium, ItemList.Hull_MAX, OrePrefixes.wireGt01.get(Materials.SuperconductorUHV), OrePrefixes.wireGt04.get(Materials.SuperconductorUHV), OrePrefixes.circuit.get(Materials.Infinite), OrePrefixes.circuit.get(Materials.Infinite)), - new Tier(SubTag.ENERGY_ELECTRICITY,15, V[15], 1, 1, 1, Materials.Neutronium, ItemList.Hull_MAX, OrePrefixes.wireGt01.get(Materials.SuperconductorUHV), OrePrefixes.wireGt04.get(Materials.SuperconductorUHV), OrePrefixes.circuit.get(Materials.Infinite), OrePrefixes.circuit.get(Materials.Infinite)), + ELECTRIC = + new Tier[] { + new Tier( + SubTag.ENERGY_ELECTRICITY, + 0, + V[0], + 1, + 1, + 1, + Materials.WroughtIron, + ItemList.Hull_ULV, + OrePrefixes.cableGt01.get(Materials.Lead), + OrePrefixes.cableGt04.get(Materials.Lead), + OrePrefixes.circuit.get(Materials.Primitive), + OrePrefixes.circuit.get(Materials.Basic)), + new Tier( + SubTag.ENERGY_ELECTRICITY, + 1, + V[1], + 1, + 1, + 1, + Materials.Steel, + ItemList.Hull_LV, + OrePrefixes.cableGt01.get(Materials.Tin), + OrePrefixes.cableGt04.get(Materials.Tin), + OrePrefixes.circuit.get(Materials.Basic), + OrePrefixes.circuit.get(Materials.Good)), + new Tier( + SubTag.ENERGY_ELECTRICITY, + 2, + V[2], + 1, + 1, + 1, + Materials.Aluminium, + ItemList.Hull_MV, + OrePrefixes.cableGt01.get(Materials.AnyCopper), + OrePrefixes.cableGt04.get(Materials.AnyCopper), + OrePrefixes.circuit.get(Materials.Good), + OrePrefixes.circuit.get(Materials.Advanced)), + new Tier( + SubTag.ENERGY_ELECTRICITY, + 3, + V[3], + 1, + 1, + 1, + Materials.StainlessSteel, + ItemList.Hull_HV, + OrePrefixes.cableGt01.get(Materials.Gold), + OrePrefixes.cableGt04.get(Materials.Gold), + OrePrefixes.circuit.get(Materials.Advanced), + OrePrefixes.circuit.get(Materials.Data)), + new Tier( + SubTag.ENERGY_ELECTRICITY, + 4, + V[4], + 1, + 1, + 1, + Materials.Titanium, + ItemList.Hull_EV, + OrePrefixes.cableGt01.get(Materials.Aluminium), + OrePrefixes.cableGt04.get(Materials.Aluminium), + OrePrefixes.circuit.get(Materials.Data), + OrePrefixes.circuit.get(Materials.Elite)), + new Tier( + SubTag.ENERGY_ELECTRICITY, + 5, + V[5], + 1, + 1, + 1, + Materials.TungstenSteel, + ItemList.Hull_IV, + OrePrefixes.cableGt01.get(Materials.Platinum), + OrePrefixes.cableGt04.get(Materials.Platinum), + OrePrefixes.circuit.get(Materials.Elite), + OrePrefixes.circuit.get(Materials.Master)), + new Tier( + SubTag.ENERGY_ELECTRICITY, + 6, + V[6], + 1, + 1, + 1, + Materials.Chrome, + ItemList.Hull_LuV, + OrePrefixes.cableGt01.get(Materials.NiobiumTitanium), + OrePrefixes.cableGt04.get(Materials.NiobiumTitanium), + OrePrefixes.circuit.get(Materials.Master), + OrePrefixes.circuit.get(Materials.Ultimate)), + new Tier( + SubTag.ENERGY_ELECTRICITY, + 7, + V[7], + 1, + 1, + 1, + Materials.Iridium, + ItemList.Hull_ZPM, + OrePrefixes.cableGt01.get(Materials.Naquadah), + OrePrefixes.cableGt04.get(Materials.Naquadah), + OrePrefixes.circuit.get(Materials.Ultimate), + OrePrefixes.circuit.get(Materials.Superconductor)), + new Tier( + SubTag.ENERGY_ELECTRICITY, + 8, + V[8], + 1, + 1, + 1, + Materials.Osmium, + ItemList.Hull_UV, + OrePrefixes.cableGt04.get(Materials.NaquadahAlloy), + OrePrefixes.wireGt01.get(Materials.SuperconductorUHV), + OrePrefixes.circuit.get(Materials.Superconductor), + OrePrefixes.circuit.get(Materials.Infinite)), + new Tier( + SubTag.ENERGY_ELECTRICITY, + 9, + V[9], + 1, + 1, + 1, + Materials.Neutronium, + ItemList.Hull_MAX, + OrePrefixes.wireGt01.get(Materials.SuperconductorUHV), + OrePrefixes.wireGt04.get(Materials.SuperconductorUHV), + OrePrefixes.circuit.get(Materials.Infinite), + OrePrefixes.circuit.get(Materials.Infinite)), + new Tier( + SubTag.ENERGY_ELECTRICITY, + 10, + V[10], + 1, + 1, + 1, + Materials.Neutronium, + ItemList.Hull_MAX, + OrePrefixes.wireGt01.get(Materials.SuperconductorUHV), + OrePrefixes.wireGt04.get(Materials.SuperconductorUHV), + OrePrefixes.circuit.get(Materials.Infinite), + OrePrefixes.circuit.get(Materials.Infinite)), + new Tier( + SubTag.ENERGY_ELECTRICITY, + 11, + V[11], + 1, + 1, + 1, + Materials.Neutronium, + ItemList.Hull_MAX, + OrePrefixes.wireGt01.get(Materials.SuperconductorUHV), + OrePrefixes.wireGt04.get(Materials.SuperconductorUHV), + OrePrefixes.circuit.get(Materials.Infinite), + OrePrefixes.circuit.get(Materials.Infinite)), + new Tier( + SubTag.ENERGY_ELECTRICITY, + 12, + V[12], + 1, + 1, + 1, + Materials.Neutronium, + ItemList.Hull_MAX, + OrePrefixes.wireGt01.get(Materials.SuperconductorUHV), + OrePrefixes.wireGt04.get(Materials.SuperconductorUHV), + OrePrefixes.circuit.get(Materials.Infinite), + OrePrefixes.circuit.get(Materials.Infinite)), + new Tier( + SubTag.ENERGY_ELECTRICITY, + 13, + V[13], + 1, + 1, + 1, + Materials.Neutronium, + ItemList.Hull_MAX, + OrePrefixes.wireGt01.get(Materials.SuperconductorUHV), + OrePrefixes.wireGt04.get(Materials.SuperconductorUHV), + OrePrefixes.circuit.get(Materials.Infinite), + OrePrefixes.circuit.get(Materials.Infinite)), + new Tier( + SubTag.ENERGY_ELECTRICITY, + 14, + V[14], + 1, + 1, + 1, + Materials.Neutronium, + ItemList.Hull_MAX, + OrePrefixes.wireGt01.get(Materials.SuperconductorUHV), + OrePrefixes.wireGt04.get(Materials.SuperconductorUHV), + OrePrefixes.circuit.get(Materials.Infinite), + OrePrefixes.circuit.get(Materials.Infinite)), + new Tier( + SubTag.ENERGY_ELECTRICITY, + 15, + V[15], + 1, + 1, + 1, + Materials.Neutronium, + ItemList.Hull_MAX, + OrePrefixes.wireGt01.get(Materials.SuperconductorUHV), + OrePrefixes.wireGt04.get(Materials.SuperconductorUHV), + OrePrefixes.circuit.get(Materials.Infinite), + OrePrefixes.circuit.get(Materials.Infinite)), - //READ GT_VALUES CLASS BEFORE YOU START ADDING STUFF TO TIERS 8+ - and probably dont do it in GT but in GTNH core mod - that way we shouldnt need to set the tier class - }, ROTATIONAL = new Tier[]{ - new Tier(SubTag.ENERGY_ROTATIONAL, 1, 32, 1, 1, 1, Materials.Wood, OrePrefixes.frameGt.get(Materials.Wood), OrePrefixes.stick.get(Materials.Wood), OrePrefixes.ingot.get(Materials.Wood), OrePrefixes.gearGt.get(Materials.Wood), OrePrefixes.gearGt.get(Materials.Stone)), - new Tier(SubTag.ENERGY_ROTATIONAL, 1, 32, 1, 2, 2, Materials.WoodSealed, OrePrefixes.frameGt.get(Materials.WoodSealed), OrePrefixes.stick.get(Materials.WoodSealed), OrePrefixes.ingot.get(Materials.WoodSealed), OrePrefixes.gearGt.get(Materials.WoodSealed), OrePrefixes.gearGt.get(Materials.Stone)), - new Tier(SubTag.ENERGY_ROTATIONAL, 2, 128, 1, 1, 1, Materials.Stone, OrePrefixes.frameGt.get(Materials.Stone), OrePrefixes.stick.get(Materials.Stone), OrePrefixes.ingot.get(Materials.Stone), OrePrefixes.gearGt.get(Materials.Stone), OrePrefixes.gearGt.get(Materials.Bronze)), - new Tier(SubTag.ENERGY_ROTATIONAL, 2, 128, 1, 2, 2, Materials.IronWood, OrePrefixes.frameGt.get(Materials.IronWood), OrePrefixes.stick.get(Materials.IronWood), OrePrefixes.ingot.get(Materials.IronWood), OrePrefixes.gearGt.get(Materials.IronWood), OrePrefixes.gearGt.get(Materials.Bronze)), - new Tier(SubTag.ENERGY_ROTATIONAL, 3, 512, 1, 1, 1, Materials.Bronze, OrePrefixes.frameGt.get(Materials.Bronze), OrePrefixes.stick.get(Materials.Bronze), OrePrefixes.ingot.get(Materials.Bronze), OrePrefixes.gearGt.get(Materials.Bronze), OrePrefixes.gearGt.get(Materials.Steel)), - new Tier(SubTag.ENERGY_ROTATIONAL, 3, 512, 1, 2, 2, Materials.Brass, OrePrefixes.frameGt.get(Materials.Brass), OrePrefixes.stick.get(Materials.Brass), OrePrefixes.ingot.get(Materials.Brass), OrePrefixes.gearGt.get(Materials.Brass), OrePrefixes.gearGt.get(Materials.Steel)), - new Tier(SubTag.ENERGY_ROTATIONAL, 4, 2048, 1, 1, 1, Materials.Steel, OrePrefixes.frameGt.get(Materials.Steel), OrePrefixes.stick.get(Materials.Steel), OrePrefixes.ingot.get(Materials.Steel), OrePrefixes.gearGt.get(Materials.Steel), OrePrefixes.gearGt.get(Materials.TungstenSteel)), - new Tier(SubTag.ENERGY_ROTATIONAL, 4, 2048, 1, 2, 2, Materials.Titanium, OrePrefixes.frameGt.get(Materials.Titanium), OrePrefixes.stick.get(Materials.Titanium), OrePrefixes.ingot.get(Materials.Titanium), OrePrefixes.gearGt.get(Materials.Titanium), OrePrefixes.gearGt.get(Materials.TungstenSteel)), - new Tier(SubTag.ENERGY_ROTATIONAL, 5, 8192, 1, 1, 1, Materials.TungstenSteel, OrePrefixes.frameGt.get(Materials.TungstenSteel), OrePrefixes.stick.get(Materials.TungstenSteel), OrePrefixes.ingot.get(Materials.TungstenSteel), OrePrefixes.gearGt.get(Materials.TungstenSteel), OrePrefixes.gearGt.get(Materials.Iridium)), - new Tier(SubTag.ENERGY_ROTATIONAL, 6, 32768, 1, 1, 1, Materials.Iridium, OrePrefixes.frameGt.get(Materials.Iridium), OrePrefixes.stick.get(Materials.Iridium), OrePrefixes.ingot.get(Materials.Iridium), OrePrefixes.gearGt.get(Materials.Iridium), OrePrefixes.gearGt.get(Materials.Neutronium)), - new Tier(SubTag.ENERGY_ROTATIONAL, 9, Integer.MAX_VALUE-7, 1, 1, 1, Materials.Neutronium, OrePrefixes.frameGt.get(Materials.Neutronium), OrePrefixes.stick.get(Materials.Neutronium), OrePrefixes.ingot.get(Materials.Neutronium), OrePrefixes.gearGt.get(Materials.Neutronium), OrePrefixes.gearGt.get(Materials.Neutronium)), - }, STEAM = new Tier[]{ - new Tier(SubTag.ENERGY_STEAM, 1, 32, 1, 1, 1, Materials.Bronze, OrePrefixes.frameGt.get(Materials.Bronze), OrePrefixes.pipeMedium.get(Materials.Bronze), OrePrefixes.pipeHuge.get(Materials.Bronze), OrePrefixes.pipeMedium.get(Materials.Bronze), OrePrefixes.pipeLarge.get(Materials.Bronze)), - new Tier(SubTag.ENERGY_STEAM, 2, 128, 1, 1, 1, Materials.Steel, OrePrefixes.frameGt.get(Materials.Steel), OrePrefixes.pipeMedium.get(Materials.Steel), OrePrefixes.pipeHuge.get(Materials.Steel), OrePrefixes.pipeMedium.get(Materials.Steel), OrePrefixes.pipeLarge.get(Materials.Steel)), - new Tier(SubTag.ENERGY_STEAM, 3, 512, 1, 1, 1, Materials.Titanium, OrePrefixes.frameGt.get(Materials.Titanium), OrePrefixes.pipeMedium.get(Materials.Titanium), OrePrefixes.pipeHuge.get(Materials.Titanium), OrePrefixes.pipeMedium.get(Materials.Titanium), OrePrefixes.pipeLarge.get(Materials.Titanium)), - new Tier(SubTag.ENERGY_STEAM, 4, 2048, 1, 1, 1, Materials.TungstenSteel, OrePrefixes.frameGt.get(Materials.TungstenSteel), OrePrefixes.pipeMedium.get(Materials.TungstenSteel), OrePrefixes.pipeHuge.get(Materials.TungstenSteel), OrePrefixes.pipeMedium.get(Materials.TungstenSteel), OrePrefixes.pipeLarge.get(Materials.TungstenSteel)), - new Tier(SubTag.ENERGY_STEAM, 5, 8192, 1, 1, 1, Materials.Iridium, OrePrefixes.frameGt.get(Materials.Iridium), OrePrefixes.pipeMedium.get(Materials.Iridium), OrePrefixes.pipeHuge.get(Materials.Iridium), OrePrefixes.pipeMedium.get(Materials.Iridium), OrePrefixes.pipeLarge.get(Materials.Iridium)), - new Tier(SubTag.ENERGY_STEAM, 9, Integer.MAX_VALUE - 7, 1, 1, 1, Materials.Neutronium, OrePrefixes.frameGt.get(Materials.Neutronium), OrePrefixes.pipeMedium.get(Materials.Neutronium), OrePrefixes.pipeHuge.get(Materials.Neutronium), OrePrefixes.pipeMedium.get(Materials.Neutronium), OrePrefixes.pipeLarge.get(Materials.Neutronium)), - }; + // READ GT_VALUES CLASS BEFORE YOU START ADDING STUFF TO TIERS 8+ - and probably dont do it in + // GT but in GTNH core mod - that way we shouldnt need to set the tier class + }, + ROTATIONAL = + new Tier[] { + new Tier( + SubTag.ENERGY_ROTATIONAL, + 1, + 32, + 1, + 1, + 1, + Materials.Wood, + OrePrefixes.frameGt.get(Materials.Wood), + OrePrefixes.stick.get(Materials.Wood), + OrePrefixes.ingot.get(Materials.Wood), + OrePrefixes.gearGt.get(Materials.Wood), + OrePrefixes.gearGt.get(Materials.Stone)), + new Tier( + SubTag.ENERGY_ROTATIONAL, + 1, + 32, + 1, + 2, + 2, + Materials.WoodSealed, + OrePrefixes.frameGt.get(Materials.WoodSealed), + OrePrefixes.stick.get(Materials.WoodSealed), + OrePrefixes.ingot.get(Materials.WoodSealed), + OrePrefixes.gearGt.get(Materials.WoodSealed), + OrePrefixes.gearGt.get(Materials.Stone)), + new Tier( + SubTag.ENERGY_ROTATIONAL, + 2, + 128, + 1, + 1, + 1, + Materials.Stone, + OrePrefixes.frameGt.get(Materials.Stone), + OrePrefixes.stick.get(Materials.Stone), + OrePrefixes.ingot.get(Materials.Stone), + OrePrefixes.gearGt.get(Materials.Stone), + OrePrefixes.gearGt.get(Materials.Bronze)), + new Tier( + SubTag.ENERGY_ROTATIONAL, + 2, + 128, + 1, + 2, + 2, + Materials.IronWood, + OrePrefixes.frameGt.get(Materials.IronWood), + OrePrefixes.stick.get(Materials.IronWood), + OrePrefixes.ingot.get(Materials.IronWood), + OrePrefixes.gearGt.get(Materials.IronWood), + OrePrefixes.gearGt.get(Materials.Bronze)), + new Tier( + SubTag.ENERGY_ROTATIONAL, + 3, + 512, + 1, + 1, + 1, + Materials.Bronze, + OrePrefixes.frameGt.get(Materials.Bronze), + OrePrefixes.stick.get(Materials.Bronze), + OrePrefixes.ingot.get(Materials.Bronze), + OrePrefixes.gearGt.get(Materials.Bronze), + OrePrefixes.gearGt.get(Materials.Steel)), + new Tier( + SubTag.ENERGY_ROTATIONAL, + 3, + 512, + 1, + 2, + 2, + Materials.Brass, + OrePrefixes.frameGt.get(Materials.Brass), + OrePrefixes.stick.get(Materials.Brass), + OrePrefixes.ingot.get(Materials.Brass), + OrePrefixes.gearGt.get(Materials.Brass), + OrePrefixes.gearGt.get(Materials.Steel)), + new Tier( + SubTag.ENERGY_ROTATIONAL, + 4, + 2048, + 1, + 1, + 1, + Materials.Steel, + OrePrefixes.frameGt.get(Materials.Steel), + OrePrefixes.stick.get(Materials.Steel), + OrePrefixes.ingot.get(Materials.Steel), + OrePrefixes.gearGt.get(Materials.Steel), + OrePrefixes.gearGt.get(Materials.TungstenSteel)), + new Tier( + SubTag.ENERGY_ROTATIONAL, + 4, + 2048, + 1, + 2, + 2, + Materials.Titanium, + OrePrefixes.frameGt.get(Materials.Titanium), + OrePrefixes.stick.get(Materials.Titanium), + OrePrefixes.ingot.get(Materials.Titanium), + OrePrefixes.gearGt.get(Materials.Titanium), + OrePrefixes.gearGt.get(Materials.TungstenSteel)), + new Tier( + SubTag.ENERGY_ROTATIONAL, + 5, + 8192, + 1, + 1, + 1, + Materials.TungstenSteel, + OrePrefixes.frameGt.get(Materials.TungstenSteel), + OrePrefixes.stick.get(Materials.TungstenSteel), + OrePrefixes.ingot.get(Materials.TungstenSteel), + OrePrefixes.gearGt.get(Materials.TungstenSteel), + OrePrefixes.gearGt.get(Materials.Iridium)), + new Tier( + SubTag.ENERGY_ROTATIONAL, + 6, + 32768, + 1, + 1, + 1, + Materials.Iridium, + OrePrefixes.frameGt.get(Materials.Iridium), + OrePrefixes.stick.get(Materials.Iridium), + OrePrefixes.ingot.get(Materials.Iridium), + OrePrefixes.gearGt.get(Materials.Iridium), + OrePrefixes.gearGt.get(Materials.Neutronium)), + new Tier( + SubTag.ENERGY_ROTATIONAL, + 9, + Integer.MAX_VALUE - 7, + 1, + 1, + 1, + Materials.Neutronium, + OrePrefixes.frameGt.get(Materials.Neutronium), + OrePrefixes.stick.get(Materials.Neutronium), + OrePrefixes.ingot.get(Materials.Neutronium), + OrePrefixes.gearGt.get(Materials.Neutronium), + OrePrefixes.gearGt.get(Materials.Neutronium)), + }, + STEAM = + new Tier[] { + new Tier( + SubTag.ENERGY_STEAM, + 1, + 32, + 1, + 1, + 1, + Materials.Bronze, + OrePrefixes.frameGt.get(Materials.Bronze), + OrePrefixes.pipeMedium.get(Materials.Bronze), + OrePrefixes.pipeHuge.get(Materials.Bronze), + OrePrefixes.pipeMedium.get(Materials.Bronze), + OrePrefixes.pipeLarge.get(Materials.Bronze)), + new Tier( + SubTag.ENERGY_STEAM, + 2, + 128, + 1, + 1, + 1, + Materials.Steel, + OrePrefixes.frameGt.get(Materials.Steel), + OrePrefixes.pipeMedium.get(Materials.Steel), + OrePrefixes.pipeHuge.get(Materials.Steel), + OrePrefixes.pipeMedium.get(Materials.Steel), + OrePrefixes.pipeLarge.get(Materials.Steel)), + new Tier( + SubTag.ENERGY_STEAM, + 3, + 512, + 1, + 1, + 1, + Materials.Titanium, + OrePrefixes.frameGt.get(Materials.Titanium), + OrePrefixes.pipeMedium.get(Materials.Titanium), + OrePrefixes.pipeHuge.get(Materials.Titanium), + OrePrefixes.pipeMedium.get(Materials.Titanium), + OrePrefixes.pipeLarge.get(Materials.Titanium)), + new Tier( + SubTag.ENERGY_STEAM, + 4, + 2048, + 1, + 1, + 1, + Materials.TungstenSteel, + OrePrefixes.frameGt.get(Materials.TungstenSteel), + OrePrefixes.pipeMedium.get(Materials.TungstenSteel), + OrePrefixes.pipeHuge.get(Materials.TungstenSteel), + OrePrefixes.pipeMedium.get(Materials.TungstenSteel), + OrePrefixes.pipeLarge.get(Materials.TungstenSteel)), + new Tier( + SubTag.ENERGY_STEAM, + 5, + 8192, + 1, + 1, + 1, + Materials.Iridium, + OrePrefixes.frameGt.get(Materials.Iridium), + OrePrefixes.pipeMedium.get(Materials.Iridium), + OrePrefixes.pipeHuge.get(Materials.Iridium), + OrePrefixes.pipeMedium.get(Materials.Iridium), + OrePrefixes.pipeLarge.get(Materials.Iridium)), + new Tier( + SubTag.ENERGY_STEAM, + 9, + Integer.MAX_VALUE - 7, + 1, + 1, + 1, + Materials.Neutronium, + OrePrefixes.frameGt.get(Materials.Neutronium), + OrePrefixes.pipeMedium.get(Materials.Neutronium), + OrePrefixes.pipeHuge.get(Materials.Neutronium), + OrePrefixes.pipeMedium.get(Materials.Neutronium), + OrePrefixes.pipeLarge.get(Materials.Neutronium)), + }; /** * Used for Crafting Recipes */ - public final Object - mHullObject, - mConductingObject, - mLargerConductingObject, - mManagingObject, - mBetterManagingObject; + public final Object mHullObject, mConductingObject, mLargerConductingObject, mManagingObject, mBetterManagingObject; + private final SubTag mType; private final byte mRank; - private final long - mPrimaryValue, - mSecondaryValue, - mSpeedMultiplier, - mEnergyCostMultiplier; + private final long mPrimaryValue, mSecondaryValue, mSpeedMultiplier, mEnergyCostMultiplier; private final Materials mMaterial; - public Tier(SubTag aType, int aRank, long aPrimaryValue, long aSecondaryValue, long aSpeedMultiplier, long aEnergyCostMultiplier, Materials aMaterial, Object aHullObject, Object aConductingObject, Object aLargerConductingObject, Object aManagingObject, Object aBetterManagingObject) { + public Tier( + SubTag aType, + int aRank, + long aPrimaryValue, + long aSecondaryValue, + long aSpeedMultiplier, + long aEnergyCostMultiplier, + Materials aMaterial, + Object aHullObject, + Object aConductingObject, + Object aLargerConductingObject, + Object aManagingObject, + Object aBetterManagingObject) { mType = aType; mRank = (byte) aRank; mPrimaryValue = aPrimaryValue; diff --git a/src/main/java/gregtech/api/enums/ToolDictNames.java b/src/main/java/gregtech/api/enums/ToolDictNames.java index d41c63c717..27e297de5e 100644 --- a/src/main/java/gregtech/api/enums/ToolDictNames.java +++ b/src/main/java/gregtech/api/enums/ToolDictNames.java @@ -32,7 +32,7 @@ public enum ToolDictNames { public static boolean contains(String aName) { if (!aName.startsWith("craftingTool")) return false; - for (ToolDictNames tool: ToolDictNames.values()) { + for (ToolDictNames tool : ToolDictNames.values()) { if (tool.toString().equals(aName)) { return true; } diff --git a/src/main/java/gregtech/api/events/BlockScanningEvent.java b/src/main/java/gregtech/api/events/BlockScanningEvent.java index 93c4f6881c..85d2e3e07a 100644 --- a/src/main/java/gregtech/api/events/BlockScanningEvent.java +++ b/src/main/java/gregtech/api/events/BlockScanningEvent.java @@ -1,14 +1,13 @@ package gregtech.api.events; import cpw.mods.fml.common.eventhandler.Cancelable; +import java.util.ArrayList; import net.minecraft.block.Block; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.tileentity.TileEntity; import net.minecraft.world.World; import net.minecraftforge.event.world.WorldEvent; -import java.util.ArrayList; - @Cancelable public class BlockScanningEvent extends WorldEvent { @@ -25,7 +24,20 @@ public class BlockScanningEvent extends WorldEvent { */ public int mEUCost = 0; - public BlockScanningEvent(World aWorld, EntityPlayer aPlayer, int aX, int aY, int aZ, byte aSide, int aScanLevel, Block aBlock, TileEntity aTileEntity, ArrayList<String> aList, float aClickX, float aClickY, float aClickZ) { + public BlockScanningEvent( + World aWorld, + EntityPlayer aPlayer, + int aX, + int aY, + int aZ, + byte aSide, + int aScanLevel, + Block aBlock, + TileEntity aTileEntity, + ArrayList<String> aList, + float aClickX, + float aClickY, + float aClickZ) { super(aWorld); mPlayer = aPlayer; mScanLevel = aScanLevel; diff --git a/src/main/java/gregtech/api/fluid/FluidTankGT.java b/src/main/java/gregtech/api/fluid/FluidTankGT.java index 5df9e2638a..93b3c87575 100644 --- a/src/main/java/gregtech/api/fluid/FluidTankGT.java +++ b/src/main/java/gregtech/api/fluid/FluidTankGT.java @@ -1,16 +1,15 @@ package gregtech.api.fluid; +import static com.google.common.primitives.Ints.saturatedCast; + import gregtech.api.util.GT_Utility; +import java.util.Map; import net.minecraft.nbt.NBTTagCompound; import net.minecraftforge.fluids.Fluid; import net.minecraftforge.fluids.FluidStack; import net.minecraftforge.fluids.FluidTankInfo; import net.minecraftforge.fluids.IFluidTank; -import java.util.Map; - -import static com.google.common.primitives.Ints.saturatedCast; - public class FluidTankGT implements IFluidTank { public final FluidTankGT[] AS_ARRAY = new FluidTankGT[] {this}; private FluidStack mFluid; @@ -18,6 +17,7 @@ public class FluidTankGT implements IFluidTank { private boolean mPreventDraining = false, mVoidExcess = false, mChangedFluids = false; /** HashMap of adjustable Tank Sizes based on Fluids if needed. */ private Map<String, Long> mAdjustableCapacity = null; + private long mAdjustableMultiplier = 1; /** Gives you a Tank Index in case there is multiple Tanks on a TileEntity that cares. */ public int mIndex = 0; @@ -102,7 +102,7 @@ public class FluidTankGT implements IFluidTank { @Override public FluidStack drain(int aDrained, boolean aDoDrain) { if (isEmpty() || aDrained <= 0) return null; - if (mAmount < aDrained) aDrained = (int)mAmount; + if (mAmount < aDrained) aDrained = (int) mAmount; final FluidStack rFluid = new FluidStack(mFluid, aDrained); if (aDoDrain) { mAmount -= aDrained; @@ -190,11 +190,20 @@ public class FluidTankGT implements IFluidTank { } else mAmount = tCapacity; return mVoidExcess ? aFluid.amount : (int) tFilled; } - return saturatedCast(isEmpty() ? mVoidExcess ? aFluid.amount : Math.min(capacity(aFluid), aFluid.amount) : contains(aFluid) ? mVoidExcess ? aFluid.amount : Math.min(capacity(aFluid) - mAmount, aFluid.amount) : 0); + return saturatedCast( + isEmpty() + ? mVoidExcess ? aFluid.amount : Math.min(capacity(aFluid), aFluid.amount) + : contains(aFluid) + ? mVoidExcess ? aFluid.amount : Math.min(capacity(aFluid) - mAmount, aFluid.amount) + : 0); } public boolean canFillAll(FluidStack aFluid) { - return aFluid == null || aFluid.amount <= 0 || (isEmpty() ? mVoidExcess || aFluid.amount <= capacity(aFluid) : contains(aFluid) && (mVoidExcess || mAmount + aFluid.amount <= capacity(aFluid))); + return aFluid == null + || aFluid.amount <= 0 + || (isEmpty() + ? mVoidExcess || aFluid.amount <= capacity(aFluid) + : contains(aFluid) && (mVoidExcess || mAmount + aFluid.amount <= capacity(aFluid))); } public boolean canFillAll(long aAmount) { @@ -341,23 +350,22 @@ public class FluidTankGT implements IFluidTank { } public long capacity(FluidStack aFluid) { - if(mAdjustableCapacity == null || aFluid == null) - return mCapacity; + if (mAdjustableCapacity == null || aFluid == null) return mCapacity; return capacity(aFluid.getFluid()); } public long capacity(Fluid aFluid) { - if(mAdjustableCapacity == null || aFluid == null) - return mCapacity; + if (mAdjustableCapacity == null || aFluid == null) return mCapacity; return capacity(aFluid.getName()); } public long capacity(String aFluid) { - if( mAdjustableCapacity == null || aFluid == null) - return mCapacity; + if (mAdjustableCapacity == null || aFluid == null) return mCapacity; final Long tSize = mAdjustableCapacity.get(aFluid); - return tSize == null ? Math.max(mAmount, mCapacity) : Math.max(tSize * mAdjustableMultiplier, Math.max(mAmount, mCapacity)); + return tSize == null + ? Math.max(mAmount, mCapacity) + : Math.max(tSize * mAdjustableMultiplier, Math.max(mAmount, mCapacity)); } public boolean isHalf() { @@ -440,5 +448,4 @@ public class FluidTankGT implements IFluidTank { public FluidTankInfo getInfo() { return new FluidTankInfo(isEmpty() ? null : mFluid.copy(), saturatedCast(capacity())); } - } diff --git a/src/main/java/gregtech/api/graphs/GenerateNodeMap.java b/src/main/java/gregtech/api/graphs/GenerateNodeMap.java index 4d1b7a7461..c0ee8b9490 100644 --- a/src/main/java/gregtech/api/graphs/GenerateNodeMap.java +++ b/src/main/java/gregtech/api/graphs/GenerateNodeMap.java @@ -1,19 +1,17 @@ package gregtech.api.graphs; +import static gregtech.api.util.GT_Utility.getOppositeSide; + import gregtech.api.graphs.consumers.ConsumerNode; import gregtech.api.graphs.paths.NodePath; import gregtech.api.metatileentity.BaseMetaPipeEntity; import gregtech.api.metatileentity.MetaPipeEntity; -import net.minecraft.tileentity.TileEntity; - import java.util.ArrayList; import java.util.HashSet; - -import static gregtech.api.util.GT_Utility.getOppositeSide; - +import net.minecraft.tileentity.TileEntity; // generates the node map -abstract public class GenerateNodeMap { +public abstract class GenerateNodeMap { // clearing the node map to make sure it is gone on reset public static void clearNodeMap(Node aNode, int aReturnNodeValue) { if (aNode.mTileEntity instanceof BaseMetaPipeEntity) { @@ -33,8 +31,7 @@ abstract public class GenerateNodeMap { } Node tNextNode = aNode.mNeighbourNodes[i]; if (tNextNode == null) continue; - if (tNextNode.mNodeValue != aReturnNodeValue) - clearNodeMap(tNextNode, aNode.mNodeValue); + if (tNextNode.mNodeValue != aReturnNodeValue) clearNodeMap(tNextNode, aNode.mNodeValue); aNode.mNeighbourNodes[i] = null; } } @@ -49,8 +46,13 @@ abstract public class GenerateNodeMap { } // gets the next node - protected void generateNextNode(BaseMetaPipeEntity aPipe, Node aPipeNode, byte aInvalidSide, int aNextNodeValue, - ArrayList<ConsumerNode> tConsumers, HashSet<Node> tNodeMap) { + protected void generateNextNode( + BaseMetaPipeEntity aPipe, + Node aPipeNode, + byte aInvalidSide, + int aNextNodeValue, + ArrayList<ConsumerNode> tConsumers, + HashSet<Node> tNodeMap) { MetaPipeEntity tMetaPipe = (MetaPipeEntity) aPipe.getMetaTileEntity(); for (byte i = 0; i < 6; i++) { if (i == aInvalidSide) { @@ -61,8 +63,14 @@ abstract public class GenerateNodeMap { ArrayList<MetaPipeEntity> tNewPipes = new ArrayList<>(); Pair nextTileEntity = getNextValidTileEntity(tNextTileEntity, tNewPipes, i, tNodeMap); if (nextTileEntity != null) { - Node tNextNode = generateNode(nextTileEntity.mTileEntity, aPipeNode, aNextNodeValue + 1, tNewPipes, - nextTileEntity.mSide, tConsumers, tNodeMap); + Node tNextNode = generateNode( + nextTileEntity.mTileEntity, + aPipeNode, + aNextNodeValue + 1, + tNewPipes, + nextTileEntity.mSide, + tConsumers, + tNodeMap); if (tNextNode != null) { aNextNodeValue = tNextNode.mHighestNodeValue; aPipeNode.mHighestNodeValue = tNextNode.mHighestNodeValue; @@ -77,8 +85,14 @@ abstract public class GenerateNodeMap { } // on a valid tile entity create a new node - protected Node generateNode(TileEntity aTileEntity, Node aPreviousNode, int aNextNodeValue, ArrayList<MetaPipeEntity> aPipes, - int aSide, ArrayList<ConsumerNode> aConsumers, HashSet<Node> aNodeMap) { + protected Node generateNode( + TileEntity aTileEntity, + Node aPreviousNode, + int aNextNodeValue, + ArrayList<MetaPipeEntity> aPipes, + int aSide, + ArrayList<ConsumerNode> aConsumers, + HashSet<Node> aNodeMap) { if (aTileEntity.isInvalid()) return null; byte tSideOp = getOppositeSide(aSide); byte tInvalidSide = aPreviousNode == null ? -1 : tSideOp; @@ -96,7 +110,7 @@ abstract public class GenerateNodeMap { } tPipe.setNode(tPipeNode); aNodeMap.add(tPipeNode); - tPipeNode.mSelfPath = getNewPath(new MetaPipeEntity[]{tMetaPipe}); + tPipeNode.mSelfPath = getNewPath(new MetaPipeEntity[] {tMetaPipe}); tThisNode = tPipeNode; if (tInvalidSide > -1) { tPipeNode.mNeighbourNodes[tInvalidSide] = aPreviousNode; @@ -123,14 +137,14 @@ abstract public class GenerateNodeMap { } // go over the pipes until we see a valid tile entity that needs a node - protected Pair getNextValidTileEntity(TileEntity aTileEntity, ArrayList<MetaPipeEntity> aPipes, byte aSide, HashSet<Node> aNodeMap) { + protected Pair getNextValidTileEntity( + TileEntity aTileEntity, ArrayList<MetaPipeEntity> aPipes, byte aSide, HashSet<Node> aNodeMap) { if (isPipe(aTileEntity)) { BaseMetaPipeEntity tPipe = (BaseMetaPipeEntity) aTileEntity; MetaPipeEntity tMetaPipe = (MetaPipeEntity) tPipe.getMetaTileEntity(); Node tNode = tPipe.getNode(); if (tNode != null) { - if (aNodeMap.contains(tNode)) - return null; + if (aNodeMap.contains(tNode)) return null; } int tConnections = getNumberOfConnections(tMetaPipe); if (tConnections == 2) { @@ -161,13 +175,15 @@ abstract public class GenerateNodeMap { } // checks if the tile entity is a consumer and add to the list - abstract protected boolean addConsumer(TileEntity aTileEntity, byte aSide, int aNodeValue, ArrayList<ConsumerNode> aConsumers); + protected abstract boolean addConsumer( + TileEntity aTileEntity, byte aSide, int aNodeValue, ArrayList<ConsumerNode> aConsumers); // get correct pathClass that you need for your node network protected abstract NodePath getNewPath(MetaPipeEntity[] aPipes); // used for if you need to use dead ends for something can be null - protected Node getEmptyNode(int aNodeValue, byte aSide, TileEntity aTileEntity, ArrayList<ConsumerNode> aConsumers) { + protected Node getEmptyNode( + int aNodeValue, byte aSide, TileEntity aTileEntity, ArrayList<ConsumerNode> aConsumers) { return null; } diff --git a/src/main/java/gregtech/api/graphs/GenerateNodeMapPower.java b/src/main/java/gregtech/api/graphs/GenerateNodeMapPower.java index bb7a1f58e1..293a46502a 100644 --- a/src/main/java/gregtech/api/graphs/GenerateNodeMapPower.java +++ b/src/main/java/gregtech/api/graphs/GenerateNodeMapPower.java @@ -16,11 +16,10 @@ import gregtech.api.metatileentity.BaseMetaTileEntity; import gregtech.api.metatileentity.MetaPipeEntity; import gregtech.api.metatileentity.implementations.GT_MetaPipeEntity_Cable; import ic2.api.energy.tile.IEnergySink; -import net.minecraft.tileentity.TileEntity; -import net.minecraftforge.common.util.ForgeDirection; - import java.util.ArrayList; import java.util.HashSet; +import net.minecraft.tileentity.TileEntity; +import net.minecraftforge.common.util.ForgeDirection; // node map generator for power distribution public class GenerateNodeMapPower extends GenerateNodeMap { @@ -30,11 +29,13 @@ public class GenerateNodeMapPower extends GenerateNodeMap { @Override protected boolean isPipe(TileEntity aTileEntity) { - return super.isPipe(aTileEntity) && ((BaseMetaPipeEntity) aTileEntity).getMetaTileEntity() instanceof GT_MetaPipeEntity_Cable; + return super.isPipe(aTileEntity) + && ((BaseMetaPipeEntity) aTileEntity).getMetaTileEntity() instanceof GT_MetaPipeEntity_Cable; } @Override - protected boolean addConsumer(TileEntity aTileEntity, byte aSide, int aNodeValue, ArrayList<ConsumerNode> aConsumers) { + protected boolean addConsumer( + TileEntity aTileEntity, byte aSide, int aNodeValue, ArrayList<ConsumerNode> aConsumers) { if (aTileEntity instanceof BaseMetaTileEntity) { BaseMetaTileEntity tBaseTileEntity = (BaseMetaTileEntity) aTileEntity; if (tBaseTileEntity.inputEnergyFrom(aSide, false)) { @@ -62,12 +63,14 @@ public class GenerateNodeMapPower extends GenerateNodeMap { tNextTo = aTileEntity.getWorldObj().getTileEntity(dX, dY, dZ); if (((IEnergySink) aTileEntity).acceptsEnergyFrom(tNextTo, ForgeDirection.getOrientation(aSide))) { - ConsumerNode tConsumerNode = new NodeEnergySink(aNodeValue, (IEnergySink) aTileEntity, aSide, aConsumers); + ConsumerNode tConsumerNode = + new NodeEnergySink(aNodeValue, (IEnergySink) aTileEntity, aSide, aConsumers); aConsumers.add(tConsumerNode); return true; } } else if (GregTech_API.mOutputRF && aTileEntity instanceof IEnergyReceiver) { - ConsumerNode tConsumerNode = new NodeEnergyReceiver(aNodeValue, (IEnergyReceiver) aTileEntity, aSide, aConsumers); + ConsumerNode tConsumerNode = + new NodeEnergyReceiver(aNodeValue, (IEnergyReceiver) aTileEntity, aSide, aConsumers); aConsumers.add(tConsumerNode); return true; } @@ -79,9 +82,10 @@ public class GenerateNodeMapPower extends GenerateNodeMap { return new PowerNodePath(aPipes); } - //used to apply voltage on dead ends + // used to apply voltage on dead ends @Override - protected Node getEmptyNode(int aNodeValue, byte aSide, TileEntity aTileEntity, ArrayList<ConsumerNode> aConsumers) { + protected Node getEmptyNode( + int aNodeValue, byte aSide, TileEntity aTileEntity, ArrayList<ConsumerNode> aConsumers) { Node tNode = new EmptyPowerConsumer(aNodeValue, aTileEntity, aSide, aConsumers); aConsumers.add((ConsumerNode) tNode); return tNode; diff --git a/src/main/java/gregtech/api/graphs/Lock.java b/src/main/java/gregtech/api/graphs/Lock.java index 0ba43b83de..e89cc8b25c 100644 --- a/src/main/java/gregtech/api/graphs/Lock.java +++ b/src/main/java/gregtech/api/graphs/Lock.java @@ -1,8 +1,7 @@ package gregtech.api.graphs; -import net.minecraft.tileentity.TileEntity; - import java.util.ArrayList; +import net.minecraft.tileentity.TileEntity; public class Lock { protected ArrayList<TileEntity> tiles = new ArrayList<>(); @@ -25,7 +24,7 @@ public class Lock { return !tiles.isEmpty(); } - //i want to check for the exact object not equals + // i want to check for the exact object not equals protected int contains(TileEntity tileEntity) { for (int i = 0; i < tiles.size(); i++) { if (tiles.get(i) == tileEntity) { diff --git a/src/main/java/gregtech/api/graphs/Node.java b/src/main/java/gregtech/api/graphs/Node.java index be499dea0d..f6a3ebe2d2 100644 --- a/src/main/java/gregtech/api/graphs/Node.java +++ b/src/main/java/gregtech/api/graphs/Node.java @@ -2,11 +2,10 @@ package gregtech.api.graphs; import gregtech.api.graphs.consumers.ConsumerNode; import gregtech.api.graphs.paths.NodePath; +import java.util.ArrayList; import net.minecraft.server.MinecraftServer; import net.minecraft.tileentity.TileEntity; -import java.util.ArrayList; - // base Node class public class Node { public Node(int aNodeValue, TileEntity aTileEntity, ArrayList<ConsumerNode> aConsumers) { @@ -18,7 +17,6 @@ public class Node { mCreationTime = MinecraftServer.getServer().getTickCounter(); } - public final TileEntity mTileEntity; public Node[] mNeighbourNodes = new Node[6]; public NodePath[] mNodePaths = new NodePath[6]; diff --git a/src/main/java/gregtech/api/graphs/NodeList.java b/src/main/java/gregtech/api/graphs/NodeList.java index fb8afe68fa..8a018e2123 100644 --- a/src/main/java/gregtech/api/graphs/NodeList.java +++ b/src/main/java/gregtech/api/graphs/NodeList.java @@ -4,21 +4,18 @@ package gregtech.api.graphs; public class NodeList { Node[] mNodes; int mCounter = 0; + public NodeList(Node[] mNodes) { this.mNodes = mNodes; } Node getNextNode() { - if (++mCounter < mNodes.length) - return mNodes[mCounter]; - else - return null; + if (++mCounter < mNodes.length) return mNodes[mCounter]; + else return null; } Node getNode() { - if (mCounter < mNodes.length) - return mNodes[mCounter]; - else - return null; + if (mCounter < mNodes.length) return mNodes[mCounter]; + else return null; } } diff --git a/src/main/java/gregtech/api/graphs/PowerNode.java b/src/main/java/gregtech/api/graphs/PowerNode.java index 82c97d3901..c81d436861 100644 --- a/src/main/java/gregtech/api/graphs/PowerNode.java +++ b/src/main/java/gregtech/api/graphs/PowerNode.java @@ -1,13 +1,13 @@ package gregtech.api.graphs; import gregtech.api.graphs.consumers.ConsumerNode; -import net.minecraft.tileentity.TileEntity; - import java.util.ArrayList; +import net.minecraft.tileentity.TileEntity; // base node for power networks -public class PowerNode extends Node{ +public class PowerNode extends Node { public boolean mHadVoltage = false; + public PowerNode(int aNodeValue, TileEntity aTileEntity, ArrayList<ConsumerNode> aConsumers) { super(aNodeValue, aTileEntity, aConsumers); } diff --git a/src/main/java/gregtech/api/graphs/PowerNodes.java b/src/main/java/gregtech/api/graphs/PowerNodes.java index e5d0e56699..759002dbdb 100644 --- a/src/main/java/gregtech/api/graphs/PowerNodes.java +++ b/src/main/java/gregtech/api/graphs/PowerNodes.java @@ -22,7 +22,8 @@ import gregtech.api.graphs.paths.PowerNodePath; */ public class PowerNodes { // check if the looked for node is next to or get the next node that is closer to it - static public long powerNode(Node aCurrentNode, Node aPreviousNode, NodeList aConsumers, long aVoltage, long aMaxAmps) { + public static long powerNode( + Node aCurrentNode, Node aPreviousNode, NodeList aConsumers, long aVoltage, long aMaxAmps) { long tAmpsUsed = 0; ConsumerNode tConsumer = (ConsumerNode) aConsumers.getNode(); int tLoopProtection = 0; @@ -39,7 +40,8 @@ public class PowerNodes { break; } else { if (aPreviousNode == tNextNode) return tAmpsUsed; - tAmpsUsed += processNextNode(aCurrentNode, tNextNode, aConsumers, j, aMaxAmps - tAmpsUsed, aVoltage); + tAmpsUsed += processNextNode( + aCurrentNode, tNextNode, aConsumers, j, aMaxAmps - tAmpsUsed, aVoltage); tConsumer = (ConsumerNode) aConsumers.getNode(); break; } @@ -52,7 +54,8 @@ public class PowerNodes { if (tNextNode == null) continue; if (tNextNode.mNodeValue > aCurrentNode.mNodeValue && tNextNode.mNodeValue < tTargetNodeValue) { if (tNextNode == aPreviousNode) return tAmpsUsed; - tAmpsUsed += processNextNodeAbove(aCurrentNode, tNextNode, aConsumers, side, aMaxAmps - tAmpsUsed, aVoltage); + tAmpsUsed += processNextNodeAbove( + aCurrentNode, tNextNode, aConsumers, side, aMaxAmps - tAmpsUsed, aVoltage); tConsumer = (ConsumerNode) aConsumers.getNode(); break; } else if (tNextNode.mNodeValue == tTargetNodeValue) { @@ -74,7 +77,8 @@ public class PowerNodes { // checking if target node is next to it or has a higher value then current node value // these functions are different to either go down or up the stack - protected static long powerNodeAbove(Node aCurrentNode, Node aPreviousNode, NodeList aConsumers, long aVoltage, long aMaxAmps) { + protected static long powerNodeAbove( + Node aCurrentNode, Node aPreviousNode, NodeList aConsumers, long aVoltage, long aMaxAmps) { long tAmpsUsed = 0; int tLoopProtection = 0; ConsumerNode tConsumer = (ConsumerNode) aConsumers.getNode(); @@ -88,7 +92,8 @@ public class PowerNodes { if (tNextNode == null) continue; if (tNextNode.mNodeValue > aCurrentNode.mNodeValue && tNextNode.mNodeValue < tTargetNodeValue) { if (tNextNode == aPreviousNode) return tAmpsUsed; - tAmpsUsed += processNextNodeAbove(aCurrentNode, tNextNode, aConsumers, side, aMaxAmps - tAmpsUsed, aVoltage); + tAmpsUsed += processNextNodeAbove( + aCurrentNode, tNextNode, aConsumers, side, aMaxAmps - tAmpsUsed, aVoltage); tConsumer = (ConsumerNode) aConsumers.getNode(); break; } else if (tNextNode.mNodeValue == tTargetNodeValue) { @@ -108,7 +113,8 @@ public class PowerNodes { return tAmpsUsed; } - protected static long processNextNode(Node aCurrentNode, Node aNextNode, NodeList aConsumers, int aSide, long aMaxAmps, long aVoltage) { + protected static long processNextNode( + Node aCurrentNode, Node aNextNode, NodeList aConsumers, int aSide, long aMaxAmps, long aVoltage) { if (aCurrentNode.locks[aSide].isLocked()) { aConsumers.getNextNode(); return 0; @@ -124,12 +130,12 @@ public class PowerNodes { tVoltLoss += tPath.getLoss(); long tAmps = powerNode(aNextNode, aCurrentNode, aConsumers, aVoltage - tVoltLoss, aMaxAmps); tPath.addAmps(tAmps); - if (tSelfPath != null) - tSelfPath.addAmps(tAmps); + if (tSelfPath != null) tSelfPath.addAmps(tAmps); return tAmps; } - protected static long processNextNodeAbove(Node aCurrentNode, Node aNextNode, NodeList aConsumers, int aSide, long aMaxAmps, long aVoltage) { + protected static long processNextNodeAbove( + Node aCurrentNode, Node aNextNode, NodeList aConsumers, int aSide, long aMaxAmps, long aVoltage) { if (aCurrentNode.locks[aSide].isLocked()) { aConsumers.getNextNode(); return 0; @@ -145,12 +151,12 @@ public class PowerNodes { tVoltLoss += tPath.getLoss(); long tAmps = powerNodeAbove(aNextNode, aCurrentNode, aConsumers, aVoltage - tVoltLoss, aMaxAmps); tPath.addAmps(tAmps); - if (tSelfPath != null) - tSelfPath.addAmps(tAmps); + if (tSelfPath != null) tSelfPath.addAmps(tAmps); return tAmps; } - protected static long processNodeInject(Node aCurrentNode, ConsumerNode aConsumer, int aSide, long aMaxAmps, long aVoltage) { + protected static long processNodeInject( + Node aCurrentNode, ConsumerNode aConsumer, int aSide, long aMaxAmps, long aVoltage) { if (aCurrentNode.locks[aSide].isLocked()) return 0; final PowerNodePath tPath = (PowerNodePath) aCurrentNode.mNodePaths[aSide]; final PowerNodePath tSelfPath = (PowerNodePath) aCurrentNode.mSelfPath; @@ -163,8 +169,7 @@ public class PowerNodes { tVoltLoss += tPath.getLoss(); long tAmps = aConsumer.injectEnergy(aVoltage - tVoltLoss, aMaxAmps); tPath.addAmps(tAmps); - if (tSelfPath != null) - tSelfPath.addAmps(tAmps); + if (tSelfPath != null) tSelfPath.addAmps(tAmps); return tAmps; } } diff --git a/src/main/java/gregtech/api/graphs/consumers/ConsumerNode.java b/src/main/java/gregtech/api/graphs/consumers/ConsumerNode.java index e060c5c094..78b3c51928 100644 --- a/src/main/java/gregtech/api/graphs/consumers/ConsumerNode.java +++ b/src/main/java/gregtech/api/graphs/consumers/ConsumerNode.java @@ -1,15 +1,15 @@ package gregtech.api.graphs.consumers; import gregtech.api.graphs.Node; -import net.minecraft.tileentity.TileEntity; - import java.util.ArrayList; +import net.minecraft.tileentity.TileEntity; // node attached to a tile entity that can consume stuff from the network public class ConsumerNode extends Node { public byte mSide; + public ConsumerNode(int aNodeValue, TileEntity aTileEntity, byte aSide, ArrayList<ConsumerNode> aConsumers) { - super(aNodeValue,aTileEntity,aConsumers); + super(aNodeValue, aTileEntity, aConsumers); this.mSide = aSide; } diff --git a/src/main/java/gregtech/api/graphs/consumers/EmptyPowerConsumer.java b/src/main/java/gregtech/api/graphs/consumers/EmptyPowerConsumer.java index 29f4fe8893..d5ff76c12b 100644 --- a/src/main/java/gregtech/api/graphs/consumers/EmptyPowerConsumer.java +++ b/src/main/java/gregtech/api/graphs/consumers/EmptyPowerConsumer.java @@ -2,12 +2,11 @@ package gregtech.api.graphs.consumers; import gregtech.api.graphs.paths.PowerNodePath; import gregtech.api.metatileentity.BaseMetaPipeEntity; -import net.minecraft.tileentity.TileEntity; - import java.util.ArrayList; +import net.minecraft.tileentity.TileEntity; -//this is here to apply voltage to dead ends -public class EmptyPowerConsumer extends ConsumerNode{ +// this is here to apply voltage to dead ends +public class EmptyPowerConsumer extends ConsumerNode { public EmptyPowerConsumer(int aNodeValue, TileEntity aTileEntity, byte aSide, ArrayList<ConsumerNode> aConsumers) { super(aNodeValue, aTileEntity, aSide, aConsumers); } @@ -20,8 +19,8 @@ public class EmptyPowerConsumer extends ConsumerNode{ @Override public int injectEnergy(long aVoltage, long aMaxAmps) { BaseMetaPipeEntity tPipe = (BaseMetaPipeEntity) mTileEntity; - PowerNodePath tPath =(PowerNodePath) tPipe.getNodePath(); - tPath.applyVoltage(aVoltage,true); + PowerNodePath tPath = (PowerNodePath) tPipe.getNodePath(); + tPath.applyVoltage(aVoltage, true); return 0; } } diff --git a/src/main/java/gregtech/api/graphs/consumers/NodeEnergyConnected.java b/src/main/java/gregtech/api/graphs/consumers/NodeEnergyConnected.java index 0b3c8e31fa..30582332e7 100644 --- a/src/main/java/gregtech/api/graphs/consumers/NodeEnergyConnected.java +++ b/src/main/java/gregtech/api/graphs/consumers/NodeEnergyConnected.java @@ -1,13 +1,13 @@ package gregtech.api.graphs.consumers; import gregtech.api.interfaces.tileentity.IEnergyConnected; -import net.minecraft.tileentity.TileEntity; - import java.util.ArrayList; +import net.minecraft.tileentity.TileEntity; public class NodeEnergyConnected extends ConsumerNode { - public NodeEnergyConnected(int aNodeValue, IEnergyConnected aTileEntity, byte aSide, ArrayList<ConsumerNode> aConsumers) { - super(aNodeValue,(TileEntity) aTileEntity, aSide, aConsumers); + public NodeEnergyConnected( + int aNodeValue, IEnergyConnected aTileEntity, byte aSide, ArrayList<ConsumerNode> aConsumers) { + super(aNodeValue, (TileEntity) aTileEntity, aSide, aConsumers); } @Override @@ -17,6 +17,6 @@ public class NodeEnergyConnected extends ConsumerNode { @Override public int injectEnergy(long aVoltage, long aMaxAmps) { - return (int) ((IEnergyConnected)mTileEntity).injectEnergyUnits(mSide,aVoltage,aMaxAmps); + return (int) ((IEnergyConnected) mTileEntity).injectEnergyUnits(mSide, aVoltage, aMaxAmps); } } diff --git a/src/main/java/gregtech/api/graphs/consumers/NodeEnergyReceiver.java b/src/main/java/gregtech/api/graphs/consumers/NodeEnergyReceiver.java index bd9e75945b..9c5e3f8aab 100644 --- a/src/main/java/gregtech/api/graphs/consumers/NodeEnergyReceiver.java +++ b/src/main/java/gregtech/api/graphs/consumers/NodeEnergyReceiver.java @@ -1,5 +1,7 @@ package gregtech.api.graphs.consumers; +import static gregtech.api.enums.GT_Values.V; + import cofh.api.energy.IEnergyReceiver; import gregtech.GT_Mod; import gregtech.api.GregTech_API; @@ -7,19 +9,18 @@ import gregtech.api.enums.SoundResource; import gregtech.api.util.GT_Utility; import gregtech.api.util.WorldSpawnedEventBuilder; import gregtech.common.GT_Pollution; +import java.util.ArrayList; import net.minecraft.init.Blocks; import net.minecraft.tileentity.TileEntity; import net.minecraft.world.World; import net.minecraftforge.common.util.ForgeDirection; -import java.util.ArrayList; - -import static gregtech.api.enums.GT_Values.V; - -//consumer for RF machines +// consumer for RF machines public class NodeEnergyReceiver extends ConsumerNode { int mRestRF = 0; - public NodeEnergyReceiver(int aNodeValue, IEnergyReceiver aTileEntity, byte aSide, ArrayList<ConsumerNode> aConsumers) { + + public NodeEnergyReceiver( + int aNodeValue, IEnergyReceiver aTileEntity, byte aSide, ArrayList<ConsumerNode> aConsumers) { super(aNodeValue, (TileEntity) aTileEntity, aSide, aConsumers); } @@ -37,44 +38,82 @@ public class NodeEnergyReceiver extends ConsumerNode { mRestRF -= consumed; return ampsUsed; } - if (GregTech_API.mRFExplosions && GregTech_API.sMachineExplosions && - ((IEnergyReceiver) mTileEntity).getMaxEnergyStored(tDirection) < rfOut * 600L) { + if (GregTech_API.mRFExplosions + && GregTech_API.sMachineExplosions + && ((IEnergyReceiver) mTileEntity).getMaxEnergyStored(tDirection) < rfOut * 600L) { explode(rfOut); } return 0; } - //copied from IEnergyConnected + // copied from IEnergyConnected private void explode(int aRfOut) { if (aRfOut > 32L * GregTech_API.mEUtoRF / 100L) { int aExplosionPower = aRfOut; - float tStrength = - aExplosionPower < V[0] ? 1.0F : - aExplosionPower < V[1] ? 2.0F : - aExplosionPower < V[2] ? 3.0F : - aExplosionPower < V[3] ? 4.0F : - aExplosionPower < V[4] ? 5.0F : - aExplosionPower < V[4] * 2 ? 6.0F : - aExplosionPower < V[5] ? 7.0F : - aExplosionPower < V[6] ? 8.0F : - aExplosionPower < V[7] ? 9.0F : - aExplosionPower < V[8] ? 10.0F : - aExplosionPower < V[8] * 2 ? 11.0F : - aExplosionPower < V[9] ? 12.0F : - aExplosionPower < V[10] ? 13.0F : - aExplosionPower < V[11] ? 14.0F : - aExplosionPower < V[12] ? 15.0F : - aExplosionPower < V[12] * 2 ? 16.0F : - aExplosionPower < V[13] ? 17.0F : - aExplosionPower < V[14] ? 18.0F : - aExplosionPower < V[15] ? 19.0F : 20.0F; + float tStrength = aExplosionPower < V[0] + ? 1.0F + : aExplosionPower < V[1] + ? 2.0F + : aExplosionPower < V[2] + ? 3.0F + : aExplosionPower < V[3] + ? 4.0F + : aExplosionPower < V[4] + ? 5.0F + : aExplosionPower < V[4] * 2 + ? 6.0F + : aExplosionPower < V[5] + ? 7.0F + : aExplosionPower < V[6] + ? 8.0F + : aExplosionPower < V[7] + ? 9.0F + : aExplosionPower < V[8] + ? 10.0F + : aExplosionPower < V[8] * 2 + ? 11.0F + : aExplosionPower + < V[ + 9] + ? 12.0F + : aExplosionPower + < V[ + 10] + ? 13.0F + : aExplosionPower + < V[ + 11] + ? 14.0F + : aExplosionPower + < V[ + 12] + ? 15.0F + : aExplosionPower + < V[ + 12] + * 2 + ? 16.0F + : aExplosionPower + < V[ + 13] + ? 17.0F + : aExplosionPower + < V[ + 14] + ? 18.0F + : aExplosionPower + < V[ + 15] + ? 19.0F + : 20.0F; int tX = mTileEntity.xCoord, tY = mTileEntity.yCoord, tZ = mTileEntity.zCoord; 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); + GT_Pollution.addPollution( + tWorld.getChunkFromBlockCoords(tX, tZ), GT_Mod.gregtechproxy.mPollutionOnExplosion); new WorldSpawnedEventBuilder.ExplosionEffectEventBuilder() .setStrength(tStrength) diff --git a/src/main/java/gregtech/api/graphs/consumers/NodeEnergySink.java b/src/main/java/gregtech/api/graphs/consumers/NodeEnergySink.java index d2c54e284f..95b16883af 100644 --- a/src/main/java/gregtech/api/graphs/consumers/NodeEnergySink.java +++ b/src/main/java/gregtech/api/graphs/consumers/NodeEnergySink.java @@ -1,11 +1,10 @@ package gregtech.api.graphs.consumers; import ic2.api.energy.tile.IEnergySink; +import java.util.ArrayList; import net.minecraft.tileentity.TileEntity; import net.minecraftforge.common.util.ForgeDirection; -import java.util.ArrayList; - // consumer for IC2 machines public class NodeEnergySink extends ConsumerNode { public NodeEnergySink(int nodeValue, IEnergySink tileEntity, byte side, ArrayList<ConsumerNode> consumers) { @@ -20,9 +19,10 @@ public class NodeEnergySink extends ConsumerNode { @Override public int injectEnergy(long aVoltage, long aMaxAmps) { int tUsedAmps = 0; - while (aMaxAmps > tUsedAmps && ((IEnergySink) mTileEntity).getDemandedEnergy() > 0 && - ((IEnergySink) mTileEntity).injectEnergy(ForgeDirection.getOrientation(mSide), aVoltage, aVoltage) < aVoltage) - tUsedAmps++; + while (aMaxAmps > tUsedAmps + && ((IEnergySink) mTileEntity).getDemandedEnergy() > 0 + && ((IEnergySink) mTileEntity).injectEnergy(ForgeDirection.getOrientation(mSide), aVoltage, aVoltage) + < aVoltage) tUsedAmps++; return tUsedAmps; } } diff --git a/src/main/java/gregtech/api/graphs/consumers/NodeGTBaseMetaTile.java b/src/main/java/gregtech/api/graphs/consumers/NodeGTBaseMetaTile.java index e9736df7f4..e367a5294e 100644 --- a/src/main/java/gregtech/api/graphs/consumers/NodeGTBaseMetaTile.java +++ b/src/main/java/gregtech/api/graphs/consumers/NodeGTBaseMetaTile.java @@ -6,13 +6,14 @@ import java.util.ArrayList; // consumer for gt machines public class NodeGTBaseMetaTile extends ConsumerNode { - public NodeGTBaseMetaTile(int aNodeValue, BaseMetaTileEntity aTileEntity, byte aSide, ArrayList<ConsumerNode> aConsumers) { + public NodeGTBaseMetaTile( + int aNodeValue, BaseMetaTileEntity aTileEntity, byte aSide, ArrayList<ConsumerNode> aConsumers) { super(aNodeValue, aTileEntity, aSide, aConsumers); } @Override public int injectEnergy(long aVoltage, long aMaxAmps) { - return (int)((IEnergyConnected) mTileEntity).injectEnergyUnits(mSide,aVoltage, aMaxAmps); + return (int) ((IEnergyConnected) mTileEntity).injectEnergyUnits(mSide, aVoltage, aMaxAmps); } @Override diff --git a/src/main/java/gregtech/api/graphs/paths/NodePath.java b/src/main/java/gregtech/api/graphs/paths/NodePath.java index 3a4bbed8c6..d5a179b24b 100644 --- a/src/main/java/gregtech/api/graphs/paths/NodePath.java +++ b/src/main/java/gregtech/api/graphs/paths/NodePath.java @@ -4,7 +4,7 @@ import gregtech.api.graphs.Lock; import gregtech.api.metatileentity.BaseMetaPipeEntity; import gregtech.api.metatileentity.MetaPipeEntity; -//to contain all info about the path between nodes +// to contain all info about the path between nodes public class NodePath { protected MetaPipeEntity[] mPipes; public Lock lock = new Lock(); diff --git a/src/main/java/gregtech/api/graphs/paths/PowerNodePath.java b/src/main/java/gregtech/api/graphs/paths/PowerNodePath.java index d18d6bcdd3..3ab8c7fe03 100644 --- a/src/main/java/gregtech/api/graphs/paths/PowerNodePath.java +++ b/src/main/java/gregtech/api/graphs/paths/PowerNodePath.java @@ -16,7 +16,6 @@ public class PowerNodePath extends NodePath { int mTick = 0; boolean mCountUp = true; - public PowerNodePath(MetaPipeEntity[] aCables) { super(aCables); } diff --git a/src/main/java/gregtech/api/gui/GT_Container.java b/src/main/java/gregtech/api/gui/GT_Container.java index 843d34c1f3..b5aebf87f2 100644 --- a/src/main/java/gregtech/api/gui/GT_Container.java +++ b/src/main/java/gregtech/api/gui/GT_Container.java @@ -4,6 +4,7 @@ import gregtech.api.interfaces.IFluidAccess; import gregtech.api.interfaces.tileentity.IGregTechTileEntity; import gregtech.api.util.GT_Log; import gregtech.api.util.GT_Utility; +import java.util.List; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.player.InventoryPlayer; import net.minecraft.inventory.Container; @@ -14,8 +15,6 @@ import net.minecraft.item.ItemStack; import net.minecraftforge.fluids.FluidStack; import net.minecraftforge.fluids.IFluidContainerItem; -import java.util.List; - /** * NEVER INCLUDE THIS FILE IN YOUR MOD!!! * <p/> @@ -109,8 +108,10 @@ public class GT_Container extends Container { if (aSlotIndex >= 0) { if (inventorySlots.get(aSlotIndex) == null || inventorySlots.get(aSlotIndex) instanceof GT_Slot_Holo) return null; - if (!(inventorySlots.get(aSlotIndex) instanceof GT_Slot_Armor)) if (aSlotIndex < getAllSlotCount()) - if (aSlotIndex < getSlotStartIndex() || aSlotIndex >= getSlotStartIndex() + getSlotCount()) return null; + if (!(inventorySlots.get(aSlotIndex) instanceof GT_Slot_Armor)) + if (aSlotIndex < getAllSlotCount()) + if (aSlotIndex < getSlotStartIndex() || aSlotIndex >= getSlotStartIndex() + getSlotCount()) + return null; } try { @@ -137,7 +138,8 @@ 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); } @@ -187,7 +189,9 @@ public class GT_Container extends Container { } aSlot.onPickupFromSlot(aPlayer, aPlayerInventory.getItemStack()); } else if (aSlot.isItemValid(mouseStack)) { - if (tTempStack.getItem() == mouseStack.getItem() && tTempStack.getItemDamage() == mouseStack.getItemDamage() && ItemStack.areItemStackTagsEqual(tTempStack, mouseStack)) { + if (tTempStack.getItem() == mouseStack.getItem() + && tTempStack.getItemDamage() == mouseStack.getItemDamage() + && ItemStack.areItemStackTagsEqual(tTempStack, mouseStack)) { tTempStackSize = aMouseclick == 0 ? mouseStack.stackSize : 1; if (tTempStackSize > aSlot.getSlotStackLimit() - tTempStack.stackSize) { tTempStackSize = aSlot.getSlotStackLimit() - tTempStack.stackSize; @@ -204,10 +208,15 @@ public class GT_Container extends Container { aSlot.putStack(mouseStack); aPlayerInventory.setItemStack(tTempStack); } - } else if (tTempStack.getItem() == mouseStack.getItem() && mouseStack.getMaxStackSize() > 1 && (!tTempStack.getHasSubtypes() || tTempStack.getItemDamage() == mouseStack.getItemDamage()) && ItemStack.areItemStackTagsEqual(tTempStack, mouseStack)) { + } else if (tTempStack.getItem() == mouseStack.getItem() + && mouseStack.getMaxStackSize() > 1 + && (!tTempStack.getHasSubtypes() + || tTempStack.getItemDamage() == mouseStack.getItemDamage()) + && ItemStack.areItemStackTagsEqual(tTempStack, mouseStack)) { tTempStackSize = tTempStack.stackSize; - if (tTempStackSize > 0 && tTempStackSize + mouseStack.stackSize <= mouseStack.getMaxStackSize()) { + if (tTempStackSize > 0 + && tTempStackSize + mouseStack.stackSize <= mouseStack.getMaxStackSize()) { mouseStack.stackSize += tTempStackSize; tTempStack = aSlot.decrStackSize(tTempStackSize); @@ -231,7 +240,8 @@ public class GT_Container extends Container { if (aSlot.canTakeStack(aPlayer)) { // get the stack at the specified hotbar slot. tTempStack = aPlayerInventory.getStackInSlot(aMouseclick); - boolean canSwap = tTempStack == null || aSlot.inventory == aPlayerInventory && aSlot.isItemValid(tTempStack); + boolean canSwap = + tTempStack == null || aSlot.inventory == aPlayerInventory && aSlot.isItemValid(tTempStack); tTempStackSize = -1; if (!canSwap) { @@ -260,7 +270,10 @@ public class GT_Container extends Container { aSlot.putStack(tTempStack); } } - } else if (aShifthold == 3 && aPlayer.capabilities.isCreativeMode && aPlayerInventory.getItemStack() == null && aSlotIndex >= 0) { + } else if (aShifthold == 3 + && aPlayer.capabilities.isCreativeMode + && aPlayerInventory.getItemStack() == null + && aSlotIndex >= 0) { aSlot = (Slot) this.inventorySlots.get(aSlotIndex); if (aSlot != null && aSlot.getHasStack()) { tTempStack = GT_Utility.copyOrNull(aSlot.getStack()); @@ -278,19 +291,26 @@ public class GT_Container extends Container { mTileEntity.markDirty(); - //null checks and checks if the item can be stacked (maxStackSize > 1) - if (getSlotCount() > 0 && slotObject != null && slotObject.getHasStack() && !(slotObject instanceof GT_Slot_Holo)) { + // null checks and checks if the item can be stacked (maxStackSize > 1) + if (getSlotCount() > 0 + && slotObject != null + && slotObject.getHasStack() + && !(slotObject instanceof GT_Slot_Holo)) { ItemStack stackInSlot = slotObject.getStack(); stack = GT_Utility.copyOrNull(stackInSlot); - //TileEntity -> Player + // TileEntity -> Player if (aSlotIndex < getAllSlotCount()) { if (doesBindPlayerInventory()) if (!mergeItemStack(stackInSlot, getAllSlotCount(), getAllSlotCount() + 36, true)) { return null; } - //Player -> TileEntity - } else if (!mergeItemStack(stackInSlot, getShiftClickStartIndex(), getShiftClickStartIndex() + getShiftClickSlotCount(), false)) { + // Player -> TileEntity + } else if (!mergeItemStack( + stackInSlot, + getShiftClickStartIndex(), + getShiftClickStartIndex() + getShiftClickSlotCount(), + false)) { return null; } @@ -321,10 +341,17 @@ public class GT_Container extends Container { ItemStack itemStack; if (aStack.isStackable()) { - while (aStack.stackSize > 0 && (!reverseOrder && slotIndex < aSlotCount || reverseOrder && slotIndex >= aStartIndex)) { + while (aStack.stackSize > 0 + && (!reverseOrder && slotIndex < aSlotCount || reverseOrder && slotIndex >= aStartIndex)) { slot = (Slot) this.inventorySlots.get(slotIndex); itemStack = slot.getStack(); - if (!(slot instanceof GT_Slot_Holo) && !(slot instanceof GT_Slot_Output) && slot.isItemValid(aStack) && itemStack != null && itemStack.getItem() == aStack.getItem() && (!aStack.getHasSubtypes() || aStack.getItemDamage() == itemStack.getItemDamage()) && ItemStack.areItemStackTagsEqual(aStack, itemStack)) { + if (!(slot instanceof GT_Slot_Holo) + && !(slot instanceof GT_Slot_Output) + && slot.isItemValid(aStack) + && itemStack != null + && itemStack.getItem() == aStack.getItem() + && (!aStack.getHasSubtypes() || aStack.getItemDamage() == itemStack.getItemDamage()) + && ItemStack.areItemStackTagsEqual(aStack, itemStack)) { int combinedStackSize = itemStack.stackSize + aStack.stackSize; if (itemStack.stackSize < mTileEntity.getInventoryStackLimit()) { if (combinedStackSize <= aStack.getMaxStackSize()) { @@ -569,14 +596,18 @@ public class GT_Container extends Container { return true; } - protected static ItemStack handleFluidSlotClick(IFluidAccess aFluidAccess, EntityPlayer aPlayer, boolean aProcessFullStack, boolean aCanDrain, boolean aCanFill) { + protected static ItemStack handleFluidSlotClick( + IFluidAccess aFluidAccess, + EntityPlayer aPlayer, + boolean aProcessFullStack, + boolean aCanDrain, + boolean aCanFill) { ItemStack tStackHeld = aPlayer.inventory.getItemStack(); ItemStack tStackSizedOne = GT_Utility.copyAmount(1, tStackHeld); if (tStackSizedOne == null || tStackHeld.stackSize == 0) return null; FluidStack tInputFluid = aFluidAccess.get(); FluidStack tFluidHeld = GT_Utility.getFluidForFilledItem(tStackSizedOne, true); - if (tFluidHeld != null && tFluidHeld.amount <= 0) - tFluidHeld = null; + if (tFluidHeld != null && tFluidHeld.amount <= 0) tFluidHeld = null; if (tInputFluid == null) { // tank empty, consider fill only from now on if (!aCanFill) @@ -639,19 +670,17 @@ public class GT_Container extends Container { } replaceCursorItemStack(aPlayer, tFilledContainer); } - if (tTankStack.amount <= 0) - aFluidAccess.set(null); + if (tTankStack.amount <= 0) aFluidAccess.set(null); return tFilledContainer; } - protected static ItemStack fillFluid(IFluidAccess aFluidAccess, EntityPlayer aPlayer, FluidStack aFluidHeld, boolean aProcessFullStack) { + 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; + if (tStackSizedOne == null) return null; int tFreeSpace = aFluidAccess.getCapacity() - (aFluidAccess.get() != null ? aFluidAccess.get().amount : 0); if (tFreeSpace <= 0) @@ -715,5 +744,4 @@ public class GT_Container extends Container { GT_Utility.addItemToPlayerInventory(aPlayer, tStackResult); } } - } 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 97ee1d85a3..f2774bbd38 100644 --- a/src/main/java/gregtech/api/gui/GT_ContainerMetaTile_Machine.java +++ b/src/main/java/gregtech/api/gui/GT_ContainerMetaTile_Machine.java @@ -1,13 +1,12 @@ package gregtech.api.gui; -import java.util.List; - import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; import gregtech.api.interfaces.metatileentity.IConfigurationCircuitSupport; import gregtech.api.interfaces.metatileentity.IMetaTileEntity; import gregtech.api.interfaces.tileentity.IGregTechTileEntity; import gregtech.api.util.GT_Utility; +import java.util.List; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.player.InventoryPlayer; import net.minecraft.inventory.ICrafting; @@ -31,8 +30,7 @@ public class GT_ContainerMetaTile_Machine extends GT_Container { mInput = 0, mID = 0, mDisplayErrorCode = 0; - public long mEnergyLong = 0, - mStorageLong = 0; + public long mEnergyLong = 0, mStorageLong = 0; private int oActive = 0, oMaxProgressTime = 0, oProgressTime = 0, @@ -44,12 +42,10 @@ public class GT_ContainerMetaTile_Machine extends GT_Container { oInput = 0, oID = 0, oDisplayErrorCode = 0; - private long oEnergyLong = 0, - oStorageLong = 0; + private long oEnergyLong = 0, oStorageLong = 0; protected int mTimer = 0; protected Runnable circuitSlotClickCallback; - public GT_ContainerMetaTile_Machine(InventoryPlayer aInventoryPlayer, IGregTechTileEntity aTileEntity) { super(aInventoryPlayer, aTileEntity); @@ -57,31 +53,32 @@ public class GT_ContainerMetaTile_Machine extends GT_Container { if (mTileEntity != null && mTileEntity.getMetaTileEntity() != null) { addSlots(aInventoryPlayer); - if (doesBindPlayerInventory()) - bindPlayerInventory(aInventoryPlayer); + if (doesBindPlayerInventory()) bindPlayerInventory(aInventoryPlayer); detectAndSendChanges(); } else { aInventoryPlayer.player.openContainer = aInventoryPlayer.player.inventoryContainer; } } - public GT_ContainerMetaTile_Machine(InventoryPlayer aInventoryPlayer, IGregTechTileEntity aTileEntity, boolean doesBindInventory) { + public GT_ContainerMetaTile_Machine( + InventoryPlayer aInventoryPlayer, IGregTechTileEntity aTileEntity, boolean doesBindInventory) { super(aInventoryPlayer, aTileEntity); mTileEntity = aTileEntity; if (mTileEntity != null && mTileEntity.getMetaTileEntity() != null) { addSlots(aInventoryPlayer); - if (doesBindPlayerInventory() && doesBindInventory) - bindPlayerInventory(aInventoryPlayer); + if (doesBindPlayerInventory() && doesBindInventory) bindPlayerInventory(aInventoryPlayer); detectAndSendChanges(); } else { aInventoryPlayer.player.openContainer = aInventoryPlayer.player.inventoryContainer; } } + protected void addCircuitSlot() { if (mTileEntity.getMetaTileEntity() instanceof IConfigurationCircuitSupport) { - IConfigurationCircuitSupport ccs = (IConfigurationCircuitSupport)mTileEntity.getMetaTileEntity(); - GT_Slot_Render slotCircuit = new GT_Slot_Render(mTileEntity, ccs.getCircuitSlot(), ccs.getCircuitSlotX(), ccs.getCircuitSlotY()); + IConfigurationCircuitSupport ccs = (IConfigurationCircuitSupport) mTileEntity.getMetaTileEntity(); + GT_Slot_Render slotCircuit = + new GT_Slot_Render(mTileEntity, ccs.getCircuitSlot(), ccs.getCircuitSlotX(), ccs.getCircuitSlotY()); addSlotToContainer(slotCircuit); slotCircuit.setEnabled(ccs.allowSelectCircuit()); } @@ -95,8 +92,7 @@ public class GT_ContainerMetaTile_Machine extends GT_Container { @Override public void detectAndSendChanges() { super.detectAndSendChanges(); - if (mTileEntity.isClientSide() || mTileEntity.getMetaTileEntity() == null) - return; + if (mTileEntity.isClientSide() || mTileEntity.getMetaTileEntity() == null) return; mStorage = (int) Math.min(Integer.MAX_VALUE, mTileEntity.getEUCapacity()); mStorageLong = mTileEntity.getEUCapacity(); mEnergy = (int) Math.min(Integer.MAX_VALUE, mTileEntity.getStoredEU()); @@ -261,17 +257,17 @@ public class GT_ContainerMetaTile_Machine extends GT_Container { public void setCircuitSlotClickCallback(Runnable circuitSlotClickCallback) { this.circuitSlotClickCallback = circuitSlotClickCallback; } + @Override public ItemStack slotClick(int aSlotNumber, int aMouseclick, int aShifthold, EntityPlayer aPlayer) { if (mTileEntity.getMetaTileEntity() instanceof IConfigurationCircuitSupport) { IMetaTileEntity machine = mTileEntity.getMetaTileEntity(); - IConfigurationCircuitSupport ccs = (IConfigurationCircuitSupport)machine; + IConfigurationCircuitSupport ccs = (IConfigurationCircuitSupport) machine; if (ccs.allowSelectCircuit() && aSlotNumber == ccs.getCircuitGUISlot() && aMouseclick < 2) { ItemStack newCircuit; if (aShifthold == 1) { if (aMouseclick == 0) { - if (circuitSlotClickCallback != null) - circuitSlotClickCallback.run(); + if (circuitSlotClickCallback != null) circuitSlotClickCallback.run(); return null; } else { // clear @@ -282,7 +278,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_Container_2by2_Fluid.java b/src/main/java/gregtech/api/gui/GT_Container_2by2_Fluid.java index f8f4e3c886..35ed089c97 100644 --- a/src/main/java/gregtech/api/gui/GT_Container_2by2_Fluid.java +++ b/src/main/java/gregtech/api/gui/GT_Container_2by2_Fluid.java @@ -38,15 +38,18 @@ public class GT_Container_2by2_Fluid extends GT_ContainerMetaTile_Machine { * I'd imagine this lag to become only more severe when playing MP over ethernet, which would have much more latency * than a memory connection */ - GT_MetaTileEntity_Hatch_MultiInput tTank = (GT_MetaTileEntity_Hatch_MultiInput) mTileEntity.getMetaTileEntity(); + GT_MetaTileEntity_Hatch_MultiInput tTank = + (GT_MetaTileEntity_Hatch_MultiInput) mTileEntity.getMetaTileEntity(); tTank.setDrainableStack(GT_Utility.getFluidFromDisplayStack(tTank.getStackInSlot(2))); } - GT_MetaTileEntity_Hatch_MultiInput tTank = (GT_MetaTileEntity_Hatch_MultiInput) mTileEntity.getMetaTileEntity(); + GT_MetaTileEntity_Hatch_MultiInput tTank = + (GT_MetaTileEntity_Hatch_MultiInput) mTileEntity.getMetaTileEntity(); MultiFluidAccess tDrainableAccess = MultiFluidAccess.from(tTank, aSlotIndex); ItemStack tStackHeld = aPlayer.inventory.getItemStack(); FluidStack tFluidHeld = GT_Utility.getFluidForFilledItem(tStackHeld, true); if (tDrainableAccess.isMatch(tFluidHeld, aSlotIndex)) - return handleFluidSlotClick(tDrainableAccess, aPlayer, aMouseclick == 0, true, !tTank.isDrainableStackSeparate()); + return handleFluidSlotClick( + tDrainableAccess, aPlayer, aMouseclick == 0, true, !tTank.isDrainableStackSeparate()); } return super.slotClick(aSlotIndex, aMouseclick, aShifthold, aPlayer); } diff --git a/src/main/java/gregtech/api/gui/GT_Container_BasicMachine.java b/src/main/java/gregtech/api/gui/GT_Container_BasicMachine.java index 6db6d45a89..fc0b3270d2 100644 --- a/src/main/java/gregtech/api/gui/GT_Container_BasicMachine.java +++ b/src/main/java/gregtech/api/gui/GT_Container_BasicMachine.java @@ -1,23 +1,20 @@ package gregtech.api.gui; +import static gregtech.api.metatileentity.implementations.GT_MetaTileEntity_BasicMachine.OTHER_SLOT_COUNT; + import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; -import gregtech.api.interfaces.IFluidAccess; import gregtech.api.interfaces.tileentity.IGregTechTileEntity; import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_BasicMachine; import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_BasicTank; -import gregtech.api.util.GT_Utility; import gregtech.api.util.GT_Recipe.GT_Recipe_Map; +import gregtech.api.util.GT_Utility; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.player.InventoryPlayer; import net.minecraft.inventory.ICrafting; import net.minecraft.inventory.Slot; import net.minecraft.item.ItemStack; -import java.util.List; - -import static gregtech.api.metatileentity.implementations.GT_MetaTileEntity_BasicMachine.OTHER_SLOT_COUNT; - /** * NEVER INCLUDE THIS FILE IN YOUR MOD!!! * <p/> @@ -25,10 +22,7 @@ import static gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Basi */ public class GT_Container_BasicMachine extends GT_Container_BasicTank { - public boolean - mFluidTransfer = false, - mItemTransfer = false, - mStuttering = false; + public boolean mFluidTransfer = false, mItemTransfer = false, mStuttering = false; GT_Slot_Holo slotFluidTransferToggle; GT_Slot_Holo slotItemTransferToggle; @@ -198,9 +192,7 @@ public class GT_Container_BasicMachine extends GT_Container_BasicTank { addSlotToContainer(slotBattery = new Slot(mTileEntity, 1, 80, 63)); addSlotToContainer(slotSpecial = new Slot(mTileEntity, 3, 125, 63)); addSlotToContainer(slotFluidInput = new GT_Slot_Render(mTileEntity, tStartIndex++, 53, 63)); - slotFluidInput.setEnabled(recipes != null - ? (recipes.hasFluidInputs()) - : (machine.getCapacity() != 0)); + slotFluidInput.setEnabled(recipes != null ? (recipes.hasFluidInputs()) : (machine.getCapacity() != 0)); } @Override @@ -220,19 +212,25 @@ public class GT_Container_BasicMachine extends GT_Container_BasicTank { } return null; default: - if (aSlotNumber == OTHER_SLOT_COUNT + 1 + machine.mInputSlotCount + machine.mOutputItems.length && aMouseclick < 2) { + if (aSlotNumber == OTHER_SLOT_COUNT + 1 + machine.mInputSlotCount + machine.mOutputItems.length + && aMouseclick < 2) { if (mTileEntity.isClientSide()) { // see parent class slotClick for an explanation on why doing this - GT_MetaTileEntity_BasicTank tTank = (GT_MetaTileEntity_BasicTank) mTileEntity.getMetaTileEntity(); + GT_MetaTileEntity_BasicTank tTank = + (GT_MetaTileEntity_BasicTank) mTileEntity.getMetaTileEntity(); tTank.setFillableStack(GT_Utility.getFluidFromDisplayStack(tTank.getStackInSlot(2))); } GT_MetaTileEntity_BasicTank tTank = (GT_MetaTileEntity_BasicTank) mTileEntity.getMetaTileEntity(); BasicTankFluidAccess tFillableAccess = BasicTankFluidAccess.from(tTank, true); GT_Recipe_Map recipes = machine.getRecipeList(); - //If the machine has recipes but no fluid inputs, disallow filling this slot with fluids. - ItemStack tToken = handleFluidSlotClick(tFillableAccess, aPlayer, aMouseclick == 0, true, (recipes == null || recipes.hasFluidInputs())); - if (mTileEntity.isServerSide() && tToken != null) - mTileEntity.markInventoryBeenModified(); + // If the machine has recipes but no fluid inputs, disallow filling this slot with fluids. + ItemStack tToken = handleFluidSlotClick( + tFillableAccess, + aPlayer, + aMouseclick == 0, + true, + (recipes == null || recipes.hasFluidInputs())); + if (mTileEntity.isServerSide() && tToken != null) mTileEntity.markInventoryBeenModified(); return tToken; } else { return super.slotClick(aSlotNumber, aMouseclick, aShifthold, aPlayer); diff --git a/src/main/java/gregtech/api/gui/GT_Container_BasicTank.java b/src/main/java/gregtech/api/gui/GT_Container_BasicTank.java index d294b60ca9..23769ab0cc 100644 --- a/src/main/java/gregtech/api/gui/GT_Container_BasicTank.java +++ b/src/main/java/gregtech/api/gui/GT_Container_BasicTank.java @@ -55,7 +55,8 @@ public class GT_Container_BasicTank extends GT_ContainerMetaTile_Machine { } GT_MetaTileEntity_BasicTank tTank = (GT_MetaTileEntity_BasicTank) mTileEntity.getMetaTileEntity(); BasicTankFluidAccess tDrainableAccess = BasicTankFluidAccess.from(tTank, false); - return handleFluidSlotClick(tDrainableAccess, aPlayer, aMouseclick == 0, true, !tTank.isDrainableStackSeparate()); + return handleFluidSlotClick( + tDrainableAccess, aPlayer, aMouseclick == 0, true, !tTank.isDrainableStackSeparate()); } return super.slotClick(aSlotIndex, aMouseclick, aShifthold, aPlayer); } @@ -66,8 +67,7 @@ public class GT_Container_BasicTank extends GT_ContainerMetaTile_Machine { if (mTileEntity.isClientSide() || mTileEntity.getMetaTileEntity() == null) return; if (((GT_MetaTileEntity_BasicTank) mTileEntity.getMetaTileEntity()).mFluid != null) mContent = ((GT_MetaTileEntity_BasicTank) mTileEntity.getMetaTileEntity()).mFluid.amount; - else - mContent = 0; + else mContent = 0; for (Object crafter : this.crafters) { ICrafting player = (ICrafting) crafter; if (mTimer % 500 == 0 || oContent != mContent) { @@ -114,10 +114,8 @@ public class GT_Container_BasicTank extends GT_ContainerMetaTile_Machine { @Override public void set(FluidStack stack) { - if (mIsFillableStack) - mTank.setFillableStack(stack); - else - mTank.setDrainableStack(stack); + if (mIsFillableStack) mTank.setFillableStack(stack); + else mTank.setDrainableStack(stack); } @Override diff --git a/src/main/java/gregtech/api/gui/GT_Container_MaintenanceHatch.java b/src/main/java/gregtech/api/gui/GT_Container_MaintenanceHatch.java index c3758486ba..fcaf618b56 100644 --- a/src/main/java/gregtech/api/gui/GT_Container_MaintenanceHatch.java +++ b/src/main/java/gregtech/api/gui/GT_Container_MaintenanceHatch.java @@ -19,13 +19,11 @@ public class GT_Container_MaintenanceHatch extends GT_ContainerMetaTile_Machine @Override public ItemStack slotClick(int aSlotIndex, int aMouseclick, int aShifthold, EntityPlayer aPlayer) { - if (aSlotIndex != 0) - return super.slotClick(aSlotIndex, aMouseclick, aShifthold, aPlayer); + if (aSlotIndex != 0) return super.slotClick(aSlotIndex, aMouseclick, aShifthold, aPlayer); ItemStack tStack = aPlayer.inventory.getItemStack(); if (tStack != null) { ((GT_MetaTileEntity_Hatch_Maintenance) mTileEntity.getMetaTileEntity()).onToolClick(tStack, aPlayer); - if (tStack.stackSize <= 0) - aPlayer.inventory.setItemStack(null); + if (tStack.stackSize <= 0) aPlayer.inventory.setItemStack(null); } return null; } diff --git a/src/main/java/gregtech/api/gui/GT_Container_MultiMachine.java b/src/main/java/gregtech/api/gui/GT_Container_MultiMachine.java index f5e9a83d19..722057950b 100644 --- a/src/main/java/gregtech/api/gui/GT_Container_MultiMachine.java +++ b/src/main/java/gregtech/api/gui/GT_Container_MultiMachine.java @@ -14,7 +14,8 @@ public class GT_Container_MultiMachine extends GT_ContainerMetaTile_Machine { super(aInventoryPlayer, aTileEntity); } - public GT_Container_MultiMachine(InventoryPlayer aInventoryPlayer, IGregTechTileEntity aTileEntity, boolean bindInventory) { + public GT_Container_MultiMachine( + InventoryPlayer aInventoryPlayer, IGregTechTileEntity aTileEntity, boolean bindInventory) { super(aInventoryPlayer, aTileEntity, bindInventory); } diff --git a/src/main/java/gregtech/api/gui/GT_Container_SpecialFilter.java b/src/main/java/gregtech/api/gui/GT_Container_SpecialFilter.java index fef857a7ae..0622f52865 100644 --- a/src/main/java/gregtech/api/gui/GT_Container_SpecialFilter.java +++ b/src/main/java/gregtech/api/gui/GT_Container_SpecialFilter.java @@ -48,51 +48,58 @@ public class GT_Container_SpecialFilter extends GT_ContainerMetaTile_Machine { return null; } if (aSlotIndex == 9) { - ((GT_MetaTileEntity_SpecialFilter) this.mTileEntity.getMetaTileEntity()).clickTypeIcon(aMouseclick != 0, aPlayer.inventory.getItemStack()); + ((GT_MetaTileEntity_SpecialFilter) this.mTileEntity.getMetaTileEntity()) + .clickTypeIcon(aMouseclick != 0, aPlayer.inventory.getItemStack()); return null; } if (aSlotIndex == 10) { - ((GT_MetaTileEntity_SpecialFilter) this.mTileEntity.getMetaTileEntity()).bOutput = (!((GT_MetaTileEntity_SpecialFilter) this.mTileEntity.getMetaTileEntity()).bOutput); + ((GT_MetaTileEntity_SpecialFilter) this.mTileEntity.getMetaTileEntity()).bOutput = + (!((GT_MetaTileEntity_SpecialFilter) this.mTileEntity.getMetaTileEntity()).bOutput); if (((GT_MetaTileEntity_SpecialFilter) this.mTileEntity.getMetaTileEntity()).bOutput) { - GT_Utility.sendChatToPlayer(aPlayer, GT_Utility.trans("116","Emit Energy to Outputside")); + GT_Utility.sendChatToPlayer(aPlayer, GT_Utility.trans("116", "Emit Energy to Outputside")); } else { - GT_Utility.sendChatToPlayer(aPlayer, GT_Utility.trans("117","Don't emit Energy")); + GT_Utility.sendChatToPlayer(aPlayer, GT_Utility.trans("117", "Don't emit Energy")); } return null; } if (aSlotIndex == 11) { - ((GT_MetaTileEntity_SpecialFilter) this.mTileEntity.getMetaTileEntity()).bRedstoneIfFull = (!((GT_MetaTileEntity_SpecialFilter) this.mTileEntity.getMetaTileEntity()).bRedstoneIfFull); + ((GT_MetaTileEntity_SpecialFilter) this.mTileEntity.getMetaTileEntity()).bRedstoneIfFull = + (!((GT_MetaTileEntity_SpecialFilter) this.mTileEntity.getMetaTileEntity()).bRedstoneIfFull); if (((GT_MetaTileEntity_SpecialFilter) this.mTileEntity.getMetaTileEntity()).bRedstoneIfFull) { - GT_Utility.sendChatToPlayer(aPlayer, GT_Utility.trans("122","Emit Redstone if slots contain something")); + GT_Utility.sendChatToPlayer( + aPlayer, GT_Utility.trans("122", "Emit Redstone if slots contain something")); } else { - GT_Utility.sendChatToPlayer(aPlayer, GT_Utility.trans("123","Don't emit Redstone")); + GT_Utility.sendChatToPlayer(aPlayer, GT_Utility.trans("123", "Don't emit Redstone")); } return null; } if (aSlotIndex == 12) { - ((GT_MetaTileEntity_SpecialFilter) this.mTileEntity.getMetaTileEntity()).bInvert = (!((GT_MetaTileEntity_SpecialFilter) this.mTileEntity.getMetaTileEntity()).bInvert); + ((GT_MetaTileEntity_SpecialFilter) this.mTileEntity.getMetaTileEntity()).bInvert = + (!((GT_MetaTileEntity_SpecialFilter) this.mTileEntity.getMetaTileEntity()).bInvert); if (((GT_MetaTileEntity_SpecialFilter) this.mTileEntity.getMetaTileEntity()).bInvert) { - GT_Utility.sendChatToPlayer(aPlayer, GT_Utility.trans("120","Invert Redstone")); + GT_Utility.sendChatToPlayer(aPlayer, GT_Utility.trans("120", "Invert Redstone")); } else { - GT_Utility.sendChatToPlayer(aPlayer, GT_Utility.trans("121","Don't invert Redstone")); + GT_Utility.sendChatToPlayer(aPlayer, GT_Utility.trans("121", "Don't invert Redstone")); } return null; } if (aSlotIndex == 13) { - ((GT_MetaTileEntity_SpecialFilter) this.mTileEntity.getMetaTileEntity()).bInvertFilter = (!((GT_MetaTileEntity_SpecialFilter) this.mTileEntity.getMetaTileEntity()).bInvertFilter); + ((GT_MetaTileEntity_SpecialFilter) this.mTileEntity.getMetaTileEntity()).bInvertFilter = + (!((GT_MetaTileEntity_SpecialFilter) this.mTileEntity.getMetaTileEntity()).bInvertFilter); if (((GT_MetaTileEntity_SpecialFilter) this.mTileEntity.getMetaTileEntity()).bInvertFilter) { - GT_Utility.sendChatToPlayer(aPlayer, GT_Utility.trans("124","Invert Filter")); + GT_Utility.sendChatToPlayer(aPlayer, GT_Utility.trans("124", "Invert Filter")); } else { - GT_Utility.sendChatToPlayer(aPlayer, GT_Utility.trans("125","Don't invert Filter")); + GT_Utility.sendChatToPlayer(aPlayer, GT_Utility.trans("125", "Don't invert Filter")); } return null; } if (aSlotIndex == 14) { - ((GT_MetaTileEntity_SpecialFilter) this.mTileEntity.getMetaTileEntity()).bNBTAllowed = (!((GT_MetaTileEntity_SpecialFilter) this.mTileEntity.getMetaTileEntity()).bNBTAllowed); + ((GT_MetaTileEntity_SpecialFilter) this.mTileEntity.getMetaTileEntity()).bNBTAllowed = + (!((GT_MetaTileEntity_SpecialFilter) this.mTileEntity.getMetaTileEntity()).bNBTAllowed); if (((GT_MetaTileEntity_SpecialFilter) this.mTileEntity.getMetaTileEntity()).bNBTAllowed) { - GT_Utility.sendChatToPlayer(aPlayer, GT_Utility.trans("126","Ignore NBT")); + GT_Utility.sendChatToPlayer(aPlayer, GT_Utility.trans("126", "Ignore NBT")); } else { - GT_Utility.sendChatToPlayer(aPlayer, GT_Utility.trans("127","NBT has to match")); + GT_Utility.sendChatToPlayer(aPlayer, GT_Utility.trans("127", "NBT has to match")); } return null; } diff --git a/src/main/java/gregtech/api/gui/GT_GUIColorOverride.java b/src/main/java/gregtech/api/gui/GT_GUIColorOverride.java index c2a833503e..63c7b224b5 100644 --- a/src/main/java/gregtech/api/gui/GT_GUIColorOverride.java +++ b/src/main/java/gregtech/api/gui/GT_GUIColorOverride.java @@ -1,24 +1,25 @@ package gregtech.api.gui; -import gregtech.api.util.ColorsMetadataSection; import gregtech.api.GregTech_API; +import gregtech.api.util.ColorsMetadataSection; +import java.io.IOException; import net.minecraft.client.Minecraft; import net.minecraft.client.resources.IResource; import net.minecraft.util.ResourceLocation; -import java.io.IOException; - public class GT_GUIColorOverride { private ColorsMetadataSection cmSection; public GT_GUIColorOverride(String guiTexturePath) { try { - IResource ir = Minecraft.getMinecraft().getResourceManager().getResource(new ResourceLocation(guiTexturePath)); + IResource ir = + Minecraft.getMinecraft().getResourceManager().getResource(new ResourceLocation(guiTexturePath)); if (ir.hasMetadata()) { cmSection = (ColorsMetadataSection) ir.getMetadata("colors"); } - } catch (IOException ignore) {} + } catch (IOException ignore) { + } } public int getTextColorOrDefault(String textType, int defaultColor) { diff --git a/src/main/java/gregtech/api/gui/GT_GUIContainer.java b/src/main/java/gregtech/api/gui/GT_GUIContainer.java index 5d3f0a59a1..281f910d8c 100644 --- a/src/main/java/gregtech/api/gui/GT_GUIContainer.java +++ b/src/main/java/gregtech/api/gui/GT_GUIContainer.java @@ -1,6 +1,7 @@ package gregtech.api.gui; -import gregtech.api.gui.GT_GUIColorOverride; +import static gregtech.GT_Mod.GT_FML_LOGGER; + import net.minecraft.client.gui.inventory.GuiContainer; import net.minecraft.client.renderer.Tessellator; import net.minecraft.inventory.Container; @@ -8,10 +9,6 @@ import net.minecraft.inventory.Slot; import net.minecraft.util.ResourceLocation; import org.lwjgl.input.Mouse; -import java.io.IOException; - -import static gregtech.GT_Mod.GT_FML_LOGGER; - /** * NEVER INCLUDE THIS FILE IN YOUR MOD!!! * <p/> @@ -79,11 +76,9 @@ public class GT_GUIContainer extends GuiContainer { super.handleMouseInput(); } - protected void onMouseWheel(int mx, int my, int delta) { - } + protected void onMouseWheel(int mx, int my, int delta) {} - public boolean isMouseOverSlot(int slotIndex, int mx, int my) - { + public boolean isMouseOverSlot(int slotIndex, int mx, int my) { int size = inventorySlots.inventorySlots.size(); if (slotIndex < 0 || slotIndex >= size) { // slot does not exist somehow. log and carry on 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 8a744aee60..0752324678 100644 --- a/src/main/java/gregtech/api/gui/GT_GUIContainerMetaTile_Machine.java +++ b/src/main/java/gregtech/api/gui/GT_GUIContainerMetaTile_Machine.java @@ -17,16 +17,13 @@ import gregtech.api.net.GT_Packet_SetConfigurationCircuit; import gregtech.api.util.GT_TooltipDataCache; import gregtech.api.util.GT_Util; import gregtech.api.util.GT_Utility; - +import java.util.List; import net.minecraft.client.gui.FontRenderer; import net.minecraft.client.renderer.entity.RenderItem; import net.minecraft.entity.player.InventoryPlayer; import net.minecraft.inventory.Slot; import net.minecraft.item.ItemStack; import net.minecraft.util.StatCollector; - -import java.util.List; - import org.lwjgl.opengl.GL11; /** @@ -46,27 +43,22 @@ public class GT_GUIContainerMetaTile_Machine extends GT_GUIContainer implements // Cover Tabs support. Subclasses can override display position, style and visuals by overriding setupCoverTabs public GT_GuiCoverTabLine coverTabs; - private static final int - COVER_TAB_LEFT = -16, - COVER_TAB_TOP = 1, - COVER_TAB_HEIGHT = 20, - COVER_TAB_WIDTH = 18, - COVER_TAB_SPACING = 2; - private static final DisplayStyle - COVER_TAB_X_DIR = DisplayStyle.NONE, - COVER_TAB_Y_DIR = DisplayStyle.NORMAL; - private static final GT_GuiTabIconSet TAB_ICONSET = new GT_GuiTabIconSet( - GT_GuiIcon.TAB_NORMAL, - GT_GuiIcon.TAB_HIGHLIGHT, - GT_GuiIcon.TAB_DISABLED); + private static final int COVER_TAB_LEFT = -16, + COVER_TAB_TOP = 1, + COVER_TAB_HEIGHT = 20, + COVER_TAB_WIDTH = 18, + COVER_TAB_SPACING = 2; + private static final DisplayStyle COVER_TAB_X_DIR = DisplayStyle.NONE, COVER_TAB_Y_DIR = DisplayStyle.NORMAL; + private static final GT_GuiTabIconSet TAB_ICONSET = + new GT_GuiTabIconSet(GT_GuiIcon.TAB_NORMAL, GT_GuiIcon.TAB_HIGHLIGHT, GT_GuiIcon.TAB_DISABLED); public GT_GUIContainerMetaTile_Machine(GT_ContainerMetaTile_Machine aContainer, String aGUIbackground) { super(aContainer, aGUIbackground); mContainer = aContainer; DisplayStyle preferredDisplayStyle = GT_Mod.gregtechproxy.mCoverTabsVisible - ? (GT_Mod.gregtechproxy.mCoverTabsFlipped ? DisplayStyle.INVERSE : DisplayStyle.NORMAL) - : DisplayStyle.NONE; + ? (GT_Mod.gregtechproxy.mCoverTabsFlipped ? DisplayStyle.INVERSE : DisplayStyle.NORMAL) + : DisplayStyle.NONE; setupCoverTabs(preferredDisplayStyle); // Only setup tooltips if they're currently enabled. @@ -78,8 +70,8 @@ public class GT_GUIContainerMetaTile_Machine extends GT_GUIContainer implements mContainer.setCircuitSlotClickCallback(this::openSelectCircuitDialog); } - public GT_GUIContainerMetaTile_Machine(InventoryPlayer aInventoryPlayer, IGregTechTileEntity aTileEntity, - String aGUIbackground) { + public GT_GUIContainerMetaTile_Machine( + InventoryPlayer aInventoryPlayer, IGregTechTileEntity aTileEntity, String aGUIbackground) { this(new GT_ContainerMetaTile_Machine(aInventoryPlayer, aTileEntity), aGUIbackground); } @@ -88,18 +80,18 @@ public class GT_GUIContainerMetaTile_Machine extends GT_GUIContainer implements */ protected void setupCoverTabs(DisplayStyle preferredDisplayStyle) { coverTabs = new GT_GuiCoverTabLine( - this, - COVER_TAB_LEFT, - COVER_TAB_TOP, - COVER_TAB_HEIGHT, - COVER_TAB_WIDTH, - COVER_TAB_SPACING, - COVER_TAB_X_DIR, - COVER_TAB_Y_DIR, - preferredDisplayStyle, - getTabBackground(), - getMachine().getBaseMetaTileEntity(), - getColorization()); + this, + COVER_TAB_LEFT, + COVER_TAB_TOP, + COVER_TAB_HEIGHT, + COVER_TAB_WIDTH, + COVER_TAB_SPACING, + COVER_TAB_X_DIR, + COVER_TAB_Y_DIR, + preferredDisplayStyle, + getTabBackground(), + getMachine().getBaseMetaTileEntity(), + getColorization()); } @Override @@ -152,15 +144,14 @@ public class GT_GUIContainerMetaTile_Machine extends GT_GUIContainer implements /** * @return This machine's MetaTileEntity */ - private MetaTileEntity getMachine() { - return (MetaTileEntity ) mContainer.mTileEntity.getMetaTileEntity(); + private MetaTileEntity getMachine() { + return (MetaTileEntity) mContainer.mTileEntity.getMetaTileEntity(); } // Tabs support @Override - protected void mouseClicked(int mouseX, int mouseY, int mouseButton) - { + protected void mouseClicked(int mouseX, int mouseY, int mouseButton) { super.mouseClicked(mouseX, mouseY, mouseButton); // Check for clicked tabs coverTabs.onMouseClicked(mouseX, mouseY, mouseButton); @@ -188,11 +179,12 @@ 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()), mTooltipCache.getData(GHOST_CIRCUIT_TOOLTIP))); + addToolTip(new GT_GuiSlotTooltip( + mContainer.getSlot(ccs.getCircuitGUISlot()), mTooltipCache.getData(GHOST_CIRCUIT_TOOLTIP))); } - } // GT_IToolTipRenderer and GT_ITabRenderer implementations @@ -200,30 +192,37 @@ public class GT_GUIContainerMetaTile_Machine extends GT_GUIContainer implements public void drawHoveringText(List text, int mouseX, int mouseY, FontRenderer font) { super.drawHoveringText(text, mouseX, mouseY, font); } + @Override public int getGuiTop() { return guiTop; } + @Override public int getGuiLeft() { return guiLeft; } + @Override public int getXSize() { return xSize; } + @Override public FontRenderer getFontRenderer() { return fontRendererObj; } + @Override public RenderItem getItemRenderer() { return itemRender; } + @Override public void addToolTip(GT_GuiTooltip toolTip) { mTooltipManager.addToolTip(toolTip); } + @Override public boolean removeToolTip(GT_GuiTooltip toolTip) { return mTooltipManager.removeToolTip(toolTip); @@ -232,11 +231,11 @@ 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)) - { + if (slotCircuit != null + && func_146978_c(slotCircuit.xDisplayPosition, slotCircuit.yDisplayPosition, 16, 16, mx, my)) { // emulate click handleMouseClick(slotCircuit, -1, delta > 0 ? 1 : 0, 0); return; @@ -247,23 +246,22 @@ public class GT_GUIContainerMetaTile_Machine extends GT_GUIContainer implements private void openSelectCircuitDialog() { IMetaTileEntity machine = mContainer.mTileEntity.getMetaTileEntity(); - IConfigurationCircuitSupport ccs = (IConfigurationCircuitSupport)machine; + IConfigurationCircuitSupport ccs = (IConfigurationCircuitSupport) machine; List<ItemStack> circuits = ccs.getConfigurationCircuits(); mc.displayGuiScreen(new GT_GUIDialogSelectItem( - StatCollector.translateToLocal("GT5U.machines.select_circuit"), - machine.getStackForm(0), - this, - this::onCircuitSelected, - circuits, - GT_Utility.findMatchingStackInList(circuits, - machine.getStackInSlot(ccs.getCircuitSlot())))); + StatCollector.translateToLocal("GT5U.machines.select_circuit"), + machine.getStackForm(0), + this, + this::onCircuitSelected, + circuits, + GT_Utility.findMatchingStackInList(circuits, machine.getStackInSlot(ccs.getCircuitSlot())))); } private void onCircuitSelected(ItemStack selected) { GT_Values.NW.sendToServer(new GT_Packet_SetConfigurationCircuit(mContainer.mTileEntity, selected)); // we will not do any validation on client side // it doesn't get to actually decide what inventory contains anyway - IConfigurationCircuitSupport ccs = (IConfigurationCircuitSupport)mContainer.mTileEntity.getMetaTileEntity(); + IConfigurationCircuitSupport ccs = (IConfigurationCircuitSupport) mContainer.mTileEntity.getMetaTileEntity(); mContainer.mTileEntity.setInventorySlotContents(ccs.getCircuitSlot(), selected); } } diff --git a/src/main/java/gregtech/api/gui/GT_GUIContainer_1by1.java b/src/main/java/gregtech/api/gui/GT_GUIContainer_1by1.java index 7e85cb60f0..16ef27c941 100644 --- a/src/main/java/gregtech/api/gui/GT_GUIContainer_1by1.java +++ b/src/main/java/gregtech/api/gui/GT_GUIContainer_1by1.java @@ -1,12 +1,12 @@ package gregtech.api.gui; +import static gregtech.api.enums.GT_Values.RES_PATH_GUI; + import gregtech.api.interfaces.tileentity.IGregTechTileEntity; import net.minecraft.entity.player.InventoryPlayer; -import static gregtech.api.enums.GT_Values.RES_PATH_GUI; - public class GT_GUIContainer_1by1 extends GT_GUIContainerMetaTile_Machine { - + private final String mName; private final int textColor = this.getTextColorOrDefault("title", 0x404040); @@ -15,7 +15,8 @@ public class GT_GUIContainer_1by1 extends GT_GUIContainerMetaTile_Machine { mName = aName; } - public GT_GUIContainer_1by1(InventoryPlayer aInventoryPlayer, IGregTechTileEntity aTileEntity, String aName, String aBackground) { + public GT_GUIContainer_1by1( + InventoryPlayer aInventoryPlayer, IGregTechTileEntity aTileEntity, String aName, String aBackground) { super(new GT_Container_1by1(aInventoryPlayer, aTileEntity), RES_PATH_GUI + aBackground + "1by1.png"); mName = aName; } diff --git a/src/main/java/gregtech/api/gui/GT_GUIContainer_2by2.java b/src/main/java/gregtech/api/gui/GT_GUIContainer_2by2.java index acefe12459..909a5b0d6a 100644 --- a/src/main/java/gregtech/api/gui/GT_GUIContainer_2by2.java +++ b/src/main/java/gregtech/api/gui/GT_GUIContainer_2by2.java @@ -1,10 +1,10 @@ package gregtech.api.gui; +import static gregtech.api.enums.GT_Values.RES_PATH_GUI; + import gregtech.api.interfaces.tileentity.IGregTechTileEntity; import net.minecraft.entity.player.InventoryPlayer; -import static gregtech.api.enums.GT_Values.RES_PATH_GUI; - public class GT_GUIContainer_2by2 extends GT_GUIContainerMetaTile_Machine { private final String mName; @@ -15,7 +15,8 @@ public class GT_GUIContainer_2by2 extends GT_GUIContainerMetaTile_Machine { mName = aName; } - public GT_GUIContainer_2by2(InventoryPlayer aInventoryPlayer, IGregTechTileEntity aTileEntity, String aName, String aBackground) { + public GT_GUIContainer_2by2( + InventoryPlayer aInventoryPlayer, IGregTechTileEntity aTileEntity, String aName, String aBackground) { super(new GT_Container_2by2(aInventoryPlayer, aTileEntity), RES_PATH_GUI + aBackground + "2by2.png"); mName = aName; } diff --git a/src/main/java/gregtech/api/gui/GT_GUIContainer_2by2_Fluid.java b/src/main/java/gregtech/api/gui/GT_GUIContainer_2by2_Fluid.java index afabaa0a80..d896349f0a 100644 --- a/src/main/java/gregtech/api/gui/GT_GUIContainer_2by2_Fluid.java +++ b/src/main/java/gregtech/api/gui/GT_GUIContainer_2by2_Fluid.java @@ -1,11 +1,11 @@ package gregtech.api.gui; +import static gregtech.api.enums.GT_Values.RES_PATH_GUI; + import gregtech.api.interfaces.tileentity.IGregTechTileEntity; import net.minecraft.entity.player.InventoryPlayer; import net.minecraft.util.StatCollector; -import static gregtech.api.enums.GT_Values.RES_PATH_GUI; - public class GT_GUIContainer_2by2_Fluid extends GT_GUIContainerMetaTile_Machine { private final String mName; @@ -29,5 +29,4 @@ public class GT_GUIContainer_2by2_Fluid extends GT_GUIContainerMetaTile_Machine int y = (height - ySize) / 2; drawTexturedModalRect(x, y, 0, 0, xSize, ySize); } - } diff --git a/src/main/java/gregtech/api/gui/GT_GUIContainer_3by3.java b/src/main/java/gregtech/api/gui/GT_GUIContainer_3by3.java index c2911fc67f..97caa08946 100644 --- a/src/main/java/gregtech/api/gui/GT_GUIContainer_3by3.java +++ b/src/main/java/gregtech/api/gui/GT_GUIContainer_3by3.java @@ -1,10 +1,10 @@ package gregtech.api.gui; +import static gregtech.api.enums.GT_Values.RES_PATH_GUI; + import gregtech.api.interfaces.tileentity.IGregTechTileEntity; import net.minecraft.entity.player.InventoryPlayer; -import static gregtech.api.enums.GT_Values.RES_PATH_GUI; - public class GT_GUIContainer_3by3 extends GT_GUIContainerMetaTile_Machine { private final String mName; @@ -15,7 +15,8 @@ public class GT_GUIContainer_3by3 extends GT_GUIContainerMetaTile_Machine { mName = aName; } - public GT_GUIContainer_3by3(InventoryPlayer aInventoryPlayer, IGregTechTileEntity aTileEntity, String aName, String aBackground) { + public GT_GUIContainer_3by3( + InventoryPlayer aInventoryPlayer, IGregTechTileEntity aTileEntity, String aName, String aBackground) { super(new GT_Container_3by3(aInventoryPlayer, aTileEntity), RES_PATH_GUI + aBackground + "3by3.png"); mName = aName; } diff --git a/src/main/java/gregtech/api/gui/GT_GUIContainer_4by4.java b/src/main/java/gregtech/api/gui/GT_GUIContainer_4by4.java index b28129eede..40441e3093 100644 --- a/src/main/java/gregtech/api/gui/GT_GUIContainer_4by4.java +++ b/src/main/java/gregtech/api/gui/GT_GUIContainer_4by4.java @@ -1,10 +1,10 @@ package gregtech.api.gui; +import static gregtech.api.enums.GT_Values.RES_PATH_GUI; + import gregtech.api.interfaces.tileentity.IGregTechTileEntity; import net.minecraft.entity.player.InventoryPlayer; -import static gregtech.api.enums.GT_Values.RES_PATH_GUI; - public class GT_GUIContainer_4by4 extends GT_GUIContainerMetaTile_Machine { private final String mName; @@ -15,7 +15,8 @@ public class GT_GUIContainer_4by4 extends GT_GUIContainerMetaTile_Machine { mName = aName; } - public GT_GUIContainer_4by4(InventoryPlayer aInventoryPlayer, IGregTechTileEntity aTileEntity, String aName, String aBackground) { + public GT_GUIContainer_4by4( + InventoryPlayer aInventoryPlayer, IGregTechTileEntity aTileEntity, String aName, String aBackground) { super(new GT_Container_4by4(aInventoryPlayer, aTileEntity), RES_PATH_GUI + aBackground + "4by4.png"); mName = aName; } 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 338d9e14a2..35dcf047a7 100644 --- a/src/main/java/gregtech/api/gui/GT_GUIContainer_BasicMachine.java +++ b/src/main/java/gregtech/api/gui/GT_GUIContainer_BasicMachine.java @@ -1,27 +1,23 @@ package gregtech.api.gui; +import static gregtech.api.enums.GT_Values.RES_PATH_GUI; + import gregtech.api.enums.GT_Values; import gregtech.api.gui.widgets.GT_GuiIcon; +import gregtech.api.gui.widgets.GT_GuiSlotTooltip; +import gregtech.api.gui.widgets.GT_GuiSmartTooltip; +import gregtech.api.gui.widgets.GT_GuiSmartTooltip.TooltipVisibilityProvider; import gregtech.api.gui.widgets.GT_GuiTabLine.GT_GuiTabIconSet; import gregtech.api.interfaces.tileentity.IGregTechTileEntity; import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_BasicMachine; import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_BasicMachine_Steel; -import gregtech.api.gui.widgets.GT_GuiSlotTooltip; -import gregtech.api.gui.widgets.GT_GuiSmartTooltip; -import gregtech.api.gui.widgets.GT_GuiSmartTooltip.TooltipVisibilityProvider; -import gregtech.api.net.GT_Packet_SetConfigurationCircuit; -import gregtech.common.power.Power; -import gregtech.api.util.GT_Utility; import gregtech.api.util.GT_Recipe.GT_Recipe_Map; +import gregtech.common.power.Power; import gregtech.nei.NEI_TransferRectHost; +import java.awt.Rectangle; import net.minecraft.entity.player.InventoryPlayer; -import net.minecraft.item.ItemStack; import net.minecraft.util.StatCollector; -import java.awt.Rectangle; - -import static gregtech.api.enums.GT_Values.RES_PATH_GUI; - /** * NEVER INCLUDE THIS FILE IN YOUR MOD!!! * <p/> @@ -32,45 +28,47 @@ import static gregtech.api.enums.GT_Values.RES_PATH_GUI; */ public class GT_GUIContainer_BasicMachine extends GT_GUIContainerMetaTile_Machine implements NEI_TransferRectHost { private static final int NEEDS_STEAM_VENTING = 64; - private final static GT_GuiTabIconSet TAB_ICONSET_BRONZE = new GT_GuiTabIconSet( - GT_GuiIcon.TAB_NORMAL_BRONZE, - GT_GuiIcon.TAB_HIGHLIGHT_BRONZE, - GT_GuiIcon.TAB_DISABLED_BRONZE); - private final static GT_GuiTabIconSet TAB_ICONSET_STEEL = new GT_GuiTabIconSet( - GT_GuiIcon.TAB_NORMAL_STEEL, - GT_GuiIcon.TAB_HIGHLIGHT_STEEL, - GT_GuiIcon.TAB_DISABLED_STEEL); + private static final GT_GuiTabIconSet TAB_ICONSET_BRONZE = new GT_GuiTabIconSet( + GT_GuiIcon.TAB_NORMAL_BRONZE, GT_GuiIcon.TAB_HIGHLIGHT_BRONZE, GT_GuiIcon.TAB_DISABLED_BRONZE); + private static final GT_GuiTabIconSet TAB_ICONSET_STEEL = new GT_GuiTabIconSet( + GT_GuiIcon.TAB_NORMAL_STEEL, GT_GuiIcon.TAB_HIGHLIGHT_STEEL, GT_GuiIcon.TAB_DISABLED_STEEL); private final int textColor = this.getTextColorOrDefault("title", 0x404040); - public final String - mName, - mNEI; - public final byte - mProgressBarDirection, - mProgressBarAmount; - + public final String mName, mNEI; + public final byte mProgressBarDirection, mProgressBarAmount; + // Tooltip localization keys - private static final String - BATTERY_SLOT_TOOLTIP = "GT5U.machines.battery_slot.tooltip", - BATTERY_SLOT_TOOLTIP_ALT = "GT5U.machines.battery_slot.tooltip.alternative", - UNUSED_SLOT_TOOLTIP = "GT5U.machines.unused_slot.tooltip", - SPECIAL_SLOT_TOOLTIP = "GT5U.machines.special_slot.tooltip", - FLUID_INPUT_TOOLTIP = "GT5U.machines.fluid_input_slot.tooltip", - FLUID_OUTPUT_TOOLTIP = "GT5U.machines.fluid_output_slot.tooltip", - STALLED_STUTTERING_TOOLTIP = "GT5U.machines.stalled_stuttering.tooltip", - STALLED_VENT_TOOLTIP = "GT5U.machines.stalled_vent.tooltip", - FLUID_TRANSFER_TOOLTIP = "GT5U.machines.fluid_transfer.tooltip", - ITEM_TRANSFER_TOOLTIP = "GT5U.machines.item_transfer.tooltip", - POWER_SOURCE_KEY = "GT5U.machines.powersource."; - - public GT_GUIContainer_BasicMachine(InventoryPlayer aInventoryPlayer, IGregTechTileEntity aTileEntity, String aName, - String aTextureFile, String aNEI) { + private static final String BATTERY_SLOT_TOOLTIP = "GT5U.machines.battery_slot.tooltip", + BATTERY_SLOT_TOOLTIP_ALT = "GT5U.machines.battery_slot.tooltip.alternative", + UNUSED_SLOT_TOOLTIP = "GT5U.machines.unused_slot.tooltip", + SPECIAL_SLOT_TOOLTIP = "GT5U.machines.special_slot.tooltip", + FLUID_INPUT_TOOLTIP = "GT5U.machines.fluid_input_slot.tooltip", + FLUID_OUTPUT_TOOLTIP = "GT5U.machines.fluid_output_slot.tooltip", + STALLED_STUTTERING_TOOLTIP = "GT5U.machines.stalled_stuttering.tooltip", + STALLED_VENT_TOOLTIP = "GT5U.machines.stalled_vent.tooltip", + FLUID_TRANSFER_TOOLTIP = "GT5U.machines.fluid_transfer.tooltip", + ITEM_TRANSFER_TOOLTIP = "GT5U.machines.item_transfer.tooltip", + POWER_SOURCE_KEY = "GT5U.machines.powersource."; + + public GT_GUIContainer_BasicMachine( + InventoryPlayer aInventoryPlayer, + IGregTechTileEntity aTileEntity, + String aName, + String aTextureFile, + String aNEI) { this(aInventoryPlayer, aTileEntity, aName, aTextureFile, aNEI, (byte) 0, (byte) 1); } - public GT_GUIContainer_BasicMachine(InventoryPlayer aInventoryPlayer, IGregTechTileEntity aTileEntity, String aName, - String aTextureFile, String aNEI, byte aProgressBarDirection, byte aProgressBarAmount) { - super(new GT_Container_BasicMachine(aInventoryPlayer, aTileEntity), - RES_PATH_GUI + "basicmachines/" + aTextureFile); + public GT_GUIContainer_BasicMachine( + InventoryPlayer aInventoryPlayer, + IGregTechTileEntity aTileEntity, + String aName, + String aTextureFile, + String aNEI, + byte aProgressBarDirection, + byte aProgressBarAmount) { + super( + new GT_Container_BasicMachine(aInventoryPlayer, aTileEntity), + RES_PATH_GUI + "basicmachines/" + aTextureFile); mProgressBarDirection = aProgressBarDirection; mProgressBarAmount = (byte) Math.max(1, aProgressBarAmount); mName = aName; @@ -92,11 +90,14 @@ public class GT_GUIContainer_BasicMachine extends GT_GUIContainerMetaTile_Machin if (machine.isSteampowered()) { batterySlotTooltipKey = UNUSED_SLOT_TOOLTIP; batterySlotTooltipArgs = new String[0]; - addToolTip(new GT_GuiSmartTooltip(tProblemArea, new TooltipVisibilityProvider() { - public boolean shouldShowTooltip() { - return hasErrorCode(NEEDS_STEAM_VENTING); - } - }, mTooltipCache.getData(STALLED_VENT_TOOLTIP))); + addToolTip(new GT_GuiSmartTooltip( + tProblemArea, + new TooltipVisibilityProvider() { + public boolean shouldShowTooltip() { + return hasErrorCode(NEEDS_STEAM_VENTING); + } + }, + mTooltipCache.getData(STALLED_VENT_TOOLTIP))); } else { String pTier1 = powerTierName(machine.mTier); if (machine.mTier == GT_Values.VN.length - 1) { @@ -106,29 +107,36 @@ public class GT_GUIContainer_BasicMachine extends GT_GUIContainerMetaTile_Machin batterySlotTooltipKey = BATTERY_SLOT_TOOLTIP; batterySlotTooltipArgs = new String[] {pTier1, powerTierName((byte) (machine.mTier + 1))}; } - addToolTip(new GT_GuiSlotTooltip( container.slotFluidTransferToggle, - mTooltipCache.getData(FLUID_TRANSFER_TOOLTIP))); - addToolTip(new GT_GuiSlotTooltip( container.slotItemTransferToggle, - mTooltipCache.getData(ITEM_TRANSFER_TOOLTIP))); - } + addToolTip(new GT_GuiSlotTooltip( + container.slotFluidTransferToggle, mTooltipCache.getData(FLUID_TRANSFER_TOOLTIP))); + addToolTip(new GT_GuiSlotTooltip( + container.slotItemTransferToggle, mTooltipCache.getData(ITEM_TRANSFER_TOOLTIP))); + } if (recipes != null && recipes.hasFluidInputs()) { - addToolTip(new GT_GuiSlotTooltip(container.slotFluidInput, - mTooltipCache.getData(FLUID_INPUT_TOOLTIP, machine.getCapacity()))); + addToolTip(new GT_GuiSlotTooltip( + container.slotFluidInput, mTooltipCache.getData(FLUID_INPUT_TOOLTIP, machine.getCapacity()))); } if (recipes != null && recipes.hasFluidOutputs()) { - addToolTip(new GT_GuiSlotTooltip(container.slotFluidOutput, - mTooltipCache.getData(FLUID_OUTPUT_TOOLTIP, machine.getCapacity()))); + addToolTip(new GT_GuiSlotTooltip( + container.slotFluidOutput, mTooltipCache.getData(FLUID_OUTPUT_TOOLTIP, machine.getCapacity()))); } - addToolTip( new GT_GuiSlotTooltip(getContainer().slotBattery, - mTooltipCache.getData(batterySlotTooltipKey, batterySlotTooltipArgs))); - addToolTip(new GT_GuiSlotTooltip(container.slotSpecial, mTooltipCache.getData( - recipes != null && recipes.usesSpecialSlot() ? SPECIAL_SLOT_TOOLTIP : UNUSED_SLOT_TOOLTIP))); - addToolTip(new GT_GuiSmartTooltip(tProblemArea, new TooltipVisibilityProvider() { + addToolTip(new GT_GuiSlotTooltip( + getContainer().slotBattery, mTooltipCache.getData(batterySlotTooltipKey, batterySlotTooltipArgs))); + addToolTip(new GT_GuiSlotTooltip( + container.slotSpecial, + mTooltipCache.getData( + recipes != null && recipes.usesSpecialSlot() ? SPECIAL_SLOT_TOOLTIP : UNUSED_SLOT_TOOLTIP))); + addToolTip(new GT_GuiSmartTooltip( + tProblemArea, + new TooltipVisibilityProvider() { public boolean shouldShowTooltip() { return container.mStuttering && !hasErrorCode(NEEDS_STEAM_VENTING); } - }, mTooltipCache.getData(STALLED_STUTTERING_TOOLTIP, StatCollector.translateToLocal( - POWER_SOURCE_KEY + (machine.isSteampowered() ? "steam" : "power"))))); + }, + mTooltipCache.getData( + STALLED_STUTTERING_TOOLTIP, + StatCollector.translateToLocal( + POWER_SOURCE_KEY + (machine.isSteampowered() ? "steam" : "power"))))); } /** @@ -158,19 +166,23 @@ public class GT_GUIContainer_BasicMachine extends GT_GUIContainerMetaTile_Machin drawTexturedModalRect(x, y, 0, 0, xSize, ySize); if (mContainer != null) { if (!getMachine().isSteampowered()) { - if (getContainer().mFluidTransfer) - drawTexturedModalRect(x + 7, y + 62, 176, 18, 18, 18); - if (getContainer().mItemTransfer) - drawTexturedModalRect(x + 25, y + 62, 176, 36, 18, 18); + if (getContainer().mFluidTransfer) drawTexturedModalRect(x + 7, y + 62, 176, 18, 18, 18); + if (getContainer().mItemTransfer) drawTexturedModalRect(x + 25, y + 62, 176, 36, 18, 18); } - if (getContainer().mStuttering) - drawTexturedModalRect(x + 79, y + 44, 176, 54, 18, 18); + if (getContainer().mStuttering) drawTexturedModalRect(x + 79, y + 44, 176, 54, 18, 18); if (mContainer.mMaxProgressTime > 0) { int tSize = mProgressBarDirection < 2 ? 20 : 18; - int tProgress = Math.max(1, Math.min(tSize * mProgressBarAmount, (mContainer.mProgressTime > 0 ? 1 : 0) - + mContainer.mProgressTime * tSize * mProgressBarAmount / mContainer.mMaxProgressTime)) - % (tSize + 1); + int tProgress = Math.max( + 1, + Math.min( + tSize * mProgressBarAmount, + (mContainer.mProgressTime > 0 ? 1 : 0) + + mContainer.mProgressTime + * tSize + * mProgressBarAmount + / mContainer.mMaxProgressTime)) + % (tSize + 1); switch (mProgressBarDirection) { // yes, my OCD was mad at me before I did the Tabs. case 0: @@ -210,7 +222,8 @@ public class GT_GUIContainer_BasicMachine extends GT_GUIContainerMetaTile_Machin protected GT_GuiTabIconSet getTabBackground() { if (getMachine().isSteampowered()) { return getMachine() instanceof GT_MetaTileEntity_BasicMachine_Steel - ? TAB_ICONSET_STEEL : TAB_ICONSET_BRONZE; + ? TAB_ICONSET_STEEL + : TAB_ICONSET_BRONZE; } return super.getTabBackground(); } @@ -243,7 +256,7 @@ public class GT_GUIContainer_BasicMachine extends GT_GUIContainerMetaTile_Machin @Override public Object[] getNeiTransferRectArgs() { - return new Object[]{getMachine().getPower()}; + return new Object[] {getMachine().getPower()}; } @Override 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 a24060aaa4..034525c338 100644 --- a/src/main/java/gregtech/api/gui/GT_GUIContainer_BasicTank.java +++ b/src/main/java/gregtech/api/gui/GT_GUIContainer_BasicTank.java @@ -1,19 +1,18 @@ package gregtech.api.gui; +import static gregtech.api.enums.GT_Values.RES_PATH_GUI; + import gregtech.api.interfaces.tileentity.IGregTechTileEntity; import gregtech.api.util.GT_Utility; import net.minecraft.entity.player.InventoryPlayer; import net.minecraft.util.StatCollector; -import static gregtech.api.enums.GT_Values.RES_PATH_GUI; - public class GT_GUIContainer_BasicTank extends GT_GUIContainerMetaTile_Machine { private final String mName; - private final int - textColor = this.getTextColorOrDefault("text", 0xFAFAFF), - textColorTitle = this.getTextColorOrDefault("title", 0x404040), - textColorValue = this.getTextColorOrDefault("value", 0xFAFAFF); + private final int textColor = this.getTextColorOrDefault("text", 0xFAFAFF), + textColorTitle = this.getTextColorOrDefault("title", 0x404040), + textColorValue = this.getTextColorOrDefault("value", 0xFAFAFF); public GT_GUIContainer_BasicTank(InventoryPlayer aInventoryPlayer, IGregTechTileEntity aTileEntity, String aName) { super(new GT_Container_BasicTank(aInventoryPlayer, aTileEntity), RES_PATH_GUI + "BasicTank.png"); @@ -22,11 +21,16 @@ 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); - fontRendererObj.drawString(GT_Utility.parseNumberToString(((GT_Container_BasicTank) mContainer).mContent), 10, 30, textColorValue); + fontRendererObj.drawString( + GT_Utility.parseNumberToString(((GT_Container_BasicTank) mContainer).mContent), + 10, + 30, + textColorValue); } } diff --git a/src/main/java/gregtech/api/gui/GT_GUIContainer_MaintenanceHatch.java b/src/main/java/gregtech/api/gui/GT_GUIContainer_MaintenanceHatch.java index fe3c47fa95..07ca031345 100644 --- a/src/main/java/gregtech/api/gui/GT_GUIContainer_MaintenanceHatch.java +++ b/src/main/java/gregtech/api/gui/GT_GUIContainer_MaintenanceHatch.java @@ -1,15 +1,13 @@ package gregtech.api.gui; +import static gregtech.api.enums.GT_Values.RES_PATH_GUI; + import gregtech.api.interfaces.tileentity.IGregTechTileEntity; import net.minecraft.entity.player.InventoryPlayer; -import static gregtech.api.enums.GT_Values.RES_PATH_GUI; - public class GT_GUIContainer_MaintenanceHatch extends GT_GUIContainerMetaTile_Machine { - private final int - textColor = this.getTextColorOrDefault("text", 0x404040), - textColorTitle = this.getTextColorOrDefault("title", 0x404040); - + private final int textColor = this.getTextColorOrDefault("text", 0x404040), + textColorTitle = this.getTextColorOrDefault("title", 0x404040); public GT_GUIContainer_MaintenanceHatch(InventoryPlayer aInventoryPlayer, IGregTechTileEntity aTileEntity) { super(new GT_Container_MaintenanceHatch(aInventoryPlayer, aTileEntity), RES_PATH_GUI + "Maintenance.png"); 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 69a3d26b2e..98268cd667 100644 --- a/src/main/java/gregtech/api/gui/GT_GUIContainer_MultiMachine.java +++ b/src/main/java/gregtech/api/gui/GT_GUIContainer_MultiMachine.java @@ -1,5 +1,7 @@ package gregtech.api.gui; +import static gregtech.api.enums.GT_Values.RES_PATH_GUI; + import gregtech.api.interfaces.tileentity.IGregTechTileEntity; import gregtech.api.util.GT_ModHandler; import gregtech.api.util.GT_Utility; @@ -9,9 +11,6 @@ import gregtech.common.tileentities.machines.multi.GT_MetaTileEntity_LargeTurbin import net.minecraft.entity.player.InventoryPlayer; import net.minecraft.item.ItemStack; -import static gregtech.api.enums.GT_Values.RES_PATH_GUI; - - /** * NEVER INCLUDE THIS FILE IN YOUR MOD!!! * <p/> @@ -22,12 +21,14 @@ import static gregtech.api.enums.GT_Values.RES_PATH_GUI; public class GT_GUIContainer_MultiMachine extends GT_GUIContainerMetaTile_Machine { String mName = ""; - private final int - textColor = this.getTextColorOrDefault("text", 0xFAFAFF), - textColorTitle = this.getTextColorOrDefault("title", 0xFAFAFF); - - public GT_GUIContainer_MultiMachine(InventoryPlayer aInventoryPlayer, IGregTechTileEntity aTileEntity, String aName, String aTextureFile) { - super(new GT_Container_MultiMachine(aInventoryPlayer, aTileEntity), RES_PATH_GUI + "multimachines/" + (aTextureFile == null ? "MultiblockDisplay" : aTextureFile)); + private final int textColor = this.getTextColorOrDefault("text", 0xFAFAFF), + textColorTitle = this.getTextColorOrDefault("title", 0xFAFAFF); + + public GT_GUIContainer_MultiMachine( + InventoryPlayer aInventoryPlayer, IGregTechTileEntity aTileEntity, String aName, String aTextureFile) { + super( + new GT_Container_MultiMachine(aInventoryPlayer, aTileEntity), + RES_PATH_GUI + "multimachines/" + (aTextureFile == null ? "MultiblockDisplay" : aTextureFile)); mName = aName; } @@ -74,8 +75,9 @@ public class GT_GUIContainer_MultiMachine extends GT_GUIContainerMetaTile_Machin line_counter += 8; } - - if (mContainer != null) {//(mWrench ? 0 : 1) | (mScrewdriver ? 0 : 2) | (mSoftHammer ? 0 : 4) | (mHardHammer ? 0 : 8) | (mSolderingTool ? 0 : 16) | (mCrowbar ? 0 : 32) | (mMachine ? 0 : 64)); + if (mContainer + != null) { // (mWrench ? 0 : 1) | (mScrewdriver ? 0 : 2) | (mSoftHammer ? 0 : 4) | (mHardHammer ? 0 : 8) + // | (mSolderingTool ? 0 : 16) | (mCrowbar ? 0 : 32) | (mMachine ? 0 : 64)); if ((mContainer.mDisplayErrorCode & 1) != 0) { fontRendererObj.drawString(GT_Utility.trans("132", "Pipe is loose."), 10, line_counter, textColor); line_counter += 8; @@ -92,46 +94,60 @@ 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"), 10, line_counter, textColor); + fontRendererObj.drawString( + GT_Utility.trans("140", "to (re-)start the Machine"), 10, 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); line_counter += 8; } 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); - if (tItem == null || !GT_Utility.areStacksEqual(tItem, GT_ModHandler.getIC2Item("miningPipe", 1L))) { - fontRendererObj.drawString(GT_Utility.trans("143", "Missing Mining Pipe"), 10, line_counter, textColor); + if (tItem == null + || !GT_Utility.areStacksEqual(tItem, GT_ModHandler.getIC2Item("miningPipe", 1L))) { + fontRendererObj.drawString( + GT_Utility.trans("143", "Missing Mining Pipe"), 10, line_counter, textColor); } } else if (mContainer.mTileEntity.getMetaTileEntity() instanceof GT_MetaTileEntity_LargeTurbine) { ItemStack tItem = mContainer.mTileEntity.getMetaTileEntity().getStackInSlot(1); - if (tItem == null || !(tItem.getItem() == GT_MetaGenerated_Tool_01.INSTANCE && tItem.getItemDamage() >= 170 && tItem.getItemDamage() <= 177)) { - fontRendererObj.drawString(GT_Utility.trans("144", "Missing Turbine Rotor"), 10, line_counter, textColor); + if (tItem == null + || !(tItem.getItem() == GT_MetaGenerated_Tool_01.INSTANCE + && tItem.getItemDamage() >= 170 + && tItem.getItemDamage() <= 177)) { + fontRendererObj.drawString( + GT_Utility.trans("144", "Missing Turbine Rotor"), 10, line_counter, textColor); } } } diff --git a/src/main/java/gregtech/api/gui/GT_GUICover.java b/src/main/java/gregtech/api/gui/GT_GUICover.java index 4f61c95dd3..635a27d6ef 100644 --- a/src/main/java/gregtech/api/gui/GT_GUICover.java +++ b/src/main/java/gregtech/api/gui/GT_GUICover.java @@ -31,19 +31,18 @@ public abstract class GT_GUICover extends GT_GUIScreen { public void setParentGuiId(int parentGuiId) { this.parentGuiId = parentGuiId; } - @Override public void closeScreen() { // If this cover was given a guiId, tell the server to open it for us when this GUI closes. if (parentGuiId != -1 && tile.isUseableByPlayer(mc.thePlayer)) { GT_Values.NW.sendToServer(new GT_Packet_GtTileEntityGuiRequest( - tile.getXCoord(), - tile.getYCoord(), - tile.getZCoord(), - parentGuiId, - tile.getWorld().provider.dimensionId, - mc.thePlayer.getEntityId())); + tile.getXCoord(), + tile.getYCoord(), + tile.getZCoord(), + parentGuiId, + tile.getWorld().provider.dimensionId, + mc.thePlayer.getEntityId())); } else { this.mc.displayGuiScreen(null); this.mc.setIngameFocus(); diff --git a/src/main/java/gregtech/api/gui/GT_GUIDialogSelectItem.java b/src/main/java/gregtech/api/gui/GT_GUIDialogSelectItem.java index 0aec243967..c077b02bf7 100644 --- a/src/main/java/gregtech/api/gui/GT_GUIDialogSelectItem.java +++ b/src/main/java/gregtech/api/gui/GT_GUIDialogSelectItem.java @@ -4,215 +4,227 @@ import gregtech.api.gui.widgets.GT_GuiFakeItemButton; import gregtech.api.gui.widgets.GT_GuiIcon; import gregtech.api.gui.widgets.GT_GuiIconButton; import gregtech.api.util.GT_Utility; +import java.util.ArrayList; +import java.util.List; +import java.util.function.Consumer; import net.minecraft.client.gui.GuiButton; import net.minecraft.client.gui.GuiScreen; import net.minecraft.item.ItemStack; import net.minecraft.util.StatCollector; -import java.util.ArrayList; -import java.util.List; -import java.util.function.Consumer; - public class GT_GUIDialogSelectItem extends GT_GUIScreen { - public static final int UNSELECTED = -1; - private static final int cols = 9; - private static final int rows = 3; - private final int textColor = this.getTextColorOrDefault("text",0xff555555); - private final GuiScreen parent; - private final Consumer<ItemStack> selectedCallback; - // passed in stack - private final List<ItemStack> stacks; - // 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 boolean noDeselect; - private int selected; - private int scroll = 0; - private GT_GuiIconButton btnUp; - private GT_GuiIconButton btnDown; - - - public GT_GUIDialogSelectItem(String header, ItemStack headerItem, GuiScreen parent, Consumer<ItemStack> selectedCallback, List<ItemStack> stacks) { - this(header, headerItem, parent, selectedCallback, stacks, UNSELECTED); - } - - public GT_GUIDialogSelectItem(String header, ItemStack headerItem, GuiScreen parent, Consumer<ItemStack> selectedCallback, List<ItemStack> stacks, int selected) { - this(header, headerItem, parent, selectedCallback, stacks, selected, false); - } - - /** - * Open a dialog to select an item from given list. Given callback may be called zero or more times depending on user action. - * @param header Header text - * @param headerItem ItemStack to use as Dialog icon - * @param parent open which GUIScreen when this dialog is closed. use null if it has no parent. - * @param selectedCallback callback upon selected - * @param stacks list to choose from - * @param selected preselected item. Use {@link #UNSELECTED} for unselected. Invalid selected will be clamped to 0 or highest index - * @param noDeselect true if player cannot deselect, false otherwise. If this is set to true, selectedCallback is guaranteed to be called with a nonnull stack - */ - public GT_GUIDialogSelectItem(String header, ItemStack headerItem, GuiScreen parent, Consumer<ItemStack> selectedCallback, List<ItemStack> stacks, int selected, boolean noDeselect) { - super(176, 107, header); - this.noDeselect = noDeselect; - if (headerItem != null) - this.headerIcon.setItem(headerItem); - this.parent = parent; - this.selectedCallback = selectedCallback; - this.stacks = stacks; - - if (stacks.size() > rows * cols) { - btnUp = new GT_GuiIconButton(this, 0, 134, 25, GT_GuiIcon.GREEN_ARROW_UP); - btnDown = new GT_GuiIconButton(this, 1, 152, 25, GT_GuiIcon.GREEN_ARROW_DOWN); - } - - 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)); - } - } - - setSelected(noDeselect ? Math.max(0, selected) : selected); - ensureSelectedDisplayed(); - } - - @Override - protected void onInitGui(int guiLeft, int guiTop, int gui_width, int gui_height) { - btnCurrent.setX(8 + 2 + fontRendererObj.getStringWidth(StatCollector.translateToLocal("GT5U.gui.select.current"))); - } - - @Override - public void closeScreen() { - selectedCallback.accept(getCandidate(getSelected())); - mc.displayGuiScreen(parent); - if (parent == null) - mc.setIngameFocus(); - } - - @Override - public void buttonClicked(GuiButton button) { - switch (button.id) { - case 0: - setScroll(scroll - 1); - return; - case 1: - setScroll(scroll + 1); - return; - } - super.buttonClicked(button); - } - - @Override - public void drawExtras(int mouseX, int mouseY, float parTicks) { - int y = 25 + (18 - getFontRenderer().FONT_HEIGHT) / 2; - getFontRenderer().drawString(StatCollector.translateToLocal("GT5U.gui.select.current"), 8, y, textColor); - super.drawExtras(mouseX, mouseY, parTicks); - } - - @Override - 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)) { - ensureSelectedDisplayed(); - return; - } - - for (int i = 0, slotsSize = slots.size(); i < slotsSize; i++) { - GT_GuiFakeItemButton slot = slots.get(i); - if (slot.getBounds().contains(mx, my)) { - setSelected(slotIndexToListIndex(i)); - return; - } - } - } else if (button == 1 && getSelected() >= 0) { - if (btnCurrent.getBounds().contains(mx, my)) { - setSelected(UNSELECTED); - return; - } - GT_GuiFakeItemButton slot = getSlot(listIndexToSlotIndex(getSelected())); - if (slot != null && slot.getBounds().contains(mx, my)) { - setSelected(UNSELECTED); - } - } - super.mouseClicked(x, y, button); - } - - @Override - public void onMouseWheel(int x, int y, int delta) { - if (delta < 0) - setScroll(scroll + 1); - else if (delta > 0) - setScroll(scroll - 1); - } - - 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); - } - } - - private void ensureSelectedDisplayed() { - if (getSelected() < scroll * cols) { - setScroll(getSelected() / cols); - } else if (getSelected() > (scroll + rows) * cols) { - setScroll((getSelected() - (rows - 1) * cols) / cols); - } else { - // called nonetheless to update button enabled states - setScroll(scroll); - } - } - - private int slotIndexToListIndex(int index) { - int mapped = scroll * cols + index; - return mapped >= stacks.size() ? UNSELECTED : mapped; - } - - private int listIndexToSlotIndex(int index) { - return index - scroll * cols; - } - - public int getSelected() { - return selected; - } - - public void setSelected(int selected) { - if (selected == this.selected) return; - int newSelected = GT_Utility.clamp(selected, UNSELECTED, stacks.size() - 1); - - if (noDeselect && newSelected == UNSELECTED) - return; - - GT_GuiFakeItemButton selectedSlot = getSlot(this.selected); - if (selectedSlot != null) - selectedSlot.setBgIcon(GT_GuiIcon.SLOT_GRAY); - - this.selected = newSelected; - - btnCurrent.setItem(getCandidate(this.selected)); - - selectedSlot = getSlot(this.selected); - if (selectedSlot != null) - selectedSlot.setBgIcon(GT_GuiIcon.SLOT_DARKGRAY); - } - - private void setScroll(int scroll) { - if (stacks.size() > rows * cols) { - int lo = 0; - int hi = (stacks.size() - rows * cols) / cols + 1; - this.scroll = GT_Utility.clamp(scroll, lo, hi); - btnUp.enabled = this.scroll != lo; - btnDown.enabled = this.scroll != hi; - } - fillSlots(); - } - - private ItemStack getCandidate(int listIndex) { - return listIndex < 0 || listIndex >= stacks.size() ? null : stacks.get(listIndex); - } - - private GT_GuiFakeItemButton getSlot(int slotIndex) { - return slotIndex < 0 || slotIndex >= slots.size() ? null : slots.get(slotIndex); - } + public static final int UNSELECTED = -1; + private static final int cols = 9; + private static final int rows = 3; + private final int textColor = this.getTextColorOrDefault("text", 0xff555555); + private final GuiScreen parent; + private final Consumer<ItemStack> selectedCallback; + // passed in stack + private final List<ItemStack> stacks; + // 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 boolean noDeselect; + private int selected; + private int scroll = 0; + private GT_GuiIconButton btnUp; + private GT_GuiIconButton btnDown; + + public GT_GUIDialogSelectItem( + String header, + ItemStack headerItem, + GuiScreen parent, + Consumer<ItemStack> selectedCallback, + List<ItemStack> stacks) { + this(header, headerItem, parent, selectedCallback, stacks, UNSELECTED); + } + + public GT_GUIDialogSelectItem( + String header, + ItemStack headerItem, + GuiScreen parent, + Consumer<ItemStack> selectedCallback, + List<ItemStack> stacks, + int selected) { + this(header, headerItem, parent, selectedCallback, stacks, selected, false); + } + + /** + * Open a dialog to select an item from given list. Given callback may be called zero or more times depending on user action. + * @param header Header text + * @param headerItem ItemStack to use as Dialog icon + * @param parent open which GUIScreen when this dialog is closed. use null if it has no parent. + * @param selectedCallback callback upon selected + * @param stacks list to choose from + * @param selected preselected item. Use {@link #UNSELECTED} for unselected. Invalid selected will be clamped to 0 or highest index + * @param noDeselect true if player cannot deselect, false otherwise. If this is set to true, selectedCallback is guaranteed to be called with a nonnull stack + */ + public GT_GUIDialogSelectItem( + String header, + ItemStack headerItem, + GuiScreen parent, + Consumer<ItemStack> selectedCallback, + List<ItemStack> stacks, + int selected, + boolean noDeselect) { + super(176, 107, header); + this.noDeselect = noDeselect; + if (headerItem != null) this.headerIcon.setItem(headerItem); + this.parent = parent; + this.selectedCallback = selectedCallback; + this.stacks = stacks; + + if (stacks.size() > rows * cols) { + btnUp = new GT_GuiIconButton(this, 0, 134, 25, GT_GuiIcon.GREEN_ARROW_UP); + btnDown = new GT_GuiIconButton(this, 1, 152, 25, GT_GuiIcon.GREEN_ARROW_DOWN); + } + + 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)); + } + } + + setSelected(noDeselect ? Math.max(0, selected) : selected); + ensureSelectedDisplayed(); + } + + @Override + protected void onInitGui(int guiLeft, int guiTop, int gui_width, int gui_height) { + btnCurrent.setX( + 8 + 2 + fontRendererObj.getStringWidth(StatCollector.translateToLocal("GT5U.gui.select.current"))); + } + + @Override + public void closeScreen() { + selectedCallback.accept(getCandidate(getSelected())); + mc.displayGuiScreen(parent); + if (parent == null) mc.setIngameFocus(); + } + + @Override + public void buttonClicked(GuiButton button) { + switch (button.id) { + case 0: + setScroll(scroll - 1); + return; + case 1: + setScroll(scroll + 1); + return; + } + super.buttonClicked(button); + } + + @Override + public void drawExtras(int mouseX, int mouseY, float parTicks) { + int y = 25 + (18 - getFontRenderer().FONT_HEIGHT) / 2; + getFontRenderer().drawString(StatCollector.translateToLocal("GT5U.gui.select.current"), 8, y, textColor); + super.drawExtras(mouseX, mouseY, parTicks); + } + + @Override + 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)) { + ensureSelectedDisplayed(); + return; + } + + for (int i = 0, slotsSize = slots.size(); i < slotsSize; i++) { + GT_GuiFakeItemButton slot = slots.get(i); + if (slot.getBounds().contains(mx, my)) { + setSelected(slotIndexToListIndex(i)); + return; + } + } + } else if (button == 1 && getSelected() >= 0) { + if (btnCurrent.getBounds().contains(mx, my)) { + setSelected(UNSELECTED); + return; + } + GT_GuiFakeItemButton slot = getSlot(listIndexToSlotIndex(getSelected())); + if (slot != null && slot.getBounds().contains(mx, my)) { + setSelected(UNSELECTED); + } + } + super.mouseClicked(x, y, button); + } + + @Override + public void onMouseWheel(int x, int y, int delta) { + if (delta < 0) setScroll(scroll + 1); + else if (delta > 0) setScroll(scroll - 1); + } + + 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); + } + } + + private void ensureSelectedDisplayed() { + if (getSelected() < scroll * cols) { + setScroll(getSelected() / cols); + } else if (getSelected() > (scroll + rows) * cols) { + setScroll((getSelected() - (rows - 1) * cols) / cols); + } else { + // called nonetheless to update button enabled states + setScroll(scroll); + } + } + + private int slotIndexToListIndex(int index) { + int mapped = scroll * cols + index; + return mapped >= stacks.size() ? UNSELECTED : mapped; + } + + private int listIndexToSlotIndex(int index) { + return index - scroll * cols; + } + + public int getSelected() { + return selected; + } + + public void setSelected(int selected) { + if (selected == this.selected) return; + int newSelected = GT_Utility.clamp(selected, UNSELECTED, stacks.size() - 1); + + if (noDeselect && newSelected == UNSELECTED) return; + + GT_GuiFakeItemButton selectedSlot = getSlot(this.selected); + if (selectedSlot != null) selectedSlot.setBgIcon(GT_GuiIcon.SLOT_GRAY); + + this.selected = newSelected; + + btnCurrent.setItem(getCandidate(this.selected)); + + selectedSlot = getSlot(this.selected); + if (selectedSlot != null) selectedSlot.setBgIcon(GT_GuiIcon.SLOT_DARKGRAY); + } + + private void setScroll(int scroll) { + if (stacks.size() > rows * cols) { + int lo = 0; + int hi = (stacks.size() - rows * cols) / cols + 1; + this.scroll = GT_Utility.clamp(scroll, lo, hi); + btnUp.enabled = this.scroll != lo; + btnDown.enabled = this.scroll != hi; + } + fillSlots(); + } + + private ItemStack getCandidate(int listIndex) { + return listIndex < 0 || listIndex >= stacks.size() ? null : stacks.get(listIndex); + } + + private GT_GuiFakeItemButton getSlot(int slotIndex) { + return slotIndex < 0 || slotIndex >= slots.size() ? null : slots.get(slotIndex); + } } diff --git a/src/main/java/gregtech/api/gui/GT_GUIScreen.java b/src/main/java/gregtech/api/gui/GT_GUIScreen.java index 1efaddea35..281be1e55d 100644 --- a/src/main/java/gregtech/api/gui/GT_GUIScreen.java +++ b/src/main/java/gregtech/api/gui/GT_GUIScreen.java @@ -1,13 +1,14 @@ package gregtech.api.gui; import gregtech.api.enums.Dyes; -import gregtech.api.gui.GT_GUIColorOverride; import gregtech.api.gui.widgets.GT_GuiFakeItemButton; import gregtech.api.gui.widgets.GT_GuiIntegerTextBox; import gregtech.api.gui.widgets.GT_GuiTooltip; import gregtech.api.gui.widgets.GT_GuiTooltipManager; import gregtech.api.gui.widgets.GT_GuiTooltipManager.GT_IToolTipRenderer; import gregtech.api.interfaces.IGuiScreen; +import java.util.ArrayList; +import java.util.List; import net.minecraft.client.gui.FontRenderer; import net.minecraft.client.gui.GuiButton; import net.minecraft.client.gui.GuiScreen; @@ -19,316 +20,305 @@ import org.lwjgl.input.Mouse; import org.lwjgl.opengl.GL11; import org.lwjgl.opengl.GL12; -import java.io.IOException; -import java.util.ArrayList; -import java.util.List; - public abstract class GT_GUIScreen extends GuiScreen implements GT_IToolTipRenderer, IGuiScreen { - protected GT_GuiTooltipManager ttManager = new GT_GuiTooltipManager(); + protected GT_GuiTooltipManager ttManager = new GT_GuiTooltipManager(); - protected int gui_width = 176; - protected int gui_height = 107; - protected int guiTop, guiLeft; - protected boolean drawButtons = true; + protected int gui_width = 176; + protected int gui_height = 107; + protected int guiTop, guiLeft; + protected boolean drawButtons = true; private ResourceLocation mGUIbackgroundLocation; - private GuiButton selectedButton; + private GuiButton selectedButton; private GT_GUIColorOverride colorOverride; private final int textColor; - private final static String guiTexturePath = "gregtech:textures/gui/GuiCover.png"; + private static final String guiTexturePath = "gregtech:textures/gui/GuiCover.png"; - public String header; - public GT_GuiFakeItemButton headerIcon; + public String header; + public GT_GuiFakeItemButton headerIcon; - protected List<IGuiElement> elements = new ArrayList<>(); - protected List<GT_GuiIntegerTextBox> textBoxes = new ArrayList<>(); + protected List<IGuiElement> elements = new ArrayList<>(); + protected List<GT_GuiIntegerTextBox> textBoxes = new ArrayList<>(); - public GT_GUIScreen(int width, int height, String header) { + public GT_GUIScreen(int width, int height, String header) { this.gui_width = width; - this.gui_height = height; - this.header = header; - this.headerIcon = new GT_GuiFakeItemButton(this, 5, 5, null); + this.gui_height = height; + this.header = header; + this.headerIcon = new GT_GuiFakeItemButton(this, 5, 5, null); this.mGUIbackgroundLocation = new ResourceLocation(guiTexturePath); this.colorOverride = new GT_GUIColorOverride(guiTexturePath); this.textColor = getTextColorOrDefault("title", 0xFF222222); - } + } - @Override - public void initGui() { - guiLeft = (this.width - this.gui_width) / 2; - guiTop = (this.height - this.gui_height) / 2; + @Override + public void initGui() { + guiLeft = (this.width - this.gui_width) / 2; + guiTop = (this.height - this.gui_height) / 2; - for (IGuiElement element : elements) { - if (element instanceof GuiButton) - buttonList.add(element); - if (element instanceof GT_GuiIntegerTextBox) - textBoxes.add((GT_GuiIntegerTextBox) element); - } + for (IGuiElement element : elements) { + if (element instanceof GuiButton) buttonList.add(element); + if (element instanceof GT_GuiIntegerTextBox) textBoxes.add((GT_GuiIntegerTextBox) element); + } - onInitGui(guiLeft, guiTop, gui_width, gui_height); + onInitGui(guiLeft, guiTop, gui_width, gui_height); - for (IGuiElement element : elements) { - element.onInit(); - } - super.initGui(); - } + for (IGuiElement element : elements) { + element.onInit(); + } + super.initGui(); + } - protected abstract void onInitGui(int guiLeft, int guiTop, int gui_width, int gui_height); + protected abstract void onInitGui(int guiLeft, int guiTop, int gui_width, int gui_height); protected int getTextColorOrDefault(String textType, int defaultColor) { return colorOverride.getTextColorOrDefault(textType, defaultColor); } - public void onMouseWheel(int x, int y, int delta) { - } - - @Override - public void handleMouseInput() { - int delta = Mouse.getEventDWheel(); - if (delta != 0) { - int i = Mouse.getEventX() * this.width / this.mc.displayWidth; - int j = this.height - Mouse.getEventY() * this.height / this.mc.displayHeight - 1; - onMouseWheel(i, j, delta); - } - super.handleMouseInput(); - } - - @Override - public void drawScreen(int mouseX, int mouseY, float parTicks) { - drawDefaultBackground(); - - drawBackground(mouseX, mouseY, parTicks); - - RenderHelper.disableStandardItemLighting(); - GL11.glDisable(GL11.GL_LIGHTING); - GL11.glDisable(GL11.GL_DEPTH_TEST); - GL11.glDisable(GL12.GL_RESCALE_NORMAL); - if (drawButtons) { - RenderHelper.enableGUIStandardItemLighting(); - for (IGuiElement e : elements) - e.draw(mouseX, mouseY, parTicks); - } - GL11.glEnable(GL12.GL_RESCALE_NORMAL); - - GL11.glPushMatrix(); - GL11.glTranslatef(guiLeft, guiTop, 0.0F); - GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); - - GL11.glDisable(GL11.GL_LIGHTING); - drawForegroundLayer(mouseX, mouseY, parTicks); - GL11.glEnable(GL11.GL_LIGHTING); - - GL11.glPopMatrix(); - - GL11.glEnable(GL11.GL_LIGHTING); - GL11.glEnable(GL11.GL_DEPTH_TEST); - RenderHelper.enableStandardItemLighting(); - } - - public void drawForegroundLayer(int mouseX, int mouseY, float parTicks) { - drawExtras(mouseX, mouseY, parTicks); - ttManager.onTick(this, mouseX, mouseY); - } - - public void drawBackground(int mouseX, int mouseY, float parTicks) { - short[] color = Dyes.MACHINE_METAL.getRGBA(); - GL11.glColor3ub((byte) color[0], (byte) color[1], (byte) color[2]); - this.mc.renderEngine.bindTexture(mGUIbackgroundLocation); - drawTexturedModalRect(guiLeft, guiTop, 0,0, gui_width, gui_height); - } - - public void drawExtras(int mouseX, int mouseY, float parTicks) { - this.fontRendererObj.drawString(header, 25, 9, textColor); - } - - @Override - public boolean doesGuiPauseGame() - { - return false; - } - - public void closeScreen() { - this.mc.displayGuiScreen(null); - this.mc.setIngameFocus(); - } - - @Override - public void updateScreen() { - super.updateScreen(); - for (GuiTextField f : textBoxes) { - f.updateCursorCounter(); - } - } - - @Override - public void mouseClicked(int x, int y, int button) { - for (GT_GuiIntegerTextBox tBox : textBoxes) { - boolean hadFocus = tBox.isFocused(); - if (tBox.isEnabled() || hadFocus) - tBox.mouseClicked(x,y,button); - - if (tBox.isFocused() && button == 1 && tBox.isEnabled()) //rightclick -> lcear it - tBox.setText("0"); - else if (hadFocus && !tBox.isFocused()) - applyTextBox(tBox); - } - super.mouseClicked(x, y, button); - } - - @Override - public void keyTyped(char c, int key) { - GT_GuiIntegerTextBox focusedTextBox = null; - for (GT_GuiIntegerTextBox textBox : textBoxes) { - if (textBox.isFocused()) - focusedTextBox = textBox; - } - - if (key == 1) { //esc - if(focusedTextBox != null) { - resetTextBox(focusedTextBox); - setFocusedTextBox(null); - return; - } else { - closeScreen(); - // don't fall through to parent - return; - } - } - - if (c == '\t') { //tab - for (int i = 0; i < textBoxes.size(); i++) { - GT_GuiIntegerTextBox box = textBoxes.get(i); - if (box.isFocused()) { - applyTextBox(box); - setFocusedTextBox(((i+1) < textBoxes.size()) ? textBoxes.get(i+1) : null); - return; - } - } - if (!textBoxes.isEmpty()) - setFocusedTextBox(textBoxes.get(0)); - return; - } - - if (focusedTextBox != null && focusedTextBox.textboxKeyTyped(c, key)){ - return; - } - - if (key == 28 && focusedTextBox != null) { // enter - applyTextBox(focusedTextBox); - setFocusedTextBox(null); - return; - } - - if (key == this.mc.gameSettings.keyBindInventory.getKeyCode()) { - if (focusedTextBox != null) { - applyTextBox(focusedTextBox); - setFocusedTextBox(null); - return; - } - closeScreen(); - return; - } - super.keyTyped(c, key); - } - - /** - * Button - */ - - @Override - public void actionPerformed(GuiButton button) { - selectedButton = button; - } - - @Override - public void clearSelectedButton() { - selectedButton = null; - } - @Override - public GuiButton getSelectedButton(){return selectedButton;} - - @Override - public void buttonClicked(GuiButton button) { - - } - - /** - * TextBoxes - */ - private void setFocusedTextBox(GT_GuiIntegerTextBox boxToFocus) { - for (GT_GuiIntegerTextBox textBox : textBoxes) { - textBox.setFocused(textBox.equals(boxToFocus) && textBox.isEnabled()); - } - } - - /** - * Given textbox's value might have changed. - */ - public void applyTextBox(GT_GuiIntegerTextBox box) { - - } - - /** - * Reset the given textbox to the last valid value, <b>NOT</b> 0. - */ - public void resetTextBox(GT_GuiIntegerTextBox box) { - - } - - /** - * GT_IToolTipRenderer - */ - @Override - public void drawHoveringText(List text, int mouseX, int mouseY, FontRenderer render) { - super.drawHoveringText(text, mouseX, mouseY, render); - } - @Override - public FontRenderer getFontRenderer() { - return super.fontRendererObj; - } - @Override - public void addToolTip(GT_GuiTooltip toolTip) { - ttManager.addToolTip(toolTip); - } - @Override - public boolean removeToolTip(GT_GuiTooltip toolTip) { - return ttManager.removeToolTip(toolTip); - } - - /** - * Junk - */ - @Override - public int getGuiTop() { - return guiTop; - } - @Override - public int getGuiLeft() { - return guiLeft; - } - @Override - public int getXSize() { - return gui_width; - } - @Override - public int getYSize() { - return gui_height; - } - - @Override - public RenderItem getItemRenderer() { - return itemRender; - } - - @Override - public void addElement(IGuiElement element) { - if (elements.contains(element)) - return; - elements.add(element); - } - @Override - public boolean removeElement(IGuiElement element) { - return elements.remove(element); - } + public void onMouseWheel(int x, int y, int delta) {} + + @Override + public void handleMouseInput() { + int delta = Mouse.getEventDWheel(); + if (delta != 0) { + int i = Mouse.getEventX() * this.width / this.mc.displayWidth; + int j = this.height - Mouse.getEventY() * this.height / this.mc.displayHeight - 1; + onMouseWheel(i, j, delta); + } + super.handleMouseInput(); + } + + @Override + public void drawScreen(int mouseX, int mouseY, float parTicks) { + drawDefaultBackground(); + + drawBackground(mouseX, mouseY, parTicks); + + RenderHelper.disableStandardItemLighting(); + GL11.glDisable(GL11.GL_LIGHTING); + GL11.glDisable(GL11.GL_DEPTH_TEST); + GL11.glDisable(GL12.GL_RESCALE_NORMAL); + if (drawButtons) { + RenderHelper.enableGUIStandardItemLighting(); + for (IGuiElement e : elements) e.draw(mouseX, mouseY, parTicks); + } + GL11.glEnable(GL12.GL_RESCALE_NORMAL); + + GL11.glPushMatrix(); + GL11.glTranslatef(guiLeft, guiTop, 0.0F); + GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); + + GL11.glDisable(GL11.GL_LIGHTING); + drawForegroundLayer(mouseX, mouseY, parTicks); + GL11.glEnable(GL11.GL_LIGHTING); + + GL11.glPopMatrix(); + + GL11.glEnable(GL11.GL_LIGHTING); + GL11.glEnable(GL11.GL_DEPTH_TEST); + RenderHelper.enableStandardItemLighting(); + } + + public void drawForegroundLayer(int mouseX, int mouseY, float parTicks) { + drawExtras(mouseX, mouseY, parTicks); + ttManager.onTick(this, mouseX, mouseY); + } + + public void drawBackground(int mouseX, int mouseY, float parTicks) { + short[] color = Dyes.MACHINE_METAL.getRGBA(); + GL11.glColor3ub((byte) color[0], (byte) color[1], (byte) color[2]); + this.mc.renderEngine.bindTexture(mGUIbackgroundLocation); + drawTexturedModalRect(guiLeft, guiTop, 0, 0, gui_width, gui_height); + } + + public void drawExtras(int mouseX, int mouseY, float parTicks) { + this.fontRendererObj.drawString(header, 25, 9, textColor); + } + + @Override + public boolean doesGuiPauseGame() { + return false; + } + + public void closeScreen() { + this.mc.displayGuiScreen(null); + this.mc.setIngameFocus(); + } + + @Override + public void updateScreen() { + super.updateScreen(); + for (GuiTextField f : textBoxes) { + f.updateCursorCounter(); + } + } + + @Override + public void mouseClicked(int x, int y, int button) { + for (GT_GuiIntegerTextBox tBox : textBoxes) { + boolean hadFocus = tBox.isFocused(); + if (tBox.isEnabled() || hadFocus) tBox.mouseClicked(x, y, button); + + if (tBox.isFocused() && button == 1 && tBox.isEnabled()) // rightclick -> lcear it + tBox.setText("0"); + else if (hadFocus && !tBox.isFocused()) applyTextBox(tBox); + } + super.mouseClicked(x, y, button); + } + + @Override + public void keyTyped(char c, int key) { + GT_GuiIntegerTextBox focusedTextBox = null; + for (GT_GuiIntegerTextBox textBox : textBoxes) { + if (textBox.isFocused()) focusedTextBox = textBox; + } + + if (key == 1) { // esc + if (focusedTextBox != null) { + resetTextBox(focusedTextBox); + setFocusedTextBox(null); + return; + } else { + closeScreen(); + // don't fall through to parent + return; + } + } + + if (c == '\t') { // tab + for (int i = 0; i < textBoxes.size(); i++) { + GT_GuiIntegerTextBox box = textBoxes.get(i); + if (box.isFocused()) { + applyTextBox(box); + setFocusedTextBox(((i + 1) < textBoxes.size()) ? textBoxes.get(i + 1) : null); + return; + } + } + if (!textBoxes.isEmpty()) setFocusedTextBox(textBoxes.get(0)); + return; + } + + if (focusedTextBox != null && focusedTextBox.textboxKeyTyped(c, key)) { + return; + } + + if (key == 28 && focusedTextBox != null) { // enter + applyTextBox(focusedTextBox); + setFocusedTextBox(null); + return; + } + + if (key == this.mc.gameSettings.keyBindInventory.getKeyCode()) { + if (focusedTextBox != null) { + applyTextBox(focusedTextBox); + setFocusedTextBox(null); + return; + } + closeScreen(); + return; + } + super.keyTyped(c, key); + } + + /** + * Button + */ + @Override + public void actionPerformed(GuiButton button) { + selectedButton = button; + } + + @Override + public void clearSelectedButton() { + selectedButton = null; + } + + @Override + public GuiButton getSelectedButton() { + return selectedButton; + } + + @Override + public void buttonClicked(GuiButton button) {} + + /** + * TextBoxes + */ + private void setFocusedTextBox(GT_GuiIntegerTextBox boxToFocus) { + for (GT_GuiIntegerTextBox textBox : textBoxes) { + textBox.setFocused(textBox.equals(boxToFocus) && textBox.isEnabled()); + } + } + + /** + * Given textbox's value might have changed. + */ + public void applyTextBox(GT_GuiIntegerTextBox box) {} + + /** + * Reset the given textbox to the last valid value, <b>NOT</b> 0. + */ + public void resetTextBox(GT_GuiIntegerTextBox box) {} + + /** + * GT_IToolTipRenderer + */ + @Override + public void drawHoveringText(List text, int mouseX, int mouseY, FontRenderer render) { + super.drawHoveringText(text, mouseX, mouseY, render); + } + + @Override + public FontRenderer getFontRenderer() { + return super.fontRendererObj; + } + + @Override + public void addToolTip(GT_GuiTooltip toolTip) { + ttManager.addToolTip(toolTip); + } + + @Override + public boolean removeToolTip(GT_GuiTooltip toolTip) { + return ttManager.removeToolTip(toolTip); + } + + /** + * Junk + */ + @Override + public int getGuiTop() { + return guiTop; + } + + @Override + public int getGuiLeft() { + return guiLeft; + } + + @Override + public int getXSize() { + return gui_width; + } + + @Override + public int getYSize() { + return gui_height; + } + + @Override + public RenderItem getItemRenderer() { + return itemRender; + } + + @Override + public void addElement(IGuiElement element) { + if (elements.contains(element)) return; + elements.add(element); + } + + @Override + public boolean removeElement(IGuiElement element) { + return elements.remove(element); + } } diff --git a/src/main/java/gregtech/api/gui/GT_Slot_Holo.java b/src/main/java/gregtech/api/gui/GT_Slot_Holo.java index ea1b8b82f8..bf5f8886b3 100644 --- a/src/main/java/gregtech/api/gui/GT_Slot_Holo.java +++ b/src/main/java/gregtech/api/gui/GT_Slot_Holo.java @@ -10,12 +10,17 @@ import net.minecraft.item.ItemStack; public class GT_Slot_Holo extends Slot { public final int mSlotIndex; public boolean mEnabled = true; - public boolean - mCanInsertItem, - mCanStackItem; + public boolean mCanInsertItem, mCanStackItem; public int mMaxStacksize = 127; - public GT_Slot_Holo(IInventory inventory, int slotIndex, int xPos, int yPos, boolean aCanInsertItem, boolean aCanStackItem, int aMaxStacksize) { + public GT_Slot_Holo( + IInventory inventory, + int slotIndex, + int xPos, + int yPos, + boolean aCanInsertItem, + boolean aCanStackItem, + int aMaxStacksize) { super(inventory, slotIndex, xPos, yPos); mCanInsertItem = aCanInsertItem; mCanStackItem = aCanStackItem; @@ -40,8 +45,7 @@ public class GT_Slot_Holo extends Slot { @Override public ItemStack decrStackSize(int amount) { - if (!mCanStackItem) - return null; + if (!mCanStackItem) return null; return super.decrStackSize(amount); } @@ -71,8 +75,7 @@ public class GT_Slot_Holo extends Slot { */ @Override @SideOnly(Side.CLIENT) - public boolean func_111238_b() - { + public boolean func_111238_b() { return isEnabled(); } } diff --git a/src/main/java/gregtech/api/gui/GT_Slot_Holo_ME.java b/src/main/java/gregtech/api/gui/GT_Slot_Holo_ME.java index 08a11d29f4..205a6d74dc 100644 --- a/src/main/java/gregtech/api/gui/GT_Slot_Holo_ME.java +++ b/src/main/java/gregtech/api/gui/GT_Slot_Holo_ME.java @@ -3,7 +3,8 @@ package gregtech.api.gui; import net.minecraft.inventory.IInventory; public class GT_Slot_Holo_ME extends GT_Slot_Holo { - public GT_Slot_Holo_ME(IInventory inventory, int slotIndex, int xPos, int yPos, boolean aCanInsertItem, boolean aCanStackItem) { + public GT_Slot_Holo_ME( + IInventory inventory, int slotIndex, int xPos, int yPos, boolean aCanInsertItem, boolean aCanStackItem) { super(inventory, slotIndex, xPos, yPos, aCanInsertItem, aCanStackItem, Integer.MAX_VALUE); } } 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 8f729771f6..525618589b 100644 --- a/src/main/java/gregtech/api/gui/widgets/GT_GuiCoverTabLine.java +++ b/src/main/java/gregtech/api/gui/widgets/GT_GuiCoverTabLine.java @@ -1,36 +1,34 @@ package gregtech.api.gui.widgets; -import java.awt.Rectangle; -import java.util.List; - -import org.lwjgl.opengl.GL11; - import codechicken.nei.api.API; import codechicken.nei.api.INEIGuiAdapter; -import gregtech.api.enums.Dyes; import gregtech.api.enums.GT_Values; import gregtech.api.gui.GT_GUIContainerMetaTile_Machine; import gregtech.api.interfaces.tileentity.IGregTechTileEntity; import gregtech.api.net.GT_Packet_GtTileEntityGuiRequest; import gregtech.common.GT_Proxy; +import java.awt.Rectangle; +import java.util.List; import net.minecraft.client.Minecraft; import net.minecraft.client.gui.inventory.GuiContainer; import net.minecraft.item.ItemStack; import net.minecraft.util.EnumChatFormatting; import net.minecraft.util.StatCollector; +import org.lwjgl.opengl.GL11; /** * Let's you access a GregTech IGregTechTileEntity's covers as tabs on the GUI's sides */ public class GT_GuiCoverTabLine extends GT_GuiTabLine { // Names of the block a cover could be on - private final static String[] SIDES = new String[]{ + private static final String[] SIDES = new String[] { "GT5U.interface.coverTabs.down", "GT5U.interface.coverTabs.up", "GT5U.interface.coverTabs.north", "GT5U.interface.coverTabs.south", "GT5U.interface.coverTabs.west", - "GT5U.interface.coverTabs.east"}; + "GT5U.interface.coverTabs.east" + }; // Not sure there's a point in JIT translation but that's what this is private String[] translatedSides; @@ -39,7 +37,7 @@ public class GT_GuiCoverTabLine extends GT_GuiTabLine { /** * Let's you access an IGregTechTileEntity's covers as tabs on the GUI's sides - * + * * @param gui GT_ITabRenderer gui which this tab line attaches to * @param tabLineLeft left position of the tab line in relation to the gui * @param tabLineTop top position of the tab line in relation to the gui @@ -56,9 +54,19 @@ public class GT_GuiCoverTabLine extends GT_GuiTabLine { * @param tile The IGregTechTileEntity the covers of which we are accessing * @param colorization The colorization of the GUI we are adding tabs to */ - public GT_GuiCoverTabLine(GT_GUIContainerMetaTile_Machine gui, int tabLineLeft, int tabLineTop, int tabHeight, - int tabWidth, int tabSpacing, DisplayStyle xDir, DisplayStyle yDir, DisplayStyle displayMode, - GT_GuiTabIconSet tabBackground, IGregTechTileEntity tile, int colorization) { + public GT_GuiCoverTabLine( + GT_GUIContainerMetaTile_Machine gui, + int tabLineLeft, + int tabLineTop, + int tabHeight, + int tabWidth, + int tabSpacing, + DisplayStyle xDir, + DisplayStyle yDir, + DisplayStyle displayMode, + GT_GuiTabIconSet tabBackground, + IGregTechTileEntity tile, + int colorization) { super(gui, 6, tabLineLeft, tabLineTop, tabHeight, tabWidth, tabSpacing, xDir, yDir, displayMode, tabBackground); this.tile = tile; this.colorization = colorization; @@ -76,12 +84,13 @@ public class GT_GuiCoverTabLine extends GT_GuiTabLine { addCoverToTabs(tSide, cover); } } - } + } @Override protected void drawBackground(float parTicks, int mouseX, int mouseY) { // Apply this tile's coloration to draw the background - GL11.glColor3ub((byte) ((colorization >> 16) & 0xFF), (byte) ((colorization >> 8) & 0xFF), (byte) (colorization & 0xFF)); + GL11.glColor3ub((byte) ((colorization >> 16) & 0xFF), (byte) ((colorization >> 8) & 0xFF), (byte) + (colorization & 0xFF)); super.drawBackground(parTicks, mouseX, mouseY); } @@ -89,13 +98,13 @@ public class GT_GuiCoverTabLine extends GT_GuiTabLine { protected void tabClicked(int tabId, int mouseButton) { if (mouseButton == 0 && mTabs[tabId].enabled) { GT_Values.NW.sendToServer(new GT_Packet_GtTileEntityGuiRequest( - this.tile.getXCoord(), - this.tile.getYCoord(), - this.tile.getZCoord(), - tabId + GT_Proxy.GUI_ID_COVER_SIDE_BASE, - this.tile.getWorld().provider.dimensionId, - Minecraft.getMinecraft().thePlayer.getEntityId(), - 0)); + this.tile.getXCoord(), + this.tile.getYCoord(), + this.tile.getZCoord(), + tabId + GT_Proxy.GUI_ID_COVER_SIDE_BASE, + this.tile.getWorld().provider.dimensionId, + Minecraft.getMinecraft().thePlayer.getEntityId(), + 0)); } } @@ -108,7 +117,6 @@ public class GT_GuiCoverTabLine extends GT_GuiTabLine { boolean enabled = this.tile.getCoverBehaviorAtSideNew(side).hasCoverGUI(); this.setTab(side, cover, null, getTooltipForCoverTab(side, cover, enabled)); this.setTabEnabled(side, enabled); - } /** @@ -119,12 +127,13 @@ public class GT_GuiCoverTabLine extends GT_GuiTabLine { * @return This cover tab's tooltip */ private String[] getTooltipForCoverTab(byte side, ItemStack cover, boolean enabled) { - List<String> tooltip = cover.getTooltip(Minecraft.getMinecraft().thePlayer, true); - tooltip.set(0, + List<String> tooltip = cover.getTooltip(Minecraft.getMinecraft().thePlayer, true); + tooltip.set( + 0, (enabled ? EnumChatFormatting.UNDERLINE : EnumChatFormatting.DARK_GRAY) - + getSideDescription(side) - + (enabled ? EnumChatFormatting.RESET + ": " : ": " + EnumChatFormatting.RESET) - + tooltip.get(0)); + + getSideDescription(side) + + (enabled ? EnumChatFormatting.RESET + ": " : ": " + EnumChatFormatting.RESET) + + tooltip.get(0)); return tooltip.toArray(new String[0]); } @@ -138,7 +147,7 @@ public class GT_GuiCoverTabLine extends GT_GuiTabLine { if (this.translatedSides[side] == null) { this.translatedSides[side] = StatCollector.translateToLocal(SIDES[side]); } - return this.translatedSides[side] ; + return this.translatedSides[side]; } return null; } @@ -146,7 +155,7 @@ public class GT_GuiCoverTabLine extends GT_GuiTabLine { /** * Hide any NEI slots that would intersect with a cover tab */ - static class CoverTabLineNEIHandler extends INEIGuiAdapter{ + static class CoverTabLineNEIHandler extends INEIGuiAdapter { @Override public boolean hideItemPanelSlot(GuiContainer gui, int x, int y, int w, int h) { Rectangle neiSlotArea = new Rectangle(x, y, w, h); @@ -155,7 +164,7 @@ public class GT_GuiCoverTabLine extends GT_GuiTabLine { if (!tabLine.visible) { return false; } - for (int i = 0; i < tabLine.mTabs.length; i++ ) { + for (int i = 0; i < tabLine.mTabs.length; i++) { if (tabLine.mTabs[i] != null && tabLine.mTabs[i].getBounds().intersects(neiSlotArea)) { return true; } @@ -164,6 +173,7 @@ public class GT_GuiCoverTabLine extends GT_GuiTabLine { return false; } } + static { API.registerNEIGuiHandler(new CoverTabLineNEIHandler()); } 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 045730dd7f..7a57c49515 100644 --- a/src/main/java/gregtech/api/gui/widgets/GT_GuiFakeItemButton.java +++ b/src/main/java/gregtech/api/gui/widgets/GT_GuiFakeItemButton.java @@ -3,15 +3,14 @@ package gregtech.api.gui.widgets; import codechicken.lib.gui.GuiDraw; import gregtech.api.interfaces.IGuiScreen; import gregtech.api.util.GT_UtilityClient; +import java.awt.*; +import java.util.List; import net.minecraft.client.Minecraft; import net.minecraft.item.ItemBlock; import net.minecraft.item.ItemStack; import org.lwjgl.opengl.GL11; import org.lwjgl.opengl.GL12; -import java.awt.*; -import java.util.List; - public class GT_GuiFakeItemButton implements IGuiScreen.IGuiElement { private GT_GuiIcon bgIcon; @@ -42,14 +41,13 @@ public class GT_GuiFakeItemButton implements IGuiScreen.IGuiElement { this.gui = gui; this.bgIcon = bgIcon; item = null; - rectangle = new Rectangle(x, y, 18, 18); + rectangle = new Rectangle(x, y, 18, 18); gui.addElement(this); } public GT_GuiFakeItemButton setItem(ItemStack i) { item = i; - if (getMimicSlot()) - updateTooltip(); + if (getMimicSlot()) updateTooltip(); return this; } @@ -57,7 +55,7 @@ public class GT_GuiFakeItemButton implements IGuiScreen.IGuiElement { itemTooltips = item == null ? null : GT_UtilityClient.getTooltip(item, true); } - public ItemStack getItem(){ + public ItemStack getItem() { return item; } @@ -95,8 +93,7 @@ public class GT_GuiFakeItemButton implements IGuiScreen.IGuiElement { @Override public void onRemoved() { - if (mimicSlot) - gui.removeToolTip(tooltip); + if (mimicSlot) gui.removeToolTip(tooltip); } @Override @@ -106,8 +103,8 @@ public class GT_GuiFakeItemButton implements IGuiScreen.IGuiElement { GL11.glEnable(GL11.GL_BLEND); GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA); - if (bgIcon != null){ - GT_GuiIcon.render(bgIcon, xPosition-1, yPosition-1, 18, 18,0,true); + if (bgIcon != null) { + GT_GuiIcon.render(bgIcon, xPosition - 1, yPosition - 1, 18, 18, 0, true); } if (item != null) { @@ -115,10 +112,15 @@ 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); - - if (item.getItem() instanceof ItemBlock) - GL11.glPopAttrib(); + gui.getItemRenderer() + .renderItemAndEffectIntoGUI( + gui.getFontRenderer(), + Minecraft.getMinecraft().getTextureManager(), + item, + xPosition, + yPosition); + + if (item.getItem() instanceof ItemBlock) GL11.glPopAttrib(); } if (getMimicSlot()) diff --git a/src/main/java/gregtech/api/gui/widgets/GT_GuiIcon.java b/src/main/java/gregtech/api/gui/widgets/GT_GuiIcon.java index 0d6c2da243..37e1a6d960 100644 --- a/src/main/java/gregtech/api/gui/widgets/GT_GuiIcon.java +++ b/src/main/java/gregtech/api/gui/widgets/GT_GuiIcon.java @@ -1,61 +1,59 @@ package gregtech.api.gui.widgets; -import java.util.Arrays; - import gregtech.api.interfaces.IGuiIcon; +import java.util.Arrays; import net.minecraft.client.Minecraft; import net.minecraft.client.renderer.Tessellator; import net.minecraft.util.ResourceLocation; -public enum GT_GuiIcon implements IGuiIcon{ - BUTTON_NORMAL (0, 0, 0), - BUTTON_DOWN (0, 32, 0), - BUTTON_HIGHLIGHT (0, 32*2, 0), - BUTTON_HIGHLIGHT_DOWN (0, 32*3, 0), - BUTTON_DISABLED (0, 32*4, 0), - - DISABLE (0, 0, 32), - REDSTONE_OFF (0, 32, 32), - REDSTONE_ON (0, 32*2, 32), - CHECKMARK (0, 32*3, 32), - CROSS (0, 32*4, 32), - WHITELIST (0, 32*5, 32), - BLACKLIST (0, 32*6, 32), - PROGRESS (0, 32*7, 32), - - EXPORT (0, 0, 32*2), - IMPORT (0, 32, 32*2), - ALLOW_INPUT (0, 32*2, 32*2), - BLOCK_INPUT (0, 32*3, 32*2), - GREEN_ARROW_UP (0, 32*4, 32*2), - GREEN_ARROW_DOWN (0, 32*5, 32*2), - CYCLIC (0, 32*6, 32*2), - - SLOT_DARKGRAY (1, 176,0,18,18), - SLOT_GRAY (1, 176,18,18,18), - - TAB_NORMAL (2, 0, 0,18,20), - TAB_HIGHLIGHT (2, 18, 0,18,20), - TAB_DISABLED (2, 18*2, 0,18,20), - TAB_NORMAL_BRONZE (2, 0, 20,18,20), - TAB_HIGHLIGHT_BRONZE (2, 18, 20,18,20), - TAB_DISABLED_BRONZE (2, 18*2, 20,18,20), - TAB_NORMAL_STEEL (2, 0,2*20,18,20), - TAB_HIGHLIGHT_STEEL (2, 18,2*20,18,20), - TAB_DISABLED_STEEL (2, 18*2,2*20,18,20), - TAB_NORMAL_BRICK (2, 0,3*20,18,20), - TAB_HIGHLIGHT_BRICK (2, 18,3*20,18,20), - TAB_DISABLED_BRICK (2, 18*2,3*20,18,20), - TAB_INFO_GRAY (2, 220, 0,18,20), - TAB_INFO_BLUE (2,220+18, 0,18,20), -; - +public enum GT_GuiIcon implements IGuiIcon { + BUTTON_NORMAL(0, 0, 0), + BUTTON_DOWN(0, 32, 0), + BUTTON_HIGHLIGHT(0, 32 * 2, 0), + BUTTON_HIGHLIGHT_DOWN(0, 32 * 3, 0), + BUTTON_DISABLED(0, 32 * 4, 0), + + DISABLE(0, 0, 32), + REDSTONE_OFF(0, 32, 32), + REDSTONE_ON(0, 32 * 2, 32), + CHECKMARK(0, 32 * 3, 32), + CROSS(0, 32 * 4, 32), + WHITELIST(0, 32 * 5, 32), + BLACKLIST(0, 32 * 6, 32), + PROGRESS(0, 32 * 7, 32), + + EXPORT(0, 0, 32 * 2), + IMPORT(0, 32, 32 * 2), + ALLOW_INPUT(0, 32 * 2, 32 * 2), + BLOCK_INPUT(0, 32 * 3, 32 * 2), + GREEN_ARROW_UP(0, 32 * 4, 32 * 2), + GREEN_ARROW_DOWN(0, 32 * 5, 32 * 2), + CYCLIC(0, 32 * 6, 32 * 2), + + SLOT_DARKGRAY(1, 176, 0, 18, 18), + SLOT_GRAY(1, 176, 18, 18, 18), + + TAB_NORMAL(2, 0, 0, 18, 20), + TAB_HIGHLIGHT(2, 18, 0, 18, 20), + TAB_DISABLED(2, 18 * 2, 0, 18, 20), + TAB_NORMAL_BRONZE(2, 0, 20, 18, 20), + TAB_HIGHLIGHT_BRONZE(2, 18, 20, 18, 20), + TAB_DISABLED_BRONZE(2, 18 * 2, 20, 18, 20), + TAB_NORMAL_STEEL(2, 0, 2 * 20, 18, 20), + TAB_HIGHLIGHT_STEEL(2, 18, 2 * 20, 18, 20), + TAB_DISABLED_STEEL(2, 18 * 2, 2 * 20, 18, 20), + TAB_NORMAL_BRICK(2, 0, 3 * 20, 18, 20), + TAB_HIGHLIGHT_BRICK(2, 18, 3 * 20, 18, 20), + TAB_DISABLED_BRICK(2, 18 * 2, 3 * 20, 18, 20), + TAB_INFO_GRAY(2, 220, 0, 18, 20), + TAB_INFO_BLUE(2, 220 + 18, 0, 18, 20), + ; private static final int T_SIZE = 256; private static ResourceLocation[] TEXTURES = { - new ResourceLocation("gregtech", "textures/gui/GuiButtons.png"), - new ResourceLocation("gregtech", "textures/gui/GuiCover.png"), - new ResourceLocation("gregtech", "textures/gui/GuiTabs.png"), + new ResourceLocation("gregtech", "textures/gui/GuiButtons.png"), + new ResourceLocation("gregtech", "textures/gui/GuiCover.png"), + new ResourceLocation("gregtech", "textures/gui/GuiTabs.png"), }; public final int x, y, width, height; @@ -72,25 +70,34 @@ public enum GT_GuiIcon implements IGuiIcon{ } GT_GuiIcon(int texID, int x, int y) { - this(texID, x, y,32,32,null); + this(texID, x, y, 32, 32, null); } + GT_GuiIcon(int texID, int x, int y, int width, int height) { - this(texID, x, y, width, height,null); + this(texID, x, y, width, height, null); } - public static void render(IGuiIcon icon, double x, double y, double width, double height, double zLevel, - boolean doDraw) { + + public static void render( + IGuiIcon icon, double x, double y, double width, double height, double zLevel, boolean doDraw) { render(icon, x, y, width, height, zLevel, doDraw, false); } - public static void render(IGuiIcon icon, double x, double y, double width, double height, double zLevel, - boolean doDraw, boolean flipHoritontally) { + public static void render( + IGuiIcon icon, + double x, + double y, + double width, + double height, + double zLevel, + boolean doDraw, + boolean flipHoritontally) { Tessellator tess = Tessellator.instance; if (doDraw) { Minecraft.getMinecraft().renderEngine.bindTexture(TEXTURES[icon.getTexId()]); tess.startDrawingQuads(); } double minU = (double) (icon.getX() + (flipHoritontally ? icon.getWidth() : 0)) / T_SIZE; - double maxU = (double) (icon.getX() + (flipHoritontally ? 0: icon.getWidth())) / T_SIZE; + double maxU = (double) (icon.getX() + (flipHoritontally ? 0 : icon.getWidth())) / T_SIZE; double minV = (double) icon.getY() / T_SIZE; double maxV = (double) (icon.getY() + icon.getHeight()) / T_SIZE; tess.addVertexWithUV(x, y + height, zLevel, minU, maxV); @@ -98,11 +105,9 @@ public enum GT_GuiIcon implements IGuiIcon{ tess.addVertexWithUV(x + width, y + 0, zLevel, maxU, minV); tess.addVertexWithUV(x, y + 0, zLevel, minU, minV); - if (icon.getOverlay() != null) - render(icon.getOverlay(), x, y, width, height, zLevel, false); + if (icon.getOverlay() != null) render(icon.getOverlay(), x, y, width, height, zLevel, false); - if (doDraw) - tess.draw(); + if (doDraw) tess.draw(); } /** diff --git a/src/main/java/gregtech/api/gui/widgets/GT_GuiIconButton.java b/src/main/java/gregtech/api/gui/widgets/GT_GuiIconButton.java index 9de9b03df4..fd9a879902 100644 --- a/src/main/java/gregtech/api/gui/widgets/GT_GuiIconButton.java +++ b/src/main/java/gregtech/api/gui/widgets/GT_GuiIconButton.java @@ -1,10 +1,10 @@ package gregtech.api.gui.widgets; import gregtech.api.interfaces.IGuiScreen; +import java.awt.Rectangle; import net.minecraft.client.Minecraft; import net.minecraft.client.gui.GuiButton; import org.lwjgl.opengl.GL11; -import java.awt.Rectangle; public class GT_GuiIconButton extends GuiButton implements IGuiScreen.IGuiElement { public static final int DEFAULT_WIDTH = 16; @@ -16,7 +16,6 @@ public class GT_GuiIconButton extends GuiButton implements IGuiScreen.IGuiElemen private GT_GuiTooltip tooltip; - public GT_GuiIconButton(IGuiScreen gui, int id, int x, int y, GT_GuiIcon icon) { super(id, x, y, DEFAULT_WIDTH, DEFAULT_HEIGHT, ""); this.gui = gui; @@ -28,8 +27,7 @@ public class GT_GuiIconButton extends GuiButton implements IGuiScreen.IGuiElemen @Override public void onInit() { - if (tooltip != null) - gui.addToolTip(tooltip); + if (tooltip != null) gui.addToolTip(tooltip); xPosition = x0 + gui.getGuiLeft(); yPosition = y0 + gui.getGuiTop(); } @@ -41,12 +39,14 @@ public class GT_GuiIconButton extends GuiButton implements IGuiScreen.IGuiElemen @Override public void drawButton(Minecraft mc, int mouseX, int mouseY) { - if (this.tooltip != null) - this.tooltip.enabled = true; + if (this.tooltip != null) this.tooltip.enabled = true; if (this.visible) { - //moused over - this.field_146123_n = mouseX >= this.xPosition && mouseY >= this.yPosition && mouseX < this.xPosition + width && mouseY < this.yPosition + height; + // moused over + this.field_146123_n = mouseX >= this.xPosition + && mouseY >= this.yPosition + && mouseX < this.xPosition + width + && mouseY < this.yPosition + height; mouseDragged(mc, mouseX, mouseY); @@ -56,17 +56,15 @@ public class GT_GuiIconButton extends GuiButton implements IGuiScreen.IGuiElemen int x = xPosition; int y = yPosition; - if(!this.field_146123_n) { - // GL11.glColor4f(200F/255F, 210F/255F, 1, 1); - } - else - GL11.glColor4f(1, 1, 1, 1); + if (!this.field_146123_n) { + // GL11.glColor4f(200F/255F, 210F/255F, 1, 1); + } else GL11.glColor4f(1, 1, 1, 1); GT_GuiIcon.render(getButtonTexture(this.field_146123_n), x, y, width, height, 0, true); GL11.glColor4f(1, 1, 1, 1); if (icon != null) { - GT_GuiIcon.render(icon, x, y, width, height , 0, true); + GT_GuiIcon.render(icon, x, y, width, height, 0, true); } GL11.glPopAttrib(); @@ -76,13 +74,11 @@ public class GT_GuiIconButton extends GuiButton implements IGuiScreen.IGuiElemen @Override public void mouseReleased(int mouseX, int mouseY) { this.gui.clearSelectedButton(); - if(mousePressed(Minecraft.getMinecraft(), mouseX, mouseY)) - this.gui.buttonClicked(this); + if (mousePressed(Minecraft.getMinecraft(), mouseX, mouseY)) this.gui.buttonClicked(this); } public GT_GuiIcon getButtonTexture(boolean mouseOver) { - if (!enabled) - return GT_GuiIcon.BUTTON_DISABLED; + if (!enabled) return GT_GuiIcon.BUTTON_DISABLED; if (this.equals(this.gui.getSelectedButton())) return mouseOver ? GT_GuiIcon.BUTTON_HIGHLIGHT_DOWN : GT_GuiIcon.BUTTON_DOWN; @@ -92,6 +88,7 @@ public class GT_GuiIconButton extends GuiButton implements IGuiScreen.IGuiElemen public GT_GuiIcon getIcon() { return icon; } + public GT_GuiIconButton setIcon(GT_GuiIcon icon) { this.icon = icon; return this; @@ -102,10 +99,8 @@ public class GT_GuiIconButton extends GuiButton implements IGuiScreen.IGuiElemen } public GT_GuiIconButton setTooltipText(String... text) { - if (tooltip == null) - tooltip = new GT_GuiTooltip(getBounds(), text); - else - tooltip.setToolTipText(text); + if (tooltip == null) tooltip = new GT_GuiTooltip(getBounds(), text); + else tooltip.setToolTipText(text); return this; } diff --git a/src/main/java/gregtech/api/gui/widgets/GT_GuiIconCheckButton.java b/src/main/java/gregtech/api/gui/widgets/GT_GuiIconCheckButton.java index e7b6b9971d..113b19711b 100644 --- a/src/main/java/gregtech/api/gui/widgets/GT_GuiIconCheckButton.java +++ b/src/main/java/gregtech/api/gui/widgets/GT_GuiIconCheckButton.java @@ -13,7 +13,15 @@ public class GT_GuiIconCheckButton extends GT_GuiIconButton { this(gui, id, x, y, checkedIcon, normalIcon, null, null); } - public GT_GuiIconCheckButton(IGuiScreen gui, int id, int x, int y, GT_GuiIcon checkedIcon, GT_GuiIcon normalIcon, String checkedTooltip, String normalTooltip) { + public GT_GuiIconCheckButton( + IGuiScreen gui, + int id, + int x, + int y, + GT_GuiIcon checkedIcon, + GT_GuiIcon normalIcon, + String checkedTooltip, + String normalTooltip) { super(gui, id, x, y, normalIcon); this.checkedIcon = checkedIcon; this.normalIcon = normalIcon; @@ -23,8 +31,7 @@ public class GT_GuiIconCheckButton extends GT_GuiIconButton { @Override public GT_GuiIcon getButtonTexture(boolean mouseOver) { - if (!enabled) - return GT_GuiIcon.BUTTON_DISABLED; + if (!enabled) return GT_GuiIcon.BUTTON_DISABLED; if (this.equals(super.gui.getSelectedButton())) return mouseOver ? GT_GuiIcon.BUTTON_HIGHLIGHT_DOWN : GT_GuiIcon.BUTTON_DOWN; return mouseOver ? GT_GuiIcon.BUTTON_HIGHLIGHT : GT_GuiIcon.BUTTON_NORMAL; diff --git a/src/main/java/gregtech/api/gui/widgets/GT_GuiIntegerTextBox.java b/src/main/java/gregtech/api/gui/widgets/GT_GuiIntegerTextBox.java index e2ba53e4c9..3e2ac1e296 100644 --- a/src/main/java/gregtech/api/gui/widgets/GT_GuiIntegerTextBox.java +++ b/src/main/java/gregtech/api/gui/widgets/GT_GuiIntegerTextBox.java @@ -1,11 +1,10 @@ package gregtech.api.gui.widgets; import gregtech.api.interfaces.IGuiScreen; +import java.awt.*; import net.minecraft.client.Minecraft; import net.minecraft.client.gui.GuiTextField; -import java.awt.*; - public class GT_GuiIntegerTextBox extends GuiTextField implements IGuiScreen.IGuiElement { private final int x0, y0; private final IGuiScreen gui; @@ -44,7 +43,17 @@ public class GT_GuiIntegerTextBox extends GuiTextField implements IGuiScreen.IGu @Override public boolean textboxKeyTyped(char c, int key) { - if (validChar(c, key) || c == 1 || c == 3 || c == 22 || c == 24 || key == 14 || key == 199 || key == 203 || key == 205 || key == 207 || key == 211) { + if (validChar(c, key) + || c == 1 + || c == 3 + || c == 22 + || c == 24 + || key == 14 + || key == 199 + || key == 203 + || key == 205 + || key == 207 + || key == 211) { return super.textboxKeyTyped(c, key); } return false; diff --git a/src/main/java/gregtech/api/gui/widgets/GT_GuiSlotTooltip.java b/src/main/java/gregtech/api/gui/widgets/GT_GuiSlotTooltip.java index 1fb25ecb1a..105e919149 100644 --- a/src/main/java/gregtech/api/gui/widgets/GT_GuiSlotTooltip.java +++ b/src/main/java/gregtech/api/gui/widgets/GT_GuiSlotTooltip.java @@ -1,8 +1,7 @@ package gregtech.api.gui.widgets; -import java.awt.Rectangle; - import gregtech.api.util.GT_TooltipDataCache.TooltipData; +import java.awt.Rectangle; import net.minecraft.inventory.Slot; public class GT_GuiSlotTooltip extends GT_GuiTooltip { diff --git a/src/main/java/gregtech/api/gui/widgets/GT_GuiSmartTooltip.java b/src/main/java/gregtech/api/gui/widgets/GT_GuiSmartTooltip.java index d4f7df6d2c..2bb28fb929 100644 --- a/src/main/java/gregtech/api/gui/widgets/GT_GuiSmartTooltip.java +++ b/src/main/java/gregtech/api/gui/widgets/GT_GuiSmartTooltip.java @@ -1,13 +1,13 @@ package gregtech.api.gui.widgets; +import gregtech.api.util.GT_TooltipDataCache.TooltipData; import java.awt.Rectangle; -import gregtech.api.util.GT_TooltipDataCache.TooltipData; +public class GT_GuiSmartTooltip extends GT_GuiTooltip { + public interface TooltipVisibilityProvider { + boolean shouldShowTooltip(); + } -public class GT_GuiSmartTooltip extends GT_GuiTooltip{ - public interface TooltipVisibilityProvider { - boolean shouldShowTooltip(); - } private final TooltipVisibilityProvider visibilityProvider; public GT_GuiSmartTooltip(Rectangle bounds, TooltipVisibilityProvider visibilityProvider, TooltipData data) { @@ -21,5 +21,4 @@ public class GT_GuiSmartTooltip extends GT_GuiTooltip{ // If disabled by super, stay disabled. this.enabled = this.enabled && this.visibilityProvider.shouldShowTooltip(); } - } 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 60672db880..1bb2f6dbb7 100644 --- a/src/main/java/gregtech/api/gui/widgets/GT_GuiTab.java +++ b/src/main/java/gregtech/api/gui/widgets/GT_GuiTab.java @@ -1,16 +1,14 @@ package gregtech.api.gui.widgets; -import java.awt.Rectangle; - -import org.lwjgl.opengl.GL11; -import org.lwjgl.opengl.GL12; - import gregtech.api.gui.widgets.GT_GuiTabLine.GT_GuiTabIconSet; import gregtech.api.gui.widgets.GT_GuiTabLine.GT_ITabRenderer; import gregtech.api.interfaces.IGuiIcon; +import java.awt.Rectangle; import net.minecraft.client.Minecraft; import net.minecraft.item.ItemBlock; import net.minecraft.item.ItemStack; +import org.lwjgl.opengl.GL11; +import org.lwjgl.opengl.GL12; /** * A tab to be attached to a tab line @@ -18,10 +16,7 @@ import net.minecraft.item.ItemStack; public class GT_GuiTab { private static final int SLOT_SIZE = 18; - public boolean - visible = true, - mousedOver, - enabled = true; + public boolean visible = true, mousedOver, enabled = true; private Rectangle bounds; private GT_GuiTabIconSet tabBackground; @@ -33,7 +28,7 @@ public class GT_GuiTab { /** * A tab to be attached to a tab line - * + * * @param gui IGregTechTileEntity the tab line this tab belongs to is attached to * @param id both the ID and position in the tab line of this tab * @param bounds bounds of this tab @@ -43,8 +38,15 @@ public class GT_GuiTab { * @param tooltipText tooltip of this tab * @param flipHorizontally whether to draw this tab on the right side of the IGregTechTileEntity */ - public GT_GuiTab( GT_ITabRenderer gui, int id, Rectangle bounds, GT_GuiTabIconSet tabBackground, ItemStack item, - IGuiIcon overlay, String[] tooltipText, boolean flipHorizontally) { + public GT_GuiTab( + GT_ITabRenderer gui, + int id, + Rectangle bounds, + GT_GuiTabIconSet tabBackground, + ItemStack item, + IGuiIcon overlay, + String[] tooltipText, + boolean flipHorizontally) { this.gui = gui; this.bounds = bounds; this.item = item; @@ -56,13 +58,13 @@ public class GT_GuiTab { this.flipHorizontally = flipHorizontally; } - public GT_GuiTab( GT_ITabRenderer gui, int id, Rectangle bounds, GT_GuiTabIconSet tabBackground) { + public GT_GuiTab(GT_ITabRenderer gui, int id, Rectangle bounds, GT_GuiTabIconSet tabBackground) { this(gui, id, bounds, tabBackground, null, null, null, false); } /** * Set this tab's tooltip text - * + * * @param text * @return This tab for chaining */ @@ -70,8 +72,7 @@ public class GT_GuiTab { if (tooltip == null) { tooltip = new GT_GuiTooltip(bounds, text); gui.addToolTip(tooltip); - } - else { + } else { tooltip.setToolTipText(text); } return this; @@ -86,21 +87,28 @@ public class GT_GuiTab { /** * Draw the background texture for this tab - * + * * @param mouseX * @param mouseY * @param parTicks */ public void drawBackground(int mouseX, int mouseY, float parTicks) { if (this.visible) { - GT_GuiIcon.render(getBackgroundTexture(), bounds.x, bounds.y, bounds.width, bounds.height, 1, true, - this.flipHorizontally); + GT_GuiIcon.render( + getBackgroundTexture(), + bounds.x, + bounds.y, + bounds.width, + bounds.height, + 1, + true, + this.flipHorizontally); } } /** * Draw overlay textures and items atop the background texture - * + * * @param mouseX * @param mouseY * @param parTicks @@ -119,19 +127,22 @@ public class GT_GuiTab { } if (item != null) { GL11.glPushAttrib(GL11.GL_ENABLE_BIT); - + if (item.getItem() instanceof ItemBlock) { GL11.glPushAttrib(GL11.GL_ENABLE_BIT); 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); - - if (item.getItem() instanceof ItemBlock) - GL11.glPopAttrib(); - + 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(); + GL11.glPopAttrib(); } } @@ -141,8 +152,7 @@ public class GT_GuiTab { * @return the texture this tab should currently use as it's background */ protected IGuiIcon getBackgroundTexture() { - if (!enabled) - return tabBackground.disabled; + if (!enabled) return tabBackground.disabled; return mousedOver ? tabBackground.highlight : tabBackground.normal; } @@ -156,11 +166,11 @@ public class GT_GuiTab { /** * Reposition this tab on the screen - * + * * @param xPos * @param yPos */ public void setPosition(int xPos, int yPos) { - this.bounds = new Rectangle( xPos, yPos, bounds.width, bounds.height); + this.bounds = new Rectangle(xPos, yPos, bounds.width, bounds.height); } } 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 e7ac596dee..ff0ccc2ac1 100644 --- a/src/main/java/gregtech/api/gui/widgets/GT_GuiTabLine.java +++ b/src/main/java/gregtech/api/gui/widgets/GT_GuiTabLine.java @@ -1,13 +1,11 @@ package gregtech.api.gui.widgets; -import java.awt.Rectangle; - -import org.lwjgl.opengl.GL11; - import gregtech.api.interfaces.IGuiIcon; +import java.awt.Rectangle; import net.minecraft.client.gui.FontRenderer; import net.minecraft.client.renderer.entity.RenderItem; import net.minecraft.item.ItemStack; +import org.lwjgl.opengl.GL11; /** * Draws clickable and configurable tabs on the left or right side of another GUI @@ -20,11 +18,11 @@ public class GT_GuiTabLine { public IGuiIcon disabled; public IGuiIcon normal; public IGuiIcon highlight; - + public GT_GuiTabIconSet(IGuiIcon normalIcon, IGuiIcon highlightIcon, IGuiIcon disabledIcon) { - this. normal = normalIcon; - this. highlight = highlightIcon; - this. disabled = disabledIcon; + this.normal = normalIcon; + this.highlight = highlightIcon; + this.disabled = disabledIcon; } } @@ -32,11 +30,12 @@ public class GT_GuiTabLine { * Controls the rendering style of the tab line */ public static enum DisplayStyle { - NONE((byte)0), - NORMAL((byte)1), - INVERSE((byte)-1); + NONE((byte) 0), + NORMAL((byte) 1), + INVERSE((byte) -1); private byte value; + DisplayStyle(byte value) { this.value = value; } @@ -52,43 +51,37 @@ public class GT_GuiTabLine { */ public interface GT_ITabRenderer { int getGuiLeft(); + int getGuiTop(); + int getXSize(); RenderItem getItemRenderer(); + FontRenderer getFontRenderer(); - void addToolTip(GT_GuiTooltip tooltip); + void addToolTip(GT_GuiTooltip tooltip); + boolean removeToolTip(GT_GuiTooltip tooltip); } // The tabs are arranged according to their index in this array protected final GT_GuiTab[] mTabs; - private int - tabLineLeft, - tabLineTop, - tabHeight, - tabWidth, - tabSpacing; - + private int tabLineLeft, tabLineTop, tabHeight, tabWidth, tabSpacing; + // In which direction to draw the tab line - private DisplayStyle - xDir, - yDir; + private DisplayStyle xDir, yDir; // Whether to display on the right side of the GT_ITabRenderer instead of left - protected boolean - flipHorizontally, - visible; + protected boolean flipHorizontally, visible; private GT_GuiTabIconSet tabBackground; private GT_ITabRenderer gui; - /** * Draws clickable and configurable tabs on the left or right side of a GT_ITabRenderer - * + * * @param gui GT_ITabRenderer gui which this tab line attaches to * @param numTabs number of tab positions in this tab line * @param tabLineLeft left position of the tab line in relation to the gui @@ -104,8 +97,18 @@ public class GT_GuiTabLine { * (NORMAL), on it's right side (INVERSE) or not at all (NONE) * @param tabBackground the set of textures used to draw this tab line's tab backgrounds */ - public GT_GuiTabLine(GT_ITabRenderer gui, int numTabs, int tabLineLeft, int tabLineTop, int tabHeight, int tabWidth, - int tabSpacing, DisplayStyle xDir, DisplayStyle yDir, DisplayStyle displayMode, GT_GuiTabIconSet tabBackground) { + public GT_GuiTabLine( + GT_ITabRenderer gui, + int numTabs, + int tabLineLeft, + int tabLineTop, + int tabHeight, + int tabWidth, + int tabSpacing, + DisplayStyle xDir, + DisplayStyle yDir, + DisplayStyle displayMode, + GT_GuiTabIconSet tabBackground) { this.gui = gui; this.mTabs = new GT_GuiTab[numTabs]; this.tabLineLeft = tabLineLeft; @@ -123,34 +126,37 @@ public class GT_GuiTabLine { /** * Creates a new tab at the specified position with the given parameters. * This class handles the positioning. - * + * * @param tabId * @param item * @param overlay * @param text */ public void setTab(int tabId, ItemStack item, IGuiIcon overlay, String[] text) { - mTabs[tabId] = new GT_GuiTab( this.gui, tabId, getBoundsForTab(tabId), - this.tabBackground, item, overlay, text, this.flipHorizontally); + mTabs[tabId] = new GT_GuiTab( + this.gui, + tabId, + getBoundsForTab(tabId), + this.tabBackground, + item, + overlay, + text, + this.flipHorizontally); } /** * Get the bounds a given tab should occupy - * + * * @param tabId * @return */ protected Rectangle getBoundsForTab(int tabId) { - return new Rectangle ( - getTabX(tabId), - getTabY(tabId), - this.tabWidth, - this.tabHeight); + return new Rectangle(getTabX(tabId), getTabY(tabId), this.tabWidth, this.tabHeight); } /** * Enable or disable a tab. Disabled tabs have a dark background. - * + * * @param tabId * @param value */ @@ -159,13 +165,12 @@ public class GT_GuiTabLine { mTabs[tabId].enabled = value; } } - /** * Draw the tabs for this tab bar * GT_ITabRenderer must call this method on drawGuiContainerBackgroundLayer * or on drawScreen. - * + * * @param parTicks * @param mouseX * @param mouseY @@ -183,7 +188,7 @@ public class GT_GuiTabLine { /** * Draw the tab's backgrounds first - * + * * @param parTicks * @param mouseX * @param mouseY @@ -198,7 +203,7 @@ public class GT_GuiTabLine { /** * Draw anything that overlays the tab's background texture - * + * * @param parTicks * @param mouseX * @param mouseY @@ -214,13 +219,13 @@ public class GT_GuiTabLine { /** * Call tabClick for every tab that was clicked. * GT_ITabRenderer must call this method on mouseClicked. - * + * * @param mouseX * @param mouseY * @param mouseButton */ public void onMouseClicked(int mouseX, int mouseY, int mouseButton) { - for(int tabId = 0; tabId < mTabs.length; tabId++) { + for (int tabId = 0; tabId < mTabs.length; tabId++) { if (mTabs[tabId] != null && mTabs[tabId].getBounds().contains(mouseX, mouseY)) { tabClicked(tabId, mouseButton); return; @@ -230,11 +235,11 @@ public class GT_GuiTabLine { /** * Act on a tab being clicked. - * + * * @param tabId * @param mouseButton */ - protected void tabClicked(int tabId, int mouseButton) { } + protected void tabClicked(int tabId, int mouseButton) {} /** * Reposition ourselves whenever the GT_ITabRenderer does so. @@ -250,18 +255,19 @@ public class GT_GuiTabLine { /** * Get the proper X position for a given tab - * + * * @param tabId * @return */ private int getTabX(int tabId) { - return this.gui.getGuiLeft() + (flipHorizontally ? (gui.getXSize() - tabLineLeft - tabWidth) : tabLineLeft) - + (tabId * (tabWidth + tabSpacing) * xDir.getValue()); + return this.gui.getGuiLeft() + + (flipHorizontally ? (gui.getXSize() - tabLineLeft - tabWidth) : tabLineLeft) + + (tabId * (tabWidth + tabSpacing) * xDir.getValue()); } /** * Get the proper Y position for a given tab - * + * * @param tabId * @return */ diff --git a/src/main/java/gregtech/api/gui/widgets/GT_GuiTooltip.java b/src/main/java/gregtech/api/gui/widgets/GT_GuiTooltip.java index 21648b74fe..ab755eb2c3 100644 --- a/src/main/java/gregtech/api/gui/widgets/GT_GuiTooltip.java +++ b/src/main/java/gregtech/api/gui/widgets/GT_GuiTooltip.java @@ -1,15 +1,13 @@ package gregtech.api.gui.widgets; +import gregtech.api.util.GT_TooltipDataCache.TooltipData; import java.awt.Rectangle; import java.util.ArrayList; import java.util.Arrays; import java.util.Collections; import java.util.List; -import java.util.Objects; - import org.lwjgl.input.Keyboard; -import gregtech.api.util.GT_TooltipDataCache.TooltipData; public class GT_GuiTooltip { protected Rectangle bounds; @@ -20,7 +18,7 @@ public class GT_GuiTooltip { /** * Used to create a tooltip that will appear over the specified bounds. * This will initially be a "static" tooltip that doesn't respect verbosity levels or respond to the shift key. - * + * * @param bounds * @param text */ @@ -32,7 +30,7 @@ public class GT_GuiTooltip { /** * Used to create a tooltip that will appear over the specified bounds. * This will initially be a "dynamic" tooltip that respects verbosity levels and responds to the shift key. - * + * * @param bounds * @param data */ @@ -43,10 +41,10 @@ public class GT_GuiTooltip { } private TooltipData sanitizeTooltipData(TooltipData data) { - if (data.text == null){ + if (data.text == null) { data.text = Arrays.asList(new String[0]); } - if (data.shiftText == null){ + if (data.shiftText == null) { data.shiftText = Arrays.asList(new String[0]); } return data; @@ -65,12 +63,11 @@ public class GT_GuiTooltip { /** * Called once this tooltip has been determined to be enabled */ - protected void updateText() { - } + protected void updateText() {} /** * Used to set a "static" tooltip that doesn't respect verbosity levels or respond to the shift key - * + * * @param text */ public void setToolTipText(String... text) { @@ -80,17 +77,17 @@ public class GT_GuiTooltip { /** * Used to set a "dynamic" tooltip that respects verbosity levels and responds to the shift key - * + * * @param data */ public void setToolTipText(TooltipData data) { // Trust that the tooltips have already been formatted and colored, just make sure it has no nulls this.data = sanitizeTooltipData(data); } - + /** * Apply tooltip colors in case the text doesn't contain them and return as tooltip data - * + * * @param text * @return colored tooltip lines as list */ @@ -100,18 +97,15 @@ public class GT_GuiTooltip { list = new ArrayList<>(text.length); for (int i = 0; i < text.length; i++) { if (text[i] == null) continue; - if (list.isEmpty()) - list.add("\u00a7f" + text[i]); - else - list.add("\u00a77" + text[i]); + if (list.isEmpty()) list.add("\u00a7f" + text[i]); + else list.add("\u00a77" + text[i]); } } else { list = Collections.emptyList(); } - return new TooltipData(list, list) ; + return new TooltipData(list, list); } - public List<String> getToolTipText() { return this.displayedText; } 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 abee1774f9..1c31670071 100644 --- a/src/main/java/gregtech/api/gui/widgets/GT_GuiTooltipManager.java +++ b/src/main/java/gregtech/api/gui/widgets/GT_GuiTooltipManager.java @@ -1,16 +1,19 @@ package gregtech.api.gui.widgets; -import net.minecraft.client.gui.FontRenderer; - import java.util.ArrayList; import java.util.List; +import net.minecraft.client.gui.FontRenderer; public class GT_GuiTooltipManager { public interface GT_IToolTipRenderer { int getGuiLeft(); + int getGuiTop(); + int getXSize(); + FontRenderer getFontRenderer(); + void drawHoveringText(List<String> text, int mouseX, int mouseY, FontRenderer font); } @@ -29,8 +32,8 @@ public class GT_GuiTooltipManager { } public final void onTick(GT_IToolTipRenderer render, int mouseX, int mouseY) { - if ((Math.abs(mouseX-lastMouseX) < 2 ) && (Math.abs(mouseY-lastMouseY) < 2 )) { - mouseStopped = Math.min(mouseStopped+1, 50); + if ((Math.abs(mouseX - lastMouseX) < 2) && (Math.abs(mouseY - lastMouseY) < 2)) { + mouseStopped = Math.min(mouseStopped + 1, 50); } else { mouseStopped = 0; } @@ -43,7 +46,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; @@ -53,10 +58,9 @@ public class GT_GuiTooltipManager { private void drawTooltip(GT_GuiTooltip tip, int mouseX, int mouseY, GT_IToolTipRenderer render) { List<String> text = tip.getToolTipText(); - if (text == null) - return; + if (text == null) return; - if (mouseX > render.getGuiLeft() + render.getXSize()/2) { + if (mouseX > render.getGuiLeft() + render.getXSize() / 2) { int maxWidth = 0; for (String s : text) { int w = render.getFontRenderer().getStringWidth(s); @@ -69,5 +73,4 @@ public class GT_GuiTooltipManager { render.drawHoveringText(text, mouseX, mouseY, render.getFontRenderer()); } - } diff --git a/src/main/java/gregtech/api/interfaces/IBlockContainer.java b/src/main/java/gregtech/api/interfaces/IBlockContainer.java index 7949ae90ce..89bda5de12 100644 --- a/src/main/java/gregtech/api/interfaces/IBlockContainer.java +++ b/src/main/java/gregtech/api/interfaces/IBlockContainer.java @@ -4,5 +4,6 @@ import net.minecraft.block.Block; public interface IBlockContainer { Block getBlock(); + byte getMeta(); } diff --git a/src/main/java/gregtech/api/interfaces/IDebugableBlock.java b/src/main/java/gregtech/api/interfaces/IDebugableBlock.java index 35ca68336e..063f713fe4 100644 --- a/src/main/java/gregtech/api/interfaces/IDebugableBlock.java +++ b/src/main/java/gregtech/api/interfaces/IDebugableBlock.java @@ -1,8 +1,7 @@ package gregtech.api.interfaces; -import net.minecraft.entity.player.EntityPlayer; - import java.util.ArrayList; +import net.minecraft.entity.player.EntityPlayer; /** * You are allowed to include this File in your Download, as i will not change it. diff --git a/src/main/java/gregtech/api/interfaces/IGlobalWirelessEnergy.java b/src/main/java/gregtech/api/interfaces/IGlobalWirelessEnergy.java index cec499c5d3..cc825f9d1a 100644 --- a/src/main/java/gregtech/api/interfaces/IGlobalWirelessEnergy.java +++ b/src/main/java/gregtech/api/interfaces/IGlobalWirelessEnergy.java @@ -1,8 +1,5 @@ package gregtech.api.interfaces; -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.world.World; - import java.io.File; import java.io.IOException; import java.math.BigInteger; @@ -13,6 +10,8 @@ import java.util.HashMap; import java.util.List; import java.util.UUID; import java.util.stream.Collectors; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.world.World; // If you are adding very late-game content feel free to tap into this interface. // The eventual goal is to bypass laser/dynamo stuff and have energy deposited directly from ultra-endgame @@ -50,22 +49,22 @@ public interface IGlobalWirelessEnergy { default void saveGlobalEnergyInfo(String world_name) { // Replace chars because of bug in forge that doesn't understand MC converts . to _ upon world creation. - world_name = world_name.replace('.','_'); + world_name = world_name.replace('.', '_'); createStorageIfNotExist(world_name); saveGlobalEnergyMap(world_name); saveGlobalEnergyName(world_name); saveGlobalEnergyTeam(world_name); - } default void saveGlobalEnergyMap(String world_name) { try { - List<String> lines = GlobalEnergy.entrySet() - .stream() - .map(entry -> entry.getKey() + ":" + entry.getValue()) - .collect(Collectors.toList()); + List<String> lines = GlobalEnergy.entrySet().stream() + .map(entry -> entry.getKey() + ":" + entry.getValue()) + .collect(Collectors.toList()); - Path path = Paths.get("./saves/" + world_name + "/" + GlobalEnergyFolderName + "/" + GlobalEnergyMapFileName + ".txt").toAbsolutePath(); + Path path = Paths.get("./saves/" + world_name + "/" + GlobalEnergyFolderName + "/" + GlobalEnergyMapFileName + + ".txt") + .toAbsolutePath(); Files.write(path, lines); } catch (IOException e) { @@ -75,12 +74,13 @@ public interface IGlobalWirelessEnergy { default void saveGlobalEnergyName(String world_name) { try { - List<String> lines = GlobalEnergyName.entrySet() - .stream() - .map(entry -> entry.getKey() + ":" + entry.getValue()) - .collect(Collectors.toList()); + List<String> lines = GlobalEnergyName.entrySet().stream() + .map(entry -> entry.getKey() + ":" + entry.getValue()) + .collect(Collectors.toList()); - Path path = Paths.get("./saves/" + world_name + "/" + GlobalEnergyFolderName + "/" + GlobalEnergyNameFileName + ".txt").toAbsolutePath(); + Path path = Paths.get("./saves/" + world_name + "/" + GlobalEnergyFolderName + "/" + + GlobalEnergyNameFileName + ".txt") + .toAbsolutePath(); Files.write(path, lines); } catch (IOException e) { @@ -90,12 +90,13 @@ public interface IGlobalWirelessEnergy { default void saveGlobalEnergyTeam(String world_name) { try { - List<String> lines = GlobalEnergyTeam.entrySet() - .stream() - .map(entry -> entry.getKey() + ":" + entry.getValue()) - .collect(Collectors.toList()); + List<String> lines = GlobalEnergyTeam.entrySet().stream() + .map(entry -> entry.getKey() + ":" + entry.getValue()) + .collect(Collectors.toList()); - Path path = Paths.get("./saves/" + world_name + "/" + GlobalEnergyFolderName + "/" + GlobalEnergyTeamFileName + ".txt").toAbsolutePath(); + Path path = Paths.get("./saves/" + world_name + "/" + GlobalEnergyFolderName + "/" + + GlobalEnergyTeamFileName + ".txt") + .toAbsolutePath(); Files.write(path, lines); } catch (IOException e) { @@ -107,7 +108,7 @@ public interface IGlobalWirelessEnergy { default void loadGlobalEnergyInfo(World world) { // Replace chars because of bug in forge that doesn't understand MC converts . to _ upon world creation. - String world_name = world.getWorldInfo().getWorldName().replace('.','_'); + String world_name = world.getWorldInfo().getWorldName().replace('.', '_'); PrivateGlobalEnergy.WorldName = world_name; createStorageIfNotExist(world_name); loadGlobalEnergyMap(world); @@ -117,10 +118,12 @@ public interface IGlobalWirelessEnergy { default void loadGlobalEnergyMap(World world) { try { - Path path = Paths.get("./saves/" + world.getWorldInfo().getWorldName() + "/" + GlobalEnergyFolderName + "/" + GlobalEnergyMapFileName + ".txt").toAbsolutePath(); + Path path = Paths.get("./saves/" + world.getWorldInfo().getWorldName() + "/" + GlobalEnergyFolderName + "/" + + GlobalEnergyMapFileName + ".txt") + .toAbsolutePath(); String[] data; - for(String line : Files.readAllLines(path)) { + for (String line : Files.readAllLines(path)) { data = line.split(":"); String UUID = data[0]; @@ -135,11 +138,12 @@ public interface IGlobalWirelessEnergy { default void loadGlobalEnergyName(World world) { try { - Path path = Paths.get("./saves/" + world.getWorldInfo().getWorldName() + "/" - + GlobalEnergyFolderName + "/" + GlobalEnergyNameFileName + ".txt").toAbsolutePath(); + Path path = Paths.get("./saves/" + world.getWorldInfo().getWorldName() + "/" + GlobalEnergyFolderName + "/" + + GlobalEnergyNameFileName + ".txt") + .toAbsolutePath(); String[] data; - for(String line : Files.readAllLines(path)) { + for (String line : Files.readAllLines(path)) { data = line.split(":"); GlobalEnergyName.put(data[0], data[1]); @@ -151,11 +155,12 @@ public interface IGlobalWirelessEnergy { default void loadGlobalEnergyTeam(World world) { try { - Path path = Paths.get("./saves/" + world.getWorldInfo().getWorldName() + "/" - + GlobalEnergyFolderName + "/" + GlobalEnergyTeamFileName + ".txt").toAbsolutePath(); + Path path = Paths.get("./saves/" + world.getWorldInfo().getWorldName() + "/" + GlobalEnergyFolderName + "/" + + GlobalEnergyTeamFileName + ".txt") + .toAbsolutePath(); String[] data; - for(String line : Files.readAllLines(path)) { + for (String line : Files.readAllLines(path)) { data = line.split(":"); GlobalEnergyName.put(data[0], data[1]); @@ -168,7 +173,8 @@ public interface IGlobalWirelessEnergy { // ------------------ default void createStorageIfNotExist(String world_name) { - Path folder_path = Paths.get("./saves/" + world_name + "/" + GlobalEnergyFolderName).toAbsolutePath(); + Path folder_path = Paths.get("./saves/" + world_name + "/" + GlobalEnergyFolderName) + .toAbsolutePath(); // Create folder for storing global energy network info. try { @@ -188,7 +194,6 @@ public interface IGlobalWirelessEnergy { } catch (IOException e) { e.printStackTrace(); } - } // Adds a user to the energy map if they do not already exist. Otherwise, do nothing. Will also check if the user @@ -299,7 +304,6 @@ public interface IGlobalWirelessEnergy { GlobalEnergyName.clear(); GlobalEnergyTeam.clear(); } - } class PrivateGlobalEnergy { diff --git a/src/main/java/gregtech/api/interfaces/IGuiIcon.java b/src/main/java/gregtech/api/interfaces/IGuiIcon.java index 2167270e6c..3204c35b4e 100644 --- a/src/main/java/gregtech/api/interfaces/IGuiIcon.java +++ b/src/main/java/gregtech/api/interfaces/IGuiIcon.java @@ -5,9 +5,14 @@ package gregtech.api.interfaces; */ public interface IGuiIcon { int getX(); + int getY(); + int getWidth(); + int getHeight(); + int getTexId(); + IGuiIcon getOverlay(); } diff --git a/src/main/java/gregtech/api/interfaces/IGuiScreen.java b/src/main/java/gregtech/api/interfaces/IGuiScreen.java index 5f1ae9cd2b..2f12781a77 100644 --- a/src/main/java/gregtech/api/interfaces/IGuiScreen.java +++ b/src/main/java/gregtech/api/interfaces/IGuiScreen.java @@ -5,12 +5,13 @@ import net.minecraft.client.gui.FontRenderer; import net.minecraft.client.gui.GuiButton; import net.minecraft.client.renderer.entity.RenderItem; - public interface IGuiScreen { interface IGuiElement { void onInit(); + default void onRemoved() {} + void draw(int mouseX, int mouseY, float parTicks); } @@ -19,18 +20,24 @@ public interface IGuiScreen { boolean removeToolTip(GT_GuiTooltip toolTip); GuiButton getSelectedButton(); + void clearSelectedButton(); + void buttonClicked(GuiButton button); int getGuiLeft(); + int getGuiTop(); int getXSize(); + int getYSize(); void addElement(IGuiElement element); + boolean removeElement(IGuiElement element); RenderItem getItemRenderer(); + FontRenderer getFontRenderer(); } diff --git a/src/main/java/gregtech/api/interfaces/IHatchElement.java b/src/main/java/gregtech/api/interfaces/IHatchElement.java index 22dbbdf013..e1f68963e0 100644 --- a/src/main/java/gregtech/api/interfaces/IHatchElement.java +++ b/src/main/java/gregtech/api/interfaces/IHatchElement.java @@ -6,7 +6,6 @@ import gregtech.api.interfaces.metatileentity.IMetaTileEntity; import gregtech.api.interfaces.tileentity.IGregTechTileEntity; import gregtech.api.util.GT_StructureUtility; import gregtech.api.util.IGT_HatchAdder; - import java.util.Arrays; import java.util.Collections; import java.util.List; @@ -56,22 +55,23 @@ 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(); + .anyOf(this) + .casingIndex(aCasingIndex) + .dot(aDot) + .continueIfSuccess() + .build(); } - default <T2 extends T> IStructureElement<T2> newAny(int aCasingIndex, int aDot, BiPredicate<? super T2, ? super IGregTechTileEntity> aShouldSkip) { + 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(); + .anyOf(this) + .casingIndex(aCasingIndex) + .dot(aDot) + .shouldSkip(aShouldSkip) + .continueIfSuccess() + .build(); } default <T2 extends T> IHatchElement<T2> or(IHatchElement<? super T2> fallback) { @@ -93,9 +93,9 @@ class HatchElementEither<T> implements IHatchElement<T> { 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; } @@ -106,8 +106,7 @@ class HatchElementEither<T> implements IHatchElement<T> { @Override public String name() { - if (name == null) - name = first.name() + " or " + second.name(); + if (name == null) name = first.name() + " or " + second.name(); return name; } @@ -124,7 +123,12 @@ class HatchElement<T> implements IHatchElement<T> { private final IHatchElement<? super T> mBacking; private final ToLongFunction<? super T> mCount; - public HatchElement(List<Class<? extends IMetaTileEntity>> aMteClasses, IGT_HatchAdder<? super T> aAdder, String aName, ToLongFunction<? super T> aCount, IHatchElement<? super T> aBacking) { + public HatchElement( + List<Class<? extends IMetaTileEntity>> aMteClasses, + IGT_HatchAdder<? super T> aAdder, + String aName, + ToLongFunction<? super T> aCount, + IHatchElement<? super T> aBacking) { this.mClasses = aMteClasses; this.mAdder = aAdder; this.mName = aName; diff --git a/src/main/java/gregtech/api/interfaces/IHeatingCoil.java b/src/main/java/gregtech/api/interfaces/IHeatingCoil.java index c8ceccf941..f30145165b 100644 --- a/src/main/java/gregtech/api/interfaces/IHeatingCoil.java +++ b/src/main/java/gregtech/api/interfaces/IHeatingCoil.java @@ -1,18 +1,18 @@ package gregtech.api.interfaces; import gregtech.api.enums.HeatingCoilLevel; -import net.minecraft.item.ItemStack; - import java.util.function.Consumer; +import net.minecraft.item.ItemStack; public interface IHeatingCoil { HeatingCoilLevel getCoilHeat(int meta); + default HeatingCoilLevel getCoilHeat(ItemStack stack) { return getCoilHeat(stack.getItemDamage()); } void setOnCoilCheck(Consumer<IHeatingCoil> callback); + Consumer<IHeatingCoil> getOnCoilCheck(); } - diff --git a/src/main/java/gregtech/api/interfaces/IIconContainer.java b/src/main/java/gregtech/api/interfaces/IIconContainer.java index 4682955603..8090ce7cb9 100644 --- a/src/main/java/gregtech/api/interfaces/IIconContainer.java +++ b/src/main/java/gregtech/api/interfaces/IIconContainer.java @@ -1,12 +1,12 @@ package gregtech.api.interfaces; +import static gregtech.api.enums.GT_Values.UNCOLORED_RBGA; + import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; import net.minecraft.util.IIcon; import net.minecraft.util.ResourceLocation; -import static gregtech.api.enums.GT_Values.UNCOLORED_RBGA; - public interface IIconContainer { /** * @return A regular Icon. @@ -26,7 +26,8 @@ public interface IIconContainer { @SideOnly(Side.CLIENT) default int getIconPasses() { return 1; - }; + } + ; /** * @return the Default Texture File for this Icon. @@ -35,13 +36,12 @@ public interface IIconContainer { ResourceLocation getTextureFile(); @SideOnly(Side.CLIENT) - default public short[] getIconColor(int aRenderPass) { + public default short[] getIconColor(int aRenderPass) { return UNCOLORED_RBGA; } @SideOnly(Side.CLIENT) - default public boolean isUsingColorModulation(int aRenderPass) { + public default boolean isUsingColorModulation(int aRenderPass) { return aRenderPass == 0; } - } diff --git a/src/main/java/gregtech/api/interfaces/IItemBehaviour.java b/src/main/java/gregtech/api/interfaces/IItemBehaviour.java index 85916ae0d7..9a513c2af5 100644 --- a/src/main/java/gregtech/api/interfaces/IItemBehaviour.java +++ b/src/main/java/gregtech/api/interfaces/IItemBehaviour.java @@ -2,6 +2,7 @@ package gregtech.api.interfaces; import gregtech.api.enums.SubTag; import gregtech.api.items.GT_MetaBase_Item; +import java.util.List; import net.minecraft.dispenser.IBlockSource; import net.minecraft.entity.Entity; import net.minecraft.entity.EntityLivingBase; @@ -11,14 +12,34 @@ import net.minecraft.item.Item; import net.minecraft.item.ItemStack; import net.minecraft.world.World; -import java.util.List; - public interface IItemBehaviour<E extends Item> { boolean onLeftClickEntity(E aItem, ItemStack aStack, EntityPlayer aPlayer, Entity aEntity); - boolean onItemUse(E aItem, ItemStack aStack, EntityPlayer aPlayer, World aWorld, int aX, int aY, int aZ, int aSide, float hitX, float hitY, float hitZ); - - boolean onItemUseFirst(E aItem, ItemStack aStack, EntityPlayer aPlayer, World aWorld, int aX, int aY, int aZ, int aSide, float hitX, float hitY, float hitZ); + boolean onItemUse( + E aItem, + ItemStack aStack, + EntityPlayer aPlayer, + World aWorld, + int aX, + int aY, + int aZ, + int aSide, + float hitX, + float hitY, + float hitZ); + + boolean onItemUseFirst( + E aItem, + ItemStack aStack, + EntityPlayer aPlayer, + World aWorld, + int aX, + int aY, + int aZ, + int aSide, + float hitX, + float hitY, + float hitZ); ItemStack onItemRightClick(E aItem, ItemStack aStack, World aWorld, EntityPlayer aPlayer); @@ -34,7 +55,9 @@ public interface IItemBehaviour<E extends Item> { boolean hasProjectile(GT_MetaBase_Item aItem, SubTag aProjectileType, ItemStack aStack); - EntityArrow getProjectile(E aItem, SubTag aProjectileType, ItemStack aStack, World aWorld, double aX, double aY, double aZ); + EntityArrow getProjectile( + E aItem, SubTag aProjectileType, ItemStack aStack, World aWorld, double aX, double aY, double aZ); - EntityArrow getProjectile(E aItem, SubTag aProjectileType, ItemStack aStack, World aWorld, EntityLivingBase aEntity, float aSpeed); + EntityArrow getProjectile( + E aItem, SubTag aProjectileType, ItemStack aStack, World aWorld, EntityLivingBase aEntity, float aSpeed); } diff --git a/src/main/java/gregtech/api/interfaces/INetworkUpdatableItem.java b/src/main/java/gregtech/api/interfaces/INetworkUpdatableItem.java index 2e102e937c..de251017a1 100644 --- a/src/main/java/gregtech/api/interfaces/INetworkUpdatableItem.java +++ b/src/main/java/gregtech/api/interfaces/INetworkUpdatableItem.java @@ -11,13 +11,13 @@ import net.minecraft.nbt.NBTTagCompound; * Usual NBT tag size limit applies. */ public interface INetworkUpdatableItem { - /** - * Receive update from client. Runs on server thread. - * @param stack Stack being updated - * @param player player holding the stack - * @param tag received data - * @return true if this stack should be kept inside the player inventory. - * false if this stack should vanish (i.e. slot content set to null) - */ - boolean receive(ItemStack stack, EntityPlayerMP player, NBTTagCompound tag); + /** + * Receive update from client. Runs on server thread. + * @param stack Stack being updated + * @param player player holding the stack + * @param tag received data + * @return true if this stack should be kept inside the player inventory. + * false if this stack should vanish (i.e. slot content set to null) + */ + boolean receive(ItemStack stack, EntityPlayerMP player, NBTTagCompound tag); } diff --git a/src/main/java/gregtech/api/interfaces/IProjectileItem.java b/src/main/java/gregtech/api/interfaces/IProjectileItem.java index 913339ef05..9441e2991b 100644 --- a/src/main/java/gregtech/api/interfaces/IProjectileItem.java +++ b/src/main/java/gregtech/api/interfaces/IProjectileItem.java @@ -20,5 +20,6 @@ public interface IProjectileItem { /** * @return an Arrow Entity to be spawned. If null then this is not an Arrow. Note: Other Projectiles still extend EntityArrow */ - EntityArrow getProjectile(SubTag aProjectileType, ItemStack aStack, World aWorld, EntityLivingBase aEntity, float aSpeed); + EntityArrow getProjectile( + SubTag aProjectileType, ItemStack aStack, World aWorld, EntityLivingBase aEntity, float aSpeed); } diff --git a/src/main/java/gregtech/api/interfaces/ITexture.java b/src/main/java/gregtech/api/interfaces/ITexture.java index b05f31d14f..e2445a8204 100644 --- a/src/main/java/gregtech/api/interfaces/ITexture.java +++ b/src/main/java/gregtech/api/interfaces/ITexture.java @@ -18,7 +18,7 @@ public interface ITexture { void renderZNeg(RenderBlocks aRenderer, Block aBlock, int aX, int aY, int aZ); boolean isValidTexture(); - + /** * @return {@code true} if this texture is from the old package */ diff --git a/src/main/java/gregtech/api/interfaces/IToolStats.java b/src/main/java/gregtech/api/interfaces/IToolStats.java index a96e12c1ce..b2e170445c 100644 --- a/src/main/java/gregtech/api/interfaces/IToolStats.java +++ b/src/main/java/gregtech/api/interfaces/IToolStats.java @@ -1,6 +1,7 @@ package gregtech.api.interfaces; import gregtech.api.items.GT_MetaGenerated_Tool; +import java.util.List; import net.minecraft.block.Block; import net.minecraft.enchantment.Enchantment; import net.minecraft.entity.Entity; @@ -11,8 +12,6 @@ import net.minecraft.util.DamageSource; import net.minecraft.world.World; import net.minecraftforge.event.world.BlockEvent; -import java.util.List; - /** * The Stats for GT Tools. Not including any Material Modifiers. * <p/> @@ -138,7 +137,18 @@ public interface IToolStats { * * @return the Amount of modified Items. */ - int convertBlockDrops(List<ItemStack> aDrops, ItemStack aStack, EntityPlayer aPlayer, Block aBlock, int aX, int aY, int aZ, byte aMetaData, int aFortune, boolean aSilkTouch, BlockEvent.HarvestDropsEvent aEvent); + int convertBlockDrops( + List<ItemStack> aDrops, + ItemStack aStack, + EntityPlayer aPlayer, + Block aBlock, + int aX, + int aY, + int aZ, + byte aMetaData, + int aFortune, + boolean aSilkTouch, + BlockEvent.HarvestDropsEvent aEvent); /** * @return Returns a broken Version of the Item. @@ -159,5 +169,6 @@ public interface IToolStats { short[] getRGBa(boolean aIsToolHead, ItemStack aStack); - float getMiningSpeed(Block aBlock, byte aMetaData, float aDefault, EntityPlayer aPlayer, World worldObj, int aX, int aY, int aZ); + float getMiningSpeed( + Block aBlock, byte aMetaData, float aDefault, EntityPlayer aPlayer, World worldObj, int aX, int aY, int aZ); } diff --git a/src/main/java/gregtech/api/interfaces/internal/IGT_Mod.java b/src/main/java/gregtech/api/interfaces/internal/IGT_Mod.java index 22947b746d..19e7a56aad 100644 --- a/src/main/java/gregtech/api/interfaces/internal/IGT_Mod.java +++ b/src/main/java/gregtech/api/interfaces/internal/IGT_Mod.java @@ -30,7 +30,7 @@ public interface IGT_Mod { */ EntityPlayer getThePlayer(); - //---------- Internal Usage Only ---------- + // ---------- Internal Usage Only ---------- /** * works only ClientSide otherwise returns 0 diff --git a/src/main/java/gregtech/api/interfaces/internal/IGT_RecipeAdder.java b/src/main/java/gregtech/api/interfaces/internal/IGT_RecipeAdder.java index add54205ee..d29dc96316 100644 --- a/src/main/java/gregtech/api/interfaces/internal/IGT_RecipeAdder.java +++ b/src/main/java/gregtech/api/interfaces/internal/IGT_RecipeAdder.java @@ -10,7 +10,13 @@ public interface IGT_RecipeAdder { * Does not work anymore! */ @Deprecated - boolean addFusionReactorRecipe(ItemStack aInput1, ItemStack aInput2, ItemStack aOutput1, int aFusionDurationInTicks, int aFusionEnergyPerTick, int aEnergyNeededForStartingFusion); + boolean addFusionReactorRecipe( + ItemStack aInput1, + ItemStack aInput2, + ItemStack aOutput1, + int aFusionDurationInTicks, + int aFusionEnergyPerTick, + int aEnergyNeededForStartingFusion); /** * Adds a FusionreactorRecipe @@ -23,9 +29,14 @@ public interface IGT_RecipeAdder { * @param aEnergyNeededForStartingFusion = EU needed for heating the Reactor up (must be >= 0) * @return true if the Recipe got added, otherwise false. */ - @Deprecated - boolean addFusionReactorRecipe(FluidStack aInput1, FluidStack aInput2, FluidStack aOutput1, int aFusionDurationInTicks, int aFusionEnergyPerTick, int aEnergyNeededForStartingFusion); + boolean addFusionReactorRecipe( + FluidStack aInput1, + FluidStack aInput2, + FluidStack aOutput1, + int aFusionDurationInTicks, + int aFusionEnergyPerTick, + int aEnergyNeededForStartingFusion); /** * Adds a Fusion Reactor Recipe @@ -37,7 +48,12 @@ public interface IGT_RecipeAdder { * @param aEnergyNeededForStartingFusion : EU needed to initialize the fusion reaction. (must be >= 0). * @return true if the recipe got added, otherwise false. */ - boolean addFusionReactorRecipe(FluidStack[] FluidInputArray, FluidStack[] FluidOutputArray, int aFusionDurationInTicks, int aFusionEnergyPerTick, int aEnergyNeededForStartingFusion); + boolean addFusionReactorRecipe( + FluidStack[] FluidInputArray, + FluidStack[] FluidOutputArray, + int aFusionDurationInTicks, + int aFusionEnergyPerTick, + int aEnergyNeededForStartingFusion); /** * Adds a Centrifuge Recipe @@ -49,9 +65,28 @@ public interface IGT_RecipeAdder { * @param aOutput4 can be null * @param aDuration must be > 0 */ - boolean addCentrifugeRecipe(ItemStack aInput1, int aInput2, ItemStack aOutput1, ItemStack aOutput2, ItemStack aOutput3, ItemStack aOutput4, ItemStack aOutput5, ItemStack aOutput6, int aDuration); - - boolean addCentrifugeRecipe(ItemStack aInput1, int aInput2, ItemStack aOutput1, ItemStack aOutput2, ItemStack aOutput3, ItemStack aOutput4, ItemStack aOutput5, ItemStack aOutput6, int aDuration, int aEUt); + boolean addCentrifugeRecipe( + ItemStack aInput1, + int aInput2, + ItemStack aOutput1, + ItemStack aOutput2, + ItemStack aOutput3, + ItemStack aOutput4, + ItemStack aOutput5, + ItemStack aOutput6, + int aDuration); + + boolean addCentrifugeRecipe( + ItemStack aInput1, + int aInput2, + ItemStack aOutput1, + ItemStack aOutput2, + ItemStack aOutput3, + ItemStack aOutput4, + ItemStack aOutput5, + ItemStack aOutput6, + int aDuration, + int aEUt); /** * Adds a Centrifuge Recipe @@ -63,9 +98,36 @@ public interface IGT_RecipeAdder { * @param aOutput4 can be null * @param aDuration must be > 0 */ - boolean addCentrifugeRecipe(ItemStack aInput1, ItemStack aInput2, FluidStack aFluidInput, FluidStack aFluidOutput, ItemStack aOutput1, ItemStack aOutput2, ItemStack aOutput3, ItemStack aOutput4, ItemStack aOutput5, ItemStack aOutput6, int[] aChances, int aDuration, int aEUt); - - boolean addCentrifugeRecipe(ItemStack aInput1, ItemStack aInput2, FluidStack aFluidInput, FluidStack aFluidOutput, ItemStack aOutput1, ItemStack aOutput2, ItemStack aOutput3, ItemStack aOutput4, ItemStack aOutput5, ItemStack aOutput6, int[] aChances, int aDuration, int aEUt, boolean aCleanroom); + boolean addCentrifugeRecipe( + ItemStack aInput1, + ItemStack aInput2, + FluidStack aFluidInput, + FluidStack aFluidOutput, + ItemStack aOutput1, + ItemStack aOutput2, + ItemStack aOutput3, + ItemStack aOutput4, + ItemStack aOutput5, + ItemStack aOutput6, + int[] aChances, + int aDuration, + int aEUt); + + boolean addCentrifugeRecipe( + ItemStack aInput1, + ItemStack aInput2, + FluidStack aFluidInput, + FluidStack aFluidOutput, + ItemStack aOutput1, + ItemStack aOutput2, + ItemStack aOutput3, + ItemStack aOutput4, + ItemStack aOutput5, + ItemStack aOutput6, + int[] aChances, + int aDuration, + int aEUt, + boolean aCleanroom); /** * @param aInput1 must be != null @@ -86,7 +148,17 @@ public interface IGT_RecipeAdder { * @param aDuration must be > 0 * @param aEUt should be > 0 */ - boolean addElectrolyzerRecipe(ItemStack aInput1, int aInput2, ItemStack aOutput1, ItemStack aOutput2, ItemStack aOutput3, ItemStack aOutput4, ItemStack aOutput5, ItemStack aOutput6, int aDuration, int aEUt); + boolean addElectrolyzerRecipe( + ItemStack aInput1, + int aInput2, + ItemStack aOutput1, + ItemStack aOutput2, + ItemStack aOutput3, + ItemStack aOutput4, + ItemStack aOutput5, + ItemStack aOutput6, + int aDuration, + int aEUt); /** * Adds a Electrolyzer Recipe @@ -99,7 +171,20 @@ public interface IGT_RecipeAdder { * @param aDuration must be > 0 * @param aEUt should be > 0 */ - boolean addElectrolyzerRecipe(ItemStack aInput1, ItemStack aInput2, FluidStack aFluidInput, FluidStack aFluidOutput, ItemStack aOutput1, ItemStack aOutput2, ItemStack aOutput3, ItemStack aOutput4, ItemStack aOutput5, ItemStack aOutput6, int[] aChances, int aDuration, int aEUt); + boolean addElectrolyzerRecipe( + ItemStack aInput1, + ItemStack aInput2, + FluidStack aFluidInput, + FluidStack aFluidOutput, + ItemStack aOutput1, + ItemStack aOutput2, + ItemStack aOutput3, + ItemStack aOutput4, + ItemStack aOutput5, + ItemStack aOutput6, + int[] aChances, + int aDuration, + int aEUt); /** * Adds a Chemical Recipe @@ -121,7 +206,13 @@ public interface IGT_RecipeAdder { * @param aOutput must be != null * @param aDuration must be > 0 */ - boolean addChemicalRecipe(ItemStack aInput1, ItemStack aInput2, FluidStack aFluidInput, FluidStack aFluidOutput, ItemStack aOutput, int aDuration); + boolean addChemicalRecipe( + ItemStack aInput1, + ItemStack aInput2, + FluidStack aFluidInput, + FluidStack aFluidOutput, + ItemStack aOutput, + int aDuration); /** * Adds a Chemical Recipe @@ -133,8 +224,15 @@ public interface IGT_RecipeAdder { * @param aOutput2 must be != null * @param aDuration must be > 0 */ - boolean addChemicalRecipeForBasicMachineOnly(ItemStack aInput1, ItemStack aInput2, FluidStack aFluidInput, FluidStack aFluidOutput, ItemStack aOutput, ItemStack aOutput2, int aDuration, int aEUtick); - + boolean addChemicalRecipeForBasicMachineOnly( + ItemStack aInput1, + ItemStack aInput2, + FluidStack aFluidInput, + FluidStack aFluidOutput, + ItemStack aOutput, + ItemStack aOutput2, + int aDuration, + int aEUtick); /** * Adds a Chemical Recipe @@ -145,7 +243,14 @@ public interface IGT_RecipeAdder { * @param aOutput2 must be != null * @param aDuration must be > 0 */ - boolean addChemicalRecipe(ItemStack aInput1, ItemStack aInput2, FluidStack aFluidInput, FluidStack aFluidOutput, ItemStack aOutput, ItemStack aOutput2, int aDuration); + boolean addChemicalRecipe( + ItemStack aInput1, + ItemStack aInput2, + FluidStack aFluidInput, + FluidStack aFluidOutput, + ItemStack aOutput, + ItemStack aOutput2, + int aDuration); /** * Adds Recipes for creating a radically polymerized polymer from a base Material (for example Ethylene -> Polyethylene) @@ -165,9 +270,25 @@ public interface IGT_RecipeAdder { * @param aDuration must be > 0 * @param aEUtick must be > 0 */ - boolean addChemicalRecipe(ItemStack aInput1, ItemStack aInput2, FluidStack aFluidInput, FluidStack aFluidOutput, ItemStack aOutput, int aDuration, int aEUtick); - - boolean addChemicalRecipe(ItemStack aInput1, ItemStack aInput2, FluidStack aFluidInput, FluidStack aFluidOutput, ItemStack aOutput, ItemStack aOutput2, int aDuration, int aEUtick, boolean aCleanroom); + boolean addChemicalRecipe( + ItemStack aInput1, + ItemStack aInput2, + FluidStack aFluidInput, + FluidStack aFluidOutput, + ItemStack aOutput, + int aDuration, + int aEUtick); + + boolean addChemicalRecipe( + ItemStack aInput1, + ItemStack aInput2, + FluidStack aFluidInput, + FluidStack aFluidOutput, + ItemStack aOutput, + ItemStack aOutput2, + int aDuration, + int aEUtick, + boolean aCleanroom); /** * Adds a Chemical Recipe @@ -179,7 +300,15 @@ public interface IGT_RecipeAdder { * @param aDuration must be > 0 * @param aEUtick must be > 0 */ - boolean addChemicalRecipe(ItemStack aInput1, ItemStack aInput2, FluidStack aFluidInput, FluidStack aFluidOutput, ItemStack aOutput, ItemStack aOutput2, int aDuration, int aEUtick); + boolean addChemicalRecipe( + ItemStack aInput1, + ItemStack aInput2, + FluidStack aFluidInput, + FluidStack aFluidOutput, + ItemStack aOutput, + ItemStack aOutput2, + int aDuration, + int aEUtick); /** * Adds a Chemical Recipe that only exists in the Large Chemical Reactor @@ -194,9 +323,13 @@ public interface IGT_RecipeAdder { * <br>aOutputs and aFluidOutputs must contain at least one valid output. * */ - - boolean addMultiblockChemicalRecipe(ItemStack[] aInputs, FluidStack[] aFluidInputs, FluidStack[] aFluidOutputs, ItemStack[] aOutputs, int aDuration, int aEUtick); - + boolean addMultiblockChemicalRecipe( + ItemStack[] aInputs, + FluidStack[] aFluidInputs, + FluidStack[] aFluidOutputs, + ItemStack[] aOutputs, + int aDuration, + int aEUtick); /** * Adds a Blast Furnace Recipe @@ -210,7 +343,14 @@ public interface IGT_RecipeAdder { * @param aLevel should be > 0 is the minimum Heat Level needed for this Recipe */ @Deprecated - boolean addBlastRecipe(ItemStack aInput1, ItemStack aInput2, ItemStack aOutput1, ItemStack aOutput2, int aDuration, int aEUt, int aLevel); + boolean addBlastRecipe( + ItemStack aInput1, + ItemStack aInput2, + ItemStack aOutput1, + ItemStack aOutput2, + int aDuration, + int aEUt, + int aLevel); /** * Adds a Blast Furnace Recipe @@ -223,9 +363,31 @@ public interface IGT_RecipeAdder { * @param aEUt should be > 0 * @param aLevel should be > 0 is the minimum Heat Level needed for this Recipe */ - boolean addBlastRecipe(ItemStack aInput1, ItemStack aInput2, FluidStack aFluidInput, FluidStack aFluidOutput, ItemStack aOutput1, ItemStack aOutput2, int aDuration, int aEUt, int aLevel); - - boolean addBlastRecipe(ItemStack aInput1, ItemStack aInput2, ItemStack aInput3, ItemStack aInput4, FluidStack aFluidInput, FluidStack aFluidOutput, ItemStack aOutput1, ItemStack aOutput2, ItemStack aOutput3, ItemStack aOutput4,int aDuration, int aEUt, int aLevel); + boolean addBlastRecipe( + ItemStack aInput1, + ItemStack aInput2, + FluidStack aFluidInput, + FluidStack aFluidOutput, + ItemStack aOutput1, + ItemStack aOutput2, + int aDuration, + int aEUt, + int aLevel); + + boolean addBlastRecipe( + ItemStack aInput1, + ItemStack aInput2, + ItemStack aInput3, + ItemStack aInput4, + FluidStack aFluidInput, + FluidStack aFluidOutput, + ItemStack aOutput1, + ItemStack aOutput2, + ItemStack aOutput3, + ItemStack aOutput4, + int aDuration, + int aEUt, + int aLevel); /** * Adds a Plasma Forge Recipe @@ -238,10 +400,22 @@ public interface IGT_RecipeAdder { * @param aEUt Should be > 0. EU/t. * @param coil_heat_level Should be > 0. Heat of the coils used. */ - boolean addPlasmaForgeRecipe(ItemStack[] ItemInputArray, FluidStack[] FluidInputArray, ItemStack[] OutputItemArray, FluidStack[] FluidOutputArray, int aDuration, int aEUt, int coil_heat_level); - - boolean addPrimitiveBlastRecipe(ItemStack aInput1, ItemStack aInput2, int aCoalAmount, ItemStack aOutput1, ItemStack aOutput2, int aDuration); + boolean addPlasmaForgeRecipe( + ItemStack[] ItemInputArray, + FluidStack[] FluidInputArray, + ItemStack[] OutputItemArray, + FluidStack[] FluidOutputArray, + int aDuration, + int aEUt, + int coil_heat_level); + boolean addPrimitiveBlastRecipe( + ItemStack aInput1, + ItemStack aInput2, + int aCoalAmount, + ItemStack aOutput1, + ItemStack aOutput2, + int aDuration); /** * Adds a Canning Machine Recipe @@ -251,7 +425,8 @@ public interface IGT_RecipeAdder { * @param aDuration must be > 0, 100 ticks is standard. * @param aEUt should be > 0, 1 EU/t is standard. */ - boolean addCannerRecipe(ItemStack aInput1, ItemStack aInput2, ItemStack aOutput1, ItemStack aOutput2, int aDuration, int aEUt); + boolean addCannerRecipe( + ItemStack aInput1, ItemStack aInput2, ItemStack aOutput1, ItemStack aOutput2, int aDuration, int aEUt); /** * Adds an Alloy Smelter Recipe @@ -264,8 +439,8 @@ public interface IGT_RecipeAdder { */ boolean addAlloySmelterRecipe(ItemStack aInput1, ItemStack aInput2, ItemStack aOutput1, int aDuration, int aEUt); - boolean addAlloySmelterRecipe(ItemStack aInput1, ItemStack aInput2, ItemStack aOutput1, int aDuration, int aEUt, boolean hidden); - + boolean addAlloySmelterRecipe( + ItemStack aInput1, ItemStack aInput2, ItemStack aOutput1, int aDuration, int aEUt, boolean hidden); /** * Adds a CNC-Machine Recipe @@ -297,7 +472,8 @@ public interface IGT_RecipeAdder { * @param aEUt should be > 0 * */ - boolean addAssemblerRecipe(ItemStack[] aInputs, FluidStack aFluidInput, ItemStack aOutput1, int aDuration, int aEUt); + boolean addAssemblerRecipe( + ItemStack[] aInputs, FluidStack aFluidInput, ItemStack aOutput1, int aDuration, int aEUt); /** * Adds an Assembler Recipe @@ -307,16 +483,43 @@ public interface IGT_RecipeAdder { * @param aDuration must be > 0 * @param aEUt should be > 0 */ - boolean addAssemblerRecipe(ItemStack aInput1, ItemStack aInput2, FluidStack aFluidInput, ItemStack aOutput1, int aDuration, int aEUt); - - boolean addAssemblerRecipe(ItemStack aInput1, Object aOreDict, int aAmount, FluidStack aFluidInput, ItemStack aOutput1, int aDuration, int aEUt); - - boolean addAssemblerRecipe(ItemStack[] aInputs, Object aOreDict, int aAmount, FluidStack aFluidInput, ItemStack aOutput1, int aDuration, int aEUt); - - boolean addAssemblerRecipe(ItemStack aInput1, ItemStack aInput2, FluidStack aFluidInput, ItemStack aOutput1, int aDuration, int aEUt, boolean aCleanroom); - - boolean addAssemblerRecipe(ItemStack[] aInputs, FluidStack aFluidInput, ItemStack aOutput1, int aDuration, int aEUt, boolean aCleanroom); - + boolean addAssemblerRecipe( + ItemStack aInput1, ItemStack aInput2, FluidStack aFluidInput, ItemStack aOutput1, int aDuration, int aEUt); + + boolean addAssemblerRecipe( + ItemStack aInput1, + Object aOreDict, + int aAmount, + FluidStack aFluidInput, + ItemStack aOutput1, + int aDuration, + int aEUt); + + boolean addAssemblerRecipe( + ItemStack[] aInputs, + Object aOreDict, + int aAmount, + FluidStack aFluidInput, + ItemStack aOutput1, + int aDuration, + int aEUt); + + boolean addAssemblerRecipe( + ItemStack aInput1, + ItemStack aInput2, + FluidStack aFluidInput, + ItemStack aOutput1, + int aDuration, + int aEUt, + boolean aCleanroom); + + boolean addAssemblerRecipe( + ItemStack[] aInputs, + FluidStack aFluidInput, + ItemStack aOutput1, + int aDuration, + int aEUt, + boolean aCleanroom); /** * Adds an Circuit Assembler Recipe @@ -327,9 +530,16 @@ public interface IGT_RecipeAdder { * @param aDuration must be > 0 * @param aEUt should be > 0 */ - boolean addCircuitAssemblerRecipe(ItemStack[] aInputs, FluidStack aFluidInput, ItemStack aOutput, int aDuration, int aEUt); + boolean addCircuitAssemblerRecipe( + ItemStack[] aInputs, FluidStack aFluidInput, ItemStack aOutput, int aDuration, int aEUt); - boolean addCircuitAssemblerRecipe(ItemStack[] aInputs, FluidStack aFluidInput, ItemStack aOutput, int aDuration, int aEUt, boolean aCleanroom); + boolean addCircuitAssemblerRecipe( + ItemStack[] aInputs, + FluidStack aFluidInput, + ItemStack aOutput, + int aDuration, + int aEUt, + boolean aCleanroom); /** * Adds an Assemblyline Recipe @@ -340,7 +550,14 @@ public interface IGT_RecipeAdder { * @param aDuration must be > 0 * @param aEUt should be > 0 */ - boolean addAssemblylineRecipe(ItemStack aResearchItem, int aResearchTime, ItemStack[] aInputs, FluidStack[] aFluidInputs, ItemStack aOutput1, int aDuration, int aEUt); + boolean addAssemblylineRecipe( + ItemStack aResearchItem, + int aResearchTime, + ItemStack[] aInputs, + FluidStack[] aFluidInputs, + ItemStack aOutput1, + int aDuration, + int aEUt); /** * Adds a Assemblyline Recipe @@ -349,7 +566,14 @@ public interface IGT_RecipeAdder { * ItemStack[] for multiple equivalent items; * {OreDict, amount} for oredict. */ - boolean addAssemblylineRecipe(ItemStack aResearchItem, int aResearchTime, Object[] aInputs, FluidStack[] aFluidInputs, ItemStack aOutput1, int aDuration, int aEUt); + boolean addAssemblylineRecipe( + ItemStack aResearchItem, + int aResearchTime, + Object[] aInputs, + FluidStack[] aFluidInputs, + ItemStack aOutput1, + int aDuration, + int aEUt); /** * Adds a Forge Hammer Recipe @@ -423,9 +647,24 @@ public interface IGT_RecipeAdder { * @param aEUt should be > 0 * @return */ - boolean addOreWasherRecipe(ItemStack aInput, ItemStack aOutput1, ItemStack aOutput2, ItemStack aOutput3, FluidStack aFluidInput, int aDuration, int aEUt); - - boolean addOreWasherRecipe(ItemStack aInput, ItemStack aOutput1, ItemStack aOutput2, ItemStack aOutput3, FluidStack aFluidInput, int[] aChances, int aDuration, int aEUt); + boolean addOreWasherRecipe( + ItemStack aInput, + ItemStack aOutput1, + ItemStack aOutput2, + ItemStack aOutput3, + FluidStack aFluidInput, + int aDuration, + int aEUt); + + boolean addOreWasherRecipe( + ItemStack aInput, + ItemStack aOutput1, + ItemStack aOutput2, + ItemStack aOutput3, + FluidStack aFluidInput, + int[] aChances, + int aDuration, + int aEUt); /** * Adds an Implosion Compressor Recipe @@ -447,7 +686,13 @@ public interface IGT_RecipeAdder { * @param aOutput3 can be null * @param aOutput4 can be null */ - boolean addGrinderRecipe(ItemStack aInput1, ItemStack aInput2, ItemStack aOutput1, ItemStack aOutput2, ItemStack aOutput3, ItemStack aOutput4); + boolean addGrinderRecipe( + ItemStack aInput1, + ItemStack aInput2, + ItemStack aOutput1, + ItemStack aOutput2, + ItemStack aOutput3, + ItemStack aOutput4); /** * Adds a Distillation Tower Recipe @@ -456,20 +701,44 @@ public interface IGT_RecipeAdder { * @param aOutputs must be != null 1-5 Fluids * @param aOutput2 can be null */ - boolean addDistillationTowerRecipe(FluidStack aInput, FluidStack[] aOutputs, ItemStack aOutput2, int aDuration, int aEUt); - boolean addDistillationTowerRecipe(FluidStack aInput, ItemStack[] aCircuit, FluidStack[] aOutputs, ItemStack aOutput2, int aDuration, int aEUt); + boolean addDistillationTowerRecipe( + FluidStack aInput, FluidStack[] aOutputs, ItemStack aOutput2, int aDuration, int aEUt); - boolean addSimpleArcFurnaceRecipe(ItemStack aInput, FluidStack aFluidInput, ItemStack[] aOutputs, int[] aChances, int aDuration, int aEUt); + boolean addDistillationTowerRecipe( + FluidStack aInput, + ItemStack[] aCircuit, + FluidStack[] aOutputs, + ItemStack aOutput2, + int aDuration, + int aEUt); - boolean addPlasmaArcFurnaceRecipe(ItemStack aInput, FluidStack aFluidInput, ItemStack[] aOutputs, int[] aChances, int aDuration, int aEUt); + boolean addSimpleArcFurnaceRecipe( + ItemStack aInput, FluidStack aFluidInput, ItemStack[] aOutputs, int[] aChances, int aDuration, int aEUt); - boolean addPlasmaArcFurnaceRecipe(ItemStack aInput, FluidStack aFluidInput, ItemStack[] aOutputs, FluidStack aFluidPutput, int[] aChances, int aDuration, int aEUt); + boolean addPlasmaArcFurnaceRecipe( + ItemStack aInput, FluidStack aFluidInput, ItemStack[] aOutputs, int[] aChances, int aDuration, int aEUt); + boolean addPlasmaArcFurnaceRecipe( + ItemStack aInput, + FluidStack aFluidInput, + ItemStack[] aOutputs, + FluidStack aFluidPutput, + int[] aChances, + int aDuration, + int aEUt); /** * Adds a Distillation Tower Recipe */ - boolean addDistillationRecipe(ItemStack aInput1, int aInput2, ItemStack aOutput1, ItemStack aOutput2, ItemStack aOutput3, ItemStack aOutput4, int aDuration, int aEUt); + boolean addDistillationRecipe( + ItemStack aInput1, + int aInput2, + ItemStack aOutput1, + ItemStack aOutput2, + ItemStack aOutput3, + ItemStack aOutput4, + int aDuration, + int aEUt); /** * Adds a Lathe Machine Recipe @@ -479,18 +748,28 @@ public interface IGT_RecipeAdder { /** * Adds a Cutter Recipe */ - boolean addCutterRecipe(ItemStack aInput, FluidStack aLubricant, ItemStack aOutput1, ItemStack aOutput2, int aDuration, int aEUt); + boolean addCutterRecipe( + ItemStack aInput, FluidStack aLubricant, ItemStack aOutput1, ItemStack aOutput2, int aDuration, int aEUt); /** * Adds Cutter Recipes with default Lubricants */ boolean addCutterRecipe(ItemStack aInput, ItemStack aOutput1, ItemStack aOutput2, int aDuration, int aEUt); - boolean addCutterRecipe(ItemStack aInput, ItemStack aOutput1, ItemStack aOutput2, int aDuration, int aEUt, boolean aCleanroom); + boolean addCutterRecipe( + ItemStack aInput, ItemStack aOutput1, ItemStack aOutput2, int aDuration, int aEUt, boolean aCleanroom); - boolean addCutterRecipe(ItemStack aInput, ItemStack aCircuit, ItemStack aOutput1, ItemStack aOutput2, int aDuration, int aEUt); + boolean addCutterRecipe( + ItemStack aInput, ItemStack aCircuit, ItemStack aOutput1, ItemStack aOutput2, int aDuration, int aEUt); - boolean addCutterRecipe(ItemStack aInput, ItemStack aCircuit, ItemStack aOutput1, ItemStack aOutput2, int aDuration, int aEUt, boolean aCleanroom); + boolean addCutterRecipe( + ItemStack aInput, + ItemStack aCircuit, + ItemStack aOutput1, + ItemStack aOutput2, + int aDuration, + int aEUt, + boolean aCleanroom); boolean addCutterRecipe(ItemStack[] aInputs, ItemStack[] aOutputs, int aDuration, int aEUt, int aSpecial); @@ -508,14 +787,23 @@ public interface IGT_RecipeAdder { * @param aEUt should be > 0 * @return */ - boolean addThermalCentrifugeRecipe(ItemStack aInput, ItemStack aOutput1, ItemStack aOutput2, ItemStack aOutput3, int aDuration, int aEUt); + boolean addThermalCentrifugeRecipe( + ItemStack aInput, ItemStack aOutput1, ItemStack aOutput2, ItemStack aOutput3, int aDuration, int aEUt); - boolean addThermalCentrifugeRecipe(ItemStack aInput, ItemStack aOutput1, ItemStack aOutput2, ItemStack aOutput3, int[] aChances, int aDuration, int aEUt); + boolean addThermalCentrifugeRecipe( + ItemStack aInput, + ItemStack aOutput1, + ItemStack aOutput2, + ItemStack aOutput3, + int[] aChances, + int aDuration, + int aEUt); /** * Adds an Unboxing Recipe */ - boolean addUnboxingRecipe(ItemStack aFullBox, ItemStack aContainedItem, ItemStack aEmptyBox, int aDuration, int aEUt); + boolean addUnboxingRecipe( + ItemStack aFullBox, ItemStack aContainedItem, ItemStack aEmptyBox, int aDuration, int aEUt); /** * Adds a Vacuum Freezer Recipe @@ -530,7 +818,13 @@ public interface IGT_RecipeAdder { boolean addVacuumFreezerRecipe(FluidStack aInput1, FluidStack aOutput1, int aDuration, int aEUt); - boolean addVacuumFreezerRecipe(ItemStack[] aItemInput, FluidStack[] aFluidInput, ItemStack[] aItemOutput, FluidStack[] aFluidOutput, int aDuration, int aEUt); + boolean addVacuumFreezerRecipe( + ItemStack[] aItemInput, + FluidStack[] aFluidInput, + ItemStack[] aItemOutput, + FluidStack[] aFluidOutput, + int aDuration, + int aEUt); /** * Adds a Fuel for My Generators @@ -552,9 +846,11 @@ public interface IGT_RecipeAdder { */ boolean addBrewingRecipe(ItemStack aIngredient, Fluid aInput, Fluid aOutput, boolean aHidden); - boolean addBrewingRecipe(ItemStack aIngredient, Fluid aInput, Fluid aOutput, int aDuration, int aEUt, boolean aHidden); + boolean addBrewingRecipe( + ItemStack aIngredient, Fluid aInput, Fluid aOutput, int aDuration, int aEUt, boolean aHidden); - boolean addBrewingRecipeCustom(ItemStack aIngredient, FluidStack aInput, FluidStack aOutput, int aDuration, int aEUt, boolean aHidden); + boolean addBrewingRecipeCustom( + ItemStack aIngredient, FluidStack aInput, FluidStack aOutput, int aDuration, int aEUt, boolean aHidden); /** * Adds a Recipe for the Fermenter @@ -571,14 +867,29 @@ public interface IGT_RecipeAdder { /** * Adds a Recipe for the Distillery */ + boolean addDistilleryRecipe( + ItemStack aCircuit, + FluidStack aInput, + FluidStack aOutput, + ItemStack aSolidOutput, + int aDuration, + int aEUt, + boolean aHidden); - boolean addDistilleryRecipe(ItemStack aCircuit, FluidStack aInput, FluidStack aOutput, ItemStack aSolidOutput, int aDuration, int aEUt, boolean aHidden); + boolean addDistilleryRecipe( + ItemStack aCircuit, FluidStack aInput, FluidStack aOutput, int aDuration, int aEUt, boolean aHidden); - boolean addDistilleryRecipe(ItemStack aCircuit, FluidStack aInput, FluidStack aOutput, int aDuration, int aEUt, boolean aHidden); + boolean addDistilleryRecipe( + int circuitConfig, + FluidStack aInput, + FluidStack aOutput, + ItemStack aSolidOutput, + int aDuration, + int aEUt, + boolean aHidden); - boolean addDistilleryRecipe(int circuitConfig, FluidStack aInput, FluidStack aOutput, ItemStack aSolidOutput, int aDuration, int aEUt, boolean aHidden); - - boolean addDistilleryRecipe(int aCircuit, FluidStack aInput, FluidStack aOutput, int aDuration, int aEUt, boolean aHidden); + boolean addDistilleryRecipe( + int aCircuit, FluidStack aInput, FluidStack aOutput, int aDuration, int aEUt, boolean aHidden); /** * Adds a Recipe for the Fluid Solidifier @@ -588,36 +899,75 @@ public interface IGT_RecipeAdder { /** * Adds a Recipe for Fluid Smelting */ - boolean addFluidSmelterRecipe(ItemStack aInput, ItemStack aRemains, FluidStack aOutput, int aChance, int aDuration, int aEUt); + boolean addFluidSmelterRecipe( + ItemStack aInput, ItemStack aRemains, FluidStack aOutput, int aChance, int aDuration, int aEUt); /** * Adds a Recipe for Fluid Smelting */ - boolean addFluidSmelterRecipe(ItemStack aInput, ItemStack aRemains, FluidStack aOutput, int aChance, int aDuration, int aEUt, boolean hidden); + boolean addFluidSmelterRecipe( + ItemStack aInput, + ItemStack aRemains, + FluidStack aOutput, + int aChance, + int aDuration, + int aEUt, + boolean hidden); /** * Adds a Recipe for Fluid Extraction */ - boolean addFluidExtractionRecipe(ItemStack aInput, ItemStack aRemains, FluidStack aOutput, int aChance, int aDuration, int aEUt); + boolean addFluidExtractionRecipe( + ItemStack aInput, ItemStack aRemains, FluidStack aOutput, int aChance, int aDuration, int aEUt); /** * Adds a Recipe for the Fluid Canner */ boolean addFluidCannerRecipe(ItemStack aInput, ItemStack aOutput, FluidStack aFluidInput, FluidStack aFluidOutput); - boolean addFluidCannerRecipe(ItemStack aInput, ItemStack aOutput, FluidStack aFluidInput, FluidStack aFluidOutput, int aDuration, int aEUt); + boolean addFluidCannerRecipe( + ItemStack aInput, + ItemStack aOutput, + FluidStack aFluidInput, + FluidStack aFluidOutput, + int aDuration, + int aEUt); /** * Adds a Recipe for the Chemical Bath */ - boolean addChemicalBathRecipe(ItemStack aInput, FluidStack aBathingFluid, ItemStack aOutput1, ItemStack aOutput2, ItemStack aOutput3, int[] aChances, int aDuration, int aEUt); - - boolean addChemicalBathRecipe(ItemStack aInput, FluidStack aBathingFluid, FluidStack aFluidOutput, ItemStack aOutput1, ItemStack aOutput2, ItemStack aOutput3, int[] aChances, int aDuration, int aEUt); + boolean addChemicalBathRecipe( + ItemStack aInput, + FluidStack aBathingFluid, + ItemStack aOutput1, + ItemStack aOutput2, + ItemStack aOutput3, + int[] aChances, + int aDuration, + int aEUt); + + boolean addChemicalBathRecipe( + ItemStack aInput, + FluidStack aBathingFluid, + FluidStack aFluidOutput, + ItemStack aOutput1, + ItemStack aOutput2, + ItemStack aOutput3, + int[] aChances, + int aDuration, + int aEUt); /** * Adds a Recipe for the Electromagnetic Separator */ - boolean addElectromagneticSeparatorRecipe(ItemStack aInput, ItemStack aOutput1, ItemStack aOutput2, ItemStack aOutput3, int[] aChances, int aDuration, int aEUt); + boolean addElectromagneticSeparatorRecipe( + ItemStack aInput, + ItemStack aOutput1, + ItemStack aOutput2, + ItemStack aOutput3, + int[] aChances, + int aDuration, + int aEUt); /** * Adds a Recipe for the Extractor @@ -627,55 +977,168 @@ public interface IGT_RecipeAdder { /** * Adds a Recipe for the Printer */ - boolean addPrinterRecipe(ItemStack aInput, FluidStack aFluid, ItemStack aSpecialSlot, ItemStack aOutput, int aDuration, int aEUt); + boolean addPrinterRecipe( + ItemStack aInput, FluidStack aFluid, ItemStack aSpecialSlot, ItemStack aOutput, int aDuration, int aEUt); /** * Adds a Recipe for the Autoclave */ - boolean addAutoclaveRecipe(ItemStack aInput, FluidStack aFluid, ItemStack aOutput, int aChance, int aDuration, int aEUt); - - boolean addAutoclaveRecipe(ItemStack aInput, FluidStack aFluid, ItemStack aOutput, int aChance, int aDuration, int aEUt, boolean aCleanroom); - - boolean addAutoclaveRecipe(ItemStack aInput, ItemStack aCircuit, FluidStack aFluid, ItemStack aOutput, int aChance, int aDuration, int aEUt, boolean aCleanroom); - - boolean addAutoclaveRecipe(ItemStack aInput, ItemStack aCircuit, FluidStack aFluidIn, FluidStack aFluidOut, ItemStack aOutput, int aChance, int aDuration, int aEUt, boolean aCleanroom); - - boolean addAutoclaveSpaceRecipe(ItemStack aInput, FluidStack aFluid, ItemStack aOutput, int aChance, int aDuration, int aEUt, boolean aCleanroom); - - boolean addAutoclaveSpaceRecipe(ItemStack aInput, ItemStack aCircuit, FluidStack aFluid, ItemStack aOutput, int aChance, int aDuration, int aEUt, boolean aCleanroom); - - - boolean addAutoclave4Recipe(ItemStack aInput, ItemStack aCircuit, FluidStack aFluidIn, FluidStack aFluidOut, ItemStack[] aOutputs, int[] aChances, int aDuration, int aEUt, boolean aCleanroom); + boolean addAutoclaveRecipe( + ItemStack aInput, FluidStack aFluid, ItemStack aOutput, int aChance, int aDuration, int aEUt); + + boolean addAutoclaveRecipe( + ItemStack aInput, + FluidStack aFluid, + ItemStack aOutput, + int aChance, + int aDuration, + int aEUt, + boolean aCleanroom); + + boolean addAutoclaveRecipe( + ItemStack aInput, + ItemStack aCircuit, + FluidStack aFluid, + ItemStack aOutput, + int aChance, + int aDuration, + int aEUt, + boolean aCleanroom); + + boolean addAutoclaveRecipe( + ItemStack aInput, + ItemStack aCircuit, + FluidStack aFluidIn, + FluidStack aFluidOut, + ItemStack aOutput, + int aChance, + int aDuration, + int aEUt, + boolean aCleanroom); + + boolean addAutoclaveSpaceRecipe( + ItemStack aInput, + FluidStack aFluid, + ItemStack aOutput, + int aChance, + int aDuration, + int aEUt, + boolean aCleanroom); + + boolean addAutoclaveSpaceRecipe( + ItemStack aInput, + ItemStack aCircuit, + FluidStack aFluid, + ItemStack aOutput, + int aChance, + int aDuration, + int aEUt, + boolean aCleanroom); + + boolean addAutoclave4Recipe( + ItemStack aInput, + ItemStack aCircuit, + FluidStack aFluidIn, + FluidStack aFluidOut, + ItemStack[] aOutputs, + int[] aChances, + int aDuration, + int aEUt, + boolean aCleanroom); /** * Adds a Recipe for the Mixer */ @Deprecated - boolean addMixerRecipe(ItemStack aInput1, ItemStack aInput2, ItemStack aInput3, ItemStack aInput4, FluidStack aFluidInput, FluidStack aFluidOutput, ItemStack aOutput, int aDuration, int aEUt); + boolean addMixerRecipe( + ItemStack aInput1, + ItemStack aInput2, + ItemStack aInput3, + ItemStack aInput4, + FluidStack aFluidInput, + FluidStack aFluidOutput, + ItemStack aOutput, + int aDuration, + int aEUt); @Deprecated - boolean addMixerRecipe(ItemStack aInput1, ItemStack aInput2, ItemStack aInput3, ItemStack aInput4, ItemStack aInput5, ItemStack aInput6, FluidStack aFluidInput, FluidStack aFluidOutput, ItemStack aOutput, int aDuration, int aEUt); + boolean addMixerRecipe( + ItemStack aInput1, + ItemStack aInput2, + ItemStack aInput3, + ItemStack aInput4, + ItemStack aInput5, + ItemStack aInput6, + FluidStack aFluidInput, + FluidStack aFluidOutput, + ItemStack aOutput, + int aDuration, + int aEUt); @Deprecated - boolean addMixerRecipe(ItemStack aInput1, ItemStack aInput2, ItemStack aInput3, ItemStack aInput4, ItemStack aInput5, ItemStack aInput6, ItemStack aInput7, ItemStack aInput8, ItemStack aInput9, FluidStack aFluidInput, FluidStack aFluidOutput, ItemStack aOutput, int aDuration, int aEUt); + boolean addMixerRecipe( + ItemStack aInput1, + ItemStack aInput2, + ItemStack aInput3, + ItemStack aInput4, + ItemStack aInput5, + ItemStack aInput6, + ItemStack aInput7, + ItemStack aInput8, + ItemStack aInput9, + FluidStack aFluidInput, + FluidStack aFluidOutput, + ItemStack aOutput, + int aDuration, + int aEUt); @Deprecated - boolean addMixerRecipe(ItemStack aInput1, ItemStack aInput2, ItemStack aInput3, ItemStack aInput4, ItemStack aInput5, ItemStack aInput6, ItemStack aInput7, ItemStack aInput8, ItemStack aInput9, FluidStack aFluidInput, FluidStack aFluidOutput, ItemStack aOutput1, ItemStack aOutput2, ItemStack aOutput3, ItemStack aOutput4, int aDuration, int aEUt); + boolean addMixerRecipe( + ItemStack aInput1, + ItemStack aInput2, + ItemStack aInput3, + ItemStack aInput4, + ItemStack aInput5, + ItemStack aInput6, + ItemStack aInput7, + ItemStack aInput8, + ItemStack aInput9, + FluidStack aFluidInput, + FluidStack aFluidOutput, + ItemStack aOutput1, + ItemStack aOutput2, + ItemStack aOutput3, + ItemStack aOutput4, + int aDuration, + int aEUt); // Use me only from now on! - boolean addMixerRecipe(ItemStack[] ItemInputArray, FluidStack[] FluidInputArray, ItemStack[] ItemOutputArray, FluidStack[] FluidOutputArray, int aDuration, int aEUt); + boolean addMixerRecipe( + ItemStack[] ItemInputArray, + FluidStack[] FluidInputArray, + ItemStack[] ItemOutputArray, + FluidStack[] FluidOutputArray, + int aDuration, + int aEUt); /** * Adds a Recipe for the Laser Engraver. */ @Deprecated - boolean addLaserEngraverRecipe(ItemStack aItemToEngrave, ItemStack aLens, ItemStack aEngravedItem, int aDuration, int aEUt); + boolean addLaserEngraverRecipe( + ItemStack aItemToEngrave, ItemStack aLens, ItemStack aEngravedItem, int aDuration, int aEUt); /** * Adds a Recipe for the Laser Engraver. */ @Deprecated - boolean addLaserEngraverRecipe(ItemStack aItemToEngrave, ItemStack aLens, ItemStack aEngravedItem, int aDuration, int aEUt, boolean aCleanroom); + boolean addLaserEngraverRecipe( + ItemStack aItemToEngrave, + ItemStack aLens, + ItemStack aEngravedItem, + int aDuration, + int aEUt, + boolean aCleanroom); /** * Adds a Generalised Laser Engraver Recipe. @@ -688,12 +1151,20 @@ public interface IGT_RecipeAdder { * @param aEUt Should be > 0. EU/t. * @param aCleanroom Boolean for usage of cleanroom in recipe. */ - boolean addLaserEngraverRecipe(ItemStack[] ItemInputArray, FluidStack[] FluidInputArray, ItemStack[] OutputItemArray, FluidStack[] FluidOutputArray, int aDuration, int aEUt, boolean aCleanroom); + boolean addLaserEngraverRecipe( + ItemStack[] ItemInputArray, + FluidStack[] FluidInputArray, + ItemStack[] OutputItemArray, + FluidStack[] FluidOutputArray, + int aDuration, + int aEUt, + boolean aCleanroom); /** * Adds a Recipe for the Forming Press */ - boolean addFormingPressRecipe(ItemStack aItemToImprint, ItemStack aForm, ItemStack aImprintedItem, int aDuration, int aEUt); + boolean addFormingPressRecipe( + ItemStack aItemToImprint, ItemStack aForm, ItemStack aImprintedItem, int aDuration, int aEUt); /** * Adds a Recipe for the Sifter. (up to 9 Outputs) @@ -708,8 +1179,8 @@ public interface IGT_RecipeAdder { /** * Adds a Recipe for the Arc Furnace. (up to 4 Outputs) */ - boolean addArcFurnaceRecipe(ItemStack aInput, ItemStack[] aOutputs, int[] aChances, int aDuration, int aEUt, boolean hidden); - + boolean addArcFurnaceRecipe( + ItemStack aInput, ItemStack[] aOutputs, int[] aChances, int aDuration, int aEUt, boolean hidden); /** * Adds a Recipe for the GT Pulveriser. (up to 4 Outputs) @@ -719,7 +1190,8 @@ public interface IGT_RecipeAdder { /** * Adds a Recipe for the GT Pulveriser. (up to 4 Outputs) */ - boolean addPulveriserRecipe(ItemStack aInput, ItemStack[] aOutputs, int[] aChances, int aDuration, int aEUt, boolean hidden); + boolean addPulveriserRecipe( + ItemStack aInput, ItemStack[] aOutputs, int[] aChances, int aDuration, int aEUt, boolean hidden); /** * Adds a Distillation Tower Recipe @@ -729,9 +1201,16 @@ public interface IGT_RecipeAdder { * @param aOutputs must be != null 1-5 Fluids * @param aOutput2 can be null */ - boolean addUniversalDistillationRecipe(FluidStack aInput, FluidStack[] aOutputs, ItemStack aOutput2, int aDuration, int aEUt); + boolean addUniversalDistillationRecipe( + FluidStack aInput, FluidStack[] aOutputs, ItemStack aOutput2, int aDuration, int aEUt); - boolean addUniversalDistillationRecipewithCircuit(FluidStack aInput, ItemStack[] aCircuit, FluidStack[] aOutputs, ItemStack aOutput2, int aDuration, int aEUt); + boolean addUniversalDistillationRecipewithCircuit( + FluidStack aInput, + ItemStack[] aCircuit, + FluidStack[] aOutputs, + ItemStack aOutput2, + int aDuration, + int aEUt); /** * Adds Pyrolyse Recipe @@ -743,7 +1222,14 @@ public interface IGT_RecipeAdder { * @param aDuration * @param aEUt */ - boolean addPyrolyseRecipe(ItemStack aInput, FluidStack aFluidInput, int intCircuit, ItemStack aOutput, FluidStack aFluidOutput, int aDuration, int aEUt); + boolean addPyrolyseRecipe( + ItemStack aInput, + FluidStack aFluidInput, + int intCircuit, + ItemStack aOutput, + FluidStack aFluidOutput, + int aDuration, + int aEUt); /** * Adds Oil Cracking Recipe @@ -753,7 +1239,6 @@ public interface IGT_RecipeAdder { * @param aDuration * @param aEUt */ - @Deprecated boolean addCrackingRecipe(FluidStack aInput, FluidStack aOutput, int aDuration, int aEUt); @@ -767,8 +1252,8 @@ public interface IGT_RecipeAdder { * @param aDuration * @param aEUt */ - - boolean addCrackingRecipe(int circuitConfig, FluidStack aInput, FluidStack aInput2, FluidStack aOutput, int aDuration, int aEUt); + boolean addCrackingRecipe( + int circuitConfig, FluidStack aInput, FluidStack aInput2, FluidStack aOutput, int aDuration, int aEUt); /** * Adds a Sound to the Sonictron9001 @@ -780,5 +1265,14 @@ public interface IGT_RecipeAdder { */ boolean addSonictronSound(ItemStack aItemStack, String aSoundName); - boolean addChemicalBathRecipe(ItemStack aInput, FluidStack aBathingFluid, ItemStack aOutput1, ItemStack aOutput2, ItemStack aOutput3, FluidStack aFluidOutput, int[] aChances, int aDuration, int aEUt); + boolean addChemicalBathRecipe( + ItemStack aInput, + FluidStack aBathingFluid, + ItemStack aOutput1, + ItemStack aOutput2, + ItemStack aOutput3, + FluidStack aFluidOutput, + int[] aChances, + int aDuration, + int aEUt); } diff --git a/src/main/java/gregtech/api/interfaces/internal/IThaumcraftCompat.java b/src/main/java/gregtech/api/interfaces/internal/IThaumcraftCompat.java index 34de41f381..330b9326c2 100644 --- a/src/main/java/gregtech/api/interfaces/internal/IThaumcraftCompat.java +++ b/src/main/java/gregtech/api/interfaces/internal/IThaumcraftCompat.java @@ -2,14 +2,12 @@ package gregtech.api.interfaces.internal; import gregtech.api.enums.TC_Aspects; import gregtech.api.enums.TC_Aspects.TC_AspectStack; +import java.util.List; import net.minecraft.block.Block; import net.minecraft.item.ItemStack; -import java.util.List; - public interface IThaumcraftCompat { - int - RESEARCH_TYPE_NORMAL = 0, + int RESEARCH_TYPE_NORMAL = 0, RESEARCH_TYPE_SECONDARY = 1, RESEARCH_TYPE_FREE = 2, RESEARCH_TYPE_HIDDEN = 4, @@ -21,8 +19,7 @@ public interface IThaumcraftCompat { /** * The Research Keys of GT */ - String - IRON_TO_STEEL = "GT_IRON_TO_STEEL", + String IRON_TO_STEEL = "GT_IRON_TO_STEEL", FILL_WATER_BUCKET = "GT_FILL_WATER_BUCKET", WOOD_TO_CHARCOAL = "GT_WOOD_TO_CHARCOAL", TRANSZINC = "GT_TRANSZINC", @@ -50,7 +47,26 @@ public interface IThaumcraftCompat { Object addCrucibleRecipe(String aResearch, Object aInput, ItemStack aOutput, List<TC_AspectStack> aAspects); - Object addInfusionRecipe(String aResearch, ItemStack aMainInput, ItemStack[] aSideInputs, ItemStack aOutput, int aInstability, List<TC_Aspects.TC_AspectStack> aAspects); + Object addInfusionRecipe( + String aResearch, + ItemStack aMainInput, + ItemStack[] aSideInputs, + ItemStack aOutput, + int aInstability, + List<TC_Aspects.TC_AspectStack> aAspects); - Object addResearch(String aResearch, String aName, String aText, String[] aParentResearches, String aCategory, ItemStack aIcon, int aComplexity, int aType, int aX, int aY, List<TC_AspectStack> aAspects, ItemStack[] aResearchTriggers, Object[] aPages); + Object addResearch( + String aResearch, + String aName, + String aText, + String[] aParentResearches, + String aCategory, + ItemStack aIcon, + int aComplexity, + int aType, + int aX, + int aY, + List<TC_AspectStack> aAspects, + ItemStack[] aResearchTriggers, + Object[] aPages); } diff --git a/src/main/java/gregtech/api/interfaces/internal/IUETileEntity.java b/src/main/java/gregtech/api/interfaces/internal/IUETileEntity.java index b62740f610..821aa35f50 100644 --- a/src/main/java/gregtech/api/interfaces/internal/IUETileEntity.java +++ b/src/main/java/gregtech/api/interfaces/internal/IUETileEntity.java @@ -1,6 +1,5 @@ package gregtech.api.interfaces.internal; - public interface IUETileEntity /*extends IElectrical*/ { // } diff --git a/src/main/java/gregtech/api/interfaces/metatileentity/IConfigurationCircuitSupport.java b/src/main/java/gregtech/api/interfaces/metatileentity/IConfigurationCircuitSupport.java index 7d6923e93f..59a70b450d 100644 --- a/src/main/java/gregtech/api/interfaces/metatileentity/IConfigurationCircuitSupport.java +++ b/src/main/java/gregtech/api/interfaces/metatileentity/IConfigurationCircuitSupport.java @@ -1,11 +1,9 @@ package gregtech.api.interfaces.metatileentity; +import gregtech.api.GregTech_API; import java.util.List; - import net.minecraft.item.ItemStack; -import gregtech.api.GregTech_API; - /** * Implement this interface if your metatileentity supports configuration circuits * to resolve recipe conflicts. @@ -23,7 +21,7 @@ public interface IConfigurationCircuitSupport { * This list is unmodifiable. Its elements are not supposed to be modified in any way! */ default List<ItemStack> getConfigurationCircuits() { - return GregTech_API.getConfigurationCircuitList(100); + return GregTech_API.getConfigurationCircuitList(100); } /** @@ -41,5 +39,6 @@ public interface IConfigurationCircuitSupport { } int getCircuitSlotX(); + int getCircuitSlotY(); } diff --git a/src/main/java/gregtech/api/interfaces/metatileentity/IConnectable.java b/src/main/java/gregtech/api/interfaces/metatileentity/IConnectable.java index cffcb4c4ab..84c991ade9 100644 --- a/src/main/java/gregtech/api/interfaces/metatileentity/IConnectable.java +++ b/src/main/java/gregtech/api/interfaces/metatileentity/IConnectable.java @@ -4,17 +4,17 @@ package gregtech.api.interfaces.metatileentity; * For pipes, wires, and other MetaTiles which need to be decided whether they should connect to the block at each side. */ public interface IConnectable { - int NO_CONNECTION = 0b00000000; - int CONNECTED_DOWN = 0b00000001; - int CONNECTED_UP = 0b00000010; - int CONNECTED_NORTH = 0b00000100; - int CONNECTED_SOUTH = 0b00001000; - int CONNECTED_WEST = 0b00010000; - int CONNECTED_EAST = 0b00100000; - int CONNECTED_ALL = 0b00111111; - int HAS_FRESHFOAM = 0b01000000; + int NO_CONNECTION = 0b00000000; + int CONNECTED_DOWN = 0b00000001; + int CONNECTED_UP = 0b00000010; + int CONNECTED_NORTH = 0b00000100; + int CONNECTED_SOUTH = 0b00001000; + int CONNECTED_WEST = 0b00010000; + int CONNECTED_EAST = 0b00100000; + int CONNECTED_ALL = 0b00111111; + int HAS_FRESHFOAM = 0b01000000; int HAS_HARDENEDFOAM = 0b10000000; - int HAS_FOAM = 0b11000000; + int HAS_FOAM = 0b11000000; /** * Try to connect to the Block at the specified side diff --git a/src/main/java/gregtech/api/interfaces/metatileentity/IMachineCallback.java b/src/main/java/gregtech/api/interfaces/metatileentity/IMachineCallback.java index e9ca4125a2..a1c00ebc97 100644 --- a/src/main/java/gregtech/api/interfaces/metatileentity/IMachineCallback.java +++ b/src/main/java/gregtech/api/interfaces/metatileentity/IMachineCallback.java @@ -2,6 +2,8 @@ package gregtech.api.interfaces.metatileentity; public interface IMachineCallback<Machinetype extends IMetaTileEntity> { Machinetype getCallbackBase(); + void setCallbackBase(Machinetype callback); + Class<?> getType(); } diff --git a/src/main/java/gregtech/api/interfaces/metatileentity/IMetaTileEntity.java b/src/main/java/gregtech/api/interfaces/metatileentity/IMetaTileEntity.java index 65848fe96f..c9d23e1f71 100644 --- a/src/main/java/gregtech/api/interfaces/metatileentity/IMetaTileEntity.java +++ b/src/main/java/gregtech/api/interfaces/metatileentity/IMetaTileEntity.java @@ -9,6 +9,9 @@ import gregtech.api.interfaces.tileentity.IGregtechWailaProvider; import gregtech.api.interfaces.tileentity.IMachineBlockUpdateable; import gregtech.api.objects.GT_ItemStack; import gregtech.api.util.GT_Config; +import java.io.File; +import java.util.ArrayList; +import java.util.List; import net.minecraft.block.Block; import net.minecraft.client.renderer.RenderBlocks; import net.minecraft.client.renderer.texture.IIconRegister; @@ -24,16 +27,18 @@ import net.minecraft.world.World; import net.minecraftforge.fluids.IFluidHandler; import net.minecraftforge.fluids.IFluidTank; -import java.io.File; -import java.util.ArrayList; -import java.util.List; - /** * Warning, this Interface has just been made to be able to add multiple kinds of MetaTileEntities (Cables, Pipes, Transformers, but not the regular Blocks) * <p/> * Don't implement this yourself and expect it to work. Extend @MetaTileEntity itself. */ -public interface IMetaTileEntity extends ISidedInventory, IFluidTank, IFluidHandler, IGearEnergyTileEntity, IMachineBlockUpdateable, IGregtechWailaProvider { +public interface IMetaTileEntity + extends ISidedInventory, + IFluidTank, + IFluidHandler, + IGearEnergyTileEntity, + IMachineBlockUpdateable, + IGregtechWailaProvider { /** * This determines the BaseMetaTileEntity belonging to this MetaTileEntity by using the Meta ID of the Block itself. * <p/> @@ -143,7 +148,8 @@ public interface IMetaTileEntity extends ISidedInventory, IFluidTank, IFluidHand /** * When a Player rightclicks the Facing with a soldering iron. */ - boolean onSolderingToolRightClick(byte aSide, byte aWrenchingSide, EntityPlayer aPlayer, float aX, float aY, float aZ); + boolean onSolderingToolRightClick( + byte aSide, byte aWrenchingSide, EntityPlayer aPlayer, float aX, float aY, float aZ); /** * Called right before this Machine explodes @@ -241,7 +247,8 @@ public interface IMetaTileEntity extends ISidedInventory, IFluidTank, IFluidHand * * @return */ - boolean onRightclick(IGregTechTileEntity aBaseMetaTileEntity, EntityPlayer aPlayer, byte aSide, float aX, float aY, float aZ); + boolean onRightclick( + IGregTechTileEntity aBaseMetaTileEntity, EntityPlayer aPlayer, byte aSide, float aX, float aY, float aZ); /** * a Player leftclicks the Machine @@ -317,7 +324,8 @@ public interface IMetaTileEntity extends ISidedInventory, IFluidTank, IFluidHand /** * returns the DebugLog */ - ArrayList<String> getSpecialDebugInfo(IGregTechTileEntity aBaseMetaTileEntity, EntityPlayer aPlayer, int aLogLevel, ArrayList<String> aList); + ArrayList<String> getSpecialDebugInfo( + IGregTechTileEntity aBaseMetaTileEntity, EntityPlayer aPlayer, int aLogLevel, ArrayList<String> aList); /** * get a small Description @@ -338,12 +346,18 @@ public interface IMetaTileEntity extends ISidedInventory, IFluidTank, IFluidHand * @param aActive if the Machine is currently active (use this instead of calling mBaseMetaTileEntity.mActive!!!). Note: In case of Pipes this means if this Side is connected to something or not. * @param aRedstone if the Machine is currently outputting a RedstoneSignal (use this instead of calling mBaseMetaTileEntity.mRedstone!!!) */ - ITexture[] getTexture(IGregTechTileEntity aBaseMetaTileEntity, byte aSide, byte aFacing, byte aColorIndex, boolean aActive, boolean aRedstone); + ITexture[] getTexture( + IGregTechTileEntity aBaseMetaTileEntity, + byte aSide, + byte aFacing, + byte aColorIndex, + boolean aActive, + boolean aRedstone); /** * The Textures used for the Item rendering. Return null if you want the regular 3D Block Rendering. */ - //public ITexture[] getItemTexture(ItemStack aStack); + // public ITexture[] getItemTexture(ItemStack aStack); /** * Register Icons here. This gets called when the Icons get initialized by the Base Block @@ -389,7 +403,14 @@ public interface IMetaTileEntity extends ISidedInventory, IFluidTank, IFluidHand boolean allowGeneralRedstoneOutput(); - void addCollisionBoxesToList(World aWorld, int aX, int aY, int aZ, AxisAlignedBB inputAABB, List<AxisAlignedBB> outputAABB, Entity collider); + void addCollisionBoxesToList( + World aWorld, + int aX, + int aY, + int aZ, + AxisAlignedBB inputAABB, + List<AxisAlignedBB> outputAABB, + Entity collider); AxisAlignedBB getCollisionBoundingBoxFromPool(World aWorld, int aX, int aY, int aZ); @@ -420,7 +441,7 @@ public interface IMetaTileEntity extends ISidedInventory, IFluidTank, IFluidHand * just return in should recurse since we are already in meta tile... */ @Override - default boolean isMachineBlockUpdateRecursive(){ + default boolean isMachineBlockUpdateRecursive() { return true; } @@ -433,5 +454,4 @@ public interface IMetaTileEntity extends ISidedInventory, IFluidTank, IFluidHand default void onRandomDisplayTick(IGregTechTileEntity aBaseMetaTileEntity) { /* do nothing */ } - } diff --git a/src/main/java/gregtech/api/interfaces/metatileentity/IMetaTileEntityCable.java b/src/main/java/gregtech/api/interfaces/metatileentity/IMetaTileEntityCable.java index 85237ac4f4..6b83ab4dba 100644 --- a/src/main/java/gregtech/api/interfaces/metatileentity/IMetaTileEntityCable.java +++ b/src/main/java/gregtech/api/interfaces/metatileentity/IMetaTileEntityCable.java @@ -1,13 +1,13 @@ package gregtech.api.interfaces.metatileentity; -import net.minecraft.tileentity.TileEntity; - import java.util.ArrayList; import java.util.HashSet; +import net.minecraft.tileentity.TileEntity; public interface IMetaTileEntityCable extends IMetaTileEntity { @Deprecated - long transferElectricity(byte aSide, long aVoltage, long aAmperage, ArrayList<TileEntity> aAlreadyPassedTileEntityList); + long transferElectricity( + byte aSide, long aVoltage, long aAmperage, ArrayList<TileEntity> aAlreadyPassedTileEntityList); default long transferElectricity(byte aSide, long aVoltage, long aAmperage, HashSet<TileEntity> aAlreadyPassedSet) { return transferElectricity(aSide, aVoltage, aAmperage, new ArrayList<>(aAlreadyPassedSet)); diff --git a/src/main/java/gregtech/api/interfaces/metatileentity/IMetaTileEntityItemPipe.java b/src/main/java/gregtech/api/interfaces/metatileentity/IMetaTileEntityItemPipe.java index 90933b501f..1b1ce36871 100644 --- a/src/main/java/gregtech/api/interfaces/metatileentity/IMetaTileEntityItemPipe.java +++ b/src/main/java/gregtech/api/interfaces/metatileentity/IMetaTileEntityItemPipe.java @@ -3,7 +3,6 @@ package gregtech.api.interfaces.metatileentity; import gregtech.api.interfaces.tileentity.IGregTechTileEntity; import gregtech.api.metatileentity.BaseMetaPipeEntity; import gregtech.api.util.GT_Utility; - import java.util.Map; public interface IMetaTileEntityItemPipe extends IMetaTileEntity { @@ -48,18 +47,30 @@ public interface IMetaTileEntityItemPipe extends IMetaTileEntity { /** * @return a List of connected Item Pipes */ - public static Map<IMetaTileEntityItemPipe, Long> scanPipes(IMetaTileEntityItemPipe aMetaTileEntity, Map<IMetaTileEntityItemPipe, Long> aMap, long aStep, boolean aSuckItems, boolean aIgnoreCapacity) { + public static Map<IMetaTileEntityItemPipe, Long> scanPipes( + IMetaTileEntityItemPipe aMetaTileEntity, + Map<IMetaTileEntityItemPipe, Long> aMap, + long aStep, + boolean aSuckItems, + boolean aIgnoreCapacity) { aStep += aMetaTileEntity.getStepSize(); if (aIgnoreCapacity || aMetaTileEntity.pipeCapacityCheck()) if (aMap.get(aMetaTileEntity) == null || aMap.get(aMetaTileEntity) > aStep) { IGregTechTileEntity aBaseMetaTileEntity = aMetaTileEntity.getBaseMetaTileEntity(); aMap.put(aMetaTileEntity, aStep); for (byte i = 0, j = 0; i < 6; i++) { - if (aMetaTileEntity instanceof IConnectable && !((IConnectable) aMetaTileEntity).isConnectedAtSide(i)) - continue; + if (aMetaTileEntity instanceof IConnectable + && !((IConnectable) aMetaTileEntity).isConnectedAtSide(i)) continue; j = GT_Utility.getOppositeSide(i); if (aSuckItems) { - if (aBaseMetaTileEntity.getCoverBehaviorAtSideNew(i).letsItemsIn(i, aBaseMetaTileEntity.getCoverIDAtSide(i), aBaseMetaTileEntity.getComplexCoverDataAtSide(i), -2, aBaseMetaTileEntity)) { + if (aBaseMetaTileEntity + .getCoverBehaviorAtSideNew(i) + .letsItemsIn( + i, + aBaseMetaTileEntity.getCoverIDAtSide(i), + aBaseMetaTileEntity.getComplexCoverDataAtSide(i), + -2, + aBaseMetaTileEntity)) { IGregTechTileEntity tItemPipe = aBaseMetaTileEntity.getIGregTechTileEntityAtSide(i); if (aBaseMetaTileEntity.getColorization() >= 0) { byte tColor = tItemPipe.getColorization(); @@ -69,13 +80,33 @@ public interface IMetaTileEntityItemPipe extends IMetaTileEntity { } if (tItemPipe instanceof BaseMetaPipeEntity) { IMetaTileEntity tMetaTileEntity = tItemPipe.getMetaTileEntity(); - if (tMetaTileEntity instanceof IMetaTileEntityItemPipe && tItemPipe.getCoverBehaviorAtSideNew(j).letsItemsOut(j, tItemPipe.getCoverIDAtSide(j), tItemPipe.getComplexCoverDataAtSide(j), -2, tItemPipe)) { - scanPipes((IMetaTileEntityItemPipe) tMetaTileEntity, aMap, aStep, aSuckItems, aIgnoreCapacity); + if (tMetaTileEntity instanceof IMetaTileEntityItemPipe + && tItemPipe + .getCoverBehaviorAtSideNew(j) + .letsItemsOut( + j, + tItemPipe.getCoverIDAtSide(j), + tItemPipe.getComplexCoverDataAtSide(j), + -2, + tItemPipe)) { + scanPipes( + (IMetaTileEntityItemPipe) tMetaTileEntity, + aMap, + aStep, + aSuckItems, + aIgnoreCapacity); } } } } else { - if (aBaseMetaTileEntity.getCoverBehaviorAtSideNew(i).letsItemsOut(i, aBaseMetaTileEntity.getCoverIDAtSide(i), aBaseMetaTileEntity.getComplexCoverDataAtSide(i), -2, aBaseMetaTileEntity)) { + if (aBaseMetaTileEntity + .getCoverBehaviorAtSideNew(i) + .letsItemsOut( + i, + aBaseMetaTileEntity.getCoverIDAtSide(i), + aBaseMetaTileEntity.getComplexCoverDataAtSide(i), + -2, + aBaseMetaTileEntity)) { IGregTechTileEntity tItemPipe = aBaseMetaTileEntity.getIGregTechTileEntityAtSide(i); if (tItemPipe != null) { if (aBaseMetaTileEntity.getColorization() >= 0) { @@ -86,8 +117,21 @@ public interface IMetaTileEntityItemPipe extends IMetaTileEntity { } if (tItemPipe instanceof BaseMetaPipeEntity) { IMetaTileEntity tMetaTileEntity = tItemPipe.getMetaTileEntity(); - if (tMetaTileEntity instanceof IMetaTileEntityItemPipe && tItemPipe.getCoverBehaviorAtSideNew(j).letsItemsIn(j, tItemPipe.getCoverIDAtSide(j), tItemPipe.getComplexCoverDataAtSide(j), -2, tItemPipe)) { - scanPipes((IMetaTileEntityItemPipe) tMetaTileEntity, aMap, aStep, aSuckItems, aIgnoreCapacity); + if (tMetaTileEntity instanceof IMetaTileEntityItemPipe + && tItemPipe + .getCoverBehaviorAtSideNew(j) + .letsItemsIn( + j, + tItemPipe.getCoverIDAtSide(j), + tItemPipe.getComplexCoverDataAtSide(j), + -2, + tItemPipe)) { + scanPipes( + (IMetaTileEntityItemPipe) tMetaTileEntity, + aMap, + aStep, + aSuckItems, + aIgnoreCapacity); } } } diff --git a/src/main/java/gregtech/api/interfaces/tileentity/IBasicEnergyContainer.java b/src/main/java/gregtech/api/interfaces/tileentity/IBasicEnergyContainer.java index ca3db3354e..7b0bc9c690 100644 --- a/src/main/java/gregtech/api/interfaces/tileentity/IBasicEnergyContainer.java +++ b/src/main/java/gregtech/api/interfaces/tileentity/IBasicEnergyContainer.java @@ -80,12 +80,16 @@ public interface IBasicEnergyContainer extends IEnergyConnected { /** * returns the amount of Steam contained in this Block, in EU units! */ - default long getStoredSteam() { return 0; } + default long getStoredSteam() { + return 0; + } /** * returns the amount of Steam containable in this Block, in EU units! */ - default long getSteamCapacity() { return 0; } + default long getSteamCapacity() { + return 0; + } /** * Increases stored Energy. Energy Base Value is in EU, even though it's Steam! @@ -96,5 +100,7 @@ public interface IBasicEnergyContainer extends IEnergyConnected { * <p/> * And yes, you can't directly decrease the Steam of a Machine. That is done by decreaseStoredEnergyUnits */ - default boolean increaseStoredSteam(long aEnergy, boolean aIgnoreTooMuchEnergy) { return false; } + default boolean increaseStoredSteam(long aEnergy, boolean aIgnoreTooMuchEnergy) { + return false; + } } diff --git a/src/main/java/gregtech/api/interfaces/tileentity/ICoverable.java b/src/main/java/gregtech/api/interfaces/tileentity/ICoverable.java index e496479bed..6beb34a305 100644 --- a/src/main/java/gregtech/api/interfaces/tileentity/ICoverable.java +++ b/src/main/java/gregtech/api/interfaces/tileentity/ICoverable.java @@ -22,8 +22,11 @@ public interface ICoverable extends IRedstoneTileEntity, IHasInventory, IBasicEn } void setCoverIdAndDataAtSide(byte aSide, int aId, ISerializableObject aData); + void setCoverIDAtSide(byte aSide, int aID); + boolean setCoverIDAtSideNoUpdate(byte aSide, int aID); + void setCoverItemAtSide(byte aSide, ItemStack aCover); @Deprecated @@ -71,7 +74,8 @@ public interface ICoverable extends IRedstoneTileEntity, IHasInventory, IBasicEn * Receiving a packet with cover data. * @param aPlayer the player who made the change */ - default void receiveCoverData(byte aCoverSide, int aCoverID, ISerializableObject aCoverData, EntityPlayerMP aPlayer) { + default void receiveCoverData( + byte aCoverSide, int aCoverID, ISerializableObject aCoverData, EntityPlayerMP aPlayer) { if (aCoverData instanceof ISerializableObject.LegacyCoverData) receiveCoverData(aCoverSide, aCoverID, ((ISerializableObject.LegacyCoverData) aCoverData).get()); } diff --git a/src/main/java/gregtech/api/interfaces/tileentity/IDebugableTileEntity.java b/src/main/java/gregtech/api/interfaces/tileentity/IDebugableTileEntity.java index 0063eb57c6..4e3b03d970 100644 --- a/src/main/java/gregtech/api/interfaces/tileentity/IDebugableTileEntity.java +++ b/src/main/java/gregtech/api/interfaces/tileentity/IDebugableTileEntity.java @@ -1,8 +1,7 @@ package gregtech.api.interfaces.tileentity; -import net.minecraft.entity.player.EntityPlayer; - import java.util.ArrayList; +import net.minecraft.entity.player.EntityPlayer; public interface IDebugableTileEntity { /** diff --git a/src/main/java/gregtech/api/interfaces/tileentity/IEnergyConnected.java b/src/main/java/gregtech/api/interfaces/tileentity/IEnergyConnected.java index 702f19a89d..c1ecc2b153 100644 --- a/src/main/java/gregtech/api/interfaces/tileentity/IEnergyConnected.java +++ b/src/main/java/gregtech/api/interfaces/tileentity/IEnergyConnected.java @@ -63,15 +63,21 @@ public interface IEnergyConnected extends IColoredTileEntity, IHasWorldObjectAnd 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))) { - while (aAmperage > rUsedAmperes && ((IEnergySink) tTileEntity).getDemandedEnergy() > 0 && ((IEnergySink) tTileEntity).injectEnergy(ForgeDirection.getOrientation(j), aVoltage, aVoltage) < aVoltage) - rUsedAmperes++; + 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) 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 2a8172a775..936de80b3e 100644 --- a/src/main/java/gregtech/api/interfaces/tileentity/IExperimentalEnergyTileEntity.java +++ b/src/main/java/gregtech/api/interfaces/tileentity/IExperimentalEnergyTileEntity.java @@ -50,12 +50,16 @@ public interface IExperimentalEnergyTileEntity extends IColoredTileEntity, IHasW Class tClass = cofh.api.energy.IEnergyReceiver.class; tClass.getCanonicalName(); RF_ENERGY = true; - } catch (Throwable e) {/**/} + } catch (Throwable e) { + /**/ + } try { Class tClass = ic2.api.energy.tile.IEnergySink.class; tClass.getCanonicalName(); IC_ENERGY = true; - } catch (Throwable e) {/**/} + } catch (Throwable e) { + /**/ + } CHECK_ALL = false; } } @@ -65,7 +69,8 @@ public interface IExperimentalEnergyTileEntity extends IColoredTileEntity, IHasW * * @return the amount of used secondary value. */ - public static final long emitEnergyToNetwork(SubTag aEnergyType, long aPrimary, long aSecondary, IExperimentalEnergyTileEntity aEmitter) { + public static final long emitEnergyToNetwork( + SubTag aEnergyType, long aPrimary, long aSecondary, IExperimentalEnergyTileEntity aEmitter) { long rUsedSecondary = 0; checkAvailabilities(); for (byte i = 0, j = 0; i < 6 && aSecondary > rUsedSecondary; i++) @@ -77,14 +82,25 @@ 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); - } else if (IC_ENERGY && aEnergyType == SubTag.ENERGY_ELECTRICITY && tTileEntity instanceof IEnergySink) { - 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) - 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))) { + while (aSecondary > rUsedSecondary + && ((IEnergySink) tTileEntity).getDemandedEnergy() > 0 + && ((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); + } 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); } } return rUsedSecondary; diff --git a/src/main/java/gregtech/api/interfaces/tileentity/IGTEnet.java b/src/main/java/gregtech/api/interfaces/tileentity/IGTEnet.java index cd4810eba6..77b894fea7 100644 --- a/src/main/java/gregtech/api/interfaces/tileentity/IGTEnet.java +++ b/src/main/java/gregtech/api/interfaces/tileentity/IGTEnet.java @@ -5,16 +5,15 @@ public interface IGTEnet { /** * @return true if this Device consumes Energy at all */ - default boolean isEnetInput() { - return false; + default boolean isEnetInput() { + return false; } - + /** - * + * * @return true if this Device emits Energy at all */ - default boolean isEnetOutput() { + default boolean isEnetOutput() { return false; } - } diff --git a/src/main/java/gregtech/api/interfaces/tileentity/IGregTechTileEntity.java b/src/main/java/gregtech/api/interfaces/tileentity/IGregTechTileEntity.java index 94b93434e2..253deae29b 100644 --- a/src/main/java/gregtech/api/interfaces/tileentity/IGregTechTileEntity.java +++ b/src/main/java/gregtech/api/interfaces/tileentity/IGregTechTileEntity.java @@ -5,6 +5,9 @@ import cpw.mods.fml.relauncher.SideOnly; import gregtech.api.interfaces.IDescribable; import gregtech.api.interfaces.metatileentity.IMetaTileEntity; import gregtech.common.blocks.GT_Block_Machines; +import java.util.ArrayList; +import java.util.List; +import java.util.UUID; import net.minecraft.entity.Entity; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.ItemStack; @@ -13,10 +16,6 @@ import net.minecraft.util.AxisAlignedBB; import net.minecraft.world.World; import net.minecraftforge.fluids.IFluidHandler; -import java.util.ArrayList; -import java.util.List; -import java.util.UUID; - /** * A simple compound Interface for all my TileEntities. * <p/> @@ -24,7 +23,18 @@ import java.util.UUID; * <p/> * It can cause Problems to include this Interface! */ -public interface IGregTechTileEntity extends ITexturedTileEntity, IGearEnergyTileEntity, ICoverable, IFluidHandler, ITurnable, IGregTechDeviceInformation, IUpgradableMachine, IDigitalChest, IDescribable, IMachineBlockUpdateable, IGregtechWailaProvider { +public interface IGregTechTileEntity + extends ITexturedTileEntity, + IGearEnergyTileEntity, + ICoverable, + IFluidHandler, + ITurnable, + IGregTechDeviceInformation, + IUpgradableMachine, + IDigitalChest, + IDescribable, + IMachineBlockUpdateable, + IGregtechWailaProvider { /** * gets the Error displayed on the GUI */ @@ -133,7 +143,14 @@ public interface IGregTechTileEntity extends ITexturedTileEntity, IGearEnergyTil */ int getLightOpacity(); - void addCollisionBoxesToList(World aWorld, int aX, int aY, int aZ, AxisAlignedBB inputAABB, List<AxisAlignedBB> outputAABB, Entity collider); + void addCollisionBoxesToList( + World aWorld, + int aX, + int aY, + int aZ, + AxisAlignedBB inputAABB, + List<AxisAlignedBB> outputAABB, + Entity collider); AxisAlignedBB getCollisionBoundingBoxFromPool(World aWorld, int aX, int aY, int aZ); @@ -143,8 +160,8 @@ public interface IGregTechTileEntity extends ITexturedTileEntity, IGearEnergyTil * Checks validity of meta tile and delegates to it */ @Override - default void onMachineBlockUpdate(){ - if(!isDead() && getMetaTileEntity() != null && getMetaTileEntity().getBaseMetaTileEntity() == this){ + default void onMachineBlockUpdate() { + if (!isDead() && getMetaTileEntity() != null && getMetaTileEntity().getBaseMetaTileEntity() == this) { getMetaTileEntity().onMachineBlockUpdate(); } } @@ -154,12 +171,15 @@ public interface IGregTechTileEntity extends ITexturedTileEntity, IGearEnergyTil */ @Override default boolean isMachineBlockUpdateRecursive() { - return !isDead() && getMetaTileEntity() != null && - getMetaTileEntity().getBaseMetaTileEntity() == this && - getMetaTileEntity().isMachineBlockUpdateRecursive(); + return !isDead() + && getMetaTileEntity() != null + && getMetaTileEntity().getBaseMetaTileEntity() == this + && getMetaTileEntity().isMachineBlockUpdateRecursive(); } - default void setShutdownStatus(boolean newStatus) {return;} + default void setShutdownStatus(boolean newStatus) { + return; + } /** * A randomly called display update to be able to add particles or other items for display diff --git a/src/main/java/gregtech/api/interfaces/tileentity/IGregtechWailaProvider.java b/src/main/java/gregtech/api/interfaces/tileentity/IGregtechWailaProvider.java index ee3da0fa6f..a463cc91df 100644 --- a/src/main/java/gregtech/api/interfaces/tileentity/IGregtechWailaProvider.java +++ b/src/main/java/gregtech/api/interfaces/tileentity/IGregtechWailaProvider.java @@ -1,5 +1,6 @@ package gregtech.api.interfaces.tileentity; +import java.util.List; import mcp.mobius.waila.api.IWailaConfigHandler; import mcp.mobius.waila.api.IWailaDataAccessor; import net.minecraft.entity.player.EntityPlayerMP; @@ -8,10 +9,16 @@ import net.minecraft.nbt.NBTTagCompound; import net.minecraft.tileentity.TileEntity; import net.minecraft.world.World; -import java.util.List; - public interface IGregtechWailaProvider { - default void getWailaBody(ItemStack itemStack, List<String> currenttip, IWailaDataAccessor accessor, IWailaConfigHandler config) {} + default void getWailaBody( + ItemStack itemStack, List<String> currenttip, IWailaDataAccessor accessor, IWailaConfigHandler config) {} - default void getWailaNBTData(final EntityPlayerMP player, final TileEntity tile, final NBTTagCompound tag, final World world, int x, int y, int z) {} + default void getWailaNBTData( + final EntityPlayerMP player, + final TileEntity tile, + final NBTTagCompound tag, + final World world, + int x, + int y, + int z) {} } diff --git a/src/main/java/gregtech/api/interfaces/tileentity/IIC2Enet.java b/src/main/java/gregtech/api/interfaces/tileentity/IIC2Enet.java index ee3516dfac..2593f1f3b5 100644 --- a/src/main/java/gregtech/api/interfaces/tileentity/IIC2Enet.java +++ b/src/main/java/gregtech/api/interfaces/tileentity/IIC2Enet.java @@ -13,5 +13,4 @@ public interface IIC2Enet { * Update the ic2 enet */ void doEnetUpdate(); - } diff --git a/src/main/java/gregtech/api/interfaces/tileentity/IMachineBlockUpdateable.java b/src/main/java/gregtech/api/interfaces/tileentity/IMachineBlockUpdateable.java index 31590f3d57..b8ce51a212 100644 --- a/src/main/java/gregtech/api/interfaces/tileentity/IMachineBlockUpdateable.java +++ b/src/main/java/gregtech/api/interfaces/tileentity/IMachineBlockUpdateable.java @@ -17,7 +17,7 @@ public interface IMachineBlockUpdateable { /** * Should recurse? */ - default boolean isMachineBlockUpdateRecursive(){ + default boolean isMachineBlockUpdateRecursive() { return true; } } diff --git a/src/main/java/gregtech/api/interfaces/tileentity/IMachineProgress.java b/src/main/java/gregtech/api/interfaces/tileentity/IMachineProgress.java index 0c342b8cfc..54fa90218a 100644 --- a/src/main/java/gregtech/api/interfaces/tileentity/IMachineProgress.java +++ b/src/main/java/gregtech/api/interfaces/tileentity/IMachineProgress.java @@ -49,7 +49,9 @@ public interface IMachineProgress extends IHasWorldObjectAndCoords { * used to control Machines via Redstone Signal Strength by special Covers * In case of 0 the Machine is very likely doing nothing, or is just not being controlled at all. */ - default byte getWorkDataValue() { return 0; } + default byte getWorkDataValue() { + return 0; + } /** * used to control Machines via Redstone Signal Strength by special Covers @@ -73,5 +75,4 @@ public interface IMachineProgress extends IHasWorldObjectAndCoords { default boolean wasShutdown() { return false; } - } diff --git a/src/main/java/gregtech/api/interfaces/tileentity/ITurnable.java b/src/main/java/gregtech/api/interfaces/tileentity/ITurnable.java index 8c8ce443b0..e05fd44637 100644 --- a/src/main/java/gregtech/api/interfaces/tileentity/ITurnable.java +++ b/src/main/java/gregtech/api/interfaces/tileentity/ITurnable.java @@ -1,6 +1,5 @@ package gregtech.api.interfaces.tileentity; - import static gregtech.api.enums.GT_Values.ALL_VALID_SIDES; /** @@ -38,7 +37,7 @@ public interface ITurnable { */ default boolean[] getValidFacings() { final boolean[] validFacings = new boolean[6]; - for(byte facing : ALL_VALID_SIDES) { + for (byte facing : ALL_VALID_SIDES) { validFacings[facing] = isValidFacing(facing); } return validFacings; diff --git a/src/main/java/gregtech/api/interfaces/tileentity/IUpgradableMachine.java b/src/main/java/gregtech/api/interfaces/tileentity/IUpgradableMachine.java index 0d027f6e30..cc59a4af34 100644 --- a/src/main/java/gregtech/api/interfaces/tileentity/IUpgradableMachine.java +++ b/src/main/java/gregtech/api/interfaces/tileentity/IUpgradableMachine.java @@ -1,6 +1,5 @@ package gregtech.api.interfaces.tileentity; - /** * To access my Machines a bit easier */ 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 2a20ac4972..d37f0479ef 100644 --- a/src/main/java/gregtech/api/items/GT_Block_LongDistancePipe.java +++ b/src/main/java/gregtech/api/items/GT_Block_LongDistancePipe.java @@ -9,6 +9,7 @@ import gregtech.api.interfaces.IIconContainer; import gregtech.api.util.GT_LanguageManager; import gregtech.common.blocks.GT_Item_LongDistancePipe; import gregtech.common.blocks.GT_Material_Machines; +import java.util.List; import net.minecraft.block.Block; import net.minecraft.client.renderer.texture.IIconRegister; import net.minecraft.creativetab.CreativeTabs; @@ -22,24 +23,26 @@ import net.minecraft.util.StatCollector; import net.minecraft.world.IBlockAccess; import net.minecraft.world.World; -import java.util.List; - public class GT_Block_LongDistancePipe extends GT_Generic_Block { public IIconContainer[] mIcons; + public GT_Block_LongDistancePipe() { super(GT_Item_LongDistancePipe.class, "gt.block.longdistancepipe", new GT_Material_Machines()); setStepSound(soundTypeMetal); setCreativeTab(GregTech_API.TAB_GREGTECH); GregTech_API.registerMachineBlock(this, -1); - GT_LanguageManager.addStringLocalization(getUnlocalizedName()+".0.name", "Long Distance Fluid Pipeline Pipe"); - GT_LanguageManager.addStringLocalization(getUnlocalizedName()+".1.name", "Long Distance Item Pipeline Pipe"); + GT_LanguageManager.addStringLocalization(getUnlocalizedName() + ".0.name", "Long Distance Fluid Pipeline Pipe"); + GT_LanguageManager.addStringLocalization(getUnlocalizedName() + ".1.name", "Long Distance Item Pipeline Pipe"); GT_LanguageManager.addStringLocalization(getUnlocalizedName() + "." + 32767 + ".name", "Any Sub Block of this"); ItemList.Long_Distance_Pipeline_Fluid_Pipe.set(new ItemStack(this, 1, 0)); ItemList.Long_Distance_Pipeline_Item_Pipe.set(new ItemStack(this, 1, 1)); - mIcons = new IIconContainer[]{Textures.BlockIcons.LONG_DISTANCE_PIPE_FLUID, Textures.BlockIcons.LONG_DISTANCE_PIPE_ITEM}; + mIcons = new IIconContainer[] { + Textures.BlockIcons.LONG_DISTANCE_PIPE_FLUID, Textures.BlockIcons.LONG_DISTANCE_PIPE_ITEM + }; } + @Override public void onBlockAdded(World aWorld, int aX, int aY, int aZ) { super.onBlockAdded(aWorld, aX, aY, aZ); @@ -47,11 +50,13 @@ public class GT_Block_LongDistancePipe extends GT_Generic_Block { GregTech_API.causeMachineUpdate(aWorld, aX, aY, aZ); } } + @Override public void breakBlock(World aWorld, int aX, int aY, int aZ, Block aBlock, int aMetaData) { GregTech_API.causeMachineUpdate(aWorld, aX, aY, aZ); super.breakBlock(aWorld, aX, aY, aZ, aBlock, aMetaData); } + @Override public String getHarvestTool(int aMeta) { return "wrench"; @@ -72,7 +77,6 @@ public class GT_Block_LongDistancePipe extends GT_Generic_Block { return Blocks.iron_block.getExplosionResistance(aTNT); } - @Override public String getUnlocalizedName() { return this.mUnlocalizedName; @@ -90,8 +94,7 @@ public class GT_Block_LongDistancePipe extends GT_Generic_Block { @Override @SideOnly(Side.CLIENT) - public void registerBlockIcons(IIconRegister aIconRegister) { - } + public void registerBlockIcons(IIconRegister aIconRegister) {} @Override public boolean canCreatureSpawn(EnumCreatureType type, IBlockAccess world, int x, int y, int z) { diff --git a/src/main/java/gregtech/api/items/GT_BreederCell_Item.java b/src/main/java/gregtech/api/items/GT_BreederCell_Item.java index bb65a9a057..c30987183b 100644 --- a/src/main/java/gregtech/api/items/GT_BreederCell_Item.java +++ b/src/main/java/gregtech/api/items/GT_BreederCell_Item.java @@ -5,6 +5,8 @@ import gregtech.api.util.GT_Utility; import ic2.api.reactor.IReactor; import ic2.api.reactor.IReactorComponent; import ic2.core.IC2Potion; +import java.util.List; +import java.util.function.Supplier; import net.minecraft.entity.Entity; import net.minecraft.entity.EntityLivingBase; import net.minecraft.entity.player.EntityPlayer; @@ -12,9 +14,6 @@ import net.minecraft.item.ItemStack; import net.minecraft.util.EnumChatFormatting; import net.minecraft.world.World; -import java.util.List; -import java.util.function.Supplier; - /** * A {@link ic2.core.item.reactor.ItemReactorLithiumCell}, but can be used to produce anything! * @@ -25,7 +24,14 @@ public class GT_BreederCell_Item extends GT_Generic_Item implements IReactorComp protected final int mHeatBonusMultiplier; protected ItemStack mProduct; - public GT_BreederCell_Item(String aUnlocalized, String aEnglish, String aEnglishTooltip, int aHeatBonusStep, int aHeatBonusMultiplier, int aRequiredPulse, Supplier<ItemStack> aProduct) { + public GT_BreederCell_Item( + String aUnlocalized, + String aEnglish, + String aEnglishTooltip, + int aHeatBonusStep, + int aHeatBonusMultiplier, + int aRequiredPulse, + Supplier<ItemStack> aProduct) { super(aUnlocalized, aEnglish, aEnglishTooltip); this.mHeatBonusStep = aHeatBonusStep; this.mHeatBonusMultiplier = aHeatBonusMultiplier; @@ -61,9 +67,11 @@ public class GT_BreederCell_Item extends GT_Generic_Item implements IReactorComp color2 = EnumChatFormatting.WHITE; break; } - aList.add(String.format(transItem("020", "Progress: %s/%s"), "" + color2 + aStack.getItemDamage() + EnumChatFormatting.RESET, "" + getMaxDamage())); - if (aStack.getItemDamage() > 0) - aList.add(EnumChatFormatting.RED + transItem("021", "Radiation Hazard")); + aList.add(String.format( + transItem("020", "Progress: %s/%s"), + "" + color2 + aStack.getItemDamage() + EnumChatFormatting.RESET, + "" + getMaxDamage())); + if (aStack.getItemDamage() > 0) aList.add(EnumChatFormatting.RED + transItem("021", "Radiation Hazard")); } @Override @@ -72,17 +80,22 @@ public class GT_BreederCell_Item extends GT_Generic_Item implements IReactorComp } @Override - public void processChamber(IReactor reactor, ItemStack yourStack, int x, int y, boolean heatrun) { - } + public void processChamber(IReactor reactor, ItemStack yourStack, int x, int y, boolean heatrun) {} @Override - public boolean acceptUraniumPulse(IReactor reactor, ItemStack yourStack, ItemStack pulsingStack, int youX, int youY, int pulseX, int pulseY, boolean heatrun) { + public boolean acceptUraniumPulse( + IReactor reactor, + ItemStack yourStack, + ItemStack pulsingStack, + int youX, + int youY, + int pulseX, + int pulseY, + boolean heatrun) { if (heatrun) { int myLevel = getNewDamage(reactor, yourStack); - if (myLevel >= getMaxDamage()) - reactor.setItemAt(youX, youY, mProduct.copy()); - else - yourStack.setItemDamage(myLevel); + if (myLevel >= getMaxDamage()) reactor.setItemAt(youX, youY, mProduct.copy()); + else yourStack.setItemDamage(myLevel); } return true; diff --git a/src/main/java/gregtech/api/items/GT_CoolantCellIC_Item.java b/src/main/java/gregtech/api/items/GT_CoolantCellIC_Item.java index 106897efd7..eb37b50ea6 100644 --- a/src/main/java/gregtech/api/items/GT_CoolantCellIC_Item.java +++ b/src/main/java/gregtech/api/items/GT_CoolantCellIC_Item.java @@ -1,23 +1,27 @@ package gregtech.api.items; - import ic2.api.reactor.IReactor; import ic2.api.reactor.IReactorComponent; import net.minecraft.item.ItemStack; -public class GT_CoolantCellIC_Item - extends GT_CoolantCell_Item - implements IReactorComponent { +public class GT_CoolantCellIC_Item extends GT_CoolantCell_Item implements IReactorComponent { public GT_CoolantCellIC_Item(String aUnlocalized, String aEnglish, int aMaxStore) { super(aUnlocalized, aEnglish, aMaxStore); } @Override - public void processChamber(IReactor aReactor, ItemStack aStack, int x, int y, boolean aHeatRun) { - } + public void processChamber(IReactor aReactor, ItemStack aStack, int x, int y, boolean aHeatRun) {} @Override - public boolean acceptUraniumPulse(IReactor aReactor, ItemStack aStack, ItemStack pulsingStack, int youX, int youY, int pulseX, int pulseY, boolean aHeatRun) { + public boolean acceptUraniumPulse( + IReactor aReactor, + ItemStack aStack, + ItemStack pulsingStack, + int youX, + int youY, + int pulseX, + int pulseY, + boolean aHeatRun) { return false; } diff --git a/src/main/java/gregtech/api/items/GT_CoolantCell_Item.java b/src/main/java/gregtech/api/items/GT_CoolantCell_Item.java index 12a075d181..116786532b 100644 --- a/src/main/java/gregtech/api/items/GT_CoolantCell_Item.java +++ b/src/main/java/gregtech/api/items/GT_CoolantCell_Item.java @@ -2,16 +2,14 @@ package gregtech.api.items; import gregtech.api.GregTech_API; import ic2.core.util.StackUtil; +import java.util.List; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.util.EnumChatFormatting; import net.minecraft.util.StatCollector; -import java.util.List; - -public class GT_CoolantCell_Item - extends GT_Generic_Item { +public class GT_CoolantCell_Item extends GT_Generic_Item { protected int heatStorage; public GT_CoolantCell_Item(String aUnlocalized, String aEnglish, int aMaxStore) { @@ -51,22 +49,33 @@ public class GT_CoolantCell_Item @Override public void addAdditionalToolTips(List aList, ItemStack aStack, EntityPlayer aPlayer) { - super.addAdditionalToolTips(aList, aStack, aPlayer); + super.addAdditionalToolTips(aList, aStack, aPlayer); int rHeat = getHeatOfStack(aStack) * 10 / this.heatStorage; EnumChatFormatting color; switch (rHeat) { - case 0: color = EnumChatFormatting.BLUE; break; - case 1: - case 2: color = EnumChatFormatting.GREEN; break; - case 3: - case 4: - case 5: - case 6: color = EnumChatFormatting.YELLOW; break; - case 7: - case 8: color = EnumChatFormatting.RED; break; - default: color = EnumChatFormatting.DARK_RED; break; + case 0: + color = EnumChatFormatting.BLUE; + break; + case 1: + case 2: + color = EnumChatFormatting.GREEN; + break; + case 3: + case 4: + case 5: + case 6: + color = EnumChatFormatting.YELLOW; + break; + case 7: + case 8: + color = EnumChatFormatting.RED; + break; + default: + color = EnumChatFormatting.DARK_RED; + break; } - aList.add(EnumChatFormatting.WHITE + String.format(transItem("000", "Stored Heat: %s"), "" + color + getHeatOfStack(aStack))); + aList.add(EnumChatFormatting.WHITE + + String.format(transItem("000", "Stored Heat: %s"), "" + color + getHeatOfStack(aStack))); switch (getControlTagOfStack(aStack)) { case 1: aList.add(StatCollector.translateToLocal("ic2.reactoritem.heatwarning.line1")); 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 904215b68a..7b4ac6afb8 100644 --- a/src/main/java/gregtech/api/items/GT_EnergyArmor_Item.java +++ b/src/main/java/gregtech/api/items/GT_EnergyArmor_Item.java @@ -1,11 +1,16 @@ package gregtech.api.items; +import static gregtech.api.enums.GT_Values.RES_PATH_ITEM; + import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; import gregtech.api.GregTech_API; import gregtech.api.util.GT_LanguageManager; import gregtech.api.util.GT_ModHandler; import gregtech.api.util.GT_Utility; +import java.util.List; +import java.util.Map; +import java.util.concurrent.ConcurrentHashMap; import net.minecraft.client.renderer.texture.IIconRegister; import net.minecraft.creativetab.CreativeTabs; import net.minecraft.entity.EntityLivingBase; @@ -23,19 +28,25 @@ import net.minecraftforge.common.ISpecialArmor; import net.minecraftforge.common.MinecraftForge; import net.minecraftforge.event.entity.living.LivingFallEvent; -import java.util.List; -import java.util.Map; -import java.util.concurrent.ConcurrentHashMap; - -import static gregtech.api.enums.GT_Values.RES_PATH_ITEM; - public class GT_EnergyArmor_Item extends ItemArmor implements ISpecialArmor { public static Map jumpChargeMap = new ConcurrentHashMap(); public int mCharge, mTransfer, mTier, mDamageEnergyCost, mSpecials; public boolean mChargeProvider; public double mArmorAbsorbtionPercentage; - public GT_EnergyArmor_Item(int aID, String aUnlocalized, String aEnglish, int aCharge, int aTransfer, int aTier, int aDamageEnergyCost, int aSpecials, double aArmorAbsorbtionPercentage, boolean aChargeProvider, int aType, int aArmorIndex) { + public GT_EnergyArmor_Item( + int aID, + String aUnlocalized, + String aEnglish, + int aCharge, + int aTransfer, + int aTier, + int aDamageEnergyCost, + int aSpecials, + double aArmorAbsorbtionPercentage, + boolean aChargeProvider, + int aType, + int aArmorIndex) { super(ArmorMaterial.DIAMOND, aArmorIndex, aType); setMaxStackSize(1); setMaxDamage(100); @@ -112,7 +123,8 @@ 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()) { + if (GT_ModHandler.canUseElectricItem(aStack, 50000) + && aPlayer.getFoodStats().needFood()) { aPlayer.getFoodStats().addStats(1, 0.0F); GT_ModHandler.useElectricItem(aStack, 50000, aPlayer); } @@ -134,7 +146,8 @@ public class GT_EnergyArmor_Item extends ItemArmor implements ISpecialArmor { } if (!aPlayer.worldObj.isRemote && (mSpecials & 128) != 0) { - float jumpCharge = jumpChargeMap.containsKey(aPlayer) ? ((Float) jumpChargeMap.get(aPlayer)).floatValue() : 1.0F; + float jumpCharge = + jumpChargeMap.containsKey(aPlayer) ? ((Float) jumpChargeMap.get(aPlayer)).floatValue() : 1.0F; if (GT_ModHandler.canUseElectricItem(aStack, 1000) && aPlayer.onGround && jumpCharge < 1.0F) { jumpCharge = 1.0F; @@ -159,7 +172,10 @@ public class GT_EnergyArmor_Item extends ItemArmor implements ISpecialArmor { } if ((mSpecials & 256) != 0) { - if (GT_ModHandler.canUseElectricItem(aStack, 100) && aPlayer.isSprinting() && (aPlayer.onGround && Math.abs(aPlayer.motionX) + Math.abs(aPlayer.motionZ) > 0.10000000149011612D || aPlayer.isInWater())) { + if (GT_ModHandler.canUseElectricItem(aStack, 100) + && aPlayer.isSprinting() + && (aPlayer.onGround && Math.abs(aPlayer.motionX) + Math.abs(aPlayer.motionZ) > 0.10000000149011612D + || aPlayer.isInWater())) { GT_ModHandler.useElectricItem(aStack, 100, aPlayer); float bonus = 0.22F; @@ -167,7 +183,6 @@ public class GT_EnergyArmor_Item extends ItemArmor implements ISpecialArmor { GT_ModHandler.useElectricItem(aStack, 100, aPlayer); bonus = 0.1F; - if (aPlayer.motionY > 0) { aPlayer.motionY += 0.10000000149011612D; } @@ -187,13 +202,14 @@ public class GT_EnergyArmor_Item extends ItemArmor implements ISpecialArmor { } if (!aPlayer.worldObj.isRemote && (mSpecials & (16 | 32)) != 0) { - //if (GregTech_API.sWorldTickCounter%20==0) { + // if (GregTech_API.sWorldTickCounter%20==0) { ItemStack tTargetChargeItem = aStack, tTargetDechargeItem = aStack; if (GT_ModHandler.chargeElectricItem(tTargetChargeItem, 1, Integer.MAX_VALUE, true, true) < 1) { tTargetChargeItem = aPlayer.inventory.armorInventory[2]; } - if (GT_ModHandler.dischargeElectricItem(tTargetDechargeItem, 10, Integer.MAX_VALUE, true, true, true) < 10) { + if (GT_ModHandler.dischargeElectricItem(tTargetDechargeItem, 10, Integer.MAX_VALUE, true, true, true) + < 10) { tTargetDechargeItem = aPlayer.inventory.armorInventory[2]; } @@ -201,18 +217,22 @@ public class GT_EnergyArmor_Item extends ItemArmor implements ISpecialArmor { tTargetChargeItem = null; } - if (aPlayer.worldObj.isDaytime() && aPlayer.worldObj.canBlockSeeTheSky(MathHelper.floor_double(aPlayer.posX), MathHelper.floor_double(aPlayer.posY + 1), MathHelper.floor_double(aPlayer.posZ))) { + if (aPlayer.worldObj.isDaytime() + && aPlayer.worldObj.canBlockSeeTheSky( + MathHelper.floor_double(aPlayer.posX), + MathHelper.floor_double(aPlayer.posY + 1), + MathHelper.floor_double(aPlayer.posZ))) { if ((mSpecials & 32) != 0 && tTargetChargeItem != null) { GT_ModHandler.chargeElectricItem(tTargetChargeItem, 20, Integer.MAX_VALUE, true, false); } } else { - /* TODO: - if ((mSpecials & 16) != 0 && tTargetDechargeItem != null && GT_ModHandler.canUseElectricItem(tTargetDechargeItem, 10)) { - if (aPlayer.worldObj.getBlock ((int)aPlayer.posX, (int)aPlayer.posY+1, (int)aPlayer.posZ) == Blocks.air) - aPlayer.worldObj.setBlock ((int)aPlayer.posX, (int)aPlayer.posY+1, (int)aPlayer.posZ, GregTech_API.sBlockList[3]); - GT_ModHandler.useElectricItem(tTargetDechargeItem, 10, aPlayer); - }*/ - //} + /* TODO: + if ((mSpecials & 16) != 0 && tTargetDechargeItem != null && GT_ModHandler.canUseElectricItem(tTargetDechargeItem, 10)) { + if (aPlayer.worldObj.getBlock ((int)aPlayer.posX, (int)aPlayer.posY+1, (int)aPlayer.posZ) == Blocks.air) + aPlayer.worldObj.setBlock ((int)aPlayer.posX, (int)aPlayer.posY+1, (int)aPlayer.posZ, GregTech_API.sBlockList[3]); + GT_ModHandler.useElectricItem(tTargetDechargeItem, 10, aPlayer); + }*/ + // } } } } @@ -285,7 +305,9 @@ 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; @@ -296,8 +318,17 @@ public class GT_EnergyArmor_Item extends ItemArmor implements ISpecialArmor { } @Override - public ISpecialArmor.ArmorProperties getProperties(EntityLivingBase player, ItemStack armor, DamageSource source, double damage, int slotIndex) { - 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); + public ISpecialArmor.ArmorProperties getProperties( + EntityLivingBase player, ItemStack armor, DamageSource source, double damage, int slotIndex) { + 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); } @Override @@ -306,8 +337,10 @@ 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); + 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); } private double getBaseAbsorptionRatio() { diff --git a/src/main/java/gregtech/api/items/GT_Generic_Block.java b/src/main/java/gregtech/api/items/GT_Generic_Block.java index 37d1e0c7d5..912841c145 100644 --- a/src/main/java/gregtech/api/items/GT_Generic_Block.java +++ b/src/main/java/gregtech/api/items/GT_Generic_Block.java @@ -1,13 +1,13 @@ package gregtech.api.items; +import static gregtech.api.enums.GT_Values.W; + import cpw.mods.fml.common.registry.GameRegistry; import gregtech.api.util.GT_LanguageManager; import net.minecraft.block.Block; import net.minecraft.block.material.Material; import net.minecraft.item.ItemBlock; -import static gregtech.api.enums.GT_Values.W; - public class GT_Generic_Block extends Block { protected final String mUnlocalizedName; 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 796a414c78..347913e470 100644 --- a/src/main/java/gregtech/api/items/GT_Generic_Item.java +++ b/src/main/java/gregtech/api/items/GT_Generic_Item.java @@ -1,5 +1,8 @@ package gregtech.api.items; +import static gregtech.api.enums.GT_Values.MOD_ID; +import static gregtech.api.enums.GT_Values.RES_PATH_ITEM; + import cpw.mods.fml.common.registry.GameRegistry; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; @@ -10,6 +13,7 @@ import gregtech.api.util.GT_Config; import gregtech.api.util.GT_LanguageManager; import gregtech.api.util.GT_ModHandler; import gregtech.api.util.GT_Utility; +import java.util.List; import net.minecraft.block.BlockDispenser; import net.minecraft.client.renderer.texture.IIconRegister; import net.minecraft.dispenser.BehaviorDefaultDispenseItem; @@ -26,11 +30,6 @@ import net.minecraft.util.EnumFacing; import net.minecraft.util.IIcon; import net.minecraft.world.World; -import java.util.List; - -import static gregtech.api.enums.GT_Values.MOD_ID; -import static gregtech.api.enums.GT_Values.RES_PATH_ITEM; - /** * Extended by most Items, also used as a fallback Item, to prevent the accidental deletion when Errors occur. */ @@ -42,12 +41,14 @@ public class GT_Generic_Item extends Item implements IProjectileItem { this(aUnlocalized, aEnglish, aEnglishTooltip, true); } - public GT_Generic_Item(String aUnlocalized, String aEnglish, String aEnglishTooltip, boolean aWriteToolTipIntoLangFile) { + public GT_Generic_Item( + String aUnlocalized, String aEnglish, String aEnglishTooltip, boolean aWriteToolTipIntoLangFile) { super(); mName = "gt." + aUnlocalized; GT_LanguageManager.addStringLocalization(mName + ".name", aEnglish); if (GT_Utility.isStringValid(aEnglishTooltip)) - GT_LanguageManager.addStringLocalization(mTooltip = mName + ".tooltip_main", aEnglishTooltip, aWriteToolTipIntoLangFile); + GT_LanguageManager.addStringLocalization( + mTooltip = mName + ".tooltip_main", aEnglishTooltip, aWriteToolTipIntoLangFile); else mTooltip = null; setCreativeTab(GregTech_API.TAB_GREGTECH); GameRegistry.registerItem(this, mName, MOD_ID); @@ -120,12 +121,14 @@ public class GT_Generic_Item extends Item implements IProjectileItem { } @Override - public EntityArrow getProjectile(SubTag aProjectileType, ItemStack aStack, World aWorld, double aX, double aY, double aZ) { + public EntityArrow getProjectile( + SubTag aProjectileType, ItemStack aStack, World aWorld, double aX, double aY, double aZ) { return null; } @Override - public EntityArrow getProjectile(SubTag aProjectileType, ItemStack aStack, World aWorld, EntityLivingBase aEntity, float aSpeed) { + public EntityArrow getProjectile( + SubTag aProjectileType, ItemStack aStack, World aWorld, EntityLivingBase aEntity, float aSpeed) { return null; } @@ -145,12 +148,12 @@ public class GT_Generic_Item extends Item implements IProjectileItem { } @Deprecated - public String trans(String aKey, String aEnglish){ - return transItem(aKey, aEnglish); + public String trans(String aKey, String aEnglish) { + return transItem(aKey, aEnglish); } - public String transItem(String aKey, String aEnglish){ - return GT_LanguageManager.addStringLocalization("Item_DESCRIPTION_Index_"+aKey, aEnglish, false); + public String transItem(String aKey, String aEnglish) { + return GT_LanguageManager.addStringLocalization("Item_DESCRIPTION_Index_" + aKey, aEnglish, false); } public static class GT_Item_Dispense extends BehaviorProjectileDispense { 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 e0a70c093c..bf2b0d2d96 100644 --- a/src/main/java/gregtech/api/items/GT_MetaBase_Item.java +++ b/src/main/java/gregtech/api/items/GT_MetaBase_Item.java @@ -1,5 +1,8 @@ package gregtech.api.items; +import static gregtech.api.enums.GT_Values.D1; +import static gregtech.api.enums.GT_Values.V; + import gregtech.api.enums.SubTag; import gregtech.api.interfaces.IItemBehaviour; import gregtech.api.util.GT_LanguageManager; @@ -10,6 +13,9 @@ import ic2.api.item.ElectricItem; import ic2.api.item.IElectricItem; import ic2.api.item.IElectricItemManager; import ic2.api.item.ISpecialElectricItem; +import java.util.ArrayList; +import java.util.List; +import java.util.concurrent.ConcurrentHashMap; import net.minecraft.dispenser.IBlockSource; import net.minecraft.entity.Entity; import net.minecraft.entity.EntityLivingBase; @@ -24,16 +30,11 @@ import net.minecraft.world.World; import net.minecraftforge.fluids.FluidStack; import net.minecraftforge.fluids.IFluidContainerItem; -import java.util.ArrayList; -import java.util.List; -import java.util.concurrent.ConcurrentHashMap; - -import static gregtech.api.enums.GT_Values.D1; -import static gregtech.api.enums.GT_Values.V; - -public abstract class GT_MetaBase_Item extends GT_Generic_Item implements ISpecialElectricItem, IElectricItemManager, IFluidContainerItem { +public abstract class GT_MetaBase_Item extends GT_Generic_Item + implements ISpecialElectricItem, IElectricItemManager, IFluidContainerItem { /* ---------- CONSTRUCTOR AND MEMBER VARIABLES ---------- */ - private final ConcurrentHashMap<Short, ArrayList<IItemBehaviour<GT_MetaBase_Item>>> mItemBehaviors = new ConcurrentHashMap<Short, ArrayList<IItemBehaviour<GT_MetaBase_Item>>>(); + private final ConcurrentHashMap<Short, ArrayList<IItemBehaviour<GT_MetaBase_Item>>> mItemBehaviors = + new ConcurrentHashMap<Short, ArrayList<IItemBehaviour<GT_MetaBase_Item>>>(); /** * Creates the Item using these Parameters. @@ -57,7 +58,8 @@ public abstract class GT_MetaBase_Item extends GT_Generic_Item implements ISpeci */ 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; } @@ -69,44 +71,51 @@ public abstract class GT_MetaBase_Item extends GT_Generic_Item implements ISpeci @Override public boolean hasProjectile(SubTag aProjectileType, ItemStack aStack) { ArrayList<IItemBehaviour<GT_MetaBase_Item>> tList = mItemBehaviors.get((short) getDamage(aStack)); - if (tList != null) for (IItemBehaviour<GT_MetaBase_Item> tBehavior : tList) - if (tBehavior.hasProjectile(this, aProjectileType, aStack)) return true; + if (tList != null) + for (IItemBehaviour<GT_MetaBase_Item> tBehavior : tList) + if (tBehavior.hasProjectile(this, aProjectileType, aStack)) return true; return super.hasProjectile(aProjectileType, aStack); } @Override - public EntityArrow getProjectile(SubTag aProjectileType, ItemStack aStack, World aWorld, double aX, double aY, double aZ) { + public EntityArrow getProjectile( + SubTag aProjectileType, ItemStack aStack, World aWorld, double aX, double aY, double aZ) { ArrayList<IItemBehaviour<GT_MetaBase_Item>> tList = mItemBehaviors.get((short) getDamage(aStack)); - if (tList != null) for (IItemBehaviour<GT_MetaBase_Item> tBehavior : tList) { - EntityArrow rArrow = tBehavior.getProjectile(this, aProjectileType, aStack, aWorld, aX, aY, aZ); - if (rArrow != null) return rArrow; - } + if (tList != null) + for (IItemBehaviour<GT_MetaBase_Item> tBehavior : tList) { + EntityArrow rArrow = tBehavior.getProjectile(this, aProjectileType, aStack, aWorld, aX, aY, aZ); + if (rArrow != null) return rArrow; + } return super.getProjectile(aProjectileType, aStack, aWorld, aX, aY, aZ); } @Override - public EntityArrow getProjectile(SubTag aProjectileType, ItemStack aStack, World aWorld, EntityLivingBase aEntity, float aSpeed) { + public EntityArrow getProjectile( + SubTag aProjectileType, ItemStack aStack, World aWorld, EntityLivingBase aEntity, float aSpeed) { ArrayList<IItemBehaviour<GT_MetaBase_Item>> tList = mItemBehaviors.get((short) getDamage(aStack)); - if (tList != null) for (IItemBehaviour<GT_MetaBase_Item> tBehavior : tList) { - EntityArrow rArrow = tBehavior.getProjectile(this, aProjectileType, aStack, aWorld, aEntity, aSpeed); - if (rArrow != null) return rArrow; - } + if (tList != null) + for (IItemBehaviour<GT_MetaBase_Item> tBehavior : tList) { + EntityArrow rArrow = tBehavior.getProjectile(this, aProjectileType, aStack, aWorld, aEntity, aSpeed); + if (rArrow != null) return rArrow; + } return super.getProjectile(aProjectileType, aStack, aWorld, aEntity, aSpeed); } @Override public ItemStack onDispense(IBlockSource aSource, ItemStack aStack) { ArrayList<IItemBehaviour<GT_MetaBase_Item>> tList = mItemBehaviors.get((short) getDamage(aStack)); - if (tList != null) for (IItemBehaviour<GT_MetaBase_Item> tBehavior : tList) - if (tBehavior.canDispense(this, aSource, aStack)) return tBehavior.onDispense(this, aSource, aStack); + if (tList != null) + for (IItemBehaviour<GT_MetaBase_Item> tBehavior : tList) + if (tBehavior.canDispense(this, aSource, aStack)) return tBehavior.onDispense(this, aSource, aStack); return super.onDispense(aSource, aStack); } @Override public boolean isItemStackUsable(ItemStack aStack) { ArrayList<IItemBehaviour<GT_MetaBase_Item>> tList = mItemBehaviors.get((short) getDamage(aStack)); - if (tList != null) for (IItemBehaviour<GT_MetaBase_Item> tBehavior : tList) - if (!tBehavior.isItemStackUsable(this, aStack)) return false; + if (tList != null) + for (IItemBehaviour<GT_MetaBase_Item> tBehavior : tList) + if (!tBehavior.isItemStackUsable(this, aStack)) return false; return super.isItemStackUsable(aStack); } @@ -115,11 +124,13 @@ public abstract class GT_MetaBase_Item extends GT_Generic_Item implements ISpeci use(aStack, 0, aPlayer); isItemStackUsable(aStack); ArrayList<IItemBehaviour<GT_MetaBase_Item>> tList = mItemBehaviors.get((short) getDamage(aStack)); - try { if (tList != null) for (IItemBehaviour<GT_MetaBase_Item> tBehavior : tList) - if (tBehavior.onLeftClickEntity(this, aStack, aPlayer, aEntity)) { - if (aStack.stackSize <= 0) aPlayer.destroyCurrentEquippedItem(); - return true; - } + try { + if (tList != null) + for (IItemBehaviour<GT_MetaBase_Item> tBehavior : tList) + if (tBehavior.onLeftClickEntity(this, aStack, aPlayer, aEntity)) { + if (aStack.stackSize <= 0) aPlayer.destroyCurrentEquippedItem(); + return true; + } if (aStack.stackSize <= 0) { aPlayer.destroyCurrentEquippedItem(); return false; @@ -131,15 +142,27 @@ public abstract class GT_MetaBase_Item extends GT_Generic_Item implements ISpeci } @Override - public boolean onItemUse(ItemStack aStack, EntityPlayer aPlayer, World aWorld, int aX, int aY, int aZ, int aSide, float hitX, float hitY, float hitZ) { + public boolean onItemUse( + ItemStack aStack, + EntityPlayer aPlayer, + World aWorld, + int aX, + int aY, + int aZ, + int aSide, + float hitX, + float hitY, + float hitZ) { use(aStack, 0, aPlayer); isItemStackUsable(aStack); ArrayList<IItemBehaviour<GT_MetaBase_Item>> tList = mItemBehaviors.get((short) getDamage(aStack)); - try { if (tList != null) for (IItemBehaviour<GT_MetaBase_Item> tBehavior : tList) - if (tBehavior.onItemUse(this, aStack, aPlayer, aWorld, aX, aY, aZ, aSide, hitX, hitY, hitZ)) { - if (aStack.stackSize <= 0) aPlayer.destroyCurrentEquippedItem(); - return true; - } + try { + if (tList != null) + for (IItemBehaviour<GT_MetaBase_Item> tBehavior : tList) + if (tBehavior.onItemUse(this, aStack, aPlayer, aWorld, aX, aY, aZ, aSide, hitX, hitY, hitZ)) { + if (aStack.stackSize <= 0) aPlayer.destroyCurrentEquippedItem(); + return true; + } if (aStack.stackSize <= 0) { aPlayer.destroyCurrentEquippedItem(); return false; @@ -151,15 +174,27 @@ public abstract class GT_MetaBase_Item extends GT_Generic_Item implements ISpeci } @Override - public boolean onItemUseFirst(ItemStack aStack, EntityPlayer aPlayer, World aWorld, int aX, int aY, int aZ, int aSide, float hitX, float hitY, float hitZ) { + public boolean onItemUseFirst( + ItemStack aStack, + EntityPlayer aPlayer, + World aWorld, + int aX, + int aY, + int aZ, + int aSide, + float hitX, + float hitY, + float hitZ) { use(aStack, 0, aPlayer); isItemStackUsable(aStack); ArrayList<IItemBehaviour<GT_MetaBase_Item>> tList = mItemBehaviors.get((short) getDamage(aStack)); - try { if (tList != null) for (IItemBehaviour<GT_MetaBase_Item> tBehavior : tList) - if (tBehavior.onItemUseFirst(this, aStack, aPlayer, aWorld, aX, aY, aZ, aSide, hitX, hitY, hitZ)) { - if (aStack.stackSize <= 0) aPlayer.destroyCurrentEquippedItem(); - return true; - } + try { + if (tList != null) + for (IItemBehaviour<GT_MetaBase_Item> tBehavior : tList) + if (tBehavior.onItemUseFirst(this, aStack, aPlayer, aWorld, aX, aY, aZ, aSide, hitX, hitY, hitZ)) { + if (aStack.stackSize <= 0) aPlayer.destroyCurrentEquippedItem(); + return true; + } if (aStack.stackSize <= 0) { aPlayer.destroyCurrentEquippedItem(); return false; @@ -175,8 +210,10 @@ public abstract class GT_MetaBase_Item extends GT_Generic_Item implements ISpeci use(aStack, 0, aPlayer); isItemStackUsable(aStack); ArrayList<IItemBehaviour<GT_MetaBase_Item>> tList = mItemBehaviors.get((short) getDamage(aStack)); - try { if (tList != null) for (IItemBehaviour<GT_MetaBase_Item> tBehavior : tList) - aStack = tBehavior.onItemRightClick(this, aStack, aWorld, aPlayer); + try { + if (tList != null) + for (IItemBehaviour<GT_MetaBase_Item> tBehavior : tList) + aStack = tBehavior.onItemRightClick(this, aStack, aWorld, aPlayer); } catch (Throwable e) { if (D1) e.printStackTrace(GT_Log.err); } @@ -190,17 +227,34 @@ public abstract class GT_MetaBase_Item extends GT_Generic_Item implements ISpeci for (String tString : tStrings) if (GT_Utility.isStringValid(tString) && !tKey.equals(tString)) aList.add(tString); - Long[] - tStats = getElectricStats(aStack); + Long[] tStats = getElectricStats(aStack); if (tStats != null) { if (tStats[3] > 0) { - aList.add(EnumChatFormatting.AQUA + String.format(transItem("009", "Contains %s EU Tier: %s"), GT_Utility.formatNumbers(tStats[3]), "" + (tStats[2] >= 0 ? tStats[2] : 0)) + EnumChatFormatting.GRAY); + aList.add(EnumChatFormatting.AQUA + + String.format( + transItem("009", "Contains %s EU Tier: %s"), + GT_Utility.formatNumbers(tStats[3]), + "" + (tStats[2] >= 0 ? tStats[2] : 0)) + + EnumChatFormatting.GRAY); } else { long tCharge = getRealCharge(aStack); if (tStats[3] == -2 && tCharge <= 0) { - aList.add(EnumChatFormatting.AQUA + transItem("010", "Empty. You should recycle it properly.") + EnumChatFormatting.GRAY); + aList.add(EnumChatFormatting.AQUA + + transItem("010", "Empty. You should recycle it properly.") + + EnumChatFormatting.GRAY); } else { - aList.add(String.valueOf(EnumChatFormatting.AQUA) + String.format(transItem("011", "%s / %s EU - Voltage: %s"), GT_Utility.formatNumbers(tCharge), GT_Utility.formatNumbers(Math.abs(tStats[0])), "" + V[(int) (tStats[2] >= 0 ? tStats[2] < V.length ? tStats[2] : V.length - 1 : 1)]) + EnumChatFormatting.GRAY); + aList.add(String.valueOf(EnumChatFormatting.AQUA) + + String.format( + transItem("011", "%s / %s EU - Voltage: %s"), + GT_Utility.formatNumbers(tCharge), + GT_Utility.formatNumbers(Math.abs(tStats[0])), + "" + + V[ + (int) + (tStats[2] >= 0 + ? tStats[2] < V.length ? tStats[2] : V.length - 1 + : 1)]) + + EnumChatFormatting.GRAY); } } } @@ -208,13 +262,21 @@ public abstract class GT_MetaBase_Item extends GT_Generic_Item implements ISpeci tStats = getFluidContainerStats(aStack); if (tStats != null && tStats[0] > 0) { FluidStack tFluid = getFluidContent(aStack); - aList.add(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 : tFluid.amount), "" + tStats[0]) + EnumChatFormatting.GRAY); + aList.add(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 : tFluid.amount), "" + tStats[0]) + + EnumChatFormatting.GRAY); } ArrayList<IItemBehaviour<GT_MetaBase_Item>> tList = mItemBehaviors.get((short) getDamage(aStack)); - if (tList != null) for (IItemBehaviour<GT_MetaBase_Item> tBehavior : tList) - aList = tBehavior.getAdditionalToolTips(this, aList, aStack); + if (tList != null) + for (IItemBehaviour<GT_MetaBase_Item> tBehavior : tList) + aList = tBehavior.getAdditionalToolTips(this, aList, aStack); addAdditionalToolTips(aList, aStack, aPlayer); } @@ -222,8 +284,9 @@ public abstract class GT_MetaBase_Item extends GT_Generic_Item implements ISpeci @Override public void onUpdate(ItemStack aStack, World aWorld, Entity aPlayer, int aTimer, boolean aIsInHand) { ArrayList<IItemBehaviour<GT_MetaBase_Item>> tList = mItemBehaviors.get((short) getDamage(aStack)); - if (tList != null) for (IItemBehaviour<GT_MetaBase_Item> tBehavior : tList) - tBehavior.onUpdate(this, aStack, aWorld, aPlayer, aTimer, aIsInHand); + if (tList != null) + for (IItemBehaviour<GT_MetaBase_Item> tBehavior : tList) + tBehavior.onUpdate(this, aStack, aWorld, aPlayer, aTimer, aIsInHand); } @Override @@ -248,20 +311,37 @@ public abstract class GT_MetaBase_Item extends GT_Generic_Item implements ISpeci } @Override - public final double charge(ItemStack aStack, double aCharge, int aTier, boolean aIgnoreTransferLimit, boolean aSimulate) { + public final double charge( + ItemStack aStack, double aCharge, int aTier, boolean aIgnoreTransferLimit, boolean aSimulate) { Long[] tStats = getElectricStats(aStack); - if (tStats == null || tStats[2] > aTier || !(tStats[3] == -1 || tStats[3] == -3 || (tStats[3] < 0 && aCharge == Integer.MAX_VALUE)) || aStack.stackSize != 1) - return 0; - //REALLY?? THIS IS THE CULPRIT THAT CHARGES ITEMS AT INSTANT!!! - //long tChargeBefore = getRealCharge(aStack), tNewCharge = aCharge == Integer.MAX_VALUE ? Long.MAX_VALUE : Math.min(Math.abs(tStats[0]), tChargeBefore + (aIgnoreTransferLimit ? (long) aCharge : Math.min(tStats[1], (long) aCharge))); + if (tStats == null + || tStats[2] > aTier + || !(tStats[3] == -1 || tStats[3] == -3 || (tStats[3] < 0 && aCharge == Integer.MAX_VALUE)) + || aStack.stackSize != 1) return 0; + // REALLY?? THIS IS THE CULPRIT THAT CHARGES ITEMS AT INSTANT!!! + // long tChargeBefore = getRealCharge(aStack), tNewCharge = aCharge == Integer.MAX_VALUE ? Long.MAX_VALUE : + // Math.min(Math.abs(tStats[0]), tChargeBefore + (aIgnoreTransferLimit ? (long) aCharge : Math.min(tStats[1], + // (long) aCharge))); long tTransfer = aIgnoreTransferLimit ? (long) aCharge : Math.min(tStats[1], (long) aCharge); - long tChargeBefore = getRealCharge(aStack), tNewCharge = Math.min(Math.abs(tStats[0]), Long.MAX_VALUE - tTransfer >= tChargeBefore ? tChargeBefore + tTransfer : Long.MAX_VALUE); + long tChargeBefore = getRealCharge(aStack), + tNewCharge = + Math.min( + Math.abs(tStats[0]), + Long.MAX_VALUE - tTransfer >= tChargeBefore + ? tChargeBefore + tTransfer + : Long.MAX_VALUE); if (!aSimulate) setCharge(aStack, tNewCharge); return tNewCharge - tChargeBefore; } @Override - public final double discharge(ItemStack aStack, double aCharge, int aTier, boolean aIgnoreTransferLimit, boolean aBatteryAlike, boolean aSimulate) { + public final double discharge( + ItemStack aStack, + double aCharge, + int aTier, + boolean aIgnoreTransferLimit, + boolean aBatteryAlike, + boolean aSimulate) { Long[] tStats = getElectricStats(aStack); if (tStats == null || tStats[2] > aTier) return 0; if (aBatteryAlike && !canProvideEnergy(aStack)) return 0; @@ -270,7 +350,14 @@ public abstract class GT_MetaBase_Item extends GT_Generic_Item implements ISpeci 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; } @@ -308,7 +395,13 @@ public abstract class GT_MetaBase_Item extends GT_Generic_Item implements ISpeci if (GT_ModHandler.isElectricItem(tArmor)) { IElectricItem tArmorItem = (IElectricItem) tArmor.getItem(); if (tArmorItem.canProvideEnergy(tArmor) && tArmorItem.getTier(tArmor) >= getTier(aStack)) { - double tCharge = ElectricItem.manager.discharge(tArmor, charge(aStack, Integer.MAX_VALUE - 1, Integer.MAX_VALUE, true, true), Integer.MAX_VALUE, true, true, false); + double tCharge = ElectricItem.manager.discharge( + tArmor, + charge(aStack, Integer.MAX_VALUE - 1, Integer.MAX_VALUE, true, true), + Integer.MAX_VALUE, + true, + true, + false); if (tCharge > 0) { charge(aStack, tCharge, Integer.MAX_VALUE, true, false); if (aPlayer instanceof EntityPlayer) { @@ -464,8 +557,11 @@ public abstract class GT_MetaBase_Item extends GT_Generic_Item implements ISpeci } Long[] tStats = getFluidContainerStats(aStack); - if (tStats == null || tStats[0] <= 0 || aFluid == null || aFluid.getFluid().getID() <= 0 || aFluid.amount <= 0) - return 0; + if (tStats == null + || tStats[0] <= 0 + || aFluid == null + || aFluid.getFluid().getID() <= 0 + || aFluid.amount <= 0) return 0; FluidStack tFluid = getFluidContent(aStack); @@ -509,10 +605,10 @@ public abstract class GT_MetaBase_Item extends GT_Generic_Item implements ISpeci if (tFluid != null && maxDrain >= tFluid.amount) { ItemStack tStack = GT_Utility.getContainerItem(aStack, false); if (tStack == null) { - if(doDrain) aStack.stackSize = 0; + if (doDrain) aStack.stackSize = 0; return tFluid; } - if(doDrain) { + if (doDrain) { aStack.setItemDamage(tStack.getItemDamage()); aStack.func_150996_a(tStack.getItem()); } @@ -558,10 +654,11 @@ public abstract class GT_MetaBase_Item extends GT_Generic_Item implements ISpeci @Override public int getItemStackLimit(ItemStack aStack) { Long[] tStats = getElectricStats(aStack); - if (tStats != null && (tStats[3] == -1 || tStats[3] == -2 || tStats[3] == -3) && getRealCharge(aStack) > 0) return 1; + if (tStats != null && (tStats[3] == -1 || tStats[3] == -2 || tStats[3] == -3) && getRealCharge(aStack) > 0) + return 1; tStats = getFluidContainerStats(aStack); if (tStats != null) return (int) (long) tStats[1]; - if(getDamage(aStack)==32763)return 1; + if (getDamage(aStack) == 32763) return 1; return 64; } 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 2743f35e3b..bf472101de 100644 --- a/src/main/java/gregtech/api/items/GT_MetaGenerated_Item.java +++ b/src/main/java/gregtech/api/items/GT_MetaGenerated_Item.java @@ -1,5 +1,7 @@ package gregtech.api.items; +import static gregtech.api.enums.GT_Values.*; + import cpw.mods.fml.common.Loader; import cpw.mods.fml.common.Optional; import cpw.mods.fml.relauncher.Side; @@ -19,6 +21,11 @@ import gregtech.api.util.GT_LanguageManager; import gregtech.api.util.GT_OreDictUnificator; import gregtech.api.util.GT_Utility; import gregtech.common.render.items.GT_GeneratedMaterial_Renderer; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.BitSet; +import java.util.List; +import java.util.concurrent.ConcurrentHashMap; import net.minecraft.client.renderer.texture.IIconRegister; import net.minecraft.creativetab.CreativeTabs; import net.minecraft.entity.player.EntityPlayer; @@ -31,14 +38,6 @@ import net.minecraft.world.World; import squeek.applecore.api.food.FoodValues; import squeek.applecore.api.food.IEdible; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.BitSet; -import java.util.List; -import java.util.concurrent.ConcurrentHashMap; - -import static gregtech.api.enums.GT_Values.*; - /** * @author Gregorius Techneticies * <p/> @@ -59,9 +58,10 @@ public abstract class GT_MetaGenerated_Item extends GT_MetaBase_Item implements * <p/> * You can also use the unlocalized Name gotten from getUnlocalizedName() as Key if you want to get a specific Item. */ - public static final ConcurrentHashMap<String, GT_MetaGenerated_Item> sInstances = new ConcurrentHashMap<String, GT_MetaGenerated_Item>(); + public static final ConcurrentHashMap<String, GT_MetaGenerated_Item> sInstances = + new ConcurrentHashMap<String, GT_MetaGenerated_Item>(); - /* ---------- CONSTRUCTOR AND MEMBER VARIABLES ---------- */ + /* ---------- CONSTRUCTOR AND MEMBER VARIABLES ---------- */ public final short mOffset, mItemAmount; public final BitSet mEnabledItems; @@ -132,7 +132,15 @@ public abstract class GT_MetaGenerated_Item extends GT_MetaBase_Item implements if (((IFoodStat) tRandomData).getFoodAction(this, rStack) == EnumAction.eat) { int tFoodValue = ((IFoodStat) tRandomData).getFoodLevel(this, rStack, null); if (tFoodValue > 0) - RA.addCannerRecipe(rStack, ItemList.IC2_Food_Can_Empty.get(tFoodValue), ((IFoodStat) tRandomData).isRotten(this, rStack, null) ? ItemList.IC2_Food_Can_Spoiled.get(tFoodValue) : ItemList.IC2_Food_Can_Filled.get(tFoodValue), null, tFoodValue * 100, 1); + RA.addCannerRecipe( + rStack, + ItemList.IC2_Food_Can_Empty.get(tFoodValue), + ((IFoodStat) tRandomData).isRotten(this, rStack, null) + ? ItemList.IC2_Food_Can_Spoiled.get(tFoodValue) + : ItemList.IC2_Food_Can_Filled.get(tFoodValue), + null, + tFoodValue * 100, + 1); } tUseOreDict = false; } @@ -208,13 +216,22 @@ public abstract class GT_MetaGenerated_Item extends GT_MetaBase_Item implements * Use -3 if you want to make this Battery charge/discharge-able. * @return the Item itself for convenience in constructing. */ - public final GT_MetaGenerated_Item setElectricStats(int aMetaValue, long aMaxCharge, long aTransferLimit, long aTier, long aSpecialData, boolean aUseAnimations) { + public final GT_MetaGenerated_Item setElectricStats( + int aMetaValue, + long aMaxCharge, + long aTransferLimit, + long aTier, + long aSpecialData, + boolean aUseAnimations) { if (aMetaValue < 0 || aMetaValue >= mOffset + mEnabledItems.length()) return this; if (aMaxCharge == 0) mElectricStats.remove((short) aMetaValue); else { - mElectricStats.put((short) aMetaValue, new Long[]{aMaxCharge, Math.max(0, aTransferLimit), Math.max(-1, aTier), aSpecialData}); + 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)); + mIconList[aMetaValue - mOffset] = Arrays.copyOf( + mIconList[aMetaValue - mOffset], Math.max(9, mIconList[aMetaValue - mOffset].length)); } return this; } @@ -229,7 +246,7 @@ public abstract class GT_MetaGenerated_Item extends GT_MetaBase_Item implements public final GT_MetaGenerated_Item setFluidContainerStats(int aMetaValue, long aCapacity, long aStacksize) { if (aMetaValue < 0 || aMetaValue >= mOffset + mEnabledItems.length()) return this; if (aCapacity < 0) mElectricStats.remove((short) aMetaValue); - else mFluidContainerStats.put((short) aMetaValue, new Long[]{aCapacity, Math.max(1, aStacksize)}); + else mFluidContainerStats.put((short) aMetaValue, new Long[] {aCapacity, Math.max(1, aStacksize)}); return this; } @@ -261,7 +278,7 @@ public abstract class GT_MetaGenerated_Item extends GT_MetaBase_Item implements return null; } - /* ---------- INTERNAL OVERRIDES ---------- */ + /* ---------- INTERNAL OVERRIDES ---------- */ @Override public ItemStack onItemRightClick(ItemStack aStack, World aWorld, EntityPlayer aPlayer) { @@ -287,9 +304,15 @@ public abstract class GT_MetaGenerated_Item extends GT_MetaBase_Item implements IFoodStat tStat = mFoodStats.get((short) getDamage(aStack)); if (tStat != null) { if (Loader.isModLoaded(MOD_ID_APC)) { - 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); } @@ -300,7 +323,9 @@ public abstract class GT_MetaGenerated_Item extends GT_MetaBase_Item implements @Optional.Method(modid = MOD_ID_APC) public FoodValues getFoodValues(ItemStack aStack) { IFoodStat tStat = mFoodStats.get((short) getDamage(aStack)); - return tStat == null ? null : new FoodValues(tStat.getFoodLevel(this, aStack, null), tStat.getSaturation(this, aStack, null)); + return tStat == null + ? null + : new FoodValues(tStat.getFoodLevel(this, aStack, null), tStat.getSaturation(this, aStack, null)); } @Override @@ -331,9 +356,11 @@ public abstract class GT_MetaGenerated_Item extends GT_MetaBase_Item implements for (short i = 0; i < j; i++) if (mEnabledItems.get(i)) { for (byte k = 1; k < mIconList[i].length; k++) { - mIconList[i][k] = aIconRegister.registerIcon(RES_PATH_ITEM + (GT_Config.troll ? "troll" : getUnlocalizedName() + "/" + i + "/" + k)); + 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 f04b4a3345..62aae22e24 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 @@ -1,5 +1,7 @@ package gregtech.api.items; +import static gregtech.api.enums.GT_Values.M; + import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; import gregtech.api.GregTech_API; @@ -9,15 +11,12 @@ import gregtech.api.interfaces.IIconContainer; import gregtech.api.util.GT_LanguageManager; import gregtech.api.util.GT_OreDictUnificator; import gregtech.api.util.GT_Utility; +import java.util.List; import net.minecraft.creativetab.CreativeTabs; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; import net.minecraft.util.IIcon; -import java.util.List; - -import static gregtech.api.enums.GT_Values.M; - /** * @author Gregorius Techneticies * <p/> @@ -45,7 +44,9 @@ public abstract class GT_MetaGenerated_Item_X01 extends GT_MetaGenerated_Item { public GT_MetaGenerated_Item_X01(String aUnlocalized, OrePrefixes aGeneratedPrefix, int aIconSetIndex) { super(aUnlocalized, (short) 32000, (short) 766); mPrefix = aGeneratedPrefix; - mIconSetIndex = aIconSetIndex >= 0 ? aIconSetIndex : aGeneratedPrefix.mTextureIndex >= 0 ? aGeneratedPrefix.mTextureIndex : 0; + mIconSetIndex = aIconSetIndex >= 0 + ? aIconSetIndex + : aGeneratedPrefix.mTextureIndex >= 0 ? aGeneratedPrefix.mTextureIndex : 0; for (int i = 0; i < GregTech_API.sGeneratedMaterials.length; i++) { OrePrefixes tPrefix = mPrefix; @@ -54,8 +55,13 @@ public abstract class GT_MetaGenerated_Item_X01 extends GT_MetaGenerated_Item { if (tMaterial == null) continue; if (mPrefix.doGenerateItem(tMaterial)) { ItemStack tStack = new ItemStack(this, 1, i); - GT_LanguageManager.addStringLocalization(getUnlocalizedName(tStack) + ".name", GT_LanguageManager.i18nPlaceholder ? getDefaultLocalizationFormat(tPrefix, tMaterial, i) : getDefaultLocalization(tPrefix, tMaterial, i)); - GT_LanguageManager.addStringLocalization(getUnlocalizedName(tStack) + ".tooltip", tMaterial.getToolTip(tPrefix.mMaterialAmount / M)); + GT_LanguageManager.addStringLocalization( + getUnlocalizedName(tStack) + ".name", + GT_LanguageManager.i18nPlaceholder + ? getDefaultLocalizationFormat(tPrefix, tMaterial, i) + : getDefaultLocalization(tPrefix, tMaterial, i)); + GT_LanguageManager.addStringLocalization( + getUnlocalizedName(tStack) + ".tooltip", tMaterial.getToolTip(tPrefix.mMaterialAmount / M)); String tOreName = getOreDictString(tPrefix, tMaterial); tPrefix = OrePrefixes.getOrePrefix(tOreName); if (tPrefix != null && tPrefix.mIsUnificatable) { @@ -67,7 +73,7 @@ public abstract class GT_MetaGenerated_Item_X01 extends GT_MetaGenerated_Item { } } - /* ---------- OVERRIDEABLE FUNCTIONS ---------- */ + /* ---------- OVERRIDEABLE FUNCTIONS ---------- */ /** * @param aPrefix the OreDict Prefix @@ -110,15 +116,14 @@ public abstract class GT_MetaGenerated_Item_X01 extends GT_MetaGenerated_Item { return aMaterial.mIconSet.mTextures[mIconSetIndex]; } - /* ---------- INTERNAL OVERRIDES ---------- */ + /* ---------- INTERNAL OVERRIDES ---------- */ @Override public String getItemStackDisplayName(ItemStack aStack) { - String aName = super.getItemStackDisplayName(aStack); - int aDamage = aStack.getItemDamage(); - if (aDamage < 32000 && aDamage >= 0) - return Materials.getLocalizedNameForItem(aName, aDamage % 1000); - return aName; + String aName = super.getItemStackDisplayName(aStack); + int aDamage = aStack.getItemDamage(); + if (aDamage < 32000 && aDamage >= 0) return Materials.getLocalizedNameForItem(aName, aDamage % 1000); + return aName; } @Override @@ -136,19 +141,27 @@ public abstract class GT_MetaGenerated_Item_X01 extends GT_MetaGenerated_Item { @Override public short[] getRGBa(ItemStack aStack) { int aMetaData = getDamage(aStack); - return aMetaData < GregTech_API.sGeneratedMaterials.length && GregTech_API.sGeneratedMaterials[aMetaData] != null ? GregTech_API.sGeneratedMaterials[aMetaData].mRGBa : Materials._NULL.mRGBa; + return aMetaData < GregTech_API.sGeneratedMaterials.length + && GregTech_API.sGeneratedMaterials[aMetaData] != null + ? GregTech_API.sGeneratedMaterials[aMetaData].mRGBa + : Materials._NULL.mRGBa; } @Override public final IIconContainer getIconContainer(int aMetaData) { - return aMetaData < GregTech_API.sGeneratedMaterials.length && GregTech_API.sGeneratedMaterials[aMetaData] != null ? getIconContainer(aMetaData, GregTech_API.sGeneratedMaterials[aMetaData]) : null; + return aMetaData < GregTech_API.sGeneratedMaterials.length + && GregTech_API.sGeneratedMaterials[aMetaData] != null + ? getIconContainer(aMetaData, GregTech_API.sGeneratedMaterials[aMetaData]) + : null; } @Override @SideOnly(Side.CLIENT) public final void getSubItems(Item aItem, CreativeTabs aCreativeTab, List aList) { for (int i = 0; i < GregTech_API.sGeneratedMaterials.length; i++) - if (mPrefix.doGenerateItem(GregTech_API.sGeneratedMaterials[i]) && doesShowInCreative(mPrefix, GregTech_API.sGeneratedMaterials[i], GregTech_API.sDoShowAllItemsInCreative)) { + if (mPrefix.doGenerateItem(GregTech_API.sGeneratedMaterials[i]) + && doesShowInCreative( + mPrefix, GregTech_API.sGeneratedMaterials[i], GregTech_API.sDoShowAllItemsInCreative)) { ItemStack tStack = new ItemStack(this, 1, i); isItemStackUsable(tStack); aList.add(tStack); @@ -166,12 +179,16 @@ public abstract class GT_MetaGenerated_Item_X01 extends GT_MetaGenerated_Item { if (tIcon != null) return tIcon.getIcon(); return null; } - return aMetaData >= mOffset && aMetaData - mOffset < mIconList.length ? mIconList[aMetaData - mOffset][0] : null; + return aMetaData >= mOffset && aMetaData - mOffset < mIconList.length + ? mIconList[aMetaData - mOffset][0] + : null; } @Override public int getItemStackLimit(ItemStack aStack) { - return getDamage(aStack) < mOffset ? Math.min(super.getItemStackLimit(aStack), mPrefix.mDefaultStackSize) : super.getItemStackLimit(aStack); + return getDamage(aStack) < mOffset + ? Math.min(super.getItemStackLimit(aStack), mPrefix.mDefaultStackSize) + : super.getItemStackLimit(aStack); } @Override diff --git a/src/main/java/gregtech/api/items/GT_MetaGenerated_Item_X32.java b/src/main/java/gregtech/api/items/GT_MetaGenerated_Item_X32.java index 645764defb..c0f7b6b3c9 100644 --- a/src/main/java/gregtech/api/items/GT_MetaGenerated_Item_X32.java +++ b/src/main/java/gregtech/api/items/GT_MetaGenerated_Item_X32.java @@ -1,5 +1,7 @@ package gregtech.api.items; +import static gregtech.api.enums.GT_Values.M; + import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; import gregtech.api.GregTech_API; @@ -11,16 +13,13 @@ import gregtech.api.util.GT_ModHandler; import gregtech.api.util.GT_OreDictUnificator; import gregtech.api.util.GT_Utility; import gregtech.common.render.items.GT_GeneratedMaterial_Renderer; +import java.util.Arrays; +import java.util.List; import net.minecraft.creativetab.CreativeTabs; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; import net.minecraft.util.IIcon; -import java.util.Arrays; -import java.util.List; - -import static gregtech.api.enums.GT_Values.M; - /** * @author Gregorius Techneticies * <p/> @@ -54,14 +53,22 @@ public abstract class GT_MetaGenerated_Item_X32 extends GT_MetaGenerated_Item { if (tMaterial == null) continue; if (doesMaterialAllowGeneration(tPrefix, tMaterial)) { ItemStack tStack = new ItemStack(this, 1, i); - GT_LanguageManager.addStringLocalization(getUnlocalizedName(tStack) + ".name", GT_LanguageManager.i18nPlaceholder ? getDefaultLocalizationFormat(tPrefix, tMaterial, i) : getDefaultLocalization(tPrefix, tMaterial, i)); - GT_LanguageManager.addStringLocalization(getUnlocalizedName(tStack) + ".tooltip", tMaterial.getToolTip(tPrefix.mMaterialAmount / M)); + GT_LanguageManager.addStringLocalization( + getUnlocalizedName(tStack) + ".name", + GT_LanguageManager.i18nPlaceholder + ? getDefaultLocalizationFormat(tPrefix, tMaterial, i) + : getDefaultLocalization(tPrefix, tMaterial, i)); + GT_LanguageManager.addStringLocalization( + getUnlocalizedName(tStack) + ".tooltip", tMaterial.getToolTip(tPrefix.mMaterialAmount / M)); if (tPrefix.mIsUnificatable) { GT_OreDictUnificator.set(tPrefix, tMaterial, tStack); } else { GT_OreDictUnificator.registerOre(tPrefix.get(tMaterial), tStack); } - if ((tPrefix == OrePrefixes.stick || tPrefix == OrePrefixes.wireFine || tPrefix == OrePrefixes.ingot) && (tMaterial == Materials.Lead || tMaterial == Materials.Tin || tMaterial == Materials.SolderingAlloy)) { + if ((tPrefix == OrePrefixes.stick || tPrefix == OrePrefixes.wireFine || tPrefix == OrePrefixes.ingot) + && (tMaterial == Materials.Lead + || tMaterial == Materials.Tin + || tMaterial == Materials.SolderingAlloy)) { GregTech_API.sSolderingMetalList.add(tStack); GT_ModHandler.registerBoxableItemToToolBox(tStack); } @@ -69,7 +76,7 @@ public abstract class GT_MetaGenerated_Item_X32 extends GT_MetaGenerated_Item { } } - /* ---------- OVERRIDEABLE FUNCTIONS ---------- */ + /* ---------- OVERRIDEABLE FUNCTIONS ---------- */ /** * @return the Color Modulation the Material is going to be rendered with. @@ -86,12 +93,13 @@ public abstract class GT_MetaGenerated_Item_X32 extends GT_MetaGenerated_Item { * @return if this Item should be generated and visible. */ public boolean doesMaterialAllowGeneration(OrePrefixes aPrefix, Materials aMaterial) { - // You have to check for at least these Conditions in every Case! So add a super Call like the following for this before executing your Code: + // You have to check for at least these Conditions in every Case! So add a super Call like the following for + // this before executing your Code: // if (!super.doesMaterialAllowGeneration(aPrefix, aMaterial)) return false; return aPrefix != null && aMaterial != null && aPrefix.doGenerateItem(aMaterial); } - /* ---------- OVERRIDEABLE FUNCTIONS ---------- */ + /* ---------- OVERRIDEABLE FUNCTIONS ---------- */ /** * @param aPrefix the OreDict Prefix @@ -119,7 +127,10 @@ public abstract class GT_MetaGenerated_Item_X32 extends GT_MetaGenerated_Item { * @return an Icon Container for the Item Display. */ public final IIconContainer getIconContainer(int aMetaData, Materials aMaterial) { - return mGeneratedPrefixList[aMetaData / 1000] != null && mGeneratedPrefixList[aMetaData / 1000].mTextureIndex >= 0 ? aMaterial.mIconSet.mTextures[mGeneratedPrefixList[aMetaData / 1000].mTextureIndex] : null; + return mGeneratedPrefixList[aMetaData / 1000] != null + && mGeneratedPrefixList[aMetaData / 1000].mTextureIndex >= 0 + ? aMaterial.mIconSet.mTextures[mGeneratedPrefixList[aMetaData / 1000].mTextureIndex] + : null; } /** @@ -132,15 +143,14 @@ public abstract class GT_MetaGenerated_Item_X32 extends GT_MetaGenerated_Item { return true; } - /* ---------- INTERNAL OVERRIDES ---------- */ + /* ---------- INTERNAL OVERRIDES ---------- */ @Override public String getItemStackDisplayName(ItemStack aStack) { - String aName = super.getItemStackDisplayName(aStack); - int aDamage = aStack.getItemDamage(); - if (aDamage < 32000 && aDamage >= 0) - return Materials.getLocalizedNameForItem(aName, aDamage % 1000); - return aName; + String aName = super.getItemStackDisplayName(aStack); + int aDamage = aStack.getItemDamage(); + if (aDamage < 32000 && aDamage >= 0) return Materials.getLocalizedNameForItem(aName, aDamage % 1000); + return aName; } @Override @@ -158,12 +168,16 @@ public abstract class GT_MetaGenerated_Item_X32 extends GT_MetaGenerated_Item { @Override public final IIconContainer getIconContainer(int aMetaData) { - return GregTech_API.sGeneratedMaterials[aMetaData % 1000] == null ? null : getIconContainer(aMetaData, GregTech_API.sGeneratedMaterials[aMetaData % 1000]); + return GregTech_API.sGeneratedMaterials[aMetaData % 1000] == null + ? null + : getIconContainer(aMetaData, GregTech_API.sGeneratedMaterials[aMetaData % 1000]); } @Override public GT_GeneratedMaterial_Renderer getMaterialRenderer(int aMetaData) { - return GregTech_API.sGeneratedMaterials[aMetaData % 1000] == null ? null : GregTech_API.sGeneratedMaterials[aMetaData % 1000].renderer; + return GregTech_API.sGeneratedMaterials[aMetaData % 1000] == null + ? null + : GregTech_API.sGeneratedMaterials[aMetaData % 1000].renderer; } @Override @@ -173,7 +187,8 @@ public abstract class GT_MetaGenerated_Item_X32 extends GT_MetaGenerated_Item { OrePrefixes aPrefix = mGeneratedPrefixList[i / 1000]; Materials aMaterial = GregTech_API.sGeneratedMaterials[i % 1000]; if (aPrefix != null && aMaterial != null) { - if (doesMaterialAllowGeneration(aPrefix, aMaterial) && doesShowInCreative(aPrefix, aMaterial, GregTech_API.sDoShowAllItemsInCreative)) { + if (doesMaterialAllowGeneration(aPrefix, aMaterial) + && doesShowInCreative(aPrefix, aMaterial, GregTech_API.sDoShowAllItemsInCreative)) { ItemStack tStack = new ItemStack(this, 1, i); isItemStackUsable(tStack); aList.add(tStack); 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 7d94d73293..a7d31332a8 100644 --- a/src/main/java/gregtech/api/items/GT_MetaGenerated_Tool.java +++ b/src/main/java/gregtech/api/items/GT_MetaGenerated_Tool.java @@ -1,5 +1,9 @@ package gregtech.api.items; +import static gregtech.api.enums.GT_Values.MOD_ID_FR; +import static gregtech.api.enums.GT_Values.MOD_ID_RC; +import static gregtech.common.tileentities.machines.multi.GT_MetaTileEntity_LargeTurbine_Steam.calculateLooseFlow; + import buildcraft.api.tools.IToolWrench; import cpw.mods.fml.common.Mod; import cpw.mods.fml.common.Optional; @@ -19,6 +23,11 @@ import gregtech.api.util.GT_ModHandler; import gregtech.api.util.GT_OreDictUnificator; import gregtech.api.util.GT_Utility; import gregtech.common.tools.GT_Tool_Turbine; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map.Entry; +import java.util.concurrent.ConcurrentHashMap; import mods.railcraft.api.core.items.IToolCrowbar; import net.minecraft.block.Block; import net.minecraft.client.renderer.texture.IIconRegister; @@ -46,31 +55,29 @@ import net.minecraftforge.common.IShearable; import net.minecraftforge.event.entity.player.PlayerEvent; import net.minecraftforge.event.world.BlockEvent; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map.Entry; -import java.util.concurrent.ConcurrentHashMap; - -import static gregtech.api.enums.GT_Values.MOD_ID_FR; -import static gregtech.api.enums.GT_Values.MOD_ID_RC; -import static gregtech.common.tileentities.machines.multi.GT_MetaTileEntity_LargeTurbine_Steam.calculateLooseFlow; - /** * This is an example on how you can create a Tool ItemStack, in this case a Bismuth Wrench: * GT_MetaGenerated_Tool.sInstances.get("gt.metatool.01").getToolWithStats(GT_MetaGenerated_Tool_01.WRENCH, 1, Materials.Bismuth, Materials.Bismuth, null); */ -@Optional.InterfaceList(value = {@Optional.Interface(iface = "forestry.api.arboriculture.IToolGrafter", modid = MOD_ID_FR), @Optional.Interface(iface = "mods.railcraft.api.core.items.IToolCrowbar", modid = MOD_ID_RC), @Optional.Interface(iface = "buildcraft.api.tools.IToolWrench", modid = "BuildCraft"), @Optional.Interface(iface = "crazypants.enderio.api.tool.ITool", modid = "EnderIO")}) -public abstract class GT_MetaGenerated_Tool extends GT_MetaBase_Item implements IDamagableItem, IToolGrafter, IToolCrowbar, IToolWrench, ITool { +@Optional.InterfaceList( + value = { + @Optional.Interface(iface = "forestry.api.arboriculture.IToolGrafter", modid = MOD_ID_FR), + @Optional.Interface(iface = "mods.railcraft.api.core.items.IToolCrowbar", modid = MOD_ID_RC), + @Optional.Interface(iface = "buildcraft.api.tools.IToolWrench", modid = "BuildCraft"), + @Optional.Interface(iface = "crazypants.enderio.api.tool.ITool", modid = "EnderIO") + }) +public abstract class GT_MetaGenerated_Tool extends GT_MetaBase_Item + implements IDamagableItem, IToolGrafter, IToolCrowbar, IToolWrench, ITool { /** * All instances of this Item Class are listed here. * This gets used to register the Renderer to all Items of this Type, if useStandardMetaItemRenderer() returns true. * <p/> * You can also use the unlocalized Name gotten from getUnlocalizedName() as Key if you want to get a specific Item. */ - public static final ConcurrentHashMap<String, GT_MetaGenerated_Tool> sInstances = new ConcurrentHashMap<String, GT_MetaGenerated_Tool>(); + public static final ConcurrentHashMap<String, GT_MetaGenerated_Tool> sInstances = + new ConcurrentHashMap<String, GT_MetaGenerated_Tool>(); - /* ---------- CONSTRUCTOR AND MEMBER VARIABLES ---------- */ + /* ---------- CONSTRUCTOR AND MEMBER VARIABLES ---------- */ public final ConcurrentHashMap<Short, IToolStats> mToolStats = new ConcurrentHashMap<Short, IToolStats>(); @@ -86,7 +93,7 @@ public abstract class GT_MetaGenerated_Tool extends GT_MetaBase_Item implements sInstances.put(getUnlocalizedName(), this); } - /* ---------- FOR ADDING CUSTOM ITEMS INTO THE REMAINING 766 RANGE ---------- */ + /* ---------- FOR ADDING CUSTOM ITEMS INTO THE REMAINING 766 RANGE ---------- */ public static final Materials getPrimaryMaterial(ItemStack aStack) { NBTTagCompound aNBT = aStack.getTagCompound(); @@ -106,7 +113,7 @@ public abstract class GT_MetaGenerated_Tool extends GT_MetaBase_Item implements return Materials._NULL; } - /* ---------- INTERNAL OVERRIDES ---------- */ + /* ---------- INTERNAL OVERRIDES ---------- */ public static final long getToolMaxDamage(ItemStack aStack) { NBTTagCompound aNBT = aStack.getTagCompound(); @@ -148,13 +155,16 @@ public abstract class GT_MetaGenerated_Tool extends GT_MetaBase_Item implements * @param aOreDictNamesAndAspects The OreDict Names you want to give the Item. Also used to assign Thaumcraft Aspects. * @return An ItemStack containing the newly created Item, but without specific Stats. */ - public final ItemStack addTool(int aID, String aEnglish, String aToolTip, IToolStats aToolStats, Object... aOreDictNamesAndAspects) { + public final ItemStack addTool( + int aID, String aEnglish, String aToolTip, IToolStats aToolStats, Object... aOreDictNamesAndAspects) { if (aToolTip == null) aToolTip = ""; 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) + ".tooltip", "You need to recharge it"); + GT_LanguageManager.addStringLocalization( + getUnlocalizedName() + "." + (aID + 1) + ".name", aEnglish + " (Empty)"); + GT_LanguageManager.addStringLocalization( + getUnlocalizedName() + "." + (aID + 1) + ".tooltip", "You need to recharge it"); mToolStats.put((short) aID, aToolStats); mToolStats.put((short) (aID + 1), aToolStats); aToolStats.onStatsAddedToTool(this, aID); @@ -163,8 +173,7 @@ public abstract class GT_MetaGenerated_Tool extends GT_MetaBase_Item implements for (Object tOreDictNameOrAspect : aOreDictNamesAndAspects) { if (tOreDictNameOrAspect instanceof TC_AspectStack) ((TC_AspectStack) tOreDictNameOrAspect).addToAspectList(tAspects); - else - GT_OreDictUnificator.registerOre(tOreDictNameOrAspect, rStack); + else GT_OreDictUnificator.registerOre(tOreDictNameOrAspect, rStack); } if (GregTech_API.sThaumcraftCompat != null) GregTech_API.sThaumcraftCompat.registerThaumcraftAspectsToItem(rStack, tAspects, false); @@ -183,14 +192,17 @@ public abstract class GT_MetaGenerated_Tool extends GT_MetaBase_Item implements * @param aSecondaryMaterial Secondary (Rod/Handle) Material of this Tool * @param aElectricArray The Electric Stats of this Tool (or null if not electric) */ - public final ItemStack getToolWithStats(int aToolID, int aAmount, Materials aPrimaryMaterial, Materials aSecondaryMaterial, long[] aElectricArray) { + public final ItemStack getToolWithStats( + int aToolID, int aAmount, Materials aPrimaryMaterial, Materials aSecondaryMaterial, long[] aElectricArray) { ItemStack rStack = new ItemStack(this, aAmount, aToolID); IToolStats tToolStats = getToolStats(rStack); if (tToolStats != null) { NBTTagCompound tMainNBT = new NBTTagCompound(), tToolNBT = new NBTTagCompound(); if (aPrimaryMaterial != null) { tToolNBT.setString("PrimaryMaterial", aPrimaryMaterial.mName); - tToolNBT.setLong("MaxDamage", 100L * (long) (aPrimaryMaterial.mDurability * tToolStats.getMaxDurabilityMultiplier())); + tToolNBT.setLong( + "MaxDamage", + 100L * (long) (aPrimaryMaterial.mDurability * tToolStats.getMaxDurabilityMultiplier())); } if (aSecondaryMaterial != null) tToolNBT.setString("SecondaryMaterial", aSecondaryMaterial.mName); @@ -213,49 +225,86 @@ public abstract class GT_MetaGenerated_Tool extends GT_MetaBase_Item implements * Called by the Block Harvesting Event within the GT_Proxy */ @Mod.EventHandler - public void onHarvestBlockEvent(ArrayList<ItemStack> aDrops, ItemStack aStack, EntityPlayer aPlayer, Block aBlock, int aX, int aY, int aZ, byte aMetaData, int aFortune, boolean aSilkTouch, BlockEvent.HarvestDropsEvent aEvent) { + public void onHarvestBlockEvent( + ArrayList<ItemStack> aDrops, + ItemStack aStack, + EntityPlayer aPlayer, + Block aBlock, + int aX, + int aY, + int aZ, + byte aMetaData, + int aFortune, + boolean aSilkTouch, + BlockEvent.HarvestDropsEvent aEvent) { IToolStats tStats = getToolStats(aStack); if (isItemStackUsable(aStack) && getDigSpeed(aStack, aBlock, aMetaData) > 0.0F) - doDamage(aStack, tStats.convertBlockDrops(aDrops, aStack, aPlayer, aBlock, aX, aY, aZ, aMetaData, aFortune, aSilkTouch, aEvent) * tStats.getToolDamagePerDropConversion()); + doDamage( + aStack, + tStats.convertBlockDrops( + aDrops, + aStack, + aPlayer, + aBlock, + aX, + aY, + aZ, + aMetaData, + aFortune, + aSilkTouch, + aEvent) + * tStats.getToolDamagePerDropConversion()); } @Mod.EventHandler - public float onBlockBreakSpeedEvent(float aDefault, ItemStack aStack, EntityPlayer aPlayer, Block aBlock, int aX, int aY, int aZ, byte aMetaData, PlayerEvent.BreakSpeed aEvent) - { - IToolStats tStats = getToolStats(aStack); - return tStats == null ? aDefault : tStats.getMiningSpeed(aBlock, aMetaData, aDefault, aPlayer, aPlayer.worldObj, aX, aY, aZ); - } - - @Override - public boolean onBlockStartBreak(ItemStack aStack, int aX, int aY, int aZ, EntityPlayer aPlayer) - { - if(aPlayer.worldObj.isRemote){ - return false; - } - IToolStats tStats = getToolStats(aStack); - Block aBlock = aPlayer.worldObj.getBlock(aX, aY, aZ); - if (tStats.isChainsaw()&&(aBlock instanceof IShearable)) - { - IShearable target = (IShearable)aBlock; - if ((target.isShearable(aStack, aPlayer.worldObj, aX, aY, aZ))) - { - ArrayList<ItemStack> drops = target.onSheared(aStack, aPlayer.worldObj, aX, aY, aZ, EnchantmentHelper.getEnchantmentLevel(Enchantment.fortune.effectId, aStack)); - for (ItemStack stack : drops) - { - float f = 0.7F; - double d = itemRand.nextFloat() * f + (1.0F - f) * 0.5D; - double d1 = itemRand.nextFloat() * f + (1.0F - f) * 0.5D; - double d2 = itemRand.nextFloat() * f + (1.0F - f) * 0.5D; - EntityItem entityitem = new EntityItem(aPlayer.worldObj, aX + d, aY + d1, aZ + d2, stack); - entityitem.delayBeforeCanPickup = 10; - aPlayer.worldObj.spawnEntityInWorld(entityitem); - } - aPlayer.addStat(net.minecraft.stats.StatList.mineBlockStatArray[Block.getIdFromBlock(aBlock)], 1); - onBlockDestroyed(aStack, aPlayer.worldObj, aBlock, aX, aY, aZ, aPlayer); + public float onBlockBreakSpeedEvent( + float aDefault, + ItemStack aStack, + EntityPlayer aPlayer, + Block aBlock, + int aX, + int aY, + int aZ, + byte aMetaData, + PlayerEvent.BreakSpeed aEvent) { + IToolStats tStats = getToolStats(aStack); + return tStats == null + ? aDefault + : tStats.getMiningSpeed(aBlock, aMetaData, aDefault, aPlayer, aPlayer.worldObj, aX, aY, aZ); + } + + @Override + public boolean onBlockStartBreak(ItemStack aStack, int aX, int aY, int aZ, EntityPlayer aPlayer) { + if (aPlayer.worldObj.isRemote) { + return false; } - return false; - } - return super.onBlockStartBreak(aStack, aX, aY, aZ, aPlayer); + IToolStats tStats = getToolStats(aStack); + Block aBlock = aPlayer.worldObj.getBlock(aX, aY, aZ); + if (tStats.isChainsaw() && (aBlock instanceof IShearable)) { + IShearable target = (IShearable) aBlock; + if ((target.isShearable(aStack, aPlayer.worldObj, aX, aY, aZ))) { + ArrayList<ItemStack> drops = target.onSheared( + aStack, + aPlayer.worldObj, + aX, + aY, + aZ, + EnchantmentHelper.getEnchantmentLevel(Enchantment.fortune.effectId, aStack)); + for (ItemStack stack : drops) { + float f = 0.7F; + double d = itemRand.nextFloat() * f + (1.0F - f) * 0.5D; + double d1 = itemRand.nextFloat() * f + (1.0F - f) * 0.5D; + double d2 = itemRand.nextFloat() * f + (1.0F - f) * 0.5D; + EntityItem entityitem = new EntityItem(aPlayer.worldObj, aX + d, aY + d1, aZ + d2, stack); + entityitem.delayBeforeCanPickup = 10; + aPlayer.worldObj.spawnEntityInWorld(entityitem); + } + aPlayer.addStat(net.minecraft.stats.StatList.mineBlockStatArray[Block.getIdFromBlock(aBlock)], 1); + onBlockDestroyed(aStack, aPlayer.worldObj, aBlock, aX, aY, aZ, aPlayer); + } + return false; + } + return super.onBlockStartBreak(aStack, aX, aY, aZ, aPlayer); } @Override @@ -265,17 +314,46 @@ public abstract class GT_MetaGenerated_Tool extends GT_MetaBase_Item implements 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), tDamage = tStats.getNormalDamageAgainstEntity((float) aPlayer.getEntityAttribute(SharedMonsterAttributes.attackDamage).getAttributeValue() + getToolCombatDamage(aStack), 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() + + getToolCombatDamage(aStack), + aEntity, + aStack, + aPlayer); if (tDamage + tMagicDamage > 0.0F) { - boolean tCriticalHit = aPlayer.fallDistance > 0.0F && !aPlayer.onGround && !aPlayer.isOnLadder() && !aPlayer.isInWater() && !aPlayer.isPotionActive(Potion.blindness) && aPlayer.ridingEntity == null && aEntity instanceof EntityLivingBase; + boolean tCriticalHit = aPlayer.fallDistance > 0.0F + && !aPlayer.onGround + && !aPlayer.isOnLadder() + && !aPlayer.isInWater() + && !aPlayer.isPotionActive(Potion.blindness) + && aPlayer.ridingEntity == null + && aEntity instanceof EntityLivingBase; if (tCriticalHit && tDamage > 0.0F) tDamage *= 1.5F; tDamage += tMagicDamage; if (aEntity.attackEntityFrom(tStats.getDamageSource(aPlayer, aEntity), tDamage)) { if (aEntity instanceof EntityLivingBase) aEntity.setFire(EnchantmentHelper.getFireAspectModifier(aPlayer) * 4); - int tKnockcack = (aPlayer.isSprinting() ? 1 : 0) + (aEntity instanceof EntityLivingBase ? EnchantmentHelper.getKnockbackModifier(aPlayer, (EntityLivingBase) aEntity) : 0); + int tKnockcack = (aPlayer.isSprinting() ? 1 : 0) + + (aEntity instanceof EntityLivingBase + ? EnchantmentHelper.getKnockbackModifier(aPlayer, (EntityLivingBase) aEntity) + : 0); if (tKnockcack > 0) { - aEntity.addVelocity(-MathHelper.sin(aPlayer.rotationYaw * (float) Math.PI / 180.0F) * tKnockcack * 0.5F, 0.1D, MathHelper.cos(aPlayer.rotationYaw * (float) Math.PI / 180.0F) * tKnockcack * 0.5F); + aEntity.addVelocity( + -MathHelper.sin(aPlayer.rotationYaw * (float) Math.PI / 180.0F) * tKnockcack * 0.5F, + 0.1D, + MathHelper.cos(aPlayer.rotationYaw * (float) Math.PI / 180.0F) * tKnockcack * 0.5F); aPlayer.motionX *= 0.6D; aPlayer.motionZ *= 0.6D; aPlayer.setSprinting(false); @@ -289,7 +367,8 @@ public abstract class GT_MetaGenerated_Tool extends GT_MetaBase_Item implements 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()); } @@ -326,9 +405,8 @@ public abstract class GT_MetaGenerated_Tool extends GT_MetaBase_Item implements ItemStack tStack = new ItemStack(this, 1, i); isItemStackUsable(tStack); aList.add(tStack); - aList.add(getToolWithStats(i,1,Materials.Neutronium,Materials.Neutronium,null)); + aList.add(getToolWithStats(i, 1, Materials.Neutronium, Materials.Neutronium, null)); } - } } @@ -357,63 +435,207 @@ public abstract class GT_MetaGenerated_Tool extends GT_MetaBase_Item implements // Optimal Flow -> toolSpeed // EU/t -> toolCombatDamage, toolSpeed // Overflow Tier -> toolQuality - int aBaseEff=(int)(5+getToolCombatDamage(aStack))*1000; - int aOptFlow=GT_Utility.safeInt((long)Math.max(Float.MIN_NORMAL, ((GT_MetaGenerated_Tool) aStack.getItem()).getToolStats(aStack).getSpeedMultiplier() * ((GT_MetaGenerated_Tool) aStack.getItem()).getPrimaryMaterial(aStack).mToolSpeed * 50)); - aList.add(tOffset + 0, EnumChatFormatting.GRAY + String.format(transItem("001", "Durability: %s/%s"), "" + EnumChatFormatting.GREEN + (tMaxDamage - getToolDamage(aStack)) + " ", " " + tMaxDamage) + EnumChatFormatting.GRAY); - aList.add(tOffset + 1, EnumChatFormatting.GRAY + String.format(transItem("002", "%s lvl %s"), tMaterial.mLocalizedName + EnumChatFormatting.YELLOW, "" + getHarvestLevel(aStack, "")) + EnumChatFormatting.GRAY); - aList.add(tOffset + 2, EnumChatFormatting.WHITE + String.format(transItem("005", "Turbine Efficiency: %s"), "" + EnumChatFormatting.BLUE + (50.0F + (10.0F * getToolCombatDamage(aStack)))) + "%" + EnumChatFormatting.GRAY); - aList.add(tOffset + 3, EnumChatFormatting.WHITE + String.format(transItem("006", "Optimal Steam flow: %s L/t"), "" + EnumChatFormatting.GOLD + GT_Utility.safeInt((long) (Math.max(Float.MIN_NORMAL, tStats.getSpeedMultiplier() * getPrimaryMaterial(aStack).mToolSpeed * (1000 * getPrimaryMaterial(aStack).mSteamMultiplier / 20)))) + EnumChatFormatting.GRAY)); - aList.add(tOffset + 4, EnumChatFormatting.WHITE + String.format(transItem("900", "Energy from Optimal Steam Flow: %s EU/t"), "" + EnumChatFormatting.GOLD + GT_Utility.safeInt((long) (Math.max(Float.MIN_NORMAL, tStats.getSpeedMultiplier() * getPrimaryMaterial(aStack).mToolSpeed * (1000 * getPrimaryMaterial(aStack).mSteamMultiplier / 20)) * (50.0F + (10.0F * getToolCombatDamage(aStack))) / 200)) + EnumChatFormatting.GRAY)); + int aBaseEff = (int) (5 + getToolCombatDamage(aStack)) * 1000; + int aOptFlow = GT_Utility.safeInt((long) Math.max( + Float.MIN_NORMAL, + ((GT_MetaGenerated_Tool) aStack.getItem()) + .getToolStats(aStack) + .getSpeedMultiplier() + * ((GT_MetaGenerated_Tool) aStack.getItem()).getPrimaryMaterial(aStack).mToolSpeed + * 50)); + aList.add( + tOffset + 0, + EnumChatFormatting.GRAY + + String.format( + transItem("001", "Durability: %s/%s"), + "" + EnumChatFormatting.GREEN + (tMaxDamage - getToolDamage(aStack)) + " ", + " " + tMaxDamage) + + EnumChatFormatting.GRAY); + aList.add( + tOffset + 1, + EnumChatFormatting.GRAY + + String.format( + transItem("002", "%s lvl %s"), + tMaterial.mLocalizedName + EnumChatFormatting.YELLOW, + "" + getHarvestLevel(aStack, "")) + + EnumChatFormatting.GRAY); + aList.add( + tOffset + 2, + EnumChatFormatting.WHITE + + String.format( + transItem("005", "Turbine Efficiency: %s"), + "" + EnumChatFormatting.BLUE + (50.0F + (10.0F * getToolCombatDamage(aStack)))) + + "%" + EnumChatFormatting.GRAY); + aList.add( + tOffset + 3, + EnumChatFormatting.WHITE + + String.format( + transItem("006", "Optimal Steam flow: %s L/t"), + "" + EnumChatFormatting.GOLD + + GT_Utility.safeInt((long) (Math.max( + Float.MIN_NORMAL, + tStats.getSpeedMultiplier() + * getPrimaryMaterial(aStack).mToolSpeed + * (1000 + * getPrimaryMaterial(aStack).mSteamMultiplier + / 20)))) + + EnumChatFormatting.GRAY)); + aList.add( + tOffset + 4, + EnumChatFormatting.WHITE + + String.format( + transItem("900", "Energy from Optimal Steam Flow: %s EU/t"), + "" + EnumChatFormatting.GOLD + + GT_Utility.safeInt((long) (Math.max( + Float.MIN_NORMAL, + tStats.getSpeedMultiplier() + * getPrimaryMaterial(aStack).mToolSpeed + * (1000 + * getPrimaryMaterial(aStack) + .mSteamMultiplier + / 20)) + * (50.0F + (10.0F * getToolCombatDamage(aStack))) + / 200)) + + EnumChatFormatting.GRAY)); { long[] calculatedFlow = calculateLooseFlow(aOptFlow, aBaseEff); int aOptFlowLoose = (int) calculatedFlow[0]; int aBaseEffLoose = (int) calculatedFlow[1]; - aList.add(tOffset + 5, EnumChatFormatting.AQUA + String.format(transItem("500", "Turbine Efficiency (Loose): %s"), "" + EnumChatFormatting.BLUE + aBaseEffLoose / 100 + "%" + EnumChatFormatting.GRAY)); - aList.add(tOffset + 6, EnumChatFormatting.AQUA + String.format(transItem("501", "Optimal Steam flow (Loose): %s L/t"), "" + EnumChatFormatting.GOLD + (aOptFlowLoose * getPrimaryMaterial(aStack).mSteamMultiplier) + EnumChatFormatting.GRAY)); - aList.add(tOffset + 7, EnumChatFormatting.AQUA + String.format(transItem("901", "Energy from Optimal Steam Flow (Loose): %s EU/t"), "" + EnumChatFormatting.GOLD + (aOptFlowLoose * getPrimaryMaterial(aStack).mSteamMultiplier/ 10000) * (aBaseEffLoose / 2) + EnumChatFormatting.GRAY)); - aList.add(tOffset + 8, EnumChatFormatting.GRAY + "(Superheated Steam EU values are 2x those of Steam)"); - - + aList.add( + tOffset + 5, + EnumChatFormatting.AQUA + + String.format( + transItem("500", "Turbine Efficiency (Loose): %s"), + "" + EnumChatFormatting.BLUE + aBaseEffLoose / 100 + "%" + + EnumChatFormatting.GRAY)); + aList.add( + tOffset + 6, + EnumChatFormatting.AQUA + + String.format( + transItem("501", "Optimal Steam flow (Loose): %s L/t"), + "" + EnumChatFormatting.GOLD + + (aOptFlowLoose * getPrimaryMaterial(aStack).mSteamMultiplier) + + EnumChatFormatting.GRAY)); + aList.add( + tOffset + 7, + EnumChatFormatting.AQUA + + String.format( + transItem("901", "Energy from Optimal Steam Flow (Loose): %s EU/t"), + "" + EnumChatFormatting.GOLD + + (aOptFlowLoose + * getPrimaryMaterial(aStack).mSteamMultiplier + / 10000) + * (aBaseEffLoose / 2) + + EnumChatFormatting.GRAY)); + aList.add( + tOffset + 8, + EnumChatFormatting.GRAY + "(Superheated Steam EU values are 2x those of Steam)"); } - aList.add(tOffset + 9, EnumChatFormatting.LIGHT_PURPLE + String.format(transItem("007", "Energy from Optimal Gas Flow: %s EU/t"), "" + EnumChatFormatting.GOLD + GT_Utility.safeInt((long) (Math.max(Float.MIN_NORMAL, tStats.getSpeedMultiplier() * getPrimaryMaterial(aStack).mToolSpeed * 50 * getPrimaryMaterial(aStack).mGasMultiplier) * (50.0F + (10.0F * getToolCombatDamage(aStack))) / 100)) + EnumChatFormatting.GRAY)); - aList.add(tOffset + 10, EnumChatFormatting.LIGHT_PURPLE + String.format(transItem("008", "Energy from Optimal Plasma Flow: %s EU/t"), "" + EnumChatFormatting.GOLD + GT_Utility.safeInt((long) (Math.max(Float.MIN_NORMAL, tStats.getSpeedMultiplier() * getPrimaryMaterial(aStack).mToolSpeed * 2000 * getPrimaryMaterial(aStack).mPlasmaMultiplier) * (50.0F + (10.0F * getToolCombatDamage(aStack))) * (1.05 / 100))) + EnumChatFormatting.GRAY)); - aList.add(tOffset + 12, EnumChatFormatting.GRAY + "(EU/t values include efficiency and are not 100% accurate)"); + aList.add( + tOffset + 9, + EnumChatFormatting.LIGHT_PURPLE + + String.format( + transItem("007", "Energy from Optimal Gas Flow: %s EU/t"), + "" + EnumChatFormatting.GOLD + + GT_Utility.safeInt((long) (Math.max( + Float.MIN_NORMAL, + tStats.getSpeedMultiplier() + * getPrimaryMaterial(aStack).mToolSpeed + * 50 + * getPrimaryMaterial(aStack).mGasMultiplier) + * (50.0F + (10.0F * getToolCombatDamage(aStack))) + / 100)) + + EnumChatFormatting.GRAY)); + aList.add( + tOffset + 10, + EnumChatFormatting.LIGHT_PURPLE + + String.format( + transItem("008", "Energy from Optimal Plasma Flow: %s EU/t"), + "" + EnumChatFormatting.GOLD + + GT_Utility.safeInt((long) (Math.max( + Float.MIN_NORMAL, + tStats.getSpeedMultiplier() + * getPrimaryMaterial(aStack).mToolSpeed + * 2000 + * getPrimaryMaterial(aStack).mPlasmaMultiplier) + * (50.0F + (10.0F * getToolCombatDamage(aStack))) + * (1.05 / 100))) + + EnumChatFormatting.GRAY)); + aList.add( + tOffset + 12, + EnumChatFormatting.GRAY + "(EU/t values include efficiency and are not 100% accurate)"); int toolQualityLevel = GT_MetaGenerated_Tool.getPrimaryMaterial(aStack).mToolQuality; int overflowMultiplier = 0; if (toolQualityLevel >= 6) { overflowMultiplier = 3; - } - else if (toolQualityLevel >= 3) { + } else if (toolQualityLevel >= 3) { overflowMultiplier = 2; - } - else { + } else { overflowMultiplier = 1; } - aList.add(tOffset + 11, EnumChatFormatting.LIGHT_PURPLE + String.format(transItem("502", "Overflow Efficiency Tier: %s"), "" + EnumChatFormatting.GOLD + overflowMultiplier + EnumChatFormatting.GRAY)); + aList.add( + tOffset + 11, + EnumChatFormatting.LIGHT_PURPLE + + String.format( + transItem("502", "Overflow Efficiency Tier: %s"), + "" + EnumChatFormatting.GOLD + overflowMultiplier + EnumChatFormatting.GRAY)); } else { - aList.add(tOffset + 0, EnumChatFormatting.WHITE + String.format(transItem("001", "Durability: %s/%s"), "" + EnumChatFormatting.GREEN + (tMaxDamage - getToolDamage(aStack)) + " ", " " + tMaxDamage) + EnumChatFormatting.GRAY); - aList.add(tOffset + 1, EnumChatFormatting.WHITE + String.format(transItem("002", "%s lvl %s"), tMaterial.mLocalizedName + EnumChatFormatting.YELLOW, "" + getHarvestLevel(aStack, "")) + EnumChatFormatting.GRAY); - aList.add(tOffset + 2, EnumChatFormatting.WHITE + String.format(transItem("003", "Attack Damage: %s"), "" + EnumChatFormatting.BLUE + getToolCombatDamage(aStack)) + EnumChatFormatting.GRAY); - aList.add(tOffset + 3, EnumChatFormatting.WHITE + String.format(transItem("004", "Mining Speed: %s"), "" + EnumChatFormatting.GOLD + Math.max(Float.MIN_NORMAL, tStats.getSpeedMultiplier() * getPrimaryMaterial(aStack).mToolSpeed)) + EnumChatFormatting.GRAY); + aList.add( + tOffset + 0, + EnumChatFormatting.WHITE + + String.format( + transItem("001", "Durability: %s/%s"), + "" + EnumChatFormatting.GREEN + (tMaxDamage - getToolDamage(aStack)) + " ", + " " + tMaxDamage) + + EnumChatFormatting.GRAY); + aList.add( + tOffset + 1, + EnumChatFormatting.WHITE + + String.format( + transItem("002", "%s lvl %s"), + tMaterial.mLocalizedName + EnumChatFormatting.YELLOW, + "" + getHarvestLevel(aStack, "")) + + EnumChatFormatting.GRAY); + aList.add( + tOffset + 2, + EnumChatFormatting.WHITE + + String.format( + transItem("003", "Attack Damage: %s"), + "" + EnumChatFormatting.BLUE + getToolCombatDamage(aStack)) + + EnumChatFormatting.GRAY); + aList.add( + tOffset + 3, + EnumChatFormatting.WHITE + + String.format( + transItem("004", "Mining Speed: %s"), + "" + EnumChatFormatting.GOLD + + Math.max( + Float.MIN_NORMAL, + tStats.getSpeedMultiplier() + * getPrimaryMaterial(aStack).mToolSpeed)) + + EnumChatFormatting.GRAY); NBTTagCompound aNBT = aStack.getTagCompound(); if (aNBT != null) { aNBT = aNBT.getCompoundTag("GT.ToolStats"); - if (aNBT != null && aNBT.hasKey("Heat")){ - int tHeat = aNBT.getInteger("Heat"); - long tWorldTime = aPlayer.getEntityWorld().getWorldTime(); - if(aNBT.hasKey("HeatTime")){ - long tHeatTime = aNBT.getLong("HeatTime"); - if(tWorldTime>(tHeatTime+10)){ - tHeat = (int) (tHeat - ((tWorldTime-tHeatTime)/10)); - if(tHeat<300&&tHeat>-10000)tHeat=300; - } - aNBT.setLong("HeatTime", tWorldTime); - if(tHeat>-10000)aNBT.setInteger("Heat", tHeat); - } - - aList.add(tOffset + 3, EnumChatFormatting.RED + "Heat: " + aNBT.getInteger("Heat")+" K" + EnumChatFormatting.GRAY); + if (aNBT != null && aNBT.hasKey("Heat")) { + int tHeat = aNBT.getInteger("Heat"); + long tWorldTime = aPlayer.getEntityWorld().getWorldTime(); + if (aNBT.hasKey("HeatTime")) { + long tHeatTime = aNBT.getLong("HeatTime"); + if (tWorldTime > (tHeatTime + 10)) { + tHeat = (int) (tHeat - ((tWorldTime - tHeatTime) / 10)); + if (tHeat < 300 && tHeat > -10000) tHeat = 300; + } + aNBT.setLong("HeatTime", tWorldTime); + if (tHeat > -10000) aNBT.setInteger("Heat", tHeat); + } + + aList.add( + tOffset + 3, + EnumChatFormatting.RED + "Heat: " + aNBT.getInteger("Heat") + " K" + + EnumChatFormatting.GRAY); } } } @@ -431,7 +653,12 @@ public abstract class GT_MetaGenerated_Tool extends GT_MetaBase_Item implements if (aNBT != null) { aNBT = aNBT.getCompoundTag("GT.ToolStats"); if (aNBT != null && aNBT.getBoolean("Electric")) - return new Long[]{aNBT.getLong("MaxCharge"), aNBT.getLong("Voltage"), aNBT.getLong("Tier"), aNBT.getLong("SpecialData")}; + return new Long[] { + aNBT.getLong("MaxCharge"), + aNBT.getLong("Voltage"), + aNBT.getLong("Tier"), + aNBT.getLong("SpecialData") + }; } return null; } @@ -458,7 +685,6 @@ public abstract class GT_MetaGenerated_Tool extends GT_MetaBase_Item implements if (tStats == null || GT_Utility.setStack(aStack, tStats.getBrokenItem(aStack)) == null) { if (tStats != null) GT_Utility.doSoundAtClient(tStats.getBreakingSound(), 1, 1.0F); if (aStack.stackSize > 0) aStack.stackSize--; - } } return true; @@ -485,7 +711,9 @@ public abstract class GT_MetaGenerated_Tool extends GT_MetaBase_Item implements if (!isItemStackUsable(aStack)) return 0.0F; IToolStats tStats = getToolStats(aStack); if (tStats == null || Math.max(0, getHarvestLevel(aStack, "")) < aBlock.getHarvestLevel(aMetaData)) return 0.0F; - return tStats.isMinableBlock(aBlock, (byte) aMetaData) ? Math.max(Float.MIN_NORMAL, tStats.getSpeedMultiplier() * getPrimaryMaterial(aStack).mToolSpeed) : 0.0F; + return tStats.isMinableBlock(aBlock, (byte) aMetaData) + ? Math.max(Float.MIN_NORMAL, tStats.getSpeedMultiplier() * getPrimaryMaterial(aStack).mToolSpeed) + : 0.0F; } @Override @@ -500,12 +728,14 @@ public abstract class GT_MetaGenerated_Tool extends GT_MetaBase_Item implements } @Override - public boolean onBlockDestroyed(ItemStack aStack, World aWorld, Block aBlock, int aX, int aY, int aZ, EntityLivingBase aPlayer) { + public boolean onBlockDestroyed( + ItemStack aStack, World aWorld, Block aBlock, int aX, int aY, int aZ, EntityLivingBase aPlayer) { if (!isItemStackUsable(aStack)) return false; IToolStats tStats = getToolStats(aStack); if (tStats == null) return false; GT_Utility.doSoundAtClient(tStats.getMiningSound(), 1, 1.0F); - doDamage(aStack, (int) Math.max(1, aBlock.getBlockHardness(aWorld, aX, aY, aZ) * tStats.getToolDamagePerBlockBreak())); + doDamage(aStack, (int) + Math.max(1, aBlock.getBlockHardness(aWorld, aX, aY, aZ) * tStats.getToolDamagePerBlockBreak())); return getDigSpeed(aStack, aBlock, aWorld.getBlockMetadata(aX, aY, aZ)) > 0.0F; } @@ -527,7 +757,7 @@ public abstract class GT_MetaGenerated_Tool extends GT_MetaBase_Item implements doDamage(aStack, tStats.getToolDamagePerContainerCraft()); aStack = aStack.stackSize > 0 ? aStack : null; if (playSound && GT_Mod.gregtechproxy.mTicksUntilNextCraftSound <= 0) { - GT_Mod.gregtechproxy.mTicksUntilNextCraftSound = 10; + GT_Mod.gregtechproxy.mTicksUntilNextCraftSound = 10; String sound = (aStack == null) ? tStats.getBreakingSound() : tStats.getCraftingSound(); GT_Utility.doSoundAtClient(sound, 1, 1.0F); } @@ -546,7 +776,9 @@ public abstract class GT_MetaGenerated_Tool extends GT_MetaBase_Item implements @Override public float getSaplingModifier(ItemStack aStack, World aWorld, EntityPlayer aPlayer, int aX, int aY, int aZ) { IToolStats tStats = getToolStats(aStack); - return tStats != null && tStats.isGrafter() ? Math.min(100.0F, (1 + getHarvestLevel(aStack, "")) * 20.0F) : 0.0F; + return tStats != null && tStats.isGrafter() + ? Math.min(100.0F, (1 + getHarvestLevel(aStack, "")) * 20.0F) + : 0.0F; } @Override @@ -562,42 +794,41 @@ public abstract class GT_MetaGenerated_Tool extends GT_MetaBase_Item implements if (tStats != null) doDamage(aStack, tStats.getToolDamagePerEntityAttack()); } - @Override - public boolean canWrench(EntityPlayer player, int x, int y, int z) { - if(player==null)return false; - if(player.getCurrentEquippedItem()==null)return false; + @Override + public boolean canWrench(EntityPlayer player, int x, int y, int z) { + if (player == null) return false; + if (player.getCurrentEquippedItem() == null) return false; if (!isItemStackUsable(player.getCurrentEquippedItem())) return false; IToolStats tStats = getToolStats(player.getCurrentEquippedItem()); return tStats != null && tStats.isWrench(); - } + } - @Override - public void wrenchUsed(EntityPlayer player, int x, int y, int z) { - if(player==null)return; - if(player.getCurrentEquippedItem()==null)return; + @Override + public void wrenchUsed(EntityPlayer player, int x, int y, int z) { + if (player == null) return; + if (player.getCurrentEquippedItem() == null) return; IToolStats tStats = getToolStats(player.getCurrentEquippedItem()); if (tStats != null) doDamage(player.getCurrentEquippedItem(), tStats.getToolDamagePerEntityAttack()); - } - - @Override - public boolean canUse(ItemStack stack, EntityPlayer player, int x, int y, int z){ - return canWrench(player, x, y, z); - } - - @Override - public void used(ItemStack stack, EntityPlayer player, int x, int y, int z){ - wrenchUsed(player, x, y, z); - } - - @Override - public boolean shouldHideFacades(ItemStack stack, EntityPlayer player) { - if(player==null)return false; - if(player.getCurrentEquippedItem()==null)return false; - if (!isItemStackUsable(player.getCurrentEquippedItem())) return false; - IToolStats tStats = getToolStats(player.getCurrentEquippedItem()); - return tStats.isWrench(); - } + } + + @Override + public boolean canUse(ItemStack stack, EntityPlayer player, int x, int y, int z) { + return canWrench(player, x, y, z); + } + + @Override + public void used(ItemStack stack, EntityPlayer player, int x, int y, int z) { + wrenchUsed(player, x, y, z); + } + @Override + public boolean shouldHideFacades(ItemStack stack, EntityPlayer player) { + if (player == null) return false; + if (player.getCurrentEquippedItem() == null) return false; + if (!isItemStackUsable(player.getCurrentEquippedItem())) return false; + IToolStats tStats = getToolStats(player.getCurrentEquippedItem()); + return tStats.isWrench(); + } @Override public boolean canLink(EntityPlayer aPlayer, ItemStack aStack, EntityMinecart cart) { @@ -671,10 +902,14 @@ public abstract class GT_MetaGenerated_Tool extends GT_MetaBase_Item implements for (int i = 0; i < tEnchants.length; i++) if (tLevels[i] > 0) { Integer tLevel = tMap.get(tEnchants[i].effectId); - tMap.put(tEnchants[i].effectId, tLevel == null ? tLevels[i] : tLevel == tLevels[i] ? tLevel + 1 : Math.max(tLevel, tLevels[i])); + tMap.put( + tEnchants[i].effectId, + tLevel == null ? tLevels[i] : tLevel == tLevels[i] ? tLevel + 1 : Math.max(tLevel, tLevels[i])); } for (Entry<Integer, Integer> tEntry : tMap.entrySet()) { - if (tEntry.getKey() == 33 || (tEntry.getKey() == 20 && tEntry.getValue() > 2) || tEntry.getKey() == Enchantment_Radioactivity.INSTANCE.effectId) + if (tEntry.getKey() == 33 + || (tEntry.getKey() == 20 && tEntry.getValue() > 2) + || tEntry.getKey() == Enchantment_Radioactivity.INSTANCE.effectId) tResult.put(tEntry.getKey(), tEntry.getValue()); else switch (Enchantment.enchantmentsList[tEntry.getKey()].type) { 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 7950672ec2..894c03db90 100644 --- a/src/main/java/gregtech/api/items/GT_RadioactiveCellIC_Item.java +++ b/src/main/java/gregtech/api/items/GT_RadioactiveCellIC_Item.java @@ -1,20 +1,16 @@ package gregtech.api.items; - import gregtech.api.GregTech_API; import gregtech.api.util.GT_Utility; import ic2.api.reactor.IReactor; import ic2.api.reactor.IReactorComponent; import ic2.core.IC2Potion; -import ic2.core.item.armor.ItemArmorHazmat; +import java.util.ArrayList; import net.minecraft.entity.Entity; import net.minecraft.entity.EntityLivingBase; import net.minecraft.item.ItemStack; import net.minecraft.world.World; -import java.util.ArrayList; - - public class GT_RadioactiveCellIC_Item extends GT_RadioactiveCell_Item implements IReactorComponent { public final int numberOfCells; public final float sEnergy; @@ -23,7 +19,16 @@ public class GT_RadioactiveCellIC_Item extends GT_RadioactiveCell_Item implement public final ItemStack sDepleted; public final boolean sMox; - public GT_RadioactiveCellIC_Item(String aUnlocalized, String aEnglish, int aCellcount, int maxDamage, float aEnergy, int aRadiation, float aHeat, ItemStack aDepleted, boolean aMox) { + public GT_RadioactiveCellIC_Item( + String aUnlocalized, + String aEnglish, + int aCellcount, + int maxDamage, + float aEnergy, + int aRadiation, + float aHeat, + ItemStack aDepleted, + boolean aMox) { super(aUnlocalized, aEnglish, aCellcount); setMaxStackSize(64); this.maxDmg = maxDamage; @@ -33,13 +38,14 @@ public class GT_RadioactiveCellIC_Item extends GT_RadioactiveCell_Item implement this.sHeat = aHeat; this.sDepleted = aDepleted; this.sMox = aMox; - } 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))) { + if ((other != null) + && ((other.getItem() instanceof IReactorComponent)) + && (((IReactorComponent) other.getItem()) + .acceptUraniumPulse(reactor, other, me, x, y, mex, mey, heatrun))) { return 1; } return 0; @@ -56,16 +62,22 @@ public class GT_RadioactiveCellIC_Item extends GT_RadioactiveCell_Item implement for (int i = 0; i < pulses; i++) { acceptUraniumPulse(reactor, yourStack, yourStack, x, y, x, y, heatrun); } - checkPulseable(reactor, x - 1, y, yourStack, x, y, heatrun);checkPulseable(reactor, x + 1, y, yourStack, x, y, heatrun);checkPulseable(reactor, x, y - 1, yourStack, x, y, heatrun);checkPulseable(reactor, x, y + 1, yourStack, x, y, heatrun); + checkPulseable(reactor, x - 1, y, yourStack, x, y, heatrun); + checkPulseable(reactor, x + 1, y, yourStack, x, y, heatrun); + checkPulseable(reactor, x, y - 1, yourStack, x, y, heatrun); + checkPulseable(reactor, x, y + 1, yourStack, x, y, heatrun); } else { - pulses += checkPulseable(reactor, x - 1, y, yourStack, x, y, heatrun) + checkPulseable(reactor, x + 1, y, yourStack, x, y, heatrun) + checkPulseable(reactor, x, y - 1, yourStack, x, y, heatrun) + checkPulseable(reactor, x, y + 1, yourStack, x, y, heatrun); + pulses += checkPulseable(reactor, x - 1, y, yourStack, x, y, heatrun) + + checkPulseable(reactor, x + 1, y, yourStack, x, y, heatrun) + + checkPulseable(reactor, x, y - 1, yourStack, x, y, heatrun) + + checkPulseable(reactor, x, y + 1, yourStack, x, y, heatrun); -// int heat = sumUp(pulses) * 4; + // int heat = sumUp(pulses) * 4; int heat = triangularNumber(pulses) * 4; - + heat = getFinalHeat(reactor, yourStack, x, y, heat); - + ArrayList<ItemStackCoord> heatAcceptors = new ArrayList(); checkHeatAcceptor(reactor, x - 1, y, heatAcceptors); checkHeatAcceptor(reactor, x + 1, y, heatAcceptors); @@ -76,7 +88,13 @@ public class GT_RadioactiveCellIC_Item extends GT_RadioactiveCell_Item implement int dheat = heat / heatAcceptors.size(); heat -= dheat; - dheat = ((IReactorComponent) ((ItemStackCoord) heatAcceptors.get(0)).stack.getItem()).alterHeat(reactor, ((ItemStackCoord) heatAcceptors.get(0)).stack, ((ItemStackCoord) heatAcceptors.get(0)).x, ((ItemStackCoord) heatAcceptors.get(0)).y, dheat); + dheat = ((IReactorComponent) ((ItemStackCoord) heatAcceptors.get(0)).stack.getItem()) + .alterHeat( + reactor, + ((ItemStackCoord) heatAcceptors.get(0)).stack, + ((ItemStackCoord) heatAcceptors.get(0)).x, + ((ItemStackCoord) heatAcceptors.get(0)).y, + dheat); heat += dheat; heatAcceptors.remove(0); } @@ -86,41 +104,49 @@ public class GT_RadioactiveCellIC_Item extends GT_RadioactiveCell_Item implement } } if (getDamageOfStack(yourStack) >= getMaxDamageEx() - 1) { - reactor.setItemAt(x, y, sDepleted.copy()); + reactor.setItemAt(x, y, sDepleted.copy()); } else if (heatrun) { damageItemStack(yourStack, 1); } } - - protected int getFinalHeat(IReactor reactor, ItemStack stack, int x, int y, int heat) - { - if (sMox&&reactor.isFluidCooled()) - { - float breedereffectiveness = (float)reactor.getHeat() / (float)reactor.getMaxHeat(); - if (breedereffectiveness > 0.5D) { - heat *= 2; + + protected int getFinalHeat(IReactor reactor, ItemStack stack, int x, int y, int heat) { + if (sMox && reactor.isFluidCooled()) { + float breedereffectiveness = (float) reactor.getHeat() / (float) reactor.getMaxHeat(); + if (breedereffectiveness > 0.5D) { + heat *= 2; + } } - } - return heat; + return heat; } private void checkHeatAcceptor(IReactor reactor, int x, int y, ArrayList<ItemStackCoord> heatAcceptors) { ItemStack thing = reactor.getItemAt(x, y); - if ((thing != null) && ((thing.getItem() instanceof IReactorComponent)) && - (((IReactorComponent) thing.getItem()).canStoreHeat(reactor, thing, x, y))) { + if ((thing != null) + && ((thing.getItem() instanceof IReactorComponent)) + && (((IReactorComponent) thing.getItem()).canStoreHeat(reactor, thing, x, y))) { heatAcceptors.add(new ItemStackCoord(thing, x, y)); } } @Override - public boolean acceptUraniumPulse(IReactor reactor, ItemStack yourStack, ItemStack pulsingStack, int youX, int youY, int pulseX, int pulseY, boolean heatrun) { - if (!heatrun) { - if(sMox){ - float breedereffectiveness = (float)reactor.getHeat() / (float)reactor.getMaxHeat(); - float ReaktorOutput = 1.5F * breedereffectiveness + 1.0F; - reactor.addOutput(ReaktorOutput * this.sEnergy); - }else{ - reactor.addOutput((float) (1.0F * this.sEnergy));} + public boolean acceptUraniumPulse( + IReactor reactor, + ItemStack yourStack, + ItemStack pulsingStack, + int youX, + int youY, + int pulseX, + int pulseY, + boolean heatrun) { + if (!heatrun) { + if (sMox) { + float breedereffectiveness = (float) reactor.getHeat() / (float) reactor.getMaxHeat(); + float ReaktorOutput = 1.5F * breedereffectiveness + 1.0F; + reactor.addOutput(ReaktorOutput * this.sEnergy); + } else { + reactor.addOutput((float) (1.0F * this.sEnergy)); + } } return true; } @@ -154,7 +180,7 @@ public class GT_RadioactiveCellIC_Item extends GT_RadioactiveCell_Item implement public void onUpdate(ItemStack stack, World world, Entity entity, int slotIndex, boolean isCurrentItem) { if (this.sRadiation > 0 && (entity instanceof EntityLivingBase)) { EntityLivingBase entityLiving = (EntityLivingBase) entity; - if (!GregTech_API.mIC2Classic&&!GT_Utility.isWearingFullRadioHazmat(entityLiving)) { + if (!GregTech_API.mIC2Classic && !GT_Utility.isWearingFullRadioHazmat(entityLiving)) { IC2Potion.radiation.applyTo(entityLiving, sRadiation * 20, sRadiation * 10); } } diff --git a/src/main/java/gregtech/api/items/GT_RadioactiveCell_Item.java b/src/main/java/gregtech/api/items/GT_RadioactiveCell_Item.java index e9c48991de..cff5bf38a8 100644 --- a/src/main/java/gregtech/api/items/GT_RadioactiveCell_Item.java +++ b/src/main/java/gregtech/api/items/GT_RadioactiveCell_Item.java @@ -3,15 +3,13 @@ package gregtech.api.items; import gregtech.common.items.GT_DepletetCell_Item; import ic2.api.item.IBoxable; import ic2.core.util.StackUtil; +import java.util.List; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.util.EnumChatFormatting; -import java.util.List; - -public class GT_RadioactiveCell_Item - extends GT_Generic_Item implements IBoxable{ +public class GT_RadioactiveCell_Item extends GT_Generic_Item implements IBoxable { protected int cellCount; protected int maxDmg; protected int dura; @@ -41,9 +39,8 @@ public class GT_RadioactiveCell_Item return b; } - protected static int triangularNumber(int x) - { - return (x * x + x) / 2; + protected static int triangularNumber(int x) { + return (x * x + x) / 2; } protected boolean outputPulseForStack(ItemStack aStack) { @@ -53,7 +50,7 @@ public class GT_RadioactiveCell_Item aStack.setTagCompound(tNBT); } tNBT.setInteger("output", tNBT.getInteger("output") + 1); - return false;//(this.pulserate > 0) || (tNBT.getInteger("output") % -this.pulserate == 0); + return false; // (this.pulserate > 0) || (tNBT.getInteger("output") % -this.pulserate == 0); } protected boolean incrementPulseForStack(ItemStack aStack) { @@ -63,7 +60,7 @@ public class GT_RadioactiveCell_Item aStack.setTagCompound(tNBT); } tNBT.setInteger("pulse", tNBT.getInteger("pulse") + 1); - return false;//(this.pulserate > 0) || (tNBT.getInteger("pulse") % -this.pulserate == 0); + return false; // (this.pulserate > 0) || (tNBT.getInteger("pulse") % -this.pulserate == 0); } protected void setDurabilityForStack(ItemStack aStack, int aDurability) { @@ -76,7 +73,7 @@ public class GT_RadioactiveCell_Item } public int getMaxNuclearDurability() { - return 0;//return this.maxDelay; + return 0; // return this.maxDelay; } public int func_77619_b() { @@ -133,24 +130,35 @@ public class GT_RadioactiveCell_Item @Override public void addAdditionalToolTips(List aList, ItemStack aStack, EntityPlayer aPlayer) { - super.addAdditionalToolTips(aList, aStack, aPlayer); - //aList.add("Time left: " + (this.maxDelay - getDurabilityOfStack(aStack)) + " secs"); + super.addAdditionalToolTips(aList, aStack, aPlayer); + // aList.add("Time left: " + (this.maxDelay - getDurabilityOfStack(aStack)) + " secs"); int rDmg = getDurabilityOfStack(aStack) * 6 / this.maxDmg; EnumChatFormatting color2; switch (rDmg) { - case 0: - case 1: color2 = EnumChatFormatting.WHITE; break; - case 2: - case 3: - case 4: color2 = EnumChatFormatting.GRAY; break; - default: color2 = EnumChatFormatting.DARK_GRAY; break; + case 0: + case 1: + color2 = EnumChatFormatting.WHITE; + break; + case 2: + case 3: + case 4: + color2 = EnumChatFormatting.GRAY; + break; + default: + color2 = EnumChatFormatting.DARK_GRAY; + break; } - EnumChatFormatting color1 = this instanceof GT_DepletetCell_Item ? color2 = EnumChatFormatting.DARK_GRAY : EnumChatFormatting.WHITE; - aList.add(color1 + String.format(transItem("001", "Durability: %s/%s"), "" + color2 + (this.maxDmg - getDurabilityOfStack(aStack)) + color1, "" + this.maxDmg)); + EnumChatFormatting color1 = + this instanceof GT_DepletetCell_Item ? color2 = EnumChatFormatting.DARK_GRAY : EnumChatFormatting.WHITE; + aList.add(color1 + + String.format( + transItem("001", "Durability: %s/%s"), + "" + color2 + (this.maxDmg - getDurabilityOfStack(aStack)) + color1, + "" + this.maxDmg)); } - @Override - public boolean canBeStoredInToolbox(ItemStack itemstack) { - return true; - } + @Override + public boolean canBeStoredInToolbox(ItemStack itemstack) { + return true; + } } diff --git a/src/main/java/gregtech/api/items/GT_SolderingTool_Item.java b/src/main/java/gregtech/api/items/GT_SolderingTool_Item.java index 7725785276..7dfe0409a1 100644 --- a/src/main/java/gregtech/api/items/GT_SolderingTool_Item.java +++ b/src/main/java/gregtech/api/items/GT_SolderingTool_Item.java @@ -1,36 +1,56 @@ package gregtech.api.items; +import static gregtech.api.enums.GT_Values.W; + import gregtech.api.GregTech_API; import gregtech.api.enums.ToolDictNames; import gregtech.api.util.GT_LanguageManager; import gregtech.api.util.GT_OreDictUnificator; +import java.util.List; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.ItemStack; import net.minecraft.world.World; -import java.util.List; - -import static gregtech.api.enums.GT_Values.W; - public class GT_SolderingTool_Item extends GT_Tool_Item { - public GT_SolderingTool_Item(String aUnlocalized, String aEnglish, int aMaxDamage, int aEntityDamage, int aDischargedGTID) { - super(aUnlocalized, aEnglish, "To repair and construct Circuitry", aMaxDamage, aEntityDamage, true, -1, aDischargedGTID); + public GT_SolderingTool_Item( + String aUnlocalized, String aEnglish, int aMaxDamage, int aEntityDamage, int aDischargedGTID) { + super( + aUnlocalized, + aEnglish, + "To repair and construct Circuitry", + aMaxDamage, + aEntityDamage, + true, + -1, + aDischargedGTID); GT_OreDictUnificator.registerOre(ToolDictNames.craftingToolSolderingIron, new ItemStack(this, 1, W)); GregTech_API.registerSolderingTool(new ItemStack(this, 1, W)); -// setCraftingSound(GregTech_API.sSoundList.get(103)); -// setBreakingSound(GregTech_API.sSoundList.get(103)); -// setEntityHitSound(GregTech_API.sSoundList.get(103)); -// setUsageAmounts(1, 1, 1); + // setCraftingSound(GregTech_API.sSoundList.get(103)); + // setBreakingSound(GregTech_API.sSoundList.get(103)); + // setEntityHitSound(GregTech_API.sSoundList.get(103)); + // setUsageAmounts(1, 1, 1); } @Override public void addAdditionalToolTips(List aList, ItemStack aStack, EntityPlayer aPlayer) { - aList.add(GT_LanguageManager.addStringLocalization(getUnlocalizedName() + ".tooltip_1", "Sets the Strength of outputted Redstone")); - aList.add(GT_LanguageManager.addStringLocalization(getUnlocalizedName() + ".tooltip_2", "Needs Soldering Metal in Inventory!")); + aList.add(GT_LanguageManager.addStringLocalization( + getUnlocalizedName() + ".tooltip_1", "Sets the Strength of outputted Redstone")); + aList.add(GT_LanguageManager.addStringLocalization( + getUnlocalizedName() + ".tooltip_2", "Needs Soldering Metal in Inventory!")); } @Override - public boolean onItemUseFirst(ItemStack aStack, EntityPlayer aPlayer, World aWorld, int aX, int aY, int aZ, int aSide, float hitX, float hitY, float hitZ) { + public boolean onItemUseFirst( + ItemStack aStack, + EntityPlayer aPlayer, + World aWorld, + int aX, + int aY, + int aZ, + int aSide, + float hitX, + float hitY, + float hitZ) { super.onItemUseFirst(aStack, aPlayer, aWorld, aX, aY, aZ, aSide, hitX, hitY, hitZ); if (aWorld.isRemote) { return false; diff --git a/src/main/java/gregtech/api/items/GT_Spray_Bug_Item.java b/src/main/java/gregtech/api/items/GT_Spray_Bug_Item.java index 5b697748da..23bf3d87ad 100644 --- a/src/main/java/gregtech/api/items/GT_Spray_Bug_Item.java +++ b/src/main/java/gregtech/api/items/GT_Spray_Bug_Item.java @@ -11,7 +11,7 @@ import net.minecraft.world.World; public class GT_Spray_Bug_Item extends GT_Tool_Item { public GT_Spray_Bug_Item(String aUnlocalized, String aEnglish, int aMaxDamage, int aEntityDamage) { - super(aUnlocalized, aEnglish, "A very 'buggy' Spray", aMaxDamage, aEntityDamage, true);/* + super(aUnlocalized, aEnglish, "A very 'buggy' Spray", aMaxDamage, aEntityDamage, true); /* addToEffectiveList(EntityCaveSpider.class.getName()); addToEffectiveList(EntitySpider.class.getName()); addToEffectiveList("EntityTFHedgeSpider"); @@ -41,14 +41,24 @@ public class GT_Spray_Bug_Item extends GT_Tool_Item { } */ @Override - public boolean onItemUseFirst(ItemStack aStack, EntityPlayer aPlayer, World aWorld, int aX, int aY, int aZ, int aSide, float hitX, float hitY, float hitZ) { + public boolean onItemUseFirst( + ItemStack aStack, + EntityPlayer aPlayer, + World aWorld, + int aX, + int aY, + int aZ, + int aSide, + float hitX, + float hitY, + float hitZ) { super.onItemUseFirst(aStack, aPlayer, aWorld, aX, aY, aZ, aSide, hitX, hitY, hitZ); if (aWorld.isRemote) { return false; } Block aBlock = aWorld.getBlock(aX, aY, aZ); if (aBlock == null) return false; -// byte aMeta = (byte)aWorld.getBlockMetadata(aX, aY, aZ); + // byte aMeta = (byte)aWorld.getBlockMetadata(aX, aY, aZ); TileEntity aTileEntity = aWorld.getTileEntity(aX, aY, aZ); try { @@ -60,7 +70,9 @@ public class GT_Spray_Bug_Item extends GT_Tool_Item { return true; } } - } catch (Throwable e) {/*Do nothing*/} + } catch (Throwable e) { + /*Do nothing*/ + } return false; } 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 58bfafdffb..c2d4ff1231 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 @@ -1,5 +1,7 @@ package gregtech.api.items; +import static gregtech.api.enums.GT_Values.D1; + import gregtech.api.enums.SoundResource; import gregtech.api.metatileentity.BaseMetaPipeEntity; import gregtech.api.util.GT_Log; @@ -14,11 +16,9 @@ import net.minecraft.util.MathHelper; import net.minecraft.world.World; import net.minecraftforge.common.util.ForgeDirection; -import static gregtech.api.enums.GT_Values.D1; - public class GT_Spray_Foam_Item extends GT_Tool_Item { public GT_Spray_Foam_Item(String aUnlocalized, String aEnglish, int aMaxDamage, int aEntityDamage) { - super(aUnlocalized, aEnglish, "Precision Spray", aMaxDamage, aEntityDamage, true);/* + super(aUnlocalized, aEnglish, "Precision Spray", aMaxDamage, aEntityDamage, true); /* setCraftingSound(Sounds.IC2_TOOLS_PAINTER); setBreakingSound(Sounds.IC2_TOOLS_PAINTER); setEntityHitSound(Sounds.IC2_TOOLS_PAINTER); @@ -57,7 +57,17 @@ public class GT_Spray_Foam_Item extends GT_Tool_Item { } */ @Override - public boolean onItemUseFirst(ItemStack aStack, EntityPlayer aPlayer, World aWorld, int aX, int aY, int aZ, int aSide, float hitX, float hitY, float hitZ) { + public boolean onItemUseFirst( + ItemStack aStack, + EntityPlayer aPlayer, + World aWorld, + int aX, + int aY, + int aZ, + int aSide, + float hitX, + float hitY, + float hitZ) { super.onItemUseFirst(aStack, aPlayer, aWorld, aX, aY, aZ, aSide, hitX, hitY, hitZ); if (aPlayer.isSneaking()) return false; if (aWorld.isRemote) { @@ -65,7 +75,7 @@ public class GT_Spray_Foam_Item extends GT_Tool_Item { } Block aBlock = aWorld.getBlock(aX, aY, aZ); if (aBlock == null) return false; -// byte aMeta = (byte)aWorld.getBlockMetadata(aX, aY, aZ); + // byte aMeta = (byte)aWorld.getBlockMetadata(aX, aY, aZ); TileEntity aTileEntity = aWorld.getTileEntity(aX, aY, aZ); try { @@ -121,7 +131,8 @@ public class GT_Spray_Foam_Item extends GT_Tool_Item { } switch (0) { case 0: - if (GT_Utility.isBlockAir(aWorld, aX, aY, aZ) && GT_ModHandler.damageOrDechargeItem(aStack, 1, 1000, aPlayer)) { + 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); aWorld.setBlock(aX, aY, aZ, GT_Utility.getBlockFromStack(tStack), tStack.getItemDamage(), 3); return true; @@ -129,9 +140,12 @@ public class GT_Spray_Foam_Item extends GT_Tool_Item { break; case 1: 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); - aWorld.setBlock(aX, aY, aZ, GT_Utility.getBlockFromStack(tStack), tStack.getItemDamage(), 3); + 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); + aWorld.setBlock( + aX, aY, aZ, GT_Utility.getBlockFromStack(tStack), tStack.getItemDamage(), 3); } else { if (i == 0) return false; break; @@ -153,10 +167,21 @@ public class GT_Spray_Foam_Item extends GT_Tool_Item { for (byte i = 0; i < 3; i++) for (byte j = 0; j < 3; j++) { - if (GT_Utility.isBlockAir(aWorld, aX + (tXFactor ? i : 0), aY + (!tXFactor && tYFactor ? i : 0) + (!tZFactor && tYFactor ? j : 0), aZ + (tZFactor ? j : 0))) { + if (GT_Utility.isBlockAir( + aWorld, + aX + (tXFactor ? i : 0), + aY + (!tXFactor && tYFactor ? i : 0) + (!tZFactor && tYFactor ? j : 0), + aZ + (tZFactor ? j : 0))) { if (GT_ModHandler.damageOrDechargeItem(aStack, 1, 1000, aPlayer)) { - GT_Utility.sendSoundToPlayers(aWorld, SoundResource.IC2_TOOLS_PAINTER, 1.0F, -1, aX, aY, aZ); - aWorld.setBlock(aX + (tXFactor ? i : 0), aY + (!tXFactor && tYFactor ? i : 0) + (!tZFactor && tYFactor ? j : 0), aZ + (tZFactor ? j : 0), GT_Utility.getBlockFromStack(tStack), tStack.getItemDamage(), 3); + GT_Utility.sendSoundToPlayers( + aWorld, SoundResource.IC2_TOOLS_PAINTER, 1.0F, -1, aX, aY, aZ); + aWorld.setBlock( + aX + (tXFactor ? i : 0), + aY + (!tXFactor && tYFactor ? i : 0) + (!tZFactor && tYFactor ? j : 0), + aZ + (tZFactor ? j : 0), + GT_Utility.getBlockFromStack(tStack), + tStack.getItemDamage(), + 3); temp = true; } else { break; 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 4c8d64b5ee..bbcd170db0 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 @@ -1,5 +1,7 @@ package gregtech.api.items; +import static gregtech.api.enums.GT_Values.D1; + import gregtech.api.enums.SoundResource; import gregtech.api.metatileentity.BaseMetaPipeEntity; import gregtech.api.util.GT_Log; @@ -12,11 +14,9 @@ import net.minecraft.item.ItemStack; import net.minecraft.tileentity.TileEntity; import net.minecraft.world.World; -import static gregtech.api.enums.GT_Values.D1; - public class GT_Spray_Hardener_Item extends GT_Tool_Item { public GT_Spray_Hardener_Item(String aUnlocalized, String aEnglish, int aMaxDamage, int aEntityDamage) { - super(aUnlocalized, aEnglish, "Construction Foam Hardener", aMaxDamage, aEntityDamage, true);/* + super(aUnlocalized, aEnglish, "Construction Foam Hardener", aMaxDamage, aEntityDamage, true); /* setCraftingSound(Sounds.IC2_TOOLS_PAINTER); setBreakingSound(Sounds.IC2_TOOLS_PAINTER); setEntityHitSound(Sounds.IC2_TOOLS_PAINTER); @@ -24,14 +24,24 @@ public class GT_Spray_Hardener_Item extends GT_Tool_Item { } @Override - public boolean onItemUseFirst(ItemStack aStack, EntityPlayer aPlayer, World aWorld, int aX, int aY, int aZ, int aSide, float hitX, float hitY, float hitZ) { + public boolean onItemUseFirst( + ItemStack aStack, + EntityPlayer aPlayer, + World aWorld, + int aX, + int aY, + int aZ, + int aSide, + float hitX, + float hitY, + float hitZ) { super.onItemUseFirst(aStack, aPlayer, aWorld, aX, aY, aZ, aSide, hitX, hitY, hitZ); if (aWorld.isRemote) { return false; } Block aBlock = aWorld.getBlock(aX, aY, aZ); if (aBlock == null) return false; -// byte aMeta = (byte)aWorld.getBlockMetadata(aX, aY, aZ); + // byte aMeta = (byte)aWorld.getBlockMetadata(aX, aY, aZ); TileEntity aTileEntity = aWorld.getTileEntity(aX, aY, aZ); try { @@ -49,8 +59,12 @@ public class GT_Spray_Hardener_Item extends GT_Tool_Item { if (D1) e.printStackTrace(GT_Log.err); } - ItemStack tStack1 = GT_ModHandler.getIC2Item("constructionFoam", 1), tStack2 = GT_ModHandler.getIC2Item("constructionFoamWall", 1); - if (tStack1 != null && tStack1.isItemEqual(new ItemStack(aBlock)) && tStack2 != null && tStack2.getItem() instanceof ItemBlock) { + ItemStack tStack1 = GT_ModHandler.getIC2Item("constructionFoam", 1), + tStack2 = GT_ModHandler.getIC2Item("constructionFoamWall", 1); + if (tStack1 != null + && tStack1.isItemEqual(new ItemStack(aBlock)) + && tStack2 != null + && tStack2.getItem() instanceof ItemBlock) { if (GT_ModHandler.damageOrDechargeItem(aStack, 1, 1000, aPlayer)) { GT_Utility.sendSoundToPlayers(aWorld, SoundResource.IC2_TOOLS_PAINTER, 1.0F, -1, aX, aY, aZ); aWorld.setBlock(aX, aY, aZ, GT_Utility.getBlockFromStack(tStack2), 7, 3); @@ -58,10 +72,12 @@ public class GT_Spray_Hardener_Item extends GT_Tool_Item { return true; } - if (aTileEntity instanceof BaseMetaPipeEntity && (((BaseMetaPipeEntity) aTileEntity).mConnections & -64) == 64) { + if (aTileEntity instanceof BaseMetaPipeEntity + && (((BaseMetaPipeEntity) aTileEntity).mConnections & -64) == 64) { if (GT_ModHandler.damageOrDechargeItem(aStack, 1, 1000, aPlayer)) { GT_Utility.sendSoundToPlayers(aWorld, SoundResource.IC2_TOOLS_PAINTER, 1.0F, -1, aX, aY, aZ); - ((BaseMetaPipeEntity) aTileEntity).mConnections = (byte) ((((BaseMetaPipeEntity) aTileEntity).mConnections & ~64) | -128); + ((BaseMetaPipeEntity) aTileEntity).mConnections = + (byte) ((((BaseMetaPipeEntity) aTileEntity).mConnections & ~64) | -128); } return true; } diff --git a/src/main/java/gregtech/api/items/GT_Spray_Hydration_Item.java b/src/main/java/gregtech/api/items/GT_Spray_Hydration_Item.java index 13ecdea3fa..e219220034 100644 --- a/src/main/java/gregtech/api/items/GT_Spray_Hydration_Item.java +++ b/src/main/java/gregtech/api/items/GT_Spray_Hydration_Item.java @@ -12,7 +12,7 @@ import net.minecraft.world.World; public class GT_Spray_Hydration_Item extends GT_Tool_Item { public GT_Spray_Hydration_Item(String aUnlocalized, String aEnglish, int aMaxDamage, int aEntityDamage) { - super(aUnlocalized, aEnglish, "To hydrate Crops and similar", aMaxDamage, aEntityDamage, true);/* + super(aUnlocalized, aEnglish, "To hydrate Crops and similar", aMaxDamage, aEntityDamage, true); /* setCraftingSound(Sounds.IC2_TOOLS_PAINTER); setBreakingSound(Sounds.IC2_TOOLS_PAINTER); setEntityHitSound(Sounds.IC2_TOOLS_PAINTER); @@ -20,14 +20,24 @@ public class GT_Spray_Hydration_Item extends GT_Tool_Item { } @Override - public boolean onItemUseFirst(ItemStack aStack, EntityPlayer aPlayer, World aWorld, int aX, int aY, int aZ, int aSide, float hitX, float hitY, float hitZ) { + public boolean onItemUseFirst( + ItemStack aStack, + EntityPlayer aPlayer, + World aWorld, + int aX, + int aY, + int aZ, + int aSide, + float hitX, + float hitY, + float hitZ) { super.onItemUseFirst(aStack, aPlayer, aWorld, aX, aY, aZ, aSide, hitX, hitY, hitZ); if (aWorld.isRemote) { return false; } Block aBlock = aWorld.getBlock(aX, aY, aZ); if (aBlock == null) return false; -// byte aMeta = (byte)aWorld.getBlockMetadata(aX, aY, aZ); + // byte aMeta = (byte)aWorld.getBlockMetadata(aX, aY, aZ); TileEntity aTileEntity = aWorld.getTileEntity(aX, aY, aZ); try { @@ -39,10 +49,13 @@ public class GT_Spray_Hydration_Item extends GT_Tool_Item { } return true; } - } catch (Throwable e) {/*Do nothing*/} + } catch (Throwable e) { + /*Do nothing*/ + } if (aTileEntity instanceof IGregTechTileEntity) { - if (((IGregTechTileEntity) aTileEntity).getColorization() >= 0 && GT_ModHandler.damageOrDechargeItem(aStack, 1, 1000, aPlayer)) { + if (((IGregTechTileEntity) aTileEntity).getColorization() >= 0 + && GT_ModHandler.damageOrDechargeItem(aStack, 1, 1000, aPlayer)) { ((IGregTechTileEntity) aTileEntity).setColorization((byte) -1); GT_Utility.sendSoundToPlayers(aWorld, SoundResource.IC2_TOOLS_PAINTER, 1.0F, -1, aX, aY, aZ); } diff --git a/src/main/java/gregtech/api/items/GT_Spray_Ice_Item.java b/src/main/java/gregtech/api/items/GT_Spray_Ice_Item.java index ddd9062d73..cb21ce60b6 100644 --- a/src/main/java/gregtech/api/items/GT_Spray_Ice_Item.java +++ b/src/main/java/gregtech/api/items/GT_Spray_Ice_Item.java @@ -1,10 +1,13 @@ package gregtech.api.items; +import static gregtech.api.enums.GT_Values.W; + import gregtech.api.enums.Materials; import gregtech.api.enums.OrePrefixes; import gregtech.api.enums.SoundResource; import gregtech.api.util.GT_ModHandler; import gregtech.api.util.GT_Utility; +import java.util.Arrays; import net.minecraft.block.Block; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.init.Blocks; @@ -12,13 +15,9 @@ import net.minecraft.item.ItemStack; import net.minecraft.world.World; import net.minecraftforge.common.util.ForgeDirection; -import java.util.Arrays; - -import static gregtech.api.enums.GT_Values.W; - public class GT_Spray_Ice_Item extends GT_Tool_Item { public GT_Spray_Ice_Item(String aUnlocalized, String aEnglish, int aMaxDamage, int aEntityDamage) { - super(aUnlocalized, aEnglish, "Very effective against Slimes", aMaxDamage, aEntityDamage, true);/* + super(aUnlocalized, aEnglish, "Very effective against Slimes", aMaxDamage, aEntityDamage, true); /* addToEffectiveList(EntitySlime.class.getName()); addToEffectiveList("BlueSlime"); addToEffectiveList("SlimeClone"); @@ -31,22 +30,36 @@ public class GT_Spray_Ice_Item extends GT_Tool_Item { setEntityHitSound(Sounds.IC2_TOOLS_PAINTER); setUsageAmounts(4, 16, 1);*/ - for (Object tName : Arrays.asList(OrePrefixes.bucket.get(Materials.Water), OrePrefixes.cell.get(Materials.Water), OrePrefixes.capsule.get(Materials.Water))) { - GT_ModHandler.addShapelessCraftingRecipe(new ItemStack(Blocks.ice, 1, 0), new Object[]{new ItemStack(this, 1, W), tName}); + for (Object tName : Arrays.asList( + OrePrefixes.bucket.get(Materials.Water), + OrePrefixes.cell.get(Materials.Water), + OrePrefixes.capsule.get(Materials.Water))) { + GT_ModHandler.addShapelessCraftingRecipe( + new ItemStack(Blocks.ice, 1, 0), new Object[] {new ItemStack(this, 1, W), tName}); } } - /* - @Override - public void onHitEntity(Entity aEntity) { - if (aEntity instanceof EntityLiving) { - ((EntityLiving)aEntity).addPotionEffect(new PotionEffect(Potion.weakness.getId(), 400, 2, false)); - ((EntityLiving)aEntity).addPotionEffect(new PotionEffect(Potion.moveSlowdown.getId(), 400, 2, false)); - } - } - */ + /* + @Override + public void onHitEntity(Entity aEntity) { + if (aEntity instanceof EntityLiving) { + ((EntityLiving)aEntity).addPotionEffect(new PotionEffect(Potion.weakness.getId(), 400, 2, false)); + ((EntityLiving)aEntity).addPotionEffect(new PotionEffect(Potion.moveSlowdown.getId(), 400, 2, false)); + } + } + */ @Override - public boolean onItemUseFirst(ItemStack aStack, EntityPlayer aPlayer, World aWorld, int aX, int aY, int aZ, int aSide, float hitX, float hitY, float hitZ) { + public boolean onItemUseFirst( + ItemStack aStack, + EntityPlayer aPlayer, + World aWorld, + int aX, + int aY, + int aZ, + int aSide, + float hitX, + float hitY, + float hitZ) { super.onItemUseFirst(aStack, aPlayer, aWorld, aX, aY, aZ, aSide, hitX, hitY, hitZ); if (aWorld.isRemote) { return false; @@ -57,7 +70,7 @@ public class GT_Spray_Ice_Item extends GT_Tool_Item { Block aBlock = aWorld.getBlock(aX, aY, aZ); if (aBlock == null) return false; byte aMeta = (byte) aWorld.getBlockMetadata(aX, aY, aZ); -// TileEntity aTileEntity = aWorld.getTileEntity(aX, aY, aZ); + // TileEntity aTileEntity = aWorld.getTileEntity(aX, aY, aZ); if (aBlock == Blocks.water || aBlock == Blocks.flowing_water) { if (aMeta == 0 && GT_ModHandler.damageOrDechargeItem(aStack, 1, 1000, aPlayer)) { 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 890ce9e8e9..355017b2ff 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 @@ -1,16 +1,15 @@ package gregtech.api.items; import gregtech.api.util.GT_LanguageManager; +import java.util.List; import net.minecraft.block.Block; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.ItemStack; import net.minecraft.world.World; -import java.util.List; - public class GT_Spray_Pepper_Item extends GT_Tool_Item { public GT_Spray_Pepper_Item(String aUnlocalized, String aEnglish, int aMaxDamage, int aEntityDamage) { - super(aUnlocalized, aEnglish, "To defend yourself against Bears", aMaxDamage, aEntityDamage, true);/* + super(aUnlocalized, aEnglish, "To defend yourself against Bears", aMaxDamage, aEntityDamage, true); /* setCraftingSound(GregTech_API.sSoundList.get(102)); setBreakingSound(GregTech_API.sSoundList.get(102)); setEntityHitSound(GregTech_API.sSoundList.get(102)); @@ -19,32 +18,45 @@ public class GT_Spray_Pepper_Item extends GT_Tool_Item { @Override public void addAdditionalToolTips(List aList, ItemStack aStack, EntityPlayer aPlayer) { - aList.add(GT_LanguageManager.addStringLocalization(getUnlocalizedName() + ".tooltip_1", "especially Pedobears, Care Bears,")); - aList.add(GT_LanguageManager.addStringLocalization(getUnlocalizedName() + ".tooltip_2", "Confession Bears, Bear Grylls")); - aList.add(GT_LanguageManager.addStringLocalization(getUnlocalizedName() + ".tooltip_3", "And ofcourse Man-Bear-Pig")); + aList.add(GT_LanguageManager.addStringLocalization( + getUnlocalizedName() + ".tooltip_1", "especially Pedobears, Care Bears,")); + aList.add(GT_LanguageManager.addStringLocalization( + getUnlocalizedName() + ".tooltip_2", "Confession Bears, Bear Grylls")); + aList.add(GT_LanguageManager.addStringLocalization( + getUnlocalizedName() + ".tooltip_3", "And ofcourse Man-Bear-Pig")); + } + /* + @Override + public void onHitEntity(Entity aEntity) { + if (aEntity instanceof EntityLiving) { + ((EntityLiving)aEntity).addPotionEffect(new PotionEffect(Potion.blindness.getId(), 1200, 2, false)); + ((EntityLiving)aEntity).addPotionEffect(new PotionEffect(Potion.poison.getId(), 120, 2, false)); + ((EntityLiving)aEntity).addPotionEffect(new PotionEffect(Potion.weakness.getId(), 200, 2, false)); + ((EntityLiving)aEntity).addPotionEffect(new PotionEffect(Potion.confusion.getId(), 600, 2, false)); + } } - /* - @Override - public void onHitEntity(Entity aEntity) { - if (aEntity instanceof EntityLiving) { - ((EntityLiving)aEntity).addPotionEffect(new PotionEffect(Potion.blindness.getId(), 1200, 2, false)); - ((EntityLiving)aEntity).addPotionEffect(new PotionEffect(Potion.poison.getId(), 120, 2, false)); - ((EntityLiving)aEntity).addPotionEffect(new PotionEffect(Potion.weakness.getId(), 200, 2, false)); - ((EntityLiving)aEntity).addPotionEffect(new PotionEffect(Potion.confusion.getId(), 600, 2, false)); - } - } - */ + */ @Override - public boolean onItemUseFirst(ItemStack aStack, EntityPlayer aPlayer, World aWorld, int aX, int aY, int aZ, int aSide, float hitX, float hitY, float hitZ) { + public boolean onItemUseFirst( + ItemStack aStack, + EntityPlayer aPlayer, + World aWorld, + int aX, + int aY, + int aZ, + int aSide, + float hitX, + float hitY, + float hitZ) { super.onItemUseFirst(aStack, aPlayer, aWorld, aX, aY, aZ, aSide, hitX, hitY, hitZ); if (aWorld.isRemote) { return false; } Block aBlock = aWorld.getBlock(aX, aY, aZ); if (aBlock == null) return false; -// byte aMeta = (byte)aWorld.getBlockMetadata(aX, aY, aZ); -// TileEntity aTileEntity = aWorld.getTileEntity(aX, aY, aZ); + // byte aMeta = (byte)aWorld.getBlockMetadata(aX, aY, aZ); + // TileEntity aTileEntity = aWorld.getTileEntity(aX, aY, aZ); return false; } diff --git a/src/main/java/gregtech/api/items/GT_Tool_Item.java b/src/main/java/gregtech/api/items/GT_Tool_Item.java index 736c7e4b13..78df3c9171 100644 --- a/src/main/java/gregtech/api/items/GT_Tool_Item.java +++ b/src/main/java/gregtech/api/items/GT_Tool_Item.java @@ -7,16 +7,54 @@ import net.minecraft.item.ItemStack; * This is just a basic Tool, which has normal durability and could break Blocks. */ public class GT_Tool_Item extends GT_Generic_Item { - public GT_Tool_Item(String aUnlocalized, String aEnglish, String aTooltip, int aMaxDamage, int aEntityDamage, boolean aSwingIfUsed) { + public GT_Tool_Item( + String aUnlocalized, + String aEnglish, + String aTooltip, + int aMaxDamage, + int aEntityDamage, + boolean aSwingIfUsed) { this(aUnlocalized, aEnglish, aTooltip, aMaxDamage, aEntityDamage, aSwingIfUsed, -1, -1); } - public GT_Tool_Item(String aUnlocalized, String aEnglish, String aTooltip, int aMaxDamage, int aEntityDamage, boolean aSwingIfUsed, int aChargedGTID, int aDisChargedGTID) { - this(aUnlocalized, aEnglish, aTooltip, aMaxDamage, aEntityDamage, aSwingIfUsed, aChargedGTID, aDisChargedGTID, 0, 0.0F); + public GT_Tool_Item( + String aUnlocalized, + String aEnglish, + String aTooltip, + int aMaxDamage, + int aEntityDamage, + boolean aSwingIfUsed, + int aChargedGTID, + int aDisChargedGTID) { + this( + aUnlocalized, + aEnglish, + aTooltip, + aMaxDamage, + aEntityDamage, + aSwingIfUsed, + aChargedGTID, + aDisChargedGTID, + 0, + 0.0F); } - public GT_Tool_Item(String aUnlocalized, String aEnglish, String aTooltip, int aMaxDamage, int aEntityDamage, boolean aSwingIfUsed, int aChargedGTID, int aDisChargedGTID, int aToolQuality, float aToolStrength) { - super(aUnlocalized, aEnglish, aTooltip, aTooltip != null && !aTooltip.equals("Doesn't work as intended, this is a Bug")); + public GT_Tool_Item( + String aUnlocalized, + String aEnglish, + String aTooltip, + int aMaxDamage, + int aEntityDamage, + boolean aSwingIfUsed, + int aChargedGTID, + int aDisChargedGTID, + int aToolQuality, + float aToolStrength) { + super( + aUnlocalized, + aEnglish, + aTooltip, + aTooltip != null && !aTooltip.equals("Doesn't work as intended, this is a Bug")); setMaxDamage(aMaxDamage); setMaxStackSize(1); setNoRepair(); diff --git a/src/main/java/gregtech/api/metatileentity/BaseMetaPipeEntity.java b/src/main/java/gregtech/api/metatileentity/BaseMetaPipeEntity.java index 16a8ec8cca..0fdaa90c1a 100644 --- a/src/main/java/gregtech/api/metatileentity/BaseMetaPipeEntity.java +++ b/src/main/java/gregtech/api/metatileentity/BaseMetaPipeEntity.java @@ -1,5 +1,8 @@ package gregtech.api.metatileentity; +import static gregtech.GT_Mod.GT_FML_LOGGER; +import static gregtech.api.enums.GT_Values.NW; + import gregtech.api.GregTech_API; import gregtech.api.enums.GT_Values; import gregtech.api.enums.SoundResource; @@ -19,6 +22,7 @@ import gregtech.api.util.GT_Log; import gregtech.api.util.GT_ModHandler; import gregtech.api.util.GT_OreDictUnificator; import gregtech.api.util.GT_Utility; +import java.util.*; import net.minecraft.block.Block; import net.minecraft.entity.Entity; import net.minecraft.entity.player.EntityPlayer; @@ -35,22 +39,24 @@ import net.minecraftforge.fluids.FluidStack; import net.minecraftforge.fluids.FluidTankInfo; import net.minecraftforge.fluids.IFluidHandler; -import java.util.*; - -import static gregtech.GT_Mod.GT_FML_LOGGER; -import static gregtech.api.enums.GT_Values.NW; - /** * NEVER INCLUDE THIS FILE IN YOUR MOD!!! * <p/> * This is the main TileEntity for EVERYTHING. */ -public class BaseMetaPipeEntity extends CommonMetaTileEntity implements IGregTechTileEntity, IPipeRenderedTileEntity, IDebugableTileEntity { +public class BaseMetaPipeEntity extends CommonMetaTileEntity + implements IGregTechTileEntity, IPipeRenderedTileEntity, IDebugableTileEntity { public byte mConnections = IConnectable.NO_CONNECTION; protected MetaPipeEntity mMetaTileEntity; private final int[] mTimeStatistics = new int[GregTech_API.TICKS_FOR_LAG_AVERAGING]; private boolean mWorkUpdate = false, mWorks = true; - private byte mColor = 0, oColor = 0, oStrongRedstone = 0, oRedstoneData = 63, oTextureData = 0, oUpdateData = 0, mLagWarningCount = 0; + private byte mColor = 0, + oColor = 0, + oStrongRedstone = 0, + oRedstoneData = 63, + oTextureData = 0, + oUpdateData = 0, + mLagWarningCount = 0; private int oX = 0, oY = 0, oZ = 0, mTimeStatisticsIndex = 0; protected Node node; protected NodePath nodePath; @@ -100,8 +106,7 @@ public class BaseMetaPipeEntity extends CommonMetaTileEntity implements IGregTec } } - public BaseMetaPipeEntity() { - } + public BaseMetaPipeEntity() {} @Override public void writeToNBT(NBTTagCompound aNBT) { @@ -141,7 +146,7 @@ public class BaseMetaPipeEntity extends CommonMetaTileEntity implements IGregTec mColor = aNBT.getByte("mColor"); mWorks = !aNBT.getBoolean("mWorks"); - if (mSidedRedstone.length != 6) mSidedRedstone = new byte[]{0, 0, 0, 0, 0, 0}; + if (mSidedRedstone.length != 6) mSidedRedstone = new byte[] {0, 0, 0, 0, 0, 0}; readCoverNBT(aNBT); loadMetaTileNBT(aNBT); @@ -164,8 +169,7 @@ public class BaseMetaPipeEntity extends CommonMetaTileEntity implements IGregTec oX = xCoord; oY = yCoord; oZ = zCoord; - if (isServerSide()) - checkDropCover(); + if (isServerSide()) checkDropCover(); else { requestCoverDataIfNeeded(); } @@ -186,15 +190,16 @@ public class BaseMetaPipeEntity extends CommonMetaTileEntity implements IGregTec } } if (isServerSide() && mTickTimer > 10) { - if (!doCoverThings()) - return; + if (!doCoverThings()) return; final byte oldConnections = mConnections; // Mask-out connection direction bits to keep only Foam related connections mConnections = (byte) (mMetaTileEntity.mConnections | (mConnections & ~IConnectable.CONNECTED_ALL)); // If foam not hardened, tries roll chance to harden - if ((mConnections & IConnectable.HAS_FOAM) == IConnectable.HAS_FRESHFOAM && getRandomNumber(1000) == 0) { - mConnections = (byte) ((mConnections & ~IConnectable.HAS_FRESHFOAM) | IConnectable.HAS_HARDENEDFOAM); + if ((mConnections & IConnectable.HAS_FOAM) == IConnectable.HAS_FRESHFOAM + && getRandomNumber(1000) == 0) { + mConnections = + (byte) ((mConnections & ~IConnectable.HAS_FRESHFOAM) | IConnectable.HAS_HARDENEDFOAM); } if (mTickTimer > 12 && oldConnections != mConnections) GregTech_API.causeCableUpdate(worldObj, xCoord, yCoord, zCoord); @@ -230,7 +235,12 @@ public class BaseMetaPipeEntity extends CommonMetaTileEntity implements IGregTec byte tData = mMetaTileEntity.getUpdateData(); if (tData != oUpdateData) sendBlockEvent((byte) 1, oUpdateData = tData); if (mColor != oColor) sendBlockEvent((byte) 2, oColor = mColor); - tData = (byte) (((mSidedRedstone[0] > 0) ? 1 : 0) | ((mSidedRedstone[1] > 0) ? 2 : 0) | ((mSidedRedstone[2] > 0) ? 4 : 0) | ((mSidedRedstone[3] > 0) ? 8 : 0) | ((mSidedRedstone[4] > 0) ? 16 : 0) | ((mSidedRedstone[5] > 0) ? 32 : 0)); + tData = (byte) (((mSidedRedstone[0] > 0) ? 1 : 0) + | ((mSidedRedstone[1] > 0) ? 2 : 0) + | ((mSidedRedstone[2] > 0) ? 4 : 0) + | ((mSidedRedstone[3] > 0) ? 8 : 0) + | ((mSidedRedstone[4] > 0) ? 16 : 0) + | ((mSidedRedstone[5] > 0) ? 32 : 0)); if (tData != oRedstoneData) sendBlockEvent((byte) 3, oRedstoneData = tData); } @@ -249,9 +259,16 @@ public class BaseMetaPipeEntity extends CommonMetaTileEntity implements IGregTec if (isServerSide() && hasValidMetaTileEntity()) { tTime = System.nanoTime() - tTime; if (mTimeStatistics.length > 0) - mTimeStatistics[mTimeStatisticsIndex = (mTimeStatisticsIndex + 1) % mTimeStatistics.length] = (int) tTime; - if (tTime > 0 && tTime > (GregTech_API.MILLISECOND_THRESHOLD_UNTIL_LAG_WARNING* 1000000L) && mTickTimer > 1000 && getMetaTileEntity().doTickProfilingMessageDuringThisTick() && mLagWarningCount++ < 10) - GT_FML_LOGGER.warn("WARNING: Possible Lag Source at ["+xCoord+","+yCoord+","+zCoord+"] in Dimension "+worldObj.provider.dimensionId+" with "+tTime+" ns caused by an instance of "+getMetaTileEntity().getClass()); + mTimeStatistics[mTimeStatisticsIndex = (mTimeStatisticsIndex + 1) % mTimeStatistics.length] = + (int) tTime; + if (tTime > 0 + && tTime > (GregTech_API.MILLISECOND_THRESHOLD_UNTIL_LAG_WARNING * 1000000L) + && mTickTimer > 1000 + && getMetaTileEntity().doTickProfilingMessageDuringThisTick() + && mLagWarningCount++ < 10) + GT_FML_LOGGER.warn("WARNING: Possible Lag Source at [" + xCoord + "," + yCoord + "," + zCoord + + "] in Dimension " + worldObj.provider.dimensionId + " with " + tTime + + " ns caused by an instance of " + getMetaTileEntity().getClass()); } mWorkUpdate = mInventoryChanged = false; @@ -260,20 +277,46 @@ public class BaseMetaPipeEntity extends CommonMetaTileEntity implements IGregTec private void sendClientData() { if (mSendClientData) { NW.sendPacketToAllPlayersInRange( - worldObj, - new GT_Packet_TileEntity( - xCoord, (short) yCoord, zCoord, mID, mCoverSides[0], mCoverSides[1], mCoverSides[2], mCoverSides[3], mCoverSides[4], mCoverSides[5], oTextureData = mConnections, - oUpdateData = hasValidMetaTileEntity() ? mMetaTileEntity.getUpdateData() : 0, - oRedstoneData = (byte) (((mSidedRedstone[0] > 0) ? 1 : 0) | ((mSidedRedstone[1] > 0) ? 2 : 0) | ((mSidedRedstone[2] > 0) ? 4 : 0) | ((mSidedRedstone[3] > 0) ? 8 : 0) | ((mSidedRedstone[4] > 0) ? 16 : 0) | ((mSidedRedstone[5] > 0) ? 32 : 0)), - oColor = mColor - ), xCoord, zCoord - ); + worldObj, + new GT_Packet_TileEntity( + xCoord, + (short) yCoord, + zCoord, + mID, + mCoverSides[0], + mCoverSides[1], + mCoverSides[2], + mCoverSides[3], + mCoverSides[4], + mCoverSides[5], + oTextureData = mConnections, + oUpdateData = hasValidMetaTileEntity() ? mMetaTileEntity.getUpdateData() : 0, + oRedstoneData = (byte) (((mSidedRedstone[0] > 0) ? 1 : 0) + | ((mSidedRedstone[1] > 0) ? 2 : 0) + | ((mSidedRedstone[2] > 0) ? 4 : 0) + | ((mSidedRedstone[3] > 0) ? 8 : 0) + | ((mSidedRedstone[4] > 0) ? 16 : 0) + | ((mSidedRedstone[5] > 0) ? 32 : 0)), + oColor = mColor), + xCoord, + zCoord); mSendClientData = false; } sendCoverDataIfNeeded(); } - public final void receiveMetaTileEntityData(short aID, int aCover0, int aCover1, int aCover2, int aCover3, int aCover4, int aCover5, byte aTextureData, byte aUpdateData, byte aRedstoneData, byte aColorData) { + public final void receiveMetaTileEntityData( + short aID, + int aCover0, + int aCover1, + int aCover2, + int aCover3, + int aCover4, + int aCover5, + byte aTextureData, + byte aUpdateData, + byte aRedstoneData, + byte aColorData) { issueTextureUpdate(); if (aID > 0 && mID != aID) { mID = aID; @@ -347,7 +390,13 @@ public class BaseMetaPipeEntity extends CommonMetaTileEntity implements IGregTec public ArrayList<String> getDebugInfo(EntityPlayer aPlayer, int aLogLevel) { final ArrayList<String> tList = new ArrayList<>(); if (aLogLevel > 3) { - tList.add("Meta-ID: " + EnumChatFormatting.BLUE+ mID +EnumChatFormatting.RESET + (hasValidMetaTileEntity() ? EnumChatFormatting.GREEN+" valid"+EnumChatFormatting.RESET : EnumChatFormatting.RED+" invalid"+EnumChatFormatting.RESET) + (mMetaTileEntity == null ? EnumChatFormatting.RED+" MetaTileEntity == null!"+EnumChatFormatting.RESET : " ")); + tList.add("Meta-ID: " + EnumChatFormatting.BLUE + mID + EnumChatFormatting.RESET + + (hasValidMetaTileEntity() + ? EnumChatFormatting.GREEN + " valid" + EnumChatFormatting.RESET + : EnumChatFormatting.RED + " invalid" + EnumChatFormatting.RESET) + + (mMetaTileEntity == null + ? EnumChatFormatting.RED + " MetaTileEntity == null!" + EnumChatFormatting.RESET + : " ")); } if (aLogLevel > 1) { if (mTimeStatistics.length > 0) { @@ -359,21 +408,27 @@ public class BaseMetaPipeEntity extends CommonMetaTileEntity implements IGregTec tWorstTime = tTime; } } - tList.add("Average CPU-load of ~" + (tAverageTime / mTimeStatistics.length) + "ns since " + mTimeStatistics.length + " ticks with worst time of " + tWorstTime + "ns."); + tList.add("Average CPU-load of ~" + (tAverageTime / mTimeStatistics.length) + "ns since " + + mTimeStatistics.length + " ticks with worst time of " + tWorstTime + "ns."); } if (mLagWarningCount > 0) { - tList.add("Caused " + (mLagWarningCount >= 10 ? "more than 10" : mLagWarningCount) + " Lag Spike Warnings (anything taking longer than " + GregTech_API.MILLISECOND_THRESHOLD_UNTIL_LAG_WARNING + "ms) on the Server."); + tList.add("Caused " + (mLagWarningCount >= 10 ? "more than 10" : mLagWarningCount) + + " Lag Spike Warnings (anything taking longer than " + + GregTech_API.MILLISECOND_THRESHOLD_UNTIL_LAG_WARNING + "ms) on the Server."); } if (mMetaTileEntity != null) { - tList.add("Is" + (mMetaTileEntity.isAccessAllowed(aPlayer) ? " " : EnumChatFormatting.RED+" not "+EnumChatFormatting.RESET) + "accessible for you"); + tList.add("Is" + + (mMetaTileEntity.isAccessAllowed(aPlayer) + ? " " + : EnumChatFormatting.RED + " not " + EnumChatFormatting.RESET) + + "accessible for you"); } } - if(joinedIc2Enet) - tList.add("Joined IC2 ENet"); + if (joinedIc2Enet) tList.add("Joined IC2 ENet"); - return mMetaTileEntity != null ? - mMetaTileEntity.getSpecialDebugInfo(this, aPlayer, aLogLevel, tList) : - new ArrayList<>(); + return mMetaTileEntity != null + ? mMetaTileEntity.getSpecialDebugInfo(this, aPlayer, aLogLevel, tList) + : new ArrayList<>(); } @Override @@ -382,7 +437,6 @@ public class BaseMetaPipeEntity extends CommonMetaTileEntity implements IGregTec return false; } - @Override public byte getBackFacing() { return GT_Utility.getOppositeSide(getFrontFacing()); @@ -415,7 +469,8 @@ public class BaseMetaPipeEntity extends CommonMetaTileEntity implements IGregTec markDirty(); mInventoryChanged = true; if (canAccessData()) - mMetaTileEntity.setInventorySlotContents(aIndex, worldObj.isRemote ? aStack : GT_OreDictUnificator.setStack(true, aStack)); + mMetaTileEntity.setInventorySlotContents( + aIndex, worldObj.isRemote ? aStack : GT_OreDictUnificator.setStack(true, aStack)); } @Override @@ -432,14 +487,22 @@ public class BaseMetaPipeEntity extends CommonMetaTileEntity implements IGregTec } @Override - public void openInventory() {/*Do nothing*/} + public void openInventory() { + /*Do nothing*/ + } @Override - public void closeInventory() {/*Do nothing*/} + public void closeInventory() { + /*Do nothing*/ + } @Override public boolean isUseableByPlayer(EntityPlayer aPlayer) { - return hasValidMetaTileEntity() && mTickTimer > 40 && getTileEntityOffset(0, 0, 0) == this && aPlayer.getDistanceSq(xCoord + 0.5, yCoord + 0.5, zCoord + 0.5) < 64 && mMetaTileEntity.isAccessAllowed(aPlayer); + return hasValidMetaTileEntity() + && mTickTimer > 40 + && getTileEntityOffset(0, 0, 0) == this + && aPlayer.getDistanceSq(xCoord + 0.5, yCoord + 0.5, zCoord + 0.5) < 64 + && mMetaTileEntity.isAccessAllowed(aPlayer); } @Override @@ -541,7 +604,9 @@ public class BaseMetaPipeEntity extends CommonMetaTileEntity implements IGregTec } @Override - public void setWorkDataValue(byte aValue) {/*Do nothing*/} + public void setWorkDataValue(byte aValue) { + /*Do nothing*/ + } @Override public int getMetaTileID() { @@ -559,7 +624,9 @@ public class BaseMetaPipeEntity extends CommonMetaTileEntity implements IGregTec } @Override - public void setActive(boolean aActive) {/*Do nothing*/} + public void setActive(boolean aActive) { + /*Do nothing*/ + } @Override public long getTimer() { @@ -636,11 +703,10 @@ public class BaseMetaPipeEntity extends CommonMetaTileEntity implements IGregTec return 0; } - @Override public ITexture[] getTexture(Block aBlock, byte aSide) { ITexture rIcon = getCoverTexture(aSide); - if (rIcon != null) return new ITexture[]{rIcon}; + if (rIcon != null) return new ITexture[] {rIcon}; return getTextureUncovered(aSide); } @@ -664,11 +730,18 @@ public class BaseMetaPipeEntity extends CommonMetaTileEntity implements IGregTec if ((mConnections & IConnectable.HAS_HARDENEDFOAM) != 0) return Textures.BlockIcons.HARDENEDFOAMS[mColor]; if ((mConnections & IConnectable.HAS_FOAM) != 0) return Textures.BlockIcons.ERROR_RENDERING; byte tConnections = mConnections; - if (tConnections == IConnectable.CONNECTED_WEST || tConnections == IConnectable.CONNECTED_EAST) tConnections = (byte) (IConnectable.CONNECTED_WEST | IConnectable.CONNECTED_EAST); - else if (tConnections == IConnectable.CONNECTED_DOWN || tConnections == IConnectable.CONNECTED_UP) tConnections = (byte) (IConnectable.CONNECTED_DOWN | IConnectable.CONNECTED_UP); - else if (tConnections == IConnectable.CONNECTED_NORTH || tConnections == IConnectable.CONNECTED_SOUTH) tConnections = (byte) (IConnectable.CONNECTED_NORTH | IConnectable.CONNECTED_SOUTH); + if (tConnections == IConnectable.CONNECTED_WEST || tConnections == IConnectable.CONNECTED_EAST) + tConnections = (byte) (IConnectable.CONNECTED_WEST | IConnectable.CONNECTED_EAST); + else if (tConnections == IConnectable.CONNECTED_DOWN || tConnections == IConnectable.CONNECTED_UP) + tConnections = (byte) (IConnectable.CONNECTED_DOWN | IConnectable.CONNECTED_UP); + else if (tConnections == IConnectable.CONNECTED_NORTH || tConnections == IConnectable.CONNECTED_SOUTH) + tConnections = (byte) (IConnectable.CONNECTED_NORTH | IConnectable.CONNECTED_SOUTH); if (hasValidMetaTileEntity()) - return mMetaTileEntity.getTexture(this, aSide, tConnections, (byte) (mColor - 1), + return mMetaTileEntity.getTexture( + this, + aSide, + tConnections, + (byte) (mColor - 1), tConnections == 0 || (tConnections & (1 << aSide)) != 0, getOutputRedstoneSignal(aSide) > 0); return Textures.BlockIcons.ERROR_RENDERING; @@ -679,7 +752,6 @@ public class BaseMetaPipeEntity extends CommonMetaTileEntity implements IGregTec return mMetaTileEntity != null && mMetaTileEntity.getBaseMetaTileEntity() == this; } - @Override public void doExplosion(long aAmount) { if (canAccessData()) { @@ -697,12 +769,11 @@ public class BaseMetaPipeEntity extends CommonMetaTileEntity implements IGregTec for (byte i = 0; i < mCoverSides.length; i++) { if (mCoverSides[i] != 0) { if (mCoverData[i] != null) // this really shouldn't be null if a cover is there already, but whatever - tNBT.setTag(COVER_DATA_NBT_KEYS[i], mCoverData[i].saveDataToNBT()); + tNBT.setTag(COVER_DATA_NBT_KEYS[i], mCoverData[i].saveDataToNBT()); hasCover = true; } } - if (hasCover) - tNBT.setIntArray("mCoverSides", mCoverSides); + if (hasCover) tNBT.setIntArray("mCoverSides", mCoverSides); if (hasValidMetaTileEntity()) mMetaTileEntity.setItemNBT(tNBT); if (!tNBT.hasNoTags()) rStack.setTagCompound(tNBT); return new ArrayList<>(Collections.singletonList(rStack)); @@ -711,9 +782,10 @@ public class BaseMetaPipeEntity extends CommonMetaTileEntity implements IGregTec @Override public boolean onRightclick(EntityPlayer aPlayer, byte aSide, float aX, float aY, float aZ) { if (isClientSide()) { - //Configure Cover, sneak can also be: screwdriver, wrench, side cutter, soldering iron + // Configure Cover, sneak can also be: screwdriver, wrench, side cutter, soldering iron if (aPlayer.isSneaking()) { - byte tSide = (getCoverIDAtSide(aSide) == 0) ? GT_Utility.determineWrenchingSide(aSide, aX, aY, aZ) : aSide; + byte tSide = + (getCoverIDAtSide(aSide) == 0) ? GT_Utility.determineWrenchingSide(aSide, aX, aY, aZ) : aSide; return (getCoverBehaviorAtSideNew(tSide).hasCoverGUI()); } else if (getCoverBehaviorAtSideNew(aSide).onCoverRightclickClient(aSide, this, aPlayer, aX, aY, aZ)) { return true; @@ -722,7 +794,8 @@ public class BaseMetaPipeEntity extends CommonMetaTileEntity implements IGregTec if (isServerSide()) { ItemStack tCurrentItem = aPlayer.inventory.getCurrentItem(); if (tCurrentItem != null) { - if (getColorization() >= 0 && GT_Utility.areStacksEqual(new ItemStack(Items.water_bucket, 1), tCurrentItem)) { + if (getColorization() >= 0 + && GT_Utility.areStacksEqual(new ItemStack(Items.water_bucket, 1), tCurrentItem)) { mMetaTileEntity.markDirty(); tCurrentItem.func_150996_a(Items.bucket); setColorization((byte) -1); @@ -733,33 +806,59 @@ public class BaseMetaPipeEntity extends CommonMetaTileEntity implements IGregTec if (mMetaTileEntity.onWrenchRightClick(aSide, tSide, aPlayer, aX, aY, aZ)) { mMetaTileEntity.markDirty(); GT_ModHandler.damageOrDechargeItem(tCurrentItem, 1, 1000, aPlayer); - GT_Utility.sendSoundToPlayers(worldObj, SoundResource.IC2_TOOLS_WRENCH, 1.0F, -1, xCoord, yCoord, zCoord); + GT_Utility.sendSoundToPlayers( + worldObj, SoundResource.IC2_TOOLS_WRENCH, 1.0F, -1, xCoord, yCoord, zCoord); } return true; } if (GT_Utility.isStackInList(tCurrentItem, GregTech_API.sScrewdriverList)) { if (getCoverIDAtSide(aSide) == 0 && getCoverIDAtSide(tSide) != 0) { if (GT_ModHandler.damageOrDechargeItem(tCurrentItem, 1, 200, aPlayer)) { - setCoverDataAtSide(tSide, getCoverBehaviorAtSideNew(tSide).onCoverScrewdriverClick(tSide, getCoverIDAtSide(tSide), getComplexCoverDataAtSide(tSide), this, aPlayer, 0.5F, 0.5F, 0.5F)); + setCoverDataAtSide( + tSide, + getCoverBehaviorAtSideNew(tSide) + .onCoverScrewdriverClick( + tSide, + getCoverIDAtSide(tSide), + getComplexCoverDataAtSide(tSide), + this, + aPlayer, + 0.5F, + 0.5F, + 0.5F)); mMetaTileEntity.onScrewdriverRightClick(tSide, aPlayer, aX, aY, aZ); mMetaTileEntity.markDirty(); - GT_Utility.sendSoundToPlayers(worldObj, SoundResource.IC2_TOOLS_WRENCH, 1.0F, -1, xCoord, yCoord, zCoord); + GT_Utility.sendSoundToPlayers( + worldObj, SoundResource.IC2_TOOLS_WRENCH, 1.0F, -1, xCoord, yCoord, zCoord); } } else { if (GT_ModHandler.damageOrDechargeItem(tCurrentItem, 1, 1000, aPlayer)) { - setCoverDataAtSide(aSide, getCoverBehaviorAtSideNew(aSide).onCoverScrewdriverClick(aSide, getCoverIDAtSide(aSide), getComplexCoverDataAtSide(aSide), this, aPlayer, aX, aY, aZ)); + setCoverDataAtSide( + aSide, + getCoverBehaviorAtSideNew(aSide) + .onCoverScrewdriverClick( + aSide, + getCoverIDAtSide(aSide), + getComplexCoverDataAtSide(aSide), + this, + aPlayer, + aX, + aY, + aZ)); mMetaTileEntity.onScrewdriverRightClick(aSide, aPlayer, aX, aY, aZ); mMetaTileEntity.markDirty(); - GT_Utility.sendSoundToPlayers(worldObj, SoundResource.IC2_TOOLS_WRENCH, 1.0F, -1, xCoord, yCoord, zCoord); + GT_Utility.sendSoundToPlayers( + worldObj, SoundResource.IC2_TOOLS_WRENCH, 1.0F, -1, xCoord, yCoord, zCoord); } } return true; } if (GT_Utility.isStackInList(tCurrentItem, GregTech_API.sHardHammerList)) { - //if (GT_ModHandler.damageOrDechargeItem(tCurrentItem, 1, 1000, aPlayer)) { - // GT_Utility.sendSoundToPlayers(worldObj, GregTech_API.sSoundList.get(1), 1.0F, -1, xCoord, yCoord, zCoord); - //} + // if (GT_ModHandler.damageOrDechargeItem(tCurrentItem, 1, 1000, aPlayer)) { + // GT_Utility.sendSoundToPlayers(worldObj, GregTech_API.sSoundList.get(1), 1.0F, -1, xCoord, yCoord, + // zCoord); + // } return true; } @@ -768,8 +867,14 @@ public class BaseMetaPipeEntity extends CommonMetaTileEntity implements IGregTec if (mWorks) disableWorking(); else enableWorking(); mMetaTileEntity.markDirty(); - GT_Utility.sendChatToPlayer(aPlayer, GT_Utility.trans("090","Machine Processing: ") + (isAllowedToWork() ? GT_Utility.trans("088","Enabled") : GT_Utility.trans("087","Disabled"))); - GT_Utility.sendSoundToPlayers(worldObj, SoundResource.IC2_TOOLS_RUBBER_TRAMPOLINE, 1.0F, -1, xCoord, yCoord, zCoord); + GT_Utility.sendChatToPlayer( + aPlayer, + GT_Utility.trans("090", "Machine Processing: ") + + (isAllowedToWork() + ? GT_Utility.trans("088", "Enabled") + : GT_Utility.trans("087", "Disabled"))); + GT_Utility.sendSoundToPlayers( + worldObj, SoundResource.IC2_TOOLS_RUBBER_TRAMPOLINE, 1.0F, -1, xCoord, yCoord, zCoord); } return true; } @@ -777,23 +882,33 @@ public class BaseMetaPipeEntity extends CommonMetaTileEntity implements IGregTec if (GT_Utility.isStackInList(tCurrentItem, GregTech_API.sWireCutterList)) { if (mMetaTileEntity.onWireCutterRightClick(aSide, tSide, aPlayer, aX, aY, aZ)) { mMetaTileEntity.markDirty(); - //logic handled internally - GT_Utility.sendSoundToPlayers(worldObj, SoundResource.IC2_TOOLS_WRENCH, 1.0F, -1, xCoord, yCoord, zCoord); + // logic handled internally + GT_Utility.sendSoundToPlayers( + worldObj, SoundResource.IC2_TOOLS_WRENCH, 1.0F, -1, xCoord, yCoord, zCoord); } doEnetUpdate(); return true; } if (GT_Utility.isStackInList(tCurrentItem, GregTech_API.sSolderingToolList)) { - if (mMetaTileEntity.onSolderingToolRightClick(aSide, tSide, aPlayer, aX, aY, aZ)) { + if (mMetaTileEntity.onSolderingToolRightClick(aSide, tSide, aPlayer, aX, aY, aZ)) { mMetaTileEntity.markDirty(); - //logic handled internally - GT_Utility.sendSoundToPlayers(worldObj, SoundResource.IC2_TOOLS_BATTERY_USE, 1.0F, -1, xCoord, yCoord, zCoord); + // logic handled internally + GT_Utility.sendSoundToPlayers( + worldObj, SoundResource.IC2_TOOLS_BATTERY_USE, 1.0F, -1, xCoord, yCoord, zCoord); } else if (GT_ModHandler.useSolderingIron(tCurrentItem, aPlayer)) { mMetaTileEntity.markDirty(); mStrongRedstone ^= (1 << tSide); - GT_Utility.sendChatToPlayer(aPlayer, GT_Utility.trans("091","Redstone Output at Side ") + tSide + GT_Utility.trans("092"," set to: ") + ((mStrongRedstone & (1 << tSide)) != 0 ? GT_Utility.trans("093","Strong") : GT_Utility.trans("094","Weak"))); - GT_Utility.sendSoundToPlayers(worldObj, SoundResource.IC2_TOOLS_BATTERY_USE, 3.0F, -1, xCoord, yCoord, zCoord); + GT_Utility.sendChatToPlayer( + aPlayer, + GT_Utility.trans("091", "Redstone Output at Side ") + + tSide + + GT_Utility.trans("092", " set to: ") + + ((mStrongRedstone & (1 << tSide)) != 0 + ? GT_Utility.trans("093", "Strong") + : GT_Utility.trans("094", "Weak"))); + GT_Utility.sendSoundToPlayers( + worldObj, SoundResource.IC2_TOOLS_BATTERY_USE, 3.0F, -1, xCoord, yCoord, zCoord); issueBlockUpdate(); } doEnetUpdate(); @@ -805,43 +920,59 @@ public class BaseMetaPipeEntity 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) && - mMetaTileEntity.allowCoverOnSide(coverSide, new GT_ItemStack(tCurrentItem))) - { + if (GregTech_API.getCoverBehaviorNew(tCurrentItem) + .isCoverPlaceable(coverSide, tCurrentItem, this) + && mMetaTileEntity.allowCoverOnSide(coverSide, new GT_ItemStack(tCurrentItem))) { setCoverItemAtSide(coverSide, tCurrentItem); mMetaTileEntity.markDirty(); if (!aPlayer.capabilities.isCreativeMode) tCurrentItem.stackSize--; - GT_Utility.sendSoundToPlayers(worldObj, SoundResource.IC2_TOOLS_WRENCH, 1.0F, -1, xCoord, yCoord, zCoord); + GT_Utility.sendSoundToPlayers( + worldObj, SoundResource.IC2_TOOLS_WRENCH, 1.0F, -1, xCoord, yCoord, zCoord); } return true; } } else { if (GT_Utility.isStackInList(tCurrentItem, GregTech_API.sCrowbarList)) { if (GT_ModHandler.damageOrDechargeItem(tCurrentItem, 1, 1000, aPlayer)) { - GT_Utility.sendSoundToPlayers(worldObj, SoundResource.RANDOM_BREAK, 1.0F, -1, xCoord, yCoord, zCoord); + GT_Utility.sendSoundToPlayers( + worldObj, SoundResource.RANDOM_BREAK, 1.0F, -1, xCoord, yCoord, zCoord); dropCover(coverSide, aSide, false); mMetaTileEntity.markDirty(); } return true; } } - } - else if (aPlayer.isSneaking()) { //Sneak click, no tool -> open cover config or turn back. + } else if (aPlayer.isSneaking()) { // Sneak click, no tool -> open cover config or turn back. aSide = (getCoverIDAtSide(aSide) == 0) ? GT_Utility.determineWrenchingSide(aSide, aX, aY, aZ) : aSide; - return getCoverIDAtSide(aSide) > 0 && getCoverBehaviorAtSideNew(aSide).onCoverShiftRightClick(aSide, getCoverIDAtSide(aSide), getComplexCoverDataAtSide(aSide), this, aPlayer); + return getCoverIDAtSide(aSide) > 0 + && getCoverBehaviorAtSideNew(aSide) + .onCoverShiftRightClick( + aSide, + getCoverIDAtSide(aSide), + getComplexCoverDataAtSide(aSide), + this, + aPlayer); } - if (getCoverBehaviorAtSideNew(aSide).onCoverRightClick(aSide, getCoverIDAtSide(aSide), getComplexCoverDataAtSide(aSide), this, aPlayer, aX, aY, aZ)) - return true; + if (getCoverBehaviorAtSideNew(aSide) + .onCoverRightClick( + aSide, + getCoverIDAtSide(aSide), + getComplexCoverDataAtSide(aSide), + this, + aPlayer, + aX, + aY, + aZ)) return true; } - if (!getCoverBehaviorAtSideNew(aSide).isGUIClickable(aSide, getCoverIDAtSide(aSide), getComplexCoverDataAtSide(aSide), this)) - return false; + if (!getCoverBehaviorAtSideNew(aSide) + .isGUIClickable(aSide, getCoverIDAtSide(aSide), getComplexCoverDataAtSide(aSide), this)) return false; try { if (!aPlayer.isSneaking() && hasValidMetaTileEntity()) { boolean handled = mMetaTileEntity.onRightclick(this, aPlayer, aSide, aX, aY, aZ); - if(handled) { + if (handled) { mMetaTileEntity.markDirty(); } return handled; @@ -896,8 +1027,21 @@ public class BaseMetaPipeEntity extends CommonMetaTileEntity implements IGregTec */ @Override public int[] getAccessibleSlotsFromSide(int aSide) { - if (canAccessData() && (getCoverBehaviorAtSideNew((byte) aSide).letsItemsOut((byte) aSide, getCoverIDAtSide((byte) aSide), getComplexCoverDataAtSide((byte) aSide), -1, this) || getCoverBehaviorAtSideNew((byte) aSide).letsItemsIn((byte) aSide, getCoverIDAtSide((byte) aSide), getComplexCoverDataAtSide((byte) aSide), -1, this))) - return mMetaTileEntity.getAccessibleSlotsFromSide(aSide); + if (canAccessData() + && (getCoverBehaviorAtSideNew((byte) aSide) + .letsItemsOut( + (byte) aSide, + getCoverIDAtSide((byte) aSide), + getComplexCoverDataAtSide((byte) aSide), + -1, + this) + || getCoverBehaviorAtSideNew((byte) aSide) + .letsItemsIn( + (byte) aSide, + getCoverIDAtSide((byte) aSide), + getComplexCoverDataAtSide((byte) aSide), + -1, + this))) return mMetaTileEntity.getAccessibleSlotsFromSide(aSide); return GT_Values.emptyIntArray; } @@ -906,7 +1050,15 @@ public class BaseMetaPipeEntity extends CommonMetaTileEntity implements IGregTec */ @Override public boolean canInsertItem(int aIndex, ItemStack aStack, int aSide) { - return canAccessData() && getCoverBehaviorAtSideNew((byte) aSide).letsItemsIn((byte) aSide, getCoverIDAtSide((byte) aSide), getComplexCoverDataAtSide((byte) aSide), aIndex, this) && mMetaTileEntity.canInsertItem(aIndex, aStack, aSide); + return canAccessData() + && getCoverBehaviorAtSideNew((byte) aSide) + .letsItemsIn( + (byte) aSide, + getCoverIDAtSide((byte) aSide), + getComplexCoverDataAtSide((byte) aSide), + aIndex, + this) + && mMetaTileEntity.canInsertItem(aIndex, aStack, aSide); } /** @@ -914,7 +1066,15 @@ public class BaseMetaPipeEntity extends CommonMetaTileEntity implements IGregTec */ @Override public boolean canExtractItem(int aIndex, ItemStack aStack, int aSide) { - return canAccessData() && getCoverBehaviorAtSideNew((byte) aSide).letsItemsOut((byte) aSide, getCoverIDAtSide((byte) aSide), getComplexCoverDataAtSide((byte) aSide), aIndex, this) && mMetaTileEntity.canExtractItem(aIndex, aStack, aSide); + return canAccessData() + && getCoverBehaviorAtSideNew((byte) aSide) + .letsItemsOut( + (byte) aSide, + getCoverIDAtSide((byte) aSide), + getComplexCoverDataAtSide((byte) aSide), + aIndex, + this) + && mMetaTileEntity.canExtractItem(aIndex, aStack, aSide); } @Override @@ -997,9 +1157,7 @@ public class BaseMetaPipeEntity extends CommonMetaTileEntity implements IGregTec } @Override - public void setOwnerUuid(UUID uuid) { - - } + public void setOwnerUuid(UUID uuid) {} @Override public byte getComparatorValue(byte aSide) { @@ -1039,42 +1197,63 @@ public class BaseMetaPipeEntity extends CommonMetaTileEntity implements IGregTec } private boolean canMoveFluidOnSide(ForgeDirection aSide, Fluid aFluid, boolean isFill) { - if (aSide == ForgeDirection.UNKNOWN) - return true; + if (aSide == ForgeDirection.UNKNOWN) return true; IFluidHandler tTileEntity = getITankContainerAtSide((byte) aSide.ordinal()); - // Only require a connection if there's something to connect to - Allows fluid cells & buckets to interact with the pipe - if (tTileEntity != null && !mMetaTileEntity.isConnectedAtSide((byte) aSide.ordinal())) - return false; - - if(isFill && mMetaTileEntity.isLiquidInput((byte) aSide.ordinal()) - && getCoverBehaviorAtSideNew((byte) aSide.ordinal()).letsFluidIn((byte) aSide.ordinal(), getCoverIDAtSide((byte) aSide.ordinal()), getComplexCoverDataAtSide((byte) aSide.ordinal()), aFluid, this)) - return true; - - if (!isFill && mMetaTileEntity.isLiquidOutput((byte) aSide.ordinal()) - && getCoverBehaviorAtSideNew((byte) aSide.ordinal()).letsFluidOut((byte) aSide.ordinal(), getCoverIDAtSide((byte) aSide.ordinal()), getComplexCoverDataAtSide((byte) aSide.ordinal()),aFluid, this)) - return true; + // Only require a connection if there's something to connect to - Allows fluid cells & buckets to interact with + // the pipe + if (tTileEntity != null && !mMetaTileEntity.isConnectedAtSide((byte) aSide.ordinal())) return false; + + if (isFill + && mMetaTileEntity.isLiquidInput((byte) aSide.ordinal()) + && getCoverBehaviorAtSideNew((byte) aSide.ordinal()) + .letsFluidIn( + (byte) aSide.ordinal(), + getCoverIDAtSide((byte) aSide.ordinal()), + getComplexCoverDataAtSide((byte) aSide.ordinal()), + aFluid, + this)) return true; + + if (!isFill + && mMetaTileEntity.isLiquidOutput((byte) aSide.ordinal()) + && getCoverBehaviorAtSideNew((byte) aSide.ordinal()) + .letsFluidOut( + (byte) aSide.ordinal(), + getCoverIDAtSide((byte) aSide.ordinal()), + getComplexCoverDataAtSide((byte) aSide.ordinal()), + aFluid, + this)) return true; return false; } @Override public int fill(ForgeDirection aSide, FluidStack aFluidStack, boolean doFill) { - if (mTickTimer > 5 && canAccessData() && canMoveFluidOnSide(aSide, aFluidStack == null ? null : aFluidStack.getFluid(), true)) + if (mTickTimer > 5 + && canAccessData() + && canMoveFluidOnSide(aSide, aFluidStack == null ? null : aFluidStack.getFluid(), true)) return mMetaTileEntity.fill(aSide, aFluidStack, doFill); return 0; } @Override public FluidStack drain(ForgeDirection aSide, int maxDrain, boolean doDrain) { - if (mTickTimer > 5 && canAccessData() && canMoveFluidOnSide(aSide, mMetaTileEntity.getFluid() == null ? null : mMetaTileEntity.getFluid().getFluid(), false)) - return mMetaTileEntity.drain(aSide, maxDrain, doDrain); + if (mTickTimer > 5 + && canAccessData() + && canMoveFluidOnSide( + aSide, + mMetaTileEntity.getFluid() == null + ? null + : mMetaTileEntity.getFluid().getFluid(), + false)) return mMetaTileEntity.drain(aSide, maxDrain, doDrain); return null; } @Override public FluidStack drain(ForgeDirection aSide, FluidStack aFluidStack, boolean doDrain) { - if (mTickTimer > 5 && canAccessData() && canMoveFluidOnSide(aSide, aFluidStack == null ? null : aFluidStack.getFluid(), false)) + if (mTickTimer > 5 + && canAccessData() + && canMoveFluidOnSide(aSide, aFluidStack == null ? null : aFluidStack.getFluid(), false)) return mMetaTileEntity.drain(aSide, aFluidStack, doDrain); return null; } @@ -1096,15 +1275,26 @@ public class BaseMetaPipeEntity extends CommonMetaTileEntity implements IGregTec @Override public FluidTankInfo[] getTankInfo(ForgeDirection aSide) { if (canAccessData() - && (aSide == ForgeDirection.UNKNOWN - || (mMetaTileEntity.isLiquidInput((byte) aSide.ordinal()) - && getCoverBehaviorAtSideNew((byte) aSide.ordinal()).letsFluidIn((byte) aSide.ordinal(), getCoverIDAtSide((byte) aSide.ordinal()), getComplexCoverDataAtSide((byte) aSide.ordinal()), null, this)) - || (mMetaTileEntity.isLiquidOutput((byte) aSide.ordinal()) && getCoverBehaviorAtSideNew((byte) aSide.ordinal()).letsFluidOut((byte) aSide.ordinal(), getCoverIDAtSide((byte) aSide.ordinal()), getComplexCoverDataAtSide((byte) aSide.ordinal()), null, this)) - // Doesn't need to be connected to get Tank Info -- otherwise things can't connect - ) - ) - return mMetaTileEntity.getTankInfo(aSide); - return new FluidTankInfo[]{}; + && (aSide == ForgeDirection.UNKNOWN + || (mMetaTileEntity.isLiquidInput((byte) aSide.ordinal()) + && getCoverBehaviorAtSideNew((byte) aSide.ordinal()) + .letsFluidIn( + (byte) aSide.ordinal(), + getCoverIDAtSide((byte) aSide.ordinal()), + getComplexCoverDataAtSide((byte) aSide.ordinal()), + null, + this)) + || (mMetaTileEntity.isLiquidOutput((byte) aSide.ordinal()) + && getCoverBehaviorAtSideNew((byte) aSide.ordinal()) + .letsFluidOut( + (byte) aSide.ordinal(), + getCoverIDAtSide((byte) aSide.ordinal()), + getComplexCoverDataAtSide((byte) aSide.ordinal()), + null, + this)) + // Doesn't need to be connected to get Tank Info -- otherwise things can't connect + )) return mMetaTileEntity.getTankInfo(aSide); + return new FluidTankInfo[] {}; } @Override @@ -1117,7 +1307,9 @@ public class BaseMetaPipeEntity extends CommonMetaTileEntity implements IGregTec return true; } aStack = GT_OreDictUnificator.get(aStack); - if (GT_Utility.areStacksEqual(tStack, aStack) && tStack.stackSize + aStack.stackSize <= Math.min(aStack.getMaxStackSize(), getInventoryStackLimit())) { + if (GT_Utility.areStacksEqual(tStack, aStack) + && tStack.stackSize + aStack.stackSize + <= Math.min(aStack.getMaxStackSize(), getInventoryStackLimit())) { markDirty(); tStack.stackSize += aStack.stackSize; return true; @@ -1183,7 +1375,7 @@ public class BaseMetaPipeEntity extends CommonMetaTileEntity implements IGregTec public String[] getInfoData() { { if (canAccessData()) return getMetaTileEntity().getInfoData(); - return new String[]{}; + return new String[] {}; } } @@ -1196,7 +1388,8 @@ public class BaseMetaPipeEntity extends CommonMetaTileEntity implements IGregTec if (canAccessData()) { final IMetaTileEntity meta = getMetaTileEntity(); if (meta instanceof MetaPipeEntity) { - // Trigger a checking of connections in case someone placed down a block that the pipe/wire shouldn't be connected to. + // Trigger a checking of connections in case someone placed down a block that the pipe/wire shouldn't be + // connected to. // However; don't do it immediately in case the world isn't finished loading // (This caused issues with AE2 GTEU p2p connections. ((MetaPipeEntity) meta).setCheckConnections(); @@ -1210,7 +1403,14 @@ public class BaseMetaPipeEntity extends CommonMetaTileEntity implements IGregTec } @Override - public void addCollisionBoxesToList(World aWorld, int aX, int aY, int aZ, AxisAlignedBB inputAABB, List<AxisAlignedBB> outputAABB, Entity collider) { + public void addCollisionBoxesToList( + World aWorld, + int aX, + int aY, + int aZ, + AxisAlignedBB inputAABB, + List<AxisAlignedBB> outputAABB, + Entity collider) { mMetaTileEntity.addCollisionBoxesToList(aWorld, aX, aY, aZ, inputAABB, outputAABB, collider); } diff --git a/src/main/java/gregtech/api/metatileentity/BaseMetaTileEntity.java b/src/main/java/gregtech/api/metatileentity/BaseMetaTileEntity.java index b68715770c..911c1cabcb 100644 --- a/src/main/java/gregtech/api/metatileentity/BaseMetaTileEntity.java +++ b/src/main/java/gregtech/api/metatileentity/BaseMetaTileEntity.java @@ -1,5 +1,10 @@ package gregtech.api.metatileentity; +import static gregtech.GT_Mod.GT_FML_LOGGER; +import static gregtech.api.enums.GT_Values.NW; +import static gregtech.api.enums.GT_Values.V; +import static gregtech.api.objects.XSTR.XSTR_INSTANCE; + import appeng.api.networking.IGridNode; import appeng.api.networking.security.IActionHost; import appeng.api.util.AECableType; @@ -9,11 +14,9 @@ import appeng.me.helpers.IGridProxyable; import appeng.tile.TileEvent; import appeng.tile.events.TileEventType; import com.gtnewhorizon.structurelib.alignment.IAlignment; -import com.gtnewhorizon.structurelib.alignment.IAlignmentLimits; import com.gtnewhorizon.structurelib.alignment.IAlignmentProvider; import com.gtnewhorizon.structurelib.alignment.constructable.IConstructable; import com.gtnewhorizon.structurelib.alignment.constructable.IConstructableProvider; -import com.gtnewhorizon.structurelib.alignment.enumerable.ExtendedFacing; import cpw.mods.fml.common.Optional; import cpw.mods.fml.relauncher.ReflectionHelper; import gregtech.GT_Mod; @@ -38,6 +41,9 @@ import gregtech.api.objects.GT_ItemStack; import gregtech.api.util.*; import gregtech.common.GT_Pollution; import ic2.api.Direction; +import java.lang.reflect.Field; +import java.util.*; +import javax.annotation.Nullable; import mcp.mobius.waila.api.IWailaConfigHandler; import mcp.mobius.waila.api.IWailaDataAccessor; import net.minecraft.block.Block; @@ -61,27 +67,34 @@ import net.minecraftforge.fluids.Fluid; import net.minecraftforge.fluids.FluidStack; import net.minecraftforge.fluids.FluidTankInfo; -import javax.annotation.Nullable; -import java.lang.reflect.Field; -import java.util.*; - -import static gregtech.GT_Mod.GT_FML_LOGGER; -import static gregtech.api.enums.GT_Values.NW; -import static gregtech.api.enums.GT_Values.V; -import static gregtech.api.objects.XSTR.XSTR_INSTANCE; - /** * NEVER INCLUDE THIS FILE IN YOUR MOD!!! * <p/> * This is the main TileEntity for EVERYTHING. */ -@Optional.InterfaceList(value = { - @Optional.Interface(iface = "appeng.api.networking.security.IActionHost", modid = "appliedenergistics2", striprefs = true), - @Optional.Interface(iface = "appeng.me.helpers.IGridProxyable", modid = "appliedenergistics2", striprefs = true)}) -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 final boolean[] mActiveEUInputs = new boolean[]{false, false, false, false, false, false}; - private final boolean[] mActiveEUOutputs = new boolean[]{false, false, false, false, false, false}; +@Optional.InterfaceList( + value = { + @Optional.Interface( + iface = "appeng.api.networking.security.IActionHost", + modid = "appliedenergistics2", + striprefs = true), + @Optional.Interface( + iface = "appeng.me.helpers.IGridProxyable", + modid = "appliedenergistics2", + striprefs = true) + }) +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 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]; public long mLastSoundTick = 0; public boolean mWasShutdown = false; @@ -89,12 +102,29 @@ public class BaseMetaTileEntity extends CommonMetaTileEntity implements IGregTec protected long mStoredEnergy = 0, mStoredSteam = 0; protected int mAverageEUInputIndex = 0, mAverageEUOutputIndex = 0; protected boolean mReleaseEnergy = false; - protected long[] mAverageEUInput = new long[]{0, 0, 0, 0, 0}, mAverageEUOutput = new long[]{0, 0, 0, 0, 0}; - private boolean mHasEnoughEnergy = true, mRunningThroughTick = false, mInputDisabled = false, mOutputDisabled = false, mMuffler = false, mLockUpgrade = false; + protected long[] mAverageEUInput = new long[] {0, 0, 0, 0, 0}, mAverageEUOutput = new long[] {0, 0, 0, 0, 0}; + private boolean mHasEnoughEnergy = true, + mRunningThroughTick = false, + mInputDisabled = false, + mOutputDisabled = false, + mMuffler = false, + mLockUpgrade = false; private boolean mActive = false, mWorkUpdate = false, mSteamConverter = false, mWorks = true; private boolean oRedstone = false; - private byte mColor = 0, oColor = 0, oStrongRedstone = 0, oRedstoneData = 63, oTextureData = 0, oUpdateData = 0, oTexturePage = 0; - private byte oLightValueClient = -1, oLightValue = -1, mLightValue = 0, mOtherUpgrades = 0, mFacing = 0, oFacing = 0, mWorkData = 0; + private byte mColor = 0, + oColor = 0, + oStrongRedstone = 0, + oRedstoneData = 63, + oTextureData = 0, + oUpdateData = 0, + oTexturePage = 0; + private byte oLightValueClient = -1, + oLightValue = -1, + mLightValue = 0, + mOtherUpgrades = 0, + mFacing = 0, + oFacing = 0, + mWorkData = 0; private int mDisplayErrorCode = 0, oX = 0, oY = 0, oZ = 0, mTimeStatisticsIndex = 0, mLagWarningCount = 0; private long oOutput = 0, mAcceptedAmperes = Long.MAX_VALUE; private long mLastCheckTick = 0; @@ -103,8 +133,7 @@ public class BaseMetaTileEntity extends CommonMetaTileEntity implements IGregTec private NBTTagCompound mRecipeStuff = new NBTTagCompound(); private int cableUpdateDelay = 30; - public BaseMetaTileEntity() { - } + public BaseMetaTileEntity() {} @Override public void writeToNBT(NBTTagCompound aNBT) { @@ -152,7 +181,9 @@ public class BaseMetaTileEntity extends CommonMetaTileEntity implements IGregTec if (aID > 0) mID = aID; else mID = mID > 0 ? mID : 0; if (mID != 0) createNewMetatileEntity(mID); - mSidedRedstone = (hasValidMetaTileEntity() && mMetaTileEntity.hasSidedRedstoneOutputBehavior() ? new byte[]{0, 0, 0, 0, 0, 0} : new byte[]{15, 15, 15, 15, 15, 15}); + mSidedRedstone = (hasValidMetaTileEntity() && mMetaTileEntity.hasSidedRedstoneOutputBehavior() + ? new byte[] {0, 0, 0, 0, 0, 0} + : new byte[] {15, 15, 15, 15, 15, 15}); } else { if (aID <= 0) mID = (short) aNBT.getInteger("mID"); else mID = aID; @@ -175,7 +206,8 @@ public class BaseMetaTileEntity extends CommonMetaTileEntity implements IGregTec mWorks = !aNBT.getBoolean("mWorks"); mInputDisabled = aNBT.getBoolean("mInputDisabled"); mOutputDisabled = aNBT.getBoolean("mOutputDisabled"); - mOtherUpgrades = (byte) (aNBT.getByte("mOtherUpgrades") + aNBT.getByte("mBatteries") + aNBT.getByte("mLiBatteries")); + mOtherUpgrades = + (byte) (aNBT.getByte("mOtherUpgrades") + aNBT.getByte("mBatteries") + aNBT.getByte("mLiBatteries")); mRecipeStuff = aNBT.getCompoundTag("GT.CraftingComponents"); final int nbtVersion = aNBT.getInteger("nbtVersion"); @@ -184,11 +216,11 @@ public class BaseMetaTileEntity extends CommonMetaTileEntity implements IGregTec } if (mCoverData == null || mCoverData.length != 6) mCoverData = new ISerializableObject[6]; - if (mCoverSides.length != 6) mCoverSides = new int[]{0, 0, 0, 0, 0, 0}; + if (mCoverSides.length != 6) mCoverSides = new int[] {0, 0, 0, 0, 0, 0}; if (mSidedRedstone.length != 6) if (hasValidMetaTileEntity() && mMetaTileEntity.hasSidedRedstoneOutputBehavior()) - mSidedRedstone = new byte[]{0, 0, 0, 0, 0, 0}; - else mSidedRedstone = new byte[]{15, 15, 15, 15, 15, 15}; + mSidedRedstone = new byte[] {0, 0, 0, 0, 0, 0}; + else mSidedRedstone = new byte[] {15, 15, 15, 15, 15, 15}; updateCoverBehavior(); } @@ -205,14 +237,29 @@ public class BaseMetaTileEntity extends CommonMetaTileEntity implements IGregTec * Called when trying to charge Items */ public void chargeItem(ItemStack aStack) { - decreaseStoredEU(GT_ModHandler.chargeElectricItem(aStack, (int) Math.min(Integer.MAX_VALUE, getStoredEU()), (int) Math.min(Integer.MAX_VALUE, mMetaTileEntity.getOutputTier()), false, false), true); + decreaseStoredEU( + GT_ModHandler.chargeElectricItem( + aStack, + (int) Math.min(Integer.MAX_VALUE, getStoredEU()), + (int) Math.min(Integer.MAX_VALUE, mMetaTileEntity.getOutputTier()), + false, + false), + true); } /** * Called when trying to discharge Items */ public void dischargeItem(ItemStack aStack) { - increaseStoredEnergyUnits(GT_ModHandler.dischargeElectricItem(aStack, (int) Math.min(Integer.MAX_VALUE, getEUCapacity() - getStoredEU()), (int) Math.min(Integer.MAX_VALUE, mMetaTileEntity.getInputTier()), false, false, false), true); + increaseStoredEnergyUnits( + GT_ModHandler.dischargeElectricItem( + aStack, + (int) Math.min(Integer.MAX_VALUE, getEUCapacity() - getStoredEU()), + (int) Math.min(Integer.MAX_VALUE, mMetaTileEntity.getInputTier()), + false, + false, + false), + true); } protected boolean isRainPossible() { @@ -274,7 +321,7 @@ public class BaseMetaTileEntity extends CommonMetaTileEntity implements IGregTec if (mNeedsUpdate) { worldObj.markBlockForUpdate(xCoord, yCoord, zCoord); - //worldObj.func_147479_m(xCoord, yCoord, zCoord); + // worldObj.func_147479_m(xCoord, yCoord, zCoord); mNeedsUpdate = false; } } @@ -340,12 +387,15 @@ 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 tUsableAmperage = Math.min(getOutputAmperage(), (getStoredEU() - mMetaTileEntity.getMinimumStoredEU()) / tOutputVoltage); + 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); if (tUsableAmperage > 0) { - final long tEU = tOutputVoltage * Util.emitEnergyToNetwork(oOutput, tUsableAmperage, this); + final long tEU = + tOutputVoltage * Util.emitEnergyToNetwork(oOutput, tUsableAmperage, this); mAverageEUOutput[mAverageEUOutputIndex] += tEU; decreaseStoredEU(tEU, true); } @@ -362,26 +412,46 @@ public class BaseMetaTileEntity extends CommonMetaTileEntity implements IGregTec } if (getRandomNumber(1000) == 0 && isRainPossible()) { - final int precipitationHeightAtSide2 = worldObj.getPrecipitationHeight(xCoord, zCoord - 1); - final int precipitationHeightAtSide3 = worldObj.getPrecipitationHeight(xCoord, zCoord + 1); - final int precipitationHeightAtSide4 = worldObj.getPrecipitationHeight(xCoord - 1, zCoord); - final int precipitationHeightAtSide5 = worldObj.getPrecipitationHeight(xCoord + 1, zCoord); - - if ((getCoverIDAtSide((byte) 1) == 0 && worldObj.getPrecipitationHeight(xCoord, zCoord) - 2 < yCoord) - || (getCoverIDAtSide((byte) 2) == 0 && precipitationHeightAtSide2 - 1 < yCoord && precipitationHeightAtSide2 > -1) - || (getCoverIDAtSide((byte) 3) == 0 && precipitationHeightAtSide3 - 1 < yCoord && precipitationHeightAtSide3 > -1) - || (getCoverIDAtSide((byte) 4) == 0 && precipitationHeightAtSide4 - 1 < yCoord && precipitationHeightAtSide4 > -1) - || (getCoverIDAtSide((byte) 5) == 0 && precipitationHeightAtSide5 - 1 < yCoord && precipitationHeightAtSide5 > -1)) { + final int precipitationHeightAtSide2 = + worldObj.getPrecipitationHeight(xCoord, zCoord - 1); + final int precipitationHeightAtSide3 = + worldObj.getPrecipitationHeight(xCoord, zCoord + 1); + final int precipitationHeightAtSide4 = + worldObj.getPrecipitationHeight(xCoord - 1, zCoord); + final int precipitationHeightAtSide5 = + worldObj.getPrecipitationHeight(xCoord + 1, zCoord); + + if ((getCoverIDAtSide((byte) 1) == 0 + && worldObj.getPrecipitationHeight(xCoord, zCoord) - 2 < yCoord) + || (getCoverIDAtSide((byte) 2) == 0 + && precipitationHeightAtSide2 - 1 < yCoord + && precipitationHeightAtSide2 > -1) + || (getCoverIDAtSide((byte) 3) == 0 + && precipitationHeightAtSide3 - 1 < yCoord + && precipitationHeightAtSide3 > -1) + || (getCoverIDAtSide((byte) 4) == 0 + && precipitationHeightAtSide4 - 1 < yCoord + && precipitationHeightAtSide4 > -1) + || (getCoverIDAtSide((byte) 5) == 0 + && precipitationHeightAtSide5 - 1 < yCoord + && precipitationHeightAtSide5 > -1)) { if (GregTech_API.sMachineRainExplosions && worldObj.isRaining()) { if (getRandomNumber(10) == 0) { try { - GT_Mod.achievements.issueAchievement(this.getWorldObj().getPlayerEntityByName(mOwnerName), "badweather"); + GT_Mod.achievements.issueAchievement( + this.getWorldObj().getPlayerEntityByName(mOwnerName), + "badweather"); } catch (Exception ignored) { } - GT_Log.exp.println("Machine at: " + this.getXCoord() + " | " + this.getYCoord() + " | " + this.getZCoord() + " DIMID: " + this.worldObj.provider.dimensionId + " explosion due to rain!"); + GT_Log.exp.println("Machine at: " + this.getXCoord() + " | " + + this.getYCoord() + " | " + this.getZCoord() + " DIMID: " + + this.worldObj.provider.dimensionId + " explosion due to rain!"); doEnergyExplosion(); } else { - GT_Log.exp.println("Machine at: " + this.getXCoord() + " | " + this.getYCoord() + " | " + this.getZCoord() + " DIMID: " + this.worldObj.provider.dimensionId + " set to Fire due to rain!"); + GT_Log.exp.println("Machine at: " + this.getXCoord() + " | " + + this.getYCoord() + " | " + this.getZCoord() + " DIMID: " + + this.worldObj.provider.dimensionId + + " set to Fire due to rain!"); setOnFire(); } } @@ -389,12 +459,18 @@ public class BaseMetaTileEntity extends CommonMetaTileEntity implements IGregTec mRunningThroughTick = false; return; } - if (GregTech_API.sMachineThunderExplosions && worldObj.isThundering() && getRandomNumber(3) == 0) { + if (GregTech_API.sMachineThunderExplosions + && worldObj.isThundering() + && getRandomNumber(3) == 0) { try { - GT_Mod.achievements.issueAchievement(this.getWorldObj().getPlayerEntityByName(mOwnerName), "badweather"); + GT_Mod.achievements.issueAchievement( + this.getWorldObj().getPlayerEntityByName(mOwnerName), "badweather"); } catch (Exception ignored) { } - GT_Log.exp.println("Machine at: " + this.getXCoord() + " | " + this.getYCoord() + " | " + this.getZCoord() + " DIMID: " + this.worldObj.provider.dimensionId + " explosion due to Thunderstorm!"); + GT_Log.exp.println("Machine at: " + this.getXCoord() + " | " + this.getYCoord() + + " | " + this.getZCoord() + " DIMID: " + + this.worldObj.provider.dimensionId + + " explosion due to Thunderstorm!"); doEnergyExplosion(); } } @@ -409,12 +485,21 @@ public class BaseMetaTileEntity extends CommonMetaTileEntity implements IGregTec } if (aSideServer) { if (mMetaTileEntity.dechargerSlotCount() > 0 && getStoredEU() < getEUCapacity()) { - for (int i = mMetaTileEntity.dechargerSlotStartIndex(), k = mMetaTileEntity.dechargerSlotCount() + i; i < k; i++) { + for (int i = mMetaTileEntity.dechargerSlotStartIndex(), + k = mMetaTileEntity.dechargerSlotCount() + i; + i < k; + i++) { 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()) { - increaseStoredEnergyUnits((long) ic2.api.info.Info.itemEnergy.getEnergyValue(mMetaTileEntity.mInventory[i]), false); + if ((getStoredEU() + + ic2.api.info.Info.itemEnergy.getEnergyValue( + mMetaTileEntity.mInventory[i])) + < getEUCapacity()) { + increaseStoredEnergyUnits( + (long) ic2.api.info.Info.itemEnergy.getEnergyValue( + mMetaTileEntity.mInventory[i]), + false); mMetaTileEntity.mInventory[i].stackSize--; mInventoryChanged = true; } @@ -429,7 +514,10 @@ public class BaseMetaTileEntity extends CommonMetaTileEntity implements IGregTec } if (aSideServer) { if (mMetaTileEntity.rechargerSlotCount() > 0 && getStoredEU() > 0) { - for (int i = mMetaTileEntity.rechargerSlotStartIndex(), k = mMetaTileEntity.rechargerSlotCount() + i; i < k; i++) { + for (int i = mMetaTileEntity.rechargerSlotStartIndex(), + k = mMetaTileEntity.rechargerSlotCount() + i; + i < k; + i++) { if (getStoredEU() > 0 && mMetaTileEntity.mInventory[i] != null) { chargeItem(mMetaTileEntity.mInventory[i]); if (mMetaTileEntity.mInventory[i].stackSize <= 0) { @@ -460,7 +548,11 @@ public class BaseMetaTileEntity extends CommonMetaTileEntity implements IGregTec } if (mTickTimer > 10) { - byte tData = (byte) ((mFacing & 7) | (mActive ? 8 : 0) | (mRedstone ? 16 : 0) | (mLockUpgrade ? 32 : 0) | (mWorks ? 64 : 0)); + byte tData = (byte) ((mFacing & 7) + | (mActive ? 8 : 0) + | (mRedstone ? 16 : 0) + | (mLockUpgrade ? 32 : 0) + | (mWorks ? 64 : 0)); if (tData != oTextureData) sendBlockEvent(GregTechTileClientEvents.CHANGE_COMMON_DATA, oTextureData = tData); @@ -470,10 +562,16 @@ public class BaseMetaTileEntity extends CommonMetaTileEntity implements IGregTec if (mMetaTileEntity instanceof GT_MetaTileEntity_Hatch) { tData = ((GT_MetaTileEntity_Hatch) mMetaTileEntity).getTexturePage(); if (tData != oTexturePage) - sendBlockEvent(GregTechTileClientEvents.CHANGE_CUSTOM_DATA, (byte) ((oTexturePage = tData) | 0x80));//set last bit as a flag for page + sendBlockEvent(GregTechTileClientEvents.CHANGE_CUSTOM_DATA, (byte) + ((oTexturePage = tData) | 0x80)); // set last bit as a flag for page } if (mColor != oColor) sendBlockEvent(GregTechTileClientEvents.CHANGE_COLOR, oColor = mColor); - tData = (byte) (((mSidedRedstone[0] > 0) ? 1 : 0) | ((mSidedRedstone[1] > 0) ? 2 : 0) | ((mSidedRedstone[2] > 0) ? 4 : 0) | ((mSidedRedstone[3] > 0) ? 8 : 0) | ((mSidedRedstone[4] > 0) ? 16 : 0) | ((mSidedRedstone[5] > 0) ? 32 : 0)); + tData = (byte) (((mSidedRedstone[0] > 0) ? 1 : 0) + | ((mSidedRedstone[1] > 0) ? 2 : 0) + | ((mSidedRedstone[2] > 0) ? 4 : 0) + | ((mSidedRedstone[3] > 0) ? 8 : 0) + | ((mSidedRedstone[4] > 0) ? 16 : 0) + | ((mSidedRedstone[5] > 0) ? 32 : 0)); if (tData != oRedstoneData) sendBlockEvent(GregTechTileClientEvents.CHANGE_REDSTONE_OUTPUT, oRedstoneData = tData); if (mLightValue != oLightValue) { @@ -505,16 +603,24 @@ public class BaseMetaTileEntity extends CommonMetaTileEntity implements IGregTec if (aSideServer && hasValidMetaTileEntity()) { tTime = System.nanoTime() - tTime; if (mTimeStatistics.length > 0) - mTimeStatistics[mTimeStatisticsIndex = (mTimeStatisticsIndex + 1) % mTimeStatistics.length] = (int) tTime; - if (tTime > 0 && tTime > (GregTech_API.MILLISECOND_THRESHOLD_UNTIL_LAG_WARNING * 1000000L) && mTickTimer > 1000 && getMetaTileEntity().doTickProfilingMessageDuringThisTick() && mLagWarningCount++ < 10) - GT_FML_LOGGER.warn("WARNING: Possible Lag Source at [" + xCoord + ", " + yCoord + ", " + zCoord + "] in Dimension " + worldObj.provider.dimensionId + " with " + tTime + "ns caused by an instance of " + getMetaTileEntity().getClass()); + mTimeStatistics[mTimeStatisticsIndex = (mTimeStatisticsIndex + 1) % mTimeStatistics.length] = + (int) tTime; + if (tTime > 0 + && tTime > (GregTech_API.MILLISECOND_THRESHOLD_UNTIL_LAG_WARNING * 1000000L) + && mTickTimer > 1000 + && getMetaTileEntity().doTickProfilingMessageDuringThisTick() + && mLagWarningCount++ < 10) + GT_FML_LOGGER.warn("WARNING: Possible Lag Source at [" + xCoord + ", " + yCoord + ", " + zCoord + + "] in Dimension " + worldObj.provider.dimensionId + " with " + tTime + + "ns caused by an instance of " + getMetaTileEntity().getClass()); } mWorkUpdate = mInventoryChanged = mRunningThroughTick = false; } @Override - public void getWailaBody(ItemStack itemStack, List<String> currenttip, IWailaDataAccessor accessor, IWailaConfigHandler config) { + public void getWailaBody( + ItemStack itemStack, List<String> currenttip, IWailaDataAccessor accessor, IWailaConfigHandler config) { if (hasValidMetaTileEntity() && getMetaTileEntity() != null) { getMetaTileEntity().getWailaBody(itemStack, currenttip, accessor, config); } @@ -522,7 +628,8 @@ public class BaseMetaTileEntity extends CommonMetaTileEntity implements IGregTec } @Override - public void getWailaNBTData(EntityPlayerMP player, TileEntity tile, NBTTagCompound tag, World world, int x, int y, int z) { + public void getWailaNBTData( + EntityPlayerMP player, TileEntity tile, NBTTagCompound tag, World world, int x, int y, int z) { super.getWailaNBTData(player, tile, tag, world, x, y, z); if (hasValidMetaTileEntity() && getMetaTileEntity() != null) { getMetaTileEntity().getWailaNBTData(player, tile, tag, world, x, y, z); @@ -532,22 +639,55 @@ public class BaseMetaTileEntity extends CommonMetaTileEntity implements IGregTec private void sendClientData() { if (mSendClientData) { NW.sendPacketToAllPlayersInRange( - worldObj, - new GT_Packet_TileEntity( - xCoord, (short) yCoord, zCoord, mID, mCoverSides[0], mCoverSides[1], mCoverSides[2], mCoverSides[3], mCoverSides[4], mCoverSides[5], - oTextureData = (byte) ((mFacing & 7) | (mActive ? 8 : 0) | (mRedstone ? 16 : 0) | (mLockUpgrade ? 32 : 0) | (mWorks ? 64 : 0)), - oTexturePage = (hasValidMetaTileEntity() && mMetaTileEntity instanceof GT_MetaTileEntity_Hatch) ? ((GT_MetaTileEntity_Hatch) mMetaTileEntity).getTexturePage() : 0, - oUpdateData = hasValidMetaTileEntity() ? mMetaTileEntity.getUpdateData() : 0, - oRedstoneData = (byte) (((mSidedRedstone[0] > 0) ? 1 : 0) | ((mSidedRedstone[1] > 0) ? 2 : 0) | ((mSidedRedstone[2] > 0) ? 4 : 0) | ((mSidedRedstone[3] > 0) ? 8 : 0) | ((mSidedRedstone[4] > 0) ? 16 : 0) | ((mSidedRedstone[5] > 0) ? 32 : 0)), - oColor = mColor), - xCoord, zCoord - ); + worldObj, + new GT_Packet_TileEntity( + xCoord, + (short) yCoord, + zCoord, + mID, + mCoverSides[0], + mCoverSides[1], + mCoverSides[2], + mCoverSides[3], + mCoverSides[4], + mCoverSides[5], + oTextureData = (byte) ((mFacing & 7) + | (mActive ? 8 : 0) + | (mRedstone ? 16 : 0) + | (mLockUpgrade ? 32 : 0) + | (mWorks ? 64 : 0)), + oTexturePage = + (hasValidMetaTileEntity() && mMetaTileEntity instanceof GT_MetaTileEntity_Hatch) + ? ((GT_MetaTileEntity_Hatch) mMetaTileEntity).getTexturePage() + : 0, + oUpdateData = hasValidMetaTileEntity() ? mMetaTileEntity.getUpdateData() : 0, + oRedstoneData = (byte) (((mSidedRedstone[0] > 0) ? 1 : 0) + | ((mSidedRedstone[1] > 0) ? 2 : 0) + | ((mSidedRedstone[2] > 0) ? 4 : 0) + | ((mSidedRedstone[3] > 0) ? 8 : 0) + | ((mSidedRedstone[4] > 0) ? 16 : 0) + | ((mSidedRedstone[5] > 0) ? 32 : 0)), + oColor = mColor), + xCoord, + zCoord); mSendClientData = false; } sendCoverDataIfNeeded(); } - public final void receiveMetaTileEntityData(short aID, int aCover0, int aCover1, int aCover2, int aCover3, int aCover4, int aCover5, byte aTextureData, byte aTexturePage, byte aUpdateData, byte aRedstoneData, byte aColorData) { + public final void receiveMetaTileEntityData( + short aID, + int aCover0, + int aCover1, + int aCover2, + int aCover3, + int aCover4, + int aCover5, + byte aTextureData, + byte aTexturePage, + byte aUpdateData, + byte aRedstoneData, + byte aColorData) { issueTextureUpdate(); if (mID != aID && aID > 0) { mID = aID; @@ -569,11 +709,33 @@ public class BaseMetaTileEntity extends CommonMetaTileEntity implements IGregTec } @Deprecated - public final void receiveMetaTileEntityData(short aID, int aCover0, int aCover1, int aCover2, int aCover3, int aCover4, int aCover5, byte aTextureData, byte aUpdateData, byte aRedstoneData, byte aColorData) { - receiveMetaTileEntityData(aID, aCover0, aCover1, aCover2, aCover3, aCover4, aCover5, aTextureData, (byte) 0, aUpdateData, aRedstoneData, aColorData); + public final void receiveMetaTileEntityData( + short aID, + int aCover0, + int aCover1, + int aCover2, + int aCover3, + int aCover4, + int aCover5, + byte aTextureData, + byte aUpdateData, + byte aRedstoneData, + byte aColorData) { + receiveMetaTileEntityData( + aID, + aCover0, + aCover1, + aCover2, + aCover3, + aCover4, + aCover5, + aTextureData, + (byte) 0, + aUpdateData, + aRedstoneData, + aColorData); } - @Override public boolean receiveClientEvent(int aEventID, int aValue) { super.receiveClientEvent(aEventID, aValue); @@ -582,7 +744,8 @@ public class BaseMetaTileEntity extends CommonMetaTileEntity implements IGregTec try { mMetaTileEntity.receiveClientEvent((byte) aEventID, (byte) aValue); } catch (Throwable e) { - GT_Log.err.println("Encountered Exception while receiving Data from the Server, the Client should've been crashed by now, but I prevented that. Please report immediately to GregTech Intergalactical!!!"); + GT_Log.err.println( + "Encountered Exception while receiving Data from the Server, the Client should've been crashed by now, but I prevented that. Please report immediately to GregTech Intergalactical!!!"); e.printStackTrace(GT_Log.err); } } @@ -594,15 +757,15 @@ public class BaseMetaTileEntity extends CommonMetaTileEntity implements IGregTec mFacing = (byte) (aValue & 7); mActive = ((aValue & 8) != 0); mRedstone = ((aValue & 16) != 0); - //mLockUpgrade = ((aValue&32) != 0); + // mLockUpgrade = ((aValue&32) != 0); mWorks = ((aValue & 64) != 0); break; case GregTechTileClientEvents.CHANGE_CUSTOM_DATA: if (hasValidMetaTileEntity()) { - if ((aValue & 0x80) == 0) //Is texture index - mMetaTileEntity.onValueUpdate((byte) (aValue & 0x7F)); - else if (mMetaTileEntity instanceof GT_MetaTileEntity_Hatch)//is texture page and hatch - ((GT_MetaTileEntity_Hatch) mMetaTileEntity).onTexturePageUpdate((byte) (aValue & 0x7F)); + if ((aValue & 0x80) == 0) // Is texture index + mMetaTileEntity.onValueUpdate((byte) (aValue & 0x7F)); + else if (mMetaTileEntity instanceof GT_MetaTileEntity_Hatch) // is texture page and hatch + ((GT_MetaTileEntity_Hatch) mMetaTileEntity).onTexturePageUpdate((byte) (aValue & 0x7F)); } break; case GregTechTileClientEvents.CHANGE_COLOR: @@ -641,7 +804,13 @@ public class BaseMetaTileEntity extends CommonMetaTileEntity implements IGregTec public ArrayList<String> getDebugInfo(EntityPlayer aPlayer, int aLogLevel) { final ArrayList<String> tList = new ArrayList<>(); if (aLogLevel > 2) { - tList.add("Meta-ID: " + EnumChatFormatting.BLUE + mID + EnumChatFormatting.RESET + (canAccessData() ? EnumChatFormatting.GREEN + " valid" + EnumChatFormatting.RESET : EnumChatFormatting.RED + " invalid" + EnumChatFormatting.RESET) + (mMetaTileEntity == null ? EnumChatFormatting.RED + " MetaTileEntity == null!" + EnumChatFormatting.RESET : " ")); + tList.add("Meta-ID: " + EnumChatFormatting.BLUE + mID + EnumChatFormatting.RESET + + (canAccessData() + ? EnumChatFormatting.GREEN + " valid" + EnumChatFormatting.RESET + : EnumChatFormatting.RED + " invalid" + EnumChatFormatting.RESET) + + (mMetaTileEntity == null + ? EnumChatFormatting.RED + " MetaTileEntity == null!" + EnumChatFormatting.RESET + : " ")); } if (aLogLevel > 1) { if (mTimeStatistics.length > 0) { @@ -653,27 +822,40 @@ public class BaseMetaTileEntity extends CommonMetaTileEntity implements IGregTec tWorstTime = tTime; } // Uncomment this line to print out tick-by-tick times. - //tList.add("tTime " + tTime); + // tList.add("tTime " + tTime); } - tList.add("Average CPU load of ~" + GT_Utility.formatNumbers(tAverageTime / mTimeStatistics.length) + "ns over " + GT_Utility.formatNumbers(mTimeStatistics.length) + " ticks with worst time of " + GT_Utility.formatNumbers(tWorstTime) + "ns."); - tList.add("Recorded " + GT_Utility.formatNumbers(mMetaTileEntity.mSoundRequests) + " sound requests in " + GT_Utility.formatNumbers(mTickTimer - mLastCheckTick) + " ticks."); + tList.add("Average CPU load of ~" + GT_Utility.formatNumbers(tAverageTime / mTimeStatistics.length) + + "ns over " + GT_Utility.formatNumbers(mTimeStatistics.length) + " ticks with worst time of " + + GT_Utility.formatNumbers(tWorstTime) + "ns."); + tList.add("Recorded " + GT_Utility.formatNumbers(mMetaTileEntity.mSoundRequests) + " sound requests in " + + GT_Utility.formatNumbers(mTickTimer - mLastCheckTick) + " ticks."); mLastCheckTick = mTickTimer; mMetaTileEntity.mSoundRequests = 0; } if (mLagWarningCount > 0) { - tList.add("Caused " + (mLagWarningCount >= 10 ? "more than 10" : mLagWarningCount) + " Lag Spike Warnings (anything taking longer than " + GregTech_API.MILLISECOND_THRESHOLD_UNTIL_LAG_WARNING + "ms) on the Server."); + tList.add("Caused " + (mLagWarningCount >= 10 ? "more than 10" : mLagWarningCount) + + " Lag Spike Warnings (anything taking longer than " + + GregTech_API.MILLISECOND_THRESHOLD_UNTIL_LAG_WARNING + "ms) on the Server."); } - tList.add("Is" + (mMetaTileEntity.isAccessAllowed(aPlayer) ? " " : EnumChatFormatting.RED + " not " + EnumChatFormatting.RESET) + "accessible for you"); + tList.add("Is" + + (mMetaTileEntity.isAccessAllowed(aPlayer) + ? " " + : EnumChatFormatting.RED + " not " + EnumChatFormatting.RESET) + + "accessible for you"); } if (aLogLevel > 0) { if (getSteamCapacity() > 0 && hasSteamEngineUpgrade()) - tList.add(GT_Utility.formatNumbers(getStoredSteam()) + " of " + GT_Utility.formatNumbers(getSteamCapacity()) + " Steam"); - tList.add("Machine is " + (mActive ? EnumChatFormatting.GREEN + "active" + EnumChatFormatting.RESET : EnumChatFormatting.RED + "inactive" + EnumChatFormatting.RESET)); + tList.add(GT_Utility.formatNumbers(getStoredSteam()) + " of " + + GT_Utility.formatNumbers(getSteamCapacity()) + " Steam"); + tList.add("Machine is " + + (mActive + ? EnumChatFormatting.GREEN + "active" + EnumChatFormatting.RESET + : EnumChatFormatting.RED + "inactive" + EnumChatFormatting.RESET)); if (!mHasEnoughEnergy) - tList.add(EnumChatFormatting.RED + "ATTENTION: This Device needs more power." + EnumChatFormatting.RESET); + tList.add( + EnumChatFormatting.RED + "ATTENTION: This Device needs more power." + EnumChatFormatting.RESET); } - if (joinedIc2Enet) - tList.add("Joined IC2 ENet"); + if (joinedIc2Enet) tList.add("Joined IC2 ENet"); return mMetaTileEntity.getSpecialDebugInfo(this, aPlayer, aLogLevel, tList); } @@ -729,7 +911,8 @@ public class BaseMetaTileEntity extends CommonMetaTileEntity implements IGregTec mInventoryChanged = true; if (canAccessData()) { markDirty(); - mMetaTileEntity.setInventorySlotContents(aIndex, worldObj.isRemote ? aStack : GT_OreDictUnificator.setStack(true, aStack)); + mMetaTileEntity.setInventorySlotContents( + aIndex, worldObj.isRemote ? aStack : GT_OreDictUnificator.setStack(true, aStack)); } } @@ -758,9 +941,12 @@ public class BaseMetaTileEntity extends CommonMetaTileEntity implements IGregTec @Override public boolean isUseableByPlayer(EntityPlayer aPlayer) { - return canAccessData() && playerOwnsThis(aPlayer, false) && mTickTimer > 40 && - getTileEntityOffset(0, 0, 0) == this && - aPlayer.getDistanceSq(xCoord + 0.5, yCoord + 0.5, zCoord + 0.5) < 64 && mMetaTileEntity.isAccessAllowed(aPlayer); + return canAccessData() + && playerOwnsThis(aPlayer, false) + && mTickTimer > 40 + && getTileEntityOffset(0, 0, 0) == this + && aPlayer.getDistanceSq(xCoord + 0.5, yCoord + 0.5, zCoord + 0.5) < 64 + && mMetaTileEntity.isAccessAllowed(aPlayer); } @Override @@ -774,8 +960,7 @@ public class BaseMetaTileEntity extends CommonMetaTileEntity implements IGregTec tileEntityInvalid = false; leaveEnet(); if (canAccessData()) { - if (GregTech_API.mAE2) - invalidateAE(); + if (GregTech_API.mAE2) invalidateAE(); mMetaTileEntity.onRemoval(); mMetaTileEntity.setBaseMetaTileEntity(null); } @@ -785,8 +970,7 @@ public class BaseMetaTileEntity extends CommonMetaTileEntity implements IGregTec @Override public void onChunkUnload() { super.onChunkUnload(); - if (GregTech_API.mAE2) - onChunkUnloadAE(); + if (GregTech_API.mAE2) onChunkUnloadAE(); } @Override @@ -898,7 +1082,9 @@ public class BaseMetaTileEntity extends CommonMetaTileEntity implements IGregTec @Override public boolean decreaseStoredEnergyUnits(long aEnergy, boolean aIgnoreTooLessEnergy) { if (!canAccessData()) return false; - return mHasEnoughEnergy = decreaseStoredEU(aEnergy, aIgnoreTooLessEnergy) || decreaseStoredSteam(aEnergy, false) || (aIgnoreTooLessEnergy && (decreaseStoredSteam(aEnergy, true))); + return mHasEnoughEnergy = decreaseStoredEU(aEnergy, aIgnoreTooLessEnergy) + || decreaseStoredSteam(aEnergy, false) + || (aIgnoreTooLessEnergy && (decreaseStoredSteam(aEnergy, true))); } @Override @@ -1039,9 +1225,10 @@ 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) : - Textures.BlockIcons.ERROR_RENDERING; + 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) { textureCovered = Arrays.copyOf(textureUncovered, textureUncovered.length + 1); @@ -1054,8 +1241,8 @@ public class BaseMetaTileEntity extends CommonMetaTileEntity implements IGregTec private boolean isEnergyInputSide(byte aSide) { if (aSide >= 0 && aSide < 6) { - if (!getCoverBehaviorAtSideNew(aSide).letsEnergyIn(aSide, getCoverIDAtSide(aSide), getComplexCoverDataAtSide(aSide), this)) - return false; + if (!getCoverBehaviorAtSideNew(aSide) + .letsEnergyIn(aSide, getCoverIDAtSide(aSide), getComplexCoverDataAtSide(aSide), this)) return false; if (isInvalid() || mReleaseEnergy) return false; if (canAccessData() && mMetaTileEntity.isElectric() && mMetaTileEntity.isEnetInput()) return mMetaTileEntity.isInputFacing(aSide); @@ -1065,7 +1252,8 @@ public class BaseMetaTileEntity extends CommonMetaTileEntity implements IGregTec private boolean isEnergyOutputSide(byte aSide) { if (aSide >= 0 && aSide < 6) { - if (!getCoverBehaviorAtSideNew(aSide).letsEnergyOut(aSide, getCoverIDAtSide(aSide), getComplexCoverDataAtSide(aSide), this)) + if (!getCoverBehaviorAtSideNew(aSide) + .letsEnergyOut(aSide, getCoverIDAtSide(aSide), getComplexCoverDataAtSide(aSide), this)) return false; if (isInvalid() || mReleaseEnergy) return mReleaseEnergy; if (canAccessData() && mMetaTileEntity.isElectric() && mMetaTileEntity.isEnetOutput()) @@ -1133,7 +1321,10 @@ public class BaseMetaTileEntity extends CommonMetaTileEntity implements IGregTec setOwnerName(aPlayer.getDisplayName()); setOwnerUuid(aPlayer.getUniqueID()); } else - return !privateAccess() || aPlayer.getDisplayName().equals("Player") || mOwnerName.equals("Player") || mOwnerName.equals(aPlayer.getDisplayName()); + return !privateAccess() + || aPlayer.getDisplayName().equals("Player") + || mOwnerName.equals("Player") + || mOwnerName.equals(aPlayer.getDisplayName()); return true; } @@ -1144,10 +1335,15 @@ public class BaseMetaTileEntity extends CommonMetaTileEntity implements IGregTec public void doEnergyExplosion() { if (getUniversalEnergyCapacity() > 0 && getUniversalEnergyStored() >= getUniversalEnergyCapacity() / 5) { - GT_Log.exp.println("Energy Explosion, injected " + getUniversalEnergyStored() + "EU >= " + getUniversalEnergyCapacity() / 5D + "Capacity of the Machine!"); - - doExplosion(oOutput * (getUniversalEnergyStored() >= getUniversalEnergyCapacity() ? 4 : getUniversalEnergyStored() >= getUniversalEnergyCapacity() / 2 ? 2 : 1)); - GT_Mod.achievements.issueAchievement(this.getWorldObj().getPlayerEntityByName(mOwnerName), "electricproblems"); + GT_Log.exp.println("Energy Explosion, injected " + getUniversalEnergyStored() + "EU >= " + + getUniversalEnergyCapacity() / 5D + "Capacity of the Machine!"); + + doExplosion(oOutput + * (getUniversalEnergyStored() >= getUniversalEnergyCapacity() + ? 4 + : getUniversalEnergyStored() >= getUniversalEnergyCapacity() / 2 ? 2 : 1)); + GT_Mod.achievements.issueAchievement( + this.getWorldObj().getPlayerEntityByName(mOwnerName), "electricproblems"); } } @@ -1189,9 +1385,15 @@ public class BaseMetaTileEntity extends CommonMetaTileEntity implements IGregTec public void dropItems(ItemStack tItem) { if (tItem == null) return; - final EntityItem tItemEntity = new EntityItem(this.worldObj, this.xCoord + XSTR_INSTANCE.nextFloat() * 0.8F + 0.1F, this.yCoord + XSTR_INSTANCE.nextFloat() * 0.8F + 0.1F, this.zCoord + XSTR_INSTANCE.nextFloat() * 0.8F + 0.1F, new ItemStack(tItem.getItem(), tItem.stackSize, tItem.getItemDamage())); + final EntityItem tItemEntity = new EntityItem( + this.worldObj, + this.xCoord + XSTR_INSTANCE.nextFloat() * 0.8F + 0.1F, + this.yCoord + XSTR_INSTANCE.nextFloat() * 0.8F + 0.1F, + 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); @@ -1199,8 +1401,7 @@ public class BaseMetaTileEntity extends CommonMetaTileEntity implements IGregTec tItemEntity.hurtResistantTime = 999999; tItemEntity.lifespan = 60000; try { - if (ENTITY_ITEM_HEALTH_FIELD != null) - ENTITY_ITEM_HEALTH_FIELD.setInt(tItemEntity, 99999999); + if (ENTITY_ITEM_HEALTH_FIELD != null) ENTITY_ITEM_HEALTH_FIELD.setInt(tItemEntity, 99999999); } catch (Exception ignored) { } this.worldObj.spawnEntityInWorld(tItemEntity); @@ -1232,34 +1433,43 @@ public class BaseMetaTileEntity extends CommonMetaTileEntity implements IGregTec @Override public boolean onRightclick(EntityPlayer aPlayer, byte aSide, float aX, float aY, float aZ) { if (isClientSide()) { - //Configure Cover, sneak can also be: screwdriver, wrench, side cutter, soldering iron + // Configure Cover, sneak can also be: screwdriver, wrench, side cutter, soldering iron if (aPlayer.isSneaking()) { - final byte tSide = (getCoverIDAtSide(aSide) == 0) ? GT_Utility.determineWrenchingSide(aSide, aX, aY, aZ) : aSide; + final byte tSide = + (getCoverIDAtSide(aSide) == 0) ? GT_Utility.determineWrenchingSide(aSide, aX, aY, aZ) : aSide; return (getCoverBehaviorAtSideNew(tSide).hasCoverGUI()); } else if (getCoverBehaviorAtSideNew(aSide).onCoverRightclickClient(aSide, this, aPlayer, aX, aY, aZ)) { return true; } - if (!getCoverBehaviorAtSideNew(aSide).isGUIClickable(aSide, getCoverIDAtSide(aSide), getComplexCoverDataAtSide(aSide), this)) + if (!getCoverBehaviorAtSideNew(aSide) + .isGUIClickable(aSide, getCoverIDAtSide(aSide), getComplexCoverDataAtSide(aSide), this)) return false; } if (isServerSide()) { if (!privateAccess() || aPlayer.getDisplayName().equalsIgnoreCase(getOwnerName())) { final ItemStack tCurrentItem = aPlayer.inventory.getCurrentItem(); if (tCurrentItem != null) { - if (getColorization() >= 0 && GT_Utility.areStacksEqual(new ItemStack(Items.water_bucket, 1), tCurrentItem)) { + if (getColorization() >= 0 + && GT_Utility.areStacksEqual(new ItemStack(Items.water_bucket, 1), tCurrentItem)) { tCurrentItem.func_150996_a(Items.bucket); setColorization((byte) (getColorization() >= 16 ? -2 : -1)); return true; } 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))) { + if (aPlayer.isSneaking() + && mMetaTileEntity instanceof GT_MetaTileEntity_BasicMachine + && ((GT_MetaTileEntity_BasicMachine) mMetaTileEntity) + .setMainFacing(GT_Utility.determineWrenchingSide(aSide, aX, aY, aZ))) { GT_ModHandler.damageOrDechargeItem(tCurrentItem, 1, 1000, aPlayer); - GT_Utility.sendSoundToPlayers(worldObj, SoundResource.IC2_TOOLS_WRENCH, 1.0F, -1, xCoord, yCoord, zCoord); + GT_Utility.sendSoundToPlayers( + worldObj, SoundResource.IC2_TOOLS_WRENCH, 1.0F, -1, xCoord, yCoord, zCoord); cableUpdateDelay = 10; - } else if (mMetaTileEntity.onWrenchRightClick(aSide, GT_Utility.determineWrenchingSide(aSide, aX, aY, aZ), aPlayer, aX, aY, aZ)) { + } else if (mMetaTileEntity.onWrenchRightClick( + aSide, GT_Utility.determineWrenchingSide(aSide, aX, aY, aZ), aPlayer, aX, aY, aZ)) { GT_ModHandler.damageOrDechargeItem(tCurrentItem, 1, 1000, aPlayer); - GT_Utility.sendSoundToPlayers(worldObj, SoundResource.IC2_TOOLS_WRENCH, 1.0F, -1, xCoord, yCoord, zCoord); + GT_Utility.sendSoundToPlayers( + worldObj, SoundResource.IC2_TOOLS_WRENCH, 1.0F, -1, xCoord, yCoord, zCoord); cableUpdateDelay = 10; } return true; @@ -1267,9 +1477,21 @@ public class BaseMetaTileEntity extends CommonMetaTileEntity implements IGregTec if (GT_Utility.isStackInList(tCurrentItem, GregTech_API.sScrewdriverList)) { if (GT_ModHandler.damageOrDechargeItem(tCurrentItem, 1, 200, aPlayer)) { - setCoverDataAtSide(aSide, getCoverBehaviorAtSideNew(aSide).onCoverScrewdriverClick(aSide, getCoverIDAtSide(aSide), getComplexCoverDataAtSide(aSide), this, aPlayer, aX, aY, aZ)); + setCoverDataAtSide( + aSide, + getCoverBehaviorAtSideNew(aSide) + .onCoverScrewdriverClick( + aSide, + getCoverIDAtSide(aSide), + getComplexCoverDataAtSide(aSide), + this, + aPlayer, + aX, + aY, + aZ)); mMetaTileEntity.onScrewdriverRightClick(aSide, aPlayer, aX, aY, aZ); - GT_Utility.sendSoundToPlayers(worldObj, SoundResource.IC2_TOOLS_WRENCH, 1.0F, -1, xCoord, yCoord, zCoord); + GT_Utility.sendSoundToPlayers( + worldObj, SoundResource.IC2_TOOLS_WRENCH, 1.0F, -1, xCoord, yCoord, zCoord); } return true; } @@ -1278,8 +1500,18 @@ 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.sendSoundToPlayers(worldObj, SoundResource.RANDOM_ANVIL_USE, 1.0F, -1, xCoord, yCoord, zCoord); + 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, 1.0F, -1, xCoord, yCoord, zCoord); } return true; } @@ -1289,12 +1521,23 @@ public class BaseMetaTileEntity extends CommonMetaTileEntity implements IGregTec if (mWorks) disableWorking(); else enableWorking(); { - String tChat = GT_Utility.trans("090", "Machine Processing: ") + (isAllowedToWork() ? GT_Utility.trans("088", "Enabled") : GT_Utility.trans("087", "Disabled")); - if (getMetaTileEntity() != null && getMetaTileEntity().hasAlternativeModeText()) + String tChat = GT_Utility.trans("090", "Machine Processing: ") + + (isAllowedToWork() + ? GT_Utility.trans("088", "Enabled") + : GT_Utility.trans("087", "Disabled")); + if (getMetaTileEntity() != null + && getMetaTileEntity().hasAlternativeModeText()) tChat = getMetaTileEntity().getAlternativeModeText(); GT_Utility.sendChatToPlayer(aPlayer, tChat); } - GT_Utility.sendSoundToPlayers(worldObj, SoundResource.IC2_TOOLS_RUBBER_TRAMPOLINE, 1.0F, -1, xCoord, yCoord, zCoord); + GT_Utility.sendSoundToPlayers( + worldObj, + SoundResource.IC2_TOOLS_RUBBER_TRAMPOLINE, + 1.0F, + -1, + xCoord, + yCoord, + zCoord); } return true; } @@ -1302,12 +1545,21 @@ public class BaseMetaTileEntity extends CommonMetaTileEntity implements IGregTec if (GT_Utility.isStackInList(tCurrentItem, GregTech_API.sSolderingToolList)) { final byte tSide = GT_Utility.determineWrenchingSide(aSide, aX, aY, aZ); if (mMetaTileEntity.onSolderingToolRightClick(aSide, tSide, aPlayer, aX, aY, aZ)) { - //logic handled internally - GT_Utility.sendSoundToPlayers(worldObj, SoundResource.IC2_TOOLS_BATTERY_USE, 1.0F, -1, xCoord, yCoord, zCoord); + // logic handled internally + GT_Utility.sendSoundToPlayers( + worldObj, SoundResource.IC2_TOOLS_BATTERY_USE, 1.0F, -1, xCoord, yCoord, zCoord); } else if (GT_ModHandler.useSolderingIron(tCurrentItem, aPlayer)) { mStrongRedstone ^= (1 << tSide); - GT_Utility.sendChatToPlayer(aPlayer, GT_Utility.trans("091", "Redstone Output at Side ") + tSide + GT_Utility.trans("092", " set to: ") + ((mStrongRedstone & (1 << tSide)) != 0 ? GT_Utility.trans("093", "Strong") : GT_Utility.trans("094", "Weak"))); - GT_Utility.sendSoundToPlayers(worldObj, SoundResource.IC2_TOOLS_BATTERY_USE, 3.0F, -1, xCoord, yCoord, zCoord); + GT_Utility.sendChatToPlayer( + aPlayer, + GT_Utility.trans("091", "Redstone Output at Side ") + + tSide + + GT_Utility.trans("092", " set to: ") + + ((mStrongRedstone & (1 << tSide)) != 0 + ? GT_Utility.trans("093", "Strong") + : GT_Utility.trans("094", "Weak"))); + GT_Utility.sendSoundToPlayers( + worldObj, SoundResource.IC2_TOOLS_BATTERY_USE, 3.0F, -1, xCoord, yCoord, zCoord); issueBlockUpdate(); } doEnetUpdate(); @@ -1318,8 +1570,9 @@ public class BaseMetaTileEntity extends CommonMetaTileEntity implements IGregTec if (GT_Utility.isStackInList(tCurrentItem, GregTech_API.sWireCutterList)) { final byte tSide = GT_Utility.determineWrenchingSide(aSide, aX, aY, aZ); if (mMetaTileEntity.onWireCutterRightClick(aSide, tSide, aPlayer, aX, aY, aZ)) { - //logic handled internally - GT_Utility.sendSoundToPlayers(worldObj, SoundResource.IC2_TOOLS_WRENCH, 1.0F, -1, xCoord, yCoord, zCoord); + // logic handled internally + GT_Utility.sendSoundToPlayers( + worldObj, SoundResource.IC2_TOOLS_WRENCH, 1.0F, -1, xCoord, yCoord, zCoord); } doEnetUpdate(); cableUpdateDelay = 10; @@ -1331,38 +1584,60 @@ 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) && - mMetaTileEntity.allowCoverOnSide(coverSide, new GT_ItemStack(tCurrentItem))) { + if (GregTech_API.getCoverBehaviorNew(tCurrentItem) + .isCoverPlaceable(coverSide, tCurrentItem, this) + && mMetaTileEntity.allowCoverOnSide(coverSide, new GT_ItemStack(tCurrentItem))) { setCoverItemAtSide(coverSide, tCurrentItem); if (!aPlayer.capabilities.isCreativeMode) tCurrentItem.stackSize--; - GT_Utility.sendSoundToPlayers(worldObj, SoundResource.IC2_TOOLS_WRENCH, 1.0F, -1, xCoord, yCoord, zCoord); + GT_Utility.sendSoundToPlayers( + worldObj, SoundResource.IC2_TOOLS_WRENCH, 1.0F, -1, xCoord, yCoord, zCoord); } return true; } } else { if (GT_Utility.isStackInList(tCurrentItem, GregTech_API.sCrowbarList)) { if (GT_ModHandler.damageOrDechargeItem(tCurrentItem, 1, 1000, aPlayer)) { - GT_Utility.sendSoundToPlayers(worldObj, SoundResource.RANDOM_BREAK, 1.0F, -1, xCoord, yCoord, zCoord); + GT_Utility.sendSoundToPlayers( + worldObj, SoundResource.RANDOM_BREAK, 1.0F, -1, xCoord, yCoord, zCoord); dropCover(coverSide, aSide, false); } return true; } } - } else if (aPlayer.isSneaking()) { //Sneak click, no tool -> open cover config if possible. - aSide = (getCoverIDAtSide(aSide) == 0) ? GT_Utility.determineWrenchingSide(aSide, aX, aY, aZ) : aSide; - return getCoverIDAtSide(aSide) > 0 && getCoverBehaviorAtSideNew(aSide).onCoverShiftRightClick(aSide, getCoverIDAtSide(aSide), getComplexCoverDataAtSide(aSide), this, aPlayer); + } else if (aPlayer.isSneaking()) { // Sneak click, no tool -> open cover config if possible. + aSide = (getCoverIDAtSide(aSide) == 0) + ? GT_Utility.determineWrenchingSide(aSide, aX, aY, aZ) + : aSide; + return getCoverIDAtSide(aSide) > 0 + && getCoverBehaviorAtSideNew(aSide) + .onCoverShiftRightClick( + aSide, + getCoverIDAtSide(aSide), + getComplexCoverDataAtSide(aSide), + this, + aPlayer); } - if (getCoverBehaviorAtSideNew(aSide).onCoverRightClick(aSide, getCoverIDAtSide(aSide), getComplexCoverDataAtSide(aSide), this, aPlayer, aX, aY, aZ)) - return true; - - if (!getCoverBehaviorAtSideNew(aSide).isGUIClickable(aSide, getCoverIDAtSide(aSide), getComplexCoverDataAtSide(aSide), this)) + if (getCoverBehaviorAtSideNew(aSide) + .onCoverRightClick( + aSide, + getCoverIDAtSide(aSide), + getComplexCoverDataAtSide(aSide), + this, + aPlayer, + aX, + aY, + aZ)) return true; + + if (!getCoverBehaviorAtSideNew(aSide) + .isGUIClickable(aSide, getCoverIDAtSide(aSide), getComplexCoverDataAtSide(aSide), this)) return false; if (isUpgradable() && tCurrentItem != null) { if (ItemList.Upgrade_Muffler.isStackEqual(aPlayer.inventory.getCurrentItem())) { if (addMufflerUpgrade()) { - GT_Utility.sendSoundToPlayers(worldObj, SoundResource.RANDOM_CLICK, 1.0F, -1, xCoord, yCoord, zCoord); + GT_Utility.sendSoundToPlayers( + worldObj, SoundResource.RANDOM_CLICK, 1.0F, -1, xCoord, yCoord, zCoord); if (!aPlayer.capabilities.isCreativeMode) aPlayer.inventory.getCurrentItem().stackSize--; } return true; @@ -1372,7 +1647,8 @@ public class BaseMetaTileEntity extends CommonMetaTileEntity implements IGregTec mLockUpgrade = true; setOwnerName(aPlayer.getDisplayName()); setOwnerUuid(aPlayer.getUniqueID()); - GT_Utility.sendSoundToPlayers(worldObj, SoundResource.RANDOM_CLICK, 1.0F, -1, xCoord, yCoord, zCoord); + GT_Utility.sendSoundToPlayers( + worldObj, SoundResource.RANDOM_CLICK, 1.0F, -1, xCoord, yCoord, zCoord); if (!aPlayer.capabilities.isCreativeMode) aPlayer.inventory.getCurrentItem().stackSize--; } return true; @@ -1385,7 +1661,8 @@ public class BaseMetaTileEntity extends CommonMetaTileEntity implements IGregTec if (!aPlayer.isSneaking() && hasValidMetaTileEntity()) return mMetaTileEntity.onRightclick(this, aPlayer, aSide, aX, aY, aZ); } catch (Throwable e) { - GT_Log.err.println("Encountered Exception while rightclicking TileEntity, the Game should've crashed now, but I prevented that. Please report immediately to GregTech Intergalactical!!!"); + GT_Log.err.println( + "Encountered Exception while rightclicking TileEntity, the Game should've crashed now, but I prevented that. Please report immediately to GregTech Intergalactical!!!"); e.printStackTrace(GT_Log.err); } @@ -1397,7 +1674,8 @@ public class BaseMetaTileEntity extends CommonMetaTileEntity implements IGregTec try { if (aPlayer != null && hasValidMetaTileEntity()) mMetaTileEntity.onLeftclick(this, aPlayer); } catch (Throwable e) { - GT_Log.err.println("Encountered Exception while leftclicking TileEntity, the Game should've crashed now, but I prevented that. Please report immediately to GregTech Intergalactical!!!"); + GT_Log.err.println( + "Encountered Exception while leftclicking TileEntity, the Game should've crashed now, but I prevented that. Please report immediately to GregTech Intergalactical!!!"); e.printStackTrace(GT_Log.err); } } @@ -1439,8 +1717,21 @@ public class BaseMetaTileEntity extends CommonMetaTileEntity implements IGregTec */ @Override public int[] getAccessibleSlotsFromSide(int aSide) { - if (canAccessData() && (getCoverBehaviorAtSideNew((byte) aSide).letsItemsOut((byte) aSide, getCoverIDAtSide((byte) aSide), getComplexCoverDataAtSide((byte) aSide), -1, this) || getCoverBehaviorAtSideNew((byte) aSide).letsItemsIn((byte) aSide, getCoverIDAtSide((byte) aSide), getComplexCoverDataAtSide((byte) aSide), -1, this))) - return mMetaTileEntity.getAccessibleSlotsFromSide(aSide); + if (canAccessData() + && (getCoverBehaviorAtSideNew((byte) aSide) + .letsItemsOut( + (byte) aSide, + getCoverIDAtSide((byte) aSide), + getComplexCoverDataAtSide((byte) aSide), + -1, + this) + || getCoverBehaviorAtSideNew((byte) aSide) + .letsItemsIn( + (byte) aSide, + getCoverIDAtSide((byte) aSide), + getComplexCoverDataAtSide((byte) aSide), + -1, + this))) return mMetaTileEntity.getAccessibleSlotsFromSide(aSide); return GT_Values.emptyIntArray; } @@ -1449,7 +1740,16 @@ public class BaseMetaTileEntity extends CommonMetaTileEntity implements IGregTec */ @Override public boolean canInsertItem(int aIndex, ItemStack aStack, int aSide) { - return canAccessData() && (mRunningThroughTick || !mInputDisabled) && getCoverBehaviorAtSideNew((byte) aSide).letsItemsIn((byte) aSide, getCoverIDAtSide((byte) aSide), getComplexCoverDataAtSide((byte) aSide), aIndex, this) && mMetaTileEntity.canInsertItem(aIndex, aStack, aSide); + return canAccessData() + && (mRunningThroughTick || !mInputDisabled) + && getCoverBehaviorAtSideNew((byte) aSide) + .letsItemsIn( + (byte) aSide, + getCoverIDAtSide((byte) aSide), + getComplexCoverDataAtSide((byte) aSide), + aIndex, + this) + && mMetaTileEntity.canInsertItem(aIndex, aStack, aSide); } /** @@ -1457,7 +1757,16 @@ public class BaseMetaTileEntity extends CommonMetaTileEntity implements IGregTec */ @Override public boolean canExtractItem(int aIndex, ItemStack aStack, int aSide) { - return canAccessData() && (mRunningThroughTick || !mOutputDisabled) && getCoverBehaviorAtSideNew((byte) aSide).letsItemsOut((byte) aSide, getCoverIDAtSide((byte) aSide), getComplexCoverDataAtSide((byte) aSide), aIndex, this) && mMetaTileEntity.canExtractItem(aIndex, aStack, aSide); + return canAccessData() + && (mRunningThroughTick || !mOutputDisabled) + && getCoverBehaviorAtSideNew((byte) aSide) + .letsItemsOut( + (byte) aSide, + getCoverIDAtSide((byte) aSide), + getComplexCoverDataAtSide((byte) aSide), + aIndex, + this) + && mMetaTileEntity.canExtractItem(aIndex, aStack, aSide); } @Override @@ -1471,7 +1780,6 @@ public class BaseMetaTileEntity extends CommonMetaTileEntity implements IGregTec return mMetaTileEntity.allowGeneralRedstoneOutput() ? mSidedRedstone[aSide] : 0; } - @Override public boolean isSteamEngineUpgradable() { return isUpgradable() && !hasSteamEngineUpgrade() && getSteamCapacity() > 0; @@ -1546,22 +1854,17 @@ public class BaseMetaTileEntity extends CommonMetaTileEntity implements IGregTec @Override public long getAverageElectricInput() { long rEU = 0; - for (int i = 0; i < mAverageEUInput.length; ++i) - if (i != mAverageEUInputIndex) - rEU += mAverageEUInput[i]; + for (int i = 0; i < mAverageEUInput.length; ++i) if (i != mAverageEUInputIndex) rEU += mAverageEUInput[i]; return rEU / (mAverageEUInput.length - 1); } @Override public long getAverageElectricOutput() { long rEU = 0; - for (int i = 0; i < mAverageEUOutput.length; ++i) - if (i != mAverageEUOutputIndex) - rEU += mAverageEUOutput[i]; + for (int i = 0; i < mAverageEUOutput.length; ++i) if (i != mAverageEUOutputIndex) rEU += mAverageEUOutput[i]; return rEU / (mAverageEUOutput.length - 1); } - @Override protected void updateOutputRedstoneSignal(byte aSide) { if (mMetaTileEntity.hasSidedRedstoneOutputBehavior()) { @@ -1598,7 +1901,6 @@ public class BaseMetaTileEntity extends CommonMetaTileEntity implements IGregTec return canAccessData() ? mMetaTileEntity.getComparatorValue(aSide) : 0; } - @Override public ItemStack decrStackSize(int aIndex, int aAmount) { if (canAccessData()) { @@ -1610,14 +1912,27 @@ public class BaseMetaTileEntity extends CommonMetaTileEntity implements IGregTec @Override public long injectEnergyUnits(byte aSide, long aVoltage, long aAmperage) { - if (!canAccessData() || !mMetaTileEntity.isElectric() || !inputEnergyFrom(aSide) || aAmperage <= 0 || aVoltage <= 0 || getStoredEU() >= getEUCapacity() || mMetaTileEntity.maxAmperesIn() <= mAcceptedAmperes) - return 0; + if (!canAccessData() + || !mMetaTileEntity.isElectric() + || !inputEnergyFrom(aSide) + || aAmperage <= 0 + || aVoltage <= 0 + || getStoredEU() >= getEUCapacity() + || mMetaTileEntity.maxAmperesIn() <= mAcceptedAmperes) return 0; if (aVoltage > getInputVoltage()) { - GT_Log.exp.println("Energy Explosion, injected " + aVoltage + "EU/t in a " + getInputVoltage() + "EU/t Machine!"); + GT_Log.exp.println( + "Energy Explosion, injected " + aVoltage + "EU/t in a " + getInputVoltage() + "EU/t Machine!"); doExplosion(aVoltage); return 0; } - if (increaseStoredEnergyUnits(aVoltage * (aAmperage = Math.min(aAmperage, Math.min(mMetaTileEntity.maxAmperesIn() - mAcceptedAmperes, 1 + ((getEUCapacity() - getStoredEU()) / aVoltage)))), true)) { + if (increaseStoredEnergyUnits( + aVoltage + * (aAmperage = Math.min( + aAmperage, + Math.min( + mMetaTileEntity.maxAmperesIn() - mAcceptedAmperes, + 1 + ((getEUCapacity() - getStoredEU()) / aVoltage)))), + true)) { mAverageEUInput[mAverageEUInputIndex] += aVoltage * aAmperage; mAcceptedAmperes += aAmperage; return aAmperage; @@ -1627,8 +1942,10 @@ public class BaseMetaTileEntity extends CommonMetaTileEntity implements IGregTec @Override public boolean drainEnergyUnits(byte aSide, long aVoltage, long aAmperage) { - if (!canAccessData() || !mMetaTileEntity.isElectric() || !outputsEnergyTo(aSide) || getStoredEU() - (aVoltage * aAmperage) < mMetaTileEntity.getMinimumStoredEU()) - return false; + if (!canAccessData() + || !mMetaTileEntity.isElectric() + || !outputsEnergyTo(aSide) + || getStoredEU() - (aVoltage * aAmperage) < mMetaTileEntity.getMinimumStoredEU()) return false; if (decreaseStoredEU(aVoltage * aAmperage, false)) { mAverageEUOutput[mAverageEUOutputIndex] += aVoltage * aAmperage; return true; @@ -1650,81 +1967,90 @@ public class BaseMetaTileEntity extends CommonMetaTileEntity implements IGregTec @Override public int fill(ForgeDirection aSide, FluidStack aFluid, boolean doFill) { - if (mTickTimer > 5 && canAccessData() && - (mRunningThroughTick || !mInputDisabled) && - ( - aSide == ForgeDirection.UNKNOWN || - ( - mMetaTileEntity.isLiquidInput((byte) aSide.ordinal()) && - getCoverBehaviorAtSideNew((byte) aSide.ordinal()).letsFluidIn((byte) aSide.ordinal(), getCoverIDAtSide((byte) aSide.ordinal()), getComplexCoverDataAtSide((byte) aSide.ordinal()), aFluid == null ? null : aFluid.getFluid(), this) - ) - ) - ) - return mMetaTileEntity.fill(aSide, aFluid, doFill); + if (mTickTimer > 5 + && canAccessData() + && (mRunningThroughTick || !mInputDisabled) + && (aSide == ForgeDirection.UNKNOWN + || (mMetaTileEntity.isLiquidInput((byte) aSide.ordinal()) + && getCoverBehaviorAtSideNew((byte) aSide.ordinal()) + .letsFluidIn( + (byte) aSide.ordinal(), + getCoverIDAtSide((byte) aSide.ordinal()), + getComplexCoverDataAtSide((byte) aSide.ordinal()), + aFluid == null ? null : aFluid.getFluid(), + this)))) return mMetaTileEntity.fill(aSide, aFluid, doFill); return 0; } @Override public FluidStack drain(ForgeDirection aSide, int maxDrain, boolean doDrain) { - if (mTickTimer > 5 && canAccessData() && - (mRunningThroughTick || !mOutputDisabled) && - ( - aSide == ForgeDirection.UNKNOWN || - ( - mMetaTileEntity.isLiquidOutput((byte) aSide.ordinal()) && - getCoverBehaviorAtSideNew((byte) aSide.ordinal()).letsFluidOut((byte) aSide.ordinal(), getCoverIDAtSide((byte) aSide.ordinal()), getComplexCoverDataAtSide((byte) aSide.ordinal()), mMetaTileEntity.getFluid() == null ? null : mMetaTileEntity.getFluid().getFluid(), this) - ) - ) - ) - return mMetaTileEntity.drain(aSide, maxDrain, doDrain); + if (mTickTimer > 5 + && canAccessData() + && (mRunningThroughTick || !mOutputDisabled) + && (aSide == ForgeDirection.UNKNOWN + || (mMetaTileEntity.isLiquidOutput((byte) aSide.ordinal()) + && getCoverBehaviorAtSideNew((byte) aSide.ordinal()) + .letsFluidOut( + (byte) aSide.ordinal(), + getCoverIDAtSide((byte) aSide.ordinal()), + getComplexCoverDataAtSide((byte) aSide.ordinal()), + mMetaTileEntity.getFluid() == null + ? null + : mMetaTileEntity + .getFluid() + .getFluid(), + this)))) return mMetaTileEntity.drain(aSide, maxDrain, doDrain); return null; } @Override public FluidStack drain(ForgeDirection aSide, FluidStack aFluid, boolean doDrain) { - if (mTickTimer > 5 && canAccessData() && - (mRunningThroughTick || !mOutputDisabled) && - ( - aSide == ForgeDirection.UNKNOWN || - ( - mMetaTileEntity.isLiquidOutput((byte) aSide.ordinal()) && - getCoverBehaviorAtSideNew((byte) aSide.ordinal()).letsFluidOut((byte) aSide.ordinal(), getCoverIDAtSide((byte) aSide.ordinal()), getComplexCoverDataAtSide((byte) aSide.ordinal()), aFluid == null ? null : aFluid.getFluid(), this) - ) - ) - ) - return mMetaTileEntity.drain(aSide, aFluid, doDrain); + if (mTickTimer > 5 + && canAccessData() + && (mRunningThroughTick || !mOutputDisabled) + && (aSide == ForgeDirection.UNKNOWN + || (mMetaTileEntity.isLiquidOutput((byte) aSide.ordinal()) + && getCoverBehaviorAtSideNew((byte) aSide.ordinal()) + .letsFluidOut( + (byte) aSide.ordinal(), + getCoverIDAtSide((byte) aSide.ordinal()), + getComplexCoverDataAtSide((byte) aSide.ordinal()), + aFluid == null ? null : aFluid.getFluid(), + this)))) return mMetaTileEntity.drain(aSide, aFluid, doDrain); return null; } @Override public boolean canFill(ForgeDirection aSide, Fluid aFluid) { - if (mTickTimer > 5 && canAccessData() && - (mRunningThroughTick || !mInputDisabled) && - ( - aSide == ForgeDirection.UNKNOWN || - ( - mMetaTileEntity.isLiquidInput((byte) aSide.ordinal()) && - getCoverBehaviorAtSideNew((byte) aSide.ordinal()).letsFluidIn((byte) aSide.ordinal(), getCoverIDAtSide((byte) aSide.ordinal()), getComplexCoverDataAtSide((byte) aSide.ordinal()), aFluid, this) - ) - ) - ) - return mMetaTileEntity.canFill(aSide, aFluid); + if (mTickTimer > 5 + && canAccessData() + && (mRunningThroughTick || !mInputDisabled) + && (aSide == ForgeDirection.UNKNOWN + || (mMetaTileEntity.isLiquidInput((byte) aSide.ordinal()) + && getCoverBehaviorAtSideNew((byte) aSide.ordinal()) + .letsFluidIn( + (byte) aSide.ordinal(), + getCoverIDAtSide((byte) aSide.ordinal()), + getComplexCoverDataAtSide((byte) aSide.ordinal()), + aFluid, + this)))) return mMetaTileEntity.canFill(aSide, aFluid); return false; } @Override public boolean canDrain(ForgeDirection aSide, Fluid aFluid) { - if (mTickTimer > 5 && canAccessData() && - (mRunningThroughTick || !mOutputDisabled) && - ( - aSide == ForgeDirection.UNKNOWN || - ( - mMetaTileEntity.isLiquidOutput((byte) aSide.ordinal()) && - getCoverBehaviorAtSideNew((byte) aSide.ordinal()).letsFluidOut((byte) aSide.ordinal(), getCoverIDAtSide((byte) aSide.ordinal()), getComplexCoverDataAtSide((byte) aSide.ordinal()), aFluid, this) - ) - ) - ) - return mMetaTileEntity.canDrain(aSide, aFluid); + if (mTickTimer > 5 + && canAccessData() + && (mRunningThroughTick || !mOutputDisabled) + && (aSide == ForgeDirection.UNKNOWN + || (mMetaTileEntity.isLiquidOutput((byte) aSide.ordinal()) + && getCoverBehaviorAtSideNew((byte) aSide.ordinal()) + .letsFluidOut( + (byte) aSide.ordinal(), + getCoverIDAtSide((byte) aSide.ordinal()), + getComplexCoverDataAtSide((byte) aSide.ordinal()), + aFluid, + this)))) return mMetaTileEntity.canDrain(aSide, aFluid); return false; } @@ -1732,17 +2058,25 @@ public class BaseMetaTileEntity extends CommonMetaTileEntity implements IGregTec public FluidTankInfo[] getTankInfo(ForgeDirection aSide) { final byte tSide = (byte) aSide.ordinal(); - if (canAccessData() && - ( - aSide == ForgeDirection.UNKNOWN || - ( - mMetaTileEntity.isLiquidInput(tSide) && getCoverBehaviorAtSideNew(tSide).letsFluidIn(tSide, getCoverIDAtSide(tSide), getComplexCoverDataAtSide(tSide), null, this)) || - (mMetaTileEntity.isLiquidOutput(tSide) && getCoverBehaviorAtSideNew(tSide).letsFluidOut(tSide, getCoverIDAtSide(tSide), getComplexCoverDataAtSide(tSide), null, this) - ) - ) - ) - return mMetaTileEntity.getTankInfo(aSide); - return new FluidTankInfo[]{}; + if (canAccessData() + && (aSide == ForgeDirection.UNKNOWN + || (mMetaTileEntity.isLiquidInput(tSide) + && getCoverBehaviorAtSideNew(tSide) + .letsFluidIn( + tSide, + getCoverIDAtSide(tSide), + getComplexCoverDataAtSide(tSide), + null, + this)) + || (mMetaTileEntity.isLiquidOutput(tSide) + && getCoverBehaviorAtSideNew(tSide) + .letsFluidOut( + tSide, + getCoverIDAtSide(tSide), + getComplexCoverDataAtSide(tSide), + null, + this)))) return mMetaTileEntity.getTankInfo(aSide); + return new FluidTankInfo[] {}; } public double getOutputEnergyUnitsPerTick() { @@ -1771,7 +2105,9 @@ public class BaseMetaTileEntity extends CommonMetaTileEntity implements IGregTec } public double getOfferedEnergy() { - return (canAccessData() && getStoredEU() - mMetaTileEntity.getMinimumStoredEU() >= oOutput) ? Math.max(0, oOutput) : 0; + return (canAccessData() && getStoredEU() - mMetaTileEntity.getMinimumStoredEU() >= oOutput) + ? Math.max(0, oOutput) + : 0; } public void drawEnergy(double amount) { @@ -1785,10 +2121,8 @@ public class BaseMetaTileEntity extends CommonMetaTileEntity implements IGregTec public int addEnergy(int aEnergy) { if (!canAccessData()) return 0; - if (aEnergy > 0) - increaseStoredEnergyUnits(aEnergy, true); - else - decreaseStoredEU(-aEnergy, true); + if (aEnergy > 0) increaseStoredEnergyUnits(aEnergy, true); + else decreaseStoredEU(-aEnergy, true); return (int) Math.min(Integer.MAX_VALUE, mMetaTileEntity.getEUVar()); } @@ -1852,7 +2186,9 @@ public class BaseMetaTileEntity extends CommonMetaTileEntity implements IGregTec return true; } aStack = GT_OreDictUnificator.get(aStack); - if (GT_Utility.areStacksEqual(tStack, aStack) && tStack.stackSize + aStack.stackSize <= Math.min(aStack.getMaxStackSize(), getInventoryStackLimit())) { + if (GT_Utility.areStacksEqual(tStack, aStack) + && tStack.stackSize + aStack.stackSize + <= Math.min(aStack.getMaxStackSize(), getInventoryStackLimit())) { tStack.stackSize += aStack.stackSize; markDirty(); return true; @@ -1894,7 +2230,7 @@ public class BaseMetaTileEntity extends CommonMetaTileEntity implements IGregTec public String[] getInfoData() { { if (canAccessData()) return getMetaTileEntity().getInfoData(); - return new String[]{}; + return new String[] {}; } } @@ -1904,7 +2240,14 @@ public class BaseMetaTileEntity extends CommonMetaTileEntity implements IGregTec } @Override - public void addCollisionBoxesToList(World aWorld, int aX, int aY, int aZ, AxisAlignedBB inputAABB, List<AxisAlignedBB> outputAABB, Entity collider) { + public void addCollisionBoxesToList( + World aWorld, + int aX, + int aY, + int aZ, + AxisAlignedBB inputAABB, + List<AxisAlignedBB> outputAABB, + Entity collider) { mMetaTileEntity.addCollisionBoxesToList(aWorld, aX, aY, aZ, inputAABB, outputAABB, collider); } @@ -1935,9 +2278,10 @@ public class BaseMetaTileEntity extends CommonMetaTileEntity implements IGregTec final int chemistryUpdateVersion = GT_Mod.calculateTotalGTVersion(509, 31); final int configCircuitAdditionVersion = GT_Mod.calculateTotalGTVersion(509, 40); // 4 is old GT_MetaTileEntity_BasicMachine.OTHER_SLOT_COUNT - if (nbtVersion < configCircuitAdditionVersion && getMetaTileEntity() instanceof GT_MetaTileEntity_BasicMachine && slotIndex >= 4) - slotIndex += 1; - if (mID >= 211 && mID <= 218) {//Assembler + if (nbtVersion < configCircuitAdditionVersion + && getMetaTileEntity() instanceof GT_MetaTileEntity_BasicMachine + && slotIndex >= 4) slotIndex += 1; + if (mID >= 211 && mID <= 218) { // Assembler if (nbtVersion < chemistryUpdateVersion) { oldInputSize = 2; oldOutputSize = 1; @@ -1947,8 +2291,7 @@ public class BaseMetaTileEntity extends CommonMetaTileEntity implements IGregTec newInputSize = 6; newOutputSize = 1; - - } else if (mID >= 421 && mID <= 428) {//Chemical Reactor + } else if (mID >= 421 && mID <= 428) { // Chemical Reactor if (nbtVersion < chemistryUpdateVersion) { oldInputSize = 2; oldOutputSize = 1; @@ -1958,7 +2301,7 @@ public class BaseMetaTileEntity extends CommonMetaTileEntity implements IGregTec newInputSize = 2; newOutputSize = 2; - } else if (mID >= 531 && mID <= 538) {//Distillery + } else if (mID >= 531 && mID <= 538) { // Distillery if (nbtVersion < chemistryUpdateVersion) { oldInputSize = 1; oldOutputSize = 0; @@ -1967,7 +2310,7 @@ public class BaseMetaTileEntity extends CommonMetaTileEntity implements IGregTec } newInputSize = 1; newOutputSize = 1; - } else if (mID >= 581 && mID <= 588) {//Mixer + } else if (mID >= 581 && mID <= 588) { // Mixer if (nbtVersion < chemistryUpdateVersion) { oldInputSize = 4; oldOutputSize = 1; @@ -1994,8 +2337,7 @@ public class BaseMetaTileEntity extends CommonMetaTileEntity implements IGregTec @Override @Optional.Method(modid = "appliedenergistics2") public IGridNode getGridNode(ForgeDirection forgeDirection) { - if (mFacing != forgeDirection.ordinal()) - return null; + if (mFacing != forgeDirection.ordinal()) return null; final AENetworkProxy gp = getProxy(); return gp != null ? gp.getNode() : null; } @@ -2008,8 +2350,7 @@ public class BaseMetaTileEntity extends CommonMetaTileEntity implements IGregTec @Override @Optional.Method(modid = "appliedenergistics2") - public void securityBreak() { - } + public void securityBreak() {} @Override @Optional.Method(modid = "appliedenergistics2") @@ -2033,38 +2374,33 @@ public class BaseMetaTileEntity extends CommonMetaTileEntity implements IGregTec @Override @Optional.Method(modid = "appliedenergistics2") public void gridChanged() { - if (mMetaTileEntity != null) - mMetaTileEntity.gridChanged(); + if (mMetaTileEntity != null) mMetaTileEntity.gridChanged(); } @TileEvent(TileEventType.WORLD_NBT_READ) @Optional.Method(modid = "appliedenergistics2") public void readFromNBT_AENetwork(final NBTTagCompound data) { final AENetworkProxy gp = getProxy(); - if (gp != null) - getProxy().readFromNBT(data); + if (gp != null) getProxy().readFromNBT(data); } @TileEvent(TileEventType.WORLD_NBT_WRITE) @Optional.Method(modid = "appliedenergistics2") public void writeToNBT_AENetwork(final NBTTagCompound data) { final AENetworkProxy gp = getProxy(); - if (gp != null) - gp.writeToNBT(data); + if (gp != null) gp.writeToNBT(data); } @Optional.Method(modid = "appliedenergistics2") void onChunkUnloadAE() { final AENetworkProxy gp = getProxy(); - if (gp != null) - gp.onChunkUnload(); + if (gp != null) gp.onChunkUnload(); } @Optional.Method(modid = "appliedenergistics2") void invalidateAE() { final AENetworkProxy gp = getProxy(); - if (gp != null) - gp.invalidate(); + if (gp != null) gp.invalidate(); } @Override @@ -2079,8 +2415,9 @@ public class BaseMetaTileEntity extends CommonMetaTileEntity implements IGregTec @Override public IAlignment getAlignment() { - return getMetaTileEntity() instanceof IAlignmentProvider ? ((IAlignmentProvider) getMetaTileEntity()).getAlignment() : - getMetaTileEntity() instanceof IAlignment ? (IAlignment) getMetaTileEntity() : null; + return getMetaTileEntity() instanceof IAlignmentProvider + ? ((IAlignmentProvider) getMetaTileEntity()).getAlignment() + : getMetaTileEntity() instanceof IAlignment ? (IAlignment) getMetaTileEntity() : null; } @Nullable diff --git a/src/main/java/gregtech/api/metatileentity/BaseTileEntity.java b/src/main/java/gregtech/api/metatileentity/BaseTileEntity.java index 8e6206f612..1f6fb0c68d 100644 --- a/src/main/java/gregtech/api/metatileentity/BaseTileEntity.java +++ b/src/main/java/gregtech/api/metatileentity/BaseTileEntity.java @@ -1,14 +1,22 @@ package gregtech.api.metatileentity; +import static gregtech.api.enums.GT_Values.ALL_VALID_SIDES; +import static gregtech.api.enums.GT_Values.COMPASS_DIRECTIONS; +import static gregtech.api.enums.GT_Values.GT; +import static gregtech.api.enums.GT_Values.NW; +import static gregtech.api.enums.GT_Values.SIDE_DOWN; +import static gregtech.api.enums.GT_Values.SIDE_UP; + import gregtech.api.interfaces.tileentity.IGTEnet; import gregtech.api.interfaces.tileentity.IGregTechTileEntity; import gregtech.api.interfaces.tileentity.IHasWorldObjectAndCoords; import gregtech.api.interfaces.tileentity.IIC2Enet; import gregtech.api.net.GT_Packet_Block_Event; -import gregtech.api.util.GT_LanguageManager; import gregtech.api.util.GT_Utility; import ic2.api.energy.event.EnergyTileLoadEvent; import ic2.api.energy.event.EnergyTileUnloadEvent; +import java.util.Arrays; +import java.util.concurrent.ThreadLocalRandom; import net.minecraft.block.Block; import net.minecraft.entity.Entity; import net.minecraft.entity.player.EntityPlayer; @@ -25,16 +33,6 @@ import net.minecraftforge.common.MinecraftForge; import net.minecraftforge.common.util.ForgeDirection; import net.minecraftforge.fluids.IFluidHandler; -import java.util.Arrays; -import java.util.concurrent.ThreadLocalRandom; - -import static gregtech.api.enums.GT_Values.ALL_VALID_SIDES; -import static gregtech.api.enums.GT_Values.COMPASS_DIRECTIONS; -import static gregtech.api.enums.GT_Values.GT; -import static gregtech.api.enums.GT_Values.NW; -import static gregtech.api.enums.GT_Values.SIDE_DOWN; -import static gregtech.api.enums.GT_Values.SIDE_UP; - /** * The Functions my old TileEntities and my BaseMetaTileEntities have in common. * <p/> @@ -63,17 +61,17 @@ public abstract class BaseTileEntity extends TileEntity implements IHasWorldObje private final ChunkCoordinates mReturnedCoordinates = new ChunkCoordinates(); public static byte getSideForPlayerPlacing(Entity aPlayer, byte aDefaultFacing, boolean[] aAllowedFacings) { - if(aPlayer != null) { + if (aPlayer != null) { if (aPlayer.rotationPitch >= 65 && aAllowedFacings[SIDE_UP]) return SIDE_UP; if (aPlayer.rotationPitch <= -65 && aAllowedFacings[SIDE_DOWN]) return SIDE_DOWN; - final byte rFacing = COMPASS_DIRECTIONS[MathHelper.floor_double(0.5D + 4.0F * aPlayer.rotationYaw / 360.0F) & 0x3]; + final byte rFacing = + COMPASS_DIRECTIONS[MathHelper.floor_double(0.5D + 4.0F * aPlayer.rotationYaw / 360.0F) & 0x3]; if (aAllowedFacings[rFacing]) return rFacing; } for (final byte tSide : ALL_VALID_SIDES) if (aAllowedFacings[tSide]) return tSide; return aDefaultFacing; } - private void clearNullMarkersFromTileEntityBuffer() { for (int i = 0; i < mBufferedTileEntities.length; i++) if (mBufferedTileEntities[i] == this) mBufferedTileEntities[i] = null; @@ -364,7 +362,9 @@ public abstract class BaseTileEntity extends TileEntity implements IHasWorldObje public Block getBlock(ChunkCoordinates aCoords) { if (worldObj == null) return Blocks.air; - if (ignoreUnloadedChunks && crossedChunkBorder(aCoords) && !worldObj.blockExists(aCoords.posX, aCoords.posY, aCoords.posZ)) return Blocks.air; + if (ignoreUnloadedChunks + && crossedChunkBorder(aCoords) + && !worldObj.blockExists(aCoords.posX, aCoords.posY, aCoords.posZ)) return Blocks.air; return worldObj.getBlock(aCoords.posX, aCoords.posY, aCoords.posZ); } @@ -426,7 +426,9 @@ public abstract class BaseTileEntity extends TileEntity implements IHasWorldObje mBufferedTileEntities[aSide] = null; return getTileEntityAtSide(aSide); } - if (mBufferedTileEntities[aSide].xCoord == tX && mBufferedTileEntities[aSide].yCoord == tY && mBufferedTileEntities[aSide].zCoord == tZ) { + if (mBufferedTileEntities[aSide].xCoord == tX + && mBufferedTileEntities[aSide].yCoord == tY + && mBufferedTileEntities[aSide].zCoord == tZ) { return mBufferedTileEntities[aSide]; } return null; @@ -482,8 +484,11 @@ public abstract class BaseTileEntity extends TileEntity implements IHasWorldObje worldObj.notifyBlockOfNeighborChange(x1, y1, z1, thisBlock); // 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 meet. + 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 + // meet. for (final ForgeDirection dir2 : ForgeDirection.VALID_DIRECTIONS) { final int x2 = x1 + dir2.offsetX, y2 = y1 + dir2.offsetY, z2 = z1 + dir2.offsetZ; @@ -497,7 +502,8 @@ public abstract class BaseTileEntity extends TileEntity implements IHasWorldObje @Override public final void sendBlockEvent(byte aID, byte aValue) { - NW.sendPacketToAllPlayersInRange(worldObj, new GT_Packet_Block_Event(xCoord, (short) yCoord, zCoord, aID, aValue), xCoord, zCoord); + NW.sendPacketToAllPlayersInRange( + worldObj, new GT_Packet_Block_Event(xCoord, (short) yCoord, zCoord, aID, aValue), xCoord, zCoord); } protected boolean crossedChunkBorder(int aX, int aZ) { @@ -520,14 +526,14 @@ public abstract class BaseTileEntity extends TileEntity implements IHasWorldObje public void markDirty() { // Avoid sending neighbor updates, just mark the chunk as dirty to make sure it gets saved final Chunk chunk = worldObj.getChunkFromBlockCoords(xCoord, zCoord); - if(chunk != null) { + if (chunk != null) { chunk.setChunkModified(); } } @Deprecated - public String trans(String aKey, String aEnglish){ - return GT_Utility.trans(aKey, aEnglish); + public String trans(String aKey, String aEnglish) { + return GT_Utility.trans(aKey, aEnglish); } /* @@ -537,8 +543,8 @@ public abstract class BaseTileEntity extends TileEntity implements IHasWorldObje protected boolean joinedIc2Enet = false; protected void createIc2Sink() { - if(ic2EnergySink == null && isServerSide() && shouldJoinIc2Enet()) { - ic2EnergySink = new TileIC2EnergySink((IGregTechTileEntity)this); + if (ic2EnergySink == null && isServerSide() && shouldJoinIc2Enet()) { + ic2EnergySink = new TileIC2EnergySink((IGregTechTileEntity) this); } } @@ -551,7 +557,7 @@ public abstract class BaseTileEntity extends TileEntity implements IHasWorldObje protected void joinEnet() { if (joinedIc2Enet || !shouldJoinIc2Enet()) return; - if(ic2EnergySink == null) createIc2Sink(); + if (ic2EnergySink == null) createIc2Sink(); if (ic2EnergySink != null) { MinecraftForge.EVENT_BUS.post(new EnergyTileLoadEvent(ic2EnergySink)); @@ -565,5 +571,4 @@ public abstract class BaseTileEntity extends TileEntity implements IHasWorldObje MinecraftForge.EVENT_BUS.post(new EnergyTileUnloadEvent(ic2EnergySink)); } } - } diff --git a/src/main/java/gregtech/api/metatileentity/CommonMetaTileEntity.java b/src/main/java/gregtech/api/metatileentity/CommonMetaTileEntity.java index 766110d227..7e35f2e2c1 100644 --- a/src/main/java/gregtech/api/metatileentity/CommonMetaTileEntity.java +++ b/src/main/java/gregtech/api/metatileentity/CommonMetaTileEntity.java @@ -1,5 +1,7 @@ package gregtech.api.metatileentity; +import static gregtech.GT_Mod.GT_FML_LOGGER; + import gregtech.GT_Mod; import gregtech.api.GregTech_API; import gregtech.api.interfaces.metatileentity.IMetaTileEntity; @@ -12,9 +14,6 @@ import net.minecraft.nbt.NBTTagCompound; import net.minecraft.nbt.NBTTagList; import net.minecraft.network.Packet; -import static gregtech.GT_Mod.GT_FML_LOGGER; -import static gregtech.api.enums.GT_Values.ALL_SIDES; - public abstract class CommonMetaTileEntity extends CoverableTileEntity implements IGregTechTileEntity { protected boolean mNeedsBlockUpdate = true, mNeedsUpdate = true, mSendClientData = false, mInventoryChanged = false; @@ -30,6 +29,7 @@ public abstract class CommonMetaTileEntity extends CoverableTileEntity implement } return false; } + protected void saveMetaTileNBT(NBTTagCompound aNBT) { try { if (hasValidMetaTileEntity()) { @@ -158,5 +158,4 @@ public abstract class CommonMetaTileEntity extends CoverableTileEntity implement final IMetaTileEntity meta = getMetaTileEntity(); return meta != null && meta.shouldJoinIc2Enet(); } - } diff --git a/src/main/java/gregtech/api/metatileentity/CoverableTileEntity.java b/src/main/java/gregtech/api/metatileentity/CoverableTileEntity.java index f7104c9b93..6c61ae8599 100644 --- a/src/main/java/gregtech/api/metatileentity/CoverableTileEntity.java +++ b/src/main/java/gregtech/api/metatileentity/CoverableTileEntity.java @@ -1,10 +1,16 @@ package gregtech.api.metatileentity; +import static gregtech.api.enums.GT_Values.ALL_VALID_SIDES; +import static gregtech.api.enums.GT_Values.E; +import static gregtech.api.enums.GT_Values.NW; +import static gregtech.api.util.GT_LanguageManager.FACES; +import static gregtech.api.util.GT_LanguageManager.getTranslation; + import gregtech.GT_Mod; import gregtech.api.GregTech_API; +import gregtech.api.enums.Textures; import gregtech.api.interfaces.ITexture; import gregtech.api.interfaces.tileentity.ICoverable; -import gregtech.api.enums.Textures; import gregtech.api.interfaces.tileentity.IGregtechWailaProvider; import gregtech.api.net.GT_Packet_RequestCoverData; import gregtech.api.net.GT_Packet_SendCoverData; @@ -14,6 +20,10 @@ import gregtech.api.util.GT_CoverBehaviorBase; import gregtech.api.util.ISerializableObject; import gregtech.common.GT_Client; import gregtech.common.covers.GT_Cover_Fluidfilter; +import java.util.Arrays; +import java.util.List; +import java.util.Objects; +import java.util.stream.IntStream; import mcp.mobius.waila.api.IWailaConfigHandler; import mcp.mobius.waila.api.IWailaDataAccessor; import net.minecraft.entity.item.EntityItem; @@ -25,27 +35,26 @@ import net.minecraft.world.World; import net.minecraftforge.common.util.ForgeDirection; import net.minecraftforge.fluids.FluidRegistry; -import java.util.Arrays; -import java.util.Objects; -import java.util.stream.IntStream; -import java.util.List; - -import static gregtech.api.enums.GT_Values.ALL_VALID_SIDES; -import static gregtech.api.enums.GT_Values.E; -import static gregtech.api.enums.GT_Values.NW; -import static gregtech.api.util.GT_LanguageManager.FACES; -import static gregtech.api.util.GT_LanguageManager.getTranslation; - 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); - protected final GT_CoverBehaviorBase<?>[] mCoverBehaviors = new GT_CoverBehaviorBase<?>[]{GregTech_API.sNoBehavior, GregTech_API.sNoBehavior, GregTech_API.sNoBehavior, GregTech_API.sNoBehavior, GregTech_API.sNoBehavior, GregTech_API.sNoBehavior}; - protected byte[] mSidedRedstone = new byte[]{15, 15, 15, 15, 15, 15}; + public static final String[] COVER_DATA_NBT_KEYS = Arrays.stream(ForgeDirection.VALID_DIRECTIONS) + .mapToInt(Enum::ordinal) + .mapToObj(i -> "mCoverData" + i) + .toArray(String[]::new); + protected final GT_CoverBehaviorBase<?>[] mCoverBehaviors = new GT_CoverBehaviorBase<?>[] { + GregTech_API.sNoBehavior, + GregTech_API.sNoBehavior, + GregTech_API.sNoBehavior, + GregTech_API.sNoBehavior, + GregTech_API.sNoBehavior, + GregTech_API.sNoBehavior + }; + protected byte[] mSidedRedstone = new byte[] {15, 15, 15, 15, 15, 15}; protected boolean mRedstone = false; protected byte mStrongRedstone = 0; - protected int[] mCoverSides = new int[]{0, 0, 0, 0, 0, 0}; + protected int[] mCoverSides = new int[] {0, 0, 0, 0, 0, 0}; protected ISerializableObject[] mCoverData = new ISerializableObject[6]; - protected final boolean[] mCoverNeedUpdate = new boolean[]{false, false, false, false, false, false}; + protected final boolean[] mCoverNeedUpdate = new boolean[] {false, false, false, false, false, false}; protected short mID = 0; public long mTickTimer = 0; @@ -60,18 +69,18 @@ public abstract class CoverableTileEntity extends BaseTileEntity implements ICov if (mStrongRedstone > 0) aNBT.setByte("mStrongRedstone", mStrongRedstone); if (hasCover) aNBT.setIntArray("mCoverSides", mCoverSides); - if(!isDrop) { + if (!isDrop) { aNBT.setByteArray("mRedstoneSided", mSidedRedstone); aNBT.setBoolean("mRedstone", mRedstone); } - } - protected void readCoverNBT(NBTTagCompound aNBT) { - mCoverSides = aNBT.hasKey("mCoverSides") ? aNBT.getIntArray("mCoverSides") : new int[]{0, 0, 0, 0, 0, 0}; + mCoverSides = aNBT.hasKey("mCoverSides") ? aNBT.getIntArray("mCoverSides") : new int[] {0, 0, 0, 0, 0, 0}; mRedstone = aNBT.getBoolean("mRedstone"); - mSidedRedstone = aNBT.hasKey("mRedstoneSided") ? aNBT.getByteArray("mRedstoneSided") : new byte[]{15, 15, 15, 15, 15, 15}; + mSidedRedstone = aNBT.hasKey("mRedstoneSided") + ? aNBT.getByteArray("mRedstoneSided") + : new byte[] {15, 15, 15, 15, 15, 15}; mStrongRedstone = aNBT.getByte("mStrongRedstone"); for (byte i = 0; i < 6; i++) mCoverBehaviors[i] = GregTech_API.getCoverBehaviorNew(mCoverSides[i]); @@ -81,10 +90,11 @@ public abstract class CoverableTileEntity extends BaseTileEntity implements ICov if (aNBT.hasKey("mCoverData", 11) && aNBT.getIntArray("mCoverData").length == 6) { final int[] tOldData = aNBT.getIntArray("mCoverData"); for (int i = 0; i < tOldData.length; i++) { - if(mCoverBehaviors[i] instanceof GT_Cover_Fluidfilter) { + if (mCoverBehaviors[i] instanceof GT_Cover_Fluidfilter) { final String filterKey = String.format("fluidFilter%d", i); if (aNBT.hasKey(filterKey)) { - mCoverData[i] = mCoverBehaviors[i].createDataObject((tOldData[i] & 7) | (FluidRegistry.getFluidID(aNBT.getString(filterKey)) << 3)); + mCoverData[i] = mCoverBehaviors[i].createDataObject( + (tOldData[i] & 7) | (FluidRegistry.getFluidID(aNBT.getString(filterKey)) << 3)); } } else if (mCoverBehaviors[i] != null && mCoverBehaviors[i] != GregTech_API.sNoBehavior) { mCoverData[i] = mCoverBehaviors[i].createDataObject(tOldData[i]); @@ -92,18 +102,17 @@ public abstract class CoverableTileEntity extends BaseTileEntity implements ICov } } else { // no old data - for (byte i = 0; i<6; i++) { + for (byte i = 0; i < 6; i++) { if (mCoverBehaviors[i] == null) continue; if (aNBT.hasKey(COVER_DATA_NBT_KEYS[i])) mCoverData[i] = mCoverBehaviors[i].createDataObject(aNBT.getTag(COVER_DATA_NBT_KEYS[i])); - else - mCoverData[i] = mCoverBehaviors[i].createDataObject(); + else mCoverData[i] = mCoverBehaviors[i].createDataObject(); if (mCoverBehaviors[i].isDataNeededOnClient(i, mCoverSides[i], mCoverData[i], this)) issueCoverUpdate(i); } } - } + public abstract boolean isStillValid(); protected boolean doCoverThings() { @@ -112,8 +121,12 @@ public abstract class CoverableTileEntity extends BaseTileEntity implements ICov final GT_CoverBehaviorBase<?> tCover = getCoverBehaviorAtSideNew(i); final int tCoverTickRate = tCover.getTickRate(i, getCoverIDAtSide(i), mCoverData[i], this); if (tCoverTickRate > 0 && mTickTimer % tCoverTickRate == 0) { - final byte tRedstone = tCover.isRedstoneSensitive(i, getCoverIDAtSide(i), mCoverData[i], this, mTickTimer) ? getInputRedstoneSignal(i) : 0; - mCoverData[i] = tCover.doCoverThings(i, tRedstone, getCoverIDAtSide(i), mCoverData[i], this, mTickTimer); + final byte tRedstone = + tCover.isRedstoneSensitive(i, getCoverIDAtSide(i), mCoverData[i], this, mTickTimer) + ? getInputRedstoneSignal(i) + : 0; + mCoverData[i] = + tCover.doCoverThings(i, tRedstone, getCoverIDAtSide(i), mCoverData[i], this, mTickTimer); if (!isStillValid()) return false; } } @@ -126,43 +139,50 @@ public abstract class CoverableTileEntity extends BaseTileEntity implements ICov protected void checkDropCover() { for (byte i : ALL_VALID_SIDES) if (getCoverIDAtSide(i) != 0) - if (!allowCoverOnSide(i, new GT_ItemStack(getCoverIDAtSide(i)))) - dropCover(i, i, true); + if (!allowCoverOnSide(i, new GT_ItemStack(getCoverIDAtSide(i)))) dropCover(i, i, true); } protected void updateCoverBehavior() { - for (byte i : ALL_VALID_SIDES) - mCoverBehaviors[i] = GregTech_API.getCoverBehaviorNew(mCoverSides[i]); + for (byte i : ALL_VALID_SIDES) mCoverBehaviors[i] = GregTech_API.getCoverBehaviorNew(mCoverSides[i]); } @Override public void issueCoverUpdate(byte aSide) { - // If we've got a null worldObj we're getting called as a part of readingNBT from a non tickable MultiTileEntity on chunk load before the world is set + // If we've got a null worldObj we're getting called as a part of readingNBT from a non tickable MultiTileEntity + // on chunk load before the world is set // so we'll want to send a cover update. - if (worldObj == null || (isServerSide() && getCoverBehaviorAtSideNew(aSide).isDataNeededOnClient(aSide, getCoverIDAtSide(aSide), getComplexCoverDataAtSide(aSide), this))) + if (worldObj == null + || (isServerSide() + && getCoverBehaviorAtSideNew(aSide) + .isDataNeededOnClient( + aSide, getCoverIDAtSide(aSide), getComplexCoverDataAtSide(aSide), this))) mCoverNeedUpdate[aSide] = true; } - public final ITexture getCoverTexture(byte aSide) { - if (getCoverIDAtSide(aSide) == 0) return null; - if (GT_Mod.instance.isClientSide() && (GT_Client.hideValue & 0x1) != 0) { - return Textures.BlockIcons.HIDDEN_TEXTURE[0]; // See through - } - final ITexture coverTexture = getCoverBehaviorAtSideNew(aSide).getSpecialCoverTexture(aSide, getCoverIDAtSide(aSide), getComplexCoverDataAtSide(aSide), this); - return coverTexture != null ? coverTexture : GregTech_API.sCovers.get(new GT_ItemStack(getCoverIDAtSide(aSide))); + public final ITexture getCoverTexture(byte aSide) { + if (getCoverIDAtSide(aSide) == 0) return null; + if (GT_Mod.instance.isClientSide() && (GT_Client.hideValue & 0x1) != 0) { + return Textures.BlockIcons.HIDDEN_TEXTURE[0]; // See through + } + final ITexture coverTexture = getCoverBehaviorAtSideNew(aSide) + .getSpecialCoverTexture(aSide, getCoverIDAtSide(aSide), getComplexCoverDataAtSide(aSide), this); + return coverTexture != null + ? coverTexture + : GregTech_API.sCovers.get(new GT_ItemStack(getCoverIDAtSide(aSide))); } protected void requestCoverDataIfNeeded() { - if(worldObj == null || !worldObj.isRemote) return; + if (worldObj == null || !worldObj.isRemote) return; for (byte i : ALL_VALID_SIDES) { - if (getCoverBehaviorAtSideNew(i).isDataNeededOnClient(i, getCoverIDAtSide(i), getComplexCoverDataAtSide(i), this)) + if (getCoverBehaviorAtSideNew(i) + .isDataNeededOnClient(i, getCoverIDAtSide(i), getComplexCoverDataAtSide(i), this)) NW.sendToServer(new GT_Packet_RequestCoverData(i, getCoverIDAtSide(i), this)); } } @Override public void setCoverIdAndDataAtSide(byte aSide, int aId, ISerializableObject aData) { - if(setCoverIDAtSideNoUpdate(aSide, aId)) { + if (setCoverIDAtSideNoUpdate(aSide, aId)) { setCoverDataAtSide(aSide, aData); issueCoverUpdate(aSide); issueBlockUpdate(); @@ -199,11 +219,12 @@ public abstract class CoverableTileEntity extends BaseTileEntity implements ICov @Override public void setCoverDataAtSide(byte aSide, ISerializableObject aData) { - if (aSide >= 0 && aSide < 6 && getCoverBehaviorAtSideNew(aSide) != null && getCoverBehaviorAtSideNew(aSide).cast(aData) != null) - mCoverData[aSide] = aData; + if (aSide >= 0 + && aSide < 6 + && getCoverBehaviorAtSideNew(aSide) != null + && getCoverBehaviorAtSideNew(aSide).cast(aData) != null) mCoverData[aSide] = aData; } - @Override @Deprecated public GT_CoverBehavior getCoverBehaviorAtSide(byte aSide) { @@ -225,7 +246,8 @@ public abstract class CoverableTileEntity extends BaseTileEntity implements ICov @Override public ItemStack getCoverItemAtSide(byte aSide) { - return getCoverBehaviorAtSideNew(aSide).getDisplayStack(getCoverIDAtSide(aSide), getComplexCoverDataAtSide(aSide)); + return getCoverBehaviorAtSideNew(aSide) + .getDisplayStack(getCoverIDAtSide(aSide), getComplexCoverDataAtSide(aSide)); } @Override @@ -248,25 +270,32 @@ public abstract class CoverableTileEntity extends BaseTileEntity implements ICov @Override public ISerializableObject getComplexCoverDataAtSide(byte aSide) { - if (aSide >= 0 && aSide < 6 && getCoverBehaviorAtSideNew(aSide) != null) - return mCoverData[aSide]; + if (aSide >= 0 && aSide < 6 && getCoverBehaviorAtSideNew(aSide) != null) return mCoverData[aSide]; return GregTech_API.sNoBehavior.createDataObject(); } @Override public GT_CoverBehaviorBase<?> getCoverBehaviorAtSideNew(byte aSide) { - if (aSide >= 0 && aSide < 6) - return mCoverBehaviors[aSide]; + if (aSide >= 0 && aSide < 6) return mCoverBehaviors[aSide]; return GregTech_API.sNoBehavior; } @Override public boolean dropCover(byte aSide, byte aDroppedSide, boolean aForced) { - if (getCoverBehaviorAtSideNew(aSide).onCoverRemoval(aSide, getCoverIDAtSide(aSide), mCoverData[aSide], this, aForced) || aForced) { - final ItemStack tStack = getCoverBehaviorAtSideNew(aSide).getDrop(aSide, getCoverIDAtSide(aSide), getComplexCoverDataAtSide(aSide), this); + if (getCoverBehaviorAtSideNew(aSide) + .onCoverRemoval(aSide, getCoverIDAtSide(aSide), mCoverData[aSide], this, aForced) + || aForced) { + final ItemStack tStack = getCoverBehaviorAtSideNew(aSide) + .getDrop(aSide, getCoverIDAtSide(aSide), getComplexCoverDataAtSide(aSide), this); if (tStack != null) { - getCoverBehaviorAtSideNew(aSide).onDropped(aSide, getCoverIDAtSide(aSide), getComplexCoverDataAtSide(aSide), this); - final EntityItem tEntity = new EntityItem(worldObj, getOffsetX(aDroppedSide, 1) + 0.5, getOffsetY(aDroppedSide, 1) + 0.5, getOffsetZ(aDroppedSide, 1) + 0.5, tStack); + getCoverBehaviorAtSideNew(aSide) + .onDropped(aSide, getCoverIDAtSide(aSide), getComplexCoverDataAtSide(aSide), this); + final EntityItem tEntity = new EntityItem( + worldObj, + getOffsetX(aDroppedSide, 1) + 0.5, + getOffsetY(aDroppedSide, 1) + 0.5, + getOffsetZ(aDroppedSide, 1) + 0.5, + tStack); tEntity.motionX = 0; tEntity.motionY = 0; tEntity.motionZ = 0; @@ -295,10 +324,10 @@ public abstract class CoverableTileEntity extends BaseTileEntity implements ICov setOutputRedstoneSignal(aSide, aStrength); } - @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); } @@ -314,12 +343,17 @@ 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 public byte getStrongOutputRedstoneSignal(byte aSide) { - return aSide >= 0 && aSide < 6 && (mStrongRedstone & (1 << aSide)) != 0 ? (byte) (mSidedRedstone[aSide] & 15) : 0; + return aSide >= 0 && aSide < 6 && (mStrongRedstone & (1 << aSide)) != 0 + ? (byte) (mSidedRedstone[aSide] & 15) + : 0; } @Override @@ -329,17 +363,30 @@ public abstract class CoverableTileEntity extends BaseTileEntity implements ICov @Override public byte getInternalInputRedstoneSignal(byte aSide) { - return (byte) (getCoverBehaviorAtSideNew(aSide).getRedstoneInput(aSide, getInputRedstoneSignal(aSide), getCoverIDAtSide(aSide), getComplexCoverDataAtSide(aSide), this) & 15); + return (byte) (getCoverBehaviorAtSideNew(aSide) + .getRedstoneInput( + aSide, + getInputRedstoneSignal(aSide), + getCoverIDAtSide(aSide), + getComplexCoverDataAtSide(aSide), + this) + & 15); } @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) { @@ -348,13 +395,13 @@ public abstract class CoverableTileEntity extends BaseTileEntity implements ICov @Override public void receiveCoverData(byte aCoverSide, int aCoverID, int aCoverData) { - if ((aCoverSide >= 0 && aCoverSide < 6)) - setCoverIDAtSideNoUpdate(aCoverSide, aCoverID); + if ((aCoverSide >= 0 && aCoverSide < 6)) setCoverIDAtSideNoUpdate(aCoverSide, aCoverID); setCoverDataAtSide(aCoverSide, aCoverData); } @Override - public void receiveCoverData(byte aCoverSide, int aCoverID, ISerializableObject aCoverData, EntityPlayerMP aPlayer) { + public void receiveCoverData( + byte aCoverSide, int aCoverID, ISerializableObject aCoverData, EntityPlayerMP aPlayer) { if ((aCoverSide >= 0 && aCoverSide < 6)) { setCoverIDAtSideNoUpdate(aCoverSide, aCoverID); setCoverDataAtSide(aCoverSide, aCoverData); @@ -365,24 +412,25 @@ public abstract class CoverableTileEntity extends BaseTileEntity implements ICov } protected void sendCoverDataIfNeeded() { - if(worldObj == null || worldObj.isRemote) return; + if (worldObj == null || worldObj.isRemote) return; final int mCoverNeedUpdateLength = mCoverNeedUpdate.length; for (byte i = 0; i < mCoverNeedUpdateLength; i++) { if (mCoverNeedUpdate[i]) { NW.sendPacketToAllPlayersInRange( worldObj, new GT_Packet_SendCoverData(i, getCoverIDAtSide(i), getComplexCoverDataAtSide(i), this), - xCoord, zCoord - ); + xCoord, + zCoord); mCoverNeedUpdate[i] = false; } } } @Override - public void getWailaBody(ItemStack itemStack, List<String> currenttip, IWailaDataAccessor accessor, IWailaConfigHandler config) { + public void getWailaBody( + ItemStack itemStack, List<String> currenttip, IWailaDataAccessor accessor, IWailaConfigHandler config) { final NBTTagCompound tag = accessor.getNBTData(); - final byte side = (byte)accessor.getSide().ordinal(); + final byte side = (byte) accessor.getSide().ordinal(); final int[] coverSides = tag.getIntArray("mCoverSides"); // Not all data is available on the client, so get it from the NBT packet @@ -391,7 +439,8 @@ public abstract class CoverableTileEntity extends BaseTileEntity implements ICov final GT_CoverBehaviorBase<?> behavior = GregTech_API.getCoverBehaviorNew(coverId); if (behavior != null && behavior != GregTech_API.sNoBehavior) { if (tag.hasKey(CoverableTileEntity.COVER_DATA_NBT_KEYS[side])) { - final ISerializableObject dataObject = behavior.createDataObject(tag.getTag(CoverableTileEntity.COVER_DATA_NBT_KEYS[side])); + final ISerializableObject dataObject = + behavior.createDataObject(tag.getTag(CoverableTileEntity.COVER_DATA_NBT_KEYS[side])); final ItemStack coverStack = behavior.getDisplayStack(coverId, dataObject); if (coverStack != null) currenttip.add(String.format("Cover: %s", coverStack.getDisplayName())); final String behaviorDesc = behavior.getDescription(side, coverId, dataObject, null); @@ -405,11 +454,13 @@ public abstract class CoverableTileEntity extends BaseTileEntity implements ICov } @Override - public void getWailaNBTData(EntityPlayerMP player, TileEntity tile, NBTTagCompound tag, World world, int x, int y, int z) { + public void getWailaNBTData( + EntityPlayerMP player, TileEntity tile, NBTTagCompound tag, World world, int x, int y, int z) { // No super implementation // super.getWailaNBTData(player, tile, tag, world, x, y, z); - // While we have some cover data on the client (enough to render it); we don't have all the information we want, such as + // While we have some cover data on the client (enough to render it); we don't have all the information we want, + // such as // details on the fluid filter, so send it all here. writeCoverNBT(tag, false); } @@ -420,7 +471,7 @@ public abstract class CoverableTileEntity extends BaseTileEntity implements ICov * @param aList - List to add the information to */ public static void addInstalledCoversInformation(NBTTagCompound aNBT, List<String> aList) { - if (aNBT.hasKey("mCoverSides")){ + if (aNBT.hasKey("mCoverSides")) { final int[] mCoverSides = aNBT.getIntArray("mCoverSides"); if (mCoverSides != null && mCoverSides.length == 6) { for (byte tSide : ALL_VALID_SIDES) { @@ -429,10 +480,12 @@ 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(String.format("Cover on %s side: %s", getTranslation(FACES[tSide]), coverStack.getDisplayName())); + aList.add(String.format( + "Cover on %s side: %s", getTranslation(FACES[tSide]), coverStack.getDisplayName())); } } } diff --git a/src/main/java/gregtech/api/metatileentity/MetaPipeEntity.java b/src/main/java/gregtech/api/metatileentity/MetaPipeEntity.java index 9d07b1f9ba..96cca4ba1d 100644 --- a/src/main/java/gregtech/api/metatileentity/MetaPipeEntity.java +++ b/src/main/java/gregtech/api/metatileentity/MetaPipeEntity.java @@ -1,5 +1,8 @@ package gregtech.api.metatileentity; +import static gregtech.api.enums.GT_Values.GT; +import static gregtech.api.enums.GT_Values.V; + import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; import gnu.trove.list.TIntList; @@ -13,6 +16,10 @@ import gregtech.api.interfaces.tileentity.IGregTechTileEntity; import gregtech.api.objects.GT_ItemStack; import gregtech.api.util.*; import gregtech.common.GT_Client; +import java.io.File; +import java.util.ArrayList; +import java.util.List; +import java.util.Locale; import net.minecraft.block.Block; import net.minecraft.client.renderer.RenderBlocks; import net.minecraft.client.renderer.texture.IIconRegister; @@ -32,14 +39,6 @@ import net.minecraftforge.fluids.Fluid; import net.minecraftforge.fluids.FluidStack; import net.minecraftforge.fluids.FluidTankInfo; -import java.io.File; -import java.util.ArrayList; -import java.util.List; -import java.util.Locale; - -import static gregtech.api.enums.GT_Values.GT; -import static gregtech.api.enums.GT_Values.V; - /** * NEVER INCLUDE THIS FILE IN YOUR MOD!!! * <p/> @@ -59,11 +58,13 @@ public abstract class MetaPipeEntity implements IMetaTileEntity, IConnectable { * This variable tells, which directions the Block is connected to. It is a Bitmask. */ public byte mConnections = 0; + protected boolean mCheckConnections = false; /** * Only assigned for the MetaTileEntity in the List! Also only used to get the localized Name for the ItemStack and for getInvName. */ public String mName; + public boolean doTickProfilingInThisTick = true; /** * accessibility to this Field is no longer given, see below @@ -83,7 +84,7 @@ public abstract class MetaPipeEntity implements IMetaTileEntity, IConnectable { * } */ public MetaPipeEntity(int aID, String aBasicName, String aRegionalName, int aInvSlotCount) { - this(aID, aBasicName, aRegionalName, aInvSlotCount, true); + this(aID, aBasicName, aRegionalName, aInvSlotCount, true); } public MetaPipeEntity(int aID, String aBasicName, String aRegionalName, int aInvSlotCount, boolean aAddInfo) { @@ -101,13 +102,13 @@ public abstract class MetaPipeEntity implements IMetaTileEntity, IConnectable { mInventory = new ItemStack[aInvSlotCount]; if (aAddInfo && GT.isClientSide()) { - addInfo(aID); + addInfo(aID); } } protected final void addInfo(int aID) { - if(!GT.isClientSide()) return; - + if (!GT.isClientSide()) return; + ItemStack tStack = new ItemStack(GregTech_API.sBlockMachines, 1, aID); tStack.getItem().addInformation(tStack, null, new ArrayList<String>(), true); } @@ -153,7 +154,10 @@ public abstract class MetaPipeEntity implements IMetaTileEntity, IConnectable { @Override public ItemStack getStackForm(long aAmount) { - return new ItemStack(GregTech_API.sBlockMachines, (int) aAmount, getBaseMetaTileEntity().getMetaTileID()); + return new ItemStack( + GregTech_API.sBlockMachines, + (int) aAmount, + getBaseMetaTileEntity().getMetaTileID()); } public boolean isCoverOnSide(BaseMetaPipeEntity aPipe, EntityLivingBase aEntity) { @@ -183,32 +187,44 @@ public abstract class MetaPipeEntity implements IMetaTileEntity, IConnectable { if (aSide < 6 && mBaseMetaTileEntity.getCoverIDAtSide(aSide) > 0) { tCovered = true; } - if(isConnectedAtSide(aSide)){ - tCovered = true; + if (isConnectedAtSide(aSide)) { + tCovered = true; } - //GT_FML_LOGGER.info("Cover: "+mBaseMetaTileEntity.getCoverIDAtSide(aSide)); - //toDo: filter cover ids that actually protect against temperature (rubber/plastic maybe?, more like asbestos) + // GT_FML_LOGGER.info("Cover: "+mBaseMetaTileEntity.getCoverIDAtSide(aSide)); + // toDo: filter cover ids that actually protect against temperature (rubber/plastic maybe?, more like asbestos) return tCovered; } @Override - public void onServerStart() {/*Do nothing*/} + public void onServerStart() { + /*Do nothing*/ + } @Override - public void onWorldSave(File aSaveDirectory) {/*Do nothing*/} + public void onWorldSave(File aSaveDirectory) { + /*Do nothing*/ + } @Override - public void onWorldLoad(File aSaveDirectory) {/*Do nothing*/} + public void onWorldLoad(File aSaveDirectory) { + /*Do nothing*/ + } @Override - public void onConfigLoad(GT_Config aConfig) {/*Do nothing*/} + public void onConfigLoad(GT_Config aConfig) { + /*Do nothing*/ + } @Override - public void setItemNBT(NBTTagCompound aNBT) {/*Do nothing*/} + public void setItemNBT(NBTTagCompound aNBT) { + /*Do nothing*/ + } @Override @SideOnly(Side.CLIENT) - public void registerIcons(IIconRegister aBlockIconRegister) {/*Do nothing*/} + public void registerIcons(IIconRegister aBlockIconRegister) { + /*Do nothing*/ + } @Override public boolean allowCoverOnSide(byte aSide, GT_ItemStack aCoverID) { @@ -216,31 +232,42 @@ public abstract class MetaPipeEntity implements IMetaTileEntity, IConnectable { } @Override - public void onScrewdriverRightClick(byte aSide, EntityPlayer aPlayer, float aX, float aY, float aZ) {/*Do nothing*/} + public void onScrewdriverRightClick(byte aSide, EntityPlayer aPlayer, float aX, float aY, float aZ) { + /*Do nothing*/ + } @Override - public boolean onWrenchRightClick(byte aSide, byte aWrenchingSide, EntityPlayer aPlayer, float aX, float aY, float aZ) { + public boolean onWrenchRightClick( + byte aSide, byte aWrenchingSide, EntityPlayer aPlayer, float aX, float aY, float aZ) { return false; } @Override - public boolean onWireCutterRightClick(byte aSide, byte aWrenchingSide, EntityPlayer aPlayer, float aX, float aY, float aZ) { + public boolean onWireCutterRightClick( + byte aSide, byte aWrenchingSide, EntityPlayer aPlayer, float aX, float aY, float aZ) { return false; } @Override - public boolean onSolderingToolRightClick(byte aSide, byte aWrenchingSide, EntityPlayer aPlayer, float aX, float aY, float aZ) { + public boolean onSolderingToolRightClick( + byte aSide, byte aWrenchingSide, EntityPlayer aPlayer, float aX, float aY, float aZ) { return false; } @Override - public void onExplosion() {/*Do nothing*/} + public void onExplosion() { + /*Do nothing*/ + } @Override - public void onFirstTick(IGregTechTileEntity aBaseMetaTileEntity) {/*Do nothing*/} + public void onFirstTick(IGregTechTileEntity aBaseMetaTileEntity) { + /*Do nothing*/ + } @Override - public void onPreTick(IGregTechTileEntity aBaseMetaTileEntity, long aTick) {/*Do nothing*/} + public void onPreTick(IGregTechTileEntity aBaseMetaTileEntity, long aTick) { + /*Do nothing*/ + } @Override public void onPostTick(IGregTechTileEntity aBaseMetaTileEntity, long aTick) { @@ -254,38 +281,53 @@ public abstract class MetaPipeEntity implements IMetaTileEntity, IConnectable { } @Override - public void inValidate() {/*Do nothing*/} + public void inValidate() { + /*Do nothing*/ + } @Override - public void onRemoval() {/*Do nothing*/} + public void onRemoval() { + /*Do nothing*/ + } @Override - public void initDefaultModes(NBTTagCompound aNBT) {/*Do nothing*/} + public void initDefaultModes(NBTTagCompound aNBT) { + /*Do nothing*/ + } /** * When a GUI is opened */ - public void onOpenGUI() {/*Do nothing*/} + public void onOpenGUI() { + /*Do nothing*/ + } /** * When a GUI is closed */ - public void onCloseGUI() {/*Do nothing*/} + public void onCloseGUI() { + /*Do nothing*/ + } /** * a Player rightclicks the Machine * Sneaky rightclicks are not getting passed to this! */ @Override - public boolean onRightclick(IGregTechTileEntity aBaseMetaTileEntity, EntityPlayer aPlayer, byte aSide, float aX, float aY, float aZ) { + public boolean onRightclick( + IGregTechTileEntity aBaseMetaTileEntity, EntityPlayer aPlayer, byte aSide, float aX, float aY, float aZ) { return false; } @Override - public void onLeftclick(IGregTechTileEntity aBaseMetaTileEntity, EntityPlayer aPlayer) {/*Do nothing*/} + public void onLeftclick(IGregTechTileEntity aBaseMetaTileEntity, EntityPlayer aPlayer) { + /*Do nothing*/ + } @Override - public void onValueUpdate(byte aValue) {/*Do nothing*/} + public void onValueUpdate(byte aValue) { + /*Do nothing*/ + } @Override public byte getUpdateData() { @@ -293,13 +335,19 @@ public abstract class MetaPipeEntity implements IMetaTileEntity, IConnectable { } @Override - public void doSound(byte aIndex, double aX, double aY, double aZ) {/*Do nothing*/} + public void doSound(byte aIndex, double aX, double aY, double aZ) { + /*Do nothing*/ + } @Override - public void startSoundLoop(byte aIndex, double aX, double aY, double aZ) {/*Do nothing*/} + public void startSoundLoop(byte aIndex, double aX, double aY, double aZ) { + /*Do nothing*/ + } @Override - public void stopSoundLoop(byte aValue, double aX, double aY, double aZ) {/*Do nothing*/} + public void stopSoundLoop(byte aValue, double aX, double aY, double aZ) { + /*Do nothing*/ + } @Override public final void sendSound(byte aIndex) { @@ -340,7 +388,8 @@ public abstract class MetaPipeEntity implements IMetaTileEntity, IConnectable { } @Override - public ArrayList<String> getSpecialDebugInfo(IGregTechTileEntity aBaseMetaTileEntity, EntityPlayer aPlayer, int aLogLevel, ArrayList<String> aList) { + public ArrayList<String> getSpecialDebugInfo( + IGregTechTileEntity aBaseMetaTileEntity, EntityPlayer aPlayer, int aLogLevel, ArrayList<String> aList) { return aList; } @@ -415,10 +464,14 @@ public abstract class MetaPipeEntity implements IMetaTileEntity, IConnectable { } @Override - public void onMachineBlockUpdate() {/*Do nothing*/} + public void onMachineBlockUpdate() { + /*Do nothing*/ + } @Override - public void receiveClientEvent(byte aEventID, byte aValue) {/*Do nothing*/} + public void receiveClientEvent(byte aEventID, byte aValue) { + /*Do nothing*/ + } @Override public boolean isSimpleMachine() { @@ -452,7 +505,7 @@ public abstract class MetaPipeEntity implements IMetaTileEntity, IConnectable { @Override public String[] getInfoData() { - return new String[]{}; + return new String[] {}; } public boolean isDigitalChest() { @@ -463,7 +516,9 @@ public abstract class MetaPipeEntity implements IMetaTileEntity, IConnectable { return null; } - public void setItemCount(int aCount) {/*Do nothing*/} + public void setItemCount(int aCount) { + /*Do nothing*/ + } public int getMaxItemCount() { return 0; @@ -522,21 +577,59 @@ public abstract class MetaPipeEntity implements IMetaTileEntity, IConnectable { public int[] getAccessibleSlotsFromSide(int aSide) { TIntList tList = new TIntArrayList(); IGregTechTileEntity tTileEntity = getBaseMetaTileEntity(); - boolean tSkip = tTileEntity.getCoverBehaviorAtSideNew((byte) aSide).letsItemsIn((byte) aSide, tTileEntity.getCoverIDAtSide((byte) aSide), tTileEntity.getComplexCoverDataAtSide((byte) aSide), -2, tTileEntity) || tTileEntity.getCoverBehaviorAtSideNew((byte) aSide).letsItemsOut((byte) aSide, tTileEntity.getCoverIDAtSide((byte) aSide), tTileEntity.getComplexCoverDataAtSide((byte) aSide), -2, tTileEntity); + boolean tSkip = tTileEntity + .getCoverBehaviorAtSideNew((byte) aSide) + .letsItemsIn( + (byte) aSide, + tTileEntity.getCoverIDAtSide((byte) aSide), + tTileEntity.getComplexCoverDataAtSide((byte) aSide), + -2, + tTileEntity) + || tTileEntity + .getCoverBehaviorAtSideNew((byte) aSide) + .letsItemsOut( + (byte) aSide, + tTileEntity.getCoverIDAtSide((byte) aSide), + tTileEntity.getComplexCoverDataAtSide((byte) aSide), + -2, + tTileEntity); for (int i = 0; i < getSizeInventory(); i++) - if (isValidSlot(i) && (tSkip || tTileEntity.getCoverBehaviorAtSideNew((byte) aSide).letsItemsOut((byte) aSide, tTileEntity.getCoverIDAtSide((byte) aSide), tTileEntity.getComplexCoverDataAtSide((byte) aSide), i, tTileEntity) || tTileEntity.getCoverBehaviorAtSideNew((byte) aSide).letsItemsIn((byte) aSide, tTileEntity.getCoverIDAtSide((byte) aSide), tTileEntity.getComplexCoverDataAtSide((byte) aSide), i, tTileEntity))) - tList.add(i); + if (isValidSlot(i) + && (tSkip + || tTileEntity + .getCoverBehaviorAtSideNew((byte) aSide) + .letsItemsOut( + (byte) aSide, + tTileEntity.getCoverIDAtSide((byte) aSide), + tTileEntity.getComplexCoverDataAtSide((byte) aSide), + i, + tTileEntity) + || tTileEntity + .getCoverBehaviorAtSideNew((byte) aSide) + .letsItemsIn( + (byte) aSide, + tTileEntity.getCoverIDAtSide((byte) aSide), + tTileEntity.getComplexCoverDataAtSide((byte) aSide), + i, + tTileEntity))) tList.add(i); return tList.toArray(); } @Override public boolean canInsertItem(int aIndex, ItemStack aStack, int aSide) { - return isValidSlot(aIndex) && aStack != null && aIndex < mInventory.length && (mInventory[aIndex] == null || GT_Utility.areStacksEqual(aStack, mInventory[aIndex])) && allowPutStack(getBaseMetaTileEntity(), aIndex, (byte) aSide, aStack); + return isValidSlot(aIndex) + && aStack != null + && aIndex < mInventory.length + && (mInventory[aIndex] == null || GT_Utility.areStacksEqual(aStack, mInventory[aIndex])) + && allowPutStack(getBaseMetaTileEntity(), aIndex, (byte) aSide, aStack); } @Override public boolean canExtractItem(int aIndex, ItemStack aStack, int aSide) { - return isValidSlot(aIndex) && aStack != null && aIndex < mInventory.length && allowPullStack(getBaseMetaTileEntity(), aIndex, (byte) aSide, aStack); + return isValidSlot(aIndex) + && aStack != null + && aIndex < mInventory.length + && allowPullStack(getBaseMetaTileEntity(), aIndex, (byte) aSide, aStack); } @Override @@ -551,8 +644,8 @@ public abstract class MetaPipeEntity implements IMetaTileEntity, IConnectable { @Override public FluidTankInfo[] getTankInfo(ForgeDirection aSide) { - if (getCapacity() <= 0 && !getBaseMetaTileEntity().hasSteamEngineUpgrade()) return new FluidTankInfo[]{}; - return new FluidTankInfo[]{getInfo()}; + if (getCapacity() <= 0 && !getBaseMetaTileEntity().hasSteamEngineUpgrade()) return new FluidTankInfo[] {}; + return new FluidTankInfo[] {getInfo()}; } public int fill_default(ForgeDirection aSide, FluidStack aFluid, boolean doFill) { @@ -683,30 +776,66 @@ public abstract class MetaPipeEntity implements IMetaTileEntity, IConnectable { @Override public void doExplosion(long aExplosionPower) { - float tStrength = - aExplosionPower < V[0] ? 1.0F : - aExplosionPower < V[1] ? 2.0F : - aExplosionPower < V[2] ? 3.0F : - aExplosionPower < V[3] ? 4.0F : - aExplosionPower < V[4] ? 5.0F : - aExplosionPower < V[4] * 2 ? 6.0F : - aExplosionPower < V[5] ? 7.0F : - aExplosionPower < V[6] ? 8.0F : - aExplosionPower < V[7] ? 9.0F : - aExplosionPower < V[8] ? 10.0F : - aExplosionPower < V[8] * 2 ? 11.0F : - aExplosionPower < V[9] ? 12.0F : - aExplosionPower < V[10] ? 13.0F : - aExplosionPower < V[11] ? 14.0F : - aExplosionPower < V[12] ? 15.0F : - aExplosionPower < V[12] * 2 ? 16.0F : - aExplosionPower < V[13] ? 17.0F : - aExplosionPower < V[14] ? 18.0F : - aExplosionPower < V[15] ? 19.0F : 20.0F; - int tX = getBaseMetaTileEntity().getXCoord(), tY = getBaseMetaTileEntity().getYCoord(), tZ = getBaseMetaTileEntity().getZCoord(); + float tStrength = aExplosionPower < V[0] + ? 1.0F + : aExplosionPower < V[1] + ? 2.0F + : aExplosionPower < V[2] + ? 3.0F + : aExplosionPower < V[3] + ? 4.0F + : aExplosionPower < V[4] + ? 5.0F + : aExplosionPower < V[4] * 2 + ? 6.0F + : aExplosionPower < V[5] + ? 7.0F + : aExplosionPower < V[6] + ? 8.0F + : aExplosionPower < V[7] + ? 9.0F + : aExplosionPower < V[8] + ? 10.0F + : aExplosionPower < V[8] * 2 + ? 11.0F + : aExplosionPower < V[9] + ? 12.0F + : aExplosionPower + < V[ + 10] + ? 13.0F + : aExplosionPower + < V[ + 11] + ? 14.0F + : aExplosionPower + < V[ + 12] + ? 15.0F + : aExplosionPower + < V[ + 12] + * 2 + ? 16.0F + : aExplosionPower + < V[ + 13] + ? 17.0F + : aExplosionPower + < V[ + 14] + ? 18.0F + : aExplosionPower + < V[ + 15] + ? 19.0F + : 20.0F; + int tX = getBaseMetaTileEntity().getXCoord(), + tY = getBaseMetaTileEntity().getYCoord(), + tZ = getBaseMetaTileEntity().getZCoord(); World tWorld = getBaseMetaTileEntity().getWorld(); tWorld.setBlock(tX, tY, tZ, Blocks.air); - if (GregTech_API.sMachineExplosions){ + if (GregTech_API.sMachineExplosions) { new WorldSpawnedEventBuilder.ExplosionEffectEventBuilder() .setStrength(tStrength) .setSmoking(true) @@ -722,7 +851,14 @@ public abstract class MetaPipeEntity implements IMetaTileEntity, IConnectable { } @Override - public void addCollisionBoxesToList(World aWorld, int aX, int aY, int aZ, AxisAlignedBB inputAABB, List<AxisAlignedBB> outputAABB, Entity collider) { + public void addCollisionBoxesToList( + World aWorld, + int aX, + int aY, + int aZ, + AxisAlignedBB inputAABB, + List<AxisAlignedBB> outputAABB, + Entity collider) { AxisAlignedBB axisalignedbb1 = getCollisionBoundingBoxFromPool(aWorld, aX, aY, aZ); if (axisalignedbb1 != null && inputAABB.intersectsWith(axisalignedbb1)) outputAABB.add(axisalignedbb1); } @@ -743,23 +879,23 @@ public abstract class MetaPipeEntity implements IMetaTileEntity, IConnectable { } @Override - public boolean allowGeneralRedstoneOutput(){ + public boolean allowGeneralRedstoneOutput() { return false; } - @Override - public boolean hasAlternativeModeText() { - return false; - } + @Override + public boolean hasAlternativeModeText() { + return false; + } - @Override - public String getAlternativeModeText() { - return ""; - } + @Override + public String getAlternativeModeText() { + return ""; + } @Deprecated - public String trans(String aKey, String aEnglish){ - return GT_Utility.trans(aKey, aEnglish); + public String trans(String aKey, String aEnglish) { + return GT_Utility.trans(aKey, aEnglish); } private boolean connectableColor(TileEntity tTileEntity) { @@ -776,13 +912,13 @@ public abstract class MetaPipeEntity implements IMetaTileEntity, IConnectable { return true; } - @Override - public int connect(byte aSide) { - if (aSide >= 6) return 0; + @Override + public int connect(byte aSide) { + if (aSide >= 6) return 0; - final byte tSide = GT_Utility.getOppositeSide(aSide); - final IGregTechTileEntity baseMetaTile = getBaseMetaTileEntity(); - if (baseMetaTile == null || !baseMetaTile.isServerSide()) return 0; + final byte tSide = GT_Utility.getOppositeSide(aSide); + final IGregTechTileEntity baseMetaTile = getBaseMetaTileEntity(); + if (baseMetaTile == null || !baseMetaTile.isServerSide()) return 0; final GT_CoverBehaviorBase<?> coverBehavior = baseMetaTile.getCoverBehaviorAtSideNew(aSide); final int coverId = baseMetaTile.getCoverIDAtSide(aSide); @@ -796,30 +932,36 @@ public abstract class MetaPipeEntity implements IMetaTileEntity, IConnectable { TileEntity tTileEntity = baseMetaTile.getTileEntityAtSide(aSide); if (!connectableColor(tTileEntity)) return 0; - if ((alwaysLookConnected || letsIn || letsOut)) { + if ((alwaysLookConnected || letsIn || letsOut)) { // Are we trying to connect to a pipe? let's do it! - IMetaTileEntity tPipe = tTileEntity instanceof IGregTechTileEntity ? ((IGregTechTileEntity) tTileEntity).getMetaTileEntity() : null; - if (getClass().isInstance(tPipe) || (tPipe != null && tPipe.getClass().isInstance(this))) { + IMetaTileEntity tPipe = tTileEntity instanceof IGregTechTileEntity + ? ((IGregTechTileEntity) tTileEntity).getMetaTileEntity() + : null; + 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 ((MetaPipeEntity) tPipe).connect(tSide); } return 1; - } - else if((getGT6StyleConnection() && baseMetaTile.getAirAtSide(aSide)) || canConnect(aSide, tTileEntity)) { - // Allow open connections to Air, if the GT6 style pipe/cables are enabled, so that it'll connect to the next block placed down next to it + } else if ((getGT6StyleConnection() && baseMetaTile.getAirAtSide(aSide)) + || canConnect(aSide, tTileEntity)) { + // Allow open connections to Air, if the GT6 style pipe/cables are enabled, so that it'll connect to the + // next block placed down next to it 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; } - } - return 0; - } + return 0; + } protected void checkConnections() { // Verify connections around us. If GT6 style cables are not enabled then revert to old behavior and try @@ -832,32 +974,54 @@ public abstract class MetaPipeEntity implements IMetaTileEntity, IConnectable { mCheckConnections = false; } - private void connectAtSide(byte aSide) { + private void connectAtSide(byte aSide) { mConnections |= (1 << aSide); } - @Override - public void disconnect(byte aSide) { - if (aSide >= 6) return; - mConnections &= ~(1 << aSide); - 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))) && ((MetaPipeEntity) tPipe).isConnectedAtSide(tSide)) - ((MetaPipeEntity) tPipe).disconnect(tSide); - } + @Override + public void disconnect(byte aSide) { + if (aSide >= 6) return; + mConnections &= ~(1 << aSide); + 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))) + && ((MetaPipeEntity) tPipe).isConnectedAtSide(tSide)) ((MetaPipeEntity) tPipe).disconnect(tSide); + } - @Override + @Override public boolean isConnectedAtSide(int aSide) { - return (mConnections & (1 << aSide)) != 0; - } + return (mConnections & (1 << aSide)) != 0; + } + + public boolean letsIn( + GT_CoverBehavior coverBehavior, byte aSide, int aCoverID, int aCoverVariable, ICoverable aTileEntity) { + return false; + } + public boolean letsOut( + GT_CoverBehavior coverBehavior, byte aSide, int aCoverID, int aCoverVariable, ICoverable aTileEntity) { + return false; + } - public boolean letsIn(GT_CoverBehavior coverBehavior, byte aSide, int aCoverID, int aCoverVariable, ICoverable aTileEntity) { return false; } - public boolean letsOut(GT_CoverBehavior coverBehavior, byte aSide, int aCoverID, int aCoverVariable, ICoverable aTileEntity) { return false; } + public boolean letsIn( + GT_CoverBehaviorBase<?> coverBehavior, + byte aSide, + int aCoverID, + ISerializableObject aCoverVariable, + ICoverable aTileEntity) { + return false; + } - public boolean letsIn(GT_CoverBehaviorBase<?> coverBehavior, byte aSide, int aCoverID, ISerializableObject aCoverVariable, ICoverable aTileEntity) { return false; } - public boolean letsOut(GT_CoverBehaviorBase<?> coverBehavior, byte aSide, int aCoverID, ISerializableObject aCoverVariable, ICoverable aTileEntity) { return false; } + public boolean letsOut( + GT_CoverBehaviorBase<?> coverBehavior, + byte aSide, + int aCoverID, + ISerializableObject aCoverVariable, + ICoverable aTileEntity) { + return false; + } public boolean canConnect(byte aSide, TileEntity tTileEntity) { return false; @@ -877,6 +1041,5 @@ public abstract class MetaPipeEntity implements IMetaTileEntity, IConnectable { return false; } - public void reloadLocks() { - } + public void reloadLocks() {} } diff --git a/src/main/java/gregtech/api/metatileentity/MetaTileEntity.java b/src/main/java/gregtech/api/metatileentity/MetaTileEntity.java index 13ea66e7d2..1e77057be9 100644 --- a/src/main/java/gregtech/api/metatileentity/MetaTileEntity.java +++ b/src/main/java/gregtech/api/metatileentity/MetaTileEntity.java @@ -1,5 +1,7 @@ package gregtech.api.metatileentity; +import static gregtech.api.enums.GT_Values.V; + import appeng.api.networking.energy.IEnergyGrid; import appeng.api.networking.pathing.IPathingGrid; import appeng.api.util.AECableType; @@ -23,6 +25,10 @@ import gregtech.api.util.GT_Log; import gregtech.api.util.GT_ModHandler; import gregtech.api.util.GT_Utility; import gregtech.common.GT_Client; +import java.io.File; +import java.util.ArrayList; +import java.util.List; +import java.util.Locale; import mcp.mobius.waila.api.IWailaConfigHandler; import mcp.mobius.waila.api.IWailaDataAccessor; import net.minecraft.block.Block; @@ -44,13 +50,6 @@ import net.minecraftforge.fluids.Fluid; import net.minecraftforge.fluids.FluidStack; import net.minecraftforge.fluids.FluidTankInfo; -import java.io.File; -import java.util.ArrayList; -import java.util.List; -import java.util.Locale; - -import static gregtech.api.enums.GT_Values.V; - /** * NEVER INCLUDE THIS FILE IN YOUR MOD!!! * <p/> @@ -71,6 +70,7 @@ public abstract class MetaTileEntity implements IMetaTileEntity, IMachineCallbac * The Inventory of the MetaTileEntity. Amount of Slots can be larger than 256. HAYO! */ public final ItemStack[] mInventory; + public boolean doTickProfilingInThisTick = true; private MetaTileEntity mCallBackTile; @@ -80,7 +80,7 @@ public abstract class MetaTileEntity implements IMetaTileEntity, IMachineCallbac */ private IGregTechTileEntity mBaseMetaTileEntity; - public long mSoundRequests=0; + public long mSoundRequests = 0; /** * This registers your Machine at the List. @@ -145,7 +145,10 @@ public abstract class MetaTileEntity implements IMetaTileEntity, IMachineCallbac @Override public ItemStack getStackForm(long aAmount) { - return new ItemStack(GregTech_API.sBlockMachines, (int) aAmount, getBaseMetaTileEntity().getMetaTileID()); + return new ItemStack( + GregTech_API.sBlockMachines, + (int) aAmount, + getBaseMetaTileEntity().getMetaTileID()); } public String getLocalName() { @@ -153,23 +156,35 @@ public abstract class MetaTileEntity implements IMetaTileEntity, IMachineCallbac } @Override - public void onServerStart() {/*Do nothing*/} + public void onServerStart() { + /*Do nothing*/ + } @Override - public void onWorldSave(File aSaveDirectory) {/*Do nothing*/} + public void onWorldSave(File aSaveDirectory) { + /*Do nothing*/ + } @Override - public void onWorldLoad(File aSaveDirectory) {/*Do nothing*/} + public void onWorldLoad(File aSaveDirectory) { + /*Do nothing*/ + } @Override - public void onConfigLoad(GT_Config aConfig) {/*Do nothing*/} + public void onConfigLoad(GT_Config aConfig) { + /*Do nothing*/ + } @Override - public void setItemNBT(NBTTagCompound aNBT) {/*Do nothing*/} + public void setItemNBT(NBTTagCompound aNBT) { + /*Do nothing*/ + } @Override @SideOnly(Side.CLIENT) - public void registerIcons(IIconRegister aBlockIconRegister) {/*Do nothing*/} + public void registerIcons(IIconRegister aBlockIconRegister) { + /*Do nothing*/ + } @Override public boolean allowCoverOnSide(byte aSide, GT_ItemStack aStack) { @@ -177,10 +192,13 @@ public abstract class MetaTileEntity implements IMetaTileEntity, IMachineCallbac } @Override - public void onScrewdriverRightClick(byte aSide, EntityPlayer aPlayer, float aX, float aY, float aZ) {/*Do nothing*/} + public void onScrewdriverRightClick(byte aSide, EntityPlayer aPlayer, float aX, float aY, float aZ) { + /*Do nothing*/ + } @Override - public boolean onWrenchRightClick(byte aSide, byte aWrenchingSide, EntityPlayer aPlayer, float aX, float aY, float aZ) { + public boolean onWrenchRightClick( + byte aSide, byte aWrenchingSide, EntityPlayer aPlayer, float aX, float aY, float aZ) { if (getBaseMetaTileEntity().isValidFacing(aWrenchingSide)) { getBaseMetaTileEntity().setFrontFacing(aWrenchingSide); return true; @@ -189,39 +207,54 @@ public abstract class MetaTileEntity implements IMetaTileEntity, IMachineCallbac } @Override - public boolean onWireCutterRightClick(byte aSide, byte aWrenchingSide, EntityPlayer aPlayer, float aX, float aY, float aZ) { - if(!aPlayer.isSneaking()) return false; + public boolean onWireCutterRightClick( + byte aSide, byte aWrenchingSide, EntityPlayer aPlayer, float aX, float aY, float aZ) { + if (!aPlayer.isSneaking()) return false; byte tSide = GT_Utility.getOppositeSide(aWrenchingSide); TileEntity tTileEntity = getBaseMetaTileEntity().getTileEntityAtSide(aWrenchingSide); - if ((tTileEntity instanceof IGregTechTileEntity) && (((IGregTechTileEntity) tTileEntity).getMetaTileEntity() instanceof GT_MetaPipeEntity_Cable)) { + if ((tTileEntity instanceof IGregTechTileEntity) + && (((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); + return ((IGregTechTileEntity) tTileEntity) + .getMetaTileEntity() + .onWireCutterRightClick(aWrenchingSide, tSide, aPlayer, aX, aY, aZ); } return false; } @Override - public boolean onSolderingToolRightClick(byte aSide, byte aWrenchingSide, EntityPlayer aPlayer, float aX, float aY, float aZ) { - if(!aPlayer.isSneaking()) return false; + public boolean onSolderingToolRightClick( + byte aSide, byte aWrenchingSide, EntityPlayer aPlayer, float aX, float aY, float aZ) { + if (!aPlayer.isSneaking()) return false; byte tSide = GT_Utility.getOppositeSide(aWrenchingSide); TileEntity tTileEntity = getBaseMetaTileEntity().getTileEntityAtSide(aWrenchingSide); - if ((tTileEntity instanceof IGregTechTileEntity) && (((IGregTechTileEntity) tTileEntity).getMetaTileEntity() instanceof GT_MetaPipeEntity_Cable)) { + if ((tTileEntity instanceof IGregTechTileEntity) + && (((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); + return ((IGregTechTileEntity) tTileEntity) + .getMetaTileEntity() + .onSolderingToolRightClick(aWrenchingSide, tSide, aPlayer, aX, aY, aZ); } return false; } @Override public void onExplosion() { - GT_Log.exp.println("Machine at "+this.getBaseMetaTileEntity().getXCoord()+" | "+this.getBaseMetaTileEntity().getYCoord()+" | "+this.getBaseMetaTileEntity().getZCoord()+" DIMID: "+ this.getBaseMetaTileEntity().getWorld().provider.dimensionId+ " exploded."); + GT_Log.exp.println("Machine at " + this.getBaseMetaTileEntity().getXCoord() + " | " + + this.getBaseMetaTileEntity().getYCoord() + " | " + + this.getBaseMetaTileEntity().getZCoord() + " DIMID: " + + this.getBaseMetaTileEntity().getWorld().provider.dimensionId + " exploded."); } @Override - public void onFirstTick(IGregTechTileEntity aBaseMetaTileEntity) {/*Do nothing*/} + public void onFirstTick(IGregTechTileEntity aBaseMetaTileEntity) { + /*Do nothing*/ + } @Override - public void onPreTick(IGregTechTileEntity aBaseMetaTileEntity, long aTick) {/*Do nothing*/} + public void onPreTick(IGregTechTileEntity aBaseMetaTileEntity, long aTick) { + /*Do nothing*/ + } @Override public void onPostTick(IGregTechTileEntity aBaseMetaTileEntity, long aTick) { @@ -235,23 +268,33 @@ public abstract class MetaTileEntity implements IMetaTileEntity, IMachineCallbac } @Override - public void inValidate() {/*Do nothing*/} + public void inValidate() { + /*Do nothing*/ + } @Override - public void onRemoval() {/*Do nothing*/} + public void onRemoval() { + /*Do nothing*/ + } @Override - public void initDefaultModes(NBTTagCompound aNBT) {/*Do nothing*/} + public void initDefaultModes(NBTTagCompound aNBT) { + /*Do nothing*/ + } /** * When a GUI is opened */ - public void onOpenGUI() {/*Do nothing*/} + public void onOpenGUI() { + /*Do nothing*/ + } /** * When a GUI is closed */ - public void onCloseGUI() {/*Do nothing*/} + public void onCloseGUI() { + /*Do nothing*/ + } /** * a Player rightclicks the Machine @@ -262,15 +305,20 @@ public abstract class MetaTileEntity implements IMetaTileEntity, IMachineCallbac } @Override - public boolean onRightclick(IGregTechTileEntity aBaseMetaTileEntity, EntityPlayer aPlayer, byte aSide, float aX, float aY, float aZ) { + public boolean onRightclick( + IGregTechTileEntity aBaseMetaTileEntity, EntityPlayer aPlayer, byte aSide, float aX, float aY, float aZ) { return onRightclick(aBaseMetaTileEntity, aPlayer); } @Override - public void onLeftclick(IGregTechTileEntity aBaseMetaTileEntity, EntityPlayer aPlayer) {/*Do nothing*/} + public void onLeftclick(IGregTechTileEntity aBaseMetaTileEntity, EntityPlayer aPlayer) { + /*Do nothing*/ + } @Override - public void onValueUpdate(byte aValue) {/*Do nothing*/} + public void onValueUpdate(byte aValue) { + /*Do nothing*/ + } @Override public byte getUpdateData() { @@ -278,13 +326,19 @@ public abstract class MetaTileEntity implements IMetaTileEntity, IMachineCallbac } @Override - public void doSound(byte aIndex, double aX, double aY, double aZ) {/*Do nothing*/} + public void doSound(byte aIndex, double aX, double aY, double aZ) { + /*Do nothing*/ + } @Override - public void startSoundLoop(byte aIndex, double aX, double aY, double aZ) {/*Do nothing*/} + public void startSoundLoop(byte aIndex, double aX, double aY, double aZ) { + /*Do nothing*/ + } @Override - public void stopSoundLoop(byte aValue, double aX, double aY, double aZ) {/*Do nothing*/} + public void stopSoundLoop(byte aValue, double aX, double aY, double aZ) { + /*Do nothing*/ + } @Override public MetaTileEntity getCallbackBase() { @@ -460,7 +514,7 @@ public abstract class MetaTileEntity implements IMetaTileEntity, IMachineCallbac * This is used to set the internal Steam Energy to the given Parameter. */ public void setSteamVar(long aSteam) { - if(((BaseMetaTileEntity) mBaseMetaTileEntity).mStoredSteam != aSteam){ + if (((BaseMetaTileEntity) mBaseMetaTileEntity).mStoredSteam != aSteam) { markDirty(); ((BaseMetaTileEntity) mBaseMetaTileEntity).mStoredSteam = aSteam; } @@ -531,7 +585,8 @@ public abstract class MetaTileEntity implements IMetaTileEntity, IMachineCallbac } @Override - public ArrayList<String> getSpecialDebugInfo(IGregTechTileEntity aBaseMetaTileEntity, EntityPlayer aPlayer, int aLogLevel, ArrayList<String> aList) { + public ArrayList<String> getSpecialDebugInfo( + IGregTechTileEntity aBaseMetaTileEntity, EntityPlayer aPlayer, int aLogLevel, ArrayList<String> aList) { return aList; } @@ -585,10 +640,14 @@ public abstract class MetaTileEntity implements IMetaTileEntity, IMachineCallbac } @Override - public void onMachineBlockUpdate() {/*Do nothing*/} + public void onMachineBlockUpdate() { + /*Do nothing*/ + } @Override - public void receiveClientEvent(byte aEventID, byte aValue) {/*Do nothing*/} + public void receiveClientEvent(byte aEventID, byte aValue) { + /*Do nothing*/ + } @Override public boolean isSimpleMachine() { @@ -641,13 +700,17 @@ public abstract class MetaTileEntity implements IMetaTileEntity, IMachineCallbac /** * When the Facing gets changed. */ - public void onFacingChange() {/*Do nothing*/} + public void onFacingChange() { + /*Do nothing*/ + } /** * if the IC2 Teleporter can drain from this. */ public boolean isTeleporterCompatible() { - return isEnetOutput() && getBaseMetaTileEntity().getOutputVoltage() >= 128 && getBaseMetaTileEntity().getUniversalEnergyCapacity() >= 500000; + return isEnetOutput() + && getBaseMetaTileEntity().getOutputVoltage() >= 128 + && getBaseMetaTileEntity().getUniversalEnergyCapacity() >= 500000; } /** @@ -680,7 +743,7 @@ public abstract class MetaTileEntity implements IMetaTileEntity, IMachineCallbac @Override public String[] getInfoData() { - return new String[]{}; + return new String[] {}; } public boolean isDigitalChest() { @@ -691,7 +754,9 @@ public abstract class MetaTileEntity implements IMetaTileEntity, IMachineCallbac return null; } - public void setItemCount(int aCount) {/*Do nothing*/} + public void setItemCount(int aCount) { + /*Do nothing*/ + } public int getMaxItemCount() { return 0; @@ -712,14 +777,13 @@ public abstract class MetaTileEntity implements IMetaTileEntity, IMachineCallbac public void setInventorySlotContents(int aIndex, ItemStack aStack) { markDirty(); if (this instanceof IConfigurationCircuitSupport) { - IConfigurationCircuitSupport ccs = (IConfigurationCircuitSupport)this; + IConfigurationCircuitSupport ccs = (IConfigurationCircuitSupport) this; if (ccs.allowSelectCircuit() && aIndex == ccs.getCircuitSlot() && aStack != null) { mInventory[aIndex] = GT_Utility.copyAmount(0, aStack); return; } } - if (aIndex >= 0 && aIndex < mInventory.length) - mInventory[aIndex] = aStack; + if (aIndex >= 0 && aIndex < mInventory.length) mInventory[aIndex] = aStack; } @Override @@ -747,8 +811,7 @@ public abstract class MetaTileEntity implements IMetaTileEntity, IMachineCallbac if (setStackToZeroInsteadOfNull(aIndex)) { tStack.stackSize = 0; markDirty(); - } - else setInventorySlotContents(aIndex, null); + } else setInventorySlotContents(aIndex, null); } else { rStack = tStack.splitStack(aAmount); markDirty(); @@ -763,21 +826,59 @@ public abstract class MetaTileEntity implements IMetaTileEntity, IMachineCallbac public int[] getAccessibleSlotsFromSide(int aSide) { TIntList tList = new TIntArrayList(); IGregTechTileEntity tTileEntity = getBaseMetaTileEntity(); - boolean tSkip = tTileEntity.getCoverBehaviorAtSideNew((byte) aSide).letsItemsIn((byte) aSide, tTileEntity.getCoverIDAtSide((byte) aSide), tTileEntity.getComplexCoverDataAtSide((byte) aSide), -2, tTileEntity) || tTileEntity.getCoverBehaviorAtSideNew((byte) aSide).letsItemsOut((byte) aSide, tTileEntity.getCoverIDAtSide((byte) aSide), tTileEntity.getComplexCoverDataAtSide((byte) aSide), -2, tTileEntity); + boolean tSkip = tTileEntity + .getCoverBehaviorAtSideNew((byte) aSide) + .letsItemsIn( + (byte) aSide, + tTileEntity.getCoverIDAtSide((byte) aSide), + tTileEntity.getComplexCoverDataAtSide((byte) aSide), + -2, + tTileEntity) + || tTileEntity + .getCoverBehaviorAtSideNew((byte) aSide) + .letsItemsOut( + (byte) aSide, + tTileEntity.getCoverIDAtSide((byte) aSide), + tTileEntity.getComplexCoverDataAtSide((byte) aSide), + -2, + tTileEntity); for (int i = 0; i < getSizeInventory(); i++) - if (isValidSlot(i) && (tSkip || tTileEntity.getCoverBehaviorAtSideNew((byte) aSide).letsItemsOut((byte) aSide, tTileEntity.getCoverIDAtSide((byte) aSide), tTileEntity.getComplexCoverDataAtSide((byte) aSide), i, tTileEntity) || tTileEntity.getCoverBehaviorAtSideNew((byte) aSide).letsItemsIn((byte) aSide, tTileEntity.getCoverIDAtSide((byte) aSide), tTileEntity.getComplexCoverDataAtSide((byte) aSide), i, tTileEntity))) - tList.add(i); + if (isValidSlot(i) + && (tSkip + || tTileEntity + .getCoverBehaviorAtSideNew((byte) aSide) + .letsItemsOut( + (byte) aSide, + tTileEntity.getCoverIDAtSide((byte) aSide), + tTileEntity.getComplexCoverDataAtSide((byte) aSide), + i, + tTileEntity) + || tTileEntity + .getCoverBehaviorAtSideNew((byte) aSide) + .letsItemsIn( + (byte) aSide, + tTileEntity.getCoverIDAtSide((byte) aSide), + tTileEntity.getComplexCoverDataAtSide((byte) aSide), + i, + tTileEntity))) tList.add(i); return tList.toArray(); } @Override public boolean canInsertItem(int aIndex, ItemStack aStack, int aSide) { - return isValidSlot(aIndex) && aStack != null && aIndex < mInventory.length && (mInventory[aIndex] == null || GT_Utility.areStacksEqual(aStack, mInventory[aIndex])) && allowPutStack(getBaseMetaTileEntity(), aIndex, (byte) aSide, aStack); + return isValidSlot(aIndex) + && aStack != null + && aIndex < mInventory.length + && (mInventory[aIndex] == null || GT_Utility.areStacksEqual(aStack, mInventory[aIndex])) + && allowPutStack(getBaseMetaTileEntity(), aIndex, (byte) aSide, aStack); } @Override public boolean canExtractItem(int aIndex, ItemStack aStack, int aSide) { - return isValidSlot(aIndex) && aStack != null && aIndex < mInventory.length && allowPullStack(getBaseMetaTileEntity(), aIndex, (byte) aSide, aStack); + return isValidSlot(aIndex) + && aStack != null + && aIndex < mInventory.length + && allowPullStack(getBaseMetaTileEntity(), aIndex, (byte) aSide, aStack); } @Override @@ -792,8 +893,8 @@ public abstract class MetaTileEntity implements IMetaTileEntity, IMachineCallbac @Override public FluidTankInfo[] getTankInfo(ForgeDirection aSide) { - if (getCapacity() <= 0 && !getBaseMetaTileEntity().hasSteamEngineUpgrade()) return new FluidTankInfo[]{}; - return new FluidTankInfo[]{getInfo()}; + if (getCapacity() <= 0 && !getBaseMetaTileEntity().hasSteamEngineUpgrade()) return new FluidTankInfo[] {}; + return new FluidTankInfo[] {getInfo()}; } public int fill_default(ForgeDirection aSide, FluidStack aFluid, boolean doFill) { @@ -804,7 +905,12 @@ public abstract class MetaTileEntity implements IMetaTileEntity, IMachineCallbac @Override public int fill(ForgeDirection aSide, FluidStack aFluid, boolean doFill) { if (getBaseMetaTileEntity().hasSteamEngineUpgrade() && GT_ModHandler.isSteam(aFluid) && aFluid.amount > 1) { - int tSteam = (int) Math.min(Integer.MAX_VALUE, Math.min(aFluid.amount / 2, getBaseMetaTileEntity().getSteamCapacity() - getBaseMetaTileEntity().getStoredSteam())); + int tSteam = (int) Math.min( + Integer.MAX_VALUE, + Math.min( + aFluid.amount / 2, + getBaseMetaTileEntity().getSteamCapacity() + - getBaseMetaTileEntity().getStoredSteam())); if (tSteam > 0) { markDirty(); if (doFill) getBaseMetaTileEntity().increaseStoredSteam(tSteam, true); @@ -909,7 +1015,7 @@ public abstract class MetaTileEntity implements IMetaTileEntity, IMachineCallbac public void onColorChangeServer(byte aColor) { final IGregTechTileEntity meta = getBaseMetaTileEntity(); final int aX = meta.getXCoord(), aY = meta.getYCoord(), aZ = meta.getZCoord(); - for (byte aSide = 0; aSide < 6 ; aSide++ ) { + for (byte aSide = 0; aSide < 6; aSide++) { // Flag surrounding pipes/cables to revaluate their connection with us if we got painted final TileEntity tTileEntity = meta.getTileEntityAtSide(aSide); if ((tTileEntity instanceof BaseMetaPipeEntity)) { @@ -937,27 +1043,63 @@ public abstract class MetaTileEntity implements IMetaTileEntity, IMachineCallbac @Override public void doExplosion(long aExplosionPower) { - float tStrength = - aExplosionPower < V[0] ? 1.0F : - aExplosionPower < V[1] ? 2.0F : - aExplosionPower < V[2] ? 3.0F : - aExplosionPower < V[3] ? 4.0F : - aExplosionPower < V[4] ? 5.0F : - aExplosionPower < V[4] * 2 ? 6.0F : - aExplosionPower < V[5] ? 7.0F : - aExplosionPower < V[6] ? 8.0F : - aExplosionPower < V[7] ? 9.0F : - aExplosionPower < V[8] ? 10.0F : - aExplosionPower < V[8] * 2 ? 11.0F : - aExplosionPower < V[9] ? 12.0F : - aExplosionPower < V[10] ? 13.0F : - aExplosionPower < V[11] ? 14.0F : - aExplosionPower < V[12] ? 15.0F : - aExplosionPower < V[12] * 2 ? 16.0F : - aExplosionPower < V[13] ? 17.0F : - aExplosionPower < V[14] ? 18.0F : - aExplosionPower < V[15] ? 19.0F : 20.0F; - int tX = getBaseMetaTileEntity().getXCoord(), tY = getBaseMetaTileEntity().getYCoord(), tZ = getBaseMetaTileEntity().getZCoord(); + float tStrength = aExplosionPower < V[0] + ? 1.0F + : aExplosionPower < V[1] + ? 2.0F + : aExplosionPower < V[2] + ? 3.0F + : aExplosionPower < V[3] + ? 4.0F + : aExplosionPower < V[4] + ? 5.0F + : aExplosionPower < V[4] * 2 + ? 6.0F + : aExplosionPower < V[5] + ? 7.0F + : aExplosionPower < V[6] + ? 8.0F + : aExplosionPower < V[7] + ? 9.0F + : aExplosionPower < V[8] + ? 10.0F + : aExplosionPower < V[8] * 2 + ? 11.0F + : aExplosionPower < V[9] + ? 12.0F + : aExplosionPower + < V[ + 10] + ? 13.0F + : aExplosionPower + < V[ + 11] + ? 14.0F + : aExplosionPower + < V[ + 12] + ? 15.0F + : aExplosionPower + < V[ + 12] + * 2 + ? 16.0F + : aExplosionPower + < V[ + 13] + ? 17.0F + : aExplosionPower + < V[ + 14] + ? 18.0F + : aExplosionPower + < V[ + 15] + ? 19.0F + : 20.0F; + int tX = getBaseMetaTileEntity().getXCoord(), + tY = getBaseMetaTileEntity().getYCoord(), + tZ = getBaseMetaTileEntity().getZCoord(); World tWorld = getBaseMetaTileEntity().getWorld(); GT_Utility.sendSoundToPlayers(tWorld, SoundResource.IC2_MACHINES_MACHINE_OVERLOAD, 1.0F, -1, tX, tY, tZ); tWorld.setBlock(tX, tY, tZ, Blocks.air); @@ -971,7 +1113,14 @@ public abstract class MetaTileEntity implements IMetaTileEntity, IMachineCallbac } @Override - public void addCollisionBoxesToList(World aWorld, int aX, int aY, int aZ, AxisAlignedBB inputAABB, List<AxisAlignedBB> outputAABB, Entity collider) { + public void addCollisionBoxesToList( + World aWorld, + int aX, + int aY, + int aZ, + AxisAlignedBB inputAABB, + List<AxisAlignedBB> outputAABB, + Entity collider) { AxisAlignedBB axisalignedbb1 = getCollisionBoundingBoxFromPool(aWorld, aX, aY, aZ); if (axisalignedbb1 != null && inputAABB.intersectsWith(axisalignedbb1)) outputAABB.add(axisalignedbb1); } @@ -992,29 +1141,33 @@ public abstract class MetaTileEntity implements IMetaTileEntity, IMachineCallbac } @Override - public boolean allowGeneralRedstoneOutput(){ - return false; + public boolean allowGeneralRedstoneOutput() { + return false; } @Deprecated - public String trans(String aKey, String aEnglish){ - return GT_Utility.trans(aKey, aEnglish); + public String trans(String aKey, String aEnglish) { + return GT_Utility.trans(aKey, aEnglish); } @Override - public boolean hasAlternativeModeText(){ - return false; + public boolean hasAlternativeModeText() { + return false; } @Override - public String getAlternativeModeText(){ - return ""; + public String getAlternativeModeText() { + return ""; } @Override - public boolean shouldJoinIc2Enet() { return false; } + public boolean shouldJoinIc2Enet() { + return false; + } - public boolean shouldTriggerBlockUpdate() { return false; } + public boolean shouldTriggerBlockUpdate() { + return false; + } @Optional.Method(modid = "appliedenergistics2") public AECableType getCableConnectionType(ForgeDirection forgeDirection) { @@ -1030,33 +1183,32 @@ public abstract class MetaTileEntity implements IMetaTileEntity, IMachineCallbac public void gridChanged() {} @Override - public void getWailaBody(ItemStack itemStack, List<String> currenttip, IWailaDataAccessor accessor, IWailaConfigHandler config) { - currenttip.add(String.format("Facing: %s", ForgeDirection.getOrientation(mBaseMetaTileEntity.getFrontFacing()).name())); + public void getWailaBody( + ItemStack itemStack, List<String> currenttip, IWailaDataAccessor accessor, IWailaConfigHandler config) { + currenttip.add(String.format( + "Facing: %s", + ForgeDirection.getOrientation(mBaseMetaTileEntity.getFrontFacing()) + .name())); } @Override - public void getWailaNBTData(EntityPlayerMP player, TileEntity tile, NBTTagCompound tag, World world, int x, int y, int z) { + public void getWailaNBTData( + EntityPlayerMP player, TileEntity tile, NBTTagCompound tag, World world, int x, int y, int z) { /* Empty */ } @Optional.Method(modid = "appliedenergistics2") protected String getAEDiagnostics() { 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)"; + 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 (!pg.isNetworkBooting()) - return "(booting)"; + if (!pg.isNetworkBooting()) return "(booting)"; IEnergyGrid eg = getProxy().getNode().getGrid().getCache(IEnergyGrid.class); - if (!eg.isNetworkPowered()) - return "(power)"; - } catch(Throwable ex) { + if (!eg.isNetworkPowered()) return "(power)"; + } catch (Throwable ex) { ex.printStackTrace(); } return ""; diff --git a/src/main/java/gregtech/api/metatileentity/TileIC2EnergySink.java b/src/main/java/gregtech/api/metatileentity/TileIC2EnergySink.java index 16af004957..661dad730f 100644 --- a/src/main/java/gregtech/api/metatileentity/TileIC2EnergySink.java +++ b/src/main/java/gregtech/api/metatileentity/TileIC2EnergySink.java @@ -44,19 +44,18 @@ public class TileIC2EnergySink extends TileEntity implements IEnergySink { */ @Override public double getDemandedEnergy() { - if(cableMeta != null) { - // We don't want everything to join the enet (treating the cable as a conductor) so we join it as a ink. We don't want to traverse all cables - // connected to this (like we would during distribution) to see if it actually needs any EU... so we just always say we want it all. If there - // are more than two things attached, and one of them is a GT cable that doesn't have anywhere to send it's energy, the distribution will be a bit + if (cableMeta != null) { + // We don't want everything to join the enet (treating the cable as a conductor) so we join it as a ink. We + // don't want to traverse all cables + // connected to this (like we would during distribution) to see if it actually needs any EU... so we just + // always say we want it all. If there + // are more than two things attached, and one of them is a GT cable that doesn't have anywhere to send it's + // energy, the distribution will be a bit // weird. In that case only use one cable, or use a transformer. return (cableMeta.mVoltage * cableMeta.mAmperage); - } - else - return myMeta.getEUCapacity() - myMeta.getStoredEU(); + } else return myMeta.getEUCapacity() - myMeta.getStoredEU(); } - - /** * Determine the tier of this energy sink. * 1 = LV, 2 = MV, 3 = HV, 4 = EV etc. @@ -82,20 +81,26 @@ 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 euPerAmp = (long)(amount / (amps * 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(); if (metaTile == null) return amount; final long usedAmps; - if(cableMeta != null) { - usedAmps = ((IMetaTileEntityCable) metaTile).transferElectricity((byte) directionFrom.ordinal(), Math.min(euPerAmp, cableMeta.mVoltage), amps, Sets.newHashSet((TileEntity) myMeta)); - - } - else - usedAmps = myMeta.injectEnergyUnits((byte) directionFrom.ordinal(), Math.min(euPerAmp, myMeta.getInputVoltage()), amps); - return amount - ( usedAmps * euPerAmp); + if (cableMeta != null) { + usedAmps = ((IMetaTileEntityCable) metaTile) + .transferElectricity( + (byte) directionFrom.ordinal(), + Math.min(euPerAmp, cableMeta.mVoltage), + amps, + Sets.newHashSet((TileEntity) myMeta)); + + } else + usedAmps = myMeta.injectEnergyUnits( + (byte) directionFrom.ordinal(), Math.min(euPerAmp, myMeta.getInputVoltage()), amps); + return amount - (usedAmps * euPerAmp); // transferElectricity for cables } @@ -112,11 +117,9 @@ public class TileIC2EnergySink extends TileEntity implements IEnergySink { @Override public boolean acceptsEnergyFrom(TileEntity emitter, ForgeDirection direction) { final IMetaTileEntity metaTile = myMeta.getMetaTileEntity(); - if(metaTile instanceof IMetaTileEntityCable && (direction == ForgeDirection.UNKNOWN || ((IConnectable)metaTile).isConnectedAtSide(direction.ordinal()))) - return true; - else - return myMeta.inputEnergyFrom((byte) direction.ordinal(), false); - + if (metaTile instanceof IMetaTileEntityCable + && (direction == ForgeDirection.UNKNOWN + || ((IConnectable) metaTile).isConnectedAtSide(direction.ordinal()))) return true; + else return myMeta.inputEnergyFrom((byte) direction.ordinal(), false); } - } 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 431ed3cc30..be1904aaf5 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 @@ -1,5 +1,7 @@ package gregtech.api.metatileentity.examples; +import static gregtech.api.enums.Textures.BlockIcons.*; + import gregtech.api.enums.SoundResource; import gregtech.api.interfaces.ITexture; import gregtech.api.interfaces.tileentity.IGregTechTileEntity; @@ -10,45 +12,84 @@ import gregtech.api.util.GT_ModHandler; import gregtech.api.util.GT_Utility; import net.minecraft.item.ItemStack; -import static gregtech.api.enums.Textures.BlockIcons.*; - /** * This Example Implementation still works, however I use something completely different in my own Code. */ public class GT_MetaTileEntity_E_Furnace extends GT_MetaTileEntity_BasicMachine { public GT_MetaTileEntity_E_Furnace(int aID, String aName, String aNameRegional, int aTier) { - super(aID, aName, aNameRegional, aTier, 1, "Not like using a Commodore 64", 1, 1, "E_Furnace.png", "smelting", + super( + aID, + aName, + aNameRegional, + aTier, + 1, + "Not like using a Commodore 64", + 1, + 1, + "E_Furnace.png", + "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, String aGUIName, String aNEIName) { + public GT_MetaTileEntity_E_Furnace( + String aName, int aTier, String aDescription, ITexture[][][] aTextures, String aGUIName, String aNEIName) { super(aName, aTier, 1, aDescription, aTextures, 1, 1, aGUIName, aNEIName); } - public GT_MetaTileEntity_E_Furnace(String aName, int aTier, String[] aDescription, ITexture[][][] aTextures, String aGUIName, String aNEIName) { + public GT_MetaTileEntity_E_Furnace( + String aName, + int aTier, + String[] aDescription, + ITexture[][][] aTextures, + String aGUIName, + String aNEIName) { super(aName, aTier, 1, aDescription, aTextures, 1, 1, aGUIName, aNEIName); } @@ -69,14 +110,17 @@ public class GT_MetaTileEntity_E_Furnace extends GT_MetaTileEntity_BasicMachine } @Override - protected boolean allowPutStackValidated(IGregTechTileEntity aBaseMetaTileEntity, int aIndex, byte aSide, ItemStack aStack) { - return super.allowPutStackValidated(aBaseMetaTileEntity, aIndex, aSide, aStack) && GT_ModHandler.getSmeltingOutput(GT_Utility.copyAmount(64, aStack), false, null) != null; + protected boolean allowPutStackValidated( + IGregTechTileEntity aBaseMetaTileEntity, int aIndex, byte aSide, ItemStack aStack) { + return super.allowPutStackValidated(aBaseMetaTileEntity, aIndex, aSide, aStack) + && GT_ModHandler.getSmeltingOutput(GT_Utility.copyAmount(64, aStack), false, null) != null; } @Override public void startSoundLoop(byte aIndex, double aX, double aY, double aZ) { super.startSoundLoop(aIndex, aX, aY, aZ); - if (aIndex == 1) GT_Utility.doSoundAtClient(SoundResource.IC2_MACHINES_ELECTROFURNACE_LOOP, 10, 1.0F, aX, aY, aZ); + if (aIndex == 1) + GT_Utility.doSoundAtClient(SoundResource.IC2_MACHINES_ELECTROFURNACE_LOOP, 10, 1.0F, aX, aY, aZ); } @Override 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 e92f61f1b9..fd3fe175c9 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 @@ -1,5 +1,7 @@ package gregtech.api.metatileentity.implementations; +import static gregtech.api.enums.GT_Values.VN; + import cofh.api.energy.IEnergyReceiver; import cpw.mods.fml.common.Loader; import gregtech.GT_Mod; @@ -34,6 +36,9 @@ import ic2.api.energy.tile.IEnergySink; import ic2.api.energy.tile.IEnergySource; import ic2.api.energy.tile.IEnergyTile; import ic2.api.reactor.IReactorChamber; +import java.util.ArrayList; +import java.util.HashSet; +import java.util.List; import net.minecraft.entity.Entity; import net.minecraft.entity.EntityLivingBase; import net.minecraft.entity.player.EntityPlayer; @@ -45,27 +50,37 @@ import net.minecraft.util.EnumChatFormatting; import net.minecraft.world.World; import net.minecraftforge.common.util.ForgeDirection; -import java.util.ArrayList; -import java.util.HashSet; -import java.util.List; - -import static gregtech.api.enums.GT_Values.VN; - public class GT_MetaPipeEntity_Cable extends MetaPipeEntity implements IMetaTileEntityCable { public final float mThickNess; public final Materials mMaterial; public final long mCableLossPerMeter, mAmperage, mVoltage; public final boolean mInsulated, mCanShock; - public int mTransferredAmperage = 0, mTransferredAmperageLast20 = 0,mTransferredAmperageLast20OK=0,mTransferredAmperageOK=0; - public long mTransferredVoltageLast20 = 0, mTransferredVoltage = 0,mTransferredVoltageLast20OK=0,mTransferredVoltageOK=0; + public int mTransferredAmperage = 0, + mTransferredAmperageLast20 = 0, + mTransferredAmperageLast20OK = 0, + mTransferredAmperageOK = 0; + public long mTransferredVoltageLast20 = 0, + mTransferredVoltage = 0, + mTransferredVoltageLast20OK = 0, + mTransferredVoltageOK = 0; public long mRestRF; public int mOverheat; - public static short mMaxOverheat=(short) (GT_Mod.gregtechproxy.mWireHeatingTicks * 100); + public static short mMaxOverheat = (short) (GT_Mod.gregtechproxy.mWireHeatingTicks * 100); private int[] lastAmperage; private long lastWorldTick; - public GT_MetaPipeEntity_Cable(int aID, String aName, String aNameRegional, float aThickNess, Materials aMaterial, long aCableLossPerMeter, long aAmperage, long aVoltage, boolean aInsulated, boolean aCanShock) { + public GT_MetaPipeEntity_Cable( + int aID, + String aName, + String aNameRegional, + float aThickNess, + Materials aMaterial, + long aCableLossPerMeter, + long aAmperage, + long aVoltage, + boolean aInsulated, + boolean aCanShock) { super(aID, aName, aNameRegional, 0); mThickNess = aThickNess; mMaterial = aMaterial; @@ -76,7 +91,15 @@ public class GT_MetaPipeEntity_Cable extends MetaPipeEntity implements IMetaTile mCableLossPerMeter = aCableLossPerMeter; } - public GT_MetaPipeEntity_Cable(String aName, float aThickNess, Materials aMaterial, long aCableLossPerMeter, long aAmperage, long aVoltage, boolean aInsulated, boolean aCanShock) { + public GT_MetaPipeEntity_Cable( + String aName, + float aThickNess, + Materials aMaterial, + long aCableLossPerMeter, + long aAmperage, + long aVoltage, + boolean aInsulated, + boolean aCanShock) { super(aName, 0); mThickNess = aThickNess; mMaterial = aMaterial; @@ -94,36 +117,88 @@ public class GT_MetaPipeEntity_Cable extends MetaPipeEntity implements IMetaTile @Override public IMetaTileEntity newMetaEntity(IGregTechTileEntity aTileEntity) { - return new GT_MetaPipeEntity_Cable(mName, mThickNess, mMaterial, mCableLossPerMeter, mAmperage, mVoltage, mInsulated, mCanShock); + return new GT_MetaPipeEntity_Cable( + mName, mThickNess, mMaterial, mCableLossPerMeter, mAmperage, mVoltage, mInsulated, mCanShock); } @Override - public ITexture[] getTexture(IGregTechTileEntity aBaseMetaTileEntity, byte aSide, byte aConnections, byte aColorIndex, boolean aConnected, boolean aRedstone) { + public ITexture[] getTexture( + IGregTechTileEntity aBaseMetaTileEntity, + byte aSide, + byte aConnections, + byte aColorIndex, + boolean aConnected, + boolean aRedstone) { if (!mInsulated) - return new ITexture[]{TextureFactory.of(mMaterial.mIconSet.mTextures[TextureSet.INDEX_wire], Dyes.getModulation(aColorIndex, mMaterial.mRGBa) )}; + return new ITexture[] { + TextureFactory.of( + mMaterial.mIconSet.mTextures[TextureSet.INDEX_wire], + Dyes.getModulation(aColorIndex, mMaterial.mRGBa)) + }; if (aConnected) { float tThickNess = getThickNess(); if (tThickNess < 0.124F) - return new ITexture[]{TextureFactory.of(Textures.BlockIcons.INSULATION_FULL, Dyes.getModulation(aColorIndex, Dyes.CABLE_INSULATION.mRGBa))}; - if (tThickNess < 0.374F)//0.375 x1 - return new ITexture[]{TextureFactory.of(mMaterial.mIconSet.mTextures[TextureSet.INDEX_wire], mMaterial.mRGBa), TextureFactory.of(Textures.BlockIcons.INSULATION_TINY, Dyes.getModulation(aColorIndex, Dyes.CABLE_INSULATION.mRGBa))}; - if (tThickNess < 0.499F)//0.500 x2 - return new ITexture[]{TextureFactory.of(mMaterial.mIconSet.mTextures[TextureSet.INDEX_wire], mMaterial.mRGBa), TextureFactory.of(Textures.BlockIcons.INSULATION_SMALL, Dyes.getModulation(aColorIndex, Dyes.CABLE_INSULATION.mRGBa))}; - if (tThickNess < 0.624F)//0.625 x4 - return new ITexture[]{TextureFactory.of(mMaterial.mIconSet.mTextures[TextureSet.INDEX_wire], mMaterial.mRGBa), TextureFactory.of(Textures.BlockIcons.INSULATION_MEDIUM, Dyes.getModulation(aColorIndex, Dyes.CABLE_INSULATION.mRGBa))}; - if (tThickNess < 0.749F)//0.750 x8 - return new ITexture[]{TextureFactory.of(mMaterial.mIconSet.mTextures[TextureSet.INDEX_wire], mMaterial.mRGBa), TextureFactory.of(Textures.BlockIcons.INSULATION_MEDIUM_PLUS, Dyes.getModulation(aColorIndex, Dyes.CABLE_INSULATION.mRGBa))}; - if (tThickNess < 0.874F)//0.825 x12 - return new ITexture[]{TextureFactory.of(mMaterial.mIconSet.mTextures[TextureSet.INDEX_wire], mMaterial.mRGBa), TextureFactory.of(Textures.BlockIcons.INSULATION_LARGE, Dyes.getModulation(aColorIndex, Dyes.CABLE_INSULATION.mRGBa))}; - return new ITexture[]{TextureFactory.of(mMaterial.mIconSet.mTextures[TextureSet.INDEX_wire], mMaterial.mRGBa), TextureFactory.of(Textures.BlockIcons.INSULATION_HUGE, Dyes.getModulation(aColorIndex, Dyes.CABLE_INSULATION.mRGBa))}; + return new ITexture[] { + TextureFactory.of( + Textures.BlockIcons.INSULATION_FULL, + Dyes.getModulation(aColorIndex, Dyes.CABLE_INSULATION.mRGBa)) + }; + if (tThickNess < 0.374F) // 0.375 x1 + return new ITexture[] { + TextureFactory.of(mMaterial.mIconSet.mTextures[TextureSet.INDEX_wire], mMaterial.mRGBa), + TextureFactory.of( + Textures.BlockIcons.INSULATION_TINY, + Dyes.getModulation(aColorIndex, Dyes.CABLE_INSULATION.mRGBa)) + }; + if (tThickNess < 0.499F) // 0.500 x2 + return new ITexture[] { + TextureFactory.of(mMaterial.mIconSet.mTextures[TextureSet.INDEX_wire], mMaterial.mRGBa), + TextureFactory.of( + Textures.BlockIcons.INSULATION_SMALL, + Dyes.getModulation(aColorIndex, Dyes.CABLE_INSULATION.mRGBa)) + }; + if (tThickNess < 0.624F) // 0.625 x4 + return new ITexture[] { + TextureFactory.of(mMaterial.mIconSet.mTextures[TextureSet.INDEX_wire], mMaterial.mRGBa), + TextureFactory.of( + Textures.BlockIcons.INSULATION_MEDIUM, + Dyes.getModulation(aColorIndex, Dyes.CABLE_INSULATION.mRGBa)) + }; + if (tThickNess < 0.749F) // 0.750 x8 + return new ITexture[] { + TextureFactory.of(mMaterial.mIconSet.mTextures[TextureSet.INDEX_wire], mMaterial.mRGBa), + TextureFactory.of( + Textures.BlockIcons.INSULATION_MEDIUM_PLUS, + Dyes.getModulation(aColorIndex, Dyes.CABLE_INSULATION.mRGBa)) + }; + if (tThickNess < 0.874F) // 0.825 x12 + return new ITexture[] { + TextureFactory.of(mMaterial.mIconSet.mTextures[TextureSet.INDEX_wire], mMaterial.mRGBa), + TextureFactory.of( + Textures.BlockIcons.INSULATION_LARGE, + Dyes.getModulation(aColorIndex, Dyes.CABLE_INSULATION.mRGBa)) + }; + return new ITexture[] { + TextureFactory.of(mMaterial.mIconSet.mTextures[TextureSet.INDEX_wire], mMaterial.mRGBa), + TextureFactory.of( + Textures.BlockIcons.INSULATION_HUGE, + Dyes.getModulation(aColorIndex, Dyes.CABLE_INSULATION.mRGBa)) + }; } - return new ITexture[]{TextureFactory.of(Textures.BlockIcons.INSULATION_FULL, Dyes.getModulation(aColorIndex, Dyes.CABLE_INSULATION.mRGBa))}; + return new ITexture[] { + TextureFactory.of( + Textures.BlockIcons.INSULATION_FULL, Dyes.getModulation(aColorIndex, Dyes.CABLE_INSULATION.mRGBa)) + }; } @Override public void onEntityCollidedWithBlock(World aWorld, int aX, int aY, int aZ, Entity aEntity) { - if (mCanShock && (((BaseMetaPipeEntity) getBaseMetaTileEntity()).mConnections & -128) == 0 && aEntity instanceof EntityLivingBase && !isCoverOnSide((BaseMetaPipeEntity) getBaseMetaTileEntity(), (EntityLivingBase) aEntity)) - GT_Utility.applyElectricityDamage((EntityLivingBase) aEntity, mTransferredVoltageLast20, mTransferredAmperageLast20); + if (mCanShock + && (((BaseMetaPipeEntity) getBaseMetaTileEntity()).mConnections & -128) == 0 + && aEntity instanceof EntityLivingBase + && !isCoverOnSide((BaseMetaPipeEntity) getBaseMetaTileEntity(), (EntityLivingBase) aEntity)) + GT_Utility.applyElectricityDamage( + (EntityLivingBase) aEntity, mTransferredVoltageLast20, mTransferredAmperageLast20); } @Override @@ -158,34 +233,37 @@ 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().getCoverBehaviorAtSideNew(aSide).letsEnergyIn(aSide, getBaseMetaTileEntity().getCoverIDAtSide(aSide), getBaseMetaTileEntity().getComplexCoverDataAtSide(aSide), getBaseMetaTileEntity())) - return 0; + if (!isConnectedAtSide(aSide) && aSide != 6) return 0; + if (!getBaseMetaTileEntity() + .getCoverBehaviorAtSideNew(aSide) + .letsEnergyIn( + aSide, + getBaseMetaTileEntity().getCoverIDAtSide(aSide), + getBaseMetaTileEntity().getComplexCoverDataAtSide(aSide), + getBaseMetaTileEntity())) return 0; HashSet<TileEntity> nul = null; - return transferElectricity(aSide, aVoltage, aAmperage,nul); + return transferElectricity(aSide, aVoltage, aAmperage, nul); } @Override @Deprecated - public long transferElectricity(byte aSide, long aVoltage, long aAmperage, ArrayList<TileEntity> aAlreadyPassedTileEntityList) { + public long transferElectricity( + byte aSide, long aVoltage, long aAmperage, ArrayList<TileEntity> aAlreadyPassedTileEntityList) { return transferElectricity(aSide, aVoltage, aAmperage, new HashSet<>(aAlreadyPassedTileEntityList)); } @Override public long transferElectricity(byte aSide, long aVoltage, long aAmperage, HashSet<TileEntity> aAlreadyPassedSet) { if (!getBaseMetaTileEntity().isServerSide() || !isConnectedAtSide(aSide) && aSide != 6) return 0; - BaseMetaPipeEntity tBase =(BaseMetaPipeEntity) getBaseMetaTileEntity(); - if (!(tBase.getNode() instanceof PowerNode)) - return 0; - PowerNode tNode =(PowerNode) tBase.getNode(); + BaseMetaPipeEntity tBase = (BaseMetaPipeEntity) getBaseMetaTileEntity(); + if (!(tBase.getNode() instanceof PowerNode)) return 0; + PowerNode tNode = (PowerNode) tBase.getNode(); if (tNode != null) { int tPlace = 0; Node[] tToPower = new Node[tNode.mConsumers.size()]; if (tNode.mHadVoltage) { for (ConsumerNode consumer : tNode.mConsumers) { - if (consumer.needsEnergy()) - tToPower[tPlace++] = consumer; + if (consumer.needsEnergy()) tToPower[tPlace++] = consumer; } } else { tNode.mHadVoltage = true; @@ -193,35 +271,39 @@ public class GT_MetaPipeEntity_Cable extends MetaPipeEntity implements IMetaTile tToPower[tPlace++] = consumer; } } - return PowerNodes.powerNode(tNode,null,new NodeList(tToPower),(int)aVoltage,(int)aAmperage); + return PowerNodes.powerNode(tNode, null, new NodeList(tToPower), (int) aVoltage, (int) aAmperage); } return 0; } @Override public void onFirstTick(IGregTechTileEntity aBaseMetaTileEntity) { - if(aBaseMetaTileEntity.isServerSide()) { + 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 } } - @Override public void onPostTick(IGregTechTileEntity aBaseMetaTileEntity, long aTick) { super.onPostTick(aBaseMetaTileEntity, aTick); - if (aTick%20 == 0 && aBaseMetaTileEntity.isServerSide() && (!GT_Mod.gregtechproxy.gt6Cable || mCheckConnections)) { + if (aTick % 20 == 0 + && aBaseMetaTileEntity.isServerSide() + && (!GT_Mod.gregtechproxy.gt6Cable || mCheckConnections)) { checkConnections(); } } @Override - public boolean onWireCutterRightClick(byte aSide, byte aWrenchingSide, EntityPlayer aPlayer, float aX, float aY, float aZ) { - if (GT_Mod.gregtechproxy.gt6Cable && GT_ModHandler.damageOrDechargeItem(aPlayer.inventory.getCurrentItem(), 1, 500, aPlayer)) { - if(isConnectedAtSide(aWrenchingSide)) { + public boolean onWireCutterRightClick( + byte aSide, byte aWrenchingSide, EntityPlayer aPlayer, float aX, float aY, float aZ) { + if (GT_Mod.gregtechproxy.gt6Cable + && GT_ModHandler.damageOrDechargeItem(aPlayer.inventory.getCurrentItem(), 1, 500, aPlayer)) { + if (isConnectedAtSide(aWrenchingSide)) { disconnect(aWrenchingSide); GT_Utility.sendChatToPlayer(aPlayer, GT_Utility.trans("215", "Disconnected")); - }else if(!GT_Mod.gregtechproxy.costlyCableConnection){ + } else if (!GT_Mod.gregtechproxy.costlyCableConnection) { if (connect(aWrenchingSide) > 0) GT_Utility.sendChatToPlayer(aPlayer, GT_Utility.trans("214", "Connected")); } @@ -231,8 +313,10 @@ public class GT_MetaPipeEntity_Cable extends MetaPipeEntity implements IMetaTile } @Override - public boolean onSolderingToolRightClick(byte aSide, byte aWrenchingSide, EntityPlayer aPlayer, float aX, float aY, float aZ) { - if (GT_Mod.gregtechproxy.gt6Cable && GT_ModHandler.damageOrDechargeItem(aPlayer.inventory.getCurrentItem(), 1, 500, aPlayer)) { + public boolean onSolderingToolRightClick( + byte aSide, byte aWrenchingSide, EntityPlayer aPlayer, float aX, float aY, float aZ) { + if (GT_Mod.gregtechproxy.gt6Cable + && GT_ModHandler.damageOrDechargeItem(aPlayer.inventory.getCurrentItem(), 1, 500, aPlayer)) { if (isConnectedAtSide(aWrenchingSide)) { disconnect(aWrenchingSide); GT_Utility.sendChatToPlayer(aPlayer, GT_Utility.trans("215", "Disconnected")); @@ -246,26 +330,37 @@ public class GT_MetaPipeEntity_Cable extends MetaPipeEntity implements IMetaTile } @Override - public boolean letsIn(GT_CoverBehavior coverBehavior, byte aSide, int aCoverID, int aCoverVariable, ICoverable aTileEntity) { + public boolean letsIn( + GT_CoverBehavior coverBehavior, byte aSide, int aCoverID, int aCoverVariable, ICoverable aTileEntity) { return coverBehavior.letsEnergyIn(aSide, aCoverID, aCoverVariable, aTileEntity); } @Override - public boolean letsOut(GT_CoverBehavior coverBehavior, byte aSide, int aCoverID, int aCoverVariable, ICoverable aTileEntity) { + public boolean letsOut( + GT_CoverBehavior coverBehavior, byte aSide, int aCoverID, int aCoverVariable, ICoverable aTileEntity) { return coverBehavior.letsEnergyOut(aSide, aCoverID, aCoverVariable, aTileEntity); } @Override - public boolean letsIn(GT_CoverBehaviorBase<?> coverBehavior, byte aSide, int aCoverID, ISerializableObject aCoverVariable, ICoverable aTileEntity) { + public boolean letsIn( + GT_CoverBehaviorBase<?> coverBehavior, + byte aSide, + int aCoverID, + ISerializableObject aCoverVariable, + ICoverable aTileEntity) { return coverBehavior.letsEnergyIn(aSide, aCoverID, aCoverVariable, aTileEntity); } @Override - public boolean letsOut(GT_CoverBehaviorBase<?> coverBehavior, byte aSide, int aCoverID, ISerializableObject aCoverVariable, ICoverable aTileEntity) { + public boolean letsOut( + GT_CoverBehaviorBase<?> coverBehavior, + byte aSide, + int aCoverID, + ISerializableObject aCoverVariable, + ICoverable aTileEntity) { return coverBehavior.letsEnergyOut(aSide, aCoverID, aCoverVariable, aTileEntity); } - @Override public boolean canConnect(byte aSide, TileEntity tTileEntity) { final IGregTechTileEntity baseMetaTile = getBaseMetaTileEntity(); @@ -274,20 +369,21 @@ public class GT_MetaPipeEntity_Cable extends MetaPipeEntity implements IMetaTile final ForgeDirection tDir = ForgeDirection.getOrientation(tSide); // GT Machine handling - if ((tTileEntity instanceof IEnergyConnected) && - (((IEnergyConnected) tTileEntity).inputEnergyFrom(tSide, false) || ((IEnergyConnected) tTileEntity).outputsEnergyTo(tSide, false))) - return true; + if ((tTileEntity instanceof IEnergyConnected) + && (((IEnergyConnected) tTileEntity).inputEnergyFrom(tSide, false) + || ((IEnergyConnected) tTileEntity).outputsEnergyTo(tSide, false))) return true; // Solar Panel Compat if (coverBehavior instanceof GT_Cover_SolarPanel) return true; - // ((tIsGregTechTileEntity && tIsTileEntityCable) && (tAlwaysLookConnected || tLetEnergyIn || tLetEnergyOut) ) --> Not needed - if (Loader.isModLoaded("GalacticraftCore") && GT_GC_Compat.canConnect(tTileEntity,tDir)) - return true; + // ((tIsGregTechTileEntity && tIsTileEntityCable) && (tAlwaysLookConnected || tLetEnergyIn || tLetEnergyOut) ) + // --> Not needed + if (Loader.isModLoaded("GalacticraftCore") && GT_GC_Compat.canConnect(tTileEntity, tDir)) return true; // AE2-p2p Compat if (GT_Mod.gregtechproxy.mAE2Integration) { - if (tTileEntity instanceof appeng.tile.powersink.IC2 && ((appeng.tile.powersink.IC2)tTileEntity).acceptsEnergyFrom((TileEntity)baseMetaTile, tDir)) + if (tTileEntity instanceof appeng.tile.powersink.IC2 + && ((appeng.tile.powersink.IC2) tTileEntity).acceptsEnergyFrom((TileEntity) baseMetaTile, tDir)) return true; } @@ -298,12 +394,14 @@ public class GT_MetaPipeEntity_Cable extends MetaPipeEntity implements IMetaTile if (tTileEntity instanceof IReactorChamber) ic2Energy = (TileEntity) ((IReactorChamber) tTileEntity).getReactor(); else - ic2Energy = (tTileEntity == null || tTileEntity instanceof IEnergyTile || EnergyNet.instance == null) ? tTileEntity : - EnergyNet.instance.getTileEntity(tTileEntity.getWorldObj(), tTileEntity.xCoord, tTileEntity.yCoord, tTileEntity.zCoord); + ic2Energy = (tTileEntity == null || tTileEntity instanceof IEnergyTile || EnergyNet.instance == null) + ? tTileEntity + : EnergyNet.instance.getTileEntity( + tTileEntity.getWorldObj(), tTileEntity.xCoord, tTileEntity.yCoord, tTileEntity.zCoord); // IC2 Sink Compat - if ((ic2Energy instanceof IEnergySink) && ((IEnergySink) ic2Energy).acceptsEnergyFrom((TileEntity) baseMetaTile, tDir)) - return true; + if ((ic2Energy instanceof IEnergySink) + && ((IEnergySink) ic2Energy).acceptsEnergyFrom((TileEntity) baseMetaTile, tDir)) return true; // IC2 Source Compat if (GT_Mod.gregtechproxy.ic2EnergySourceCompat && (ic2Energy instanceof IEnergySource)) { @@ -313,11 +411,14 @@ public class GT_MetaPipeEntity_Cable extends MetaPipeEntity implements IMetaTile } } // RF Output Compat - if (GregTech_API.mOutputRF && tTileEntity instanceof IEnergyReceiver && ((IEnergyReceiver) tTileEntity).canConnectEnergy(tDir)) - return true; + if (GregTech_API.mOutputRF + && tTileEntity instanceof IEnergyReceiver + && ((IEnergyReceiver) tTileEntity).canConnectEnergy(tDir)) return true; // RF Input Compat - return GregTech_API.mInputRF && (tTileEntity instanceof IEnergyEmitter && ((IEnergyEmitter) tTileEntity).emitsEnergyTo((TileEntity) baseMetaTile, tDir)); + return GregTech_API.mInputRF + && (tTileEntity instanceof IEnergyEmitter + && ((IEnergyEmitter) tTileEntity).emitsEnergyTo((TileEntity) baseMetaTile, tDir)); } @Override @@ -326,7 +427,6 @@ public class GT_MetaPipeEntity_Cable extends MetaPipeEntity implements IMetaTile return GT_Mod.gregtechproxy.gt6Cable; } - @Override public boolean allowPullStack(IGregTechTileEntity aBaseMetaTileEntity, int aIndex, byte aSide, ItemStack aStack) { return false; @@ -339,29 +439,32 @@ public class GT_MetaPipeEntity_Cable extends MetaPipeEntity implements IMetaTile @Override public String[] getDescription() { - return new String[]{ - "Max Voltage: %%%" + EnumChatFormatting.GREEN + GT_Utility.formatNumbers(mVoltage) + " (" + GT_Values.TIER_COLORS[GT_Utility.getTier(mVoltage)] + VN[GT_Utility.getTier(mVoltage)] + EnumChatFormatting.GREEN + ")" + EnumChatFormatting.GRAY, - "Max Amperage: %%%" + EnumChatFormatting.YELLOW + GT_Utility.formatNumbers(mAmperage) + EnumChatFormatting.GRAY, - "Loss/Meter/Ampere: %%%" + EnumChatFormatting.RED + GT_Utility.formatNumbers(mCableLossPerMeter) + EnumChatFormatting.GRAY + "%%% EU-Volt" + return new String[] { + "Max Voltage: %%%" + EnumChatFormatting.GREEN + GT_Utility.formatNumbers(mVoltage) + " (" + + GT_Values.TIER_COLORS[GT_Utility.getTier(mVoltage)] + VN[GT_Utility.getTier(mVoltage)] + + EnumChatFormatting.GREEN + ")" + EnumChatFormatting.GRAY, + "Max Amperage: %%%" + EnumChatFormatting.YELLOW + GT_Utility.formatNumbers(mAmperage) + + EnumChatFormatting.GRAY, + "Loss/Meter/Ampere: %%%" + EnumChatFormatting.RED + GT_Utility.formatNumbers(mCableLossPerMeter) + + EnumChatFormatting.GRAY + "%%% EU-Volt" }; } @Override public float getThickNess() { - if(GT_Mod.instance.isClientSide() && (GT_Client.hideValue & 0x1) != 0) return 0.0625F; + if (GT_Mod.instance.isClientSide() && (GT_Client.hideValue & 0x1) != 0) return 0.0625F; return mThickNess; } @Override public void saveNBTData(NBTTagCompound aNBT) { - if (GT_Mod.gregtechproxy.gt6Cable) - aNBT.setByte("mConnections", mConnections); + if (GT_Mod.gregtechproxy.gt6Cable) aNBT.setByte("mConnections", mConnections); } @Override public void loadNBTData(NBTTagCompound aNBT) { if (GT_Mod.gregtechproxy.gt6Cable) { - mConnections = aNBT.getByte("mConnections"); + mConnections = aNBT.getByte("mConnections"); } } @@ -373,73 +476,98 @@ public class GT_MetaPipeEntity_Cable extends MetaPipeEntity implements IMetaTile @Override public String[] getInfoData() { BaseMetaPipeEntity base = (BaseMetaPipeEntity) getBaseMetaTileEntity(); - PowerNodePath path =(PowerNodePath) base.getNodePath(); + PowerNodePath path = (PowerNodePath) base.getNodePath(); long amps = 0; long volts = 0; if (path != null) { amps = path.getAmps(); volts = path.getVoltage(this); } - return new String[]{ - //EnumChatFormatting.BLUE + mName + EnumChatFormatting.RESET, - "Heat: " + - EnumChatFormatting.RED + GT_Utility.formatNumbers(mOverheat) + EnumChatFormatting.RESET + " / " + - EnumChatFormatting.YELLOW + GT_Utility.formatNumbers(mMaxOverheat) + EnumChatFormatting.RESET, - "Max Load (1t):", - EnumChatFormatting.GREEN + GT_Utility.formatNumbers(amps) + EnumChatFormatting.RESET + " A / " + - EnumChatFormatting.YELLOW + GT_Utility.formatNumbers(mAmperage) + EnumChatFormatting.RESET + " A", - "Max EU/p (1t):", - EnumChatFormatting.GREEN + GT_Utility.formatNumbers(volts) + EnumChatFormatting.RESET + " EU / " + - EnumChatFormatting.YELLOW + GT_Utility.formatNumbers(mVoltage) + EnumChatFormatting.RESET + " EU", - "Max Load (20t): " + - EnumChatFormatting.GREEN + GT_Utility.formatNumbers(mTransferredAmperageLast20OK) + EnumChatFormatting.RESET + " A", - "Max EU/p (20t): " + - EnumChatFormatting.GREEN + GT_Utility.formatNumbers(mTransferredVoltageLast20OK) + EnumChatFormatting.RESET + " EU" + return new String[] { + // EnumChatFormatting.BLUE + mName + EnumChatFormatting.RESET, + "Heat: " + EnumChatFormatting.RED + + GT_Utility.formatNumbers(mOverheat) + EnumChatFormatting.RESET + " / " + EnumChatFormatting.YELLOW + + GT_Utility.formatNumbers(mMaxOverheat) + EnumChatFormatting.RESET, + "Max Load (1t):", + EnumChatFormatting.GREEN + GT_Utility.formatNumbers(amps) + EnumChatFormatting.RESET + " A / " + + EnumChatFormatting.YELLOW + GT_Utility.formatNumbers(mAmperage) + EnumChatFormatting.RESET + " A", + "Max EU/p (1t):", + EnumChatFormatting.GREEN + GT_Utility.formatNumbers(volts) + EnumChatFormatting.RESET + " EU / " + + EnumChatFormatting.YELLOW + GT_Utility.formatNumbers(mVoltage) + EnumChatFormatting.RESET + " EU", + "Max Load (20t): " + EnumChatFormatting.GREEN + GT_Utility.formatNumbers(mTransferredAmperageLast20OK) + + EnumChatFormatting.RESET + " A", + "Max EU/p (20t): " + EnumChatFormatting.GREEN + GT_Utility.formatNumbers(mTransferredVoltageLast20OK) + + EnumChatFormatting.RESET + " EU" }; } @Override public AxisAlignedBB getCollisionBoundingBoxFromPool(World aWorld, int aX, int aY, int aZ) { - if (GT_Mod.instance.isClientSide() && (GT_Client.hideValue & 0x2) != 0) - return AxisAlignedBB.getBoundingBox(aX, aY, aZ, aX + 1, aY + 1, aZ + 1); - else - return getActualCollisionBoundingBoxFromPool(aWorld, aX, aY, aZ); + if (GT_Mod.instance.isClientSide() && (GT_Client.hideValue & 0x2) != 0) + return AxisAlignedBB.getBoundingBox(aX, aY, aZ, aX + 1, aY + 1, aZ + 1); + else return getActualCollisionBoundingBoxFromPool(aWorld, aX, aY, aZ); } private AxisAlignedBB getActualCollisionBoundingBoxFromPool(World aWorld, int aX, int aY, int aZ) { - float tSpace = (1f - mThickNess)/2; - float tSide0 = tSpace; - float tSide1 = 1f - tSpace; - float tSide2 = tSpace; - float tSide3 = 1f - tSpace; - float tSide4 = tSpace; - float tSide5 = 1f - tSpace; - - if(getBaseMetaTileEntity().getCoverIDAtSide((byte) 0) != 0){tSide0=tSide2=tSide4=0;tSide3=tSide5=1;} - if(getBaseMetaTileEntity().getCoverIDAtSide((byte) 1) != 0){tSide2=tSide4=0;tSide1=tSide3=tSide5=1;} - if(getBaseMetaTileEntity().getCoverIDAtSide((byte) 2) != 0){tSide0=tSide2=tSide4=0;tSide1=tSide5=1;} - if(getBaseMetaTileEntity().getCoverIDAtSide((byte) 3) != 0){tSide0=tSide4=0;tSide1=tSide3=tSide5=1;} - if(getBaseMetaTileEntity().getCoverIDAtSide((byte) 4) != 0){tSide0=tSide2=tSide4=0;tSide1=tSide3=1;} - if(getBaseMetaTileEntity().getCoverIDAtSide((byte) 5) != 0){tSide0=tSide2=0;tSide1=tSide3=tSide5=1;} - - byte tConn = ((BaseMetaPipeEntity) getBaseMetaTileEntity()).mConnections; - if((tConn & (1 << ForgeDirection.DOWN.ordinal()) ) != 0) tSide0 = 0f; - if((tConn & (1 << ForgeDirection.UP.ordinal()) ) != 0) tSide1 = 1f; - if((tConn & (1 << ForgeDirection.NORTH.ordinal())) != 0) tSide2 = 0f; - if((tConn & (1 << ForgeDirection.SOUTH.ordinal())) != 0) tSide3 = 1f; - 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); - } + float tSpace = (1f - mThickNess) / 2; + float tSide0 = tSpace; + float tSide1 = 1f - tSpace; + float tSide2 = tSpace; + float tSide3 = 1f - tSpace; + float tSide4 = tSpace; + float tSide5 = 1f - tSpace; + + if (getBaseMetaTileEntity().getCoverIDAtSide((byte) 0) != 0) { + tSide0 = tSide2 = tSide4 = 0; + tSide3 = tSide5 = 1; + } + if (getBaseMetaTileEntity().getCoverIDAtSide((byte) 1) != 0) { + tSide2 = tSide4 = 0; + tSide1 = tSide3 = tSide5 = 1; + } + if (getBaseMetaTileEntity().getCoverIDAtSide((byte) 2) != 0) { + tSide0 = tSide2 = tSide4 = 0; + tSide1 = tSide5 = 1; + } + if (getBaseMetaTileEntity().getCoverIDAtSide((byte) 3) != 0) { + tSide0 = tSide4 = 0; + tSide1 = tSide3 = tSide5 = 1; + } + if (getBaseMetaTileEntity().getCoverIDAtSide((byte) 4) != 0) { + tSide0 = tSide2 = tSide4 = 0; + tSide1 = tSide3 = 1; + } + if (getBaseMetaTileEntity().getCoverIDAtSide((byte) 5) != 0) { + tSide0 = tSide2 = 0; + tSide1 = tSide3 = tSide5 = 1; + } - @Override - public void addCollisionBoxesToList(World aWorld, int aX, int aY, int aZ, AxisAlignedBB inputAABB, List<AxisAlignedBB> outputAABB, Entity collider) { - super.addCollisionBoxesToList(aWorld, aX, aY, aZ, inputAABB, outputAABB, collider); - if (GT_Mod.instance.isClientSide() && (GT_Client.hideValue & 0x2) != 0) { - AxisAlignedBB aabb = getActualCollisionBoundingBoxFromPool(aWorld, aX, aY, aZ); - if (inputAABB.intersectsWith(aabb)) outputAABB.add(aabb); - } + byte tConn = ((BaseMetaPipeEntity) getBaseMetaTileEntity()).mConnections; + if ((tConn & (1 << ForgeDirection.DOWN.ordinal())) != 0) tSide0 = 0f; + if ((tConn & (1 << ForgeDirection.UP.ordinal())) != 0) tSide1 = 1f; + if ((tConn & (1 << ForgeDirection.NORTH.ordinal())) != 0) tSide2 = 0f; + if ((tConn & (1 << ForgeDirection.SOUTH.ordinal())) != 0) tSide3 = 1f; + 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); + } + + @Override + public void addCollisionBoxesToList( + World aWorld, + int aX, + int aY, + int aZ, + AxisAlignedBB inputAABB, + List<AxisAlignedBB> outputAABB, + Entity collider) { + super.addCollisionBoxesToList(aWorld, aX, aY, aZ, inputAABB, outputAABB, collider); + if (GT_Mod.instance.isClientSide() && (GT_Client.hideValue & 0x2) != 0) { + AxisAlignedBB aabb = getActualCollisionBoundingBoxFromPool(aWorld, aX, aY, aZ); + if (inputAABB.intersectsWith(aabb)) outputAABB.add(aabb); + } } @Override @@ -448,15 +576,20 @@ public class GT_MetaPipeEntity_Cable extends MetaPipeEntity implements IMetaTile if (mConnections != 0) { final IGregTechTileEntity baseMeta = getBaseMetaTileEntity(); - for( byte aSide = 0 ; aSide < 6 ; aSide++) if(isConnectedAtSide(aSide)) { - final TileEntity tTileEntity = baseMeta.getTileEntityAtSide(aSide); - final TileEntity tEmitter = (tTileEntity == null || tTileEntity instanceof IEnergyTile || EnergyNet.instance == null) ? tTileEntity : - EnergyNet.instance.getTileEntity(tTileEntity.getWorldObj(), tTileEntity.xCoord, tTileEntity.yCoord, tTileEntity.zCoord); - - if (tEmitter instanceof IEnergyEmitter) - return true; - - } + for (byte aSide = 0; aSide < 6; aSide++) + if (isConnectedAtSide(aSide)) { + final TileEntity tTileEntity = baseMeta.getTileEntityAtSide(aSide); + final TileEntity tEmitter = + (tTileEntity == null || tTileEntity instanceof IEnergyTile || EnergyNet.instance == null) + ? tTileEntity + : EnergyNet.instance.getTileEntity( + tTileEntity.getWorldObj(), + tTileEntity.xCoord, + tTileEntity.yCoord, + tTileEntity.zCoord); + + if (tEmitter instanceof IEnergyEmitter) return true; + } } return false; } @@ -471,7 +604,8 @@ public class GT_MetaPipeEntity_Cable extends MetaPipeEntity implements IMetaTile if (coverBehavior instanceof GT_Cover_None) continue; final int coverId = pipe.getCoverIDAtSide(i); ISerializableObject coverData = pipe.getComplexCoverDataAtSide(i); - if (!letsIn(coverBehavior, i, coverId, coverData, pipe) || !letsOut(coverBehavior, i, coverId, coverData, pipe)) { + if (!letsIn(coverBehavior, i, coverId, coverData, pipe) + || !letsOut(coverBehavior, i, coverId, coverData, pipe)) { pipe.addToLock(pipe, i); } else { pipe.removeFromLock(pipe, i); @@ -486,7 +620,8 @@ public class GT_MetaPipeEntity_Cable extends MetaPipeEntity implements IMetaTile if (coverBehavior instanceof GT_Cover_None) continue; final int coverId = pipe.getCoverIDAtSide(i); ISerializableObject coverData = pipe.getComplexCoverDataAtSide(i); - if (!letsIn(coverBehavior, i, coverId, coverData, pipe) || !letsOut(coverBehavior, i, coverId, coverData, pipe)) { + if (!letsIn(coverBehavior, i, coverId, coverData, pipe) + || !letsOut(coverBehavior, i, coverId, coverData, pipe)) { dontAllow = true; } } 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 5f91c2acd1..d25f92b58b 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 @@ -1,10 +1,13 @@ package gregtech.api.metatileentity.implementations; +import static gregtech.api.enums.GT_Values.D1; +import static gregtech.api.objects.XSTR.XSTR_INSTANCE; + import cpw.mods.fml.common.Optional; import gregtech.GT_Mod; import gregtech.api.GregTech_API; -import gregtech.api.enums.ParticleFX; import gregtech.api.enums.*; +import gregtech.api.enums.ParticleFX; import gregtech.api.interfaces.ITexture; import gregtech.api.interfaces.metatileentity.IMetaTileEntity; import gregtech.api.interfaces.tileentity.ICoverable; @@ -17,6 +20,8 @@ import gregtech.api.util.WorldSpawnedEventBuilder.ParticleEventBuilder; import gregtech.common.GT_Client; import gregtech.common.covers.GT_Cover_Drain; import gregtech.common.covers.GT_Cover_FluidRegulator; +import java.util.ArrayList; +import java.util.List; import net.minecraft.entity.Entity; import net.minecraft.entity.EntityLivingBase; import net.minecraft.entity.player.EntityPlayer; @@ -32,12 +37,6 @@ import net.minecraftforge.fluids.FluidTankInfo; import net.minecraftforge.fluids.IFluidHandler; import org.apache.commons.lang3.tuple.MutableTriple; -import java.util.ArrayList; -import java.util.List; - -import static gregtech.api.enums.GT_Values.D1; -import static gregtech.api.objects.XSTR.XSTR_INSTANCE; - public class GT_MetaPipeEntity_Fluid extends MetaPipeEntity { public final float mThickNess; public final Materials mMaterial; @@ -50,11 +49,28 @@ public class GT_MetaPipeEntity_Fluid extends MetaPipeEntity { */ public byte mDisableInput = 0; - public GT_MetaPipeEntity_Fluid(int aID, String aName, String aNameRegional, float aThickNess, Materials aMaterial, int aCapacity, int aHeatResistance, boolean aGasProof) { + public GT_MetaPipeEntity_Fluid( + int aID, + String aName, + String aNameRegional, + float aThickNess, + Materials aMaterial, + int aCapacity, + int aHeatResistance, + boolean aGasProof) { this(aID, aName, aNameRegional, aThickNess, aMaterial, aCapacity, aHeatResistance, aGasProof, 1); } - public GT_MetaPipeEntity_Fluid(int aID, String aName, String aNameRegional, float aThickNess, Materials aMaterial, int aCapacity, int aHeatResistance, boolean aGasProof, int aFluidTypes) { + public GT_MetaPipeEntity_Fluid( + int aID, + String aName, + String aNameRegional, + float aThickNess, + Materials aMaterial, + int aCapacity, + int aHeatResistance, + boolean aGasProof, + int aFluidTypes) { super(aID, aName, aNameRegional, 0, false); mThickNess = aThickNess; mMaterial = aMaterial; @@ -67,11 +83,24 @@ public class GT_MetaPipeEntity_Fluid extends MetaPipeEntity { } @Deprecated - public GT_MetaPipeEntity_Fluid(String aName, float aThickNess, Materials aMaterial, int aCapacity, int aHeatResistance, boolean aGasProof) { + public GT_MetaPipeEntity_Fluid( + String aName, + float aThickNess, + Materials aMaterial, + int aCapacity, + int aHeatResistance, + boolean aGasProof) { this(aName, aThickNess, aMaterial, aCapacity, aHeatResistance, aGasProof, 1); } - public GT_MetaPipeEntity_Fluid(String aName, float aThickNess, Materials aMaterial, int aCapacity, int aHeatResistance, boolean aGasProof, int aFluidTypes) { + public GT_MetaPipeEntity_Fluid( + String aName, + float aThickNess, + Materials aMaterial, + int aCapacity, + int aHeatResistance, + boolean aGasProof, + int aFluidTypes) { super(aName, 0); mThickNess = aThickNess; mMaterial = aMaterial; @@ -89,14 +118,27 @@ public class GT_MetaPipeEntity_Fluid extends MetaPipeEntity { @Override public IMetaTileEntity newMetaEntity(IGregTechTileEntity aTileEntity) { - return new GT_MetaPipeEntity_Fluid(mName, mThickNess, mMaterial, mCapacity, mHeatResistance, mGasProof, mPipeAmount); + return new GT_MetaPipeEntity_Fluid( + mName, mThickNess, mMaterial, mCapacity, mHeatResistance, mGasProof, mPipeAmount); } @Override - public ITexture[] getTexture(IGregTechTileEntity aBaseMetaTileEntity, byte aSide, byte aConnections, byte aColorIndex, boolean aConnected, boolean aRedstone) { + public ITexture[] getTexture( + IGregTechTileEntity aBaseMetaTileEntity, + byte aSide, + byte aConnections, + byte aColorIndex, + boolean aConnected, + boolean aRedstone) { float tThickNess = getThickNess(); if (mDisableInput == 0) - return new ITexture[]{aConnected ? getBaseTexture(tThickNess, mPipeAmount, mMaterial, aColorIndex) : TextureFactory.of(mMaterial.mIconSet.mTextures[OrePrefixes.pipe.mTextureIndex], Dyes.getModulation(aColorIndex, mMaterial.mRGBa))}; + return new ITexture[] { + aConnected + ? getBaseTexture(tThickNess, mPipeAmount, mMaterial, aColorIndex) + : TextureFactory.of( + mMaterial.mIconSet.mTextures[OrePrefixes.pipe.mTextureIndex], + Dyes.getModulation(aColorIndex, mMaterial.mRGBa)) + }; byte tMask = 0; byte[][] sRestrictionArray = { {2, 3, 5, 4}, @@ -108,30 +150,51 @@ public class GT_MetaPipeEntity_Fluid extends MetaPipeEntity { }; if (aSide >= 0 && aSide < 6) { for (byte i = 0; i < 4; i++) if (isInputDisabledAtSide(sRestrictionArray[aSide][i])) tMask |= 1 << i; - //Full block size renderer flips side 5 and 2 textures, flip restrictor textures to compensate - if (aSide == 5 || aSide == 2) - if (tMask > 3 && tMask < 12) - tMask = (byte) (tMask ^ 12); - } - return new ITexture[]{aConnected ? getBaseTexture(tThickNess, mPipeAmount, mMaterial, aColorIndex) : TextureFactory.of(mMaterial.mIconSet.mTextures[OrePrefixes.pipe.mTextureIndex], Dyes.getModulation(aColorIndex, mMaterial.mRGBa)), getRestrictorTexture(tMask)}; + // Full block size renderer flips side 5 and 2 textures, flip restrictor textures to compensate + if (aSide == 5 || aSide == 2) if (tMask > 3 && tMask < 12) tMask = (byte) (tMask ^ 12); + } + return new ITexture[] { + aConnected + ? getBaseTexture(tThickNess, mPipeAmount, mMaterial, aColorIndex) + : TextureFactory.of( + mMaterial.mIconSet.mTextures[OrePrefixes.pipe.mTextureIndex], + Dyes.getModulation(aColorIndex, mMaterial.mRGBa)), + getRestrictorTexture(tMask) + }; } protected static ITexture getBaseTexture(float aThickNess, int aPipeAmount, Materials aMaterial, byte aColorIndex) { if (aPipeAmount >= 9) - return TextureFactory.of(aMaterial.mIconSet.mTextures[OrePrefixes.pipeNonuple.mTextureIndex], Dyes.getModulation(aColorIndex, aMaterial.mRGBa)); + return TextureFactory.of( + aMaterial.mIconSet.mTextures[OrePrefixes.pipeNonuple.mTextureIndex], + Dyes.getModulation(aColorIndex, aMaterial.mRGBa)); if (aPipeAmount >= 4) - return TextureFactory.of(aMaterial.mIconSet.mTextures[OrePrefixes.pipeQuadruple.mTextureIndex], Dyes.getModulation(aColorIndex, aMaterial.mRGBa)); + return TextureFactory.of( + aMaterial.mIconSet.mTextures[OrePrefixes.pipeQuadruple.mTextureIndex], + Dyes.getModulation(aColorIndex, aMaterial.mRGBa)); if (aThickNess < 0.124F) - return TextureFactory.of(aMaterial.mIconSet.mTextures[OrePrefixes.pipe.mTextureIndex], Dyes.getModulation(aColorIndex, aMaterial.mRGBa)); + return TextureFactory.of( + aMaterial.mIconSet.mTextures[OrePrefixes.pipe.mTextureIndex], + Dyes.getModulation(aColorIndex, aMaterial.mRGBa)); if (aThickNess < 0.374F) - return TextureFactory.of(aMaterial.mIconSet.mTextures[OrePrefixes.pipeTiny.mTextureIndex], Dyes.getModulation(aColorIndex, aMaterial.mRGBa)); + return TextureFactory.of( + aMaterial.mIconSet.mTextures[OrePrefixes.pipeTiny.mTextureIndex], + Dyes.getModulation(aColorIndex, aMaterial.mRGBa)); if (aThickNess < 0.499F) - return TextureFactory.of(aMaterial.mIconSet.mTextures[OrePrefixes.pipeSmall.mTextureIndex], Dyes.getModulation(aColorIndex, aMaterial.mRGBa)); + return TextureFactory.of( + aMaterial.mIconSet.mTextures[OrePrefixes.pipeSmall.mTextureIndex], + Dyes.getModulation(aColorIndex, aMaterial.mRGBa)); if (aThickNess < 0.749F) - return TextureFactory.of(aMaterial.mIconSet.mTextures[OrePrefixes.pipeMedium.mTextureIndex], Dyes.getModulation(aColorIndex, aMaterial.mRGBa)); + return TextureFactory.of( + aMaterial.mIconSet.mTextures[OrePrefixes.pipeMedium.mTextureIndex], + Dyes.getModulation(aColorIndex, aMaterial.mRGBa)); if (aThickNess < 0.874F) - return TextureFactory.of(aMaterial.mIconSet.mTextures[OrePrefixes.pipeLarge.mTextureIndex], Dyes.getModulation(aColorIndex, aMaterial.mRGBa)); - return TextureFactory.of(aMaterial.mIconSet.mTextures[OrePrefixes.pipeHuge.mTextureIndex], Dyes.getModulation(aColorIndex, aMaterial.mRGBa)); + return TextureFactory.of( + aMaterial.mIconSet.mTextures[OrePrefixes.pipeLarge.mTextureIndex], + Dyes.getModulation(aColorIndex, aMaterial.mRGBa)); + return TextureFactory.of( + aMaterial.mIconSet.mTextures[OrePrefixes.pipeHuge.mTextureIndex], + Dyes.getModulation(aColorIndex, aMaterial.mRGBa)); } protected static ITexture getRestrictorTexture(byte aMask) { @@ -236,14 +299,19 @@ public class GT_MetaPipeEntity_Fluid extends MetaPipeEntity { @Override public void onEntityCollidedWithBlock(World aWorld, int aX, int aY, int aZ, Entity aEntity) { - if ((((BaseMetaPipeEntity) getBaseMetaTileEntity()).mConnections & -128) == 0 && aEntity instanceof EntityLivingBase) { + if ((((BaseMetaPipeEntity) getBaseMetaTileEntity()).mConnections & -128) == 0 + && aEntity instanceof EntityLivingBase) { for (FluidStack tFluid : mFluids) { if (tFluid != null) { int tTemperature = tFluid.getFluid().getTemperature(tFluid); - if (tTemperature > 320 && !isCoverOnSide((BaseMetaPipeEntity) getBaseMetaTileEntity(), (EntityLivingBase) aEntity)) { + if (tTemperature > 320 + && !isCoverOnSide( + (BaseMetaPipeEntity) getBaseMetaTileEntity(), (EntityLivingBase) aEntity)) { GT_Utility.applyHeatDamage((EntityLivingBase) aEntity, (tTemperature - 300) / 50.0F); break; - } else if (tTemperature < 260 && !isCoverOnSide((BaseMetaPipeEntity) getBaseMetaTileEntity(), (EntityLivingBase) aEntity)) { + } else if (tTemperature < 260 + && !isCoverOnSide( + (BaseMetaPipeEntity) getBaseMetaTileEntity(), (EntityLivingBase) aEntity)) { GT_Utility.applyFrostDamage((EntityLivingBase) aEntity, (270 - tTemperature) / 25.0F); break; } @@ -278,7 +346,6 @@ public class GT_MetaPipeEntity_Fluid extends MetaPipeEntity { } oLastReceivedFrom = mLastReceivedFrom; - } } @@ -291,21 +358,36 @@ public class GT_MetaPipeEntity_Fluid extends MetaPipeEntity { if (tTemperature > mHeatResistance) { if (aBaseMetaTileEntity.getRandomNumber(100) == 0) { // Poof - GT_Log.exp.println("Set Pipe to Fire due to to low heat resistance at " + aBaseMetaTileEntity.getXCoord() + " | " + aBaseMetaTileEntity.getYCoord() + " | " + aBaseMetaTileEntity.getZCoord() + " DIMID: " + aBaseMetaTileEntity.getWorld().provider.dimensionId); + GT_Log.exp.println( + "Set Pipe to Fire due to to low heat resistance at " + aBaseMetaTileEntity.getXCoord() + + " | " + aBaseMetaTileEntity.getYCoord() + " | " + aBaseMetaTileEntity.getZCoord() + + " DIMID: " + aBaseMetaTileEntity.getWorld().provider.dimensionId); aBaseMetaTileEntity.setToFire(); return true; } // Mmhmm, Fire aBaseMetaTileEntity.setOnFire(); - GT_Log.exp.println("Set Blocks around Pipe to Fire due to to low heat resistance at " + aBaseMetaTileEntity.getXCoord() + " | " + aBaseMetaTileEntity.getYCoord() + " | " + aBaseMetaTileEntity.getZCoord() + " DIMID: " + aBaseMetaTileEntity.getWorld().provider.dimensionId); - + GT_Log.exp.println("Set Blocks around Pipe to Fire due to to low heat resistance at " + + aBaseMetaTileEntity.getXCoord() + " | " + aBaseMetaTileEntity.getYCoord() + " | " + + aBaseMetaTileEntity.getZCoord() + " DIMID: " + + aBaseMetaTileEntity.getWorld().provider.dimensionId); } 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))) { + 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))) { GT_Utility.applyHeatDamage(tLiving, (tTemperature - 300) / 25.0F); } } catch (Throwable e) { @@ -313,7 +395,17 @@ 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))) { + 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))) { GT_Utility.applyFrostDamage(tLiving, (270 - tTemperature) / 12.5F); } } catch (Throwable e) { @@ -341,9 +433,25 @@ public class GT_MetaPipeEntity_Fluid extends MetaPipeEntity { final IFluidHandler tTank = aBaseMetaTileEntity.getITankContainerAtSide(aSide); final IGregTechTileEntity gTank = tTank instanceof IGregTechTileEntity ? (IGregTechTileEntity) tTank : null; - if (isConnectedAtSide(aSide) && tTank != null && (mLastReceivedFrom & (1 << aSide)) == 0 && - getBaseMetaTileEntity().getCoverBehaviorAtSideNew(aSide).letsFluidOut(aSide, getBaseMetaTileEntity().getCoverIDAtSide(aSide), getBaseMetaTileEntity().getComplexCoverDataAtSide(aSide), tFluid.getFluid(), getBaseMetaTileEntity()) && - (gTank == null || gTank.getCoverBehaviorAtSideNew(tSide).letsFluidIn(tSide, gTank.getCoverIDAtSide(tSide), gTank.getComplexCoverDataAtSide(tSide), tFluid.getFluid(), gTank))) { + if (isConnectedAtSide(aSide) + && tTank != null + && (mLastReceivedFrom & (1 << aSide)) == 0 + && getBaseMetaTileEntity() + .getCoverBehaviorAtSideNew(aSide) + .letsFluidOut( + aSide, + getBaseMetaTileEntity().getCoverIDAtSide(aSide), + getBaseMetaTileEntity().getComplexCoverDataAtSide(aSide), + tFluid.getFluid(), + getBaseMetaTileEntity()) + && (gTank == null + || gTank.getCoverBehaviorAtSideNew(tSide) + .letsFluidIn( + tSide, + gTank.getCoverIDAtSide(tSide), + gTank.getComplexCoverDataAtSide(tSide), + tFluid.getFluid(), + gTank))) { if (tTank.fill(ForgeDirection.getOrientation(tSide), tFluid, false) > 0) { tTanks.add(new MutableTriple<>(tTank, ForgeDirection.getOrientation(tSide), 0)); } @@ -366,9 +474,12 @@ public class GT_MetaPipeEntity_Fluid extends MetaPipeEntity { // Now distribute for (MutableTriple<IFluidHandler, ForgeDirection, Integer> tEntry : tTanks) { if (availableCapacity > tAmount) - tEntry.right = (int) Math.floor(tEntry.right * tAmount / availableCapacity); // Distribue fluids based on percentage available space at destination + tEntry.right = (int) Math.floor(tEntry.right + * tAmount + / availableCapacity); // Distribue fluids based on percentage available space at destination if (tEntry.right == 0) - tEntry.right = (int) Math.min(1, tAmount); // If the percent is not enough to give at least 1L, try to give 1L + tEntry.right = + (int) Math.min(1, tAmount); // If the percent is not enough to give at least 1L, try to give 1L if (tEntry.right <= 0) continue; int tFilledAmount = tEntry.left.fill(tEntry.middle, drainFromIndex(tEntry.right, false, index), false); @@ -377,11 +488,11 @@ public class GT_MetaPipeEntity_Fluid extends MetaPipeEntity { if (mFluids[index] == null || mFluids[index].amount <= 0) return; } - } @Override - public boolean onWrenchRightClick(byte aSide, byte aWrenchingSide, EntityPlayer aPlayer, float aX, float aY, float aZ) { + public boolean onWrenchRightClick( + byte aSide, byte aWrenchingSide, EntityPlayer aPlayer, float aX, float aY, float aZ) { if (GT_Mod.gregtechproxy.gt6Pipe) { byte tSide = GT_Utility.determineWrenchingSide(aSide, aX, aY, aZ); byte tMask = (byte) (1 << tSide); @@ -389,16 +500,14 @@ public class GT_MetaPipeEntity_Fluid extends MetaPipeEntity { if (isInputDisabledAtSide(tSide)) { mDisableInput &= ~tMask; GT_Utility.sendChatToPlayer(aPlayer, GT_Utility.trans("212", "Input enabled")); - if (!isConnectedAtSide(tSide)) - connect(tSide); + if (!isConnectedAtSide(tSide)) connect(tSide); } else { mDisableInput |= tMask; GT_Utility.sendChatToPlayer(aPlayer, GT_Utility.trans("213", "Input disabled")); } } else { if (!isConnectedAtSide(tSide)) { - if (connect(tSide) > 0) - GT_Utility.sendChatToPlayer(aPlayer, GT_Utility.trans("214", "Connected")); + if (connect(tSide) > 0) GT_Utility.sendChatToPlayer(aPlayer, GT_Utility.trans("214", "Connected")); } else { disconnect(tSide); GT_Utility.sendChatToPlayer(aPlayer, GT_Utility.trans("215", "Disconnected")); @@ -410,37 +519,49 @@ public class GT_MetaPipeEntity_Fluid extends MetaPipeEntity { } @Override - public boolean letsIn(GT_CoverBehavior coverBehavior, byte aSide, int aCoverID, int aCoverVariable, ICoverable aTileEntity) { + public boolean letsIn( + GT_CoverBehavior coverBehavior, byte aSide, int aCoverID, int aCoverVariable, ICoverable aTileEntity) { return coverBehavior.letsFluidIn(aSide, aCoverID, aCoverVariable, null, aTileEntity); } @Override - public boolean letsOut(GT_CoverBehavior coverBehavior, byte aSide, int aCoverID, int aCoverVariable, ICoverable aTileEntity) { + public boolean letsOut( + GT_CoverBehavior coverBehavior, byte aSide, int aCoverID, int aCoverVariable, ICoverable aTileEntity) { return coverBehavior.letsFluidOut(aSide, aCoverID, aCoverVariable, null, aTileEntity); } @Override - public boolean letsIn(GT_CoverBehaviorBase<?> coverBehavior, byte aSide, int aCoverID, ISerializableObject aCoverVariable, ICoverable aTileEntity) { + public boolean letsIn( + GT_CoverBehaviorBase<?> coverBehavior, + byte aSide, + int aCoverID, + ISerializableObject aCoverVariable, + ICoverable aTileEntity) { return coverBehavior.letsFluidIn(aSide, aCoverID, aCoverVariable, null, aTileEntity); } @Override - public boolean letsOut(GT_CoverBehaviorBase<?> coverBehavior, byte aSide, int aCoverID, ISerializableObject aCoverVariable, ICoverable aTileEntity) { + public boolean letsOut( + GT_CoverBehaviorBase<?> coverBehavior, + byte aSide, + int aCoverID, + ISerializableObject aCoverVariable, + ICoverable aTileEntity) { return coverBehavior.letsFluidOut(aSide, aCoverID, aCoverVariable, null, aTileEntity); } @Override public boolean canConnect(byte aSide, TileEntity tTileEntity) { - if (tTileEntity == null) - return false; + 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; + if (baseMetaTile == null) return false; final GT_CoverBehaviorBase<?> coverBehavior = baseMetaTile.getCoverBehaviorAtSideNew(aSide); - final IGregTechTileEntity gTileEntity = (tTileEntity instanceof IGregTechTileEntity) ? (IGregTechTileEntity) tTileEntity : null; + final IGregTechTileEntity gTileEntity = + (tTileEntity instanceof IGregTechTileEntity) ? (IGregTechTileEntity) tTileEntity : null; if (coverBehavior instanceof GT_Cover_Drain || (GregTech_API.mTConstruct && isTConstructFaucet(tTileEntity))) return true; @@ -451,9 +572,9 @@ public class GT_MetaPipeEntity_Fluid extends MetaPipeEntity { final FluidTankInfo[] tInfo = fTileEntity.getTankInfo(ForgeDirection.getOrientation(tSide)); if (tInfo != null) { return tInfo.length > 0 - || (GregTech_API.mTranslocator && isTranslocator(tTileEntity)) - || gTileEntity != null && gTileEntity.getCoverBehaviorAtSideNew(tSide) instanceof GT_Cover_FluidRegulator; - + || (GregTech_API.mTranslocator && isTranslocator(tTileEntity)) + || gTileEntity != null + && gTileEntity.getCoverBehaviorAtSideNew(tSide) instanceof GT_Cover_FluidRegulator; } } return false; @@ -484,20 +605,17 @@ public class GT_MetaPipeEntity_Fluid extends MetaPipeEntity { 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() - ); + .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()); } } @@ -509,18 +627,16 @@ public class GT_MetaPipeEntity_Fluid extends MetaPipeEntity { @Override public FluidTankInfo getInfo() { for (FluidStack tFluid : mFluids) { - if (tFluid != null) - return new FluidTankInfo(tFluid, mCapacity * 20); + if (tFluid != null) return new FluidTankInfo(tFluid, mCapacity * 20); } return new FluidTankInfo(null, mCapacity * 20); } @Override public FluidTankInfo[] getTankInfo(ForgeDirection aSide) { - if (getCapacity() <= 0 && !getBaseMetaTileEntity().hasSteamEngineUpgrade()) return new FluidTankInfo[]{}; + if (getCapacity() <= 0 && !getBaseMetaTileEntity().hasSteamEngineUpgrade()) return new FluidTankInfo[] {}; ArrayList<FluidTankInfo> tList = new ArrayList<>(); - for (FluidStack tFluid : mFluids) - tList.add(new FluidTankInfo(tFluid, mCapacity * 20)); + for (FluidStack tFluid : mFluids) tList.add(new FluidTankInfo(tFluid, mCapacity * 20)); return tList.toArray(new FluidTankInfo[mPipeAmount]); } @@ -537,8 +653,7 @@ public class GT_MetaPipeEntity_Fluid extends MetaPipeEntity { @Override public final FluidStack getFluid() { for (FluidStack tFluid : mFluids) { - if (tFluid != null) - return tFluid; + if (tFluid != null) return tFluid; } return null; } @@ -547,8 +662,7 @@ public class GT_MetaPipeEntity_Fluid extends MetaPipeEntity { public final int getFluidAmount() { int rAmount = 0; for (FluidStack tFluid : mFluids) { - if (tFluid != null) - rAmount += tFluid.amount; + if (tFluid != null) rAmount += tFluid.amount; } return rAmount; } @@ -611,8 +725,7 @@ public class GT_MetaPipeEntity_Fluid extends MetaPipeEntity { public final FluidStack drain(int maxDrain, boolean doDrain) { FluidStack drained; for (int i = 0; i < mPipeAmount; i++) { - if ((drained = drainFromIndex(maxDrain, doDrain, i)) != null) - return drained; + if ((drained = drainFromIndex(maxDrain, doDrain, i)) != null) return drained; } return null; } @@ -626,8 +739,7 @@ public class GT_MetaPipeEntity_Fluid extends MetaPipeEntity { } int used = maxDrain; - if (mFluids[index].amount < used) - used = mFluids[index].amount; + if (mFluids[index].amount < used) used = mFluids[index].amount; if (doDrain) { mFluids[index].amount -= used; @@ -651,14 +763,18 @@ public class GT_MetaPipeEntity_Fluid extends MetaPipeEntity { @Override public String[] getDescription() { if (mPipeAmount == 1) { - return new String[]{ - EnumChatFormatting.BLUE + "Fluid Capacity: %%%" + GT_Utility.formatNumbers(mCapacity * 20L) + "%%% L/sec" + EnumChatFormatting.GRAY, - EnumChatFormatting.RED + "Heat Limit: %%%" + GT_Utility.formatNumbers(mHeatResistance) + "%%% K" + EnumChatFormatting.GRAY + return new String[] { + EnumChatFormatting.BLUE + "Fluid Capacity: %%%" + GT_Utility.formatNumbers(mCapacity * 20L) + + "%%% L/sec" + EnumChatFormatting.GRAY, + EnumChatFormatting.RED + "Heat Limit: %%%" + GT_Utility.formatNumbers(mHeatResistance) + "%%% K" + + EnumChatFormatting.GRAY }; } else { - return new String[]{ - EnumChatFormatting.BLUE + "Fluid Capacity: %%%" + GT_Utility.formatNumbers(mCapacity * 20L) + "%%% L/sec" + EnumChatFormatting.GRAY, - EnumChatFormatting.RED + "Heat Limit: %%%" + GT_Utility.formatNumbers(mHeatResistance) + "%%% K" + EnumChatFormatting.GRAY, + return new String[] { + EnumChatFormatting.BLUE + "Fluid Capacity: %%%" + GT_Utility.formatNumbers(mCapacity * 20L) + + "%%% L/sec" + EnumChatFormatting.GRAY, + EnumChatFormatting.RED + "Heat Limit: %%%" + GT_Utility.formatNumbers(mHeatResistance) + "%%% K" + + EnumChatFormatting.GRAY, EnumChatFormatting.AQUA + "Pipe Amount: %%%" + mPipeAmount + EnumChatFormatting.GRAY }; } @@ -688,8 +804,7 @@ public class GT_MetaPipeEntity_Fluid extends MetaPipeEntity { public AxisAlignedBB getCollisionBoundingBoxFromPool(World aWorld, int aX, int aY, int aZ) { if (GT_Mod.instance.isClientSide() && (GT_Client.hideValue & 0x2) != 0) return AxisAlignedBB.getBoundingBox(aX, aY, aZ, aX + 1, aY + 1, aZ + 1); - else - return getActualCollisionBoundingBoxFromPool(aWorld, aX, aY, aZ); + else return getActualCollisionBoundingBoxFromPool(aWorld, aX, aY, aZ); } private AxisAlignedBB getActualCollisionBoundingBoxFromPool(World aWorld, int aX, int aY, int aZ) { @@ -734,11 +849,19 @@ 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 - public void addCollisionBoxesToList(World aWorld, int aX, int aY, int aZ, AxisAlignedBB inputAABB, List<AxisAlignedBB> outputAABB, Entity collider) { + public void addCollisionBoxesToList( + World aWorld, + int aX, + int aY, + int aZ, + AxisAlignedBB inputAABB, + List<AxisAlignedBB> outputAABB, + Entity collider) { super.addCollisionBoxesToList(aWorld, aX, aY, aZ, inputAABB, outputAABB, collider); if (GT_Mod.instance.isClientSide() && (GT_Client.hideValue & 0x2) != 0) { AxisAlignedBB aabb = getActualCollisionBoundingBoxFromPool(aWorld, aX, aY, aZ); @@ -748,12 +871,10 @@ public class GT_MetaPipeEntity_Fluid extends MetaPipeEntity { @Override public FluidStack drain(ForgeDirection aSide, FluidStack aFluid, boolean doDrain) { - if (aFluid == null) - return null; + if (aFluid == null) return null; for (int i = 0; i < mFluids.length; ++i) { final FluidStack f = mFluids[i]; - if (f == null || !f.isFluidEqual(aFluid)) - continue; + if (f == null || !f.isFluidEqual(aFluid)) continue; return drainFromIndex(aFluid.amount, doDrain, i); } return null; 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 e1677b1deb..dce130325c 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 @@ -1,5 +1,7 @@ package gregtech.api.metatileentity.implementations; +import static gregtech.api.enums.GT_Values.RA; + import gregtech.api.enums.Dyes; import gregtech.api.enums.ItemList; import gregtech.api.enums.Materials; @@ -16,12 +18,9 @@ import gregtech.api.util.GT_OreDictUnificator; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; -import static gregtech.api.enums.GT_Values.RA; - 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."); + "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) { @@ -29,8 +28,16 @@ public class GT_MetaPipeEntity_Frame extends MetaPipeEntity { mMaterial = aMaterial; GT_OreDictUnificator.registerOre(OrePrefixes.frameGt, aMaterial, getStackForm(1)); - GT_ModHandler.addCraftingRecipe(getStackForm(2), RecipeBits.NOT_REMOVABLE | GT_ModHandler.RecipeBits.BUFFERED, new Object[]{"SSS", "SwS", "SSS", 'S', OrePrefixes.stick.get(mMaterial)}); - RA.addAssemblerRecipe(GT_OreDictUnificator.get(OrePrefixes.stick, aMaterial, 4), ItemList.Circuit_Integrated.getWithDamage(0, 4), getStackForm(1), 64, 8); + GT_ModHandler.addCraftingRecipe( + getStackForm(2), + RecipeBits.NOT_REMOVABLE | GT_ModHandler.RecipeBits.BUFFERED, + new Object[] {"SSS", "SwS", "SSS", 'S', OrePrefixes.stick.get(mMaterial)}); + RA.addAssemblerRecipe( + GT_OreDictUnificator.get(OrePrefixes.stick, aMaterial, 4), + ItemList.Circuit_Integrated.getWithDamage(0, 4), + getStackForm(1), + 64, + 8); } public GT_MetaPipeEntity_Frame(String aName, Materials aMaterial) { @@ -49,8 +56,18 @@ public class GT_MetaPipeEntity_Frame extends MetaPipeEntity { } @Override - public ITexture[] getTexture(IGregTechTileEntity aBaseMetaTileEntity, byte aSide, byte aConnections, byte aColorIndex, boolean aConnected, boolean aRedstone) { - return new ITexture[]{TextureFactory.of(mMaterial.mIconSet.mTextures[OrePrefixes.frameGt.mTextureIndex], Dyes.getModulation(aColorIndex, mMaterial.mRGBa))}; + public ITexture[] getTexture( + IGregTechTileEntity aBaseMetaTileEntity, + byte aSide, + byte aConnections, + byte aColorIndex, + boolean aConnected, + boolean aRedstone) { + return new ITexture[] { + TextureFactory.of( + mMaterial.mIconSet.mTextures[OrePrefixes.frameGt.mTextureIndex], + Dyes.getModulation(aColorIndex, mMaterial.mRGBa)) + }; } @Override @@ -84,26 +101,36 @@ public class GT_MetaPipeEntity_Frame extends MetaPipeEntity { } @Override - public final void saveNBTData(NBTTagCompound aNBT) {/*Do nothing*/} + public final void saveNBTData(NBTTagCompound aNBT) { + /*Do nothing*/ + } @Override - public final void loadNBTData(NBTTagCompound aNBT) {/*Do nothing*/} + public final void loadNBTData(NBTTagCompound aNBT) { + /*Do nothing*/ + } @Override - public final boolean allowPutStack(IGregTechTileEntity aBaseMetaTileEntity, int aIndex, byte aSide, ItemStack aStack) { + public final boolean allowPutStack( + IGregTechTileEntity aBaseMetaTileEntity, int aIndex, byte aSide, ItemStack aStack) { return false; } @Override - public final boolean allowPullStack(IGregTechTileEntity aBaseMetaTileEntity, int aIndex, byte aSide, ItemStack aStack) { + public final boolean allowPullStack( + IGregTechTileEntity aBaseMetaTileEntity, int aIndex, byte aSide, ItemStack aStack) { return false; } @Override - public int connect(byte aSide) {return 0;} + public int connect(byte aSide) { + return 0; + } @Override - public void disconnect(byte aSide) {/* Do nothing*/} + public void disconnect(byte aSide) { + /* Do nothing*/ + } @Override public boolean isMachineBlockUpdateRecursive() { 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 218e064f71..c919187927 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 @@ -1,5 +1,7 @@ package gregtech.api.metatileentity.implementations; +import static gregtech.api.enums.Textures.BlockIcons.PIPE_RESTRICTOR; + import gregtech.GT_Mod; import gregtech.api.enums.Dyes; import gregtech.api.enums.GT_Values; @@ -18,6 +20,9 @@ import gregtech.api.util.GT_CoverBehaviorBase; import gregtech.api.util.GT_Utility; import gregtech.api.util.ISerializableObject; import gregtech.common.GT_Client; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; import net.minecraft.entity.Entity; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.inventory.IInventory; @@ -31,12 +36,6 @@ import net.minecraft.util.AxisAlignedBB; import net.minecraft.world.World; import net.minecraftforge.common.util.ForgeDirection; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; - -import static gregtech.api.enums.Textures.BlockIcons.PIPE_RESTRICTOR; - public class GT_MetaPipeEntity_Item extends MetaPipeEntity implements IMetaTileEntityItemPipe { public final float mThickNess; public final Materials mMaterial; @@ -47,7 +46,16 @@ public class GT_MetaPipeEntity_Item extends MetaPipeEntity implements IMetaTileE public boolean mIsRestrictive = false; private int[] cacheSides; - public GT_MetaPipeEntity_Item(int aID, String aName, String aNameRegional, float aThickNess, Materials aMaterial, int aInvSlotCount, int aStepSize, boolean aIsRestrictive, int aTickTime) { + public GT_MetaPipeEntity_Item( + int aID, + String aName, + String aNameRegional, + float aThickNess, + Materials aMaterial, + int aInvSlotCount, + int aStepSize, + boolean aIsRestrictive, + int aTickTime) { super(aID, aName, aNameRegional, aInvSlotCount, false); mIsRestrictive = aIsRestrictive; mThickNess = aThickNess; @@ -57,11 +65,26 @@ public class GT_MetaPipeEntity_Item extends MetaPipeEntity implements IMetaTileE addInfo(aID); } - public GT_MetaPipeEntity_Item(int aID, String aName, String aNameRegional, float aThickNess, Materials aMaterial, int aInvSlotCount, int aStepSize, boolean aIsRestrictive) { + public GT_MetaPipeEntity_Item( + int aID, + String aName, + String aNameRegional, + float aThickNess, + Materials aMaterial, + int aInvSlotCount, + int aStepSize, + boolean aIsRestrictive) { this(aID, aName, aNameRegional, aThickNess, aMaterial, aInvSlotCount, aStepSize, aIsRestrictive, 20); } - public GT_MetaPipeEntity_Item(String aName, float aThickNess, Materials aMaterial, int aInvSlotCount, int aStepSize, boolean aIsRestrictive, int aTickTime) { + public GT_MetaPipeEntity_Item( + String aName, + float aThickNess, + Materials aMaterial, + int aInvSlotCount, + int aStepSize, + boolean aIsRestrictive, + int aTickTime) { super(aName, aInvSlotCount); mIsRestrictive = aIsRestrictive; mThickNess = aThickNess; @@ -77,43 +100,113 @@ public class GT_MetaPipeEntity_Item extends MetaPipeEntity implements IMetaTileE @Override public IMetaTileEntity newMetaEntity(IGregTechTileEntity aTileEntity) { - return new GT_MetaPipeEntity_Item(mName, mThickNess, mMaterial, mInventory.length, mStepSize, mIsRestrictive, mTickTime); + return new GT_MetaPipeEntity_Item( + mName, mThickNess, mMaterial, mInventory.length, mStepSize, mIsRestrictive, mTickTime); } @Override - public ITexture[] getTexture(IGregTechTileEntity aBaseMetaTileEntity, byte aSide, byte aConnections, byte aColorIndex, boolean aConnected, boolean aRedstone) { + public ITexture[] getTexture( + IGregTechTileEntity aBaseMetaTileEntity, + byte aSide, + byte aConnections, + byte aColorIndex, + boolean aConnected, + boolean aRedstone) { if (mIsRestrictive) { if (aConnected) { float tThickNess = getThickNess(); if (tThickNess < 0.124F) - return new ITexture[]{TextureFactory.of(mMaterial.mIconSet.mTextures[OrePrefixes.pipe.mTextureIndex], Dyes.getModulation(aColorIndex, mMaterial.mRGBa)), TextureFactory.of(PIPE_RESTRICTOR)}; - if (tThickNess < 0.374F)//0.375 - return new ITexture[]{TextureFactory.of(mMaterial.mIconSet.mTextures[OrePrefixes.pipeTiny.mTextureIndex], Dyes.getModulation(aColorIndex, mMaterial.mRGBa)), TextureFactory.of(PIPE_RESTRICTOR)}; - if (tThickNess < 0.499F)//0.500 - return new ITexture[]{TextureFactory.of(mMaterial.mIconSet.mTextures[OrePrefixes.pipeSmall.mTextureIndex], Dyes.getModulation(aColorIndex, mMaterial.mRGBa)), TextureFactory.of(PIPE_RESTRICTOR)}; - if (tThickNess < 0.749F)//0.750 - return new ITexture[]{TextureFactory.of(mMaterial.mIconSet.mTextures[OrePrefixes.pipeMedium.mTextureIndex], Dyes.getModulation(aColorIndex, mMaterial.mRGBa)), TextureFactory.of(PIPE_RESTRICTOR)}; - if (tThickNess < 0.874F)//0.825 - return new ITexture[]{TextureFactory.of(mMaterial.mIconSet.mTextures[OrePrefixes.pipeLarge.mTextureIndex], Dyes.getModulation(aColorIndex, mMaterial.mRGBa)), TextureFactory.of(PIPE_RESTRICTOR)}; - return new ITexture[]{TextureFactory.of(mMaterial.mIconSet.mTextures[OrePrefixes.pipeHuge.mTextureIndex], Dyes.getModulation(aColorIndex, mMaterial.mRGBa)), TextureFactory.of(PIPE_RESTRICTOR)}; + return new ITexture[] { + TextureFactory.of( + mMaterial.mIconSet.mTextures[OrePrefixes.pipe.mTextureIndex], + Dyes.getModulation(aColorIndex, mMaterial.mRGBa)), + TextureFactory.of(PIPE_RESTRICTOR) + }; + if (tThickNess < 0.374F) // 0.375 + return new ITexture[] { + TextureFactory.of( + mMaterial.mIconSet.mTextures[OrePrefixes.pipeTiny.mTextureIndex], + Dyes.getModulation(aColorIndex, mMaterial.mRGBa)), + TextureFactory.of(PIPE_RESTRICTOR) + }; + if (tThickNess < 0.499F) // 0.500 + return new ITexture[] { + TextureFactory.of( + mMaterial.mIconSet.mTextures[OrePrefixes.pipeSmall.mTextureIndex], + Dyes.getModulation(aColorIndex, mMaterial.mRGBa)), + TextureFactory.of(PIPE_RESTRICTOR) + }; + if (tThickNess < 0.749F) // 0.750 + return new ITexture[] { + TextureFactory.of( + mMaterial.mIconSet.mTextures[OrePrefixes.pipeMedium.mTextureIndex], + Dyes.getModulation(aColorIndex, mMaterial.mRGBa)), + TextureFactory.of(PIPE_RESTRICTOR) + }; + if (tThickNess < 0.874F) // 0.825 + return new ITexture[] { + TextureFactory.of( + mMaterial.mIconSet.mTextures[OrePrefixes.pipeLarge.mTextureIndex], + Dyes.getModulation(aColorIndex, mMaterial.mRGBa)), + TextureFactory.of(PIPE_RESTRICTOR) + }; + return new ITexture[] { + TextureFactory.of( + mMaterial.mIconSet.mTextures[OrePrefixes.pipeHuge.mTextureIndex], + Dyes.getModulation(aColorIndex, mMaterial.mRGBa)), + TextureFactory.of(PIPE_RESTRICTOR) + }; } - return new ITexture[]{TextureFactory.of(mMaterial.mIconSet.mTextures[OrePrefixes.pipe.mTextureIndex], Dyes.getModulation(aColorIndex, mMaterial.mRGBa)), TextureFactory.of(PIPE_RESTRICTOR)}; + return new ITexture[] { + TextureFactory.of( + mMaterial.mIconSet.mTextures[OrePrefixes.pipe.mTextureIndex], + Dyes.getModulation(aColorIndex, mMaterial.mRGBa)), + TextureFactory.of(PIPE_RESTRICTOR) + }; } if (aConnected) { float tThickNess = getThickNess(); if (tThickNess < 0.124F) - return new ITexture[]{TextureFactory.of(mMaterial.mIconSet.mTextures[OrePrefixes.pipe.mTextureIndex], Dyes.getModulation(aColorIndex, mMaterial.mRGBa))}; - if (tThickNess < 0.374F)//0.375 - return new ITexture[]{TextureFactory.of(mMaterial.mIconSet.mTextures[OrePrefixes.pipeTiny.mTextureIndex], Dyes.getModulation(aColorIndex, mMaterial.mRGBa))}; - if (tThickNess < 0.499F)//0.500 - return new ITexture[]{TextureFactory.of(mMaterial.mIconSet.mTextures[OrePrefixes.pipeSmall.mTextureIndex], Dyes.getModulation(aColorIndex, mMaterial.mRGBa))}; - if (tThickNess < 0.749F)//0.750 - return new ITexture[]{TextureFactory.of(mMaterial.mIconSet.mTextures[OrePrefixes.pipeMedium.mTextureIndex], Dyes.getModulation(aColorIndex, mMaterial.mRGBa))}; - if (tThickNess < 0.874F)//0.825 - return new ITexture[]{TextureFactory.of(mMaterial.mIconSet.mTextures[OrePrefixes.pipeLarge.mTextureIndex], Dyes.getModulation(aColorIndex, mMaterial.mRGBa))}; - return new ITexture[]{TextureFactory.of(mMaterial.mIconSet.mTextures[OrePrefixes.pipeHuge.mTextureIndex], Dyes.getModulation(aColorIndex, mMaterial.mRGBa))}; + return new ITexture[] { + TextureFactory.of( + mMaterial.mIconSet.mTextures[OrePrefixes.pipe.mTextureIndex], + Dyes.getModulation(aColorIndex, mMaterial.mRGBa)) + }; + if (tThickNess < 0.374F) // 0.375 + return new ITexture[] { + TextureFactory.of( + mMaterial.mIconSet.mTextures[OrePrefixes.pipeTiny.mTextureIndex], + Dyes.getModulation(aColorIndex, mMaterial.mRGBa)) + }; + if (tThickNess < 0.499F) // 0.500 + return new ITexture[] { + TextureFactory.of( + mMaterial.mIconSet.mTextures[OrePrefixes.pipeSmall.mTextureIndex], + Dyes.getModulation(aColorIndex, mMaterial.mRGBa)) + }; + if (tThickNess < 0.749F) // 0.750 + return new ITexture[] { + TextureFactory.of( + mMaterial.mIconSet.mTextures[OrePrefixes.pipeMedium.mTextureIndex], + Dyes.getModulation(aColorIndex, mMaterial.mRGBa)) + }; + if (tThickNess < 0.874F) // 0.825 + return new ITexture[] { + TextureFactory.of( + mMaterial.mIconSet.mTextures[OrePrefixes.pipeLarge.mTextureIndex], + Dyes.getModulation(aColorIndex, mMaterial.mRGBa)) + }; + return new ITexture[] { + TextureFactory.of( + mMaterial.mIconSet.mTextures[OrePrefixes.pipeHuge.mTextureIndex], + Dyes.getModulation(aColorIndex, mMaterial.mRGBa)) + }; } - return new ITexture[]{TextureFactory.of(mMaterial.mIconSet.mTextures[OrePrefixes.pipe.mTextureIndex], Dyes.getModulation(aColorIndex, mMaterial.mRGBa))}; + return new ITexture[] { + TextureFactory.of( + mMaterial.mIconSet.mTextures[OrePrefixes.pipe.mTextureIndex], + Dyes.getModulation(aColorIndex, mMaterial.mRGBa)) + }; } @Override @@ -149,8 +242,7 @@ public class GT_MetaPipeEntity_Item extends MetaPipeEntity implements IMetaTileE @Override public void saveNBTData(NBTTagCompound aNBT) { aNBT.setByte("mLastReceivedFrom", mLastReceivedFrom); - if (GT_Mod.gregtechproxy.gt6Pipe) - aNBT.setByte("mConnections", mConnections); + if (GT_Mod.gregtechproxy.gt6Pipe) aNBT.setByte("mConnections", mConnections); } @Override @@ -177,7 +269,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)) @@ -193,15 +287,15 @@ public class GT_MetaPipeEntity_Item extends MetaPipeEntity implements IMetaTileE } @Override - public boolean onWrenchRightClick(byte aSide, byte aWrenchingSide, EntityPlayer aPlayer, float aX, float aY, float aZ) { + public boolean onWrenchRightClick( + byte aSide, byte aWrenchingSide, EntityPlayer aPlayer, float aX, float aY, float aZ) { if (GT_Mod.gregtechproxy.gt6Pipe) { byte tSide = GT_Utility.determineWrenchingSide(aSide, aX, aY, aZ); if (isConnectedAtSide(tSide)) { disconnect(tSide); GT_Utility.sendChatToPlayer(aPlayer, GT_Utility.trans("215", "Disconnected")); } else { - if (connect(tSide) > 0) - GT_Utility.sendChatToPlayer(aPlayer, GT_Utility.trans("214", "Connected")); + if (connect(tSide) > 0) GT_Utility.sendChatToPlayer(aPlayer, GT_Utility.trans("214", "Connected")); } return true; } @@ -209,22 +303,34 @@ public class GT_MetaPipeEntity_Item extends MetaPipeEntity implements IMetaTileE } @Override - public boolean letsIn(GT_CoverBehavior coverBehavior, byte aSide, int aCoverID, int aCoverVariable, ICoverable aTileEntity) { + public boolean letsIn( + GT_CoverBehavior coverBehavior, byte aSide, int aCoverID, int aCoverVariable, ICoverable aTileEntity) { return coverBehavior.letsItemsIn(aSide, aCoverID, aCoverVariable, -1, aTileEntity); } @Override - public boolean letsOut(GT_CoverBehavior coverBehavior, byte aSide, int aCoverID, int aCoverVariable, ICoverable aTileEntity) { + public boolean letsOut( + GT_CoverBehavior coverBehavior, byte aSide, int aCoverID, int aCoverVariable, ICoverable aTileEntity) { return coverBehavior.letsItemsOut(aSide, aCoverID, aCoverVariable, -1, aTileEntity); } @Override - public boolean letsIn(GT_CoverBehaviorBase<?> coverBehavior, byte aSide, int aCoverID, ISerializableObject aCoverVariable, ICoverable aTileEntity) { + public boolean letsIn( + GT_CoverBehaviorBase<?> coverBehavior, + byte aSide, + int aCoverID, + ISerializableObject aCoverVariable, + ICoverable aTileEntity) { return coverBehavior.letsItemsIn(aSide, aCoverID, aCoverVariable, -1, aTileEntity); } @Override - public boolean letsOut(GT_CoverBehaviorBase<?> coverBehavior, byte aSide, int aCoverID, ISerializableObject aCoverVariable, ICoverable aTileEntity) { + public boolean letsOut( + GT_CoverBehaviorBase<?> coverBehavior, + byte aSide, + int aCoverID, + ISerializableObject aCoverVariable, + ICoverable aTileEntity) { return coverBehavior.letsItemsOut(aSide, aCoverID, aCoverVariable, -1, aTileEntity); } @@ -235,7 +341,8 @@ public class GT_MetaPipeEntity_Item extends MetaPipeEntity implements IMetaTileE final byte tSide = GT_Utility.getOppositeSide(aSide); boolean connectable = GT_Utility.isConnectableNonInventoryPipe(tTileEntity, tSide); - final IGregTechTileEntity gTileEntity = (tTileEntity instanceof IGregTechTileEntity) ? (IGregTechTileEntity) tTileEntity : null; + final IGregTechTileEntity gTileEntity = + (tTileEntity instanceof IGregTechTileEntity) ? (IGregTechTileEntity) tTileEntity : null; if (gTileEntity != null) { if (gTileEntity.getMetaTileEntity() == null) return false; if (gTileEntity.getMetaTileEntity().connectsToItemPipe(tSide)) return true; @@ -261,7 +368,6 @@ public class GT_MetaPipeEntity_Item extends MetaPipeEntity implements IMetaTileE return GT_Mod.gregtechproxy.gt6Pipe; } - @Override public boolean incrementTransferCounter(int aIncrement) { mTransferredItems += aIncrement; @@ -274,7 +380,8 @@ public class GT_MetaPipeEntity_Item extends MetaPipeEntity implements IMetaTileE byte tOffset = (byte) getBaseMetaTileEntity().getRandomNumber(6), tSide = 0; for (byte i = 0; i < 6; i++) { tSide = (byte) ((i + tOffset) % 6); - if (isConnectedAtSide(tSide) && (isInventoryEmpty() || (tSide != mLastReceivedFrom || aSender != getBaseMetaTileEntity()))) { + if (isConnectedAtSide(tSide) + && (isInventoryEmpty() || (tSide != mLastReceivedFrom || aSender != getBaseMetaTileEntity()))) { if (insertItemStackIntoTileEntity(aSender, tSide)) return true; } } @@ -284,11 +391,31 @@ public class GT_MetaPipeEntity_Item extends MetaPipeEntity implements IMetaTileE @Override public boolean insertItemStackIntoTileEntity(Object aSender, byte aSide) { - if (getBaseMetaTileEntity().getCoverBehaviorAtSideNew(aSide).letsItemsOut(aSide, getBaseMetaTileEntity().getCoverIDAtSide(aSide), getBaseMetaTileEntity().getComplexCoverDataAtSide(aSide), -1, getBaseMetaTileEntity())) { + if (getBaseMetaTileEntity() + .getCoverBehaviorAtSideNew(aSide) + .letsItemsOut( + aSide, + getBaseMetaTileEntity().getCoverIDAtSide(aSide), + getBaseMetaTileEntity().getComplexCoverDataAtSide(aSide), + -1, + getBaseMetaTileEntity())) { TileEntity tInventory = getBaseMetaTileEntity().getTileEntityAtSide(aSide); if (tInventory != null && !(tInventory instanceof BaseMetaPipeEntity)) { - if ((!(tInventory instanceof TileEntityHopper) && !(tInventory instanceof TileEntityDispenser)) || getBaseMetaTileEntity().getMetaIDAtSide(aSide) != GT_Utility.getOppositeSide(aSide)) { - return GT_Utility.moveMultipleItemStacks(aSender, tInventory, (byte) 6, GT_Utility.getOppositeSide(aSide), null, false, (byte) 64, (byte) 1, (byte) 64, (byte) 1, 1) > 0; + if ((!(tInventory instanceof TileEntityHopper) && !(tInventory instanceof TileEntityDispenser)) + || getBaseMetaTileEntity().getMetaIDAtSide(aSide) != GT_Utility.getOppositeSide(aSide)) { + return GT_Utility.moveMultipleItemStacks( + aSender, + tInventory, + (byte) 6, + GT_Utility.getOppositeSide(aSide), + null, + false, + (byte) 64, + (byte) 1, + (byte) 64, + (byte) 1, + 1) + > 0; } } } @@ -333,10 +460,24 @@ public class GT_MetaPipeEntity_Item extends MetaPipeEntity implements IMetaTileE @Override public int[] getAccessibleSlotsFromSide(int aSide) { IGregTechTileEntity tTileEntity = getBaseMetaTileEntity(); - boolean tAllow = tTileEntity.getCoverBehaviorAtSideNew((byte) aSide).letsItemsIn((byte) aSide, tTileEntity.getCoverIDAtSide((byte) aSide), tTileEntity.getComplexCoverDataAtSide((byte) aSide), -2, tTileEntity) || tTileEntity.getCoverBehaviorAtSideNew((byte) aSide).letsItemsOut((byte) aSide, tTileEntity.getCoverIDAtSide((byte) aSide), tTileEntity.getComplexCoverDataAtSide((byte) aSide), -2, tTileEntity); + boolean tAllow = tTileEntity + .getCoverBehaviorAtSideNew((byte) aSide) + .letsItemsIn( + (byte) aSide, + tTileEntity.getCoverIDAtSide((byte) aSide), + tTileEntity.getComplexCoverDataAtSide((byte) aSide), + -2, + tTileEntity) + || tTileEntity + .getCoverBehaviorAtSideNew((byte) aSide) + .letsItemsOut( + (byte) aSide, + tTileEntity.getCoverIDAtSide((byte) aSide), + tTileEntity.getComplexCoverDataAtSide((byte) aSide), + -2, + tTileEntity); if (tAllow) { - if (cacheSides == null) - cacheSides = super.getAccessibleSlotsFromSide(aSide); + if (cacheSides == null) cacheSides = super.getAccessibleSlotsFromSide(aSide); return cacheSides; } else { return GT_Values.emptyIntArray; @@ -358,11 +499,20 @@ public class GT_MetaPipeEntity_Item extends MetaPipeEntity implements IMetaTileE @Override public String[] getDescription() { if (mTickTime == 20) - return new String[]{"Item Capacity: %%%" + getMaxPipeCapacity() + "%%% Stacks/sec", "Routing Value: %%%" + GT_Utility.formatNumbers(mStepSize)}; + return new String[] { + "Item Capacity: %%%" + getMaxPipeCapacity() + "%%% Stacks/sec", + "Routing Value: %%%" + GT_Utility.formatNumbers(mStepSize) + }; else if (mTickTime % 20 == 0) - return new String[]{"Item Capacity: %%%" + getMaxPipeCapacity() + "%%% Stacks/%%%" + (mTickTime / 20) + "%%% sec", "Routing Value: %%%" + GT_Utility.formatNumbers(mStepSize)}; + return new String[] { + "Item Capacity: %%%" + getMaxPipeCapacity() + "%%% Stacks/%%%" + (mTickTime / 20) + "%%% sec", + "Routing Value: %%%" + GT_Utility.formatNumbers(mStepSize) + }; else - return new String[]{"Item Capacity: %%%" + getMaxPipeCapacity() + "%%% Stacks/%%%" + mTickTime + "%%% ticks", "Routing Value: %%%" + GT_Utility.formatNumbers(mStepSize)}; + return new String[] { + "Item Capacity: %%%" + getMaxPipeCapacity() + "%%% Stacks/%%%" + mTickTime + "%%% ticks", + "Routing Value: %%%" + GT_Utility.formatNumbers(mStepSize) + }; } private boolean isInventoryEmpty() { @@ -380,8 +530,7 @@ public class GT_MetaPipeEntity_Item extends MetaPipeEntity implements IMetaTileE public AxisAlignedBB getCollisionBoundingBoxFromPool(World aWorld, int aX, int aY, int aZ) { if (GT_Mod.instance.isClientSide() && (GT_Client.hideValue & 0x2) != 0) return AxisAlignedBB.getBoundingBox(aX, aY, aZ, aX + 1, aY + 1, aZ + 1); - else - return getActualCollisionBoundingBoxFromPool(aWorld, aX, aY, aZ); + else return getActualCollisionBoundingBoxFromPool(aWorld, aX, aY, aZ); } private AxisAlignedBB getActualCollisionBoundingBoxFromPool(World aWorld, int aX, int aY, int aZ) { @@ -426,11 +575,19 @@ 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 - public void addCollisionBoxesToList(World aWorld, int aX, int aY, int aZ, AxisAlignedBB inputAABB, List<AxisAlignedBB> outputAABB, Entity collider) { + public void addCollisionBoxesToList( + World aWorld, + int aX, + int aY, + int aZ, + AxisAlignedBB inputAABB, + List<AxisAlignedBB> outputAABB, + Entity collider) { super.addCollisionBoxesToList(aWorld, aX, aY, aZ, inputAABB, outputAABB, collider); if (GT_Mod.instance.isClientSide() && (GT_Client.hideValue & 0x2) != 0) { AxisAlignedBB aabb = getActualCollisionBoundingBoxFromPool(aWorld, aX, aY, aZ); 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 1a81e4d570..67c3c672ae 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 @@ -1,5 +1,7 @@ package gregtech.api.metatileentity.implementations; +import static gregtech.api.enums.GT_Values.V; + import gregtech.api.enums.Textures; import gregtech.api.gui.*; import gregtech.api.interfaces.ITexture; @@ -15,8 +17,6 @@ import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.util.EnumChatFormatting; -import static gregtech.api.enums.GT_Values.V; - /** * NEVER INCLUDE THIS FILE IN YOUR MOD!!! * <p/> @@ -30,38 +30,54 @@ public class GT_MetaTileEntity_BasicBatteryBuffer extends GT_MetaTileEntity_Tier private long mStored = 0; private long mMax = 0; - public GT_MetaTileEntity_BasicBatteryBuffer(int aID, String aName, String aNameRegional, int aTier, String aDescription, int aSlotCount) { + public GT_MetaTileEntity_BasicBatteryBuffer( + int aID, String aName, String aNameRegional, int aTier, String aDescription, int aSlotCount) { super(aID, aName, aNameRegional, aTier, aSlotCount, aDescription); } - public GT_MetaTileEntity_BasicBatteryBuffer(String aName, int aTier, String aDescription, ITexture[][][] aTextures, int aSlotCount) { + public GT_MetaTileEntity_BasicBatteryBuffer( + String aName, int aTier, String aDescription, ITexture[][][] aTextures, int aSlotCount) { super(aName, aTier, aSlotCount, aDescription, aTextures); } - public GT_MetaTileEntity_BasicBatteryBuffer(String aName, int aTier, String[] aDescription, ITexture[][][] aTextures, int aSlotCount) { + public GT_MetaTileEntity_BasicBatteryBuffer( + String aName, int aTier, String[] aDescription, ITexture[][][] aTextures, int aSlotCount) { super(aName, aTier, aSlotCount, aDescription, aTextures); } @Override public String[] getDescription() { - String[] desc = new String[mDescriptionArray.length + 1]; - System.arraycopy(mDescriptionArray, 0, desc, 0, mDescriptionArray.length); - desc[mDescriptionArray.length] = mInventory.length + " Slots"; - return desc; + String[] desc = new String[mDescriptionArray.length + 1]; + System.arraycopy(mDescriptionArray, 0, desc, 0, mDescriptionArray.length); + desc[mDescriptionArray.length] = mInventory.length + " Slots"; + return desc; } @Override public ITexture[][][] getTextureSet(ITexture[] aTextures) { ITexture[][][] rTextures = new ITexture[2][17][]; for (byte i = -1; i < 16; i++) { - rTextures[0][i + 1] = new ITexture[]{Textures.BlockIcons.MACHINE_CASINGS[mTier][i + 1]}; - rTextures[1][i + 1] = new ITexture[]{Textures.BlockIcons.MACHINE_CASINGS[mTier][i + 1], mInventory.length==16 ? Textures.BlockIcons.OVERLAYS_ENERGY_OUT_POWER[mTier] : mInventory.length > 4 ? Textures.BlockIcons.OVERLAYS_ENERGY_OUT_MULTI[mTier] : Textures.BlockIcons.OVERLAYS_ENERGY_OUT[mTier]}; + rTextures[0][i + 1] = new ITexture[] {Textures.BlockIcons.MACHINE_CASINGS[mTier][i + 1]}; + rTextures[1][i + 1] = new ITexture[] { + Textures.BlockIcons.MACHINE_CASINGS[mTier][i + 1], + mInventory.length == 16 + ? Textures.BlockIcons.OVERLAYS_ENERGY_OUT_POWER[mTier] + : mInventory.length > 4 + ? Textures.BlockIcons.OVERLAYS_ENERGY_OUT_MULTI[mTier] + : Textures.BlockIcons.OVERLAYS_ENERGY_OUT[mTier] + }; } return rTextures; } @Override - public ITexture[] getTexture(IGregTechTileEntity aBaseMetaTileEntity, byte aSide, byte aFacing, byte aColorIndex, boolean aActive, boolean aRedstone) { + public ITexture[] getTexture( + IGregTechTileEntity aBaseMetaTileEntity, + byte aSide, + byte aFacing, + byte aColorIndex, + boolean aActive, + boolean aRedstone) { return mTextures[aSide == aFacing ? 1 : 0][aColorIndex + 1]; } @@ -247,14 +263,15 @@ public class GT_MetaTileEntity_BasicBatteryBuffer extends GT_MetaTileEntity_Tier public boolean allowPullStack(IGregTechTileEntity aBaseMetaTileEntity, int aIndex, byte aSide, ItemStack aStack) { 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") || - name.equals("gt.metaitem.01.32521") || - name.equals("gt.metaitem.01.32530") || - name.equals("gt.metaitem.01.32531")) { - if(ic2.api.item.ElectricItem.manager.getCharge(aStack)==0){ - return true;} + if (name.equals("gt.metaitem.01.32510") + || name.equals("gt.metaitem.01.32511") + || name.equals("gt.metaitem.01.32520") + || name.equals("gt.metaitem.01.32521") + || name.equals("gt.metaitem.01.32530") + || name.equals("gt.metaitem.01.32531")) { + if (ic2.api.item.ElectricItem.manager.getCharge(aStack) == 0) { + return true; + } } } return false; @@ -265,7 +282,7 @@ public class GT_MetaTileEntity_BasicBatteryBuffer extends GT_MetaTileEntity_Tier if (!GT_Utility.isStackValid(aStack)) { return false; } - if (mInventory[aIndex]==null && GT_ModHandler.isElectricItem(aStack, this.mTier)) { + if (mInventory[aIndex] == null && GT_ModHandler.isElectricItem(aStack, this.mTier)) { return true; } return false; @@ -277,8 +294,8 @@ public class GT_MetaTileEntity_BasicBatteryBuffer extends GT_MetaTileEntity_Tier } public long[] getStoredEnergy() { - boolean scaleOverflow =false; - boolean storedOverflow = false; + boolean scaleOverflow = false; + boolean storedOverflow = false; long tScale = getBaseMetaTileEntity().getEUCapacity(); long tStored = getBaseMetaTileEntity().getStoredEU(); long tStep = 0; @@ -289,10 +306,14 @@ public class GT_MetaTileEntity_BasicBatteryBuffer extends GT_MetaTileEntity_Tier if (aStack.getItem() instanceof GT_MetaBase_Item) { Long[] stats = ((GT_MetaBase_Item) aStack.getItem()).getElectricStats(aStack); if (stats != null) { - if(stats[0]>Long.MAX_VALUE/2){scaleOverflow=true;} + if (stats[0] > Long.MAX_VALUE / 2) { + scaleOverflow = true; + } tScale = tScale + stats[0]; tStep = ((GT_MetaBase_Item) aStack.getItem()).getRealCharge(aStack); - if(tStep > Long.MAX_VALUE/2){storedOverflow=true;} + if (tStep > Long.MAX_VALUE / 2) { + storedOverflow = true; + } tStored = tStored + tStep; } } else if (aStack.getItem() instanceof IElectricItem) { @@ -301,11 +322,14 @@ public class GT_MetaTileEntity_BasicBatteryBuffer extends GT_MetaTileEntity_Tier } } } - } - if(scaleOverflow){tScale=Long.MAX_VALUE;} - if(storedOverflow){tStored=Long.MAX_VALUE;} - return new long[]{tStored, tScale}; + if (scaleOverflow) { + tScale = Long.MAX_VALUE; + } + if (storedOverflow) { + tStored = Long.MAX_VALUE; + } + return new long[] {tStored, tScale}; } @Override @@ -317,15 +341,16 @@ public class GT_MetaTileEntity_BasicBatteryBuffer extends GT_MetaTileEntity_Tier count = 0; } - return new String[]{ - EnumChatFormatting.BLUE+getLocalName()+EnumChatFormatting.RESET, - "Stored Items:", - EnumChatFormatting.GREEN+GT_Utility.formatNumbers(mStored) +EnumChatFormatting.RESET+ " EU / "+ - EnumChatFormatting.YELLOW+GT_Utility.formatNumbers(mMax) +EnumChatFormatting.RESET+ " EU", - "Average input:", - GT_Utility.formatNumbers(getBaseMetaTileEntity().getAverageElectricInput())+" EU/t", - "Average output:", - GT_Utility.formatNumbers(getBaseMetaTileEntity().getAverageElectricOutput())+" EU/t"}; + return new String[] { + EnumChatFormatting.BLUE + getLocalName() + EnumChatFormatting.RESET, + "Stored Items:", + EnumChatFormatting.GREEN + GT_Utility.formatNumbers(mStored) + EnumChatFormatting.RESET + " EU / " + + EnumChatFormatting.YELLOW + GT_Utility.formatNumbers(mMax) + EnumChatFormatting.RESET + " EU", + "Average input:", + GT_Utility.formatNumbers(getBaseMetaTileEntity().getAverageElectricInput()) + " EU/t", + "Average output:", + GT_Utility.formatNumbers(getBaseMetaTileEntity().getAverageElectricOutput()) + " EU/t" + }; } @Override 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 8a626460fb..091c364b4f 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 @@ -1,5 +1,7 @@ package gregtech.api.metatileentity.implementations; +import static gregtech.api.enums.GT_Values.V; + import gregtech.api.enums.ItemList; import gregtech.api.enums.OrePrefixes; import gregtech.api.enums.Textures; @@ -18,14 +20,14 @@ import net.minecraftforge.fluids.FluidStack; import net.minecraftforge.fluids.IFluidContainerItem; import net.minecraftforge.fluids.IFluidHandler; -import static gregtech.api.enums.GT_Values.V; - public abstract class GT_MetaTileEntity_BasicGenerator extends GT_MetaTileEntity_BasicTank { - public GT_MetaTileEntity_BasicGenerator(int aID, String aName, String aNameRegional, int aTier, String aDescription, ITexture... aTextures) { + public GT_MetaTileEntity_BasicGenerator( + int aID, String aName, String aNameRegional, int aTier, String aDescription, ITexture... aTextures) { super(aID, aName, aNameRegional, aTier, 3, aDescription, aTextures); } - public GT_MetaTileEntity_BasicGenerator(int aID, String aName, String aNameRegional, int aTier, String[] aDescription, ITexture... aTextures) { + public GT_MetaTileEntity_BasicGenerator( + int aID, String aName, String aNameRegional, int aTier, String[] aDescription, ITexture... aTextures) { super(aID, aName, aNameRegional, aTier, 3, aDescription, aTextures); } @@ -56,8 +58,21 @@ public abstract class GT_MetaTileEntity_BasicGenerator extends GT_MetaTileEntity } @Override - public ITexture[] getTexture(IGregTechTileEntity aBaseMetaTileEntity, byte aSide, byte aFacing, byte aColorIndex, boolean aActive, boolean aRedstone) { - return mTextures[(aActive ? 5 : 0) + (aSide == aFacing ? 0 : aSide == GT_Utility.getOppositeSide(aFacing) ? 1 : aSide == 0 ? 2 : aSide == 1 ? 3 : 4)][aColorIndex + 1]; + public ITexture[] getTexture( + IGregTechTileEntity aBaseMetaTileEntity, + byte aSide, + byte aFacing, + byte aColorIndex, + boolean aActive, + boolean aRedstone) { + return mTextures[ + (aActive ? 5 : 0) + + (aSide == aFacing + ? 0 + : aSide == GT_Utility.getOppositeSide(aFacing) + ? 1 + : aSide == 0 ? 2 : aSide == 1 ? 3 : 4)][ + aColorIndex + 1]; } @Override @@ -76,23 +91,23 @@ public abstract class GT_MetaTileEntity_BasicGenerator extends GT_MetaTileEntity } public ITexture[] getFront(byte aColor) { - return new ITexture[]{Textures.BlockIcons.MACHINE_CASINGS[mTier][aColor + 1]}; + return new ITexture[] {Textures.BlockIcons.MACHINE_CASINGS[mTier][aColor + 1]}; } public ITexture[] getBack(byte aColor) { - return new ITexture[]{Textures.BlockIcons.MACHINE_CASINGS[mTier][aColor + 1]}; + return new ITexture[] {Textures.BlockIcons.MACHINE_CASINGS[mTier][aColor + 1]}; } public ITexture[] getBottom(byte aColor) { - return new ITexture[]{Textures.BlockIcons.MACHINE_CASINGS[mTier][aColor + 1]}; + return new ITexture[] {Textures.BlockIcons.MACHINE_CASINGS[mTier][aColor + 1]}; } public ITexture[] getTop(byte aColor) { - return new ITexture[]{Textures.BlockIcons.MACHINE_CASINGS[mTier][aColor + 1]}; + return new ITexture[] {Textures.BlockIcons.MACHINE_CASINGS[mTier][aColor + 1]}; } public ITexture[] getSides(byte aColor) { - return new ITexture[]{Textures.BlockIcons.MACHINE_CASINGS[mTier][aColor + 1]}; + return new ITexture[] {Textures.BlockIcons.MACHINE_CASINGS[mTier][aColor + 1]}; } public ITexture[] getFrontActive(byte aColor) { @@ -158,7 +173,7 @@ public abstract class GT_MetaTileEntity_BasicGenerator extends GT_MetaTileEntity @Override public boolean doesFillContainers() { return getBaseMetaTileEntity().isAllowedToWork(); - //return false; + // return false; } @Override @@ -193,7 +208,7 @@ public abstract class GT_MetaTileEntity_BasicGenerator extends GT_MetaTileEntity @Override public boolean isLiquidOutput(byte aSide) { - //return super.isLiquidOutput(aSide); + // return super.isLiquidOutput(aSide); return false; } @@ -206,39 +221,50 @@ public abstract class GT_MetaTileEntity_BasicGenerator extends GT_MetaTileEntity } else { if (mInventory[getStackDisplaySlot()] == null) mInventory[getStackDisplaySlot()] = new ItemStack(Blocks.fire, 1); - mInventory[getStackDisplaySlot()].setStackDisplayName("Draining internal buffer: " + GT_Utility.formatNumbers(aBaseMetaTileEntity.getUniversalEnergyStored() - getMinimumStoredEU()) + " EU"); + mInventory[getStackDisplaySlot()].setStackDisplayName("Draining internal buffer: " + + GT_Utility.formatNumbers( + aBaseMetaTileEntity.getUniversalEnergyStored() - getMinimumStoredEU()) + + " EU"); } } else { long tFuelValue = getFuelValue(mFluid), tConsumed = consumedFluidPerOperation(mFluid); if (tFuelValue > 0 && tConsumed > 0 && mFluid.amount >= tConsumed) { - long tFluidAmountToUse = Math.min(mFluid.amount / tConsumed, (maxEUStore() - aBaseMetaTileEntity.getUniversalEnergyStored()) / tFuelValue); - //long tFluidAmountToUse = Math.min(mFluid.amount / tConsumed, (maxEUOutput() * 20 + getMinimumStoredEU() - aBaseMetaTileEntity.getUniversalEnergyStored()) / tFuelValue);//TODO CHECK - if (tFluidAmountToUse > 0 && aBaseMetaTileEntity.increaseStoredEnergyUnits(tFluidAmountToUse * tFuelValue, true)) { + long tFluidAmountToUse = Math.min( + mFluid.amount / tConsumed, + (maxEUStore() - aBaseMetaTileEntity.getUniversalEnergyStored()) / tFuelValue); + // long tFluidAmountToUse = Math.min(mFluid.amount / tConsumed, (maxEUOutput() * 20 + + // getMinimumStoredEU() - aBaseMetaTileEntity.getUniversalEnergyStored()) / tFuelValue);//TODO CHECK + if (tFluidAmountToUse > 0 + && aBaseMetaTileEntity.increaseStoredEnergyUnits(tFluidAmountToUse * tFuelValue, true)) { // divided by two because this is called every 10 ticks, not 20 - GT_Pollution.addPollution(getBaseMetaTileEntity(),getPollution()/2); + GT_Pollution.addPollution(getBaseMetaTileEntity(), getPollution() / 2); mFluid.amount -= tFluidAmountToUse * tConsumed; } } } - if (mInventory[getInputSlot()] != null && aBaseMetaTileEntity.getUniversalEnergyStored() < (maxEUOutput() * 20 + getMinimumStoredEU()) && ((GT_Utility.getFluidForFilledItem(mInventory[getInputSlot()], true) != null) || solidFuelOverride(mInventory[getInputSlot()]))) { + if (mInventory[getInputSlot()] != null + && aBaseMetaTileEntity.getUniversalEnergyStored() < (maxEUOutput() * 20 + getMinimumStoredEU()) + && ((GT_Utility.getFluidForFilledItem(mInventory[getInputSlot()], true) != null) + || solidFuelOverride(mInventory[getInputSlot()]))) { long tFuelValue = getFuelValue(mInventory[getInputSlot()]); if (tFuelValue <= 0) tFuelValue = getFuelValue(mInventory[getInputSlot()], true); - //System.out.println(" tFuelValue : " + tFuelValue ); + // System.out.println(" tFuelValue : " + tFuelValue ); if (tFuelValue > 0) { ItemStack tEmptyContainer = getEmptyContainer(mInventory[getInputSlot()]); if (aBaseMetaTileEntity.addStackToSlot(getOutputSlot(), tEmptyContainer)) { aBaseMetaTileEntity.increaseStoredEnergyUnits(tFuelValue, true); aBaseMetaTileEntity.decrStackSize(getInputSlot(), 1); // divided by two because this is called every 10 ticks, not 20 - GT_Pollution.addPollution(getBaseMetaTileEntity(),getPollution()/2); + GT_Pollution.addPollution(getBaseMetaTileEntity(), getPollution() / 2); } } } } if (aBaseMetaTileEntity.isServerSide()) - aBaseMetaTileEntity.setActive(aBaseMetaTileEntity.isAllowedToWork() && aBaseMetaTileEntity.getUniversalEnergyStored() >= maxEUOutput() + getMinimumStoredEU()); + aBaseMetaTileEntity.setActive(aBaseMetaTileEntity.isAllowedToWork() + && aBaseMetaTileEntity.getUniversalEnergyStored() >= maxEUOutput() + getMinimumStoredEU()); } /** @@ -246,18 +272,24 @@ public abstract class GT_MetaTileEntity_BasicGenerator extends GT_MetaTileEntity * @return if the stack is a solid fuel */ public boolean solidFuelOverride(ItemStack stack) { - //this could be used for a coal generator for example aswell... + // this could be used for a coal generator for example aswell... ItemData association = GT_OreDictUnificator.getAssociation(stack); - //if it is a gregtech Item, make sure its not a VOLUMETRIC_FLASK or any type of cell, else do vanilla checks + // if it is a gregtech Item, make sure its not a VOLUMETRIC_FLASK or any type of cell, else do vanilla checks if (association != null) { - return !OrePrefixes.CELL_TYPES.contains(association.mPrefix) && - !GT_Utility.areStacksEqual(ItemList.VOLUMETRIC_FLASK.get(1L), stack, true); + return !OrePrefixes.CELL_TYPES.contains(association.mPrefix) + && !GT_Utility.areStacksEqual(ItemList.VOLUMETRIC_FLASK.get(1L), stack, true); } else { - return stack != null && //when the stack is null its not a solid - stack.getItem() != null && //when the item in the stack is null its not a solid - !(stack.getItem() instanceof IFluidContainerItem) && //when the item is a fluid container its not a 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... + return stack != null + && // when the stack is null its not a solid + stack.getItem() != null + && // when the item in the stack is null its not a solid + !(stack.getItem() instanceof IFluidContainerItem) + && // when the item is a fluid container its not a 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... } } @@ -309,7 +341,9 @@ public abstract class GT_MetaTileEntity_BasicGenerator extends GT_MetaTileEntity @Override public boolean allowPutStack(IGregTechTileEntity aBaseMetaTileEntity, int aIndex, byte aSide, ItemStack aStack) { - return super.allowPutStack(aBaseMetaTileEntity, aIndex, aSide, aStack) && (getFuelValue(aStack, true) > 0 || getFuelValue(GT_Utility.getFluidForFilledItem(aStack, true), true) > 0); + return super.allowPutStack(aBaseMetaTileEntity, aIndex, aSide, aStack) + && (getFuelValue(aStack, true) > 0 + || getFuelValue(GT_Utility.getFluidForFilledItem(aStack, true), true) > 0); } @Override diff --git a/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_BasicHull.java b/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_BasicHull.java index f6535d2ddc..31420386ee 100644 --- a/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_BasicHull.java +++ b/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_BasicHull.java @@ -1,5 +1,7 @@ package gregtech.api.metatileentity.implementations; +import static gregtech.api.enums.GT_Values.V; + import gregtech.api.enums.Textures; import gregtech.api.interfaces.ITexture; import gregtech.api.interfaces.metatileentity.IMetaTileEntity; @@ -7,22 +9,30 @@ import gregtech.api.interfaces.tileentity.IGregTechTileEntity; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.ItemStack; -import static gregtech.api.enums.GT_Values.V; - public class GT_MetaTileEntity_BasicHull extends GT_MetaTileEntity_BasicTank { - public GT_MetaTileEntity_BasicHull(int aID, String aName, String aNameRegional, int aTier, String aDescription, ITexture... aTextures) { + public GT_MetaTileEntity_BasicHull( + int aID, String aName, String aNameRegional, int aTier, String aDescription, ITexture... aTextures) { super(aID, aName, aNameRegional, aTier, 1, aDescription, aTextures); } - public GT_MetaTileEntity_BasicHull(int aID, String aName, String aNameRegional, int aTier, int aInvSlotCount, String aDescription, ITexture... aTextures) { + public GT_MetaTileEntity_BasicHull( + int aID, + String aName, + String aNameRegional, + int aTier, + int aInvSlotCount, + String aDescription, + ITexture... aTextures) { super(aID, aName, aNameRegional, aTier, aInvSlotCount, aDescription, aTextures); } - public GT_MetaTileEntity_BasicHull(String aName, int aTier, int aInvSlotCount, String aDescription, ITexture[][][] aTextures) { + public GT_MetaTileEntity_BasicHull( + String aName, int aTier, int aInvSlotCount, String aDescription, ITexture[][][] aTextures) { super(aName, aTier, aInvSlotCount, aDescription, aTextures); } - - public GT_MetaTileEntity_BasicHull(String aName, int aTier, int aInvSlotCount, String[] aDescription, ITexture[][][] aTextures) { + + public GT_MetaTileEntity_BasicHull( + String aName, int aTier, int aInvSlotCount, String[] aDescription, ITexture[][][] aTextures) { super(aName, aTier, aInvSlotCount, aDescription, aTextures); } @@ -107,7 +117,13 @@ public class GT_MetaTileEntity_BasicHull extends GT_MetaTileEntity_BasicTank { } @Override - public ITexture[] getTexture(IGregTechTileEntity aBaseMetaTileEntity, byte aSide, byte aFacing, byte aColorIndex, boolean aConnected, boolean aRedstone) { + public ITexture[] getTexture( + IGregTechTileEntity aBaseMetaTileEntity, + byte aSide, + byte aFacing, + byte aColorIndex, + boolean aConnected, + boolean aRedstone) { return mTextures[Math.min(2, aSide) + (aSide == aFacing ? 3 : 0)][aColorIndex + 1]; } @@ -115,12 +131,18 @@ public class GT_MetaTileEntity_BasicHull extends GT_MetaTileEntity_BasicTank { public ITexture[][][] getTextureSet(ITexture[] aTextures) { ITexture[][][] rTextures = new ITexture[6][17][]; for (byte i = -1; i < 16; i++) { - rTextures[0][i + 1] = new ITexture[]{Textures.BlockIcons.MACHINE_CASINGS[mTier][i + 1]}; - rTextures[1][i + 1] = new ITexture[]{Textures.BlockIcons.MACHINE_CASINGS[mTier][i + 1]}; - rTextures[2][i + 1] = new ITexture[]{Textures.BlockIcons.MACHINE_CASINGS[mTier][i + 1]}; - rTextures[3][i + 1] = new ITexture[]{Textures.BlockIcons.MACHINE_CASINGS[mTier][i + 1], Textures.BlockIcons.OVERLAYS_ENERGY_OUT[mTier]}; - rTextures[4][i + 1] = new ITexture[]{Textures.BlockIcons.MACHINE_CASINGS[mTier][i + 1], Textures.BlockIcons.OVERLAYS_ENERGY_OUT[mTier]}; - rTextures[5][i + 1] = new ITexture[]{Textures.BlockIcons.MACHINE_CASINGS[mTier][i + 1], Textures.BlockIcons.OVERLAYS_ENERGY_OUT[mTier]}; + rTextures[0][i + 1] = new ITexture[] {Textures.BlockIcons.MACHINE_CASINGS[mTier][i + 1]}; + rTextures[1][i + 1] = new ITexture[] {Textures.BlockIcons.MACHINE_CASINGS[mTier][i + 1]}; + rTextures[2][i + 1] = new ITexture[] {Textures.BlockIcons.MACHINE_CASINGS[mTier][i + 1]}; + rTextures[3][i + 1] = new ITexture[] { + Textures.BlockIcons.MACHINE_CASINGS[mTier][i + 1], Textures.BlockIcons.OVERLAYS_ENERGY_OUT[mTier] + }; + rTextures[4][i + 1] = new ITexture[] { + Textures.BlockIcons.MACHINE_CASINGS[mTier][i + 1], Textures.BlockIcons.OVERLAYS_ENERGY_OUT[mTier] + }; + rTextures[5][i + 1] = new ITexture[] { + Textures.BlockIcons.MACHINE_CASINGS[mTier][i + 1], Textures.BlockIcons.OVERLAYS_ENERGY_OUT[mTier] + }; } return rTextures; } diff --git a/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_BasicHull_NonElectric.java b/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_BasicHull_NonElectric.java index 54fe2b32a6..716d9d2c12 100644 --- a/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_BasicHull_NonElectric.java +++ b/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_BasicHull_NonElectric.java @@ -4,20 +4,29 @@ import gregtech.api.interfaces.ITexture; import gregtech.api.interfaces.tileentity.IGregTechTileEntity; public abstract class GT_MetaTileEntity_BasicHull_NonElectric extends GT_MetaTileEntity_BasicHull { - public GT_MetaTileEntity_BasicHull_NonElectric(int aID, String aName, String aNameRegional, int aTier, String aDescription) { + public GT_MetaTileEntity_BasicHull_NonElectric( + int aID, String aName, String aNameRegional, int aTier, String aDescription) { super(aID, aName, aNameRegional, aTier, aDescription); } - public GT_MetaTileEntity_BasicHull_NonElectric(String aName, int aTier, String aDescription, ITexture[][][] aTextures) { + public GT_MetaTileEntity_BasicHull_NonElectric( + String aName, int aTier, String aDescription, ITexture[][][] aTextures) { super(aName, aTier, 1, aDescription, aTextures); } - public GT_MetaTileEntity_BasicHull_NonElectric(String aName, int aTier, String[] aDescription, ITexture[][][] aTextures) { + public GT_MetaTileEntity_BasicHull_NonElectric( + String aName, int aTier, String[] aDescription, ITexture[][][] aTextures) { super(aName, aTier, 1, aDescription, aTextures); } @Override - public ITexture[] getTexture(IGregTechTileEntity aBaseMetaTileEntity, byte aSide, byte aConnections, byte aColorIndex, boolean aConnected, boolean aRedstone) { + public ITexture[] getTexture( + IGregTechTileEntity aBaseMetaTileEntity, + byte aSide, + byte aConnections, + byte aColorIndex, + boolean aConnected, + boolean aRedstone) { return mTextures[Math.min(2, aSide)][aColorIndex + 1]; } 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 ce5c1b9ee4..25c7c2991e 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 @@ -1,5 +1,11 @@ package gregtech.api.metatileentity.implementations; +import static gregtech.api.enums.GT_Values.V; +import static gregtech.api.enums.GT_Values.debugCleanroom; +import static gregtech.api.enums.Textures.BlockIcons.MACHINE_CASINGS; +import static gregtech.api.enums.Textures.BlockIcons.OVERLAY_PIPE_OUT; +import static gregtech.api.util.GT_Utility.moveMultipleItemStacks; + import gregtech.GT_Mod; import gregtech.api.GregTech_API; import gregtech.api.enums.ItemList; @@ -16,6 +22,8 @@ import gregtech.api.util.GT_Recipe.GT_Recipe_Map; import gregtech.common.power.BasicMachineEUPower; import gregtech.common.power.Power; import gregtech.common.tileentities.machines.multi.GT_MetaTileEntity_Cleanroom; +import java.util.Arrays; +import java.util.List; import mcp.mobius.waila.api.IWailaConfigHandler; import mcp.mobius.waila.api.IWailaDataAccessor; import net.minecraft.entity.player.EntityPlayer; @@ -32,34 +40,32 @@ import net.minecraftforge.common.util.ForgeDirection; import net.minecraftforge.fluids.FluidStack; import net.minecraftforge.fluids.IFluidHandler; -import java.util.Arrays; -import java.util.List; - -import static gregtech.api.enums.GT_Values.V; -import static gregtech.api.enums.GT_Values.debugCleanroom; -import static gregtech.api.enums.Textures.BlockIcons.MACHINE_CASINGS; -import static gregtech.api.enums.Textures.BlockIcons.OVERLAY_PIPE_OUT; -import static gregtech.api.util.GT_Utility.moveMultipleItemStacks; - /** * NEVER INCLUDE THIS FILE IN YOUR MOD!!! * <p/> * This is the main construct for my Basic Machines such as the Automatic Extractor * Extend this class to make a simple Machine */ -public abstract class GT_MetaTileEntity_BasicMachine extends GT_MetaTileEntity_BasicTank implements IConfigurationCircuitSupport { +public abstract class GT_MetaTileEntity_BasicMachine extends GT_MetaTileEntity_BasicTank + implements IConfigurationCircuitSupport { /** * return values for checkRecipe() */ - protected static final int - DID_NOT_FIND_RECIPE = 0, + protected static final int DID_NOT_FIND_RECIPE = 0, FOUND_RECIPE_BUT_DID_NOT_MEET_REQUIREMENTS = 1, FOUND_AND_SUCCESSFULLY_USED_RECIPE = 2; + public static final int OTHER_SLOT_COUNT = 5; public final ItemStack[] mOutputItems; public final int mInputSlotCount, mAmperage; - public boolean mAllowInputFromOutputSide = false, mFluidTransfer = false, mItemTransfer = false, mHasBeenUpdated = false, mStuttering = false, mCharge = false, mDecharge = false; + public boolean mAllowInputFromOutputSide = false, + mFluidTransfer = false, + mItemTransfer = false, + mHasBeenUpdated = false, + mStuttering = false, + mCharge = false, + mDecharge = false; public boolean mDisableFilter = true; public boolean mDisableMultiStack = true; public int mMainFacing = -1, mProgresstime = 0, mMaxProgresstime = 0, mEUt = 0, mOutputBlocked = 0; @@ -71,6 +77,7 @@ public abstract class GT_MetaTileEntity_BasicMachine extends GT_MetaTileEntity_B * Contains the Recipe which has been previously used, or null if there was no previous Recipe, which could have been buffered */ protected GT_Recipe mLastRecipe = null; + private FluidStack mFluidOut; /** @@ -90,8 +97,26 @@ public abstract class GT_MetaTileEntity_BasicMachine extends GT_MetaTileEntity_B * 12 = SideFacingPipeActive * 13 = SideFacingPipeInactive */ - public GT_MetaTileEntity_BasicMachine(int aID, String aName, String aNameRegional, int aTier, int aAmperage, String aDescription, int aInputSlotCount, int aOutputSlotCount, String aGUIName, String aNEIName, ITexture... aOverlays) { - super(aID, aName, aNameRegional, aTier, OTHER_SLOT_COUNT + aInputSlotCount + aOutputSlotCount + 1, aDescription, aOverlays); + public GT_MetaTileEntity_BasicMachine( + int aID, + String aName, + String aNameRegional, + int aTier, + int aAmperage, + String aDescription, + int aInputSlotCount, + int aOutputSlotCount, + String aGUIName, + String aNEIName, + ITexture... aOverlays) { + super( + aID, + aName, + aNameRegional, + aTier, + OTHER_SLOT_COUNT + aInputSlotCount + aOutputSlotCount + 1, + aDescription, + aOverlays); mInputSlotCount = Math.max(0, aInputSlotCount); mOutputItems = new ItemStack[Math.max(0, aOutputSlotCount)]; mAmperage = aAmperage; @@ -100,8 +125,26 @@ public abstract class GT_MetaTileEntity_BasicMachine extends GT_MetaTileEntity_B mPower = buildPower(); } - public GT_MetaTileEntity_BasicMachine(int aID, String aName, String aNameRegional, int aTier, int aAmperage, String[] aDescription, int aInputSlotCount, int aOutputSlotCount, String aGUIName, String aNEIName, ITexture... aOverlays) { - super(aID, aName, aNameRegional, aTier, OTHER_SLOT_COUNT + aInputSlotCount + aOutputSlotCount + 1, aDescription, aOverlays); + public GT_MetaTileEntity_BasicMachine( + int aID, + String aName, + String aNameRegional, + int aTier, + int aAmperage, + String[] aDescription, + int aInputSlotCount, + int aOutputSlotCount, + String aGUIName, + String aNEIName, + ITexture... aOverlays) { + super( + aID, + aName, + aNameRegional, + aTier, + OTHER_SLOT_COUNT + aInputSlotCount + aOutputSlotCount + 1, + aDescription, + aOverlays); mInputSlotCount = Math.max(0, aInputSlotCount); mOutputItems = new ItemStack[Math.max(0, aOutputSlotCount)]; mAmperage = aAmperage; @@ -109,7 +152,17 @@ public abstract class GT_MetaTileEntity_BasicMachine extends GT_MetaTileEntity_B mNEIName = aNEIName; mPower = buildPower(); } - public GT_MetaTileEntity_BasicMachine(String aName, int aTier, int aAmperage, String aDescription, ITexture[][][] aTextures, int aInputSlotCount, int aOutputSlotCount, String aGUIName, String aNEIName) { + + public GT_MetaTileEntity_BasicMachine( + String aName, + int aTier, + int aAmperage, + String aDescription, + ITexture[][][] aTextures, + int aInputSlotCount, + int aOutputSlotCount, + String aGUIName, + String aNEIName) { super(aName, aTier, OTHER_SLOT_COUNT + aInputSlotCount + aOutputSlotCount + 1, aDescription, aTextures); mInputSlotCount = Math.max(0, aInputSlotCount); mOutputItems = new ItemStack[Math.max(0, aOutputSlotCount)]; @@ -119,7 +172,16 @@ public abstract class GT_MetaTileEntity_BasicMachine extends GT_MetaTileEntity_B mPower = buildPower(); } - public GT_MetaTileEntity_BasicMachine(String aName, int aTier, int aAmperage, String[] aDescription, ITexture[][][] aTextures, int aInputSlotCount, int aOutputSlotCount, String aGUIName, String aNEIName) { + public GT_MetaTileEntity_BasicMachine( + String aName, + int aTier, + int aAmperage, + String[] aDescription, + ITexture[][][] aTextures, + int aInputSlotCount, + int aOutputSlotCount, + String aGUIName, + String aNEIName) { super(aName, aTier, OTHER_SLOT_COUNT + aInputSlotCount + aOutputSlotCount + 1, aDescription, aTextures); mInputSlotCount = Math.max(0, aInputSlotCount); mOutputItems = new ItemStack[Math.max(0, aOutputSlotCount)]; @@ -137,18 +199,18 @@ public abstract class GT_MetaTileEntity_BasicMachine extends GT_MetaTileEntity_B } protected boolean isValidMainFacing(byte aSide) { - return aSide > 1; + return aSide > 1; } - public boolean setMainFacing(byte aSide){ - if (!isValidMainFacing(aSide)) return false; - mMainFacing = aSide; - if(getBaseMetaTileEntity().getFrontFacing() == mMainFacing){ - getBaseMetaTileEntity().setFrontFacing(GT_Utility.getOppositeSide(aSide)); - } + public boolean setMainFacing(byte aSide) { + if (!isValidMainFacing(aSide)) return false; + mMainFacing = aSide; + if (getBaseMetaTileEntity().getFrontFacing() == mMainFacing) { + getBaseMetaTileEntity().setFrontFacing(GT_Utility.getOppositeSide(aSide)); + } onFacingChange(); onMachineBlockUpdate(); - return true; + return true; } @Override @@ -157,10 +219,11 @@ public abstract class GT_MetaTileEntity_BasicMachine extends GT_MetaTileEntity_B aTextures = Arrays.copyOf(aTextures, 14); for (int i = 0; i < aTextures.length; i++) - if (aTextures[i] != null) for (byte c = -1; c < 16; c++) { - if (rTextures[i][c + 1] == null) - rTextures[i][c + 1] = new ITexture[]{MACHINE_CASINGS[mTier][c + 1], aTextures[i]}; - } + if (aTextures[i] != null) + for (byte c = -1; c < 16; c++) { + if (rTextures[i][c + 1] == null) + rTextures[i][c + 1] = new ITexture[] {MACHINE_CASINGS[mTier][c + 1], aTextures[i]}; + } for (byte c = -1; c < 16; c++) { if (rTextures[0][c + 1] == null) rTextures[0][c + 1] = getSideFacingActive(c); @@ -182,8 +245,28 @@ public abstract class GT_MetaTileEntity_BasicMachine extends GT_MetaTileEntity_B } @Override - public ITexture[] getTexture(IGregTechTileEntity aBaseMetaTileEntity, byte aSide, byte aFacing, byte aColorIndex, boolean aActive, boolean aRedstone) { - return mTextures[mMainFacing < 2 ? aSide == aFacing ? aActive ? 2 : 3 : aSide == 0 ? aActive ? 6 : 7 : aSide == 1 ? aActive ? 4 : 5 : aActive ? 0 : 1 : aSide == mMainFacing ? aActive ? 2 : 3 : (showPipeFacing() && aSide == aFacing) ? aSide == 0 ? aActive ? 8 : 9 : aSide == 1 ? aActive ? 10 : 11 : aActive ? 12 : 13 : aSide == 0 ? aActive ? 6 : 7 : aSide == 1 ? aActive ? 4 : 5 : aActive ? 0 : 1][aColorIndex + 1]; + public ITexture[] getTexture( + IGregTechTileEntity aBaseMetaTileEntity, + byte aSide, + byte aFacing, + byte aColorIndex, + boolean aActive, + boolean aRedstone) { + return mTextures[ + mMainFacing < 2 + ? aSide == aFacing + ? aActive ? 2 : 3 + : aSide == 0 ? aActive ? 6 : 7 : aSide == 1 ? aActive ? 4 : 5 : aActive ? 0 : 1 + : aSide == mMainFacing + ? aActive ? 2 : 3 + : (showPipeFacing() && aSide == aFacing) + ? aSide == 0 + ? aActive ? 8 : 9 + : aSide == 1 ? aActive ? 10 : 11 : aActive ? 12 : 13 + : aSide == 0 + ? aActive ? 6 : 7 + : aSide == 1 ? aActive ? 4 : 5 : aActive ? 0 : 1][ + aColorIndex + 1]; } @Override @@ -208,7 +291,10 @@ public abstract class GT_MetaTileEntity_BasicMachine extends GT_MetaTileEntity_B @Override public boolean isValidSlot(int aIndex) { - return aIndex > 0 && super.isValidSlot(aIndex) && aIndex != getCircuitSlot() && aIndex != OTHER_SLOT_COUNT + mInputSlotCount + mOutputItems.length; + return aIndex > 0 + && super.isValidSlot(aIndex) + && aIndex != getCircuitSlot() + && aIndex != OTHER_SLOT_COUNT + mInputSlotCount + mOutputItems.length; } @Override @@ -238,7 +324,9 @@ public abstract class GT_MetaTileEntity_BasicMachine extends GT_MetaTileEntity_B @Override public boolean isLiquidInput(byte aSide) { - return aSide != mMainFacing && (mAllowInputFromOutputSide || aSide != getBaseMetaTileEntity().getFrontFacing()); + return aSide != mMainFacing + && (mAllowInputFromOutputSide + || aSide != getBaseMetaTileEntity().getFrontFacing()); } @Override @@ -268,7 +356,7 @@ public abstract class GT_MetaTileEntity_BasicMachine extends GT_MetaTileEntity_B @Override public long maxAmperesIn() { - return ((long)mEUt * 2L) / V[mTier] + 1L; + return ((long) mEUt * 2L) / V[mTier] + 1L; } @Override @@ -329,7 +417,8 @@ public abstract class GT_MetaTileEntity_BasicMachine extends GT_MetaTileEntity_B @Override public boolean isFluidInputAllowed(FluidStack aFluid) { - return getFillableStack() != null || (getRecipeList() != null && getRecipeList().containsInput(aFluid)); + return getFillableStack() != null + || (getRecipeList() != null && getRecipeList().containsInput(aFluid)); } @Override @@ -392,17 +481,17 @@ public abstract class GT_MetaTileEntity_BasicMachine extends GT_MetaTileEntity_B @Override public boolean onRightclick(IGregTechTileEntity aBaseMetaTileEntity, EntityPlayer aPlayer) { if (aBaseMetaTileEntity.isClientSide()) return true; - if(!GT_Mod.gregtechproxy.mForceFreeFace) { - aBaseMetaTileEntity.openGUI(aPlayer); - return true; + if (!GT_Mod.gregtechproxy.mForceFreeFace) { + aBaseMetaTileEntity.openGUI(aPlayer); + return true; } - for(byte i=0;i < 6; i++){ - if(aBaseMetaTileEntity.getAirAtSide(i)){ - aBaseMetaTileEntity.openGUI(aPlayer); - return true; - } + for (byte i = 0; i < 6; i++) { + if (aBaseMetaTileEntity.getAirAtSide(i)) { + aBaseMetaTileEntity.openGUI(aPlayer); + return true; + } } - GT_Utility.sendChatToPlayer(aPlayer,"No free Side!"); + GT_Utility.sendChatToPlayer(aPlayer, "No free Side!"); return true; } @@ -413,14 +502,22 @@ public abstract class GT_MetaTileEntity_BasicMachine extends GT_MetaTileEntity_B @Override public Object getClientGUI(int aID, InventoryPlayer aPlayerInventory, IGregTechTileEntity aBaseMetaTileEntity) { - return new GT_GUIContainer_BasicMachine(aPlayerInventory, aBaseMetaTileEntity, getLocalName(), mGUIName, GT_Utility.isStringValid(mNEIName) ? mNEIName : getRecipeList() != null ? getRecipeList().mUnlocalizedName : ""); + return new GT_GUIContainer_BasicMachine( + aPlayerInventory, + aBaseMetaTileEntity, + getLocalName(), + mGUIName, + GT_Utility.isStringValid(mNEIName) + ? mNEIName + : getRecipeList() != null ? getRecipeList().mUnlocalizedName : ""); } @Override 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(); @@ -487,8 +584,8 @@ public abstract class GT_MetaTileEntity_BasicMachine extends GT_MetaTileEntity_B 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])) - break; + if (aBaseMetaTileEntity.addStackToSlot( + getOutputSlot() + ((j + i) % mOutputItems.length), mOutputItems[i])) break; if (mOutputFluid != null) if (getDrainableStack() == null) setDrainableStack(mOutputFluid.copy()); else if (mOutputFluid.isFluidEqual(getDrainableStack())) @@ -503,8 +600,11 @@ public abstract class GT_MetaTileEntity_BasicMachine extends GT_MetaTileEntity_B endProcess(); } if (mProgresstime > 5) mStuttering = false; - //XSTR aXSTR = new XSTR(); - //if(GT_Mod.gregtechproxy.mAprilFool && aXSTR.nextInt(5000)==0)GT_Utility.sendSoundToPlayers(aBaseMetaTileEntity.getWorld(), GregTech_API.sSoundList.get(5), 10.0F, -1.0F, aBaseMetaTileEntity.getXCoord(), aBaseMetaTileEntity.getYCoord(),aBaseMetaTileEntity.getZCoord()); + // XSTR aXSTR = new XSTR(); + // if(GT_Mod.gregtechproxy.mAprilFool && + // aXSTR.nextInt(5000)==0)GT_Utility.sendSoundToPlayers(aBaseMetaTileEntity.getWorld(), + // GregTech_API.sSoundList.get(5), 10.0F, -1.0F, aBaseMetaTileEntity.getXCoord(), + // aBaseMetaTileEntity.getYCoord(),aBaseMetaTileEntity.getZCoord()); } else { if (!mStuttering) { stutterProcess(); @@ -518,38 +618,72 @@ public abstract class GT_MetaTileEntity_BasicMachine extends GT_MetaTileEntity_B boolean tRemovedOutputFluid = false; - if (doesAutoOutputFluids() && getDrainableStack() != null && aBaseMetaTileEntity.getFrontFacing() != mMainFacing && (tSucceeded || aTick % 20 == 0)) { + if (doesAutoOutputFluids() + && getDrainableStack() != null + && aBaseMetaTileEntity.getFrontFacing() != mMainFacing + && (tSucceeded || aTick % 20 == 0)) { IFluidHandler tTank = aBaseMetaTileEntity.getITankContainerAtSide(aBaseMetaTileEntity.getFrontFacing()); if (tTank != null) { FluidStack tDrained = drain(1000, false); if (tDrained != null) { - int tFilledAmount = tTank.fill(ForgeDirection.getOrientation(aBaseMetaTileEntity.getBackFacing()), tDrained, false); + int tFilledAmount = tTank.fill( + ForgeDirection.getOrientation(aBaseMetaTileEntity.getBackFacing()), tDrained, false); if (tFilledAmount > 0) - tTank.fill(ForgeDirection.getOrientation(aBaseMetaTileEntity.getBackFacing()), drain(tFilledAmount, true), true); + tTank.fill( + ForgeDirection.getOrientation(aBaseMetaTileEntity.getBackFacing()), + drain(tFilledAmount, true), + true); } } if (getDrainableStack() == null) tRemovedOutputFluid = true; } - if (doesAutoOutput() && !isOutputEmpty() && aBaseMetaTileEntity.getFrontFacing() != mMainFacing && (tSucceeded || mOutputBlocked % 300 == 1 || aBaseMetaTileEntity.hasInventoryBeenModified() || aTick % 600 == 0)) { + if (doesAutoOutput() + && !isOutputEmpty() + && aBaseMetaTileEntity.getFrontFacing() != mMainFacing + && (tSucceeded + || mOutputBlocked % 300 == 1 + || aBaseMetaTileEntity.hasInventoryBeenModified() + || aTick % 600 == 0)) { TileEntity tTileEntity2 = aBaseMetaTileEntity.getTileEntityAtSide(aBaseMetaTileEntity.getFrontFacing()); long tStoredEnergy = aBaseMetaTileEntity.getUniversalEnergyStored(); - int tMaxStacks = (int)(tStoredEnergy/64L); - if (tMaxStacks > mOutputItems.length) - tMaxStacks = mOutputItems.length; - - moveMultipleItemStacks(aBaseMetaTileEntity, tTileEntity2, aBaseMetaTileEntity.getFrontFacing(), aBaseMetaTileEntity.getBackFacing(), null, false, (byte) 64, (byte) 1, (byte) 64, (byte) 1,tMaxStacks); -// for (int i = 0, tCosts = 1; i < mOutputItems.length && tCosts > 0 && aBaseMetaTileEntity.isUniversalEnergyStored(128); i++) { -// tCosts = GT_Utility.moveOneItemStack(aBaseMetaTileEntity, tTileEntity2, aBaseMetaTileEntity.getFrontFacing(), aBaseMetaTileEntity.getBackFacing(), null, false, (byte) 64, (byte) 1, (byte) 64, (byte) 1); -// if (tCosts > 0) aBaseMetaTileEntity.decreaseStoredEnergyUnits(tCosts, true); -// } + int tMaxStacks = (int) (tStoredEnergy / 64L); + if (tMaxStacks > mOutputItems.length) tMaxStacks = mOutputItems.length; + + moveMultipleItemStacks( + aBaseMetaTileEntity, + tTileEntity2, + aBaseMetaTileEntity.getFrontFacing(), + aBaseMetaTileEntity.getBackFacing(), + null, + false, + (byte) 64, + (byte) 1, + (byte) 64, + (byte) 1, + tMaxStacks); + // for (int i = 0, tCosts = 1; i < mOutputItems.length && tCosts > 0 && + // aBaseMetaTileEntity.isUniversalEnergyStored(128); i++) { + // tCosts = GT_Utility.moveOneItemStack(aBaseMetaTileEntity, tTileEntity2, + // aBaseMetaTileEntity.getFrontFacing(), aBaseMetaTileEntity.getBackFacing(), null, false, (byte) 64, + // (byte) 1, (byte) 64, (byte) 1); + // if (tCosts > 0) aBaseMetaTileEntity.decreaseStoredEnergyUnits(tCosts, true); + // } } - if (mOutputBlocked != 0) if (isOutputEmpty()) mOutputBlocked = 0; - else mOutputBlocked++; + if (mOutputBlocked != 0) + if (isOutputEmpty()) mOutputBlocked = 0; + else mOutputBlocked++; if (allowToCheckRecipe()) { - if (mMaxProgresstime <= 0 && aBaseMetaTileEntity.isAllowedToWork() && (tRemovedOutputFluid || tSucceeded || aBaseMetaTileEntity.hasInventoryBeenModified() || aTick % 600 == 0 || aBaseMetaTileEntity.hasWorkJustBeenEnabled()) && hasEnoughEnergyToCheckRecipe()) { + if (mMaxProgresstime <= 0 + && aBaseMetaTileEntity.isAllowedToWork() + && (tRemovedOutputFluid + || tSucceeded + || aBaseMetaTileEntity.hasInventoryBeenModified() + || aTick % 600 == 0 + || aBaseMetaTileEntity.hasWorkJustBeenEnabled()) + && hasEnoughEnergyToCheckRecipe()) { if (checkRecipe() == FOUND_AND_SUCCESSFULLY_USED_RECIPE) { if (mInventory[3] != null && mInventory[3].stackSize <= 0) mInventory[3] = null; for (int i = getInputSlot(), j = i + mInputSlotCount; i < j; i++) @@ -584,7 +718,8 @@ public abstract class GT_MetaTileEntity_BasicMachine extends GT_MetaTileEntity_B // Value | Class | Field // 1 | GT_MetaTileEntity_BasicMachine | mStuttering // 64 | GT_MetaTileEntity_BasicMachine_Bronze | mNeedsSteamVenting - aBaseMetaTileEntity.setErrorDisplayID((aBaseMetaTileEntity.getErrorDisplayID() & ~127));// | (mStuttering ? 1 : 0)); + aBaseMetaTileEntity.setErrorDisplayID( + (aBaseMetaTileEntity.getErrorDisplayID() & ~127)); // | (mStuttering ? 1 : 0)); } protected void doDisplayThings() { @@ -606,7 +741,8 @@ 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()); } } } @@ -649,14 +785,20 @@ public abstract class GT_MetaTileEntity_BasicMachine extends GT_MetaTileEntity_B } protected boolean canOutput(GT_Recipe aRecipe) { - return aRecipe != null && (aRecipe.mNeedsEmptyOutput ? isOutputEmpty() && getDrainableStack() == null : canOutput(aRecipe.getFluidOutput(0)) && canOutput(aRecipe.mOutputs)); + return aRecipe != null + && (aRecipe.mNeedsEmptyOutput + ? isOutputEmpty() && getDrainableStack() == null + : canOutput(aRecipe.getFluidOutput(0)) && canOutput(aRecipe.mOutputs)); } protected boolean canOutput(ItemStack... aOutputs) { if (aOutputs == null) return true; ItemStack[] tOutputSlots = getAllOutputs(); for (int i = 0; i < tOutputSlots.length && i < aOutputs.length; i++) - if (tOutputSlots[i] != null && aOutputs[i] != null && (!GT_Utility.areStacksEqual(tOutputSlots[i], aOutputs[i], false) || tOutputSlots[i].stackSize + aOutputs[i].stackSize > tOutputSlots[i].getMaxStackSize())) { + if (tOutputSlots[i] != null + && aOutputs[i] != null + && (!GT_Utility.areStacksEqual(tOutputSlots[i], aOutputs[i], false) + || tOutputSlots[i].stackSize + aOutputs[i].stackSize > tOutputSlots[i].getMaxStackSize())) { mOutputBlocked++; return false; } @@ -664,7 +806,11 @@ public abstract class GT_MetaTileEntity_BasicMachine extends GT_MetaTileEntity_B } protected boolean canOutput(FluidStack aOutput) { - return getDrainableStack() == null || aOutput == null || (getDrainableStack().isFluidEqual(aOutput) && (getDrainableStack().amount <= 0 || getDrainableStack().amount + aOutput.amount <= getCapacity())); + return getDrainableStack() == null + || aOutput == null + || (getDrainableStack().isFluidEqual(aOutput) + && (getDrainableStack().amount <= 0 + || getDrainableStack().amount + aOutput.amount <= getCapacity())); } protected ItemStack getInputAt(int aIndex) { @@ -675,8 +821,7 @@ public abstract class GT_MetaTileEntity_BasicMachine extends GT_MetaTileEntity_B int tRealInputSlotCount = this.mInputSlotCount + (allowSelectCircuit() ? 1 : 0); ItemStack[] rInputs = new ItemStack[tRealInputSlotCount]; for (int i = 0; i < mInputSlotCount; i++) rInputs[i] = getInputAt(i); - if (allowSelectCircuit()) - rInputs[mInputSlotCount] = getStackInSlot(getCircuitSlot()); + if (allowSelectCircuit()) rInputs[mInputSlotCount] = getStackInSlot(getCircuitSlot()); return rInputs; } @@ -771,17 +916,21 @@ public abstract class GT_MetaTileEntity_BasicMachine extends GT_MetaTileEntity_B @Override public String[] getInfoData() { - return new String[]{ - EnumChatFormatting.BLUE + mNEIName + EnumChatFormatting.RESET, - "Progress:", - EnumChatFormatting.GREEN + GT_Utility.formatNumbers((mProgresstime/20)) + EnumChatFormatting.RESET +" s / " + - EnumChatFormatting.YELLOW + GT_Utility.formatNumbers(mMaxProgresstime / 20) + EnumChatFormatting.RESET + " s", - "Stored Energy:", - EnumChatFormatting.GREEN + GT_Utility.formatNumbers(getBaseMetaTileEntity().getStoredEU()) + EnumChatFormatting.RESET + " EU / " + - EnumChatFormatting.YELLOW + GT_Utility.formatNumbers(getBaseMetaTileEntity().getEUCapacity()) + EnumChatFormatting.RESET + " EU", - "Probably uses: " + - EnumChatFormatting.RED + GT_Utility.formatNumbers(mEUt) + EnumChatFormatting.RESET + " EU/t at " + - EnumChatFormatting.RED + GT_Utility.formatNumbers(mEUt == 0 ? 0 : mAmperage) + EnumChatFormatting.RESET +" A" + return new String[] { + EnumChatFormatting.BLUE + mNEIName + EnumChatFormatting.RESET, + "Progress:", + EnumChatFormatting.GREEN + GT_Utility.formatNumbers((mProgresstime / 20)) + EnumChatFormatting.RESET + + " s / " + EnumChatFormatting.YELLOW + GT_Utility.formatNumbers(mMaxProgresstime / 20) + + EnumChatFormatting.RESET + " s", + "Stored Energy:", + EnumChatFormatting.GREEN + + GT_Utility.formatNumbers(getBaseMetaTileEntity().getStoredEU()) + EnumChatFormatting.RESET + + " EU / " + EnumChatFormatting.YELLOW + + GT_Utility.formatNumbers(getBaseMetaTileEntity().getEUCapacity()) + EnumChatFormatting.RESET + + " EU", + "Probably uses: " + EnumChatFormatting.RED + + GT_Utility.formatNumbers(mEUt) + EnumChatFormatting.RESET + " EU/t at " + EnumChatFormatting.RED + + GT_Utility.formatNumbers(mEUt == 0 ? 0 : mAmperage) + EnumChatFormatting.RESET + " A" }; } @@ -793,24 +942,31 @@ public abstract class GT_MetaTileEntity_BasicMachine extends GT_MetaTileEntity_B @Override public void onScrewdriverRightClick(byte aSide, EntityPlayer aPlayer, float aX, float aY, float aZ) { if (aSide == getBaseMetaTileEntity().getFrontFacing() || aSide == mMainFacing) { - if (aPlayer.isSneaking()){ + if (aPlayer.isSneaking()) { mDisableFilter = !mDisableFilter; - GT_Utility.sendChatToPlayer(aPlayer, StatCollector.translateToLocal("GT5U.hatch.disableFilter." + mDisableFilter)); + GT_Utility.sendChatToPlayer( + aPlayer, StatCollector.translateToLocal("GT5U.hatch.disableFilter." + mDisableFilter)); } else { mAllowInputFromOutputSide = !mAllowInputFromOutputSide; - GT_Utility.sendChatToPlayer(aPlayer, mAllowInputFromOutputSide ? GT_Utility.trans("095", "Input from Output Side allowed") : GT_Utility.trans("096", "Input from Output Side forbidden")); + GT_Utility.sendChatToPlayer( + aPlayer, + mAllowInputFromOutputSide + ? GT_Utility.trans("095", "Input from Output Side allowed") + : GT_Utility.trans("096", "Input from Output Side forbidden")); } } } @Override - public boolean onSolderingToolRightClick(byte aSide, byte aWrenchingSide, EntityPlayer aPlayer, float aX, float aY, float aZ) { - if(!aPlayer.isSneaking()) return false; + public boolean onSolderingToolRightClick( + byte aSide, byte aWrenchingSide, EntityPlayer aPlayer, float aX, float aY, float aZ) { + if (!aPlayer.isSneaking()) return false; boolean click = super.onSolderingToolRightClick(aSide, aWrenchingSide, aPlayer, aX, aY, aZ); if (click) return true; if (aWrenchingSide != mMainFacing) return false; mDisableMultiStack = !mDisableMultiStack; - GT_Utility.sendChatToPlayer(aPlayer, StatCollector.translateToLocal("GT5U.hatch.disableMultiStack." + mDisableMultiStack)); + GT_Utility.sendChatToPlayer( + aPlayer, StatCollector.translateToLocal("GT5U.hatch.disableMultiStack." + mDisableMultiStack)); return true; } @@ -818,7 +974,12 @@ public abstract class GT_MetaTileEntity_BasicMachine extends GT_MetaTileEntity_B public boolean allowCoverOnSide(byte aSide, GT_ItemStack aCoverID) { if (aSide != mMainFacing) return true; GT_CoverBehaviorBase<?> tBehavior = GregTech_API.getCoverBehaviorNew(aCoverID.toStack()); - return tBehavior.isGUIClickable(aSide, GT_Utility.stackToInt(aCoverID.toStack()), tBehavior.createDataObject(), getBaseMetaTileEntity());} + return tBehavior.isGUIClickable( + aSide, + GT_Utility.stackToInt(aCoverID.toStack()), + tBehavior.createDataObject(), + getBaseMetaTileEntity()); + } @Override public boolean allowPullStack(IGregTechTileEntity aBaseMetaTileEntity, int aIndex, byte aSide, ItemStack aStack) { @@ -827,10 +988,13 @@ public abstract class GT_MetaTileEntity_BasicMachine extends GT_MetaTileEntity_B @Override public boolean allowPutStack(IGregTechTileEntity aBaseMetaTileEntity, int aIndex, byte aSide, ItemStack aStack) { - if (aSide == mMainFacing || aIndex < getInputSlot() || aIndex >= getInputSlot() + mInputSlotCount || (!mAllowInputFromOutputSide && aSide == aBaseMetaTileEntity.getFrontFacing())) - return false; + if (aSide == mMainFacing + || aIndex < getInputSlot() + || aIndex >= getInputSlot() + mInputSlotCount + || (!mAllowInputFromOutputSide && aSide == aBaseMetaTileEntity.getFrontFacing())) return false; for (int i = getInputSlot(), j = i + mInputSlotCount; i < j; i++) - if (GT_Utility.areStacksEqual(GT_OreDictUnificator.get(aStack), mInventory[i]) && mDisableMultiStack) return i == aIndex; + if (GT_Utility.areStacksEqual(GT_OreDictUnificator.get(aStack), mInventory[i]) && mDisableMultiStack) + return i == aIndex; return mDisableFilter || allowPutStackValidated(aBaseMetaTileEntity, aIndex, aSide, aStack); } @@ -839,7 +1003,8 @@ public abstract class GT_MetaTileEntity_BasicMachine extends GT_MetaTileEntity_B * If mDisableMultiStack is false, before execution of this method it is ensured there is no such kind of item inside any input slots already. * Otherwise, you don't need to check for it anyway. */ - protected boolean allowPutStackValidated(IGregTechTileEntity aBaseMetaTileEntity, int aIndex, byte aSide, ItemStack aStack) { + protected boolean allowPutStackValidated( + IGregTechTileEntity aBaseMetaTileEntity, int aIndex, byte aSide, ItemStack aStack) { return !mDisableMultiStack || mInventory[aIndex] == null; } @@ -866,7 +1031,9 @@ public abstract class GT_MetaTileEntity_BasicMachine extends GT_MetaTileEntity_B } @Override - public int getCircuitGUISlot() { return 3; } + public int getCircuitGUISlot() { + return 3; + } @Override public List<ItemStack> getConfigurationCircuits() { @@ -893,16 +1060,15 @@ public abstract class GT_MetaTileEntity_BasicMachine extends GT_MetaTileEntity_B return checkRecipe(false); } - 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"); + 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"); } - /** * * @param skipOC disables OverclockedNess calculation and check - if you do you must implement your own method... @@ -910,43 +1076,53 @@ public abstract class GT_MetaTileEntity_BasicMachine extends GT_MetaTileEntity_B * FOUND_RECIPE_BUT_DID_NOT_MEET_REQUIREMENTS = 1, * FOUND_AND_SUCCESSFULLY_USED_RECIPE = 2; */ - public int checkRecipe(boolean skipOC){ + public int checkRecipe(boolean skipOC) { GT_Recipe_Map tMap = getRecipeList(); if (tMap == null) return DID_NOT_FIND_RECIPE; - GT_Recipe tRecipe = tMap.findRecipe(getBaseMetaTileEntity(), mLastRecipe, false, V[mTier], new FluidStack[]{getFillableStack()}, getSpecialSlot(), getAllInputs()); + GT_Recipe tRecipe = tMap.findRecipe( + getBaseMetaTileEntity(), + mLastRecipe, + false, + V[mTier], + new FluidStack[] {getFillableStack()}, + getSpecialSlot(), + getAllInputs()); if (tRecipe == null) return DID_NOT_FIND_RECIPE; - if (GT_Mod.gregtechproxy.mLowGravProcessing && (tRecipe.mSpecialValue == -100 || tRecipe.mSpecialValue == -300) && - !isValidForLowGravity(tRecipe,getBaseMetaTileEntity().getWorld().provider.dimensionId)) + if (GT_Mod.gregtechproxy.mLowGravProcessing + && (tRecipe.mSpecialValue == -100 || tRecipe.mSpecialValue == -300) + && !isValidForLowGravity(tRecipe, getBaseMetaTileEntity().getWorld().provider.dimensionId)) return FOUND_RECIPE_BUT_DID_NOT_MEET_REQUIREMENTS; if (tRecipe.mCanBeBuffered) mLastRecipe = tRecipe; if (!canOutput(tRecipe)) { mOutputBlocked++; return FOUND_RECIPE_BUT_DID_NOT_MEET_REQUIREMENTS; } - if (tRecipe.mSpecialValue == -200 && (getCallbackBase() == null || !(getCallbackBase() instanceof GT_MetaTileEntity_Cleanroom) || ((GT_MetaTileEntity_Cleanroom) getCallbackBase()).mEfficiency == 0)) + if (tRecipe.mSpecialValue == -200 + && (getCallbackBase() == null + || !(getCallbackBase() instanceof GT_MetaTileEntity_Cleanroom) + || ((GT_MetaTileEntity_Cleanroom) getCallbackBase()).mEfficiency == 0)) return FOUND_RECIPE_BUT_DID_NOT_MEET_REQUIREMENTS; - if (!tRecipe.isRecipeInputEqual(true, new FluidStack[]{getFillableStack()}, getAllInputs())) + if (!tRecipe.isRecipeInputEqual(true, new FluidStack[] {getFillableStack()}, getAllInputs())) return FOUND_RECIPE_BUT_DID_NOT_MEET_REQUIREMENTS; for (int i = 0; i < mOutputItems.length; i++) if (getBaseMetaTileEntity().getRandomNumber(10000) < tRecipe.getOutputChance(i)) mOutputItems[i] = tRecipe.getOutput(i); if (tRecipe.mSpecialValue == -200 || tRecipe.mSpecialValue == -300) for (int i = 0; i < mOutputItems.length; i++) - if (mOutputItems[i] != null && getBaseMetaTileEntity().getRandomNumber(10000) > ((GT_MetaTileEntity_Cleanroom) getCallbackBase()).mEfficiency) - { - if (debugCleanroom) { - GT_Log.out.println( - "BasicMachine: Voiding output due to efficiency failure. mEfficiency = " + - ((GT_MetaTileEntity_Cleanroom) getCallbackBase()).mEfficiency - ); - } + if (mOutputItems[i] != null + && getBaseMetaTileEntity().getRandomNumber(10000) + > ((GT_MetaTileEntity_Cleanroom) getCallbackBase()).mEfficiency) { + if (debugCleanroom) { + GT_Log.out.println("BasicMachine: Voiding output due to efficiency failure. mEfficiency = " + + ((GT_MetaTileEntity_Cleanroom) getCallbackBase()).mEfficiency); + } mOutputItems[i] = null; } mOutputFluid = tRecipe.getFluidOutput(0); - if(!skipOC){ + if (!skipOC) { calculateOverclockedNess(tRecipe); - //In case recipe is too OP for that machine + // In case recipe is too OP for that machine if (mMaxProgresstime == Integer.MAX_VALUE - 1 && mEUt == Integer.MAX_VALUE - 1) return FOUND_RECIPE_BUT_DID_NOT_MEET_REQUIREMENTS; } @@ -954,75 +1130,79 @@ public abstract class GT_MetaTileEntity_BasicMachine extends GT_MetaTileEntity_B } public ITexture[] getSideFacingActive(byte aColor) { - return new ITexture[]{MACHINE_CASINGS[mTier][aColor + 1]}; + return new ITexture[] {MACHINE_CASINGS[mTier][aColor + 1]}; } public ITexture[] getSideFacingInactive(byte aColor) { - return new ITexture[]{MACHINE_CASINGS[mTier][aColor + 1]}; + return new ITexture[] {MACHINE_CASINGS[mTier][aColor + 1]}; } public ITexture[] getFrontFacingActive(byte aColor) { - return new ITexture[]{MACHINE_CASINGS[mTier][aColor + 1]}; + return new ITexture[] {MACHINE_CASINGS[mTier][aColor + 1]}; } public ITexture[] getFrontFacingInactive(byte aColor) { - return new ITexture[]{MACHINE_CASINGS[mTier][aColor + 1]}; + return new ITexture[] {MACHINE_CASINGS[mTier][aColor + 1]}; } public ITexture[] getTopFacingActive(byte aColor) { - return new ITexture[]{MACHINE_CASINGS[mTier][aColor + 1]}; + return new ITexture[] {MACHINE_CASINGS[mTier][aColor + 1]}; } public ITexture[] getTopFacingInactive(byte aColor) { - return new ITexture[]{MACHINE_CASINGS[mTier][aColor + 1]}; + return new ITexture[] {MACHINE_CASINGS[mTier][aColor + 1]}; } public ITexture[] getBottomFacingActive(byte aColor) { - return new ITexture[]{MACHINE_CASINGS[mTier][aColor + 1]}; + return new ITexture[] {MACHINE_CASINGS[mTier][aColor + 1]}; } public ITexture[] getBottomFacingInactive(byte aColor) { - return new ITexture[]{MACHINE_CASINGS[mTier][aColor + 1]}; + return new ITexture[] {MACHINE_CASINGS[mTier][aColor + 1]}; } public ITexture[] getBottomFacingPipeActive(byte aColor) { - return new ITexture[]{MACHINE_CASINGS[mTier][aColor + 1], TextureFactory.of(OVERLAY_PIPE_OUT)}; + return new ITexture[] {MACHINE_CASINGS[mTier][aColor + 1], TextureFactory.of(OVERLAY_PIPE_OUT)}; } public ITexture[] getBottomFacingPipeInactive(byte aColor) { - return new ITexture[]{MACHINE_CASINGS[mTier][aColor + 1], TextureFactory.of(OVERLAY_PIPE_OUT)}; + return new ITexture[] {MACHINE_CASINGS[mTier][aColor + 1], TextureFactory.of(OVERLAY_PIPE_OUT)}; } public ITexture[] getTopFacingPipeActive(byte aColor) { - return new ITexture[]{MACHINE_CASINGS[mTier][aColor + 1], TextureFactory.of(OVERLAY_PIPE_OUT)}; + return new ITexture[] {MACHINE_CASINGS[mTier][aColor + 1], TextureFactory.of(OVERLAY_PIPE_OUT)}; } public ITexture[] getTopFacingPipeInactive(byte aColor) { - return new ITexture[]{MACHINE_CASINGS[mTier][aColor + 1], TextureFactory.of(OVERLAY_PIPE_OUT)}; + return new ITexture[] {MACHINE_CASINGS[mTier][aColor + 1], TextureFactory.of(OVERLAY_PIPE_OUT)}; } public ITexture[] getSideFacingPipeActive(byte aColor) { - return new ITexture[]{MACHINE_CASINGS[mTier][aColor + 1], TextureFactory.of(OVERLAY_PIPE_OUT)}; + return new ITexture[] {MACHINE_CASINGS[mTier][aColor + 1], TextureFactory.of(OVERLAY_PIPE_OUT)}; } public ITexture[] getSideFacingPipeInactive(byte aColor) { - return new ITexture[]{MACHINE_CASINGS[mTier][aColor + 1], TextureFactory.of(OVERLAY_PIPE_OUT)}; + return new ITexture[] {MACHINE_CASINGS[mTier][aColor + 1], TextureFactory.of(OVERLAY_PIPE_OUT)}; } @Override - public void getWailaBody(ItemStack itemStack, List<String> currenttip, IWailaDataAccessor accessor, IWailaConfigHandler config) { + public void getWailaBody( + ItemStack itemStack, List<String> currenttip, IWailaDataAccessor accessor, IWailaConfigHandler config) { final NBTTagCompound tag = accessor.getNBTData(); - currenttip.add(String.format("Progress: %d s / %d s", tag.getInteger("progressSingleBlock"), tag.getInteger("maxProgressSingleBlock"))); + currenttip.add(String.format( + "Progress: %d s / %d s", + tag.getInteger("progressSingleBlock"), tag.getInteger("maxProgressSingleBlock"))); super.getWailaBody(itemStack, currenttip, accessor, config); } @Override - public void getWailaNBTData(EntityPlayerMP player, TileEntity tile, NBTTagCompound tag, World world, int x, int y, int z) { + public void getWailaNBTData( + EntityPlayerMP player, TileEntity tile, NBTTagCompound tag, World world, int x, int y, int z) { super.getWailaNBTData(player, tile, tag, world, x, y, z); tag.setInteger("progressSingleBlock", mProgresstime / 20); - tag.setInteger("maxProgressSingleBlock", mMaxProgresstime / 20); + tag.setInteger("maxProgressSingleBlock", mMaxProgresstime / 20); } public Power getPower() { 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 f185a9c246..aa893c0bc2 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 @@ -1,8 +1,12 @@ package gregtech.api.metatileentity.implementations; +import static gregtech.api.enums.GT_Values.D1; +import static gregtech.api.enums.Textures.BlockIcons.*; +import static gregtech.api.objects.XSTR.XSTR_INSTANCE; + import gregtech.api.GregTech_API; -import gregtech.api.enums.ParticleFX; import gregtech.api.enums.Dyes; +import gregtech.api.enums.ParticleFX; import gregtech.api.enums.SoundResource; import gregtech.api.interfaces.ITexture; import gregtech.api.interfaces.tileentity.IGregTechTileEntity; @@ -14,17 +18,12 @@ import gregtech.api.util.GT_Utility; import gregtech.api.util.WorldSpawnedEventBuilder.ParticleEventBuilder; import gregtech.common.power.Power; import gregtech.common.power.SteamPower; +import java.util.ArrayList; import net.minecraft.entity.EntityLivingBase; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.util.AxisAlignedBB; import net.minecraftforge.common.util.ForgeDirection; -import java.util.ArrayList; - -import static gregtech.api.enums.GT_Values.D1; -import static gregtech.api.enums.Textures.BlockIcons.*; -import static gregtech.api.objects.XSTR.XSTR_INSTANCE; - /** * NEVER INCLUDE THIS FILE IN YOUR MOD!!! * <p/> @@ -35,15 +34,44 @@ public abstract class GT_MetaTileEntity_BasicMachine_Bronze extends GT_MetaTileE private static final int NEEDS_STEAM_VENTING = 64; public boolean mNeedsSteamVenting = false; - public GT_MetaTileEntity_BasicMachine_Bronze(int aID, String aName, String aNameRegional, String aDescription, int aInputSlotCount, int aOutputSlotCount, boolean aHighPressure) { - super(aID, aName, aNameRegional, aHighPressure ? 2 : 1, 0, aDescription, aInputSlotCount, aOutputSlotCount, "", ""); - } - - public GT_MetaTileEntity_BasicMachine_Bronze(String aName, String aDescription, ITexture[][][] aTextures, int aInputSlotCount, int aOutputSlotCount, boolean aHighPressure) { + public GT_MetaTileEntity_BasicMachine_Bronze( + int aID, + String aName, + String aNameRegional, + String aDescription, + int aInputSlotCount, + int aOutputSlotCount, + boolean aHighPressure) { + super( + aID, + aName, + aNameRegional, + aHighPressure ? 2 : 1, + 0, + aDescription, + aInputSlotCount, + aOutputSlotCount, + "", + ""); + } + + public GT_MetaTileEntity_BasicMachine_Bronze( + String aName, + String aDescription, + ITexture[][][] aTextures, + int aInputSlotCount, + int aOutputSlotCount, + boolean aHighPressure) { super(aName, aHighPressure ? 2 : 1, 0, aDescription, aTextures, aInputSlotCount, aOutputSlotCount, "", ""); } - public GT_MetaTileEntity_BasicMachine_Bronze(String aName, String[] aDescription, ITexture[][][] aTextures, int aInputSlotCount, int aOutputSlotCount, boolean aHighPressure) { + public GT_MetaTileEntity_BasicMachine_Bronze( + String aName, + String[] aDescription, + ITexture[][][] aTextures, + int aInputSlotCount, + int aOutputSlotCount, + boolean aHighPressure) { super(aName, aHighPressure ? 2 : 1, 0, aDescription, aTextures, aInputSlotCount, aOutputSlotCount, "", ""); } @@ -140,11 +168,53 @@ public abstract class GT_MetaTileEntity_BasicMachine_Bronze extends GT_MetaTileE @Override public boolean allowToCheckRecipe() { - if (mNeedsSteamVenting && getBaseMetaTileEntity().getCoverIDAtSide(getBaseMetaTileEntity().getFrontFacing()) == 0 && !GT_Utility.hasBlockHitBox(getBaseMetaTileEntity().getWorld(), getBaseMetaTileEntity().getOffsetX(getBaseMetaTileEntity().getFrontFacing(), 1), getBaseMetaTileEntity().getOffsetY(getBaseMetaTileEntity().getFrontFacing(), 1), getBaseMetaTileEntity().getOffsetZ(getBaseMetaTileEntity().getFrontFacing(), 1))) { + if (mNeedsSteamVenting + && getBaseMetaTileEntity() + .getCoverIDAtSide(getBaseMetaTileEntity().getFrontFacing()) + == 0 + && !GT_Utility.hasBlockHitBox( + getBaseMetaTileEntity().getWorld(), + getBaseMetaTileEntity() + .getOffsetX(getBaseMetaTileEntity().getFrontFacing(), 1), + getBaseMetaTileEntity() + .getOffsetY(getBaseMetaTileEntity().getFrontFacing(), 1), + getBaseMetaTileEntity() + .getOffsetZ(getBaseMetaTileEntity().getFrontFacing(), 1))) { sendSound((byte) 9); 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))) { + 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))) { GT_Utility.applyHeatDamage(tLiving, getSteamDamage()); } } catch (Throwable e) { @@ -156,8 +226,12 @@ public abstract class GT_MetaTileEntity_BasicMachine_Bronze extends GT_MetaTileE @Override public int checkRecipe() { - GT_Recipe tRecipe = getRecipeList().findRecipe(getBaseMetaTileEntity(), false, gregtech.api.enums.GT_Values.V[mTier], null, getAllInputs()); - if ((tRecipe != null) && (canOutput(tRecipe.mOutputs)) && (tRecipe.isRecipeInputEqual(true, null, getAllInputs()))) { + GT_Recipe tRecipe = getRecipeList() + .findRecipe( + getBaseMetaTileEntity(), false, gregtech.api.enums.GT_Values.V[mTier], null, getAllInputs()); + if ((tRecipe != null) + && (canOutput(tRecipe.mOutputs)) + && (tRecipe.isRecipeInputEqual(true, null, getAllInputs()))) { this.mOutputItems[0] = tRecipe.getOutput(0); calculateOverclockedNess(tRecipe); return 2; @@ -184,20 +258,26 @@ public abstract class GT_MetaTileEntity_BasicMachine_Bronze extends GT_MetaTileE 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() - ); + .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()); } } @@ -208,7 +288,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() && super.allowCoverOnSide(aSide, aCoverID); + return GregTech_API.getCoverBehaviorNew(aCoverID.toStack()).isSimpleCover() + && super.allowCoverOnSide(aSide, aCoverID); } public float getSteamDamage() { @@ -217,71 +298,133 @@ public abstract class GT_MetaTileEntity_BasicMachine_Bronze extends GT_MetaTileE @Override public ITexture[] getSideFacingActive(byte aColor) { - return new ITexture[]{TextureFactory.of(isBricked() ? MACHINE_BRONZEBRICKS_SIDE : MACHINE_BRONZE_SIDE, Dyes.getModulation(aColor, Dyes._NULL.mRGBa))}; + return new ITexture[] { + TextureFactory.of( + isBricked() ? MACHINE_BRONZEBRICKS_SIDE : MACHINE_BRONZE_SIDE, + Dyes.getModulation(aColor, Dyes._NULL.mRGBa)) + }; } @Override public ITexture[] getSideFacingInactive(byte aColor) { - return new ITexture[]{TextureFactory.of(isBricked() ? MACHINE_BRONZEBRICKS_SIDE : MACHINE_BRONZE_SIDE, Dyes.getModulation(aColor, Dyes._NULL.mRGBa))}; + return new ITexture[] { + TextureFactory.of( + isBricked() ? MACHINE_BRONZEBRICKS_SIDE : MACHINE_BRONZE_SIDE, + Dyes.getModulation(aColor, Dyes._NULL.mRGBa)) + }; } @Override public ITexture[] getFrontFacingActive(byte aColor) { - return new ITexture[]{TextureFactory.of(isBricked() ? MACHINE_BRONZEBRICKS_SIDE : MACHINE_BRONZE_SIDE, Dyes.getModulation(aColor, Dyes._NULL.mRGBa))}; + return new ITexture[] { + TextureFactory.of( + isBricked() ? MACHINE_BRONZEBRICKS_SIDE : MACHINE_BRONZE_SIDE, + Dyes.getModulation(aColor, Dyes._NULL.mRGBa)) + }; } @Override public ITexture[] getFrontFacingInactive(byte aColor) { - return new ITexture[]{TextureFactory.of(isBricked() ? MACHINE_BRONZEBRICKS_SIDE : MACHINE_BRONZE_SIDE, Dyes.getModulation(aColor, Dyes._NULL.mRGBa))}; + return new ITexture[] { + TextureFactory.of( + isBricked() ? MACHINE_BRONZEBRICKS_SIDE : MACHINE_BRONZE_SIDE, + Dyes.getModulation(aColor, Dyes._NULL.mRGBa)) + }; } @Override public ITexture[] getTopFacingActive(byte aColor) { - return new ITexture[]{TextureFactory.of(isBricked() ? MACHINE_BRONZEBRICKS_TOP : MACHINE_BRONZE_TOP, Dyes.getModulation(aColor, Dyes._NULL.mRGBa))}; + return new ITexture[] { + TextureFactory.of( + isBricked() ? MACHINE_BRONZEBRICKS_TOP : MACHINE_BRONZE_TOP, + Dyes.getModulation(aColor, Dyes._NULL.mRGBa)) + }; } @Override public ITexture[] getTopFacingInactive(byte aColor) { - return new ITexture[]{TextureFactory.of(isBricked() ? MACHINE_BRONZEBRICKS_TOP : MACHINE_BRONZE_TOP, Dyes.getModulation(aColor, Dyes._NULL.mRGBa))}; + return new ITexture[] { + TextureFactory.of( + isBricked() ? MACHINE_BRONZEBRICKS_TOP : MACHINE_BRONZE_TOP, + Dyes.getModulation(aColor, Dyes._NULL.mRGBa)) + }; } @Override public ITexture[] getBottomFacingActive(byte aColor) { - return new ITexture[]{TextureFactory.of(isBricked() ? MACHINE_BRONZEBRICKS_BOTTOM : MACHINE_BRONZE_BOTTOM, Dyes.getModulation(aColor, Dyes._NULL.mRGBa))}; + return new ITexture[] { + TextureFactory.of( + isBricked() ? MACHINE_BRONZEBRICKS_BOTTOM : MACHINE_BRONZE_BOTTOM, + Dyes.getModulation(aColor, Dyes._NULL.mRGBa)) + }; } @Override public ITexture[] getBottomFacingInactive(byte aColor) { - return new ITexture[]{TextureFactory.of(isBricked() ? MACHINE_BRONZEBRICKS_BOTTOM : MACHINE_BRONZE_BOTTOM, Dyes.getModulation(aColor, Dyes._NULL.mRGBa))}; + return new ITexture[] { + TextureFactory.of( + isBricked() ? MACHINE_BRONZEBRICKS_BOTTOM : MACHINE_BRONZE_BOTTOM, + Dyes.getModulation(aColor, Dyes._NULL.mRGBa)) + }; } @Override public ITexture[] getBottomFacingPipeActive(byte aColor) { - return new ITexture[]{TextureFactory.of(isBricked() ? MACHINE_BRONZEBRICKS_BOTTOM : MACHINE_BRONZE_BOTTOM, Dyes.getModulation(aColor, Dyes._NULL.mRGBa)), TextureFactory.of(OVERLAY_PIPE_OUT)}; + return new ITexture[] { + TextureFactory.of( + isBricked() ? MACHINE_BRONZEBRICKS_BOTTOM : MACHINE_BRONZE_BOTTOM, + Dyes.getModulation(aColor, Dyes._NULL.mRGBa)), + TextureFactory.of(OVERLAY_PIPE_OUT) + }; } @Override public ITexture[] getBottomFacingPipeInactive(byte aColor) { - return new ITexture[]{TextureFactory.of(isBricked() ? MACHINE_BRONZEBRICKS_BOTTOM : MACHINE_BRONZE_BOTTOM, Dyes.getModulation(aColor, Dyes._NULL.mRGBa)), TextureFactory.of(OVERLAY_PIPE_OUT)}; + return new ITexture[] { + TextureFactory.of( + isBricked() ? MACHINE_BRONZEBRICKS_BOTTOM : MACHINE_BRONZE_BOTTOM, + Dyes.getModulation(aColor, Dyes._NULL.mRGBa)), + TextureFactory.of(OVERLAY_PIPE_OUT) + }; } @Override public ITexture[] getTopFacingPipeActive(byte aColor) { - return new ITexture[]{TextureFactory.of(isBricked() ? MACHINE_BRONZEBRICKS_TOP : MACHINE_BRONZE_TOP, Dyes.getModulation(aColor, Dyes._NULL.mRGBa)), TextureFactory.of(OVERLAY_PIPE_OUT)}; + return new ITexture[] { + TextureFactory.of( + isBricked() ? MACHINE_BRONZEBRICKS_TOP : MACHINE_BRONZE_TOP, + Dyes.getModulation(aColor, Dyes._NULL.mRGBa)), + TextureFactory.of(OVERLAY_PIPE_OUT) + }; } @Override public ITexture[] getTopFacingPipeInactive(byte aColor) { - return new ITexture[]{TextureFactory.of(isBricked() ? MACHINE_BRONZEBRICKS_TOP : MACHINE_BRONZE_TOP, Dyes.getModulation(aColor, Dyes._NULL.mRGBa)), TextureFactory.of(OVERLAY_PIPE_OUT)}; + return new ITexture[] { + TextureFactory.of( + isBricked() ? MACHINE_BRONZEBRICKS_TOP : MACHINE_BRONZE_TOP, + Dyes.getModulation(aColor, Dyes._NULL.mRGBa)), + TextureFactory.of(OVERLAY_PIPE_OUT) + }; } @Override public ITexture[] getSideFacingPipeActive(byte aColor) { - return new ITexture[]{TextureFactory.of(isBricked() ? MACHINE_BRONZEBRICKS_SIDE : MACHINE_BRONZE_SIDE, Dyes.getModulation(aColor, Dyes._NULL.mRGBa)), TextureFactory.of(OVERLAY_PIPE_OUT)}; + return new ITexture[] { + TextureFactory.of( + isBricked() ? MACHINE_BRONZEBRICKS_SIDE : MACHINE_BRONZE_SIDE, + Dyes.getModulation(aColor, Dyes._NULL.mRGBa)), + TextureFactory.of(OVERLAY_PIPE_OUT) + }; } @Override public ITexture[] getSideFacingPipeInactive(byte aColor) { - return new ITexture[]{TextureFactory.of(isBricked() ? MACHINE_BRONZEBRICKS_SIDE : MACHINE_BRONZE_SIDE, Dyes.getModulation(aColor, Dyes._NULL.mRGBa)), TextureFactory.of(OVERLAY_PIPE_OUT)}; + return new ITexture[] { + TextureFactory.of( + isBricked() ? MACHINE_BRONZEBRICKS_SIDE : MACHINE_BRONZE_SIDE, + Dyes.getModulation(aColor, Dyes._NULL.mRGBa)), + TextureFactory.of(OVERLAY_PIPE_OUT) + }; } } 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 b09639e292..419ab1fb14 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 @@ -1,10 +1,16 @@ package gregtech.api.metatileentity.implementations; +import static gregtech.api.enums.GT_Values.V; +import static gregtech.api.enums.GT_Values.VN; +import static gregtech.api.enums.GT_Values.W; +import static gregtech.api.enums.GT_Values.ticksBetweenSounds; +import static gregtech.api.objects.XSTR.XSTR_INSTANCE; + import cpw.mods.fml.common.Loader; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; -import gregtech.api.enums.ParticleFX; import gregtech.api.enums.*; +import gregtech.api.enums.ParticleFX; import gregtech.api.enums.Textures.BlockIcons.CustomIcon; import gregtech.api.gui.GT_Container_BasicMachine; import gregtech.api.gui.GT_GUIContainer_BasicMachine; @@ -19,6 +25,7 @@ import gregtech.api.util.GT_Utility; import gregtech.api.util.WorldSpawnedEventBuilder; import gregtech.api.util.WorldSpawnedEventBuilder.ParticleEventBuilder; import ic2.core.Ic2Items; +import java.util.Locale; import net.minecraft.block.Block; import net.minecraft.entity.player.InventoryPlayer; import net.minecraft.init.Blocks; @@ -28,14 +35,6 @@ import net.minecraftforge.common.util.ForgeDirection; import net.minecraftforge.fluids.FluidStack; import net.minecraftforge.oredict.OreDictionary; -import java.util.Locale; - -import static gregtech.api.enums.GT_Values.V; -import static gregtech.api.enums.GT_Values.VN; -import static gregtech.api.enums.GT_Values.W; -import static gregtech.api.enums.GT_Values.ticksBetweenSounds; -import static gregtech.api.objects.XSTR.XSTR_INSTANCE; - /** * NEVER INCLUDE THIS FILE IN YOUR MOD!!! * <p/> @@ -51,36 +50,99 @@ public class GT_MetaTileEntity_BasicMachine_GT_Recipe extends GT_MetaTileEntity_ private final byte mGUIParameterA, mGUIParameterB; public GT_MetaTileEntity_BasicMachine_GT_Recipe( - int aID, String aName, String aNameRegional, int aTier, String aDescription, GT_Recipe.GT_Recipe_Map aRecipes, - int aInputSlots, int aOutputSlots, int aTankCapacity, int aGUIParameterA, int aGUIParameterB, String aGUIName, ResourceLocation aSound, boolean aSharedTank, - boolean aRequiresFluidForFiltering, SpecialEffects aSpecialEffect, String aOverlays, Object[] aRecipe - ) { - super(aID, aName, aNameRegional, aTier, aRecipes.mAmperage, aDescription, aInputSlots, aOutputSlots, aGUIName, aRecipes.mNEIName, + int aID, + String aName, + String aNameRegional, + int aTier, + String aDescription, + GT_Recipe.GT_Recipe_Map aRecipes, + int aInputSlots, + int aOutputSlots, + int aTankCapacity, + int aGUIParameterA, + int aGUIParameterB, + String aGUIName, + ResourceLocation aSound, + boolean aSharedTank, + boolean aRequiresFluidForFiltering, + SpecialEffects aSpecialEffect, + String aOverlays, + Object[] aRecipe) { + super( + aID, + aName, + aNameRegional, + aTier, + aRecipes.mAmperage, + aDescription, + aInputSlots, + aOutputSlots, + aGUIName, + aRecipes.mNEIName, TextureFactory.of( - TextureFactory.of(new CustomIcon("basicmachines/" + aOverlays.toLowerCase(Locale.ENGLISH) + "/OVERLAY_SIDE_ACTIVE")), - TextureFactory.builder().addIcon((new CustomIcon("basicmachines/" + aOverlays.toLowerCase(Locale.ENGLISH) + "/OVERLAY_SIDE_ACTIVE_GLOW"))).glow().build()), + TextureFactory.of(new CustomIcon( + "basicmachines/" + aOverlays.toLowerCase(Locale.ENGLISH) + "/OVERLAY_SIDE_ACTIVE")), + TextureFactory.builder() + .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()), + 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()), 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()), + 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()), 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()), + 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()), 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()), + 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()), 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()), + 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()), 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()), + 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()), 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()) - ); + 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())); this.mSharedTank = aSharedTank; this.mTankCapacity = aTankCapacity; this.mSpecialEffect = aSpecialEffect; @@ -90,8 +152,7 @@ public class GT_MetaTileEntity_BasicMachine_GT_Recipe extends GT_MetaTileEntity_ this.mGUIParameterA = (byte) aGUIParameterA; this.mGUIParameterB = (byte) aGUIParameterB; - - //TODO: CHECK + // TODO: CHECK if (aRecipe != null) { for (int i = 3; i < aRecipe.length; i++) { if (aRecipe[i] == GT_MetaTileEntity_BasicMachine_GT_Recipe.X.CIRCUIT) { @@ -128,12 +189,12 @@ public class GT_MetaTileEntity_BasicMachine_GT_Recipe extends GT_MetaTileEntity_ case 6: case 7: case 8: - if (Loader.isModLoaded("bartworks")) {//todo remove via provider pattern on all enums? + if (Loader.isModLoaded("bartworks")) { // todo remove via provider pattern on all enums? aRecipe[i] = "blockGlass" + VN[aTier]; break; } default: - if (Loader.isModLoaded("bartworks")) {//todo remove via provider pattern on all enums? + if (Loader.isModLoaded("bartworks")) { // todo remove via provider pattern on all enums? aRecipe[i] = "blockGlass" + VN[8]; } else { aRecipe[i] = Ic2Items.reinforcedGlass; @@ -700,26 +761,57 @@ public class GT_MetaTileEntity_BasicMachine_GT_Recipe extends GT_MetaTileEntity_ throw new IllegalArgumentException("MISSING TIER MAPPING FOR: " + aRecipe[i] + " AT TIER " + mTier); } - if ( - !GT_ModHandler.addCraftingRecipe( + if (!GT_ModHandler.addCraftingRecipe( getStackForm(1), - GT_ModHandler.RecipeBits.DISMANTLEABLE | GT_ModHandler.RecipeBits.BUFFERED | GT_ModHandler.RecipeBits.NOT_REMOVABLE | GT_ModHandler.RecipeBits.REVERSIBLE, aRecipe - ) - ) { - throw new IllegalArgumentException("INVALID CRAFTING RECIPE FOR: " + getStackForm(1).getDisplayName()); + GT_ModHandler.RecipeBits.DISMANTLEABLE + | GT_ModHandler.RecipeBits.BUFFERED + | GT_ModHandler.RecipeBits.NOT_REMOVABLE + | GT_ModHandler.RecipeBits.REVERSIBLE, + aRecipe)) { + throw new IllegalArgumentException( + "INVALID CRAFTING RECIPE FOR: " + getStackForm(1).getDisplayName()); } } } public GT_MetaTileEntity_BasicMachine_GT_Recipe( - int aID, String aName, String aNameRegional, int aTier, String aDescription, GT_Recipe.GT_Recipe_Map aRecipes, - int aInputSlots, int aOutputSlots, int aTankCapacity, int aGUIParameterA, int aGUIParameterB, String aGUIName, SoundResource aSound, boolean aSharedTank, - boolean aRequiresFluidForFiltering, SpecialEffects aSpecialEffect, String aOverlays, Object[] aRecipe - ) { + int aID, + String aName, + String aNameRegional, + int aTier, + String aDescription, + GT_Recipe.GT_Recipe_Map aRecipes, + int aInputSlots, + int aOutputSlots, + int aTankCapacity, + int aGUIParameterA, + int aGUIParameterB, + String aGUIName, + SoundResource aSound, + boolean aSharedTank, + boolean aRequiresFluidForFiltering, + SpecialEffects aSpecialEffect, + String aOverlays, + Object[] aRecipe) { this( - aID, aName, aNameRegional, aTier, aDescription, aRecipes, - aInputSlots, aOutputSlots, aTankCapacity, aGUIParameterA, aGUIParameterB, aGUIName, aSound.resourceLocation, aSharedTank, - aRequiresFluidForFiltering, aSpecialEffect, aOverlays, aRecipe); + aID, + aName, + aNameRegional, + aTier, + aDescription, + aRecipes, + aInputSlots, + aOutputSlots, + aTankCapacity, + aGUIParameterA, + aGUIParameterB, + aGUIName, + aSound.resourceLocation, + aSharedTank, + aRequiresFluidForFiltering, + aSpecialEffect, + aOverlays, + aRecipe); } /** @@ -731,20 +823,63 @@ public class GT_MetaTileEntity_BasicMachine_GT_Recipe extends GT_MetaTileEntity_ */ @Deprecated public GT_MetaTileEntity_BasicMachine_GT_Recipe( - int aID, String aName, String aNameRegional, int aTier, String aDescription, GT_Recipe.GT_Recipe_Map aRecipes, - int aInputSlots, int aOutputSlots, int aTankCapacity, int aGUIParameterA, int aGUIParameterB, String aGUIName, String aSound, boolean aSharedTank, - boolean aRequiresFluidForFiltering, int aSpecialEffect, String aOverlays, Object[] aRecipe - ) { - this(aID, aName, aNameRegional, aTier, aDescription, aRecipes, - aInputSlots, aOutputSlots, aTankCapacity, aGUIParameterA, aGUIParameterB, aGUIName, new ResourceLocation(aSound), aSharedTank, - aRequiresFluidForFiltering, SpecialEffects.fromId(aSpecialEffect), aOverlays, aRecipe); + int aID, + String aName, + String aNameRegional, + int aTier, + String aDescription, + GT_Recipe.GT_Recipe_Map aRecipes, + int aInputSlots, + int aOutputSlots, + int aTankCapacity, + int aGUIParameterA, + int aGUIParameterB, + String aGUIName, + String aSound, + boolean aSharedTank, + boolean aRequiresFluidForFiltering, + int aSpecialEffect, + String aOverlays, + Object[] aRecipe) { + this( + aID, + aName, + aNameRegional, + aTier, + aDescription, + aRecipes, + aInputSlots, + aOutputSlots, + aTankCapacity, + aGUIParameterA, + aGUIParameterB, + aGUIName, + new ResourceLocation(aSound), + aSharedTank, + aRequiresFluidForFiltering, + SpecialEffects.fromId(aSpecialEffect), + aOverlays, + aRecipe); } public GT_MetaTileEntity_BasicMachine_GT_Recipe( - String aName, int aTier, String aDescription, GT_Recipe.GT_Recipe_Map aRecipes, int aInputSlots, int aOutputSlots, int aTankCapacity, int aAmperage, - int aGUIParameterA, int aGUIParameterB, ITexture[][][] aTextures, String aGUIName, String aNEIName, String aSound, boolean aSharedTank, - boolean aRequiresFluidForFiltering, int aSpecialEffect - ) { + String aName, + int aTier, + String aDescription, + GT_Recipe.GT_Recipe_Map aRecipes, + int aInputSlots, + int aOutputSlots, + int aTankCapacity, + int aAmperage, + int aGUIParameterA, + int aGUIParameterB, + ITexture[][][] aTextures, + String aGUIName, + String aNEIName, + String aSound, + boolean aSharedTank, + boolean aRequiresFluidForFiltering, + int aSpecialEffect) { super(aName, aTier, aAmperage, aDescription, aTextures, aInputSlots, aOutputSlots, aGUIName, aNEIName); this.mSharedTank = aSharedTank; this.mTankCapacity = aTankCapacity; @@ -757,10 +892,23 @@ public class GT_MetaTileEntity_BasicMachine_GT_Recipe extends GT_MetaTileEntity_ } public GT_MetaTileEntity_BasicMachine_GT_Recipe( - String aName, int aTier, String[] aDescription, GT_Recipe.GT_Recipe_Map aRecipes, int aInputSlots, int aOutputSlots, int aTankCapacity, int aAmperage, - int aGUIParameterA, int aGUIParameterB, ITexture[][][] aTextures, String aGUIName, String aNEIName, String aSound, boolean aSharedTank, - boolean aRequiresFluidForFiltering, int aSpecialEffect - ) { + String aName, + int aTier, + String[] aDescription, + GT_Recipe.GT_Recipe_Map aRecipes, + int aInputSlots, + int aOutputSlots, + int aTankCapacity, + int aAmperage, + int aGUIParameterA, + int aGUIParameterB, + ITexture[][][] aTextures, + String aGUIName, + String aNEIName, + String aSound, + boolean aSharedTank, + boolean aRequiresFluidForFiltering, + int aSpecialEffect) { super(aName, aTier, aAmperage, aDescription, aTextures, aInputSlots, aOutputSlots, aGUIName, aNEIName); this.mSharedTank = aSharedTank; this.mTankCapacity = aTankCapacity; @@ -775,10 +923,23 @@ public class GT_MetaTileEntity_BasicMachine_GT_Recipe extends GT_MetaTileEntity_ @Override public IMetaTileEntity newMetaEntity(IGregTechTileEntity aTileEntity) { return new GT_MetaTileEntity_BasicMachine_GT_Recipe( - this.mName, this.mTier, this.mDescriptionArray, this.mRecipes, this.mInputSlotCount, this.mOutputItems == null ? 0 : this.mOutputItems.length, - this.mTankCapacity, this.mAmperage, this.mGUIParameterA, this.mGUIParameterB, this.mTextures, this.mGUIName, this.mNEIName, this.mSoundResourceLocation.toString(), - this.mSharedTank, this.mRequiresFluidForFiltering, this.mSpecialEffect.ordinal() - ); + this.mName, + this.mTier, + this.mDescriptionArray, + this.mRecipes, + this.mInputSlotCount, + this.mOutputItems == null ? 0 : this.mOutputItems.length, + this.mTankCapacity, + this.mAmperage, + this.mGUIParameterA, + this.mGUIParameterB, + this.mTextures, + this.mGUIName, + this.mNEIName, + this.mSoundResourceLocation.toString(), + this.mSharedTank, + this.mRequiresFluidForFiltering, + this.mSpecialEffect.ordinal()); } @Override @@ -789,61 +950,74 @@ public class GT_MetaTileEntity_BasicMachine_GT_Recipe extends GT_MetaTileEntity_ @Override public Object getClientGUI(int aID, InventoryPlayer aPlayerInventory, IGregTechTileEntity aBaseMetaTileEntity) { return new GT_GUIContainer_BasicMachine( - aPlayerInventory, aBaseMetaTileEntity, this.getLocalName(), this.mGUIName, - GT_Utility.isStringValid(this.mNEIName) ? this.mNEIName : this.getRecipeList() != null ? this.getRecipeList().mUnlocalizedName : "", - this.mGUIParameterA, this.mGUIParameterB - ); + aPlayerInventory, + aBaseMetaTileEntity, + this.getLocalName(), + this.mGUIName, + GT_Utility.isStringValid(this.mNEIName) + ? this.mNEIName + : this.getRecipeList() != null ? this.getRecipeList().mUnlocalizedName : "", + this.mGUIParameterA, + this.mGUIParameterB); } @Override - protected boolean allowPutStackValidated(IGregTechTileEntity aBaseMetaTileEntity, int aIndex, byte aSide, ItemStack aStack) { + protected boolean allowPutStackValidated( + IGregTechTileEntity aBaseMetaTileEntity, int aIndex, byte aSide, ItemStack aStack) { if (!super.allowPutStackValidated(aBaseMetaTileEntity, aIndex, aSide, aStack)) return false; switch (this.mInputSlotCount) { case 0: return false; case 1: if (this.getFillableStack() == null) - return !this.mRequiresFluidForFiltering && this.getRecipeList().containsInput(aStack); + 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; + 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( - 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 - ) - ) - ) - ); + 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(); - if (tID >= 211 && tID <= 218 || tID >= 1180 && tID <= 1187 || tID >= 10780 && tID <= 10786) { //assembler lv-iv; circuit asseblers lv - uv; assemblers luv-uev + if (tID >= 211 && tID <= 218 + || tID >= 1180 && tID <= 1187 + || tID >= 10780 + && tID <= 10786) { // assembler lv-iv; circuit asseblers lv - uv; 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); } - } } @@ -859,23 +1033,21 @@ public class GT_MetaTileEntity_BasicMachine_GT_Recipe extends GT_MetaTileEntity_ //noinspection SwitchStatementWithTooFewBranches switch (this.mSpecialEffect) { case TOP_SMOKE: - final byte topFacing = (byte) ForgeDirection.UP.ordinal(); if (aBaseMetaTileEntity.getFrontFacing() != topFacing - && aBaseMetaTileEntity.getCoverIDAtSide(topFacing) == 0 - && !aBaseMetaTileEntity.getOpacityAtSide(topFacing)) { + && aBaseMetaTileEntity.getCoverIDAtSide(topFacing) == 0 + && !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(); + .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(); } break; default: @@ -902,8 +1074,8 @@ public class GT_MetaTileEntity_BasicMachine_GT_Recipe extends GT_MetaTileEntity_ final byte mainFacing = (byte) this.mMainFacing; if (mainFacing > 1 - && aBaseMetaTileEntity.getCoverIDAtSide(mainFacing) == 0 - && !aBaseMetaTileEntity.getOpacityAtSide(mainFacing)) { + && aBaseMetaTileEntity.getCoverIDAtSide(mainFacing) == 0 + && !aBaseMetaTileEntity.getOpacityAtSide(mainFacing)) { final double oX = aBaseMetaTileEntity.getXCoord(); final double oY = aBaseMetaTileEntity.getYCoord(); @@ -938,8 +1110,7 @@ public class GT_MetaTileEntity_BasicMachine_GT_Recipe extends GT_MetaTileEntity_ mZ = .05D; } - ParticleEventBuilder particleEventBuilder = - (new ParticleEventBuilder()) + ParticleEventBuilder particleEventBuilder = (new ParticleEventBuilder()) .setMotion(mX, 0, mZ) .setPosition(x, y, z) .setWorld(getBaseMetaTileEntity().getWorld()); @@ -1001,7 +1172,31 @@ public class GT_MetaTileEntity_BasicMachine_GT_Recipe extends GT_MetaTileEntity_ return !this.mSharedTank; } - public enum X {PUMP, WIRE, WIRE4, HULL, PIPE, GLASS, PLATE, MOTOR, ROTOR, SENSOR, PISTON, CIRCUIT, EMITTER, CONVEYOR, ROBOT_ARM, COIL_HEATING, COIL_ELECTRIC, STICK_MAGNETIC, STICK_DISTILLATION, BETTER_CIRCUIT, FIELD_GENERATOR, COIL_HEATING_DOUBLE, STICK_ELECTROMAGNETIC} + public enum X { + PUMP, + WIRE, + WIRE4, + HULL, + PIPE, + GLASS, + PLATE, + MOTOR, + ROTOR, + SENSOR, + PISTON, + CIRCUIT, + EMITTER, + CONVEYOR, + ROBOT_ARM, + COIL_HEATING, + COIL_ELECTRIC, + STICK_MAGNETIC, + STICK_DISTILLATION, + BETTER_CIRCUIT, + FIELD_GENERATOR, + COIL_HEATING_DOUBLE, + STICK_ELECTROMAGNETIC + } /** * Special Effects @@ -1011,11 +1206,7 @@ public class GT_MetaTileEntity_BasicMachine_GT_Recipe extends GT_MetaTileEntity_ TOP_SMOKE, MAIN_RANDOM_SPARKS; - static final SpecialEffects[] VALID_SPECIAL_EFFECTS = { - NONE, - TOP_SMOKE, - MAIN_RANDOM_SPARKS - }; + static final SpecialEffects[] VALID_SPECIAL_EFFECTS = {NONE, TOP_SMOKE, MAIN_RANDOM_SPARKS}; static SpecialEffects fromId(int id) { return id >= 0 && id < VALID_SPECIAL_EFFECTS.length ? VALID_SPECIAL_EFFECTS[id] : NONE; diff --git a/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_BasicMachine_Steel.java b/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_BasicMachine_Steel.java index a58cf6345d..d69ab3aa14 100644 --- a/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_BasicMachine_Steel.java +++ b/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_BasicMachine_Steel.java @@ -1,11 +1,5 @@ package gregtech.api.metatileentity.implementations; -import gregtech.api.enums.Dyes; -import gregtech.api.interfaces.ITexture; -import gregtech.api.render.TextureFactory; -import gregtech.common.power.Power; -import gregtech.common.power.SteamPower; - import static gregtech.api.enums.Textures.BlockIcons.MACHINE_STEELBRICKS_BOTTOM; import static gregtech.api.enums.Textures.BlockIcons.MACHINE_STEELBRICKS_SIDE; import static gregtech.api.enums.Textures.BlockIcons.MACHINE_STEELBRICKS_TOP; @@ -14,6 +8,11 @@ import static gregtech.api.enums.Textures.BlockIcons.MACHINE_STEEL_SIDE; import static gregtech.api.enums.Textures.BlockIcons.MACHINE_STEEL_TOP; import static gregtech.api.enums.Textures.BlockIcons.OVERLAY_PIPE_OUT; +import gregtech.api.enums.Dyes; +import gregtech.api.interfaces.ITexture; +import gregtech.api.render.TextureFactory; +import gregtech.common.power.Power; +import gregtech.common.power.SteamPower; /** * NEVER INCLUDE THIS FILE IN YOUR MOD!!! @@ -22,15 +21,34 @@ import static gregtech.api.enums.Textures.BlockIcons.OVERLAY_PIPE_OUT; * Extend this class to make a simple Machine */ public abstract class GT_MetaTileEntity_BasicMachine_Steel extends GT_MetaTileEntity_BasicMachine_Bronze { - public GT_MetaTileEntity_BasicMachine_Steel(int aID, String aName, String aNameRegional, String aDescription, int aInputSlotCount, int aOutputSlotCount, boolean aHighPressure) { + public GT_MetaTileEntity_BasicMachine_Steel( + int aID, + String aName, + String aNameRegional, + String aDescription, + int aInputSlotCount, + int aOutputSlotCount, + boolean aHighPressure) { super(aID, aName, aNameRegional, aDescription, aInputSlotCount, aOutputSlotCount, aHighPressure); } - public GT_MetaTileEntity_BasicMachine_Steel(String aName, String aDescription, ITexture[][][] aTextures, int aInputSlotCount, int aOutputSlotCount, boolean aHighPressure) { + public GT_MetaTileEntity_BasicMachine_Steel( + String aName, + String aDescription, + ITexture[][][] aTextures, + int aInputSlotCount, + int aOutputSlotCount, + boolean aHighPressure) { super(aName, aDescription, aTextures, aInputSlotCount, aOutputSlotCount, aHighPressure); } - - public GT_MetaTileEntity_BasicMachine_Steel(String aName, String[] aDescription, ITexture[][][] aTextures, int aInputSlotCount, int aOutputSlotCount, boolean aHighPressure) { + + public GT_MetaTileEntity_BasicMachine_Steel( + String aName, + String[] aDescription, + ITexture[][][] aTextures, + int aInputSlotCount, + int aOutputSlotCount, + boolean aHighPressure) { super(aName, aDescription, aTextures, aInputSlotCount, aOutputSlotCount, aHighPressure); } @@ -41,71 +59,133 @@ public abstract class GT_MetaTileEntity_BasicMachine_Steel extends GT_MetaTileEn @Override public ITexture[] getSideFacingActive(byte aColor) { - return new ITexture[]{TextureFactory.of(isBricked() ? MACHINE_STEELBRICKS_SIDE : MACHINE_STEEL_SIDE, Dyes.getModulation(aColor, Dyes._NULL.mRGBa))}; + return new ITexture[] { + TextureFactory.of( + isBricked() ? MACHINE_STEELBRICKS_SIDE : MACHINE_STEEL_SIDE, + Dyes.getModulation(aColor, Dyes._NULL.mRGBa)) + }; } @Override public ITexture[] getSideFacingInactive(byte aColor) { - return new ITexture[]{TextureFactory.of(isBricked() ? MACHINE_STEELBRICKS_SIDE : MACHINE_STEEL_SIDE, Dyes.getModulation(aColor, Dyes._NULL.mRGBa))}; + return new ITexture[] { + TextureFactory.of( + isBricked() ? MACHINE_STEELBRICKS_SIDE : MACHINE_STEEL_SIDE, + Dyes.getModulation(aColor, Dyes._NULL.mRGBa)) + }; } @Override public ITexture[] getFrontFacingActive(byte aColor) { - return new ITexture[]{TextureFactory.of(isBricked() ? MACHINE_STEELBRICKS_SIDE : MACHINE_STEEL_SIDE, Dyes.getModulation(aColor, Dyes._NULL.mRGBa))}; + return new ITexture[] { + TextureFactory.of( + isBricked() ? MACHINE_STEELBRICKS_SIDE : MACHINE_STEEL_SIDE, + Dyes.getModulation(aColor, Dyes._NULL.mRGBa)) + }; } @Override public ITexture[] getFrontFacingInactive(byte aColor) { - return new ITexture[]{TextureFactory.of(isBricked() ? MACHINE_STEELBRICKS_SIDE : MACHINE_STEEL_SIDE, Dyes.getModulation(aColor, Dyes._NULL.mRGBa))}; + return new ITexture[] { + TextureFactory.of( + isBricked() ? MACHINE_STEELBRICKS_SIDE : MACHINE_STEEL_SIDE, + Dyes.getModulation(aColor, Dyes._NULL.mRGBa)) + }; } @Override public ITexture[] getTopFacingActive(byte aColor) { - return new ITexture[]{TextureFactory.of(isBricked() ? MACHINE_STEELBRICKS_TOP : MACHINE_STEEL_TOP, Dyes.getModulation(aColor, Dyes._NULL.mRGBa))}; + return new ITexture[] { + TextureFactory.of( + isBricked() ? MACHINE_STEELBRICKS_TOP : MACHINE_STEEL_TOP, + Dyes.getModulation(aColor, Dyes._NULL.mRGBa)) + }; } @Override public ITexture[] getTopFacingInactive(byte aColor) { - return new ITexture[]{TextureFactory.of(isBricked() ? MACHINE_STEELBRICKS_TOP : MACHINE_STEEL_TOP, Dyes.getModulation(aColor, Dyes._NULL.mRGBa))}; + return new ITexture[] { + TextureFactory.of( + isBricked() ? MACHINE_STEELBRICKS_TOP : MACHINE_STEEL_TOP, + Dyes.getModulation(aColor, Dyes._NULL.mRGBa)) + }; } @Override public ITexture[] getBottomFacingActive(byte aColor) { - return new ITexture[]{TextureFactory.of(isBricked() ? MACHINE_STEELBRICKS_BOTTOM : MACHINE_STEEL_BOTTOM, Dyes.getModulation(aColor, Dyes._NULL.mRGBa))}; + return new ITexture[] { + TextureFactory.of( + isBricked() ? MACHINE_STEELBRICKS_BOTTOM : MACHINE_STEEL_BOTTOM, + Dyes.getModulation(aColor, Dyes._NULL.mRGBa)) + }; } @Override public ITexture[] getBottomFacingInactive(byte aColor) { - return new ITexture[]{TextureFactory.of(isBricked() ? MACHINE_STEELBRICKS_BOTTOM : MACHINE_STEEL_BOTTOM, Dyes.getModulation(aColor, Dyes._NULL.mRGBa))}; + return new ITexture[] { + TextureFactory.of( + isBricked() ? MACHINE_STEELBRICKS_BOTTOM : MACHINE_STEEL_BOTTOM, + Dyes.getModulation(aColor, Dyes._NULL.mRGBa)) + }; } @Override public ITexture[] getBottomFacingPipeActive(byte aColor) { - return new ITexture[]{TextureFactory.of(isBricked() ? MACHINE_STEELBRICKS_BOTTOM : MACHINE_STEEL_BOTTOM, Dyes.getModulation(aColor, Dyes._NULL.mRGBa)), TextureFactory.of(OVERLAY_PIPE_OUT)}; + return new ITexture[] { + TextureFactory.of( + isBricked() ? MACHINE_STEELBRICKS_BOTTOM : MACHINE_STEEL_BOTTOM, + Dyes.getModulation(aColor, Dyes._NULL.mRGBa)), + TextureFactory.of(OVERLAY_PIPE_OUT) + }; } @Override public ITexture[] getBottomFacingPipeInactive(byte aColor) { - return new ITexture[]{TextureFactory.of(isBricked() ? MACHINE_STEELBRICKS_BOTTOM : MACHINE_STEEL_BOTTOM, Dyes.getModulation(aColor, Dyes._NULL.mRGBa)), TextureFactory.of(OVERLAY_PIPE_OUT)}; + return new ITexture[] { + TextureFactory.of( + isBricked() ? MACHINE_STEELBRICKS_BOTTOM : MACHINE_STEEL_BOTTOM, + Dyes.getModulation(aColor, Dyes._NULL.mRGBa)), + TextureFactory.of(OVERLAY_PIPE_OUT) + }; } @Override public ITexture[] getTopFacingPipeActive(byte aColor) { - return new ITexture[]{TextureFactory.of(isBricked() ? MACHINE_STEELBRICKS_TOP : MACHINE_STEEL_TOP, Dyes.getModulation(aColor, Dyes._NULL.mRGBa)), TextureFactory.of(OVERLAY_PIPE_OUT)}; + return new ITexture[] { + TextureFactory.of( + isBricked() ? MACHINE_STEELBRICKS_TOP : MACHINE_STEEL_TOP, + Dyes.getModulation(aColor, Dyes._NULL.mRGBa)), + TextureFactory.of(OVERLAY_PIPE_OUT) + }; } @Override public ITexture[] getTopFacingPipeInactive(byte aColor) { - return new ITexture[]{TextureFactory.of(isBricked() ? MACHINE_STEELBRICKS_TOP : MACHINE_STEEL_TOP, Dyes.getModulation(aColor, Dyes._NULL.mRGBa)), TextureFactory.of(OVERLAY_PIPE_OUT)}; + return new ITexture[] { + TextureFactory.of( + isBricked() ? MACHINE_STEELBRICKS_TOP : MACHINE_STEEL_TOP, + Dyes.getModulation(aColor, Dyes._NULL.mRGBa)), + TextureFactory.of(OVERLAY_PIPE_OUT) + }; } @Override public ITexture[] getSideFacingPipeActive(byte aColor) { - return new ITexture[]{TextureFactory.of(isBricked() ? MACHINE_STEELBRICKS_SIDE : MACHINE_STEEL_SIDE, Dyes.getModulation(aColor, Dyes._NULL.mRGBa)), TextureFactory.of(OVERLAY_PIPE_OUT)}; + return new ITexture[] { + TextureFactory.of( + isBricked() ? MACHINE_STEELBRICKS_SIDE : MACHINE_STEEL_SIDE, + Dyes.getModulation(aColor, Dyes._NULL.mRGBa)), + TextureFactory.of(OVERLAY_PIPE_OUT) + }; } @Override public ITexture[] getSideFacingPipeInactive(byte aColor) { - return new ITexture[]{TextureFactory.of(isBricked() ? MACHINE_STEELBRICKS_SIDE : MACHINE_STEEL_SIDE, Dyes.getModulation(aColor, Dyes._NULL.mRGBa)), TextureFactory.of(OVERLAY_PIPE_OUT)}; + return new ITexture[] { + TextureFactory.of( + isBricked() ? MACHINE_STEELBRICKS_SIDE : MACHINE_STEEL_SIDE, + Dyes.getModulation(aColor, Dyes._NULL.mRGBa)), + TextureFactory.of(OVERLAY_PIPE_OUT) + }; } } 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 bc031e0e6f..c1b734baf6 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 @@ -19,7 +19,8 @@ import net.minecraftforge.fluids.FluidTankInfo; * * This is the main construct for my generic Tanks. Filling and emptying behavior have to be implemented manually */ -public abstract class GT_MetaTileEntity_BasicTank extends GT_MetaTileEntity_TieredMachineBlock implements IHasFluidDisplayItem { +public abstract class GT_MetaTileEntity_BasicTank extends GT_MetaTileEntity_TieredMachineBlock + implements IHasFluidDisplayItem { public FluidStack mFluid; protected int mOpenerCount; @@ -27,19 +28,35 @@ public abstract class GT_MetaTileEntity_BasicTank extends GT_MetaTileEntity_Tier /** * @param aInvSlotCount should be 3 */ - public GT_MetaTileEntity_BasicTank(int aID, String aName, String aNameRegional, int aTier, int aInvSlotCount, String aDescription, ITexture... aTextures) { + public GT_MetaTileEntity_BasicTank( + int aID, + String aName, + String aNameRegional, + int aTier, + int aInvSlotCount, + String aDescription, + ITexture... aTextures) { super(aID, aName, aNameRegional, aTier, aInvSlotCount, aDescription, aTextures); } - public GT_MetaTileEntity_BasicTank(int aID, String aName, String aNameRegional, int aTier, int aInvSlotCount, String[] aDescription, ITexture... aTextures) { + public GT_MetaTileEntity_BasicTank( + int aID, + String aName, + String aNameRegional, + int aTier, + int aInvSlotCount, + String[] aDescription, + ITexture... aTextures) { super(aID, aName, aNameRegional, aTier, aInvSlotCount, aDescription, aTextures); } - public GT_MetaTileEntity_BasicTank(String aName, int aTier, int aInvSlotCount, String aDescription, ITexture[][][] aTextures) { + public GT_MetaTileEntity_BasicTank( + String aName, int aTier, int aInvSlotCount, String aDescription, ITexture[][][] aTextures) { super(aName, aTier, aInvSlotCount, aDescription, aTextures); } - public GT_MetaTileEntity_BasicTank(String aName, int aTier, int aInvSlotCount, String[] aDescription, ITexture[][][] aTextures) { + public GT_MetaTileEntity_BasicTank( + String aName, int aTier, int aInvSlotCount, String[] aDescription, ITexture[][][] aTextures) { super(aName, aTier, aInvSlotCount, aDescription, aTextures); } @@ -138,8 +155,7 @@ public abstract class GT_MetaTileEntity_BasicTank extends GT_MetaTileEntity_Tier public void onOpenGUI() { super.onOpenGUI(); mOpenerCount++; - if (mOpenerCount == 1) - updateFluidDisplayItem(); + if (mOpenerCount == 1) updateFluidDisplayItem(); } @Override @@ -154,23 +170,29 @@ public abstract class GT_MetaTileEntity_BasicTank extends GT_MetaTileEntity_Tier if (isFluidChangingAllowed() && getFillableStack() != null && getFillableStack().amount <= 0) setFillableStack(null); - if (mOpenerCount > 0) - updateFluidDisplayItem(); + if (mOpenerCount > 0) updateFluidDisplayItem(); if (doesEmptyContainers()) { FluidStack tFluid = GT_Utility.getFluidForFilledItem(mInventory[getInputSlot()], true); if (tFluid != null && isFluidInputAllowed(tFluid)) { if (getFillableStack() == null) { if (isFluidInputAllowed(tFluid) && tFluid.amount <= getCapacity()) { - if (aBaseMetaTileEntity.addStackToSlot(getOutputSlot(), GT_Utility.getContainerForFilledItem(mInventory[getInputSlot()], true), 1)) { + if (aBaseMetaTileEntity.addStackToSlot( + getOutputSlot(), + GT_Utility.getContainerForFilledItem(mInventory[getInputSlot()], true), + 1)) { setFillableStack(tFluid.copy()); this.onEmptyingContainerWhenEmpty(); aBaseMetaTileEntity.decrStackSize(getInputSlot(), 1); } } } else { - if (tFluid.isFluidEqual(getFillableStack()) && ((long)tFluid.amount + getFillableStack().amount) <= (long)getCapacity()) { - if (aBaseMetaTileEntity.addStackToSlot(getOutputSlot(), GT_Utility.getContainerForFilledItem(mInventory[getInputSlot()], true), 1)) { + if (tFluid.isFluidEqual(getFillableStack()) + && ((long) tFluid.amount + getFillableStack().amount) <= (long) getCapacity()) { + if (aBaseMetaTileEntity.addStackToSlot( + getOutputSlot(), + GT_Utility.getContainerForFilledItem(mInventory[getInputSlot()], true), + 1)) { getFillableStack().amount += tFluid.amount; aBaseMetaTileEntity.decrStackSize(getInputSlot(), 1); } @@ -180,7 +202,8 @@ 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); @@ -198,7 +221,8 @@ 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()); } } } @@ -215,8 +239,11 @@ 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)) - return 0; + if (aFluid == null + || aFluid.getFluid().getID() <= 0 + || aFluid.amount <= 0 + || !canTankBeFilled() + || !isFluidInputAllowed(aFluid)) return 0; if (getFillableStack() == null || getFillableStack().getFluid().getID() <= 0) { if (aFluid.amount <= getCapacity()) { @@ -234,8 +261,7 @@ public abstract class GT_MetaTileEntity_BasicTank extends GT_MetaTileEntity_Tier return getCapacity(); } - if (!getFillableStack().isFluidEqual(aFluid)) - return 0; + if (!getFillableStack().isFluidEqual(aFluid)) return 0; int space = getCapacity() - getFillableStack().amount; if (aFluid.amount <= space) { @@ -245,8 +271,7 @@ public abstract class GT_MetaTileEntity_BasicTank extends GT_MetaTileEntity_Tier } return aFluid.amount; } - if (doFill) - getFillableStack().amount = getCapacity(); + if (doFill) getFillableStack().amount = getCapacity(); return space; } @@ -260,8 +285,7 @@ public abstract class GT_MetaTileEntity_BasicTank extends GT_MetaTileEntity_Tier } int used = maxDrain; - if (getDrainableStack().amount < used) - used = getDrainableStack().amount; + if (getDrainableStack().amount < used) used = getDrainableStack().amount; if (doDrain) { getDrainableStack().amount -= used; @@ -281,14 +305,14 @@ public abstract class GT_MetaTileEntity_BasicTank extends GT_MetaTileEntity_Tier @Override public FluidTankInfo[] getTankInfo(ForgeDirection aSide) { - if (getCapacity() <= 0 && !getBaseMetaTileEntity().hasSteamEngineUpgrade()) return new FluidTankInfo[]{}; + if (getCapacity() <= 0 && !getBaseMetaTileEntity().hasSteamEngineUpgrade()) return new FluidTankInfo[] {}; if (isDrainableStackSeparate()) { - return new FluidTankInfo[]{ - new FluidTankInfo(getFillableStack(), getCapacity()), - new FluidTankInfo(getDrainableStack(), getCapacity()) + return new FluidTankInfo[] { + new FluidTankInfo(getFillableStack(), getCapacity()), + new FluidTankInfo(getDrainableStack(), getCapacity()) }; } else { - return new FluidTankInfo[]{new FluidTankInfo(this)}; + return new FluidTankInfo[] {new FluidTankInfo(this)}; } } @@ -302,7 +326,7 @@ public abstract class GT_MetaTileEntity_BasicTank extends GT_MetaTileEntity_Tier return aIndex == getInputSlot(); } - protected void onEmptyingContainerWhenEmpty(){ - //Do nothing + protected void onEmptyingContainerWhenEmpty() { + // Do nothing } } 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 32067744d5..e249be541e 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 @@ -1,19 +1,18 @@ package gregtech.api.metatileentity.implementations; +import static gregtech.api.enums.GT_Values.V; +import static gregtech.api.enums.Textures.BlockIcons.*; + import gregtech.api.interfaces.ITexture; import gregtech.api.interfaces.tileentity.IGregTechTileEntity; import gregtech.api.render.TextureFactory; import gregtech.api.util.GT_Utility; +import java.util.*; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; import net.minecraftforge.common.util.ForgeDirection; -import java.util.*; - -import static gregtech.api.enums.GT_Values.V; -import static gregtech.api.enums.Textures.BlockIcons.*; - public abstract class GT_MetaTileEntity_Buffer extends GT_MetaTileEntity_TieredMachineBlock { private static final int OUTPUT_INDEX = 0; private static final int ARROW_RIGHT_INDEX = 1; @@ -24,22 +23,30 @@ public abstract class GT_MetaTileEntity_Buffer extends GT_MetaTileEntity_TieredM public int mMaxStackSize = 64; public static int MAX = 8; - public boolean bOutput = false, bRedstoneIfFull = false, bInvert = false, bStockingMode = false, bSortStacks = false; + public boolean bOutput = false, + bRedstoneIfFull = false, + bInvert = false, + bStockingMode = false, + bSortStacks = false; public int mSuccess = 0, mTargetStackSize = 0; - public GT_MetaTileEntity_Buffer(int aID, String aName, String aNameRegional, int aTier, int aInvSlotCount, String aDescription) { + public GT_MetaTileEntity_Buffer( + int aID, String aName, String aNameRegional, int aTier, int aInvSlotCount, String aDescription) { super(aID, aName, aNameRegional, aTier, aInvSlotCount, aDescription); } - public GT_MetaTileEntity_Buffer(int aID, String aName, String aNameRegional, int aTier, int aInvSlotCount, String[] aDescription) { - super(aID, aName, aNameRegional, aTier, aInvSlotCount, aDescription); + public GT_MetaTileEntity_Buffer( + int aID, String aName, String aNameRegional, int aTier, int aInvSlotCount, String[] aDescription) { + super(aID, aName, aNameRegional, aTier, aInvSlotCount, aDescription); } - public GT_MetaTileEntity_Buffer(String aName, int aTier, int aInvSlotCount, String aDescription, ITexture[][][] aTextures) { + public GT_MetaTileEntity_Buffer( + String aName, int aTier, int aInvSlotCount, String aDescription, ITexture[][][] aTextures) { super(aName, aTier, aInvSlotCount, aDescription, aTextures); } - public GT_MetaTileEntity_Buffer(String aName, int aTier, int aInvSlotCount, String[] aDescription, ITexture[][][] aTextures) { + public GT_MetaTileEntity_Buffer( + String aName, int aTier, int aInvSlotCount, String[] aDescription, ITexture[][][] aTextures) { super(aName, aTier, aInvSlotCount, aDescription, aTextures); } @@ -61,18 +68,24 @@ public abstract class GT_MetaTileEntity_Buffer extends GT_MetaTileEntity_TieredM 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}; - rTextures[ARROW_DOWN_INDEX][i] = new ITexture[]{MACHINE_CASINGS[mTier][i], tDown, tIcon}; - rTextures[ARROW_LEFT_INDEX][i] = new ITexture[]{MACHINE_CASINGS[mTier][i], tLeft, tIcon}; - rTextures[ARROW_UP_INDEX][i] = new ITexture[]{MACHINE_CASINGS[mTier][i], tUp, tIcon}; - rTextures[FRONT_INDEX][i] = new ITexture[]{MACHINE_CASINGS[mTier][i], tIcon}; + rTextures[OUTPUT_INDEX][i] = new ITexture[] {MACHINE_CASINGS[mTier][i], tOut}; + rTextures[ARROW_RIGHT_INDEX][i] = new ITexture[] {MACHINE_CASINGS[mTier][i], tRight, tIcon}; + rTextures[ARROW_DOWN_INDEX][i] = new ITexture[] {MACHINE_CASINGS[mTier][i], tDown, tIcon}; + rTextures[ARROW_LEFT_INDEX][i] = new ITexture[] {MACHINE_CASINGS[mTier][i], tLeft, tIcon}; + rTextures[ARROW_UP_INDEX][i] = new ITexture[] {MACHINE_CASINGS[mTier][i], tUp, tIcon}; + rTextures[FRONT_INDEX][i] = new ITexture[] {MACHINE_CASINGS[mTier][i], tIcon}; } return rTextures; } @Override - public ITexture[] getTexture(IGregTechTileEntity aBaseMetaTileEntity, byte aSide, byte aFacing, byte aColorIndex, boolean aActive, boolean aRedstone) { + public ITexture[] getTexture( + IGregTechTileEntity aBaseMetaTileEntity, + byte aSide, + byte aFacing, + byte aColorIndex, + boolean aActive, + boolean aRedstone) { int colorIndex = aColorIndex + 1; ForgeDirection side = ForgeDirection.VALID_DIRECTIONS[aSide]; ForgeDirection facing = ForgeDirection.VALID_DIRECTIONS[aFacing]; @@ -237,9 +250,9 @@ public abstract class GT_MetaTileEntity_Buffer extends GT_MetaTileEntity_TieredM if (aNBT.hasKey("bStockingMode")) { // Adding new key to existing NBT, need to protect if it is not there. bStockingMode = aNBT.getBoolean("bStockingMode"); } - if (aNBT.hasKey("bSortStacks")) { - bSortStacks = aNBT.getBoolean("bSortStacks"); - } + if (aNBT.hasKey("bSortStacks")) { + bSortStacks = aNBT.getBoolean("bSortStacks"); + } mTargetStackSize = aNBT.getInteger("mTargetStackSize"); } @@ -253,18 +266,22 @@ public abstract class GT_MetaTileEntity_Buffer extends GT_MetaTileEntity_TieredM public void onScrewdriverRightClick(byte aSide, EntityPlayer aPlayer, float aX, float aY, float aZ) { if (aSide == getBaseMetaTileEntity().getBackFacing()) { - mTargetStackSize = (byte) ((mTargetStackSize + (aPlayer.isSneaking()? -1 : 1)) % 65); - if(mTargetStackSize <0){mTargetStackSize = mMaxStackSize;} + mTargetStackSize = (byte) ((mTargetStackSize + (aPlayer.isSneaking() ? -1 : 1)) % 65); + if (mTargetStackSize < 0) { + mTargetStackSize = mMaxStackSize; + } if (mTargetStackSize == 0) { - GT_Utility.sendChatToPlayer(aPlayer, GT_Utility.trans("098","Do not regulate Item Stack Size")); + GT_Utility.sendChatToPlayer(aPlayer, GT_Utility.trans("098", "Do not regulate Item Stack Size")); } else { - GT_Utility.sendChatToPlayer(aPlayer, GT_Utility.trans("099","Regulate Item Stack Size to: ") + mTargetStackSize); + GT_Utility.sendChatToPlayer( + aPlayer, GT_Utility.trans("099", "Regulate Item Stack Size to: ") + mTargetStackSize); } } } @Override - public boolean onWrenchRightClick(byte aSide, byte aWrenchingSide, EntityPlayer aPlayer, float aX, float aY, float aZ) { + public boolean onWrenchRightClick( + byte aSide, byte aWrenchingSide, EntityPlayer aPlayer, float aX, float aY, float aZ) { aWrenchingSide = GT_Utility.getOppositeSide(aWrenchingSide); if (getBaseMetaTileEntity().isValidFacing(aWrenchingSide)) { getBaseMetaTileEntity().setFrontFacing(aWrenchingSide); @@ -282,20 +299,22 @@ public abstract class GT_MetaTileEntity_Buffer extends GT_MetaTileEntity_TieredM break; } } - if (bInvert) - hasEmptySlots = !hasEmptySlots; + if (bInvert) hasEmptySlots = !hasEmptySlots; for (byte b = 0; b < 6; b++) aBaseMetaTileEntity.setInternalOutputRedstoneSignal(b, hasEmptySlots ? (byte) 0 : (byte) 15); - } - else { - for(byte b = 0;b<6;b++) - aBaseMetaTileEntity.setInternalOutputRedstoneSignal(b, (byte)0); + } else { + for (byte b = 0; b < 6; b++) aBaseMetaTileEntity.setInternalOutputRedstoneSignal(b, (byte) 0); } } @Override public void onPostTick(IGregTechTileEntity aBaseMetaTileEntity, long aTimer) { - if (aBaseMetaTileEntity.isAllowedToWork() && aBaseMetaTileEntity.isServerSide() && (aBaseMetaTileEntity.hasWorkJustBeenEnabled() || aBaseMetaTileEntity.hasInventoryBeenModified() || aTimer % 200 == 0 || mSuccess > 0)) { + if (aBaseMetaTileEntity.isAllowedToWork() + && aBaseMetaTileEntity.isServerSide() + && (aBaseMetaTileEntity.hasWorkJustBeenEnabled() + || aBaseMetaTileEntity.hasInventoryBeenModified() + || aTimer % 200 == 0 + || mSuccess > 0)) { mSuccess--; updateSlots(); moveItems(aBaseMetaTileEntity, aTimer); @@ -305,8 +324,7 @@ public abstract class GT_MetaTileEntity_Buffer extends GT_MetaTileEntity_TieredM @Override public void onFirstTick(IGregTechTileEntity aBaseMetaTileEntity) { - for(byte b = 0;b<6;b++) - aBaseMetaTileEntity.setInternalOutputRedstoneSignal(b,(byte)0); + for (byte b = 0; b < 6; b++) aBaseMetaTileEntity.setInternalOutputRedstoneSignal(b, (byte) 0); } protected void moveItems(IGregTechTileEntity aBaseMetaTileEntity, long aTimer) { @@ -314,15 +332,37 @@ public abstract class GT_MetaTileEntity_Buffer extends GT_MetaTileEntity_TieredM } protected void moveItems(IGregTechTileEntity aBaseMetaTileEntity, long aTimer, int stacks) { - int tCost; - if (bStockingMode) - tCost = GT_Utility.moveMultipleItemStacks(aBaseMetaTileEntity, aBaseMetaTileEntity.getTileEntityAtSide(aBaseMetaTileEntity.getBackFacing()), aBaseMetaTileEntity.getBackFacing(), aBaseMetaTileEntity.getFrontFacing(), null, false, mTargetStackSize == 0 ? 64 : (byte) mTargetStackSize, mTargetStackSize == 0 ? 1 : (byte) mTargetStackSize, (byte) 64, (byte) 1, stacks); - else - tCost = GT_Utility.moveMultipleItemStacks(aBaseMetaTileEntity, aBaseMetaTileEntity.getTileEntityAtSide(aBaseMetaTileEntity.getBackFacing()), aBaseMetaTileEntity.getBackFacing(), aBaseMetaTileEntity.getFrontFacing(), null, false, (byte) 64, (byte) 1, mTargetStackSize == 0 ? 64 : (byte) mTargetStackSize, mTargetStackSize == 0 ? 1 : (byte) mTargetStackSize, stacks); - - if (tCost > 0 || aBaseMetaTileEntity.hasInventoryBeenModified()) { - mSuccess = 50; - } + int tCost; + if (bStockingMode) + tCost = GT_Utility.moveMultipleItemStacks( + aBaseMetaTileEntity, + aBaseMetaTileEntity.getTileEntityAtSide(aBaseMetaTileEntity.getBackFacing()), + aBaseMetaTileEntity.getBackFacing(), + aBaseMetaTileEntity.getFrontFacing(), + null, + false, + mTargetStackSize == 0 ? 64 : (byte) mTargetStackSize, + mTargetStackSize == 0 ? 1 : (byte) mTargetStackSize, + (byte) 64, + (byte) 1, + stacks); + else + tCost = GT_Utility.moveMultipleItemStacks( + aBaseMetaTileEntity, + aBaseMetaTileEntity.getTileEntityAtSide(aBaseMetaTileEntity.getBackFacing()), + aBaseMetaTileEntity.getBackFacing(), + aBaseMetaTileEntity.getFrontFacing(), + null, + false, + (byte) 64, + (byte) 1, + mTargetStackSize == 0 ? 64 : (byte) mTargetStackSize, + mTargetStackSize == 0 ? 1 : (byte) mTargetStackSize, + stacks); + + if (tCost > 0 || aBaseMetaTileEntity.hasInventoryBeenModified()) { + mSuccess = 50; + } } @Override @@ -336,15 +376,14 @@ public abstract class GT_MetaTileEntity_Buffer extends GT_MetaTileEntity_TieredM } @Override - public boolean allowGeneralRedstoneOutput(){ - return true; + public boolean allowGeneralRedstoneOutput() { + return true; } public void updateSlots() { for (int i = 0; i < mInventory.length; i++) if (mInventory[i] != null && mInventory[i].stackSize <= 0) mInventory[i] = null; - if (bSortStacks) - fillStacksIntoFirstSlots(); + if (bSortStacks) fillStacksIntoFirstSlots(); } protected void fillStacksIntoFirstSlots() { @@ -353,24 +392,20 @@ public abstract class GT_MetaTileEntity_Buffer extends GT_MetaTileEntity_TieredM List<GT_Utility.ItemId> order = new ArrayList<>(mInventory.length); List<Integer> validSlots = new ArrayList<>(mInventory.length); for (int i = 0; i < mInventory.length - 1; i++) { - if (!isValidSlot(i)) - continue; + if (!isValidSlot(i)) continue; validSlots.add(i); ItemStack s = mInventory[i]; - if(s == null) - continue; + if (s == null) continue; GT_Utility.ItemId sID = GT_Utility.ItemId.createNoCopy(s); slots.merge(sID, s.stackSize, Integer::sum); - if(!stacks.containsKey(sID)) - stacks.put(sID, s); + if (!stacks.containsKey(sID)) stacks.put(sID, s); order.add(sID); mInventory[i] = null; } int slotindex = 0; for (GT_Utility.ItemId sID : order) { int toSet = slots.get(sID); - if (toSet == 0) - continue; + if (toSet == 0) continue; int slot = validSlots.get(slotindex); slotindex++; mInventory[slot] = stacks.get(sID).copy(); @@ -381,14 +416,15 @@ public abstract class GT_MetaTileEntity_Buffer extends GT_MetaTileEntity_TieredM } @Override - public boolean onSolderingToolRightClick(byte aSide, byte aWrenchingSide, EntityPlayer aPlayer, float aX, float aY, float aZ) { + public boolean onSolderingToolRightClick( + byte aSide, byte aWrenchingSide, EntityPlayer aPlayer, float aX, float aY, float aZ) { if (aPlayer.isSneaking()) { // I was so proud of all this but I literally just copied code from OutputBus bSortStacks = !bSortStacks; - GT_Utility.sendChatToPlayer(aPlayer, GT_Utility.trans("200", "Sort mode: " + (bSortStacks ? "Enabled" : "Disabled"))); + GT_Utility.sendChatToPlayer( + aPlayer, GT_Utility.trans("200", "Sort mode: " + (bSortStacks ? "Enabled" : "Disabled"))); return true; } - return super.onSolderingToolRightClick(aSide,aWrenchingSide,aPlayer,aX,aY,aZ); + return super.onSolderingToolRightClick(aSide, aWrenchingSide, aPlayer, aX, aY, aZ); } - } 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 c2212e331e..e9e2e8f575 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 @@ -1,5 +1,11 @@ package gregtech.api.metatileentity.implementations; +import static com.gtnewhorizon.structurelib.structure.StructureUtility.lazy; +import static com.gtnewhorizon.structurelib.structure.StructureUtility.ofChain; +import static com.gtnewhorizon.structurelib.structure.StructureUtility.onElementPass; +import static com.gtnewhorizon.structurelib.structure.StructureUtility.transpose; +import static gregtech.api.enums.GT_HatchElement.*; + import com.google.common.collect.ImmutableList; import com.gtnewhorizon.structurelib.alignment.constructable.ISurvivalConstructable; import com.gtnewhorizon.structurelib.structure.IItemSource; @@ -9,17 +15,10 @@ import com.gtnewhorizon.structurelib.structure.StructureDefinition; import gregtech.api.interfaces.IHatchElement; import gregtech.api.interfaces.tileentity.IGregTechTileEntity; import gregtech.api.util.GT_StructureUtility; +import java.util.List; import net.minecraft.entity.player.EntityPlayerMP; import net.minecraft.item.ItemStack; -import java.util.List; - -import static com.gtnewhorizon.structurelib.structure.StructureUtility.lazy; -import static com.gtnewhorizon.structurelib.structure.StructureUtility.ofChain; -import static com.gtnewhorizon.structurelib.structure.StructureUtility.onElementPass; -import static com.gtnewhorizon.structurelib.structure.StructureUtility.transpose; -import static gregtech.api.enums.GT_HatchElement.*; - /** * A simple 3x3x3 hollow cubic multiblock, that can be arbitrarily rotated, made of a single type of machine casing and accepts hatches everywhere. * Controller will be placed in front center of the structure. @@ -35,100 +34,102 @@ import static gregtech.api.enums.GT_HatchElement.*; * * @param <T> */ -public abstract class GT_MetaTileEntity_CubicMultiBlockBase<T extends GT_MetaTileEntity_CubicMultiBlockBase<T>> extends GT_MetaTileEntity_EnhancedMultiBlockBase<T> implements ISurvivalConstructable { - protected static final String STRUCTURE_PIECE_MAIN = "main"; - protected static final ClassValue<IStructureDefinition<GT_MetaTileEntity_CubicMultiBlockBase<?>>> STRUCTURE_DEFINITION = new ClassValue<IStructureDefinition<GT_MetaTileEntity_CubicMultiBlockBase<?>>>() { - @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(); - } - }; - private int mCasingAmount = 0; - - protected GT_MetaTileEntity_CubicMultiBlockBase(int aID, String aName, String aNameRegional) { - super(aID, aName, aNameRegional); - } +public abstract class GT_MetaTileEntity_CubicMultiBlockBase<T extends GT_MetaTileEntity_CubicMultiBlockBase<T>> + extends GT_MetaTileEntity_EnhancedMultiBlockBase<T> implements ISurvivalConstructable { + protected static final String STRUCTURE_PIECE_MAIN = "main"; + protected static final ClassValue<IStructureDefinition<GT_MetaTileEntity_CubicMultiBlockBase<?>>> + STRUCTURE_DEFINITION = new ClassValue<IStructureDefinition<GT_MetaTileEntity_CubicMultiBlockBase<?>>>() { + @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(); + } + }; + private int mCasingAmount = 0; + + protected GT_MetaTileEntity_CubicMultiBlockBase(int aID, String aName, String aNameRegional) { + super(aID, aName, aNameRegional); + } - protected GT_MetaTileEntity_CubicMultiBlockBase(String aName) { - super(aName); - } + protected GT_MetaTileEntity_CubicMultiBlockBase(String aName) { + super(aName); + } - /** - * Create a simple 3x3x3 hollow cubic structure made of a single type of machine casing and accepts hatches everywhere. - * <p> - * The created definition contains a single piece named {@link #STRUCTURE_PIECE_MAIN}. - */ - @Override - @SuppressWarnings("unchecked") - public IStructureDefinition<T> getStructureDefinition() { - return (IStructureDefinition<T>) STRUCTURE_DEFINITION.get(getClass()); - } + /** + * Create a simple 3x3x3 hollow cubic structure made of a single type of machine casing and accepts hatches everywhere. + * <p> + * The created definition contains a single piece named {@link #STRUCTURE_PIECE_MAIN}. + */ + @Override + @SuppressWarnings("unchecked") + public IStructureDefinition<T> getStructureDefinition() { + return (IStructureDefinition<T>) STRUCTURE_DEFINITION.get(getClass()); + } - @Override - public void construct(ItemStack aStack, boolean aHintsOnly) { - buildPiece(STRUCTURE_PIECE_MAIN, aStack, aHintsOnly, 1, 1, 0); - } + @Override + public void construct(ItemStack aStack, boolean aHintsOnly) { + buildPiece(STRUCTURE_PIECE_MAIN, aStack, aHintsOnly, 1, 1, 0); + } @Override public int survivalConstruct(ItemStack stackSize, int elementBudget, IItemSource source, EntityPlayerMP actor) { if (mMachine) return -1; - return survivialBuildPiece(STRUCTURE_PIECE_MAIN, stackSize, 1, 1, 0, elementBudget, source, actor,false, true); + return survivialBuildPiece(STRUCTURE_PIECE_MAIN, stackSize, 1, 1, 0, elementBudget, source, actor, false, true); } @Override - public boolean checkMachine(IGregTechTileEntity aBaseMetaTileEntity, ItemStack aStack) { - mCasingAmount = 0; - return checkPiece(STRUCTURE_PIECE_MAIN, 1, 1, 0) && - mCasingAmount >= getRequiredCasingCount() && - checkHatches(aBaseMetaTileEntity, aStack); - } + public boolean checkMachine(IGregTechTileEntity aBaseMetaTileEntity, ItemStack aStack) { + mCasingAmount = 0; + return checkPiece(STRUCTURE_PIECE_MAIN, 1, 1, 0) + && mCasingAmount >= getRequiredCasingCount() + && checkHatches(aBaseMetaTileEntity, aStack); + } - /** - * Called by {@link #checkMachine(IGregTechTileEntity, ItemStack)} to check if all required hatches are present. - * <p> - * Default implementation requires EXACTLY ONE maintenance hatch to be present, and ignore all other conditions. - * - * @param aBaseMetaTileEntity the tile entity of self - * @param aStack The item stack inside the controller - * @return true if the test passes, false otherwise - */ - protected boolean checkHatches(IGregTechTileEntity aBaseMetaTileEntity, ItemStack aStack) { - return mMaintenanceHatches.size() == 1; - } + /** + * Called by {@link #checkMachine(IGregTechTileEntity, ItemStack)} to check if all required hatches are present. + * <p> + * Default implementation requires EXACTLY ONE maintenance hatch to be present, and ignore all other conditions. + * + * @param aBaseMetaTileEntity the tile entity of self + * @param aStack The item stack inside the controller + * @return true if the test passes, false otherwise + */ + protected boolean checkHatches(IGregTechTileEntity aBaseMetaTileEntity, ItemStack aStack) { + return mMaintenanceHatches.size() == 1; + } - protected abstract IStructureElement<GT_MetaTileEntity_CubicMultiBlockBase<?>> getCasingElement(); + protected abstract IStructureElement<GT_MetaTileEntity_CubicMultiBlockBase<?>> getCasingElement(); protected List<IHatchElement<? super GT_MetaTileEntity_CubicMultiBlockBase<?>>> getAllowedHatches() { return ImmutableList.of(InputHatch, OutputHatch, InputBus, OutputBus, Muffler, Maintenance, Energy); } - /** - * The hatch's texture index. - */ - protected abstract int getHatchTextureIndex(); + /** + * The hatch's texture index. + */ + protected abstract int getHatchTextureIndex(); - protected abstract int getRequiredCasingCount(); + protected abstract int getRequiredCasingCount(); - protected void onCorrectCasingAdded() { - mCasingAmount++; - } + protected void onCorrectCasingAdded() { + mCasingAmount++; + } } 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 1e85933522..76787fcd32 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 @@ -19,7 +19,6 @@ import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; import net.minecraftforge.common.util.ForgeDirection; - /** * Enhanced multiblock base class, featuring following improvement over {@link GT_MetaTileEntity_MultiBlockBase} * <p> @@ -28,149 +27,225 @@ import net.minecraftforge.common.util.ForgeDirection; * * @param <T> type of this */ -public abstract class GT_MetaTileEntity_EnhancedMultiBlockBase<T extends GT_MetaTileEntity_EnhancedMultiBlockBase<T>> extends GT_MetaTileEntity_TooltipMultiBlockBase implements IAlignment, IConstructable { - private ExtendedFacing mExtendedFacing = ExtendedFacing.DEFAULT; - private IAlignmentLimits mLimits = getInitialAlignmentLimits(); - - protected GT_MetaTileEntity_EnhancedMultiBlockBase(int aID, String aName, String aNameRegional) { - super(aID, aName, aNameRegional); - } - - protected GT_MetaTileEntity_EnhancedMultiBlockBase(String aName) { - super(aName); - } - - @Override - public ExtendedFacing getExtendedFacing() { - return mExtendedFacing; - } - - @Override - public void setExtendedFacing(ExtendedFacing newExtendedFacing) { - if (mExtendedFacing != newExtendedFacing) { - if(mMachine) - stopMachine(); - mExtendedFacing = newExtendedFacing; - final IGregTechTileEntity base = getBaseMetaTileEntity(); - mMachine = false; - mUpdated = false; - mUpdate = 100; - if (getBaseMetaTileEntity().isServerSide()) { - StructureLibAPI.sendAlignment((IAlignmentProvider) base, - new NetworkRegistry.TargetPoint(base.getWorld().provider.dimensionId, base.getXCoord(), base.getYCoord(), base.getZCoord(), 512)); - } else { - base.issueTextureUpdate(); - } - } - } - - @Override - public final boolean isFacingValid(byte aFacing) { - return canSetToDirectionAny(ForgeDirection.getOrientation(aFacing)); - } - - @Override - public boolean onWrenchRightClick(byte aSide, byte aWrenchingSide, EntityPlayer aPlayer, float aX, float aY, float aZ) { - if (aWrenchingSide != getBaseMetaTileEntity().getFrontFacing()) - return super.onWrenchRightClick(aSide, aWrenchingSide, aPlayer, aX, aY, aZ); - if (aPlayer.isSneaking()) { - // we won't be allowing horizontal flips, as it can be perfectly emulated by rotating twice and flipping horizontally - // allowing an extra round of flip make it hard to draw meaningful flip markers in GT_Proxy#drawGrid - toolSetFlip(getFlip().isHorizontallyFlipped() ? Flip.NONE : Flip.HORIZONTAL); - } else { - toolSetRotation(null); - } - return true; - } - - @Override - public void onFacingChange() { - toolSetDirection(ForgeDirection.getOrientation(getBaseMetaTileEntity().getFrontFacing())); - } - - @Override - public IAlignmentLimits getAlignmentLimits() { - return mLimits; - } - - protected void setAlignmentLimits(IAlignmentLimits mLimits) { - this.mLimits = mLimits; - } - - /** - * Due to limitation of Java type system, you might need to do an unchecked cast. - * HOWEVER, the returned IStructureDefinition is expected to be evaluated against current instance only, and should - * not be used against other instances, even for those of the same class. - */ - public abstract IStructureDefinition<T> getStructureDefinition(); - - protected abstract GT_Multiblock_Tooltip_Builder createTooltip(); - - @Override - public String[] getStructureDescription(ItemStack stackSize) { - return getTooltip().getStructureHint(); - } - - protected IAlignmentLimits getInitialAlignmentLimits() { - return (d, r, f) -> !f.isVerticallyFliped(); - } - - @Override - public void saveNBTData(NBTTagCompound aNBT) { - super.saveNBTData(aNBT); - aNBT.setByte("eRotation", (byte) mExtendedFacing.getRotation().getIndex()); - aNBT.setByte("eFlip", (byte) mExtendedFacing.getFlip().getIndex()); - } - - @Override - public void loadNBTData(NBTTagCompound aNBT) { - super.loadNBTData(aNBT); - mExtendedFacing = ExtendedFacing.of(ForgeDirection.getOrientation(getBaseMetaTileEntity().getFrontFacing()), - Rotation.byIndex(aNBT.getByte("eRotation")), - Flip.byIndex(aNBT.getByte("eFlip"))); - } - - @SuppressWarnings("unchecked") - private IStructureDefinition<GT_MetaTileEntity_EnhancedMultiBlockBase<T>> getCastedStructureDefinition() { - return (IStructureDefinition<GT_MetaTileEntity_EnhancedMultiBlockBase<T>>) getStructureDefinition(); - } - - /** - * Explanation of the world coordinate these offset means: - * - * Imagine you stand in front of the controller, with controller facing towards you not rotated or flipped. - * - * The horizontalOffset would be the number of blocks on the left side of the controller, not counting controller itself. - * The verticalOffset would be the number of blocks on the top side of the controller, not counting controller itself. - * The depthOffset would be the number of blocks between you and controller, not counting controller itself. - * - * All these offsets can be negative. - */ - protected final boolean checkPiece(String piece, int horizontalOffset, int verticalOffset, int depthOffset) { - final IGregTechTileEntity tTile = getBaseMetaTileEntity(); - return getCastedStructureDefinition().check(this, piece, tTile.getWorld(), getExtendedFacing(), tTile.getXCoord(), tTile.getYCoord(), tTile.getZCoord(), horizontalOffset, verticalOffset, depthOffset, !mMachine); - } - - protected final boolean buildPiece(String piece, ItemStack trigger, boolean hintOnly, int horizontalOffset, int verticalOffset, int depthOffset) { +public abstract class GT_MetaTileEntity_EnhancedMultiBlockBase<T extends GT_MetaTileEntity_EnhancedMultiBlockBase<T>> + extends GT_MetaTileEntity_TooltipMultiBlockBase implements IAlignment, IConstructable { + private ExtendedFacing mExtendedFacing = ExtendedFacing.DEFAULT; + private IAlignmentLimits mLimits = getInitialAlignmentLimits(); + + protected GT_MetaTileEntity_EnhancedMultiBlockBase(int aID, String aName, String aNameRegional) { + super(aID, aName, aNameRegional); + } + + protected GT_MetaTileEntity_EnhancedMultiBlockBase(String aName) { + super(aName); + } + + @Override + public ExtendedFacing getExtendedFacing() { + return mExtendedFacing; + } + + @Override + public void setExtendedFacing(ExtendedFacing newExtendedFacing) { + if (mExtendedFacing != newExtendedFacing) { + if (mMachine) stopMachine(); + mExtendedFacing = newExtendedFacing; + final IGregTechTileEntity base = getBaseMetaTileEntity(); + mMachine = false; + mUpdated = false; + mUpdate = 100; + if (getBaseMetaTileEntity().isServerSide()) { + StructureLibAPI.sendAlignment( + (IAlignmentProvider) base, + new NetworkRegistry.TargetPoint( + base.getWorld().provider.dimensionId, + base.getXCoord(), + base.getYCoord(), + base.getZCoord(), + 512)); + } else { + base.issueTextureUpdate(); + } + } + } + + @Override + public final boolean isFacingValid(byte aFacing) { + return canSetToDirectionAny(ForgeDirection.getOrientation(aFacing)); + } + + @Override + public boolean onWrenchRightClick( + byte aSide, byte aWrenchingSide, EntityPlayer aPlayer, float aX, float aY, float aZ) { + if (aWrenchingSide != getBaseMetaTileEntity().getFrontFacing()) + return super.onWrenchRightClick(aSide, aWrenchingSide, aPlayer, aX, aY, aZ); + if (aPlayer.isSneaking()) { + // we won't be allowing horizontal flips, as it can be perfectly emulated by rotating twice and flipping + // horizontally + // allowing an extra round of flip make it hard to draw meaningful flip markers in GT_Proxy#drawGrid + toolSetFlip(getFlip().isHorizontallyFlipped() ? Flip.NONE : Flip.HORIZONTAL); + } else { + toolSetRotation(null); + } + return true; + } + + @Override + public void onFacingChange() { + toolSetDirection(ForgeDirection.getOrientation(getBaseMetaTileEntity().getFrontFacing())); + } + + @Override + public IAlignmentLimits getAlignmentLimits() { + return mLimits; + } + + protected void setAlignmentLimits(IAlignmentLimits mLimits) { + this.mLimits = mLimits; + } + + /** + * Due to limitation of Java type system, you might need to do an unchecked cast. + * HOWEVER, the returned IStructureDefinition is expected to be evaluated against current instance only, and should + * not be used against other instances, even for those of the same class. + */ + public abstract IStructureDefinition<T> getStructureDefinition(); + + protected abstract GT_Multiblock_Tooltip_Builder createTooltip(); + + @Override + public String[] getStructureDescription(ItemStack stackSize) { + return getTooltip().getStructureHint(); + } + + protected IAlignmentLimits getInitialAlignmentLimits() { + return (d, r, f) -> !f.isVerticallyFliped(); + } + + @Override + public void saveNBTData(NBTTagCompound aNBT) { + super.saveNBTData(aNBT); + aNBT.setByte("eRotation", (byte) mExtendedFacing.getRotation().getIndex()); + aNBT.setByte("eFlip", (byte) mExtendedFacing.getFlip().getIndex()); + } + + @Override + public void loadNBTData(NBTTagCompound aNBT) { + super.loadNBTData(aNBT); + mExtendedFacing = ExtendedFacing.of( + ForgeDirection.getOrientation(getBaseMetaTileEntity().getFrontFacing()), + Rotation.byIndex(aNBT.getByte("eRotation")), + Flip.byIndex(aNBT.getByte("eFlip"))); + } + + @SuppressWarnings("unchecked") + private IStructureDefinition<GT_MetaTileEntity_EnhancedMultiBlockBase<T>> getCastedStructureDefinition() { + return (IStructureDefinition<GT_MetaTileEntity_EnhancedMultiBlockBase<T>>) getStructureDefinition(); + } + + /** + * Explanation of the world coordinate these offset means: + * + * Imagine you stand in front of the controller, with controller facing towards you not rotated or flipped. + * + * The horizontalOffset would be the number of blocks on the left side of the controller, not counting controller itself. + * The verticalOffset would be the number of blocks on the top side of the controller, not counting controller itself. + * The depthOffset would be the number of blocks between you and controller, not counting controller itself. + * + * All these offsets can be negative. + */ + protected final boolean checkPiece(String piece, int horizontalOffset, int verticalOffset, int depthOffset) { final IGregTechTileEntity tTile = getBaseMetaTileEntity(); - return getCastedStructureDefinition().buildOrHints(this, trigger, piece, tTile.getWorld(), getExtendedFacing(), tTile.getXCoord(), tTile.getYCoord(), tTile.getZCoord(), horizontalOffset, verticalOffset, depthOffset, hintOnly); + return getCastedStructureDefinition() + .check( + this, + piece, + tTile.getWorld(), + getExtendedFacing(), + tTile.getXCoord(), + tTile.getYCoord(), + tTile.getZCoord(), + horizontalOffset, + verticalOffset, + depthOffset, + !mMachine); } - protected final int survivialBuildPiece(String piece, ItemStack trigger, int horizontalOffset, int verticalOffset, int depthOffset, int elementsBudget, IItemSource source, EntityPlayerMP actor, boolean check) { + protected final boolean buildPiece( + String piece, + ItemStack trigger, + boolean hintOnly, + int horizontalOffset, + int verticalOffset, + int depthOffset) { final IGregTechTileEntity tTile = getBaseMetaTileEntity(); - return getCastedStructureDefinition().survivalBuild(this, trigger, piece, tTile.getWorld(), getExtendedFacing(), tTile.getXCoord(), tTile.getYCoord(), tTile.getZCoord(), horizontalOffset, verticalOffset, depthOffset, elementsBudget, source, actor, check); + return getCastedStructureDefinition() + .buildOrHints( + this, + trigger, + piece, + tTile.getWorld(), + getExtendedFacing(), + tTile.getXCoord(), + tTile.getYCoord(), + tTile.getZCoord(), + horizontalOffset, + verticalOffset, + depthOffset, + hintOnly); } - protected final int survivialBuildPiece(String piece, ItemStack trigger, int horizontalOffset, int verticalOffset, int depthOffset, int elementsBudget, IItemSource source, EntityPlayerMP actor, boolean check, boolean checkIfPlaced) { - int built = survivialBuildPiece(piece, trigger, horizontalOffset, verticalOffset, depthOffset, elementsBudget, source, actor, check); + protected final int survivialBuildPiece( + String piece, + ItemStack trigger, + int horizontalOffset, + int verticalOffset, + int depthOffset, + int elementsBudget, + IItemSource source, + EntityPlayerMP actor, + boolean check) { + final IGregTechTileEntity tTile = getBaseMetaTileEntity(); + return getCastedStructureDefinition() + .survivalBuild( + this, + trigger, + piece, + tTile.getWorld(), + getExtendedFacing(), + tTile.getXCoord(), + tTile.getYCoord(), + tTile.getZCoord(), + horizontalOffset, + verticalOffset, + depthOffset, + elementsBudget, + source, + actor, + check); + } + + protected final int survivialBuildPiece( + String piece, + ItemStack trigger, + int horizontalOffset, + int verticalOffset, + int depthOffset, + int elementsBudget, + IItemSource source, + EntityPlayerMP actor, + boolean check, + boolean checkIfPlaced) { + int built = survivialBuildPiece( + piece, trigger, horizontalOffset, verticalOffset, depthOffset, elementsBudget, source, actor, check); if (checkIfPlaced && built > 0) checkStructure(true, getBaseMetaTileEntity()); return built; } - @Override - public void onFirstTick(IGregTechTileEntity aBaseMetaTileEntity) { - super.onFirstTick(aBaseMetaTileEntity); - if (aBaseMetaTileEntity.isClientSide()) - StructureLibAPI.queryAlignment((IAlignmentProvider) aBaseMetaTileEntity); - } + @Override + public void onFirstTick(IGregTechTileEntity aBaseMetaTileEntity) { + super.onFirstTick(aBaseMetaTileEntity); + if (aBaseMetaTileEntity.isClientSide()) + StructureLibAPI.queryAlignment((IAlignmentProvider) aBaseMetaTileEntity); + } } diff --git a/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_Hatch.java b/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_Hatch.java index 82dbc3afd9..a92849a6d2 100644 --- a/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_Hatch.java +++ b/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_Hatch.java @@ -15,22 +15,39 @@ public abstract class GT_MetaTileEntity_Hatch extends GT_MetaTileEntity_BasicTan */ @Deprecated public byte mMachineBlock = 0; + private byte mTexturePage = 0; private byte actualTexture = 0; - public GT_MetaTileEntity_Hatch(int aID, String aName, String aNameRegional, int aTier, int aInvSlotCount, String aDescription, ITexture... aTextures) { + public GT_MetaTileEntity_Hatch( + int aID, + String aName, + String aNameRegional, + int aTier, + int aInvSlotCount, + String aDescription, + ITexture... aTextures) { super(aID, aName, aNameRegional, aTier, aInvSlotCount, aDescription, aTextures); } - public GT_MetaTileEntity_Hatch(int aID, String aName, String aNameRegional, int aTier, int aInvSlotCount, String[] aDescription, ITexture... aTextures) { + public GT_MetaTileEntity_Hatch( + int aID, + String aName, + String aNameRegional, + int aTier, + int aInvSlotCount, + String[] aDescription, + ITexture... aTextures) { super(aID, aName, aNameRegional, aTier, aInvSlotCount, aDescription, aTextures); } - public GT_MetaTileEntity_Hatch(String aName, int aTier, int aInvSlotCount, String aDescription, ITexture[][][] aTextures) { + public GT_MetaTileEntity_Hatch( + String aName, int aTier, int aInvSlotCount, String aDescription, ITexture[][][] aTextures) { super(aName, aTier, aInvSlotCount, aDescription, aTextures); } - public GT_MetaTileEntity_Hatch(String aName, int aTier, int aInvSlotCount, String []aDescription, ITexture[][][] aTextures) { + public GT_MetaTileEntity_Hatch( + String aName, int aTier, int aInvSlotCount, String[] aDescription, ITexture[][][] aTextures) { super(aName, aTier, aInvSlotCount, aDescription, aTextures); } @@ -48,30 +65,35 @@ public abstract class GT_MetaTileEntity_Hatch extends GT_MetaTileEntity_BasicTan public abstract ITexture[] getTexturesInactive(ITexture aBaseTexture); @Override - public ITexture[] getTexture(IGregTechTileEntity aBaseMetaTileEntity, byte aSide, byte aFacing, byte aColorIndex, boolean aActive, boolean aRedstone) { - int textureIndex = actualTexture | (mTexturePage << 7);//Shift seven since one page is 128 textures! - int texturePointer = (byte) (actualTexture & 0x7F);//just to be sure, from my testing the 8th bit cannot be set clientside + public ITexture[] getTexture( + IGregTechTileEntity aBaseMetaTileEntity, + byte aSide, + byte aFacing, + byte aColorIndex, + boolean aActive, + boolean aRedstone) { + int textureIndex = actualTexture | (mTexturePage << 7); // Shift seven since one page is 128 textures! + int texturePointer = + (byte) (actualTexture & 0x7F); // just to be sure, from my testing the 8th bit cannot be set clientside try { if (aSide != aFacing) { if (textureIndex > 0) - return new ITexture[]{Textures.BlockIcons.casingTexturePages[mTexturePage][texturePointer]}; - else - return new ITexture[]{Textures.BlockIcons.MACHINE_CASINGS[mTier][aColorIndex + 1]}; + return new ITexture[] {Textures.BlockIcons.casingTexturePages[mTexturePage][texturePointer]}; + else return new ITexture[] {Textures.BlockIcons.MACHINE_CASINGS[mTier][aColorIndex + 1]}; } else { if (textureIndex > 0) { if (aActive) return getTexturesActive(Textures.BlockIcons.casingTexturePages[mTexturePage][texturePointer]); else - return getTexturesInactive(Textures.BlockIcons.casingTexturePages[mTexturePage][texturePointer]); + return getTexturesInactive( + Textures.BlockIcons.casingTexturePages[mTexturePage][texturePointer]); } else { - if (aActive) - return getTexturesActive(Textures.BlockIcons.MACHINE_CASINGS[mTier][aColorIndex + 1]); - else - return getTexturesInactive(Textures.BlockIcons.MACHINE_CASINGS[mTier][aColorIndex + 1]); + if (aActive) return getTexturesActive(Textures.BlockIcons.MACHINE_CASINGS[mTier][aColorIndex + 1]); + else return getTexturesInactive(Textures.BlockIcons.MACHINE_CASINGS[mTier][aColorIndex + 1]); } } } catch (NullPointerException npe) { - return new ITexture[]{Textures.BlockIcons.MACHINE_CASINGS[0][0]}; + return new ITexture[] {Textures.BlockIcons.MACHINE_CASINGS[0][0]}; } } @@ -85,21 +107,21 @@ public abstract class GT_MetaTileEntity_Hatch extends GT_MetaTileEntity_BasicTan @Override public void loadNBTData(NBTTagCompound aNBT) { super.loadNBTData(aNBT); - actualTexture=aNBT.getByte("mMachineBlock"); - mTexturePage=aNBT.getByte("mTexturePage"); + actualTexture = aNBT.getByte("mMachineBlock"); + mTexturePage = aNBT.getByte("mTexturePage"); - if(mTexturePage!=0 && GT_Values.GT.isServerSide()) - actualTexture|=0x80;//<- lets just hope no one needs the correct value for that on server - mMachineBlock=actualTexture; + if (mTexturePage != 0 && GT_Values.GT.isServerSide()) + actualTexture |= 0x80; // <- lets just hope no one needs the correct value for that on server + mMachineBlock = actualTexture; } /** * Sets texture with page and index, called on add to machine list * @param id (page<<7)+index of the texture */ - public final void updateTexture(int id){ + public final void updateTexture(int id) { onValueUpdate((byte) id); - onTexturePageUpdate((byte) (id>>7)); + onTexturePageUpdate((byte) (id >> 7)); } /** @@ -108,34 +130,35 @@ public abstract class GT_MetaTileEntity_Hatch extends GT_MetaTileEntity_BasicTan * @param index index of texure */ @Deprecated - public final void updateTexture(byte page, byte index){ + public final void updateTexture(byte page, byte index) { onValueUpdate(index); onTexturePageUpdate(page); } @Override public final void onValueUpdate(byte aValue) { - actualTexture=(byte)(aValue & 0x7F); - mMachineBlock=actualTexture; - mTexturePage=0; + actualTexture = (byte) (aValue & 0x7F); + mMachineBlock = actualTexture; + mTexturePage = 0; } @Override public final byte getUpdateData() { - return (byte)(actualTexture & 0x7F); + return (byte) (actualTexture & 0x7F); } public final void onTexturePageUpdate(byte aValue) { - mTexturePage = (byte)(aValue & 0x7F); - if(mTexturePage!=0 && getBaseMetaTileEntity().isServerSide()) {//just to be sure - mMachineBlock|=0x80;//<- lets just hope no one needs the correct value for that on server - actualTexture=mMachineBlock; + mTexturePage = (byte) (aValue & 0x7F); + if (mTexturePage != 0 && getBaseMetaTileEntity().isServerSide()) { // just to be sure + mMachineBlock |= 0x80; // <- lets just hope no one needs the correct value for that on server + actualTexture = mMachineBlock; } - //set last bit to allow working of the page reset-er to 0 in rare case when texture id is the same but page changes to 0 + // set last bit to allow working of the page reset-er to 0 in rare case when texture id is the same but page + // changes to 0 } public final byte getTexturePage() { - return (byte)(mTexturePage & 0x7F); + return (byte) (mTexturePage & 0x7F); } @Override @@ -169,16 +192,22 @@ public abstract class GT_MetaTileEntity_Hatch extends GT_MetaTileEntity_BasicTan } @Override - public void onPreTick(IGregTechTileEntity aBaseMetaTileEntity, long aTick) {//in that method since it is usually not overriden, especially for hatches. - if(actualTexture!=mMachineBlock){//revert to page 0 on edition of the field - old code way - actualTexture=(byte)(mMachineBlock & 0x7F); - mMachineBlock=actualTexture;//clear last bit in mMachineBlock since now we are at page 0 after the direct field change - mTexturePage=0;//assuming old code only supports page 0 + public void onPreTick( + IGregTechTileEntity aBaseMetaTileEntity, + long aTick) { // in that method since it is usually not overriden, especially for hatches. + if (actualTexture != mMachineBlock) { // revert to page 0 on edition of the field - old code way + actualTexture = (byte) (mMachineBlock & 0x7F); + mMachineBlock = + actualTexture; // clear last bit in mMachineBlock since now we are at page 0 after the direct field + // change + mTexturePage = 0; // assuming old code only supports page 0 } super.onPreTick(aBaseMetaTileEntity, aTick); } - //To change to other page -> use the setter method -> updateTexture + // To change to other page -> use the setter method -> updateTexture - public int getCircuitSlot() { return -1; } + public int getCircuitSlot() { + return -1; + } } 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 ab6ba80f1b..bc4b82477d 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 @@ -1,5 +1,7 @@ package gregtech.api.metatileentity.implementations; +import static gregtech.api.enums.Textures.BlockIcons.OVERLAY_DATA_ACCESS; + import gregtech.api.gui.GT_Container_2by2; import gregtech.api.gui.GT_Container_4by4; import gregtech.api.gui.GT_GUIContainer_2by2; @@ -14,33 +16,32 @@ import net.minecraft.entity.player.InventoryPlayer; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; -import static gregtech.api.enums.Textures.BlockIcons.OVERLAY_DATA_ACCESS; - public class GT_MetaTileEntity_Hatch_DataAccess extends GT_MetaTileEntity_Hatch { - private int timeout=4; + private int timeout = 4; public GT_MetaTileEntity_Hatch_DataAccess(int aID, String aName, String aNameRegional, int aTier) { - super(aID, aName, aNameRegional, aTier, 16, new String[]{ - "Data Access for Multiblocks", - "Adds " + (aTier == 4 ? 4 : 16) + " extra slots for Data Sticks"}); + super(aID, aName, aNameRegional, aTier, 16, new String[] { + "Data Access for Multiblocks", "Adds " + (aTier == 4 ? 4 : 16) + " extra slots for Data Sticks" + }); } public GT_MetaTileEntity_Hatch_DataAccess(String aName, int aTier, String aDescription, ITexture[][][] aTextures) { super(aName, aTier, aTier == 4 ? 4 : 16, aDescription, aTextures); } - public GT_MetaTileEntity_Hatch_DataAccess(String aName, int aTier, String[] aDescription, ITexture[][][] aTextures) { + public GT_MetaTileEntity_Hatch_DataAccess( + String aName, int aTier, String[] aDescription, ITexture[][][] aTextures) { super(aName, aTier, aTier == 4 ? 4 : 16, aDescription, aTextures); } @Override public ITexture[] getTexturesActive(ITexture aBaseTexture) { - return new ITexture[]{aBaseTexture, TextureFactory.of(OVERLAY_DATA_ACCESS)}; + return new ITexture[] {aBaseTexture, TextureFactory.of(OVERLAY_DATA_ACCESS)}; } @Override public ITexture[] getTexturesInactive(ITexture aBaseTexture) { - return new ITexture[]{aBaseTexture, TextureFactory.of(OVERLAY_DATA_ACCESS)}; + return new ITexture[] {aBaseTexture, TextureFactory.of(OVERLAY_DATA_ACCESS)}; } @Override @@ -89,21 +90,24 @@ public class GT_MetaTileEntity_Hatch_DataAccess extends GT_MetaTileEntity_Hatch public Object getClientGUI(int aID, InventoryPlayer aPlayerInventory, IGregTechTileEntity aBaseMetaTileEntity) { switch (mTier) { case 4: - return new GT_GUIContainer_2by2(aPlayerInventory, aBaseMetaTileEntity, "Data Access Hatch", "DataAccess"); + return new GT_GUIContainer_2by2( + aPlayerInventory, aBaseMetaTileEntity, "Data Access Hatch", "DataAccess"); default: - return new GT_GUIContainer_4by4(aPlayerInventory, aBaseMetaTileEntity, "Data Access Hatch", "DataAccess"); + return new GT_GUIContainer_4by4( + aPlayerInventory, aBaseMetaTileEntity, "Data Access Hatch", "DataAccess"); } } @Override public boolean allowPullStack(IGregTechTileEntity aBaseMetaTileEntity, int aIndex, byte aSide, ItemStack aStack) { - return mTier>=8 && !aBaseMetaTileEntity.isActive(); + return mTier >= 8 && !aBaseMetaTileEntity.isActive(); } @Override public boolean allowPutStack(IGregTechTileEntity aBaseMetaTileEntity, int aIndex, byte aSide, ItemStack aStack) { - return mTier>=8 && !aBaseMetaTileEntity.isActive(); + return mTier >= 8 && !aBaseMetaTileEntity.isActive(); } + @Override public int getInventoryStackLimit() { return 1; @@ -117,12 +121,11 @@ public class GT_MetaTileEntity_Hatch_DataAccess extends GT_MetaTileEntity_Hatch aBaseMetaTileEntity.setActive(false); } } - } - public void setActive(boolean mActive){ + public void setActive(boolean mActive) { getBaseMetaTileEntity().setActive(mActive); - timeout=mActive?4:0; + timeout = mActive ? 4 : 0; } @Override diff --git a/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_Hatch_Dynamo.java b/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_Hatch_Dynamo.java index ae2aea8e4a..e9ba5ec512 100644 --- a/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_Hatch_Dynamo.java +++ b/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_Hatch_Dynamo.java @@ -1,5 +1,7 @@ package gregtech.api.metatileentity.implementations; +import static gregtech.api.enums.GT_Values.V; + import gregtech.api.enums.Textures; import gregtech.api.interfaces.ITexture; import gregtech.api.interfaces.tileentity.IGregTechTileEntity; @@ -7,14 +9,15 @@ import gregtech.api.metatileentity.MetaTileEntity; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.ItemStack; -import static gregtech.api.enums.GT_Values.V; - public class GT_MetaTileEntity_Hatch_Dynamo extends GT_MetaTileEntity_Hatch { public GT_MetaTileEntity_Hatch_Dynamo(int aID, String aName, String aNameRegional, int aTier) { - super(aID, aName, aNameRegional, aTier, 0, new String[]{"Generating electric Energy from Multiblocks", "Puts out up to 1 Amp"}); + super(aID, aName, aNameRegional, aTier, 0, new String[] { + "Generating electric Energy from Multiblocks", "Puts out up to 1 Amp" + }); } - public GT_MetaTileEntity_Hatch_Dynamo(int aID, String aName, String aNameRegional, int aTier, String[] aDescription) { + public GT_MetaTileEntity_Hatch_Dynamo( + int aID, String aName, String aNameRegional, int aTier, String[] aDescription) { super(aID, aName, aNameRegional, aTier, 0, aDescription); } @@ -28,12 +31,12 @@ public class GT_MetaTileEntity_Hatch_Dynamo extends GT_MetaTileEntity_Hatch { @Override public ITexture[] getTexturesActive(ITexture aBaseTexture) { - return new ITexture[]{aBaseTexture, Textures.BlockIcons.OVERLAYS_ENERGY_OUT_MULTI[mTier]}; + return new ITexture[] {aBaseTexture, Textures.BlockIcons.OVERLAYS_ENERGY_OUT_MULTI[mTier]}; } @Override public ITexture[] getTexturesInactive(ITexture aBaseTexture) { - return new ITexture[]{aBaseTexture, Textures.BlockIcons.OVERLAYS_ENERGY_OUT_MULTI[mTier]}; + return new ITexture[] {aBaseTexture, Textures.BlockIcons.OVERLAYS_ENERGY_OUT_MULTI[mTier]}; } @Override diff --git a/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_Hatch_Energy.java b/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_Hatch_Energy.java index a6bdc6726c..acc302e903 100644 --- a/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_Hatch_Energy.java +++ b/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_Hatch_Energy.java @@ -1,5 +1,7 @@ package gregtech.api.metatileentity.implementations; +import static gregtech.api.enums.GT_Values.V; + import gregtech.api.enums.Textures; import gregtech.api.interfaces.ITexture; import gregtech.api.interfaces.tileentity.IGregTechTileEntity; @@ -7,16 +9,17 @@ import gregtech.api.metatileentity.MetaTileEntity; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.ItemStack; -import static gregtech.api.enums.GT_Values.V; - public class GT_MetaTileEntity_Hatch_Energy extends GT_MetaTileEntity_Hatch { - public GT_MetaTileEntity_Hatch_Energy(int aID, String aName, String aNameRegional, int aTier, String[] aDescription) { + public GT_MetaTileEntity_Hatch_Energy( + int aID, String aName, String aNameRegional, int aTier, String[] aDescription) { super(aID, aName, aNameRegional, aTier, 0, aDescription); } public GT_MetaTileEntity_Hatch_Energy(int aID, String aName, String aNameRegional, int aTier) { - super(aID, aName, aNameRegional, aTier, 0, new String[]{"Energy Injector for Multiblocks", "Accepts up to 2 Amps"}); + super(aID, aName, aNameRegional, aTier, 0, new String[] { + "Energy Injector for Multiblocks", "Accepts up to 2 Amps" + }); } public GT_MetaTileEntity_Hatch_Energy(String aName, int aTier, String aDescription, ITexture[][][] aTextures) { @@ -27,18 +30,19 @@ public class GT_MetaTileEntity_Hatch_Energy extends GT_MetaTileEntity_Hatch { super(aName, aTier, 0, aDescription, aTextures); } - public GT_MetaTileEntity_Hatch_Energy(String aName, int aTier, int aInvSlotCount, String[] aDescription, ITexture[][][] aTextures) { + public GT_MetaTileEntity_Hatch_Energy( + String aName, int aTier, int aInvSlotCount, String[] aDescription, ITexture[][][] aTextures) { super(aName, aTier, 0, aDescription, aTextures); } @Override public ITexture[] getTexturesActive(ITexture aBaseTexture) { - return new ITexture[]{aBaseTexture, Textures.BlockIcons.OVERLAYS_ENERGY_IN_MULTI[mTier]}; + return new ITexture[] {aBaseTexture, Textures.BlockIcons.OVERLAYS_ENERGY_IN_MULTI[mTier]}; } @Override public ITexture[] getTexturesInactive(ITexture aBaseTexture) { - return new ITexture[]{aBaseTexture, Textures.BlockIcons.OVERLAYS_ENERGY_IN_MULTI[mTier]}; + return new ITexture[] {aBaseTexture, Textures.BlockIcons.OVERLAYS_ENERGY_IN_MULTI[mTier]}; } @Override diff --git a/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_Hatch_Input.java b/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_Hatch_Input.java index 99c89e091a..cb2c869edc 100644 --- a/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_Hatch_Input.java +++ b/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_Hatch_Input.java @@ -1,5 +1,8 @@ package gregtech.api.metatileentity.implementations; +import static gregtech.api.enums.Textures.BlockIcons.FLUID_IN_SIGN; +import static gregtech.api.enums.Textures.BlockIcons.OVERLAY_PIPE_IN; + import gregtech.GT_Mod; import gregtech.api.interfaces.ITexture; import gregtech.api.interfaces.tileentity.IGregTechTileEntity; @@ -12,23 +15,21 @@ import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; import net.minecraftforge.fluids.FluidStack; -import static gregtech.api.enums.Textures.BlockIcons.FLUID_IN_SIGN; -import static gregtech.api.enums.Textures.BlockIcons.OVERLAY_PIPE_IN; - public class GT_MetaTileEntity_Hatch_Input extends GT_MetaTileEntity_Hatch { public GT_Recipe_Map mRecipeMap = null; public GT_MetaTileEntity_Hatch_Input(int aID, String aName, String aNameRegional, int aTier) { - super(aID, aName, aNameRegional, aTier, 3, new String[]{ - "Fluid Input for Multiblocks", - "Capacity: " + GT_Utility.formatNumbers(8000*(1<<aTier)) + "L"}); + super(aID, aName, aNameRegional, aTier, 3, new String[] { + "Fluid Input for Multiblocks", "Capacity: " + GT_Utility.formatNumbers(8000 * (1 << aTier)) + "L" + }); } public GT_MetaTileEntity_Hatch_Input(int aID, int aSlot, String aName, String aNameRegional, int aTier) { - super(aID, aName, aNameRegional, aTier, aSlot, new String[]{ + super(aID, aName, aNameRegional, aTier, aSlot, new String[] { "Fluid Input for Multiblocks", - "Capacity: " + GT_Utility.formatNumbers(8000*(1<<aTier) / aSlot) + "L", - "Can hold " + aSlot + " types of fluid."}); + "Capacity: " + GT_Utility.formatNumbers(8000 * (1 << aTier) / aSlot) + "L", + "Can hold " + aSlot + " types of fluid." + }); } public GT_MetaTileEntity_Hatch_Input(String aName, int aTier, String aDescription, ITexture[][][] aTextures) { @@ -39,22 +40,23 @@ public class GT_MetaTileEntity_Hatch_Input extends GT_MetaTileEntity_Hatch { super(aName, aTier, 3, aDescription, aTextures); } - public GT_MetaTileEntity_Hatch_Input(String aName, int aSlots, int aTier, String[] aDescription, ITexture[][][] aTextures) { + public GT_MetaTileEntity_Hatch_Input( + String aName, int aSlots, int aTier, String[] aDescription, ITexture[][][] aTextures) { super(aName, aTier, aSlots, aDescription, aTextures); } @Override public ITexture[] getTexturesActive(ITexture aBaseTexture) { - return GT_Mod.gregtechproxy.mRenderIndicatorsOnHatch ? - new ITexture[]{aBaseTexture, TextureFactory.of(OVERLAY_PIPE_IN), TextureFactory.of(FLUID_IN_SIGN)} : - new ITexture[]{aBaseTexture, TextureFactory.of(OVERLAY_PIPE_IN)}; + return GT_Mod.gregtechproxy.mRenderIndicatorsOnHatch + ? new ITexture[] {aBaseTexture, TextureFactory.of(OVERLAY_PIPE_IN), TextureFactory.of(FLUID_IN_SIGN)} + : new ITexture[] {aBaseTexture, TextureFactory.of(OVERLAY_PIPE_IN)}; } @Override public ITexture[] getTexturesInactive(ITexture aBaseTexture) { - return GT_Mod.gregtechproxy.mRenderIndicatorsOnHatch ? - new ITexture[]{aBaseTexture, TextureFactory.of(OVERLAY_PIPE_IN), TextureFactory.of(FLUID_IN_SIGN)} : - new ITexture[]{aBaseTexture, TextureFactory.of(OVERLAY_PIPE_IN)}; + return GT_Mod.gregtechproxy.mRenderIndicatorsOnHatch + ? new ITexture[] {aBaseTexture, TextureFactory.of(OVERLAY_PIPE_IN), TextureFactory.of(FLUID_IN_SIGN)} + : new ITexture[] {aBaseTexture, TextureFactory.of(OVERLAY_PIPE_IN)}; } @Override @@ -80,8 +82,7 @@ public class GT_MetaTileEntity_Hatch_Input extends GT_MetaTileEntity_Hatch { @Override public void saveNBTData(NBTTagCompound aNBT) { super.saveNBTData(aNBT); - if (mRecipeMap != null) - aNBT.setString("recipeMap", mRecipeMap.mUniqueIdentifier); + if (mRecipeMap != null) aNBT.setString("recipeMap", mRecipeMap.mUniqueIdentifier); } @Override @@ -99,7 +100,7 @@ public class GT_MetaTileEntity_Hatch_Input extends GT_MetaTileEntity_Hatch { @Override public boolean doesFillContainers() { - //return true; + // return true; return false; } @@ -145,12 +146,16 @@ public class GT_MetaTileEntity_Hatch_Input extends GT_MetaTileEntity_Hatch { @Override public boolean allowPutStack(IGregTechTileEntity aBaseMetaTileEntity, int aIndex, byte aSide, ItemStack aStack) { - return aSide == aBaseMetaTileEntity.getFrontFacing() && aIndex == 0 && (mRecipeMap == null || mRecipeMap.containsInput(aStack) || mRecipeMap.containsInput(GT_Utility.getFluidForFilledItem(aStack, true))); + return aSide == aBaseMetaTileEntity.getFrontFacing() + && aIndex == 0 + && (mRecipeMap == null + || mRecipeMap.containsInput(aStack) + || mRecipeMap.containsInput(GT_Utility.getFluidForFilledItem(aStack, true))); } @Override public int getCapacity() { - return 8000*(1<<mTier); + return 8000 * (1 << mTier); } @Override 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 ba6e1698b1..f37befb63b 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 @@ -1,5 +1,7 @@ package gregtech.api.metatileentity.implementations; +import static gregtech.api.enums.Textures.BlockIcons.*; + import gregtech.GT_Mod; import gregtech.api.gui.*; import gregtech.api.interfaces.ITexture; @@ -12,18 +14,15 @@ import gregtech.api.util.GT_OreDictUnificator; import gregtech.api.util.GT_Recipe.GT_Recipe_Map; import gregtech.api.util.GT_Utility; import gregtech.api.util.extensions.ArrayExt; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.player.InventoryPlayer; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.util.StatCollector; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; - -import static gregtech.api.enums.Textures.BlockIcons.*; - public class GT_MetaTileEntity_Hatch_InputBus extends GT_MetaTileEntity_Hatch implements IConfigurationCircuitSupport { public GT_Recipe_Map mRecipeMap = null; public boolean disableSort; @@ -34,19 +33,27 @@ public class GT_MetaTileEntity_Hatch_InputBus extends GT_MetaTileEntity_Hatch im this(id, name, nameRegional, tier, getSlots(tier) + 1); } - protected GT_MetaTileEntity_Hatch_InputBus(int id, String name, String nameRegional, int tier, int slots, String[] description) { + protected GT_MetaTileEntity_Hatch_InputBus( + int id, String name, String nameRegional, int tier, int slots, String[] description) { super(id, name, nameRegional, tier, slots, description); } public GT_MetaTileEntity_Hatch_InputBus(int id, String name, String nameRegional, int tier, int slots) { - super(id, name, nameRegional, tier, slots, ArrayExt.of( - "Item Input for Multiblocks", - "Shift + right click with screwdriver to turn Sort mode on/off", - "Capacity: " + slots + " stack" + (slots >= 2 ? "s" : ""))); + super( + id, + name, + nameRegional, + tier, + slots, + ArrayExt.of( + "Item Input for Multiblocks", + "Shift + right click with screwdriver to turn Sort mode on/off", + "Capacity: " + slots + " stack" + (slots >= 2 ? "s" : ""))); } @Deprecated - // having too many constructors is bad, don't be so lazy, use GT_MetaTileEntity_Hatch_InputBus(String, int, String[], ITexture[][][]) + // having too many constructors is bad, don't be so lazy, use GT_MetaTileEntity_Hatch_InputBus(String, int, + // String[], ITexture[][][]) public GT_MetaTileEntity_Hatch_InputBus(String aName, int aTier, String aDescription, ITexture[][][] aTextures) { this(aName, aTier, ArrayExt.of(aDescription), aTextures); } @@ -55,22 +62,23 @@ public class GT_MetaTileEntity_Hatch_InputBus extends GT_MetaTileEntity_Hatch im this(aName, aTier, getSlots(aTier) + 1, aDescription, aTextures); } - public GT_MetaTileEntity_Hatch_InputBus(String aName, int aTier, int aSlots, String[] aDescription, ITexture[][][] aTextures) { + public GT_MetaTileEntity_Hatch_InputBus( + String aName, int aTier, int aSlots, String[] aDescription, ITexture[][][] aTextures) { super(aName, aTier, aSlots, aDescription, aTextures); } @Override public ITexture[] getTexturesActive(ITexture aBaseTexture) { - return GT_Mod.gregtechproxy.mRenderIndicatorsOnHatch ? - new ITexture[]{aBaseTexture, TextureFactory.of(OVERLAY_PIPE_IN), TextureFactory.of(ITEM_IN_SIGN)} : - new ITexture[]{aBaseTexture, TextureFactory.of(OVERLAY_PIPE_IN)}; + return GT_Mod.gregtechproxy.mRenderIndicatorsOnHatch + ? new ITexture[] {aBaseTexture, TextureFactory.of(OVERLAY_PIPE_IN), TextureFactory.of(ITEM_IN_SIGN)} + : new ITexture[] {aBaseTexture, TextureFactory.of(OVERLAY_PIPE_IN)}; } @Override public ITexture[] getTexturesInactive(ITexture aBaseTexture) { - return GT_Mod.gregtechproxy.mRenderIndicatorsOnHatch ? - new ITexture[]{aBaseTexture, TextureFactory.of(OVERLAY_PIPE_IN), TextureFactory.of(ITEM_IN_SIGN)} : - new ITexture[]{aBaseTexture, TextureFactory.of(OVERLAY_PIPE_IN)}; + return GT_Mod.gregtechproxy.mRenderIndicatorsOnHatch + ? new ITexture[] {aBaseTexture, TextureFactory.of(OVERLAY_PIPE_IN), TextureFactory.of(ITEM_IN_SIGN)} + : new ITexture[] {aBaseTexture, TextureFactory.of(OVERLAY_PIPE_IN)}; } @Override @@ -129,13 +137,12 @@ public class GT_MetaTileEntity_Hatch_InputBus extends GT_MetaTileEntity_Hatch im return 63; } - @Override public void initDefaultModes(NBTTagCompound aNBT) { if (!getBaseMetaTileEntity().getWorld().isRemote) { - GT_ClientPreference tPreference = GT_Mod.gregtechproxy.getClientPreference(getBaseMetaTileEntity().getOwnerUuid()); - if (tPreference != null) - disableFilter = !tPreference.isInputBusInitialFilterEnabled(); + GT_ClientPreference tPreference = GT_Mod.gregtechproxy.getClientPreference( + getBaseMetaTileEntity().getOwnerUuid()); + if (tPreference != null) disableFilter = !tPreference.isInputBusInitialFilterEnabled(); } } @@ -164,10 +171,8 @@ public class GT_MetaTileEntity_Hatch_InputBus extends GT_MetaTileEntity_Hatch im public void updateSlots() { for (int i = 0; i < mInventory.length - 1; i++) - if (mInventory[i] != null && mInventory[i].stackSize <= 0) - mInventory[i] = null; - if (!disableSort) - fillStacksIntoFirstSlots(); + if (mInventory[i] != null && mInventory[i].stackSize <= 0) mInventory[i] = null; + if (!disableSort) fillStacksIntoFirstSlots(); } protected void fillStacksIntoFirstSlots() { @@ -177,24 +182,20 @@ public class GT_MetaTileEntity_Hatch_InputBus extends GT_MetaTileEntity_Hatch im List<GT_Utility.ItemId> order = new ArrayList<>(L); List<Integer> validSlots = new ArrayList<>(L); for (int i = 0; i < L; i++) { - if (!isValidSlot(i)) - continue; + if (!isValidSlot(i)) continue; validSlots.add(i); ItemStack s = mInventory[i]; - if(s == null) - continue; + if (s == null) continue; GT_Utility.ItemId sID = GT_Utility.ItemId.createNoCopy(s); slots.merge(sID, s.stackSize, Integer::sum); - if(!stacks.containsKey(sID)) - stacks.put(sID, s); + if (!stacks.containsKey(sID)) stacks.put(sID, s); order.add(sID); mInventory[i] = null; } int slotindex = 0; for (GT_Utility.ItemId sID : order) { int toSet = slots.get(sID); - if (toSet == 0) - continue; + if (toSet == 0) continue; int slot = validSlots.get(slotindex); slotindex++; mInventory[slot] = stacks.get(sID).copy(); @@ -210,8 +211,7 @@ public class GT_MetaTileEntity_Hatch_InputBus extends GT_MetaTileEntity_Hatch im aNBT.setBoolean("disableSort", disableSort); aNBT.setBoolean("disableFilter", disableFilter); aNBT.setBoolean("disableLimited", disableLimited); - if (mRecipeMap != null) - aNBT.setString("recipeMap", mRecipeMap.mUniqueIdentifier); + if (mRecipeMap != null) aNBT.setString("recipeMap", mRecipeMap.mUniqueIdentifier); } @Override @@ -219,60 +219,64 @@ public class GT_MetaTileEntity_Hatch_InputBus extends GT_MetaTileEntity_Hatch im super.loadNBTData(aNBT); disableSort = aNBT.getBoolean("disableSort"); disableFilter = aNBT.getBoolean("disableFilter"); - if(aNBT.hasKey("disableLimited")) - disableLimited = aNBT.getBoolean("disableLimited"); + if (aNBT.hasKey("disableLimited")) disableLimited = aNBT.getBoolean("disableLimited"); mRecipeMap = GT_Recipe_Map.sIndexedMappings.getOrDefault(aNBT.getString("recipeMap"), null); } @Override public void onScrewdriverRightClick(byte aSide, EntityPlayer aPlayer, float aX, float aY, float aZ) { - if (!getBaseMetaTileEntity().getCoverBehaviorAtSideNew(aSide).isGUIClickable(aSide, getBaseMetaTileEntity().getCoverIDAtSide(aSide), getBaseMetaTileEntity().getComplexCoverDataAtSide(aSide), getBaseMetaTileEntity())) - return; + if (!getBaseMetaTileEntity() + .getCoverBehaviorAtSideNew(aSide) + .isGUIClickable( + aSide, + getBaseMetaTileEntity().getCoverIDAtSide(aSide), + getBaseMetaTileEntity().getComplexCoverDataAtSide(aSide), + getBaseMetaTileEntity())) return; if (aPlayer.isSneaking()) { - if(disableSort) { + if (disableSort) { disableSort = false; } else { - if(disableLimited) { + if (disableLimited) { disableLimited = false; } else { disableSort = true; disableLimited = true; } } - GT_Utility.sendChatToPlayer(aPlayer, StatCollector.translateToLocal("GT5U.hatch.disableSort." + disableSort) + " " + - StatCollector.translateToLocal("GT5U.hatch.disableLimited." + disableLimited)); + GT_Utility.sendChatToPlayer( + aPlayer, + StatCollector.translateToLocal("GT5U.hatch.disableSort." + disableSort) + " " + + StatCollector.translateToLocal("GT5U.hatch.disableLimited." + disableLimited)); } else { disableFilter = !disableFilter; - GT_Utility.sendChatToPlayer(aPlayer, StatCollector.translateToLocal("GT5U.hatch.disableFilter." + disableFilter)); + GT_Utility.sendChatToPlayer( + aPlayer, StatCollector.translateToLocal("GT5U.hatch.disableFilter." + disableFilter)); } } @Override public boolean allowPullStack(IGregTechTileEntity aBaseMetaTileEntity, int aIndex, byte aSide, ItemStack aStack) { - if (aIndex == getCircuitSlot()) - return false; + if (aIndex == getCircuitSlot()) return false; return aSide == getBaseMetaTileEntity().getFrontFacing(); } @Override public boolean allowPutStack(IGregTechTileEntity aBaseMetaTileEntity, int aIndex, byte aSide, ItemStack aStack) { - return aSide == getBaseMetaTileEntity().getFrontFacing() && aIndex != getCircuitSlot() + return aSide == getBaseMetaTileEntity().getFrontFacing() + && aIndex != getCircuitSlot() && (mRecipeMap == null || disableFilter || mRecipeMap.containsInput(aStack)) && (disableLimited || limitedAllowPutStack(aIndex, aStack)); } protected boolean limitedAllowPutStack(int aIndex, ItemStack aStack) { for (int i = 0; i < getSizeInventory(); i++) - if (GT_Utility.areStacksEqual(GT_OreDictUnificator.get_nocopy(aStack), mInventory[i])) - return i == aIndex; + if (GT_Utility.areStacksEqual(GT_OreDictUnificator.get_nocopy(aStack), mInventory[i])) return i == aIndex; return mInventory[aIndex] == null; } - public void startRecipeProcessing() { - } + public void startRecipeProcessing() {} - public void endRecipeProcessing() { - } + public void endRecipeProcessing() {} @Override public boolean allowSelectCircuit() { @@ -280,5 +284,7 @@ public class GT_MetaTileEntity_Hatch_InputBus extends GT_MetaTileEntity_Hatch im } @Override - public int getCircuitSlot() { return getSlots(mTier); } + public int getCircuitSlot() { + return getSlots(mTier); + } } 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 bdfd06c92f..fada5a9b7c 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 @@ -1,5 +1,12 @@ package gregtech.api.metatileentity.implementations; +import static gregtech.api.enums.Textures.BlockIcons.OVERLAY_AUTOMAINTENANCE; +import static gregtech.api.enums.Textures.BlockIcons.OVERLAY_AUTOMAINTENANCE_GLOW; +import static gregtech.api.enums.Textures.BlockIcons.OVERLAY_AUTOMAINTENANCE_IDLE; +import static gregtech.api.enums.Textures.BlockIcons.OVERLAY_AUTOMAINTENANCE_IDLE_GLOW; +import static gregtech.api.enums.Textures.BlockIcons.OVERLAY_DUCTTAPE; +import static gregtech.api.enums.Textures.BlockIcons.OVERLAY_MAINTENANCE; + import gregtech.GT_Mod; import gregtech.api.GregTech_API; import gregtech.api.enums.ItemList; @@ -27,16 +34,15 @@ import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; import net.minecraftforge.common.util.FakePlayer; -import static gregtech.api.enums.Textures.BlockIcons.OVERLAY_AUTOMAINTENANCE; -import static gregtech.api.enums.Textures.BlockIcons.OVERLAY_AUTOMAINTENANCE_GLOW; -import static gregtech.api.enums.Textures.BlockIcons.OVERLAY_AUTOMAINTENANCE_IDLE; -import static gregtech.api.enums.Textures.BlockIcons.OVERLAY_AUTOMAINTENANCE_IDLE_GLOW; -import static gregtech.api.enums.Textures.BlockIcons.OVERLAY_DUCTTAPE; -import static gregtech.api.enums.Textures.BlockIcons.OVERLAY_MAINTENANCE; - public class GT_MetaTileEntity_Hatch_Maintenance extends GT_MetaTileEntity_Hatch { private static ItemStack[] sAutoMaintenanceInputs; - public boolean mWrench = false, mScrewdriver = false, mSoftHammer = false, mHardHammer = false, mSolderingTool = false, mCrowbar = false, mAuto; + public boolean mWrench = false, + mScrewdriver = false, + mSoftHammer = false, + mHardHammer = false, + mSolderingTool = false, + mCrowbar = false, + mAuto; public GT_MetaTileEntity_Hatch_Maintenance(int aID, String aName, String aNameRegional, int aTier) { super(aID, aName, aNameRegional, aTier, 1, "For maintaining Multiblocks"); @@ -48,24 +54,26 @@ public class GT_MetaTileEntity_Hatch_Maintenance extends GT_MetaTileEntity_Hatch mAuto = aAuto; } - public GT_MetaTileEntity_Hatch_Maintenance(String aName, int aTier, String aDescription, ITexture[][][] aTextures, boolean aAuto) { + public GT_MetaTileEntity_Hatch_Maintenance( + String aName, int aTier, String aDescription, ITexture[][][] aTextures, boolean aAuto) { super(aName, aTier, aAuto ? 4 : 1, aDescription, aTextures); mAuto = aAuto; } - public GT_MetaTileEntity_Hatch_Maintenance(String aName, int aTier, String[] aDescription, ITexture[][][] aTextures, boolean aAuto) { + public GT_MetaTileEntity_Hatch_Maintenance( + String aName, int aTier, String[] aDescription, ITexture[][][] aTextures, boolean aAuto) { super(aName, aTier, aAuto ? 4 : 1, aDescription, aTextures); mAuto = aAuto; } private static ItemStack[] getAutoMaintenanceInputs() { if (sAutoMaintenanceInputs == null) - sAutoMaintenanceInputs = new ItemStack[]{ - ItemList.Duct_Tape.get(4), - GT_OreDictUnificator.get(OrePrefixes.cell, Materials.Lubricant, 2), - GT_OreDictUnificator.get(OrePrefixes.screw, Materials.Steel, 4), - GT_OreDictUnificator.get(OrePrefixes.circuit, Materials.Advanced, 2) - }; + sAutoMaintenanceInputs = new ItemStack[] { + ItemList.Duct_Tape.get(4), + GT_OreDictUnificator.get(OrePrefixes.cell, Materials.Lubricant, 2), + GT_OreDictUnificator.get(OrePrefixes.screw, Materials.Steel, 4), + GT_OreDictUnificator.get(OrePrefixes.circuit, Materials.Advanced, 2) + }; return sAutoMaintenanceInputs; } @@ -88,25 +96,31 @@ public class GT_MetaTileEntity_Hatch_Maintenance extends GT_MetaTileEntity_Hatch @Override public ITexture[] getTexturesActive(ITexture aBaseTexture) { - if (mAuto) return new ITexture[]{ + if (mAuto) + return new ITexture[] { aBaseTexture, TextureFactory.of(OVERLAY_AUTOMAINTENANCE_IDLE), - TextureFactory.builder().addIcon(OVERLAY_AUTOMAINTENANCE_IDLE_GLOW).glow().build()}; - return new ITexture[]{ - aBaseTexture, - TextureFactory.of(OVERLAY_MAINTENANCE)}; + 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[]{ + if (mAuto) + return new ITexture[] { aBaseTexture, TextureFactory.of(OVERLAY_AUTOMAINTENANCE), - TextureFactory.builder().addIcon(OVERLAY_AUTOMAINTENANCE_GLOW).glow().build()}; - return new ITexture[]{ - aBaseTexture, - TextureFactory.of(OVERLAY_MAINTENANCE), - TextureFactory.of(OVERLAY_DUCTTAPE)}; + TextureFactory.builder() + .addIcon(OVERLAY_AUTOMAINTENANCE_GLOW) + .glow() + .build() + }; + return new ITexture[] {aBaseTexture, TextureFactory.of(OVERLAY_MAINTENANCE), TextureFactory.of(OVERLAY_DUCTTAPE) + }; } @Override @@ -142,17 +156,17 @@ public class GT_MetaTileEntity_Hatch_Maintenance extends GT_MetaTileEntity_Hatch } @Override - public boolean onRightclick(IGregTechTileEntity aBaseMetaTileEntity, EntityPlayer aPlayer, byte aSide, float aX, float aY, float aZ) { - if (aBaseMetaTileEntity.isClientSide()) - return true; + public boolean onRightclick( + IGregTechTileEntity aBaseMetaTileEntity, EntityPlayer aPlayer, byte aSide, float aX, float aY, float aZ) { + 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.getCurrentEquippedItem() != null && aPlayer.getCurrentEquippedItem().getItem() instanceof ItemToolbox) + if (aPlayer instanceof FakePlayer + && !aPlayer.getGameProfile().getName().endsWith(".robot")) return false; + if (aPlayer.getCurrentEquippedItem() != null + && aPlayer.getCurrentEquippedItem().getItem() instanceof ItemToolbox) applyToolbox(aPlayer.getCurrentEquippedItem(), aPlayer); - else - aBaseMetaTileEntity.openGUI(aPlayer); + else aBaseMetaTileEntity.openGUI(aPlayer); return true; } return false; @@ -175,21 +189,20 @@ public class GT_MetaTileEntity_Hatch_Maintenance extends GT_MetaTileEntity_Hatch if (mInventory[i] != null && mInventory[i].stackSize <= 0) mInventory[i] = null; } - @Override public void onPostTick(IGregTechTileEntity aBaseMetaTileEntity, long aTick) { super.onPostTick(aBaseMetaTileEntity, aTick); - if(aBaseMetaTileEntity.isServerSide() && mAuto && aTick % 100L ==0L){ + if (aBaseMetaTileEntity.isServerSide() && mAuto && aTick % 100L == 0L) { aBaseMetaTileEntity.setActive(!isRecipeInputEqual(false)); } } - public boolean autoMaintainance(){ + public boolean autoMaintainance() { return isRecipeInputEqual(true); } public boolean isRecipeInputEqual(boolean aDecreaseStacksizeBySuccess) { - ItemStack[] mInputs= getAutoMaintenanceInputs(); + ItemStack[] mInputs = getAutoMaintenanceInputs(); int amt; @@ -198,7 +211,9 @@ 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; @@ -215,7 +230,9 @@ 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; @@ -244,20 +261,25 @@ public class GT_MetaTileEntity_Hatch_Maintenance extends GT_MetaTileEntity_Hatch // Allow IC2 Toolbox with tools to function for maint issues. if (aStack.getItem() instanceof ItemToolbox && aPlayer instanceof EntityPlayer) { - applyToolbox(aStack, (EntityPlayer)aPlayer); + applyToolbox(aStack, (EntityPlayer) aPlayer); return; } - if (GT_Utility.isStackInList(aStack, GregTech_API.sWrenchList) && !mWrench && GT_ModHandler.damageOrDechargeItem(aStack, 1, 1000, aPlayer)) - mWrench = true; - if (GT_Utility.isStackInList(aStack, GregTech_API.sScrewdriverList) && !mScrewdriver && GT_ModHandler.damageOrDechargeItem(aStack, 1, 1000, aPlayer)) - mScrewdriver = true; - if (GT_Utility.isStackInList(aStack, GregTech_API.sSoftHammerList) && !mSoftHammer && GT_ModHandler.damageOrDechargeItem(aStack, 1, 1000, aPlayer)) - mSoftHammer = true; - if (GT_Utility.isStackInList(aStack, GregTech_API.sHardHammerList) && !mHardHammer && GT_ModHandler.damageOrDechargeItem(aStack, 1, 1000, aPlayer)) - mHardHammer = true; - if (GT_Utility.isStackInList(aStack, GregTech_API.sCrowbarList) && !mCrowbar && GT_ModHandler.damageOrDechargeItem(aStack, 1, 1000, aPlayer)) - mCrowbar = true; + if (GT_Utility.isStackInList(aStack, GregTech_API.sWrenchList) + && !mWrench + && GT_ModHandler.damageOrDechargeItem(aStack, 1, 1000, aPlayer)) mWrench = true; + if (GT_Utility.isStackInList(aStack, GregTech_API.sScrewdriverList) + && !mScrewdriver + && GT_ModHandler.damageOrDechargeItem(aStack, 1, 1000, aPlayer)) mScrewdriver = true; + if (GT_Utility.isStackInList(aStack, GregTech_API.sSoftHammerList) + && !mSoftHammer + && GT_ModHandler.damageOrDechargeItem(aStack, 1, 1000, aPlayer)) mSoftHammer = true; + if (GT_Utility.isStackInList(aStack, GregTech_API.sHardHammerList) + && !mHardHammer + && GT_ModHandler.damageOrDechargeItem(aStack, 1, 1000, aPlayer)) mHardHammer = true; + if (GT_Utility.isStackInList(aStack, GregTech_API.sCrowbarList) + && !mCrowbar + && GT_ModHandler.damageOrDechargeItem(aStack, 1, 1000, aPlayer)) mCrowbar = true; if (!mSolderingTool && GT_ModHandler.useSolderingIron(aStack, aPlayer, aToolboxInventory)) mSolderingTool = true; if (GT_OreDictUnificator.isItemStackInstanceOf(aStack, "craftingDuctTape")) { @@ -281,7 +303,7 @@ public class GT_MetaTileEntity_Hatch_Maintenance extends GT_MetaTileEntity_Hatch private void applyToolbox(ItemStack aStack, EntityPlayer aPlayer) { ItemToolbox aToolbox = (ItemToolbox) aStack.getItem(); IHasGui aToolboxGUI = aToolbox.getInventory(aPlayer, aStack); - for (int i = 0; i < aToolboxGUI.getSizeInventory(); i ++) { + for (int i = 0; i < aToolboxGUI.getSizeInventory(); i++) { if (aToolboxGUI.getStackInSlot(i) != null) { onToolClick(aToolboxGUI.getStackInSlot(i), aPlayer, aToolboxGUI); if (aToolboxGUI.getStackInSlot(i) != null && aToolboxGUI.getStackInSlot(i).stackSize <= 0) @@ -299,10 +321,12 @@ public class GT_MetaTileEntity_Hatch_Maintenance extends GT_MetaTileEntity_Hatch public boolean allowPutStack(IGregTechTileEntity aBaseMetaTileEntity, int aIndex, byte aSide, ItemStack aStack) { if (mAuto && GT_Mod.gregtechproxy.mAMHInteraction) { for (int i = 0; i < getSizeInventory(); i++) - if (GT_Utility.areStacksEqual(GT_OreDictUnificator.get(false, aStack), GT_OreDictUnificator.get(false, getStackInSlot(i)))) + if (GT_Utility.areStacksEqual( + GT_OreDictUnificator.get(false, aStack), GT_OreDictUnificator.get(false, getStackInSlot(i)))) return i == aIndex; for (ItemStack tInput : getAutoMaintenanceInputs()) - if (GT_Utility.areUnificationsEqual(tInput, aStack, true) || GT_Utility.areUnificationsEqual(GT_OreDictUnificator.get(false, aStack), tInput, true)) + if (GT_Utility.areUnificationsEqual(tInput, aStack, true) + || GT_Utility.areUnificationsEqual(GT_OreDictUnificator.get(false, aStack), tInput, true)) return true; } return false; 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 6d59b4ff7f..d65370901b 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 @@ -1,5 +1,8 @@ package gregtech.api.metatileentity.implementations; +import static gregtech.api.enums.Textures.BlockIcons.OVERLAY_MUFFLER; +import static gregtech.api.objects.XSTR.XSTR_INSTANCE; + import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; import gregtech.GT_Mod; @@ -12,24 +15,19 @@ import gregtech.api.util.GT_LanguageManager; import gregtech.api.util.WorldSpawnedEventBuilder; import gregtech.common.GT_Pollution; import gregtech.common.tileentities.machines.multi.GT_MetaTileEntity_Cleanroom; +import java.util.Arrays; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.ItemStack; import net.minecraft.world.World; import net.minecraftforge.common.util.ForgeDirection; -import java.util.Arrays; - -import static gregtech.api.enums.Textures.BlockIcons.OVERLAY_MUFFLER; -import static gregtech.api.objects.XSTR.XSTR_INSTANCE; - @SuppressWarnings("unused") // Unused API is expected within scope public class GT_MetaTileEntity_Hatch_Muffler extends GT_MetaTileEntity_Hatch { private static final String localizedDescFormat = GT_LanguageManager.addStringLocalization( "gt.blockmachines.hatch.muffler.desc.format", - "Outputs the Pollution (Might cause ... things)%n" + - "DO NOT OBSTRUCT THE OUTPUT!%n" + - "Reduces Pollution to %d%%%n" + - "Recovers %d%% of CO2/CO/SO2"); + "Outputs the Pollution (Might cause ... things)%n" + "DO NOT OBSTRUCT THE OUTPUT!%n" + + "Reduces Pollution to %d%%%n" + + "Recovers %d%% of CO2/CO/SO2"); private final int pollutionReduction = calculatePollutionReduction(100); private final int pollutionRecover = 100 - pollutionReduction; private final String[] description = String.format(localizedDescFormat, pollutionReduction, pollutionRecover) @@ -41,7 +39,7 @@ public class GT_MetaTileEntity_Hatch_Muffler extends GT_MetaTileEntity_Hatch { } public GT_MetaTileEntity_Hatch_Muffler(String aName, int aTier, String aDescription, ITexture[][][] aTextures) { - this(aName, aTier, new String[]{aDescription}, aTextures); + this(aName, aTier, new String[] {aDescription}, aTextures); } public GT_MetaTileEntity_Hatch_Muffler(String aName, int aTier, String[] aDescription, ITexture[][][] aTextures) { @@ -56,12 +54,12 @@ public class GT_MetaTileEntity_Hatch_Muffler extends GT_MetaTileEntity_Hatch { @Override public ITexture[] getTexturesActive(ITexture aBaseTexture) { - return new ITexture[]{aBaseTexture, TextureFactory.of(OVERLAY_MUFFLER)}; + return new ITexture[] {aBaseTexture, TextureFactory.of(OVERLAY_MUFFLER)}; } @Override public ITexture[] getTexturesInactive(ITexture aBaseTexture) { - return new ITexture[]{aBaseTexture, TextureFactory.of(OVERLAY_MUFFLER)}; + return new ITexture[] {aBaseTexture, TextureFactory.of(OVERLAY_MUFFLER)}; } @Override @@ -154,16 +152,25 @@ public class GT_MetaTileEntity_Hatch_Muffler extends GT_MetaTileEntity_Hatch { .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(); + events.setPosition( + xPos + ran1 * 0.5F, + yPos + XSTR_INSTANCE.nextFloat() * 0.5F, + 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(); + events.setPosition( + xPos + ran2 * 0.5F, + yPos + XSTR_INSTANCE.nextFloat() * 0.5F, + 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(); + events.setPosition( + xPos + ran3 * 0.5F, + yPos + XSTR_INSTANCE.nextFloat() * 0.5F, + zPos + XSTR_INSTANCE.nextFloat() * 0.5F) + .run(); } } 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 b16ec3c7c7..74c6ca2b96 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 @@ -1,5 +1,7 @@ package gregtech.api.metatileentity.implementations; +import static gregtech.api.enums.Textures.BlockIcons.OVERLAY_INPUT_HATCH_2x2; + import gregtech.api.enums.ItemList; import gregtech.api.gui.GT_Container_2by2_Fluid; import gregtech.api.gui.GT_GUIContainer_2by2_Fluid; @@ -14,8 +16,6 @@ import net.minecraftforge.common.util.ForgeDirection; import net.minecraftforge.fluids.FluidStack; import net.minecraftforge.fluids.FluidTankInfo; -import static gregtech.api.enums.Textures.BlockIcons.OVERLAY_INPUT_HATCH_2x2; - public class GT_MetaTileEntity_Hatch_MultiInput extends GT_MetaTileEntity_Hatch_Input { public FluidStack[] mStoredFluid; @@ -27,7 +27,8 @@ public class GT_MetaTileEntity_Hatch_MultiInput extends GT_MetaTileEntity_Hatch_ mCapacityPer = 8000 * (1 << aTier) / aSlot; } - public GT_MetaTileEntity_Hatch_MultiInput(String aName, int aSlot, int aTier, String[] aDescription, ITexture[][][] aTextures) { + public GT_MetaTileEntity_Hatch_MultiInput( + String aName, int aSlot, int aTier, String[] aDescription, ITexture[][][] aTextures) { super(aName, aSlot, aTier, aDescription, aTextures); this.mStoredFluid = new FluidStack[aSlot]; mCapacityPer = 8000 * (1 << aTier) / aSlot; @@ -67,12 +68,12 @@ public class GT_MetaTileEntity_Hatch_MultiInput extends GT_MetaTileEntity_Hatch_ @Override public ITexture[] getTexturesActive(ITexture aBaseTexture) { - return new ITexture[]{aBaseTexture, TextureFactory.of(OVERLAY_INPUT_HATCH_2x2)}; + return new ITexture[] {aBaseTexture, TextureFactory.of(OVERLAY_INPUT_HATCH_2x2)}; } @Override public ITexture[] getTexturesInactive(ITexture aBaseTexture) { - return new ITexture[]{aBaseTexture, TextureFactory.of(OVERLAY_INPUT_HATCH_2x2)}; + return new ITexture[] {aBaseTexture, TextureFactory.of(OVERLAY_INPUT_HATCH_2x2)}; } public int getMaxType() { @@ -82,8 +83,7 @@ public class GT_MetaTileEntity_Hatch_MultiInput extends GT_MetaTileEntity_Hatch_ @Override public FluidStack getFluid() { for (FluidStack tFluid : mStoredFluid) { - if (tFluid != null && tFluid.amount > 0) - return tFluid; + if (tFluid != null && tFluid.amount > 0) return tFluid; } return null; } @@ -108,8 +108,7 @@ public class GT_MetaTileEntity_Hatch_MultiInput extends GT_MetaTileEntity_Hatch_ public int getFirstEmptySlot() { for (int i = 0; i < mStoredFluid.length; i++) { - if (mStoredFluid[i] == null || mStoredFluid[i].amount <= 0) - return i; + if (mStoredFluid[i] == null || mStoredFluid[i].amount <= 0) return i; } return -1; } @@ -117,8 +116,7 @@ public class GT_MetaTileEntity_Hatch_MultiInput extends GT_MetaTileEntity_Hatch_ public boolean hasFluid(FluidStack aFluid) { if (aFluid == null) return false; for (FluidStack tFluid : mStoredFluid) { - if (aFluid.isFluidEqual(tFluid)) - return true; + if (aFluid.isFluidEqual(tFluid)) return true; } return false; } @@ -126,8 +124,7 @@ public class GT_MetaTileEntity_Hatch_MultiInput extends GT_MetaTileEntity_Hatch_ public int getFluidSlot(FluidStack tFluid) { if (tFluid == null) return -1; for (int i = 0; i < mStoredFluid.length; i++) { - if (tFluid.equals(mStoredFluid[i])) - return i; + if (tFluid.equals(mStoredFluid[i])) return i; } return -1; } @@ -161,8 +158,11 @@ 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)) - return 0; + 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); if (doFill) { @@ -261,7 +261,7 @@ public class GT_MetaTileEntity_Hatch_MultiInput extends GT_MetaTileEntity_Hatch_ @Override public void onPostTick(IGregTechTileEntity aBaseMetaTileEntity, long aTick) { if (aBaseMetaTileEntity.isServerSide() && mStoredFluid != null) { - for (int i = 0; i < getMaxType(); i ++) { + for (int i = 0; i < getMaxType(); i++) { if (mStoredFluid[i] != null && mStoredFluid[i].amount <= 0) { mStoredFluid[i] = null; } @@ -277,12 +277,10 @@ public class GT_MetaTileEntity_Hatch_MultiInput extends GT_MetaTileEntity_Hatch_ @Override public void updateFluidDisplayItem() { - for (int i = 0; i < 4; i ++) { + for (int i = 0; i < 4; i++) { if (getFluid(i) == null || getFluid(i).amount <= 0) { - if (ItemList.Display_Fluid.isStackEqual(mInventory[i], true, true)) - mInventory[i] = null; - } - else { + if (ItemList.Display_Fluid.isStackEqual(mInventory[i], true, true)) mInventory[i] = null; + } else { mInventory[i] = GT_Utility.getFluidDisplayStack(getFluid(i), true, !displaysStackSize()); } } 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 7e04a5581f..43ccd2db7c 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 @@ -1,5 +1,8 @@ package gregtech.api.metatileentity.implementations; +import static gregtech.api.enums.Textures.BlockIcons.FLUID_OUT_SIGN; +import static gregtech.api.enums.Textures.BlockIcons.OVERLAY_PIPE_OUT; + import gregtech.GT_Mod; import gregtech.api.interfaces.ITexture; import gregtech.api.interfaces.tileentity.IGregTechTileEntity; @@ -17,21 +20,19 @@ import net.minecraft.util.StatCollector; import net.minecraftforge.common.util.ForgeDirection; import net.minecraftforge.fluids.*; -import static gregtech.api.enums.Textures.BlockIcons.FLUID_OUT_SIGN; -import static gregtech.api.enums.Textures.BlockIcons.OVERLAY_PIPE_OUT; - public class GT_MetaTileEntity_Hatch_Output extends GT_MetaTileEntity_Hatch { private String lockedFluidName = null; private EntityPlayer playerThatLockedfluid = null; public byte mMode = 0; public GT_MetaTileEntity_Hatch_Output(int aID, String aName, String aNameRegional, int aTier) { - super(aID, aName, aNameRegional, aTier, 4, new String[]{ - "Fluid Output for Multiblocks", - "Capacity: " + GT_Utility.formatNumbers(8000*(1<<aTier)) + "L", - "Right click with screwdriver to restrict output", - "Can be restricted to put out Items and/or Steam/No Steam/1 specific Fluid", - "Restricted Output Hatches are given priority for Multiblock Fluid output"}); + super(aID, aName, aNameRegional, aTier, 4, new String[] { + "Fluid Output for Multiblocks", + "Capacity: " + GT_Utility.formatNumbers(8000 * (1 << aTier)) + "L", + "Right click with screwdriver to restrict output", + "Can be restricted to put out Items and/or Steam/No Steam/1 specific Fluid", + "Restricted Output Hatches are given priority for Multiblock Fluid output" + }); } public GT_MetaTileEntity_Hatch_Output(String aName, int aTier, String aDescription, ITexture[][][] aTextures) { @@ -44,16 +45,16 @@ public class GT_MetaTileEntity_Hatch_Output extends GT_MetaTileEntity_Hatch { @Override public ITexture[] getTexturesActive(ITexture aBaseTexture) { - return GT_Mod.gregtechproxy.mRenderIndicatorsOnHatch ? - new ITexture[]{aBaseTexture, TextureFactory.of(OVERLAY_PIPE_OUT), TextureFactory.of(FLUID_OUT_SIGN)} : - new ITexture[]{aBaseTexture, TextureFactory.of(OVERLAY_PIPE_OUT)}; + return GT_Mod.gregtechproxy.mRenderIndicatorsOnHatch + ? new ITexture[] {aBaseTexture, TextureFactory.of(OVERLAY_PIPE_OUT), TextureFactory.of(FLUID_OUT_SIGN)} + : new ITexture[] {aBaseTexture, TextureFactory.of(OVERLAY_PIPE_OUT)}; } @Override public ITexture[] getTexturesInactive(ITexture aBaseTexture) { - return GT_Mod.gregtechproxy.mRenderIndicatorsOnHatch ? - new ITexture[]{aBaseTexture, TextureFactory.of(OVERLAY_PIPE_OUT), TextureFactory.of(FLUID_OUT_SIGN)} : - new ITexture[]{aBaseTexture, TextureFactory.of(OVERLAY_PIPE_OUT)}; + return GT_Mod.gregtechproxy.mRenderIndicatorsOnHatch + ? new ITexture[] {aBaseTexture, TextureFactory.of(OVERLAY_PIPE_OUT), TextureFactory.of(FLUID_OUT_SIGN)} + : new ITexture[] {aBaseTexture, TextureFactory.of(OVERLAY_PIPE_OUT)}; } @Override @@ -92,13 +93,24 @@ public class GT_MetaTileEntity_Hatch_Output extends GT_MetaTileEntity_Hatch { 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); + 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()), aBaseMetaTileEntity.drain(ForgeDirection.getOrientation(aBaseMetaTileEntity.getFrontFacing()), tFilledAmount, true), true); + tTileEntity.fill( + ForgeDirection.getOrientation(aBaseMetaTileEntity.getBackFacing()), + aBaseMetaTileEntity.drain( + ForgeDirection.getOrientation(aBaseMetaTileEntity.getFrontFacing()), + tFilledAmount, + true), + true); } } } @@ -109,7 +121,8 @@ public class GT_MetaTileEntity_Hatch_Output extends GT_MetaTileEntity_Hatch { public void saveNBTData(NBTTagCompound aNBT) { super.saveNBTData(aNBT); aNBT.setByte("mMode", mMode); - if(lockedFluidName!=null && lockedFluidName.length()!=0) aNBT.setString("lockedFluidName", lockedFluidName); + if (lockedFluidName != null && lockedFluidName.length() != 0) + aNBT.setString("lockedFluidName", lockedFluidName); else aNBT.removeTag("lockedFluidName"); } @@ -120,7 +133,8 @@ public class GT_MetaTileEntity_Hatch_Output extends GT_MetaTileEntity_Hatch { 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(); } } @@ -163,8 +177,7 @@ public class GT_MetaTileEntity_Hatch_Output extends GT_MetaTileEntity_Hatch { // Because getStackDisplaySlot() only allow return one int, this place I only can manually set. if (tLockedFluid != null) { mInventory[3] = GT_Utility.getFluidDisplayStack(tLockedFluid, false, true); - } - else { + } else { mInventory[3] = null; } } @@ -198,13 +211,18 @@ public class GT_MetaTileEntity_Hatch_Output extends GT_MetaTileEntity_Hatch { @Override public int getCapacity() { - return 8000*(1<<mTier); + return 8000 * (1 << mTier); } @Override public void onScrewdriverRightClick(byte aSide, EntityPlayer aPlayer, float aX, float aY, float aZ) { - if (!getBaseMetaTileEntity().getCoverBehaviorAtSideNew(aSide).isGUIClickable(aSide, getBaseMetaTileEntity().getCoverIDAtSide(aSide), getBaseMetaTileEntity().getComplexCoverDataAtSide(aSide), getBaseMetaTileEntity())) - return; + if (!getBaseMetaTileEntity() + .getCoverBehaviorAtSideNew(aSide) + .isGUIClickable( + aSide, + getBaseMetaTileEntity().getCoverIDAtSide(aSide), + getBaseMetaTileEntity().getComplexCoverDataAtSide(aSide), + getBaseMetaTileEntity())) return; if (aPlayer.isSneaking()) { mMode = (byte) ((mMode + 9) % 10); } else { @@ -213,85 +231,112 @@ public class GT_MetaTileEntity_Hatch_Output extends GT_MetaTileEntity_Hatch { String inBrackets; switch (mMode) { case 0: - GT_Utility.sendChatToPlayer(aPlayer, GT_Utility.trans("108","Outputs misc. Fluids, Steam and Items")); + GT_Utility.sendChatToPlayer(aPlayer, GT_Utility.trans("108", "Outputs misc. Fluids, Steam and Items")); this.setLockedFluidName(null); break; case 1: - GT_Utility.sendChatToPlayer(aPlayer, GT_Utility.trans("109","Outputs Steam and Items")); + GT_Utility.sendChatToPlayer(aPlayer, GT_Utility.trans("109", "Outputs Steam and Items")); this.setLockedFluidName(null); break; case 2: - GT_Utility.sendChatToPlayer(aPlayer, GT_Utility.trans("110","Outputs Steam and misc. Fluids")); + GT_Utility.sendChatToPlayer(aPlayer, GT_Utility.trans("110", "Outputs Steam and misc. Fluids")); this.setLockedFluidName(null); break; case 3: - GT_Utility.sendChatToPlayer(aPlayer, GT_Utility.trans("111","Outputs Steam")); + GT_Utility.sendChatToPlayer(aPlayer, GT_Utility.trans("111", "Outputs Steam")); this.setLockedFluidName(null); break; case 4: - GT_Utility.sendChatToPlayer(aPlayer, GT_Utility.trans("112","Outputs misc. Fluids and Items")); + GT_Utility.sendChatToPlayer(aPlayer, GT_Utility.trans("112", "Outputs misc. Fluids and Items")); this.setLockedFluidName(null); break; case 5: - GT_Utility.sendChatToPlayer(aPlayer, GT_Utility.trans("113","Outputs only Items")); + GT_Utility.sendChatToPlayer(aPlayer, GT_Utility.trans("113", "Outputs only Items")); this.setLockedFluidName(null); break; case 6: - GT_Utility.sendChatToPlayer(aPlayer, GT_Utility.trans("114","Outputs only misc. Fluids")); + GT_Utility.sendChatToPlayer(aPlayer, GT_Utility.trans("114", "Outputs only misc. Fluids")); this.setLockedFluidName(null); break; case 7: - GT_Utility.sendChatToPlayer(aPlayer, GT_Utility.trans("115","Outputs nothing")); + GT_Utility.sendChatToPlayer(aPlayer, GT_Utility.trans("115", "Outputs nothing")); this.setLockedFluidName(null); break; case 8: playerThatLockedfluid = aPlayer; if (mFluid == null) { this.setLockedFluidName(null); - inBrackets = GT_Utility.trans("115.3","currently none, will be locked to the next that is put in (or use fluid cell to lock)"); + inBrackets = GT_Utility.trans( + "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(); } - GT_Utility.sendChatToPlayer(aPlayer, String.format("%s (%s)", GT_Utility.trans("151.1", "Outputs items and 1 specific Fluid"), inBrackets)); + GT_Utility.sendChatToPlayer( + aPlayer, + String.format( + "%s (%s)", + GT_Utility.trans("151.1", "Outputs items and 1 specific Fluid"), inBrackets)); break; case 9: playerThatLockedfluid = aPlayer; if (mFluid == null) { this.setLockedFluidName(null); - inBrackets = GT_Utility.trans("115.3","currently none, will be locked to the next that is put in (or use fluid cell to lock)"); + inBrackets = GT_Utility.trans( + "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(); } - GT_Utility.sendChatToPlayer(aPlayer, String.format("%s (%s)", GT_Utility.trans("151.2", "Outputs 1 specific Fluid"), inBrackets)); + GT_Utility.sendChatToPlayer( + aPlayer, + String.format("%s (%s)", GT_Utility.trans("151.2", "Outputs 1 specific Fluid"), inBrackets)); break; } } private boolean tryToLockHatch(EntityPlayer aPlayer, byte aSide) { - if (!getBaseMetaTileEntity().getCoverBehaviorAtSideNew(aSide).isGUIClickable(aSide, getBaseMetaTileEntity().getCoverIDAtSide(aSide), getBaseMetaTileEntity().getComplexCoverDataAtSide(aSide), getBaseMetaTileEntity())) - return false; - if (!isFluidLocked()) - return false; + if (!getBaseMetaTileEntity() + .getCoverBehaviorAtSideNew(aSide) + .isGUIClickable( + aSide, + getBaseMetaTileEntity().getCoverIDAtSide(aSide), + getBaseMetaTileEntity().getComplexCoverDataAtSide(aSide), + getBaseMetaTileEntity())) return false; + if (!isFluidLocked()) return false; ItemStack tCurrentItem = aPlayer.inventory.getCurrentItem(); - if (tCurrentItem == null) - return false; + if (tCurrentItem == null) return false; FluidStack tFluid = FluidContainerRegistry.getFluidForFilledItem(tCurrentItem); if (tFluid == null && tCurrentItem.getItem() instanceof IFluidContainerItem) - tFluid = ((IFluidContainerItem)tCurrentItem.getItem()).getFluid(tCurrentItem); + tFluid = ((IFluidContainerItem) tCurrentItem.getItem()).getFluid(tCurrentItem); if (tFluid != null) { - if (getLockedFluidName() != null && !getLockedFluidName().equals(tFluid.getFluid().getName())) { - GT_Utility.sendChatToPlayer(aPlayer, String.format("%s %s", GT_Utility.trans("151.3", - "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 { + if (getLockedFluidName() != null + && !getLockedFluidName().equals(tFluid.getFluid().getName())) { + GT_Utility.sendChatToPlayer( + aPlayer, + String.format( + "%s %s", + GT_Utility.trans( + "151.3", + "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()); if (mMode == 8) - GT_Utility.sendChatToPlayer(aPlayer, String.format("%s (%s)", GT_Utility.trans("151.1", "Outputs items and 1 specific Fluid"), tFluid.getLocalizedName())); + GT_Utility.sendChatToPlayer( + aPlayer, + String.format( + "%s (%s)", + GT_Utility.trans("151.1", "Outputs items and 1 specific Fluid"), + tFluid.getLocalizedName())); else - GT_Utility.sendChatToPlayer(aPlayer, String.format("%s (%s)", GT_Utility.trans("151.2", "Outputs 1 specific Fluid"), tFluid.getLocalizedName())); + GT_Utility.sendChatToPlayer( + aPlayer, + String.format( + "%s (%s)", + GT_Utility.trans("151.2", "Outputs 1 specific Fluid"), tFluid.getLocalizedName())); } return true; } @@ -303,9 +348,9 @@ public class GT_MetaTileEntity_Hatch_Output extends GT_MetaTileEntity_Hatch { } @Override - public boolean onRightclick(IGregTechTileEntity aBaseMetaTileEntity, EntityPlayer aPlayer, byte aSide, float aX, float aY, float aZ) { - if (tryToLockHatch(aPlayer, aSide)) - return true; + public boolean onRightclick( + IGregTechTileEntity aBaseMetaTileEntity, EntityPlayer aPlayer, byte aSide, float aX, float aY, float aZ) { + if (tryToLockHatch(aPlayer, aSide)) return true; return super.onRightclick(aBaseMetaTileEntity, aPlayer, aSide, aX, aY, aZ); } @@ -342,7 +387,10 @@ public class GT_MetaTileEntity_Hatch_Output extends GT_MetaTileEntity_Hatch { protected void onEmptyingContainerWhenEmpty() { if (this.lockedFluidName == null && this.mFluid != null) { this.setLockedFluidName(this.mFluid.getFluid().getName()); - GT_Utility.sendChatToPlayer(playerThatLockedfluid, String.format(GT_Utility.trans("151.4","Sucessfully locked Fluid to %s"), mFluid.getLocalizedName())); + GT_Utility.sendChatToPlayer( + playerThatLockedfluid, + String.format( + GT_Utility.trans("151.4", "Sucessfully locked Fluid to %s"), mFluid.getLocalizedName())); } } @@ -353,13 +401,20 @@ public class GT_MetaTileEntity_Hatch_Output extends GT_MetaTileEntity_Hatch { @Override public String[] getInfoData() { - return new String[]{ - EnumChatFormatting.BLUE + "Output Hatch" + EnumChatFormatting.RESET, - "Stored Fluid:", - EnumChatFormatting.GOLD + (mFluid == null ? "No Fluid" : mFluid.getLocalizedName()) + EnumChatFormatting.RESET, - EnumChatFormatting.GREEN + GT_Utility.formatNumbers(mFluid == null ? 0 : mFluid.amount) + " L" + EnumChatFormatting.RESET + " " + - EnumChatFormatting.YELLOW + GT_Utility.formatNumbers(getCapacity()) + " L"+ EnumChatFormatting.RESET, - (!isFluidLocked() || lockedFluidName == null) ? "Not Locked" : ("Locked to " + StatCollector.translateToLocal(FluidRegistry.getFluidStack(lockedFluidName, 1).getUnlocalizedName())) + return new String[] { + EnumChatFormatting.BLUE + "Output Hatch" + EnumChatFormatting.RESET, + "Stored Fluid:", + EnumChatFormatting.GOLD + + (mFluid == null ? "No Fluid" : mFluid.getLocalizedName()) + + EnumChatFormatting.RESET, + EnumChatFormatting.GREEN + GT_Utility.formatNumbers(mFluid == null ? 0 : mFluid.amount) + " L" + + EnumChatFormatting.RESET + " " + EnumChatFormatting.YELLOW + + GT_Utility.formatNumbers(getCapacity()) + " L" + EnumChatFormatting.RESET, + (!isFluidLocked() || lockedFluidName == null) + ? "Not Locked" + : ("Locked to " + + StatCollector.translateToLocal(FluidRegistry.getFluidStack(lockedFluidName, 1) + .getUnlocalizedName())) }; } } 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 8ee2f48b2d..5b08f7ae69 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 @@ -1,5 +1,9 @@ package gregtech.api.metatileentity.implementations; +import static gregtech.api.enums.Textures.BlockIcons.ITEM_OUT_SIGN; +import static gregtech.api.enums.Textures.BlockIcons.OVERLAY_PIPE_OUT; +import static gregtech.api.util.GT_Utility.moveMultipleItemStacks; + import gregtech.GT_Mod; import gregtech.api.gui.*; import gregtech.api.interfaces.ITexture; @@ -13,31 +17,36 @@ import net.minecraft.entity.player.InventoryPlayer; import net.minecraft.inventory.IInventory; import net.minecraft.item.ItemStack; -import static gregtech.api.enums.Textures.BlockIcons.ITEM_OUT_SIGN; -import static gregtech.api.enums.Textures.BlockIcons.OVERLAY_PIPE_OUT; -import static gregtech.api.util.GT_Utility.moveMultipleItemStacks; - public class GT_MetaTileEntity_Hatch_OutputBus extends GT_MetaTileEntity_Hatch { public GT_MetaTileEntity_Hatch_OutputBus(int aID, String aName, String aNameRegional, int aTier) { this(aID, aName, aNameRegional, aTier, getSlots(aTier)); } public GT_MetaTileEntity_Hatch_OutputBus(int id, String name, String nameRegional, int tier, int slots) { - super(id, name, nameRegional, tier, slots, ArrayExt.of( - "Item Output for Multiblocks", - "Capacity: " + getSlots(tier) + " stack" + (getSlots(tier) >= 2 ? "s" : ""))); - } - - public GT_MetaTileEntity_Hatch_OutputBus(int aID, String aName, String aNameRegional, int aTier, String[] aDescription) { + super( + id, + name, + nameRegional, + tier, + slots, + ArrayExt.of( + "Item Output for Multiblocks", + "Capacity: " + getSlots(tier) + " stack" + (getSlots(tier) >= 2 ? "s" : ""))); + } + + public GT_MetaTileEntity_Hatch_OutputBus( + int aID, String aName, String aNameRegional, int aTier, String[] aDescription) { super(aID, aName, aNameRegional, aTier, getSlots(aTier), aDescription); } - public GT_MetaTileEntity_Hatch_OutputBus(int aID, String aName, String aNameRegional, int aTier, String[] aDescription, int inventorySize) { + public GT_MetaTileEntity_Hatch_OutputBus( + int aID, String aName, String aNameRegional, int aTier, String[] aDescription, int inventorySize) { super(aID, aName, aNameRegional, aTier, inventorySize, aDescription); } @Deprecated - // having too many constructors is bad, don't be so lazy, use GT_MetaTileEntity_Hatch_OutputBus(String, int, String[], ITexture[][][]) + // having too many constructors is bad, don't be so lazy, use GT_MetaTileEntity_Hatch_OutputBus(String, int, + // String[], ITexture[][][]) public GT_MetaTileEntity_Hatch_OutputBus(String aName, int aTier, String aDescription, ITexture[][][] aTextures) { this(aName, aTier, getSlots(aTier), ArrayExt.of(aDescription), aTextures); } @@ -46,22 +55,23 @@ public class GT_MetaTileEntity_Hatch_OutputBus extends GT_MetaTileEntity_Hatch { super(aName, aTier, getSlots(aTier), aDescription, aTextures); } - public GT_MetaTileEntity_Hatch_OutputBus(String name, int tier, int slots, String[] description, ITexture[][][] textures) { + public GT_MetaTileEntity_Hatch_OutputBus( + String name, int tier, int slots, String[] description, ITexture[][][] textures) { super(name, tier, slots, description, textures); } @Override public ITexture[] getTexturesActive(ITexture aBaseTexture) { - return GT_Mod.gregtechproxy.mRenderIndicatorsOnHatch ? - new ITexture[]{aBaseTexture, TextureFactory.of(OVERLAY_PIPE_OUT), TextureFactory.of(ITEM_OUT_SIGN)} : - new ITexture[]{aBaseTexture, TextureFactory.of(OVERLAY_PIPE_OUT)}; + return GT_Mod.gregtechproxy.mRenderIndicatorsOnHatch + ? new ITexture[] {aBaseTexture, TextureFactory.of(OVERLAY_PIPE_OUT), TextureFactory.of(ITEM_OUT_SIGN)} + : new ITexture[] {aBaseTexture, TextureFactory.of(OVERLAY_PIPE_OUT)}; } @Override public ITexture[] getTexturesInactive(ITexture aBaseTexture) { - return GT_Mod.gregtechproxy.mRenderIndicatorsOnHatch ? - new ITexture[]{aBaseTexture, TextureFactory.of(OVERLAY_PIPE_OUT), TextureFactory.of(ITEM_OUT_SIGN)} : - new ITexture[]{aBaseTexture, TextureFactory.of(OVERLAY_PIPE_OUT)}; + return GT_Mod.gregtechproxy.mRenderIndicatorsOnHatch + ? new ITexture[] {aBaseTexture, TextureFactory.of(OVERLAY_PIPE_OUT), TextureFactory.of(ITEM_OUT_SIGN)} + : new ITexture[] {aBaseTexture, TextureFactory.of(OVERLAY_PIPE_OUT)}; } @Override @@ -144,9 +154,9 @@ public class GT_MetaTileEntity_Hatch_OutputBus extends GT_MetaTileEntity_Hatch { mInventory[i] = aStack.splitStack(getInventoryStackLimit()); } else { int tRealStackLimit = Math.min(getInventoryStackLimit(), tSlot.getMaxStackSize()); - if (tSlot.stackSize < tRealStackLimit && - tSlot.isItemEqual(aStack) && - ItemStack.areItemStackTagsEqual(tSlot, aStack)) { + if (tSlot.stackSize < tRealStackLimit + && tSlot.isItemEqual(aStack) + && ItemStack.areItemStackTagsEqual(tSlot, aStack)) { if (aStack.stackSize + tSlot.stackSize <= tRealStackLimit) { mInventory[i].stackSize += aStack.stackSize; return true; @@ -174,15 +184,27 @@ public class GT_MetaTileEntity_Hatch_OutputBus extends GT_MetaTileEntity_Hatch { @Override public void onPostTick(IGregTechTileEntity aBaseMetaTileEntity, long aTick) { super.onPostTick(aBaseMetaTileEntity, aTick); - if (aBaseMetaTileEntity.isServerSide() && aBaseMetaTileEntity.isAllowedToWork() && (aTick&0x7)==0) { - IInventory tTileEntity =aBaseMetaTileEntity.getIInventoryAtSide(aBaseMetaTileEntity.getFrontFacing()); - if(tTileEntity!=null){ - moveMultipleItemStacks(aBaseMetaTileEntity,tTileEntity,aBaseMetaTileEntity.getFrontFacing(),aBaseMetaTileEntity.getBackFacing(),null,false,(byte)64,(byte)1,(byte)64,(byte)1,mInventory.length); + if (aBaseMetaTileEntity.isServerSide() && aBaseMetaTileEntity.isAllowedToWork() && (aTick & 0x7) == 0) { + IInventory tTileEntity = aBaseMetaTileEntity.getIInventoryAtSide(aBaseMetaTileEntity.getFrontFacing()); + if (tTileEntity != null) { + moveMultipleItemStacks( + aBaseMetaTileEntity, + tTileEntity, + aBaseMetaTileEntity.getFrontFacing(), + aBaseMetaTileEntity.getBackFacing(), + null, + false, + (byte) 64, + (byte) 1, + (byte) 64, + (byte) 1, + mInventory.length); for (int i = 0; i < mInventory.length; i++) if (mInventory[i] != null && mInventory[i].stackSize <= 0) mInventory[i] = null; -// GT_Utility.moveOneItemStack(aBaseMetaTileEntity, tTileEntity, -// aBaseMetaTileEntity.getFrontFacing(), aBaseMetaTileEntity.getBackFacing(), -// null, false, (byte) 64, (byte) 1, (byte)( 64 * aBaseMetaTileEntity.getSizeInventory()), (byte) 1); + // GT_Utility.moveOneItemStack(aBaseMetaTileEntity, tTileEntity, + // aBaseMetaTileEntity.getFrontFacing(), aBaseMetaTileEntity.getBackFacing(), + // null, false, (byte) 64, (byte) 1, (byte)( 64 * + // aBaseMetaTileEntity.getSizeInventory()), (byte) 1); } } } 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 e29499b0b1..bd8daabfb9 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 @@ -1,5 +1,10 @@ package gregtech.api.metatileentity.implementations; +import static gregtech.api.enums.GT_Values.*; +import static mcp.mobius.waila.api.SpecialChars.GREEN; +import static mcp.mobius.waila.api.SpecialChars.RED; +import static mcp.mobius.waila.api.SpecialChars.RESET; + import gregtech.GT_Mod; import gregtech.api.GregTech_API; import gregtech.api.enums.ConfigCategories; @@ -18,6 +23,8 @@ import gregtech.api.util.GT_Single_Recipe_Check; import gregtech.api.util.GT_Utility; import gregtech.common.GT_Pollution; import gregtech.common.items.GT_MetaGenerated_Tool_01; +import java.util.ArrayList; +import java.util.List; import mcp.mobius.waila.api.IWailaConfigHandler; import mcp.mobius.waila.api.IWailaDataAccessor; import net.minecraft.entity.player.EntityPlayer; @@ -32,20 +39,26 @@ import net.minecraft.world.World; import net.minecraftforge.fluids.FluidStack; import org.lwjgl.input.Keyboard; -import java.util.ArrayList; -import java.util.List; - -import static gregtech.api.enums.GT_Values.*; -import static mcp.mobius.waila.api.SpecialChars.GREEN; -import static mcp.mobius.waila.api.SpecialChars.RED; -import static mcp.mobius.waila.api.SpecialChars.RESET; - public abstract class GT_MetaTileEntity_MultiBlockBase extends MetaTileEntity { public static boolean disableMaintenance; - public boolean mMachine = false, mWrench = false, mScrewdriver = false, mSoftHammer = false, mHardHammer = false, mSolderingTool = false, mCrowbar = false, mRunningOnLoad = false; + public boolean mMachine = false, + mWrench = false, + mScrewdriver = false, + mSoftHammer = false, + mHardHammer = false, + mSolderingTool = false, + mCrowbar = false, + mRunningOnLoad = false; public boolean mStructureChanged = false; - public int mPollution = 0, mProgresstime = 0, mMaxProgresstime = 0, mEUt = 0, mEfficiencyIncrease = 0, mStartUpCheck = 100, mRuntime = 0, mEfficiency = 0; + public int mPollution = 0, + mProgresstime = 0, + mMaxProgresstime = 0, + mEUt = 0, + mEfficiencyIncrease = 0, + mStartUpCheck = 100, + mRuntime = 0, + mEfficiency = 0; public volatile boolean mUpdated = false; public int mUpdate = 0; public ItemStack[] mOutputItems = null; @@ -69,21 +82,29 @@ 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 @@ -106,7 +127,8 @@ public abstract class GT_MetaTileEntity_MultiBlockBase extends MetaTileEntity { if (supportsSingleRecipeLocking()) { mLockedToSingleRecipe = !mLockedToSingleRecipe; if (mLockedToSingleRecipe) { - GT_Utility.sendChatToPlayer(aPlayer, GT_Utility.trans("223", "Single recipe locking enabled. Will lock to next recipe.")); + GT_Utility.sendChatToPlayer( + aPlayer, GT_Utility.trans("223", "Single recipe locking enabled. Will lock to next recipe.")); } else { GT_Utility.sendChatToPlayer(aPlayer, GT_Utility.trans("220", "Single recipe locking disabled.")); mSingleRecipeCheck = null; @@ -234,7 +256,8 @@ public abstract class GT_MetaTileEntity_MultiBlockBase extends MetaTileEntity { @Override public Object getClientGUI(int aID, InventoryPlayer aPlayerInventory, IGregTechTileEntity aBaseMetaTileEntity) { - return new GT_GUIContainer_MultiMachine(aPlayerInventory, aBaseMetaTileEntity, getLocalName(), "MultiblockDisplay.png"); + return new GT_GUIContainer_MultiMachine( + aPlayerInventory, aBaseMetaTileEntity, getLocalName(), "MultiblockDisplay.png"); } @Override @@ -274,7 +297,7 @@ public abstract class GT_MetaTileEntity_MultiBlockBase extends MetaTileEntity { } public boolean checkStructure(boolean aForceReset, IGregTechTileEntity aBaseMetaTileEntity) { - if(!aBaseMetaTileEntity.isServerSide()) return mMachine; + if (!aBaseMetaTileEntity.isServerSide()) return mMachine; // Only trigger an update if forced (from onPostTick, generally), or if the structure has changed if ((mStructureChanged || aForceReset)) { clearHatches(); @@ -307,9 +330,16 @@ public abstract class GT_MetaTileEntity_MultiBlockBase extends MetaTileEntity { stopMachine(); } } - aBaseMetaTileEntity.setErrorDisplayID((aBaseMetaTileEntity.getErrorDisplayID() & ~127) | (mWrench ? 0 : 1) | (mScrewdriver ? 0 : 2) | (mSoftHammer ? 0 : 4) | (mHardHammer ? 0 : 8) | (mSolderingTool ? 0 : 16) | (mCrowbar ? 0 : 32) | (mMachine ? 0 : 64)); + aBaseMetaTileEntity.setErrorDisplayID((aBaseMetaTileEntity.getErrorDisplayID() & ~127) + | (mWrench ? 0 : 1) + | (mScrewdriver ? 0 : 2) + | (mSoftHammer ? 0 : 4) + | (mHardHammer ? 0 : 8) + | (mSolderingTool ? 0 : 16) + | (mCrowbar ? 0 : 32) + | (mMachine ? 0 : 64)); aBaseMetaTileEntity.setActive(mMaxProgresstime > 0); - boolean active=aBaseMetaTileEntity.isActive() && mPollution>0; + boolean active = aBaseMetaTileEntity.isActive() && mPollution > 0; for (GT_MetaTileEntity_Hatch_Muffler aMuffler : mMufflerHatches) { IGregTechTileEntity iGTTileEntity = aMuffler.getBaseMetaTileEntity(); if (iGTTileEntity != null && !iGTTileEntity.isDead()) { @@ -332,7 +362,9 @@ public abstract class GT_MetaTileEntity_MultiBlockBase extends MetaTileEntity { } for (GT_MetaTileEntity_Hatch_Maintenance tHatch : mMaintenanceHatches) { if (isValidMetaTileEntity(tHatch)) { - if (tHatch.mAuto && !( mWrench && mScrewdriver && mSoftHammer && mHardHammer && mSolderingTool && mCrowbar)) tHatch.autoMaintainance(); + if (tHatch.mAuto + && !(mWrench && mScrewdriver && mSoftHammer && mHardHammer && mSolderingTool && mCrowbar)) + tHatch.autoMaintainance(); if (tHatch.mWrench) mWrench = true; if (tHatch.mScrewdriver) mScrewdriver = true; if (tHatch.mSoftHammer) mSoftHammer = true; @@ -350,8 +382,7 @@ public abstract class GT_MetaTileEntity_MultiBlockBase extends MetaTileEntity { } } - protected boolean checkRecipe() - { + protected boolean checkRecipe() { startRecipeProcessing(); boolean result = checkRecipe(mInventory[1]); endRecipeProcessing(); @@ -366,19 +397,27 @@ public abstract class GT_MetaTileEntity_MultiBlockBase extends MetaTileEntity { stopMachine(); } if (mMaxProgresstime > 0 && ++mProgresstime >= mMaxProgresstime) { - if (mOutputItems != null) for (ItemStack tStack : mOutputItems) - if (tStack != null) { - try { - GT_Mod.achievements.issueAchivementHatch( - aBaseMetaTileEntity.getWorld().getPlayerEntityByName(aBaseMetaTileEntity.getOwnerName()), tStack); - } catch (Exception ignored) { + if (mOutputItems != null) + for (ItemStack tStack : mOutputItems) + if (tStack != null) { + try { + GT_Mod.achievements.issueAchivementHatch( + aBaseMetaTileEntity + .getWorld() + .getPlayerEntityByName(aBaseMetaTileEntity.getOwnerName()), + tStack); + } catch (Exception ignored) { + } + addOutput(tStack); } - addOutput(tStack); - } if (mOutputFluids != null) { addFluidOutputs(mOutputFluids); } - mEfficiency = Math.max(0, Math.min(mEfficiency + mEfficiencyIncrease, getMaxEfficiency(mInventory[1]) - ((getIdealStatus() - getRepairStatus()) * 1000))); + mEfficiency = Math.max( + 0, + Math.min( + mEfficiency + mEfficiencyIncrease, + getMaxEfficiency(mInventory[1]) - ((getIdealStatus() - getRepairStatus()) * 1000))); mOutputItems = null; mProgresstime = 0; mMaxProgresstime = 0; @@ -389,7 +428,11 @@ public abstract class GT_MetaTileEntity_MultiBlockBase extends MetaTileEntity { if (mOutputFluids != null && mOutputFluids.length > 0) { if (mOutputFluids.length > 1) { try { - GT_Mod.achievements.issueAchievement(aBaseMetaTileEntity.getWorld().getPlayerEntityByName(aBaseMetaTileEntity.getOwnerName()), "oilplant"); + GT_Mod.achievements.issueAchievement( + aBaseMetaTileEntity + .getWorld() + .getPlayerEntityByName(aBaseMetaTileEntity.getOwnerName()), + "oilplant"); } catch (Exception ignored) { } } @@ -397,7 +440,9 @@ public abstract class GT_MetaTileEntity_MultiBlockBase extends MetaTileEntity { } } } else { - if (aTick % 100 == 0 || aBaseMetaTileEntity.hasWorkJustBeenEnabled() || aBaseMetaTileEntity.hasInventoryBeenModified()) { + if (aTick % 100 == 0 + || aBaseMetaTileEntity.hasWorkJustBeenEnabled() + || aBaseMetaTileEntity.hasInventoryBeenModified()) { if (aBaseMetaTileEntity.isAllowedToWork()) { if (checkRecipe()) { @@ -465,15 +510,15 @@ public abstract class GT_MetaTileEntity_MultiBlockBase extends MetaTileEntity { /** * Gets the pollution this Device outputs to a Muffler per tick (10000 = one Pullution Block) */ - public int getPollutionPerTick(ItemStack aStack){ - return getPollutionPerSecond(aStack)/20; + public int getPollutionPerTick(ItemStack aStack) { + return getPollutionPerSecond(aStack) / 20; } /** * Gets the pollution produced per second by this multiblock, default to 0. Override this with * its actual value in the code of the multiblock. */ - public int getPollutionPerSecond(ItemStack aStack){ + public int getPollutionPerSecond(ItemStack aStack) { return 0; } @@ -503,18 +548,22 @@ public abstract class GT_MetaTileEntity_MultiBlockBase extends MetaTileEntity { } public int getRepairStatus() { - return (mWrench ? 1 : 0) + (mScrewdriver ? 1 : 0) + (mSoftHammer ? 1 : 0) + (mHardHammer ? 1 : 0) + (mSolderingTool ? 1 : 0) + (mCrowbar ? 1 : 0); + return (mWrench ? 1 : 0) + + (mScrewdriver ? 1 : 0) + + (mSoftHammer ? 1 : 0) + + (mHardHammer ? 1 : 0) + + (mSolderingTool ? 1 : 0) + + (mCrowbar ? 1 : 0); } public int getIdealStatus() { return 6; } - public int getCurrentEfficiency(ItemStack itemStack) { - int maxEff = getMaxEfficiency(itemStack); - return maxEff - (getIdealStatus() - getRepairStatus()) * maxEff / 10; - } + int maxEff = getMaxEfficiency(itemStack); + return maxEff - (getIdealStatus() - getRepairStatus()) * maxEff / 10; + } public boolean doRandomMaintenanceDamage() { if (!isCorrectMachinePart(mInventory[1]) || getRepairStatus() == 0) { @@ -545,10 +594,18 @@ public abstract class GT_MetaTileEntity_MultiBlockBase extends MetaTileEntity { break; } } - if (mInventory[1] != null && getBaseMetaTileEntity().getRandomNumber(2) == 0 && !mInventory[1].getUnlocalizedName().startsWith("gt.blockmachines.basicmachine.")) { + if (mInventory[1] != null + && getBaseMetaTileEntity().getRandomNumber(2) == 0 + && !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))); + ((GT_MetaGenerated_Tool) mInventory[1].getItem()) + .doDamage( + mInventory[1], + (long) getDamageToComponent(mInventory[1]) + * (long) Math.min( + mEUt / this.damageFactorLow, + Math.pow(mEUt, this.damageFactorHigh))); if (mInventory[1].stackSize == 0) mInventory[1] = null; } } @@ -558,18 +615,30 @@ public abstract class GT_MetaTileEntity_MultiBlockBase extends MetaTileEntity { public void explodeMultiblock() { - GT_Log.exp.println("MultiBlockExplosion at: " +this.getBaseMetaTileEntity().getXCoord()+" | "+this.getBaseMetaTileEntity().getYCoord()+" | "+this.getBaseMetaTileEntity().getZCoord()+" DIMID: "+ this.getBaseMetaTileEntity().getWorld().provider.dimensionId+"."); + GT_Log.exp.println( + "MultiBlockExplosion at: " + this.getBaseMetaTileEntity().getXCoord() + " | " + + this.getBaseMetaTileEntity().getYCoord() + " | " + + this.getBaseMetaTileEntity().getZCoord() + " DIMID: " + + this.getBaseMetaTileEntity().getWorld().provider.dimensionId + "."); GT_Pollution.addPollution(getBaseMetaTileEntity(), GT_Mod.gregtechproxy.mPollutionOnExplosion); mInventory[1] = null; - for (MetaTileEntity tTileEntity : mInputBusses) tTileEntity.getBaseMetaTileEntity().doExplosion(V[8]); - for (MetaTileEntity tTileEntity : mOutputBusses) tTileEntity.getBaseMetaTileEntity().doExplosion(V[8]); - for (MetaTileEntity tTileEntity : mInputHatches) tTileEntity.getBaseMetaTileEntity().doExplosion(V[8]); - for (MetaTileEntity tTileEntity : mOutputHatches) tTileEntity.getBaseMetaTileEntity().doExplosion(V[8]); - for (MetaTileEntity tTileEntity : mDynamoHatches) tTileEntity.getBaseMetaTileEntity().doExplosion(V[8]); - for (MetaTileEntity tTileEntity : mMufflerHatches) tTileEntity.getBaseMetaTileEntity().doExplosion(V[8]); - for (MetaTileEntity tTileEntity : mEnergyHatches) tTileEntity.getBaseMetaTileEntity().doExplosion(V[8]); - for (MetaTileEntity tTileEntity : mMaintenanceHatches) tTileEntity.getBaseMetaTileEntity().doExplosion(V[8]); + for (MetaTileEntity tTileEntity : mInputBusses) + tTileEntity.getBaseMetaTileEntity().doExplosion(V[8]); + for (MetaTileEntity tTileEntity : mOutputBusses) + tTileEntity.getBaseMetaTileEntity().doExplosion(V[8]); + for (MetaTileEntity tTileEntity : mInputHatches) + tTileEntity.getBaseMetaTileEntity().doExplosion(V[8]); + for (MetaTileEntity tTileEntity : mOutputHatches) + tTileEntity.getBaseMetaTileEntity().doExplosion(V[8]); + for (MetaTileEntity tTileEntity : mDynamoHatches) + tTileEntity.getBaseMetaTileEntity().doExplosion(V[8]); + for (MetaTileEntity tTileEntity : mMufflerHatches) + tTileEntity.getBaseMetaTileEntity().doExplosion(V[8]); + for (MetaTileEntity tTileEntity : mEnergyHatches) + tTileEntity.getBaseMetaTileEntity().doExplosion(V[8]); + for (MetaTileEntity tTileEntity : mMaintenanceHatches) + tTileEntity.getBaseMetaTileEntity().doExplosion(V[8]); getBaseMetaTileEntity().doExplosion(V[8]); } @@ -582,13 +651,14 @@ public abstract class GT_MetaTileEntity_MultiBlockBase extends MetaTileEntity { } return false; } + public boolean addEnergyOutputMultipleDynamos(long aEU, boolean aAllowMixedVoltageDynamos) { int injected = 0; long totalOutput = 0; long aFirstVoltageFound = -1; boolean aFoundMixedDynamos = false; for (GT_MetaTileEntity_Hatch_Dynamo aDynamo : mDynamoHatches) { - if( aDynamo == null ) { + if (aDynamo == null) { return false; } if (isValidMetaTileEntity(aDynamo)) { @@ -597,8 +667,7 @@ public abstract class GT_MetaTileEntity_MultiBlockBase extends MetaTileEntity { // Check against voltage to check when hatch mixing if (aFirstVoltageFound == -1) { aFirstVoltageFound = aVoltage; - } - else { + } else { if (aFirstVoltageFound != aVoltage) { aFoundMixedDynamos = true; } @@ -623,14 +692,14 @@ public abstract class GT_MetaTileEntity_MultiBlockBase extends MetaTileEntity { aVoltage = aDynamo.maxEUOutput(); aAmpsToInject = (int) (leftToInject / aVoltage); aRemainder = (int) (leftToInject - (aAmpsToInject * aVoltage)); - ampsOnCurrentHatch= (int) Math.min(aDynamo.maxAmperesOut(), aAmpsToInject); + ampsOnCurrentHatch = (int) Math.min(aDynamo.maxAmperesOut(), aAmpsToInject); for (int i = 0; i < ampsOnCurrentHatch; i++) { aDynamo.getBaseMetaTileEntity().increaseStoredEnergyUnits(aVoltage, false); } - injected+=aVoltage*ampsOnCurrentHatch; - if(aRemainder>0 && ampsOnCurrentHatch<aDynamo.maxAmperesOut()){ + injected += aVoltage * ampsOnCurrentHatch; + if (aRemainder > 0 && ampsOnCurrentHatch < aDynamo.maxAmperesOut()) { aDynamo.getBaseMetaTileEntity().increaseStoredEnergyUnits(aRemainder, false); - injected+=aRemainder; + injected += aRemainder; } } } @@ -640,7 +709,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; } @@ -652,23 +722,24 @@ public abstract class GT_MetaTileEntity_MultiBlockBase extends MetaTileEntity { * @param maxInputVoltage - Multiblock Max input voltage * @param perfectOC - If the Multiblock OCs perfectly, i.e. the large Chemical Reactor */ - protected void calculateOverclockedNessMultiInternal(int aEUt, int aDuration, int mAmperage, long maxInputVoltage, boolean perfectOC) { + protected void calculateOverclockedNessMultiInternal( + int aEUt, int aDuration, int mAmperage, long maxInputVoltage, boolean perfectOC) { byte mTier = (byte) Math.max(0, GT_Utility.getTier(maxInputVoltage)); - if(mTier == 0){ - //Long time calculation - long xMaxProgresstime = ((long)aDuration)<<1; - if(xMaxProgresstime > Integer.MAX_VALUE - 1){ - //make impossible if too long + if (mTier == 0) { + // Long time calculation + long xMaxProgresstime = ((long) aDuration) << 1; + if (xMaxProgresstime > Integer.MAX_VALUE - 1) { + // make impossible if too long mEUt = Integer.MAX_VALUE - 1; mMaxProgresstime = Integer.MAX_VALUE - 1; - }else{ + } else { mEUt = aEUt >> 2; - mMaxProgresstime= (int) xMaxProgresstime; + mMaxProgresstime = (int) xMaxProgresstime; } - }else{ - //Long EUt calculation + } else { + // Long EUt calculation long xEUt = aEUt; - //Isnt too low EUt check? + // Isnt too low EUt check? long tempEUt = Math.max(xEUt, V[1]); mMaxProgresstime = aDuration; @@ -676,41 +747,35 @@ public abstract class GT_MetaTileEntity_MultiBlockBase extends MetaTileEntity { final int ocTimeShift = perfectOC ? 2 : 1; while (tempEUt <= V[mTier - 1] * mAmperage) { - tempEUt <<= 2;//this actually controls overclocking - //xEUt *= 4;//this is effect of everclocking + tempEUt <<= 2; // this actually controls overclocking + // xEUt *= 4;//this is effect of everclocking int oldTime = mMaxProgresstime; - mMaxProgresstime >>= ocTimeShift;//this is effect of overclocking - if (mMaxProgresstime <1) - { - if(oldTime == 1) - break; - xEUt *= oldTime * (perfectOC ? 1:2); + mMaxProgresstime >>= ocTimeShift; // this is effect of overclocking + if (mMaxProgresstime < 1) { + if (oldTime == 1) break; + xEUt *= oldTime * (perfectOC ? 1 : 2); break; - } - else - { + } else { xEUt <<= 2; } } - if(xEUt > Integer.MAX_VALUE - 1) { + if (xEUt > Integer.MAX_VALUE - 1) { mEUt = Integer.MAX_VALUE - 1; mMaxProgresstime = Integer.MAX_VALUE - 1; } else { mEUt = (int) xEUt; - if(mEUt == 0) - mEUt = 1; - if(mMaxProgresstime == 0) - mMaxProgresstime = 1;//set time to 1 tick + if (mEUt == 0) mEUt = 1; + if (mMaxProgresstime == 0) mMaxProgresstime = 1; // set time to 1 tick } } } protected void calculateOverclockedNessMulti(int aEUt, int aDuration, int mAmperage, long maxInputVoltage) { - calculateOverclockedNessMultiInternal(aEUt,aDuration,mAmperage,maxInputVoltage,false); + calculateOverclockedNessMultiInternal(aEUt, aDuration, mAmperage, maxInputVoltage, false); } protected void calculatePerfectOverclockedNessMulti(int aEUt, int aDuration, int mAmperage, long maxInputVoltage) { - calculateOverclockedNessMultiInternal(aEUt,aDuration,mAmperage,maxInputVoltage,true); + calculateOverclockedNessMultiInternal(aEUt, aDuration, mAmperage, maxInputVoltage, true); } public boolean drainEnergyInput(long aEU) { @@ -722,27 +787,33 @@ public abstract class GT_MetaTileEntity_MultiBlockBase extends MetaTileEntity { return false; } - protected static boolean dumpFluid(List<GT_MetaTileEntity_Hatch_Output> aOutputHatches, FluidStack copiedFluidStack, boolean restrictiveHatchesOnly){ + protected static boolean dumpFluid( + List<GT_MetaTileEntity_Hatch_Output> aOutputHatches, + FluidStack copiedFluidStack, + boolean restrictiveHatchesOnly) { for (GT_MetaTileEntity_Hatch_Output tHatch : aOutputHatches) { - if (!isValidMetaTileEntity(tHatch) || (restrictiveHatchesOnly && tHatch.mMode == 0)) { - continue; - } - if (GT_ModHandler.isSteam(copiedFluidStack)) { - if (!tHatch.outputsSteam()) { - continue; - } - } else { - if (!tHatch.outputsLiquids()) { - continue; - } - if (tHatch.isFluidLocked() && tHatch.getLockedFluidName() != null && !tHatch.getLockedFluidName().equals(copiedFluidStack.getFluid().getName())) { - continue; - } - } + if (!isValidMetaTileEntity(tHatch) || (restrictiveHatchesOnly && tHatch.mMode == 0)) { + continue; + } + if (GT_ModHandler.isSteam(copiedFluidStack)) { + if (!tHatch.outputsSteam()) { + continue; + } + } else { + if (!tHatch.outputsLiquids()) { + continue; + } + if (tHatch.isFluidLocked() + && tHatch.getLockedFluidName() != null + && !tHatch.getLockedFluidName() + .equals(copiedFluidStack.getFluid().getName())) { + continue; + } + } int tAmount = tHatch.fill(copiedFluidStack, false); if (tAmount >= copiedFluidStack.amount) { - boolean filled = tHatch.fill(copiedFluidStack, true) >= copiedFluidStack.amount; - tHatch.onEmptyingContainerWhenEmpty(); + boolean filled = tHatch.fill(copiedFluidStack, true) >= copiedFluidStack.amount; + tHatch.onEmptyingContainerWhenEmpty(); return filled; } else if (tAmount > 0) { copiedFluidStack.amount = copiedFluidStack.amount - tHatch.fill(copiedFluidStack, true); @@ -755,7 +826,7 @@ public abstract class GT_MetaTileEntity_MultiBlockBase extends MetaTileEntity { public boolean addOutput(FluidStack aLiquid) { if (aLiquid == null) return false; FluidStack copiedFluidStack = aLiquid.copy(); - if (!dumpFluid(mOutputHatches, copiedFluidStack, true)){ + if (!dumpFluid(mOutputHatches, copiedFluidStack, true)) { dumpFluid(mOutputHatches, copiedFluidStack, false); } return false; @@ -763,7 +834,7 @@ public abstract class GT_MetaTileEntity_MultiBlockBase extends MetaTileEntity { protected void addFluidOutputs(FluidStack[] mOutputFluids2) { for (FluidStack outputFluidStack : mOutputFluids2) { - addOutput(outputFluidStack); + addOutput(outputFluidStack); } } @@ -780,8 +851,7 @@ public abstract class GT_MetaTileEntity_MultiBlockBase extends MetaTileEntity { return tLiquid != null && tLiquid.amount >= aLiquid.amount; } } - } - else { + } else { FluidStack tLiquid = tHatch.getFluid(); if (tLiquid != null && tLiquid.isFluidEqual(aLiquid)) { tLiquid = tHatch.drain(aLiquid.amount, false); @@ -824,7 +894,8 @@ 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 (GT_Utility.areStacksEqual( + aStack, tHatch.getBaseMetaTileEntity().getStackInSlot(0))) { if (tHatch.getBaseMetaTileEntity().getStackInSlot(0).stackSize >= aStack.stackSize) { tHatch.getBaseMetaTileEntity().decrStackSize(0, aStack.stackSize); return true; @@ -836,7 +907,8 @@ public abstract class GT_MetaTileEntity_MultiBlockBase extends MetaTileEntity { 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 (GT_Utility.areStacksEqual( + aStack, tHatch.getBaseMetaTileEntity().getStackInSlot(i))) { if (tHatch.getBaseMetaTileEntity().getStackInSlot(i).stackSize >= aStack.stackSize) { tHatch.getBaseMetaTileEntity().decrStackSize(i, aStack.stackSize); return true; @@ -850,11 +922,11 @@ public abstract class GT_MetaTileEntity_MultiBlockBase extends MetaTileEntity { public ArrayList<ItemStack> getStoredOutputs() { ArrayList<ItemStack> rList = new ArrayList<>(); -// for (GT_MetaTileEntity_Hatch_Output tHatch : mOutputHatches) { -// if (isValidMetaTileEntity(tHatch)) { -// rList.add(tHatch.getBaseMetaTileEntity().getStackInSlot(1)); -// } -// } + // for (GT_MetaTileEntity_Hatch_Output tHatch : mOutputHatches) { + // if (isValidMetaTileEntity(tHatch)) { + // rList.add(tHatch.getBaseMetaTileEntity().getStackInSlot(1)); + // } + // } for (GT_MetaTileEntity_Hatch_OutputBus tHatch : mOutputBusses) { if (isValidMetaTileEntity(tHatch)) { for (int i = tHatch.getBaseMetaTileEntity().getSizeInventory() - 1; i >= 0; i--) { @@ -873,15 +945,14 @@ public abstract class GT_MetaTileEntity_MultiBlockBase extends MetaTileEntity { if (isValidMetaTileEntity(tHatch)) { for (FluidStack tFluid : ((GT_MetaTileEntity_Hatch_MultiInput) tHatch).getStoredFluid()) { if (tFluid != null) { - //GT_Log.out.print("mf: " + tFluid + "\n"); + // GT_Log.out.print("mf: " + tFluid + "\n"); rList.add(tFluid); } } } - } - else { + } else { if (isValidMetaTileEntity(tHatch) && tHatch.getFillableStack() != null) { - //GT_Log.out.print("sf: " + tHatch.getFillableStack() + "\n"); + // GT_Log.out.print("sf: " + tHatch.getFillableStack() + "\n"); rList.add(tHatch.getFillableStack()); } } @@ -900,7 +971,7 @@ public abstract class GT_MetaTileEntity_MultiBlockBase extends MetaTileEntity { } } } - 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; } @@ -916,19 +987,18 @@ public abstract class GT_MetaTileEntity_MultiBlockBase extends MetaTileEntity { if (isValidMetaTileEntity(tHatch)) tHatch.updateSlots(); } - protected void startRecipeProcessing() - { + protected void startRecipeProcessing() { for (GT_MetaTileEntity_Hatch_InputBus tHatch : mInputBusses) if (isValidMetaTileEntity(tHatch)) tHatch.startRecipeProcessing(); } - protected void endRecipeProcessing() - { + protected void endRecipeProcessing() { for (GT_MetaTileEntity_Hatch_InputBus tHatch : mInputBusses) if (isValidMetaTileEntity(tHatch)) tHatch.endRecipeProcessing(); } - protected static <T extends GT_MetaTileEntity_Hatch> T identifyHatch(IGregTechTileEntity aTileEntity, int aBaseCasingIndex, Class<T> clazz) { + protected static <T extends GT_MetaTileEntity_Hatch> T identifyHatch( + IGregTechTileEntity aTileEntity, int aBaseCasingIndex, Class<T> clazz) { if (aTileEntity == null) return null; IMetaTileEntity aMetaTileEntity = aTileEntity.getMetaTileEntity(); if (!clazz.isInstance(aMetaTileEntity)) return null; @@ -995,7 +1065,8 @@ public abstract class GT_MetaTileEntity_MultiBlockBase extends MetaTileEntity { if (aTileEntity == null) return false; IMetaTileEntity aMetaTileEntity = aTileEntity.getMetaTileEntity(); if (aMetaTileEntity == null) return false; - if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch && GT_ExoticEnergyInputHelper.isExoticEnergyInput(aMetaTileEntity)) { + if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch + && GT_ExoticEnergyInputHelper.isExoticEnergyInput(aMetaTileEntity)) { GT_MetaTileEntity_Hatch hatch = (GT_MetaTileEntity_Hatch) aMetaTileEntity; hatch.updateTexture(aBaseCasingIndex); return mExoticEnergyHatches.add(hatch); @@ -1026,13 +1097,13 @@ public abstract class GT_MetaTileEntity_MultiBlockBase extends MetaTileEntity { } public boolean addInputToMachineList(IGregTechTileEntity aTileEntity, int aBaseCasingIndex) { - return addInputBusToMachineList(aTileEntity, aBaseCasingIndex) || - addInputHatchToMachineList(aTileEntity, aBaseCasingIndex); + return addInputBusToMachineList(aTileEntity, aBaseCasingIndex) + || addInputHatchToMachineList(aTileEntity, aBaseCasingIndex); } public boolean addOutputToMachineList(IGregTechTileEntity aTileEntity, int aBaseCasingIndex) { - return addOutputBusToMachineList(aTileEntity, aBaseCasingIndex) || - addOutputHatchToMachineList(aTileEntity, aBaseCasingIndex); + return addOutputBusToMachineList(aTileEntity, aBaseCasingIndex) + || addOutputHatchToMachineList(aTileEntity, aBaseCasingIndex); } public boolean addInputBusToMachineList(IGregTechTileEntity aTileEntity, int aBaseCasingIndex) { @@ -1083,41 +1154,45 @@ public abstract class GT_MetaTileEntity_MultiBlockBase extends MetaTileEntity { @Override public String[] getInfoData() { - int mPollutionReduction=0; + int mPollutionReduction = 0; for (GT_MetaTileEntity_Hatch_Muffler tHatch : mMufflerHatches) { if (isValidMetaTileEntity(tHatch)) { - mPollutionReduction=Math.max(tHatch.calculatePollutionReduction(100),mPollutionReduction); + mPollutionReduction = Math.max(tHatch.calculatePollutionReduction(100), mPollutionReduction); } } - long storedEnergy=0; - long maxEnergy=0; - for(GT_MetaTileEntity_Hatch_Energy tHatch : mEnergyHatches) { + long storedEnergy = 0; + 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(); } } - return new String[]{ - /* 1*/ StatCollector.translateToLocal("GT5U.multiblock.Progress") + ": " + - EnumChatFormatting.GREEN + GT_Utility.formatNumbers(mProgresstime/20) + EnumChatFormatting.RESET + " s / " + - EnumChatFormatting.YELLOW + GT_Utility.formatNumbers(mMaxProgresstime/20) + EnumChatFormatting.RESET + " s", - /* 2*/ StatCollector.translateToLocal("GT5U.multiblock.energy") + ": " + - EnumChatFormatting.GREEN + GT_Utility.formatNumbers(storedEnergy) + EnumChatFormatting.RESET + " EU / " + - EnumChatFormatting.YELLOW + GT_Utility.formatNumbers(maxEnergy) + EnumChatFormatting.RESET + " EU", - /* 3*/ StatCollector.translateToLocal("GT5U.multiblock.usage") + ": " + - EnumChatFormatting.RED + GT_Utility.formatNumbers(-mEUt) + EnumChatFormatting.RESET + " EU/t", - /* 4*/ StatCollector.translateToLocal("GT5U.multiblock.mei") + ": " + - EnumChatFormatting.YELLOW + GT_Utility.formatNumbers(getMaxInputVoltage()) + EnumChatFormatting.RESET + " EU/t(*2A) " + - StatCollector.translateToLocal("GT5U.machines.tier") + ": " + - EnumChatFormatting.YELLOW + VN[GT_Utility.getTier(getMaxInputVoltage())] + EnumChatFormatting.RESET, - /* 5*/ StatCollector.translateToLocal("GT5U.multiblock.problems") + ": " + - EnumChatFormatting.RED + (getIdealStatus() - getRepairStatus()) + EnumChatFormatting.RESET + " " + - StatCollector.translateToLocal("GT5U.multiblock.efficiency") + ": " + - EnumChatFormatting.YELLOW + Float.toString(mEfficiency / 100.0F) + EnumChatFormatting.RESET + " %", - /* 6*/ StatCollector.translateToLocal("GT5U.multiblock.pollution") + ": " + - EnumChatFormatting.GREEN + mPollutionReduction + EnumChatFormatting.RESET + " %" + return new String[] { + /* 1*/ StatCollector.translateToLocal("GT5U.multiblock.Progress") + ": " + EnumChatFormatting.GREEN + + GT_Utility.formatNumbers(mProgresstime / 20) + EnumChatFormatting.RESET + " s / " + + EnumChatFormatting.YELLOW + + GT_Utility.formatNumbers(mMaxProgresstime / 20) + EnumChatFormatting.RESET + " s", + /* 2*/ StatCollector.translateToLocal("GT5U.multiblock.energy") + ": " + EnumChatFormatting.GREEN + + GT_Utility.formatNumbers(storedEnergy) + EnumChatFormatting.RESET + " EU / " + + EnumChatFormatting.YELLOW + + GT_Utility.formatNumbers(maxEnergy) + EnumChatFormatting.RESET + " EU", + /* 3*/ StatCollector.translateToLocal("GT5U.multiblock.usage") + ": " + EnumChatFormatting.RED + + GT_Utility.formatNumbers(-mEUt) + EnumChatFormatting.RESET + " EU/t", + /* 4*/ StatCollector.translateToLocal("GT5U.multiblock.mei") + ": " + EnumChatFormatting.YELLOW + + GT_Utility.formatNumbers(getMaxInputVoltage()) + EnumChatFormatting.RESET + " EU/t(*2A) " + + StatCollector.translateToLocal("GT5U.machines.tier") + + ": " + EnumChatFormatting.YELLOW + + VN[GT_Utility.getTier(getMaxInputVoltage())] + EnumChatFormatting.RESET, + /* 5*/ StatCollector.translateToLocal("GT5U.multiblock.problems") + ": " + EnumChatFormatting.RED + + (getIdealStatus() - getRepairStatus()) + EnumChatFormatting.RESET + " " + + StatCollector.translateToLocal("GT5U.multiblock.efficiency") + + ": " + EnumChatFormatting.YELLOW + + Float.toString(mEfficiency / 100.0F) + EnumChatFormatting.RESET + " %", + /* 6*/ StatCollector.translateToLocal("GT5U.multiblock.pollution") + ": " + EnumChatFormatting.GREEN + + mPollutionReduction + EnumChatFormatting.RESET + " %" }; } @@ -1136,14 +1211,13 @@ public abstract class GT_MetaTileEntity_MultiBlockBase extends MetaTileEntity { return false; } - protected ItemStack[] getCompactedInputs(){ - //TODO: repalce method with a cleaner one + protected ItemStack[] getCompactedInputs() { + // TODO: repalce method with a cleaner one ArrayList<ItemStack> tInputList = getStoredInputs(); int tInputList_sS = tInputList.size(); for (int i = 0; i < tInputList_sS - 1; i++) { for (int j = i + 1; j < tInputList_sS; j++) { - if (!GT_Utility.areStacksEqual(tInputList.get(i), tInputList.get(j))) - continue; + if (!GT_Utility.areStacksEqual(tInputList.get(i), tInputList.get(j))) continue; if (tInputList.get(i).stackSize >= tInputList.get(j).stackSize) { tInputList.remove(j--); tInputList_sS = tInputList.size(); @@ -1157,14 +1231,13 @@ public abstract class GT_MetaTileEntity_MultiBlockBase extends MetaTileEntity { return tInputList.toArray(new ItemStack[0]); } - protected FluidStack[] getCompactedFluids(){ - //TODO: repalce method with a cleaner one + protected FluidStack[] getCompactedFluids() { + // TODO: repalce method with a cleaner one ArrayList<FluidStack> tFluidList = getStoredFluids(); int tFluidList_sS = tFluidList.size(); for (int i = 0; i < tFluidList_sS - 1; i++) { for (int j = i + 1; j < tFluidList_sS; j++) { - if (!GT_Utility.areFluidsEqual(tFluidList.get(i), tFluidList.get(j))) - continue; + if (!GT_Utility.areFluidsEqual(tFluidList.get(i), tFluidList.get(j))) continue; if (tFluidList.get(i).amount >= tFluidList.get(j).amount) { tFluidList.remove(j--); @@ -1180,31 +1253,32 @@ public abstract class GT_MetaTileEntity_MultiBlockBase extends MetaTileEntity { } @Override - public void getWailaBody(ItemStack itemStack, List<String> currentTip, IWailaDataAccessor accessor, IWailaConfigHandler config) { + public void getWailaBody( + ItemStack itemStack, List<String> currentTip, IWailaDataAccessor accessor, IWailaConfigHandler config) { final NBTTagCompound tag = accessor.getNBTData(); - if(tag.getBoolean("incompleteStructure")) { + if (tag.getBoolean("incompleteStructure")) { currentTip.add(RED + "** INCOMPLETE STRUCTURE **" + RESET); } currentTip.add((tag.getBoolean("hasProblems") ? (RED + "** HAS PROBLEMS **") : GREEN + "Running Fine") + RESET - + " Efficiency: " + tag.getFloat("efficiency") + "%"); - - currentTip.add(String.format("Progress: %d s / %d s", tag.getInteger("progress"), tag.getInteger("maxProgress"))); + + " Efficiency: " + tag.getFloat("efficiency") + "%"); + currentTip.add( + String.format("Progress: %d s / %d s", tag.getInteger("progress"), tag.getInteger("maxProgress"))); super.getWailaBody(itemStack, currentTip, accessor, config); } @Override - public void getWailaNBTData(EntityPlayerMP player, TileEntity tile, NBTTagCompound tag, World world, int x, int y, int z) { + public void getWailaNBTData( + EntityPlayerMP player, TileEntity tile, NBTTagCompound tag, World world, int x, int y, int z) { super.getWailaNBTData(player, tile, tag, world, x, y, z); tag.setBoolean("hasProblems", (getIdealStatus() - getRepairStatus()) > 0); tag.setFloat("efficiency", mEfficiency / 100.0F); - tag.setInteger("progress", mProgresstime/20); - tag.setInteger("maxProgress", mMaxProgresstime/20); + tag.setInteger("progress", mProgresstime / 20); + tag.setInteger("maxProgress", mMaxProgresstime / 20); tag.setBoolean("incompleteStructure", (getBaseMetaTileEntity().getErrorDisplayID() & 64) != 0); - } public List<GT_MetaTileEntity_Hatch> getExoticEnergyHatches() { 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 f5d43faffc..44d40e5a67 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 @@ -14,16 +14,19 @@ public abstract class GT_MetaTileEntity_SpecialFilter extends GT_MetaTileEntity_ public boolean bNBTAllowed = false; public boolean bInvertFilter = false; - public GT_MetaTileEntity_SpecialFilter(int aID, String aName, String aNameRegional, int aTier, String[] aDescription) { + public GT_MetaTileEntity_SpecialFilter( + int aID, String aName, String aNameRegional, int aTier, String[] aDescription) { // 9 buffer slot, 1 representation slot, 1 holo slot. last seems not needed... super(aID, aName, aNameRegional, aTier, 11, aDescription); } - public GT_MetaTileEntity_SpecialFilter(String aName, int aTier, int aInvSlotCount, String aDescription, ITexture[][][] aTextures) { + public GT_MetaTileEntity_SpecialFilter( + String aName, int aTier, int aInvSlotCount, String aDescription, ITexture[][][] aTextures) { super(aName, aTier, aInvSlotCount, aDescription, aTextures); } - public GT_MetaTileEntity_SpecialFilter(String aName, int aTier, int aInvSlotCount, String[] aDescription, ITexture[][][] aTextures) { + public GT_MetaTileEntity_SpecialFilter( + String aName, int aTier, int aInvSlotCount, String[] aDescription, ITexture[][][] aTextures) { super(aName, aTier, aInvSlotCount, aDescription, aTextures); } @@ -60,7 +63,9 @@ public abstract class GT_MetaTileEntity_SpecialFilter extends GT_MetaTileEntity_ @Override public boolean allowPutStack(IGregTechTileEntity aBaseMetaTileEntity, int aIndex, byte aSide, ItemStack aStack) { - return (super.allowPutStack(aBaseMetaTileEntity, aIndex, aSide, aStack)) && ((this.bNBTAllowed) || (!aStack.hasTagCompound())) && (this.isStackAllowed(aStack) != this.bInvertFilter); + return (super.allowPutStack(aBaseMetaTileEntity, aIndex, aSide, aStack)) + && ((this.bNBTAllowed) || (!aStack.hasTagCompound())) + && (this.isStackAllowed(aStack) != this.bInvertFilter); } protected abstract boolean isStackAllowed(ItemStack aStack); 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 fa040bf5cb..a4d6fc0e6b 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 @@ -1,11 +1,11 @@ package gregtech.api.metatileentity.implementations; +import static gregtech.api.enums.GT_Values.GT; + import gregtech.api.interfaces.ITexture; import gregtech.api.metatileentity.MetaTileEntity; import gregtech.common.tileentities.machines.multi.GT_MetaTileEntity_Cleanroom; -import static gregtech.api.enums.GT_Values.GT; - public abstract class GT_MetaTileEntity_TieredMachineBlock extends MetaTileEntity { /** * Value between [0 - 9] to describe the Tier of this Machine. @@ -26,17 +26,31 @@ public abstract class GT_MetaTileEntity_TieredMachineBlock extends MetaTileEntit */ public final ITexture[][][] mTextures; - public GT_MetaTileEntity_TieredMachineBlock(int aID, String aName, String aNameRegional, int aTier, int aInvSlotCount, String aDescription, ITexture... aTextures) { + public GT_MetaTileEntity_TieredMachineBlock( + int aID, + String aName, + String aNameRegional, + int aTier, + int aInvSlotCount, + String aDescription, + ITexture... aTextures) { super(aID, aName, aNameRegional, aInvSlotCount); mTier = (byte) Math.max(0, Math.min(aTier, 14)); - mDescriptionArray = aDescription == null ? new String[0] : new String[]{aDescription}; + mDescriptionArray = aDescription == null ? new String[0] : new String[] {aDescription}; mDescription = mDescriptionArray.length > 0 ? mDescriptionArray[0] : ""; // must always be the last call! if (GT.isClientSide()) mTextures = getTextureSet(aTextures); else mTextures = null; } - public GT_MetaTileEntity_TieredMachineBlock(int aID, String aName, String aNameRegional, int aTier, int aInvSlotCount, String[] aDescription, ITexture... aTextures) { + public GT_MetaTileEntity_TieredMachineBlock( + int aID, + String aName, + String aNameRegional, + int aTier, + int aInvSlotCount, + String[] aDescription, + ITexture... aTextures) { super(aID, aName, aNameRegional, aInvSlotCount); mTier = (byte) Math.max(0, Math.min(aTier, 15)); mDescriptionArray = aDescription == null ? new String[0] : aDescription; @@ -52,15 +66,17 @@ public abstract class GT_MetaTileEntity_TieredMachineBlock extends MetaTileEntit return GT_MetaTileEntity_Cleanroom.class; } - public GT_MetaTileEntity_TieredMachineBlock(String aName, int aTier, int aInvSlotCount, String aDescription, ITexture[][][] aTextures) { + public GT_MetaTileEntity_TieredMachineBlock( + String aName, int aTier, int aInvSlotCount, String aDescription, ITexture[][][] aTextures) { super(aName, aInvSlotCount); mTier = (byte) aTier; - mDescriptionArray = aDescription == null ? new String[0] : new String[]{aDescription}; + mDescriptionArray = aDescription == null ? new String[0] : new String[] {aDescription}; mDescription = mDescriptionArray.length > 0 ? mDescriptionArray[0] : ""; mTextures = aTextures; } - public GT_MetaTileEntity_TieredMachineBlock(String aName, int aTier, int aInvSlotCount, String[] aDescription, ITexture[][][] aTextures) { + public GT_MetaTileEntity_TieredMachineBlock( + String aName, int aTier, int aInvSlotCount, String[] aDescription, ITexture[][][] aTextures) { super(aName, aInvSlotCount); mTier = (byte) aTier; mDescriptionArray = aDescription == null ? new String[0] : aDescription; diff --git a/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_TooltipMultiBlockBase.java b/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_TooltipMultiBlockBase.java index f77875db02..e564c65d21 100644 --- a/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_TooltipMultiBlockBase.java +++ b/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_TooltipMultiBlockBase.java @@ -3,15 +3,16 @@ package gregtech.api.metatileentity.implementations; import gregtech.api.GregTech_API; import gregtech.api.interfaces.ISecondaryDescribable; import gregtech.api.util.GT_Multiblock_Tooltip_Builder; -import org.lwjgl.input.Keyboard; - import java.util.concurrent.atomic.AtomicReferenceArray; +import org.lwjgl.input.Keyboard; /** * A multiblock with tooltip {@link GT_Multiblock_Tooltip_Builder} */ -public abstract class GT_MetaTileEntity_TooltipMultiBlockBase extends GT_MetaTileEntity_MultiBlockBase implements ISecondaryDescribable { - private static final AtomicReferenceArray<GT_Multiblock_Tooltip_Builder> tooltips = new AtomicReferenceArray<>(GregTech_API.METATILEENTITIES.length); +public abstract class GT_MetaTileEntity_TooltipMultiBlockBase extends GT_MetaTileEntity_MultiBlockBase + implements ISecondaryDescribable { + private static final AtomicReferenceArray<GT_Multiblock_Tooltip_Builder> tooltips = + new AtomicReferenceArray<>(GregTech_API.METATILEENTITIES.length); public GT_MetaTileEntity_TooltipMultiBlockBase(int aID, String aName, String aNameRegional) { super(aID, aName, aNameRegional); 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 fdef48a86e..4bd5905ac5 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 @@ -1,5 +1,12 @@ package gregtech.api.metatileentity.implementations; +import static gregtech.api.enums.GT_Values.V; +import static mcp.mobius.waila.api.SpecialChars.BLUE; +import static mcp.mobius.waila.api.SpecialChars.GOLD; +import static mcp.mobius.waila.api.SpecialChars.GREEN; +import static mcp.mobius.waila.api.SpecialChars.RED; +import static mcp.mobius.waila.api.SpecialChars.RESET; + import cofh.api.energy.IEnergyProvider; import cofh.api.energy.IEnergyStorage; import crazypants.enderio.machine.capbank.TileCapBank; @@ -13,6 +20,7 @@ import gregtech.api.interfaces.ITexture; import gregtech.api.interfaces.metatileentity.IMetaTileEntity; import gregtech.api.interfaces.tileentity.IGregTechTileEntity; import gregtech.api.util.GT_Utility; +import java.util.List; import mcp.mobius.waila.api.IWailaConfigHandler; import mcp.mobius.waila.api.IWailaDataAccessor; import net.minecraft.entity.player.EntityPlayer; @@ -23,15 +31,6 @@ import net.minecraft.tileentity.TileEntity; import net.minecraft.world.World; import net.minecraftforge.common.util.ForgeDirection; -import java.util.List; - -import static gregtech.api.enums.GT_Values.V; -import static mcp.mobius.waila.api.SpecialChars.RESET; -import static mcp.mobius.waila.api.SpecialChars.GOLD; -import static mcp.mobius.waila.api.SpecialChars.BLUE; -import static mcp.mobius.waila.api.SpecialChars.GREEN; -import static mcp.mobius.waila.api.SpecialChars.RED; - /** * NEVER INCLUDE THIS FILE IN YOUR MOD!!! * <p/> @@ -55,25 +54,57 @@ public class GT_MetaTileEntity_Transformer extends GT_MetaTileEntity_TieredMachi public ITexture[][][] getTextureSet(ITexture[] aTextures) { ITexture[][][] rTextures = new ITexture[12][17][]; for (byte i = -1; i < 16; i++) { - rTextures[ 0][i + 1] = new ITexture[]{Textures.BlockIcons.MACHINE_CASINGS[mTier][i + 1], Textures.BlockIcons.OVERLAYS_ENERGY_OUT [mTier]}; - rTextures[ 1][i + 1] = new ITexture[]{Textures.BlockIcons.MACHINE_CASINGS[mTier][i + 1], Textures.BlockIcons.OVERLAYS_ENERGY_OUT [mTier]}; - rTextures[ 2][i + 1] = new ITexture[]{Textures.BlockIcons.MACHINE_CASINGS[mTier][i + 1], Textures.BlockIcons.OVERLAYS_ENERGY_OUT [mTier]}; - rTextures[ 3][i + 1] = new ITexture[]{Textures.BlockIcons.MACHINE_CASINGS[mTier][i + 1], Textures.BlockIcons.OVERLAYS_ENERGY_IN_MULTI [mTier]}; - rTextures[ 4][i + 1] = new ITexture[]{Textures.BlockIcons.MACHINE_CASINGS[mTier][i + 1], Textures.BlockIcons.OVERLAYS_ENERGY_IN_MULTI [mTier]}; - rTextures[ 5][i + 1] = new ITexture[]{Textures.BlockIcons.MACHINE_CASINGS[mTier][i + 1], Textures.BlockIcons.OVERLAYS_ENERGY_IN_MULTI [mTier]}; - rTextures[ 6][i + 1] = new ITexture[]{Textures.BlockIcons.MACHINE_CASINGS[mTier][i + 1], Textures.BlockIcons.OVERLAYS_ENERGY_IN [mTier]}; - rTextures[ 7][i + 1] = new ITexture[]{Textures.BlockIcons.MACHINE_CASINGS[mTier][i + 1], Textures.BlockIcons.OVERLAYS_ENERGY_IN [mTier]}; - rTextures[ 8][i + 1] = new ITexture[]{Textures.BlockIcons.MACHINE_CASINGS[mTier][i + 1], Textures.BlockIcons.OVERLAYS_ENERGY_IN [mTier]}; - rTextures[ 9][i + 1] = new ITexture[]{Textures.BlockIcons.MACHINE_CASINGS[mTier][i + 1], Textures.BlockIcons.OVERLAYS_ENERGY_OUT_MULTI[mTier]}; - rTextures[10][i + 1] = new ITexture[]{Textures.BlockIcons.MACHINE_CASINGS[mTier][i + 1], Textures.BlockIcons.OVERLAYS_ENERGY_OUT_MULTI[mTier]}; - rTextures[11][i + 1] = new ITexture[]{Textures.BlockIcons.MACHINE_CASINGS[mTier][i + 1], Textures.BlockIcons.OVERLAYS_ENERGY_OUT_MULTI[mTier]}; + rTextures[0][i + 1] = new ITexture[] { + Textures.BlockIcons.MACHINE_CASINGS[mTier][i + 1], Textures.BlockIcons.OVERLAYS_ENERGY_OUT[mTier] + }; + rTextures[1][i + 1] = new ITexture[] { + Textures.BlockIcons.MACHINE_CASINGS[mTier][i + 1], Textures.BlockIcons.OVERLAYS_ENERGY_OUT[mTier] + }; + rTextures[2][i + 1] = new ITexture[] { + Textures.BlockIcons.MACHINE_CASINGS[mTier][i + 1], Textures.BlockIcons.OVERLAYS_ENERGY_OUT[mTier] + }; + rTextures[3][i + 1] = new ITexture[] { + Textures.BlockIcons.MACHINE_CASINGS[mTier][i + 1], Textures.BlockIcons.OVERLAYS_ENERGY_IN_MULTI[mTier] + }; + rTextures[4][i + 1] = new ITexture[] { + Textures.BlockIcons.MACHINE_CASINGS[mTier][i + 1], Textures.BlockIcons.OVERLAYS_ENERGY_IN_MULTI[mTier] + }; + rTextures[5][i + 1] = new ITexture[] { + Textures.BlockIcons.MACHINE_CASINGS[mTier][i + 1], Textures.BlockIcons.OVERLAYS_ENERGY_IN_MULTI[mTier] + }; + rTextures[6][i + 1] = new ITexture[] { + Textures.BlockIcons.MACHINE_CASINGS[mTier][i + 1], Textures.BlockIcons.OVERLAYS_ENERGY_IN[mTier] + }; + rTextures[7][i + 1] = new ITexture[] { + Textures.BlockIcons.MACHINE_CASINGS[mTier][i + 1], Textures.BlockIcons.OVERLAYS_ENERGY_IN[mTier] + }; + rTextures[8][i + 1] = new ITexture[] { + Textures.BlockIcons.MACHINE_CASINGS[mTier][i + 1], Textures.BlockIcons.OVERLAYS_ENERGY_IN[mTier] + }; + rTextures[9][i + 1] = new ITexture[] { + Textures.BlockIcons.MACHINE_CASINGS[mTier][i + 1], Textures.BlockIcons.OVERLAYS_ENERGY_OUT_MULTI[mTier] + }; + rTextures[10][i + 1] = new ITexture[] { + Textures.BlockIcons.MACHINE_CASINGS[mTier][i + 1], Textures.BlockIcons.OVERLAYS_ENERGY_OUT_MULTI[mTier] + }; + rTextures[11][i + 1] = new ITexture[] { + Textures.BlockIcons.MACHINE_CASINGS[mTier][i + 1], Textures.BlockIcons.OVERLAYS_ENERGY_OUT_MULTI[mTier] + }; } return rTextures; } @Override - public ITexture[] getTexture(IGregTechTileEntity aBaseMetaTileEntity, byte aSide, byte aFacing, byte aColorIndex, boolean aActive, boolean aRedstone) { - return mTextures[Math.min(2, aSide) + (aSide == aFacing ? 3 : 0) + (aBaseMetaTileEntity.isAllowedToWork() ? 0 : 6)][aColorIndex + 1]; + public ITexture[] getTexture( + IGregTechTileEntity aBaseMetaTileEntity, + byte aSide, + byte aFacing, + byte aColorIndex, + boolean aActive, + boolean aRedstone) { + return mTextures[ + Math.min(2, aSide) + (aSide == aFacing ? 3 : 0) + (aBaseMetaTileEntity.isAllowedToWork() ? 0 : 6)][ + aColorIndex + 1]; } @Override @@ -108,7 +139,9 @@ public class GT_MetaTileEntity_Transformer extends GT_MetaTileEntity_TieredMachi @Override public boolean isInputFacing(byte aSide) { - return getBaseMetaTileEntity().isAllowedToWork() ? aSide == getBaseMetaTileEntity().getFrontFacing() : aSide != getBaseMetaTileEntity().getFrontFacing(); + return getBaseMetaTileEntity().isAllowedToWork() + ? aSide == getBaseMetaTileEntity().getFrontFacing() + : aSide != getBaseMetaTileEntity().getFrontFacing(); } @Override @@ -158,22 +191,42 @@ 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) { - long tEU = (long) ((IEnergyProvider) tTileEntity).extractEnergy(ForgeDirection.getOrientation(GT_Utility.getOppositeSide(i)), GT_Utility.safeInt(maxEUInput() * 100L / GregTech_API.mRFtoEU), false); + 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), + false); tEU = tEU * GregTech_API.mRFtoEU / 100; aBaseMetaTileEntity.injectEnergyUnits((byte) 6, Math.min(tEU, maxEUInput()), 1); - } else if (tTileEntity instanceof IEnergyStorage && ((IEnergyStorage) tTileEntity).extractEnergy(1, true) == 1) { - long tEU = (long) ((IEnergyStorage) tTileEntity).extractEnergy(GT_Utility.safeInt(maxEUInput() * 100L / GregTech_API.mRFtoEU), false); + } else if (tTileEntity instanceof IEnergyStorage + && ((IEnergyStorage) tTileEntity).extractEnergy(1, true) == 1) { + long tEU = (long) ((IEnergyStorage) tTileEntity) + .extractEnergy(GT_Utility.safeInt(maxEUInput() * 100L / GregTech_API.mRFtoEU), false); tEU = tEU * GregTech_API.mRFtoEU / 100; aBaseMetaTileEntity.injectEnergyUnits((byte) 6, Math.min(tEU, maxEUInput()), 1); - } else if (GregTech_API.meIOLoaded && tTileEntity instanceof IPowerContainer && ((IPowerContainer) tTileEntity).getEnergyStored() > 0) { + } else if (GregTech_API.meIOLoaded + && tTileEntity instanceof IPowerContainer + && ((IPowerContainer) tTileEntity).getEnergyStored() > 0) { int storedRF = ((IPowerContainer) tTileEntity).getEnergyStored(); - int extractRF = GT_Utility.safeInt(maxEUInput() * 100L / GregTech_API.mRFtoEU); + int extractRF = GT_Utility.safeInt(maxEUInput() * 100L / GregTech_API.mRFtoEU); long tEU = 0; if (tTileEntity instanceof TileCapBank) { ICapBankNetwork network = ((TileCapBank) tTileEntity).getNetwork(); if (network != null && network.getEnergyStoredL() > 0) { - tEU = Math.min((Math.min(Math.min(network.getEnergyStoredL(), storedRF - extractRF), network.getMaxOutput())) * (long)GregTech_API.mRFtoEU / 100L, maxEUInput()); + tEU = Math.min( + (Math.min( + Math.min(network.getEnergyStoredL(), storedRF - extractRF), + network.getMaxOutput())) + * (long) GregTech_API.mRFtoEU + / 100L, + maxEUInput()); network.addEnergy(GT_Utility.safeInt(-(tEU * 100 / GregTech_API.mRFtoEU))); } } else { @@ -182,7 +235,7 @@ public class GT_MetaTileEntity_Transformer extends GT_MetaTileEntity_TieredMachi tEU = maxEUInput(); } else { ((IPowerContainer) tTileEntity).setEnergyStored(0); - tEU = storedRF * (long)GregTech_API.mRFtoEU / 100L; + tEU = storedRF * (long) GregTech_API.mRFtoEU / 100L; } } aBaseMetaTileEntity.injectEnergyUnits((byte) 6, Math.min(tEU, maxEUInput()), 1); @@ -212,22 +265,23 @@ public class GT_MetaTileEntity_Transformer extends GT_MetaTileEntity_TieredMachi } @Override - public boolean hasAlternativeModeText(){ - return true; + public boolean hasAlternativeModeText() { + return true; } @Override - public String getAlternativeModeText(){ - return - (getBaseMetaTileEntity().isAllowedToWork() ? GT_Utility.trans("145","Step Down, In: ") : GT_Utility.trans("146","Step Up, In: ")) + - maxEUInput() + - GT_Utility.trans("148","V ") + - maxAmperesIn() + - GT_Utility.trans("147","A, Out: ") + - maxEUOutput() + - GT_Utility.trans("148","V ") + - maxAmperesOut() + - GT_Utility.trans("149","A"); + public String getAlternativeModeText() { + return (getBaseMetaTileEntity().isAllowedToWork() + ? GT_Utility.trans("145", "Step Down, In: ") + : GT_Utility.trans("146", "Step Up, In: ")) + + maxEUInput() + + GT_Utility.trans("148", "V ") + + maxAmperesIn() + + GT_Utility.trans("147", "A, Out: ") + + maxEUOutput() + + GT_Utility.trans("148", "V ") + + maxAmperesOut() + + GT_Utility.trans("149", "A"); } @Override @@ -236,58 +290,50 @@ public class GT_MetaTileEntity_Transformer extends GT_MetaTileEntity_TieredMachi } @Override - public void getWailaBody(ItemStack itemStack, List<String> currenttip, IWailaDataAccessor accessor, IWailaConfigHandler config) { + public void getWailaBody( + ItemStack itemStack, List<String> currenttip, IWailaDataAccessor accessor, IWailaConfigHandler config) { 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")); final byte outputTier = GT_Utility.getTier(tag.getLong("maxEUOutput")); - currenttip.add( - String.format( + currenttip.add(String.format( "%s %s(%dA) -> %s(%dA)", (allowedToWork ? (GREEN + "Step Down") : (RED + "Step Up")) + RESET, GT_Mod.gregtechproxy.mWailaTransformerVoltageTier - ? GT_Values.TIER_COLORS[inputTier] + GT_Values.VN[inputTier] + RESET - : tag.getLong("maxEUInput"), + ? GT_Values.TIER_COLORS[inputTier] + GT_Values.VN[inputTier] + RESET + : tag.getLong("maxEUInput"), tag.getLong("maxAmperesIn"), GT_Mod.gregtechproxy.mWailaTransformerVoltageTier - ? GT_Values.TIER_COLORS[outputTier] + GT_Values.VN[outputTier] + RESET - : tag.getLong("maxEUOutput"), - tag.getLong("maxAmperesOut") - ) - ); + ? GT_Values.TIER_COLORS[outputTier] + GT_Values.VN[outputTier] + RESET + : tag.getLong("maxEUOutput"), + tag.getLong("maxAmperesOut"))); if ((side == facing && allowedToWork) || (side != facing && !allowedToWork)) { - currenttip.add( - String.format( + currenttip.add(String.format( GOLD + "Input:" + RESET + " %s(%dA)", GT_Mod.gregtechproxy.mWailaTransformerVoltageTier - ? GT_Values.TIER_COLORS[inputTier] + GT_Values.VN[inputTier] + RESET - : tag.getLong("maxEUInput"), - tag.getLong("maxAmperesIn") - ) - ); + ? GT_Values.TIER_COLORS[inputTier] + GT_Values.VN[inputTier] + RESET + : tag.getLong("maxEUInput"), + tag.getLong("maxAmperesIn"))); } else { - currenttip.add( - String.format( + currenttip.add(String.format( BLUE + "Output:" + RESET + " %s(%dA)", GT_Mod.gregtechproxy.mWailaTransformerVoltageTier - ? GT_Values.TIER_COLORS[outputTier] + GT_Values.VN[outputTier] + RESET - : tag.getLong("maxEUOutput"), - tag.getLong("maxAmperesOut") - ) - ); + ? GT_Values.TIER_COLORS[outputTier] + GT_Values.VN[outputTier] + RESET + : tag.getLong("maxEUOutput"), + tag.getLong("maxAmperesOut"))); } super.getWailaBody(itemStack, currenttip, accessor, config); - } @Override - public void getWailaNBTData(EntityPlayerMP player, TileEntity tile, NBTTagCompound tag, World world, int x, int y, int z) { + public void getWailaNBTData( + EntityPlayerMP player, TileEntity tile, NBTTagCompound tag, World world, int x, int y, int z) { super.getWailaNBTData(player, tile, tag, world, x, y, z); tag.setBoolean("isAllowedToWork", getBaseMetaTileEntity().isAllowedToWork()); tag.setLong("maxEUInput", maxEUInput()); @@ -295,6 +341,4 @@ public class GT_MetaTileEntity_Transformer extends GT_MetaTileEntity_TieredMachi tag.setLong("maxEUOutput", maxEUOutput()); tag.setLong("maxAmperesOut", maxAmperesOut()); } - - } 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 bfc9b2118e..3fd496e960 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 @@ -1,25 +1,25 @@ package gregtech.api.metatileentity.implementations; +import static gregtech.api.enums.GT_Values.*; + import gregtech.api.enums.Textures; import gregtech.api.interfaces.IGlobalWirelessEnergy; import gregtech.api.interfaces.ITexture; import gregtech.api.interfaces.tileentity.IGregTechTileEntity; import gregtech.api.interfaces.tileentity.IWirelessEnergyHatchInformation; import gregtech.api.metatileentity.MetaTileEntity; -import gregtech.api.util.GT_Utility; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.ItemStack; import net.minecraft.util.EnumChatFormatting; -import static gregtech.GT_Mod.gregtechproxy; -import static gregtech.api.enums.GT_Values.*; - -public class GT_MetaTileEntity_Wireless_Dynamo extends GT_MetaTileEntity_Hatch_Dynamo implements IGlobalWirelessEnergy, IWirelessEnergyHatchInformation { +public class GT_MetaTileEntity_Wireless_Dynamo extends GT_MetaTileEntity_Hatch_Dynamo + implements IGlobalWirelessEnergy, IWirelessEnergyHatchInformation { private String owner_uuid; private String owner_name; - public GT_MetaTileEntity_Wireless_Dynamo(String aName, byte aTier, String[] aDescription, ITexture[][][] aTextures) { + public GT_MetaTileEntity_Wireless_Dynamo( + String aName, byte aTier, String[] aDescription, ITexture[][][] aTextures) { super(aName, aTier, aDescription, aTextures); } @@ -29,12 +29,12 @@ public class GT_MetaTileEntity_Wireless_Dynamo extends GT_MetaTileEntity_Hatch_D @Override public ITexture[] getTexturesActive(ITexture aBaseTexture) { - return new ITexture[]{aBaseTexture, Textures.BlockIcons.OVERLAYS_ENERGY_IN_MULTI_WIRELESS_ON[mTier]}; + return new ITexture[] {aBaseTexture, Textures.BlockIcons.OVERLAYS_ENERGY_IN_MULTI_WIRELESS_ON[mTier]}; } @Override public ITexture[] getTexturesInactive(ITexture aBaseTexture) { - return new ITexture[]{aBaseTexture, Textures.BlockIcons.OVERLAYS_ENERGY_IN_MULTI_WIRELESS_ON[mTier]}; + return new ITexture[] {aBaseTexture, Textures.BlockIcons.OVERLAYS_ENERGY_IN_MULTI_WIRELESS_ON[mTier]}; } @Override @@ -125,11 +125,9 @@ public class GT_MetaTileEntity_Wireless_Dynamo extends GT_MetaTileEntity_Hatch_D owner_name = aBaseMetaTileEntity.getOwnerName(); // Attempt to load in map from file. - if (GlobalEnergy.size() == 0) - loadGlobalEnergyInfo(aBaseMetaTileEntity.getWorld()); + if (GlobalEnergy.size() == 0) loadGlobalEnergyInfo(aBaseMetaTileEntity.getWorld()); strongCheckOrAddUser(owner_uuid, owner_name); - } // Every ticks_between_energy_addition ticks change the energy content of the machine. @@ -140,4 +138,3 @@ public class GT_MetaTileEntity_Wireless_Dynamo extends GT_MetaTileEntity_Hatch_D } } } - 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 035147ca0b..baffde6f3f 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 @@ -1,24 +1,23 @@ package gregtech.api.metatileentity.implementations; +import static gregtech.api.enums.GT_Values.*; + import gregtech.api.enums.Textures; import gregtech.api.interfaces.IGlobalWirelessEnergy; import gregtech.api.interfaces.ITexture; import gregtech.api.interfaces.tileentity.IGregTechTileEntity; import gregtech.api.interfaces.tileentity.IWirelessEnergyHatchInformation; import gregtech.api.metatileentity.MetaTileEntity; -import gregtech.api.util.GT_Utility; +import java.math.BigInteger; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.ItemStack; import net.minecraft.util.EnumChatFormatting; -import java.math.BigInteger; - -import static gregtech.GT_Mod.gregtechproxy; -import static gregtech.api.enums.GT_Values.*; - -public class GT_MetaTileEntity_Wireless_Hatch extends GT_MetaTileEntity_Hatch_Energy implements IGlobalWirelessEnergy, IWirelessEnergyHatchInformation { +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; @@ -43,12 +42,12 @@ public class GT_MetaTileEntity_Wireless_Hatch extends GT_MetaTileEntity_Hatch_En @Override public ITexture[] getTexturesActive(ITexture aBaseTexture) { - return new ITexture[]{aBaseTexture, Textures.BlockIcons.OVERLAYS_ENERGY_IN_MULTI_WIRELESS_ON[mTier]}; + return new ITexture[] {aBaseTexture, Textures.BlockIcons.OVERLAYS_ENERGY_IN_MULTI_WIRELESS_ON[mTier]}; } @Override public ITexture[] getTexturesInactive(ITexture aBaseTexture) { - return new ITexture[]{aBaseTexture, Textures.BlockIcons.OVERLAYS_ENERGY_IN_MULTI_WIRELESS_ON[mTier]}; + return new ITexture[] {aBaseTexture, Textures.BlockIcons.OVERLAYS_ENERGY_IN_MULTI_WIRELESS_ON[mTier]}; } @Override @@ -131,8 +130,7 @@ public class GT_MetaTileEntity_Wireless_Hatch extends GT_MetaTileEntity_Hatch_En owner_name = aBaseMetaTileEntity.getOwnerName(); // Attempt to load in map from file. - if (GlobalEnergy.size() == 0) - loadGlobalEnergyInfo(aBaseMetaTileEntity.getWorld()); + if (GlobalEnergy.size() == 0) loadGlobalEnergyInfo(aBaseMetaTileEntity.getWorld()); strongCheckOrAddUser(owner_uuid, owner_name); @@ -140,7 +138,8 @@ public class GT_MetaTileEntity_Wireless_Hatch extends GT_MetaTileEntity_Hatch_En setEUVar(eu_transferred_per_operation_long); } - // This is set up in a way to be as optimised as possible. If a user has a relatively plentiful energy network + // This is set up in a way to be as optimised as possible. If a user has a relatively plentiful energy + // network // it should make no difference to them. Minimising the number of operations on BigInteger is essential. // Every ticks_between_energy_addition add eu_transferred_per_operation to internal EU storage from network. diff --git a/src/main/java/gregtech/api/multitileentity/MultiTileEntityBlock.java b/src/main/java/gregtech/api/multitileentity/MultiTileEntityBlock.java index 7129fd0aab..876fa50f0b 100644 --- a/src/main/java/gregtech/api/multitileentity/MultiTileEntityBlock.java +++ b/src/main/java/gregtech/api/multitileentity/MultiTileEntityBlock.java @@ -1,5 +1,12 @@ package gregtech.api.multitileentity; +import static gregtech.api.enums.GT_Values.OFFX; +import static gregtech.api.enums.GT_Values.OFFY; +import static gregtech.api.enums.GT_Values.OFFZ; +import static gregtech.api.util.GT_Util.LAST_BROKEN_TILEENTITY; +import static gregtech.api.util.GT_Util.getTileEntity; +import static gregtech.api.util.GT_Util.setTileEntity; + import com.cricketcraft.chisel.api.IFacade; import cpw.mods.fml.common.registry.GameRegistry; import cpw.mods.fml.relauncher.Side; @@ -30,6 +37,11 @@ import gregtech.api.util.GT_Util; import gregtech.api.util.GT_Utility; import gregtech.common.render.GT_Renderer_Block; import gregtech.common.render.IRenderedBlock; +import java.util.ArrayList; +import java.util.Collections; +import java.util.HashMap; +import java.util.List; +import java.util.Map; import net.minecraft.block.Block; import net.minecraft.block.ITileEntityProvider; import net.minecraft.block.material.Material; @@ -55,23 +67,11 @@ import net.minecraft.world.World; import net.minecraftforge.common.util.ForgeDirection; import net.minecraftforge.event.ForgeEventFactory; -import java.util.ArrayList; -import java.util.Collections; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -import static gregtech.api.enums.GT_Values.OFFX; -import static gregtech.api.enums.GT_Values.OFFY; -import static gregtech.api.enums.GT_Values.OFFZ; -import static gregtech.api.util.GT_Util.LAST_BROKEN_TILEENTITY; -import static gregtech.api.util.GT_Util.getTileEntity; -import static gregtech.api.util.GT_Util.setTileEntity; - /* * MultiTileEntityBlock ported from GT6 */ -public class MultiTileEntityBlock extends Block implements IDebugableBlock, ITileEntityProvider, IRenderedBlock, IFacade { +public class MultiTileEntityBlock extends Block + implements IDebugableBlock, ITileEntityProvider, IRenderedBlock, IFacade { protected static final Map<String, MultiTileEntityBlock> MULTI_BLOCK_MAP = new HashMap<>(); private static boolean LOCK = false; @@ -79,9 +79,18 @@ public class MultiTileEntityBlock extends Block implements IDebugableBlock, ITil protected final int mHarvestLevelOffset, mHarvestLevelMinimum, mHarvestLevelMaximum; protected final boolean mOpaque, mNormalCube; - public static String getName(String aMaterialName, SoundType aSoundType, String aTool, int aHarvestLevelOffset, int aHarvestLevelMinimum, int aHarvestLevelMaximum, boolean aOpaque, boolean aNormalCube) { - return "gt.block.multiblock." + aMaterialName + "." + aSoundType.soundName + "." + aTool + "." + aHarvestLevelOffset + "." + aHarvestLevelMinimum + "." + aHarvestLevelMaximum + "." + aOpaque + "." + aNormalCube; - + public static String getName( + String aMaterialName, + SoundType aSoundType, + String aTool, + int aHarvestLevelOffset, + int aHarvestLevelMinimum, + int aHarvestLevelMaximum, + boolean aOpaque, + boolean aNormalCube) { + return "gt.block.multiblock." + aMaterialName + "." + aSoundType.soundName + "." + aTool + "." + + aHarvestLevelOffset + "." + aHarvestLevelMinimum + "." + aHarvestLevelMaximum + "." + aOpaque + "." + + aNormalCube; } /** * @param aMaterialName the Name of the vanilla Material Field. In case this is not a vanilla Material, insert the Name you want to give your own Material instead. @@ -95,17 +104,65 @@ public class MultiTileEntityBlock extends Block implements IDebugableBlock, ITil * @param aNormalCube if this Block is a normal Cube (for Redstone Stuff). */ public static MultiTileEntityBlock getOrCreate( - String aModID, String aMaterialName, Material aMaterial, SoundType aSoundType, String aTool, int aHarvestLevelOffset, int aHarvestLevelMinimum, - int aHarvestLevelMaximum, boolean aOpaque, boolean aNormalCube - ) { - final MultiTileEntityBlock rBlock = MULTI_BLOCK_MAP.get(aModID + ":" + getName(aMaterialName, aSoundType, aTool = aTool.toLowerCase(), aHarvestLevelOffset, aHarvestLevelMinimum, aHarvestLevelMaximum, aOpaque, aNormalCube)); - return rBlock == null ? new MultiTileEntityBlock(aModID, aMaterialName, aMaterial, aSoundType, aTool, aHarvestLevelOffset, aHarvestLevelMinimum, aHarvestLevelMaximum, aOpaque, aNormalCube) : rBlock; - } - protected MultiTileEntityBlock(String aModID, String aMaterialName, Material aMaterial, SoundType aSoundType, String aTool, int aHarvestLevelOffset, int aHarvestLevelMinimum, int aHarvestLevelMaximum, boolean aOpaque, boolean aNormalCube) { + String aModID, + String aMaterialName, + Material aMaterial, + SoundType aSoundType, + String aTool, + int aHarvestLevelOffset, + int aHarvestLevelMinimum, + int aHarvestLevelMaximum, + boolean aOpaque, + boolean aNormalCube) { + final MultiTileEntityBlock rBlock = MULTI_BLOCK_MAP.get(aModID + ":" + + getName( + aMaterialName, + aSoundType, + aTool = aTool.toLowerCase(), + aHarvestLevelOffset, + aHarvestLevelMinimum, + aHarvestLevelMaximum, + aOpaque, + aNormalCube)); + return rBlock == null + ? new MultiTileEntityBlock( + aModID, + aMaterialName, + aMaterial, + aSoundType, + aTool, + aHarvestLevelOffset, + aHarvestLevelMinimum, + aHarvestLevelMaximum, + aOpaque, + aNormalCube) + : rBlock; + } + + protected MultiTileEntityBlock( + String aModID, + String aMaterialName, + Material aMaterial, + SoundType aSoundType, + String aTool, + int aHarvestLevelOffset, + int aHarvestLevelMinimum, + int aHarvestLevelMaximum, + boolean aOpaque, + boolean aNormalCube) { super(aMaterial); - if(GregTech_API.sPreloadFinished) throw new IllegalStateException("Blocks can only be initialized within preInit!"); - - mNameInternal = getName(aMaterialName, aSoundType, aTool, aHarvestLevelOffset, aHarvestLevelMinimum, aHarvestLevelMaximum, aOpaque, aNormalCube); + if (GregTech_API.sPreloadFinished) + throw new IllegalStateException("Blocks can only be initialized within preInit!"); + + mNameInternal = getName( + aMaterialName, + aSoundType, + aTool, + aHarvestLevelOffset, + aHarvestLevelMinimum, + aHarvestLevelMaximum, + aOpaque, + aNormalCube); GameRegistry.registerBlock(this, ItemBlock.class, mNameInternal); MULTI_BLOCK_MAP.put(aModID + ":" + mNameInternal, this); @@ -121,16 +178,17 @@ public class MultiTileEntityBlock extends Block implements IDebugableBlock, ITil opaque = isOpaqueCube(); lightOpacity = isOpaqueCube() ? 255 : 0; - } @Override public final void breakBlock(World aWorld, int aX, int aY, int aZ, Block aBlock, int aMetaData) { final TileEntity aTileEntity = getTileEntity(aWorld, aX, aY, aZ, true); if (aTileEntity != null) LAST_BROKEN_TILEENTITY.set(aTileEntity); - if (aTileEntity == null || !aTileEntity.shouldRefresh(this, aBlock, aMetaData, aMetaData, aWorld, aX, aY, aZ)) return; - if (aTileEntity instanceof IMTE_BreakBlock && ((IMTE_BreakBlock)aTileEntity).breakBlock()) return; - if (aTileEntity instanceof IMTE_HasMultiBlockMachineRelevantData && ((IMTE_HasMultiBlockMachineRelevantData)aTileEntity).hasMultiBlockMachineRelevantData()) + if (aTileEntity == null || !aTileEntity.shouldRefresh(this, aBlock, aMetaData, aMetaData, aWorld, aX, aY, aZ)) + return; + if (aTileEntity instanceof IMTE_BreakBlock && ((IMTE_BreakBlock) aTileEntity).breakBlock()) return; + if (aTileEntity instanceof IMTE_HasMultiBlockMachineRelevantData + && ((IMTE_HasMultiBlockMachineRelevantData) aTileEntity).hasMultiBlockMachineRelevantData()) GregTech_API.causeMachineUpdate(aWorld, aX, aY, aZ); aWorld.removeTileEntity(aX, aY, aZ); @@ -146,7 +204,7 @@ public class MultiTileEntityBlock extends Block implements IDebugableBlock, ITil } @Override - public final boolean func_149730_j/*isFullBlock*/() { + public final boolean func_149730_j /*isFullBlock*/() { return mOpaque; } @@ -168,7 +226,9 @@ public class MultiTileEntityBlock extends Block implements IDebugableBlock, ITil @Override public final float getBlockHardness(World aWorld, int aX, int aY, int aZ) { final TileEntity aTileEntity = aWorld.getTileEntity(aX, aY, aZ); - return aTileEntity instanceof IMTE_GetBlockHardness ? ((IMTE_GetBlockHardness) aTileEntity).getBlockHardness() : 1.0F; + return aTileEntity instanceof IMTE_GetBlockHardness + ? ((IMTE_GetBlockHardness) aTileEntity).getBlockHardness() + : 1.0F; } @SideOnly(Side.CLIENT) @@ -185,31 +245,35 @@ public class MultiTileEntityBlock extends Block implements IDebugableBlock, ITil @Override @SuppressWarnings("unchecked") - public final void addCollisionBoxesToList(World aWorld, int aX, int aY, int aZ, AxisAlignedBB aAABB, List aList, Entity aEntity) { + public final void addCollisionBoxesToList( + World aWorld, int aX, int aY, int aZ, AxisAlignedBB aAABB, List aList, Entity aEntity) { final TileEntity aTileEntity = aWorld.getTileEntity(aX, aY, aZ); - if (aTileEntity instanceof IMultiTileEntity) ((IMultiTileEntity) aTileEntity).addCollisionBoxesToList(aAABB, aList, aEntity); + if (aTileEntity instanceof IMultiTileEntity) + ((IMultiTileEntity) aTileEntity).addCollisionBoxesToList(aAABB, aList, aEntity); else super.addCollisionBoxesToList(aWorld, aX, aY, aZ, aAABB, aList, aEntity); } @Override public final AxisAlignedBB getCollisionBoundingBoxFromPool(World aWorld, int aX, int aY, int aZ) { final TileEntity aTileEntity = aWorld.getTileEntity(aX, aY, aZ); - return aTileEntity instanceof IMultiTileEntity ? ((IMultiTileEntity) aTileEntity).getCollisionBoundingBoxFromPool() - : aTileEntity == null ? null : super.getCollisionBoundingBoxFromPool(aWorld, aX, aY, aZ); + return aTileEntity instanceof IMultiTileEntity + ? ((IMultiTileEntity) aTileEntity).getCollisionBoundingBoxFromPool() + : aTileEntity == null ? null : super.getCollisionBoundingBoxFromPool(aWorld, aX, aY, aZ); } @Override public final AxisAlignedBB getSelectedBoundingBoxFromPool(World aWorld, int aX, int aY, int aZ) { final TileEntity aTileEntity = aWorld.getTileEntity(aX, aY, aZ); - return aTileEntity instanceof IMultiTileEntity ? ((IMultiTileEntity) aTileEntity).getSelectedBoundingBoxFromPool() - : super.getSelectedBoundingBoxFromPool(aWorld, aX, aY, aZ); + return aTileEntity instanceof IMultiTileEntity + ? ((IMultiTileEntity) aTileEntity).getSelectedBoundingBoxFromPool() + : super.getSelectedBoundingBoxFromPool(aWorld, aX, aY, aZ); } @Override public void setBlockBoundsBasedOnState(IBlockAccess blockAccess, int aX, int aY, int aZ) { final TileEntity aTileEntity = blockAccess.getTileEntity(aX, aY, aZ); if (aTileEntity instanceof IMultiTileEntity) { - ((IMultiTileEntity)aTileEntity).setBlockBoundsBasedOnState(this); + ((IMultiTileEntity) aTileEntity).setBlockBoundsBasedOnState(this); return; } super.setBlockBoundsBasedOnState(blockAccess, aX, aY, aZ); @@ -221,11 +285,13 @@ public class MultiTileEntityBlock extends Block implements IDebugableBlock, ITil } @Override - public final void onNeighborChange(IBlockAccess aWorld, int aX, int aY, int aZ, int aTileX, int aTileY, int aTileZ) { + public final void onNeighborChange( + IBlockAccess aWorld, int aX, int aY, int aZ, int aTileX, int aTileY, int aTileZ) { final TileEntity aTileEntity = aWorld.getTileEntity(aX, aY, aZ); if (!LOCK) { LOCK = true; - if (aTileEntity instanceof BaseTileEntity) ((BaseTileEntity) aTileEntity).onAdjacentBlockChange(aTileX, aTileY, aTileZ); + if (aTileEntity instanceof BaseTileEntity) + ((BaseTileEntity) aTileEntity).onAdjacentBlockChange(aTileX, aTileY, aTileZ); LOCK = false; } } @@ -238,7 +304,8 @@ public class MultiTileEntityBlock extends Block implements IDebugableBlock, ITil if (aTileEntity instanceof BaseTileEntity) ((BaseTileEntity) aTileEntity).onAdjacentBlockChange(aX, aY, aZ); LOCK = false; } - if (aTileEntity instanceof IMTE_OnNeighborBlockChange) ((IMTE_OnNeighborBlockChange) aTileEntity).onNeighborBlockChange(aWorld, aBlock); + if (aTileEntity instanceof IMTE_OnNeighborBlockChange) + ((IMTE_OnNeighborBlockChange) aTileEntity).onNeighborBlockChange(aWorld, aBlock); if (aTileEntity == null) aWorld.setBlockToAir(aX, aY, aZ); } @@ -251,8 +318,11 @@ public class MultiTileEntityBlock extends Block implements IDebugableBlock, ITil @Override public float getPlayerRelativeBlockHardness(EntityPlayer aPlayer, World aWorld, int aX, int aY, int aZ) { final TileEntity aTileEntity = aWorld.getTileEntity(aX, aY, aZ); - return aTileEntity instanceof IMultiTileEntity && ((IMultiTileEntity) aTileEntity).privateAccess() && !((IMultiTileEntity) aTileEntity).playerOwnsThis(aPlayer, true) ? -1.0F - : super.getPlayerRelativeBlockHardness(aPlayer, aWorld, aX, aY, aZ); + return aTileEntity instanceof IMultiTileEntity + && ((IMultiTileEntity) aTileEntity).privateAccess() + && !((IMultiTileEntity) aTileEntity).playerOwnsThis(aPlayer, true) + ? -1.0F + : super.getPlayerRelativeBlockHardness(aPlayer, aWorld, aX, aY, aZ); } @Override @@ -263,42 +333,54 @@ public class MultiTileEntityBlock extends Block implements IDebugableBlock, ITil } @Override - public boolean onBlockActivated(World aWorld, int aX, int aY, int aZ, EntityPlayer aPlayer, int aSide, float aHitX, float aHitY, float aHitZ) { + public boolean onBlockActivated( + World aWorld, + int aX, + int aY, + int aZ, + EntityPlayer aPlayer, + int aSide, + float aHitX, + float aHitY, + float aHitZ) { final TileEntity aTileEntity = aWorld.getTileEntity(aX, aY, aZ); if (aPlayer != null && ItemList.TC_Thaumometer.isStackEqual(aPlayer.getHeldItem(), true, true)) return false; - return aTileEntity instanceof IMultiTileEntity && ((IMultiTileEntity) aTileEntity).onBlockActivated(aPlayer, (byte)aSide, aHitX, aHitY, aHitZ); + return aTileEntity instanceof IMultiTileEntity + && ((IMultiTileEntity) aTileEntity).onBlockActivated(aPlayer, (byte) aSide, aHitX, aHitY, aHitZ); } @Override public final int isProvidingWeakPower(IBlockAccess aWorld, int aX, int aY, int aZ, int aSide) { final TileEntity aTileEntity = aWorld.getTileEntity(aX, aY, aZ); - return aTileEntity instanceof IMTE_IsProvidingWeakPower ? ((IMTE_IsProvidingWeakPower) aTileEntity).isProvidingWeakPower((byte)aSide) : - super.isProvidingWeakPower(aWorld, aX, aY, aZ, aSide); + return aTileEntity instanceof IMTE_IsProvidingWeakPower + ? ((IMTE_IsProvidingWeakPower) aTileEntity).isProvidingWeakPower((byte) aSide) + : super.isProvidingWeakPower(aWorld, aX, aY, aZ, aSide); } @Override public final int isProvidingStrongPower(IBlockAccess aWorld, int aX, int aY, int aZ, int aSide) { final TileEntity aTileEntity = aWorld.getTileEntity(aX, aY, aZ); - return aTileEntity instanceof IMTE_IsProvidingStrongPower ? ((IMTE_IsProvidingStrongPower) aTileEntity).isProvidingStrongPower((byte)aSide) - : super.isProvidingStrongPower(aWorld, aX, aY, aZ, aSide); + return aTileEntity instanceof IMTE_IsProvidingStrongPower + ? ((IMTE_IsProvidingStrongPower) aTileEntity).isProvidingStrongPower((byte) aSide) + : super.isProvidingStrongPower(aWorld, aX, aY, aZ, aSide); } - @Override public final boolean shouldCheckWeakPower(IBlockAccess aWorld, int aX, int aY, int aZ, int aSide) { final TileEntity aTileEntity = aWorld.getTileEntity(aX, aY, aZ); - return aTileEntity instanceof IMTE_ShouldCheckWeakPower ? ((IMTE_ShouldCheckWeakPower) aTileEntity).shouldCheckWeakPower((byte)aSide) - : isNormalCube(aWorld, aX, aY, aZ); + return aTileEntity instanceof IMTE_ShouldCheckWeakPower + ? ((IMTE_ShouldCheckWeakPower) aTileEntity).shouldCheckWeakPower((byte) aSide) + : isNormalCube(aWorld, aX, aY, aZ); } @Override public final boolean getWeakChanges(IBlockAccess aWorld, int aX, int aY, int aZ) { final TileEntity aTileEntity = aWorld.getTileEntity(aX, aY, aZ); - return aTileEntity instanceof IMTE_GetWeakChanges ? ((IMTE_GetWeakChanges) aTileEntity).getWeakChanges() - : super.getWeakChanges(aWorld, aX, aY, aZ); + return aTileEntity instanceof IMTE_GetWeakChanges + ? ((IMTE_GetWeakChanges) aTileEntity).getWeakChanges() + : super.getWeakChanges(aWorld, aX, aY, aZ); } - @Override public final void harvestBlock(World aWorld, EntityPlayer aPlayer, int aX, int aY, int aZ, int aMeta) { if (aPlayer == null) aPlayer = harvesters.get(); @@ -310,8 +392,10 @@ public class MultiTileEntityBlock extends Block implements IDebugableBlock, ITil final TileEntity aTileEntity = getTileEntity(aWorld, aX, aY, aZ, true); if (aTileEntity instanceof IMultiTileEntity) { final ArrayList<ItemStack> tList = ((IMultiTileEntity) aTileEntity).getDrops(aFortune, aSilkTouch); - aChance = ForgeEventFactory.fireBlockHarvesting(tList, aWorld, this, aX, aY, aZ, aMeta, aFortune, aChance, aSilkTouch, aPlayer); - for (ItemStack tStack : tList) if (XSTR.XSTR_INSTANCE.nextFloat() <= aChance) dropBlockAsItem(aWorld, aX, aY, aZ, tStack); + aChance = ForgeEventFactory.fireBlockHarvesting( + tList, aWorld, this, aX, aY, aZ, aMeta, aFortune, aChance, aSilkTouch, aPlayer); + for (ItemStack tStack : tList) + if (XSTR.XSTR_INSTANCE.nextFloat() <= aChance) dropBlockAsItem(aWorld, aX, aY, aZ, tStack); } } @@ -355,7 +439,9 @@ public class MultiTileEntityBlock extends Block implements IDebugableBlock, ITil @Override public final boolean shouldSideBeRendered(IBlockAccess aWorld, int aX, int aY, int aZ, int aSide) { final TileEntity aTileEntity = aWorld.getTileEntity(aX - OFFX[aSide], aY - OFFY[aSide], aZ - OFFZ[aSide]); - return aTileEntity instanceof IMultiTileEntity ? ((IMultiTileEntity) aTileEntity).shouldSideBeRendered((byte)aSide) : super.shouldSideBeRendered(aWorld, aX, aY, aZ, aSide); + return aTileEntity instanceof IMultiTileEntity + ? ((IMultiTileEntity) aTileEntity).shouldSideBeRendered((byte) aSide) + : super.shouldSideBeRendered(aWorld, aX, aY, aZ, aSide); } @Override @@ -365,13 +451,16 @@ public class MultiTileEntityBlock extends Block implements IDebugableBlock, ITil final byte aSide = (byte) side; final CoverableTileEntity tile = (CoverableTileEntity) tTileEntity; if (side != -1) { - final Block facadeBlock = tile.getCoverBehaviorAtSideNew(aSide).getFacadeBlock(aSide, tile.getCoverIDAtSide(aSide), tile.getComplexCoverDataAtSide(aSide), tile); + final Block facadeBlock = tile.getCoverBehaviorAtSideNew(aSide) + .getFacadeBlock( + aSide, tile.getCoverIDAtSide(aSide), tile.getComplexCoverDataAtSide(aSide), tile); 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 i = 0; i < 6; i++) { - final Block facadeBlock = tile.getCoverBehaviorAtSideNew(i).getFacadeBlock(i, tile.getCoverIDAtSide(i), tile.getComplexCoverDataAtSide(i), tile); + final Block facadeBlock = tile.getCoverBehaviorAtSideNew(i) + .getFacadeBlock(i, tile.getCoverIDAtSide(i), tile.getComplexCoverDataAtSide(i), tile); if (facadeBlock != null) { return facadeBlock; } @@ -388,16 +477,22 @@ public class MultiTileEntityBlock extends Block implements IDebugableBlock, ITil final byte aSide = (byte) side; final CoverableTileEntity tile = (CoverableTileEntity) tTileEntity; if (side != -1) { - final Block facadeBlock = tile.getCoverBehaviorAtSideNew(aSide).getFacadeBlock(aSide, tile.getCoverIDAtSide(aSide), tile.getComplexCoverDataAtSide(aSide), tile); + final Block facadeBlock = tile.getCoverBehaviorAtSideNew(aSide) + .getFacadeBlock( + aSide, tile.getCoverIDAtSide(aSide), tile.getComplexCoverDataAtSide(aSide), tile); if (facadeBlock != null) - return tile.getCoverBehaviorAtSideNew(aSide).getFacadeMeta(aSide, tile.getCoverIDAtSide(aSide), tile.getComplexCoverDataAtSide(aSide), tile); + return tile.getCoverBehaviorAtSideNew(aSide) + .getFacadeMeta( + aSide, tile.getCoverIDAtSide(aSide), tile.getComplexCoverDataAtSide(aSide), tile); } 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 i = 0; i < 6; i++) { - final Block facadeBlock = tile.getCoverBehaviorAtSideNew(i).getFacadeBlock(i, tile.getCoverIDAtSide(i), tile.getComplexCoverDataAtSide(i), tile); + final Block facadeBlock = tile.getCoverBehaviorAtSideNew(i) + .getFacadeBlock(i, tile.getCoverIDAtSide(i), tile.getComplexCoverDataAtSide(i), tile); if (facadeBlock != null) { - return tile.getCoverBehaviorAtSideNew(i).getFacadeMeta(i, tile.getCoverIDAtSide(i), tile.getComplexCoverDataAtSide(i), tile); + return tile.getCoverBehaviorAtSideNew(i) + .getFacadeMeta(i, tile.getCoverIDAtSide(i), tile.getComplexCoverDataAtSide(i), tile); } } } @@ -432,7 +527,9 @@ public class MultiTileEntityBlock extends Block implements IDebugableBlock, ITil } @Override - public final void getSubBlocks(Item aItem, CreativeTabs aCreativeTab, List aList) {/**/} + public final void getSubBlocks(Item aItem, CreativeTabs aCreativeTab, List aList) { + /**/ + } @Override public boolean hasComparatorInputOverride() { @@ -442,13 +539,18 @@ public class MultiTileEntityBlock extends Block implements IDebugableBlock, ITil @Override public final int getComparatorInputOverride(World aWorld, int aX, int aY, int aZ, int aSide) { final TileEntity aTileEntity = aWorld.getTileEntity(aX, aY, aZ); - return aTileEntity instanceof IMTE_GetComparatorInputOverride ? ((IMTE_GetComparatorInputOverride) aTileEntity).getComparatorInputOverride((byte)aSide) - : aTileEntity instanceof IMTE_IsProvidingWeakPower ? ((IMTE_IsProvidingWeakPower) aTileEntity).isProvidingWeakPower(GT_Utility.getOppositeSide(aSide)) - : super.getComparatorInputOverride(aWorld, aX, aY, aZ, aSide); + return aTileEntity instanceof IMTE_GetComparatorInputOverride + ? ((IMTE_GetComparatorInputOverride) aTileEntity).getComparatorInputOverride((byte) aSide) + : aTileEntity instanceof IMTE_IsProvidingWeakPower + ? ((IMTE_IsProvidingWeakPower) aTileEntity) + .isProvidingWeakPower(GT_Utility.getOppositeSide(aSide)) + : super.getComparatorInputOverride(aWorld, aX, aY, aZ, aSide); } @Override - public final void registerBlockIcons(IIconRegister aIconRegister) {/**/} + public final void registerBlockIcons(IIconRegister aIconRegister) { + /**/ + } @Override public final boolean isNormalCube(IBlockAccess aWorld, int aX, int aY, int aZ) { @@ -458,7 +560,10 @@ public class MultiTileEntityBlock extends Block implements IDebugableBlock, ITil @Override 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)) : mOpaque; + return aTileEntity instanceof IMultiTileEntity + ? ((IMultiTileEntity) aTileEntity) + .isSideSolid((byte) (aSide != null ? aSide.ordinal() : GT_Values.SIDE_UNKNOWN)) + : mOpaque; } @Override @@ -484,7 +589,8 @@ public class MultiTileEntityBlock extends Block implements IDebugableBlock, ITil } @Override - public final ArrayList<ItemStack> getDrops(World aWorld, int aX, int aY, int aZ, int aUnusableMetaData, int aFortune) { + public final ArrayList<ItemStack> getDrops( + World aWorld, int aX, int aY, int aZ, int aUnusableMetaData, int aFortune) { final TileEntity aTileEntity = getTileEntity(aWorld, aX, aY, aZ, true); if (aTileEntity instanceof IMultiTileEntity) return ((IMultiTileEntity) aTileEntity).getDrops(aFortune, false); return new ArrayList<>(); @@ -496,10 +602,20 @@ public class MultiTileEntityBlock extends Block implements IDebugableBlock, ITil } @Override - public final float getExplosionResistance(Entity aExploder, World aWorld, int aX, int aY, int aZ, double aExplosionX, double aExplosionY, double aExplosionZ) { + public final float getExplosionResistance( + Entity aExploder, + World aWorld, + int aX, + int aY, + int aZ, + 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) - : 1.0F; + return aTileEntity instanceof IMultiTileEntity + ? ((IMultiTileEntity) aTileEntity) + .getExplosionResistance(aExploder, aExplosionX, aExplosionY, aExplosionZ) + : 1.0F; } @Override @@ -508,10 +624,11 @@ public class MultiTileEntityBlock extends Block implements IDebugableBlock, ITil final TileEntity aTileEntity = getTileEntity(aWorld, aX, aY, aZ, true); if (aTileEntity != null) LAST_BROKEN_TILEENTITY.set(aTileEntity); if (aTileEntity instanceof IMultiTileEntity) { - GT_Log.exp.printf("Explosion at : %d | %d | %d DIMID: %s due to near explosion!%n", aX, aY, aZ, aWorld.provider.dimensionId); + GT_Log.exp.printf( + "Explosion at : %d | %d | %d DIMID: %s due to near explosion!%n", + aX, aY, aZ, aWorld.provider.dimensionId); ((IMultiTileEntity) aTileEntity).onExploded(aExplosion); - } - else aWorld.setBlockToAir(aX, aY, aZ); + } else aWorld.setBlockToAir(aX, aY, aZ); } @Override @@ -522,7 +639,8 @@ public class MultiTileEntityBlock extends Block implements IDebugableBlock, ITil @Override public final boolean recolourBlock(World aWorld, int aX, int aY, int aZ, ForgeDirection aSide, int aColor) { final TileEntity aTileEntity = aWorld.getTileEntity(aX, aY, aZ); - return aTileEntity instanceof IMultiTileEntity && ((IMultiTileEntity) aTileEntity).recolourBlock((byte)aSide.ordinal(), (byte) aColor); + return aTileEntity instanceof IMultiTileEntity + && ((IMultiTileEntity) aTileEntity).recolourBlock((byte) aSide.ordinal(), (byte) aColor); } @Override @@ -540,9 +658,9 @@ public class MultiTileEntityBlock extends Block implements IDebugableBlock, ITil return getHarvestTool(aMeta).equals(aType); } - @Override - public final ItemStack getPickBlock(MovingObjectPosition aTarget, World aWorld, int aX, int aY, int aZ, EntityPlayer aPlayer) { + public final ItemStack getPickBlock( + MovingObjectPosition aTarget, World aWorld, int aX, int aY, int aZ, EntityPlayer aPlayer) { final TileEntity aTileEntity = aWorld.getTileEntity(aX, aY, aZ); return aTileEntity instanceof IMultiTileEntity ? ((IMultiTileEntity) aTileEntity).getPickBlock(aTarget) : null; } @@ -553,17 +671,32 @@ public class MultiTileEntityBlock extends Block implements IDebugableBlock, ITil return aTileEntity instanceof IMultiTileEntity ? ((IMultiTileEntity) aTileEntity).getPickBlock(aTarget) : null; } - public final void receiveMultiTileEntityData( - IBlockAccess aWorld, int aX, short aY, int aZ, short aRID, short aID, int aCover0, int aCover1, int aCover2, int aCover3, int aCover4, int aCover5, - byte aTextureData, byte aTexturePage, byte aUpdateData, byte aRedstoneData, byte aColorData - ) { + IBlockAccess aWorld, + int aX, + short aY, + int aZ, + short aRID, + short aID, + int aCover0, + int aCover1, + int aCover2, + int aCover3, + int aCover4, + int aCover5, + byte aTextureData, + byte aTexturePage, + byte aUpdateData, + byte aRedstoneData, + byte aColorData) { if (!(aWorld instanceof World)) return; final IMultiTileEntity te; TileEntity aTileEntity = aWorld.getTileEntity(aX, aY, aZ); - if (!(aTileEntity instanceof IMultiTileEntity) || ((IMultiTileEntity) aTileEntity).getMultiTileEntityRegistryID() != aRID || ((IMultiTileEntity) aTileEntity).getMultiTileEntityID() != aID) { + if (!(aTileEntity instanceof IMultiTileEntity) + || ((IMultiTileEntity) aTileEntity).getMultiTileEntityRegistryID() != aRID + || ((IMultiTileEntity) aTileEntity).getMultiTileEntityID() != aID) { final MultiTileEntityRegistry tRegistry = MultiTileEntityRegistry.getRegistry(aRID); if (tRegistry == null) return; @@ -574,18 +707,17 @@ public class MultiTileEntityBlock extends Block implements IDebugableBlock, ITil te = (IMultiTileEntity) aTileEntity; boolean updated; - updated = te.setCoverIDAtSideNoUpdate((byte) 0, aCover0); + updated = te.setCoverIDAtSideNoUpdate((byte) 0, aCover0); updated |= te.setCoverIDAtSideNoUpdate((byte) 1, aCover1); updated |= te.setCoverIDAtSideNoUpdate((byte) 2, aCover2); updated |= te.setCoverIDAtSideNoUpdate((byte) 3, aCover3); updated |= te.setCoverIDAtSideNoUpdate((byte) 4, aCover4); updated |= te.setCoverIDAtSideNoUpdate((byte) 5, aCover5); - if(updated) { + if (updated) { te.issueBlockUpdate(); } - te.receiveClientEvent(GregTechTileClientEvents.CHANGE_COMMON_DATA, aTextureData); te.receiveClientEvent(GregTechTileClientEvents.CHANGE_CUSTOM_DATA, aUpdateData & 0x7F); te.receiveClientEvent(GregTechTileClientEvents.CHANGE_CUSTOM_DATA, aTexturePage | 0x80); @@ -593,12 +725,13 @@ public class MultiTileEntityBlock extends Block implements IDebugableBlock, ITil te.receiveClientEvent(GregTechTileClientEvents.CHANGE_REDSTONE_OUTPUT, aRedstoneData); } - @Override public final TileEntity createTileEntity(World aWorld, int aMeta) { return null; } @Override - public TileEntity createNewTileEntity(World world, int i) { return null; } + public TileEntity createNewTileEntity(World world, int i) { + return null; + } } diff --git a/src/main/java/gregtech/api/multitileentity/MultiTileEntityBlockInternal.java b/src/main/java/gregtech/api/multitileentity/MultiTileEntityBlockInternal.java index 852ffa3c8e..f388944bb4 100644 --- a/src/main/java/gregtech/api/multitileentity/MultiTileEntityBlockInternal.java +++ b/src/main/java/gregtech/api/multitileentity/MultiTileEntityBlockInternal.java @@ -1,5 +1,8 @@ package gregtech.api.multitileentity; +import static gregtech.GT_Mod.GT_FML_LOGGER; +import static gregtech.api.util.GT_Util.setTileEntity; + import gregtech.api.GregTech_API; import gregtech.api.interfaces.ITexture; import gregtech.api.multitileentity.interfaces.IMultiTileEntity; @@ -17,9 +20,6 @@ import net.minecraft.util.StatCollector; import net.minecraft.world.IBlockAccess; import net.minecraft.world.World; -import static gregtech.GT_Mod.GT_FML_LOGGER; -import static gregtech.api.util.GT_Util.setTileEntity; - public class MultiTileEntityBlockInternal extends Block implements IRenderedBlock { public MultiTileEntityRegistry mMultiTileEntityRegistry; @@ -28,47 +28,73 @@ public class MultiTileEntityBlockInternal extends Block implements IRenderedBloc } @Override - public void registerBlockIcons(IIconRegister aIconRegister) { /* Do Nothing */ } + public void registerBlockIcons(IIconRegister aIconRegister) { + /* Do Nothing */ + } @Override public int getRenderType() { return GT_Renderer_Block.INSTANCE == null ? super.getRenderType() : GT_Renderer_Block.INSTANCE.mRenderID; } - @Override public final String getUnlocalizedName() {return mMultiTileEntityRegistry.mNameInternal;} - @Override public final String getLocalizedName() {return StatCollector.translateToLocal(mMultiTileEntityRegistry.mNameInternal + ".name");} - 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); + @Override + public final String getUnlocalizedName() { + return mMultiTileEntityRegistry.mNameInternal; + } + + @Override + public final String getLocalizedName() { + return StatCollector.translateToLocal(mMultiTileEntityRegistry.mNameInternal + ".name"); + } + + 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); if (aMTEContainer == null) return false; final Block tReplacedBlock = aWorld.getBlock(aX, aY, aZ); - // This is some complicated bullshit Greg had to do to make his MTEs work right. // Set Block with reverse MetaData first. - aWorld.setBlock(aX, aY, aZ, aMTEContainer.mBlock, 15-aMTEContainer.mBlockMetaData, 2); - // Make sure the Block has been set, yes I know setBlock has a true/false return value, but guess what, it is not reliable in 0.0001% of cases! -Greg - if (aWorld.getBlock(aX, aY, aZ) != aMTEContainer.mBlock) {aWorld.setBlock(aX, aY, aZ, Blocks.air, 0, 0); return false;} + aWorld.setBlock(aX, aY, aZ, aMTEContainer.mBlock, 15 - aMTEContainer.mBlockMetaData, 2); + // Make sure the Block has been set, yes I know setBlock has a true/false return value, but guess what, it is + // not reliable in 0.0001% of cases! -Greg + if (aWorld.getBlock(aX, aY, aZ) != aMTEContainer.mBlock) { + aWorld.setBlock(aX, aY, aZ, Blocks.air, 0, 0); + return false; + } // TileEntity should not refresh yet! -Greg - ((IMultiTileEntity)aMTEContainer.mTileEntity).setShouldRefresh(false); + ((IMultiTileEntity) aMTEContainer.mTileEntity).setShouldRefresh(false); // Fake-Set the TileEntity first, bypassing a lot of checks. -Greg setTileEntity(aWorld, aX, aY, aZ, (TileEntity) aMTEContainer.mTileEntity, false); // Now set the Block with the REAL MetaData. -Greg setTileEntity(aWorld, aX, aY, aZ, aMTEContainer.mBlock, aMTEContainer.mBlockMetaData, 0, false); // When the TileEntity is set now it SHOULD refresh! -Greg - ((IMultiTileEntity)aMTEContainer.mTileEntity).setShouldRefresh(true); + ((IMultiTileEntity) aMTEContainer.mTileEntity).setShouldRefresh(true); // But make sure again that the Block we have set was actually set properly, because 0.0001%! -Greg - if (aWorld.getBlock(aX, aY, aZ) != aMTEContainer.mBlock) {aWorld.setBlock(aX, aY, aZ, Blocks.air, 0, 0); return false;} + if (aWorld.getBlock(aX, aY, aZ) != aMTEContainer.mBlock) { + aWorld.setBlock(aX, aY, aZ, Blocks.air, 0, 0); + return false; + } // And finally properly set the TileEntity for real! -Greg setTileEntity(aWorld, aX, aY, aZ, (TileEntity) aMTEContainer.mTileEntity, aCauseBlockUpdates); // Yep, all this just to set one Block and its TileEntity properly... -Greg - try { if (aMTEContainer.mTileEntity instanceof IMTE_HasMultiBlockMachineRelevantData) { - if (((IMTE_HasMultiBlockMachineRelevantData)aMTEContainer.mTileEntity).hasMultiBlockMachineRelevantData()) GregTech_API.causeMachineUpdate(aWorld, aX, aY, aZ); + if (((IMTE_HasMultiBlockMachineRelevantData) aMTEContainer.mTileEntity) + .hasMultiBlockMachineRelevantData()) GregTech_API.causeMachineUpdate(aWorld, aX, aY, aZ); } - } catch(Throwable e) { + } catch (Throwable e) { GT_FML_LOGGER.error("causeMachineUpdate", e); } @@ -77,20 +103,19 @@ public class MultiTileEntityBlockInternal extends Block implements IRenderedBloc aWorld.notifyBlockChange(aX, aY, aZ, tReplacedBlock); aWorld.func_147453_f(aX, aY, aZ, aMTEContainer.mBlock); } - } catch(Throwable e) { + } catch (Throwable e) { GT_FML_LOGGER.error("aCauseBlockUpdates", e); } try { - ((IMultiTileEntity)aMTEContainer.mTileEntity).onTileEntityPlaced(); - } catch(Throwable e) { + ((IMultiTileEntity) aMTEContainer.mTileEntity).onTileEntityPlaced(); + } catch (Throwable e) { GT_FML_LOGGER.error("onTileEntityPlaced", e); } - try { - aWorld.func_147451_t/*updateAllLightTypes*/(aX, aY, aZ); - } catch(Throwable e) { + aWorld.func_147451_t /*updateAllLightTypes*/(aX, aY, aZ); + } catch (Throwable e) { GT_FML_LOGGER.error("updateAllLightTypes", e); } return true; @@ -125,7 +150,7 @@ public class MultiTileEntityBlockInternal extends Block implements IRenderedBloc @Override public IRenderedBlock passRenderingToObject(ItemStack aStack) { final TileEntity tTileEntity = mMultiTileEntityRegistry.getNewTileEntity(aStack); - return tTileEntity instanceof IRenderedBlock ? (IRenderedBlock)tTileEntity : null; + return tTileEntity instanceof IRenderedBlock ? (IRenderedBlock) tTileEntity : null; } @Override diff --git a/src/main/java/gregtech/api/multitileentity/MultiTileEntityClassContainer.java b/src/main/java/gregtech/api/multitileentity/MultiTileEntityClassContainer.java index 563d2fc462..c66ec30481 100644 --- a/src/main/java/gregtech/api/multitileentity/MultiTileEntityClassContainer.java +++ b/src/main/java/gregtech/api/multitileentity/MultiTileEntityClassContainer.java @@ -1,16 +1,14 @@ package gregtech.api.multitileentity; +import static gregtech.api.enums.GT_Values.NBT; + import gregtech.api.enums.Materials; import gregtech.api.multitileentity.base.BaseMultiTileEntity; import gregtech.api.util.GT_Util; -import net.minecraft.block.material.Material; +import java.lang.ref.WeakReference; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.util.Tuple; -import java.lang.ref.WeakReference; - -import static gregtech.api.enums.GT_Values.NBT; - public class MultiTileEntityClassContainer { private final WeakReference<MultiTileEntityRegistry> mRegistry; private String mLocalized; @@ -27,8 +25,8 @@ public class MultiTileEntityClassContainer { public byte mStackSize = 64; public boolean mHidden = false; - - public MultiTileEntityClassContainer(MultiTileEntityRegistry aRegistry, int aID, Class<? extends BaseMultiTileEntity> aClass) { + public MultiTileEntityClassContainer( + MultiTileEntityRegistry aRegistry, int aID, Class<? extends BaseMultiTileEntity> aClass) { /* Start the Builder */ mRegistry = new WeakReference<>(aRegistry); mID = (short) aID; @@ -41,9 +39,16 @@ public class MultiTileEntityClassContainer { 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())); - - try {mCanonicalTileEntity = mClass.newInstance();} catch (Throwable e) {throw new IllegalArgumentException(e);} + mParameters.setInteger( + NBT.COLOR, + GT_Util.getRGBInt( + Materials.get(mParameters.getString(NBT.MATERIAL)).getRGBA())); + + try { + mCanonicalTileEntity = mClass.newInstance(); + } catch (Throwable e) { + throw new IllegalArgumentException(e); + } mCanonicalTileEntity.initFromNBT(mParameters, mID, (short) -1); return registry != null && registry.add(this.mLocalized, this.mCategoryName, this) != null; @@ -86,8 +91,7 @@ public class MultiTileEntityClassContainer { public MultiTileEntityClassContainer material(Materials aMaterial) { // Sets the material, and the color from the material, if not already set mParameters.setString(NBT.MATERIAL, aMaterial.toString()); - if (!mParameters.hasKey(NBT.COLOR)) - mParameters.setInteger(NBT.COLOR, GT_Util.getRGBInt(aMaterial.getRGBA())); + if (!mParameters.hasKey(NBT.COLOR)) mParameters.setInteger(NBT.COLOR, GT_Util.getRGBInt(aMaterial.getRGBA())); return this; } @@ -116,5 +120,4 @@ public class MultiTileEntityClassContainer { mParameters = GT_Util.fuseNBT(mParameters, GT_Util.makeNBT(aTags)); return this; } - } diff --git a/src/main/java/gregtech/api/multitileentity/MultiTileEntityContainer.java b/src/main/java/gregtech/api/multitileentity/MultiTileEntityContainer.java index 1c037a45e1..b209c95990 100644 --- a/src/main/java/gregtech/api/multitileentity/MultiTileEntityContainer.java +++ b/src/main/java/gregtech/api/multitileentity/MultiTileEntityContainer.java @@ -1,11 +1,11 @@ package gregtech.api.multitileentity; +import static gregtech.api.util.GT_Util.setTileEntity; + import gregtech.api.multitileentity.interfaces.IMultiTileEntity; import net.minecraft.tileentity.TileEntity; import net.minecraft.world.World; -import static gregtech.api.util.GT_Util.setTileEntity; - public class MultiTileEntityContainer { public final TileEntity mTileEntity; public final MultiTileEntityBlock mBlock; @@ -16,12 +16,13 @@ public class MultiTileEntityContainer { mTileEntity = aTileEntity; mBlock = aBlock; } + public void setMultiTile(World aWorld, int aX, int aY, int aZ) { // This is some complicated Bullshit Greg had to do to make his MTEs work right. - ((IMultiTileEntity)mTileEntity).setShouldRefresh(false); + ((IMultiTileEntity) mTileEntity).setShouldRefresh(false); setTileEntity(aWorld, aX, aY, aZ, mTileEntity, false); setTileEntity(aWorld, aX, aY, aZ, mBlock, mBlockMetaData, 0, false); - ((IMultiTileEntity)mTileEntity).setShouldRefresh(true); + ((IMultiTileEntity) mTileEntity).setShouldRefresh(true); setTileEntity(aWorld, aX, aY, aZ, mTileEntity, true); } } diff --git a/src/main/java/gregtech/api/multitileentity/MultiTileEntityItemInternal.java b/src/main/java/gregtech/api/multitileentity/MultiTileEntityItemInternal.java index 897dbf7991..4d7c6be262 100644 --- a/src/main/java/gregtech/api/multitileentity/MultiTileEntityItemInternal.java +++ b/src/main/java/gregtech/api/multitileentity/MultiTileEntityItemInternal.java @@ -1,5 +1,8 @@ package gregtech.api.multitileentity; +import static gregtech.GT_Mod.GT_FML_LOGGER; +import static gregtech.api.enums.GT_Values.SIDE_TOP; + import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; import gregtech.api.GregTech_API; @@ -8,11 +11,12 @@ import gregtech.api.metatileentity.CoverableTileEntity; import gregtech.api.multitileentity.interfaces.IItemUpdatable; import gregtech.api.multitileentity.interfaces.IMultiTileEntity; import gregtech.api.multitileentity.interfaces.IMultiTileEntity.IMTE_AddToolTips; +import gregtech.api.multitileentity.interfaces.IMultiTileEntity.IMTE_CanPlace; import gregtech.api.multitileentity.interfaces.IMultiTileEntity.IMTE_GetMaxStackSize; import gregtech.api.multitileentity.interfaces.IMultiTileEntity.IMTE_HasMultiBlockMachineRelevantData; -import gregtech.api.multitileentity.interfaces.IMultiTileEntity.IMTE_OnlyPlaceableWhenSneaking; import gregtech.api.multitileentity.interfaces.IMultiTileEntity.IMTE_IgnoreEntityCollisionWhenPlacing; -import gregtech.api.multitileentity.interfaces.IMultiTileEntity.IMTE_CanPlace; +import gregtech.api.multitileentity.interfaces.IMultiTileEntity.IMTE_OnlyPlaceableWhenSneaking; +import java.util.List; import net.minecraft.block.Block; import net.minecraft.block.BlockSnow; import net.minecraft.client.renderer.texture.IIconRegister; @@ -30,12 +34,6 @@ import net.minecraft.world.World; import net.minecraftforge.fluids.FluidStack; import net.minecraftforge.fluids.IFluidContainerItem; -import java.util.List; - -import static gregtech.GT_Mod.GT_FML_LOGGER; -import static gregtech.api.enums.GT_Values.SIDE_TOP; -import static gregtech.api.util.GT_Util.setTileEntity; - public class MultiTileEntityItemInternal extends ItemBlock implements IFluidContainerItem, IItemUpdatable { public final MultiTileEntityBlockInternal mBlock; @@ -43,12 +41,14 @@ public class MultiTileEntityItemInternal extends ItemBlock implements IFluidCont super(aBlock); setMaxDamage(0); setHasSubtypes(true); - mBlock = (MultiTileEntityBlockInternal)aBlock; + mBlock = (MultiTileEntityBlockInternal) aBlock; } + @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; @@ -65,14 +65,14 @@ public class MultiTileEntityItemInternal extends ItemBlock implements IFluidCont // TODO: Add anything else relevant } - @Override @SideOnly(Side.CLIENT) @SuppressWarnings("unchecked") 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)); } } @@ -80,48 +80,85 @@ public class MultiTileEntityItemInternal extends ItemBlock implements IFluidCont } @Override - public boolean onItemUse(ItemStack aStack, EntityPlayer aPlayer, World aWorld, int aX, int aY, int aZ, int aSide, float aHitX, float aHitY, float aHitZ) { + public boolean onItemUse( + ItemStack aStack, + EntityPlayer aPlayer, + World aWorld, + int aX, + int aY, + int aZ, + int aSide, + float aHitX, + float aHitY, + float aHitZ) { if (aY < 0 || aY > aWorld.getHeight()) return false; try { final Block tClickedBlock = aWorld.getBlock(aX, aY, aZ); if (tClickedBlock instanceof BlockSnow && (aWorld.getBlockMetadata(aX, aY, aZ) & 7) < 1) { aSide = SIDE_TOP; - } else if (tClickedBlock != Blocks.vine && tClickedBlock != Blocks.tallgrass && tClickedBlock != Blocks.deadbush && !tClickedBlock.isReplaceable(aWorld, aX, aY, aZ)) { + } else if (tClickedBlock != Blocks.vine + && tClickedBlock != Blocks.tallgrass + && tClickedBlock != Blocks.deadbush + && !tClickedBlock.isReplaceable(aWorld, aX, aY, aZ)) { aX += GT_Values.OFFX[aSide]; aY += GT_Values.OFFY[aSide]; aZ += GT_Values.OFFZ[aSide]; } final Block tReplacedBlock = aWorld.getBlock(aX, aY, aZ); - if (!tReplacedBlock.isReplaceable(aWorld, aX, aY, aZ) || !mBlock.canReplace(aWorld, aX, aY, aZ, aSide, aStack)) return false; - if (aStack.stackSize == 0 || (aPlayer != null && !aPlayer.canPlayerEdit(aX, aY, aZ, aSide, aStack))) return false; + if (!tReplacedBlock.isReplaceable(aWorld, aX, aY, aZ) + || !mBlock.canReplace(aWorld, aX, aY, aZ, aSide, aStack)) return false; + 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()) - && ( - 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)) - ) - && (!(aMTEContainer.mTileEntity instanceof IMTE_CanPlace) || ((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)) - { + && (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))) + && (!(aMTEContainer.mTileEntity instanceof IMTE_CanPlace) + || ((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, aZ + 0.5, aMTEContainer.mBlock.stepSound.func_150496_b(), (aMTEContainer.mBlock.stepSound.getVolume() + 1) / 2, - aMTEContainer.mBlock.stepSound.getPitch() * 0.8F - ); + aX + 0.5, + aY + 0.5, + aZ + 0.5, + aMTEContainer.mBlock.stepSound.func_150496_b(), + (aMTEContainer.mBlock.stepSound.getVolume() + 1) / 2, + aMTEContainer.mBlock.stepSound.getPitch() * 0.8F); } } catch (Throwable e) { GT_FML_LOGGER.error("onPlaced", e); } try { - if (aMTEContainer.mTileEntity instanceof IMTE_HasMultiBlockMachineRelevantData && (((IMTE_HasMultiBlockMachineRelevantData) aMTEContainer.mTileEntity).hasMultiBlockMachineRelevantData())) { - GregTech_API.causeMachineUpdate(aWorld, aX, aY, aZ); + if (aMTEContainer.mTileEntity instanceof IMTE_HasMultiBlockMachineRelevantData + && (((IMTE_HasMultiBlockMachineRelevantData) aMTEContainer.mTileEntity) + .hasMultiBlockMachineRelevantData())) { + GregTech_API.causeMachineUpdate(aWorld, aX, aY, aZ); } } catch (Throwable e) { GT_FML_LOGGER.error("causeMachineUpdate", e); @@ -129,18 +166,18 @@ public class MultiTileEntityItemInternal extends ItemBlock implements IFluidCont try { if (!aWorld.isRemote) { aWorld.notifyBlockChange(aX, aY, aZ, tReplacedBlock); - aWorld.func_147453_f/*updateNeighborsAboutBlockChange*/(aX, aY, aZ, aMTEContainer.mBlock); + aWorld.func_147453_f /*updateNeighborsAboutBlockChange*/(aX, aY, aZ, aMTEContainer.mBlock); } } catch (Throwable e) { GT_FML_LOGGER.error("notifyBlockChange", e); } try { - ((IMultiTileEntity)aMTEContainer.mTileEntity).onTileEntityPlaced(); + ((IMultiTileEntity) aMTEContainer.mTileEntity).onTileEntityPlaced(); } catch (Throwable e) { GT_FML_LOGGER.error("onTileEntityPlaced", e); } try { - aWorld.func_147451_t/*updateAllLightTypes*/(aX, aY, aZ); + aWorld.func_147451_t /*updateAllLightTypes*/(aX, aY, aZ); } catch (Throwable e) { GT_FML_LOGGER.error("updateAllLightTypes", e); } @@ -158,18 +195,21 @@ 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); + ((IItemUpdatable) tTileEntityContainer.mTileEntity).updateItemStack(aStack); } } + @Override 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); + ((IItemUpdatable) tTileEntityContainer.mTileEntity).updateItemStack(aStack, aWorld, aX, aY, aZ); } } @@ -177,9 +217,11 @@ 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; } @@ -191,9 +233,10 @@ 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); + final FluidStack rFluid = ((IFluidContainerItem) tTileEntityContainer.mTileEntity).getFluid(aStack); updateItemStack(aStack); return rFluid; } @@ -202,9 +245,10 @@ 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); + final int rCapacity = ((IFluidContainerItem) tTileEntityContainer.mTileEntity).getCapacity(aStack); updateItemStack(aStack); return rCapacity; } @@ -213,9 +257,10 @@ 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); + final int tFilled = ((IFluidContainerItem) tTileEntityContainer.mTileEntity).fill(aStack, aFluid, aDoFill); updateItemStack(aStack); return tFilled; } @@ -224,9 +269,11 @@ 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; } @@ -234,7 +281,8 @@ public class MultiTileEntityItemInternal extends ItemBlock implements IFluidCont } @Override - public boolean func_150936_a/*canPlaceAtSide*/(World aWorld, int aX, int aY, int aZ, int aSide, EntityPlayer aPlayer, ItemStack aStack) { + public boolean func_150936_a /*canPlaceAtSide*/( + World aWorld, int aX, int aY, int aZ, int aSide, EntityPlayer aPlayer, ItemStack aStack) { return true; } @@ -273,7 +321,7 @@ public class MultiTileEntityItemInternal extends ItemBlock implements IFluidCont @Override public final boolean getShareTag() { - return true; // just to be sure + return true; // just to be sure } @Override diff --git a/src/main/java/gregtech/api/multitileentity/MultiTileEntityRegistry.java b/src/main/java/gregtech/api/multitileentity/MultiTileEntityRegistry.java index 0bb9af1daa..b212a51384 100644 --- a/src/main/java/gregtech/api/multitileentity/MultiTileEntityRegistry.java +++ b/src/main/java/gregtech/api/multitileentity/MultiTileEntityRegistry.java @@ -1,5 +1,7 @@ package gregtech.api.multitileentity; +import static gregtech.GT_Mod.GT_FML_LOGGER; + import appeng.core.CreativeTab; import com.gtnewhorizon.gtnhlib.util.map.ItemStackMap; import cpw.mods.fml.common.registry.GameRegistry; @@ -10,6 +12,11 @@ import gregtech.api.multitileentity.interfaces.IMultiTileEntity; import gregtech.api.util.GT_LanguageManager; import gregtech.api.util.GT_Util; import gregtech.api.util.GT_Utility; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; import net.minecraft.block.Block; import net.minecraft.init.Items; import net.minecraft.item.Item; @@ -20,14 +27,6 @@ import net.minecraft.tileentity.TileEntity; import net.minecraft.util.StatCollector; import net.minecraft.world.World; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.HashSet; -import java.util.List; -import java.util.Map; - -import static gregtech.GT_Mod.GT_FML_LOGGER; - public class MultiTileEntityRegistry { private static final HashMap<String, MultiTileEntityRegistry> NAMED_REGISTRIES = new HashMap<>(); @@ -42,7 +41,8 @@ public class MultiTileEntityRegistry { public final String mNameInternal; public final MultiTileEntityBlockInternal mBlock; - private static MultiTileEntityBlockInternal regblock(String aNameInternal, MultiTileEntityBlockInternal aBlock, Class<? extends ItemBlock> aItemClass) { + private static MultiTileEntityBlockInternal regblock( + String aNameInternal, MultiTileEntityBlockInternal aBlock, Class<? extends ItemBlock> aItemClass) { GameRegistry.registerBlock(aBlock, aItemClass == null ? ItemBlock.class : aItemClass, aNameInternal); return aBlock; } @@ -57,7 +57,8 @@ public class MultiTileEntityRegistry { /** * @param aNameInternal the internal Name of the Item */ - public MultiTileEntityRegistry(String aNameInternal, MultiTileEntityBlockInternal aBlock, Class<? extends ItemBlock> aItemClass) { + public MultiTileEntityRegistry( + String aNameInternal, MultiTileEntityBlockInternal aBlock, Class<? extends ItemBlock> aItemClass) { this(aNameInternal, regblock(aNameInternal, aBlock, aItemClass)); } @@ -65,7 +66,9 @@ public class MultiTileEntityRegistry { * @param aNameInternal the internal Name of the Item */ public MultiTileEntityRegistry(String aNameInternal, MultiTileEntityBlockInternal aBlock) { - if (!GregTech_API.sPreloadStarted || GregTech_API.sPreloadFinished) throw new IllegalStateException("The MultiTileEntity Registry must be initialised during Preload Phase and not before"); + if (!GregTech_API.sPreloadStarted || GregTech_API.sPreloadFinished) + throw new IllegalStateException( + "The MultiTileEntity Registry must be initialised during Preload Phase and not before"); mNameInternal = aNameInternal; mBlock = aBlock; mBlock.mMultiTileEntityRegistry = this; @@ -84,6 +87,7 @@ public class MultiTileEntityRegistry { public static MultiTileEntityRegistry getRegistry(int aRegistryID) { return REGISTRIES.get(new ItemStack(Item.getItemById(aRegistryID), 1, GT_Values.W)); } + public static MultiTileEntityRegistry getRegistry(String aRegistryName) { return NAMED_REGISTRIES.get(aRegistryName); } @@ -116,18 +120,23 @@ public class MultiTileEntityRegistry { tFailed = true; } if (mRegistry.containsKey(aClassContainer.mID)) { - GT_FML_LOGGER.error("MULTI-TILE REGISTRY ERROR: Class Container uses occupied MetaData! (" + aClassContainer.mID + ")"); + GT_FML_LOGGER.error("MULTI-TILE REGISTRY ERROR: Class Container uses occupied MetaData! (" + + aClassContainer.mID + ")"); tFailed = true; } } 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; + int i = 0; + 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); @@ -135,34 +144,49 @@ public class MultiTileEntityRegistry { if (sRegisteredTileEntities.add(aClassContainer.mCanonicalTileEntity.getClass())) { aClassContainer.mCanonicalTileEntity.onRegistrationFirst(this, aClassContainer.mID); } -// // TODO: Recipe -// if (aRecipe != null && aRecipe.length > 1) { -// if (aRecipe[0] instanceof Object[]) aRecipe = (Object[])aRecipe[0]; -// if (aRecipe.length > 2) CR.shaped(getItem(aClassContainer.mID), CR.DEF_REV_NCC, aRecipe); -// } -// // A simple special case to make it easier to add a Machine to Recipe Lists without having to worry about anything. -// String tRecipeMapName = aClassContainer.mParameters.getString(NBT_RECIPEMAP); -// if (GT_Utility.isStringValid(tRecipeMapName)) {RecipeMap tMap = RecipeMap.RECIPE_MAPS.get(tRecipeMapName); if (tMap != null) tMap.mRecipeMachineList.add(getItem(aClassContainer.mID));} -// tRecipeMapName = aClassContainer.mParameters.getString(NBT_FUELMAP); -// if (GT_Utility.isStringValid(tRecipeMapName)) {RecipeMap tMap = RecipeMap.RECIPE_MAPS.get(tRecipeMapName); if (tMap != null) tMap.mRecipeMachineList.add(getItem(aClassContainer.mID));} -// + // // TODO: Recipe + // if (aRecipe != null && aRecipe.length > 1) { + // if (aRecipe[0] instanceof Object[]) aRecipe = (Object[])aRecipe[0]; + // if (aRecipe.length > 2) CR.shaped(getItem(aClassContainer.mID), CR.DEF_REV_NCC, aRecipe); + // } + // // A simple special case to make it easier to add a Machine to Recipe Lists without having to worry + // about anything. + // String tRecipeMapName = aClassContainer.mParameters.getString(NBT_RECIPEMAP); + // if (GT_Utility.isStringValid(tRecipeMapName)) {RecipeMap tMap = + // RecipeMap.RECIPE_MAPS.get(tRecipeMapName); if (tMap != null) + // tMap.mRecipeMachineList.add(getItem(aClassContainer.mID));} + // tRecipeMapName = aClassContainer.mParameters.getString(NBT_FUELMAP); + // if (GT_Utility.isStringValid(tRecipeMapName)) {RecipeMap tMap = + // RecipeMap.RECIPE_MAPS.get(tRecipeMapName); if (tMap != null) + // tMap.mRecipeMachineList.add(getItem(aClassContainer.mID));} + // return getItem(aClassContainer.mID); } public short mLastRegisteredID = GT_Values.W; + public ItemStack getItem() { + return getItem(mLastRegisteredID, 1, null); + } - public ItemStack getItem() {return getItem(mLastRegisteredID, 1, null);} - public ItemStack getItem(int aID) {return getItem(aID, 1, null);} - public ItemStack getItem(int aID, NBTTagCompound aNBT) {return getItem(aID, 1, aNBT);} - public ItemStack getItem(int aID, long aAmount) {return getItem(aID, aAmount, null);} + public ItemStack getItem(int aID) { + return getItem(aID, 1, null); + } + + public ItemStack getItem(int aID, NBTTagCompound aNBT) { + return getItem(aID, 1, aNBT); + } + + public ItemStack getItem(int aID, long aAmount) { + return getItem(aID, aAmount, null); + } public ItemStack getItem(int aID, long aAmount, NBTTagCompound aNBT) { - final ItemStack rStack = new ItemStack(mBlock, (int)aAmount, aID); + final ItemStack rStack = new ItemStack(mBlock, (int) aAmount, aID); if (aNBT == null || aNBT.hasNoTags()) { aNBT = new NBTTagCompound(); final MultiTileEntityContainer tTileEntityContainer = getNewTileEntityContainer(aID, aNBT); - if (tTileEntityContainer != null) ((IMultiTileEntity)tTileEntityContainer.mTileEntity).writeItemNBT(aNBT); + if (tTileEntityContainer != null) ((IMultiTileEntity) tTileEntityContainer.mTileEntity).writeItemNBT(aNBT); } rStack.setTagCompound(aNBT); return rStack; @@ -185,16 +209,26 @@ public class MultiTileEntityRegistry { return tContainer == null ? null : (TileEntity) tContainer.mTileEntity; } - public MultiTileEntityContainer getNewTileEntityContainer(World aWorld, int aX, int aY, int aZ, int aID, NBTTagCompound aNBT) { + public MultiTileEntityContainer getNewTileEntityContainer( + World aWorld, int aX, int aY, int aZ, int aID, NBTTagCompound aNBT) { final MultiTileEntityClassContainer tClass = mRegistry.get((short) aID); if (tClass == null || tClass.mBlock == null) return null; - final MultiTileEntityContainer rContainer = new MultiTileEntityContainer((TileEntity) GT_Utility.callConstructor(tClass.mClass, -1, null, true), tClass.mBlock, tClass.mBlockMetaData); + final MultiTileEntityContainer rContainer = new MultiTileEntityContainer( + (TileEntity) GT_Utility.callConstructor(tClass.mClass, -1, null, true), + tClass.mBlock, + tClass.mBlockMetaData); if (rContainer.mTileEntity == null) return null; rContainer.mTileEntity.setWorldObj(aWorld); rContainer.mTileEntity.xCoord = aX; rContainer.mTileEntity.yCoord = aY; rContainer.mTileEntity.zCoord = aZ; - ((IMultiTileEntity) rContainer.mTileEntity).initFromNBT(aNBT == null || aNBT.hasNoTags() ? tClass.mParameters : GT_Util.fuseNBT(aNBT, tClass.mParameters), (short) aID, (short) Block.getIdFromBlock(mBlock)); + ((IMultiTileEntity) rContainer.mTileEntity) + .initFromNBT( + aNBT == null || aNBT.hasNoTags() + ? tClass.mParameters + : GT_Util.fuseNBT(aNBT, tClass.mParameters), + (short) aID, + (short) Block.getIdFromBlock(mBlock)); return rContainer; } @@ -204,12 +238,14 @@ public class MultiTileEntityRegistry { } public TileEntity getNewTileEntity(ItemStack aStack) { - final MultiTileEntityContainer tContainer = getNewTileEntityContainer(null, 0, 0, 0, Items.feather.getDamage(aStack), aStack.getTagCompound()); + final MultiTileEntityContainer tContainer = + getNewTileEntityContainer(null, 0, 0, 0, Items.feather.getDamage(aStack), aStack.getTagCompound()); return tContainer == null ? null : tContainer.mTileEntity; } public TileEntity getNewTileEntity(World aWorld, int aX, int aY, int aZ, ItemStack aStack) { - final MultiTileEntityContainer tContainer = getNewTileEntityContainer(aWorld, aX, aY, aZ, Items.feather.getDamage(aStack), aStack.getTagCompound()); + final MultiTileEntityContainer tContainer = + getNewTileEntityContainer(aWorld, aX, aY, aZ, Items.feather.getDamage(aStack), aStack.getTagCompound()); return tContainer == null ? null : tContainer.mTileEntity; } @@ -224,5 +260,4 @@ public class MultiTileEntityRegistry { public MultiTileEntityContainer getNewTileEntityContainer(int aID, NBTTagCompound aNBT) { return getNewTileEntityContainer(null, 0, 0, 0, aID, aNBT); } - } diff --git a/src/main/java/gregtech/api/multitileentity/base/BaseMultiTileEntity.java b/src/main/java/gregtech/api/multitileentity/base/BaseMultiTileEntity.java index 50c43c9764..18dc310bb7 100644 --- a/src/main/java/gregtech/api/multitileentity/base/BaseMultiTileEntity.java +++ b/src/main/java/gregtech/api/multitileentity/base/BaseMultiTileEntity.java @@ -1,5 +1,12 @@ package gregtech.api.multitileentity.base; +import static gregtech.GT_Mod.GT_FML_LOGGER; +import static gregtech.api.enums.GT_Values.NBT; +import static gregtech.api.enums.GT_Values.OPOS; +import static gregtech.api.enums.GT_Values.SIDE_WEST; +import static gregtech.api.enums.GT_Values.VALID_SIDES; +import static gregtech.api.enums.GT_Values.emptyIconContainerArray; + import cpw.mods.fml.common.registry.GameRegistry; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; @@ -14,10 +21,10 @@ import gregtech.api.interfaces.tileentity.IGregtechWailaProvider; import gregtech.api.interfaces.tileentity.IHasWorldObjectAndCoords; import gregtech.api.metatileentity.CoverableTileEntity; import gregtech.api.metatileentity.GregTechTileClientEvents; -import gregtech.api.multitileentity.interfaces.IMultiTileEntity; import gregtech.api.multitileentity.MultiTileEntityBlockInternal; import gregtech.api.multitileentity.MultiTileEntityClassContainer; import gregtech.api.multitileentity.MultiTileEntityRegistry; +import gregtech.api.multitileentity.interfaces.IMultiTileEntity; import gregtech.api.net.GT_Packet_New; import gregtech.api.net.GT_Packet_TileEntity; import gregtech.api.objects.GT_ItemStack; @@ -29,8 +36,10 @@ import gregtech.api.util.GT_Util; import gregtech.api.util.GT_Utility; import gregtech.api.util.ISerializableObject; import gregtech.common.render.GT_MultiTexture; -import gregtech.common.render.GT_RenderedTexture; import gregtech.common.render.IRenderedBlock; +import java.util.ArrayList; +import java.util.List; +import java.util.UUID; import mcp.mobius.waila.api.IWailaConfigHandler; import mcp.mobius.waila.api.IWailaDataAccessor; import net.minecraft.block.Block; @@ -57,35 +66,27 @@ import net.minecraftforge.fluids.FluidStack; import net.minecraftforge.fluids.FluidTankInfo; import net.minecraftforge.fluids.IFluidTank; -import java.util.ArrayList; -import java.util.List; -import java.util.UUID; - -import static gregtech.GT_Mod.GT_FML_LOGGER; -import static gregtech.api.enums.GT_Values.emptyIconContainerArray; -import static gregtech.api.enums.GT_Values.NBT; -import static gregtech.api.enums.GT_Values.OPOS; -import static gregtech.api.enums.GT_Values.SIDE_WEST; -import static gregtech.api.enums.GT_Values.VALID_SIDES; - -public abstract class BaseMultiTileEntity extends CoverableTileEntity implements IMultiTileEntity, IHasWorldObjectAndCoords, IRenderedBlock, IGregtechWailaProvider { +public abstract class BaseMultiTileEntity extends CoverableTileEntity + implements IMultiTileEntity, IHasWorldObjectAndCoords, IRenderedBlock, IGregtechWailaProvider { public IIconContainer[] mTextures = emptyIconContainerArray; -// public IIconContainer[] mTexturesFront = emptyIconContainerArray; + // public IIconContainer[] mTexturesFront = emptyIconContainerArray; // Makes a Bounding Box without having to constantly specify the Offset Coordinates. protected static final float[] PX_BOX = {0, 0, 0, 1, 1, 1}; public Materials mMaterial = Materials._NULL; - protected final boolean mIsTicking; // If this TileEntity is ticking at all + protected final boolean mIsTicking; // If this TileEntity is ticking at all - protected boolean mShouldRefresh = true; // This Variable checks if this TileEntity should refresh when the Block is being set. That way you can turn this check off any time you need it. - protected boolean mDoesBlockUpdate = false; // This Variable is for a buffered Block Update. - protected boolean mForceFullSelectionBoxes = false; // This Variable is for forcing the Selection Box to be full. + protected boolean mShouldRefresh = + true; // This Variable checks if this TileEntity should refresh when the Block is being set. That way you + // can turn this check off any time you need it. + protected boolean mDoesBlockUpdate = false; // This Variable is for a buffered Block Update. + protected boolean mForceFullSelectionBoxes = false; // This Variable is for forcing the Selection Box to be full. protected boolean mNeedsUpdate = false; protected boolean mInventoryChanged = false; protected boolean mIsPainted = false; - protected byte mFacing = SIDE_WEST; // Default to WEST, so it renders facing Left in the inventory + protected byte mFacing = SIDE_WEST; // Default to WEST, so it renders facing Left in the inventory protected byte mColor; protected int mRGBa = GT_Values.UNCOLORED; private short mMTEID = GT_Values.W, mMTERegistry = GT_Values.W; @@ -127,18 +128,19 @@ public abstract class BaseMultiTileEntity extends CoverableTileEntity implements // Loading the registry final String textureName = aNBT.getString(NBT.TEXTURE); mTextures = new IIconContainer[] { - new Textures.BlockIcons.CustomIcon("multitileentity/base/"+textureName+"/bottom"), - new Textures.BlockIcons.CustomIcon("multitileentity/base/"+textureName+"/top"), - new Textures.BlockIcons.CustomIcon("multitileentity/base/"+textureName+"/side"), + new Textures.BlockIcons.CustomIcon("multitileentity/base/" + textureName + "/bottom"), + new Textures.BlockIcons.CustomIcon("multitileentity/base/" + textureName + "/top"), + new Textures.BlockIcons.CustomIcon("multitileentity/base/" + textureName + "/side"), }; } @Override public void copyTextures() { // Loading an instance - final TileEntity tCanonicalTileEntity = MultiTileEntityRegistry.getCanonicalTileEntity(getMultiTileEntityRegistryID(), getMultiTileEntityID()); - if(tCanonicalTileEntity instanceof BaseMultiTileEntity) - mTextures = ((BaseMultiTileEntity)tCanonicalTileEntity).mTextures; + final TileEntity tCanonicalTileEntity = + MultiTileEntityRegistry.getCanonicalTileEntity(getMultiTileEntityRegistryID(), getMultiTileEntityID()); + if (tCanonicalTileEntity instanceof BaseMultiTileEntity) + mTextures = ((BaseMultiTileEntity) tCanonicalTileEntity).mTextures; } @Override @@ -153,7 +155,8 @@ public abstract class BaseMultiTileEntity extends CoverableTileEntity implements if (tRegistry != null) { final MultiTileEntityClassContainer tClass = tRegistry.getClassContainer(mMTEID); if (tClass != null) { - // Add the Default Parameters. Useful for things that differ between different tiers/types of the same machine + // Add the Default Parameters. Useful for things that differ between different tiers/types of the + // same machine aNBT = GT_Util.fuseNBT(aNBT, tClass.mParameters); } } @@ -163,7 +166,8 @@ public abstract class BaseMultiTileEntity extends CoverableTileEntity implements if (aNBT.hasKey("y")) yCoord = aNBT.getInteger("y"); if (aNBT.hasKey("z")) zCoord = aNBT.getInteger("z"); // read the custom Name. - if (aNBT.hasKey(NBT.DISPAY)) mCustomName = aNBT.getCompoundTag(NBT.DISPAY).getString(NBT.CUSTOM_NAME); + if (aNBT.hasKey(NBT.DISPAY)) + mCustomName = aNBT.getCompoundTag(NBT.DISPAY).getString(NBT.CUSTOM_NAME); // And now everything else. try { @@ -173,7 +177,7 @@ public abstract class BaseMultiTileEntity extends CoverableTileEntity implements mOwnerName = aNBT.getString(NBT.OWNER); try { mOwnerUuid = UUID.fromString(aNBT.getString(NBT.OWNER_UUID)); - } catch (IllegalArgumentException e){ + } catch (IllegalArgumentException e) { mOwnerUuid = null; } if (aNBT.hasKey(NBT.LOCK_UPGRADE)) mLockUpgrade = aNBT.getBoolean(NBT.LOCK_UPGRADE); @@ -182,15 +186,15 @@ public abstract class BaseMultiTileEntity extends CoverableTileEntity implements readCoverNBT(aNBT); readMultiTileNBT(aNBT); - if(GregTech_API.sBlockIcons == null && aNBT.hasKey(NBT.TEXTURE)) { + if (GregTech_API.sBlockIcons == null && aNBT.hasKey(NBT.TEXTURE)) { loadTextureNBT(aNBT); } else { copyTextures(); } if (mCoverData == null || mCoverData.length != 6) mCoverData = new ISerializableObject[6]; - if (mCoverSides.length != 6) mCoverSides = new int[]{0, 0, 0, 0, 0, 0}; - if (mSidedRedstone.length != 6) mSidedRedstone = new byte[]{15, 15, 15, 15, 15, 15}; + if (mCoverSides.length != 6) mCoverSides = new int[] {0, 0, 0, 0, 0, 0}; + if (mSidedRedstone.length != 6) mSidedRedstone = new byte[] {15, 15, 15, 15, 15, 15}; updateCoverBehavior(); @@ -246,7 +250,6 @@ public abstract class BaseMultiTileEntity extends CoverableTileEntity implements return aNBT; } - @Override public long getTimer() { return 0; @@ -259,7 +262,9 @@ public abstract class BaseMultiTileEntity extends CoverableTileEntity implements @Override public TileEntity getTileEntity(int aX, int aY, int aZ) { - if (worldObj == null || (ignoreUnloadedChunks && crossedChunkBorder(aX, aZ) && !worldObj.blockExists(aX, aY, aZ))) return null; + if (worldObj == null + || (ignoreUnloadedChunks && crossedChunkBorder(aX, aZ) && !worldObj.blockExists(aX, aY, aZ))) + return null; return GT_Util.getTileEntity(worldObj, aX, aY, aZ, true); } @@ -269,7 +274,8 @@ public abstract class BaseMultiTileEntity extends CoverableTileEntity implements } @Override - public boolean shouldRefresh(Block aOldBlock, Block aNewBlock, int aOldMeta, int aNewMeta, World aWorld, int aX, int aY, int aZ) { + public boolean shouldRefresh( + Block aOldBlock, Block aNewBlock, int aOldMeta, int aNewMeta, World aWorld, int aX, int aY, int aZ) { return mShouldRefresh || aOldBlock != aNewBlock; } @@ -282,13 +288,22 @@ public abstract class BaseMultiTileEntity extends CoverableTileEntity implements public void doBlockUpdate() { final Block tBlock = getBlock(getCoords()); worldObj.notifyBlocksOfNeighborChange(xCoord, yCoord, zCoord, tBlock); - if (this instanceof IMTE_IsProvidingStrongPower) for (byte tSide : GT_Values.ALL_VALID_SIDES) { - if (getBlockAtSide(tSide).isNormalCube(worldObj, xCoord + GT_Values.OFFX[tSide], yCoord + GT_Values.OFFY[tSide], zCoord + GT_Values.OFFZ[tSide])) { - worldObj.notifyBlocksOfNeighborChange( - xCoord + GT_Values.OFFX[tSide], yCoord + GT_Values.OFFY[tSide], zCoord + GT_Values.OFFZ[tSide], tBlock, OPOS[tSide] - ); + if (this instanceof IMTE_IsProvidingStrongPower) + for (byte tSide : GT_Values.ALL_VALID_SIDES) { + if (getBlockAtSide(tSide) + .isNormalCube( + worldObj, + xCoord + GT_Values.OFFX[tSide], + yCoord + GT_Values.OFFY[tSide], + zCoord + GT_Values.OFFZ[tSide])) { + worldObj.notifyBlocksOfNeighborChange( + xCoord + GT_Values.OFFX[tSide], + yCoord + GT_Values.OFFY[tSide], + zCoord + GT_Values.OFFZ[tSide], + tBlock, + OPOS[tSide]); + } } - } mDoesBlockUpdate = false; } @@ -297,7 +312,9 @@ public abstract class BaseMultiTileEntity extends CoverableTileEntity implements final TileEntity tTileEntity = getTileEntityAtSideAndDistance(aSide, 1); // TODO: check to an interface // if (getBlockAtSide(aSide) == Blocks.glass) return false; - return tTileEntity instanceof IMultiTileEntity ? !((IMultiTileEntity) tTileEntity).isSurfaceOpaque(OPOS[aSide]) : !getBlockAtSide(aSide).isOpaqueCube(); + return tTileEntity instanceof IMultiTileEntity + ? !((IMultiTileEntity) tTileEntity).isSurfaceOpaque(OPOS[aSide]) + : !getBlockAtSide(aSide).isOpaqueCube(); } @Override @@ -317,37 +334,55 @@ public abstract class BaseMultiTileEntity extends CoverableTileEntity implements return this; } - @Override public int getRenderPasses(Block aBlock) {return 1;} - @Override public boolean usesRenderPass(int aRenderPass) {return true;} - @Override public boolean setBlockBounds(Block aBlock, int aRenderPass) {return false;} - @Override public boolean renderItem(Block aBlock, RenderBlocks aRenderer) {return false;} - @Override public boolean renderBlock(Block aBlock, RenderBlocks aRenderer, IBlockAccess aWorld, int aX, int aY, int aZ) {return false;} + @Override + public int getRenderPasses(Block aBlock) { + return 1; + } + + @Override + public boolean usesRenderPass(int aRenderPass) { + return true; + } + + @Override + public boolean setBlockBounds(Block aBlock, int aRenderPass) { + return false; + } + + @Override + public boolean renderItem(Block aBlock, RenderBlocks aRenderer) { + return false; + } + + @Override + public boolean renderBlock(Block aBlock, RenderBlocks aRenderer, IBlockAccess aWorld, int aX, int aY, int aZ) { + return false; + } @Override public ITexture[] getTexture(Block aBlock, byte aSide) { return getTexture(aBlock, aSide, 1, VALID_SIDES); } - @Override public final ITexture[] getTexture(Block aBlock, byte aSide, int aRenderPass, boolean[] aShouldSideBeRendered) { + @Override + public final ITexture[] getTexture(Block aBlock, byte aSide, int aRenderPass, boolean[] aShouldSideBeRendered) { if (!aShouldSideBeRendered[aSide]) return null; final ITexture coverTexture = getCoverTexture(aSide); final ITexture[] textureUncovered = getTexture(aBlock, aSide, true, aRenderPass); if (coverTexture != null) { - return new ITexture[]{ - GT_MultiTexture.get(textureUncovered), - coverTexture - }; + return new ITexture[] {GT_MultiTexture.get(textureUncovered), coverTexture}; } else { return textureUncovered; } } - @Override public ITexture[] getTexture(Block aBlock, byte aSide, boolean isActive, int aRenderPass) { + @Override + public ITexture[] getTexture(Block aBlock, byte aSide, boolean isActive, int aRenderPass) { // Top, bottom or side - aSide = (byte)Math.min(aSide, 2); - return new ITexture[]{TextureFactory.of(mTextures[aSide], GT_Util.getRGBaArray(mRGBa))}; + aSide = (byte) Math.min(aSide, 2); + return new ITexture[] {TextureFactory.of(mTextures[aSide], GT_Util.getRGBaArray(mRGBa))}; } @Override @@ -403,7 +438,7 @@ public abstract class BaseMultiTileEntity extends CoverableTileEntity implements */ @Override public boolean setMainFacing(byte aSide) { - if(!isValidFacing(aSide)) return false; + if (!isValidFacing(aSide)) return false; mFacing = aSide; issueClientUpdate(); @@ -450,20 +485,35 @@ public abstract class BaseMultiTileEntity extends CoverableTileEntity implements public AxisAlignedBB box(double[] aBox) { return AxisAlignedBB.getBoundingBox( - xCoord + aBox[0], yCoord + aBox[1], zCoord + aBox[2], xCoord + aBox[3], yCoord + aBox[4], zCoord + aBox[5] - ); - } - - public boolean box(AxisAlignedBB aAABB, List<AxisAlignedBB> aList, double aMinX, double aMinY, double aMinZ, double aMaxX, double aMaxY, double aMaxZ) { + xCoord + aBox[0], + yCoord + aBox[1], + zCoord + aBox[2], + xCoord + aBox[3], + yCoord + aBox[4], + zCoord + aBox[5]); + } + + public boolean box( + AxisAlignedBB aAABB, + List<AxisAlignedBB> aList, + double aMinX, + double aMinY, + double aMinZ, + double aMaxX, + double aMaxY, + double aMaxZ) { final AxisAlignedBB tBox = box(aMinX, aMinY, aMinZ, aMaxX, aMaxY, aMaxZ); return tBox.intersectsWith(aAABB) && aList.add(tBox); } @Override - public void onFacingChange() {/*Do nothing*/} + public void onFacingChange() { + /*Do nothing*/ + } public AxisAlignedBB box(double aMinX, double aMinY, double aMinZ, double aMaxX, double aMaxY, double aMaxZ) { - return AxisAlignedBB.getBoundingBox(xCoord + aMinX, yCoord + aMinY, zCoord + aMinZ, xCoord + aMaxX, yCoord + aMaxY, zCoord + aMaxZ); + return AxisAlignedBB.getBoundingBox( + xCoord + aMinX, yCoord + aMinY, zCoord + aMinZ, xCoord + aMaxX, yCoord + aMaxY, zCoord + aMaxZ); } @Override @@ -477,7 +527,9 @@ public abstract class BaseMultiTileEntity extends CoverableTileEntity implements } @Override - public void onMachineBlockUpdate() {/*Do nothing*/} + public void onMachineBlockUpdate() { + /*Do nothing*/ + } public boolean box(AxisAlignedBB aAABB, List<AxisAlignedBB> aList, float[] aBox) { final AxisAlignedBB tBox = box(aBox[0], aBox[1], aBox[2], aBox[3], aBox[4], aBox[5]); @@ -490,7 +542,13 @@ public abstract class BaseMultiTileEntity extends CoverableTileEntity implements } public AxisAlignedBB box(float[] aBox) { - return AxisAlignedBB.getBoundingBox(xCoord + aBox[0], yCoord + aBox[1], zCoord + aBox[2], xCoord + aBox[3], yCoord + aBox[4], zCoord + aBox[5]); + return AxisAlignedBB.getBoundingBox( + xCoord + aBox[0], + yCoord + aBox[1], + zCoord + aBox[2], + xCoord + aBox[3], + yCoord + aBox[4], + zCoord + aBox[5]); } public boolean box(Block aBlock) { @@ -513,16 +571,15 @@ public abstract class BaseMultiTileEntity extends CoverableTileEntity implements } public boolean box(Block aBlock, double[] aBox) { - aBlock.setBlockBounds((float) aBox[0], (float) aBox[1], (float) aBox[2], (float) aBox[3], (float) aBox[4], (float) aBox[5]); + aBlock.setBlockBounds( + (float) aBox[0], (float) aBox[1], (float) aBox[2], (float) aBox[3], (float) aBox[4], (float) aBox[5]); return true; } - protected void markBlockForUpdate() { worldObj.markBlockForUpdate(xCoord, yCoord, zCoord); - //worldObj.func_147479_m(xCoord, yCoord, zCoord); + // worldObj.func_147479_m(xCoord, yCoord, zCoord); mNeedsUpdate = false; - } public boolean box(Block aBlock, float[] aBox) { @@ -535,7 +592,8 @@ public abstract class BaseMultiTileEntity extends CoverableTileEntity implements /* empty */ } - public boolean box(Block aBlock, double aMinX, double aMinY, double aMinZ, double aMaxX, double aMaxY, double aMaxZ) { + public boolean box( + Block aBlock, double aMinX, double aMinY, double aMinZ, double aMaxX, double aMaxY, double aMaxZ) { aBlock.setBlockBounds((float) aMinX, (float) aMinY, (float) aMinZ, (float) aMaxX, (float) aMaxY, (float) aMaxZ); return true; } @@ -612,9 +670,7 @@ public abstract class BaseMultiTileEntity extends CoverableTileEntity implements } @Override - public void onBlockAdded() { - - } + public void onBlockAdded() {} @Override public String getOwnerName() { @@ -639,7 +695,17 @@ public abstract class BaseMultiTileEntity extends CoverableTileEntity implements } @Override - public boolean onPlaced(ItemStack aStack, EntityPlayer aPlayer, World aWorld, int aX, int aY, int aZ, byte aSide, float aHitX, float aHitY, float aHitZ) { + public boolean onPlaced( + ItemStack aStack, + EntityPlayer aPlayer, + World aWorld, + int aX, + int aY, + int aZ, + byte aSide, + float aHitX, + float aHitY, + float aHitZ) { mFacing = getSideForPlayerPlacing(aPlayer, mFacing, getValidFacings()); onFacingChange(); return true; @@ -658,23 +724,26 @@ public abstract class BaseMultiTileEntity extends CoverableTileEntity implements public boolean onBlockActivated(EntityPlayer aPlayer, byte aSide, float aX, float aY, float aZ) { try { return allowRightclick(aPlayer) && onRightClick(aPlayer, aSide, aX, aY, aZ); - } catch(Throwable e) { + } catch (Throwable e) { e.printStackTrace(GT_Log.err); return true; } } + @Override public boolean onRightClick(EntityPlayer aPlayer, byte aSide, float aX, float aY, float aZ) { if (isClientSide()) { - //Configure Cover, sneak can also be: screwdriver, wrench, side cutter, soldering iron + // Configure Cover, sneak can also be: screwdriver, wrench, side cutter, soldering iron if (aPlayer.isSneaking()) { - final byte tSide = (getCoverIDAtSide(aSide) == 0) ? GT_Utility.determineWrenchingSide(aSide, aX, aY, aZ) : aSide; + final byte tSide = + (getCoverIDAtSide(aSide) == 0) ? GT_Utility.determineWrenchingSide(aSide, aX, aY, aZ) : aSide; return (getCoverBehaviorAtSideNew(tSide).hasCoverGUI()); } else if (getCoverBehaviorAtSideNew(aSide).onCoverRightclickClient(aSide, this, aPlayer, aX, aY, aZ)) { return true; } - if (!getCoverBehaviorAtSideNew(aSide).isGUIClickable(aSide, getCoverIDAtSide(aSide), getComplexCoverDataAtSide(aSide), this)) + if (!getCoverBehaviorAtSideNew(aSide) + .isGUIClickable(aSide, getCoverIDAtSide(aSide), getComplexCoverDataAtSide(aSide), this)) return false; } if (isServerSide()) { @@ -682,27 +751,35 @@ public abstract class BaseMultiTileEntity extends CoverableTileEntity implements final ItemStack tCurrentItem = aPlayer.inventory.getCurrentItem(); final byte wrenchSide = GT_Utility.determineWrenchingSide(aSide, aX, aY, aZ); - if(tCurrentItem != null) { - if (getColorization() >= 0 && GT_Utility.areStacksEqual(new ItemStack(Items.water_bucket, 1), tCurrentItem)) { + if (tCurrentItem != null) { + if (getColorization() >= 0 + && GT_Utility.areStacksEqual(new ItemStack(Items.water_bucket, 1), tCurrentItem)) { // TODO (Colorization) } - if (GT_Utility.isStackInList(tCurrentItem, GregTech_API.sWrenchList)) return onWrenchRightClick(aPlayer, tCurrentItem, wrenchSide, aX, aY, aZ); - if (GT_Utility.isStackInList(tCurrentItem, GregTech_API.sScrewdriverList)) return onScrewdriverRightClick(aPlayer, tCurrentItem, wrenchSide, aX, aY, aZ); - if (GT_Utility.isStackInList(tCurrentItem, GregTech_API.sHardHammerList)) return onHammerRightClick(aPlayer, tCurrentItem, wrenchSide, aX, aY, aZ); - if (GT_Utility.isStackInList(tCurrentItem, GregTech_API.sSoftHammerList)) return onMalletRightClick(aPlayer, tCurrentItem, wrenchSide, aX, aY, aZ); - if (GT_Utility.isStackInList(tCurrentItem, GregTech_API.sSolderingToolList)) return onSolderingRightClick(aPlayer, tCurrentItem, wrenchSide, aX, aY, aZ); - if (GT_Utility.isStackInList(tCurrentItem, GregTech_API.sWireCutterList)) return onWireCutterRightClick(aPlayer, tCurrentItem, wrenchSide, aX, aY, aZ); + if (GT_Utility.isStackInList(tCurrentItem, GregTech_API.sWrenchList)) + return onWrenchRightClick(aPlayer, tCurrentItem, wrenchSide, aX, aY, aZ); + if (GT_Utility.isStackInList(tCurrentItem, GregTech_API.sScrewdriverList)) + return onScrewdriverRightClick(aPlayer, tCurrentItem, wrenchSide, aX, aY, aZ); + if (GT_Utility.isStackInList(tCurrentItem, GregTech_API.sHardHammerList)) + return onHammerRightClick(aPlayer, tCurrentItem, wrenchSide, aX, aY, aZ); + if (GT_Utility.isStackInList(tCurrentItem, GregTech_API.sSoftHammerList)) + return onMalletRightClick(aPlayer, tCurrentItem, wrenchSide, aX, aY, aZ); + if (GT_Utility.isStackInList(tCurrentItem, GregTech_API.sSolderingToolList)) + return onSolderingRightClick(aPlayer, tCurrentItem, wrenchSide, aX, aY, aZ); + if (GT_Utility.isStackInList(tCurrentItem, GregTech_API.sWireCutterList)) + return onWireCutterRightClick(aPlayer, tCurrentItem, wrenchSide, aX, aY, aZ); final byte coverSide = getCoverIDAtSide(aSide) == 0 ? wrenchSide : aSide; if (getCoverIDAtSide(coverSide) == 0) { if (GT_Utility.isStackInList(tCurrentItem, GregTech_API.sCovers.keySet())) { - if (GregTech_API.getCoverBehaviorNew(tCurrentItem).isCoverPlaceable(coverSide, tCurrentItem, this) && - allowCoverOnSide(coverSide, new GT_ItemStack(tCurrentItem))) - { + if (GregTech_API.getCoverBehaviorNew(tCurrentItem) + .isCoverPlaceable(coverSide, tCurrentItem, this) + && allowCoverOnSide(coverSide, new GT_ItemStack(tCurrentItem))) { setCoverItemAtSide(coverSide, tCurrentItem); if (!aPlayer.capabilities.isCreativeMode) tCurrentItem.stackSize--; - GT_Utility.sendSoundToPlayers(worldObj, SoundResource.IC2_TOOLS_WRENCH, 1.0F, -1, xCoord, yCoord, zCoord); + GT_Utility.sendSoundToPlayers( + worldObj, SoundResource.IC2_TOOLS_WRENCH, 1.0F, -1, xCoord, yCoord, zCoord); issueClientUpdate(); } sendCoverDataIfNeeded(); @@ -711,63 +788,97 @@ public abstract class BaseMultiTileEntity extends CoverableTileEntity implements } else { if (GT_Utility.isStackInList(tCurrentItem, GregTech_API.sCrowbarList)) { if (GT_ModHandler.damageOrDechargeItem(tCurrentItem, 1, 1000, aPlayer)) { - GT_Utility.sendSoundToPlayers(worldObj, SoundResource.RANDOM_BREAK, 1.0F, -1, xCoord, yCoord, zCoord); + GT_Utility.sendSoundToPlayers( + worldObj, SoundResource.RANDOM_BREAK, 1.0F, -1, xCoord, yCoord, zCoord); dropCover(coverSide, aSide, false); } sendCoverDataIfNeeded(); return true; } } - } else if (aPlayer.isSneaking()) { //Sneak click, no tool -> open cover config if possible. - aSide = (getCoverIDAtSide(aSide) == 0) ? GT_Utility.determineWrenchingSide(aSide, aX, aY, aZ) : aSide; - return getCoverIDAtSide(aSide) > 0 && getCoverBehaviorAtSideNew(aSide).onCoverShiftRightClick(aSide, getCoverIDAtSide(aSide), getComplexCoverDataAtSide(aSide), this, aPlayer); + } else if (aPlayer.isSneaking()) { // Sneak click, no tool -> open cover config if possible. + aSide = (getCoverIDAtSide(aSide) == 0) + ? GT_Utility.determineWrenchingSide(aSide, aX, aY, aZ) + : aSide; + return getCoverIDAtSide(aSide) > 0 + && getCoverBehaviorAtSideNew(aSide) + .onCoverShiftRightClick( + aSide, + getCoverIDAtSide(aSide), + getComplexCoverDataAtSide(aSide), + this, + aPlayer); } - if (getCoverBehaviorAtSideNew(aSide).onCoverRightClick(aSide, getCoverIDAtSide(aSide), getComplexCoverDataAtSide(aSide), this, aPlayer, aX, aY, aZ)) - return true; - - if (!getCoverBehaviorAtSideNew(aSide).isGUIClickable(aSide, getCoverIDAtSide(aSide), getComplexCoverDataAtSide(aSide), this)) + if (getCoverBehaviorAtSideNew(aSide) + .onCoverRightClick( + aSide, + getCoverIDAtSide(aSide), + getComplexCoverDataAtSide(aSide), + this, + aPlayer, + aX, + aY, + aZ)) return true; + + if (!getCoverBehaviorAtSideNew(aSide) + .isGUIClickable(aSide, getCoverIDAtSide(aSide), getComplexCoverDataAtSide(aSide), this)) return false; - - } } return false; } - public boolean onWrenchRightClick(EntityPlayer aPlayer, ItemStack tCurrentItem, byte wrenchSide, float aX, float aY, float aZ) { - if(setMainFacing(wrenchSide)) { + public boolean onWrenchRightClick( + EntityPlayer aPlayer, ItemStack tCurrentItem, byte wrenchSide, float aX, float aY, float aZ) { + if (setMainFacing(wrenchSide)) { GT_ModHandler.damageOrDechargeItem(tCurrentItem, 1, 1000, aPlayer); GT_Utility.sendSoundToPlayers(worldObj, SoundResource.IC2_TOOLS_WRENCH, 1.0F, -1, xCoord, yCoord, zCoord); } return true; } - public boolean onScrewdriverRightClick(EntityPlayer aPlayer, ItemStack tCurrentItem, byte wrenchSide, float aX, float aY, float aZ) { + public boolean onScrewdriverRightClick( + EntityPlayer aPlayer, ItemStack tCurrentItem, byte wrenchSide, float aX, float aY, float aZ) { if (GT_ModHandler.damageOrDechargeItem(tCurrentItem, 1, 200, aPlayer)) { - setCoverDataAtSide(wrenchSide, getCoverBehaviorAtSideNew(wrenchSide).onCoverScrewdriverClick(wrenchSide, getCoverIDAtSide(wrenchSide), getComplexCoverDataAtSide(wrenchSide), this, aPlayer, aX, aY, aZ)); + setCoverDataAtSide( + wrenchSide, + getCoverBehaviorAtSideNew(wrenchSide) + .onCoverScrewdriverClick( + wrenchSide, + getCoverIDAtSide(wrenchSide), + getComplexCoverDataAtSide(wrenchSide), + this, + aPlayer, + aX, + aY, + aZ)); // TODO: Update connections! GT_Utility.sendSoundToPlayers(worldObj, SoundResource.IC2_TOOLS_WRENCH, 1.0F, -1, xCoord, yCoord, zCoord); } return true; } - public boolean onHammerRightClick(EntityPlayer aPlayer, ItemStack tCurrentItem, byte wrenchSide, float aX, float aY, float aZ) { + public boolean onHammerRightClick( + EntityPlayer aPlayer, ItemStack tCurrentItem, byte wrenchSide, float aX, float aY, float aZ) { return true; } - public boolean onMalletRightClick(EntityPlayer aPlayer, ItemStack tCurrentItem, byte wrenchSide, float aX, float aY, float aZ) { + public boolean onMalletRightClick( + EntityPlayer aPlayer, ItemStack tCurrentItem, byte wrenchSide, float aX, float aY, float aZ) { return true; } - public boolean onSolderingRightClick(EntityPlayer aPlayer, ItemStack tCurrentItem, byte wrenchSide, float aX, float aY, float aZ) { + public boolean onSolderingRightClick( + EntityPlayer aPlayer, ItemStack tCurrentItem, byte wrenchSide, float aX, float aY, float aZ) { return true; } - public boolean onWireCutterRightClick(EntityPlayer aPlayer, ItemStack tCurrentItem, byte wrenchSide, float aX, float aY, float aZ) { + public boolean onWireCutterRightClick( + EntityPlayer aPlayer, ItemStack tCurrentItem, byte wrenchSide, float aX, float aY, float aZ) { return true; } @@ -783,9 +894,7 @@ public abstract class BaseMultiTileEntity extends CoverableTileEntity implements } @Override - public void onExploded(Explosion aExplosion) { - - } + public void onExploded(Explosion aExplosion) {} @Override public boolean isSideSolid(byte aSide) { @@ -800,28 +909,26 @@ public abstract class BaseMultiTileEntity extends CoverableTileEntity implements return rList; } - @Override - public boolean getSubItems(MultiTileEntityBlockInternal aBlock, Item aItem, CreativeTabs aTab, List<ItemStack> aList, short aID) { + public boolean getSubItems( + MultiTileEntityBlockInternal aBlock, Item aItem, CreativeTabs aTab, List<ItemStack> aList, short aID) { return true; } - @Override public boolean recolourBlock(byte aSide, byte aColor) { -// if (aColor > 15 || aColor < -1) aColor = -1; -// if(paint((byte) (aColor + 1))) { -//// updateClientData(); -//// causeBlockUpdate(); -// return true; -// } -// if (unpaint()) {updateClientData(); causeBlockUpdate(); return T;} -// mColor = (byte) (aColor + 1); -//// if (canAccessData()) mMetaTileEntity.onColorChangeServer(aColor); + // if (aColor > 15 || aColor < -1) aColor = -1; + // if(paint((byte) (aColor + 1))) { + //// updateClientData(); + //// causeBlockUpdate(); + // return true; + // } + // if (unpaint()) {updateClientData(); causeBlockUpdate(); return T;} + // mColor = (byte) (aColor + 1); + //// if (canAccessData()) mMetaTileEntity.onColorChangeServer(aColor); return false; } - @Override public boolean playerOwnsThis(EntityPlayer aPlayer, boolean aCheckPrecicely) { if (aCheckPrecicely || privateAccess() || (mOwnerName.length() == 0)) @@ -829,8 +936,10 @@ public abstract class BaseMultiTileEntity extends CoverableTileEntity implements setOwnerName(aPlayer.getDisplayName()); setOwnerUuid(aPlayer.getUniqueID()); } else - return !privateAccess() || aPlayer.getDisplayName().equals("Player") || mOwnerName.equals("Player") || mOwnerName.equals( - aPlayer.getDisplayName()); + return !privateAccess() + || aPlayer.getDisplayName().equals("Player") + || mOwnerName.equals("Player") + || mOwnerName.equals(aPlayer.getDisplayName()); return true; } @@ -848,15 +957,27 @@ public abstract class BaseMultiTileEntity extends CoverableTileEntity implements */ public GT_Packet_New getClientDataPacket() { return new GT_Packet_TileEntity( - xCoord, (short) yCoord, zCoord, - getMultiTileEntityRegistryID(), getMultiTileEntityID(), - mCoverSides[0], mCoverSides[1], mCoverSides[2], mCoverSides[3], mCoverSides[4], mCoverSides[5], - (byte) ((mFacing & 7) | (mRedstone ? 16 : 0)), - (byte) getTextureData(), /*getTexturePage()*/ - (byte) 0, /*getUpdateData()*/ - (byte) (((mSidedRedstone[0] > 0) ? 1 : 0) | ((mSidedRedstone[1] > 0) ? 2 : 0) | ((mSidedRedstone[2] > 0) ? 4 : 0) | ((mSidedRedstone[3] > 0) ? 8 : 0) | ((mSidedRedstone[4] > 0) ? 16 : 0) | ((mSidedRedstone[5] > 0) ? 32 : 0)), - mColor - ); + xCoord, + (short) yCoord, + zCoord, + getMultiTileEntityRegistryID(), + getMultiTileEntityID(), + mCoverSides[0], + mCoverSides[1], + mCoverSides[2], + mCoverSides[3], + mCoverSides[4], + mCoverSides[5], + (byte) ((mFacing & 7) | (mRedstone ? 16 : 0)), + (byte) getTextureData(), /*getTexturePage()*/ + (byte) 0, /*getUpdateData()*/ + (byte) (((mSidedRedstone[0] > 0) ? 1 : 0) + | ((mSidedRedstone[1] > 0) ? 2 : 0) + | ((mSidedRedstone[2] > 0) ? 4 : 0) + | ((mSidedRedstone[3] > 0) ? 8 : 0) + | ((mSidedRedstone[4] > 0) ? 16 : 0) + | ((mSidedRedstone[5] > 0) ? 32 : 0)), + mColor); } @Override @@ -866,29 +987,34 @@ public abstract class BaseMultiTileEntity extends CoverableTileEntity implements } @Override - public void getWailaBody(ItemStack itemStack, List<String> currenttip, IWailaDataAccessor accessor, IWailaConfigHandler config) { + public void getWailaBody( + ItemStack itemStack, List<String> currenttip, IWailaDataAccessor accessor, IWailaConfigHandler config) { super.getWailaBody(itemStack, currenttip, accessor, config); - currenttip.add(String.format("Facing: %s", ForgeDirection.getOrientation(getFrontFacing()).name())); + currenttip.add(String.format( + "Facing: %s", ForgeDirection.getOrientation(getFrontFacing()).name())); } @Override - public void getWailaNBTData(EntityPlayerMP player, TileEntity tile, NBTTagCompound tag, World world, int x, int y, int z) { + public void getWailaNBTData( + EntityPlayerMP player, TileEntity tile, NBTTagCompound tag, World world, int x, int y, int z) { super.getWailaNBTData(player, tile, tag, world, x, y, z); } - @Override - public void sendClientData( EntityPlayerMP aPlayer) { - if(worldObj == null || worldObj.isRemote) return; + public void sendClientData(EntityPlayerMP aPlayer) { + if (worldObj == null || worldObj.isRemote) return; final GT_Packet_New tPacket = getClientDataPacket(); - if(aPlayer == null) { + if (aPlayer == null) { GT_Values.NW.sendPacketToAllPlayersInRange(worldObj, tPacket, getXCoord(), getZCoord()); } else { GT_Values.NW.sendToPlayer(tPacket, aPlayer); } sendCoverDataIfNeeded(); } - public void setTextureData(byte aValue) {/*Do nothing*/} + + public void setTextureData(byte aValue) { + /*Do nothing*/ + } @Override public boolean receiveClientEvent(int aEventID, int aValue) { @@ -898,15 +1024,15 @@ public abstract class BaseMultiTileEntity extends CoverableTileEntity implements switch (aEventID) { case GregTechTileClientEvents.CHANGE_COMMON_DATA: mFacing = (byte) (aValue & 7); - //mActive = ((aValue & 8) != 0); + // mActive = ((aValue & 8) != 0); mRedstone = ((aValue & 16) != 0); - //mLockUpgrade = ((aValue&32) != 0); - //mWorks = ((aValue & 64) != 0); + // mLockUpgrade = ((aValue&32) != 0); + // mWorks = ((aValue & 64) != 0); break; case GregTechTileClientEvents.CHANGE_CUSTOM_DATA: if ((aValue & 0x80) != 0) // Is texture index - setTextureData((byte) (aValue & 0x7F)); - //else if (mMetaTileEntity instanceof GT_MetaTileEntity_Hatch)//is texture page and hatch + setTextureData((byte) (aValue & 0x7F)); + // else if (mMetaTileEntity instanceof GT_MetaTileEntity_Hatch)//is texture page and hatch // ((GT_MetaTileEntity_Hatch) mMetaTileEntity).onTexturePageUpdate((byte) (aValue & 0x7F)); break; case GregTechTileClientEvents.CHANGE_COLOR: @@ -921,21 +1047,21 @@ public abstract class BaseMultiTileEntity extends CoverableTileEntity implements mSidedRedstone[4] = (byte) ((aValue & 16) == 16 ? 15 : 0); mSidedRedstone[5] = (byte) ((aValue & 32) == 32 ? 15 : 0); break; -// case GregTechTileClientEvents.DO_SOUND: -// if (mTickTimer > 20) -// doSound((byte) aValue, xCoord + 0.5, yCoord + 0.5, zCoord + 0.5); -// break; -// case GregTechTileClientEvents.START_SOUND_LOOP: -// if (mTickTimer > 20) -// startSoundLoop((byte) aValue, xCoord + 0.5, yCoord + 0.5, zCoord + 0.5); -// break; -// case GregTechTileClientEvents.STOP_SOUND_LOOP: -// if (mTickTimer > 20) -// stopSoundLoop((byte) aValue, xCoord + 0.5, yCoord + 0.5, zCoord + 0.5); -// break; -// case GregTechTileClientEvents.CHANGE_LIGHT: -// mLightValue = (byte) aValue; -// break; + // case GregTechTileClientEvents.DO_SOUND: + // if (mTickTimer > 20) + // doSound((byte) aValue, xCoord + 0.5, yCoord + 0.5, zCoord + 0.5); + // break; + // case GregTechTileClientEvents.START_SOUND_LOOP: + // if (mTickTimer > 20) + // startSoundLoop((byte) aValue, xCoord + 0.5, yCoord + 0.5, zCoord + 0.5); + // break; + // case GregTechTileClientEvents.STOP_SOUND_LOOP: + // if (mTickTimer > 20) + // stopSoundLoop((byte) aValue, xCoord + 0.5, yCoord + 0.5, zCoord + 0.5); + // break; + // case GregTechTileClientEvents.CHANGE_LIGHT: + // mLightValue = (byte) aValue; + // break; } } return true; @@ -950,10 +1076,10 @@ public abstract class BaseMultiTileEntity extends CoverableTileEntity implements public ArrayList<String> getDebugInfo(EntityPlayer aPlayer, int aLogLevel) { final ArrayList<String> tList = new ArrayList<>(); if (aLogLevel > 2) { - tList.add("MultiTileRegistry-ID: " + EnumChatFormatting.BLUE + mMTERegistry + EnumChatFormatting.RESET + " MultiTile-ID: " + EnumChatFormatting.BLUE + mMTEID + EnumChatFormatting.RESET); + tList.add("MultiTileRegistry-ID: " + EnumChatFormatting.BLUE + mMTERegistry + EnumChatFormatting.RESET + + " MultiTile-ID: " + EnumChatFormatting.BLUE + mMTEID + EnumChatFormatting.RESET); } - if(joinedIc2Enet) - tList.add("Joined IC2 ENet"); + if (joinedIc2Enet) tList.add("Joined IC2 ENet"); addDebugInfo(aPlayer, aLogLevel, tList); @@ -967,33 +1093,48 @@ public abstract class BaseMultiTileEntity extends CoverableTileEntity implements /** * Fluid - A Default implementation of the Fluid Tank behaviour, so that every TileEntity can use this to simplify its Code. */ - protected IFluidTank getFluidTankFillable(byte aSide, FluidStack aFluidToFill) {return null;} - protected IFluidTank getFluidTankDrainable(byte aSide, FluidStack aFluidToDrain) {return null;} - protected IFluidTank[] getFluidTanks(byte aSide) { return GT_Values.emptyFluidTank; } + protected IFluidTank getFluidTankFillable(byte aSide, FluidStack aFluidToFill) { + return null; + } - public boolean isLiquidInput(byte aSide) {return true;} + protected IFluidTank getFluidTankDrainable(byte aSide, FluidStack aFluidToDrain) { + return null; + } - public boolean isLiquidOutput(byte aSide) {return true;} + protected IFluidTank[] getFluidTanks(byte aSide) { + return GT_Values.emptyFluidTank; + } + + public boolean isLiquidInput(byte aSide) { + return true; + } + + public boolean isLiquidOutput(byte aSide) { + return true; + } @Override public int fill(ForgeDirection aDirection, FluidStack aFluid, boolean aDoFill) { if (aFluid == null || aFluid.amount <= 0) return 0; - final IFluidTank tTank = getFluidTankFillable((byte)aDirection.ordinal(), aFluid); + final IFluidTank tTank = getFluidTankFillable((byte) aDirection.ordinal(), aFluid); return (tTank == null) ? 0 : tTank.fill(aFluid, aDoFill); } @Override public FluidStack drain(ForgeDirection aDirection, FluidStack aFluid, boolean aDoDrain) { if (aFluid == null || aFluid.amount <= 0) return null; - final IFluidTank tTank = getFluidTankDrainable((byte)aDirection.ordinal(), aFluid); - if (tTank == null || tTank.getFluid() == null || tTank.getFluidAmount() == 0 || !tTank.getFluid().isFluidEqual(aFluid)) return null; + final IFluidTank tTank = getFluidTankDrainable((byte) aDirection.ordinal(), aFluid); + if (tTank == null + || tTank.getFluid() == null + || tTank.getFluidAmount() == 0 + || !tTank.getFluid().isFluidEqual(aFluid)) return null; return tTank.drain(aFluid.amount, aDoDrain); } @Override public FluidStack drain(ForgeDirection aDirection, int aAmountToDrain, boolean aDoDrain) { if (aAmountToDrain <= 0) return null; - final IFluidTank tTank = getFluidTankDrainable((byte)aDirection.ordinal(), null); + final IFluidTank tTank = getFluidTankDrainable((byte) aDirection.ordinal(), null); if (tTank == null || tTank.getFluid() == null || tTank.getFluidAmount() == 0) return null; return tTank.drain(aAmountToDrain, aDoDrain); } @@ -1001,20 +1142,20 @@ public abstract class BaseMultiTileEntity extends CoverableTileEntity implements @Override public boolean canFill(ForgeDirection aDirection, Fluid aFluid) { if (aFluid == null) return false; - final IFluidTank tTank = getFluidTankFillable((byte)aDirection.ordinal(), new FluidStack(aFluid, 0)); + final IFluidTank tTank = getFluidTankFillable((byte) aDirection.ordinal(), new FluidStack(aFluid, 0)); 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)); + final IFluidTank tTank = getFluidTankDrainable((byte) aDirection.ordinal(), new FluidStack(aFluid, 0)); return tTank != null && (tTank.getFluid() != null && tTank.getFluid().getFluid() == aFluid); } @Override public FluidTankInfo[] getTankInfo(ForgeDirection aDirection) { - final IFluidTank[] tTanks = getFluidTanks((byte)aDirection.ordinal()); + final IFluidTank[] tTanks = getFluidTanks((byte) aDirection.ordinal()); if (tTanks == null || tTanks.length <= 0) return GT_Values.emptyFluidTankInfo; final FluidTankInfo[] rInfo = new FluidTankInfo[tTanks.length]; for (int i = 0; i < tTanks.length; i++) rInfo[i] = new FluidTankInfo(tTanks[i]); @@ -1024,69 +1165,210 @@ public abstract class BaseMultiTileEntity extends CoverableTileEntity implements /** * Energy - Do nothing by Default */ - @Override public boolean isUniversalEnergyStored(long aEnergyAmount) { return false; } - @Override public long getUniversalEnergyStored() { return 0; } - @Override public long getUniversalEnergyCapacity() { return 0; } - @Override public long getOutputAmperage() { return 0; } - @Override public long getOutputVoltage() { return 0; } - @Override public long getInputAmperage() { return 0; } - @Override public long getInputVoltage() { return 0; } - @Override public boolean decreaseStoredEnergyUnits(long aEnergy, boolean aIgnoreTooLessEnergy) { return false; } - @Override public boolean increaseStoredEnergyUnits(long aEnergy, boolean aIgnoreTooMuchEnergy) { return false; } - @Override public boolean drainEnergyUnits(byte aSide, long aVoltage, long aAmperage) { return false; } - @Override public long getAverageElectricInput() { return 0; } - @Override public long getAverageElectricOutput() { return 0; } - @Override public long getStoredEU() { return 0; } - @Override public long getEUCapacity() { return 0; } - @Override public long injectEnergyUnits(byte aSide, long aVoltage, long aAmperage) { return 0; } - @Override public boolean inputEnergyFrom(byte aSide) { return false; } - @Override public boolean outputsEnergyTo(byte aSide) { return false; } + @Override + public boolean isUniversalEnergyStored(long aEnergyAmount) { + return false; + } + + @Override + public long getUniversalEnergyStored() { + return 0; + } + + @Override + public long getUniversalEnergyCapacity() { + return 0; + } + + @Override + public long getOutputAmperage() { + return 0; + } + + @Override + public long getOutputVoltage() { + return 0; + } + + @Override + public long getInputAmperage() { + return 0; + } + + @Override + public long getInputVoltage() { + return 0; + } + + @Override + public boolean decreaseStoredEnergyUnits(long aEnergy, boolean aIgnoreTooLessEnergy) { + return false; + } + + @Override + public boolean increaseStoredEnergyUnits(long aEnergy, boolean aIgnoreTooMuchEnergy) { + return false; + } + + @Override + public boolean drainEnergyUnits(byte aSide, long aVoltage, long aAmperage) { + return false; + } + + @Override + public long getAverageElectricInput() { + return 0; + } + + @Override + public long getAverageElectricOutput() { + return 0; + } + + @Override + public long getStoredEU() { + return 0; + } + + @Override + public long getEUCapacity() { + return 0; + } + + @Override + public long injectEnergyUnits(byte aSide, long aVoltage, long aAmperage) { + return 0; + } + + @Override + public boolean inputEnergyFrom(byte aSide) { + return false; + } + + @Override + public boolean outputsEnergyTo(byte aSide) { + return false; + } /** * Inventory - Do nothing by default */ - @Override public void openInventory() { /* Do nothing */ } - @Override public void closeInventory() { /* Do nothing */ } - @Override public boolean hasInventoryBeenModified() { return false; } - @Override public boolean isValidSlot(int aIndex) { return false; } - @Override public boolean addStackToSlot(int aIndex, ItemStack aStack) { return false; } - @Override public boolean addStackToSlot(int aIndex, ItemStack aStack, int aAmount) { return false; } - @Override public int[] getAccessibleSlotsFromSide(int aSide) { return GT_Values.emptyIntArray; } - @Override public boolean canInsertItem(int aSlot, ItemStack aStack, int aSide) { return false; } - @Override public boolean canExtractItem(int aSlot, ItemStack aStack, int aSide) { return false; } - @Override public int getSizeInventory() { return 0; } - @Override public ItemStack getStackInSlot(int aSlot) { return null; } - @Override public ItemStack decrStackSize(int aSlot, int aDecrement) { return null; } - @Override public ItemStack getStackInSlotOnClosing(int aSlot) { return null; } - @Override public void setInventorySlotContents(int aSlot, ItemStack aStack) { /* Do nothing */ } - @Override public int getInventoryStackLimit() { return 0; } - @Override public boolean isItemValidForSlot(int aSlot, ItemStack aStack) { return false; } - @Override public void markInventoryBeenModified() { mInventoryChanged = true; } + @Override + public void openInventory() { + /* Do nothing */ + } + @Override + public void closeInventory() { + /* Do nothing */ + } + + @Override + public boolean hasInventoryBeenModified() { + return false; + } + + @Override + public boolean isValidSlot(int aIndex) { + return false; + } + + @Override + public boolean addStackToSlot(int aIndex, ItemStack aStack) { + return false; + } + + @Override + public boolean addStackToSlot(int aIndex, ItemStack aStack, int aAmount) { + return false; + } + + @Override + public int[] getAccessibleSlotsFromSide(int aSide) { + return GT_Values.emptyIntArray; + } + + @Override + public boolean canInsertItem(int aSlot, ItemStack aStack, int aSide) { + return false; + } + + @Override + public boolean canExtractItem(int aSlot, ItemStack aStack, int aSide) { + return false; + } + + @Override + public int getSizeInventory() { + return 0; + } + + @Override + public ItemStack getStackInSlot(int aSlot) { + return null; + } + + @Override + public ItemStack decrStackSize(int aSlot, int aDecrement) { + return null; + } + + @Override + public ItemStack getStackInSlotOnClosing(int aSlot) { + return null; + } + + @Override + public void setInventorySlotContents(int aSlot, ItemStack aStack) { + /* Do nothing */ + } + + @Override + public int getInventoryStackLimit() { + return 0; + } + + @Override + public boolean isItemValidForSlot(int aSlot, ItemStack aStack) { + return false; + } + + @Override + public void markInventoryBeenModified() { + mInventoryChanged = true; + } /* * Cover Helpers */ public boolean coverLetsFluidIn(byte aSide, Fluid aFluid) { - return getCoverBehaviorAtSideNew(aSide).letsFluidIn(aSide, getCoverIDAtSide(aSide), getComplexCoverDataAtSide(aSide), aFluid, this); + return getCoverBehaviorAtSideNew(aSide) + .letsFluidIn(aSide, getCoverIDAtSide(aSide), getComplexCoverDataAtSide(aSide), aFluid, this); } + public boolean coverLetsFluidOut(byte aSide, Fluid aFluid) { - return getCoverBehaviorAtSideNew(aSide).letsFluidOut(aSide, getCoverIDAtSide(aSide), getComplexCoverDataAtSide(aSide), aFluid, this); + return getCoverBehaviorAtSideNew(aSide) + .letsFluidOut(aSide, getCoverIDAtSide(aSide), getComplexCoverDataAtSide(aSide), aFluid, this); } public boolean coverLetsEnergyIn(byte aSide) { - return getCoverBehaviorAtSideNew(aSide).letsEnergyIn(aSide, getCoverIDAtSide(aSide), getComplexCoverDataAtSide(aSide), this); + return getCoverBehaviorAtSideNew(aSide) + .letsEnergyIn(aSide, getCoverIDAtSide(aSide), getComplexCoverDataAtSide(aSide), this); } + public boolean coverLetsEnergyOut(byte aSide) { - return getCoverBehaviorAtSideNew(aSide).letsEnergyOut(aSide, getCoverIDAtSide(aSide), getComplexCoverDataAtSide(aSide), this); + return getCoverBehaviorAtSideNew(aSide) + .letsEnergyOut(aSide, getCoverIDAtSide(aSide), getComplexCoverDataAtSide(aSide), this); } public boolean coverLetsItemsIn(byte aSide, int aSlot) { - return getCoverBehaviorAtSideNew(aSide).letsItemsIn(aSide, getCoverIDAtSide(aSide), getComplexCoverDataAtSide(aSide), aSlot, this); + return getCoverBehaviorAtSideNew(aSide) + .letsItemsIn(aSide, getCoverIDAtSide(aSide), getComplexCoverDataAtSide(aSide), aSlot, this); } + public boolean coverLetsItemsOut(byte aSide, int aSlot) { - return getCoverBehaviorAtSideNew(aSide).letsItemsOut(aSide, getCoverIDAtSide(aSide), getComplexCoverDataAtSide(aSide), aSlot,this); + return getCoverBehaviorAtSideNew(aSide) + .letsItemsOut(aSide, getCoverIDAtSide(aSide), getComplexCoverDataAtSide(aSide), aSlot, this); } - } diff --git a/src/main/java/gregtech/api/multitileentity/base/BaseNontickableMultiTileEntity.java b/src/main/java/gregtech/api/multitileentity/base/BaseNontickableMultiTileEntity.java index 2e689a6bae..bc6f2439ea 100644 --- a/src/main/java/gregtech/api/multitileentity/base/BaseNontickableMultiTileEntity.java +++ b/src/main/java/gregtech/api/multitileentity/base/BaseNontickableMultiTileEntity.java @@ -1,20 +1,22 @@ package gregtech.api.multitileentity.base; + +import static gregtech.api.enums.GT_Values.NW; + import gregtech.api.net.GT_Packet_SendCoverData; import gregtech.api.util.ISerializableObject; import net.minecraft.entity.player.EntityPlayerMP; import net.minecraft.network.Packet; -import static gregtech.api.enums.GT_Values.NW; - public abstract class BaseNontickableMultiTileEntity extends BaseMultiTileEntity { boolean mConstructed = false; // Keeps track of whether this TE has been constructed and placed in the world + public BaseNontickableMultiTileEntity() { super(false); } @Override public void issueClientUpdate() { - if(worldObj != null && !worldObj.isRemote) sendClientData(null); + if (worldObj != null && !worldObj.isRemote) sendClientData(null); } @Override @@ -30,26 +32,26 @@ public abstract class BaseNontickableMultiTileEntity extends BaseMultiTileEntity @Override public void issueCoverUpdate(byte aSide) { - if(!mConstructed) { + if (!mConstructed) { // Queue these up and send them with the description packet super.issueCoverUpdate(aSide); } else { // Otherwise, send the data right away NW.sendPacketToAllPlayersInRange( - worldObj, - new GT_Packet_SendCoverData(aSide, getCoverIDAtSide(aSide), getComplexCoverDataAtSide(aSide), this), - xCoord, zCoord - ); + worldObj, + new GT_Packet_SendCoverData(aSide, getCoverIDAtSide(aSide), getComplexCoverDataAtSide(aSide), this), + xCoord, + zCoord); // Just in case mCoverNeedUpdate[aSide] = false; } } @Override - public void receiveCoverData(byte aCoverSide, int aCoverID, ISerializableObject aCoverData, EntityPlayerMP aPlayer) { + public void receiveCoverData( + byte aCoverSide, int aCoverID, ISerializableObject aCoverData, EntityPlayerMP aPlayer) { super.receiveCoverData(aCoverSide, aCoverID, aCoverData, aPlayer); // We don't get ticked so issue the texture update right away issueTextureUpdate(); } - } diff --git a/src/main/java/gregtech/api/multitileentity/base/BaseTickableMultiTileEntity.java b/src/main/java/gregtech/api/multitileentity/base/BaseTickableMultiTileEntity.java index c8bc04557f..4945fbc62e 100644 --- a/src/main/java/gregtech/api/multitileentity/base/BaseTickableMultiTileEntity.java +++ b/src/main/java/gregtech/api/multitileentity/base/BaseTickableMultiTileEntity.java @@ -1,5 +1,7 @@ package gregtech.api.multitileentity.base; +import static gregtech.GT_Mod.GT_FML_LOGGER; + import gregtech.api.multitileentity.interfaces.IMultiTileEntity.IMTE_OnNeighborBlockChange; import gregtech.api.util.GT_Log; import gregtech.api.util.GT_Util; @@ -7,8 +9,6 @@ import net.minecraft.block.Block; import net.minecraft.entity.player.EntityPlayerMP; import net.minecraft.world.World; -import static gregtech.GT_Mod.GT_FML_LOGGER; - public abstract class BaseTickableMultiTileEntity extends BaseMultiTileEntity implements IMTE_OnNeighborBlockChange { /** Variable for seeing if the Tick Function is called right now. */ public boolean mIsRunningTick = false; @@ -19,7 +19,6 @@ public abstract class BaseTickableMultiTileEntity extends BaseMultiTileEntity im /** Variable for updating Data to the Client */ private boolean mSendClientData = false; - public BaseTickableMultiTileEntity() { super(true); } @@ -42,7 +41,7 @@ public abstract class BaseTickableMultiTileEntity extends BaseMultiTileEntity im if (!isServerSide) { if (mNeedsUpdate) { worldObj.markBlockForUpdate(xCoord, yCoord, zCoord); - //worldObj.func_147479_m(xCoord, yCoord, zCoord); + // worldObj.func_147479_m(xCoord, yCoord, zCoord); mNeedsUpdate = false; } } @@ -84,16 +83,24 @@ public abstract class BaseTickableMultiTileEntity extends BaseMultiTileEntity im } /** The first part of the Tick. */ - public void onPreTick(long aTick, boolean isServerSide) { /*Do nothing*/ } + public void onPreTick(long aTick, boolean isServerSide) { + /*Do nothing*/ + } /** The regular Tick. */ - public void onTick(long aTimer, boolean isServerSide) { /*Do nothing*/ } + public void onTick(long aTimer, boolean isServerSide) { + /*Do nothing*/ + } /** The absolute last part of the Tick. */ - public void onPostTick(long aTick, boolean isServerSide) { /*Do nothing*/ } + public void onPostTick(long aTick, boolean isServerSide) { + /*Do nothing*/ + } /** Gets called when there is an Exception happening during one of the Tick Functions. */ - public void onTickFailed(long aTimer, boolean isServerSide) { /*Do nothing*/ } + public void onTickFailed(long aTimer, boolean isServerSide) { + /*Do nothing*/ + } @Override public void onNeighborBlockChange(World aWorld, Block aBlock) { @@ -109,5 +116,4 @@ public abstract class BaseTickableMultiTileEntity extends BaseMultiTileEntity im public byte getComparatorValue(byte aSide) { return 0; } - } diff --git a/src/main/java/gregtech/api/multitileentity/interfaces/IMultiBlockController.java b/src/main/java/gregtech/api/multitileentity/interfaces/IMultiBlockController.java index 95b369847f..74d1252eeb 100644 --- a/src/main/java/gregtech/api/multitileentity/interfaces/IMultiBlockController.java +++ b/src/main/java/gregtech/api/multitileentity/interfaces/IMultiBlockController.java @@ -3,17 +3,19 @@ package gregtech.api.multitileentity.interfaces; import net.minecraft.util.ChunkCoordinates; import net.minecraftforge.fluids.FluidStack; -public interface IMultiBlockController extends IMultiTileEntity, IMultiBlockFluidHandler, IMultiBlockInventory, IMultiBlockEnergy { +public interface IMultiBlockController + extends IMultiTileEntity, IMultiBlockFluidHandler, IMultiBlockInventory, IMultiBlockEnergy { boolean checkStructure(boolean aForceReset); /** Set the structure as having changed, and trigger an update */ void onStructureChange(); - @Override ChunkCoordinates getCoords(); + @Override + ChunkCoordinates getCoords(); FluidStack getDrainableFluid(byte aSide); boolean isLiquidInput(byte aSide); - boolean isLiquidOutput(byte aSide); + boolean isLiquidOutput(byte aSide); } diff --git a/src/main/java/gregtech/api/multitileentity/interfaces/IMultiBlockEnergy.java b/src/main/java/gregtech/api/multitileentity/interfaces/IMultiBlockEnergy.java index 3e9892d3bd..4ffd725df5 100644 --- a/src/main/java/gregtech/api/multitileentity/interfaces/IMultiBlockEnergy.java +++ b/src/main/java/gregtech/api/multitileentity/interfaces/IMultiBlockEnergy.java @@ -3,21 +3,37 @@ package gregtech.api.multitileentity.interfaces; import gregtech.api.multitileentity.multiblock.base.MultiBlockPart; interface IMultiBlockEnergy { - boolean isUniversalEnergyStored (MultiBlockPart aPart, long aEnergyAmount); - long getUniversalEnergyStored (MultiBlockPart aPart); - long getUniversalEnergyCapacity (MultiBlockPart aPart); - long getOutputAmperage (MultiBlockPart aPart); - long getOutputVoltage (MultiBlockPart aPart); - long getInputAmperage (MultiBlockPart aPart); - long getInputVoltage (MultiBlockPart aPart); - boolean decreaseStoredEnergyUnits (MultiBlockPart aPart, long aEnergy, boolean aIgnoreTooLittleEnergy); - boolean increaseStoredEnergyUnits (MultiBlockPart aPart, long aEnergy, boolean aIgnoreTooMuchEnergy); - boolean drainEnergyUnits (MultiBlockPart aPart, byte aSide, long aVoltage, long aAmperage); - long injectEnergyUnits (MultiBlockPart aPart, byte aSide, long aVoltage, long aAmperage); - long getAverageElectricInput (MultiBlockPart aPart); - long getAverageElectricOutput (MultiBlockPart aPart); - long getStoredEU (MultiBlockPart aPart); - long getEUCapacity (MultiBlockPart aPart); - boolean inputEnergyFrom (MultiBlockPart aPart, byte aSide); - boolean outputsEnergyTo (MultiBlockPart aPart, byte aSide); + boolean isUniversalEnergyStored(MultiBlockPart aPart, long aEnergyAmount); + + long getUniversalEnergyStored(MultiBlockPart aPart); + + long getUniversalEnergyCapacity(MultiBlockPart aPart); + + long getOutputAmperage(MultiBlockPart aPart); + + long getOutputVoltage(MultiBlockPart aPart); + + long getInputAmperage(MultiBlockPart aPart); + + long getInputVoltage(MultiBlockPart aPart); + + boolean decreaseStoredEnergyUnits(MultiBlockPart aPart, long aEnergy, boolean aIgnoreTooLittleEnergy); + + boolean increaseStoredEnergyUnits(MultiBlockPart aPart, long aEnergy, boolean aIgnoreTooMuchEnergy); + + boolean drainEnergyUnits(MultiBlockPart aPart, byte aSide, long aVoltage, long aAmperage); + + long injectEnergyUnits(MultiBlockPart aPart, byte aSide, long aVoltage, long aAmperage); + + long getAverageElectricInput(MultiBlockPart aPart); + + long getAverageElectricOutput(MultiBlockPart aPart); + + long getStoredEU(MultiBlockPart aPart); + + long getEUCapacity(MultiBlockPart aPart); + + boolean inputEnergyFrom(MultiBlockPart aPart, byte aSide); + + boolean outputsEnergyTo(MultiBlockPart aPart, byte aSide); } diff --git a/src/main/java/gregtech/api/multitileentity/interfaces/IMultiBlockFluidHandler.java b/src/main/java/gregtech/api/multitileentity/interfaces/IMultiBlockFluidHandler.java index 4935ad49ab..e5d2e4f691 100644 --- a/src/main/java/gregtech/api/multitileentity/interfaces/IMultiBlockFluidHandler.java +++ b/src/main/java/gregtech/api/multitileentity/interfaces/IMultiBlockFluidHandler.java @@ -7,10 +7,15 @@ import net.minecraftforge.fluids.FluidStack; import net.minecraftforge.fluids.FluidTankInfo; public interface IMultiBlockFluidHandler { - int fill (MultiBlockPart aPart, ForgeDirection aDirection, FluidStack aFluid, boolean aDoFill); - FluidStack drain (MultiBlockPart aPart, ForgeDirection aDirection, FluidStack aFluid, boolean aDoDrain); - FluidStack drain (MultiBlockPart aPart, ForgeDirection aDirection, int aAmountToDrain, boolean aDoDrain); - boolean canFill (MultiBlockPart aPart, ForgeDirection aDirection, Fluid aFluid); - boolean canDrain (MultiBlockPart aPart, ForgeDirection aDirection, Fluid aFluid); - FluidTankInfo[] getTankInfo (MultiBlockPart aPart, ForgeDirection aDirection); + int fill(MultiBlockPart aPart, ForgeDirection aDirection, FluidStack aFluid, boolean aDoFill); + + FluidStack drain(MultiBlockPart aPart, ForgeDirection aDirection, FluidStack aFluid, boolean aDoDrain); + + FluidStack drain(MultiBlockPart aPart, ForgeDirection aDirection, int aAmountToDrain, boolean aDoDrain); + + boolean canFill(MultiBlockPart aPart, ForgeDirection aDirection, Fluid aFluid); + + boolean canDrain(MultiBlockPart aPart, ForgeDirection aDirection, Fluid aFluid); + + FluidTankInfo[] getTankInfo(MultiBlockPart aPart, ForgeDirection aDirection); } diff --git a/src/main/java/gregtech/api/multitileentity/interfaces/IMultiBlockInventory.java b/src/main/java/gregtech/api/multitileentity/interfaces/IMultiBlockInventory.java index 4df5a11cc0..7e3777fe90 100644 --- a/src/main/java/gregtech/api/multitileentity/interfaces/IMultiBlockInventory.java +++ b/src/main/java/gregtech/api/multitileentity/interfaces/IMultiBlockInventory.java @@ -5,24 +5,43 @@ import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.ItemStack; public interface IMultiBlockInventory { - boolean hasInventoryBeenModified (MultiBlockPart aPart); - boolean isValidSlot (MultiBlockPart aPart, int aIndex); - boolean addStackToSlot (MultiBlockPart aPart, int aIndex, ItemStack aStack); - boolean addStackToSlot (MultiBlockPart aPart, int aIndex, ItemStack aStack, int aAmount); - int[] getAccessibleSlotsFromSide (MultiBlockPart aPart, byte aSide); - boolean canInsertItem (MultiBlockPart aPart, int aSlot, ItemStack aStack, byte aSide); - boolean canExtractItem (MultiBlockPart aPart, int aSlot, ItemStack aStack, byte aSide); - int getSizeInventory (MultiBlockPart aPart); - ItemStack getStackInSlot (MultiBlockPart aPart, int aSlot); - ItemStack decrStackSize (MultiBlockPart aPart, int aSlot, int aDecrement); - ItemStack getStackInSlotOnClosing (MultiBlockPart aPart, int aSlot); - void setInventorySlotContents (MultiBlockPart aPart, int aSlot, ItemStack aStack); - String getInventoryName (MultiBlockPart aPart); - boolean hasCustomInventoryName (MultiBlockPart aPart); - int getInventoryStackLimit (MultiBlockPart aPart); - void markDirty (MultiBlockPart aPart); - boolean isUseableByPlayer (MultiBlockPart aPart, EntityPlayer aPlayer); - void openInventory (MultiBlockPart aPart); - void closeInventory (MultiBlockPart aPart); - boolean isItemValidForSlot (MultiBlockPart aPart, int aSlot, ItemStack aStack); + boolean hasInventoryBeenModified(MultiBlockPart aPart); + + boolean isValidSlot(MultiBlockPart aPart, int aIndex); + + boolean addStackToSlot(MultiBlockPart aPart, int aIndex, ItemStack aStack); + + boolean addStackToSlot(MultiBlockPart aPart, int aIndex, ItemStack aStack, int aAmount); + + int[] getAccessibleSlotsFromSide(MultiBlockPart aPart, byte aSide); + + boolean canInsertItem(MultiBlockPart aPart, int aSlot, ItemStack aStack, byte aSide); + + boolean canExtractItem(MultiBlockPart aPart, int aSlot, ItemStack aStack, byte aSide); + + int getSizeInventory(MultiBlockPart aPart); + + ItemStack getStackInSlot(MultiBlockPart aPart, int aSlot); + + ItemStack decrStackSize(MultiBlockPart aPart, int aSlot, int aDecrement); + + ItemStack getStackInSlotOnClosing(MultiBlockPart aPart, int aSlot); + + void setInventorySlotContents(MultiBlockPart aPart, int aSlot, ItemStack aStack); + + String getInventoryName(MultiBlockPart aPart); + + boolean hasCustomInventoryName(MultiBlockPart aPart); + + int getInventoryStackLimit(MultiBlockPart aPart); + + void markDirty(MultiBlockPart aPart); + + boolean isUseableByPlayer(MultiBlockPart aPart, EntityPlayer aPlayer); + + void openInventory(MultiBlockPart aPart); + + void closeInventory(MultiBlockPart aPart); + + boolean isItemValidForSlot(MultiBlockPart aPart, int aSlot, ItemStack aStack); } diff --git a/src/main/java/gregtech/api/multitileentity/interfaces/IMultiTileEntity.java b/src/main/java/gregtech/api/multitileentity/interfaces/IMultiTileEntity.java index d601d8abd2..f5278d47b4 100644 --- a/src/main/java/gregtech/api/multitileentity/interfaces/IMultiTileEntity.java +++ b/src/main/java/gregtech/api/multitileentity/interfaces/IMultiTileEntity.java @@ -1,5 +1,7 @@ package gregtech.api.multitileentity.interfaces; +import static gregtech.api.enums.GT_Values.MOD_ID_APC; + import cpw.mods.fml.common.Optional; import gregtech.api.interfaces.tileentity.IBasicEnergyContainer; import gregtech.api.interfaces.tileentity.ICoverable; @@ -12,6 +14,9 @@ import gregtech.api.interfaces.tileentity.ITurnable; import gregtech.api.multitileentity.MultiTileEntityBlockInternal; import gregtech.api.multitileentity.MultiTileEntityItemInternal; import gregtech.api.multitileentity.MultiTileEntityRegistry; +import java.util.ArrayList; +import java.util.List; +import java.util.UUID; import net.minecraft.block.Block; import net.minecraft.creativetab.CreativeTabs; import net.minecraft.entity.Entity; @@ -26,18 +31,22 @@ import net.minecraft.world.Explosion; import net.minecraft.world.World; import net.minecraftforge.fluids.IFluidHandler; -import java.util.ArrayList; -import java.util.List; -import java.util.UUID; - -import static gregtech.api.enums.GT_Values.MOD_ID_APC; - /* * Heavily inspired by GT6 */ -public interface IMultiTileEntity extends IHasWorldObjectAndCoords, ICoverable, ITurnable, IHasInventory, IEnergyConnected, IBasicEnergyContainer, IFluidHandler, ITexturedTileEntity, IDebugableTileEntity { +public interface IMultiTileEntity + extends IHasWorldObjectAndCoords, + ICoverable, + ITurnable, + IHasInventory, + IEnergyConnected, + IBasicEnergyContainer, + IFluidHandler, + ITexturedTileEntity, + IDebugableTileEntity { /** Those two IDs HAVE to be saved inside the NBT of the TileEntity itself. They get set by the Registry itself, when the TileEntity is placed. */ short getMultiTileEntityID(); + short getMultiTileEntityRegistryID(); /** Called by the Registry with the default NBT Parameters and the two IDs you have to save, when the TileEntity is created. aNBT may be null, take that into account if you decide to call the regular readFromNBT Function from here. */ void initFromNBT(NBTTagCompound aNBT, short aMTEID, short aMTERegistry); @@ -45,6 +54,7 @@ public interface IMultiTileEntity extends IHasWorldObjectAndCoords, ICoverable, NBTTagCompound writeItemNBT(NBTTagCompound aNBT); /** Sets the Item Display Name. Use null to reset it. */ void setCustomName(String aName); + String getCustomName(); /** return the internal Name of this TileEntity to be registered. */ @@ -61,21 +71,29 @@ public interface IMultiTileEntity extends IHasWorldObjectAndCoords, ICoverable, boolean isDead(); void loadTextureNBT(NBTTagCompound aNBT); + void copyTextures(); void issueClientUpdate(); - void sendClientData( EntityPlayerMP aPlayer); + + void sendClientData(EntityPlayerMP aPlayer); + boolean receiveClientEvent(int aEventID, int aValue); void setShouldRefresh(boolean aShouldRefresh); void addCollisionBoxesToList(AxisAlignedBB aAABB, List<AxisAlignedBB> aList, Entity aEntity); + AxisAlignedBB getCollisionBoundingBoxFromPool(); + AxisAlignedBB getSelectedBoundingBoxFromPool(); + void setBlockBoundsBasedOnState(Block aBlock); void onBlockAdded(); + boolean playerOwnsThis(EntityPlayer aPlayer, boolean aCheckPrecicely); + boolean privateAccess(); /** @return the amount of Time this TileEntity has been loaded. */ @@ -104,8 +122,11 @@ public interface IMultiTileEntity extends IHasWorldObjectAndCoords, ICoverable, * Paintable Support */ boolean unpaint(); + boolean isPainted(); + boolean paint(int aRGB); + int getPaint(); /** @@ -113,19 +134,28 @@ public interface IMultiTileEntity extends IHasWorldObjectAndCoords, ICoverable, * @return Whether the facing was changed */ boolean setMainFacing(byte aSide); + boolean isFacingValid(byte aFacing); - void onFacingChange(); - @Override default void setFrontFacing(byte aSide) { setMainFacing(aSide); } + void onFacingChange(); + @Override + default void setFrontFacing(byte aSide) { + setMainFacing(aSide); + } boolean shouldTriggerBlockUpdate(); + void onMachineBlockUpdate(); boolean allowInteraction(Entity aEntity); - default void onLeftClick(EntityPlayer aPlayer) { /* do nothing */ } + + default void onLeftClick(EntityPlayer aPlayer) { + /* do nothing */ + } boolean onBlockActivated(EntityPlayer aPlayer, byte aSide, float aX, float aY, float aZ); + boolean onRightClick(EntityPlayer aPlayer, byte aSide, float aX, float aY, float aZ); ArrayList<ItemStack> getDrops(int aFortune, boolean aSilkTouch); @@ -133,13 +163,16 @@ public interface IMultiTileEntity extends IHasWorldObjectAndCoords, ICoverable, boolean isSideSolid(byte aSide); float getExplosionResistance(Entity aExploder, double aExplosionX, double aExplosionY, double aExplosionZ); + float getExplosionResistance(); + void onExploded(Explosion aExplosion); boolean recolourBlock(byte aSide, byte aColor); /** Adds to the Creative Tab. return false to prevent it from being added. */ - boolean getSubItems(MultiTileEntityBlockInternal aBlock, Item aItem, CreativeTabs aTab, List<ItemStack> aList, short aID); + boolean getSubItems( + MultiTileEntityBlockInternal aBlock, Item aItem, CreativeTabs aTab, List<ItemStack> aList, short aID); ItemStack getPickBlock(MovingObjectPosition aTarget); @@ -147,9 +180,19 @@ public interface IMultiTileEntity extends IHasWorldObjectAndCoords, ICoverable, boolean isSurfaceOpaque(byte aSide); - boolean onPlaced(ItemStack aStack, EntityPlayer aPlayer, World aWorld, int aX, int aY, int aZ, byte aSide, float aHitX, float aHitY, float aHitZ); + boolean onPlaced( + ItemStack aStack, + EntityPlayer aPlayer, + World aWorld, + int aX, + int aY, + int aZ, + byte aSide, + float aHitX, + float aHitY, + float aHitZ); -// ItemStack getPickBlock(MovingObjectPosition aTarget); + // ItemStack getPickBlock(MovingObjectPosition aTarget); /* * Various Sub Interfaces from GT6 @@ -177,7 +220,6 @@ public interface IMultiTileEntity extends IHasWorldObjectAndCoords, ICoverable, boolean getWeakChanges(); } - interface IMTE_GetComparatorInputOverride extends IMultiTileEntity { int getComparatorInputOverride(byte aSide); } @@ -208,15 +250,34 @@ public interface IMultiTileEntity extends IHasWorldObjectAndCoords, ICoverable, interface IMTE_IgnoreEntityCollisionWhenPlacing extends IMultiTileEntity { /** Return true to ignore the Player standing in the way of placing this Block; useful for things like pipes/wires. */ - boolean ignoreEntityCollisionWhenPlacing(ItemStack aStack, EntityPlayer aPlayer, World aWorld, int aX, int aY, int aZ, byte aSide, float aHitX, float aHitY, float aHitZ); + boolean ignoreEntityCollisionWhenPlacing( + ItemStack aStack, + EntityPlayer aPlayer, + World aWorld, + int aX, + int aY, + int aZ, + byte aSide, + float aHitX, + float aHitY, + float aHitZ); } interface IMTE_CanPlace extends IMultiTileEntity { /** Return false if this TileEntity cannot be placed at that Location. */ - boolean canPlace(ItemStack aStack, EntityPlayer aPlayer, World aWorld, int aX, int aY, int aZ, byte aSide, float aHitX, float aHitY, float aHitZ); + boolean canPlace( + ItemStack aStack, + EntityPlayer aPlayer, + World aWorld, + int aX, + int aY, + int aZ, + byte aSide, + float aHitX, + float aHitY, + float aHitZ); } - interface IMTE_GetMaxStackSize extends IMultiTileEntity { /** Gets the Max Stacksize of this Item. */ byte getMaxStackSize(ItemStack aStack, byte aDefault); @@ -226,5 +287,4 @@ public interface IMultiTileEntity extends IHasWorldObjectAndCoords, ICoverable, /** Adds ToolTips to the Item. */ void addToolTips(List<String> aList, ItemStack aStack, boolean aF3_H); } - } diff --git a/src/main/java/gregtech/api/multitileentity/machine/MultiTileBasicMachine.java b/src/main/java/gregtech/api/multitileentity/machine/MultiTileBasicMachine.java index 9fcbaa235f..767026b286 100644 --- a/src/main/java/gregtech/api/multitileentity/machine/MultiTileBasicMachine.java +++ b/src/main/java/gregtech/api/multitileentity/machine/MultiTileBasicMachine.java @@ -1,5 +1,8 @@ package gregtech.api.multitileentity.machine; +import static com.google.common.primitives.Ints.saturatedCast; +import static gregtech.api.enums.GT_Values.emptyIconContainerArray; + import gregtech.api.enums.GT_Values; import gregtech.api.enums.GT_Values.NBT; import gregtech.api.enums.Textures; @@ -8,7 +11,6 @@ import gregtech.api.interfaces.IIconContainer; import gregtech.api.interfaces.ITexture; import gregtech.api.multitileentity.MultiTileEntityRegistry; import gregtech.api.multitileentity.base.BaseTickableMultiTileEntity; -import gregtech.api.multitileentity.multiblock.base.MultiBlockPart; import gregtech.api.render.TextureFactory; import gregtech.api.util.GT_Util; import gregtech.api.util.GT_Utility; @@ -21,10 +23,7 @@ import net.minecraft.tileentity.TileEntity; import net.minecraftforge.fluids.FluidStack; import net.minecraftforge.fluids.IFluidTank; -import static com.google.common.primitives.Ints.saturatedCast; -import static gregtech.api.enums.GT_Values.emptyIconContainerArray; - -public class MultiTileBasicMachine extends BaseTickableMultiTileEntity { +public class MultiTileBasicMachine extends BaseTickableMultiTileEntity { private static final String TEXTURE_LOCATION = "multitileentity/machines/"; public IIconContainer[] mTexturesInactive = emptyIconContainerArray; public IIconContainer[] mTexturesActive = emptyIconContainerArray; @@ -43,14 +42,13 @@ public class MultiTileBasicMachine extends BaseTickableMultiTileEntity { return "gt.multitileentity.machine.basic"; } - @Override public void writeMultiTileNBT(NBTTagCompound aNBT) { super.writeMultiTileNBT(aNBT); if (mParallel > 0) aNBT.setInteger(NBT.PARALLEL, mParallel); if (mActive) aNBT.setBoolean(NBT.ACTIVE, mActive); - } + @Override public void readMultiTileNBT(NBTTagCompound aNBT) { super.readMultiTileNBT(aNBT); @@ -58,7 +56,7 @@ public class MultiTileBasicMachine extends BaseTickableMultiTileEntity { if (aNBT.hasKey(NBT.ACTIVE)) mActive = aNBT.getBoolean(NBT.ACTIVE); mInventory = getDefaultInventory(aNBT); - if(mInventory != null) { + if (mInventory != null) { final NBTTagList tList = aNBT.getTagList(NBT.INV_LIST, 10); for (int i = 0; i < tList.tagCount(); i++) { final NBTTagCompound tNBT = tList.getCompoundTagAt(i); @@ -75,19 +73,25 @@ public class MultiTileBasicMachine extends BaseTickableMultiTileEntity { mOutputFluids = new FluidStack[getFluidOutputCount()]; mOutputItems = new ItemStack[getItemOutputCount()]; - // TODO: See if we need the adjustable map here `.setCapacity(mRecipes, mParallel * 2L)` in place of the `setCapacityMultiplier` - for (int i = 0; i < mTanksInput.length; i++) mTanksInput[i] = new FluidTankGT(tCapacity).setCapacityMultiplier(mParallel * 2L).readFromNBT(aNBT, NBT.TANK_IN + i); - for (int i = 0; i < mTanksOutput.length; i++) mTanksOutput[i] = new FluidTankGT().readFromNBT(aNBT, NBT.TANK_OUT + i); - for (int i = 0; i < mOutputFluids.length; i++) mOutputFluids[i] = FluidStack.loadFluidStackFromNBT(aNBT.getCompoundTag(NBT.FLUID_OUT + "." + i)); - for (int i = 0; i < mOutputItems.length; i++) mOutputItems[i] = ItemStack.loadItemStackFromNBT(aNBT.getCompoundTag(NBT.INV_OUT + "." + i)); - + // TODO: See if we need the adjustable map here `.setCapacity(mRecipes, mParallel * 2L)` in place of the + // `setCapacityMultiplier` + for (int i = 0; i < mTanksInput.length; i++) + mTanksInput[i] = new FluidTankGT(tCapacity) + .setCapacityMultiplier(mParallel * 2L) + .readFromNBT(aNBT, NBT.TANK_IN + i); + for (int i = 0; i < mTanksOutput.length; i++) + mTanksOutput[i] = new FluidTankGT().readFromNBT(aNBT, NBT.TANK_OUT + i); + for (int i = 0; i < mOutputFluids.length; i++) + mOutputFluids[i] = FluidStack.loadFluidStackFromNBT(aNBT.getCompoundTag(NBT.FLUID_OUT + "." + i)); + for (int i = 0; i < mOutputItems.length; i++) + mOutputItems[i] = ItemStack.loadItemStackFromNBT(aNBT.getCompoundTag(NBT.INV_OUT + "." + i)); } @Override public void loadTextureNBT(NBTTagCompound aNBT) { // Loading the registry final String textureName = aNBT.getString(NBT.TEXTURE); - mTextures = new IIconContainer[]{ + mTextures = new IIconContainer[] { new Textures.BlockIcons.CustomIcon(TEXTURE_LOCATION + textureName + "/bottom"), new Textures.BlockIcons.CustomIcon(TEXTURE_LOCATION + textureName + "/top"), new Textures.BlockIcons.CustomIcon(TEXTURE_LOCATION + textureName + "/left"), @@ -95,7 +99,7 @@ public class MultiTileBasicMachine extends BaseTickableMultiTileEntity { new Textures.BlockIcons.CustomIcon(TEXTURE_LOCATION + textureName + "/right"), new Textures.BlockIcons.CustomIcon(TEXTURE_LOCATION + textureName + "/side") }; - mTexturesInactive = new IIconContainer[]{ + mTexturesInactive = new IIconContainer[] { new Textures.BlockIcons.CustomIcon(TEXTURE_LOCATION + textureName + "/overlay/inactive/bottom"), new Textures.BlockIcons.CustomIcon(TEXTURE_LOCATION + textureName + "/overlay/inactive/top"), new Textures.BlockIcons.CustomIcon(TEXTURE_LOCATION + textureName + "/overlay/inactive/left"), @@ -103,7 +107,7 @@ public class MultiTileBasicMachine extends BaseTickableMultiTileEntity { new Textures.BlockIcons.CustomIcon(TEXTURE_LOCATION + textureName + "/overlay/inactive/right"), new Textures.BlockIcons.CustomIcon(TEXTURE_LOCATION + textureName + "/overlay/inactive/back") }; - mTexturesActive = new IIconContainer[]{ + mTexturesActive = new IIconContainer[] { new Textures.BlockIcons.CustomIcon(TEXTURE_LOCATION + textureName + "/overlay/active/bottom"), new Textures.BlockIcons.CustomIcon(TEXTURE_LOCATION + textureName + "/overlay/active/top"), new Textures.BlockIcons.CustomIcon(TEXTURE_LOCATION + textureName + "/overlay/active/left"), @@ -111,38 +115,35 @@ public class MultiTileBasicMachine extends BaseTickableMultiTileEntity { new Textures.BlockIcons.CustomIcon(TEXTURE_LOCATION + textureName + "/overlay/active/right"), new Textures.BlockIcons.CustomIcon(TEXTURE_LOCATION + textureName + "/overlay/active/back") }; - } @Override public void copyTextures() { // Loading an instance - final TileEntity tCanonicalTileEntity = MultiTileEntityRegistry.getCanonicalTileEntity(getMultiTileEntityRegistryID(), getMultiTileEntityID()); - if(tCanonicalTileEntity instanceof MultiTileBasicMachine){ - mTextures = ((MultiTileBasicMachine)tCanonicalTileEntity).mTextures; - mTexturesInactive = ((MultiTileBasicMachine)tCanonicalTileEntity).mTexturesInactive; - mTexturesActive = ((MultiTileBasicMachine)tCanonicalTileEntity).mTexturesActive; + final TileEntity tCanonicalTileEntity = + MultiTileEntityRegistry.getCanonicalTileEntity(getMultiTileEntityRegistryID(), getMultiTileEntityID()); + if (tCanonicalTileEntity instanceof MultiTileBasicMachine) { + mTextures = ((MultiTileBasicMachine) tCanonicalTileEntity).mTextures; + mTexturesInactive = ((MultiTileBasicMachine) tCanonicalTileEntity).mTexturesInactive; + mTexturesActive = ((MultiTileBasicMachine) tCanonicalTileEntity).mTexturesActive; } else { mTextures = mTexturesInactive = mTexturesActive = emptyIconContainerArray; } } - - @Override public ITexture[] getTexture(Block aBlock, byte aSide, boolean isActive, int aRenderPass) { - return new ITexture[]{ + return new ITexture[] { TextureFactory.of(mTextures[GT_Values.FACING_ROTATIONS[mFacing][aSide]], GT_Util.getRGBaArray(mRGBa)), - TextureFactory.of((mActive ? mTexturesActive : mTexturesInactive)[GT_Values.FACING_ROTATIONS[mFacing][aSide]]) + TextureFactory.of( + (mActive ? mTexturesActive : mTexturesInactive)[GT_Values.FACING_ROTATIONS[mFacing][aSide]]) }; } - /* * Fluids */ - /** * The number of fluid (input) slots available for this machine */ @@ -162,29 +163,26 @@ public class MultiTileBasicMachine extends BaseTickableMultiTileEntity { return tSize > 0 ? new ItemStack[tSize] : GT_Values.emptyItemStackArray; } - @Override - public void setLightValue(byte aLightValue) { - - } + public void setLightValue(byte aLightValue) {} @Override public String getInventoryName() { final String name = getCustomName(); - if(name != null) return name; + if (name != null) return name; final MultiTileEntityRegistry tRegistry = MultiTileEntityRegistry.getRegistry(getMultiTileEntityRegistryID()); return tRegistry == null ? getClass().getName() : tRegistry.getLocal(getMultiTileEntityID()); } - @Override public boolean isUseableByPlayer(EntityPlayer aPlayer) { - return playerOwnsThis(aPlayer, false) && mTickTimer > 40 && - getTileEntityOffset(0, 0, 0) == this && - aPlayer.getDistanceSq(xCoord + 0.5, yCoord + 0.5, zCoord + 0.5) < 64 && allowInteraction(aPlayer); + return playerOwnsThis(aPlayer, false) + && mTickTimer > 40 + && getTileEntityOffset(0, 0, 0) == this + && aPlayer.getDistanceSq(xCoord + 0.5, yCoord + 0.5, zCoord + 0.5) < 64 + && allowInteraction(aPlayer); } - @Override public boolean isLiquidInput(byte aSide) { return aSide != mFacing; @@ -195,20 +193,19 @@ public class MultiTileBasicMachine extends BaseTickableMultiTileEntity { return aSide != mFacing; } - @Override protected IFluidTank[] getFluidTanks(byte aSide) { final boolean fluidInput = isLiquidInput(aSide); final boolean fluidOutput = isLiquidOutput(aSide); - if(fluidInput && fluidOutput) { - final IFluidTank[] rTanks = new IFluidTank[ mTanksInput.length + mTanksOutput.length]; + if (fluidInput && fluidOutput) { + final IFluidTank[] rTanks = new IFluidTank[mTanksInput.length + mTanksOutput.length]; System.arraycopy(mTanksInput, 0, rTanks, 0, mTanksInput.length); System.arraycopy(mTanksOutput, 0, rTanks, mTanksInput.length, mTanksOutput.length); return rTanks; - } else if(fluidInput) { + } else if (fluidInput) { return mTanksInput; - } else if(fluidOutput) { + } else if (fluidOutput) { return mTanksOutput; } return GT_Values.emptyFluidTank; @@ -216,19 +213,19 @@ public class MultiTileBasicMachine extends BaseTickableMultiTileEntity { @Override public IFluidTank getFluidTankFillable(byte aSide, FluidStack aFluidToFill) { - if(!isLiquidInput(aSide)) return null; + if (!isLiquidInput(aSide)) return null; for (FluidTankGT tankGT : mTanksInput) if (tankGT.contains(aFluidToFill)) return tankGT; -// if (!mRecipes.containsInput(aFluidToFill, this, slot(mRecipes.mInputItemsCount + mRecipes.mOutputItemsCount))) return null; + // if (!mRecipes.containsInput(aFluidToFill, this, slot(mRecipes.mInputItemsCount + + // mRecipes.mOutputItemsCount))) return null; for (FluidTankGT fluidTankGT : mTanksInput) if (fluidTankGT.isEmpty()) return fluidTankGT; return null; } @Override protected IFluidTank getFluidTankDrainable(byte aSide, FluidStack aFluidToDrain) { - if(!isLiquidOutput(aSide)) return null; + if (!isLiquidOutput(aSide)) return null; for (FluidTankGT fluidTankGT : mTanksOutput) - if (aFluidToDrain == null ? fluidTankGT.has() : fluidTankGT.contains(aFluidToDrain)) - return fluidTankGT; + if (aFluidToDrain == null ? fluidTankGT.has() : fluidTankGT.contains(aFluidToDrain)) return fluidTankGT; return null; } @@ -282,7 +279,6 @@ public class MultiTileBasicMachine extends BaseTickableMultiTileEntity { return 1; } - public boolean isEnergyInputSide(byte aSide) { return true; } @@ -295,8 +291,9 @@ public class MultiTileBasicMachine extends BaseTickableMultiTileEntity { public boolean inputEnergyFrom(byte aSide) { if (aSide == GT_Values.SIDE_UNKNOWN) return true; if (aSide >= 0 && aSide < 6) { - if(isInvalid()) return false; - if (!getCoverBehaviorAtSideNew(aSide).letsEnergyIn(aSide, getCoverIDAtSide(aSide), getComplexCoverDataAtSide(aSide), this)) return false; + if (isInvalid()) return false; + if (!getCoverBehaviorAtSideNew(aSide) + .letsEnergyIn(aSide, getCoverIDAtSide(aSide), getComplexCoverDataAtSide(aSide), this)) return false; if (isEnetInput()) return isEnergyInputSide(aSide); } return false; @@ -307,7 +304,9 @@ public class MultiTileBasicMachine extends BaseTickableMultiTileEntity { if (aSide == GT_Values.SIDE_UNKNOWN) return true; if (aSide >= 0 && aSide < 6) { if (isInvalid()) return false; - if (!getCoverBehaviorAtSideNew(aSide).letsEnergyOut(aSide, getCoverIDAtSide(aSide), getComplexCoverDataAtSide(aSide), this)) return false; + if (!getCoverBehaviorAtSideNew(aSide) + .letsEnergyOut(aSide, getCoverIDAtSide(aSide), getComplexCoverDataAtSide(aSide), this)) + return false; if (isEnetOutput()) return isEnergyOutputSide(aSide); } return false; @@ -317,7 +316,8 @@ public class MultiTileBasicMachine extends BaseTickableMultiTileEntity { * Inventory */ - @Override public boolean hasInventoryBeenModified() { + @Override + public boolean hasInventoryBeenModified() { return mInventoryChanged; } @@ -344,5 +344,4 @@ public class MultiTileBasicMachine extends BaseTickableMultiTileEntity { public int getItemOutputCount() { return 2; } - } 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 afd8f9577f..bb01f0b4fa 100644 --- a/src/main/java/gregtech/api/multitileentity/multiblock/base/MultiBlockController.java +++ b/src/main/java/gregtech/api/multitileentity/multiblock/base/MultiBlockController.java @@ -1,5 +1,8 @@ package gregtech.api.multitileentity.multiblock.base; +import static gregtech.GT_Mod.GT_FML_LOGGER; +import static gregtech.api.enums.GT_Values.NBT; + import com.gtnewhorizon.structurelib.StructureLibAPI; import com.gtnewhorizon.structurelib.alignment.IAlignment; import com.gtnewhorizon.structurelib.alignment.IAlignmentLimits; @@ -29,12 +32,16 @@ import gregtech.api.multitileentity.machine.MultiTileBasicMachine; import gregtech.api.objects.GT_ItemStack; import gregtech.api.util.GT_Multiblock_Tooltip_Builder; import gregtech.api.util.GT_Utility; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; +import java.util.Map; +import java.util.concurrent.ConcurrentHashMap; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.tileentity.TileEntity; import net.minecraft.util.IIcon; -import net.minecraft.util.Tuple; import net.minecraft.world.World; import net.minecraftforge.common.util.ForgeDirection; import net.minecraftforge.fluids.Fluid; @@ -45,26 +52,23 @@ import org.apache.commons.lang3.tuple.ImmutablePair; import org.apache.commons.lang3.tuple.Pair; import org.lwjgl.input.Keyboard; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.List; -import java.util.Map; -import java.util.concurrent.ConcurrentHashMap; - -import static gregtech.GT_Mod.GT_FML_LOGGER; -import static gregtech.api.enums.GT_Values.NBT; - public abstract class MultiBlockController<T extends MultiBlockController<T>> extends MultiTileBasicMachine - implements IAlignment, IConstructable, IMultiBlockController, IDescribable, IMachineProgress, IMultiBlockFluidHandler, IMultiBlockInventory, IMTE_AddToolTips -{ + implements IAlignment, + IConstructable, + IMultiBlockController, + IDescribable, + IMachineProgress, + IMultiBlockFluidHandler, + IMultiBlockInventory, + IMTE_AddToolTips { private static final Map<Integer, GT_Multiblock_Tooltip_Builder> tooltip = new ConcurrentHashMap<>(); protected BuildState buildState = new BuildState(); - // The 0th slot is the default inventory of the MultiBlock; any other has been added by an Inventory Extender of sorts + // The 0th slot is the default inventory of the MultiBlock; any other has been added by an Inventory Extender of + // sorts protected List<ItemStack[]> multiBlockInventory = new ArrayList<>(); - private int mMaxProgresstime = 0, mProgresstime = 0; private boolean mStructureOkay = false, mStructureChanged = false; private boolean mWorks = true, mWorkUpdate = false, mWasShutdown = false, mActive = false; @@ -76,7 +80,6 @@ public abstract class MultiBlockController<T extends MultiBlockController<T>> ex /** Meta ID of the required casing */ public abstract short getCasingMeta(); - /** * Create the tooltip for this multi block controller. */ @@ -106,7 +109,6 @@ public abstract class MultiBlockController<T extends MultiBlockController<T>> ex */ public abstract boolean checkRecipe(ItemStack aStack); - @Override public void writeMultiTileNBT(NBTTagCompound aNBT) { super.writeMultiTileNBT(aNBT); @@ -120,16 +122,16 @@ public abstract class MultiBlockController<T extends MultiBlockController<T>> ex public void readMultiTileNBT(NBTTagCompound aNBT) { super.readMultiTileNBT(aNBT); - // Multiblock inventories are a collection of inventories. The first inventory is the default internal inventory, + // Multiblock inventories are a collection of inventories. The first inventory is the default internal + // inventory, // and the others are added by inventory extending blocks. - if(mInventory != null) multiBlockInventory.add(mInventory); + if (mInventory != null) multiBlockInventory.add(mInventory); mStructureOkay = aNBT.getBoolean(NBT.STRUCTURE_OK); mExtendedFacing = ExtendedFacing.of( - ForgeDirection.getOrientation(getFrontFacing()), - Rotation.byIndex(aNBT.getByte(NBT.ROTATION)), - Flip.byIndex(aNBT.getByte(NBT.FLIP)) - ); + ForgeDirection.getOrientation(getFrontFacing()), + Rotation.byIndex(aNBT.getByte(NBT.ROTATION)), + Flip.byIndex(aNBT.getByte(NBT.FLIP))); } @Override @@ -157,18 +159,17 @@ public abstract class MultiBlockController<T extends MultiBlockController<T>> ex protected GT_Multiblock_Tooltip_Builder getTooltip() { return createTooltip(); -// final int tooltipId = getToolTipID(); -// final GT_Multiblock_Tooltip_Builder tt = tooltip.get(tooltipId); -// if (tt == null) { -// return tooltip.computeIfAbsent(tooltipId, k -> createTooltip()); -// } -// return tt; + // final int tooltipId = getToolTipID(); + // final GT_Multiblock_Tooltip_Builder tt = tooltip.get(tooltipId); + // if (tt == null) { + // return tooltip.computeIfAbsent(tooltipId, k -> createTooltip()); + // } + // return tt; } - @Override public boolean checkStructure(boolean aForceReset) { - if(!isServerSide()) return mStructureOkay; + if (!isServerSide()) return mStructureOkay; // Only trigger an update if forced (from onPostTick, generally), or if the structure has changed if ((mStructureChanged || aForceReset)) { @@ -199,21 +200,46 @@ public abstract class MultiBlockController<T extends MultiBlockController<T>> ex * All these offsets can be negative. */ protected final boolean checkPiece(String piece, int horizontalOffset, int verticalOffset, int depthOffset) { - return getCastedStructureDefinition().check( - this, piece, getWorld(), getExtendedFacing(), getXCoord(), getYCoord(), getZCoord(), horizontalOffset, verticalOffset, - depthOffset, !mStructureOkay - ); + return getCastedStructureDefinition() + .check( + this, + piece, + getWorld(), + getExtendedFacing(), + getXCoord(), + getYCoord(), + getZCoord(), + horizontalOffset, + verticalOffset, + depthOffset, + !mStructureOkay); } public final boolean buildPiece(String piece, ItemStack trigger, boolean hintsOnly, Vec3Impl offset) { return buildPiece(piece, trigger, hintsOnly, offset.get0(), offset.get1(), offset.get2()); } - protected final boolean buildPiece(String piece, ItemStack trigger, boolean hintOnly, int horizontalOffset, int verticalOffset, int depthOffset) { - return getCastedStructureDefinition().buildOrHints( - this, trigger, piece, getWorld(), getExtendedFacing(), getXCoord(), getYCoord(), getZCoord(), horizontalOffset, - verticalOffset, depthOffset, hintOnly - ); + protected final boolean buildPiece( + String piece, + ItemStack trigger, + boolean hintOnly, + int horizontalOffset, + int verticalOffset, + int depthOffset) { + return getCastedStructureDefinition() + .buildOrHints( + this, + trigger, + piece, + getWorld(), + getExtendedFacing(), + getXCoord(), + getYCoord(), + getZCoord(), + horizontalOffset, + verticalOffset, + depthOffset, + hintOnly); } @SuppressWarnings("unchecked") @@ -230,13 +256,14 @@ public abstract class MultiBlockController<T extends MultiBlockController<T>> ex public void setExtendedFacing(ExtendedFacing newExtendedFacing) { if (mExtendedFacing != newExtendedFacing) { onStructureChange(); - if (mStructureOkay) - stopMachine(); + if (mStructureOkay) stopMachine(); mExtendedFacing = newExtendedFacing; mStructureOkay = false; if (isServerSide()) { StructureLibAPI.sendAlignment( - this, new NetworkRegistry.TargetPoint(getWorld().provider.dimensionId, getXCoord(), getYCoord(), getZCoord(), 512)); + this, + new NetworkRegistry.TargetPoint( + getWorld().provider.dimensionId, getXCoord(), getYCoord(), getZCoord(), 512)); } else { issueTextureUpdate(); } @@ -244,11 +271,13 @@ public abstract class MultiBlockController<T extends MultiBlockController<T>> ex } @Override - public boolean onWrenchRightClick(EntityPlayer aPlayer, ItemStack tCurrentItem, byte wrenchSide, float aX, float aY, float aZ) { + public boolean onWrenchRightClick( + EntityPlayer aPlayer, ItemStack tCurrentItem, byte wrenchSide, float aX, float aY, float aZ) { if (wrenchSide != getFrontFacing()) return super.onWrenchRightClick(aPlayer, tCurrentItem, wrenchSide, aX, aY, aZ); if (aPlayer.isSneaking()) { - // we won't be allowing horizontal flips, as it can be perfectly emulated by rotating twice and flipping horizontally + // we won't be allowing horizontal flips, as it can be perfectly emulated by rotating twice and flipping + // horizontally // allowing an extra round of flip make it hard to draw meaningful flip markers in GT_Proxy#drawGrid toolSetFlip(getFlip().isHorizontallyFlipped() ? Flip.NONE : Flip.HORIZONTAL); } else { @@ -260,10 +289,8 @@ public abstract class MultiBlockController<T extends MultiBlockController<T>> ex @Override public void onFirstTick(boolean aIsServerSide) { super.onFirstTick(aIsServerSide); - if (aIsServerSide) - checkStructure(true); - else - StructureLibAPI.queryAlignment(this); + if (aIsServerSide) checkStructure(true); + else StructureLibAPI.queryAlignment(this); } @Override @@ -325,8 +352,7 @@ public abstract class MultiBlockController<T extends MultiBlockController<T>> ex @Override public FluidStack getDrainableFluid(byte aSide) { final IFluidTank tank = getFluidTankDrainable(aSide, null); - return tank == null ? null : tank.getFluid(); - + return tank == null ? null : tank.getFluid(); } /** @@ -393,6 +419,7 @@ public abstract class MultiBlockController<T extends MultiBlockController<T>> ex * Utility class to keep track of the build state of a multiblock */ boolean building = false; + Vec3Impl currentOffset; public void startBuilding(Vec3Impl structureOffset) { @@ -437,7 +464,7 @@ public abstract class MultiBlockController<T extends MultiBlockController<T>> ex public <S> IStructureElement<S> addMultiTileCasing(int aRegistryID, int aBlockMeta, int aModes) { return new IStructureElement<S>() { - private final short[] DEFAULT = new short[]{255, 255, 255, 0}; + private final short[] DEFAULT = new short[] {255, 255, 255, 0}; private IIcon[] mIcons = null; @Override @@ -446,7 +473,8 @@ public abstract class MultiBlockController<T extends MultiBlockController<T>> ex if (!(tileEntity instanceof MultiBlockPart)) return false; final MultiBlockPart part = (MultiBlockPart) tileEntity; - if (aRegistryID != part.getMultiTileEntityRegistryID() || aBlockMeta != part.getMultiTileEntityID()) return false; + if (aRegistryID != part.getMultiTileEntityRegistryID() || aBlockMeta != part.getMultiTileEntityID()) + return false; final IMultiBlockController tTarget = part.getTarget(false); if (tTarget != null && tTarget != MultiBlockController.this) return false; @@ -460,27 +488,28 @@ public abstract class MultiBlockController<T extends MultiBlockController<T>> ex if (mIcons == null) { mIcons = new IIcon[6]; Arrays.fill(mIcons, TextureSet.SET_NONE.mTextures[OrePrefixes.block.mTextureIndex].getIcon()); -// Arrays.fill(mIcons, getTexture(aCasing); -// for (int i = 0; i < 6; i++) { -// mIcons[i] = aCasing.getIcon(i, aMeta); -// } + // Arrays.fill(mIcons, getTexture(aCasing); + // for (int i = 0; i < 6; i++) { + // mIcons[i] = aCasing.getIcon(i, aMeta); + // } } final short[] RGBA = DEFAULT; StructureLibAPI.hintParticleTinted(world, x, y, z, mIcons, RGBA); -// StructureLibAPI.hintParticle(world, x, y, z, aCasing, aMeta); + // StructureLibAPI.hintParticle(world, x, y, z, aCasing, aMeta); return true; } @Override public boolean placeBlock(S t, World world, int x, int y, int z, ItemStack trigger) { final MultiTileEntityRegistry tRegistry = MultiTileEntityRegistry.getRegistry(aRegistryID); - final MultiTileEntityContainer tContainer = tRegistry.getNewTileEntityContainer(world, x, y, z, aBlockMeta, null); - if(tContainer == null) { + final MultiTileEntityContainer tContainer = + tRegistry.getNewTileEntityContainer(world, x, y, z, aBlockMeta, null); + if (tContainer == null) { GT_FML_LOGGER.error("NULL CONTAINER"); return false; } - final IMultiTileEntity te = ((IMultiTileEntity)tContainer.mTileEntity); - if(!(te instanceof MultiBlockPart)) { + final IMultiTileEntity te = ((IMultiTileEntity) tContainer.mTileEntity); + if (!(te instanceof MultiBlockPart)) { GT_FML_LOGGER.error("Not a multiblock part"); return false; } @@ -501,15 +530,22 @@ public abstract class MultiBlockController<T extends MultiBlockController<T>> ex /** * Fluid - MultiBlock related Fluid Tank behaviour. */ + protected IFluidTank getFluidTankFillable(MultiBlockPart aPart, byte aSide, FluidStack aFluidToFill) { + return getFluidTankFillable(aSide, aFluidToFill); + } - protected IFluidTank getFluidTankFillable(MultiBlockPart aPart, byte aSide, FluidStack aFluidToFill) {return getFluidTankFillable(aSide, aFluidToFill);} - protected IFluidTank getFluidTankDrainable(MultiBlockPart aPart, byte aSide, FluidStack aFluidToDrain) {return getFluidTankDrainable(aSide, aFluidToDrain);} - protected IFluidTank[] getFluidTanks(MultiBlockPart aPart, byte aSide) {return getFluidTanks(aSide);} + protected IFluidTank getFluidTankDrainable(MultiBlockPart aPart, byte aSide, FluidStack aFluidToDrain) { + return getFluidTankDrainable(aSide, aFluidToDrain); + } + + protected IFluidTank[] getFluidTanks(MultiBlockPart aPart, byte aSide) { + return getFluidTanks(aSide); + } @Override public int fill(MultiBlockPart aPart, ForgeDirection aDirection, FluidStack aFluid, boolean aDoFill) { if (aFluid == null || aFluid.amount <= 0) return 0; - final IFluidTank tTank = getFluidTankFillable(aPart, (byte)aDirection.ordinal(), aFluid); + final IFluidTank tTank = getFluidTankFillable(aPart, (byte) aDirection.ordinal(), aFluid); if (tTank == null) return 0; final int rFilledAmount = tTank.fill(aFluid, aDoFill); if (rFilledAmount > 0 && aDoFill) mInventoryChanged = true; @@ -519,8 +555,11 @@ public abstract class MultiBlockController<T extends MultiBlockController<T>> ex @Override public FluidStack drain(MultiBlockPart aPart, ForgeDirection aDirection, FluidStack aFluid, boolean aDoDrain) { if (aFluid == null || aFluid.amount <= 0) return null; - final IFluidTank tTank = getFluidTankDrainable(aPart, (byte)aDirection.ordinal(), aFluid); - if (tTank == null || tTank.getFluid() == null || tTank.getFluidAmount() == 0 || !tTank.getFluid().isFluidEqual(aFluid)) return null; + final IFluidTank tTank = getFluidTankDrainable(aPart, (byte) aDirection.ordinal(), aFluid); + if (tTank == null + || tTank.getFluid() == null + || tTank.getFluidAmount() == 0 + || !tTank.getFluid().isFluidEqual(aFluid)) return null; final FluidStack rDrained = tTank.drain(aFluid.amount, aDoDrain); if (rDrained != null && aDoDrain) markInventoryBeenModified(); return rDrained; @@ -529,7 +568,7 @@ public abstract class MultiBlockController<T extends MultiBlockController<T>> ex @Override public FluidStack drain(MultiBlockPart aPart, ForgeDirection aDirection, int aAmountToDrain, boolean aDoDrain) { if (aAmountToDrain <= 0) return null; - final IFluidTank tTank = getFluidTankDrainable(aPart, (byte)aDirection.ordinal(), null); + final IFluidTank tTank = getFluidTankDrainable(aPart, (byte) aDirection.ordinal(), null); if (tTank == null || tTank.getFluid() == null || tTank.getFluidAmount() == 0) return null; final FluidStack rDrained = tTank.drain(aAmountToDrain, aDoDrain); if (rDrained != null && aDoDrain) markInventoryBeenModified(); @@ -539,20 +578,20 @@ public abstract class MultiBlockController<T extends MultiBlockController<T>> ex @Override 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)); + final IFluidTank tTank = getFluidTankFillable(aPart, (byte) aDirection.ordinal(), new FluidStack(aFluid, 0)); 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)); + final IFluidTank tTank = getFluidTankDrainable(aPart, (byte) aDirection.ordinal(), new FluidStack(aFluid, 0)); return tTank != null && (tTank.getFluid() != null && tTank.getFluid().getFluid() == aFluid); } @Override public FluidTankInfo[] getTankInfo(MultiBlockPart aPart, ForgeDirection aDirection) { - final IFluidTank[] tTanks = getFluidTanks(aPart, (byte)aDirection.ordinal()); + final IFluidTank[] tTanks = getFluidTanks(aPart, (byte) aDirection.ordinal()); if (tTanks == null || tTanks.length <= 0) return GT_Values.emptyFluidTankInfo; final FluidTankInfo[] rInfo = new FluidTankInfo[tTanks.length]; for (int i = 0; i < tTanks.length; i++) rInfo[i] = new FluidTankInfo(tTanks[i]); @@ -562,7 +601,6 @@ public abstract class MultiBlockController<T extends MultiBlockController<T>> ex /** * Energy - MultiBlock related Energy behavior */ - @Override public boolean isUniversalEnergyStored(MultiBlockPart aPart, long aEnergyAmount) { return getUniversalEnergyStored(aPart) >= aEnergyAmount; @@ -642,7 +680,7 @@ public abstract class MultiBlockController<T extends MultiBlockController<T>> ex public boolean inputEnergyFrom(MultiBlockPart aPart, byte aSide) { if (aSide == GT_Values.SIDE_UNKNOWN) return true; if (aSide >= 0 && aSide < 6) { - if(isInvalid()) return false; + if (isInvalid()) return false; if (isEnetInput()) return isEnergyInputSide(aSide); } return false; @@ -661,8 +699,6 @@ public abstract class MultiBlockController<T extends MultiBlockController<T>> ex /** * Item - MultiBlock related Item behaviour. */ - - @Override public boolean hasInventoryBeenModified(MultiBlockPart aPart) { // TODO: MultiInventory - Figure this out based on locked & the part @@ -688,7 +724,7 @@ public abstract class MultiBlockController<T extends MultiBlockController<T>> ex if (lockedInventory != -1) return new ImmutablePair<>(multiBlockInventory.get(lockedInventory), aSlot); int start = 0; - for(ItemStack[] inv : multiBlockInventory) { + for (ItemStack[] inv : multiBlockInventory) { if (aSlot > start && aSlot < start + inv.length) { return new ImmutablePair<>(inv, aSlot - start); } @@ -703,42 +739,43 @@ public abstract class MultiBlockController<T extends MultiBlockController<T>> ex final int lockedInventory = aPart.getLockedInventory(); int start = 0; - if(lockedInventory == -1) { + if (lockedInventory == -1) { for (ItemStack[] inv : multiBlockInventory) { for (int i = start; i < inv.length + start; i++) tList.add(i); start += inv.length; } } else { final int len = multiBlockInventory.get(lockedInventory).length; - for(int i = 0; i < len ; i++) tList.add(i); + for (int i = 0; i < len; i++) tList.add(i); } return tList.toArray(); } - @Override public boolean canInsertItem(MultiBlockPart aPart, int aSlot, ItemStack aStack, byte aSide) { final int lockedInventory = aPart.getLockedInventory(), tSlot; final ItemStack[] inv; - if(lockedInventory == -1) { + if (lockedInventory == -1) { final Pair<ItemStack[], Integer> tInv = getInventory(lockedInventory, aSlot); - if(tInv == null) return false; + if (tInv == null) return false; inv = tInv.getLeft(); tSlot = tInv.getRight(); } else { inv = multiBlockInventory.get(lockedInventory); tSlot = aSlot; } - return inv[tSlot] == null || GT_Utility.areStacksEqual(aStack, inv[tSlot]); //&& allowPutStack(getBaseMetaTileEntity(), aIndex, (byte) aSide, aStack) + return inv[tSlot] == null + || GT_Utility.areStacksEqual( + aStack, inv[tSlot]); // && allowPutStack(getBaseMetaTileEntity(), aIndex, (byte) aSide, aStack) } @Override public boolean canExtractItem(MultiBlockPart aPart, int aSlot, ItemStack aStack, byte aSide) { final int lockedInventory = aPart.getLockedInventory(), tSlot; final ItemStack[] inv; - if(lockedInventory == -1) { + if (lockedInventory == -1) { final Pair<ItemStack[], Integer> tInv = getInventory(lockedInventory, aSlot); - if(tInv == null) return false; + if (tInv == null) return false; inv = tInv.getLeft(); tSlot = tInv.getRight(); } else { @@ -751,7 +788,7 @@ public abstract class MultiBlockController<T extends MultiBlockController<T>> ex @Override public int getSizeInventory(MultiBlockPart aPart) { final int lockedInventory = aPart.getLockedInventory(); - if(lockedInventory == -1) { + if (lockedInventory == -1) { int len = 0; for (ItemStack[] inv : multiBlockInventory) len += inv.length; return len; @@ -764,9 +801,9 @@ public abstract class MultiBlockController<T extends MultiBlockController<T>> ex public ItemStack getStackInSlot(MultiBlockPart aPart, int aSlot) { final int lockedInventory = aPart.getLockedInventory(), tSlot; final ItemStack[] inv; - if(lockedInventory == -1) { + if (lockedInventory == -1) { final Pair<ItemStack[], Integer> tInv = getInventory(lockedInventory, aSlot); - if(tInv == null) return null; + if (tInv == null) return null; inv = tInv.getLeft(); tSlot = tInv.getRight(); } else { @@ -785,8 +822,7 @@ public abstract class MultiBlockController<T extends MultiBlockController<T>> ex setInventorySlotContents(aSlot, null); } else { rStack = tStack.splitStack(aDecrement); - if (tStack.stackSize == 0) - setInventorySlotContents(aSlot, null); + if (tStack.stackSize == 0) setInventorySlotContents(aSlot, null); } } return rStack; @@ -833,7 +869,8 @@ public abstract class MultiBlockController<T extends MultiBlockController<T>> ex @Override public void markDirty(MultiBlockPart aPart) { // TODO: MultiInventory - Consider the part? - markDirty(); markInventoryBeenModified(); + markDirty(); + markInventoryBeenModified(); } @Override 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 6c36798197..628992a931 100644 --- a/src/main/java/gregtech/api/multitileentity/multiblock/base/MultiBlockPart.java +++ b/src/main/java/gregtech/api/multitileentity/multiblock/base/MultiBlockPart.java @@ -1,20 +1,36 @@ package gregtech.api.multitileentity.multiblock.base; +import static com.google.common.math.LongMath.log2; +import static gregtech.api.enums.GT_Values.ALL_VALID_SIDES; +import static gregtech.api.enums.GT_Values.B; +import static gregtech.api.enums.GT_Values.NBT; +import static gregtech.api.enums.GT_Values.SIDE_UNKNOWN; +import static gregtech.api.enums.Textures.BlockIcons.FLUID_IN_SIGN; +import static gregtech.api.enums.Textures.BlockIcons.FLUID_OUT_SIGN; +import static gregtech.api.enums.Textures.BlockIcons.ITEM_IN_SIGN; +import static gregtech.api.enums.Textures.BlockIcons.ITEM_OUT_SIGN; +import static gregtech.api.enums.Textures.BlockIcons.OVERLAY_ENERGY_IN_MULTI; +import static gregtech.api.enums.Textures.BlockIcons.OVERLAY_ENERGY_OUT_MULTI; +import static gregtech.api.enums.Textures.BlockIcons.OVERLAY_PIPE_IN; +import static gregtech.api.enums.Textures.BlockIcons.OVERLAY_PIPE_OUT; +import static org.apache.commons.lang3.ObjectUtils.firstNonNull; + import gregtech.api.enums.GT_Values; import gregtech.api.enums.Textures; import gregtech.api.interfaces.IIconContainer; import gregtech.api.interfaces.ITexture; import gregtech.api.multitileentity.MultiTileEntityRegistry; -import gregtech.api.multitileentity.base.BaseMultiTileEntity; import gregtech.api.multitileentity.base.BaseNontickableMultiTileEntity; import gregtech.api.multitileentity.interfaces.IMultiBlockController; import gregtech.api.multitileentity.interfaces.IMultiTileEntity.IMTE_BreakBlock; import gregtech.api.render.TextureFactory; import gregtech.api.util.GT_CoverBehaviorBase; -import gregtech.api.util.GT_Util; import gregtech.api.util.GT_Utility; import gregtech.api.util.ISerializableObject; -import gregtech.common.render.GT_MultiTexture; +import java.math.RoundingMode; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; import mcp.mobius.waila.api.IWailaConfigHandler; import mcp.mobius.waila.api.IWailaDataAccessor; import net.minecraft.block.Block; @@ -29,44 +45,23 @@ import net.minecraftforge.fluids.Fluid; import net.minecraftforge.fluids.FluidStack; import net.minecraftforge.fluids.FluidTankInfo; -import java.math.RoundingMode; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.List; - -import static com.google.common.math.LongMath.log2; -import static gregtech.api.enums.GT_Values.ALL_VALID_SIDES; -import static gregtech.api.enums.GT_Values.B; -import static gregtech.api.enums.GT_Values.NBT; -import static gregtech.api.enums.GT_Values.SIDE_UNKNOWN; -import static gregtech.api.enums.Textures.BlockIcons.FLUID_IN_SIGN; -import static gregtech.api.enums.Textures.BlockIcons.FLUID_OUT_SIGN; -import static gregtech.api.enums.Textures.BlockIcons.ITEM_IN_SIGN; -import static gregtech.api.enums.Textures.BlockIcons.ITEM_OUT_SIGN; -import static gregtech.api.enums.Textures.BlockIcons.MACHINE_CASINGS; -import static gregtech.api.enums.Textures.BlockIcons.OVERLAY_ENERGY_IN_MULTI; -import static gregtech.api.enums.Textures.BlockIcons.OVERLAY_ENERGY_OUT_MULTI; -import static gregtech.api.enums.Textures.BlockIcons.OVERLAY_PIPE_IN; -import static gregtech.api.enums.Textures.BlockIcons.OVERLAY_PIPE_OUT; -import static org.apache.commons.lang3.ObjectUtils.firstNonNull; - public class MultiBlockPart extends BaseNontickableMultiTileEntity implements IMTE_BreakBlock { - public static final int - NOTHING = 0, - ENERGY_IN = B[0], - ENERGY_OUT = B[1], - FLUID_IN = B[2], - FLUID_OUT = B[3], - ITEM_IN = B[4], - ITEM_OUT = B[5]; + public static final int NOTHING = 0, + ENERGY_IN = B[0], + ENERGY_OUT = B[1], + FLUID_IN = B[2], + FLUID_OUT = B[3], + ITEM_IN = B[4], + ITEM_OUT = B[5]; - protected final List<Integer> BASIC_MODES = new ArrayList<>(Arrays.asList(NOTHING, ENERGY_IN, ENERGY_OUT, FLUID_IN, FLUID_OUT, ITEM_IN, ITEM_OUT)); + protected final List<Integer> BASIC_MODES = + new ArrayList<>(Arrays.asList(NOTHING, ENERGY_IN, ENERGY_OUT, FLUID_IN, FLUID_OUT, ITEM_IN, ITEM_OUT)); protected ChunkCoordinates mTargetPos = null; protected IMultiBlockController mTarget = null; - protected int mAllowedModes = NOTHING; // BITMASK - Modes allowed for this part - protected byte mMode = 0; // Mode selected for this part + protected int mAllowedModes = NOTHING; // BITMASK - Modes allowed for this part + protected byte mMode = 0; // Mode selected for this part /** * What Part Tier is this part? All Basic Casings are Tier 1, and will allow: @@ -89,7 +84,7 @@ public class MultiBlockPart extends BaseNontickableMultiTileEntity implements IM @Override protected void addDebugInfo(EntityPlayer aPlayer, int aLogLevel, ArrayList<String> tList) { final IMultiBlockController controller = getTarget(false); - if(controller != null) { + if (controller != null) { tList.add("Has controller"); } else { tList.add("No Controller"); @@ -98,7 +93,8 @@ public class MultiBlockPart extends BaseNontickableMultiTileEntity implements IM } @Override - public void getWailaBody(ItemStack itemStack, List<String> currenttip, IWailaDataAccessor accessor, IWailaConfigHandler config) { + public void getWailaBody( + ItemStack itemStack, List<String> currenttip, IWailaDataAccessor accessor, IWailaConfigHandler config) { super.getWailaBody(itemStack, currenttip, accessor, config); currenttip.add(String.format("Mode: %s", getModeName(mMode))); } @@ -109,17 +105,15 @@ public class MultiBlockPart extends BaseNontickableMultiTileEntity implements IM if (worldObj.blockExists(mTargetPos.posX, mTargetPos.posY, mTargetPos.posZ)) { final TileEntity te = worldObj.getTileEntity(mTargetPos.posX, mTargetPos.posY, mTargetPos.posZ); if (te instanceof IMultiBlockController) { - mTarget = (IMultiBlockController)te; + mTarget = (IMultiBlockController) te; } else { mTargetPos = null; } } } - if(aCheckValidity) { + if (aCheckValidity) { return mTarget != null && mTarget.checkStructure(false) ? mTarget : null; - } - else - return mTarget; + } else return mTarget; } @Override @@ -127,9 +121,9 @@ public class MultiBlockPart extends BaseNontickableMultiTileEntity implements IM if (aNBT.hasKey(NBT.ALLOWED_MODES)) mAllowedModes = aNBT.getInteger(NBT.ALLOWED_MODES); if (aNBT.hasKey(NBT.MODE)) mMode = aNBT.getByte(NBT.MODE); if (aNBT.hasKey(NBT.TARGET)) { - mTargetPos = new ChunkCoordinates(aNBT.getInteger(NBT.TARGET_X), aNBT.getShort(NBT.TARGET_Y), aNBT.getInteger(NBT.TARGET_Z)); + mTargetPos = new ChunkCoordinates( + aNBT.getInteger(NBT.TARGET_X), aNBT.getShort(NBT.TARGET_Y), aNBT.getInteger(NBT.TARGET_Z)); } - } @Override @@ -139,7 +133,7 @@ public class MultiBlockPart extends BaseNontickableMultiTileEntity implements IM if (mTargetPos != null) { aNBT.setBoolean(NBT.TARGET, true); aNBT.setInteger(NBT.TARGET_X, mTargetPos.posX); - aNBT.setShort(NBT.TARGET_Y, (short)mTargetPos.posY); + aNBT.setShort(NBT.TARGET_Y, (short) mTargetPos.posY); aNBT.setInteger(NBT.TARGET_Z, mTargetPos.posZ); } } @@ -155,9 +149,8 @@ public class MultiBlockPart extends BaseNontickableMultiTileEntity implements IM * Returns true if the part has any of the modes provided, and that mode is the currently selected mode */ public boolean modeSelected(int... aModes) { - for(int aMode : aModes) { - if (hasMode(aMode) && mMode == getModeOrdinal(aMode)) - return true; + for (int aMode : aModes) { + if (hasMode(aMode) && mMode == getModeOrdinal(aMode)) return true; } return false; } @@ -174,10 +167,10 @@ public class MultiBlockPart extends BaseNontickableMultiTileEntity implements IM for (byte tSide : ALL_VALID_SIDES) { final TileEntity te = getTileEntityAtSide(tSide); if (te instanceof MultiBlockPart) { - final IMultiBlockController tController = ((MultiBlockPart)te).getTarget(false); + final IMultiBlockController tController = ((MultiBlockPart) te).getTarget(false); if (tController != null) tController.onStructureChange(); } else if (te instanceof IMultiBlockController) { - ((IMultiBlockController)te).onStructureChange(); + ((IMultiBlockController) te).onStructureChange(); } } } @@ -192,51 +185,55 @@ public class MultiBlockPart extends BaseNontickableMultiTileEntity implements IM mMode = aData; } - @Override public void loadTextureNBT(NBTTagCompound aNBT) { // Loading the registry final String textureName = aNBT.getString(NBT.TEXTURE); mTextures = new IIconContainer[] { - new Textures.BlockIcons.CustomIcon("multitileentity/multiblockparts/"+textureName+"/bottom"), - new Textures.BlockIcons.CustomIcon("multitileentity/multiblockparts/"+textureName+"/top"), - new Textures.BlockIcons.CustomIcon("multitileentity/multiblockparts/"+textureName+"/side"), - new Textures.BlockIcons.CustomIcon("multitileentity/multiblockparts/"+textureName+"/overlay/bottom"), - new Textures.BlockIcons.CustomIcon("multitileentity/multiblockparts/"+textureName+"/overlay/top"), - new Textures.BlockIcons.CustomIcon("multitileentity/multiblockparts/"+textureName+"/overlay/side") + new Textures.BlockIcons.CustomIcon("multitileentity/multiblockparts/" + textureName + "/bottom"), + new Textures.BlockIcons.CustomIcon("multitileentity/multiblockparts/" + textureName + "/top"), + new Textures.BlockIcons.CustomIcon("multitileentity/multiblockparts/" + textureName + "/side"), + new Textures.BlockIcons.CustomIcon("multitileentity/multiblockparts/" + textureName + "/overlay/bottom"), + new Textures.BlockIcons.CustomIcon("multitileentity/multiblockparts/" + textureName + "/overlay/top"), + new Textures.BlockIcons.CustomIcon("multitileentity/multiblockparts/" + textureName + "/overlay/side") }; } @Override public void copyTextures() { // Loading an instance - final TileEntity tCanonicalTileEntity = MultiTileEntityRegistry.getCanonicalTileEntity(getMultiTileEntityRegistryID(), getMultiTileEntityID()); - if(tCanonicalTileEntity instanceof MultiBlockPart) - mTextures = ((MultiBlockPart)tCanonicalTileEntity).mTextures; + final TileEntity tCanonicalTileEntity = + MultiTileEntityRegistry.getCanonicalTileEntity(getMultiTileEntityRegistryID(), getMultiTileEntityID()); + if (tCanonicalTileEntity instanceof MultiBlockPart) + mTextures = ((MultiBlockPart) tCanonicalTileEntity).mTextures; } - @Override public ITexture[] getTexture(Block aBlock, byte aSide, boolean isActive, int aRenderPass) { // For normal parts - texture comes from BaseMTE; overlay based on current mode // TODO(MTE) - For Advanced parts they might come from somewhere else final ITexture baseTexture = TextureFactory.of(super.getTexture(aBlock, aSide, isActive, aRenderPass)); - if(mMode != 0 && aSide == mFacing) { - if(mMode == getModeOrdinal(ITEM_IN)) - return new ITexture[]{ baseTexture, TextureFactory.of(OVERLAY_PIPE_IN), TextureFactory.of(ITEM_IN_SIGN) }; - if(mMode == getModeOrdinal(ITEM_OUT)) - return new ITexture[]{ baseTexture, TextureFactory.of(OVERLAY_PIPE_OUT), TextureFactory.of(ITEM_OUT_SIGN) }; - if(mMode == getModeOrdinal(FLUID_IN)) - return new ITexture[]{ baseTexture, TextureFactory.of(OVERLAY_PIPE_IN), TextureFactory.of(FLUID_IN_SIGN) }; - if(mMode == getModeOrdinal(FLUID_OUT)) - return new ITexture[]{ baseTexture, TextureFactory.of(OVERLAY_PIPE_OUT), TextureFactory.of(FLUID_OUT_SIGN) }; - if(mMode == getModeOrdinal(ENERGY_IN)) - return new ITexture[]{ baseTexture, TextureFactory.of(OVERLAY_ENERGY_IN_MULTI)}; - if(mMode == getModeOrdinal(ENERGY_OUT)) - return new ITexture[]{ baseTexture, TextureFactory.of(OVERLAY_ENERGY_OUT_MULTI)}; - + if (mMode != 0 && aSide == mFacing) { + if (mMode == getModeOrdinal(ITEM_IN)) + return new ITexture[] {baseTexture, TextureFactory.of(OVERLAY_PIPE_IN), TextureFactory.of(ITEM_IN_SIGN) + }; + if (mMode == getModeOrdinal(ITEM_OUT)) + return new ITexture[] { + baseTexture, TextureFactory.of(OVERLAY_PIPE_OUT), TextureFactory.of(ITEM_OUT_SIGN) + }; + if (mMode == getModeOrdinal(FLUID_IN)) + return new ITexture[] {baseTexture, TextureFactory.of(OVERLAY_PIPE_IN), TextureFactory.of(FLUID_IN_SIGN) + }; + if (mMode == getModeOrdinal(FLUID_OUT)) + return new ITexture[] { + baseTexture, TextureFactory.of(OVERLAY_PIPE_OUT), TextureFactory.of(FLUID_OUT_SIGN) + }; + if (mMode == getModeOrdinal(ENERGY_IN)) + return new ITexture[] {baseTexture, TextureFactory.of(OVERLAY_ENERGY_IN_MULTI)}; + if (mMode == getModeOrdinal(ENERGY_OUT)) + return new ITexture[] {baseTexture, TextureFactory.of(OVERLAY_ENERGY_OUT_MULTI)}; } - return new ITexture[]{ baseTexture }; + return new ITexture[] {baseTexture}; } @Override @@ -245,46 +242,38 @@ public class MultiBlockPart extends BaseNontickableMultiTileEntity implements IM } protected String getModeName(int aMode) { - if(aMode == NOTHING) - return "Nothing"; - if(aMode == getModeOrdinal(ITEM_IN)) - return "Item Input"; - if(aMode == getModeOrdinal(ITEM_OUT)) - return "Item Output"; - if(aMode == getModeOrdinal(FLUID_IN)) - return "Fluid Input"; - if(aMode == getModeOrdinal(FLUID_OUT)) - return "Fluid Output"; - if(aMode == getModeOrdinal(ENERGY_IN)) - return "Energy Input"; - if(aMode == getModeOrdinal(ENERGY_OUT)) - return "Energy Output"; + if (aMode == NOTHING) return "Nothing"; + if (aMode == getModeOrdinal(ITEM_IN)) return "Item Input"; + if (aMode == getModeOrdinal(ITEM_OUT)) return "Item Output"; + if (aMode == getModeOrdinal(FLUID_IN)) return "Fluid Input"; + if (aMode == getModeOrdinal(FLUID_OUT)) return "Fluid Output"; + if (aMode == getModeOrdinal(ENERGY_IN)) return "Energy Input"; + if (aMode == getModeOrdinal(ENERGY_OUT)) return "Energy Output"; return "Unknown"; } protected byte getModeOrdinal(int aMode) { // log2 returns the bit position of the only bit set, add 1 to account for 0 being NOTHING // NOTE: Must be a power of 2 (single bit) - return (byte)(log2(aMode, RoundingMode.UNNECESSARY) + 1); + return (byte) (log2(aMode, RoundingMode.UNNECESSARY) + 1); } + protected byte getNextAllowedMode(List<Integer> allowedModes) { - if(mAllowedModes == NOTHING) - return NOTHING; + if (mAllowedModes == NOTHING) return NOTHING; final int numModes = allowedModes.size(); - for(byte i = 1 ; i <= numModes ; i++) { - final byte curMode = (byte)((mMode + i) % numModes); - if(curMode == NOTHING || hasMode(1 << (curMode - 1))) - return curMode; + for (byte i = 1; i <= numModes; i++) { + final byte curMode = (byte) ((mMode + i) % numModes); + if (curMode == NOTHING || hasMode(1 << (curMode - 1))) return curMode; } // Nothing valid found return 0; } @Override - public boolean onMalletRightClick(EntityPlayer aPlayer, ItemStack tCurrentItem, byte wrenchSide, float aX, float aY, float aZ) { - if(mAllowedModes == NOTHING) - return true; + public boolean onMalletRightClick( + EntityPlayer aPlayer, ItemStack tCurrentItem, byte wrenchSide, float aX, float aY, float aZ) { + if (mAllowedModes == NOTHING) return true; mMode = getNextAllowedMode(BASIC_MODES); GT_Utility.sendChatToPlayer(aPlayer, "Mode set to `" + getModeName(mMode) + "' (" + mMode + ")"); @@ -293,17 +282,15 @@ public class MultiBlockPart extends BaseNontickableMultiTileEntity implements IM } @Override - public void setLightValue(byte aLightValue) { - - } + public void setLightValue(byte aLightValue) {} @Override public byte getComparatorValue(byte aSide) { return 0; } - - @Override public String getTileEntityName() { + @Override + public String getTileEntityName() { return "gt.multitileentity.multiblock.part"; } @@ -318,8 +305,9 @@ public class MultiBlockPart extends BaseNontickableMultiTileEntity implements IM @Override public int fill(ForgeDirection aDirection, FluidStack aFluidStack, boolean aDoFill) { if (!modeSelected(FLUID_IN)) return 0; - final byte aSide = (byte)aDirection.ordinal(); - if(aDirection != ForgeDirection.UNKNOWN && (aSide != mFacing || !coverLetsFluidIn(aSide, aFluidStack == null ? null : aFluidStack.getFluid()))) + final byte aSide = (byte) aDirection.ordinal(); + if (aDirection != ForgeDirection.UNKNOWN + && (aSide != mFacing || !coverLetsFluidIn(aSide, aFluidStack == null ? null : aFluidStack.getFluid()))) return 0; final IMultiBlockController controller = getTarget(true); return controller == null ? 0 : controller.fill(this, aDirection, aFluidStack, aDoFill); @@ -328,8 +316,9 @@ public class MultiBlockPart extends BaseNontickableMultiTileEntity implements IM @Override public FluidStack drain(ForgeDirection aDirection, FluidStack aFluidStack, boolean aDoDrain) { if (!modeSelected(FLUID_OUT)) return null; - final byte aSide = (byte)aDirection.ordinal(); - if(aDirection != ForgeDirection.UNKNOWN && (aSide != mFacing || !coverLetsFluidOut(aSide, aFluidStack == null ? null : aFluidStack.getFluid()))) + final byte aSide = (byte) aDirection.ordinal(); + if (aDirection != ForgeDirection.UNKNOWN + && (aSide != mFacing || !coverLetsFluidOut(aSide, aFluidStack == null ? null : aFluidStack.getFluid()))) return null; final IMultiBlockController controller = getTarget(true); return controller == null ? null : controller.drain(this, aDirection, aFluidStack, aDoDrain); @@ -338,11 +327,12 @@ public class MultiBlockPart extends BaseNontickableMultiTileEntity implements IM @Override public FluidStack drain(ForgeDirection aDirection, int aAmountToDrain, boolean aDoDrain) { if (!modeSelected(FLUID_OUT)) return null; - final byte aSide = (byte)aDirection.ordinal(); + final byte aSide = (byte) aDirection.ordinal(); final IMultiBlockController controller = getTarget(true); if (controller == null) return null; final FluidStack aFluidStack = controller.getDrainableFluid(aSide); - if(aDirection != ForgeDirection.UNKNOWN && (aSide != mFacing || !coverLetsFluidOut(aSide, aFluidStack == null ? null : aFluidStack.getFluid()))) + if (aDirection != ForgeDirection.UNKNOWN + && (aSide != mFacing || !coverLetsFluidOut(aSide, aFluidStack == null ? null : aFluidStack.getFluid()))) return null; return controller.drain(this, aDirection, aAmountToDrain, aDoDrain); } @@ -350,8 +340,8 @@ public class MultiBlockPart extends BaseNontickableMultiTileEntity implements IM @Override public boolean canFill(ForgeDirection aDirection, Fluid aFluid) { if (!modeSelected(FLUID_IN)) return false; - final byte aSide = (byte)aDirection.ordinal(); - if(aDirection != ForgeDirection.UNKNOWN && (aSide != mFacing || !coverLetsFluidIn(aSide, aFluid))) + final byte aSide = (byte) aDirection.ordinal(); + if (aDirection != ForgeDirection.UNKNOWN && (aSide != mFacing || !coverLetsFluidIn(aSide, aFluid))) return false; final IMultiBlockController controller = getTarget(true); return controller != null && controller.canFill(this, aDirection, aFluid); @@ -360,8 +350,8 @@ public class MultiBlockPart extends BaseNontickableMultiTileEntity implements IM @Override public boolean canDrain(ForgeDirection aDirection, Fluid aFluid) { if (!modeSelected(FLUID_OUT)) return false; - final byte aSide = (byte)aDirection.ordinal(); - if(aDirection != ForgeDirection.UNKNOWN && (aSide != mFacing || !coverLetsFluidOut(aSide, aFluid))) + final byte aSide = (byte) aDirection.ordinal(); + if (aDirection != ForgeDirection.UNKNOWN && (aSide != mFacing || !coverLetsFluidOut(aSide, aFluid))) return false; final IMultiBlockController controller = getTarget(true); return controller != null && controller.canDrain(this, aDirection, aFluid); @@ -370,16 +360,18 @@ public class MultiBlockPart extends BaseNontickableMultiTileEntity implements IM @Override public FluidTankInfo[] getTankInfo(ForgeDirection aDirection) { final byte aSide = (byte) aDirection.ordinal(); - if (!modeSelected(FLUID_IN, FLUID_OUT) || (aSide != SIDE_UNKNOWN && aSide != mFacing)) return GT_Values.emptyFluidTankInfo; + if (!modeSelected(FLUID_IN, FLUID_OUT) || (aSide != SIDE_UNKNOWN && aSide != mFacing)) + return GT_Values.emptyFluidTankInfo; final IMultiBlockController controller = getTarget(true); - if(controller == null) return GT_Values.emptyFluidTankInfo; + if (controller == null) return GT_Values.emptyFluidTankInfo; final GT_CoverBehaviorBase<?> tCover = getCoverBehaviorAtSideNew(aSide); final int coverId = getCoverIDAtSide(aSide); final ISerializableObject complexCoverData = getComplexCoverDataAtSide(aSide); - if((controller.isLiquidInput(aSide) && tCover.letsFluidIn(aSide, coverId, complexCoverData, null, controller)) || - (controller.isLiquidOutput(aSide) && tCover.letsFluidOut(aSide, coverId, complexCoverData, null, controller))) + if ((controller.isLiquidInput(aSide) && tCover.letsFluidIn(aSide, coverId, complexCoverData, null, controller)) + || (controller.isLiquidOutput(aSide) + && tCover.letsFluidOut(aSide, coverId, complexCoverData, null, controller))) return controller.getTankInfo(this, aDirection); return GT_Values.emptyFluidTankInfo; @@ -388,7 +380,6 @@ public class MultiBlockPart extends BaseNontickableMultiTileEntity implements IM /** * Energy - Depending on the part type - proxy to the multiblock controller, if we have one */ - @Override public boolean isEnetInput() { return modeSelected(ENERGY_IN); @@ -404,7 +395,6 @@ public class MultiBlockPart extends BaseNontickableMultiTileEntity implements IM if (!modeSelected(ENERGY_OUT, ENERGY_IN)) return false; final IMultiBlockController controller = getTarget(true); return controller != null && controller.isUniversalEnergyStored(this, aEnergyAmount); - } @Override @@ -453,37 +443,41 @@ public class MultiBlockPart extends BaseNontickableMultiTileEntity implements IM public boolean decreaseStoredEnergyUnits(long aEnergy, boolean aIgnoreTooLittleEnergy) { if (!modeSelected(ENERGY_IN)) return false; final IMultiBlockController controller = getTarget(true); - return controller != null && hasMode(ENERGY_OUT) && controller.decreaseStoredEnergyUnits(this, aEnergy, aIgnoreTooLittleEnergy); + return controller != null + && hasMode(ENERGY_OUT) + && controller.decreaseStoredEnergyUnits(this, aEnergy, aIgnoreTooLittleEnergy); } @Override public boolean increaseStoredEnergyUnits(long aEnergy, boolean aIgnoreTooMuchEnergy) { if (!modeSelected(ENERGY_IN)) return false; final IMultiBlockController controller = getTarget(true); - return controller != null && hasMode(ENERGY_IN) && controller.increaseStoredEnergyUnits(this, aEnergy, aIgnoreTooMuchEnergy); + return controller != null + && hasMode(ENERGY_IN) + && controller.increaseStoredEnergyUnits(this, aEnergy, aIgnoreTooMuchEnergy); } @Override public boolean drainEnergyUnits(byte aSide, long aVoltage, long aAmperage) { - if(!modeSelected(ENERGY_OUT) || (mFacing != SIDE_UNKNOWN && (mFacing != aSide || !coverLetsEnergyOut(aSide)))) return false; + if (!modeSelected(ENERGY_OUT) || (mFacing != SIDE_UNKNOWN && (mFacing != aSide || !coverLetsEnergyOut(aSide)))) + return false; final IMultiBlockController controller = getTarget(true); return controller != null && controller.drainEnergyUnits(this, aSide, aVoltage, aAmperage); } - @Override public long injectEnergyUnits(byte aSide, long aVoltage, long aAmperage) { - if (!modeSelected(ENERGY_IN) || (mFacing != SIDE_UNKNOWN && (mFacing != aSide || !coverLetsEnergyIn(aSide)))) return 0; + if (!modeSelected(ENERGY_IN) || (mFacing != SIDE_UNKNOWN && (mFacing != aSide || !coverLetsEnergyIn(aSide)))) + return 0; final IMultiBlockController controller = getTarget(true); return controller != null ? controller.injectEnergyUnits(this, aSide, aVoltage, aAmperage) : 0; } - @Override public long getAverageElectricInput() { if (!modeSelected(ENERGY_IN)) return 0; final IMultiBlockController controller = getTarget(true); - return controller != null? controller.getAverageElectricInput(this) : 0; + return controller != null ? controller.getAverageElectricInput(this) : 0; } @Override @@ -509,13 +503,16 @@ public class MultiBlockPart extends BaseNontickableMultiTileEntity implements IM @Override public boolean inputEnergyFrom(byte aSide) { - if (!modeSelected(ENERGY_IN) || (mFacing != SIDE_UNKNOWN && (mFacing != aSide || !coverLetsEnergyIn(aSide)))) return false; + if (!modeSelected(ENERGY_IN) || (mFacing != SIDE_UNKNOWN && (mFacing != aSide || !coverLetsEnergyIn(aSide)))) + return false; final IMultiBlockController controller = getTarget(true); return controller != null && controller.inputEnergyFrom(this, aSide); } + @Override public boolean outputsEnergyTo(byte aSide) { - if(!modeSelected(ENERGY_OUT) || (mFacing != SIDE_UNKNOWN && (mFacing != aSide || !coverLetsEnergyOut(aSide)))) return false; + if (!modeSelected(ENERGY_OUT) || (mFacing != SIDE_UNKNOWN && (mFacing != aSide || !coverLetsEnergyOut(aSide)))) + return false; final IMultiBlockController controller = getTarget(true); return controller != null && controller.outputsEnergyTo(this, aSide); } @@ -525,7 +522,6 @@ public class MultiBlockPart extends BaseNontickableMultiTileEntity implements IM /** * Inventory - Depending on the part type - proxy to the multiblock controller, if we have one */ - @Override public boolean hasInventoryBeenModified() { final IMultiBlockController controller = getTarget(true); @@ -552,23 +548,28 @@ public class MultiBlockPart extends BaseNontickableMultiTileEntity implements IM return (controller != null && controller.addStackToSlot(this, aIndex, aStack, aAmount)); } - @Override public int[] getAccessibleSlotsFromSide(int aSide) { - if (!modeSelected(ITEM_IN, ITEM_OUT) || (mFacing != SIDE_UNKNOWN && mFacing != aSide)) return GT_Values.emptyIntArray; + if (!modeSelected(ITEM_IN, ITEM_OUT) || (mFacing != SIDE_UNKNOWN && mFacing != aSide)) + return GT_Values.emptyIntArray; final IMultiBlockController controller = getTarget(true); return controller != null ? controller.getAccessibleSlotsFromSide(this, (byte) aSide) : GT_Values.emptyIntArray; } @Override public boolean canInsertItem(int aSlot, ItemStack aStack, int aSide) { - if (!modeSelected(ITEM_IN) || (mFacing != SIDE_UNKNOWN && (mFacing != aSide || !coverLetsItemsIn((byte)aSide, aSlot)))) return false; + if (!modeSelected(ITEM_IN) + || (mFacing != SIDE_UNKNOWN && (mFacing != aSide || !coverLetsItemsIn((byte) aSide, aSlot)))) + return false; final IMultiBlockController controller = getTarget(true); return (controller != null && controller.canInsertItem(this, aSlot, aStack, (byte) aSide)); } + @Override public boolean canExtractItem(int aSlot, ItemStack aStack, int aSide) { - if (!modeSelected(ITEM_OUT) || (mFacing != SIDE_UNKNOWN && (mFacing != aSide || !coverLetsItemsOut((byte)aSide, aSlot)))) return false; + if (!modeSelected(ITEM_OUT) + || (mFacing != SIDE_UNKNOWN && (mFacing != aSide || !coverLetsItemsOut((byte) aSide, aSlot)))) + return false; final IMultiBlockController controller = getTarget(true); return (controller != null && controller.canExtractItem(this, aSlot, aStack, (byte) aSide)); } @@ -603,14 +604,13 @@ public class MultiBlockPart extends BaseNontickableMultiTileEntity implements IM @Override public void setInventorySlotContents(int aSlot, ItemStack aStack) { final IMultiBlockController controller = getTarget(true); - if(controller != null) controller.setInventorySlotContents(this, aSlot, aStack); + if (controller != null) controller.setInventorySlotContents(this, aSlot, aStack); } @Override public String getInventoryName() { final IMultiBlockController controller = getTarget(true); - if(controller != null) - return controller.getInventoryName(this); + if (controller != null) return controller.getInventoryName(this); return firstNonNull(getCustomName(), getTileEntityName()); } @@ -620,7 +620,6 @@ public class MultiBlockPart extends BaseNontickableMultiTileEntity implements IM return controller != null ? controller.getInventoryStackLimit(this) : 0; } - @Override public boolean isItemValidForSlot(int aSlot, ItemStack aStack) { final IMultiBlockController controller = getTarget(true); diff --git a/src/main/java/gregtech/api/multitileentity/multiblock/base/MultiBlock_Stackable.java b/src/main/java/gregtech/api/multitileentity/multiblock/base/MultiBlock_Stackable.java index f19d3156fa..92931bc4db 100644 --- a/src/main/java/gregtech/api/multitileentity/multiblock/base/MultiBlock_Stackable.java +++ b/src/main/java/gregtech/api/multitileentity/multiblock/base/MultiBlock_Stackable.java @@ -1,7 +1,6 @@ package gregtech.api.multitileentity.multiblock.base; import com.gtnewhorizon.structurelib.util.Vec3Impl; - import net.minecraft.item.ItemStack; public abstract class MultiBlock_Stackable<T extends MultiBlock_Stackable<T>> extends MultiBlockController<T> { @@ -25,7 +24,7 @@ public abstract class MultiBlock_Stackable<T extends MultiBlock_Stackable<T>> ex buildPiece(STACKABLE_MIDDLE, trigger, hintsOnly, buildState.getCurrentOffset()); buildState.addOffset(getPerStackOffset()); } - if(hasTop()) { + if (hasTop()) { buildState.addOffset(getAfterLastStackOffset()); buildPiece(STACKABLE_TOP, trigger, hintsOnly, buildState.stopBuilding()); } else { @@ -86,8 +85,7 @@ public abstract class MultiBlock_Stackable<T extends MultiBlock_Stackable<T>> ex int stackCount = 0; buildState.startBuilding(getStartingStructureOffset()); - if (!checkPiece(STACKABLE_BOTTOM, buildState.getCurrentOffset())) - return buildState.failBuilding(); + if (!checkPiece(STACKABLE_BOTTOM, buildState.getCurrentOffset())) return buildState.failBuilding(); buildState.addOffset(getStartingStackOffset()); @@ -99,8 +97,7 @@ public abstract class MultiBlock_Stackable<T extends MultiBlock_Stackable<T>> ex break; } } - if (stackCount < getMinStacks()) - return buildState.failBuilding(); + if (stackCount < getMinStacks()) return buildState.failBuilding(); buildState.addOffset(getAfterLastStackOffset()); return checkPiece(STACKABLE_TOP, buildState.stopBuilding()); @@ -110,5 +107,4 @@ public abstract class MultiBlock_Stackable<T extends MultiBlock_Stackable<T>> ex public boolean checkRecipe(ItemStack aStack) { return false; } - } diff --git a/src/main/java/gregtech/api/multitileentity/multiblock/casing/CasingBehaviorBase.java b/src/main/java/gregtech/api/multitileentity/multiblock/casing/CasingBehaviorBase.java index 8c507db88c..b4b69e0b21 100644 --- a/src/main/java/gregtech/api/multitileentity/multiblock/casing/CasingBehaviorBase.java +++ b/src/main/java/gregtech/api/multitileentity/multiblock/casing/CasingBehaviorBase.java @@ -13,5 +13,4 @@ package gregtech.api.multitileentity.multiblock.casing; * - etc, etc. * */ -public class CasingBehaviorBase { -} +public class CasingBehaviorBase {} diff --git a/src/main/java/gregtech/api/net/GT_Packet_Block_Event.java b/src/main/java/gregtech/api/net/GT_Packet_Block_Event.java index 9060144e22..dd7657e95d 100644 --- a/src/main/java/gregtech/api/net/GT_Packet_Block_Event.java +++ b/src/main/java/gregtech/api/net/GT_Packet_Block_Event.java @@ -37,7 +37,8 @@ public class GT_Packet_Block_Event extends GT_Packet_New { @Override public GT_Packet_New decode(ByteArrayDataInput aData) { - return new GT_Packet_Block_Event(aData.readInt(), aData.readShort(), aData.readInt(), aData.readByte(), aData.readByte()); + return new GT_Packet_Block_Event( + aData.readInt(), aData.readShort(), aData.readInt(), aData.readByte(), aData.readByte()); } @Override diff --git a/src/main/java/gregtech/api/net/GT_Packet_ClientPreference.java b/src/main/java/gregtech/api/net/GT_Packet_ClientPreference.java index 5f2549d13c..f692a4c88a 100644 --- a/src/main/java/gregtech/api/net/GT_Packet_ClientPreference.java +++ b/src/main/java/gregtech/api/net/GT_Packet_ClientPreference.java @@ -36,8 +36,7 @@ public class GT_Packet_ClientPreference extends GT_Packet_New { @Override public void process(IBlockAccess aWorld) { - if (mPlayer != null) - GT_Mod.gregtechproxy.setClientPreference(mPlayer.getUniqueID(), mPreference); + if (mPlayer != null) GT_Mod.gregtechproxy.setClientPreference(mPlayer.getUniqueID(), mPreference); } @Override @@ -49,6 +48,7 @@ public class GT_Packet_ClientPreference extends GT_Packet_New { @Override public GT_Packet_New decode(ByteArrayDataInput aData) { - return new GT_Packet_ClientPreference(new GT_ClientPreference(aData.readBoolean(), aData.readBoolean(), aData.readBoolean())); + return new GT_Packet_ClientPreference( + new GT_ClientPreference(aData.readBoolean(), aData.readBoolean(), aData.readBoolean())); } } diff --git a/src/main/java/gregtech/api/net/GT_Packet_GtTileEntityGuiRequest.java b/src/main/java/gregtech/api/net/GT_Packet_GtTileEntityGuiRequest.java index bf412c4400..9f32ad4bae 100644 --- a/src/main/java/gregtech/api/net/GT_Packet_GtTileEntityGuiRequest.java +++ b/src/main/java/gregtech/api/net/GT_Packet_GtTileEntityGuiRequest.java @@ -1,7 +1,6 @@ package gregtech.api.net; import com.google.common.io.ByteArrayDataInput; - import gregtech.api.enums.GT_Values; import gregtech.api.interfaces.tileentity.IGregTechTileEntity; import gregtech.common.GT_Proxy; @@ -17,7 +16,6 @@ import net.minecraftforge.common.DimensionManager; */ public class GT_Packet_GtTileEntityGuiRequest extends GT_Packet_New { - protected int mX; protected short mY; protected int mZ; @@ -31,7 +29,8 @@ public class GT_Packet_GtTileEntityGuiRequest extends GT_Packet_New { super(true); } - public GT_Packet_GtTileEntityGuiRequest(int mX, short mY, int mZ, int guiId, int dimID, int playerID, int parentGuiId) { + public GT_Packet_GtTileEntityGuiRequest( + int mX, short mY, int mZ, int guiId, int dimID, int playerID, int parentGuiId) { super(false); this.mX = mX; this.mY = mY; @@ -69,12 +68,9 @@ public class GT_Packet_GtTileEntityGuiRequest extends GT_Packet_New { aData.readInt(), aData.readShort(), aData.readInt(), - aData.readInt(), - aData.readInt(), aData.readInt(), - aData.readInt()); } @@ -91,22 +87,23 @@ public class GT_Packet_GtTileEntityGuiRequest extends GT_Packet_New { if (!(tile instanceof IGregTechTileEntity) || ((IGregTechTileEntity) tile).isDead()) return; IGregTechTileEntity gtTile = ((IGregTechTileEntity) tile); - EntityPlayerMP player = (EntityPlayerMP) world.getEntityByID(playerId); + EntityPlayerMP player = (EntityPlayerMP) world.getEntityByID(playerId); // If the requested Gui ID corresponds to a cover, send the cover data to the client so they can open it. - if (GT_Proxy.GUI_ID_COVER_SIDE_BASE <= guiId && guiId < GT_Proxy.GUI_ID_COVER_SIDE_BASE+6) { + if (GT_Proxy.GUI_ID_COVER_SIDE_BASE <= guiId && guiId < GT_Proxy.GUI_ID_COVER_SIDE_BASE + 6) { byte coverSide = (byte) (guiId - GT_Proxy.GUI_ID_COVER_SIDE_BASE); GT_Packet_TileEntityCoverGUI packet = new GT_Packet_TileEntityCoverGUI( - this.mX, this.mY, this.mZ, - coverSide, - gtTile.getCoverIDAtSide(coverSide), - gtTile.getComplexCoverDataAtSide(coverSide), - this.dimId, - this.playerId, - parentGuiId); + this.mX, + this.mY, + this.mZ, + coverSide, + gtTile.getCoverIDAtSide(coverSide), + gtTile.getComplexCoverDataAtSide(coverSide), + this.dimId, + this.playerId, + parentGuiId); GT_Values.NW.sendToPlayer(packet, player); } else if (guiId == 0) { gtTile.openGUI(player); } } - } diff --git a/src/main/java/gregtech/api/net/GT_Packet_New.java b/src/main/java/gregtech/api/net/GT_Packet_New.java index 10beae0e4d..f4e6f2a0e2 100644 --- a/src/main/java/gregtech/api/net/GT_Packet_New.java +++ b/src/main/java/gregtech/api/net/GT_Packet_New.java @@ -1,29 +1,28 @@ package gregtech.api.net; import com.google.common.io.ByteArrayDataInput; -import gregtech.api.interfaces.tileentity.IGregTechTileEntity; import io.netty.buffer.ByteBuf; import io.netty.buffer.Unpooled; @SuppressWarnings("deprecation") public abstract class GT_Packet_New extends GT_Packet { - public GT_Packet_New(boolean aIsReference) { - super(aIsReference); - } + public GT_Packet_New(boolean aIsReference) { + super(aIsReference); + } - @Override - @Deprecated - public final byte[] encode() { - ByteBuf tOut = Unpooled.buffer(); - encode(tOut); - byte[] bytes = new byte[tOut.readableBytes()]; - tOut.readBytes(bytes); - return bytes; - } + @Override + @Deprecated + public final byte[] encode() { + ByteBuf tOut = Unpooled.buffer(); + encode(tOut); + byte[] bytes = new byte[tOut.readableBytes()]; + tOut.readBytes(bytes); + return bytes; + } - @Override - public abstract void encode(ByteBuf aOut); + @Override + public abstract void encode(ByteBuf aOut); - @Override - public abstract GT_Packet_New decode(ByteArrayDataInput aData); + @Override + public abstract GT_Packet_New decode(ByteArrayDataInput aData); } 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 20efe41679..b79ce20e39 100644 --- a/src/main/java/gregtech/api/net/GT_Packet_Pollution.java +++ b/src/main/java/gregtech/api/net/GT_Packet_Pollution.java @@ -27,10 +27,7 @@ public class GT_Packet_Pollution extends GT_Packet_New { @Override public GT_Packet_New decode(ByteArrayDataInput aData) { - return new GT_Packet_Pollution( - new ChunkCoordIntPair(aData.readInt(), aData.readInt()), - aData.readInt() - ); + return new GT_Packet_Pollution(new ChunkCoordIntPair(aData.readInt(), aData.readInt()), aData.readInt()); } @Override diff --git a/src/main/java/gregtech/api/net/GT_Packet_RequestCoverData.java b/src/main/java/gregtech/api/net/GT_Packet_RequestCoverData.java index cdb744ee32..8084a772bb 100644 --- a/src/main/java/gregtech/api/net/GT_Packet_RequestCoverData.java +++ b/src/main/java/gregtech/api/net/GT_Packet_RequestCoverData.java @@ -1,11 +1,8 @@ package gregtech.api.net; import com.google.common.io.ByteArrayDataInput; -import gregtech.api.GregTech_API; import gregtech.api.interfaces.tileentity.ICoverable; -import gregtech.api.interfaces.tileentity.IGregTechTileEntity; import gregtech.api.metatileentity.CoverableTileEntity; -import gregtech.api.util.ISerializableObject; import io.netty.buffer.ByteBuf; import net.minecraft.entity.player.EntityPlayerMP; import net.minecraft.network.INetHandler; @@ -41,6 +38,7 @@ public class GT_Packet_RequestCoverData extends GT_Packet_New { this.side = coverSide; this.coverID = coverID; } + public GT_Packet_RequestCoverData(byte coverSide, int coverID, ICoverable tile) { super(false); this.mX = tile.getXCoord(); @@ -69,13 +67,7 @@ public class GT_Packet_RequestCoverData extends GT_Packet_New { @Override public GT_Packet_New decode(ByteArrayDataInput aData) { return new GT_Packet_RequestCoverData( - aData.readInt(), - aData.readShort(), - aData.readInt(), - - aData.readByte(), - aData.readInt() - ); + aData.readInt(), aData.readShort(), aData.readInt(), aData.readByte(), aData.readInt()); } @Override @@ -88,7 +80,7 @@ public class GT_Packet_RequestCoverData extends GT_Packet_New { @Override public void process(IBlockAccess aWorld) { if (mPlayer == null) // impossible, but who knows - return; + return; World world = DimensionManager.getWorld(mPlayer.dimension); if (world != null) { final TileEntity tile = world.getTileEntity(mX, mY, mZ); 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 820f4e18d5..ab8b230077 100644 --- a/src/main/java/gregtech/api/net/GT_Packet_SendCoverData.java +++ b/src/main/java/gregtech/api/net/GT_Packet_SendCoverData.java @@ -25,7 +25,8 @@ public class GT_Packet_SendCoverData extends GT_Packet_New { super(true); } - public GT_Packet_SendCoverData(int mX, short mY, int mZ, byte coverSide, int coverID, ISerializableObject coverData) { + public GT_Packet_SendCoverData( + int mX, short mY, int mZ, byte coverSide, int coverID, ISerializableObject coverData) { super(false); this.mX = mX; this.mY = mY; @@ -35,6 +36,7 @@ public class GT_Packet_SendCoverData extends GT_Packet_New { this.coverID = coverID; this.coverData = coverData; } + public GT_Packet_SendCoverData(byte coverSide, int coverID, ISerializableObject coverData, ICoverable tile) { super(false); this.mX = tile.getXCoord(); @@ -69,11 +71,9 @@ public class GT_Packet_SendCoverData extends GT_Packet_New { aData.readInt(), aData.readShort(), 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 1cfe59743c..0561b18ac1 100644 --- a/src/main/java/gregtech/api/net/GT_Packet_SetConfigurationCircuit.java +++ b/src/main/java/gregtech/api/net/GT_Packet_SetConfigurationCircuit.java @@ -5,7 +5,6 @@ import cpw.mods.fml.common.network.ByteBufUtils; import gregtech.api.interfaces.metatileentity.IConfigurationCircuitSupport; import gregtech.api.interfaces.metatileentity.IMetaTileEntity; import gregtech.api.interfaces.tileentity.IGregTechTileEntity; -import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_BasicMachine; import gregtech.api.util.GT_Utility; import gregtech.api.util.ISerializableObject; import io.netty.buffer.ByteBuf; @@ -20,7 +19,6 @@ import net.minecraftforge.common.DimensionManager; /** * Client -> Server: Update machine configuration data */ - public class GT_Packet_SetConfigurationCircuit extends GT_Packet_New { protected int mX; protected short mY; @@ -97,6 +95,7 @@ public class GT_Packet_SetConfigurationCircuit extends GT_Packet_New { machine.getConfigurationCircuits().stream() .filter(stack -> GT_Utility.areStacksEqual(stack, circuit)) .findFirst() - .ifPresent(stack -> ((IGregTechTileEntity) tile).setInventorySlotContents(machine.getCircuitSlot(), stack)); + .ifPresent(stack -> + ((IGregTechTileEntity) tile).setInventorySlotContents(machine.getCircuitSlot(), stack)); } } diff --git a/src/main/java/gregtech/api/net/GT_Packet_SetLockedFluid.java b/src/main/java/gregtech/api/net/GT_Packet_SetLockedFluid.java index 911d48223b..d100dd6055 100644 --- a/src/main/java/gregtech/api/net/GT_Packet_SetLockedFluid.java +++ b/src/main/java/gregtech/api/net/GT_Packet_SetLockedFluid.java @@ -18,76 +18,76 @@ import net.minecraftforge.fluids.FluidRegistry; import net.minecraftforge.fluids.FluidStack; public class GT_Packet_SetLockedFluid extends GT_Packet_New { - protected int mX; - protected short mY; - protected int mZ; - - protected int mFluidID; - - private EntityPlayerMP mPlayer; - - public GT_Packet_SetLockedFluid() { - super(true); - } - - public GT_Packet_SetLockedFluid(IGregTechTileEntity aTile, FluidStack aSource) { - this(aTile.getXCoord(), aTile.getYCoord(), aTile.getZCoord(), aSource.getFluidID()); - } - - public GT_Packet_SetLockedFluid(int x, short y, int z, int aFluidID) { - super(false); - - this.mX = x; - this.mY = y; - this.mZ = z; - - this.mFluidID = aFluidID; - } - - @Override - public byte getPacketID() { - return 14; - } - - @Override - public void encode(ByteBuf aOut) { - aOut.writeInt(mX); - aOut.writeShort(mY); - aOut.writeInt(mZ); - - aOut.writeInt(mFluidID); - } - - @Override - public void setINetHandler(INetHandler aHandler) { - if (aHandler instanceof NetHandlerPlayServer) { - mPlayer = ((NetHandlerPlayServer) aHandler).playerEntity; - } - } - - @Override - public GT_Packet_New decode(ByteArrayDataInput aData) { - return new GT_Packet_SetLockedFluid( - aData.readInt(), - aData.readShort(), - aData.readInt(), - - aData.readInt()); - } - - @Override - public void process(IBlockAccess aWorld) { - if (mPlayer == null) return; - World world = mPlayer.worldObj; - TileEntity tile = world.getTileEntity(mX, mY, mZ); - if (!(tile instanceof IGregTechTileEntity) || ((IGregTechTileEntity) tile).isDead()) return; - IMetaTileEntity mte = ((IGregTechTileEntity) tile).getMetaTileEntity(); - if (!(mte instanceof GT_MetaTileEntity_Hatch_Output)) return; - Fluid tFluid = FluidRegistry.getFluid(mFluidID); - if (tFluid == null) return; + protected int mX; + protected short mY; + protected int mZ; + + protected int mFluidID; + + private EntityPlayerMP mPlayer; + + public GT_Packet_SetLockedFluid() { + super(true); + } + + public GT_Packet_SetLockedFluid(IGregTechTileEntity aTile, FluidStack aSource) { + this(aTile.getXCoord(), aTile.getYCoord(), aTile.getZCoord(), aSource.getFluidID()); + } + + public GT_Packet_SetLockedFluid(int x, short y, int z, int aFluidID) { + super(false); + + this.mX = x; + this.mY = y; + this.mZ = z; + + this.mFluidID = aFluidID; + } + + @Override + public byte getPacketID() { + return 14; + } + + @Override + public void encode(ByteBuf aOut) { + aOut.writeInt(mX); + aOut.writeShort(mY); + aOut.writeInt(mZ); + + aOut.writeInt(mFluidID); + } + + @Override + public void setINetHandler(INetHandler aHandler) { + if (aHandler instanceof NetHandlerPlayServer) { + mPlayer = ((NetHandlerPlayServer) aHandler).playerEntity; + } + } + + @Override + public GT_Packet_New decode(ByteArrayDataInput aData) { + return new GT_Packet_SetLockedFluid(aData.readInt(), aData.readShort(), aData.readInt(), aData.readInt()); + } + + @Override + public void process(IBlockAccess aWorld) { + if (mPlayer == null) return; + World world = mPlayer.worldObj; + TileEntity tile = world.getTileEntity(mX, mY, mZ); + if (!(tile instanceof IGregTechTileEntity) || ((IGregTechTileEntity) tile).isDead()) return; + IMetaTileEntity mte = ((IGregTechTileEntity) tile).getMetaTileEntity(); + if (!(mte instanceof GT_MetaTileEntity_Hatch_Output)) return; + Fluid tFluid = FluidRegistry.getFluid(mFluidID); + if (tFluid == null) return; GT_MetaTileEntity_Hatch_Output hatch = (GT_MetaTileEntity_Hatch_Output) mte; hatch.setLockedFluidName(tFluid.getName()); hatch.mMode = 9; - GT_Utility.sendChatToPlayer(mPlayer, String.format(GT_LanguageManager.addStringLocalization("Interaction_DESCRIPTION_Index_151.4", "Sucessfully locked Fluid to %s", false), new FluidStack(tFluid, 1).getLocalizedName())); - } + GT_Utility.sendChatToPlayer( + mPlayer, + String.format( + GT_LanguageManager.addStringLocalization( + "Interaction_DESCRIPTION_Index_151.4", "Sucessfully locked Fluid to %s", false), + new FluidStack(tFluid, 1).getLocalizedName())); + } } diff --git a/src/main/java/gregtech/api/net/GT_Packet_Sound.java b/src/main/java/gregtech/api/net/GT_Packet_Sound.java index be66400609..ae779efc75 100644 --- a/src/main/java/gregtech/api/net/GT_Packet_Sound.java +++ b/src/main/java/gregtech/api/net/GT_Packet_Sound.java @@ -5,10 +5,9 @@ import gregtech.api.util.GT_Log; import gregtech.api.util.GT_Utility; import io.netty.buffer.ByteBuf; import io.netty.buffer.ByteBufOutputStream; -import net.minecraft.world.IBlockAccess; - import java.io.DataOutput; import java.io.IOException; +import net.minecraft.world.IBlockAccess; public class GT_Packet_Sound extends GT_Packet_New { private int mX, mZ; @@ -48,7 +47,13 @@ public class GT_Packet_Sound extends GT_Packet_New { @Override public GT_Packet_New decode(ByteArrayDataInput aData) { - return new GT_Packet_Sound(aData.readUTF(), aData.readFloat(), aData.readFloat(), aData.readInt(), aData.readShort(), aData.readInt()); + return new GT_Packet_Sound( + aData.readUTF(), + aData.readFloat(), + aData.readFloat(), + aData.readInt(), + aData.readShort(), + aData.readInt()); } @Override 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 970b0ca156..f805fee76c 100644 --- a/src/main/java/gregtech/api/net/GT_Packet_TileEntity.java +++ b/src/main/java/gregtech/api/net/GT_Packet_TileEntity.java @@ -19,7 +19,23 @@ public class GT_Packet_TileEntity extends GT_Packet_New { } // For multi tiles - public GT_Packet_TileEntity(int aX, short aY, int aZ, short aRID, short aID, int aC0, int aC1, int aC2, int aC3, int aC4, int aC5, byte aTexture, byte aTexturePage, byte aUpdate, byte aRedstone, byte aColor) { + public GT_Packet_TileEntity( + int aX, + short aY, + int aZ, + short aRID, + short aID, + int aC0, + int aC1, + int aC2, + int aC3, + int aC4, + int aC5, + byte aTexture, + byte aTexturePage, + byte aUpdate, + byte aRedstone, + byte aColor) { super(false); mX = aX; mY = aY; @@ -33,19 +49,64 @@ public class GT_Packet_TileEntity extends GT_Packet_New { mRID = aRID; mID = aID; mTexture = aTexture; - mTexturePage=aTexturePage; + mTexturePage = aTexturePage; mUpdate = aUpdate; mRedstone = aRedstone; mColor = aColor; } // For meta tiles - public GT_Packet_TileEntity(int aX, short aY, int aZ, short aID, int aC0, int aC1, int aC2, int aC3, int aC4, int aC5, byte aTexture, byte aTexturePage, byte aUpdate, byte aRedstone, byte aColor) { - this(aX, aY, aZ, (short) 0, aID, aC0, aC1, aC2, aC3, aC4, aC5, aTexture, aTexturePage, aUpdate, aRedstone, aColor); + public GT_Packet_TileEntity( + int aX, + short aY, + int aZ, + short aID, + int aC0, + int aC1, + int aC2, + int aC3, + int aC4, + int aC5, + byte aTexture, + byte aTexturePage, + byte aUpdate, + byte aRedstone, + byte aColor) { + this( + aX, + aY, + aZ, + (short) 0, + aID, + aC0, + aC1, + aC2, + aC3, + aC4, + aC5, + aTexture, + aTexturePage, + aUpdate, + aRedstone, + aColor); } // For pipes - public GT_Packet_TileEntity(int aX, short aY, int aZ, short aID, int aC0, int aC1, int aC2, int aC3, int aC4, int aC5, byte aTexture, byte aUpdate, byte aRedstone, byte aColor) { + public GT_Packet_TileEntity( + int aX, + short aY, + int aZ, + short aID, + int aC0, + int aC1, + int aC2, + int aC3, + int aC4, + int aC5, + byte aTexture, + byte aUpdate, + byte aRedstone, + byte aColor) { this(aX, aY, aZ, (short) 0, aID, aC0, aC1, aC2, aC3, aC4, aC5, aTexture, (byte) 0, aUpdate, aRedstone, aColor); } @@ -75,15 +136,26 @@ public class GT_Packet_TileEntity extends GT_Packet_New { @Override public GT_Packet_New decode(ByteArrayDataInput aData) { return new GT_Packet_TileEntity( - // Coords - aData.readInt(), aData.readShort(), aData.readInt(), - // Registry & ID - aData.readShort(), aData.readShort(), - // Covers - aData.readInt(), aData.readInt(), aData.readInt(), aData.readInt(), aData.readInt(), aData.readInt(), - // Everything else - aData.readByte(), aData.readByte(), aData.readByte(), aData.readByte(), aData.readByte() - ); + // Coords + aData.readInt(), + aData.readShort(), + aData.readInt(), + // Registry & ID + aData.readShort(), + aData.readShort(), + // Covers + aData.readInt(), + aData.readInt(), + aData.readInt(), + aData.readInt(), + aData.readInt(), + aData.readInt(), + // Everything else + aData.readByte(), + aData.readByte(), + aData.readByte(), + aData.readByte(), + aData.readByte()); } @Override @@ -92,11 +164,33 @@ public class GT_Packet_TileEntity extends GT_Packet_New { final TileEntity tTileEntity = aWorld.getTileEntity(mX, mY, mZ); final Block tBlock; if (tTileEntity instanceof BaseMetaTileEntity) - ((BaseMetaTileEntity) tTileEntity).receiveMetaTileEntityData(mID, mC0, mC1, mC2, mC3, mC4, mC5, mTexture, mTexturePage, mUpdate, mRedstone, mColor); + ((BaseMetaTileEntity) tTileEntity) + .receiveMetaTileEntityData( + mID, mC0, mC1, mC2, mC3, mC4, mC5, mTexture, mTexturePage, mUpdate, mRedstone, mColor); else if (tTileEntity instanceof BaseMetaPipeEntity) - ((BaseMetaPipeEntity) tTileEntity).receiveMetaTileEntityData(mID, mC0, mC1, mC2, mC3, mC4, mC5, mTexture, mUpdate, mRedstone, mColor); + ((BaseMetaPipeEntity) tTileEntity) + .receiveMetaTileEntityData( + mID, mC0, mC1, mC2, mC3, mC4, mC5, mTexture, mUpdate, mRedstone, mColor); else if ((tBlock = aWorld.getBlock(mX, mY, mZ)) instanceof MultiTileEntityBlock) { - ((MultiTileEntityBlock)tBlock).receiveMultiTileEntityData(aWorld, mX, mY, mZ, mRID, mID, mC0, mC1, mC2, mC3, mC4, mC5, mTexture, mTexturePage, mUpdate, mRedstone, mColor); + ((MultiTileEntityBlock) tBlock) + .receiveMultiTileEntityData( + aWorld, + mX, + mY, + mZ, + mRID, + mID, + mC0, + mC1, + mC2, + mC3, + mC4, + mC5, + mTexture, + mTexturePage, + mUpdate, + mRedstone, + mColor); } } } diff --git a/src/main/java/gregtech/api/net/GT_Packet_TileEntityCover.java b/src/main/java/gregtech/api/net/GT_Packet_TileEntityCover.java index 8035030f19..6989acca9e 100644 --- a/src/main/java/gregtech/api/net/GT_Packet_TileEntityCover.java +++ b/src/main/java/gregtech/api/net/GT_Packet_TileEntityCover.java @@ -36,6 +36,7 @@ public class GT_Packet_TileEntityCover extends GT_Packet_New { this.dimID = dimID; } + public GT_Packet_TileEntityCover(byte coverSide, int coverID, int coverData, ICoverable tile) { super(false); this.mX = tile.getXCoord(); @@ -73,11 +74,9 @@ public class GT_Packet_TileEntityCover extends GT_Packet_New { aData.readInt(), aData.readShort(), aData.readInt(), - aData.readByte(), aData.readInt(), aData.readInt(), - aData.readInt()); } 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 687bceb726..e190648bef 100644 --- a/src/main/java/gregtech/api/net/GT_Packet_TileEntityCoverGUI.java +++ b/src/main/java/gregtech/api/net/GT_Packet_TileEntityCoverGUI.java @@ -34,8 +34,8 @@ public class GT_Packet_TileEntityCoverGUI extends GT_Packet_New { super(true); } - public GT_Packet_TileEntityCoverGUI(int mX, short mY, int mZ, byte coverSide, int coverID, int coverData, int dimID, - int playerID) { + public GT_Packet_TileEntityCoverGUI( + int mX, short mY, int mZ, byte coverSide, int coverID, int coverData, int dimID, int playerID) { super(false); this.mX = mX; this.mY = mY; @@ -50,8 +50,15 @@ public class GT_Packet_TileEntityCoverGUI extends GT_Packet_New { this.parentGuiId = -1; } - public GT_Packet_TileEntityCoverGUI(int mX, short mY, int mZ, byte coverSide, int coverID, - ISerializableObject coverData, int dimID, int playerID) { + public GT_Packet_TileEntityCoverGUI( + int mX, + short mY, + int mZ, + byte coverSide, + int coverID, + ISerializableObject coverData, + int dimID, + int playerID) { super(false); this.mX = mX; this.mY = mY; @@ -65,8 +72,16 @@ public class GT_Packet_TileEntityCoverGUI extends GT_Packet_New { this.parentGuiId = -1; } - public GT_Packet_TileEntityCoverGUI(int mX, short mY, int mZ, byte coverSide, int coverID, - ISerializableObject coverData, int dimID, int playerID, int parentGuiId) { + public GT_Packet_TileEntityCoverGUI( + int mX, + short mY, + int mZ, + byte coverSide, + int coverID, + ISerializableObject coverData, + int dimID, + int playerID, + int parentGuiId) { super(false); this.mX = mX; this.mY = mY; @@ -80,8 +95,8 @@ public class GT_Packet_TileEntityCoverGUI extends GT_Packet_New { this.parentGuiId = parentGuiId; } - - public GT_Packet_TileEntityCoverGUI(byte side, int coverID, int coverData, ICoverable tile, EntityPlayerMP aPlayer) { + public GT_Packet_TileEntityCoverGUI( + byte side, int coverID, int coverData, ICoverable tile, EntityPlayerMP aPlayer) { super(false); this.mX = tile.getXCoord(); @@ -111,8 +126,8 @@ public class GT_Packet_TileEntityCoverGUI extends GT_Packet_New { this.parentGuiId = -1; } - public GT_Packet_TileEntityCoverGUI(byte side, int coverID, ISerializableObject coverData, ICoverable tile, - EntityPlayerMP aPlayer) { + public GT_Packet_TileEntityCoverGUI( + byte side, int coverID, ISerializableObject coverData, ICoverable tile, EntityPlayerMP aPlayer) { super(false); this.mX = tile.getXCoord(); this.mY = tile.getYCoord(); @@ -155,14 +170,11 @@ public class GT_Packet_TileEntityCoverGUI extends GT_Packet_New { aData.readInt(), aData.readShort(), aData.readInt(), - aData.readByte(), coverID = aData.readInt(), GregTech_API.getCoverBehaviorNew(coverID).createDataObject().readFromPacket(aData, null), - aData.readInt(), aData.readInt(), - aData.readInt()); } @@ -170,12 +182,12 @@ public class GT_Packet_TileEntityCoverGUI extends GT_Packet_New { public void process(IBlockAccess aWorld) { if (aWorld instanceof World) { // Using EntityPlayer instead of EntityClientPlayerMP so both client and server can load this - EntityPlayer thePlayer = ((EntityPlayer) ((World)aWorld).getEntityByID(playerID)); + EntityPlayer thePlayer = ((EntityPlayer) ((World) aWorld).getEntityByID(playerID)); TileEntity tile = aWorld.getTileEntity(mX, mY, mZ); if (tile instanceof IGregTechTileEntity && !((IGregTechTileEntity) tile).isDead()) { IGregTechTileEntity gtTile = ((IGregTechTileEntity) tile); - gtTile.setCoverDataAtSide(side, coverData); //Set it client side to read later. - + gtTile.setCoverDataAtSide(side, coverData); // Set it client side to read later. + GuiScreen gui = (GuiScreen) getCoverGUI(side, thePlayer, thePlayer.worldObj, gtTile); // If it's one of this mod's covers, tell it to exit to the GUI with the specified ID (-1 is ignored) if (gui instanceof GT_GUICover) { @@ -198,7 +210,12 @@ public class GT_Packet_TileEntityCoverGUI extends GT_Packet_New { GT_CoverBehaviorBase<?> cover = aGtTile.getCoverBehaviorAtSideNew(aSide); if (cover.hasCoverGUI()) { return cover.getClientGUI( - aSide, aGtTile.getCoverIDAtSide(aSide), aGtTile.getComplexCoverDataAtSide(aSide), aGtTile, aPlayer, aWorld); + aSide, + aGtTile.getCoverIDAtSide(aSide), + aGtTile.getComplexCoverDataAtSide(aSide), + aGtTile, + aPlayer, + aWorld); } return null; } 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 f600fb1d82..2b2338d4ce 100644 --- a/src/main/java/gregtech/api/net/GT_Packet_TileEntityCoverNew.java +++ b/src/main/java/gregtech/api/net/GT_Packet_TileEntityCoverNew.java @@ -17,7 +17,6 @@ import net.minecraftforge.common.DimensionManager; /** * Client -> Server: Update cover data */ - public class GT_Packet_TileEntityCoverNew extends GT_Packet_New { protected int mX; protected short mY; @@ -33,7 +32,8 @@ public class GT_Packet_TileEntityCoverNew extends GT_Packet_New { super(true); } - public GT_Packet_TileEntityCoverNew(int mX, short mY, int mZ, byte coverSide, int coverID, ISerializableObject coverData, int dimID) { + public GT_Packet_TileEntityCoverNew( + int mX, short mY, int mZ, byte coverSide, int coverID, ISerializableObject coverData, int dimID) { super(false); this.mX = mX; this.mY = mY; @@ -45,6 +45,7 @@ public class GT_Packet_TileEntityCoverNew extends GT_Packet_New { this.dimID = dimID; } + public GT_Packet_TileEntityCoverNew(byte coverSide, int coverID, ISerializableObject coverData, ICoverable tile) { super(false); this.mX = tile.getXCoord(); @@ -90,18 +91,16 @@ public class GT_Packet_TileEntityCoverNew extends GT_Packet_New { aData.readInt(), aData.readShort(), aData.readInt(), - aData.readByte(), coverId = aData.readInt(), GregTech_API.getCoverBehaviorNew(coverId).createDataObject().readFromPacket(aData, mPlayer), - aData.readInt()); } @Override public void process(IBlockAccess aWorld) { if (mPlayer == null) // impossible, but who knows - return; + return; World world = DimensionManager.getWorld(dimID); if (world != null) { TileEntity tile = world.getTileEntity(mX, mY, mZ); diff --git a/src/main/java/gregtech/api/net/GT_Packet_UpdateItem.java b/src/main/java/gregtech/api/net/GT_Packet_UpdateItem.java index 537f62ccec..db94051946 100644 --- a/src/main/java/gregtech/api/net/GT_Packet_UpdateItem.java +++ b/src/main/java/gregtech/api/net/GT_Packet_UpdateItem.java @@ -16,46 +16,46 @@ import net.minecraft.world.IBlockAccess; * Client -> Server: send arbitrary data to server and update the currently held item. */ public class GT_Packet_UpdateItem extends GT_Packet_New { - private NBTTagCompound tag; - private EntityPlayerMP mPlayer; - - public GT_Packet_UpdateItem() { - super(true); - } - - public GT_Packet_UpdateItem(NBTTagCompound tag) { - super(false); - this.tag = tag; - } - - @Override - public byte getPacketID() { - return 13; - } - - @Override - public void setINetHandler(INetHandler aHandler) { - if (aHandler instanceof NetHandlerPlayServer) { - mPlayer = ((NetHandlerPlayServer) aHandler).playerEntity; - } - } - - @Override - public void encode(ByteBuf aOut) { - ByteBufUtils.writeTag(aOut, tag); - } - - @Override - public GT_Packet_New decode(ByteArrayDataInput aData) { - return new GT_Packet_UpdateItem(ISerializableObject.readCompoundTagFromGreggyByteBuf(aData)); - } - - @Override - public void process(IBlockAccess aWorld) { - if (mPlayer == null) return; - ItemStack stack = mPlayer.inventory.getCurrentItem(); - if (stack != null && stack.getItem() instanceof INetworkUpdatableItem) { - ((INetworkUpdatableItem) stack.getItem()).receive(stack, mPlayer, tag); - } - } + private NBTTagCompound tag; + private EntityPlayerMP mPlayer; + + public GT_Packet_UpdateItem() { + super(true); + } + + public GT_Packet_UpdateItem(NBTTagCompound tag) { + super(false); + this.tag = tag; + } + + @Override + public byte getPacketID() { + return 13; + } + + @Override + public void setINetHandler(INetHandler aHandler) { + if (aHandler instanceof NetHandlerPlayServer) { + mPlayer = ((NetHandlerPlayServer) aHandler).playerEntity; + } + } + + @Override + public void encode(ByteBuf aOut) { + ByteBufUtils.writeTag(aOut, tag); + } + + @Override + public GT_Packet_New decode(ByteArrayDataInput aData) { + return new GT_Packet_UpdateItem(ISerializableObject.readCompoundTagFromGreggyByteBuf(aData)); + } + + @Override + public void process(IBlockAccess aWorld) { + if (mPlayer == null) return; + ItemStack stack = mPlayer.inventory.getCurrentItem(); + if (stack != null && stack.getItem() instanceof INetworkUpdatableItem) { + ((INetworkUpdatableItem) stack.getItem()).receive(stack, mPlayer, tag); + } + } } 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 3ce0b48821..3d18c9d204 100644 --- a/src/main/java/gregtech/api/net/GT_Packet_WirelessRedstoneCover.java +++ b/src/main/java/gregtech/api/net/GT_Packet_WirelessRedstoneCover.java @@ -25,13 +25,15 @@ public class GT_Packet_WirelessRedstoneCover extends GT_Packet_TileEntityCover { super(); } - public GT_Packet_WirelessRedstoneCover(int mX, short mY, int mZ, byte coverSide, int coverID, int dimID, int publicChannel, int checkBoxValue) { + public GT_Packet_WirelessRedstoneCover( + int mX, short mY, int mZ, byte coverSide, int coverID, int dimID, int publicChannel, int checkBoxValue) { super(mX, mY, mZ, coverSide, coverID, 0, dimID); mPublicChannel = publicChannel; mCheckBoxValue = checkBoxValue; } - public GT_Packet_WirelessRedstoneCover(byte coverSide, int coverID, ICoverable tile, int publicChannel, int checkBoxValue) { + public GT_Packet_WirelessRedstoneCover( + byte coverSide, int coverID, ICoverable tile, int publicChannel, int checkBoxValue) { super(coverSide, coverID, 0, tile); mPublicChannel = publicChannel; mCheckBoxValue = checkBoxValue; @@ -70,12 +72,9 @@ public class GT_Packet_WirelessRedstoneCover extends GT_Packet_TileEntityCover { aData.readInt(), aData.readShort(), aData.readInt(), - aData.readByte(), aData.readInt(), - aData.readInt(), - aData.readInt(), aData.readInt()); } @@ -86,7 +85,8 @@ 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/AE2DigitalChestHandler.java b/src/main/java/gregtech/api/objects/AE2DigitalChestHandler.java index ad51d307fe..1fe4536085 100644 --- a/src/main/java/gregtech/api/objects/AE2DigitalChestHandler.java +++ b/src/main/java/gregtech/api/objects/AE2DigitalChestHandler.java @@ -6,18 +6,31 @@ import gregtech.common.tileentities.storage.GT_MetaTileEntity_DigitalChestBase; import net.minecraft.tileentity.TileEntity; import net.minecraftforge.common.util.ForgeDirection; -@Optional.Interface(iface = "appeng.api.storage.IExternalStorageHandler", modid = "appliedenergistics2", striprefs = true) +@Optional.Interface( + iface = "appeng.api.storage.IExternalStorageHandler", + modid = "appliedenergistics2", + striprefs = true) public class AE2DigitalChestHandler implements appeng.api.storage.IExternalStorageHandler { @Override @Optional.Method(modid = "appliedenergistics2") - public boolean canHandle(final TileEntity te, final ForgeDirection d, final appeng.api.storage.StorageChannel chan, final appeng.api.networking.security.BaseActionSource mySrc) { - return chan == appeng.api.storage.StorageChannel.ITEMS && te instanceof BaseMetaTileEntity && ((BaseMetaTileEntity) te).getMetaTileEntity() instanceof GT_MetaTileEntity_DigitalChestBase; + public boolean canHandle( + final TileEntity te, + final ForgeDirection d, + final appeng.api.storage.StorageChannel chan, + final appeng.api.networking.security.BaseActionSource mySrc) { + return chan == appeng.api.storage.StorageChannel.ITEMS + && te instanceof BaseMetaTileEntity + && ((BaseMetaTileEntity) te).getMetaTileEntity() instanceof GT_MetaTileEntity_DigitalChestBase; } @Override @Optional.Method(modid = "appliedenergistics2") - public appeng.api.storage.IMEInventory getInventory(final TileEntity te, final ForgeDirection d, final appeng.api.storage.StorageChannel chan, final appeng.api.networking.security.BaseActionSource src) { + public appeng.api.storage.IMEInventory getInventory( + final TileEntity te, + final ForgeDirection d, + final appeng.api.storage.StorageChannel chan, + final appeng.api.networking.security.BaseActionSource src) { if (chan == appeng.api.storage.StorageChannel.ITEMS) { return ((GT_MetaTileEntity_DigitalChestBase) (((BaseMetaTileEntity) te).getMetaTileEntity())); } diff --git a/src/main/java/gregtech/api/objects/CollectorUtils.java b/src/main/java/gregtech/api/objects/CollectorUtils.java index 3f89ad0773..41ca5e1e05 100644 --- a/src/main/java/gregtech/api/objects/CollectorUtils.java +++ b/src/main/java/gregtech/api/objects/CollectorUtils.java @@ -20,10 +20,13 @@ public class CollectorUtils { * @return a merge function which always throw {@code IllegalStateException} */ public static <T> BinaryOperator<T> throwingMerger() { - return (u,v) -> { throw new IllegalStateException(String.format("Duplicate key %s", u)); }; + return (u, v) -> { + throw new IllegalStateException(String.format("Duplicate key %s", u)); + }; } - public static <K, V, E extends Map.Entry<K, V>, M extends Map<K, V>> Collector<E, ?, M> entriesToMap(Supplier<M> mapSupplier) { + public static <K, V, E extends Map.Entry<K, V>, M extends Map<K, V>> Collector<E, ?, M> entriesToMap( + Supplier<M> mapSupplier) { return Collectors.toMap(Map.Entry::getKey, Map.Entry::getValue, CollectorUtils.throwingMerger(), mapSupplier); } } diff --git a/src/main/java/gregtech/api/objects/ElementStack.java b/src/main/java/gregtech/api/objects/ElementStack.java index d241276103..29f043188c 100644 --- a/src/main/java/gregtech/api/objects/ElementStack.java +++ b/src/main/java/gregtech/api/objects/ElementStack.java @@ -17,7 +17,11 @@ public class ElementStack implements Cloneable { @Override public ElementStack clone() { - try { return (ElementStack) super.clone(); } catch (Exception e) { return new ElementStack(mElement, mAmount); } + try { + return (ElementStack) super.clone(); + } catch (Exception e) { + return new ElementStack(mElement, mAmount); + } } @Override @@ -26,7 +30,10 @@ public class ElementStack implements Cloneable { if (aObject == null) return false; if (aObject instanceof Element) return aObject == mElement; if (aObject instanceof ElementStack) - return ((ElementStack) aObject).mElement == mElement && (mAmount < 0 || ((ElementStack) aObject).mAmount < 0 || ((ElementStack) aObject).mAmount == mAmount); + return ((ElementStack) aObject).mElement == mElement + && (mAmount < 0 + || ((ElementStack) aObject).mAmount < 0 + || ((ElementStack) aObject).mAmount == mAmount); return false; } diff --git a/src/main/java/gregtech/api/objects/GT_ArrayList.java b/src/main/java/gregtech/api/objects/GT_ArrayList.java index a9efd8d0a0..fe6bd4a214 100644 --- a/src/main/java/gregtech/api/objects/GT_ArrayList.java +++ b/src/main/java/gregtech/api/objects/GT_ArrayList.java @@ -1,7 +1,6 @@ package gregtech.api.objects; import com.google.common.collect.Collections2; - import java.util.ArrayList; import java.util.Arrays; import java.util.Collection; @@ -21,13 +20,27 @@ public class GT_ArrayList<E> extends ArrayList<E> { public GT_ArrayList(boolean aAllowNulls, E... aArray) { super(Arrays.asList(aArray)); mAllowNulls = aAllowNulls; - if (!mAllowNulls) {size_sS=size(); for (int i = 0; i < size_sS; i++) if (get(i) == null) {remove(i--);size_sS=size();}} + if (!mAllowNulls) { + size_sS = size(); + for (int i = 0; i < size_sS; i++) + if (get(i) == null) { + remove(i--); + size_sS = size(); + } + } } public GT_ArrayList(boolean aAllowNulls, Collection<? extends E> aList) { super(aList); mAllowNulls = aAllowNulls; - if (!mAllowNulls) {size_sS=size(); for (int i = 0; i < size_sS; i++) if (get(i) == null) {remove(i--);size_sS=size();}} + if (!mAllowNulls) { + size_sS = size(); + for (int i = 0; i < size_sS; i++) + if (get(i) == null) { + remove(i--); + size_sS = size(); + } + } } @Override diff --git a/src/main/java/gregtech/api/objects/GT_ChunkManager.java b/src/main/java/gregtech/api/objects/GT_ChunkManager.java index 2f1d2c3381..e06834fe1f 100644 --- a/src/main/java/gregtech/api/objects/GT_ChunkManager.java +++ b/src/main/java/gregtech/api/objects/GT_ChunkManager.java @@ -1,12 +1,16 @@ package gregtech.api.objects; +import com.google.common.collect.ArrayListMultimap; +import com.google.common.collect.ListMultimap; import gregtech.GT_Mod; import gregtech.api.enums.GT_Values; import gregtech.api.interfaces.IChunkLoader; import gregtech.api.interfaces.tileentity.IGregTechTileEntity; import gregtech.api.util.GT_Log; -import com.google.common.collect.ArrayListMultimap; -import com.google.common.collect.ListMultimap; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.tileentity.TileEntity; import net.minecraft.world.ChunkCoordIntPair; @@ -14,27 +18,24 @@ import net.minecraft.world.World; import net.minecraftforge.common.ForgeChunkManager; import net.minecraftforge.common.ForgeChunkManager.Ticket; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - - // This class handles re-initializing chunks after a server restart -public class GT_ChunkManager implements ForgeChunkManager.OrderedLoadingCallback, ForgeChunkManager.PlayerOrderedLoadingCallback { +public class GT_ChunkManager + implements ForgeChunkManager.OrderedLoadingCallback, ForgeChunkManager.PlayerOrderedLoadingCallback { private Map<TileEntity, Ticket> registeredTickets = new HashMap<>(); public static GT_ChunkManager instance = new GT_ChunkManager(); public static void init() { ForgeChunkManager.setForcedChunkLoadingCallback(GT_Mod.instance, instance); - //MinecraftForge.EVENT_BUS.register(instance); + // MinecraftForge.EVENT_BUS.register(instance); } @Override public void ticketsLoaded(List<Ticket> tickets, World world) {} - // Determine if tickets should be kept. Based on if the ticket is a machine or working chunk ticket. Working chunk tickets are tossed - // and re-created when the machine re-activates. Machine tickets are kept only if the config alwaysReloadChunkloaders is true. Otherwise + // Determine if tickets should be kept. Based on if the ticket is a machine or working chunk ticket. Working chunk + // tickets are tossed + // and re-created when the machine re-activates. Machine tickets are kept only if the config + // alwaysReloadChunkloaders is true. Otherwise // machine chunks are tossed and re-created only when the machine re-activates, similar to a Passive Anchor. @Override public List<Ticket> ticketsLoaded(List<Ticket> tickets, World world, int maxTicketCount) { @@ -46,23 +47,30 @@ public class GT_ChunkManager implements ForgeChunkManager.OrderedLoadingCallback int z = ticket.getModData().getInteger("OwnerZ"); if (y > 0) { TileEntity tile = world.getTileEntity(x, y, z); - if (tile != null && tile instanceof IGregTechTileEntity && ((IGregTechTileEntity)tile).isAllowedToWork()) { + if (tile != null + && tile instanceof IGregTechTileEntity + && ((IGregTechTileEntity) tile).isAllowedToWork()) { ForgeChunkManager.forceChunk(ticket, new ChunkCoordIntPair(x >> 4, z >> 4)); if (!registeredTickets.containsKey(tile)) { registeredTickets.put(tile, ticket); - if (((IGregTechTileEntity)tile).getMetaTileEntity() instanceof IChunkLoader) - ForgeChunkManager.forceChunk(ticket, ((IChunkLoader)((IGregTechTileEntity)tile).getMetaTileEntity()).getActiveChunk()); + if (((IGregTechTileEntity) tile).getMetaTileEntity() instanceof IChunkLoader) + ForgeChunkManager.forceChunk( + ticket, + ((IChunkLoader) ((IGregTechTileEntity) tile).getMetaTileEntity()) + .getActiveChunk()); validTickets.add(ticket); } } } } } - return validTickets ; + return validTickets; } - // Determine if player tickets should be kept. This is where a ticket list per player would be created and maintained. When - // a player join event occurs, their name/UUID/whatevs is compared against tickets on this list and those tickets reactivated. + // Determine if player tickets should be kept. This is where a ticket list per player would be created and + // maintained. When + // a player join event occurs, their name/UUID/whatevs is compared against tickets on this list and those tickets + // reactivated. // Since that info would be maintained/dealt with on a per-player startup, the list returned back to Forge is empty. @Override public ListMultimap<String, Ticket> playerTicketsLoaded(ListMultimap<String, Ticket> tickets, World world) { @@ -73,27 +81,29 @@ public class GT_ChunkManager implements ForgeChunkManager.OrderedLoadingCallback // Request a chunk to be loaded for this machine // may pass null chunk to load just the machine itself, if "alwaysReloadChunkloaders" is enabled in config 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.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 + ")"); + 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); + ticket = ForgeChunkManager.requestTicket( + GT_Mod.instance, owner.getWorldObj(), ForgeChunkManager.Type.NORMAL); else - ticket = ForgeChunkManager.requestPlayerTicket(GT_Mod.instance, player, owner.getWorldObj(), ForgeChunkManager.Type.NORMAL); + 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"); return false; } if (GT_Values.debugChunkloaders) - GT_Log.out.println("GT_ChunkManager: ticket issued for machine at: (" + owner.xCoord + ", " + owner.yCoord + ", " + owner.zCoord + ")" ); + GT_Log.out.println("GT_ChunkManager: ticket issued for machine at: (" + owner.xCoord + ", " + + owner.yCoord + ", " + owner.zCoord + ")"); NBTTagCompound tag = ticket.getModData(); tag.setInteger("OwnerX", owner.xCoord); tag.setInteger("OwnerY", owner.yCoord); @@ -111,25 +121,26 @@ public class GT_ChunkManager implements ForgeChunkManager.OrderedLoadingCallback } public static void releaseChunk(TileEntity owner, ChunkCoordIntPair chunkXZ) { - if (!GT_Values.enableChunkloaders) - return; + 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 + ")"); + GT_Log.out.println( + "GT_ChunkManager: Chunk release: (" + chunkXZ.chunkXPos + ", " + chunkXZ.chunkZPos + ")"); ForgeChunkManager.unforceChunk(ticket, chunkXZ); } } public static void releaseTicket(TileEntity owner) { - if (!GT_Values.enableChunkloaders) - return; + if (!GT_Values.enableChunkloaders) return; Ticket ticket = instance.registeredTickets.get(owner); if (ticket != null) { if (GT_Values.debugChunkloaders) { - GT_Log.out.println("GT_ChunkManager: ticket released by machine at: (" + owner.xCoord + ", " + owner.yCoord + ", " + owner.zCoord + ")" ); + GT_Log.out.println("GT_ChunkManager: ticket released by machine at: (" + owner.xCoord + ", " + + owner.yCoord + ", " + owner.zCoord + ")"); for (ChunkCoordIntPair chunk : ticket.getChunkList()) - GT_Log.out.println("GT_ChunkManager: Chunk release: (" + chunk.chunkXPos + ", " + chunk.chunkZPos + ")"); + GT_Log.out.println( + "GT_ChunkManager: Chunk release: (" + chunk.chunkXPos + ", " + chunk.chunkZPos + ")"); } ForgeChunkManager.releaseTicket(ticket); instance.registeredTickets.remove(owner); @@ -139,9 +150,9 @@ public class GT_ChunkManager implements ForgeChunkManager.OrderedLoadingCallback public static void printTickets() { GT_Log.out.println("GT_ChunkManager: Start forced chunks dump:"); instance.registeredTickets.forEach((machine, ticket) -> { - GT_Log.out.print("GT_ChunkManager: Chunks forced by the machine at (" + machine.xCoord + ", " + machine.yCoord + ", " + machine.zCoord + ")"); - if (ticket.isPlayerTicket()) - GT_Log.out.print(" Owner: " + ticket.getPlayerName()); + GT_Log.out.print("GT_ChunkManager: Chunks forced by the machine at (" + machine.xCoord + ", " + + machine.yCoord + ", " + machine.zCoord + ")"); + if (ticket.isPlayerTicket()) GT_Log.out.print(" Owner: " + ticket.getPlayerName()); GT_Log.out.print(" :"); for (ChunkCoordIntPair c : ticket.getChunkList()) { GT_Log.out.print("("); diff --git a/src/main/java/gregtech/api/objects/GT_CopiedBlockTexture.java b/src/main/java/gregtech/api/objects/GT_CopiedBlockTexture.java index 317cc04066..cfecc9d736 100644 --- a/src/main/java/gregtech/api/objects/GT_CopiedBlockTexture.java +++ b/src/main/java/gregtech/api/objects/GT_CopiedBlockTexture.java @@ -4,14 +4,14 @@ import gregtech.api.enums.Dyes; import gregtech.api.interfaces.ITexture; import net.minecraft.block.Block; - /** * @deprecated Replaced by the {@link gregtech.api.render.TextureFactory} API. */ @Deprecated public class GT_CopiedBlockTexture extends gregtech.common.render.GT_CopiedBlockTexture implements ITexture { // Backwards Compat - @Deprecated public short[] mRGBa; + @Deprecated + public short[] mRGBa; public GT_CopiedBlockTexture(Block aBlock, int aSide, int aMeta, short[] aRGBa, boolean aAllowAlpha) { super(aBlock, aSide, aMeta, aRGBa, aAllowAlpha); diff --git a/src/main/java/gregtech/api/objects/GT_Cover_Default.java b/src/main/java/gregtech/api/objects/GT_Cover_Default.java index 79db764449..a975de9759 100644 --- a/src/main/java/gregtech/api/objects/GT_Cover_Default.java +++ b/src/main/java/gregtech/api/objects/GT_Cover_Default.java @@ -20,9 +20,22 @@ public class GT_Cover_Default extends GT_CoverBehavior { } @Override - public int onCoverScrewdriverclick(byte aSide, int aCoverID, int aCoverVariable, ICoverable aTileEntity, EntityPlayer aPlayer, float aX, float aY, float aZ) { + public int onCoverScrewdriverclick( + byte aSide, + int aCoverID, + int aCoverVariable, + ICoverable aTileEntity, + EntityPlayer aPlayer, + float aX, + float aY, + float aZ) { aCoverVariable = ((aCoverVariable + 1) & 15); - GT_Utility.sendChatToPlayer(aPlayer, ((aCoverVariable & 1) != 0 ? GT_Utility.trans("128", "Redstone ") : "") + ((aCoverVariable & 2) != 0 ? GT_Utility.trans("129", "Energy ") : "") + ((aCoverVariable & 4) != 0 ? GT_Utility.trans("130", "Fluids ") : "") + ((aCoverVariable & 8) != 0 ? GT_Utility.trans("131", "Items ") : "")); + GT_Utility.sendChatToPlayer( + aPlayer, + ((aCoverVariable & 1) != 0 ? GT_Utility.trans("128", "Redstone ") : "") + + ((aCoverVariable & 2) != 0 ? GT_Utility.trans("129", "Energy ") : "") + + ((aCoverVariable & 4) != 0 ? GT_Utility.trans("130", "Fluids ") : "") + + ((aCoverVariable & 8) != 0 ? GT_Utility.trans("131", "Items ") : "")); return aCoverVariable; } diff --git a/src/main/java/gregtech/api/objects/GT_Cover_None.java b/src/main/java/gregtech/api/objects/GT_Cover_None.java index 073b51511d..dac48449d1 100644 --- a/src/main/java/gregtech/api/objects/GT_Cover_None.java +++ b/src/main/java/gregtech/api/objects/GT_Cover_None.java @@ -1,5 +1,7 @@ package gregtech.api.objects; +import static gregtech.api.enums.GT_Values.E; + import gregtech.api.interfaces.tileentity.ICoverable; import gregtech.api.util.GT_CoverBehavior; import gregtech.api.util.ISerializableObject; @@ -8,15 +10,12 @@ import net.minecraft.item.ItemStack; import net.minecraft.world.World; import net.minecraftforge.fluids.Fluid; -import static gregtech.api.enums.GT_Values.E; - public class GT_Cover_None extends GT_CoverBehavior { /** * This is the Dummy, if there is no Cover */ - public GT_Cover_None() { - } + public GT_Cover_None() {} @Override public float getBlastProofLevel(byte aSide, int aCoverID, int aCoverVariable, ICoverable aTileEntity) { @@ -69,22 +68,33 @@ public class GT_Cover_None extends GT_CoverBehavior { } @Override - public boolean manipulatesSidedRedstoneOutput(byte aSide, int aCoverID, int aCoverVariable, ICoverable aTileEntity) { + public boolean manipulatesSidedRedstoneOutput( + byte aSide, int aCoverID, int aCoverVariable, ICoverable aTileEntity) { return false; } @Override - public boolean onCoverRightclick(byte aSide, int aCoverID, int aCoverVariable, ICoverable aTileEntity, EntityPlayer aPlayer, float aX, float aY, float aZ) { + public boolean onCoverRightclick( + byte aSide, + int aCoverID, + int aCoverVariable, + ICoverable aTileEntity, + EntityPlayer aPlayer, + float aX, + float aY, + float aZ) { return false; } @Override - public boolean onCoverRemoval(byte aSide, int aCoverID, int aCoverVariable, ICoverable aTileEntity, boolean aForced) { + public boolean onCoverRemoval( + byte aSide, int aCoverID, int aCoverVariable, ICoverable aTileEntity, boolean aForced) { return true; } @Override - public int doCoverThings(byte aSide, byte aInputRedstone, int aCoverID, int aCoverVariable, ICoverable aTileEntity, long aTimer) { + public int doCoverThings( + byte aSide, byte aInputRedstone, int aCoverID, int aCoverVariable, ICoverable aTileEntity, long aTimer) { return 0; } @@ -94,132 +104,214 @@ public class GT_Cover_None extends GT_CoverBehavior { } @Override - protected boolean isRedstoneSensitiveImpl(byte aSide, int aCoverID, ISerializableObject.LegacyCoverData aCoverVariable, ICoverable aTileEntity, long aTimer) { + protected boolean isRedstoneSensitiveImpl( + byte aSide, + int aCoverID, + ISerializableObject.LegacyCoverData aCoverVariable, + ICoverable aTileEntity, + long aTimer) { return false; } @Override - protected ISerializableObject.LegacyCoverData doCoverThingsImpl(byte aSide, byte aInputRedstone, int aCoverID, ISerializableObject.LegacyCoverData aCoverVariable, ICoverable aTileEntity, long aTimer) { + protected ISerializableObject.LegacyCoverData doCoverThingsImpl( + byte aSide, + byte aInputRedstone, + int aCoverID, + ISerializableObject.LegacyCoverData aCoverVariable, + ICoverable aTileEntity, + long aTimer) { return aCoverVariable; } @Override - protected boolean onCoverRightClickImpl(byte aSide, int aCoverID, ISerializableObject.LegacyCoverData aCoverVariable, ICoverable aTileEntity, EntityPlayer aPlayer, float aX, float aY, float aZ) { + protected boolean onCoverRightClickImpl( + byte aSide, + int aCoverID, + ISerializableObject.LegacyCoverData aCoverVariable, + ICoverable aTileEntity, + EntityPlayer aPlayer, + float aX, + float aY, + float aZ) { return false; } @Override - protected ISerializableObject.LegacyCoverData onCoverScrewdriverClickImpl(byte aSide, int aCoverID, ISerializableObject.LegacyCoverData aCoverVariable, ICoverable aTileEntity, EntityPlayer aPlayer, float aX, float aY, float aZ) { + protected ISerializableObject.LegacyCoverData onCoverScrewdriverClickImpl( + byte aSide, + int aCoverID, + ISerializableObject.LegacyCoverData aCoverVariable, + ICoverable aTileEntity, + EntityPlayer aPlayer, + float aX, + float aY, + float aZ) { return aCoverVariable; } @Override - protected boolean onCoverShiftRightClickImpl(byte aSide, int aCoverID, ISerializableObject.LegacyCoverData aCoverVariable, ICoverable aTileEntity, EntityPlayer aPlayer) { + protected boolean onCoverShiftRightClickImpl( + byte aSide, + int aCoverID, + ISerializableObject.LegacyCoverData aCoverVariable, + ICoverable aTileEntity, + EntityPlayer aPlayer) { return false; } @Override - protected Object getClientGUIImpl(byte aSide, int aCoverID, ISerializableObject.LegacyCoverData aCoverVariable, ICoverable aTileEntity, EntityPlayer aPlayer, World aWorld) { + protected Object getClientGUIImpl( + byte aSide, + int aCoverID, + ISerializableObject.LegacyCoverData aCoverVariable, + ICoverable aTileEntity, + EntityPlayer aPlayer, + World aWorld) { return null; } @Override - protected boolean onCoverRemovalImpl(byte aSide, int aCoverID, ISerializableObject.LegacyCoverData aCoverVariable, ICoverable aTileEntity, boolean aForced) { + protected boolean onCoverRemovalImpl( + byte aSide, + int aCoverID, + ISerializableObject.LegacyCoverData aCoverVariable, + ICoverable aTileEntity, + boolean aForced) { return true; } @Override - protected String getDescriptionImpl(byte aSide, int aCoverID, ISerializableObject.LegacyCoverData aCoverVariable, ICoverable aTileEntity) { + protected String getDescriptionImpl( + byte aSide, int aCoverID, ISerializableObject.LegacyCoverData aCoverVariable, ICoverable aTileEntity) { return E; } @Override - protected float getBlastProofLevelImpl(byte aSide, int aCoverID, ISerializableObject.LegacyCoverData aCoverVariable, ICoverable aTileEntity) { + protected float getBlastProofLevelImpl( + byte aSide, int aCoverID, ISerializableObject.LegacyCoverData aCoverVariable, ICoverable aTileEntity) { return 10.0F; } @Override - protected boolean letsRedstoneGoInImpl(byte aSide, int aCoverID, ISerializableObject.LegacyCoverData aCoverVariable, ICoverable aTileEntity) { + protected boolean letsRedstoneGoInImpl( + byte aSide, int aCoverID, ISerializableObject.LegacyCoverData aCoverVariable, ICoverable aTileEntity) { return true; } @Override - protected boolean letsRedstoneGoOutImpl(byte aSide, int aCoverID, ISerializableObject.LegacyCoverData aCoverVariable, ICoverable aTileEntity) { + protected boolean letsRedstoneGoOutImpl( + byte aSide, int aCoverID, ISerializableObject.LegacyCoverData aCoverVariable, ICoverable aTileEntity) { return true; } @Override - protected boolean letsFibreGoInImpl(byte aSide, int aCoverID, ISerializableObject.LegacyCoverData aCoverVariable, ICoverable aTileEntity) { + protected boolean letsFibreGoInImpl( + byte aSide, int aCoverID, ISerializableObject.LegacyCoverData aCoverVariable, ICoverable aTileEntity) { return true; } @Override - protected boolean letsFibreGoOutImpl(byte aSide, int aCoverID, ISerializableObject.LegacyCoverData aCoverVariable, ICoverable aTileEntity) { + protected boolean letsFibreGoOutImpl( + byte aSide, int aCoverID, ISerializableObject.LegacyCoverData aCoverVariable, ICoverable aTileEntity) { return true; } @Override - protected boolean letsEnergyInImpl(byte aSide, int aCoverID, ISerializableObject.LegacyCoverData aCoverVariable, ICoverable aTileEntity) { + protected boolean letsEnergyInImpl( + byte aSide, int aCoverID, ISerializableObject.LegacyCoverData aCoverVariable, ICoverable aTileEntity) { return true; } @Override - protected boolean letsEnergyOutImpl(byte aSide, int aCoverID, ISerializableObject.LegacyCoverData aCoverVariable, ICoverable aTileEntity) { + protected boolean letsEnergyOutImpl( + byte aSide, int aCoverID, ISerializableObject.LegacyCoverData aCoverVariable, ICoverable aTileEntity) { return true; } @Override - protected boolean letsFluidInImpl(byte aSide, int aCoverID, ISerializableObject.LegacyCoverData aCoverVariable, Fluid aFluid, ICoverable aTileEntity) { + protected boolean letsFluidInImpl( + byte aSide, + int aCoverID, + ISerializableObject.LegacyCoverData aCoverVariable, + Fluid aFluid, + ICoverable aTileEntity) { return true; } @Override - protected boolean letsFluidOutImpl(byte aSide, int aCoverID, ISerializableObject.LegacyCoverData aCoverVariable, Fluid aFluid, ICoverable aTileEntity) { + protected boolean letsFluidOutImpl( + byte aSide, + int aCoverID, + ISerializableObject.LegacyCoverData aCoverVariable, + Fluid aFluid, + ICoverable aTileEntity) { return true; } @Override - protected boolean letsItemsInImpl(byte aSide, int aCoverID, ISerializableObject.LegacyCoverData aCoverVariable, int aSlot, ICoverable aTileEntity) { + protected boolean letsItemsInImpl( + byte aSide, + int aCoverID, + ISerializableObject.LegacyCoverData aCoverVariable, + int aSlot, + ICoverable aTileEntity) { return true; } @Override - protected boolean letsItemsOutImpl(byte aSide, int aCoverID, ISerializableObject.LegacyCoverData aCoverVariable, int aSlot, ICoverable aTileEntity) { + protected boolean letsItemsOutImpl( + byte aSide, + int aCoverID, + ISerializableObject.LegacyCoverData aCoverVariable, + int aSlot, + ICoverable aTileEntity) { return true; } @Override - protected boolean isGUIClickableImpl(byte aSide, int aCoverID, ISerializableObject.LegacyCoverData aCoverVariable, ICoverable aTileEntity) { + protected boolean isGUIClickableImpl( + byte aSide, int aCoverID, ISerializableObject.LegacyCoverData aCoverVariable, ICoverable aTileEntity) { return true; } @Override - protected boolean manipulatesSidedRedstoneOutputImpl(byte aSide, int aCoverID, ISerializableObject.LegacyCoverData aCoverVariable, ICoverable aTileEntity) { + protected boolean manipulatesSidedRedstoneOutputImpl( + byte aSide, int aCoverID, ISerializableObject.LegacyCoverData aCoverVariable, ICoverable aTileEntity) { return false; } @Override - protected boolean alwaysLookConnectedImpl(byte aSide, int aCoverID, ISerializableObject.LegacyCoverData aCoverVariable, ICoverable aTileEntity) { + protected boolean alwaysLookConnectedImpl( + byte aSide, int aCoverID, ISerializableObject.LegacyCoverData aCoverVariable, ICoverable aTileEntity) { return false; } @Override - protected byte getRedstoneInputImpl(byte aSide, byte aInputRedstone, int aCoverID, ISerializableObject.LegacyCoverData aCoverVariable, ICoverable aTileEntity) { + protected byte getRedstoneInputImpl( + byte aSide, + byte aInputRedstone, + int aCoverID, + ISerializableObject.LegacyCoverData aCoverVariable, + ICoverable aTileEntity) { return aInputRedstone; } @Override - protected int getTickRateImpl(byte aSide, int aCoverID, ISerializableObject.LegacyCoverData aCoverVariable, ICoverable aTileEntity) { + protected int getTickRateImpl( + byte aSide, int aCoverID, ISerializableObject.LegacyCoverData aCoverVariable, ICoverable aTileEntity) { return 0; } @Override - protected byte getLensColorImpl(byte aSide, int aCoverID, ISerializableObject.LegacyCoverData aCoverVariable, ICoverable aTileEntity) { + protected byte getLensColorImpl( + byte aSide, int aCoverID, ISerializableObject.LegacyCoverData aCoverVariable, ICoverable aTileEntity) { return -1; } @Override - protected ItemStack getDropImpl(byte aSide, int aCoverID, ISerializableObject.LegacyCoverData aCoverVariable, ICoverable aTileEntity) { + protected ItemStack getDropImpl( + byte aSide, int aCoverID, ISerializableObject.LegacyCoverData aCoverVariable, ICoverable aTileEntity) { return null; } } diff --git a/src/main/java/gregtech/api/objects/GT_Fluid.java b/src/main/java/gregtech/api/objects/GT_Fluid.java index 4f5c2a3ca2..52b58d38cc 100644 --- a/src/main/java/gregtech/api/objects/GT_Fluid.java +++ b/src/main/java/gregtech/api/objects/GT_Fluid.java @@ -1,10 +1,10 @@ package gregtech.api.objects; +import static gregtech.api.enums.GT_Values.RES_PATH_BLOCK; + import gregtech.api.GregTech_API; import net.minecraftforge.fluids.Fluid; -import static gregtech.api.enums.GT_Values.RES_PATH_BLOCK; - public class GT_Fluid extends Fluid implements Runnable { public final String mTextureName; private final short[] mRGBa; @@ -18,7 +18,9 @@ public class GT_Fluid extends Fluid implements Runnable { @Override public int getColor() { - return (Math.max(0, Math.min(255, mRGBa[0])) << 16) | (Math.max(0, Math.min(255, mRGBa[1])) << 8) | Math.max(0, Math.min(255, mRGBa[2])); + return (Math.max(0, Math.min(255, mRGBa[0])) << 16) + | (Math.max(0, Math.min(255, mRGBa[1])) << 8) + | Math.max(0, Math.min(255, mRGBa[2])); } @Override diff --git a/src/main/java/gregtech/api/objects/GT_FluidStack.java b/src/main/java/gregtech/api/objects/GT_FluidStack.java index 8771b504cf..8f796430e5 100644 --- a/src/main/java/gregtech/api/objects/GT_FluidStack.java +++ b/src/main/java/gregtech/api/objects/GT_FluidStack.java @@ -3,27 +3,29 @@ package gregtech.api.objects; import gregtech.api.GregTech_API; import gregtech.api.util.GT_Log; import gregtech.api.util.GT_Utility; -import net.minecraftforge.common.ForgeVersion; -import net.minecraftforge.fluids.Fluid; -import net.minecraftforge.fluids.FluidStack; - import java.util.Collection; import java.util.Collections; import java.util.Map; import java.util.WeakHashMap; +import net.minecraftforge.common.ForgeVersion; +import net.minecraftforge.fluids.Fluid; +import net.minecraftforge.fluids.FluidStack; /** * Because Forge fucked this one up royally. */ 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; public GT_FluidStack(Fluid aFluid, int aAmount) { super(aFluid, aAmount); mFluid = aFluid; - if(!GregTech_API.mServerStarted){sAllFluidStacks.add(this);} + if (!GregTech_API.mServerStarted) { + sAllFluidStacks.add(this); + } } public GT_FluidStack(FluidStack aFluid) { @@ -35,13 +37,16 @@ public class GT_FluidStack extends FluidStack { try { while (lock) { Thread.sleep(1); - }} catch (InterruptedException e) {} + } + } catch (InterruptedException e) { + } lock = true; for (GT_FluidStack tFluid : sAllFluidStacks) tFluid.fixFluidIDForFucksSake(); try { - for (Map<Fluid, ?> tMap : GregTech_API.sFluidMappings) - GT_Utility.reMap(tMap); - } catch (Throwable e) {e.printStackTrace(GT_Log.err);} + for (Map<Fluid, ?> tMap : GregTech_API.sFluidMappings) GT_Utility.reMap(tMap); + } catch (Throwable e) { + e.printStackTrace(GT_Log.err); + } lock = false; } } @@ -72,6 +77,7 @@ 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 c0a8e3994d..01c4b00995 100644 --- a/src/main/java/gregtech/api/objects/GT_HashSet.java +++ b/src/main/java/gregtech/api/objects/GT_HashSet.java @@ -2,9 +2,8 @@ package gregtech.api.objects; import gregtech.api.GregTech_API; import gregtech.api.util.GT_Utility; -import net.minecraft.item.ItemStack; - import java.util.*; +import net.minecraft.item.ItemStack; public class GT_HashSet<E extends GT_ItemStack> extends AbstractSet<E> { private static final Object OBJECT = new Object(); diff --git a/src/main/java/gregtech/api/objects/GT_ItemStack.java b/src/main/java/gregtech/api/objects/GT_ItemStack.java index 3e25454fa1..a6c892c4f9 100644 --- a/src/main/java/gregtech/api/objects/GT_ItemStack.java +++ b/src/main/java/gregtech/api/objects/GT_ItemStack.java @@ -22,7 +22,10 @@ public class GT_ItemStack { } public GT_ItemStack(ItemStack aStack, boolean wildcard) { - this(aStack == null ? null : aStack.getItem(), aStack == null ? 0 : aStack.stackSize, aStack == null ? 0 : wildcard ? GT_Values.W : Items.feather.getDamage(aStack)); + this( + aStack == null ? null : aStack.getItem(), + aStack == null ? 0 : aStack.stackSize, + aStack == null ? 0 : wildcard ? GT_Values.W : Items.feather.getDamage(aStack)); } public GT_ItemStack(int aHashCode) { diff --git a/src/main/java/gregtech/api/objects/GT_MultiTexture.java b/src/main/java/gregtech/api/objects/GT_MultiTexture.java index 51ab7615b4..82df899135 100644 --- a/src/main/java/gregtech/api/objects/GT_MultiTexture.java +++ b/src/main/java/gregtech/api/objects/GT_MultiTexture.java @@ -5,7 +5,7 @@ import gregtech.api.interfaces.ITexture; /** * <p>Lets Multiple ITextures Render overlay over each other.<</p> * <p>I should have done this much earlier...</p> - * @deprecated Replaced by the {@link gregtech.api.render.TextureFactory} API. + * @deprecated Replaced by the {@link gregtech.api.render.TextureFactory} API. */ @Deprecated public class GT_MultiTexture extends gregtech.common.render.GT_MultiTexture implements ITexture { diff --git a/src/main/java/gregtech/api/objects/GT_RenderedTexture.java b/src/main/java/gregtech/api/objects/GT_RenderedTexture.java index 1f123274f4..4c17afde17 100644 --- a/src/main/java/gregtech/api/objects/GT_RenderedTexture.java +++ b/src/main/java/gregtech/api/objects/GT_RenderedTexture.java @@ -6,8 +6,10 @@ import gregtech.api.interfaces.IIconContainer; import gregtech.api.interfaces.ITexture; @Deprecated -public class GT_RenderedTexture extends gregtech.common.render.GT_RenderedTexture implements ITexture, IColorModulationContainer { - @Deprecated public short[] mRGBa; +public class GT_RenderedTexture extends gregtech.common.render.GT_RenderedTexture + implements ITexture, IColorModulationContainer { + @Deprecated + public short[] mRGBa; public GT_RenderedTexture(IIconContainer aIcon, short[] aRGBa, boolean aAllowAlpha) { super(aIcon, aRGBa, aAllowAlpha, false, true, false); diff --git a/src/main/java/gregtech/api/objects/GT_SidedTexture.java b/src/main/java/gregtech/api/objects/GT_SidedTexture.java index 3c699a3f4b..25b941e968 100644 --- a/src/main/java/gregtech/api/objects/GT_SidedTexture.java +++ b/src/main/java/gregtech/api/objects/GT_SidedTexture.java @@ -9,21 +9,44 @@ import gregtech.api.interfaces.ITexture; * @deprecated Replaced by the {@link gregtech.api.render.TextureFactory} API. */ @Deprecated -public class GT_SidedTexture extends gregtech.common.render.GT_SidedTexture implements ITexture, IColorModulationContainer { - @Deprecated public short[] mRGBa; +public class GT_SidedTexture extends gregtech.common.render.GT_SidedTexture + implements ITexture, IColorModulationContainer { + @Deprecated + public short[] mRGBa; - public GT_SidedTexture(IIconContainer aIcon0, IIconContainer aIcon1, IIconContainer aIcon2, IIconContainer aIcon3, IIconContainer aIcon4, IIconContainer aIcon5, short[] aRGBa, boolean aAllowAlpha) { + public GT_SidedTexture( + IIconContainer aIcon0, + IIconContainer aIcon1, + IIconContainer aIcon2, + IIconContainer aIcon3, + IIconContainer aIcon4, + IIconContainer aIcon5, + short[] aRGBa, + boolean aAllowAlpha) { super(aIcon0, aIcon1, aIcon2, aIcon3, aIcon4, aIcon5, aRGBa, aAllowAlpha); // Backwards Compat GT_SidedTexture.this.mRGBa = aRGBa; } - public GT_SidedTexture(IIconContainer aIcon0, IIconContainer aIcon1, IIconContainer aIcon2, IIconContainer aIcon3, IIconContainer aIcon4, IIconContainer aIcon5, short[] aRGBa) { + public GT_SidedTexture( + IIconContainer aIcon0, + IIconContainer aIcon1, + IIconContainer aIcon2, + IIconContainer aIcon3, + IIconContainer aIcon4, + IIconContainer aIcon5, + short[] aRGBa) { this(aIcon0, aIcon1, aIcon2, aIcon3, aIcon4, aIcon5, aRGBa, true); } - public GT_SidedTexture(IIconContainer aIcon0, IIconContainer aIcon1, IIconContainer aIcon2, IIconContainer aIcon3, IIconContainer aIcon4, IIconContainer aIcon5) { + public GT_SidedTexture( + IIconContainer aIcon0, + IIconContainer aIcon1, + IIconContainer aIcon2, + IIconContainer aIcon3, + IIconContainer aIcon4, + IIconContainer aIcon5) { this(aIcon0, aIcon1, aIcon2, aIcon3, aIcon4, aIcon5, Dyes._NULL.mRGBa); } diff --git a/src/main/java/gregtech/api/objects/GT_StdRenderedTexture.java b/src/main/java/gregtech/api/objects/GT_StdRenderedTexture.java index 0dd405c792..3966b060a3 100644 --- a/src/main/java/gregtech/api/objects/GT_StdRenderedTexture.java +++ b/src/main/java/gregtech/api/objects/GT_StdRenderedTexture.java @@ -15,7 +15,7 @@ import net.minecraftforge.common.util.ForgeDirection; * @deprecated Replaced by the {@link gregtech.api.render.TextureFactory} API. */ @Deprecated -public class GT_StdRenderedTexture extends GT_RenderedTexture{ +public class GT_StdRenderedTexture extends GT_RenderedTexture { @SuppressWarnings("unused") public GT_StdRenderedTexture(IIconContainer aIcon, short[] aRGBa, boolean aAllowAlpha) { @@ -34,8 +34,7 @@ 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 0d05e6d229..f449478860 100644 --- a/src/main/java/gregtech/api/objects/GT_UO_Dimension.java +++ b/src/main/java/gregtech/api/objects/GT_UO_Dimension.java @@ -2,48 +2,47 @@ package gregtech.api.objects; import com.google.common.collect.BiMap; import com.google.common.collect.HashBiMap; -import net.minecraftforge.common.config.ConfigCategory; - import java.util.Random; +import net.minecraftforge.common.config.ConfigCategory; public class GT_UO_Dimension { - private BiMap<String, GT_UO_Fluid> fFluids; - private int maxChance; - public String Dimension = "null"; + private BiMap<String, GT_UO_Fluid> fFluids; + private int maxChance; + public String Dimension = "null"; + + public GT_UO_Dimension(ConfigCategory aConfigCategory) { // TODO CONFIGURE + fFluids = HashBiMap.create(); + if (aConfigCategory.containsKey("Dimension")) { + aConfigCategory.get("Dimension").comment = "Dimension ID or Class Name"; + 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]); + fFluids.put(fluid.Registry, fluid); + maxChance += fluid.Chance; + } + } - public GT_UO_Dimension(ConfigCategory aConfigCategory) {//TODO CONFIGURE - fFluids = HashBiMap.create(); - if (aConfigCategory.containsKey("Dimension")) - { - aConfigCategory.get("Dimension").comment = "Dimension ID or Class Name"; - 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]); - fFluids.put(fluid.Registry, fluid); - maxChance += fluid.Chance; - } - } - - public GT_UO_Fluid getRandomFluid (Random aRandom) { - int random = aRandom.nextInt(1000); - for (BiMap.Entry<String, GT_UO_Fluid> fl : fFluids.entrySet()) { - int chance = fl.getValue().Chance*1000/maxChance; - if (random<=chance) return fl.getValue(); - //GT_FML_LOGGER.info("GT UO "+fl.getValue().Registry+" Chance:"+chance+" Random:"+random); - random-=chance; - } - return null; - } + public GT_UO_Fluid getRandomFluid(Random aRandom) { + int random = aRandom.nextInt(1000); + for (BiMap.Entry<String, GT_UO_Fluid> fl : fFluids.entrySet()) { + int chance = fl.getValue().Chance * 1000 / maxChance; + if (random <= chance) return fl.getValue(); + // GT_FML_LOGGER.info("GT UO "+fl.getValue().Registry+" Chance:"+chance+" Random:"+random); + random -= chance; + } + return null; + } - public String getUOFluidKey(GT_UO_Fluid uoFluid) { - return fFluids.inverse().get(uoFluid); - } + public String getUOFluidKey(GT_UO_Fluid uoFluid) { + return fFluids.inverse().get(uoFluid); + } - public GT_UO_Fluid getUOFluid(String key) { - return fFluids.get(key); - } + public GT_UO_Fluid getUOFluid(String key) { + return fFluids.get(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 a2cd2354d8..44b56938b4 100644 --- a/src/main/java/gregtech/api/objects/GT_UO_DimensionList.java +++ b/src/main/java/gregtech/api/objects/GT_UO_DimensionList.java @@ -8,74 +8,85 @@ import net.minecraftforge.common.config.Configuration; public class GT_UO_DimensionList { - private Configuration fConfig; - private String fCategory; - private BiMap<String, GT_UO_Dimension> fDimensionList; + private Configuration fConfig; + private String fCategory; + private BiMap<String, GT_UO_Dimension> fDimensionList; - public int[] blackList =new int[0]; - - public GT_UO_DimensionList() { - fDimensionList = HashBiMap.create(); - } + public int[] blackList = new int[0]; - public GT_UO_Dimension GetDimension(int aDimension) { - if(CheckBlackList(aDimension)) return null; - 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)) - return dl.getValue(); - return fDimensionList.get("Default"); - } + public GT_UO_DimensionList() { + fDimensionList = HashBiMap.create(); + } - private boolean CheckBlackList(int aDimensionId){ - try { - return java.util.Arrays.binarySearch(blackList, aDimensionId) >= 0; - } catch (Exception e) { - e.printStackTrace(); - return false; - } - } - - 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(); - 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, "DecreasePerOperationAmount", aDecreasePerOperationAmount).getInt(aDecreasePerOperationAmount); - //IT IS IN BUCKETS!!! - } - - public void SetDafultValues() { - SetConfigValues("Overworld", "0", "gas_natural_gas", "gas_natural_gas", 0, 700, 20, 7); - SetConfigValues("Overworld", "0", "liquid_light_oil", "liquid_light_oil", 0, 650, 20, 6); - SetConfigValues("Overworld", "0", "liquid_medium_oil", "liquid_medium_oil", 0, 600, 20, 5); - SetConfigValues("Overworld", "0", "liquid_heavy_oil", "liquid_heavy_oil", 0, 550, 20, 4); - SetConfigValues("Overworld", "0", "oil", "oil", 0, 600, 20, 5); - SetConfigValues("Moon", "Moon", "helium-3", "helium-3", 24, 128, 100, 1); - } - - public void getConfig(Configuration aConfig, String aCategory) { - fCategory=aCategory; - fConfig = aConfig; - if (!fConfig.hasCategory(fCategory)) - SetDafultValues(); + public GT_UO_Dimension GetDimension(int aDimension) { + if (CheckBlackList(aDimension)) return null; + 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)) + return dl.getValue(); + return fDimensionList.get("Default"); + } - fConfig.setCategoryComment(fCategory, "Config Underground Fluids (Delete this Category for regenerate)"); - fConfig.setCategoryComment(fCategory+".Default", "Set Default Generating (Use this Category for Default settings)"); - fConfig.setCategoryComment(fCategory+".Overworld", "Set Overworld Generating"); - fConfig.setCategoryComment(fCategory+".Moon", "Set Moon Generating"); - - blackList = new int[]{-1,1}; - 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++) { - GT_UO_Dimension Dimension = new GT_UO_Dimension((ConfigCategory)fConfig.getCategory(fCategory).getChildren().toArray()[i]); - fDimensionList.put(Dimension.Dimension, Dimension); - } - } + private boolean CheckBlackList(int aDimensionId) { + try { + return java.util.Arrays.binarySearch(blackList, aDimensionId) >= 0; + } catch (Exception e) { + e.printStackTrace(); + return false; + } + } + + 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(); + 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, "DecreasePerOperationAmount", aDecreasePerOperationAmount) + .getInt(aDecreasePerOperationAmount); + // IT IS IN BUCKETS!!! + } + + public void SetDafultValues() { + SetConfigValues("Overworld", "0", "gas_natural_gas", "gas_natural_gas", 0, 700, 20, 7); + SetConfigValues("Overworld", "0", "liquid_light_oil", "liquid_light_oil", 0, 650, 20, 6); + SetConfigValues("Overworld", "0", "liquid_medium_oil", "liquid_medium_oil", 0, 600, 20, 5); + SetConfigValues("Overworld", "0", "liquid_heavy_oil", "liquid_heavy_oil", 0, 550, 20, 4); + SetConfigValues("Overworld", "0", "oil", "oil", 0, 600, 20, 5); + SetConfigValues("Moon", "Moon", "helium-3", "helium-3", 24, 128, 100, 1); + } + + public void getConfig(Configuration aConfig, String aCategory) { + fCategory = aCategory; + fConfig = aConfig; + if (!fConfig.hasCategory(fCategory)) SetDafultValues(); + + fConfig.setCategoryComment(fCategory, "Config Underground Fluids (Delete this Category for regenerate)"); + fConfig.setCategoryComment( + fCategory + ".Default", "Set Default Generating (Use this Category for Default settings)"); + fConfig.setCategoryComment(fCategory + ".Overworld", "Set Overworld Generating"); + fConfig.setCategoryComment(fCategory + ".Moon", "Set Moon Generating"); + + blackList = new int[] {-1, 1}; + 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++) { + GT_UO_Dimension Dimension = new GT_UO_Dimension((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 d06772dc1e..36f98d6cae 100644 --- a/src/main/java/gregtech/api/objects/GT_UO_Fluid.java +++ b/src/main/java/gregtech/api/objects/GT_UO_Fluid.java @@ -1,61 +1,61 @@ package gregtech.api.objects; +import static gregtech.common.GT_UndergroundOil.DIVIDER; + +import java.util.Random; import net.minecraftforge.common.config.ConfigCategory; import net.minecraftforge.fluids.Fluid; import net.minecraftforge.fluids.FluidRegistry; -import java.util.Random; +public class GT_UO_Fluid { + public String Registry = "null"; + public int MaxAmount = 0; + public int MinAmount = 0; + public int Chance = 0; + public int DecreasePerOperationAmount = 5; -import static gregtech.common.GT_UndergroundOil.DIVIDER; + public GT_UO_Fluid(ConfigCategory aConfigCategory) { // TODO CONFIGURE + if (aConfigCategory.containsKey("Registry")) { + aConfigCategory.get("Registry").comment = "Fluid registry name"; + 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); + } + if (aConfigCategory.containsKey("MinAmount")) { + aConfigCategory.get("MinAmount").comment = "Min amount generation (per operation, sets the VeinData) 0 MIN"; + 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); + } + 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); + } + // GT_FML_LOGGER.info("GT UO "+aConfigCategory.getName()+" Fluid:"+Registry+" Max:"+MaxAmount+" + // Min:"+MinAmount+" Chance:"+Chance); + } -public class GT_UO_Fluid { - public String Registry = "null"; - public int MaxAmount = 0; - public int MinAmount = 0; - public int Chance = 0; - public int DecreasePerOperationAmount = 5; + public Fluid getFluid() { + try { + return FluidRegistry.getFluid(this.Registry); + } catch (Exception e) { + return null; + } + } - public GT_UO_Fluid(ConfigCategory aConfigCategory) {//TODO CONFIGURE - if (aConfigCategory.containsKey("Registry")) - { - aConfigCategory.get("Registry").comment = "Fluid registry name"; - 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); - } - if (aConfigCategory.containsKey("MinAmount")) - { - aConfigCategory.get("MinAmount").comment = "Min amount generation (per operation, sets the VeinData) 0 MIN"; - 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); - } - 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); - } - //GT_FML_LOGGER.info("GT UO "+aConfigCategory.getName()+" Fluid:"+Registry+" Max:"+MaxAmount+" Min:"+MinAmount+" Chance:"+Chance); - } - - public Fluid getFluid(){ - try { - return FluidRegistry.getFluid(this.Registry); - } catch (Exception e) { - return null; - } - } - - public int getRandomAmount(Random aRandom){//generates some random ass number that correlates to extraction speeds - int div = (int)Math.floor(Math.pow((MaxAmount-MinAmount)*100.d*DIVIDER, 0.2d)); - int min = (int)Math.floor(Math.pow(MinAmount*100.d*DIVIDER, 0.2d)); - double amount = min+aRandom.nextInt(div)+aRandom.nextDouble(); - return (int) (Math.pow(amount, 5) / 100);//reverses the computation above - } + public int getRandomAmount( + Random aRandom) { // generates some random ass number that correlates to extraction speeds + int div = (int) Math.floor(Math.pow((MaxAmount - MinAmount) * 100.d * DIVIDER, 0.2d)); + int min = (int) Math.floor(Math.pow(MinAmount * 100.d * DIVIDER, 0.2d)); + double amount = min + aRandom.nextInt(div) + aRandom.nextDouble(); + return (int) (Math.pow(amount, 5) / 100); // reverses the computation above + } } diff --git a/src/main/java/gregtech/api/objects/ItemData.java b/src/main/java/gregtech/api/objects/ItemData.java index ce77d222aa..cf3c2b5c14 100644 --- a/src/main/java/gregtech/api/objects/ItemData.java +++ b/src/main/java/gregtech/api/objects/ItemData.java @@ -2,9 +2,8 @@ package gregtech.api.objects; import gregtech.api.enums.Materials; import gregtech.api.enums.OrePrefixes; -import net.minecraft.item.ItemStack; - import java.util.*; +import net.minecraft.item.ItemStack; public class ItemData { private static final MaterialStack[] EMPTY_MATERIALSTACK_ARRAY = new MaterialStack[0]; @@ -20,7 +19,9 @@ public class ItemData { mPrefix = aPrefix; mMaterial = aMaterial == null ? null : new MaterialStack(aMaterial, aPrefix.mMaterialAmount); mBlackListed = aBlackListed; - mByProducts = aPrefix.mSecondaryMaterial == null || aPrefix.mSecondaryMaterial.mMaterial == null ? EMPTY_MATERIALSTACK_ARRAY : new MaterialStack[]{aPrefix.mSecondaryMaterial.clone()}; + mByProducts = aPrefix.mSecondaryMaterial == null || aPrefix.mSecondaryMaterial.mMaterial == null + ? EMPTY_MATERIALSTACK_ARRAY + : new MaterialStack[] {aPrefix.mSecondaryMaterial.clone()}; } public ItemData(OrePrefixes aPrefix, Materials aMaterial) { @@ -34,7 +35,8 @@ public class ItemData { if (aByProducts == null) { mByProducts = EMPTY_MATERIALSTACK_ARRAY; } else { - MaterialStack[] tByProducts = aByProducts.length < 1 ? EMPTY_MATERIALSTACK_ARRAY : new MaterialStack[aByProducts.length]; + MaterialStack[] tByProducts = + aByProducts.length < 1 ? EMPTY_MATERIALSTACK_ARRAY : new MaterialStack[aByProducts.length]; int j = 0; for (int i = 0; i < aByProducts.length; i++) if (aByProducts[i] != null && aByProducts[i].mMaterial != null) diff --git a/src/main/java/gregtech/api/objects/MaterialStack.java b/src/main/java/gregtech/api/objects/MaterialStack.java index e4c135cc73..3e68105f0e 100644 --- a/src/main/java/gregtech/api/objects/MaterialStack.java +++ b/src/main/java/gregtech/api/objects/MaterialStack.java @@ -18,7 +18,11 @@ public class MaterialStack implements Cloneable { @Override public MaterialStack clone() { - try { return (MaterialStack) super.clone(); } catch (Exception e) { return new MaterialStack(mMaterial, mAmount); } + try { + return (MaterialStack) super.clone(); + } catch (Exception e) { + return new MaterialStack(mMaterial, mAmount); + } } @Override @@ -27,34 +31,38 @@ public class MaterialStack implements Cloneable { if (aObject == null) return false; if (aObject instanceof Materials) return aObject == mMaterial; if (aObject instanceof MaterialStack) - return ((MaterialStack) aObject).mMaterial == mMaterial && (mAmount < 0 || ((MaterialStack) aObject).mAmount < 0 || ((MaterialStack) aObject).mAmount == mAmount); + return ((MaterialStack) aObject).mMaterial == mMaterial + && (mAmount < 0 + || ((MaterialStack) aObject).mAmount < 0 + || ((MaterialStack) aObject).mAmount == mAmount); return false; } @Override public String toString() { - String temp1 = "", temp2 = mMaterial.getToolTip(true), temp3 = "", temp4 = ""; - if (mAmount > 1) { - temp4 = GT_Utility.toSubscript(mAmount); - - if (mMaterial.mMaterialList.size() > 1 || isMaterialListComplex(this)) { + String temp1 = "", temp2 = mMaterial.getToolTip(true), temp3 = "", temp4 = ""; + if (mAmount > 1) { + temp4 = GT_Utility.toSubscript(mAmount); + + if (mMaterial.mMaterialList.size() > 1 || isMaterialListComplex(this)) { temp1 = "("; temp3 = ")"; - } - } - return String.valueOf(new StringBuilder().append(temp1).append(temp2).append(temp3).append(temp4)); + } + } + return String.valueOf( + new StringBuilder().append(temp1).append(temp2).append(temp3).append(temp4)); } - private boolean isMaterialListComplex(MaterialStack materialStack){ - if (materialStack.mMaterial.mMaterialList.size() > 1) { - return true; - } - if (materialStack.mMaterial.mMaterialList.size() == 0) { - return false; - } - return isMaterialListComplex(materialStack.mMaterial.mMaterialList.get(0)); + private boolean isMaterialListComplex(MaterialStack materialStack) { + if (materialStack.mMaterial.mMaterialList.size() > 1) { + return true; + } + if (materialStack.mMaterial.mMaterialList.size() == 0) { + return false; + } + return isMaterialListComplex(materialStack.mMaterial.mMaterialList.get(0)); } - + @Override public int hashCode() { return mMaterial.hashCode(); diff --git a/src/main/java/gregtech/api/objects/ObjMap.java b/src/main/java/gregtech/api/objects/ObjMap.java index 0db6083cfe..0a3b3a8fbe 100644 --- a/src/main/java/gregtech/api/objects/ObjMap.java +++ b/src/main/java/gregtech/api/objects/ObjMap.java @@ -5,8 +5,7 @@ import java.util.Arrays; /** * Object-2-object map based on IntIntMap4a */ -public class ObjMap<K, V> -{ +public class ObjMap<K, V> { private static final Object FREE_KEY = new Object(); private static final Object REMOVED_KEY = new Object(); @@ -15,6 +14,7 @@ public class ObjMap<K, V> /** Value for the null key (if inserted into a map) */ private Object m_nullValue; + private boolean m_hasNull; /** Fill factor, must be between (0 and 1) */ @@ -28,159 +28,120 @@ public class ObjMap<K, V> /** Mask to wrap the actual array pointer */ private int m_mask2; - public ObjMap( final int size, final float fillFactor ) - { - if ( fillFactor <= 0 || fillFactor >= 1 ) - throw new IllegalArgumentException( "FillFactor must be in (0, 1)" ); - if ( size <= 0 ) - throw new IllegalArgumentException( "Size must be positive!" ); + public ObjMap(final int size, final float fillFactor) { + if (fillFactor <= 0 || fillFactor >= 1) throw new IllegalArgumentException("FillFactor must be in (0, 1)"); + if (size <= 0) throw new IllegalArgumentException("Size must be positive!"); final int capacity = arraySize(size, fillFactor); m_mask = capacity - 1; m_mask2 = capacity * 2 - 1; m_fillFactor = fillFactor; m_data = new Object[capacity * 2]; - Arrays.fill( m_data, FREE_KEY ); + Arrays.fill(m_data, FREE_KEY); m_threshold = (int) (capacity * fillFactor); } @SuppressWarnings("unchecked") - public V get( final K key ) - { - if ( key == null ) - return (V) m_nullValue; //we null it on remove, so safe not to check a flag here + public V get(final K key) { + if (key == null) return (V) m_nullValue; // we null it on remove, so safe not to check a flag here int ptr = (key.hashCode() & m_mask) << 1; - Object k = m_data[ ptr ]; + Object k = m_data[ptr]; - if ( k == FREE_KEY ) - return null; //end of chain already - if ( k.equals( key ) ) //we check FREE and REMOVED prior to this call - return (V) m_data[ ptr + 1 ]; - while ( true ) - { - ptr = (ptr + 2) & m_mask2; //that's next index - k = m_data[ ptr ]; - if ( k == FREE_KEY ) - return null; - if ( k.equals( key ) ) - return (V) m_data[ ptr + 1 ]; + if (k == FREE_KEY) return null; // end of chain already + if (k.equals(key)) // we check FREE and REMOVED prior to this call + return (V) m_data[ptr + 1]; + while (true) { + ptr = (ptr + 2) & m_mask2; // that's next index + k = m_data[ptr]; + if (k == FREE_KEY) return null; + if (k.equals(key)) return (V) m_data[ptr + 1]; } } @SuppressWarnings("unchecked") - public V put( final K key, final V value ) - { - if ( key == null ) - return insertNullKey(value); + public V put(final K key, final V value) { + if (key == null) return insertNullKey(value); int ptr = getStartIndex(key) << 1; Object k = m_data[ptr]; - if ( k == FREE_KEY ) //end of chain already + if (k == FREE_KEY) // end of chain already { - m_data[ ptr ] = key; - m_data[ ptr + 1 ] = value; - if ( m_size >= m_threshold ) - rehash( m_data.length * 2 ); //size is set inside - else - ++m_size; + m_data[ptr] = key; + m_data[ptr + 1] = value; + if (m_size >= m_threshold) rehash(m_data.length * 2); // size is set inside + else ++m_size; return null; - } - else if ( k.equals( key ) ) //we check FREE and REMOVED prior to this call + } else if (k.equals(key)) // we check FREE and REMOVED prior to this call { - final Object ret = m_data[ ptr + 1 ]; - m_data[ ptr + 1 ] = value; + final Object ret = m_data[ptr + 1]; + m_data[ptr + 1] = value; return (V) ret; } int firstRemoved = -1; - if ( k == REMOVED_KEY ) - firstRemoved = ptr; //we may find a key later - - while ( true ) - { - ptr = ( ptr + 2 ) & m_mask2; //that's next index calculation - k = m_data[ ptr ]; - if ( k == FREE_KEY ) - { - if ( firstRemoved != -1 ) - ptr = firstRemoved; - m_data[ ptr ] = key; - m_data[ ptr + 1 ] = value; - if ( m_size >= m_threshold ) - rehash( m_data.length * 2 ); //size is set inside - else - ++m_size; + if (k == REMOVED_KEY) firstRemoved = ptr; // we may find a key later + + while (true) { + ptr = (ptr + 2) & m_mask2; // that's next index calculation + k = m_data[ptr]; + if (k == FREE_KEY) { + if (firstRemoved != -1) ptr = firstRemoved; + m_data[ptr] = key; + m_data[ptr + 1] = value; + if (m_size >= m_threshold) rehash(m_data.length * 2); // size is set inside + else ++m_size; return null; - } - else if ( k.equals( key ) ) - { - final Object ret = m_data[ ptr + 1 ]; - m_data[ ptr + 1 ] = value; + } else if (k.equals(key)) { + final Object ret = m_data[ptr + 1]; + m_data[ptr + 1] = value; return (V) ret; - } - else if ( k == REMOVED_KEY ) - { - if ( firstRemoved == -1 ) - firstRemoved = ptr; + } else if (k == REMOVED_KEY) { + if (firstRemoved == -1) firstRemoved = ptr; } } } @SuppressWarnings("unchecked") - public V remove( final K key ) - { - if ( key == null ) - return removeNullKey(); + public V remove(final K key) { + if (key == null) return removeNullKey(); int ptr = getStartIndex(key) << 1; - Object k = m_data[ ptr ]; - if ( k == FREE_KEY ) - return null; //end of chain already - else if ( k.equals( key ) ) //we check FREE and REMOVED prior to this call + Object k = m_data[ptr]; + if (k == FREE_KEY) return null; // end of chain already + else if (k.equals(key)) // we check FREE and REMOVED prior to this call { --m_size; - if ( m_data[ ( ptr + 2 ) & m_mask2 ] == FREE_KEY ) - m_data[ ptr ] = FREE_KEY; - else - m_data[ ptr ] = REMOVED_KEY; - final V ret = (V) m_data[ ptr + 1 ]; - m_data[ ptr + 1 ] = null; + if (m_data[(ptr + 2) & m_mask2] == FREE_KEY) m_data[ptr] = FREE_KEY; + else m_data[ptr] = REMOVED_KEY; + final V ret = (V) m_data[ptr + 1]; + m_data[ptr + 1] = null; return ret; } - while ( true ) - { - ptr = ( ptr + 2 ) & m_mask2; //that's next index calculation - k = m_data[ ptr ]; - if ( k == FREE_KEY ) - return null; - else if ( k.equals( key ) ) - { + while (true) { + ptr = (ptr + 2) & m_mask2; // that's next index calculation + k = m_data[ptr]; + if (k == FREE_KEY) return null; + else if (k.equals(key)) { --m_size; - if ( m_data[ ( ptr + 2 ) & m_mask2 ] == FREE_KEY ) - m_data[ ptr ] = FREE_KEY; - else - m_data[ ptr ] = REMOVED_KEY; - final V ret = (V) m_data[ ptr + 1 ]; - m_data[ ptr + 1 ] = null; + if (m_data[(ptr + 2) & m_mask2] == FREE_KEY) m_data[ptr] = FREE_KEY; + else m_data[ptr] = REMOVED_KEY; + final V ret = (V) m_data[ptr + 1]; + m_data[ptr + 1] = null; return ret; } } } @SuppressWarnings("unchecked") - private V insertNullKey(final V value) - { - if ( m_hasNull ) - { + private V insertNullKey(final V value) { + if (m_hasNull) { final Object ret = m_nullValue; m_nullValue = value; return (V) ret; - } - else - { + } else { m_nullValue = value; ++m_size; return null; @@ -188,94 +149,87 @@ public class ObjMap<K, V> } @SuppressWarnings("unchecked") - private V removeNullKey() - { - if ( m_hasNull ) - { + private V removeNullKey() { + if (m_hasNull) { final Object ret = m_nullValue; m_nullValue = null; m_hasNull = false; --m_size; return (V) ret; - } - else - { + } else { return null; } } - public int size() - { + public int size() { return m_size; } @SuppressWarnings("unchecked") - private void rehash( final int newCapacity ) - { - m_threshold = (int) (newCapacity/2 * m_fillFactor); - m_mask = newCapacity/2 - 1; + private void rehash(final int newCapacity) { + m_threshold = (int) (newCapacity / 2 * m_fillFactor); + m_mask = newCapacity / 2 - 1; m_mask2 = newCapacity - 1; final int oldCapacity = m_data.length; final Object[] oldData = m_data; - m_data = new Object[ newCapacity ]; - Arrays.fill( m_data, FREE_KEY ); + m_data = new Object[newCapacity]; + Arrays.fill(m_data, FREE_KEY); m_size = m_hasNull ? 1 : 0; - for ( int i = 0; i < oldCapacity; i += 2 ) { - final Object oldKey = oldData[ i ]; - if( oldKey != FREE_KEY && oldKey != REMOVED_KEY ) - put( (K)oldKey, (V)oldData[ i + 1 ]); + for (int i = 0; i < oldCapacity; i += 2) { + final Object oldKey = oldData[i]; + if (oldKey != FREE_KEY && oldKey != REMOVED_KEY) put((K) oldKey, (V) oldData[i + 1]); } } - public int getStartIndex( final Object key ) - { - //key is not null here + public int getStartIndex(final Object key) { + // key is not null here return key.hashCode() & m_mask; } - + /** Taken from FastUtil implementation */ /** Return the least power of two greater than or equal to the specified value. - * - * <p>Note that this function will return 1 when the argument is 0. - * - * @param x a long integer smaller than or equal to 2<sup>62</sup>. - * @return the least power of two greater than or equal to the specified value. - */ - public static long nextPowerOfTwo( long x ) { - if ( x == 0 ) return 1; - x--; - x |= x >> 1; - x |= x >> 2; - x |= x >> 4; - x |= x >> 8; - x |= x >> 16; - return ( x | x >> 32 ) + 1; - } + * + * <p>Note that this function will return 1 when the argument is 0. + * + * @param x a long integer smaller than or equal to 2<sup>62</sup>. + * @return the least power of two greater than or equal to the specified value. + */ + public static long nextPowerOfTwo(long x) { + if (x == 0) return 1; + x--; + x |= x >> 1; + x |= x >> 2; + x |= x >> 4; + x |= x >> 8; + x |= x >> 16; + return (x | x >> 32) + 1; + } /** Returns the least power of two smaller than or equal to 2<sup>30</sup> and larger than or equal to <code>Math.ceil( expected / f )</code>. - * - * @param expected the expected number of elements in a hash table. - * @param f the load factor. - * @return the minimum possible size for a backing array. - * @throws IllegalArgumentException if the necessary size is larger than 2<sup>30</sup>. - */ - public static int arraySize( final int expected, final float f ) { - final long s = Math.max( 2, nextPowerOfTwo( (long)Math.ceil( expected / f ) ) ); - if ( s > (1 << 30) ) throw new IllegalArgumentException( "Too large (" + expected + " expected elements with load factor " + f + ")" ); - return (int)s; - } - - //taken from FastUtil + * + * @param expected the expected number of elements in a hash table. + * @param f the load factor. + * @return the minimum possible size for a backing array. + * @throws IllegalArgumentException if the necessary size is larger than 2<sup>30</sup>. + */ + public static int arraySize(final int expected, final float f) { + final long s = Math.max(2, nextPowerOfTwo((long) Math.ceil(expected / f))); + if (s > (1 << 30)) + throw new IllegalArgumentException( + "Too large (" + expected + " expected elements with load factor " + f + ")"); + return (int) s; + } + + // taken from FastUtil private static final int INT_PHI = 0x9E3779B9; - public static int phiMix( final int x ) { - final int h = x * INT_PHI; - return h ^ (h >> 16); -} - + public static int phiMix(final int x) { + final int h = x * INT_PHI; + return h ^ (h >> 16); + } } diff --git a/src/main/java/gregtech/api/objects/ReverseShapedRecipe.java b/src/main/java/gregtech/api/objects/ReverseShapedRecipe.java index cb9e7d4d83..60a5c13d74 100644 --- a/src/main/java/gregtech/api/objects/ReverseShapedRecipe.java +++ b/src/main/java/gregtech/api/objects/ReverseShapedRecipe.java @@ -1,16 +1,15 @@ package gregtech.api.objects; +import static gregtech.api.util.GT_Recipe.GT_Recipe_Map.sDisassemblerRecipes; + import gregtech.api.util.GT_Recipe; import gregtech.api.util.GT_Utility; import gregtech.common.tileentities.machines.basic.GT_MetaTileEntity_Disassembler; -import net.minecraft.item.ItemStack; - import java.util.Collections; import java.util.LinkedList; import java.util.Optional; import java.util.Queue; - -import static gregtech.api.util.GT_Recipe.GT_Recipe_Map.sDisassemblerRecipes; +import net.minecraft.item.ItemStack; public class ReverseShapedRecipe { private static Queue<ReverseShapedRecipe> reverseRecipes = new LinkedList<>(); @@ -30,11 +29,11 @@ public class ReverseShapedRecipe { public static void runReverseRecipes() { for (ReverseShapedRecipe x : reverseRecipes) { Optional<GT_Recipe> recipeOptional = GT_Utility.reverseShapedRecipe(x.aResult, x.aRecipe); - if (!recipeOptional.isPresent()) - continue; + 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 1c5e27d246..6593dc60d8 100644 --- a/src/main/java/gregtech/api/objects/ReverseShapelessRecipe.java +++ b/src/main/java/gregtech/api/objects/ReverseShapelessRecipe.java @@ -1,16 +1,15 @@ package gregtech.api.objects; +import static gregtech.api.util.GT_Recipe.GT_Recipe_Map.sDisassemblerRecipes; + import gregtech.api.util.GT_Recipe; import gregtech.api.util.GT_Utility; import gregtech.common.tileentities.machines.basic.GT_MetaTileEntity_Disassembler; -import net.minecraft.item.ItemStack; - import java.util.Collections; import java.util.LinkedList; import java.util.Optional; import java.util.Queue; - -import static gregtech.api.util.GT_Recipe.GT_Recipe_Map.sDisassemblerRecipes; +import net.minecraft.item.ItemStack; public class ReverseShapelessRecipe { private static Queue<ReverseShapelessRecipe> reverseRecipes = new LinkedList<>(); @@ -30,11 +29,11 @@ public class ReverseShapelessRecipe { public static void runReverseRecipes() { for (ReverseShapelessRecipe x : reverseRecipes) { Optional<GT_Recipe> recipeOptional = GT_Utility.reverseShapelessRecipe(x.aResult, x.aRecipe); - if (!recipeOptional.isPresent()) - continue; + 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 a2c4906345..b5ed4a00b4 100644 --- a/src/main/java/gregtech/api/objects/XSTR.java +++ b/src/main/java/gregtech/api/objects/XSTR.java @@ -23,7 +23,6 @@ package gregtech.api.objects; * This code is released under the GNU Lesser General Public License Version 3 * http://www.gnu.org/licenses/lgpl-3.0.txt */ - import java.util.Random; import java.util.concurrent.atomic.AtomicLong; @@ -41,21 +40,21 @@ public class XSTR extends Random { private static final long GAMMA = 0x9e3779b97f4a7c15L; private static final int PROBE_INCREMENT = 0x9e3779b9; private static final long SEEDER_INCREMENT = 0xbb67ae8584caa73bL; - private static final double DOUBLE_UNIT = 0x1.0p-53; // 1.0 / (1L << 53) - private static final float FLOAT_UNIT = 0x1.0p-24f; // 1.0f / (1 << 24) + private static final double DOUBLE_UNIT = 0x1.0p-53; // 1.0 / (1L << 53) + private static final float FLOAT_UNIT = 0x1.0p-24f; // 1.0f / (1 << 24) private static final AtomicLong seedUniquifier = new AtomicLong(8682522807148012L); - public static final XSTR XSTR_INSTANCE=new XSTR(){ + public static final XSTR XSTR_INSTANCE = new XSTR() { @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!"); } }; /* - MODIFIED BY: Robotia - Modification: Implemented Random class seed generator - */ + MODIFIED BY: Robotia + Modification: Implemented Random class seed generator + */ /** * Creates a new pseudo random number generator. The seed is initialized to * the current time, as if by @@ -68,7 +67,7 @@ public class XSTR extends Random { private static long seedUniquifier() { // L'Ecuyer, "Tables of Linear Congruential Generators of // Different Sizes and Good Lattice Structure", 1999 - for (;;) { + for (; ; ) { long current = seedUniquifier.get(); long next = current * 181783497276652981L; if (seedUniquifier.compareAndSet(current, next)) { @@ -86,6 +85,7 @@ public class XSTR extends Random { public XSTR(long seed) { this.seed = seed; } + @Override public boolean nextBoolean() { return next(1) != 0; @@ -93,7 +93,7 @@ public class XSTR extends Random { @Override public double nextDouble() { - return (((long)(next(26)) << 27) + next(27)) * DOUBLE_UNIT; + return (((long) (next(26)) << 27) + next(27)) * DOUBLE_UNIT; } /** * Returns the current state of the seed, can be used to clone the object @@ -142,8 +142,10 @@ public class XSTR extends Random { x &= ((1L << nbits) - 1); return (int) x; } + boolean haveNextNextGaussian = false; double nextNextGaussian = 0; + @Override public synchronized double nextGaussian() { // See Knuth, ACP, Section 3.4.1 Algorithm C. @@ -157,7 +159,7 @@ public class XSTR extends Random { v2 = 2 * nextDouble() - 1; // between -1 and 1 s = v1 * v1 + v2 * v2; } while (s >= 1 || s == 0); - double multiplier = StrictMath.sqrt(-2 * StrictMath.log(s)/s); + double multiplier = StrictMath.sqrt(-2 * StrictMath.log(s) / s); nextNextGaussian = v2 * multiplier; haveNextNextGaussian = true; return v1 * multiplier; @@ -220,9 +222,9 @@ public class XSTR extends Random { */ @Override public int nextInt(int bound) { - //if (bound <= 0) { - //throw new RuntimeException("BadBound"); - //} + // if (bound <= 0) { + // throw new RuntimeException("BadBound"); + // } /*int r = next(31); int m = bound - 1; @@ -236,7 +238,7 @@ public class XSTR extends Random { ; } return r;*/ - //speedup, new nextInt ~+40% + // speedup, new nextInt ~+40% last = seed ^ (seed << 21); last ^= (last >>> 35); last ^= (last << 4); @@ -244,6 +246,7 @@ public class XSTR extends Random { int out = (int) last % bound; return (out < 0) ? -out : out; } + @Override public int nextInt() { return next(32); @@ -257,15 +260,14 @@ public class XSTR extends Random { @Override public long nextLong() { // it's okay that the bottom word remains signed. - return ((long)(next(32)) << 32) + next(32); + return ((long) (next(32)) << 32) + next(32); } @Override public void nextBytes(byte[] bytes_arr) { for (int iba = 0, lenba = bytes_arr.length; iba < lenba; ) - for (int rndba = nextInt(), - nba = Math.min(lenba - iba, Integer.SIZE/Byte.SIZE); - nba-- > 0; rndba >>= Byte.SIZE) - bytes_arr[iba++] = (byte)rndba; + for (int rndba = nextInt(), nba = Math.min(lenba - iba, Integer.SIZE / Byte.SIZE); + nba-- > 0; + rndba >>= Byte.SIZE) bytes_arr[iba++] = (byte) rndba; } } diff --git a/src/main/java/gregtech/api/render/TextureFactory.java b/src/main/java/gregtech/api/render/TextureFactory.java index 8c67cd6740..4ff1a05707 100644 --- a/src/main/java/gregtech/api/render/TextureFactory.java +++ b/src/main/java/gregtech/api/render/TextureFactory.java @@ -49,10 +49,19 @@ public final class TextureFactory { * @param rgba The {@code short[]} RGBA tint for all sides. * @return The instance of an {@link ITexture} implementation */ - 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(); + 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(); } /** @@ -64,9 +73,13 @@ public final class TextureFactory { * @param rgba The {@code short[]} RGBA tint for all sides. * @return The instance of an {@link ITexture} implementation */ - 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(); + 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(); } /** @@ -78,7 +91,11 @@ 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) { @@ -100,7 +117,11 @@ 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) { 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 7093184533..9ae94d1c80 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 @@ -30,8 +30,8 @@ public class GT_Runnable_Cable_Update extends GT_Runnable_MachineBlockUpdate { GT_Proxy.TICK_LOCK.lock(); try { - //we dont want to go over cables that are in unloaded chunks - //keeping the lock just to make sure no CME happens + // we dont want to go over cables that are in unloaded chunks + // keeping the lock just to make sure no CME happens if (world.blockExists(aCoords.posX, aCoords.posY, aCoords.posZ)) { tTileEntity = world.getTileEntity(aCoords.posX, aCoords.posY, aCoords.posZ); } else { @@ -47,23 +47,27 @@ public class GT_Runnable_Cable_Update extends GT_Runnable_MachineBlockUpdate { // Now see if we should add the nearby blocks to the queue: // only add blocks the cable is connected to - if (tTileEntity instanceof BaseMetaPipeEntity && - ((BaseMetaPipeEntity) tTileEntity).getMetaTileEntity() instanceof GT_MetaPipeEntity_Cable) - { + if (tTileEntity instanceof BaseMetaPipeEntity + && ((BaseMetaPipeEntity) tTileEntity).getMetaTileEntity() instanceof GT_MetaPipeEntity_Cable) { ChunkCoordinates tCoords; - for (byte i = 0;i<6;i++) { - if (((GT_MetaPipeEntity_Cable) ((BaseMetaPipeEntity) tTileEntity).getMetaTileEntity()).isConnectedAtSide(i)) { + for (byte i = 0; i < 6; i++) { + if (((GT_MetaPipeEntity_Cable) ((BaseMetaPipeEntity) tTileEntity).getMetaTileEntity()) + .isConnectedAtSide(i)) { ForgeDirection offset = ForgeDirection.getOrientation(i); - if (visited.add(tCoords = new ChunkCoordinates(aCoords.posX + offset.offsetX, - aCoords.posY + offset.offsetY, aCoords.posZ + offset.offsetZ))) - tQueue.add(tCoords); + if (visited.add( + tCoords = new ChunkCoordinates( + aCoords.posX + offset.offsetX, + aCoords.posY + offset.offsetY, + aCoords.posZ + offset.offsetZ))) tQueue.add(tCoords); } } } } } catch (Exception e) { GT_Mod.GT_FML_LOGGER.error( - "Well this update was broken... " + mCoords + ", mWorld={" + world.getProviderName() + " @dimId " + world.provider.dimensionId + "}", e); + "Well this update was broken... " + mCoords + ", mWorld={" + world.getProviderName() + " @dimId " + + world.provider.dimensionId + "}", + e); } } } 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 4b4c01345a..371c3316f3 100644 --- a/src/main/java/gregtech/api/threads/GT_Runnable_MachineBlockUpdate.java +++ b/src/main/java/gregtech/api/threads/GT_Runnable_MachineBlockUpdate.java @@ -4,10 +4,6 @@ import gregtech.GT_Mod; import gregtech.api.GregTech_API; import gregtech.api.interfaces.tileentity.IMachineBlockUpdateable; import gregtech.common.GT_Proxy; -import net.minecraft.tileentity.TileEntity; -import net.minecraft.util.ChunkCoordinates; -import net.minecraft.world.World; - import java.util.HashSet; import java.util.LinkedList; import java.util.Queue; @@ -16,6 +12,9 @@ import java.util.concurrent.ExecutorService; import java.util.concurrent.Executors; import java.util.concurrent.ThreadFactory; import java.util.concurrent.TimeUnit; +import net.minecraft.tileentity.TileEntity; +import net.minecraft.util.ChunkCoordinates; +import net.minecraft.world.World; public class GT_Runnable_MachineBlockUpdate implements Runnable { // used by runner thread @@ -23,7 +22,7 @@ public class GT_Runnable_MachineBlockUpdate implements Runnable { protected final World world; protected final Set<ChunkCoordinates> visited = new HashSet<>(80); protected final Queue<ChunkCoordinates> tQueue = new LinkedList<>(); - + // Threading private static final ThreadFactory THREAD_FACTORY = r -> { Thread thread = new Thread(r); @@ -65,7 +64,8 @@ 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() { @@ -77,7 +77,8 @@ public class GT_Runnable_MachineBlockUpdate implements Runnable { EXECUTOR_SERVICE.shutdownNow(); // Cancel currently executing tasks // Wait a while for tasks to respond to being cancelled if (!EXECUTOR_SERVICE.awaitTermination(60, TimeUnit.SECONDS)) { - GT_Mod.GT_FML_LOGGER.error("Well this didn't terminated well... GT_Runnable_MachineBlockUpdate.shutdownExecutorService"); + GT_Mod.GT_FML_LOGGER.error( + "Well this didn't terminated well... GT_Runnable_MachineBlockUpdate.shutdownExecutorService"); } } } catch (InterruptedException ie) { @@ -86,11 +87,11 @@ public class GT_Runnable_MachineBlockUpdate implements Runnable { EXECUTOR_SERVICE.shutdownNow(); // Preserve interrupt status Thread.currentThread().interrupt(); - }catch (Exception e){ + } catch (Exception e) { GT_Mod.GT_FML_LOGGER.error("Well this didn't terminated well...", e); // (Re-)Cancel in case EXECUTOR_SERVICE.shutdownNow(); - }finally { + } finally { GT_Mod.GT_FML_LOGGER.info("Leaving... GT_Runnable_MachineBlockUpdate.shutdownExecutorService"); } } @@ -102,17 +103,21 @@ public class GT_Runnable_MachineBlockUpdate implements Runnable { final ChunkCoordinates aCoords = tQueue.poll(); final TileEntity tTileEntity; final boolean isMachineBlock; - - // This might load a chunk... which might load a TileEntity... which might get added to `loadedTileEntityList`... which might be in the process - // of being iterated over during `UpdateEntities()`... which might cause a ConcurrentModificationException. So, lock that shit. + + // This might load a chunk... which might load a TileEntity... which might get added to + // `loadedTileEntityList`... which might be in the process + // of being iterated over during `UpdateEntities()`... which might cause a + // ConcurrentModificationException. So, lock that shit. GT_Proxy.TICK_LOCK.lock(); try { tTileEntity = world.getTileEntity(aCoords.posX, aCoords.posY, aCoords.posZ); - isMachineBlock = GregTech_API.isMachineBlock(world.getBlock(aCoords.posX, aCoords.posY, aCoords.posZ), world.getBlockMetadata(aCoords.posX, aCoords.posY, aCoords.posZ)); + isMachineBlock = GregTech_API.isMachineBlock( + world.getBlock(aCoords.posX, aCoords.posY, aCoords.posZ), + world.getBlockMetadata(aCoords.posX, aCoords.posY, aCoords.posZ)); } finally { GT_Proxy.TICK_LOCK.unlock(); } - + // See if the block itself needs an update if (tTileEntity instanceof IMachineBlockUpdateable) ((IMachineBlockUpdateable) tTileEntity).onMachineBlockUpdate(); @@ -121,24 +126,31 @@ public class GT_Runnable_MachineBlockUpdate implements Runnable { // 1) If we've visited less than 5 blocks, then yes // 2) If the tile says we should recursively updated (pipes don't, machine blocks do) // 3) If the block at the coordinates is marked as a machine block - if (visited.size() < 5 - || (tTileEntity instanceof IMachineBlockUpdateable && ((IMachineBlockUpdateable) tTileEntity).isMachineBlockUpdateRecursive()) - || isMachineBlock) - { + if (visited.size() < 5 + || (tTileEntity instanceof IMachineBlockUpdateable + && ((IMachineBlockUpdateable) tTileEntity).isMachineBlockUpdateRecursive()) + || isMachineBlock) { ChunkCoordinates tCoords; - - if (visited.add(tCoords = new ChunkCoordinates(aCoords.posX + 1, aCoords.posY, aCoords.posZ))) tQueue.add(tCoords); - if (visited.add(tCoords = new ChunkCoordinates(aCoords.posX - 1, aCoords.posY, aCoords.posZ))) tQueue.add(tCoords); - if (visited.add(tCoords = new ChunkCoordinates(aCoords.posX, aCoords.posY + 1, aCoords.posZ))) tQueue.add(tCoords); - if (visited.add(tCoords = new ChunkCoordinates(aCoords.posX, aCoords.posY - 1, aCoords.posZ))) tQueue.add(tCoords); - if (visited.add(tCoords = new ChunkCoordinates(aCoords.posX, aCoords.posY, aCoords.posZ + 1))) tQueue.add(tCoords); - if (visited.add(tCoords = new ChunkCoordinates(aCoords.posX, aCoords.posY, aCoords.posZ - 1))) tQueue.add(tCoords); + + if (visited.add(tCoords = new ChunkCoordinates(aCoords.posX + 1, aCoords.posY, aCoords.posZ))) + tQueue.add(tCoords); + if (visited.add(tCoords = new ChunkCoordinates(aCoords.posX - 1, aCoords.posY, aCoords.posZ))) + tQueue.add(tCoords); + if (visited.add(tCoords = new ChunkCoordinates(aCoords.posX, aCoords.posY + 1, aCoords.posZ))) + tQueue.add(tCoords); + if (visited.add(tCoords = new ChunkCoordinates(aCoords.posX, aCoords.posY - 1, aCoords.posZ))) + tQueue.add(tCoords); + if (visited.add(tCoords = new ChunkCoordinates(aCoords.posX, aCoords.posY, aCoords.posZ + 1))) + tQueue.add(tCoords); + if (visited.add(tCoords = new ChunkCoordinates(aCoords.posX, aCoords.posY, aCoords.posZ - 1))) + tQueue.add(tCoords); } } } catch (Exception e) { GT_Mod.GT_FML_LOGGER.error( - "Well this update was broken... " + mCoords + ", mWorld={" + world.getProviderName() + " @dimId " + world.provider.dimensionId + "}", e); + "Well this update was broken... " + mCoords + ", mWorld={" + world.getProviderName() + " @dimId " + + world.provider.dimensionId + "}", + e); } } - } diff --git a/src/main/java/gregtech/api/threads/GT_Runnable_Sound.java b/src/main/java/gregtech/api/threads/GT_Runnable_Sound.java index 441d46ad58..99aa638f87 100644 --- a/src/main/java/gregtech/api/threads/GT_Runnable_Sound.java +++ b/src/main/java/gregtech/api/threads/GT_Runnable_Sound.java @@ -11,7 +11,15 @@ public class GT_Runnable_Sound implements Runnable { private final ResourceLocation mSoundResourceLocation; private final float mSoundStrength, mSoundModulation; - public GT_Runnable_Sound(World aWorld, int aX, int aY, int aZ, int aTimeUntilNextSound, ResourceLocation aSoundResourceLocation, float aSoundStrength, float aSoundModulation) { + public GT_Runnable_Sound( + World aWorld, + int aX, + int aY, + int aZ, + int aTimeUntilNextSound, + ResourceLocation aSoundResourceLocation, + float aSoundStrength, + float aSoundModulation) { mWorld = aWorld; mX = aX; mY = aY; @@ -26,8 +34,24 @@ public class GT_Runnable_Sound implements Runnable { * @deprecated Use {@link #GT_Runnable_Sound(World, int, int, int, int, ResourceLocation, float, float)} */ @Deprecated - public GT_Runnable_Sound(World aWorld, int aX, int aY, int aZ, int aTimeUntilNextSound, String aSoundName, float aSoundStrength, float aSoundModulation) { - this(aWorld, aX, aY, aZ, aTimeUntilNextSound, new ResourceLocation(aSoundName), aSoundStrength, aSoundModulation); + public GT_Runnable_Sound( + World aWorld, + int aX, + int aY, + int aZ, + int aTimeUntilNextSound, + String aSoundName, + float aSoundStrength, + float aSoundModulation) { + this( + aWorld, + aX, + aY, + aZ, + aTimeUntilNextSound, + new ResourceLocation(aSoundName), + aSoundStrength, + aSoundModulation); } @Override @@ -38,6 +62,8 @@ public class GT_Runnable_Sound implements Runnable { return; mWorld.playSound(mX, mY, mZ, mSoundResourceLocation.toString(), mSoundStrength, mSoundModulation, false); GT_Utility.sPlayedSoundMap.put(tSound, mTimeUntilNextSound); - } catch (Throwable e) {/**/} + } catch (Throwable e) { + /**/ + } } } diff --git a/src/main/java/gregtech/api/util/ColorsMetadataSection.java b/src/main/java/gregtech/api/util/ColorsMetadataSection.java index 2851435061..9f1c4f3ffe 100644 --- a/src/main/java/gregtech/api/util/ColorsMetadataSection.java +++ b/src/main/java/gregtech/api/util/ColorsMetadataSection.java @@ -2,10 +2,8 @@ package gregtech.api.util; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; -import java.util.Map; import java.util.HashMap; -import gregtech.api.util.GT_Log; -import gregtech.api.GregTech_API; +import java.util.Map; import net.minecraft.client.resources.data.IMetadataSection; @SideOnly(Side.CLIENT) @@ -16,7 +14,8 @@ public class ColorsMetadataSection implements IMetadataSection { private final Map<String, String> hexGuiTints; private final boolean guiTintEnabled; - public ColorsMetadataSection(Map<String, String> hexTextColorMap, Map<String, String> hexGuiTintMap, boolean guiTintEnabled) { + public ColorsMetadataSection( + Map<String, String> hexTextColorMap, Map<String, String> hexGuiTintMap, boolean guiTintEnabled) { this.hexTextColors = hexTextColorMap; this.textColors = convertHexMapToIntMap(hexTextColorMap); @@ -26,16 +25,15 @@ public class ColorsMetadataSection implements IMetadataSection { this.guiTintEnabled = guiTintEnabled; } - private Map<String, Integer> convertHexMapToIntMap(Map <String, String> hexMap) { + private Map<String, Integer> convertHexMapToIntMap(Map<String, String> hexMap) { Map<String, Integer> intMap = new HashMap<>(); for (String key : hexMap.keySet()) { int colorValue = -1; String hex = hexMap.get(key); try { - if (!hex.isEmpty()) colorValue = Integer.parseUnsignedInt(hex,16); - } - catch (final NumberFormatException e) { + if (!hex.isEmpty()) colorValue = Integer.parseUnsignedInt(hex, 16); + } catch (final NumberFormatException e) { GT_Log.err.println("Couldn't format color correctly of " + key + " -> " + hex); } intMap.put(key, colorValue); @@ -51,7 +49,7 @@ public class ColorsMetadataSection implements IMetadataSection { return sColorInMap(key, this.hexGuiTints) ? defaultColor : this.guiTints.get(key); } - private boolean sColorInMap(String key, Map<String,String> hexMap) { + private boolean sColorInMap(String key, Map<String, String> hexMap) { return hexMap.containsKey(key) && hexMap.get(key).isEmpty(); } diff --git a/src/main/java/gregtech/api/util/ColorsMetadataSectionSerializer.java b/src/main/java/gregtech/api/util/ColorsMetadataSectionSerializer.java index 4de8463685..718ff81854 100644 --- a/src/main/java/gregtech/api/util/ColorsMetadataSectionSerializer.java +++ b/src/main/java/gregtech/api/util/ColorsMetadataSectionSerializer.java @@ -7,26 +7,29 @@ import com.google.gson.JsonSerializationContext; import com.google.gson.JsonSerializer; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; -import java.lang.reflect.Type; -import java.util.Map; -import java.util.HashMap; import gregtech.api.GregTech_API; import gregtech.api.enums.Dyes; -import net.minecraft.util.JsonUtils; +import java.lang.reflect.Type; +import java.util.HashMap; +import java.util.Map; import net.minecraft.client.resources.data.BaseMetadataSectionSerializer; +import net.minecraft.util.JsonUtils; @SideOnly(Side.CLIENT) public class ColorsMetadataSectionSerializer extends BaseMetadataSectionSerializer implements JsonSerializer { - public ColorsMetadataSection deserialize(JsonElement metadataColors, Type type, JsonDeserializationContext context) { + public ColorsMetadataSection deserialize( + JsonElement metadataColors, Type type, JsonDeserializationContext context) { // Default values boolean enableGuiTint = GregTech_API.sColoredGUI; Map<String, String> hexGuiTintMap = new HashMap<String, String>(); - Map<String, String> hexTextColorMap = new HashMap<String, String>() {{ - put("title", ""); - put("text", ""); - put("value", ""); - put("nei", ""); - }}; + Map<String, String> hexTextColorMap = new HashMap<String, String>() { + { + put("title", ""); + put("text", ""); + put("value", ""); + put("nei", ""); + } + }; JsonObject jsonObject = JsonUtils.getJsonElementAsJsonObject(metadataColors, "metadata section"); if (jsonObject.has("textColor")) { @@ -38,7 +41,8 @@ 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())); @@ -46,7 +50,9 @@ public class ColorsMetadataSectionSerializer extends BaseMetadataSectionSerializ for (String key : hexGuiTintMap.keySet()) { if (enableGuiTint) { - hexGuiTintMap.replace(key, JsonUtils.getJsonObjectStringFieldValueOrDefault(guiTints, key, hexGuiTintMap.get(key))); + hexGuiTintMap.replace( + key, + JsonUtils.getJsonObjectStringFieldValueOrDefault(guiTints, key, hexGuiTintMap.get(key))); } else { hexGuiTintMap.replace(key, GT_Util.toHexString(Dyes.dyeWhite.getRGBA())); } diff --git a/src/main/java/gregtech/api/util/GT_ApiaryUpgrade.java b/src/main/java/gregtech/api/util/GT_ApiaryUpgrade.java index e74b68111a..4cbd014cbc 100644 --- a/src/main/java/gregtech/api/util/GT_ApiaryUpgrade.java +++ b/src/main/java/gregtech/api/util/GT_ApiaryUpgrade.java @@ -3,13 +3,12 @@ package gregtech.api.util; import cpw.mods.fml.common.Loader; import gregtech.api.enums.OrePrefixes; import gregtech.common.items.GT_MetaGenerated_Item_03; +import java.util.*; +import java.util.function.Consumer; import net.bdew.gendustry.api.ApiaryModifiers; import net.bdew.gendustry.api.items.IApiaryUpgrade; import net.minecraft.item.ItemStack; -import java.util.*; -import java.util.function.Consumer; - public enum GT_ApiaryUpgrade { speed1(UNIQUE_INDEX.SPEED_UPGRADE, 32200, 1, 1), speed2(UNIQUE_INDEX.SPEED_UPGRADE, 32201, 1, 2), @@ -22,15 +21,17 @@ public enum GT_ApiaryUpgrade { speed8upgraded(UNIQUE_INDEX.SPEED_UPGRADE, 32208, 1, 8), ; - private enum UNIQUE_INDEX{ + private enum UNIQUE_INDEX { SPEED_UPGRADE, ; - void apply(Consumer<GT_ApiaryUpgrade> fn){ + + void apply(Consumer<GT_ApiaryUpgrade> fn) { UNIQUE_UPGRADE_LIST.get(this).forEach(fn); } } - private static final EnumMap<UNIQUE_INDEX, ArrayList<GT_ApiaryUpgrade>> UNIQUE_UPGRADE_LIST = new EnumMap<>(UNIQUE_INDEX.class); + private static final EnumMap<UNIQUE_INDEX, ArrayList<GT_ApiaryUpgrade>> UNIQUE_UPGRADE_LIST = + new EnumMap<>(UNIQUE_INDEX.class); private int meta = 0; private int maxnumber = 1; @@ -40,9 +41,10 @@ public enum GT_ApiaryUpgrade { private final UNIQUE_INDEX unique_index; private final HashMap<GT_Utility.ItemId, ItemStack> additionalGendustryUpgrades = new HashMap<>(); - private final HashSet<GT_Utility.ItemId> blacklistedUpgrades = new HashSet<>(); // additionalGendustryUpgrades are blacklisted by default + private final HashSet<GT_Utility.ItemId> blacklistedUpgrades = + new HashSet<>(); // additionalGendustryUpgrades are blacklisted by default - GT_ApiaryUpgrade(UNIQUE_INDEX unique_index, int meta, int maxnumber, int maxspeedmodifier){ + GT_ApiaryUpgrade(UNIQUE_INDEX unique_index, int meta, int maxnumber, int maxspeedmodifier) { this.unique_index = unique_index; this.meta = meta; this.maxnumber = maxnumber; @@ -50,11 +52,14 @@ public enum GT_ApiaryUpgrade { this.id = GT_Utility.ItemId.createNoCopy(get(1)); } - private void setup_static_variables(){ + private void setup_static_variables() { quickLookup.put(this.meta, this); ArrayList<GT_ApiaryUpgrade> un = UNIQUE_UPGRADE_LIST.get(this.unique_index); - if(un != null) - un.forEach((u) -> { u.blacklistedUpgrades.add(this.id); this.blacklistedUpgrades.add(u.id); }); + if (un != null) + un.forEach((u) -> { + u.blacklistedUpgrades.add(this.id); + this.blacklistedUpgrades.add(u.id); + }); else { un = new ArrayList<>(1); UNIQUE_UPGRADE_LIST.put(this.unique_index, un); @@ -62,45 +67,43 @@ public enum GT_ApiaryUpgrade { un.add(this); } - public static GT_ApiaryUpgrade getUpgrade(ItemStack s){ - if(s == null) - return null; - if(!isUpgrade(s)) - return null; + public static GT_ApiaryUpgrade getUpgrade(ItemStack s) { + if (s == null) return null; + if (!isUpgrade(s)) return null; return quickLookup.get(s.getItemDamage()); } - public boolean isAllowedToWorkWith(ItemStack s){ + public boolean isAllowedToWorkWith(ItemStack s) { GT_Utility.ItemId id = GT_Utility.ItemId.createNoCopy(s); return !additionalGendustryUpgrades.containsKey(id) && !blacklistedUpgrades.contains(id); } - public int getMaxNumber(){ + public int getMaxNumber() { return maxnumber; } - public void applyModifiers(ApiaryModifiers mods, ItemStack s){ - additionalGendustryUpgrades.forEach((k, u) -> ((IApiaryUpgrade)u.getItem()).applyModifiers(mods, u)); + public void applyModifiers(ApiaryModifiers mods, ItemStack s) { + additionalGendustryUpgrades.forEach((k, u) -> ((IApiaryUpgrade) u.getItem()).applyModifiers(mods, u)); } - public ItemStack get(int count){ + public ItemStack get(int count) { return new ItemStack(GT_MetaGenerated_Item_03.INSTANCE, count, meta); } - public static boolean isUpgrade(ItemStack s){ + public static boolean isUpgrade(ItemStack s) { return OrePrefixes.apiaryUpgrade.contains(s); } - public int applyMaxSpeedModifier(int maxspeed){ + public int applyMaxSpeedModifier(int maxspeed) { return Math.max(maxspeed, maxspeedmodifier); } private static final HashMap<Integer, GT_ApiaryUpgrade> quickLookup = new HashMap<>(); - static{ + static { EnumSet.allOf(GT_ApiaryUpgrade.class).forEach(GT_ApiaryUpgrade::setup_static_variables); - if(Loader.isModLoaded("gendustry")) { + if (Loader.isModLoaded("gendustry")) { ItemStack s = GT_ModHandler.getModItem("gendustry", "ApiaryUpgrade", 8L, 0); GT_Utility.ItemId a = GT_Utility.ItemId.createNoCopy(s); speed8upgraded.additionalGendustryUpgrades.put(a, s); diff --git a/src/main/java/gregtech/api/util/GT_AssemblyLineUtils.java b/src/main/java/gregtech/api/util/GT_AssemblyLineUtils.java index 4f9036f2c7..f20a78d494 100644 --- a/src/main/java/gregtech/api/util/GT_AssemblyLineUtils.java +++ b/src/main/java/gregtech/api/util/GT_AssemblyLineUtils.java @@ -2,17 +2,17 @@ package gregtech.api.util; import static gregtech.GT_Mod.GT_FML_LOGGER; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.HashMap; -import java.util.List; -import java.util.Objects; - import cpw.mods.fml.common.FMLCommonHandler; import gregtech.api.enums.GT_Values; import gregtech.api.enums.ItemList; import gregtech.api.objects.GT_ItemStack; import gregtech.api.util.GT_Recipe.GT_Recipe_AssemblyLine; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.HashMap; +import java.util.List; +import java.util.Objects; +import javax.annotation.Nonnull; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.nbt.NBTTagList; @@ -20,509 +20,514 @@ import net.minecraft.nbt.NBTTagString; import net.minecraftforge.common.util.Constants.NBT; import net.minecraftforge.fluids.FluidStack; -import javax.annotation.Nonnull; - public class GT_AssemblyLineUtils { - /** - * A cache of Recipes using the Output as Key. - */ - private static HashMap<GT_ItemStack, GT_Recipe_AssemblyLine> sRecipeCacheByOutput = new HashMap<GT_ItemStack, GT_Recipe_AssemblyLine>(); - /** - * A cache of Recipes using the Recipe Hash String as Key. - */ - private static HashMap<String, GT_Recipe_AssemblyLine> sRecipeCacheByRecipeHash = new HashMap<String, GT_Recipe_AssemblyLine>(); - - - - /** - * Checks the DataStick for deprecated/invalid recipes, updating them as required. - * @param aDataStick - The DataStick to process - * @return Is this DataStick now valid with a current recipe? - */ - public static GT_Recipe_AssemblyLine processDataStick(ItemStack aDataStick) { - if (!isItemDataStick(aDataStick)) { - return null; - } - if (doesDataStickNeedUpdate(aDataStick)) { - ItemStack aStickOutput = getDataStickOutput(aDataStick); - if (aStickOutput != null) { - GT_Recipe_AssemblyLine aIntendedRecipe = findAssemblyLineRecipeByOutput(aStickOutput); - if (aIntendedRecipe != null && setAssemblyLineRecipeOnDataStick(aDataStick, aIntendedRecipe)) - return aIntendedRecipe; - } - } - return null; - } - - - /** - * Finds an Assembly Line recipe from a DataStick. - * @param aDataStick - The DataStick to check. - * @return The GT_Recipe_AssemblyLine recipe contained on the DataStick, if any. - */ - public static GT_Recipe_AssemblyLine findAssemblyLineRecipeFromDataStick(ItemStack aDataStick) { - return findAssemblyLineRecipeFromDataStick(aDataStick, false).getRecipe(); - } - - /** - * Finds an Assembly Line recipe from a DataStick. - * @param aDataStick - The DataStick to check. - * @param aReturnBuiltRecipe - Do we return a GT_Recipe_AssemblyLine built from the data on the Data Stick instead of searching the Recipe Map? - * @return The GT_Recipe_AssemblyLine recipe contained on the DataStick, if any. - */ - @Nonnull - public static LookupResult findAssemblyLineRecipeFromDataStick(ItemStack aDataStick, boolean aReturnBuiltRecipe) { - if (!isItemDataStick(aDataStick) || !doesDataStickHaveOutput(aDataStick)) { - return LookupResultType.INVALID_STICK.getResult(); - } - List<ItemStack> aInputs = new ArrayList<>(15); - ItemStack aOutput = getDataStickOutput(aDataStick); - List<List<ItemStack>> mOreDictAlt = new ArrayList<>(15); - List<FluidStack> aFluidInputs = new ArrayList<>(4); - - NBTTagCompound aTag = aDataStick.getTagCompound(); - if (aTag == null) { - return LookupResultType.INVALID_STICK.getResult(); - } - - //Get From Cache - if (doesDataStickHaveRecipeHash(aDataStick)) { - GT_Recipe_AssemblyLine aRecipeFromCache = sRecipeCacheByRecipeHash.get(getHashFromDataStack(aDataStick)); - if (aRecipeFromCache != null && GT_Utility.areStacksEqual(aOutput, aRecipeFromCache.mOutput)) { - return LookupResultType.VALID_STACK_AND_VALID_HASH.getResult(aRecipeFromCache); - } // else: no cache, or the old recipe run into a hash collision with a different new recipe - } - - for (int i = 0; i < 15; i++) { - int count = aTag.getInteger("a" + i); - if (!aTag.hasKey("" + i) && count <= 0) { - continue; - } - - List<ItemStack> tAltCurrent = new ArrayList<>(); - for (int j = 0; j < count; j++) { - ItemStack tLoaded = GT_Utility.loadItem(aTag, "a" + i + ":" + j); - if (tLoaded == null) { - continue; - } - tAltCurrent.add(tLoaded); - if (GT_Values.D1) { - GT_FML_LOGGER.info("Item Alt " + i + " : " + tLoaded.getUnlocalizedName()); - } - } - mOreDictAlt.add(tAltCurrent); - ItemStack tLoaded = GT_Utility.loadItem(aTag, "" + i); - if (tLoaded == null) { - continue; - } - aInputs.add(tLoaded); - if (GT_Values.D1) { - GT_FML_LOGGER.info("Item " + i + " : " + tLoaded.getUnlocalizedName()); - } - } - - if (GT_Values.D1) { - GT_FML_LOGGER.info("All Items done, start fluid check"); - } - for (int i = 0; i < 4; i++) { - if (!aTag.hasKey("f" + i)) continue; - FluidStack tLoaded = GT_Utility.loadFluid(aTag, "f" + i); - if (tLoaded == null) continue; - aFluidInputs.add(tLoaded); - if (GT_Values.D1) { - GT_FML_LOGGER.info("Fluid " + i + " " + tLoaded.getUnlocalizedName()); - } - } - if (!aTag.hasKey("output") || !aTag.hasKey("time") || aTag.getInteger("time") <= 0 || !aTag.hasKey("eu") || !GT_Utility.isStackValid(aOutput)) { - return LookupResultType.INVALID_STICK.getResult(); - } - if (GT_Values.D1) { - GT_FML_LOGGER.info("Found Data Stick recipe"); - } - - int aTime = aTag.getInteger("time"); - int aEU = aTag.getInteger("eu"); - - // Try build a recipe instance - if (aReturnBuiltRecipe) { - return LookupResultType.VALID_STACK_AND_VALID_HASH.getResult(new GT_Recipe_AssemblyLine(null, 0, aInputs.toArray(new ItemStack[0]), aFluidInputs.toArray(new FluidStack[0]), aOutput, aTime, aEU)); - } - - - for (GT_Recipe_AssemblyLine aRecipe : GT_Recipe.GT_Recipe_AssemblyLine.sAssemblylineRecipes) { - if (aRecipe.mEUt != aEU || aRecipe.mDuration != aTime) continue; - if (!GT_Utility.areStacksEqual(aOutput, aRecipe.mOutput, true)) continue; - if (!GT_Utility.areStackListsEqual(Arrays.asList(aRecipe.mInputs), aInputs, false, true)) continue; - if (!Objects.equals(Arrays.asList(aRecipe.mFluidInputs), aFluidInputs)) continue; - if (!areStacksEqual(aRecipe.mOreDictAlt, mOreDictAlt)) continue; - - // Cache it - String aRecipeHash = generateRecipeHash(aRecipe); - sRecipeCacheByRecipeHash.put(aRecipeHash, aRecipe); - sRecipeCacheByOutput.put(new GT_ItemStack(aRecipe.mOutput), aRecipe); - if (doesDataStickHaveRecipeHash(aDataStick)) { - String aStickHash = getHashFromDataStack(aDataStick); - if (aRecipeHash.equals(aStickHash)) - return LookupResultType.VALID_STACK_AND_VALID_HASH.getResult(aRecipe); - } - return LookupResultType.VALID_STACK_AND_VALID_RECIPE.getResult(aRecipe); - } - return LookupResultType.VALID_STACK_BUT_INVALID_RECIPE.getResult(); - } - - private static boolean areStacksEqual(ItemStack[][] lhs, List<List<ItemStack>> rhs) { - for (int i = 0; i < lhs.length; i++) { - if (!areStacksEqual(lhs[i], rhs.get(i))) - return false; - } - return true; - } - - private static boolean areStacksEqual(ItemStack[] lhs, List<ItemStack> rhs) { - return lhs == null ? rhs.isEmpty() : !rhs.isEmpty() && GT_Utility.areStackListsEqual(Arrays.asList(lhs), rhs, false, true); - } - - - /** - * Finds a GT_Recipe_AssemblyLine based on the expected output ItemStack. - * @param aOutput - The Output of a GT_Recipe_AssemblyLine. - * @return First found GT_Recipe_AssemblyLine with matching output. - */ - public static GT_Recipe_AssemblyLine findAssemblyLineRecipeByOutput(ItemStack aOutput) { - if (aOutput == null) { - return null; - } - - // Check the cache - GT_ItemStack aCacheStack = new GT_ItemStack(aOutput); - GT_Recipe_AssemblyLine aRecipeFromCache = sRecipeCacheByOutput.get(aCacheStack); - if (aRecipeFromCache != null) { - return aRecipeFromCache; - } - - // Iterate all recipes and return the first matching based on Output. - for (GT_Recipe_AssemblyLine aRecipe : GT_Recipe.GT_Recipe_AssemblyLine.sAssemblylineRecipes) { - ItemStack aRecipeOutput = aRecipe.mOutput; - if (GT_Utility.areStacksEqual(aRecipeOutput, aOutput)) { - // Cache it to prevent future iterations of all recipes - sRecipeCacheByOutput.put(aCacheStack, aRecipe); - sRecipeCacheByRecipeHash.put(generateRecipeHash(aRecipe), aRecipe); - return aRecipe; - } - } - return null; - } - - /** - * @param aRecipe - The recipe to generate a Recipe Hash String from. - * @return The Recipe Hash String. - */ - public static String generateRecipeHash(GT_Recipe_AssemblyLine aRecipe) { - String aHash = "Invalid.Recipe.Hash"; - if (aRecipe != null) { - aHash = "Hash."+aRecipe.getPersistentHash(); - } - return aHash; - } - - /** - * @param aRecipe - The recipe to add to internal caches - * @throws IllegalArgumentException if given recipe collide with any existing recipe in the cache - */ - public static void addRecipeToCache(GT_Recipe_AssemblyLine aRecipe) { - if (aRecipe != null) { - String aHash = "Hash." + aRecipe.getPersistentHash(); - GT_Recipe_AssemblyLine existing = sRecipeCacheByOutput.put(new GT_ItemStack(aRecipe.mOutput), aRecipe); - if (existing != null) - throw new IllegalArgumentException("Duplicate assline recipe for " + aRecipe.mOutput); - existing = sRecipeCacheByRecipeHash.put(aHash, aRecipe); - if (existing != null && !existing.equals(aRecipe)) - throw new IllegalArgumentException("Recipe hash collision for " + aRecipe + " and " + existing); - } - } - - /** - * @param aHash - Recipe hash String, may be null but will just be treated as invalid. - * @return Is this Recipe Hash String valid? - */ - public static boolean isValidHash(String aHash) { - if (aHash != null && aHash.length() > 0) { - // persistent hash can never be 0 - return !aHash.equals("Invalid.Recipe.Hash") && !aHash.equals("Hash.0"); - } - return false; - } - - /** - * @param aStack - The ItemStack to check. - * @return Is this ItemStack a Data Stick? - */ - public static boolean isItemDataStick(ItemStack aStack) { - return GT_Utility.isStackValid(aStack) && ItemList.Tool_DataStick.isStackEqual(aStack, false, true); - } - - /** - * @param aDataStick - The Data Stick to check. - * @return Does this Data Stick have a valid output ItemStack? - */ - public static boolean doesDataStickHaveOutput(ItemStack aDataStick) { - if (isItemDataStick(aDataStick) && aDataStick.hasTagCompound() && aDataStick.getTagCompound().hasKey("output")) { - return true; - } - return false; - } - - /** - * @param aDataStick - The Data Stick to check. - * @return Does this Data Stick need recipe data updated. - */ - public static boolean doesDataStickNeedUpdate(ItemStack aDataStick) { - if (isItemDataStick(aDataStick) && doesDataStickHaveRecipeHash(aDataStick)) { - String aStickHash = getHashFromDataStack(aDataStick); - if (isValidHash(aStickHash) && doesDataStickHaveOutput(aDataStick)) { - ItemStack aStickOutput = getDataStickOutput(aDataStick); - GT_Recipe_AssemblyLine aIntendedRecipe = findAssemblyLineRecipeByOutput(aStickOutput); - if (aStickHash.equals(generateRecipeHash(aIntendedRecipe))) { - return false; - } - } - } - return true; - } - - /** - * @param aDataStick - The Data Stick to check. - * @return Does this have a Recipe Hash String at all? - */ - 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")) { - return true; - } - } - return false; - } - - /** - * Get the Output ItemStack from a Data Stick. - * @param aDataStick - The Data Stick to check. - * @return Output ItemStack contained on the Data Stick. - */ - public static ItemStack getDataStickOutput(ItemStack aDataStick) { - if (doesDataStickHaveOutput(aDataStick)) { - ItemStack aOutput = GT_Utility.loadItem(aDataStick.getTagCompound(), "output"); - return aOutput; - } - return null; - } - - /** - * @param aDataStick - The Data Stick to process. - * @return The stored Recipe Hash String on the Data Stick, will return an invalid Hash if one is not found. <p> - * The hash will be guaranteed to pass isValidHash(). <p> - * Will not return Null. - */ - public static String getHashFromDataStack(ItemStack aDataStick) { - if (isItemDataStick(aDataStick) && aDataStick.hasTagCompound()) { - NBTTagCompound aNBT = aDataStick.getTagCompound(); - if (aNBT.hasKey("Data.Recipe.Hash", NBT.TAG_STRING)) { - String hash = aNBT.getString("Data.Recipe.Hash"); - if (isValidHash(hash)) - return hash; - } - } - return "Invalid.Recipe.Hash"; - } - - /** - * - * @param aDataStick - The Data Stick to update. - * @param aRecipeHash - The Recipe Hash String to update with. - * @return Did we update the Recipe Hash String on the Data Stick? - */ - public static boolean setRecipeHashOnDataStick(ItemStack aDataStick, String aRecipeHash) { - if (isItemDataStick(aDataStick) && aDataStick.hasTagCompound()) { - NBTTagCompound aNBT = aDataStick.getTagCompound(); - aNBT.setString("Data.Recipe.Hash", aRecipeHash); - aDataStick.setTagCompound(aNBT); - return true; - } - return false; - } - - /** - * - * @param aDataStick - The Data Stick to update. - * @param aNewRecipe - The New GT_Recipe_AssemblyLine recipe to update it with. - * @return Did we set the new recipe data & Recipe Hash String on the Data Stick? - */ - public static boolean setAssemblyLineRecipeOnDataStick(ItemStack aDataStick, GT_Recipe_AssemblyLine aNewRecipe) { - if (isItemDataStick(aDataStick)) { - String s = aNewRecipe.mOutput.getDisplayName(); - if (FMLCommonHandler.instance().getEffectiveSide().isServer()) { - s = GT_Assemblyline_Server.lServerNames.get(aNewRecipe.mOutput.getDisplayName()); - if (s == null) { - s = aNewRecipe.mOutput.getDisplayName(); - } - } - - String aHash = generateRecipeHash(aNewRecipe); - if (GT_Values.D1) { - GT_Recipe_AssemblyLine aOldRecipe = findAssemblyLineRecipeFromDataStick(aDataStick, true).recipe; - GT_FML_LOGGER.info("Updating data stick: "+aDataStick.getDisplayName()+" | Old Recipe Hash: "+generateRecipeHash(aOldRecipe)+", New Recipe Hash: "+aHash); - } - - String author = "Assembling Line Recipe Generator"; - String displayName = null; - if (aDataStick.hasTagCompound()) { - NBTTagCompound tag = aDataStick.getTagCompound(); - if (tag.hasKey("author", NBT.TAG_STRING)) { - author = tag.getString("author"); - } - if (tag.hasKey("display", NBT.TAG_COMPOUND)) { - NBTTagCompound displayTag = tag.getCompoundTag("display"); - if (displayTag.hasKey("Name", NBT.TAG_STRING)) - displayName = displayTag.getString("Name"); - } - } - - //remove possible old NBTTagCompound - aDataStick.setTagCompound(new NBTTagCompound()); - if (displayName != null) - aDataStick.setStackDisplayName(displayName); - if (GT_Values.D1) { - GT_Utility.ItemNBT.setBookTitle(aDataStick, s + " Construction Data ("+aHash+")"); - } - else { - GT_Utility.ItemNBT.setBookTitle(aDataStick, s + " Construction Data"); - } - - NBTTagCompound tNBT = aDataStick.getTagCompound(); - if (tNBT == null) { - tNBT = new NBTTagCompound(); - } - - tNBT.setTag("output", aNewRecipe.mOutput.writeToNBT(new NBTTagCompound())); - tNBT.setInteger("time", aNewRecipe.mDuration); - tNBT.setInteger("eu", aNewRecipe.mEUt); - for (int i = 0; i < aNewRecipe.mInputs.length; i++) { - tNBT.setTag("" + i, aNewRecipe.mInputs[i].writeToNBT(new NBTTagCompound())); - } - for (int i = 0; i < aNewRecipe.mOreDictAlt.length; i++) { - if (aNewRecipe.mOreDictAlt[i] != null && aNewRecipe.mOreDictAlt[i].length > 0) { - tNBT.setInteger("a" + i, aNewRecipe.mOreDictAlt[i].length); - for (int j = 0; j < aNewRecipe.mOreDictAlt[i].length; j++) { - tNBT.setTag("a" + i + ":" + j, aNewRecipe.mOreDictAlt[i][j].writeToNBT(new NBTTagCompound())); - } - } - } - for (int i = 0; i < aNewRecipe.mFluidInputs.length; i++) { - tNBT.setTag("f" + i, aNewRecipe.mFluidInputs[i].writeToNBT(new NBTTagCompound())); - } - tNBT.setString("author", author); - NBTTagList tNBTList = new NBTTagList(); - s = aNewRecipe.mOutput.getDisplayName(); - if (FMLCommonHandler.instance().getEffectiveSide().isServer()) { - s = GT_Assemblyline_Server.lServerNames.get(aNewRecipe.mOutput.getDisplayName()); - if (s == null) - s = aNewRecipe.mOutput.getDisplayName(); - } - tNBTList.appendTag(new NBTTagString("Construction plan for " + aNewRecipe.mOutput.stackSize + " " + s + ". Needed EU/t: " + aNewRecipe.mEUt + " Production time: " + (aNewRecipe.mDuration / 20))); - for (int i = 0; i < aNewRecipe.mInputs.length; i++) { - if (aNewRecipe.mOreDictAlt[i] != null) { - int count = 0; - StringBuilder tBuilder = new StringBuilder("Input Bus " + (i + 1) + ": "); - for (ItemStack tStack : aNewRecipe.mOreDictAlt[i]) { - if (tStack != null) { - s = tStack.getDisplayName(); - 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); - 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()) { - s = GT_Assemblyline_Server.lServerNames.get(aNewRecipe.mInputs[i].getDisplayName()); - if (s == null) - s = aNewRecipe.mInputs[i].getDisplayName(); - } - tNBTList.appendTag(new NBTTagString("Input Bus " + (i + 1) + ": " + aNewRecipe.mInputs[i].stackSize + " " + s)); - } - } - for (int i = 0; i < aNewRecipe.mFluidInputs.length; i++) { - if (aNewRecipe.mFluidInputs[i] != null) { - s = aNewRecipe.mFluidInputs[i].getLocalizedName(); - if (FMLCommonHandler.instance().getEffectiveSide().isServer()) { - s = GT_Assemblyline_Server.lServerNames.get(aNewRecipe.mFluidInputs[i].getLocalizedName()); - if (s == null) - s = aNewRecipe.mFluidInputs[i].getLocalizedName(); - } - tNBTList.appendTag(new NBTTagString("Input Hatch " + (i + 1) + ": " + aNewRecipe.mFluidInputs[i].amount + "L " + s)); - } - } - tNBT.setTag("pages", tNBTList); - tNBT.setLong("lastUpdate", System.currentTimeMillis()); - aDataStick.setTagCompound(tNBT); - // Set recipe hash - setRecipeHashOnDataStick(aDataStick, aHash); - return true; - } - return false; - } - - public enum LookupResultType { - INVALID_STICK(true), - VALID_STACK_BUT_INVALID_RECIPE(true), - VALID_STACK_AND_VALID_RECIPE(false), - VALID_STACK_AND_VALID_HASH(false); - - private final boolean recipeNull; - private LookupResult singletonResult; - - LookupResultType(boolean recipeNull) { - this.recipeNull = recipeNull; - } - - public LookupResult getResult() { - if (!recipeNull) - throw new IllegalArgumentException("This result type require a nonnull recipe"); - if (singletonResult == null) - singletonResult = new LookupResult(null, this); - return singletonResult; - } - - public LookupResult getResult(GT_Recipe_AssemblyLine recipe) { - if ((recipe == null) != recipeNull) - throw new IllegalArgumentException("This result type does not allow given input"); - return new LookupResult(recipe, this); - } - } - - public static class LookupResult { - private final GT_Recipe_AssemblyLine recipe; - private final LookupResultType type; - - LookupResult(GT_Recipe_AssemblyLine recipe, LookupResultType type) { - this.recipe = recipe; - this.type = type; - } - - public GT_Recipe_AssemblyLine getRecipe() { - return recipe; - } - - public LookupResultType getType() { - return type; - } - } + /** + * A cache of Recipes using the Output as Key. + */ + private static HashMap<GT_ItemStack, GT_Recipe_AssemblyLine> sRecipeCacheByOutput = + new HashMap<GT_ItemStack, GT_Recipe_AssemblyLine>(); + /** + * A cache of Recipes using the Recipe Hash String as Key. + */ + private static HashMap<String, GT_Recipe_AssemblyLine> sRecipeCacheByRecipeHash = + new HashMap<String, GT_Recipe_AssemblyLine>(); + + /** + * Checks the DataStick for deprecated/invalid recipes, updating them as required. + * @param aDataStick - The DataStick to process + * @return Is this DataStick now valid with a current recipe? + */ + public static GT_Recipe_AssemblyLine processDataStick(ItemStack aDataStick) { + if (!isItemDataStick(aDataStick)) { + return null; + } + if (doesDataStickNeedUpdate(aDataStick)) { + ItemStack aStickOutput = getDataStickOutput(aDataStick); + if (aStickOutput != null) { + GT_Recipe_AssemblyLine aIntendedRecipe = findAssemblyLineRecipeByOutput(aStickOutput); + if (aIntendedRecipe != null && setAssemblyLineRecipeOnDataStick(aDataStick, aIntendedRecipe)) + return aIntendedRecipe; + } + } + return null; + } + + /** + * Finds an Assembly Line recipe from a DataStick. + * @param aDataStick - The DataStick to check. + * @return The GT_Recipe_AssemblyLine recipe contained on the DataStick, if any. + */ + public static GT_Recipe_AssemblyLine findAssemblyLineRecipeFromDataStick(ItemStack aDataStick) { + return findAssemblyLineRecipeFromDataStick(aDataStick, false).getRecipe(); + } + + /** + * Finds an Assembly Line recipe from a DataStick. + * @param aDataStick - The DataStick to check. + * @param aReturnBuiltRecipe - Do we return a GT_Recipe_AssemblyLine built from the data on the Data Stick instead of searching the Recipe Map? + * @return The GT_Recipe_AssemblyLine recipe contained on the DataStick, if any. + */ + @Nonnull + public static LookupResult findAssemblyLineRecipeFromDataStick(ItemStack aDataStick, boolean aReturnBuiltRecipe) { + if (!isItemDataStick(aDataStick) || !doesDataStickHaveOutput(aDataStick)) { + return LookupResultType.INVALID_STICK.getResult(); + } + List<ItemStack> aInputs = new ArrayList<>(15); + ItemStack aOutput = getDataStickOutput(aDataStick); + List<List<ItemStack>> mOreDictAlt = new ArrayList<>(15); + List<FluidStack> aFluidInputs = new ArrayList<>(4); + + NBTTagCompound aTag = aDataStick.getTagCompound(); + if (aTag == null) { + return LookupResultType.INVALID_STICK.getResult(); + } + + // Get From Cache + if (doesDataStickHaveRecipeHash(aDataStick)) { + GT_Recipe_AssemblyLine aRecipeFromCache = sRecipeCacheByRecipeHash.get(getHashFromDataStack(aDataStick)); + if (aRecipeFromCache != null && GT_Utility.areStacksEqual(aOutput, aRecipeFromCache.mOutput)) { + return LookupResultType.VALID_STACK_AND_VALID_HASH.getResult(aRecipeFromCache); + } // else: no cache, or the old recipe run into a hash collision with a different new recipe + } + + for (int i = 0; i < 15; i++) { + int count = aTag.getInteger("a" + i); + if (!aTag.hasKey("" + i) && count <= 0) { + continue; + } + + List<ItemStack> tAltCurrent = new ArrayList<>(); + for (int j = 0; j < count; j++) { + ItemStack tLoaded = GT_Utility.loadItem(aTag, "a" + i + ":" + j); + if (tLoaded == null) { + continue; + } + tAltCurrent.add(tLoaded); + if (GT_Values.D1) { + GT_FML_LOGGER.info("Item Alt " + i + " : " + tLoaded.getUnlocalizedName()); + } + } + mOreDictAlt.add(tAltCurrent); + ItemStack tLoaded = GT_Utility.loadItem(aTag, "" + i); + if (tLoaded == null) { + continue; + } + aInputs.add(tLoaded); + if (GT_Values.D1) { + GT_FML_LOGGER.info("Item " + i + " : " + tLoaded.getUnlocalizedName()); + } + } + + if (GT_Values.D1) { + GT_FML_LOGGER.info("All Items done, start fluid check"); + } + for (int i = 0; i < 4; i++) { + if (!aTag.hasKey("f" + i)) continue; + FluidStack tLoaded = GT_Utility.loadFluid(aTag, "f" + i); + if (tLoaded == null) continue; + aFluidInputs.add(tLoaded); + if (GT_Values.D1) { + GT_FML_LOGGER.info("Fluid " + i + " " + tLoaded.getUnlocalizedName()); + } + } + if (!aTag.hasKey("output") + || !aTag.hasKey("time") + || aTag.getInteger("time") <= 0 + || !aTag.hasKey("eu") + || !GT_Utility.isStackValid(aOutput)) { + return LookupResultType.INVALID_STICK.getResult(); + } + if (GT_Values.D1) { + GT_FML_LOGGER.info("Found Data Stick recipe"); + } + + int aTime = aTag.getInteger("time"); + int aEU = aTag.getInteger("eu"); + + // Try build a recipe instance + if (aReturnBuiltRecipe) { + return LookupResultType.VALID_STACK_AND_VALID_HASH.getResult(new GT_Recipe_AssemblyLine( + null, + 0, + aInputs.toArray(new ItemStack[0]), + aFluidInputs.toArray(new FluidStack[0]), + aOutput, + aTime, + aEU)); + } + + for (GT_Recipe_AssemblyLine aRecipe : GT_Recipe.GT_Recipe_AssemblyLine.sAssemblylineRecipes) { + if (aRecipe.mEUt != aEU || aRecipe.mDuration != aTime) continue; + if (!GT_Utility.areStacksEqual(aOutput, aRecipe.mOutput, true)) continue; + if (!GT_Utility.areStackListsEqual(Arrays.asList(aRecipe.mInputs), aInputs, false, true)) continue; + if (!Objects.equals(Arrays.asList(aRecipe.mFluidInputs), aFluidInputs)) continue; + if (!areStacksEqual(aRecipe.mOreDictAlt, mOreDictAlt)) continue; + + // Cache it + String aRecipeHash = generateRecipeHash(aRecipe); + sRecipeCacheByRecipeHash.put(aRecipeHash, aRecipe); + sRecipeCacheByOutput.put(new GT_ItemStack(aRecipe.mOutput), aRecipe); + if (doesDataStickHaveRecipeHash(aDataStick)) { + String aStickHash = getHashFromDataStack(aDataStick); + if (aRecipeHash.equals(aStickHash)) + return LookupResultType.VALID_STACK_AND_VALID_HASH.getResult(aRecipe); + } + return LookupResultType.VALID_STACK_AND_VALID_RECIPE.getResult(aRecipe); + } + return LookupResultType.VALID_STACK_BUT_INVALID_RECIPE.getResult(); + } + + private static boolean areStacksEqual(ItemStack[][] lhs, List<List<ItemStack>> rhs) { + for (int i = 0; i < lhs.length; i++) { + if (!areStacksEqual(lhs[i], rhs.get(i))) return false; + } + return true; + } + + private static boolean areStacksEqual(ItemStack[] lhs, List<ItemStack> rhs) { + return lhs == null + ? rhs.isEmpty() + : !rhs.isEmpty() && GT_Utility.areStackListsEqual(Arrays.asList(lhs), rhs, false, true); + } + + /** + * Finds a GT_Recipe_AssemblyLine based on the expected output ItemStack. + * @param aOutput - The Output of a GT_Recipe_AssemblyLine. + * @return First found GT_Recipe_AssemblyLine with matching output. + */ + public static GT_Recipe_AssemblyLine findAssemblyLineRecipeByOutput(ItemStack aOutput) { + if (aOutput == null) { + return null; + } + + // Check the cache + GT_ItemStack aCacheStack = new GT_ItemStack(aOutput); + GT_Recipe_AssemblyLine aRecipeFromCache = sRecipeCacheByOutput.get(aCacheStack); + if (aRecipeFromCache != null) { + return aRecipeFromCache; + } + + // Iterate all recipes and return the first matching based on Output. + for (GT_Recipe_AssemblyLine aRecipe : GT_Recipe.GT_Recipe_AssemblyLine.sAssemblylineRecipes) { + ItemStack aRecipeOutput = aRecipe.mOutput; + if (GT_Utility.areStacksEqual(aRecipeOutput, aOutput)) { + // Cache it to prevent future iterations of all recipes + sRecipeCacheByOutput.put(aCacheStack, aRecipe); + sRecipeCacheByRecipeHash.put(generateRecipeHash(aRecipe), aRecipe); + return aRecipe; + } + } + return null; + } + + /** + * @param aRecipe - The recipe to generate a Recipe Hash String from. + * @return The Recipe Hash String. + */ + public static String generateRecipeHash(GT_Recipe_AssemblyLine aRecipe) { + String aHash = "Invalid.Recipe.Hash"; + if (aRecipe != null) { + aHash = "Hash." + aRecipe.getPersistentHash(); + } + return aHash; + } + + /** + * @param aRecipe - The recipe to add to internal caches + * @throws IllegalArgumentException if given recipe collide with any existing recipe in the cache + */ + public static void addRecipeToCache(GT_Recipe_AssemblyLine aRecipe) { + if (aRecipe != null) { + String aHash = "Hash." + aRecipe.getPersistentHash(); + GT_Recipe_AssemblyLine existing = sRecipeCacheByOutput.put(new GT_ItemStack(aRecipe.mOutput), aRecipe); + if (existing != null) throw new IllegalArgumentException("Duplicate assline recipe for " + aRecipe.mOutput); + existing = sRecipeCacheByRecipeHash.put(aHash, aRecipe); + if (existing != null && !existing.equals(aRecipe)) + throw new IllegalArgumentException("Recipe hash collision for " + aRecipe + " and " + existing); + } + } + + /** + * @param aHash - Recipe hash String, may be null but will just be treated as invalid. + * @return Is this Recipe Hash String valid? + */ + public static boolean isValidHash(String aHash) { + if (aHash != null && aHash.length() > 0) { + // persistent hash can never be 0 + return !aHash.equals("Invalid.Recipe.Hash") && !aHash.equals("Hash.0"); + } + return false; + } + + /** + * @param aStack - The ItemStack to check. + * @return Is this ItemStack a Data Stick? + */ + public static boolean isItemDataStick(ItemStack aStack) { + return GT_Utility.isStackValid(aStack) && ItemList.Tool_DataStick.isStackEqual(aStack, false, true); + } + + /** + * @param aDataStick - The Data Stick to check. + * @return Does this Data Stick have a valid output ItemStack? + */ + public static boolean doesDataStickHaveOutput(ItemStack aDataStick) { + if (isItemDataStick(aDataStick) + && aDataStick.hasTagCompound() + && aDataStick.getTagCompound().hasKey("output")) { + return true; + } + return false; + } + + /** + * @param aDataStick - The Data Stick to check. + * @return Does this Data Stick need recipe data updated. + */ + public static boolean doesDataStickNeedUpdate(ItemStack aDataStick) { + if (isItemDataStick(aDataStick) && doesDataStickHaveRecipeHash(aDataStick)) { + String aStickHash = getHashFromDataStack(aDataStick); + if (isValidHash(aStickHash) && doesDataStickHaveOutput(aDataStick)) { + ItemStack aStickOutput = getDataStickOutput(aDataStick); + GT_Recipe_AssemblyLine aIntendedRecipe = findAssemblyLineRecipeByOutput(aStickOutput); + if (aStickHash.equals(generateRecipeHash(aIntendedRecipe))) { + return false; + } + } + } + return true; + } + + /** + * @param aDataStick - The Data Stick to check. + * @return Does this have a Recipe Hash String at all? + */ + 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")) { + return true; + } + } + return false; + } + + /** + * Get the Output ItemStack from a Data Stick. + * @param aDataStick - The Data Stick to check. + * @return Output ItemStack contained on the Data Stick. + */ + public static ItemStack getDataStickOutput(ItemStack aDataStick) { + if (doesDataStickHaveOutput(aDataStick)) { + ItemStack aOutput = GT_Utility.loadItem(aDataStick.getTagCompound(), "output"); + return aOutput; + } + return null; + } + + /** + * @param aDataStick - The Data Stick to process. + * @return The stored Recipe Hash String on the Data Stick, will return an invalid Hash if one is not found. <p> + * The hash will be guaranteed to pass isValidHash(). <p> + * Will not return Null. + */ + public static String getHashFromDataStack(ItemStack aDataStick) { + if (isItemDataStick(aDataStick) && aDataStick.hasTagCompound()) { + NBTTagCompound aNBT = aDataStick.getTagCompound(); + if (aNBT.hasKey("Data.Recipe.Hash", NBT.TAG_STRING)) { + String hash = aNBT.getString("Data.Recipe.Hash"); + if (isValidHash(hash)) return hash; + } + } + return "Invalid.Recipe.Hash"; + } + + /** + * + * @param aDataStick - The Data Stick to update. + * @param aRecipeHash - The Recipe Hash String to update with. + * @return Did we update the Recipe Hash String on the Data Stick? + */ + public static boolean setRecipeHashOnDataStick(ItemStack aDataStick, String aRecipeHash) { + if (isItemDataStick(aDataStick) && aDataStick.hasTagCompound()) { + NBTTagCompound aNBT = aDataStick.getTagCompound(); + aNBT.setString("Data.Recipe.Hash", aRecipeHash); + aDataStick.setTagCompound(aNBT); + return true; + } + return false; + } + + /** + * + * @param aDataStick - The Data Stick to update. + * @param aNewRecipe - The New GT_Recipe_AssemblyLine recipe to update it with. + * @return Did we set the new recipe data & Recipe Hash String on the Data Stick? + */ + public static boolean setAssemblyLineRecipeOnDataStick(ItemStack aDataStick, GT_Recipe_AssemblyLine aNewRecipe) { + if (isItemDataStick(aDataStick)) { + String s = aNewRecipe.mOutput.getDisplayName(); + if (FMLCommonHandler.instance().getEffectiveSide().isServer()) { + s = GT_Assemblyline_Server.lServerNames.get(aNewRecipe.mOutput.getDisplayName()); + if (s == null) { + s = aNewRecipe.mOutput.getDisplayName(); + } + } + + String aHash = generateRecipeHash(aNewRecipe); + if (GT_Values.D1) { + GT_Recipe_AssemblyLine aOldRecipe = findAssemblyLineRecipeFromDataStick(aDataStick, true).recipe; + GT_FML_LOGGER.info("Updating data stick: " + aDataStick.getDisplayName() + " | Old Recipe Hash: " + + generateRecipeHash(aOldRecipe) + ", New Recipe Hash: " + aHash); + } + + String author = "Assembling Line Recipe Generator"; + String displayName = null; + if (aDataStick.hasTagCompound()) { + NBTTagCompound tag = aDataStick.getTagCompound(); + if (tag.hasKey("author", NBT.TAG_STRING)) { + author = tag.getString("author"); + } + if (tag.hasKey("display", NBT.TAG_COMPOUND)) { + NBTTagCompound displayTag = tag.getCompoundTag("display"); + if (displayTag.hasKey("Name", NBT.TAG_STRING)) displayName = displayTag.getString("Name"); + } + } + + // remove possible old NBTTagCompound + aDataStick.setTagCompound(new NBTTagCompound()); + if (displayName != null) aDataStick.setStackDisplayName(displayName); + if (GT_Values.D1) { + GT_Utility.ItemNBT.setBookTitle(aDataStick, s + " Construction Data (" + aHash + ")"); + } else { + GT_Utility.ItemNBT.setBookTitle(aDataStick, s + " Construction Data"); + } + + NBTTagCompound tNBT = aDataStick.getTagCompound(); + if (tNBT == null) { + tNBT = new NBTTagCompound(); + } + + tNBT.setTag("output", aNewRecipe.mOutput.writeToNBT(new NBTTagCompound())); + tNBT.setInteger("time", aNewRecipe.mDuration); + tNBT.setInteger("eu", aNewRecipe.mEUt); + for (int i = 0; i < aNewRecipe.mInputs.length; i++) { + tNBT.setTag("" + i, aNewRecipe.mInputs[i].writeToNBT(new NBTTagCompound())); + } + for (int i = 0; i < aNewRecipe.mOreDictAlt.length; i++) { + if (aNewRecipe.mOreDictAlt[i] != null && aNewRecipe.mOreDictAlt[i].length > 0) { + tNBT.setInteger("a" + i, aNewRecipe.mOreDictAlt[i].length); + for (int j = 0; j < aNewRecipe.mOreDictAlt[i].length; j++) { + tNBT.setTag("a" + i + ":" + j, aNewRecipe.mOreDictAlt[i][j].writeToNBT(new NBTTagCompound())); + } + } + } + for (int i = 0; i < aNewRecipe.mFluidInputs.length; i++) { + tNBT.setTag("f" + i, aNewRecipe.mFluidInputs[i].writeToNBT(new NBTTagCompound())); + } + tNBT.setString("author", author); + NBTTagList tNBTList = new NBTTagList(); + s = aNewRecipe.mOutput.getDisplayName(); + if (FMLCommonHandler.instance().getEffectiveSide().isServer()) { + s = GT_Assemblyline_Server.lServerNames.get(aNewRecipe.mOutput.getDisplayName()); + if (s == null) s = aNewRecipe.mOutput.getDisplayName(); + } + tNBTList.appendTag(new NBTTagString("Construction plan for " + aNewRecipe.mOutput.stackSize + " " + s + + ". Needed EU/t: " + aNewRecipe.mEUt + " Production time: " + (aNewRecipe.mDuration / 20))); + for (int i = 0; i < aNewRecipe.mInputs.length; i++) { + if (aNewRecipe.mOreDictAlt[i] != null) { + int count = 0; + StringBuilder tBuilder = new StringBuilder("Input Bus " + (i + 1) + ": "); + for (ItemStack tStack : aNewRecipe.mOreDictAlt[i]) { + if (tStack != null) { + s = tStack.getDisplayName(); + 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); + 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()) { + s = GT_Assemblyline_Server.lServerNames.get(aNewRecipe.mInputs[i].getDisplayName()); + if (s == null) s = aNewRecipe.mInputs[i].getDisplayName(); + } + tNBTList.appendTag(new NBTTagString( + "Input Bus " + (i + 1) + ": " + aNewRecipe.mInputs[i].stackSize + " " + s)); + } + } + for (int i = 0; i < aNewRecipe.mFluidInputs.length; i++) { + if (aNewRecipe.mFluidInputs[i] != null) { + s = aNewRecipe.mFluidInputs[i].getLocalizedName(); + if (FMLCommonHandler.instance().getEffectiveSide().isServer()) { + s = GT_Assemblyline_Server.lServerNames.get(aNewRecipe.mFluidInputs[i].getLocalizedName()); + if (s == null) s = aNewRecipe.mFluidInputs[i].getLocalizedName(); + } + tNBTList.appendTag(new NBTTagString( + "Input Hatch " + (i + 1) + ": " + aNewRecipe.mFluidInputs[i].amount + "L " + s)); + } + } + tNBT.setTag("pages", tNBTList); + tNBT.setLong("lastUpdate", System.currentTimeMillis()); + aDataStick.setTagCompound(tNBT); + // Set recipe hash + setRecipeHashOnDataStick(aDataStick, aHash); + return true; + } + return false; + } + + public enum LookupResultType { + INVALID_STICK(true), + VALID_STACK_BUT_INVALID_RECIPE(true), + VALID_STACK_AND_VALID_RECIPE(false), + VALID_STACK_AND_VALID_HASH(false); + + private final boolean recipeNull; + private LookupResult singletonResult; + + LookupResultType(boolean recipeNull) { + this.recipeNull = recipeNull; + } + + public LookupResult getResult() { + if (!recipeNull) throw new IllegalArgumentException("This result type require a nonnull recipe"); + if (singletonResult == null) singletonResult = new LookupResult(null, this); + return singletonResult; + } + + public LookupResult getResult(GT_Recipe_AssemblyLine recipe) { + if ((recipe == null) != recipeNull) + throw new IllegalArgumentException("This result type does not allow given input"); + return new LookupResult(recipe, this); + } + } + + public static class LookupResult { + private final GT_Recipe_AssemblyLine recipe; + private final LookupResultType type; + + LookupResult(GT_Recipe_AssemblyLine recipe, LookupResultType type) { + this.recipe = recipe; + this.type = type; + } + + public GT_Recipe_AssemblyLine getRecipe() { + return recipe; + } + + public LookupResultType getType() { + return type; + } + } } 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 fa838abec1..15d11cda63 100644 --- a/src/main/java/gregtech/api/util/GT_Assemblyline_Server.java +++ b/src/main/java/gregtech/api/util/GT_Assemblyline_Server.java @@ -1,345 +1,415 @@ package gregtech.api.util; -import java.io.File; -import java.util.HashMap; -import java.util.LinkedHashMap; -import java.util.Map; - import cpw.mods.fml.common.event.FMLPreInitializationEvent; import gregtech.api.GregTech_API; import gregtech.api.enums.Materials; import gregtech.api.enums.MaterialsBotania; +import java.io.File; +import java.util.HashMap; +import java.util.LinkedHashMap; +import java.util.Map; import net.minecraftforge.common.config.ConfigCategory; import net.minecraftforge.common.config.Configuration; import net.minecraftforge.common.config.Property; public class GT_Assemblyline_Server { + public static LinkedHashMap<String, String> lServerNames = new LinkedHashMap<String, String>(); + private static LinkedHashMap<String, String> internal2 = new LinkedHashMap<String, String>(), + internal3 = new LinkedHashMap<String, String>(), + internal4 = new LinkedHashMap<String, String>(); + private static HashMap<String, Property> internal = new HashMap<String, Property>(); - public static LinkedHashMap<String, String> lServerNames = new LinkedHashMap<String, String>(); - private static LinkedHashMap<String, String> internal2 = new LinkedHashMap<String, String>(), internal3 = new LinkedHashMap<String, String>(), internal4 = new LinkedHashMap<String, String>(); - private static HashMap<String, Property> internal = new HashMap<String, Property>(); - - public static void fillMap(FMLPreInitializationEvent aEvent) { + public static void fillMap(FMLPreInitializationEvent aEvent) { - 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 = ""; - Configuration conf = new Configuration(f); + 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 = ""; + Configuration conf = new Configuration(f); - ConfigCategory cat = conf.getCategory("languagefile"); - internal.putAll(cat.getValues()); - for (Map.Entry<String, Property> entry : internal.entrySet()) { - try { - s = entry.getValue().getString().replaceAll("%", ""); + ConfigCategory cat = conf.getCategory("languagefile"); + internal.putAll(cat.getValues()); + for (Map.Entry<String, Property> entry : internal.entrySet()) { + try { + 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")) - internal3.put(entry.getKey(), s); - 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); - } catch (Exception ignored) { - } - } - for (Map.Entry<String, String> entry : internal2.entrySet()) { - try { - if (entry.getKey().contains("name")) { - int i = Integer.parseInt(entry.getKey().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())); - 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(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")) { - int i = Integer.parseInt(entry.getKey().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())); - 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 + 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"))) + && s.contains("material")) internal4.put(entry.getKey(), s); + else lServerNames.put(entry.getKey(), s); + } catch (Exception ignored) { + } + } + for (Map.Entry<String, String> entry : internal2.entrySet()) { + try { + if (entry.getKey().contains("name")) { + int i = Integer.parseInt(entry.getKey() + .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())); + 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( + 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")) { + int i = Integer.parseInt(entry.getKey() + .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())); + 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; - 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) { - } - } + 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) { + } + } - internal = null; - internal2 = null; - internal3 = null; - internal4 = null; - } + internal = null; + internal2 = null; + internal3 = null; + internal4 = null; + } } diff --git a/src/main/java/gregtech/api/util/GT_BaseCrop.java b/src/main/java/gregtech/api/util/GT_BaseCrop.java index 97f8db0547..930badfdba 100644 --- a/src/main/java/gregtech/api/util/GT_BaseCrop.java +++ b/src/main/java/gregtech/api/util/GT_BaseCrop.java @@ -1,5 +1,7 @@ package gregtech.api.util; +import static gregtech.api.enums.GT_Values.E; + import cpw.mods.fml.common.Loader; import gregtech.GT_Mod; import gregtech.api.GregTech_API; @@ -12,6 +14,8 @@ import gregtech.common.blocks.GT_TileEntity_Ores; import ic2.api.crops.CropCard; import ic2.api.crops.Crops; import ic2.api.crops.ICropTile; +import java.util.ArrayList; +import java.util.List; import net.minecraft.block.Block; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.player.EntityPlayerMP; @@ -19,15 +23,15 @@ import net.minecraft.item.ItemStack; import net.minecraft.tileentity.TileEntity; import speiger.src.crops.api.ICropCardInfo; -import java.util.ArrayList; -import java.util.List; - -import static gregtech.api.enums.GT_Values.E; - public class GT_BaseCrop extends CropCard implements ICropCardInfo { public static ArrayList<GT_BaseCrop> sCropList = new ArrayList<GT_BaseCrop>(); private String mName = E, mDiscoveredBy = "Gregorius Techneticies", mAttributes[]; - private int mTier = 0, mMaxSize = 0, mAfterHarvestSize = 0, mHarvestSize = 0, mStats[] = new int[5], mGrowthSpeed = 0; + private int mTier = 0, + mMaxSize = 0, + mAfterHarvestSize = 0, + mHarvestSize = 0, + mStats[] = new int[5], + mGrowthSpeed = 0; private ItemStack mDrop = null, mSpecialDrops[] = null; private Materials mBlock = null; private static boolean bIc2NeiLoaded = Loader.isModLoaded("Ic2Nei"); @@ -45,8 +49,43 @@ public class GT_BaseCrop extends CropCard implements ICropCardInfo { * @param aGrowthSpeed how fast the Crop grows. if < 0 then its set to Tier*300 * @param aHarvestSize the size the Crop needs to be harvested. forced to be between 2 and max size */ - public GT_BaseCrop(int aID, String aCropName, String aDiscoveredBy, ItemStack aBaseSeed, int aTier, int aMaxSize, int aGrowthSpeed, int aAfterHarvestSize, int aHarvestSize, int aStatChemical, int aStatFood, int aStatDefensive, int aStatColor, int aStatWeed, String[] aAttributes, ItemStack aDrop, ItemStack[] aSpecialDrops) { - new GT_BaseCrop(aID, aCropName, aDiscoveredBy, aBaseSeed, aTier, aMaxSize, aGrowthSpeed, aAfterHarvestSize, aHarvestSize, aStatChemical, aStatFood, aStatDefensive, aStatColor, aStatWeed, aAttributes, null, aDrop, aSpecialDrops); + public GT_BaseCrop( + int aID, + String aCropName, + String aDiscoveredBy, + ItemStack aBaseSeed, + int aTier, + int aMaxSize, + int aGrowthSpeed, + int aAfterHarvestSize, + int aHarvestSize, + int aStatChemical, + int aStatFood, + int aStatDefensive, + int aStatColor, + int aStatWeed, + String[] aAttributes, + ItemStack aDrop, + ItemStack[] aSpecialDrops) { + new GT_BaseCrop( + aID, + aCropName, + aDiscoveredBy, + aBaseSeed, + aTier, + aMaxSize, + aGrowthSpeed, + aAfterHarvestSize, + aHarvestSize, + aStatChemical, + aStatFood, + aStatDefensive, + aStatColor, + aStatWeed, + aAttributes, + null, + aDrop, + aSpecialDrops); } /** @@ -63,7 +102,25 @@ public class GT_BaseCrop extends CropCard implements ICropCardInfo { * @param aHarvestSize the size the Crop needs to be harvested. forced to be between 2 and max size * @param aBlock the block below needed for crop to grow. If null no block needed */ - public GT_BaseCrop(int aID, String aCropName, String aDiscoveredBy, ItemStack aBaseSeed, int aTier, int aMaxSize, int aGrowthSpeed, int aAfterHarvestSize, int aHarvestSize, int aStatChemical, int aStatFood, int aStatDefensive, int aStatColor, int aStatWeed, String[] aAttributes, Materials aBlock, ItemStack aDrop, ItemStack[] aSpecialDrops) { + public GT_BaseCrop( + int aID, + String aCropName, + String aDiscoveredBy, + ItemStack aBaseSeed, + int aTier, + int aMaxSize, + int aGrowthSpeed, + int aAfterHarvestSize, + int aHarvestSize, + int aStatChemical, + int aStatFood, + int aStatDefensive, + int aStatColor, + int aStatWeed, + String[] aAttributes, + Materials aBlock, + ItemStack aDrop, + ItemStack[] aSpecialDrops) { mName = aCropName; aID = GT_Config.addIDConfig(ConfigCategories.IDs.crops, mName.replaceAll(" ", "_"), aID); if (aDiscoveredBy != null && !aDiscoveredBy.equals(E)) mDiscoveredBy = aDiscoveredBy; @@ -81,15 +138,21 @@ public class GT_BaseCrop extends CropCard implements ICropCardInfo { mStats[4] = aStatWeed; mAttributes = aAttributes; mBlock = aBlock; - if(GregTech_API.sRecipeFile.get(ConfigCategories.Recipes.crops, aCropName, true)){ - if (!Crops.instance.registerCrop(this, aID)) - throw new GT_ItsNotMyFaultException("Make sure the Crop ID is valid!"); - if (aBaseSeed != null) Crops.instance.registerBaseSeed(aBaseSeed, this, 1, 1, 1, 1); - sCropList.add(this);} + if (GregTech_API.sRecipeFile.get(ConfigCategories.Recipes.crops, aCropName, true)) { + if (!Crops.instance.registerCrop(this, aID)) + throw new GT_ItsNotMyFaultException("Make sure the Crop ID is valid!"); + if (aBaseSeed != null) Crops.instance.registerBaseSeed(aBaseSeed, this, 1, 1, 1, 1); + sCropList.add(this); + } } 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); + 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); } catch (IllegalAccessException ex) { bIc2NeiLoaded = false; } catch (IllegalArgumentException ex) { @@ -176,7 +239,10 @@ 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); @@ -198,11 +264,15 @@ public class GT_BaseCrop extends CropCard implements ICropCardInfo { return false; } for (int i = 1; i < this.getrootslength(aCrop); i++) { - Block tBlock = aCrop.getWorld().getBlock(aCrop.getLocation().posX, aCrop.getLocation().posY - i, aCrop.getLocation().posZ); + Block tBlock = aCrop.getWorld() + .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)]; + Materials tMaterial = + GregTech_API.sGeneratedMaterials[(((GT_TileEntity_Ores) tTileEntity).mMetaData % 1000)]; if ((tMaterial != null) && (tMaterial != Materials._NULL)) { if (tMaterial == mBlock) { return true; @@ -212,24 +282,33 @@ 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")) && (tAssotiation.mMaterial.mMaterial == mBlock)) { + if ((tAssotiation != null) + && (tAssotiation.mPrefix.toString().startsWith("ore")) + && (tAssotiation.mMaterial.mMaterial == mBlock)) { return true; } - if ((tAssotiation != null) && (tAssotiation.mPrefix == OrePrefixes.block) && (tAssotiation.mMaterial.mMaterial == mBlock)) { + if ((tAssotiation != null) + && (tAssotiation.mPrefix == OrePrefixes.block) + && (tAssotiation.mMaterial.mMaterial == mBlock)) { return true; } } -// Block block = aCrop.getWorld().getBlock(aCrop.getLocation().posX, aCrop.getLocation().posY - i, aCrop.getLocation().posZ); -// if (block.isAir(aCrop.getWorld(), aCrop.getLocation().posX, aCrop.getLocation().posY - i, aCrop.getLocation().posZ)) { -// return false; -// } -// if (block == mBlock) { -// int tMeta = aCrop.getWorld().getBlockMetadata(aCrop.getLocation().posX, aCrop.getLocation().posY - i, aCrop.getLocation().posZ); -// if(mMeta < 0 || tMeta == mMeta){ -// return true;} -// } + // Block block = aCrop.getWorld().getBlock(aCrop.getLocation().posX, aCrop.getLocation().posY - i, + // aCrop.getLocation().posZ); + // if (block.isAir(aCrop.getWorld(), aCrop.getLocation().posX, aCrop.getLocation().posY - i, + // aCrop.getLocation().posZ)) { + // return false; + // } + // if (block == mBlock) { + // int tMeta = aCrop.getWorld().getBlockMetadata(aCrop.getLocation().posX, aCrop.getLocation().posY - + // i, aCrop.getLocation().posZ); + // if(mMeta < 0 || tMeta == mMeta){ + // return true;} + // } } return false; } @@ -238,7 +317,8 @@ public class GT_BaseCrop extends CropCard implements ICropCardInfo { public List<String> getCropInformation() { if (mBlock != null) { ArrayList<String> result = new ArrayList<String>(1); - result.add(String.format("Requires %s Ore or Block of %s as soil block to reach full growth.", mBlock.mName, mBlock.mName)); + result.add(String.format( + "Requires %s Ore or Block of %s as soil block to reach full growth.", mBlock.mName, mBlock.mName)); return result; } return null; @@ -251,5 +331,4 @@ public class GT_BaseCrop extends CropCard implements ICropCardInfo { } return GT_Utility.copyOrNull(mDrop); } - } diff --git a/src/main/java/gregtech/api/util/GT_BlockMap.java b/src/main/java/gregtech/api/util/GT_BlockMap.java index cd98aae2bd..9b71abbdc3 100644 --- a/src/main/java/gregtech/api/util/GT_BlockMap.java +++ b/src/main/java/gregtech/api/util/GT_BlockMap.java @@ -2,132 +2,131 @@ package gregtech.api.util; import gnu.trove.map.TByteObjectMap; import gnu.trove.map.hash.TByteObjectHashMap; -import net.minecraft.block.Block; - import java.util.HashMap; import java.util.Map; import java.util.function.BiFunction; +import net.minecraft.block.Block; public class GT_BlockMap<V> { - public static final byte WILDCARD = -1; - private final Map<Block, TByteObjectMap<V>> backing = new HashMap<>(); - private int size = 0; + public static final byte WILDCARD = -1; + private final Map<Block, TByteObjectMap<V>> backing = new HashMap<>(); + private int size = 0; - private TByteObjectMap<V> getSubmap(Block block) { - return backing.computeIfAbsent(block, b -> new TByteObjectHashMap<>()); - } + private TByteObjectMap<V> getSubmap(Block block) { + return backing.computeIfAbsent(block, b -> new TByteObjectHashMap<>()); + } - /** - * Associate a value with that union key - * - * @param block block - * @param meta meta - * @return old mapping, or null if that doesn't exist - */ - public V put(Block block, byte meta, V value) { - V v = getSubmap(block).put(meta, value); - if (v == null) size++; - return v; - } + /** + * Associate a value with that union key + * + * @param block block + * @param meta meta + * @return old mapping, or null if that doesn't exist + */ + public V put(Block block, byte meta, V value) { + V v = getSubmap(block).put(meta, value); + if (v == null) size++; + return v; + } - /** - * Associate a value with that union key ONLY IF there isn't a prior EXACT mapping - * - * @param block block - * @param meta meta - * @return old mapping, or null if that doesn't exist - */ - public V putIfAbsent(Block block, byte meta, V value) { - V v = getSubmap(block).putIfAbsent(meta, value); - if (v == null) size++; - return v; - } + /** + * Associate a value with that union key ONLY IF there isn't a prior EXACT mapping + * + * @param block block + * @param meta meta + * @return old mapping, or null if that doesn't exist + */ + public V putIfAbsent(Block block, byte meta, V value) { + V v = getSubmap(block).putIfAbsent(meta, value); + if (v == null) size++; + return v; + } - /** - * Associate a value with that union key ONLY IF there isn't a prior EXACT mapping - * - * @param block block - * @param meta meta - * @return old mapping, or null if that doesn't exist - */ - public V computeIfAbsent(Block block, byte meta, BiFunction<Block, Byte, V> function) { - TByteObjectMap<V> submap = getSubmap(block); - V v = submap.get(meta); - if (v == null) { - v = function.apply(block, meta); - submap.put(meta, v); - size++; - } - return v; - } + /** + * Associate a value with that union key ONLY IF there isn't a prior EXACT mapping + * + * @param block block + * @param meta meta + * @return old mapping, or null if that doesn't exist + */ + public V computeIfAbsent(Block block, byte meta, BiFunction<Block, Byte, V> function) { + TByteObjectMap<V> submap = getSubmap(block); + V v = submap.get(meta); + if (v == null) { + v = function.apply(block, meta); + submap.put(meta, v); + size++; + } + return v; + } - /** - * Contains an associated value - * - * @param block block - * @param meta meta - * @return current mapping OR wildcard of that mapping exists - */ - public boolean containsKey(Block block, byte meta) { - TByteObjectMap<V> submap = backing.get(block); - if (submap == null) return false; - return submap.containsKey(meta) || submap.containsKey(WILDCARD); - } + /** + * Contains an associated value + * + * @param block block + * @param meta meta + * @return current mapping OR wildcard of that mapping exists + */ + public boolean containsKey(Block block, byte meta) { + TByteObjectMap<V> submap = backing.get(block); + if (submap == null) return false; + return submap.containsKey(meta) || submap.containsKey(WILDCARD); + } - /** - * Get the associated value - * - * @param block block - * @param meta meta - * @return current mapping OR wildcard of that block. null if neither exists - */ - public V get(Block block, byte meta) { - TByteObjectMap<V> submap = backing.get(block); - if (submap == null) return null; - V v = submap.get(meta); - if (v != null) return v; - return submap.get(WILDCARD); - } + /** + * Get the associated value + * + * @param block block + * @param meta meta + * @return current mapping OR wildcard of that block. null if neither exists + */ + public V get(Block block, byte meta) { + TByteObjectMap<V> submap = backing.get(block); + if (submap == null) return null; + V v = submap.get(meta); + if (v != null) return v; + return submap.get(WILDCARD); + } - /** - * Remove a mapping - * - * @param block block - * @param meta meta - * @return old value, or null if none - */ - public V remove(Block block, byte meta) { - TByteObjectMap<V> submap = backing.get(block); - if (submap == null) return null; - V v = submap.remove(meta); - if (v != null) { - size--; - if (submap.isEmpty()) backing.remove(block); - } - return v; - } + /** + * Remove a mapping + * + * @param block block + * @param meta meta + * @return old value, or null if none + */ + public V remove(Block block, byte meta) { + TByteObjectMap<V> submap = backing.get(block); + if (submap == null) return null; + V v = submap.remove(meta); + if (v != null) { + size--; + if (submap.isEmpty()) backing.remove(block); + } + return v; + } - /** - * Size of all mappings - * - * @return size - */ - public int size() { - return size; - } + /** + * Size of all mappings + * + * @return size + */ + public int size() { + return size; + } - @Override - public boolean equals(Object o) { - if (this == o) return true; - if (o == null || getClass() != o.getClass()) return false; + @Override + public boolean equals(Object o) { + if (this == o) return true; + if (o == null || getClass() != o.getClass()) return false; - GT_BlockMap<?> that = (GT_BlockMap<?>) o; + GT_BlockMap<?> that = (GT_BlockMap<?>) o; - return backing.equals(that.backing); - } + return backing.equals(that.backing); + } - @Override - public int hashCode() { - return backing.hashCode(); - } + @Override + public int hashCode() { + return backing.hashCode(); + } } diff --git a/src/main/java/gregtech/api/util/GT_BlockSet.java b/src/main/java/gregtech/api/util/GT_BlockSet.java index 3c9905a757..94f3c3944a 100644 --- a/src/main/java/gregtech/api/util/GT_BlockSet.java +++ b/src/main/java/gregtech/api/util/GT_BlockSet.java @@ -3,36 +3,36 @@ package gregtech.api.util; import net.minecraft.block.Block; public class GT_BlockSet { - private final GT_BlockMap<Object> backing = new GT_BlockMap<>(); + private final GT_BlockMap<Object> backing = new GT_BlockMap<>(); - public boolean add(Block block, byte meta) { - return backing.put(block, meta, this) != this; - } + public boolean add(Block block, byte meta) { + return backing.put(block, meta, this) != this; + } - public boolean contains(Block block, byte meta) { - return backing.get(block, meta) == this; - } + public boolean contains(Block block, byte meta) { + return backing.get(block, meta) == this; + } - public boolean remove(Block block, byte meta) { - return backing.remove(block, meta) == this; - } + public boolean remove(Block block, byte meta) { + return backing.remove(block, meta) == this; + } - public int size() { - return backing.size(); - } + public int size() { + return backing.size(); + } - @Override - public boolean equals(Object o) { - if (this == o) return true; - if (o == null || getClass() != o.getClass()) return false; + @Override + public boolean equals(Object o) { + if (this == o) return true; + if (o == null || getClass() != o.getClass()) return false; - GT_BlockSet that = (GT_BlockSet) o; + GT_BlockSet that = (GT_BlockSet) o; - return backing.equals(that.backing); - } + return backing.equals(that.backing); + } - @Override - public int hashCode() { - return backing.hashCode(); - } + @Override + public int hashCode() { + return backing.hashCode(); + } } 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 83b292d274..fd01ccd00e 100644 --- a/src/main/java/gregtech/api/util/GT_CLS_Compat.java +++ b/src/main/java/gregtech/api/util/GT_CLS_Compat.java @@ -5,16 +5,14 @@ import gregtech.GT_Mod; import gregtech.api.enums.Materials; import gregtech.common.GT_Proxy; import gregtech.loaders.postload.GT_PostLoad; - import java.lang.reflect.Field; import java.lang.reflect.InvocationTargetException; import java.lang.reflect.Method; import java.util.Collection; import java.util.Optional; import java.util.Set; -import java.util.function.Function; import java.util.function.Consumer; - +import java.util.function.Function; @SuppressWarnings("rawtypes, unchecked, deprecation") public class GT_CLS_Compat { @@ -31,7 +29,7 @@ public class GT_CLS_Compat { private static Field progressBarStep; static { - //CLS + // CLS try { alexiilMinecraftDisplayer = Class.forName("alexiil.mods.load.MinecraftDisplayer"); alexiilProgressDisplayer = Class.forName("alexiil.mods.load.ProgressDisplayer"); @@ -53,7 +51,6 @@ public class GT_CLS_Compat { } catch (NoSuchMethodException | NoSuchFieldException ex) { GT_Mod.GT_FML_LOGGER.catching(ex); } - }); Optional.ofNullable(alexiilProgressDisplayer).ifPresent(e -> { @@ -72,10 +69,14 @@ public class GT_CLS_Compat { } } - private GT_CLS_Compat() { - } + private GT_CLS_Compat() {} - private static <T> void registerAndReportProgression(String materialsType, Collection<T> materials, ProgressManager.ProgressBar progressBar, Function<T,Object> getName, Consumer<T> action) { + private static <T> void registerAndReportProgression( + String materialsType, + Collection<T> materials, + ProgressManager.ProgressBar progressBar, + Function<T, Object> getName, + Consumer<T> action) { int sizeStep = materials.size(); final long progressionReportsEvery = 100; final long bakingMsgEvery = 1000; @@ -90,7 +91,7 @@ public class GT_CLS_Compat { nextProgressionReportAt = now + progressionReportsEvery; String materialName = getName.apply(m).toString(); try { - displayProgress.invoke(null, materialName, (float)currentStep / sizeStep); + displayProgress.invoke(null, materialName, (float) currentStep / sizeStep); } catch (IllegalAccessException | InvocationTargetException iae) { GT_Mod.GT_FML_LOGGER.error("While updating progression", iae); } @@ -103,11 +104,13 @@ public class GT_CLS_Compat { } if (nextBakingMsgAt < now) { nextBakingMsgAt = now + bakingMsgEvery; - GT_Mod.GT_FML_LOGGER.info(String.format("%s - Baking: %d%%", materialsType, (Integer)(currentStep * 100 / sizeStep))); + GT_Mod.GT_FML_LOGGER.info( + String.format("%s - Baking: %d%%", materialsType, (Integer) (currentStep * 100 / sizeStep))); } action.accept(m); currentStep += 1; - }; + } + ; GT_Mod.GT_FML_LOGGER.info(String.format("%s - Baking: Done", materialsType)); try { progressBarStep.set(progressBar, currentStep); @@ -116,35 +119,38 @@ public class GT_CLS_Compat { } } - public static void stepMaterialsCLS(Collection<GT_Proxy.OreDictEventContainer> mEvents, ProgressManager.ProgressBar progressBar) throws IllegalAccessException, InvocationTargetException { + public static void stepMaterialsCLS( + Collection<GT_Proxy.OreDictEventContainer> mEvents, ProgressManager.ProgressBar progressBar) + throws IllegalAccessException, InvocationTargetException { try { isRegisteringGTmaterials.set(null, true); } catch (IllegalArgumentException | IllegalAccessException e) { GT_Mod.GT_FML_LOGGER.catching(e); } - registerAndReportProgression("GregTech materials", mEvents, progressBar, - m -> m.mMaterial, - m -> GT_Proxy.registerRecipes(m) - ); + registerAndReportProgression( + "GregTech materials", mEvents, progressBar, m -> m.mMaterial, m -> GT_Proxy.registerRecipes(m)); ProgressManager.pop(progressBar); isRegisteringGTmaterials.set(null, false); - } + } - public static void doActualRegistrationCLS(ProgressManager.ProgressBar progressBar, Set<Materials> replacedVanillaItemsSet) throws InvocationTargetException, IllegalAccessException { + public static void doActualRegistrationCLS( + ProgressManager.ProgressBar progressBar, Set<Materials> replacedVanillaItemsSet) + throws InvocationTargetException, IllegalAccessException { try { - isReplacingVanillaMaterials.set(null, true); - } catch (IllegalArgumentException | IllegalAccessException e) { + isReplacingVanillaMaterials.set(null, true); + } catch (IllegalArgumentException | IllegalAccessException e) { GT_Mod.GT_FML_LOGGER.catching(e); } - registerAndReportProgression("Vanilla materials", replacedVanillaItemsSet, progressBar, - m -> m.mDefaultLocalName, - m -> GT_PostLoad.doActualRegistration(m) - ); + registerAndReportProgression( + "Vanilla materials", + replacedVanillaItemsSet, + progressBar, + m -> m.mDefaultLocalName, + m -> GT_PostLoad.doActualRegistration(m)); } public static void pushToDisplayProgress() throws InvocationTargetException, IllegalAccessException { isReplacingVanillaMaterials.set(null, false); displayProgress.invoke(null, "Post Initialization: loading GregTech", getLastPercent.invoke(null)); } - } diff --git a/src/main/java/gregtech/api/util/GT_ChunkAssociatedData.java b/src/main/java/gregtech/api/util/GT_ChunkAssociatedData.java index bb589daa80..38b147e318 100644 --- a/src/main/java/gregtech/api/util/GT_ChunkAssociatedData.java +++ b/src/main/java/gregtech/api/util/GT_ChunkAssociatedData.java @@ -3,14 +3,6 @@ package gregtech.api.util; import cpw.mods.fml.common.eventhandler.SubscribeEvent; import gregtech.api.enums.GT_Values; import gregtech.api.interfaces.tileentity.IGregTechTileEntity; -import net.minecraft.world.ChunkCoordIntPair; -import net.minecraft.world.World; -import net.minecraft.world.chunk.Chunk; -import net.minecraftforge.common.MinecraftForge; -import net.minecraftforge.event.world.WorldEvent; -import org.apache.commons.io.FileUtils; - -import javax.annotation.ParametersAreNonnullByDefault; import java.io.DataInput; import java.io.DataInputStream; import java.io.DataOutput; @@ -36,6 +28,13 @@ import java.util.regex.Matcher; import java.util.regex.Pattern; import java.util.stream.Collectors; import java.util.stream.Stream; +import javax.annotation.ParametersAreNonnullByDefault; +import net.minecraft.world.ChunkCoordIntPair; +import net.minecraft.world.World; +import net.minecraft.world.chunk.Chunk; +import net.minecraftforge.common.MinecraftForge; +import net.minecraftforge.event.world.WorldEvent; +import org.apache.commons.io.FileUtils; /** * A utility to save all kinds of data that is a function of any chunk. @@ -57,400 +56,413 @@ import java.util.stream.Stream; */ @ParametersAreNonnullByDefault 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 ExecutorService IO_WORKERS = Executors.newWorkStealingPool(IO_PARALLELISM); - private static final Pattern FILE_PATTERN = Pattern.compile("(.+)\\.(-?\\d+)\\.(-?\\d+)\\.dat"); - - static { - // register event handler - new EventHandler(); - } - - protected final String mId; - protected final Class<T> elementtype; - private final int regionLength; - private final int version; - private final boolean saveDefaults; - /** - * Data is stored as a `(world id -> (super region id -> super region data))` hash map. - * where super region's size is determined by regionSize. - * Here it is called super region, to not confuse with vanilla's regions. - */ - private final Map<Integer, Map<ChunkCoordIntPair, SuperRegion>> masterMap = new ConcurrentHashMap<>(); - - /** - * Initialize this instance. - * - * @param aId An arbitrary, but globally unique identifier for what this data is - * @param elementType The class of this element type. Used to create arrays. - * @param regionLength The length of one super region. Each super region will contain {@code regionLength * regionLength} chunks - * @param version An integer marking the version of this data. Useful later when the data's serialized form changed. - */ - protected GT_ChunkAssociatedData(String aId, Class<T> elementType, int regionLength, byte version, boolean saveDefaults) { - if (regionLength * regionLength > Short.MAX_VALUE || regionLength <= 0) - throw new IllegalArgumentException("Region invalid: " + regionLength); - if (!IData.class.isAssignableFrom(elementType)) - throw new IllegalArgumentException("Data type invalid"); - if (aId.contains(".")) - throw new IllegalArgumentException("ID cannot contains dot"); - this.mId = aId; - this.elementtype = elementType; - this.regionLength = regionLength; - this.version = version; - this.saveDefaults = saveDefaults; - if (instances.putIfAbsent(aId, this) != null) - throw new IllegalArgumentException("Duplicate GT_ChunkAssociatedData: " + aId); - } - - private ChunkCoordIntPair getRegionID(int aChunkX, int aChunkZ) { - return new ChunkCoordIntPair(Math.floorDiv(aChunkX, regionLength), Math.floorDiv(aChunkZ, regionLength)); - } - - /** - * Get a reference to data of the chunk that tile entity is in. - * The returned reference should be mutable. - */ - public final T get(IGregTechTileEntity tileEntity) { - return get(tileEntity.getWorld(), tileEntity.getXCoord() >> 4, tileEntity.getZCoord() >> 4); - } - - public final T get(Chunk chunk) { - return get(chunk.worldObj, chunk.xPosition, chunk.zPosition); - } - - public final T get(World world, ChunkCoordIntPair coord) { - return get(world, coord.chunkXPos, coord.chunkZPos); - } - - 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)); - 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)); - region.set(Math.floorMod(chunkX, regionLength), Math.floorMod(chunkZ, regionLength), data); - } - - protected final boolean isCreated(int dimId, int chunkX, int chunkZ) { - Map<ChunkCoordIntPair, SuperRegion> dimData = masterMap.getOrDefault(dimId, null); - if (dimData == null) return false; - - SuperRegion region = dimData.getOrDefault(getRegionID(chunkX, chunkZ), null); - if (region == null) return false; - - return region.isCreated(Math.floorMod(chunkX, regionLength), Math.floorMod(chunkZ, regionLength)); - } - - public void clear() { - if (GT_Values.debugWorldData) { - 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!"); - } - masterMap.clear(); - } - - public void save() { - 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()); - } - - 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); - } - }); - } - - protected abstract void writeElement(DataOutput output, T element, World world, int chunkX, int chunkZ) throws IOException; - - protected abstract T readElement(DataInput input, int version, World world, int chunkX, int chunkZ) throws IOException; - - protected abstract T createElement(World world, int chunkX, int chunkZ); - - /** - * Clear all mappings, regardless of whether they are dirty - */ - public static void clearAll() { - for (GT_ChunkAssociatedData<?> d : instances.values()) d.clear(); - } - - /** - * Save all mappings - */ - public static void saveAll() { - for (GT_ChunkAssociatedData<?> d : instances.values()) d.save(); - } - - /** - * Load data for all chunks for a given world. - * Current data for that world will be discarded. If this is what you intended, call {@link #save(World)} beforehand. - * <p> - * Be aware of the memory consumption though. - */ - protected void loadAll(World w) { - if (GT_Values.debugWorldData && masterMap.containsKey(w.provider.dimensionId)) - GT_Log.err.println("Reloading ChunkAssociatedData " + mId + " for world " + w.provider.dimensionId + " discards old data!"); - if (!getSaveDirectory(w).isDirectory()) - // nothing to load... - return; - try { - Map<ChunkCoordIntPair, SuperRegion> worldData = Files.list(getSaveDirectory(w).toPath()) - .map(f -> { - 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())); - masterMap.put(w.provider.dimensionId, worldData); - } catch (IOException e) { - GT_Log.err.println("Error loading all region"); - e.printStackTrace(GT_Log.err); - } - } - - 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()); - return new File(base, "gregtech"); - } - - public interface IData { - /** - * @return Whether the data is different from chunk default - */ - boolean isSameAsDefault(); - } - - protected final class SuperRegion { - private final T[] data = createData(); - private final File backingStorage; - private final WeakReference<World> world; - /** - * Be aware, this means region coord, not bottom-left chunk coord - */ - private final ChunkCoordIntPair coord; - - private SuperRegion(World world, int regionX, int regionZ) { - this.world = new WeakReference<>(world); - this.coord = new ChunkCoordIntPair(regionX, regionZ); - backingStorage = new File(getSaveDirectory(world), String.format("%s.%d.%d.dat", mId, regionX, regionZ)); - if (backingStorage.isFile()) - load(); - } - - private SuperRegion(World world, ChunkCoordIntPair regionCoord) { - this.world = new WeakReference<>(world); - this.coord = regionCoord; - backingStorage = new File(getSaveDirectory(world), String.format("%s.%d.%d.dat", mId, regionCoord.chunkXPos, regionCoord.chunkZPos)); - if (backingStorage.isFile()) - load(); - } - - @SuppressWarnings("unchecked") - private T[] createData() { - return (T[]) Array.newInstance(elementtype, regionLength * regionLength); - } - - public T get(int subRegionX, int subRegionZ) { - int index = getIndex(subRegionX, subRegionZ); - T datum = data[index]; - if (datum == null) { - World world = Objects.requireNonNull(this.world.get()); - T newElem = createElement(world, coord.chunkXPos * regionLength + subRegionX, coord.chunkZPos * regionLength + subRegionZ); - data[index] = newElem; - return newElem; - } - return datum; - } - - public void set(int subRegionX, int subRegionZ, T data) { - this.data[getIndex(subRegionX, subRegionZ)] = data; - } - - public boolean isCreated(int subRegionX, int subRegionZ) { - return this.data[getIndex(subRegionX, subRegionZ)] != null; - } - - public ChunkCoordIntPair getCoord() { - return coord; - } - - private int getIndex(int subRegionX, int subRegionY) { - return subRegionX * regionLength + subRegionY; - } - - private int getChunkX(int index) { - return index / regionLength + coord.chunkXPos * regionLength; - } - - private int getChunkZ(int index) { - return index % regionLength + coord.chunkZPos * regionLength; - } - - public boolean isDirty() { - for (T datum : data) { - if (datum != null && !datum.isSameAsDefault()) - return true; - } - return false; - } - - public void save() { - try { - save0(); - } catch (IOException e) { - GT_Log.err.println("Error saving data " + backingStorage.getPath()); - e.printStackTrace(GT_Log.err); - } - } - - private void save0() throws IOException { - //noinspection ResultOfMethodCallIgnored - 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))) { - int ptr = 0; - boolean nullRange = data[0] == null; - // write a magic byte as storage format version - output.writeByte(0); - // write a magic byte as data format version - output.writeByte(version); - output.writeBoolean(nullRange); - while (ptr < data.length) { - // work out how long is this range - int rangeStart = ptr; - while (ptr < data.length && (data[ptr] == null || (!saveDefaults && data[ptr].isSameAsDefault())) == nullRange) - ptr++; - // write range length - output.writeShort(ptr - rangeStart); - if (!nullRange) - // write element data - for (int i = rangeStart; i < ptr; i++) - writeElement(output, data[i], world, getChunkX(ptr), getChunkZ(ptr)); - // or not - nullRange = !nullRange; - } - } - // first try to replace the destination file - // since atomic operation, no need to keep the backup in place - try { - Files.move(tmpFile.toPath(), backingStorage.toPath(), StandardCopyOption.REPLACE_EXISTING, StandardCopyOption.ATOMIC_MOVE); - } catch (AtomicMoveNotSupportedException ignored) { - // in case some dumb system/jre combination would cause this - // or if **somehow** two file inside the same directory belongs two separate filesystem - FileUtils.copyFile(tmpFile, backingStorage); - } - } - - public void load() { - try { - loadFromFile(backingStorage); - } catch (IOException | RuntimeException e) { - GT_Log.err.println("Primary storage file broken in " + backingStorage.getPath()); - e.printStackTrace(GT_Log.err); - // in case the primary storage is broken - try { - loadFromFile(getTmpFile()); - } catch (IOException | RuntimeException e2) { - GT_Log.err.println("Backup storage file broken in " + backingStorage.getPath()); - e2.printStackTrace(GT_Log.err); - } - } - } - - private void loadFromFile(File file) throws IOException { - World world = Objects.requireNonNull(this.world.get(), "Attempting to load region of another world!"); - try (DataInputStream input = new DataInputStream(new FileInputStream(file))) { - byte b = input.readByte(); - switch (b) { - case 0: - loadV0(input, world); - break; - default: - GT_Log.err.printf("Unknown ChunkAssociatedData version %d\n", b); - } - } - } - - private void loadV0(DataInput input, World world) throws IOException { - int version = input.readByte(); - boolean nullRange = input.readBoolean(); - int ptr = 0; - while (ptr != data.length) { - int rangeEnd = ptr + input.readUnsignedShort(); - if (!nullRange) { - for (; ptr < rangeEnd; ptr++) { - data[ptr] = readElement(input, version, world, getChunkX(ptr), getChunkZ(ptr)); - } - } else { - Arrays.fill(data, ptr, rangeEnd, null); - ptr = rangeEnd; - } - nullRange = !nullRange; - } - } - - private File getTmpFile() { - return new File(backingStorage.getParentFile(), backingStorage.getName() + ".tmp"); - } - } - - public static class EventHandler { - private EventHandler() { - MinecraftForge.EVENT_BUS.register(this); - } - - @SubscribeEvent - public void onWorldSave(WorldEvent.Save e) { - for (GT_ChunkAssociatedData<?> d : instances.values()) { - d.save(e.world); - } - } - - @SubscribeEvent - public void onWorldUnload(WorldEvent.Unload e) { - for (GT_ChunkAssociatedData<?> d : instances.values()) { - // there is no need to explicitly do a save here - // forge will send a WorldEvent.Save on server thread before this event is distributed - d.masterMap.remove(e.world.provider.dimensionId); - } - } - } + 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 ExecutorService IO_WORKERS = Executors.newWorkStealingPool(IO_PARALLELISM); + private static final Pattern FILE_PATTERN = Pattern.compile("(.+)\\.(-?\\d+)\\.(-?\\d+)\\.dat"); + + static { + // register event handler + new EventHandler(); + } + + protected final String mId; + protected final Class<T> elementtype; + private final int regionLength; + private final int version; + private final boolean saveDefaults; + /** + * Data is stored as a `(world id -> (super region id -> super region data))` hash map. + * where super region's size is determined by regionSize. + * Here it is called super region, to not confuse with vanilla's regions. + */ + private final Map<Integer, Map<ChunkCoordIntPair, SuperRegion>> masterMap = new ConcurrentHashMap<>(); + + /** + * Initialize this instance. + * + * @param aId An arbitrary, but globally unique identifier for what this data is + * @param elementType The class of this element type. Used to create arrays. + * @param regionLength The length of one super region. Each super region will contain {@code regionLength * regionLength} chunks + * @param version An integer marking the version of this data. Useful later when the data's serialized form changed. + */ + protected GT_ChunkAssociatedData( + String aId, Class<T> elementType, int regionLength, byte version, boolean saveDefaults) { + if (regionLength * regionLength > Short.MAX_VALUE || regionLength <= 0) + throw new IllegalArgumentException("Region invalid: " + regionLength); + if (!IData.class.isAssignableFrom(elementType)) throw new IllegalArgumentException("Data type invalid"); + if (aId.contains(".")) throw new IllegalArgumentException("ID cannot contains dot"); + this.mId = aId; + this.elementtype = elementType; + this.regionLength = regionLength; + this.version = version; + this.saveDefaults = saveDefaults; + if (instances.putIfAbsent(aId, this) != null) + throw new IllegalArgumentException("Duplicate GT_ChunkAssociatedData: " + aId); + } + + private ChunkCoordIntPair getRegionID(int aChunkX, int aChunkZ) { + return new ChunkCoordIntPair(Math.floorDiv(aChunkX, regionLength), Math.floorDiv(aChunkZ, regionLength)); + } + + /** + * Get a reference to data of the chunk that tile entity is in. + * The returned reference should be mutable. + */ + public final T get(IGregTechTileEntity tileEntity) { + return get(tileEntity.getWorld(), tileEntity.getXCoord() >> 4, tileEntity.getZCoord() >> 4); + } + + public final T get(Chunk chunk) { + return get(chunk.worldObj, chunk.xPosition, chunk.zPosition); + } + + public final T get(World world, ChunkCoordIntPair coord) { + return get(world, coord.chunkXPos, coord.chunkZPos); + } + + 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)); + 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)); + region.set(Math.floorMod(chunkX, regionLength), Math.floorMod(chunkZ, regionLength), data); + } + + protected final boolean isCreated(int dimId, int chunkX, int chunkZ) { + Map<ChunkCoordIntPair, SuperRegion> dimData = masterMap.getOrDefault(dimId, null); + if (dimData == null) return false; + + SuperRegion region = dimData.getOrDefault(getRegionID(chunkX, chunkZ), null); + if (region == null) return false; + + return region.isCreated(Math.floorMod(chunkX, regionLength), Math.floorMod(chunkZ, regionLength)); + } + + public void clear() { + if (GT_Values.debugWorldData) { + 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!"); + } + masterMap.clear(); + } + + public void save() { + 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()); + } + + 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); + } + }); + } + + protected abstract void writeElement(DataOutput output, T element, World world, int chunkX, int chunkZ) + throws IOException; + + protected abstract T readElement(DataInput input, int version, World world, int chunkX, int chunkZ) + throws IOException; + + protected abstract T createElement(World world, int chunkX, int chunkZ); + + /** + * Clear all mappings, regardless of whether they are dirty + */ + public static void clearAll() { + for (GT_ChunkAssociatedData<?> d : instances.values()) d.clear(); + } + + /** + * Save all mappings + */ + public static void saveAll() { + for (GT_ChunkAssociatedData<?> d : instances.values()) d.save(); + } + + /** + * Load data for all chunks for a given world. + * Current data for that world will be discarded. If this is what you intended, call {@link #save(World)} beforehand. + * <p> + * Be aware of the memory consumption though. + */ + protected void loadAll(World w) { + if (GT_Values.debugWorldData && masterMap.containsKey(w.provider.dimensionId)) + GT_Log.err.println("Reloading ChunkAssociatedData " + mId + " for world " + w.provider.dimensionId + + " discards old data!"); + if (!getSaveDirectory(w).isDirectory()) + // nothing to load... + return; + try { + Map<ChunkCoordIntPair, SuperRegion> worldData = Files.list( + getSaveDirectory(w).toPath()) + .map(f -> { + 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())); + masterMap.put(w.provider.dimensionId, worldData); + } catch (IOException e) { + GT_Log.err.println("Error loading all region"); + e.printStackTrace(GT_Log.err); + } + } + + 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()); + return new File(base, "gregtech"); + } + + public interface IData { + /** + * @return Whether the data is different from chunk default + */ + boolean isSameAsDefault(); + } + + protected final class SuperRegion { + private final T[] data = createData(); + private final File backingStorage; + private final WeakReference<World> world; + /** + * Be aware, this means region coord, not bottom-left chunk coord + */ + private final ChunkCoordIntPair coord; + + private SuperRegion(World world, int regionX, int regionZ) { + this.world = new WeakReference<>(world); + this.coord = new ChunkCoordIntPair(regionX, regionZ); + backingStorage = new File(getSaveDirectory(world), String.format("%s.%d.%d.dat", mId, regionX, regionZ)); + if (backingStorage.isFile()) load(); + } + + private SuperRegion(World world, ChunkCoordIntPair regionCoord) { + this.world = new WeakReference<>(world); + this.coord = regionCoord; + backingStorage = new File( + getSaveDirectory(world), + String.format("%s.%d.%d.dat", mId, regionCoord.chunkXPos, regionCoord.chunkZPos)); + if (backingStorage.isFile()) load(); + } + + @SuppressWarnings("unchecked") + private T[] createData() { + return (T[]) Array.newInstance(elementtype, regionLength * regionLength); + } + + public T get(int subRegionX, int subRegionZ) { + int index = getIndex(subRegionX, subRegionZ); + T datum = data[index]; + if (datum == null) { + World world = Objects.requireNonNull(this.world.get()); + T newElem = createElement( + world, + coord.chunkXPos * regionLength + subRegionX, + coord.chunkZPos * regionLength + subRegionZ); + data[index] = newElem; + return newElem; + } + return datum; + } + + public void set(int subRegionX, int subRegionZ, T data) { + this.data[getIndex(subRegionX, subRegionZ)] = data; + } + + public boolean isCreated(int subRegionX, int subRegionZ) { + return this.data[getIndex(subRegionX, subRegionZ)] != null; + } + + public ChunkCoordIntPair getCoord() { + return coord; + } + + private int getIndex(int subRegionX, int subRegionY) { + return subRegionX * regionLength + subRegionY; + } + + private int getChunkX(int index) { + return index / regionLength + coord.chunkXPos * regionLength; + } + + private int getChunkZ(int index) { + return index % regionLength + coord.chunkZPos * regionLength; + } + + public boolean isDirty() { + for (T datum : data) { + if (datum != null && !datum.isSameAsDefault()) return true; + } + return false; + } + + public void save() { + try { + save0(); + } catch (IOException e) { + GT_Log.err.println("Error saving data " + backingStorage.getPath()); + e.printStackTrace(GT_Log.err); + } + } + + private void save0() throws IOException { + //noinspection ResultOfMethodCallIgnored + 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))) { + int ptr = 0; + boolean nullRange = data[0] == null; + // write a magic byte as storage format version + output.writeByte(0); + // write a magic byte as data format version + output.writeByte(version); + output.writeBoolean(nullRange); + while (ptr < data.length) { + // work out how long is this range + int rangeStart = ptr; + while (ptr < data.length + && (data[ptr] == null || (!saveDefaults && data[ptr].isSameAsDefault())) == nullRange) + ptr++; + // write range length + output.writeShort(ptr - rangeStart); + if (!nullRange) + // write element data + for (int i = rangeStart; i < ptr; i++) + writeElement(output, data[i], world, getChunkX(ptr), getChunkZ(ptr)); + // or not + nullRange = !nullRange; + } + } + // first try to replace the destination file + // since atomic operation, no need to keep the backup in place + try { + Files.move( + tmpFile.toPath(), + backingStorage.toPath(), + StandardCopyOption.REPLACE_EXISTING, + StandardCopyOption.ATOMIC_MOVE); + } catch (AtomicMoveNotSupportedException ignored) { + // in case some dumb system/jre combination would cause this + // or if **somehow** two file inside the same directory belongs two separate filesystem + FileUtils.copyFile(tmpFile, backingStorage); + } + } + + public void load() { + try { + loadFromFile(backingStorage); + } catch (IOException | RuntimeException e) { + GT_Log.err.println("Primary storage file broken in " + backingStorage.getPath()); + e.printStackTrace(GT_Log.err); + // in case the primary storage is broken + try { + loadFromFile(getTmpFile()); + } catch (IOException | RuntimeException e2) { + GT_Log.err.println("Backup storage file broken in " + backingStorage.getPath()); + e2.printStackTrace(GT_Log.err); + } + } + } + + private void loadFromFile(File file) throws IOException { + World world = Objects.requireNonNull(this.world.get(), "Attempting to load region of another world!"); + try (DataInputStream input = new DataInputStream(new FileInputStream(file))) { + byte b = input.readByte(); + switch (b) { + case 0: + loadV0(input, world); + break; + default: + GT_Log.err.printf("Unknown ChunkAssociatedData version %d\n", b); + } + } + } + + private void loadV0(DataInput input, World world) throws IOException { + int version = input.readByte(); + boolean nullRange = input.readBoolean(); + int ptr = 0; + while (ptr != data.length) { + int rangeEnd = ptr + input.readUnsignedShort(); + if (!nullRange) { + for (; ptr < rangeEnd; ptr++) { + data[ptr] = readElement(input, version, world, getChunkX(ptr), getChunkZ(ptr)); + } + } else { + Arrays.fill(data, ptr, rangeEnd, null); + ptr = rangeEnd; + } + nullRange = !nullRange; + } + } + + private File getTmpFile() { + return new File(backingStorage.getParentFile(), backingStorage.getName() + ".tmp"); + } + } + + public static class EventHandler { + private EventHandler() { + MinecraftForge.EVENT_BUS.register(this); + } + + @SubscribeEvent + public void onWorldSave(WorldEvent.Save e) { + for (GT_ChunkAssociatedData<?> d : instances.values()) { + d.save(e.world); + } + } + + @SubscribeEvent + public void onWorldUnload(WorldEvent.Unload e) { + for (GT_ChunkAssociatedData<?> d : instances.values()) { + // there is no need to explicitly do a save here + // forge will send a WorldEvent.Save on server thread before this event is distributed + d.masterMap.remove(e.world.provider.dimensionId); + } + } + } } diff --git a/src/main/java/gregtech/api/util/GT_CircuitryBehavior.java b/src/main/java/gregtech/api/util/GT_CircuitryBehavior.java index f25b88728d..b7ded54d64 100644 --- a/src/main/java/gregtech/api/util/GT_CircuitryBehavior.java +++ b/src/main/java/gregtech/api/util/GT_CircuitryBehavior.java @@ -33,7 +33,14 @@ public abstract class GT_CircuitryBehavior { */ public static final boolean getAnyRedstone(IRedstoneCircuitBlock aRedstoneCircuitBlock) { for (byte i = 0; i < 6; i++) { - if (i != aRedstoneCircuitBlock.getOutputFacing() && aRedstoneCircuitBlock.getCover(i).letsRedstoneGoIn(i, aRedstoneCircuitBlock.getCoverID(i), aRedstoneCircuitBlock.getCoverVariable(i), aRedstoneCircuitBlock.getOwnTileEntity())) { + if (i != aRedstoneCircuitBlock.getOutputFacing() + && aRedstoneCircuitBlock + .getCover(i) + .letsRedstoneGoIn( + i, + aRedstoneCircuitBlock.getCoverID(i), + aRedstoneCircuitBlock.getCoverVariable(i), + aRedstoneCircuitBlock.getOwnTileEntity())) { if (aRedstoneCircuitBlock.getInputRedstone(i) > 0) { return true; } @@ -47,7 +54,14 @@ public abstract class GT_CircuitryBehavior { */ public static final boolean getAllRedstone(IRedstoneCircuitBlock aRedstoneCircuitBlock) { for (byte i = 0; i < 6; i++) { - if (i != aRedstoneCircuitBlock.getOutputFacing() && aRedstoneCircuitBlock.getCover(i).letsRedstoneGoIn(i, aRedstoneCircuitBlock.getCoverID(i), aRedstoneCircuitBlock.getCoverVariable(i), aRedstoneCircuitBlock.getOwnTileEntity())) { + if (i != aRedstoneCircuitBlock.getOutputFacing() + && aRedstoneCircuitBlock + .getCover(i) + .letsRedstoneGoIn( + i, + aRedstoneCircuitBlock.getCoverID(i), + aRedstoneCircuitBlock.getCoverVariable(i), + aRedstoneCircuitBlock.getOwnTileEntity())) { if (aRedstoneCircuitBlock.getInputRedstone(i) == 0) { return false; } @@ -62,7 +76,14 @@ public abstract class GT_CircuitryBehavior { public static final boolean getOneRedstone(IRedstoneCircuitBlock aRedstoneCircuitBlock) { int tRedstoneAmount = 0; for (byte i = 0; i < 6; i++) { - if (i != aRedstoneCircuitBlock.getOutputFacing() && aRedstoneCircuitBlock.getCover(i).letsRedstoneGoIn(i, aRedstoneCircuitBlock.getCoverID(i), aRedstoneCircuitBlock.getCoverVariable(i), aRedstoneCircuitBlock.getOwnTileEntity())) { + if (i != aRedstoneCircuitBlock.getOutputFacing() + && aRedstoneCircuitBlock + .getCover(i) + .letsRedstoneGoIn( + i, + aRedstoneCircuitBlock.getCoverID(i), + aRedstoneCircuitBlock.getCoverVariable(i), + aRedstoneCircuitBlock.getOwnTileEntity())) { if (aRedstoneCircuitBlock.getInputRedstone(i) > 0) { tRedstoneAmount++; } @@ -77,7 +98,14 @@ public abstract class GT_CircuitryBehavior { public static final byte getStrongestRedstone(IRedstoneCircuitBlock aRedstoneCircuitBlock) { byte tRedstoneAmount = 0; for (byte i = 0; i < 6; i++) { - if (i != aRedstoneCircuitBlock.getOutputFacing() && aRedstoneCircuitBlock.getCover(i).letsRedstoneGoIn(i, aRedstoneCircuitBlock.getCoverID(i), aRedstoneCircuitBlock.getCoverVariable(i), aRedstoneCircuitBlock.getOwnTileEntity())) { + if (i != aRedstoneCircuitBlock.getOutputFacing() + && aRedstoneCircuitBlock + .getCover(i) + .letsRedstoneGoIn( + i, + aRedstoneCircuitBlock.getCoverID(i), + aRedstoneCircuitBlock.getCoverVariable(i), + aRedstoneCircuitBlock.getOwnTileEntity())) { tRedstoneAmount = (byte) Math.max(tRedstoneAmount, aRedstoneCircuitBlock.getInputRedstone(i)); } } @@ -95,7 +123,14 @@ public abstract class GT_CircuitryBehavior { if (!getAnyRedstone(aRedstoneCircuitBlock)) return 0; byte tRedstoneAmount = 15; for (byte i = 0; i < 6; i++) { - if (i != aRedstoneCircuitBlock.getOutputFacing() && aRedstoneCircuitBlock.getCover(i).letsRedstoneGoIn(i, aRedstoneCircuitBlock.getCoverID(i), aRedstoneCircuitBlock.getCoverVariable(i), aRedstoneCircuitBlock.getOwnTileEntity())) { + if (i != aRedstoneCircuitBlock.getOutputFacing() + && aRedstoneCircuitBlock + .getCover(i) + .letsRedstoneGoIn( + i, + aRedstoneCircuitBlock.getCoverID(i), + aRedstoneCircuitBlock.getCoverVariable(i), + aRedstoneCircuitBlock.getOwnTileEntity())) { if (aRedstoneCircuitBlock.getInputRedstone(i) > 0) tRedstoneAmount = (byte) Math.min(tRedstoneAmount, aRedstoneCircuitBlock.getInputRedstone(i)); } @@ -110,7 +145,14 @@ public abstract class GT_CircuitryBehavior { if (!getAnyRedstone(aRedstoneCircuitBlock)) return 0; byte tRedstoneAmount = 15; for (byte i = 0; i < 6; i++) { - if (i != aRedstoneCircuitBlock.getOutputFacing() && aRedstoneCircuitBlock.getCover(i).letsRedstoneGoIn(i, aRedstoneCircuitBlock.getCoverID(i), aRedstoneCircuitBlock.getCoverVariable(i), aRedstoneCircuitBlock.getOwnTileEntity())) { + if (i != aRedstoneCircuitBlock.getOutputFacing() + && aRedstoneCircuitBlock + .getCover(i) + .letsRedstoneGoIn( + i, + aRedstoneCircuitBlock.getCoverID(i), + aRedstoneCircuitBlock.getCoverVariable(i), + aRedstoneCircuitBlock.getOwnTileEntity())) { tRedstoneAmount = (byte) Math.min(tRedstoneAmount, aRedstoneCircuitBlock.getInputRedstone(i)); } } @@ -134,7 +176,6 @@ public abstract class GT_CircuitryBehavior { */ public abstract void validateParameters(int[] aCircuitData, IRedstoneCircuitBlock aRedstoneCircuitBlock); - /**************************** * Useful Utility Functions * ****************************/ @@ -150,7 +191,8 @@ public abstract class GT_CircuitryBehavior { /** * If the ItemStack should be displayed. Parameters are between 0 and 3. */ - public abstract boolean displayItemStack(int[] aCircuitData, IRedstoneCircuitBlock aRedstoneCircuitBlock, int aIndex); + public abstract boolean displayItemStack( + int[] aCircuitData, IRedstoneCircuitBlock aRedstoneCircuitBlock, int aIndex); /** * The Name of the Gate for the GUI diff --git a/src/main/java/gregtech/api/util/GT_ClientPreference.java b/src/main/java/gregtech/api/util/GT_ClientPreference.java index 26c7fa3da5..de3051fd37 100644 --- a/src/main/java/gregtech/api/util/GT_ClientPreference.java +++ b/src/main/java/gregtech/api/util/GT_ClientPreference.java @@ -5,7 +5,8 @@ public class GT_ClientPreference { private final boolean mSingleBlockInitialMultiStack; private final boolean mInputBusInitialFilter; - public GT_ClientPreference(boolean mSingleBlockInitialFilter, boolean mSingleBlockInitialMultiStack, boolean mInputBusInitialFilter) { + public GT_ClientPreference( + boolean mSingleBlockInitialFilter, boolean mSingleBlockInitialMultiStack, boolean mInputBusInitialFilter) { this.mSingleBlockInitialFilter = mSingleBlockInitialFilter; this.mSingleBlockInitialMultiStack = mSingleBlockInitialMultiStack; this.mInputBusInitialFilter = mInputBusInitialFilter; @@ -13,7 +14,8 @@ 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 4a0b15408f..362be0fe01 100644 --- a/src/main/java/gregtech/api/util/GT_Config.java +++ b/src/main/java/gregtech/api/util/GT_Config.java @@ -1,13 +1,13 @@ package gregtech.api.util; +import static gregtech.api.enums.GT_Values.E; + import gregtech.api.GregTech_API; import gregtech.api.enums.GT_Values; import net.minecraft.item.ItemStack; import net.minecraftforge.common.config.Configuration; import net.minecraftforge.common.config.Property; -import static gregtech.api.enums.GT_Values.E; - public class GT_Config implements Runnable { public static boolean troll = false; @@ -21,8 +21,7 @@ public class GT_Config implements Runnable { GregTech_API.sAfterGTPreload.add(this); // in case of crash on startup GregTech_API.sAfterGTLoad.add(this); // in case of crash on startup GregTech_API.sAfterGTPostload.add(this); - if (GT_Values.lateConfigSave) - GregTech_API.sFirstWorldTick.add(this); + if (GT_Values.lateConfigSave) GregTech_API.sFirstWorldTick.add(this); } private static boolean shouldSave() { @@ -31,7 +30,8 @@ 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; @@ -43,7 +43,9 @@ public class GT_Config implements Runnable { if (rName != null) return rName.toString(); try { if (GT_Utility.isStringValid(rName = aStack.getUnlocalizedName())) return rName.toString(); - } catch (Throwable e) {/*Do nothing*/} + } catch (Throwable e) { + /*Do nothing*/ + } String sName = aStack.getItem().toString(); String[] tmp = sName.split("@"); if (tmp.length > 0) sName = tmp[0]; @@ -57,7 +59,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("\\|", "_"), (aName + "_" + aDefault).replaceAll("\\|", "_"), aDefault); + Property tProperty = mConfig.get( + aCategory.toString().replaceAll("\\|", "_"), (aName + "_" + aDefault).replaceAll("\\|", "_"), aDefault); boolean rResult = tProperty.getBoolean(aDefault); if (!tProperty.wasRead() && shouldSave()) mConfig.save(); return rResult; @@ -69,7 +72,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("\\|", "_"), (aName + "_" + aDefault).replaceAll("\\|", "_"), aDefault); + Property tProperty = mConfig.get( + aCategory.toString().replaceAll("\\|", "_"), (aName + "_" + aDefault).replaceAll("\\|", "_"), aDefault); int rResult = tProperty.getInt(aDefault); if (!tProperty.wasRead() && shouldSave()) mConfig.save(); return rResult; @@ -81,7 +85,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("\\|", "_"), (aName + "_" + aDefault).replaceAll("\\|", "_"), aDefault); + Property tProperty = mConfig.get( + aCategory.toString().replaceAll("\\|", "_"), (aName + "_" + aDefault).replaceAll("\\|", "_"), aDefault); double rResult = tProperty.getDouble(aDefault); if (!tProperty.wasRead() && shouldSave()) mConfig.save(); return rResult; @@ -93,7 +98,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("\\|", "_"), (aName + "_" + aDefault).replaceAll("\\|", "_"), aDefault); + Property tProperty = mConfig.get( + aCategory.toString().replaceAll("\\|", "_"), (aName + "_" + aDefault).replaceAll("\\|", "_"), aDefault); String rResult = tProperty.getString(); if (!tProperty.wasRead() && shouldSave()) mConfig.save(); return rResult; @@ -105,13 +111,13 @@ 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; } - @Override public void run() { mConfig.save(); diff --git a/src/main/java/gregtech/api/util/GT_CoverBehavior.java b/src/main/java/gregtech/api/util/GT_CoverBehavior.java index 9972331eb3..de1514c956 100644 --- a/src/main/java/gregtech/api/util/GT_CoverBehavior.java +++ b/src/main/java/gregtech/api/util/GT_CoverBehavior.java @@ -1,5 +1,7 @@ package gregtech.api.util; +import static gregtech.api.enums.GT_Values.E; + import gregtech.api.enums.GT_Values; import gregtech.api.interfaces.tileentity.ICoverable; import gregtech.api.net.GT_Packet_TileEntityCoverGUI; @@ -9,8 +11,6 @@ import net.minecraft.item.ItemStack; import net.minecraft.world.World; import net.minecraftforge.fluids.Fluid; -import static gregtech.api.enums.GT_Values.E; - /** * For Covers with a special behavior. Has fixed storage format of 4 byte. Not very convenient... */ @@ -39,151 +39,234 @@ public abstract class GT_CoverBehavior extends GT_CoverBehaviorBase<ISerializabl } @Override - protected boolean isRedstoneSensitiveImpl(byte aSide, int aCoverID, ISerializableObject.LegacyCoverData aCoverVariable, ICoverable aTileEntity, long aTimer) { + protected boolean isRedstoneSensitiveImpl( + byte aSide, + int aCoverID, + ISerializableObject.LegacyCoverData aCoverVariable, + ICoverable aTileEntity, + long aTimer) { return isRedstoneSensitive(aSide, aCoverID, aCoverVariable.get(), aTileEntity, aTimer); } @Override - protected ISerializableObject.LegacyCoverData doCoverThingsImpl(byte aSide, byte aInputRedstone, int aCoverID, ISerializableObject.LegacyCoverData aCoverVariable, ICoverable aTileEntity, long aTimer) { - if (aCoverVariable == null) - aCoverVariable = new ISerializableObject.LegacyCoverData(); + protected ISerializableObject.LegacyCoverData doCoverThingsImpl( + byte aSide, + byte aInputRedstone, + int aCoverID, + ISerializableObject.LegacyCoverData aCoverVariable, + ICoverable aTileEntity, + long aTimer) { + if (aCoverVariable == null) aCoverVariable = new ISerializableObject.LegacyCoverData(); aCoverVariable.set(doCoverThings(aSide, aInputRedstone, aCoverID, aCoverVariable.get(), aTileEntity, aTimer)); return aCoverVariable; } @Override - protected boolean onCoverRightClickImpl(byte aSide, int aCoverID, ISerializableObject.LegacyCoverData aCoverVariable, ICoverable aTileEntity, EntityPlayer aPlayer, float aX, float aY, float aZ) { + protected boolean onCoverRightClickImpl( + byte aSide, + int aCoverID, + ISerializableObject.LegacyCoverData aCoverVariable, + ICoverable aTileEntity, + EntityPlayer aPlayer, + float aX, + float aY, + float aZ) { return onCoverRightclick(aSide, aCoverID, convert(aCoverVariable), aTileEntity, aPlayer, aX, aY, aZ); } @Override - protected ISerializableObject.LegacyCoverData onCoverScrewdriverClickImpl(byte aSide, int aCoverID, ISerializableObject.LegacyCoverData aCoverVariable, ICoverable aTileEntity, EntityPlayer aPlayer, float aX, float aY, float aZ) { - if (aCoverVariable == null) - aCoverVariable = new ISerializableObject.LegacyCoverData(); - aCoverVariable.set(onCoverScrewdriverclick(aSide, aCoverID, convert(aCoverVariable), aTileEntity, aPlayer, aX, aY, aZ)); + protected ISerializableObject.LegacyCoverData onCoverScrewdriverClickImpl( + byte aSide, + int aCoverID, + ISerializableObject.LegacyCoverData aCoverVariable, + ICoverable aTileEntity, + EntityPlayer aPlayer, + float aX, + float aY, + float aZ) { + if (aCoverVariable == null) aCoverVariable = new ISerializableObject.LegacyCoverData(); + aCoverVariable.set( + onCoverScrewdriverclick(aSide, aCoverID, convert(aCoverVariable), aTileEntity, aPlayer, aX, aY, aZ)); return aCoverVariable; } @Override - protected boolean onCoverShiftRightClickImpl(byte aSide, int aCoverID, ISerializableObject.LegacyCoverData aCoverVariable, ICoverable aTileEntity, EntityPlayer aPlayer) { + protected boolean onCoverShiftRightClickImpl( + byte aSide, + int aCoverID, + ISerializableObject.LegacyCoverData aCoverVariable, + ICoverable aTileEntity, + EntityPlayer aPlayer) { return onCoverShiftRightclick(aSide, aCoverID, convert(aCoverVariable), aTileEntity, aPlayer); } @Override - protected Object getClientGUIImpl(byte aSide, int aCoverID, ISerializableObject.LegacyCoverData aCoverVariable, ICoverable aTileEntity, EntityPlayer aPlayer, World aWorld) { + protected Object getClientGUIImpl( + byte aSide, + int aCoverID, + ISerializableObject.LegacyCoverData aCoverVariable, + ICoverable aTileEntity, + EntityPlayer aPlayer, + World aWorld) { return getClientGUI(aSide, aCoverID, convert(aCoverVariable), aTileEntity); } @Override - protected boolean onCoverRemovalImpl(byte aSide, int aCoverID, ISerializableObject.LegacyCoverData aCoverVariable, ICoverable aTileEntity, boolean aForced) { + protected boolean onCoverRemovalImpl( + byte aSide, + int aCoverID, + ISerializableObject.LegacyCoverData aCoverVariable, + ICoverable aTileEntity, + boolean aForced) { return onCoverRemoval(aSide, aCoverID, convert(aCoverVariable), aTileEntity, aForced); } @Override - protected String getDescriptionImpl(byte aSide, int aCoverID, ISerializableObject.LegacyCoverData aCoverVariable, ICoverable aTileEntity) { + protected String getDescriptionImpl( + byte aSide, int aCoverID, ISerializableObject.LegacyCoverData aCoverVariable, ICoverable aTileEntity) { return getDescription(aSide, aCoverID, convert(aCoverVariable), aTileEntity); } @Override - protected float getBlastProofLevelImpl(byte aSide, int aCoverID, ISerializableObject.LegacyCoverData aCoverVariable, ICoverable aTileEntity) { + protected float getBlastProofLevelImpl( + byte aSide, int aCoverID, ISerializableObject.LegacyCoverData aCoverVariable, ICoverable aTileEntity) { return getBlastProofLevel(aSide, aCoverID, convert(aCoverVariable), aTileEntity); } @Override - protected boolean letsRedstoneGoInImpl(byte aSide, int aCoverID, ISerializableObject.LegacyCoverData aCoverVariable, ICoverable aTileEntity) { + protected boolean letsRedstoneGoInImpl( + byte aSide, int aCoverID, ISerializableObject.LegacyCoverData aCoverVariable, ICoverable aTileEntity) { return letsRedstoneGoIn(aSide, aCoverID, convert(aCoverVariable), aTileEntity); } @Override - protected boolean letsRedstoneGoOutImpl(byte aSide, int aCoverID, ISerializableObject.LegacyCoverData aCoverVariable, ICoverable aTileEntity) { + protected boolean letsRedstoneGoOutImpl( + byte aSide, int aCoverID, ISerializableObject.LegacyCoverData aCoverVariable, ICoverable aTileEntity) { return letsRedstoneGoOut(aSide, aCoverID, convert(aCoverVariable), aTileEntity); } @Override - protected boolean letsFibreGoInImpl(byte aSide, int aCoverID, ISerializableObject.LegacyCoverData aCoverVariable, ICoverable aTileEntity) { + protected boolean letsFibreGoInImpl( + byte aSide, int aCoverID, ISerializableObject.LegacyCoverData aCoverVariable, ICoverable aTileEntity) { return letsFibreGoIn(aSide, aCoverID, convert(aCoverVariable), aTileEntity); } @Override - protected boolean letsFibreGoOutImpl(byte aSide, int aCoverID, ISerializableObject.LegacyCoverData aCoverVariable, ICoverable aTileEntity) { + protected boolean letsFibreGoOutImpl( + byte aSide, int aCoverID, ISerializableObject.LegacyCoverData aCoverVariable, ICoverable aTileEntity) { return letsFibreGoOut(aSide, aCoverID, convert(aCoverVariable), aTileEntity); } @Override - protected boolean letsEnergyInImpl(byte aSide, int aCoverID, ISerializableObject.LegacyCoverData aCoverVariable, ICoverable aTileEntity) { + protected boolean letsEnergyInImpl( + byte aSide, int aCoverID, ISerializableObject.LegacyCoverData aCoverVariable, ICoverable aTileEntity) { return letsEnergyIn(aSide, aCoverID, convert(aCoverVariable), aTileEntity); } @Override - protected boolean letsEnergyOutImpl(byte aSide, int aCoverID, ISerializableObject.LegacyCoverData aCoverVariable, ICoverable aTileEntity) { + protected boolean letsEnergyOutImpl( + byte aSide, int aCoverID, ISerializableObject.LegacyCoverData aCoverVariable, ICoverable aTileEntity) { return letsEnergyOut(aSide, aCoverID, convert(aCoverVariable), aTileEntity); } @Override - protected boolean letsFluidInImpl(byte aSide, int aCoverID, ISerializableObject.LegacyCoverData aCoverVariable, Fluid aFluid, ICoverable aTileEntity) { + protected boolean letsFluidInImpl( + byte aSide, + int aCoverID, + ISerializableObject.LegacyCoverData aCoverVariable, + Fluid aFluid, + ICoverable aTileEntity) { return letsFluidIn(aSide, aCoverID, convert(aCoverVariable), aFluid, aTileEntity); } @Override - protected boolean letsFluidOutImpl(byte aSide, int aCoverID, ISerializableObject.LegacyCoverData aCoverVariable, Fluid aFluid, ICoverable aTileEntity) { + protected boolean letsFluidOutImpl( + byte aSide, + int aCoverID, + ISerializableObject.LegacyCoverData aCoverVariable, + Fluid aFluid, + ICoverable aTileEntity) { return letsFluidOut(aSide, aCoverID, convert(aCoverVariable), aFluid, aTileEntity); } @Override - protected boolean letsItemsInImpl(byte aSide, int aCoverID, ISerializableObject.LegacyCoverData aCoverVariable, int aSlot, ICoverable aTileEntity) { + protected boolean letsItemsInImpl( + byte aSide, + int aCoverID, + ISerializableObject.LegacyCoverData aCoverVariable, + int aSlot, + ICoverable aTileEntity) { return letsItemsIn(aSide, aCoverID, convert(aCoverVariable), aSlot, aTileEntity); } @Override - protected boolean letsItemsOutImpl(byte aSide, int aCoverID, ISerializableObject.LegacyCoverData aCoverVariable, int aSlot, ICoverable aTileEntity) { + protected boolean letsItemsOutImpl( + byte aSide, + int aCoverID, + ISerializableObject.LegacyCoverData aCoverVariable, + int aSlot, + ICoverable aTileEntity) { return letsItemsOut(aSide, aCoverID, convert(aCoverVariable), aSlot, aTileEntity); } @Override - protected boolean isGUIClickableImpl(byte aSide, int aCoverID, ISerializableObject.LegacyCoverData aCoverVariable, ICoverable aTileEntity) { + protected boolean isGUIClickableImpl( + byte aSide, int aCoverID, ISerializableObject.LegacyCoverData aCoverVariable, ICoverable aTileEntity) { return isGUIClickable(aSide, aCoverID, convert(aCoverVariable), aTileEntity); } @Override - protected boolean manipulatesSidedRedstoneOutputImpl(byte aSide, int aCoverID, ISerializableObject.LegacyCoverData aCoverVariable, ICoverable aTileEntity) { + protected boolean manipulatesSidedRedstoneOutputImpl( + byte aSide, int aCoverID, ISerializableObject.LegacyCoverData aCoverVariable, ICoverable aTileEntity) { return manipulatesSidedRedstoneOutput(aSide, aCoverID, convert(aCoverVariable), aTileEntity); } @Override - protected boolean alwaysLookConnectedImpl(byte aSide, int aCoverID, ISerializableObject.LegacyCoverData aCoverVariable, ICoverable aTileEntity) { + protected boolean alwaysLookConnectedImpl( + byte aSide, int aCoverID, ISerializableObject.LegacyCoverData aCoverVariable, ICoverable aTileEntity) { return alwaysLookConnected(aSide, aCoverID, convert(aCoverVariable), aTileEntity); } @Override - protected byte getRedstoneInputImpl(byte aSide, byte aInputRedstone, int aCoverID, ISerializableObject.LegacyCoverData aCoverVariable, ICoverable aTileEntity) { + protected byte getRedstoneInputImpl( + byte aSide, + byte aInputRedstone, + int aCoverID, + ISerializableObject.LegacyCoverData aCoverVariable, + ICoverable aTileEntity) { return getRedstoneInput(aSide, aInputRedstone, aCoverID, convert(aCoverVariable), aTileEntity); } @Override - protected int getTickRateImpl(byte aSide, int aCoverID, ISerializableObject.LegacyCoverData aCoverVariable, ICoverable aTileEntity) { + protected int getTickRateImpl( + byte aSide, int aCoverID, ISerializableObject.LegacyCoverData aCoverVariable, ICoverable aTileEntity) { return getTickRate(aSide, aCoverID, convert(aCoverVariable), aTileEntity); } @Override - protected byte getLensColorImpl(byte aSide, int aCoverID, ISerializableObject.LegacyCoverData aCoverVariable, ICoverable aTileEntity) { + protected byte getLensColorImpl( + byte aSide, int aCoverID, ISerializableObject.LegacyCoverData aCoverVariable, ICoverable aTileEntity) { return getLensColor(aSide, aCoverID, convert(aCoverVariable), aTileEntity); } @Override - protected ItemStack getDropImpl(byte aSide, int aCoverID, ISerializableObject.LegacyCoverData aCoverVariable, ICoverable aTileEntity) { + protected ItemStack getDropImpl( + byte aSide, int aCoverID, ISerializableObject.LegacyCoverData aCoverVariable, ICoverable aTileEntity) { return getDrop(aSide, aCoverID, convert(aCoverVariable), aTileEntity); } // endregion - public boolean isRedstoneSensitive(byte aSide, int aCoverID, int aCoverVariable, ICoverable aTileEntity, long aTimer) { + public boolean isRedstoneSensitive( + byte aSide, int aCoverID, int aCoverVariable, ICoverable aTileEntity, long aTimer) { return true; } /** * Called by updateEntity inside the covered TileEntity. aCoverVariable is the Value you returned last time. */ - public int doCoverThings(byte aSide, byte aInputRedstone, int aCoverID, int aCoverVariable, ICoverable aTileEntity, long aTimer) { + public int doCoverThings( + byte aSide, byte aInputRedstone, int aCoverID, int aCoverVariable, ICoverable aTileEntity, long aTimer) { return aCoverVariable; } @@ -192,7 +275,15 @@ public abstract class GT_CoverBehavior extends GT_CoverBehaviorBase<ISerializabl * <p/> * return true, if something actually happens. */ - public boolean onCoverRightclick(byte aSide, int aCoverID, int aCoverVariable, ICoverable aTileEntity, EntityPlayer aPlayer, float aX, float aY, float aZ) { + public boolean onCoverRightclick( + byte aSide, + int aCoverID, + int aCoverVariable, + ICoverable aTileEntity, + EntityPlayer aPlayer, + float aX, + float aY, + float aZ) { return false; } @@ -201,17 +292,29 @@ public abstract class GT_CoverBehavior extends GT_CoverBehaviorBase<ISerializabl * <p/> * return the new Value of the Cover Variable */ - public int onCoverScrewdriverclick(byte aSide, int aCoverID, int aCoverVariable, ICoverable aTileEntity, EntityPlayer aPlayer, float aX, float aY, float aZ) { + public int onCoverScrewdriverclick( + byte aSide, + int aCoverID, + int aCoverVariable, + ICoverable aTileEntity, + EntityPlayer aPlayer, + float aX, + float aY, + float aZ) { return aCoverVariable; } /** * Called when someone shift-rightclicks this Cover with no tool. Doesn't call @onCoverRightclick in this Case. */ - public boolean onCoverShiftRightclick(byte aSide, int aCoverID, int aCoverVariable, ICoverable aTileEntity, EntityPlayer aPlayer) { - if(hasCoverGUI() && aPlayer instanceof EntityPlayerMP) { + public boolean onCoverShiftRightclick( + byte aSide, int aCoverID, int aCoverVariable, ICoverable aTileEntity, EntityPlayer aPlayer) { + if (hasCoverGUI() && aPlayer instanceof EntityPlayerMP) { lastPlayer = aPlayer; - GT_Values.NW.sendToPlayer(new GT_Packet_TileEntityCoverGUI(aSide, aCoverID, aCoverVariable, aTileEntity, (EntityPlayerMP) aPlayer), (EntityPlayerMP) aPlayer); + GT_Values.NW.sendToPlayer( + new GT_Packet_TileEntityCoverGUI( + aSide, aCoverID, aCoverVariable, aTileEntity, (EntityPlayerMP) aPlayer), + (EntityPlayerMP) aPlayer); return true; } return false; @@ -225,7 +328,8 @@ public abstract class GT_CoverBehavior extends GT_CoverBehaviorBase<ISerializabl * Removes the Cover if this returns true, or if aForced is true. * Doesn't get called when the Machine Block is getting broken, only if you break the Cover away from the Machine. */ - public boolean onCoverRemoval(byte aSide, int aCoverID, int aCoverVariable, ICoverable aTileEntity, boolean aForced) { + public boolean onCoverRemoval( + byte aSide, int aCoverID, int aCoverVariable, ICoverable aTileEntity, boolean aForced) { return true; } @@ -327,7 +431,8 @@ public abstract class GT_CoverBehavior extends GT_CoverBehaviorBase<ISerializabl /** * Needs to return true for Covers, which have a Redstone Output on their Facing. */ - public boolean manipulatesSidedRedstoneOutput(byte aSide, int aCoverID, int aCoverVariable, ICoverable aTileEntity) { + public boolean manipulatesSidedRedstoneOutput( + byte aSide, int aCoverID, int aCoverVariable, ICoverable aTileEntity) { return false; } @@ -343,7 +448,8 @@ public abstract class GT_CoverBehavior extends GT_CoverBehaviorBase<ISerializabl * Returns the original Redstone per default. * The Cover should @letsRedstoneGoIn or the aInputRedstone Parameter is always 0. */ - public byte getRedstoneInput(byte aSide, byte aInputRedstone, int aCoverID, int aCoverVariable, ICoverable aTileEntity) { + public byte getRedstoneInput( + byte aSide, byte aInputRedstone, int aCoverID, int aCoverVariable, ICoverable aTileEntity) { return letsRedstoneGoIn(aSide, aCoverID, aCoverVariable, aTileEntity) ? aInputRedstone : 0; } diff --git a/src/main/java/gregtech/api/util/GT_CoverBehaviorBase.java b/src/main/java/gregtech/api/util/GT_CoverBehaviorBase.java index 1c72f9c9d9..470a250ee7 100644 --- a/src/main/java/gregtech/api/util/GT_CoverBehaviorBase.java +++ b/src/main/java/gregtech/api/util/GT_CoverBehaviorBase.java @@ -1,5 +1,7 @@ package gregtech.api.util; +import static gregtech.api.enums.GT_Values.E; + import gregtech.api.enums.GT_Values; import gregtech.api.interfaces.ITexture; import gregtech.api.interfaces.tileentity.ICoverable; @@ -14,8 +16,6 @@ import net.minecraft.nbt.NBTTagInt; import net.minecraft.world.World; import net.minecraftforge.fluids.Fluid; -import static gregtech.api.enums.GT_Values.E; - /** * For Covers with a special behavior. * @@ -46,8 +46,7 @@ public abstract class GT_CoverBehaviorBase<T extends ISerializableObject> { } public final T cast(ISerializableObject aData) { - if (typeToken.isInstance(aData)) - return forceCast(aData); + if (typeToken.isInstance(aData)) return forceCast(aData); return null; } @@ -66,7 +65,8 @@ public abstract class GT_CoverBehaviorBase<T extends ISerializableObject> { * in case of CTM * @return null if none, otherwise return facade target block */ - public final Block getFacadeBlock(byte aSide, int aCoverID, ISerializableObject aCoverVariable, ICoverable aTileEntity) { + public final Block getFacadeBlock( + byte aSide, int aCoverID, ISerializableObject aCoverVariable, ICoverable aTileEntity) { return getFacadeBlockImpl(aSide, aCoverID, forceCast(aCoverVariable), aTileEntity); } @@ -75,7 +75,8 @@ public abstract class GT_CoverBehaviorBase<T extends ISerializableObject> { * in case of CTM * @return 0 if none, otherwise return facade target meta */ - public final int getFacadeMeta(byte aSide, int aCoverID, ISerializableObject aCoverVariable, ICoverable aTileEntity) { + public final int getFacadeMeta( + byte aSide, int aCoverID, ISerializableObject aCoverVariable, ICoverable aTileEntity) { return getFacadeMetaImpl(aSide, aCoverID, forceCast(aCoverVariable), aTileEntity); } @@ -83,14 +84,15 @@ public abstract class GT_CoverBehaviorBase<T extends ISerializableObject> { * Get the display stack. Default to {@code int2Stack(aCoverID)} */ public final ItemStack getDisplayStack(int aCoverID, ISerializableObject aCoverVariable) { - return getDisplayStackImpl(aCoverID,forceCast(aCoverVariable)); + return getDisplayStackImpl(aCoverID, forceCast(aCoverVariable)); } /** * Get the special cover texture associated with this cover. Return null if one should use the texture passed to * {@link gregtech.api.GregTech_API#registerCover(ItemStack, ITexture, GT_CoverBehaviorBase)} or its overloads. */ - public final ITexture getSpecialCoverTexture(byte aSide, int aCoverID, ISerializableObject aCoverVariable, ICoverable aTileEntity) { + public final ITexture getSpecialCoverTexture( + byte aSide, int aCoverID, ISerializableObject aCoverVariable, ICoverable aTileEntity) { return getSpecialCoverTextureImpl(aSide, aCoverID, forceCast(aCoverVariable), aTileEntity); } @@ -100,14 +102,16 @@ public abstract class GT_CoverBehaviorBase<T extends ISerializableObject> { * Note if you want to sync the data afterwards you will have to manually do it by calling {@link ICoverable#issueCoverUpdate(byte)} * This option only affects the initial sync. */ - public final boolean isDataNeededOnClient(byte aSide, int aCoverID, ISerializableObject aCoverVariable, ICoverable aTileEntity) { + public final boolean isDataNeededOnClient( + byte aSide, int aCoverID, ISerializableObject aCoverVariable, ICoverable aTileEntity) { return isDataNeededOnClientImpl(aSide, aCoverID, forceCast(aCoverVariable), aTileEntity); } /** * Called upon receiving data from network. Use {@link ICoverable#isClientSide()} to determine the side. */ - public final void onDataChanged(byte aSide, int aCoverID, ISerializableObject aCoverVariable, ICoverable aTileEntity) { + public final void onDataChanged( + byte aSide, int aCoverID, ISerializableObject aCoverVariable, ICoverable aTileEntity) { onDataChangedImpl(aSide, aCoverID, forceCast(aCoverVariable), aTileEntity); } @@ -118,14 +122,21 @@ public abstract class GT_CoverBehaviorBase<T extends ISerializableObject> { onDroppedImpl(aSide, aCoverID, forceCast(aCoverVariable), aTileEntity); } - public final boolean isRedstoneSensitive(byte aSide, int aCoverID, ISerializableObject aCoverVariable, ICoverable aTileEntity, long aTimer) { + public final boolean isRedstoneSensitive( + byte aSide, int aCoverID, ISerializableObject aCoverVariable, ICoverable aTileEntity, long aTimer) { return isRedstoneSensitiveImpl(aSide, aCoverID, forceCast(aCoverVariable), aTileEntity, aTimer); } /** * Called by updateEntity inside the covered TileEntity. aCoverVariable is the Value you returned last time. */ - public final T doCoverThings(byte aSide, byte aInputRedstone, int aCoverID, ISerializableObject aCoverVariable, ICoverable aTileEntity, long aTimer) { + public final T doCoverThings( + byte aSide, + byte aInputRedstone, + int aCoverID, + ISerializableObject aCoverVariable, + ICoverable aTileEntity, + long aTimer) { return doCoverThingsImpl(aSide, aInputRedstone, aCoverID, forceCast(aCoverVariable), aTileEntity, aTimer); } @@ -134,7 +145,15 @@ public abstract class GT_CoverBehaviorBase<T extends ISerializableObject> { * <p/> * return true, if something actually happens. */ - public final boolean onCoverRightClick(byte aSide, int aCoverID, ISerializableObject aCoverVariable, ICoverable aTileEntity, EntityPlayer aPlayer, float aX, float aY, float aZ) { + public final boolean onCoverRightClick( + byte aSide, + int aCoverID, + ISerializableObject aCoverVariable, + ICoverable aTileEntity, + EntityPlayer aPlayer, + float aX, + float aY, + float aZ) { return onCoverRightClickImpl(aSide, aCoverID, forceCast(aCoverVariable), aTileEntity, aPlayer, aX, aY, aZ); } @@ -143,18 +162,38 @@ public abstract class GT_CoverBehaviorBase<T extends ISerializableObject> { * <p/> * return the new Value of the Cover Variable */ - public final T onCoverScrewdriverClick(byte aSide, int aCoverID, ISerializableObject aCoverVariable, ICoverable aTileEntity, EntityPlayer aPlayer, float aX, float aY, float aZ) { - return onCoverScrewdriverClickImpl(aSide, aCoverID, forceCast(aCoverVariable), aTileEntity, aPlayer, aX, aY, aZ); + public final T onCoverScrewdriverClick( + byte aSide, + int aCoverID, + ISerializableObject aCoverVariable, + ICoverable aTileEntity, + EntityPlayer aPlayer, + float aX, + float aY, + float aZ) { + return onCoverScrewdriverClickImpl( + aSide, aCoverID, forceCast(aCoverVariable), aTileEntity, aPlayer, aX, aY, aZ); } /** * Called when someone shift-rightclicks this Cover with no tool. Doesn't call @onCoverRightclick in this Case. */ - public final boolean onCoverShiftRightClick(byte aSide, int aCoverID, ISerializableObject aCoverVariable, ICoverable aTileEntity, EntityPlayer aPlayer) { + public final boolean onCoverShiftRightClick( + byte aSide, + int aCoverID, + ISerializableObject aCoverVariable, + ICoverable aTileEntity, + EntityPlayer aPlayer) { return onCoverShiftRightClickImpl(aSide, aCoverID, forceCast(aCoverVariable), aTileEntity, aPlayer); } - public final Object getClientGUI(byte aSide, int aCoverID, ISerializableObject aCoverVariable, ICoverable aTileEntity, EntityPlayer aPlayer, World aWorld) { + public final Object getClientGUI( + byte aSide, + int aCoverID, + ISerializableObject aCoverVariable, + ICoverable aTileEntity, + EntityPlayer aPlayer, + World aWorld) { return getClientGUIImpl(aSide, aCoverID, forceCast(aCoverVariable), aTileEntity, aPlayer, aWorld); } @@ -162,21 +201,24 @@ public abstract class GT_CoverBehaviorBase<T extends ISerializableObject> { * Removes the Cover if this returns true, or if aForced is true. * Doesn't get called when the Machine Block is getting broken, only if you break the Cover away from the Machine. */ - public final boolean onCoverRemoval(byte aSide, int aCoverID, ISerializableObject aCoverVariable, ICoverable aTileEntity, boolean aForced) { + public final boolean onCoverRemoval( + byte aSide, int aCoverID, ISerializableObject aCoverVariable, ICoverable aTileEntity, boolean aForced) { return onCoverRemovalImpl(aSide, aCoverID, forceCast(aCoverVariable), aTileEntity, aForced); } /** * Gives a small Text for the status of the Cover. */ - public final String getDescription(byte aSide, int aCoverID, ISerializableObject aCoverVariable, ICoverable aTileEntity) { + public final String getDescription( + byte aSide, int aCoverID, ISerializableObject aCoverVariable, ICoverable aTileEntity) { return getDescriptionImpl(aSide, aCoverID, forceCast(aCoverVariable), aTileEntity); } /** * How Blast Proof the Cover is. 30 is normal. */ - public final float getBlastProofLevel(byte aSide, int aCoverID, ISerializableObject aCoverVariable, ICoverable aTileEntity) { + public final float getBlastProofLevel( + byte aSide, int aCoverID, ISerializableObject aCoverVariable, ICoverable aTileEntity) { return getBlastProofLevelImpl(aSide, aCoverID, forceCast(aCoverVariable), aTileEntity); } @@ -185,14 +227,16 @@ public abstract class GT_CoverBehaviorBase<T extends ISerializableObject> { * <p/> * This is just Informative so that Machines know if their Redstone Input is blocked or not */ - public final boolean letsRedstoneGoIn(byte aSide, int aCoverID, ISerializableObject aCoverVariable, ICoverable aTileEntity) { + public final boolean letsRedstoneGoIn( + byte aSide, int aCoverID, ISerializableObject aCoverVariable, ICoverable aTileEntity) { return letsRedstoneGoInImpl(aSide, aCoverID, forceCast(aCoverVariable), aTileEntity); } /** * If it lets RS-Signals out of the Block */ - public final boolean letsRedstoneGoOut(byte aSide, int aCoverID, ISerializableObject aCoverVariable, ICoverable aTileEntity) { + public final boolean letsRedstoneGoOut( + byte aSide, int aCoverID, ISerializableObject aCoverVariable, ICoverable aTileEntity) { return letsRedstoneGoOutImpl(aSide, aCoverID, forceCast(aCoverVariable), aTileEntity); } @@ -201,77 +245,88 @@ public abstract class GT_CoverBehaviorBase<T extends ISerializableObject> { * <p/> * This is just Informative so that Machines know if their Redstone Input is blocked or not */ - public final boolean letsFibreGoIn(byte aSide, int aCoverID, ISerializableObject aCoverVariable, ICoverable aTileEntity) { + public final boolean letsFibreGoIn( + byte aSide, int aCoverID, ISerializableObject aCoverVariable, ICoverable aTileEntity) { return letsFibreGoInImpl(aSide, aCoverID, forceCast(aCoverVariable), aTileEntity); } /** * If it lets Fibre-Signals out of the Block */ - public final boolean letsFibreGoOut(byte aSide, int aCoverID, ISerializableObject aCoverVariable, ICoverable aTileEntity) { + public final boolean letsFibreGoOut( + byte aSide, int aCoverID, ISerializableObject aCoverVariable, ICoverable aTileEntity) { return letsFibreGoOutImpl(aSide, aCoverID, forceCast(aCoverVariable), aTileEntity); } /** * If it lets Energy into the Block */ - public final boolean letsEnergyIn(byte aSide, int aCoverID, ISerializableObject aCoverVariable, ICoverable aTileEntity) { + public final boolean letsEnergyIn( + byte aSide, int aCoverID, ISerializableObject aCoverVariable, ICoverable aTileEntity) { return letsEnergyInImpl(aSide, aCoverID, forceCast(aCoverVariable), aTileEntity); } /** * If it lets Energy out of the Block */ - public final boolean letsEnergyOut(byte aSide, int aCoverID, ISerializableObject aCoverVariable, ICoverable aTileEntity) { + public final boolean letsEnergyOut( + byte aSide, int aCoverID, ISerializableObject aCoverVariable, ICoverable aTileEntity) { return letsEnergyOutImpl(aSide, aCoverID, forceCast(aCoverVariable), aTileEntity); } /** * If it lets Liquids into the Block, aFluid can be null meaning if this is generally allowing Fluids or not. */ - public final boolean letsFluidIn(byte aSide, int aCoverID, ISerializableObject aCoverVariable, Fluid aFluid, ICoverable aTileEntity) { + public final boolean letsFluidIn( + byte aSide, int aCoverID, ISerializableObject aCoverVariable, Fluid aFluid, ICoverable aTileEntity) { return letsFluidInImpl(aSide, aCoverID, forceCast(aCoverVariable), aFluid, aTileEntity); } /** * If it lets Liquids out of the Block, aFluid can be null meaning if this is generally allowing Fluids or not. */ - public final boolean letsFluidOut(byte aSide, int aCoverID, ISerializableObject aCoverVariable, Fluid aFluid, ICoverable aTileEntity) { + public final boolean letsFluidOut( + byte aSide, int aCoverID, ISerializableObject aCoverVariable, Fluid aFluid, ICoverable aTileEntity) { return letsFluidOutImpl(aSide, aCoverID, forceCast(aCoverVariable), aFluid, aTileEntity); } /** * If it lets Items into the Block, aSlot = -1 means if it is generally accepting Items (return false for no reaction at all), aSlot = -2 means if it would accept for all Slots Impl(return true to skip the Checks for each Slot). */ - public final boolean letsItemsIn(byte aSide, int aCoverID, ISerializableObject aCoverVariable, int aSlot, ICoverable aTileEntity) { + public final boolean letsItemsIn( + byte aSide, int aCoverID, ISerializableObject aCoverVariable, int aSlot, ICoverable aTileEntity) { return letsItemsInImpl(aSide, aCoverID, forceCast(aCoverVariable), aSlot, aTileEntity); } /** * If it lets Items out of the Block, aSlot = -1 means if it is generally accepting Items (return false for no reaction at all), aSlot = -2 means if it would accept for all Slots Impl(return true to skip the Checks for each Slot). */ - public final boolean letsItemsOut(byte aSide, int aCoverID, ISerializableObject aCoverVariable, int aSlot, ICoverable aTileEntity) { + public final boolean letsItemsOut( + byte aSide, int aCoverID, ISerializableObject aCoverVariable, int aSlot, ICoverable aTileEntity) { return letsItemsOutImpl(aSide, aCoverID, forceCast(aCoverVariable), aSlot, aTileEntity); } /** * If it lets you rightclick the Machine normally */ - public final boolean isGUIClickable(byte aSide, int aCoverID, ISerializableObject aCoverVariable, ICoverable aTileEntity) { + public final boolean isGUIClickable( + byte aSide, int aCoverID, ISerializableObject aCoverVariable, ICoverable aTileEntity) { return isGUIClickableImpl(aSide, aCoverID, forceCast(aCoverVariable), aTileEntity); } /** * Needs to return true for Covers, which have a Redstone Output on their Facing. */ - public final boolean manipulatesSidedRedstoneOutput(byte aSide, int aCoverID, ISerializableObject aCoverVariable, ICoverable aTileEntity) { + public final boolean manipulatesSidedRedstoneOutput( + byte aSide, int aCoverID, ISerializableObject aCoverVariable, ICoverable aTileEntity) { return manipulatesSidedRedstoneOutputImpl(aSide, aCoverID, forceCast(aCoverVariable), aTileEntity); } /** * if this Cover should let Pipe Connections look connected even if it is not the case. */ - public final boolean alwaysLookConnected(byte aSide, int aCoverID, ISerializableObject aCoverVariable, ICoverable aTileEntity) { + public final boolean alwaysLookConnected( + byte aSide, int aCoverID, ISerializableObject aCoverVariable, ICoverable aTileEntity) { return alwaysLookConnectedImpl(aSide, aCoverID, forceCast(aCoverVariable), aTileEntity); } @@ -280,7 +335,8 @@ public abstract class GT_CoverBehaviorBase<T extends ISerializableObject> { * Returns the original Redstone per default. * The Cover should @letsRedstoneGoIn or the aInputRedstone Parameter is always 0. */ - public final byte getRedstoneInput(byte aSide, byte aInputRedstone, int aCoverID, ISerializableObject aCoverVariable, ICoverable aTileEntity) { + public final byte getRedstoneInput( + byte aSide, byte aInputRedstone, int aCoverID, ISerializableObject aCoverVariable, ICoverable aTileEntity) { return getRedstoneInputImpl(aSide, aInputRedstone, aCoverID, forceCast(aCoverVariable), aTileEntity); } @@ -293,18 +349,19 @@ public abstract class GT_CoverBehaviorBase<T extends ISerializableObject> { return getTickRateImpl(aSide, aCoverID, forceCast(aCoverVariable), aTileEntity); } - /** * The MC Color of this Lens. -1 for no Color (meaning this isn't a Lens then). */ - public final byte getLensColor(byte aSide, int aCoverID, ISerializableObject aCoverVariable, ICoverable aTileEntity) { + public final byte getLensColor( + byte aSide, int aCoverID, ISerializableObject aCoverVariable, ICoverable aTileEntity) { return getLensColorImpl(aSide, aCoverID, forceCast(aCoverVariable), aTileEntity); } /** * @return the ItemStack dropped by this Cover */ - public final ItemStack getDrop(byte aSide, int aCoverID, ISerializableObject aCoverVariable, ICoverable aTileEntity) { + public final ItemStack getDrop( + byte aSide, int aCoverID, ISerializableObject aCoverVariable, ICoverable aTileEntity) { return getDropImpl(aSide, aCoverID, forceCast(aCoverVariable), aTileEntity); } // endregion @@ -331,21 +388,20 @@ public abstract class GT_CoverBehaviorBase<T extends ISerializableObject> { return false; } - protected void onDataChangedImpl(byte aSide, int aCoverID, T aCoverVariable, ICoverable aTileEntity) { - } - + protected void onDataChangedImpl(byte aSide, int aCoverID, T aCoverVariable, ICoverable aTileEntity) {} - protected void onDroppedImpl(byte aSide, int aCoverID, T aCoverVariable, ICoverable aTileEntity) { - } + protected void onDroppedImpl(byte aSide, int aCoverID, T aCoverVariable, ICoverable aTileEntity) {} - protected boolean isRedstoneSensitiveImpl(byte aSide, int aCoverID, T aCoverVariable, ICoverable aTileEntity, long aTimer) { + protected boolean isRedstoneSensitiveImpl( + byte aSide, int aCoverID, T aCoverVariable, ICoverable aTileEntity, long aTimer) { return true; } /** * Called by updateEntity inside the covered TileEntity. aCoverVariable is the Value you returned last time. */ - protected T doCoverThingsImpl(byte aSide, byte aInputRedstone, int aCoverID, T aCoverVariable, ICoverable aTileEntity, long aTimer) { + protected T doCoverThingsImpl( + byte aSide, byte aInputRedstone, int aCoverID, T aCoverVariable, ICoverable aTileEntity, long aTimer) { return aCoverVariable; } @@ -354,7 +410,15 @@ public abstract class GT_CoverBehaviorBase<T extends ISerializableObject> { * <p/> * return true, if something actually happens. */ - protected boolean onCoverRightClickImpl(byte aSide, int aCoverID, T aCoverVariable, ICoverable aTileEntity, EntityPlayer aPlayer, float aX, float aY, float aZ) { + protected boolean onCoverRightClickImpl( + byte aSide, + int aCoverID, + T aCoverVariable, + ICoverable aTileEntity, + EntityPlayer aPlayer, + float aX, + float aY, + float aZ) { return false; } @@ -363,23 +427,36 @@ public abstract class GT_CoverBehaviorBase<T extends ISerializableObject> { * <p/> * return the new Value of the Cover Variable */ - protected T onCoverScrewdriverClickImpl(byte aSide, int aCoverID, T aCoverVariable, ICoverable aTileEntity, EntityPlayer aPlayer, float aX, float aY, float aZ) { + protected T onCoverScrewdriverClickImpl( + byte aSide, + int aCoverID, + T aCoverVariable, + ICoverable aTileEntity, + EntityPlayer aPlayer, + float aX, + float aY, + float aZ) { return aCoverVariable; } /** * Called when someone shift-rightclicks this Cover with no tool. Doesn't call @onCoverRightclick in this Case. */ - protected boolean onCoverShiftRightClickImpl(byte aSide, int aCoverID, T aCoverVariable, ICoverable aTileEntity, EntityPlayer aPlayer) { + protected boolean onCoverShiftRightClickImpl( + byte aSide, int aCoverID, T aCoverVariable, ICoverable aTileEntity, EntityPlayer aPlayer) { if (hasCoverGUI() && aPlayer instanceof EntityPlayerMP) { lastPlayer = aPlayer; - GT_Values.NW.sendToPlayer(new GT_Packet_TileEntityCoverGUI(aSide, aCoverID, aCoverVariable, aTileEntity, (EntityPlayerMP) aPlayer), (EntityPlayerMP) aPlayer); + GT_Values.NW.sendToPlayer( + new GT_Packet_TileEntityCoverGUI( + aSide, aCoverID, aCoverVariable, aTileEntity, (EntityPlayerMP) aPlayer), + (EntityPlayerMP) aPlayer); return true; } return false; } - protected Object getClientGUIImpl(byte aSide, int aCoverID, T aCoverVariable, ICoverable aTileEntity, EntityPlayer aPlayer, World aWorld) { + protected Object getClientGUIImpl( + byte aSide, int aCoverID, T aCoverVariable, ICoverable aTileEntity, EntityPlayer aPlayer, World aWorld) { return null; } @@ -387,7 +464,8 @@ public abstract class GT_CoverBehaviorBase<T extends ISerializableObject> { * Removes the Cover if this returns true, or if aForced is true. * Doesn't get called when the Machine Block is getting broken, only if you break the Cover away from the Machine. */ - protected boolean onCoverRemovalImpl(byte aSide, int aCoverID, T aCoverVariable, ICoverable aTileEntity, boolean aForced) { + protected boolean onCoverRemovalImpl( + byte aSide, int aCoverID, T aCoverVariable, ICoverable aTileEntity, boolean aForced) { return true; } @@ -454,14 +532,16 @@ public abstract class GT_CoverBehaviorBase<T extends ISerializableObject> { /** * If it lets Liquids into the Block, aFluid can be null meaning if this is generally allowing Fluids or not. */ - protected boolean letsFluidInImpl(byte aSide, int aCoverID, T aCoverVariable, Fluid aFluid, ICoverable aTileEntity) { + protected boolean letsFluidInImpl( + byte aSide, int aCoverID, T aCoverVariable, Fluid aFluid, ICoverable aTileEntity) { return false; } /** * If it lets Liquids out of the Block, aFluid can be null meaning if this is generally allowing Fluids or not. */ - protected boolean letsFluidOutImpl(byte aSide, int aCoverID, T aCoverVariable, Fluid aFluid, ICoverable aTileEntity) { + protected boolean letsFluidOutImpl( + byte aSide, int aCoverID, T aCoverVariable, Fluid aFluid, ICoverable aTileEntity) { return false; } @@ -489,7 +569,8 @@ public abstract class GT_CoverBehaviorBase<T extends ISerializableObject> { /** * Needs to return true for Covers, which have a Redstone Output on their Facing. */ - protected boolean manipulatesSidedRedstoneOutputImpl(byte aSide, int aCoverID, T aCoverVariable, ICoverable aTileEntity) { + protected boolean manipulatesSidedRedstoneOutputImpl( + byte aSide, int aCoverID, T aCoverVariable, ICoverable aTileEntity) { return false; } @@ -505,7 +586,8 @@ public abstract class GT_CoverBehaviorBase<T extends ISerializableObject> { * Returns the original Redstone per default. * The Cover should @letsRedstoneGoIn or the aInputRedstone Parameter is always 0. */ - protected byte getRedstoneInputImpl(byte aSide, byte aInputRedstone, int aCoverID, T aCoverVariable, ICoverable aTileEntity) { + protected byte getRedstoneInputImpl( + byte aSide, byte aInputRedstone, int aCoverID, T aCoverVariable, ICoverable aTileEntity) { return letsRedstoneGoIn(aSide, aCoverID, aCoverVariable, aTileEntity) ? aInputRedstone : 0; } @@ -518,7 +600,6 @@ public abstract class GT_CoverBehaviorBase<T extends ISerializableObject> { return 0; } - /** * The MC Color of this Lens. -1 for no Color (meaning this isn't a Lens then). */ @@ -533,7 +614,7 @@ public abstract class GT_CoverBehaviorBase<T extends ISerializableObject> { return GT_OreDictUnificator.get(true, aTileEntity.getCoverItemAtSide(aSide)); } - //endregion + // endregion // region no data @@ -561,7 +642,8 @@ public abstract class GT_CoverBehaviorBase<T extends ISerializableObject> { * <p/> * return true, if something actually happens. */ - public boolean onCoverRightclickClient(byte aSide, ICoverable aTileEntity, EntityPlayer aPlayer, float aX, float aY, float aZ) { + public boolean onCoverRightclickClient( + byte aSide, ICoverable aTileEntity, EntityPlayer aPlayer, float aX, float aY, float aZ) { return false; } diff --git a/src/main/java/gregtech/api/util/GT_ExoticEnergyInputHelper.java b/src/main/java/gregtech/api/util/GT_ExoticEnergyInputHelper.java index 01614a0704..76cdb13f78 100644 --- a/src/main/java/gregtech/api/util/GT_ExoticEnergyInputHelper.java +++ b/src/main/java/gregtech/api/util/GT_ExoticEnergyInputHelper.java @@ -1,75 +1,77 @@ package gregtech.api.util; +import static gregtech.api.metatileentity.implementations.GT_MetaTileEntity_MultiBlockBase.isValidMetaTileEntity; + import gregtech.api.interfaces.metatileentity.IMetaTileEntity; import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch; - import java.util.ArrayList; import java.util.Collection; import java.util.Collections; import java.util.List; -import static gregtech.api.metatileentity.implementations.GT_MetaTileEntity_MultiBlockBase.isValidMetaTileEntity; - public class GT_ExoticEnergyInputHelper { - /** - * The Valid Types of TecTech Hatch List. - */ - private static final List<Class<? extends GT_MetaTileEntity_Hatch>> sExoticEnergyHatchType = new ArrayList<>(); + /** + * The Valid Types of TecTech Hatch List. + */ + private static final List<Class<? extends GT_MetaTileEntity_Hatch>> sExoticEnergyHatchType = new ArrayList<>(); - static { - tryRegister("com.github.technus.tectech.thing.metaTileEntity.hatch.GT_MetaTileEntity_Hatch_EnergyMulti"); - tryRegister("com.github.technus.tectech.thing.metaTileEntity.hatch.GT_MetaTileEntity_Hatch_EnergyTunnel"); - } + static { + tryRegister("com.github.technus.tectech.thing.metaTileEntity.hatch.GT_MetaTileEntity_Hatch_EnergyMulti"); + tryRegister("com.github.technus.tectech.thing.metaTileEntity.hatch.GT_MetaTileEntity_Hatch_EnergyTunnel"); + } - public static void register(Class<? extends GT_MetaTileEntity_Hatch> clazz) { - if (!GT_MetaTileEntity_Hatch.class.isAssignableFrom(clazz)) - throw new IllegalArgumentException(clazz.getName() + " is not a subclass of " + GT_MetaTileEntity_Hatch.class.getName()); - sExoticEnergyHatchType.add(clazz); - } + public static void register(Class<? extends GT_MetaTileEntity_Hatch> clazz) { + if (!GT_MetaTileEntity_Hatch.class.isAssignableFrom(clazz)) + throw new IllegalArgumentException( + clazz.getName() + " is not a subclass of " + GT_MetaTileEntity_Hatch.class.getName()); + sExoticEnergyHatchType.add(clazz); + } - @SuppressWarnings("unchecked") + @SuppressWarnings("unchecked") public static void tryRegister(String className) { - Class<?> clazz; - try { - clazz = Class.forName(className); - } catch (ClassNotFoundException e) { - return; - } - if (!GT_MetaTileEntity_Hatch.class.isAssignableFrom(clazz)) - throw new IllegalArgumentException(clazz.getName() + " is not a subclass of " + GT_MetaTileEntity_Hatch.class.getName()); - sExoticEnergyHatchType.add((Class<? extends GT_MetaTileEntity_Hatch>) clazz); - } + Class<?> clazz; + try { + clazz = Class.forName(className); + } catch (ClassNotFoundException e) { + return; + } + if (!GT_MetaTileEntity_Hatch.class.isAssignableFrom(clazz)) + throw new IllegalArgumentException( + clazz.getName() + " is not a subclass of " + GT_MetaTileEntity_Hatch.class.getName()); + sExoticEnergyHatchType.add((Class<? extends GT_MetaTileEntity_Hatch>) clazz); + } - 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); - aEU -= tDrain; - } - return aEU <= 0; - } + 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); + aEU -= tDrain; + } + return aEU <= 0; + } - public static boolean isExoticEnergyInput(IMetaTileEntity aHatch) { - for (Class<?> clazz : sExoticEnergyHatchType) { - if (clazz.isInstance(aHatch)) - return true; - } - return false; - } + public static boolean isExoticEnergyInput(IMetaTileEntity aHatch) { + for (Class<?> clazz : sExoticEnergyHatchType) { + if (clazz.isInstance(aHatch)) return true; + } + return false; + } - 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(); - return rVoltage; - } + 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(); + return rVoltage; + } - 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(); - return rAmp; - } + 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(); + return rAmp; + } public static List<Class<? extends GT_MetaTileEntity_Hatch>> getAllClasses() { return Collections.unmodifiableList(sExoticEnergyHatchType); diff --git a/src/main/java/gregtech/api/util/GT_FoodStat.java b/src/main/java/gregtech/api/util/GT_FoodStat.java index 87c38a8073..f9a0f50c5f 100644 --- a/src/main/java/gregtech/api/util/GT_FoodStat.java +++ b/src/main/java/gregtech/api/util/GT_FoodStat.java @@ -32,7 +32,15 @@ public class GT_FoodStat implements IFoodStat { * Level of the Effect. [0, 1, 2] are for [I, II, III] * The likelihood that this Potion Effect takes place upon being eaten [1 - 100] */ - public GT_FoodStat(int aFoodLevel, float aSaturation, EnumAction aAction, ItemStack aEmptyContainer, boolean aAlwaysEdible, boolean aInvisibleParticles, boolean aIsRotten, int... aPotionEffects) { + public GT_FoodStat( + int aFoodLevel, + float aSaturation, + EnumAction aAction, + ItemStack aEmptyContainer, + boolean aAlwaysEdible, + boolean aInvisibleParticles, + boolean aIsRotten, + int... aPotionEffects) { mFoodLevel = aFoodLevel; mSaturation = aSaturation; mAction = aAction == null ? EnumAction.eat : aAction; @@ -84,7 +92,8 @@ public class GT_FoodStat implements IFoodStat { } for (int i = 3; i < mPotionEffects.length; i += 4) { if (aPlayer.worldObj.rand.nextInt(100) < mPotionEffects[i]) { - aPlayer.addPotionEffect(new PotionEffect(mPotionEffects[i - 3], mPotionEffects[i - 2], mPotionEffects[i - 1], mInvisibleParticles)); + aPlayer.addPotionEffect(new PotionEffect( + mPotionEffects[i - 3], mPotionEffects[i - 2], mPotionEffects[i - 1], mInvisibleParticles)); } } if (mExplosive) { 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 c59e551373..6e73c099cb 100644 --- a/src/main/java/gregtech/api/util/GT_Forestry_Compat.java +++ b/src/main/java/gregtech/api/util/GT_Forestry_Compat.java @@ -6,44 +6,124 @@ import forestry.api.recipes.RecipeManagers; import gregtech.api.enums.GT_Values; import gregtech.api.enums.ItemList; import gregtech.api.enums.Materials; +import java.util.Map; import net.minecraft.item.ItemStack; import net.minecraftforge.fluids.FluidStack; -import java.util.Map; - public class GT_Forestry_Compat { - - public static void populateFakeNeiRecipes(){ + + public static void populateFakeNeiRecipes() { if (ItemList.FR_Bee_Drone.get(1L) != null) { - GT_Recipe.GT_Recipe_Map.sScannerFakeRecipes.addFakeRecipe(false, new ItemStack[]{ItemList.FR_Bee_Drone.getWildcard(1L)}, new ItemStack[]{ItemList.FR_Bee_Drone.getWithName(1L, "Scanned Drone")}, null, new FluidStack[]{Materials.Honey.getFluid(100L)}, null, 500, 2, 0); + GT_Recipe.GT_Recipe_Map.sScannerFakeRecipes.addFakeRecipe( + false, + new ItemStack[] {ItemList.FR_Bee_Drone.getWildcard(1L)}, + new ItemStack[] {ItemList.FR_Bee_Drone.getWithName(1L, "Scanned Drone")}, + null, + new FluidStack[] {Materials.Honey.getFluid(100L)}, + null, + 500, + 2, + 0); } if (ItemList.FR_Bee_Princess.get(1L) != null) { - GT_Recipe.GT_Recipe_Map.sScannerFakeRecipes.addFakeRecipe(false, new ItemStack[]{ItemList.FR_Bee_Princess.getWildcard(1L)}, new ItemStack[]{ItemList.FR_Bee_Princess.getWithName(1L, "Scanned Princess")}, null, new FluidStack[]{Materials.Honey.getFluid(100L)}, null, 500, 2, 0); + GT_Recipe.GT_Recipe_Map.sScannerFakeRecipes.addFakeRecipe( + false, + new ItemStack[] {ItemList.FR_Bee_Princess.getWildcard(1L)}, + new ItemStack[] {ItemList.FR_Bee_Princess.getWithName(1L, "Scanned Princess")}, + null, + new FluidStack[] {Materials.Honey.getFluid(100L)}, + null, + 500, + 2, + 0); } if (ItemList.FR_Bee_Queen.get(1L) != null) { - GT_Recipe.GT_Recipe_Map.sScannerFakeRecipes.addFakeRecipe(false, new ItemStack[]{ItemList.FR_Bee_Queen.getWildcard(1L)}, new ItemStack[]{ItemList.FR_Bee_Queen.getWithName(1L, "Scanned Queen")}, null, new FluidStack[]{Materials.Honey.getFluid(100L)}, null, 500, 2, 0); + GT_Recipe.GT_Recipe_Map.sScannerFakeRecipes.addFakeRecipe( + false, + new ItemStack[] {ItemList.FR_Bee_Queen.getWildcard(1L)}, + new ItemStack[] {ItemList.FR_Bee_Queen.getWithName(1L, "Scanned Queen")}, + null, + new FluidStack[] {Materials.Honey.getFluid(100L)}, + null, + 500, + 2, + 0); } if (ItemList.FR_Tree_Sapling.get(1L) != null) { - GT_Recipe.GT_Recipe_Map.sScannerFakeRecipes.addFakeRecipe(false, new ItemStack[]{ItemList.FR_Tree_Sapling.getWildcard(1L)}, new ItemStack[]{ItemList.FR_Tree_Sapling.getWithName(1L, "Scanned Sapling")}, null, new FluidStack[]{Materials.Honey.getFluid(100L)}, null, 500, 2, 0); + GT_Recipe.GT_Recipe_Map.sScannerFakeRecipes.addFakeRecipe( + false, + new ItemStack[] {ItemList.FR_Tree_Sapling.getWildcard(1L)}, + new ItemStack[] {ItemList.FR_Tree_Sapling.getWithName(1L, "Scanned Sapling")}, + null, + new FluidStack[] {Materials.Honey.getFluid(100L)}, + null, + 500, + 2, + 0); } if (ItemList.FR_Butterfly.get(1L) != null) { - GT_Recipe.GT_Recipe_Map.sScannerFakeRecipes.addFakeRecipe(false, new ItemStack[]{ItemList.FR_Butterfly.getWildcard(1L)}, new ItemStack[]{ItemList.FR_Butterfly.getWithName(1L, "Scanned Butterfly")}, null, new FluidStack[]{Materials.Honey.getFluid(100L)}, null, 500, 2, 0); + GT_Recipe.GT_Recipe_Map.sScannerFakeRecipes.addFakeRecipe( + false, + new ItemStack[] {ItemList.FR_Butterfly.getWildcard(1L)}, + new ItemStack[] {ItemList.FR_Butterfly.getWithName(1L, "Scanned Butterfly")}, + null, + new FluidStack[] {Materials.Honey.getFluid(100L)}, + null, + 500, + 2, + 0); } if (ItemList.FR_Larvae.get(1L) != null) { - GT_Recipe.GT_Recipe_Map.sScannerFakeRecipes.addFakeRecipe(false, new ItemStack[]{ItemList.FR_Larvae.getWildcard(1L)}, new ItemStack[]{ItemList.FR_Larvae.getWithName(1L, "Scanned Larvae")}, null, new FluidStack[]{Materials.Honey.getFluid(100L)}, null, 500, 2, 0); + GT_Recipe.GT_Recipe_Map.sScannerFakeRecipes.addFakeRecipe( + false, + new ItemStack[] {ItemList.FR_Larvae.getWildcard(1L)}, + new ItemStack[] {ItemList.FR_Larvae.getWithName(1L, "Scanned Larvae")}, + null, + new FluidStack[] {Materials.Honey.getFluid(100L)}, + null, + 500, + 2, + 0); } if (ItemList.FR_Serum.get(1L) != null) { - GT_Recipe.GT_Recipe_Map.sScannerFakeRecipes.addFakeRecipe(false, new ItemStack[]{ItemList.FR_Serum.getWildcard(1L)}, new ItemStack[]{ItemList.FR_Serum.getWithName(1L, "Scanned Serum")}, null, new FluidStack[]{Materials.Honey.getFluid(100L)}, null, 500, 2, 0); + GT_Recipe.GT_Recipe_Map.sScannerFakeRecipes.addFakeRecipe( + false, + new ItemStack[] {ItemList.FR_Serum.getWildcard(1L)}, + new ItemStack[] {ItemList.FR_Serum.getWithName(1L, "Scanned Serum")}, + null, + new FluidStack[] {Materials.Honey.getFluid(100L)}, + null, + 500, + 2, + 0); } if (ItemList.FR_Caterpillar.get(1L) != null) { - GT_Recipe.GT_Recipe_Map.sScannerFakeRecipes.addFakeRecipe(false, new ItemStack[]{ItemList.FR_Caterpillar.getWildcard(1L)}, new ItemStack[]{ItemList.FR_Caterpillar.getWithName(1L, "Scanned Caterpillar")}, null, new FluidStack[]{Materials.Honey.getFluid(100L)}, null, 500, 2, 0); + GT_Recipe.GT_Recipe_Map.sScannerFakeRecipes.addFakeRecipe( + false, + new ItemStack[] {ItemList.FR_Caterpillar.getWildcard(1L)}, + new ItemStack[] {ItemList.FR_Caterpillar.getWithName(1L, "Scanned Caterpillar")}, + null, + new FluidStack[] {Materials.Honey.getFluid(100L)}, + null, + 500, + 2, + 0); } if (ItemList.FR_PollenFertile.get(1L) != null) { - GT_Recipe.GT_Recipe_Map.sScannerFakeRecipes.addFakeRecipe(false, new ItemStack[]{ItemList.FR_PollenFertile.getWildcard(1L)}, new ItemStack[]{ItemList.FR_PollenFertile.getWithName(1L, "Scanned Pollen")}, null, new FluidStack[]{Materials.Honey.getFluid(100L)}, null, 500, 2, 0); + GT_Recipe.GT_Recipe_Map.sScannerFakeRecipes.addFakeRecipe( + false, + new ItemStack[] {ItemList.FR_PollenFertile.getWildcard(1L)}, + new ItemStack[] {ItemList.FR_PollenFertile.getWithName(1L, "Scanned Pollen")}, + null, + new FluidStack[] {Materials.Honey.getFluid(100L)}, + null, + 500, + 2, + 0); } } - - public static void transferCentrifugeRecipes(){ + + public static void transferCentrifugeRecipes() { try { for (ICentrifugeRecipe tRecipe : RecipeManagers.centrifugeManager.recipes()) { Map<ItemStack, Float> outputs = tRecipe.getAllProducts(); @@ -55,7 +135,8 @@ public class GT_Forestry_Compat { tOutputs[i] = entry.getKey().copy(); i++; } - GT_Recipe.GT_Recipe_Map.sCentrifugeRecipes.addRecipe(true, new ItemStack[]{tRecipe.getInput()}, tOutputs, null, tChances, null, null, 128, 5, 0); + GT_Recipe.GT_Recipe_Map.sCentrifugeRecipes.addRecipe( + true, new ItemStack[] {tRecipe.getInput()}, tOutputs, null, tChances, null, null, 128, 5, 0); } } catch (Throwable e) { if (GT_Values.D1) { @@ -63,12 +144,22 @@ public class GT_Forestry_Compat { } } } - - public static void transferSqueezerRecipes(){ + + public static void transferSqueezerRecipes() { try { for (ISqueezerRecipe tRecipe : RecipeManagers.squeezerManager.recipes()) { if ((tRecipe.getResources().length == 1) && (tRecipe.getFluidOutput() != null)) { - GT_Recipe.GT_Recipe_Map.sFluidExtractionRecipes.addRecipe(true, new ItemStack[]{tRecipe.getResources()[0]}, new ItemStack[]{tRecipe.getRemnants()}, null, new int[]{(int) (tRecipe.getRemnantsChance() * 10000)}, null, new FluidStack[]{tRecipe.getFluidOutput()}, 32, 8, 0); + GT_Recipe.GT_Recipe_Map.sFluidExtractionRecipes.addRecipe( + true, + new ItemStack[] {tRecipe.getResources()[0]}, + new ItemStack[] {tRecipe.getRemnants()}, + null, + new int[] {(int) (tRecipe.getRemnantsChance() * 10000)}, + null, + new FluidStack[] {tRecipe.getFluidOutput()}, + 32, + 8, + 0); } } } catch (Throwable e) { 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 8131e3affb..60e0e2649d 100644 --- a/src/main/java/gregtech/api/util/GT_GC_Compat.java +++ b/src/main/java/gregtech/api/util/GT_GC_Compat.java @@ -15,16 +15,20 @@ public class GT_GC_Compat { public static long insertEnergyInto(TileEntity tTileEntity, long aVoltage, ForgeDirection tDirection) { // GC Compat if (GregTech_API.mGalacticraft && tTileEntity instanceof IEnergyHandlerGC) { - if (!(tTileEntity instanceof IConnector) || ((IConnector)tTileEntity).canConnect(tDirection, NetworkType.POWER)) { + if (!(tTileEntity instanceof IConnector) + || ((IConnector) tTileEntity).canConnect(tDirection, NetworkType.POWER)) { EnergySource eSource = new EnergySourceAdjacent(tDirection); - float tSizeToReceive = aVoltage * EnergyConfigHandler.IC2_RATIO, tStored = ((IEnergyHandlerGC)tTileEntity).getEnergyStoredGC(eSource); - if (tSizeToReceive >= tStored || tSizeToReceive <= ((IEnergyHandlerGC)tTileEntity).getMaxEnergyStoredGC(eSource) - tStored) { - float tReceived = ((IEnergyHandlerGC)tTileEntity).receiveEnergyGC(eSource, tSizeToReceive, false); + float tSizeToReceive = aVoltage * EnergyConfigHandler.IC2_RATIO, + tStored = ((IEnergyHandlerGC) tTileEntity).getEnergyStoredGC(eSource); + if (tSizeToReceive >= tStored + || tSizeToReceive <= ((IEnergyHandlerGC) tTileEntity).getMaxEnergyStoredGC(eSource) - tStored) { + float tReceived = ((IEnergyHandlerGC) tTileEntity).receiveEnergyGC(eSource, tSizeToReceive, false); 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; } @@ -37,11 +41,12 @@ public class GT_GC_Compat { return 2; } - public static boolean canConnect(TileEntity tTileEntity,ForgeDirection tDirection){ + public static boolean canConnect(TileEntity tTileEntity, ForgeDirection tDirection) { // GC Compat - if (GregTech_API.mGalacticraft && tTileEntity instanceof IEnergyHandlerGC && (!(tTileEntity instanceof IConnector) || ((IConnector)tTileEntity).canConnect(tDirection, NetworkType.POWER))) - return true; + if (GregTech_API.mGalacticraft + && tTileEntity instanceof IEnergyHandlerGC + && (!(tTileEntity instanceof IConnector) + || ((IConnector) tTileEntity).canConnect(tDirection, NetworkType.POWER))) return true; return false; } - } diff --git a/src/main/java/gregtech/api/util/GT_HatchElementBuilder.java b/src/main/java/gregtech/api/util/GT_HatchElementBuilder.java index 35a132da68..98f4f39297 100644 --- a/src/main/java/gregtech/api/util/GT_HatchElementBuilder.java +++ b/src/main/java/gregtech/api/util/GT_HatchElementBuilder.java @@ -1,5 +1,7 @@ package gregtech.api.util; +import static com.gtnewhorizon.structurelib.structure.StructureUtility.ofBlock; + import com.gtnewhorizon.structurelib.StructureLibAPI; import com.gtnewhorizon.structurelib.structure.*; import com.gtnewhorizon.structurelib.util.ItemStackPredicate; @@ -10,6 +12,9 @@ import gregtech.api.interfaces.IHatchElement; import gregtech.api.interfaces.metatileentity.IMetaTileEntity; import gregtech.api.interfaces.tileentity.IGregTechTileEntity; import gregtech.common.blocks.GT_Item_Machines; +import java.util.*; +import java.util.function.*; +import java.util.stream.Collectors; import net.minecraft.block.Block; import net.minecraft.entity.player.EntityPlayerMP; import net.minecraft.item.ItemStack; @@ -18,16 +23,8 @@ import net.minecraft.util.ChatComponentTranslation; import net.minecraft.util.IChatComponent; import net.minecraft.world.World; -import java.util.*; -import java.util.function.*; -import java.util.stream.Collectors; - -import static com.gtnewhorizon.structurelib.structure.StructureUtility.ofBlock; -import static com.gtnewhorizon.structurelib.structure.StructureUtility.ofChain; - public class GT_HatchElementBuilder<T> { - private interface Builtin { - } + private interface Builtin {} private IGT_HatchAdder<? super T> mAdder; private int mCasingIndex = -1; @@ -39,8 +36,7 @@ public class GT_HatchElementBuilder<T> { private boolean mCacheHint; private boolean mNoStop; - private GT_HatchElementBuilder() { - } + private GT_HatchElementBuilder() {} public static <T> GT_HatchElementBuilder<T> builder() { return new GT_HatchElementBuilder<>(); @@ -55,9 +51,18 @@ 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 ", ""))); } /** @@ -69,7 +74,8 @@ public class GT_HatchElementBuilder<T> { @SafeVarargs 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()))); + return atLeast(Arrays.stream(elements) + .collect(Collectors.groupingBy(Function.identity(), LinkedHashMap::new, Collectors.counting()))); } /** @@ -80,7 +86,8 @@ 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()))); + return atLeast(elements.stream() + .collect(Collectors.groupingBy(Function.identity(), LinkedHashMap::new, Collectors.counting()))); } /** @@ -90,20 +97,32 @@ 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 ", ""))); + 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 ", ""))); } - //endregion + // endregion - //region primitives + // region primitives public GT_HatchElementBuilder<T> adder(IGT_HatchAdder<? super T> aAdder) { if (aAdder == null) throw new IllegalArgumentException(); @@ -132,9 +151,10 @@ public class GT_HatchElementBuilder<T> { return this; } - // avoid loooooong lines like - // shouldSkip((BiPredicate<.....> & Builtin) (c, t) -> ....) - // private <P extends BiPredicate<? super T, ? super IGregTechTileEntity> & Builtin> GT_HatchElementBuilder<T> shouldSkipInternal(P aShouldSkip) { + // avoid loooooong lines like + // shouldSkip((BiPredicate<.....> & Builtin) (c, t) -> ....) + // private <P extends BiPredicate<? super T, ? super IGregTechTileEntity> & Builtin> GT_HatchElementBuilder<T> + // shouldSkipInternal(P aShouldSkip) { // if (mShouldSkip == null) mShouldSkip = aShouldSkip; // return this; // } @@ -146,26 +166,30 @@ public class GT_HatchElementBuilder<T> { return this; } - public GT_HatchElementBuilder<T> hatchItemFilter(Function<? super T, ? extends Predicate<ItemStack>> aHatchItemFilter) { + public GT_HatchElementBuilder<T> hatchItemFilter( + Function<? super T, ? extends Predicate<ItemStack>> aHatchItemFilter) { if (aHatchItemFilter == null) throw new IllegalArgumentException(); mHatchItemFilter = (t, s) -> aHatchItemFilter.apply(t); return this; } - public GT_HatchElementBuilder<T> hatchItemFilterAnd(Function<? super T, ? extends Predicate<ItemStack>> aHatchItemFilter) { + public GT_HatchElementBuilder<T> hatchItemFilterAnd( + 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)); return this; } - public GT_HatchElementBuilder<T> hatchItemFilter(BiFunction<? super T, ItemStack, ? extends Predicate<ItemStack>> aHatchItemFilter) { + public GT_HatchElementBuilder<T> hatchItemFilter( + BiFunction<? super T, ItemStack, ? extends Predicate<ItemStack>> aHatchItemFilter) { if (aHatchItemFilter == null) throw new IllegalArgumentException(); mHatchItemFilter = aHatchItemFilter; return this; } - public GT_HatchElementBuilder<T> hatchItemFilterAnd(BiFunction<? super T, ItemStack, ? extends Predicate<ItemStack>> aHatchItemFilter) { + public GT_HatchElementBuilder<T> hatchItemFilterAnd( + 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)); @@ -208,8 +232,9 @@ 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())); + .cacheHint(() -> "of class " + clazz.getSimpleName()) + .shouldSkip((BiPredicate<? super T, ? super IGregTechTileEntity> & Builtin) + (c, t) -> clazz.isInstance(t.getMetaTileEntity())); } @SafeVarargs @@ -220,26 +245,39 @@ 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()))); + .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); + 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); } public GT_HatchElementBuilder<T> hatchIds(int... aIds) { if (aIds == null || aIds.length == 0) throw new IllegalArgumentException(); if (aIds.length == 1) return hatchId(aIds[0]); 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())); + 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())); } - //endregion + // endregion @SuppressWarnings("unchecked") @SafeVarargs @@ -265,7 +303,8 @@ public class GT_HatchElementBuilder<T> { @Override public boolean check(T t, World world, int x, int y, int z) { TileEntity tileEntity = world.getTileEntity(x, y, z); - return tileEntity instanceof IGregTechTileEntity && mAdder.apply(t, (IGregTechTileEntity) tileEntity, (short) mCasingIndex); + return tileEntity instanceof IGregTechTileEntity + && mAdder.apply(t, (IGregTechTileEntity) tileEntity, (short) mCasingIndex); } @Override @@ -281,7 +320,8 @@ public class GT_HatchElementBuilder<T> { @Override public boolean check(T t, World world, int x, int y, int z) { TileEntity tileEntity = world.getTileEntity(x, y, z); - return tileEntity instanceof IGregTechTileEntity && mAdder.apply(t, (IGregTechTileEntity) tileEntity, (short) mCasingIndex); + return tileEntity instanceof IGregTechTileEntity + && mAdder.apply(t, (IGregTechTileEntity) tileEntity, (short) mCasingIndex); } @Override @@ -312,14 +352,22 @@ public class GT_HatchElementBuilder<T> { } @Override - public PlaceResult survivalPlaceBlock(T t, World world, int x, int y, int z, ItemStack trigger, IItemSource s, EntityPlayerMP actor, Consumer<IChatComponent> chatter) { + public PlaceResult survivalPlaceBlock( + T t, + World world, + int x, + int y, + int z, + ItemStack trigger, + IItemSource s, + EntityPlayerMP actor, + Consumer<IChatComponent> chatter) { if (mShouldSkip != null) { TileEntity tileEntity = world.getTileEntity(x, y, z); - if (tileEntity instanceof IGregTechTileEntity && mShouldSkip.test(t, (IGregTechTileEntity) tileEntity)) - return PlaceResult.SKIP; + if (tileEntity instanceof IGregTechTileEntity + && mShouldSkip.test(t, (IGregTechTileEntity) tileEntity)) return PlaceResult.SKIP; } - if (!StructureLibAPI.isBlockTriviallyReplaceable(world, x, y, z, actor)) - return PlaceResult.REJECT; + if (!StructureLibAPI.isBlockTriviallyReplaceable(world, x, y, z, actor)) return PlaceResult.REJECT; if (mReject != null && mReject.test(t)) return PlaceResult.REJECT; ItemStack taken = s.takeOne(mHatchItemFilter.apply(t, trigger), true); if (GT_Utility.isStackInvalid(taken)) { @@ -327,7 +375,11 @@ public class GT_HatchElementBuilder<T> { chatter.accept(new ChatComponentTranslation("GT5U.autoplace.error.no_hatch", type)); return PlaceResult.REJECT; } - return StructureUtility.survivalPlaceBlock(taken, ItemStackPredicate.NBTMode.IGNORE, null, true, world, x, y, z, s, actor) == PlaceResult.ACCEPT ? (mNoStop ? PlaceResult.ACCEPT : PlaceResult.ACCEPT_STOP) : PlaceResult.REJECT; + return StructureUtility.survivalPlaceBlock( + taken, ItemStackPredicate.NBTMode.IGNORE, null, true, world, x, y, z, s, actor) + == PlaceResult.ACCEPT + ? (mNoStop ? PlaceResult.ACCEPT : PlaceResult.ACCEPT_STOP) + : PlaceResult.REJECT; } }; } diff --git a/src/main/java/gregtech/api/util/GT_ItsNotMyFaultException.java b/src/main/java/gregtech/api/util/GT_ItsNotMyFaultException.java index f742be20cb..174b4618e8 100644 --- a/src/main/java/gregtech/api/util/GT_ItsNotMyFaultException.java +++ b/src/main/java/gregtech/api/util/GT_ItsNotMyFaultException.java @@ -11,6 +11,7 @@ public class GT_ItsNotMyFaultException extends RuntimeException { @Override public String toString() { - return "The GregTech-Addon has a Problem.\nIT'S NOT MY FAULT!!! Below is how to fix it.\n" + mError + "\nDO NOT COME TO ME WITH THIS CRASH. YOU CAUSED IT YOURSELF, AND I TOLD YOU HOW TO FIX IT!!!"; + return "The GregTech-Addon has a Problem.\nIT'S NOT MY FAULT!!! Below is how to fix it.\n" + mError + + "\nDO NOT COME TO ME WITH THIS CRASH. YOU CAUSED IT YOURSELF, AND I TOLD YOU HOW TO FIX IT!!!"; } } diff --git a/src/main/java/gregtech/api/util/GT_LanguageManager.java b/src/main/java/gregtech/api/util/GT_LanguageManager.java index d6cd1553eb..50d0deeee7 100644 --- a/src/main/java/gregtech/api/util/GT_LanguageManager.java +++ b/src/main/java/gregtech/api/util/GT_LanguageManager.java @@ -1,57 +1,57 @@ package gregtech.api.util; +import static gregtech.api.enums.GT_Values.E; + import cpw.mods.fml.common.registry.LanguageRegistry; import cpw.mods.fml.relauncher.ReflectionHelper; import gregtech.api.GregTech_API; - +import java.lang.reflect.Field; +import java.util.HashMap; +import java.util.Map; +import java.util.Map.Entry; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.util.StatCollector; import net.minecraftforge.common.config.Configuration; import net.minecraftforge.common.config.Property; -import java.lang.reflect.Field; -import java.util.HashMap; -import java.util.Map; -import java.util.Map.Entry; - -import static gregtech.api.enums.GT_Values.E; - public class GT_LanguageManager { - public static final HashMap<String, String> TEMPMAP = new HashMap<>(), BUFFERMAP = new HashMap<>(), LANGMAP = new HashMap<>(); + public static final HashMap<String, String> TEMPMAP = new HashMap<>(), + BUFFERMAP = new HashMap<>(), + LANGMAP = new HashMap<>(); public static Configuration sEnglishFile; - public static String sLanguage = "en_US"; + public static String sLanguage = "en_US"; public static boolean sUseEnglishFile = false; public static boolean i18nPlaceholder = true; - public static String - FACE_ANY = "gt.lang.face.any", - FACE_BOTTOM = "gt.lang.face.bottom", - FACE_TOP = "gt.lang.face.top", - FACE_LEFT = "gt.lang.face.left", - FACE_FRONT = "gt.lang.face.front", - FACE_RIGHT = "gt.lang.face.right", - FACE_BACK = "gt.lang.face.back", - FACE_NONE = "gt.lang.face.none"; + public static String FACE_ANY = "gt.lang.face.any", + FACE_BOTTOM = "gt.lang.face.bottom", + FACE_TOP = "gt.lang.face.top", + FACE_LEFT = "gt.lang.face.left", + FACE_FRONT = "gt.lang.face.front", + FACE_RIGHT = "gt.lang.face.right", + FACE_BACK = "gt.lang.face.back", + FACE_NONE = "gt.lang.face.none"; - public static String[] - FACES = {FACE_BOTTOM, FACE_TOP, FACE_LEFT, FACE_FRONT, FACE_RIGHT, FACE_BACK, FACE_NONE}; + public static String[] FACES = {FACE_BOTTOM, FACE_TOP, FACE_LEFT, FACE_FRONT, FACE_RIGHT, FACE_BACK, FACE_NONE}; private static Map<String, String> stringTranslateLanguageList = null; 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(); } } - - public static String addStringLocalization(String aKey, String aEnglish) { + public static String addStringLocalization(String aKey, String aEnglish) { return addStringLocalization(aKey, aEnglish, true); } @@ -67,7 +67,7 @@ public class GT_LanguageManager { TEMPMAP.put(aKey.trim(), aEnglish); LanguageRegistry.instance().injectLanguage(sLanguage, TEMPMAP); TEMPMAP.clear(); - if(sUseEnglishFile && !aWriteIntoLangFile){ + if (sUseEnglishFile && !aWriteIntoLangFile) { if (!LANGMAP.containsKey(aKey)) { Property tProperty = sEnglishFile.get("LanguageFile", aKey, aEnglish); aEnglish = tProperty.getString(); @@ -92,7 +92,9 @@ 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; } @@ -104,9 +106,9 @@ 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); + rTranslation = StatCollector.translateToLocal(tTrimmedKey); } if (GT_Utility.isStringInvalid(rTranslation)) { rTranslation = StatCollector.translateToLocal(tTrimmedKey); @@ -151,235 +153,240 @@ public class GT_LanguageManager { return aStack.getUnlocalizedName() + ".name"; } - public static void writePlaceholderStrings(){ - addStringLocalization("Interaction_DESCRIPTION_Index_001", "Puts out into adjacent Slot #"); - addStringLocalization("Interaction_DESCRIPTION_Index_002", "Grabs in for own Slot #"); - addStringLocalization("Interaction_DESCRIPTION_Index_003", "Normal"); - addStringLocalization("Interaction_DESCRIPTION_Index_004", "Inverted"); - addStringLocalization("Interaction_DESCRIPTION_Index_005", "No Work at all"); - addStringLocalization("Interaction_DESCRIPTION_Index_006", "Export"); - addStringLocalization("Interaction_DESCRIPTION_Index_007", "Import"); - addStringLocalization("Interaction_DESCRIPTION_Index_008", "Export (conditional)"); - addStringLocalization("Interaction_DESCRIPTION_Index_009", "Import (conditional)"); - addStringLocalization("Interaction_DESCRIPTION_Index_010", "Export (invert cond)"); - addStringLocalization("Interaction_DESCRIPTION_Index_011", "Import (invert cond)"); - addStringLocalization("Interaction_DESCRIPTION_Index_012", "Export allow Input"); - addStringLocalization("Interaction_DESCRIPTION_Index_013", "Import allow Output"); - addStringLocalization("Interaction_DESCRIPTION_Index_014", "Export allow Input (conditional)"); - addStringLocalization("Interaction_DESCRIPTION_Index_015", "Import allow Output (conditional)"); - addStringLocalization("Interaction_DESCRIPTION_Index_016", "Export allow Input (invert cond)"); - addStringLocalization("Interaction_DESCRIPTION_Index_017", "Import allow Output (invert cond)"); - addStringLocalization("Interaction_DESCRIPTION_Index_018", "Normal"); - addStringLocalization("Interaction_DESCRIPTION_Index_019", "Inverted"); - addStringLocalization("Interaction_DESCRIPTION_Index_020", "Ready to work"); - addStringLocalization("Interaction_DESCRIPTION_Index_021", "Not ready to work"); - addStringLocalization("Interaction_DESCRIPTION_Index_022", "Import"); - addStringLocalization("Interaction_DESCRIPTION_Index_023", "Import (conditional)"); - addStringLocalization("Interaction_DESCRIPTION_Index_024", "Import (invert cond)"); - addStringLocalization("Interaction_DESCRIPTION_Index_025", "Keep Liquids Away"); - addStringLocalization("Interaction_DESCRIPTION_Index_026", "Keep Liquids Away (conditional)"); - addStringLocalization("Interaction_DESCRIPTION_Index_027", "Keep Liquids Away (invert cond)"); - addStringLocalization("Interaction_DESCRIPTION_Index_028", "Allow"); - addStringLocalization("Interaction_DESCRIPTION_Index_029", "Allow (conditional)"); - addStringLocalization("Interaction_DESCRIPTION_Index_030", "Disallow (conditional)"); - addStringLocalization("Interaction_DESCRIPTION_Index_031", "Normal Universal Storage"); - addStringLocalization("Interaction_DESCRIPTION_Index_032", "Inverted Universal Storage"); - addStringLocalization("Interaction_DESCRIPTION_Index_033", "Normal Electricity Storage"); - addStringLocalization("Interaction_DESCRIPTION_Index_034", "Inverted Electricity Storage"); - addStringLocalization("Interaction_DESCRIPTION_Index_035", "Normal Steam Storage"); - addStringLocalization("Interaction_DESCRIPTION_Index_036", "Inverted Steam Storage"); - addStringLocalization("Interaction_DESCRIPTION_Index_037", "Normal Average Electric Input"); - addStringLocalization("Interaction_DESCRIPTION_Index_038", "Inverted Average Electric Input"); - addStringLocalization("Interaction_DESCRIPTION_Index_039", "Normal Average Electric Output"); - addStringLocalization("Interaction_DESCRIPTION_Index_040", "Inverted Average Electric Output"); - addStringLocalization("Interaction_DESCRIPTION_Index_041", "Normal Electricity Storage(Including Batteries)"); - addStringLocalization("Interaction_DESCRIPTION_Index_042", "Inverted Electricity Storage(Including Batteries)"); - addStringLocalization("Interaction_DESCRIPTION_Index_043", "Allow input, no output"); - addStringLocalization("Interaction_DESCRIPTION_Index_044", "Deny input, no output"); - addStringLocalization("Interaction_DESCRIPTION_Index_045", "Allow input, permit any output"); - addStringLocalization("Interaction_DESCRIPTION_Index_046", "Deny input, permit any output"); - addStringLocalization("Interaction_DESCRIPTION_Index_047", "Filter Fluid: "); - addStringLocalization("Interaction_DESCRIPTION_Index_048", "Pump speed: "); - addStringLocalization("Interaction_DESCRIPTION_Index_049", "L/tick "); - addStringLocalization("Interaction_DESCRIPTION_Index_050", "L/sec"); - addStringLocalization("Interaction_DESCRIPTION_Index_051", "Normal"); - addStringLocalization("Interaction_DESCRIPTION_Index_052", "Inverted"); - addStringLocalization("Interaction_DESCRIPTION_Index_053", "Slot: "); - addStringLocalization("Interaction_DESCRIPTION_Index_054", "Inverted"); - addStringLocalization("Interaction_DESCRIPTION_Index_055", "Normal"); - addStringLocalization("Interaction_DESCRIPTION_Index_056", "Emit if 1 Maintenance Needed"); - addStringLocalization("Interaction_DESCRIPTION_Index_057", "Emit if 1 Maintenance Needed(inverted)"); - addStringLocalization("Interaction_DESCRIPTION_Index_058", "Emit if 2 Maintenance Needed"); - addStringLocalization("Interaction_DESCRIPTION_Index_059", "Emit if 2 Maintenance Needed(inverted)"); - addStringLocalization("Interaction_DESCRIPTION_Index_060", "Emit if 3 Maintenance Needed"); - addStringLocalization("Interaction_DESCRIPTION_Index_061", "Emit if 3 Maintenance Needed(inverted)"); - addStringLocalization("Interaction_DESCRIPTION_Index_062", "Emit if 4 Maintenance Needed"); - addStringLocalization("Interaction_DESCRIPTION_Index_063", "Emit if 4 Maintenance Needed(inverted)"); - addStringLocalization("Interaction_DESCRIPTION_Index_064", "Emit if 5 Maintenance Needed"); - addStringLocalization("Interaction_DESCRIPTION_Index_065", "Emit if 5 Maintenance Needed(inverted)"); - addStringLocalization("Interaction_DESCRIPTION_Index_066", "Emit if rotor needs maintenance"); - addStringLocalization("Interaction_DESCRIPTION_Index_067", "Emit if rotor needs maintenance(inverted)"); - addStringLocalization("Interaction_DESCRIPTION_Index_068", "Emit if any Player is close"); - addStringLocalization("Interaction_DESCRIPTION_Index_069", "Emit if other player is close"); - addStringLocalization("Interaction_DESCRIPTION_Index_070", "Emit if you are close"); - addStringLocalization("Interaction_DESCRIPTION_Index_071", "Conducts strongest Input"); - addStringLocalization("Interaction_DESCRIPTION_Index_072", "Conducts from bottom Input"); - addStringLocalization("Interaction_DESCRIPTION_Index_073", "Conducts from top Input"); - addStringLocalization("Interaction_DESCRIPTION_Index_074", "Conducts from north Input"); - addStringLocalization("Interaction_DESCRIPTION_Index_075", "Conducts from south Input"); - addStringLocalization("Interaction_DESCRIPTION_Index_076", "Conducts from west Input"); - addStringLocalization("Interaction_DESCRIPTION_Index_077", "Conducts from east Input"); - addStringLocalization("Interaction_DESCRIPTION_Index_078", "Signal = "); - addStringLocalization("Interaction_DESCRIPTION_Index_079", "Conditional Signal = "); - addStringLocalization("Interaction_DESCRIPTION_Index_080", "Inverted Conditional Signal = "); - addStringLocalization("Interaction_DESCRIPTION_Index_081", "Frequency: "); - addStringLocalization("Interaction_DESCRIPTION_Index_082", "Open if work enabled"); - addStringLocalization("Interaction_DESCRIPTION_Index_083", "Open if work disabled"); - addStringLocalization("Interaction_DESCRIPTION_Index_084", "Only Output allowed"); - addStringLocalization("Interaction_DESCRIPTION_Index_085", "Only Input allowed"); - addStringLocalization("Interaction_DESCRIPTION_Index_086", "Auto-Input: "); - addStringLocalization("Interaction_DESCRIPTION_Index_087", "Disabled"); - addStringLocalization("Interaction_DESCRIPTION_Index_088", "Enabled"); - addStringLocalization("Interaction_DESCRIPTION_Index_089", " Auto-Output: "); - addStringLocalization("Interaction_DESCRIPTION_Index_090", "Machine Processing: "); - addStringLocalization("Interaction_DESCRIPTION_Index_091", "Redstone Output at Side "); - addStringLocalization("Interaction_DESCRIPTION_Index_092", " set to: "); - addStringLocalization("Interaction_DESCRIPTION_Index_093", "Strong"); - addStringLocalization("Interaction_DESCRIPTION_Index_094", "Weak"); - addStringLocalization("Interaction_DESCRIPTION_Index_095", "Input from Output Side allowed"); - addStringLocalization("Interaction_DESCRIPTION_Index_096", "Input from Output Side forbidden"); - addStringLocalization("Interaction_DESCRIPTION_Index_097", "It's dangerous to go alone! Take this."); - addStringLocalization("Interaction_DESCRIPTION_Index_098", "Do not regulate Item Stack Size"); - addStringLocalization("Interaction_DESCRIPTION_Index_099", "Regulate Item Stack Size to: "); - addStringLocalization("Interaction_DESCRIPTION_Index_100", "This is ");//Spartaaaaaaa!!! - addStringLocalization("Interaction_DESCRIPTION_Index_101", " Ore."); - addStringLocalization("Interaction_DESCRIPTION_Index_102", "There is Lava behind this Rock."); - addStringLocalization("Interaction_DESCRIPTION_Index_103", "There is a Liquid behind this Rock."); - addStringLocalization("Interaction_DESCRIPTION_Index_104", "There is an Air Pocket behind this Rock."); - addStringLocalization("Interaction_DESCRIPTION_Index_105", "Material is changing behind this Rock."); - addStringLocalization("Interaction_DESCRIPTION_Index_106", "Found traces of "); - addStringLocalization("Interaction_DESCRIPTION_Index_107", "No Ores found."); - addStringLocalization("Interaction_DESCRIPTION_Index_108", "Outputs Liquids, Steam and Items"); - addStringLocalization("Interaction_DESCRIPTION_Index_109", "Outputs Steam and Items"); - addStringLocalization("Interaction_DESCRIPTION_Index_110", "Outputs Steam and Liquids"); - addStringLocalization("Interaction_DESCRIPTION_Index_111", "Outputs Steam"); - addStringLocalization("Interaction_DESCRIPTION_Index_112", "Outputs Liquids and Items"); - addStringLocalization("Interaction_DESCRIPTION_Index_113", "Outputs only Items"); - addStringLocalization("Interaction_DESCRIPTION_Index_114", "Outputs only Liquids"); - addStringLocalization("Interaction_DESCRIPTION_Index_115", "Outputs nothing"); - addStringLocalization("Interaction_DESCRIPTION_Index_116", "Emit Energy to Outputside"); - addStringLocalization("Interaction_DESCRIPTION_Index_117", "Don't emit Energy"); - addStringLocalization("Interaction_DESCRIPTION_Index_118", "Emit Redstone if no Slot is free"); - addStringLocalization("Interaction_DESCRIPTION_Index_119", "Don't emit Redstone"); - addStringLocalization("Interaction_DESCRIPTION_Index_120", "Invert Redstone"); - addStringLocalization("Interaction_DESCRIPTION_Index_121", "Don't invert Redstone"); - addStringLocalization("Interaction_DESCRIPTION_Index_122", "Emit Redstone if slots contain something"); - addStringLocalization("Interaction_DESCRIPTION_Index_123", "Don't emit Redstone"); - addStringLocalization("Interaction_DESCRIPTION_Index_124", "Invert Filter"); - addStringLocalization("Interaction_DESCRIPTION_Index_125", "Don't invert Filter"); - addStringLocalization("Interaction_DESCRIPTION_Index_126", "Ignore NBT"); - addStringLocalization("Interaction_DESCRIPTION_Index_127", "NBT has to match"); - addStringLocalization("Interaction_DESCRIPTION_Index_128", "Redstone "); - addStringLocalization("Interaction_DESCRIPTION_Index_129", "Energy "); - addStringLocalization("Interaction_DESCRIPTION_Index_130", "Fluids "); - addStringLocalization("Interaction_DESCRIPTION_Index_131", "Items "); - addStringLocalization("Interaction_DESCRIPTION_Index_132", "Pipe is loose."); - addStringLocalization("Interaction_DESCRIPTION_Index_133", "Screws are loose."); - addStringLocalization("Interaction_DESCRIPTION_Index_134", "Something is stuck."); - addStringLocalization("Interaction_DESCRIPTION_Index_135", "Platings are dented."); - addStringLocalization("Interaction_DESCRIPTION_Index_136", "Circuitry burned out."); - addStringLocalization("Interaction_DESCRIPTION_Index_137", "That doesn't belong there."); - addStringLocalization("Interaction_DESCRIPTION_Index_138", "Incomplete Structure."); - addStringLocalization("Interaction_DESCRIPTION_Index_139", "Hit with Soft Hammer"); - addStringLocalization("Interaction_DESCRIPTION_Index_140", "to (re-)start the Machine"); - addStringLocalization("Interaction_DESCRIPTION_Index_141", "if it doesn't start."); - addStringLocalization("Interaction_DESCRIPTION_Index_142", "Running perfectly."); - addStringLocalization("Interaction_DESCRIPTION_Index_143", "Missing Mining Pipe"); - addStringLocalization("Interaction_DESCRIPTION_Index_144", "Missing Turbine Rotor"); - addStringLocalization("Interaction_DESCRIPTION_Index_145", "Step Down, In: "); - addStringLocalization("Interaction_DESCRIPTION_Index_146", "Step Up, In: "); - addStringLocalization("Interaction_DESCRIPTION_Index_147", "Amp, Out: "); - addStringLocalization("Interaction_DESCRIPTION_Index_148", " V at "); - addStringLocalization("Interaction_DESCRIPTION_Index_149", " Amp"); - addStringLocalization("Interaction_DESCRIPTION_Index_150", "Chance: "); - addStringLocalization("Interaction_DESCRIPTION_Index_151", "Does not get consumed in the process"); - addStringLocalization("Interaction_DESCRIPTION_Index_152", "Total: "); - addStringLocalization("Interaction_DESCRIPTION_Index_153", "Usage: "); - addStringLocalization("Interaction_DESCRIPTION_Index_154", "Voltage: "); - addStringLocalization("Interaction_DESCRIPTION_Index_155", "Amperage: "); - addStringLocalization("Interaction_DESCRIPTION_Index_156", "Voltage: unspecified"); - addStringLocalization("Interaction_DESCRIPTION_Index_157", "Amperage: unspecified"); - addStringLocalization("Interaction_DESCRIPTION_Index_158", "Time: "); - addStringLocalization("Interaction_DESCRIPTION_Index_159", "Needs Low Gravity"); - addStringLocalization("Interaction_DESCRIPTION_Index_160", "Needs Cleanroom"); - addStringLocalization("Interaction_DESCRIPTION_Index_161", " secs"); - addStringLocalization("Interaction_DESCRIPTION_Index_162", "Name: "); - addStringLocalization("Interaction_DESCRIPTION_Index_163", " MetaData: "); - addStringLocalization("Interaction_DESCRIPTION_Index_164", "Hardness: "); - addStringLocalization("Interaction_DESCRIPTION_Index_165", " Blast Resistance: "); - addStringLocalization("Interaction_DESCRIPTION_Index_166", "Is valid Beacon Pyramid Material"); - addStringLocalization("Interaction_DESCRIPTION_Index_167", "Tank "); - addStringLocalization("Interaction_DESCRIPTION_Index_168", "Heat: "); - addStringLocalization("Interaction_DESCRIPTION_Index_169", " HEM: "); - addStringLocalization("Interaction_DESCRIPTION_Index_170", " Base EU Output: "); - addStringLocalization("Interaction_DESCRIPTION_Index_171", "Facing: "); - addStringLocalization("Interaction_DESCRIPTION_Index_172", " / Chance: "); - addStringLocalization("Interaction_DESCRIPTION_Index_173", "You can remove this with a Wrench"); - addStringLocalization("Interaction_DESCRIPTION_Index_174", "You can NOT remove this with a Wrench"); - addStringLocalization("Interaction_DESCRIPTION_Index_175", "Conduction Loss: "); - addStringLocalization("Interaction_DESCRIPTION_Index_176", "Contained Energy: "); - addStringLocalization("Interaction_DESCRIPTION_Index_177", "Has Muffler Upgrade"); - addStringLocalization("Interaction_DESCRIPTION_Index_178", "Progress: "); - addStringLocalization("Interaction_DESCRIPTION_Index_179", "Max IN: "); - addStringLocalization("Interaction_DESCRIPTION_Index_180", " EU"); - addStringLocalization("Interaction_DESCRIPTION_Index_181", "Max OUT: "); - addStringLocalization("Interaction_DESCRIPTION_Index_182", " EU at "); - addStringLocalization("Interaction_DESCRIPTION_Index_183", " Amperes"); - addStringLocalization("Interaction_DESCRIPTION_Index_184", "Energy: "); - addStringLocalization("Interaction_DESCRIPTION_Index_185", "EU"); - addStringLocalization("Interaction_DESCRIPTION_Index_186", "Owned by: "); - addStringLocalization("Interaction_DESCRIPTION_Index_187", "Type -- Crop-Name: "); - addStringLocalization("Interaction_DESCRIPTION_Index_188", " Growth: "); - addStringLocalization("Interaction_DESCRIPTION_Index_189", " Gain: "); - addStringLocalization("Interaction_DESCRIPTION_Index_190", " Resistance: "); - addStringLocalization("Interaction_DESCRIPTION_Index_191", "Plant -- Fertilizer: "); - addStringLocalization("Interaction_DESCRIPTION_Index_192", " Water: "); - addStringLocalization("Interaction_DESCRIPTION_Index_193", " Weed-Ex: "); - addStringLocalization("Interaction_DESCRIPTION_Index_194", " Scan-Level: "); - addStringLocalization("Interaction_DESCRIPTION_Index_195", "Environment -- Nutrients: "); - addStringLocalization("Interaction_DESCRIPTION_Index_196", " Humidity: "); - addStringLocalization("Interaction_DESCRIPTION_Index_197", " Air-Quality: "); - addStringLocalization("Interaction_DESCRIPTION_Index_198", "Attributes:"); - addStringLocalization("Interaction_DESCRIPTION_Index_199", "Discovered by: "); - addStringLocalization("Interaction_DESCRIPTION_Index_200", " L"); - addStringLocalization("Interaction_DESCRIPTION_Index_201", "Nothing"); - addStringLocalization("Interaction_DESCRIPTION_Index_202", "Pollution in Chunk: "); - addStringLocalization("Interaction_DESCRIPTION_Index_203", " gibbl"); - addStringLocalization("Interaction_DESCRIPTION_Index_204", "No Pollution in Chunk! HAYO!"); - addStringLocalization("Interaction_DESCRIPTION_Index_205", " of "); - addStringLocalization("Interaction_DESCRIPTION_Index_206", "Scan for Assembly Line"); -// addStringLocalization("Interaction_DESCRIPTION_Index_207", "Grab"); -// addStringLocalization("Interaction_DESCRIPTION_Index_208", "Grab"); -// addStringLocalization("Interaction_DESCRIPTION_Index_209", "Grab"); -// addStringLocalization("Interaction_DESCRIPTION_Index_210", "Grab"); - addStringLocalization("Interaction_DESCRIPTION_Index_211", "Items per side: "); - addStringLocalization("Interaction_DESCRIPTION_Index_212", "Input enabled"); + public static void writePlaceholderStrings() { + addStringLocalization("Interaction_DESCRIPTION_Index_001", "Puts out into adjacent Slot #"); + addStringLocalization("Interaction_DESCRIPTION_Index_002", "Grabs in for own Slot #"); + addStringLocalization("Interaction_DESCRIPTION_Index_003", "Normal"); + addStringLocalization("Interaction_DESCRIPTION_Index_004", "Inverted"); + addStringLocalization("Interaction_DESCRIPTION_Index_005", "No Work at all"); + addStringLocalization("Interaction_DESCRIPTION_Index_006", "Export"); + addStringLocalization("Interaction_DESCRIPTION_Index_007", "Import"); + addStringLocalization("Interaction_DESCRIPTION_Index_008", "Export (conditional)"); + addStringLocalization("Interaction_DESCRIPTION_Index_009", "Import (conditional)"); + addStringLocalization("Interaction_DESCRIPTION_Index_010", "Export (invert cond)"); + addStringLocalization("Interaction_DESCRIPTION_Index_011", "Import (invert cond)"); + addStringLocalization("Interaction_DESCRIPTION_Index_012", "Export allow Input"); + addStringLocalization("Interaction_DESCRIPTION_Index_013", "Import allow Output"); + addStringLocalization("Interaction_DESCRIPTION_Index_014", "Export allow Input (conditional)"); + addStringLocalization("Interaction_DESCRIPTION_Index_015", "Import allow Output (conditional)"); + addStringLocalization("Interaction_DESCRIPTION_Index_016", "Export allow Input (invert cond)"); + addStringLocalization("Interaction_DESCRIPTION_Index_017", "Import allow Output (invert cond)"); + addStringLocalization("Interaction_DESCRIPTION_Index_018", "Normal"); + addStringLocalization("Interaction_DESCRIPTION_Index_019", "Inverted"); + addStringLocalization("Interaction_DESCRIPTION_Index_020", "Ready to work"); + addStringLocalization("Interaction_DESCRIPTION_Index_021", "Not ready to work"); + addStringLocalization("Interaction_DESCRIPTION_Index_022", "Import"); + addStringLocalization("Interaction_DESCRIPTION_Index_023", "Import (conditional)"); + addStringLocalization("Interaction_DESCRIPTION_Index_024", "Import (invert cond)"); + addStringLocalization("Interaction_DESCRIPTION_Index_025", "Keep Liquids Away"); + addStringLocalization("Interaction_DESCRIPTION_Index_026", "Keep Liquids Away (conditional)"); + addStringLocalization("Interaction_DESCRIPTION_Index_027", "Keep Liquids Away (invert cond)"); + addStringLocalization("Interaction_DESCRIPTION_Index_028", "Allow"); + addStringLocalization("Interaction_DESCRIPTION_Index_029", "Allow (conditional)"); + addStringLocalization("Interaction_DESCRIPTION_Index_030", "Disallow (conditional)"); + addStringLocalization("Interaction_DESCRIPTION_Index_031", "Normal Universal Storage"); + addStringLocalization("Interaction_DESCRIPTION_Index_032", "Inverted Universal Storage"); + addStringLocalization("Interaction_DESCRIPTION_Index_033", "Normal Electricity Storage"); + addStringLocalization("Interaction_DESCRIPTION_Index_034", "Inverted Electricity Storage"); + addStringLocalization("Interaction_DESCRIPTION_Index_035", "Normal Steam Storage"); + addStringLocalization("Interaction_DESCRIPTION_Index_036", "Inverted Steam Storage"); + addStringLocalization("Interaction_DESCRIPTION_Index_037", "Normal Average Electric Input"); + addStringLocalization("Interaction_DESCRIPTION_Index_038", "Inverted Average Electric Input"); + addStringLocalization("Interaction_DESCRIPTION_Index_039", "Normal Average Electric Output"); + addStringLocalization("Interaction_DESCRIPTION_Index_040", "Inverted Average Electric Output"); + addStringLocalization("Interaction_DESCRIPTION_Index_041", "Normal Electricity Storage(Including Batteries)"); + addStringLocalization("Interaction_DESCRIPTION_Index_042", "Inverted Electricity Storage(Including Batteries)"); + addStringLocalization("Interaction_DESCRIPTION_Index_043", "Allow input, no output"); + addStringLocalization("Interaction_DESCRIPTION_Index_044", "Deny input, no output"); + addStringLocalization("Interaction_DESCRIPTION_Index_045", "Allow input, permit any output"); + addStringLocalization("Interaction_DESCRIPTION_Index_046", "Deny input, permit any output"); + addStringLocalization("Interaction_DESCRIPTION_Index_047", "Filter Fluid: "); + addStringLocalization("Interaction_DESCRIPTION_Index_048", "Pump speed: "); + addStringLocalization("Interaction_DESCRIPTION_Index_049", "L/tick "); + addStringLocalization("Interaction_DESCRIPTION_Index_050", "L/sec"); + addStringLocalization("Interaction_DESCRIPTION_Index_051", "Normal"); + addStringLocalization("Interaction_DESCRIPTION_Index_052", "Inverted"); + addStringLocalization("Interaction_DESCRIPTION_Index_053", "Slot: "); + addStringLocalization("Interaction_DESCRIPTION_Index_054", "Inverted"); + addStringLocalization("Interaction_DESCRIPTION_Index_055", "Normal"); + addStringLocalization("Interaction_DESCRIPTION_Index_056", "Emit if 1 Maintenance Needed"); + addStringLocalization("Interaction_DESCRIPTION_Index_057", "Emit if 1 Maintenance Needed(inverted)"); + addStringLocalization("Interaction_DESCRIPTION_Index_058", "Emit if 2 Maintenance Needed"); + addStringLocalization("Interaction_DESCRIPTION_Index_059", "Emit if 2 Maintenance Needed(inverted)"); + addStringLocalization("Interaction_DESCRIPTION_Index_060", "Emit if 3 Maintenance Needed"); + addStringLocalization("Interaction_DESCRIPTION_Index_061", "Emit if 3 Maintenance Needed(inverted)"); + addStringLocalization("Interaction_DESCRIPTION_Index_062", "Emit if 4 Maintenance Needed"); + addStringLocalization("Interaction_DESCRIPTION_Index_063", "Emit if 4 Maintenance Needed(inverted)"); + addStringLocalization("Interaction_DESCRIPTION_Index_064", "Emit if 5 Maintenance Needed"); + addStringLocalization("Interaction_DESCRIPTION_Index_065", "Emit if 5 Maintenance Needed(inverted)"); + addStringLocalization("Interaction_DESCRIPTION_Index_066", "Emit if rotor needs maintenance"); + addStringLocalization("Interaction_DESCRIPTION_Index_067", "Emit if rotor needs maintenance(inverted)"); + addStringLocalization("Interaction_DESCRIPTION_Index_068", "Emit if any Player is close"); + addStringLocalization("Interaction_DESCRIPTION_Index_069", "Emit if other player is close"); + addStringLocalization("Interaction_DESCRIPTION_Index_070", "Emit if you are close"); + addStringLocalization("Interaction_DESCRIPTION_Index_071", "Conducts strongest Input"); + addStringLocalization("Interaction_DESCRIPTION_Index_072", "Conducts from bottom Input"); + addStringLocalization("Interaction_DESCRIPTION_Index_073", "Conducts from top Input"); + addStringLocalization("Interaction_DESCRIPTION_Index_074", "Conducts from north Input"); + addStringLocalization("Interaction_DESCRIPTION_Index_075", "Conducts from south Input"); + addStringLocalization("Interaction_DESCRIPTION_Index_076", "Conducts from west Input"); + addStringLocalization("Interaction_DESCRIPTION_Index_077", "Conducts from east Input"); + addStringLocalization("Interaction_DESCRIPTION_Index_078", "Signal = "); + addStringLocalization("Interaction_DESCRIPTION_Index_079", "Conditional Signal = "); + addStringLocalization("Interaction_DESCRIPTION_Index_080", "Inverted Conditional Signal = "); + addStringLocalization("Interaction_DESCRIPTION_Index_081", "Frequency: "); + addStringLocalization("Interaction_DESCRIPTION_Index_082", "Open if work enabled"); + addStringLocalization("Interaction_DESCRIPTION_Index_083", "Open if work disabled"); + addStringLocalization("Interaction_DESCRIPTION_Index_084", "Only Output allowed"); + addStringLocalization("Interaction_DESCRIPTION_Index_085", "Only Input allowed"); + addStringLocalization("Interaction_DESCRIPTION_Index_086", "Auto-Input: "); + addStringLocalization("Interaction_DESCRIPTION_Index_087", "Disabled"); + addStringLocalization("Interaction_DESCRIPTION_Index_088", "Enabled"); + addStringLocalization("Interaction_DESCRIPTION_Index_089", " Auto-Output: "); + addStringLocalization("Interaction_DESCRIPTION_Index_090", "Machine Processing: "); + addStringLocalization("Interaction_DESCRIPTION_Index_091", "Redstone Output at Side "); + addStringLocalization("Interaction_DESCRIPTION_Index_092", " set to: "); + addStringLocalization("Interaction_DESCRIPTION_Index_093", "Strong"); + addStringLocalization("Interaction_DESCRIPTION_Index_094", "Weak"); + addStringLocalization("Interaction_DESCRIPTION_Index_095", "Input from Output Side allowed"); + addStringLocalization("Interaction_DESCRIPTION_Index_096", "Input from Output Side forbidden"); + addStringLocalization("Interaction_DESCRIPTION_Index_097", "It's dangerous to go alone! Take this."); + addStringLocalization("Interaction_DESCRIPTION_Index_098", "Do not regulate Item Stack Size"); + addStringLocalization("Interaction_DESCRIPTION_Index_099", "Regulate Item Stack Size to: "); + addStringLocalization("Interaction_DESCRIPTION_Index_100", "This is "); // Spartaaaaaaa!!! + addStringLocalization("Interaction_DESCRIPTION_Index_101", " Ore."); + addStringLocalization("Interaction_DESCRIPTION_Index_102", "There is Lava behind this Rock."); + addStringLocalization("Interaction_DESCRIPTION_Index_103", "There is a Liquid behind this Rock."); + addStringLocalization("Interaction_DESCRIPTION_Index_104", "There is an Air Pocket behind this Rock."); + addStringLocalization("Interaction_DESCRIPTION_Index_105", "Material is changing behind this Rock."); + addStringLocalization("Interaction_DESCRIPTION_Index_106", "Found traces of "); + addStringLocalization("Interaction_DESCRIPTION_Index_107", "No Ores found."); + addStringLocalization("Interaction_DESCRIPTION_Index_108", "Outputs Liquids, Steam and Items"); + addStringLocalization("Interaction_DESCRIPTION_Index_109", "Outputs Steam and Items"); + addStringLocalization("Interaction_DESCRIPTION_Index_110", "Outputs Steam and Liquids"); + addStringLocalization("Interaction_DESCRIPTION_Index_111", "Outputs Steam"); + addStringLocalization("Interaction_DESCRIPTION_Index_112", "Outputs Liquids and Items"); + addStringLocalization("Interaction_DESCRIPTION_Index_113", "Outputs only Items"); + addStringLocalization("Interaction_DESCRIPTION_Index_114", "Outputs only Liquids"); + addStringLocalization("Interaction_DESCRIPTION_Index_115", "Outputs nothing"); + addStringLocalization("Interaction_DESCRIPTION_Index_116", "Emit Energy to Outputside"); + addStringLocalization("Interaction_DESCRIPTION_Index_117", "Don't emit Energy"); + addStringLocalization("Interaction_DESCRIPTION_Index_118", "Emit Redstone if no Slot is free"); + addStringLocalization("Interaction_DESCRIPTION_Index_119", "Don't emit Redstone"); + addStringLocalization("Interaction_DESCRIPTION_Index_120", "Invert Redstone"); + addStringLocalization("Interaction_DESCRIPTION_Index_121", "Don't invert Redstone"); + addStringLocalization("Interaction_DESCRIPTION_Index_122", "Emit Redstone if slots contain something"); + addStringLocalization("Interaction_DESCRIPTION_Index_123", "Don't emit Redstone"); + addStringLocalization("Interaction_DESCRIPTION_Index_124", "Invert Filter"); + addStringLocalization("Interaction_DESCRIPTION_Index_125", "Don't invert Filter"); + addStringLocalization("Interaction_DESCRIPTION_Index_126", "Ignore NBT"); + addStringLocalization("Interaction_DESCRIPTION_Index_127", "NBT has to match"); + addStringLocalization("Interaction_DESCRIPTION_Index_128", "Redstone "); + addStringLocalization("Interaction_DESCRIPTION_Index_129", "Energy "); + addStringLocalization("Interaction_DESCRIPTION_Index_130", "Fluids "); + addStringLocalization("Interaction_DESCRIPTION_Index_131", "Items "); + addStringLocalization("Interaction_DESCRIPTION_Index_132", "Pipe is loose."); + addStringLocalization("Interaction_DESCRIPTION_Index_133", "Screws are loose."); + addStringLocalization("Interaction_DESCRIPTION_Index_134", "Something is stuck."); + addStringLocalization("Interaction_DESCRIPTION_Index_135", "Platings are dented."); + addStringLocalization("Interaction_DESCRIPTION_Index_136", "Circuitry burned out."); + addStringLocalization("Interaction_DESCRIPTION_Index_137", "That doesn't belong there."); + addStringLocalization("Interaction_DESCRIPTION_Index_138", "Incomplete Structure."); + addStringLocalization("Interaction_DESCRIPTION_Index_139", "Hit with Soft Hammer"); + addStringLocalization("Interaction_DESCRIPTION_Index_140", "to (re-)start the Machine"); + addStringLocalization("Interaction_DESCRIPTION_Index_141", "if it doesn't start."); + addStringLocalization("Interaction_DESCRIPTION_Index_142", "Running perfectly."); + addStringLocalization("Interaction_DESCRIPTION_Index_143", "Missing Mining Pipe"); + addStringLocalization("Interaction_DESCRIPTION_Index_144", "Missing Turbine Rotor"); + addStringLocalization("Interaction_DESCRIPTION_Index_145", "Step Down, In: "); + addStringLocalization("Interaction_DESCRIPTION_Index_146", "Step Up, In: "); + addStringLocalization("Interaction_DESCRIPTION_Index_147", "Amp, Out: "); + addStringLocalization("Interaction_DESCRIPTION_Index_148", " V at "); + addStringLocalization("Interaction_DESCRIPTION_Index_149", " Amp"); + addStringLocalization("Interaction_DESCRIPTION_Index_150", "Chance: "); + addStringLocalization("Interaction_DESCRIPTION_Index_151", "Does not get consumed in the process"); + addStringLocalization("Interaction_DESCRIPTION_Index_152", "Total: "); + addStringLocalization("Interaction_DESCRIPTION_Index_153", "Usage: "); + addStringLocalization("Interaction_DESCRIPTION_Index_154", "Voltage: "); + addStringLocalization("Interaction_DESCRIPTION_Index_155", "Amperage: "); + addStringLocalization("Interaction_DESCRIPTION_Index_156", "Voltage: unspecified"); + addStringLocalization("Interaction_DESCRIPTION_Index_157", "Amperage: unspecified"); + addStringLocalization("Interaction_DESCRIPTION_Index_158", "Time: "); + addStringLocalization("Interaction_DESCRIPTION_Index_159", "Needs Low Gravity"); + addStringLocalization("Interaction_DESCRIPTION_Index_160", "Needs Cleanroom"); + addStringLocalization("Interaction_DESCRIPTION_Index_161", " secs"); + addStringLocalization("Interaction_DESCRIPTION_Index_162", "Name: "); + addStringLocalization("Interaction_DESCRIPTION_Index_163", " MetaData: "); + addStringLocalization("Interaction_DESCRIPTION_Index_164", "Hardness: "); + addStringLocalization("Interaction_DESCRIPTION_Index_165", " Blast Resistance: "); + addStringLocalization("Interaction_DESCRIPTION_Index_166", "Is valid Beacon Pyramid Material"); + addStringLocalization("Interaction_DESCRIPTION_Index_167", "Tank "); + addStringLocalization("Interaction_DESCRIPTION_Index_168", "Heat: "); + addStringLocalization("Interaction_DESCRIPTION_Index_169", " HEM: "); + addStringLocalization("Interaction_DESCRIPTION_Index_170", " Base EU Output: "); + addStringLocalization("Interaction_DESCRIPTION_Index_171", "Facing: "); + addStringLocalization("Interaction_DESCRIPTION_Index_172", " / Chance: "); + addStringLocalization("Interaction_DESCRIPTION_Index_173", "You can remove this with a Wrench"); + addStringLocalization("Interaction_DESCRIPTION_Index_174", "You can NOT remove this with a Wrench"); + addStringLocalization("Interaction_DESCRIPTION_Index_175", "Conduction Loss: "); + addStringLocalization("Interaction_DESCRIPTION_Index_176", "Contained Energy: "); + addStringLocalization("Interaction_DESCRIPTION_Index_177", "Has Muffler Upgrade"); + addStringLocalization("Interaction_DESCRIPTION_Index_178", "Progress: "); + addStringLocalization("Interaction_DESCRIPTION_Index_179", "Max IN: "); + addStringLocalization("Interaction_DESCRIPTION_Index_180", " EU"); + addStringLocalization("Interaction_DESCRIPTION_Index_181", "Max OUT: "); + addStringLocalization("Interaction_DESCRIPTION_Index_182", " EU at "); + addStringLocalization("Interaction_DESCRIPTION_Index_183", " Amperes"); + addStringLocalization("Interaction_DESCRIPTION_Index_184", "Energy: "); + addStringLocalization("Interaction_DESCRIPTION_Index_185", "EU"); + addStringLocalization("Interaction_DESCRIPTION_Index_186", "Owned by: "); + addStringLocalization("Interaction_DESCRIPTION_Index_187", "Type -- Crop-Name: "); + addStringLocalization("Interaction_DESCRIPTION_Index_188", " Growth: "); + addStringLocalization("Interaction_DESCRIPTION_Index_189", " Gain: "); + addStringLocalization("Interaction_DESCRIPTION_Index_190", " Resistance: "); + addStringLocalization("Interaction_DESCRIPTION_Index_191", "Plant -- Fertilizer: "); + addStringLocalization("Interaction_DESCRIPTION_Index_192", " Water: "); + addStringLocalization("Interaction_DESCRIPTION_Index_193", " Weed-Ex: "); + addStringLocalization("Interaction_DESCRIPTION_Index_194", " Scan-Level: "); + addStringLocalization("Interaction_DESCRIPTION_Index_195", "Environment -- Nutrients: "); + addStringLocalization("Interaction_DESCRIPTION_Index_196", " Humidity: "); + addStringLocalization("Interaction_DESCRIPTION_Index_197", " Air-Quality: "); + addStringLocalization("Interaction_DESCRIPTION_Index_198", "Attributes:"); + addStringLocalization("Interaction_DESCRIPTION_Index_199", "Discovered by: "); + addStringLocalization("Interaction_DESCRIPTION_Index_200", " L"); + addStringLocalization("Interaction_DESCRIPTION_Index_201", "Nothing"); + addStringLocalization("Interaction_DESCRIPTION_Index_202", "Pollution in Chunk: "); + addStringLocalization("Interaction_DESCRIPTION_Index_203", " gibbl"); + addStringLocalization("Interaction_DESCRIPTION_Index_204", "No Pollution in Chunk! HAYO!"); + addStringLocalization("Interaction_DESCRIPTION_Index_205", " of "); + addStringLocalization("Interaction_DESCRIPTION_Index_206", "Scan for Assembly Line"); + // addStringLocalization("Interaction_DESCRIPTION_Index_207", "Grab"); + // addStringLocalization("Interaction_DESCRIPTION_Index_208", "Grab"); + // addStringLocalization("Interaction_DESCRIPTION_Index_209", "Grab"); + // addStringLocalization("Interaction_DESCRIPTION_Index_210", "Grab"); + addStringLocalization("Interaction_DESCRIPTION_Index_211", "Items per side: "); + addStringLocalization("Interaction_DESCRIPTION_Index_212", "Input enabled"); addStringLocalization("Interaction_DESCRIPTION_Index_213", "Input disabled"); addStringLocalization("Interaction_DESCRIPTION_Index_214", "Connected"); addStringLocalization("Interaction_DESCRIPTION_Index_215", "Disconnected"); - addStringLocalization("Interaction_DESCRIPTION_Index_216", "Deprecated Recipe"); - addStringLocalization("Interaction_DESCRIPTION_Index_217", "Stocking mode. Keeps this many items in destination input slots. This mode can be server unfriendly."); - addStringLocalization("Interaction_DESCRIPTION_Index_218", "Transfer size mode. Add exactly this many items in destination input slots as long as there is room."); - addStringLocalization("Interaction_DESCRIPTION_Index_219", "Extended Facing:"); - addStringLocalization("Interaction_DESCRIPTION_Index_220", "Single recipe locking disabled."); - addStringLocalization("Interaction_DESCRIPTION_Index_221", "Item threshold"); - addStringLocalization("Interaction_DESCRIPTION_Index_222", "Fluid threshold"); - addStringLocalization("Interaction_DESCRIPTION_Index_223", "Single recipe locking enabled. Will lock to next recipe."); + addStringLocalization("Interaction_DESCRIPTION_Index_216", "Deprecated Recipe"); + addStringLocalization( + "Interaction_DESCRIPTION_Index_217", + "Stocking mode. Keeps this many items in destination input slots. This mode can be server unfriendly."); + addStringLocalization( + "Interaction_DESCRIPTION_Index_218", + "Transfer size mode. Add exactly this many items in destination input slots as long as there is room."); + addStringLocalization("Interaction_DESCRIPTION_Index_219", "Extended Facing:"); + addStringLocalization("Interaction_DESCRIPTION_Index_220", "Single recipe locking disabled."); + addStringLocalization("Interaction_DESCRIPTION_Index_221", "Item threshold"); + addStringLocalization("Interaction_DESCRIPTION_Index_222", "Fluid threshold"); + addStringLocalization( + "Interaction_DESCRIPTION_Index_223", "Single recipe locking enabled. Will lock to next recipe."); addStringLocalization("Interaction_DESCRIPTION_Index_224", " ticks"); addStringLocalization("Interaction_DESCRIPTION_Index_500", "Fitting: Loose - More Flow"); - addStringLocalization("Interaction_DESCRIPTION_Index_501", "Fitting: Tight - More Efficiency"); + addStringLocalization("Interaction_DESCRIPTION_Index_501", "Fitting: Tight - More Efficiency"); - addStringLocalization("Item_DESCRIPTION_Index_000", "Stored Heat: %s"); + addStringLocalization("Item_DESCRIPTION_Index_000", "Stored Heat: %s"); addStringLocalization("Item_DESCRIPTION_Index_001", "Durability: %s/%s"); addStringLocalization("Item_DESCRIPTION_Index_002", "%s lvl %s"); addStringLocalization("Item_DESCRIPTION_Index_003", "Attack Damage: %s"); @@ -401,14 +408,14 @@ public class GT_LanguageManager { addStringLocalization("Item_DESCRIPTION_Index_500", "Turbine Efficiency (Loose): %s"); addStringLocalization("Item_DESCRIPTION_Index_501", "Optimal Steam flow (Loose): %s L/t"); - addStringLocalization(FACE_ANY, "Any Side"); - addStringLocalization(FACE_BOTTOM, "Bottom"); - addStringLocalization(FACE_TOP, "Top"); - addStringLocalization(FACE_LEFT, "Left"); - addStringLocalization(FACE_FRONT, "Front"); - addStringLocalization(FACE_RIGHT, "Right"); - addStringLocalization(FACE_BACK, "Back"); - addStringLocalization(FACE_NONE, "None"); + addStringLocalization(FACE_ANY, "Any Side"); + addStringLocalization(FACE_BOTTOM, "Bottom"); + addStringLocalization(FACE_TOP, "Top"); + addStringLocalization(FACE_LEFT, "Left"); + addStringLocalization(FACE_FRONT, "Front"); + addStringLocalization(FACE_RIGHT, "Right"); + addStringLocalization(FACE_BACK, "Back"); + addStringLocalization(FACE_NONE, "None"); } private static void addToMCLangList(String aKey, String aEnglish) { diff --git a/src/main/java/gregtech/api/util/GT_Log.java b/src/main/java/gregtech/api/util/GT_Log.java index 888f471317..49f44b968b 100644 --- a/src/main/java/gregtech/api/util/GT_Log.java +++ b/src/main/java/gregtech/api/util/GT_Log.java @@ -28,7 +28,9 @@ public class GT_Log { public LogBuffer() { super(new OutputStream() { @Override - public void write(int arg0) {/*Do nothing*/} + public void write(int arg0) { + /*Do nothing*/ + } }); } diff --git a/src/main/java/gregtech/api/util/GT_ModHandler.java b/src/main/java/gregtech/api/util/GT_ModHandler.java index 1af913f4ee..f861f2afc7 100644 --- a/src/main/java/gregtech/api/util/GT_ModHandler.java +++ b/src/main/java/gregtech/api/util/GT_ModHandler.java @@ -1,5 +1,15 @@ package gregtech.api.util; +import static gregtech.GT_Mod.GT_FML_LOGGER; +import static gregtech.api.enums.GT_Values.B; +import static gregtech.api.enums.GT_Values.D1; +import static gregtech.api.enums.GT_Values.DW; +import static gregtech.api.enums.GT_Values.E; +import static gregtech.api.enums.GT_Values.M; +import static gregtech.api.enums.GT_Values.RA; +import static gregtech.api.enums.GT_Values.V; +import static gregtech.api.enums.GT_Values.W; + import cpw.mods.fml.common.registry.GameRegistry; import gregtech.api.GregTech_API; import gregtech.api.enums.ConfigCategories; @@ -22,6 +32,18 @@ import ic2.api.reactor.IReactorComponent; import ic2.api.recipe.IRecipeInput; import ic2.api.recipe.RecipeInputItemStack; import ic2.api.recipe.RecipeOutput; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.Collection; +import java.util.HashMap; +import java.util.HashSet; +import java.util.Iterator; +import java.util.List; +import java.util.Map; +import java.util.Map.Entry; +import java.util.Objects; +import java.util.Set; +import java.util.stream.Collectors; import net.minecraft.block.Block; import net.minecraft.enchantment.Enchantment; import net.minecraft.entity.EntityLivingBase; @@ -47,29 +69,6 @@ import net.minecraftforge.fluids.FluidStack; import net.minecraftforge.oredict.ShapedOreRecipe; import net.minecraftforge.oredict.ShapelessOreRecipe; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.Collection; -import java.util.HashMap; -import java.util.HashSet; -import java.util.Iterator; -import java.util.List; -import java.util.Map; -import java.util.Map.Entry; -import java.util.Objects; -import java.util.Set; -import java.util.stream.Collectors; - -import static gregtech.GT_Mod.GT_FML_LOGGER; -import static gregtech.api.enums.GT_Values.B; -import static gregtech.api.enums.GT_Values.D1; -import static gregtech.api.enums.GT_Values.DW; -import static gregtech.api.enums.GT_Values.E; -import static gregtech.api.enums.GT_Values.M; -import static gregtech.api.enums.GT_Values.RA; -import static gregtech.api.enums.GT_Values.V; -import static gregtech.api.enums.GT_Values.W; - /** * NEVER INCLUDE THIS FILE IN YOUR MOD!!! * <p/> @@ -81,11 +80,11 @@ public class GT_ModHandler { public static final List<IRecipe> sSingleNonBlockDamagableRecipeList = new ArrayList<>(1000); private static final Map<String, ItemStack> sIC2ItemMap = new HashMap<>(); - private static final List<IRecipe> sAllRecipeList = new ArrayList<>(5000), sBufferRecipeList = new ArrayList<>(1000); + private static final List<IRecipe> sAllRecipeList = new ArrayList<>(5000), + sBufferRecipeList = new ArrayList<>(1000); private static final List<ItemStack> delayedRemovalByOutput = new ArrayList<>(); private static final List<InventoryCrafting> delayedRemovalByRecipe = new ArrayList<>(); - public static volatile int VERSION = 509; public static Collection<String> sNativeRecipeClasses = new HashSet<>(), sSpecialRecipeClasses = new HashSet<>(); public static GT_HashSet<GT_ItemStack> sNonReplaceableItems = new GT_HashSet<>(); @@ -103,52 +102,51 @@ public class GT_ModHandler { private static final boolean sSingleNonBlockDamagableRecipeList_create = true; private static final ItemStack sMt1 = new ItemStack(Blocks.dirt, 1, 0), sMt2 = new ItemStack(Blocks.dirt, 1, 0); private static final String s_H = "h", s_F = "f", s_I = "I", s_P = "P", s_R = "R"; - private static final ItemStack[][] - sShapes1 = new ItemStack[][]{ - {sMt1, null, sMt1, sMt1, sMt1, sMt1, null, sMt1, null}, - {sMt1, null, sMt1, sMt1, null, sMt1, sMt1, sMt1, sMt1}, - {null, sMt1, null, sMt1, sMt1, sMt1, sMt1, null, sMt1}, - {sMt1, sMt1, sMt1, sMt1, null, sMt1, null, null, null}, - {sMt1, null, sMt1, sMt1, sMt1, sMt1, sMt1, sMt1, sMt1}, - {sMt1, sMt1, sMt1, sMt1, null, sMt1, sMt1, null, sMt1}, - {null, null, null, sMt1, null, sMt1, sMt1, null, sMt1}, - {null, sMt1, null, null, sMt1, null, null, sMt2, null}, - {sMt1, sMt1, sMt1, null, sMt2, null, null, sMt2, null}, - {null, sMt1, null, null, sMt2, null, null, sMt2, null}, - {sMt1, sMt1, null, sMt1, sMt2, null, null, sMt2, null}, - {null, sMt1, sMt1, null, sMt2, sMt1, null, sMt2, null}, - {sMt1, sMt1, null, null, sMt2, null, null, sMt2, null}, - {null, sMt1, sMt1, null, sMt2, null, null, sMt2, null}, - {null, sMt1, null, sMt1, null, null, null, sMt1, sMt2}, - {null, sMt1, null, null, null, sMt1, sMt2, sMt1, null}, - {null, sMt1, null, sMt1, null, sMt1, null, null, sMt2}, - {null, sMt1, null, sMt1, null, sMt1, sMt2, null, null}, - {null, sMt2, null, null, sMt1, null, null, sMt1, null}, - {null, sMt2, null, null, sMt2, null, sMt1, sMt1, sMt1}, - {null, sMt2, null, null, sMt2, null, null, sMt1, null}, - {null, sMt2, null, sMt1, sMt2, null, sMt1, sMt1, null}, - {null, sMt2, null, null, sMt2, sMt1, null, sMt1, sMt1}, - {null, sMt2, null, null, sMt2, null, sMt1, sMt1, null}, - {sMt1, null, null, null, sMt2, null, null, null, sMt2}, - {null, null, sMt1, null, sMt2, null, sMt2, null, null}, - {sMt1, null, null, null, sMt2, null, null, null, null}, - {null, null, sMt1, null, sMt2, null, null, null, null}, - {sMt1, sMt2, null, null, null, null, null, null, null}, - {sMt2, sMt1, null, null, null, null, null, null, null}, - {sMt1, null, null, sMt2, null, null, null, null, null}, - {sMt2, null, null, sMt1, null, null, null, null, null}, - {sMt1, sMt1, sMt1, sMt1, sMt1, sMt1, null, sMt2, null}, - {sMt1, sMt1, null, sMt1, sMt1, sMt2, sMt1, sMt1, null}, - {null, sMt1, sMt1, sMt2, sMt1, sMt1, null, sMt1, sMt1}, - {null, sMt2, null, sMt1, sMt1, sMt1, sMt1, sMt1, sMt1}, - {sMt1, sMt1, sMt1, sMt1, sMt2, sMt1, null, sMt2, null}, - {sMt1, sMt1, null, sMt1, sMt2, sMt2, sMt1, sMt1, null}, - {null, sMt1, sMt1, sMt2, sMt2, sMt1, null, sMt1, sMt1}, - {null, sMt2, null, sMt1, sMt2, sMt1, sMt1, sMt1, sMt1}, - {sMt1, null, null, null, sMt1, null, null, null, null}, - {null, sMt1, null, sMt1, null, null, null, null, null}, - {sMt1, sMt1, null, sMt2, null, sMt1, sMt2, null, null}, - {null, sMt1, sMt1, sMt1, null, sMt2, null, null, sMt2} + private static final ItemStack[][] sShapes1 = new ItemStack[][] { + {sMt1, null, sMt1, sMt1, sMt1, sMt1, null, sMt1, null}, + {sMt1, null, sMt1, sMt1, null, sMt1, sMt1, sMt1, sMt1}, + {null, sMt1, null, sMt1, sMt1, sMt1, sMt1, null, sMt1}, + {sMt1, sMt1, sMt1, sMt1, null, sMt1, null, null, null}, + {sMt1, null, sMt1, sMt1, sMt1, sMt1, sMt1, sMt1, sMt1}, + {sMt1, sMt1, sMt1, sMt1, null, sMt1, sMt1, null, sMt1}, + {null, null, null, sMt1, null, sMt1, sMt1, null, sMt1}, + {null, sMt1, null, null, sMt1, null, null, sMt2, null}, + {sMt1, sMt1, sMt1, null, sMt2, null, null, sMt2, null}, + {null, sMt1, null, null, sMt2, null, null, sMt2, null}, + {sMt1, sMt1, null, sMt1, sMt2, null, null, sMt2, null}, + {null, sMt1, sMt1, null, sMt2, sMt1, null, sMt2, null}, + {sMt1, sMt1, null, null, sMt2, null, null, sMt2, null}, + {null, sMt1, sMt1, null, sMt2, null, null, sMt2, null}, + {null, sMt1, null, sMt1, null, null, null, sMt1, sMt2}, + {null, sMt1, null, null, null, sMt1, sMt2, sMt1, null}, + {null, sMt1, null, sMt1, null, sMt1, null, null, sMt2}, + {null, sMt1, null, sMt1, null, sMt1, sMt2, null, null}, + {null, sMt2, null, null, sMt1, null, null, sMt1, null}, + {null, sMt2, null, null, sMt2, null, sMt1, sMt1, sMt1}, + {null, sMt2, null, null, sMt2, null, null, sMt1, null}, + {null, sMt2, null, sMt1, sMt2, null, sMt1, sMt1, null}, + {null, sMt2, null, null, sMt2, sMt1, null, sMt1, sMt1}, + {null, sMt2, null, null, sMt2, null, sMt1, sMt1, null}, + {sMt1, null, null, null, sMt2, null, null, null, sMt2}, + {null, null, sMt1, null, sMt2, null, sMt2, null, null}, + {sMt1, null, null, null, sMt2, null, null, null, null}, + {null, null, sMt1, null, sMt2, null, null, null, null}, + {sMt1, sMt2, null, null, null, null, null, null, null}, + {sMt2, sMt1, null, null, null, null, null, null, null}, + {sMt1, null, null, sMt2, null, null, null, null, null}, + {sMt2, null, null, sMt1, null, null, null, null, null}, + {sMt1, sMt1, sMt1, sMt1, sMt1, sMt1, null, sMt2, null}, + {sMt1, sMt1, null, sMt1, sMt1, sMt2, sMt1, sMt1, null}, + {null, sMt1, sMt1, sMt2, sMt1, sMt1, null, sMt1, sMt1}, + {null, sMt2, null, sMt1, sMt1, sMt1, sMt1, sMt1, sMt1}, + {sMt1, sMt1, sMt1, sMt1, sMt2, sMt1, null, sMt2, null}, + {sMt1, sMt1, null, sMt1, sMt2, sMt2, sMt1, sMt1, null}, + {null, sMt1, sMt1, sMt2, sMt2, sMt1, null, sMt1, sMt1}, + {null, sMt2, null, sMt1, sMt2, sMt1, sMt1, sMt1, sMt1}, + {sMt1, null, null, null, sMt1, null, null, null, null}, + {null, sMt1, null, sMt1, null, null, null, null, null}, + {sMt1, sMt1, null, sMt2, null, sMt1, sMt2, null, null}, + {null, sMt1, sMt1, sMt1, null, sMt2, null, null, sMt2} }; public static List<Integer> sSingleNonBlockDamagableRecipeList_validsShapes1 = new ArrayList<>(44); public static boolean sSingleNonBlockDamagableRecipeList_validsShapes1_update = false; @@ -220,8 +218,8 @@ public class GT_ModHandler { * Returns a Liquid Stack with given amount of distilled Water. */ public static FluidStack getDistilledWater(long aAmount) { - FluidStack tFluid = FluidRegistry.getFluidStack("ic2distilledwater", (int) aAmount); - if(tFluid==null)tFluid = getWater(aAmount); + FluidStack tFluid = FluidRegistry.getFluidStack("ic2distilledwater", (int) aAmount); + if (tFluid == null) tFluid = getWater(aAmount); return tFluid; } @@ -252,14 +250,14 @@ public class GT_ModHandler { * Returns if that Liquid is Any Steam (including other mods) */ public static boolean isAnySteam(FluidStack aFluid) { - return(aFluid != null && (isSteam(aFluid) || sAnySteamFluidIDs.contains(aFluid.getFluidID()))); + return (aFluid != null && (isSteam(aFluid) || sAnySteamFluidIDs.contains(aFluid.getFluidID()))); } /** * Returns if that Liquid is Super Heated Steam (including other mods) */ public static boolean isSuperHeatedSteam(FluidStack aFluid) { - return(aFluid != null && sSuperHeatedSteamFluidIDs.contains(aFluid.getFluidID())); + return (aFluid != null && sSuperHeatedSteamFluidIDs.contains(aFluid.getFluidID())); } /** @@ -300,7 +298,8 @@ public class GT_ModHandler { return ItemList.Cell_Water.get(aAmount); } - public static ItemStack getLavaCell(long aAmount) { return ItemList.Cell_Lava.get(aAmount); + public static ItemStack getLavaCell(long aAmount) { + return ItemList.Cell_Lava.get(aAmount); } /** @@ -347,12 +346,15 @@ public class GT_ModHandler { */ public static ItemStack getIC2Item(String aItem, long aAmount, ItemStack aReplacement) { if (GT_Utility.isStringInvalid(aItem) || !GregTech_API.sPreloadStarted) return null; - //if (D1) GT_Log.out.println("Requested the Item '" + aItem + "' from the IC2-API"); - if (!sIC2ItemMap.containsKey(aItem)) try { - ItemStack tStack = IC2Items.getItem(aItem); - sIC2ItemMap.put(aItem, tStack); - if (tStack == null && D1) GT_Log.err.println(aItem + " is not found in the IC2 Items!"); - } catch (Throwable e) {/*Do nothing*/} + // if (D1) GT_Log.out.println("Requested the Item '" + aItem + "' from the IC2-API"); + if (!sIC2ItemMap.containsKey(aItem)) + try { + ItemStack tStack = IC2Items.getItem(aItem); + sIC2ItemMap.put(aItem, tStack); + if (tStack == null && D1) GT_Log.err.println(aItem + " is not found in the IC2 Items!"); + } catch (Throwable e) { + /*Do nothing*/ + } return GT_Utility.copyAmount(aAmount, sIC2ItemMap.get(aItem), aReplacement); } @@ -442,8 +444,12 @@ 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); - } catch (Throwable e) {/*Do nothing*/} + 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*/ + } return true; } @@ -458,9 +464,25 @@ public class GT_ModHandler { aChance = (float) GregTech_API.sRecipeFile.get(ConfigCategories.Machines.scrapboxdrops, aOutput, aChance); if (aChance <= 0) return false; try { - GT_Utility.callMethod(GT_Utility.getFieldContent("ic2.api.recipe.Recipes", "scrapboxDrops", true, true), "addDrop", true, false, true, GT_Utility.copyOrNull(aOutput), aChance); - GT_Utility.callMethod(GT_Utility.getFieldContent("ic2.api.recipe.Recipes", "scrapboxDrops", true, true), "addRecipe", true, true, false, GT_Utility.copyOrNull(aOutput), aChance); - } catch (Throwable e) {/*Do nothing*/} + GT_Utility.callMethod( + GT_Utility.getFieldContent("ic2.api.recipe.Recipes", "scrapboxDrops", true, true), + "addDrop", + true, + false, + true, + GT_Utility.copyOrNull(aOutput), + aChance); + GT_Utility.callMethod( + GT_Utility.getFieldContent("ic2.api.recipe.Recipes", "scrapboxDrops", true, true), + "addRecipe", + true, + true, + false, + GT_Utility.copyOrNull(aOutput), + aChance); + } catch (Throwable e) { + /*Do nothing*/ + } return true; } @@ -471,7 +493,9 @@ public class GT_ModHandler { if (aRecycledStack == null) return false; try { ic2.api.recipe.Recipes.recyclerBlacklist.add(new RecipeInputItemStack(aRecycledStack)); - } catch (Throwable e) {/*Do nothing*/} + } catch (Throwable e) { + /*Do nothing*/ + } return true; } @@ -494,33 +518,39 @@ public class GT_ModHandler { boolean temp = false; if (aInput.stackSize == 1 && addSmeltingRecipe(aInput, aOutput)) temp = true; return (RA.addAlloySmelterRecipe( - aInput, - OrePrefixes.ingot.contains(aOutput) ? ItemList.Shape_Mold_Ingot.get(0) : OrePrefixes.block.contains(aOutput) ? ItemList.Shape_Mold_Block.get(0) : OrePrefixes.nugget.contains(aOutput) ? ItemList.Shape_Mold_Nugget.get(0) : null, - aOutput, - 130, - 3, - hidden - )); + aInput, + OrePrefixes.ingot.contains(aOutput) + ? ItemList.Shape_Mold_Ingot.get(0) + : OrePrefixes.block.contains(aOutput) + ? ItemList.Shape_Mold_Block.get(0) + : OrePrefixes.nugget.contains(aOutput) ? ItemList.Shape_Mold_Nugget.get(0) : null, + aOutput, + 130, + 3, + hidden)); } /** * LiquidTransposer Recipe for both directions */ - public static boolean addLiquidTransposerRecipe(ItemStack aEmptyContainer, FluidStack aLiquid, ItemStack aFullContainer, int aMJ) { + public static boolean addLiquidTransposerRecipe( + ItemStack aEmptyContainer, FluidStack aLiquid, ItemStack aFullContainer, int aMJ) { return true; } /** * LiquidTransposer Recipe for filling Containers */ - public static boolean addLiquidTransposerFillRecipe(ItemStack aEmptyContainer, FluidStack aLiquid, ItemStack aFullContainer, int aMJ) { + public static boolean addLiquidTransposerFillRecipe( + ItemStack aEmptyContainer, FluidStack aLiquid, ItemStack aFullContainer, int aMJ) { return true; } /** * LiquidTransposer Recipe for emptying Containers */ - public static boolean addLiquidTransposerEmptyRecipe(ItemStack aFullContainer, FluidStack aLiquid, ItemStack aEmptyContainer, int aMJ) { + public static boolean addLiquidTransposerEmptyRecipe( + ItemStack aFullContainer, FluidStack aLiquid, ItemStack aEmptyContainer, int aMJ) { return true; } @@ -538,8 +568,8 @@ public class GT_ModHandler { /** * RC-BlastFurnace Recipes */ - @Deprecated - public static boolean addRCBlastFurnaceRecipe(ItemStack aInput, ItemStack aOutput, int aTime) { + @Deprecated + public static boolean addRCBlastFurnaceRecipe(ItemStack aInput, ItemStack aOutput, int aTime) { return true; } @@ -551,7 +581,8 @@ public class GT_ModHandler { return addPulverisationRecipe(aInput, aOutput1, aOutput2, 100, false); } - public static boolean addPulverisationRecipe(ItemStack aInput, ItemStack aOutput1, ItemStack aOutput2, int aChance) { + public static boolean addPulverisationRecipe( + ItemStack aInput, ItemStack aOutput1, ItemStack aOutput2, int aChance) { return addPulverisationRecipe(aInput, aOutput1, aOutput2, aChance, false); } @@ -559,34 +590,49 @@ public class GT_ModHandler { return addPulverisationRecipe(aInput, aOutput1, null, 0, aOverwrite); } - public static boolean addPulverisationRecipe(ItemStack aInput, ItemStack aOutput1, ItemStack aOutput2, boolean aOverwrite) { + public static boolean addPulverisationRecipe( + ItemStack aInput, ItemStack aOutput1, ItemStack aOutput2, boolean aOverwrite) { return addPulverisationRecipe(aInput, aOutput1, aOutput2, 100, aOverwrite); } - public static boolean addPulverisationRecipe(ItemStack aInput, ItemStack aOutput1, ItemStack aOutput2, int aChance, boolean aOverwrite) { + public static boolean addPulverisationRecipe( + ItemStack aInput, ItemStack aOutput1, ItemStack aOutput2, int aChance, boolean aOverwrite) { return addPulverisationRecipe(aInput, aOutput1, aOutput2, aChance, null, 0, aOverwrite); } /** * Adds Several Pulverizer-Type Recipes. */ - public static boolean addPulverisationRecipe(ItemStack aInput, ItemStack aOutput1, ItemStack aOutput2, int aChance2, ItemStack aOutput3, int aChance3, boolean aOverwrite) { + public static boolean addPulverisationRecipe( + ItemStack aInput, + ItemStack aOutput1, + ItemStack aOutput2, + int aChance2, + ItemStack aOutput3, + int aChance3, + boolean aOverwrite) { aOutput1 = GT_OreDictUnificator.get(true, aOutput1); aOutput2 = GT_OreDictUnificator.get(true, aOutput2); if (GT_Utility.isStackInvalid(aInput) || GT_Utility.isStackInvalid(aOutput1)) return false; if (GT_Utility.getContainerItem(aInput, false) == null) { - RA.addPulveriserRecipe(aInput, new ItemStack[]{aOutput1, aOutput2, aOutput3}, new int[]{10000, aChance2 <= 0 ? 1000 : 100 * aChance2, aChance3 <= 0 ? 1000 : 100 * aChance3}, 400, 2); + RA.addPulveriserRecipe( + aInput, + new ItemStack[] {aOutput1, aOutput2, aOutput3}, + new int[] {10000, aChance2 <= 0 ? 1000 : 100 * aChance2, aChance3 <= 0 ? 1000 : 100 * aChance3}, + 400, + 2); } return true; } - public static boolean addPulverisationRecipe(ItemStack aInputItem, ItemStack[] aOutputArray, int[] aChanceArray, int aEUt, int aRecipeDurationInTicks) { + public static boolean addPulverisationRecipe( + ItemStack aInputItem, ItemStack[] aOutputArray, int[] aChanceArray, int aEUt, int aRecipeDurationInTicks) { ItemStack[] aUnifiedOutputArray = new ItemStack[aOutputArray.length]; int counter = 0; - for (ItemStack item: aOutputArray) { + for (ItemStack item : aOutputArray) { aUnifiedOutputArray[counter] = GT_OreDictUnificator.get(true, item); counter++; } @@ -596,11 +642,13 @@ public class GT_ModHandler { return true; } - public static boolean addImmersiveEngineeringRecipe(ItemStack aInput, ItemStack aOutput1, ItemStack aOutput2, int aChance2, ItemStack aOutput3, int aChance3){ - return true; + public static boolean addImmersiveEngineeringRecipe( + ItemStack aInput, ItemStack aOutput1, ItemStack aOutput2, int aChance2, ItemStack aOutput3, int aChance3) { + return true; } - public static boolean addMagneticraftRecipe(ItemStack aInput, ItemStack aOutput1, ItemStack aOutput2, int aChance2, ItemStack aOutput3, int aChance3){ + public static boolean addMagneticraftRecipe( + ItemStack aInput, ItemStack aOutput1, ItemStack aOutput2, int aChance2, ItemStack aOutput3, int aChance3) { return true; } @@ -614,7 +662,13 @@ public class GT_ModHandler { /** * Induction Smelter Recipes and Alloy Smelter Recipes */ - public static boolean addAlloySmelterRecipe(ItemStack aInput1, ItemStack aInput2, ItemStack aOutput1, int aDuration, int aEUt, boolean aAllowSecondaryInputEmpty) { + public static boolean addAlloySmelterRecipe( + ItemStack aInput1, + ItemStack aInput2, + ItemStack aOutput1, + int aDuration, + int aEUt, + boolean aAllowSecondaryInputEmpty) { if (aInput1 == null || (aInput2 == null && !aAllowSecondaryInputEmpty) || aOutput1 == null) return false; aOutput1 = GT_OreDictUnificator.get(true, aOutput1); return RA.addAlloySmelterRecipe(aInput1, aInput2, aOutput1, aDuration, aEUt); @@ -623,7 +677,8 @@ public class GT_ModHandler { /** * Induction Smelter Recipes for TE */ - public static boolean addInductionSmelterRecipe(ItemStack aInput1, ItemStack aInput2, ItemStack aOutput1, ItemStack aOutput2, int aEnergy, int aChance) { + public static boolean addInductionSmelterRecipe( + ItemStack aInput1, ItemStack aInput2, ItemStack aOutput1, ItemStack aOutput2, int aEnergy, int aChance) { return true; } @@ -640,31 +695,73 @@ public class GT_ModHandler { /** * Adds GT versions of the IC2 recipes from the supplied IC2RecipeList. */ - public static void addIC2RecipesToGT(Map<IRecipeInput, RecipeOutput> aIC2RecipeList, GT_Recipe.GT_Recipe_Map aGTRecipeMap, boolean aAddGTRecipe, boolean aRemoveIC2Recipe, boolean aExcludeGTIC2Items) { + public static void addIC2RecipesToGT( + Map<IRecipeInput, RecipeOutput> aIC2RecipeList, + GT_Recipe.GT_Recipe_Map aGTRecipeMap, + boolean aAddGTRecipe, + boolean aRemoveIC2Recipe, + boolean aExcludeGTIC2Items) { Map<ItemStack, ItemStack> aRecipesToRemove = new HashMap<>(); for (Entry<IRecipeInput, RecipeOutput> iRecipeInputRecipeOutputEntry : aIC2RecipeList.entrySet()) { if ((iRecipeInputRecipeOutputEntry.getValue()).items.size() > 0) { for (ItemStack tStack : (iRecipeInputRecipeOutputEntry.getKey()).getInputs()) { if (GT_Utility.isStackValid(tStack)) { - if (aAddGTRecipe && (aGTRecipeMap.findRecipe(null, false, Long.MAX_VALUE, null, tStack) == null)) { + 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": case "gt.recipe.extractor": case "gt.recipe.compressor": - aGTRecipeMap.addRecipe(true, new ItemStack[]{GT_Utility.copyAmount((iRecipeInputRecipeOutputEntry.getKey()).getAmount(), tStack)}, (ItemStack[]) (iRecipeInputRecipeOutputEntry.getValue()).items.toArray(), null, null, null, null, 300, 2, 0); + aGTRecipeMap.addRecipe( + true, + new ItemStack[] { + GT_Utility.copyAmount( + (iRecipeInputRecipeOutputEntry.getKey()).getAmount(), + tStack) + }, + (ItemStack[]) + (iRecipeInputRecipeOutputEntry.getValue()).items.toArray(), + null, + null, + null, + null, + 300, + 2, + 0); break; case "gt.recipe.thermalcentrifuge": - aGTRecipeMap.addRecipe(true, new ItemStack[]{GT_Utility.copyAmount((iRecipeInputRecipeOutputEntry.getKey()).getAmount(), tStack)}, (ItemStack[]) (iRecipeInputRecipeOutputEntry.getValue()).items.toArray(), null, null, null, null, 500, 48, 0); + aGTRecipeMap.addRecipe( + true, + new ItemStack[] { + GT_Utility.copyAmount( + (iRecipeInputRecipeOutputEntry.getKey()).getAmount(), + tStack) + }, + (ItemStack[]) + (iRecipeInputRecipeOutputEntry.getValue()).items.toArray(), + null, + null, + null, + null, + 500, + 48, + 0); break; } } catch (Exception e) { System.err.println(e); } } - if (aRemoveIC2Recipe) aRecipesToRemove.put(tStack, ((RecipeOutput) iRecipeInputRecipeOutputEntry.getValue()).items.get(0)); + if (aRemoveIC2Recipe) + aRecipesToRemove.put( + tStack, ((RecipeOutput) iRecipeInputRecipeOutputEntry.getValue()).items.get(0)); } } } @@ -675,42 +772,54 @@ public class GT_ModHandler { public static Map<IRecipeInput, RecipeOutput> getExtractorRecipeList() { try { return ic2.api.recipe.Recipes.extractor.getRecipes(); - } catch (Throwable e) {/*Do nothing*/} + } catch (Throwable e) { + /*Do nothing*/ + } return sExtractorRecipes; } public static Map<IRecipeInput, RecipeOutput> getCompressorRecipeList() { try { return ic2.api.recipe.Recipes.compressor.getRecipes(); - } catch (Throwable e) {/*Do nothing*/} + } catch (Throwable e) { + /*Do nothing*/ + } return sCompressorRecipes; } public static Map<IRecipeInput, RecipeOutput> getMaceratorRecipeList() { try { return ic2.api.recipe.Recipes.macerator.getRecipes(); - } catch (Throwable e) {/*Do nothing*/} + } catch (Throwable e) { + /*Do nothing*/ + } return sMaceratorRecipes; } public static Map<IRecipeInput, RecipeOutput> getThermalCentrifugeRecipeList() { try { return ic2.api.recipe.Recipes.centrifuge.getRecipes(); - } catch (Throwable e) {/*Do nothing*/} + } catch (Throwable e) { + /*Do nothing*/ + } return sThermalCentrifugeRecipes; } public static Map<IRecipeInput, RecipeOutput> getOreWashingRecipeList() { try { return ic2.api.recipe.Recipes.oreWashing.getRecipes(); - } catch (Throwable e) {/*Do nothing*/} + } catch (Throwable e) { + /*Do nothing*/ + } return sOreWashingRecipes; } public static Map<IRecipeInput, RecipeOutput> getMassFabricatorList() { try { return ic2.api.recipe.Recipes.matterAmplifier.getRecipes(); - } catch (Throwable e) {/*Do nothing*/} + } catch (Throwable e) { + /*Do nothing*/ + } return sMassfabRecipes; } @@ -720,14 +829,27 @@ public class GT_ModHandler { public static boolean addThermalCentrifugeRecipe(ItemStack aInput, int[] aChances, int aHeat, Object... aOutput) { if (aInput == null || aOutput == null || aOutput.length <= 0 || aOutput[0] == null) return false; if (!GregTech_API.sRecipeFile.get(ConfigCategories.Machines.thermalcentrifuge, aInput, true)) return false; - RA.addThermalCentrifugeRecipe(aInput, aOutput.length >= 1 ? (ItemStack)aOutput[0] : null, aOutput.length >= 2 ? (ItemStack)aOutput[1] : null, aOutput.length >= 3 ? (ItemStack)aOutput[2] : null, aChances, 500, 48); + RA.addThermalCentrifugeRecipe( + aInput, + aOutput.length >= 1 ? (ItemStack) aOutput[0] : null, + aOutput.length >= 2 ? (ItemStack) aOutput[1] : null, + aOutput.length >= 3 ? (ItemStack) aOutput[2] : null, + aChances, + 500, + 48); return true; } public static boolean addThermalCentrifugeRecipe(ItemStack aInput, int aHeat, Object... aOutput) { if (aInput == null || aOutput == null || aOutput.length <= 0 || aOutput[0] == null) return false; if (!GregTech_API.sRecipeFile.get(ConfigCategories.Machines.thermalcentrifuge, aInput, true)) return false; - RA.addThermalCentrifugeRecipe(aInput, aOutput.length >= 1 ? (ItemStack)aOutput[0] : null, aOutput.length >= 2 ? (ItemStack)aOutput[1] : null, aOutput.length >= 3 ? (ItemStack)aOutput[2] : null, 500, 48); + RA.addThermalCentrifugeRecipe( + aInput, + aOutput.length >= 1 ? (ItemStack) aOutput[0] : null, + aOutput.length >= 2 ? (ItemStack) aOutput[1] : null, + aOutput.length >= 3 ? (ItemStack) aOutput[2] : null, + 500, + 48); return true; } @@ -737,16 +859,46 @@ public class GT_ModHandler { public static boolean addOreWasherRecipe(ItemStack aInput, int[] aChances, int aWaterAmount, Object... aOutput) { if (aInput == null || aOutput == null || aOutput.length <= 0 || aOutput[0] == null) return false; if (!GregTech_API.sRecipeFile.get(ConfigCategories.Machines.orewashing, aInput, true)) return false; - RA.addOreWasherRecipe(aInput, (ItemStack)aOutput[0], (ItemStack)aOutput[1], (ItemStack)aOutput[2], GT_ModHandler.getWater(aWaterAmount), aChances, 500, 16); - RA.addOreWasherRecipe(aInput, (ItemStack)aOutput[0], (ItemStack)aOutput[1], (ItemStack)aOutput[2], GT_ModHandler.getDistilledWater(aWaterAmount / 5), aChances, 300, 16); + RA.addOreWasherRecipe( + aInput, + (ItemStack) aOutput[0], + (ItemStack) aOutput[1], + (ItemStack) aOutput[2], + GT_ModHandler.getWater(aWaterAmount), + aChances, + 500, + 16); + RA.addOreWasherRecipe( + aInput, + (ItemStack) aOutput[0], + (ItemStack) aOutput[1], + (ItemStack) aOutput[2], + GT_ModHandler.getDistilledWater(aWaterAmount / 5), + aChances, + 300, + 16); return true; } public static boolean addOreWasherRecipe(ItemStack aInput, int aWaterAmount, Object... aOutput) { if (aInput == null || aOutput == null || aOutput.length <= 0 || aOutput[0] == null) return false; if (!GregTech_API.sRecipeFile.get(ConfigCategories.Machines.orewashing, aInput, true)) return false; - RA.addOreWasherRecipe(aInput, (ItemStack)aOutput[0], (ItemStack)aOutput[1], (ItemStack)aOutput[2], GT_ModHandler.getWater(aWaterAmount), 500, 16); - RA.addOreWasherRecipe(aInput, (ItemStack)aOutput[0], (ItemStack)aOutput[1], (ItemStack)aOutput[2], GT_ModHandler.getDistilledWater(aWaterAmount / 5), 300, 16); + RA.addOreWasherRecipe( + aInput, + (ItemStack) aOutput[0], + (ItemStack) aOutput[1], + (ItemStack) aOutput[2], + GT_ModHandler.getWater(aWaterAmount), + 500, + 16); + RA.addOreWasherRecipe( + aInput, + (ItemStack) aOutput[0], + (ItemStack) aOutput[1], + (ItemStack) aOutput[2], + GT_ModHandler.getDistilledWater(aWaterAmount / 5), + 300, + 16); return true; } @@ -770,8 +922,11 @@ public class GT_ModHandler { try { NBTTagCompound tNBT = new NBTTagCompound(); tNBT.setInteger("amplification", aValue); - GT_Utility.callMethod(ic2.api.recipe.Recipes.matterAmplifier, "addRecipe", false, false, false, aAmplifier, tNBT); - } catch (Throwable e) {/*Do nothing*/} + GT_Utility.callMethod( + ic2.api.recipe.Recipes.matterAmplifier, "addRecipe", false, false, false, aAmplifier, tNBT); + } catch (Throwable e) { + /*Do nothing*/ + } return true; } @@ -782,7 +937,9 @@ public class GT_ModHandler { aResult = GT_OreDictUnificator.get(true, aResult); 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)); + mods.railcraft.api.crafting.RailcraftCraftingManager.rollingMachine + .getRecipeList() + .add(new ShapedOreRecipe(GT_Utility.copyOrNull(aResult), aRecipe)); } catch (Throwable e) { return addCraftingRecipe(GT_Utility.copyOrNull(aResult), aRecipe); } @@ -804,8 +961,26 @@ public class GT_ModHandler { /** * Shapeless Crafting Recipes. Deletes conflicting Recipes too. */ - public static boolean addCraftingRecipe(ItemStack aResult, Enchantment[] aEnchantmentsAdded, int[] aEnchantmentLevelsAdded, Object[] aRecipe) { - return addCraftingRecipe(aResult, aEnchantmentsAdded, aEnchantmentLevelsAdded, false, true, false, false, false, false, false, false, false, false, false, false, true, aRecipe); + public static boolean addCraftingRecipe( + ItemStack aResult, Enchantment[] aEnchantmentsAdded, int[] aEnchantmentLevelsAdded, Object[] aRecipe) { + return addCraftingRecipe( + aResult, + aEnchantmentsAdded, + aEnchantmentLevelsAdded, + false, + true, + false, + false, + false, + false, + false, + false, + false, + false, + false, + false, + true, + aRecipe); } /** @@ -862,47 +1037,46 @@ public class GT_ModHandler { */ public static boolean addCraftingRecipe(ItemStack aResult, long aBitMask, Object[] aRecipe) { return addCraftingRecipe( - aResult, - new Enchantment[0], - new int[0], - (aBitMask & RecipeBits.MIRRORED) != 0, - (aBitMask & RecipeBits.BUFFERED) != 0, - (aBitMask & RecipeBits.KEEPNBT) != 0, - (aBitMask & RecipeBits.DISMANTLEABLE) != 0, - (aBitMask & RecipeBits.NOT_REMOVABLE) == 0, - (aBitMask & RecipeBits.REVERSIBLE) != 0, - (aBitMask & RecipeBits.DELETE_ALL_OTHER_RECIPES) != 0, - (aBitMask & RecipeBits.DELETE_ALL_OTHER_RECIPES_IF_SAME_NBT) != 0, - (aBitMask & RecipeBits.DELETE_ALL_OTHER_SHAPED_RECIPES) != 0, - (aBitMask & RecipeBits.DELETE_ALL_OTHER_NATIVE_RECIPES) != 0, - (aBitMask & RecipeBits.DO_NOT_CHECK_FOR_COLLISIONS) == 0, - (aBitMask & RecipeBits.ONLY_ADD_IF_THERE_IS_ANOTHER_RECIPE_FOR_IT) != 0, - (aBitMask & RecipeBits.ONLY_ADD_IF_RESULT_IS_NOT_NULL) != 0, - aRecipe); + aResult, + new Enchantment[0], + new int[0], + (aBitMask & RecipeBits.MIRRORED) != 0, + (aBitMask & RecipeBits.BUFFERED) != 0, + (aBitMask & RecipeBits.KEEPNBT) != 0, + (aBitMask & RecipeBits.DISMANTLEABLE) != 0, + (aBitMask & RecipeBits.NOT_REMOVABLE) == 0, + (aBitMask & RecipeBits.REVERSIBLE) != 0, + (aBitMask & RecipeBits.DELETE_ALL_OTHER_RECIPES) != 0, + (aBitMask & RecipeBits.DELETE_ALL_OTHER_RECIPES_IF_SAME_NBT) != 0, + (aBitMask & RecipeBits.DELETE_ALL_OTHER_SHAPED_RECIPES) != 0, + (aBitMask & RecipeBits.DELETE_ALL_OTHER_NATIVE_RECIPES) != 0, + (aBitMask & RecipeBits.DO_NOT_CHECK_FOR_COLLISIONS) == 0, + (aBitMask & RecipeBits.ONLY_ADD_IF_THERE_IS_ANOTHER_RECIPE_FOR_IT) != 0, + (aBitMask & RecipeBits.ONLY_ADD_IF_RESULT_IS_NOT_NULL) != 0, + aRecipe); } /** * Internal realisation of the Crafting Recipe adding Process. */ private static boolean addCraftingRecipe( - ItemStack aResult, - Enchantment[] aEnchantmentsAdded, - int[] aEnchantmentLevelsAdded, - boolean aMirrored, - boolean aBuffered, - boolean aKeepNBT, - boolean aDismantleable, - boolean aRemovable, - boolean aReversible, - boolean aRemoveAllOthersWithSameOutput, - boolean aRemoveAllOthersWithSameOutputIfTheyHaveSameNBT, - boolean aRemoveAllOtherShapedsWithSameOutput, - boolean aRemoveAllOtherNativeRecipes, - boolean aCheckForCollisions, - boolean aOnlyAddIfThereIsAnyRecipeOutputtingThis, - boolean aOnlyAddIfResultIsNotNull, - Object[] aRecipe - ) { + ItemStack aResult, + Enchantment[] aEnchantmentsAdded, + int[] aEnchantmentLevelsAdded, + boolean aMirrored, + boolean aBuffered, + boolean aKeepNBT, + boolean aDismantleable, + boolean aRemovable, + boolean aReversible, + boolean aRemoveAllOthersWithSameOutput, + boolean aRemoveAllOthersWithSameOutputIfTheyHaveSameNBT, + boolean aRemoveAllOtherShapedsWithSameOutput, + boolean aRemoveAllOtherNativeRecipes, + boolean aCheckForCollisions, + boolean aOnlyAddIfThereIsAnyRecipeOutputtingThis, + boolean aOnlyAddIfResultIsNotNull, + Object[] aRecipe) { aResult = GT_OreDictUnificator.get(true, aResult); if (aOnlyAddIfResultIsNotNull && aResult == null) return false; if (aResult != null && Items.feather.getDamage(aResult) == W) Items.feather.setDamage(aResult, 0); @@ -912,12 +1086,13 @@ public class GT_ModHandler { boolean tThereWasARecipe = false; for (byte i = 0; i < aRecipe.length; i++) { - if (aRecipe[i] instanceof IItemContainer) - aRecipe[i] = ((IItemContainer) aRecipe[i]).get(1); - else if (aRecipe[i] instanceof Enum) - aRecipe[i] = ((Enum) aRecipe[i]).name(); - else if (!(aRecipe[i] == null || aRecipe[i] instanceof ItemStack || aRecipe[i] instanceof ItemData || aRecipe[i] instanceof String || aRecipe[i] instanceof Character)) - aRecipe[i] = aRecipe[i].toString(); + if (aRecipe[i] instanceof IItemContainer) aRecipe[i] = ((IItemContainer) aRecipe[i]).get(1); + else if (aRecipe[i] instanceof Enum) aRecipe[i] = ((Enum) aRecipe[i]).name(); + else if (!(aRecipe[i] == null + || aRecipe[i] instanceof ItemStack + || aRecipe[i] instanceof ItemData + || aRecipe[i] instanceof String + || aRecipe[i] instanceof Character)) aRecipe[i] = aRecipe[i].toString(); } try { @@ -1011,7 +1186,8 @@ public class GT_ModHandler { for (; idx < aRecipe.length; idx += 2) { if (aRecipe[idx] == null || aRecipe[idx + 1] == null) { if (D1) { - GT_Log.err.println("WARNING: Missing Item for shaped Recipe: " + (aResult == null ? "null" : aResult.getDisplayName())); + GT_Log.err.println("WARNING: Missing Item for shaped Recipe: " + + (aResult == null ? "null" : aResult.getDisplayName())); for (Object tContent : aRecipe) GT_Log.err.println(tContent); } return false; @@ -1084,8 +1260,7 @@ public class GT_ModHandler { } if (tDoWeCareIfThereWasARecipe || !aBuffered) tThereWasARecipe = removeRecipe(tRecipe) != null || tThereWasARecipe; - else - removeRecipeDelayed(tRecipe); + else removeRecipeDelayed(tRecipe); } } catch (Throwable e) { e.printStackTrace(GT_Log.err); @@ -1093,21 +1268,30 @@ public class GT_ModHandler { if (aResult == null || aResult.stackSize <= 0) return false; - if (aRemoveAllOthersWithSameOutput || aRemoveAllOthersWithSameOutputIfTheyHaveSameNBT || aRemoveAllOtherShapedsWithSameOutput || aRemoveAllOtherNativeRecipes) { - if(tDoWeCareIfThereWasARecipe || !aBuffered) - tThereWasARecipe = removeRecipeByOutput(aResult, !aRemoveAllOthersWithSameOutputIfTheyHaveSameNBT, aRemoveAllOtherShapedsWithSameOutput, aRemoveAllOtherNativeRecipes) || tThereWasARecipe; - else - removeRecipeByOutputDelayed(aResult); + if (aRemoveAllOthersWithSameOutput + || aRemoveAllOthersWithSameOutputIfTheyHaveSameNBT + || aRemoveAllOtherShapedsWithSameOutput + || aRemoveAllOtherNativeRecipes) { + if (tDoWeCareIfThereWasARecipe || !aBuffered) + tThereWasARecipe = removeRecipeByOutput( + aResult, + !aRemoveAllOthersWithSameOutputIfTheyHaveSameNBT, + aRemoveAllOtherShapedsWithSameOutput, + aRemoveAllOtherNativeRecipes) + || tThereWasARecipe; + else removeRecipeByOutputDelayed(aResult); } if (aOnlyAddIfThereIsAnyRecipeOutputtingThis && !tDoWeCareIfThereWasARecipe && !tThereWasARecipe) { - ArrayList<IRecipe> tList = (ArrayList<IRecipe>) CraftingManager.getInstance().getRecipeList(); - int tList_sS=tList.size(); + 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 (GT_Utility.areStacksEqual(GT_OreDictUnificator.get(tRecipe.getRecipeOutput()), aResult, true)) { - tList.remove(i--); tList_sS=tList.size(); + tList.remove(i--); + tList_sS = tList.size(); tThereWasARecipe = true; } } @@ -1120,9 +1304,25 @@ public class GT_ModHandler { if (tThereWasARecipe || !aOnlyAddIfThereIsAnyRecipeOutputtingThis) { if (sBufferCraftingRecipes && aBuffered) - sBufferRecipeList.add(new GT_Shaped_Recipe(GT_Utility.copyOrNull(aResult), aDismantleable, aRemovable, aKeepNBT, aEnchantmentsAdded, aEnchantmentLevelsAdded, aRecipe).setMirrored(aMirrored)); + sBufferRecipeList.add(new GT_Shaped_Recipe( + GT_Utility.copyOrNull(aResult), + aDismantleable, + aRemovable, + aKeepNBT, + aEnchantmentsAdded, + aEnchantmentLevelsAdded, + aRecipe) + .setMirrored(aMirrored)); else - GameRegistry.addRecipe(new GT_Shaped_Recipe(GT_Utility.copyOrNull(aResult), aDismantleable, aRemovable, aKeepNBT, aEnchantmentsAdded, aEnchantmentLevelsAdded, aRecipe).setMirrored(aMirrored)); + GameRegistry.addRecipe(new GT_Shaped_Recipe( + GT_Utility.copyOrNull(aResult), + aDismantleable, + aRemovable, + aKeepNBT, + aEnchantmentsAdded, + aEnchantmentLevelsAdded, + aRecipe) + .setMirrored(aMirrored)); } return true; } @@ -1130,37 +1330,56 @@ public class GT_ModHandler { /** * Shapeless Crafting Recipes. Deletes conflicting Recipes too. */ - public static boolean addShapelessEnchantingRecipe(ItemStack aResult, Enchantment[] aEnchantmentsAdded, int[] aEnchantmentLevelsAdded, Object[] aRecipe) { - return addShapelessCraftingRecipe(aResult, aEnchantmentsAdded, aEnchantmentLevelsAdded, true, false, false, false, aRecipe); + public static boolean addShapelessEnchantingRecipe( + ItemStack aResult, Enchantment[] aEnchantmentsAdded, int[] aEnchantmentLevelsAdded, Object[] aRecipe) { + return addShapelessCraftingRecipe( + aResult, aEnchantmentsAdded, aEnchantmentLevelsAdded, true, false, false, false, aRecipe); } /** * Shapeless Crafting Recipes. Deletes conflicting Recipes too. */ public static boolean addShapelessCraftingRecipe(ItemStack aResult, Object[] aRecipe) { - return addShapelessCraftingRecipe(aResult, RecipeBits.DO_NOT_CHECK_FOR_COLLISIONS | RecipeBits.BUFFERED, aRecipe); + return addShapelessCraftingRecipe( + aResult, RecipeBits.DO_NOT_CHECK_FOR_COLLISIONS | RecipeBits.BUFFERED, aRecipe); } /** * Shapeless Crafting Recipes. Deletes conflicting Recipes too. */ public static boolean addShapelessCraftingRecipe(ItemStack aResult, long aBitMask, Object[] aRecipe) { - return addShapelessCraftingRecipe(aResult, new Enchantment[0], new int[0], (aBitMask & RecipeBits.BUFFERED) != 0, (aBitMask & RecipeBits.KEEPNBT) != 0, (aBitMask & RecipeBits.DISMANTLEABLE) != 0, (aBitMask & RecipeBits.NOT_REMOVABLE) == 0, aRecipe); + return addShapelessCraftingRecipe( + aResult, + new Enchantment[0], + new int[0], + (aBitMask & RecipeBits.BUFFERED) != 0, + (aBitMask & RecipeBits.KEEPNBT) != 0, + (aBitMask & RecipeBits.DISMANTLEABLE) != 0, + (aBitMask & RecipeBits.NOT_REMOVABLE) == 0, + aRecipe); } /** * Shapeless Crafting Recipes. Deletes conflicting Recipes too. */ - private static boolean addShapelessCraftingRecipe(ItemStack aResult, Enchantment[] aEnchantmentsAdded, int[] aEnchantmentLevelsAdded, boolean aBuffered, boolean aKeepNBT, boolean aDismantleable, boolean aRemovable, Object[] aRecipe) { + private static boolean addShapelessCraftingRecipe( + ItemStack aResult, + Enchantment[] aEnchantmentsAdded, + int[] aEnchantmentLevelsAdded, + boolean aBuffered, + boolean aKeepNBT, + boolean aDismantleable, + boolean aRemovable, + Object[] aRecipe) { aResult = GT_OreDictUnificator.get(true, aResult); if (aRecipe == null || aRecipe.length <= 0) return false; for (byte i = 0; i < aRecipe.length; i++) { - if (aRecipe[i] instanceof IItemContainer) - aRecipe[i] = ((IItemContainer) aRecipe[i]).get(1); - else if (aRecipe[i] instanceof Enum) - aRecipe[i] = ((Enum) aRecipe[i]).name(); - else if (!(aRecipe[i] == null || aRecipe[i] instanceof ItemStack || aRecipe[i] instanceof String || aRecipe[i] instanceof Character)) - aRecipe[i] = aRecipe[i].toString(); + if (aRecipe[i] instanceof IItemContainer) aRecipe[i] = ((IItemContainer) aRecipe[i]).get(1); + else if (aRecipe[i] instanceof Enum) aRecipe[i] = ((Enum) aRecipe[i]).name(); + else if (!(aRecipe[i] == null + || aRecipe[i] instanceof ItemStack + || aRecipe[i] instanceof String + || aRecipe[i] instanceof Character)) aRecipe[i] = aRecipe[i].toString(); } try { ItemStack[] tRecipe = new ItemStack[9]; @@ -1168,7 +1387,8 @@ public class GT_ModHandler { for (Object tObject : aRecipe) { if (tObject == null) { if (D1) - GT_Log.err.println("WARNING: Missing Item for shapeless Recipe: " + (aResult == null ? "null" : aResult.getDisplayName())); + GT_Log.err.println("WARNING: Missing Item for shapeless Recipe: " + + (aResult == null ? "null" : aResult.getDisplayName())); for (Object tContent : aRecipe) GT_Log.err.println(tContent); return false; } @@ -1180,10 +1400,8 @@ public class GT_ModHandler { } i++; } - if (sBufferCraftingRecipes && aBuffered) - removeRecipeDelayed(tRecipe); - else - removeRecipe(tRecipe); + if (sBufferCraftingRecipes && aBuffered) removeRecipeDelayed(tRecipe); + else removeRecipe(tRecipe); } catch (Throwable e) { e.printStackTrace(GT_Log.err); } @@ -1196,9 +1414,23 @@ public class GT_ModHandler { GT_Utility.updateItemStack(aResult); if (sBufferCraftingRecipes && aBuffered) - sBufferRecipeList.add(new GT_Shapeless_Recipe(GT_Utility.copyOrNull(aResult), aDismantleable, aRemovable, aKeepNBT, aEnchantmentsAdded, aEnchantmentLevelsAdded, aRecipe)); + sBufferRecipeList.add(new GT_Shapeless_Recipe( + GT_Utility.copyOrNull(aResult), + aDismantleable, + aRemovable, + aKeepNBT, + aEnchantmentsAdded, + aEnchantmentLevelsAdded, + aRecipe)); else - GameRegistry.addRecipe(new GT_Shapeless_Recipe(GT_Utility.copyOrNull(aResult), aDismantleable, aRemovable, aKeepNBT, aEnchantmentsAdded, aEnchantmentLevelsAdded, aRecipe)); + GameRegistry.addRecipe(new GT_Shapeless_Recipe( + GT_Utility.copyOrNull(aResult), + aDismantleable, + aRemovable, + aKeepNBT, + aEnchantmentsAdded, + aEnchantmentLevelsAdded, + aRecipe)); return true; } @@ -1228,28 +1460,37 @@ public class GT_ModHandler { if (Arrays.stream(aRecipe).noneMatch(Objects::nonNull)) return null; ItemStack rReturn = null; - InventoryCrafting aCrafting = new InventoryCrafting(new Container() { - @Override - public boolean canInteractWith(EntityPlayer player) { - return false; - } - }, 3, 3); + InventoryCrafting aCrafting = new InventoryCrafting( + new Container() { + @Override + public boolean canInteractWith(EntityPlayer player) { + return false; + } + }, + 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(); - int tList_sS=tList.size(); + 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)) { + 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); - if (rReturn != null) tList.remove(i--); tList_sS=tList.size(); + if (rReturn != null) tList.remove(i--); + tList_sS = tList.size(); } } - }} catch (Throwable e) {e.printStackTrace(GT_Log.err);} + } + } catch (Throwable e) { + e.printStackTrace(GT_Log.err); + } return rReturn; } - public static void removeRecipeDelayed(ItemStack... aRecipe) { if (!sBufferCraftingRecipes) { removeRecipe(aRecipe); @@ -1259,42 +1500,50 @@ public class GT_ModHandler { if (aRecipe == null) return; if (Arrays.stream(aRecipe).noneMatch(Objects::nonNull)) return; - InventoryCrafting aCrafting = new InventoryCrafting(new Container() { - @Override - public boolean canInteractWith(EntityPlayer player) { - return false; - } - }, 3, 3); + InventoryCrafting aCrafting = new InventoryCrafting( + new Container() { + @Override + public boolean canInteractWith(EntityPlayer player) { + return false; + } + }, + 3, + 3); for (int i = 0; i < aRecipe.length && i < 9; i++) aCrafting.setInventorySlotContents(i, aRecipe[i]); delayedRemovalByRecipe.add(aCrafting); } @SuppressWarnings("unchecked") public static void bulkRemoveByRecipe(List<InventoryCrafting> toRemove) { - ArrayList<IRecipe> tList = (ArrayList<IRecipe>) CraftingManager.getInstance().getRecipeList(); - GT_FML_LOGGER.info("BulkRemoveByRecipe: tList: " + tList.size() + " toRemove: " + toRemove.size() ); + 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); } public static boolean removeRecipeByOutputDelayed(ItemStack aOutput) { - if (sBufferCraftingRecipes) - return delayedRemovalByOutput.add(aOutput); - else - return removeRecipeByOutput(aOutput); + if (sBufferCraftingRecipes) return delayedRemovalByOutput.add(aOutput); + else return removeRecipeByOutput(aOutput); } - public static boolean removeRecipeByOutputDelayed (ItemStack aOutput, boolean aIgnoreNBT, boolean aNotRemoveShapelessRecipes, boolean aOnlyRemoveNativeHandlers) { + public static boolean removeRecipeByOutputDelayed( + ItemStack aOutput, + boolean aIgnoreNBT, + boolean aNotRemoveShapelessRecipes, + boolean aOnlyRemoveNativeHandlers) { if (sBufferCraftingRecipes && (aIgnoreNBT && !aNotRemoveShapelessRecipes && !aOnlyRemoveNativeHandlers)) // Too lazy to handle deferred versions of the parameters that aren't used very often return delayedRemovalByOutput.add(aOutput); - else - return removeRecipeByOutput(aOutput, aIgnoreNBT, aNotRemoveShapelessRecipes, aOnlyRemoveNativeHandlers); + else return removeRecipeByOutput(aOutput, aIgnoreNBT, aNotRemoveShapelessRecipes, aOnlyRemoveNativeHandlers); } public static boolean removeRecipeByOutput(ItemStack aOutput) { @@ -1307,27 +1556,31 @@ public class GT_ModHandler { * @param aOutput The output of the Recipe. * @return if it has removed at least one Recipe. */ - public static boolean removeRecipeByOutput(ItemStack aOutput, boolean aIgnoreNBT, boolean aNotRemoveShapelessRecipes, boolean aOnlyRemoveNativeHandlers) { + public static boolean removeRecipeByOutput( + ItemStack aOutput, + boolean aIgnoreNBT, + 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(); + int tList_sS = tList.size(); for (int i = 0; i < tList_sS; i++) { IRecipe tRecipe = tList.get(i); - if (aNotRemoveShapelessRecipes && (tRecipe instanceof ShapelessRecipes || tRecipe instanceof ShapelessOreRecipe)) - continue; + if (aNotRemoveShapelessRecipes + && (tRecipe instanceof ShapelessRecipes || tRecipe instanceof ShapelessOreRecipe)) continue; if (aOnlyRemoveNativeHandlers) { if (!sNativeRecipeClasses.contains(tRecipe.getClass().getName())) continue; } else { if (sSpecialRecipeClasses.contains(tRecipe.getClass().getName())) continue; } ItemStack tStack = tRecipe.getRecipeOutput(); - if ( - (!(tRecipe instanceof IGT_CraftingRecipe) || ((IGT_CraftingRecipe) tRecipe).isRemovable()) - && GT_Utility.areStacksEqual(GT_OreDictUnificator.get(tStack), aOutput, aIgnoreNBT) - ) { - tList.remove(i--); tList_sS=tList.size(); + if ((!(tRecipe instanceof IGT_CraftingRecipe) || ((IGT_CraftingRecipe) tRecipe).isRemovable()) + && GT_Utility.areStacksEqual(GT_OreDictUnificator.get(tStack), aOutput, aIgnoreNBT)) { + tList.remove(i--); + tList_sS = tList.size(); rReturn = true; } } @@ -1335,18 +1588,23 @@ 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() ); + 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; @@ -1369,12 +1627,15 @@ public class GT_ModHandler { } } if (!temp) return null; - InventoryCrafting aCrafting = new InventoryCrafting(new Container() { - @Override - public boolean canInteractWith(EntityPlayer player) { - return false; - } - }, 3, 3); + InventoryCrafting aCrafting = new InventoryCrafting( + new Container() { + @Override + public boolean canInteractWith(EntityPlayer player) { + return false; + } + }, + 3, + 3); for (int i = 0; i < 9 && i < aRecipe.length; i++) aCrafting.setInventorySlotContents(i, aRecipe[i]); List<IRecipe> tList = CraftingManager.getInstance().getRecipeList(); synchronized (sAllRecipeList) { @@ -1407,8 +1668,14 @@ public class GT_ModHandler { if (tIndex == 2) { assert tStack1 != null && tStack2 != null; - if (tStack1.getItem() == tStack2.getItem() && tStack1.stackSize == 1 && tStack2.stackSize == 1 && tStack1.getItem().isRepairable()) { - int tNewDamage = tStack1.getMaxDamage() + tStack1.getItemDamage() - tStack2.getItemDamage() + tStack1.getMaxDamage() / 20; + if (tStack1.getItem() == tStack2.getItem() + && tStack1.stackSize == 1 + && tStack2.stackSize == 1 + && tStack1.getItem().isRepairable()) { + int tNewDamage = tStack1.getMaxDamage() + + tStack1.getItemDamage() + - tStack2.getItemDamage() + + tStack1.getMaxDamage() / 20; return new ItemStack(tStack1.getItem(), 1, tNewDamage < 0 ? 0 : tNewDamage); } } @@ -1425,7 +1692,7 @@ public class GT_ModHandler { } public static ItemStack getRecipeOutputNoOreDict(ItemStack... aRecipe) { - return getRecipeOutput(false,false, aRecipe); + return getRecipeOutput(false, false, aRecipe); } public static ItemStack getRecipeOutput(boolean aUncopiedStack, ItemStack... aRecipe) { @@ -1440,14 +1707,18 @@ public class GT_ModHandler { public static ItemStack getRecipeOutput(boolean aUncopiedStack, boolean allowOreDict, ItemStack... aRecipe) { if (aRecipe == null || Arrays.stream(aRecipe).noneMatch(Objects::nonNull)) return null; - InventoryCrafting aCrafting = new InventoryCrafting(new Container() { - @Override - public boolean canInteractWith(EntityPlayer player) { - return false; - } - }, 3, 3); + InventoryCrafting aCrafting = new InventoryCrafting( + new Container() { + @Override + public boolean canInteractWith(EntityPlayer player) { + return false; + } + }, + 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) { @@ -1464,7 +1735,8 @@ public class GT_ModHandler { if (tOutput == null || tOutput.stackSize <= 0) { // Seriously, who would ever do that shit? if (!GregTech_API.sPostloadFinished) - throw new GT_ItsNotMyFaultException("Seems another Mod added a Crafting Recipe with null Output. Tell the Developer of said Mod to fix that."); + throw new GT_ItsNotMyFaultException( + "Seems another Mod added a Crafting Recipe with null Output. Tell the Developer of said Mod to fix that."); } else { if (aUncopiedStack) return tOutput; return GT_Utility.copyOrNull(tOutput); @@ -1483,15 +1755,26 @@ 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 && !(tStack.getItem() instanceof ItemBlock) && !(tStack.getItem() instanceof IReactorComponent) && !isElectricItem(tStack) && !GT_Utility.isStackInList(tStack, sNonReplaceableItems)) { + if (GT_Utility.isStackValid(tStack) + && tStack.getMaxStackSize() == 1 + && tStack.getMaxDamage() > 0 + && !(tStack.getItem() instanceof ItemBlock) + && !(tStack.getItem() instanceof IReactorComponent) + && !isElectricItem(tStack) + && !GT_Utility.isStackInList(tStack, sNonReplaceableItems)) { if (!(tRecipe instanceof ShapelessRecipes || tRecipe instanceof ShapelessOreRecipe)) { if (tRecipe instanceof ShapedOreRecipe) { boolean temp = true; for (Object tObject : ((ShapedOreRecipe) tRecipe).getInput()) if (tObject != null) { - if (tObject instanceof ItemStack && (((ItemStack) tObject).getItem() == null || ((ItemStack) tObject).getMaxStackSize() < 2 || ((ItemStack) tObject).getMaxDamage() > 0 || ((ItemStack) tObject).getItem() instanceof ItemBlock)) { + if (tObject instanceof ItemStack + && (((ItemStack) tObject).getItem() == null + || ((ItemStack) tObject).getMaxStackSize() < 2 + || ((ItemStack) tObject).getMaxDamage() > 0 + || ((ItemStack) tObject).getItem() instanceof ItemBlock)) { temp = false; break; } @@ -1504,7 +1787,11 @@ public class GT_ModHandler { } else if (tRecipe instanceof ShapedRecipes) { boolean temp = true; for (ItemStack tObject : ((ShapedRecipes) tRecipe).recipeItems) { - if (tObject != null && (tObject.getItem() == null || tObject.getMaxStackSize() < 2 || tObject.getMaxDamage() > 0 || tObject.getItem() instanceof ItemBlock)) { + if (tObject != null + && (tObject.getItem() == null + || tObject.getMaxStackSize() < 2 + || tObject.getMaxDamage() > 0 + || tObject.getItem() instanceof ItemBlock)) { temp = false; break; } @@ -1516,7 +1803,11 @@ public class GT_ModHandler { } } } - GT_Log.out.println("GT_Mod: Created a List of Tool Recipes containing " + sSingleNonBlockDamagableRecipeList.size() + " Recipes for recycling." + (sSingleNonBlockDamagableRecipeList.size() > 1024 ? " Scanning all these Recipes is the reason for the startup Lag you receive right now." : E)); + GT_Log.out.println("GT_Mod: Created a List of Tool Recipes containing " + + sSingleNonBlockDamagableRecipeList.size() + " Recipes for recycling." + + (sSingleNonBlockDamagableRecipeList.size() > 1024 + ? " Scanning all these Recipes is the reason for the startup Lag you receive right now." + : E)); } List<ItemStack> rList = getRecipeOutputs(sSingleNonBlockDamagableRecipeList, true, aRecipe); if (!GregTech_API.sPostloadStarted || GregTech_API.sPostloadFinished) @@ -1542,20 +1833,22 @@ 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; - }) + 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); } @@ -1566,59 +1859,66 @@ 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; - InventoryCrafting aCrafting = new InventoryCrafting(new Container() { - @Override - public boolean canInteractWith(EntityPlayer player) { - return false; - } - }, 3, 3); - for (int i = 0; i < 9 && i < aRecipe.length; i++) - aCrafting.setInventorySlotContents(i, aRecipe[i]); + if (aRecipe == null || Arrays.stream(aRecipe).noneMatch(Objects::nonNull)) return rList; + InventoryCrafting aCrafting = new InventoryCrafting( + new Container() { + @Override + public boolean canInteractWith(EntityPlayer player) { + return false; + } + }, + 3, + 3); + 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; + 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; - - try { - matched = tRecipe.matches(aCrafting, DW); - } catch (Throwable e) { - e.printStackTrace(GT_Log.err); - } - if (matched) { - ItemStack tOutput = tRecipe.getCraftingResult(aCrafting); + }) + .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; - if (tOutput == null || tOutput.stackSize <= 0) { - // Seriously, who would ever do that shit? - if (!GregTech_API.sPostloadFinished) - throw new GT_ItsNotMyFaultException("Seems another Mod added a Crafting Recipe with null Output. Tell the Developer of said Mod to fix that."); - continue; + try { + matched = tRecipe.matches(aCrafting, DW); + } catch (Throwable e) { + e.printStackTrace(GT_Log.err); + } + if (matched) { + ItemStack tOutput = tRecipe.getCraftingResult(aCrafting); + + if (tOutput == null || tOutput.stackSize <= 0) { + // Seriously, who would ever do that shit? + if (!GregTech_API.sPostloadFinished) + throw new GT_ItsNotMyFaultException( + "Seems another Mod added a Crafting Recipe with null Output. Tell the Developer of said Mod to fix that."); + continue; + } + if (tOutput.stackSize != 1) continue; + if (tOutput.getMaxDamage() <= 0) continue; + if (tOutput.getMaxStackSize() != 1) continue; + if (tRecipe instanceof ShapelessRecipes) continue; + if (tRecipe instanceof ShapelessOreRecipe) continue; + if (tRecipe instanceof IGT_CraftingRecipe) continue; + rList.add(GT_Utility.copyOrNull(tOutput)); + iterator.remove(); } - if (tOutput.stackSize != 1) continue; - if (tOutput.getMaxDamage() <= 0) continue; - if (tOutput.getMaxStackSize() != 1) continue; - if (tRecipe instanceof ShapelessRecipes) continue; - if (tRecipe instanceof ShapelessOreRecipe) continue; - if (tRecipe instanceof IGT_CraftingRecipe) continue; - rList.add(GT_Utility.copyOrNull(tOutput)); - iterator.remove(); } - } return rList; } @@ -1627,7 +1927,8 @@ public class GT_ModHandler { */ @Deprecated public static ItemStack getMaceratorOutput(ItemStack aInput, boolean aRemoveInput, ItemStack aOutputSlot) { - return GT_Utility.copyOrNull(getMachineOutput(aInput, getMaceratorRecipeList(), aRemoveInput, new NBTTagCompound(), aOutputSlot)[0]); + return GT_Utility.copyOrNull( + getMachineOutput(aInput, getMaceratorRecipeList(), aRemoveInput, new NBTTagCompound(), aOutputSlot)[0]); } /** @@ -1635,7 +1936,8 @@ public class GT_ModHandler { */ @Deprecated public static ItemStack getExtractorOutput(ItemStack aInput, boolean aRemoveInput, ItemStack aOutputSlot) { - return GT_Utility.copyOrNull(getMachineOutput(aInput, getExtractorRecipeList(), aRemoveInput, new NBTTagCompound(), aOutputSlot)[0]); + return GT_Utility.copyOrNull( + getMachineOutput(aInput, getExtractorRecipeList(), aRemoveInput, new NBTTagCompound(), aOutputSlot)[0]); } /** @@ -1643,18 +1945,21 @@ public class GT_ModHandler { */ @Deprecated public static ItemStack getCompressorOutput(ItemStack aInput, boolean aRemoveInput, ItemStack aOutputSlot) { - return GT_Utility.copyOrNull(getMachineOutput(aInput, getCompressorRecipeList(), aRemoveInput, new NBTTagCompound(), aOutputSlot)[0]); + return GT_Utility.copyOrNull(getMachineOutput( + aInput, getCompressorRecipeList(), aRemoveInput, new NBTTagCompound(), aOutputSlot)[0]); } /** * Used in my own Furnace. */ public static ItemStack getSmeltingOutput(ItemStack aInput, boolean aRemoveInput, ItemStack aOutputSlot) { - if (aInput == null || aInput.stackSize < 1) - return null; + if (aInput == null || aInput.stackSize < 1) return null; 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()))) { + if (rStack != null + && (aOutputSlot == null + || (GT_Utility.areStacksEqual(rStack, aOutputSlot) + && rStack.stackSize + aOutputSlot.stackSize <= aOutputSlot.getMaxStackSize()))) { if (aRemoveInput) aInput.stackSize--; return rStack; } @@ -1666,7 +1971,12 @@ public class GT_ModHandler { * <p/> * Checks also if there is enough Space in the Output Slots. */ - public static ItemStack[] getMachineOutput(ItemStack aInput, Map<IRecipeInput, RecipeOutput> aRecipeList, boolean aRemoveInput, NBTTagCompound rRecipeMetaData, ItemStack... aOutputSlots) { + public static ItemStack[] getMachineOutput( + ItemStack aInput, + Map<IRecipeInput, RecipeOutput> aRecipeList, + boolean aRemoveInput, + NBTTagCompound rRecipeMetaData, + ItemStack... aOutputSlots) { if (aOutputSlots == null || aOutputSlots.length <= 0) return new ItemStack[0]; if (aInput == null) return new ItemStack[aOutputSlots.length]; try { @@ -1679,7 +1989,10 @@ public class GT_ModHandler { rRecipeMetaData.setTag("return", tEntry.getValue().metadata); for (byte i = 0; i < aOutputSlots.length && i < tList.length; i++) { if (tList[i] != null) { - if (aOutputSlots[i] == null || (GT_Utility.areStacksEqual(tList[i], aOutputSlots[i]) && tList[i].stackSize + aOutputSlots[i].stackSize <= aOutputSlots[i].getMaxStackSize())) { + if (aOutputSlots[i] == null + || (GT_Utility.areStacksEqual(tList[i], aOutputSlots[i]) + && tList[i].stackSize + aOutputSlots[i].stackSize + <= aOutputSlots[i].getMaxStackSize())) { rList[i] = GT_Utility.copyOrNull(tList[i]); } else { return new ItemStack[aOutputSlots.length]; @@ -1711,10 +2024,14 @@ public class GT_ModHandler { if (ic2.api.recipe.Recipes.recyclerWhitelist.isEmpty()) return ic2.api.recipe.Recipes.recyclerBlacklist.contains(aInput) ? null : ItemList.IC2_Scrap.get(1); return ic2.api.recipe.Recipes.recyclerWhitelist.contains(aInput) ? ItemList.IC2_Scrap.get(1) : null; - } catch (Throwable e) {/*Do nothing*/} + } catch (Throwable e) { + /*Do nothing*/ + } try { return ic2.api.recipe.Recipes.recyclerBlacklist.contains(aInput) ? null : ItemList.IC2_Scrap.get(1); - } catch (Throwable e) {/*Do nothing*/} + } catch (Throwable e) { + /*Do nothing*/ + } return null; } @@ -1732,7 +2049,8 @@ public class GT_ModHandler { * * @return the actually used Energy. */ - public static int chargeElectricItem(ItemStack aStack, int aCharge, int aTier, boolean aIgnoreLimit, boolean aSimulate) { + public static int chargeElectricItem( + ItemStack aStack, int aCharge, int aTier, boolean aIgnoreLimit, boolean aSimulate) { try { if (isElectricItem(aStack)) { int tTier = ((ic2.api.item.IElectricItem) aStack.getItem()).getTier(aStack); @@ -1740,12 +2058,15 @@ public class GT_ModHandler { if (!aIgnoreLimit && tTier >= 0) aCharge = (int) Math.min(aCharge, V[Math.max(0, Math.min(V.length - 1, tTier))]); if (aCharge > 0) { - int rCharge = (int) Math.max(0.0, ic2.api.item.ElectricItem.manager.charge(aStack, aCharge, tTier, true, aSimulate)); + int rCharge = (int) Math.max( + 0.0, ic2.api.item.ElectricItem.manager.charge(aStack, aCharge, tTier, true, aSimulate)); return rCharge + (rCharge * 4 > aTier ? aTier : 0); } } } - } catch (Throwable e) {/*Do nothing*/} + } catch (Throwable e) { + /*Do nothing*/ + } return 0; } @@ -1756,22 +2077,43 @@ public class GT_ModHandler { * * @return the Energy got from the Item. */ - public static int dischargeElectricItem(ItemStack aStack, int aCharge, int aTier, boolean aIgnoreLimit, boolean aSimulate, boolean aIgnoreDischargability) { + public static int dischargeElectricItem( + ItemStack aStack, + int aCharge, + int aTier, + boolean aIgnoreLimit, + boolean aSimulate, + boolean aIgnoreDischargability) { try { -// if (isElectricItem(aStack) && (aIgnoreDischargability || ((ic2.api.item.IElectricItem)aStack.getItem()).canProvideEnergy(aStack))) { + // if (isElectricItem(aStack) && (aIgnoreDischargability || + // ((ic2.api.item.IElectricItem)aStack.getItem()).canProvideEnergy(aStack))) { if (isElectricItem(aStack)) { int tTier = ((ic2.api.item.IElectricItem) aStack.getItem()).getTier(aStack); if (tTier < 0 || tTier == aTier || aTier == Integer.MAX_VALUE) { if (!aIgnoreLimit && tTier >= 0) - aCharge = (int) Math.min(aCharge, V[Math.max(0, Math.min(V.length - 1, tTier))] + B[Math.max(0, Math.min(V.length - 1, tTier))]); + aCharge = (int) Math.min( + aCharge, + V[Math.max(0, Math.min(V.length - 1, tTier))] + + B[Math.max(0, Math.min(V.length - 1, tTier))]); if (aCharge > 0) { -// int rCharge = Math.max(0, ic2.api.item.ElectricItem.manager.discharge(aStack, aCharge + (aCharge * 4 > aTier ? aTier : 0), tTier, T, aSimulate)); - int rCharge = (int) Math.max(0, ic2.api.item.ElectricItem.manager.discharge(aStack, aCharge + (aCharge * 4 > aTier ? aTier : 0), tTier, true, !aIgnoreDischargability, aSimulate)); + // int rCharge = Math.max(0, ic2.api.item.ElectricItem.manager.discharge(aStack, aCharge + + // (aCharge * 4 > aTier ? aTier : 0), tTier, T, aSimulate)); + int rCharge = (int) Math.max( + 0, + ic2.api.item.ElectricItem.manager.discharge( + aStack, + aCharge + (aCharge * 4 > aTier ? aTier : 0), + tTier, + true, + !aIgnoreDischargability, + aSimulate)); return rCharge - (rCharge * 4 > aTier ? aTier : 0); } } } - } catch (Throwable e) {/*Do nothing*/} + } catch (Throwable e) { + /*Do nothing*/ + } return 0; } @@ -1785,7 +2127,9 @@ public class GT_ModHandler { if (isElectricItem(aStack)) { return ic2.api.item.ElectricItem.manager.canUse(aStack, aCharge); } - } catch (Throwable e) {/*Do nothing*/} + } catch (Throwable e) { + /*Do nothing*/ + } return false; } @@ -1802,7 +2146,9 @@ public class GT_ModHandler { return ic2.api.item.ElectricItem.manager.use(aStack, aCharge, aPlayer); } } - } catch (Throwable e) {/*Do nothing*/} + } catch (Throwable e) { + /*Do nothing*/ + } return false; } @@ -1820,7 +2166,8 @@ public class GT_ModHandler { if (aPlayer != null && aPlayer instanceof EntityPlayer) { return GT_ModHandler.useElectricItem(aStack, aDecharge, (EntityPlayer) aPlayer); } - return GT_ModHandler.dischargeElectricItem(aStack, aDecharge, Integer.MAX_VALUE, true, false, true) >= aDecharge; + return GT_ModHandler.dischargeElectricItem(aStack, aDecharge, Integer.MAX_VALUE, true, false, true) + >= aDecharge; } } else if (aStack.getItem().isDamageable()) { if (aPlayer == null) { @@ -1854,11 +2201,13 @@ public class GT_ModHandler { if (tPlayer.capabilities.isCreativeMode) return true; if (isElectricItem(aStack) && ic2.api.item.ElectricItem.manager.getCharge(aStack) > 1000.0d) { if (consumeSolderingMaterial(tPlayer) - || (aExternalInventory != null && consumeSolderingMaterial(aExternalInventory))) { - if (canUseElectricItem(aStack, 10000)) { + || (aExternalInventory != null && consumeSolderingMaterial(aExternalInventory))) { + if (canUseElectricItem(aStack, 10000)) { return GT_ModHandler.useElectricItem(aStack, 10000, (EntityPlayer) aPlayer); } - GT_ModHandler.useElectricItem(aStack, (int) ic2.api.item.ElectricItem.manager.getCharge(aStack), (EntityPlayer) aPlayer); + GT_ModHandler.useElectricItem( + aStack, (int) ic2.api.item.ElectricItem.manager.getCharge(aStack), (EntityPlayer) + aPlayer); return false; } } @@ -1875,7 +2224,7 @@ public class GT_ModHandler { } public static boolean consumeSolderingMaterial(EntityPlayer aPlayer) { - if (aPlayer.capabilities.isCreativeMode) return true; + if (aPlayer.capabilities.isCreativeMode) return true; if (consumeSolderingMaterial(aPlayer.inventory)) { if (aPlayer.inventoryContainer != null) { aPlayer.inventoryContainer.detectAndSendChanges(); @@ -1914,7 +2263,9 @@ public class GT_ModHandler { if (isElectricItem(aStack)) { return ((ic2.api.item.IElectricItem) aStack.getItem()).canProvideEnergy(aStack); } - } catch (Throwable e) {/*Do nothing*/} + } catch (Throwable e) { + /*Do nothing*/ + } return false; } @@ -1923,15 +2274,23 @@ public class GT_ModHandler { */ public static boolean isElectricItem(ItemStack aStack) { try { - return aStack != null && aStack.getItem() instanceof ic2.api.item.IElectricItem && ((IElectricItem) aStack.getItem()).getTier(aStack) < Integer.MAX_VALUE; - } catch (Throwable e) {/*Do nothing*/} + return aStack != null + && aStack.getItem() instanceof ic2.api.item.IElectricItem + && ((IElectricItem) aStack.getItem()).getTier(aStack) < Integer.MAX_VALUE; + } catch (Throwable e) { + /*Do nothing*/ + } return false; } public static boolean isElectricItem(ItemStack aStack, byte aTier) { try { - return aStack != null && aStack.getItem() instanceof ic2.api.item.IElectricItem && ((IElectricItem) aStack.getItem()).getTier(aStack) == aTier; - } catch (Throwable e) {/*Do nothing*/} + return aStack != null + && aStack.getItem() instanceof ic2.api.item.IElectricItem + && ((IElectricItem) aStack.getItem()).getTier(aStack) == aTier; + } catch (Throwable e) { + /*Do nothing*/ + } return false; } @@ -1942,7 +2301,9 @@ public class GT_ModHandler { if (aStack != null) { try { ic2.api.item.ItemWrapper.registerBoxable(aStack.getItem(), (IBoxable) sBoxableWrapper); - } catch (Throwable ignored) {/*Do nothing*/} + } catch (Throwable ignored) { + /*Do nothing*/ + } sBoxableItems.add(new GT_ItemStack(aStack)); } } @@ -2042,58 +2403,56 @@ public class GT_ModHandler { * Copy of the original Helper Class of Thermal Expansion, just to make sure it works even when other Mods include TE-APIs */ public static class ThermalExpansion { - public static void addFurnaceRecipe(int energy, ItemStack input, ItemStack output) { + public static void addFurnaceRecipe(int energy, ItemStack input, ItemStack output) {} - } - - public static void addPulverizerRecipe(int energy, ItemStack input, ItemStack primaryOutput) { - } - - public static void addPulverizerRecipe(int energy, ItemStack input, ItemStack primaryOutput, ItemStack secondaryOutput) { - } + public static void addPulverizerRecipe(int energy, ItemStack input, ItemStack primaryOutput) {} - public static void addPulverizerRecipe(int energy, ItemStack input, ItemStack primaryOutput, ItemStack secondaryOutput, int secondaryChance) { - } + public static void addPulverizerRecipe( + int energy, ItemStack input, ItemStack primaryOutput, ItemStack secondaryOutput) {} - public static void addSawmillRecipe(int energy, ItemStack input, ItemStack primaryOutput) { - } + public static void addPulverizerRecipe( + int energy, ItemStack input, ItemStack primaryOutput, ItemStack secondaryOutput, int secondaryChance) {} - public static void addSawmillRecipe(int energy, ItemStack input, ItemStack primaryOutput, ItemStack secondaryOutput) { - } + public static void addSawmillRecipe(int energy, ItemStack input, ItemStack primaryOutput) {} - public static void addSawmillRecipe(int energy, ItemStack input, ItemStack primaryOutput, ItemStack secondaryOutput, int secondaryChance) { - - } + public static void addSawmillRecipe( + int energy, ItemStack input, ItemStack primaryOutput, ItemStack secondaryOutput) {} - public static void addSmelterRecipe(int energy, ItemStack primaryInput, ItemStack secondaryInput, ItemStack primaryOutput) { - } + public static void addSawmillRecipe( + int energy, ItemStack input, ItemStack primaryOutput, ItemStack secondaryOutput, int secondaryChance) {} - public static void addSmelterRecipe(int energy, ItemStack primaryInput, ItemStack secondaryInput, ItemStack primaryOutput, ItemStack secondaryOutput) { - } + public static void addSmelterRecipe( + int energy, ItemStack primaryInput, ItemStack secondaryInput, ItemStack primaryOutput) {} - public static void addSmelterRecipe(int energy, ItemStack primaryInput, ItemStack secondaryInput, ItemStack primaryOutput, ItemStack secondaryOutput, int secondaryChance) { + public static void addSmelterRecipe( + int energy, + ItemStack primaryInput, + ItemStack secondaryInput, + ItemStack primaryOutput, + ItemStack secondaryOutput) {} - } + public static void addSmelterRecipe( + int energy, + ItemStack primaryInput, + ItemStack secondaryInput, + ItemStack primaryOutput, + ItemStack secondaryOutput, + int secondaryChance) {} - public static void addSmelterBlastOre(Materials aMaterial) { - } + public static void addSmelterBlastOre(Materials aMaterial) {} - public static void addCrucibleRecipe(int energy, ItemStack input, FluidStack output) { - } + public static void addCrucibleRecipe(int energy, ItemStack input, FluidStack output) {} - public static void addTransposerFill(int energy, ItemStack input, ItemStack output, FluidStack fluid, boolean reversible) { - } + public static void addTransposerFill( + int energy, ItemStack input, ItemStack output, FluidStack fluid, boolean reversible) {} - public static void addTransposerExtract(int energy, ItemStack input, ItemStack output, FluidStack fluid, int chance, boolean reversible) { - } + public static void addTransposerExtract( + int energy, ItemStack input, ItemStack output, FluidStack fluid, int chance, boolean reversible) {} - public static void addMagmaticFuel(String fluidName, int energy) { - } + public static void addMagmaticFuel(String fluidName, int energy) {} - public static void addCompressionFuel(String fluidName, int energy) { - } + public static void addCompressionFuel(String fluidName, int energy) {} - public static void addCoolant(String fluidName, int energy) { - } + public static void addCoolant(String fluidName, int energy) {} } } 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 197d2bdaa5..626ca2690f 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 @@ -3,16 +3,14 @@ package gregtech.api.util; import com.google.common.collect.Multimaps; import com.google.common.collect.SetMultimap; import com.gtnewhorizon.structurelib.StructureLibAPI; -import gregtech.api.enums.Materials; -import net.minecraft.util.EnumChatFormatting; -import net.minecraft.util.StatCollector; - import java.util.HashMap; import java.util.HashSet; import java.util.LinkedList; import java.util.List; import java.util.stream.IntStream; import java.util.stream.Stream; +import net.minecraft.util.EnumChatFormatting; +import net.minecraft.util.StatCollector; /** * This makes it easier to build multi tooltips, with a standardized format. <br> @@ -38,433 +36,437 @@ import java.util.stream.Stream; * Originally created by kekzdealer */ public class GT_Multiblock_Tooltip_Builder { - private static final String TAB = " "; - private static final String COLON = ": "; - private static final String SEPARATOR = ", "; - - private final List<String> iLines; - private final List<String> sLines; - private final List<String> hLines; - private final SetMultimap<Integer, String> hBlocks; - - private String[] iArray; - private String[] sArray; - private String[] hArray; - - //Localized tooltips - private static final String TT_machineType = StatCollector.translateToLocal("GT5U.MBTT.MachineType"); - private static final String TT_dimensions = StatCollector.translateToLocal("GT5U.MBTT.Dimensions"); - private static final String TT_hollow = StatCollector.translateToLocal("GT5U.MBTT.Hollow"); - private static final String TT_structure = StatCollector.translateToLocal("GT5U.MBTT.Structure"); - private static final String TT_controller = StatCollector.translateToLocal("GT5U.MBTT.Controller"); - private static final String TT_minimum = StatCollector.translateToLocal("GT5U.MBTT.Minimum"); - private static final String TT_maintenancehatch = StatCollector.translateToLocal("GT5U.MBTT.MaintenanceHatch"); - private static final String TT_energyhatch = StatCollector.translateToLocal("GT5U.MBTT.EnergyHatch"); - private static final String TT_dynamohatch = StatCollector.translateToLocal("GT5U.MBTT.DynamoHatch"); - private static final String TT_mufflerhatch = StatCollector.translateToLocal("GT5U.MBTT.MufflerHatch"); - private static final String TT_inputbus = StatCollector.translateToLocal("GT5U.MBTT.InputBus"); - private static final String TT_inputhatch = StatCollector.translateToLocal("GT5U.MBTT.InputHatch"); - private static final String TT_outputbus = StatCollector.translateToLocal("GT5U.MBTT.OutputBus"); - private static final String TT_outputhatch = StatCollector.translateToLocal("GT5U.MBTT.OutputHatch"); - private static final String TT_causes = StatCollector.translateToLocal("GT5U.MBTT.Causes"); - private static final String TT_pps = StatCollector.translateToLocal("GT5U.MBTT.PPS"); - private static final String TT_hold = StatCollector.translateToLocal("GT5U.MBTT.Hold"); - private static final String TT_todisplay = StatCollector.translateToLocal("GT5U.MBTT.Display"); - private static final String TT_structurehint = StatCollector.translateToLocal("GT5U.MBTT.StructureHint"); - 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); - - public GT_Multiblock_Tooltip_Builder() { - iLines = new LinkedList<>(); - sLines = new LinkedList<>(); - hLines = new LinkedList<>(); - hBlocks = Multimaps.newSetMultimap(new HashMap<>(), HashSet::new); - hBlocks.put(StructureLibAPI.HINT_BLOCK_META_AIR, TT_air); - } - - /** - * Add a line telling you what the machine type is. Usually, this will be the name of a SB version.<br> - * Machine Type: machine - * - * @param machine - * Name of the machine type - * - * @return Instance this method was called on. - */ - public GT_Multiblock_Tooltip_Builder addMachineType(String machine) { - iLines.add(TT_machineType + COLON + EnumChatFormatting.YELLOW + machine + EnumChatFormatting.RESET); - return this; - } - - /** - * Add a basic line of information about this structure - * - * @param info - * The line to be added. - * @return Instance this method was called on. - */ - public GT_Multiblock_Tooltip_Builder addInfo(String info) { - iLines.add(info); - return this; - } - - /** - * Add a separator line like this:<br> - * ----------------------------------------- - * - * @return Instance this method was called on. - */ - public GT_Multiblock_Tooltip_Builder addSeparator() { - iLines.add("-----------------------------------------"); - return this; - } - - /** - * Add a line telling how much this machine pollutes. - * - * @param pollution - * Amount of pollution per second when active - * - * @return Instance this method was called on. - */ - public GT_Multiblock_Tooltip_Builder addPollutionAmount(int pollution) { - iLines.add(TT_causes + COLON + EnumChatFormatting.DARK_PURPLE + pollution + " " + EnumChatFormatting.GRAY + TT_pps); - return this; - } - - /** - * Begin adding structural information by adding a line about the structure's dimensions - * and then inserting a "Structure:" line. - * - * @param w - * Structure width. - * @param h - * Structure height. - * @param l - * Structure depth/length. - * @param hollow - * T/F, adds a (hollow) comment if true - * @return Instance this method was called on. - */ - public GT_Multiblock_Tooltip_Builder beginStructureBlock(int w, int h, int l, boolean hollow) { - if (hollow) { - sLines.add(TT_dimensions + COLON + w + "x" + h + "x" + l + " (WxHxL) " + TT_hollow); - } - else { - sLines.add(TT_dimensions + COLON + w + "x" + h + "x" + l + " (WxHxL)"); - } - sLines.add(TT_structure + COLON); - return this; - } - - /** - * Begin adding structural information by adding a line about the structure's dimensions<br> - * and then inserting a "Structure:" line. Variable version displays min and max - * - * @param wmin - * Structure min width. - * @param wmax - * Structure max width. - * @param hmin - * Structure min height. - * @param hmax - * Structure max height. - * @param lmin - * Structure min depth/length. - * @param lmax - * Structure max depth/length. - * @param hollow - * T/F, adds a (hollow) comment if true - * @return Instance this method was called on. - */ - public GT_Multiblock_Tooltip_Builder beginVariableStructureBlock(int wmin, int wmax, int hmin, int hmax, int lmin, int lmax, boolean hollow) { - if (hollow) { - sLines.add(TT_dimensions + COLON + wmin + "-" + wmax + "x" + hmin + "-" + hmax + "x" + lmin + "-" + lmax + " (WxHxL) " + TT_hollow); - } - else { - sLines.add(TT_dimensions + COLON + wmin + "-" + wmax + "x" + hmin + "-" + hmax + "x" + lmin + "-" + lmax + " (WxHxL)"); - } - sLines.add(TT_structure + COLON); - return this; - } - - /** - * Add a line of information about the structure:<br> - * (indent)Controller: info - * @param info - * Positional information. - * @return Instance this method was called on. - */ - public GT_Multiblock_Tooltip_Builder addController(String info) { - sLines.add(TAB + TT_controller + COLON + info); - return this; - } - - /** - * Add a line of information about the structure:<br> - * (indent)minCountx casingName (minimum) - * @param casingName - * Name of the Casing. - * @param minCount - * Minimum needed for valid structure check. - * @return Instance this method was called on. - */ - public GT_Multiblock_Tooltip_Builder addCasingInfo(String casingName, int minCount) { - sLines.add(TAB + minCount +"x " + casingName + " " + TT_minimum); - return this; - } - - /** - * Use this method to add a structural part that isn't covered by the other methods.<br> - * (indent)name: info - * @param name - * Name of the hatch or other component. - * @param info - * Positional information. - * @return Instance this method was called on. - */ - public GT_Multiblock_Tooltip_Builder addOtherStructurePart(String name, String info) { - sLines.add(TAB + name + COLON + info); - return this; - } - - /** - * Add a line of information about the structure:<br> - * (indent)Maintenance Hatch: info - * @param info - * Positional information. - * @return Instance this method was called on. - */ - public GT_Multiblock_Tooltip_Builder addMaintenanceHatch(String info) { - sLines.add(TAB + TT_maintenancehatch + COLON + info); - return this; - } - - /** - * Add a line of information about the structure:<br> - * (indent)Muffler Hatch: info - * @param info - * Location where the hatch goes - * @return Instance this method was called on. - */ - public GT_Multiblock_Tooltip_Builder addMufflerHatch(String info) { - sLines.add(TAB + TT_mufflerhatch + COLON + info); - return this; - } - - /** - * Add a line of information about the structure:<br> - * (indent)Energy Hatch: info - * @param info - * Positional information. - * @return Instance this method was called on. - */ - public GT_Multiblock_Tooltip_Builder addEnergyHatch(String info) { - sLines.add(TAB + TT_energyhatch + COLON + info); - return this; - } - - /** - * Add a line of information about the structure:<br> - * (indent)Dynamo Hatch: info - * @param info - * Positional information. - * @return Instance this method was called on. - */ - public GT_Multiblock_Tooltip_Builder addDynamoHatch(String info) { - sLines.add(TAB + TT_dynamohatch + COLON + info); - return this; - } - - /** - * Add a line of information about the structure:<br> - * (indent)Input Bus: info - * @param info - * Location where the bus goes - * @return Instance this method was called on. - */ - public GT_Multiblock_Tooltip_Builder addInputBus(String info) { - sLines.add(TAB + TT_inputbus + COLON + info); - return this; - } - - /** - * Add a line of information about the structure:<br> - * (indent)Input Hatch: info - * @param info - * Location where the hatch goes - * @return Instance this method was called on. - */ - public GT_Multiblock_Tooltip_Builder addInputHatch(String info) { - sLines.add(TAB + TT_inputhatch + COLON + info); - return this; - } - - /** - * Add a line of information about the structure:<br> - * (indent)Output Bus: info - * @param info - * Location where the bus goes - * @return Instance this method was called on. - */ - public GT_Multiblock_Tooltip_Builder addOutputBus(String info) { - sLines.add(TAB + TT_outputbus + COLON + info); - return this; - } - - /** - * Add a line of information about the structure:<br> - * (indent)Output Hatch: info - * @param info - * Location where the bus goes - * @return Instance this method was called on. - */ - public GT_Multiblock_Tooltip_Builder addOutputHatch(String info) { - sLines.add(TAB + TT_outputhatch + COLON + info); - return this; - } - - /** - * Use this method to add a structural part that isn't covered by the other methods.<br> - * (indent)name: info - * @param name - * Name of the hatch or other component. - * @param info - * Positional information. - * @param dots - * The valid locations for this part when asked to display hints - * @return Instance this method was called on. - */ - public GT_Multiblock_Tooltip_Builder addOtherStructurePart(String name, String info, int... dots) { - sLines.add(TAB + name + COLON + info); - for (int dot : dots) hBlocks.put(dot, name); - return this; - } - - /** - * Add a line of information about the structure:<br> - * (indent)Maintenance Hatch: info - * - * @param info Positional information. - * @param dots The valid locations for this part when asked to display hints - * @return Instance this method was called on. - */ - public GT_Multiblock_Tooltip_Builder addMaintenanceHatch(String info, int... dots) { - sLines.add(TAB + TT_maintenancehatch + COLON + info); - for (int dot : dots) hBlocks.put(dot, TT_maintenancehatch); - return this; - } - - /** - * Add a line of information about the structure:<br> - * (indent)Muffler Hatch: info - * - * @param info Location where the hatch goes - * @param dots The valid locations for this part when asked to display hints - * @return Instance this method was called on. - */ - public GT_Multiblock_Tooltip_Builder addMufflerHatch(String info, int... dots) { - sLines.add(TAB + TT_mufflerhatch + COLON + info); - for (int dot : dots) hBlocks.put(dot, TT_mufflerhatch); - return this; - } - - /** - * Add a line of information about the structure:<br> - * (indent)Energy Hatch: info - * - * @param info Positional information. - * @param dots The valid locations for this part when asked to display hints - * @return Instance this method was called on. - */ - public GT_Multiblock_Tooltip_Builder addEnergyHatch(String info, int... dots) { - sLines.add(TAB + TT_energyhatch + COLON + info); - for (int dot : dots) hBlocks.put(dot, TT_energyhatch); - return this; - } - - /** - * Add a line of information about the structure:<br> - * (indent)Dynamo Hatch: info - * - * @param info Positional information. - * @param dots The valid locations for this part when asked to display hints - * @return Instance this method was called on. - */ - public GT_Multiblock_Tooltip_Builder addDynamoHatch(String info, int... dots) { - sLines.add(TAB + TT_dynamohatch + COLON + info); - for (int dot : dots) hBlocks.put(dot, TT_dynamohatch); - return this; - } - - /** - * Add a line of information about the structure:<br> - * (indent)Input Bus: info - * - * @param info Location where the bus goes - * @param dots The valid locations for this part when asked to display hints - * @return Instance this method was called on. - */ - public GT_Multiblock_Tooltip_Builder addInputBus(String info, int... dots) { - sLines.add(TAB + TT_inputbus + COLON + info); - for (int dot : dots) hBlocks.put(dot, TT_inputbus); - return this; - } - - /** - * Add a line of information about the structure:<br> - * (indent)Input Hatch: info - * - * @param info Location where the hatch goes - * @param dots The valid locations for this part when asked to display hints - * @return Instance this method was called on. - */ - public GT_Multiblock_Tooltip_Builder addInputHatch(String info, int... dots) { - sLines.add(TAB + TT_inputhatch + COLON + info); - for (int dot : dots) hBlocks.put(dot, TT_inputhatch); - return this; - } - - /** - * Add a line of information about the structure:<br> - * (indent)Output Bus: info - * - * @param info Location where the bus goes - * @param dots The valid locations for this part when asked to display hints - * @return Instance this method was called on. - */ - public GT_Multiblock_Tooltip_Builder addOutputBus(String info, int... dots) { - sLines.add(TAB + TT_outputbus + COLON + info); - for (int dot : dots) hBlocks.put(dot, TT_outputbus); - return this; - } - - /** - * Add a line of information about the structure:<br> - * (indent)Output Hatch: info - * - * @param info Location where the bus goes - * @param dots The valid locations for this part when asked to display hints - * @return Instance this method was called on. - */ - public GT_Multiblock_Tooltip_Builder addOutputHatch(String info, int... dots) { - sLines.add(TAB + TT_outputhatch + COLON + info); - for (int dot : dots) hBlocks.put(dot, TT_outputhatch); - return this; - } - - /** - * Use this method to add non-standard structural info.<br> - * (indent)info - * @param info - * The line to be added. - * @return Instance this method was called on. - */ - public GT_Multiblock_Tooltip_Builder addStructureInfo(String info) { - sLines.add(TAB + info); - return this; - } + private static final String TAB = " "; + private static final String COLON = ": "; + private static final String SEPARATOR = ", "; + + private final List<String> iLines; + private final List<String> sLines; + private final List<String> hLines; + private final SetMultimap<Integer, String> hBlocks; + + private String[] iArray; + private String[] sArray; + private String[] hArray; + + // Localized tooltips + private static final String TT_machineType = StatCollector.translateToLocal("GT5U.MBTT.MachineType"); + private static final String TT_dimensions = StatCollector.translateToLocal("GT5U.MBTT.Dimensions"); + private static final String TT_hollow = StatCollector.translateToLocal("GT5U.MBTT.Hollow"); + private static final String TT_structure = StatCollector.translateToLocal("GT5U.MBTT.Structure"); + private static final String TT_controller = StatCollector.translateToLocal("GT5U.MBTT.Controller"); + private static final String TT_minimum = StatCollector.translateToLocal("GT5U.MBTT.Minimum"); + private static final String TT_maintenancehatch = StatCollector.translateToLocal("GT5U.MBTT.MaintenanceHatch"); + private static final String TT_energyhatch = StatCollector.translateToLocal("GT5U.MBTT.EnergyHatch"); + private static final String TT_dynamohatch = StatCollector.translateToLocal("GT5U.MBTT.DynamoHatch"); + private static final String TT_mufflerhatch = StatCollector.translateToLocal("GT5U.MBTT.MufflerHatch"); + private static final String TT_inputbus = StatCollector.translateToLocal("GT5U.MBTT.InputBus"); + private static final String TT_inputhatch = StatCollector.translateToLocal("GT5U.MBTT.InputHatch"); + private static final String TT_outputbus = StatCollector.translateToLocal("GT5U.MBTT.OutputBus"); + private static final String TT_outputhatch = StatCollector.translateToLocal("GT5U.MBTT.OutputHatch"); + private static final String TT_causes = StatCollector.translateToLocal("GT5U.MBTT.Causes"); + private static final String TT_pps = StatCollector.translateToLocal("GT5U.MBTT.PPS"); + private static final String TT_hold = StatCollector.translateToLocal("GT5U.MBTT.Hold"); + private static final String TT_todisplay = StatCollector.translateToLocal("GT5U.MBTT.Display"); + private static final String TT_structurehint = StatCollector.translateToLocal("GT5U.MBTT.StructureHint"); + 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); + + public GT_Multiblock_Tooltip_Builder() { + iLines = new LinkedList<>(); + sLines = new LinkedList<>(); + hLines = new LinkedList<>(); + hBlocks = Multimaps.newSetMultimap(new HashMap<>(), HashSet::new); + hBlocks.put(StructureLibAPI.HINT_BLOCK_META_AIR, TT_air); + } + + /** + * Add a line telling you what the machine type is. Usually, this will be the name of a SB version.<br> + * Machine Type: machine + * + * @param machine + * Name of the machine type + * + * @return Instance this method was called on. + */ + public GT_Multiblock_Tooltip_Builder addMachineType(String machine) { + iLines.add(TT_machineType + COLON + EnumChatFormatting.YELLOW + machine + EnumChatFormatting.RESET); + return this; + } + + /** + * Add a basic line of information about this structure + * + * @param info + * The line to be added. + * @return Instance this method was called on. + */ + public GT_Multiblock_Tooltip_Builder addInfo(String info) { + iLines.add(info); + return this; + } + + /** + * Add a separator line like this:<br> + * ----------------------------------------- + * + * @return Instance this method was called on. + */ + public GT_Multiblock_Tooltip_Builder addSeparator() { + iLines.add("-----------------------------------------"); + return this; + } + + /** + * Add a line telling how much this machine pollutes. + * + * @param pollution + * Amount of pollution per second when active + * + * @return Instance this method was called on. + */ + public GT_Multiblock_Tooltip_Builder addPollutionAmount(int pollution) { + iLines.add(TT_causes + COLON + EnumChatFormatting.DARK_PURPLE + pollution + " " + EnumChatFormatting.GRAY + + TT_pps); + return this; + } + + /** + * Begin adding structural information by adding a line about the structure's dimensions + * and then inserting a "Structure:" line. + * + * @param w + * Structure width. + * @param h + * Structure height. + * @param l + * Structure depth/length. + * @param hollow + * T/F, adds a (hollow) comment if true + * @return Instance this method was called on. + */ + public GT_Multiblock_Tooltip_Builder beginStructureBlock(int w, int h, int l, boolean hollow) { + if (hollow) { + sLines.add(TT_dimensions + COLON + w + "x" + h + "x" + l + " (WxHxL) " + TT_hollow); + } else { + sLines.add(TT_dimensions + COLON + w + "x" + h + "x" + l + " (WxHxL)"); + } + sLines.add(TT_structure + COLON); + return this; + } + + /** + * Begin adding structural information by adding a line about the structure's dimensions<br> + * and then inserting a "Structure:" line. Variable version displays min and max + * + * @param wmin + * Structure min width. + * @param wmax + * Structure max width. + * @param hmin + * Structure min height. + * @param hmax + * Structure max height. + * @param lmin + * Structure min depth/length. + * @param lmax + * Structure max depth/length. + * @param hollow + * T/F, adds a (hollow) comment if true + * @return Instance this method was called on. + */ + public GT_Multiblock_Tooltip_Builder beginVariableStructureBlock( + int wmin, int wmax, int hmin, int hmax, int lmin, int lmax, boolean hollow) { + if (hollow) { + sLines.add(TT_dimensions + COLON + wmin + "-" + wmax + "x" + hmin + "-" + hmax + "x" + lmin + "-" + lmax + + " (WxHxL) " + TT_hollow); + } else { + sLines.add(TT_dimensions + COLON + wmin + "-" + wmax + "x" + hmin + "-" + hmax + "x" + lmin + "-" + lmax + + " (WxHxL)"); + } + sLines.add(TT_structure + COLON); + return this; + } + + /** + * Add a line of information about the structure:<br> + * (indent)Controller: info + * @param info + * Positional information. + * @return Instance this method was called on. + */ + public GT_Multiblock_Tooltip_Builder addController(String info) { + sLines.add(TAB + TT_controller + COLON + info); + return this; + } + + /** + * Add a line of information about the structure:<br> + * (indent)minCountx casingName (minimum) + * @param casingName + * Name of the Casing. + * @param minCount + * Minimum needed for valid structure check. + * @return Instance this method was called on. + */ + public GT_Multiblock_Tooltip_Builder addCasingInfo(String casingName, int minCount) { + sLines.add(TAB + minCount + "x " + casingName + " " + TT_minimum); + return this; + } + + /** + * Use this method to add a structural part that isn't covered by the other methods.<br> + * (indent)name: info + * @param name + * Name of the hatch or other component. + * @param info + * Positional information. + * @return Instance this method was called on. + */ + public GT_Multiblock_Tooltip_Builder addOtherStructurePart(String name, String info) { + sLines.add(TAB + name + COLON + info); + return this; + } + + /** + * Add a line of information about the structure:<br> + * (indent)Maintenance Hatch: info + * @param info + * Positional information. + * @return Instance this method was called on. + */ + public GT_Multiblock_Tooltip_Builder addMaintenanceHatch(String info) { + sLines.add(TAB + TT_maintenancehatch + COLON + info); + return this; + } + + /** + * Add a line of information about the structure:<br> + * (indent)Muffler Hatch: info + * @param info + * Location where the hatch goes + * @return Instance this method was called on. + */ + public GT_Multiblock_Tooltip_Builder addMufflerHatch(String info) { + sLines.add(TAB + TT_mufflerhatch + COLON + info); + return this; + } + + /** + * Add a line of information about the structure:<br> + * (indent)Energy Hatch: info + * @param info + * Positional information. + * @return Instance this method was called on. + */ + public GT_Multiblock_Tooltip_Builder addEnergyHatch(String info) { + sLines.add(TAB + TT_energyhatch + COLON + info); + return this; + } + + /** + * Add a line of information about the structure:<br> + * (indent)Dynamo Hatch: info + * @param info + * Positional information. + * @return Instance this method was called on. + */ + public GT_Multiblock_Tooltip_Builder addDynamoHatch(String info) { + sLines.add(TAB + TT_dynamohatch + COLON + info); + return this; + } + + /** + * Add a line of information about the structure:<br> + * (indent)Input Bus: info + * @param info + * Location where the bus goes + * @return Instance this method was called on. + */ + public GT_Multiblock_Tooltip_Builder addInputBus(String info) { + sLines.add(TAB + TT_inputbus + COLON + info); + return this; + } + + /** + * Add a line of information about the structure:<br> + * (indent)Input Hatch: info + * @param info + * Location where the hatch goes + * @return Instance this method was called on. + */ + public GT_Multiblock_Tooltip_Builder addInputHatch(String info) { + sLines.add(TAB + TT_inputhatch + COLON + info); + return this; + } + + /** + * Add a line of information about the structure:<br> + * (indent)Output Bus: info + * @param info + * Location where the bus goes + * @return Instance this method was called on. + */ + public GT_Multiblock_Tooltip_Builder addOutputBus(String info) { + sLines.add(TAB + TT_outputbus + COLON + info); + return this; + } + + /** + * Add a line of information about the structure:<br> + * (indent)Output Hatch: info + * @param info + * Location where the bus goes + * @return Instance this method was called on. + */ + public GT_Multiblock_Tooltip_Builder addOutputHatch(String info) { + sLines.add(TAB + TT_outputhatch + COLON + info); + return this; + } + + /** + * Use this method to add a structural part that isn't covered by the other methods.<br> + * (indent)name: info + * @param name + * Name of the hatch or other component. + * @param info + * Positional information. + * @param dots + * The valid locations for this part when asked to display hints + * @return Instance this method was called on. + */ + public GT_Multiblock_Tooltip_Builder addOtherStructurePart(String name, String info, int... dots) { + sLines.add(TAB + name + COLON + info); + for (int dot : dots) hBlocks.put(dot, name); + return this; + } + + /** + * Add a line of information about the structure:<br> + * (indent)Maintenance Hatch: info + * + * @param info Positional information. + * @param dots The valid locations for this part when asked to display hints + * @return Instance this method was called on. + */ + public GT_Multiblock_Tooltip_Builder addMaintenanceHatch(String info, int... dots) { + sLines.add(TAB + TT_maintenancehatch + COLON + info); + for (int dot : dots) hBlocks.put(dot, TT_maintenancehatch); + return this; + } + + /** + * Add a line of information about the structure:<br> + * (indent)Muffler Hatch: info + * + * @param info Location where the hatch goes + * @param dots The valid locations for this part when asked to display hints + * @return Instance this method was called on. + */ + public GT_Multiblock_Tooltip_Builder addMufflerHatch(String info, int... dots) { + sLines.add(TAB + TT_mufflerhatch + COLON + info); + for (int dot : dots) hBlocks.put(dot, TT_mufflerhatch); + return this; + } + + /** + * Add a line of information about the structure:<br> + * (indent)Energy Hatch: info + * + * @param info Positional information. + * @param dots The valid locations for this part when asked to display hints + * @return Instance this method was called on. + */ + public GT_Multiblock_Tooltip_Builder addEnergyHatch(String info, int... dots) { + sLines.add(TAB + TT_energyhatch + COLON + info); + for (int dot : dots) hBlocks.put(dot, TT_energyhatch); + return this; + } + + /** + * Add a line of information about the structure:<br> + * (indent)Dynamo Hatch: info + * + * @param info Positional information. + * @param dots The valid locations for this part when asked to display hints + * @return Instance this method was called on. + */ + public GT_Multiblock_Tooltip_Builder addDynamoHatch(String info, int... dots) { + sLines.add(TAB + TT_dynamohatch + COLON + info); + for (int dot : dots) hBlocks.put(dot, TT_dynamohatch); + return this; + } + + /** + * Add a line of information about the structure:<br> + * (indent)Input Bus: info + * + * @param info Location where the bus goes + * @param dots The valid locations for this part when asked to display hints + * @return Instance this method was called on. + */ + public GT_Multiblock_Tooltip_Builder addInputBus(String info, int... dots) { + sLines.add(TAB + TT_inputbus + COLON + info); + for (int dot : dots) hBlocks.put(dot, TT_inputbus); + return this; + } + + /** + * Add a line of information about the structure:<br> + * (indent)Input Hatch: info + * + * @param info Location where the hatch goes + * @param dots The valid locations for this part when asked to display hints + * @return Instance this method was called on. + */ + public GT_Multiblock_Tooltip_Builder addInputHatch(String info, int... dots) { + sLines.add(TAB + TT_inputhatch + COLON + info); + for (int dot : dots) hBlocks.put(dot, TT_inputhatch); + return this; + } + + /** + * Add a line of information about the structure:<br> + * (indent)Output Bus: info + * + * @param info Location where the bus goes + * @param dots The valid locations for this part when asked to display hints + * @return Instance this method was called on. + */ + public GT_Multiblock_Tooltip_Builder addOutputBus(String info, int... dots) { + sLines.add(TAB + TT_outputbus + COLON + info); + for (int dot : dots) hBlocks.put(dot, TT_outputbus); + return this; + } + + /** + * Add a line of information about the structure:<br> + * (indent)Output Hatch: info + * + * @param info Location where the bus goes + * @param dots The valid locations for this part when asked to display hints + * @return Instance this method was called on. + */ + public GT_Multiblock_Tooltip_Builder addOutputHatch(String info, int... dots) { + sLines.add(TAB + TT_outputhatch + COLON + info); + for (int dot : dots) hBlocks.put(dot, TT_outputhatch); + return this; + } + + /** + * Use this method to add non-standard structural info.<br> + * (indent)info + * @param info + * The line to be added. + * @return Instance this method was called on. + */ + public GT_Multiblock_Tooltip_Builder addStructureInfo(String info) { + sLines.add(TAB + info); + return this; + } /** * Use this method to add non-standard structural info.<br> @@ -478,57 +480,62 @@ public class GT_Multiblock_Tooltip_Builder { return this; } - /** - * Use this method to add non-standard structural hint. This info will appear before the standard structural hint. - * @param info - * The line to be added. This should be an entry into minecraft's localization system. - * @return Instance this method was called on. - */ - public GT_Multiblock_Tooltip_Builder addStructureHint(String info) { - hLines.add(StatCollector.translateToLocal(info)); - return this; - } - - /** - * Use this method to add an entry to standard structural hint without creating a corresponding line in structure information - * @param name - * The name of block This should be an entry into minecraft's localization system. - * @param dots - * Possible locations of this block - * @return Instance this method was called on. - */ - public GT_Multiblock_Tooltip_Builder addStructureHint(String name, int... dots) { - for (int dot : dots) hBlocks.put(dot, StatCollector.translateToLocal(name)); - return this; - } - - /** - * Call at the very end.<br> - * Adds a final line with the mod name and information on how to display the structure guidelines.<br> - * Ends the building process. - * - * @param mod - * Name of the mod that adds this multiblock machine - */ - public void toolTipFinisher(String mod) { - iLines.add(TT_hold + " " + EnumChatFormatting.BOLD + "[LSHIFT]" + EnumChatFormatting.RESET + EnumChatFormatting.GRAY + " " + TT_todisplay); - iLines.add(TT_mod + COLON + EnumChatFormatting.GREEN + mod + EnumChatFormatting.GRAY); - hLines.add(TT_structurehint); - 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); - } - - public String[] getInformation() { - return iArray; - } - - public String[] getStructureInformation() { - return sArray; - } - - public String[] getStructureHint() { - return hArray; - } + /** + * Use this method to add non-standard structural hint. This info will appear before the standard structural hint. + * @param info + * The line to be added. This should be an entry into minecraft's localization system. + * @return Instance this method was called on. + */ + public GT_Multiblock_Tooltip_Builder addStructureHint(String info) { + hLines.add(StatCollector.translateToLocal(info)); + return this; + } + + /** + * Use this method to add an entry to standard structural hint without creating a corresponding line in structure information + * @param name + * The name of block This should be an entry into minecraft's localization system. + * @param dots + * Possible locations of this block + * @return Instance this method was called on. + */ + public GT_Multiblock_Tooltip_Builder addStructureHint(String name, int... dots) { + for (int dot : dots) hBlocks.put(dot, StatCollector.translateToLocal(name)); + return this; + } + + /** + * Call at the very end.<br> + * Adds a final line with the mod name and information on how to display the structure guidelines.<br> + * Ends the building process. + * + * @param mod + * Name of the mod that adds this multiblock machine + */ + public void toolTipFinisher(String mod) { + iLines.add(TT_hold + " " + EnumChatFormatting.BOLD + "[LSHIFT]" + EnumChatFormatting.RESET + + EnumChatFormatting.GRAY + " " + TT_todisplay); + iLines.add(TT_mod + COLON + EnumChatFormatting.GREEN + mod + EnumChatFormatting.GRAY); + hLines.add(TT_structurehint); + 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); + } + + public String[] getInformation() { + return iArray; + } + + public String[] getStructureInformation() { + return sArray; + } + + public String[] getStructureHint() { + return hArray; + } } diff --git a/src/main/java/gregtech/api/util/GT_OreDictUnificator.java b/src/main/java/gregtech/api/util/GT_OreDictUnificator.java index a017cf3bb0..81038645e9 100644 --- a/src/main/java/gregtech/api/util/GT_OreDictUnificator.java +++ b/src/main/java/gregtech/api/util/GT_OreDictUnificator.java @@ -1,5 +1,9 @@ package gregtech.api.util; +import static gregtech.api.enums.GT_Values.E; +import static gregtech.api.enums.GT_Values.M; +import static gregtech.api.enums.GT_Values.W; + import gregtech.api.GregTech_API; import gregtech.api.enums.Dyes; import gregtech.api.enums.Materials; @@ -9,21 +13,16 @@ import gregtech.api.objects.GT_HashSet; import gregtech.api.objects.GT_ItemStack; import gregtech.api.objects.ItemData; import gregtech.api.objects.MaterialStack; -import net.minecraft.init.Items; -import net.minecraft.item.ItemStack; -import net.minecraftforge.oredict.OreDictionary; - -import javax.annotation.Nullable; import java.util.ArrayList; import java.util.Collections; import java.util.HashMap; import java.util.List; import java.util.Map; import java.util.Map.Entry; - -import static gregtech.api.enums.GT_Values.E; -import static gregtech.api.enums.GT_Values.M; -import static gregtech.api.enums.GT_Values.W; +import javax.annotation.Nullable; +import net.minecraft.init.Items; +import net.minecraft.item.ItemStack; +import net.minecraftforge.oredict.OreDictionary; /** * NEVER INCLUDE THIS FILE IN YOUR MOD!!! @@ -69,14 +68,23 @@ public class GT_OreDictUnificator { set(aPrefix, aMaterial, aStack, true, false); } - public static void set(OrePrefixes aPrefix, Materials aMaterial, ItemStack aStack, boolean aOverwrite, boolean aAlreadyRegistered) { - if (aMaterial == null || aPrefix == null || GT_Utility.isStackInvalid(aStack) || Items.feather.getDamage(aStack) == W) - return; + public static void set( + OrePrefixes aPrefix, + Materials aMaterial, + ItemStack aStack, + boolean aOverwrite, + boolean aAlreadyRegistered) { + if (aMaterial == null + || aPrefix == null + || GT_Utility.isStackInvalid(aStack) + || Items.feather.getDamage(aStack) == W) return; isAddingOre++; 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()))) + if (aOverwrite + || GT_Utility.isStackInvalid( + sName2StackMap.get(aPrefix.get(aMaterial).toString()))) sName2StackMap.put(aPrefix.get(aMaterial).toString(), aStack); isAddingOre--; } @@ -101,12 +109,19 @@ public class GT_OreDictUnificator { } public static ItemStack get(OrePrefixes aPrefix, Object aMaterial, ItemStack aReplacement, long aAmount) { - //if (Materials.mDefaultComponents.contains(aPrefix) && !aPrefix.mDynamicItems.contains((Materials)aMaterial)) aPrefix.mDynamicItems.add((Materials) aMaterial); - if (OrePrefixes.mPreventableComponents.contains(aPrefix) && aPrefix.mDisabledItems.contains(aMaterial)) return aReplacement; + // if (Materials.mDefaultComponents.contains(aPrefix) && !aPrefix.mDynamicItems.contains((Materials)aMaterial)) + // aPrefix.mDynamicItems.add((Materials) aMaterial); + if (OrePrefixes.mPreventableComponents.contains(aPrefix) && aPrefix.mDisabledItems.contains(aMaterial)) + return aReplacement; return get(aPrefix.get(aMaterial), aReplacement, aAmount, false, true); } - public static ItemStack get(Object aName, ItemStack aReplacement, long aAmount, boolean aMentionPossibleTypos, boolean aNoInvalidAmounts) { + public static ItemStack get( + Object aName, + ItemStack aReplacement, + long aAmount, + boolean aMentionPossibleTypos, + boolean aNoInvalidAmounts) { if (aNoInvalidAmounts && aAmount < 1) return null; final ItemStack stackFromName = sName2StackMap.get(aName.toString()); if (stackFromName != null) return GT_Utility.copyAmount(aAmount, stackFromName); @@ -154,8 +169,9 @@ public class GT_OreDictUnificator { if (GT_Utility.isStackInvalid(aStack)) return null; ItemData tPrefixMaterial = getAssociation(aStack); ItemStack rStack = null; - if (tPrefixMaterial == null || !tPrefixMaterial.hasValidPrefixMaterialData() || (aUseBlackList && tPrefixMaterial.mBlackListed)) - return GT_Utility.copyOrNull(aStack); + if (tPrefixMaterial == null + || !tPrefixMaterial.hasValidPrefixMaterialData() + || (aUseBlackList && tPrefixMaterial.mBlackListed)) return GT_Utility.copyOrNull(aStack); if (aUseBlackList && !GregTech_API.sUnificationEntriesRegistered && isBlacklisted(aStack)) { tPrefixMaterial.mBlackListed = true; return GT_Utility.copyOrNull(aStack); @@ -174,15 +190,16 @@ public class GT_OreDictUnificator { public static ItemStack get_nocopy(ItemStack aStack) { return get_nocopy(true, aStack); } - + /** Doesn't copy the returned stack or set quantity. Be careful and do not mutate it; * intended only to optimize comparisons */ static ItemStack get_nocopy(boolean aUseBlackList, ItemStack aStack) { if (GT_Utility.isStackInvalid(aStack)) return null; ItemData tPrefixMaterial = getAssociation(aStack); ItemStack rStack = null; - if (tPrefixMaterial == null || !tPrefixMaterial.hasValidPrefixMaterialData() || (aUseBlackList && tPrefixMaterial.mBlackListed)) - return aStack; + if (tPrefixMaterial == null + || !tPrefixMaterial.hasValidPrefixMaterialData() + || (aUseBlackList && tPrefixMaterial.mBlackListed)) return aStack; if (aUseBlackList && !GregTech_API.sUnificationEntriesRegistered && isBlacklisted(aStack)) { tPrefixMaterial.mBlackListed = true; return aStack; @@ -205,18 +222,14 @@ public class GT_OreDictUnificator { ItemStack rStack = null; if (tPrefixMaterial == null || !tPrefixMaterial.hasValidPrefixMaterialData()) return GT_Utility.areStacksEqual(aStack, unified_tStack, true); - else if(tPrefixMaterial.mBlackListed) { - if (GT_Utility.areStacksEqual(aStack, unified_tStack, true)) - return true; - else - alreadyCompared = true; + else if (tPrefixMaterial.mBlackListed) { + if (GT_Utility.areStacksEqual(aStack, unified_tStack, true)) return true; + else alreadyCompared = true; } if (!alreadyCompared && !GregTech_API.sUnificationEntriesRegistered && isBlacklisted(aStack)) { tPrefixMaterial.mBlackListed = true; - if (GT_Utility.areStacksEqual(aStack, unified_tStack, true)) - return true; - else - alreadyCompared = true; + if (GT_Utility.areStacksEqual(aStack, unified_tStack, true)) return true; + else alreadyCompared = true; } if (tPrefixMaterial.mUnificationTarget == null) tPrefixMaterial.mUnificationTarget = sName2StackMap.get(tPrefixMaterial.toString()); @@ -247,25 +260,22 @@ public class GT_OreDictUnificator { } } } - ItemStack[] aStacks = {}; - if (obj instanceof ItemStack) - aStacks = new ItemStack[]{(ItemStack) obj}; - else if (obj instanceof ItemStack[]) - aStacks = (ItemStack[]) obj; - else if (obj instanceof List) aStacks = (ItemStack[]) - ((List)obj).toArray(new ItemStack[0]); - List<ItemStack> rList = new ArrayList<>(); - for (ItemStack aStack : aStacks) { - rList.add(aStack); - List<ItemStack> tList = sUnificationTable.get(new GT_ItemStack(aStack)); - if (tList != null) { - for (ItemStack tStack : tList) { - ItemStack tStack1 = GT_Utility.copyAmount(aStack.stackSize, tStack); - rList.add(tStack1); - } - } - } - return rList; + ItemStack[] aStacks = {}; + if (obj instanceof ItemStack) aStacks = new ItemStack[] {(ItemStack) obj}; + else if (obj instanceof ItemStack[]) aStacks = (ItemStack[]) obj; + else if (obj instanceof List) aStacks = (ItemStack[]) ((List) obj).toArray(new ItemStack[0]); + List<ItemStack> rList = new ArrayList<>(); + for (ItemStack aStack : aStacks) { + rList.add(aStack); + List<ItemStack> tList = sUnificationTable.get(new GT_ItemStack(aStack)); + if (tList != null) { + for (ItemStack tStack : tList) { + ItemStack tStack1 = GT_Utility.copyAmount(aStack.stackSize, tStack); + rList.add(tStack1); + } + } + } + return rList; } public static void addItemData(ItemStack aStack, ItemData aData) { @@ -276,8 +286,9 @@ public class GT_OreDictUnificator { if (GT_Utility.isStackInvalid(aStack) || aData == null) return; ItemData tData = getItemData(aStack); if (tData == null || !tData.hasValidPrefixMaterialData()) { - if (tData != null) for (Object tObject : tData.mExtraData) - if (!aData.mExtraData.contains(tObject)) aData.mExtraData.add(tObject); + if (tData != null) + for (Object tObject : tData.mExtraData) + if (!aData.mExtraData.contains(tObject)) aData.mExtraData.add(tObject); if (aStack.stackSize > 1) { if (aData.mMaterial != null) aData.mMaterial.mAmount /= aStack.stackSize; for (MaterialStack tMaterial : aData.mByProducts) tMaterial.mAmount /= aStack.stackSize; @@ -285,9 +296,13 @@ public class GT_OreDictUnificator { } sItemStack2DataMap.put(new GT_ItemStack(aStack), aData); if (aData.hasValidMaterialData()) { - long tValidMaterialAmount = aData.mMaterial.mMaterial.contains(SubTag.NO_RECYCLING) ? 0 : aData.mMaterial.mAmount >= 0 ? aData.mMaterial.mAmount : M; + long tValidMaterialAmount = aData.mMaterial.mMaterial.contains(SubTag.NO_RECYCLING) + ? 0 + : aData.mMaterial.mAmount >= 0 ? aData.mMaterial.mAmount : M; for (MaterialStack tMaterial : aData.mByProducts) - tValidMaterialAmount += tMaterial.mMaterial.contains(SubTag.NO_RECYCLING) ? 0 : tMaterial.mAmount >= 0 ? tMaterial.mAmount : M; + tValidMaterialAmount += tMaterial.mMaterial.contains(SubTag.NO_RECYCLING) + ? 0 + : tMaterial.mAmount >= 0 ? tMaterial.mAmount : M; if (tValidMaterialAmount < M) GT_ModHandler.addToRecyclerBlackList(aStack); } if (mRunThroughTheList) { @@ -295,7 +310,8 @@ public class GT_OreDictUnificator { mRunThroughTheList = false; for (Entry<GT_ItemStack, ItemData> tEntry : sItemStack2DataMap.entrySet()) if (!tEntry.getValue().hasValidPrefixData() || tEntry.getValue().mPrefix.mAllowNormalRecycling) - GT_RecipeRegistrator.registerMaterialRecycling(tEntry.getKey().toStack(), tEntry.getValue()); + GT_RecipeRegistrator.registerMaterialRecycling( + tEntry.getKey().toStack(), tEntry.getValue()); } } else { if (!aData.hasValidPrefixData() || aData.mPrefix.mAllowNormalRecycling) @@ -307,11 +323,13 @@ public class GT_OreDictUnificator { } } - public static void addAssociation(OrePrefixes aPrefix, Materials aMaterial, ItemStack aStack, boolean aBlackListed) { - if (aPrefix == null || aMaterial == null || GT_Utility.isStackInvalid(aStack)) - return; - if (Items.feather.getDamage(aStack) == W) for (byte i = 0; i < 16; i++) - setItemData(GT_Utility.copyAmountAndMetaData(1, i, aStack), new ItemData(aPrefix, aMaterial, aBlackListed)); + public static void addAssociation( + OrePrefixes aPrefix, Materials aMaterial, ItemStack aStack, boolean aBlackListed) { + if (aPrefix == null || aMaterial == null || GT_Utility.isStackInvalid(aStack)) return; + if (Items.feather.getDamage(aStack) == W) + for (byte i = 0; i < 16; i++) + setItemData( + GT_Utility.copyAmountAndMetaData(1, i, aStack), new ItemData(aPrefix, aMaterial, aBlackListed)); setItemData(aStack, new ItemData(aPrefix, aMaterial, aBlackListed)); } @@ -335,12 +353,9 @@ public class GT_OreDictUnificator { } public static boolean isItemStackDye(ItemStack aStack) { - if (GT_Utility.isStackInvalid(aStack)) - return false; + if (GT_Utility.isStackInvalid(aStack)) return false; - for (Dyes tDye : Dyes.VALUES) - if (isItemStackInstanceOf(aStack, tDye.toString())) - return true; + for (Dyes tDye : Dyes.VALUES) if (isItemStackInstanceOf(aStack, tDye.toString())) return true; return false; } @@ -350,17 +365,14 @@ public class GT_OreDictUnificator { } public static boolean registerOre(Object aName, ItemStack aStack) { - if (aName == null || GT_Utility.isStackInvalid(aStack)) - return false; + if (aName == null || GT_Utility.isStackInvalid(aStack)) return false; String tName = aName.toString(); - if (GT_Utility.isStringInvalid(tName)) - return false; + if (GT_Utility.isStringInvalid(tName)) return false; for (ItemStack itemStack : getOresImmutable(tName)) - if (GT_Utility.areStacksEqual(itemStack, aStack, true)) - return false; + if (GT_Utility.areStacksEqual(itemStack, aStack, true)) return false; isRegisteringOre++; OreDictionary.registerOre(tName, GT_Utility.copyAmount(1, aStack)); @@ -377,8 +389,7 @@ public class GT_OreDictUnificator { } public static void resetUnificationEntries() { - for (ItemData tPrefixMaterial : sItemStack2DataMap.values()) - tPrefixMaterial.mUnificationTarget = null; + for (ItemData tPrefixMaterial : sItemStack2DataMap.values()) tPrefixMaterial.mUnificationTarget = null; } public static ItemStack getGem(MaterialStack aMaterial) { @@ -391,8 +402,7 @@ public class GT_OreDictUnificator { public static ItemStack getGem(Materials aMaterial, long aMaterialAmount) { ItemStack rStack = null; - if (((aMaterialAmount >= M))) - rStack = get(OrePrefixes.gem, aMaterial, aMaterialAmount / M); + if (((aMaterialAmount >= M))) rStack = get(OrePrefixes.gem, aMaterial, aMaterialAmount / M); if (rStack == null) { if ((((aMaterialAmount * 2) % M == 0) || aMaterialAmount >= M * 16)) rStack = get(OrePrefixes.gemFlawed, aMaterial, (aMaterialAmount * 2) / M); @@ -491,7 +501,9 @@ public class GT_OreDictUnificator { */ public static List<ItemStack> getOresImmutable(@Nullable Object aOreName) { String aName = aOreName == null ? E : aOreName.toString(); - - return GT_Utility.isStringValid(aName) ? Collections.unmodifiableList(OreDictionary.getOres(aName)) : Collections.emptyList(); + + return GT_Utility.isStringValid(aName) + ? Collections.unmodifiableList(OreDictionary.getOres(aName)) + : Collections.emptyList(); } } diff --git a/src/main/java/gregtech/api/util/GT_PlayedSound.java b/src/main/java/gregtech/api/util/GT_PlayedSound.java index fa27bbb9d4..87743517d0 100644 --- a/src/main/java/gregtech/api/util/GT_PlayedSound.java +++ b/src/main/java/gregtech/api/util/GT_PlayedSound.java @@ -1,9 +1,9 @@ package gregtech.api.util; -import net.minecraft.util.ResourceLocation; - import static gregtech.api.enums.GT_Values.E; +import net.minecraft.util.ResourceLocation; + public class GT_PlayedSound { public final String mSoundName; public final int mX, mY, mZ; @@ -27,7 +27,10 @@ public class GT_PlayedSound { @Override public boolean equals(Object aObject) { if (aObject instanceof GT_PlayedSound) { - return ((GT_PlayedSound) aObject).mX == mX && ((GT_PlayedSound) aObject).mY == mY && ((GT_PlayedSound) aObject).mZ == mZ && ((GT_PlayedSound) aObject).mSoundName.equals(mSoundName); + return ((GT_PlayedSound) aObject).mX == mX + && ((GT_PlayedSound) aObject).mY == mY + && ((GT_PlayedSound) aObject).mZ == mZ + && ((GT_PlayedSound) aObject).mSoundName.equals(mSoundName); } return false; } diff --git a/src/main/java/gregtech/api/util/GT_ProcessingArray_Manager.java b/src/main/java/gregtech/api/util/GT_ProcessingArray_Manager.java index 0005f20869..548795cc49 100644 --- a/src/main/java/gregtech/api/util/GT_ProcessingArray_Manager.java +++ b/src/main/java/gregtech/api/util/GT_ProcessingArray_Manager.java @@ -1,20 +1,19 @@ package gregtech.api.util; import gregtech.api.util.GT_Recipe.GT_Recipe_Map; - import java.util.HashMap; public class GT_ProcessingArray_Manager { private static final HashMap<String, GT_Recipe_Map> mRecipeSaves = new HashMap<String, GT_Recipe_Map>(); - //Adds recipe Maps to the PA using the machines unlocalized name. - //Example: basicmachine.electrolyzer, with its recipe map will add the electrolyzer's recipe map to the PA + // Adds recipe Maps to the PA using the machines unlocalized name. + // Example: basicmachine.electrolyzer, with its recipe map will add the electrolyzer's recipe map to the PA public static void addRecipeMapToPA(String aMachineName, GT_Recipe_Map aMap) { if (aMachineName != null) { mRecipeSaves.put(aMachineName, aMap); } } - //Allows the PA to extract the recipe map for the machine inside it. + // Allows the PA to extract the recipe map for the machine inside it. public static GT_Recipe_Map giveRecipeMap(String aMachineName) { if (aMachineName != null) { return mRecipeSaves.get(aMachineName); diff --git a/src/main/java/gregtech/api/util/GT_Recipe.java b/src/main/java/gregtech/api/util/GT_Recipe.java index 9e46839f8c..5ec8ad16a2 100644 --- a/src/main/java/gregtech/api/util/GT_Recipe.java +++ b/src/main/java/gregtech/api/util/GT_Recipe.java @@ -1,5 +1,7 @@ package gregtech.api.util; +import static gregtech.api.enums.GT_Values.*; + import codechicken.nei.PositionedStack; import cpw.mods.fml.common.Loader; import cpw.mods.fml.common.ModContainer; @@ -16,6 +18,8 @@ import gregtech.api.util.extensions.ArrayExt; import gregtech.common.tileentities.machines.basic.GT_MetaTileEntity_Replicator; import gregtech.nei.GT_NEI_DefaultHandler.FixedPositionedStack; import ic2.core.Ic2Items; +import java.util.*; +import java.util.concurrent.atomic.AtomicInteger; import net.minecraft.init.Blocks; import net.minecraft.init.Items; import net.minecraft.item.Item; @@ -27,12 +31,6 @@ import net.minecraftforge.fluids.FluidContainerRegistry; import net.minecraftforge.fluids.FluidStack; import net.minecraftforge.fluids.IFluidContainerItem; -import java.util.*; -import java.util.concurrent.atomic.AtomicInteger; -import java.util.stream.Collectors; - -import static gregtech.api.enums.GT_Values.*; - /** * NEVER INCLUDE THIS FILE IN YOUR MOD!!! * <p/> @@ -60,6 +58,7 @@ public class GT_Recipe implements Comparable<GT_Recipe> { * An Item that needs to be inside the Special Slot, like for example the Copy Slot inside the Printer. This is only useful for Fake Recipes in NEI, since findRecipe() and containsInput() don't give a shit about this Field. Lists are also possible. */ public Object mSpecialItems; + public int mDuration, mEUt, mSpecialValue; /** * Use this to just disable a specific Recipe, but the Configuration enables that already for every single Recipe. @@ -113,19 +112,23 @@ public class GT_Recipe implements Comparable<GT_Recipe> { reloadOwner(); } - public GT_Recipe(boolean aOptimize, ItemStack[] aInputs, ItemStack[] aOutputs, Object aSpecialItems, int[] aChances, FluidStack[] aFluidInputs, FluidStack[] aFluidOutputs, int aDuration, int aEUt, int aSpecialValue) { - if (aInputs == null) - aInputs = new ItemStack[0]; - if (aOutputs == null) - aOutputs = new ItemStack[0]; - if (aFluidInputs == null) - aFluidInputs = new FluidStack[0]; - if (aFluidOutputs == null) - aFluidOutputs = new FluidStack[0]; - if (aChances == null) - aChances = new int[aOutputs.length]; - if (aChances.length < aOutputs.length) - aChances = Arrays.copyOf(aChances, aOutputs.length); + public GT_Recipe( + boolean aOptimize, + ItemStack[] aInputs, + ItemStack[] aOutputs, + Object aSpecialItems, + int[] aChances, + FluidStack[] aFluidInputs, + FluidStack[] aFluidOutputs, + int aDuration, + int aEUt, + int aSpecialValue) { + if (aInputs == null) aInputs = new ItemStack[0]; + if (aOutputs == null) aOutputs = new ItemStack[0]; + if (aFluidInputs == null) aFluidInputs = new FluidStack[0]; + if (aFluidOutputs == null) aFluidOutputs = new FluidStack[0]; + if (aChances == null) aChances = new int[aOutputs.length]; + if (aChances.length < aOutputs.length) aChances = Arrays.copyOf(aChances, aOutputs.length); aInputs = ArrayExt.withoutTrailingNulls(aInputs, ItemStack[]::new); aOutputs = ArrayExt.withoutTrailingNulls(aOutputs, ItemStack[]::new); @@ -135,16 +138,11 @@ public class GT_Recipe implements Comparable<GT_Recipe> { GT_OreDictUnificator.setStackArray(true, aInputs); GT_OreDictUnificator.setStackArray(true, aOutputs); - for (ItemStack tStack : aOutputs) - GT_Utility.updateItemStack(tStack); + for (ItemStack tStack : aOutputs) GT_Utility.updateItemStack(tStack); - for (int i = 0; i < aChances.length; i++) - if (aChances[i] <= 0) - aChances[i] = 10000; - for (int i = 0; i < aFluidInputs.length; i++) - aFluidInputs[i] = new GT_FluidStack(aFluidInputs[i]); - for (int i = 0; i < aFluidOutputs.length; i++) - aFluidOutputs[i] = new GT_FluidStack(aFluidOutputs[i]); + for (int i = 0; i < aChances.length; i++) if (aChances[i] <= 0) aChances[i] = 10000; + for (int i = 0; i < aFluidInputs.length; i++) aFluidInputs[i] = new GT_FluidStack(aFluidInputs[i]); + for (int i = 0; i < aFluidOutputs.length; i++) aFluidOutputs[i] = new GT_FluidStack(aFluidOutputs[i]); for (ItemStack aInput : aInputs) if (aInput != null && Items.feather.getDamage(aInput) != W) @@ -186,12 +184,9 @@ public class GT_Recipe implements Comparable<GT_Recipe> { break; } if (temp) { - for (ItemStack itemStack : tList) - itemStack.stackSize /= i; - for (FluidStack aFluidInput : aFluidInputs) - aFluidInput.amount /= i; - for (FluidStack aFluidOutput : aFluidOutputs) - aFluidOutput.amount /= i; + for (ItemStack itemStack : tList) itemStack.stackSize /= i; + for (FluidStack aFluidInput : aFluidInputs) aFluidInput.amount /= i; + for (FluidStack aFluidOutput : aFluidOutputs) aFluidOutput.amount /= i; aDuration /= i; } } @@ -206,7 +201,7 @@ public class GT_Recipe implements Comparable<GT_Recipe> { mDuration = aDuration; mSpecialValue = aSpecialValue; mEUt = aEUt; -// checkCellBalance(); + // checkCellBalance(); reloadOwner(); } @@ -220,33 +215,50 @@ public class GT_Recipe implements Comparable<GT_Recipe> { } // aSpecialValue = EU per Liter! If there is no Liquid for this Object, then it gets multiplied with 1000! - public GT_Recipe(ItemStack aInput1, ItemStack aOutput1, ItemStack aOutput2, ItemStack aOutput3, ItemStack aOutput4, int aSpecialValue, int aType) { - this(true, new ItemStack[]{aInput1}, new ItemStack[]{aOutput1, aOutput2, aOutput3, aOutput4}, null, null, null, null, 0, 0, Math.max(1, aSpecialValue)); + public GT_Recipe( + ItemStack aInput1, + ItemStack aOutput1, + ItemStack aOutput2, + ItemStack aOutput3, + ItemStack aOutput4, + int aSpecialValue, + int aType) { + this( + true, + new ItemStack[] {aInput1}, + new ItemStack[] {aOutput1, aOutput2, aOutput3, aOutput4}, + null, + null, + null, + null, + 0, + 0, + Math.max(1, aSpecialValue)); if (mInputs.length > 0 && aSpecialValue > 0) { switch (aType) { - // Diesel Generator + // Diesel Generator case 0: GT_Recipe_Map.sDieselFuels.addRecipe(this); GT_Recipe_Map.sLargeBoilerFakeFuels.addDieselRecipe(this); break; - // Gas Turbine + // Gas Turbine case 1: GT_Recipe_Map.sTurbineFuels.addRecipe(this); break; - // Thermal Generator + // Thermal Generator case 2: GT_Recipe_Map.sHotFuels.addRecipe(this); break; - // Plasma Generator + // Plasma Generator case 4: GT_Recipe_Map.sPlasmaFuels.addRecipe(this); break; - // Magic Generator + // Magic Generator case 5: GT_Recipe_Map.sMagicFuels.addRecipe(this); break; - // Fluid Generator. Usually 3. Every wrong Type ends up in the Semifluid Generator + // Fluid Generator. Usually 3. Every wrong Type ends up in the Semifluid Generator default: GT_Recipe_Map.sDenseLiquidFuels.addRecipe(this); GT_Recipe_Map.sLargeBoilerFakeFuels.addDenseLiquidRecipe(this); @@ -255,85 +267,221 @@ public class GT_Recipe implements Comparable<GT_Recipe> { } } - public GT_Recipe(FluidStack aInput1, FluidStack aInput2, FluidStack aOutput1, int aDuration, int aEUt, int aSpecialValue) { - this(true, null, null, null, null, new FluidStack[]{aInput1, aInput2}, new FluidStack[]{aOutput1}, Math.max(aDuration, 1), aEUt, Math.max(Math.min(aSpecialValue, 160000000), 0)); + public GT_Recipe( + FluidStack aInput1, FluidStack aInput2, FluidStack aOutput1, int aDuration, int aEUt, int aSpecialValue) { + this( + true, + null, + null, + null, + null, + new FluidStack[] {aInput1, aInput2}, + new FluidStack[] {aOutput1}, + Math.max(aDuration, 1), + aEUt, + Math.max(Math.min(aSpecialValue, 160000000), 0)); if (mInputs.length > 1) { GT_Recipe_Map.sFusionRecipes.addRecipe(this); } } public GT_Recipe(ItemStack aInput1, ItemStack aOutput1, ItemStack aOutput2, int aDuration, int aEUt) { - this(true, new ItemStack[]{aInput1}, new ItemStack[]{aOutput1, aOutput2}, null, null, null, null, aDuration, aEUt, 0); + this( + true, + new ItemStack[] {aInput1}, + new ItemStack[] {aOutput1, aOutput2}, + null, + null, + null, + null, + aDuration, + aEUt, + 0); if (mInputs.length > 0 && mOutputs[0] != null) { GT_Recipe_Map.sLatheRecipes.addRecipe(this); } } - public GT_Recipe(ItemStack aInput1, int aCellAmount, ItemStack aOutput1, ItemStack aOutput2, ItemStack aOutput3, ItemStack aOutput4, int aDuration, int aEUt) { - this(true, new ItemStack[]{aInput1, aCellAmount > 0 ? ItemList.Cell_Empty.get(Math.min(64, Math.max(1, aCellAmount))) : null}, new ItemStack[]{aOutput1, aOutput2, aOutput3, aOutput4}, null, null, null, null, Math.max(aDuration, 1), Math.max(aEUt, 1), 0); + public GT_Recipe( + ItemStack aInput1, + int aCellAmount, + ItemStack aOutput1, + ItemStack aOutput2, + ItemStack aOutput3, + ItemStack aOutput4, + int aDuration, + int aEUt) { + this( + true, + new ItemStack[] { + aInput1, aCellAmount > 0 ? ItemList.Cell_Empty.get(Math.min(64, Math.max(1, aCellAmount))) : null + }, + new ItemStack[] {aOutput1, aOutput2, aOutput3, aOutput4}, + null, + null, + null, + null, + Math.max(aDuration, 1), + Math.max(aEUt, 1), + 0); if (mInputs.length > 0 && mOutputs[0] != null) { GT_Recipe_Map.sDistillationRecipes.addRecipe(this); } } public GT_Recipe(ItemStack aInput1, int aInput2, ItemStack aOutput1, ItemStack aOutput2) { - this(true, new ItemStack[]{aInput1, GT_ModHandler.getIC2Item("industrialTnt", aInput2 > 0 ? Math.min(aInput2, 64) : 1, new ItemStack(Blocks.tnt, aInput2 > 0 ? Math.min(aInput2, 64) : 1))}, new ItemStack[]{aOutput1, aOutput2}, null, null, null, null, 20, 30, 0); + this( + true, + new ItemStack[] { + aInput1, + GT_ModHandler.getIC2Item( + "industrialTnt", + aInput2 > 0 ? Math.min(aInput2, 64) : 1, + new ItemStack(Blocks.tnt, aInput2 > 0 ? Math.min(aInput2, 64) : 1)) + }, + new ItemStack[] {aOutput1, aOutput2}, + null, + null, + null, + null, + 20, + 30, + 0); if (mInputs.length > 0 && mOutputs[0] != null) { GT_Recipe_Map.sImplosionRecipes.addRecipe(this); } } public GT_Recipe(int aEUt, int aDuration, ItemStack aInput1, ItemStack aOutput1) { - this(true, new ItemStack[]{aInput1, ItemList.Circuit_Integrated.getWithDamage(0, aInput1.stackSize)}, new ItemStack[]{aOutput1}, null, null, null, null, Math.max(aDuration, 1), Math.max(aEUt, 1), 0); + this( + true, + new ItemStack[] {aInput1, ItemList.Circuit_Integrated.getWithDamage(0, aInput1.stackSize)}, + new ItemStack[] {aOutput1}, + null, + null, + null, + null, + Math.max(aDuration, 1), + Math.max(aEUt, 1), + 0); if (mInputs.length > 0 && mOutputs[0] != null) { GT_Recipe_Map.sBenderRecipes.addRecipe(this); } } public GT_Recipe(ItemStack aInput1, ItemStack aInput2, int aEUt, int aDuration, ItemStack aOutput1) { - this(true, aInput2 == null ? new ItemStack[]{aInput1} : new ItemStack[]{aInput1, aInput2}, new ItemStack[]{aOutput1}, null, null, null, null, Math.max(aDuration, 1), Math.max(aEUt, 1), 0); + this( + true, + aInput2 == null ? new ItemStack[] {aInput1} : new ItemStack[] {aInput1, aInput2}, + new ItemStack[] {aOutput1}, + null, + null, + null, + null, + Math.max(aDuration, 1), + Math.max(aEUt, 1), + 0); if (mInputs.length > 0 && mOutputs[0] != null) { GT_Recipe_Map.sAlloySmelterRecipes.addRecipe(this); } } - public GT_Recipe(ItemStack aInput1, int aEUt, ItemStack aInput2, int aDuration, ItemStack aOutput1, ItemStack aOutput2) { - this(true, aInput2 == null ? new ItemStack[]{aInput1} : new ItemStack[]{aInput1, aInput2}, new ItemStack[]{aOutput1, aOutput2}, null, null, null, null, Math.max(aDuration, 1), Math.max(aEUt, 1), 0); + public GT_Recipe( + ItemStack aInput1, int aEUt, ItemStack aInput2, int aDuration, ItemStack aOutput1, ItemStack aOutput2) { + this( + true, + aInput2 == null ? new ItemStack[] {aInput1} : new ItemStack[] {aInput1, aInput2}, + new ItemStack[] {aOutput1, aOutput2}, + null, + null, + null, + null, + Math.max(aDuration, 1), + Math.max(aEUt, 1), + 0); if (mInputs.length > 0 && mOutputs[0] != null) { GT_Recipe_Map.sCannerRecipes.addRecipe(this); } } public GT_Recipe(ItemStack aInput1, ItemStack aOutput1, int aDuration) { - this(true, new ItemStack[]{aInput1}, new ItemStack[]{aOutput1}, null, null, null, null, Math.max(aDuration, 1), 120, 0); + this( + true, + new ItemStack[] {aInput1}, + new ItemStack[] {aOutput1}, + null, + null, + null, + null, + Math.max(aDuration, 1), + 120, + 0); if (mInputs.length > 0 && mOutputs[0] != null) { GT_Recipe_Map.sVacuumRecipes.addRecipe(this); } } public GT_Recipe(ItemStack aInput1, ItemStack aOutput1, int aDuration, int aEUt, int VACUUM) { - this(true, new ItemStack[]{aInput1}, new ItemStack[]{aOutput1}, null, null, null, null, Math.max(aDuration, 1), aEUt, 0); + this( + true, + new ItemStack[] {aInput1}, + new ItemStack[] {aOutput1}, + null, + null, + null, + null, + Math.max(aDuration, 1), + aEUt, + 0); if (mInputs.length > 0 && mOutputs[0] != null) { GT_Recipe_Map.sVacuumRecipes.addRecipe(this); } } public GT_Recipe(FluidStack aInput1, FluidStack aOutput1, int aDuration, int aEUt) { - this(false, null, null, null, null, new FluidStack[]{aInput1}, new FluidStack[]{aOutput1}, Math.max(aDuration, 1), aEUt, 0); + this( + false, + null, + null, + null, + null, + new FluidStack[] {aInput1}, + new FluidStack[] {aOutput1}, + Math.max(aDuration, 1), + aEUt, + 0); if (mFluidInputs.length > 0 && mFluidOutputs[0] != null) { GT_Recipe_Map.sVacuumRecipes.addRecipe(this); } } - //Dummy GT_Recipe maker... - public GT_Recipe(ItemStack[] aInputs, ItemStack[] aOutputs, Object aSpecialItems, int[] aChances, FluidStack[] aFluidInputs, FluidStack[] aFluidOutputs, int aDuration, int aEUt, int aSpecialValue){ - this(true, aInputs, aOutputs, aSpecialItems, aChances, aFluidInputs, aFluidOutputs, aDuration, aEUt, aSpecialValue); + // Dummy GT_Recipe maker... + public GT_Recipe( + ItemStack[] aInputs, + ItemStack[] aOutputs, + Object aSpecialItems, + int[] aChances, + FluidStack[] aFluidInputs, + FluidStack[] aFluidOutputs, + int aDuration, + int aEUt, + int aSpecialValue) { + this( + true, + aInputs, + aOutputs, + aSpecialItems, + aChances, + aFluidInputs, + aFluidOutputs, + aDuration, + aEUt, + aSpecialValue); } public static void reInit() { GT_Log.out.println("GT_Mod: Re-Unificating Recipes."); - for (GT_Recipe_Map tMapEntry : GT_Recipe_Map.sMappings) - tMapEntry.reInit(); + for (GT_Recipe_Map tMapEntry : GT_Recipe_Map.sMappings) tMapEntry.reInit(); } // ----- @@ -388,7 +536,8 @@ public class GT_Recipe implements Comparable<GT_Recipe> { return new GT_Recipe(this); } - public boolean isRecipeInputEqual(boolean aDecreaseStacksizeBySuccess, FluidStack[] aFluidInputs, ItemStack... aInputs) { + public boolean isRecipeInputEqual( + boolean aDecreaseStacksizeBySuccess, FluidStack[] aFluidInputs, ItemStack... aInputs) { return isRecipeInputEqual(aDecreaseStacksizeBySuccess, false, aFluidInputs, aInputs); } @@ -411,7 +560,11 @@ public class GT_Recipe implements Comparable<GT_Recipe> { * WARNING: Do not call this method with both {@code aDecreaseStacksizeBySuccess} and {@code aDontCheckStackSizes} set to {@code true}! * You'll get weird behavior. */ - public boolean isRecipeInputEqual(boolean aDecreaseStacksizeBySuccess, boolean aDontCheckStackSizes, FluidStack[] aFluidInputs, ItemStack... aInputs) { + public boolean isRecipeInputEqual( + boolean aDecreaseStacksizeBySuccess, + boolean aDontCheckStackSizes, + FluidStack[] aFluidInputs, + ItemStack... aInputs) { if (mInputs.length > 0 && aInputs == null) return false; if (mFluidInputs.length > 0 && aFluidInputs == null) return false; @@ -473,9 +626,12 @@ public class GT_Recipe implements Comparable<GT_Recipe> { ItemStack providedItem = aInputs[i]; 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)) { - if (!GT_Utility.areStacksEqual(providedItem, recipeItemCost, false)) - continue; + 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)) { + if (!GT_Utility.areStacksEqual(providedItem, recipeItemCost, false)) continue; } } @@ -559,8 +715,8 @@ public class GT_Recipe implements Comparable<GT_Recipe> { */ @SuppressWarnings("DeprecatedIsStillUsed") @Deprecated - public ArrayList<PositionedStack> getInputPositionedStacks(){ - return null; + public ArrayList<PositionedStack> getInputPositionedStacks() { + return null; } /** @@ -568,21 +724,20 @@ public class GT_Recipe implements Comparable<GT_Recipe> { */ @SuppressWarnings("DeprecatedIsStillUsed") @Deprecated - public ArrayList<PositionedStack> getOutputPositionedStacks(){ - return null; + public ArrayList<PositionedStack> getOutputPositionedStacks() { + return null; } public void reloadOwner() { setOwner(Loader.instance().activeModContainer()); - final List<String> excludedClasses = Arrays.asList( - "java.lang.Thread", - "gregtech.api.util.GT_Recipe", - "gregtech.common.GT_RecipeAdder"); + final List<String> excludedClasses = + Arrays.asList("java.lang.Thread", "gregtech.api.util.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().contains(c))) { + if (excludedClasses.stream() + .noneMatch(c -> stackTrace.getClassName().contains(c))) { toAdd.add(stackTrace); } } @@ -609,14 +764,14 @@ public class GT_Recipe implements Comparable<GT_Recipe> { } } - public static class GT_Recipe_AssemblyLine{ - public static final ArrayList<GT_Recipe_AssemblyLine> sAssemblylineRecipes = new ArrayList<GT_Recipe_AssemblyLine>(); + public static class GT_Recipe_AssemblyLine { + public static final ArrayList<GT_Recipe_AssemblyLine> sAssemblylineRecipes = + new ArrayList<GT_Recipe_AssemblyLine>(); static { if (!Boolean.getBoolean("com.gtnh.gt5u.ignore-invalid-assline-recipe")) GregTech_API.sFirstWorldTick.add(GT_Recipe_AssemblyLine::checkInvalidRecipes); - else - GT_Log.out.println("NOT CHECKING INVALID ASSLINE RECIPE."); + else GT_Log.out.println("NOT CHECKING INVALID ASSLINE RECIPE."); } private static void checkInvalidRecipes() { @@ -629,7 +784,8 @@ public class GT_Recipe implements Comparable<GT_Recipe> { } } if (invalidCount > 0) - throw new RuntimeException("There are " + invalidCount + " invalid assembly line recipe(s)! Check GregTech.log for details!"); + throw new RuntimeException("There are " + invalidCount + + " invalid assembly line recipe(s)! Check GregTech.log for details!"); } public ItemStack mResearchItem; @@ -647,8 +803,23 @@ public class GT_Recipe implements Comparable<GT_Recipe> { * * if you set one yourself, it will give you one of the RunetimeExceptions! */ - public GT_Recipe_AssemblyLine(ItemStack aResearchItem, int aResearchTime, ItemStack[] aInputs, FluidStack[] aFluidInputs, ItemStack aOutput, int aDuration, int aEUt) { - this(aResearchItem, aResearchTime, aInputs, aFluidInputs, aOutput, aDuration, aEUt, new ItemStack[aInputs.length][]); + public GT_Recipe_AssemblyLine( + ItemStack aResearchItem, + int aResearchTime, + ItemStack[] aInputs, + FluidStack[] aFluidInputs, + ItemStack aOutput, + int aDuration, + int aEUt) { + this( + aResearchItem, + aResearchTime, + aInputs, + aFluidInputs, + aOutput, + aDuration, + aEUt, + new ItemStack[aInputs.length][]); int tPersistentHash = 1; for (ItemStack tInput : aInputs) tPersistentHash = tPersistentHash * 31 + GT_Utility.persistentHash(tInput, true, false); @@ -667,94 +838,97 @@ public class GT_Recipe implements Comparable<GT_Recipe> { * * if you don't set one yourself, it will break a lot of stuff! */ - public GT_Recipe_AssemblyLine(ItemStack aResearchItem, int aResearchTime, ItemStack[] aInputs, FluidStack[] aFluidInputs, ItemStack aOutput, int aDuration, int aEUt, ItemStack[][] aAlt) { - mResearchItem = aResearchItem; - mResearchTime = aResearchTime; - mInputs = aInputs; - mFluidInputs = aFluidInputs; - mOutput = aOutput; - mDuration = aDuration; - mEUt = aEUt; - mOreDictAlt = aAlt; + public GT_Recipe_AssemblyLine( + ItemStack aResearchItem, + int aResearchTime, + ItemStack[] aInputs, + FluidStack[] aFluidInputs, + ItemStack aOutput, + int aDuration, + int aEUt, + ItemStack[][] aAlt) { + mResearchItem = aResearchItem; + mResearchTime = aResearchTime; + mInputs = aInputs; + mFluidInputs = aFluidInputs; + mOutput = aOutput; + mDuration = aDuration; + mEUt = aEUt; + mOreDictAlt = aAlt; + } + + @Override + public int hashCode() { + final int prime = 31; + int result = 1; + GT_ItemStack[] thisInputs = new GT_ItemStack[this.mInputs.length]; + int totalInputStackSize = 0; + for (int i = 0; i < this.mInputs.length; i++) { + thisInputs[i] = new GT_ItemStack(this.mInputs[i]); + totalInputStackSize += thisInputs[i].mStackSize; + } + int inputHash = Arrays.deepHashCode(thisInputs); + int inputFluidHash = Arrays.deepHashCode(this.mFluidInputs); + GT_ItemStack thisOutput = new GT_ItemStack(mOutput); + GT_ItemStack thisResearch = new GT_ItemStack(mResearchItem); + int miscRecipeDataHash = Arrays.deepHashCode( + new Object[] {totalInputStackSize, mDuration, mEUt, thisOutput, thisResearch, mResearchTime}); + result = prime * result + inputFluidHash; + result = prime * result + inputHash; + result = prime * result + miscRecipeDataHash; + return result; } @Override - public int hashCode() { - final int prime = 31; - int result = 1; - GT_ItemStack[] thisInputs = new GT_ItemStack[this.mInputs.length]; - int totalInputStackSize = 0; - for (int i=0;i<this.mInputs.length;i++) { - thisInputs[i] = new GT_ItemStack(this.mInputs[i]); - totalInputStackSize += thisInputs[i].mStackSize; - } - int inputHash = Arrays.deepHashCode(thisInputs); - int inputFluidHash = Arrays.deepHashCode(this.mFluidInputs); - GT_ItemStack thisOutput = new GT_ItemStack(mOutput); - GT_ItemStack thisResearch = new GT_ItemStack(mResearchItem); - int miscRecipeDataHash = Arrays.deepHashCode(new Object[] { - totalInputStackSize, - mDuration, mEUt, - thisOutput, - thisResearch, - mResearchTime - }); - result = prime * result + inputFluidHash; - result = prime * result + inputHash; - result = prime * result + miscRecipeDataHash; - return result; - } - - @Override - public boolean equals(Object obj) { - if (this == obj) { - return true; - } - if (!(obj instanceof GT_Recipe_AssemblyLine)) { - return false; - } - GT_Recipe_AssemblyLine other = (GT_Recipe_AssemblyLine) obj; - if (this.mInputs.length != other.mInputs.length) { - return false; - } - if (this.mFluidInputs.length != other.mFluidInputs.length) { - return false; - } - // Check Outputs Match - GT_ItemStack output1 = new GT_ItemStack(this.mOutput); - GT_ItemStack output2 = new GT_ItemStack(other.mOutput); - if (!output1.equals(output2)) { - return false; - } - // Check Scanned Item Match - GT_ItemStack scan1 = new GT_ItemStack(this.mResearchItem); - GT_ItemStack scan2 = new GT_ItemStack(other.mResearchItem); - if (!scan1.equals(scan2)) { - return false; - } - // Check Items Match - GT_ItemStack[] thisInputs = new GT_ItemStack[this.mInputs.length]; - GT_ItemStack[] otherInputs = new GT_ItemStack[other.mInputs.length]; - for (int i=0;i<thisInputs.length;i++) { - thisInputs[i] = new GT_ItemStack(this.mInputs[i]); - otherInputs[i] = new GT_ItemStack(other.mInputs[i]); - } - for (int i=0;i<thisInputs.length;i++) { - if (!thisInputs[i].equals(otherInputs[i]) || thisInputs[i].mStackSize != otherInputs[i].mStackSize) { - return false; - } - } - // Check Fluids Match - for (int i=0;i<this.mFluidInputs.length;i++) { - if (!this.mFluidInputs[i].isFluidStackIdentical(other.mFluidInputs[i])) { - return false; - } - } - - return this.mDuration == other.mDuration - && this.mEUt == other.mEUt - && this.mResearchTime == other.mResearchTime; - } + public boolean equals(Object obj) { + if (this == obj) { + return true; + } + if (!(obj instanceof GT_Recipe_AssemblyLine)) { + return false; + } + GT_Recipe_AssemblyLine other = (GT_Recipe_AssemblyLine) obj; + if (this.mInputs.length != other.mInputs.length) { + return false; + } + if (this.mFluidInputs.length != other.mFluidInputs.length) { + return false; + } + // Check Outputs Match + GT_ItemStack output1 = new GT_ItemStack(this.mOutput); + GT_ItemStack output2 = new GT_ItemStack(other.mOutput); + if (!output1.equals(output2)) { + return false; + } + // Check Scanned Item Match + GT_ItemStack scan1 = new GT_ItemStack(this.mResearchItem); + GT_ItemStack scan2 = new GT_ItemStack(other.mResearchItem); + if (!scan1.equals(scan2)) { + return false; + } + // Check Items Match + GT_ItemStack[] thisInputs = new GT_ItemStack[this.mInputs.length]; + GT_ItemStack[] otherInputs = new GT_ItemStack[other.mInputs.length]; + for (int i = 0; i < thisInputs.length; i++) { + thisInputs[i] = new GT_ItemStack(this.mInputs[i]); + otherInputs[i] = new GT_ItemStack(other.mInputs[i]); + } + for (int i = 0; i < thisInputs.length; i++) { + if (!thisInputs[i].equals(otherInputs[i]) || thisInputs[i].mStackSize != otherInputs[i].mStackSize) { + return false; + } + } + // Check Fluids Match + for (int i = 0; i < this.mFluidInputs.length; i++) { + if (!this.mFluidInputs[i].isFluidStackIdentical(other.mFluidInputs[i])) { + return false; + } + } + + return this.mDuration == other.mDuration + && this.mEUt == other.mEUt + && this.mResearchTime == other.mResearchTime; + } public int getPersistentHash() { if (mPersistentHash == 0) @@ -764,16 +938,15 @@ public class GT_Recipe implements Comparable<GT_Recipe> { @Override public String toString() { - return "GT_Recipe_AssemblyLine{" + - "mResearchItem=" + mResearchItem + - ", mResearchTime=" + mResearchTime + - ", mInputs=" + Arrays.toString(mInputs) + - ", mFluidInputs=" + Arrays.toString(mFluidInputs) + - ", mOutput=" + mOutput + - ", mDuration=" + mDuration + - ", mEUt=" + mEUt + - ", mOreDictAlt=" + Arrays.toString(mOreDictAlt) + - '}'; + return "GT_Recipe_AssemblyLine{" + "mResearchItem=" + + mResearchItem + ", mResearchTime=" + + mResearchTime + ", mInputs=" + + Arrays.toString(mInputs) + ", mFluidInputs=" + + Arrays.toString(mFluidInputs) + ", mOutput=" + + mOutput + ", mDuration=" + + mDuration + ", mEUt=" + + mEUt + ", mOreDictAlt=" + + Arrays.toString(mOreDictAlt) + '}'; } /** @@ -782,12 +955,9 @@ public class GT_Recipe implements Comparable<GT_Recipe> { * @throws IllegalStateException if the persistent hash has been set already */ public void setPersistentHash(int aPersistentHash) { - if (this.mPersistentHash != 0) - throw new IllegalStateException("Cannot set persistent hash twice!"); - if (aPersistentHash == 0) - this.mPersistentHash = 1; - else - this.mPersistentHash = aPersistentHash; + if (this.mPersistentHash != 0) throw new IllegalStateException("Cannot set persistent hash twice!"); + if (aPersistentHash == 0) this.mPersistentHash = 1; + else this.mPersistentHash = aPersistentHash; } } @@ -801,53 +971,716 @@ public class GT_Recipe implements Comparable<GT_Recipe> { */ public static final Map<String, GT_Recipe_Map> sIndexedMappings = new HashMap<>(); - public static final GT_Recipe_Map sOreWasherRecipes = new GT_Recipe_Map(new HashSet<>(500), "gt.recipe.orewasher", "Ore Washing Plant", null, RES_PATH_GUI + "basicmachines/OreWasher", 1, 3, 1, 1, 1, E, 1, E, true, true); - public static final GT_Recipe_Map sThermalCentrifugeRecipes = new GT_Recipe_Map(new HashSet<>(1000), "gt.recipe.thermalcentrifuge", "Thermal Centrifuge", null, RES_PATH_GUI + "basicmachines/ThermalCentrifuge", 1, 3, 1, 0, 2, E, 1, E, true, true); - public static final GT_Recipe_Map sCompressorRecipes = new GT_Recipe_Map(new HashSet<>(750), "gt.recipe.compressor", "Compressor", null, RES_PATH_GUI + "basicmachines/Compressor", 1, 1, 1, 0, 1, E, 1, E, true, true); - public static final GT_Recipe_Map sExtractorRecipes = new GT_Recipe_Map(new HashSet<>(250), "gt.recipe.extractor", "Extractor", null, RES_PATH_GUI + "basicmachines/Extractor", 1, 1, 1, 0, 1, E, 1, E, true, true); - public static final GT_Recipe_Map sRecyclerRecipes = new GT_Recipe_Map_Recycler(new HashSet<>(0), "ic.recipe.recycler", "Recycler", "ic2.recycler", RES_PATH_GUI + "basicmachines/Recycler", 1, 1, 1, 0, 1, E, 1, E, true, false); - public static final GT_Recipe_Map sFurnaceRecipes = new GT_Recipe_Map_Furnace(new HashSet<>(0), "mc.recipe.furnace", "Furnace", "smelting", RES_PATH_GUI + "basicmachines/E_Furnace", 1, 1, 1, 0, 1, E, 1, E, true, false); - public static final GT_Recipe_Map sMicrowaveRecipes = new GT_Recipe_Map_Microwave(new HashSet<>(0), "gt.recipe.microwave", "Microwave", "smelting", RES_PATH_GUI + "basicmachines/E_Furnace", 1, 1, 1, 0, 1, E, 1, E, true, false); + public static final GT_Recipe_Map sOreWasherRecipes = new GT_Recipe_Map( + new HashSet<>(500), + "gt.recipe.orewasher", + "Ore Washing Plant", + null, + RES_PATH_GUI + "basicmachines/OreWasher", + 1, + 3, + 1, + 1, + 1, + E, + 1, + E, + true, + true); + public static final GT_Recipe_Map sThermalCentrifugeRecipes = new GT_Recipe_Map( + new HashSet<>(1000), + "gt.recipe.thermalcentrifuge", + "Thermal Centrifuge", + null, + RES_PATH_GUI + "basicmachines/ThermalCentrifuge", + 1, + 3, + 1, + 0, + 2, + E, + 1, + E, + true, + true); + public static final GT_Recipe_Map sCompressorRecipes = new GT_Recipe_Map( + new HashSet<>(750), + "gt.recipe.compressor", + "Compressor", + null, + RES_PATH_GUI + "basicmachines/Compressor", + 1, + 1, + 1, + 0, + 1, + E, + 1, + E, + true, + true); + public static final GT_Recipe_Map sExtractorRecipes = new GT_Recipe_Map( + new HashSet<>(250), + "gt.recipe.extractor", + "Extractor", + null, + RES_PATH_GUI + "basicmachines/Extractor", + 1, + 1, + 1, + 0, + 1, + E, + 1, + E, + true, + true); + public static final GT_Recipe_Map sRecyclerRecipes = new GT_Recipe_Map_Recycler( + new HashSet<>(0), + "ic.recipe.recycler", + "Recycler", + "ic2.recycler", + RES_PATH_GUI + "basicmachines/Recycler", + 1, + 1, + 1, + 0, + 1, + E, + 1, + E, + true, + false); + public static final GT_Recipe_Map sFurnaceRecipes = new GT_Recipe_Map_Furnace( + new HashSet<>(0), + "mc.recipe.furnace", + "Furnace", + "smelting", + RES_PATH_GUI + "basicmachines/E_Furnace", + 1, + 1, + 1, + 0, + 1, + E, + 1, + E, + true, + false); + public static final GT_Recipe_Map sMicrowaveRecipes = new GT_Recipe_Map_Microwave( + new HashSet<>(0), + "gt.recipe.microwave", + "Microwave", + "smelting", + RES_PATH_GUI + "basicmachines/E_Furnace", + 1, + 1, + 1, + 0, + 1, + E, + 1, + E, + true, + false); /** 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(new HashSet<>(250), "gt.recipe.disassembler", "Disassembler", null, RES_PATH_GUI + "basicmachines/Disassembler", 1, 9, 1, 0, 1, E, 1, E, true, false); - public static final GT_Recipe_Map sScannerFakeRecipes = new GT_Recipe_Map(new HashSet<>(300), "gt.recipe.scanner", "Scanner", null, RES_PATH_GUI + "basicmachines/Scanner", 1, 1, 1, 0, 1, E, 1, E, true, true); - public static final GT_Recipe_Map sRockBreakerFakeRecipes = new GT_Recipe_Map(new HashSet<>(200), "gt.recipe.rockbreaker", "Rock Breaker", null, RES_PATH_GUI + "basicmachines/RockBreaker", 1, 1, 0, 0, 1, E, 1, E, true, true); - public static final GT_Recipe_Map sByProductList = new GT_Recipe_Map(new HashSet<>(1000), "gt.recipe.byproductlist", "Ore Byproduct List", null, RES_PATH_GUI + "basicmachines/Default", 1, 6, 1, 0, 1, E, 1, E, true, true); - public static final GT_Recipe_Map sReplicatorFakeRecipes = new ReplicatorFakeMap(new HashSet<>(100), "gt.recipe.replicator", "Replicator", null, RES_PATH_GUI + "basicmachines/Replicator", 0, 1, 0, 1, 1, E, 1, E, true, true); - //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); - public static final GT_Recipe_Map sAssemblylineVisualRecipes = new GT_Recipe_Map(new HashSet<>(110), "gt.recipe.fakeAssemblylineProcess", "Assemblyline Process", null, RES_PATH_GUI + "FakeAssemblyline", 1, 1, 1, 0, 1, E, 1, E, true, false); - public static final GT_Recipe_Map sPlasmaArcFurnaceRecipes = new GT_Recipe_Map(new HashSet<>(20000), "gt.recipe.plasmaarcfurnace", "Plasma Arc Furnace", null, RES_PATH_GUI + "basicmachines/PlasmaArcFurnace", 1, 4, 1, 1, 1, E, 1, E, true, true); - public static final GT_Recipe_Map sArcFurnaceRecipes = new GT_Recipe_Map(new HashSet<>(20000), "gt.recipe.arcfurnace", "Arc Furnace", null, RES_PATH_GUI + "basicmachines/ArcFurnace", 1, 4, 1, 1, 3, E, 1, E, true, true); - public static final GT_Recipe_Map sPrinterRecipes = new GT_Recipe_Map_Printer(new HashSet<>(5), "gt.recipe.printer", "Printer", null, RES_PATH_GUI + "basicmachines/Printer", 1, 1, 1, 1, 1, E, 1, E, true, true); - public static final GT_Recipe_Map sSifterRecipes = new GT_Recipe_Map(new HashSet<>(105), "gt.recipe.sifter", "Sifter", null, RES_PATH_GUI + "basicmachines/Sifter", 1, 9, 0, 0, 1, E, 1, E, true, true); - public static final GT_Recipe_Map sPressRecipes = new GT_Recipe_Map_FormingPress(new HashSet<>(300), "gt.recipe.press", "Forming Press", null, RES_PATH_GUI + "basicmachines/Press", 2, 1, 2, 0, 1, E, 1, E, true, true); - public static final GT_Recipe_Map sLaserEngraverRecipes = new GT_Recipe_Map(new HashSet<>(810), "gt.recipe.laserengraver", "Precision Laser Engraver", null, RES_PATH_GUI + "basicmachines/LaserEngraverNEI", 2, 1, 0, 0, 1, E, 1, E, true, true); - public static final GT_Recipe_Map sMixerRecipes = new GT_Recipe_Map(new HashSet<>(900), "gt.recipe.mixer", "Mixer", null, RES_PATH_GUI + "basicmachines/Mixer6", 9, 4, 1, 0, 1, E, 1, E, true, true); - public static final GT_Recipe_Map sAutoclaveRecipes = new GT_Recipe_Map(new HashSet<>(300), "gt.recipe.autoclave", "Autoclave", null, RES_PATH_GUI + "basicmachines/Autoclave4", 2, 4, 1, 1, 1, E, 1, E, true, true); - public static final GT_Recipe_Map sElectroMagneticSeparatorRecipes = new GT_Recipe_Map(new HashSet<>(50), "gt.recipe.electromagneticseparator", "Electromagnetic Separator", null, RES_PATH_GUI + "basicmachines/ElectromagneticSeparator", 1, 3, 1, 0, 1, E, 1, E, true, true); - public static final GT_Recipe_Map sPolarizerRecipes = new GT_Recipe_Map(new HashSet<>(300), "gt.recipe.polarizer", "Electromagnetic Polarizer", null, RES_PATH_GUI + "basicmachines/Polarizer", 1, 1, 1, 0, 1, E, 1, E, true, true); - public static final GT_Recipe_Map sMaceratorRecipes = new GT_Recipe_Map_Macerator(new HashSet<>(16600), "gt.recipe.macerator", "Pulverization", null, RES_PATH_GUI + "basicmachines/Macerator4", 1, 4, 1, 0, 1, E, 1, E, true, true); - public static final GT_Recipe_Map sChemicalBathRecipes = new GT_Recipe_Map(new HashSet<>(2550), "gt.recipe.chemicalbath", "Chemical Bath", null, RES_PATH_GUI + "basicmachines/ChemicalBath", 1, 3, 1, 1, 1, E, 1, E, true, true); - public static final GT_Recipe_Map sFluidCannerRecipes = new GT_Recipe_Map_FluidCanner(new HashSet<>(2100), "gt.recipe.fluidcanner", "Fluid Canning Machine", null, RES_PATH_GUI + "basicmachines/FluidCanner", 1, 1, 1, 0, 1, E, 1, E, true, true); - public static final GT_Recipe_Map sBrewingRecipes = new GT_Recipe_Map(new HashSet<>(450), "gt.recipe.brewer", "Brewing Machine", null, RES_PATH_GUI + "basicmachines/PotionBrewer", 1, 0, 1, 1, 1, E, 1, E, true, true); - public static final GT_Recipe_Map sFluidHeaterRecipes = new GT_Recipe_Map(new HashSet<>(10), "gt.recipe.fluidheater", "Fluid Heater", null, RES_PATH_GUI + "basicmachines/FluidHeater", 1, 0, 1, 1, 1, E, 1, E, true, true); - public static final GT_Recipe_Map sDistilleryRecipes = new GT_Recipe_Map(new HashSet<>(400), "gt.recipe.distillery", "Distillery", null, RES_PATH_GUI + "basicmachines/Distillery", 1, 1, 1, 1, 1, E, 1, E, true, true); - public static final GT_Recipe_Map sFermentingRecipes = new GT_Recipe_Map(new HashSet<>(50), "gt.recipe.fermenter", "Fermenter", null, RES_PATH_GUI + "basicmachines/Fermenter", 0, 0, 0, 1, 1, E, 1, E, true, true); - public static final GT_Recipe_Map sFluidSolidficationRecipes = new GT_Recipe_Map(new HashSet<>(35000), "gt.recipe.fluidsolidifier", "Fluid Solidifier", null, RES_PATH_GUI + "basicmachines/FluidSolidifier", 1, 1, 1, 1, 1, E, 1, E, true, true); - public static final GT_Recipe_Map sFluidExtractionRecipes = new GT_Recipe_Map(new HashSet<>(15000), "gt.recipe.fluidextractor", "Fluid Extractor", null, RES_PATH_GUI + "basicmachines/FluidExtractor", 1, 1, 1, 0, 1, E, 1, E, true, true); - public static final GT_Recipe_Map sBoxinatorRecipes = new GT_Recipe_Map(new HashSet<>(2500), "gt.recipe.packager", "Packager", null, RES_PATH_GUI + "basicmachines/Packager", 2, 1, 2, 0, 1, E, 1, E, true, true); - public static final GT_Recipe_Map sUnboxinatorRecipes = new GT_Recipe_Map_Unboxinator(new HashSet<>(2500), "gt.recipe.unpackager", "Unpackager", null, RES_PATH_GUI + "basicmachines/Unpackager", 1, 2, 1, 0, 1, E, 1, E, true, true); - public static final GT_Recipe_Map sFusionRecipes = new GT_Recipe_Map(new HashSet<>(50), "gt.recipe.fusionreactor", "Fusion Reactor", null, RES_PATH_GUI + "basicmachines/FusionReactor", 0, 0, 0, 2, 1, "Start: ", 1, " EU", true, true); - public static final GT_Recipe_Map sComplexFusionRecipes = new GT_Recipe_Map_ComplexFusion(new HashSet<>(50), "gt.recipe.complexfusionreactor", "Complex Fusion Reactor", null, RES_PATH_GUI + "basicmachines/ComplexFusionReactor", 3, 0, 0, 2, 1, "Start: ", 1, " EU", true, true); - public static final GT_Recipe_Map sCentrifugeRecipes = new GT_Recipe_Map(new HashSet<>(1200), "gt.recipe.centrifuge", "Centrifuge", null, RES_PATH_GUI + "basicmachines/Centrifuge", 2, 6, 0, 0, 1, E, 1, E, true, true); - public static final GT_Recipe_Map sElectrolyzerRecipes = new GT_Recipe_Map(new HashSet<>(300), "gt.recipe.electrolyzer", "Electrolyzer", null, RES_PATH_GUI + "basicmachines/Electrolyzer", 2, 6, 0, 0, 1, E, 1, E, true, true); - public static final GT_Recipe_Map sBlastRecipes = new GT_Recipe_Map(new HashSet<>(800), "gt.recipe.blastfurnace", "Blast Furnace", null, RES_PATH_GUI + "basicmachines/Default", 6, 6, 1, 0, 1, "Heat Capacity: ", 1, " K", false, true); - public static final GT_Recipe_Map sPlasmaForgeRecipes = new GT_Recipe_Map_PlasmaForge(new HashSet<>(20), "gt.recipe.plasmaforge", "DTPF", null, RES_PATH_GUI + "basicmachines/PlasmaForge", 1, 1, 0, 0, 1, "Heat Capacity: ", 1, " K", false, true); - public static final GT_Recipe_Map sPrimitiveBlastRecipes = new GT_Recipe_Map(new HashSet<>(200), "gt.recipe.primitiveblastfurnace", "Primitive Blast Furnace", null, RES_PATH_GUI + "basicmachines/Default", 3, 3, 1, 0, 1, E, 1, E, false, true); - public static final GT_Recipe_Map sImplosionRecipes = new GT_Recipe_Map(new HashSet<>(900), "gt.recipe.implosioncompressor", "Implosion Compressor", null, RES_PATH_GUI + "basicmachines/Default", 2, 2, 2, 0, 1, E, 1, E, true, true); - public static final GT_Recipe_Map sVacuumRecipes = new GT_Recipe_Map(new HashSet<>(305), "gt.recipe.vacuumfreezer", "Vacuum Freezer", null, RES_PATH_GUI + "basicmachines/Default", 1, 1, 0, 0, 1, E, 1, E, false, true); - public static final GT_Recipe_Map sChemicalRecipes = new GT_Recipe_Map(new HashSet<>(1170), "gt.recipe.chemicalreactor", "Chemical Reactor", null, RES_PATH_GUI + "basicmachines/ChemicalReactor", 2, 2, 1, 0, 1, E, 1, E, true, true); + public static final GT_Recipe_Map sDisassemblerRecipes = new GT_Recipe_Map( + new HashSet<>(250), + "gt.recipe.disassembler", + "Disassembler", + null, + RES_PATH_GUI + "basicmachines/Disassembler", + 1, + 9, + 1, + 0, + 1, + E, + 1, + E, + true, + false); + + public static final GT_Recipe_Map sScannerFakeRecipes = new GT_Recipe_Map( + new HashSet<>(300), + "gt.recipe.scanner", + "Scanner", + null, + RES_PATH_GUI + "basicmachines/Scanner", + 1, + 1, + 1, + 0, + 1, + E, + 1, + E, + true, + true); + public static final GT_Recipe_Map sRockBreakerFakeRecipes = new GT_Recipe_Map( + new HashSet<>(200), + "gt.recipe.rockbreaker", + "Rock Breaker", + null, + RES_PATH_GUI + "basicmachines/RockBreaker", + 1, + 1, + 0, + 0, + 1, + E, + 1, + E, + true, + true); + public static final GT_Recipe_Map sByProductList = new GT_Recipe_Map( + new HashSet<>(1000), + "gt.recipe.byproductlist", + "Ore Byproduct List", + null, + RES_PATH_GUI + "basicmachines/Default", + 1, + 6, + 1, + 0, + 1, + E, + 1, + E, + true, + true); + public static final GT_Recipe_Map sReplicatorFakeRecipes = new ReplicatorFakeMap( + new HashSet<>(100), + "gt.recipe.replicator", + "Replicator", + null, + RES_PATH_GUI + "basicmachines/Replicator", + 0, + 1, + 0, + 1, + 1, + E, + 1, + E, + true, + true); + // 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); + public static final GT_Recipe_Map sAssemblylineVisualRecipes = new GT_Recipe_Map( + new HashSet<>(110), + "gt.recipe.fakeAssemblylineProcess", + "Assemblyline Process", + null, + RES_PATH_GUI + "FakeAssemblyline", + 1, + 1, + 1, + 0, + 1, + E, + 1, + E, + true, + false); + public static final GT_Recipe_Map sPlasmaArcFurnaceRecipes = new GT_Recipe_Map( + new HashSet<>(20000), + "gt.recipe.plasmaarcfurnace", + "Plasma Arc Furnace", + null, + RES_PATH_GUI + "basicmachines/PlasmaArcFurnace", + 1, + 4, + 1, + 1, + 1, + E, + 1, + E, + true, + true); + public static final GT_Recipe_Map sArcFurnaceRecipes = new GT_Recipe_Map( + new HashSet<>(20000), + "gt.recipe.arcfurnace", + "Arc Furnace", + null, + RES_PATH_GUI + "basicmachines/ArcFurnace", + 1, + 4, + 1, + 1, + 3, + E, + 1, + E, + true, + true); + public static final GT_Recipe_Map sPrinterRecipes = new GT_Recipe_Map_Printer( + new HashSet<>(5), + "gt.recipe.printer", + "Printer", + null, + RES_PATH_GUI + "basicmachines/Printer", + 1, + 1, + 1, + 1, + 1, + E, + 1, + E, + true, + true); + public static final GT_Recipe_Map sSifterRecipes = new GT_Recipe_Map( + new HashSet<>(105), + "gt.recipe.sifter", + "Sifter", + null, + RES_PATH_GUI + "basicmachines/Sifter", + 1, + 9, + 0, + 0, + 1, + E, + 1, + E, + true, + true); + public static final GT_Recipe_Map sPressRecipes = new GT_Recipe_Map_FormingPress( + new HashSet<>(300), + "gt.recipe.press", + "Forming Press", + null, + RES_PATH_GUI + "basicmachines/Press", + 2, + 1, + 2, + 0, + 1, + E, + 1, + E, + true, + true); + public static final GT_Recipe_Map sLaserEngraverRecipes = new GT_Recipe_Map( + new HashSet<>(810), + "gt.recipe.laserengraver", + "Precision Laser Engraver", + null, + RES_PATH_GUI + "basicmachines/LaserEngraverNEI", + 2, + 1, + 0, + 0, + 1, + E, + 1, + E, + true, + true); + public static final GT_Recipe_Map sMixerRecipes = new GT_Recipe_Map( + new HashSet<>(900), + "gt.recipe.mixer", + "Mixer", + null, + RES_PATH_GUI + "basicmachines/Mixer6", + 9, + 4, + 1, + 0, + 1, + E, + 1, + E, + true, + true); + public static final GT_Recipe_Map sAutoclaveRecipes = new GT_Recipe_Map( + new HashSet<>(300), + "gt.recipe.autoclave", + "Autoclave", + null, + RES_PATH_GUI + "basicmachines/Autoclave4", + 2, + 4, + 1, + 1, + 1, + E, + 1, + E, + true, + true); + public static final GT_Recipe_Map sElectroMagneticSeparatorRecipes = new GT_Recipe_Map( + new HashSet<>(50), + "gt.recipe.electromagneticseparator", + "Electromagnetic Separator", + null, + RES_PATH_GUI + "basicmachines/ElectromagneticSeparator", + 1, + 3, + 1, + 0, + 1, + E, + 1, + E, + true, + true); + public static final GT_Recipe_Map sPolarizerRecipes = new GT_Recipe_Map( + new HashSet<>(300), + "gt.recipe.polarizer", + "Electromagnetic Polarizer", + null, + RES_PATH_GUI + "basicmachines/Polarizer", + 1, + 1, + 1, + 0, + 1, + E, + 1, + E, + true, + true); + public static final GT_Recipe_Map sMaceratorRecipes = new GT_Recipe_Map_Macerator( + new HashSet<>(16600), + "gt.recipe.macerator", + "Pulverization", + null, + RES_PATH_GUI + "basicmachines/Macerator4", + 1, + 4, + 1, + 0, + 1, + E, + 1, + E, + true, + true); + public static final GT_Recipe_Map sChemicalBathRecipes = new GT_Recipe_Map( + new HashSet<>(2550), + "gt.recipe.chemicalbath", + "Chemical Bath", + null, + RES_PATH_GUI + "basicmachines/ChemicalBath", + 1, + 3, + 1, + 1, + 1, + E, + 1, + E, + true, + true); + public static final GT_Recipe_Map sFluidCannerRecipes = new GT_Recipe_Map_FluidCanner( + new HashSet<>(2100), + "gt.recipe.fluidcanner", + "Fluid Canning Machine", + null, + RES_PATH_GUI + "basicmachines/FluidCanner", + 1, + 1, + 1, + 0, + 1, + E, + 1, + E, + true, + true); + public static final GT_Recipe_Map sBrewingRecipes = new GT_Recipe_Map( + new HashSet<>(450), + "gt.recipe.brewer", + "Brewing Machine", + null, + RES_PATH_GUI + "basicmachines/PotionBrewer", + 1, + 0, + 1, + 1, + 1, + E, + 1, + E, + true, + true); + public static final GT_Recipe_Map sFluidHeaterRecipes = new GT_Recipe_Map( + new HashSet<>(10), + "gt.recipe.fluidheater", + "Fluid Heater", + null, + RES_PATH_GUI + "basicmachines/FluidHeater", + 1, + 0, + 1, + 1, + 1, + E, + 1, + E, + true, + true); + public static final GT_Recipe_Map sDistilleryRecipes = new GT_Recipe_Map( + new HashSet<>(400), + "gt.recipe.distillery", + "Distillery", + null, + RES_PATH_GUI + "basicmachines/Distillery", + 1, + 1, + 1, + 1, + 1, + E, + 1, + E, + true, + true); + public static final GT_Recipe_Map sFermentingRecipes = new GT_Recipe_Map( + new HashSet<>(50), + "gt.recipe.fermenter", + "Fermenter", + null, + RES_PATH_GUI + "basicmachines/Fermenter", + 0, + 0, + 0, + 1, + 1, + E, + 1, + E, + true, + true); + public static final GT_Recipe_Map sFluidSolidficationRecipes = new GT_Recipe_Map( + new HashSet<>(35000), + "gt.recipe.fluidsolidifier", + "Fluid Solidifier", + null, + RES_PATH_GUI + "basicmachines/FluidSolidifier", + 1, + 1, + 1, + 1, + 1, + E, + 1, + E, + true, + true); + public static final GT_Recipe_Map sFluidExtractionRecipes = new GT_Recipe_Map( + new HashSet<>(15000), + "gt.recipe.fluidextractor", + "Fluid Extractor", + null, + RES_PATH_GUI + "basicmachines/FluidExtractor", + 1, + 1, + 1, + 0, + 1, + E, + 1, + E, + true, + true); + public static final GT_Recipe_Map sBoxinatorRecipes = new GT_Recipe_Map( + new HashSet<>(2500), + "gt.recipe.packager", + "Packager", + null, + RES_PATH_GUI + "basicmachines/Packager", + 2, + 1, + 2, + 0, + 1, + E, + 1, + E, + true, + true); + public static final GT_Recipe_Map sUnboxinatorRecipes = new GT_Recipe_Map_Unboxinator( + new HashSet<>(2500), + "gt.recipe.unpackager", + "Unpackager", + null, + RES_PATH_GUI + "basicmachines/Unpackager", + 1, + 2, + 1, + 0, + 1, + E, + 1, + E, + true, + true); + public static final GT_Recipe_Map sFusionRecipes = new GT_Recipe_Map( + new HashSet<>(50), + "gt.recipe.fusionreactor", + "Fusion Reactor", + null, + RES_PATH_GUI + "basicmachines/FusionReactor", + 0, + 0, + 0, + 2, + 1, + "Start: ", + 1, + " EU", + true, + true); + public static final GT_Recipe_Map sComplexFusionRecipes = new GT_Recipe_Map_ComplexFusion( + new HashSet<>(50), + "gt.recipe.complexfusionreactor", + "Complex Fusion Reactor", + null, + RES_PATH_GUI + "basicmachines/ComplexFusionReactor", + 3, + 0, + 0, + 2, + 1, + "Start: ", + 1, + " EU", + true, + true); + public static final GT_Recipe_Map sCentrifugeRecipes = new GT_Recipe_Map( + new HashSet<>(1200), + "gt.recipe.centrifuge", + "Centrifuge", + null, + RES_PATH_GUI + "basicmachines/Centrifuge", + 2, + 6, + 0, + 0, + 1, + E, + 1, + E, + true, + true); + public static final GT_Recipe_Map sElectrolyzerRecipes = new GT_Recipe_Map( + new HashSet<>(300), + "gt.recipe.electrolyzer", + "Electrolyzer", + null, + RES_PATH_GUI + "basicmachines/Electrolyzer", + 2, + 6, + 0, + 0, + 1, + E, + 1, + E, + true, + true); + public static final GT_Recipe_Map sBlastRecipes = new GT_Recipe_Map( + new HashSet<>(800), + "gt.recipe.blastfurnace", + "Blast Furnace", + null, + RES_PATH_GUI + "basicmachines/Default", + 6, + 6, + 1, + 0, + 1, + "Heat Capacity: ", + 1, + " K", + false, + true); + public static final GT_Recipe_Map sPlasmaForgeRecipes = new GT_Recipe_Map_PlasmaForge( + new HashSet<>(20), + "gt.recipe.plasmaforge", + "DTPF", + null, + RES_PATH_GUI + "basicmachines/PlasmaForge", + 1, + 1, + 0, + 0, + 1, + "Heat Capacity: ", + 1, + " K", + false, + true); + public static final GT_Recipe_Map sPrimitiveBlastRecipes = new GT_Recipe_Map( + new HashSet<>(200), + "gt.recipe.primitiveblastfurnace", + "Primitive Blast Furnace", + null, + RES_PATH_GUI + "basicmachines/Default", + 3, + 3, + 1, + 0, + 1, + E, + 1, + E, + false, + true); + public static final GT_Recipe_Map sImplosionRecipes = new GT_Recipe_Map( + new HashSet<>(900), + "gt.recipe.implosioncompressor", + "Implosion Compressor", + null, + RES_PATH_GUI + "basicmachines/Default", + 2, + 2, + 2, + 0, + 1, + E, + 1, + E, + true, + true); + public static final GT_Recipe_Map sVacuumRecipes = new GT_Recipe_Map( + new HashSet<>(305), + "gt.recipe.vacuumfreezer", + "Vacuum Freezer", + null, + RES_PATH_GUI + "basicmachines/Default", + 1, + 1, + 0, + 0, + 1, + E, + 1, + E, + false, + true); + public static final GT_Recipe_Map sChemicalRecipes = new GT_Recipe_Map( + new HashSet<>(1170), + "gt.recipe.chemicalreactor", + "Chemical Reactor", + null, + RES_PATH_GUI + "basicmachines/ChemicalReactor", + 2, + 2, + 1, + 0, + 1, + E, + 1, + E, + true, + true); public static final GT_Recipe_Map sMultiblockChemicalRecipes = new GT_Recipe_Map_LargeChemicalReactor(); public static final GT_Recipe_Map sDistillationRecipes = new GT_Recipe_Map_DistillationTower(); public static final GT_Recipe_Map_OilCracker sCrackingRecipes = new GT_Recipe_Map_OilCracker(); @@ -856,44 +1689,468 @@ public class GT_Recipe implements Comparable<GT_Recipe> { */ @Deprecated public static final GT_Recipe_Map sCrakingRecipes = sCrackingRecipes; - public static final GT_Recipe_Map sPyrolyseRecipes = new GT_Recipe_Map(new HashSet<>(150), "gt.recipe.pyro", "Pyrolyse Oven", null, RES_PATH_GUI + "basicmachines/Default", 2, 1, 1, 0, 1, E, 1, E, true, true); - public static final GT_Recipe_Map sWiremillRecipes = new GT_Recipe_Map(new HashSet<>(450), "gt.recipe.wiremill", "Wiremill", null, RES_PATH_GUI + "basicmachines/Wiremill", 1, 1, 1, 0, 1, E, 1, E, true, true); - public static final GT_Recipe_Map sBenderRecipes = new GT_Recipe_Map(new HashSet<>(5000), "gt.recipe.metalbender", "Bending Machine", null, RES_PATH_GUI + "basicmachines/Bender", 2, 1, 2, 0, 1, E, 1, E, true, true); - public static final GT_Recipe_Map sAlloySmelterRecipes = new GT_Recipe_Map(new HashSet<>(12000), "gt.recipe.alloysmelter", "Alloy Smelter", null, RES_PATH_GUI + "basicmachines/AlloySmelter", 2, 1, 2, 0, 1, E, 1, E, true, true); - public static final GT_Recipe_Map sAssemblerRecipes = new GT_Recipe_Map_Assembler(new HashSet<>(8200), "gt.recipe.assembler", "Assembler", null, RES_PATH_GUI + "basicmachines/Assembler2", 9, 1, 1, 0, 1, E, 1, E, true, true); - public static final GT_Recipe_Map sCircuitAssemblerRecipes = new GT_Recipe_Map_Assembler(new HashSet<>(605), "gt.recipe.circuitassembler", "Circuit Assembler", null, RES_PATH_GUI + "basicmachines/CircuitAssembler", 6, 1, 1, 0, 1, E, 1, E, true, true, !Loader.isModLoaded("neicustomdiagram")); - public static final GT_Recipe_Map sCannerRecipes = new GT_Recipe_Map(new HashSet<>(900), "gt.recipe.canner", "Canning Machine", null, RES_PATH_GUI + "basicmachines/Canner", 2, 2, 1, 0, 1, E, 1, E, true, true); - public static final GT_Recipe_Map sCNCRecipes = new GT_Recipe_Map(new HashSet<>(100), "gt.recipe.cncmachine", "CNC Machine", null, RES_PATH_GUI + "basicmachines/Default", 2, 1, 2, 1, 1, E, 1, E, true, true); - public static final GT_Recipe_Map sLatheRecipes = new GT_Recipe_Map(new HashSet<>(1150), "gt.recipe.lathe", "Lathe", null, RES_PATH_GUI + "basicmachines/Lathe", 1, 2, 1, 0, 1, E, 1, E, true, true); - public static final GT_Recipe_Map sCutterRecipes = new GT_Recipe_Map(new HashSet<>(5125), "gt.recipe.cuttingsaw", "Cutting Machine", null, RES_PATH_GUI + "basicmachines/Cutter4", 2, 4, 1, 1, 1, E, 1, E, true, true); - public static final GT_Recipe_Map sSlicerRecipes = new GT_Recipe_Map(new HashSet<>(20), "gt.recipe.slicer", "Slicing Machine", null, RES_PATH_GUI + "basicmachines/Slicer", 2, 1, 2, 0, 1, E, 1, E, true, true); - public static final GT_Recipe_Map sExtruderRecipes = new GT_Recipe_Map(new HashSet<>(13000), "gt.recipe.extruder", "Extruder", null, RES_PATH_GUI + "basicmachines/Extruder", 2, 1, 2, 0, 1, E, 1, E, true, true); - public static final GT_Recipe_Map sHammerRecipes = new GT_Recipe_Map(new HashSet<>(3800), "gt.recipe.hammer", "Forge Hammer", null, RES_PATH_GUI + "basicmachines/Hammer", 1, 1, 1, 0, 1, E, 1, E, true, true); - public static final GT_Recipe_Map sAmplifiers = new GT_Recipe_Map(new HashSet<>(2), "gt.recipe.uuamplifier", "Amplifabricator", null, RES_PATH_GUI + "basicmachines/Amplifabricator", 1, 0, 1, 0, 1, E, 1, E, true, true); - public static final GT_Recipe_Map sMassFabFakeRecipes = new GT_Recipe_Map(new HashSet<>(2), "gt.recipe.massfab", "Mass Fabrication", null, RES_PATH_GUI + "basicmachines/Massfabricator", 1, 0, 1, 0, 8, E, 1, E, true, true); - public static final GT_Recipe_Map_Fuel sDieselFuels = new GT_Recipe_Map_Fuel(new HashSet<>(20), "gt.recipe.dieselgeneratorfuel", "Combustion Generator Fuels", null, RES_PATH_GUI + "basicmachines/Default", 1, 1, 0, 0, 1, "Fuel Value: ", 1000, " EU", true, true); - public static final GT_Recipe_Map_Fuel sExtremeDieselFuels = new GT_Recipe_Map_Fuel(new HashSet<>(20), "gt.recipe.extremedieselgeneratorfuel", "Extreme Diesel Engine Fuel", null, RES_PATH_GUI + "basicmachines/Default", 1, 1, 0, 0, 1, "Fuel Value: ", 1000, " EU", true, true); - public static final GT_Recipe_Map_Fuel sTurbineFuels = new GT_Recipe_Map_Fuel(new HashSet<>(25), "gt.recipe.gasturbinefuel", "Gas Turbine Fuel", null, RES_PATH_GUI + "basicmachines/Default", 1, 1, 0, 0, 1, "Fuel Value: ", 1000, " EU", true, true); - public static final GT_Recipe_Map_Fuel sHotFuels = new GT_Recipe_Map_Fuel(new HashSet<>(10), "gt.recipe.thermalgeneratorfuel", "Thermal Generator Fuels", null, RES_PATH_GUI + "basicmachines/Default", 1, 1, 0, 0, 1, "Fuel Value: ", 1000, " EU", true, false); - public static final GT_Recipe_Map_Fuel sDenseLiquidFuels = new GT_Recipe_Map_Fuel(new HashSet<>(15), "gt.recipe.semifluidboilerfuels", "Semifluid Boiler Fuels", null, RES_PATH_GUI + "basicmachines/Default", 1, 1, 0, 0, 1, "Fuel Value: ", 1000, " EU", true, true); - public static final GT_Recipe_Map_Fuel sPlasmaFuels = new GT_Recipe_Map_Fuel(new HashSet<>(100), "gt.recipe.plasmageneratorfuels", "Plasma Generator Fuels", null, RES_PATH_GUI + "basicmachines/Default", 1, 1, 0, 0, 1, "Fuel Value: ", 1000, " EU", true, true); - public static final GT_Recipe_Map_Fuel sMagicFuels = new GT_Recipe_Map_Fuel(new HashSet<>(100), "gt.recipe.magicfuels", "Magic Energy Absorber Fuels", null, RES_PATH_GUI + "basicmachines/Default", 1, 1, 0, 0, 1, "Fuel Value: ", 1000, " EU", true, true); - public static final GT_Recipe_Map_Fuel sSmallNaquadahReactorFuels = new GT_Recipe_Map_Fuel(new HashSet<>(1), "gt.recipe.smallnaquadahreactor", "Naquadah Reactor MkI", null, RES_PATH_GUI + "basicmachines/Default", 1, 1, 0, 0, 1, "Fuel Value: ", 1000, " EU", true, true); - public static final GT_Recipe_Map_Fuel sLargeNaquadahReactorFuels = new GT_Recipe_Map_Fuel(new HashSet<>(1), "gt.recipe.largenaquadahreactor", "Naquadah Reactor MkII", null, RES_PATH_GUI + "basicmachines/Default", 1, 1, 0, 0, 1, "Fuel Value: ", 1000, " EU", true, true); - public static final GT_Recipe_Map_Fuel sHugeNaquadahReactorFuels = new GT_Recipe_Map_Fuel(new HashSet<>(1), "gt.recipe.fluidnaquadahreactor", "Naquadah Reactor MkIII", null, RES_PATH_GUI + "basicmachines/Default", 1, 1, 0, 0, 1, "Fuel Value: ", 1000, " EU", true, true); - public static final GT_Recipe_Map_Fuel sExtremeNaquadahReactorFuels = new GT_Recipe_Map_Fuel(new HashSet<>(1), "gt.recipe.hugenaquadahreactor", "Naquadah Reactor MkIV", null, RES_PATH_GUI + "basicmachines/Default", 1, 1, 0, 0, 1, "Fuel Value: ", 1000, " EU", true, true); - public static final GT_Recipe_Map_Fuel sUltraHugeNaquadahReactorFuels = new GT_Recipe_Map_Fuel(new HashSet<>(1), "gt.recipe.extrahugenaquadahreactor", "Naquadah Reactor MkV", null, RES_PATH_GUI + "basicmachines/Default", 1, 1, 0, 0, 1, "Fuel Value: ", 1000, " EU", true, true); - public static final GT_Recipe_Map_Fuel sFluidNaquadahReactorFuels = new GT_Recipe_Map_Fuel(new HashSet<>(1), "gt.recipe.fluidfuelnaquadahreactor", "Fluid Naquadah Reactor", null, RES_PATH_GUI + "basicmachines/Default", 1, 1, 0, 0, 1, "Fuel Value: ", 1000, " EU", true, true); - public static final GT_Recipe_Map_LargeBoilerFakeFuels sLargeBoilerFakeFuels = new GT_Recipe_Map_LargeBoilerFakeFuels(); + + public static final GT_Recipe_Map sPyrolyseRecipes = new GT_Recipe_Map( + new HashSet<>(150), + "gt.recipe.pyro", + "Pyrolyse Oven", + null, + RES_PATH_GUI + "basicmachines/Default", + 2, + 1, + 1, + 0, + 1, + E, + 1, + E, + true, + true); + public static final GT_Recipe_Map sWiremillRecipes = new GT_Recipe_Map( + new HashSet<>(450), + "gt.recipe.wiremill", + "Wiremill", + null, + RES_PATH_GUI + "basicmachines/Wiremill", + 1, + 1, + 1, + 0, + 1, + E, + 1, + E, + true, + true); + public static final GT_Recipe_Map sBenderRecipes = new GT_Recipe_Map( + new HashSet<>(5000), + "gt.recipe.metalbender", + "Bending Machine", + null, + RES_PATH_GUI + "basicmachines/Bender", + 2, + 1, + 2, + 0, + 1, + E, + 1, + E, + true, + true); + public static final GT_Recipe_Map sAlloySmelterRecipes = new GT_Recipe_Map( + new HashSet<>(12000), + "gt.recipe.alloysmelter", + "Alloy Smelter", + null, + RES_PATH_GUI + "basicmachines/AlloySmelter", + 2, + 1, + 2, + 0, + 1, + E, + 1, + E, + true, + true); + public static final GT_Recipe_Map sAssemblerRecipes = new GT_Recipe_Map_Assembler( + new HashSet<>(8200), + "gt.recipe.assembler", + "Assembler", + null, + RES_PATH_GUI + "basicmachines/Assembler2", + 9, + 1, + 1, + 0, + 1, + E, + 1, + E, + true, + true); + public static final GT_Recipe_Map sCircuitAssemblerRecipes = new GT_Recipe_Map_Assembler( + new HashSet<>(605), + "gt.recipe.circuitassembler", + "Circuit Assembler", + null, + RES_PATH_GUI + "basicmachines/CircuitAssembler", + 6, + 1, + 1, + 0, + 1, + E, + 1, + E, + true, + true, + !Loader.isModLoaded("neicustomdiagram")); + public static final GT_Recipe_Map sCannerRecipes = new GT_Recipe_Map( + new HashSet<>(900), + "gt.recipe.canner", + "Canning Machine", + null, + RES_PATH_GUI + "basicmachines/Canner", + 2, + 2, + 1, + 0, + 1, + E, + 1, + E, + true, + true); + public static final GT_Recipe_Map sCNCRecipes = new GT_Recipe_Map( + new HashSet<>(100), + "gt.recipe.cncmachine", + "CNC Machine", + null, + RES_PATH_GUI + "basicmachines/Default", + 2, + 1, + 2, + 1, + 1, + E, + 1, + E, + true, + true); + public static final GT_Recipe_Map sLatheRecipes = new GT_Recipe_Map( + new HashSet<>(1150), + "gt.recipe.lathe", + "Lathe", + null, + RES_PATH_GUI + "basicmachines/Lathe", + 1, + 2, + 1, + 0, + 1, + E, + 1, + E, + true, + true); + public static final GT_Recipe_Map sCutterRecipes = new GT_Recipe_Map( + new HashSet<>(5125), + "gt.recipe.cuttingsaw", + "Cutting Machine", + null, + RES_PATH_GUI + "basicmachines/Cutter4", + 2, + 4, + 1, + 1, + 1, + E, + 1, + E, + true, + true); + public static final GT_Recipe_Map sSlicerRecipes = new GT_Recipe_Map( + new HashSet<>(20), + "gt.recipe.slicer", + "Slicing Machine", + null, + RES_PATH_GUI + "basicmachines/Slicer", + 2, + 1, + 2, + 0, + 1, + E, + 1, + E, + true, + true); + public static final GT_Recipe_Map sExtruderRecipes = new GT_Recipe_Map( + new HashSet<>(13000), + "gt.recipe.extruder", + "Extruder", + null, + RES_PATH_GUI + "basicmachines/Extruder", + 2, + 1, + 2, + 0, + 1, + E, + 1, + E, + true, + true); + public static final GT_Recipe_Map sHammerRecipes = new GT_Recipe_Map( + new HashSet<>(3800), + "gt.recipe.hammer", + "Forge Hammer", + null, + RES_PATH_GUI + "basicmachines/Hammer", + 1, + 1, + 1, + 0, + 1, + E, + 1, + E, + true, + true); + public static final GT_Recipe_Map sAmplifiers = new GT_Recipe_Map( + new HashSet<>(2), + "gt.recipe.uuamplifier", + "Amplifabricator", + null, + RES_PATH_GUI + "basicmachines/Amplifabricator", + 1, + 0, + 1, + 0, + 1, + E, + 1, + E, + true, + true); + public static final GT_Recipe_Map sMassFabFakeRecipes = new GT_Recipe_Map( + new HashSet<>(2), + "gt.recipe.massfab", + "Mass Fabrication", + null, + RES_PATH_GUI + "basicmachines/Massfabricator", + 1, + 0, + 1, + 0, + 8, + E, + 1, + E, + true, + true); + public static final GT_Recipe_Map_Fuel sDieselFuels = new GT_Recipe_Map_Fuel( + new HashSet<>(20), + "gt.recipe.dieselgeneratorfuel", + "Combustion Generator Fuels", + null, + RES_PATH_GUI + "basicmachines/Default", + 1, + 1, + 0, + 0, + 1, + "Fuel Value: ", + 1000, + " EU", + true, + true); + public static final GT_Recipe_Map_Fuel sExtremeDieselFuels = new GT_Recipe_Map_Fuel( + new HashSet<>(20), + "gt.recipe.extremedieselgeneratorfuel", + "Extreme Diesel Engine Fuel", + null, + RES_PATH_GUI + "basicmachines/Default", + 1, + 1, + 0, + 0, + 1, + "Fuel Value: ", + 1000, + " EU", + true, + true); + public static final GT_Recipe_Map_Fuel sTurbineFuels = new GT_Recipe_Map_Fuel( + new HashSet<>(25), + "gt.recipe.gasturbinefuel", + "Gas Turbine Fuel", + null, + RES_PATH_GUI + "basicmachines/Default", + 1, + 1, + 0, + 0, + 1, + "Fuel Value: ", + 1000, + " EU", + true, + true); + public static final GT_Recipe_Map_Fuel sHotFuels = new GT_Recipe_Map_Fuel( + new HashSet<>(10), + "gt.recipe.thermalgeneratorfuel", + "Thermal Generator Fuels", + null, + RES_PATH_GUI + "basicmachines/Default", + 1, + 1, + 0, + 0, + 1, + "Fuel Value: ", + 1000, + " EU", + true, + false); + public static final GT_Recipe_Map_Fuel sDenseLiquidFuels = new GT_Recipe_Map_Fuel( + new HashSet<>(15), + "gt.recipe.semifluidboilerfuels", + "Semifluid Boiler Fuels", + null, + RES_PATH_GUI + "basicmachines/Default", + 1, + 1, + 0, + 0, + 1, + "Fuel Value: ", + 1000, + " EU", + true, + true); + public static final GT_Recipe_Map_Fuel sPlasmaFuels = new GT_Recipe_Map_Fuel( + new HashSet<>(100), + "gt.recipe.plasmageneratorfuels", + "Plasma Generator Fuels", + null, + RES_PATH_GUI + "basicmachines/Default", + 1, + 1, + 0, + 0, + 1, + "Fuel Value: ", + 1000, + " EU", + true, + true); + public static final GT_Recipe_Map_Fuel sMagicFuels = new GT_Recipe_Map_Fuel( + new HashSet<>(100), + "gt.recipe.magicfuels", + "Magic Energy Absorber Fuels", + null, + RES_PATH_GUI + "basicmachines/Default", + 1, + 1, + 0, + 0, + 1, + "Fuel Value: ", + 1000, + " EU", + true, + true); + public static final GT_Recipe_Map_Fuel sSmallNaquadahReactorFuels = new GT_Recipe_Map_Fuel( + new HashSet<>(1), + "gt.recipe.smallnaquadahreactor", + "Naquadah Reactor MkI", + null, + RES_PATH_GUI + "basicmachines/Default", + 1, + 1, + 0, + 0, + 1, + "Fuel Value: ", + 1000, + " EU", + true, + true); + public static final GT_Recipe_Map_Fuel sLargeNaquadahReactorFuels = new GT_Recipe_Map_Fuel( + new HashSet<>(1), + "gt.recipe.largenaquadahreactor", + "Naquadah Reactor MkII", + null, + RES_PATH_GUI + "basicmachines/Default", + 1, + 1, + 0, + 0, + 1, + "Fuel Value: ", + 1000, + " EU", + true, + true); + public static final GT_Recipe_Map_Fuel sHugeNaquadahReactorFuels = new GT_Recipe_Map_Fuel( + new HashSet<>(1), + "gt.recipe.fluidnaquadahreactor", + "Naquadah Reactor MkIII", + null, + RES_PATH_GUI + "basicmachines/Default", + 1, + 1, + 0, + 0, + 1, + "Fuel Value: ", + 1000, + " EU", + true, + true); + public static final GT_Recipe_Map_Fuel sExtremeNaquadahReactorFuels = new GT_Recipe_Map_Fuel( + new HashSet<>(1), + "gt.recipe.hugenaquadahreactor", + "Naquadah Reactor MkIV", + null, + RES_PATH_GUI + "basicmachines/Default", + 1, + 1, + 0, + 0, + 1, + "Fuel Value: ", + 1000, + " EU", + true, + true); + public static final GT_Recipe_Map_Fuel sUltraHugeNaquadahReactorFuels = new GT_Recipe_Map_Fuel( + new HashSet<>(1), + "gt.recipe.extrahugenaquadahreactor", + "Naquadah Reactor MkV", + null, + RES_PATH_GUI + "basicmachines/Default", + 1, + 1, + 0, + 0, + 1, + "Fuel Value: ", + 1000, + " EU", + true, + true); + public static final GT_Recipe_Map_Fuel sFluidNaquadahReactorFuels = new GT_Recipe_Map_Fuel( + new HashSet<>(1), + "gt.recipe.fluidfuelnaquadahreactor", + "Fluid Naquadah Reactor", + null, + RES_PATH_GUI + "basicmachines/Default", + 1, + 1, + 0, + 0, + 1, + "Fuel Value: ", + 1000, + " EU", + true, + true); + public static final GT_Recipe_Map_LargeBoilerFakeFuels sLargeBoilerFakeFuels = + new GT_Recipe_Map_LargeBoilerFakeFuels(); /** * HashMap of Recipes based on their Items */ - public final Map<GT_ItemStack, Collection<GT_Recipe>> mRecipeItemMap = new /*Concurrent*/HashMap<>(); + public final Map<GT_ItemStack, Collection<GT_Recipe>> mRecipeItemMap = new /*Concurrent*/ HashMap<>(); /** * HashMap of Recipes based on their Fluids */ - public final Map<Fluid, Collection<GT_Recipe>> mRecipeFluidMap = new /*Concurrent*/HashMap<>(); + public final Map<Fluid, Collection<GT_Recipe>> mRecipeFluidMap = new /*Concurrent*/ HashMap<>(); + public final HashSet<String> mRecipeFluidNameMap = new HashSet<>(); /** * The List of all Recipes @@ -911,8 +2168,14 @@ public class GT_Recipe implements Comparable<GT_Recipe> { * GUI used for NEI Display. Usually the GUI of the Machine itself */ public final String mNEIGUIPath; + public final String mNEISpecialValuePre, mNEISpecialValuePost; - public final int mUsualInputCount, mUsualOutputCount, mNEISpecialValueMultiplier, mMinimalInputItems, mMinimalInputFluids, mAmperage; + public final int mUsualInputCount, + mUsualOutputCount, + mNEISpecialValueMultiplier, + mMinimalInputItems, + mMinimalInputFluids, + mAmperage; public final boolean mNEIAllowed, mShowVoltageAmperageInNEI, mNEIUnificateOutput; /** @@ -946,7 +2209,23 @@ public class GT_Recipe implements Comparable<GT_Recipe> { * @param aNEIAllowed if NEI is allowed to display this Recipe Handler in general. * @param aNEIUnificateOutput if NEI generate oredict equivalents */ - public GT_Recipe_Map(Collection<GT_Recipe> aRecipeList, String aUnlocalizedName, String aLocalName, String aNEIName, String aNEIGUIPath, int aUsualInputCount, int aUsualOutputCount, int aMinimalInputItems, int aMinimalInputFluids, int aAmperage, String aNEISpecialValuePre, int aNEISpecialValueMultiplier, String aNEISpecialValuePost, boolean aShowVoltageAmperageInNEI, boolean aNEIAllowed, boolean aNEIUnificateOutput) { + public GT_Recipe_Map( + Collection<GT_Recipe> aRecipeList, + String aUnlocalizedName, + String aLocalName, + String aNEIName, + String aNEIGUIPath, + int aUsualInputCount, + int aUsualOutputCount, + int aMinimalInputItems, + int aMinimalInputFluids, + int aAmperage, + String aNEISpecialValuePre, + int aNEISpecialValueMultiplier, + String aNEISpecialValuePost, + boolean aShowVoltageAmperageInNEI, + boolean aNEIAllowed, + boolean aNEIUnificateOutput) { sMappings.add(this); mNEIAllowed = aNEIAllowed; mShowVoltageAmperageInNEI = aShowVoltageAmperageInNEI; @@ -965,37 +2244,136 @@ public class GT_Recipe implements Comparable<GT_Recipe> { GregTech_API.sFluidMappings.add(mRecipeFluidMap); GregTech_API.sItemStackMappings.add(mRecipeItemMap); GT_LanguageManager.addStringLocalization(mUnlocalizedName = aUnlocalizedName, aLocalName); - mUniqueIdentifier = String.format("%s_%d_%d_%d_%d_%d", aUnlocalizedName, aAmperage, aUsualInputCount, aUsualOutputCount, aMinimalInputFluids, aMinimalInputItems); + mUniqueIdentifier = String.format( + "%s_%d_%d_%d_%d_%d", + aUnlocalizedName, + aAmperage, + aUsualInputCount, + aUsualOutputCount, + aMinimalInputFluids, + aMinimalInputItems); if (sIndexedMappings.put(mUniqueIdentifier, this) != null) throw new IllegalArgumentException("Duplicate recipe map registered: " + mUniqueIdentifier); } - public GT_Recipe_Map(Collection<GT_Recipe> aRecipeList, String aUnlocalizedName, String aLocalName, String aNEIName, String aNEIGUIPath, int aUsualInputCount, int aUsualOutputCount, int aMinimalInputItems, int aMinimalInputFluids, int aAmperage, String aNEISpecialValuePre, int aNEISpecialValueMultiplier, String aNEISpecialValuePost, boolean aShowVoltageAmperageInNEI, boolean aNEIAllowed) { - this(aRecipeList, aUnlocalizedName, aLocalName, aNEIName, aNEIGUIPath, aUsualInputCount, aUsualOutputCount, aMinimalInputItems, aMinimalInputFluids, aAmperage, aNEISpecialValuePre, aNEISpecialValueMultiplier, aNEISpecialValuePost, aShowVoltageAmperageInNEI, aNEIAllowed, true); - } - - public GT_Recipe addRecipe(boolean aOptimize, ItemStack[] aInputs, ItemStack[] aOutputs, Object aSpecial, int[] aOutputChances, FluidStack[] aFluidInputs, FluidStack[] aFluidOutputs, int aDuration, int aEUt, int aSpecialValue) { - return addRecipe(new GT_Recipe(aOptimize, aInputs, aOutputs, aSpecial, aOutputChances, aFluidInputs, aFluidOutputs, aDuration, aEUt, aSpecialValue)); - } - - public GT_Recipe addRecipe(int[] aOutputChances, FluidStack[] aFluidInputs, FluidStack[] aFluidOutputs, int aDuration, int aEUt, int aSpecialValue) { - return addRecipe(new GT_Recipe(false, null, null, null, aOutputChances, aFluidInputs, aFluidOutputs, aDuration, aEUt, aSpecialValue), false, false, false); - } - - public GT_Recipe addRecipe(boolean aOptimize, ItemStack[] aInputs, ItemStack[] aOutputs, Object aSpecial, FluidStack[] aFluidInputs, FluidStack[] aFluidOutputs, int aDuration, int aEUt, int aSpecialValue) { - return addRecipe(new GT_Recipe(aOptimize, aInputs, aOutputs, aSpecial, null, aFluidInputs, aFluidOutputs, aDuration, aEUt, aSpecialValue)); + public GT_Recipe_Map( + Collection<GT_Recipe> aRecipeList, + String aUnlocalizedName, + String aLocalName, + String aNEIName, + String aNEIGUIPath, + int aUsualInputCount, + int aUsualOutputCount, + int aMinimalInputItems, + int aMinimalInputFluids, + int aAmperage, + String aNEISpecialValuePre, + int aNEISpecialValueMultiplier, + String aNEISpecialValuePost, + boolean aShowVoltageAmperageInNEI, + boolean aNEIAllowed) { + this( + aRecipeList, + aUnlocalizedName, + aLocalName, + aNEIName, + aNEIGUIPath, + aUsualInputCount, + aUsualOutputCount, + aMinimalInputItems, + aMinimalInputFluids, + aAmperage, + aNEISpecialValuePre, + aNEISpecialValueMultiplier, + aNEISpecialValuePost, + aShowVoltageAmperageInNEI, + aNEIAllowed, + true); + } + + public GT_Recipe addRecipe( + boolean aOptimize, + ItemStack[] aInputs, + ItemStack[] aOutputs, + Object aSpecial, + int[] aOutputChances, + FluidStack[] aFluidInputs, + FluidStack[] aFluidOutputs, + int aDuration, + int aEUt, + int aSpecialValue) { + return addRecipe(new GT_Recipe( + aOptimize, + aInputs, + aOutputs, + aSpecial, + aOutputChances, + aFluidInputs, + aFluidOutputs, + aDuration, + aEUt, + aSpecialValue)); + } + + public GT_Recipe addRecipe( + int[] aOutputChances, + FluidStack[] aFluidInputs, + FluidStack[] aFluidOutputs, + int aDuration, + int aEUt, + int aSpecialValue) { + return addRecipe( + new GT_Recipe( + false, + null, + null, + null, + aOutputChances, + aFluidInputs, + aFluidOutputs, + aDuration, + aEUt, + aSpecialValue), + false, + false, + false); + } + + public GT_Recipe addRecipe( + boolean aOptimize, + ItemStack[] aInputs, + ItemStack[] aOutputs, + Object aSpecial, + FluidStack[] aFluidInputs, + FluidStack[] aFluidOutputs, + int aDuration, + int aEUt, + int aSpecialValue) { + return addRecipe(new GT_Recipe( + aOptimize, + aInputs, + aOutputs, + aSpecial, + null, + aFluidInputs, + aFluidOutputs, + aDuration, + aEUt, + aSpecialValue)); } public GT_Recipe addRecipe(GT_Recipe aRecipe) { return addRecipe(aRecipe, true, false, false); } - protected GT_Recipe addRecipe(GT_Recipe aRecipe, boolean aCheckForCollisions, boolean aFakeRecipe, boolean aHidden) { + protected GT_Recipe addRecipe( + GT_Recipe aRecipe, boolean aCheckForCollisions, boolean aFakeRecipe, boolean aHidden) { aRecipe.mHidden = aHidden; aRecipe.mFakeRecipe = aFakeRecipe; if (aRecipe.mFluidInputs.length < mMinimalInputFluids && aRecipe.mInputs.length < mMinimalInputItems) return null; - if (aCheckForCollisions && findRecipe(null, false, true, Long.MAX_VALUE, aRecipe.mFluidInputs, aRecipe.mInputs) != null) + if (aCheckForCollisions + && findRecipe(null, false, true, Long.MAX_VALUE, aRecipe.mFluidInputs, aRecipe.mInputs) != null) return null; return add(aRecipe); } @@ -1003,22 +2381,114 @@ public class GT_Recipe implements Comparable<GT_Recipe> { /** * Only used for fake Recipe Handlers to show something in NEI, do not use this for adding actual Recipes! findRecipe wont find fake Recipes, containsInput WILL find fake Recipes */ - public GT_Recipe addFakeRecipe(boolean aCheckForCollisions, ItemStack[] aInputs, ItemStack[] aOutputs, Object aSpecial, int[] aOutputChances, FluidStack[] aFluidInputs, FluidStack[] aFluidOutputs, int aDuration, int aEUt, int aSpecialValue) { - return addFakeRecipe(aCheckForCollisions, new GT_Recipe(false, aInputs, aOutputs, aSpecial, aOutputChances, aFluidInputs, aFluidOutputs, aDuration, aEUt, aSpecialValue)); + public GT_Recipe addFakeRecipe( + boolean aCheckForCollisions, + ItemStack[] aInputs, + ItemStack[] aOutputs, + Object aSpecial, + int[] aOutputChances, + FluidStack[] aFluidInputs, + FluidStack[] aFluidOutputs, + int aDuration, + int aEUt, + int aSpecialValue) { + return addFakeRecipe( + aCheckForCollisions, + new GT_Recipe( + false, + aInputs, + aOutputs, + aSpecial, + aOutputChances, + aFluidInputs, + aFluidOutputs, + aDuration, + aEUt, + aSpecialValue)); } /** * Only used for fake Recipe Handlers to show something in NEI, do not use this for adding actual Recipes! findRecipe wont find fake Recipes, containsInput WILL find fake Recipes */ - public GT_Recipe addFakeRecipe(boolean aCheckForCollisions, ItemStack[] aInputs, ItemStack[] aOutputs, Object aSpecial, FluidStack[] aFluidInputs, FluidStack[] aFluidOutputs, int aDuration, int aEUt, int aSpecialValue) { - return addFakeRecipe(aCheckForCollisions, new GT_Recipe(false, aInputs, aOutputs, aSpecial, null, aFluidInputs, aFluidOutputs, aDuration, aEUt, aSpecialValue)); - } - public GT_Recipe addFakeRecipe(boolean aCheckForCollisions, ItemStack[] aInputs, ItemStack[] aOutputs, Object aSpecial, FluidStack[] aFluidInputs, FluidStack[] aFluidOutputs, int aDuration, int aEUt, int aSpecialValue,boolean hidden) { - return addFakeRecipe(aCheckForCollisions, new GT_Recipe(false, aInputs, aOutputs, aSpecial, null, aFluidInputs, aFluidOutputs, aDuration, aEUt, aSpecialValue),hidden); - } - - public GT_Recipe addFakeRecipe(boolean aCheckForCollisions, ItemStack[] aInputs, ItemStack[] aOutputs, Object aSpecial, FluidStack[] aFluidInputs, FluidStack[] aFluidOutputs, int aDuration, int aEUt, int aSpecialValue, ItemStack[][] aAlt ,boolean hidden) { - return addFakeRecipe(aCheckForCollisions, new GT_Recipe_WithAlt(false, aInputs, aOutputs, aSpecial, null, aFluidInputs, aFluidOutputs, aDuration, aEUt, aSpecialValue, aAlt),hidden); + public GT_Recipe addFakeRecipe( + boolean aCheckForCollisions, + ItemStack[] aInputs, + ItemStack[] aOutputs, + Object aSpecial, + FluidStack[] aFluidInputs, + FluidStack[] aFluidOutputs, + int aDuration, + int aEUt, + int aSpecialValue) { + return addFakeRecipe( + aCheckForCollisions, + new GT_Recipe( + false, + aInputs, + aOutputs, + aSpecial, + null, + aFluidInputs, + aFluidOutputs, + aDuration, + aEUt, + aSpecialValue)); + } + + public GT_Recipe addFakeRecipe( + boolean aCheckForCollisions, + ItemStack[] aInputs, + ItemStack[] aOutputs, + Object aSpecial, + FluidStack[] aFluidInputs, + FluidStack[] aFluidOutputs, + int aDuration, + int aEUt, + int aSpecialValue, + boolean hidden) { + return addFakeRecipe( + aCheckForCollisions, + new GT_Recipe( + false, + aInputs, + aOutputs, + aSpecial, + null, + aFluidInputs, + aFluidOutputs, + aDuration, + aEUt, + aSpecialValue), + hidden); + } + + public GT_Recipe addFakeRecipe( + boolean aCheckForCollisions, + ItemStack[] aInputs, + ItemStack[] aOutputs, + Object aSpecial, + FluidStack[] aFluidInputs, + FluidStack[] aFluidOutputs, + int aDuration, + int aEUt, + int aSpecialValue, + ItemStack[][] aAlt, + boolean hidden) { + return addFakeRecipe( + aCheckForCollisions, + new GT_Recipe_WithAlt( + false, + aInputs, + aOutputs, + aSpecial, + null, + aFluidInputs, + aFluidOutputs, + aDuration, + aEUt, + aSpecialValue, + aAlt), + hidden); } /** @@ -1027,7 +2497,8 @@ public class GT_Recipe implements Comparable<GT_Recipe> { public GT_Recipe addFakeRecipe(boolean aCheckForCollisions, GT_Recipe aRecipe) { return addRecipe(aRecipe, aCheckForCollisions, true, false); } - public GT_Recipe addFakeRecipe(boolean aCheckForCollisions, GT_Recipe aRecipe,boolean hidden) { + + public GT_Recipe addFakeRecipe(boolean aCheckForCollisions, GT_Recipe aRecipe, boolean hidden) { return addRecipe(aRecipe, aCheckForCollisions, true, hidden); } @@ -1035,7 +2506,8 @@ 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()); } @@ -1062,7 +2534,9 @@ public class GT_Recipe implements Comparable<GT_Recipe> { * @return if this Item is a valid Input for any for the Recipes */ public boolean containsInput(ItemStack aStack) { - return aStack != null && (mRecipeItemMap.containsKey(new GT_ItemStack(aStack)) || mRecipeItemMap.containsKey(new GT_ItemStack(aStack, true))); + return aStack != null + && (mRecipeItemMap.containsKey(new GT_ItemStack(aStack)) + || mRecipeItemMap.containsKey(new GT_ItemStack(aStack, true))); } /** @@ -1076,27 +2550,60 @@ public class GT_Recipe implements Comparable<GT_Recipe> { * @return if this Fluid is a valid Input for any for the Recipes */ public boolean containsInput(Fluid aFluid) { - return aFluid != null && mRecipeFluidNameMap.contains(aFluid.getName()); + return aFluid != null && mRecipeFluidNameMap.contains(aFluid.getName()); } - public GT_Recipe findRecipe(IHasWorldObjectAndCoords aTileEntity, boolean aNotUnificated, long aVoltage, FluidStack[] aFluids, ItemStack... aInputs) { + public GT_Recipe findRecipe( + IHasWorldObjectAndCoords aTileEntity, + boolean aNotUnificated, + long aVoltage, + FluidStack[] aFluids, + ItemStack... aInputs) { return findRecipe(aTileEntity, null, aNotUnificated, aVoltage, aFluids, null, aInputs); } - public GT_Recipe findRecipe(IHasWorldObjectAndCoords aTileEntity, boolean aNotUnificated, boolean aDontCheckStackSizes, long aVoltage, FluidStack[] aFluids, ItemStack... aInputs) { - return findRecipe(aTileEntity, null, aNotUnificated, aDontCheckStackSizes, aVoltage, aFluids, null, aInputs); - } - - public GT_Recipe findRecipe(IHasWorldObjectAndCoords aTileEntity, GT_Recipe aRecipe, boolean aNotUnificated, long aVoltage, FluidStack[] aFluids, ItemStack... aInputs) { + public GT_Recipe findRecipe( + IHasWorldObjectAndCoords aTileEntity, + boolean aNotUnificated, + boolean aDontCheckStackSizes, + long aVoltage, + FluidStack[] aFluids, + ItemStack... aInputs) { + return findRecipe( + aTileEntity, null, aNotUnificated, aDontCheckStackSizes, aVoltage, aFluids, null, aInputs); + } + + public GT_Recipe findRecipe( + IHasWorldObjectAndCoords aTileEntity, + GT_Recipe aRecipe, + boolean aNotUnificated, + long aVoltage, + FluidStack[] aFluids, + ItemStack... aInputs) { return findRecipe(aTileEntity, aRecipe, aNotUnificated, aVoltage, aFluids, null, aInputs); } - public GT_Recipe findRecipe(IHasWorldObjectAndCoords aTileEntity, GT_Recipe aRecipe, boolean aNotUnificated, boolean aDontCheckStackSizes, long aVoltage, FluidStack[] aFluids, ItemStack... aInputs) { - return findRecipe(aTileEntity, aRecipe, aNotUnificated, aDontCheckStackSizes, aVoltage, aFluids, null, aInputs); - } - - public GT_Recipe findRecipe(IHasWorldObjectAndCoords aTileEntity, GT_Recipe aRecipe, boolean aNotUnificated, long aVoltage, FluidStack[] aFluids, ItemStack aSpecialSlot, ItemStack... aInputs) { - return findRecipe(aTileEntity, aRecipe, aNotUnificated, false, aVoltage, aFluids, aSpecialSlot, aInputs); + public GT_Recipe findRecipe( + IHasWorldObjectAndCoords aTileEntity, + GT_Recipe aRecipe, + boolean aNotUnificated, + boolean aDontCheckStackSizes, + long aVoltage, + FluidStack[] aFluids, + ItemStack... aInputs) { + return findRecipe( + aTileEntity, aRecipe, aNotUnificated, aDontCheckStackSizes, aVoltage, aFluids, null, aInputs); + } + + public GT_Recipe findRecipe( + IHasWorldObjectAndCoords aTileEntity, + GT_Recipe aRecipe, + boolean aNotUnificated, + long aVoltage, + FluidStack[] aFluids, + ItemStack aSpecialSlot, + ItemStack... aInputs) { + return findRecipe(aTileEntity, aRecipe, aNotUnificated, false, aVoltage, aFluids, aSpecialSlot, aInputs); } /** * finds a Recipe matching the aFluid and ItemStack Inputs. @@ -1111,12 +2618,22 @@ public class GT_Recipe implements Comparable<GT_Recipe> { * @param aInputs the Item Inputs * @return the Recipe it has found or null for no matching Recipe */ - public GT_Recipe findRecipe(IHasWorldObjectAndCoords aTileEntity, GT_Recipe aRecipe, boolean aNotUnificated, boolean aDontCheckStackSizes, long aVoltage, FluidStack[] aFluids, ItemStack aSpecialSlot, ItemStack... aInputs) { + public GT_Recipe findRecipe( + IHasWorldObjectAndCoords aTileEntity, + GT_Recipe aRecipe, + boolean aNotUnificated, + boolean aDontCheckStackSizes, + long aVoltage, + FluidStack[] aFluids, + ItemStack aSpecialSlot, + ItemStack... aInputs) { // No Recipes? Well, nothing to be found then. if (mRecipeList.isEmpty()) return null; - // Some Recipe Classes require a certain amount of Inputs of certain kinds. Like "at least 1 Fluid + 1 Stack" or "at least 2 Stacks" before they start searching for Recipes. - // This improves Performance massively, especially if people leave things like Circuits, Molds or Shapes in their Machines to select Sub Recipes. + // Some Recipe Classes require a certain amount of Inputs of certain kinds. Like "at least 1 Fluid + 1 + // Stack" or "at least 2 Stacks" before they start searching for Recipes. + // This improves Performance massively, especially if people leave things like Circuits, Molds or Shapes in + // their Machines to select Sub Recipes. if (GregTech_API.sPostloadFinished) { if (mMinimalInputFluids > 0) { if (aFluids == null) return null; @@ -1128,7 +2645,7 @@ public class GT_Recipe implements Comparable<GT_Recipe> { if (aInputs == null) return null; int tAmount = 0; for (ItemStack aInput : aInputs) if (aInput != null) tAmount++; - if (tAmount < mMinimalInputItems) return null; + if (tAmount < mMinimalInputItems) return null; } } @@ -1137,32 +2654,41 @@ public class GT_Recipe implements Comparable<GT_Recipe> { // Check the Recipe which has been used last time in order to not have to search for it again, if possible. if (aRecipe != null) - if (!aRecipe.mFakeRecipe && aRecipe.mCanBeBuffered && aRecipe.isRecipeInputEqual(false, aDontCheckStackSizes, aFluids, aInputs)) + if (!aRecipe.mFakeRecipe + && aRecipe.mCanBeBuffered + && aRecipe.isRecipeInputEqual(false, aDontCheckStackSizes, aFluids, aInputs)) return aRecipe.mEnabled && aVoltage * mAmperage >= aRecipe.mEUt ? aRecipe : null; // Now look for the Recipes inside the Item HashMaps, but only when the Recipes usually have Items. - if (mUsualInputCount > 0 && aInputs != null) for (ItemStack tStack : aInputs) - if (tStack != null) { - Collection<GT_Recipe> - tRecipes = mRecipeItemMap.get(new GT_ItemStack(tStack)); - if (tRecipes != null) for (GT_Recipe tRecipe : tRecipes) - if (!tRecipe.mFakeRecipe && tRecipe.isRecipeInputEqual(false, aDontCheckStackSizes, aFluids, aInputs)) - return tRecipe.mEnabled && aVoltage * mAmperage >= tRecipe.mEUt ? tRecipe : null; - tRecipes = mRecipeItemMap.get(new GT_ItemStack(tStack, true)); - if (tRecipes != null) for (GT_Recipe tRecipe : tRecipes) - if (!tRecipe.mFakeRecipe && tRecipe.isRecipeInputEqual(false, aDontCheckStackSizes, aFluids, aInputs)) - return tRecipe.mEnabled && aVoltage * mAmperage >= tRecipe.mEUt ? tRecipe : null; - } + if (mUsualInputCount > 0 && aInputs != null) + for (ItemStack tStack : aInputs) + if (tStack != null) { + Collection<GT_Recipe> tRecipes = mRecipeItemMap.get(new GT_ItemStack(tStack)); + if (tRecipes != null) + for (GT_Recipe tRecipe : tRecipes) + if (!tRecipe.mFakeRecipe + && tRecipe.isRecipeInputEqual(false, aDontCheckStackSizes, aFluids, aInputs)) + return tRecipe.mEnabled && aVoltage * mAmperage >= tRecipe.mEUt ? tRecipe : null; + tRecipes = mRecipeItemMap.get(new GT_ItemStack(tStack, true)); + if (tRecipes != null) + for (GT_Recipe tRecipe : tRecipes) + if (!tRecipe.mFakeRecipe + && tRecipe.isRecipeInputEqual(false, aDontCheckStackSizes, aFluids, aInputs)) + return tRecipe.mEnabled && aVoltage * mAmperage >= tRecipe.mEUt ? tRecipe : null; + } - // If the minimal Amount of Items for the Recipe is 0, then it could be a Fluid-Only Recipe, so check that Map too. - if (mMinimalInputItems == 0 && aFluids != null) for (FluidStack aFluid : aFluids) - if (aFluid != null) { - Collection<GT_Recipe> - tRecipes = mRecipeFluidMap.get(aFluid.getFluid()); - if (tRecipes != null) for (GT_Recipe tRecipe : tRecipes) - if (!tRecipe.mFakeRecipe && tRecipe.isRecipeInputEqual(false, aDontCheckStackSizes, aFluids, aInputs)) - return tRecipe.mEnabled && aVoltage * mAmperage >= tRecipe.mEUt ? tRecipe : null; - } + // If the minimal Amount of Items for the Recipe is 0, then it could be a Fluid-Only Recipe, so check that + // Map too. + if (mMinimalInputItems == 0 && aFluids != null) + for (FluidStack aFluid : aFluids) + if (aFluid != null) { + Collection<GT_Recipe> tRecipes = mRecipeFluidMap.get(aFluid.getFluid()); + if (tRecipes != null) + for (GT_Recipe tRecipe : tRecipes) + if (!tRecipe.mFakeRecipe + && tRecipe.isRecipeInputEqual(false, aDontCheckStackSizes, aFluids, aInputs)) + return tRecipe.mEnabled && aVoltage * mAmperage >= tRecipe.mEUt ? tRecipe : null; + } // And nothing has been found. return null; @@ -1203,7 +2729,7 @@ public class GT_Recipe implements Comparable<GT_Recipe> { * Overriding this method and getOutputPositionedStacks allows custom NEI stack placement * @return A list of input stacks */ - public ArrayList<PositionedStack> getInputPositionedStacks(GT_Recipe recipe){ + public ArrayList<PositionedStack> getInputPositionedStacks(GT_Recipe recipe) { return null; } @@ -1211,12 +2737,11 @@ public class GT_Recipe implements Comparable<GT_Recipe> { * Overriding this method and getInputPositionedStacks allows custom NEI stack placement * @return A list of output stacks */ - public ArrayList<PositionedStack> getOutputPositionedStacks(GT_Recipe recipe){ + public ArrayList<PositionedStack> getOutputPositionedStacks(GT_Recipe recipe) { return null; } - public void addRecipe(Object o, FluidStack[] fluidInputArray, FluidStack[] fluidOutputArray) { - } + public void addRecipe(Object o, FluidStack[] fluidInputArray, FluidStack[] fluidOutputArray) {} } // ----------------------------------------------------------------------------------------------------------------- @@ -1227,8 +2752,38 @@ public class GT_Recipe implements Comparable<GT_Recipe> { * Abstract Class for general Recipe Handling of non GT Recipes */ public abstract static class GT_Recipe_Map_NonGTRecipes extends GT_Recipe_Map { - public GT_Recipe_Map_NonGTRecipes(Collection<GT_Recipe> aRecipeList, String aUnlocalizedName, String aLocalName, String aNEIName, String aNEIGUIPath, int aUsualInputCount, int aUsualOutputCount, int aMinimalInputItems, int aMinimalInputFluids, int aAmperage, String aNEISpecialValuePre, int aNEISpecialValueMultiplier, String aNEISpecialValuePost, boolean aShowVoltageAmperageInNEI, boolean aNEIAllowed) { - super(aRecipeList, aUnlocalizedName, aLocalName, aNEIName, aNEIGUIPath, aUsualInputCount, aUsualOutputCount, aMinimalInputItems, aMinimalInputFluids, aAmperage, aNEISpecialValuePre, aNEISpecialValueMultiplier, aNEISpecialValuePost, aShowVoltageAmperageInNEI, aNEIAllowed); + public GT_Recipe_Map_NonGTRecipes( + Collection<GT_Recipe> aRecipeList, + String aUnlocalizedName, + String aLocalName, + String aNEIName, + String aNEIGUIPath, + int aUsualInputCount, + int aUsualOutputCount, + int aMinimalInputItems, + int aMinimalInputFluids, + int aAmperage, + String aNEISpecialValuePre, + int aNEISpecialValueMultiplier, + String aNEISpecialValuePost, + boolean aShowVoltageAmperageInNEI, + boolean aNEIAllowed) { + super( + aRecipeList, + aUnlocalizedName, + aLocalName, + aNEIName, + aNEIGUIPath, + aUsualInputCount, + aUsualOutputCount, + aMinimalInputItems, + aMinimalInputFluids, + aAmperage, + aNEISpecialValuePre, + aNEISpecialValueMultiplier, + aNEISpecialValuePost, + aShowVoltageAmperageInNEI, + aNEIAllowed); } @Override @@ -1247,12 +2802,31 @@ public class GT_Recipe implements Comparable<GT_Recipe> { } @Override - public GT_Recipe addRecipe(boolean aOptimize, ItemStack[] aInputs, ItemStack[] aOutputs, Object aSpecial, int[] aOutputChances, FluidStack[] aFluidInputs, FluidStack[] aFluidOutputs, int aDuration, int aEUt, int aSpecialValue) { + public GT_Recipe addRecipe( + boolean aOptimize, + ItemStack[] aInputs, + ItemStack[] aOutputs, + Object aSpecial, + int[] aOutputChances, + FluidStack[] aFluidInputs, + FluidStack[] aFluidOutputs, + int aDuration, + int aEUt, + int aSpecialValue) { return null; } @Override - public GT_Recipe addRecipe(boolean aOptimize, ItemStack[] aInputs, ItemStack[] aOutputs, Object aSpecial, FluidStack[] aFluidInputs, FluidStack[] aFluidOutputs, int aDuration, int aEUt, int aSpecialValue) { + public GT_Recipe addRecipe( + boolean aOptimize, + ItemStack[] aInputs, + ItemStack[] aOutputs, + Object aSpecial, + FluidStack[] aFluidInputs, + FluidStack[] aFluidOutputs, + int aDuration, + int aEUt, + int aSpecialValue) { return null; } @@ -1262,17 +2836,46 @@ public class GT_Recipe implements Comparable<GT_Recipe> { } @Override - public GT_Recipe addFakeRecipe(boolean aCheckForCollisions, ItemStack[] aInputs, ItemStack[] aOutputs, Object aSpecial, int[] aOutputChances, FluidStack[] aFluidInputs, FluidStack[] aFluidOutputs, int aDuration, int aEUt, int aSpecialValue) { + public GT_Recipe addFakeRecipe( + boolean aCheckForCollisions, + ItemStack[] aInputs, + ItemStack[] aOutputs, + Object aSpecial, + int[] aOutputChances, + FluidStack[] aFluidInputs, + FluidStack[] aFluidOutputs, + int aDuration, + int aEUt, + int aSpecialValue) { return null; } @Override - public GT_Recipe addFakeRecipe(boolean aCheckForCollisions, ItemStack[] aInputs, ItemStack[] aOutputs, Object aSpecial, FluidStack[] aFluidInputs, FluidStack[] aFluidOutputs, int aDuration, int aEUt, int aSpecialValue) { + public GT_Recipe addFakeRecipe( + boolean aCheckForCollisions, + ItemStack[] aInputs, + ItemStack[] aOutputs, + Object aSpecial, + FluidStack[] aFluidInputs, + FluidStack[] aFluidOutputs, + int aDuration, + int aEUt, + int aSpecialValue) { return null; } @Override - public GT_Recipe addFakeRecipe(boolean aCheckForCollisions, ItemStack[] aInputs, ItemStack[] aOutputs, Object aSpecial, FluidStack[] aFluidInputs, FluidStack[] aFluidOutputs, int aDuration, int aEUt, int aSpecialValue,boolean hidden) { + public GT_Recipe addFakeRecipe( + boolean aCheckForCollisions, + ItemStack[] aInputs, + ItemStack[] aOutputs, + Object aSpecial, + FluidStack[] aFluidInputs, + FluidStack[] aFluidOutputs, + int aDuration, + int aEUt, + int aSpecialValue, + boolean hidden) { return null; } @@ -1287,7 +2890,9 @@ public class GT_Recipe implements Comparable<GT_Recipe> { } @Override - public void reInit() {/**/} + public void reInit() { + /**/ + } @Override protected GT_Recipe addToItemMap(GT_Recipe aRecipe) { @@ -1300,8 +2905,39 @@ public class GT_Recipe implements Comparable<GT_Recipe> { */ public static class GT_Recipe_Map_Fuel extends GT_Recipe_Map { private final Map<String, GT_Recipe> mRecipesByFluidInput = new HashMap<>(); - public GT_Recipe_Map_Fuel(Collection<GT_Recipe> aRecipeList, String aUnlocalizedName, String aLocalName, String aNEIName, String aNEIGUIPath, int aUsualInputCount, int aUsualOutputCount, int aMinimalInputItems, int aMinimalInputFluids, int aAmperage, String aNEISpecialValuePre, int aNEISpecialValueMultiplier, String aNEISpecialValuePost, boolean aShowVoltageAmperageInNEI, boolean aNEIAllowed) { - super(aRecipeList, aUnlocalizedName, aLocalName, aNEIName, aNEIGUIPath, aUsualInputCount, aUsualOutputCount, aMinimalInputItems, aMinimalInputFluids, aAmperage, aNEISpecialValuePre, aNEISpecialValueMultiplier, aNEISpecialValuePost, aShowVoltageAmperageInNEI, aNEIAllowed); + + public GT_Recipe_Map_Fuel( + Collection<GT_Recipe> aRecipeList, + String aUnlocalizedName, + String aLocalName, + String aNEIName, + String aNEIGUIPath, + int aUsualInputCount, + int aUsualOutputCount, + int aMinimalInputItems, + int aMinimalInputFluids, + int aAmperage, + String aNEISpecialValuePre, + int aNEISpecialValueMultiplier, + String aNEISpecialValuePost, + boolean aShowVoltageAmperageInNEI, + boolean aNEIAllowed) { + super( + aRecipeList, + aUnlocalizedName, + aLocalName, + aNEIName, + aNEIGUIPath, + aUsualInputCount, + aUsualOutputCount, + aMinimalInputItems, + aMinimalInputFluids, + aAmperage, + aNEISpecialValuePre, + aNEISpecialValueMultiplier, + aNEISpecialValuePost, + aShowVoltageAmperageInNEI, + aNEIAllowed); } public GT_Recipe addFuel(ItemStack aInput, ItemStack aOutput, int aFuelValueInEU) { @@ -1316,27 +2952,50 @@ public class GT_Recipe implements Comparable<GT_Recipe> { return addFuel(null, null, aFluidInput, aFluidOutput, 10000, aFuelValueInEU); } - public GT_Recipe addFuel(ItemStack aInput, ItemStack aOutput, FluidStack aFluidInput, FluidStack aFluidOutput, int aFuelValueInEU) { + public GT_Recipe addFuel( + ItemStack aInput, + ItemStack aOutput, + FluidStack aFluidInput, + FluidStack aFluidOutput, + int aFuelValueInEU) { return addFuel(aInput, aOutput, aFluidInput, aFluidOutput, 10000, aFuelValueInEU); } - public GT_Recipe addFuel(ItemStack aInput, ItemStack aOutput, FluidStack aFluidInput, FluidStack aFluidOutput, int aChance, int aFuelValueInEU) { - return addRecipe(true, new ItemStack[]{aInput}, new ItemStack[]{aOutput}, null, new int[]{aChance}, new FluidStack[]{aFluidInput}, new FluidStack[]{aFluidOutput}, 0, 0, aFuelValueInEU); + public GT_Recipe addFuel( + ItemStack aInput, + ItemStack aOutput, + FluidStack aFluidInput, + FluidStack aFluidOutput, + int aChance, + int aFuelValueInEU) { + return addRecipe( + true, + new ItemStack[] {aInput}, + new ItemStack[] {aOutput}, + null, + new int[] {aChance}, + new FluidStack[] {aFluidInput}, + new FluidStack[] {aFluidOutput}, + 0, + 0, + aFuelValueInEU); } @Override public GT_Recipe add(GT_Recipe aRecipe) { aRecipe = super.add(aRecipe); - if (aRecipe.mInputs != null && GT_Utility.getNonnullElementCount(aRecipe.mInputs) == 1 && - (aRecipe.mFluidInputs == null || GT_Utility.getNonnullElementCount(aRecipe.mFluidInputs) == 0)) { + if (aRecipe.mInputs != null + && GT_Utility.getNonnullElementCount(aRecipe.mInputs) == 1 + && (aRecipe.mFluidInputs == null || GT_Utility.getNonnullElementCount(aRecipe.mFluidInputs) == 0)) { FluidStack tFluid = GT_Utility.getFluidForFilledItem(aRecipe.mInputs[0], true); if (tFluid != null) { tFluid.amount = 0; mRecipesByFluidInput.put(tFluid.getUnlocalizedName(), aRecipe); } - } else if ((aRecipe.mInputs == null || GT_Utility.getNonnullElementCount(aRecipe.mInputs) == 0) && - aRecipe.mFluidInputs != null && GT_Utility.getNonnullElementCount(aRecipe.mFluidInputs) == 1 && - aRecipe.mFluidInputs[0] != null) { + } else if ((aRecipe.mInputs == null || GT_Utility.getNonnullElementCount(aRecipe.mInputs) == 0) + && aRecipe.mFluidInputs != null + && GT_Utility.getNonnullElementCount(aRecipe.mFluidInputs) == 1 + && aRecipe.mFluidInputs[0] != null) { mRecipesByFluidInput.put(aRecipe.mFluidInputs[0].getUnlocalizedName(), aRecipe); } return aRecipe; @@ -1351,16 +3010,65 @@ public class GT_Recipe implements Comparable<GT_Recipe> { * Special Class for Furnace Recipe handling. */ public static class GT_Recipe_Map_Furnace extends GT_Recipe_Map_NonGTRecipes { - public GT_Recipe_Map_Furnace(Collection<GT_Recipe> aRecipeList, String aUnlocalizedName, String aLocalName, String aNEIName, String aNEIGUIPath, int aUsualInputCount, int aUsualOutputCount, int aMinimalInputItems, int aMinimalInputFluids, int aAmperage, String aNEISpecialValuePre, int aNEISpecialValueMultiplier, String aNEISpecialValuePost, boolean aShowVoltageAmperageInNEI, boolean aNEIAllowed) { - super(aRecipeList, aUnlocalizedName, aLocalName, aNEIName, aNEIGUIPath, aUsualInputCount, aUsualOutputCount, aMinimalInputItems, aMinimalInputFluids, aAmperage, aNEISpecialValuePre, aNEISpecialValueMultiplier, aNEISpecialValuePost, aShowVoltageAmperageInNEI, aNEIAllowed); + public GT_Recipe_Map_Furnace( + Collection<GT_Recipe> aRecipeList, + String aUnlocalizedName, + String aLocalName, + String aNEIName, + String aNEIGUIPath, + int aUsualInputCount, + int aUsualOutputCount, + int aMinimalInputItems, + int aMinimalInputFluids, + int aAmperage, + String aNEISpecialValuePre, + int aNEISpecialValueMultiplier, + String aNEISpecialValuePost, + boolean aShowVoltageAmperageInNEI, + boolean aNEIAllowed) { + super( + aRecipeList, + aUnlocalizedName, + aLocalName, + aNEIName, + aNEIGUIPath, + aUsualInputCount, + aUsualOutputCount, + aMinimalInputItems, + aMinimalInputFluids, + aAmperage, + aNEISpecialValuePre, + aNEISpecialValueMultiplier, + aNEISpecialValuePost, + aShowVoltageAmperageInNEI, + aNEIAllowed); } @Override - public GT_Recipe findRecipe(IHasWorldObjectAndCoords aTileEntity, GT_Recipe aRecipe, boolean aNotUnificated, long aVoltage, FluidStack[] aFluids, ItemStack aSpecialSlot, ItemStack... aInputs) { + public GT_Recipe findRecipe( + IHasWorldObjectAndCoords aTileEntity, + GT_Recipe aRecipe, + boolean aNotUnificated, + long aVoltage, + FluidStack[] aFluids, + ItemStack aSpecialSlot, + ItemStack... aInputs) { if (aInputs == null || aInputs.length <= 0 || aInputs[0] == null) return null; if (aRecipe != null && aRecipe.isRecipeInputEqual(false, true, aFluids, aInputs)) return aRecipe; ItemStack tOutput = GT_ModHandler.getSmeltingOutput(aInputs[0], false, null); - return tOutput == null ? null : new GT_Recipe(false, new ItemStack[]{GT_Utility.copyAmount(1, aInputs[0])}, new ItemStack[]{tOutput}, null, null, null, null, 128, 4, 0); + return tOutput == null + ? null + : new GT_Recipe( + false, + new ItemStack[] {GT_Utility.copyAmount(1, aInputs[0])}, + new ItemStack[] {tOutput}, + null, + null, + null, + null, + 128, + 4, + 0); } @Override @@ -1373,42 +3081,96 @@ public class GT_Recipe implements Comparable<GT_Recipe> { * Special Class for Microwave Recipe handling. */ public static class GT_Recipe_Map_Microwave extends GT_Recipe_Map_NonGTRecipes { - public GT_Recipe_Map_Microwave(Collection<GT_Recipe> aRecipeList, String aUnlocalizedName, String aLocalName, String aNEIName, String aNEIGUIPath, int aUsualInputCount, int aUsualOutputCount, int aMinimalInputItems, int aMinimalInputFluids, int aAmperage, String aNEISpecialValuePre, int aNEISpecialValueMultiplier, String aNEISpecialValuePost, boolean aShowVoltageAmperageInNEI, boolean aNEIAllowed) { - super(aRecipeList, aUnlocalizedName, aLocalName, aNEIName, aNEIGUIPath, aUsualInputCount, aUsualOutputCount, aMinimalInputItems, aMinimalInputFluids, aAmperage, aNEISpecialValuePre, aNEISpecialValueMultiplier, aNEISpecialValuePost, aShowVoltageAmperageInNEI, aNEIAllowed); + public GT_Recipe_Map_Microwave( + Collection<GT_Recipe> aRecipeList, + String aUnlocalizedName, + String aLocalName, + String aNEIName, + String aNEIGUIPath, + int aUsualInputCount, + int aUsualOutputCount, + int aMinimalInputItems, + int aMinimalInputFluids, + int aAmperage, + String aNEISpecialValuePre, + int aNEISpecialValueMultiplier, + String aNEISpecialValuePost, + boolean aShowVoltageAmperageInNEI, + boolean aNEIAllowed) { + super( + aRecipeList, + aUnlocalizedName, + aLocalName, + aNEIName, + aNEIGUIPath, + aUsualInputCount, + aUsualOutputCount, + aMinimalInputItems, + aMinimalInputFluids, + aAmperage, + aNEISpecialValuePre, + aNEISpecialValueMultiplier, + aNEISpecialValuePost, + aShowVoltageAmperageInNEI, + aNEIAllowed); } @Override - public GT_Recipe findRecipe(IHasWorldObjectAndCoords aTileEntity, GT_Recipe aRecipe, boolean aNotUnificated, long aVoltage, FluidStack[] aFluids, ItemStack aSpecialSlot, ItemStack... aInputs) { + public GT_Recipe findRecipe( + IHasWorldObjectAndCoords aTileEntity, + GT_Recipe aRecipe, + boolean aNotUnificated, + long aVoltage, + FluidStack[] aFluids, + ItemStack aSpecialSlot, + ItemStack... aInputs) { if (aInputs == null || aInputs.length <= 0 || aInputs[0] == null) return null; if (aRecipe != null && aRecipe.isRecipeInputEqual(false, true, aFluids, aInputs)) return aRecipe; ItemStack tOutput = GT_ModHandler.getSmeltingOutput(aInputs[0], false, null); if (GT_Utility.areStacksEqual(aInputs[0], new ItemStack(Items.book, 1, W))) { - return new GT_Recipe(false, new ItemStack[]{GT_Utility.copyAmount(1, aInputs[0])}, new ItemStack[]{GT_Utility.getWrittenBook("Manual_Microwave", ItemList.Book_Written_03.get(1))}, null, null, null, null, 32, 4, 0); + return new GT_Recipe( + false, + new ItemStack[] {GT_Utility.copyAmount(1, aInputs[0])}, + new ItemStack[] {GT_Utility.getWrittenBook("Manual_Microwave", ItemList.Book_Written_03.get(1)) + }, + null, + null, + null, + null, + 32, + 4, + 0); } - // Check Container Item of Input since it is around the Input, then the Input itself, then Container Item of Output and last check the Output itself - for (ItemStack tStack : new ItemStack[]{GT_Utility.getContainerItem(aInputs[0], true), aInputs[0], GT_Utility.getContainerItem(tOutput, true), tOutput}) + // Check Container Item of Input since it is around the Input, then the Input itself, then Container Item of + // Output and last check the Output itself + for (ItemStack tStack : new ItemStack[] { + GT_Utility.getContainerItem(aInputs[0], true), + aInputs[0], + GT_Utility.getContainerItem(tOutput, true), + tOutput + }) if (tStack != null) { if (GT_Utility.areStacksEqual(tStack, new ItemStack(Blocks.netherrack, 1, W), true) || GT_Utility.areStacksEqual(tStack, new ItemStack(Blocks.tnt, 1, W), true) || GT_Utility.areStacksEqual(tStack, new ItemStack(Items.egg, 1, W), true) || GT_Utility.areStacksEqual(tStack, new ItemStack(Items.firework_charge, 1, W), true) || GT_Utility.areStacksEqual(tStack, new ItemStack(Items.fireworks, 1, W), true) - || GT_Utility.areStacksEqual(tStack, new ItemStack(Items.fire_charge, 1, W), true) - ) { + || GT_Utility.areStacksEqual(tStack, new ItemStack(Items.fire_charge, 1, W), true)) { if (aTileEntity instanceof IGregTechTileEntity) { - GT_Log.exp.println("Microwave Explosion due to TNT || EGG || FIREWORKCHARGE || FIREWORK || FIRE CHARGE"); + GT_Log.exp.println( + "Microwave Explosion due to TNT || EGG || FIREWORKCHARGE || FIREWORK || FIRE CHARGE"); ((IGregTechTileEntity) aTileEntity).doExplosion(aVoltage * 4); } return null; } ItemData tData = GT_OreDictUnificator.getItemData(tStack); - if (tData != null) { if (tData.mMaterial != null && tData.mMaterial.mMaterial != null) { - if (tData.mMaterial.mMaterial.contains(SubTag.METAL) || tData.mMaterial.mMaterial.contains(SubTag.EXPLOSIVE)) { + if (tData.mMaterial.mMaterial.contains(SubTag.METAL) + || tData.mMaterial.mMaterial.contains(SubTag.EXPLOSIVE)) { if (aTileEntity instanceof IGregTechTileEntity) { GT_Log.exp.println("Microwave Explosion due to METAL insertion"); ((IGregTechTileEntity) aTileEntity).doExplosion(aVoltage * 4); @@ -1425,7 +3187,8 @@ public class GT_Recipe implements Comparable<GT_Recipe> { } for (MaterialStack tMaterial : tData.mByProducts) if (tMaterial != null) { - if (tMaterial.mMaterial.contains(SubTag.METAL) || tMaterial.mMaterial.contains(SubTag.EXPLOSIVE)) { + if (tMaterial.mMaterial.contains(SubTag.METAL) + || tMaterial.mMaterial.contains(SubTag.EXPLOSIVE)) { if (aTileEntity instanceof IGregTechTileEntity) { GT_Log.exp.println("Microwave Explosion due to METAL insertion"); ((IGregTechTileEntity) aTileEntity).doExplosion(aVoltage * 4); @@ -1448,10 +3211,21 @@ public class GT_Recipe implements Comparable<GT_Recipe> { } return null; } - } - return tOutput == null ? null : new GT_Recipe(false, new ItemStack[]{GT_Utility.copyAmount(1, aInputs[0])}, new ItemStack[]{tOutput}, null, null, null, null, 32, 4, 0); + return tOutput == null + ? null + : new GT_Recipe( + false, + new ItemStack[] {GT_Utility.copyAmount(1, aInputs[0])}, + new ItemStack[] {tOutput}, + null, + null, + null, + null, + 32, + 4, + 0); } @Override @@ -1464,21 +3238,69 @@ public class GT_Recipe implements Comparable<GT_Recipe> { * Special Class for Unboxinator handling. */ public static class GT_Recipe_Map_Unboxinator extends GT_Recipe_Map { - public GT_Recipe_Map_Unboxinator(Collection<GT_Recipe> aRecipeList, String aUnlocalizedName, String aLocalName, String aNEIName, String aNEIGUIPath, int aUsualInputCount, int aUsualOutputCount, int aMinimalInputItems, int aMinimalInputFluids, int aAmperage, String aNEISpecialValuePre, int aNEISpecialValueMultiplier, String aNEISpecialValuePost, boolean aShowVoltageAmperageInNEI, boolean aNEIAllowed) { - super(aRecipeList, aUnlocalizedName, aLocalName, aNEIName, aNEIGUIPath, aUsualInputCount, aUsualOutputCount, aMinimalInputItems, aMinimalInputFluids, aAmperage, aNEISpecialValuePre, aNEISpecialValueMultiplier, aNEISpecialValuePost, aShowVoltageAmperageInNEI, aNEIAllowed); + public GT_Recipe_Map_Unboxinator( + Collection<GT_Recipe> aRecipeList, + String aUnlocalizedName, + String aLocalName, + String aNEIName, + String aNEIGUIPath, + int aUsualInputCount, + int aUsualOutputCount, + int aMinimalInputItems, + int aMinimalInputFluids, + int aAmperage, + String aNEISpecialValuePre, + int aNEISpecialValueMultiplier, + String aNEISpecialValuePost, + boolean aShowVoltageAmperageInNEI, + boolean aNEIAllowed) { + super( + aRecipeList, + aUnlocalizedName, + aLocalName, + aNEIName, + aNEIGUIPath, + aUsualInputCount, + aUsualOutputCount, + aMinimalInputItems, + aMinimalInputFluids, + aAmperage, + aNEISpecialValuePre, + aNEISpecialValueMultiplier, + aNEISpecialValuePost, + aShowVoltageAmperageInNEI, + aNEIAllowed); } @Override - public GT_Recipe findRecipe(IHasWorldObjectAndCoords aTileEntity, GT_Recipe aRecipe, boolean aNotUnificated, long aVoltage, FluidStack[] aFluids, ItemStack aSpecialSlot, ItemStack... aInputs) { + public GT_Recipe findRecipe( + IHasWorldObjectAndCoords aTileEntity, + GT_Recipe aRecipe, + boolean aNotUnificated, + long aVoltage, + FluidStack[] aFluids, + ItemStack aSpecialSlot, + ItemStack... aInputs) { if (aInputs == null || aInputs.length <= 0 || !ItemList.IC2_Scrapbox.isStackEqual(aInputs[0], false, true)) return super.findRecipe(aTileEntity, aRecipe, aNotUnificated, aVoltage, aFluids, aSpecialSlot, aInputs); ItemStack tOutput = GT_ModHandler.getRandomScrapboxDrop(); if (tOutput == null) return super.findRecipe(aTileEntity, aRecipe, aNotUnificated, aVoltage, aFluids, aSpecialSlot, aInputs); - GT_Recipe rRecipe = new GT_Recipe(false, new ItemStack[]{ItemList.IC2_Scrapbox.get(1)}, new ItemStack[]{tOutput}, null, null, null, null, 16, 1, 0); + GT_Recipe rRecipe = new GT_Recipe( + false, + new ItemStack[] {ItemList.IC2_Scrapbox.get(1)}, + new ItemStack[] {tOutput}, + null, + null, + null, + null, + 16, + 1, + 0); // It is not allowed to be buffered due to the random Output rRecipe.mCanBeBuffered = false; - // Due to its randomness it is not good if there are Items in the Output Slot, because those Items could manipulate the outcome. + // Due to its randomness it is not good if there are Items in the Output Slot, because those Items could + // manipulate the outcome. rRecipe.mNeedsEmptyOutput = true; return rRecipe; } @@ -1493,25 +3315,86 @@ public class GT_Recipe implements Comparable<GT_Recipe> { * Special Class for Fluid Canner handling. */ public static class GT_Recipe_Map_FluidCanner extends GT_Recipe_Map { - public GT_Recipe_Map_FluidCanner(Collection<GT_Recipe> aRecipeList, String aUnlocalizedName, String aLocalName, String aNEIName, String aNEIGUIPath, int aUsualInputCount, int aUsualOutputCount, int aMinimalInputItems, int aMinimalInputFluids, int aAmperage, String aNEISpecialValuePre, int aNEISpecialValueMultiplier, String aNEISpecialValuePost, boolean aShowVoltageAmperageInNEI, boolean aNEIAllowed) { - super(aRecipeList, aUnlocalizedName, aLocalName, aNEIName, aNEIGUIPath, aUsualInputCount, aUsualOutputCount, aMinimalInputItems, aMinimalInputFluids, aAmperage, aNEISpecialValuePre, aNEISpecialValueMultiplier, aNEISpecialValuePost, aShowVoltageAmperageInNEI, aNEIAllowed); + public GT_Recipe_Map_FluidCanner( + Collection<GT_Recipe> aRecipeList, + String aUnlocalizedName, + String aLocalName, + String aNEIName, + String aNEIGUIPath, + int aUsualInputCount, + int aUsualOutputCount, + int aMinimalInputItems, + int aMinimalInputFluids, + int aAmperage, + String aNEISpecialValuePre, + int aNEISpecialValueMultiplier, + String aNEISpecialValuePost, + boolean aShowVoltageAmperageInNEI, + boolean aNEIAllowed) { + super( + aRecipeList, + aUnlocalizedName, + aLocalName, + aNEIName, + aNEIGUIPath, + aUsualInputCount, + aUsualOutputCount, + aMinimalInputItems, + aMinimalInputFluids, + aAmperage, + aNEISpecialValuePre, + aNEISpecialValueMultiplier, + aNEISpecialValuePost, + aShowVoltageAmperageInNEI, + aNEIAllowed); } @Override - public GT_Recipe findRecipe(IHasWorldObjectAndCoords aTileEntity, GT_Recipe aRecipe, boolean aNotUnificated, long aVoltage, FluidStack[] aFluids, ItemStack aSpecialSlot, ItemStack... aInputs) { - GT_Recipe rRecipe = super.findRecipe(aTileEntity, aRecipe, aNotUnificated, aVoltage, aFluids, aSpecialSlot, aInputs); - if (aInputs == null || aInputs.length <= 0 || aInputs[0] == null || rRecipe != null || !GregTech_API.sPostloadFinished) - return rRecipe; + public GT_Recipe findRecipe( + IHasWorldObjectAndCoords aTileEntity, + GT_Recipe aRecipe, + boolean aNotUnificated, + long aVoltage, + FluidStack[] aFluids, + ItemStack aSpecialSlot, + ItemStack... aInputs) { + GT_Recipe rRecipe = + super.findRecipe(aTileEntity, aRecipe, aNotUnificated, aVoltage, aFluids, aSpecialSlot, aInputs); + if (aInputs == null + || aInputs.length <= 0 + || aInputs[0] == null + || rRecipe != null + || !GregTech_API.sPostloadFinished) return rRecipe; if (aFluids != null && aFluids.length > 0 && aFluids[0] != null) { ItemStack tOutput = GT_Utility.fillFluidContainer(aFluids[0], aInputs[0], false, true); FluidStack tFluid = GT_Utility.getFluidForFilledItem(tOutput, true); if (tFluid != null) - rRecipe = new GT_Recipe(false, new ItemStack[]{GT_Utility.copyAmount(1, aInputs[0])}, new ItemStack[]{tOutput}, null, null, new FluidStack[]{tFluid}, null, Math.max(tFluid.amount / 64, 16), 1, 0); + rRecipe = new GT_Recipe( + false, + new ItemStack[] {GT_Utility.copyAmount(1, aInputs[0])}, + new ItemStack[] {tOutput}, + null, + null, + new FluidStack[] {tFluid}, + null, + Math.max(tFluid.amount / 64, 16), + 1, + 0); } if (rRecipe == null) { FluidStack tFluid = GT_Utility.getFluidForFilledItem(aInputs[0], true); if (tFluid != null) - rRecipe = new GT_Recipe(false, new ItemStack[]{GT_Utility.copyAmount(1, aInputs[0])}, new ItemStack[]{GT_Utility.getContainerItem(aInputs[0], true)}, null, null, null, new FluidStack[]{tFluid}, Math.max(tFluid.amount / 64, 16), 1, 0); + rRecipe = new GT_Recipe( + false, + new ItemStack[] {GT_Utility.copyAmount(1, aInputs[0])}, + new ItemStack[] {GT_Utility.getContainerItem(aInputs[0], true)}, + null, + null, + null, + new FluidStack[] {tFluid}, + Math.max(tFluid.amount / 64, 16), + 1, + 0); } if (rRecipe != null) rRecipe.mCanBeBuffered = false; return rRecipe; @@ -1519,7 +3402,10 @@ public class GT_Recipe implements Comparable<GT_Recipe> { @Override public boolean containsInput(ItemStack aStack) { - return aStack != null && (super.containsInput(aStack) || (aStack.getItem() instanceof IFluidContainerItem && ((IFluidContainerItem) aStack.getItem()).getCapacity(aStack) > 0)); + return aStack != null + && (super.containsInput(aStack) + || (aStack.getItem() instanceof IFluidContainerItem + && ((IFluidContainerItem) aStack.getItem()).getCapacity(aStack) > 0)); } @Override @@ -1537,15 +3423,64 @@ public class GT_Recipe implements Comparable<GT_Recipe> { * Special Class for Recycler Recipe handling. */ public static class GT_Recipe_Map_Recycler extends GT_Recipe_Map_NonGTRecipes { - public GT_Recipe_Map_Recycler(Collection<GT_Recipe> aRecipeList, String aUnlocalizedName, String aLocalName, String aNEIName, String aNEIGUIPath, int aUsualInputCount, int aUsualOutputCount, int aMinimalInputItems, int aMinimalInputFluids, int aAmperage, String aNEISpecialValuePre, int aNEISpecialValueMultiplier, String aNEISpecialValuePost, boolean aShowVoltageAmperageInNEI, boolean aNEIAllowed) { - super(aRecipeList, aUnlocalizedName, aLocalName, aNEIName, aNEIGUIPath, aUsualInputCount, aUsualOutputCount, aMinimalInputItems, aMinimalInputFluids, aAmperage, aNEISpecialValuePre, aNEISpecialValueMultiplier, aNEISpecialValuePost, aShowVoltageAmperageInNEI, aNEIAllowed); + public GT_Recipe_Map_Recycler( + Collection<GT_Recipe> aRecipeList, + String aUnlocalizedName, + String aLocalName, + String aNEIName, + String aNEIGUIPath, + int aUsualInputCount, + int aUsualOutputCount, + int aMinimalInputItems, + int aMinimalInputFluids, + int aAmperage, + String aNEISpecialValuePre, + int aNEISpecialValueMultiplier, + String aNEISpecialValuePost, + boolean aShowVoltageAmperageInNEI, + boolean aNEIAllowed) { + super( + aRecipeList, + aUnlocalizedName, + aLocalName, + aNEIName, + aNEIGUIPath, + aUsualInputCount, + aUsualOutputCount, + aMinimalInputItems, + aMinimalInputFluids, + aAmperage, + aNEISpecialValuePre, + aNEISpecialValueMultiplier, + aNEISpecialValuePost, + aShowVoltageAmperageInNEI, + aNEIAllowed); } @Override - public GT_Recipe findRecipe(IHasWorldObjectAndCoords aTileEntity, GT_Recipe aRecipe, boolean aNotUnificated, long aVoltage, FluidStack[] aFluids, ItemStack aSpecialSlot, ItemStack... aInputs) { + public GT_Recipe findRecipe( + IHasWorldObjectAndCoords aTileEntity, + GT_Recipe aRecipe, + boolean aNotUnificated, + long aVoltage, + FluidStack[] aFluids, + ItemStack aSpecialSlot, + ItemStack... aInputs) { if (aInputs == null || aInputs.length <= 0 || aInputs[0] == null) return null; if (aRecipe != null && aRecipe.isRecipeInputEqual(false, true, aFluids, aInputs)) return aRecipe; - return new GT_Recipe(false, new ItemStack[]{GT_Utility.copyAmount(1, aInputs[0])}, GT_ModHandler.getRecyclerOutput(GT_Utility.copyAmount(64, aInputs[0]), 0) == null ? null : new ItemStack[]{ItemList.IC2_Scrap.get(1)}, null, new int[]{1250}, null, null, 45, 1, 0); + return new GT_Recipe( + false, + new ItemStack[] {GT_Utility.copyAmount(1, aInputs[0])}, + GT_ModHandler.getRecyclerOutput(GT_Utility.copyAmount(64, aInputs[0]), 0) == null + ? null + : new ItemStack[] {ItemList.IC2_Scrap.get(1)}, + null, + new int[] {1250}, + null, + null, + 45, + 1, + 0); } @Override @@ -1558,22 +3493,87 @@ public class GT_Recipe implements Comparable<GT_Recipe> { * Special Class for Compressor Recipe handling. */ public static class GT_Recipe_Map_Compressor extends GT_Recipe_Map_NonGTRecipes { - public GT_Recipe_Map_Compressor(Collection<GT_Recipe> aRecipeList, String aUnlocalizedName, String aLocalName, String aNEIName, String aNEIGUIPath, int aUsualInputCount, int aUsualOutputCount, int aMinimalInputItems, int aMinimalInputFluids, int aAmperage, String aNEISpecialValuePre, int aNEISpecialValueMultiplier, String aNEISpecialValuePost, boolean aShowVoltageAmperageInNEI, boolean aNEIAllowed) { - super(aRecipeList, aUnlocalizedName, aLocalName, aNEIName, aNEIGUIPath, aUsualInputCount, aUsualOutputCount, aMinimalInputItems, aMinimalInputFluids, aAmperage, aNEISpecialValuePre, aNEISpecialValueMultiplier, aNEISpecialValuePost, aShowVoltageAmperageInNEI, aNEIAllowed); + public GT_Recipe_Map_Compressor( + Collection<GT_Recipe> aRecipeList, + String aUnlocalizedName, + String aLocalName, + String aNEIName, + String aNEIGUIPath, + int aUsualInputCount, + int aUsualOutputCount, + int aMinimalInputItems, + int aMinimalInputFluids, + int aAmperage, + String aNEISpecialValuePre, + int aNEISpecialValueMultiplier, + String aNEISpecialValuePost, + boolean aShowVoltageAmperageInNEI, + boolean aNEIAllowed) { + super( + aRecipeList, + aUnlocalizedName, + aLocalName, + aNEIName, + aNEIGUIPath, + aUsualInputCount, + aUsualOutputCount, + aMinimalInputItems, + aMinimalInputFluids, + aAmperage, + aNEISpecialValuePre, + aNEISpecialValueMultiplier, + aNEISpecialValuePost, + aShowVoltageAmperageInNEI, + aNEIAllowed); } @Override - public GT_Recipe findRecipe(IHasWorldObjectAndCoords aTileEntity, GT_Recipe aRecipe, boolean aNotUnificated, long aVoltage, FluidStack[] aFluids, ItemStack aSpecialSlot, ItemStack... aInputs) { + public GT_Recipe findRecipe( + IHasWorldObjectAndCoords aTileEntity, + GT_Recipe aRecipe, + boolean aNotUnificated, + long aVoltage, + FluidStack[] aFluids, + ItemStack aSpecialSlot, + ItemStack... aInputs) { if (aInputs == null || aInputs.length <= 0 || aInputs[0] == null) return null; if (aRecipe != null && aRecipe.isRecipeInputEqual(false, true, aFluids, aInputs)) return aRecipe; ItemStack tComparedInput = GT_Utility.copyOrNull(aInputs[0]); - ItemStack[] tOutputItems = GT_ModHandler.getMachineOutput(tComparedInput, ic2.api.recipe.Recipes.compressor.getRecipes(), true, new NBTTagCompound(), 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; + ItemStack[] tOutputItems = GT_ModHandler.getMachineOutput( + tComparedInput, + ic2.api.recipe.Recipes.compressor.getRecipes(), + true, + new NBTTagCompound(), + 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; } @Override public boolean containsInput(ItemStack aStack) { - return GT_Utility.arrayContainsNonNull(GT_ModHandler.getMachineOutput(GT_Utility.copyAmount(64, aStack), ic2.api.recipe.Recipes.compressor.getRecipes(), false, new NBTTagCompound(), null, null, null)); + return GT_Utility.arrayContainsNonNull(GT_ModHandler.getMachineOutput( + GT_Utility.copyAmount(64, aStack), + ic2.api.recipe.Recipes.compressor.getRecipes(), + false, + new NBTTagCompound(), + null, + null, + null)); } } @@ -1581,22 +3581,87 @@ public class GT_Recipe implements Comparable<GT_Recipe> { * Special Class for Extractor Recipe handling. */ public static class GT_Recipe_Map_Extractor extends GT_Recipe_Map_NonGTRecipes { - public GT_Recipe_Map_Extractor(Collection<GT_Recipe> aRecipeList, String aUnlocalizedName, String aLocalName, String aNEIName, String aNEIGUIPath, int aUsualInputCount, int aUsualOutputCount, int aMinimalInputItems, int aMinimalInputFluids, int aAmperage, String aNEISpecialValuePre, int aNEISpecialValueMultiplier, String aNEISpecialValuePost, boolean aShowVoltageAmperageInNEI, boolean aNEIAllowed) { - super(aRecipeList, aUnlocalizedName, aLocalName, aNEIName, aNEIGUIPath, aUsualInputCount, aUsualOutputCount, aMinimalInputItems, aMinimalInputFluids, aAmperage, aNEISpecialValuePre, aNEISpecialValueMultiplier, aNEISpecialValuePost, aShowVoltageAmperageInNEI, aNEIAllowed); + public GT_Recipe_Map_Extractor( + Collection<GT_Recipe> aRecipeList, + String aUnlocalizedName, + String aLocalName, + String aNEIName, + String aNEIGUIPath, + int aUsualInputCount, + int aUsualOutputCount, + int aMinimalInputItems, + int aMinimalInputFluids, + int aAmperage, + String aNEISpecialValuePre, + int aNEISpecialValueMultiplier, + String aNEISpecialValuePost, + boolean aShowVoltageAmperageInNEI, + boolean aNEIAllowed) { + super( + aRecipeList, + aUnlocalizedName, + aLocalName, + aNEIName, + aNEIGUIPath, + aUsualInputCount, + aUsualOutputCount, + aMinimalInputItems, + aMinimalInputFluids, + aAmperage, + aNEISpecialValuePre, + aNEISpecialValueMultiplier, + aNEISpecialValuePost, + aShowVoltageAmperageInNEI, + aNEIAllowed); } @Override - public GT_Recipe findRecipe(IHasWorldObjectAndCoords aTileEntity, GT_Recipe aRecipe, boolean aNotUnificated, long aVoltage, FluidStack[] aFluids, ItemStack aSpecialSlot, ItemStack... aInputs) { + public GT_Recipe findRecipe( + IHasWorldObjectAndCoords aTileEntity, + GT_Recipe aRecipe, + boolean aNotUnificated, + long aVoltage, + FluidStack[] aFluids, + ItemStack aSpecialSlot, + ItemStack... aInputs) { if (aInputs == null || aInputs.length <= 0 || aInputs[0] == null) return null; if (aRecipe != null && aRecipe.isRecipeInputEqual(false, true, aFluids, aInputs)) return aRecipe; ItemStack tComparedInput = GT_Utility.copyOrNull(aInputs[0]); - ItemStack[] tOutputItems = GT_ModHandler.getMachineOutput(tComparedInput, ic2.api.recipe.Recipes.extractor.getRecipes(), true, new NBTTagCompound(), 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; + ItemStack[] tOutputItems = GT_ModHandler.getMachineOutput( + tComparedInput, + ic2.api.recipe.Recipes.extractor.getRecipes(), + true, + new NBTTagCompound(), + 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; } @Override public boolean containsInput(ItemStack aStack) { - return GT_Utility.arrayContainsNonNull(GT_ModHandler.getMachineOutput(GT_Utility.copyAmount(64, aStack), ic2.api.recipe.Recipes.extractor.getRecipes(), false, new NBTTagCompound(), null, null, null)); + return GT_Utility.arrayContainsNonNull(GT_ModHandler.getMachineOutput( + GT_Utility.copyAmount(64, aStack), + ic2.api.recipe.Recipes.extractor.getRecipes(), + false, + new NBTTagCompound(), + null, + null, + null)); } } @@ -1604,22 +3669,87 @@ public class GT_Recipe implements Comparable<GT_Recipe> { * Special Class for Thermal Centrifuge Recipe handling. */ public static class GT_Recipe_Map_ThermalCentrifuge extends GT_Recipe_Map_NonGTRecipes { - public GT_Recipe_Map_ThermalCentrifuge(Collection<GT_Recipe> aRecipeList, String aUnlocalizedName, String aLocalName, String aNEIName, String aNEIGUIPath, int aUsualInputCount, int aUsualOutputCount, int aMinimalInputItems, int aMinimalInputFluids, int aAmperage, String aNEISpecialValuePre, int aNEISpecialValueMultiplier, String aNEISpecialValuePost, boolean aShowVoltageAmperageInNEI, boolean aNEIAllowed) { - super(aRecipeList, aUnlocalizedName, aLocalName, aNEIName, aNEIGUIPath, aUsualInputCount, aUsualOutputCount, aMinimalInputItems, aMinimalInputFluids, aAmperage, aNEISpecialValuePre, aNEISpecialValueMultiplier, aNEISpecialValuePost, aShowVoltageAmperageInNEI, aNEIAllowed); + public GT_Recipe_Map_ThermalCentrifuge( + Collection<GT_Recipe> aRecipeList, + String aUnlocalizedName, + String aLocalName, + String aNEIName, + String aNEIGUIPath, + int aUsualInputCount, + int aUsualOutputCount, + int aMinimalInputItems, + int aMinimalInputFluids, + int aAmperage, + String aNEISpecialValuePre, + int aNEISpecialValueMultiplier, + String aNEISpecialValuePost, + boolean aShowVoltageAmperageInNEI, + boolean aNEIAllowed) { + super( + aRecipeList, + aUnlocalizedName, + aLocalName, + aNEIName, + aNEIGUIPath, + aUsualInputCount, + aUsualOutputCount, + aMinimalInputItems, + aMinimalInputFluids, + aAmperage, + aNEISpecialValuePre, + aNEISpecialValueMultiplier, + aNEISpecialValuePost, + aShowVoltageAmperageInNEI, + aNEIAllowed); } @Override - public GT_Recipe findRecipe(IHasWorldObjectAndCoords aTileEntity, GT_Recipe aRecipe, boolean aNotUnificated, long aVoltage, FluidStack[] aFluids, ItemStack aSpecialSlot, ItemStack... aInputs) { + public GT_Recipe findRecipe( + IHasWorldObjectAndCoords aTileEntity, + GT_Recipe aRecipe, + boolean aNotUnificated, + long aVoltage, + FluidStack[] aFluids, + ItemStack aSpecialSlot, + ItemStack... aInputs) { if (aInputs == null || aInputs.length <= 0 || aInputs[0] == null) return null; if (aRecipe != null && aRecipe.isRecipeInputEqual(false, true, aFluids, aInputs)) return aRecipe; ItemStack tComparedInput = GT_Utility.copyOrNull(aInputs[0]); - ItemStack[] tOutputItems = GT_ModHandler.getMachineOutput(tComparedInput, ic2.api.recipe.Recipes.centrifuge.getRecipes(), true, new NBTTagCompound(), 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; + ItemStack[] tOutputItems = GT_ModHandler.getMachineOutput( + tComparedInput, + ic2.api.recipe.Recipes.centrifuge.getRecipes(), + true, + new NBTTagCompound(), + 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; } @Override public boolean containsInput(ItemStack aStack) { - return GT_Utility.arrayContainsNonNull(GT_ModHandler.getMachineOutput(GT_Utility.copyAmount(64, aStack), ic2.api.recipe.Recipes.centrifuge.getRecipes(), false, new NBTTagCompound(), null, null, null)); + return GT_Utility.arrayContainsNonNull(GT_ModHandler.getMachineOutput( + GT_Utility.copyAmount(64, aStack), + ic2.api.recipe.Recipes.centrifuge.getRecipes(), + false, + new NBTTagCompound(), + null, + null, + null)); } } @@ -1627,24 +3757,97 @@ public class GT_Recipe implements Comparable<GT_Recipe> { * Special Class for Ore Washer Recipe handling. */ public static class GT_Recipe_Map_OreWasher extends GT_Recipe_Map_NonGTRecipes { - public GT_Recipe_Map_OreWasher(Collection<GT_Recipe> aRecipeList, String aUnlocalizedName, String aLocalName, String aNEIName, String aNEIGUIPath, int aUsualInputCount, int aUsualOutputCount, int aMinimalInputItems, int aMinimalInputFluids, int aAmperage, String aNEISpecialValuePre, int aNEISpecialValueMultiplier, String aNEISpecialValuePost, boolean aShowVoltageAmperageInNEI, boolean aNEIAllowed) { - super(aRecipeList, aUnlocalizedName, aLocalName, aNEIName, aNEIGUIPath, aUsualInputCount, aUsualOutputCount, aMinimalInputItems, aMinimalInputFluids, aAmperage, aNEISpecialValuePre, aNEISpecialValueMultiplier, aNEISpecialValuePost, aShowVoltageAmperageInNEI, aNEIAllowed); + public GT_Recipe_Map_OreWasher( + Collection<GT_Recipe> aRecipeList, + String aUnlocalizedName, + String aLocalName, + String aNEIName, + String aNEIGUIPath, + int aUsualInputCount, + int aUsualOutputCount, + int aMinimalInputItems, + int aMinimalInputFluids, + int aAmperage, + String aNEISpecialValuePre, + int aNEISpecialValueMultiplier, + String aNEISpecialValuePost, + boolean aShowVoltageAmperageInNEI, + boolean aNEIAllowed) { + super( + aRecipeList, + aUnlocalizedName, + aLocalName, + aNEIName, + aNEIGUIPath, + aUsualInputCount, + aUsualOutputCount, + aMinimalInputItems, + aMinimalInputFluids, + aAmperage, + aNEISpecialValuePre, + aNEISpecialValueMultiplier, + aNEISpecialValuePost, + aShowVoltageAmperageInNEI, + aNEIAllowed); } @Override - public GT_Recipe findRecipe(IHasWorldObjectAndCoords aTileEntity, GT_Recipe aRecipe, boolean aNotUnificated, long aVoltage, FluidStack[] aFluids, ItemStack aSpecialSlot, ItemStack... aInputs) { - if (aInputs == null || aInputs.length <= 0 || aInputs[0] == null || aFluids == null || aFluids.length < 1 || !GT_ModHandler.isWater(aFluids[0])) - return null; + public GT_Recipe findRecipe( + IHasWorldObjectAndCoords aTileEntity, + GT_Recipe aRecipe, + boolean aNotUnificated, + long aVoltage, + FluidStack[] aFluids, + ItemStack aSpecialSlot, + ItemStack... aInputs) { + if (aInputs == null + || aInputs.length <= 0 + || aInputs[0] == null + || aFluids == null + || aFluids.length < 1 + || !GT_ModHandler.isWater(aFluids[0])) return null; if (aRecipe != null && aRecipe.isRecipeInputEqual(false, true, aFluids, aInputs)) return aRecipe; ItemStack tComparedInput = GT_Utility.copyOrNull(aInputs[0]); NBTTagCompound aRecipeMetaData = new NBTTagCompound(); - ItemStack[] tOutputItems = GT_ModHandler.getMachineOutput(tComparedInput, ic2.api.recipe.Recipes.oreWashing.getRecipes(), true, aRecipeMetaData, 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; + ItemStack[] tOutputItems = GT_ModHandler.getMachineOutput( + tComparedInput, + ic2.api.recipe.Recipes.oreWashing.getRecipes(), + true, + aRecipeMetaData, + 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; } @Override public boolean containsInput(ItemStack aStack) { - return GT_Utility.arrayContainsNonNull(GT_ModHandler.getMachineOutput(GT_Utility.copyAmount(64, aStack), ic2.api.recipe.Recipes.oreWashing.getRecipes(), false, new NBTTagCompound(), null, null, null)); + return GT_Utility.arrayContainsNonNull(GT_ModHandler.getMachineOutput( + GT_Utility.copyAmount(64, aStack), + ic2.api.recipe.Recipes.oreWashing.getRecipes(), + false, + new NBTTagCompound(), + null, + null, + null)); } @Override @@ -1662,37 +3865,117 @@ public class GT_Recipe implements Comparable<GT_Recipe> { * Special Class for Macerator/RockCrusher Recipe handling. */ public static class GT_Recipe_Map_Macerator extends GT_Recipe_Map { - public GT_Recipe_Map_Macerator(Collection<GT_Recipe> aRecipeList, String aUnlocalizedName, String aLocalName, String aNEIName, String aNEIGUIPath, int aUsualInputCount, int aUsualOutputCount, int aMinimalInputItems, int aMinimalInputFluids, int aAmperage, String aNEISpecialValuePre, int aNEISpecialValueMultiplier, String aNEISpecialValuePost, boolean aShowVoltageAmperageInNEI, boolean aNEIAllowed) { - super(aRecipeList, aUnlocalizedName, aLocalName, aNEIName, aNEIGUIPath, aUsualInputCount, aUsualOutputCount, aMinimalInputItems, aMinimalInputFluids, aAmperage, aNEISpecialValuePre, aNEISpecialValueMultiplier, aNEISpecialValuePost, aShowVoltageAmperageInNEI, aNEIAllowed); + public GT_Recipe_Map_Macerator( + Collection<GT_Recipe> aRecipeList, + String aUnlocalizedName, + String aLocalName, + String aNEIName, + String aNEIGUIPath, + int aUsualInputCount, + int aUsualOutputCount, + int aMinimalInputItems, + int aMinimalInputFluids, + int aAmperage, + String aNEISpecialValuePre, + int aNEISpecialValueMultiplier, + String aNEISpecialValuePost, + boolean aShowVoltageAmperageInNEI, + boolean aNEIAllowed) { + super( + aRecipeList, + aUnlocalizedName, + aLocalName, + aNEIName, + aNEIGUIPath, + aUsualInputCount, + aUsualOutputCount, + aMinimalInputItems, + aMinimalInputFluids, + aAmperage, + aNEISpecialValuePre, + aNEISpecialValueMultiplier, + aNEISpecialValuePost, + aShowVoltageAmperageInNEI, + aNEIAllowed); } @Override - public GT_Recipe findRecipe(IHasWorldObjectAndCoords aTileEntity, GT_Recipe aRecipe, boolean aNotUnificated, long aVoltage, FluidStack[] aFluids, ItemStack aSpecialSlot, ItemStack... aInputs) { + public GT_Recipe findRecipe( + IHasWorldObjectAndCoords aTileEntity, + GT_Recipe aRecipe, + boolean aNotUnificated, + long aVoltage, + FluidStack[] aFluids, + ItemStack aSpecialSlot, + ItemStack... aInputs) { if (aInputs == null || aInputs.length <= 0 || aInputs[0] == null || !GregTech_API.sPostloadFinished) return super.findRecipe(aTileEntity, aRecipe, aNotUnificated, aVoltage, aFluids, aSpecialSlot, aInputs); aRecipe = super.findRecipe(aTileEntity, aRecipe, aNotUnificated, aVoltage, aFluids, aSpecialSlot, aInputs); 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, new ItemStack[]{GT_Utility.copyAmount(1, aInputs[0])}, tRecipeOutputs.toArray(new ItemStack[0]), null, null, null, null, 800, 2, 0); + aRecipe = new GT_Recipe( + false, + new ItemStack[] {GT_Utility.copyAmount(1, aInputs[0])}, + tRecipeOutputs.toArray(new ItemStack[0]), + null, + null, + null, + null, + 800, + 2, + 0); aRecipe.mCanBeBuffered = false; aRecipe.mNeedsEmptyOutput = true; return aRecipe; } } catch (NoClassDefFoundError e) { if (D1) GT_Log.err.println("Railcraft Not loaded"); - } catch (NullPointerException e) {/**/} + } catch (NullPointerException e) { + /**/ + } ItemStack tComparedInput = GT_Utility.copyOrNull(aInputs[0]); - ItemStack[] tOutputItems = GT_ModHandler.getMachineOutput(tComparedInput, ic2.api.recipe.Recipes.macerator.getRecipes(), true, new NBTTagCompound(), 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; + ItemStack[] tOutputItems = GT_ModHandler.getMachineOutput( + tComparedInput, + ic2.api.recipe.Recipes.macerator.getRecipes(), + true, + new NBTTagCompound(), + 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; } @Override public boolean containsInput(ItemStack aStack) { - return super.containsInput(aStack) || GT_Utility.arrayContainsNonNull(GT_ModHandler.getMachineOutput(GT_Utility.copyAmount(64, aStack), ic2.api.recipe.Recipes.macerator.getRecipes(), false, new NBTTagCompound(), null, null, null)); + return super.containsInput(aStack) + || GT_Utility.arrayContainsNonNull(GT_ModHandler.getMachineOutput( + GT_Utility.copyAmount(64, aStack), + ic2.api.recipe.Recipes.macerator.getRecipes(), + false, + new NBTTagCompound(), + null, + null, + null)); } } @@ -1701,62 +3984,135 @@ public class GT_Recipe implements Comparable<GT_Recipe> { */ public static class GT_Recipe_Map_Assembler extends GT_Recipe_Map { - public GT_Recipe_Map_Assembler(Collection<GT_Recipe> aRecipeList, String aUnlocalizedName, String aLocalName, String aNEIName, String aNEIGUIPath, int aUsualInputCount, int aUsualOutputCount, int aMinimalInputItems, int aMinimalInputFluids, int aAmperage, String aNEISpecialValuePre, int aNEISpecialValueMultiplier, String aNEISpecialValuePost, boolean aShowVoltageAmperageInNEI, boolean aNEIAllowed, boolean aNEIUnificateOutput) { - super(aRecipeList, aUnlocalizedName, aLocalName, aNEIName, aNEIGUIPath, aUsualInputCount, aUsualOutputCount, aMinimalInputItems, aMinimalInputFluids, aAmperage, aNEISpecialValuePre, aNEISpecialValueMultiplier, aNEISpecialValuePost, aShowVoltageAmperageInNEI, aNEIAllowed, aNEIUnificateOutput); - } - - public GT_Recipe_Map_Assembler(Collection<GT_Recipe> aRecipeList, String aUnlocalizedName, String aLocalName, String aNEIName, String aNEIGUIPath, int aUsualInputCount, int aUsualOutputCount, int aMinimalInputItems, int aMinimalInputFluids, int aAmperage, String aNEISpecialValuePre, int aNEISpecialValueMultiplier, String aNEISpecialValuePost, boolean aShowVoltageAmperageInNEI, boolean aNEIAllowed) { - this(aRecipeList, aUnlocalizedName, aLocalName, aNEIName, aNEIGUIPath, aUsualInputCount, aUsualOutputCount, aMinimalInputItems, aMinimalInputFluids, aAmperage, aNEISpecialValuePre, aNEISpecialValueMultiplier, aNEISpecialValuePost, aShowVoltageAmperageInNEI, aNEIAllowed, true); + public GT_Recipe_Map_Assembler( + Collection<GT_Recipe> aRecipeList, + String aUnlocalizedName, + String aLocalName, + String aNEIName, + String aNEIGUIPath, + int aUsualInputCount, + int aUsualOutputCount, + int aMinimalInputItems, + int aMinimalInputFluids, + int aAmperage, + String aNEISpecialValuePre, + int aNEISpecialValueMultiplier, + String aNEISpecialValuePost, + boolean aShowVoltageAmperageInNEI, + boolean aNEIAllowed, + boolean aNEIUnificateOutput) { + super( + aRecipeList, + aUnlocalizedName, + aLocalName, + aNEIName, + aNEIGUIPath, + aUsualInputCount, + aUsualOutputCount, + aMinimalInputItems, + aMinimalInputFluids, + aAmperage, + aNEISpecialValuePre, + aNEISpecialValueMultiplier, + aNEISpecialValuePost, + aShowVoltageAmperageInNEI, + aNEIAllowed, + aNEIUnificateOutput); + } + + public GT_Recipe_Map_Assembler( + Collection<GT_Recipe> aRecipeList, + String aUnlocalizedName, + String aLocalName, + String aNEIName, + String aNEIGUIPath, + int aUsualInputCount, + int aUsualOutputCount, + int aMinimalInputItems, + int aMinimalInputFluids, + int aAmperage, + String aNEISpecialValuePre, + int aNEISpecialValueMultiplier, + String aNEISpecialValuePost, + boolean aShowVoltageAmperageInNEI, + boolean aNEIAllowed) { + this( + aRecipeList, + aUnlocalizedName, + aLocalName, + aNEIName, + aNEIGUIPath, + aUsualInputCount, + aUsualOutputCount, + aMinimalInputItems, + aMinimalInputFluids, + aAmperage, + aNEISpecialValuePre, + aNEISpecialValueMultiplier, + aNEISpecialValuePost, + aShowVoltageAmperageInNEI, + aNEIAllowed, + true); } @Override - public GT_Recipe findRecipe(IHasWorldObjectAndCoords aTileEntity, GT_Recipe aRecipe, boolean aNotUnificated, long aVoltage, FluidStack[] aFluids, ItemStack aSpecialSlot, ItemStack... aInputs) { + public GT_Recipe findRecipe( + IHasWorldObjectAndCoords aTileEntity, + GT_Recipe aRecipe, + boolean aNotUnificated, + long aVoltage, + FluidStack[] aFluids, + ItemStack aSpecialSlot, + ItemStack... aInputs) { GT_Recipe rRecipe = super.findRecipe(aTileEntity, aRecipe, true, aVoltage, aFluids, aSpecialSlot, aInputs); -/* + /* - Doesnt work, keep it as a reminder tho + Doesnt work, keep it as a reminder tho - if (rRecipe == null){ - Set<ItemStack> aInputs2 = new TreeSet<ItemStack>(); - for (ItemStack aInput : aInputs) { - aInputs2.add(aInput); - } + if (rRecipe == null){ + Set<ItemStack> aInputs2 = new TreeSet<ItemStack>(); + for (ItemStack aInput : aInputs) { + aInputs2.add(aInput); + } - for (ItemStack aInput : aInputs) { - aInputs2.remove(aInput); - int[] oredictIDs = OreDictionary.getOreIDs(aInput); - if ( oredictIDs.length > 1){ - for (final int i : oredictIDs){ - final ItemStack[] oredictIS = (ItemStack[]) OreDictionary.getOres(OreDictionary.getOreName(i)).toArray(); - if (oredictIS != null && oredictIS.length > 1){ - for (final ItemStack IS : oredictIS){ - aInputs2.add(IS); - ItemStack[] temp = (ItemStack[]) aInputs2.toArray(); - rRecipe = super.findRecipe(aTileEntity, aRecipe, aNotUnificated, aVoltage, aFluids, aSpecialSlot,temp); - if(rRecipe!= null){ - break; + for (ItemStack aInput : aInputs) { + aInputs2.remove(aInput); + int[] oredictIDs = OreDictionary.getOreIDs(aInput); + if ( oredictIDs.length > 1){ + for (final int i : oredictIDs){ + final ItemStack[] oredictIS = (ItemStack[]) OreDictionary.getOres(OreDictionary.getOreName(i)).toArray(); + if (oredictIS != null && oredictIS.length > 1){ + for (final ItemStack IS : oredictIS){ + aInputs2.add(IS); + ItemStack[] temp = (ItemStack[]) aInputs2.toArray(); + rRecipe = super.findRecipe(aTileEntity, aRecipe, aNotUnificated, aVoltage, aFluids, aSpecialSlot,temp); + if(rRecipe!= null){ + break; + } + else { + aInputs2.remove(IS); + } + } + if(rRecipe!= null) + break; + } } - else { - aInputs2.remove(IS); - } - } + if(rRecipe!= null) + break; + }else + aInputs2.add(aInput); if(rRecipe!= null) - break; + break; } } - if(rRecipe!= null) - break; - }else - aInputs2.add(aInput); - if(rRecipe!= null) - break; - } - } -*/ - if (aInputs == null || aInputs.length <= 0 || aInputs[0] == null || rRecipe == null || !GregTech_API.sPostloadFinished) - return rRecipe; + */ + if (aInputs == null + || aInputs.length <= 0 + || aInputs[0] == null + || rRecipe == null + || !GregTech_API.sPostloadFinished) return rRecipe; for (ItemStack aInput : aInputs) { if (ItemList.Paper_Printed_Pages.isStackEqual(aInput, false, true)) { @@ -1764,28 +4120,74 @@ public class GT_Recipe implements Comparable<GT_Recipe> { rRecipe.mCanBeBuffered = false; rRecipe.mOutputs[0].setTagCompound(aInput.getTagCompound()); } - } return rRecipe; } - } /** * Special Class for Forming Press handling. */ public static class GT_Recipe_Map_FormingPress extends GT_Recipe_Map { - public GT_Recipe_Map_FormingPress(Collection<GT_Recipe> aRecipeList, String aUnlocalizedName, String aLocalName, String aNEIName, String aNEIGUIPath, int aUsualInputCount, int aUsualOutputCount, int aMinimalInputItems, int aMinimalInputFluids, int aAmperage, String aNEISpecialValuePre, int aNEISpecialValueMultiplier, String aNEISpecialValuePost, boolean aShowVoltageAmperageInNEI, boolean aNEIAllowed) { - super(aRecipeList, aUnlocalizedName, aLocalName, aNEIName, aNEIGUIPath, aUsualInputCount, aUsualOutputCount, aMinimalInputItems, aMinimalInputFluids, aAmperage, aNEISpecialValuePre, aNEISpecialValueMultiplier, aNEISpecialValuePost, aShowVoltageAmperageInNEI, aNEIAllowed); + public GT_Recipe_Map_FormingPress( + Collection<GT_Recipe> aRecipeList, + String aUnlocalizedName, + String aLocalName, + String aNEIName, + String aNEIGUIPath, + int aUsualInputCount, + int aUsualOutputCount, + int aMinimalInputItems, + int aMinimalInputFluids, + int aAmperage, + String aNEISpecialValuePre, + int aNEISpecialValueMultiplier, + String aNEISpecialValuePost, + boolean aShowVoltageAmperageInNEI, + boolean aNEIAllowed) { + super( + aRecipeList, + aUnlocalizedName, + aLocalName, + aNEIName, + aNEIGUIPath, + aUsualInputCount, + aUsualOutputCount, + aMinimalInputItems, + aMinimalInputFluids, + aAmperage, + aNEISpecialValuePre, + aNEISpecialValueMultiplier, + aNEISpecialValuePost, + aShowVoltageAmperageInNEI, + aNEIAllowed); } @Override - public GT_Recipe findRecipe(IHasWorldObjectAndCoords aTileEntity, GT_Recipe aRecipe, boolean aNotUnificated, boolean aDontCheckStackSizes, long aVoltage, FluidStack[] aFluids, ItemStack aSpecialSlot, ItemStack... aInputs) { - GT_Recipe rRecipe = super.findRecipe(aTileEntity, aRecipe, aNotUnificated, aDontCheckStackSizes, aVoltage, aFluids, aSpecialSlot, aInputs); - if (aInputs == null || aInputs.length < 2 || aInputs[0] == null || aInputs[1] == null || !GregTech_API.sPostloadFinished) - return rRecipe; - if (rRecipe == null) - return findRenamingRecipe(aInputs); + public GT_Recipe findRecipe( + IHasWorldObjectAndCoords aTileEntity, + GT_Recipe aRecipe, + boolean aNotUnificated, + boolean aDontCheckStackSizes, + long aVoltage, + FluidStack[] aFluids, + ItemStack aSpecialSlot, + ItemStack... aInputs) { + GT_Recipe rRecipe = super.findRecipe( + aTileEntity, + aRecipe, + aNotUnificated, + aDontCheckStackSizes, + aVoltage, + aFluids, + aSpecialSlot, + aInputs); + if (aInputs == null + || aInputs.length < 2 + || aInputs[0] == null + || aInputs[1] == null + || !GregTech_API.sPostloadFinished) return rRecipe; + if (rRecipe == null) return findRenamingRecipe(aInputs); for (ItemStack aMold : aInputs) { if (ItemList.Shape_Mold_Credit.isStackEqual(aMold, false, true)) { NBTTagCompound tNBT = aMold.getTagCompound(); @@ -1803,17 +4205,15 @@ public class GT_Recipe implements Comparable<GT_Recipe> { } private ItemStack findNameMoldIndex(ItemStack[] inputs) { - for (ItemStack stack: inputs) { - if (ItemList.Shape_Mold_Name.isStackEqual(stack, false, true)) - return stack; + for (ItemStack stack : inputs) { + if (ItemList.Shape_Mold_Name.isStackEqual(stack, false, true)) return stack; } return null; } private ItemStack findStackToRename(ItemStack[] inputs, ItemStack mold) { - for (ItemStack stack: inputs) { - if (stack == mold || stack == null) - continue; + for (ItemStack stack : inputs) { + if (stack == mold || stack == null) continue; return stack; } return null; @@ -1821,17 +4221,22 @@ public class GT_Recipe implements Comparable<GT_Recipe> { private GT_Recipe findRenamingRecipe(ItemStack[] inputs) { ItemStack mold = findNameMoldIndex(inputs); - if (mold == null) - return null; + if (mold == null) return null; ItemStack input = findStackToRename(inputs, mold); - if (input == null) - return null; + if (input == null) return null; ItemStack output = GT_Utility.copyAmount(1, input); output.setStackDisplayName(mold.getDisplayName()); - GT_Recipe recipe = new GT_Recipe(false, - new ItemStack[]{ ItemList.Shape_Mold_Name.get(0), GT_Utility.copyAmount(1, input) }, - new ItemStack[]{ output }, - null, null, null, null, 128, 8, 0); + GT_Recipe recipe = new GT_Recipe( + false, + new ItemStack[] {ItemList.Shape_Mold_Name.get(0), GT_Utility.copyAmount(1, input)}, + new ItemStack[] {output}, + null, + null, + null, + null, + 128, + 8, + 0); recipe.mCanBeBuffered = false; return recipe; } @@ -1841,15 +4246,58 @@ public class GT_Recipe implements Comparable<GT_Recipe> { * Special Class for Printer handling. */ public static class GT_Recipe_Map_Printer extends GT_Recipe_Map { - public GT_Recipe_Map_Printer(Collection<GT_Recipe> aRecipeList, String aUnlocalizedName, String aLocalName, String aNEIName, String aNEIGUIPath, int aUsualInputCount, int aUsualOutputCount, int aMinimalInputItems, int aMinimalInputFluids, int aAmperage, String aNEISpecialValuePre, int aNEISpecialValueMultiplier, String aNEISpecialValuePost, boolean aShowVoltageAmperageInNEI, boolean aNEIAllowed) { - super(aRecipeList, aUnlocalizedName, aLocalName, aNEIName, aNEIGUIPath, aUsualInputCount, aUsualOutputCount, aMinimalInputItems, aMinimalInputFluids, aAmperage, aNEISpecialValuePre, aNEISpecialValueMultiplier, aNEISpecialValuePost, aShowVoltageAmperageInNEI, aNEIAllowed); + public GT_Recipe_Map_Printer( + Collection<GT_Recipe> aRecipeList, + String aUnlocalizedName, + String aLocalName, + String aNEIName, + String aNEIGUIPath, + int aUsualInputCount, + int aUsualOutputCount, + int aMinimalInputItems, + int aMinimalInputFluids, + int aAmperage, + String aNEISpecialValuePre, + int aNEISpecialValueMultiplier, + String aNEISpecialValuePost, + boolean aShowVoltageAmperageInNEI, + boolean aNEIAllowed) { + super( + aRecipeList, + aUnlocalizedName, + aLocalName, + aNEIName, + aNEIGUIPath, + aUsualInputCount, + aUsualOutputCount, + aMinimalInputItems, + aMinimalInputFluids, + aAmperage, + aNEISpecialValuePre, + aNEISpecialValueMultiplier, + aNEISpecialValuePost, + aShowVoltageAmperageInNEI, + aNEIAllowed); } @Override - public GT_Recipe findRecipe(IHasWorldObjectAndCoords aTileEntity, GT_Recipe aRecipe, boolean aNotUnificated, long aVoltage, FluidStack[] aFluids, ItemStack aSpecialSlot, ItemStack... aInputs) { - GT_Recipe rRecipe = super.findRecipe(aTileEntity, aRecipe, aNotUnificated, aVoltage, aFluids, aSpecialSlot, aInputs); - if (aInputs == null || aInputs.length <= 0 || aInputs[0] == null || aFluids == null || aFluids.length <= 0 || aFluids[0] == null || !GregTech_API.sPostloadFinished) - return rRecipe; + public GT_Recipe findRecipe( + IHasWorldObjectAndCoords aTileEntity, + GT_Recipe aRecipe, + boolean aNotUnificated, + long aVoltage, + FluidStack[] aFluids, + ItemStack aSpecialSlot, + ItemStack... aInputs) { + GT_Recipe rRecipe = + super.findRecipe(aTileEntity, aRecipe, aNotUnificated, aVoltage, aFluids, aSpecialSlot, aInputs); + if (aInputs == null + || aInputs.length <= 0 + || aInputs[0] == null + || aFluids == null + || aFluids.length <= 0 + || aFluids[0] == null + || !GregTech_API.sPostloadFinished) return rRecipe; Dyes aDye = null; for (Dyes tDye : Dyes.VALUES) @@ -1861,20 +4309,61 @@ public class GT_Recipe implements Comparable<GT_Recipe> { if (aDye == null) return rRecipe; if (rRecipe == null) { - ItemStack - tOutput = GT_ModHandler.getAllRecipeOutput(aTileEntity == null ? null : aTileEntity.getWorld(), aInputs[0], aInputs[0], aInputs[0], aInputs[0], ItemList.DYE_ONLY_ITEMS[aDye.mIndex].get(1), aInputs[0], aInputs[0], aInputs[0], aInputs[0]); + ItemStack tOutput = GT_ModHandler.getAllRecipeOutput( + aTileEntity == null ? null : aTileEntity.getWorld(), + aInputs[0], + aInputs[0], + aInputs[0], + aInputs[0], + ItemList.DYE_ONLY_ITEMS[aDye.mIndex].get(1), + aInputs[0], + aInputs[0], + aInputs[0], + aInputs[0]); if (tOutput != null) - return addRecipe(new GT_Recipe(true, new ItemStack[]{GT_Utility.copyAmount(8, aInputs[0])}, new ItemStack[]{tOutput}, null, null, new FluidStack[]{new FluidStack(aFluids[0].getFluid(), (int) L)}, null, 256, 2, 0), false, false, true); - - tOutput = GT_ModHandler.getAllRecipeOutput(aTileEntity == null ? null : aTileEntity.getWorld(), aInputs[0], ItemList.DYE_ONLY_ITEMS[aDye.mIndex].get(1)); + return addRecipe( + new GT_Recipe( + true, + new ItemStack[] {GT_Utility.copyAmount(8, aInputs[0])}, + new ItemStack[] {tOutput}, + null, + null, + new FluidStack[] {new FluidStack(aFluids[0].getFluid(), (int) L)}, + null, + 256, + 2, + 0), + false, + false, + true); + + tOutput = GT_ModHandler.getAllRecipeOutput( + aTileEntity == null ? null : aTileEntity.getWorld(), + aInputs[0], + ItemList.DYE_ONLY_ITEMS[aDye.mIndex].get(1)); if (tOutput != null) - return addRecipe(new GT_Recipe(true, new ItemStack[]{GT_Utility.copyAmount(1, aInputs[0])}, new ItemStack[]{tOutput}, null, null, new FluidStack[]{new FluidStack(aFluids[0].getFluid(), (int) L)}, null, 32, 2, 0), false, false, true); + return addRecipe( + new GT_Recipe( + true, + new ItemStack[] {GT_Utility.copyAmount(1, aInputs[0])}, + new ItemStack[] {tOutput}, + null, + null, + new FluidStack[] {new FluidStack(aFluids[0].getFluid(), (int) L)}, + null, + 32, + 2, + 0), + false, + false, + true); } else { if (aInputs[0].getItem() == Items.paper) { if (!ItemList.Tool_DataStick.isStackEqual(aSpecialSlot, false, true)) return null; NBTTagCompound tNBT = aSpecialSlot.getTagCompound(); - if (tNBT == null || GT_Utility.isStringInvalid(tNBT.getString("title")) || GT_Utility.isStringInvalid(tNBT.getString("author"))) - return null; + if (tNBT == null + || GT_Utility.isStringInvalid(tNBT.getString("title")) + || GT_Utility.isStringInvalid(tNBT.getString("author"))) return null; rRecipe = rRecipe.copy(); rRecipe.mCanBeBuffered = false; @@ -1898,7 +4387,8 @@ public class GT_Recipe implements Comparable<GT_Recipe> { rRecipe = rRecipe.copy(); rRecipe.mCanBeBuffered = false; - rRecipe.mOutputs[0].setTagCompound(GT_Utility.getNBTContainingString(new NBTTagCompound(), "GT.PunchCardData", tNBT.getString("GT.PunchCardData"))); + rRecipe.mOutputs[0].setTagCompound(GT_Utility.getNBTContainingString( + new NBTTagCompound(), "GT.PunchCardData", tNBT.getString("GT.PunchCardData"))); return rRecipe; } } @@ -1923,33 +4413,54 @@ public class GT_Recipe implements Comparable<GT_Recipe> { public static class GT_Recipe_Map_LargeBoilerFakeFuels extends GT_Recipe_Map { - private static final List<String> ALLOWED_SOLID_FUELS = Arrays.asList(GregTech_API.sMachineFile.mConfig.getStringList( - "LargeBoiler.allowedFuels", - ConfigCategories.machineconfig.toString(), - new String[] {"gregtech:gt.blockreinforced:6", "gregtech:gt.blockreinforced:7"}, - "Allowed fuels for the Large Titanium Boiler and Large Tungstensteel Boiler")); + private static final List<String> ALLOWED_SOLID_FUELS = + Arrays.asList(GregTech_API.sMachineFile.mConfig.getStringList( + "LargeBoiler.allowedFuels", + ConfigCategories.machineconfig.toString(), + new String[] {"gregtech:gt.blockreinforced:6", "gregtech:gt.blockreinforced:7"}, + "Allowed fuels for the Large Titanium Boiler and Large Tungstensteel Boiler")); public GT_Recipe_Map_LargeBoilerFakeFuels() { - super(new HashSet<>(55), "gt.recipe.largeboilerfakefuels", "Large Boiler", null, RES_PATH_GUI + "basicmachines/Default", 1, 0, 1, 0, 1, E, 1, E, true, true); - GT_Recipe explanatoryRecipe = new GT_Recipe(true, new ItemStack[]{}, new ItemStack[]{}, null, null, null, null, 1, 1, 1); - explanatoryRecipe.setNeiDesc("Not all solid fuels are listed.", "Any item that burns in a", "vanilla furnace will burn in", "a Large Bronze or Steel Boiler."); + super( + new HashSet<>(55), + "gt.recipe.largeboilerfakefuels", + "Large Boiler", + null, + RES_PATH_GUI + "basicmachines/Default", + 1, + 0, + 1, + 0, + 1, + E, + 1, + E, + true, + true); + GT_Recipe explanatoryRecipe = + new GT_Recipe(true, new ItemStack[] {}, new ItemStack[] {}, null, null, null, null, 1, 1, 1); + explanatoryRecipe.setNeiDesc( + "Not all solid fuels are listed.", + "Any item that burns in a", + "vanilla furnace will burn in", + "a Large Bronze or Steel Boiler."); addRecipe(explanatoryRecipe); } public static boolean isAllowedSolidFuel(ItemStack stack) { - return isAllowedSolidFuel(Item.itemRegistry.getNameForObject(stack.getItem()), stack.getItemDamage()); + return isAllowedSolidFuel(Item.itemRegistry.getNameForObject(stack.getItem()), stack.getItemDamage()); } public static boolean isAllowedSolidFuel(String itemRegistryName, int meta) { - return ALLOWED_SOLID_FUELS.contains(itemRegistryName + ":" + meta); + return ALLOWED_SOLID_FUELS.contains(itemRegistryName + ":" + meta); } public static boolean addAllowedSolidFuel(ItemStack stack) { - return addAllowedSolidFuel(Item.itemRegistry.getNameForObject(stack.getItem()), stack.getItemDamage()); + return addAllowedSolidFuel(Item.itemRegistry.getNameForObject(stack.getItem()), stack.getItemDamage()); } public static boolean addAllowedSolidFuel(String itemregistryName, int meta) { - return ALLOWED_SOLID_FUELS.add(itemregistryName + ":" + meta); + return ALLOWED_SOLID_FUELS.add(itemregistryName + ":" + meta); } public GT_Recipe addDenseLiquidRecipe(GT_Recipe recipe) { @@ -1969,48 +4480,61 @@ public class GT_Recipe implements Comparable<GT_Recipe> { public GT_Recipe addSolidRecipe(ItemStack fuelItemStack) { boolean allowedFuel = false; if (fuelItemStack != null) { - String registryName = Item.itemRegistry.getNameForObject(fuelItemStack.getItem()); - allowedFuel = ALLOWED_SOLID_FUELS.contains(registryName + ":" + fuelItemStack.getItemDamage()); + String registryName = Item.itemRegistry.getNameForObject(fuelItemStack.getItem()); + allowedFuel = ALLOWED_SOLID_FUELS.contains(registryName + ":" + fuelItemStack.getItemDamage()); } - return addRecipe(new GT_Recipe(true, new ItemStack[]{fuelItemStack}, new ItemStack[]{}, null, null, null, null, 1, 0, GT_ModHandler.getFuelValue(fuelItemStack) / 1600), ((double) GT_ModHandler.getFuelValue(fuelItemStack)) / 1600, allowedFuel); + return addRecipe( + new GT_Recipe( + true, + new ItemStack[] {fuelItemStack}, + new ItemStack[] {}, + null, + null, + null, + null, + 1, + 0, + GT_ModHandler.getFuelValue(fuelItemStack) / 1600), + ((double) GT_ModHandler.getFuelValue(fuelItemStack)) / 1600, + allowedFuel); } private GT_Recipe addRecipe(GT_Recipe recipe, double baseBurnTime, boolean isAllowedFuel) { - recipe = new GT_Recipe(recipe); - //Some recipes will have a burn time like 15.9999999 and % always rounds down - double floatErrorCorrection = 0.0001; - - double bronzeBurnTime = baseBurnTime * 2 + floatErrorCorrection; - bronzeBurnTime -= bronzeBurnTime % 0.05; - double steelBurnTime = baseBurnTime + floatErrorCorrection; - steelBurnTime -= steelBurnTime % 0.05; - double titaniumBurnTime = baseBurnTime * 0.3 + floatErrorCorrection; - titaniumBurnTime -= titaniumBurnTime % 0.05; - double tungstensteelBurnTime = baseBurnTime * 0.15 + floatErrorCorrection; - tungstensteelBurnTime -= tungstensteelBurnTime % 0.05; + recipe = new GT_Recipe(recipe); + // Some recipes will have a burn time like 15.9999999 and % always rounds down + double floatErrorCorrection = 0.0001; + + double bronzeBurnTime = baseBurnTime * 2 + floatErrorCorrection; + bronzeBurnTime -= bronzeBurnTime % 0.05; + double steelBurnTime = baseBurnTime + floatErrorCorrection; + steelBurnTime -= steelBurnTime % 0.05; + double titaniumBurnTime = baseBurnTime * 0.3 + floatErrorCorrection; + titaniumBurnTime -= titaniumBurnTime % 0.05; + double tungstensteelBurnTime = baseBurnTime * 0.15 + floatErrorCorrection; + tungstensteelBurnTime -= tungstensteelBurnTime % 0.05; if (isAllowedFuel) { - recipe.setNeiDesc("Burn time in seconds:", + recipe.setNeiDesc( + "Burn time in seconds:", String.format("Bronze Boiler: %.4f", bronzeBurnTime), String.format("Steel Boiler: %.4f", steelBurnTime), String.format("Titanium Boiler: %.4f", titaniumBurnTime), String.format("Tungstensteel Boiler: %.4f", tungstensteelBurnTime)); - } - - else { - recipe.setNeiDesc("Burn time in seconds:", + } else { + recipe.setNeiDesc( + "Burn time in seconds:", String.format("Bronze Boiler: %.4f", bronzeBurnTime), String.format("Steel Boiler: %.4f", steelBurnTime), "Titanium Boiler: Not allowed", "Tungstenst. Boiler: Not allowed"); } - return super.addRecipe(recipe); - } + return super.addRecipe(recipe); + } private GT_Recipe addRecipe(GT_Recipe recipe, double baseBurnTime) { recipe = new GT_Recipe(recipe); - //Some recipes will have a burn time like 15.9999999 and % always rounds down + // Some recipes will have a burn time like 15.9999999 and % always rounds down double floatErrorCorrection = 0.0001; double bronzeBurnTime = baseBurnTime * 2 + floatErrorCorrection; @@ -2018,7 +4542,8 @@ public class GT_Recipe implements Comparable<GT_Recipe> { double steelBurnTime = baseBurnTime + floatErrorCorrection; steelBurnTime -= steelBurnTime % 0.05; - recipe.setNeiDesc("Burn time in seconds:", + recipe.setNeiDesc( + "Burn time in seconds:", String.format("Bronze Boiler: %.4f", bronzeBurnTime), String.format("Steel Boiler: %.4f", steelBurnTime), "Titanium Boiler: Not allowed", @@ -2026,7 +4551,6 @@ public class GT_Recipe implements Comparable<GT_Recipe> { return super.addRecipe(recipe); } - } public static class GT_Recipe_Map_LargeChemicalReactor extends GT_Recipe_Map { @@ -2035,11 +4559,36 @@ public class GT_Recipe implements Comparable<GT_Recipe> { private static final int FLUID_OUTPUT_COUNT = 6; public GT_Recipe_Map_LargeChemicalReactor() { - super(new HashSet<>(1000), "gt.recipe.largechemicalreactor", "Large Chemical Reactor", null, RES_PATH_GUI + "basicmachines/LCRNEI", 2, OUTPUT_COUNT, 0, 0, 1, E, 1, E, true, true); + super( + new HashSet<>(1000), + "gt.recipe.largechemicalreactor", + "Large Chemical Reactor", + null, + RES_PATH_GUI + "basicmachines/LCRNEI", + 2, + OUTPUT_COUNT, + 0, + 0, + 1, + E, + 1, + E, + true, + true); } @Override - public GT_Recipe addRecipe(boolean aOptimize, ItemStack[] aInputs, ItemStack[] aOutputs, Object aSpecial, int[] aOutputChances, FluidStack[] aFluidInputs, FluidStack[] aFluidOutputs, int aDuration, int aEUt, int aSpecialValue) { + public GT_Recipe addRecipe( + boolean aOptimize, + ItemStack[] aInputs, + ItemStack[] aOutputs, + Object aSpecial, + int[] aOutputChances, + FluidStack[] aFluidInputs, + FluidStack[] aFluidOutputs, + int aDuration, + int aEUt, + int aSpecialValue) { aOptimize = false; ArrayList<ItemStack> adjustedInputs = new ArrayList<>(); ArrayList<ItemStack> adjustedOutputs = new ArrayList<>(); @@ -2055,23 +4604,27 @@ public class GT_Recipe implements Comparable<GT_Recipe> { for (ItemStack input : aInputs) { FluidStack inputFluidContent = FluidContainerRegistry.getFluidForFilledItem(input); if (inputFluidContent != null) { - inputFluidContent.amount *= input.stackSize; + inputFluidContent.amount *= input.stackSize; if (inputFluidContent.getFluid().getName().equals("ic2steam")) { inputFluidContent = GT_ModHandler.getSteam(inputFluidContent.amount); } - adjustedFluidInputs.add(inputFluidContent); - } else { - ItemData itemData = GT_OreDictUnificator.getItemData(input); - if (itemData != null && itemData.hasValidPrefixMaterialData() && itemData.mMaterial.mMaterial == Materials.Empty) { - continue; - } else { - if (itemData != null && itemData.hasValidPrefixMaterialData() && itemData.mPrefix == OrePrefixes.cell) { - ItemStack dustStack = itemData.mMaterial.mMaterial.getDust(input.stackSize); - if (dustStack != null) { - adjustedInputs.add(dustStack); - } else { - adjustedInputs.add(input); - } + adjustedFluidInputs.add(inputFluidContent); + } else { + ItemData itemData = GT_OreDictUnificator.getItemData(input); + if (itemData != null + && itemData.hasValidPrefixMaterialData() + && itemData.mMaterial.mMaterial == Materials.Empty) { + continue; + } else { + if (itemData != null + && itemData.hasValidPrefixMaterialData() + && itemData.mPrefix == OrePrefixes.cell) { + ItemStack dustStack = itemData.mMaterial.mMaterial.getDust(input.stackSize); + if (dustStack != null) { + adjustedInputs.add(dustStack); + } else { + adjustedInputs.add(input); + } } else { adjustedInputs.add(input); } @@ -2095,14 +4648,16 @@ public class GT_Recipe implements Comparable<GT_Recipe> { for (ItemStack output : aOutputs) { FluidStack outputFluidContent = FluidContainerRegistry.getFluidForFilledItem(output); if (outputFluidContent != null) { - outputFluidContent.amount *= output.stackSize; + outputFluidContent.amount *= output.stackSize; if (outputFluidContent.getFluid().getName().equals("ic2steam")) { outputFluidContent = GT_ModHandler.getSteam(outputFluidContent.amount); } - adjustedFluidOutputs.add(outputFluidContent); + adjustedFluidOutputs.add(outputFluidContent); } else { ItemData itemData = GT_OreDictUnificator.getItemData(output); - if (!(itemData != null && itemData.hasValidPrefixMaterialData() && itemData.mMaterial.mMaterial == Materials.Empty)) { + if (!(itemData != null + && itemData.hasValidPrefixMaterialData() + && itemData.mMaterial.mMaterial == Materials.Empty)) { adjustedOutputs.add(output); } } @@ -2114,7 +4669,17 @@ public class GT_Recipe implements Comparable<GT_Recipe> { aOutputs = adjustedOutputs.toArray(new ItemStack[0]); aFluidOutputs = adjustedFluidOutputs.toArray(new FluidStack[0]); - return super.addRecipe(aOptimize, aInputs, aOutputs, aSpecial, aOutputChances, aFluidInputs, aFluidOutputs, aDuration, aEUt, aSpecialValue); + return super.addRecipe( + aOptimize, + aInputs, + aOutputs, + aSpecial, + aOutputChances, + aFluidInputs, + aFluidOutputs, + aDuration, + aEUt, + aSpecialValue); } @Override @@ -2129,32 +4694,37 @@ public class GT_Recipe implements Comparable<GT_Recipe> { for (int i = 0; i < itemLimit; i++, j++) { if (recipe.mInputs == null || (recipe.mInputs[i] == null && (i == 0 && itemLimit == 1))) { if (recipe.mOutputs != null && recipe.mOutputs.length > 0 && recipe.mOutputs[0] != null) - GT_Log.out.println("recipe " + recipe + " Output 0:" + recipe.mOutputs[0].getDisplayName() + " has errored!"); - else - GT_Log.out.println("recipe " + recipe + " has errored!"); + GT_Log.out.println("recipe " + recipe + " Output 0:" + recipe.mOutputs[0].getDisplayName() + + " has errored!"); + else GT_Log.out.println("recipe " + recipe + " has errored!"); new Exception("Recipe Fixme").printStackTrace(GT_Log.out); } - if ((recipe.mInputs != null && recipe.mInputs[i] != null) || !GT_Values.allow_broken_recipemap) - inputStacks.add(new FixedPositionedStack(recipe.mInputs[i].copy(), 48 - j % 3 * 18, (j >= 3 ? 5 : 23))); + inputStacks.add( + new FixedPositionedStack(recipe.mInputs[i].copy(), 48 - j % 3 * 18, (j >= 3 ? 5 : 23))); else - inputStacks.add(new FixedPositionedStack(new ItemStack(Items.command_block_minecart), 48 - j % 3 * 18, (j >= 3 ? 5 : 23))); + inputStacks.add(new FixedPositionedStack( + new ItemStack(Items.command_block_minecart), 48 - j % 3 * 18, (j >= 3 ? 5 : 23))); } for (int i = 0; i < fluidLimit; i++, j++) { if (recipe.mFluidInputs == null || recipe.mFluidInputs[i] == null) { if (recipe.mOutputs != null && recipe.mOutputs.length > 0 && recipe.mOutputs[0] != null) - GT_Log.out.println("recipe " + recipe + " Output 0:" + recipe.mOutputs[0].getDisplayName() + " has errored!"); - else - GT_Log.out.println("recipe " + recipe + " has errored!"); + GT_Log.out.println("recipe " + recipe + " Output 0:" + recipe.mOutputs[0].getDisplayName() + + " has errored!"); + else GT_Log.out.println("recipe " + recipe + " has errored!"); new Exception("Recipe Fixme").printStackTrace(GT_Log.out); } - if ((recipe.mFluidInputs != null && recipe.mFluidInputs[i] != null) || !GT_Values.allow_broken_recipemap) - inputStacks.add(new FixedPositionedStack(GT_Utility.getFluidDisplayStack(recipe.mFluidInputs[i], true), 48 - j % 3 * 18, (j >= 3 ? 5 : 23))); + if ((recipe.mFluidInputs != null && recipe.mFluidInputs[i] != null) + || !GT_Values.allow_broken_recipemap) + inputStacks.add(new FixedPositionedStack( + GT_Utility.getFluidDisplayStack(recipe.mFluidInputs[i], true), + 48 - j % 3 * 18, + (j >= 3 ? 5 : 23))); } return inputStacks; @@ -2169,24 +4739,44 @@ public class GT_Recipe implements Comparable<GT_Recipe> { int j = 0; for (int i = 0; i < itemLimit; i++, j++) { - outputStacks.add(new FixedPositionedStack(recipe.mOutputs[i].copy(), 102 + j % 3 * 18, (j >= 3 ? 5 : 23))); + outputStacks.add( + new FixedPositionedStack(recipe.mOutputs[i].copy(), 102 + j % 3 * 18, (j >= 3 ? 5 : 23))); } for (int i = 0; i < fluidLimit; i++, j++) { - outputStacks.add(new FixedPositionedStack(GT_Utility.getFluidDisplayStack(recipe.mFluidOutputs[i], true), 102 + j % 3 * 18, (j >= 3 ? 5 : 23))); + outputStacks.add(new FixedPositionedStack( + GT_Utility.getFluidDisplayStack(recipe.mFluidOutputs[i], true), + 102 + j % 3 * 18, + (j >= 3 ? 5 : 23))); } return outputStacks; } } - public static class GT_Recipe_Map_DistillationTower extends GT_Recipe_Map { - private static final int TOTAL_INPUT_COUNT = 6; - private static final int FLUID_OUTPUT_COUNT = 11; - private static final int ROW_SIZE = 3; - public GT_Recipe_Map_DistillationTower() { - super(new HashSet<>(110), "gt.recipe.distillationtower", "Distillation Tower", null, RES_PATH_GUI + "basicmachines/DistillationTower", 2, 4, 0, 0, 1, E, 1, E, true, true); - } + public static class GT_Recipe_Map_DistillationTower extends GT_Recipe_Map { + private static final int TOTAL_INPUT_COUNT = 6; + private static final int FLUID_OUTPUT_COUNT = 11; + private static final int ROW_SIZE = 3; + + public GT_Recipe_Map_DistillationTower() { + super( + new HashSet<>(110), + "gt.recipe.distillationtower", + "Distillation Tower", + null, + RES_PATH_GUI + "basicmachines/DistillationTower", + 2, + 4, + 0, + 0, + 1, + E, + 1, + E, + true, + true); + } @Override public ArrayList<PositionedStack> getInputPositionedStacks(GT_Recipe recipe) { @@ -2200,33 +4790,40 @@ public class GT_Recipe implements Comparable<GT_Recipe> { for (int i = 0; i < itemLimit; i++, j++) { if (recipe.mInputs == null || (recipe.mInputs[i] == null && (i == 0 && itemLimit == 1))) { if (recipe.mOutputs != null && recipe.mOutputs.length > 0 && recipe.mOutputs[0] != null) - GT_Log.out.println("recipe " + recipe + " Output 0:" + recipe.mOutputs[0].getDisplayName() + " has errored!"); - else - GT_Log.out.println("recipe " + recipe + " has errored!"); + GT_Log.out.println("recipe " + recipe + " Output 0:" + recipe.mOutputs[0].getDisplayName() + + " has errored!"); + else GT_Log.out.println("recipe " + recipe + " has errored!"); new Exception("Recipe Fixme").printStackTrace(GT_Log.out); } if ((recipe.mInputs != null && recipe.mInputs[i] != null) || !GT_Values.allow_broken_recipemap) - inputStacks.add(new FixedPositionedStack(recipe.mInputs[i].copy(), 48 - j % 3 * 18, (j >= 3 ? 5 : 23))); + inputStacks.add( + new FixedPositionedStack(recipe.mInputs[i].copy(), 48 - j % 3 * 18, (j >= 3 ? 5 : 23))); else - inputStacks.add(new FixedPositionedStack(new ItemStack(Items.command_block_minecart), 48 - j % 3 * 18, (j >= 3 ? 5 : 23))); + inputStacks.add(new FixedPositionedStack( + new ItemStack(Items.command_block_minecart), 48 - j % 3 * 18, (j >= 3 ? 5 : 23))); } for (int i = 0; i < fluidLimit; i++, j++) { if (recipe.mFluidInputs == null || recipe.mFluidInputs[i] == null) { if (recipe.mOutputs != null && recipe.mOutputs.length > 0 && recipe.mOutputs[0] != null) - GT_Log.out.println("recipe " + recipe + " Output 0:" + recipe.mOutputs[0].getDisplayName() + " has errored!"); - else - GT_Log.out.println("recipe " + recipe + " has errored!"); + GT_Log.out.println("recipe " + recipe + " Output 0:" + recipe.mOutputs[0].getDisplayName() + + " has errored!"); + else GT_Log.out.println("recipe " + recipe + " has errored!"); new Exception("Recipe Fixme").printStackTrace(GT_Log.out); } - if ((recipe.mFluidInputs != null && recipe.mFluidInputs[i] != null) || !GT_Values.allow_broken_recipemap) - inputStacks.add(new FixedPositionedStack(GT_Utility.getFluidDisplayStack(recipe.mFluidInputs[i], true), 48 - j % 3 * 18, (j >= 3 ? 5 : 23))); + if ((recipe.mFluidInputs != null && recipe.mFluidInputs[i] != null) + || !GT_Values.allow_broken_recipemap) + inputStacks.add(new FixedPositionedStack( + GT_Utility.getFluidDisplayStack(recipe.mFluidInputs[i], true), + 48 - j % 3 * 18, + (j >= 3 ? 5 : 23))); } return inputStacks; } + @Override public ArrayList<PositionedStack> getOutputPositionedStacks(GT_Recipe recipe) { int fluidLimit = Math.min(recipe.mFluidOutputs.length, FLUID_OUTPUT_COUNT); @@ -2238,8 +4835,9 @@ public class GT_Recipe implements Comparable<GT_Recipe> { for (int i = 0; i < fluidLimit; i++) { int x = 102 + ((i + 1) % ROW_SIZE) * 18; - int y = 52 - ((i + 1) / ROW_SIZE) * 18; - outputStacks.add(new FixedPositionedStack(GT_Utility.getFluidDisplayStack(recipe.mFluidOutputs[i], true), x, y)); + int y = 52 - ((i + 1) / ROW_SIZE) * 18; + outputStacks.add( + new FixedPositionedStack(GT_Utility.getFluidDisplayStack(recipe.mFluidOutputs[i], true), x, y)); } return outputStacks; } @@ -2247,14 +4845,30 @@ public class GT_Recipe implements Comparable<GT_Recipe> { public static class GT_Recipe_Map_OilCracker extends GT_Recipe_Map { private final Set<String> mValidCatalystFluidNames = new HashSet<>(); + public GT_Recipe_Map_OilCracker() { - super(new HashSet<>(70), "gt.recipe.craker", "Oil Cracker", null, RES_PATH_GUI + "basicmachines/OilCracker", 1, 1, 1, 2, 1, E, 1, E, true, true); + super( + new HashSet<>(70), + "gt.recipe.craker", + "Oil Cracker", + null, + RES_PATH_GUI + "basicmachines/OilCracker", + 1, + 1, + 1, + 2, + 1, + E, + 1, + E, + true, + true); } @Override 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) { + if (ret != null && ret.mFluidInputs != null && ret.mFluidInputs.length > 1 && ret.mFluidInputs[1] != null) { mValidCatalystFluidNames.add(ret.mFluidInputs[1].getFluid().getName()); } return ret; @@ -2267,60 +4881,158 @@ public class GT_Recipe implements Comparable<GT_Recipe> { public static class GT_Recipe_WithAlt extends GT_Recipe { - ItemStack[][] mOreDictAlt; - - public GT_Recipe_WithAlt(boolean aOptimize, ItemStack[] aInputs, ItemStack[] aOutputs, Object aSpecialItems, int[] aChances, FluidStack[] aFluidInputs, FluidStack[] aFluidOutputs, int aDuration, int aEUt, int aSpecialValue, ItemStack[][] aAlt) { - super(aOptimize, aInputs, aOutputs, aSpecialItems, aChances, aFluidInputs, aFluidOutputs, aDuration, aEUt, aSpecialValue); - mOreDictAlt = aAlt; - } - - - public Object getAltRepresentativeInput(int aIndex) { - if (aIndex < 0) return null; - if (aIndex < mOreDictAlt.length) { - if (mOreDictAlt[aIndex] != null && mOreDictAlt[aIndex].length > 0) { - ItemStack[] rStacks = new ItemStack[mOreDictAlt[aIndex].length]; - for (int i = 0; i < mOreDictAlt[aIndex].length; i++) { - rStacks[i] = GT_Utility.copyOrNull(mOreDictAlt[aIndex][i]); - } - return rStacks; - } - } - if (aIndex >= mInputs.length) return null; - return GT_Utility.copyOrNull(mInputs[aIndex]); - } - + ItemStack[][] mOreDictAlt; + + public GT_Recipe_WithAlt( + boolean aOptimize, + ItemStack[] aInputs, + ItemStack[] aOutputs, + Object aSpecialItems, + int[] aChances, + FluidStack[] aFluidInputs, + FluidStack[] aFluidOutputs, + int aDuration, + int aEUt, + int aSpecialValue, + ItemStack[][] aAlt) { + super( + aOptimize, + aInputs, + aOutputs, + aSpecialItems, + aChances, + aFluidInputs, + aFluidOutputs, + aDuration, + aEUt, + aSpecialValue); + mOreDictAlt = aAlt; + } + + public Object getAltRepresentativeInput(int aIndex) { + if (aIndex < 0) return null; + if (aIndex < mOreDictAlt.length) { + if (mOreDictAlt[aIndex] != null && mOreDictAlt[aIndex].length > 0) { + ItemStack[] rStacks = new ItemStack[mOreDictAlt[aIndex].length]; + for (int i = 0; i < mOreDictAlt[aIndex].length; i++) { + rStacks[i] = GT_Utility.copyOrNull(mOreDictAlt[aIndex][i]); + } + return rStacks; + } + } + if (aIndex >= mInputs.length) return null; + return GT_Utility.copyOrNull(mInputs[aIndex]); + } } private static class ReplicatorFakeMap extends GT_Recipe_Map { - public ReplicatorFakeMap(Collection<GT_Recipe> aRecipeList, String aUnlocalizedName, String aLocalName, String aNEIName, String aNEIGUIPath, int aUsualInputCount, int aUsualOutputCount, int aMinimalInputItems, int aMinimalInputFluids, int aAmperage, String aNEISpecialValuePre, int aNEISpecialValueMultiplier, String aNEISpecialValuePost, boolean aShowVoltageAmperageInNEI, boolean aNEIAllowed) { - super(aRecipeList, aUnlocalizedName, aLocalName, aNEIName, aNEIGUIPath, aUsualInputCount, aUsualOutputCount, aMinimalInputItems, aMinimalInputFluids, aAmperage, aNEISpecialValuePre, aNEISpecialValueMultiplier, aNEISpecialValuePost, aShowVoltageAmperageInNEI, aNEIAllowed); + public ReplicatorFakeMap( + Collection<GT_Recipe> aRecipeList, + String aUnlocalizedName, + String aLocalName, + String aNEIName, + String aNEIGUIPath, + int aUsualInputCount, + int aUsualOutputCount, + int aMinimalInputItems, + int aMinimalInputFluids, + int aAmperage, + String aNEISpecialValuePre, + int aNEISpecialValueMultiplier, + String aNEISpecialValuePost, + boolean aShowVoltageAmperageInNEI, + boolean aNEIAllowed) { + super( + aRecipeList, + aUnlocalizedName, + aLocalName, + aNEIName, + aNEIGUIPath, + aUsualInputCount, + aUsualOutputCount, + aMinimalInputItems, + aMinimalInputFluids, + aAmperage, + aNEISpecialValuePre, + aNEISpecialValueMultiplier, + aNEISpecialValuePost, + aShowVoltageAmperageInNEI, + aNEIAllowed); } @Override - public GT_Recipe addFakeRecipe(boolean aCheckForCollisions, ItemStack[] aInputs, ItemStack[] aOutputs, Object aSpecial, FluidStack[] aFluidInputs, FluidStack[] aFluidOutputs, int aDuration, int aEUt, int aSpecialValue) { + public GT_Recipe addFakeRecipe( + boolean aCheckForCollisions, + ItemStack[] aInputs, + ItemStack[] aOutputs, + 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 -> - { - aFluidInputs[0].amount = (int) GT_MetaTileEntity_Replicator.cubicFluidMultiplier(e); - ai.set(GT_Utility.safeInt(aFluidInputs[0].amount * 512L, 1)); - } - ); - return addFakeRecipe(aCheckForCollisions, new GT_Recipe(false, aInputs, aOutputs, aSpecial, null, aFluidInputs, aFluidOutputs, ai.get(), aEUt, aSpecialValue)); + .ifPresent(e -> { + aFluidInputs[0].amount = (int) GT_MetaTileEntity_Replicator.cubicFluidMultiplier(e); + ai.set(GT_Utility.safeInt(aFluidInputs[0].amount * 512L, 1)); + }); + return addFakeRecipe( + aCheckForCollisions, + new GT_Recipe( + false, + aInputs, + aOutputs, + aSpecial, + null, + aFluidInputs, + aFluidOutputs, + ai.get(), + aEUt, + aSpecialValue)); } - } public static class GT_Recipe_Map_PlasmaForge extends GT_Recipe_Map { - public GT_Recipe_Map_PlasmaForge(Collection<GT_Recipe> aRecipeList, String aUnlocalizedName, String aLocalName, String aNEIName, String aNEIGUIPath, int aUsualInputCount, int aUsualOutputCount, int aMinimalInputItems, int aMinimalInputFluids, int aAmperage, String aNEISpecialValuePre, int aNEISpecialValueMultiplier, String aNEISpecialValuePost, boolean aShowVoltageAmperageInNEI, boolean aNEIAllowed) { - super(aRecipeList, aUnlocalizedName, aLocalName, aNEIName, aNEIGUIPath, aUsualInputCount, aUsualOutputCount, aMinimalInputItems, aMinimalInputFluids, aAmperage, aNEISpecialValuePre, aNEISpecialValueMultiplier, aNEISpecialValuePost, aShowVoltageAmperageInNEI, aNEIAllowed, true); + public GT_Recipe_Map_PlasmaForge( + Collection<GT_Recipe> aRecipeList, + String aUnlocalizedName, + String aLocalName, + String aNEIName, + String aNEIGUIPath, + int aUsualInputCount, + int aUsualOutputCount, + int aMinimalInputItems, + int aMinimalInputFluids, + int aAmperage, + String aNEISpecialValuePre, + int aNEISpecialValueMultiplier, + String aNEISpecialValuePost, + boolean aShowVoltageAmperageInNEI, + boolean aNEIAllowed) { + super( + aRecipeList, + aUnlocalizedName, + aLocalName, + aNEIName, + aNEIGUIPath, + aUsualInputCount, + aUsualOutputCount, + aMinimalInputItems, + aMinimalInputFluids, + aAmperage, + aNEISpecialValuePre, + aNEISpecialValueMultiplier, + aNEISpecialValuePost, + aShowVoltageAmperageInNEI, + aNEIAllowed, + true); } @Override @@ -2328,15 +5040,19 @@ public class GT_Recipe implements Comparable<GT_Recipe> { ArrayList<PositionedStack> inputStacks = new ArrayList<>(); int i = 0; if (recipe.mInputs != null) { - for (int j = 0; j < recipe.mInputs.length; j ++, i ++) { + for (int j = 0; j < recipe.mInputs.length; j++, i++) { if (recipe.mInputs[j] == NI) continue; - inputStacks.add(new FixedPositionedStack(recipe.mInputs[j].copy(), 12 + 18 * (i % 3), 5 + 18 * (i / 3))); + inputStacks.add( + new FixedPositionedStack(recipe.mInputs[j].copy(), 12 + 18 * (i % 3), 5 + 18 * (i / 3))); } } if (recipe.mFluidInputs != null) { - for (int j = 0; j < recipe.mFluidInputs.length; j ++, i ++) { + for (int j = 0; j < recipe.mFluidInputs.length; j++, i++) { if (recipe.mFluidInputs[j] == NF) continue; - inputStacks.add(new FixedPositionedStack(GT_Utility.getFluidDisplayStack(recipe.mFluidInputs[j], true), 12 + 18 * (i % 3), 5 + 18 * (i / 3))); + inputStacks.add(new FixedPositionedStack( + GT_Utility.getFluidDisplayStack(recipe.mFluidInputs[j], true), + 12 + 18 * (i % 3), + 5 + 18 * (i / 3))); } } return inputStacks; @@ -2347,15 +5063,19 @@ public class GT_Recipe implements Comparable<GT_Recipe> { ArrayList<PositionedStack> outputStacks = new ArrayList<>(); int i = 0; if (recipe.mOutputs != null) { - for (int j = 0; j < recipe.mOutputs.length; j ++, i ++) { + for (int j = 0; j < recipe.mOutputs.length; j++, i++) { if (recipe.mOutputs[j] == NI) continue; - outputStacks.add(new FixedPositionedStack(recipe.mOutputs[j].copy(), 102 + 18 * (i % 3), 5 + 18 * (i / 3))); + outputStacks.add( + new FixedPositionedStack(recipe.mOutputs[j].copy(), 102 + 18 * (i % 3), 5 + 18 * (i / 3))); } } if (recipe.mFluidOutputs != null) { - for (int j = 0; j < recipe.mFluidOutputs.length; j ++, i ++) { + for (int j = 0; j < recipe.mFluidOutputs.length; j++, i++) { if (recipe.mFluidOutputs[j] == NF) continue; - outputStacks.add(new FixedPositionedStack(GT_Utility.getFluidDisplayStack(recipe.mFluidOutputs[j], true), 102 + 18 * (i % 3), 5 + 18 * (i / 3))); + outputStacks.add(new FixedPositionedStack( + GT_Utility.getFluidDisplayStack(recipe.mFluidOutputs[j], true), + 102 + 18 * (i % 3), + 5 + 18 * (i / 3))); } } return outputStacks; @@ -2364,13 +5084,64 @@ public class GT_Recipe implements Comparable<GT_Recipe> { public static class GT_Recipe_Map_ComplexFusion extends GT_Recipe_Map { - public GT_Recipe_Map_ComplexFusion(Collection<GT_Recipe> aRecipeList, String aUnlocalizedName, String aLocalName, String aNEIName, String aNEIGUIPath, int aUsualInputCount, int aUsualOutputCount, int aMinimalInputItems, int aMinimalInputFluids, int aAmperage, String aNEISpecialValuePre, int aNEISpecialValueMultiplier, String aNEISpecialValuePost, boolean aShowVoltageAmperageInNEI, boolean aNEIAllowed) { - super(aRecipeList, aUnlocalizedName, aLocalName, aNEIName, aNEIGUIPath, aUsualInputCount, aUsualOutputCount, aMinimalInputItems, aMinimalInputFluids, aAmperage, aNEISpecialValuePre, aNEISpecialValueMultiplier, aNEISpecialValuePost, aShowVoltageAmperageInNEI, aNEIAllowed, true); + public GT_Recipe_Map_ComplexFusion( + Collection<GT_Recipe> aRecipeList, + String aUnlocalizedName, + String aLocalName, + String aNEIName, + String aNEIGUIPath, + int aUsualInputCount, + int aUsualOutputCount, + int aMinimalInputItems, + int aMinimalInputFluids, + int aAmperage, + String aNEISpecialValuePre, + int aNEISpecialValueMultiplier, + String aNEISpecialValuePost, + boolean aShowVoltageAmperageInNEI, + boolean aNEIAllowed) { + super( + aRecipeList, + aUnlocalizedName, + aLocalName, + aNEIName, + aNEIGUIPath, + aUsualInputCount, + aUsualOutputCount, + aMinimalInputItems, + aMinimalInputFluids, + aAmperage, + aNEISpecialValuePre, + aNEISpecialValueMultiplier, + aNEISpecialValuePost, + aShowVoltageAmperageInNEI, + aNEIAllowed, + true); } @Override - public GT_Recipe addRecipe(int[] aOutputChances, FluidStack[] aFluidInputs, FluidStack[] aFluidOutputs, int aDuration, int aEUt, int aSpecialValue) { - return addRecipe(new GT_Recipe(false, null, null, null, aOutputChances, aFluidInputs, aFluidOutputs, aDuration, aEUt, aSpecialValue), false, false, false); + public GT_Recipe addRecipe( + int[] aOutputChances, + FluidStack[] aFluidInputs, + FluidStack[] aFluidOutputs, + int aDuration, + int aEUt, + int aSpecialValue) { + return addRecipe( + new GT_Recipe( + false, + null, + null, + null, + aOutputChances, + aFluidInputs, + aFluidOutputs, + aDuration, + aEUt, + aSpecialValue), + false, + false, + false); } @Override @@ -2378,9 +5149,12 @@ public class GT_Recipe implements Comparable<GT_Recipe> { ArrayList<PositionedStack> inputStacks = new ArrayList<>(); int i = 0; if (recipe.mFluidInputs != null) { - for (int j = 0; j < recipe.mFluidInputs.length; j ++, i ++) { + for (int j = 0; j < recipe.mFluidInputs.length; j++, i++) { if (recipe.mFluidInputs[j] == NF) continue; - inputStacks.add(new FixedPositionedStack(GT_Utility.getFluidDisplayStack(recipe.mFluidInputs[j], true), 3 + 18 * (i % 4), -1 + 18 * (i / 4))); + inputStacks.add(new FixedPositionedStack( + GT_Utility.getFluidDisplayStack(recipe.mFluidInputs[j], true), + 3 + 18 * (i % 4), + -1 + 18 * (i / 4))); } } return inputStacks; @@ -2391,13 +5165,15 @@ public class GT_Recipe implements Comparable<GT_Recipe> { ArrayList<PositionedStack> outputStacks = new ArrayList<>(); int i = 0; if (recipe.mFluidOutputs != null) { - for (int j = 0; j < recipe.mFluidOutputs.length; j ++, i ++) { + for (int j = 0; j < recipe.mFluidOutputs.length; j++, i++) { if (recipe.mFluidOutputs[j] == NF) continue; - outputStacks.add(new FixedPositionedStack(GT_Utility.getFluidDisplayStack(recipe.mFluidOutputs[j], true), 93 + 18 * (i % 4), -1 + 18 * (i / 4))); + outputStacks.add(new FixedPositionedStack( + GT_Utility.getFluidDisplayStack(recipe.mFluidOutputs[j], true), + 93 + 18 * (i % 4), + -1 + 18 * (i / 4))); } } return outputStacks; } } - } diff --git a/src/main/java/gregtech/api/util/GT_RecipeRegistrator.java b/src/main/java/gregtech/api/util/GT_RecipeRegistrator.java index 9ce949f274..1b1654d8a6 100644 --- a/src/main/java/gregtech/api/util/GT_RecipeRegistrator.java +++ b/src/main/java/gregtech/api/util/GT_RecipeRegistrator.java @@ -1,24 +1,21 @@ package gregtech.api.util; -import com.google.common.base.Stopwatch; +import static gregtech.api.enums.GT_Values.*; +import static gregtech.api.enums.Materials.*; +import static gregtech.api.enums.Materials.Void; + import gregtech.GT_Mod; import gregtech.api.GregTech_API; import gregtech.api.enums.*; -import gregtech.api.enums.TC_Aspects.TC_AspectStack; -import gregtech.api.interfaces.internal.IThaumcraftCompat; import gregtech.api.objects.ItemData; import gregtech.api.objects.MaterialStack; -import net.minecraft.init.Blocks; -import net.minecraft.init.Items; -import net.minecraft.item.ItemStack; - import java.util.ArrayList; import java.util.Arrays; import java.util.List; +import net.minecraft.init.Blocks; +import net.minecraft.init.Items; +import net.minecraft.item.ItemStack; -import static gregtech.api.enums.GT_Values.*; -import static gregtech.api.enums.Materials.Void; -import static gregtech.api.enums.Materials.*; /** * Class for Automatic Recipe registering. */ @@ -27,118 +24,130 @@ public class GT_RecipeRegistrator { * List of Materials, which are used in the Creation of Sticks. All Rod Materials are automatically added to this List. */ public static final List<Materials> sRodMaterialList = new ArrayList<Materials>(); + private static final ItemStack sMt1 = new ItemStack(Blocks.dirt, 1, 0), sMt2 = new ItemStack(Blocks.dirt, 1, 0); private static final String s_H = "h", s_F = "f", s_I = "I", s_P = "P", s_R = "R"; - private static final RecipeShape[] - sShapes = new RecipeShape[]{ - new RecipeShape(sMt1, null, sMt1, sMt1, sMt1, sMt1, null, sMt1, null), - new RecipeShape(sMt1, null, sMt1, sMt1, null, sMt1, sMt1, sMt1, sMt1), - new RecipeShape(null, sMt1, null, sMt1, sMt1, sMt1, sMt1, null, sMt1), - new RecipeShape(sMt1, sMt1, sMt1, sMt1, null, sMt1, null, null, null), - new RecipeShape(sMt1, null, sMt1, sMt1, sMt1, sMt1, sMt1, sMt1, sMt1), - new RecipeShape(sMt1, sMt1, sMt1, sMt1, null, sMt1, sMt1, null, sMt1), - new RecipeShape(null, null, null, sMt1, null, sMt1, sMt1, null, sMt1), - new RecipeShape(null, sMt1, null, null, sMt1, null, null, sMt2, null), - new RecipeShape(sMt1, sMt1, sMt1, null, sMt2, null, null, sMt2, null), - new RecipeShape(null, sMt1, null, null, sMt2, null, null, sMt2, null), - new RecipeShape(sMt1, sMt1, null, sMt1, sMt2, null, null, sMt2, null), - new RecipeShape(null, sMt1, sMt1, null, sMt2, sMt1, null, sMt2, null), - new RecipeShape(sMt1, sMt1, null, null, sMt2, null, null, sMt2, null), - new RecipeShape(null, sMt1, sMt1, null, sMt2, null, null, sMt2, null), - new RecipeShape(null, sMt1, null, sMt1, null, null, null, sMt1, sMt2), - new RecipeShape(null, sMt1, null, null, null, sMt1, sMt2, sMt1, null), - new RecipeShape(null, sMt1, null, sMt1, null, sMt1, null, null, sMt2), - new RecipeShape(null, sMt1, null, sMt1, null, sMt1, sMt2, null, null), - new RecipeShape(null, sMt2, null, null, sMt1, null, null, sMt1, null), - new RecipeShape(null, sMt2, null, null, sMt2, null, sMt1, sMt1, sMt1), - new RecipeShape(null, sMt2, null, null, sMt2, null, null, sMt1, null), - new RecipeShape(null, sMt2, null, sMt1, sMt2, null, sMt1, sMt1, null), - new RecipeShape(null, sMt2, null, null, sMt2, sMt1, null, sMt1, sMt1), - new RecipeShape(null, sMt2, null, null, sMt2, null, sMt1, sMt1, null), - new RecipeShape(sMt1, null, null, null, sMt2, null, null, null, sMt2), - new RecipeShape(null, null, sMt1, null, sMt2, null, sMt2, null, null), - new RecipeShape(sMt1, null, null, null, sMt2, null, null, null, null), - new RecipeShape(null, null, sMt1, null, sMt2, null, null, null, null), - new RecipeShape(sMt1, sMt2, null, null, null, null, null, null, null), - new RecipeShape(sMt2, sMt1, null, null, null, null, null, null, null), - new RecipeShape(sMt1, null, null, sMt2, null, null, null, null, null), - new RecipeShape(sMt2, null, null, sMt1, null, null, null, null, null), - new RecipeShape(sMt1, sMt1, sMt1, sMt1, sMt1, sMt1, null, sMt2, null), - new RecipeShape(sMt1, sMt1, null, sMt1, sMt1, sMt2, sMt1, sMt1, null), - new RecipeShape(null, sMt1, sMt1, sMt2, sMt1, sMt1, null, sMt1, sMt1), - new RecipeShape(null, sMt2, null, sMt1, sMt1, sMt1, sMt1, sMt1, sMt1), - new RecipeShape(sMt1, sMt1, sMt1, sMt1, sMt2, sMt1, null, sMt2, null), - new RecipeShape(sMt1, sMt1, null, sMt1, sMt2, sMt2, sMt1, sMt1, null), - new RecipeShape(null, sMt1, sMt1, sMt2, sMt2, sMt1, null, sMt1, sMt1), - new RecipeShape(null, sMt2, null, sMt1, sMt2, sMt1, sMt1, sMt1, sMt1), - new RecipeShape(sMt1, null, null, null, sMt1, null, null, null, null), - new RecipeShape(null, sMt1, null, sMt1, null, null, null, null, null), - new RecipeShape(sMt1, sMt1, null, sMt2, null, sMt1, sMt2, null, null), - new RecipeShape(null, sMt1, sMt1, sMt1, null, sMt2, null, null, sMt2) + private static final RecipeShape[] sShapes = new RecipeShape[] { + new RecipeShape(sMt1, null, sMt1, sMt1, sMt1, sMt1, null, sMt1, null), + new RecipeShape(sMt1, null, sMt1, sMt1, null, sMt1, sMt1, sMt1, sMt1), + new RecipeShape(null, sMt1, null, sMt1, sMt1, sMt1, sMt1, null, sMt1), + new RecipeShape(sMt1, sMt1, sMt1, sMt1, null, sMt1, null, null, null), + new RecipeShape(sMt1, null, sMt1, sMt1, sMt1, sMt1, sMt1, sMt1, sMt1), + new RecipeShape(sMt1, sMt1, sMt1, sMt1, null, sMt1, sMt1, null, sMt1), + new RecipeShape(null, null, null, sMt1, null, sMt1, sMt1, null, sMt1), + new RecipeShape(null, sMt1, null, null, sMt1, null, null, sMt2, null), + new RecipeShape(sMt1, sMt1, sMt1, null, sMt2, null, null, sMt2, null), + new RecipeShape(null, sMt1, null, null, sMt2, null, null, sMt2, null), + new RecipeShape(sMt1, sMt1, null, sMt1, sMt2, null, null, sMt2, null), + new RecipeShape(null, sMt1, sMt1, null, sMt2, sMt1, null, sMt2, null), + new RecipeShape(sMt1, sMt1, null, null, sMt2, null, null, sMt2, null), + new RecipeShape(null, sMt1, sMt1, null, sMt2, null, null, sMt2, null), + new RecipeShape(null, sMt1, null, sMt1, null, null, null, sMt1, sMt2), + new RecipeShape(null, sMt1, null, null, null, sMt1, sMt2, sMt1, null), + new RecipeShape(null, sMt1, null, sMt1, null, sMt1, null, null, sMt2), + new RecipeShape(null, sMt1, null, sMt1, null, sMt1, sMt2, null, null), + new RecipeShape(null, sMt2, null, null, sMt1, null, null, sMt1, null), + new RecipeShape(null, sMt2, null, null, sMt2, null, sMt1, sMt1, sMt1), + new RecipeShape(null, sMt2, null, null, sMt2, null, null, sMt1, null), + new RecipeShape(null, sMt2, null, sMt1, sMt2, null, sMt1, sMt1, null), + new RecipeShape(null, sMt2, null, null, sMt2, sMt1, null, sMt1, sMt1), + new RecipeShape(null, sMt2, null, null, sMt2, null, sMt1, sMt1, null), + new RecipeShape(sMt1, null, null, null, sMt2, null, null, null, sMt2), + new RecipeShape(null, null, sMt1, null, sMt2, null, sMt2, null, null), + new RecipeShape(sMt1, null, null, null, sMt2, null, null, null, null), + new RecipeShape(null, null, sMt1, null, sMt2, null, null, null, null), + new RecipeShape(sMt1, sMt2, null, null, null, null, null, null, null), + new RecipeShape(sMt2, sMt1, null, null, null, null, null, null, null), + new RecipeShape(sMt1, null, null, sMt2, null, null, null, null, null), + new RecipeShape(sMt2, null, null, sMt1, null, null, null, null, null), + new RecipeShape(sMt1, sMt1, sMt1, sMt1, sMt1, sMt1, null, sMt2, null), + new RecipeShape(sMt1, sMt1, null, sMt1, sMt1, sMt2, sMt1, sMt1, null), + new RecipeShape(null, sMt1, sMt1, sMt2, sMt1, sMt1, null, sMt1, sMt1), + new RecipeShape(null, sMt2, null, sMt1, sMt1, sMt1, sMt1, sMt1, sMt1), + new RecipeShape(sMt1, sMt1, sMt1, sMt1, sMt2, sMt1, null, sMt2, null), + new RecipeShape(sMt1, sMt1, null, sMt1, sMt2, sMt2, sMt1, sMt1, null), + new RecipeShape(null, sMt1, sMt1, sMt2, sMt2, sMt1, null, sMt1, sMt1), + new RecipeShape(null, sMt2, null, sMt1, sMt2, sMt1, sMt1, sMt1, sMt1), + new RecipeShape(sMt1, null, null, null, sMt1, null, null, null, null), + new RecipeShape(null, sMt1, null, sMt1, null, null, null, null, null), + new RecipeShape(sMt1, sMt1, null, sMt2, null, sMt1, sMt2, null, null), + new RecipeShape(null, sMt1, sMt1, sMt1, null, sMt2, null, null, sMt2) }; - private static final String[][] sShapesA = new String[][]{ - null, - null, - null, - {"Helmet", s_P + s_P + s_P, s_P + s_H + s_P}, - {"ChestPlate", s_P + s_H + s_P, s_P + s_P + s_P, s_P + s_P + s_P}, - {"Pants", s_P + s_P + s_P, s_P + s_H + s_P, s_P + " " + s_P}, - {"Boots", s_P + " " + s_P, s_P + s_H + s_P}, - {"Sword", " " + s_P + " ", s_F + s_P + s_H, " " + s_R + " "}, - {"Pickaxe", s_P + s_I + s_I, s_F + s_R + s_H, " " + s_R + " "}, - {"Shovel", s_F + s_P + s_H, " " + s_R + " ", " " + s_R + " "}, - {"Axe", s_P + s_I + s_H, s_P + s_R + " ", s_F + s_R + " "}, - {"Axe", s_P + s_I + s_H, s_P + s_R + " ", s_F + s_R + " "}, - {"Hoe", s_P + s_I + s_H, s_F + s_R + " ", " " + s_R + " "}, - {"Hoe", s_P + s_I + s_H, s_F + s_R + " ", " " + s_R + " "}, - {"Sickle", " " + s_P + " ", s_P + s_F + " ", s_H + s_P + s_R}, - {"Sickle", " " + s_P + " ", s_P + s_F + " ", s_H + s_P + s_R}, - {"Sickle", " " + s_P + " ", s_P + s_F + " ", s_H + s_P + s_R}, - {"Sickle", " " + s_P + " ", s_P + s_F + " ", s_H + s_P + s_R}, - {"Sword", " " + s_R + " ", s_F + s_P + s_H, " " + s_P + " "}, - {"Pickaxe", " " + s_R + " ", s_F + s_R + s_H, s_P + s_I + s_I}, - {"Shovel", " " + s_R + " ", " " + s_R + " ", s_F + s_P + s_H}, - {"Axe", s_F + s_R + " ", s_P + s_R + " ", s_P + s_I + s_H}, - {"Axe", s_F + s_R + " ", s_P + s_R + " ", s_P + s_I + s_H}, - {"Hoe", " " + s_R + " ", s_F + s_R + " ", s_P + s_I + s_H}, - {"Hoe", " " + s_R + " ", s_F + s_R + " ", s_P + s_I + s_H}, - {"Spear", s_P + s_H + " ", s_F + s_R + " ", " " + " " + s_R}, - {"Spear", s_P + s_H + " ", s_F + s_R + " ", " " + " " + s_R}, - {"Knive", s_H + s_P, s_R + s_F}, - {"Knive", s_F + s_H, s_P + s_R}, - {"Knive", s_F + s_H, s_P + s_R}, - {"Knive", s_P + s_F, s_R + s_H}, - {"Knive", s_P + s_F, s_R + s_H}, - null, - null, - null, - null, - {"WarAxe", s_P + s_P + s_P, s_P + s_R + s_P, s_F + s_R + s_H}, - null, - null, - null, - {"Shears", s_H + s_P, s_P + s_F}, - {"Shears", s_H + s_P, s_P + s_F}, - {"Scythe", s_I + s_P + s_H, s_R + s_F + s_P, s_R + " " + " "}, - {"Scythe", s_H + s_P + s_I, s_P + s_F + s_R, " " + " " + s_R} + private static final String[][] sShapesA = new String[][] { + null, + null, + null, + {"Helmet", s_P + s_P + s_P, s_P + s_H + s_P}, + {"ChestPlate", s_P + s_H + s_P, s_P + s_P + s_P, s_P + s_P + s_P}, + {"Pants", s_P + s_P + s_P, s_P + s_H + s_P, s_P + " " + s_P}, + {"Boots", s_P + " " + s_P, s_P + s_H + s_P}, + {"Sword", " " + s_P + " ", s_F + s_P + s_H, " " + s_R + " "}, + {"Pickaxe", s_P + s_I + s_I, s_F + s_R + s_H, " " + s_R + " "}, + {"Shovel", s_F + s_P + s_H, " " + s_R + " ", " " + s_R + " "}, + {"Axe", s_P + s_I + s_H, s_P + s_R + " ", s_F + s_R + " "}, + {"Axe", s_P + s_I + s_H, s_P + s_R + " ", s_F + s_R + " "}, + {"Hoe", s_P + s_I + s_H, s_F + s_R + " ", " " + s_R + " "}, + {"Hoe", s_P + s_I + s_H, s_F + s_R + " ", " " + s_R + " "}, + {"Sickle", " " + s_P + " ", s_P + s_F + " ", s_H + s_P + s_R}, + {"Sickle", " " + s_P + " ", s_P + s_F + " ", s_H + s_P + s_R}, + {"Sickle", " " + s_P + " ", s_P + s_F + " ", s_H + s_P + s_R}, + {"Sickle", " " + s_P + " ", s_P + s_F + " ", s_H + s_P + s_R}, + {"Sword", " " + s_R + " ", s_F + s_P + s_H, " " + s_P + " "}, + {"Pickaxe", " " + s_R + " ", s_F + s_R + s_H, s_P + s_I + s_I}, + {"Shovel", " " + s_R + " ", " " + s_R + " ", s_F + s_P + s_H}, + {"Axe", s_F + s_R + " ", s_P + s_R + " ", s_P + s_I + s_H}, + {"Axe", s_F + s_R + " ", s_P + s_R + " ", s_P + s_I + s_H}, + {"Hoe", " " + s_R + " ", s_F + s_R + " ", s_P + s_I + s_H}, + {"Hoe", " " + s_R + " ", s_F + s_R + " ", s_P + s_I + s_H}, + {"Spear", s_P + s_H + " ", s_F + s_R + " ", " " + " " + s_R}, + {"Spear", s_P + s_H + " ", s_F + s_R + " ", " " + " " + s_R}, + {"Knive", s_H + s_P, s_R + s_F}, + {"Knive", s_F + s_H, s_P + s_R}, + {"Knive", s_F + s_H, s_P + s_R}, + {"Knive", s_P + s_F, s_R + s_H}, + {"Knive", s_P + s_F, s_R + s_H}, + null, + null, + null, + null, + {"WarAxe", s_P + s_P + s_P, s_P + s_R + s_P, s_F + s_R + s_H}, + null, + null, + null, + {"Shears", s_H + s_P, s_P + s_F}, + {"Shears", s_H + s_P, s_P + s_F}, + {"Scythe", s_I + s_P + s_H, s_R + s_F + s_P, s_R + " " + " "}, + {"Scythe", s_H + s_P + s_I, s_P + s_F + s_R, " " + " " + s_R} }; public static volatile int VERSION = 509; - public static void registerMaterialRecycling(ItemStack aStack, Materials aMaterial, long aMaterialAmount, MaterialStack aByproduct) { + public static void registerMaterialRecycling( + ItemStack aStack, Materials aMaterial, long aMaterialAmount, MaterialStack aByproduct) { if (GT_Utility.isStackInvalid(aStack)) return; if (aByproduct != null) { aByproduct = aByproduct.clone(); aByproduct.mAmount /= aStack.stackSize; } - GT_OreDictUnificator.addItemData(GT_Utility.copyAmount(1, aStack), new ItemData(aMaterial, aMaterialAmount / aStack.stackSize, aByproduct)); + GT_OreDictUnificator.addItemData( + GT_Utility.copyAmount(1, aStack), + new ItemData(aMaterial, aMaterialAmount / aStack.stackSize, aByproduct)); } public static void registerMaterialRecycling(ItemStack aStack, ItemData aData) { - if (GT_Utility.isStackInvalid(aStack) || GT_Utility.areStacksEqual(new ItemStack(Items.blaze_rod), aStack) || aData == null || !aData.hasValidMaterialData() || aData.mMaterial.mAmount <= 0 || GT_Utility.getFluidForFilledItem(aStack, false) != null) - return; + if (GT_Utility.isStackInvalid(aStack) + || GT_Utility.areStacksEqual(new ItemStack(Items.blaze_rod), aStack) + || aData == null + || !aData.hasValidMaterialData() + || aData.mMaterial.mAmount <= 0 + || GT_Utility.getFluidForFilledItem(aStack, false) != null) return; registerReverseMacerating(GT_Utility.copyAmount(1, aStack), aData, aData.mPrefix == null); - registerReverseSmelting(GT_Utility.copyAmount(1, aStack), aData.mMaterial.mMaterial, aData.mMaterial.mAmount, true); - registerReverseFluidSmelting(GT_Utility.copyAmount(1, aStack), aData.mMaterial.mMaterial, aData.mMaterial.mAmount, aData.getByProduct(0)); + registerReverseSmelting( + GT_Utility.copyAmount(1, aStack), aData.mMaterial.mMaterial, aData.mMaterial.mAmount, true); + registerReverseFluidSmelting( + GT_Utility.copyAmount(1, aStack), + aData.mMaterial.mMaterial, + aData.mMaterial.mAmount, + aData.getByProduct(0)); registerReverseArcSmelting(GT_Utility.copyAmount(1, aStack), aData); } @@ -147,17 +156,48 @@ public class GT_RecipeRegistrator { * @param aMaterial the Material. * @param aMaterialAmount the amount of it in Material Units. */ - public static void registerReverseFluidSmelting(ItemStack aStack, Materials aMaterial, long aMaterialAmount, MaterialStack aByproduct) { - if (aStack == null || aMaterial == null || aMaterial.mSmeltInto.mStandardMoltenFluid == null || !aMaterial.contains(SubTag.SMELTING_TO_FLUID) || (L * aMaterialAmount) / (M * aStack.stackSize) <= 0) - return; + public static void registerReverseFluidSmelting( + ItemStack aStack, Materials aMaterial, long aMaterialAmount, MaterialStack aByproduct) { + if (aStack == null + || aMaterial == null + || aMaterial.mSmeltInto.mStandardMoltenFluid == null + || !aMaterial.contains(SubTag.SMELTING_TO_FLUID) + || (L * aMaterialAmount) / (M * aStack.stackSize) <= 0) return; ItemData tData = GT_OreDictUnificator.getItemData(aStack); - boolean tHide = aStack.getUnlocalizedName().startsWith("gt.blockmachines")&&(GT_Mod.gregtechproxy.mHideRecyclingRecipes); - if(GT_Mod.gregtechproxy.mHideRecyclingRecipes&&tData!=null&&tData.hasValidPrefixData()&&!(tData.mPrefix==OrePrefixes.dust||tData.mPrefix==OrePrefixes.ingot||tData.mPrefix==OrePrefixes.block|tData.mPrefix==OrePrefixes.plate)){tHide=true;} -// boolean tHide = (aMaterial != Materials.Iron && aMaterial!= Materials.Redstone)&&(GT_Mod.gregtechproxy.mHideRecyclingRecipes); -// if(tHide && tData!=null&&tData.hasValidPrefixData()&&tData.mPrefix==OrePrefixes.ingot){ -// tHide=false; -// } - RA.addFluidSmelterRecipe(GT_Utility.copyAmount(1, aStack), aByproduct == null ? null : aByproduct.mMaterial.contains(SubTag.NO_SMELTING) || !aByproduct.mMaterial.contains(SubTag.METAL) ? aByproduct.mMaterial.contains(SubTag.FLAMMABLE) ? GT_OreDictUnificator.getDust(Materials.Ash, aByproduct.mAmount / 2) : aByproduct.mMaterial.contains(SubTag.UNBURNABLE) ? GT_OreDictUnificator.getDustOrIngot(aByproduct.mMaterial.mSmeltInto, aByproduct.mAmount) : null : GT_OreDictUnificator.getIngotOrDust(aByproduct.mMaterial.mSmeltInto, aByproduct.mAmount), aMaterial.mSmeltInto.getMolten((L * aMaterialAmount) / (M * aStack.stackSize)), 10000, (int) Math.max(1, (24 * aMaterialAmount) / M), Math.max(8, (int) Math.sqrt(2 * aMaterial.mSmeltInto.mStandardMoltenFluid.getTemperature())), tHide); + boolean tHide = aStack.getUnlocalizedName().startsWith("gt.blockmachines") + && (GT_Mod.gregtechproxy.mHideRecyclingRecipes); + if (GT_Mod.gregtechproxy.mHideRecyclingRecipes + && tData != null + && tData.hasValidPrefixData() + && !(tData.mPrefix == OrePrefixes.dust + || tData.mPrefix == OrePrefixes.ingot + || tData.mPrefix == OrePrefixes.block | tData.mPrefix == OrePrefixes.plate)) { + tHide = true; + } + // boolean tHide = (aMaterial != Materials.Iron && aMaterial!= + // Materials.Redstone)&&(GT_Mod.gregtechproxy.mHideRecyclingRecipes); + // if(tHide && tData!=null&&tData.hasValidPrefixData()&&tData.mPrefix==OrePrefixes.ingot){ + // tHide=false; + // } + RA.addFluidSmelterRecipe( + GT_Utility.copyAmount(1, aStack), + aByproduct == null + ? null + : aByproduct.mMaterial.contains(SubTag.NO_SMELTING) + || !aByproduct.mMaterial.contains(SubTag.METAL) + ? aByproduct.mMaterial.contains(SubTag.FLAMMABLE) + ? GT_OreDictUnificator.getDust(Materials.Ash, aByproduct.mAmount / 2) + : aByproduct.mMaterial.contains(SubTag.UNBURNABLE) + ? GT_OreDictUnificator.getDustOrIngot( + aByproduct.mMaterial.mSmeltInto, aByproduct.mAmount) + : null + : GT_OreDictUnificator.getIngotOrDust( + aByproduct.mMaterial.mSmeltInto, aByproduct.mAmount), + aMaterial.mSmeltInto.getMolten((L * aMaterialAmount) / (M * aStack.stackSize)), + 10000, + (int) Math.max(1, (24 * aMaterialAmount) / M), + Math.max(8, (int) Math.sqrt(2 * aMaterial.mSmeltInto.mStandardMoltenFluid.getTemperature())), + tHide); } /** @@ -166,21 +206,42 @@ public class GT_RecipeRegistrator { * @param aMaterialAmount the amount of it in Material Units. * @param aAllowAlloySmelter if it is allowed to be recycled inside the Alloy Smelter. */ - public static void registerReverseSmelting(ItemStack aStack, Materials aMaterial, long aMaterialAmount, boolean aAllowAlloySmelter) { - if (aStack == null || aMaterial == null || aMaterialAmount <= 0 || aMaterial.contains(SubTag.NO_SMELTING) || (aMaterialAmount > M && aMaterial.contains(SubTag.METAL))) - return; + public static void registerReverseSmelting( + ItemStack aStack, Materials aMaterial, long aMaterialAmount, boolean aAllowAlloySmelter) { + if (aStack == null + || aMaterial == null + || aMaterialAmount <= 0 + || aMaterial.contains(SubTag.NO_SMELTING) + || (aMaterialAmount > M && aMaterial.contains(SubTag.METAL))) return; aMaterialAmount /= aStack.stackSize; - if(aMaterial==Materials.Naquadah||aMaterial==Materials.NaquadahEnriched)return; + if (aMaterial == Materials.Naquadah || aMaterial == Materials.NaquadahEnriched) return; - boolean tHide = (aMaterial != Materials.Iron)&&(GT_Mod.gregtechproxy.mHideRecyclingRecipes); + boolean tHide = (aMaterial != Materials.Iron) && (GT_Mod.gregtechproxy.mHideRecyclingRecipes); if (aAllowAlloySmelter) - GT_ModHandler.addSmeltingAndAlloySmeltingRecipe(GT_Utility.copyAmount(1, aStack), GT_OreDictUnificator.getIngot(aMaterial.mSmeltInto, aMaterialAmount),tHide); + GT_ModHandler.addSmeltingAndAlloySmeltingRecipe( + GT_Utility.copyAmount(1, aStack), + GT_OreDictUnificator.getIngot(aMaterial.mSmeltInto, aMaterialAmount), + tHide); else - GT_ModHandler.addSmeltingRecipe(GT_Utility.copyAmount(1, aStack), GT_OreDictUnificator.getIngot(aMaterial.mSmeltInto, aMaterialAmount)); + GT_ModHandler.addSmeltingRecipe( + GT_Utility.copyAmount(1, aStack), + GT_OreDictUnificator.getIngot(aMaterial.mSmeltInto, aMaterialAmount)); } - public static void registerReverseArcSmelting(ItemStack aStack, Materials aMaterial, long aMaterialAmount, MaterialStack aByProduct01, MaterialStack aByProduct02, MaterialStack aByProduct03) { - registerReverseArcSmelting(aStack, new ItemData(aMaterial == null ? null : new MaterialStack(aMaterial, aMaterialAmount), aByProduct01, aByProduct02, aByProduct03)); + public static void registerReverseArcSmelting( + ItemStack aStack, + Materials aMaterial, + long aMaterialAmount, + MaterialStack aByProduct01, + MaterialStack aByProduct02, + MaterialStack aByProduct03) { + registerReverseArcSmelting( + aStack, + new ItemData( + aMaterial == null ? null : new MaterialStack(aMaterial, aMaterialAmount), + aByProduct01, + aByProduct02, + aByProduct03)); } public static void registerReverseArcSmelting(ItemStack aStack, ItemData aData) { @@ -190,10 +251,11 @@ public class GT_RecipeRegistrator { if (!aData.hasValidMaterialData()) return; boolean tIron = false; - for (MaterialStack tMaterial : aData.getAllMaterialStacks()) { - if (tMaterial.mMaterial == Materials.Iron||tMaterial.mMaterial == Materials.Copper || - tMaterial.mMaterial == Materials.WroughtIron||tMaterial.mMaterial == Materials.AnnealedCopper) tIron = true; + if (tMaterial.mMaterial == Materials.Iron + || tMaterial.mMaterial == Materials.Copper + || tMaterial.mMaterial == Materials.WroughtIron + || tMaterial.mMaterial == Materials.AnnealedCopper) tIron = true; if (tMaterial.mMaterial.contains(SubTag.UNBURNABLE)) { tMaterial.mMaterial = tMaterial.mMaterial.mSmeltInto.mArcSmeltInto; @@ -214,20 +276,21 @@ public class GT_RecipeRegistrator { continue; } if (tMaterial.mMaterial.contains(SubTag.METAL)) { - if(GT_Mod.gregtechproxy.mArcSmeltIntoAnnealed){ - tMaterial.mMaterial = tMaterial.mMaterial.mSmeltInto.mArcSmeltInto; - }else{ - tMaterial.mMaterial = tMaterial.mMaterial.mSmeltInto.mSmeltInto; - } + if (GT_Mod.gregtechproxy.mArcSmeltIntoAnnealed) { + tMaterial.mMaterial = tMaterial.mMaterial.mSmeltInto.mArcSmeltInto; + } else { + tMaterial.mMaterial = tMaterial.mMaterial.mSmeltInto.mSmeltInto; + } continue; } tMaterial.mAmount = 0; } aData = new ItemData(aData); - if (aData.mByProducts.length > 3) for (MaterialStack tMaterial : aData.getAllMaterialStacks()){ - if (tMaterial.mMaterial == Materials.Ash) tMaterial.mAmount = 0; - } + if (aData.mByProducts.length > 3) + for (MaterialStack tMaterial : aData.getAllMaterialStacks()) { + if (tMaterial.mMaterial == Materials.Ash) tMaterial.mAmount = 0; + } aData = new ItemData(aData); @@ -238,11 +301,36 @@ public class GT_RecipeRegistrator { tAmount += tMaterial.mAmount * tMaterial.mMaterial.getMass(); boolean tHide = !tIron && GT_Mod.gregtechproxy.mHideRecyclingRecipes; - RA.addArcFurnaceRecipe(aStack, new ItemStack[]{GT_OreDictUnificator.getIngotOrDust(aData.mMaterial), GT_OreDictUnificator.getIngotOrDust(aData.getByProduct(0)), GT_OreDictUnificator.getIngotOrDust(aData.getByProduct(1)), GT_OreDictUnificator.getIngotOrDust(aData.getByProduct(2))}, null, (int) Math.max(16, tAmount / M), 90, tHide); + RA.addArcFurnaceRecipe( + aStack, + new ItemStack[] { + GT_OreDictUnificator.getIngotOrDust(aData.mMaterial), + GT_OreDictUnificator.getIngotOrDust(aData.getByProduct(0)), + GT_OreDictUnificator.getIngotOrDust(aData.getByProduct(1)), + GT_OreDictUnificator.getIngotOrDust(aData.getByProduct(2)) + }, + null, + (int) Math.max(16, tAmount / M), + 90, + tHide); } - public static void registerReverseMacerating(ItemStack aStack, Materials aMaterial, long aMaterialAmount, MaterialStack aByProduct01, MaterialStack aByProduct02, MaterialStack aByProduct03, boolean aAllowHammer) { - registerReverseMacerating(aStack, new ItemData(aMaterial == null ? null : new MaterialStack(aMaterial, aMaterialAmount), aByProduct01, aByProduct02, aByProduct03), aAllowHammer); + public static void registerReverseMacerating( + ItemStack aStack, + Materials aMaterial, + long aMaterialAmount, + MaterialStack aByProduct01, + MaterialStack aByProduct02, + MaterialStack aByProduct03, + boolean aAllowHammer) { + registerReverseMacerating( + aStack, + new ItemData( + aMaterial == null ? null : new MaterialStack(aMaterial, aMaterialAmount), + aByProduct01, + aByProduct02, + aByProduct03), + aAllowHammer); } public static void registerReverseMacerating(ItemStack aStack, ItemData aData, boolean aAllowHammer) { @@ -262,36 +350,50 @@ public class GT_RecipeRegistrator { for (MaterialStack tMaterial : aData.getAllMaterialStacks()) tAmount += tMaterial.mAmount * tMaterial.mMaterial.getMass(); boolean tHide = (aData.mMaterial.mMaterial != Materials.Iron) && (GT_Mod.gregtechproxy.mHideRecyclingRecipes); - RA.addPulveriserRecipe(aStack, new ItemStack[]{GT_OreDictUnificator.getDust(aData.mMaterial), GT_OreDictUnificator.getDust(aData.getByProduct(0)), GT_OreDictUnificator.getDust(aData.getByProduct(1)), GT_OreDictUnificator.getDust(aData.getByProduct(2))}, null, aData.mMaterial.mMaterial==Materials.Marble ? 1 : (int) Math.max(16, tAmount / M), 4, tHide); + RA.addPulveriserRecipe( + aStack, + new ItemStack[] { + GT_OreDictUnificator.getDust(aData.mMaterial), + GT_OreDictUnificator.getDust(aData.getByProduct(0)), + GT_OreDictUnificator.getDust(aData.getByProduct(1)), + GT_OreDictUnificator.getDust(aData.getByProduct(2)) + }, + null, + aData.mMaterial.mMaterial == Materials.Marble ? 1 : (int) Math.max(16, tAmount / M), + 4, + tHide); if (aAllowHammer) - for (MaterialStack tMaterial : aData.getAllMaterialStacks()) - if (tMaterial.mMaterial.contains(SubTag.CRYSTAL) && !tMaterial.mMaterial.contains(SubTag.METAL) && tMaterial.mMaterial != Materials.Glass) { - if (RA.addForgeHammerRecipe(GT_Utility.copyAmount(1, aStack), GT_OreDictUnificator.getDust(aData.mMaterial), 200, 30)) - break; - } + for (MaterialStack tMaterial : aData.getAllMaterialStacks()) + if (tMaterial.mMaterial.contains(SubTag.CRYSTAL) + && !tMaterial.mMaterial.contains(SubTag.METAL) + && tMaterial.mMaterial != Materials.Glass) { + if (RA.addForgeHammerRecipe( + GT_Utility.copyAmount(1, aStack), GT_OreDictUnificator.getDust(aData.mMaterial), 200, 30)) + break; + } } /** * Place Materials which you want to replace in Non-GT-Recipes here (warning HUGHE impact on loading times!) */ private static final Materials[] VANILLA_MATS = { - Cobalt, - Gold, - Iron, - Lead, - FierySteel, - Void, - Bronze, - Diamond, - Ruby, - Sapphire, - Steel, - IronWood, - Steeleaf, - Knightmetal, - Thaumium, - DarkSteel, + Cobalt, + Gold, + Iron, + Lead, + FierySteel, + Void, + Bronze, + Diamond, + Ruby, + Sapphire, + Steel, + IronWood, + Steeleaf, + Knightmetal, + Thaumium, + DarkSteel, }; /** @@ -301,12 +403,12 @@ public class GT_RecipeRegistrator { * @param aPlate the Plate referenced to aMat * @param aRecipeReplacing allows to replace the Recipe with a Plate variant */ - public static synchronized void registerUsagesForMaterials(String aPlate, boolean aRecipeReplacing, ItemStack... aMats) { + public static synchronized void registerUsagesForMaterials( + String aPlate, boolean aRecipeReplacing, ItemStack... aMats) { for (ItemStack aMat : aMats) { aMat = GT_Utility.copyOrNull(aMat); - if (aMat == null) - continue; + if (aMat == null) continue; ItemData aItemData = GT_OreDictUnificator.getItemData(aMat); if (aItemData == null || aItemData.mPrefix != OrePrefixes.ingot) aPlate = null; @@ -320,15 +422,22 @@ public class GT_RecipeRegistrator { sMt2.stackSize = 1; Items.feather.setDamage(sMt2, 0); - if(aItemData != null && aItemData.hasValidPrefixMaterialData()) { + if (aItemData != null && aItemData.hasValidPrefixMaterialData()) { for (RecipeShape tRecipe : sShapes) { for (ItemStack tCrafted : GT_ModHandler.getRecipeOutputsBuffered(tRecipe.shape)) { - GT_OreDictUnificator.addItemData(tCrafted, new ItemData(aItemData.mMaterial.mMaterial, aItemData.mMaterial.mAmount * tRecipe.amount1)); - // GT_Log.out.println("###################################################################################"); + GT_OreDictUnificator.addItemData( + tCrafted, + new ItemData( + aItemData.mMaterial.mMaterial, aItemData.mMaterial.mAmount * tRecipe.amount1)); + // + // GT_Log.out.println("###################################################################################"); // GT_Log.out.println("registerUsagesForMaterials used aPlate: "+aPlate); - // GT_Log.out.println("registerUsagesForMaterials used aPlate: "+aMat.getUnlocalizedName()); - // GT_Log.out.println("registerUsagesForMaterials used aPlate: "+aMat.getDisplayName()); - // GT_Log.out.println("###################################################################################"); + // GT_Log.out.println("registerUsagesForMaterials used aPlate: + // "+aMat.getUnlocalizedName()); + // GT_Log.out.println("registerUsagesForMaterials used aPlate: + // "+aMat.getDisplayName()); + // + // GT_Log.out.println("###################################################################################"); } } } @@ -350,24 +459,66 @@ public class GT_RecipeRegistrator { for (ItemStack tCrafted : GT_ModHandler.getVanillyToolRecipeOutputs(tRecipe.shape)) { if (aItemData != null && aItemData.hasValidPrefixMaterialData()) - GT_OreDictUnificator.addItemData(tCrafted, new ItemData(aItemData.mMaterial.mMaterial, aItemData.mMaterial.mAmount * tRecipe.amount1, new MaterialStack(tMaterial, OrePrefixes.stick.mMaterialAmount * tRecipe.amount2))); + GT_OreDictUnificator.addItemData( + tCrafted, + new ItemData( + aItemData.mMaterial.mMaterial, + aItemData.mMaterial.mAmount * tRecipe.amount1, + new MaterialStack( + tMaterial, OrePrefixes.stick.mMaterialAmount * tRecipe.amount2))); if (aRecipeReplacing && aPlate != null && sShapesA[i] != null && sShapesA[i].length > 1) { assert aItemData != null; - if (GregTech_API.sRecipeFile.get(ConfigCategories.Recipes.recipereplacements, aItemData.mMaterial.mMaterial + "." + sShapesA[i][0], true)) { + if (GregTech_API.sRecipeFile.get( + ConfigCategories.Recipes.recipereplacements, + aItemData.mMaterial.mMaterial + "." + sShapesA[i][0], + true)) { if (null != (tStack = GT_ModHandler.removeRecipe(tRecipe.shape))) { -// GT_Log.out.println("###################################################################################"); -// GT_Log.out.println("registerStickStuff used aPlate: "+aPlate); -// GT_Log.out.println("###################################################################################"); + // + // GT_Log.out.println("###################################################################################"); + // GT_Log.out.println("registerStickStuff used + // aPlate: "+aPlate); + // + // GT_Log.out.println("###################################################################################"); switch (sShapesA[i].length) { case 2: - GT_ModHandler.addCraftingRecipe(tStack, GT_ModHandler.RecipeBits.BUFFERED, new Object[]{sShapesA[i][1], s_P.charAt(0), aPlate, s_R.charAt(0), OrePrefixes.stick.get(tMaterial), s_I.charAt(0), aItemData}); + GT_ModHandler.addCraftingRecipe( + tStack, GT_ModHandler.RecipeBits.BUFFERED, new Object[] { + sShapesA[i][1], + s_P.charAt(0), + aPlate, + s_R.charAt(0), + OrePrefixes.stick.get(tMaterial), + s_I.charAt(0), + aItemData + }); break; case 3: - GT_ModHandler.addCraftingRecipe(tStack, GT_ModHandler.RecipeBits.BUFFERED, new Object[]{sShapesA[i][1], sShapesA[i][2], s_P.charAt(0), aPlate, s_R.charAt(0), OrePrefixes.stick.get(tMaterial), s_I.charAt(0), aItemData}); + GT_ModHandler.addCraftingRecipe( + tStack, GT_ModHandler.RecipeBits.BUFFERED, new Object[] { + sShapesA[i][1], + sShapesA[i][2], + s_P.charAt(0), + aPlate, + s_R.charAt(0), + OrePrefixes.stick.get(tMaterial), + s_I.charAt(0), + aItemData + }); break; default: - GT_ModHandler.addCraftingRecipe(tStack, GT_ModHandler.RecipeBits.BUFFERED, new Object[]{sShapesA[i][1], sShapesA[i][2], sShapesA[i][3], s_P.charAt(0), aPlate, s_R.charAt(0), OrePrefixes.stick.get(tMaterial), s_I.charAt(0), aItemData}); + GT_ModHandler.addCraftingRecipe( + tStack, GT_ModHandler.RecipeBits.BUFFERED, new Object[] { + sShapesA[i][1], + sShapesA[i][2], + sShapesA[i][3], + s_P.charAt(0), + aPlate, + s_R.charAt(0), + OrePrefixes.stick.get(tMaterial), + s_I.charAt(0), + aItemData + }); break; } } @@ -392,8 +543,8 @@ public class GT_RecipeRegistrator { this.shape = shape; for (ItemStack stack : shape) { - if(stack == sMt1) this.amount1++; - if(stack == sMt2) this.amount2++; + if (stack == sMt1) this.amount1++; + if (stack == sMt2) this.amount2++; } } } diff --git a/src/main/java/gregtech/api/util/GT_RenderingWorld.java b/src/main/java/gregtech/api/util/GT_RenderingWorld.java index 920ce76357..173631e99c 100644 --- a/src/main/java/gregtech/api/util/GT_RenderingWorld.java +++ b/src/main/java/gregtech/api/util/GT_RenderingWorld.java @@ -4,6 +4,10 @@ import cpw.mods.fml.common.FMLCommonHandler; import cpw.mods.fml.common.eventhandler.EventPriority; import cpw.mods.fml.common.eventhandler.SubscribeEvent; import cpw.mods.fml.common.gameevent.TickEvent; +import java.util.HashMap; +import java.util.HashSet; +import java.util.Map; +import java.util.Set; import net.minecraft.block.Block; import net.minecraft.client.Minecraft; import net.minecraft.tileentity.TileEntity; @@ -16,176 +20,164 @@ import net.minecraftforge.common.util.ForgeDirection; import net.minecraftforge.event.world.ChunkEvent; import net.minecraftforge.event.world.WorldEvent; -import java.util.HashMap; -import java.util.HashSet; -import java.util.Map; -import java.util.Set; - /** * Provide a fake IBlockAccess to support CTM. Facade are supposed to set these when they are placed/received by client. */ public class GT_RenderingWorld implements IBlockAccess { - private static final GT_RenderingWorld INSTANCE = new GT_RenderingWorld(); - /* - * I do not think this map would ever grow too huge, so I won't go too overcomplicated on this one - */ - private final Map<ChunkPosition, BlockInfo> infos = new HashMap<>(); - private final Map<ChunkCoordIntPair, Set<ChunkPosition>> index = new HashMap<>(); - private IBlockAccess mWorld = Minecraft.getMinecraft().theWorld; - - private GT_RenderingWorld() { - new FMLEventHandler(); - new ForgeEventHandler(); - } - - public static GT_RenderingWorld getInstance() { - return INSTANCE; - } - - public static GT_RenderingWorld getInstance(IBlockAccess aWorld) { - if (aWorld == INSTANCE) - return INSTANCE; - if (aWorld == null) - INSTANCE.mWorld = Minecraft.getMinecraft().theWorld; - else - INSTANCE.mWorld = aWorld; - return INSTANCE; - } - - private void setWorld(IBlockAccess aWorld) { - if (aWorld == null) - mWorld = Minecraft.getMinecraft().theWorld; - else - mWorld = aWorld; - } - - 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); - } - - public void unregister(int x, int y, int z, Block block, int meta) { - ChunkPosition key = new ChunkPosition(x, y, z); - if (infos.remove(key, new BlockInfo(block, meta))) { - ChunkCoordIntPair chunkKey = new ChunkCoordIntPair(x >> 4, z >> 4); - Set<ChunkPosition> set = index.get(chunkKey); - set.remove(key); - if (set.isEmpty()) - index.remove(chunkKey); - } - } - - @Override - public Block getBlock(int p_147439_1_, int p_147439_2_, int p_147439_3_) { - BlockInfo blockInfo = infos.get(new ChunkPosition(p_147439_1_, p_147439_2_, p_147439_3_)); - return blockInfo != null ? blockInfo.block : mWorld.getBlock(p_147439_1_, p_147439_2_, p_147439_3_); - } - - @Override - public TileEntity getTileEntity(int p_147438_1_, int p_147438_2_, int p_147438_3_) { - return mWorld.getTileEntity(p_147438_1_, p_147438_2_, p_147438_3_); - } - - @Override - public int getLightBrightnessForSkyBlocks(int p_72802_1_, int p_72802_2_, int p_72802_3_, int p_72802_4_) { - return mWorld.getLightBrightnessForSkyBlocks(p_72802_1_, p_72802_2_, p_72802_3_, p_72802_4_); - } - - @Override - public int getBlockMetadata(int p_72805_1_, int p_72805_2_, int p_72805_3_) { - BlockInfo blockInfo = infos.get(new ChunkPosition(p_72805_1_, p_72805_2_, p_72805_3_)); - return blockInfo != null ? blockInfo.meta : mWorld.getBlockMetadata(p_72805_1_, p_72805_2_, p_72805_3_); - } - - @Override - public int isBlockProvidingPowerTo(int p_72879_1_, int p_72879_2_, int p_72879_3_, int p_72879_4_) { - return mWorld.isBlockProvidingPowerTo(p_72879_1_, p_72879_2_, p_72879_3_, p_72879_4_); - } - - @Override - public boolean isAirBlock(int p_147437_1_, int p_147437_2_, int p_147437_3_) { - return getBlock(p_147437_1_, p_147437_2_, p_147437_3_).isAir(mWorld, p_147437_1_, p_147437_2_, p_147437_3_); - } - - @Override - public BiomeGenBase getBiomeGenForCoords(int p_72807_1_, int p_72807_2_) { - return mWorld.getBiomeGenForCoords(p_72807_1_, p_72807_2_); - } - - @Override - public int getHeight() { - return mWorld.getHeight(); - } - - @Override - public boolean extendedLevelsInChunkCache() { - return mWorld.extendedLevelsInChunkCache(); - } - - @Override - public boolean isSideSolid(int x, int y, int z, ForgeDirection side, boolean _default) { - return getBlock(x, y, z).isSideSolid(this, x, y, z, side); - } - - public class FMLEventHandler { - public FMLEventHandler() { - FMLCommonHandler.instance().bus().register(this); - } - - @SubscribeEvent(priority = EventPriority.HIGHEST) - public void onRenderTickStart(TickEvent.RenderTickEvent e) { - if (e.phase == TickEvent.Phase.START) - mWorld = Minecraft.getMinecraft().theWorld; - } - } - - public class ForgeEventHandler { - private ForgeEventHandler() { - MinecraftForge.EVENT_BUS.register(this); - } - - @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); - } - - @SubscribeEvent - public void onWorldUnloaded(WorldEvent.Unload e) { - if (!e.world.isRemote) return; - infos.clear(); - index.clear(); - } - } - - private static class BlockInfo { - private final Block block; - private final int meta; - - public BlockInfo(Block block, int meta) { - this.block = block; - this.meta = meta; - } - - @Override - public boolean equals(Object o) { - if (this == o) return true; - if (o == null || getClass() != o.getClass()) return false; - - BlockInfo blockInfo = (BlockInfo) o; - - if (meta != blockInfo.meta) return false; - return block != null ? block.equals(blockInfo.block) : blockInfo.block == null; - } - - @Override - public int hashCode() { - int result = block != null ? block.hashCode() : 0; - result = 31 * result + meta; - return result; - } - } + private static final GT_RenderingWorld INSTANCE = new GT_RenderingWorld(); + /* + * I do not think this map would ever grow too huge, so I won't go too overcomplicated on this one + */ + private final Map<ChunkPosition, BlockInfo> infos = new HashMap<>(); + private final Map<ChunkCoordIntPair, Set<ChunkPosition>> index = new HashMap<>(); + private IBlockAccess mWorld = Minecraft.getMinecraft().theWorld; + + private GT_RenderingWorld() { + new FMLEventHandler(); + new ForgeEventHandler(); + } + + public static GT_RenderingWorld getInstance() { + return INSTANCE; + } + + public static GT_RenderingWorld getInstance(IBlockAccess aWorld) { + if (aWorld == INSTANCE) return INSTANCE; + if (aWorld == null) INSTANCE.mWorld = Minecraft.getMinecraft().theWorld; + else INSTANCE.mWorld = aWorld; + return INSTANCE; + } + + private void setWorld(IBlockAccess aWorld) { + if (aWorld == null) mWorld = Minecraft.getMinecraft().theWorld; + else mWorld = aWorld; + } + + 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); + } + + public void unregister(int x, int y, int z, Block block, int meta) { + ChunkPosition key = new ChunkPosition(x, y, z); + if (infos.remove(key, new BlockInfo(block, meta))) { + ChunkCoordIntPair chunkKey = new ChunkCoordIntPair(x >> 4, z >> 4); + Set<ChunkPosition> set = index.get(chunkKey); + set.remove(key); + if (set.isEmpty()) index.remove(chunkKey); + } + } + + @Override + public Block getBlock(int p_147439_1_, int p_147439_2_, int p_147439_3_) { + BlockInfo blockInfo = infos.get(new ChunkPosition(p_147439_1_, p_147439_2_, p_147439_3_)); + return blockInfo != null ? blockInfo.block : mWorld.getBlock(p_147439_1_, p_147439_2_, p_147439_3_); + } + + @Override + public TileEntity getTileEntity(int p_147438_1_, int p_147438_2_, int p_147438_3_) { + return mWorld.getTileEntity(p_147438_1_, p_147438_2_, p_147438_3_); + } + + @Override + public int getLightBrightnessForSkyBlocks(int p_72802_1_, int p_72802_2_, int p_72802_3_, int p_72802_4_) { + return mWorld.getLightBrightnessForSkyBlocks(p_72802_1_, p_72802_2_, p_72802_3_, p_72802_4_); + } + + @Override + public int getBlockMetadata(int p_72805_1_, int p_72805_2_, int p_72805_3_) { + BlockInfo blockInfo = infos.get(new ChunkPosition(p_72805_1_, p_72805_2_, p_72805_3_)); + return blockInfo != null ? blockInfo.meta : mWorld.getBlockMetadata(p_72805_1_, p_72805_2_, p_72805_3_); + } + + @Override + public int isBlockProvidingPowerTo(int p_72879_1_, int p_72879_2_, int p_72879_3_, int p_72879_4_) { + return mWorld.isBlockProvidingPowerTo(p_72879_1_, p_72879_2_, p_72879_3_, p_72879_4_); + } + + @Override + public boolean isAirBlock(int p_147437_1_, int p_147437_2_, int p_147437_3_) { + return getBlock(p_147437_1_, p_147437_2_, p_147437_3_).isAir(mWorld, p_147437_1_, p_147437_2_, p_147437_3_); + } + + @Override + public BiomeGenBase getBiomeGenForCoords(int p_72807_1_, int p_72807_2_) { + return mWorld.getBiomeGenForCoords(p_72807_1_, p_72807_2_); + } + + @Override + public int getHeight() { + return mWorld.getHeight(); + } + + @Override + public boolean extendedLevelsInChunkCache() { + return mWorld.extendedLevelsInChunkCache(); + } + + @Override + public boolean isSideSolid(int x, int y, int z, ForgeDirection side, boolean _default) { + return getBlock(x, y, z).isSideSolid(this, x, y, z, side); + } + + public class FMLEventHandler { + public FMLEventHandler() { + FMLCommonHandler.instance().bus().register(this); + } + + @SubscribeEvent(priority = EventPriority.HIGHEST) + public void onRenderTickStart(TickEvent.RenderTickEvent e) { + if (e.phase == TickEvent.Phase.START) mWorld = Minecraft.getMinecraft().theWorld; + } + } + + public class ForgeEventHandler { + private ForgeEventHandler() { + MinecraftForge.EVENT_BUS.register(this); + } + + @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); + } + + @SubscribeEvent + public void onWorldUnloaded(WorldEvent.Unload e) { + if (!e.world.isRemote) return; + infos.clear(); + index.clear(); + } + } + + private static class BlockInfo { + private final Block block; + private final int meta; + + public BlockInfo(Block block, int meta) { + this.block = block; + this.meta = meta; + } + + @Override + public boolean equals(Object o) { + if (this == o) return true; + if (o == null || getClass() != o.getClass()) return false; + + BlockInfo blockInfo = (BlockInfo) o; + + if (meta != blockInfo.meta) return false; + return block != null ? block.equals(blockInfo.block) : blockInfo.block == null; + } + + @Override + public int hashCode() { + int result = block != null ? block.hashCode() : 0; + result = 31 * result + meta; + return result; + } + } } 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 7ecabaffeb..ae8d804ee9 100644 --- a/src/main/java/gregtech/api/util/GT_Shaped_Recipe.java +++ b/src/main/java/gregtech/api/util/GT_Shaped_Recipe.java @@ -15,7 +15,14 @@ public class GT_Shaped_Recipe extends ShapedOreRecipe implements IGT_CraftingRec private final Enchantment[] mEnchantmentsAdded; private final int[] mEnchantmentLevelsAdded; - public GT_Shaped_Recipe(ItemStack aResult, boolean aDismantleAble, boolean aRemovableByGT, boolean aKeepingNBT, Enchantment[] aEnchantmentsAdded, int[] aEnchantmentLevelsAdded, Object... aRecipe) { + public GT_Shaped_Recipe( + ItemStack aResult, + boolean aDismantleAble, + boolean aRemovableByGT, + boolean aKeepingNBT, + Enchantment[] aEnchantmentsAdded, + int[] aEnchantmentLevelsAdded, + Object... aRecipe) { super(aResult, aRecipe); mEnchantmentsAdded = aEnchantmentsAdded; mEnchantmentLevelsAdded = aEnchantmentLevelsAdded; @@ -33,8 +40,10 @@ 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()))) - return false; + if ((tStack.hasTagCompound() != aGrid.getStackInSlot(i).hasTagCompound()) + || (tStack.hasTagCompound() + && !tStack.getTagCompound() + .equals(aGrid.getStackInSlot(i).getTagCompound()))) return false; } tStack = aGrid.getStackInSlot(i); } @@ -51,25 +60,33 @@ public class GT_Shaped_Recipe extends ShapedOreRecipe implements IGT_CraftingRec GT_Utility.updateItemStack(rStack); // 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()); - break; + 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()); + break; + } } - } // Charge Values if (GT_ModHandler.isElectricItem(rStack)) { GT_ModHandler.dischargeElectricItem(rStack, Integer.MAX_VALUE, Integer.MAX_VALUE, true, false, true); int tCharge = 0; for (int i = 0; i < aGrid.getSizeInventory(); i++) - tCharge += GT_ModHandler.dischargeElectricItem(aGrid.getStackInSlot(i), Integer.MAX_VALUE, Integer.MAX_VALUE, true, true, true); + tCharge += GT_ModHandler.dischargeElectricItem( + aGrid.getStackInSlot(i), Integer.MAX_VALUE, Integer.MAX_VALUE, true, true, true); if (tCharge > 0) GT_ModHandler.chargeElectricItem(rStack, tCharge, Integer.MAX_VALUE, true, false); } // Add Enchantments for (int i = 0; i < mEnchantmentsAdded.length; i++) - GT_Utility.ItemNBT.addEnchantment(rStack, mEnchantmentsAdded[i], EnchantmentHelper.getEnchantmentLevel(mEnchantmentsAdded[i].effectId, rStack) + mEnchantmentLevelsAdded[i]); + GT_Utility.ItemNBT.addEnchantment( + rStack, + mEnchantmentsAdded[i], + EnchantmentHelper.getEnchantmentLevel(mEnchantmentsAdded[i].effectId, rStack) + + mEnchantmentLevelsAdded[i]); // Update the Stack again GT_Utility.updateItemStack(rStack); 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 2718ea3efa..09d8730df5 100644 --- a/src/main/java/gregtech/api/util/GT_Shapeless_Recipe.java +++ b/src/main/java/gregtech/api/util/GT_Shapeless_Recipe.java @@ -15,13 +15,20 @@ public class GT_Shapeless_Recipe extends ShapelessOreRecipe implements IGT_Craft private final Enchantment[] mEnchantmentsAdded; private final int[] mEnchantmentLevelsAdded; - public GT_Shapeless_Recipe(ItemStack aResult, boolean aDismantleAble, boolean aRemovableByGT, boolean aKeepingNBT, Enchantment[] aEnchantmentsAdded, int[] aEnchantmentLevelsAdded, Object... aRecipe) { + public GT_Shapeless_Recipe( + ItemStack aResult, + boolean aDismantleAble, + boolean aRemovableByGT, + boolean aKeepingNBT, + Enchantment[] aEnchantmentsAdded, + int[] aEnchantmentLevelsAdded, + Object... aRecipe) { super(aResult, aRecipe); mEnchantmentsAdded = aEnchantmentsAdded; mEnchantmentLevelsAdded = aEnchantmentLevelsAdded; mRemovableByGT = aRemovableByGT; mKeepingNBT = aKeepingNBT; - if (aDismantleAble){ + if (aDismantleAble) { new ReverseShapelessRecipe(aResult, aRecipe); } } @@ -33,8 +40,10 @@ 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()))) - return false; + if ((tStack.hasTagCompound() != aGrid.getStackInSlot(i).hasTagCompound()) + || (tStack.hasTagCompound() + && !tStack.getTagCompound() + .equals(aGrid.getStackInSlot(i).getTagCompound()))) return false; } tStack = aGrid.getStackInSlot(i); } @@ -51,41 +60,51 @@ public class GT_Shapeless_Recipe extends ShapelessOreRecipe implements IGT_Craft GT_Utility.updateItemStack(rStack); // 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()); - break; + 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()); + break; + } } - } // Charge Values if (GT_ModHandler.isElectricItem(rStack)) { GT_ModHandler.dischargeElectricItem(rStack, Integer.MAX_VALUE, Integer.MAX_VALUE, true, false, true); int tCharge = 0; for (int i = 0; i < aGrid.getSizeInventory(); i++) - tCharge += GT_ModHandler.dischargeElectricItem(aGrid.getStackInSlot(i), Integer.MAX_VALUE, Integer.MAX_VALUE, true, true, true); + tCharge += GT_ModHandler.dischargeElectricItem( + aGrid.getStackInSlot(i), Integer.MAX_VALUE, Integer.MAX_VALUE, true, true, true); if (tCharge > 0) GT_ModHandler.chargeElectricItem(rStack, tCharge, Integer.MAX_VALUE, true, false); } // Saving Ingredients inside the Item. -// if (mDismantleable) { -// NBTTagCompound rNBT = rStack.getTagCompound(), tNBT = new NBTTagCompound(); -// if (rNBT == null) rNBT = new NBTTagCompound(); -// for (int i = 0; i < 9; i++) { -// ItemStack tStack = aGrid.getStackInSlot(i); -// if (tStack != null && GT_Utility.getContainerItem(tStack, true) == null && !(tStack.getItem() instanceof GT_MetaGenerated_Tool)) { -// tStack = GT_Utility.copyAmount(1, tStack); -// GT_ModHandler.dischargeElectricItem(tStack, Integer.MAX_VALUE, Integer.MAX_VALUE, true, false, true); -// tNBT.setTag("Ingredient." + i, tStack.writeToNBT(new NBTTagCompound())); -// } -// } -// rNBT.setTag("GT.CraftingComponents", tNBT); -// rStack.setTagCompound(rNBT); -// } + // if (mDismantleable) { + // NBTTagCompound rNBT = rStack.getTagCompound(), tNBT = new NBTTagCompound(); + // if (rNBT == null) rNBT = new NBTTagCompound(); + // for (int i = 0; i < 9; i++) { + // ItemStack tStack = aGrid.getStackInSlot(i); + // if (tStack != null && GT_Utility.getContainerItem(tStack, true) == null && + // !(tStack.getItem() instanceof GT_MetaGenerated_Tool)) { + // tStack = GT_Utility.copyAmount(1, tStack); + // GT_ModHandler.dischargeElectricItem(tStack, Integer.MAX_VALUE, Integer.MAX_VALUE, + // true, false, true); + // tNBT.setTag("Ingredient." + i, tStack.writeToNBT(new NBTTagCompound())); + // } + // } + // rNBT.setTag("GT.CraftingComponents", tNBT); + // rStack.setTagCompound(rNBT); + // } // Add Enchantments for (int i = 0; i < mEnchantmentsAdded.length; i++) - GT_Utility.ItemNBT.addEnchantment(rStack, mEnchantmentsAdded[i], EnchantmentHelper.getEnchantmentLevel(mEnchantmentsAdded[i].effectId, rStack) + mEnchantmentLevelsAdded[i]); + GT_Utility.ItemNBT.addEnchantment( + rStack, + mEnchantmentsAdded[i], + EnchantmentHelper.getEnchantmentLevel(mEnchantmentsAdded[i].effectId, rStack) + + mEnchantmentLevelsAdded[i]); // Update the Stack again GT_Utility.updateItemStack(rStack); 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 0be96a2e05..5ff631fad6 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 @@ -3,13 +3,12 @@ package gregtech.api.util; import com.google.common.collect.ImmutableMap; import com.google.common.collect.Maps; import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_MultiBlockBase; -import net.minecraft.item.ItemStack; -import net.minecraftforge.fluids.Fluid; -import net.minecraftforge.fluids.FluidStack; - import java.util.HashMap; import java.util.List; import java.util.Map; +import net.minecraft.item.ItemStack; +import net.minecraftforge.fluids.Fluid; +import net.minecraftforge.fluids.FluidStack; /** Used by machines that are locked to a single recipe, for fast computation. */ public class GT_Single_Recipe_Check { @@ -31,8 +30,10 @@ 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() { @@ -51,7 +52,8 @@ public class GT_Single_Recipe_Check { itemMap = new HashMap<>(); for (ItemStack itemStack : multiBlockBase.getStoredInputs()) { itemMap.merge( - GT_Utility.ItemId.createNoCopy(itemStack), itemStack, + GT_Utility.ItemId.createNoCopy(itemStack), + itemStack, (a, b) -> a.stackSize >= b.stackSize ? a : b); } @@ -67,9 +69,7 @@ public class GT_Single_Recipe_Check { if (totalFluidCost > 0) { fluidMap = new HashMap<>(); for (FluidStack fluidStack : multiBlockBase.getStoredFluids()) { - fluidMap.merge( - fluidStack.getFluid(), fluidStack, - (a, b) -> a.amount >= b.amount ? a : b); + fluidMap.merge(fluidStack.getFluid(), fluidStack, (a, b) -> a.amount >= b.amount ? a : b); } for (Map.Entry<Fluid, Integer> entry : fluidCost.entrySet()) { @@ -173,8 +173,7 @@ public class GT_Single_Recipe_Check { return true; } - protected static Map<GT_Utility.ItemId, Integer> buildItemMap( - GT_MetaTileEntity_MultiBlockBase multiBlockBase) { + protected static Map<GT_Utility.ItemId, Integer> buildItemMap(GT_MetaTileEntity_MultiBlockBase multiBlockBase) { Map<GT_Utility.ItemId, Integer> itemMap = new HashMap<>(); for (ItemStack itemStack : multiBlockBase.getStoredInputs()) { itemMap.merge(GT_Utility.ItemId.create(itemStack), itemStack.stackSize, Integer::sum); @@ -182,8 +181,7 @@ public class GT_Single_Recipe_Check { return itemMap; } - protected static Map<Fluid, Integer> buildFluidMap( - GT_MetaTileEntity_MultiBlockBase multiBlockBase) { + protected static Map<Fluid, Integer> buildFluidMap(GT_MetaTileEntity_MultiBlockBase multiBlockBase) { Map<Fluid, Integer> fluidMap = new HashMap<>(); for (FluidStack fluidStack : multiBlockBase.getStoredFluids()) { fluidMap.merge(fluidStack.getFluid(), fluidStack.amount, Integer::sum); @@ -251,6 +249,4 @@ public class GT_Single_Recipe_Check { multiBlockBase, recipe, itemCostBuilder.build(), fluidCostBuilder.build()); } } - - } 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 871cb642c4..585460842d 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 @@ -2,14 +2,13 @@ package gregtech.api.util; import com.google.common.collect.ImmutableMap; import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_MultiBlockBase; -import net.minecraft.item.ItemStack; -import net.minecraftforge.fluids.Fluid; -import net.minecraftforge.fluids.FluidStack; - import java.util.HashMap; import java.util.List; import java.util.Map; import java.util.stream.Collectors; +import net.minecraft.item.ItemStack; +import net.minecraftforge.fluids.Fluid; +import net.minecraftforge.fluids.FluidStack; /** Processing Array-specialized version of {@link gregtech.api.util.GT_Single_Recipe_Check}. */ public class GT_Single_Recipe_Check_Processing_Array extends GT_Single_Recipe_Check { @@ -94,12 +93,8 @@ 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); @@ -117,12 +112,8 @@ 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(); @@ -205,8 +196,12 @@ public class GT_Single_Recipe_Check_Processing_Array extends GT_Single_Recipe_Ch } return new GT_Single_Recipe_Check_Processing_Array( - multiBlockBase, recipe, itemCostBuilder.build(), fluidCostBuilder.build(), - recipeAmperage, multiBlockBase.mInventory[1].copy()); + multiBlockBase, + recipe, + itemCostBuilder.build(), + fluidCostBuilder.build(), + recipeAmperage, + multiBlockBase.mInventory[1].copy()); } } } diff --git a/src/main/java/gregtech/api/util/GT_SpawnEventHandler.java b/src/main/java/gregtech/api/util/GT_SpawnEventHandler.java index 9edb64a196..38c43da7c2 100644 --- a/src/main/java/gregtech/api/util/GT_SpawnEventHandler.java +++ b/src/main/java/gregtech/api/util/GT_SpawnEventHandler.java @@ -4,15 +4,14 @@ import cpw.mods.fml.common.eventhandler.Event; import cpw.mods.fml.common.eventhandler.SubscribeEvent; import gregtech.api.metatileentity.BaseMetaTileEntity; import gregtech.common.tileentities.machines.basic.GT_MetaTileEntity_MonsterRepellent; +import java.util.List; +import java.util.concurrent.CopyOnWriteArrayList; import net.minecraft.entity.EnumCreatureType; import net.minecraft.entity.monster.EntitySlime; import net.minecraft.tileentity.TileEntity; import net.minecraftforge.common.MinecraftForge; import net.minecraftforge.event.entity.living.LivingSpawnEvent.CheckSpawn; -import java.util.List; -import java.util.concurrent.CopyOnWriteArrayList; - public class GT_SpawnEventHandler { public static volatile List<int[]> mobReps = new CopyOnWriteArrayList<>(); @@ -23,8 +22,9 @@ public class GT_SpawnEventHandler { @SubscribeEvent public void denyMobSpawn(CheckSpawn event) { - if (event.entityLiving instanceof EntitySlime && !(((EntitySlime) event.entityLiving).getCustomNameTag().length() > 0)) { - if(event.getResult() == Event.Result.ALLOW) event.setResult(Event.Result.DEFAULT); + if (event.entityLiving instanceof EntitySlime + && !(((EntitySlime) event.entityLiving).getCustomNameTag().length() > 0)) { + if (event.getResult() == Event.Result.ALLOW) event.setResult(Event.Result.DEFAULT); } if (event.getResult() == Event.Result.ALLOW) { @@ -35,13 +35,17 @@ public class GT_SpawnEventHandler { for (int[] rep : mobReps) { if (rep[3] == event.entity.worldObj.provider.dimensionId) { TileEntity tTile = event.entity.worldObj.getTileEntity(rep[0], rep[1], rep[2]); - if (tTile instanceof BaseMetaTileEntity && ((BaseMetaTileEntity) tTile).getMetaTileEntity() instanceof GT_MetaTileEntity_MonsterRepellent) { - int r = ((GT_MetaTileEntity_MonsterRepellent) ((BaseMetaTileEntity) tTile).getMetaTileEntity()).mRange; + if (tTile instanceof BaseMetaTileEntity + && ((BaseMetaTileEntity) tTile).getMetaTileEntity() + instanceof GT_MetaTileEntity_MonsterRepellent) { + int r = ((GT_MetaTileEntity_MonsterRepellent) ((BaseMetaTileEntity) tTile).getMetaTileEntity()) + .mRange; double dx = rep[0] + 0.5F - event.entity.posX; double dy = rep[1] + 0.5F - event.entity.posY; double dz = rep[2] + 0.5F - event.entity.posZ; if ((dx * dx + dz * dz + dy * dy) <= Math.pow(r, 2)) { - if(event.entityLiving instanceof EntitySlime) ((EntitySlime) event.entityLiving).setCustomNameTag("DoNotSpawnSlimes"); + if (event.entityLiving instanceof EntitySlime) + ((EntitySlime) event.entityLiving).setCustomNameTag("DoNotSpawnSlimes"); event.setResult(Event.Result.DENY); } } diff --git a/src/main/java/gregtech/api/util/GT_StructureUtility.java b/src/main/java/gregtech/api/util/GT_StructureUtility.java index dc3112621e..ef7724db0a 100644 --- a/src/main/java/gregtech/api/util/GT_StructureUtility.java +++ b/src/main/java/gregtech/api/util/GT_StructureUtility.java @@ -15,11 +15,13 @@ import gregtech.api.interfaces.metatileentity.IMetaTileEntity; import gregtech.api.interfaces.tileentity.IGregTechTileEntity; import gregtech.api.metatileentity.BaseMetaPipeEntity; import gregtech.api.metatileentity.implementations.GT_MetaPipeEntity_Frame; -import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_EnhancedMultiBlockBase; -import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_MultiBlockBase; import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_TieredMachineBlock; import gregtech.common.blocks.GT_Block_Casings5; import gregtech.common.blocks.GT_Item_Machines; +import java.util.Arrays; +import java.util.List; +import java.util.function.*; +import javax.annotation.Nonnull; import net.minecraft.block.Block; import net.minecraft.entity.player.EntityPlayerMP; import net.minecraft.init.Items; @@ -32,11 +34,6 @@ import net.minecraft.util.IChatComponent; import net.minecraft.util.IIcon; import net.minecraft.world.World; -import javax.annotation.Nonnull; -import java.util.Arrays; -import java.util.List; -import java.util.function.*; - public class GT_StructureUtility { // private static final Map<Class<?>, String> customNames = new HashMap<>(); private GT_StructureUtility() { @@ -47,7 +44,8 @@ public class GT_StructureUtility { return aTile != null && clazz.isInstance(aTile.getMetaTileEntity()); } - public static <T> IStructureElementNoPlacement<T> ofHatchAdder(IGT_HatchAdder<T> aHatchAdder, int aTextureIndex, int aDots) { + public static <T> IStructureElementNoPlacement<T> ofHatchAdder( + IGT_HatchAdder<T> aHatchAdder, int aTextureIndex, int aDots) { return ofHatchAdder(aHatchAdder, aTextureIndex, StructureLibAPI.getBlockHint(), aDots - 1); } @@ -85,16 +83,37 @@ public class GT_StructureUtility { if (!GT_Utility.isStackValid(tFrameStack) || !(tFrameStack.getItem() instanceof ItemBlock)) return false; ItemBlock tFrameStackItem = (ItemBlock) tFrameStack.getItem(); - return tFrameStackItem.placeBlockAt(tFrameStack, null, world, x, y, z, 6, 0, 0, 0, Items.feather.getDamage(tFrameStack)); + return tFrameStackItem.placeBlockAt( + tFrameStack, null, world, x, y, z, 6, 0, 0, 0, Items.feather.getDamage(tFrameStack)); } @Override - public PlaceResult survivalPlaceBlock(T t, World world, int x, int y, int z, ItemStack trigger, IItemSource s, EntityPlayerMP actor, Consumer<IChatComponent> chatter) { + 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 PlaceResult.SKIP; ItemStack tFrameStack = GT_OreDictUnificator.get(OrePrefixes.frameGt, aFrameMaterial, 1); if (!GT_Utility.isStackValid(tFrameStack) || !(tFrameStack.getItem() instanceof ItemBlock)) return PlaceResult.REJECT; // honestly, this is more like a programming error or pack issue - return StructureUtility.survivalPlaceBlock(tFrameStack, ItemStackPredicate.NBTMode.IGNORE_KNOWN_INSIGNIFICANT_TAGS, null, false, world, x, y, z, s, actor, chatter); + return StructureUtility.survivalPlaceBlock( + tFrameStack, + ItemStackPredicate.NBTMode.IGNORE_KNOWN_INSIGNIFICANT_TAGS, + null, + false, + world, + x, + y, + z, + s, + actor, + chatter); } }; } @@ -110,7 +129,8 @@ public class GT_StructureUtility { return GT_HatchElementBuilder.builder(); } - public static <T> IStructureElementNoPlacement<T> ofHatchAdder(IGT_HatchAdder<T> aHatchAdder, int aTextureIndex, Block aHintBlock, int aHintMeta) { + public static <T> IStructureElementNoPlacement<T> ofHatchAdder( + IGT_HatchAdder<T> aHatchAdder, int aTextureIndex, Block aHintBlock, int aHintMeta) { if (aHatchAdder == null || aHintBlock == null) { throw new IllegalArgumentException(); } @@ -118,7 +138,8 @@ public class GT_StructureUtility { @Override public boolean check(T t, World world, int x, int y, int z) { TileEntity tileEntity = world.getTileEntity(x, y, z); - return tileEntity instanceof IGregTechTileEntity && aHatchAdder.apply(t, (IGregTechTileEntity) tileEntity, (short) aTextureIndex); + return tileEntity instanceof IGregTechTileEntity + && aHatchAdder.apply(t, (IGregTechTileEntity) tileEntity, (short) aTextureIndex); } @Override @@ -129,7 +150,14 @@ public class GT_StructureUtility { }; } - public static <T> IStructureElement<T> ofHatchAdder(IGT_HatchAdder<T> aHatchAdder, int aTextureIndex, Block aHintBlock, int aHintMeta, BiPredicate<T, IGregTechTileEntity> shouldSkip, Function<T, Class<? extends IMetaTileEntity>> aMetaId, final IStructureElement.PlaceResult acceptType) { + public static <T> IStructureElement<T> ofHatchAdder( + IGT_HatchAdder<T> aHatchAdder, + int aTextureIndex, + Block aHintBlock, + int aHintMeta, + BiPredicate<T, IGregTechTileEntity> shouldSkip, + Function<T, Class<? extends IMetaTileEntity>> aMetaId, + final IStructureElement.PlaceResult acceptType) { if (aHatchAdder == null) { throw new IllegalArgumentException(); } @@ -137,7 +165,8 @@ public class GT_StructureUtility { @Override public boolean check(T t, World world, int x, int y, int z) { TileEntity tileEntity = world.getTileEntity(x, y, z); - return tileEntity instanceof IGregTechTileEntity && aHatchAdder.apply(t, (IGregTechTileEntity) tileEntity, (short) aTextureIndex); + return tileEntity instanceof IGregTechTileEntity + && aHatchAdder.apply(t, (IGregTechTileEntity) tileEntity, (short) aTextureIndex); } @Override @@ -153,29 +182,45 @@ public class GT_StructureUtility { } @Override - public PlaceResult survivalPlaceBlock(T t, World world, int x, int y, int z, ItemStack trigger, IItemSource s, EntityPlayerMP actor, Consumer<IChatComponent> chatter) { + public PlaceResult survivalPlaceBlock( + T t, + World world, + int x, + int y, + int z, + ItemStack trigger, + IItemSource s, + EntityPlayerMP actor, + Consumer<IChatComponent> chatter) { if (shouldSkip != null) { TileEntity tileEntity = world.getTileEntity(x, y, z); - if (tileEntity instanceof IGregTechTileEntity && shouldSkip.test(t, (IGregTechTileEntity) tileEntity)) - return PlaceResult.SKIP; + if (tileEntity instanceof IGregTechTileEntity + && shouldSkip.test(t, (IGregTechTileEntity) tileEntity)) return PlaceResult.SKIP; } - if (!StructureLibAPI.isBlockTriviallyReplaceable(world, x, y, z, actor)) - return PlaceResult.REJECT; + if (!StructureLibAPI.isBlockTriviallyReplaceable(world, x, y, z, actor)) return PlaceResult.REJECT; Class<? extends IMetaTileEntity> clazz = aMetaId.apply(t); if (clazz == null) return PlaceResult.REJECT; ItemStack taken = s.takeOne(is -> clazz.isInstance(GT_Item_Machines.getMetaTileEntity(is)), true); if (GT_Utility.isStackInvalid(taken)) { - chatter.accept(new ChatComponentTranslation("GT5U.autoplace.error.no_mte.class_name", clazz.getSimpleName())); + chatter.accept(new ChatComponentTranslation( + "GT5U.autoplace.error.no_mte.class_name", clazz.getSimpleName())); return PlaceResult.REJECT; } - if (StructureUtility.survivalPlaceBlock(taken, ItemStackPredicate.NBTMode.IGNORE, null, true, world, x, y, z, s, actor) == PlaceResult.ACCEPT) - return acceptType; + if (StructureUtility.survivalPlaceBlock( + taken, ItemStackPredicate.NBTMode.IGNORE, null, true, world, x, y, z, s, actor) + == PlaceResult.ACCEPT) return acceptType; return PlaceResult.REJECT; } }; } - public static <T> IStructureElement<T> ofHatchAdder(IGT_HatchAdder<T> aHatchAdder, int aTextureIndex, Block aHintBlock, int aHintMeta, BiPredicate<T, IGregTechTileEntity> shouldSkip, ToIntFunction<T> aMetaId) { + public static <T> IStructureElement<T> ofHatchAdder( + IGT_HatchAdder<T> aHatchAdder, + int aTextureIndex, + Block aHintBlock, + int aHintMeta, + BiPredicate<T, IGregTechTileEntity> shouldSkip, + ToIntFunction<T> aMetaId) { if (aHatchAdder == null) { throw new IllegalArgumentException(); } @@ -183,7 +228,8 @@ public class GT_StructureUtility { @Override public boolean check(T t, World world, int x, int y, int z) { TileEntity tileEntity = world.getTileEntity(x, y, z); - return tileEntity instanceof IGregTechTileEntity && aHatchAdder.apply(t, (IGregTechTileEntity) tileEntity, (short) aTextureIndex); + return tileEntity instanceof IGregTechTileEntity + && aHatchAdder.apply(t, (IGregTechTileEntity) tileEntity, (short) aTextureIndex); } @Override @@ -199,14 +245,22 @@ public class GT_StructureUtility { } @Override - public PlaceResult survivalPlaceBlock(T t, World world, int x, int y, int z, ItemStack trigger, IItemSource s, EntityPlayerMP actor, Consumer<IChatComponent> chatter) { + public PlaceResult survivalPlaceBlock( + T t, + World world, + int x, + int y, + int z, + ItemStack trigger, + IItemSource s, + EntityPlayerMP actor, + Consumer<IChatComponent> chatter) { if (shouldSkip != null) { TileEntity tileEntity = world.getTileEntity(x, y, z); - if (tileEntity instanceof IGregTechTileEntity && shouldSkip.test(t, (IGregTechTileEntity) tileEntity)) - return PlaceResult.SKIP; + if (tileEntity instanceof IGregTechTileEntity + && shouldSkip.test(t, (IGregTechTileEntity) tileEntity)) return PlaceResult.SKIP; } - if (!StructureLibAPI.isBlockTriviallyReplaceable(world, x, y, z, actor)) - return PlaceResult.REJECT; + if (!StructureLibAPI.isBlockTriviallyReplaceable(world, x, y, z, actor)) return PlaceResult.REJECT; GT_Item_Machines item = (GT_Item_Machines) Item.getItemFromBlock(GregTech_API.sBlockMachines); int meta = aMetaId.applyAsInt(t); if (meta < 0) return PlaceResult.REJECT; @@ -215,16 +269,28 @@ public class GT_StructureUtility { chatter.accept(new ChatComponentTranslation("GT5U.autoplace.error.no_mte.id", meta)); return PlaceResult.REJECT; } - return StructureUtility.survivalPlaceBlock(taken, ItemStackPredicate.NBTMode.IGNORE, null, true, world, x, y, z, s, actor) == PlaceResult.ACCEPT ? PlaceResult.ACCEPT_STOP : PlaceResult.REJECT; + return StructureUtility.survivalPlaceBlock( + taken, ItemStackPredicate.NBTMode.IGNORE, null, true, world, x, y, z, s, actor) + == PlaceResult.ACCEPT + ? PlaceResult.ACCEPT_STOP + : PlaceResult.REJECT; } }; } - public static <T> IStructureElement<T> ofHatchAdderOptional(IGT_HatchAdder<T> aHatchAdder, int textureIndex, int dots, Block placeCasing, int placeCasingMeta) { - return ofHatchAdderOptional(aHatchAdder, textureIndex, StructureLibAPI.getBlockHint(), dots - 1, placeCasing, placeCasingMeta); + public static <T> IStructureElement<T> ofHatchAdderOptional( + IGT_HatchAdder<T> aHatchAdder, int textureIndex, int dots, Block placeCasing, int placeCasingMeta) { + return ofHatchAdderOptional( + aHatchAdder, textureIndex, StructureLibAPI.getBlockHint(), dots - 1, placeCasing, placeCasingMeta); } - public static <T> IStructureElement<T> ofHatchAdderOptional(IGT_HatchAdder<T> aHatchAdder, int aTextureIndex, Block aHintBlock, int hintMeta, Block placeCasing, int placeCasingMeta) { + public static <T> IStructureElement<T> ofHatchAdderOptional( + IGT_HatchAdder<T> aHatchAdder, + int aTextureIndex, + Block aHintBlock, + int hintMeta, + Block placeCasing, + int placeCasingMeta) { if (aHatchAdder == null || aHintBlock == null) { throw new IllegalArgumentException(); } @@ -233,9 +299,9 @@ public class GT_StructureUtility { public boolean check(T t, World world, int x, int y, int z) { TileEntity tileEntity = world.getTileEntity(x, y, z); Block worldBlock = world.getBlock(x, y, z); - return (tileEntity instanceof IGregTechTileEntity && - aHatchAdder.apply(t, (IGregTechTileEntity) tileEntity, (short) aTextureIndex)) || - (worldBlock == placeCasing && worldBlock.getDamageValue(world, x, y, z) == placeCasingMeta); + return (tileEntity instanceof IGregTechTileEntity + && aHatchAdder.apply(t, (IGregTechTileEntity) tileEntity, (short) aTextureIndex)) + || (worldBlock == placeCasing && worldBlock.getDamageValue(world, x, y, z) == placeCasingMeta); } @Override @@ -251,9 +317,19 @@ public class GT_StructureUtility { } @Override - public PlaceResult survivalPlaceBlock(T t, World world, int x, int y, int z, ItemStack trigger, IItemSource s, EntityPlayerMP actor, Consumer<IChatComponent> chatter) { + 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 PlaceResult.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); } }; } @@ -263,11 +339,14 @@ public class GT_StructureUtility { * * @see #ofCoil(BiPredicate, Function) */ - public static <T> IStructureElement<T> ofCoil(BiConsumer<T, HeatingCoilLevel> aHeatingCoilSetter, Function<T, HeatingCoilLevel> aHeatingCoilGetter) { - return ofCoil((t, l) -> { - aHeatingCoilSetter.accept(t, l); - return true; - }, aHeatingCoilGetter); + public static <T> IStructureElement<T> ofCoil( + BiConsumer<T, HeatingCoilLevel> aHeatingCoilSetter, Function<T, HeatingCoilLevel> aHeatingCoilGetter) { + return ofCoil( + (t, l) -> { + aHeatingCoilSetter.accept(t, l); + return true; + }, + aHeatingCoilGetter); } /** @@ -279,7 +358,8 @@ public class GT_StructureUtility { * If the setter returns false then it assumes the coil is rejected. * @param aHeatingCoilGetter Get the current heating level. Null means no coil recorded yet. */ - public static <T> IStructureElement<T> ofCoil(BiPredicate<T, HeatingCoilLevel> aHeatingCoilSetter, Function<T, HeatingCoilLevel> aHeatingCoilGetter) { + public static <T> IStructureElement<T> ofCoil( + BiPredicate<T, HeatingCoilLevel> aHeatingCoilSetter, Function<T, HeatingCoilLevel> aHeatingCoilGetter) { if (aHeatingCoilSetter == null || aHeatingCoilGetter == null) { throw new IllegalArgumentException(); } @@ -287,10 +367,9 @@ public class GT_StructureUtility { @Override public boolean check(T t, World world, int x, int y, int z) { Block block = world.getBlock(x, y, z); - if (!(block instanceof IHeatingCoil)) - return false; + if (!(block instanceof IHeatingCoil)) return false; HeatingCoilLevel existingLevel = aHeatingCoilGetter.apply(t), - newLevel = ((IHeatingCoil) block).getCoilHeat(world.getBlockMetadata(x, y, z)); + newLevel = ((IHeatingCoil) block).getCoilHeat(world.getBlockMetadata(x, y, z)); if (existingLevel == null || existingLevel == HeatingCoilLevel.None) { return aHeatingCoilSetter.test(t, newLevel); } else { @@ -309,7 +388,8 @@ public class GT_StructureUtility { } private HeatingCoilLevel getHeatFromHint(ItemStack trigger) { - return HeatingCoilLevel.getFromTier((byte) Math.min(HeatingCoilLevel.getMaxTier() , Math.max(0, trigger.stackSize - 1))); + return HeatingCoilLevel.getFromTier( + (byte) Math.min(HeatingCoilLevel.getMaxTier(), Math.max(0, trigger.stackSize - 1))); } @Override @@ -318,11 +398,23 @@ public class GT_StructureUtility { } @Override - public PlaceResult survivalPlaceBlock(T t, World world, int x, int y, int z, ItemStack trigger, IItemSource s, EntityPlayerMP actor, Consumer<IChatComponent> chatter) { + public PlaceResult survivalPlaceBlock( + T t, + World world, + int x, + int y, + int z, + ItemStack trigger, + IItemSource s, + EntityPlayerMP actor, + Consumer<IChatComponent> chatter) { Block block = world.getBlock(x, y, z); - boolean isCoil = block instanceof IHeatingCoil && ((IHeatingCoil) block).getCoilHeat(world.getBlockMetadata(x, y, z)) == getHeatFromHint(trigger); + boolean isCoil = block instanceof IHeatingCoil + && ((IHeatingCoil) block).getCoilHeat(world.getBlockMetadata(x, y, z)) + == getHeatFromHint(trigger); if (isCoil) return PlaceResult.SKIP; - return StructureUtility.survivalPlaceBlock(GregTech_API.sBlockCasings5, getMetaFromHint(trigger), world, x, y, z, s, actor, chatter); + return StructureUtility.survivalPlaceBlock( + GregTech_API.sBlockCasings5, getMetaFromHint(trigger), world, x, y, z, s, actor, chatter); } }; } @@ -339,9 +431,9 @@ public class GT_StructureUtility { public static Predicate<ItemStack> filterByMTETier(int aMinTier, int aMaxTier) { return is -> { IMetaTileEntity tile = GT_Item_Machines.getMetaTileEntity(is); - return tile instanceof GT_MetaTileEntity_TieredMachineBlock && - ((GT_MetaTileEntity_TieredMachineBlock) tile).mTier <= aMaxTier && - ((GT_MetaTileEntity_TieredMachineBlock) tile).mTier >= aMinTier; + return tile instanceof GT_MetaTileEntity_TieredMachineBlock + && ((GT_MetaTileEntity_TieredMachineBlock) tile).mTier <= aMaxTier + && ((GT_MetaTileEntity_TieredMachineBlock) tile).mTier >= aMinTier; }; } } diff --git a/src/main/java/gregtech/api/util/GT_ToolHarvestHelper.java b/src/main/java/gregtech/api/util/GT_ToolHarvestHelper.java index 271b361da0..7416289c79 100644 --- a/src/main/java/gregtech/api/util/GT_ToolHarvestHelper.java +++ b/src/main/java/gregtech/api/util/GT_ToolHarvestHelper.java @@ -1,61 +1,57 @@ -package gregtech.api.util;
-
-import net.minecraft.block.Block;
-import net.minecraft.block.material.Material;
-
-public class GT_ToolHarvestHelper {
-
- public static boolean isAppropriateTool(Block aBlock, byte aMetaData, String... tTools) {
-
- if (aBlock == null || tTools == null) {
- return false;
- }
- String targetTool = aBlock.getHarvestTool(aMetaData);
- return !isStringEmpty(targetTool) && isArrayContains(targetTool, tTools);
- }
-
- public static boolean isAppropriateMaterial(Block aBlock, Material... tMats) {
- if (aBlock == null || tMats == null) {
- return false;
- }
- return isArrayContains(aBlock.getMaterial(), tMats);
- }
-
-
- public static boolean isSpecialBlock(Block aBlock, Block... tBlocks) {
- if (aBlock == null || tBlocks == null) {
- return false;
- }
- return isArrayContains(aBlock, tBlocks);
- }
-
-
- public static <T> boolean isArrayContains(T obj, T[] list) {
-
- if (obj == null || list == null) {
- return false;
- }
-
- for (T iObj : list) {
- if (obj == iObj || obj.equals(iObj)) {
- return true;
- }
- }
- return false;
- }
-
- public static boolean isStringEmpty(String s) {
- return s == null || s.length() == 0;
- }
-
- public static boolean hasNull(Object... obj) {
- for (Object iObj : obj) {
- if (iObj == null) {
- return true;
- }
- }
- return false;
- }
-
-
-}
+package gregtech.api.util; + +import net.minecraft.block.Block; +import net.minecraft.block.material.Material; + +public class GT_ToolHarvestHelper { + + public static boolean isAppropriateTool(Block aBlock, byte aMetaData, String... tTools) { + + if (aBlock == null || tTools == null) { + return false; + } + String targetTool = aBlock.getHarvestTool(aMetaData); + return !isStringEmpty(targetTool) && isArrayContains(targetTool, tTools); + } + + public static boolean isAppropriateMaterial(Block aBlock, Material... tMats) { + if (aBlock == null || tMats == null) { + return false; + } + return isArrayContains(aBlock.getMaterial(), tMats); + } + + public static boolean isSpecialBlock(Block aBlock, Block... tBlocks) { + if (aBlock == null || tBlocks == null) { + return false; + } + return isArrayContains(aBlock, tBlocks); + } + + public static <T> boolean isArrayContains(T obj, T[] list) { + + if (obj == null || list == null) { + return false; + } + + for (T iObj : list) { + if (obj == iObj || obj.equals(iObj)) { + return true; + } + } + return false; + } + + public static boolean isStringEmpty(String s) { + return s == null || s.length() == 0; + } + + public static boolean hasNull(Object... obj) { + for (Object iObj : obj) { + if (iObj == null) { + return true; + } + } + return false; + } +} diff --git a/src/main/java/gregtech/api/util/GT_TooltipDataCache.java b/src/main/java/gregtech/api/util/GT_TooltipDataCache.java index 4309958b82..15f7b69248 100644 --- a/src/main/java/gregtech/api/util/GT_TooltipDataCache.java +++ b/src/main/java/gregtech/api/util/GT_TooltipDataCache.java @@ -1,11 +1,10 @@ package gregtech.api.util; +import gregtech.GT_Mod; import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.Map; - -import gregtech.GT_Mod; import net.minecraft.util.StatCollector; public class GT_TooltipDataCache { @@ -19,6 +18,7 @@ public class GT_TooltipDataCache { this.shiftText = shiftText; } } + private final Map<String, TooltipData> fetchedTooltipData = new HashMap<>(); /** @@ -48,14 +48,16 @@ public class GT_TooltipDataCache { List<String> lines = getAllLines(key, args); int normalLines = lines.size(); if (Math.max(GT_Mod.gregtechproxy.mTooltipVerbosity, GT_Mod.gregtechproxy.mTooltipShiftVerbosity) >= 3) { - lines.addAll(getAllLines(key + ".extended", args)); // Are extended lines enabled? If so add them to the lines + lines.addAll( + getAllLines(key + ".extended", args)); // Are extended lines enabled? If so add them to the lines } if (lines.size() == 0) { lines.add(key); // Fallback in case no lines could be found at all } return new TooltipData( - lines.subList(0, getVerbosityIndex(GT_Mod.gregtechproxy.mTooltipVerbosity, normalLines, lines.size())), - lines.subList(0, getVerbosityIndex(GT_Mod.gregtechproxy.mTooltipShiftVerbosity, normalLines, lines.size()))); + lines.subList(0, getVerbosityIndex(GT_Mod.gregtechproxy.mTooltipVerbosity, normalLines, lines.size())), + lines.subList( + 0, getVerbosityIndex(GT_Mod.gregtechproxy.mTooltipShiftVerbosity, normalLines, lines.size()))); } /** @@ -65,7 +67,7 @@ public class GT_TooltipDataCache { * @param args arguments for string formatting (prefer using positional arguments) * @return The lines for the key and all of it's subkeys */ - private List<String> getAllLines(String key, Object... args) { + private List<String> getAllLines(String key, Object... args) { List<String> lines = new ArrayList<String>(); String keyToLookup = key; int i = 1; // First loop has no .number postfix diff --git a/src/main/java/gregtech/api/util/GT_Util.java b/src/main/java/gregtech/api/util/GT_Util.java index 2d1a1e389d..9de1726162 100644 --- a/src/main/java/gregtech/api/util/GT_Util.java +++ b/src/main/java/gregtech/api/util/GT_Util.java @@ -20,10 +20,11 @@ public class GT_Util { } public static NBTTagCompound fuseNBT(NBTTagCompound aNBT1, NBTTagCompound aNBT2) { - if (aNBT1 == null) return aNBT2 == null ? new NBTTagCompound() : (NBTTagCompound)aNBT2.copy(); - final NBTTagCompound rNBT = (NBTTagCompound)aNBT1.copy(); + if (aNBT1 == null) return aNBT2 == null ? new NBTTagCompound() : (NBTTagCompound) aNBT2.copy(); + final NBTTagCompound rNBT = (NBTTagCompound) aNBT1.copy(); if (aNBT2 == null) return rNBT; - for (Object tKey : aNBT2.func_150296_c/*getKeySet*/()) if (!rNBT.hasKey(tKey.toString())) rNBT.setTag(tKey.toString(), aNBT2.getTag(tKey.toString())); + for (Object tKey : aNBT2.func_150296_c /*getKeySet*/()) + if (!rNBT.hasKey(tKey.toString())) rNBT.setTag(tKey.toString(), aNBT2.getTag(tKey.toString())); return rNBT; } @@ -32,29 +33,22 @@ public class GT_Util { */ public static NBTTagCompound makeNBT(Tuple... aTags) { final NBTTagCompound rNBT = new NBTTagCompound(); - for(Tuple t : aTags) { + 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()); + 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 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()); + 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; @@ -66,37 +60,41 @@ public class GT_Util { public static TileEntity getTileEntity(World aWorld, int aX, int aY, int aZ, boolean aLoadUnloadedChunks) { if (aLoadUnloadedChunks || aWorld.blockExists(aX, aY, aZ)) { TileEntity rTileEntity = aWorld.getTileEntity(aX, aY, aZ); - if (rTileEntity instanceof IMultiTileEntity && ((IMultiTileEntity)rTileEntity).isDead()) return null; + if (rTileEntity instanceof IMultiTileEntity && ((IMultiTileEntity) rTileEntity).isDead()) return null; if (rTileEntity != null) return rTileEntity; rTileEntity = LAST_BROKEN_TILEENTITY.get(); - if (rTileEntity != null && rTileEntity.xCoord == aX && rTileEntity.yCoord == aY && rTileEntity.zCoord == aZ) return rTileEntity; + if (rTileEntity != null && rTileEntity.xCoord == aX && rTileEntity.yCoord == aY && rTileEntity.zCoord == aZ) + return rTileEntity; } return null; } /** Sets the TileEntity at the passed position, with the option of turning adjacent TileEntity updates off. */ - public static TileEntity setTileEntity(World aWorld, int aX, int aY, int aZ, TileEntity aTileEntity, boolean aCauseTileEntityUpdates) { - if (aCauseTileEntityUpdates) aWorld.setTileEntity(aX, aY, aZ, aTileEntity); else { + public static TileEntity setTileEntity( + World aWorld, int aX, int aY, int aZ, TileEntity aTileEntity, boolean aCauseTileEntityUpdates) { + if (aCauseTileEntityUpdates) aWorld.setTileEntity(aX, aY, aZ, aTileEntity); + else { Chunk tChunk = aWorld.getChunkFromChunkCoords(aX >> 4, aZ >> 4); if (tChunk != null) { aWorld.addTileEntity(aTileEntity); - tChunk.func_150812_a/*setBlockTileEntityInChunk*/(aX & 15, aY, aZ & 15, aTileEntity); + tChunk.func_150812_a /*setBlockTileEntityInChunk*/(aX & 15, aY, aZ & 15, aTileEntity); tChunk.setChunkModified(); } } return aTileEntity; } - public static boolean setTileEntity(World aWorld, int aX, int aY, int aZ, Block aBlock, short aMeta, long aFlags, boolean aRemoveGrassBelow) { + public static boolean setTileEntity( + World aWorld, int aX, int aY, int aZ, Block aBlock, short aMeta, long aFlags, boolean aRemoveGrassBelow) { if (aRemoveGrassBelow) { - final Block tBlock = aWorld.getBlock(aX, aY-1, aZ); - if (tBlock == Blocks.grass || tBlock == Blocks.mycelium) aWorld.setBlock(aX, aY-1, aZ, Blocks.dirt, 0, (byte)aFlags); + final Block tBlock = aWorld.getBlock(aX, aY - 1, aZ); + if (tBlock == Blocks.grass || tBlock == Blocks.mycelium) + aWorld.setBlock(aX, aY - 1, aZ, Blocks.dirt, 0, (byte) aFlags); } - return aWorld.setBlock(aX, aY, aZ, aBlock, aMeta, (byte)aFlags); + return aWorld.setBlock(aX, aY, aZ, aBlock, aMeta, (byte) aFlags); } - - public static TileEntity getTileEntity (World aWorld, ChunkCoordinates aCoords, boolean aLoadUnloadedChunks) { + public static TileEntity getTileEntity(World aWorld, ChunkCoordinates aCoords, boolean aLoadUnloadedChunks) { return getTileEntity(aWorld, aCoords.posX, aCoords.posY, aCoords.posZ, aLoadUnloadedChunks); } @@ -108,7 +106,8 @@ public class GT_Util { aWorld.getBlockMetadata(aX, 0, aZ); aChunk = aWorld.getChunkFromBlockCoords(aX, aZ); if (aChunk == null) { - GT_Log.err.println("Some important Chunk does not exist for some reason at Coordinates X: " + aX + " and Z: " + aZ); + GT_Log.err.println("Some important Chunk does not exist for some reason at Coordinates X: " + aX + + " and Z: " + aZ); return false; } } @@ -117,11 +116,19 @@ public class GT_Util { } /** Marks a Chunk dirty so it is saved */ public static boolean markChunkDirty(Object aTileEntity) { - return aTileEntity instanceof TileEntity && markChunkDirty(((TileEntity)aTileEntity).getWorldObj(), ((TileEntity)aTileEntity).xCoord, ((TileEntity)aTileEntity).zCoord); + return aTileEntity instanceof TileEntity + && markChunkDirty( + ((TileEntity) aTileEntity).getWorldObj(), + ((TileEntity) aTileEntity).xCoord, + ((TileEntity) aTileEntity).zCoord); } public static int mixRGBInt(int aRGB1, int aRGB2) { - return getRGBInt(new short[] {(short)((getR(aRGB1) + getR(aRGB2)) >> 1), (short)((getG(aRGB1) + getG(aRGB2)) >> 1), (short)((getB(aRGB1) + getB(aRGB2)) >> 1)}); + return getRGBInt(new short[] { + (short) ((getR(aRGB1) + getR(aRGB2)) >> 1), + (short) ((getG(aRGB1) + getG(aRGB2)) >> 1), + (short) ((getB(aRGB1) + getB(aRGB2)) >> 1) + }); } public static int getRGBInt(short[] aColors) { @@ -145,12 +152,27 @@ public class GT_Util { } public static short[] getRGBaArray(int aColors) { - return new short[] {(short)((aColors >>> 16) & 255), (short)((aColors >>> 8) & 255), (short)(aColors & 255), (short)((aColors >>> 24) & 255)}; + return new short[] { + (short) ((aColors >>> 16) & 255), + (short) ((aColors >>> 8) & 255), + (short) (aColors & 255), + (short) ((aColors >>> 24) & 255) + }; + } + + public static short getR(int aColors) { + return (short) ((aColors >>> 16) & 255); } - public static short getR(int aColors) {return (short)((aColors >>> 16) & 255);} - public static short getG(int aColors) {return (short)((aColors >>> 8) & 255);} - public static short getB(int aColors) {return (short) (aColors & 255);} - public static short getA(int aColors) {return (short)((aColors >>> 24) & 255);} + public static short getG(int aColors) { + return (short) ((aColors >>> 8) & 255); + } + public static short getB(int aColors) { + return (short) (aColors & 255); + } + + public static short getA(int aColors) { + return (short) ((aColors >>> 24) & 255); + } } diff --git a/src/main/java/gregtech/api/util/GT_Utility.java b/src/main/java/gregtech/api/util/GT_Utility.java index b03c3ab13e..dc192a7d57 100644 --- a/src/main/java/gregtech/api/util/GT_Utility.java +++ b/src/main/java/gregtech/api/util/GT_Utility.java @@ -1,5 +1,16 @@ package gregtech.api.util; +import static gregtech.GT_Mod.GT_FML_LOGGER; +import static gregtech.api.enums.GT_Values.D1; +import static gregtech.api.enums.GT_Values.E; +import static gregtech.api.enums.GT_Values.GT; +import static gregtech.api.enums.GT_Values.L; +import static gregtech.api.enums.GT_Values.M; +import static gregtech.api.enums.GT_Values.NW; +import static gregtech.api.enums.GT_Values.V; +import static gregtech.api.enums.GT_Values.W; +import static gregtech.common.GT_UndergroundOil.undergroundOilReadInformation; + import cofh.api.transport.IItemDuct; import com.google.auto.value.AutoValue; import com.google.common.base.Suppliers; @@ -42,6 +53,32 @@ import ic2.api.recipe.IRecipeInput; import ic2.api.recipe.RecipeInputItemStack; import ic2.api.recipe.RecipeInputOreDict; import ic2.api.recipe.RecipeOutput; +import java.lang.reflect.Constructor; +import java.lang.reflect.Field; +import java.lang.reflect.Method; +import java.math.BigInteger; +import java.math.RoundingMode; +import java.text.DecimalFormat; +import java.text.DecimalFormatSymbols; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.Collection; +import java.util.Collections; +import java.util.HashMap; +import java.util.Iterator; +import java.util.LinkedHashMap; +import java.util.LinkedList; +import java.util.List; +import java.util.Locale; +import java.util.Map; +import java.util.Map.Entry; +import java.util.Objects; +import java.util.Optional; +import java.util.UUID; +import java.util.function.Function; +import java.util.function.IntFunction; +import java.util.function.Supplier; +import javax.annotation.Nullable; import net.minecraft.block.Block; import net.minecraft.enchantment.Enchantment; import net.minecraft.enchantment.EnchantmentHelper; @@ -92,44 +129,6 @@ import net.minecraftforge.fluids.IFluidContainerItem; import net.minecraftforge.fluids.IFluidHandler; import net.minecraftforge.oredict.OreDictionary; -import javax.annotation.Nullable; -import java.lang.reflect.Constructor; -import java.lang.reflect.Field; -import java.lang.reflect.Method; -import java.math.BigInteger; -import java.math.RoundingMode; -import java.text.DecimalFormat; -import java.text.DecimalFormatSymbols; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.Collection; -import java.util.Collections; -import java.util.HashMap; -import java.util.Iterator; -import java.util.LinkedHashMap; -import java.util.LinkedList; -import java.util.List; -import java.util.Locale; -import java.util.Map; -import java.util.Map.Entry; -import java.util.Objects; -import java.util.Optional; -import java.util.UUID; -import java.util.function.Function; -import java.util.function.IntFunction; -import java.util.function.Supplier; - -import static gregtech.GT_Mod.GT_FML_LOGGER; -import static gregtech.api.enums.GT_Values.D1; -import static gregtech.api.enums.GT_Values.E; -import static gregtech.api.enums.GT_Values.GT; -import static gregtech.api.enums.GT_Values.L; -import static gregtech.api.enums.GT_Values.M; -import static gregtech.api.enums.GT_Values.NW; -import static gregtech.api.enums.GT_Values.V; -import static gregtech.api.enums.GT_Values.W; -import static gregtech.common.GT_UndergroundOil.undergroundOilReadInformation; - /** * NEVER INCLUDE THIS FILE IN YOUR MOD!!! * <p/> @@ -137,24 +136,28 @@ import static gregtech.common.GT_UndergroundOil.undergroundOilReadInformation; */ public class GT_Utility { /** Formats a number with group separator and at most 2 fraction digits. */ - private static final Map<Locale, DecimalFormat> decimalFormatters=new HashMap<>(); + private static final Map<Locale, DecimalFormat> decimalFormatters = new HashMap<>(); /** * Forge screwed the Fluid Registry up again, so I make my own, which is also much more efficient than the stupid Stuff over there. */ private static final List<FluidContainerData> sFluidContainerList = new ArrayList<>(); - private static final Map<GT_ItemStack, FluidContainerData> sFilledContainerToData = new /*Concurrent*/HashMap<>(); - private static final Map<GT_ItemStack, Map<Fluid, FluidContainerData>> sEmptyContainerToFluidToData = new /*Concurrent*/HashMap<>(); + + private static final Map<GT_ItemStack, FluidContainerData> sFilledContainerToData = new /*Concurrent*/ HashMap<>(); + private static final Map<GT_ItemStack, Map<Fluid, FluidContainerData>> sEmptyContainerToFluidToData = + new /*Concurrent*/ HashMap<>(); private static final Map<Fluid, List<ItemStack>> sFluidToContainers = new HashMap<>(); private static final Map<String, Fluid> sFluidUnlocalizedNameToFluid = new HashMap<>(); /** Must use {@code Supplier} here because the ore prefixes have not yet been registered at class load time. */ private static final Map<OrePrefixes, Supplier<ItemStack>> sOreToCobble = new HashMap<>(); - private final static Map<Integer, Boolean> sOreTable = new HashMap<>(); + + private static final Map<Integer, Boolean> sOreTable = new HashMap<>(); public static volatile int VERSION = 509; public static boolean TE_CHECK = false, BC_CHECK = false, CHECK_ALL = true, RF_CHECK = false; - public static Map<GT_PlayedSound, Integer> sPlayedSoundMap = new /*Concurrent*/HashMap<>(); + public static Map<GT_PlayedSound, Integer> sPlayedSoundMap = new /*Concurrent*/ HashMap<>(); private static int sBookCount = 0; - public static UUID defaultUuid = null; // maybe default non-null? UUID.fromString("00000000-0000-0000-0000-000000000000"); + public static UUID defaultUuid = + null; // maybe default non-null? UUID.fromString("00000000-0000-0000-0000-000000000000"); static { GregTech_API.sItemStackMappings.add(sFilledContainerToData); @@ -162,41 +165,33 @@ 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; - sOreToCobble.put( - OrePrefixes.oreBlackgranite, - materialToCobble.apply(Materials.GraniteBlack)); - sOreToCobble.put( - OrePrefixes.oreRedgranite, - materialToCobble.apply(Materials.GraniteRed)); - sOreToCobble.put( - OrePrefixes.oreMarble, - materialToCobble.apply(Materials.Marble)); - sOreToCobble.put( - OrePrefixes.oreBasalt, - materialToCobble.apply(Materials.Basalt)); - sOreToCobble.put( - OrePrefixes.oreNetherrack, - () -> new ItemStack(Blocks.netherrack)); - sOreToCobble.put( - OrePrefixes.oreEndstone, - () -> new ItemStack(Blocks.end_stone)); - } - - public static int safeInt(long number, int margin){ - return number>Integer.MAX_VALUE-margin ? Integer.MAX_VALUE-margin :(int)number; - } - - public static int safeInt(long number){ - return number> V[V.length-1] ? safeInt(V[V.length-1],1) : number<Integer.MIN_VALUE ? Integer.MIN_VALUE : (int)number; + 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)); + sOreToCobble.put(OrePrefixes.oreBasalt, materialToCobble.apply(Materials.Basalt)); + sOreToCobble.put(OrePrefixes.oreNetherrack, () -> new ItemStack(Blocks.netherrack)); + sOreToCobble.put(OrePrefixes.oreEndstone, () -> new ItemStack(Blocks.end_stone)); + } + + public static int safeInt(long number, int margin) { + return number > Integer.MAX_VALUE - margin ? Integer.MAX_VALUE - margin : (int) number; + } + + public static int safeInt(long number) { + return number > V[V.length - 1] + ? safeInt(V[V.length - 1], 1) + : number < Integer.MIN_VALUE ? Integer.MIN_VALUE : (int) number; } public static Field getPublicField(Object aObject, String aField) { Field rField = null; try { rField = aObject.getClass().getDeclaredField(aField); - } catch (Throwable e) {/*Do nothing*/} + } catch (Throwable e) { + /*Do nothing*/ + } return rField; } @@ -205,7 +200,9 @@ public class GT_Utility { try { rField = aObject.getClass().getDeclaredField(aField); rField.setAccessible(true); - } catch (Throwable e) {/*Do nothing*/} + } catch (Throwable e) { + /*Do nothing*/ + } return rField; } @@ -214,7 +211,9 @@ public class GT_Utility { try { rField = aObject.getDeclaredField(aField); rField.setAccessible(true); - } catch (Throwable e) {/*Do nothing*/} + } catch (Throwable e) { + /*Do nothing*/ + } return rField; } @@ -223,7 +222,9 @@ public class GT_Utility { try { rMethod = aObject.getMethod(aMethod, aParameterTypes); rMethod.setAccessible(true); - } catch (Throwable e) {/*Do nothing*/} + } catch (Throwable e) { + /*Do nothing*/ + } return rMethod; } @@ -232,13 +233,19 @@ public class GT_Utility { try { rMethod = aObject.getClass().getMethod(aMethod, aParameterTypes); rMethod.setAccessible(true); - } catch (Throwable e) {/*Do nothing*/} + } catch (Throwable e) { + /*Do nothing*/ + } return rMethod; } 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); + Field tField = (aObject instanceof Class) + ? ((Class) aObject).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) { @@ -249,7 +256,11 @@ 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); + Field tField = (aObject instanceof Class) + ? ((Class) aObject).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) { @@ -266,7 +277,13 @@ public class GT_Utility { return callMethod(aObject, aMethod, true, false, true, aParameters); } - public static Object callMethod(Object aObject, String aMethod, boolean aPrivate, boolean aUseUpperCasedDataTypes, boolean aLogErrors, Object... aParameters) { + public static Object callMethod( + Object aObject, + String aMethod, + boolean aPrivate, + boolean aUseUpperCasedDataTypes, + boolean aLogErrors, + Object... aParameters) { try { Class<?>[] tParameterTypes = new Class<?>[aParameters.length]; for (byte i = 0; i < aParameters.length; i++) { @@ -287,7 +304,9 @@ public class GT_Utility { } } - Method tMethod = (aObject instanceof Class) ? ((Class) aObject).getMethod(aMethod, tParameterTypes) : aObject.getClass().getMethod(aMethod, tParameterTypes); + Method tMethod = (aObject instanceof Class) + ? ((Class) aObject).getMethod(aMethod, tParameterTypes) + : aObject.getClass().getMethod(aMethod, tParameterTypes); if (aPrivate) tMethod.setAccessible(true); return tMethod.invoke(aObject, aParameters); } catch (Throwable e) { @@ -296,22 +315,34 @@ public class GT_Utility { return null; } - public static Object callConstructor(String aClass, int aConstructorIndex, Object aReplacementObject, boolean aLogErrors, Object... aParameters) { + public static Object callConstructor( + String aClass, + int aConstructorIndex, + Object aReplacementObject, + boolean aLogErrors, + Object... aParameters) { try { - return callConstructor(Class.forName(aClass), aConstructorIndex, aReplacementObject, aLogErrors, aParameters); + return callConstructor( + Class.forName(aClass), aConstructorIndex, aReplacementObject, aLogErrors, aParameters); } catch (Throwable e) { if (aLogErrors) e.printStackTrace(GT_Log.err); } return aReplacementObject; } - public static Object callConstructor(Class<?> aClass, int aConstructorIndex, Object aReplacementObject, boolean aLogErrors, Object... aParameters) { + public static Object callConstructor( + Class<?> aClass, + int aConstructorIndex, + Object aReplacementObject, + boolean aLogErrors, + Object... aParameters) { if (aConstructorIndex < 0) { try { for (Constructor<?> tConstructor : aClass.getConstructors()) { try { return tConstructor.newInstance(aParameters); - } catch (Throwable ignored) {} + } catch (Throwable ignored) { + } } } catch (Throwable e) { if (aLogErrors) e.printStackTrace(GT_Log.err); @@ -346,8 +377,7 @@ public class GT_Utility { } } - if (tPotionHashmap != null) - return ((HashMap) tPotionHashmap.get(aPlayer)).get(aPotionIndex) != null; + if (tPotionHashmap != null) return ((HashMap) tPotionHashmap.get(aPlayer)).get(aPotionIndex) != null; } catch (Throwable e) { if (D1) e.printStackTrace(GT_Log.err); } @@ -356,7 +386,9 @@ 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) { @@ -385,7 +417,8 @@ public class GT_Utility { for (int i = 0; i < 4; i++) { if (aPlayer.inventory.armorInventory[i] != null) { if (aPlayer.inventory.armorInventory[i].getItem() instanceof GT_EnergyArmor_Item) { - if ((((GT_EnergyArmor_Item) aPlayer.inventory.armorInventory[i].getItem()).mSpecials & 512) != 0) { + if ((((GT_EnergyArmor_Item) aPlayer.inventory.armorInventory[i].getItem()).mSpecials & 512) + != 0) { if (GT_ModHandler.canUseElectricItem(aPlayer.inventory.armorInventory[i], 10000)) { return true; } @@ -400,8 +433,10 @@ public class GT_Utility { return false; } - public static ItemStack suckOneItemStackAt(World aWorld, double aX, double aY, double aZ, double aL, double aH, double aW) { - for (EntityItem tItem : (ArrayList<EntityItem>) aWorld.getEntitiesWithinAABB(EntityItem.class, AxisAlignedBB.getBoundingBox(aX, aY, aZ, aX + aL, aY + aH, aZ + aW))) { + public static ItemStack suckOneItemStackAt( + World aWorld, double aX, double aY, double aZ, double aL, double aH, double aW) { + for (EntityItem tItem : (ArrayList<EntityItem>) aWorld.getEntitiesWithinAABB( + EntityItem.class, AxisAlignedBB.getBoundingBox(aX, aY, aZ, aX + aL, aY + aH, aZ + aW))) { if (!tItem.isDead) { aWorld.removeEntity(tItem); tItem.setDead(); @@ -433,17 +468,23 @@ public class GT_Utility { Class tClass = IItemDuct.class; tClass.getCanonicalName(); TE_CHECK = true; - } catch (Throwable e) {/**/} + } catch (Throwable e) { + /**/ + } try { Class tClass = buildcraft.api.transport.IPipeTile.class; tClass.getCanonicalName(); BC_CHECK = true; - } catch (Throwable e) {/**/} + } catch (Throwable e) { + /**/ + } try { Class tClass = cofh.api.energy.IEnergyReceiver.class; tClass.getCanonicalName(); RF_CHECK = true; - } catch (Throwable e) {/**/} + } catch (Throwable e) { + /**/ + } CHECK_ALL = false; } } @@ -453,7 +494,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; } /** @@ -461,8 +503,31 @@ public class GT_Utility { * * @return the Amount of moved Items */ - public static byte moveStackIntoPipe(IInventory aTileEntity1, Object aTileEntity2, int[] aGrabSlots, int aGrabFrom, int aPutTo, List<ItemStack> aFilter, boolean aInvertFilter, byte aMaxTargetStackSize, byte aMinTargetStackSize, byte aMaxMoveAtOnce, byte aMinMoveAtOnce) { - return moveStackIntoPipe(aTileEntity1, aTileEntity2, aGrabSlots, aGrabFrom, aPutTo, aFilter, aInvertFilter, aMaxTargetStackSize, aMinTargetStackSize, aMaxMoveAtOnce, aMinMoveAtOnce, true); + public static byte moveStackIntoPipe( + IInventory aTileEntity1, + Object aTileEntity2, + int[] aGrabSlots, + int aGrabFrom, + int aPutTo, + List<ItemStack> aFilter, + boolean aInvertFilter, + byte aMaxTargetStackSize, + byte aMinTargetStackSize, + byte aMaxMoveAtOnce, + byte aMinMoveAtOnce) { + return moveStackIntoPipe( + aTileEntity1, + aTileEntity2, + aGrabSlots, + aGrabFrom, + aPutTo, + aFilter, + aInvertFilter, + aMaxTargetStackSize, + aMinTargetStackSize, + aMaxMoveAtOnce, + aMinMoveAtOnce, + true); } /** @@ -470,21 +535,45 @@ public class GT_Utility { * * @return the Amount of moved Items */ - public static byte moveStackIntoPipe(IInventory aTileEntity1, Object aTileEntity2, int[] aGrabSlots, int aGrabFrom, int aPutTo, List<ItemStack> aFilter, boolean aInvertFilter, byte aMaxTargetStackSize, byte aMinTargetStackSize, byte aMaxMoveAtOnce, byte aMinMoveAtOnce, boolean dropItem) { - if (aTileEntity1 == null || aMaxTargetStackSize <= 0 || aMinTargetStackSize <= 0 || aMinTargetStackSize > aMaxTargetStackSize || aMaxMoveAtOnce <= 0 || aMinMoveAtOnce > aMaxMoveAtOnce) - return 0; + public static byte moveStackIntoPipe( + IInventory aTileEntity1, + Object aTileEntity2, + int[] aGrabSlots, + int aGrabFrom, + int aPutTo, + List<ItemStack> aFilter, + boolean aInvertFilter, + byte aMaxTargetStackSize, + byte aMinTargetStackSize, + byte aMaxMoveAtOnce, + byte aMinMoveAtOnce, + boolean dropItem) { + if (aTileEntity1 == null + || aMaxTargetStackSize <= 0 + || aMinTargetStackSize <= 0 + || aMinTargetStackSize > aMaxTargetStackSize + || aMaxMoveAtOnce <= 0 + || aMinMoveAtOnce > aMaxMoveAtOnce) return 0; if (aTileEntity2 != null) { checkAvailabilities(); if (TE_CHECK && aTileEntity2 instanceof IItemDuct) { for (int aGrabSlot : aGrabSlots) { if (listContainsItem(aFilter, aTileEntity1.getStackInSlot(aGrabSlot), true, aInvertFilter)) { - if (isAllowedToTakeFromSlot(aTileEntity1, aGrabSlot, (byte) aGrabFrom, aTileEntity1.getStackInSlot(aGrabSlot))) { - if (Math.max(aMinMoveAtOnce, aMinTargetStackSize) <= aTileEntity1.getStackInSlot(aGrabSlot).stackSize) { - ItemStack tStack = copyAmount(Math.min(aTileEntity1.getStackInSlot(aGrabSlot).stackSize, Math.min(aMaxMoveAtOnce, aMaxTargetStackSize)), aTileEntity1.getStackInSlot(aGrabSlot)); - 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)*/) { - //((cofh.api.transport.IItemConduit)aTileEntity2).insertItem(ForgeDirection.getOrientation(aPutTo), copyAmount(tMovedItemCount, tStack), F); + if (isAllowedToTakeFromSlot( + aTileEntity1, aGrabSlot, (byte) aGrabFrom, aTileEntity1.getStackInSlot(aGrabSlot))) { + if (Math.max(aMinMoveAtOnce, aMinTargetStackSize) + <= aTileEntity1.getStackInSlot(aGrabSlot).stackSize) { + ItemStack tStack = copyAmount( + Math.min( + aTileEntity1.getStackInSlot(aGrabSlot).stackSize, + Math.min(aMaxMoveAtOnce, aMaxTargetStackSize)), + aTileEntity1.getStackInSlot(aGrabSlot)); + 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)*/) { + // ((cofh.api.transport.IItemConduit)aTileEntity2).insertItem(ForgeDirection.getOrientation(aPutTo), copyAmount(tMovedItemCount, tStack), F); aTileEntity1.decrStackSize(aGrabSlot, tMovedItemCount); aTileEntity1.markDirty(); return tMovedItemCount; @@ -498,12 +587,23 @@ public class GT_Utility { if (BC_CHECK && aTileEntity2 instanceof buildcraft.api.transport.IPipeTile) { for (int aGrabSlot : aGrabSlots) { if (listContainsItem(aFilter, aTileEntity1.getStackInSlot(aGrabSlot), true, aInvertFilter)) { - if (isAllowedToTakeFromSlot(aTileEntity1, aGrabSlot, (byte) aGrabFrom, aTileEntity1.getStackInSlot(aGrabSlot))) { - if (Math.max(aMinMoveAtOnce, aMinTargetStackSize) <= aTileEntity1.getStackInSlot(aGrabSlot).stackSize) { - ItemStack tStack = copyAmount(Math.min(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)); + if (isAllowedToTakeFromSlot( + aTileEntity1, aGrabSlot, (byte) aGrabFrom, aTileEntity1.getStackInSlot(aGrabSlot))) { + if (Math.max(aMinMoveAtOnce, aMinTargetStackSize) + <= aTileEntity1.getStackInSlot(aGrabSlot).stackSize) { + ItemStack tStack = copyAmount( + Math.min( + 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)); 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; @@ -517,15 +617,30 @@ public class GT_Utility { } ForgeDirection tDirection = ForgeDirection.getOrientation(aGrabFrom); - if (aTileEntity1 instanceof TileEntity && tDirection != ForgeDirection.UNKNOWN && tDirection.getOpposite() == ForgeDirection.getOrientation(aPutTo)) { - int tX = ((TileEntity) aTileEntity1).xCoord + tDirection.offsetX, tY = ((TileEntity) aTileEntity1).yCoord + tDirection.offsetY, tZ = ((TileEntity) aTileEntity1).zCoord + tDirection.offsetZ; + if (aTileEntity1 instanceof TileEntity + && tDirection != ForgeDirection.UNKNOWN + && tDirection.getOpposite() == ForgeDirection.getOrientation(aPutTo)) { + int tX = ((TileEntity) aTileEntity1).xCoord + tDirection.offsetX, + tY = ((TileEntity) aTileEntity1).yCoord + tDirection.offsetY, + tZ = ((TileEntity) aTileEntity1).zCoord + tDirection.offsetZ; if (!hasBlockHitBox(((TileEntity) aTileEntity1).getWorldObj(), tX, tY, tZ) && dropItem) { for (int aGrabSlot : aGrabSlots) { if (listContainsItem(aFilter, aTileEntity1.getStackInSlot(aGrabSlot), true, aInvertFilter)) { - if (isAllowedToTakeFromSlot(aTileEntity1, aGrabSlot, (byte) aGrabFrom, aTileEntity1.getStackInSlot(aGrabSlot))) { - if (Math.max(aMinMoveAtOnce, aMinTargetStackSize) <= aTileEntity1.getStackInSlot(aGrabSlot).stackSize) { - ItemStack tStack = copyAmount(Math.min(aTileEntity1.getStackInSlot(aGrabSlot).stackSize, Math.min(aMaxMoveAtOnce, aMaxTargetStackSize)), aTileEntity1.getStackInSlot(aGrabSlot)); - EntityItem tEntity = new EntityItem(((TileEntity) aTileEntity1).getWorldObj(), tX + 0.5, tY + 0.5, tZ + 0.5, tStack); + if (isAllowedToTakeFromSlot( + aTileEntity1, aGrabSlot, (byte) aGrabFrom, aTileEntity1.getStackInSlot(aGrabSlot))) { + if (Math.max(aMinMoveAtOnce, aMinTargetStackSize) + <= aTileEntity1.getStackInSlot(aGrabSlot).stackSize) { + ItemStack tStack = copyAmount( + Math.min( + aTileEntity1.getStackInSlot(aGrabSlot).stackSize, + Math.min(aMaxMoveAtOnce, aMaxTargetStackSize)), + aTileEntity1.getStackInSlot(aGrabSlot)); + EntityItem tEntity = new EntityItem( + ((TileEntity) aTileEntity1).getWorldObj(), + tX + 0.5, + tY + 0.5, + tZ + 0.5, + tStack); tEntity.motionX = tEntity.motionY = tEntity.motionZ = 0; ((TileEntity) aTileEntity1).getWorldObj().spawnEntityInWorld(tEntity); aTileEntity1.decrStackSize(aGrabSlot, tStack.stackSize); @@ -545,18 +660,42 @@ public class GT_Utility { * * @return the Amount of moved Items */ - public static byte moveStackFromSlotAToSlotB(IInventory aTileEntity1, IInventory aTileEntity2, int aGrabFrom, int aPutTo, byte aMaxTargetStackSize, byte aMinTargetStackSize, byte aMaxMoveAtOnce, byte aMinMoveAtOnce) { - if (aTileEntity1 == null || aTileEntity2 == null || aMaxTargetStackSize <= 0 || aMinTargetStackSize <= 0 || aMinTargetStackSize > aMaxTargetStackSize || aMaxMoveAtOnce <= 0 || aMinMoveAtOnce > aMaxMoveAtOnce) - return 0; - - ItemStack tStack1 = aTileEntity1.getStackInSlot(aGrabFrom), tStack2 = aTileEntity2.getStackInSlot(aPutTo), tStack3 = null; + public static byte moveStackFromSlotAToSlotB( + IInventory aTileEntity1, + IInventory aTileEntity2, + int aGrabFrom, + int aPutTo, + byte aMaxTargetStackSize, + byte aMinTargetStackSize, + byte aMaxMoveAtOnce, + byte aMinMoveAtOnce) { + if (aTileEntity1 == null + || aTileEntity2 == null + || aMaxTargetStackSize <= 0 + || aMinTargetStackSize <= 0 + || aMinTargetStackSize > aMaxTargetStackSize + || aMaxMoveAtOnce <= 0 + || aMinMoveAtOnce > aMaxMoveAtOnce) return 0; + + ItemStack tStack1 = aTileEntity1.getStackInSlot(aGrabFrom), + tStack2 = aTileEntity2.getStackInSlot(aPutTo), + tStack3 = null; if (tStack1 != null) { if (tStack2 != null && !areStacksEqual(tStack1, tStack2)) return 0; tStack3 = copyOrNull(tStack1); - aMaxTargetStackSize = (byte) Math.min(aMaxTargetStackSize, Math.min(tStack3.getMaxStackSize(), Math.min(tStack2 == null ? Integer.MAX_VALUE : tStack2.getMaxStackSize(), aTileEntity2.getInventoryStackLimit()))); - tStack3.stackSize = Math.min(tStack3.stackSize, aMaxTargetStackSize - (tStack2 == null ? 0 : tStack2.stackSize)); + aMaxTargetStackSize = (byte) Math.min( + aMaxTargetStackSize, + Math.min( + tStack3.getMaxStackSize(), + Math.min( + tStack2 == null ? Integer.MAX_VALUE : tStack2.getMaxStackSize(), + aTileEntity2.getInventoryStackLimit()))); + 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) && tStack3.stackSize >= aMinMoveAtOnce) { + if (tStack3.stackSize + (tStack2 == null ? 0 : tStack2.stackSize) + >= Math.min(tStack3.getMaxStackSize(), aMinTargetStackSize) + && tStack3.stackSize >= aMinMoveAtOnce) { tStack3 = aTileEntity1.decrStackSize(aGrabFrom, tStack3.stackSize); aTileEntity1.markDirty(); if (tStack3 != null) { @@ -587,7 +726,8 @@ public class GT_Utility { return true; } - public static boolean isAllowedToPutIntoSlot(IInventory aTileEntity, int aSlot, byte aSide, ItemStack aStack, byte aMaxStackSize) { + public static boolean isAllowedToPutIntoSlot( + IInventory aTileEntity, int aSlot, byte aSide, ItemStack aStack, byte aMaxStackSize) { ItemStack tStack = aTileEntity.getStackInSlot(aSlot); if (tStack != null && (!areStacksEqual(tStack, aStack) || tStack.stackSize >= tStack.getMaxStackSize())) return false; @@ -599,8 +739,8 @@ public class GT_Utility { || isAllowedToPutIntoSlot(aTileEntity, aSlot, (byte) 4, aStack, aMaxStackSize) || isAllowedToPutIntoSlot(aTileEntity, aSlot, (byte) 5, aStack, aMaxStackSize); } - if (aTileEntity instanceof ISidedInventory && !((ISidedInventory) aTileEntity).canInsertItem(aSlot, aStack, aSide)) - return false; + if (aTileEntity instanceof ISidedInventory + && !((ISidedInventory) aTileEntity).canInsertItem(aSlot, aStack, aSide)) return false; return aSlot < aTileEntity.getSizeInventory() && aTileEntity.isItemValidForSlot(aSlot, aStack); } @@ -609,31 +749,70 @@ public class GT_Utility { * * @return the Amount of moved Items */ - - public static int moveMultipleItemStacks(Object aTileEntity1, Object aTileEntity2, byte aGrabFrom, byte aPutTo, List<ItemStack> aFilter, boolean aInvertFilter, byte aMaxTargetStackSize, byte aMinTargetStackSize, byte aMaxMoveAtOnce, byte aMinMoveAtOnce,int aStackAmount) { - if (aTileEntity1 instanceof IInventory) - return moveMultipleItemStacks((IInventory) aTileEntity1, aTileEntity2, aGrabFrom, aPutTo, aFilter, aInvertFilter, aMaxTargetStackSize, aMinTargetStackSize, aMaxMoveAtOnce, aMinMoveAtOnce,aStackAmount, true); + public static int moveMultipleItemStacks( + Object aTileEntity1, + Object aTileEntity2, + byte aGrabFrom, + byte aPutTo, + List<ItemStack> aFilter, + boolean aInvertFilter, + byte aMaxTargetStackSize, + byte aMinTargetStackSize, + byte aMaxMoveAtOnce, + byte aMinMoveAtOnce, + int aStackAmount) { + if (aTileEntity1 instanceof IInventory) + return moveMultipleItemStacks( + (IInventory) aTileEntity1, + aTileEntity2, + aGrabFrom, + aPutTo, + aFilter, + aInvertFilter, + aMaxTargetStackSize, + aMinTargetStackSize, + aMaxMoveAtOnce, + aMinMoveAtOnce, + aStackAmount, + true); return 0; } - public static int moveMultipleItemStacks(IInventory aTileEntity1, Object aTileEntity2, byte aGrabFrom, byte aPutTo, List<ItemStack> aFilter, boolean aInvertFilter, byte aMaxTargetStackSize, byte aMinTargetStackSize, byte aMaxMoveAtOnce, byte aMinMoveAtOnce,int aMaxStackTransfer, boolean aDoCheckChests) { - if (aTileEntity1 == null || aMaxTargetStackSize <= 0 || aMinTargetStackSize <= 0 || aMaxMoveAtOnce <= 0 || aMinTargetStackSize > aMaxTargetStackSize || aMinMoveAtOnce > aMaxMoveAtOnce || aMaxStackTransfer == 0) - return 0; + public static int moveMultipleItemStacks( + IInventory aTileEntity1, + Object aTileEntity2, + byte aGrabFrom, + byte aPutTo, + List<ItemStack> aFilter, + boolean aInvertFilter, + byte aMaxTargetStackSize, + byte aMinTargetStackSize, + byte aMaxMoveAtOnce, + byte aMinMoveAtOnce, + int aMaxStackTransfer, + boolean aDoCheckChests) { + if (aTileEntity1 == null + || aMaxTargetStackSize <= 0 + || aMinTargetStackSize <= 0 + || aMaxMoveAtOnce <= 0 + || aMinTargetStackSize > aMaxTargetStackSize + || aMinMoveAtOnce > aMaxMoveAtOnce + || aMaxStackTransfer == 0) return 0; // find where to take from int[] tGrabSlots = new int[aTileEntity1.getSizeInventory()]; int tGrabSlotsSize = 0; if (aTileEntity1 instanceof ISidedInventory) { - for(int i : ((ISidedInventory) aTileEntity1).getAccessibleSlotsFromSide(aGrabFrom)) { + for (int i : ((ISidedInventory) aTileEntity1).getAccessibleSlotsFromSide(aGrabFrom)) { ItemStack s = aTileEntity1.getStackInSlot(i); - if (s == null || !isAllowedToTakeFromSlot(aTileEntity1, i, aGrabFrom, s) || s.stackSize < aMinMoveAtOnce || !listContainsItem(aFilter, s, true, aInvertFilter)) - continue; + if (s == null + || !isAllowedToTakeFromSlot(aTileEntity1, i, aGrabFrom, s) + || s.stackSize < aMinMoveAtOnce + || !listContainsItem(aFilter, s, true, aInvertFilter)) continue; tGrabSlots[tGrabSlotsSize++] = i; } - } - else { - for (int i = 0; i < tGrabSlots.length; i++) - { + } else { + for (int i = 0; i < tGrabSlots.length; i++) { ItemStack s = aTileEntity1.getStackInSlot(i); if (s == null || s.stackSize < aMinMoveAtOnce || !listContainsItem(aFilter, s, true, aInvertFilter)) continue; @@ -642,10 +821,21 @@ public class GT_Utility { } // no source, bail out - if(tGrabSlotsSize == 0) { + if (tGrabSlotsSize == 0) { // maybe source is a double chest. check it if (aDoCheckChests && aTileEntity1 instanceof TileEntityChest) - return moveFromAdjacentChests((TileEntityChest) aTileEntity1, aTileEntity2, aGrabFrom, aPutTo, aFilter, aInvertFilter, aMaxTargetStackSize, aMinTargetStackSize, aMaxMoveAtOnce, aMinMoveAtOnce, aMaxStackTransfer); + return moveFromAdjacentChests( + (TileEntityChest) aTileEntity1, + aTileEntity2, + aGrabFrom, + aPutTo, + aFilter, + aInvertFilter, + aMaxTargetStackSize, + aMinTargetStackSize, + aMaxMoveAtOnce, + aMinMoveAtOnce, + aMaxStackTransfer); return 0; } @@ -667,32 +857,45 @@ public class GT_Utility { accessibleSlots = ((ISidedInventory) tPutInventory).getAccessibleSlotsFromSide(aPutTo); for (int i = 0; i < tPutInventory.getSizeInventory(); i++) { int slot = i; - if(accessibleSlots != null) - { - if(accessibleSlots.length <= i) - break; + if (accessibleSlots != null) { + if (accessibleSlots.length <= i) break; slot = accessibleSlots[slot]; } ItemStack s = tPutInventory.getStackInSlot(slot); - if(s == null) { + if (s == null) { tPutFreeSlots.add(slot); - } else if((s.stackSize < s.getMaxStackSize() && s.stackSize < tPutInventory.getInventoryStackLimit()) && aMinMoveAtOnce <= s.getMaxStackSize() - s.stackSize) { + } else if ((s.stackSize < s.getMaxStackSize() && s.stackSize < tPutInventory.getInventoryStackLimit()) + && aMinMoveAtOnce <= s.getMaxStackSize() - s.stackSize) { ItemId sID = ItemId.createNoCopy(s); - tPutItems.merge(sID, (Math.min(s.getMaxStackSize(), tPutInventory.getInventoryStackLimit()) - s.stackSize), Integer::sum); + tPutItems.merge( + sID, + (Math.min(s.getMaxStackSize(), tPutInventory.getInventoryStackLimit()) - s.stackSize), + Integer::sum); tPutItemStacks.computeIfAbsent(sID, k -> new ArrayList<>()).add(s); } } // target completely filled, bail out - if(tPutItems.isEmpty() && tPutFreeSlots.isEmpty()) { + if (tPutItems.isEmpty() && tPutFreeSlots.isEmpty()) { // maybe target is a double chest. check it. if (aDoCheckChests && aTileEntity2 instanceof TileEntityChest) - return moveToAdjacentChests(aTileEntity1, (TileEntityChest) aTileEntity2, aGrabFrom, aPutTo, aFilter, aInvertFilter, aMaxTargetStackSize, aMinTargetStackSize, aMaxMoveAtOnce, aMinMoveAtOnce, aMaxStackTransfer); + return moveToAdjacentChests( + aTileEntity1, + (TileEntityChest) aTileEntity2, + aGrabFrom, + aPutTo, + aFilter, + aInvertFilter, + aMaxTargetStackSize, + aMinTargetStackSize, + aMaxMoveAtOnce, + aMinMoveAtOnce, + aMaxStackTransfer); return 0; } // go over source stacks one by one - int tStacksMoved = 0,tTotalItemsMoved = 0; + int tStacksMoved = 0, tTotalItemsMoved = 0; for (int j = 0; j < tGrabSlotsSize; j++) { int grabSlot = tGrabSlots[j]; int tMovedItems; @@ -700,8 +903,7 @@ public class GT_Utility { do { tMovedItems = 0; ItemStack tGrabStack = aTileEntity1.getStackInSlot(grabSlot); - if (tGrabStack == null) - break; + if (tGrabStack == null) break; tStackSize = tGrabStack.stackSize; ItemId sID = ItemId.createNoCopy(tGrabStack); @@ -716,22 +918,23 @@ public class GT_Utility { tMovedItems = toPut; for (int i = 0; i < putStack.size(); i++) { ItemStack s = putStack.get(i); - int sToPut = Math.min(Math.min(Math.min(toPut, s.getMaxStackSize() - s.stackSize), tPutInventory.getInventoryStackLimit() - s.stackSize), aMaxTargetStackSize - s.stackSize); - if (sToPut <= 0) - continue; - if (sToPut < aMinMoveAtOnce) - continue; - if (s.stackSize + sToPut < aMinTargetStackSize) - continue; + int sToPut = Math.min( + Math.min( + Math.min(toPut, s.getMaxStackSize() - s.stackSize), + tPutInventory.getInventoryStackLimit() - s.stackSize), + aMaxTargetStackSize - s.stackSize); + if (sToPut <= 0) continue; + if (sToPut < aMinMoveAtOnce) continue; + if (s.stackSize + sToPut < aMinTargetStackSize) continue; toPut -= sToPut; s.stackSize += sToPut; - if (s.stackSize == s.getMaxStackSize() || s.stackSize == tPutInventory.getInventoryStackLimit()) { + if (s.stackSize == s.getMaxStackSize() + || s.stackSize == tPutInventory.getInventoryStackLimit()) { // this slot is full. remove this stack from candidate list putStack.remove(i); i--; } - if (toPut == 0) - break; + if (toPut == 0) break; } tMovedItems -= toPut; if (tMovedItems > 0) { @@ -740,10 +943,8 @@ public class GT_Utility { // deduct spare space tPutItems.merge(sID, tMovedItems, (a, b) -> a.equals(b) ? null : a - b); - if (tStackSize == 0) - aTileEntity1.setInventorySlotContents(grabSlot, null); - else - tGrabStack.stackSize = tStackSize; + if (tStackSize == 0) aTileEntity1.setInventorySlotContents(grabSlot, null); + else tGrabStack.stackSize = tStackSize; aTileEntity1.markDirty(); tPutInventory.markDirty(); @@ -757,19 +958,31 @@ public class GT_Utility { int tPutSlot = tPutFreeSlots.get(i); if (isAllowedToPutIntoSlot(tPutInventory, tPutSlot, aPutTo, tGrabStack, (byte) 64)) { // allowed, now do moving - int tMoved = moveStackFromSlotAToSlotB(aTileEntity1, tPutInventory, grabSlot, tPutSlot, aMaxTargetStackSize, aMinTargetStackSize, (byte) (aMaxMoveAtOnce - tMovedItems), aMinMoveAtOnce); + int tMoved = moveStackFromSlotAToSlotB( + aTileEntity1, + tPutInventory, + grabSlot, + tPutSlot, + aMaxTargetStackSize, + aMinTargetStackSize, + (byte) (aMaxMoveAtOnce - tMovedItems), + aMinMoveAtOnce); if (tMoved > 0) { ItemStack s = tPutInventory.getStackInSlot(tPutSlot); 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 - int spare = Math.min(s.getMaxStackSize(), tPutInventory.getInventoryStackLimit()) - s.stackSize; + int spare = + Math.min(s.getMaxStackSize(), tPutInventory.getInventoryStackLimit()) + - s.stackSize; if (spare > 0) { 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); @@ -780,8 +993,7 @@ public class GT_Utility { tTotalItemsMoved += tMoved; tMovedItems += tMoved; tStackSize -= tMoved; - if (tStackSize == 0) - break; + if (tStackSize == 0) break; } } } @@ -789,22 +1001,44 @@ public class GT_Utility { if (tMovedItems > 0) { // check if we have moved enough stacks - if (++tStacksMoved >= aMaxStackTransfer) - return tTotalItemsMoved; + if (++tStacksMoved >= aMaxStackTransfer) return tTotalItemsMoved; } - } while (tMovedItems > 0 && tStackSize > 0); //support inventories that store more than a stack in a slot + } while (tMovedItems > 0 + && tStackSize > 0); // support inventories that store more than a stack in a slot } // check if source is a double chest, if yes, try move from the adjacent as well if (aDoCheckChests && aTileEntity1 instanceof TileEntityChest) { - int tAmount = moveFromAdjacentChests((TileEntityChest) aTileEntity1, aTileEntity2, aGrabFrom, aPutTo, aFilter, aInvertFilter, aMaxTargetStackSize, aMinTargetStackSize, aMaxMoveAtOnce, aMinMoveAtOnce, aMaxStackTransfer - tStacksMoved); - if (tAmount != 0) return tAmount+tTotalItemsMoved; + int tAmount = moveFromAdjacentChests( + (TileEntityChest) aTileEntity1, + aTileEntity2, + aGrabFrom, + aPutTo, + aFilter, + aInvertFilter, + aMaxTargetStackSize, + aMinTargetStackSize, + aMaxMoveAtOnce, + aMinMoveAtOnce, + aMaxStackTransfer - tStacksMoved); + if (tAmount != 0) return tAmount + tTotalItemsMoved; } // check if target is a double chest, if yes, try move to the adjacent as well if (aDoCheckChests && aTileEntity2 instanceof TileEntityChest) { - int tAmount = moveToAdjacentChests(aTileEntity1, (TileEntityChest) aTileEntity2, aGrabFrom, aPutTo, aFilter, aInvertFilter, aMaxTargetStackSize, aMinTargetStackSize, aMaxMoveAtOnce, aMinMoveAtOnce, aMaxStackTransfer - tStacksMoved); - if (tAmount != 0) return tAmount+tTotalItemsMoved; + int tAmount = moveToAdjacentChests( + aTileEntity1, + (TileEntityChest) aTileEntity2, + aGrabFrom, + aPutTo, + aFilter, + aInvertFilter, + aMaxTargetStackSize, + aMinTargetStackSize, + aMaxMoveAtOnce, + aMinMoveAtOnce, + aMaxStackTransfer - tStacksMoved); + if (tAmount != 0) return tAmount + tTotalItemsMoved; } return tTotalItemsMoved; @@ -814,61 +1048,224 @@ public class GT_Utility { int tTotalItemsMoved = 0; int tGrabInventorySize = tGrabSlots.length; for (int i = 0; i < tGrabInventorySize; i++) { - int tMoved = moveStackIntoPipe(aTileEntity1, aTileEntity2, tGrabSlots, aGrabFrom, aPutTo, aFilter, aInvertFilter, aMaxTargetStackSize, aMinTargetStackSize, aMaxMoveAtOnce, aMinMoveAtOnce, aDoCheckChests); - if (tMoved == 0) - return tTotalItemsMoved; - else - tTotalItemsMoved += tMoved; + int tMoved = moveStackIntoPipe( + aTileEntity1, + aTileEntity2, + tGrabSlots, + aGrabFrom, + aPutTo, + aFilter, + aInvertFilter, + aMaxTargetStackSize, + aMinTargetStackSize, + aMaxMoveAtOnce, + aMinMoveAtOnce, + aDoCheckChests); + if (tMoved == 0) return tTotalItemsMoved; + else tTotalItemsMoved += tMoved; } - return 0; + return 0; } - private static int moveToAdjacentChests(IInventory aTileEntity1, TileEntityChest aTargetChest, byte aGrabFrom, byte aPutTo, List<ItemStack> aFilter, boolean aInvertFilter, byte aMaxTargetStackSize, byte aMinTargetStackSize, byte aMaxMoveAtOnce, byte aMinMoveAtOnce, int aMaxStackTransfer) { + private static int moveToAdjacentChests( + IInventory aTileEntity1, + TileEntityChest aTargetChest, + byte aGrabFrom, + byte aPutTo, + List<ItemStack> aFilter, + boolean aInvertFilter, + byte aMaxTargetStackSize, + byte aMinTargetStackSize, + byte aMaxMoveAtOnce, + byte aMinMoveAtOnce, + int aMaxStackTransfer) { if (aTargetChest.adjacentChestChecked) { if (aTargetChest.adjacentChestXNeg != null) { - return moveMultipleItemStacks(aTileEntity1, aTargetChest.adjacentChestXNeg, aGrabFrom, aPutTo, aFilter, aInvertFilter, aMaxTargetStackSize, aMinTargetStackSize, aMaxMoveAtOnce, aMinMoveAtOnce, aMaxStackTransfer, false); + return moveMultipleItemStacks( + aTileEntity1, + aTargetChest.adjacentChestXNeg, + aGrabFrom, + aPutTo, + aFilter, + aInvertFilter, + aMaxTargetStackSize, + aMinTargetStackSize, + aMaxMoveAtOnce, + aMinMoveAtOnce, + aMaxStackTransfer, + false); } else if (aTargetChest.adjacentChestZNeg != null) { - return moveMultipleItemStacks(aTileEntity1, aTargetChest.adjacentChestZNeg, aGrabFrom, aPutTo, aFilter, aInvertFilter, aMaxTargetStackSize, aMinTargetStackSize, aMaxMoveAtOnce, aMinMoveAtOnce, aMaxStackTransfer, false); + return moveMultipleItemStacks( + aTileEntity1, + aTargetChest.adjacentChestZNeg, + aGrabFrom, + aPutTo, + aFilter, + aInvertFilter, + aMaxTargetStackSize, + aMinTargetStackSize, + aMaxMoveAtOnce, + aMinMoveAtOnce, + aMaxStackTransfer, + false); } else if (aTargetChest.adjacentChestXPos != null) { - return moveMultipleItemStacks(aTileEntity1, aTargetChest.adjacentChestXPos, aGrabFrom, aPutTo, aFilter, aInvertFilter, aMaxTargetStackSize, aMinTargetStackSize, aMaxMoveAtOnce, aMinMoveAtOnce, aMaxStackTransfer, false); + return moveMultipleItemStacks( + aTileEntity1, + aTargetChest.adjacentChestXPos, + aGrabFrom, + aPutTo, + aFilter, + aInvertFilter, + aMaxTargetStackSize, + aMinTargetStackSize, + aMaxMoveAtOnce, + aMinMoveAtOnce, + aMaxStackTransfer, + false); } else if (aTargetChest.adjacentChestZPos != null) { - return moveMultipleItemStacks(aTileEntity1, aTargetChest.adjacentChestZPos, aGrabFrom, aPutTo, aFilter, aInvertFilter, aMaxTargetStackSize, aMinTargetStackSize, aMaxMoveAtOnce, aMinMoveAtOnce, aMaxStackTransfer, false); + return moveMultipleItemStacks( + aTileEntity1, + aTargetChest.adjacentChestZPos, + aGrabFrom, + aPutTo, + aFilter, + aInvertFilter, + aMaxTargetStackSize, + aMinTargetStackSize, + aMaxMoveAtOnce, + aMinMoveAtOnce, + aMaxStackTransfer, + false); } } return 0; } - private static int moveFromAdjacentChests(TileEntityChest aChest, Object aTileEntity2, byte aGrabFrom, byte aPutTo, List<ItemStack> aFilter, boolean aInvertFilter, byte aMaxTargetStackSize, byte aMinTargetStackSize, byte aMaxMoveAtOnce, byte aMinMoveAtOnce, int aMaxStackTransfer) { + private static int moveFromAdjacentChests( + TileEntityChest aChest, + Object aTileEntity2, + byte aGrabFrom, + byte aPutTo, + List<ItemStack> aFilter, + boolean aInvertFilter, + byte aMaxTargetStackSize, + byte aMinTargetStackSize, + byte aMaxMoveAtOnce, + byte aMinMoveAtOnce, + int aMaxStackTransfer) { if (aChest.adjacentChestXNeg != null) { - return moveMultipleItemStacks(aChest.adjacentChestXNeg, aTileEntity2, aGrabFrom, aPutTo, aFilter, aInvertFilter, aMaxTargetStackSize, aMinTargetStackSize, aMaxMoveAtOnce, aMinMoveAtOnce, aMaxStackTransfer, false); + return moveMultipleItemStacks( + aChest.adjacentChestXNeg, + aTileEntity2, + aGrabFrom, + aPutTo, + aFilter, + aInvertFilter, + aMaxTargetStackSize, + aMinTargetStackSize, + aMaxMoveAtOnce, + aMinMoveAtOnce, + aMaxStackTransfer, + false); } else if (aChest.adjacentChestZNeg != null) { - return moveMultipleItemStacks(aChest.adjacentChestZNeg, aTileEntity2, aGrabFrom, aPutTo, aFilter, aInvertFilter, aMaxTargetStackSize, aMinTargetStackSize, aMaxMoveAtOnce, aMinMoveAtOnce, aMaxStackTransfer, false); + return moveMultipleItemStacks( + aChest.adjacentChestZNeg, + aTileEntity2, + aGrabFrom, + aPutTo, + aFilter, + aInvertFilter, + aMaxTargetStackSize, + aMinTargetStackSize, + aMaxMoveAtOnce, + aMinMoveAtOnce, + aMaxStackTransfer, + false); } else if (aChest.adjacentChestXPos != null) { - return moveMultipleItemStacks(aChest.adjacentChestXPos, aTileEntity2, aGrabFrom, aPutTo, aFilter, aInvertFilter, aMaxTargetStackSize, aMinTargetStackSize, aMaxMoveAtOnce, aMinMoveAtOnce, aMaxStackTransfer, false); + return moveMultipleItemStacks( + aChest.adjacentChestXPos, + aTileEntity2, + aGrabFrom, + aPutTo, + aFilter, + aInvertFilter, + aMaxTargetStackSize, + aMinTargetStackSize, + aMaxMoveAtOnce, + aMinMoveAtOnce, + aMaxStackTransfer, + false); } else if (aChest.adjacentChestZPos != null) { - return moveMultipleItemStacks(aChest.adjacentChestZPos, aTileEntity2, aGrabFrom, aPutTo, aFilter, aInvertFilter, aMaxTargetStackSize, aMinTargetStackSize, aMaxMoveAtOnce, aMinMoveAtOnce, aMaxStackTransfer, false); + return moveMultipleItemStacks( + aChest.adjacentChestZPos, + aTileEntity2, + aGrabFrom, + aPutTo, + aFilter, + aInvertFilter, + aMaxTargetStackSize, + aMinTargetStackSize, + aMaxMoveAtOnce, + aMinMoveAtOnce, + aMaxStackTransfer, + false); } return 0; } - /** * Moves Stack from Inv-Side to Inv-Side. * * @return the Amount of moved Items */ - public static byte moveOneItemStack(Object aTileEntity1, Object aTileEntity2, byte aGrabFrom, byte aPutTo, List<ItemStack> aFilter, boolean aInvertFilter, byte aMaxTargetStackSize, byte aMinTargetStackSize, byte aMaxMoveAtOnce, byte aMinMoveAtOnce) { + public static byte moveOneItemStack( + Object aTileEntity1, + Object aTileEntity2, + byte aGrabFrom, + byte aPutTo, + List<ItemStack> aFilter, + boolean aInvertFilter, + byte aMaxTargetStackSize, + byte aMinTargetStackSize, + byte aMaxMoveAtOnce, + byte aMinMoveAtOnce) { if (aTileEntity1 instanceof IInventory) - return moveOneItemStack((IInventory) aTileEntity1, aTileEntity2, aGrabFrom, aPutTo, aFilter, aInvertFilter, aMaxTargetStackSize, aMinTargetStackSize, aMaxMoveAtOnce, aMinMoveAtOnce, true); + return moveOneItemStack( + (IInventory) aTileEntity1, + aTileEntity2, + aGrabFrom, + aPutTo, + aFilter, + aInvertFilter, + aMaxTargetStackSize, + aMinTargetStackSize, + aMaxMoveAtOnce, + aMinMoveAtOnce, + true); return 0; } /** * This is only because I needed an additional Parameter for the Double Chest Check. */ - private static byte moveOneItemStack(IInventory aTileEntity1, Object aTileEntity2, byte aGrabFrom, byte aPutTo, List<ItemStack> aFilter, boolean aInvertFilter, byte aMaxTargetStackSize, byte aMinTargetStackSize, byte aMaxMoveAtOnce, byte aMinMoveAtOnce, boolean aDoCheckChests) { - if (aTileEntity1 == null || aMaxTargetStackSize <= 0 || aMinTargetStackSize <= 0 || aMaxMoveAtOnce <= 0 || aMinTargetStackSize > aMaxTargetStackSize || aMinMoveAtOnce > aMaxMoveAtOnce) - return 0; + private static byte moveOneItemStack( + IInventory aTileEntity1, + Object aTileEntity2, + byte aGrabFrom, + byte aPutTo, + List<ItemStack> aFilter, + boolean aInvertFilter, + byte aMaxTargetStackSize, + byte aMinTargetStackSize, + byte aMaxMoveAtOnce, + byte aMinMoveAtOnce, + boolean aDoCheckChests) { + if (aTileEntity1 == null + || aMaxTargetStackSize <= 0 + || aMinTargetStackSize <= 0 + || aMaxMoveAtOnce <= 0 + || aMinTargetStackSize > aMaxTargetStackSize + || aMinMoveAtOnce > aMaxMoveAtOnce) return 0; int[] tGrabSlots = null; if (aTileEntity1 instanceof ISidedInventory) @@ -892,12 +1289,22 @@ public class GT_Utility { byte tMovedItemCount = 0; ItemStack tGrabStack = aTileEntity1.getStackInSlot(tGrabSlot); if (listContainsItem(aFilter, tGrabStack, true, aInvertFilter)) { - if (tGrabStack.stackSize >= aMinMoveAtOnce && isAllowedToTakeFromSlot(aTileEntity1, tGrabSlot, aGrabFrom, tGrabStack)) { + if (tGrabStack.stackSize >= aMinMoveAtOnce + && isAllowedToTakeFromSlot(aTileEntity1, tGrabSlot, aGrabFrom, tGrabStack)) { for (int tPutSlot : tPutSlots) { - if (isAllowedToPutIntoSlot((IInventory) aTileEntity2, tPutSlot, aPutTo, tGrabStack, aMaxTargetStackSize)) { - tMovedItemCount += moveStackFromSlotAToSlotB(aTileEntity1, (IInventory) aTileEntity2, tGrabSlot, tPutSlot, aMaxTargetStackSize, aMinTargetStackSize, (byte) (aMaxMoveAtOnce - tMovedItemCount), aMinMoveAtOnce); - if (tMovedItemCount >= aMaxMoveAtOnce || (tMovedItemCount > 0 && aMaxTargetStackSize < 64)) - return tMovedItemCount; + if (isAllowedToPutIntoSlot( + (IInventory) aTileEntity2, tPutSlot, aPutTo, tGrabStack, aMaxTargetStackSize)) { + tMovedItemCount += moveStackFromSlotAToSlotB( + aTileEntity1, + (IInventory) aTileEntity2, + tGrabSlot, + tPutSlot, + aMaxTargetStackSize, + aMinTargetStackSize, + (byte) (aMaxMoveAtOnce - tMovedItemCount), + aMinMoveAtOnce); + if (tMovedItemCount >= aMaxMoveAtOnce + || (tMovedItemCount > 0 && aMaxTargetStackSize < 64)) return tMovedItemCount; } } } @@ -910,13 +1317,57 @@ public class GT_Utility { if (tTileEntity1.adjacentChestChecked) { byte tAmount = 0; if (tTileEntity1.adjacentChestXNeg != null) { - tAmount = moveOneItemStack(tTileEntity1.adjacentChestXNeg, aTileEntity2, aGrabFrom, aPutTo, aFilter, aInvertFilter, aMaxTargetStackSize, aMinTargetStackSize, aMaxMoveAtOnce, aMinMoveAtOnce, false); + tAmount = moveOneItemStack( + tTileEntity1.adjacentChestXNeg, + aTileEntity2, + aGrabFrom, + aPutTo, + aFilter, + aInvertFilter, + aMaxTargetStackSize, + aMinTargetStackSize, + aMaxMoveAtOnce, + aMinMoveAtOnce, + false); } else if (tTileEntity1.adjacentChestZNeg != null) { - tAmount = moveOneItemStack(tTileEntity1.adjacentChestZNeg, aTileEntity2, aGrabFrom, aPutTo, aFilter, aInvertFilter, aMaxTargetStackSize, aMinTargetStackSize, aMaxMoveAtOnce, aMinMoveAtOnce, false); + tAmount = moveOneItemStack( + tTileEntity1.adjacentChestZNeg, + aTileEntity2, + aGrabFrom, + aPutTo, + aFilter, + aInvertFilter, + aMaxTargetStackSize, + aMinTargetStackSize, + aMaxMoveAtOnce, + aMinMoveAtOnce, + false); } else if (tTileEntity1.adjacentChestXPos != null) { - tAmount = moveOneItemStack(tTileEntity1.adjacentChestXPos, aTileEntity2, aGrabFrom, aPutTo, aFilter, aInvertFilter, aMaxTargetStackSize, aMinTargetStackSize, aMaxMoveAtOnce, aMinMoveAtOnce, false); + tAmount = moveOneItemStack( + tTileEntity1.adjacentChestXPos, + aTileEntity2, + aGrabFrom, + aPutTo, + aFilter, + aInvertFilter, + aMaxTargetStackSize, + aMinTargetStackSize, + aMaxMoveAtOnce, + aMinMoveAtOnce, + false); } else if (tTileEntity1.adjacentChestZPos != null) { - tAmount = moveOneItemStack(tTileEntity1.adjacentChestZPos, aTileEntity2, aGrabFrom, aPutTo, aFilter, aInvertFilter, aMaxTargetStackSize, aMinTargetStackSize, aMaxMoveAtOnce, aMinMoveAtOnce, false); + tAmount = moveOneItemStack( + tTileEntity1.adjacentChestZPos, + aTileEntity2, + aGrabFrom, + aPutTo, + aFilter, + aInvertFilter, + aMaxTargetStackSize, + aMinTargetStackSize, + aMaxMoveAtOnce, + aMinMoveAtOnce, + false); } if (tAmount != 0) return tAmount; } @@ -926,20 +1377,76 @@ public class GT_Utility { if (tTileEntity2.adjacentChestChecked) { byte tAmount = 0; if (tTileEntity2.adjacentChestXNeg != null) { - tAmount = moveOneItemStack(aTileEntity1, tTileEntity2.adjacentChestXNeg, aGrabFrom, aPutTo, aFilter, aInvertFilter, aMaxTargetStackSize, aMinTargetStackSize, aMaxMoveAtOnce, aMinMoveAtOnce, false); + tAmount = moveOneItemStack( + aTileEntity1, + tTileEntity2.adjacentChestXNeg, + aGrabFrom, + aPutTo, + aFilter, + aInvertFilter, + aMaxTargetStackSize, + aMinTargetStackSize, + aMaxMoveAtOnce, + aMinMoveAtOnce, + false); } else if (tTileEntity2.adjacentChestZNeg != null) { - tAmount = moveOneItemStack(aTileEntity1, tTileEntity2.adjacentChestZNeg, aGrabFrom, aPutTo, aFilter, aInvertFilter, aMaxTargetStackSize, aMinTargetStackSize, aMaxMoveAtOnce, aMinMoveAtOnce, false); + tAmount = moveOneItemStack( + aTileEntity1, + tTileEntity2.adjacentChestZNeg, + aGrabFrom, + aPutTo, + aFilter, + aInvertFilter, + aMaxTargetStackSize, + aMinTargetStackSize, + aMaxMoveAtOnce, + aMinMoveAtOnce, + false); } else if (tTileEntity2.adjacentChestXPos != null) { - tAmount = moveOneItemStack(aTileEntity1, tTileEntity2.adjacentChestXPos, aGrabFrom, aPutTo, aFilter, aInvertFilter, aMaxTargetStackSize, aMinTargetStackSize, aMaxMoveAtOnce, aMinMoveAtOnce, false); + tAmount = moveOneItemStack( + aTileEntity1, + tTileEntity2.adjacentChestXPos, + aGrabFrom, + aPutTo, + aFilter, + aInvertFilter, + aMaxTargetStackSize, + aMinTargetStackSize, + aMaxMoveAtOnce, + aMinMoveAtOnce, + false); } else if (tTileEntity2.adjacentChestZPos != null) { - tAmount = moveOneItemStack(aTileEntity1, tTileEntity2.adjacentChestZPos, aGrabFrom, aPutTo, aFilter, aInvertFilter, aMaxTargetStackSize, aMinTargetStackSize, aMaxMoveAtOnce, aMinMoveAtOnce, false); + tAmount = moveOneItemStack( + aTileEntity1, + tTileEntity2.adjacentChestZPos, + aGrabFrom, + aPutTo, + aFilter, + aInvertFilter, + aMaxTargetStackSize, + aMinTargetStackSize, + aMaxMoveAtOnce, + aMinMoveAtOnce, + false); } if (tAmount != 0) return tAmount; } } } - return moveStackIntoPipe(aTileEntity1, aTileEntity2, tGrabSlots, aGrabFrom, aPutTo, aFilter, aInvertFilter, aMaxTargetStackSize, aMinTargetStackSize, aMaxMoveAtOnce, aMinMoveAtOnce, aDoCheckChests); + return moveStackIntoPipe( + aTileEntity1, + aTileEntity2, + tGrabSlots, + aGrabFrom, + aPutTo, + aFilter, + aInvertFilter, + aMaxTargetStackSize, + aMinTargetStackSize, + aMaxMoveAtOnce, + aMinMoveAtOnce, + aDoCheckChests); } /** @@ -947,9 +1454,25 @@ public class GT_Utility { * * @return the Amount of moved Items */ - public static byte moveOneItemStackIntoSlot(Object aTileEntity1, Object aTileEntity2, byte aGrabFrom, int aPutTo, List<ItemStack> aFilter, boolean aInvertFilter, byte aMaxTargetStackSize, byte aMinTargetStackSize, byte aMaxMoveAtOnce, byte aMinMoveAtOnce) { - if (aTileEntity1 == null || !(aTileEntity1 instanceof IInventory) || aPutTo < 0 || aMaxTargetStackSize <= 0 || aMinTargetStackSize <= 0 || aMaxMoveAtOnce <= 0 || aMinTargetStackSize > aMaxTargetStackSize || aMinMoveAtOnce > aMaxMoveAtOnce) - return 0; + public static byte moveOneItemStackIntoSlot( + Object aTileEntity1, + Object aTileEntity2, + byte aGrabFrom, + int aPutTo, + List<ItemStack> aFilter, + boolean aInvertFilter, + byte aMaxTargetStackSize, + byte aMinTargetStackSize, + byte aMaxMoveAtOnce, + byte aMinMoveAtOnce) { + if (aTileEntity1 == null + || !(aTileEntity1 instanceof IInventory) + || aPutTo < 0 + || aMaxTargetStackSize <= 0 + || aMinTargetStackSize <= 0 + || aMaxMoveAtOnce <= 0 + || aMinTargetStackSize > aMaxTargetStackSize + || aMinMoveAtOnce > aMaxMoveAtOnce) return 0; int[] tGrabSlots = null; if (aTileEntity1 instanceof ISidedInventory) @@ -961,10 +1484,28 @@ public class GT_Utility { if (aTileEntity2 instanceof IInventory) { for (int tGrabSlot : tGrabSlots) { - if (listContainsItem(aFilter, ((IInventory) aTileEntity1).getStackInSlot(tGrabSlot), true, aInvertFilter)) { - if (isAllowedToTakeFromSlot((IInventory) aTileEntity1, tGrabSlot, aGrabFrom, ((IInventory) aTileEntity1).getStackInSlot(tGrabSlot))) { - if (isAllowedToPutIntoSlot((IInventory) aTileEntity2, aPutTo, (byte) 6, ((IInventory) aTileEntity1).getStackInSlot(tGrabSlot), aMaxTargetStackSize)) { - byte tMovedItemCount = moveStackFromSlotAToSlotB((IInventory) aTileEntity1, (IInventory) aTileEntity2, tGrabSlot, aPutTo, aMaxTargetStackSize, aMinTargetStackSize, aMaxMoveAtOnce, aMinMoveAtOnce); + if (listContainsItem( + aFilter, ((IInventory) aTileEntity1).getStackInSlot(tGrabSlot), true, aInvertFilter)) { + if (isAllowedToTakeFromSlot( + (IInventory) aTileEntity1, + tGrabSlot, + aGrabFrom, + ((IInventory) aTileEntity1).getStackInSlot(tGrabSlot))) { + if (isAllowedToPutIntoSlot( + (IInventory) aTileEntity2, + aPutTo, + (byte) 6, + ((IInventory) aTileEntity1).getStackInSlot(tGrabSlot), + aMaxTargetStackSize)) { + byte tMovedItemCount = moveStackFromSlotAToSlotB( + (IInventory) aTileEntity1, + (IInventory) aTileEntity2, + tGrabSlot, + aPutTo, + aMaxTargetStackSize, + aMinTargetStackSize, + aMaxMoveAtOnce, + aMinMoveAtOnce); if (tMovedItemCount > 0) return tMovedItemCount; } } @@ -972,7 +1513,18 @@ public class GT_Utility { } } - moveStackIntoPipe(((IInventory) aTileEntity1), aTileEntity2, tGrabSlots, aGrabFrom, aPutTo, aFilter, aInvertFilter, aMaxTargetStackSize, aMinTargetStackSize, aMaxMoveAtOnce, aMinMoveAtOnce); + moveStackIntoPipe( + ((IInventory) aTileEntity1), + aTileEntity2, + tGrabSlots, + aGrabFrom, + aPutTo, + aFilter, + aInvertFilter, + aMaxTargetStackSize, + aMinTargetStackSize, + aMaxMoveAtOnce, + aMinMoveAtOnce); return 0; } @@ -981,13 +1533,39 @@ public class GT_Utility { * * @return the Amount of moved Items */ - public static byte moveFromSlotToSlot(IInventory aTileEntity1, IInventory aTileEntity2, int aGrabFrom, int aPutTo, List<ItemStack> aFilter, boolean aInvertFilter, byte aMaxTargetStackSize, byte aMinTargetStackSize, byte aMaxMoveAtOnce, byte aMinMoveAtOnce) { - if (aTileEntity1 == null || aTileEntity2 == null || aGrabFrom < 0 || aPutTo < 0 || aMaxTargetStackSize <= 0 || aMinTargetStackSize <= 0 || aMaxMoveAtOnce <= 0 || aMinTargetStackSize > aMaxTargetStackSize || aMinMoveAtOnce > aMaxMoveAtOnce) - return 0; + public static byte moveFromSlotToSlot( + IInventory aTileEntity1, + IInventory aTileEntity2, + int aGrabFrom, + int aPutTo, + List<ItemStack> aFilter, + boolean aInvertFilter, + byte aMaxTargetStackSize, + byte aMinTargetStackSize, + byte aMaxMoveAtOnce, + byte aMinMoveAtOnce) { + if (aTileEntity1 == null + || aTileEntity2 == null + || aGrabFrom < 0 + || aPutTo < 0 + || aMaxTargetStackSize <= 0 + || aMinTargetStackSize <= 0 + || aMaxMoveAtOnce <= 0 + || aMinTargetStackSize > aMaxTargetStackSize + || aMinMoveAtOnce > aMaxMoveAtOnce) return 0; if (listContainsItem(aFilter, aTileEntity1.getStackInSlot(aGrabFrom), true, aInvertFilter)) { if (isAllowedToTakeFromSlot(aTileEntity1, aGrabFrom, (byte) 6, aTileEntity1.getStackInSlot(aGrabFrom))) { - if (isAllowedToPutIntoSlot(aTileEntity2, aPutTo, (byte) 6, aTileEntity1.getStackInSlot(aGrabFrom), aMaxTargetStackSize)) { - byte tMovedItemCount = moveStackFromSlotAToSlotB(aTileEntity1, aTileEntity2, aGrabFrom, aPutTo, aMaxTargetStackSize, aMinTargetStackSize, aMaxMoveAtOnce, aMinMoveAtOnce); + if (isAllowedToPutIntoSlot( + aTileEntity2, aPutTo, (byte) 6, aTileEntity1.getStackInSlot(aGrabFrom), aMaxTargetStackSize)) { + byte tMovedItemCount = moveStackFromSlotAToSlotB( + aTileEntity1, + aTileEntity2, + aGrabFrom, + aPutTo, + aMaxTargetStackSize, + aMinTargetStackSize, + aMaxMoveAtOnce, + aMinMoveAtOnce); if (tMovedItemCount > 0) return tMovedItemCount; } } @@ -1000,12 +1578,27 @@ public class GT_Utility { * * @return the Amount of moved Items */ - public static byte moveFromSlotToSide(IInventory fromTile, Object toTile, int aGrabFrom, byte aPutTo, List<ItemStack> aFilter, boolean aInvertFilter, byte aMaxTargetStackSize, byte aMinTargetStackSize, byte aMaxMoveAtOnce, byte aMinMoveAtOnce, boolean aDoCheckChests) { - if (fromTile == null || aGrabFrom < 0 || aMinTargetStackSize <= 0 || aMaxMoveAtOnce <= 0 || aMinTargetStackSize > aMaxTargetStackSize || aMinMoveAtOnce > aMaxMoveAtOnce) - return 0; - - if (!listContainsItem(aFilter, fromTile.getStackInSlot(aGrabFrom), true, aInvertFilter) || - !isAllowedToTakeFromSlot(fromTile, aGrabFrom, (byte) 6, fromTile.getStackInSlot(aGrabFrom))) + public static byte moveFromSlotToSide( + IInventory fromTile, + Object toTile, + int aGrabFrom, + byte aPutTo, + List<ItemStack> aFilter, + boolean aInvertFilter, + byte aMaxTargetStackSize, + byte aMinTargetStackSize, + byte aMaxMoveAtOnce, + byte aMinMoveAtOnce, + boolean aDoCheckChests) { + if (fromTile == null + || aGrabFrom < 0 + || aMinTargetStackSize <= 0 + || aMaxMoveAtOnce <= 0 + || aMinTargetStackSize > aMaxTargetStackSize + || aMinMoveAtOnce > aMaxMoveAtOnce) return 0; + + if (!listContainsItem(aFilter, fromTile.getStackInSlot(aGrabFrom), true, aInvertFilter) + || !isAllowedToTakeFromSlot(fromTile, aGrabFrom, (byte) 6, fromTile.getStackInSlot(aGrabFrom))) return 0; if (toTile instanceof IInventory) { @@ -1020,11 +1613,23 @@ public class GT_Utility { byte tMovedItemCount = 0; for (int tPutSlot : tPutSlots) { - if (isAllowedToPutIntoSlot((IInventory) toTile, tPutSlot, aPutTo, fromTile.getStackInSlot(aGrabFrom), aMaxTargetStackSize)) { - tMovedItemCount += moveStackFromSlotAToSlotB(fromTile, (IInventory) toTile, aGrabFrom, tPutSlot, aMaxTargetStackSize, aMinTargetStackSize, (byte) (aMaxMoveAtOnce - tMovedItemCount), aMinMoveAtOnce); + if (isAllowedToPutIntoSlot( + (IInventory) toTile, + tPutSlot, + aPutTo, + fromTile.getStackInSlot(aGrabFrom), + aMaxTargetStackSize)) { + tMovedItemCount += moveStackFromSlotAToSlotB( + fromTile, + (IInventory) toTile, + aGrabFrom, + tPutSlot, + aMaxTargetStackSize, + aMinTargetStackSize, + (byte) (aMaxMoveAtOnce - tMovedItemCount), + aMinMoveAtOnce); if (tMovedItemCount >= aMaxMoveAtOnce) { return tMovedItemCount; - } } } @@ -1034,26 +1639,104 @@ public class GT_Utility { TileEntityChest tTileEntity2 = (TileEntityChest) toTile; if (tTileEntity2.adjacentChestChecked) { if (tTileEntity2.adjacentChestXNeg != null) { - tMovedItemCount = moveFromSlotToSide(fromTile, tTileEntity2.adjacentChestXNeg, aGrabFrom, aPutTo, aFilter, aInvertFilter, aMaxTargetStackSize, aMinTargetStackSize, aMaxMoveAtOnce, aMinMoveAtOnce, false); + tMovedItemCount = moveFromSlotToSide( + fromTile, + tTileEntity2.adjacentChestXNeg, + aGrabFrom, + aPutTo, + aFilter, + aInvertFilter, + aMaxTargetStackSize, + aMinTargetStackSize, + aMaxMoveAtOnce, + aMinMoveAtOnce, + false); } else if (tTileEntity2.adjacentChestZNeg != null) { - tMovedItemCount = moveFromSlotToSide(fromTile, tTileEntity2.adjacentChestZNeg, aGrabFrom, aPutTo, aFilter, aInvertFilter, aMaxTargetStackSize, aMinTargetStackSize, aMaxMoveAtOnce, aMinMoveAtOnce, false); + tMovedItemCount = moveFromSlotToSide( + fromTile, + tTileEntity2.adjacentChestZNeg, + aGrabFrom, + aPutTo, + aFilter, + aInvertFilter, + aMaxTargetStackSize, + aMinTargetStackSize, + aMaxMoveAtOnce, + aMinMoveAtOnce, + false); } else if (tTileEntity2.adjacentChestXPos != null) { - tMovedItemCount = moveFromSlotToSide(fromTile, tTileEntity2.adjacentChestXPos, aGrabFrom, aPutTo, aFilter, aInvertFilter, aMaxTargetStackSize, aMinTargetStackSize, aMaxMoveAtOnce, aMinMoveAtOnce, false); + tMovedItemCount = moveFromSlotToSide( + fromTile, + tTileEntity2.adjacentChestXPos, + aGrabFrom, + aPutTo, + aFilter, + aInvertFilter, + aMaxTargetStackSize, + aMinTargetStackSize, + aMaxMoveAtOnce, + aMinMoveAtOnce, + false); } else if (tTileEntity2.adjacentChestZPos != null) { - tMovedItemCount = moveFromSlotToSide(fromTile, tTileEntity2.adjacentChestZPos, aGrabFrom, aPutTo, aFilter, aInvertFilter, aMaxTargetStackSize, aMinTargetStackSize, aMaxMoveAtOnce, aMinMoveAtOnce, false); + tMovedItemCount = moveFromSlotToSide( + fromTile, + tTileEntity2.adjacentChestZPos, + aGrabFrom, + aPutTo, + aFilter, + aInvertFilter, + aMaxTargetStackSize, + aMinTargetStackSize, + aMaxMoveAtOnce, + aMinMoveAtOnce, + false); } if (tMovedItemCount > 0) return tMovedItemCount; } } } - return moveStackIntoPipe(fromTile, toTile, new int[]{aGrabFrom}, (byte) 6, aPutTo, aFilter, aInvertFilter, aMaxTargetStackSize, aMinTargetStackSize, aMaxMoveAtOnce, aMinMoveAtOnce, aDoCheckChests); - } - - public static byte moveFromSlotToSide(IInventory fromTile, Object toTile, int aGrabFrom, byte aPutTo, List<ItemStack> aFilter, boolean aInvertFilter, byte aMaxTargetStackSize, byte aMinTargetStackSize, byte aMaxMoveAtOnce, byte aMinMoveAtOnce) { - return moveFromSlotToSide(fromTile, toTile, aGrabFrom, aPutTo, aFilter, aInvertFilter, aMaxTargetStackSize, aMinTargetStackSize, aMaxMoveAtOnce, aMinMoveAtOnce, true); - } - - public static boolean listContainsItem(Collection<ItemStack> aList, ItemStack aStack, boolean aTIfListEmpty, boolean aInvertFilter) { + return moveStackIntoPipe( + fromTile, + toTile, + new int[] {aGrabFrom}, + (byte) 6, + aPutTo, + aFilter, + aInvertFilter, + aMaxTargetStackSize, + aMinTargetStackSize, + aMaxMoveAtOnce, + aMinMoveAtOnce, + aDoCheckChests); + } + + public static byte moveFromSlotToSide( + IInventory fromTile, + Object toTile, + int aGrabFrom, + byte aPutTo, + List<ItemStack> aFilter, + boolean aInvertFilter, + byte aMaxTargetStackSize, + byte aMinTargetStackSize, + byte aMaxMoveAtOnce, + byte aMinMoveAtOnce) { + return moveFromSlotToSide( + fromTile, + toTile, + aGrabFrom, + aPutTo, + aFilter, + aInvertFilter, + aMaxTargetStackSize, + aMinTargetStackSize, + aMaxMoveAtOnce, + aMinMoveAtOnce, + true); + } + + public static boolean listContainsItem( + Collection<ItemStack> aList, ItemStack aStack, boolean aTIfListEmpty, boolean aInvertFilter) { if (aStack == null || aStack.stackSize < 1) return false; if (aList == null) return aTIfListEmpty; boolean tEmpty = true; @@ -1071,7 +1754,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; - return ((aStack1.getTagCompound() == null) == (aStack2.getTagCompound() == null)) && (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); + return ((aStack1.getTagCompound() == null) == (aStack2.getTagCompound() == null)) + && (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); } return false; } @@ -1081,7 +1769,12 @@ public class GT_Utility { } public static boolean areFluidsEqual(FluidStack aFluid1, FluidStack aFluid2, boolean aIgnoreNBT) { - return aFluid1 != null && aFluid2 != null && aFluid1.getFluid() == aFluid2.getFluid() && (aIgnoreNBT || ((aFluid1.tag == null) == (aFluid2.tag == null)) && (aFluid1.tag == null || aFluid1.tag.equals(aFluid2.tag))); + return aFluid1 != null + && aFluid2 != null + && aFluid1.getFluid() == aFluid2.getFluid() + && (aIgnoreNBT + || ((aFluid1.tag == null) == (aFluid2.tag == null)) + && (aFluid1.tag == null || aFluid1.tag.equals(aFluid2.tag))); } public static boolean areStacksEqual(ItemStack aStack1, ItemStack aStack2) { @@ -1089,9 +1782,16 @@ public class GT_Utility { } public static boolean areStacksEqual(ItemStack aStack1, ItemStack aStack2, boolean aIgnoreNBT) { - return aStack1 != null && aStack2 != null && aStack1.getItem() == aStack2.getItem() - && (aIgnoreNBT || (((aStack1.getTagCompound() == null) == (aStack2.getTagCompound() == null)) && (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); + return aStack1 != null + && aStack2 != null + && aStack1.getItem() == aStack2.getItem() + && (aIgnoreNBT + || (((aStack1.getTagCompound() == null) == (aStack2.getTagCompound() == null)) + && (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); } /** @@ -1099,23 +1799,24 @@ public class GT_Utility { * * Since ItemStack doesn't override equals and hashCode, you cannot just use Objects.equals */ - public static boolean areStackListsEqual(List<ItemStack> lhs, List<ItemStack> rhs, boolean ignoreStackSize, boolean ignoreNBT) { + public static boolean areStackListsEqual( + List<ItemStack> lhs, List<ItemStack> rhs, boolean ignoreStackSize, boolean ignoreNBT) { if (lhs == null) return rhs == null; if (rhs == null) return false; if (lhs.size() != rhs.size()) return false; for (Iterator<ItemStack> it1 = lhs.iterator(), it2 = rhs.iterator(); it1.hasNext() && it2.hasNext(); ) { - if (!areStacksEqualExtended(it1.next(), it2.next(), ignoreStackSize, ignoreNBT)) - return false; + if (!areStacksEqualExtended(it1.next(), it2.next(), ignoreStackSize, ignoreNBT)) return false; } return true; } - private static boolean areStacksEqualExtended(ItemStack lhs, ItemStack rhs, boolean ignoreStackSize, boolean ignoreNBT) { + private static boolean areStacksEqualExtended( + ItemStack lhs, ItemStack rhs, boolean ignoreStackSize, boolean ignoreNBT) { if (lhs == null) return rhs == null; if (rhs == null) return false; - return lhs.getItem() == rhs.getItem() && - (ignoreNBT || Objects.equals(lhs.stackTagCompound, rhs.stackTagCompound)) && - (ignoreStackSize || lhs.stackSize == rhs.stackSize); + return lhs.getItem() == rhs.getItem() + && (ignoreNBT || Objects.equals(lhs.stackTagCompound, rhs.stackTagCompound)) + && (ignoreStackSize || lhs.stackSize == rhs.stackSize); } public static boolean areUnificationsEqual(ItemStack aStack1, ItemStack aStack2) { @@ -1123,7 +1824,8 @@ public class GT_Utility { } public static boolean areUnificationsEqual(ItemStack aStack1, ItemStack aStack2, boolean aIgnoreNBT) { - return areStacksEqual(GT_OreDictUnificator.get_nocopy(aStack1), GT_OreDictUnificator.get_nocopy(aStack2), aIgnoreNBT); + return areStacksEqual( + GT_OreDictUnificator.get_nocopy(aStack1), GT_OreDictUnificator.get_nocopy(aStack2), aIgnoreNBT); } public static String getFluidName(Fluid aFluid, boolean aLocalized) { @@ -1146,10 +1848,12 @@ 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(new GT_ItemStack(tData.emptyContainer), tFluidToContainer = new /*Concurrent*/HashMap<>()); + sEmptyContainerToFluidToData.put( + new GT_ItemStack(tData.emptyContainer), tFluidToContainer = new /*Concurrent*/ HashMap<>()); GregTech_API.sFluidMappings.add(tFluidToContainer); } tFluidToContainer.put(tData.fluid.getFluid(), tData); @@ -1157,8 +1861,7 @@ public class GT_Utility { tContainers = new ArrayList<>(); tContainers.add(tData.filledContainer); sFluidToContainers.put(tData.fluid.getFluid(), tContainers); - } - else tContainers.add(tData.filledContainer); + } else tContainers.add(tData.filledContainer); } for (Fluid tFluid : FluidRegistry.getRegisteredFluids().values()) { sFluidUnlocalizedNameToFluid.put(tFluid.getUnlocalizedName(), tFluid); @@ -1172,10 +1875,12 @@ 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); @@ -1183,8 +1888,7 @@ public class GT_Utility { tContainers = new ArrayList<>(); tContainers.add(aData.filledContainer); sFluidToContainers.put(aData.fluid.getFluid(), tContainers); - } - else tContainers.add(aData.filledContainer); + } else tContainers.add(aData.filledContainer); } public static List<ItemStack> getContainersFromFluid(FluidStack tFluidStack) { @@ -1196,7 +1900,8 @@ public class GT_Utility { return new ArrayList<>(); } - public static ItemStack fillFluidContainer(FluidStack aFluid, ItemStack aStack, boolean aRemoveFluidDirectly, boolean aCheckIFluidContainerItems) { + public static ItemStack fillFluidContainer( + FluidStack aFluid, ItemStack aStack, boolean aRemoveFluidDirectly, boolean aCheckIFluidContainerItems) { if (isStackInvalid(aStack) || aFluid == null) return null; if (GT_ModHandler.isWater(aFluid) && ItemList.Bottle_Empty.isStackEqual(aStack)) { if (aFluid.amount >= 250) { @@ -1205,11 +1910,14 @@ public class GT_Utility { } return null; } - if (aCheckIFluidContainerItems && aStack.getItem() instanceof IFluidContainerItem && ((IFluidContainerItem) aStack.getItem()).getFluid(aStack) == null && ((IFluidContainerItem) aStack.getItem()).getCapacity(aStack) <= aFluid.amount) { + 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); - else - ((IFluidContainerItem) aStack.getItem()).fill(aStack = copyAmount(1, aStack), aFluid, true); + 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; } Map<Fluid, FluidContainerData> tFluidToContainer = sEmptyContainerToFluidToData.get(new GT_ItemStack(aStack)); @@ -1247,25 +1955,29 @@ public class GT_Utility { } public static FluidStack getFluidFromDisplayStack(ItemStack aDisplayStack) { - if (!isStackValid(aDisplayStack) || - aDisplayStack.getItem() != ItemList.Display_Fluid.getItem() || - !aDisplayStack.hasTagCompound()) - return null; + 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")); } 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))); + if (aCheckIFluidContainerItems + && aStack.getItem() instanceof IFluidContainerItem + && ((IFluidContainerItem) aStack.getItem()).getCapacity(aStack) > 0) + 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); } public static FluidStack getFluidForFilledItem(ItemStack aStack, boolean aCheckIFluidContainerItems) { if (isStackInvalid(aStack)) return null; - if (aCheckIFluidContainerItems && aStack.getItem() instanceof IFluidContainerItem && ((IFluidContainerItem) aStack.getItem()).getCapacity(aStack) > 0) + if (aCheckIFluidContainerItems + && aStack.getItem() instanceof IFluidContainerItem + && ((IFluidContainerItem) aStack.getItem()).getCapacity(aStack) > 0) return ((IFluidContainerItem) aStack.getItem()).drain(copyAmount(1, aStack), Integer.MAX_VALUE, true); FluidContainerData tData = sFilledContainerToData.get(new GT_ItemStack(aStack)); return tData == null ? null : tData.fluid.copy(); @@ -1278,7 +1990,9 @@ public class GT_Utility { if (isStackInvalid(aStack)) return null; FluidContainerData tData = sFilledContainerToData.get(new GT_ItemStack(aStack)); if (tData != null) return copyAmount(1, tData.emptyContainer); - if (aCheckIFluidContainerItems && aStack.getItem() instanceof IFluidContainerItem && ((IFluidContainerItem) aStack.getItem()).getCapacity(aStack) > 0) { + if (aCheckIFluidContainerItems + && aStack.getItem() instanceof IFluidContainerItem + && ((IFluidContainerItem) aStack.getItem()).getCapacity(aStack) > 0) { ((IFluidContainerItem) aStack.getItem()).drain(aStack = copyAmount(1, aStack), Integer.MAX_VALUE, true); return aStack; } @@ -1295,10 +2009,14 @@ public class GT_Utility { /** These are all special Cases, in which it is intended to have only GT Blocks outputting those Container Items */ if (ItemList.Cell_Empty.isStackEqual(aStack, false, true)) return null; if (ItemList.IC2_Fuel_Can_Filled.isStackEqual(aStack, false, true)) return ItemList.IC2_Fuel_Can_Empty.get(1); - if (aStack.getItem() == Items.potionitem || aStack.getItem() == Items.experience_bottle || ItemList.TF_Vial_FieryBlood.isStackEqual(aStack) || ItemList.TF_Vial_FieryTears.isStackEqual(aStack)) - return ItemList.Bottle_Empty.get(1); - - if (aCheckIFluidContainerItems && aStack.getItem() instanceof IFluidContainerItem && ((IFluidContainerItem) aStack.getItem()).getCapacity(aStack) > 0) { + if (aStack.getItem() == Items.potionitem + || aStack.getItem() == Items.experience_bottle + || ItemList.TF_Vial_FieryBlood.isStackEqual(aStack) + || ItemList.TF_Vial_FieryTears.isStackEqual(aStack)) return ItemList.Bottle_Empty.get(1); + + if (aCheckIFluidContainerItems + && aStack.getItem() instanceof IFluidContainerItem + && ((IFluidContainerItem) aStack.getItem()).getCapacity(aStack) > 0) { ItemStack tStack = copyAmount(1, aStack); ((IFluidContainerItem) aStack.getItem()).drain(tStack, Integer.MAX_VALUE, true); if (!areStacksEqual(aStack, tStack)) return tStack; @@ -1313,63 +2031,79 @@ public class GT_Utility { return null; } - public static synchronized boolean removeIC2BottleRecipe(ItemStack aContainer, ItemStack aInput, Map<ic2.api.recipe.ICannerBottleRecipeManager.Input, RecipeOutput> aRecipeList, ItemStack aOutput){ - if ((isStackInvalid(aInput) && isStackInvalid(aOutput) && isStackInvalid(aContainer)) || aRecipeList == null) return false; + public static synchronized boolean removeIC2BottleRecipe( + ItemStack aContainer, + ItemStack aInput, + Map<ic2.api.recipe.ICannerBottleRecipeManager.Input, RecipeOutput> aRecipeList, + ItemStack aOutput) { + 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)) { List<ItemStack> tList = tEntry.getValue().items; - if (tList != null) for (ItemStack tOutput : tList) - if (aOutput == null || areStacksEqual(GT_OreDictUnificator.get(tOutput), aOutput)) { - tIterator.remove(); - rReturn = true; - break; - } + if (tList != null) + for (ItemStack tOutput : tList) + if (aOutput == null || areStacksEqual(GT_OreDictUnificator.get(tOutput), aOutput)) { + tIterator.remove(); + rReturn = true; + break; + } } } return rReturn; } - public static synchronized boolean removeSimpleIC2MachineRecipe(ItemStack aInput, Map<IRecipeInput, RecipeOutput> aRecipeList, ItemStack aOutput) { + public static synchronized boolean removeSimpleIC2MachineRecipe( + ItemStack aInput, 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)) { List<ItemStack> tList = tEntry.getValue().items; - if (tList != null) for (ItemStack tOutput : tList) - if (aOutput == null || areStacksEqual(GT_OreDictUnificator.get(tOutput), aOutput)) { - tIterator.remove(); - rReturn = true; - break; - } + if (tList != null) + for (ItemStack tOutput : tList) + if (aOutput == null || areStacksEqual(GT_OreDictUnificator.get(tOutput), aOutput)) { + tIterator.remove(); + rReturn = true; + break; + } } } return rReturn; } - public static synchronized void bulkRemoveSimpleIC2MachineRecipe(Map<ItemStack, ItemStack> toRemove, Map<IRecipeInput, RecipeOutput> aRecipeList) { + 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); + 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; + 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; + 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))); - })); + return tList.stream() + .anyMatch(tOutput -> + (aOutput == null || areStacksEqual(GT_OreDictUnificator.get(tOutput), aOutput))); + })); } - public static boolean addSimpleIC2MachineRecipe(ItemStack aInput, Map<IRecipeInput, RecipeOutput> aRecipeList, NBTTagCompound aNBT, Object... aOutput) { + public static boolean addSimpleIC2MachineRecipe( + ItemStack aInput, Map<IRecipeInput, RecipeOutput> aRecipeList, NBTTagCompound aNBT, Object... aOutput) { if (isStackInvalid(aInput) || aOutput.length == 0 || aRecipeList == null) return false; ItemData tOreName = GT_OreDictUnificator.getAssociation(aInput); for (Object o : aOutput) { @@ -1379,12 +2113,15 @@ public class GT_Utility { } } ItemStack[] tStack = GT_OreDictUnificator.getStackArray(true, aOutput); - if(tStack.length > 0 && areStacksEqual(aInput, tStack[0]))return false; + if (tStack.length > 0 && areStacksEqual(aInput, tStack[0])) return false; if (tOreName != null) { - 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)); + 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)); } else { - aRecipeList.put(new RecipeInputItemStack(copyOrNull(aInput), aInput.stackSize), new RecipeOutput(aNBT, tStack)); + aRecipeList.put( + new RecipeInputItemStack(copyOrNull(aInput), aInput.stackSize), new RecipeOutput(aNBT, tStack)); } return true; } @@ -1412,21 +2149,22 @@ 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]); + 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]); } else { GT_Log.err.println("WARNING: Too much Pages for written Book! -> " + aTitle); break; } } - tNBTList.appendTag(new NBTTagString("Credits to " + aAuthor + " for writing this Book. This was Book Nr. " + sBookCount + " at its creation. Gotta get 'em all!")); + tNBTList.appendTag(new NBTTagString("Credits to " + aAuthor + " for writing this Book. This was Book Nr. " + + sBookCount + " at its creation. Gotta get 'em all!")); tNBT.setTag("pages", tNBTList); rStack.setTagCompound(tNBT); - GT_Log.out.println("GT_Mod: Added Book to Book List - Mapping: '" + aMapping + "' - Name: '" + aTitle + "' - Author: '" + aAuthor + "'"); + GT_Log.out.println("GT_Mod: Added Book to Book List - Mapping: '" + aMapping + "' - Name: '" + aTitle + + "' - Author: '" + aAuthor + "'"); GregTech_API.sBookList.put(aMapping, rStack); return copyOrNull(rStack); } @@ -1440,21 +2178,37 @@ public class GT_Utility { return doSoundAtClient(sound.resourceLocation, aTimeUntilNextSound, aSoundStrength, GT.getThePlayer()); } - public static boolean doSoundAtClient(ResourceLocation aSoundResourceLocation, int aTimeUntilNextSound, float aSoundStrength) { + public static boolean doSoundAtClient( + ResourceLocation aSoundResourceLocation, int aTimeUntilNextSound, float aSoundStrength) { return doSoundAtClient(aSoundResourceLocation, aTimeUntilNextSound, aSoundStrength, GT.getThePlayer()); } - public static boolean doSoundAtClient(String aSoundName, int aTimeUntilNextSound, float aSoundStrength, Entity aEntity) { + public static boolean doSoundAtClient( + String aSoundName, int aTimeUntilNextSound, float aSoundStrength, Entity aEntity) { if (aEntity == null || aSoundName == null) return false; - return doSoundAtClient(aSoundName, aTimeUntilNextSound, aSoundStrength, aEntity.posX, aEntity.posY, aEntity.posZ); + return doSoundAtClient( + aSoundName, aTimeUntilNextSound, aSoundStrength, aEntity.posX, aEntity.posY, aEntity.posZ); } - public static boolean doSoundAtClient(ResourceLocation aSoundResourceLocation, int aTimeUntilNextSound, float aSoundStrength, Entity aEntity) { + public static boolean doSoundAtClient( + ResourceLocation aSoundResourceLocation, int aTimeUntilNextSound, float aSoundStrength, Entity aEntity) { if (aEntity == null) return false; - return doSoundAtClient(aSoundResourceLocation.toString(), aTimeUntilNextSound, aSoundStrength, aEntity.posX, aEntity.posY, aEntity.posZ); + return doSoundAtClient( + aSoundResourceLocation.toString(), + aTimeUntilNextSound, + aSoundStrength, + aEntity.posX, + aEntity.posY, + aEntity.posZ); } - public static boolean doSoundAtClient(ResourceLocation aSoundResourceLocation, int aTimeUntilNextSound, float aSoundStrength, double aX, double aY, double aZ) { + public static boolean doSoundAtClient( + ResourceLocation aSoundResourceLocation, + int aTimeUntilNextSound, + float aSoundStrength, + double aX, + double aY, + double aZ) { return doSoundAtClient(aSoundResourceLocation, aTimeUntilNextSound, aSoundStrength, 1.01818028F, aX, aY, aZ); } @@ -1463,40 +2217,65 @@ public class GT_Utility { * @deprecated Use {@link #doSoundAtClient(ResourceLocation, int, float, double, double, double)} */ @Deprecated - public static boolean doSoundAtClient(String aSoundName, int aTimeUntilNextSound, float aSoundStrength, double aX, double aY, double aZ) { + public static boolean doSoundAtClient( + String aSoundName, int aTimeUntilNextSound, float aSoundStrength, double aX, double aY, double aZ) { if (aSoundName == null) return false; - return doSoundAtClient(new ResourceLocation(aSoundName), aTimeUntilNextSound, aSoundStrength, 1.01818028F, aX, aY, aZ); + return doSoundAtClient( + new ResourceLocation(aSoundName), aTimeUntilNextSound, aSoundStrength, 1.01818028F, aX, aY, aZ); } - public static boolean doSoundAtClient(SoundResource aSound, int aTimeUntilNextSound, float aSoundStrength, double aX, double aY, double aZ) { + public static boolean doSoundAtClient( + SoundResource aSound, int aTimeUntilNextSound, float aSoundStrength, double aX, double aY, double aZ) { return doSoundAtClient(aSound.resourceLocation, aTimeUntilNextSound, aSoundStrength, aX, aY, aZ); } public static boolean doSoundAtClient( - SoundResource aSound, int aTimeUntilNextSound, float aSoundStrength, float aSoundModulation, - double aX, double aY, double aZ) { - return doSoundAtClient(aSound.resourceLocation, aTimeUntilNextSound, aSoundStrength, aSoundModulation, aX, aY, aZ); + SoundResource aSound, + int aTimeUntilNextSound, + float aSoundStrength, + float aSoundModulation, + double aX, + double aY, + double aZ) { + return doSoundAtClient( + aSound.resourceLocation, aTimeUntilNextSound, aSoundStrength, aSoundModulation, aX, aY, aZ); } - public static boolean doSoundAtClient( - ResourceLocation aSoundResourceLocation, int aTimeUntilNextSound, float aSoundStrength, float aSoundModulation, - double aX, double aY, double aZ) { + ResourceLocation aSoundResourceLocation, + int aTimeUntilNextSound, + float aSoundStrength, + float aSoundModulation, + double aX, + double aY, + double aZ) { if (!FMLCommonHandler.instance().getEffectiveSide().isClient() - || GT.getThePlayer() == null - || !GT.getThePlayer().worldObj.isRemote) - return false; + || GT.getThePlayer() == null + || !GT.getThePlayer().worldObj.isRemote) return false; if (GregTech_API.sMultiThreadedSounds) - new Thread(new GT_Runnable_Sound( - GT.getThePlayer().worldObj, - MathHelper.floor_double(aX), MathHelper.floor_double(aY), MathHelper.floor_double(aZ), - aTimeUntilNextSound, aSoundResourceLocation, aSoundStrength, aSoundModulation), "Sound Effect") - .start(); + new Thread( + new GT_Runnable_Sound( + GT.getThePlayer().worldObj, + MathHelper.floor_double(aX), + MathHelper.floor_double(aY), + MathHelper.floor_double(aZ), + aTimeUntilNextSound, + aSoundResourceLocation, + aSoundStrength, + aSoundModulation), + "Sound Effect") + .start(); else new GT_Runnable_Sound( - GT.getThePlayer().worldObj, - MathHelper.floor_double(aX), MathHelper.floor_double(aY), MathHelper.floor_double(aZ), - aTimeUntilNextSound, aSoundResourceLocation, aSoundStrength, aSoundModulation).run(); + GT.getThePlayer().worldObj, + MathHelper.floor_double(aX), + MathHelper.floor_double(aY), + MathHelper.floor_double(aZ), + aTimeUntilNextSound, + aSoundResourceLocation, + aSoundStrength, + aSoundModulation) + .run(); return true; } @@ -1505,20 +2284,36 @@ public class GT_Utility { * @Deprecated Use {@link #doSoundAtClient(ResourceLocation, int, float, float, double, double, double)} */ @Deprecated - public static boolean doSoundAtClient(String aSoundName, int aTimeUntilNextSound, float aSoundStrength, float aSoundModulation, double aX, double aY, double aZ) { + public static boolean doSoundAtClient( + String aSoundName, + int aTimeUntilNextSound, + float aSoundStrength, + float aSoundModulation, + double aX, + double aY, + double aZ) { if (isStringInvalid(aSoundName)) return false; - return doSoundAtClient(new ResourceLocation(aSoundName), aTimeUntilNextSound, aSoundStrength, aSoundModulation, aX, aY, aZ); + return doSoundAtClient( + new ResourceLocation(aSoundName), aTimeUntilNextSound, aSoundStrength, aSoundModulation, aX, aY, aZ); } - public static boolean sendSoundToPlayers(World aWorld, String aSoundName, float aSoundStrength, float aSoundModulation, int aX, int aY, int aZ) { + public static boolean sendSoundToPlayers( + World aWorld, String aSoundName, float aSoundStrength, float aSoundModulation, int aX, int aY, int aZ) { if (isStringInvalid(aSoundName) || aWorld == null || aWorld.isRemote) return false; - NW.sendPacketToAllPlayersInRange(aWorld, new GT_Packet_Sound(aSoundName, aSoundStrength, aSoundModulation, aX, (short) aY, aZ), aX, aZ); + NW.sendPacketToAllPlayersInRange( + aWorld, new GT_Packet_Sound(aSoundName, aSoundStrength, aSoundModulation, aX, (short) aY, aZ), aX, aZ); return true; } - public static boolean sendSoundToPlayers(World aWorld, SoundResource sound, float aSoundStrength, float aSoundModulation, int aX, int aY, int aZ) { + public static boolean sendSoundToPlayers( + World aWorld, SoundResource sound, float aSoundStrength, float aSoundModulation, int aX, int aY, int aZ) { if (aWorld == null || aWorld.isRemote) return false; - NW.sendPacketToAllPlayersInRange(aWorld, new GT_Packet_Sound(sound.resourceLocation.toString(), aSoundStrength, aSoundModulation, aX, (short) aY, aZ), aX, aZ); + NW.sendPacketToAllPlayersInRange( + aWorld, + new GT_Packet_Sound( + sound.resourceLocation.toString(), aSoundStrength, aSoundModulation, aX, (short) aY, aZ), + aX, + aZ); return true; } @@ -1626,15 +2421,21 @@ public class GT_Utility { } public static boolean isStackValid(Object aStack) { - return (aStack instanceof ItemStack) && ((ItemStack) aStack).getItem() != null && ((ItemStack) aStack).stackSize >= 0; + return (aStack instanceof ItemStack) + && ((ItemStack) aStack).getItem() != null + && ((ItemStack) aStack).stackSize >= 0; } public static boolean isStackInvalid(Object aStack) { - return aStack == null || !(aStack instanceof ItemStack) || ((ItemStack) aStack).getItem() == null || ((ItemStack) aStack).stackSize < 0; + return aStack == null + || !(aStack instanceof ItemStack) + || ((ItemStack) aStack).getItem() == null + || ((ItemStack) aStack).stackSize < 0; } public static boolean isDebugItem(ItemStack aStack) { - return /*ItemList.Armor_Cheat.isStackEqual(aStack, T, T) || */areStacksEqual(GT_ModHandler.getIC2Item("debug", 1), aStack, true); + return /*ItemList.Armor_Cheat.isStackEqual(aStack, T, T) || */ areStacksEqual( + GT_ModHandler.getIC2Item("debug", 1), aStack, true); } public static ItemStack updateItemStack(ItemStack aStack) { @@ -1674,20 +2475,24 @@ public class GT_Utility { } public static ItemStack getProjectile(SubTag aProjectileType, IInventory aInventory) { - if (aInventory != null) for (int i = 0, j = aInventory.getSizeInventory(); i < j; i++) { - ItemStack rStack = aInventory.getStackInSlot(i); - if (isStackValid(rStack) && rStack.getItem() instanceof IProjectileItem && ((IProjectileItem) rStack.getItem()).hasProjectile(aProjectileType, rStack)) - return updateItemStack(rStack); - } + if (aInventory != null) + for (int i = 0, j = aInventory.getSizeInventory(); i < j; i++) { + ItemStack rStack = aInventory.getStackInSlot(i); + if (isStackValid(rStack) + && rStack.getItem() instanceof IProjectileItem + && ((IProjectileItem) rStack.getItem()).hasProjectile(aProjectileType, rStack)) + return updateItemStack(rStack); + } return null; } public static void removeNullStacksFromInventory(IInventory aInventory) { - if (aInventory != null) for (int i = 0, j = aInventory.getSizeInventory(); i < j; i++) { - ItemStack tStack = aInventory.getStackInSlot(i); - if (tStack != null && (tStack.stackSize == 0 || tStack.getItem() == null)) - aInventory.setInventorySlotContents(i, null); - } + if (aInventory != null) + for (int i = 0, j = aInventory.getSizeInventory(); i < j; i++) { + ItemStack tStack = aInventory.getStackInSlot(i); + if (tStack != null && (tStack.stackSize == 0 || tStack.getItem() == null)) + aInventory.setInventorySlotContents(i, null); + } } /** @@ -1702,9 +2507,9 @@ public class GT_Utility { * @param page 0 to 127 * @return true if it made empty page, false if one already existed... */ - public static boolean addTexturePage(byte page){ - if(Textures.BlockIcons.casingTexturePages[page]==null){ - Textures.BlockIcons.casingTexturePages[page]=new ITexture[128]; + public static boolean addTexturePage(byte page) { + if (Textures.BlockIcons.casingTexturePages[page] == null) { + Textures.BlockIcons.casingTexturePages[page] = new ITexture[128]; return true; } return false; @@ -1717,11 +2522,11 @@ public class GT_Utility { * @param index 0 to 127 texture index * @return casing texture 0 to 16383 */ - public static int getTextureId(byte page,byte index){ - if(page>=0 && index>=0){ - return (page<<7)+index; + public static int getTextureId(byte page, byte index) { + if (page >= 0 && index >= 0) { + return (page << 7) + index; } - throw new RuntimeException("Index out of range: ["+page+"]["+index+"]"); + throw new RuntimeException("Index out of range: [" + page + "][" + index + "]"); } /** @@ -1732,11 +2537,12 @@ public class GT_Utility { * @param blockMeta meta of the block * @return casing texture 0 to 16383 */ - public static int getTextureId(byte page,byte startIndex,byte blockMeta){ - if(page>=0 && startIndex>=0 && blockMeta>=0 && (startIndex+blockMeta)<=127){ - return (page<<7)+(startIndex+blockMeta); + public static int getTextureId(byte page, byte startIndex, byte blockMeta) { + if (page >= 0 && startIndex >= 0 && blockMeta >= 0 && (startIndex + blockMeta) <= 127) { + return (page << 7) + (startIndex + blockMeta); } - throw new RuntimeException("Index out of range: ["+page+"]["+startIndex+"+"+blockMeta+"="+(startIndex+blockMeta)+"]"); + throw new RuntimeException("Index out of range: [" + page + "][" + startIndex + "+" + blockMeta + "=" + + (startIndex + blockMeta) + "]"); } /** @@ -1744,8 +2550,8 @@ public class GT_Utility { * @return casing texture 0 to 16383 */ @Deprecated - public static int getTextureId(ItemStack stack){ - return getTextureId(Block.getBlockFromItem(stack.getItem()),(byte)stack.getItemDamage()); + public static int getTextureId(ItemStack stack) { + return getTextureId(Block.getBlockFromItem(stack.getItem()), (byte) stack.getItemDamage()); } /** @@ -1768,8 +2574,8 @@ public class GT_Utility { } } } - throw new RuntimeException("Probably missing mapping or different texture class used for: " + - blockFromBlock.getUnlocalizedName() + " meta:" + metaFromBlock); + throw new RuntimeException("Probably missing mapping or different texture class used for: " + + blockFromBlock.getUnlocalizedName() + " meta:" + metaFromBlock); } /** @@ -1881,7 +2687,10 @@ public class GT_Utility { public static float getHeatDamageFromItem(ItemStack aStack) { ItemData tData = GT_OreDictUnificator.getItemData(aStack); - return tData == null ? 0 : (tData.mPrefix == null ? 0 : tData.mPrefix.mHeatDamage) + (tData.hasValidMaterialData() ? tData.mMaterial.mMaterial.mHeatDamage : 0); + return tData == null + ? 0 + : (tData.mPrefix == null ? 0 : tData.mPrefix.mHeatDamage) + + (tData.hasValidMaterialData() ? tData.mMaterial.mMaterial.mHeatDamage : 0); } public static int getRadioactivityLevel(ItemStack aStack) { @@ -1908,7 +2717,10 @@ public class GT_Utility { } private static boolean applyHeatDamage(EntityLivingBase aEntity, float aDamage, DamageSource source) { - if (aDamage > 0 && aEntity != null && aEntity.getActivePotionEffect(Potion.fireResistance) == null && !isWearingFullHeatHazmat(aEntity)) { + if (aDamage > 0 + && aEntity != null + && aEntity.getActivePotionEffect(Potion.fireResistance) == null + && !isWearingFullHeatHazmat(aEntity)) { aEntity.attackEntityFrom(source, aDamage); return true; } @@ -1933,14 +2745,66 @@ public class GT_Utility { } public static boolean applyRadioactivity(EntityLivingBase aEntity, int aLevel, int aAmountOfItems) { - if (aLevel > 0 && aEntity != null && aEntity.getCreatureAttribute() != EnumCreatureAttribute.UNDEAD && aEntity.getCreatureAttribute() != EnumCreatureAttribute.ARTHROPOD && !isWearingFullRadioHazmat(aEntity)) { + if (aLevel > 0 + && aEntity != null + && aEntity.getCreatureAttribute() != EnumCreatureAttribute.UNDEAD + && aEntity.getCreatureAttribute() != EnumCreatureAttribute.ARTHROPOD + && !isWearingFullRadioHazmat(aEntity)) { PotionEffect tEffect = null; - aEntity.addPotionEffect(new PotionEffect(Potion.moveSlowdown.id, aLevel * 140 * aAmountOfItems + Math.max(0, ((tEffect = aEntity.getActivePotionEffect(Potion.moveSlowdown)) == null ? 0 : tEffect.getDuration())), Math.max(0, (5 * aLevel) / 7))); - aEntity.addPotionEffect(new PotionEffect(Potion.digSlowdown.id, aLevel * 150 * aAmountOfItems + Math.max(0, ((tEffect = aEntity.getActivePotionEffect(Potion.digSlowdown)) == null ? 0 : tEffect.getDuration())), Math.max(0, (5 * aLevel) / 7))); - aEntity.addPotionEffect(new PotionEffect(Potion.confusion.id, aLevel * 130 * aAmountOfItems + Math.max(0, ((tEffect = aEntity.getActivePotionEffect(Potion.confusion)) == null ? 0 : tEffect.getDuration())), Math.max(0, (5 * aLevel) / 7))); - aEntity.addPotionEffect(new PotionEffect(Potion.weakness.id, aLevel * 150 * aAmountOfItems + Math.max(0, ((tEffect = aEntity.getActivePotionEffect(Potion.weakness)) == null ? 0 : tEffect.getDuration())), Math.max(0, (5 * aLevel) / 7))); - aEntity.addPotionEffect(new PotionEffect(Potion.hunger.id, aLevel * 130 * aAmountOfItems + Math.max(0, ((tEffect = aEntity.getActivePotionEffect(Potion.hunger)) == null ? 0 : tEffect.getDuration())), Math.max(0, (5 * aLevel) / 7))); - aEntity.addPotionEffect(new PotionEffect(24 /* IC2 Radiation */, aLevel * 180 * aAmountOfItems + Math.max(0, ((tEffect = aEntity.getActivePotionEffect(Potion.potionTypes[24])) == null ? 0 : tEffect.getDuration())), Math.max(0, (5 * aLevel) / 7))); + aEntity.addPotionEffect(new PotionEffect( + Potion.moveSlowdown.id, + aLevel * 140 * aAmountOfItems + + Math.max( + 0, + ((tEffect = aEntity.getActivePotionEffect(Potion.moveSlowdown)) == null + ? 0 + : tEffect.getDuration())), + Math.max(0, (5 * aLevel) / 7))); + aEntity.addPotionEffect(new PotionEffect( + Potion.digSlowdown.id, + aLevel * 150 * aAmountOfItems + + Math.max( + 0, + ((tEffect = aEntity.getActivePotionEffect(Potion.digSlowdown)) == null + ? 0 + : tEffect.getDuration())), + Math.max(0, (5 * aLevel) / 7))); + aEntity.addPotionEffect(new PotionEffect( + Potion.confusion.id, + aLevel * 130 * aAmountOfItems + + Math.max( + 0, + ((tEffect = aEntity.getActivePotionEffect(Potion.confusion)) == null + ? 0 + : tEffect.getDuration())), + Math.max(0, (5 * aLevel) / 7))); + aEntity.addPotionEffect(new PotionEffect( + Potion.weakness.id, + aLevel * 150 * aAmountOfItems + + Math.max( + 0, + ((tEffect = aEntity.getActivePotionEffect(Potion.weakness)) == null + ? 0 + : tEffect.getDuration())), + Math.max(0, (5 * aLevel) / 7))); + aEntity.addPotionEffect(new PotionEffect( + Potion.hunger.id, + aLevel * 130 * aAmountOfItems + + Math.max( + 0, + ((tEffect = aEntity.getActivePotionEffect(Potion.hunger)) == null + ? 0 + : tEffect.getDuration())), + Math.max(0, (5 * aLevel) / 7))); + aEntity.addPotionEffect(new PotionEffect( + 24 /* IC2 Radiation */, + aLevel * 180 * aAmountOfItems + + Math.max( + 0, + ((tEffect = aEntity.getActivePotionEffect(Potion.potionTypes[24])) == null + ? 0 + : tEffect.getDuration())), + Math.max(0, (5 * aLevel) / 7))); return true; } return false; @@ -2070,7 +2934,8 @@ public class GT_Utility { } public static boolean isStackInList(GT_ItemStack aStack, Collection<GT_ItemStack> aList) { - return aStack != null && (aList.contains(aStack) || aList.contains(new GT_ItemStack(aStack.mItem, aStack.mStackSize, W))); + return aStack != null + && (aList.contains(aStack) || aList.contains(new GT_ItemStack(aStack.mItem, aStack.mStackSize, W))); } /** @@ -2084,7 +2949,9 @@ 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)); } /** @@ -2093,7 +2960,7 @@ 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()); @@ -2111,7 +2978,10 @@ public class GT_Utility { * Translates a Material Amount into an Amount of Fluid. Second Parameter for things like Bucket Amounts (1000) and similar */ public static long translateMaterialToAmount(long aMaterialAmount, long aAmountPerUnit, boolean aRoundUp) { - return Math.max(0, ((aMaterialAmount * aAmountPerUnit) / M) + (aRoundUp && (aMaterialAmount * aAmountPerUnit) % M > 0 ? 1 : 0)); + return Math.max( + 0, + ((aMaterialAmount * aAmountPerUnit) / M) + + (aRoundUp && (aMaterialAmount * aAmountPerUnit) % M > 0 ? 1 : 0)); } /** @@ -2119,31 +2989,41 @@ public class GT_Utility { * Used for my Teleporter. */ public static boolean isRealDimension(int aDimensionID) { - if(aDimensionID<=1 && aDimensionID>=-1 && !GregTech_API.sDimensionalList.contains(aDimensionID)) return true; - return !GregTech_API.sDimensionalList.contains(aDimensionID) && DimensionManager.isDimensionRegistered(aDimensionID); + if (aDimensionID <= 1 && aDimensionID >= -1 && !GregTech_API.sDimensionalList.contains(aDimensionID)) + return true; + return !GregTech_API.sDimensionalList.contains(aDimensionID) + && DimensionManager.isDimensionRegistered(aDimensionID); } - public static boolean moveEntityToDimensionAtCoords(Entity entity, int aDimension, double aX, double aY, double aZ) { - //Credit goes to BrandonCore Author :!: + public static boolean moveEntityToDimensionAtCoords( + Entity entity, int aDimension, double aX, double aY, double aZ) { + // Credit goes to BrandonCore Author :!: if (entity == null || entity.worldObj.isRemote) return false; if (entity.ridingEntity != null) entity.mountEntity(null); 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;} + if (destinationWorld == null) { + return false; + } boolean interDimensional = startWorld.provider.dimensionId != destinationWorld.provider.dimensionId; - if(!interDimensional)return false; - startWorld.updateEntityWithOptionalForce(entity, false);//added + if (!interDimensional) return false; + startWorld.updateEntityWithOptionalForce(entity, false); // added if ((entity instanceof EntityPlayerMP) && interDimensional) { EntityPlayerMP player = (EntityPlayerMP) entity; - player.closeScreen();//added + player.closeScreen(); // added player.dimension = aDimension; - player.playerNetServerHandler.sendPacket(new S07PacketRespawn(player.dimension, player.worldObj.difficultySetting, destinationWorld.getWorldInfo().getTerrainType(), player.theItemInWorldManager.getGameType())); + player.playerNetServerHandler.sendPacket(new S07PacketRespawn( + player.dimension, + player.worldObj.difficultySetting, + destinationWorld.getWorldInfo().getTerrainType(), + player.theItemInWorldManager.getGameType())); ((WorldServer) startWorld).getPlayerManager().removePlayer(player); startWorld.playerEntities.remove(player); @@ -2197,15 +3077,19 @@ public class GT_Utility { if (((entity instanceof EntityPlayerMP)) && interDimensional) { EntityPlayerMP player = (EntityPlayerMP) entity; player.theItemInWorldManager.setWorld((WorldServer) destinationWorld); - player.mcServer.getConfigurationManager().updateTimeAndWeatherForPlayer(player, (WorldServer) destinationWorld); + player.mcServer.getConfigurationManager().updateTimeAndWeatherForPlayer(player, (WorldServer) + destinationWorld); player.mcServer.getConfigurationManager().syncPlayerInventory(player); for (PotionEffect potionEffect : (Iterable<PotionEffect>) player.getActivePotionEffects()) { player.playerNetServerHandler.sendPacket(new S1DPacketEntityEffect(player.getEntityId(), potionEffect)); } - player.playerNetServerHandler.sendPacket(new S1FPacketSetExperience(player.experience, player.experienceTotal, player.experienceLevel)); - FMLCommonHandler.instance().firePlayerChangedDimensionEvent(player, startWorld.provider.dimensionId, destinationWorld.provider.dimensionId); + player.playerNetServerHandler.sendPacket( + new S1FPacketSetExperience(player.experience, player.experienceTotal, player.experienceLevel)); + FMLCommonHandler.instance() + .firePlayerChangedDimensionEvent( + player, startWorld.provider.dimensionId, destinationWorld.provider.dimensionId); } entity.setLocationAndAngles(aX, aY, aZ, entity.rotationYaw, entity.rotationPitch); @@ -2215,10 +3099,21 @@ public class GT_Utility { } public static int getScaleCoordinates(double aValue, int aScale) { - return (int)Math.floor(aValue / aScale); - } - - public static int getCoordinateScan(ArrayList<String> aList, EntityPlayer aPlayer, World aWorld, int aScanLevel, int aX, int aY, int aZ, int aSide, float aClickX, float aClickY, float aClickZ) { + return (int) Math.floor(aValue / aScale); + } + + public static int getCoordinateScan( + ArrayList<String> aList, + EntityPlayer aPlayer, + World aWorld, + int aScanLevel, + int aX, + int aY, + int aZ, + int aSide, + float aClickX, + float aClickY, + float aClickZ) { if (aList == null) return 0; ArrayList<String> tList = new ArrayList<>(); @@ -2228,25 +3123,43 @@ public class GT_Utility { final Block tBlock = aWorld.getBlock(aX, aY, aZ); - tList.add( - "----- X: " + EnumChatFormatting.AQUA + formatNumbers(aX) + EnumChatFormatting.RESET + - " Y: " + EnumChatFormatting.AQUA + formatNumbers(aY) + EnumChatFormatting.RESET + - " Z: " + EnumChatFormatting.AQUA + formatNumbers(aZ) + EnumChatFormatting.RESET + - " D: " + EnumChatFormatting.AQUA + aWorld.provider.dimensionId + EnumChatFormatting.RESET + " -----"); + tList.add("----- X: " + EnumChatFormatting.AQUA + formatNumbers(aX) + EnumChatFormatting.RESET + " Y: " + + EnumChatFormatting.AQUA + formatNumbers(aY) + EnumChatFormatting.RESET + " Z: " + + EnumChatFormatting.AQUA + formatNumbers(aZ) + EnumChatFormatting.RESET + " D: " + + EnumChatFormatting.AQUA + aWorld.provider.dimensionId + EnumChatFormatting.RESET + " -----"); try { if (tTileEntity instanceof IInventory) - tList.add( - GT_Utility.trans("162","Name: ") + EnumChatFormatting.BLUE + ((IInventory) tTileEntity).getInventoryName() + EnumChatFormatting.RESET + - GT_Utility.trans("163"," MetaData: ") + EnumChatFormatting.AQUA + aWorld.getBlockMetadata(aX, aY, aZ) + EnumChatFormatting.RESET); + tList.add(GT_Utility.trans("162", "Name: ") + + EnumChatFormatting.BLUE + + ((IInventory) tTileEntity).getInventoryName() + + EnumChatFormatting.RESET + + GT_Utility.trans("163", " MetaData: ") + + EnumChatFormatting.AQUA + + aWorld.getBlockMetadata(aX, aY, aZ) + + EnumChatFormatting.RESET); else - tList.add( - GT_Utility.trans("162","Name: ") + EnumChatFormatting.BLUE + tBlock.getUnlocalizedName() + EnumChatFormatting.RESET + - GT_Utility.trans("163"," MetaData: ") + EnumChatFormatting.AQUA + aWorld.getBlockMetadata(aX, aY, aZ) + EnumChatFormatting.RESET); - - tList.add( - GT_Utility.trans("164","Hardness: ") + EnumChatFormatting.YELLOW + tBlock.getBlockHardness(aWorld, aX, aY, aZ) + EnumChatFormatting.RESET + - GT_Utility.trans("165"," Blast Resistance: ") + EnumChatFormatting.YELLOW + tBlock.getExplosionResistance(aPlayer, aWorld, aX, aY, aZ, aPlayer.posX, aPlayer.posY, aPlayer.posZ) + EnumChatFormatting.RESET); - if (tBlock.isBeaconBase(aWorld, aX, aY, aZ, aX, aY + 1, aZ)) tList.add(EnumChatFormatting.GOLD + GT_Utility.trans("166","Is valid Beacon Pyramid Material") + EnumChatFormatting.RESET); + tList.add(GT_Utility.trans("162", "Name: ") + + EnumChatFormatting.BLUE + + tBlock.getUnlocalizedName() + + EnumChatFormatting.RESET + + GT_Utility.trans("163", " MetaData: ") + + EnumChatFormatting.AQUA + + aWorld.getBlockMetadata(aX, aY, aZ) + + EnumChatFormatting.RESET); + + tList.add(GT_Utility.trans("164", "Hardness: ") + + EnumChatFormatting.YELLOW + + tBlock.getBlockHardness(aWorld, aX, aY, aZ) + + EnumChatFormatting.RESET + + GT_Utility.trans("165", " Blast Resistance: ") + + EnumChatFormatting.YELLOW + + tBlock.getExplosionResistance( + aPlayer, aWorld, aX, aY, aZ, aPlayer.posX, aPlayer.posY, aPlayer.posZ) + + EnumChatFormatting.RESET); + if (tBlock.isBeaconBase(aWorld, aX, aY, aZ, aX, aY + 1, aZ)) + tList.add(EnumChatFormatting.GOLD + + GT_Utility.trans("166", "Is valid Beacon Pyramid Material") + + EnumChatFormatting.RESET); } catch (Throwable e) { if (D1) e.printStackTrace(GT_Log.err); } @@ -2254,13 +3167,17 @@ public class GT_Utility { try { if (tTileEntity instanceof IFluidHandler) { rEUAmount += 500; - 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 + ": " + - EnumChatFormatting.GREEN + formatNumbers((tTanks[i].fluid == null ? 0 : tTanks[i].fluid.amount)) + EnumChatFormatting.RESET + " L / " + - EnumChatFormatting.YELLOW + formatNumbers(tTanks[i].capacity) + EnumChatFormatting.RESET + " L " + EnumChatFormatting.GOLD + getFluidName(tTanks[i].fluid, true) + EnumChatFormatting.RESET); - } + 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 + ": " + EnumChatFormatting.GREEN + + formatNumbers((tTanks[i].fluid == null ? 0 : tTanks[i].fluid.amount)) + + EnumChatFormatting.RESET + " L / " + EnumChatFormatting.YELLOW + + formatNumbers(tTanks[i].capacity) + EnumChatFormatting.RESET + " L " + + EnumChatFormatting.GOLD + getFluidName(tTanks[i].fluid, true) + + EnumChatFormatting.RESET); + } } } catch (Throwable e) { if (D1) e.printStackTrace(GT_Log.err); @@ -2276,12 +3193,17 @@ public class GT_Utility { try { if (tTileEntity instanceof ic2.api.reactor.IReactor) { rEUAmount += 500; + tList.add(GT_Utility.trans("168", "Heat: ") + EnumChatFormatting.GREEN + + formatNumbers(((ic2.api.reactor.IReactor) tTileEntity).getHeat()) + + EnumChatFormatting.RESET + " / " + EnumChatFormatting.YELLOW + + formatNumbers(((ic2.api.reactor.IReactor) tTileEntity).getMaxHeat()) + + EnumChatFormatting.RESET); tList.add( - GT_Utility.trans("168","Heat: ") + EnumChatFormatting.GREEN + formatNumbers(((ic2.api.reactor.IReactor) tTileEntity).getHeat()) + EnumChatFormatting.RESET + " / " + - EnumChatFormatting.YELLOW + formatNumbers(((ic2.api.reactor.IReactor) tTileEntity).getMaxHeat()) + EnumChatFormatting.RESET); - tList.add( - GT_Utility.trans("169","HEM: ") + EnumChatFormatting.YELLOW + ((ic2.api.reactor.IReactor) tTileEntity).getHeatEffectModifier() + EnumChatFormatting.RESET - /* + GT_Utility.trans("170"," Base EU Output: ")/* + ((ic2.api.reactor.IReactor)tTileEntity).getOutput()*/); + GT_Utility.trans("169", "HEM: ") + + EnumChatFormatting.YELLOW + + ((ic2.api.reactor.IReactor) tTileEntity).getHeatEffectModifier() + + EnumChatFormatting.RESET + /* + GT_Utility.trans("170"," Base EU Output: ")/* + ((ic2.api.reactor.IReactor)tTileEntity).getOutput()*/ ); } } catch (Throwable e) { if (D1) e.printStackTrace(GT_Log.err); @@ -2291,7 +3213,10 @@ public class GT_Utility { final IAlignment tAlignment = ((IAlignmentProvider) tTileEntity).getAlignment(); if (tAlignment != null) { rEUAmount += 100; - tList.add(GT_Utility.trans("219", "Extended Facing: ") + EnumChatFormatting.GREEN + tAlignment.getExtendedFacing() + EnumChatFormatting.RESET); + tList.add(GT_Utility.trans("219", "Extended Facing: ") + + EnumChatFormatting.GREEN + + tAlignment.getExtendedFacing() + + EnumChatFormatting.RESET); } } } catch (Throwable e) { @@ -2300,8 +3225,19 @@ public class GT_Utility { try { if (tTileEntity instanceof ic2.api.tile.IWrenchable) { rEUAmount += 100; - tList.add(GT_Utility.trans("171","Facing: ") +EnumChatFormatting.GREEN+ ((ic2.api.tile.IWrenchable) tTileEntity).getFacing() +EnumChatFormatting.RESET+ GT_Utility.trans("172"," / Chance: ") +EnumChatFormatting.YELLOW+ (((ic2.api.tile.IWrenchable) tTileEntity).getWrenchDropRate() * 100) +EnumChatFormatting.RESET+ "%"); - tList.add(((ic2.api.tile.IWrenchable) tTileEntity).wrenchCanRemove(aPlayer) ? EnumChatFormatting.GREEN+ GT_Utility.trans("173","You can remove this with a Wrench") +EnumChatFormatting.RESET : EnumChatFormatting.RED+ GT_Utility.trans("174","You can NOT remove this with a Wrench") +EnumChatFormatting.RESET); + tList.add(GT_Utility.trans("171", "Facing: ") + EnumChatFormatting.GREEN + + ((ic2.api.tile.IWrenchable) tTileEntity).getFacing() + EnumChatFormatting.RESET + + GT_Utility.trans("172", " / Chance: ") + EnumChatFormatting.YELLOW + + (((ic2.api.tile.IWrenchable) tTileEntity).getWrenchDropRate() * 100) + + EnumChatFormatting.RESET + "%"); + tList.add( + ((ic2.api.tile.IWrenchable) tTileEntity).wrenchCanRemove(aPlayer) + ? EnumChatFormatting.GREEN + + GT_Utility.trans("173", "You can remove this with a Wrench") + + EnumChatFormatting.RESET + : EnumChatFormatting.RED + + GT_Utility.trans("174", "You can NOT remove this with a Wrench") + + EnumChatFormatting.RESET); } } catch (Throwable e) { if (D1) e.printStackTrace(GT_Log.err); @@ -2309,7 +3245,10 @@ public class GT_Utility { try { if (tTileEntity instanceof ic2.api.energy.tile.IEnergyConductor) { rEUAmount += 200; - tList.add(GT_Utility.trans("175","Conduction Loss: ") + EnumChatFormatting.YELLOW + ((ic2.api.energy.tile.IEnergyConductor) tTileEntity).getConductionLoss() + EnumChatFormatting.RESET); + tList.add(GT_Utility.trans("175", "Conduction Loss: ") + + EnumChatFormatting.YELLOW + + ((ic2.api.energy.tile.IEnergyConductor) tTileEntity).getConductionLoss() + + EnumChatFormatting.RESET); } } catch (Throwable e) { if (D1) e.printStackTrace(GT_Log.err); @@ -2317,9 +3256,11 @@ public class GT_Utility { try { if (tTileEntity instanceof ic2.api.tile.IEnergyStorage) { rEUAmount += 200; - tList.add( - GT_Utility.trans("176","Contained Energy: ") + EnumChatFormatting.YELLOW + formatNumbers(((ic2.api.tile.IEnergyStorage) tTileEntity).getStored()) + EnumChatFormatting.RESET + " EU / " + - EnumChatFormatting.YELLOW + formatNumbers(((ic2.api.tile.IEnergyStorage) tTileEntity).getCapacity()) + EnumChatFormatting.RESET + " EU"); + tList.add(GT_Utility.trans("176", "Contained Energy: ") + EnumChatFormatting.YELLOW + + formatNumbers(((ic2.api.tile.IEnergyStorage) tTileEntity).getStored()) + + EnumChatFormatting.RESET + " EU / " + EnumChatFormatting.YELLOW + + formatNumbers(((ic2.api.tile.IEnergyStorage) tTileEntity).getCapacity()) + + EnumChatFormatting.RESET + " EU"); } } catch (Throwable e) { if (D1) e.printStackTrace(GT_Log.err); @@ -2327,7 +3268,10 @@ public class GT_Utility { try { if (tTileEntity instanceof IUpgradableMachine) { rEUAmount += 500; - if (((IUpgradableMachine) tTileEntity).hasMufflerUpgrade()) tList.add(EnumChatFormatting.GREEN + GT_Utility.trans("177","Has Muffler Upgrade") + EnumChatFormatting.RESET); + if (((IUpgradableMachine) tTileEntity).hasMufflerUpgrade()) + tList.add(EnumChatFormatting.GREEN + + GT_Utility.trans("177", "Has Muffler Upgrade") + + EnumChatFormatting.RESET); } } catch (Throwable e) { if (D1) e.printStackTrace(GT_Log.err); @@ -2343,8 +3287,10 @@ public class GT_Utility { rEUAmount += 400; int tValue = 0; if (0 < (tValue = ((IMachineProgress) tTileEntity).getMaxProgress())) - tList.add(GT_Utility.trans("178","Progress/Load: ") + EnumChatFormatting.GREEN + formatNumbers(((IMachineProgress) tTileEntity).getProgress()) + EnumChatFormatting.RESET + " / " + - EnumChatFormatting.YELLOW + formatNumbers(tValue) + EnumChatFormatting.RESET); + tList.add(GT_Utility.trans("178", "Progress/Load: ") + EnumChatFormatting.GREEN + + formatNumbers(((IMachineProgress) tTileEntity).getProgress()) + + EnumChatFormatting.RESET + " / " + EnumChatFormatting.YELLOW + formatNumbers(tValue) + + EnumChatFormatting.RESET); } } catch (Throwable e) { if (D1) e.printStackTrace(GT_Log.err); @@ -2352,36 +3298,55 @@ public class GT_Utility { try { if (tTileEntity instanceof ICoverable) { rEUAmount += 300; - final String tString = ((ICoverable) tTileEntity).getCoverBehaviorAtSideNew((byte) aSide).getDescription((byte) aSide, ((ICoverable) tTileEntity).getCoverIDAtSide((byte) aSide), ((ICoverable) tTileEntity).getComplexCoverDataAtSide((byte) aSide), (ICoverable) tTileEntity); + final String tString = ((ICoverable) tTileEntity) + .getCoverBehaviorAtSideNew((byte) aSide) + .getDescription( + (byte) aSide, + ((ICoverable) tTileEntity).getCoverIDAtSide((byte) aSide), + ((ICoverable) tTileEntity).getComplexCoverDataAtSide((byte) aSide), + (ICoverable) tTileEntity); if (tString != null && !tString.equals(E)) tList.add(tString); } } catch (Throwable e) { if (D1) e.printStackTrace(GT_Log.err); } try { - if (tTileEntity instanceof IBasicEnergyContainer && ((IBasicEnergyContainer) tTileEntity).getEUCapacity() > 0) { - tList.add( - GT_Utility.trans("179","Max IN: ") + EnumChatFormatting.RED + formatNumbers(((IBasicEnergyContainer) tTileEntity).getInputVoltage()) + " (" + GT_Values.VN[getTier(((IBasicEnergyContainer) tTileEntity).getInputVoltage())] + ") " + EnumChatFormatting.RESET + - GT_Utility.trans("182"," EU at ") + EnumChatFormatting.RED + formatNumbers(((IBasicEnergyContainer)tTileEntity).getInputAmperage()) + EnumChatFormatting.RESET + GT_Utility.trans("183"," A")); - tList.add( - GT_Utility.trans("181","Max OUT: ") + EnumChatFormatting.RED + formatNumbers(((IBasicEnergyContainer) tTileEntity).getOutputVoltage()) + " (" + GT_Values.VN[getTier(((IBasicEnergyContainer) tTileEntity).getOutputVoltage())] + ") " + EnumChatFormatting.RESET + - GT_Utility.trans("182"," EU at ") + EnumChatFormatting.RED + formatNumbers(((IBasicEnergyContainer) tTileEntity).getOutputAmperage()) + EnumChatFormatting.RESET + GT_Utility.trans("183"," A")); - tList.add( - GT_Utility.trans("184","Energy: ") + EnumChatFormatting.GREEN + formatNumbers(((IBasicEnergyContainer) tTileEntity).getStoredEU()) + EnumChatFormatting.RESET + " EU / " + - EnumChatFormatting.YELLOW + formatNumbers(((IBasicEnergyContainer) tTileEntity).getEUCapacity()) + EnumChatFormatting.RESET + " EU"); + if (tTileEntity instanceof IBasicEnergyContainer + && ((IBasicEnergyContainer) tTileEntity).getEUCapacity() > 0) { + tList.add(GT_Utility.trans("179", "Max IN: ") + EnumChatFormatting.RED + + formatNumbers(((IBasicEnergyContainer) tTileEntity).getInputVoltage()) + " (" + + GT_Values.VN[getTier(((IBasicEnergyContainer) tTileEntity).getInputVoltage())] + ") " + + EnumChatFormatting.RESET + GT_Utility.trans("182", " EU at ") + EnumChatFormatting.RED + + formatNumbers(((IBasicEnergyContainer) tTileEntity).getInputAmperage()) + + EnumChatFormatting.RESET + GT_Utility.trans("183", " A")); + tList.add(GT_Utility.trans("181", "Max OUT: ") + EnumChatFormatting.RED + + formatNumbers(((IBasicEnergyContainer) tTileEntity).getOutputVoltage()) + " (" + + GT_Values.VN[getTier(((IBasicEnergyContainer) tTileEntity).getOutputVoltage())] + ") " + + EnumChatFormatting.RESET + GT_Utility.trans("182", " EU at ") + EnumChatFormatting.RED + + formatNumbers(((IBasicEnergyContainer) tTileEntity).getOutputAmperage()) + + EnumChatFormatting.RESET + GT_Utility.trans("183", " A")); + tList.add(GT_Utility.trans("184", "Energy: ") + EnumChatFormatting.GREEN + + formatNumbers(((IBasicEnergyContainer) tTileEntity).getStoredEU()) + + EnumChatFormatting.RESET + " EU / " + EnumChatFormatting.YELLOW + + formatNumbers(((IBasicEnergyContainer) tTileEntity).getEUCapacity()) + + EnumChatFormatting.RESET + " EU"); } } catch (Throwable e) { if (D1) e.printStackTrace(GT_Log.err); } try { if (tTileEntity instanceof IGregTechTileEntity) { - tList.add(GT_Utility.trans("186","Owned by: ") + EnumChatFormatting.BLUE + ((IGregTechTileEntity) tTileEntity).getOwnerName() + EnumChatFormatting.RESET); + tList.add(GT_Utility.trans("186", "Owned by: ") + + EnumChatFormatting.BLUE + + ((IGregTechTileEntity) tTileEntity).getOwnerName() + + EnumChatFormatting.RESET); } } catch (Throwable e) { if (D1) e.printStackTrace(GT_Log.err); } try { - if (tTileEntity instanceof IGregTechDeviceInformation && ((IGregTechDeviceInformation) tTileEntity).isGivingInformation()) { + if (tTileEntity instanceof IGregTechDeviceInformation + && ((IGregTechDeviceInformation) tTileEntity).isGivingInformation()) { tList.addAll(Arrays.asList(((IGregTechDeviceInformation) tTileEntity).getInfoData())); } } catch (Throwable e) { @@ -2391,32 +3356,40 @@ public class GT_Utility { if (tTileEntity instanceof ic2.api.crops.ICropTile) { rEUAmount += 1000; final ic2.api.crops.ICropTile crop = (ic2.api.crops.ICropTile) tTileEntity; - if (crop.getScanLevel() < 4) - crop.setScanLevel((byte) 4); + 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("188", " Growth: ") + crop.getGrowth() - + GT_Utility.trans("189", " Gain: ") + crop.getGain() - + GT_Utility.trans("190", " Resistance: ") + crop.getResistance() - ); + tList.add(GT_Utility.trans("187", "Type -- Crop-Name: ") + + crop.getCrop().name() + + GT_Utility.trans("188", " Growth: ") + + crop.getGrowth() + + GT_Utility.trans("189", " Gain: ") + + crop.getGain() + + GT_Utility.trans("190", " Resistance: ") + + crop.getResistance()); } - tList.add(GT_Utility.trans("191","Plant -- Fertilizer: ") + crop.getNutrientStorage() - + GT_Utility.trans("192"," Water: ") + crop.getHydrationStorage() - + GT_Utility.trans("193"," Weed-Ex: ") + crop.getWeedExStorage() - + GT_Utility.trans("194"," Scan-Level: ") + crop.getScanLevel() - ); - tList.add(GT_Utility.trans("195","Environment -- Nutrients: ") + crop.getNutrients() - + GT_Utility.trans("196"," Humidity: ") + crop.getHumidity() - + GT_Utility.trans("197"," Air-Quality: ") + crop.getAirQuality() - ); + tList.add(GT_Utility.trans("191", "Plant -- Fertilizer: ") + + crop.getNutrientStorage() + + GT_Utility.trans("192", " Water: ") + + crop.getHydrationStorage() + + GT_Utility.trans("193", " Weed-Ex: ") + + crop.getWeedExStorage() + + GT_Utility.trans("194", " Scan-Level: ") + + crop.getScanLevel()); + tList.add(GT_Utility.trans("195", "Environment -- Nutrients: ") + + crop.getNutrients() + + GT_Utility.trans("196", " Humidity: ") + + crop.getHumidity() + + GT_Utility.trans("197", " Air-Quality: ") + + crop.getAirQuality()); if (crop.getCrop() != null) { final StringBuilder tStringB = new StringBuilder(); 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("198", "Attributes:") + tString.replaceFirst(",", E)); + tList.add(GT_Utility.trans("199", "Discovered by: ") + + crop.getCrop().discoveredBy()); } } } catch (Throwable e) { @@ -2425,34 +3398,41 @@ public class GT_Utility { try { if (tTileEntity instanceof forestry.arboriculture.tiles.TileLeaves) { - final forestry.arboriculture.tiles.TileLeaves tileLeaves = (forestry.arboriculture.tiles.TileLeaves)tTileEntity; + final forestry.arboriculture.tiles.TileLeaves tileLeaves = + (forestry.arboriculture.tiles.TileLeaves) tTileEntity; final forestry.api.arboriculture.ITree tree = tileLeaves.getTree(); - if (tree != null ) { + if (tree != null) { rEUAmount += 1000; - if (!tree.isAnalyzed()) - tree.analyze(); + if (!tree.isAnalyzed()) tree.analyze(); tree.addTooltip(tList); } } } catch (Throwable e) { if (D1) e.printStackTrace(GT_Log.err); } - } final Chunk currentChunk = aWorld.getChunkFromBlockCoords(aX, aZ); if (aPlayer.capabilities.isCreativeMode) { - final FluidStack tFluid = undergroundOilReadInformation(currentChunk);//-# to only read - if (tFluid!=null) - tList.add(EnumChatFormatting.GOLD + tFluid.getLocalizedName() + EnumChatFormatting.RESET + ": " + EnumChatFormatting.YELLOW + formatNumbers(tFluid.amount) + EnumChatFormatting.RESET + " L"); + final FluidStack tFluid = undergroundOilReadInformation(currentChunk); // -# to only read + if (tFluid != null) + tList.add(EnumChatFormatting.GOLD + tFluid.getLocalizedName() + EnumChatFormatting.RESET + ": " + + EnumChatFormatting.YELLOW + formatNumbers(tFluid.amount) + EnumChatFormatting.RESET + " L"); else - tList.add(EnumChatFormatting.GOLD + GT_Utility.trans("201","Nothing") + EnumChatFormatting.RESET + ": " + EnumChatFormatting.YELLOW + '0' + EnumChatFormatting.RESET + " L"); + tList.add(EnumChatFormatting.GOLD + GT_Utility.trans("201", "Nothing") + EnumChatFormatting.RESET + ": " + + EnumChatFormatting.YELLOW + '0' + EnumChatFormatting.RESET + " L"); } -// if(aPlayer.capabilities.isCreativeMode){ + // if(aPlayer.capabilities.isCreativeMode){ if (GT_Pollution.hasPollution(currentChunk)) { - tList.add(GT_Utility.trans("202", "Pollution in Chunk: ") + EnumChatFormatting.RED + formatNumbers(GT_Pollution.getPollution(currentChunk)) + EnumChatFormatting.RESET + GT_Utility.trans("203", " gibbl")); + tList.add(GT_Utility.trans("202", "Pollution in Chunk: ") + + EnumChatFormatting.RED + + formatNumbers(GT_Pollution.getPollution(currentChunk)) + + EnumChatFormatting.RESET + + GT_Utility.trans("203", " gibbl")); } else { - tList.add(EnumChatFormatting.GREEN + GT_Utility.trans("204", "No Pollution in Chunk! HAYO!") + EnumChatFormatting.RESET); + tList.add(EnumChatFormatting.GREEN + + GT_Utility.trans("204", "No Pollution in Chunk! HAYO!") + + EnumChatFormatting.RESET); } try { @@ -2465,15 +3445,28 @@ public class GT_Utility { if (D1) e.printStackTrace(GT_Log.err); } - final BlockScanningEvent tEvent = new BlockScanningEvent(aWorld, aPlayer, aX, aY, aZ, (byte) aSide, aScanLevel, tBlock, tTileEntity, tList, aClickX, aClickY, aClickZ); + final BlockScanningEvent tEvent = new BlockScanningEvent( + aWorld, + aPlayer, + aX, + aY, + aZ, + (byte) aSide, + aScanLevel, + tBlock, + tTileEntity, + tList, + aClickX, + aClickY, + aClickZ); tEvent.mEUCost = rEUAmount; MinecraftForge.EVENT_BUS.post(tEvent); if (!tEvent.isCanceled()) aList.addAll(tList); return tEvent.mEUCost; } - public static String trans(String aKey, String aEnglish){ - return GT_LanguageManager.addStringLocalization("Interaction_DESCRIPTION_Index_" + aKey, aEnglish, false); + public static String trans(String aKey, String aEnglish) { + return GT_LanguageManager.addStringLocalization("Interaction_DESCRIPTION_Index_" + aKey, aEnglish, false); } /** @@ -2482,19 +3475,19 @@ public class GT_Utility { public static float[] getClickedFacingCoords(byte aSide, float aX, float aY, float aZ) { switch (aSide) { case 0: - return new float[]{Math.min(0.99F, Math.max(0, 1 - aX)), Math.min(0.99F, Math.max(0, aZ))}; + return new float[] {Math.min(0.99F, Math.max(0, 1 - aX)), Math.min(0.99F, Math.max(0, aZ))}; case 1: - return new float[]{Math.min(0.99F, Math.max(0, aX)), Math.min(0.99F, Math.max(0, aZ))}; + return new float[] {Math.min(0.99F, Math.max(0, aX)), Math.min(0.99F, Math.max(0, aZ))}; case 2: - return new float[]{Math.min(0.99F, Math.max(0, 1 - aX)), Math.min(0.99F, Math.max(0, 1 - aY))}; + return new float[] {Math.min(0.99F, Math.max(0, 1 - aX)), Math.min(0.99F, Math.max(0, 1 - aY))}; case 3: - return new float[]{Math.min(0.99F, Math.max(0, aX)), Math.min(0.99F, Math.max(0, 1 - aY))}; + return new float[] {Math.min(0.99F, Math.max(0, aX)), Math.min(0.99F, Math.max(0, 1 - aY))}; case 4: - return new float[]{Math.min(0.99F, Math.max(0, aZ)), Math.min(0.99F, Math.max(0, 1 - aY))}; + return new float[] {Math.min(0.99F, Math.max(0, aZ)), Math.min(0.99F, Math.max(0, 1 - aY))}; case 5: - return new float[]{Math.min(0.99F, Math.max(0, 1 - aZ)), Math.min(0.99F, Math.max(0, 1 - aY))}; + return new float[] {Math.min(0.99F, Math.max(0, 1 - aZ)), Math.min(0.99F, Math.max(0, 1 - aY))}; default: - return new float[]{0.5F, 0.5F}; + return new float[] {0.5F, 0.5F}; } } @@ -2554,15 +3547,15 @@ public class GT_Utility { return -1; } - private static DecimalFormat getDecimalFormat(){ + private static DecimalFormat getDecimalFormat() { return decimalFormatters.computeIfAbsent(Locale.getDefault(Locale.Category.FORMAT), locale -> { - DecimalFormat numberFormat =new DecimalFormat();//uses the necessary locale inside anyway + DecimalFormat numberFormat = new DecimalFormat(); // uses the necessary locale inside anyway numberFormat.setGroupingUsed(true); numberFormat.setMaximumFractionDigits(2); numberFormat.setRoundingMode(RoundingMode.HALF_UP); DecimalFormatSymbols decimalFormatSymbols = numberFormat.getDecimalFormatSymbols(); - decimalFormatSymbols.setGroupingSeparator(',');// Use sensible separator for best clarity. - numberFormat.setDecimalFormatSymbols(decimalFormatSymbols); + decimalFormatSymbols.setGroupingSeparator(','); // Use sensible separator for best clarity. + numberFormat.setDecimalFormatSymbols(decimalFormatSymbols); return numberFormat; }); } @@ -2584,48 +3577,44 @@ public class GT_Utility { */ public static boolean consumeItems(EntityPlayer player, ItemStack stack, Item item, int count) { if (stack != null && stack.getItem() == item && stack.stackSize >= count) { - if ((!player.capabilities.isCreativeMode) && (stack.stackSize != 111)) - stack.stackSize -= count; + if ((!player.capabilities.isCreativeMode) && (stack.stackSize != 111)) stack.stackSize -= count; return true; } return false; - } + } /* * Check if stack has enough items of given gregtech material (will be oredicted) * and subtract from stack, if there's no creative or 111 stack. */ - public static boolean consumeItems(EntityPlayer player, ItemStack stack, gregtech.api.enums.Materials mat, int count) { + public static boolean consumeItems( + EntityPlayer player, ItemStack stack, gregtech.api.enums.Materials mat, int count) { if (stack != null - && GT_OreDictUnificator.getItemData(stack).mMaterial.mMaterial == mat - && stack.stackSize >= count) { - if ((!player.capabilities.isCreativeMode) && (stack.stackSize != 111)) - stack.stackSize -= count; + && GT_OreDictUnificator.getItemData(stack).mMaterial.mMaterial == mat + && stack.stackSize >= count) { + if ((!player.capabilities.isCreativeMode) && (stack.stackSize != 111)) stack.stackSize -= count; return true; - } + } return false; } - public static ArrayList<String> sortByValueToList( Map<String, Integer> map ) { - List<Map.Entry<String, Integer>> list = - new LinkedList<>(map.entrySet()); + public static ArrayList<String> sortByValueToList(Map<String, Integer> map) { + List<Map.Entry<String, Integer>> list = new LinkedList<>(map.entrySet()); list.sort((o1, o2) -> o2.getValue() - o1.getValue()); ArrayList<String> result = new ArrayList<>(); - for (Map.Entry<String, Integer> e : list) - result.add(e.getKey()); + for (Map.Entry<String, Integer> e : list) result.add(e.getKey()); return result; } public static String joinListToString(List<String> list) { StringBuilder result = new StringBuilder(32); - for (String s : list) - result.append(result.length()==0?s:'|'+s); + for (String s : list) result.append(result.length() == 0 ? s : '|' + s); return result.toString(); } - public static ItemStack getIntegratedCircuit(int config){ - return ItemList.Circuit_Integrated.getWithDamage(0, config); + public static ItemStack getIntegratedCircuit(int config) { + return ItemList.Circuit_Integrated.getWithDamage(0, config); } public static float getBlockHardnessAt(World aWorld, int aX, int aY, int aZ) { @@ -2634,7 +3623,9 @@ public class GT_Utility { public static FakePlayer getFakePlayer(IGregTechTileEntity aBaseMetaTileEntity) { if (aBaseMetaTileEntity.getWorld() instanceof WorldServer) { - return FakePlayerFactory.get((WorldServer) aBaseMetaTileEntity.getWorld(), new GameProfile(aBaseMetaTileEntity.getOwnerUuid(), aBaseMetaTileEntity.getOwnerName())); + return FakePlayerFactory.get( + (WorldServer) aBaseMetaTileEntity.getWorld(), + new GameProfile(aBaseMetaTileEntity.getOwnerUuid(), aBaseMetaTileEntity.getOwnerName())); } return null; } @@ -2642,7 +3633,8 @@ public class GT_Utility { public static boolean eraseBlockByFakePlayer(FakePlayer aPlayer, int aX, int aY, int aZ, boolean isSimulate) { if (aPlayer == null) return false; World aWorld = aPlayer.worldObj; - BlockEvent.BreakEvent event = new BlockEvent.BreakEvent(aX, aY, aZ, aWorld, aWorld.getBlock(aX, aY, aZ), aWorld.getBlockMetadata(aX, aY, aZ), aPlayer); + BlockEvent.BreakEvent event = new BlockEvent.BreakEvent( + aX, aY, aZ, aWorld, aWorld.getBlock(aX, aY, aZ), aWorld.getBlockMetadata(aX, aY, aZ), aPlayer); MinecraftForge.EVENT_BUS.post(event); if (!event.isCanceled()) { if (!isSimulate) return aWorld.setBlockToAir(aX, aY, aZ); @@ -2651,10 +3643,12 @@ public class GT_Utility { return false; } - public static boolean setBlockByFakePlayer(FakePlayer aPlayer, int aX, int aY, int aZ, Block aBlock, int aMeta, boolean isSimulate) { + public static boolean setBlockByFakePlayer( + FakePlayer aPlayer, int aX, int aY, int aZ, Block aBlock, int aMeta, boolean isSimulate) { if (aPlayer == null) return false; World aWorld = aPlayer.worldObj; - BlockEvent.PlaceEvent event = ForgeEventFactory.onPlayerBlockPlace(aPlayer, new BlockSnapshot(aWorld, aX, aY, aZ, aBlock, aMeta), ForgeDirection.UNKNOWN); + BlockEvent.PlaceEvent event = ForgeEventFactory.onPlayerBlockPlace( + aPlayer, new BlockSnapshot(aWorld, aX, aY, aZ, aBlock, aMeta), ForgeDirection.UNKNOWN); if (!event.isCanceled()) { if (!isSimulate) return aWorld.setBlock(aX, aY, aZ, aBlock, aMeta, 3); return true; @@ -2662,18 +3656,16 @@ public class GT_Utility { return false; } - public static int findMatchingStackInList(List<ItemStack> aStacks, ItemStack aStack) { - if (isStackInvalid(aStack)) - return -1; + public static int findMatchingStackInList(List<ItemStack> aStacks, ItemStack aStack) { + if (isStackInvalid(aStack)) return -1; for (int i = 0, aStacksSize = aStacks.size(); i < aStacksSize; i++) { ItemStack tStack = aStacks.get(i); - if (areStacksEqual(aStack, tStack)) - return i; + if (areStacksEqual(aStack, tStack)) return i; } return -1; } - public static class ItemNBT { + public static class ItemNBT { public static void setNBT(ItemStack aStack, NBTTagCompound aNBT) { if (aNBT == null) { aStack.setTagCompound(null); @@ -2682,7 +3674,10 @@ public class GT_Utility { ArrayList<String> tTagsToRemove = new ArrayList<>(); for (Object tKey : aNBT.func_150296_c()) { NBTBase tValue = aNBT.getTag((String) tKey); - if (tValue == null || (tValue instanceof NBTPrimitive && ((NBTPrimitive) tValue).func_150291_c() == 0) || (tValue instanceof NBTTagString && isStringInvalid(((NBTTagString) tValue).func_150285_a_()))) + if (tValue == null + || (tValue instanceof NBTPrimitive && ((NBTPrimitive) tValue).func_150291_c() == 0) + || (tValue instanceof NBTTagString + && isStringInvalid(((NBTTagString) tValue).func_150285_a_()))) tTagsToRemove.add((String) tKey); } for (Object tKey : tTagsToRemove) aNBT.removeTag((String) tKey); @@ -2750,11 +3745,15 @@ public class GT_Utility { return tNBT.getString("author"); } - public static void setProspectionData(ItemStack aStack, int aX, int aY, int aZ, int aDim, FluidStack aFluid, String... aOres) { + public static void setProspectionData( + ItemStack aStack, int aX, int aY, int aZ, int aDim, FluidStack aFluid, 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(","); } @@ -2765,7 +3764,10 @@ public class GT_Utility { public static void setAdvancedProspectionData( byte aTier, ItemStack aStack, - int aX, short aY, int aZ, int aDim, + int aX, + short aY, + int aZ, + int aDim, ArrayList<String> aOils, ArrayList<String> aOres, int aRadius) { @@ -2784,38 +3786,40 @@ public class GT_Utility { // oils ArrayList<String> tOilsTransformed = new ArrayList<>(aOils.size()); for (String aStr : aOils) { - String[] aStats = aStr.split(","); - tOilsTransformed.add(aStats[0] + ": " + aStats[1] + "L " + aStats[2]); + String[] aStats = aStr.split(","); + tOilsTransformed.add(aStats[0] + ": " + aStats[1] + "L " + aStats[2]); } tNBT.setString("prospection_oils", joinListToString(tOilsTransformed)); - String tOilsPosStr = "X: " + Math.floorDiv(aX, 16*8)*16*8 + " Z: " + Math.floorDiv(aZ, 16*8)*16*8 + "\n"; - int xOff = aX - Math.floorDiv(aX, 16*8)*16*8; - xOff = xOff/16; + String tOilsPosStr = + "X: " + Math.floorDiv(aX, 16 * 8) * 16 * 8 + " Z: " + Math.floorDiv(aZ, 16 * 8) * 16 * 8 + "\n"; + int xOff = aX - Math.floorDiv(aX, 16 * 8) * 16 * 8; + xOff = xOff / 16; int xOffRemain = 7 - xOff; - int zOff = aZ - Math.floorDiv(aZ, 16*8)*16*8; - zOff = zOff/16; + int zOff = aZ - Math.floorDiv(aZ, 16 * 8) * 16 * 8; + zOff = zOff / 16; int zOffRemain = 7 - zOff; - for( ; zOff > 0; zOff-- ) { + for (; zOff > 0; zOff--) { tOilsPosStr = tOilsPosStr.concat("--------\n"); } - for( ; xOff > 0; xOff-- ) { + for (; xOff > 0; xOff--) { tOilsPosStr = tOilsPosStr.concat("-"); } tOilsPosStr = tOilsPosStr.concat("P"); - for( ; xOffRemain > 0; xOffRemain-- ) { + for (; xOffRemain > 0; xOffRemain--) { tOilsPosStr = tOilsPosStr.concat("-"); } tOilsPosStr = tOilsPosStr.concat("\n"); - for( ; zOffRemain > 0; zOffRemain-- ) { + for (; zOffRemain > 0; zOffRemain--) { tOilsPosStr = tOilsPosStr.concat("--------\n"); } - tOilsPosStr = tOilsPosStr.concat( " X: " + (Math.floorDiv(aX, 16*8) + 1)*16*8 + " Z: " + (Math.floorDiv(aZ, 16*8) + 1)*16*8 ); // +1 oilfied to find bottomright of [5] + tOilsPosStr = tOilsPosStr.concat(" X: " + (Math.floorDiv(aX, 16 * 8) + 1) * 16 * 8 + " Z: " + + (Math.floorDiv(aZ, 16 * 8) + 1) * 16 * 8); // +1 oilfied to find bottomright of [5] tNBT.setString("prospection_oils_pos", tOilsPosStr); @@ -2832,13 +3836,18 @@ public class GT_Utility { String tData = tNBT.getString("prospection"); String[] tDataArray = tData.split(","); if (tDataArray.length > 6) { - tNBT.setString("author", " Dim: " + tDataArray[3] + "X: " + tDataArray[0] + " Y: " + tDataArray[1] + " Z: " + tDataArray[2]); + tNBT.setString( + "author", + " Dim: " + tDataArray[3] + "X: " + tDataArray[0] + " Y: " + tDataArray[1] + " Z: " + + tDataArray[2]); NBTTagList tNBTList = new NBTTagList(); StringBuilder tOres = new StringBuilder(" Prospected Ores: "); for (int i = 6; tDataArray.length > i; i++) { tOres.append(tDataArray[i]).append(" "); } - tNBTList.appendTag(new NBTTagString("Tier " + tTier + " Prospecting Data From: X" + tDataArray[0] + " Z:" + tDataArray[2] + " Dim:" + tDataArray[3] + " Produces " + tDataArray[4] + "L " + tDataArray[5] + " " + tOres)); + tNBTList.appendTag(new NBTTagString("Tier " + tTier + " Prospecting Data From: X" + tDataArray[0] + + " Z:" + tDataArray[2] + " Dim:" + tDataArray[3] + " Produces " + tDataArray[4] + "L " + + tDataArray[5] + " " + tOres)); tNBT.setTag("pages", tNBTList); } } else { // advanced prospection data @@ -2855,19 +3864,16 @@ public class GT_Utility { NBTTagList tNBTList = new NBTTagList(); String tPageText = "Prospector report\n" - + tPos + "\n\n" - + "Oils: " + (tOils != null ? tOils.length : 0) + "\n\n" - + "Ores within " + tRadius + " blocks\n\n" - + "Location is center of orevein\n\n" - + "Check NEI to confirm orevein type"; + + tPos + "\n\n" + + "Oils: " + (tOils != null ? tOils.length : 0) + "\n\n" + + "Ores within " + tRadius + " blocks\n\n" + + "Location is center of orevein\n\n" + + "Check NEI to confirm orevein type"; tNBTList.appendTag(new NBTTagString(tPageText)); - if (tOres != null) - fillBookWithList(tNBTList, "Ores Found %s\n\n", "\n", 7, tOres); - + if (tOres != null) fillBookWithList(tNBTList, "Ores Found %s\n\n", "\n", 7, tOres); - if (tOils != null) - fillBookWithList(tNBTList, "Oils%s\n\n", "\n", 9, tOils); + if (tOils != null) fillBookWithList(tNBTList, "Oils%s\n\n", "\n", 9, tOils); tPageText = "Oil notes\n\n" + "Prospects from NW to SE 576 chunks" @@ -2879,26 +3885,27 @@ public class GT_Utility { + "[5] - Prospector in this 8x8 area"; tNBTList.appendTag(new NBTTagString(tPageText)); - tPageText = "Corners of [5] are \n" + - tOilsPosStr + "\n" + - "P - Prospector in 8x8 field"; + tPageText = "Corners of [5] are \n" + tOilsPosStr + "\n" + "P - Prospector in 8x8 field"; tNBTList.appendTag(new NBTTagString(tPageText)); - tNBT.setString("author", tPos.replace("\n"," ")); + tNBT.setString("author", tPos.replace("\n", " ")); tNBT.setTag("pages", tNBTList); } setNBT(aStack, tNBT); } - public static void fillBookWithList(NBTTagList aBook, String aPageHeader, String aListDelimiter, int aItemsPerPage, String[] list) { + public static void fillBookWithList( + NBTTagList aBook, String aPageHeader, String aListDelimiter, int aItemsPerPage, String[] list) { String aPageFormatter = " %d/%d"; int tTotalPages = list.length / aItemsPerPage + (list.length % aItemsPerPage > 0 ? 1 : 0); int tPage = 0; StringBuilder tPageText; 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]); + for (int i = tPage * aItemsPerPage; i < (tPage + 1) * aItemsPerPage && i < list.length; i += 1) + tPageText + .append((tPageText.length() == 0) ? "" : aListDelimiter) + .append(list[i]); if (tPageText.length() > 0) { String tPageCounter = tTotalPages > 1 ? String.format(aPageFormatter, tPage + 1, tTotalPages) : ""; @@ -2955,7 +3962,9 @@ public class GT_Utility { if (Enchantment.enchantmentsList[short1] != null) aBullshitModifier.calculateModifier(Enchantment.enchantmentsList[short1], short2); } - } catch (Throwable e) {/**/} + } catch (Throwable e) { + /**/ + } } } } @@ -2991,8 +4000,7 @@ public class GT_Utility { public EntityLivingBase mPlayer; public Entity mEntity; - BullshitIteratorA() { - } + BullshitIteratorA() {} @Override public void calculateModifier(Enchantment aEnchantment, int aLevel) { @@ -3004,8 +4012,7 @@ public class GT_Utility { public EntityLivingBase mPlayer; public Entity mEntity; - BullshitIteratorB() { - } + BullshitIteratorB() {} @Override public void calculateModifier(Enchantment aEnchantment, int aLevel) { @@ -3014,27 +4021,31 @@ public class GT_Utility { } } - public static String toSubscript(long no){ - char[] chars=Long.toString(no).toCharArray(); - for(int i=0;i<chars.length;i++){ - chars[i]+=8272; + public static String toSubscript(long no) { + char[] chars = Long.toString(no).toCharArray(); + for (int i = 0; i < chars.length; i++) { + chars[i] += 8272; } return new String(chars); } - public static boolean isPartOfMaterials(ItemStack aStack, Materials aMaterials){ - return GT_OreDictUnificator.getAssociation(aStack) != null && GT_OreDictUnificator.getAssociation(aStack).mMaterial.mMaterial.equals(aMaterials); + public static boolean isPartOfMaterials(ItemStack aStack, Materials aMaterials) { + return GT_OreDictUnificator.getAssociation(aStack) != null + && GT_OreDictUnificator.getAssociation(aStack) + .mMaterial + .mMaterial + .equals(aMaterials); } - public static boolean isPartOfOrePrefix(ItemStack aStack, OrePrefixes aPrefix){ - return GT_OreDictUnificator.getAssociation(aStack) != null && GT_OreDictUnificator.getAssociation(aStack).mPrefix.equals(aPrefix); + public static boolean isPartOfOrePrefix(ItemStack aStack, OrePrefixes aPrefix) { + return GT_OreDictUnificator.getAssociation(aStack) != null + && GT_OreDictUnificator.getAssociation(aStack).mPrefix.equals(aPrefix); } public static final ImmutableSet<String> ORE_BLOCK_CLASSES = ImmutableSet.of( "com.github.bartimaeusnek.bartworks.system.material.BW_MetaGenerated_Ores", "com.github.bartimaeusnek.bartworks.system.material.BW_MetaGenerated_SmallOres", - "gtPlusPlus.core.block.base.BlockBaseOre" - ); + "gtPlusPlus.core.block.base.BlockBaseOre"); public static boolean isOre(Block aBlock, int aMeta) { return (aBlock instanceof GT_Block_Ores_Abstract) @@ -3047,7 +4058,7 @@ public class GT_Utility { if (sOreTable.containsKey(tItem)) { return sOreTable.get(tItem); } - for (int id: OreDictionary.getOreIDs(aStack)) { + for (int id : OreDictionary.getOreIDs(aStack)) { if (OreDictionary.getOreName(id).startsWith("ore")) { sOreTable.put(tItem, true); return true; @@ -3063,9 +4074,11 @@ public class GT_Utility { */ public static ItemStack getCobbleForOre(Block ore, short metaData) { // We need to convert small ores to regular ores because small ores don't have associated ItemData. - // We take the modulus of the metadata by 16000 because that is the magic number to convert small ores to regular ores. + // 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) { @@ -3089,9 +4102,8 @@ 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(); inputs.add(copy); @@ -3100,29 +4112,17 @@ public class GT_Utility { ItemStack copy = stack.copy(); inputs.add(copy); } - } else if (o instanceof Item) - inputs.add(new ItemStack((Item) o)); - else if (o instanceof Block) - inputs.add(new ItemStack((Block) o)); - else - throw new IllegalStateException("A Recipe contains an invalid input! Output: " + output); + } else if (o instanceof Item) inputs.add(new ItemStack((Item) o)); + else if (o instanceof Block) inputs.add(new ItemStack((Block) o)); + else throw new IllegalStateException("A Recipe contains an invalid input! Output: " + output); } inputs.removeIf(x -> x.getItem() instanceof GT_MetaGenerated_Tool); - return Optional.of( - new GT_Recipe( - false, - new ItemStack[]{output}, - inputs.toArray(new ItemStack[0]), - null, null, - null, null, - 300, 30, 0 - ) - ); + return Optional.of(new GT_Recipe( + false, new ItemStack[] {output}, inputs.toArray(new ItemStack[0]), null, null, null, null, 300, 30, 0)); } - public static Optional<GT_Recipe> reverseShapedRecipe(ItemStack output, Object... aRecipe) { if (output == null) { return Optional.empty(); @@ -3136,17 +4136,13 @@ public class GT_Utility { Object o = aRecipe[i]; if (!startFound) { if (o instanceof String) { - for (Character c : ((String) o).toCharArray()) - amounts.merge(c, 1, (a, b) -> ++a); - } else if (o instanceof Character) - startFound = true; - } else if (!(o instanceof Character)) - ingridients.put((Character) aRecipe[i - 1], o); + for (Character c : ((String) o).toCharArray()) amounts.merge(c, 1, (a, b) -> ++a); + } else if (o instanceof Character) startFound = true; + } else if (!(o instanceof Character)) ingridients.put((Character) aRecipe[i - 1], o); } for (Map.Entry<Character, Object> characterObjectEntry : ingridients.entrySet()) { for (Map.Entry<Character, Integer> characterIntegerEntry : amounts.entrySet()) { - if (characterObjectEntry.getKey() != characterIntegerEntry.getKey()) - continue; + if (characterObjectEntry.getKey() != characterIntegerEntry.getKey()) continue; recipeAsMap.put(characterObjectEntry.getValue(), characterIntegerEntry.getValue()); } } @@ -3164,9 +4160,8 @@ 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(); copy.stackSize = amount; @@ -3177,27 +4172,16 @@ public class GT_Utility { copy.stackSize = amount; inputs.add(copy); } - } else if (o.getKey() instanceof Item) - inputs.add(new ItemStack((Item) o.getKey(), amount)); - else if (o.getKey() instanceof Block) - inputs.add(new ItemStack((Block) o.getKey(), amount)); - else - throw new IllegalStateException("A Recipe contains an invalid input! Output: " + output); + } else if (o.getKey() instanceof Item) inputs.add(new ItemStack((Item) o.getKey(), amount)); + else if (o.getKey() instanceof Block) inputs.add(new ItemStack((Block) o.getKey(), amount)); + else throw new IllegalStateException("A Recipe contains an invalid input! Output: " + output); } // Remove tools from inputs in case a recipe has one as a direct Item or ItemStack reference inputs.removeIf(x -> x.getItem() instanceof GT_MetaGenerated_Tool); - return Optional.of( - new GT_Recipe( - false, - new ItemStack[]{output}, - inputs.toArray(new ItemStack[0]), - null, null, - null, null, - 300, 30, 0 - ) - ); + return Optional.of(new GT_Recipe( + false, new ItemStack[] {output}, inputs.toArray(new ItemStack[0]), null, null, null, null, 300, 30, 0)); } /** @@ -3224,8 +4208,7 @@ public class GT_Utility { * Hash an item stack for the purpose of storing hash across launches */ public static int persistentHash(ItemStack aStack, boolean aUseStackSize, boolean aUseNBT) { - if (aStack == null) - return 0; + if (aStack == null) return 0; int result = Objects.hashCode(GameRegistry.findUniqueIdentifierFor(aStack.getItem())); result = result * 31 + Items.feather.getDamage(aStack); @@ -3238,8 +4221,7 @@ public class GT_Utility { * Hash an item stack for the purpose of storing hash across launches */ public static int persistentHash(FluidStack aStack, boolean aUseStackSize, boolean aUseNBT) { - if (aStack == null) - return 0; + if (aStack == null) return 0; int base = Objects.hashCode(aStack.getFluid().getName()); if (aUseStackSize) base = base * 31 + aStack.amount; @@ -3248,8 +4230,7 @@ public class GT_Utility { } public static int getCasingTextureIndex(Block block, int meta) { - if (block instanceof IHasIndexedTexture) - return ((IHasIndexedTexture) block).getTextureIndex(meta); + if (block instanceof IHasIndexedTexture) return ((IHasIndexedTexture) block).getTextureIndex(meta); return Textures.BlockIcons.ERROR_TEXTURE_INDEX; } @@ -3262,17 +4243,17 @@ public class GT_Utility { nbt = (NBTTagCompound) nbt.copy(); } - return new AutoValue_GT_Utility_ItemId( - itemStack.getItem(), itemStack.getItemDamage(), nbt); + return new AutoValue_GT_Utility_ItemId(itemStack.getItem(), itemStack.getItemDamage(), nbt); } /** This method does not copy NBT in order to save time. Make sure not to mutate it! */ public static ItemId createNoCopy(ItemStack itemStack) { return new AutoValue_GT_Utility_ItemId( - itemStack.getItem(), itemStack.getItemDamage(), itemStack.getTagCompound()); + itemStack.getItem(), itemStack.getItemDamage(), itemStack.getTagCompound()); } protected abstract Item item(); + protected abstract int metaData(); @Nullable diff --git a/src/main/java/gregtech/api/util/GT_UtilityClient.java b/src/main/java/gregtech/api/util/GT_UtilityClient.java index bb161802ed..8cbf6bf4ad 100644 --- a/src/main/java/gregtech/api/util/GT_UtilityClient.java +++ b/src/main/java/gregtech/api/util/GT_UtilityClient.java @@ -2,45 +2,49 @@ package gregtech.api.util; import com.google.common.collect.Lists; import cpw.mods.fml.relauncher.ReflectionHelper; +import java.lang.reflect.Field; +import java.util.List; import net.minecraft.client.Minecraft; import net.minecraft.client.renderer.Tessellator; import net.minecraft.item.EnumRarity; import net.minecraft.item.ItemStack; import net.minecraft.util.EnumChatFormatting; -import java.lang.reflect.Field; -import java.util.List; - public class GT_UtilityClient { - private static final Field isDrawingField = ReflectionHelper.findField(Tessellator.class, "isDrawing", "field_78415_z"); - - public static boolean isDrawing(Tessellator tess) { - try { - return isDrawingField.getBoolean(tess); - } catch (IllegalAccessException e) { - e.printStackTrace(); - return false; - } - } - + private static final Field isDrawingField = + ReflectionHelper.findField(Tessellator.class, "isDrawing", "field_78415_z"); - @SuppressWarnings("unchecked") - public static List<String> getTooltip(ItemStack aStack, boolean aGuiStyle) { - try { - List<String> tooltip = aStack.getTooltip(Minecraft.getMinecraft().thePlayer, Minecraft.getMinecraft().gameSettings.advancedItemTooltips); - if (aGuiStyle) { - tooltip.set(0, (aStack.getRarity() == null ? EnumRarity.common : aStack.getRarity()).rarityColor +tooltip.get(0)); - for (int i = 1; i < tooltip.size(); i++) { - tooltip.set(i, EnumChatFormatting.GRAY + tooltip.get(i)); - } - } - return tooltip; - } catch (RuntimeException e) { - // Collections.singletonList() can not be added to. we don't want that - if (aGuiStyle) - return Lists.newArrayList((aStack.getRarity() == null ? EnumRarity.common : aStack.getRarity()).rarityColor + aStack.getDisplayName()); - return Lists.newArrayList(aStack.getDisplayName()); - } - } + public static boolean isDrawing(Tessellator tess) { + try { + return isDrawingField.getBoolean(tess); + } catch (IllegalAccessException e) { + e.printStackTrace(); + return false; + } + } + @SuppressWarnings("unchecked") + public static List<String> getTooltip(ItemStack aStack, boolean aGuiStyle) { + try { + List<String> tooltip = aStack.getTooltip( + Minecraft.getMinecraft().thePlayer, Minecraft.getMinecraft().gameSettings.advancedItemTooltips); + if (aGuiStyle) { + tooltip.set( + 0, + (aStack.getRarity() == null ? EnumRarity.common : aStack.getRarity()).rarityColor + + tooltip.get(0)); + for (int i = 1; i < tooltip.size(); i++) { + tooltip.set(i, EnumChatFormatting.GRAY + tooltip.get(i)); + } + } + return tooltip; + } catch (RuntimeException e) { + // Collections.singletonList() can not be added to. we don't want that + if (aGuiStyle) + return Lists.newArrayList( + (aStack.getRarity() == null ? EnumRarity.common : aStack.getRarity()).rarityColor + + aStack.getDisplayName()); + return Lists.newArrayList(aStack.getDisplayName()); + } + } } diff --git a/src/main/java/gregtech/api/util/IGT_HatchAdder.java b/src/main/java/gregtech/api/util/IGT_HatchAdder.java index 16fdd90e62..ecf2921d36 100644 --- a/src/main/java/gregtech/api/util/IGT_HatchAdder.java +++ b/src/main/java/gregtech/api/util/IGT_HatchAdder.java @@ -1,6 +1,5 @@ package gregtech.api.util; - import gregtech.api.interfaces.tileentity.IGregTechTileEntity; public interface IGT_HatchAdder<T> { @@ -22,6 +21,7 @@ public interface IGT_HatchAdder<T> { } default IGT_HatchAdder<T> orElse(IGT_HatchAdder<? super T> fallback) { - return (t, iGregTechTileEntity, aShort) -> IGT_HatchAdder.this.apply(t, iGregTechTileEntity, aShort) || fallback.apply(t, iGregTechTileEntity, aShort); + return (t, iGregTechTileEntity, aShort) -> IGT_HatchAdder.this.apply(t, iGregTechTileEntity, aShort) + || fallback.apply(t, iGregTechTileEntity, aShort); } } diff --git a/src/main/java/gregtech/api/util/ISerializableObject.java b/src/main/java/gregtech/api/util/ISerializableObject.java index 536aea7545..b8014860f8 100644 --- a/src/main/java/gregtech/api/util/ISerializableObject.java +++ b/src/main/java/gregtech/api/util/ISerializableObject.java @@ -2,6 +2,9 @@ package gregtech.api.util; import com.google.common.io.ByteArrayDataInput; import io.netty.buffer.ByteBuf; +import java.io.IOException; +import javax.annotation.Nonnull; +import javax.annotation.Nullable; import net.minecraft.entity.player.EntityPlayerMP; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; @@ -11,10 +14,6 @@ import net.minecraft.nbt.NBTSizeTracker; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.nbt.NBTTagInt; -import javax.annotation.Nonnull; -import javax.annotation.Nullable; -import java.io.IOException; - /** * We could well have used {@link java.io.Serializable}, but that's too slow and should generally be avoided * @@ -58,9 +57,8 @@ public interface ISerializableObject { */ static NBTTagCompound readCompoundTagFromGreggyByteBuf(ByteArrayDataInput aBuf) { short size = aBuf.readShort(); - if (size < 0) - return null; - else { + if (size < 0) return null; + else { byte[] buf = new byte[size]; // this is shit, how many copies have we been doing? aBuf.readFully(buf); try { @@ -90,8 +88,7 @@ public interface ISerializableObject { final class LegacyCoverData implements ISerializableObject { private int mData; - public LegacyCoverData() { - } + public LegacyCoverData() {} public LegacyCoverData(int mData) { this.mData = mData; diff --git a/src/main/java/gregtech/api/util/LightingHelper.java b/src/main/java/gregtech/api/util/LightingHelper.java index f131ef74a0..7bffbfd00d 100644 --- a/src/main/java/gregtech/api/util/LightingHelper.java +++ b/src/main/java/gregtech/api/util/LightingHelper.java @@ -42,6 +42,7 @@ public class LightingHelper { * Ambient occlusion values for all four corners of side. */ private float aoTopLeft, aoBottomLeft, aoBottomRight, aoTopRight; + private boolean hasLightnessOverride; private float lightnessOverride; private boolean hasBrightnessOverride; @@ -93,7 +94,7 @@ public class LightingHelper { float green = color[1] / 255.0F; float blue = color[2] / 255.0F; - return new float[]{red, green, blue}; + return new float[] {red, green, blue}; } /** @@ -229,15 +230,21 @@ public class LightingHelper { if (renderBlocks.hasOverrideBlockTexture()) { - renderBlocks.colorRedTopLeft = renderBlocks.colorRedBottomLeft = renderBlocks.colorRedBottomRight = renderBlocks.colorRedTopRight = rgb[0]; - renderBlocks.colorGreenTopLeft = renderBlocks.colorGreenBottomLeft = renderBlocks.colorGreenBottomRight = renderBlocks.colorGreenTopRight = rgb[1]; - renderBlocks.colorBlueTopLeft = renderBlocks.colorBlueBottomLeft = renderBlocks.colorBlueBottomRight = renderBlocks.colorBlueTopRight = rgb[2]; + renderBlocks.colorRedTopLeft = renderBlocks.colorRedBottomLeft = + renderBlocks.colorRedBottomRight = renderBlocks.colorRedTopRight = rgb[0]; + renderBlocks.colorGreenTopLeft = renderBlocks.colorGreenBottomLeft = + renderBlocks.colorGreenBottomRight = renderBlocks.colorGreenTopRight = rgb[1]; + renderBlocks.colorBlueTopLeft = renderBlocks.colorBlueBottomLeft = + renderBlocks.colorBlueBottomRight = renderBlocks.colorBlueTopRight = rgb[2]; } else { - renderBlocks.colorRedTopLeft = renderBlocks.colorRedBottomLeft = renderBlocks.colorRedBottomRight = renderBlocks.colorRedTopRight = rgb[0] * lightness; - renderBlocks.colorGreenTopLeft = renderBlocks.colorGreenBottomLeft = renderBlocks.colorGreenBottomRight = renderBlocks.colorGreenTopRight = rgb[1] * lightness; - renderBlocks.colorBlueTopLeft = renderBlocks.colorBlueBottomLeft = renderBlocks.colorBlueBottomRight = renderBlocks.colorBlueTopRight = rgb[2] * lightness; + renderBlocks.colorRedTopLeft = renderBlocks.colorRedBottomLeft = + renderBlocks.colorRedBottomRight = renderBlocks.colorRedTopRight = rgb[0] * lightness; + renderBlocks.colorGreenTopLeft = renderBlocks.colorGreenBottomLeft = + renderBlocks.colorGreenBottomRight = renderBlocks.colorGreenTopRight = rgb[1] * lightness; + renderBlocks.colorBlueTopLeft = renderBlocks.colorBlueBottomLeft = + renderBlocks.colorBlueBottomRight = renderBlocks.colorBlueTopRight = rgb[2] * lightness; renderBlocks.colorRedTopLeft *= aoTopLeft; renderBlocks.colorGreenTopLeft *= aoTopLeft; @@ -257,7 +264,6 @@ public class LightingHelper { if (hasBrightnessOverride) tessellator.setBrightness(brightnessOverride); tessellator.setColorOpaque_F(rgb[0] * lightness, rgb[1] * lightness, rgb[2] * lightness); - } } @@ -272,7 +278,7 @@ public class LightingHelper { float green = (color >> 8 & 0xff) / 255.0F; float blue = (color & 0xff) / 255.0F; - return new float[]{red, green, blue}; + return new float[] {red, green, blue}; } /** @@ -335,43 +341,150 @@ public class LightingHelper { 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); - renderBlocks.aoLightValueScratchXYNN = getMixedAo(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(), ratio); - renderBlocks.aoLightValueScratchXZNP = getMixedAo(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(), ratio); - renderBlocks.aoLightValueScratchXYZNNN = getMixedAo(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(), ratio); - renderBlocks.aoLightValueScratchXYZNPN = getMixedAo(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(), ratio); - - int brightnessMixedXYZNPN = renderBlocks.getAoBrightness(renderBlocks.aoBrightnessXZNN, renderBlocks.aoBrightnessXYZNPN, renderBlocks.aoBrightnessXYNP, mixedBrightness); - int brightnessMixedXYZNNN = renderBlocks.getAoBrightness(renderBlocks.aoBrightnessXYZNNN, renderBlocks.aoBrightnessXYNN, renderBlocks.aoBrightnessXZNN, mixedBrightness); - int brightnessMixedXYZNNP = renderBlocks.getAoBrightness(renderBlocks.aoBrightnessXYNN, renderBlocks.aoBrightnessXYZNNP, renderBlocks.aoBrightnessXZNP, mixedBrightness); - int brightnessMixedXYZNPP = renderBlocks.getAoBrightness(renderBlocks.aoBrightnessXZNP, renderBlocks.aoBrightnessXYNP, renderBlocks.aoBrightnessXYZNPP, mixedBrightness); - - float aoMixedXYZNPN = (renderBlocks.aoLightValueScratchXZNN + aoLightValue + renderBlocks.aoLightValueScratchXYZNPN + renderBlocks.aoLightValueScratchXYNP) / 4.0F; - float aoMixedXYZNNN = (renderBlocks.aoLightValueScratchXYZNNN + renderBlocks.aoLightValueScratchXYNN + renderBlocks.aoLightValueScratchXZNN + aoLightValue) / 4.0F; - float aoMixedXYZNNP = (renderBlocks.aoLightValueScratchXYNN + renderBlocks.aoLightValueScratchXYZNNP + aoLightValue + renderBlocks.aoLightValueScratchXZNP) / 4.0F; - float aoMixedXYZNPP = (aoLightValue + renderBlocks.aoLightValueScratchXZNP + renderBlocks.aoLightValueScratchXYNP + renderBlocks.aoLightValueScratchXYZNPP) / 4.0F; - - aoTopLeft = (float) (aoMixedXYZNPP * renderBlocks.renderMaxY * renderBlocks.renderMaxZ + aoMixedXYZNPN * renderBlocks.renderMaxY * (1.0D - renderBlocks.renderMaxZ) + aoMixedXYZNNN * (1.0D - renderBlocks.renderMaxY) * (1.0D - renderBlocks.renderMaxZ) + aoMixedXYZNNP * (1.0D - renderBlocks.renderMaxY) * renderBlocks.renderMaxZ); - aoBottomLeft = (float) (aoMixedXYZNPP * renderBlocks.renderMaxY * renderBlocks.renderMinZ + aoMixedXYZNPN * renderBlocks.renderMaxY * (1.0D - renderBlocks.renderMinZ) + aoMixedXYZNNN * (1.0D - renderBlocks.renderMaxY) * (1.0D - renderBlocks.renderMinZ) + aoMixedXYZNNP * (1.0D - renderBlocks.renderMaxY) * renderBlocks.renderMinZ); - aoBottomRight = (float) (aoMixedXYZNPP * renderBlocks.renderMinY * renderBlocks.renderMinZ + aoMixedXYZNPN * renderBlocks.renderMinY * (1.0D - renderBlocks.renderMinZ) + aoMixedXYZNNN * (1.0D - renderBlocks.renderMinY) * (1.0D - renderBlocks.renderMinZ) + aoMixedXYZNNP * (1.0D - renderBlocks.renderMinY) * renderBlocks.renderMinZ); - aoTopRight = (float) (aoMixedXYZNPP * renderBlocks.renderMinY * renderBlocks.renderMaxZ + aoMixedXYZNPN * renderBlocks.renderMinY * (1.0D - renderBlocks.renderMaxZ) + aoMixedXYZNNN * (1.0D - renderBlocks.renderMinY) * (1.0D - renderBlocks.renderMaxZ) + aoMixedXYZNNP * (1.0D - renderBlocks.renderMinY) * renderBlocks.renderMaxZ); - - renderBlocks.brightnessTopLeft = renderBlocks.mixAoBrightness(brightnessMixedXYZNPP, brightnessMixedXYZNPN, brightnessMixedXYZNNN, brightnessMixedXYZNNP, renderBlocks.renderMaxY * renderBlocks.renderMaxZ, renderBlocks.renderMaxY * (1.0D - renderBlocks.renderMaxZ), (1.0D - renderBlocks.renderMaxY) * (1.0D - renderBlocks.renderMaxZ), (1.0D - renderBlocks.renderMaxY) * renderBlocks.renderMaxZ); - renderBlocks.brightnessBottomLeft = renderBlocks.mixAoBrightness(brightnessMixedXYZNPP, brightnessMixedXYZNPN, brightnessMixedXYZNNN, brightnessMixedXYZNNP, renderBlocks.renderMaxY * renderBlocks.renderMinZ, renderBlocks.renderMaxY * (1.0D - renderBlocks.renderMinZ), (1.0D - renderBlocks.renderMaxY) * (1.0D - renderBlocks.renderMinZ), (1.0D - renderBlocks.renderMaxY) * renderBlocks.renderMinZ); - renderBlocks.brightnessBottomRight = renderBlocks.mixAoBrightness(brightnessMixedXYZNPP, brightnessMixedXYZNPN, brightnessMixedXYZNNN, brightnessMixedXYZNNP, renderBlocks.renderMinY * renderBlocks.renderMinZ, renderBlocks.renderMinY * (1.0D - renderBlocks.renderMinZ), (1.0D - renderBlocks.renderMinY) * (1.0D - renderBlocks.renderMinZ), (1.0D - renderBlocks.renderMinY) * renderBlocks.renderMinZ); - renderBlocks.brightnessTopRight = renderBlocks.mixAoBrightness(brightnessMixedXYZNPP, brightnessMixedXYZNPN, brightnessMixedXYZNNN, brightnessMixedXYZNNP, renderBlocks.renderMinY * renderBlocks.renderMaxZ, renderBlocks.renderMinY * (1.0D - renderBlocks.renderMaxZ), (1.0D - renderBlocks.renderMinY) * (1.0D - renderBlocks.renderMaxZ), (1.0D - renderBlocks.renderMinY) * renderBlocks.renderMaxZ); - + 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(), + ratio); + renderBlocks.aoLightValueScratchXZNN = getMixedAo( + 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(), + ratio); + renderBlocks.aoLightValueScratchXYNP = getMixedAo( + 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(), + ratio); + renderBlocks.aoLightValueScratchXYZNNP = getMixedAo( + 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(), + ratio); + renderBlocks.aoLightValueScratchXYZNPP = getMixedAo( + renderBlocks.blockAccess.getBlock(x - 1, y + 1, z + 1).getAmbientOcclusionLightValue(), + renderBlocks.blockAccess.getBlock(x, y + 1, z + 1).getAmbientOcclusionLightValue(), + ratio); + + int brightnessMixedXYZNPN = renderBlocks.getAoBrightness( + renderBlocks.aoBrightnessXZNN, + renderBlocks.aoBrightnessXYZNPN, + renderBlocks.aoBrightnessXYNP, + mixedBrightness); + int brightnessMixedXYZNNN = renderBlocks.getAoBrightness( + renderBlocks.aoBrightnessXYZNNN, + renderBlocks.aoBrightnessXYNN, + renderBlocks.aoBrightnessXZNN, + mixedBrightness); + int brightnessMixedXYZNNP = renderBlocks.getAoBrightness( + renderBlocks.aoBrightnessXYNN, + renderBlocks.aoBrightnessXYZNNP, + renderBlocks.aoBrightnessXZNP, + mixedBrightness); + int brightnessMixedXYZNPP = renderBlocks.getAoBrightness( + renderBlocks.aoBrightnessXZNP, + renderBlocks.aoBrightnessXYNP, + renderBlocks.aoBrightnessXYZNPP, + mixedBrightness); + + float aoMixedXYZNPN = (renderBlocks.aoLightValueScratchXZNN + + aoLightValue + + renderBlocks.aoLightValueScratchXYZNPN + + renderBlocks.aoLightValueScratchXYNP) + / 4.0F; + float aoMixedXYZNNN = (renderBlocks.aoLightValueScratchXYZNNN + + renderBlocks.aoLightValueScratchXYNN + + renderBlocks.aoLightValueScratchXZNN + + aoLightValue) + / 4.0F; + float aoMixedXYZNNP = (renderBlocks.aoLightValueScratchXYNN + + renderBlocks.aoLightValueScratchXYZNNP + + aoLightValue + + renderBlocks.aoLightValueScratchXZNP) + / 4.0F; + float aoMixedXYZNPP = (aoLightValue + + renderBlocks.aoLightValueScratchXZNP + + renderBlocks.aoLightValueScratchXYNP + + renderBlocks.aoLightValueScratchXYZNPP) + / 4.0F; + + aoTopLeft = (float) (aoMixedXYZNPP * renderBlocks.renderMaxY * renderBlocks.renderMaxZ + + aoMixedXYZNPN * renderBlocks.renderMaxY * (1.0D - renderBlocks.renderMaxZ) + + aoMixedXYZNNN * (1.0D - renderBlocks.renderMaxY) * (1.0D - renderBlocks.renderMaxZ) + + aoMixedXYZNNP * (1.0D - renderBlocks.renderMaxY) * renderBlocks.renderMaxZ); + aoBottomLeft = (float) (aoMixedXYZNPP * renderBlocks.renderMaxY * renderBlocks.renderMinZ + + aoMixedXYZNPN * renderBlocks.renderMaxY * (1.0D - renderBlocks.renderMinZ) + + aoMixedXYZNNN * (1.0D - renderBlocks.renderMaxY) * (1.0D - renderBlocks.renderMinZ) + + aoMixedXYZNNP * (1.0D - renderBlocks.renderMaxY) * renderBlocks.renderMinZ); + aoBottomRight = (float) (aoMixedXYZNPP * renderBlocks.renderMinY * renderBlocks.renderMinZ + + aoMixedXYZNPN * renderBlocks.renderMinY * (1.0D - renderBlocks.renderMinZ) + + aoMixedXYZNNN * (1.0D - renderBlocks.renderMinY) * (1.0D - renderBlocks.renderMinZ) + + aoMixedXYZNNP * (1.0D - renderBlocks.renderMinY) * renderBlocks.renderMinZ); + aoTopRight = (float) (aoMixedXYZNPP * renderBlocks.renderMinY * renderBlocks.renderMaxZ + + aoMixedXYZNPN * renderBlocks.renderMinY * (1.0D - renderBlocks.renderMaxZ) + + aoMixedXYZNNN * (1.0D - renderBlocks.renderMinY) * (1.0D - renderBlocks.renderMaxZ) + + aoMixedXYZNNP * (1.0D - renderBlocks.renderMinY) * renderBlocks.renderMaxZ); + + renderBlocks.brightnessTopLeft = renderBlocks.mixAoBrightness( + brightnessMixedXYZNPP, + brightnessMixedXYZNPN, + brightnessMixedXYZNNN, + brightnessMixedXYZNNP, + renderBlocks.renderMaxY * renderBlocks.renderMaxZ, + renderBlocks.renderMaxY * (1.0D - renderBlocks.renderMaxZ), + (1.0D - renderBlocks.renderMaxY) * (1.0D - renderBlocks.renderMaxZ), + (1.0D - renderBlocks.renderMaxY) * renderBlocks.renderMaxZ); + renderBlocks.brightnessBottomLeft = renderBlocks.mixAoBrightness( + brightnessMixedXYZNPP, + brightnessMixedXYZNPN, + brightnessMixedXYZNNN, + brightnessMixedXYZNNP, + renderBlocks.renderMaxY * renderBlocks.renderMinZ, + renderBlocks.renderMaxY * (1.0D - renderBlocks.renderMinZ), + (1.0D - renderBlocks.renderMaxY) * (1.0D - renderBlocks.renderMinZ), + (1.0D - renderBlocks.renderMaxY) * renderBlocks.renderMinZ); + renderBlocks.brightnessBottomRight = renderBlocks.mixAoBrightness( + brightnessMixedXYZNPP, + brightnessMixedXYZNPN, + brightnessMixedXYZNNN, + brightnessMixedXYZNNP, + renderBlocks.renderMinY * renderBlocks.renderMinZ, + renderBlocks.renderMinY * (1.0D - renderBlocks.renderMinZ), + (1.0D - renderBlocks.renderMinY) * (1.0D - renderBlocks.renderMinZ), + (1.0D - renderBlocks.renderMinY) * renderBlocks.renderMinZ); + renderBlocks.brightnessTopRight = renderBlocks.mixAoBrightness( + brightnessMixedXYZNPP, + brightnessMixedXYZNPN, + brightnessMixedXYZNNN, + brightnessMixedXYZNNP, + renderBlocks.renderMinY * renderBlocks.renderMaxZ, + renderBlocks.renderMinY * (1.0D - renderBlocks.renderMaxZ), + (1.0D - renderBlocks.renderMinY) * (1.0D - renderBlocks.renderMaxZ), + (1.0D - renderBlocks.renderMinY) * renderBlocks.renderMaxZ); } return this; @@ -405,43 +518,150 @@ public class LightingHelper { 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.renderMaxX); - renderBlocks.aoLightValueScratchXZPN = getMixedAo(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.renderMaxX); - renderBlocks.aoLightValueScratchXYPP = getMixedAo(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.renderMaxX); - renderBlocks.aoLightValueScratchXYZPNP = getMixedAo(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.renderMaxX); - renderBlocks.aoLightValueScratchXYZPPP = getMixedAo(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(renderBlocks.aoBrightnessXZPP, renderBlocks.aoBrightnessXYPP, renderBlocks.aoBrightnessXYZPPP, mixedBrightness); - int brightnessMixedXYZPNP = renderBlocks.getAoBrightness(renderBlocks.aoBrightnessXYPN, renderBlocks.aoBrightnessXYZPNP, renderBlocks.aoBrightnessXZPP, mixedBrightness); - int brightnessMixedXYZPNN = renderBlocks.getAoBrightness(renderBlocks.aoBrightnessXYZPNN, renderBlocks.aoBrightnessXYPN, renderBlocks.aoBrightnessXZPN, mixedBrightness); - int brightnessMixedXYZPPN = renderBlocks.getAoBrightness(renderBlocks.aoBrightnessXZPN, renderBlocks.aoBrightnessXYZPPN, renderBlocks.aoBrightnessXYPP, mixedBrightness); - - float aoMixedXYZPPP = (aoLightValue + renderBlocks.aoLightValueScratchXZPP + renderBlocks.aoLightValueScratchXYPP + renderBlocks.aoLightValueScratchXYZPPP) / 4.0F; - float aoMixedXYZPNP = (renderBlocks.aoLightValueScratchXYPN + renderBlocks.aoLightValueScratchXYZPNP + aoLightValue + renderBlocks.aoLightValueScratchXZPP) / 4.0F; - float aoMixedXYZPNN = (renderBlocks.aoLightValueScratchXYZPNN + renderBlocks.aoLightValueScratchXYPN + renderBlocks.aoLightValueScratchXZPN + aoLightValue) / 4.0F; - float aoMixedXYZPPN = (renderBlocks.aoLightValueScratchXZPN + aoLightValue + renderBlocks.aoLightValueScratchXYZPPN + renderBlocks.aoLightValueScratchXYPP) / 4.0F; - - aoTopLeft = (float) (aoMixedXYZPNP * (1.0D - renderBlocks.renderMinY) * renderBlocks.renderMaxZ + aoMixedXYZPNN * (1.0D - renderBlocks.renderMinY) * (1.0D - renderBlocks.renderMaxZ) + aoMixedXYZPPN * renderBlocks.renderMinY * (1.0D - renderBlocks.renderMaxZ) + aoMixedXYZPPP * renderBlocks.renderMinY * renderBlocks.renderMaxZ); - aoBottomLeft = (float) (aoMixedXYZPNP * (1.0D - renderBlocks.renderMinY) * renderBlocks.renderMinZ + aoMixedXYZPNN * (1.0D - renderBlocks.renderMinY) * (1.0D - renderBlocks.renderMinZ) + aoMixedXYZPPN * renderBlocks.renderMinY * (1.0D - renderBlocks.renderMinZ) + aoMixedXYZPPP * renderBlocks.renderMinY * renderBlocks.renderMinZ); - aoBottomRight = (float) (aoMixedXYZPNP * (1.0D - renderBlocks.renderMaxY) * renderBlocks.renderMinZ + aoMixedXYZPNN * (1.0D - renderBlocks.renderMaxY) * (1.0D - renderBlocks.renderMinZ) + aoMixedXYZPPN * renderBlocks.renderMaxY * (1.0D - renderBlocks.renderMinZ) + aoMixedXYZPPP * renderBlocks.renderMaxY * renderBlocks.renderMinZ); - aoTopRight = (float) (aoMixedXYZPNP * (1.0D - renderBlocks.renderMaxY) * renderBlocks.renderMaxZ + aoMixedXYZPNN * (1.0D - renderBlocks.renderMaxY) * (1.0D - renderBlocks.renderMaxZ) + aoMixedXYZPPN * renderBlocks.renderMaxY * (1.0D - renderBlocks.renderMaxZ) + aoMixedXYZPPP * renderBlocks.renderMaxY * renderBlocks.renderMaxZ); - - renderBlocks.brightnessTopLeft = renderBlocks.mixAoBrightness(brightnessMixedXYZPNP, brightnessMixedXYZPNN, brightnessMixedXYZPPN, brightnessMixedXYZPPP, (1.0D - renderBlocks.renderMinY) * renderBlocks.renderMaxZ, (1.0D - renderBlocks.renderMinY) * (1.0D - renderBlocks.renderMaxZ), renderBlocks.renderMinY * (1.0D - renderBlocks.renderMaxZ), renderBlocks.renderMinY * renderBlocks.renderMaxZ); - renderBlocks.brightnessBottomLeft = renderBlocks.mixAoBrightness(brightnessMixedXYZPNP, brightnessMixedXYZPNN, brightnessMixedXYZPPN, brightnessMixedXYZPPP, (1.0D - renderBlocks.renderMinY) * renderBlocks.renderMinZ, (1.0D - renderBlocks.renderMinY) * (1.0D - renderBlocks.renderMinZ), renderBlocks.renderMinY * (1.0D - renderBlocks.renderMinZ), renderBlocks.renderMinY * renderBlocks.renderMinZ); - renderBlocks.brightnessBottomRight = renderBlocks.mixAoBrightness(brightnessMixedXYZPNP, brightnessMixedXYZPNN, brightnessMixedXYZPPN, brightnessMixedXYZPPP, (1.0D - renderBlocks.renderMaxY) * renderBlocks.renderMinZ, (1.0D - renderBlocks.renderMaxY) * (1.0D - renderBlocks.renderMinZ), renderBlocks.renderMaxY * (1.0D - renderBlocks.renderMinZ), renderBlocks.renderMaxY * renderBlocks.renderMinZ); - renderBlocks.brightnessTopRight = renderBlocks.mixAoBrightness(brightnessMixedXYZPNP, brightnessMixedXYZPNN, brightnessMixedXYZPPN, brightnessMixedXYZPPP, (1.0D - renderBlocks.renderMaxY) * renderBlocks.renderMaxZ, (1.0D - renderBlocks.renderMaxY) * (1.0D - renderBlocks.renderMaxZ), renderBlocks.renderMaxY * (1.0D - renderBlocks.renderMaxZ), renderBlocks.renderMaxY * renderBlocks.renderMaxZ); - + 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.renderMaxX); + renderBlocks.aoLightValueScratchXZPN = getMixedAo( + 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.renderMaxX); + renderBlocks.aoLightValueScratchXYPP = getMixedAo( + 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.renderMaxX); + renderBlocks.aoLightValueScratchXYZPNP = getMixedAo( + 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.renderMaxX); + renderBlocks.aoLightValueScratchXYZPPP = getMixedAo( + 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( + renderBlocks.aoBrightnessXZPP, + renderBlocks.aoBrightnessXYPP, + renderBlocks.aoBrightnessXYZPPP, + mixedBrightness); + int brightnessMixedXYZPNP = renderBlocks.getAoBrightness( + renderBlocks.aoBrightnessXYPN, + renderBlocks.aoBrightnessXYZPNP, + renderBlocks.aoBrightnessXZPP, + mixedBrightness); + int brightnessMixedXYZPNN = renderBlocks.getAoBrightness( + renderBlocks.aoBrightnessXYZPNN, + renderBlocks.aoBrightnessXYPN, + renderBlocks.aoBrightnessXZPN, + mixedBrightness); + int brightnessMixedXYZPPN = renderBlocks.getAoBrightness( + renderBlocks.aoBrightnessXZPN, + renderBlocks.aoBrightnessXYZPPN, + renderBlocks.aoBrightnessXYPP, + mixedBrightness); + + float aoMixedXYZPPP = (aoLightValue + + renderBlocks.aoLightValueScratchXZPP + + renderBlocks.aoLightValueScratchXYPP + + renderBlocks.aoLightValueScratchXYZPPP) + / 4.0F; + float aoMixedXYZPNP = (renderBlocks.aoLightValueScratchXYPN + + renderBlocks.aoLightValueScratchXYZPNP + + aoLightValue + + renderBlocks.aoLightValueScratchXZPP) + / 4.0F; + float aoMixedXYZPNN = (renderBlocks.aoLightValueScratchXYZPNN + + renderBlocks.aoLightValueScratchXYPN + + renderBlocks.aoLightValueScratchXZPN + + aoLightValue) + / 4.0F; + float aoMixedXYZPPN = (renderBlocks.aoLightValueScratchXZPN + + aoLightValue + + renderBlocks.aoLightValueScratchXYZPPN + + renderBlocks.aoLightValueScratchXYPP) + / 4.0F; + + aoTopLeft = (float) (aoMixedXYZPNP * (1.0D - renderBlocks.renderMinY) * renderBlocks.renderMaxZ + + aoMixedXYZPNN * (1.0D - renderBlocks.renderMinY) * (1.0D - renderBlocks.renderMaxZ) + + aoMixedXYZPPN * renderBlocks.renderMinY * (1.0D - renderBlocks.renderMaxZ) + + aoMixedXYZPPP * renderBlocks.renderMinY * renderBlocks.renderMaxZ); + aoBottomLeft = (float) (aoMixedXYZPNP * (1.0D - renderBlocks.renderMinY) * renderBlocks.renderMinZ + + aoMixedXYZPNN * (1.0D - renderBlocks.renderMinY) * (1.0D - renderBlocks.renderMinZ) + + aoMixedXYZPPN * renderBlocks.renderMinY * (1.0D - renderBlocks.renderMinZ) + + aoMixedXYZPPP * renderBlocks.renderMinY * renderBlocks.renderMinZ); + aoBottomRight = (float) (aoMixedXYZPNP * (1.0D - renderBlocks.renderMaxY) * renderBlocks.renderMinZ + + aoMixedXYZPNN * (1.0D - renderBlocks.renderMaxY) * (1.0D - renderBlocks.renderMinZ) + + aoMixedXYZPPN * renderBlocks.renderMaxY * (1.0D - renderBlocks.renderMinZ) + + aoMixedXYZPPP * renderBlocks.renderMaxY * renderBlocks.renderMinZ); + aoTopRight = (float) (aoMixedXYZPNP * (1.0D - renderBlocks.renderMaxY) * renderBlocks.renderMaxZ + + aoMixedXYZPNN * (1.0D - renderBlocks.renderMaxY) * (1.0D - renderBlocks.renderMaxZ) + + aoMixedXYZPPN * renderBlocks.renderMaxY * (1.0D - renderBlocks.renderMaxZ) + + aoMixedXYZPPP * renderBlocks.renderMaxY * renderBlocks.renderMaxZ); + + renderBlocks.brightnessTopLeft = renderBlocks.mixAoBrightness( + brightnessMixedXYZPNP, + brightnessMixedXYZPNN, + brightnessMixedXYZPPN, + brightnessMixedXYZPPP, + (1.0D - renderBlocks.renderMinY) * renderBlocks.renderMaxZ, + (1.0D - renderBlocks.renderMinY) * (1.0D - renderBlocks.renderMaxZ), + renderBlocks.renderMinY * (1.0D - renderBlocks.renderMaxZ), + renderBlocks.renderMinY * renderBlocks.renderMaxZ); + renderBlocks.brightnessBottomLeft = renderBlocks.mixAoBrightness( + brightnessMixedXYZPNP, + brightnessMixedXYZPNN, + brightnessMixedXYZPPN, + brightnessMixedXYZPPP, + (1.0D - renderBlocks.renderMinY) * renderBlocks.renderMinZ, + (1.0D - renderBlocks.renderMinY) * (1.0D - renderBlocks.renderMinZ), + renderBlocks.renderMinY * (1.0D - renderBlocks.renderMinZ), + renderBlocks.renderMinY * renderBlocks.renderMinZ); + renderBlocks.brightnessBottomRight = renderBlocks.mixAoBrightness( + brightnessMixedXYZPNP, + brightnessMixedXYZPNN, + brightnessMixedXYZPPN, + brightnessMixedXYZPPP, + (1.0D - renderBlocks.renderMaxY) * renderBlocks.renderMinZ, + (1.0D - renderBlocks.renderMaxY) * (1.0D - renderBlocks.renderMinZ), + renderBlocks.renderMaxY * (1.0D - renderBlocks.renderMinZ), + renderBlocks.renderMaxY * renderBlocks.renderMinZ); + renderBlocks.brightnessTopRight = renderBlocks.mixAoBrightness( + brightnessMixedXYZPNP, + brightnessMixedXYZPNN, + brightnessMixedXYZPPN, + brightnessMixedXYZPPP, + (1.0D - renderBlocks.renderMaxY) * renderBlocks.renderMaxZ, + (1.0D - renderBlocks.renderMaxY) * (1.0D - renderBlocks.renderMaxZ), + renderBlocks.renderMaxY * (1.0D - renderBlocks.renderMaxZ), + renderBlocks.renderMaxY * renderBlocks.renderMaxZ); } return this; @@ -476,43 +696,150 @@ public class LightingHelper { 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); - renderBlocks.aoLightValueScratchXYNN = getMixedAo(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(), ratio); - renderBlocks.aoLightValueScratchYZNP = getMixedAo(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(), ratio); - renderBlocks.aoLightValueScratchXYZNNN = getMixedAo(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(), ratio); - renderBlocks.aoLightValueScratchXYZPNN = getMixedAo(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(), ratio); - - int brightnessMixedXYZPNP = renderBlocks.getAoBrightness(renderBlocks.aoBrightnessYZNP, renderBlocks.aoBrightnessXYZPNP, renderBlocks.aoBrightnessXYPN, mixedBrightness); - int brightnessMixedXYZPNN = renderBlocks.getAoBrightness(renderBlocks.aoBrightnessYZNN, renderBlocks.aoBrightnessXYPN, renderBlocks.aoBrightnessXYZPNN, mixedBrightness); - int brightnessMixedXYZNNN = renderBlocks.getAoBrightness(renderBlocks.aoBrightnessXYNN, renderBlocks.aoBrightnessXYZNNN, renderBlocks.aoBrightnessYZNN, mixedBrightness); - int brightnessMixedXYZNNP = renderBlocks.getAoBrightness(renderBlocks.aoBrightnessXYZNNP, renderBlocks.aoBrightnessXYNN, renderBlocks.aoBrightnessYZNP, mixedBrightness); - - float aoMixedXYZPNP = (renderBlocks.aoLightValueScratchYZNP + aoLightValue + renderBlocks.aoLightValueScratchXYZPNP + renderBlocks.aoLightValueScratchXYPN) / 4.0F; - float aoMixedXYZPNN = (aoLightValue + renderBlocks.aoLightValueScratchYZNN + renderBlocks.aoLightValueScratchXYPN + renderBlocks.aoLightValueScratchXYZPNN) / 4.0F; - float aoMixedXYZNNN = (renderBlocks.aoLightValueScratchXYNN + renderBlocks.aoLightValueScratchXYZNNN + aoLightValue + renderBlocks.aoLightValueScratchYZNN) / 4.0F; - float aoMixedXYZNNP = (renderBlocks.aoLightValueScratchXYZNNP + renderBlocks.aoLightValueScratchXYNN + renderBlocks.aoLightValueScratchYZNP + aoLightValue) / 4.0F; - - aoTopLeft = (float) (aoMixedXYZNNP * renderBlocks.renderMaxZ * (1.0D - renderBlocks.renderMinX) + aoMixedXYZPNP * renderBlocks.renderMaxZ * renderBlocks.renderMinX + aoMixedXYZPNN * (1.0D - renderBlocks.renderMaxZ) * renderBlocks.renderMinX + aoMixedXYZNNN * (1.0D - renderBlocks.renderMaxZ) * (1.0D - renderBlocks.renderMinX)); - aoBottomLeft = (float) (aoMixedXYZNNP * renderBlocks.renderMinZ * (1.0D - renderBlocks.renderMinX) + aoMixedXYZPNP * renderBlocks.renderMinZ * renderBlocks.renderMinX + aoMixedXYZPNN * (1.0D - renderBlocks.renderMinZ) * renderBlocks.renderMinX + aoMixedXYZNNN * (1.0D - renderBlocks.renderMinZ) * (1.0D - renderBlocks.renderMinX)); - aoBottomRight = (float) (aoMixedXYZNNP * renderBlocks.renderMinZ * (1.0D - renderBlocks.renderMaxX) + aoMixedXYZPNP * renderBlocks.renderMinZ * renderBlocks.renderMaxX + aoMixedXYZPNN * (1.0D - renderBlocks.renderMinZ) * renderBlocks.renderMaxX + aoMixedXYZNNN * (1.0D - renderBlocks.renderMinZ) * (1.0D - renderBlocks.renderMaxX)); - aoTopRight = (float) (aoMixedXYZNNP * renderBlocks.renderMaxZ * (1.0D - renderBlocks.renderMaxX) + aoMixedXYZPNP * renderBlocks.renderMaxZ * renderBlocks.renderMaxX + aoMixedXYZPNN * (1.0D - renderBlocks.renderMaxZ) * renderBlocks.renderMaxX + aoMixedXYZNNN * (1.0D - renderBlocks.renderMaxZ) * (1.0D - renderBlocks.renderMaxX)); - - renderBlocks.brightnessTopLeft = renderBlocks.mixAoBrightness(brightnessMixedXYZNNP, brightnessMixedXYZPNP, brightnessMixedXYZPNN, brightnessMixedXYZNNN, renderBlocks.renderMaxZ * (1.0D - renderBlocks.renderMinX), renderBlocks.renderMaxZ * renderBlocks.renderMinX, (1.0D - renderBlocks.renderMaxZ) * renderBlocks.renderMinX, (1.0D - renderBlocks.renderMaxZ) * (1.0D - renderBlocks.renderMinX)); - renderBlocks.brightnessBottomLeft = renderBlocks.mixAoBrightness(brightnessMixedXYZNNP, brightnessMixedXYZPNP, brightnessMixedXYZPNN, brightnessMixedXYZNNN, renderBlocks.renderMinZ * (1.0D - renderBlocks.renderMinX), renderBlocks.renderMinZ * renderBlocks.renderMinX, (1.0D - renderBlocks.renderMinZ) * renderBlocks.renderMinX, (1.0D - renderBlocks.renderMinZ) * (1.0D - renderBlocks.renderMinX)); - renderBlocks.brightnessBottomRight = renderBlocks.mixAoBrightness(brightnessMixedXYZNNP, brightnessMixedXYZPNP, brightnessMixedXYZPNN, brightnessMixedXYZNNN, renderBlocks.renderMinZ * (1.0D - renderBlocks.renderMaxX), renderBlocks.renderMinZ * renderBlocks.renderMaxX, (1.0D - renderBlocks.renderMinZ) * renderBlocks.renderMaxX, (1.0D - renderBlocks.renderMinZ) * (1.0D - renderBlocks.renderMaxX)); - renderBlocks.brightnessTopRight = renderBlocks.mixAoBrightness(brightnessMixedXYZNNP, brightnessMixedXYZPNP, brightnessMixedXYZPNN, brightnessMixedXYZNNN, renderBlocks.renderMaxZ * (1.0D - renderBlocks.renderMaxX), renderBlocks.renderMaxZ * renderBlocks.renderMaxX, (1.0D - renderBlocks.renderMaxZ) * renderBlocks.renderMaxX, (1.0D - renderBlocks.renderMaxZ) * (1.0D - renderBlocks.renderMaxX)); - + 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(), + ratio); + renderBlocks.aoLightValueScratchYZNN = getMixedAo( + 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(), + ratio); + renderBlocks.aoLightValueScratchXYPN = getMixedAo( + 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(), + ratio); + renderBlocks.aoLightValueScratchXYZNNP = getMixedAo( + 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(), + ratio); + renderBlocks.aoLightValueScratchXYZPNP = getMixedAo( + renderBlocks.blockAccess.getBlock(x + 1, y - 1, z + 1).getAmbientOcclusionLightValue(), + renderBlocks.blockAccess.getBlock(x + 1, y, z + 1).getAmbientOcclusionLightValue(), + ratio); + + int brightnessMixedXYZPNP = renderBlocks.getAoBrightness( + renderBlocks.aoBrightnessYZNP, + renderBlocks.aoBrightnessXYZPNP, + renderBlocks.aoBrightnessXYPN, + mixedBrightness); + int brightnessMixedXYZPNN = renderBlocks.getAoBrightness( + renderBlocks.aoBrightnessYZNN, + renderBlocks.aoBrightnessXYPN, + renderBlocks.aoBrightnessXYZPNN, + mixedBrightness); + int brightnessMixedXYZNNN = renderBlocks.getAoBrightness( + renderBlocks.aoBrightnessXYNN, + renderBlocks.aoBrightnessXYZNNN, + renderBlocks.aoBrightnessYZNN, + mixedBrightness); + int brightnessMixedXYZNNP = renderBlocks.getAoBrightness( + renderBlocks.aoBrightnessXYZNNP, + renderBlocks.aoBrightnessXYNN, + renderBlocks.aoBrightnessYZNP, + mixedBrightness); + + float aoMixedXYZPNP = (renderBlocks.aoLightValueScratchYZNP + + aoLightValue + + renderBlocks.aoLightValueScratchXYZPNP + + renderBlocks.aoLightValueScratchXYPN) + / 4.0F; + float aoMixedXYZPNN = (aoLightValue + + renderBlocks.aoLightValueScratchYZNN + + renderBlocks.aoLightValueScratchXYPN + + renderBlocks.aoLightValueScratchXYZPNN) + / 4.0F; + float aoMixedXYZNNN = (renderBlocks.aoLightValueScratchXYNN + + renderBlocks.aoLightValueScratchXYZNNN + + aoLightValue + + renderBlocks.aoLightValueScratchYZNN) + / 4.0F; + float aoMixedXYZNNP = (renderBlocks.aoLightValueScratchXYZNNP + + renderBlocks.aoLightValueScratchXYNN + + renderBlocks.aoLightValueScratchYZNP + + aoLightValue) + / 4.0F; + + aoTopLeft = (float) (aoMixedXYZNNP * renderBlocks.renderMaxZ * (1.0D - renderBlocks.renderMinX) + + aoMixedXYZPNP * renderBlocks.renderMaxZ * renderBlocks.renderMinX + + aoMixedXYZPNN * (1.0D - renderBlocks.renderMaxZ) * renderBlocks.renderMinX + + aoMixedXYZNNN * (1.0D - renderBlocks.renderMaxZ) * (1.0D - renderBlocks.renderMinX)); + aoBottomLeft = (float) (aoMixedXYZNNP * renderBlocks.renderMinZ * (1.0D - renderBlocks.renderMinX) + + aoMixedXYZPNP * renderBlocks.renderMinZ * renderBlocks.renderMinX + + aoMixedXYZPNN * (1.0D - renderBlocks.renderMinZ) * renderBlocks.renderMinX + + aoMixedXYZNNN * (1.0D - renderBlocks.renderMinZ) * (1.0D - renderBlocks.renderMinX)); + aoBottomRight = (float) (aoMixedXYZNNP * renderBlocks.renderMinZ * (1.0D - renderBlocks.renderMaxX) + + aoMixedXYZPNP * renderBlocks.renderMinZ * renderBlocks.renderMaxX + + aoMixedXYZPNN * (1.0D - renderBlocks.renderMinZ) * renderBlocks.renderMaxX + + aoMixedXYZNNN * (1.0D - renderBlocks.renderMinZ) * (1.0D - renderBlocks.renderMaxX)); + aoTopRight = (float) (aoMixedXYZNNP * renderBlocks.renderMaxZ * (1.0D - renderBlocks.renderMaxX) + + aoMixedXYZPNP * renderBlocks.renderMaxZ * renderBlocks.renderMaxX + + aoMixedXYZPNN * (1.0D - renderBlocks.renderMaxZ) * renderBlocks.renderMaxX + + aoMixedXYZNNN * (1.0D - renderBlocks.renderMaxZ) * (1.0D - renderBlocks.renderMaxX)); + + renderBlocks.brightnessTopLeft = renderBlocks.mixAoBrightness( + brightnessMixedXYZNNP, + brightnessMixedXYZPNP, + brightnessMixedXYZPNN, + brightnessMixedXYZNNN, + renderBlocks.renderMaxZ * (1.0D - renderBlocks.renderMinX), + renderBlocks.renderMaxZ * renderBlocks.renderMinX, + (1.0D - renderBlocks.renderMaxZ) * renderBlocks.renderMinX, + (1.0D - renderBlocks.renderMaxZ) * (1.0D - renderBlocks.renderMinX)); + renderBlocks.brightnessBottomLeft = renderBlocks.mixAoBrightness( + brightnessMixedXYZNNP, + brightnessMixedXYZPNP, + brightnessMixedXYZPNN, + brightnessMixedXYZNNN, + renderBlocks.renderMinZ * (1.0D - renderBlocks.renderMinX), + renderBlocks.renderMinZ * renderBlocks.renderMinX, + (1.0D - renderBlocks.renderMinZ) * renderBlocks.renderMinX, + (1.0D - renderBlocks.renderMinZ) * (1.0D - renderBlocks.renderMinX)); + renderBlocks.brightnessBottomRight = renderBlocks.mixAoBrightness( + brightnessMixedXYZNNP, + brightnessMixedXYZPNP, + brightnessMixedXYZPNN, + brightnessMixedXYZNNN, + renderBlocks.renderMinZ * (1.0D - renderBlocks.renderMaxX), + renderBlocks.renderMinZ * renderBlocks.renderMaxX, + (1.0D - renderBlocks.renderMinZ) * renderBlocks.renderMaxX, + (1.0D - renderBlocks.renderMinZ) * (1.0D - renderBlocks.renderMaxX)); + renderBlocks.brightnessTopRight = renderBlocks.mixAoBrightness( + brightnessMixedXYZNNP, + brightnessMixedXYZPNP, + brightnessMixedXYZPNN, + brightnessMixedXYZNNN, + renderBlocks.renderMaxZ * (1.0D - renderBlocks.renderMaxX), + renderBlocks.renderMaxZ * renderBlocks.renderMaxX, + (1.0D - renderBlocks.renderMaxZ) * renderBlocks.renderMaxX, + (1.0D - renderBlocks.renderMaxZ) * (1.0D - renderBlocks.renderMaxX)); } return this; @@ -546,42 +873,150 @@ public class LightingHelper { 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.renderMaxY); - renderBlocks.aoLightValueScratchXYPP = getMixedAo(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.renderMaxY); - renderBlocks.aoLightValueScratchYZPP = getMixedAo(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.renderMaxY); - renderBlocks.aoLightValueScratchXYZPPN = getMixedAo(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.renderMaxY); - renderBlocks.aoLightValueScratchXYZPPP = getMixedAo(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(renderBlocks.aoBrightnessYZPP, renderBlocks.aoBrightnessXYZPPP, renderBlocks.aoBrightnessXYPP, mixedBrightness); - int brightnessMixedXYZPPN = renderBlocks.getAoBrightness(renderBlocks.aoBrightnessYZPN, renderBlocks.aoBrightnessXYPP, renderBlocks.aoBrightnessXYZPPN, mixedBrightness); - int brightnessMixedXYZNPN = renderBlocks.getAoBrightness(renderBlocks.aoBrightnessXYNP, renderBlocks.aoBrightnessXYZNPN, renderBlocks.aoBrightnessYZPN, mixedBrightness); - int brightnessMixedXYZNPP = renderBlocks.getAoBrightness(renderBlocks.aoBrightnessXYZNPP, renderBlocks.aoBrightnessXYNP, renderBlocks.aoBrightnessYZPP, mixedBrightness); - - float aoMixedXYZPPP = (renderBlocks.aoLightValueScratchYZPP + aoLightValue + renderBlocks.aoLightValueScratchXYZPPP + renderBlocks.aoLightValueScratchXYPP) / 4.0F; - float aoMixedXYZPPN = (aoLightValue + renderBlocks.aoLightValueScratchYZPN + renderBlocks.aoLightValueScratchXYPP + renderBlocks.aoLightValueScratchXYZPPN) / 4.0F; - float aoMixedXYZNPN = (renderBlocks.aoLightValueScratchXYNP + renderBlocks.aoLightValueScratchXYZNPN + aoLightValue + renderBlocks.aoLightValueScratchYZPN) / 4.0F; - float aoMixedXYZNPP = (renderBlocks.aoLightValueScratchXYZNPP + renderBlocks.aoLightValueScratchXYNP + renderBlocks.aoLightValueScratchYZPP + aoLightValue) / 4.0F; - - aoTopLeft /*SE*/ = (float) (aoMixedXYZNPP * renderBlocks.renderMaxZ * (1.0D - renderBlocks.renderMaxX) + aoMixedXYZPPP * renderBlocks.renderMaxZ * renderBlocks.renderMaxX + aoMixedXYZPPN * (1.0D - renderBlocks.renderMaxZ) * renderBlocks.renderMaxX + aoMixedXYZNPN * (1.0D - renderBlocks.renderMaxZ) * (1.0D - renderBlocks.renderMaxX)); - aoBottomLeft /*NE*/ = (float) (aoMixedXYZNPP * renderBlocks.renderMinZ * (1.0D - renderBlocks.renderMaxX) + aoMixedXYZPPP * renderBlocks.renderMinZ * renderBlocks.renderMaxX + aoMixedXYZPPN * (1.0D - renderBlocks.renderMinZ) * renderBlocks.renderMaxX + aoMixedXYZNPN * (1.0D - renderBlocks.renderMinZ) * (1.0D - renderBlocks.renderMaxX)); - aoBottomRight /*NW*/ = (float) (aoMixedXYZNPP * renderBlocks.renderMinZ * (1.0D - renderBlocks.renderMinX) + aoMixedXYZPPP * renderBlocks.renderMinZ * renderBlocks.renderMinX + aoMixedXYZPPN * (1.0D - renderBlocks.renderMinZ) * renderBlocks.renderMinX + aoMixedXYZNPN * (1.0D - renderBlocks.renderMinZ) * (1.0D - renderBlocks.renderMinX)); - aoTopRight /*SW*/ = (float) (aoMixedXYZNPP * renderBlocks.renderMaxZ * (1.0D - renderBlocks.renderMinX) + aoMixedXYZPPP * renderBlocks.renderMaxZ * renderBlocks.renderMinX + aoMixedXYZPPN * (1.0D - renderBlocks.renderMaxZ) * renderBlocks.renderMinX + aoMixedXYZNPN * (1.0D - renderBlocks.renderMaxZ) * (1.0D - renderBlocks.renderMinX)); - - renderBlocks.brightnessTopLeft = renderBlocks.mixAoBrightness(brightnessMixedXYZNPP, brightnessMixedXYZPPP, brightnessMixedXYZPPN, brightnessMixedXYZNPN, renderBlocks.renderMaxZ * (1.0D - renderBlocks.renderMaxX), renderBlocks.renderMaxZ * renderBlocks.renderMaxX, (1.0D - renderBlocks.renderMaxZ) * renderBlocks.renderMaxX, (1.0D - renderBlocks.renderMaxZ) * (1.0D - renderBlocks.renderMaxX)); - renderBlocks.brightnessBottomLeft = renderBlocks.mixAoBrightness(brightnessMixedXYZNPP, brightnessMixedXYZPPP, brightnessMixedXYZPPN, brightnessMixedXYZNPN, renderBlocks.renderMinZ * (1.0D - renderBlocks.renderMaxX), renderBlocks.renderMinZ * renderBlocks.renderMaxX, (1.0D - renderBlocks.renderMinZ) * renderBlocks.renderMaxX, (1.0D - renderBlocks.renderMinZ) * (1.0D - renderBlocks.renderMaxX)); - renderBlocks.brightnessBottomRight = renderBlocks.mixAoBrightness(brightnessMixedXYZNPP, brightnessMixedXYZPPP, brightnessMixedXYZPPN, brightnessMixedXYZNPN, renderBlocks.renderMinZ * (1.0D - renderBlocks.renderMinX), renderBlocks.renderMinZ * renderBlocks.renderMinX, (1.0D - renderBlocks.renderMinZ) * renderBlocks.renderMinX, (1.0D - renderBlocks.renderMinZ) * (1.0D - renderBlocks.renderMinX)); - renderBlocks.brightnessTopRight = renderBlocks.mixAoBrightness(brightnessMixedXYZNPP, brightnessMixedXYZPPP, brightnessMixedXYZPPN, brightnessMixedXYZNPN, renderBlocks.renderMaxZ * (1.0D - renderBlocks.renderMinX), renderBlocks.renderMaxZ * renderBlocks.renderMinX, (1.0D - renderBlocks.renderMaxZ) * renderBlocks.renderMinX, (1.0D - renderBlocks.renderMaxZ) * (1.0D - renderBlocks.renderMinX)); + 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.renderMaxY); + renderBlocks.aoLightValueScratchXYPP = getMixedAo( + 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.renderMaxY); + renderBlocks.aoLightValueScratchYZPP = getMixedAo( + 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.renderMaxY); + renderBlocks.aoLightValueScratchXYZPPN = getMixedAo( + 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.renderMaxY); + renderBlocks.aoLightValueScratchXYZPPP = getMixedAo( + 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( + renderBlocks.aoBrightnessYZPP, + renderBlocks.aoBrightnessXYZPPP, + renderBlocks.aoBrightnessXYPP, + mixedBrightness); + int brightnessMixedXYZPPN = renderBlocks.getAoBrightness( + renderBlocks.aoBrightnessYZPN, + renderBlocks.aoBrightnessXYPP, + renderBlocks.aoBrightnessXYZPPN, + mixedBrightness); + int brightnessMixedXYZNPN = renderBlocks.getAoBrightness( + renderBlocks.aoBrightnessXYNP, + renderBlocks.aoBrightnessXYZNPN, + renderBlocks.aoBrightnessYZPN, + mixedBrightness); + int brightnessMixedXYZNPP = renderBlocks.getAoBrightness( + renderBlocks.aoBrightnessXYZNPP, + renderBlocks.aoBrightnessXYNP, + renderBlocks.aoBrightnessYZPP, + mixedBrightness); + + float aoMixedXYZPPP = (renderBlocks.aoLightValueScratchYZPP + + aoLightValue + + renderBlocks.aoLightValueScratchXYZPPP + + renderBlocks.aoLightValueScratchXYPP) + / 4.0F; + float aoMixedXYZPPN = (aoLightValue + + renderBlocks.aoLightValueScratchYZPN + + renderBlocks.aoLightValueScratchXYPP + + renderBlocks.aoLightValueScratchXYZPPN) + / 4.0F; + float aoMixedXYZNPN = (renderBlocks.aoLightValueScratchXYNP + + renderBlocks.aoLightValueScratchXYZNPN + + aoLightValue + + renderBlocks.aoLightValueScratchYZPN) + / 4.0F; + float aoMixedXYZNPP = (renderBlocks.aoLightValueScratchXYZNPP + + renderBlocks.aoLightValueScratchXYNP + + renderBlocks.aoLightValueScratchYZPP + + aoLightValue) + / 4.0F; + + aoTopLeft /*SE*/ = (float) (aoMixedXYZNPP * renderBlocks.renderMaxZ * (1.0D - renderBlocks.renderMaxX) + + aoMixedXYZPPP * renderBlocks.renderMaxZ * renderBlocks.renderMaxX + + aoMixedXYZPPN * (1.0D - renderBlocks.renderMaxZ) * renderBlocks.renderMaxX + + aoMixedXYZNPN * (1.0D - renderBlocks.renderMaxZ) * (1.0D - renderBlocks.renderMaxX)); + aoBottomLeft /*NE*/ = (float) (aoMixedXYZNPP * renderBlocks.renderMinZ * (1.0D - renderBlocks.renderMaxX) + + aoMixedXYZPPP * renderBlocks.renderMinZ * renderBlocks.renderMaxX + + aoMixedXYZPPN * (1.0D - renderBlocks.renderMinZ) * renderBlocks.renderMaxX + + aoMixedXYZNPN * (1.0D - renderBlocks.renderMinZ) * (1.0D - renderBlocks.renderMaxX)); + aoBottomRight /*NW*/ = (float) (aoMixedXYZNPP * renderBlocks.renderMinZ * (1.0D - renderBlocks.renderMinX) + + aoMixedXYZPPP * renderBlocks.renderMinZ * renderBlocks.renderMinX + + aoMixedXYZPPN * (1.0D - renderBlocks.renderMinZ) * renderBlocks.renderMinX + + aoMixedXYZNPN * (1.0D - renderBlocks.renderMinZ) * (1.0D - renderBlocks.renderMinX)); + aoTopRight /*SW*/ = (float) (aoMixedXYZNPP * renderBlocks.renderMaxZ * (1.0D - renderBlocks.renderMinX) + + aoMixedXYZPPP * renderBlocks.renderMaxZ * renderBlocks.renderMinX + + aoMixedXYZPPN * (1.0D - renderBlocks.renderMaxZ) * renderBlocks.renderMinX + + aoMixedXYZNPN * (1.0D - renderBlocks.renderMaxZ) * (1.0D - renderBlocks.renderMinX)); + + renderBlocks.brightnessTopLeft = renderBlocks.mixAoBrightness( + brightnessMixedXYZNPP, + brightnessMixedXYZPPP, + brightnessMixedXYZPPN, + brightnessMixedXYZNPN, + renderBlocks.renderMaxZ * (1.0D - renderBlocks.renderMaxX), + renderBlocks.renderMaxZ * renderBlocks.renderMaxX, + (1.0D - renderBlocks.renderMaxZ) * renderBlocks.renderMaxX, + (1.0D - renderBlocks.renderMaxZ) * (1.0D - renderBlocks.renderMaxX)); + renderBlocks.brightnessBottomLeft = renderBlocks.mixAoBrightness( + brightnessMixedXYZNPP, + brightnessMixedXYZPPP, + brightnessMixedXYZPPN, + brightnessMixedXYZNPN, + renderBlocks.renderMinZ * (1.0D - renderBlocks.renderMaxX), + renderBlocks.renderMinZ * renderBlocks.renderMaxX, + (1.0D - renderBlocks.renderMinZ) * renderBlocks.renderMaxX, + (1.0D - renderBlocks.renderMinZ) * (1.0D - renderBlocks.renderMaxX)); + renderBlocks.brightnessBottomRight = renderBlocks.mixAoBrightness( + brightnessMixedXYZNPP, + brightnessMixedXYZPPP, + brightnessMixedXYZPPN, + brightnessMixedXYZNPN, + renderBlocks.renderMinZ * (1.0D - renderBlocks.renderMinX), + renderBlocks.renderMinZ * renderBlocks.renderMinX, + (1.0D - renderBlocks.renderMinZ) * renderBlocks.renderMinX, + (1.0D - renderBlocks.renderMinZ) * (1.0D - renderBlocks.renderMinX)); + renderBlocks.brightnessTopRight = renderBlocks.mixAoBrightness( + brightnessMixedXYZNPP, + brightnessMixedXYZPPP, + brightnessMixedXYZPPN, + brightnessMixedXYZNPN, + renderBlocks.renderMaxZ * (1.0D - renderBlocks.renderMinX), + renderBlocks.renderMaxZ * renderBlocks.renderMinX, + (1.0D - renderBlocks.renderMaxZ) * renderBlocks.renderMinX, + (1.0D - renderBlocks.renderMaxZ) * (1.0D - renderBlocks.renderMinX)); } return this; @@ -616,43 +1051,150 @@ public class LightingHelper { 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); - renderBlocks.aoLightValueScratchXZNN = getMixedAo(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(), ratio); - renderBlocks.aoLightValueScratchYZPN = getMixedAo(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(), ratio); - renderBlocks.aoLightValueScratchXYZNNN = getMixedAo(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(), ratio); - renderBlocks.aoLightValueScratchXYZPNN = getMixedAo(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(), ratio); - - int brightnessMixedXYZPPN = renderBlocks.getAoBrightness(renderBlocks.aoBrightnessYZPN, renderBlocks.aoBrightnessXZPN, renderBlocks.aoBrightnessXYZPPN, mixedBrightness); - int brightnessMixedXYZPNN = renderBlocks.getAoBrightness(renderBlocks.aoBrightnessYZNN, renderBlocks.aoBrightnessXYZPNN, renderBlocks.aoBrightnessXZPN, mixedBrightness); - int brightnessMixedXYZNNN = renderBlocks.getAoBrightness(renderBlocks.aoBrightnessXYZNNN, renderBlocks.aoBrightnessXZNN, renderBlocks.aoBrightnessYZNN, mixedBrightness); - int brightnessMixedXYZNPN = renderBlocks.getAoBrightness(renderBlocks.aoBrightnessXZNN, renderBlocks.aoBrightnessXYZNPN, renderBlocks.aoBrightnessYZPN, mixedBrightness); - - float aoMixedXYZPPN = (aoLightValue + renderBlocks.aoLightValueScratchYZPN + renderBlocks.aoLightValueScratchXZPN + renderBlocks.aoLightValueScratchXYZPPN) / 4.0F; - float aoMixedXYZPNN = (renderBlocks.aoLightValueScratchYZNN + aoLightValue + renderBlocks.aoLightValueScratchXYZPNN + renderBlocks.aoLightValueScratchXZPN) / 4.0F; - float aoMixedXYZNNN = (renderBlocks.aoLightValueScratchXYZNNN + renderBlocks.aoLightValueScratchXZNN + renderBlocks.aoLightValueScratchYZNN + aoLightValue) / 4.0F; - float aoMixedXYZNPN = (renderBlocks.aoLightValueScratchXZNN + renderBlocks.aoLightValueScratchXYZNPN + aoLightValue + renderBlocks.aoLightValueScratchYZPN) / 4.0F; - - aoTopLeft = (float) (aoMixedXYZNPN * renderBlocks.renderMaxY * (1.0D - renderBlocks.renderMinX) + aoMixedXYZPPN * renderBlocks.renderMaxY * renderBlocks.renderMinX + aoMixedXYZPNN * (1.0D - renderBlocks.renderMaxY) * renderBlocks.renderMinX + aoMixedXYZNNN * (1.0D - renderBlocks.renderMaxY) * (1.0D - renderBlocks.renderMinX)); - aoBottomLeft = (float) (aoMixedXYZNPN * renderBlocks.renderMaxY * (1.0D - renderBlocks.renderMaxX) + aoMixedXYZPPN * renderBlocks.renderMaxY * renderBlocks.renderMaxX + aoMixedXYZPNN * (1.0D - renderBlocks.renderMaxY) * renderBlocks.renderMaxX + aoMixedXYZNNN * (1.0D - renderBlocks.renderMaxY) * (1.0D - renderBlocks.renderMaxX)); - aoBottomRight = (float) (aoMixedXYZNPN * renderBlocks.renderMinY * (1.0D - renderBlocks.renderMaxX) + aoMixedXYZPPN * renderBlocks.renderMinY * renderBlocks.renderMaxX + aoMixedXYZPNN * (1.0D - renderBlocks.renderMinY) * renderBlocks.renderMaxX + aoMixedXYZNNN * (1.0D - renderBlocks.renderMinY) * (1.0D - renderBlocks.renderMaxX)); - aoTopRight = (float) (aoMixedXYZNPN * renderBlocks.renderMinY * (1.0D - renderBlocks.renderMinX) + aoMixedXYZPPN * renderBlocks.renderMinY * renderBlocks.renderMinX + aoMixedXYZPNN * (1.0D - renderBlocks.renderMinY) * renderBlocks.renderMinX + aoMixedXYZNNN * (1.0D - renderBlocks.renderMinY) * (1.0D - renderBlocks.renderMinX)); - - renderBlocks.brightnessTopLeft = renderBlocks.mixAoBrightness(brightnessMixedXYZNPN, brightnessMixedXYZPPN, brightnessMixedXYZPNN, brightnessMixedXYZNNN, renderBlocks.renderMaxY * (1.0D - renderBlocks.renderMinX), renderBlocks.renderMaxY * renderBlocks.renderMinX, (1.0D - renderBlocks.renderMaxY) * renderBlocks.renderMinX, (1.0D - renderBlocks.renderMaxY) * (1.0D - renderBlocks.renderMinX)); - renderBlocks.brightnessBottomLeft = renderBlocks.mixAoBrightness(brightnessMixedXYZNPN, brightnessMixedXYZPPN, brightnessMixedXYZPNN, brightnessMixedXYZNNN, renderBlocks.renderMaxY * (1.0D - renderBlocks.renderMaxX), renderBlocks.renderMaxY * renderBlocks.renderMaxX, (1.0D - renderBlocks.renderMaxY) * renderBlocks.renderMaxX, (1.0D - renderBlocks.renderMaxY) * (1.0D - renderBlocks.renderMaxX)); - renderBlocks.brightnessBottomRight = renderBlocks.mixAoBrightness(brightnessMixedXYZNPN, brightnessMixedXYZPPN, brightnessMixedXYZPNN, brightnessMixedXYZNNN, renderBlocks.renderMinY * (1.0D - renderBlocks.renderMaxX), renderBlocks.renderMinY * renderBlocks.renderMaxX, (1.0D - renderBlocks.renderMinY) * renderBlocks.renderMaxX, (1.0D - renderBlocks.renderMinY) * (1.0D - renderBlocks.renderMaxX)); - renderBlocks.brightnessTopRight = renderBlocks.mixAoBrightness(brightnessMixedXYZNPN, brightnessMixedXYZPPN, brightnessMixedXYZPNN, brightnessMixedXYZNNN, renderBlocks.renderMinY * (1.0D - renderBlocks.renderMinX), renderBlocks.renderMinY * renderBlocks.renderMinX, (1.0D - renderBlocks.renderMinY) * renderBlocks.renderMinX, (1.0D - renderBlocks.renderMinY) * (1.0D - renderBlocks.renderMinX)); - + 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(), + ratio); + renderBlocks.aoLightValueScratchYZNN = getMixedAo( + 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(), + ratio); + renderBlocks.aoLightValueScratchXZPN = getMixedAo( + 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(), + ratio); + renderBlocks.aoLightValueScratchXYZNPN = getMixedAo( + 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(), + ratio); + renderBlocks.aoLightValueScratchXYZPPN = getMixedAo( + renderBlocks.blockAccess.getBlock(x + 1, y + 1, z - 1).getAmbientOcclusionLightValue(), + renderBlocks.blockAccess.getBlock(x + 1, y + 1, z).getAmbientOcclusionLightValue(), + ratio); + + int brightnessMixedXYZPPN = renderBlocks.getAoBrightness( + renderBlocks.aoBrightnessYZPN, + renderBlocks.aoBrightnessXZPN, + renderBlocks.aoBrightnessXYZPPN, + mixedBrightness); + int brightnessMixedXYZPNN = renderBlocks.getAoBrightness( + renderBlocks.aoBrightnessYZNN, + renderBlocks.aoBrightnessXYZPNN, + renderBlocks.aoBrightnessXZPN, + mixedBrightness); + int brightnessMixedXYZNNN = renderBlocks.getAoBrightness( + renderBlocks.aoBrightnessXYZNNN, + renderBlocks.aoBrightnessXZNN, + renderBlocks.aoBrightnessYZNN, + mixedBrightness); + int brightnessMixedXYZNPN = renderBlocks.getAoBrightness( + renderBlocks.aoBrightnessXZNN, + renderBlocks.aoBrightnessXYZNPN, + renderBlocks.aoBrightnessYZPN, + mixedBrightness); + + float aoMixedXYZPPN = (aoLightValue + + renderBlocks.aoLightValueScratchYZPN + + renderBlocks.aoLightValueScratchXZPN + + renderBlocks.aoLightValueScratchXYZPPN) + / 4.0F; + float aoMixedXYZPNN = (renderBlocks.aoLightValueScratchYZNN + + aoLightValue + + renderBlocks.aoLightValueScratchXYZPNN + + renderBlocks.aoLightValueScratchXZPN) + / 4.0F; + float aoMixedXYZNNN = (renderBlocks.aoLightValueScratchXYZNNN + + renderBlocks.aoLightValueScratchXZNN + + renderBlocks.aoLightValueScratchYZNN + + aoLightValue) + / 4.0F; + float aoMixedXYZNPN = (renderBlocks.aoLightValueScratchXZNN + + renderBlocks.aoLightValueScratchXYZNPN + + aoLightValue + + renderBlocks.aoLightValueScratchYZPN) + / 4.0F; + + aoTopLeft = (float) (aoMixedXYZNPN * renderBlocks.renderMaxY * (1.0D - renderBlocks.renderMinX) + + aoMixedXYZPPN * renderBlocks.renderMaxY * renderBlocks.renderMinX + + aoMixedXYZPNN * (1.0D - renderBlocks.renderMaxY) * renderBlocks.renderMinX + + aoMixedXYZNNN * (1.0D - renderBlocks.renderMaxY) * (1.0D - renderBlocks.renderMinX)); + aoBottomLeft = (float) (aoMixedXYZNPN * renderBlocks.renderMaxY * (1.0D - renderBlocks.renderMaxX) + + aoMixedXYZPPN * renderBlocks.renderMaxY * renderBlocks.renderMaxX + + aoMixedXYZPNN * (1.0D - renderBlocks.renderMaxY) * renderBlocks.renderMaxX + + aoMixedXYZNNN * (1.0D - renderBlocks.renderMaxY) * (1.0D - renderBlocks.renderMaxX)); + aoBottomRight = (float) (aoMixedXYZNPN * renderBlocks.renderMinY * (1.0D - renderBlocks.renderMaxX) + + aoMixedXYZPPN * renderBlocks.renderMinY * renderBlocks.renderMaxX + + aoMixedXYZPNN * (1.0D - renderBlocks.renderMinY) * renderBlocks.renderMaxX + + aoMixedXYZNNN * (1.0D - renderBlocks.renderMinY) * (1.0D - renderBlocks.renderMaxX)); + aoTopRight = (float) (aoMixedXYZNPN * renderBlocks.renderMinY * (1.0D - renderBlocks.renderMinX) + + aoMixedXYZPPN * renderBlocks.renderMinY * renderBlocks.renderMinX + + aoMixedXYZPNN * (1.0D - renderBlocks.renderMinY) * renderBlocks.renderMinX + + aoMixedXYZNNN * (1.0D - renderBlocks.renderMinY) * (1.0D - renderBlocks.renderMinX)); + + renderBlocks.brightnessTopLeft = renderBlocks.mixAoBrightness( + brightnessMixedXYZNPN, + brightnessMixedXYZPPN, + brightnessMixedXYZPNN, + brightnessMixedXYZNNN, + renderBlocks.renderMaxY * (1.0D - renderBlocks.renderMinX), + renderBlocks.renderMaxY * renderBlocks.renderMinX, + (1.0D - renderBlocks.renderMaxY) * renderBlocks.renderMinX, + (1.0D - renderBlocks.renderMaxY) * (1.0D - renderBlocks.renderMinX)); + renderBlocks.brightnessBottomLeft = renderBlocks.mixAoBrightness( + brightnessMixedXYZNPN, + brightnessMixedXYZPPN, + brightnessMixedXYZPNN, + brightnessMixedXYZNNN, + renderBlocks.renderMaxY * (1.0D - renderBlocks.renderMaxX), + renderBlocks.renderMaxY * renderBlocks.renderMaxX, + (1.0D - renderBlocks.renderMaxY) * renderBlocks.renderMaxX, + (1.0D - renderBlocks.renderMaxY) * (1.0D - renderBlocks.renderMaxX)); + renderBlocks.brightnessBottomRight = renderBlocks.mixAoBrightness( + brightnessMixedXYZNPN, + brightnessMixedXYZPPN, + brightnessMixedXYZPNN, + brightnessMixedXYZNNN, + renderBlocks.renderMinY * (1.0D - renderBlocks.renderMaxX), + renderBlocks.renderMinY * renderBlocks.renderMaxX, + (1.0D - renderBlocks.renderMinY) * renderBlocks.renderMaxX, + (1.0D - renderBlocks.renderMinY) * (1.0D - renderBlocks.renderMaxX)); + renderBlocks.brightnessTopRight = renderBlocks.mixAoBrightness( + brightnessMixedXYZNPN, + brightnessMixedXYZPPN, + brightnessMixedXYZPNN, + brightnessMixedXYZNNN, + renderBlocks.renderMinY * (1.0D - renderBlocks.renderMinX), + renderBlocks.renderMinY * renderBlocks.renderMinX, + (1.0D - renderBlocks.renderMinY) * renderBlocks.renderMinX, + (1.0D - renderBlocks.renderMinY) * (1.0D - renderBlocks.renderMinX)); } return this; @@ -686,42 +1228,150 @@ public class LightingHelper { 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.renderMaxZ); - renderBlocks.aoLightValueScratchXZPP = getMixedAo(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.renderMaxZ); - renderBlocks.aoLightValueScratchYZPP = getMixedAo(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.renderMaxZ); - renderBlocks.aoLightValueScratchXYZNPP = getMixedAo(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.renderMaxZ); - renderBlocks.aoLightValueScratchXYZPPP = getMixedAo(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(renderBlocks.aoBrightnessXZNP, renderBlocks.aoBrightnessXYZNPP, renderBlocks.aoBrightnessYZPP, mixedBrightness); - int brightnessMixedXYZNNP = renderBlocks.getAoBrightness(renderBlocks.aoBrightnessXYZNNP, renderBlocks.aoBrightnessXZNP, renderBlocks.aoBrightnessYZNP, mixedBrightness); - int brightnessMixedXYZPNP = renderBlocks.getAoBrightness(renderBlocks.aoBrightnessYZNP, renderBlocks.aoBrightnessXYZPNP, renderBlocks.aoBrightnessXZPP, mixedBrightness); - int brightnessMixedXYZPPP = renderBlocks.getAoBrightness(renderBlocks.aoBrightnessYZPP, renderBlocks.aoBrightnessXZPP, renderBlocks.aoBrightnessXYZPPP, mixedBrightness); - - float aoMixedXYZNPP = (renderBlocks.aoLightValueScratchXZNP + renderBlocks.aoLightValueScratchXYZNPP + aoLightValue + renderBlocks.aoLightValueScratchYZPP) / 4.0F; - float aoMixedXYZNNP = (renderBlocks.aoLightValueScratchXYZNNP + renderBlocks.aoLightValueScratchXZNP + renderBlocks.aoLightValueScratchYZNP + aoLightValue) / 4.0F; - float aoMixedXYZPNP = (renderBlocks.aoLightValueScratchYZNP + aoLightValue + renderBlocks.aoLightValueScratchXYZPNP + renderBlocks.aoLightValueScratchXZPP) / 4.0F; - float aoMixedXYZPPP = (aoLightValue + renderBlocks.aoLightValueScratchYZPP + renderBlocks.aoLightValueScratchXZPP + renderBlocks.aoLightValueScratchXYZPPP) / 4.0F; - - aoTopLeft = (float) (aoMixedXYZNPP * renderBlocks.renderMaxY * (1.0D - renderBlocks.renderMinX) + aoMixedXYZPPP * renderBlocks.renderMaxY * renderBlocks.renderMinX + aoMixedXYZPNP * (1.0D - renderBlocks.renderMaxY) * renderBlocks.renderMinX + aoMixedXYZNNP * (1.0D - renderBlocks.renderMaxY) * (1.0D - renderBlocks.renderMinX)); - aoBottomLeft = (float) (aoMixedXYZNPP * renderBlocks.renderMinY * (1.0D - renderBlocks.renderMinX) + aoMixedXYZPPP * renderBlocks.renderMinY * renderBlocks.renderMinX + aoMixedXYZPNP * (1.0D - renderBlocks.renderMinY) * renderBlocks.renderMinX + aoMixedXYZNNP * (1.0D - renderBlocks.renderMinY) * (1.0D - renderBlocks.renderMinX)); - aoBottomRight = (float) (aoMixedXYZNPP * renderBlocks.renderMinY * (1.0D - renderBlocks.renderMaxX) + aoMixedXYZPPP * renderBlocks.renderMinY * renderBlocks.renderMaxX + aoMixedXYZPNP * (1.0D - renderBlocks.renderMinY) * renderBlocks.renderMaxX + aoMixedXYZNNP * (1.0D - renderBlocks.renderMinY) * (1.0D - renderBlocks.renderMaxX)); - aoTopRight = (float) (aoMixedXYZNPP * renderBlocks.renderMaxY * (1.0D - renderBlocks.renderMaxX) + aoMixedXYZPPP * renderBlocks.renderMaxY * renderBlocks.renderMaxX + aoMixedXYZPNP * (1.0D - renderBlocks.renderMaxY) * renderBlocks.renderMaxX + aoMixedXYZNNP * (1.0D - renderBlocks.renderMaxY) * (1.0D - renderBlocks.renderMaxX)); - - renderBlocks.brightnessTopLeft = renderBlocks.mixAoBrightness(brightnessMixedXYZNPP, brightnessMixedXYZNNP, brightnessMixedXYZPNP, brightnessMixedXYZPPP, renderBlocks.renderMaxY * (1.0D - renderBlocks.renderMinX), (1.0D - renderBlocks.renderMaxY) * (1.0D - renderBlocks.renderMinX), (1.0D - renderBlocks.renderMaxY) * renderBlocks.renderMinX, renderBlocks.renderMaxY * renderBlocks.renderMinX); - renderBlocks.brightnessBottomLeft = renderBlocks.mixAoBrightness(brightnessMixedXYZNPP, brightnessMixedXYZNNP, brightnessMixedXYZPNP, brightnessMixedXYZPPP, renderBlocks.renderMinY * (1.0D - renderBlocks.renderMinX), (1.0D - renderBlocks.renderMinY) * (1.0D - renderBlocks.renderMinX), (1.0D - renderBlocks.renderMinY) * renderBlocks.renderMinX, renderBlocks.renderMinY * renderBlocks.renderMinX); - renderBlocks.brightnessBottomRight = renderBlocks.mixAoBrightness(brightnessMixedXYZNPP, brightnessMixedXYZNNP, brightnessMixedXYZPNP, brightnessMixedXYZPPP, renderBlocks.renderMinY * (1.0D - renderBlocks.renderMaxX), (1.0D - renderBlocks.renderMinY) * (1.0D - renderBlocks.renderMaxX), (1.0D - renderBlocks.renderMinY) * renderBlocks.renderMaxX, renderBlocks.renderMinY * renderBlocks.renderMaxX); - renderBlocks.brightnessTopRight = renderBlocks.mixAoBrightness(brightnessMixedXYZNPP, brightnessMixedXYZNNP, brightnessMixedXYZPNP, brightnessMixedXYZPPP, renderBlocks.renderMaxY * (1.0D - renderBlocks.renderMaxX), (1.0D - renderBlocks.renderMaxY) * (1.0D - renderBlocks.renderMaxX), (1.0D - renderBlocks.renderMaxY) * renderBlocks.renderMaxX, renderBlocks.renderMaxY * renderBlocks.renderMaxX); + 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.renderMaxZ); + renderBlocks.aoLightValueScratchXZPP = getMixedAo( + 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.renderMaxZ); + renderBlocks.aoLightValueScratchYZPP = getMixedAo( + 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.renderMaxZ); + renderBlocks.aoLightValueScratchXYZNPP = getMixedAo( + 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.renderMaxZ); + renderBlocks.aoLightValueScratchXYZPPP = getMixedAo( + 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( + renderBlocks.aoBrightnessXZNP, + renderBlocks.aoBrightnessXYZNPP, + renderBlocks.aoBrightnessYZPP, + mixedBrightness); + int brightnessMixedXYZNNP = renderBlocks.getAoBrightness( + renderBlocks.aoBrightnessXYZNNP, + renderBlocks.aoBrightnessXZNP, + renderBlocks.aoBrightnessYZNP, + mixedBrightness); + int brightnessMixedXYZPNP = renderBlocks.getAoBrightness( + renderBlocks.aoBrightnessYZNP, + renderBlocks.aoBrightnessXYZPNP, + renderBlocks.aoBrightnessXZPP, + mixedBrightness); + int brightnessMixedXYZPPP = renderBlocks.getAoBrightness( + renderBlocks.aoBrightnessYZPP, + renderBlocks.aoBrightnessXZPP, + renderBlocks.aoBrightnessXYZPPP, + mixedBrightness); + + float aoMixedXYZNPP = (renderBlocks.aoLightValueScratchXZNP + + renderBlocks.aoLightValueScratchXYZNPP + + aoLightValue + + renderBlocks.aoLightValueScratchYZPP) + / 4.0F; + float aoMixedXYZNNP = (renderBlocks.aoLightValueScratchXYZNNP + + renderBlocks.aoLightValueScratchXZNP + + renderBlocks.aoLightValueScratchYZNP + + aoLightValue) + / 4.0F; + float aoMixedXYZPNP = (renderBlocks.aoLightValueScratchYZNP + + aoLightValue + + renderBlocks.aoLightValueScratchXYZPNP + + renderBlocks.aoLightValueScratchXZPP) + / 4.0F; + float aoMixedXYZPPP = (aoLightValue + + renderBlocks.aoLightValueScratchYZPP + + renderBlocks.aoLightValueScratchXZPP + + renderBlocks.aoLightValueScratchXYZPPP) + / 4.0F; + + aoTopLeft = (float) (aoMixedXYZNPP * renderBlocks.renderMaxY * (1.0D - renderBlocks.renderMinX) + + aoMixedXYZPPP * renderBlocks.renderMaxY * renderBlocks.renderMinX + + aoMixedXYZPNP * (1.0D - renderBlocks.renderMaxY) * renderBlocks.renderMinX + + aoMixedXYZNNP * (1.0D - renderBlocks.renderMaxY) * (1.0D - renderBlocks.renderMinX)); + aoBottomLeft = (float) (aoMixedXYZNPP * renderBlocks.renderMinY * (1.0D - renderBlocks.renderMinX) + + aoMixedXYZPPP * renderBlocks.renderMinY * renderBlocks.renderMinX + + aoMixedXYZPNP * (1.0D - renderBlocks.renderMinY) * renderBlocks.renderMinX + + aoMixedXYZNNP * (1.0D - renderBlocks.renderMinY) * (1.0D - renderBlocks.renderMinX)); + aoBottomRight = (float) (aoMixedXYZNPP * renderBlocks.renderMinY * (1.0D - renderBlocks.renderMaxX) + + aoMixedXYZPPP * renderBlocks.renderMinY * renderBlocks.renderMaxX + + aoMixedXYZPNP * (1.0D - renderBlocks.renderMinY) * renderBlocks.renderMaxX + + aoMixedXYZNNP * (1.0D - renderBlocks.renderMinY) * (1.0D - renderBlocks.renderMaxX)); + aoTopRight = (float) (aoMixedXYZNPP * renderBlocks.renderMaxY * (1.0D - renderBlocks.renderMaxX) + + aoMixedXYZPPP * renderBlocks.renderMaxY * renderBlocks.renderMaxX + + aoMixedXYZPNP * (1.0D - renderBlocks.renderMaxY) * renderBlocks.renderMaxX + + aoMixedXYZNNP * (1.0D - renderBlocks.renderMaxY) * (1.0D - renderBlocks.renderMaxX)); + + renderBlocks.brightnessTopLeft = renderBlocks.mixAoBrightness( + brightnessMixedXYZNPP, + brightnessMixedXYZNNP, + brightnessMixedXYZPNP, + brightnessMixedXYZPPP, + renderBlocks.renderMaxY * (1.0D - renderBlocks.renderMinX), + (1.0D - renderBlocks.renderMaxY) * (1.0D - renderBlocks.renderMinX), + (1.0D - renderBlocks.renderMaxY) * renderBlocks.renderMinX, + renderBlocks.renderMaxY * renderBlocks.renderMinX); + renderBlocks.brightnessBottomLeft = renderBlocks.mixAoBrightness( + brightnessMixedXYZNPP, + brightnessMixedXYZNNP, + brightnessMixedXYZPNP, + brightnessMixedXYZPPP, + renderBlocks.renderMinY * (1.0D - renderBlocks.renderMinX), + (1.0D - renderBlocks.renderMinY) * (1.0D - renderBlocks.renderMinX), + (1.0D - renderBlocks.renderMinY) * renderBlocks.renderMinX, + renderBlocks.renderMinY * renderBlocks.renderMinX); + renderBlocks.brightnessBottomRight = renderBlocks.mixAoBrightness( + brightnessMixedXYZNPP, + brightnessMixedXYZNNP, + brightnessMixedXYZPNP, + brightnessMixedXYZPPP, + renderBlocks.renderMinY * (1.0D - renderBlocks.renderMaxX), + (1.0D - renderBlocks.renderMinY) * (1.0D - renderBlocks.renderMaxX), + (1.0D - renderBlocks.renderMinY) * renderBlocks.renderMaxX, + renderBlocks.renderMinY * renderBlocks.renderMaxX); + renderBlocks.brightnessTopRight = renderBlocks.mixAoBrightness( + brightnessMixedXYZNPP, + brightnessMixedXYZNNP, + brightnessMixedXYZPNP, + brightnessMixedXYZPPP, + renderBlocks.renderMaxY * (1.0D - renderBlocks.renderMaxX), + (1.0D - renderBlocks.renderMaxY) * (1.0D - renderBlocks.renderMaxX), + (1.0D - renderBlocks.renderMaxY) * renderBlocks.renderMaxX, + renderBlocks.renderMaxY * renderBlocks.renderMaxX); } return this; diff --git a/src/main/java/gregtech/api/util/WorldSpawnedEventBuilder.java b/src/main/java/gregtech/api/util/WorldSpawnedEventBuilder.java index f2bb79657a..50566f79a3 100644 --- a/src/main/java/gregtech/api/util/WorldSpawnedEventBuilder.java +++ b/src/main/java/gregtech/api/util/WorldSpawnedEventBuilder.java @@ -1,14 +1,13 @@ package gregtech.api.util; +import java.util.Objects; +import java.util.function.BiConsumer; +import java.util.function.Consumer; import net.minecraft.entity.Entity; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.util.Vec3; import net.minecraft.world.World; -import java.util.Objects; -import java.util.function.BiConsumer; -import java.util.function.Consumer; - @SuppressWarnings("unused") public abstract class WorldSpawnedEventBuilder implements Runnable { private static final String ILLEGAL_STATE_STR1 = "Position, identifier and world must be set"; @@ -49,36 +48,46 @@ public abstract class WorldSpawnedEventBuilder implements Runnable { private interface IPositionedWorldSpawnedEvent { Vec3 getPosition(); + IPositionedWorldSpawnedEvent setPosition(Vec3 position); + IPositionedWorldSpawnedEvent setPosition(double x, double y, double z); } private interface IEntityWorldSpawnedEvent { Entity getEntity(); + IEntityWorldSpawnedEvent setEntity(Entity entity); } private interface IEntityPlayerWorldSpawnedEvent { EntityPlayer getEntityPlayer(); + IEntityPlayerWorldSpawnedEvent setEntityPlayer(EntityPlayer entity); } private interface IStringIdentifierWorldSpawnedEvent { - String getIdentifier(); - IStringIdentifierWorldSpawnedEvent setIdentifier(String identifier); - IStringIdentifierWorldSpawnedEvent setIdentifier(Enum<?> identifier); + String getIdentifier(); + + IStringIdentifierWorldSpawnedEvent setIdentifier(String identifier); + + IStringIdentifierWorldSpawnedEvent setIdentifier(Enum<?> identifier); } private interface ISoundWorldSpawnedEvent { float getPitch(); + float getVolume(); + ISoundWorldSpawnedEvent setPitch(float pitch); + ISoundWorldSpawnedEvent setVolume(float volume); } /* Abstract Classes */ - private abstract static class EntityWorldSpawnedEventBuilder extends WorldSpawnedEventBuilder implements IEntityWorldSpawnedEvent { + private abstract static class EntityWorldSpawnedEventBuilder extends WorldSpawnedEventBuilder + implements IEntityWorldSpawnedEvent { private Entity entity; @@ -94,7 +103,8 @@ public abstract class WorldSpawnedEventBuilder implements Runnable { } } - private abstract static class PositionedEntityWorldSpawnedEventBuilder extends EntityWorldSpawnedEventBuilder implements IPositionedWorldSpawnedEvent { + private abstract static class PositionedEntityWorldSpawnedEventBuilder extends EntityWorldSpawnedEventBuilder + implements IPositionedWorldSpawnedEvent { private Vec3 position; @@ -114,10 +124,10 @@ public abstract class WorldSpawnedEventBuilder implements Runnable { this.position = Vec3.createVectorHelper(x, y, z); return this; } - } - private abstract static class PositionedWorldSpawnedEventBuilder extends WorldSpawnedEventBuilder implements IPositionedWorldSpawnedEvent { + private abstract static class PositionedWorldSpawnedEventBuilder extends WorldSpawnedEventBuilder + implements IPositionedWorldSpawnedEvent { private Vec3 position; @Override @@ -138,7 +148,8 @@ public abstract class WorldSpawnedEventBuilder implements Runnable { } } - private abstract static class StringIdentifierPositionedWorldSpawnedEventBuilder extends PositionedWorldSpawnedEventBuilder implements IStringIdentifierWorldSpawnedEvent { + private abstract static class StringIdentifierPositionedWorldSpawnedEventBuilder + extends PositionedWorldSpawnedEventBuilder implements IStringIdentifierWorldSpawnedEvent { private String identifier; @Override @@ -153,13 +164,14 @@ public abstract class WorldSpawnedEventBuilder implements Runnable { } @Override - public StringIdentifierPositionedWorldSpawnedEventBuilder setIdentifier(Enum<?> identifier){ + public StringIdentifierPositionedWorldSpawnedEventBuilder setIdentifier(Enum<?> identifier) { this.identifier = identifier.toString(); return this; } } - private abstract static class SoundStringIdentifierPositionedWorldSpawnedEventBuilder extends StringIdentifierPositionedWorldSpawnedEventBuilder implements ISoundWorldSpawnedEvent { + private abstract static class SoundStringIdentifierPositionedWorldSpawnedEventBuilder + extends StringIdentifierPositionedWorldSpawnedEventBuilder implements ISoundWorldSpawnedEvent { private float pitch; private float volume; @@ -237,11 +249,15 @@ public abstract class WorldSpawnedEventBuilder implements Runnable { if (getPosition() == null || getIdentifier() == null || getMotion() == null || getWorld() == null) throw new IllegalStateException("Position, identifier, motion and world must be set"); - getWorld().spawnParticle( - getIdentifier(), - getPosition().xCoord, getPosition().yCoord, getPosition().zCoord, - getMotion().xCoord, getMotion().yCoord, getMotion().zCoord - ); + getWorld() + .spawnParticle( + getIdentifier(), + getPosition().xCoord, + getPosition().yCoord, + getPosition().zCoord, + getMotion().xCoord, + getMotion().yCoord, + getMotion().zCoord); } } @@ -287,11 +303,14 @@ public abstract class WorldSpawnedEventBuilder implements Runnable { if (getPosition() == null || getIdentifier() == null || getWorld() == null) throw new IllegalStateException(ILLEGAL_STATE_STR1); - getWorld().playSoundEffect( - getPosition().xCoord, getPosition().yCoord, getPosition().zCoord, - getIdentifier(), - getPitch(), getVolume() - ); + getWorld() + .playSoundEffect( + getPosition().xCoord, + getPosition().yCoord, + getPosition().zCoord, + getIdentifier(), + getPitch(), + getVolume()); } } @@ -343,11 +362,15 @@ public abstract class WorldSpawnedEventBuilder implements Runnable { if (getPosition() == null || getIdentifier() == null || getWorld() == null) throw new IllegalStateException(ILLEGAL_STATE_STR1); - getWorld().playSound( - getPosition().xCoord, getPosition().yCoord, getPosition().zCoord, - getIdentifier(), - getPitch(), getVolume(), isProximity() - ); + getWorld() + .playSound( + getPosition().xCoord, + getPosition().yCoord, + getPosition().zCoord, + getIdentifier(), + getPitch(), + getVolume(), + isProximity()); } } @@ -381,10 +404,8 @@ public abstract class WorldSpawnedEventBuilder implements Runnable { if (getPosition() == null || getIdentifier() == null || getWorld() == null) throw new IllegalStateException(ILLEGAL_STATE_STR1); - getWorld().playRecord( - getIdentifier(), - (int) getPosition().xCoord,(int) getPosition().yCoord,(int) getPosition().zCoord - ); + getWorld().playRecord(getIdentifier(), (int) getPosition().xCoord, (int) getPosition().yCoord, (int) + getPosition().zCoord); } } @@ -392,7 +413,6 @@ public abstract class WorldSpawnedEventBuilder implements Runnable { private boolean isFlaming, isSmoking; private float strength; - public float getStrength() { return strength; } @@ -440,14 +460,23 @@ public abstract class WorldSpawnedEventBuilder implements Runnable { if (getPosition() == null || getWorld() == null) throw new IllegalStateException("Position and world must be set"); - getWorld().newExplosion(getEntity(), getPosition().xCoord, getPosition().yCoord, getPosition().zCoord, strength, isFlaming, isSmoking); + getWorld() + .newExplosion( + getEntity(), + getPosition().xCoord, + getPosition().yCoord, + getPosition().zCoord, + strength, + isFlaming, + isSmoking); } } /** * Positional Data is rounded down due to this targeting a block. */ - public static final class ExtinguishFireEffectEventBuilder extends PositionedWorldSpawnedEventBuilder implements IEntityPlayerWorldSpawnedEvent { + public static final class ExtinguishFireEffectEventBuilder extends PositionedWorldSpawnedEventBuilder + implements IEntityPlayerWorldSpawnedEvent { private int side; private EntityPlayer entityPlayer; @@ -492,11 +521,18 @@ public abstract class WorldSpawnedEventBuilder implements Runnable { if (getEntityPlayer() == null || getPosition() == null || getWorld() == null) throw new IllegalStateException("EntityPlayer, position and world must be set"); - getWorld().extinguishFire(getEntityPlayer(), (int) getPosition().xCoord, (int) getPosition().yCoord, (int) getPosition().zCoord, side); + getWorld() + .extinguishFire( + getEntityPlayer(), + (int) getPosition().xCoord, + (int) getPosition().yCoord, + (int) getPosition().zCoord, + side); } } - public static final class SoundAtEntityEventBuilder extends EntityWorldSpawnedEventBuilder implements ISoundWorldSpawnedEvent, IStringIdentifierWorldSpawnedEvent { + public static final class SoundAtEntityEventBuilder extends EntityWorldSpawnedEventBuilder + implements ISoundWorldSpawnedEvent, IStringIdentifierWorldSpawnedEvent { private float pitch; private float volume; @@ -553,14 +589,15 @@ public abstract class WorldSpawnedEventBuilder implements Runnable { @Override public void run() { - if (getWorld() == null || getIdentifier() == null || getEntity() == null) + if (getWorld() == null || getIdentifier() == null || getEntity() == null) throw new IllegalStateException("World, Identifier and entity must be set!"); getWorld().playSoundAtEntity(getEntity(), getIdentifier(), volume, pitch); } } - public static final class SoundToNearExceptEventBuilder extends WorldSpawnedEventBuilder implements ISoundWorldSpawnedEvent, IStringIdentifierWorldSpawnedEvent, IEntityPlayerWorldSpawnedEvent { + public static final class SoundToNearExceptEventBuilder extends WorldSpawnedEventBuilder + implements ISoundWorldSpawnedEvent, IStringIdentifierWorldSpawnedEvent, IEntityPlayerWorldSpawnedEvent { private float pitch; private float volume; @@ -613,7 +650,7 @@ public abstract class WorldSpawnedEventBuilder implements Runnable { @Override public void run() { - if (getWorld() == null || getIdentifier() == null || getEntityPlayer() == null) + if (getWorld() == null || getIdentifier() == null || getEntityPlayer() == null) throw new IllegalStateException("World, Identifier and EntityPlayer must be set!"); getWorld().playSoundAtEntity(getEntityPlayer(), getIdentifier(), volume, pitch); diff --git a/src/main/java/gregtech/api/util/extensions/IteratorExt.java b/src/main/java/gregtech/api/util/extensions/IteratorExt.java index d59bb298a4..8662870921 100644 --- a/src/main/java/gregtech/api/util/extensions/IteratorExt.java +++ b/src/main/java/gregtech/api/util/extensions/IteratorExt.java @@ -1,7 +1,6 @@ package gregtech.api.util.extensions; import gregtech.api.objects.iterators.MergedIterator; - import java.util.Iterator; public class IteratorExt { diff --git a/src/main/java/gregtech/api/world/GT_Worldgen.java b/src/main/java/gregtech/api/world/GT_Worldgen.java index c2bbdd1e21..698ed0d1c9 100644 --- a/src/main/java/gregtech/api/world/GT_Worldgen.java +++ b/src/main/java/gregtech/api/world/GT_Worldgen.java @@ -1,13 +1,12 @@ package gregtech.api.world; import gregtech.api.GregTech_API; -import net.minecraft.world.World; -import net.minecraft.world.chunk.IChunkProvider; - import java.util.List; import java.util.Map; import java.util.Random; import java.util.concurrent.ConcurrentHashMap; +import net.minecraft.world.World; +import net.minecraft.world.chunk.IChunkProvider; public abstract class GT_Worldgen { @@ -30,12 +29,30 @@ public abstract class GT_Worldgen { * @param aChunkZ zCoord of the Chunk * @return if the Worldgeneration has been successfully completed */ - public boolean executeWorldgen(World aWorld, Random aRandom, String aBiome, int aDimensionType, int aChunkX, int aChunkZ, IChunkProvider aChunkGenerator, IChunkProvider aChunkProvider) { + public boolean executeWorldgen( + World aWorld, + Random aRandom, + String aBiome, + int aDimensionType, + int aChunkX, + int aChunkZ, + IChunkProvider aChunkGenerator, + IChunkProvider aChunkProvider) { return false; } - public int executeWorldgenChunkified(World aWorld, Random aRandom, String aBiome, int aDimensionType, int aChunkX, int aChunkZ, int seedX, int seedZ, IChunkProvider aChunkGenerator, IChunkProvider aChunkProvider) { - return 4; // This is for the empty Orevein + public int executeWorldgenChunkified( + World aWorld, + Random aRandom, + String aBiome, + int aDimensionType, + int aChunkX, + int aChunkZ, + int seedX, + int seedZ, + IChunkProvider aChunkGenerator, + IChunkProvider aChunkProvider) { + return 4; // This is for the empty Orevein } /** @@ -47,26 +64,38 @@ public abstract class GT_Worldgen { * @param aChunkZ zCoord of the Chunk * @return if the Worldgeneration has been successfully completed */ - public boolean executeCavegen(World aWorld, Random aRandom, String aBiome, int aDimensionType, int aChunkX, int aChunkZ, IChunkProvider aChunkGenerator, IChunkProvider aChunkProvider) { + public boolean executeCavegen( + World aWorld, + Random aRandom, + String aBiome, + int aDimensionType, + int aChunkX, + int aChunkZ, + IChunkProvider aChunkGenerator, + IChunkProvider aChunkProvider) { return false; } /** - * + * * @param aWorld The World Object * @param aDimensionType The Type of Worldgeneration to add. -1 = Nether, 0 = Overworld, +1 = End * @param aAllowedDimensionType The Type of allowed Worldgeneration * @return if generation for this world is allowed for MoronTech (tm) OreGen (ATM (2.0.3.1Dev) only End, Nether, Overworld, Twilight Forest and Deep Dark) */ 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")))) - return false; - - String aDimName = aWorld.provider.getDimensionName(); + + 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.java b/src/main/java/gregtech/api/world/GT_Worldgen_Ore.java index 5d82d2798f..c9d1325529 100644 --- a/src/main/java/gregtech/api/world/GT_Worldgen_Ore.java +++ b/src/main/java/gregtech/api/world/GT_Worldgen_Ore.java @@ -1,10 +1,9 @@ package gregtech.api.world; import gregtech.api.GregTech_API; -import net.minecraft.block.Block; - import java.util.ArrayList; import java.util.Collection; +import net.minecraft.block.Block; public abstract class GT_Worldgen_Ore extends GT_Worldgen { public final int mBlockMeta, mAmount, mSize, mMinY, mMaxY, mProbability, mDimensionType; @@ -13,7 +12,19 @@ public abstract class GT_Worldgen_Ore extends GT_Worldgen { public final boolean mAllowToGenerateinVoid; private final String aTextWorldgen = "worldgen."; - public GT_Worldgen_Ore(String aName, boolean aDefault, Block aBlock, int aBlockMeta, int aDimensionType, int aAmount, int aSize, int aProbability, int aMinY, int aMaxY, Collection<String> aBiomeList, boolean aAllowToGenerateinVoid) { + public GT_Worldgen_Ore( + String aName, + boolean aDefault, + Block aBlock, + int aBlockMeta, + int aDimensionType, + int aAmount, + int aSize, + int aProbability, + int aMinY, + int aMaxY, + Collection<String> aBiomeList, + boolean aAllowToGenerateinVoid) { super(aName, GregTech_API.sWorldgenList, aDefault); mDimensionType = aDimensionType; mBlock = aBlock; 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 7205eef4a5..92c00bc455 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 @@ -1,25 +1,64 @@ package gregtech.api.world; +import java.util.Collection; +import java.util.Random; import net.minecraft.block.Block; import net.minecraft.init.Blocks; import net.minecraft.world.World; import net.minecraft.world.chunk.IChunkProvider; -import java.util.Collection; -import java.util.Random; - public class GT_Worldgen_Ore_SingleBlock extends GT_Worldgen_Ore { - public GT_Worldgen_Ore_SingleBlock(String aName, boolean aDefault, Block aBlock, int aBlockMeta, int aDimensionType, int aAmount, int aSize, int aProbability, int aMinY, int aMaxY, Collection<String> aBiomeList, boolean aAllowToGenerateinVoid) { - super(aName, aDefault, aBlock, aBlockMeta, aDimensionType, aAmount, aSize, aProbability, aMinY, aMaxY, aBiomeList, aAllowToGenerateinVoid); + public GT_Worldgen_Ore_SingleBlock( + String aName, + boolean aDefault, + Block aBlock, + int aBlockMeta, + int aDimensionType, + int aAmount, + int aSize, + int aProbability, + int aMinY, + int aMaxY, + Collection<String> aBiomeList, + boolean aAllowToGenerateinVoid) { + super( + aName, + aDefault, + aBlock, + aBlockMeta, + aDimensionType, + aAmount, + aSize, + aProbability, + aMinY, + aMaxY, + aBiomeList, + aAllowToGenerateinVoid); } @Override - public boolean executeWorldgen(World aWorld, Random aRandom, String aBiome, int aDimensionType, int aChunkX, int aChunkZ, IChunkProvider aChunkGenerator, IChunkProvider aChunkProvider) { - if (isGenerationAllowed(aWorld, aDimensionType, mDimensionType) && (mBiomeList.isEmpty() || mBiomeList.contains(aBiome)) && (mProbability <= 1 || aRandom.nextInt(mProbability) == 0)) { + public boolean executeWorldgen( + World aWorld, + Random aRandom, + String aBiome, + int aDimensionType, + int aChunkX, + int aChunkZ, + IChunkProvider aChunkGenerator, + IChunkProvider aChunkProvider) { + if (isGenerationAllowed(aWorld, aDimensionType, mDimensionType) + && (mBiomeList.isEmpty() || mBiomeList.contains(aBiome)) + && (mProbability <= 1 || aRandom.nextInt(mProbability) == 0)) { for (int i = 0; i < mAmount; i++) { - int tX = aChunkX + aRandom.nextInt(16), tY = mMinY + aRandom.nextInt(mMaxY - mMinY), tZ = aChunkZ + aRandom.nextInt(16); + 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)) || (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))))) { + 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))))) { aWorld.setBlock(tX, tY, tZ, mBlock, mBlockMeta, 0); } } 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 16f6d37555..940f923815 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 @@ -1,26 +1,66 @@ package gregtech.api.world; +import java.util.Collection; +import java.util.Random; import net.minecraft.block.Block; import net.minecraft.init.Blocks; import net.minecraft.world.World; import net.minecraft.world.chunk.IChunkProvider; -import java.util.Collection; -import java.util.Random; - public class GT_Worldgen_Ore_SingleBlock_UnderLava extends GT_Worldgen_Ore { - public GT_Worldgen_Ore_SingleBlock_UnderLava(String aName, boolean aDefault, Block aBlock, int aBlockMeta, int aDimensionType, int aAmount, int aSize, int aProbability, int aMinY, int aMaxY, Collection<String> aBiomeList, boolean aAllowToGenerateinVoid) { - super(aName, aDefault, aBlock, aBlockMeta, aDimensionType, aAmount, aSize, aProbability, aMinY, aMaxY, aBiomeList, aAllowToGenerateinVoid); + public GT_Worldgen_Ore_SingleBlock_UnderLava( + String aName, + boolean aDefault, + Block aBlock, + int aBlockMeta, + int aDimensionType, + int aAmount, + int aSize, + int aProbability, + int aMinY, + int aMaxY, + Collection<String> aBiomeList, + boolean aAllowToGenerateinVoid) { + super( + aName, + aDefault, + aBlock, + aBlockMeta, + aDimensionType, + aAmount, + aSize, + aProbability, + aMinY, + aMaxY, + aBiomeList, + aAllowToGenerateinVoid); } @Override - public boolean executeCavegen(World aWorld, Random aRandom, String aBiome, int aDimensionType, int aChunkX, int aChunkZ, IChunkProvider aChunkGenerator, IChunkProvider aChunkProvider) { - if (isGenerationAllowed(aWorld, aDimensionType, mDimensionType) && (mBiomeList.isEmpty() || mBiomeList.contains(aBiome)) && (mProbability <= 1 || aRandom.nextInt(mProbability) == 0)) { + public boolean executeCavegen( + World aWorld, + Random aRandom, + String aBiome, + int aDimensionType, + int aChunkX, + int aChunkZ, + IChunkProvider aChunkGenerator, + IChunkProvider aChunkProvider) { + if (isGenerationAllowed(aWorld, aDimensionType, mDimensionType) + && (mBiomeList.isEmpty() || mBiomeList.contains(aBiome)) + && (mProbability <= 1 || aRandom.nextInt(mProbability) == 0)) { for (int i = 0; i < mAmount; i++) { - int tX = aChunkX + aRandom.nextInt(16), tY = mMinY + aRandom.nextInt(mMaxY - mMinY), tZ = aChunkZ + aRandom.nextInt(16); + 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)) || (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))))) { - if (aWorld.getBlock(tX, tY + 1, tZ) == Blocks.lava || aWorld.getBlock(tX, tY, tZ) == Blocks.flowing_lava) + 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))))) { + if (aWorld.getBlock(tX, tY + 1, tZ) == Blocks.lava + || aWorld.getBlock(tX, tY, tZ) == Blocks.flowing_lava) aWorld.setBlock(tX, tY, tZ, mBlock, mBlockMeta, 0); } } |