diff options
Diffstat (limited to 'src/main/java/gregtech/api')
365 files changed, 16175 insertions, 22499 deletions
diff --git a/src/main/java/gregtech/api/GregTech_API.java b/src/main/java/gregtech/api/GregTech_API.java index 0deb239d4b..41a0885a84 100644 --- a/src/main/java/gregtech/api/GregTech_API.java +++ b/src/main/java/gregtech/api/GregTech_API.java @@ -5,8 +5,37 @@ 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 java.util.ArrayList; +import java.util.Collection; +import java.util.Collections; +import java.util.Comparator; +import java.util.HashMap; +import java.util.HashSet; +import java.util.LinkedHashMap; +import java.util.List; +import java.util.Locale; +import java.util.Map; +import java.util.TreeMap; +import java.util.concurrent.ConcurrentHashMap; +import java.util.function.BiFunction; +import java.util.function.IntFunction; +import java.util.function.Predicate; +import java.util.stream.Collectors; + +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.tileentity.TileEntity; +import net.minecraft.util.ChunkCoordinates; +import net.minecraft.world.World; +import net.minecraftforge.fluids.Fluid; + import com.google.common.collect.Multimap; import com.google.common.collect.Multimaps; + import cpw.mods.fml.common.registry.GameRegistry; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; @@ -42,46 +71,20 @@ 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 java.util.ArrayList; -import java.util.Collection; -import java.util.Collections; -import java.util.Comparator; -import java.util.HashMap; -import java.util.HashSet; -import java.util.LinkedHashMap; -import java.util.List; -import java.util.Locale; -import java.util.Map; -import java.util.TreeMap; -import java.util.concurrent.ConcurrentHashMap; -import java.util.function.BiFunction; -import java.util.function.IntFunction; -import java.util.function.Predicate; -import java.util.stream.Collectors; -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.tileentity.TileEntity; -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 - * You may just copy those Functions into your Code, or better call them via reflection. + * Please do not include this File in your Mod-download as it ruins compatibility, like with the IC2-API You may just + * copy those Functions into your Code, or better call them via reflection. * <p/> - * The whole API is the basic construct of my Mod. Everything is dependent on it. - * I change things quite often so please don't include any File inside your Mod, even if it is an Interface. - * Since some Authors were stupid enough to break this simple Rule, I added Version checks to enforce it. + * The whole API is the basic construct of my Mod. Everything is dependent on it. I change things quite often so please + * don't include any File inside your Mod, even if it is an Interface. Since some Authors were stupid enough to break + * this simple Rule, I added Version checks to enforce it. * <p/> - * In these Folders are many useful Functions. You can use them via reflection if you want. - * I know not everything is compilable due to APIs of other Mods, but these are easy to fix in your Setup. + * In these Folders are many useful Functions. You can use them via reflection if you want. I know not everything is + * compilable due to APIs of other Mods, but these are easy to fix in your Setup. * <p/> - * You can use this to learn about Modding, but I would recommend simpler Mods. - * You may even copy-paste Code from these API-Files into your Mod, as I have nothing against that, but you should look exactly at what you are copying. + * You can use this to learn about Modding, but I would recommend simpler Mods. You may even copy-paste Code from these + * API-Files into your Mod, as I have nothing against that, but you should look exactly at what you are copying. * * @author Gregorius Techneticies */ @@ -117,39 +120,20 @@ public class GregTech_API { /** * A List of all registered MetaTileEntities * <p/> - * 0 - 749 are used by GregTech. - * 750 - 999 are reserved for Alkalus. - * 1000 - 2047 are used by GregTech. - * 2048 - 2559 are reserved for OvermindDL. - * 2560 - 3071 are reserved for Immibis. - * 3072 - 3583 are reserved for LinusPhoenix. - * 3584 - 4095 are reserved for BloodyAsp. - * 4096 - 5095 are used for GregTech Frames. - * 5096 - 6099 are used for GregTech Pipes. - * 6100 - 8191 are used for GregTech Decoration Blocks. - * 8192 - 8703 are reserved for ZL123. - * 8704 - 9215 are reserved for Mr10Movie. - * 9216 - 9727 are used for GregTech Automation Machines. - * 9728 - 10239 are reserved for 28Smiles. - * 10240 - 10751 are reserved for VirMan. - * 10752 - 11263 are reserved for Briareos81. - * 11264 - 12000 are reserved for Quantum64. - * 12001 - 12500 are reserved for RedMage17. - * 12501 - 13000 are reserved for bartimaeusnek. - * 13001 - 13100 are reserved for Techlone - * 13101 - 13500 are reserved for kekzdealer - * 13501 - 14000 are reserved for glee8e. - * 14001 - 14100 are reserved for glowredman - * 14101 - 14200 are reserved for MuXiu1997. - * 14201 - 14300 are reserved for kuba6000. - * 14301 - 14999 are currently free. - * 15000 - 16999 are reserved for TecTech. - * 17000 - 29999 are currently free. - * 30000 - 31999 are reserved for Alkalus. - * 32001 - 32766 are reserved for Glod. + * 0 - 749 are used by GregTech. 750 - 999 are reserved for Alkalus. 1000 - 2047 are used by GregTech. 2048 - 2559 + * are reserved for OvermindDL. 2560 - 3071 are reserved for Immibis. 3072 - 3583 are reserved for LinusPhoenix. + * 3584 - 4095 are reserved for BloodyAsp. 4096 - 5095 are used for GregTech Frames. 5096 - 6099 are used for + * GregTech Pipes. 6100 - 8191 are used for GregTech Decoration Blocks. 8192 - 8703 are reserved for ZL123. 8704 - + * 9215 are reserved for Mr10Movie. 9216 - 9727 are used for GregTech Automation Machines. 9728 - 10239 are reserved + * for 28Smiles. 10240 - 10751 are reserved for VirMan. 10752 - 11263 are reserved for Briareos81. 11264 - 12000 are + * reserved for Quantum64. 12001 - 12500 are reserved for RedMage17. 12501 - 13000 are reserved for bartimaeusnek. + * 13001 - 13100 are reserved for Techlone 13101 - 13500 are reserved for kekzdealer 13501 - 14000 are reserved for + * glee8e. 14001 - 14100 are reserved for glowredman 14101 - 14200 are reserved for MuXiu1997. 14201 - 14300 are + * reserved for kuba6000. 14301 - 14999 are currently free. 15000 - 16999 are reserved for TecTech. 17000 - 29999 + * are currently free. 30000 - 31999 are reserved for Alkalus. 32001 - 32766 are reserved for Glod. * <p/> - * Contact me if you need a free ID-Range, which doesn't conflict with other Addons. - * You could make an ID-Config, but we all know what "stupid" customers think about conflicting ID's + * Contact me if you need a free ID-Range, which doesn't conflict with other Addons. You could make an ID-Config, + * but we all know what "stupid" customers think about conflicting ID's */ public static final IMetaTileEntity[] METATILEENTITIES = new IMetaTileEntity[MAXIMUM_METATILE_IDS]; /** @@ -175,8 +159,7 @@ public class GregTech_API { /** * The Advanced Redstone Frequencies */ - public static final Map<String, Map<Integer, Map<Long, Byte>>> sAdvancedWirelessRedstone = - new ConcurrentHashMap<>(); + public static final Map<String, Map<Integer, Map<Long, Byte>>> sAdvancedWirelessRedstone = new ConcurrentHashMap<>(); /** * The IDSU Frequencies @@ -188,6 +171,7 @@ public class GregTech_API { public static final Map<String, ItemStack> sBookList = new ConcurrentHashMap<>(); /** * The List of all Sounds used in GT, indices are in the static Block at the bottom + * * @deprecated Use {@link SoundResource} */ @Deprecated @@ -195,37 +179,30 @@ 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<>(), - sCrowbarList = new GT_HashSet<>(), - sScrewdriverList = new GT_HashSet<>(), - sWrenchList = new GT_HashSet<>(), - sSoftHammerList = new GT_HashSet<>(), - sHardHammerList = new GT_HashSet<>(), - sWireCutterList = new GT_HashSet<>(), - sSolderingToolList = 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<>(), + sSoftHammerList = new GT_HashSet<>(), sHardHammerList = new GT_HashSet<>(), + sWireCutterList = new GT_HashSet<>(), sSolderingToolList = new GT_HashSet<>(), sSolderingMetalList = new GT_HashSet<>(); /** * The List of Hazmat Armors */ 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<>(), + 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. - * Mystcraft Dimensions and other Dimensional Things should be allowed. - * Mystcraft and Twilight Forest are automatically considered a Dimension, without being in this List. + * Mystcraft Dimensions and other Dimensional Things should be allowed. Mystcraft and Twilight Forest are + * automatically considered a Dimension, without being in this List. */ public static final Collection<Integer> sDimensionalList = new HashSet<>(); /** @@ -256,38 +233,28 @@ public class GregTech_API { */ public static IThaumcraftCompat sThaumcraftCompat; /** - * 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 + * 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<>(), - sAfterGTPreload = new ArrayList<>(), - sBeforeGTLoad = new ArrayList<>(), - sAfterGTLoad = new ArrayList<>(), - sBeforeGTPostload = new ArrayList<>(), - sAfterGTPostload = new ArrayList<>(), - sFirstWorldTick = new ArrayList<>(), - sBeforeGTServerstart = new ArrayList<>(), - sAfterGTServerstart = new ArrayList<>(), - sBeforeGTServerstop = new ArrayList<>(), - sAfterGTServerstop = new ArrayList<>(), - sGTBlockIconload = new ArrayList<>(), - sGTItemIconload = new ArrayList<>(); + public static List<Runnable> sBeforeGTPreload = new ArrayList<>(), sAfterGTPreload = new ArrayList<>(), + sBeforeGTLoad = new ArrayList<>(), sAfterGTLoad = new ArrayList<>(), sBeforeGTPostload = new ArrayList<>(), + sAfterGTPostload = new ArrayList<>(), sFirstWorldTick = new ArrayList<>(), + sBeforeGTServerstart = new ArrayList<>(), sAfterGTServerstart = new ArrayList<>(), + sBeforeGTServerstop = new ArrayList<>(), sAfterGTServerstop = new ArrayList<>(), + sGTBlockIconload = new ArrayList<>(), sGTItemIconload = new ArrayList<>(); /** - * 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. + * 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; /** * The Configuration Objects */ - public static GT_Config sRecipeFile = null, - sMachineFile = null, - sWorldgenFile = null, - sMaterialProperties = null, - sMaterialComponents = null, - sUnification = null, - sSpecialFile = null, - sClientDataFile, - sOPStuff = null; + public static GT_Config sRecipeFile = null, sMachineFile = null, sWorldgenFile = null, sMaterialProperties = null, + sMaterialComponents = null, sUnification = null, sSpecialFile = null, sClientDataFile, sOPStuff = null; public static int TICKS_FOR_LAG_AVERAGING = 25, MILLISECOND_THRESHOLD_UNTIL_LAG_WARNING = 100; /** @@ -295,65 +262,24 @@ public class GregTech_API { */ public static Block sBlockMachines; - public static Block sBlockOres1, - sBlockOresUb1, - sBlockOresUb2, - sBlockOresUb3, - /*sBlockGem,*/ - sBlockMetal1, - sBlockMetal2, - sBlockMetal3, - sBlockMetal4, - sBlockMetal5, - sBlockMetal6, - sBlockMetal7, - sBlockMetal8, - sBlockMetal9, - sBlockGem1, - sBlockGem2, - sBlockGem3, - sBlockReinforced; + public static Block sBlockOres1, sBlockOresUb1, sBlockOresUb2, sBlockOresUb3, + /* sBlockGem, */ + sBlockMetal1, sBlockMetal2, sBlockMetal3, sBlockMetal4, sBlockMetal5, sBlockMetal6, sBlockMetal7, + sBlockMetal8, sBlockMetal9, sBlockGem1, sBlockGem2, sBlockGem3, sBlockReinforced; public static Block sBlockGranites, sBlockConcretes, sBlockStones; - public static Block sBlockCasings1, - sBlockCasings2, - sBlockCasings3, - sBlockCasings4, - sBlockCasings5, - sBlockCasings6, - sBlockCasings8, - sBlockCasings9, - sSolenoidCoilCasings; + public static Block sBlockCasings1, sBlockCasings2, sBlockCasings3, sBlockCasings4, sBlockCasings5, sBlockCasings6, + sBlockCasings8, sBlockCasings9, sSolenoidCoilCasings; public static Block sBlockLongDistancePipes; /** * Getting assigned by the Config */ - public static boolean sTimber = true, - sDrinksAlwaysDrinkable = false, - sMultiThreadedSounds = false, - sDoShowAllItemsInCreative = false, - sColoredGUI = true, - sMachineMetalGUI = false, - sConstantEnergy = true, - sMachineExplosions = true, - sMachineFlammable = true, - sMachineNonWrenchExplosions = true, - sMachineRainExplosions = true, - sMachineThunderExplosions = true, - sMachineFireExplosions = true, - sMachineWireFire = true, - mOutputRF = false, - mInputRF = false, - meIOLoaded = false, - mRFExplosions = false, - mServerStarted = false, - mIC2Classic = false, - mMagneticraft = false, - mImmersiveEngineering = false, - mGTPlusPlus = false, - mTranslocator = false, - mTConstruct = false, - mGalacticraft = false, - mAE2 = false; + public static boolean sTimber = true, sDrinksAlwaysDrinkable = false, sMultiThreadedSounds = false, + sDoShowAllItemsInCreative = false, sColoredGUI = true, sMachineMetalGUI = false, sConstantEnergy = true, + sMachineExplosions = true, sMachineFlammable = true, sMachineNonWrenchExplosions = true, + sMachineRainExplosions = true, sMachineThunderExplosions = true, sMachineFireExplosions = true, + sMachineWireFire = true, mOutputRF = false, mInputRF = false, meIOLoaded = false, mRFExplosions = false, + mServerStarted = false, mIC2Classic = false, mMagneticraft = false, mImmersiveEngineering = false, + mGTPlusPlus = false, mTranslocator = false, mTConstruct = false, mGalacticraft = false, mAE2 = false; public static int mEUtoRF = 360, mRFtoEU = 20; @@ -368,13 +294,8 @@ public class GregTech_API { /** * Getting assigned by the Mod loading */ - public static boolean sUnificationEntriesRegistered = false, - sPreloadStarted = false, - sPreloadFinished = false, - sLoadStarted = false, - sLoadFinished = false, - sPostloadStarted = false, - sPostloadFinished = false; + public static boolean sUnificationEntriesRegistered = false, sPreloadStarted = false, sPreloadFinished = false, + sLoadStarted = false, sLoadFinished = false, sPostloadStarted = false, sPostloadFinished = false; private static Class<BaseMetaTileEntity> sBaseMetaTileEntityClass = null; @@ -388,31 +309,36 @@ public class GregTech_API { /** * You want OreDict-Unification for YOUR Mod/Addon, when GregTech is installed? This Function is especially for YOU. - * Call this Function after the load-Phase, as I register the most of the Unification at that Phase (Redpowers Storageblocks are registered at postload). - * A recommended use of this Function is inside your Recipe-System itself (if you have one), as the unification then makes 100% sure, that every added non-unificated Output gets automatically unificated. + * Call this Function after the load-Phase, as I register the most of the Unification at that Phase (Redpowers + * Storageblocks are registered at postload). A recommended use of this Function is inside your Recipe-System itself + * (if you have one), as the unification then makes 100% sure, that every added non-unificated Output gets + * automatically unificated. * <p/> - * I will personally make sure, that only common prefixes of Ores get registered at the Unificator, as of now there are: - * pulp, dust, dustSmall, ingot, nugget, gem, ore and block - * If another Mod-Author messes these up, then it's not my fault, and it's especially not your fault. As these are commonly used prefixes. + * I will personally make sure, that only common prefixes of Ores get registered at the Unificator, as of now there + * are: pulp, dust, dustSmall, ingot, nugget, gem, ore and block If another Mod-Author messes these up, then it's + * not my fault, and it's especially not your fault. As these are commonly used prefixes. * <p/> - * This Unificator-API-Function uses the same Functions I use, for unificating Items. So if there is something messed up (very unlikely), then everything is messed up. + * This Unificator-API-Function uses the same Functions I use, for unificating Items. So if there is something + * messed up (very unlikely), then everything is messed up. * <p/> * You shouldn't use this to unificate the Inputs of your Recipes, this is only meant for the Outputs. * * @param aOreStack the Stack you want to get unificated. It is stackSize Sensitive. - * @return Either an unificated Stack or the stack you toss in, but it should never be null, unless you throw a Null-Pointer into it. + * @return Either an unificated Stack or the stack you toss in, but it should never be null, unless you throw a + * Null-Pointer into it. */ 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."); + 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."); return GT_OreDictUnificator.get(true, aOreStack); } /** - * Causes a Machineblock Update - * This update will cause surrounding MultiBlock Machines to update their Configuration. - * You should call this Function in @Block.breakBlock and in @Block.onBlockAdded of your Machine. + * Causes a Machineblock Update This update will cause surrounding MultiBlock Machines to update their + * Configuration. You should call this Function in @Block.breakBlock and in @Block.onBlockAdded of your Machine. * * @param aWorld is being the World * @param aX is the X-Coord of the update causing Block @@ -437,12 +363,12 @@ public class GregTech_API { } /** - * Adds a Multi-Machine Block, like my Machine Casings for example. - * You should call @causeMachineUpdate in @Block.breakBlock and in {@link Block#onBlockAdded} of your registered Block. - * You don't need to register TileEntities which implement {@link IMachineBlockUpdateable} + * Adds a Multi-Machine Block, like my Machine Casings for example. You should call @causeMachineUpdate + * in @Block.breakBlock and in {@link Block#onBlockAdded} of your registered Block. You don't need to register + * TileEntities which implement {@link IMachineBlockUpdateable} * - * @param aBlock the Block - * @param aMeta the Metadata of the Blocks as Bitmask! -1 or ~0 for all Meta-values + * @param aBlock the Block + * @param aMeta the Metadata of the Blocks as Bitmask! -1 or ~0 for all Meta-values */ @SuppressWarnings("UnusedReturnValue") // Retains API method signature public static boolean registerMachineBlock(Block aBlock, int aMeta) { @@ -483,233 +409,238 @@ 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); + // return + // (Item)Class.forName("gregtech.api.items.GT_CoolantCellIC_Item").getConstructors()[0].newInstance(aUnlocalized, + // aEnglish, aMaxStore); } catch (Throwable e) { - /*Do nothing*/ + /* 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); + // return + // (Item)Class.forName("gregtech.api.items.GT_CoolantCell_Item").getConstructors()[0].newInstance(aUnlocalized, + // aEnglish, aMaxStore); } catch (Throwable e) { - /*Do nothing*/ + /* Do nothing */ } return new gregtech.api.items.GT_Generic_Item( - aUnlocalized, aEnglish, "Doesn't work as intended, this is a Bug", false); + 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); + 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*/ + /* Do nothing */ } try { - return (Item) Class.forName("gregtechmod.api.items.GT_EnergyArmor_Item") - .getConstructors()[0] - .newInstance( - aUnlocalized, - aEnglish, - aCharge, - aTransfer, - aTier, - aDamageEnergyCost, - aSpecials, - aArmorAbsorbtionPercentage, - aChargeProvider, - aType, - aArmorIndex); + return (Item) Class.forName("gregtechmod.api.items.GT_EnergyArmor_Item").getConstructors()[0].newInstance( + aUnlocalized, + aEnglish, + aCharge, + aTransfer, + aTier, + aDamageEnergyCost, + aSpecials, + aArmorAbsorbtionPercentage, + aChargeProvider, + aType, + aArmorIndex); } catch (Throwable e) { - /*Do nothing*/ + /* Do nothing */ } return new gregtech.api.items.GT_Generic_Item( - aUnlocalized, aEnglish, "Doesn't work as intended, this is a Bug", false); + 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] + 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*/ + /* Do nothing */ } try { - return (Item) Class.forName("gregtechmod.api.items.GT_EnergyStore_Item") - .getConstructors()[0] + 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*/ + /* Do nothing */ } return new gregtech.api.items.GT_Generic_Item( - aUnlocalized, aEnglish, "Doesn't work as intended, this is a Bug", false); + 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] + return (GT_Tool_Item) Class.forName("gregtechmod.api.items.GT_HardHammer_Item").getConstructors()[0] .newInstance(aUnlocalized, aEnglish, aMaxDamage, aEntityDamage); } catch (Throwable e) { - /*Do nothing*/ + /* Do nothing */ } return new gregtech.api.items.GT_Tool_Item( - aUnlocalized, aEnglish, "Doesn't work as intended, this is a Bug", aMaxDamage, aEntityDamage, false); + 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] + return (GT_Tool_Item) Class.forName("gregtechmod.api.items.GT_CrowbarRC_Item").getConstructors()[0] .newInstance(aUnlocalized, aEnglish, aMaxDamage, aEntityDamage); } catch (Throwable e) { - /*Do nothing*/ + /* Do nothing */ } try { - return (GT_Tool_Item) Class.forName("gregtechmod.api.items.GT_Crowbar_Item") - .getConstructors()[0] + return (GT_Tool_Item) Class.forName("gregtechmod.api.items.GT_Crowbar_Item").getConstructors()[0] .newInstance(aUnlocalized, aEnglish, aMaxDamage, aEntityDamage); } catch (Throwable e) { - /*Do nothing*/ + /* Do nothing */ } return new gregtech.api.items.GT_Tool_Item( - aUnlocalized, aEnglish, "Doesn't work as intended, this is a Bug", aMaxDamage, aEntityDamage, false); + 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] + 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*/ + /* Do nothing */ } return new gregtech.api.items.GT_Tool_Item( - aUnlocalized, aEnglish, "Doesn't work as intended, this is a Bug", aMaxDamage, aEntityDamage, false); + 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] + 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*/ + /* Do nothing */ } return new gregtech.api.items.GT_Tool_Item( - aUnlocalized, aEnglish, "Doesn't work as intended, this is a Bug", aMaxDamage, aEntityDamage, false); + 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] + 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*/ + /* Do nothing */ } return new gregtech.api.items.GT_Tool_Item( - aUnlocalized, aEnglish, "Doesn't work as intended, this is a Bug", aMaxDamage, aEntityDamage, false); + 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, + 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); + 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*/ + /* Do nothing */ } return new gregtech.api.items.GT_Tool_Item( - aUnlocalized, aEnglish, "Doesn't work as intended, this is a Bug", aMaxDamage, aEntityDamage, false); + 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, + 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] + return (GT_Tool_Item) Class.forName("gregtechmod.api.items.GT_DrillIC_Item").getConstructors()[0] .newInstance( aUnlocalized, aEnglish, @@ -720,53 +651,67 @@ public class GregTech_API { aEnergyConsumptionPerBlockBreak, aDisChargedGTID); } catch (Throwable e) { - /*Do nothing*/ + /* Do nothing */ } return new gregtech.api.items.GT_Tool_Item( - aUnlocalized, aEnglish, "Doesn't work as intended, this is a Bug", aMaxDamage, aEntityDamage, false); + 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] + 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*/ + /* Do nothing */ } return new gregtech.api.items.GT_Tool_Item( - aUnlocalized, aEnglish, "Doesn't work as intended, this is a Bug", aMaxDamage, aEntityDamage, false); + 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] + return (GT_Tool_Item) Class.forName("gregtechmod.api.items.GT_EmptyToolIC_Item").getConstructors()[0] .newInstance(aUnlocalized, aEnglish, aMaxDamage, aChargedGTID); } catch (Throwable e) { - /*Do nothing*/ + /* Do nothing */ } return new gregtech.api.items.GT_Tool_Item( - aUnlocalized, aEnglish, "Doesn't work as intended, this is a Bug", aMaxDamage, 0, false); + aUnlocalized, + aEnglish, + "Doesn't work as intended, this is a Bug", + aMaxDamage, + 0, + false); } /** - * This gives you a new BaseMetaTileEntity. As some Interfaces are not always loaded (Buildcraft, Universal Electricity) I have to use Invocation at the Constructor of the BaseMetaTileEntity + * This gives you a new BaseMetaTileEntity. As some Interfaces are not always loaded (Buildcraft, Universal + * Electricity) I have to use Invocation at the Constructor of the BaseMetaTileEntity */ public static BaseMetaTileEntity constructBaseMetaTileEntity() { if (sBaseMetaTileEntityClass == null) { try { return (sBaseMetaTileEntityClass = BaseMetaTileEntity.class).newInstance(); } catch (Throwable e) { - /*Do nothing*/ + /* Do nothing */ } } @@ -780,18 +725,17 @@ public class GregTech_API { } /** - * Register a new ItemStack as configuration circuits. - * Duplicates or invalid stacks will be silently ignored. + * Register a new ItemStack as configuration circuits. Duplicates or invalid stacks will be silently ignored. */ public static void registerConfigurationCircuit(ItemStack aStack) { registerConfigurationCircuit(aStack, 0); } /** - * Register a new ItemStack as configuration circuits. - * Duplicates or invalid stacks will be silently ignored. - * @param minTier the minimal tier this circuit can be offered for free, e.g. normal configuration circuit is available - * in LV+ single blocks, GT++ breakthrough circuit is offered in HV+ single blocks + * Register a new ItemStack as configuration circuits. Duplicates or invalid stacks will be silently ignored. + * + * @param minTier the minimal tier this circuit can be offered for free, e.g. normal configuration circuit is + * available 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; @@ -799,41 +743,36 @@ public class GregTech_API { if (GT_Utility.areStacksEqual(tRegistered, aStack)) return; ItemStack stack = GT_Utility.copyAmount(0, aStack); sRealConfigurationList.put(minTier, stack); - sConfigurationLists.entrySet().stream() - .filter(e -> e.getKey() >= minTier) + sConfigurationLists.entrySet().stream().filter(e -> e.getKey() >= minTier) .forEach(e -> e.getValue().add(stack)); } /** - * Get a list of Configuration circuits. These stacks will have a stack size of 0. - * Use {@link #registerConfigurationCircuit(ItemStack, int)} or its overload to add to this list. + * Get a list of Configuration circuits. These stacks will have a stack size of 0. Use + * {@link #registerConfigurationCircuit(ItemStack, int)} or its overload to add to this list. * * @param machineTier The voltage tier where this list will be used. use Integer.MAX_VALUE to get all circuits - * @return An unmodifiable view of actual list. - * DO NOT MODIFY THE ItemStacks! + * @return An unmodifiable view of actual list. 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())) - .stream() - .sorted(getConfigurationCircuitsComparator()) - .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())); } 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); + // 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) { @@ -841,12 +780,12 @@ public class GregTech_API { } public static void registerCircuitProgrammer(Predicate<ItemStack> predicate, boolean useContainer) { - sRealCircuitProgrammerList.put( - predicate, useContainer ? (s, p) -> s.getItem().getContainerItem(s) : (s, p) -> s); + sRealCircuitProgrammerList + .put(predicate, useContainer ? (s, p) -> s.getItem().getContainerItem(s) : (s, p) -> s); } - public static void registerCircuitProgrammer( - Predicate<ItemStack> predicate, BiFunction<ItemStack, EntityPlayerMP, ItemStack> doDamage) { + public static void registerCircuitProgrammer(Predicate<ItemStack> predicate, + BiFunction<ItemStack, EntityPlayerMP, ItemStack> doDamage) { sRealCircuitProgrammerList.put(predicate, doDamage); } @@ -855,10 +794,9 @@ 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 (!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); } @@ -884,8 +822,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)); } @@ -903,6 +841,7 @@ public class GregTech_API { /** * returns a Cover behavior, guaranteed to not return null after preload + * * @return The Cover behavior */ public static GT_CoverBehaviorBase<?> getCoverBehaviorNew(ItemStack aStack) { @@ -932,41 +871,43 @@ public class GregTech_API { } /** - * Register a Wrench to be usable on GregTech Machines. - * The Wrench MUST have some kind of Durability unlike certain Buildcraft Wrenches. + * Register a Wrench to be usable on GregTech Machines. The Wrench MUST have some kind of Durability unlike certain + * Buildcraft Wrenches. * <p/> - * You need to register Tools in the Load Phase, because otherwise the Auto-detection will assign a Tool Type in certain Cases during postload (When IToolWrench or similar Interfaces are implemented). + * You need to register Tools in the Load Phase, because otherwise the Auto-detection will assign a Tool Type in + * certain Cases during postload (When IToolWrench or similar Interfaces are implemented). * <p/> * ----- * <p/> - * Returning true at isDamageable was a great Idea, KingLemming. Well played. - * Since the OmniWrench is just a Single-Item-Mod, people can choose if they want your infinite durability or not. So that's not really a Problem. + * Returning true at isDamageable was a great Idea, KingLemming. Well played. Since the OmniWrench is just a + * Single-Item-Mod, people can choose if they want your infinite durability or not. So that's not really a Problem. * I even have a new Config to auto-disable most infinite BC Wrenches (but that one is turned off). * <p/> - * One last Bug for you to fix: - * My Auto-registration detects Railcraft's Crowbars, Buildcraft's Wrenches and alike, due to their Interfaces. - * Guess what now became a Crowbar by accident. Try registering the Wrench at the load phase to prevent things like that from happening. - * Yes, I know that "You need to register Tools in the Load Phase"-Part wasn't there before this. Sorry about that. + * One last Bug for you to fix: My Auto-registration detects Railcraft's Crowbars, Buildcraft's Wrenches and alike, + * due to their Interfaces. Guess what now became a Crowbar by accident. Try registering the Wrench at the load + * phase to prevent things like that from happening. Yes, I know that "You need to register Tools in the Load + * Phase"-Part wasn't there before this. Sorry about that. */ public static boolean registerWrench(ItemStack aTool) { return registerTool(aTool, sWrenchList); } /** - * Register a Crowbar to extract Covers from Machines - * Crowbars are NOT Wrenches btw. + * Register a Crowbar to extract Covers from Machines Crowbars are NOT Wrenches btw. * <p/> - * You need to register Tools in the Load Phase, because otherwise the Auto-detection will assign a Tool Type in certain Cases during postload (When IToolWrench or similar Interfaces are implemented). + * You need to register Tools in the Load Phase, because otherwise the Auto-detection will assign a Tool Type in + * certain Cases during postload (When IToolWrench or similar Interfaces are implemented). */ public static boolean registerCrowbar(ItemStack aTool) { return registerTool(aTool, sCrowbarList); } /** - * Register a Screwdriver to interact directly with Machines and Covers - * Did I mention, that it is intentionally not possible to make a Multi-tool, which doesn't switch ItemID (like a Mode) all the time? + * Register a Screwdriver to interact directly with Machines and Covers Did I mention, that it is intentionally not + * possible to make a Multi-tool, which doesn't switch ItemID (like a Mode) all the time? * <p/> - * You need to register Tools in the Load Phase, because otherwise the Auto-detection will assign a Tool Type in certain Cases during postload (When IToolWrench or similar Interfaces are implemented). + * You need to register Tools in the Load Phase, because otherwise the Auto-detection will assign a Tool Type in + * certain Cases during postload (When IToolWrench or similar Interfaces are implemented). */ @SuppressWarnings("UnusedReturnValue") // Retains API method signature public static boolean registerScrewdriver(ItemStack aTool) { @@ -976,7 +917,8 @@ public class GregTech_API { /** * Register a Soft Hammer to interact with Machines * <p/> - * You need to register Tools in the Load Phase, because otherwise the Auto-detection will assign a Tool Type in certain Cases during postload (When IToolWrench or similar Interfaces are implemented). + * You need to register Tools in the Load Phase, because otherwise the Auto-detection will assign a Tool Type in + * certain Cases during postload (When IToolWrench or similar Interfaces are implemented). */ public static boolean registerSoftHammer(ItemStack aTool) { return registerTool(aTool, sSoftHammerList); @@ -985,7 +927,8 @@ public class GregTech_API { /** * Register a Hard Hammer to interact with Machines * <p/> - * You need to register Tools in the Load Phase, because otherwise the Auto-detection will assign a Tool Type in certain Cases during postload (When IToolWrench or similar Interfaces are implemented). + * You need to register Tools in the Load Phase, because otherwise the Auto-detection will assign a Tool Type in + * certain Cases during postload (When IToolWrench or similar Interfaces are implemented). */ public static boolean registerHardHammer(ItemStack aTool) { return registerTool(aTool, sHardHammerList); @@ -994,7 +937,8 @@ public class GregTech_API { /** * Register a Wire Cutter to interact with Machines * <p/> - * You need to register Tools in the Load Phase, because otherwise the Auto-detection will assign a Tool Type in certain Cases during postload (When IToolWrench or similar Interfaces are implemented). + * You need to register Tools in the Load Phase, because otherwise the Auto-detection will assign a Tool Type in + * certain Cases during postload (When IToolWrench or similar Interfaces are implemented). */ public static boolean registerWireCutter(ItemStack aTool) { return registerTool(aTool, sWireCutterList); @@ -1003,7 +947,8 @@ public class GregTech_API { /** * Register a Soldering Tool to interact with Machines * <p/> - * You need to register Tools in the Load Phase, because otherwise the Auto-detection will assign a Tool Type in certain Cases during postload (When IToolWrench or similar Interfaces are implemented). + * You need to register Tools in the Load Phase, because otherwise the Auto-detection will assign a Tool Type in + * certain Cases during postload (When IToolWrench or similar Interfaces are implemented). */ @SuppressWarnings("UnusedReturnValue") // Retains API method signature public static boolean registerSolderingTool(ItemStack aTool) { @@ -1013,7 +958,8 @@ public class GregTech_API { /** * Register a Soldering Tin to interact with Soldering Tools * <p/> - * You need to register Tools in the Load Phase, because otherwise the Auto-detection will assign a Tool Type in certain Cases during postload (When IToolWrench or similar Interfaces are implemented). + * You need to register Tools in the Load Phase, because otherwise the Auto-detection will assign a Tool Type in + * certain Cases during postload (When IToolWrench or similar Interfaces are implemented). */ @SuppressWarnings("UnusedReturnValue") // Retains API method signature public static boolean registerSolderingMetal(ItemStack aTool) { @@ -1021,15 +967,14 @@ public class GregTech_API { } /** - * Generic Function to add Tools to the Lists. - * Contains all sanity Checks for Tools, like preventing one Tool from being registered for multiple purposes as controls would override each other. + * Generic Function to add Tools to the Lists. 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; @@ -1037,6 +982,7 @@ public class GregTech_API { /** * Sets the {@link IIconRegister} for Block Icons + * * @param aIconRegister The {@link IIconRegister} Icon Register */ @SideOnly(Side.CLIENT) @@ -1046,6 +992,7 @@ public class GregTech_API { /** * Sets the {@link IIconRegister} for Items Icons + * * @param aIconRegister The {@link IIconRegister} Icon Register */ @SideOnly(Side.CLIENT) @@ -1055,9 +1002,8 @@ public class GregTech_API { public static void registerTileEntityConstructor(int meta, IntFunction<TileEntity> constructor) { if (meta < 0 || meta > 15 || constructor == null) throw new IllegalArgumentException(); - if (teCreators[meta] != null) - throw new IllegalStateException( - "previous constructor: " + teCreators[meta] + " new constructor: " + constructor + " meta:" + meta); + if (teCreators[meta] != null) throw new IllegalStateException( + "previous constructor: " + teCreators[meta] + " new constructor: " + constructor + " meta:" + meta); teCreators[meta] = constructor; } diff --git a/src/main/java/gregtech/api/damagesources/GT_DamageSources.java b/src/main/java/gregtech/api/damagesources/GT_DamageSources.java index a012f030c5..fca4d7fe9f 100644 --- a/src/main/java/gregtech/api/damagesources/GT_DamageSources.java +++ b/src/main/java/gregtech/api/damagesources/GT_DamageSources.java @@ -1,11 +1,13 @@ package gregtech.api.damagesources; import javax.annotation.Nullable; + import net.minecraft.entity.EntityLivingBase; import net.minecraft.item.ItemStack; import net.minecraft.util.*; public class GT_DamageSources { + public static DamageSource getElectricDamage() { return ic2.api.info.Info.DMG_ELECTRIC; } @@ -35,6 +37,7 @@ public class GT_DamageSources { } private static class DamageSourceCombat extends EntityDamageSource { + private final IChatComponent mDeathMessage; public DamageSourceCombat(String aType, EntityLivingBase aPlayer, IChatComponent aDeathMessage) { @@ -49,6 +52,7 @@ public class GT_DamageSources { } private static class DamageSourceFrost extends DamageSource { + public DamageSourceFrost() { super("frost"); setDifficultyScaled(); @@ -62,6 +66,7 @@ public class GT_DamageSources { } private static class DamageSourceHeat extends DamageSource { + public DamageSourceHeat() { super("steam"); setDifficultyScaled(); @@ -69,12 +74,15 @@ 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"); } } public static class DamageSourceHotItem extends DamageSourceHeat { + @Nullable private final ItemStack stack; @@ -89,6 +97,7 @@ public class GT_DamageSources { } public static class DamageSourceExploding extends DamageSource { + public DamageSourceExploding() { super("exploded"); setDamageAllowedInCreativeMode(); diff --git a/src/main/java/gregtech/api/enchants/Enchantment_EnderDamage.java b/src/main/java/gregtech/api/enchants/Enchantment_EnderDamage.java index a31b802219..52fd3b1134 100644 --- a/src/main/java/gregtech/api/enchants/Enchantment_EnderDamage.java +++ b/src/main/java/gregtech/api/enchants/Enchantment_EnderDamage.java @@ -1,9 +1,5 @@ package gregtech.api.enchants; -import gregtech.api.enums.ConfigCategories; -import gregtech.api.enums.Materials; -import gregtech.api.util.GT_Config; -import gregtech.api.util.GT_LanguageManager; import net.minecraft.enchantment.EnchantmentDamage; import net.minecraft.entity.Entity; import net.minecraft.entity.EntityLivingBase; @@ -12,7 +8,13 @@ import net.minecraft.entity.monster.EntityEnderman; import net.minecraft.potion.Potion; import net.minecraft.potion.PotionEffect; +import gregtech.api.enums.ConfigCategories; +import gregtech.api.enums.Materials; +import gregtech.api.util.GT_Config; +import gregtech.api.util.GT_LanguageManager; + public class Enchantment_EnderDamage extends EnchantmentDamage { + public static Enchantment_EnderDamage INSTANCE; public Enchantment_EnderDamage() { @@ -43,20 +45,15 @@ 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/enchants/Enchantment_Hazmat.java b/src/main/java/gregtech/api/enchants/Enchantment_Hazmat.java index 136b5c61a6..ecbe654698 100644 --- a/src/main/java/gregtech/api/enchants/Enchantment_Hazmat.java +++ b/src/main/java/gregtech/api/enchants/Enchantment_Hazmat.java @@ -1,14 +1,16 @@ package gregtech.api.enchants; -import gregtech.api.enums.ConfigCategories; -import gregtech.api.util.GT_Config; -import gregtech.api.util.GT_LanguageManager; import net.minecraft.enchantment.Enchantment; import net.minecraft.enchantment.EnumEnchantmentType; import net.minecraft.item.ItemArmor; import net.minecraft.item.ItemStack; +import gregtech.api.enums.ConfigCategories; +import gregtech.api.util.GT_Config; +import gregtech.api.util.GT_LanguageManager; + public class Enchantment_Hazmat extends Enchantment { + public static Enchantment_Hazmat INSTANCE; public Enchantment_Hazmat() { diff --git a/src/main/java/gregtech/api/enchants/Enchantment_Radioactivity.java b/src/main/java/gregtech/api/enchants/Enchantment_Radioactivity.java index f6088caab3..34035c9457 100644 --- a/src/main/java/gregtech/api/enchants/Enchantment_Radioactivity.java +++ b/src/main/java/gregtech/api/enchants/Enchantment_Radioactivity.java @@ -1,16 +1,18 @@ package gregtech.api.enchants; +import net.minecraft.enchantment.EnchantmentDamage; +import net.minecraft.entity.Entity; +import net.minecraft.entity.EntityLivingBase; +import net.minecraft.item.ItemStack; + import gregtech.api.enums.ConfigCategories; import gregtech.api.enums.Materials; import gregtech.api.util.GT_Config; import gregtech.api.util.GT_LanguageManager; import gregtech.api.util.GT_Utility; -import net.minecraft.enchantment.EnchantmentDamage; -import net.minecraft.entity.Entity; -import net.minecraft.entity.EntityLivingBase; -import net.minecraft.item.ItemStack; public class Enchantment_Radioactivity extends EnchantmentDamage { + public static Enchantment_Radioactivity INSTANCE; public Enchantment_Radioactivity() { diff --git a/src/main/java/gregtech/api/enums/ConfigCategories.java b/src/main/java/gregtech/api/enums/ConfigCategories.java index ae4b425e5e..e4a647db22 100644 --- a/src/main/java/gregtech/api/enums/ConfigCategories.java +++ b/src/main/java/gregtech/api/enums/ConfigCategories.java @@ -1,6 +1,7 @@ package gregtech.api.enums; public enum ConfigCategories { + news, general, machineconfig, @@ -15,8 +16,7 @@ public enum ConfigCategories { heatdamage, oreprocessingoutputmultiplier, blastfurnacerequirements, - blastinductionsmelter, - ; + blastinductionsmelter,; } public enum Recipes { diff --git a/src/main/java/gregtech/api/enums/Dyes.java b/src/main/java/gregtech/api/enums/Dyes.java index 2a546e6138..a0b9f87593 100644 --- a/src/main/java/gregtech/api/enums/Dyes.java +++ b/src/main/java/gregtech/api/enums/Dyes.java @@ -1,13 +1,16 @@ 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 gregtech.api.interfaces.IColorModulationContainer; +import gregtech.api.objects.GT_ArrayList; +import gregtech.api.util.GT_Utility; + public enum Dyes implements IColorModulationContainer { + /** * The valid Colors, see VALUES Array below */ @@ -38,24 +41,8 @@ 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; @@ -66,7 +53,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 450a85d3d6..c66b9630a3 100644 --- a/src/main/java/gregtech/api/enums/Element.java +++ b/src/main/java/gregtech/api/enums/Element.java @@ -8,6 +8,7 @@ import java.util.Map; * This is some kind of Periodic Table, which I use to determine Properties of the Materials. */ public enum Element { + _NULL(0, 0, 0, -1, null, "", false), H(1, 0, 0, -1, null, "Hydrogen", false), D(1, 1, 0, -1, "H", "Deuterium", true), @@ -288,18 +289,13 @@ public enum Element { /** * @param aProtons Amount of Protons. Antiprotons if negative. - * @param aNeutrons Amount of Neutrons. Antineutrons if negative. (I could have made mistakes with the Neutron amount calculation, please tell me if I did something wrong) + * @param aNeutrons Amount of Neutrons. Antineutrons if negative. (I could have made mistakes with the + * Neutron amount calculation, please tell me if I did something wrong) * @param aHalfLifeSeconds Amount of Half Life this Material has in Seconds. -1 for stable Materials. * @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, + Element(long aProtons, long aNeutrons, long aAdditionalMass, long aHalfLifeSeconds, String aDecayTo, String aName, boolean aIsIsotope) { mProtons = aProtons; mNeutrons = aNeutrons; @@ -331,6 +327,7 @@ public enum Element { * A companion object to workaround java limitations */ private static final class Companion { + /** * Why is this a separate map and populated by enum constructor instead of a Map prepoluated with values()? * Because apparently there are people hacking into this enum via EnumHelper. diff --git a/src/main/java/gregtech/api/enums/FluidState.java b/src/main/java/gregtech/api/enums/FluidState.java index a6e81ab43d..e84657cc6a 100644 --- a/src/main/java/gregtech/api/enums/FluidState.java +++ b/src/main/java/gregtech/api/enums/FluidState.java @@ -1,17 +1,17 @@ package gregtech.api.enums; public enum FluidState { + GAS, LIQUID, MOLTEN, PLASMA, SLURRY; - public static final FluidState[] VALID_STATES = new FluidState[] {SLURRY, LIQUID, GAS, PLASMA, MOLTEN}; + public static final FluidState[] VALID_STATES = new FluidState[] { SLURRY, LIQUID, GAS, PLASMA, MOLTEN }; public static FluidState fromValue(int stateValue) { - return stateValue >= 0 && stateValue < FluidState.VALID_STATES.length - ? FluidState.VALID_STATES[stateValue] + return stateValue >= 0 && stateValue < FluidState.VALID_STATES.length ? FluidState.VALID_STATES[stateValue] : FluidState.LIQUID; } } diff --git a/src/main/java/gregtech/api/enums/GT_HatchElement.java b/src/main/java/gregtech/api/enums/GT_HatchElement.java index 68702f5eb5..8d8603a10e 100644 --- a/src/main/java/gregtech/api/enums/GT_HatchElement.java +++ b/src/main/java/gregtech/api/enums/GT_HatchElement.java @@ -1,5 +1,9 @@ package gregtech.api.enums; +import java.util.Arrays; +import java.util.Collections; +import java.util.List; + import gregtech.api.interfaces.IHatchElement; import gregtech.api.interfaces.metatileentity.IMetaTileEntity; import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch_Dynamo; @@ -13,61 +17,68 @@ 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; public enum GT_HatchElement implements IHatchElement<GT_MetaTileEntity_MultiBlockBase> { + Muffler(GT_MetaTileEntity_MultiBlockBase::addMufflerToMachineList, GT_MetaTileEntity_Hatch_Muffler.class) { + @Override public long count(GT_MetaTileEntity_MultiBlockBase t) { 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(); } }, InputHatch(GT_MetaTileEntity_MultiBlockBase::addInputHatchToMachineList, GT_MetaTileEntity_Hatch_Input.class) { + @Override public long count(GT_MetaTileEntity_MultiBlockBase t) { return t.mInputHatches.size(); } }, InputBus(GT_MetaTileEntity_MultiBlockBase::addInputBusToMachineList, GT_MetaTileEntity_Hatch_InputBus.class) { + @Override public long count(GT_MetaTileEntity_MultiBlockBase t) { return t.mInputBusses.size(); } }, OutputHatch(GT_MetaTileEntity_MultiBlockBase::addOutputHatchToMachineList, GT_MetaTileEntity_Hatch_Output.class) { + @Override public long count(GT_MetaTileEntity_MultiBlockBase t) { return t.mOutputHatches.size(); } }, OutputBus(GT_MetaTileEntity_MultiBlockBase::addOutputBusToMachineList, GT_MetaTileEntity_Hatch_OutputBus.class) { + @Override public long count(GT_MetaTileEntity_MultiBlockBase t) { return t.mOutputBusses.size(); } }, Energy(GT_MetaTileEntity_MultiBlockBase::addEnergyInputToMachineList, GT_MetaTileEntity_Hatch_Energy.class) { + @Override public long count(GT_MetaTileEntity_MultiBlockBase t) { return t.mEnergyHatches.size(); } }, Dynamo(GT_MetaTileEntity_MultiBlockBase::addDynamoToMachineList, GT_MetaTileEntity_Hatch_Dynamo.class) { + @Override public long count(GT_MetaTileEntity_MultiBlockBase t) { return t.mDynamoHatches.size(); } }, ExoticEnergy(GT_MetaTileEntity_MultiBlockBase::addExoticEnergyInputToMachineList) { + @Override public List<? extends Class<? extends IMetaTileEntity>> mteClasses() { return GT_ExoticEnergyInputHelper.getAllClasses(); @@ -77,14 +88,14 @@ public enum GT_HatchElement implements IHatchElement<GT_MetaTileEntity_MultiBloc public long count(GT_MetaTileEntity_MultiBlockBase t) { return t.getExoticEnergyHatches().size(); } - }, - ; + },; + private final List<Class<? extends IMetaTileEntity>> mteClasses; 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 8cadd17246..ef921a0339 100644 --- a/src/main/java/gregtech/api/enums/GT_Values.java +++ b/src/main/java/gregtech/api/enums/GT_Values.java @@ -1,12 +1,8 @@ package gregtech.api.enums; -import gregtech.api.fluid.FluidTankGT; -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.math.BigInteger; import java.util.*; + import net.minecraft.item.ItemStack; import net.minecraft.util.EnumChatFormatting; import net.minecraft.world.World; @@ -15,12 +11,20 @@ import net.minecraftforge.fluids.FluidTankInfo; import net.minecraftforge.fluids.IFluidTank; import net.minecraftforge.oredict.OreDictionary; +import gregtech.api.fluid.FluidTankGT; +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; + /** * Made for static imports, this Class is just a Helper. * <p/> - * I am doing this to have a better Table alike view on my Code, so I can change things faster using the Block Selection Mode of eclipse. + * I am doing this to have a better Table alike view on my Code, so I can change things faster using the Block Selection + * Mode of eclipse. * <p/> - * Go to "Window > Preferences > Java > Editor > Content Assist > Favorites" to set static importable Constant Classes such as this one as AutoCompleteable. + * Go to "Window > Preferences > Java > Editor > Content Assist > Favorites" to set static importable Constant Classes + * such as this one as AutoCompleteable. */ @SuppressWarnings("unused") // API Legitimately has unused fields and methods public class GT_Values { @@ -39,31 +43,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" * <p/> - * This is worth exactly one normal Item. - * This Constant can be divided by many commonly used Numbers such as - * 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 12, 14, 15, 16, 18, 20, 21, 24, ... 64 or 81 - * without losing precision and is for that reason used as Unit of Amount. - * But it is also small enough to be multiplied with larger Numbers. + * This is worth exactly one normal Item. This Constant can be divided by many commonly used Numbers such as 1, 2, + * 3, 4, 5, 6, 7, 8, 9, 10, 12, 14, 15, 16, 18, 20, 21, 24, ... 64 or 81 without losing precision and is for that + * reason used as Unit of Amount. But it is also small enough to be multiplied with larger Numbers. * <p/> - * This is used to determine the amount of Material contained inside a prefixed Ore. - * For example Nugget = M / 9 as it contains out of 1/9 of an Ingot. + * This is used to determine the amount of Material contained inside a prefixed Ore. For example Nugget = M / 9 as + * it contains out of 1/9 of an Ingot. */ public static final long M = 3628800; @@ -82,26 +74,18 @@ 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 - }; + 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 }; /** - * The Voltage Practical. These are recipe voltage you should use if you expect the recipe to use a full amp of - * that tier. These leave a bit of headroom for cable and transformer losses, but not enough to make it a great gain. + * The Voltage Practical. These are recipe voltage you should use if you expect the recipe to use a full amp of that + * tier. These leave a bit of headroom for cable and transformer losses, but not enough to make it a great gain. */ // this will correctly map ULV to 7. - public static final long[] VP = Arrays.stream(V) - .map(i -> BigInteger.valueOf(i) - .multiply(BigInteger.valueOf(30)) - .divide(BigInteger.valueOf(32)) - .longValueExact()) + public static final long[] VP = Arrays.stream(V).map( + i -> BigInteger.valueOf(i).multiply(BigInteger.valueOf(30)).divide(BigInteger.valueOf(32)).longValueExact()) .toArray(); // Why -7? Mystery of the universe. Something may break if you change this so please do not without extensive // testing. @@ -109,7 +93,7 @@ public class GT_Values { // 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: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 @@ -118,140 +102,110 @@ public class GT_Values { /** * 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 - }; + * <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 }; /** * 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 }; /** - * This way it is possible to have a Call Hierarchy of NullPointers in ItemStack based Functions, and also because most of the time I don't know what kind of Data Type the "null" stands for + * This way it is possible to have a Call Hierarchy of NullPointers in ItemStack based Functions, and also because + * most of the time I don't know what kind of Data Type the "null" stands for */ public static final ItemStack NI = null; /** - * This way it is possible to have a Call Hierarchy of NullPointers in FluidStack based Functions, and also because most of the time I don't know what kind of Data Type the "null" stands for + * This way it is possible to have a Call Hierarchy of NullPointers in FluidStack based Functions, and also because + * most of the time I don't know what kind of Data Type the "null" stands for */ public static final FluidStack NF = null; /** * MOD ID Strings, since they are very common Parameters. */ - public static final String MOD_ID = "gregtech", - MOD_ID_IC2 = "IC2", - MOD_ID_NC = "IC2NuclearControl", - MOD_ID_TC = "Thaumcraft", - MOD_ID_TF = "TwilightForest", - MOD_ID_RC = "Railcraft", - MOD_ID_TE = "ThermalExpansion", - MOD_ID_AE = "appliedenergistics2", - MOD_ID_TFC = "terrafirmacraft", - MOD_ID_PFAA = "PFAAGeologica", - MOD_ID_FR = "Forestry", - MOD_ID_HaC = "harvestcraft", - MOD_ID_APC = "AppleCore", - MOD_ID_MaCr = "magicalcrops", - MOD_ID_GaEn = "ganysend", - MOD_ID_GaSu = "ganyssurface", - MOD_ID_GaNe = "ganysnether", - MOD_ID_BC_SILICON = "BuildCraft|Silicon", - MOD_ID_BC_TRANSPORT = "BuildCraft|Transport", - MOD_ID_BC_FACTORY = "BuildCraft|Factory", - MOD_ID_BC_ENERGY = "BuildCraft|Energy", - MOD_ID_BC_BUILDERS = "BuildCraft|Builders", - MOD_ID_BC_CORE = "BuildCraft|Core", - MOD_ID_GC_CORE = "GalacticraftCore", - MOD_ID_GC_MARS = "GalacticraftMars", - MOD_ID_GC_PLANETS = "GalacticraftPlanets", - MOD_ID_DC = "dreamcraft", + public static final String MOD_ID = "gregtech", MOD_ID_IC2 = "IC2", MOD_ID_NC = "IC2NuclearControl", + MOD_ID_TC = "Thaumcraft", MOD_ID_TF = "TwilightForest", MOD_ID_RC = "Railcraft", + MOD_ID_TE = "ThermalExpansion", MOD_ID_AE = "appliedenergistics2", MOD_ID_TFC = "terrafirmacraft", + MOD_ID_PFAA = "PFAAGeologica", MOD_ID_FR = "Forestry", MOD_ID_HaC = "harvestcraft", + MOD_ID_APC = "AppleCore", MOD_ID_MaCr = "magicalcrops", MOD_ID_GaEn = "ganysend", + MOD_ID_GaSu = "ganyssurface", MOD_ID_GaNe = "ganysnether", MOD_ID_BC_SILICON = "BuildCraft|Silicon", + MOD_ID_BC_TRANSPORT = "BuildCraft|Transport", MOD_ID_BC_FACTORY = "BuildCraft|Factory", + MOD_ID_BC_ENERGY = "BuildCraft|Energy", MOD_ID_BC_BUILDERS = "BuildCraft|Builders", + MOD_ID_BC_CORE = "BuildCraft|Core", MOD_ID_GC_CORE = "GalacticraftCore", + MOD_ID_GC_MARS = "GalacticraftMars", MOD_ID_GC_PLANETS = "GalacticraftPlanets", MOD_ID_DC = "dreamcraft", MOD_ID_GTPP = "miscutils"; /** * File Paths and Resource Paths */ - 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/", - TEX_DIR_ENTITY = TEX_DIR + "entity/", - TEX_DIR_ASPECTS = TEX_DIR + "aspects/", - RES_PATH = MOD_ID + ":" + TEX_DIR, - RES_PATH_GUI = MOD_ID + ":" + TEX_DIR_GUI, - RES_PATH_ITEM = MOD_ID + ":", - RES_PATH_BLOCK = MOD_ID + ":", - RES_PATH_ENTITY = MOD_ID + ":" + TEX_DIR_ENTITY, - RES_PATH_ASPECTS = MOD_ID + ":" + TEX_DIR_ASPECTS, + 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/", TEX_DIR_ENTITY = TEX_DIR + "entity/", + TEX_DIR_ASPECTS = TEX_DIR + "aspects/", RES_PATH = MOD_ID + ":" + TEX_DIR, + RES_PATH_GUI = MOD_ID + ":" + TEX_DIR_GUI, RES_PATH_ITEM = MOD_ID + ":", RES_PATH_BLOCK = MOD_ID + ":", + RES_PATH_ENTITY = MOD_ID + ":" + TEX_DIR_ENTITY, RES_PATH_ASPECTS = MOD_ID + ":" + TEX_DIR_ASPECTS, RES_PATH_IC2 = MOD_ID_IC2.toLowerCase(Locale.ENGLISH) + ":", RES_PATH_MODEL = MOD_ID + ":" + TEX_DIR + "models/"; @@ -259,6 +213,7 @@ public class GT_Values { * NBT String Keys */ public static final class NBT { + public static final String COLOR = "gt.color", // Integer COVERS = "gt.covers", // String CUSTOM_NAME = "name", // String @@ -287,10 +242,7 @@ public class GT_Values { INV_OUTPUT_LIST = "gt.invlist.out", // NBT List // MultiBlock - STRUCTURE_OK = "gt.structure.ok", - ROTATION = "gt.eRotation", - FLIP = "gt.eFlip", - TARGET = "gt.target", // Boolean + 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 @@ -300,66 +252,53 @@ public class GT_Values { } /** The Color White as RGB Short Array. */ - public static final short[] UNCOLORED_RBGA = {255, 255, 255, 255}; + public static final short[] UNCOLORED_RBGA = { 255, 255, 255, 255 }; /** The Color White as simple Integer (0x00ffffff). */ public static final int UNCOLORED = 0x00ffffff; /** * 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}; + 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. + * 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. + * 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. + * [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} - }; + 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 } }; /** * The Mod Object itself. That is the GT_Mod-Object. It's needed to open GUI's and similar. @@ -378,13 +317,15 @@ public class GT_Values { */ public static int oreveinPercentage; /** - * Control number of attempts to find a valid orevein. Generally this maximum limit isn't hit, selecting a vein is cheap + * Control number of attempts to find a valid orevein. Generally this maximum limit isn't hit, selecting a vein is + * cheap */ public static int oreveinAttempts; /** * Control number of attempts to place a valid ore vein. - * <p>If a vein wasn't placed due to height restrictions, - * completely in the water, etc, another attempt is tried.</p> + * <p> + * If a vein wasn't placed due to height restrictions, completely in the water, etc, another attempt is tried. + * </p> */ public static int oreveinMaxPlacementAttempts; /** @@ -396,7 +337,8 @@ public class GT_Values { */ public static int oreveinPlacerOresMultiplier; /** - * Not really Constants, but they set using the Config and therefore should be constant (those are for the Debug Mode) + * Not really Constants, but they set using the Config and therefore should be constant (those are for the Debug + * Mode) */ public static boolean D1 = false, D2 = false; /** @@ -440,7 +382,8 @@ public class GT_Values { */ public static boolean debugWorldData = false; /** - * Number of ticks between sending sound packets to clients for electric machines. Default is 1.5 seconds. Trying to mitigate lag and FPS drops. + * Number of ticks between sending sound packets to clients for electric machines. Default is 1.5 seconds. Trying to + * mitigate lag and FPS drops. */ public static int ticksBetweenSounds = 30; /** @@ -473,7 +416,7 @@ public class GT_Values { public static boolean updateFluidDisplayItems = true; public static final int STEAM_PER_WATER = 160; /** - * If true, then digital chest with AE2 storage bus will be accessible only through AE2 + * If true, then digital chest with AE2 storage bus will be accessible only through AE2 */ public static boolean disableDigitalChestsExternalAccess = false; @@ -490,29 +433,66 @@ public class GT_Values { public static final IIconContainer[] emptyIconContainerArray = new IIconContainer[3]; /** - * Pretty formatting for author names. + * Pretty formatting for author names. */ public static final String Colen = "" + EnumChatFormatting.DARK_RED - + EnumChatFormatting.BOLD + EnumChatFormatting.ITALIC + EnumChatFormatting.UNDERLINE + "C" + + EnumChatFormatting.BOLD + + EnumChatFormatting.ITALIC + + EnumChatFormatting.UNDERLINE + + "C" + EnumChatFormatting.GOLD - + EnumChatFormatting.BOLD + EnumChatFormatting.ITALIC + EnumChatFormatting.UNDERLINE + "o" + + EnumChatFormatting.BOLD + + EnumChatFormatting.ITALIC + + EnumChatFormatting.UNDERLINE + + "o" + EnumChatFormatting.GREEN - + EnumChatFormatting.BOLD + EnumChatFormatting.ITALIC + EnumChatFormatting.UNDERLINE + "l" + + EnumChatFormatting.BOLD + + EnumChatFormatting.ITALIC + + EnumChatFormatting.UNDERLINE + + "l" + EnumChatFormatting.DARK_AQUA - + EnumChatFormatting.BOLD + EnumChatFormatting.ITALIC + EnumChatFormatting.UNDERLINE + "e" + + EnumChatFormatting.BOLD + + EnumChatFormatting.ITALIC + + EnumChatFormatting.UNDERLINE + + "e" + EnumChatFormatting.DARK_PURPLE - + EnumChatFormatting.BOLD + EnumChatFormatting.ITALIC + EnumChatFormatting.UNDERLINE + "n"; + + EnumChatFormatting.BOLD + + EnumChatFormatting.ITALIC + + EnumChatFormatting.UNDERLINE + + "n"; public static final String AuthorColen = "Author: " + Colen; - public static final String AuthorKuba = "Author: " + EnumChatFormatting.DARK_RED + EnumChatFormatting.BOLD + "k" - + EnumChatFormatting.RED + EnumChatFormatting.BOLD + "u" - + EnumChatFormatting.GOLD + EnumChatFormatting.BOLD + "b" + EnumChatFormatting.YELLOW - + EnumChatFormatting.BOLD + "a" + EnumChatFormatting.DARK_GREEN + EnumChatFormatting.BOLD + "6" - + EnumChatFormatting.GREEN + EnumChatFormatting.BOLD + "0" + EnumChatFormatting.AQUA - + EnumChatFormatting.BOLD + "0" + EnumChatFormatting.DARK_AQUA + EnumChatFormatting.BOLD + "0"; - - public static final String AuthorBlueWeabo = "Author: " + EnumChatFormatting.BLUE + EnumChatFormatting.BOLD + "Blue" - + EnumChatFormatting.AQUA + EnumChatFormatting.BOLD + "Weabo"; + public static final String AuthorKuba = "Author: " + EnumChatFormatting.DARK_RED + + EnumChatFormatting.BOLD + + "k" + + EnumChatFormatting.RED + + EnumChatFormatting.BOLD + + "u" + + EnumChatFormatting.GOLD + + EnumChatFormatting.BOLD + + "b" + + EnumChatFormatting.YELLOW + + EnumChatFormatting.BOLD + + "a" + + EnumChatFormatting.DARK_GREEN + + EnumChatFormatting.BOLD + + "6" + + EnumChatFormatting.GREEN + + EnumChatFormatting.BOLD + + "0" + + EnumChatFormatting.AQUA + + EnumChatFormatting.BOLD + + "0" + + EnumChatFormatting.DARK_AQUA + + EnumChatFormatting.BOLD + + "0"; + + public static final String AuthorBlueWeabo = "Author: " + EnumChatFormatting.BLUE + + EnumChatFormatting.BOLD + + "Blue" + + EnumChatFormatting.AQUA + + EnumChatFormatting.BOLD + + "Weabo"; // 7.5F comes from GT_Tool_Turbine_Large#getBaseDamage() given huge turbines are the most efficient now. public static double getMaxPlasmaTurbineEfficiencyFromMaterial(Materials material) { diff --git a/src/main/java/gregtech/api/enums/HeatingCoilLevel.java b/src/main/java/gregtech/api/enums/HeatingCoilLevel.java index 62a4663bb4..f80f8139c6 100644 --- a/src/main/java/gregtech/api/enums/HeatingCoilLevel.java +++ b/src/main/java/gregtech/api/enums/HeatingCoilLevel.java @@ -3,22 +3,23 @@ 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, // TPVALLOY 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, // TPVALLOY 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(); diff --git a/src/main/java/gregtech/api/enums/ItemList.java b/src/main/java/gregtech/api/enums/ItemList.java index 4453d16653..e260b03936 100644 --- a/src/main/java/gregtech/api/enums/ItemList.java +++ b/src/main/java/gregtech/api/enums/ItemList.java @@ -3,22 +3,25 @@ package gregtech.api.enums; import static gregtech.api.enums.GT_Values.NI; import static gregtech.api.enums.GT_Values.W; +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 gregtech.api.interfaces.IItemContainer; import gregtech.api.util.GT_LanguageManager; 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.Locale; -import net.minecraft.block.Block; -import net.minecraft.item.Item; -import net.minecraft.item.ItemStack; -import net.minecraftforge.fluids.Fluid; /** * Class containing all non-OreDict Items of GregTech. */ public enum ItemList implements IItemContainer { + Display_ITS_FREE, Display_Fluid, TE_Slag, @@ -2010,167 +2013,40 @@ public enum ItemList implements IItemContainer { ReinforcedPhotolithographicFrameworkCasing, RadiationProofPhotolithographicFrameworkCasing, InfinityCooledCasing; - 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 - }; - public static Fluid sOilExtraHeavy, - sEpichlorhydrin, - sDrillingFluid, - sBlueVitriol, - sNickelSulfate, - sGreenVitriol, - sToluene, - sNitrationMixture, - sRocketFuel, - sHydricSulfur, - sIndiumConcentrate, - sLeadZincSolution, + + 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 }; + public static Fluid sOilExtraHeavy, sEpichlorhydrin, sDrillingFluid, sBlueVitriol, sNickelSulfate, sGreenVitriol, + sToluene, sNitrationMixture, sRocketFuel, sHydricSulfur, sIndiumConcentrate, sLeadZincSolution, sHydrochloricAcid; private ItemStack mStack; private boolean mHasNotBeenSet; @@ -2275,10 +2151,8 @@ public enum ItemList implements IItemContainer { StringBuilder tCamelCasedDisplayNameBuilder = new StringBuilder(); final String[] tDisplayNameWords = aDisplayName.split("\\W"); for (String tWord : tDisplayNameWords) { - if (tWord.length() > 0) - tCamelCasedDisplayNameBuilder.append(tWord.substring(0, 1).toUpperCase(Locale.US)); - if (tWord.length() > 1) - tCamelCasedDisplayNameBuilder.append(tWord.substring(1).toLowerCase(Locale.US)); + if (tWord.length() > 0) tCamelCasedDisplayNameBuilder.append(tWord.substring(0, 1).toUpperCase(Locale.US)); + if (tWord.length() > 1) tCamelCasedDisplayNameBuilder.append(tWord.substring(1).toLowerCase(Locale.US)); } if (tCamelCasedDisplayNameBuilder.length() == 0) { // CamelCased DisplayName is empty, so use hash of aDisplayName @@ -2322,9 +2196,8 @@ public enum ItemList implements IItemContainer { } /** - * Returns the internal stack. - * This method is unsafe. It's here only for quick operations. - * DON'T CHANGE THE RETURNED VALUE! + * Returns the internal stack. This method is unsafe. It's here only for quick operations. DON'T CHANGE THE RETURNED + * VALUE! */ public ItemStack getInternalStack_unsafe() { return mStack; diff --git a/src/main/java/gregtech/api/enums/MaterialBuilder.java b/src/main/java/gregtech/api/enums/MaterialBuilder.java index 5514b9382e..d265faae8e 100644 --- a/src/main/java/gregtech/api/enums/MaterialBuilder.java +++ b/src/main/java/gregtech/api/enums/MaterialBuilder.java @@ -1,11 +1,13 @@ package gregtech.api.enums; -import gregtech.api.objects.MaterialStack; import java.util.ArrayList; import java.util.Arrays; import java.util.List; +import gregtech.api.objects.MaterialStack; + public class MaterialBuilder { + public static final int DIESEL = 0, GAS = 1, THERMAL = 2, SEMIFLUID = 3, PLASMA = 4, MAGIC = 5; private int metaItemSubID; @@ -46,34 +48,32 @@ public class MaterialBuilder { 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); + 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) { diff --git a/src/main/java/gregtech/api/enums/Materials.java b/src/main/java/gregtech/api/enums/Materials.java index fd30bfd231..86e4e3f1ca 100644 --- a/src/main/java/gregtech/api/enums/Materials.java +++ b/src/main/java/gregtech/api/enums/Materials.java @@ -4,6 +4,15 @@ import static gregtech.api.enums.FluidState.GAS; import static gregtech.api.enums.GT_Values.M; import static gregtech.api.enums.GT_Values.MOD_ID_DC; +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 cpw.mods.fml.common.Loader; import gregtech.GT_Mod; import gregtech.api.GregTech_API; @@ -20,13 +29,6 @@ import gregtech.common.render.items.*; import gregtech.common.render.items.UniversiumRenderer; 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; @SuppressWarnings("unused") // API Legitimately has unused Members and Methods public class Materials implements IColorModulationContainer, ISubTagContainer { @@ -38,12 +40,14 @@ public class Materials implements IColorModulationContainer, ISubTagContainer { public static volatile int VERSION = 509; /** - * This is for keeping compatibility with addons mods (Such as TinkersGregworks etc.) that looped over the old materials enum + * This is for keeping compatibility with addons mods (Such as TinkersGregworks etc.) that looped over the old + * materials enum */ @Deprecated public static Collection<Materials> VALUES = new LinkedHashSet<>(); /** - * 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. + * 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. */ // Spotless breaks the table below into many, many lines @@ -927,14 +931,18 @@ public class Materials implements IColorModulationContainer, ISubTagContainer { /** * Superconductor re-routed for mod compatibility. Circuits are re-routed into SuperconductorUHV as well. - * <p>Internal name is now Superconductor while translated name is SuperconductorUHV.</p> + * <p> + * Internal name is now Superconductor while translated name is SuperconductorUHV. + * </p> + * * @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 + 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 @@ -962,7 +970,7 @@ 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<>(); @@ -971,16 +979,9 @@ public class Materials implements IColorModulationContainer, ISubTagContainer { public ArrayList<ItemStack> mMaterialItems = new ArrayList<>(); public Collection<SubTag> mSubTags = new LinkedHashSet<>(); public Enchantment mEnchantmentTools = null, mEnchantmentArmors = null; - public boolean mUnificatable, - mBlastFurnaceRequired = false, - mAutoGenerateBlastFurnaceRecipes = true, - mAutoGenerateVacuumFreezerRecipes = true, - mAutoGenerateRecycleRecipes = true, - mTransparent = false, - mHasParentMod = true, - mHasPlasma = false, - mHasGas = false, - mCustomOre = false; + public boolean mUnificatable, mBlastFurnaceRequired = false, mAutoGenerateBlastFurnaceRecipes = true, + mAutoGenerateVacuumFreezerRecipes = true, mAutoGenerateRecycleRecipes = true, mTransparent = false, + mHasParentMod = true, mHasPlasma = false, mHasGas = false, mCustomOre = false; public byte mEnchantmentToolsLevel = 0, mEnchantmentArmorsLevel = 0, mToolQuality = 0; public short mBlastFurnaceTemp = 0; public int mMeltingPoint = 0; @@ -1009,44 +1010,26 @@ public class Materials implements IColorModulationContainer, ISubTagContainer { public int processingMaterialTierEU = 0; public long mDensity = M; - public float mToolSpeed = 1.0F, - mHeatDamage = 0.0F, - mSteamMultiplier = 1.0F, - mGasMultiplier = 1.0F, + public float mToolSpeed = 1.0F, mHeatDamage = 0.0F, mSteamMultiplier = 1.0F, mGasMultiplier = 1.0F, mPlasmaMultiplier = 1.0F; - public String mChemicalFormula = "?", - mName, - mDefaultLocalName, - mCustomID = "null", - mConfigSection = "null", + public String mChemicalFormula = "?", mName, mDefaultLocalName, mCustomID = "null", mConfigSection = "null", mLocalizedName = "null"; public Dyes mColor = Dyes._NULL; public Element mElement = null; - public Materials mDirectSmelting = this, - mOreReplacement = this, - mMacerateInto = this, - mSmeltInto = this, - mArcSmeltInto = this, - mHandleMaterial = this, - mMaterialInto; + 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; /** - * 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. + * 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) { + public Materials(int aMetaItemSubID, TextureSet aIconSet, float aToolSpeed, int aDurability, int aToolQuality, + boolean aUnificatable, String aName, String aDefaultLocalName) { this( aMetaItemSubID, aIconSet, @@ -1061,17 +1044,8 @@ public class Materials implements IColorModulationContainer, ISubTagContainer { "null"); } - public Materials( - int aMetaItemSubID, - TextureSet aIconSet, - float aToolSpeed, - int aDurability, - int aToolQuality, - boolean aUnificatable, - String aName, - String aDefaultLocalName, - String aConfigSection, - boolean aCustomOre, + 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; @@ -1099,29 +1073,10 @@ public class Materials implements IColorModulationContainer, ISubTagContainer { 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) { + 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, @@ -1150,29 +1105,10 @@ public class Materials implements IColorModulationContainer, ISubTagContainer { "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, + 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, @@ -1204,52 +1140,29 @@ public class Materials implements IColorModulationContainer, ISubTagContainer { /** * @param aMetaItemSubID the Sub-ID used in my own MetaItems. Range 0-1000. -1 for no Material - * @param aTypes which kind of Items should be generated. Bitmask as follows: - * 1 = Dusts of all kinds. - * 2 = Dusts, Ingots, Plates, Rods/Sticks, Machine Components and other Metal specific things. - * 4 = Dusts, Gems, Plates, Lenses (if transparent). - * 8 = Dusts, Impure Dusts, crushed Ores, purified Ores, centrifuged Ores etc. - * 16 = Cells - * 32 = Plasma Cells - * 64 = Tool Heads - * 128 = Gears - * 256 = Designates something as empty (only used for the Empty material) + * @param aTypes which kind of Items should be generated. Bitmask as follows: 1 = Dusts of all kinds. + * 2 = Dusts, Ingots, Plates, Rods/Sticks, Machine Components and other Metal specific + * things. 4 = Dusts, Gems, Plates, Lenses (if transparent). 8 = Dusts, Impure Dusts, + * crushed Ores, purified Ores, centrifuged Ores etc. 16 = Cells 32 = Plasma Cells 64 = + * Tool Heads 128 = Gears 256 = Designates something as empty (only used for the Empty + * material) * @param aR, aG, aB Color of the Material 0-255 each. * @param aA transparency of the Material Texture. 0 = fully visible, 255 = Invisible. * @param aName The Name used as Default for localization. * @param aFuelType Type of Generator to get Energy from this Material. - * @param aFuelPower EU generated. Will be multiplied by 1000, also additionally multiplied by 2 for Gems. - * @param aMeltingPoint Used to determine the smelting Costs in furnace. >>>>**ADD 20000 to remove EBF recipes to add them MANUALLY ! :D**<<<< + * @param aFuelPower EU generated. Will be multiplied by 1000, also additionally multiplied by 2 for + * Gems. + * @param aMeltingPoint Used to determine the smelting Costs in furnace. >>>>**ADD 20000 to remove EBF + * recipes to add them MANUALLY ! :D**<<<< * @param aBlastFurnaceTemp Used to determine the needed Heat capacity Costs in Blast Furnace. * @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) { + 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, @@ -1283,29 +1196,10 @@ public class Materials implements IColorModulationContainer, ISubTagContainer { 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, + 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, @@ -1333,31 +1227,11 @@ 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, - Element aElement, - List<TC_Aspects.TC_AspectStack> 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, @@ -1392,31 +1266,11 @@ 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) { + 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, @@ -1445,32 +1299,11 @@ public class Materials implements IColorModulationContainer, ISubTagContainer { 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) { + 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, @@ -1497,37 +1330,30 @@ public class Materials implements IColorModulationContainer, ISubTagContainer { mExtraData = aExtraData; mMaterialList.addAll(aMaterialList); if (mMaterialList.size() == 1) mChemicalFormula = mMaterialList.get(0).toString(true); - else - mChemicalFormula = mMaterialList.stream() - .map(MaterialStack::toString) - .collect(Collectors.joining()) - .replaceAll("_", "-"); + else mChemicalFormula = mMaterialList.stream().map(MaterialStack::toString).collect(Collectors.joining()) + .replaceAll("_", "-"); int tAmountOfComponents = 0, tMeltingPoint = 0; for (MaterialStack tMaterial : mMaterialList) { tAmountOfComponents += tMaterial.mAmount; if (tMaterial.mMaterial.mMeltingPoint > 0) tMeltingPoint += tMaterial.mMaterial.mMeltingPoint * tMaterial.mAmount; - if (aAspects == null) - for (TC_Aspects.TC_AspectStack tAspect : tMaterial.mMaterial.mAspects) - tAspect.addToAspectList(mAspects); + if (aAspects == null) for (TC_Aspects.TC_AspectStack tAspect : tMaterial.mMaterial.mAspects) + tAspect.addToAspectList(mAspects); } if (mMeltingPoint < 0) mMeltingPoint = (short) (tMeltingPoint / tAmountOfComponents); tAmountOfComponents *= aDensityMultiplier; tAmountOfComponents /= aDensityDivider; - if (aAspects == null) - for (TC_Aspects.TC_AspectStack tAspect : mAspects) - tAspect.mAmount = Math.max(1, tAspect.mAmount / Math.max(1, tAmountOfComponents)); + if (aAspects == null) for (TC_Aspects.TC_AspectStack tAspect : mAspects) + tAspect.mAmount = Math.max(1, tAspect.mAmount / Math.max(1, tAmountOfComponents)); else mAspects.addAll(aAspects); } 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); @@ -1536,8 +1362,7 @@ 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) + AnnealedCopper.setSmeltingInto(AnnealedCopper).setMaceratingInto(AnnealedCopper) .setArcSmeltingInto(AnnealedCopper); Netherrack.setSmeltingInto(NetherBrick); MeatRaw.setSmeltingInto(MeatCooked); @@ -1553,14 +1378,10 @@ 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) + 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) + 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); @@ -1703,8 +1524,7 @@ public class Materials implements IColorModulationContainer, ISubTagContainer { } /** - * DO NOT ADD MORE THAN 1 TOOL AND ARMOR ENCHANTMENT PER MATERIAL! - * It will get overwritten! + * DO NOT ADD MORE THAN 1 TOOL AND ARMOR ENCHANTMENT PER MATERIAL! It will get overwritten! */ private static void setEnchantments() { setToolEnchantments(); @@ -2001,10 +1821,8 @@ 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)"; EnrichedHolmium.mChemicalFormula = "Nq+\u2088Ho\u2082"; Grade1PurifiedWater.mChemicalFormula = "H₂O"; @@ -2020,8 +1838,8 @@ public class Materials implements IColorModulationContainer, ISubTagContainer { private static void initSubTags() { SubTag.ELECTROMAGNETIC_SEPERATION_NEODYMIUM.addTo(Bastnasite, Monazite, Forcicium, Forcillium); - SubTag.ELECTROMAGNETIC_SEPERATION_GOLD.addTo( - Magnetite, VanadiumMagnetite, BasalticMineralSand, GraniticMineralSand); + SubTag.ELECTROMAGNETIC_SEPERATION_GOLD + .addTo(Magnetite, VanadiumMagnetite, BasalticMineralSand, GraniticMineralSand); SubTag.NO_RECIPES.addTo(MagnetohydrodynamicallyConstrainedStarMatter); @@ -2043,8 +1861,8 @@ public class Materials implements IColorModulationContainer, ISubTagContainer { Chromite, Andradite); - SubTag.BLASTFURNACE_CALCITE_DOUBLE.addTo( - Pyrite, BrownLimonite, YellowLimonite, BasalticMineralSand, GraniticMineralSand, Magnetite); + SubTag.BLASTFURNACE_CALCITE_DOUBLE + .addTo(Pyrite, BrownLimonite, YellowLimonite, BasalticMineralSand, GraniticMineralSand, Magnetite); SubTag.BLASTFURNACE_CALCITE_TRIPLE.addTo(Iron, PigIron, DeepIron, ShadowIron, WroughtIron, MeteoricIron); @@ -2420,14 +2238,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); @@ -2471,7 +2289,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); @@ -2490,21 +2308,19 @@ public class Materials implements IColorModulationContainer, ISubTagContainer { 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 + mMaterialHandlers.forEach(IMaterialHandler::onMaterialsInit); // This is where addon mods can add/manipulate + // materials initMaterialProperties(); // No more material addition or manipulation should be done past this point! - MATERIALS_ARRAY = MATERIALS_MAP - .values() - .toArray(new Materials[0]); // Generate standard object array. This is a lot faster to loop over. + MATERIALS_ARRAY = MATERIALS_MAP.values().toArray(new Materials[0]); // Generate standard object array. This is a + // lot faster to loop over. VALUES = Arrays.asList(MATERIALS_ARRAY); if (!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); @@ -2545,13 +2361,17 @@ public class Materials implements IColorModulationContainer, ISubTagContainer { if (aMaterial.mHasParentMod) { 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!"); + } else 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"); + } else throw new IllegalArgumentException( + "The Material Index " + aMaterial.mMetaItemSubID + + " for " + + aMaterial.mName + + " is/over the maximum of 1000"); } } } @@ -2562,22 +2382,22 @@ public class Materials implements IColorModulationContainer, ISubTagContainer { } private static void addTemperatureValues(Materials aMaterial, String aConfigPath) { - aMaterial.mMeltingPoint = - GregTech_API.sMaterialProperties.get(aConfigPath, "MeltingPoint", aMaterial.mMeltingPoint); - aMaterial.mBlastFurnaceRequired = GregTech_API.sMaterialProperties.get( - aConfigPath, "BlastFurnaceRequired", aMaterial.mBlastFurnaceRequired); - aMaterial.mBlastFurnaceTemp = (short) - GregTech_API.sMaterialProperties.get(aConfigPath, "BlastFurnaceTemp", aMaterial.mBlastFurnaceTemp); + aMaterial.mMeltingPoint = GregTech_API.sMaterialProperties + .get(aConfigPath, "MeltingPoint", aMaterial.mMeltingPoint); + aMaterial.mBlastFurnaceRequired = GregTech_API.sMaterialProperties + .get(aConfigPath, "BlastFurnaceRequired", aMaterial.mBlastFurnaceRequired); + aMaterial.mBlastFurnaceTemp = (short) GregTech_API.sMaterialProperties + .get(aConfigPath, "BlastFurnaceTemp", aMaterial.mBlastFurnaceTemp); aMaterial.mGasTemp = GregTech_API.sMaterialProperties.get(aConfigPath, "GasTemp", aMaterial.mGasTemp); aMaterial.setHeatDamage( (float) GregTech_API.sMaterialProperties.get(aConfigPath, "HeatDamage", aMaterial.mHeatDamage)); } private static void addDensityValues(Materials aMaterial, String aConfigPath) { - aMaterial.mDensityMultiplier = - GregTech_API.sMaterialProperties.get(aConfigPath, "DensityMultiplier", aMaterial.mDensityMultiplier); - aMaterial.mDensityDivider = - GregTech_API.sMaterialProperties.get(aConfigPath, "DensityDivider", aMaterial.mDensityDivider); + aMaterial.mDensityMultiplier = GregTech_API.sMaterialProperties + .get(aConfigPath, "DensityMultiplier", aMaterial.mDensityMultiplier); + aMaterial.mDensityDivider = GregTech_API.sMaterialProperties + .get(aConfigPath, "DensityDivider", aMaterial.mDensityDivider); aMaterial.mDensity = (long) GregTech_API.sMaterialProperties.get( aConfigPath, "Density", @@ -2586,17 +2406,21 @@ public class Materials implements IColorModulationContainer, ISubTagContainer { } private static void addColorValues(Materials aMaterial, String aConfigPath) { - aMaterial.mTransparent = - GregTech_API.sMaterialProperties.get(aConfigPath, "Transparent", aMaterial.mTransparent); - String aColor = GregTech_API.sMaterialProperties.get( - aConfigPath, "DyeColor", aMaterial.mColor == Dyes._NULL ? "None" : aMaterial.mColor.toString()); + aMaterial.mTransparent = GregTech_API.sMaterialProperties + .get(aConfigPath, "Transparent", aMaterial.mTransparent); + String aColor = GregTech_API.sMaterialProperties + .get(aConfigPath, "DyeColor", aMaterial.mColor == Dyes._NULL ? "None" : aMaterial.mColor.toString()); aMaterial.mColor = aColor.equals("None") ? Dyes._NULL : Dyes.get(aColor); - String[] aRGBA = GregTech_API.sMaterialProperties - .get( - aConfigPath, - "MatRGBA", - aMaterial.mRGBa[0] + "," + aMaterial.mRGBa[1] + "," + aMaterial.mRGBa[2] + "," - + aMaterial.mRGBa[3] + ",") + 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]); @@ -2605,26 +2429,20 @@ 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); if (aMaterial == Materials.SpaceTime) { aMaterial.mHandleMaterial = Materials.Infinity; @@ -2636,8 +2454,8 @@ public class Materials implements IColorModulationContainer, ISubTagContainer { } private static void addEnchantmentValues(Materials aMaterial, String aConfigPath) { - aMaterial.mEnchantmentToolsLevel = (byte) - GregTech_API.sMaterialProperties.get(aConfigPath, "EnchantmentLevel", aMaterial.mEnchantmentToolsLevel); + aMaterial.mEnchantmentToolsLevel = (byte) GregTech_API.sMaterialProperties + .get(aConfigPath, "EnchantmentLevel", aMaterial.mEnchantmentToolsLevel); String aEnchantmentName = GregTech_API.sMaterialProperties.get( aConfigPath, "Enchantment", @@ -2651,24 +2469,29 @@ public class Materials implements IColorModulationContainer, ISubTagContainer { 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.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.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) { @@ -2681,22 +2504,26 @@ public class Materials implements IColorModulationContainer, ISubTagContainer { aMaterial.mHasGas = GregTech_API.sMaterialProperties.get(aConfigPath, "AddGas", aMaterial.mHasGas); if (aMaterial.mHasGas) { GT_FluidFactory.of( - aMaterial.mName.toLowerCase(), aMaterial.mDefaultLocalName, aMaterial, GAS, aMaterial.mGasTemp); + aMaterial.mName.toLowerCase(), + aMaterial.mDefaultLocalName, + aMaterial, + GAS, + aMaterial.mGasTemp); } } } private static void addInternalStuff(Materials aMaterial, String aConfigPath) { - aMaterial.mMetaItemSubID = GregTech_API.sMaterialProperties.get( - aConfigPath, "MaterialID", aMaterial.mCustomOre ? -1 : aMaterial.mMetaItemSubID); + aMaterial.mMetaItemSubID = GregTech_API.sMaterialProperties + .get(aConfigPath, "MaterialID", aMaterial.mCustomOre ? -1 : aMaterial.mMetaItemSubID); aMaterial.mTypes = GregTech_API.sMaterialProperties.get( aConfigPath, "MaterialTypes", aMaterial.mCustomOre ? 1 | 2 | 4 | 8 | 16 | 32 | 64 | 128 : aMaterial.mTypes); - aMaterial.mUnificatable = - GregTech_API.sMaterialProperties.get(aConfigPath, "Unificatable", aMaterial.mUnificatable); - aMaterial.mHasParentMod = - GregTech_API.sMaterialProperties.get(aConfigPath, "HasParentMod", aMaterial.mHasParentMod); + aMaterial.mUnificatable = GregTech_API.sMaterialProperties + .get(aConfigPath, "Unificatable", aMaterial.mUnificatable); + aMaterial.mHasParentMod = GregTech_API.sMaterialProperties + .get(aConfigPath, "HasParentMod", aMaterial.mHasParentMod); } private static void addLocalisation(Materials aMaterial, String aConfigPath) { @@ -2704,8 +2531,8 @@ public class Materials implements IColorModulationContainer, ISubTagContainer { aConfigPath, "MaterialName", aMaterial.mCustomOre ? "CustomOre" + aMaterial.mCustomID : aMaterial.mDefaultLocalName); - aMaterial.mChemicalFormula = - GregTech_API.sMaterialProperties.get(aConfigPath, "ChemicalFormula", aMaterial.mChemicalFormula); + aMaterial.mChemicalFormula = GregTech_API.sMaterialProperties + .get(aConfigPath, "ChemicalFormula", aMaterial.mChemicalFormula); } private static String getConfigPath(Materials aMaterial) { @@ -2715,22 +2542,21 @@ 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 + if (GT_Mod.gregtechproxy.mChangeHarvestLevels && aMaterial.mToolQuality > 0 && aMaterial.mMetaItemSubID < GT_Mod.gregtechproxy.mHarvestLevel.length && aMaterial.mMetaItemSubID >= 0) { - GT_Mod.gregtechproxy.mHarvestLevel[aMaterial.mMetaItemSubID] = - GregTech_API.sMaterialProperties.get(aConfigPath, "HarvestLevel", aMaterial.mToolQuality); + GT_Mod.gregtechproxy.mHarvestLevel[aMaterial.mMetaItemSubID] = GregTech_API.sMaterialProperties + .get(aConfigPath, "HarvestLevel", aMaterial.mToolQuality); } } private static void addHarvestLevels() { - GT_Mod.gregtechproxy.mChangeHarvestLevels = - GregTech_API.sMaterialProperties.get("harvestlevel", "ActivateHarvestLevelChange", false); - GT_Mod.gregtechproxy.mMaxHarvestLevel = - Math.min(15, GregTech_API.sMaterialProperties.get("harvestlevel", "MaxHarvestLevel", 7)); - GT_Mod.gregtechproxy.mGraniteHavestLevel = - GregTech_API.sMaterialProperties.get("harvestlevel", "GraniteHarvestLevel", 3); + GT_Mod.gregtechproxy.mChangeHarvestLevels = GregTech_API.sMaterialProperties + .get("harvestlevel", "ActivateHarvestLevelChange", false); + GT_Mod.gregtechproxy.mMaxHarvestLevel = Math + .min(15, GregTech_API.sMaterialProperties.get("harvestlevel", "MaxHarvestLevel", 7)); + GT_Mod.gregtechproxy.mGraniteHavestLevel = GregTech_API.sMaterialProperties + .get("harvestlevel", "GraniteHarvestLevel", 3); } public static void initMaterialProperties() { @@ -2762,17 +2588,15 @@ public class Materials implements IColorModulationContainer, ISubTagContainer { private static void aspectCalculation(Materials aMaterial, String aConfigPath) { - String aDefaultAspectString = aMaterial.mAspects.stream() - .map(aAspectStack -> aAspectStack.mAspect.toString()) + String aDefaultAspectString = aMaterial.mAspects.stream().map(aAspectStack -> aAspectStack.mAspect.toString()) .collect(Collectors.joining(",", ",", "")); String aDefaultAspectAmountString = aMaterial.mAspects.stream() - .map(aAspectStack -> String.valueOf(aAspectStack.mAmount)) - .collect(Collectors.joining(",", ",", "")); + .map(aAspectStack -> String.valueOf(aAspectStack.mAmount)).collect(Collectors.joining(",", ",", "")); - String aConfigAspectString = - GregTech_API.sMaterialProperties.get(aConfigPath, "ListTCAspects", aDefaultAspectString); - String aConfigAspectAmountString = - GregTech_API.sMaterialProperties.get(aConfigPath, "ListTCAspectAmounts", aDefaultAspectAmountString); + String aConfigAspectString = GregTech_API.sMaterialProperties + .get(aConfigPath, "ListTCAspects", aDefaultAspectString); + String aConfigAspectAmountString = GregTech_API.sMaterialProperties + .get(aConfigPath, "ListTCAspectAmounts", aDefaultAspectAmountString); if (!aConfigAspectString.equals(aDefaultAspectString) || !aConfigAspectAmountString.equals(aDefaultAspectAmountString)) { @@ -2791,60 +2615,55 @@ public class Materials implements IColorModulationContainer, ISubTagContainer { } private static void OreReRegistrationsCalculation(Materials aMaterial, String aConfigPath) { - String aDefaultMatReRegString = aMaterial.mOreReRegistrations.stream() - .map(aTag -> aTag.mName) + String aDefaultMatReRegString = aMaterial.mOreReRegistrations.stream().map(aTag -> aTag.mName) .collect(Collectors.joining(",", ",", "")); - String aConfigMatMatReRegString = GregTech_API.sMaterialProperties.get( - aConfigPath, "ListMaterialReRegistrations", aDefaultMatReRegString); + 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) + 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) + Arrays.stream(aConfigMatByProString.split(",")).map(MATERIALS_MAP::get).filter(Objects::nonNull) .forEach(aMat -> aMaterial.mOreByProducts.add(aMat)); } } } /** - * Converts the pre-defined list of SubTags from a material into a list of SubTag names for setting/getting to/from the config. - * It is then converted to a String[] and finally to a singular String for insertion into the config - * 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. + * Converts the pre-defined list of SubTags from a material into a list of SubTag names for setting/getting to/from + * the config. It is then converted to a String[] and finally to a singular String for insertion into the config 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) + Arrays.stream(aConfigTagString.split(",")).map(SubTag.sSubTags::get).filter(Objects::nonNull) .forEach(aTag -> aMaterial.mSubTags.add(aTag)); } } } /** - * This is for keeping compatibility with addons mods (Such as TinkersGregworks etc.) that looped over the old materials enum + * This is for keeping compatibility with addons mods (Such as TinkersGregworks etc.) that looped over the old + * materials enum */ @Deprecated public static Materials valueOf(String aMaterialName) { @@ -2852,7 +2671,8 @@ public class Materials implements IColorModulationContainer, ISubTagContainer { } /** - * This is for keeping compatibility with addons mods (Such as TinkersGregworks etc.) that looped over the old materials enum + * This is for keeping compatibility with addons mods (Such as TinkersGregworks etc.) that looped over the old + * materials enum */ public static Materials[] values() { return MATERIALS_ARRAY; @@ -2918,7 +2738,8 @@ public class Materials implements IColorModulationContainer, ISubTagContainer { } /** - * This is for keeping compatibility with addons mods (Such as TinkersGregworks etc.) that looped over the old materials enum + * This is for keeping compatibility with addons mods (Such as TinkersGregworks etc.) that looped over the old + * materials enum */ @Deprecated public String name() { @@ -2984,9 +2805,8 @@ public class Materials implements IColorModulationContainer, ISubTagContainer { 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; + ? mChemicalFormula + : "(" + mChemicalFormula + ")") + aMultiplier; } return mChemicalFormula; } @@ -3004,8 +2824,9 @@ public class Materials implements IColorModulationContainer, ISubTagContainer { */ public boolean contains(ItemStack... aStacks) { if (aStacks == null || aStacks.length == 0) return false; - return mMaterialItems.stream().anyMatch(tStack -> Arrays.stream(aStacks) - .anyMatch(aStack -> GT_Utility.areStacksEqual(aStack, tStack, !tStack.hasTagCompound()))); + return mMaterialItems.stream().anyMatch( + tStack -> Arrays.stream(aStacks) + .anyMatch(aStack -> GT_Utility.areStacksEqual(aStack, tStack, !tStack.hasTagCompound()))); } /** @@ -3015,11 +2836,10 @@ public class Materials implements IColorModulationContainer, ISubTagContainer { if (aStack == null) return false; boolean temp = false; int mMaterialItems_sS = mMaterialItems.size(); - for (int i = 0; i < mMaterialItems_sS; i++) - if (GT_Utility.areStacksEqual(aStack, mMaterialItems.get(i))) { - mMaterialItems.remove(i--); - temp = true; - } + for (int i = 0; i < mMaterialItems_sS; i++) if (GT_Utility.areStacksEqual(aStack, mMaterialItems.get(i))) { + mMaterialItems.remove(i--); + temp = true; + } return temp; } @@ -3028,12 +2848,10 @@ public class Materials implements IColorModulationContainer, ISubTagContainer { */ @Override public ISubTagContainer add(SubTag... aTags) { - if (aTags != null) - for (SubTag aTag : aTags) - if (aTag != null && !contains(aTag)) { - aTag.addContainerToList(this); - mSubTags.add(aTag); - } + if (aTags != null) for (SubTag aTag : aTags) if (aTag != null && !contains(aTag)) { + aTag.addContainerToList(this); + mSubTags.add(aTag); + } return this; } @@ -3063,8 +2881,8 @@ public class Materials implements IColorModulationContainer, ISubTagContainer { } /** - * Adds a Material to the List of Byproducts when grinding this Ore. - * Is used for more precise Ore grinding, so that it is possible to choose between certain kinds of Materials. + * Adds a Material to the List of Byproducts when grinding this Ore. Is used for more precise Ore grinding, so that + * it is possible to choose between certain kinds of Materials. */ @SuppressWarnings("UnusedReturnValue") // Maintains signature public Materials addOreByProduct(Materials aMaterial) { @@ -3073,8 +2891,8 @@ public class Materials implements IColorModulationContainer, ISubTagContainer { } /** - * Adds multiple Materials to the List of Byproducts when grinding this Ore. - * Is used for more precise Ore grinding, so that it is possible to choose between certain kinds of Materials. + * Adds multiple Materials to the List of Byproducts when grinding this Ore. 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); @@ -3082,8 +2900,7 @@ public class Materials implements IColorModulationContainer, ISubTagContainer { } /** - * If this Ore gives multiple drops of its Main Material. - * Lapis Ore for example gives about 6 drops. + * If this Ore gives multiple drops of its Main Material. Lapis Ore for example gives about 6 drops. */ public Materials setOreMultiplier(int aOreMultiplier) { if (aOreMultiplier > 0) mOreMultiplier = aOreMultiplier; @@ -3100,8 +2917,7 @@ public class Materials implements IColorModulationContainer, ISubTagContainer { } /** - * If this Ore gives multiple drops of its Main Material. - * Lapis Ore for example gives about 6 drops. + * If this Ore gives multiple drops of its Main Material. Lapis Ore for example gives about 6 drops. */ public Materials setSmeltingMultiplier(int aSmeltingMultiplier) { if (aSmeltingMultiplier > 0) mSmeltingMultiplier = aSmeltingMultiplier; @@ -3117,8 +2933,8 @@ public class Materials implements IColorModulationContainer, ISubTagContainer { } /** - * This Material should be the Main Material this Ore gets ground into. - * Example, Chromite giving Chrome or Tungstate giving Tungsten. + * This Material should be the Main Material this Ore gets ground into. Example, Chromite giving Chrome or Tungstate + * giving Tungsten. */ @SuppressWarnings("UnusedReturnValue") // Maintains signature public Materials setOreReplacement(Materials aMaterial) { @@ -3306,12 +3122,13 @@ public class Materials implements IColorModulationContainer, ISubTagContainer { return new FluidStack(steamCrackedFluids[2], amount); } - /** Check that the material is a proper soldering fluid - ** @return true if Materials is a proper soldering fluid + /** + * Check that the material is a proper soldering fluid + ** + * @return true if Materials is a proper soldering fluid */ public boolean isProperSolderingFluid() { - return mStandardMoltenFluid != null - && contains(SubTag.SOLDERING_MATERIAL) + return mStandardMoltenFluid != null && contains(SubTag.SOLDERING_MATERIAL) && !(GregTech_API.mUseOnlyGoodSolderingMaterials && !contains(SubTag.SOLDERING_MATERIAL_GOOD)); } diff --git a/src/main/java/gregtech/api/enums/MaterialsBotania.java b/src/main/java/gregtech/api/enums/MaterialsBotania.java index ef07ec4297..f6ae06408e 100644 --- a/src/main/java/gregtech/api/enums/MaterialsBotania.java +++ b/src/main/java/gregtech/api/enums/MaterialsBotania.java @@ -2,75 +2,45 @@ package gregtech.api.enums; import static gregtech.api.enums.OrePrefixes.*; -import gregtech.api.enums.TC_Aspects.TC_AspectStack; import java.util.Arrays; +import gregtech.api.enums.TC_Aspects.TC_AspectStack; + public class MaterialsBotania { // Botania materials. public static Materials Manasteel = new MaterialBuilder(201, TextureSet.SET_METALLIC, "Manasteel") - .setName("Manasteel") - .setRGBA(150, 219, 252, 255) - .addDustItems() - .addMetalItems() - .addToolHeadItems() - .addGearItems() - .setToolSpeed(8.0F) - .setDurability(5120) - .setToolQuality(4) - .setMeltingPoint(1500) - .setBlastFurnaceTemp(1500) - .setBlastFurnaceRequired(true) - .setAspects(Arrays.asList( - new TC_AspectStack(TC_Aspects.METALLUM, 3), new TC_AspectStack(TC_Aspects.PRAECANTATIO, 1))) + .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))) + .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))) + .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) + .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(); @@ -103,36 +73,19 @@ public class MaterialsBotania { 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) + .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))) + .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, diff --git a/src/main/java/gregtech/api/enums/MaterialsKevlar.java b/src/main/java/gregtech/api/enums/MaterialsKevlar.java index be1ef3b0f1..1c23f17698 100644 --- a/src/main/java/gregtech/api/enums/MaterialsKevlar.java +++ b/src/main/java/gregtech/api/enums/MaterialsKevlar.java @@ -1,271 +1,221 @@ package gregtech.api.enums; -import gregtech.api.objects.MaterialStack; import java.util.Arrays; +import gregtech.api.objects.MaterialStack; + 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 + 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 + 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 + 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) + .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))) + .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) + .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))) + .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) + .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))) + .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) + .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))) + .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) + .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))) + .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) + .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))) + .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) + .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))) + .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) + .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))) + .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) + .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))) + .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) + .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 + 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) + 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) + .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))) + .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 + 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) + .setName("Methylamine").addCell().addGas().setRGB(65, 68, 105).setColor(Dyes.dyeGray).setMeltingPoint(180) .setExtraData(1) .setMaterialList( new MaterialStack(Materials.Carbon, 1), @@ -273,24 +223,15 @@ public class MaterialsKevlar { 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) + .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) + .setName("GammaButyrolactone").addCell().addFluid().setRGB(255, 255, 151).setColor(Dyes.dyeYellow) .setMeltingPoint(229) .setMaterialList( new MaterialStack(Materials.Carbon, 4), @@ -298,101 +239,56 @@ public class MaterialsKevlar { 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) + .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 + 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) + .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) + .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 + .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) + .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) + .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) + .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) + .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) + 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) + .setName("TerephthalicAcid").addCell().addFluid().setRGB(255, 255, 255).setColor(Dyes.dyeWhite) .setMeltingPoint(480) .setMaterialList( new MaterialStack(Materials.Carbon, 8L), @@ -400,28 +296,15 @@ public class MaterialsKevlar { 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) + .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 + .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) + .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 + .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) + .setName("Cobalt(II)Naphthenate").addDustItems().setRGB(143, 95, 39).setColor(Dyes.dyeBrown) .setMeltingPoint(413) .setMaterialList( new MaterialStack(Materials.Cobalt, 1), @@ -430,19 +313,10 @@ public class MaterialsKevlar { new MaterialStack(Materials.Oxygen, 4)) .constructMaterial(); // CoC22H14O4 public static Materials NaphthenicAcid = new MaterialBuilder(760, TextureSet.SET_FLUID, "Naphthenic Acid") - .setName("NaphthenicAcid") - .addCell() - .addFluid() - .setRGB(255, 255, 255) - .setColor(Dyes.dyeWhite) - .setFuelType(MaterialBuilder.SEMIFLUID) - .setFuelPower(80) - .constructMaterial(); + .setName("NaphthenicAcid").addCell().addFluid().setRGB(255, 255, 255).setColor(Dyes.dyeWhite) + .setFuelType(MaterialBuilder.SEMIFLUID).setFuelPower(80).constructMaterial(); public static Materials CobaltIIHydroxide = new MaterialBuilder(759, TextureSet.SET_POWDER, "Cobalt II Hydroxide") - .setName("CobaltIIHydroxide") - .addDustItems() - .setRGB(229, 140, 239) - .setColor(Dyes.dyePurple) + .setName("CobaltIIHydroxide").addDustItems().setRGB(229, 140, 239).setColor(Dyes.dyePurple) .setMeltingPoint(441) .setMaterialList( new MaterialStack(Materials.Cobalt, 1), @@ -450,10 +324,7 @@ public class MaterialsKevlar { 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) + .setName("Cobalt(II)Acetate").addDustItems().setRGB(219, 162, 229).setColor(Dyes.dyePurple) .setMeltingPoint(413) .setMaterialList( new MaterialStack(Materials.Carbon, 4L), @@ -462,30 +333,21 @@ public class MaterialsKevlar { 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) + .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 + 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) + .setName("SodiumBorohydride").addDustItems().setRGB(255, 255, 255).setColor(Dyes.dyeWhite) .setMeltingPoint(673) .setMaterialList( new MaterialStack(Materials.Sodium, 1), @@ -493,17 +355,10 @@ public class MaterialsKevlar { 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) + .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) + .setName("Triphenylphosphene").addDustItems().setRGB(255, 255, 255).setColor(Dyes.dyeWhite) .setMeltingPoint(353) .setMaterialList( new MaterialStack(Materials.Carbon, 18L), @@ -511,29 +366,21 @@ public class MaterialsKevlar { 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 + 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) + .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) + .setName("TrimethylBorate").addCell().addFluid().setRGB(255, 255, 255).setColor(Dyes.dyeWhite) .setMeltingPoint(239) .setMaterialList( new MaterialStack(Materials.Carbon, 3L), @@ -542,10 +389,7 @@ public class MaterialsKevlar { 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) + .setName("SodiumMethoxide").addDustItems().setRGB(255, 255, 255).setColor(Dyes.dyeWhite) .setMeltingPoint(400) .setMaterialList( new MaterialStack(Materials.Carbon, 1L), @@ -557,7 +401,8 @@ public class MaterialsKevlar { // H3RhCl6 /** - * called by Materials. Can be safely called multiple times. exists to allow Materials ensure this class is initialized + * called by Materials. Can be safely called multiple times. exists to allow Materials ensure this class is + * initialized */ public static void init() { // no-op. all work is done by <clinit> diff --git a/src/main/java/gregtech/api/enums/MaterialsOreAlum.java b/src/main/java/gregtech/api/enums/MaterialsOreAlum.java index 14e75b3efa..f90e39e493 100644 --- a/src/main/java/gregtech/api/enums/MaterialsOreAlum.java +++ b/src/main/java/gregtech/api/enums/MaterialsOreAlum.java @@ -3,74 +3,34 @@ package gregtech.api.enums; public class MaterialsOreAlum { public static Materials BauxiteSlurry = new MaterialBuilder(409, TextureSet.SET_FLUID, "Bauxite Slurry") - .setName("BauxiteSlurry") - .addCell() - .addFluid() - .setRGB(37, 67, 168) - .setMeltingPoint(295) - .setColor(Dyes.dyeBlue) - .constructMaterial(); + .setName("BauxiteSlurry").addCell().addFluid().setRGB(37, 67, 168).setMeltingPoint(295) + .setColor(Dyes.dyeBlue).constructMaterial(); public static Materials HeatedBauxiteSlurry = new MaterialBuilder( - 410, TextureSet.SET_FLUID, "Heated Bauxite Slurry") - .setName("HeadedBauxiteSlurry") - .addCell() - .addFluid() - .setRGB(55, 92, 212) - .setLiquidTemperature(533) - .setMeltingPoint(295) - .setColor(Dyes.dyeBlue) - .constructMaterial(); + 410, + TextureSet.SET_FLUID, + "Heated Bauxite Slurry").setName("HeadedBauxiteSlurry").addCell().addFluid().setRGB(55, 92, 212) + .setLiquidTemperature(533).setMeltingPoint(295).setColor(Dyes.dyeBlue).constructMaterial(); public static Materials SluiceJuice = new MaterialBuilder(411, TextureSet.SET_FLUID, "Sluice Juice") - .setName("SluiceJuice") - .addCell() - .addFluid() - .setRGB(92, 60, 36) - .setLiquidTemperature(295) - .setMeltingPoint(295) - .setColor(Dyes.dyeGray) - .constructMaterial(); + .setName("SluiceJuice").addCell().addFluid().setRGB(92, 60, 36).setLiquidTemperature(295) + .setMeltingPoint(295).setColor(Dyes.dyeGray).constructMaterial(); public static Materials SluiceSand = new MaterialBuilder(412, TextureSet.SET_FINE, "Sluice Sand") - .setName("SluiceSand") - .addDustItems() - .setRGB(165, 165, 120) - .setColor(Dyes.dyeGray) - .constructMaterial(); + .setName("SluiceSand").addDustItems().setRGB(165, 165, 120).setColor(Dyes.dyeGray).constructMaterial(); public static Materials BauxiteSlag = new MaterialBuilder(413, TextureSet.SET_FINE, "Bauxite Slag") - .setName("BauxiteSlag") - .addDustItems() - .setRGB(110, 31, 31) - .setColor(Dyes.dyeRed) - .constructMaterial(); + .setName("BauxiteSlag").addDustItems().setRGB(110, 31, 31).setColor(Dyes.dyeRed).constructMaterial(); public static Materials IlmeniteSlag = new MaterialBuilder(414, TextureSet.SET_FINE, "Ilmenite Slag") - .setName("IlmeniteSlag") - .addDustItems() - .setRGB(163, 38, 38) - .setColor(Dyes.dyeBrown) - .constructMaterial(); + .setName("IlmeniteSlag").addDustItems().setRGB(163, 38, 38).setColor(Dyes.dyeBrown).constructMaterial(); public static Materials GreenSapphireJuice = new MaterialBuilder(415, TextureSet.SET_FLUID, "Green Sapphire Juice") - .setName("GreenSapphireJuice") - .addCell() - .addFluid() - .setRGB(100, 200, 130) - .setColor(Dyes.dyeGreen) + .setName("GreenSapphireJuice").addCell().addFluid().setRGB(100, 200, 130).setColor(Dyes.dyeGreen) .constructMaterial(); public static Materials SapphireJuice = new MaterialBuilder(416, TextureSet.SET_FLUID, "Sapphire Juice") - .setName("SapphireJuice") - .addCell() - .addFluid() - .setRGB(100, 100, 200) - .setColor(Dyes.dyeBlue) + .setName("SapphireJuice").addCell().addFluid().setRGB(100, 100, 200).setColor(Dyes.dyeBlue) .constructMaterial(); public static Materials RubyJuice = new MaterialBuilder(417, TextureSet.SET_FLUID, "Ruby Juice") - .setName("RubyJuice") - .addCell() - .addFluid() - .setRGB(255, 100, 100) - .setColor(Dyes.dyeRed) - .constructMaterial(); + .setName("RubyJuice").addCell().addFluid().setRGB(255, 100, 100).setColor(Dyes.dyeRed).constructMaterial(); /** - * called by Materials. Can be safely called multiple times. exists to allow Materials ensure this class is initialized + * called by Materials. Can be safely called multiple times. exists to allow Materials ensure this class is + * initialized */ public static void init() { // no-op. all work is done by <clinit> diff --git a/src/main/java/gregtech/api/enums/OrePrefixes.java b/src/main/java/gregtech/api/enums/OrePrefixes.java index cd78d3a560..7e102d5a2b 100644 --- a/src/main/java/gregtech/api/enums/OrePrefixes.java +++ b/src/main/java/gregtech/api/enums/OrePrefixes.java @@ -2,7 +2,12 @@ package gregtech.api.enums; import static gregtech.api.enums.GT_Values.*; +import java.util.*; + +import net.minecraft.item.ItemStack; + import com.google.common.collect.ImmutableList; + import gregtech.api.GregTech_API; import gregtech.api.enums.TC_Aspects.TC_AspectStack; import gregtech.api.interfaces.ICondition; @@ -17,2853 +22,528 @@ import gregtech.api.objects.MaterialStack; import gregtech.api.util.GT_Log; import gregtech.api.util.GT_Utility; import gregtech.loaders.materialprocessing.ProcessingModSupport; -import java.util.*; -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), + 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! + 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, + 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 + 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, + reduced("Reduced 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, - 64, - 16), // A quintuple Ingot. - ingotQuadruple( - "4x Ingots", - "Quadruple ", - " Ingot", - true, - true, - false, - false, - false, - false, - true, - true, - false, - false, - B[1], - M * 4, - 64, - 15), // A quadruple Ingot. + 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, 64, 16), // A quintuple Ingot. + ingotQuadruple("4x Ingots", "Quadruple ", " Ingot", true, true, false, false, false, false, true, true, false, + false, B[1], M * 4, 64, 15), // A quadruple Ingot. @Deprecated - ingotQuad( - "4x Ingots", - "Quadruple ", - " Ingot", - false, - false, - false, - false, - false, - false, - false, - false, - false, - false, - B[1], - -1, - 64, - 15), - ingotTriple( - "3x Ingots", - "Triple ", - " Ingot", - true, - true, - false, - false, - false, - false, - true, - false, - false, - false, - B[1], - M * 3, - 64, - 14), // A triple Ingot. - ingotDouble( - "2x Ingots", - "Double ", - " Ingot", - true, - true, - false, - false, - false, - false, - true, - true, - false, - false, - B[1], - M * 2, - 64, - 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, + ingotQuad("4x Ingots", "Quadruple ", " Ingot", false, false, false, false, false, false, false, false, false, false, + B[1], -1, 64, 15), + ingotTriple("3x Ingots", "Triple ", " Ingot", true, true, false, false, false, false, true, false, false, false, + B[1], M * 3, 64, 14), // A triple Ingot. + ingotDouble("2x Ingots", "Double ", " Ingot", true, true, false, false, false, false, true, true, false, false, + B[1], M * 2, 64, 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, - 64, - 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, - 64, - 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 + 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, 64, 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, 64, 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, + 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, - 64, - 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, - 64, - 21), - plateQuadruple( - "4x Plates", - "Quadruple ", - " Plate", - true, - true, - false, - false, - false, - false, - true, - true, - false, - false, - B[1], - M * 4, - 64, - 20), + 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, 64, 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, 64, 21), + plateQuadruple("4x Plates", "Quadruple ", " Plate", true, true, false, false, false, false, true, true, false, + false, B[1], M * 4, 64, 20), @Deprecated - plateQuad( - "4x Plates", - "", - "", - false, - false, - false, - false, - false, - false, - false, - false, - false, - false, - B[1], - -1, - 64, + plateQuad("4x Plates", "", "", false, false, false, false, false, false, false, false, false, false, B[1], -1, 64, 20), - plateTriple( - "3x Plates", - "Triple ", - " Plate", - true, - true, - false, - false, - false, - false, - true, - true, - false, - false, - B[1], - M * 3, - 64, - 19), - plateDouble( - "2x Plates", - "Double ", - " Plate", - true, - true, - false, - false, - false, - false, - true, - true, - false, - false, - B[1], - M * 2, - 64, - 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, + plateTriple("3x Plates", "Triple ", " Plate", true, true, false, false, false, false, true, true, false, false, + B[1], M * 3, 64, 19), + plateDouble("2x Plates", "Double ", " Plate", true, true, false, false, false, false, true, true, false, false, + B[1], M * 2, 64, 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, + 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, + 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, + 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, - 64, - 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, + 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, + 64, 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, + 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, - 64, - -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, - 64, - -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, - 64, - -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, - 64, - -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. + bucket("Buckets", "", " Bucket", true, true, true, true, false, false, true, false, false, false, B[4] | B[8], + M * 1, 64, -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, 64, -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, + 64, -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, 64, -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, - 64, - 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, - 64, - 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, - 64, - 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, - 64, - 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, - 64, - 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, - 64, - 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, - 64, - 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, - 64, - 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, - 64, - 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, - 64, - 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, - 64, - 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, - 64, - 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, - 64, - 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, - 64, - 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, - 64, - 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, - 64, - 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, + 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, 64, 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, 64, 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, 64, 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, 64, 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, 64, 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, 64, 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, 64, 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, 64, 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, 64, 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, 64, 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, 64, 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, 64, 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, 64, 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, 64, 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, 64, 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, 64, 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, + 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, + 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 + 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, + 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. - 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, + 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, + 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, + 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, + 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. + 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, + 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, + 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, + 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 + 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), - - /* 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) + 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 + 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), @@ -2878,9 +558,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), @@ -2889,42 +569,26 @@ 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, + 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), @@ -2941,28 +605,12 @@ 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), @@ -2971,29 +619,13 @@ 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, + 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), @@ -3003,174 +635,30 @@ 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, - 64, - 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, 64, 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), - - 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, - false, - false, - 0, - -1, - 64, - -1), + 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), + + apiaryUpgrade("Industrial Apiary Upgrade", "", "", false, false, true, false, false, false, false, false, false, + false, 0, -1, 64, -1), beeComb("Bee Combs", "", "", true, false, true, false, false, false, false, false, false, false, 0, -1, 64, -1), nanite("Nanites", "", " Nanites", true, true, true, false, false, false, false, false, false, false, 0, -1, 64, 50); @@ -3228,9 +716,8 @@ public enum OrePrefixes { nugget.addFamiliarPrefix(ingot); for (OrePrefixes tPrefix1 : values()) - if (tPrefix1.name().startsWith("ore")) - for (OrePrefixes tPrefix2 : values()) - if (tPrefix2.name().startsWith("ore")) tPrefix1.addFamiliarPrefix(tPrefix2); + if (tPrefix1.name().startsWith("ore")) for (OrePrefixes tPrefix2 : values()) + if (tPrefix2.name().startsWith("ore")) tPrefix1.addFamiliarPrefix(tPrefix2); // These are only the important ones. gem.mNotGeneratedItems.add(Materials.Coal); @@ -3405,9 +892,13 @@ public enum OrePrefixes { 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)); + 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)); + SubTag.STRETCHY, + SubTag.BOUNCY, + new ICondition.Not<ISubTagContainer>(SubTag.NO_SMASHING)); gemChipped.mCondition = new ICondition.And<ISubTagContainer>( SubTag.TRANSPARENT, @@ -3435,16 +926,21 @@ public enum OrePrefixes { new ICondition.Not<ISubTagContainer>(SubTag.MAGICAL)); lens.mCondition = new ICondition.Or<ISubTagContainer>( - SubTag.MAGICAL, new ICondition.And<ISubTagContainer>(SubTag.TRANSPARENT, SubTag.HAS_COLOR)); + 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)); + SubTag.PAPER, + new ICondition.Not<ISubTagContainer>(SubTag.NO_SMASHING)); plateTriple.mCondition = new ICondition.Or<ISubTagContainer>( - SubTag.PAPER, new ICondition.Not<ISubTagContainer>(SubTag.NO_SMASHING)); + SubTag.PAPER, + new ICondition.Not<ISubTagContainer>(SubTag.NO_SMASHING)); plateQuadruple.mCondition = new ICondition.Or<ISubTagContainer>( - SubTag.PAPER, new ICondition.Not<ISubTagContainer>(SubTag.NO_SMASHING)); + SubTag.PAPER, + new ICondition.Not<ISubTagContainer>(SubTag.NO_SMASHING)); plateQuintuple.mCondition = new ICondition.Or<ISubTagContainer>( - SubTag.PAPER, new ICondition.Not<ISubTagContainer>(SubTag.NO_SMASHING)); + SubTag.PAPER, + new ICondition.Not<ISubTagContainer>(SubTag.NO_SMASHING)); plateDense.mCondition = new ICondition.Not<ISubTagContainer>(SubTag.NO_SMASHING); @@ -3488,10 +984,12 @@ 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); @@ -3502,29 +1000,18 @@ 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>(); /** - * Used to determine the amount of Material this Prefix contains. - * Multiply or Divide GregTech_API.MATERIAL_UNIT to get the Amounts in comparision to one Ingot. - * 0 = Null - * Negative = Undefined Amount + * Used to determine the amount of Material this Prefix contains. Multiply or Divide GregTech_API.MATERIAL_UNIT to + * get the Amounts in comparision to one Ingot. 0 = Null Negative = Undefined Amount */ public final long mMaterialAmount; public final Collection<Materials> mDisabledItems = new HashSet<Materials>(), - mNotGeneratedItems = new HashSet<Materials>(), - mIgnoredMaterials = 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; @@ -3534,84 +1021,72 @@ 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, - OrePrefixes.nanite)); + 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, + OrePrefixes.nanite)); /** * 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; @@ -3668,80 +1143,81 @@ 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 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 + 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 + if (!(aMaterial == Materials.DamascusSteel || aMaterial == Materials.Steel || aMaterial == Materials.Bronze - || aMaterial == Materials.Manganese)) crateGtIngot.mDisabledItems.add(aMaterial); + || aMaterial == Materials.Manganese)) + crateGtIngot.mDisabledItems.add(aMaterial); if (!(aMaterial == Materials.Neodymium || aMaterial == Materials.Chrome)) crateGtDust.mDisabledItems.add(aMaterial); crateGtGem.mDisabledItems.add(aMaterial); @@ -3754,10 +1230,8 @@ public enum OrePrefixes { arrowGtWood.mDisabledItems.add(aMaterial); } // Plates - if (!enableUnusedPlates - && ((aMaterial.mTypes & 0x40) == 0) - && !(aMaterial == Materials.Silicon - || aMaterial == Materials.Zinc + if (!enableUnusedPlates && ((aMaterial.mTypes & 0x40) == 0) + && !(aMaterial == Materials.Silicon || aMaterial == Materials.Zinc || aMaterial == Materials.Europium || aMaterial == Materials.Americium || aMaterial == Materials.RedAlloy @@ -3786,7 +1260,8 @@ public enum OrePrefixes { || aMaterial == Materials.Sodalite || aMaterial == Materials.Gallium || aMaterial == Materials.GalliumArsenide - || aMaterial == Materials.IndiumGalliumPhosphide)) plate.mDisabledItems.add(aMaterial); + || aMaterial == Materials.IndiumGalliumPhosphide)) + plate.mDisabledItems.add(aMaterial); if (!enableUnusedIngotHot) { ingotHot.mDisabledItems.add(aMaterial); } @@ -3795,12 +1270,11 @@ public enum OrePrefixes { 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 + if (!enableUnusedDoublePlates && ((aMaterial.mTypes & 0x40) == 0) + && !(aMaterial == Materials.Paper || aMaterial == Materials.Aluminium || aMaterial == Materials.Steel - || aMaterial == Materials.TungstenSteel)) plateDouble.mDisabledItems.add(aMaterial); + || aMaterial == Materials.TungstenSteel)) + plateDouble.mDisabledItems.add(aMaterial); if (!enableUnusedTriplePlates && !(aMaterial == Materials.Paper)) plateTriple.mDisabledItems.add(aMaterial); if (!enableUnusedQuadPlates && !(aMaterial == Materials.Paper)) @@ -3808,135 +1282,127 @@ public enum OrePrefixes { if (!enableUnusedQuinPlates && !(aMaterial == Materials.Paper)) plateQuintuple.mDisabledItems.add(aMaterial); if (!(enableUnusedDensePlates || GregTech_API.mGTPlusPlus) - && !(aMaterial == Materials.Iron - || aMaterial == Materials.Copper + && !(aMaterial == Materials.Iron || aMaterial == Materials.Copper || aMaterial == Materials.Lead || aMaterial == Materials.Paper || aMaterial == Materials.Thaumium - || aMaterial == Materials.Titanium)) plateDense.mDisabledItems.add(aMaterial); + || 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); + 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); + 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); + 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); + 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); + 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); + 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 + if (!enableUnusedBolts && ((aMaterial.mTypes & 0x40) == 0) + && !(aMaterial == Materials.Titanium || aMaterial == Materials.Chrome || aMaterial == Materials.Iron || aMaterial == Materials.Tin || aMaterial == Materials.Osmium @@ -3950,12 +1416,11 @@ public enum OrePrefixes { || aMaterial == Materials.TungstenSteel || aMaterial == Materials.Tungsten || aMaterial == Materials.HSSE - || aMaterial == Materials.HSSG)) bolt.mDisabledItems.add(aMaterial); + || aMaterial == Materials.HSSG)) + bolt.mDisabledItems.add(aMaterial); // Screws - if (!enableUnusedScrews - && ((aMaterial.mTypes & 0x40) == 0) - && !(aMaterial == Materials.Titanium - || aMaterial == Materials.Chrome + if (!enableUnusedScrews && ((aMaterial.mTypes & 0x40) == 0) + && !(aMaterial == Materials.Titanium || aMaterial == Materials.Chrome || aMaterial == Materials.Iron || aMaterial == Materials.Tin || aMaterial == Materials.Osmium @@ -3968,12 +1433,11 @@ public enum OrePrefixes { || aMaterial == Materials.PigIron || aMaterial == Materials.TungstenSteel || aMaterial == Materials.HSSE - || aMaterial == Materials.HSSG)) screw.mDisabledItems.add(aMaterial); + || aMaterial == Materials.HSSG)) + screw.mDisabledItems.add(aMaterial); // Rods - if (!enableUnusedRods - && ((aMaterial.mTypes & 0x40) == 0) - && !(aMaterial == Materials.Titanium - || aMaterial == Materials.Chrome + if (!enableUnusedRods && ((aMaterial.mTypes & 0x40) == 0) + && !(aMaterial == Materials.Titanium || aMaterial == Materials.Chrome || aMaterial == Materials.Iron || aMaterial == Materials.Tin || aMaterial == Materials.Osmium @@ -4016,12 +1480,11 @@ public enum OrePrefixes { || aMaterial == Materials.Lapis || aMaterial == Materials.Lazurite || aMaterial == Materials.Sodalite - || aMaterial == Materials.PolyvinylChloride)) stick.mDisabledItems.add(aMaterial); + || aMaterial == Materials.PolyvinylChloride)) + stick.mDisabledItems.add(aMaterial); // Long Rods - if (!enableUnusedLongRods - && ((aMaterial.mTypes & 0x40) == 0) - && !(aMaterial == Materials.Titanium - || aMaterial == Materials.NeodymiumMagnetic + if (!enableUnusedLongRods && ((aMaterial.mTypes & 0x40) == 0) + && !(aMaterial == Materials.Titanium || aMaterial == Materials.NeodymiumMagnetic || aMaterial == Materials.SamariumMagnetic || aMaterial == Materials.HSSG || aMaterial == Materials.HSSE @@ -4029,7 +1492,8 @@ public enum OrePrefixes { || aMaterial == Materials.Americium || aMaterial == Materials.WroughtIron || aMaterial == Materials.Magnalium - || aMaterial == Materials.TungstenSteel)) stickLong.mDisabledItems.add(aMaterial); + || aMaterial == Materials.TungstenSteel)) + stickLong.mDisabledItems.add(aMaterial); if (!enableUnusedGems && ((aMaterial.mTypes & 0x04) == 0)) { gem.mDisabledItems.add(aMaterial); @@ -4052,15 +1516,12 @@ public enum OrePrefixes { } if (enablePerItemSettings) { StringBuilder aConfigPathSB = new StringBuilder(); - aConfigPathSB - .append("materialcomponents.") - .append(aMaterial.mConfigSection) - .append(".") + aConfigPathSB.append("materialcomponents.").append(aMaterial.mConfigSection).append(".") .append(aMaterial.mName); String aConfigPath = aConfigPathSB.toString(); for (OrePrefixes aPrefix : mPreventableComponents) { - boolean aEnableComponent = GregTech_API.sMaterialComponents.get( - aConfigPath, aPrefix.toString(), !aPrefix.mDisabledItems.contains(aMaterial)); + boolean aEnableComponent = GregTech_API.sMaterialComponents + .get(aConfigPath, aPrefix.toString(), !aPrefix.mDisabledItems.contains(aMaterial)); if (!aEnableComponent) { // Disable component if false and is not already in disabled list aPrefix.disableComponent(aMaterial); } else if (aEnableComponent) { // Enable component if true and is not already in enabled list @@ -4082,15 +1543,14 @@ public enum OrePrefixes { } public static OrePrefixes getOrePrefix(String aOre) { - 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 == stickLong && aOre.equals("stickLongasssuperconductornameforuvwire")) return stick; - if (tPrefix == stickLong && aOre.equals("stickLongasssuperconductornameforuhvwire")) return stick; - return tPrefix; - } + 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 == stickLong && aOre.equals("stickLongasssuperconductornameforuvwire")) return stick; + if (tPrefix == stickLong && aOre.equals("stickLongasssuperconductornameforuhvwire")) return stick; + return tPrefix; + } return null; } @@ -4163,10 +1623,15 @@ public enum OrePrefixes { } public boolean doGenerateItem(Materials aMaterial) { - return aMaterial != null - && aMaterial != Materials._NULL - && ((aMaterial.mTypes & mMaterialGenerationBits) != 0 - || mGeneratedItems.contains(aMaterial) /*|| mDynamicItems.contains(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)); @@ -4206,10 +1671,14 @@ public enum OrePrefixes { && 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)); } } diff --git a/src/main/java/gregtech/api/enums/ParticleFX.java b/src/main/java/gregtech/api/enums/ParticleFX.java index 985ef3e4a8..c692598b89 100644 --- a/src/main/java/gregtech/api/enums/ParticleFX.java +++ b/src/main/java/gregtech/api/enums/ParticleFX.java @@ -4,6 +4,7 @@ package gregtech.api.enums; * Enumerates known EntityFX particles */ public enum ParticleFX { + HUGE_EXPLOSION("hugeexplosion"), LARGE_EXPLODE("largeexplode"), FIREWORKS_SPARK("fireworksSpark"), diff --git a/src/main/java/gregtech/api/enums/SoundResource.java b/src/main/java/gregtech/api/enums/SoundResource.java index 193aad3002..fe15c21deb 100644 --- a/src/main/java/gregtech/api/enums/SoundResource.java +++ b/src/main/java/gregtech/api/enums/SoundResource.java @@ -2,20 +2,25 @@ package gregtech.api.enums; 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 net.minecraft.util.ResourceLocation; +import com.google.common.collect.Maps; + /** * Enumerates known sounds with id and resource-location * - * <p>Note that the id serve no specific purpose, if for legacy compatibility of - * a plausible yet unimplemented network packet weight optimization.</p> + * <p> + * Note that the id serve no specific purpose, if for legacy compatibility of 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"), @@ -291,9 +296,7 @@ public enum SoundResource { private static final Map<String, SoundResource> RESOURCE_STR_SOUND_MAP = new ConcurrentHashMap<>(); static { - EnumSet.allOf(SoundResource.class).forEach(sound -> { - if (sound.id >= 0) ID_SOUND_MAP.put(sound.id, sound); - }); + EnumSet.allOf(SoundResource.class).forEach(sound -> { 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)); } @@ -342,7 +345,9 @@ public enum SoundResource { * * @return The map for the deprecated {@link gregtech.api.GregTech_API#sSoundList} * @deprecated This method is planned for removal. - * <p>Use this {@link SoundResource} enum instead.</p> + * <p> + * Use this {@link SoundResource} enum instead. + * </p> */ @Deprecated public static Map<Integer, String> asSoundList() { diff --git a/src/main/java/gregtech/api/enums/SteamVariant.java b/src/main/java/gregtech/api/enums/SteamVariant.java index 333f678900..941b0d7231 100644 --- a/src/main/java/gregtech/api/enums/SteamVariant.java +++ b/src/main/java/gregtech/api/enums/SteamVariant.java @@ -3,6 +3,7 @@ package gregtech.api.enums; import java.util.Locale; public enum SteamVariant { + BRONZE, STEEL, PRIMITIVE, diff --git a/src/main/java/gregtech/api/enums/SubTag.java b/src/main/java/gregtech/api/enums/SubTag.java index 610e4a637b..1298e74f34 100644 --- a/src/main/java/gregtech/api/enums/SubTag.java +++ b/src/main/java/gregtech/api/enums/SubTag.java @@ -1,55 +1,58 @@ 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; +import gregtech.api.interfaces.ICondition; +import gregtech.api.interfaces.ISubTagContainer; + /** * Just a simple Class to be able to add special Tags for Materials. * <p/> - * The Tags should be added in preload and before I do my own preload to the Materials. - * In order to make yourself a new SubTag, just create one new instance of SubTag using getNewSubTag - * and use that one instance on all Materials you want to add those Tags to. + * The Tags should be added in preload and before I do my own preload to the Materials. In order to make yourself a new + * SubTag, just create one new instance of SubTag using getNewSubTag and use that one instance on all Materials you want + * to add those Tags to. * <p/> * You should look at this File whenever you update, maybe there are some new Tags you could use. * <p/> * ------------------------------------------------------------------------------------------------- * <p/> - * Some SubTags are used for other things than Materials too. It is useful when I need an easy way to declare Stuff in Items. + * Some SubTags are used for other things than Materials too. It is useful when I need an easy way to declare Stuff in + * Items. */ public final class SubTag implements ICondition<ISubTagContainer> { + public static final HashMap<String, SubTag> sSubTags = new HashMap<>(); private static long sSubtagID = 0; public final long mSubtagID; public final String mName; /** - * 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. + * 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"); /** - * 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 + * 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"); /** - * Materials which are outputting less in an Induction Smelter. Already listed are: - * Pyrite, Tetrahedrite, Sphalerite, Cinnabar + * Materials which are outputting less in an Induction Smelter. Already listed are: Pyrite, Tetrahedrite, + * Sphalerite, Cinnabar */ public static final SubTag INDUCTIONSMELTING_LOW_OUTPUT = getNewSubTag("INDUCTIONSMELTING_LOW_OUTPUT"); /** - * Add this to your Material if you want to have its Ore Sodium Persulfate washed. Already listed are: - * Zinc, Nickel, Copper, Cobalt, Cobaltite and Tetrahedrite. + * Add this to your Material if you want to have its Ore Sodium Persulfate washed. Already listed are: Zinc, Nickel, + * Copper, Cobalt, Cobaltite and Tetrahedrite. */ public static final SubTag WASHING_SODIUMPERSULFATE = getNewSubTag("WASHING_SODIUMPERSULFATE"); /** - * Add this to your Material if you want to have its Ore Mercury washed. Already listed are: - * Gold, Osmium, Mithril, Platinum, Midasium, Cooperite and AstralSilver. + * Add this to your Material if you want to have its Ore Mercury washed. Already listed are: Gold, Osmium, Mithril, + * Platinum, Midasium, Cooperite and AstralSilver. */ public static final SubTag WASHING_MERCURY = getNewSubTag("WASHING_MERCURY"); /** @@ -68,11 +71,11 @@ 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 + * Add this to your Material if you want to have its Ore giving Cinnabar Crystals on Pulverization. Already listed + * are: Redstone */ public static final SubTag PULVERIZING_CINNABAR = getNewSubTag("PULVERIZING_CINNABAR"); /** @@ -80,8 +83,8 @@ public final class SubTag implements ICondition<ISubTagContainer> { */ public static final SubTag NO_WORKING = getNewSubTag("NO_WORKING"); /** - * This Material cannot be used for regular Metal working techniques since it is not possible to bend it. Already listed are: - * Rubber, Plastic, Paper, Wood, Stone + * This Material cannot be used for regular Metal working techniques since it is not possible to bend it. Already + * listed are: Rubber, Plastic, Paper, Wood, Stone */ public static final SubTag NO_SMASHING = getNewSubTag("NO_SMASHING"); /** @@ -93,13 +96,11 @@ public final class SubTag implements ICondition<ISubTagContainer> { */ public static final SubTag NO_UNIFICATION = getNewSubTag("NO_UNIFICATION"); /** - * This Material cannot be used in any Recycler. Already listed are: - * Stone, Glass, Water + * This Material cannot be used in any Recycler. Already listed are: Stone, Glass, Water */ public static final SubTag NO_RECYCLING = getNewSubTag("NO_RECYCLING"); /** - * This Material cannot be used in any Furnace alike Structure. Already listed are: - * Paper, Wood, Gunpowder, Stone + * This Material cannot be used in any Furnace alike Structure. Already listed are: Paper, Wood, Gunpowder, Stone */ public static final SubTag NO_SMELTING = getNewSubTag("NO_SMELTING"); /** @@ -204,39 +205,27 @@ public final class SubTag implements ICondition<ISubTagContainer> { */ public static final SubTag SOLDERING_MATERIAL_GOOD = getNewSubTag("SOLDERING_MATERIAL_GOOD"); /** - * Energy Tag for Electricity - * Primary = Voltage - * Secondary = Amperage + * Energy Tag for Electricity Primary = Voltage Secondary = Amperage */ public static final SubTag ENERGY_ELECTRICITY = getNewSubTag("ENERGY_ELECTRICITY"); /** - * Energy Tag for Rotating Power - * Primary = Speed - * Secondary = Power + * Energy Tag for Rotating Power Primary = Speed Secondary = Power */ public static final SubTag ENERGY_ROTATIONAL = getNewSubTag("ENERGY_ROTATIONAL"); /** - * Energy Tag for Steam Power - * Primary = Steam per Tick - * Secondary = unused (always 1) + * Energy Tag for Steam Power Primary = Steam per Tick Secondary = unused (always 1) */ public static final SubTag ENERGY_STEAM = getNewSubTag("ENERGY_STEAM"); /** - * Energy Tag for Air Pressure Power - * Primary = Pressure - * Secondary = unused (always 1) + * Energy Tag for Air Pressure Power Primary = Pressure Secondary = unused (always 1) */ public static final SubTag ENERGY_AIR = getNewSubTag("ENERGY_AIR"); /** - * Energy Tag for Heat - * Primary = Temperature - * Secondary = unused (always 1) + * Energy Tag for Heat Primary = Temperature Secondary = unused (always 1) */ public static final SubTag ENERGY_HEAT = getNewSubTag("ENERGY_HEAT"); /** - * Energy Tag for RedstoneFlux - * Primary = unused (always 1) - * Secondary = RF + * Energy Tag for RedstoneFlux Primary = unused (always 1) Secondary = RF */ public static final SubTag ENERGY_REDSTONE_FLUX = getNewSubTag("ENERGY_REDSTONE_FLUX"); /** @@ -263,10 +252,8 @@ public final class SubTag implements ICondition<ISubTagContainer> { } public SubTag addContainerToList(ISubTagContainer... aContainers) { - if (aContainers != null) - for (ISubTagContainer aContainer : aContainers) - if (aContainer != null && !mRelevantTaggedItems.contains(aContainer)) - mRelevantTaggedItems.add(aContainer); + if (aContainers != null) for (ISubTagContainer aContainer : aContainers) + if (aContainer != null && !mRelevantTaggedItems.contains(aContainer)) mRelevantTaggedItems.add(aContainer); 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 cb578cf870..7d0ca56fbf 100644 --- a/src/main/java/gregtech/api/enums/TC_Aspects.java +++ b/src/main/java/gregtech/api/enums/TC_Aspects.java @@ -3,6 +3,7 @@ package gregtech.api.enums; import java.util.List; public enum TC_Aspects { + AER(1), ALIENIS(20), AQUA(3), @@ -70,6 +71,7 @@ public enum TC_Aspects { } public static class TC_AspectStack { + public TC_Aspects mAspect; public long mAmount; @@ -88,24 +90,22 @@ public enum TC_Aspects { public List<TC_AspectStack> addToAspectList(List<TC_AspectStack> aList) { if (mAmount == 0) return aList; - for (TC_AspectStack tAspect : aList) - if (tAspect.mAspect == mAspect) { - tAspect.mAmount += mAmount; - return aList; - } + for (TC_AspectStack tAspect : aList) if (tAspect.mAspect == mAspect) { + tAspect.mAmount += mAmount; + return aList; + } aList.add(copy()); return aList; } public boolean removeFromAspectList(List<TC_AspectStack> aList) { - for (TC_AspectStack tAspect : aList) - if (tAspect.mAspect == mAspect) { - if (tAspect.mAmount >= mAmount) { - tAspect.mAmount -= mAmount; - if (tAspect.mAmount == 0) aList.remove(tAspect); - return true; - } + for (TC_AspectStack tAspect : aList) if (tAspect.mAspect == mAspect) { + if (tAspect.mAmount >= mAmount) { + tAspect.mAmount -= mAmount; + if (tAspect.mAmount == 0) aList.remove(tAspect); + return true; } + } return false; } } diff --git a/src/main/java/gregtech/api/enums/TextureSet.java b/src/main/java/gregtech/api/enums/TextureSet.java index b033e010d3..78829ca01f 100644 --- a/src/main/java/gregtech/api/enums/TextureSet.java +++ b/src/main/java/gregtech/api/enums/TextureSet.java @@ -3,311 +3,75 @@ package gregtech.api.enums; import gregtech.api.interfaces.IIconContainer; public class TextureSet { + private static final String aTextMatIconDir = "materialicons/"; private static final String aTextVoidDir = "/void"; - private static final TextureType[] IS_BLOCK_TEXTURE = new TextureType[] { - TextureType.ITEM, - TextureType.ITEM, - TextureType.ITEM, - TextureType.ITEM, - TextureType.ITEM, - TextureType.ITEM, - TextureType.ITEM, - TextureType.ITEM, - TextureType.ITEM, - TextureType.ITEM, - TextureType.ITEM, - TextureType.ITEM, - TextureType.ITEM, - TextureType.ITEM, - TextureType.ITEM, - TextureType.ITEM, - TextureType.ITEM, - TextureType.ITEM, - TextureType.ITEM, - TextureType.ITEM, - TextureType.ITEM, - TextureType.ITEM, - TextureType.ITEM, - TextureType.ITEM, - TextureType.ITEM, - TextureType.ITEM, - TextureType.ITEM, - TextureType.ITEM, - TextureType.ITEM, - TextureType.ITEM, - TextureType.ITEM, - TextureType.ITEM, - TextureType.ITEM, - TextureType.ITEM, - TextureType.ITEM, - TextureType.ITEM, - TextureType.ITEM, - TextureType.ITEM, - TextureType.ITEM, - TextureType.ITEM, - TextureType.ITEM, - TextureType.ITEM, - TextureType.ITEM, - TextureType.ITEM, - TextureType.ITEM, - TextureType.ITEM, - TextureType.ITEM, - TextureType.ITEM, - TextureType.ITEM, - TextureType.ITEM, - TextureType.ITEM, - TextureType.ITEM, - TextureType.ITEM, - TextureType.ITEM, - TextureType.ITEM, - TextureType.ITEM, - TextureType.ITEM, - TextureType.ITEM, - TextureType.ITEM, - TextureType.ITEM, - TextureType.ITEM, - TextureType.ITEM, - TextureType.ITEM, - TextureType.ITEM, - TextureType.BLOCK, - TextureType.BLOCK, - TextureType.BLOCK, - TextureType.BLOCK, - TextureType.BLOCK, - TextureType.BLOCK, - TextureType.BLOCK, - TextureType.BLOCK, - TextureType.BLOCK, - TextureType.BLOCK, - TextureType.BLOCK, - TextureType.BLOCK, - TextureType.BLOCK, - TextureType.BLOCK, - TextureType.BLOCK, - TextureType.BLOCK, - TextureType.BLOCK, - TextureType.BLOCK, - TextureType.BLOCK, - TextureType.BLOCK, - TextureType.BLOCK, - TextureType.BLOCK, - TextureType.BLOCK, - TextureType.BLOCK, - TextureType.BLOCK, - TextureType.BLOCK, - TextureType.BLOCK, - TextureType.BLOCK, - TextureType.BLOCK, - TextureType.BLOCK, - TextureType.BLOCK, - TextureType.BLOCK, - TextureType.ITEM, - TextureType.ITEM, - TextureType.ITEM, - TextureType.ITEM, - TextureType.ITEM, - TextureType.ITEM, - TextureType.ITEM, - TextureType.ITEM, - TextureType.ITEM, - TextureType.ITEM, - TextureType.ITEM, - TextureType.ITEM, - TextureType.ITEM, - TextureType.ITEM, - TextureType.ITEM, - TextureType.ITEM, - TextureType.ITEM, - TextureType.ITEM, - TextureType.ITEM, - TextureType.ITEM, - TextureType.ITEM, - TextureType.ITEM, - TextureType.ITEM, - TextureType.ITEM, - TextureType.ITEM, - TextureType.ITEM, - TextureType.ITEM, - TextureType.ITEM, - TextureType.ITEM, - TextureType.ITEM, - TextureType.ITEM, - TextureType.ITEM, - }; - private static final String[] SUFFIXES = new String[] { - "/dustTiny", - "/dustSmall", - "/dust", - "/dustImpure", - "/dustPure", - "/crushed", - "/crushedPurified", - "/crushedCentrifuged", - "/gem", - "/nugget", - "/casingSmall", - "/ingot", - "/ingotHot", - "/ingotDouble", - "/ingotTriple", - "/ingotQuadruple", - "/ingotQuintuple", - "/plate", - "/plateDouble", - "/plateTriple", - "/plateQuadruple", - "/plateQuintuple", - "/plateDense", - "/stick", - "/lens", - "/round", - "/bolt", - "/screw", - "/ring", - "/foil", - "/cell", - "/cellPlasma", - "/toolHeadSword", - "/toolHeadPickaxe", - "/toolHeadShovel", - "/toolHeadAxe", - "/toolHeadHoe", - "/toolHeadHammer", - "/toolHeadFile", - "/toolHeadSaw", - "/toolHeadDrill", - "/toolHeadChainsaw", - "/toolHeadWrench", - "/toolHeadUniversalSpade", - "/toolHeadSense", - "/toolHeadPlow", - "/toolHeadArrow", - "/toolHeadScrewdriver", - "/toolHeadBuzzSaw", - "/toolHeadSoldering", - "/nanites", - "/wireFine", - "/gearGtSmall", - "/rotor", - "/stickLong", - "/springSmall", - "/spring", - "/arrowGtWood", - "/arrowGtPlastic", - "/gemChipped", - "/gemFlawed", - "/gemFlawless", - "/gemExquisite", - "/gearGt", - aTextVoidDir, - aTextVoidDir, - aTextVoidDir, - "/oreSmall", - "/ore", - "/wire", - "/foil", - "/block1", - "/block2", - "/block3", - "/block4", - "/block5", - "/block6", - "/pipeSide", - "/pipeTiny", - "/pipeSmall", - "/pipeMedium", - "/pipeLarge", - "/pipeHuge", - "/frameGt", - "/pipeQuadruple", - "/pipeNonuple", - aTextVoidDir, - aTextVoidDir, - aTextVoidDir, - aTextVoidDir, - aTextVoidDir, - aTextVoidDir, - aTextVoidDir, - aTextVoidDir, - aTextVoidDir, - aTextVoidDir, - "/crateGtDust", - "/crateGtIngot", - "/crateGtGem", - "/crateGtPlate", - "/turbineBlade", - aTextVoidDir, - aTextVoidDir, - aTextVoidDir, - aTextVoidDir, - aTextVoidDir, - aTextVoidDir, - aTextVoidDir, - aTextVoidDir, - aTextVoidDir, - aTextVoidDir, - aTextVoidDir, - aTextVoidDir, - aTextVoidDir, - aTextVoidDir, - aTextVoidDir, - aTextVoidDir, - aTextVoidDir, - aTextVoidDir, - aTextVoidDir, - aTextVoidDir, - aTextVoidDir, - aTextVoidDir, - aTextVoidDir, - aTextVoidDir, - aTextVoidDir, - "/handleMallet", - "/toolHeadMallet", - }; + private static final TextureType[] IS_BLOCK_TEXTURE = new TextureType[] { TextureType.ITEM, TextureType.ITEM, + TextureType.ITEM, TextureType.ITEM, TextureType.ITEM, TextureType.ITEM, TextureType.ITEM, TextureType.ITEM, + TextureType.ITEM, TextureType.ITEM, TextureType.ITEM, TextureType.ITEM, TextureType.ITEM, TextureType.ITEM, + TextureType.ITEM, TextureType.ITEM, TextureType.ITEM, TextureType.ITEM, TextureType.ITEM, TextureType.ITEM, + TextureType.ITEM, TextureType.ITEM, TextureType.ITEM, TextureType.ITEM, TextureType.ITEM, TextureType.ITEM, + TextureType.ITEM, TextureType.ITEM, TextureType.ITEM, TextureType.ITEM, TextureType.ITEM, TextureType.ITEM, + TextureType.ITEM, TextureType.ITEM, TextureType.ITEM, TextureType.ITEM, TextureType.ITEM, TextureType.ITEM, + TextureType.ITEM, TextureType.ITEM, TextureType.ITEM, TextureType.ITEM, TextureType.ITEM, TextureType.ITEM, + TextureType.ITEM, TextureType.ITEM, TextureType.ITEM, TextureType.ITEM, TextureType.ITEM, TextureType.ITEM, + TextureType.ITEM, TextureType.ITEM, TextureType.ITEM, TextureType.ITEM, TextureType.ITEM, TextureType.ITEM, + TextureType.ITEM, TextureType.ITEM, TextureType.ITEM, TextureType.ITEM, TextureType.ITEM, TextureType.ITEM, + TextureType.ITEM, TextureType.ITEM, TextureType.BLOCK, TextureType.BLOCK, TextureType.BLOCK, + TextureType.BLOCK, TextureType.BLOCK, TextureType.BLOCK, TextureType.BLOCK, TextureType.BLOCK, + TextureType.BLOCK, TextureType.BLOCK, TextureType.BLOCK, TextureType.BLOCK, TextureType.BLOCK, + TextureType.BLOCK, TextureType.BLOCK, TextureType.BLOCK, TextureType.BLOCK, TextureType.BLOCK, + TextureType.BLOCK, TextureType.BLOCK, TextureType.BLOCK, TextureType.BLOCK, TextureType.BLOCK, + TextureType.BLOCK, TextureType.BLOCK, TextureType.BLOCK, TextureType.BLOCK, TextureType.BLOCK, + TextureType.BLOCK, TextureType.BLOCK, TextureType.BLOCK, TextureType.BLOCK, TextureType.ITEM, + TextureType.ITEM, TextureType.ITEM, TextureType.ITEM, TextureType.ITEM, TextureType.ITEM, TextureType.ITEM, + TextureType.ITEM, TextureType.ITEM, TextureType.ITEM, TextureType.ITEM, TextureType.ITEM, TextureType.ITEM, + TextureType.ITEM, TextureType.ITEM, TextureType.ITEM, TextureType.ITEM, TextureType.ITEM, TextureType.ITEM, + TextureType.ITEM, TextureType.ITEM, TextureType.ITEM, TextureType.ITEM, TextureType.ITEM, TextureType.ITEM, + TextureType.ITEM, TextureType.ITEM, TextureType.ITEM, TextureType.ITEM, TextureType.ITEM, TextureType.ITEM, + TextureType.ITEM, }; + private static final String[] SUFFIXES = new String[] { "/dustTiny", "/dustSmall", "/dust", "/dustImpure", + "/dustPure", "/crushed", "/crushedPurified", "/crushedCentrifuged", "/gem", "/nugget", "/casingSmall", + "/ingot", "/ingotHot", "/ingotDouble", "/ingotTriple", "/ingotQuadruple", "/ingotQuintuple", "/plate", + "/plateDouble", "/plateTriple", "/plateQuadruple", "/plateQuintuple", "/plateDense", "/stick", "/lens", + "/round", "/bolt", "/screw", "/ring", "/foil", "/cell", "/cellPlasma", "/toolHeadSword", "/toolHeadPickaxe", + "/toolHeadShovel", "/toolHeadAxe", "/toolHeadHoe", "/toolHeadHammer", "/toolHeadFile", "/toolHeadSaw", + "/toolHeadDrill", "/toolHeadChainsaw", "/toolHeadWrench", "/toolHeadUniversalSpade", "/toolHeadSense", + "/toolHeadPlow", "/toolHeadArrow", "/toolHeadScrewdriver", "/toolHeadBuzzSaw", "/toolHeadSoldering", + "/nanites", "/wireFine", "/gearGtSmall", "/rotor", "/stickLong", "/springSmall", "/spring", "/arrowGtWood", + "/arrowGtPlastic", "/gemChipped", "/gemFlawed", "/gemFlawless", "/gemExquisite", "/gearGt", aTextVoidDir, + aTextVoidDir, aTextVoidDir, "/oreSmall", "/ore", "/wire", "/foil", "/block1", "/block2", "/block3", + "/block4", "/block5", "/block6", "/pipeSide", "/pipeTiny", "/pipeSmall", "/pipeMedium", "/pipeLarge", + "/pipeHuge", "/frameGt", "/pipeQuadruple", "/pipeNonuple", aTextVoidDir, aTextVoidDir, aTextVoidDir, + aTextVoidDir, aTextVoidDir, aTextVoidDir, aTextVoidDir, aTextVoidDir, aTextVoidDir, aTextVoidDir, + "/crateGtDust", "/crateGtIngot", "/crateGtGem", "/crateGtPlate", "/turbineBlade", aTextVoidDir, + aTextVoidDir, aTextVoidDir, aTextVoidDir, aTextVoidDir, aTextVoidDir, aTextVoidDir, aTextVoidDir, + aTextVoidDir, aTextVoidDir, aTextVoidDir, aTextVoidDir, aTextVoidDir, aTextVoidDir, aTextVoidDir, + aTextVoidDir, aTextVoidDir, aTextVoidDir, aTextVoidDir, aTextVoidDir, aTextVoidDir, aTextVoidDir, + aTextVoidDir, aTextVoidDir, aTextVoidDir, "/handleMallet", "/toolHeadMallet", }; public boolean is_custom = false; - public static final TextureSet SET_NONE = new TextureSet("NONE"), - SET_DULL = new TextureSet("DULL"), - SET_RUBY = new TextureSet("RUBY"), - SET_OPAL = new TextureSet("OPAL"), - SET_LEAF = new TextureSet("LEAF"), - SET_WOOD = new TextureSet("WOOD"), - SET_SAND = new TextureSet("SAND"), - SET_FINE = new TextureSet("FINE"), - SET_FIERY = new TextureSet("FIERY"), - SET_FLUID = new TextureSet("FLUID"), - SET_ROUGH = new TextureSet("ROUGH"), - SET_PAPER = new TextureSet("PAPER"), - SET_GLASS = new TextureSet("GLASS"), - SET_FLINT = new TextureSet("FLINT"), - SET_LAPIS = new TextureSet("LAPIS"), - SET_SHINY = new TextureSet("SHINY"), - SET_SHARDS = new TextureSet("SHARDS"), - SET_POWDER = new TextureSet("POWDER"), - SET_QUARTZ = new TextureSet("QUARTZ"), - SET_EMERALD = new TextureSet("EMERALD"), - SET_DIAMOND = new TextureSet("DIAMOND"), - SET_LIGNITE = new TextureSet("LIGNITE"), - SET_MAGNETIC = new TextureSet("MAGNETIC"), - SET_METALLIC = new TextureSet("METALLIC"), - SET_NETHERSTAR = new TextureSet("NETHERSTAR"), - SET_GEM_VERTICAL = new TextureSet("GEM_VERTICAL"), + public static final TextureSet SET_NONE = new TextureSet("NONE"), SET_DULL = new TextureSet("DULL"), + SET_RUBY = new TextureSet("RUBY"), SET_OPAL = new TextureSet("OPAL"), SET_LEAF = new TextureSet("LEAF"), + SET_WOOD = new TextureSet("WOOD"), SET_SAND = new TextureSet("SAND"), SET_FINE = new TextureSet("FINE"), + SET_FIERY = new TextureSet("FIERY"), SET_FLUID = new TextureSet("FLUID"), + SET_ROUGH = new TextureSet("ROUGH"), SET_PAPER = new TextureSet("PAPER"), + SET_GLASS = new TextureSet("GLASS"), SET_FLINT = new TextureSet("FLINT"), + SET_LAPIS = new TextureSet("LAPIS"), SET_SHINY = new TextureSet("SHINY"), + SET_SHARDS = new TextureSet("SHARDS"), SET_POWDER = new TextureSet("POWDER"), + SET_QUARTZ = new TextureSet("QUARTZ"), SET_EMERALD = new TextureSet("EMERALD"), + SET_DIAMOND = new TextureSet("DIAMOND"), SET_LIGNITE = new TextureSet("LIGNITE"), + SET_MAGNETIC = new TextureSet("MAGNETIC"), SET_METALLIC = new TextureSet("METALLIC"), + SET_NETHERSTAR = new TextureSet("NETHERSTAR"), SET_GEM_VERTICAL = new TextureSet("GEM_VERTICAL"), SET_GEM_HORIZONTAL = new TextureSet("GEM_HORIZONTAL"); /** * For the Indices of OrePrefixes you need to look into the OrePrefix Enum. */ - public static final short INDEX_wire = 69, - INDEX_foil = 70, - INDEX_block1 = 71, - INDEX_block2 = 72, - INDEX_block3 = 73, - INDEX_block4 = 74, - INDEX_block5 = 75, - INDEX_block6 = 76; + public static final short INDEX_wire = 69, INDEX_foil = 70, INDEX_block1 = 71, INDEX_block2 = 72, INDEX_block3 = 73, + INDEX_block4 = 74, INDEX_block5 = 75, INDEX_block6 = 76; public final IIconContainer[] mTextures = new IIconContainer[128]; public final String mSetName; diff --git a/src/main/java/gregtech/api/enums/Textures.java b/src/main/java/gregtech/api/enums/Textures.java index 13a2ac8490..d3778a6253 100644 --- a/src/main/java/gregtech/api/enums/Textures.java +++ b/src/main/java/gregtech/api/enums/Textures.java @@ -3,19 +3,23 @@ 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 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; + public class Textures { + public enum BlockIcons implements IIconContainer, Runnable { + // ADDED MACHINE_UEV_SIDE, MACHINE_UIV_SIDE, @@ -1340,767 +1344,309 @@ public class Textures { LARGETURBINE_NEW_EMPTY6, LARGETURBINE_NEW_EMPTY7, LARGETURBINE_NEW_EMPTY8, - LARGETURBINE_NEW_EMPTY9, - ; + LARGETURBINE_NEW_EMPTY9,; + /** * Icon for Fresh CFoam */ - public static final ITexture[] FRESHFOAM = {TextureFactory.of(CFOAM_FRESH)}; + public static final ITexture[] FRESHFOAM = { TextureFactory.of(CFOAM_FRESH) }; /** - * Icons for Hardened CFoam - * 0 = No Color - * 1 - 16 = Colors + * Icons for Hardened CFoam 0 = No Color 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 + * 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 - }, - TURBINE_NEW = - { - LARGETURBINE_NEW1, - LARGETURBINE_NEW2, - LARGETURBINE_NEW3, - LARGETURBINE_NEW4, - LARGETURBINE_NEW5, - LARGETURBINE_NEW6, - LARGETURBINE_NEW7, - LARGETURBINE_NEW8, - LARGETURBINE_NEW9 - }, - TURBINE_NEW_ACTIVE = - { - LARGETURBINE_NEW_ACTIVE1, - LARGETURBINE_NEW_ACTIVE2, - LARGETURBINE_NEW_ACTIVE3, - LARGETURBINE_NEW_ACTIVE4, - LARGETURBINE_NEW_ACTIVE5, - LARGETURBINE_NEW_ACTIVE6, - LARGETURBINE_NEW_ACTIVE7, - LARGETURBINE_NEW_ACTIVE8, - LARGETURBINE_NEW_ACTIVE9 - }, - TURBINE_NEW_EMPTY = - { - LARGETURBINE_NEW_EMPTY1, - LARGETURBINE_NEW_EMPTY2, - LARGETURBINE_NEW_EMPTY3, - LARGETURBINE_NEW_EMPTY4, - LARGETURBINE_NEW_EMPTY5, - LARGETURBINE_NEW_EMPTY6, - LARGETURBINE_NEW_EMPTY7, - LARGETURBINE_NEW_EMPTY8, - LARGETURBINE_NEW_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, - BLOCK_TRANSCENDENTMETAL, - BLOCK_ORIHARUKON, - BLOCK_WHITEDWARFMATTER, - BLOCK_BLACKDWARFMATTER, - }; + 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 }, + TURBINE_NEW = { LARGETURBINE_NEW1, LARGETURBINE_NEW2, LARGETURBINE_NEW3, LARGETURBINE_NEW4, + LARGETURBINE_NEW5, LARGETURBINE_NEW6, LARGETURBINE_NEW7, LARGETURBINE_NEW8, LARGETURBINE_NEW9 }, + TURBINE_NEW_ACTIVE = { LARGETURBINE_NEW_ACTIVE1, LARGETURBINE_NEW_ACTIVE2, LARGETURBINE_NEW_ACTIVE3, + LARGETURBINE_NEW_ACTIVE4, LARGETURBINE_NEW_ACTIVE5, LARGETURBINE_NEW_ACTIVE6, + LARGETURBINE_NEW_ACTIVE7, LARGETURBINE_NEW_ACTIVE8, LARGETURBINE_NEW_ACTIVE9 }, + TURBINE_NEW_EMPTY = { LARGETURBINE_NEW_EMPTY1, LARGETURBINE_NEW_EMPTY2, LARGETURBINE_NEW_EMPTY3, + LARGETURBINE_NEW_EMPTY4, LARGETURBINE_NEW_EMPTY5, LARGETURBINE_NEW_EMPTY6, + LARGETURBINE_NEW_EMPTY7, LARGETURBINE_NEW_EMPTY8, LARGETURBINE_NEW_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, + BLOCK_TRANSCENDENTMETAL, BLOCK_ORIHARUKON, BLOCK_WHITEDWARFMATTER, BLOCK_BLACKDWARFMATTER, }; public static final ITexture[] HIDDEN_TEXTURE = { - TextureFactory.builder().addIcon(HIDDEN_FACE).stdOrient().build() - }; - public static final ITexture[] ERROR_RENDERING = {TextureFactory.of(RENDERING_ERROR)}; + TextureFactory.builder().addIcon(HIDDEN_FACE).stdOrient().build() }; + public static final ITexture[] ERROR_RENDERING = { TextureFactory.of(RENDERING_ERROR) }; public static final ITexture[] OVERLAYS_ENERGY_IN = { - TextureFactory.of(OVERLAY_ENERGY_IN, new short[] {180, 180, 180, 0}), - 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}), - }; - public static final ITexture[] LOCKERS = { - TextureFactory.of(OVERLAY_LOCKER_000), - TextureFactory.of(OVERLAY_LOCKER_001), - TextureFactory.of(OVERLAY_LOCKER_002), - TextureFactory.of(OVERLAY_LOCKER_003), - TextureFactory.of(OVERLAY_LOCKER_004), - TextureFactory.of(OVERLAY_LOCKER_005), - TextureFactory.of(OVERLAY_LOCKER_006), - TextureFactory.of(OVERLAY_LOCKER_007), - TextureFactory.of(OVERLAY_LOCKER_008), - TextureFactory.of(OVERLAY_LOCKER_009), - TextureFactory.of(OVERLAY_LOCKER_010), - TextureFactory.of(OVERLAY_LOCKER_011), - TextureFactory.of(OVERLAY_LOCKER_012), - TextureFactory.of(OVERLAY_LOCKER_013), - }; + 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), + TextureFactory.of(OVERLAY_LOCKER_001), TextureFactory.of(OVERLAY_LOCKER_002), + TextureFactory.of(OVERLAY_LOCKER_003), TextureFactory.of(OVERLAY_LOCKER_004), + TextureFactory.of(OVERLAY_LOCKER_005), TextureFactory.of(OVERLAY_LOCKER_006), + TextureFactory.of(OVERLAY_LOCKER_007), TextureFactory.of(OVERLAY_LOCKER_008), + TextureFactory.of(OVERLAY_LOCKER_009), TextureFactory.of(OVERLAY_LOCKER_010), + TextureFactory.of(OVERLAY_LOCKER_011), TextureFactory.of(OVERLAY_LOCKER_012), + TextureFactory.of(OVERLAY_LOCKER_013), }; /** * USE casingTexturePages[page] instead of CASING_BLOCKS since it is casingTexturePages[0] */ @@ -2109,28 +1655,23 @@ public class Textures { public static ITexture[][] MACHINE_CASINGS = new ITexture[15][17]; /** - * by Default pages are null - * page 0: 0-63 GT casing 1-4, 64-127 GT++ - * page 1: 0-15 GT casing 5, 22-26 GS dyson swarm, 48-57 GT casing 8, 63 EMT, 80-95 GT reinforced blocks, - * 96 casing 2 meta 6, 97 error casing - * page 8: 0-111 TecTech, 112-127 GT casing 6 - * page 12: 0-127 GlodBlock - * page 42: 0-126 glee8e, 127 KekzTech LSC base + * by Default pages are null page 0: 0-63 GT casing 1-4, 64-127 GT++ page 1: 0-15 GT casing 5, 22-26 GS dyson + * swarm, 48-57 GT casing 8, 63 EMT, 80-95 GT reinforced blocks, 96 casing 2 meta 6, 97 error casing page 8: + * 0-111 TecTech, 112-127 GT casing 6 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<>(); static { 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)); + 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)); casingTexturePages[0] = new ITexture[128]; // adds some known pages, modders also can do it... GT_Utility.addTexturePage((byte) 1); @@ -2186,6 +1727,7 @@ public class Textures { } public static class CustomIcon implements IIconContainer, Runnable { + protected IIcon mIcon; protected String mIconName; @@ -2217,6 +1759,7 @@ public class Textures { } public enum ItemIcons implements IIconContainer, Runnable { + VOID, // The Empty Texture RENDERING_ERROR, WRENCH, @@ -2272,33 +1815,14 @@ public class Textures { POCKET_MULTITOOL_WIRECUTTER, HALO, HALO_FUZZY; - 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, - }; - - public static final ITexture[] ERROR_RENDERING = {TextureFactory.of(RENDERING_ERROR)}; + + 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, }; + + public static final ITexture[] ERROR_RENDERING = { TextureFactory.of(RENDERING_ERROR) }; protected IIcon mIcon, mOverlay; @@ -2328,6 +1852,7 @@ public class Textures { } public static class CustomIcon implements IIconContainer, Runnable { + protected IIcon mIcon, mOverlay; protected String mIconName; diff --git a/src/main/java/gregtech/api/enums/Tier.java b/src/main/java/gregtech/api/enums/Tier.java index 766c381041..3af005750b 100644 --- a/src/main/java/gregtech/api/enums/Tier.java +++ b/src/main/java/gregtech/api/enums/Tier.java @@ -7,448 +7,441 @@ 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)), + 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)), - // 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 */ @@ -459,19 +452,9 @@ public class Tier { 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/TierEU.java b/src/main/java/gregtech/api/enums/TierEU.java index 0c920c1bb0..419580f92d 100644 --- a/src/main/java/gregtech/api/enums/TierEU.java +++ b/src/main/java/gregtech/api/enums/TierEU.java @@ -23,7 +23,7 @@ public class TierEU { public static final long UXV = V[13]; public static final long MAX = V[14]; - // Use me for recipes. + // Use me for recipes. public static final long RECIPE_ULV = GT_Values.VP[0]; public static final long RECIPE_LV = GT_Values.VP[1]; public static final long RECIPE_MV = GT_Values.VP[2]; diff --git a/src/main/java/gregtech/api/enums/ToolDictNames.java b/src/main/java/gregtech/api/enums/ToolDictNames.java index 27e297de5e..9b1c3e594a 100644 --- a/src/main/java/gregtech/api/enums/ToolDictNames.java +++ b/src/main/java/gregtech/api/enums/ToolDictNames.java @@ -1,6 +1,7 @@ package gregtech.api.enums; public enum ToolDictNames { + craftingToolSaw, craftingToolHoe, craftingToolAxe, diff --git a/src/main/java/gregtech/api/events/BlockScanningEvent.java b/src/main/java/gregtech/api/events/BlockScanningEvent.java index 85d2e3e07a..9d7500a8b0 100644 --- a/src/main/java/gregtech/api/events/BlockScanningEvent.java +++ b/src/main/java/gregtech/api/events/BlockScanningEvent.java @@ -1,13 +1,15 @@ 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 cpw.mods.fml.common.eventhandler.Cancelable; + @Cancelable public class BlockScanningEvent extends WorldEvent { @@ -24,19 +26,8 @@ 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, + 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; diff --git a/src/main/java/gregtech/api/fluid/FluidTankGT.java b/src/main/java/gregtech/api/fluid/FluidTankGT.java index 93b3c87575..f10e65d100 100644 --- a/src/main/java/gregtech/api/fluid/FluidTankGT.java +++ b/src/main/java/gregtech/api/fluid/FluidTankGT.java @@ -2,16 +2,19 @@ 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 gregtech.api.util.GT_Utility; + public class FluidTankGT implements IFluidTank { - public final FluidTankGT[] AS_ARRAY = new FluidTankGT[] {this}; + + public final FluidTankGT[] AS_ARRAY = new FluidTankGT[] { this }; private FluidStack mFluid; private long mCapacity = 0, mAmount = 0; private boolean mPreventDraining = false, mVoidExcess = false, mChangedFluids = false; @@ -191,18 +194,15 @@ public class FluidTankGT implements IFluidTank { return mVoidExcess ? aFluid.amount : (int) tFilled; } return saturatedCast( - isEmpty() - ? mVoidExcess ? aFluid.amount : Math.min(capacity(aFluid), aFluid.amount) + 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) + return aFluid == null || aFluid.amount <= 0 + || (isEmpty() ? mVoidExcess || aFluid.amount <= capacity(aFluid) : contains(aFluid) && (mVoidExcess || mAmount + aFluid.amount <= capacity(aFluid))); } @@ -263,6 +263,7 @@ public class FluidTankGT implements IFluidTank { } return false; } + /** Resets Tank Contents entirely */ public FluidTankGT setEmpty() { mFluid = null; @@ -271,7 +272,7 @@ public class FluidTankGT implements IFluidTank { return this; } - /** Sets Fluid Content, taking Amount from the Fluid Parameter */ + /** Sets Fluid Content, taking Amount from the Fluid Parameter */ public FluidTankGT setFluid(FluidStack aFluid) { mFluid = aFluid; mChangedFluids = true; @@ -287,7 +288,7 @@ public class FluidTankGT implements IFluidTank { return this; } - /** Sets Fluid Content, taking Amount from the Tank Parameter */ + /** Sets Fluid Content, taking Amount from the Tank Parameter */ public FluidTankGT setFluid(FluidTankGT aTank) { mFluid = new FluidStack(aTank.mFluid, saturatedCast(aTank.mAmount)); mChangedFluids = true; @@ -306,7 +307,8 @@ public class FluidTankGT implements IFluidTank { if (aCapacity >= 0) mCapacity = aCapacity; return this; } - /** Sets the Capacity Multiplier */ + + /** Sets the Capacity Multiplier */ public FluidTankGT setCapacityMultiplier(long aCapacityMultiplier) { if (aCapacityMultiplier >= 0) mAdjustableMultiplier = aCapacityMultiplier; return this; @@ -363,8 +365,7 @@ public class FluidTankGT implements IFluidTank { if (mAdjustableCapacity == null || aFluid == null) return mCapacity; final Long tSize = mAdjustableCapacity.get(aFluid); - return tSize == null - ? Math.max(mAmount, mCapacity) + return tSize == null ? Math.max(mAmount, mCapacity) : Math.max(tSize * mAdjustableMultiplier, Math.max(mAmount, mCapacity)); } diff --git a/src/main/java/gregtech/api/fluid/GT_FluidFactory.java b/src/main/java/gregtech/api/fluid/GT_FluidFactory.java index 1622aa2e05..b392167147 100644 --- a/src/main/java/gregtech/api/fluid/GT_FluidFactory.java +++ b/src/main/java/gregtech/api/fluid/GT_FluidFactory.java @@ -1,32 +1,42 @@ package gregtech.api.fluid; +import net.minecraftforge.fluids.Fluid; +import net.minecraftforge.fluids.FluidContainerRegistry; +import net.minecraftforge.fluids.FluidRegistry; + import gregtech.api.enums.FluidState; import gregtech.api.enums.Materials; import gregtech.api.interfaces.fluid.IGT_Fluid; import gregtech.api.interfaces.fluid.IGT_FluidBuilder; import gregtech.common.fluid.GT_FluidBuilder; -import net.minecraftforge.fluids.Fluid; -import net.minecraftforge.fluids.FluidContainerRegistry; -import net.minecraftforge.fluids.FluidRegistry; /** - * <p>This class contains helpers factory methods to:</p> + * <p> + * This class contains helpers factory methods to: + * </p> * <ol> - * <li> - * <p>Build {@link IGT_Fluid} instances.</p> - * </li> - * <li> - * <p>Register the corresponding {@link Fluid}, built from an {@link IGT_Fluid}, - * to the {@link FluidRegistry}:</p> - * <ul> - * <li> - * <p>Register the optionally associated containers to the {@link FluidContainerRegistry}.</p> - * </li> - * <li> - * <p>Add the needed Fluid Canner recipes.</p> - * </li> - * </ul> - * </li> + * <li> + * <p> + * Build {@link IGT_Fluid} instances. + * </p> + * </li> + * <li> + * <p> + * Register the corresponding {@link Fluid}, built from an {@link IGT_Fluid}, to the {@link FluidRegistry}: + * </p> + * <ul> + * <li> + * <p> + * Register the optionally associated containers to the {@link FluidContainerRegistry}. + * </p> + * </li> + * <li> + * <p> + * Add the needed Fluid Canner recipes. + * </p> + * </li> + * </ul> + * </li> * </ol> */ @SuppressWarnings("unused") // API might legitimately expose unused methods within this local project's scope @@ -34,46 +44,38 @@ public class GT_FluidFactory { /** * Helper for quick fluid creation and registration - * @param fluidName The name key of the {@link Fluid} to register in the {@link FluidRegistry} + * + * @param fluidName The name key of the {@link Fluid} to register in the {@link FluidRegistry} * @param localizedName The localized name of this {@link IGT_Fluid} - * @param material The {@link Materials} of this {@link IGT_Fluid} - * @param state The {@link FluidState} of this {@link IGT_Fluid} - * @param temperature The fluid temperature in Kelvin + * @param material The {@link Materials} of this {@link IGT_Fluid} + * @param state The {@link FluidState} of this {@link IGT_Fluid} + * @param temperature The fluid temperature in Kelvin * @return the registered {@link Fluid} */ - public static Fluid of( - final String fluidName, - final String localizedName, - final Materials material, - final FluidState state, - final int temperature) { - return builder(fluidName) - .withLocalizedName(localizedName) - .withStateAndTemperature(state, temperature) - .buildAndRegister() - .configureMaterials(material) - .asFluid(); + public static Fluid of(final String fluidName, final String localizedName, final Materials material, + final FluidState state, final int temperature) { + return builder(fluidName).withLocalizedName(localizedName).withStateAndTemperature(state, temperature) + .buildAndRegister().configureMaterials(material).asFluid(); } /** * Helper for quick fluid creation and registration - * @param fluidName The name key of the {@link Fluid} to register in the {@link FluidRegistry} + * + * @param fluidName The name key of the {@link Fluid} to register in the {@link FluidRegistry} * @param localizedName The localized name of this {@link IGT_Fluid} - * @param state The {@link FluidState} of this {@link IGT_Fluid} - * @param temperature The fluid temperature in Kelvin + * @param state The {@link FluidState} of this {@link IGT_Fluid} + * @param temperature The fluid temperature in Kelvin * @return the registered {@link Fluid} */ - public static Fluid of( - final String fluidName, final String localizedName, final FluidState state, final int temperature) { - return builder(fluidName) - .withLocalizedName(localizedName) - .withStateAndTemperature(state, temperature) - .buildAndRegister() - .asFluid(); + public static Fluid of(final String fluidName, final String localizedName, final FluidState state, + final int temperature) { + return builder(fluidName).withLocalizedName(localizedName).withStateAndTemperature(state, temperature) + .buildAndRegister().asFluid(); } /** * Gets an {@link IGT_Fluid} builder instance + * * @param fluidName The name key of the {@link Fluid} to register in the {@link FluidRegistry} * @return the {@link IGT_FluidBuilder} instance */ diff --git a/src/main/java/gregtech/api/graphs/GenerateNodeMap.java b/src/main/java/gregtech/api/graphs/GenerateNodeMap.java index 8085421576..fba74b0aec 100644 --- a/src/main/java/gregtech/api/graphs/GenerateNodeMap.java +++ b/src/main/java/gregtech/api/graphs/GenerateNodeMap.java @@ -3,16 +3,19 @@ package gregtech.api.graphs; import static gregtech.api.enums.GT_Values.ALL_VALID_SIDES; import static gregtech.api.util.GT_Utility.getOppositeSide; +import java.util.ArrayList; +import java.util.HashSet; + +import net.minecraft.tileentity.TileEntity; + import gregtech.api.graphs.consumers.ConsumerNode; import gregtech.api.graphs.paths.NodePath; import gregtech.api.metatileentity.BaseMetaPipeEntity; import gregtech.api.metatileentity.MetaPipeEntity; -import java.util.ArrayList; -import java.util.HashSet; -import net.minecraft.tileentity.TileEntity; // generates the node map 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) { @@ -47,13 +50,8 @@ public abstract 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) { final MetaPipeEntity tMetaPipe = (MetaPipeEntity) aPipe.getMetaTileEntity(); for (byte side : ALL_VALID_SIDES) { if (side == aInvalidSide) { @@ -86,14 +84,8 @@ public abstract 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; final byte tSideOp = getOppositeSide(aSide); final byte tInvalidSide = aPreviousNode == null ? -1 : tSideOp; @@ -111,7 +103,7 @@ public abstract 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; @@ -138,8 +130,8 @@ public abstract 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)) { final BaseMetaPipeEntity tPipe = (BaseMetaPipeEntity) aTileEntity; final MetaPipeEntity tMetaPipe = (MetaPipeEntity) tPipe.getMetaTileEntity(); @@ -176,15 +168,15 @@ public abstract class GenerateNodeMap { } // checks if the tile entity is a consumer and add to the list - protected abstract 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 + // 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; } @@ -194,6 +186,7 @@ public abstract class GenerateNodeMap { } private static class Pair { + public byte mSide; public TileEntity mTileEntity; diff --git a/src/main/java/gregtech/api/graphs/GenerateNodeMapPower.java b/src/main/java/gregtech/api/graphs/GenerateNodeMapPower.java index 293a46502a..62dfa2d8ea 100644 --- a/src/main/java/gregtech/api/graphs/GenerateNodeMapPower.java +++ b/src/main/java/gregtech/api/graphs/GenerateNodeMapPower.java @@ -1,5 +1,11 @@ package gregtech.api.graphs; +import java.util.ArrayList; +import java.util.HashSet; + +import net.minecraft.tileentity.TileEntity; +import net.minecraftforge.common.util.ForgeDirection; + import cofh.api.energy.IEnergyReceiver; import gregtech.api.GregTech_API; import gregtech.api.graphs.consumers.ConsumerNode; @@ -16,13 +22,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 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 { + public GenerateNodeMapPower(BaseMetaPipeEntity aTileEntity) { generateNode(aTileEntity, null, 1, null, -1, new ArrayList<>(), new HashSet<>()); } @@ -34,8 +37,8 @@ public class GenerateNodeMapPower extends GenerateNodeMap { } @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)) { @@ -63,14 +66,20 @@ 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; } @@ -84,8 +93,8 @@ public class GenerateNodeMapPower extends GenerateNodeMap { // 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 e89cc8b25c..d3c8c49169 100644 --- a/src/main/java/gregtech/api/graphs/Lock.java +++ b/src/main/java/gregtech/api/graphs/Lock.java @@ -1,9 +1,11 @@ package gregtech.api.graphs; import java.util.ArrayList; + import net.minecraft.tileentity.TileEntity; public class Lock { + protected ArrayList<TileEntity> tiles = new ArrayList<>(); public void addTileEntity(TileEntity tileEntity) { diff --git a/src/main/java/gregtech/api/graphs/Node.java b/src/main/java/gregtech/api/graphs/Node.java index f6a3ebe2d2..21b9937191 100644 --- a/src/main/java/gregtech/api/graphs/Node.java +++ b/src/main/java/gregtech/api/graphs/Node.java @@ -1,13 +1,16 @@ 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 gregtech.api.graphs.consumers.ConsumerNode; +import gregtech.api.graphs.paths.NodePath; + // base Node class public class Node { + public Node(int aNodeValue, TileEntity aTileEntity, ArrayList<ConsumerNode> aConsumers) { this.mNodeValue = aNodeValue; this.mTileEntity = aTileEntity; @@ -29,6 +32,7 @@ public class Node { public int mHighestNodeValue; public class ReturnPair { + public NodePath mReturnPath; public Lock returnLock; } diff --git a/src/main/java/gregtech/api/graphs/NodeList.java b/src/main/java/gregtech/api/graphs/NodeList.java index 8a018e2123..899384b3d4 100644 --- a/src/main/java/gregtech/api/graphs/NodeList.java +++ b/src/main/java/gregtech/api/graphs/NodeList.java @@ -2,6 +2,7 @@ package gregtech.api.graphs; // keep track on which node is being looked for across the recursive functions public class NodeList { + Node[] mNodes; int mCounter = 0; diff --git a/src/main/java/gregtech/api/graphs/PowerNode.java b/src/main/java/gregtech/api/graphs/PowerNode.java index c81d436861..75a8e8d73b 100644 --- a/src/main/java/gregtech/api/graphs/PowerNode.java +++ b/src/main/java/gregtech/api/graphs/PowerNode.java @@ -1,11 +1,14 @@ package gregtech.api.graphs; -import gregtech.api.graphs.consumers.ConsumerNode; import java.util.ArrayList; + import net.minecraft.tileentity.TileEntity; +import gregtech.api.graphs.consumers.ConsumerNode; + // base node for power networks public class PowerNode extends Node { + public boolean mHadVoltage = false; public PowerNode(int aNodeValue, TileEntity aTileEntity, ArrayList<ConsumerNode> aConsumers) { diff --git a/src/main/java/gregtech/api/graphs/PowerNodes.java b/src/main/java/gregtech/api/graphs/PowerNodes.java index 759002dbdb..12416f6d72 100644 --- a/src/main/java/gregtech/api/graphs/PowerNodes.java +++ b/src/main/java/gregtech/api/graphs/PowerNodes.java @@ -3,27 +3,20 @@ package gregtech.api.graphs; import gregtech.api.graphs.consumers.ConsumerNode; import gregtech.api.graphs.paths.PowerNodePath; -/* look for and power node that need power - * - * how this works - * - * a node only contains nodes that has a higher value then it self except for 1 which is the return node - * this node also contains the highest known node value of its network - * this network only includes nodes that have a higher value then it self so it does not know the highest known value that - * the return node knows - * - * with these rules we can know for the target node to be in the network of a node, the target node must have a value no - * less than the node we are looking and no greater than the highest value that node knows - * this way we don't have to go over the entire network to look for it - * - * we also hold a list of all consumers so we can check before looking if that consumer actually needs power - * and only look for nodes that actually need power - * +/* + * look for and power node that need power how this works a node only contains nodes that has a higher value then it + * self except for 1 which is the return node this node also contains the highest known node value of its network this + * network only includes nodes that have a higher value then it self so it does not know the highest known value that + * the return node knows with these rules we can know for the target node to be in the network of a node, the target + * node must have a value no less than the node we are looking and no greater than the highest value that node knows + * this way we don't have to go over the entire network to look for it we also hold a list of all consumers so we can + * check before looking if that consumer actually needs power and only look for nodes that actually need power */ public class PowerNodes { + // check if the looked for node is next to or get the next node that is closer to it - public static 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; @@ -41,7 +34,12 @@ public class PowerNodes { } else { if (aPreviousNode == tNextNode) return tAmpsUsed; tAmpsUsed += processNextNode( - aCurrentNode, tNextNode, aConsumers, j, aMaxAmps - tAmpsUsed, aVoltage); + aCurrentNode, + tNextNode, + aConsumers, + j, + aMaxAmps - tAmpsUsed, + aVoltage); tConsumer = (ConsumerNode) aConsumers.getNode(); break; } @@ -55,7 +53,12 @@ public class PowerNodes { if (tNextNode.mNodeValue > aCurrentNode.mNodeValue && tNextNode.mNodeValue < tTargetNodeValue) { if (tNextNode == aPreviousNode) return tAmpsUsed; tAmpsUsed += processNextNodeAbove( - aCurrentNode, tNextNode, aConsumers, side, aMaxAmps - tAmpsUsed, aVoltage); + aCurrentNode, + tNextNode, + aConsumers, + side, + aMaxAmps - tAmpsUsed, + aVoltage); tConsumer = (ConsumerNode) aConsumers.getNode(); break; } else if (tNextNode.mNodeValue == tTargetNodeValue) { @@ -77,8 +80,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(); @@ -93,7 +96,12 @@ public class PowerNodes { if (tNextNode.mNodeValue > aCurrentNode.mNodeValue && tNextNode.mNodeValue < tTargetNodeValue) { if (tNextNode == aPreviousNode) return tAmpsUsed; tAmpsUsed += processNextNodeAbove( - aCurrentNode, tNextNode, aConsumers, side, aMaxAmps - tAmpsUsed, aVoltage); + aCurrentNode, + tNextNode, + aConsumers, + side, + aMaxAmps - tAmpsUsed, + aVoltage); tConsumer = (ConsumerNode) aConsumers.getNode(); break; } else if (tNextNode.mNodeValue == tTargetNodeValue) { @@ -113,8 +121,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; @@ -134,8 +142,8 @@ public class PowerNodes { 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; @@ -155,8 +163,8 @@ public class PowerNodes { 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; diff --git a/src/main/java/gregtech/api/graphs/consumers/ConsumerNode.java b/src/main/java/gregtech/api/graphs/consumers/ConsumerNode.java index 78b3c51928..f82798f09b 100644 --- a/src/main/java/gregtech/api/graphs/consumers/ConsumerNode.java +++ b/src/main/java/gregtech/api/graphs/consumers/ConsumerNode.java @@ -1,11 +1,14 @@ package gregtech.api.graphs.consumers; -import gregtech.api.graphs.Node; import java.util.ArrayList; + import net.minecraft.tileentity.TileEntity; +import gregtech.api.graphs.Node; + // 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) { diff --git a/src/main/java/gregtech/api/graphs/consumers/EmptyPowerConsumer.java b/src/main/java/gregtech/api/graphs/consumers/EmptyPowerConsumer.java index d5ff76c12b..6507d0f8e4 100644 --- a/src/main/java/gregtech/api/graphs/consumers/EmptyPowerConsumer.java +++ b/src/main/java/gregtech/api/graphs/consumers/EmptyPowerConsumer.java @@ -1,12 +1,15 @@ package gregtech.api.graphs.consumers; -import gregtech.api.graphs.paths.PowerNodePath; -import gregtech.api.metatileentity.BaseMetaPipeEntity; import java.util.ArrayList; + import net.minecraft.tileentity.TileEntity; +import gregtech.api.graphs.paths.PowerNodePath; +import gregtech.api.metatileentity.BaseMetaPipeEntity; + // 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); } diff --git a/src/main/java/gregtech/api/graphs/consumers/NodeEnergyConnected.java b/src/main/java/gregtech/api/graphs/consumers/NodeEnergyConnected.java index 30582332e7..bd2087de84 100644 --- a/src/main/java/gregtech/api/graphs/consumers/NodeEnergyConnected.java +++ b/src/main/java/gregtech/api/graphs/consumers/NodeEnergyConnected.java @@ -1,12 +1,15 @@ package gregtech.api.graphs.consumers; -import gregtech.api.interfaces.tileentity.IEnergyConnected; import java.util.ArrayList; + import net.minecraft.tileentity.TileEntity; +import gregtech.api.interfaces.tileentity.IEnergyConnected; + public class NodeEnergyConnected extends ConsumerNode { - public NodeEnergyConnected( - int aNodeValue, IEnergyConnected aTileEntity, byte aSide, ArrayList<ConsumerNode> aConsumers) { + + public NodeEnergyConnected(int aNodeValue, IEnergyConnected aTileEntity, byte aSide, + ArrayList<ConsumerNode> aConsumers) { super(aNodeValue, (TileEntity) aTileEntity, aSide, aConsumers); } diff --git a/src/main/java/gregtech/api/graphs/consumers/NodeEnergyReceiver.java b/src/main/java/gregtech/api/graphs/consumers/NodeEnergyReceiver.java index 9c5e3f8aab..eec63cf935 100644 --- a/src/main/java/gregtech/api/graphs/consumers/NodeEnergyReceiver.java +++ b/src/main/java/gregtech/api/graphs/consumers/NodeEnergyReceiver.java @@ -2,6 +2,13 @@ package gregtech.api.graphs.consumers; import static gregtech.api.enums.GT_Values.V; +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 cofh.api.energy.IEnergyReceiver; import gregtech.GT_Mod; import gregtech.api.GregTech_API; @@ -9,18 +16,14 @@ 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; // 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); } @@ -38,8 +41,7 @@ public class NodeEnergyReceiver extends ConsumerNode { mRestRF -= consumed; return ampsUsed; } - if (GregTech_API.mRFExplosions - && GregTech_API.sMachineExplosions + if (GregTech_API.mRFExplosions && GregTech_API.sMachineExplosions && ((IEnergyReceiver) mTileEntity).getMaxEnergyStored(tDirection) < rfOut * 600L) { explode(rfOut); } @@ -50,77 +52,45 @@ public class NodeEnergyReceiver extends ConsumerNode { 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 + 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 + < V[9] ? 12.0F : aExplosionPower - < V[ - 11] - ? 14.0F - : aExplosionPower - < V[ - 12] - ? 15.0F + < V[10] ? 13.0F : aExplosionPower - < V[ - 12] - * 2 - ? 16.0F - : aExplosionPower - < V[ - 13] - ? 17.0F + < V[11] ? 14.0F : aExplosionPower - < V[ - 14] - ? 18.0F - : aExplosionPower - < V[ - 15] - ? 19.0F - : 20.0F; + < 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); + if (GregTech_API.sMachineExplosions) if (GT_Mod.gregtechproxy.mPollution) GT_Pollution + .addPollution(tWorld.getChunkFromBlockCoords(tX, tZ), GT_Mod.gregtechproxy.mPollutionOnExplosion); - new WorldSpawnedEventBuilder.ExplosionEffectEventBuilder() - .setStrength(tStrength) - .setSmoking(true) - .setPosition(tX + 0.5, tY + 0.5, tZ + 0.5) - .setWorld(tWorld) - .run(); + new WorldSpawnedEventBuilder.ExplosionEffectEventBuilder().setStrength(tStrength).setSmoking(true) + .setPosition(tX + 0.5, tY + 0.5, tZ + 0.5).setWorld(tWorld).run(); } } } diff --git a/src/main/java/gregtech/api/graphs/consumers/NodeEnergySink.java b/src/main/java/gregtech/api/graphs/consumers/NodeEnergySink.java index 95b16883af..16b8f99939 100644 --- a/src/main/java/gregtech/api/graphs/consumers/NodeEnergySink.java +++ b/src/main/java/gregtech/api/graphs/consumers/NodeEnergySink.java @@ -1,12 +1,15 @@ 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 ic2.api.energy.tile.IEnergySink; + // consumer for IC2 machines public class NodeEnergySink extends ConsumerNode { + public NodeEnergySink(int nodeValue, IEnergySink tileEntity, byte side, ArrayList<ConsumerNode> consumers) { super(nodeValue, (TileEntity) tileEntity, side, consumers); } @@ -19,10 +22,10 @@ public class NodeEnergySink extends ConsumerNode { @Override public int injectEnergy(long aVoltage, long aMaxAmps) { int tUsedAmps = 0; - while (aMaxAmps > tUsedAmps - && ((IEnergySink) mTileEntity).getDemandedEnergy() > 0 + while (aMaxAmps > tUsedAmps && ((IEnergySink) mTileEntity).getDemandedEnergy() > 0 && ((IEnergySink) mTileEntity).injectEnergy(ForgeDirection.getOrientation(mSide), aVoltage, aVoltage) - < aVoltage) tUsedAmps++; + < 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 e367a5294e..19a2478c07 100644 --- a/src/main/java/gregtech/api/graphs/consumers/NodeGTBaseMetaTile.java +++ b/src/main/java/gregtech/api/graphs/consumers/NodeGTBaseMetaTile.java @@ -1,13 +1,15 @@ package gregtech.api.graphs.consumers; +import java.util.ArrayList; + import gregtech.api.interfaces.tileentity.IEnergyConnected; import gregtech.api.metatileentity.BaseMetaTileEntity; -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); } diff --git a/src/main/java/gregtech/api/graphs/paths/NodePath.java b/src/main/java/gregtech/api/graphs/paths/NodePath.java index d5a179b24b..0e852bd484 100644 --- a/src/main/java/gregtech/api/graphs/paths/NodePath.java +++ b/src/main/java/gregtech/api/graphs/paths/NodePath.java @@ -6,6 +6,7 @@ import gregtech.api.metatileentity.MetaPipeEntity; // 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 3ab8c7fe03..1601d3b28d 100644 --- a/src/main/java/gregtech/api/graphs/paths/PowerNodePath.java +++ b/src/main/java/gregtech/api/graphs/paths/PowerNodePath.java @@ -1,13 +1,15 @@ package gregtech.api.graphs.paths; +import net.minecraft.server.MinecraftServer; + import gregtech.api.metatileentity.BaseMetaPipeEntity; import gregtech.api.metatileentity.MetaPipeEntity; import gregtech.api.metatileentity.implementations.GT_MetaPipeEntity_Cable; -import net.minecraft.server.MinecraftServer; // path for cables // all calculations like amp and voltage happens here public class PowerNodePath extends NodePath { + long mMaxAmps; long mAmps = 0; long mLoss; diff --git a/src/main/java/gregtech/api/gui/GT_Container.java b/src/main/java/gregtech/api/gui/GT_Container.java index 5d9dde3535..2c4d7292d0 100644 --- a/src/main/java/gregtech/api/gui/GT_Container.java +++ b/src/main/java/gregtech/api/gui/GT_Container.java @@ -1,10 +1,7 @@ package gregtech.api.gui; -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; @@ -15,12 +12,18 @@ import net.minecraft.item.ItemStack; import net.minecraftforge.fluids.FluidStack; import net.minecraftforge.fluids.IFluidContainerItem; +import gregtech.api.interfaces.IFluidAccess; +import gregtech.api.interfaces.tileentity.IGregTechTileEntity; +import gregtech.api.util.GT_Log; +import gregtech.api.util.GT_Utility; + /** * NEVER INCLUDE THIS FILE IN YOUR MOD!!! * <p/> * Main Container-Class, used for all my GUIs */ public class GT_Container extends Container { + public IGregTechTileEntity mTileEntity; public InventoryPlayer mPlayerInventory; @@ -108,10 +111,8 @@ 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 { @@ -138,8 +139,7 @@ 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); } @@ -208,25 +208,24 @@ public class GT_Container extends Container { aSlot.putStack(mouseStack); aPlayerInventory.setItemStack(tTempStack); } - } else if (tTempStack.getItem() == mouseStack.getItem() - && mouseStack.getMaxStackSize() > 1 + } else if (tTempStack.getItem() == mouseStack.getItem() && mouseStack.getMaxStackSize() > 1 && (!tTempStack.getHasSubtypes() || tTempStack.getItemDamage() == mouseStack.getItemDamage()) && ItemStack.areItemStackTagsEqual(tTempStack, mouseStack)) { - tTempStackSize = tTempStack.stackSize; + tTempStackSize = tTempStack.stackSize; - if (tTempStackSize > 0 - && tTempStackSize + mouseStack.stackSize <= mouseStack.getMaxStackSize()) { - mouseStack.stackSize += tTempStackSize; - tTempStack = aSlot.decrStackSize(tTempStackSize); + if (tTempStackSize > 0 + && tTempStackSize + mouseStack.stackSize <= mouseStack.getMaxStackSize()) { + mouseStack.stackSize += tTempStackSize; + tTempStack = aSlot.decrStackSize(tTempStackSize); - if (tTempStack.stackSize == 0) { - aSlot.putStack(null); - } + if (tTempStack.stackSize == 0) { + aSlot.putStack(null); + } - aSlot.onPickupFromSlot(aPlayer, aPlayerInventory.getItemStack()); - } - } + aSlot.onPickupFromSlot(aPlayer, aPlayerInventory.getItemStack()); + } + } } aSlot.onSlotChanged(); } @@ -240,8 +239,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) { @@ -270,17 +269,16 @@ public class GT_Container extends Container { aSlot.putStack(tTempStack); } } - } else if (aShifthold == 3 - && aPlayer.capabilities.isCreativeMode + } 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()); - tTempStack.stackSize = tTempStack.getMaxStackSize(); - aPlayerInventory.setItemStack(tTempStack); - } - } + aSlot = (Slot) this.inventorySlots.get(aSlotIndex); + if (aSlot != null && aSlot.getHasStack()) { + tTempStack = GT_Utility.copyOrNull(aSlot.getStack()); + tTempStack.stackSize = tTempStack.getMaxStackSize(); + aPlayerInventory.setItemStack(tTempStack); + } + } return rStack; } @@ -292,8 +290,7 @@ 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 + if (getSlotCount() > 0 && slotObject != null && slotObject.getHasStack() && !(slotObject instanceof GT_Slot_Holo)) { ItemStack stackInSlot = slotObject.getStack(); @@ -311,8 +308,8 @@ public class GT_Container extends Container { getShiftClickStartIndex(), getShiftClickStartIndex() + getShiftClickSlotCount(), false)) { - return null; - } + return null; + } if (stackInSlot.stackSize == 0) { slotObject.putStack(null); @@ -345,8 +342,7 @@ public class GT_Container extends Container { && (!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) + if (!(slot instanceof GT_Slot_Holo) && !(slot instanceof GT_Slot_Output) && slot.isItemValid(aStack) && itemStack != null && itemStack.getItem() == aStack.getItem() @@ -596,12 +592,8 @@ 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; @@ -658,12 +650,10 @@ public class GT_Container extends Container { if (aProcessFullStack) { int tFilledAmount = tOriginalFluidAmount - tTankStack.amount; /* - work out how many more items we can fill - one cell is already used, so account for that - the round down behavior will left over a fraction of a cell worth of fluid - the user then get to decide what to do with it - it will not be too fancy if it spills out partially filled cells - */ + * work out how many more items we can fill one cell is already used, so account for that the round down + * behavior will left over a fraction of a cell worth of fluid the user then get to decide what to do + * with it it will not be too fancy if it spills out partially filled cells + */ int tAdditionalParallel = Math.min(tStackHeld.stackSize - 1, tTankStack.amount / tFilledAmount); tTankStack.amount -= tFilledAmount * tAdditionalParallel; tFilledContainer.stackSize += tAdditionalParallel; @@ -674,8 +664,8 @@ public class GT_Container extends Container { 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; ItemStack tStackHeld = aPlayer.inventory.getItemStack(); 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 588fb415c2..3ce2a53fce 100644 --- a/src/main/java/gregtech/api/gui/GT_ContainerMetaTile_Machine.java +++ b/src/main/java/gregtech/api/gui/GT_ContainerMetaTile_Machine.java @@ -1,16 +1,18 @@ package gregtech.api.gui; +import java.util.List; + +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.entity.player.InventoryPlayer; +import net.minecraft.inventory.ICrafting; +import net.minecraft.item.ItemStack; + import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; import gregtech.api.interfaces.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; -import net.minecraft.item.ItemStack; /** * NEVER INCLUDE THIS FILE IN YOUR MOD!!! @@ -19,29 +21,11 @@ import net.minecraft.item.ItemStack; */ public class GT_ContainerMetaTile_Machine extends GT_Container { - public int mActive = 0, - mMaxProgressTime = 0, - mProgressTime = 0, - mEnergy = 0, - mSteam = 0, - mSteamStorage = 0, - mStorage = 0, - mOutput = 0, - mInput = 0, - mID = 0, - mDisplayErrorCode = 0; + public int mActive = 0, mMaxProgressTime = 0, mProgressTime = 0, mEnergy = 0, mSteam = 0, mSteamStorage = 0, + mStorage = 0, mOutput = 0, mInput = 0, mID = 0, mDisplayErrorCode = 0; public long mEnergyLong = 0, mStorageLong = 0; - private int oActive = 0, - oMaxProgressTime = 0, - oProgressTime = 0, - oEnergy = 0, - oSteam = 0, - oSteamStorage = 0, - oStorage = 0, - oOutput = 0, - oInput = 0, - oID = 0, - oDisplayErrorCode = 0; + private int oActive = 0, oMaxProgressTime = 0, oProgressTime = 0, oEnergy = 0, oSteam = 0, oSteamStorage = 0, + oStorage = 0, oOutput = 0, oInput = 0, oID = 0, oDisplayErrorCode = 0; private long oEnergyLong = 0, oStorageLong = 0; protected int mTimer = 0; protected Runnable circuitSlotClickCallback; @@ -60,8 +44,8 @@ public class GT_ContainerMetaTile_Machine extends GT_Container { } } - 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; @@ -77,8 +61,11 @@ public class GT_ContainerMetaTile_Machine extends GT_Container { 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()); + GT_Slot_Render slotCircuit = new GT_Slot_Render( + mTileEntity, + ccs.getCircuitSlot(), + ccs.getCircuitSlotX(), + ccs.getCircuitSlotY()); addSlotToContainer(slotCircuit); slotCircuit.setEnabled(ccs.allowSelectCircuit()); } @@ -278,9 +265,8 @@ 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_1by1.java b/src/main/java/gregtech/api/gui/GT_Container_1by1.java index 882b4d0502..06efaee5ef 100644 --- a/src/main/java/gregtech/api/gui/GT_Container_1by1.java +++ b/src/main/java/gregtech/api/gui/GT_Container_1by1.java @@ -1,9 +1,10 @@ package gregtech.api.gui; -import gregtech.api.interfaces.tileentity.IGregTechTileEntity; import net.minecraft.entity.player.InventoryPlayer; import net.minecraft.inventory.Slot; +import gregtech.api.interfaces.tileentity.IGregTechTileEntity; + @Deprecated public class GT_Container_1by1 extends GT_ContainerMetaTile_Machine { diff --git a/src/main/java/gregtech/api/gui/GT_Container_2by2.java b/src/main/java/gregtech/api/gui/GT_Container_2by2.java index 4267423b75..4e3584a0a6 100644 --- a/src/main/java/gregtech/api/gui/GT_Container_2by2.java +++ b/src/main/java/gregtech/api/gui/GT_Container_2by2.java @@ -1,9 +1,10 @@ package gregtech.api.gui; -import gregtech.api.interfaces.tileentity.IGregTechTileEntity; import net.minecraft.entity.player.InventoryPlayer; import net.minecraft.inventory.Slot; +import gregtech.api.interfaces.tileentity.IGregTechTileEntity; + @Deprecated public class GT_Container_2by2 extends GT_ContainerMetaTile_Machine { diff --git a/src/main/java/gregtech/api/gui/GT_Container_3by3.java b/src/main/java/gregtech/api/gui/GT_Container_3by3.java index 80f3e213d6..4c0f7f946b 100644 --- a/src/main/java/gregtech/api/gui/GT_Container_3by3.java +++ b/src/main/java/gregtech/api/gui/GT_Container_3by3.java @@ -1,9 +1,10 @@ package gregtech.api.gui; -import gregtech.api.interfaces.tileentity.IGregTechTileEntity; import net.minecraft.entity.player.InventoryPlayer; import net.minecraft.inventory.Slot; +import gregtech.api.interfaces.tileentity.IGregTechTileEntity; + @Deprecated public class GT_Container_3by3 extends GT_ContainerMetaTile_Machine { diff --git a/src/main/java/gregtech/api/gui/GT_Container_4by4.java b/src/main/java/gregtech/api/gui/GT_Container_4by4.java index 6aa0717a11..db5cde4cfe 100644 --- a/src/main/java/gregtech/api/gui/GT_Container_4by4.java +++ b/src/main/java/gregtech/api/gui/GT_Container_4by4.java @@ -1,9 +1,10 @@ package gregtech.api.gui; -import gregtech.api.interfaces.tileentity.IGregTechTileEntity; import net.minecraft.entity.player.InventoryPlayer; import net.minecraft.inventory.Slot; +import gregtech.api.interfaces.tileentity.IGregTechTileEntity; + @Deprecated public class GT_Container_4by4 extends GT_ContainerMetaTile_Machine { 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 28779ada08..101c1cba83 100644 --- a/src/main/java/gregtech/api/gui/GT_Container_BasicMachine.java +++ b/src/main/java/gregtech/api/gui/GT_Container_BasicMachine.java @@ -2,6 +2,12 @@ package gregtech.api.gui; import static gregtech.api.metatileentity.implementations.GT_MetaTileEntity_BasicMachine.OTHER_SLOT_COUNT; +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 cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; import gregtech.api.interfaces.IFluidAccess; @@ -10,11 +16,6 @@ import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_BasicMachin import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_BasicTank; 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; /** * NEVER INCLUDE THIS FILE IN YOUR MOD!!! @@ -223,7 +224,7 @@ public class GT_Container_BasicMachine extends GT_Container_BasicTank { } IFluidAccess tFillableAccess = constructFluidAccess(tTank, true); GT_Recipe_Map recipes = machine.getRecipeList(); - // If the machine has recipes but no fluid inputs, disallow filling this slot with fluids. + // If the machine has recipes but no fluid inputs, disallow filling this slot with fluids. ItemStack tToken = handleFluidSlotClick( tFillableAccess, 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 bc0ac72a8b..5aa793f8f6 100644 --- a/src/main/java/gregtech/api/gui/GT_Container_BasicTank.java +++ b/src/main/java/gregtech/api/gui/GT_Container_BasicTank.java @@ -1,11 +1,5 @@ package gregtech.api.gui; -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_BasicTank; -import gregtech.api.util.GT_Utility; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.player.InventoryPlayer; import net.minecraft.inventory.ICrafting; @@ -13,6 +7,13 @@ import net.minecraft.inventory.Slot; import net.minecraft.item.ItemStack; import net.minecraftforge.fluids.FluidStack; +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_BasicTank; +import gregtech.api.util.GT_Utility; + /** * NEVER INCLUDE THIS FILE IN YOUR MOD!!! * <p/> @@ -28,8 +29,8 @@ public class GT_Container_BasicTank extends GT_ContainerMetaTile_Machine { } /** - * Subclasses must ensure third slot (aSlotIndex==2) is drainable fluid display item slot. - * Otherwise, subclasses must intercept the appropriate the slotClick event and call super.slotClick(2, xxx) if necessary + * Subclasses must ensure third slot (aSlotIndex==2) is drainable fluid display item slot. Otherwise, subclasses + * must intercept the appropriate the slotClick event and call super.slotClick(2, xxx) if necessary */ @Override public void addSlots(InventoryPlayer aInventoryPlayer) { @@ -46,16 +47,20 @@ public class GT_Container_BasicTank extends GT_ContainerMetaTile_Machine { /* * While a logical client don't really need to process fluid cells upon click (it could have just wait * for server side to send the result), doing so would result in every fluid interaction having a - * noticeable delay between clicking and changes happening even on single player. - * 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 + * noticeable delay between clicking and changes happening even on single player. 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 */ Slot slot = (Slot) inventorySlots.get(aSlotIndex); tTank.setDrainableStack(GT_Utility.getFluidFromDisplayStack(slot.getStack())); } IFluidAccess tDrainableAccess = constructFluidAccess(tTank, false); return handleFluidSlotClick( - tDrainableAccess, aPlayer, aMouseclick == 0, true, !tTank.isDrainableStackSeparate()); + tDrainableAccess, + aPlayer, + aMouseclick == 0, + true, + !tTank.isDrainableStackSeparate()); } return super.slotClick(aSlotIndex, aMouseclick, aShifthold, aPlayer); } @@ -110,6 +115,7 @@ public class GT_Container_BasicTank extends GT_ContainerMetaTile_Machine { } static class BasicTankFluidAccess implements IFluidAccess { + protected final GT_MetaTileEntity_BasicTank mTank; protected final boolean mIsFillableStack; 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 4bfc14ad57..bcc9219d5e 100644 --- a/src/main/java/gregtech/api/gui/GT_Container_MultiMachine.java +++ b/src/main/java/gregtech/api/gui/GT_Container_MultiMachine.java @@ -1,9 +1,10 @@ package gregtech.api.gui; -import gregtech.api.interfaces.tileentity.IGregTechTileEntity; import net.minecraft.entity.player.InventoryPlayer; import net.minecraft.inventory.Slot; +import gregtech.api.interfaces.tileentity.IGregTechTileEntity; + /** * NEVER INCLUDE THIS FILE IN YOUR MOD!!! * <p/> @@ -11,12 +12,13 @@ import net.minecraft.inventory.Slot; */ @Deprecated public class GT_Container_MultiMachine extends GT_ContainerMetaTile_Machine { + public GT_Container_MultiMachine(InventoryPlayer aInventoryPlayer, IGregTechTileEntity aTileEntity) { 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_GUIColorOverride.java b/src/main/java/gregtech/api/gui/GT_GUIColorOverride.java index 2d6268dbec..795148ee25 100644 --- a/src/main/java/gregtech/api/gui/GT_GUIColorOverride.java +++ b/src/main/java/gregtech/api/gui/GT_GUIColorOverride.java @@ -1,24 +1,29 @@ package gregtech.api.gui; +import java.util.concurrent.ExecutionException; + +import javax.annotation.Nonnull; + +import net.minecraft.client.Minecraft; +import net.minecraft.client.resources.IResource; +import net.minecraft.util.ResourceLocation; + import com.google.common.cache.CacheBuilder; import com.google.common.cache.CacheLoader; import com.google.common.cache.LoadingCache; import com.google.common.util.concurrent.UncheckedExecutionException; + import cpw.mods.fml.relauncher.FMLLaunchHandler; import cpw.mods.fml.relauncher.Side; import gregtech.api.GregTech_API; import gregtech.api.util.ColorsMetadataSection; -import java.util.concurrent.ExecutionException; -import javax.annotation.Nonnull; -import net.minecraft.client.Minecraft; -import net.minecraft.client.resources.IResource; -import net.minecraft.util.ResourceLocation; public class GT_GUIColorOverride { + private static final Object NOT_FOUND = new Object(); - private static final LoadingCache<ResourceLocation, Object> cache = CacheBuilder.newBuilder() - .softValues() + private static final LoadingCache<ResourceLocation, Object> cache = CacheBuilder.newBuilder().softValues() .build(new CacheLoader<ResourceLocation, Object>() { + @Override public Object load(@Nonnull ResourceLocation key) throws Exception { IResource ir = Minecraft.getMinecraft().getResourceManager().getResource(key); diff --git a/src/main/java/gregtech/api/gui/GT_GUIContainer.java b/src/main/java/gregtech/api/gui/GT_GUIContainer.java index efed327b46..639bd56162 100644 --- a/src/main/java/gregtech/api/gui/GT_GUIContainer.java +++ b/src/main/java/gregtech/api/gui/GT_GUIContainer.java @@ -7,6 +7,7 @@ import net.minecraft.client.renderer.Tessellator; import net.minecraft.inventory.Container; import net.minecraft.inventory.Slot; import net.minecraft.util.ResourceLocation; + import org.lwjgl.input.Mouse; /** @@ -90,19 +91,9 @@ public class GT_GUIContainer extends GuiContainer { } /* - @Override - protected void drawSlotInventory(Slot slot) { - try { - super.drawSlotInventory(slot); - } catch(Throwable e) { - try { - Tessellator.instance.draw(); - } catch(Throwable f) {} - if (!mCrashed) { - GT_Log.out.println("Clientside Slot drawing Crash prevented. Seems one Itemstack causes Problems with negative Damage Values or the Wildcard Damage Value. This is absolutely NOT a Bug of the GregTech-Addon, so don't even think about reporting it to me, it's a Bug of the Mod, which belongs to the almost-crash-causing Item, so bug that Mods Author and not me! Did you hear it? NOT ME!!!"); - e.printStackTrace(); - mCrashed = true; - } - } - }*/ + * @Override protected void drawSlotInventory(Slot slot) { try { super.drawSlotInventory(slot); } catch(Throwable e) + * { try { Tessellator.instance.draw(); } catch(Throwable f) {} if (!mCrashed) { GT_Log.out. + * println("Clientside Slot drawing Crash prevented. Seems one Itemstack causes Problems with negative Damage Values or the Wildcard Damage Value. This is absolutely NOT a Bug of the GregTech-Addon, so don't even think about reporting it to me, it's a Bug of the Mod, which belongs to the almost-crash-causing Item, so bug that Mods Author and not me! Did you hear it? NOT ME!!!" + * ); e.printStackTrace(); mCrashed = true; } } } + */ } 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 19aa8fa9a8..7e072f0fe6 100644 --- a/src/main/java/gregtech/api/gui/GT_GUIContainerMetaTile_Machine.java +++ b/src/main/java/gregtech/api/gui/GT_GUIContainerMetaTile_Machine.java @@ -1,5 +1,16 @@ package gregtech.api.gui; +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 org.lwjgl.opengl.GL11; + import gregtech.GT_Mod; import gregtech.api.GregTech_API; import gregtech.api.enums.Dyes; @@ -17,14 +28,6 @@ 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 org.lwjgl.opengl.GL11; /** * NEVER INCLUDE THIS FILE IN YOUR MOD!!! @@ -43,14 +46,13 @@ 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, + 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 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); @@ -70,8 +72,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); } @@ -174,16 +176,17 @@ public class GT_GUIContainerMetaTile_Machine extends GT_GUIContainer implements // Tooltips support /** - * Load data for and create appropriate tooltips for this machine. - * Only called when one of regular or shift tooltips are enabled. + * Load data for and create appropriate tooltips for this machine. Only called when one of regular or shift tooltips + * are enabled. */ protected void setupTooltips() { if (mContainer.mTileEntity.getMetaTileEntity() instanceof IConfigurationCircuitSupport) { - IConfigurationCircuitSupport ccs = - (IConfigurationCircuitSupport) mContainer.mTileEntity.getMetaTileEntity(); - if (ccs.allowSelectCircuit()) - addToolTip(new GT_GuiSlotTooltip( - mContainer.getSlot(ccs.getCircuitGUISlot()), mTooltipCache.getData(GHOST_CIRCUIT_TOOLTIP))); + IConfigurationCircuitSupport ccs = (IConfigurationCircuitSupport) mContainer.mTileEntity + .getMetaTileEntity(); + if (ccs.allowSelectCircuit()) addToolTip( + new GT_GuiSlotTooltip( + mContainer.getSlot(ccs.getCircuitGUISlot()), + mTooltipCache.getData(GHOST_CIRCUIT_TOOLTIP))); } } @@ -231,8 +234,8 @@ 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)) { @@ -248,13 +251,14 @@ public class GT_GUIContainerMetaTile_Machine extends GT_GUIContainer implements IMetaTileEntity machine = mContainer.mTileEntity.getMetaTileEntity(); 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())))); + 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())))); } private void onCircuitSelected(ItemStack 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 694b212872..b891ed177d 100644 --- a/src/main/java/gregtech/api/gui/GT_GUIContainer_1by1.java +++ b/src/main/java/gregtech/api/gui/GT_GUIContainer_1by1.java @@ -2,9 +2,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 gregtech.api.interfaces.tileentity.IGregTechTileEntity; + @Deprecated public class GT_GUIContainer_1by1 extends GT_GUIContainerMetaTile_Machine { @@ -16,8 +17,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 069e6f67fe..a06d4a98d2 100644 --- a/src/main/java/gregtech/api/gui/GT_GUIContainer_2by2.java +++ b/src/main/java/gregtech/api/gui/GT_GUIContainer_2by2.java @@ -2,9 +2,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 gregtech.api.interfaces.tileentity.IGregTechTileEntity; + @Deprecated public class GT_GUIContainer_2by2 extends GT_GUIContainerMetaTile_Machine { @@ -16,8 +17,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_3by3.java b/src/main/java/gregtech/api/gui/GT_GUIContainer_3by3.java index 2ce72e054c..715be4fdea 100644 --- a/src/main/java/gregtech/api/gui/GT_GUIContainer_3by3.java +++ b/src/main/java/gregtech/api/gui/GT_GUIContainer_3by3.java @@ -2,9 +2,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 gregtech.api.interfaces.tileentity.IGregTechTileEntity; + @Deprecated public class GT_GUIContainer_3by3 extends GT_GUIContainerMetaTile_Machine { @@ -16,8 +17,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 df8e3d137b..d091abfff6 100644 --- a/src/main/java/gregtech/api/gui/GT_GUIContainer_4by4.java +++ b/src/main/java/gregtech/api/gui/GT_GUIContainer_4by4.java @@ -2,9 +2,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 gregtech.api.interfaces.tileentity.IGregTechTileEntity; + @Deprecated public class GT_GUIContainer_4by4 extends GT_GUIContainerMetaTile_Machine { @@ -16,8 +17,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 50272f4820..43943b49cb 100644 --- a/src/main/java/gregtech/api/gui/GT_GUIContainer_BasicMachine.java +++ b/src/main/java/gregtech/api/gui/GT_GUIContainer_BasicMachine.java @@ -2,6 +2,11 @@ package gregtech.api.gui; import static gregtech.api.enums.GT_Values.RES_PATH_GUI; +import java.awt.Rectangle; + +import net.minecraft.entity.player.InventoryPlayer; +import net.minecraft.util.StatCollector; + import gregtech.api.enums.GT_Values; import gregtech.api.gui.widgets.GT_GuiIcon; import gregtech.api.gui.widgets.GT_GuiSlotTooltip; @@ -14,9 +19,6 @@ import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_BasicMachin 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.util.StatCollector; /** * NEVER INCLUDE THIS FILE IN YOUR MOD!!! @@ -24,11 +26,16 @@ import net.minecraft.util.StatCollector; * The GUI-Container I use for all my Basic Machines */ public class GT_GUIContainer_BasicMachine extends GT_GUIContainerMetaTile_Machine implements NEI_TransferRectHost { + private static final int NEEDS_STEAM_VENTING = 64; 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); + 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); + 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; @@ -46,23 +53,13 @@ public class GT_GUIContainer_BasicMachine extends GT_GUIContainerMetaTile_Machin 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) { + 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) { + 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); @@ -87,57 +84,67 @@ 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) { batterySlotTooltipKey = BATTERY_SLOT_TOOLTIP_ALT; - batterySlotTooltipArgs = new String[] {pTier1}; + batterySlotTooltipArgs = new String[] { pTier1 }; } else { batterySlotTooltipKey = BATTERY_SLOT_TOOLTIP; - batterySlotTooltipArgs = new String[] {pTier1, powerTierName((byte) (machine.mTier + 1))}; + 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() { - public boolean shouldShowTooltip() { - return container.mStuttering && !hasErrorCode(NEEDS_STEAM_VENTING); - } - }, + 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"))))); + StatCollector + .translateToLocal(POWER_SOURCE_KEY + (machine.isSteampowered() ? "steam" : "power"))))); } /** * Apply proper coloration to a machine's power tier short name + * * @param machineTier * @return colored power tier short name */ @@ -171,14 +178,12 @@ public class GT_GUIContainer_BasicMachine extends GT_GUIContainerMetaTile_Machin 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)) + 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. @@ -218,8 +223,7 @@ public class GT_GUIContainer_BasicMachine extends GT_GUIContainerMetaTile_Machin @Override protected GT_GuiTabIconSet getTabBackground() { if (getMachine().isSteampowered()) { - return getMachine() instanceof GT_MetaTileEntity_BasicMachine_Steel - ? TAB_ICONSET_STEEL + return getMachine() instanceof GT_MetaTileEntity_BasicMachine_Steel ? TAB_ICONSET_STEEL : TAB_ICONSET_BRONZE; } return super.getTabBackground(); @@ -253,7 +257,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 034525c338..28075cabdb 100644 --- a/src/main/java/gregtech/api/gui/GT_GUIContainer_BasicTank.java +++ b/src/main/java/gregtech/api/gui/GT_GUIContainer_BasicTank.java @@ -2,11 +2,12 @@ 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 gregtech.api.interfaces.tileentity.IGregTechTileEntity; +import gregtech.api.util.GT_Utility; + public class GT_GUIContainer_BasicTank extends GT_GUIContainerMetaTile_Machine { private final String mName; @@ -21,8 +22,8 @@ public class GT_GUIContainer_BasicTank extends GT_GUIContainerMetaTile_Machine { @Override protected void drawGuiContainerForegroundLayer(int mouseX, int mouseY) { - fontRendererObj.drawString( - StatCollector.translateToLocal("container.inventory"), 8, ySize - 96 + 2, textColorTitle); + fontRendererObj + .drawString(StatCollector.translateToLocal("container.inventory"), 8, ySize - 96 + 2, textColorTitle); fontRendererObj.drawString(mName, 8, 6, textColorTitle); if (mContainer != null) { fontRendererObj.drawString("Liquid Amount", 10, 20, textColor); diff --git a/src/main/java/gregtech/api/gui/GT_GUIContainer_MultiMachine.java b/src/main/java/gregtech/api/gui/GT_GUIContainer_MultiMachine.java index 7fb5026cd3..f2ea91571a 100644 --- a/src/main/java/gregtech/api/gui/GT_GUIContainer_MultiMachine.java +++ b/src/main/java/gregtech/api/gui/GT_GUIContainer_MultiMachine.java @@ -2,14 +2,15 @@ package gregtech.api.gui; import static gregtech.api.enums.GT_Values.RES_PATH_GUI; +import net.minecraft.entity.player.InventoryPlayer; +import net.minecraft.item.ItemStack; + import gregtech.api.interfaces.tileentity.IGregTechTileEntity; import gregtech.api.util.GT_ModHandler; import gregtech.api.util.GT_Utility; import gregtech.common.items.GT_MetaGenerated_Tool_01; import gregtech.common.tileentities.machines.multi.GT_MetaTileEntity_DrillerBase; import gregtech.common.tileentities.machines.multi.GT_MetaTileEntity_LargeTurbine; -import net.minecraft.entity.player.InventoryPlayer; -import net.minecraft.item.ItemStack; /** * NEVER INCLUDE THIS FILE IN YOUR MOD!!! @@ -23,8 +24,8 @@ public class GT_GUIContainer_MultiMachine extends GT_GUIContainerMetaTile_Machin 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) { + 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)); @@ -73,8 +74,8 @@ 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) + 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); @@ -92,42 +93,45 @@ 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); + 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); } 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) { @@ -135,16 +139,21 @@ public class GT_GUIContainer_MultiMachine extends GT_GUIContainerMetaTile_Machin 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); + 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.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); + 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 cef3ddb3bf..2bd981c6b1 100644 --- a/src/main/java/gregtech/api/gui/GT_GUICover.java +++ b/src/main/java/gregtech/api/gui/GT_GUICover.java @@ -1,9 +1,10 @@ package gregtech.api.gui; +import net.minecraft.item.ItemStack; + import gregtech.api.enums.GT_Values; import gregtech.api.interfaces.tileentity.ICoverable; import gregtech.api.net.GT_Packet_GtTileEntityGuiRequest; -import net.minecraft.item.ItemStack; @Deprecated public abstract class GT_GUICover extends GT_GUIScreen { @@ -27,6 +28,7 @@ public abstract class GT_GUICover extends GT_GUIScreen { /** * The parent GUI to exit to. -1 is ignored. + * * @param parentGuiId */ public void setParentGuiId(int parentGuiId) { @@ -37,13 +39,14 @@ public abstract class GT_GUICover extends GT_GUIScreen { 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())); + GT_Values.NW.sendToServer( + new GT_Packet_GtTileEntityGuiRequest( + 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 b0c381f104..f2352fb53d 100644 --- a/src/main/java/gregtech/api/gui/GT_GUIDialogSelectItem.java +++ b/src/main/java/gregtech/api/gui/GT_GUIDialogSelectItem.java @@ -1,19 +1,22 @@ package gregtech.api.gui; -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 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; + @Deprecated 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; @@ -25,51 +28,40 @@ public class GT_GUIDialogSelectItem extends GT_GUIScreen { // all slots not including btnCurrent private final List<GT_GuiFakeItemButton> slots = new ArrayList<>(); // the currently selected slot content - private final GT_GuiFakeItemButton btnCurrent = - new GT_GuiFakeItemButton(this, 8, 25, GT_GuiIcon.SLOT_DARKGRAY).setMimicSlot(true); + private final GT_GuiFakeItemButton btnCurrent = new GT_GuiFakeItemButton(this, 8, 25, GT_GuiIcon.SLOT_DARKGRAY) + .setMimicSlot(true); private final boolean noDeselect; private int selected; private int scroll = 0; private GT_GuiIconButton btnUp; private GT_GuiIconButton btnDown; - public GT_GUIDialogSelectItem( - String header, - ItemStack headerItem, - GuiScreen parent, - Consumer<ItemStack> selectedCallback, - List<ItemStack> stacks) { + 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) { + 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 + * 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 + * @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) { + 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); @@ -84,8 +76,9 @@ public class GT_GUIDialogSelectItem extends GT_GUIScreen { for (int i = 0; i < rows; i++) { for (int j = 0; j < cols; j++) { - slots.add(new GT_GuiFakeItemButton(this, 8 + 18 * j, 44 + 18 * i, GT_GuiIcon.SLOT_GRAY) - .setMimicSlot(true)); + slots.add( + new GT_GuiFakeItemButton(this, 8 + 18 * j, 44 + 18 * i, GT_GuiIcon.SLOT_GRAY) + .setMimicSlot(true)); } } @@ -163,8 +156,7 @@ public class GT_GUIDialogSelectItem extends GT_GUIScreen { private void fillSlots() { for (int i = 0, j = scroll * cols; i < slots.size(); i++, j++) { - slots.get(i) - .setItem(getCandidate(j)) + slots.get(i).setItem(getCandidate(j)) .setBgIcon(j == getSelected() ? GT_GuiIcon.SLOT_DARKGRAY : GT_GuiIcon.SLOT_GRAY); } } diff --git a/src/main/java/gregtech/api/gui/GT_GUIScreen.java b/src/main/java/gregtech/api/gui/GT_GUIScreen.java index 141f51e7c7..1aa9ccc24c 100644 --- a/src/main/java/gregtech/api/gui/GT_GUIScreen.java +++ b/src/main/java/gregtech/api/gui/GT_GUIScreen.java @@ -1,14 +1,8 @@ package gregtech.api.gui; -import gregtech.api.enums.Dyes; -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; @@ -16,10 +10,19 @@ import net.minecraft.client.gui.GuiTextField; import net.minecraft.client.renderer.RenderHelper; import net.minecraft.client.renderer.entity.RenderItem; import net.minecraft.util.ResourceLocation; + import org.lwjgl.input.Mouse; import org.lwjgl.opengl.GL11; import org.lwjgl.opengl.GL12; +import gregtech.api.enums.Dyes; +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; + @Deprecated public abstract class GT_GUIScreen extends GuiScreen implements GT_IToolTipRenderer, IGuiScreen { @@ -161,7 +164,7 @@ public abstract class GT_GUIScreen extends GuiScreen implements GT_IToolTipRende if (tBox.isEnabled() || hadFocus) tBox.mouseClicked(x, y, button); if (tBox.isFocused() && button == 1 && tBox.isEnabled()) // rightclick -> lcear it - tBox.setText("0"); + tBox.setText("0"); else if (hadFocus && !tBox.isFocused()) applyTextBox(tBox); } super.mouseClicked(x, y, button); diff --git a/src/main/java/gregtech/api/gui/GT_Slot_Armor.java b/src/main/java/gregtech/api/gui/GT_Slot_Armor.java index 3b454aee0e..be9b0e5e00 100644 --- a/src/main/java/gregtech/api/gui/GT_Slot_Armor.java +++ b/src/main/java/gregtech/api/gui/GT_Slot_Armor.java @@ -6,6 +6,7 @@ import net.minecraft.inventory.Slot; import net.minecraft.item.ItemStack; public class GT_Slot_Armor extends Slot { + final int mArmorType; final EntityPlayer mPlayer; diff --git a/src/main/java/gregtech/api/gui/GT_Slot_DataOrb.java b/src/main/java/gregtech/api/gui/GT_Slot_DataOrb.java index 0a78e3f0b3..115b50ddb8 100644 --- a/src/main/java/gregtech/api/gui/GT_Slot_DataOrb.java +++ b/src/main/java/gregtech/api/gui/GT_Slot_DataOrb.java @@ -1,11 +1,13 @@ package gregtech.api.gui; -import gregtech.api.enums.ItemList; import net.minecraft.inventory.IInventory; import net.minecraft.inventory.Slot; import net.minecraft.item.ItemStack; +import gregtech.api.enums.ItemList; + public class GT_Slot_DataOrb extends Slot { + public GT_Slot_DataOrb(IInventory inventory, int slotIndex, int xPos, int yPos) { super(inventory, slotIndex, xPos, yPos); } 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 bf5f8886b3..a01b91cefb 100644 --- a/src/main/java/gregtech/api/gui/GT_Slot_Holo.java +++ b/src/main/java/gregtech/api/gui/GT_Slot_Holo.java @@ -1,26 +1,22 @@ package gregtech.api.gui; -import cpw.mods.fml.relauncher.Side; -import cpw.mods.fml.relauncher.SideOnly; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.inventory.IInventory; import net.minecraft.inventory.Slot; import net.minecraft.item.ItemStack; +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; + public class GT_Slot_Holo extends Slot { + public final int mSlotIndex; public boolean mEnabled = true; 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; @@ -55,8 +51,8 @@ public class GT_Slot_Holo extends Slot { } /** - * Whether this slot should be ignored in event processing, - * for example highlight the slot on mouseOver + * Whether this slot should be ignored in event processing, for example highlight the slot on mouseOver + * * @param enabled */ public void setEnabled(boolean enabled) { diff --git a/src/main/java/gregtech/api/gui/GT_Slot_Output.java b/src/main/java/gregtech/api/gui/GT_Slot_Output.java index d348e4e236..7c883ea2d1 100644 --- a/src/main/java/gregtech/api/gui/GT_Slot_Output.java +++ b/src/main/java/gregtech/api/gui/GT_Slot_Output.java @@ -5,6 +5,7 @@ import net.minecraft.inventory.Slot; import net.minecraft.item.ItemStack; public class GT_Slot_Output extends Slot { + public GT_Slot_Output(IInventory inventory, int slotIndex, int xPos, int yPos) { super(inventory, slotIndex, xPos, yPos); } diff --git a/src/main/java/gregtech/api/gui/GT_Slot_Render.java b/src/main/java/gregtech/api/gui/GT_Slot_Render.java index dd11aa6305..ae03ce83ea 100644 --- a/src/main/java/gregtech/api/gui/GT_Slot_Render.java +++ b/src/main/java/gregtech/api/gui/GT_Slot_Render.java @@ -5,12 +5,14 @@ import net.minecraft.item.ItemStack; import net.minecraft.tileentity.TileEntity; public class GT_Slot_Render extends GT_Slot_Holo { + public GT_Slot_Render(IInventory inventory, int slotIndex, int xPos, int yPos) { super(inventory, slotIndex, xPos, yPos, false, false, 0); } /** - * NEI has a nice and "useful" Delete-All Function, which would delete the Content of this Slot. This is here to prevent that. + * NEI has a nice and "useful" Delete-All Function, which would delete the Content of this Slot. This is here to + * prevent that. */ @Override public void putStack(ItemStack aStack) { diff --git a/src/main/java/gregtech/api/gui/modularui/FallbackableSteamTexture.java b/src/main/java/gregtech/api/gui/modularui/FallbackableSteamTexture.java index 9216d1d224..f242aff0ed 100644 --- a/src/main/java/gregtech/api/gui/modularui/FallbackableSteamTexture.java +++ b/src/main/java/gregtech/api/gui/modularui/FallbackableSteamTexture.java @@ -1,15 +1,17 @@ package gregtech.api.gui.modularui; -import com.gtnewhorizons.modularui.api.drawable.UITexture; -import com.gtnewhorizons.modularui.common.internal.network.NetworkUtils; -import gregtech.api.enums.SteamVariant; import java.io.IOException; import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.Map; + import net.minecraft.client.Minecraft; +import com.gtnewhorizons.modularui.api.drawable.UITexture; +import com.gtnewhorizons.modularui.common.internal.network.NetworkUtils; +import gregtech.api.enums.SteamVariant; + public class FallbackableSteamTexture { private final SteamTexture candidate; diff --git a/src/main/java/gregtech/api/gui/modularui/GT_CoverUIBuildContext.java b/src/main/java/gregtech/api/gui/modularui/GT_CoverUIBuildContext.java index 811ad8be5f..65a61ad951 100644 --- a/src/main/java/gregtech/api/gui/modularui/GT_CoverUIBuildContext.java +++ b/src/main/java/gregtech/api/gui/modularui/GT_CoverUIBuildContext.java @@ -1,8 +1,9 @@ package gregtech.api.gui.modularui; +import net.minecraft.entity.player.EntityPlayer; + import com.gtnewhorizons.modularui.api.screen.UIBuildContext; import gregtech.api.interfaces.tileentity.ICoverable; -import net.minecraft.entity.player.EntityPlayer; public class GT_CoverUIBuildContext extends UIBuildContext { @@ -14,15 +15,15 @@ public class GT_CoverUIBuildContext extends UIBuildContext { private final int guiColorization; /** - * @param player Player opened this UI - * @param coverID See {@link ICoverable#getCoverIDAtSide} - * @param side Side this cover is attached to - * @param tile Tile this cover is attached to - * @param anotherWindow If cover UI is shown on top of another window + * @param player Player opened this UI + * @param coverID See {@link ICoverable#getCoverIDAtSide} + * @param side Side this cover is attached to + * @param tile Tile this cover is attached to + * @param anotherWindow If cover UI is shown on top of another window * @param guiColorization The color used to render machine's GUI */ - public GT_CoverUIBuildContext( - EntityPlayer player, int coverID, byte side, ICoverable tile, boolean anotherWindow, int guiColorization) { + public GT_CoverUIBuildContext(EntityPlayer player, int coverID, byte side, ICoverable tile, boolean anotherWindow, + int guiColorization) { super(player); this.coverID = coverID; this.side = side; @@ -32,10 +33,10 @@ public class GT_CoverUIBuildContext extends UIBuildContext { } /** - * @param player Player opened this UI - * @param coverID See {@link ICoverable#getCoverIDAtSide} - * @param side Side this cover is attached to - * @param tile Tile this cover is attached to + * @param player Player opened this UI + * @param coverID See {@link ICoverable#getCoverIDAtSide} + * @param side Side this cover is attached to + * @param tile Tile this cover is attached to * @param anotherWindow If cover GUI is shown in opened on top of another window */ public GT_CoverUIBuildContext(EntityPlayer player, int coverID, byte side, ICoverable tile, boolean anotherWindow) { diff --git a/src/main/java/gregtech/api/gui/modularui/GT_UIInfos.java b/src/main/java/gregtech/api/gui/modularui/GT_UIInfos.java index d1e699bb40..32ed6442c1 100644 --- a/src/main/java/gregtech/api/gui/modularui/GT_UIInfos.java +++ b/src/main/java/gregtech/api/gui/modularui/GT_UIInfos.java @@ -1,5 +1,14 @@ package gregtech.api.gui.modularui; +import java.util.HashMap; +import java.util.Map; +import java.util.function.Function; + +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.entity.player.EntityPlayerMP; +import net.minecraft.tileentity.TileEntity; +import net.minecraftforge.common.util.ForgeDirection; + import com.gtnewhorizons.modularui.api.UIInfos; import com.gtnewhorizons.modularui.api.screen.ITileWithModularUI; import com.gtnewhorizons.modularui.api.screen.ModularUIContext; @@ -10,6 +19,7 @@ import com.gtnewhorizons.modularui.common.builder.UIInfo; import com.gtnewhorizons.modularui.common.internal.network.NetworkUtils; import com.gtnewhorizons.modularui.common.internal.wrapper.ModularGui; import com.gtnewhorizons.modularui.common.internal.wrapper.ModularUIContainer; + import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; import gregtech.api.enums.GT_Values; @@ -17,47 +27,37 @@ import gregtech.api.interfaces.tileentity.ICoverable; import gregtech.api.interfaces.tileentity.IHasWorldObjectAndCoords; import gregtech.api.net.GT_Packet_SendCoverData; import gregtech.api.util.GT_CoverBehaviorBase; -import java.util.HashMap; -import java.util.Map; -import java.util.function.Function; -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.entity.player.EntityPlayerMP; -import net.minecraft.tileentity.TileEntity; -import net.minecraftforge.common.util.ForgeDirection; public class GT_UIInfos { /** - * Generator for {@link UIInfo} which is responsible for registering and opening UIs. - * Unlike {@link com.gtnewhorizons.modularui.api.UIInfos#TILE_MODULAR_UI}, this accepts - * custom constructors for UI. - * <br> Do NOT run {@link UIBuilder#build} on-the-fly, otherwise MP client won't register UIs. - * Instead, store to static field, just like {@link #GTTileEntityDefaultUI}. - * Such mistake can be easily overlooked by testing only SP. + * Generator for {@link UIInfo} which is responsible for registering and opening UIs. Unlike + * {@link com.gtnewhorizons.modularui.api.UIInfos#TILE_MODULAR_UI}, this accepts custom constructors for UI. <br> + * Do NOT run {@link UIBuilder#build} on-the-fly, otherwise MP client won't register UIs. Instead, store to static + * field, just like {@link #GTTileEntityDefaultUI}. Such mistake can be easily overlooked by testing only SP. */ - public static final Function<ContainerConstructor, UIInfo<?, ?>> GTTileEntityUIFactory = - containerConstructor -> UIBuilder.of() - .container((player, world, x, y, z) -> { - TileEntity te = world.getTileEntity(x, y, z); - if (te instanceof ITileWithModularUI) { - return createTileEntityContainer( - player, - ((ITileWithModularUI) te)::createWindow, - te::markDirty, - containerConstructor); - } - return null; - }) - .gui(((player, world, x, y, z) -> { - if (!world.isRemote) return null; - TileEntity te = world.getTileEntity(x, y, z); - if (te instanceof ITileWithModularUI) { - return createTileEntityGuiContainer( - player, ((ITileWithModularUI) te)::createWindow, containerConstructor); - } - return null; - })) - .build(); + public static final Function<ContainerConstructor, UIInfo<?, ?>> GTTileEntityUIFactory = containerConstructor -> UIBuilder + .of().container((player, world, x, y, z) -> { + TileEntity te = world.getTileEntity(x, y, z); + if (te instanceof ITileWithModularUI) { + return createTileEntityContainer( + player, + ((ITileWithModularUI) te)::createWindow, + te::markDirty, + containerConstructor); + } + return null; + }).gui(((player, world, x, y, z) -> { + if (!world.isRemote) return null; + TileEntity te = world.getTileEntity(x, y, z); + if (te instanceof ITileWithModularUI) { + return createTileEntityGuiContainer( + player, + ((ITileWithModularUI) te)::createWindow, + containerConstructor); + } + return null; + })).build(); private static final UIInfo<?, ?> GTTileEntityDefaultUI = GTTileEntityUIFactory.apply(ModularUIContainer::new); @@ -66,36 +66,31 @@ public class GT_UIInfos { static { for (byte i = 0; i < ForgeDirection.VALID_DIRECTIONS.length; i++) { final byte side = i; - coverUI.put( - side, - UIBuilder.of() - .container((player, world, x, y, z) -> { - final TileEntity te = world.getTileEntity(x, y, z); - if (!(te instanceof ICoverable)) return null; - final ICoverable gtTileEntity = (ICoverable) te; - GT_CoverBehaviorBase<?> cover = gtTileEntity.getCoverBehaviorAtSideNew(side); - return createCoverContainer( - player, - cover::createWindow, - te::markDirty, - gtTileEntity.getCoverIDAtSide(side), - side, - gtTileEntity); - }) - .gui((player, world, x, y, z) -> { - if (!world.isRemote) return null; - final TileEntity te = world.getTileEntity(x, y, z); - if (!(te instanceof ICoverable)) return null; - final ICoverable gtTileEntity = (ICoverable) te; - final GT_CoverBehaviorBase<?> cover = gtTileEntity.getCoverBehaviorAtSideNew(side); - return createCoverGuiContainer( - player, - cover::createWindow, - gtTileEntity.getCoverIDAtSide(side), - side, - gtTileEntity); - }) - .build()); + coverUI.put(side, UIBuilder.of().container((player, world, x, y, z) -> { + final TileEntity te = world.getTileEntity(x, y, z); + if (!(te instanceof ICoverable)) return null; + final ICoverable gtTileEntity = (ICoverable) te; + GT_CoverBehaviorBase<?> cover = gtTileEntity.getCoverBehaviorAtSideNew(side); + return createCoverContainer( + player, + cover::createWindow, + te::markDirty, + gtTileEntity.getCoverIDAtSide(side), + side, + gtTileEntity); + }).gui((player, world, x, y, z) -> { + if (!world.isRemote) return null; + final TileEntity te = world.getTileEntity(x, y, z); + if (!(te instanceof ICoverable)) return null; + final ICoverable gtTileEntity = (ICoverable) te; + final GT_CoverBehaviorBase<?> cover = gtTileEntity.getCoverBehaviorAtSideNew(side); + return createCoverGuiContainer( + player, + cover::createWindow, + gtTileEntity.getCoverIDAtSide(side), + side, + gtTileEntity); + }).build()); } } @@ -126,27 +121,25 @@ public class GT_UIInfos { tileEntity), (EntityPlayerMP) player); - coverUI.get(side) - .open( - player, - tileEntity.getWorld(), - tileEntity.getXCoord(), - tileEntity.getYCoord(), - tileEntity.getZCoord()); + coverUI.get(side).open( + player, + tileEntity.getWorld(), + tileEntity.getXCoord(), + tileEntity.getYCoord(), + tileEntity.getZCoord()); } /** - * Opens UI for player's item, created by {@link com.gtnewhorizons.modularui.api.screen.IItemWithModularUI#createWindow}. + * Opens UI for player's item, created by + * {@link com.gtnewhorizons.modularui.api.screen.IItemWithModularUI#createWindow}. */ public static void openPlayerHeldItemUI(EntityPlayer player) { if (NetworkUtils.isClient()) return; UIInfos.PLAYER_HELD_ITEM_UI.open(player); } - private static ModularUIContainer createTileEntityContainer( - EntityPlayer player, - Function<UIBuildContext, ModularWindow> windowCreator, - Runnable onWidgetUpdate, + private static ModularUIContainer createTileEntityContainer(EntityPlayer player, + Function<UIBuildContext, ModularWindow> windowCreator, Runnable onWidgetUpdate, ContainerConstructor containerCreator) { final UIBuildContext buildContext = new UIBuildContext(player); final ModularWindow window = windowCreator.apply(buildContext); @@ -155,23 +148,20 @@ public class GT_UIInfos { } @SideOnly(Side.CLIENT) - private static ModularGui createTileEntityGuiContainer( - EntityPlayer player, - Function<UIBuildContext, ModularWindow> windowCreator, - ContainerConstructor containerConstructor) { - final ModularUIContainer container = - createTileEntityContainer(player, windowCreator, null, containerConstructor); + private static ModularGui createTileEntityGuiContainer(EntityPlayer player, + Function<UIBuildContext, ModularWindow> windowCreator, ContainerConstructor containerConstructor) { + final ModularUIContainer container = createTileEntityContainer( + player, + windowCreator, + null, + containerConstructor); if (container == null) return null; return new ModularGui(container); } - private static ModularUIContainer createCoverContainer( - EntityPlayer player, - Function<GT_CoverUIBuildContext, ModularWindow> windowCreator, - Runnable onWidgetUpdate, - int coverID, - byte side, - ICoverable tile) { + private static ModularUIContainer createCoverContainer(EntityPlayer player, + Function<GT_CoverUIBuildContext, ModularWindow> windowCreator, Runnable onWidgetUpdate, int coverID, + byte side, ICoverable tile) { final GT_CoverUIBuildContext buildContext = new GT_CoverUIBuildContext(player, coverID, side, tile, false); final ModularWindow window = windowCreator.apply(buildContext); if (window == null) return null; @@ -179,12 +169,8 @@ public class GT_UIInfos { } @SideOnly(Side.CLIENT) - private static ModularGui createCoverGuiContainer( - EntityPlayer player, - Function<GT_CoverUIBuildContext, ModularWindow> windowCreator, - int coverID, - byte side, - ICoverable tile) { + private static ModularGui createCoverGuiContainer(EntityPlayer player, + Function<GT_CoverUIBuildContext, ModularWindow> windowCreator, int coverID, byte side, ICoverable tile) { final ModularUIContainer container = createCoverContainer(player, windowCreator, null, coverID, side, tile); if (container == null) { return null; @@ -194,6 +180,7 @@ public class GT_UIInfos { @FunctionalInterface public interface ContainerConstructor { + ModularUIContainer of(ModularUIContext context, ModularWindow mainWindow); } } diff --git a/src/main/java/gregtech/api/gui/modularui/GT_UITextures.java b/src/main/java/gregtech/api/gui/modularui/GT_UITextures.java index 3ca1e6d45e..a480178002 100644 --- a/src/main/java/gregtech/api/gui/modularui/GT_UITextures.java +++ b/src/main/java/gregtech/api/gui/modularui/GT_UITextures.java @@ -1,33 +1,34 @@ package gregtech.api.gui.modularui; -import com.gtnewhorizons.modularui.api.drawable.AdaptableUITexture; -import com.gtnewhorizons.modularui.api.drawable.UITexture; import java.util.function.BiFunction; import java.util.stream.Collectors; import java.util.stream.IntStream; +import com.gtnewhorizons.modularui.api.drawable.AdaptableUITexture; +import com.gtnewhorizons.modularui.api.drawable.UITexture; + public class GT_UITextures { private static final String MODID = "gregtech"; public static final UITexture TRANSPARENT = UITexture.fullImage(MODID, "gui/picture/transparent"); - public static final AdaptableUITexture BACKGROUND_SINGLEBLOCK_DEFAULT = - AdaptableUITexture.of(MODID, "gui/background/singleblock_default", 176, 166, 4); - public static final SteamTexture BACKGROUND_STEAM = - SteamTexture.adaptableTexture(MODID, "gui/background/%s", 176, 166, 4); - public static final UITexture BACKGROUND_FUSION_COMPUTER = - UITexture.fullImage(MODID, "gui/background/fusion_computer"); - public static final AdaptableUITexture BACKGROUND_TEXT_FIELD = - AdaptableUITexture.of(MODID, "gui/background/text_field", 142, 28, 1); - public static final AdaptableUITexture BACKGROUND_TEXT_FIELD_LIGHT_GRAY = - AdaptableUITexture.of(MODID, "gui/background/text_field_light_gray", 61, 12, 1); + public static final AdaptableUITexture BACKGROUND_SINGLEBLOCK_DEFAULT = AdaptableUITexture + .of(MODID, "gui/background/singleblock_default", 176, 166, 4); + public static final SteamTexture BACKGROUND_STEAM = SteamTexture + .adaptableTexture(MODID, "gui/background/%s", 176, 166, 4); + public static final UITexture BACKGROUND_FUSION_COMPUTER = UITexture + .fullImage(MODID, "gui/background/fusion_computer"); + public static final AdaptableUITexture BACKGROUND_TEXT_FIELD = AdaptableUITexture + .of(MODID, "gui/background/text_field", 142, 28, 1); + public static final AdaptableUITexture BACKGROUND_TEXT_FIELD_LIGHT_GRAY = AdaptableUITexture + .of(MODID, "gui/background/text_field_light_gray", 61, 12, 1); public static final SteamTexture SLOT_ITEM_STEAM = SteamTexture.fullImage(MODID, "gui/slot/item_%s"); - public static final AdaptableUITexture SLOT_DARK_GRAY = - AdaptableUITexture.of(MODID, "gui/slot/dark_gray", 18, 18, 1); - public static final AdaptableUITexture SLOT_MAINTENANCE = - AdaptableUITexture.of(MODID, "gui/slot/maintenance", 20, 20, 1); + public static final AdaptableUITexture SLOT_DARK_GRAY = AdaptableUITexture + .of(MODID, "gui/slot/dark_gray", 18, 18, 1); + public static final AdaptableUITexture SLOT_MAINTENANCE = AdaptableUITexture + .of(MODID, "gui/slot/maintenance", 20, 20, 1); public static final AdaptableUITexture SLOT_UPLIFTED = AdaptableUITexture.of(MODID, "gui/slot/uplifted", 18, 18, 1); public static final UITexture OVERLAY_SLOT_ARROW_ME = UITexture.fullImage(MODID, "gui/overlay_slot/arrow_me"); @@ -39,51 +40,51 @@ public class GT_UITextures { public static final UITexture OVERLAY_SLOT_BOX = UITexture.fullImage(MODID, "gui/overlay_slot/box"); public static final UITexture OVERLAY_SLOT_BOXED = UITexture.fullImage(MODID, "gui/overlay_slot/boxed"); public static final UITexture OVERLAY_SLOT_CANISTER = UITexture.fullImage(MODID, "gui/overlay_slot/canister"); - public static final SteamTexture OVERLAY_SLOT_CANISTER_STEAM = - SteamTexture.fullImage(MODID, "gui/overlay_slot/canister_%s"); + public static final SteamTexture OVERLAY_SLOT_CANISTER_STEAM = SteamTexture + .fullImage(MODID, "gui/overlay_slot/canister_%s"); public static final UITexture OVERLAY_SLOT_CANNER = UITexture.fullImage(MODID, "gui/overlay_slot/canner"); public static final UITexture OVERLAY_SLOT_CAULDRON = UITexture.fullImage(MODID, "gui/overlay_slot/cauldron"); public static final UITexture OVERLAY_SLOT_CENTRIFUGE = UITexture.fullImage(MODID, "gui/overlay_slot/centrifuge"); - public static final UITexture OVERLAY_SLOT_CENTRIFUGE_FLUID = - UITexture.fullImage(MODID, "gui/overlay_slot/centrifuge_fluid"); - public static final SteamTexture OVERLAY_SLOT_CENTRIFUGE_STEAM = - SteamTexture.fullImage(MODID, "gui/overlay_slot/centrifuge_%s"); + public static final UITexture OVERLAY_SLOT_CENTRIFUGE_FLUID = UITexture + .fullImage(MODID, "gui/overlay_slot/centrifuge_fluid"); + public static final SteamTexture OVERLAY_SLOT_CENTRIFUGE_STEAM = SteamTexture + .fullImage(MODID, "gui/overlay_slot/centrifuge_%s"); public static final UITexture OVERLAY_SLOT_CHARGER = UITexture.fullImage(MODID, "gui/overlay_slot/charger"); - public static final UITexture OVERLAY_SLOT_CHARGER_FLUID = - UITexture.fullImage(MODID, "gui/overlay_slot/charger_fluid"); + public static final UITexture OVERLAY_SLOT_CHARGER_FLUID = UITexture + .fullImage(MODID, "gui/overlay_slot/charger_fluid"); public static final UITexture OVERLAY_SLOT_CIRCUIT = UITexture.fullImage(MODID, "gui/overlay_slot/circuit"); - public static final SteamTexture OVERLAY_SLOT_COAL_STEAM = - SteamTexture.fullImage(MODID, "gui/overlay_slot/coal_%s"); + public static final SteamTexture OVERLAY_SLOT_COAL_STEAM = SteamTexture + .fullImage(MODID, "gui/overlay_slot/coal_%s"); public static final UITexture OVERLAY_SLOT_COMPRESSOR = UITexture.fullImage(MODID, "gui/overlay_slot/compressor"); - public static final SteamTexture OVERLAY_SLOT_COMPRESSOR_STEAM = - SteamTexture.fullImage(MODID, "gui/overlay_slot/compressor_%s"); + public static final SteamTexture OVERLAY_SLOT_COMPRESSOR_STEAM = SteamTexture + .fullImage(MODID, "gui/overlay_slot/compressor_%s"); public static final UITexture OVERLAY_SLOT_CRUSHED_ORE = UITexture.fullImage(MODID, "gui/overlay_slot/crushed_ore"); - public static final SteamTexture OVERLAY_SLOT_CRUSHED_ORE_STEAM = - SteamTexture.fullImage(MODID, "gui/overlay_slot/crushed_ore_%s"); - public static final UITexture OVERLAY_SLOT_CUTTER_SLICED = - UITexture.fullImage(MODID, "gui/overlay_slot/cutter_sliced"); + public static final SteamTexture OVERLAY_SLOT_CRUSHED_ORE_STEAM = SteamTexture + .fullImage(MODID, "gui/overlay_slot/crushed_ore_%s"); + public static final UITexture OVERLAY_SLOT_CUTTER_SLICED = UITexture + .fullImage(MODID, "gui/overlay_slot/cutter_sliced"); public static final UITexture OVERLAY_SLOT_DATA_ORB = UITexture.fullImage(MODID, "gui/overlay_slot/data_orb"); public static final UITexture OVERLAY_SLOT_DATA_STICK = UITexture.fullImage(MODID, "gui/overlay_slot/data_stick"); public static final UITexture OVERLAY_SLOT_DUST = UITexture.fullImage(MODID, "gui/overlay_slot/dust"); - public static final SteamTexture OVERLAY_SLOT_DUST_STEAM = - SteamTexture.fullImage(MODID, "gui/overlay_slot/dust_%s"); + public static final SteamTexture OVERLAY_SLOT_DUST_STEAM = SteamTexture + .fullImage(MODID, "gui/overlay_slot/dust_%s"); public static final UITexture OVERLAY_SLOT_EXPLOSIVE = UITexture.fullImage(MODID, "gui/overlay_slot/explosive"); - public static final UITexture OVERLAY_SLOT_EXTRUDER_SHAPE = - UITexture.fullImage(MODID, "gui/overlay_slot/extruder_shape"); + public static final UITexture OVERLAY_SLOT_EXTRUDER_SHAPE = UITexture + .fullImage(MODID, "gui/overlay_slot/extruder_shape"); public static final UITexture OVERLAY_SLOT_FURNACE = UITexture.fullImage(MODID, "gui/overlay_slot/furnace"); - public static final SteamTexture OVERLAY_SLOT_FURNACE_STEAM = - SteamTexture.fullImage(MODID, "gui/overlay_slot/furnace_%s"); + public static final SteamTexture OVERLAY_SLOT_FURNACE_STEAM = SteamTexture + .fullImage(MODID, "gui/overlay_slot/furnace_%s"); public static final UITexture OVERLAY_SLOT_GEM = UITexture.fullImage(MODID, "gui/overlay_slot/gem"); public static final UITexture OVERLAY_SLOT_HAMMER = UITexture.fullImage(MODID, "gui/overlay_slot/hammer"); - public static final SteamTexture OVERLAY_SLOT_HAMMER_STEAM = - SteamTexture.fullImage(MODID, "gui/overlay_slot/hammer_%s"); + public static final SteamTexture OVERLAY_SLOT_HAMMER_STEAM = SteamTexture + .fullImage(MODID, "gui/overlay_slot/hammer_%s"); public static final UITexture OVERLAY_SLOT_HEATER_1 = UITexture.fullImage(MODID, "gui/overlay_slot/heater_1"); public static final UITexture OVERLAY_SLOT_HEATER_2 = UITexture.fullImage(MODID, "gui/overlay_slot/heater_2"); public static final UITexture OVERLAY_SLOT_IMPLOSION = UITexture.fullImage(MODID, "gui/overlay_slot/implosion"); public static final UITexture OVERLAY_SLOT_IN = UITexture.fullImage(MODID, "gui/overlay_slot/in"); public static final SteamTexture OVERLAY_SLOT_IN_STEAM = SteamTexture.fullImage(MODID, "gui/overlay_slot/in_%s"); - public static final SteamTexture OVERLAY_SLOT_INGOT_STEAM = - SteamTexture.fullImage(MODID, "gui/overlay_slot/ingot_%s"); + public static final SteamTexture OVERLAY_SLOT_INGOT_STEAM = SteamTexture + .fullImage(MODID, "gui/overlay_slot/ingot_%s"); public static final UITexture OVERLAY_SLOT_INT_CIRCUIT = UITexture.fullImage(MODID, "gui/overlay_slot/int_circuit"); public static final UITexture OVERLAY_SLOT_LENS = UITexture.fullImage(MODID, "gui/overlay_slot/lens"); public static final UITexture OVERLAY_SLOT_MICROSCOPE = UITexture.fullImage(MODID, "gui/overlay_slot/microscope"); @@ -94,8 +95,8 @@ public class GT_UITextures { public static final UITexture OVERLAY_SLOT_OUT = UITexture.fullImage(MODID, "gui/overlay_slot/out"); public static final SteamTexture OVERLAY_SLOT_OUT_STEAM = SteamTexture.fullImage(MODID, "gui/overlay_slot/out_%s"); public static final UITexture OVERLAY_SLOT_PAGE_BLANK = UITexture.fullImage(MODID, "gui/overlay_slot/page_blank"); - public static final UITexture OVERLAY_SLOT_PAGE_PRINTED = - UITexture.fullImage(MODID, "gui/overlay_slot/page_printed"); + public static final UITexture OVERLAY_SLOT_PAGE_PRINTED = UITexture + .fullImage(MODID, "gui/overlay_slot/page_printed"); public static final UITexture OVERLAY_SLOT_PRESS_1 = UITexture.fullImage(MODID, "gui/overlay_slot/press_1"); public static final UITexture OVERLAY_SLOT_PRESS_2 = UITexture.fullImage(MODID, "gui/overlay_slot/press_2"); public static final UITexture OVERLAY_SLOT_PRESS_3 = UITexture.fullImage(MODID, "gui/overlay_slot/press_3"); @@ -103,8 +104,8 @@ public class GT_UITextures { public static final UITexture OVERLAY_SLOT_ROD_1 = UITexture.fullImage(MODID, "gui/overlay_slot/rod_1"); public static final UITexture OVERLAY_SLOT_ROD_2 = UITexture.fullImage(MODID, "gui/overlay_slot/rod_2"); public static final UITexture OVERLAY_SLOT_SLICE_SHAPE = UITexture.fullImage(MODID, "gui/overlay_slot/slice_shape"); - public static final UITexture OVERLAY_SLOT_SLICER_SLICED = - UITexture.fullImage(MODID, "gui/overlay_slot/slicer_sliced"); + public static final UITexture OVERLAY_SLOT_SLICER_SLICED = UITexture + .fullImage(MODID, "gui/overlay_slot/slicer_sliced"); public static final UITexture OVERLAY_SLOT_SQUARE = UITexture.fullImage(MODID, "gui/overlay_slot/square"); public static final UITexture OVERLAY_SLOT_UUA = UITexture.fullImage(MODID, "gui/overlay_slot/uua"); public static final UITexture OVERLAY_SLOT_UUM = UITexture.fullImage(MODID, "gui/overlay_slot/uum"); @@ -113,54 +114,53 @@ public class GT_UITextures { public static final UITexture OVERLAY_SLOT_WIREMILL = UITexture.fullImage(MODID, "gui/overlay_slot/wiremill"); public static final UITexture OVERLAY_SLOT_WRENCH = UITexture.fullImage(MODID, "gui/overlay_slot/wrench"); public static final UITexture[] OVERLAY_SLOTS_NUMBER = IntStream.range(0, 12) - .mapToObj(i -> UITexture.fullImage(MODID, "gui/overlay_slot/number_" + i)) - .collect(Collectors.toList()) + .mapToObj(i -> UITexture.fullImage(MODID, "gui/overlay_slot/number_" + i)).collect(Collectors.toList()) .toArray(new UITexture[0]); public static final UITexture PROGRESSBAR_ARROW = UITexture.fullImage(MODID, "gui/progressbar/arrow"); - public static final SteamTexture PROGRESSBAR_ARROW_STEAM = - SteamTexture.fullImage(MODID, "gui/progressbar/arrow_%s"); - public static final SteamTexture PROGRESSBAR_ARROW_2_STEAM = - SteamTexture.fullImage(MODID, "gui/progressbar/arrow_2_%s"); - public static final UITexture PROGRESSBAR_ARROW_MULTIPLE = - UITexture.fullImage(MODID, "gui/progressbar/arrow_multiple"); + public static final SteamTexture PROGRESSBAR_ARROW_STEAM = SteamTexture + .fullImage(MODID, "gui/progressbar/arrow_%s"); + public static final SteamTexture PROGRESSBAR_ARROW_2_STEAM = SteamTexture + .fullImage(MODID, "gui/progressbar/arrow_2_%s"); + public static final UITexture PROGRESSBAR_ARROW_MULTIPLE = UITexture + .fullImage(MODID, "gui/progressbar/arrow_multiple"); public static final UITexture PROGRESSBAR_ASSEMBLE = UITexture.fullImage(MODID, "gui/progressbar/assemble"); - public static final UITexture PROGRESSBAR_ASSEMBLY_LINE_1 = - UITexture.fullImage(MODID, "gui/progressbar/assemblyline_1"); - public static final UITexture PROGRESSBAR_ASSEMBLY_LINE_2 = - UITexture.fullImage(MODID, "gui/progressbar/assemblyline_2"); - public static final UITexture PROGRESSBAR_ASSEMBLY_LINE_3 = - UITexture.fullImage(MODID, "gui/progressbar/assemblyline_3"); + public static final UITexture PROGRESSBAR_ASSEMBLY_LINE_1 = UITexture + .fullImage(MODID, "gui/progressbar/assemblyline_1"); + public static final UITexture PROGRESSBAR_ASSEMBLY_LINE_2 = UITexture + .fullImage(MODID, "gui/progressbar/assemblyline_2"); + public static final UITexture PROGRESSBAR_ASSEMBLY_LINE_3 = UITexture + .fullImage(MODID, "gui/progressbar/assemblyline_3"); public static final UITexture PROGRESSBAR_BATH = UITexture.fullImage(MODID, "gui/progressbar/bath"); public static final UITexture PROGRESSBAR_BENDING = UITexture.fullImage(MODID, "gui/progressbar/bending"); - public static final SteamTexture PROGRESSBAR_BOILER_EMPTY_STEAM = - SteamTexture.fullImage(MODID, "gui/progressbar/boiler_empty_%s"); + public static final SteamTexture PROGRESSBAR_BOILER_EMPTY_STEAM = SteamTexture + .fullImage(MODID, "gui/progressbar/boiler_empty_%s"); public static final UITexture PROGRESSBAR_BOILER_HEAT = UITexture.fullImage(MODID, "gui/progressbar/boiler_heat"); public static final UITexture PROGRESSBAR_BOILER_STEAM = UITexture.fullImage(MODID, "gui/progressbar/boiler_steam"); public static final UITexture PROGRESSBAR_BOILER_WATER = UITexture.fullImage(MODID, "gui/progressbar/boiler_water"); public static final UITexture PROGRESSBAR_CANNER = UITexture.fullImage(MODID, "gui/progressbar/canner"); - public static final UITexture PROGRESSBAR_CIRCUIT_ASSEMBLER = - UITexture.fullImage(MODID, "gui/progressbar/circuit_assembler"); + public static final UITexture PROGRESSBAR_CIRCUIT_ASSEMBLER = UITexture + .fullImage(MODID, "gui/progressbar/circuit_assembler"); public static final UITexture PROGRESSBAR_COMPRESS = UITexture.fullImage(MODID, "gui/progressbar/compress"); - public static final SteamTexture PROGRESSBAR_COMPRESS_STEAM = - SteamTexture.fullImage(MODID, "gui/progressbar/compress_%s"); + public static final SteamTexture PROGRESSBAR_COMPRESS_STEAM = SteamTexture + .fullImage(MODID, "gui/progressbar/compress_%s"); public static final UITexture PROGRESSBAR_CUT = UITexture.fullImage(MODID, "gui/progressbar/cut"); public static final UITexture PROGRESSBAR_EXTRACT = UITexture.fullImage(MODID, "gui/progressbar/extract"); - public static final SteamTexture PROGRESSBAR_EXTRACT_STEAM = - SteamTexture.fullImage(MODID, "gui/progressbar/extract_%s"); + public static final SteamTexture PROGRESSBAR_EXTRACT_STEAM = SteamTexture + .fullImage(MODID, "gui/progressbar/extract_%s"); public static final UITexture PROGRESSBAR_EXTRUDE = UITexture.fullImage(MODID, "gui/progressbar/extrude"); public static final SteamTexture PROGRESSBAR_FUEL_STEAM = SteamTexture.fullImage(MODID, "gui/progressbar/fuel_%s"); public static final UITexture PROGRESSBAR_HAMMER = UITexture.fullImage(MODID, "gui/progressbar/hammer"); public static final UITexture PROGRESSBAR_HAMMER_BASE = UITexture.fullImage(MODID, "gui/progressbar/hammer_base"); - public static final SteamTexture PROGRESSBAR_HAMMER_STEAM = - SteamTexture.fullImage(MODID, "gui/progressbar/hammer_%s"); - public static final SteamTexture PROGRESSBAR_HAMMER_BASE_STEAM = - SteamTexture.fullImage(MODID, "gui/progressbar/hammer_base_%s"); + public static final SteamTexture PROGRESSBAR_HAMMER_STEAM = SteamTexture + .fullImage(MODID, "gui/progressbar/hammer_%s"); + public static final SteamTexture PROGRESSBAR_HAMMER_BASE_STEAM = SteamTexture + .fullImage(MODID, "gui/progressbar/hammer_base_%s"); public static final UITexture PROGRESSBAR_LATHE = UITexture.fullImage(MODID, "gui/progressbar/lathe"); public static final UITexture PROGRESSBAR_LATHE_BASE = UITexture.fullImage(MODID, "gui/progressbar/lathe_base"); public static final UITexture PROGRESSBAR_MACERATE = UITexture.fullImage(MODID, "gui/progressbar/macerate"); - public static final SteamTexture PROGRESSBAR_MACERATE_STEAM = - SteamTexture.fullImage(MODID, "gui/progressbar/macerate_%s"); + public static final SteamTexture PROGRESSBAR_MACERATE_STEAM = SteamTexture + .fullImage(MODID, "gui/progressbar/macerate_%s"); public static final UITexture PROGRESSBAR_MAGNET = UITexture.fullImage(MODID, "gui/progressbar/magnet"); public static final UITexture PROGRESSBAR_MIXER = UITexture.fullImage(MODID, "gui/progressbar/mixer"); public static final UITexture PROGRESSBAR_RECYCLE = UITexture.fullImage(MODID, "gui/progressbar/recycle"); @@ -173,36 +173,36 @@ public class GT_UITextures { public static final UITexture TAB_COVER_HIGHLIGHT = UITexture.fullImage(MODID, "gui/tab/cover_highlight"); public static final UITexture TAB_COVER_DISABLED = UITexture.fullImage(MODID, "gui/tab/cover_disabled"); public static final SteamTexture TAB_COVER_STEAM_NORMAL = SteamTexture.fullImage(MODID, "gui/tab/cover_%s_normal"); - public static final SteamTexture TAB_COVER_STEAM_HIGHLIGHT = - SteamTexture.fullImage(MODID, "gui/tab/cover_%s_highlight"); - public static final SteamTexture TAB_COVER_STEAM_DISABLED = - SteamTexture.fullImage(MODID, "gui/tab/cover_%s_disabled"); + public static final SteamTexture TAB_COVER_STEAM_HIGHLIGHT = SteamTexture + .fullImage(MODID, "gui/tab/cover_%s_highlight"); + public static final SteamTexture TAB_COVER_STEAM_DISABLED = SteamTexture + .fullImage(MODID, "gui/tab/cover_%s_disabled"); public static final AdaptableUITexture TAB_TITLE = AdaptableUITexture.of(MODID, "gui/tab/title", 28, 28, 4); - public static final AdaptableUITexture TAB_TITLE_DARK = - AdaptableUITexture.of(MODID, "gui/tab/title_dark", 28, 28, 4); - public static final SteamTexture TAB_TITLE_STEAM = - SteamTexture.adaptableTexture(MODID, "gui/tab/title_%s", 28, 28, 4); - public static final SteamTexture TAB_TITLE_DARK_STEAM = - SteamTexture.adaptableTexture(MODID, "gui/tab/title_dark_%s", 28, 28, 4); - public static final AdaptableUITexture TAB_TITLE_ANGULAR = - AdaptableUITexture.of(MODID, "gui/tab/title_angular", 28, 28, 4); - public static final SteamTexture TAB_TITLE_ANGULAR_STEAM = - SteamTexture.adaptableTexture(MODID, "gui/tab/title_angular_%s", 28, 28, 4); + public static final AdaptableUITexture TAB_TITLE_DARK = AdaptableUITexture + .of(MODID, "gui/tab/title_dark", 28, 28, 4); + public static final SteamTexture TAB_TITLE_STEAM = SteamTexture + .adaptableTexture(MODID, "gui/tab/title_%s", 28, 28, 4); + public static final SteamTexture TAB_TITLE_DARK_STEAM = SteamTexture + .adaptableTexture(MODID, "gui/tab/title_dark_%s", 28, 28, 4); + public static final AdaptableUITexture TAB_TITLE_ANGULAR = AdaptableUITexture + .of(MODID, "gui/tab/title_angular", 28, 28, 4); + public static final SteamTexture TAB_TITLE_ANGULAR_STEAM = SteamTexture + .adaptableTexture(MODID, "gui/tab/title_angular_%s", 28, 28, 4); public static final UITexture BUTTON_STANDARD = AdaptableUITexture.of(MODID, "gui/button/standard", 18, 18, 1); - public static final UITexture BUTTON_STANDARD_TOGGLE = - AdaptableUITexture.of(MODID, "gui/button/standard_toggle", 18, 18, 1); + public static final UITexture BUTTON_STANDARD_TOGGLE = AdaptableUITexture + .of(MODID, "gui/button/standard_toggle", 18, 18, 1); public static final UITexture BUTTON_COVER_NORMAL = UITexture.fullImage(MODID, "gui/button/cover_normal"); - public static final UITexture BUTTON_COVER_NORMAL_HOVERED = - UITexture.fullImage(MODID, "gui/button/cover_normal_hovered"); - public static final UITexture BUTTON_COVER_NORMAL_DISABLED = - UITexture.fullImage(MODID, "gui/button/cover_normal_disabled"); + public static final UITexture BUTTON_COVER_NORMAL_HOVERED = UITexture + .fullImage(MODID, "gui/button/cover_normal_hovered"); + public static final UITexture BUTTON_COVER_NORMAL_DISABLED = UITexture + .fullImage(MODID, "gui/button/cover_normal_disabled"); public static final UITexture OVERLAY_BUTTON_DISABLE = UITexture.fullImage(MODID, "gui/overlay_button/disable"); - public static final UITexture OVERLAY_BUTTON_REDSTONE_OFF = - UITexture.fullImage(MODID, "gui/overlay_button/redstone_off"); - public static final UITexture OVERLAY_BUTTON_REDSTONE_ON = - UITexture.fullImage(MODID, "gui/overlay_button/redstone_on"); + public static final UITexture OVERLAY_BUTTON_REDSTONE_OFF = UITexture + .fullImage(MODID, "gui/overlay_button/redstone_off"); + public static final UITexture OVERLAY_BUTTON_REDSTONE_ON = UITexture + .fullImage(MODID, "gui/overlay_button/redstone_on"); public static final UITexture OVERLAY_BUTTON_CHECKMARK = UITexture.fullImage(MODID, "gui/overlay_button/checkmark"); public static final UITexture OVERLAY_BUTTON_CROSS = UITexture.fullImage(MODID, "gui/overlay_button/cross"); public static final UITexture OVERLAY_BUTTON_WHITELIST = UITexture.fullImage(MODID, "gui/overlay_button/whitelist"); @@ -210,77 +210,77 @@ public class GT_UITextures { public static final UITexture OVERLAY_BUTTON_PROGRESS = UITexture.fullImage(MODID, "gui/overlay_button/progress"); public static final UITexture OVERLAY_BUTTON_EXPORT = UITexture.fullImage(MODID, "gui/overlay_button/export"); public static final UITexture OVERLAY_BUTTON_IMPORT = UITexture.fullImage(MODID, "gui/overlay_button/import"); - public static final UITexture OVERLAY_BUTTON_AUTOOUTPUT_ITEM = - UITexture.fullImage(MODID, "gui/overlay_button/autooutput_item"); - public static final UITexture OVERLAY_BUTTON_AUTOOUTPUT_FLUID = - UITexture.fullImage(MODID, "gui/overlay_button/autooutput_fluid"); - public static final UITexture OVERLAY_BUTTON_ALLOW_INPUT = - UITexture.fullImage(MODID, "gui/overlay_button/allow_input"); - public static final UITexture OVERLAY_BUTTON_BLOCK_INPUT = - UITexture.fullImage(MODID, "gui/overlay_button/block_input"); - public static final UITexture OVERLAY_BUTTON_ARROW_GREEN_UP = - UITexture.fullImage(MODID, "gui/overlay_button/arrow_green_up"); - public static final UITexture OVERLAY_BUTTON_ARROW_GREEN_DOWN = - UITexture.fullImage(MODID, "gui/overlay_button/arrow_green_down"); + public static final UITexture OVERLAY_BUTTON_AUTOOUTPUT_ITEM = UITexture + .fullImage(MODID, "gui/overlay_button/autooutput_item"); + public static final UITexture OVERLAY_BUTTON_AUTOOUTPUT_FLUID = UITexture + .fullImage(MODID, "gui/overlay_button/autooutput_fluid"); + public static final UITexture OVERLAY_BUTTON_ALLOW_INPUT = UITexture + .fullImage(MODID, "gui/overlay_button/allow_input"); + public static final UITexture OVERLAY_BUTTON_BLOCK_INPUT = UITexture + .fullImage(MODID, "gui/overlay_button/block_input"); + public static final UITexture OVERLAY_BUTTON_ARROW_GREEN_UP = UITexture + .fullImage(MODID, "gui/overlay_button/arrow_green_up"); + public static final UITexture OVERLAY_BUTTON_ARROW_GREEN_DOWN = UITexture + .fullImage(MODID, "gui/overlay_button/arrow_green_down"); public static final UITexture OVERLAY_BUTTON_CYCLIC = UITexture.fullImage(MODID, "gui/overlay_button/cyclic"); - public static final UITexture OVERLAY_BUTTON_EMIT_ENERGY = - UITexture.fullImage(MODID, "gui/overlay_button/emit_energy"); - public static final UITexture OVERLAY_BUTTON_EMIT_REDSTONE = - UITexture.fullImage(MODID, "gui/overlay_button/emit_redstone"); - public static final UITexture OVERLAY_BUTTON_INVERT_REDSTONE = - UITexture.fullImage(MODID, "gui/overlay_button/invert_redstone"); - public static final UITexture OVERLAY_BUTTON_STOCKING_MODE = - UITexture.fullImage(MODID, "gui/overlay_button/stocking_mode"); - public static final UITexture OVERLAY_BUTTON_INVERT_FILTER = - UITexture.fullImage(MODID, "gui/overlay_button/invert_filter"); + public static final UITexture OVERLAY_BUTTON_EMIT_ENERGY = UITexture + .fullImage(MODID, "gui/overlay_button/emit_energy"); + public static final UITexture OVERLAY_BUTTON_EMIT_REDSTONE = UITexture + .fullImage(MODID, "gui/overlay_button/emit_redstone"); + public static final UITexture OVERLAY_BUTTON_INVERT_REDSTONE = UITexture + .fullImage(MODID, "gui/overlay_button/invert_redstone"); + public static final UITexture OVERLAY_BUTTON_STOCKING_MODE = UITexture + .fullImage(MODID, "gui/overlay_button/stocking_mode"); + public static final UITexture OVERLAY_BUTTON_INVERT_FILTER = UITexture + .fullImage(MODID, "gui/overlay_button/invert_filter"); public static final UITexture OVERLAY_BUTTON_NBT = UITexture.fullImage(MODID, "gui/overlay_button/nbt"); public static final UITexture OVERLAY_BUTTON_PRINT = UITexture.fullImage(MODID, "gui/overlay_button/print"); public static final UITexture OVERLAY_BUTTON_TRANSPOSE = UITexture.fullImage(MODID, "gui/overlay_button/transpose"); - public static final UITexture OVERLAY_BUTTON_BOUNDING_BOX = - UITexture.fullImage(MODID, "gui/overlay_button/bounding_box"); - public static final UITexture OVERLAY_BUTTON_MINUS_SMALL = - UITexture.fullImage(MODID, "gui/overlay_button/minus_small"); - public static final UITexture OVERLAY_BUTTON_MINUS_LARGE = - UITexture.fullImage(MODID, "gui/overlay_button/minus_large"); - public static final UITexture OVERLAY_BUTTON_PLUS_SMALL = - UITexture.fullImage(MODID, "gui/overlay_button/plus_small"); - public static final UITexture OVERLAY_BUTTON_PLUS_LARGE = - UITexture.fullImage(MODID, "gui/overlay_button/plus_large"); + public static final UITexture OVERLAY_BUTTON_BOUNDING_BOX = UITexture + .fullImage(MODID, "gui/overlay_button/bounding_box"); + public static final UITexture OVERLAY_BUTTON_MINUS_SMALL = UITexture + .fullImage(MODID, "gui/overlay_button/minus_small"); + public static final UITexture OVERLAY_BUTTON_MINUS_LARGE = UITexture + .fullImage(MODID, "gui/overlay_button/minus_large"); + public static final UITexture OVERLAY_BUTTON_PLUS_SMALL = UITexture + .fullImage(MODID, "gui/overlay_button/plus_small"); + public static final UITexture OVERLAY_BUTTON_PLUS_LARGE = UITexture + .fullImage(MODID, "gui/overlay_button/plus_large"); public static final UITexture OVERLAY_BUTTON_GATE_AND = UITexture.fullImage(MODID, "gui/overlay_button/gate_and"); public static final UITexture OVERLAY_BUTTON_GATE_NAND = UITexture.fullImage(MODID, "gui/overlay_button/gate_nand"); public static final UITexture OVERLAY_BUTTON_GATE_OR = UITexture.fullImage(MODID, "gui/overlay_button/gate_or"); public static final UITexture OVERLAY_BUTTON_GATE_NOR = UITexture.fullImage(MODID, "gui/overlay_button/gate_nor"); public static final UITexture OVERLAY_BUTTON_ANALOG = UITexture.fullImage(MODID, "gui/overlay_button/analog"); public static final UITexture OVERLAY_BUTTON_LOCK = UITexture.fullImage(MODID, "gui/overlay_button/lock"); - public static final UITexture OVERLAY_BUTTON_INPUT_FROM_OUTPUT_SIDE = - UITexture.fullImage(MODID, "gui/overlay_button/input_from_output_side"); - public static final UITexture OVERLAY_BUTTON_VOID_EXCESS = - UITexture.fullImage(MODID, "gui/overlay_button/void_excess"); + public static final UITexture OVERLAY_BUTTON_INPUT_FROM_OUTPUT_SIDE = UITexture + .fullImage(MODID, "gui/overlay_button/input_from_output_side"); + public static final UITexture OVERLAY_BUTTON_VOID_EXCESS = UITexture + .fullImage(MODID, "gui/overlay_button/void_excess"); public static final UITexture OVERLAY_BUTTON_VOID_ALL = UITexture.fullImage(MODID, "gui/overlay_button/void_all"); public static final UITexture OVERLAY_BUTTON_NEI = UITexture.fullImage(MODID, "gui/overlay_button/nei"); /** * Can adjust size as needed. */ - public static final AdaptableUITexture PICTURE_SCREEN_BLACK = - AdaptableUITexture.of(MODID, "gui/picture/screen_black", 16, 16, 2); + public static final AdaptableUITexture PICTURE_SCREEN_BLACK = AdaptableUITexture + .of(MODID, "gui/picture/screen_black", 16, 16, 2); - public static final UITexture PICTURE_RADIATION_WARNING = - UITexture.fullImage(MODID, "gui/picture/radiation_warning"); - public static final UITexture PICTURE_GT_LOGO_17x17_TRANSPARENT = - UITexture.fullImage(MODID, "gui/picture/gt_logo_17x17_transparent"); - public static final UITexture PICTURE_GT_LOGO_17x17_TRANSPARENT_GRAY = - UITexture.fullImage(MODID, "gui/picture/gt_logo_17x17_transparent_gray"); - public static final SteamTexture PICTURE_GT_LOGO_17x17_TRANSPARENT_STEAM = - SteamTexture.fullImage(MODID, "gui/picture/gt_logo_17x17_transparent_%s"); + public static final UITexture PICTURE_RADIATION_WARNING = UITexture + .fullImage(MODID, "gui/picture/radiation_warning"); + public static final UITexture PICTURE_GT_LOGO_17x17_TRANSPARENT = UITexture + .fullImage(MODID, "gui/picture/gt_logo_17x17_transparent"); + public static final UITexture PICTURE_GT_LOGO_17x17_TRANSPARENT_GRAY = UITexture + .fullImage(MODID, "gui/picture/gt_logo_17x17_transparent_gray"); + public static final SteamTexture PICTURE_GT_LOGO_17x17_TRANSPARENT_STEAM = SteamTexture + .fullImage(MODID, "gui/picture/gt_logo_17x17_transparent_%s"); public static final UITexture PICTURE_GT_LOGO_18x18 = UITexture.fullImage(MODID, "gui/picture/gt_logo_18x18"); public static final UITexture PICTURE_GT_LOGO_19x19 = UITexture.fullImage(MODID, "gui/picture/gt_logo_19x19"); public static final UITexture PICTURE_INFORMATION = UITexture.fullImage(MODID, "gui/picture/information"); - public static final UITexture PICTURE_STALLED_ELECTRICITY = - UITexture.fullImage(MODID, "gui/picture/stalled_electricity"); + public static final UITexture PICTURE_STALLED_ELECTRICITY = UITexture + .fullImage(MODID, "gui/picture/stalled_electricity"); public static final UITexture PICTURE_STALLED_STEAM = UITexture.fullImage(MODID, "gui/picture/stalled_steam"); - public static final BiFunction<Integer, Boolean, UITexture> PICTURE_ARROW_22_RED = - (width, fromRight) -> UITexture.partly( + public static final BiFunction<Integer, Boolean, UITexture> PICTURE_ARROW_22_RED = (width, fromRight) -> UITexture + .partly( MODID, "gui/picture/arrow_22_red", 87, @@ -289,8 +289,8 @@ public class GT_UITextures { 0, fromRight ? 87 : width, 22); - public static final BiFunction<Integer, Boolean, UITexture> PICTURE_ARROW_22_BLUE = - (width, fromRight) -> UITexture.partly( + public static final BiFunction<Integer, Boolean, UITexture> PICTURE_ARROW_22_BLUE = (width, fromRight) -> UITexture + .partly( MODID, "gui/picture/arrow_22_blue", 87, @@ -299,8 +299,8 @@ public class GT_UITextures { 0, fromRight ? 87 : width, 22); - public static final BiFunction<Integer, Boolean, UITexture> PICTURE_ARROW_22_WHITE = - (width, fromRight) -> UITexture.partly( + public static final BiFunction<Integer, Boolean, UITexture> PICTURE_ARROW_22_WHITE = (width, fromRight) -> UITexture + .partly( MODID, "gui/picture/arrow_22_white", 87, @@ -309,8 +309,8 @@ public class GT_UITextures { 0, fromRight ? 87 : width, 22); - public static final BiFunction<Integer, Boolean, UITexture> PICTURE_ARROW_24_RED = - (width, fromRight) -> UITexture.partly( + public static final BiFunction<Integer, Boolean, UITexture> PICTURE_ARROW_24_RED = (width, fromRight) -> UITexture + .partly( MODID, "gui/picture/arrow_24_red", 69, @@ -319,8 +319,8 @@ public class GT_UITextures { 0, fromRight ? 69 : width, 24); - public static final BiFunction<Integer, Boolean, UITexture> PICTURE_ARROW_24_BLUE = - (width, fromRight) -> UITexture.partly( + public static final BiFunction<Integer, Boolean, UITexture> PICTURE_ARROW_24_BLUE = (width, fromRight) -> UITexture + .partly( MODID, "gui/picture/arrow_24_blue", 69, @@ -329,8 +329,8 @@ public class GT_UITextures { 0, fromRight ? 69 : width, 24); - public static final BiFunction<Integer, Boolean, UITexture> PICTURE_ARROW_24_WHITE = - (width, fromRight) -> UITexture.partly( + public static final BiFunction<Integer, Boolean, UITexture> PICTURE_ARROW_24_WHITE = (width, fromRight) -> UITexture + .partly( MODID, "gui/picture/arrow_24_white", 69, @@ -344,8 +344,8 @@ public class GT_UITextures { public static final UITexture PICTURE_SLOTS_HOLO_3BY3 = UITexture.fullImage(MODID, "gui/picture/slots_holo_3by3"); public static final UITexture PICTURE_ARROW_DOUBLE = UITexture.fullImage(MODID, "gui/picture/arrow_double"); public static final UITexture PICTURE_SUPER_BUFFER = UITexture.fullImage(MODID, "gui/picture/super_buffer"); - public static final UITexture PICTURE_SQUARE_LIGHT_GRAY = - UITexture.fullImage(MODID, "gui/picture/square_light_gray"); + public static final UITexture PICTURE_SQUARE_LIGHT_GRAY = UITexture + .fullImage(MODID, "gui/picture/square_light_gray"); public static final UITexture PICTURE_GAUGE = UITexture.fullImage(MODID, "gui/picture/gauge"); public static final UITexture PICTURE_ITEM_IN = UITexture.fullImage(MODID, "gui/picture/item_in"); public static final UITexture PICTURE_ITEM_OUT = UITexture.fullImage(MODID, "gui/picture/item_out"); diff --git a/src/main/java/gregtech/api/gui/modularui/GUITextureSet.java b/src/main/java/gregtech/api/gui/modularui/GUITextureSet.java index 13d7eadfee..1bacff886a 100644 --- a/src/main/java/gregtech/api/gui/modularui/GUITextureSet.java +++ b/src/main/java/gregtech/api/gui/modularui/GUITextureSet.java @@ -1,17 +1,19 @@ package gregtech.api.gui.modularui; +import java.util.function.Function; + import com.gtnewhorizons.modularui.api.ModularUITextures; import com.gtnewhorizons.modularui.api.drawable.AdaptableUITexture; import com.gtnewhorizons.modularui.api.drawable.UITexture; import gregtech.api.enums.SteamVariant; -import java.util.function.Function; /** - * Set of textures that is commonly used for GUI but can vary depending on "style" of machines, - * e.g. bronze steam or steel steam. - * <br> This has builder pattern; Textures you didn't specify will fall back to default ones. + * Set of textures that is commonly used for GUI but can vary depending on "style" of machines, e.g. bronze steam or + * steel steam. <br> + * This has builder pattern; Textures you didn't specify will fall back to default ones. */ public class GUITextureSet { + private UITexture mainBackground; private UITexture itemSlot; private UITexture fluidSlot; @@ -27,11 +29,12 @@ public class GUITextureSet { private UITexture gregtechLogo; public static final GUITextureSet DEFAULT = new GUITextureSet() - .setMainBackground(GT_UITextures.BACKGROUND_SINGLEBLOCK_DEFAULT) - .setItemSlot(ModularUITextures.ITEM_SLOT) + .setMainBackground(GT_UITextures.BACKGROUND_SINGLEBLOCK_DEFAULT).setItemSlot(ModularUITextures.ITEM_SLOT) .setFluidSlot(ModularUITextures.FLUID_SLOT) .setCoverTab( - GT_UITextures.TAB_COVER_NORMAL, GT_UITextures.TAB_COVER_HIGHLIGHT, GT_UITextures.TAB_COVER_DISABLED) + GT_UITextures.TAB_COVER_NORMAL, + GT_UITextures.TAB_COVER_HIGHLIGHT, + GT_UITextures.TAB_COVER_DISABLED) .setTitleTab(GT_UITextures.TAB_TITLE, GT_UITextures.TAB_TITLE_DARK, GT_UITextures.TAB_TITLE_ANGULAR) .setGregTechLogo(GT_UITextures.PICTURE_GT_LOGO_17x17_TRANSPARENT); @@ -77,8 +80,8 @@ public class GUITextureSet { return this; } - public GUITextureSet setTitleTab( - AdaptableUITexture titleNormal, AdaptableUITexture titleDark, AdaptableUITexture titleTabAngular) { + public GUITextureSet setTitleTab(AdaptableUITexture titleNormal, AdaptableUITexture titleDark, + AdaptableUITexture titleTabAngular) { this.titleTabNormal = titleNormal; this.titleTabDark = titleDark; this.titleTabAngular = titleTabAngular; diff --git a/src/main/java/gregtech/api/gui/modularui/IDataFollowerWidget.java b/src/main/java/gregtech/api/gui/modularui/IDataFollowerWidget.java index 40ebcea0f4..87833da7b3 100644 --- a/src/main/java/gregtech/api/gui/modularui/IDataFollowerWidget.java +++ b/src/main/java/gregtech/api/gui/modularui/IDataFollowerWidget.java @@ -1,19 +1,21 @@ package gregtech.api.gui.modularui; +import java.util.function.Consumer; +import java.util.function.Function; + import com.gtnewhorizons.modularui.api.widget.Widget; + import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; import gregtech.api.util.ISerializableObject; import gregtech.common.gui.modularui.widget.DataControllerWidget; -import java.util.function.Consumer; -import java.util.function.Function; /** - * Widget whose state is controlled by specific data. - * Data can be anything, e.g. {@link ISerializableObject} or machine recipe mode. - * <br> No widgets implementing this interface should not sync; - * Instead, {@link DataControllerWidget} will sync data, either when this widget triggers update on client - * or data update is detected on server. + * Widget whose state is controlled by specific data. Data can be anything, e.g. {@link ISerializableObject} or machine + * recipe mode. <br> + * No widgets implementing this interface should not sync; Instead, {@link DataControllerWidget} will sync data, either + * when this widget triggers update on client or data update is detected on server. + * * @param <T> Data type stored in the parent widget * @param <U> State type stored in this widget * @see DataControllerWidget @@ -22,21 +24,20 @@ import java.util.function.Function; public interface IDataFollowerWidget<T, U> { /** - * Sets function to get widget state from provided data. This function will be called when client receives data - * from server and {@link DataControllerWidget} updates all children, including this widget. + * Sets function to get widget state from provided data. This function will be called when client receives data from + * server and {@link DataControllerWidget} updates all children, including this widget. */ Widget setDataToStateGetter(Function<T, U> dataToStateGetter); /** - * Sets setter called when this widget gets action from player. - * Basically the same functionality with widgets that have getter/setter. + * Sets setter called when this widget gets action from player. Basically the same functionality with widgets that + * have getter/setter. */ Widget setStateSetter(Consumer<U> setter); /** - * Updates state of this widget with provided data. - * On server {@link DataControllerWidget} won't propagate data update to this widget, - * so this method is client-only. + * Updates state of this widget with provided data. On server {@link DataControllerWidget} won't propagate data + * update to this widget, so this method is client-only. */ @SideOnly(Side.CLIENT) void updateState(T data); diff --git a/src/main/java/gregtech/api/gui/modularui/SteamTexture.java b/src/main/java/gregtech/api/gui/modularui/SteamTexture.java index 9e52c0f874..619b19e232 100644 --- a/src/main/java/gregtech/api/gui/modularui/SteamTexture.java +++ b/src/main/java/gregtech/api/gui/modularui/SteamTexture.java @@ -5,8 +5,7 @@ import com.gtnewhorizons.modularui.api.drawable.UITexture; import gregtech.api.enums.SteamVariant; /** - * Wrapper for {@link UITexture}s used to - * ease in choosing between Bronze, Steel and Primitive textures. + * Wrapper for {@link UITexture}s used to ease in choosing between Bronze, Steel and Primitive textures. */ public class SteamTexture { @@ -27,13 +26,21 @@ public class SteamTexture { UITexture.fullImage(mod, String.format(location, SteamVariant.PRIMITIVE))); } - public static SteamTexture adaptableTexture( - String mod, String location, int imageWidth, int imageHeight, int borderWidthPixel) { + public static SteamTexture adaptableTexture(String mod, String location, int imageWidth, int imageHeight, + int borderWidthPixel) { return new SteamTexture( AdaptableUITexture.of( - mod, String.format(location, SteamVariant.BRONZE), imageWidth, imageHeight, borderWidthPixel), + mod, + String.format(location, SteamVariant.BRONZE), + imageWidth, + imageHeight, + borderWidthPixel), AdaptableUITexture.of( - mod, String.format(location, SteamVariant.STEEL), imageWidth, imageHeight, borderWidthPixel), + mod, + String.format(location, SteamVariant.STEEL), + imageWidth, + imageHeight, + borderWidthPixel), AdaptableUITexture.of( mod, String.format(location, SteamVariant.PRIMITIVE), 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 d5e383ed50..639b402856 100644 --- a/src/main/java/gregtech/api/gui/widgets/GT_GuiCoverTabLine.java +++ b/src/main/java/gregtech/api/gui/widgets/GT_GuiCoverTabLine.java @@ -1,34 +1,33 @@ package gregtech.api.gui.widgets; -import codechicken.nei.api.API; -import codechicken.nei.api.INEIGuiAdapter; -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; +import codechicken.nei.api.API; +import codechicken.nei.api.INEIGuiAdapter; +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; + /** * 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 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" - }; + 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" }; // Not sure there's a point in JIT translation but that's what this is private String[] translatedSides; @@ -38,35 +37,24 @@ 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 - * @param tabHeight height of a tab - * @param tabWidth width of a tab - * @param tabSpacing pixels between each tab - * @param xDir whether to extend the line horizontally to the right (NORMAL), - * the left (INVERSE) or not at all (NONE) - * @param yDir whether to extend the line vertically down (NORMAL), up (INVERSE) - * or not at all (NONE) - * @param displayMode whether to display on the left side of the GT_ITabRenderer - * (NORMAL), on it's right side (INVERSE) or not at all (NONE) + * @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 + * @param tabHeight height of a tab + * @param tabWidth width of a tab + * @param tabSpacing pixels between each tab + * @param xDir whether to extend the line horizontally to the right (NORMAL), the left (INVERSE) or not at + * all (NONE) + * @param yDir whether to extend the line vertically down (NORMAL), up (INVERSE) or not at all (NONE) + * @param displayMode whether to display on the left side of the GT_ITabRenderer (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 - * @param tile The IGregTechTileEntity the covers of which we are accessing - * @param colorization The colorization of the GUI we are adding tabs to + * @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; @@ -89,27 +77,31 @@ public class GT_GuiCoverTabLine extends GT_GuiTabLine { @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); } @Override 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)); + 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)); } } /** * Add the cover on this side of the IGregTechTileEntity to the tabs + * * @param side * @param cover */ @@ -121,6 +113,7 @@ public class GT_GuiCoverTabLine extends GT_GuiTabLine { /** * Decorate the cover's tooltips according to the side it's on and on whether the tab is enabled or not + * * @param side * @param cover * @param enabled @@ -130,8 +123,7 @@ public class GT_GuiCoverTabLine extends GT_GuiTabLine { final List<String> tooltip = cover.getTooltip(Minecraft.getMinecraft().thePlayer, true); tooltip.set( 0, - (enabled ? EnumChatFormatting.UNDERLINE : EnumChatFormatting.DARK_GRAY) - + getSideDescription(side) + (enabled ? EnumChatFormatting.UNDERLINE : EnumChatFormatting.DARK_GRAY) + getSideDescription(side) + (enabled ? EnumChatFormatting.RESET + ": " : ": " + EnumChatFormatting.RESET) + tooltip.get(0)); return tooltip.toArray(new String[0]); @@ -139,6 +131,7 @@ public class GT_GuiCoverTabLine extends GT_GuiTabLine { /** * Get the translated name for a side of the IGregTechTileEntity + * * @param side * @return translated name for a side of the IGregTechTileEntity */ @@ -156,6 +149,7 @@ public class GT_GuiCoverTabLine extends GT_GuiTabLine { * Hide any NEI slots that would intersect with a cover tab */ static class CoverTabLineNEIHandler extends INEIGuiAdapter { + @Override public boolean hideItemPanelSlot(GuiContainer gui, int x, int y, int w, int h) { final Rectangle neiSlotArea = new Rectangle(x, y, w, h); 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 7a57c49515..bfeb84d762 100644 --- a/src/main/java/gregtech/api/gui/widgets/GT_GuiFakeItemButton.java +++ b/src/main/java/gregtech/api/gui/widgets/GT_GuiFakeItemButton.java @@ -1,16 +1,19 @@ 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 codechicken.lib.gui.GuiDraw; +import gregtech.api.interfaces.IGuiScreen; +import gregtech.api.util.GT_UtilityClient; + public class GT_GuiFakeItemButton implements IGuiScreen.IGuiElement { private GT_GuiIcon bgIcon; @@ -19,6 +22,7 @@ public class GT_GuiFakeItemButton implements IGuiScreen.IGuiElement { private int xPosition, yPosition; private List<String> itemTooltips; private final GT_GuiTooltip tooltip = new GT_GuiTooltip(null) { + @Override public List<String> getToolTipText() { return itemTooltips; @@ -112,26 +116,24 @@ public class GT_GuiFakeItemButton implements IGuiScreen.IGuiElement { GL11.glPushAttrib(GL11.GL_ENABLE_BIT); GL11.glEnable(GL12.GL_RESCALE_NORMAL); } - gui.getItemRenderer() - .renderItemAndEffectIntoGUI( - gui.getFontRenderer(), - Minecraft.getMinecraft().getTextureManager(), - item, - xPosition, - yPosition); + gui.getItemRenderer().renderItemAndEffectIntoGUI( + gui.getFontRenderer(), + Minecraft.getMinecraft().getTextureManager(), + item, + xPosition, + yPosition); if (item.getItem() instanceof ItemBlock) GL11.glPopAttrib(); } - if (getMimicSlot()) - if (getBounds().contains(mouseX - gui.getGuiLeft(), mouseY - gui.getGuiTop())) { - GL11.glDisable(GL11.GL_LIGHTING); - GL11.glDisable(GL11.GL_DEPTH_TEST); - GL11.glColorMask(true, true, true, false); - GuiDraw.drawGradientRect(xPosition, yPosition, 16, 16, 0x80ffffff, 0x80ffffff); - GL11.glColorMask(true, true, true, true); - // no glEnable, state will be recovered by glPopAttrib - } + if (getMimicSlot()) if (getBounds().contains(mouseX - gui.getGuiLeft(), mouseY - gui.getGuiTop())) { + GL11.glDisable(GL11.GL_LIGHTING); + GL11.glDisable(GL11.GL_DEPTH_TEST); + GL11.glColorMask(true, true, true, false); + GuiDraw.drawGradientRect(xPosition, yPosition, 16, 16, 0x80ffffff, 0x80ffffff); + GL11.glColorMask(true, true, true, true); + // no glEnable, state will be recovered by glPopAttrib + } GL11.glPopAttrib(); } 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 43fbe0711c..01c8671678 100644 --- a/src/main/java/gregtech/api/gui/widgets/GT_GuiIcon.java +++ b/src/main/java/gregtech/api/gui/widgets/GT_GuiIcon.java @@ -1,12 +1,15 @@ package gregtech.api.gui.widgets; -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; +import gregtech.api.interfaces.IGuiIcon; + public enum GT_GuiIcon implements IGuiIcon { + BUTTON_NORMAL(0, 0, 0), BUTTON_DOWN(0, 32, 0), BUTTON_HIGHLIGHT(0, 32 * 2, 0), @@ -52,15 +55,12 @@ public enum GT_GuiIcon implements IGuiIcon { 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), - ; + 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"), - }; + 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"), }; public final int x, y, width, height; public final IGuiIcon overlay; @@ -83,20 +83,13 @@ public enum GT_GuiIcon implements IGuiIcon { 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()]); 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 fd9a879902..01bbccc599 100644 --- a/src/main/java/gregtech/api/gui/widgets/GT_GuiIconButton.java +++ b/src/main/java/gregtech/api/gui/widgets/GT_GuiIconButton.java @@ -1,12 +1,16 @@ 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 gregtech.api.interfaces.IGuiScreen; + public class GT_GuiIconButton extends GuiButton implements IGuiScreen.IGuiElement { + public static final int DEFAULT_WIDTH = 16; public static final int DEFAULT_HEIGHT = 16; @@ -43,8 +47,7 @@ public class GT_GuiIconButton extends GuiButton implements IGuiScreen.IGuiElemen if (this.visible) { // moused over - this.field_146123_n = mouseX >= this.xPosition - && mouseY >= this.yPosition + this.field_146123_n = mouseX >= this.xPosition && mouseY >= this.yPosition && mouseX < this.xPosition + width && mouseY < this.yPosition + height; @@ -57,7 +60,7 @@ 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); + // 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); 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 113b19711b..636ff0bc26 100644 --- a/src/main/java/gregtech/api/gui/widgets/GT_GuiIconCheckButton.java +++ b/src/main/java/gregtech/api/gui/widgets/GT_GuiIconCheckButton.java @@ -3,6 +3,7 @@ package gregtech.api.gui.widgets; import gregtech.api.interfaces.IGuiScreen; public class GT_GuiIconCheckButton extends GT_GuiIconButton { + private final GT_GuiIcon checkedIcon; private final GT_GuiIcon normalIcon; private final String checkedTooltip; @@ -13,15 +14,8 @@ 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; 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 3e2ac1e296..b2430f7b76 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,14 @@ 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 gregtech.api.interfaces.IGuiScreen; + public class GT_GuiIntegerTextBox extends GuiTextField implements IGuiScreen.IGuiElement { + private final int x0, y0; private final IGuiScreen gui; public final int id; @@ -43,8 +46,7 @@ public class GT_GuiIntegerTextBox extends GuiTextField implements IGuiScreen.IGu @Override public boolean textboxKeyTyped(char c, int key) { - if (validChar(c, key) - || c == 1 + if (validChar(c, key) || c == 1 || c == 3 || c == 22 || c == 24 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 105e919149..015c8c7697 100644 --- a/src/main/java/gregtech/api/gui/widgets/GT_GuiSlotTooltip.java +++ b/src/main/java/gregtech/api/gui/widgets/GT_GuiSlotTooltip.java @@ -1,10 +1,13 @@ package gregtech.api.gui.widgets; -import gregtech.api.util.GT_TooltipDataCache.TooltipData; import java.awt.Rectangle; + import net.minecraft.inventory.Slot; +import gregtech.api.util.GT_TooltipDataCache.TooltipData; + public class GT_GuiSlotTooltip extends GT_GuiTooltip { + private final Slot slot; public GT_GuiSlotTooltip(Slot slot, TooltipData data) { 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 2bb28fb929..ffae5c30e6 100644 --- a/src/main/java/gregtech/api/gui/widgets/GT_GuiSmartTooltip.java +++ b/src/main/java/gregtech/api/gui/widgets/GT_GuiSmartTooltip.java @@ -1,10 +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(); } 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 1bb2f6dbb7..661ed81fce 100644 --- a/src/main/java/gregtech/api/gui/widgets/GT_GuiTab.java +++ b/src/main/java/gregtech/api/gui/widgets/GT_GuiTab.java @@ -1,19 +1,23 @@ package gregtech.api.gui.widgets; -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; +import gregtech.api.gui.widgets.GT_GuiTabLine.GT_GuiTabIconSet; +import gregtech.api.gui.widgets.GT_GuiTabLine.GT_ITabRenderer; +import gregtech.api.interfaces.IGuiIcon; + /** * A tab to be attached to a tab line */ public class GT_GuiTab { + private static final int SLOT_SIZE = 18; public boolean visible = true, mousedOver, enabled = true; @@ -29,24 +33,17 @@ 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 - * @param tabBackground set of background textures - * @param item item to draw atop the background texture, not colored - * @param overlay texture to draw atop the background texture, not colored - * @param tooltipText tooltip of this tab + * @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 + * @param tabBackground set of background textures + * @param item item to draw atop the background texture, not colored + * @param overlay texture to draw atop the background texture, not colored + * @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; @@ -133,13 +130,12 @@ public class GT_GuiTab { GL11.glEnable(GL12.GL_RESCALE_NORMAL); } int margin = (bounds.height - SLOT_SIZE); - gui.getItemRenderer() - .renderItemAndEffectIntoGUI( - gui.getFontRenderer(), - Minecraft.getMinecraft().getTextureManager(), - item, - bounds.x + (this.flipHorizontally ? 0 : margin), - bounds.y + margin); + gui.getItemRenderer().renderItemAndEffectIntoGUI( + gui.getFontRenderer(), + Minecraft.getMinecraft().getTextureManager(), + item, + bounds.x + (this.flipHorizontally ? 0 : margin), + bounds.y + margin); if (item.getItem() instanceof ItemBlock) GL11.glPopAttrib(); diff --git a/src/main/java/gregtech/api/gui/widgets/GT_GuiTabLine.java b/src/main/java/gregtech/api/gui/widgets/GT_GuiTabLine.java index ff0ccc2ac1..cb94a81dfa 100644 --- a/src/main/java/gregtech/api/gui/widgets/GT_GuiTabLine.java +++ b/src/main/java/gregtech/api/gui/widgets/GT_GuiTabLine.java @@ -1,20 +1,25 @@ package gregtech.api.gui.widgets; -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; +import gregtech.api.interfaces.IGuiIcon; + /** * Draws clickable and configurable tabs on the left or right side of another GUI */ public class GT_GuiTabLine { + /** * Defines a set of textures a tab line can use to render it's tab backgrounds */ public static class GT_GuiTabIconSet { + public IGuiIcon disabled; public IGuiIcon normal; public IGuiIcon highlight; @@ -30,6 +35,7 @@ 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); @@ -46,10 +52,11 @@ public class GT_GuiTabLine { } /** - * A GUI should implement these methods as well as call the tab line's - * onMouseClicked, onInit and drawTabs for the tab line to attach to it properly. + * A GUI should implement these methods as well as call the tab line's onMouseClicked, onInit and drawTabs for the + * tab line to attach to it properly. */ public interface GT_ITabRenderer { + int getGuiLeft(); int getGuiTop(); @@ -82,32 +89,22 @@ public class GT_GuiTabLine { /** * 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 - * @param tabLineTop top position of the tab line in relation to the gui - * @param tabHeight height of a tab - * @param tabWidth width of a tab - * @param tabSpacing pixels between each tab - * @param xDir whether to extend the line horizontally to the right (NORMAL), - * the left (INVERSE) or not at all (NONE) - * @param yDir whether to extend the line vertically down (NORMAL), up (INVERSE) - * or not at all (NONE) - * @param displayMode whether to display on the left side of the GT_ITabRenderer - * (NORMAL), on it's right side (INVERSE) or not at all (NONE) + * @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 + * @param tabLineTop top position of the tab line in relation to the gui + * @param tabHeight height of a tab + * @param tabWidth width of a tab + * @param tabSpacing pixels between each tab + * @param xDir whether to extend the line horizontally to the right (NORMAL), the left (INVERSE) or not at + * all (NONE) + * @param yDir whether to extend the line vertically down (NORMAL), up (INVERSE) or not at all (NONE) + * @param displayMode whether to display on the left side of the GT_ITabRenderer (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, + 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]; @@ -124,8 +121,7 @@ public class GT_GuiTabLine { } /** - * Creates a new tab at the specified position with the given parameters. - * This class handles the positioning. + * Creates a new tab at the specified position with the given parameters. This class handles the positioning. * * @param tabId * @param item @@ -167,9 +163,8 @@ public class GT_GuiTabLine { } /** - * Draw the tabs for this tab bar - * GT_ITabRenderer must call this method on drawGuiContainerBackgroundLayer - * or on drawScreen. + * Draw the tabs for this tab bar GT_ITabRenderer must call this method on drawGuiContainerBackgroundLayer or on + * drawScreen. * * @param parTicks * @param mouseX @@ -217,8 +212,7 @@ public class GT_GuiTabLine { } /** - * Call tabClick for every tab that was clicked. - * GT_ITabRenderer must call this method on mouseClicked. + * Call tabClick for every tab that was clicked. GT_ITabRenderer must call this method on mouseClicked. * * @param mouseX * @param mouseY @@ -242,8 +236,7 @@ public class GT_GuiTabLine { protected void tabClicked(int tabId, int mouseButton) {} /** - * Reposition ourselves whenever the GT_ITabRenderer does so. - * GT_ITabRenderer must call this method on Init. + * Reposition ourselves whenever the GT_ITabRenderer does so. GT_ITabRenderer must call this method on Init. */ public void onInit() { for (int i = 0; i < mTabs.length; i++) { @@ -260,8 +253,7 @@ public class GT_GuiTabLine { * @return */ private int getTabX(int tabId) { - return this.gui.getGuiLeft() - + (flipHorizontally ? (gui.getXSize() - tabLineLeft - tabWidth) : tabLineLeft) + return this.gui.getGuiLeft() + (flipHorizontally ? (gui.getXSize() - tabLineLeft - tabWidth) : tabLineLeft) + (tabId * (tabWidth + tabSpacing) * xDir.getValue()); } 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 ab755eb2c3..1162630d5e 100644 --- a/src/main/java/gregtech/api/gui/widgets/GT_GuiTooltip.java +++ b/src/main/java/gregtech/api/gui/widgets/GT_GuiTooltip.java @@ -1,13 +1,15 @@ 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 org.lwjgl.input.Keyboard; +import gregtech.api.util.GT_TooltipDataCache.TooltipData; + public class GT_GuiTooltip { protected Rectangle bounds; @@ -16,8 +18,8 @@ public class GT_GuiTooltip { public boolean enabled = true; /** - * 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. + * 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 @@ -28,8 +30,8 @@ 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. + * 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 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 1c31670071..a74f5adda5 100644 --- a/src/main/java/gregtech/api/gui/widgets/GT_GuiTooltipManager.java +++ b/src/main/java/gregtech/api/gui/widgets/GT_GuiTooltipManager.java @@ -2,10 +2,13 @@ package gregtech.api.gui.widgets; 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(); @@ -46,9 +49,7 @@ 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; diff --git a/src/main/java/gregtech/api/interfaces/IBlockContainer.java b/src/main/java/gregtech/api/interfaces/IBlockContainer.java index 89bda5de12..5a80655a5c 100644 --- a/src/main/java/gregtech/api/interfaces/IBlockContainer.java +++ b/src/main/java/gregtech/api/interfaces/IBlockContainer.java @@ -3,6 +3,7 @@ package gregtech.api.interfaces; import net.minecraft.block.Block; public interface IBlockContainer { + Block getBlock(); byte getMeta(); diff --git a/src/main/java/gregtech/api/interfaces/IBlockOnWalkOver.java b/src/main/java/gregtech/api/interfaces/IBlockOnWalkOver.java index 50f6cce5d9..0c8fce931b 100644 --- a/src/main/java/gregtech/api/interfaces/IBlockOnWalkOver.java +++ b/src/main/java/gregtech/api/interfaces/IBlockOnWalkOver.java @@ -4,5 +4,6 @@ import net.minecraft.entity.EntityLivingBase; import net.minecraft.world.World; public interface IBlockOnWalkOver { + void onWalkOver(EntityLivingBase aEntity, World aWorld, int aX, int aY, int aZ); } diff --git a/src/main/java/gregtech/api/interfaces/IChunkLoader.java b/src/main/java/gregtech/api/interfaces/IChunkLoader.java index adba5e721e..b597d6a71f 100644 --- a/src/main/java/gregtech/api/interfaces/IChunkLoader.java +++ b/src/main/java/gregtech/api/interfaces/IChunkLoader.java @@ -4,6 +4,7 @@ import net.minecraft.world.ChunkCoordIntPair; // This interface is implemented by the machines that actively load a working chunk public interface IChunkLoader { + // return a working chunk coordinates, may be null ChunkCoordIntPair getActiveChunk(); } diff --git a/src/main/java/gregtech/api/interfaces/IColorModulationContainer.java b/src/main/java/gregtech/api/interfaces/IColorModulationContainer.java index d3c312e610..55053e1d12 100644 --- a/src/main/java/gregtech/api/interfaces/IColorModulationContainer.java +++ b/src/main/java/gregtech/api/interfaces/IColorModulationContainer.java @@ -1,5 +1,6 @@ package gregtech.api.interfaces; public interface IColorModulationContainer { + short[] getRGBA(); } diff --git a/src/main/java/gregtech/api/interfaces/ICondition.java b/src/main/java/gregtech/api/interfaces/ICondition.java index b29b960650..554cd2df77 100644 --- a/src/main/java/gregtech/api/interfaces/ICondition.java +++ b/src/main/java/gregtech/api/interfaces/ICondition.java @@ -1,11 +1,13 @@ package gregtech.api.interfaces; public interface ICondition<O> { + boolean isTrue(O aObject); // Utility Classes for adding relations between Conditions. class Not<O> implements ICondition<O> { + private final ICondition<O> mCondition; public Not(ICondition<O> aCondition) { @@ -19,6 +21,7 @@ public interface ICondition<O> { } class Or<O> implements ICondition<O> { + private final ICondition<O>[] mConditions; public Or(ICondition<O>... aConditions) { @@ -33,6 +36,7 @@ public interface ICondition<O> { } class Nor<O> implements ICondition<O> { + private final ICondition<O>[] mConditions; public Nor(ICondition<O>... aConditions) { @@ -47,6 +51,7 @@ public interface ICondition<O> { } class And<O> implements ICondition<O> { + private final ICondition<O>[] mConditions; public And(ICondition<O>... aConditions) { @@ -61,6 +66,7 @@ public interface ICondition<O> { } class Nand<O> implements ICondition<O> { + private final ICondition<O>[] mConditions; public Nand(ICondition<O>... aConditions) { @@ -75,6 +81,7 @@ public interface ICondition<O> { } class Xor<O> implements ICondition<O> { + private final ICondition<O> mCondition1, mCondition2; public Xor(ICondition<O> aCondition1, ICondition<O> aCondition2) { @@ -89,6 +96,7 @@ public interface ICondition<O> { } class Equal<O> implements ICondition<O> { + private final ICondition<O> mCondition1, mCondition2; public Equal(ICondition<O> aCondition1, ICondition<O> aCondition2) { diff --git a/src/main/java/gregtech/api/interfaces/IConfigurationCircuitSupport.java b/src/main/java/gregtech/api/interfaces/IConfigurationCircuitSupport.java index b2d32b2fc4..6ec9f68a8b 100644 --- a/src/main/java/gregtech/api/interfaces/IConfigurationCircuitSupport.java +++ b/src/main/java/gregtech/api/interfaces/IConfigurationCircuitSupport.java @@ -1,14 +1,17 @@ package gregtech.api.interfaces; -import gregtech.api.GregTech_API; import java.util.List; + import net.minecraft.item.ItemStack; +import gregtech.api.GregTech_API; + /** - * Implement this interface if your tileentity (or metatileentity) supports configuration circuits - * to resolve recipe conflicts. + * Implement this interface if your tileentity (or metatileentity) supports configuration circuits to resolve recipe + * conflicts. */ public interface IConfigurationCircuitSupport { + /** * * @return Integrated circuit slot index in the machine inventory diff --git a/src/main/java/gregtech/api/interfaces/IDamagableItem.java b/src/main/java/gregtech/api/interfaces/IDamagableItem.java index b360556aa3..5f0d53b577 100644 --- a/src/main/java/gregtech/api/interfaces/IDamagableItem.java +++ b/src/main/java/gregtech/api/interfaces/IDamagableItem.java @@ -3,5 +3,6 @@ package gregtech.api.interfaces; import net.minecraft.item.ItemStack; public interface IDamagableItem { + boolean doDamageToItem(ItemStack aStack, int aVanillaDamage); } diff --git a/src/main/java/gregtech/api/interfaces/IDebugableBlock.java b/src/main/java/gregtech/api/interfaces/IDebugableBlock.java index 063f713fe4..9c6ab660bd 100644 --- a/src/main/java/gregtech/api/interfaces/IDebugableBlock.java +++ b/src/main/java/gregtech/api/interfaces/IDebugableBlock.java @@ -1,25 +1,23 @@ package gregtech.api.interfaces; 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. */ public interface IDebugableBlock { + /** - * Returns a Debug Message, for a generic DebugItem - * Blocks have to implement this interface NOT TileEntities! + * Returns a Debug Message, for a generic DebugItem Blocks have to implement this interface NOT TileEntities! * * @param aPlayer the Player, who rightclicked with his Debug Item * @param aX Block-Coordinate * @param aY Block-Coordinate * @param aZ Block-Coordinate - * @param aLogLevel the Log Level of the Debug Item. - * 0 = Obvious - * 1 = Visible for the regular Scanner - * 2 = Only visible to more advanced Scanners - * 3 = Debug ONLY + * @param aLogLevel the Log Level of the Debug Item. 0 = Obvious 1 = Visible for the regular Scanner 2 = Only + * visible to more advanced Scanners 3 = Debug ONLY * @return a String-Array containing the DebugInfo, every Index is a separate line (0 = first Line) */ ArrayList<String> getDebugInfo(EntityPlayer aPlayer, int aX, int aY, int aZ, int aLogLevel); diff --git a/src/main/java/gregtech/api/interfaces/IDescribable.java b/src/main/java/gregtech/api/interfaces/IDescribable.java index 3e72f587db..21bb520482 100644 --- a/src/main/java/gregtech/api/interfaces/IDescribable.java +++ b/src/main/java/gregtech/api/interfaces/IDescribable.java @@ -4,6 +4,7 @@ package gregtech.api.interfaces; * To get simple things like a ToolTip Description */ public interface IDescribable { + /** * The Tooltip Text */ diff --git a/src/main/java/gregtech/api/interfaces/IDragAndDropSupport.java b/src/main/java/gregtech/api/interfaces/IDragAndDropSupport.java index 53b3a2b059..3527b2e60d 100644 --- a/src/main/java/gregtech/api/interfaces/IDragAndDropSupport.java +++ b/src/main/java/gregtech/api/interfaces/IDragAndDropSupport.java @@ -1,14 +1,16 @@ package gregtech.api.interfaces; +import java.util.Collections; +import java.util.List; + +import net.minecraft.client.gui.inventory.GuiContainer; +import net.minecraft.item.ItemStack; + import codechicken.nei.NEIClientUtils; import codechicken.nei.VisiblityData; import codechicken.nei.api.INEIGuiHandler; import codechicken.nei.api.TaggedInventoryArea; import cpw.mods.fml.common.Optional; -import java.util.Collections; -import java.util.List; -import net.minecraft.client.gui.inventory.GuiContainer; -import net.minecraft.item.ItemStack; /** * Implement this interface if your GuiContainer supports Drag-And-Drop behavior on NEI. @@ -17,19 +19,21 @@ import net.minecraft.item.ItemStack; public interface IDragAndDropSupport extends INEIGuiHandler { /** - * Implement this to handle Drag-And-Drop behavior. - * This may be invoked on normal click too ({@code isGhost==false}), so be careful - * if your slot supports both Drag-And-Drop and other behaviors e.g. fluid I/O with FluidDisplay click - * @param gui Current gui instance. Make sure to check if it is an instance of your GuiContainer. - * @param mousex X position of the mouse - * @param mousey Y position of the mouse + * Implement this to handle Drag-And-Drop behavior. This may be invoked on normal click too + * ({@code isGhost==false}), so be careful if your slot supports both Drag-And-Drop and other behaviors e.g. fluid + * I/O with FluidDisplay click + * + * @param gui Current gui instance. Make sure to check if it is an instance of your GuiContainer. + * @param mousex X position of the mouse + * @param mousey Y position of the mouse * @param draggedStack ItemStack user is holding on cursor - * @param button 0 = left click, 1 = right click - * @param isGhost Whether {@code draggedStack} is dragged from ItemPanel/BookmarkPanel, or actual item player holds + * @param button 0 = left click, 1 = right click + * @param isGhost Whether {@code draggedStack} is dragged from ItemPanel/BookmarkPanel, or actual item player + * holds * @return True if success */ - boolean handleDragAndDropGT( - GuiContainer gui, int mousex, int mousey, ItemStack draggedStack, int button, boolean isGhost); + boolean handleDragAndDropGT(GuiContainer gui, int mousex, int mousey, ItemStack draggedStack, int button, + boolean isGhost); default boolean handleDragNDrop(GuiContainer gui, int mousex, int mousey, ItemStack draggedStack, int button) { return handleDragAndDropGT(gui, mousex, mousey, draggedStack, button, NEIClientUtils.getHeldItem() == null); diff --git a/src/main/java/gregtech/api/interfaces/IFoodStat.java b/src/main/java/gregtech/api/interfaces/IFoodStat.java index 4f4c696e12..c768c5ca1c 100644 --- a/src/main/java/gregtech/api/interfaces/IFoodStat.java +++ b/src/main/java/gregtech/api/interfaces/IFoodStat.java @@ -1,11 +1,13 @@ package gregtech.api.interfaces; -import gregtech.api.items.GT_MetaBase_Item; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.EnumAction; import net.minecraft.item.ItemStack; +import gregtech.api.items.GT_MetaBase_Item; + public interface IFoodStat { + /** * Warning the "aPlayer" Parameter may be null! */ diff --git a/src/main/java/gregtech/api/interfaces/IGlobalWirelessEnergy.java b/src/main/java/gregtech/api/interfaces/IGlobalWirelessEnergy.java index 91ada956bf..29b32b5d3b 100644 --- a/src/main/java/gregtech/api/interfaces/IGlobalWirelessEnergy.java +++ b/src/main/java/gregtech/api/interfaces/IGlobalWirelessEnergy.java @@ -2,11 +2,13 @@ package gregtech.api.interfaces; import static gregtech.common.misc.GlobalVariableStorage.*; -import gregtech.common.misc.GlobalEnergyWorldSavedData; import java.math.BigInteger; import java.util.UUID; + import net.minecraft.entity.player.EntityPlayer; +import gregtech.common.misc.GlobalEnergyWorldSavedData; + // 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 // multi-blocks directly into the users network. diff --git a/src/main/java/gregtech/api/interfaces/IGuiIcon.java b/src/main/java/gregtech/api/interfaces/IGuiIcon.java index 3204c35b4e..0bc7408250 100644 --- a/src/main/java/gregtech/api/interfaces/IGuiIcon.java +++ b/src/main/java/gregtech/api/interfaces/IGuiIcon.java @@ -4,6 +4,7 @@ package gregtech.api.interfaces; * To allow addons to make use of GT_GuiIcon */ public interface IGuiIcon { + int getX(); int getY(); diff --git a/src/main/java/gregtech/api/interfaces/IGuiScreen.java b/src/main/java/gregtech/api/interfaces/IGuiScreen.java index 2f12781a77..c33838fc7f 100644 --- a/src/main/java/gregtech/api/interfaces/IGuiScreen.java +++ b/src/main/java/gregtech/api/interfaces/IGuiScreen.java @@ -1,13 +1,15 @@ package gregtech.api.interfaces; -import gregtech.api.gui.widgets.GT_GuiTooltip; import net.minecraft.client.gui.FontRenderer; import net.minecraft.client.gui.GuiButton; import net.minecraft.client.renderer.entity.RenderItem; +import gregtech.api.gui.widgets.GT_GuiTooltip; + public interface IGuiScreen { interface IGuiElement { + void onInit(); default void onRemoved() {} diff --git a/src/main/java/gregtech/api/interfaces/IHasFluidDisplayItem.java b/src/main/java/gregtech/api/interfaces/IHasFluidDisplayItem.java index dc844b8a85..59bac8296b 100644 --- a/src/main/java/gregtech/api/interfaces/IHasFluidDisplayItem.java +++ b/src/main/java/gregtech/api/interfaces/IHasFluidDisplayItem.java @@ -1,5 +1,6 @@ package gregtech.api.interfaces; public interface IHasFluidDisplayItem { + void updateFluidDisplayItem(); } diff --git a/src/main/java/gregtech/api/interfaces/IHasIndexedTexture.java b/src/main/java/gregtech/api/interfaces/IHasIndexedTexture.java index 7401d35323..ed31984b6e 100644 --- a/src/main/java/gregtech/api/interfaces/IHasIndexedTexture.java +++ b/src/main/java/gregtech/api/interfaces/IHasIndexedTexture.java @@ -4,10 +4,12 @@ package gregtech.api.interfaces; * To be implemented on blocks. Usually machine casing blocks. */ public interface IHasIndexedTexture { + /** * Returns the statically mapped texture for this casing. Return * {@link gregtech.api.enums.Textures.BlockIcons#ERROR_TEXTURE_INDEX} if meta maps to a nonexistent block, or the * block does not have a statically mapped texture. + * * @param aMeta block meta * @return texture index into {@link gregtech.api.enums.Textures.BlockIcons#casingTexturePages} */ diff --git a/src/main/java/gregtech/api/interfaces/IHatchElement.java b/src/main/java/gregtech/api/interfaces/IHatchElement.java index 276a7a1a9c..254d9562c2 100644 --- a/src/main/java/gregtech/api/interfaces/IHatchElement.java +++ b/src/main/java/gregtech/api/interfaces/IHatchElement.java @@ -1,19 +1,23 @@ package gregtech.api.interfaces; -import com.google.common.collect.ImmutableList; -import com.gtnewhorizon.structurelib.structure.IStructureElement; -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; import java.util.function.BiPredicate; import java.util.function.ToLongFunction; + import net.minecraftforge.common.util.ForgeDirection; +import com.google.common.collect.ImmutableList; +import com.gtnewhorizon.structurelib.structure.IStructureElement; + +import gregtech.api.interfaces.metatileentity.IMetaTileEntity; +import gregtech.api.interfaces.tileentity.IGregTechTileEntity; +import gregtech.api.util.GT_StructureUtility; +import gregtech.api.util.IGT_HatchAdder; + public interface IHatchElement<T> { + List<? extends Class<? extends IMetaTileEntity>> mteClasses(); IGT_HatchAdder<? super T> adder(); @@ -55,35 +59,21 @@ public interface IHatchElement<T> { default <T2 extends T> IStructureElement<T2> newAny(int aCasingIndex, int aDot) { if (aCasingIndex < 0 || aDot < 0) throw new IllegalArgumentException(); - return GT_StructureUtility.<T2>buildHatchAdder() - .anyOf(this) - .casingIndex(aCasingIndex) - .dot(aDot) - .continueIfSuccess() - .build(); + return GT_StructureUtility.<T2>buildHatchAdder().anyOf(this).casingIndex(aCasingIndex).dot(aDot) + .continueIfSuccess().build(); } default <T2 extends T> IStructureElement<T2> newAny(int aCasingIndex, int aDot, ForgeDirection... allowedFacings) { if (aCasingIndex < 0 || aDot < 0) throw new IllegalArgumentException(); - return GT_StructureUtility.<T2>buildHatchAdder() - .anyOf(this) - .casingIndex(aCasingIndex) - .dot(aDot) - .continueIfSuccess() - .allowOnly(allowedFacings) - .build(); + return GT_StructureUtility.<T2>buildHatchAdder().anyOf(this).casingIndex(aCasingIndex).dot(aDot) + .continueIfSuccess().allowOnly(allowedFacings).build(); } - default <T2 extends T> IStructureElement<T2> newAny( - int aCasingIndex, int aDot, BiPredicate<? super T2, ? super IGregTechTileEntity> aShouldSkip) { + default <T2 extends T> IStructureElement<T2> newAny(int aCasingIndex, int aDot, + BiPredicate<? super T2, ? super IGregTechTileEntity> aShouldSkip) { if (aCasingIndex < 0 || aDot < 0 || aShouldSkip == null) throw new IllegalArgumentException(); - return GT_StructureUtility.<T2>buildHatchAdder() - .anyOf(this) - .casingIndex(aCasingIndex) - .dot(aDot) - .shouldSkip(aShouldSkip) - .continueIfSuccess() - .build(); + return GT_StructureUtility.<T2>buildHatchAdder().anyOf(this).casingIndex(aCasingIndex).dot(aDot) + .shouldSkip(aShouldSkip).continueIfSuccess().build(); } default <T2 extends T> IHatchElement<T2> or(IHatchElement<? super T2> fallback) { @@ -92,6 +82,7 @@ public interface IHatchElement<T> { } class HatchElementEither<T> implements IHatchElement<T> { + private final IHatchElement<? super T> first, second; private ImmutableList<? extends Class<? extends IMetaTileEntity>> mMteClasses; private String name; @@ -103,11 +94,8 @@ class HatchElementEither<T> implements IHatchElement<T> { @Override public List<? extends Class<? extends IMetaTileEntity>> mteClasses() { - if (mMteClasses == null) - mMteClasses = ImmutableList.<Class<? extends IMetaTileEntity>>builder() - .addAll(first.mteClasses()) - .addAll(second.mteClasses()) - .build(); + if (mMteClasses == null) mMteClasses = ImmutableList.<Class<? extends IMetaTileEntity>>builder() + .addAll(first.mteClasses()).addAll(second.mteClasses()).build(); return mMteClasses; } @@ -129,18 +117,15 @@ class HatchElementEither<T> implements IHatchElement<T> { } class HatchElement<T> implements IHatchElement<T> { + private final List<Class<? extends IMetaTileEntity>> mClasses; private final IGT_HatchAdder<? super T> mAdder; private final String mName; 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 f30145165b..37f7969d56 100644 --- a/src/main/java/gregtech/api/interfaces/IHeatingCoil.java +++ b/src/main/java/gregtech/api/interfaces/IHeatingCoil.java @@ -1,9 +1,11 @@ package gregtech.api.interfaces; -import gregtech.api.enums.HeatingCoilLevel; import java.util.function.Consumer; + import net.minecraft.item.ItemStack; +import gregtech.api.enums.HeatingCoilLevel; + public interface IHeatingCoil { HeatingCoilLevel getCoilHeat(int meta); diff --git a/src/main/java/gregtech/api/interfaces/IIconContainer.java b/src/main/java/gregtech/api/interfaces/IIconContainer.java index 8090ce7cb9..fbb9e53519 100644 --- a/src/main/java/gregtech/api/interfaces/IIconContainer.java +++ b/src/main/java/gregtech/api/interfaces/IIconContainer.java @@ -2,12 +2,14 @@ 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 cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; + public interface IIconContainer { + /** * @return A regular Icon. */ @@ -26,8 +28,7 @@ public interface IIconContainer { @SideOnly(Side.CLIENT) default int getIconPasses() { return 1; - } - ; + }; /** * @return the Default Texture File for this Icon. diff --git a/src/main/java/gregtech/api/interfaces/IItemBehaviour.java b/src/main/java/gregtech/api/interfaces/IItemBehaviour.java index 9a513c2af5..33e5db783a 100644 --- a/src/main/java/gregtech/api/interfaces/IItemBehaviour.java +++ b/src/main/java/gregtech/api/interfaces/IItemBehaviour.java @@ -1,8 +1,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; @@ -12,34 +11,18 @@ import net.minecraft.item.Item; import net.minecraft.item.ItemStack; import net.minecraft.world.World; +import gregtech.api.enums.SubTag; +import gregtech.api.items.GT_MetaBase_Item; + 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); @@ -55,9 +38,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/IItemContainer.java b/src/main/java/gregtech/api/interfaces/IItemContainer.java index 36363b8da1..de94606e95 100644 --- a/src/main/java/gregtech/api/interfaces/IItemContainer.java +++ b/src/main/java/gregtech/api/interfaces/IItemContainer.java @@ -5,6 +5,7 @@ import net.minecraft.item.Item; import net.minecraft.item.ItemStack; public interface IItemContainer { + Item getItem(); Block getBlock(); diff --git a/src/main/java/gregtech/api/interfaces/IMaterialHandler.java b/src/main/java/gregtech/api/interfaces/IMaterialHandler.java index 9ca97981bf..b26951121b 100644 --- a/src/main/java/gregtech/api/interfaces/IMaterialHandler.java +++ b/src/main/java/gregtech/api/interfaces/IMaterialHandler.java @@ -3,6 +3,7 @@ package gregtech.api.interfaces; import gregtech.api.enums.Materials; public interface IMaterialHandler { + void onMaterialsInit(); void onComponentInit(); diff --git a/src/main/java/gregtech/api/interfaces/INetworkUpdatableItem.java b/src/main/java/gregtech/api/interfaces/INetworkUpdatableItem.java index de251017a1..b7e7b0ce33 100644 --- a/src/main/java/gregtech/api/interfaces/INetworkUpdatableItem.java +++ b/src/main/java/gregtech/api/interfaces/INetworkUpdatableItem.java @@ -5,19 +5,21 @@ import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; /** - * Together with {@link gregtech.api.net.GT_Packet_UpdateItem} you can request server side to update item in hand with - * a NBT tag. + * Together with {@link gregtech.api.net.GT_Packet_UpdateItem} you can request server side to update item in hand with a + * NBT tag. * * Usual NBT tag size limit applies. */ public interface INetworkUpdatableItem { + /** * Receive update from client. Runs on server thread. - * @param stack Stack being updated + * + * @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) + * @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/IOreRecipeRegistrator.java b/src/main/java/gregtech/api/interfaces/IOreRecipeRegistrator.java index 322586dc90..714342ae7e 100644 --- a/src/main/java/gregtech/api/interfaces/IOreRecipeRegistrator.java +++ b/src/main/java/gregtech/api/interfaces/IOreRecipeRegistrator.java @@ -1,12 +1,15 @@ package gregtech.api.interfaces; +import net.minecraft.item.ItemStack; + import gregtech.api.enums.Materials; import gregtech.api.enums.OrePrefixes; -import net.minecraft.item.ItemStack; public interface IOreRecipeRegistrator { + /** - * Contains a Code Fragment, used in the OrePrefix to register Recipes. Better than using a switch/case, like I did before. + * Contains a Code Fragment, used in the OrePrefix to register Recipes. Better than using a switch/case, like I did + * before. * * @param aPrefix always != null * @param aMaterial always != null, and can be == _NULL if the Prefix is Self Referencing or not Material based! diff --git a/src/main/java/gregtech/api/interfaces/IProjectileItem.java b/src/main/java/gregtech/api/interfaces/IProjectileItem.java index 9441e2991b..a1cfb7f4d1 100644 --- a/src/main/java/gregtech/api/interfaces/IProjectileItem.java +++ b/src/main/java/gregtech/api/interfaces/IProjectileItem.java @@ -1,25 +1,29 @@ package gregtech.api.interfaces; -import gregtech.api.enums.SubTag; import net.minecraft.entity.EntityLivingBase; import net.minecraft.entity.projectile.EntityArrow; import net.minecraft.item.ItemStack; import net.minecraft.world.World; +import gregtech.api.enums.SubTag; + public interface IProjectileItem { + /** * @return if this Item has an Arrow Entity */ boolean hasProjectile(SubTag aProjectileType, ItemStack aStack); /** - * @return an Arrow Entity to be spawned. If null then this is not an Arrow. Note: Other Projectiles still extend EntityArrow + * @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, double aX, double aY, double aZ); /** - * @return an Arrow Entity to be spawned. If null then this is not an Arrow. Note: Other Projectiles still extend EntityArrow + * @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/IRedstoneCircuitBlock.java b/src/main/java/gregtech/api/interfaces/IRedstoneCircuitBlock.java index 73a81cc74b..91219368b7 100644 --- a/src/main/java/gregtech/api/interfaces/IRedstoneCircuitBlock.java +++ b/src/main/java/gregtech/api/interfaces/IRedstoneCircuitBlock.java @@ -1,14 +1,16 @@ package gregtech.api.interfaces; -import gregtech.api.interfaces.tileentity.ICoverable; -import gregtech.api.util.GT_CoverBehavior; import net.minecraft.block.Block; import net.minecraft.tileentity.TileEntity; +import gregtech.api.interfaces.tileentity.ICoverable; +import gregtech.api.util.GT_CoverBehavior; + /** * Implemented by the MetaTileEntity of the Redstone Circuit Block */ public interface IRedstoneCircuitBlock { + /** * The Output Direction the Circuit Block is Facing */ @@ -20,8 +22,8 @@ public interface IRedstoneCircuitBlock { boolean setRedstone(byte aStrength, byte aSide); /** - * returns Output Redstone State at Side - * Note that setRedstone checks if there is a Difference between the old and the new Setting before consuming any Energy + * returns Output Redstone State at Side Note that setRedstone checks if there is a Difference between the old and + * the new Setting before consuming any Energy */ byte getOutputRedstone(byte aSide); diff --git a/src/main/java/gregtech/api/interfaces/ISecondaryDescribable.java b/src/main/java/gregtech/api/interfaces/ISecondaryDescribable.java index 9c3c9ed219..1f480091fc 100644 --- a/src/main/java/gregtech/api/interfaces/ISecondaryDescribable.java +++ b/src/main/java/gregtech/api/interfaces/ISecondaryDescribable.java @@ -4,6 +4,7 @@ package gregtech.api.interfaces; * To get a tooltip with a secondary description */ public interface ISecondaryDescribable extends IDescribable { + /** * Convenient to call when overriding the `String[] getDescription()` method. */ diff --git a/src/main/java/gregtech/api/interfaces/ISubTagContainer.java b/src/main/java/gregtech/api/interfaces/ISubTagContainer.java index e067579a1d..3e3690c67b 100644 --- a/src/main/java/gregtech/api/interfaces/ISubTagContainer.java +++ b/src/main/java/gregtech/api/interfaces/ISubTagContainer.java @@ -3,6 +3,7 @@ package gregtech.api.interfaces; import gregtech.api.enums.SubTag; public interface ISubTagContainer { + /** * @return if the Tag is inside the List. */ diff --git a/src/main/java/gregtech/api/interfaces/ITexture.java b/src/main/java/gregtech/api/interfaces/ITexture.java index e2445a8204..e97fa4539a 100644 --- a/src/main/java/gregtech/api/interfaces/ITexture.java +++ b/src/main/java/gregtech/api/interfaces/ITexture.java @@ -5,6 +5,7 @@ import net.minecraft.client.renderer.RenderBlocks; import net.minecraft.client.renderer.Tessellator; public interface ITexture { + void renderXPos(RenderBlocks aRenderer, Block aBlock, int aX, int aY, int aZ); void renderXNeg(RenderBlocks aRenderer, Block aBlock, int aX, int aY, int aZ); @@ -28,10 +29,11 @@ public interface ITexture { /** * Will initialize the {@link Tessellator} if rendering off-world (Inventory) + * * @param aRenderer The {@link RenderBlocks} Renderer - * @param aNormalX The X Normal for current Quad Face - * @param aNormalY The Y Normal for current Quad Face - * @param aNormalZ The Z Normal for current Quad Face + * @param aNormalX The X Normal for current Quad Face + * @param aNormalY The Y Normal for current Quad Face + * @param aNormalZ The Z Normal for current Quad Face */ default void startDrawingQuads(RenderBlocks aRenderer, float aNormalX, float aNormalY, float aNormalZ) { if (aRenderer.useInventoryTint && !isOldTexture()) { @@ -42,6 +44,7 @@ public interface ITexture { /** * Will run the {@link Tessellator} to draw Quads if rendering off-world (Inventory) + * * @param aRenderer The {@link RenderBlocks} Renderer */ default void draw(RenderBlocks aRenderer) { diff --git a/src/main/java/gregtech/api/interfaces/ITextureBuilder.java b/src/main/java/gregtech/api/interfaces/ITextureBuilder.java index d8ae592c9e..95c7639477 100644 --- a/src/main/java/gregtech/api/interfaces/ITextureBuilder.java +++ b/src/main/java/gregtech/api/interfaces/ITextureBuilder.java @@ -1,15 +1,21 @@ package gregtech.api.interfaces; -import com.gtnewhorizon.structurelib.alignment.enumerable.ExtendedFacing; -import gregtech.api.render.TextureFactory; import net.minecraft.block.Block; import net.minecraftforge.common.util.ForgeDirection; +import com.gtnewhorizon.structurelib.alignment.enumerable.ExtendedFacing; +import gregtech.api.render.TextureFactory; + /** - * <p>This Interface defines operations to configure and build instances of the {@link ITexture} implementations</p> - * <p>Use the {@link TextureFactory#builder()} method to get an instance of the {@link ITextureBuilder} implementation.</p> + * <p> + * This Interface defines operations to configure and build instances of the {@link ITexture} implementations + * </p> + * <p> + * Use the {@link TextureFactory#builder()} method to get an instance of the {@link ITextureBuilder} implementation. + * </p> */ public interface ITextureBuilder { + /** * Build the {@link ITexture} * @@ -20,14 +26,19 @@ public interface ITextureBuilder { /** * @param block The {@link Block} - * @param meta The meta value for the Block + * @param meta The meta value for the Block * @return {@link ITextureBuilder} for chaining */ ITextureBuilder setFromBlock(final Block block, final int meta); /** - * @param side <p>The {@link ForgeDirection} side providing the texture</p> - * <p>Default is {@link ForgeDirection#UNKNOWN} to use same side as rendered</p> + * @param side + * <p> + * The {@link ForgeDirection} side providing the texture + * </p> + * <p> + * Default is {@link ForgeDirection#UNKNOWN} to use same side as rendered + * </p> * @return {@link ITextureBuilder} for chaining */ ITextureBuilder setFromSide(final ForgeDirection side); @@ -52,6 +63,7 @@ public interface ITextureBuilder { /** * Set alpha blending + * * @param allowAlpha to set * * @return {@link ITextureBuilder} for chaining diff --git a/src/main/java/gregtech/api/interfaces/IToolStats.java b/src/main/java/gregtech/api/interfaces/IToolStats.java index 9dcfc4bce8..91c8564a51 100644 --- a/src/main/java/gregtech/api/interfaces/IToolStats.java +++ b/src/main/java/gregtech/api/interfaces/IToolStats.java @@ -1,7 +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; @@ -12,12 +12,15 @@ import net.minecraft.util.DamageSource; import net.minecraft.world.World; import net.minecraftforge.event.world.BlockEvent; +import gregtech.api.items.GT_MetaGenerated_Tool; + /** * The Stats for GT Tools. Not including any Material Modifiers. * <p/> * And this is supposed to not have any ItemStack Parameters as these are generic Stats. */ public interface IToolStats { + /** * Called when aPlayer crafts this Tool */ @@ -39,7 +42,8 @@ public interface IToolStats { int getToolDamagePerDropConversion(); /** - * @return Damage the Tool receives when being used as Container Item. 100 is one use, however it is usually 8 times more than normal. + * @return Damage the Tool receives when being used as Container Item. 100 is one use, however it is usually 8 times + * more than normal. */ int getToolDamagePerContainerCraft(); @@ -49,7 +53,8 @@ public interface IToolStats { int getToolDamagePerEntityAttack(); /** - * @return Basic Quality of the Tool, 0 is normal. If increased, it will increase the general quality of all Tools of this Type. Decreasing is also possible. + * @return Basic Quality of the Tool, 0 is normal. If increased, it will increase the general quality of all Tools + * of this Type. Decreasing is also possible. */ int getBaseQuality(); @@ -122,7 +127,8 @@ public interface IToolStats { boolean isWeapon(); /** - * @return If this Tool is a Ranged Weapon. Return false at isWeapon unless you have a Blade attached to your Bow/Gun or something + * @return If this Tool is a Ranged Weapon. Return false at isWeapon unless you have a Blade attached to your + * Bow/Gun or something */ boolean isRangedWeapon(); @@ -132,10 +138,12 @@ public interface IToolStats { boolean isMiningTool(); /** - * aBlock.getHarvestTool(aMetaData) can return the following Values for example. - * "axe", "pickaxe", "sword", "shovel", "hoe", "grafter", "saw", "wrench", "crowbar", "file", "hammer", "plow", "plunger", "scoop", "screwdriver", "sense", "scythe", "softhammer", "cutter", "plasmatorch" + * aBlock.getHarvestTool(aMetaData) can return the following Values for example. "axe", "pickaxe", "sword", + * "shovel", "hoe", "grafter", "saw", "wrench", "crowbar", "file", "hammer", "plow", "plunger", "scoop", + * "screwdriver", "sense", "scythe", "softhammer", "cutter", "plasmatorch" * - * @return If this is a minable Block. Tool Quality checks (like Diamond Tier or something) are separate from this check. + * @return If this is a minable Block. Tool Quality checks (like Diamond Tier or something) are separate from this + * check. */ boolean isMinableBlock(Block aBlock, byte aMetaData); @@ -144,18 +152,8 @@ 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. @@ -176,6 +174,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/covers/IControlsWorkCover.java b/src/main/java/gregtech/api/interfaces/covers/IControlsWorkCover.java index 47edc7af93..cef20ac3b7 100644 --- a/src/main/java/gregtech/api/interfaces/covers/IControlsWorkCover.java +++ b/src/main/java/gregtech/api/interfaces/covers/IControlsWorkCover.java @@ -11,8 +11,8 @@ import gregtech.api.interfaces.tileentity.IMachineProgress; public interface IControlsWorkCover { /** - * Make sure there is only one GT_Cover_ControlsWork on the aTileEntity - * TODO this is a migration thing. Remove this after 2.3.0 is released. + * Make sure there is only one GT_Cover_ControlsWork on the aTileEntity TODO this is a migration thing. Remove this + * after 2.3.0 is released. * * @return true if the cover is the first (side) one **/ diff --git a/src/main/java/gregtech/api/interfaces/fluid/IGT_FluidBuilder.java b/src/main/java/gregtech/api/interfaces/fluid/IGT_FluidBuilder.java index a643b8aace..00bfd6dbe8 100644 --- a/src/main/java/gregtech/api/interfaces/fluid/IGT_FluidBuilder.java +++ b/src/main/java/gregtech/api/interfaces/fluid/IGT_FluidBuilder.java @@ -1,14 +1,17 @@ package gregtech.api.interfaces.fluid; -import gregtech.api.enums.FluidState; import javax.annotation.Nonnull; + import net.minecraft.block.Block; import net.minecraft.util.ResourceLocation; import net.minecraftforge.fluids.Fluid; import net.minecraftforge.fluids.FluidRegistry; +import gregtech.api.enums.FluidState; + @SuppressWarnings("unused") // API might legitimately expose unused methods within this local project's scope public interface IGT_FluidBuilder { + /** * @param colorRGBA The {@code short[]} RGBA color of the {@link Fluid} or {@code null} for no defined RGBA color * @return {@link IGT_FluidBuilder} self for call chaining @@ -72,8 +75,8 @@ public interface IGT_FluidBuilder { * @return {@link IGT_FluidBuilder} self for call chaining */ @SuppressWarnings("UnusedReturnValue") // Last call in chain, may not use this returned value - IGT_FluidBuilder withTextures( - final ResourceLocation stillIconResourceLocation, final ResourceLocation flowingIconResourceLocation); + IGT_FluidBuilder withTextures(final ResourceLocation stillIconResourceLocation, + final ResourceLocation flowingIconResourceLocation); /** * Builds the {@link IGT_Fluid} diff --git a/src/main/java/gregtech/api/interfaces/fluid/IGT_RegisteredFluid.java b/src/main/java/gregtech/api/interfaces/fluid/IGT_RegisteredFluid.java index f4d278e2b0..e7c220607a 100644 --- a/src/main/java/gregtech/api/interfaces/fluid/IGT_RegisteredFluid.java +++ b/src/main/java/gregtech/api/interfaces/fluid/IGT_RegisteredFluid.java @@ -1,11 +1,12 @@ package gregtech.api.interfaces.fluid; -import gregtech.api.enums.FluidState; -import gregtech.api.enums.Materials; import net.minecraft.item.ItemStack; import net.minecraftforge.fluids.Fluid; import net.minecraftforge.fluids.FluidContainerRegistry; +import gregtech.api.enums.FluidState; +import gregtech.api.enums.Materials; + public interface IGT_RegisteredFluid { /** @@ -17,11 +18,12 @@ public interface IGT_RegisteredFluid { * @return The {@link IGT_RegisteredFluid} for call chaining */ @SuppressWarnings("UnusedReturnValue") // Last call in chain, may not use this returned value - IGT_RegisteredFluid registerContainers( - final ItemStack fullContainer, final ItemStack emptyContainer, final int containerSize); + IGT_RegisteredFluid registerContainers(final ItemStack fullContainer, final ItemStack emptyContainer, + final int containerSize); /** - * Registers the bucket-sized 1000L containers in the {@link FluidContainerRegistry} for this {@link IGT_RegisteredFluid} + * Registers the bucket-sized 1000L containers in the {@link FluidContainerRegistry} for this + * {@link IGT_RegisteredFluid} * * @param fullContainer The full container to associate with this {@link IGT_RegisteredFluid} * @param emptyContainer The empty container associate with this {@link IGT_RegisteredFluid} @@ -31,7 +33,8 @@ public interface IGT_RegisteredFluid { IGT_RegisteredFluid registerBContainers(final ItemStack fullContainer, final ItemStack emptyContainer); /** - * Registers the potion-sized 250L containers in the {@link FluidContainerRegistry} for this {@link IGT_RegisteredFluid} + * Registers the potion-sized 250L containers in the {@link FluidContainerRegistry} for this + * {@link IGT_RegisteredFluid} * * @param fullContainer The full container to associate with this {@link IGT_RegisteredFluid} * @param emptyContainer The empty container associate with this {@link IGT_RegisteredFluid} @@ -43,7 +46,8 @@ public interface IGT_RegisteredFluid { /** * Updates the {@link Materials}'s fluids from this {@link IGT_RegisteredFluid}'s state * - * @param material the {@link Materials} to configure based on this {@link IGT_RegisteredFluid} and {@link FluidState} + * @param material the {@link Materials} to configure based on this {@link IGT_RegisteredFluid} and + * {@link FluidState} * @return The {@link IGT_RegisteredFluid} for call chaining */ @SuppressWarnings("UnusedReturnValue") // Last call in chain, may not use this returned value diff --git a/src/main/java/gregtech/api/interfaces/internal/IBCTileEntity.java b/src/main/java/gregtech/api/interfaces/internal/IBCTileEntity.java index dd73ffc1e7..4acfa62549 100644 --- a/src/main/java/gregtech/api/interfaces/internal/IBCTileEntity.java +++ b/src/main/java/gregtech/api/interfaces/internal/IBCTileEntity.java @@ -3,6 +3,6 @@ package gregtech.api.interfaces.internal; /** * A simple compound Interface for generic BuildCraft Code. */ -public interface IBCTileEntity /*extends IPowerReceptor*/ { +public interface IBCTileEntity /* extends IPowerReceptor */ { // } diff --git a/src/main/java/gregtech/api/interfaces/internal/IGT_CraftingRecipe.java b/src/main/java/gregtech/api/interfaces/internal/IGT_CraftingRecipe.java index 0bb4155214..3f29736470 100644 --- a/src/main/java/gregtech/api/interfaces/internal/IGT_CraftingRecipe.java +++ b/src/main/java/gregtech/api/interfaces/internal/IGT_CraftingRecipe.java @@ -3,5 +3,6 @@ package gregtech.api.interfaces.internal; import net.minecraft.item.crafting.IRecipe; public interface IGT_CraftingRecipe extends IRecipe { + boolean isRemovable(); } 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 19e7a56aad..dbf888ef96 100644 --- a/src/main/java/gregtech/api/interfaces/internal/IGT_Mod.java +++ b/src/main/java/gregtech/api/interfaces/internal/IGT_Mod.java @@ -10,18 +10,22 @@ import net.minecraft.world.World; * Don't even think about including this File in your Mod. */ public interface IGT_Mod { + /** - * This means that Server specific Basefiles are definitely existing! Not if the World is actually server side or not! + * This means that Server specific Basefiles are definitely existing! Not if the World is actually server side or + * not! */ boolean isServerSide(); /** - * This means that Client specific Basefiles are definitely existing! Not if the World is actually client side or not! + * This means that Client specific Basefiles are definitely existing! Not if the World is actually client side or + * not! */ boolean isClientSide(); /** - * This means that Bukkit specific Basefiles are definitely existing! Not if the World is actually bukkit server or not! + * This means that Bukkit specific Basefiles are definitely existing! Not if the World is actually bukkit server or + * not! */ boolean isBukkitSide(); 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 77e6bd6742..342d3a5403 100644 --- a/src/main/java/gregtech/api/interfaces/internal/IGT_RecipeAdder.java +++ b/src/main/java/gregtech/api/interfaces/internal/IGT_RecipeAdder.java @@ -1,23 +1,19 @@ package gregtech.api.interfaces.internal; -import gregtech.api.util.GT_Recipe; import net.minecraft.item.ItemStack; import net.minecraftforge.fluids.Fluid; import net.minecraftforge.fluids.FluidStack; +import gregtech.api.util.GT_Recipe; + public interface IGT_RecipeAdder { + /** - * Adds a FusionreactorRecipe - * Does not work anymore! + * Adds a FusionreactorRecipe 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 @@ -31,13 +27,8 @@ public interface IGT_RecipeAdder { * @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 @@ -49,45 +40,24 @@ 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 * - * @param aInput1 must be != null - * @param aOutput1 must be != null - * @param aOutput2 can be null - * @param aOutput3 can be null - * @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); + * @param aInput1 must be != null + * @param aOutput1 must be != null + * @param aOutput2 can be null + * @param aOutput3 can be null + * @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); /** * Adds a Centrifuge Recipe @@ -99,36 +69,13 @@ 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 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 aCleanroom); /** * @param aInput1 must be != null @@ -141,51 +88,31 @@ public interface IGT_RecipeAdder { /** * Adds a Electrolyzer Recipe * - * @param aInput1 must be != null - * @param aOutput1 must be != null - * @param aOutput2 can be null - * @param aOutput3 can be null - * @param aOutput4 can be null - * @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); + * @param aInput1 must be != null + * @param aOutput1 must be != null + * @param aOutput2 can be null + * @param aOutput3 can be null + * @param aOutput4 can be null + * @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); /** * Adds a Electrolyzer Recipe * - * @param aInput1 must be != null - * @param aOutput1 must be != null - * @param aOutput2 can be null - * @param aOutput3 can be null - * @param aOutput4 can be null - * @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); + * @param aInput1 must be != null + * @param aOutput1 must be != null + * @param aOutput2 can be null + * @param aOutput3 can be null + * @param aOutput4 can be null + * @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); /** * Adds a Chemical Recipe @@ -207,54 +134,36 @@ 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 - * Only use this when the recipe conflicts in MultiBlock! + * Adds a Chemical Recipe Only use this when the recipe conflicts in MultiBlock! * * @param aInput1 must be != null * @param aInput2 must be != null - * @param aOutput must be != null + * @param aOutput must be != null * @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 * * @param aInput1 must be != null * @param aInput2 must be != null - * @param aOutput must be != null + * @param aOutput must be != null * @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) + * Adds Recipes for creating a radically polymerized polymer from a base Material (for example Ethylene -> + * Polyethylene) * * @param aBasicMaterial The basic Material * @param aBasicMaterialCell The corresponding Cell basic Material @@ -267,70 +176,44 @@ public interface IGT_RecipeAdder { * * @param aInput1 must be != null * @param aInput2 must be != null - * @param aOutput must be != null + * @param aOutput must be != null * @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 * * @param aInput1 must be != null * @param aInput2 must be != null - * @param aOutput must be != null + * @param aOutput must be != null * @param aOutput2 must be != null * @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 * - * @param aInputs item inputs - * @param aFluidInputs fluid inputs + * @param aInputs item inputs + * @param aFluidInputs fluid inputs * @param aFluidOutputs fluid outputs - * @param aOutputs item outputs - * @param aDuration must be > 0 - * @param aEUtick must be > 0 - * <br>aInputs and aFluidInputs must contain at least one valid input. - * <br>aOutputs and aFluidOutputs must contain at least one valid output. + * @param aOutputs item outputs + * @param aDuration must be > 0 + * @param aEUtick must be > 0 <br> + * aInputs and aFluidInputs must contain at least one valid input. <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 @@ -344,14 +227,8 @@ 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 @@ -364,59 +241,29 @@ 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 * - * @param ItemInputArray Array of input items. - * @param FluidInputArray Array of output items. - * @param OutputItemArray Array of input fluids. - * @param FluidOutputArray Array of output items. - * @param aDuration Must be > 0. Duration in ticks. - * @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); + * @param ItemInputArray Array of input items. + * @param FluidInputArray Array of output items. + * @param OutputItemArray Array of input fluids. + * @param FluidOutputArray Array of output items. + * @param aDuration Must be > 0. Duration in ticks. + * @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); /** * Adds a Canning Machine Recipe @@ -426,8 +273,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 @@ -440,8 +287,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 @@ -473,8 +320,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 @@ -484,42 +331,19 @@ 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, 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 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[] 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 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 addAssemblerRecipe(ItemStack[] aInputs, FluidStack aFluidInput, ItemStack aOutput1, int aDuration, int aEUt, boolean aCleanroom); /** @@ -531,16 +355,11 @@ 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 @@ -551,30 +370,17 @@ 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 * - * @param aInputs elements should be: ItemStack for single item; - * ItemStack[] for multiple equivalent items; + * @param aInputs elements should be: ItemStack for single item; 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 @@ -587,13 +393,8 @@ public interface IGT_RecipeAdder { boolean addForgeHammerRecipe(ItemStack aInput1, ItemStack aOutput1, int aDuration, int aEUt); // Allows fluids as well as multiple items. - boolean addForgeHammerRecipe( - ItemStack[] ItemInputArray, - FluidStack[] FluidInputArray, - ItemStack[] ItemOutputArray, - FluidStack[] FluidOutputArray, - int aDuration, - int aEUt); + boolean addForgeHammerRecipe(ItemStack[] ItemInputArray, FluidStack[] FluidInputArray, ItemStack[] ItemOutputArray, + FluidStack[] FluidOutputArray, int aDuration, int aEUt); /** * Adds a Wiremill Recipe @@ -659,24 +460,11 @@ 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 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[] aChances, int aDuration, int aEUt); /** * Adds an Implosion Compressor Recipe @@ -698,13 +486,8 @@ 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 @@ -713,44 +496,26 @@ 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, + 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 @@ -760,28 +525,22 @@ 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); @@ -799,23 +558,17 @@ 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 @@ -830,21 +583,18 @@ 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 * * @param aInput1 must be != null * @param aOutput1 can be null - * @param aEU EU per MilliBucket. If no Liquid Form of this Container is available, then it will give you EU*1000 per Item. - * @param aType 0 = Diesel; 1 = Gas Turbine; 2 = Thermal; 3 = Dense Fluid; 4 = Plasma; 5 = Magic; And if something is unclear or missing, then look at the GT_Recipe-Class + * @param aEU EU per MilliBucket. If no Liquid Form of this Container is available, then it will give you + * EU*1000 per Item. + * @param aType 0 = Diesel; 1 = Gas Turbine; 2 = Thermal; 3 = Dense Fluid; 4 = Plasma; 5 = Magic; And if + * something is unclear or missing, then look at the GT_Recipe-Class */ boolean addFuel(ItemStack aInput1, ItemStack aOutput1, int aEU, int aType); @@ -858,11 +608,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 @@ -877,33 +627,22 @@ public interface IGT_RecipeAdder { boolean addFluidHeaterRecipe(ItemStack aCircuit, FluidStack aOutput, int aDuration, int aEUt); boolean addFluidHeaterRecipe(ItemStack aCircuit, FluidStack aInput, FluidStack aOutput, int aDuration, int aEUt); + /** * Adds a Recipe for the Distillery */ - boolean addDistilleryRecipe( - ItemStack aCircuit, - FluidStack aInput, - FluidStack aOutput, - ItemStack aSolidOutput, - int aDuration, - int aEUt, + 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 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 */ @@ -912,75 +651,43 @@ 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, 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, 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 @@ -990,194 +697,93 @@ 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 addAutoclaveRecipe( - ItemStack aInput, - FluidStack aFluid, - ItemStack aOutput, - int aChance, - int aDuration, - int aEUt, - boolean aCleanroom); + 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 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 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, 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 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 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. * - * @param ItemInputArray Array of input items. - * @param FluidInputArray Array of output items. - * @param OutputItemArray Array of input fluids. - * @param FluidOutputArray Array of output items. - * @param aDuration Must be > 0. Duration in ticks. - * @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); + * @param ItemInputArray Array of input items. + * @param FluidInputArray Array of output items. + * @param OutputItemArray Array of input fluids. + * @param FluidOutputArray Array of output items. + * @param aDuration Must be > 0. Duration in ticks. + * @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); /** * 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); // Allows more than 2 inputs and multiple outputs boolean addFormingPressRecipe(ItemStack[] ItemInputArray, ItemStack[] OutputItemArray, int aDuration, int aEUt); @@ -1186,27 +792,22 @@ public interface IGT_RecipeAdder { * Adds a Recipe for the Sifter. (up to 9 Outputs) */ boolean addSifterRecipe(ItemStack aItemToSift, ItemStack[] aSiftedItems, int[] aChances, int aDuration, int aEUt); + /** * Adds a Generalised Sifter Recipe. * - * @param ItemInputArray Array of input items. - * @param FluidInputArray Array of output items. - * @param OutputItemArray Array of input fluids. - * @param FluidOutputArray Array of output items. - * @param aChances Array of output chances. - * @param aDuration Must be > 0. Duration in ticks. - * @param aEUt Should be > 0. EU/t. - * @param aCleanroom Boolean for usage of cleanroom in recipe. - */ - boolean addSifterRecipe( - ItemStack[] ItemInputArray, - FluidStack[] FluidInputArray, - ItemStack[] OutputItemArray, - FluidStack[] FluidOutputArray, - int[] aChances, - int aDuration, - int aEUt, - boolean aCleanroom); + * @param ItemInputArray Array of input items. + * @param FluidInputArray Array of output items. + * @param OutputItemArray Array of input fluids. + * @param FluidOutputArray Array of output items. + * @param aChances Array of output chances. + * @param aDuration Must be > 0. Duration in ticks. + * @param aEUt Should be > 0. EU/t. + * @param aCleanroom Boolean for usage of cleanroom in recipe. + */ + boolean addSifterRecipe(ItemStack[] ItemInputArray, FluidStack[] FluidInputArray, ItemStack[] OutputItemArray, + FluidStack[] FluidOutputArray, int[] aChances, int aDuration, int aEUt, boolean aCleanroom); + /** * Adds a Recipe for the Arc Furnace. (up to 4 Outputs) */ @@ -1215,8 +816,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) @@ -1226,28 +827,22 @@ 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 - * Every Fluid also gets separate distillation recipes + * Adds a Distillation Tower Recipe Every Fluid also gets separate distillation recipes * * @param aInput must be != null * @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 addUniversalDistillationRecipewithCircuit( - FluidStack aInput, - ItemStack[] aCircuit, - FluidStack[] aOutputs, - ItemStack aOutput2, - int aDuration, + 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); + /** * Adds Pyrolyse Recipe * @@ -1258,14 +853,8 @@ 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 @@ -1288,12 +877,11 @@ 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 - * you should NOT call this in the preInit-Phase! + * Adds a Sound to the Sonictron9001 you should NOT call this in the preInit-Phase! * * @param aItemStack = The Item you want to display for this Sound * @param aSoundName = The Name of the Sound in the resources/newsound-folder like Vanillasounds @@ -1301,87 +889,68 @@ 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); /** - * Add a Nano Forge Recipe. The Nano Forge's main use is to make nanites/nanorobots. - * Tier 1 Nano Forge - Can make partly biological, partly metal nanites - * TIer 2 Nano Forge - Can make mostly metal nanites with some biological aspects - * TIer 3 Nano Forge - Can make nanites entierly out of metal + * Add a Nano Forge Recipe. The Nano Forge's main use is to make nanites/nanorobots. Tier 1 Nano Forge - Can make + * partly biological, partly metal nanites TIer 2 Nano Forge - Can make mostly metal nanites with some biological + * aspects TIer 3 Nano Forge - Can make nanites entierly out of metal * - * @param aInputs = must not be null - * @param aFluidInputs = can be null - * @param aOutputs = must not be null, the nanite or other output + * @param aInputs = must not be null + * @param aFluidInputs = can be null + * @param aOutputs = must not be null, the nanite or other output * @param aFluidOutputs = can be null - * @param aChances = can be null + * @param aChances = can be null * @param aDuration * @param aEUt * @param aSpecialValue = defines the tier of nano forge required. * */ - boolean addNanoForgeRecipe( - ItemStack[] aInputs, - FluidStack[] aFluidInputs, - ItemStack[] aOutputs, - FluidStack[] aFluidOutputs, - int[] aChances, - int aDuration, - int aEUt, - int aSpecialValue); + boolean addNanoForgeRecipe(ItemStack[] aInputs, FluidStack[] aFluidInputs, ItemStack[] aOutputs, + FluidStack[] aFluidOutputs, int[] aChances, int aDuration, int aEUt, int aSpecialValue); /** - * Add a Board Manufacturer Recipe. The Board Manufacturer's main use is to make the circuit boards - * needed to make circuits. + * Add a Board Manufacturer Recipe. The Board Manufacturer's main use is to make the circuit boards needed to make + * circuits. * - * @param aInputs = must not be null - * @param aFluidInputs = must not be null - * @param aOutputs = must not be null + * @param aInputs = must not be null + * @param aFluidInputs = must not be null + * @param aOutputs = must not be null * @param aDuration * @param aEUt * @param aSpecialValue = defines the tier of the board manufacturer required. */ - boolean addPCBFactoryRecipe( - ItemStack[] aInputs, - FluidStack[] aFluidInputs, - ItemStack[] aOutputs, - int aDuration, - int aEUt, - int aSpecialValue); + boolean addPCBFactoryRecipe(ItemStack[] aInputs, FluidStack[] aFluidInputs, ItemStack[] aOutputs, int aDuration, + int aEUt, int aSpecialValue); /** * Add a breeder cell. - * @param input raw stack. should be undamaged. - * @param output breed output + * + * @param input raw stack. should be undamaged. + * @param output breed output * @param heatMultiplier bonus progress per neutron pulse per heat step - * @param heatStep divisor for hull heat - * @param reflector true if also acts as a neutron reflector, false otherwise. + * @param heatStep divisor for hull heat + * @param reflector true if also acts as a neutron reflector, false otherwise. * @param requiredPulses progress required to complete breeding * @return added fake recipe */ - GT_Recipe addIC2ReactorBreederCell( - ItemStack input, ItemStack output, boolean reflector, int heatStep, int heatMultiplier, int requiredPulses); + GT_Recipe addIC2ReactorBreederCell(ItemStack input, ItemStack output, boolean reflector, int heatStep, + int heatMultiplier, int requiredPulses); /** * Add a fuel cell. - * @param input raw stack. should be undamaged. - * @param output depleted stack - * @param aMox true if has mox behavior, false if uranium behavior. - * @param aHeat inherent heat output multiplier of the fuel material. should not add the extra heat from being - * a multi-cell! - * @param aEnergy inherent energy output multiplier of the fuel material. should not add the extra energy from - * being a multi-cell! - * @param aCells cell count + * + * @param input raw stack. should be undamaged. + * @param output depleted stack + * @param aMox true if has mox behavior, false if uranium behavior. + * @param aHeat inherent heat output multiplier of the fuel material. should not add the extra heat from being a + * multi-cell! + * @param aEnergy inherent energy output multiplier of the fuel material. should not add the extra energy from being + * a multi-cell! + * @param aCells cell count * @return added fake recipe */ - GT_Recipe addIC2ReactorFuelCell( - ItemStack input, ItemStack output, boolean aMox, float aHeat, float aEnergy, int aCells); + GT_Recipe addIC2ReactorFuelCell(ItemStack input, ItemStack output, boolean aMox, float aHeat, float aEnergy, + int aCells); } diff --git a/src/main/java/gregtech/api/interfaces/internal/IIC2TileEntity.java b/src/main/java/gregtech/api/interfaces/internal/IIC2TileEntity.java index 7592ffbe1a..ce9b4c4282 100644 --- a/src/main/java/gregtech/api/interfaces/internal/IIC2TileEntity.java +++ b/src/main/java/gregtech/api/interfaces/internal/IIC2TileEntity.java @@ -6,7 +6,8 @@ import ic2.api.energy.tile.IEnergySource; import ic2.api.tile.IEnergyStorage; /** - * A simple compound Interface for generic EnergyTileEntities. I don't want to have imports of the IC2-API in my main-code + * A simple compound Interface for generic EnergyTileEntities. I don't want to have imports of the IC2-API in my + * main-code */ public interface IIC2TileEntity extends IEnergyStorage, IEnergySink, IEnergySource, IHasWorldObjectAndCoords { // diff --git a/src/main/java/gregtech/api/interfaces/internal/IThaumcraftCompat.java b/src/main/java/gregtech/api/interfaces/internal/IThaumcraftCompat.java index 330b9326c2..debbe928fd 100644 --- a/src/main/java/gregtech/api/interfaces/internal/IThaumcraftCompat.java +++ b/src/main/java/gregtech/api/interfaces/internal/IThaumcraftCompat.java @@ -1,41 +1,29 @@ 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 gregtech.api.enums.TC_Aspects; +import gregtech.api.enums.TC_Aspects.TC_AspectStack; + public interface IThaumcraftCompat { - int RESEARCH_TYPE_NORMAL = 0, - RESEARCH_TYPE_SECONDARY = 1, - RESEARCH_TYPE_FREE = 2, - RESEARCH_TYPE_HIDDEN = 4, - RESEARCH_TYPE_VIRTUAL = 8, - RESEARCH_TYPE_ROUND = 16, - RESEARCH_TYPE_SPECIAL = 32, + + int RESEARCH_TYPE_NORMAL = 0, RESEARCH_TYPE_SECONDARY = 1, RESEARCH_TYPE_FREE = 2, RESEARCH_TYPE_HIDDEN = 4, + RESEARCH_TYPE_VIRTUAL = 8, RESEARCH_TYPE_ROUND = 16, RESEARCH_TYPE_SPECIAL = 32, RESEARCH_TYPE_AUTOUNLOCK = 64; /** * The Research Keys of GT */ - 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", - TRANSNICKEL = "GT_TRANSNICKEL", - TRANSCOBALT = "GT_TRANSCOBALT", - TRANSBISMUTH = "GT_TRANSBISMUTH", - TRANSANTIMONY = "GT_TRANSANTIMONY", - TRANSCUPRONICKEL = "GT_TRANSCUPRONICKEL", - TRANSBATTERYALLOY = "GT_TRANSBATTERYALLOY", - TRANSSOLDERINGALLOY = "GT_TRANSSOLDERINGALLOY", - TRANSBRASS = "GT_TRANSBRASS", - TRANSBRONZE = "GT_TRANSBRONZE", - TRANSINVAR = "GT_TRANSINVAR", - TRANSELECTRUM = "GT_TRANSELECTRUM", - TRANSALUMINIUM = "GT_TRANSALUMINIUM", - CRYSTALLISATION = "GT_CRYSTALLISATION", + 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", TRANSNICKEL = "GT_TRANSNICKEL", + TRANSCOBALT = "GT_TRANSCOBALT", TRANSBISMUTH = "GT_TRANSBISMUTH", TRANSANTIMONY = "GT_TRANSANTIMONY", + TRANSCUPRONICKEL = "GT_TRANSCUPRONICKEL", TRANSBATTERYALLOY = "GT_TRANSBATTERYALLOY", + TRANSSOLDERINGALLOY = "GT_TRANSSOLDERINGALLOY", TRANSBRASS = "GT_TRANSBRASS", + TRANSBRONZE = "GT_TRANSBRONZE", TRANSINVAR = "GT_TRANSINVAR", TRANSELECTRUM = "GT_TRANSELECTRUM", + TRANSALUMINIUM = "GT_TRANSALUMINIUM", CRYSTALLISATION = "GT_CRYSTALLISATION", ADVANCEDENTROPICPROCESSING = "GT_ADVANCEDENTROPICPROCESSING", // unused ADVANCEDMETALLURGY = "GT_ADVANCEDMETALLURGY"; @@ -47,26 +35,10 @@ 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 821aa35f50..7c9d487e05 100644 --- a/src/main/java/gregtech/api/interfaces/internal/IUETileEntity.java +++ b/src/main/java/gregtech/api/interfaces/internal/IUETileEntity.java @@ -1,5 +1,5 @@ package gregtech.api.interfaces.internal; -public interface IUETileEntity /*extends IElectrical*/ { +public interface IUETileEntity /* extends IElectrical */ { // } diff --git a/src/main/java/gregtech/api/interfaces/metatileentity/IConnectable.java b/src/main/java/gregtech/api/interfaces/metatileentity/IConnectable.java index 84c991ade9..76d8d082ef 100644 --- a/src/main/java/gregtech/api/interfaces/metatileentity/IConnectable.java +++ b/src/main/java/gregtech/api/interfaces/metatileentity/IConnectable.java @@ -4,6 +4,7 @@ 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; @@ -17,8 +18,8 @@ public interface IConnectable { int HAS_FOAM = 0b11000000; /** - * Try to connect to the Block at the specified side - * returns the connection state. Non-positive values for failed, others for succeeded. + * Try to connect to the Block at the specified side returns the connection state. Non-positive values for failed, + * others for succeeded. */ int connect(byte aSide); diff --git a/src/main/java/gregtech/api/interfaces/metatileentity/IFluidLockable.java b/src/main/java/gregtech/api/interfaces/metatileentity/IFluidLockable.java index bac9cffba0..d7574313ac 100644 --- a/src/main/java/gregtech/api/interfaces/metatileentity/IFluidLockable.java +++ b/src/main/java/gregtech/api/interfaces/metatileentity/IFluidLockable.java @@ -5,7 +5,7 @@ import net.minecraftforge.fluids.Fluid; /** * Implement this interface if your MetaTileEntity supports fluid lock mechanism. */ -@SuppressWarnings({"BooleanMethodIsAlwaysInverted"}) +@SuppressWarnings({ "BooleanMethodIsAlwaysInverted" }) public interface IFluidLockable { /** @@ -16,8 +16,8 @@ public interface IFluidLockable { String getLockedFluidName(); /** - * Set fluid lock state. - * Would be useful when you don't necessarily want to change mode when locked fluid is changed. + * Set fluid lock state. Would be useful when you don't necessarily want to change mode when locked fluid is + * changed. */ void lockFluid(boolean lock); diff --git a/src/main/java/gregtech/api/interfaces/metatileentity/IMachineCallback.java b/src/main/java/gregtech/api/interfaces/metatileentity/IMachineCallback.java index a1c00ebc97..fb7845cfd4 100644 --- a/src/main/java/gregtech/api/interfaces/metatileentity/IMachineCallback.java +++ b/src/main/java/gregtech/api/interfaces/metatileentity/IMachineCallback.java @@ -1,6 +1,7 @@ package gregtech.api.interfaces.metatileentity; public interface IMachineCallback<Machinetype extends IMetaTileEntity> { + Machinetype getCallbackBase(); void setCallbackBase(Machinetype callback); diff --git a/src/main/java/gregtech/api/interfaces/metatileentity/IMetaTileEntity.java b/src/main/java/gregtech/api/interfaces/metatileentity/IMetaTileEntity.java index 0d1d52edb0..66c85be547 100644 --- a/src/main/java/gregtech/api/interfaces/metatileentity/IMetaTileEntity.java +++ b/src/main/java/gregtech/api/interfaces/metatileentity/IMetaTileEntity.java @@ -1,21 +1,9 @@ package gregtech.api.interfaces.metatileentity; -import com.gtnewhorizons.modularui.api.forge.ItemStackHandler; -import cpw.mods.fml.relauncher.Side; -import cpw.mods.fml.relauncher.SideOnly; -import gregtech.api.enums.Dyes; -import gregtech.api.interfaces.ITexture; -import gregtech.api.interfaces.modularui.IGetGUITextureSet; -import gregtech.api.interfaces.tileentity.IGearEnergyTileEntity; -import gregtech.api.interfaces.tileentity.IGregTechTileEntity; -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 gregtech.api.util.GT_Util; 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; @@ -31,38 +19,40 @@ import net.minecraft.world.World; import net.minecraftforge.fluids.IFluidHandler; import net.minecraftforge.fluids.IFluidTank; +import com.gtnewhorizons.modularui.api.forge.ItemStackHandler; + +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; +import gregtech.api.enums.Dyes; +import gregtech.api.interfaces.ITexture; +import gregtech.api.interfaces.modularui.IGetGUITextureSet; +import gregtech.api.interfaces.tileentity.IGearEnergyTileEntity; +import gregtech.api.interfaces.tileentity.IGregTechTileEntity; +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 gregtech.api.util.GT_Util; + /** - * Warning, this Interface has just been made to be able to add multiple kinds of MetaTileEntities (Cables, Pipes, Transformers, but not the regular Blocks) + * 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, - IGetGUITextureSet { +public interface IMetaTileEntity extends ISidedInventory, IFluidTank, IFluidHandler, IGearEnergyTileEntity, + IMachineBlockUpdateable, IGregtechWailaProvider, IGetGUITextureSet { + /** * This determines the BaseMetaTileEntity belonging to this MetaTileEntity by using the Meta ID of the Block itself. * <p/> - * 0 = BaseMetaTileEntity, Wrench lvl 0 to dismantle - * 1 = BaseMetaTileEntity, Wrench lvl 1 to dismantle - * 2 = BaseMetaTileEntity, Wrench lvl 2 to dismantle - * 3 = BaseMetaTileEntity, Wrench lvl 3 to dismantle - * 4 = BaseMetaPipeEntity, Wrench lvl 0 to dismantle - * 5 = BaseMetaPipeEntity, Wrench lvl 1 to dismantle - * 6 = BaseMetaPipeEntity, Wrench lvl 2 to dismantle - * 7 = BaseMetaPipeEntity, Wrench lvl 3 to dismantle - * 8 = BaseMetaPipeEntity, Cutter lvl 0 to dismantle - * 9 = BaseMetaPipeEntity, Cutter lvl 1 to dismantle - * 10 = BaseMetaPipeEntity, Cutter lvl 2 to dismantle - * 11 = BaseMetaPipeEntity, Cutter lvl 3 to dismantle - * 12 = GT++ - * 13 = GT++ - * 14 = GT++ - * 15 = GT++ + * 0 = BaseMetaTileEntity, Wrench lvl 0 to dismantle 1 = BaseMetaTileEntity, Wrench lvl 1 to dismantle 2 = + * BaseMetaTileEntity, Wrench lvl 2 to dismantle 3 = BaseMetaTileEntity, Wrench lvl 3 to dismantle 4 = + * BaseMetaPipeEntity, Wrench lvl 0 to dismantle 5 = BaseMetaPipeEntity, Wrench lvl 1 to dismantle 6 = + * BaseMetaPipeEntity, Wrench lvl 2 to dismantle 7 = BaseMetaPipeEntity, Wrench lvl 3 to dismantle 8 = + * BaseMetaPipeEntity, Cutter lvl 0 to dismantle 9 = BaseMetaPipeEntity, Cutter lvl 1 to dismantle 10 = + * BaseMetaPipeEntity, Cutter lvl 2 to dismantle 11 = BaseMetaPipeEntity, Cutter lvl 3 to dismantle 12 = GT++ 13 = + * GT++ 14 = GT++ 15 = GT++ */ byte getTileEntityBaseType(); @@ -103,8 +93,8 @@ public interface IMetaTileEntity void loadNBTData(NBTTagCompound aNBT); /** - * Adds the NBT-Information to the ItemStack, when being dismanteled properly - * Used to store Machine specific Upgrade Data. + * Adds the NBT-Information to the ItemStack, when being dismanteled properly Used to store Machine specific Upgrade + * Data. */ void setItemNBT(NBTTagCompound aNBT); @@ -114,7 +104,8 @@ public interface IMetaTileEntity void onServerStart(); /** - * Called in the registered MetaTileEntity when the Server ticks a World the first time, to load things from the World Save + * Called in the registered MetaTileEntity when the Server ticks a World the first time, to load things from the + * World Save */ void onWorldLoad(File aSaveDirectory); @@ -124,14 +115,14 @@ public interface IMetaTileEntity void onWorldSave(File aSaveDirectory); /** - * Called to set Configuration values for this MetaTileEntity. - * Use aConfig.get(ConfigCategories.machineconfig, "MetaTileEntityName.Ability", DEFAULT_VALUE); to set the Values. + * Called to set Configuration values for this MetaTileEntity. Use aConfig.get(ConfigCategories.machineconfig, + * "MetaTileEntityName.Ability", DEFAULT_VALUE); to set the Values. */ void onConfigLoad(GT_Config aConfig); /** - * If a Cover of that Type can be placed on this Side. - * Also Called when the Facing of the Block Changes and a Cover is on said Side. + * If a Cover of that Type can be placed on this Side. Also Called when the Facing of the Block Changes and a Cover + * is on said Side. */ boolean allowCoverOnSide(byte aSide, GT_ItemStack aStack); @@ -153,8 +144,8 @@ public interface IMetaTileEntity /** * 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 @@ -167,21 +158,19 @@ public interface IMetaTileEntity void onFirstTick(IGregTechTileEntity aBaseMetaTileEntity); /** - * The Tick before all the generic handling happens, what gives a slightly faster reaction speed. - * Don't use this if you really don't need to. @onPostTick is better suited for ticks. - * This happens still after the Cover handling. + * The Tick before all the generic handling happens, what gives a slightly faster reaction speed. Don't use this if + * you really don't need to. @onPostTick is better suited for ticks. This happens still after the Cover handling. */ void onPreTick(IGregTechTileEntity aBaseMetaTileEntity, long aTick); /** - * The Tick after all the generic handling happened. - * Recommended to use this like updateEntity. + * The Tick after all the generic handling happened. Recommended to use this like updateEntity. */ void onPostTick(IGregTechTileEntity aBaseMetaTileEntity, long aTick); /** - * Called when this MetaTileEntity gets (intentionally) disconnected from the BaseMetaTileEntity. - * Doesn't get called when this thing is moved by Frames or similar hacks. + * Called when this MetaTileEntity gets (intentionally) disconnected from the BaseMetaTileEntity. Doesn't get called + * when this thing is moved by Frames or similar hacks. */ void inValidate(); @@ -232,11 +221,13 @@ public interface IMetaTileEntity boolean allowPutStack(IGregTechTileEntity aBaseMetaTileEntity, int aIndex, byte aSide, ItemStack aStack); /** - * @return if aIndex is a valid Slot. false for things like HoloSlots. Is used for determining if an Item is dropped upon Block destruction and for Inventory Access Management + * @return if aIndex is a valid Slot. false for things like HoloSlots. Is used for determining if an Item is dropped + * upon Block destruction and for Inventory Access Management */ boolean isValidSlot(int aIndex); - /** Check if the item at the specified index should be dropped + /** + * Check if the item at the specified index should be dropped * * @param index Index that will be checked * @return True if the item at the index should be dropped, else false @@ -269,17 +260,15 @@ public interface IMetaTileEntity boolean isAccessAllowed(EntityPlayer aPlayer); /** - * a Player rightclicks the Machine - * Sneaky rightclicks are not getting passed to this! + * a Player rightclicks the Machine Sneaky rightclicks are not getting passed to this! * * @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 - * Sneaky leftclicks are getting passed to this unlike with the rightclicks. + * a Player leftclicks the Machine Sneaky leftclicks are getting passed to this unlike with the rightclicks. */ void onLeftclick(IGregTechTileEntity aBaseMetaTileEntity, EntityPlayer aPlayer); @@ -289,11 +278,12 @@ public interface IMetaTileEntity void onValueUpdate(byte aValue); /** - * return a small bit of Data, like a secondary Facing for example with this Function, for the Client. - * The BaseMetaTileEntity detects changes to this Value and will then send an Update. - * This is only for Information, which is visible as Texture to the outside. + * return a small bit of Data, like a secondary Facing for example with this Function, for the Client. The + * BaseMetaTileEntity detects changes to this Value and will then send an Update. This is only for Information, + * which is visible as Texture to the outside. * <p/> - * If you just want to have an Active/Redstone State then set the Active State inside the BaseMetaTileEntity instead. + * If you just want to have an Active/Redstone State then set the Active State inside the BaseMetaTileEntity + * instead. */ byte getUpdateData(); @@ -303,9 +293,8 @@ public interface IMetaTileEntity void receiveClientEvent(byte aEventID, byte aValue); /** - * Called to actually play the Sound. - * Do not insert Client/Server checks. That is already done for you. - * Do not use @playSoundEffect, Minecraft doesn't like that at all. Use @playSound instead. + * Called to actually play the Sound. Do not insert Client/Server checks. That is already done for you. Do not + * use @playSoundEffect, Minecraft doesn't like that at all. Use @playSound instead. */ void doSound(byte aIndex, double aX, double aY, double aZ); @@ -343,16 +332,16 @@ public interface IMetaTileEntity /** * If there should be a Lag Warning if something laggy happens during this Tick. * <p/> - * The Advanced Pump uses this to not cause the Lag Message, while it scans for all close Fluids. - * The Item Pipes and Retrievers neither send this Message, when scanning for Pipes. + * The Advanced Pump uses this to not cause the Lag Message, while it scans for all close Fluids. The Item Pipes and + * Retrievers neither send this Message, when scanning for Pipes. */ boolean doTickProfilingMessageDuringThisTick(); /** * 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 @@ -370,16 +359,14 @@ public interface IMetaTileEntity * @param aSide is the Side of the Block * @param aFacing is the direction the Block is facing (or a Bitmask of all Connections in case of Pipes) * @param aColorIndex The Minecraft Color the Block is having - * @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!!!) + * @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. @@ -387,8 +374,8 @@ public interface IMetaTileEntity // public ITexture[] getItemTexture(ItemStack aStack); /** - * Register Icons here. This gets called when the Icons get initialized by the Base Block - * Best is you put your Icons in a static Array for quick and easy access without relying on the MetaTileList. + * Register Icons here. This gets called when the Icons get initialized by the Base Block Best is you put your Icons + * in a static Array for quick and easy access without relying on the MetaTileList. * * @param aBlockIconRegister The Block Icon Register */ @@ -441,14 +428,8 @@ public interface IMetaTileEntity 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); @@ -466,9 +447,9 @@ public interface IMetaTileEntity boolean shouldJoinIc2Enet(); /** - * The Machine Update, which is called when the Machine needs an Update of its Parts. - * I suggest to wait 1-5 seconds before actually checking the Machine Parts. - * RP-Frames could for example cause Problems when you instacheck the Machine Parts. + * The Machine Update, which is called when the Machine needs an Update of its Parts. I suggest to wait 1-5 seconds + * before actually checking the Machine Parts. RP-Frames could for example cause Problems when you instacheck the + * Machine Parts. * * just do stuff since we are already in meta tile... */ diff --git a/src/main/java/gregtech/api/interfaces/metatileentity/IMetaTileEntityCable.java b/src/main/java/gregtech/api/interfaces/metatileentity/IMetaTileEntityCable.java index 6b83ab4dba..62df2e713f 100644 --- a/src/main/java/gregtech/api/interfaces/metatileentity/IMetaTileEntityCable.java +++ b/src/main/java/gregtech/api/interfaces/metatileentity/IMetaTileEntityCable.java @@ -2,12 +2,14 @@ package gregtech.api.interfaces.metatileentity; 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 5375ea85ee..b60088a41b 100644 --- a/src/main/java/gregtech/api/interfaces/metatileentity/IMetaTileEntityItemPipe.java +++ b/src/main/java/gregtech/api/interfaces/metatileentity/IMetaTileEntityItemPipe.java @@ -2,12 +2,14 @@ package gregtech.api.interfaces.metatileentity; import static gregtech.api.enums.GT_Values.ALL_VALID_SIDES; +import java.util.Map; + 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 { + /** * @return if this Pipe can still be used. */ @@ -36,9 +38,9 @@ public interface IMetaTileEntityItemPipe extends IMetaTileEntity { boolean insertItemStackIntoTileEntity(Object aSender, byte aSide); /** - * Can be used to make flow control Pipes, like Redpowers Restriction Tubes. - * Every normal Pipe returns a Value of 32768, so you can easily insert lower Numbers to set Routing priorities. - * Negative Numbers to "suck" Items into a certain direction are also possible. + * Can be used to make flow control Pipes, like Redpowers Restriction Tubes. Every normal Pipe returns a Value of + * 32768, so you can easily insert lower Numbers to set Routing priorities. Negative Numbers to "suck" Items into a + * certain direction are also possible. */ int getStepSize(); @@ -46,15 +48,12 @@ public interface IMetaTileEntityItemPipe extends IMetaTileEntity { * Utility for the Item Network */ class Util { + /** * @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) { @@ -63,12 +62,13 @@ public interface IMetaTileEntityItemPipe extends IMetaTileEntity { byte oppositeSide; for (byte side : ALL_VALID_SIDES) { if (aMetaTileEntity instanceof IConnectable - && !((IConnectable) aMetaTileEntity).isConnectedAtSide(side)) continue; + && !((IConnectable) aMetaTileEntity).isConnectedAtSide(side)) + continue; oppositeSide = GT_Utility.getOppositeSide(side); if (aSuckItems) { if (aBaseMetaTileEntity.getCoverInfoAtSide(side).letsItemsIn(-2)) { - final IGregTechTileEntity tItemPipe = - aBaseMetaTileEntity.getIGregTechTileEntityAtSide(side); + final IGregTechTileEntity tItemPipe = aBaseMetaTileEntity + .getIGregTechTileEntityAtSide(side); if (aBaseMetaTileEntity.getColorization() >= 0) { final byte tColor = tItemPipe.getColorization(); if (tColor >= 0 && tColor != aBaseMetaTileEntity.getColorization()) { @@ -78,9 +78,7 @@ public interface IMetaTileEntityItemPipe extends IMetaTileEntity { if (tItemPipe instanceof BaseMetaPipeEntity) { final IMetaTileEntity tMetaTileEntity = tItemPipe.getMetaTileEntity(); if (tMetaTileEntity instanceof IMetaTileEntityItemPipe - && tItemPipe - .getCoverInfoAtSide(oppositeSide) - .letsItemsOut(-2)) { + && tItemPipe.getCoverInfoAtSide(oppositeSide).letsItemsOut(-2)) { scanPipes( (IMetaTileEntityItemPipe) tMetaTileEntity, aMap, @@ -92,8 +90,8 @@ public interface IMetaTileEntityItemPipe extends IMetaTileEntity { } } else { if (aBaseMetaTileEntity.getCoverInfoAtSide(side).letsItemsOut(-2)) { - final IGregTechTileEntity tItemPipe = - aBaseMetaTileEntity.getIGregTechTileEntityAtSide(side); + final IGregTechTileEntity tItemPipe = aBaseMetaTileEntity + .getIGregTechTileEntityAtSide(side); if (tItemPipe != null) { if (aBaseMetaTileEntity.getColorization() >= 0) { final byte tColor = tItemPipe.getColorization(); @@ -104,9 +102,7 @@ public interface IMetaTileEntityItemPipe extends IMetaTileEntity { if (tItemPipe instanceof BaseMetaPipeEntity) { final IMetaTileEntity tMetaTileEntity = tItemPipe.getMetaTileEntity(); if (tMetaTileEntity instanceof IMetaTileEntityItemPipe - && tItemPipe - .getCoverInfoAtSide(oppositeSide) - .letsItemsIn(-2)) { + && tItemPipe.getCoverInfoAtSide(oppositeSide).letsItemsIn(-2)) { scanPipes( (IMetaTileEntityItemPipe) tMetaTileEntity, aMap, diff --git a/src/main/java/gregtech/api/interfaces/modularui/IAddGregtechLogo.java b/src/main/java/gregtech/api/interfaces/modularui/IAddGregtechLogo.java index d90d310dc8..12ac32c143 100644 --- a/src/main/java/gregtech/api/interfaces/modularui/IAddGregtechLogo.java +++ b/src/main/java/gregtech/api/interfaces/modularui/IAddGregtechLogo.java @@ -3,5 +3,6 @@ package gregtech.api.interfaces.modularui; import com.gtnewhorizons.modularui.api.screen.ModularWindow; public interface IAddGregtechLogo { + default void addGregTechLogo(ModularWindow.Builder builder) {} } diff --git a/src/main/java/gregtech/api/interfaces/modularui/IAddInventorySlots.java b/src/main/java/gregtech/api/interfaces/modularui/IAddInventorySlots.java index 70e33aa2c8..4111848ecb 100644 --- a/src/main/java/gregtech/api/interfaces/modularui/IAddInventorySlots.java +++ b/src/main/java/gregtech/api/interfaces/modularui/IAddInventorySlots.java @@ -4,6 +4,7 @@ import com.gtnewhorizons.modularui.api.drawable.IDrawable; import com.gtnewhorizons.modularui.api.screen.ModularWindow; public interface IAddInventorySlots { + default void add1by1Slot(ModularWindow.Builder builder, IDrawable... background) {} default void add2by2Slots(ModularWindow.Builder builder, IDrawable... background) {} diff --git a/src/main/java/gregtech/api/interfaces/modularui/IAddUIWidgets.java b/src/main/java/gregtech/api/interfaces/modularui/IAddUIWidgets.java index 7b70fd724c..1fa317b17f 100644 --- a/src/main/java/gregtech/api/interfaces/modularui/IAddUIWidgets.java +++ b/src/main/java/gregtech/api/interfaces/modularui/IAddUIWidgets.java @@ -4,5 +4,6 @@ import com.gtnewhorizons.modularui.api.screen.ModularWindow; import com.gtnewhorizons.modularui.api.screen.UIBuildContext; public interface IAddUIWidgets { + default void addUIWidgets(ModularWindow.Builder builder, UIBuildContext buildContext) {} } diff --git a/src/main/java/gregtech/api/interfaces/modularui/IGetGUITextureSet.java b/src/main/java/gregtech/api/interfaces/modularui/IGetGUITextureSet.java index 409523b008..59aa2723c3 100644 --- a/src/main/java/gregtech/api/interfaces/modularui/IGetGUITextureSet.java +++ b/src/main/java/gregtech/api/interfaces/modularui/IGetGUITextureSet.java @@ -3,6 +3,7 @@ package gregtech.api.interfaces.modularui; import gregtech.api.gui.modularui.GUITextureSet; public interface IGetGUITextureSet { + default GUITextureSet getGUITextureSet() { return null; } diff --git a/src/main/java/gregtech/api/interfaces/modularui/IGetTitleColor.java b/src/main/java/gregtech/api/interfaces/modularui/IGetTitleColor.java index a1f79d1568..76d94ee299 100644 --- a/src/main/java/gregtech/api/interfaces/modularui/IGetTitleColor.java +++ b/src/main/java/gregtech/api/interfaces/modularui/IGetTitleColor.java @@ -4,6 +4,7 @@ import gregtech.api.enums.Dyes; import gregtech.api.util.GT_Util; public interface IGetTitleColor { + default int getTitleColor() { return GT_Util.getRGBaInt(Dyes.dyeWhite.getRGBA()); } diff --git a/src/main/java/gregtech/api/interfaces/tileentity/IBasicEnergyContainer.java b/src/main/java/gregtech/api/interfaces/tileentity/IBasicEnergyContainer.java index 7b0bc9c690..44b59ffce1 100644 --- a/src/main/java/gregtech/api/interfaces/tileentity/IBasicEnergyContainer.java +++ b/src/main/java/gregtech/api/interfaces/tileentity/IBasicEnergyContainer.java @@ -4,16 +4,16 @@ package gregtech.api.interfaces.tileentity; * Interface for internal Code, which is mainly used for independent Energy conversion. */ public interface IBasicEnergyContainer extends IEnergyConnected { + /** - * Gets if that Amount of Energy is stored inside the Machine. - * It is used for checking the contained Energy before consuming it. - * If this returns false, it will also give a Message inside the Scanner, that this Machine doesn't have enough Energy. + * Gets if that Amount of Energy is stored inside the Machine. It is used for checking the contained Energy before + * consuming it. If this returns false, it will also give a Message inside the Scanner, that this Machine doesn't + * have enough Energy. */ boolean isUniversalEnergyStored(long aEnergyAmount); /** - * Gets the stored electric, kinetic or steam Energy (with EU as reference Value) - * Always returns the largest one. + * Gets the stored electric, kinetic or steam Energy (with EU as reference Value) Always returns the largest one. */ long getUniversalEnergyStored(); @@ -43,12 +43,14 @@ public interface IBasicEnergyContainer extends IEnergyConnected { long getInputVoltage(); /** - * Decreases the Amount of stored universal Energy. If ignoring too less Energy, then it just sets the Energy to 0 and returns false. + * Decreases the Amount of stored universal Energy. If ignoring too less Energy, then it just sets the Energy to 0 + * and returns false. */ boolean decreaseStoredEnergyUnits(long aEnergy, boolean aIgnoreTooLessEnergy); /** - * Increases the Amount of stored electric Energy. If ignoring too much Energy, then the Energy Limit is just being ignored. + * Increases the Amount of stored electric Energy. If ignoring too much Energy, then the Energy Limit is just being + * ignored. */ boolean increaseStoredEnergyUnits(long aEnergy, boolean aIgnoreTooMuchEnergy); @@ -97,8 +99,8 @@ public interface IBasicEnergyContainer extends IEnergyConnected { * @param aEnergy The Energy to add to the Machine. * @param aIgnoreTooMuchEnergy if it shall ignore if it has too much Energy. * @return if it was successful - * <p/> - * And yes, you can't directly decrease the Steam of a Machine. That is done by decreaseStoredEnergyUnits + * <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; diff --git a/src/main/java/gregtech/api/interfaces/tileentity/IColoredTileEntity.java b/src/main/java/gregtech/api/interfaces/tileentity/IColoredTileEntity.java index 3bcf441128..3a17df4717 100644 --- a/src/main/java/gregtech/api/interfaces/tileentity/IColoredTileEntity.java +++ b/src/main/java/gregtech/api/interfaces/tileentity/IColoredTileEntity.java @@ -4,6 +4,7 @@ import gregtech.api.enums.Dyes; import gregtech.api.util.GT_Util; public interface IColoredTileEntity { + /** * @return 0 - 15 are Colors, while -1 means uncolored */ @@ -20,7 +21,7 @@ public interface IColoredTileEntity { * @return Actual color shown on GUI */ default int getGUIColorization() { - return GT_Util.getRGBInt( - (getColorization() != -1 ? Dyes.get(getColorization()) : Dyes.MACHINE_METAL).getRGBA()); + return GT_Util + .getRGBInt((getColorization() != -1 ? Dyes.get(getColorization()) : Dyes.MACHINE_METAL).getRGBA()); } } diff --git a/src/main/java/gregtech/api/interfaces/tileentity/ICoverable.java b/src/main/java/gregtech/api/interfaces/tileentity/ICoverable.java index df131c84c2..f23c5a64c9 100644 --- a/src/main/java/gregtech/api/interfaces/tileentity/ICoverable.java +++ b/src/main/java/gregtech/api/interfaces/tileentity/ICoverable.java @@ -1,13 +1,15 @@ package gregtech.api.interfaces.tileentity; +import net.minecraft.entity.player.EntityPlayerMP; +import net.minecraft.item.ItemStack; + import gregtech.api.util.GT_CoverBehavior; import gregtech.api.util.GT_CoverBehaviorBase; import gregtech.api.util.ISerializableObject; import gregtech.common.covers.CoverInfo; -import net.minecraft.entity.player.EntityPlayerMP; -import net.minecraft.item.ItemStack; public interface ICoverable extends IRedstoneTileEntity, IHasInventory, IBasicEnergyContainer { + boolean canPlaceCoverIDAtSide(byte aSide, int aID); boolean canPlaceCoverItemAtSide(byte aSide, ItemStack aCover); @@ -53,20 +55,19 @@ public interface ICoverable extends IRedstoneTileEntity, IHasInventory, IBasicEn } /** - * For use by the regular MetaTileEntities. Returns the Cover Manipulated input Redstone. - * Don't use this if you are a Cover Behavior. Only for MetaTileEntities. + * For use by the regular MetaTileEntities. Returns the Cover Manipulated input Redstone. Don't use this if you are + * a Cover Behavior. Only for MetaTileEntities. */ byte getInternalInputRedstoneSignal(byte aSide); /** - * For use by the regular MetaTileEntities. This makes it not conflict with Cover based Redstone Signals. - * Don't use this if you are a Cover Behavior. Only for MetaTileEntities. + * For use by the regular MetaTileEntities. This makes it not conflict with Cover based Redstone Signals. Don't use + * this if you are a Cover Behavior. Only for MetaTileEntities. */ void setInternalOutputRedstoneSignal(byte aSide, byte aStrength); /** - * Causes a general Cover Texture update. - * Sends 6 Integers to Client + causes @issueTextureUpdate() + * Causes a general Cover Texture update. Sends 6 Integers to Client + causes @issueTextureUpdate() */ void issueCoverUpdate(byte aSide); @@ -77,10 +78,11 @@ 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 4e3b03d970..5208944d66 100644 --- a/src/main/java/gregtech/api/interfaces/tileentity/IDebugableTileEntity.java +++ b/src/main/java/gregtech/api/interfaces/tileentity/IDebugableTileEntity.java @@ -1,18 +1,17 @@ package gregtech.api.interfaces.tileentity; import java.util.ArrayList; + import net.minecraft.entity.player.EntityPlayer; public interface IDebugableTileEntity { + /** * Returns a Debug Message, for a generic DebugItem * * @param aPlayer the Player, who rightclicked with his Debug Item - * @param aLogLevel the Log Level of the Debug Item. - * 0 = Obvious - * 1 = Visible for the regular Scanner - * 2 = Only visible to more advanced Scanners - * 3 = Debug ONLY + * @param aLogLevel the Log Level of the Debug Item. 0 = Obvious 1 = Visible for the regular Scanner 2 = Only + * visible to more advanced Scanners 3 = Debug ONLY * @return a String-Array containing the DebugInfo, every Index is a separate line (0 = first Line) */ ArrayList<String> getDebugInfo(EntityPlayer aPlayer, int aLogLevel); diff --git a/src/main/java/gregtech/api/interfaces/tileentity/IDigitalChest.java b/src/main/java/gregtech/api/interfaces/tileentity/IDigitalChest.java index 9d19e7cef0..9a08e65b78 100644 --- a/src/main/java/gregtech/api/interfaces/tileentity/IDigitalChest.java +++ b/src/main/java/gregtech/api/interfaces/tileentity/IDigitalChest.java @@ -6,16 +6,17 @@ import net.minecraft.item.ItemStack; * You are allowed to include this File in your Download, as i will not change it. */ public interface IDigitalChest extends IHasWorldObjectAndCoords { + /** - * Is this even a TileEntity of a Digital Chest? - * I need things like this Function for MetaTileEntities, you MUST check this!!! - * Do not assume that it's a Digital Chest or similar Device, when it just implements this Interface. + * Is this even a TileEntity of a Digital Chest? I need things like this Function for MetaTileEntities, you MUST + * check this!!! Do not assume that it's a Digital Chest or similar Device, when it just implements this Interface. */ boolean isDigitalChest(); /** - * Gives an Array of Stacks with Size (of all the Data-stored Items) of the correspondent Item kinds (regular QChests have only one) - * Does NOT include the 64 "ready" Items inside the Slots, and neither the 128 Items in the overflow Buffer. + * Gives an Array of Stacks with Size (of all the Data-stored Items) of the correspondent Item kinds (regular + * QChests have only one) Does NOT include the 64 "ready" Items inside the Slots, and neither the 128 Items in the + * overflow Buffer. */ ItemStack[] getStoredItemData(); @@ -25,7 +26,8 @@ public interface IDigitalChest extends IHasWorldObjectAndCoords { void setItemCount(int aCount); /** - * Gets the maximum Item count for this QChest alike Storage. This applies to the Data-Storage, not for the up to 192 buffered Items! + * Gets the maximum Item count for this QChest alike Storage. This applies to the Data-Storage, not for the up to + * 192 buffered Items! */ int getMaxItemCount(); } diff --git a/src/main/java/gregtech/api/interfaces/tileentity/IEnergyConductor.java b/src/main/java/gregtech/api/interfaces/tileentity/IEnergyConductor.java index 5a35e1ea52..f136434c54 100644 --- a/src/main/java/gregtech/api/interfaces/tileentity/IEnergyConductor.java +++ b/src/main/java/gregtech/api/interfaces/tileentity/IEnergyConductor.java @@ -8,6 +8,7 @@ import gregtech.api.enums.Materials; * Not all Data might be reliable. This is just for Information sake. */ public interface IEnergyConductor extends IEnergyConnected { + /** * @return if this is actually a Cable. (you must check this) */ diff --git a/src/main/java/gregtech/api/interfaces/tileentity/IEnergyConnected.java b/src/main/java/gregtech/api/interfaces/tileentity/IEnergyConnected.java index c1ecc2b153..d046418ea6 100644 --- a/src/main/java/gregtech/api/interfaces/tileentity/IEnergyConnected.java +++ b/src/main/java/gregtech/api/interfaces/tileentity/IEnergyConnected.java @@ -1,26 +1,29 @@ package gregtech.api.interfaces.tileentity; +import net.minecraft.tileentity.TileEntity; +import net.minecraftforge.common.util.ForgeDirection; + import cofh.api.energy.IEnergyReceiver; import gregtech.api.GregTech_API; import gregtech.api.util.GT_Utility; import ic2.api.energy.tile.IEnergySink; -import net.minecraft.tileentity.TileEntity; -import net.minecraftforge.common.util.ForgeDirection; /** * Interface for getting Connected to the GregTech Energy Network. * <p/> - * This is all you need to connect to the GT Network. - * IColoredTileEntity is needed for not connecting differently coloured Blocks to each other. - * IHasWorldObjectAndCoords is needed for the InWorld related Stuff. @BaseTileEntity does implement most of that Interface. + * This is all you need to connect to the GT Network. IColoredTileEntity is needed for not connecting differently + * coloured Blocks to each other. IHasWorldObjectAndCoords is needed for the InWorld related Stuff. @BaseTileEntity does + * implement most of that Interface. */ public interface IEnergyConnected extends IColoredTileEntity, IHasWorldObjectAndCoords { + /** * Inject Energy Call for Electricity. Gets called by EnergyEmitters to inject Energy into your Block * <p/> * Note: you have to check for @inputEnergyFrom because the Network won't check for that by itself. * - * @param aSide 0 - 5 = Vanilla Directions of YOUR Block the Energy gets inserted to. 6 = No specific Side (don't do Side checks for this Side) + * @param aSide 0 - 5 = Vanilla Directions of YOUR Block the Energy gets inserted to. 6 = No specific Side (don't do + * Side checks for this Side) * @return amount of used Amperes. 0 if not accepted anything. */ long injectEnergyUnits(byte aSide, long aVoltage, long aAmperage); @@ -47,6 +50,7 @@ public interface IEnergyConnected extends IColoredTileEntity, IHasWorldObjectAnd * Utility for the Network */ final class Util { + /** * Emits Energy to the E-net. Also compatible with adjacent IC2 TileEntities. * @@ -69,15 +73,14 @@ public interface IEnergyConnected extends IColoredTileEntity, IHasWorldObjectAnd } else if (tTileEntity instanceof IEnergySink) { if (((IEnergySink) tTileEntity) .acceptsEnergyFrom((TileEntity) aEmitter, ForgeDirection.getOrientation(j))) { - while (aAmperage > rUsedAmperes - && ((IEnergySink) tTileEntity).getDemandedEnergy() > 0 + while (aAmperage > rUsedAmperes && ((IEnergySink) tTileEntity).getDemandedEnergy() > 0 && ((IEnergySink) tTileEntity) - .injectEnergy(ForgeDirection.getOrientation(j), aVoltage, aVoltage) - < aVoltage) rUsedAmperes++; + .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 936de80b3e..8eb481f150 100644 --- a/src/main/java/gregtech/api/interfaces/tileentity/IExperimentalEnergyTileEntity.java +++ b/src/main/java/gregtech/api/interfaces/tileentity/IExperimentalEnergyTileEntity.java @@ -1,28 +1,31 @@ package gregtech.api.interfaces.tileentity; +import net.minecraft.tileentity.TileEntity; +import net.minecraftforge.common.util.ForgeDirection; + import cofh.api.energy.IEnergyReceiver; import gregtech.api.enums.SubTag; import gregtech.api.util.GT_Utility; import ic2.api.energy.tile.IEnergySink; -import net.minecraft.tileentity.TileEntity; -import net.minecraftforge.common.util.ForgeDirection; /** * THIS IS GOING TO BE USED IN 1.8 * <p/> * Interface for getting Connected to the GregTech Energy Network. * <p/> - * This is all you need to connect to the GT Network. - * IColoredTileEntity is needed for not connecting differently coloured Blocks to each other. - * IHasWorldObjectAndCoords is needed for the InWorld related Stuff. @BaseTileEntity does implement most of that Interface. + * This is all you need to connect to the GT Network. IColoredTileEntity is needed for not connecting differently + * coloured Blocks to each other. IHasWorldObjectAndCoords is needed for the InWorld related Stuff. @BaseTileEntity does + * implement most of that Interface. */ public interface IExperimentalEnergyTileEntity extends IColoredTileEntity, IHasWorldObjectAndCoords { + /** * Inject Energy Call for Electricity. Gets called by EnergyEmitters to inject Energy into your Block * <p/> * Note: you have to check for @inputEnergyFrom because the Network won't check for that by itself. * - * @param aSide 0 - 5 = Vanilla Directions of YOUR Block the Energy gets inserted to. 6 = No specific Side (don't do Side checks for this Side) + * @param aSide 0 - 5 = Vanilla Directions of YOUR Block the Energy gets inserted to. 6 = No specific Side (don't do + * Side checks for this Side) * @return amount of used Amperes. 0 if not accepted anything. */ long injectEnergy(SubTag aEnergyType, byte aSide, long aPrimary, long aSecondary); @@ -41,6 +44,7 @@ public interface IExperimentalEnergyTileEntity extends IColoredTileEntity, IHasW * Utility for the Network */ class Util { + public static int RF_PER_EU = 4; private static boolean RF_ENERGY = false, IC_ENERGY = false, CHECK_ALL = true; @@ -65,12 +69,13 @@ public interface IExperimentalEnergyTileEntity extends IColoredTileEntity, IHasW } /** - * Emits Energy to the adjacent Blocks. Also compatible with adjacent IC2 TileEntities when electric and RF TileEntities when RedstoneFlux. + * Emits Energy to the adjacent Blocks. Also compatible with adjacent IC2 TileEntities when electric and RF + * TileEntities when RedstoneFlux. * * @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++) @@ -84,24 +89,24 @@ public interface IExperimentalEnergyTileEntity extends IColoredTileEntity, IHasW } rUsedSecondary += ((IExperimentalEnergyTileEntity) tTileEntity) .injectEnergy(aEnergyType, j, aPrimary, aSecondary - rUsedSecondary); - } else if (IC_ENERGY - && aEnergyType == SubTag.ENERGY_ELECTRICITY + } 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) + 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); - } + < 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); + } } return rUsedSecondary; } diff --git a/src/main/java/gregtech/api/interfaces/tileentity/IFibreConnected.java b/src/main/java/gregtech/api/interfaces/tileentity/IFibreConnected.java index 713fe73f22..a301c21a76 100644 --- a/src/main/java/gregtech/api/interfaces/tileentity/IFibreConnected.java +++ b/src/main/java/gregtech/api/interfaces/tileentity/IFibreConnected.java @@ -4,6 +4,7 @@ package gregtech.api.interfaces.tileentity; * This File has just internal Information about the Fibre Redstone State of a TileEntity */ public interface IFibreConnected extends IColoredTileEntity, IHasWorldObjectAndCoords { + /** * If this Blocks accepts Fibre from this Side */ diff --git a/src/main/java/gregtech/api/interfaces/tileentity/IGearEnergyTileEntity.java b/src/main/java/gregtech/api/interfaces/tileentity/IGearEnergyTileEntity.java index 54fe151cb1..31e9b51719 100644 --- a/src/main/java/gregtech/api/interfaces/tileentity/IGearEnergyTileEntity.java +++ b/src/main/java/gregtech/api/interfaces/tileentity/IGearEnergyTileEntity.java @@ -1,15 +1,16 @@ package gregtech.api.interfaces.tileentity; public interface IGearEnergyTileEntity { + /** - * If Rotation Energy can be accepted on this Side. - * This means that the Gear/Axle will connect to this Side, and can cause the Gear/Axle to stop if the Energy isn't accepted. + * If Rotation Energy can be accepted on this Side. This means that the Gear/Axle will connect to this Side, and can + * cause the Gear/Axle to stop if the Energy isn't accepted. */ boolean acceptsRotationalEnergy(byte aSide); /** - * Inject Energy Call for Rotational Energy. - * Rotation Energy can't be stored, this is just for things like internal Dynamos, which convert it into Energy, or into Progress. + * Inject Energy Call for Rotational Energy. Rotation Energy can't be stored, this is just for things like internal + * Dynamos, which convert it into Energy, or into Progress. * * @param aSpeed Positive = Clockwise, Negative = Counterclockwise */ diff --git a/src/main/java/gregtech/api/interfaces/tileentity/IGregTechDeviceInformation.java b/src/main/java/gregtech/api/interfaces/tileentity/IGregTechDeviceInformation.java index 221e290220..001ed44825 100644 --- a/src/main/java/gregtech/api/interfaces/tileentity/IGregTechDeviceInformation.java +++ b/src/main/java/gregtech/api/interfaces/tileentity/IGregTechDeviceInformation.java @@ -4,16 +4,17 @@ package gregtech.api.interfaces.tileentity; * You are allowed to include this File in your Download, as i will not change it. */ public interface IGregTechDeviceInformation { + /** - * Is this even a TileEntity which allows GregTech Sensor Kits? - * I need things like this Function for MetaTileEntities, you MUST check this!!! - * Do not assume that it's a Information returning Device, when it just implements this Interface. + * Is this even a TileEntity which allows GregTech Sensor Kits? I need things like this Function for + * MetaTileEntities, you MUST check this!!! Do not assume that it's a Information returning Device, when it just + * implements this Interface. */ boolean isGivingInformation(); /** - * Up to 8 Strings can be returned. - * Note: If you insert "\\\\" in the String it tries to translate seperate Parts of the String instead of the String as a whole. + * Up to 8 Strings can be returned. Note: If you insert "\\\\" in the String it tries to translate seperate Parts of + * the String instead of the String as a whole. * * @return an Array of Information Strings. Don't return null! */ diff --git a/src/main/java/gregtech/api/interfaces/tileentity/IGregTechTileEntity.java b/src/main/java/gregtech/api/interfaces/tileentity/IGregTechTileEntity.java index 16fbe4f327..a561c3ebe1 100644 --- a/src/main/java/gregtech/api/interfaces/tileentity/IGregTechTileEntity.java +++ b/src/main/java/gregtech/api/interfaces/tileentity/IGregTechTileEntity.java @@ -1,15 +1,9 @@ package gregtech.api.interfaces.tileentity; -import cpw.mods.fml.relauncher.Side; -import cpw.mods.fml.relauncher.SideOnly; -import gregtech.api.interfaces.IDescribable; -import gregtech.api.interfaces.metatileentity.IMetaTileEntity; -import gregtech.api.interfaces.modularui.IAddInventorySlots; -import gregtech.api.interfaces.modularui.IGetGUITextureSet; -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; @@ -18,6 +12,14 @@ import net.minecraft.util.AxisAlignedBB; import net.minecraft.world.World; import net.minecraftforge.fluids.IFluidHandler; +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; +import gregtech.api.interfaces.IDescribable; +import gregtech.api.interfaces.metatileentity.IMetaTileEntity; +import gregtech.api.interfaces.modularui.IAddInventorySlots; +import gregtech.api.interfaces.modularui.IGetGUITextureSet; +import gregtech.common.blocks.GT_Block_Machines; + /** * A simple compound Interface for all my TileEntities. * <p/> @@ -25,20 +27,10 @@ import net.minecraftforge.fluids.IFluidHandler; * <p/> * It can cause Problems to include this Interface! */ -public interface IGregTechTileEntity - extends ITexturedTileEntity, - IGearEnergyTileEntity, - ICoverable, - IFluidHandler, - ITurnable, - IGregTechDeviceInformation, - IUpgradableMachine, - IDigitalChest, - IDescribable, - IMachineBlockUpdateable, - IGregtechWailaProvider, - IGetGUITextureSet, - IAddInventorySlots { +public interface IGregTechTileEntity extends ITexturedTileEntity, IGearEnergyTileEntity, ICoverable, IFluidHandler, + ITurnable, IGregTechDeviceInformation, IUpgradableMachine, IDigitalChest, IDescribable, IMachineBlockUpdateable, + IGregtechWailaProvider, IGetGUITextureSet, IAddInventorySlots { + /** * gets the Error displayed on the GUI */ @@ -65,9 +57,9 @@ public interface IGregTechTileEntity IMetaTileEntity getMetaTileEntity(); /** - * Sets the MetaTileEntity. - * Even though this uses the Universal Interface, certain BaseMetaTileEntities only accept one kind of MetaTileEntity - * so only use this if you are sure its the correct one or you will get a Class cast Error. + * Sets the MetaTileEntity. Even though this uses the Universal Interface, certain BaseMetaTileEntities only accept + * one kind of MetaTileEntity so only use this if you are sure its the correct one or you will get a Class cast + * Error. * * @param aMetaTileEntity */ @@ -144,7 +136,8 @@ public interface IGregTechTileEntity ArrayList<ItemStack> getDrops(); - /** Check if the item at the specific index should be dropped or not + /** + * Check if the item at the specific index should be dropped or not * * @param index Index that will be checked * @return True if it should drop, else false @@ -156,14 +149,8 @@ public interface IGregTechTileEntity */ 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); @@ -184,8 +171,7 @@ public interface IGregTechTileEntity */ @Override default boolean isMachineBlockUpdateRecursive() { - return !isDead() - && getMetaTileEntity() != null + return !isDead() && getMetaTileEntity() != null && getMetaTileEntity().getBaseMetaTileEntity() == this && getMetaTileEntity().isMachineBlockUpdateRecursive(); } @@ -195,8 +181,8 @@ public interface IGregTechTileEntity } /** - * A randomly called display update to be able to add particles or other items for display - * The event is proxied by the {@link GT_Block_Machines#randomDisplayTick} + * A randomly called display update to be able to add particles or other items for display The event is proxied by + * the {@link GT_Block_Machines#randomDisplayTick} */ @SideOnly(Side.CLIENT) default void onRandomDisplayTick() { diff --git a/src/main/java/gregtech/api/interfaces/tileentity/IGregtechWailaProvider.java b/src/main/java/gregtech/api/interfaces/tileentity/IGregtechWailaProvider.java index a463cc91df..19835cd03c 100644 --- a/src/main/java/gregtech/api/interfaces/tileentity/IGregtechWailaProvider.java +++ b/src/main/java/gregtech/api/interfaces/tileentity/IGregtechWailaProvider.java @@ -1,8 +1,10 @@ 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; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; @@ -10,15 +12,10 @@ import net.minecraft.tileentity.TileEntity; import net.minecraft.world.World; public interface IGregtechWailaProvider { - 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 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) {} } diff --git a/src/main/java/gregtech/api/interfaces/tileentity/IHasInventory.java b/src/main/java/gregtech/api/interfaces/tileentity/IHasInventory.java index 74ad58c407..bee1756217 100644 --- a/src/main/java/gregtech/api/interfaces/tileentity/IHasInventory.java +++ b/src/main/java/gregtech/api/interfaces/tileentity/IHasInventory.java @@ -18,18 +18,20 @@ public interface IHasInventory extends ISidedInventory, IHasWorldObjectAndCoords boolean isValidSlot(int aIndex); /** - * Tries to add a Stack to the Slot. - * It doesn't matter if the Slot is valid or invalid as described at the Function above. + * Tries to add a Stack to the Slot. It doesn't matter if the Slot is valid or invalid as described at the Function + * above. * - * @return true if aStack == null, then false if aIndex is out of bounds, then false if aStack cannot be added, and then true if aStack has been added + * @return true if aStack == null, then false if aIndex is out of bounds, then false if aStack cannot be added, and + * then true if aStack has been added */ boolean addStackToSlot(int aIndex, ItemStack aStack); /** - * Tries to add X Items of a Stack to the Slot. - * It doesn't matter if the Slot is valid or invalid as described at the Function above. + * Tries to add X Items of a Stack to the Slot. It doesn't matter if the Slot is valid or invalid as described at + * the Function above. * - * @return true if aStack == null, then false if aIndex is out of bounds, then false if aStack cannot be added, and then true if aStack has been added + * @return true if aStack == null, then false if aIndex is out of bounds, then false if aStack cannot be added, and + * then true if aStack has been added */ boolean addStackToSlot(int aIndex, ItemStack aStack, int aAmount); } diff --git a/src/main/java/gregtech/api/interfaces/tileentity/IHasWorldObjectAndCoords.java b/src/main/java/gregtech/api/interfaces/tileentity/IHasWorldObjectAndCoords.java index 7f31d17d11..f02672365e 100644 --- a/src/main/java/gregtech/api/interfaces/tileentity/IHasWorldObjectAndCoords.java +++ b/src/main/java/gregtech/api/interfaces/tileentity/IHasWorldObjectAndCoords.java @@ -11,13 +11,16 @@ import net.minecraft.world.biome.BiomeGenBase; import net.minecraftforge.fluids.IFluidHandler; /** - * This is a bunch of Functions my TileEntities provide, to make life much easier, and to get rid of internal TileEntity stuff. + * This is a bunch of Functions my TileEntities provide, to make life much easier, and to get rid of internal TileEntity + * stuff. * <p/> * This also makes access to adjacent TileEntities more Efficient. * <p/> - * Note: It doesn't have to be a TileEntity in certain cases! And only certain cases, such as the Recipe checking of the findRecipe Function. + * Note: It doesn't have to be a TileEntity in certain cases! And only certain cases, such as the Recipe checking of the + * findRecipe Function. */ public interface IHasWorldObjectAndCoords { + World getWorld(); int getXCoord(); @@ -132,7 +135,8 @@ public interface IHasWorldObjectAndCoords { boolean isDead(); /** - * Sends a Block Event to the Client TileEntity, the byte Parameters are only for validation as Minecraft doesn't properly write Packet Data. + * Sends a Block Event to the Client TileEntity, the byte Parameters are only for validation as Minecraft doesn't + * properly write Packet Data. */ void sendBlockEvent(byte aID, byte aValue); @@ -142,8 +146,8 @@ public interface IHasWorldObjectAndCoords { long getTimer(); /** - * Sets the Light Level of this Block on a Scale of 0 - 15 - * It could be that it doesn't work. This is just for convenience. + * Sets the Light Level of this Block on a Scale of 0 - 15 It could be that it doesn't work. This is just for + * convenience. */ void setLightValue(byte aLightValue); @@ -164,6 +168,7 @@ public interface IHasWorldObjectAndCoords { /** * Opens the GUI with this ID of this MetaTileEntity + * * @deprecated Use ModularUI */ @Deprecated @@ -173,6 +178,7 @@ public interface IHasWorldObjectAndCoords { /** * Opens the GUI with the ID = 0 of this TileEntity + * * @deprecated Use ModularUI */ @Deprecated diff --git a/src/main/java/gregtech/api/interfaces/tileentity/IIC2Enet.java b/src/main/java/gregtech/api/interfaces/tileentity/IIC2Enet.java index 2593f1f3b5..971558c092 100644 --- a/src/main/java/gregtech/api/interfaces/tileentity/IIC2Enet.java +++ b/src/main/java/gregtech/api/interfaces/tileentity/IIC2Enet.java @@ -4,6 +4,7 @@ package gregtech.api.interfaces.tileentity; * IC2 Energy Compat */ public interface IIC2Enet { + /** * Should this tile/block join the ic2 enet */ diff --git a/src/main/java/gregtech/api/interfaces/tileentity/IMachineBlockUpdateable.java b/src/main/java/gregtech/api/interfaces/tileentity/IMachineBlockUpdateable.java index b8ce51a212..f772c1ee69 100644 --- a/src/main/java/gregtech/api/interfaces/tileentity/IMachineBlockUpdateable.java +++ b/src/main/java/gregtech/api/interfaces/tileentity/IMachineBlockUpdateable.java @@ -1,16 +1,17 @@ package gregtech.api.interfaces.tileentity; /** - * You are allowed to include this File in your Download, as i will not change it. - * Simple Interface for Machines, which need my Machine Blocks for MultiBlockStructures. + * You are allowed to include this File in your Download, as i will not change it. Simple Interface for Machines, which + * need my Machine Blocks for MultiBlockStructures. * <p/> * Every Machine implementing this Interface will conduct Machine updates. */ public interface IMachineBlockUpdateable { + /** - * The Machine Update, which is called when the Machine needs an Update of its Parts. - * I suggest to wait 1-5 seconds before actually checking the Machine Parts. - * RP-Frames could for example cause Problems when you instacheck the Machine Parts. + * The Machine Update, which is called when the Machine needs an Update of its Parts. I suggest to wait 1-5 seconds + * before actually checking the Machine Parts. RP-Frames could for example cause Problems when you instacheck the + * Machine Parts. */ void onMachineBlockUpdate(); diff --git a/src/main/java/gregtech/api/interfaces/tileentity/IMachineProgress.java b/src/main/java/gregtech/api/interfaces/tileentity/IMachineProgress.java index 54fa90218a..bcd213b4ff 100644 --- a/src/main/java/gregtech/api/interfaces/tileentity/IMachineProgress.java +++ b/src/main/java/gregtech/api/interfaces/tileentity/IMachineProgress.java @@ -4,6 +4,7 @@ package gregtech.api.interfaces.tileentity; * For Machines which have Progress */ public interface IMachineProgress extends IHasWorldObjectAndCoords { + /** * returns the Progress this Machine has made. Warning, this can also be negative! */ @@ -25,8 +26,8 @@ public interface IMachineProgress extends IHasWorldObjectAndCoords { boolean hasThingsToDo(); /** - * returns if the Machine just got enableWorking called after being disabled. - * Used for Translocators, which need to check if they need to transfer immediately. + * returns if the Machine just got enableWorking called after being disabled. Used for Translocators, which need to + * check if they need to transfer immediately. */ boolean hasWorkJustBeenEnabled(); @@ -46,16 +47,15 @@ public interface IMachineProgress extends IHasWorldObjectAndCoords { boolean isAllowedToWork(); /** - * 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. + * 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; } /** - * used to control Machines via Redstone Signal Strength by special Covers - * only Values between 0 and 15! + * used to control Machines via Redstone Signal Strength by special Covers only Values between 0 and 15! */ default void setWorkDataValue(byte aValue) {} @@ -71,7 +71,7 @@ public interface IMachineProgress extends IHasWorldObjectAndCoords { /** * Indicates if the object in question was forced to shut down (i.e. loss of power) - * */ + */ default boolean wasShutdown() { return false; } diff --git a/src/main/java/gregtech/api/interfaces/tileentity/IPipeRenderedTileEntity.java b/src/main/java/gregtech/api/interfaces/tileentity/IPipeRenderedTileEntity.java index c7590e98ed..3cc3c6404d 100644 --- a/src/main/java/gregtech/api/interfaces/tileentity/IPipeRenderedTileEntity.java +++ b/src/main/java/gregtech/api/interfaces/tileentity/IPipeRenderedTileEntity.java @@ -3,6 +3,7 @@ package gregtech.api.interfaces.tileentity; import gregtech.api.interfaces.ITexture; public interface IPipeRenderedTileEntity extends ICoverable, ITexturedTileEntity { + float getThickNess(); byte getConnections(); diff --git a/src/main/java/gregtech/api/interfaces/tileentity/IRedstoneEmitter.java b/src/main/java/gregtech/api/interfaces/tileentity/IRedstoneEmitter.java index fc5aa460bf..fba20ee79d 100644 --- a/src/main/java/gregtech/api/interfaces/tileentity/IRedstoneEmitter.java +++ b/src/main/java/gregtech/api/interfaces/tileentity/IRedstoneEmitter.java @@ -4,6 +4,7 @@ package gregtech.api.interfaces.tileentity; * This File has just internal Information about the Redstone State of a TileEntity */ public interface IRedstoneEmitter extends IHasWorldObjectAndCoords { + /** * gets the Redstone Level the TileEntity should emit to the given Output Side */ @@ -12,8 +13,9 @@ public interface IRedstoneEmitter extends IHasWorldObjectAndCoords { /** * sets the Redstone Level the TileEntity should emit to the given Output Side * <p/> - * Do not use this if ICoverable is implemented. ICoverable has @getInternalOutputRedstoneSignal for Machine internal Output Redstone, so that it doesnt conflict with Cover Redstone. - * This sets the true Redstone Output Signal. Only Cover Behaviors should use it, not MetaTileEntities. + * Do not use this if ICoverable is implemented. ICoverable has @getInternalOutputRedstoneSignal for Machine + * internal Output Redstone, so that it doesnt conflict with Cover Redstone. This sets the true Redstone Output + * Signal. Only Cover Behaviors should use it, not MetaTileEntities. */ void setOutputRedstoneSignal(byte aSide, byte aStrength); @@ -25,8 +27,9 @@ public interface IRedstoneEmitter extends IHasWorldObjectAndCoords { /** * sets the Redstone Level the TileEntity should emit to the given Output Side * <p/> - * Do not use this if ICoverable is implemented. ICoverable has @getInternalOutputRedstoneSignal for Machine internal Output Redstone, so that it doesnt conflict with Cover Redstone. - * This sets the true Redstone Output Signal. Only Cover Behaviors should use it, not MetaTileEntities. + * Do not use this if ICoverable is implemented. ICoverable has @getInternalOutputRedstoneSignal for Machine + * internal Output Redstone, so that it doesnt conflict with Cover Redstone. This sets the true Redstone Output + * Signal. Only Cover Behaviors should use it, not MetaTileEntities. */ void setStrongOutputRedstoneSignal(byte aSide, byte aStrength); diff --git a/src/main/java/gregtech/api/interfaces/tileentity/IRedstoneReceiver.java b/src/main/java/gregtech/api/interfaces/tileentity/IRedstoneReceiver.java index acee525137..d5fb814c52 100644 --- a/src/main/java/gregtech/api/interfaces/tileentity/IRedstoneReceiver.java +++ b/src/main/java/gregtech/api/interfaces/tileentity/IRedstoneReceiver.java @@ -4,11 +4,13 @@ package gregtech.api.interfaces.tileentity; * This File has just internal Information about the Redstone State of a TileEntity */ public interface IRedstoneReceiver extends IHasWorldObjectAndCoords { + /** * gets the Redstone Level of the TileEntity to the given Input Side * <p/> - * Do not use this if ICoverable is implemented. ICoverable has @getInternalInputRedstoneSignal for Machine internal Input Redstone - * This returns the true incoming Redstone Signal. Only Cover Behaviors should check it, not MetaTileEntities. + * Do not use this if ICoverable is implemented. ICoverable has @getInternalInputRedstoneSignal for Machine internal + * Input Redstone This returns the true incoming Redstone Signal. Only Cover Behaviors should check it, not + * MetaTileEntities. */ byte getInputRedstoneSignal(byte aSide); diff --git a/src/main/java/gregtech/api/interfaces/tileentity/IRedstoneTileEntity.java b/src/main/java/gregtech/api/interfaces/tileentity/IRedstoneTileEntity.java index 452699a172..1deb5f1d7c 100644 --- a/src/main/java/gregtech/api/interfaces/tileentity/IRedstoneTileEntity.java +++ b/src/main/java/gregtech/api/interfaces/tileentity/IRedstoneTileEntity.java @@ -4,14 +4,14 @@ package gregtech.api.interfaces.tileentity; * This File has just internal Information about the Redstone State of a TileEntity */ public interface IRedstoneTileEntity extends IRedstoneEmitter, IRedstoneReceiver { + /** * enables/disables Redstone Output in general. */ void setGenericRedstoneOutput(boolean aOnOff); /** - * Causes a general Block update. - * Sends nothing to Client, just causes a Block Update. + * Causes a general Block update. Sends nothing to Client, just causes a Block Update. */ void issueBlockUpdate(); } diff --git a/src/main/java/gregtech/api/interfaces/tileentity/ITexturedTileEntity.java b/src/main/java/gregtech/api/interfaces/tileentity/ITexturedTileEntity.java index fd1600903e..d6024b612e 100644 --- a/src/main/java/gregtech/api/interfaces/tileentity/ITexturedTileEntity.java +++ b/src/main/java/gregtech/api/interfaces/tileentity/ITexturedTileEntity.java @@ -1,9 +1,11 @@ package gregtech.api.interfaces.tileentity; -import gregtech.api.interfaces.ITexture; import net.minecraft.block.Block; +import gregtech.api.interfaces.ITexture; + public interface ITexturedTileEntity { + /** * @return the Textures rendered by the GT Rendering */ diff --git a/src/main/java/gregtech/api/interfaces/tileentity/ITurnable.java b/src/main/java/gregtech/api/interfaces/tileentity/ITurnable.java index e05fd44637..e54a85090e 100644 --- a/src/main/java/gregtech/api/interfaces/tileentity/ITurnable.java +++ b/src/main/java/gregtech/api/interfaces/tileentity/ITurnable.java @@ -6,6 +6,7 @@ import static gregtech.api.enums.GT_Values.ALL_VALID_SIDES; * Implemented by all my Machines. However without any security checks, if the Players are even allowed to rotate it. */ public interface ITurnable { + /** * Get the block's facing. * diff --git a/src/main/java/gregtech/api/interfaces/tileentity/IUpgradableMachine.java b/src/main/java/gregtech/api/interfaces/tileentity/IUpgradableMachine.java index cc59a4af34..546ada0c9d 100644 --- a/src/main/java/gregtech/api/interfaces/tileentity/IUpgradableMachine.java +++ b/src/main/java/gregtech/api/interfaces/tileentity/IUpgradableMachine.java @@ -4,6 +4,7 @@ package gregtech.api.interfaces.tileentity; * To access my Machines a bit easier */ public interface IUpgradableMachine extends IMachineProgress { + /** * Accepts Upgrades. Some Machines have an Upgrade Limit. */ 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 d37f0479ef..1226520eff 100644 --- a/src/main/java/gregtech/api/items/GT_Block_LongDistancePipe.java +++ b/src/main/java/gregtech/api/items/GT_Block_LongDistancePipe.java @@ -1,15 +1,7 @@ package gregtech.api.items; -import cpw.mods.fml.relauncher.Side; -import cpw.mods.fml.relauncher.SideOnly; -import gregtech.api.GregTech_API; -import gregtech.api.enums.ItemList; -import gregtech.api.enums.Textures; -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; @@ -23,7 +15,18 @@ import net.minecraft.util.StatCollector; import net.minecraft.world.IBlockAccess; import net.minecraft.world.World; +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; +import gregtech.api.GregTech_API; +import gregtech.api.enums.ItemList; +import gregtech.api.enums.Textures; +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; + public class GT_Block_LongDistancePipe extends GT_Generic_Block { + public IIconContainer[] mIcons; public GT_Block_LongDistancePipe() { @@ -38,9 +41,8 @@ public class GT_Block_LongDistancePipe extends GT_Generic_Block { 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 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 05b73d730c..3371a1a261 100644 --- a/src/main/java/gregtech/api/items/GT_BreederCell_Item.java +++ b/src/main/java/gregtech/api/items/GT_BreederCell_Item.java @@ -2,14 +2,9 @@ package gregtech.api.items; import static gregtech.api.util.GT_Utility.formatNumbers; -import gregtech.api.GregTech_API; -import gregtech.api.enums.GT_Values; -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; @@ -17,12 +12,20 @@ import net.minecraft.item.ItemStack; import net.minecraft.util.EnumChatFormatting; import net.minecraft.world.World; +import gregtech.api.GregTech_API; +import gregtech.api.enums.GT_Values; +import gregtech.api.util.GT_Utility; +import ic2.api.reactor.IReactor; +import ic2.api.reactor.IReactorComponent; +import ic2.core.IC2Potion; + /** * A {@link ic2.core.item.reactor.ItemReactorLithiumCell}, but can be used to produce anything! * * @author glee8e */ public class GT_BreederCell_Item extends GT_Generic_Item implements IReactorComponent { + protected final int mHeatBonusStep; protected final int mHeatBonusMultiplier; protected ItemStack mProduct; @@ -30,14 +33,8 @@ public class GT_BreederCell_Item extends GT_Generic_Item implements IReactorComp protected boolean hidden = false; protected boolean neiAdded = false; - 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; @@ -47,7 +44,12 @@ public class GT_BreederCell_Item extends GT_Generic_Item implements IReactorComp mProduct = aProduct.get(); if (!hidden && !neiAdded) { GT_Values.RA.addIC2ReactorBreederCell( - new ItemStack(this), mProduct, deflector, mHeatBonusStep, mHeatBonusMultiplier, getMaxDamage()); + new ItemStack(this), + mProduct, + deflector, + mHeatBonusStep, + mHeatBonusMultiplier, + getMaxDamage()); neiAdded = true; } }); @@ -90,10 +92,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 + formatNumbers(aStack.getItemDamage()) + EnumChatFormatting.RESET, - "" + formatNumbers(getMaxDamage()))); + aList.add( + String.format( + transItem("020", "Progress: %s/%s"), + "" + color2 + formatNumbers(aStack.getItemDamage()) + EnumChatFormatting.RESET, + "" + formatNumbers(getMaxDamage()))); if (aStack.getItemDamage() > 0) aList.add(EnumChatFormatting.RED + transItem("021", "Radiation Hazard")); } @@ -106,15 +109,8 @@ public class GT_BreederCell_Item extends GT_Generic_Item implements IReactorComp 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()); 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 eb37b50ea6..73d3dc3be8 100644 --- a/src/main/java/gregtech/api/items/GT_CoolantCellIC_Item.java +++ b/src/main/java/gregtech/api/items/GT_CoolantCellIC_Item.java @@ -1,10 +1,12 @@ package gregtech.api.items; +import net.minecraft.item.ItemStack; + 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 GT_CoolantCellIC_Item(String aUnlocalized, String aEnglish, int aMaxStore) { super(aUnlocalized, aEnglish, aMaxStore); } @@ -13,15 +15,8 @@ public class GT_CoolantCellIC_Item extends GT_CoolantCell_Item implements IReact 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 e698491b7d..b6530df95c 100644 --- a/src/main/java/gregtech/api/items/GT_CoolantCell_Item.java +++ b/src/main/java/gregtech/api/items/GT_CoolantCell_Item.java @@ -1,15 +1,18 @@ 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 gregtech.api.GregTech_API; +import ic2.core.util.StackUtil; + public class GT_CoolantCell_Item extends GT_Generic_Item { + protected int heatStorage; public GT_CoolantCell_Item(String aUnlocalized, String aEnglish, int aMaxStore) { @@ -74,8 +77,9 @@ public class GT_CoolantCell_Item extends GT_Generic_Item { 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 7b4ac6afb8..c31ba0cc82 100644 --- a/src/main/java/gregtech/api/items/GT_EnergyArmor_Item.java +++ b/src/main/java/gregtech/api/items/GT_EnergyArmor_Item.java @@ -2,15 +2,10 @@ 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; @@ -28,24 +23,22 @@ import net.minecraftforge.common.ISpecialArmor; import net.minecraftforge.common.MinecraftForge; import net.minecraftforge.event.entity.living.LivingFallEvent; +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; + 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, + 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); @@ -123,8 +116,7 @@ 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); } @@ -146,8 +138,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; @@ -172,8 +164,7 @@ public class GT_EnergyArmor_Item extends ItemArmor implements ISpecialArmor { } if ((mSpecials & 256) != 0) { - if (GT_ModHandler.canUseElectricItem(aStack, 100) - && aPlayer.isSprinting() + 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); @@ -217,21 +208,21 @@ 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); } + */ // } } } @@ -305,9 +296,8 @@ 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; @@ -318,17 +308,15 @@ public class GT_EnergyArmor_Item extends ItemArmor implements ISpecialArmor { } @Override - public ISpecialArmor.ArmorProperties getProperties( - EntityLivingBase player, ItemStack armor, DamageSource source, double damage, int slotIndex) { + 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); + mDamageEnergyCost > 0 ? 25 + * GT_ModHandler + .dischargeElectricItem(armor, Integer.MAX_VALUE, Integer.MAX_VALUE, true, true, true) + / mDamageEnergyCost : 0); } @Override @@ -337,10 +325,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 912841c145..7aaef6d5ca 100644 --- a/src/main/java/gregtech/api/items/GT_Generic_Block.java +++ b/src/main/java/gregtech/api/items/GT_Generic_Block.java @@ -2,13 +2,15 @@ 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 cpw.mods.fml.common.registry.GameRegistry; +import gregtech.api.util.GT_LanguageManager; + public class GT_Generic_Block extends Block { + protected final String mUnlocalizedName; protected GT_Generic_Block(Class<? extends ItemBlock> aItemClass, String aName, Material aMaterial) { 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 e139914de1..2f1e642e34 100644 --- a/src/main/java/gregtech/api/items/GT_Generic_Item.java +++ b/src/main/java/gregtech/api/items/GT_Generic_Item.java @@ -3,17 +3,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; -import gregtech.api.GregTech_API; -import gregtech.api.enums.SubTag; -import gregtech.api.interfaces.IProjectileItem; -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; @@ -30,10 +21,22 @@ import net.minecraft.util.EnumFacing; import net.minecraft.util.IIcon; import net.minecraft.world.World; +import cpw.mods.fml.common.registry.GameRegistry; +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; +import gregtech.api.GregTech_API; +import gregtech.api.enums.SubTag; +import gregtech.api.interfaces.IProjectileItem; +import gregtech.api.util.GT_Config; +import gregtech.api.util.GT_LanguageManager; +import gregtech.api.util.GT_ModHandler; +import gregtech.api.util.GT_Utility; + /** * Extended by most Items, also used as a fallback Item, to prevent the accidental deletion when Errors occur. */ public class GT_Generic_Item extends Item implements IProjectileItem { + private final String mName, mTooltip; protected IIcon mIcon; @@ -41,14 +44,13 @@ 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); + if (GT_Utility.isStringValid(aEnglishTooltip)) GT_LanguageManager + .addStringLocalization(mTooltip = mName + ".tooltip_main", aEnglishTooltip, aWriteToolTipIntoLangFile); else mTooltip = null; setCreativeTab(GregTech_API.TAB_GREGTECH); GameRegistry.registerItem(this, mName, MOD_ID); @@ -122,14 +124,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; } @@ -158,6 +160,7 @@ public class GT_Generic_Item extends Item implements IProjectileItem { } public static class GT_Item_Dispense extends BehaviorProjectileDispense { + @Override public ItemStack dispenseStack(IBlockSource aSource, ItemStack aStack) { return ((GT_Generic_Item) aStack.getItem()).onDispense(aSource, aStack); 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 efc8f88be1..42c356fd88 100644 --- a/src/main/java/gregtech/api/items/GT_MetaBase_Item.java +++ b/src/main/java/gregtech/api/items/GT_MetaBase_Item.java @@ -4,19 +4,10 @@ import static gregtech.api.enums.GT_Values.D1; import static gregtech.api.enums.GT_Values.V; import static gregtech.api.util.GT_Utility.formatNumbers; -import gregtech.api.enums.SubTag; -import gregtech.api.interfaces.IItemBehaviour; -import gregtech.api.util.GT_LanguageManager; -import gregtech.api.util.GT_Log; -import gregtech.api.util.GT_ModHandler; -import gregtech.api.util.GT_Utility; -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; @@ -31,16 +22,27 @@ import net.minecraft.world.World; import net.minecraftforge.fluids.FluidStack; import net.minecraftforge.fluids.IFluidContainerItem; +import gregtech.api.enums.SubTag; +import gregtech.api.interfaces.IItemBehaviour; +import gregtech.api.util.GT_LanguageManager; +import gregtech.api.util.GT_Log; +import gregtech.api.util.GT_ModHandler; +import gregtech.api.util.GT_Utility; +import ic2.api.item.ElectricItem; +import ic2.api.item.IElectricItem; +import ic2.api.item.IElectricItemManager; +import ic2.api.item.ISpecialElectricItem; + 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. * - * @param aUnlocalized The Unlocalized Name of this Item. + * @param aUnlocalized The Unlocalized Name of this Item. */ public GT_MetaBase_Item(String aUnlocalized) { super(aUnlocalized, "Generated Item", null, false); @@ -59,8 +61,8 @@ public abstract class GT_MetaBase_Item extends GT_Generic_Item */ public final GT_MetaBase_Item addItemBehavior(int aMetaValue, IItemBehaviour<GT_MetaBase_Item> aBehavior) { if (aMetaValue < 0 || aMetaValue >= 32766 || aBehavior == null) return this; - ArrayList<IItemBehaviour<GT_MetaBase_Item>> tList = - mItemBehaviors.computeIfAbsent((short) aMetaValue, k -> new ArrayList<>(1)); + ArrayList<IItemBehaviour<GT_MetaBase_Item>> tList = mItemBehaviors + .computeIfAbsent((short) aMetaValue, k -> new ArrayList<>(1)); tList.add(aBehavior); return this; } @@ -72,51 +74,46 @@ public abstract class GT_MetaBase_Item extends GT_Generic_Item @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); } @@ -126,12 +123,11 @@ public abstract class GT_MetaBase_Item extends GT_Generic_Item 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; - } + 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; @@ -143,27 +139,17 @@ public abstract class GT_MetaBase_Item extends GT_Generic_Item } @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; - } + 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; @@ -175,27 +161,17 @@ public abstract class GT_MetaBase_Item extends GT_Generic_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) { 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; - } + 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; @@ -212,9 +188,8 @@ public abstract class GT_MetaBase_Item extends GT_Generic_Item 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); + 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); } @@ -232,31 +207,28 @@ public abstract class GT_MetaBase_Item extends GT_Generic_Item Long[] tStats = getElectricStats(aStack); if (tStats != null) { if (tStats[3] > 0) { - aList.add(EnumChatFormatting.AQUA - + String.format( + aList.add( + EnumChatFormatting.AQUA + String.format( transItem("009", "Contains %s EU Tier: %s"), formatNumbers(tStats[3]), - "" + (tStats[2] >= 0 ? tStats[2] : 0)) - + EnumChatFormatting.GRAY); + "" + (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"), - formatNumbers(tCharge), - 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"), + formatNumbers(tCharge), + formatNumbers(Math.abs(tStats[0])), + "" + V[(int) (tStats[2] >= 0 + ? tStats[2] < V.length ? tStats[2] : V.length - 1 + : 1)]) + + EnumChatFormatting.GRAY); } } } @@ -264,23 +236,19 @@ public abstract class GT_MetaBase_Item extends GT_Generic_Item 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( + 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 : formatNumbers(tFluid.amount)), - "" + formatNumbers(tStats[0])) - + EnumChatFormatting.GRAY); + "" + formatNumbers(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); } @@ -288,9 +256,8 @@ public abstract class GT_MetaBase_Item extends GT_Generic_Item @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 @@ -315,37 +282,28 @@ public abstract class GT_MetaBase_Item extends GT_Generic_Item } @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 + if (tStats == null || tStats[2] > aTier || !(tStats[3] == -1 || tStats[3] == -3 || (tStats[3] < 0 && aCharge == Integer.MAX_VALUE)) - || aStack.stackSize != 1) return 0; + || 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; @@ -354,14 +312,8 @@ public abstract class GT_MetaBase_Item extends GT_Generic_Item if (!aSimulate) aStack.stackSize--; return tStats[3]; } - long tChargeBefore = getRealCharge(aStack), - tNewCharge = - Math.max( - 0, - tChargeBefore - - (aIgnoreTransferLimit - ? (long) aCharge - : Math.min(tStats[1], (long) aCharge))); + long tChargeBefore = getRealCharge(aStack), tNewCharge = Math + .max(0, tChargeBefore - (aIgnoreTransferLimit ? (long) aCharge : Math.min(tStats[1], (long) aCharge))); if (!aSimulate) setCharge(aStack, tNewCharge); return tChargeBefore - tNewCharge; } @@ -419,90 +371,41 @@ public abstract class GT_MetaBase_Item extends GT_Generic_Item } /* - - @Override - public final int getMaxCharge(ItemStack aStack) { - Long[] tStats = getElectricStats(aStack); - if (tStats == null) return 0; - return (int)Math.abs(tStats[0]); - } - - @Override - public final int getTransferLimit(ItemStack aStack) { - Long[] tStats = getElectricStats(aStack); - if (tStats == null) return 0; - return (int)Math.max(tStats[1], tStats[3]); - } - - @Override - public final int charge(ItemStack aStack, int 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; - long tChargeBefore = getRealCharge(aStack), tNewCharge = aCharge==Integer.MAX_VALUE?Long.MAX_VALUE:Math.min(Math.abs(tStats[0]), tChargeBefore + (aIgnoreTransferLimit?aCharge:Math.min(tStats[1], aCharge))); - if (!aSimulate) setCharge(aStack, tNewCharge); - return (int)(tNewCharge-tChargeBefore); - } - - @Override - public final int discharge(ItemStack aStack, int aCharge, int aTier, boolean aIgnoreTransferLimit, boolean aSimulate) { - Long[] tStats = getElectricStats(aStack); - if (tStats == null || tStats[2] > aTier) return 0; - if (tStats[3] > 0) { - if (aCharge < tStats[3] || aStack.stackSize < 1) return 0; - if (!aSimulate) aStack.stackSize--; - return (int)(long)tStats[3]; - } - long tChargeBefore = getRealCharge(aStack), tNewCharge = Math.max(0, tChargeBefore - (aIgnoreTransferLimit?aCharge:Math.min(tStats[1], aCharge))); - if (!aSimulate) setCharge(aStack, tNewCharge); - return (int)(tChargeBefore-tNewCharge); - } - - @Override - public final int getCharge(ItemStack aStack) { - return (int)Math.min(Integer.MAX_VALUE, getRealCharge(aStack)); - } - - @Override - public final boolean canUse(ItemStack aStack, int aAmount) { - return getRealCharge(aStack) >= aAmount; - } - - @Override - public final boolean use(ItemStack aStack, int aAmount, EntityLivingBase aPlayer) { - chargeFromArmor(aStack, aPlayer); - if (aPlayer instanceof EntityPlayer && ((EntityPlayer)aPlayer).capabilities.isCreativeMode) return true; - int tTransfer = discharge(aStack, aAmount, Integer.MAX_VALUE, true, true); - if (tTransfer == aAmount) { - discharge(aStack, aAmount, Integer.MAX_VALUE, true, false); - chargeFromArmor(aStack, aPlayer); - return true; - } - discharge(aStack, aAmount, Integer.MAX_VALUE, true, false); - chargeFromArmor(aStack, aPlayer); - return false; - } - - @Override - public final void chargeFromArmor(ItemStack aStack, EntityLivingBase aPlayer) { - if (aPlayer == null || aPlayer.worldObj.isRemote) return; - for (int i = 1; i < 5; i++) { - ItemStack tArmor = aPlayer.getEquipmentInSlot(i); - if (GT_ModHandler.isElectricItem(tArmor)) { - IElectricItem tArmorItem = (IElectricItem)tArmor.getItem(); - if (tArmorItem.canProvideEnergy(tArmor) && tArmorItem.getTier(tArmor) >= getTier(aStack)) { - int tCharge = ElectricItem.manager.discharge(tArmor, charge(aStack, Integer.MAX_VALUE-1, Integer.MAX_VALUE, true, true), Integer.MAX_VALUE, true, false); - if (tCharge > 0) { - charge(aStack, tCharge, Integer.MAX_VALUE, true, false); - if (aPlayer instanceof EntityPlayer) { - Container tContainer = ((EntityPlayer)aPlayer).openContainer; - if (tContainer != null) tContainer.detectAndSendChanges(); - } - } - } - } - } - } - */ + * @Override public final int getMaxCharge(ItemStack aStack) { Long[] tStats = getElectricStats(aStack); if (tStats + * == null) return 0; return (int)Math.abs(tStats[0]); } + * @Override public final int getTransferLimit(ItemStack aStack) { Long[] tStats = getElectricStats(aStack); if + * (tStats == null) return 0; return (int)Math.max(tStats[1], tStats[3]); } + * @Override public final int charge(ItemStack aStack, int 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; + * long tChargeBefore = getRealCharge(aStack), tNewCharge = + * aCharge==Integer.MAX_VALUE?Long.MAX_VALUE:Math.min(Math.abs(tStats[0]), tChargeBefore + + * (aIgnoreTransferLimit?aCharge:Math.min(tStats[1], aCharge))); if (!aSimulate) setCharge(aStack, tNewCharge); + * return (int)(tNewCharge-tChargeBefore); } + * @Override public final int discharge(ItemStack aStack, int aCharge, int aTier, boolean aIgnoreTransferLimit, + * boolean aSimulate) { Long[] tStats = getElectricStats(aStack); if (tStats == null || tStats[2] > aTier) return 0; + * if (tStats[3] > 0) { if (aCharge < tStats[3] || aStack.stackSize < 1) return 0; if (!aSimulate) + * aStack.stackSize--; return (int)(long)tStats[3]; } long tChargeBefore = getRealCharge(aStack), tNewCharge = + * Math.max(0, tChargeBefore - (aIgnoreTransferLimit?aCharge:Math.min(tStats[1], aCharge))); if (!aSimulate) + * setCharge(aStack, tNewCharge); return (int)(tChargeBefore-tNewCharge); } + * @Override public final int getCharge(ItemStack aStack) { return (int)Math.min(Integer.MAX_VALUE, + * getRealCharge(aStack)); } + * @Override public final boolean canUse(ItemStack aStack, int aAmount) { return getRealCharge(aStack) >= aAmount; } + * @Override public final boolean use(ItemStack aStack, int aAmount, EntityLivingBase aPlayer) { + * chargeFromArmor(aStack, aPlayer); if (aPlayer instanceof EntityPlayer && + * ((EntityPlayer)aPlayer).capabilities.isCreativeMode) return true; int tTransfer = discharge(aStack, aAmount, + * Integer.MAX_VALUE, true, true); if (tTransfer == aAmount) { discharge(aStack, aAmount, Integer.MAX_VALUE, true, + * false); chargeFromArmor(aStack, aPlayer); return true; } discharge(aStack, aAmount, Integer.MAX_VALUE, true, + * false); chargeFromArmor(aStack, aPlayer); return false; } + * @Override public final void chargeFromArmor(ItemStack aStack, EntityLivingBase aPlayer) { if (aPlayer == null || + * aPlayer.worldObj.isRemote) return; for (int i = 1; i < 5; i++) { ItemStack tArmor = + * aPlayer.getEquipmentInSlot(i); if (GT_ModHandler.isElectricItem(tArmor)) { IElectricItem tArmorItem = + * (IElectricItem)tArmor.getItem(); if (tArmorItem.canProvideEnergy(tArmor) && tArmorItem.getTier(tArmor) >= + * getTier(aStack)) { int tCharge = ElectricItem.manager.discharge(tArmor, charge(aStack, Integer.MAX_VALUE-1, + * Integer.MAX_VALUE, true, true), Integer.MAX_VALUE, true, false); if (tCharge > 0) { charge(aStack, tCharge, + * Integer.MAX_VALUE, true, false); if (aPlayer instanceof EntityPlayer) { Container tContainer = + * ((EntityPlayer)aPlayer).openContainer; if (tContainer != null) tContainer.detectAndSendChanges(); } } } } } } + */ public final long getRealCharge(ItemStack aStack) { Long[] tStats = getElectricStats(aStack); if (tStats == null) return 0; @@ -561,11 +464,8 @@ public abstract class GT_MetaBase_Item extends GT_Generic_Item } Long[] tStats = getFluidContainerStats(aStack); - if (tStats == null - || tStats[0] <= 0 - || aFluid == null - || aFluid.getFluid().getID() <= 0 - || aFluid.amount <= 0) return 0; + if (tStats == null || tStats[0] <= 0 || aFluid == null || aFluid.getFluid().getID() <= 0 || aFluid.amount <= 0) + return 0; FluidStack tFluid = getFluidContent(aStack); 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 bf472101de..ba1f4abda9 100644 --- a/src/main/java/gregtech/api/items/GT_MetaGenerated_Item.java +++ b/src/main/java/gregtech/api/items/GT_MetaGenerated_Item.java @@ -2,6 +2,24 @@ package gregtech.api.items; import static gregtech.api.enums.GT_Values.*; +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; +import net.minecraft.item.EnumAction; +import net.minecraft.item.Item; +import net.minecraft.item.ItemFood; +import net.minecraft.item.ItemStack; +import net.minecraft.util.IIcon; +import net.minecraft.world.World; + +import squeek.applecore.api.food.FoodValues; +import squeek.applecore.api.food.IEdible; import cpw.mods.fml.common.Loader; import cpw.mods.fml.common.Optional; import cpw.mods.fml.relauncher.Side; @@ -21,45 +39,32 @@ 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; -import net.minecraft.item.EnumAction; -import net.minecraft.item.Item; -import net.minecraft.item.ItemFood; -import net.minecraft.item.ItemStack; -import net.minecraft.util.IIcon; -import net.minecraft.world.World; -import squeek.applecore.api.food.FoodValues; -import squeek.applecore.api.food.IEdible; /** * @author Gregorius Techneticies * <p/> * One Item for everything! * <p/> - * This brilliant Item Class is used for automatically generating all possible variations of Material Items, like Dusts, Ingots, Gems, Plates and similar. - * It saves me a ton of work, when adding Items, because I always have to make a new Item SubType for each OreDict Prefix, when adding a new Material. + * This brilliant Item Class is used for automatically generating all possible variations of Material Items, + * like Dusts, Ingots, Gems, Plates and similar. It saves me a ton of work, when adding Items, because I always + * have to make a new Item SubType for each OreDict Prefix, when adding a new Material. * <p/> - * As you can see, up to 32766 Items can be generated using this Class. And the last 766 Items can be custom defined, just to save space and MetaData. + * As you can see, up to 32766 Items can be generated using this Class. And the last 766 Items can be custom + * defined, just to save space and MetaData. * <p/> - * These Items can also have special RightClick abilities, electric Charge or even be set to become a Food alike Item. + * These Items can also have special RightClick abilities, electric Charge or even be set to become a Food alike + * Item. */ @Optional.Interface(iface = "squeek.applecore.api.food.IEdible", modid = MOD_ID_APC) public abstract class GT_MetaGenerated_Item extends GT_MetaBase_Item implements IEdible { + /** - * 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. + * 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_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 ---------- */ @@ -96,10 +101,10 @@ public abstract class GT_MetaGenerated_Item extends GT_MetaBase_Item implements /** * This adds a Custom Item to the ending Range. * - * @param aID The Id of the assigned Item [0 - mItemAmount] (The MetaData gets auto-shifted by +mOffset) - * @param aEnglish The Default Localized Name of the created Item - * @param aToolTip The Default ToolTip of the created Item, you can also insert null for having no ToolTip - * @param aRandomData The OreDict Names you want to give the Item. Also used for TC Aspects and some other things. + * @param aID The Id of the assigned Item [0 - mItemAmount] (The MetaData gets auto-shifted by +mOffset) + * @param aEnglish The Default Localized Name of the created Item + * @param aToolTip The Default ToolTip of the created Item, you can also insert null for having no ToolTip + * @param aRandomData The OreDict Names you want to give the Item. Also used for TC Aspects and some other things. * @return An ItemStack containing the newly created Item. */ public final ItemStack addItem(int aID, String aEnglish, String aToolTip, Object... aRandomData) { @@ -112,64 +117,60 @@ public abstract class GT_MetaGenerated_Item extends GT_MetaBase_Item implements GT_LanguageManager.addStringLocalization(getUnlocalizedName(rStack) + ".tooltip", aToolTip); List<TC_AspectStack> tAspects = new ArrayList<TC_AspectStack>(); // Important Stuff to do first - for (Object tRandomData : aRandomData) - if (tRandomData instanceof SubTag) { - if (tRandomData == SubTag.INVISIBLE) { - mVisibleItems.set(aID, false); - continue; - } - if (tRandomData == SubTag.NO_UNIFICATION) { - GT_OreDictUnificator.addToBlacklist(rStack); - continue; - } + for (Object tRandomData : aRandomData) if (tRandomData instanceof SubTag) { + if (tRandomData == SubTag.INVISIBLE) { + mVisibleItems.set(aID, false); + continue; + } + if (tRandomData == SubTag.NO_UNIFICATION) { + GT_OreDictUnificator.addToBlacklist(rStack); + continue; } + } // now check for the rest - for (Object tRandomData : aRandomData) - if (tRandomData != null) { - boolean tUseOreDict = true; - if (tRandomData instanceof IFoodStat) { - setFoodBehavior(mOffset + aID, (IFoodStat) tRandomData); - 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); - } - tUseOreDict = false; - } - if (tRandomData instanceof IItemBehaviour) { - addItemBehavior(mOffset + aID, (IItemBehaviour<GT_MetaBase_Item>) tRandomData); - tUseOreDict = false; - } - if (tRandomData instanceof IItemContainer) { - ((IItemContainer) tRandomData).set(rStack); - tUseOreDict = false; - } - if (tRandomData instanceof SubTag) { - continue; - } - if (tRandomData instanceof TC_AspectStack) { - ((TC_AspectStack) tRandomData).addToAspectList(tAspects); - continue; - } - if (tRandomData instanceof ItemData) { - if (GT_Utility.isStringValid(tRandomData)) - GT_OreDictUnificator.registerOre(tRandomData, rStack); - else GT_OreDictUnificator.addItemData(rStack, (ItemData) tRandomData); - continue; - } - if (tUseOreDict) { - GT_OreDictUnificator.registerOre(tRandomData, rStack); - continue; + for (Object tRandomData : aRandomData) if (tRandomData != null) { + boolean tUseOreDict = true; + if (tRandomData instanceof IFoodStat) { + setFoodBehavior(mOffset + aID, (IFoodStat) tRandomData); + 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); } + tUseOreDict = false; + } + if (tRandomData instanceof IItemBehaviour) { + addItemBehavior(mOffset + aID, (IItemBehaviour<GT_MetaBase_Item>) tRandomData); + tUseOreDict = false; } + if (tRandomData instanceof IItemContainer) { + ((IItemContainer) tRandomData).set(rStack); + tUseOreDict = false; + } + if (tRandomData instanceof SubTag) { + continue; + } + if (tRandomData instanceof TC_AspectStack) { + ((TC_AspectStack) tRandomData).addToAspectList(tAspects); + continue; + } + if (tRandomData instanceof ItemData) { + if (GT_Utility.isStringValid(tRandomData)) GT_OreDictUnificator.registerOre(tRandomData, rStack); + else GT_OreDictUnificator.addItemData(rStack, (ItemData) tRandomData); + continue; + } + if (tUseOreDict) { + GT_OreDictUnificator.registerOre(tRandomData, rStack); + continue; + } + } if (GregTech_API.sThaumcraftCompat != null) GregTech_API.sThaumcraftCompat.registerThaumcraftAspectsToItem(rStack, tAspects, false); return rStack; @@ -210,43 +211,37 @@ public abstract class GT_MetaGenerated_Item extends GT_MetaBase_Item implements * @param aMaxCharge Maximum Charge. (if this is == 0 it will remove the Electric Behavior) * @param aTransferLimit Transfer Limit. * @param aTier The electric Tier. - * @param aSpecialData If this Item has a Fixed Charge, like a SingleUse Battery (if > 0). - * Use -1 if you want to make this Battery chargeable (the use and canUse Functions will still discharge if you just use this) - * Use -2 if you want to make this Battery dischargeable. - * Use -3 if you want to make this Battery charge/discharge-able. + * @param aSpecialData If this Item has a Fixed Charge, like a SingleUse Battery (if > 0). Use -1 if you want to + * make this Battery chargeable (the use and canUse Functions will still discharge if you just + * use this) Use -2 if you want to make this Battery dischargeable. 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}); - if (aMetaValue >= mOffset && aUseAnimations) - mIconList[aMetaValue - mOffset] = Arrays.copyOf( - mIconList[aMetaValue - mOffset], Math.max(9, mIconList[aMetaValue - mOffset].length)); + 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)); } return this; } /** * - * @param aMetaValue the Meta Value of the Item you want to set it to. [0 - 32765] - * @param aCapacity fluid capacity in L or mb - * @param aStacksize item stack size + * @param aMetaValue the Meta Value of the Item you want to set it to. [0 - 32765] + * @param aCapacity fluid capacity in L or mb + * @param aStacksize item stack size * @return the Item itself for convenience in constructing. */ 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; } @@ -304,15 +299,18 @@ 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); } @@ -323,8 +321,7 @@ 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 + return tStat == null ? null : new FoodValues(tStat.getFoodLevel(this, aStack, null), tStat.getSaturation(this, aStack, null)); } @@ -332,36 +329,34 @@ public abstract class GT_MetaGenerated_Item extends GT_MetaBase_Item implements @SideOnly(Side.CLIENT) public void getSubItems(Item aItem, CreativeTabs aCreativeTab, List aList) { int j = mEnabledItems.length(); - for (int i = 0; i < j; i++) - if (mVisibleItems.get(i) || (D1 && mEnabledItems.get(i))) { - Long[] tStats = mElectricStats.get((short) (mOffset + i)); - if (tStats != null && tStats[3] < 0) { - ItemStack tStack = new ItemStack(this, 1, mOffset + i); - setCharge(tStack, Math.abs(tStats[0])); - isItemStackUsable(tStack); - aList.add(tStack); - } - if (tStats == null || tStats[3] != -2) { - ItemStack tStack = new ItemStack(this, 1, mOffset + i); - isItemStackUsable(tStack); - aList.add(tStack); - } + for (int i = 0; i < j; i++) if (mVisibleItems.get(i) || (D1 && mEnabledItems.get(i))) { + Long[] tStats = mElectricStats.get((short) (mOffset + i)); + if (tStats != null && tStats[3] < 0) { + ItemStack tStack = new ItemStack(this, 1, mOffset + i); + setCharge(tStack, Math.abs(tStats[0])); + isItemStackUsable(tStack); + aList.add(tStack); + } + if (tStats == null || tStats[3] != -2) { + ItemStack tStack = new ItemStack(this, 1, mOffset + i); + isItemStackUsable(tStack); + aList.add(tStack); } + } } @Override @SideOnly(Side.CLIENT) public final void registerIcons(IIconRegister aIconRegister) { short j = (short) mEnabledItems.length(); - 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][0] = aIconRegister.registerIcon( - RES_PATH_ITEM + (GT_Config.troll ? "troll" : getUnlocalizedName() + "/" + i)); + 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][0] = aIconRegister + .registerIcon(RES_PATH_ITEM + (GT_Config.troll ? "troll" : getUnlocalizedName() + "/" + i)); + } } @Override 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 62aae22e24..f33d7a4f2e 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 @@ -2,6 +2,13 @@ package gregtech.api.items; import static gregtech.api.enums.GT_Values.M; +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 cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; import gregtech.api.GregTech_API; @@ -11,23 +18,21 @@ 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; /** * @author Gregorius Techneticies * <p/> * One Item for everything! * <p/> - * This brilliant Item Class is used for automatically generating all possible variations of Material Items, like Dusts, Ingots, Gems, Plates and similar. - * It saves me a ton of work, when adding Items, because I always have to make a new Item SubType for each OreDict Prefix, when adding a new Material. + * This brilliant Item Class is used for automatically generating all possible variations of Material Items, + * like Dusts, Ingots, Gems, Plates and similar. It saves me a ton of work, when adding Items, because I always + * have to make a new Item SubType for each OreDict Prefix, when adding a new Material. * <p/> - * As you can see, up to 32766 Items can be generated using this Class. And the last 766 Items can be custom defined, just to save space and MetaData. + * As you can see, up to 32766 Items can be generated using this Class. And the last 766 Items can be custom + * defined, just to save space and MetaData. * <p/> - * These Items can also have special RightClick abilities, electric Charge or even be set to become a Food alike Item. + * These Items can also have special RightClick abilities, electric Charge or even be set to become a Food alike + * Item. */ public abstract class GT_MetaGenerated_Item_X01 extends GT_MetaGenerated_Item { @@ -39,13 +44,13 @@ public abstract class GT_MetaGenerated_Item_X01 extends GT_MetaGenerated_Item { * * @param aUnlocalized The Unlocalized Name of this Item. * @param aGeneratedPrefix The OreDict Prefix you want to have generated. - * @param aIconSetIndex The TextureSet Index to be used. -1 for Defaulting to the Data contained in the Prefix. (this is only to be used for selecting the Icon in getIconContainer, nothing else) + * @param aIconSetIndex The TextureSet Index to be used. -1 for Defaulting to the Data contained in the Prefix. + * (this is only to be used for selecting the Icon in getIconContainer, nothing else) */ public GT_MetaGenerated_Item_X01(String aUnlocalized, OrePrefixes aGeneratedPrefix, int aIconSetIndex) { super(aUnlocalized, (short) 32000, (short) 766); mPrefix = aGeneratedPrefix; - mIconSetIndex = aIconSetIndex >= 0 - ? aIconSetIndex + mIconSetIndex = aIconSetIndex >= 0 ? aIconSetIndex : aGeneratedPrefix.mTextureIndex >= 0 ? aGeneratedPrefix.mTextureIndex : 0; for (int i = 0; i < GregTech_API.sGeneratedMaterials.length; i++) { @@ -57,11 +62,11 @@ public abstract class GT_MetaGenerated_Item_X01 extends GT_MetaGenerated_Item { ItemStack tStack = new ItemStack(this, 1, i); GT_LanguageManager.addStringLocalization( getUnlocalizedName(tStack) + ".name", - GT_LanguageManager.i18nPlaceholder - ? getDefaultLocalizationFormat(tPrefix, tMaterial, i) + GT_LanguageManager.i18nPlaceholder ? getDefaultLocalizationFormat(tPrefix, tMaterial, i) : getDefaultLocalization(tPrefix, tMaterial, i)); GT_LanguageManager.addStringLocalization( - getUnlocalizedName(tStack) + ".tooltip", tMaterial.getToolTip(tPrefix.mMaterialAmount / M)); + getUnlocalizedName(tStack) + ".tooltip", + tMaterial.getToolTip(tPrefix.mMaterialAmount / M)); String tOreName = getOreDictString(tPrefix, tMaterial); tPrefix = OrePrefixes.getOrePrefix(tOreName); if (tPrefix != null && tPrefix.mIsUnificatable) { @@ -98,7 +103,8 @@ public abstract class GT_MetaGenerated_Item_X01 extends GT_MetaGenerated_Item { /** * @param aPrefix always != null * @param aMaterial always != null - * @param aDoShowAllItems this is the Configuration Setting of the User, if he wants to see all the Stuff like Tiny Dusts or Crushed Ores as well. + * @param aDoShowAllItems this is the Configuration Setting of the User, if he wants to see all the Stuff like Tiny + * Dusts or Crushed Ores as well. * @return if this Item should be visible in NEI or Creative */ public boolean doesShowInCreative(OrePrefixes aPrefix, Materials aMaterial, boolean aDoShowAllItems) { @@ -142,30 +148,31 @@ public abstract class GT_MetaGenerated_Item_X01 extends GT_MetaGenerated_Item { 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; + && 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; + && 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)) { - ItemStack tStack = new ItemStack(this, 1, i); - isItemStackUsable(tStack); - aList.add(tStack); - } + 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); + } super.getSubItems(aItem, aCreativeTab, aList); } @@ -179,15 +186,13 @@ 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] + 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) + return getDamage(aStack) < mOffset ? Math.min(super.getItemStackLimit(aStack), mPrefix.mDefaultStackSize) : super.getItemStackLimit(aStack); } 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 c0f7b6b3c9..a3c5814dbf 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 @@ -2,6 +2,14 @@ package gregtech.api.items; import static gregtech.api.enums.GT_Values.M; +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 cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; import gregtech.api.GregTech_API; @@ -13,24 +21,21 @@ 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; /** * @author Gregorius Techneticies * <p/> * One Item for everything! * <p/> - * This brilliant Item Class is used for automatically generating all possible variations of Material Items, like Dusts, Ingots, Gems, Plates and similar. - * It saves me a ton of work, when adding Items, because I always have to make a new Item SubType for each OreDict Prefix, when adding a new Material. + * This brilliant Item Class is used for automatically generating all possible variations of Material Items, + * like Dusts, Ingots, Gems, Plates and similar. It saves me a ton of work, when adding Items, because I always + * have to make a new Item SubType for each OreDict Prefix, when adding a new Material. * <p/> - * As you can see, up to 32766 Items can be generated using this Class. And the last 766 Items can be custom defined, just to save space and MetaData. + * As you can see, up to 32766 Items can be generated using this Class. And the last 766 Items can be custom + * defined, just to save space and MetaData. * <p/> - * These Items can also have special RightClick abilities, electric Charge or even be set to become a Food alike Item. + * These Items can also have special RightClick abilities, electric Charge or even be set to become a Food alike + * Item. */ public abstract class GT_MetaGenerated_Item_X32 extends GT_MetaGenerated_Item { @@ -55,19 +60,18 @@ public abstract class GT_MetaGenerated_Item_X32 extends GT_MetaGenerated_Item { ItemStack tStack = new ItemStack(this, 1, i); GT_LanguageManager.addStringLocalization( getUnlocalizedName(tStack) + ".name", - GT_LanguageManager.i18nPlaceholder - ? getDefaultLocalizationFormat(tPrefix, tMaterial, i) + GT_LanguageManager.i18nPlaceholder ? getDefaultLocalizationFormat(tPrefix, tMaterial, i) : getDefaultLocalization(tPrefix, tMaterial, i)); GT_LanguageManager.addStringLocalization( - getUnlocalizedName(tStack) + ".tooltip", tMaterial.getToolTip(tPrefix.mMaterialAmount / M)); + 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.Lead || tMaterial == Materials.Tin || tMaterial == Materials.SolderingAlloy)) { GregTech_API.sSolderingMetalList.add(tStack); GT_ModHandler.registerBoxableItemToToolBox(tStack); @@ -128,15 +132,16 @@ public abstract class GT_MetaGenerated_Item_X32 extends GT_MetaGenerated_Item { */ 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; + && mGeneratedPrefixList[aMetaData / 1000].mTextureIndex >= 0 + ? aMaterial.mIconSet.mTextures[mGeneratedPrefixList[aMetaData / 1000].mTextureIndex] + : null; } /** * @param aPrefix always != null * @param aMaterial always != null - * @param aDoShowAllItems this is the Configuration Setting of the User, if he wants to see all the Stuff like Tiny Dusts or Crushed Ores as well. + * @param aDoShowAllItems this is the Configuration Setting of the User, if he wants to see all the Stuff like Tiny + * Dusts or Crushed Ores as well. * @return if this Item should be visible in NEI or Creative */ public boolean doesShowInCreative(OrePrefixes aPrefix, Materials aMaterial, boolean aDoShowAllItems) { @@ -168,15 +173,13 @@ 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 + 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 + return GregTech_API.sGeneratedMaterials[aMetaData % 1000] == null ? null : GregTech_API.sGeneratedMaterials[aMetaData % 1000].renderer; } 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 ec28d04eb9..7ee4b23628 100644 --- a/src/main/java/gregtech/api/items/GT_MetaGenerated_Tool.java +++ b/src/main/java/gregtech/api/items/GT_MetaGenerated_Tool.java @@ -3,32 +3,15 @@ package gregtech.api.items; import static gregtech.api.util.GT_Utility.formatNumbers; 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; -import cpw.mods.fml.relauncher.Side; -import cpw.mods.fml.relauncher.SideOnly; -import crazypants.enderio.api.tool.ITool; -import forestry.api.arboriculture.IToolGrafter; -import gregtech.GT_Mod; -import gregtech.api.GregTech_API; -import gregtech.api.enchants.Enchantment_Radioactivity; -import gregtech.api.enums.Materials; -import gregtech.api.enums.TC_Aspects.TC_AspectStack; -import gregtech.api.interfaces.IDamagableItem; -import gregtech.api.interfaces.IToolStats; -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 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 mrtjp.projectred.api.IScrewdriver; + import net.minecraft.block.Block; import net.minecraft.client.renderer.texture.IIconRegister; import net.minecraft.creativetab.CreativeTabs; @@ -55,28 +38,50 @@ import net.minecraftforge.common.IShearable; import net.minecraftforge.event.entity.player.PlayerEvent; import net.minecraftforge.event.world.BlockEvent; +import buildcraft.api.tools.IToolWrench; +import cpw.mods.fml.common.Mod; +import cpw.mods.fml.common.Optional; +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; +import crazypants.enderio.api.tool.ITool; +import forestry.api.arboriculture.IToolGrafter; +import gregtech.GT_Mod; +import gregtech.api.GregTech_API; +import gregtech.api.enchants.Enchantment_Radioactivity; +import gregtech.api.enums.Materials; +import gregtech.api.enums.TC_Aspects.TC_AspectStack; +import gregtech.api.interfaces.IDamagableItem; +import gregtech.api.interfaces.IToolStats; +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 gregtech.common.tools.GT_Tool_Turbine; + /** * 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); + * 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 = "ForestryAPI|arboriculture"), - @Optional.Interface(iface = "mods.railcraft.api.core.items.IToolCrowbar", modid = "RailcraftAPI|items"), - @Optional.Interface(iface = "buildcraft.api.tools.IToolWrench", modid = "BuildCraftAPI|tools"), - @Optional.Interface(iface = "crazypants.enderio.api.tool.ITool", modid = "EnderIOAPI|Tools"), - @Optional.Interface(iface = "mrtjp.projectred.api.IScrewdriver", modid = "ProjRed|Core"), - }) + @Optional.Interface( + iface = "forestry.api.arboriculture.IToolGrafter", + modid = "ForestryAPI|arboriculture"), + @Optional.Interface(iface = "mods.railcraft.api.core.items.IToolCrowbar", modid = "RailcraftAPI|items"), + @Optional.Interface(iface = "buildcraft.api.tools.IToolWrench", modid = "BuildCraftAPI|tools"), + @Optional.Interface(iface = "crazypants.enderio.api.tool.ITool", modid = "EnderIOAPI|Tools"), + @Optional.Interface(iface = "mrtjp.projectred.api.IScrewdriver", modid = "ProjRed|Core"), }) public abstract class GT_MetaGenerated_Tool extends GT_MetaBase_Item implements IDamagableItem, IToolGrafter, IToolCrowbar, IToolWrench, ITool, IScrewdriver { + /** - * 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. + * 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 ---------- */ @@ -149,23 +154,27 @@ public abstract class GT_MetaGenerated_Tool extends GT_MetaBase_Item /** * This adds a Custom Item to the ending Range. * - * @param aID The Id of the assigned Tool Class [0 - 32765] (only even Numbers allowed! Uneven ID's are empty electric Items) + * @param aID The Id of the assigned Tool Class [0 - 32765] (only even Numbers allowed! Uneven + * ID's are empty electric Items) * @param aEnglish The Default Localized Name of the created Item - * @param aToolTip The Default ToolTip of the created Item, you can also insert null for having no ToolTip + * @param aToolTip The Default ToolTip of the created Item, you can also insert null for having no + * ToolTip * @param aToolStats The Food Value of this Item. Can be null as well. - * @param aOreDictNamesAndAspects The OreDict Names you want to give the Item. Also used to assign Thaumcraft Aspects. + * @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) + ".name", aEnglish + " (Empty)"); - GT_LanguageManager.addStringLocalization( - getUnlocalizedName() + "." + (aID + 1) + ".tooltip", "You need to recharge it"); + getUnlocalizedName() + "." + (aID + 1) + ".tooltip", + "You need to recharge it"); mToolStats.put((short) aID, aToolStats); mToolStats.put((short) (aID + 1), aToolStats); aToolStats.onStatsAddedToTool(this, aID); @@ -193,8 +202,8 @@ public abstract class GT_MetaGenerated_Tool extends GT_MetaBase_Item * @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) { @@ -226,51 +235,31 @@ public abstract class GT_MetaGenerated_Tool extends GT_MetaBase_Item * 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, + 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()); + 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()); } @Mod.EventHandler - public float onBlockBreakSpeedEvent( - float aDefault, - ItemStack aStack, - EntityPlayer aPlayer, - Block aBlock, - int aX, - int aY, - int aZ, - byte aMetaData, - PlayerEvent.BreakSpeed aEvent) { + 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 + return tStats == null ? aDefault : tStats.getMiningSpeed(aBlock, aMetaData, aDefault, aPlayer, aPlayer.worldObj, aX, aY, aZ); } @@ -315,27 +304,23 @@ public abstract class GT_MetaGenerated_Tool extends GT_MetaBase_Item GT_Utility.doSoundAtClient(tStats.getEntityHitSound(), 1, 1.0F); if (super.onLeftClickEntity(aStack, aPlayer, aEntity)) return true; if (aEntity.canAttackWithItem() && !aEntity.hitByEntity(aPlayer)) { - float - tMagicDamage = - tStats.getMagicDamageAgainstEntity( - aEntity instanceof EntityLivingBase - ? EnchantmentHelper.getEnchantmentModifierLiving( - aPlayer, (EntityLivingBase) aEntity) - : 0.0F, - aEntity, - aStack, - aPlayer), - 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 + boolean tCriticalHit = aPlayer.fallDistance > 0.0F && !aPlayer.onGround && !aPlayer.isOnLadder() && !aPlayer.isInWater() && !aPlayer.isPotionActive(Potion.blindness) @@ -346,10 +331,9 @@ public abstract class GT_MetaGenerated_Tool extends GT_MetaBase_Item 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, @@ -368,8 +352,8 @@ public abstract class GT_MetaGenerated_Tool extends GT_MetaBase_Item EnchantmentHelper.func_151385_b(aPlayer, aEntity); if (aEntity instanceof EntityLivingBase) aPlayer.addStat(StatList.damageDealtStat, Math.round(tDamage * 10.0F)); - aEntity.hurtResistantTime = - Math.max(1, tStats.getHurtResistanceTime(aEntity.hurtResistantTime, aEntity)); + aEntity.hurtResistantTime = Math + .max(1, tStats.getHurtResistanceTime(aEntity.hurtResistantTime, aEntity)); aPlayer.addExhaustion(0.3F); doDamage(aStack, tStats.getToolDamagePerEntityAttack()); } @@ -437,68 +421,63 @@ public abstract class GT_MetaGenerated_Tool extends GT_MetaBase_Item // 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)); + 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 - + formatNumbers(tMaxDamage - getToolDamage(aStack)) + " ", - " " + formatNumbers(tMaxDamage)) - + EnumChatFormatting.GRAY); + EnumChatFormatting.GRAY + String.format( + transItem("001", "Durability: %s/%s"), + "" + EnumChatFormatting.GREEN + formatNumbers(tMaxDamage - getToolDamage(aStack)) + " ", + " " + formatNumbers(tMaxDamage)) + EnumChatFormatting.GRAY); aList.add( tOffset + 1, - EnumChatFormatting.GRAY - + String.format( - transItem("002", "%s lvl %s"), - tMaterial.mLocalizedName + EnumChatFormatting.YELLOW, - "" + getHarvestLevel(aStack, "")) - + EnumChatFormatting.GRAY); + EnumChatFormatting.GRAY + String.format( + transItem("002", "%s lvl %s"), + tMaterial.mLocalizedName + EnumChatFormatting.YELLOW, + "" + getHarvestLevel(aStack, "")) + EnumChatFormatting.GRAY); aList.add( tOffset + 2, EnumChatFormatting.WHITE + String.format( transItem("005", "Turbine Efficiency: %s"), "" + EnumChatFormatting.BLUE + (50.0F + (10.0F * getToolCombatDamage(aStack)))) - + "%" + EnumChatFormatting.GRAY); + + "%" + + EnumChatFormatting.GRAY); aList.add( tOffset + 3, - EnumChatFormatting.WHITE - + String.format( - transItem("006", "Optimal Steam flow: %s L/t"), - "" + EnumChatFormatting.GOLD - + formatNumbers(GT_Utility.safeInt((long) (Math.max( - Float.MIN_NORMAL, - tStats.getSpeedMultiplier() - * getPrimaryMaterial(aStack).mToolSpeed - * (1000 - * getPrimaryMaterial(aStack).mSteamMultiplier - / 20))))) - + EnumChatFormatting.GRAY)); + EnumChatFormatting.WHITE + String.format( + transItem("006", "Optimal Steam flow: %s L/t"), + "" + EnumChatFormatting.GOLD + + formatNumbers( + 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 - + formatNumbers(GT_Utility.safeInt((long) (Math.max( + EnumChatFormatting.WHITE + String.format( + transItem("900", "Energy from Optimal Steam Flow: %s EU/t"), + "" + EnumChatFormatting.GOLD + + formatNumbers( + 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)); + * (1000 * getPrimaryMaterial( + aStack).mSteamMultiplier / 20)) + * (50.0F + (10.0F * getToolCombatDamage(aStack))) + / 200))) + + EnumChatFormatting.GRAY)); { long[] calculatedFlow = calculateLooseFlow(aOptFlow, aBaseEff); int aOptFlowLoose = (int) calculatedFlow[0]; @@ -506,65 +485,65 @@ public abstract class GT_MetaGenerated_Tool extends GT_MetaBase_Item aList.add( tOffset + 5, - EnumChatFormatting.AQUA - + String.format( - transItem("500", "Turbine Efficiency (Loose): %s"), - "" + EnumChatFormatting.BLUE + aBaseEffLoose / 100 + "%" - + EnumChatFormatting.GRAY)); + 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 - + formatNumbers((aOptFlowLoose - * getPrimaryMaterial(aStack).mSteamMultiplier)) - + EnumChatFormatting.GRAY)); + EnumChatFormatting.AQUA + String.format( + transItem("501", "Optimal Steam flow (Loose): %s L/t"), + "" + EnumChatFormatting.GOLD + + formatNumbers( + (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 - + formatNumbers((aOptFlowLoose - * getPrimaryMaterial(aStack).mSteamMultiplier - / 10000) - * (aBaseEffLoose / 2)) - + EnumChatFormatting.GRAY)); + EnumChatFormatting.AQUA + String.format( + transItem("901", "Energy from Optimal Steam Flow (Loose): %s EU/t"), + "" + EnumChatFormatting.GOLD + + formatNumbers( + (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 - + formatNumbers(GT_Utility.safeInt((long) (Math.max( + EnumChatFormatting.LIGHT_PURPLE + String.format( + transItem("007", "Energy from Optimal Gas Flow: %s EU/t"), + "" + EnumChatFormatting.GOLD + + formatNumbers( + 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)); + * (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 - + formatNumbers(GT_Utility.safeInt((long) (Math.max( + EnumChatFormatting.LIGHT_PURPLE + String.format( + transItem("008", "Energy from Optimal Plasma Flow: %s EU/t"), + "" + EnumChatFormatting.GOLD + + formatNumbers( + 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)); + * (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)"); @@ -579,29 +558,23 @@ public abstract class GT_MetaGenerated_Tool extends GT_MetaBase_Item } aList.add( tOffset + 11, - EnumChatFormatting.LIGHT_PURPLE - + String.format( - transItem("502", "Overflow Efficiency Tier: %s"), - "" + EnumChatFormatting.GOLD + overflowMultiplier + EnumChatFormatting.GRAY)); + EnumChatFormatting.LIGHT_PURPLE + String.format( + transItem("502", "Overflow Efficiency Tier: %s"), + "" + EnumChatFormatting.GOLD + overflowMultiplier + EnumChatFormatting.GRAY)); } else { aList.add( tOffset, - EnumChatFormatting.WHITE - + String.format( - transItem("001", "Durability: %s/%s"), - "" + EnumChatFormatting.GREEN - + formatNumbers(tMaxDamage - getToolDamage(aStack)) + " ", - " " + formatNumbers(tMaxDamage)) - + EnumChatFormatting.GRAY); + EnumChatFormatting.WHITE + String.format( + transItem("001", "Durability: %s/%s"), + "" + EnumChatFormatting.GREEN + formatNumbers(tMaxDamage - getToolDamage(aStack)) + " ", + " " + formatNumbers(tMaxDamage)) + EnumChatFormatting.GRAY); aList.add( tOffset + 1, - EnumChatFormatting.WHITE - + String.format( - transItem("002", "%s lvl %s"), - tMaterial.mLocalizedName + EnumChatFormatting.YELLOW, - "" + getHarvestLevel(aStack, "")) - + EnumChatFormatting.GRAY); + EnumChatFormatting.WHITE + String.format( + transItem("002", "%s lvl %s"), + tMaterial.mLocalizedName + EnumChatFormatting.YELLOW, + "" + getHarvestLevel(aStack, "")) + EnumChatFormatting.GRAY); aList.add( tOffset + 2, EnumChatFormatting.WHITE @@ -638,7 +611,9 @@ public abstract class GT_MetaGenerated_Tool extends GT_MetaBase_Item aList.add( tOffset + 3, - EnumChatFormatting.RED + "Heat: " + aNBT.getInteger("Heat") + " K" + EnumChatFormatting.RED + "Heat: " + + aNBT.getInteger("Heat") + + " K" + EnumChatFormatting.GRAY); } } @@ -656,13 +631,8 @@ public abstract class GT_MetaGenerated_Tool extends GT_MetaBase_Item NBTTagCompound aNBT = aStack.getTagCompound(); 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") - }; + if (aNBT != null && aNBT.getBoolean("Electric")) return new Long[] { aNBT.getLong("MaxCharge"), + aNBT.getLong("Voltage"), aNBT.getLong("Tier"), aNBT.getLong("SpecialData") }; } return null; } @@ -732,14 +702,15 @@ public abstract class GT_MetaGenerated_Tool extends GT_MetaBase_Item } @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; } @@ -780,8 +751,7 @@ public abstract class GT_MetaGenerated_Tool extends GT_MetaBase_Item @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) + return tStats != null && tStats.isGrafter() ? Math.min(100.0F, (1 + getHarvestLevel(aStack, "")) * 20.0F) : 0.0F; } @@ -920,43 +890,40 @@ public abstract class GT_MetaGenerated_Tool extends GT_MetaBase_Item } Enchantment[] tEnchants = tStats.getEnchantments(aStack); int[] tLevels = tStats.getEnchantmentLevels(aStack); - 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])); - } + 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])); + } for (Entry<Integer, Integer> tEntry : tMap.entrySet()) { - if (tEntry.getKey() == 33 - || (tEntry.getKey() == 20 && tEntry.getValue() > 2) + 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) { - case weapon: - if (tStats.isWeapon()) tResult.put(tEntry.getKey(), tEntry.getValue()); - break; - case all: - tResult.put(tEntry.getKey(), tEntry.getValue()); - break; - case armor: - case armor_feet: - case armor_head: - case armor_legs: - case armor_torso: - break; - case bow: - if (tStats.isRangedWeapon()) tResult.put(tEntry.getKey(), tEntry.getValue()); - break; - case breakable: - break; - case fishing_rod: - break; - case digger: - if (tStats.isMiningTool()) tResult.put(tEntry.getKey(), tEntry.getValue()); - break; - } + else switch (Enchantment.enchantmentsList[tEntry.getKey()].type) { + case weapon: + if (tStats.isWeapon()) tResult.put(tEntry.getKey(), tEntry.getValue()); + break; + case all: + tResult.put(tEntry.getKey(), tEntry.getValue()); + break; + case armor: + case armor_feet: + case armor_head: + case armor_legs: + case armor_torso: + break; + case bow: + if (tStats.isRangedWeapon()) tResult.put(tEntry.getKey(), tEntry.getValue()); + break; + case breakable: + break; + case fishing_rod: + break; + case digger: + if (tStats.isMiningTool()) tResult.put(tEntry.getKey(), tEntry.getValue()); + break; + } } EnchantmentHelper.setEnchantments(tResult, aStack); return true; 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 95c584fd6a..3abfad3347 100644 --- a/src/main/java/gregtech/api/items/GT_RadioactiveCellIC_Item.java +++ b/src/main/java/gregtech/api/items/GT_RadioactiveCellIC_Item.java @@ -1,18 +1,21 @@ package gregtech.api.items; +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 gregtech.api.GregTech_API; import gregtech.api.enums.GT_Values; import gregtech.api.util.GT_Utility; import ic2.api.reactor.IReactor; import ic2.api.reactor.IReactorComponent; import ic2.core.IC2Potion; -import java.util.ArrayList; -import net.minecraft.entity.Entity; -import net.minecraft.entity.EntityLivingBase; -import net.minecraft.item.ItemStack; -import net.minecraft.world.World; public class GT_RadioactiveCellIC_Item extends GT_RadioactiveCell_Item implements IReactorComponent { + private static final int MYSTERIOUS_MULTIPLIER_HEAT = 4; public final int numberOfCells; public final float sEnergy; @@ -21,16 +24,8 @@ 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; @@ -43,14 +38,18 @@ public class GT_RadioactiveCellIC_Item extends GT_RadioactiveCell_Item implement if (aDepleted != null && aEnergy > 0 && aHeat > 0) { // avoid adding depleted cells to recipe map GT_Values.RA.addIC2ReactorFuelCell( - new ItemStack(this), aDepleted, aMox, aHeat * MYSTERIOUS_MULTIPLIER_HEAT, aEnergy, aCellcount); + new ItemStack(this), + aDepleted, + aMox, + aHeat * MYSTERIOUS_MULTIPLIER_HEAT, + aEnergy, + aCellcount); } } 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)) + if ((other != null) && ((other.getItem() instanceof IReactorComponent)) && (((IReactorComponent) other.getItem()) .acceptUraniumPulse(reactor, other, me, x, y, mex, mey, heatrun))) { return 1; @@ -79,7 +78,7 @@ public class GT_RadioactiveCellIC_Item extends GT_RadioactiveCell_Item implement + 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) * MYSTERIOUS_MULTIPLIER_HEAT; @@ -95,13 +94,12 @@ 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); } @@ -129,23 +127,15 @@ public class GT_RadioactiveCellIC_Item extends GT_RadioactiveCell_Item implement 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)) + 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) { + 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(); @@ -194,6 +184,7 @@ public class GT_RadioactiveCellIC_Item extends GT_RadioactiveCell_Item implement } private class ItemStackCoord { + public ItemStack stack; public int x; public int y; 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 61353c7c2a..4ec9ce1990 100644 --- a/src/main/java/gregtech/api/items/GT_RadioactiveCell_Item.java +++ b/src/main/java/gregtech/api/items/GT_RadioactiveCell_Item.java @@ -2,16 +2,19 @@ package gregtech.api.items; import static gregtech.api.util.GT_Utility.formatNumbers; -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 gregtech.common.items.GT_DepletetCell_Item; +import ic2.api.item.IBoxable; +import ic2.core.util.StackUtil; + public class GT_RadioactiveCell_Item extends GT_Generic_Item implements IBoxable { + protected int cellCount; protected int maxDmg; protected int dura; @@ -150,10 +153,10 @@ public class GT_RadioactiveCell_Item extends GT_Generic_Item implements IBoxable color2 = EnumChatFormatting.DARK_GRAY; break; } - EnumChatFormatting color1 = - this instanceof GT_DepletetCell_Item ? color2 = EnumChatFormatting.DARK_GRAY : EnumChatFormatting.WHITE; - aList.add(color1 - + String.format( + EnumChatFormatting color1 = this instanceof GT_DepletetCell_Item ? color2 = EnumChatFormatting.DARK_GRAY + : EnumChatFormatting.WHITE; + aList.add( + color1 + String.format( transItem("001", "Durability: %s/%s"), "" + color2 + formatNumbers(this.maxDmg - getDurabilityOfStack(aStack)) + color1, "" + formatNumbers(this.maxDmg))); 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 f62eed1a6e..41581b94f8 100644 --- a/src/main/java/gregtech/api/items/GT_SolderingTool_Item.java +++ b/src/main/java/gregtech/api/items/GT_SolderingTool_Item.java @@ -2,18 +2,21 @@ 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 gregtech.api.GregTech_API; +import gregtech.api.enums.ToolDictNames; +import gregtech.api.util.GT_LanguageManager; +import gregtech.api.util.GT_OreDictUnificator; + public class GT_SolderingTool_Item extends GT_Tool_Item { - public GT_SolderingTool_Item( - String aUnlocalized, String aEnglish, int aMaxDamage, int aEntityDamage, int aDischargedGTID) { + + public GT_SolderingTool_Item(String aUnlocalized, String aEnglish, int aMaxDamage, int aEntityDamage, + int aDischargedGTID) { super( aUnlocalized, aEnglish, @@ -25,32 +28,27 @@ public class GT_SolderingTool_Item extends GT_Tool_Item { 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<String> 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 23bf3d87ad..7614ea2fe9 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 @@ -1,64 +1,51 @@ package gregtech.api.items; -import gregtech.api.enums.SoundResource; -import gregtech.api.util.GT_ModHandler; -import gregtech.api.util.GT_Utility; import net.minecraft.block.Block; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.ItemStack; import net.minecraft.tileentity.TileEntity; import net.minecraft.world.World; +import gregtech.api.enums.SoundResource; +import gregtech.api.util.GT_ModHandler; +import gregtech.api.util.GT_Utility; + 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); /* - addToEffectiveList(EntityCaveSpider.class.getName()); - addToEffectiveList(EntitySpider.class.getName()); - addToEffectiveList("EntityTFHedgeSpider"); - addToEffectiveList("EntityTFKingSpider"); - addToEffectiveList("EntityTFSwarmSpider"); - addToEffectiveList("EntityTFTowerBroodling"); - addToEffectiveList("EntityTFFireBeetle"); - addToEffectiveList("EntityTFSlimeBeetle"); - setCraftingSound(Sounds.IC2_TOOLS_PAINTER); - setBreakingSound(Sounds.IC2_TOOLS_PAINTER); - setEntityHitSound(Sounds.IC2_TOOLS_PAINTER); - setUsageAmounts(8, 4, 1);*/ + super( + aUnlocalized, + aEnglish, + "A very 'buggy' Spray", + aMaxDamage, + aEntityDamage, + true); /* + * addToEffectiveList(EntityCaveSpider.class.getName()); + * addToEffectiveList(EntitySpider.class.getName()); addToEffectiveList("EntityTFHedgeSpider"); + * addToEffectiveList("EntityTFKingSpider"); addToEffectiveList("EntityTFSwarmSpider"); + * addToEffectiveList("EntityTFTowerBroodling"); addToEffectiveList("EntityTFFireBeetle"); + * addToEffectiveList("EntityTFSlimeBeetle"); setCraftingSound(Sounds.IC2_TOOLS_PAINTER); + * setBreakingSound(Sounds.IC2_TOOLS_PAINTER); setEntityHitSound(Sounds.IC2_TOOLS_PAINTER); + * setUsageAmounts(8, 4, 1); + */ } /* + * @Override public void onHitEntity(Entity aEntity) { if (aEntity instanceof EntityLiving) { + * ((EntityLiving)aEntity).addPotionEffect(new PotionEffect(Potion.poison.getId(), 60, 1, false)); + * ((EntityLiving)aEntity).addPotionEffect(new PotionEffect(Potion.confusion.getId(), 600, 1, false)); } } + * @Override public ItemStack getEmptiedItem(ItemStack aStack) { return ItemList.Spray_Empty.get(1); } + */ @Override - public void onHitEntity(Entity aEntity) { - if (aEntity instanceof EntityLiving) { - ((EntityLiving)aEntity).addPotionEffect(new PotionEffect(Potion.poison.getId(), 60, 1, false)); - ((EntityLiving)aEntity).addPotionEffect(new PotionEffect(Potion.confusion.getId(), 600, 1, false)); - } - } - - @Override - public ItemStack getEmptiedItem(ItemStack aStack) { - return ItemList.Spray_Empty.get(1); - } - */ - @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 { @@ -71,7 +58,7 @@ public class GT_Spray_Bug_Item extends GT_Tool_Item { } } } catch (Throwable e) { - /*Do nothing*/ + /* 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 c2d4ff1231..ca77340b34 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 @@ -2,11 +2,6 @@ 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; -import gregtech.api.util.GT_ModHandler; -import gregtech.api.util.GT_Utility; import net.minecraft.block.Block; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.ItemBlock; @@ -16,58 +11,42 @@ import net.minecraft.util.MathHelper; import net.minecraft.world.World; import net.minecraftforge.common.util.ForgeDirection; +import gregtech.api.enums.SoundResource; +import gregtech.api.metatileentity.BaseMetaPipeEntity; +import gregtech.api.util.GT_Log; +import gregtech.api.util.GT_ModHandler; +import gregtech.api.util.GT_Utility; + 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); /* - setCraftingSound(Sounds.IC2_TOOLS_PAINTER); - setBreakingSound(Sounds.IC2_TOOLS_PAINTER); - setEntityHitSound(Sounds.IC2_TOOLS_PAINTER); - setUsageAmounts(25, 3, 1);*/ + super( + aUnlocalized, + aEnglish, + "Precision Spray", + aMaxDamage, + aEntityDamage, + true); /* + * setCraftingSound(Sounds.IC2_TOOLS_PAINTER); setBreakingSound(Sounds.IC2_TOOLS_PAINTER); + * setEntityHitSound(Sounds.IC2_TOOLS_PAINTER); setUsageAmounts(25, 3, 1); + */ } /* + * @Override public ItemStack getEmptiedItem(ItemStack aStack) { return ItemList.Spray_Empty.get(1); } public void + * switchMode(ItemStack aStack, EntityPlayer aPlayer) { setMode(aStack, (getMode(aStack) + 1) % 3); switch + * (getMode(aStack)) { case 0: GT_Utility.sendChatToPlayer(aPlayer, "Single Block Mode"); break; case 1: + * GT_Utility.sendChatToPlayer(aPlayer, "4m Line Mode"); break; case 2: GT_Utility.sendChatToPlayer(aPlayer, + * "3mx3m Area Mode"); break; } } + * @Override public void addAdditionalToolTips(List aList, ItemStack aStack) { super.addAdditionalToolTips(aList, + * aStack); switch (getMode(aStack)) { case 0: aList.add("Single Block Mode"); break; case 1: + * aList.add("4m Line Mode"); break; case 2: aList.add("3mx3m Area Mode"); break; } } + * @Override public ItemStack onItemRightClick(ItemStack aStack, World aWorld, EntityPlayer aPlayer) { if + * (aPlayer.isSneaking()) switchMode(aStack, aPlayer); return super.onItemRightClick(aStack, aWorld, aPlayer); } + */ @Override - public ItemStack getEmptiedItem(ItemStack aStack) { - return ItemList.Spray_Empty.get(1); - } - - public void switchMode(ItemStack aStack, EntityPlayer aPlayer) { - setMode(aStack, (getMode(aStack) + 1) % 3); - switch (getMode(aStack)) { - case 0: GT_Utility.sendChatToPlayer(aPlayer, "Single Block Mode"); break; - case 1: GT_Utility.sendChatToPlayer(aPlayer, "4m Line Mode"); break; - case 2: GT_Utility.sendChatToPlayer(aPlayer, "3mx3m Area Mode"); break; - } - } - - @Override - public void addAdditionalToolTips(List aList, ItemStack aStack) { - super.addAdditionalToolTips(aList, aStack); - switch (getMode(aStack)) { - case 0: aList.add("Single Block Mode"); break; - case 1: aList.add("4m Line Mode"); break; - case 2: aList.add("3mx3m Area Mode"); break; - } - } - - @Override - public ItemStack onItemRightClick(ItemStack aStack, World aWorld, EntityPlayer aPlayer) { - if (aPlayer.isSneaking()) switchMode(aStack, aPlayer); - return super.onItemRightClick(aStack, aWorld, aPlayer); - } - */ - @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) { @@ -75,7 +54,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 { @@ -142,10 +121,15 @@ public class GT_Spray_Foam_Item extends GT_Tool_Item { for (byte i = 0; i < 4; i++) { if (GT_Utility.isBlockAir(aWorld, aX, aY, aZ) && GT_ModHandler.damageOrDechargeItem(aStack, 1, 1000, aPlayer)) { - GT_Utility.sendSoundToPlayers( - aWorld, SoundResource.IC2_TOOLS_PAINTER, 1.0F, -1, aX, aY, aZ); + GT_Utility + .sendSoundToPlayers(aWorld, SoundResource.IC2_TOOLS_PAINTER, 1.0F, -1, aX, aY, aZ); aWorld.setBlock( - aX, aY, aZ, GT_Utility.getBlockFromStack(tStack), tStack.getItemDamage(), 3); + aX, + aY, + aZ, + GT_Utility.getBlockFromStack(tStack), + tStack.getItemDamage(), + 3); } else { if (i == 0) return false; break; @@ -156,8 +140,7 @@ public class GT_Spray_Foam_Item extends GT_Tool_Item { } return true; case 2: - boolean temp = false, - tXFactor = (ForgeDirection.getOrientation(tSide).offsetX == 0), + boolean temp = false, tXFactor = (ForgeDirection.getOrientation(tSide).offsetX == 0), tYFactor = (ForgeDirection.getOrientation(tSide).offsetY == 0), tZFactor = (ForgeDirection.getOrientation(tSide).offsetZ == 0); @@ -165,29 +148,34 @@ public class GT_Spray_Foam_Item extends GT_Tool_Item { aY -= (tYFactor ? 1 : 0); aZ -= (tZFactor ? 1 : 0); - 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_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); - temp = true; - } else { - break; - } + 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_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); + temp = true; + } else { + break; } } + } return temp; } } 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 bbcd170db0..b5902f2d52 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 @@ -2,11 +2,6 @@ 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; -import gregtech.api.util.GT_ModHandler; -import gregtech.api.util.GT_Utility; import net.minecraft.block.Block; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.ItemBlock; @@ -14,34 +9,37 @@ import net.minecraft.item.ItemStack; import net.minecraft.tileentity.TileEntity; import net.minecraft.world.World; +import gregtech.api.enums.SoundResource; +import gregtech.api.metatileentity.BaseMetaPipeEntity; +import gregtech.api.util.GT_Log; +import gregtech.api.util.GT_ModHandler; +import gregtech.api.util.GT_Utility; + 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); /* - setCraftingSound(Sounds.IC2_TOOLS_PAINTER); - setBreakingSound(Sounds.IC2_TOOLS_PAINTER); - setEntityHitSound(Sounds.IC2_TOOLS_PAINTER); - setUsageAmounts(16, 3, 1);*/ + super( + aUnlocalized, + aEnglish, + "Construction Foam Hardener", + aMaxDamage, + aEntityDamage, + true); /* + * setCraftingSound(Sounds.IC2_TOOLS_PAINTER); setBreakingSound(Sounds.IC2_TOOLS_PAINTER); + * setEntityHitSound(Sounds.IC2_TOOLS_PAINTER); setUsageAmounts(16, 3, 1); + */ } @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 { @@ -61,8 +59,7 @@ public class GT_Spray_Hardener_Item extends GT_Tool_Item { ItemStack tStack1 = GT_ModHandler.getIC2Item("constructionFoam", 1), tStack2 = GT_ModHandler.getIC2Item("constructionFoamWall", 1); - if (tStack1 != null - && tStack1.isItemEqual(new ItemStack(aBlock)) + if (tStack1 != null && tStack1.isItemEqual(new ItemStack(aBlock)) && tStack2 != null && tStack2.getItem() instanceof ItemBlock) { if (GT_ModHandler.damageOrDechargeItem(aStack, 1, 1000, aPlayer)) { @@ -76,8 +73,8 @@ public class GT_Spray_Hardener_Item extends GT_Tool_Item { && (((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 e219220034..9056a6a90d 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 @@ -1,43 +1,41 @@ package gregtech.api.items; -import gregtech.api.enums.SoundResource; -import gregtech.api.interfaces.tileentity.IGregTechTileEntity; -import gregtech.api.util.GT_ModHandler; -import gregtech.api.util.GT_Utility; import net.minecraft.block.Block; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.ItemStack; import net.minecraft.tileentity.TileEntity; import net.minecraft.world.World; +import gregtech.api.enums.SoundResource; +import gregtech.api.interfaces.tileentity.IGregTechTileEntity; +import gregtech.api.util.GT_ModHandler; +import gregtech.api.util.GT_Utility; + 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); /* - setCraftingSound(Sounds.IC2_TOOLS_PAINTER); - setBreakingSound(Sounds.IC2_TOOLS_PAINTER); - setEntityHitSound(Sounds.IC2_TOOLS_PAINTER); - setUsageAmounts(20, 3, 1);*/ + 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); setUsageAmounts(20, 3, 1); + */ } @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 { @@ -50,7 +48,7 @@ public class GT_Spray_Hydration_Item extends GT_Tool_Item { return true; } } catch (Throwable e) { - /*Do nothing*/ + /* Do nothing */ } if (aTileEntity instanceof IGregTechTileEntity) { 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 cb21ce60b6..9ccc442b53 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 @@ -2,12 +2,8 @@ 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; @@ -15,51 +11,48 @@ import net.minecraft.item.ItemStack; import net.minecraft.world.World; import net.minecraftforge.common.util.ForgeDirection; +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; + 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); /* - addToEffectiveList(EntitySlime.class.getName()); - addToEffectiveList("BlueSlime"); - addToEffectiveList("SlimeClone"); - addToEffectiveList("MetalSlime"); - addToEffectiveList("EntityTFFireBeetle"); - addToEffectiveList("EntityTFMazeSlime"); - addToEffectiveList("EntityTFSlimeBeetle"); - setCraftingSound(Sounds.IC2_TOOLS_PAINTER); - setBreakingSound(Sounds.IC2_TOOLS_PAINTER); - setEntityHitSound(Sounds.IC2_TOOLS_PAINTER); - setUsageAmounts(4, 16, 1);*/ + super( + aUnlocalized, + aEnglish, + "Very effective against Slimes", + aMaxDamage, + aEntityDamage, + true); /* + * addToEffectiveList(EntitySlime.class.getName()); addToEffectiveList("BlueSlime"); + * addToEffectiveList("SlimeClone"); addToEffectiveList("MetalSlime"); + * addToEffectiveList("EntityTFFireBeetle"); addToEffectiveList("EntityTFMazeSlime"); + * addToEffectiveList("EntityTFSlimeBeetle"); setCraftingSound(Sounds.IC2_TOOLS_PAINTER); + * setBreakingSound(Sounds.IC2_TOOLS_PAINTER); 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}); + 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; @@ -70,7 +63,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 685da248a1..a70ebb4bfb 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,62 +1,62 @@ 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 gregtech.api.util.GT_LanguageManager; + 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); /* - setCraftingSound(GregTech_API.sSoundList.get(102)); - setBreakingSound(GregTech_API.sSoundList.get(102)); - setEntityHitSound(GregTech_API.sSoundList.get(102)); - setUsageAmounts(1, 8, 1);*/ + 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)); setUsageAmounts(1, 8, 1); + */ } @Override public void addAdditionalToolTips(List<String> 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 78df3c9171..9689964396 100644 --- a/src/main/java/gregtech/api/items/GT_Tool_Item.java +++ b/src/main/java/gregtech/api/items/GT_Tool_Item.java @@ -1,31 +1,21 @@ package gregtech.api.items; -import gregtech.api.util.GT_ModHandler; import net.minecraft.item.ItemStack; +import gregtech.api.util.GT_ModHandler; + /** * 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, + + 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) { + public GT_Tool_Item(String aUnlocalized, String aEnglish, String aTooltip, int aMaxDamage, int aEntityDamage, + boolean aSwingIfUsed, int aChargedGTID, int aDisChargedGTID) { this( aUnlocalized, aEnglish, @@ -39,17 +29,8 @@ public class GT_Tool_Item extends GT_Generic_Item { 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) { + 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, diff --git a/src/main/java/gregtech/api/metatileentity/BaseMetaPipeEntity.java b/src/main/java/gregtech/api/metatileentity/BaseMetaPipeEntity.java index 31a341040e..335639c9e3 100644 --- a/src/main/java/gregtech/api/metatileentity/BaseMetaPipeEntity.java +++ b/src/main/java/gregtech/api/metatileentity/BaseMetaPipeEntity.java @@ -3,6 +3,24 @@ package gregtech.api.metatileentity; import static gregtech.GT_Mod.GT_FML_LOGGER; import static gregtech.api.enums.GT_Values.NW; +import java.util.*; + +import net.minecraft.block.Block; +import net.minecraft.entity.Entity; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.init.Items; +import net.minecraft.item.ItemStack; +import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.tileentity.TileEntity; +import net.minecraft.util.AxisAlignedBB; +import net.minecraft.util.EnumChatFormatting; +import net.minecraft.world.World; +import net.minecraftforge.common.util.ForgeDirection; +import net.minecraftforge.fluids.Fluid; +import net.minecraftforge.fluids.FluidStack; +import net.minecraftforge.fluids.FluidTankInfo; +import net.minecraftforge.fluids.IFluidHandler; + import gregtech.api.GregTech_API; import gregtech.api.enums.GT_Values; import gregtech.api.enums.SoundResource; @@ -23,22 +41,6 @@ import gregtech.api.util.GT_ModHandler; import gregtech.api.util.GT_OreDictUnificator; import gregtech.api.util.GT_Utility; import gregtech.common.covers.CoverInfo; -import java.util.*; -import net.minecraft.block.Block; -import net.minecraft.entity.Entity; -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.init.Items; -import net.minecraft.item.ItemStack; -import net.minecraft.nbt.NBTTagCompound; -import net.minecraft.tileentity.TileEntity; -import net.minecraft.util.AxisAlignedBB; -import net.minecraft.util.EnumChatFormatting; -import net.minecraft.world.World; -import net.minecraftforge.common.util.ForgeDirection; -import net.minecraftforge.fluids.Fluid; -import net.minecraftforge.fluids.FluidStack; -import net.minecraftforge.fluids.FluidTankInfo; -import net.minecraftforge.fluids.IFluidHandler; /** * NEVER INCLUDE THIS FILE IN YOUR MOD!!! @@ -47,16 +49,12 @@ import net.minecraftforge.fluids.IFluidHandler; */ 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, + 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; @@ -147,7 +145,7 @@ public class BaseMetaPipeEntity extends CommonMetaTileEntity 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); @@ -199,8 +197,8 @@ public class BaseMetaPipeEntity extends CommonMetaTileEntity // 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); + mConnections = (byte) ((mConnections & ~IConnectable.HAS_FRESHFOAM) + | IConnectable.HAS_HARDENEDFOAM); } if (mTickTimer > 12 && oldConnections != mConnections) GregTech_API.causeCableUpdate(worldObj, xCoord, yCoord, zCoord); @@ -236,8 +234,7 @@ public class BaseMetaPipeEntity extends CommonMetaTileEntity 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) + 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) @@ -259,17 +256,24 @@ public class BaseMetaPipeEntity extends CommonMetaTileEntity 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) + 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()); + 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; @@ -306,18 +310,8 @@ public class BaseMetaPipeEntity extends CommonMetaTileEntity 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; @@ -391,13 +385,15 @@ public class BaseMetaPipeEntity extends CommonMetaTileEntity 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) { @@ -409,26 +405,30 @@ public class BaseMetaPipeEntity extends CommonMetaTileEntity 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"); - return mMetaTileEntity != null - ? mMetaTileEntity.getSpecialDebugInfo(this, aPlayer, aLogLevel, tList) + return mMetaTileEntity != null ? mMetaTileEntity.getSpecialDebugInfo(this, aPlayer, aLogLevel, tList) : new ArrayList<>(); } @@ -469,9 +469,9 @@ public class BaseMetaPipeEntity extends CommonMetaTileEntity public void setInventorySlotContents(int aIndex, ItemStack aStack) { markDirty(); mInventoryChanged = true; - if (canAccessData()) - mMetaTileEntity.setInventorySlotContents( - aIndex, worldObj.isRemote ? aStack : GT_OreDictUnificator.setStack(true, aStack)); + if (canAccessData()) mMetaTileEntity.setInventorySlotContents( + aIndex, + worldObj.isRemote ? aStack : GT_OreDictUnificator.setStack(true, aStack)); } @Override @@ -489,18 +489,17 @@ public class BaseMetaPipeEntity extends CommonMetaTileEntity @Override public void openInventory() { - /*Do nothing*/ + /* Do nothing */ } @Override public void closeInventory() { - /*Do nothing*/ + /* Do nothing */ } @Override public boolean isUseableByPlayer(EntityPlayer aPlayer) { - return hasValidMetaTileEntity() - && mTickTimer > 40 + return hasValidMetaTileEntity() && mTickTimer > 40 && getTileEntityOffset(0, 0, 0) == this && aPlayer.getDistanceSq(xCoord + 0.5, yCoord + 0.5, zCoord + 0.5) < 64 && mMetaTileEntity.isAccessAllowed(aPlayer); @@ -606,7 +605,7 @@ public class BaseMetaPipeEntity extends CommonMetaTileEntity @Override public void setWorkDataValue(byte aValue) { - /*Do nothing*/ + /* Do nothing */ } @Override @@ -626,7 +625,7 @@ public class BaseMetaPipeEntity extends CommonMetaTileEntity @Override public void setActive(boolean aActive) { - /*Do nothing*/ + /* Do nothing */ } @Override @@ -707,7 +706,7 @@ public class BaseMetaPipeEntity extends CommonMetaTileEntity @Override public ITexture[] getTexture(Block aBlock, byte aSide) { final ITexture rIcon = getCoverTexture(aSide); - if (rIcon != null) return new ITexture[] {rIcon}; + if (rIcon != null) return new ITexture[] { rIcon }; return getTextureUncovered(aSide); } @@ -737,14 +736,13 @@ public class BaseMetaPipeEntity extends CommonMetaTileEntity 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), - tConnections == 0 || (tConnections & (1 << aSide)) != 0, - getOutputRedstoneSignal(aSide) > 0); + if (hasValidMetaTileEntity()) return mMetaTileEntity.getTexture( + this, + aSide, + tConnections, + (byte) (mColor - 1), + tConnections == 0 || (tConnections & (1 << aSide)) != 0, + getOutputRedstoneSignal(aSide) > 0); return Textures.BlockIcons.ERROR_RENDERING; } @@ -785,8 +783,8 @@ public class BaseMetaPipeEntity extends CommonMetaTileEntity if (isClientSide()) { // 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 (getCoverInfoAtSide(tSide).hasCoverGUI()); } else if (getCoverBehaviorAtSideNew(aSide).onCoverRightclickClient(aSide, this, aPlayer, aX, aY, aZ)) { return true; @@ -808,7 +806,13 @@ public class BaseMetaPipeEntity extends CommonMetaTileEntity mMetaTileEntity.markDirty(); GT_ModHandler.damageOrDechargeItem(tCurrentItem, 1, 1000, aPlayer); GT_Utility.sendSoundToPlayers( - worldObj, SoundResource.IC2_TOOLS_WRENCH, 1.0F, -1, xCoord, yCoord, zCoord); + worldObj, + SoundResource.IC2_TOOLS_WRENCH, + 1.0F, + -1, + xCoord, + yCoord, + zCoord); } return true; } @@ -821,16 +825,29 @@ public class BaseMetaPipeEntity extends CommonMetaTileEntity mMetaTileEntity.onScrewdriverRightClick(tSide, aPlayer, aX, aY, aZ); mMetaTileEntity.markDirty(); GT_Utility.sendSoundToPlayers( - worldObj, SoundResource.IC2_TOOLS_WRENCH, 1.0F, -1, xCoord, yCoord, zCoord); + worldObj, + SoundResource.IC2_TOOLS_WRENCH, + 1.0F, + -1, + xCoord, + yCoord, + zCoord); } } else { if (GT_ModHandler.damageOrDechargeItem(tCurrentItem, 1, 1000, aPlayer)) { setCoverDataAtSide( - aSide, getCoverInfoAtSide(aSide).onCoverScrewdriverClick(aPlayer, aX, aY, aZ)); + aSide, + getCoverInfoAtSide(aSide).onCoverScrewdriverClick(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); + worldObj, + SoundResource.IC2_TOOLS_WRENCH, + 1.0F, + -1, + xCoord, + yCoord, + zCoord); } } return true; @@ -838,7 +855,7 @@ public class BaseMetaPipeEntity extends CommonMetaTileEntity 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, + // GT_Utility.sendSoundToPlayers(worldObj, GregTech_API.sSoundList.get(1), 1.0F, -1, xCoord, yCoord, // zCoord); // } return true; @@ -852,11 +869,16 @@ public class BaseMetaPipeEntity extends CommonMetaTileEntity GT_Utility.sendChatToPlayer( aPlayer, GT_Utility.trans("090", "Machine Processing: ") - + (isAllowedToWork() - ? GT_Utility.trans("088", "Enabled") + + (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); + worldObj, + SoundResource.IC2_TOOLS_RUBBER_TRAMPOLINE, + 1.0F, + -1, + xCoord, + yCoord, + zCoord); } return true; } @@ -866,7 +888,13 @@ public class BaseMetaPipeEntity extends CommonMetaTileEntity mMetaTileEntity.markDirty(); // logic handled internally GT_Utility.sendSoundToPlayers( - worldObj, SoundResource.IC2_TOOLS_WRENCH, 1.0F, -1, xCoord, yCoord, zCoord); + worldObj, + SoundResource.IC2_TOOLS_WRENCH, + 1.0F, + -1, + xCoord, + yCoord, + zCoord); } doEnetUpdate(); return true; @@ -877,20 +905,30 @@ public class BaseMetaPipeEntity extends CommonMetaTileEntity mMetaTileEntity.markDirty(); // logic handled internally GT_Utility.sendSoundToPlayers( - worldObj, SoundResource.IC2_TOOLS_BATTERY_USE, 1.0F, -1, xCoord, yCoord, zCoord); + 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("091", "Redstone Output at Side ") + tSide + GT_Utility.trans("092", " set to: ") - + ((mStrongRedstone & (1 << tSide)) != 0 - ? GT_Utility.trans("093", "Strong") + + ((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); + worldObj, + SoundResource.IC2_TOOLS_BATTERY_USE, + 3.0F, + -1, + xCoord, + yCoord, + zCoord); issueBlockUpdate(); } doEnetUpdate(); @@ -905,13 +943,19 @@ public class BaseMetaPipeEntity extends CommonMetaTileEntity if (coverInfo.getCoverID() == 0) { if (GT_Utility.isStackInList(tCurrentItem, GregTech_API.sCovers.keySet())) { if (GregTech_API.getCoverBehaviorNew(tCurrentItem) - .isCoverPlaceable(coverSide, tCurrentItem, this) + .isCoverPlaceable(coverSide, tCurrentItem, this) && mMetaTileEntity.allowCoverOnSide(coverSide, new GT_ItemStack(tCurrentItem))) { setCoverItemAtSide(coverSide, tCurrentItem); mMetaTileEntity.markDirty(); if (!aPlayer.capabilities.isCreativeMode) tCurrentItem.stackSize--; GT_Utility.sendSoundToPlayers( - worldObj, SoundResource.IC2_TOOLS_WRENCH, 1.0F, -1, xCoord, yCoord, zCoord); + worldObj, + SoundResource.IC2_TOOLS_WRENCH, + 1.0F, + -1, + xCoord, + yCoord, + zCoord); } return true; } @@ -919,7 +963,13 @@ public class BaseMetaPipeEntity extends CommonMetaTileEntity 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); + worldObj, + SoundResource.RANDOM_BREAK, + 1.0F, + -1, + xCoord, + yCoord, + zCoord); dropCover(coverSide, aSide, false); mMetaTileEntity.markDirty(); } @@ -990,8 +1040,8 @@ public class BaseMetaPipeEntity extends CommonMetaTileEntity } /** - * returns all valid Inventory Slots, no matter which Side (Unless it's covered). - * The Side Stuff is done in the following two Functions. + * returns all valid Inventory Slots, no matter which Side (Unless it's covered). The Side Stuff is done in the + * following two Functions. */ @Override public int[] getAccessibleSlotsFromSide(int aSide) { @@ -1006,8 +1056,7 @@ public class BaseMetaPipeEntity extends CommonMetaTileEntity */ @Override public boolean canInsertItem(int aIndex, ItemStack aStack, int aSide) { - return canAccessData() - && getCoverInfoAtSide((byte) aSide).letsItemsIn(aIndex) + return canAccessData() && getCoverInfoAtSide((byte) aSide).letsItemsIn(aIndex) && mMetaTileEntity.canInsertItem(aIndex, aStack, aSide); } @@ -1016,15 +1065,12 @@ public class BaseMetaPipeEntity extends CommonMetaTileEntity */ @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 @@ -1154,21 +1200,20 @@ public class BaseMetaPipeEntity extends CommonMetaTileEntity // the pipe if (tTileEntity != null && !mMetaTileEntity.isConnectedAtSide((byte) aSide.ordinal())) return false; - if (isFill - && mMetaTileEntity.isLiquidInput((byte) aSide.ordinal()) - && getCoverInfoAtSide((byte) aSide.ordinal()).letsFluidIn(aFluid)) return true; + if (isFill && mMetaTileEntity.isLiquidInput((byte) aSide.ordinal()) + && getCoverInfoAtSide((byte) aSide.ordinal()).letsFluidIn(aFluid)) + return true; - if (!isFill - && mMetaTileEntity.isLiquidOutput((byte) aSide.ordinal()) - && getCoverInfoAtSide((byte) aSide.ordinal()).letsFluidOut(aFluid)) return true; + if (!isFill && mMetaTileEntity.isLiquidOutput((byte) aSide.ordinal()) + && getCoverInfoAtSide((byte) aSide.ordinal()).letsFluidOut(aFluid)) + return true; return false; } @Override public int fill(ForgeDirection aSide, FluidStack aFluidStack, boolean doFill) { - if (mTickTimer > 5 - && canAccessData() + if (mTickTimer > 5 && canAccessData() && canMoveFluidOnSide(aSide, aFluidStack == null ? null : aFluidStack.getFluid(), true)) return mMetaTileEntity.fill(aSide, aFluidStack, doFill); return 0; @@ -1176,21 +1221,18 @@ public class BaseMetaPipeEntity extends CommonMetaTileEntity @Override public FluidStack drain(ForgeDirection aSide, int maxDrain, boolean doDrain) { - if (mTickTimer > 5 - && canAccessData() + if (mTickTimer > 5 && canAccessData() && canMoveFluidOnSide( aSide, - mMetaTileEntity.getFluid() == null - ? null - : mMetaTileEntity.getFluid().getFluid(), - false)) return mMetaTileEntity.drain(aSide, maxDrain, doDrain); + 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() + if (mTickTimer > 5 && canAccessData() && canMoveFluidOnSide(aSide, aFluidStack == null ? null : aFluidStack.getFluid(), false)) return mMetaTileEntity.drain(aSide, aFluidStack, doDrain); return null; @@ -1213,12 +1255,11 @@ public class BaseMetaPipeEntity extends CommonMetaTileEntity @Override public FluidTankInfo[] getTankInfo(ForgeDirection aSide) { final CoverInfo coverInfo = getCoverInfoAtSide((byte) aSide.ordinal()); - if (canAccessData() - && (aSide == ForgeDirection.UNKNOWN - || (mMetaTileEntity.isLiquidInput((byte) aSide.ordinal()) && coverInfo.letsFluidIn(null)) - || (mMetaTileEntity.isLiquidOutput((byte) aSide.ordinal()) && coverInfo.letsFluidOut(null)) - // Doesn't need to be connected to get Tank Info -- otherwise things can't connect - )) return mMetaTileEntity.getTankInfo(aSide); + if (canAccessData() && (aSide == ForgeDirection.UNKNOWN + || (mMetaTileEntity.isLiquidInput((byte) aSide.ordinal()) && coverInfo.letsFluidIn(null)) + || (mMetaTileEntity.isLiquidOutput((byte) aSide.ordinal()) && coverInfo.letsFluidOut(null)) + // Doesn't need to be connected to get Tank Info -- otherwise things can't connect + )) return mMetaTileEntity.getTankInfo(aSide); return new FluidTankInfo[] {}; } @@ -1232,9 +1273,8 @@ public class BaseMetaPipeEntity extends CommonMetaTileEntity 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; @@ -1321,7 +1361,7 @@ public class BaseMetaPipeEntity extends CommonMetaTileEntity // 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. + // (This caused issues with AE2 GTEU p2p connections. ((MetaPipeEntity) meta).setCheckConnections(); } } @@ -1333,14 +1373,8 @@ public class BaseMetaPipeEntity extends CommonMetaTileEntity } @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 1e8ffa0994..7408701f16 100644 --- a/src/main/java/gregtech/api/metatileentity/BaseMetaTileEntity.java +++ b/src/main/java/gregtech/api/metatileentity/BaseMetaTileEntity.java @@ -6,6 +6,35 @@ 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 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; +import net.minecraft.block.BlockFire; +import net.minecraft.entity.Entity; +import net.minecraft.entity.item.EntityItem; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.entity.player.EntityPlayerMP; +import net.minecraft.init.Items; +import net.minecraft.item.ItemStack; +import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.server.MinecraftServer; +import net.minecraft.tileentity.TileEntity; +import net.minecraft.util.AxisAlignedBB; +import net.minecraft.util.EnumChatFormatting; +import net.minecraft.world.EnumSkyBlock; +import net.minecraft.world.World; +import net.minecraft.world.biome.BiomeGenBase; +import net.minecraftforge.common.util.ForgeDirection; +import net.minecraftforge.fluids.Fluid; +import net.minecraftforge.fluids.FluidStack; +import net.minecraftforge.fluids.FluidTankInfo; + import appeng.api.networking.IGridNode; import appeng.api.networking.security.IActionHost; import appeng.api.util.AECableType; @@ -14,10 +43,12 @@ import appeng.me.helpers.AENetworkProxy; 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.IAlignmentProvider; import com.gtnewhorizon.structurelib.alignment.constructable.IConstructable; import com.gtnewhorizon.structurelib.alignment.constructable.IConstructableProvider; + import cpw.mods.fml.common.Optional; import cpw.mods.fml.relauncher.ReflectionHelper; import gregtech.GT_Mod; @@ -43,31 +74,6 @@ import gregtech.api.util.*; import gregtech.common.GT_Pollution; import gregtech.common.covers.CoverInfo; 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; -import net.minecraft.block.BlockFire; -import net.minecraft.entity.Entity; -import net.minecraft.entity.item.EntityItem; -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.entity.player.EntityPlayerMP; -import net.minecraft.init.Items; -import net.minecraft.item.ItemStack; -import net.minecraft.nbt.NBTTagCompound; -import net.minecraft.server.MinecraftServer; -import net.minecraft.tileentity.TileEntity; -import net.minecraft.util.AxisAlignedBB; -import net.minecraft.util.EnumChatFormatting; -import net.minecraft.world.EnumSkyBlock; -import net.minecraft.world.World; -import net.minecraft.world.biome.BiomeGenBase; -import net.minecraftforge.common.util.ForgeDirection; -import net.minecraftforge.fluids.Fluid; -import net.minecraftforge.fluids.FluidStack; -import net.minecraftforge.fluids.FluidTankInfo; /** * NEVER INCLUDE THIS FILE IN YOUR MOD!!! @@ -76,27 +82,21 @@ import net.minecraftforge.fluids.FluidTankInfo; */ @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.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; @@ -104,28 +104,14 @@ public class BaseMetaTileEntity extends CommonMetaTileEntity 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, + private byte mColor = 0, oColor = 0, oStrongRedstone = 0, oRedstoneData = 63, oTextureData = 0, oUpdateData = 0, oTexturePage = 0; - private byte oLightValueClient = 0, - oLightValue = -1, - mLightValue = 0, - mOtherUpgrades = 0, - mFacing = 0, - oFacing = 0, + private byte oLightValueClient = 0, 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; @@ -184,8 +170,8 @@ public class BaseMetaTileEntity extends CommonMetaTileEntity 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}); + ? 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; @@ -208,8 +194,8 @@ public class BaseMetaTileEntity extends CommonMetaTileEntity 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"); @@ -219,15 +205,15 @@ public class BaseMetaTileEntity extends CommonMetaTileEntity 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(); } /** - * Used for ticking special BaseMetaTileEntities, which need that for Energy Conversion - * It's called right before onPostTick() + * Used for ticking special BaseMetaTileEntities, which need that for Energy Conversion It's called right before + * onPostTick() */ public void updateStatus() { // @@ -279,17 +265,13 @@ public class BaseMetaTileEntity extends CommonMetaTileEntity final int precipitationHeightAtSide4 = worldObj.getPrecipitationHeight(xCoord - 1, zCoord); final int precipitationHeightAtSide5 = worldObj.getPrecipitationHeight(xCoord + 1, zCoord); return (getCoverIDAtSide((byte) 1) == 0 && worldObj.getPrecipitationHeight(xCoord, zCoord) - 2 < yCoord) - || (getCoverIDAtSide((byte) 2) == 0 - && precipitationHeightAtSide2 - 1 < yCoord + || (getCoverIDAtSide((byte) 2) == 0 && precipitationHeightAtSide2 - 1 < yCoord && precipitationHeightAtSide2 > -1) - || (getCoverIDAtSide((byte) 3) == 0 - && precipitationHeightAtSide3 - 1 < yCoord + || (getCoverIDAtSide((byte) 3) == 0 && precipitationHeightAtSide3 - 1 < yCoord && precipitationHeightAtSide3 > -1) - || (getCoverIDAtSide((byte) 4) == 0 - && precipitationHeightAtSide4 - 1 < yCoord + || (getCoverIDAtSide((byte) 4) == 0 && precipitationHeightAtSide4 - 1 < yCoord && precipitationHeightAtSide4 > -1) - || (getCoverIDAtSide((byte) 5) == 0 - && precipitationHeightAtSide5 - 1 < yCoord + || (getCoverIDAtSide((byte) 5) == 0 && precipitationHeightAtSide5 - 1 < yCoord && precipitationHeightAtSide5 > -1); } @@ -413,14 +395,14 @@ public class BaseMetaTileEntity extends CommonMetaTileEntity } if (mMetaTileEntity.isEnetOutput() && oOutput > 0) { - final long tOutputVoltage = - Math.max(oOutput, oOutput + (1L << Math.max(0, GT_Utility.getTier(oOutput) - 1))); + final long tOutputVoltage = Math + .max(oOutput, oOutput + (1L << Math.max(0, GT_Utility.getTier(oOutput) - 1))); final long tUsableAmperage = Math.min( getOutputAmperage(), (getStoredEU() - mMetaTileEntity.getMinimumStoredEU()) / tOutputVoltage); 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); } @@ -444,21 +426,29 @@ public class BaseMetaTileEntity extends CommonMetaTileEntity if (getRandomNumber(10) == 0) { try { GT_Mod.achievements.issueAchievement( - this.getWorldObj() - .getPlayerEntityByName(mOwnerName), + this.getWorldObj().getPlayerEntityByName(mOwnerName), "badweather"); - } catch (Exception ignored) { - } - GT_Log.exp.println("Machine at: " + this.getXCoord() + " | " - + this.getYCoord() + " | " + this.getZCoord() + " DIMID: " - + this.worldObj.provider.dimensionId - + " explosion due to rain!"); + } catch (Exception ignored) {} + 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(); } } @@ -466,18 +456,20 @@ public class BaseMetaTileEntity extends CommonMetaTileEntity mRunningThroughTick = false; return; } - if (GregTech_API.sMachineThunderExplosions - && worldObj.isThundering() + if (GregTech_API.sMachineThunderExplosions && worldObj.isThundering() && getRandomNumber(3) == 0) { try { GT_Mod.achievements.issueAchievement( this.getWorldObj().getPlayerEntityByName(mOwnerName), "badweather"); - } catch (Exception ignored) { - } + } catch (Exception ignored) {} GT_Log.exp.println( - "Machine at: " + this.getXCoord() + " | " + this.getYCoord() - + " | " + this.getZCoord() + " DIMID: " + "Machine at: " + this.getXCoord() + + " | " + + this.getYCoord() + + " | " + + this.getZCoord() + + " DIMID: " + this.worldObj.provider.dimensionId + " explosion due to Thunderstorm!"); doEnergyExplosion(); @@ -497,19 +489,15 @@ public class BaseMetaTileEntity extends CommonMetaTileEntity if (aSideServer) { if (mMetaTileEntity.dechargerSlotCount() > 0 && getStoredEU() < getEUCapacity()) { for (int i = mMetaTileEntity.dechargerSlotStartIndex(), - k = mMetaTileEntity.dechargerSlotCount() + i; - i < k; - i++) { + 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()) { + if ((getStoredEU() + ic2.api.info.Info.itemEnergy + .getEnergyValue(mMetaTileEntity.mInventory[i])) < getEUCapacity()) { increaseStoredEnergyUnits( - (long) ic2.api.info.Info.itemEnergy.getEnergyValue( - mMetaTileEntity.mInventory[i]), + (long) ic2.api.info.Info.itemEnergy + .getEnergyValue(mMetaTileEntity.mInventory[i]), false); mMetaTileEntity.mInventory[i].stackSize--; mInventoryChanged = true; @@ -526,9 +514,7 @@ public class BaseMetaTileEntity extends CommonMetaTileEntity if (aSideServer) { if (mMetaTileEntity.rechargerSlotCount() > 0 && getStoredEU() > 0) { for (int i = mMetaTileEntity.rechargerSlotStartIndex(), - k = mMetaTileEntity.rechargerSlotCount() + i; - i < k; - i++) { + k = mMetaTileEntity.rechargerSlotCount() + i; i < k; i++) { if (getStoredEU() > 0 && mMetaTileEntity.mInventory[i] != null) { chargeItem(mMetaTileEntity.mInventory[i]); if (mMetaTileEntity.mInventory[i].stackSize <= 0) { @@ -559,8 +545,7 @@ public class BaseMetaTileEntity extends CommonMetaTileEntity } if (mTickTimer > 10) { - byte tData = (byte) ((mFacing & 7) - | (mActive ? 8 : 0) + byte tData = (byte) ((mFacing & 7) | (mActive ? 8 : 0) | (mRedstone ? 16 : 0) | (mLockUpgrade ? 32 : 0) | (mWorks ? 64 : 0)); @@ -572,13 +557,12 @@ public class BaseMetaTileEntity extends CommonMetaTileEntity sendBlockEvent(GregTechTileClientEvents.CHANGE_CUSTOM_DATA, oUpdateData = tData); 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 + if (tData != oTexturePage) 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) + 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) @@ -613,25 +597,32 @@ public class BaseMetaTileEntity extends CommonMetaTileEntity 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) + 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()); + 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().getWailaBody(itemStack, currenttip, accessor, config); } @@ -639,8 +630,8 @@ public class BaseMetaTileEntity extends CommonMetaTileEntity } @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().getWailaNBTData(player, tile, tag, world, x, y, z); @@ -662,13 +653,12 @@ public class BaseMetaTileEntity extends CommonMetaTileEntity getCoverInfoAtSide((byte) 3).getCoverID(), getCoverInfoAtSide((byte) 4).getCoverID(), getCoverInfoAtSide((byte) 5).getCoverID(), - oTextureData = (byte) ((mFacing & 7) - | (mActive ? 8 : 0) + oTextureData = (byte) ((mFacing & 7) | (mActive ? 8 : 0) | (mRedstone ? 16 : 0) | (mLockUpgrade ? 32 : 0) | (mWorks ? 64 : 0)), - oTexturePage = - (hasValidMetaTileEntity() && mMetaTileEntity instanceof GT_MetaTileEntity_Hatch) + oTexturePage = (hasValidMetaTileEntity() + && mMetaTileEntity instanceof GT_MetaTileEntity_Hatch) ? ((GT_MetaTileEntity_Hatch) mMetaTileEntity).getTexturePage() : 0, oUpdateData = hasValidMetaTileEntity() ? mMetaTileEntity.getUpdateData() : 0, @@ -686,18 +676,8 @@ public class BaseMetaTileEntity extends CommonMetaTileEntity 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, + 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) { @@ -720,18 +700,8 @@ public class BaseMetaTileEntity extends CommonMetaTileEntity } @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) { + 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, @@ -768,15 +738,15 @@ public class BaseMetaTileEntity extends CommonMetaTileEntity 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)); + 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)); + ((GT_MetaTileEntity_Hatch) mMetaTileEntity).onTexturePageUpdate((byte) (aValue & 0x7F)); } break; case GregTechTileClientEvents.CHANGE_COLOR: @@ -815,13 +785,15 @@ public class BaseMetaTileEntity extends CommonMetaTileEntity 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) { @@ -835,36 +807,42 @@ public class BaseMetaTileEntity extends CommonMetaTileEntity // Uncomment this line to print out tick-by-tick times. // 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 + 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)); - if (!mHasEnoughEnergy) - tList.add( - EnumChatFormatting.RED + "ATTENTION: This Device needs more power." + EnumChatFormatting.RESET); + if (!mHasEnoughEnergy) tList.add( + EnumChatFormatting.RED + "ATTENTION: This Device needs more power." + EnumChatFormatting.RESET); } if (joinedIc2Enet) tList.add("Joined IC2 ENet"); return mMetaTileEntity.getSpecialDebugInfo(this, aPlayer, aLogLevel, tList); @@ -923,7 +901,8 @@ public class BaseMetaTileEntity extends CommonMetaTileEntity if (canAccessData()) { markDirty(); mMetaTileEntity.setInventorySlotContents( - aIndex, worldObj.isRemote ? aStack : GT_OreDictUnificator.setStack(true, aStack)); + aIndex, + worldObj.isRemote ? aStack : GT_OreDictUnificator.setStack(true, aStack)); } } @@ -952,8 +931,7 @@ public class BaseMetaTileEntity extends CommonMetaTileEntity @Override public boolean isUseableByPlayer(EntityPlayer aPlayer) { - return canAccessData() - && playerOwnsThis(aPlayer, false) + return canAccessData() && playerOwnsThis(aPlayer, false) && mTickTimer > 40 && getTileEntityOffset(0, 0, 0) == this && aPlayer.getDistanceSq(xCoord + 0.5, yCoord + 0.5, zCoord + 0.5) < 64 @@ -1093,8 +1071,7 @@ public class BaseMetaTileEntity extends CommonMetaTileEntity @Override public boolean decreaseStoredEnergyUnits(long aEnergy, boolean aIgnoreTooLessEnergy) { if (!canAccessData()) return false; - return mHasEnoughEnergy = decreaseStoredEU(aEnergy, aIgnoreTooLessEnergy) - || decreaseStoredSteam(aEnergy, false) + return mHasEnoughEnergy = decreaseStoredEU(aEnergy, aIgnoreTooLessEnergy) || decreaseStoredSteam(aEnergy, false) || (aIgnoreTooLessEnergy && (decreaseStoredSteam(aEnergy, true))); } @@ -1236,9 +1213,8 @@ public class BaseMetaTileEntity extends CommonMetaTileEntity @Override public ITexture[] getTexture(Block aBlock, byte aSide) { final ITexture coverTexture = getCoverTexture(aSide); - final ITexture[] textureUncovered = hasValidMetaTileEntity() - ? mMetaTileEntity.getTexture( - this, aSide, mFacing, (byte) (mColor - 1), mActive, getOutputRedstoneSignal(aSide) > 0) + final ITexture[] textureUncovered = hasValidMetaTileEntity() ? mMetaTileEntity + .getTexture(this, aSide, mFacing, (byte) (mColor - 1), mActive, getOutputRedstoneSignal(aSide) > 0) : Textures.BlockIcons.ERROR_RENDERING; final ITexture[] textureCovered; if (coverTexture != null) { @@ -1328,11 +1304,9 @@ public class BaseMetaTileEntity extends CommonMetaTileEntity if ((mOwnerName.length() == 0) && isServerSide()) { setOwnerName(aPlayer.getDisplayName()); setOwnerUuid(aPlayer.getUniqueID()); - } else - return !privateAccess() - || aPlayer.getDisplayName().equals("Player") - || mOwnerName.equals("Player") - || mOwnerName.equals(aPlayer.getDisplayName()); + } else return !privateAccess() || aPlayer.getDisplayName().equals("Player") + || mOwnerName.equals("Player") + || mOwnerName.equals(aPlayer.getDisplayName()); return true; } @@ -1343,15 +1317,17 @@ public class BaseMetaTileEntity extends CommonMetaTileEntity public void doEnergyExplosion() { if (getUniversalEnergyCapacity() > 0 && getUniversalEnergyStored() >= getUniversalEnergyCapacity() / 5) { - GT_Log.exp.println("Energy Explosion, injected " + getUniversalEnergyStored() + "EU >= " - + getUniversalEnergyCapacity() / 5D + "Capacity of the Machine!"); + GT_Log.exp.println( + "Energy Explosion, injected " + getUniversalEnergyStored() + + "EU >= " + + getUniversalEnergyCapacity() / 5D + + "Capacity of the Machine!"); - doExplosion(oOutput - * (getUniversalEnergyStored() >= getUniversalEnergyCapacity() - ? 4 + doExplosion( + oOutput * (getUniversalEnergyStored() >= getUniversalEnergyCapacity() ? 4 : getUniversalEnergyStored() >= getUniversalEnergyCapacity() / 2 ? 2 : 1)); - GT_Mod.achievements.issueAchievement( - this.getWorldObj().getPlayerEntityByName(mOwnerName), "electricproblems"); + GT_Mod.achievements + .issueAchievement(this.getWorldObj().getPlayerEntityByName(mOwnerName), "electricproblems"); } } @@ -1363,8 +1339,7 @@ public class BaseMetaTileEntity extends CommonMetaTileEntity try { mReleaseEnergy = true; IEnergyConnected.Util.emitEnergyToNetwork(V[5], Math.max(1, getStoredEU() / V[5]), this); - } catch (Exception ignored) { - } + } catch (Exception ignored) {} } mReleaseEnergy = false; // Normal Explosion Code @@ -1400,8 +1375,7 @@ public class BaseMetaTileEntity extends CommonMetaTileEntity 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); @@ -1410,8 +1384,7 @@ public class BaseMetaTileEntity extends CommonMetaTileEntity tItemEntity.lifespan = 60000; try { if (ENTITY_ITEM_HEALTH_FIELD != null) ENTITY_ITEM_HEALTH_FIELD.setInt(tItemEntity, 99999999); - } catch (Exception ignored) { - } + } catch (Exception ignored) {} this.worldObj.spawnEntityInWorld(tItemEntity); tItem.stackSize = 0; } @@ -1450,8 +1423,8 @@ public class BaseMetaTileEntity extends CommonMetaTileEntity if (isClientSide()) { // 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; @@ -1471,21 +1444,37 @@ public class BaseMetaTileEntity extends CommonMetaTileEntity return true; } if (GT_Utility.isStackInList(tCurrentItem, GregTech_API.sWrenchList)) { - if (aPlayer.isSneaking() - && mMetaTileEntity instanceof GT_MetaTileEntity_BasicMachine + 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); + 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)) { - GT_ModHandler.damageOrDechargeItem(tCurrentItem, 1, 1000, aPlayer); - GT_Utility.sendSoundToPlayers( - worldObj, SoundResource.IC2_TOOLS_WRENCH, 1.0F, -1, xCoord, yCoord, zCoord); - cableUpdateDelay = 10; - } + 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); + cableUpdateDelay = 10; + } return true; } @@ -1493,19 +1482,24 @@ public class BaseMetaTileEntity extends CommonMetaTileEntity if (GT_ModHandler.damageOrDechargeItem(tCurrentItem, 1, 200, aPlayer)) { setCoverDataAtSide( aSide, - getCoverBehaviorAtSideNew(aSide) - .onCoverScrewdriverClick( - aSide, - getCoverIDAtSide(aSide), - getComplexCoverDataAtSide(aSide), - this, - aPlayer, - aX, - aY, - aZ)); + 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); + worldObj, + SoundResource.IC2_TOOLS_WRENCH, + 1.0F, + -1, + xCoord, + yCoord, + zCoord); } return true; } @@ -1514,18 +1508,24 @@ public class BaseMetaTileEntity extends CommonMetaTileEntity if (GT_ModHandler.damageOrDechargeItem(tCurrentItem, 1, 1000, aPlayer)) { mInputDisabled = !mInputDisabled; if (mInputDisabled) mOutputDisabled = !mOutputDisabled; - GT_Utility.sendChatToPlayer( - aPlayer, - GT_Utility.trans("086", "Auto-Input: ") - + (mInputDisabled - ? GT_Utility.trans("087", "Disabled") - : GT_Utility.trans("088", "Enabled") - + GT_Utility.trans("089", " Auto-Output: ") - + (mOutputDisabled - ? GT_Utility.trans("087", "Disabled") - : GT_Utility.trans("088", "Enabled")))); + GT_Utility + .sendChatToPlayer( + aPlayer, + GT_Utility.trans("086", "Auto-Input: ") + + (mInputDisabled ? GT_Utility.trans("087", "Disabled") + : GT_Utility.trans("088", "Enabled") + + GT_Utility.trans("089", " Auto-Output: ") + + (mOutputDisabled + ? GT_Utility.trans("087", "Disabled") + : GT_Utility.trans("088", "Enabled")))); GT_Utility.sendSoundToPlayers( - worldObj, SoundResource.RANDOM_ANVIL_USE, 1.0F, -1, xCoord, yCoord, zCoord); + worldObj, + SoundResource.RANDOM_ANVIL_USE, + 1.0F, + -1, + xCoord, + yCoord, + zCoord); } return true; } @@ -1536,11 +1536,9 @@ public class BaseMetaTileEntity extends CommonMetaTileEntity else enableWorking(); { String tChat = GT_Utility.trans("090", "Machine Processing: ") - + (isAllowedToWork() - ? GT_Utility.trans("088", "Enabled") + + (isAllowedToWork() ? GT_Utility.trans("088", "Enabled") : GT_Utility.trans("087", "Disabled")); - if (getMetaTileEntity() != null - && getMetaTileEntity().hasAlternativeModeText()) + if (getMetaTileEntity() != null && getMetaTileEntity().hasAlternativeModeText()) tChat = getMetaTileEntity().getAlternativeModeText(); GT_Utility.sendChatToPlayer(aPlayer, tChat); } @@ -1561,19 +1559,29 @@ public class BaseMetaTileEntity extends CommonMetaTileEntity 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); + 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("091", "Redstone Output at Side ") + tSide + GT_Utility.trans("092", " set to: ") - + ((mStrongRedstone & (1 << tSide)) != 0 - ? GT_Utility.trans("093", "Strong") + + ((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); + worldObj, + SoundResource.IC2_TOOLS_BATTERY_USE, + 3.0F, + -1, + xCoord, + yCoord, + zCoord); issueBlockUpdate(); } doEnetUpdate(); @@ -1586,7 +1594,13 @@ public class BaseMetaTileEntity extends CommonMetaTileEntity 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); + worldObj, + SoundResource.IC2_TOOLS_WRENCH, + 1.0F, + -1, + xCoord, + yCoord, + zCoord); } doEnetUpdate(); cableUpdateDelay = 10; @@ -1599,12 +1613,18 @@ public class BaseMetaTileEntity extends CommonMetaTileEntity if (getCoverIDAtSide(coverSide) == 0) { if (GT_Utility.isStackInList(tCurrentItem, GregTech_API.sCovers.keySet())) { if (GregTech_API.getCoverBehaviorNew(tCurrentItem) - .isCoverPlaceable(coverSide, tCurrentItem, this) + .isCoverPlaceable(coverSide, tCurrentItem, this) && mMetaTileEntity.allowCoverOnSide(coverSide, new GT_ItemStack(tCurrentItem))) { setCoverItemAtSide(coverSide, tCurrentItem); if (!aPlayer.capabilities.isCreativeMode) tCurrentItem.stackSize--; GT_Utility.sendSoundToPlayers( - worldObj, SoundResource.IC2_TOOLS_WRENCH, 1.0F, -1, xCoord, yCoord, zCoord); + worldObj, + SoundResource.IC2_TOOLS_WRENCH, + 1.0F, + -1, + xCoord, + yCoord, + zCoord); } return true; } @@ -1612,7 +1632,13 @@ public class BaseMetaTileEntity extends CommonMetaTileEntity 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); + worldObj, + SoundResource.RANDOM_BREAK, + 1.0F, + -1, + xCoord, + yCoord, + zCoord); dropCover(coverSide, aSide, false); } return true; @@ -1620,29 +1646,26 @@ public class BaseMetaTileEntity extends CommonMetaTileEntity } // End item != null } 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 = (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 (!getCoverInfoAtSide(aSide).isGUIClickable()) return false; @@ -1650,7 +1673,13 @@ public class BaseMetaTileEntity extends CommonMetaTileEntity if (ItemList.Upgrade_Muffler.isStackEqual(aPlayer.inventory.getCurrentItem())) { if (addMufflerUpgrade()) { GT_Utility.sendSoundToPlayers( - worldObj, SoundResource.RANDOM_CLICK, 1.0F, -1, xCoord, yCoord, zCoord); + worldObj, + SoundResource.RANDOM_CLICK, + 1.0F, + -1, + xCoord, + yCoord, + zCoord); if (!aPlayer.capabilities.isCreativeMode) aPlayer.inventory.getCurrentItem().stackSize--; } return true; @@ -1661,7 +1690,13 @@ public class BaseMetaTileEntity extends CommonMetaTileEntity setOwnerName(aPlayer.getDisplayName()); setOwnerUuid(aPlayer.getUniqueID()); GT_Utility.sendSoundToPlayers( - worldObj, SoundResource.RANDOM_CLICK, 1.0F, -1, xCoord, yCoord, zCoord); + worldObj, + SoundResource.RANDOM_CLICK, + 1.0F, + -1, + xCoord, + yCoord, + zCoord); if (!aPlayer.capabilities.isCreativeMode) aPlayer.inventory.getCurrentItem().stackSize--; } return true; @@ -1726,8 +1761,8 @@ public class BaseMetaTileEntity extends CommonMetaTileEntity } /** - * returns all valid Inventory Slots, no matter which Side (Unless it's covered). - * The Side Stuff is done in the following two Functions. + * returns all valid Inventory Slots, no matter which Side (Unless it's covered). The Side Stuff is done in the + * following two Functions. */ @Override public int[] getAccessibleSlotsFromSide(int aSide) { @@ -1742,8 +1777,7 @@ public class BaseMetaTileEntity extends CommonMetaTileEntity */ @Override public boolean canInsertItem(int aIndex, ItemStack aStack, int aSide) { - return canAccessData() - && (mRunningThroughTick || !mInputDisabled) + return canAccessData() && (mRunningThroughTick || !mInputDisabled) && getCoverInfoAtSide((byte) aSide).letsItemsIn(aIndex) && mMetaTileEntity.canInsertItem(aIndex, aStack, aSide); } @@ -1753,15 +1787,13 @@ public class BaseMetaTileEntity extends CommonMetaTileEntity */ @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) + return canAccessData() && (mRunningThroughTick || !mOutputDisabled) + && getCoverBehaviorAtSideNew((byte) aSide).letsItemsOut( + (byte) aSide, + getCoverIDAtSide((byte) aSide), + getComplexCoverDataAtSide((byte) aSide), + aIndex, + this) && mMetaTileEntity.canExtractItem(aIndex, aStack, aSide); } @@ -1915,13 +1947,13 @@ public class BaseMetaTileEntity extends CommonMetaTileEntity @Override public long injectEnergyUnits(byte aSide, long aVoltage, long aAmperage) { - if (!canAccessData() - || !mMetaTileEntity.isElectric() + if (!canAccessData() || !mMetaTileEntity.isElectric() || !inputEnergyFrom(aSide) || aAmperage <= 0 || aVoltage <= 0 || getStoredEU() >= getEUCapacity() - || mMetaTileEntity.maxAmperesIn() <= mAcceptedAmperes) return 0; + || mMetaTileEntity.maxAmperesIn() <= mAcceptedAmperes) + return 0; if (aVoltage > getInputVoltage()) { GT_Log.exp.println( "Energy Explosion, injected " + aVoltage + "EU/t in a " + getInputVoltage() + "EU/t Machine!"); @@ -1929,12 +1961,11 @@ public class BaseMetaTileEntity extends CommonMetaTileEntity return 0; } if (increaseStoredEnergyUnits( - aVoltage - * (aAmperage = Math.min( - aAmperage, - Math.min( - mMetaTileEntity.maxAmperesIn() - mAcceptedAmperes, - 1 + ((getEUCapacity() - getStoredEU()) / aVoltage)))), + aVoltage * (aAmperage = Math.min( + aAmperage, + Math.min( + mMetaTileEntity.maxAmperesIn() - mAcceptedAmperes, + 1 + ((getEUCapacity() - getStoredEU()) / aVoltage)))), true)) { mAverageEUInput[mAverageEUInputIndex] += aVoltage * aAmperage; mAcceptedAmperes += aAmperage; @@ -1945,10 +1976,10 @@ public class BaseMetaTileEntity extends CommonMetaTileEntity @Override public boolean drainEnergyUnits(byte aSide, long aVoltage, long aAmperage) { - if (!canAccessData() - || !mMetaTileEntity.isElectric() + if (!canAccessData() || !mMetaTileEntity.isElectric() || !outputsEnergyTo(aSide) - || getStoredEU() - (aVoltage * aAmperage) < mMetaTileEntity.getMinimumStoredEU()) return false; + || getStoredEU() - (aVoltage * aAmperage) < mMetaTileEntity.getMinimumStoredEU()) + return false; if (decreaseStoredEU(aVoltage * aAmperage, false)) { mAverageEUOutput[mAverageEUOutputIndex] += aVoltage * aAmperage; return true; @@ -1970,68 +2001,53 @@ public class BaseMetaTileEntity extends CommonMetaTileEntity @Override public int fill(ForgeDirection aSide, FluidStack aFluid, boolean doFill) { - if (mTickTimer > 5 - && canAccessData() + if (mTickTimer > 5 && canAccessData() && (mRunningThroughTick || !mInputDisabled) - && (aSide == ForgeDirection.UNKNOWN - || (mMetaTileEntity.isLiquidInput((byte) aSide.ordinal()) - && getCoverInfoAtSide((byte) aSide.ordinal()) - .letsFluidIn(aFluid == null ? null : aFluid.getFluid())))) + && (aSide == ForgeDirection.UNKNOWN || (mMetaTileEntity.isLiquidInput((byte) aSide.ordinal()) + && getCoverInfoAtSide((byte) aSide.ordinal()) + .letsFluidIn(aFluid == null ? null : aFluid.getFluid())))) return mMetaTileEntity.fill(aSide, aFluid, doFill); return 0; } @Override public FluidStack drain(ForgeDirection aSide, int maxDrain, boolean doDrain) { - if (mTickTimer > 5 - && canAccessData() + if (mTickTimer > 5 && canAccessData() && (mRunningThroughTick || !mOutputDisabled) - && (aSide == ForgeDirection.UNKNOWN - || (mMetaTileEntity.isLiquidOutput((byte) aSide.ordinal()) - && getCoverInfoAtSide((byte) aSide.ordinal()) - .letsFluidOut( - mMetaTileEntity.getFluid() == null - ? null - : mMetaTileEntity - .getFluid() - .getFluid())))) + && (aSide == ForgeDirection.UNKNOWN || (mMetaTileEntity.isLiquidOutput((byte) aSide.ordinal()) + && getCoverInfoAtSide((byte) aSide.ordinal()).letsFluidOut( + mMetaTileEntity.getFluid() == null ? null : mMetaTileEntity.getFluid().getFluid())))) return mMetaTileEntity.drain(aSide, maxDrain, doDrain); return null; } @Override public FluidStack drain(ForgeDirection aSide, FluidStack aFluid, boolean doDrain) { - if (mTickTimer > 5 - && canAccessData() + if (mTickTimer > 5 && canAccessData() && (mRunningThroughTick || !mOutputDisabled) - && (aSide == ForgeDirection.UNKNOWN - || (mMetaTileEntity.isLiquidOutput((byte) aSide.ordinal()) - && getCoverInfoAtSide((byte) aSide.ordinal()) - .letsFluidOut(aFluid == null ? null : aFluid.getFluid())))) + && (aSide == ForgeDirection.UNKNOWN || (mMetaTileEntity.isLiquidOutput((byte) aSide.ordinal()) + && getCoverInfoAtSide((byte) aSide.ordinal()) + .letsFluidOut(aFluid == null ? null : aFluid.getFluid())))) return mMetaTileEntity.drain(aSide, aFluid, doDrain); return null; } @Override public boolean canFill(ForgeDirection aSide, Fluid aFluid) { - if (mTickTimer > 5 - && canAccessData() + if (mTickTimer > 5 && canAccessData() && (mRunningThroughTick || !mInputDisabled) - && (aSide == ForgeDirection.UNKNOWN - || (mMetaTileEntity.isLiquidInput((byte) aSide.ordinal()) - && getCoverInfoAtSide((byte) aSide.ordinal()).letsFluidIn(aFluid)))) + && (aSide == ForgeDirection.UNKNOWN || (mMetaTileEntity.isLiquidInput((byte) aSide.ordinal()) + && getCoverInfoAtSide((byte) aSide.ordinal()).letsFluidIn(aFluid)))) return mMetaTileEntity.canFill(aSide, aFluid); return false; } @Override public boolean canDrain(ForgeDirection aSide, Fluid aFluid) { - if (mTickTimer > 5 - && canAccessData() + if (mTickTimer > 5 && canAccessData() && (mRunningThroughTick || !mOutputDisabled) - && (aSide == ForgeDirection.UNKNOWN - || (mMetaTileEntity.isLiquidOutput((byte) aSide.ordinal()) - && getCoverInfoAtSide((byte) aSide.ordinal()).letsFluidOut(aFluid)))) + && (aSide == ForgeDirection.UNKNOWN || (mMetaTileEntity.isLiquidOutput((byte) aSide.ordinal()) + && getCoverInfoAtSide((byte) aSide.ordinal()).letsFluidOut(aFluid)))) return mMetaTileEntity.canDrain(aSide, aFluid); return false; } @@ -2040,12 +2056,9 @@ public class BaseMetaTileEntity extends CommonMetaTileEntity public FluidTankInfo[] getTankInfo(ForgeDirection aSide) { final byte tSide = (byte) aSide.ordinal(); - if (canAccessData() - && (aSide == ForgeDirection.UNKNOWN - || (mMetaTileEntity.isLiquidInput(tSide) - && getCoverInfoAtSide(tSide).letsFluidIn(null)) - || (mMetaTileEntity.isLiquidOutput(tSide) - && getCoverInfoAtSide(tSide).letsFluidOut(null)))) + if (canAccessData() && (aSide == ForgeDirection.UNKNOWN + || (mMetaTileEntity.isLiquidInput(tSide) && getCoverInfoAtSide(tSide).letsFluidIn(null)) + || (mMetaTileEntity.isLiquidOutput(tSide) && getCoverInfoAtSide(tSide).letsFluidOut(null)))) return mMetaTileEntity.getTankInfo(aSide); return new FluidTankInfo[] {}; } @@ -2157,9 +2170,8 @@ public class BaseMetaTileEntity extends CommonMetaTileEntity 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; @@ -2216,14 +2228,8 @@ public class BaseMetaTileEntity extends CommonMetaTileEntity } @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); } @@ -2238,9 +2244,9 @@ public class BaseMetaTileEntity extends CommonMetaTileEntity } /** - * Shifts the machine Inventory index according to the change in Input/Output Slots. - * This is NOT done automatically. If you want to change slot count for a machine this method needs to be adapted. - * Currently this method only works for GT_MetaTileEntity_BasicMachine + * Shifts the machine Inventory index according to the change in Input/Output Slots. This is NOT done automatically. + * If you want to change slot count for a machine this method needs to be adapted. Currently this method only works + * for GT_MetaTileEntity_BasicMachine * * @param slotIndex The original Inventory index * @param nbtVersion The GregTech version in which the original Inventory Index was saved. @@ -2256,9 +2262,9 @@ public class BaseMetaTileEntity extends CommonMetaTileEntity final int configCircuitAdditionVersion = GT_Mod.calculateTotalGTVersion(509, 40); final int wireAdditionVersion = GT_Mod.calculateTotalGTVersion(509, 41); // 4 is old GT_MetaTileEntity_BasicMachine.OTHER_SLOT_COUNT - if (nbtVersion < configCircuitAdditionVersion - && getMetaTileEntity() instanceof GT_MetaTileEntity_BasicMachine - && slotIndex >= 4) slotIndex += 1; + if (nbtVersion < configCircuitAdditionVersion && getMetaTileEntity() instanceof GT_MetaTileEntity_BasicMachine + && slotIndex >= 4) + slotIndex += 1; if (mID >= 211 && mID <= 218) { // Assembler if (nbtVersion < chemistryUpdateVersion) { oldInputSize = 2; diff --git a/src/main/java/gregtech/api/metatileentity/BaseTileEntity.java b/src/main/java/gregtech/api/metatileentity/BaseTileEntity.java index 23a247468a..31d388cf71 100644 --- a/src/main/java/gregtech/api/metatileentity/BaseTileEntity.java +++ b/src/main/java/gregtech/api/metatileentity/BaseTileEntity.java @@ -7,6 +7,33 @@ 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 java.util.Arrays; +import java.util.List; +import java.util.concurrent.ThreadLocalRandom; +import java.util.concurrent.atomic.AtomicBoolean; +import java.util.function.Supplier; + +import net.minecraft.block.Block; +import net.minecraft.client.Minecraft; +import net.minecraft.client.gui.FontRenderer; +import net.minecraft.entity.Entity; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.init.Blocks; +import net.minecraft.inventory.IInventory; +import net.minecraft.item.ItemStack; +import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.tileentity.TileEntity; +import net.minecraft.util.ChunkCoordinates; +import net.minecraft.util.EnumChatFormatting; +import net.minecraft.util.MathHelper; +import net.minecraft.util.StatCollector; +import net.minecraft.world.World; +import net.minecraft.world.biome.BiomeGenBase; +import net.minecraft.world.chunk.Chunk; +import net.minecraftforge.common.MinecraftForge; +import net.minecraftforge.common.util.ForgeDirection; +import net.minecraftforge.fluids.IFluidHandler; + import com.gtnewhorizons.modularui.api.drawable.IDrawable; import com.gtnewhorizons.modularui.api.drawable.ItemDrawable; import com.gtnewhorizons.modularui.api.forge.ItemStackHandler; @@ -22,6 +49,7 @@ import com.gtnewhorizons.modularui.common.widget.MultiChildWidget; import com.gtnewhorizons.modularui.common.widget.SlotGroup; import com.gtnewhorizons.modularui.common.widget.SlotWidget; import com.gtnewhorizons.modularui.common.widget.TextWidget; + import gregtech.GT_Mod; import gregtech.api.enums.Dyes; import gregtech.api.enums.GT_Values; @@ -43,61 +71,33 @@ import gregtech.api.util.GT_Utility; import gregtech.common.gui.modularui.uifactory.SelectItemUIFactory; import ic2.api.energy.event.EnergyTileLoadEvent; import ic2.api.energy.event.EnergyTileUnloadEvent; -import java.util.Arrays; -import java.util.List; -import java.util.concurrent.ThreadLocalRandom; -import java.util.concurrent.atomic.AtomicBoolean; -import java.util.function.Supplier; -import net.minecraft.block.Block; -import net.minecraft.client.Minecraft; -import net.minecraft.client.gui.FontRenderer; -import net.minecraft.entity.Entity; -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.init.Blocks; -import net.minecraft.inventory.IInventory; -import net.minecraft.item.ItemStack; -import net.minecraft.nbt.NBTTagCompound; -import net.minecraft.tileentity.TileEntity; -import net.minecraft.util.ChunkCoordinates; -import net.minecraft.util.EnumChatFormatting; -import net.minecraft.util.MathHelper; -import net.minecraft.util.StatCollector; -import net.minecraft.world.World; -import net.minecraft.world.biome.BiomeGenBase; -import net.minecraft.world.chunk.Chunk; -import net.minecraftforge.common.MinecraftForge; -import net.minecraftforge.common.util.ForgeDirection; -import net.minecraftforge.fluids.IFluidHandler; /** * The Functions my old TileEntities and my BaseMetaTileEntities have in common. * <p/> * Basically everything a TileEntity should have. */ -public abstract class BaseTileEntity extends TileEntity - implements IHasWorldObjectAndCoords, - IIC2Enet, - IGTEnet, - ITileWithModularUI, - IAddGregtechLogo, - IGetGUITextureSet, - IAddInventorySlots { +public abstract class BaseTileEntity extends TileEntity implements IHasWorldObjectAndCoords, IIC2Enet, IGTEnet, + ITileWithModularUI, IAddGregtechLogo, IGetGUITextureSet, IAddInventorySlots { + protected boolean mInventoryChanged = false; /** * Buffers adjacent TileEntities for faster access * <p/> - * "this" means that there is no TileEntity, while "null" means that it doesn't know if there is even a TileEntity and still needs to check that if needed. + * "this" means that there is no TileEntity, while "null" means that it doesn't know if there is even a TileEntity + * and still needs to check that if needed. */ private final TileEntity[] mBufferedTileEntities = new TileEntity[6]; /** - * If this TileEntity checks for the Chunk to be loaded before returning World based values. - * The AdvPump hacks this to false to ensure everything runs properly even when far Chunks are not actively loaded. - * But anything else should not cause worfin' Chunks, uhh I mean orphan Chunks. + * If this TileEntity checks for the Chunk to be loaded before returning World based values. The AdvPump hacks this + * to false to ensure everything runs properly even when far Chunks are not actively loaded. But anything else + * should not cause worfin' Chunks, uhh I mean orphan Chunks. */ public boolean ignoreUnloadedChunks = true; /** - * This Variable checks if this TileEntity is dead, because Minecraft is too stupid to have proper TileEntity unloading. + * This Variable checks if this TileEntity is dead, because Minecraft is too stupid to have proper TileEntity + * unloading. */ public boolean isDead = false; @@ -107,8 +107,8 @@ public abstract class BaseTileEntity extends TileEntity 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; @@ -407,9 +407,9 @@ public abstract class BaseTileEntity extends TileEntity 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); } @@ -471,8 +471,7 @@ public abstract class BaseTileEntity extends TileEntity mBufferedTileEntities[aSide] = null; return getTileEntityAtSide(aSide); } - if (mBufferedTileEntities[aSide].xCoord == tX - && mBufferedTileEntities[aSide].yCoord == tY + if (mBufferedTileEntities[aSide].xCoord == tX && mBufferedTileEntities[aSide].yCoord == tY && mBufferedTileEntities[aSide].zCoord == tZ) { return mBufferedTileEntities[aSide]; } @@ -531,8 +530,8 @@ public abstract class BaseTileEntity extends TileEntity // update if it was / is strong powered. if (((((mStrongRedstone | oStrongRedstone) >>> dir.ordinal()) & 1) != 0) && getBlock(x1, y1, z1).isNormalCube()) { - final int skipUpdateSide = dir.getOpposite() - .ordinal(); // Don't update this block. Still updates diagonal blocks twice if conditions + final int skipUpdateSide = dir.getOpposite().ordinal(); // Don't update this block. Still updates + // diagonal blocks twice if conditions // meet. for (final ForgeDirection dir2 : ForgeDirection.VALID_DIRECTIONS) { @@ -548,7 +547,10 @@ public abstract class BaseTileEntity extends TileEntity @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); + worldObj, + new GT_Packet_Block_Event(xCoord, (short) yCoord, zCoord, aID, aValue), + xCoord, + zCoord); } protected boolean crossedChunkBorder(int aX, int aZ) { @@ -679,8 +681,7 @@ public abstract class BaseTileEntity extends TileEntity public void addUIWidgets(ModularWindow.Builder builder, UIBuildContext buildContext) {} public void bindPlayerInventoryUI(ModularWindow.Builder builder, UIBuildContext buildContext) { - builder.bindPlayerInventory( - buildContext.getPlayer(), 7, getGUITextureSet().getItemSlot()); + builder.bindPlayerInventory(buildContext.getPlayer(), 7, getGUITextureSet().getItemSlot()); } public String getLocalName() { @@ -705,29 +706,24 @@ public abstract class BaseTileEntity extends TileEntity int titleWidth = 0, titleHeight = 0; if (NetworkUtils.isClient()) { final FontRenderer fontRenderer = Minecraft.getMinecraft().fontRenderer; - //noinspection unchecked - final List<String> titleLines = - fontRenderer.listFormattedStringToWidth(title, getGUIWidth() - (TAB_PADDING + TITLE_PADDING) * 2); - titleWidth = titleLines.size() > 1 - ? getGUIWidth() - (TAB_PADDING + TITLE_PADDING) * 2 + // noinspection unchecked + final List<String> titleLines = fontRenderer + .listFormattedStringToWidth(title, getGUIWidth() - (TAB_PADDING + TITLE_PADDING) * 2); + titleWidth = titleLines.size() > 1 ? getGUIWidth() - (TAB_PADDING + TITLE_PADDING) * 2 : fontRenderer.getStringWidth(title); - //noinspection PointlessArithmeticExpression + // noinspection PointlessArithmeticExpression titleHeight = titleLines.size() * fontRenderer.FONT_HEIGHT + (titleLines.size() - 1) * 1; } final DrawableWidget tab = new DrawableWidget(); - final TextWidget text = new TextWidget(title) - .setDefaultColor(getTitleColor()) - .setTextAlignment(Alignment.CenterLeft) - .setMaxWidth(titleWidth); + final TextWidget text = new TextWidget(title).setDefaultColor(getTitleColor()) + .setTextAlignment(Alignment.CenterLeft).setMaxWidth(titleWidth); if (GT_Mod.gregtechproxy.mTitleTabStyle == 1) { - tab.setDrawable(getGUITextureSet().getTitleTabAngular()) - .setPos(0, -(titleHeight + TAB_PADDING) + 1) + tab.setDrawable(getGUITextureSet().getTitleTabAngular()).setPos(0, -(titleHeight + TAB_PADDING) + 1) .setSize(getGUIWidth(), titleHeight + TAB_PADDING * 2); text.setPos(TAB_PADDING + TITLE_PADDING, -titleHeight + TAB_PADDING); } else { - tab.setDrawable(getGUITextureSet().getTitleTabDark()) - .setPos(0, -(titleHeight + TAB_PADDING * 2) + 1) + tab.setDrawable(getGUITextureSet().getTitleTabDark()).setPos(0, -(titleHeight + TAB_PADDING * 2) + 1) .setSize(titleWidth + (TAB_PADDING + TITLE_PADDING) * 2, titleHeight + TAB_PADDING * 2 - 1); text.setPos(TAB_PADDING + TITLE_PADDING, -titleHeight); } @@ -735,15 +731,13 @@ public abstract class BaseTileEntity extends TileEntity } protected void addTitleItemIconStyle(ModularWindow.Builder builder, String title) { - builder.widget(new MultiChildWidget() - .addChild(new DrawableWidget() - .setDrawable(getGUITextureSet().getTitleTabNormal()) - .setPos(0, 0) - .setSize(24, 24)) - .addChild(new ItemDrawable(getStackForm(1)).asWidget().setPos(4, 4)) - .addTooltip(title) - .setTooltipShowUpDelay(TOOLTIP_DELAY) - .setPos(0, -24 + 3)); + builder.widget( + new MultiChildWidget() + .addChild( + new DrawableWidget().setDrawable(getGUITextureSet().getTitleTabNormal()).setPos(0, 0) + .setSize(24, 24)) + .addChild(new ItemDrawable(getStackForm(1)).asWidget().setPos(4, 4)).addTooltip(title) + .setTooltipShowUpDelay(TOOLTIP_DELAY).setPos(0, -24 + 3)); } @Override @@ -757,10 +751,8 @@ public abstract class BaseTileEntity extends TileEntity @Override public void addGregTechLogo(ModularWindow.Builder builder) { - builder.widget(new DrawableWidget() - .setDrawable(getGUITextureSet().getGregTechLogo()) - .setSize(17, 17) - .setPos(152, 63)); + builder.widget( + new DrawableWidget().setDrawable(getGUITextureSet().getGregTechLogo()).setSize(17, 17).setPos(152, 63)); } protected int getGUIWidth() { @@ -781,14 +773,11 @@ public abstract class BaseTileEntity extends TileEntity if (inventoryHandler == null) return; if (background.length == 0) { - background = new IDrawable[] {getGUITextureSet().getItemSlot()}; + background = new IDrawable[] { getGUITextureSet().getItemSlot() }; } - builder.widget(SlotGroup.ofItemHandler(inventoryHandler, 1) - .startFromSlot(0) - .endAtSlot(0) - .background(background) - .build() - .setPos(79, 34)); + builder.widget( + SlotGroup.ofItemHandler(inventoryHandler, 1).startFromSlot(0).endAtSlot(0).background(background) + .build().setPos(79, 34)); } @Override @@ -797,14 +786,11 @@ public abstract class BaseTileEntity extends TileEntity if (inventoryHandler == null) return; if (background.length == 0) { - background = new IDrawable[] {getGUITextureSet().getItemSlot()}; + background = new IDrawable[] { getGUITextureSet().getItemSlot() }; } - builder.widget(SlotGroup.ofItemHandler(inventoryHandler, 2) - .startFromSlot(0) - .endAtSlot(3) - .background(background) - .build() - .setPos(70, 25)); + builder.widget( + SlotGroup.ofItemHandler(inventoryHandler, 2).startFromSlot(0).endAtSlot(3).background(background) + .build().setPos(70, 25)); } @Override @@ -813,14 +799,11 @@ public abstract class BaseTileEntity extends TileEntity if (inventoryHandler == null) return; if (background.length == 0) { - background = new IDrawable[] {getGUITextureSet().getItemSlot()}; + background = new IDrawable[] { getGUITextureSet().getItemSlot() }; } - builder.widget(SlotGroup.ofItemHandler(inventoryHandler, 3) - .startFromSlot(0) - .endAtSlot(8) - .background(background) - .build() - .setPos(61, 16)); + builder.widget( + SlotGroup.ofItemHandler(inventoryHandler, 3).startFromSlot(0).endAtSlot(8).background(background) + .build().setPos(61, 16)); } @Override @@ -829,14 +812,11 @@ public abstract class BaseTileEntity extends TileEntity if (inventoryHandler == null) return; if (background.length == 0) { - background = new IDrawable[] {getGUITextureSet().getItemSlot()}; + background = new IDrawable[] { getGUITextureSet().getItemSlot() }; } - builder.widget(SlotGroup.ofItemHandler(inventoryHandler, 4) - .startFromSlot(0) - .endAtSlot(15) - .background(background) - .build() - .setPos(52, 7)); + builder.widget( + SlotGroup.ofItemHandler(inventoryHandler, 4).startFromSlot(0).endAtSlot(15).background(background) + .build().setPos(52, 7)); } public void addCoverTabs(ModularWindow.Builder builder, UIBuildContext buildContext) { @@ -859,76 +839,65 @@ public abstract class BaseTileEntity extends TileEntity if (ccs == null) return; final AtomicBoolean dialogOpened = new AtomicBoolean(false); - builder.widget( - new SlotWidget(new BaseSlot(inventoryHandler, ccs.getCircuitSlot(), true)) { - @Override - protected void phantomClick(ClickData clickData, ItemStack cursorStack) { - final ItemStack newCircuit; - if (clickData.shift) { - if (clickData.mouseButton == 0) { - if (NetworkUtils.isClient() && !dialogOpened.get()) { - openSelectCircuitDialog(getContext(), dialogOpened); - } - return; - } else { - newCircuit = null; - } + builder.widget(new SlotWidget(new BaseSlot(inventoryHandler, ccs.getCircuitSlot(), true)) { + + @Override + protected void phantomClick(ClickData clickData, ItemStack cursorStack) { + final ItemStack newCircuit; + if (clickData.shift) { + if (clickData.mouseButton == 0) { + if (NetworkUtils.isClient() && !dialogOpened.get()) { + openSelectCircuitDialog(getContext(), dialogOpened); + } + return; + } else { + newCircuit = null; + } + } else { + final List<ItemStack> tCircuits = ccs.getConfigurationCircuits(); + final int index = GT_Utility.findMatchingStackInList(tCircuits, cursorStack); + if (index < 0) { + int curIndex = GT_Utility + .findMatchingStackInList(tCircuits, inv.getStackInSlot(ccs.getCircuitSlot())) + 1; + if (clickData.mouseButton == 0) { + curIndex += 1; } else { - final List<ItemStack> tCircuits = ccs.getConfigurationCircuits(); - final int index = GT_Utility.findMatchingStackInList(tCircuits, cursorStack); - if (index < 0) { - int curIndex = GT_Utility.findMatchingStackInList( - tCircuits, inv.getStackInSlot(ccs.getCircuitSlot())) - + 1; - if (clickData.mouseButton == 0) { - curIndex += 1; - } else { - curIndex -= 1; - } - curIndex = Math.floorMod(curIndex, tCircuits.size() + 1) - 1; - newCircuit = curIndex < 0 ? null : tCircuits.get(curIndex); - } else { - // set to whatever it is - newCircuit = tCircuits.get(index); - } + curIndex -= 1; } - inv.setInventorySlotContents(ccs.getCircuitSlot(), newCircuit); + curIndex = Math.floorMod(curIndex, tCircuits.size() + 1) - 1; + newCircuit = curIndex < 0 ? null : tCircuits.get(curIndex); + } else { + // set to whatever it is + newCircuit = tCircuits.get(index); } + } + inv.setInventorySlotContents(ccs.getCircuitSlot(), newCircuit); + } - @Override - protected void phantomScroll(int direction) { - phantomClick(new ClickData(direction > 0 ? 1 : 0, false, false, false)); - } + @Override + protected void phantomScroll(int direction) { + phantomClick(new ClickData(direction > 0 ? 1 : 0, false, false, false)); + } - @Override - public List<String> getExtraTooltip() { - return Arrays.asList( - EnumChatFormatting.DARK_GRAY - + EnumChatFormatting.getTextWithoutFormattingCodes( - StatCollector.translateToLocal( - "GT5U.machines.select_circuit.tooltip.1")), - EnumChatFormatting.DARK_GRAY - + EnumChatFormatting.getTextWithoutFormattingCodes( - StatCollector.translateToLocal( - "GT5U.machines.select_circuit.tooltip.2")), - EnumChatFormatting.DARK_GRAY - + EnumChatFormatting.getTextWithoutFormattingCodes( - StatCollector.translateToLocal( - "GT5U.machines.select_circuit.tooltip.3"))); - } - }.setOverwriteItemStackTooltip(list -> { - list.removeIf(line -> - line.contains(StatCollector.translateToLocal("gt.integrated_circuit.tooltip.0")) - || line.contains( - StatCollector.translateToLocal("gt.integrated_circuit.tooltip.1"))); - return list; - }) - .disableShiftInsert() - .setHandlePhantomActionClient(true) - .setBackground(getGUITextureSet().getItemSlot(), GT_UITextures.OVERLAY_SLOT_INT_CIRCUIT) - .setGTTooltip(() -> mTooltipCache.getData("GT5U.machines.select_circuit.tooltip")) - .setTooltipShowUpDelay(TOOLTIP_DELAY) - .setPos(ccs.getCircuitSlotX() - 1, ccs.getCircuitSlotY() - 1)); + @Override + public List<String> getExtraTooltip() { + return Arrays.asList( + EnumChatFormatting.DARK_GRAY + EnumChatFormatting.getTextWithoutFormattingCodes( + StatCollector.translateToLocal("GT5U.machines.select_circuit.tooltip.1")), + EnumChatFormatting.DARK_GRAY + EnumChatFormatting.getTextWithoutFormattingCodes( + StatCollector.translateToLocal("GT5U.machines.select_circuit.tooltip.2")), + EnumChatFormatting.DARK_GRAY + EnumChatFormatting.getTextWithoutFormattingCodes( + StatCollector.translateToLocal("GT5U.machines.select_circuit.tooltip.3"))); + } + }.setOverwriteItemStackTooltip(list -> { + list.removeIf( + line -> line.contains(StatCollector.translateToLocal("gt.integrated_circuit.tooltip.0")) + || line.contains(StatCollector.translateToLocal("gt.integrated_circuit.tooltip.1"))); + return list; + }).disableShiftInsert().setHandlePhantomActionClient(true) + .setBackground(getGUITextureSet().getItemSlot(), GT_UITextures.OVERLAY_SLOT_INT_CIRCUIT) + .setGTTooltip(() -> mTooltipCache.getData("GT5U.machines.select_circuit.tooltip")) + .setTooltipShowUpDelay(TOOLTIP_DELAY).setPos(ccs.getCircuitSlotX() - 1, ccs.getCircuitSlotY() - 1)); } protected void openSelectCircuitDialog(ModularUIContext uiContext, AtomicBoolean dialogOpened) { @@ -939,16 +908,16 @@ public abstract class BaseTileEntity extends TileEntity final IInventory inv = (IInventory) this; final List<ItemStack> circuits = ccs.getConfigurationCircuits(); - uiContext.openClientWindow(player -> new SelectItemUIFactory( + uiContext.openClientWindow( + player -> new SelectItemUIFactory( StatCollector.translateToLocal("GT5U.machines.select_circuit"), getStackForm(0), this::onCircuitSelected, circuits, GT_Utility.findMatchingStackInList(circuits, inv.getStackInSlot(ccs.getCircuitSlot()))) - .setAnotherWindow(true, dialogOpened) - .setGuiTint(getGUIColorization()) - .setCurrentGetter(() -> inv.getStackInSlot(ccs.getCircuitSlot())) - .createWindow(new UIBuildContext(player))); + .setAnotherWindow(true, dialogOpened).setGuiTint(getGUIColorization()) + .setCurrentGetter(() -> inv.getStackInSlot(ccs.getCircuitSlot())) + .createWindow(new UIBuildContext(player))); } protected void onCircuitSelected(ItemStack selected) { diff --git a/src/main/java/gregtech/api/metatileentity/CommonMetaTileEntity.java b/src/main/java/gregtech/api/metatileentity/CommonMetaTileEntity.java index e2860d6292..a49071cdcf 100644 --- a/src/main/java/gregtech/api/metatileentity/CommonMetaTileEntity.java +++ b/src/main/java/gregtech/api/metatileentity/CommonMetaTileEntity.java @@ -2,9 +2,15 @@ package gregtech.api.metatileentity; import static gregtech.GT_Mod.GT_FML_LOGGER; +import net.minecraft.item.ItemStack; +import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.nbt.NBTTagList; +import net.minecraft.network.Packet; + import com.gtnewhorizons.modularui.api.forge.ItemStackHandler; import com.gtnewhorizons.modularui.api.screen.ModularWindow; import com.gtnewhorizons.modularui.api.screen.UIBuildContext; + import gregtech.GT_Mod; import gregtech.api.GregTech_API; import gregtech.api.gui.modularui.GUITextureSet; @@ -18,12 +24,9 @@ import gregtech.api.interfaces.tileentity.IGregTechTileEntity; import gregtech.api.objects.GT_ItemStack; import gregtech.api.util.GT_Log; import gregtech.api.util.GT_Utility; -import net.minecraft.item.ItemStack; -import net.minecraft.nbt.NBTTagCompound; -import net.minecraft.nbt.NBTTagList; -import net.minecraft.network.Packet; public abstract class CommonMetaTileEntity extends CoverableTileEntity implements IGregTechTileEntity { + protected boolean mNeedsBlockUpdate = true, mNeedsUpdate = true, mSendClientData = false, mInventoryChanged = false; protected boolean createNewMetatileEntity(short aID) { @@ -89,8 +92,8 @@ public abstract class CommonMetaTileEntity extends CoverableTileEntity implement } /** - * Shifts the machine Inventory index according to the change in Input/Output Slots. - * Default implementation does not do anything to the slotIndex. + * Shifts the machine Inventory index according to the change in Input/Output Slots. Default implementation does not + * do anything to the slotIndex. */ protected int migrateInventoryIndex(int slotIndex, int nbtVersion) { return slotIndex; diff --git a/src/main/java/gregtech/api/metatileentity/CoverableTileEntity.java b/src/main/java/gregtech/api/metatileentity/CoverableTileEntity.java index 69f51730f4..5b469ddb00 100644 --- a/src/main/java/gregtech/api/metatileentity/CoverableTileEntity.java +++ b/src/main/java/gregtech/api/metatileentity/CoverableTileEntity.java @@ -6,6 +6,30 @@ 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 java.util.ArrayList; +import java.util.Arrays; +import java.util.Collections; +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.client.Minecraft; +import net.minecraft.entity.item.EntityItem; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.entity.player.EntityPlayerMP; +import net.minecraft.item.ItemStack; +import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.nbt.NBTTagList; +import net.minecraft.tileentity.TileEntity; +import net.minecraft.util.EnumChatFormatting; +import net.minecraft.util.StatCollector; +import net.minecraft.world.World; +import net.minecraftforge.common.util.ForgeDirection; +import net.minecraftforge.fluids.FluidRegistry; + import com.gtnewhorizons.modularui.api.drawable.IDrawable; import com.gtnewhorizons.modularui.api.drawable.ItemDrawable; import com.gtnewhorizons.modularui.api.math.MainAxisAlignment; @@ -15,6 +39,7 @@ import com.gtnewhorizons.modularui.api.widget.Widget; import com.gtnewhorizons.modularui.common.widget.ButtonWidget; import com.gtnewhorizons.modularui.common.widget.Column; import com.gtnewhorizons.modularui.common.widget.MultiChildWidget; + import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; import gregtech.GT_Mod; @@ -35,60 +60,33 @@ import gregtech.api.util.ISerializableObject; import gregtech.common.GT_Client; import gregtech.common.covers.CoverInfo; import gregtech.common.covers.GT_Cover_Fluidfilter; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.Collections; -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.client.Minecraft; -import net.minecraft.entity.item.EntityItem; -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.entity.player.EntityPlayerMP; -import net.minecraft.item.ItemStack; -import net.minecraft.nbt.NBTTagCompound; -import net.minecraft.nbt.NBTTagList; -import net.minecraft.tileentity.TileEntity; -import net.minecraft.util.EnumChatFormatting; -import net.minecraft.util.StatCollector; -import net.minecraft.world.World; -import net.minecraftforge.common.util.ForgeDirection; -import net.minecraftforge.fluids.FluidRegistry; public abstract class CoverableTileEntity extends BaseTileEntity implements ICoverable, IGregtechWailaProvider { + public static final String[] COVER_DATA_NBT_KEYS = Arrays.stream(ForgeDirection.VALID_DIRECTIONS) - .mapToInt(Enum::ordinal) - .mapToObj(i -> "mCoverData" + i) - .toArray(String[]::new); + .mapToInt(Enum::ordinal).mapToObj(i -> "mCoverData" + i).toArray(String[]::new); // New Cover Information - protected final CoverInfo[] coverInfos = new CoverInfo[] {null, null, null, null, null, null}; + protected final CoverInfo[] coverInfos = new CoverInfo[] { null, null, null, null, null, null }; - protected byte[] mSidedRedstone = new byte[] {15, 15, 15, 15, 15, 15}; + protected byte[] mSidedRedstone = new byte[] { 15, 15, 15, 15, 15, 15 }; protected boolean mRedstone = false; protected byte mStrongRedstone = 0; /* Deprecated Cover Variables */ @Deprecated 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 - }; + GregTech_API.sNoBehavior, GregTech_API.sNoBehavior, GregTech_API.sNoBehavior, GregTech_API.sNoBehavior, + GregTech_API.sNoBehavior, GregTech_API.sNoBehavior }; @Deprecated - protected int[] mCoverSides = new int[] {0, 0, 0, 0, 0, 0}; + protected int[] mCoverSides = new int[] { 0, 0, 0, 0, 0, 0 }; @Deprecated protected ISerializableObject[] mCoverData = new ISerializableObject[6]; @Deprecated - protected final boolean[] mCoverNeedUpdate = new boolean[] {false, false, false, false, false, false}; + protected final boolean[] mCoverNeedUpdate = new boolean[] { false, false, false, false, false, false }; /* End Deprecated Cover Variables */ protected short mID = 0; @@ -96,7 +94,7 @@ public abstract class CoverableTileEntity extends BaseTileEntity implements ICov protected void writeCoverNBT(NBTTagCompound aNBT, boolean isDrop) { final NBTTagList tList = new NBTTagList(); - final int[] coverSides = new int[] {0, 0, 0, 0, 0, 0}; + final int[] coverSides = new int[] { 0, 0, 0, 0, 0, 0 }; for (byte i = 0; i < coverInfos.length; i++) { final CoverInfo coverInfo = getCoverInfoAtSide(i); @@ -122,9 +120,8 @@ public abstract class CoverableTileEntity extends BaseTileEntity implements ICov protected void readCoverNBT(NBTTagCompound aNBT) { 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"); if (aNBT.hasKey(GT_Values.NBT.COVERS)) { @@ -145,8 +142,8 @@ public abstract class CoverableTileEntity extends BaseTileEntity implements ICov } public void readLegacyCoverInfoNBT(NBTTagCompound aNBT) { - final int[] coverIDs = - aNBT.hasKey("mCoverSides") ? aNBT.getIntArray("mCoverSides") : new int[] {0, 0, 0, 0, 0, 0}; + final int[] coverIDs = aNBT.hasKey("mCoverSides") ? aNBT.getIntArray("mCoverSides") + : new int[] { 0, 0, 0, 0, 0, 0 }; final boolean hasOldCoverData = (aNBT.hasKey("mCoverData", 11) && aNBT.getIntArray("mCoverData").length == 6); final int[] tOldData = hasOldCoverData ? aNBT.getIntArray("mCoverData") : new int[] {}; @@ -162,10 +159,8 @@ public abstract class CoverableTileEntity extends BaseTileEntity implements ICov if (coverBehavior instanceof GT_Cover_Fluidfilter) { final String filterKey = String.format("fluidFilter%d", i); if (aNBT.hasKey(filterKey)) { - coverData = coverInfo - .getCoverBehavior() - .createDataObject( - (tOldData[i] & 7) | (FluidRegistry.getFluidID(aNBT.getString(filterKey)) << 3)); + coverData = coverInfo.getCoverBehavior().createDataObject( + (tOldData[i] & 7) | (FluidRegistry.getFluidID(aNBT.getString(filterKey)) << 3)); } } else { coverData = coverBehavior.createDataObject(tOldData[i]); @@ -241,12 +236,10 @@ public abstract class CoverableTileEntity extends BaseTileEntity implements ICov if (GT_Mod.instance.isClientSide() && (GT_Client.hideValue & 0x1) != 0) { return Textures.BlockIcons.HIDDEN_TEXTURE[0]; // See through } - final ITexture coverTexture = (!(this instanceof BaseMetaPipeEntity)) - ? coverInfo.getSpecialCoverFGTexture() + final ITexture coverTexture = (!(this instanceof BaseMetaPipeEntity)) ? coverInfo.getSpecialCoverFGTexture() : coverInfo.getSpecialCoverTexture(); - return coverTexture != null - ? coverTexture + return coverTexture != null ? coverTexture : GregTech_API.sCovers.get(new GT_ItemStack(getCoverIDAtSide(aSide))); } @@ -438,16 +431,12 @@ 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) + return aSide >= 0 && aSide < 6 && (mStrongRedstone & (1 << aSide)) != 0 ? (byte) (mSidedRedstone[aSide] & 15) : 0; } @@ -458,30 +447,26 @@ 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); + .manipulatesSidedRedstoneOutput(aSide, getCoverIDAtSide(aSide), getComplexCoverDataAtSide(aSide), this) + ? mSidedRedstone[aSide] + : getGeneralRS(aSide); } protected void updateOutputRedstoneSignal(byte aSide) { @@ -499,8 +484,8 @@ public abstract class CoverableTileEntity extends BaseTileEntity implements ICov } @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) return; final CoverInfo oldCoverInfo = getCoverInfoAtSide(aCoverSide); @@ -521,15 +506,18 @@ public abstract class CoverableTileEntity extends BaseTileEntity implements ICov final CoverInfo coverInfo = getCoverInfoAtSide(i); if (coverInfo.needsUpdate()) { NW.sendPacketToAllPlayersInRange( - worldObj, new GT_Packet_SendCoverData(coverInfo, this), xCoord, zCoord); + worldObj, + new GT_Packet_SendCoverData(coverInfo, this), + xCoord, + zCoord); coverInfo.setNeedsUpdate(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 currentFacing = (byte) accessor.getSide().ordinal(); @@ -541,15 +529,15 @@ public abstract class CoverableTileEntity extends BaseTileEntity implements ICov final ItemStack coverStack = coverInfo.getDisplayStack(); if (coverStack != null) { - currenttip.add(StatCollector.translateToLocalFormatted( - "GT5U.waila.cover", - currentFacing == coverInfo.getSide() - ? StatCollector.translateToLocal("GT5U.waila.cover.current_facing") - : StatCollector.translateToLocal("GT5U.interface.coverTabs." - + ForgeDirection.getOrientation(coverInfo.getSide()) - .toString() - .toLowerCase()), - coverStack.getDisplayName())); + currenttip.add( + StatCollector.translateToLocalFormatted( + "GT5U.waila.cover", + currentFacing == coverInfo.getSide() + ? StatCollector.translateToLocal("GT5U.waila.cover.current_facing") + : StatCollector.translateToLocal( + "GT5U.interface.coverTabs." + ForgeDirection + .getOrientation(coverInfo.getSide()).toString().toLowerCase()), + coverStack.getDisplayName())); final String behaviorDesc = coverInfo.getBehaviorDescription(); if (!Objects.equals(behaviorDesc, E)) currenttip.add(behaviorDesc); } @@ -560,8 +548,8 @@ 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); @@ -572,7 +560,8 @@ public abstract class CoverableTileEntity extends BaseTileEntity implements ICov /** * Add installed cover information, generally called from ItemBlock - * @param aNBT - NBTTagCompound from the stack + * + * @param aNBT - NBTTagCompound from the stack * @param aList - List to add the information to */ public static void addInstalledCoversInformation(NBTTagCompound aNBT, List<String> aList) { @@ -584,9 +573,11 @@ public abstract class CoverableTileEntity extends BaseTileEntity implements ICov final ItemStack coverStack = coverInfo.getDisplayStack(); if (coverStack != null) { - aList.add(String.format( - "Cover on %s side: %s", - getTranslation(FACES[coverInfo.getSide()]), coverStack.getDisplayName())); + aList.add( + String.format( + "Cover on %s side: %s", + getTranslation(FACES[coverInfo.getSide()]), + coverStack.getDisplayName())); } } @@ -599,12 +590,15 @@ 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())); } } } @@ -619,20 +613,16 @@ public abstract class CoverableTileEntity extends BaseTileEntity implements ICov @Override public void addCoverTabs(ModularWindow.Builder builder, UIBuildContext buildContext) { - final int COVER_TAB_LEFT = -16, - COVER_TAB_TOP = 1, - COVER_TAB_HEIGHT = 20, - COVER_TAB_WIDTH = 18, - COVER_TAB_SPACING = 2, - ICON_SIZE = 16; + final int COVER_TAB_LEFT = -16, COVER_TAB_TOP = 1, COVER_TAB_HEIGHT = 20, COVER_TAB_WIDTH = 18, + COVER_TAB_SPACING = 2, ICON_SIZE = 16; final boolean flipHorizontally = GT_Mod.gregtechproxy.mCoverTabsFlipped; final Column columnWidget = new Column(); builder.widget(columnWidget); final int xPos = flipHorizontally ? (getGUIWidth() - COVER_TAB_LEFT - COVER_TAB_WIDTH) : COVER_TAB_LEFT; if (GT_Mod.gregtechproxy.mCoverTabsVisible) { - columnWidget.setPos(xPos, COVER_TAB_TOP).setEnabled(widget -> ((Column) widget) - .getChildren().stream().anyMatch(Widget::isEnabled)); + columnWidget.setPos(xPos, COVER_TAB_TOP) + .setEnabled(widget -> ((Column) widget).getChildren().stream().anyMatch(Widget::isEnabled)); } else { columnWidget.setEnabled(false); } @@ -641,42 +631,34 @@ public abstract class CoverableTileEntity extends BaseTileEntity implements ICov for (ForgeDirection direction : ForgeDirection.VALID_DIRECTIONS) { final byte side = (byte) direction.ordinal(); buildContext.addSyncedWindow(side + COVER_WINDOW_ID_START, player -> createCoverWindow(player, side)); - columnWidget.addChild(new MultiChildWidget() + columnWidget.addChild(new MultiChildWidget().addChild(new ButtonWidget() { + + @Override + public IDrawable[] getBackground() { + final List<IDrawable> backgrounds = new ArrayList<>(); + final GUITextureSet tabIconSet = getGUITextureSet(); + + if (getCoverBehaviorAtSideNew(side).hasCoverGUI()) { + if (isHovering()) { + backgrounds.add( + flipHorizontally ? tabIconSet.getCoverTabHighlightFlipped() + : tabIconSet.getCoverTabHighlight()); + } else { + backgrounds.add( + flipHorizontally ? tabIconSet.getCoverTabNormalFlipped() + : tabIconSet.getCoverTabNormal()); + } + } else { + backgrounds.add( + flipHorizontally ? tabIconSet.getCoverTabDisabledFlipped() + : tabIconSet.getCoverTabDisabled()); + } + return backgrounds.toArray(new IDrawable[] {}); + } + }.setOnClick((clickData, widget) -> onTabClicked(clickData, widget, side)) + .dynamicTooltip(() -> getCoverTabTooltip(side)).setSize(COVER_TAB_WIDTH, COVER_TAB_HEIGHT)) .addChild( - new ButtonWidget() { - @Override - public IDrawable[] getBackground() { - final List<IDrawable> backgrounds = new ArrayList<>(); - final GUITextureSet tabIconSet = getGUITextureSet(); - - if (getCoverBehaviorAtSideNew(side).hasCoverGUI()) { - if (isHovering()) { - backgrounds.add( - flipHorizontally - ? tabIconSet.getCoverTabHighlightFlipped() - : tabIconSet.getCoverTabHighlight()); - } else { - backgrounds.add( - flipHorizontally - ? tabIconSet.getCoverTabNormalFlipped() - : tabIconSet.getCoverTabNormal()); - } - } else { - backgrounds.add( - flipHorizontally - ? tabIconSet.getCoverTabDisabledFlipped() - : tabIconSet.getCoverTabDisabled()); - } - return backgrounds.toArray(new IDrawable[] {}); - } - }.setOnClick((clickData, widget) -> onTabClicked(clickData, widget, side)) - .dynamicTooltip(() -> getCoverTabTooltip(side)) - .setSize(COVER_TAB_WIDTH, COVER_TAB_HEIGHT)) - .addChild(new ItemDrawable(() -> { - return getCoverItemAtSide(side); - }) - .asWidget() - .setPos( + new ItemDrawable(() -> { return getCoverItemAtSide(side); }).asWidget().setPos( (COVER_TAB_WIDTH - ICON_SIZE) / 2 + (flipHorizontally ? -1 : 1), (COVER_TAB_HEIGHT - ICON_SIZE) / 2)) .setEnabled(widget -> getCoverItemAtSide(side) != null)); @@ -685,20 +667,15 @@ public abstract class CoverableTileEntity extends BaseTileEntity implements ICov @SideOnly(Side.CLIENT) protected List<String> getCoverTabTooltip(byte side) { - final String[] SIDE_TOOLTIPS = 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" - }; + final String[] SIDE_TOOLTIPS = 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" }; final CoverInfo coverInfo = getCoverInfoAtSide(side); final ItemStack coverItem = coverInfo.getDisplayStack(); if (coverItem == null) return Collections.emptyList(); final boolean coverHasGUI = coverInfo.hasCoverGUI(); - //noinspection unchecked + // noinspection unchecked final List<String> tooltip = coverItem.getTooltip(Minecraft.getMinecraft().thePlayer, true); for (int i = 0; i < tooltip.size(); i++) { if (i == 0) { @@ -726,8 +703,7 @@ public abstract class CoverableTileEntity extends BaseTileEntity implements ICov getWorld().provider.dimensionId, widget.getContext().getPlayer().getEntityId(), 0); - GT_Values.NW.sendToPlayer( - packet, (EntityPlayerMP) widget.getContext().getPlayer()); + GT_Values.NW.sendToPlayer(packet, (EntityPlayerMP) widget.getContext().getPlayer()); } } } diff --git a/src/main/java/gregtech/api/metatileentity/GregTechTileClientEvents.java b/src/main/java/gregtech/api/metatileentity/GregTechTileClientEvents.java index d8e8017060..2f560c5f15 100644 --- a/src/main/java/gregtech/api/metatileentity/GregTechTileClientEvents.java +++ b/src/main/java/gregtech/api/metatileentity/GregTechTileClientEvents.java @@ -1,6 +1,7 @@ package gregtech.api.metatileentity; public final class GregTechTileClientEvents { + public static final byte CHANGE_COMMON_DATA = 0; public static final byte CHANGE_CUSTOM_DATA = 1; public static final byte CHANGE_COLOR = 2; diff --git a/src/main/java/gregtech/api/metatileentity/MetaPipeEntity.java b/src/main/java/gregtech/api/metatileentity/MetaPipeEntity.java index b433e48b6e..3aa0cbfb32 100644 --- a/src/main/java/gregtech/api/metatileentity/MetaPipeEntity.java +++ b/src/main/java/gregtech/api/metatileentity/MetaPipeEntity.java @@ -3,25 +3,11 @@ 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; -import gnu.trove.list.array.TIntArrayList; -import gregtech.api.GregTech_API; -import gregtech.api.enums.Dyes; -import gregtech.api.interfaces.metatileentity.IConnectable; -import gregtech.api.interfaces.metatileentity.IMetaTileEntity; -import gregtech.api.interfaces.tileentity.IColoredTileEntity; -import gregtech.api.interfaces.tileentity.ICoverable; -import gregtech.api.interfaces.tileentity.IGregTechTileEntity; -import gregtech.api.objects.GT_ItemStack; -import gregtech.api.util.*; -import gregtech.common.GT_Client; -import gregtech.common.covers.CoverInfo; 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; @@ -41,17 +27,33 @@ import net.minecraftforge.fluids.Fluid; import net.minecraftforge.fluids.FluidStack; import net.minecraftforge.fluids.FluidTankInfo; +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; +import gnu.trove.list.TIntList; +import gnu.trove.list.array.TIntArrayList; +import gregtech.api.GregTech_API; +import gregtech.api.enums.Dyes; +import gregtech.api.interfaces.metatileentity.IConnectable; +import gregtech.api.interfaces.metatileentity.IMetaTileEntity; +import gregtech.api.interfaces.tileentity.IColoredTileEntity; +import gregtech.api.interfaces.tileentity.ICoverable; +import gregtech.api.interfaces.tileentity.IGregTechTileEntity; +import gregtech.api.objects.GT_ItemStack; +import gregtech.api.util.*; +import gregtech.common.GT_Client; +import gregtech.common.covers.CoverInfo; + /** * NEVER INCLUDE THIS FILE IN YOUR MOD!!! * <p/> - * Extend this Class to add a new MetaPipe - * Call the Constructor with the desired ID at the load-phase (not preload and also not postload!) - * Implement the newMetaEntity-Method to return a new ready instance of your MetaTileEntity + * Extend this Class to add a new MetaPipe Call the Constructor with the desired ID at the load-phase (not preload and + * also not postload!) Implement the newMetaEntity-Method to return a new ready instance of your MetaTileEntity * <p/> - * Call the Constructor like the following example inside the Load Phase, to register it. - * "new GT_MetaTileEntity_E_Furnace(54, "GT_E_Furnace", "Automatic E-Furnace");" + * Call the Constructor like the following example inside the Load Phase, to register it. "new + * GT_MetaTileEntity_E_Furnace(54, "GT_E_Furnace", "Automatic E-Furnace");" */ public abstract class MetaPipeEntity implements IMetaTileEntity, IConnectable { + /** * The Inventory of the MetaTileEntity. Amount of Slots can be larger than 256. HAYO! */ @@ -63,7 +65,8 @@ public abstract class MetaPipeEntity implements IMetaTileEntity, IConnectable { 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. + * 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; @@ -74,16 +77,14 @@ public abstract class MetaPipeEntity implements IMetaTileEntity, IConnectable { private IGregTechTileEntity mBaseMetaTileEntity; /** - * This registers your Machine at the List. - * Use only ID's larger than 2048, because i reserved these ones. - * See also the List in the API, as it has a Description containing all the reservations. + * This registers your Machine at the List. Use only ID's larger than 2048, because i reserved these ones. See also + * the List in the API, as it has a Description containing all the reservations. * * @param aID the ID * @example for Constructor overload. - * <p/> - * public GT_MetaTileEntity_EBench(int aID, String mName, String mNameRegional) { - * super(aID, mName, mNameRegional); - * } + * <p/> + * public GT_MetaTileEntity_EBench(int aID, String mName, String mNameRegional) { super(aID, mName, + * mNameRegional); } */ public MetaPipeEntity(int aID, String aBasicName, String aRegionalName, int aInvSlotCount) { this(aID, aBasicName, aRegionalName, aInvSlotCount, true); @@ -156,10 +157,7 @@ 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) { @@ -199,33 +197,33 @@ public abstract class MetaPipeEntity implements IMetaTileEntity, IConnectable { @Override public void onServerStart() { - /*Do nothing*/ + /* Do nothing */ } @Override public void onWorldSave(File aSaveDirectory) { - /*Do nothing*/ + /* Do nothing */ } @Override public void onWorldLoad(File aSaveDirectory) { - /*Do nothing*/ + /* Do nothing */ } @Override public void onConfigLoad(GT_Config aConfig) { - /*Do nothing*/ + /* Do nothing */ } @Override public void setItemNBT(NBTTagCompound aNBT) { - /*Do nothing*/ + /* Do nothing */ } @Override @SideOnly(Side.CLIENT) public void registerIcons(IIconRegister aBlockIconRegister) { - /*Do nothing*/ + /* Do nothing */ } @Override @@ -235,48 +233,49 @@ public abstract class MetaPipeEntity implements IMetaTileEntity, IConnectable { @Override public void onScrewdriverRightClick(byte aSide, EntityPlayer aPlayer, float aX, float aY, float aZ) { - /*Do nothing*/ + /* 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*/ + /* Do nothing */ } @Override public void onFirstTick(IGregTechTileEntity aBaseMetaTileEntity) { - /*Do nothing*/ + /* Do nothing */ } @Override public void onPreTick(IGregTechTileEntity aBaseMetaTileEntity, long aTick) { - /*Do nothing*/ + /* Do nothing */ } @Override public void onPostTick(IGregTechTileEntity aBaseMetaTileEntity, long aTick) { if (aBaseMetaTileEntity.isClientSide() && GT_Client.changeDetected == 4) { - /* Client tick counter that is set to 5 on hiding pipes and covers. - * It triggers a texture update next client tick when reaching 4, with provision for 3 more update tasks, - * spreading client change detection related work and network traffic on different ticks, until it reaches 0. + /* + * Client tick counter that is set to 5 on hiding pipes and covers. It triggers a texture update next client + * tick when reaching 4, with provision for 3 more update tasks, spreading client change detection related + * work and network traffic on different ticks, until it reaches 0. */ aBaseMetaTileEntity.issueTextureUpdate(); } @@ -284,51 +283,50 @@ public abstract class MetaPipeEntity implements IMetaTileEntity, IConnectable { @Override public void inValidate() { - /*Do nothing*/ + /* Do nothing */ } @Override public void onRemoval() { - /*Do nothing*/ + /* Do nothing */ } @Override public void initDefaultModes(NBTTagCompound aNBT) { - /*Do nothing*/ + /* Do nothing */ } /** * When a GUI is opened */ public void onOpenGUI() { - /*Do nothing*/ + /* Do nothing */ } /** * When a GUI is closed */ public void onCloseGUI() { - /*Do nothing*/ + /* Do nothing */ } /** - * a Player rightclicks the Machine - * Sneaky rightclicks are not getting passed to this! + * 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*/ + /* Do nothing */ } @Override public void onValueUpdate(byte aValue) { - /*Do nothing*/ + /* Do nothing */ } @Override @@ -338,17 +336,17 @@ public abstract class MetaPipeEntity implements IMetaTileEntity, IConnectable { @Override public void doSound(byte aIndex, double aX, double aY, double aZ) { - /*Do nothing*/ + /* Do nothing */ } @Override public void startSoundLoop(byte aIndex, double aX, double aY, double aZ) { - /*Do nothing*/ + /* Do nothing */ } @Override public void stopSoundLoop(byte aValue, double aX, double aY, double aZ) { - /*Do nothing*/ + /* Do nothing */ } @Override @@ -395,8 +393,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; } @@ -472,12 +470,12 @@ public abstract class MetaPipeEntity implements IMetaTileEntity, IConnectable { @Override public void onMachineBlockUpdate() { - /*Do nothing*/ + /* Do nothing */ } @Override public void receiveClientEvent(byte aEventID, byte aValue) { - /*Do nothing*/ + /* Do nothing */ } @Override @@ -524,7 +522,7 @@ public abstract class MetaPipeEntity implements IMetaTileEntity, IConnectable { } public void setItemCount(int aCount) { - /*Do nothing*/ + /* Do nothing */ } public int getMaxItemCount() { @@ -596,8 +594,7 @@ public abstract class MetaPipeEntity implements IMetaTileEntity, IConnectable { @Override public boolean canInsertItem(int aIndex, ItemStack aStack, int aSide) { - return isValidSlot(aIndex) - && aStack != null + return isValidSlot(aIndex) && aStack != null && aIndex < mInventory.length && (mInventory[aIndex] == null || GT_Utility.areStacksEqual(aStack, mInventory[aIndex])) && allowPutStack(getBaseMetaTileEntity(), aIndex, (byte) aSide, aStack); @@ -605,8 +602,7 @@ public abstract class MetaPipeEntity implements IMetaTileEntity, IConnectable { @Override public boolean canExtractItem(int aIndex, ItemStack aStack, int aSide) { - return isValidSlot(aIndex) - && aStack != null + return isValidSlot(aIndex) && aStack != null && aIndex < mInventory.length && allowPullStack(getBaseMetaTileEntity(), aIndex, (byte) aSide, aStack); } @@ -624,7 +620,7 @@ 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()}; + return new FluidTankInfo[] { getInfo() }; } public int fill_default(ForgeDirection aSide, FluidStack aFluid, boolean doFill) { @@ -755,72 +751,43 @@ 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 + 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 + < V[10] ? 13.0F : aExplosionPower - < V[ - 12] - ? 15.0F - : aExplosionPower - < V[ - 12] - * 2 - ? 16.0F + < V[11] ? 14.0F : aExplosionPower - < V[ - 13] - ? 17.0F - : aExplosionPower - < V[ - 14] - ? 18.0F + < V[12] ? 15.0F : aExplosionPower - < V[ - 15] - ? 19.0F - : 20.0F; - int tX = getBaseMetaTileEntity().getXCoord(), - tY = getBaseMetaTileEntity().getYCoord(), + < 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) { - new WorldSpawnedEventBuilder.ExplosionEffectEventBuilder() - .setStrength(tStrength) - .setSmoking(true) - .setPosition(tX + 0.5, tY + 0.5, tZ + 0.5) - .setWorld(tWorld) - .run(); + new WorldSpawnedEventBuilder.ExplosionEffectEventBuilder().setStrength(tStrength).setSmoking(true) + .setPosition(tX + 0.5, tY + 0.5, tZ + 0.5).setWorld(tWorld).run(); } } @@ -830,14 +797,8 @@ 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); } @@ -879,8 +840,8 @@ public abstract class MetaPipeEntity implements IMetaTileEntity, IConnectable { private boolean connectableColor(TileEntity tTileEntity) { // Determine if two entities are connectable based on their colorization: - // Uncolored can connect to anything - // If both are colored they must be the same color to connect. + // Uncolored can connect to anything + // If both are colored they must be the same color to connect. if (tTileEntity instanceof IColoredTileEntity) { if (getBaseMetaTileEntity().getColorization() >= 0) { final byte tColor = ((IColoredTileEntity) tTileEntity).getColorization(); @@ -914,24 +875,22 @@ public abstract class MetaPipeEntity implements IMetaTileEntity, IConnectable { final IMetaTileEntity tPipe = tTileEntity instanceof IGregTechTileEntity ? ((IGregTechTileEntity) tTileEntity).getMetaTileEntity() : null; - if (getClass().isInstance(tPipe) - || (tPipe != null && tPipe.getClass().isInstance(this))) { + if (getClass().isInstance(tPipe) || (tPipe != null && tPipe.getClass().isInstance(this))) { connectAtSide(aSide); if (!((MetaPipeEntity) tPipe).isConnectedAtSide(tSide)) { // Make sure pipes all get together -- connect back to us if we're connecting to a pipe ((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 - connectAtSide(aSide); - return 1; - } - if (!baseMetaTile - .getWorld() - .getChunkProvider() + } 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)) { // Target chunk unloaded return -1; @@ -941,7 +900,7 @@ public abstract class MetaPipeEntity implements IMetaTileEntity, IConnectable { } protected void checkConnections() { - // Verify connections around us. If GT6 style cables are not enabled then revert to old behavior and try + // Verify connections around us. If GT6 style cables are not enabled then revert to old behavior and try // connecting to everything around us for (byte aSide = 0; aSide < 6; aSide++) { if ((!getGT6StyleConnection() || isConnectedAtSide(aSide)) && connect(aSide) == 0) { @@ -962,9 +921,9 @@ public abstract class MetaPipeEntity implements IMetaTileEntity, IConnectable { byte tSide = GT_Utility.getOppositeSide(aSide); IGregTechTileEntity tTileEntity = getBaseMetaTileEntity().getIGregTechTileEntityAtSide(aSide); IMetaTileEntity tPipe = tTileEntity == null ? null : tTileEntity.getMetaTileEntity(); - if ((this.getClass().isInstance(tPipe) - || (tPipe != null && tPipe.getClass().isInstance(this))) - && ((MetaPipeEntity) tPipe).isConnectedAtSide(tSide)) ((MetaPipeEntity) tPipe).disconnect(tSide); + if ((this.getClass().isInstance(tPipe) || (tPipe != null && tPipe.getClass().isInstance(this))) + && ((MetaPipeEntity) tPipe).isConnectedAtSide(tSide)) + ((MetaPipeEntity) tPipe).disconnect(tSide); } @Override @@ -972,8 +931,8 @@ public abstract class MetaPipeEntity implements IMetaTileEntity, IConnectable { return (mConnections & (1 << aSide)) != 0; } - 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 false; } @@ -981,8 +940,8 @@ public abstract class MetaPipeEntity implements IMetaTileEntity, IConnectable { return false; } - 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 false; } @@ -990,21 +949,13 @@ public abstract class MetaPipeEntity implements IMetaTileEntity, IConnectable { return false; } - 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 false; } - 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 false; } diff --git a/src/main/java/gregtech/api/metatileentity/MetaTileEntity.java b/src/main/java/gregtech/api/metatileentity/MetaTileEntity.java index eb4e797c49..64bc531947 100644 --- a/src/main/java/gregtech/api/metatileentity/MetaTileEntity.java +++ b/src/main/java/gregtech/api/metatileentity/MetaTileEntity.java @@ -2,13 +2,43 @@ package gregtech.api.metatileentity; import static gregtech.api.enums.GT_Values.V; +import java.io.File; +import java.util.ArrayList; +import java.util.List; +import java.util.Locale; +import java.util.function.Supplier; + +import mcp.mobius.waila.api.IWailaConfigHandler; +import mcp.mobius.waila.api.IWailaDataAccessor; + +import net.minecraft.block.Block; +import net.minecraft.client.renderer.RenderBlocks; +import net.minecraft.client.renderer.texture.IIconRegister; +import net.minecraft.entity.Entity; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.entity.player.EntityPlayerMP; +import net.minecraft.entity.player.InventoryPlayer; +import net.minecraft.init.Blocks; +import net.minecraft.item.ItemStack; +import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.tileentity.TileEntity; +import net.minecraft.util.AxisAlignedBB; +import net.minecraft.world.IBlockAccess; +import net.minecraft.world.World; +import net.minecraftforge.common.util.ForgeDirection; +import net.minecraftforge.fluids.Fluid; +import net.minecraftforge.fluids.FluidStack; +import net.minecraftforge.fluids.FluidTankInfo; + import appeng.api.implementations.IPowerChannelState; import appeng.api.networking.energy.IEnergyGrid; import appeng.api.networking.pathing.IPathingGrid; import appeng.api.util.AECableType; import appeng.core.localization.WailaText; import appeng.me.helpers.AENetworkProxy; + import com.gtnewhorizons.modularui.api.forge.ItemStackHandler; + import cpw.mods.fml.common.Loader; import cpw.mods.fml.common.Optional; import cpw.mods.fml.relauncher.Side; @@ -36,46 +66,22 @@ import gregtech.api.util.GT_Util; import gregtech.api.util.GT_Utility; import gregtech.common.GT_Client; import gregtech.common.covers.CoverInfo; -import java.io.File; -import java.util.ArrayList; -import java.util.List; -import java.util.Locale; -import java.util.function.Supplier; -import mcp.mobius.waila.api.IWailaConfigHandler; -import mcp.mobius.waila.api.IWailaDataAccessor; -import net.minecraft.block.Block; -import net.minecraft.client.renderer.RenderBlocks; -import net.minecraft.client.renderer.texture.IIconRegister; -import net.minecraft.entity.Entity; -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.entity.player.EntityPlayerMP; -import net.minecraft.entity.player.InventoryPlayer; -import net.minecraft.init.Blocks; -import net.minecraft.item.ItemStack; -import net.minecraft.nbt.NBTTagCompound; -import net.minecraft.tileentity.TileEntity; -import net.minecraft.util.AxisAlignedBB; -import net.minecraft.world.IBlockAccess; -import net.minecraft.world.World; -import net.minecraftforge.common.util.ForgeDirection; -import net.minecraftforge.fluids.Fluid; -import net.minecraftforge.fluids.FluidStack; -import net.minecraftforge.fluids.FluidTankInfo; /** * NEVER INCLUDE THIS FILE IN YOUR MOD!!! * <p/> - * Extend this Class to add a new MetaMachine - * Call the Constructor with the desired ID at the load-phase (not preload and also not postload!) - * Implement the newMetaEntity-Method to return a new ready instance of your MetaTileEntity + * Extend this Class to add a new MetaMachine Call the Constructor with the desired ID at the load-phase (not preload + * and also not postload!) Implement the newMetaEntity-Method to return a new ready instance of your MetaTileEntity * <p/> - * Call the Constructor like the following example inside the Load Phase, to register it. - * "new GT_MetaTileEntity_E_Furnace(54, "GT_E_Furnace", "Automatic E-Furnace");" + * Call the Constructor like the following example inside the Load Phase, to register it. "new + * GT_MetaTileEntity_E_Furnace(54, "GT_E_Furnace", "Automatic E-Furnace");" */ @SuppressWarnings("unused") public abstract class MetaTileEntity implements IMetaTileEntity, IMachineCallback<MetaTileEntity> { + /** - * Only assigned for the MetaTileEntity in the List! Also only used to get the localized Name for the ItemStack and for getInvName. + * Only assigned for the MetaTileEntity in the List! Also only used to get the localized Name for the ItemStack and + * for getInvName. */ public final String mName; /** @@ -108,16 +114,14 @@ public abstract class MetaTileEntity implements IMetaTileEntity, IMachineCallbac public long mSoundRequests = 0; /** - * This registers your Machine at the List. - * Use only ID's larger than 2048, because i reserved these ones. - * See also the List in the API, as it has a Description containing all the reservations. + * This registers your Machine at the List. Use only ID's larger than 2048, because i reserved these ones. See also + * the List in the API, as it has a Description containing all the reservations. * * @param aID the ID * @example for Constructor overload. - * <p/> - * public GT_MetaTileEntity_EBench(int aID, String mName, String mNameRegional) { - * super(aID, mName, mNameRegional); - * } + * <p/> + * public GT_MetaTileEntity_EBench(int aID, String mName, String mNameRegional) { super(aID, mName, + * mNameRegional); } */ public MetaTileEntity(int aID, String aBasicName, String aRegionalName, int aInvSlotCount) { if (GregTech_API.sPostloadStarted || !GregTech_API.sPreloadStarted) @@ -147,6 +151,7 @@ public abstract class MetaTileEntity implements IMetaTileEntity, IMachineCallbac /** * This method will only be called on client side + * * @return whether the secondary description should be display. default is false */ @Deprecated @@ -173,10 +178,7 @@ 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()); } @Override @@ -186,33 +188,33 @@ public abstract class MetaTileEntity implements IMetaTileEntity, IMachineCallbac @Override public void onServerStart() { - /*Do nothing*/ + /* Do nothing */ } @Override public void onWorldSave(File aSaveDirectory) { - /*Do nothing*/ + /* Do nothing */ } @Override public void onWorldLoad(File aSaveDirectory) { - /*Do nothing*/ + /* Do nothing */ } @Override public void onConfigLoad(GT_Config aConfig) { - /*Do nothing*/ + /* Do nothing */ } @Override public void setItemNBT(NBTTagCompound aNBT) { - /*Do nothing*/ + /* Do nothing */ } @Override @SideOnly(Side.CLIENT) public void registerIcons(IIconRegister aBlockIconRegister) { - /*Do nothing*/ + /* Do nothing */ } @Override @@ -222,12 +224,12 @@ public abstract class MetaTileEntity implements IMetaTileEntity, IMachineCallbac @Override public void onScrewdriverRightClick(byte aSide, EntityPlayer aPlayer, float aX, float aY, float aZ) { - /*Do nothing*/ + /* 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; @@ -236,32 +238,30 @@ public abstract class MetaTileEntity implements IMetaTileEntity, IMachineCallbac } @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) { 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)) { // The tile entity we're facing is a cable, let's try to connect to it - return ((IGregTechTileEntity) tTileEntity) - .getMetaTileEntity() + 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) { + 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)) { // The tile entity we're facing is a cable, let's try to connect to it - return ((IGregTechTileEntity) tTileEntity) - .getMetaTileEntity() + return ((IGregTechTileEntity) tTileEntity).getMetaTileEntity() .onSolderingToolRightClick(aWrenchingSide, tSide, aPlayer, aX, aY, aZ); } return false; @@ -269,28 +269,34 @@ public abstract class MetaTileEntity implements IMetaTileEntity, IMachineCallbac @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*/ + /* Do nothing */ } @Override public void onPreTick(IGregTechTileEntity aBaseMetaTileEntity, long aTick) { - /*Do nothing*/ + /* Do nothing */ } @Override public void onPostTick(IGregTechTileEntity aBaseMetaTileEntity, long aTick) { if (aBaseMetaTileEntity.isClientSide() && GT_Client.changeDetected == 4) { - /* Client tick counter that is set to 5 on hiding pipes and covers. - * It triggers a texture update next client tick when reaching 4, with provision for 3 more update tasks, - * spreading client change detection related work and network traffic on different ticks, until it reaches 0. + /* + * Client tick counter that is set to 5 on hiding pipes and covers. It triggers a texture update next client + * tick when reaching 4, with provision for 3 more update tasks, spreading client change detection related + * work and network traffic on different ticks, until it reaches 0. */ aBaseMetaTileEntity.issueTextureUpdate(); } @@ -298,55 +304,54 @@ public abstract class MetaTileEntity implements IMetaTileEntity, IMachineCallbac @Override public void inValidate() { - /*Do nothing*/ + /* Do nothing */ } @Override public void onRemoval() { - /*Do nothing*/ + /* Do nothing */ } @Override public void initDefaultModes(NBTTagCompound aNBT) { - /*Do nothing*/ + /* Do nothing */ } /** * When a GUI is opened */ public void onOpenGUI() { - /*Do nothing*/ + /* Do nothing */ } /** * When a GUI is closed */ public void onCloseGUI() { - /*Do nothing*/ + /* Do nothing */ } /** - * a Player rightclicks the Machine - * Sneaky rightclicks are not getting passed to this! + * a Player rightclicks the Machine Sneaky rightclicks are not getting passed to this! */ public boolean onRightclick(IGregTechTileEntity aBaseMetaTileEntity, EntityPlayer aPlayer) { return false; } @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*/ + /* Do nothing */ } @Override public void onValueUpdate(byte aValue) { - /*Do nothing*/ + /* Do nothing */ } @Override @@ -356,17 +361,17 @@ public abstract class MetaTileEntity implements IMetaTileEntity, IMachineCallbac @Override public void doSound(byte aIndex, double aX, double aY, double aZ) { - /*Do nothing*/ + /* Do nothing */ } @Override public void startSoundLoop(byte aIndex, double aX, double aY, double aZ) { - /*Do nothing*/ + /* Do nothing */ } @Override public void stopSoundLoop(byte aValue, double aX, double aY, double aZ) { - /*Do nothing*/ + /* Do nothing */ } @Override @@ -425,8 +430,7 @@ public abstract class MetaTileEntity implements IMetaTileEntity, IMachineCallbac } /** - * @return what type of texture does this machine use for GUI, - * i.e. Bronze, Steel, or Primitive + * @return what type of texture does this machine use for GUI, i.e. Bronze, Steel, or Primitive */ public SteamVariant getSteamVariant() { return SteamVariant.NONE; @@ -468,8 +472,8 @@ public abstract class MetaTileEntity implements IMetaTileEntity, IMachineCallbac } /** - * @return the amount of E-net Impulses of the maxEUOutput size, which can be outputted by this Device. - * Default is 1 Pulse, this shouldn't be set to smaller Values than 1, as it won't output anything in that Case! + * @return the amount of E-net Impulses of the maxEUOutput size, which can be outputted by this Device. Default is 1 + * Pulse, this shouldn't be set to smaller Values than 1, as it won't output anything in that Case! */ public long maxAmperesOut() { return 1; @@ -570,8 +574,8 @@ public abstract class MetaTileEntity implements IMetaTileEntity, IMachineCallbac } /** - * @return the amount of EU, which this Device stores before starting to emit Energy. - * useful if you don't want to emit stored Energy until a certain Level is reached. + * @return the amount of EU, which this Device stores before starting to emit Energy. useful if you don't want to + * emit stored Energy until a certain Level is reached. */ public long getMinimumStoredEU() { return 512; @@ -627,8 +631,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; } @@ -683,12 +687,12 @@ public abstract class MetaTileEntity implements IMetaTileEntity, IMachineCallbac @Override public void onMachineBlockUpdate() { - /*Do nothing*/ + /* Do nothing */ } @Override public void receiveClientEvent(byte aEventID, byte aValue) { - /*Do nothing*/ + /* Do nothing */ } @Override @@ -732,8 +736,8 @@ public abstract class MetaTileEntity implements IMetaTileEntity, IMachineCallbac } /** - * If this TileEntity makes use of Sided Redstone behaviors. - * Determines only, if the Output Redstone Array is getting filled with 0 for true, or 15 for false. + * If this TileEntity makes use of Sided Redstone behaviors. Determines only, if the Output Redstone Array is + * getting filled with 0 for true, or 15 for false. */ public boolean hasSidedRedstoneOutputBehavior() { return false; @@ -743,15 +747,14 @@ public abstract class MetaTileEntity implements IMetaTileEntity, IMachineCallbac * When the Facing gets changed. */ public void onFacingChange() { - /*Do nothing*/ + /* Do nothing */ } /** * if the IC2 Teleporter can drain from this. */ public boolean isTeleporterCompatible() { - return isEnetOutput() - && getBaseMetaTileEntity().getOutputVoltage() >= 128 + return isEnetOutput() && getBaseMetaTileEntity().getOutputVoltage() >= 128 && getBaseMetaTileEntity().getUniversalEnergyCapacity() >= 500000; } @@ -806,7 +809,7 @@ public abstract class MetaTileEntity implements IMetaTileEntity, IMachineCallbac } public void setItemCount(int aCount) { - /*Do nothing*/ + /* Do nothing */ } public int getMaxItemCount() { @@ -889,8 +892,7 @@ public abstract class MetaTileEntity implements IMetaTileEntity, IMachineCallbac @Override public boolean canInsertItem(int aIndex, ItemStack aStack, int aSide) { - return isValidSlot(aIndex) - && aStack != null + return isValidSlot(aIndex) && aStack != null && aIndex < mInventory.length && (mInventory[aIndex] == null || GT_Utility.areStacksEqual(aStack, mInventory[aIndex])) && allowPutStack(getBaseMetaTileEntity(), aIndex, (byte) aSide, aStack); @@ -898,8 +900,7 @@ public abstract class MetaTileEntity implements IMetaTileEntity, IMachineCallbac @Override public boolean canExtractItem(int aIndex, ItemStack aStack, int aSide) { - return isValidSlot(aIndex) - && aStack != null + return isValidSlot(aIndex) && aStack != null && aIndex < mInventory.length && allowPullStack(getBaseMetaTileEntity(), aIndex, (byte) aSide, aStack); } @@ -917,7 +918,7 @@ 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()}; + return new FluidTankInfo[] { getInfo() }; } public int fill_default(ForgeDirection aSide, FluidStack aFluid, boolean doFill) { @@ -932,8 +933,7 @@ public abstract class MetaTileEntity implements IMetaTileEntity, IMachineCallbac Integer.MAX_VALUE, Math.min( aFluid.amount / 2, - getBaseMetaTileEntity().getSteamCapacity() - - getBaseMetaTileEntity().getStoredSteam())); + getBaseMetaTileEntity().getSteamCapacity() - getBaseMetaTileEntity().getStoredSteam())); if (tSteam > 0) { markDirty(); if (doFill) getBaseMetaTileEntity().increaseStoredSteam(tSteam, true); @@ -1112,14 +1112,8 @@ 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); } @@ -1186,12 +1180,12 @@ public abstract class MetaTileEntity implements IMetaTileEntity, IMachineCallbac // === Waila compat === @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())); if (Loader.isModLoaded("appliedenergistics2") && this instanceof IPowerChannelState) { // adapted from PowerStateWailaDataProvider @@ -1214,8 +1208,8 @@ public abstract class MetaTileEntity implements IMetaTileEntity, IMachineCallbac } @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) { if (Loader.isModLoaded("appliedenergistics2") && this instanceof IPowerChannelState) { // adapted from PowerStateWailaDataProvider final IPowerChannelState state = (IPowerChannelState) this; diff --git a/src/main/java/gregtech/api/metatileentity/TileIC2EnergySink.java b/src/main/java/gregtech/api/metatileentity/TileIC2EnergySink.java index 661dad730f..6d6ec378d4 100644 --- a/src/main/java/gregtech/api/metatileentity/TileIC2EnergySink.java +++ b/src/main/java/gregtech/api/metatileentity/TileIC2EnergySink.java @@ -1,6 +1,10 @@ package gregtech.api.metatileentity; +import net.minecraft.tileentity.TileEntity; +import net.minecraftforge.common.util.ForgeDirection; + import com.google.common.collect.Sets; + import gregtech.api.interfaces.metatileentity.IConnectable; import gregtech.api.interfaces.metatileentity.IMetaTileEntity; import gregtech.api.interfaces.metatileentity.IMetaTileEntityCable; @@ -8,10 +12,9 @@ import gregtech.api.interfaces.tileentity.IGregTechTileEntity; import gregtech.api.metatileentity.implementations.GT_MetaPipeEntity_Cable; import gregtech.api.util.GT_Utility; import ic2.api.energy.tile.IEnergySink; -import net.minecraft.tileentity.TileEntity; -import net.minecraftforge.common.util.ForgeDirection; public class TileIC2EnergySink extends TileEntity implements IEnergySink { + private IGregTechTileEntity myMeta; private GT_MetaPipeEntity_Cable cableMeta = null; @@ -28,9 +31,7 @@ public class TileIC2EnergySink extends TileEntity implements IEnergySink { zCoord = meta.getZCoord(); } /* - * * IC2 enet compat - IEnergySink - * */ /** @@ -48,17 +49,17 @@ public class TileIC2EnergySink extends TileEntity implements IEnergySink { // 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 + // 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. + // weird. In that case only use one cable, or use a transformer. return (cableMeta.mVoltage * cableMeta.mAmperage); } else return myMeta.getEUCapacity() - myMeta.getStoredEU(); } /** - * Determine the tier of this energy sink. - * 1 = LV, 2 = MV, 3 = HV, 4 = EV etc. + * Determine the tier of this energy sink. 1 = LV, 2 = MV, 3 = HV, 4 = EV etc. + * * @note Return Integer.MAX_VALUE to allow any voltage. * * @return tier of this energy sink @@ -71,18 +72,18 @@ public class TileIC2EnergySink extends TileEntity implements IEnergySink { /** * Transfer energy to the sink. * - * It's highly recommended to accept all energy by letting the internal buffer overflow to - * increase the performance and accuracy of the distribution simulation. + * It's highly recommended to accept all energy by letting the internal buffer overflow to increase the performance + * and accuracy of the distribution simulation. * * @param directionFrom direction from which the energy comes from - * @param amount energy to be transferred + * @param amount energy to be transferred * @return Energy not consumed (leftover) */ @Override public double injectEnergy(ForgeDirection directionFrom, double amount, double voltage) { - final long amps = (long) - Math.max(amount / (cableMeta != null ? cableMeta.mVoltage : myMeta.getInputVoltage() * 1.0), 1.0); + final long amps = (long) Math + .max(amount / (cableMeta != null ? cableMeta.mVoltage : myMeta.getInputVoltage() * 1.0), 1.0); final long euPerAmp = (long) (amount / (amps * 1.0)); final IMetaTileEntity metaTile = myMeta.getMetaTileEntity(); @@ -90,16 +91,14 @@ public class TileIC2EnergySink extends TileEntity implements IEnergySink { final long usedAmps; if (cableMeta != null) { - usedAmps = ((IMetaTileEntityCable) metaTile) - .transferElectricity( - (byte) directionFrom.ordinal(), - Math.min(euPerAmp, cableMeta.mVoltage), - amps, - Sets.newHashSet((TileEntity) myMeta)); + 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); + } else usedAmps = myMeta + .injectEnergyUnits((byte) directionFrom.ordinal(), Math.min(euPerAmp, myMeta.getInputVoltage()), amps); return amount - (usedAmps * euPerAmp); // transferElectricity for cables @@ -108,18 +107,18 @@ public class TileIC2EnergySink extends TileEntity implements IEnergySink { /** * Determine if this acceptor can accept current from an adjacent emitter in a direction. * - * The TileEntity in the emitter parameter is what was originally added to the energy net, - * which may be normal in-world TileEntity, a delegate or an IMetaDelegate. + * The TileEntity in the emitter parameter is what was originally added to the energy net, which may be normal + * in-world TileEntity, a delegate or an IMetaDelegate. * - * @param emitter energy emitter, may also be null or an IMetaDelegate + * @param emitter energy emitter, may also be null or an IMetaDelegate * @param direction direction the energy is being received from */ @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; + 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 be1904aaf5..a372a37103 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 @@ -2,6 +2,8 @@ package gregtech.api.metatileentity.examples; import static gregtech.api.enums.Textures.BlockIcons.*; +import net.minecraft.item.ItemStack; + import gregtech.api.enums.SoundResource; import gregtech.api.interfaces.ITexture; import gregtech.api.interfaces.tileentity.IGregTechTileEntity; @@ -10,12 +12,12 @@ import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_BasicMachin import gregtech.api.render.TextureFactory; import gregtech.api.util.GT_ModHandler; import gregtech.api.util.GT_Utility; -import net.minecraft.item.ItemStack; /** * 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, @@ -30,66 +32,37 @@ public class GT_MetaTileEntity_E_Furnace extends GT_MetaTileEntity_BasicMachine "smelting", TextureFactory.of( TextureFactory.of(OVERLAY_SIDE_STEAM_FURNACE_ACTIVE), - TextureFactory.builder() - .addIcon(OVERLAY_SIDE_STEAM_FURNACE_ACTIVE_GLOW) - .glow() - .build()), + TextureFactory.builder().addIcon(OVERLAY_SIDE_STEAM_FURNACE_ACTIVE_GLOW).glow().build()), TextureFactory.of( TextureFactory.of(OVERLAY_SIDE_STEAM_FURNACE), - TextureFactory.builder() - .addIcon(OVERLAY_SIDE_STEAM_FURNACE_GLOW) - .glow() - .build()), + TextureFactory.builder().addIcon(OVERLAY_SIDE_STEAM_FURNACE_GLOW).glow().build()), TextureFactory.of( TextureFactory.of(OVERLAY_FRONT_STEAM_FURNACE_ACTIVE), - TextureFactory.builder() - .addIcon(OVERLAY_FRONT_STEAM_FURNACE_ACTIVE_GLOW) - .glow() - .build()), + TextureFactory.builder().addIcon(OVERLAY_FRONT_STEAM_FURNACE_ACTIVE_GLOW).glow().build()), TextureFactory.of( TextureFactory.of(OVERLAY_FRONT_STEAM_FURNACE), - TextureFactory.builder() - .addIcon(OVERLAY_FRONT_STEAM_FURNACE_GLOW) - .glow() - .build()), + TextureFactory.builder().addIcon(OVERLAY_FRONT_STEAM_FURNACE_GLOW).glow().build()), TextureFactory.of( TextureFactory.of(OVERLAY_TOP_STEAM_FURNACE_ACTIVE), - TextureFactory.builder() - .addIcon(OVERLAY_TOP_STEAM_FURNACE_ACTIVE_GLOW) - .glow() - .build()), + TextureFactory.builder().addIcon(OVERLAY_TOP_STEAM_FURNACE_ACTIVE_GLOW).glow().build()), TextureFactory.of( TextureFactory.of(OVERLAY_TOP_STEAM_FURNACE), - TextureFactory.builder() - .addIcon(OVERLAY_TOP_STEAM_FURNACE_GLOW) - .glow() - .build()), + TextureFactory.builder().addIcon(OVERLAY_TOP_STEAM_FURNACE_GLOW).glow().build()), TextureFactory.of( TextureFactory.of(OVERLAY_BOTTOM_STEAM_FURNACE_ACTIVE), - TextureFactory.builder() - .addIcon(OVERLAY_BOTTOM_STEAM_FURNACE_ACTIVE_GLOW) - .glow() - .build()), + TextureFactory.builder().addIcon(OVERLAY_BOTTOM_STEAM_FURNACE_ACTIVE_GLOW).glow().build()), TextureFactory.of( TextureFactory.of(OVERLAY_BOTTOM_STEAM_FURNACE), - TextureFactory.builder() - .addIcon(OVERLAY_BOTTOM_STEAM_FURNACE_GLOW) - .glow() - .build())); + TextureFactory.builder().addIcon(OVERLAY_BOTTOM_STEAM_FURNACE_GLOW).glow().build())); } - public GT_MetaTileEntity_E_Furnace( - String aName, int aTier, String aDescription, ITexture[][][] aTextures, 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); } @@ -110,8 +83,8 @@ public class GT_MetaTileEntity_E_Furnace extends GT_MetaTileEntity_BasicMachine } @Override - protected boolean allowPutStackValidated( - IGregTechTileEntity aBaseMetaTileEntity, int aIndex, byte aSide, ItemStack aStack) { + 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; } 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 750b50d652..1ea2e3e756 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 @@ -2,6 +2,22 @@ package gregtech.api.metatileentity.implementations; import static gregtech.api.enums.GT_Values.ALL_VALID_SIDES; +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; +import net.minecraft.item.ItemStack; +import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.tileentity.TileEntity; +import net.minecraft.util.AxisAlignedBB; +import net.minecraft.util.EnumChatFormatting; +import net.minecraft.util.StatCollector; +import net.minecraft.world.World; +import net.minecraftforge.common.util.ForgeDirection; + import cofh.api.energy.IEnergyReceiver; import cpw.mods.fml.common.Loader; import gregtech.GT_Mod; @@ -36,33 +52,16 @@ 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; -import net.minecraft.item.ItemStack; -import net.minecraft.nbt.NBTTagCompound; -import net.minecraft.tileentity.TileEntity; -import net.minecraft.util.AxisAlignedBB; -import net.minecraft.util.EnumChatFormatting; -import net.minecraft.util.StatCollector; -import net.minecraft.world.World; -import net.minecraftforge.common.util.ForgeDirection; 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, + public int mTransferredAmperage = 0, mTransferredAmperageLast20 = 0, mTransferredAmperageLast20OK = 0, mTransferredAmperageOK = 0; - public long mTransferredVoltageLast20 = 0, - mTransferredVoltage = 0, - mTransferredVoltageLast20OK = 0, + public long mTransferredVoltageLast20 = 0, mTransferredVoltage = 0, mTransferredVoltageLast20OK = 0, mTransferredVoltageOK = 0; public long mRestRF; public int mOverheat; @@ -71,17 +70,8 @@ public class GT_MetaPipeEntity_Cable extends MetaPipeEntity implements IMetaTile 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; @@ -92,15 +82,8 @@ 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; @@ -119,87 +102,77 @@ 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); - } - - @Override - 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)) - }; + mName, + mThickNess, + mMaterial, + mCableLossPerMeter, + mAmperage, + mVoltage, + mInsulated, + mCanShock); + } + + @Override + 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)) }; 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.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)) - }; + 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)) - }; + 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)) - }; + 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)) - }; + 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_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)) - }; + 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 + if (mCanShock && (((BaseMetaPipeEntity) getBaseMetaTileEntity()).mConnections & -128) == 0 && aEntity instanceof EntityLivingBase && !isCoverOnSide((BaseMetaPipeEntity) getBaseMetaTileEntity(), (EntityLivingBase) aEntity)) GT_Utility.applyElectricityDamage( - (EntityLivingBase) aEntity, mTransferredVoltageLast20, mTransferredAmperageLast20); + (EntityLivingBase) aEntity, + mTransferredVoltageLast20, + mTransferredAmperageLast20); } @Override @@ -242,8 +215,8 @@ public class GT_MetaPipeEntity_Cable extends MetaPipeEntity implements IMetaTile @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)); } @@ -275,24 +248,24 @@ public class GT_MetaPipeEntity_Cable extends MetaPipeEntity implements IMetaTile public void onFirstTick(IGregTechTileEntity aBaseMetaTileEntity) { if (aBaseMetaTileEntity.isServerSide()) { lastAmperage = new int[16]; - lastWorldTick = aBaseMetaTileEntity.getWorld().getTotalWorldTime() - - 1; // sets initial value -1 since it is in the same tick as first on post tick + lastWorldTick = aBaseMetaTileEntity.getWorld().getTotalWorldTime() - 1; // sets initial value -1 since it is + // in the same tick as first on post + // tick } } @Override public void onPostTick(IGregTechTileEntity aBaseMetaTileEntity, long aTick) { super.onPostTick(aBaseMetaTileEntity, aTick); - if (aTick % 20 == 0 - && aBaseMetaTileEntity.isServerSide() + 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) { + 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)) { @@ -308,8 +281,8 @@ 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) { + 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)) { @@ -325,34 +298,26 @@ 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); } @@ -374,9 +339,9 @@ 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; @@ -398,15 +363,18 @@ 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); + else 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; + && ((IEnergySink) ic2Energy).acceptsEnergyFrom((TileEntity) baseMetaTile, tDir)) + return true; // IC2 Source Compat if (GT_Mod.gregtechproxy.ic2EnergySourceCompat && (ic2Energy instanceof IEnergySource)) { @@ -416,14 +384,13 @@ 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 @@ -445,16 +412,24 @@ public class GT_MetaPipeEntity_Cable extends MetaPipeEntity implements IMetaTile @Override public String[] getDescription() { return new String[] { - StatCollector.translateToLocal("GT5U.item.cable.max_voltage") + ": %%%" + EnumChatFormatting.GREEN - + GT_Utility.formatNumbers(mVoltage) + " (" - + GT_Utility.getColoredTierNameFromVoltage(mVoltage) - + EnumChatFormatting.GREEN + ")" + EnumChatFormatting.GRAY, - StatCollector.translateToLocal("GT5U.item.cable.max_amperage") + ": %%%" + EnumChatFormatting.YELLOW - + GT_Utility.formatNumbers(mAmperage) + EnumChatFormatting.GRAY, - StatCollector.translateToLocal("GT5U.item.cable.loss") + ": %%%" + EnumChatFormatting.RED - + GT_Utility.formatNumbers(mCableLossPerMeter) + EnumChatFormatting.GRAY + "%%% " - + StatCollector.translateToLocal("GT5U.item.cable.eu_volt") - }; + StatCollector.translateToLocal("GT5U.item.cable.max_voltage") + ": %%%" + + EnumChatFormatting.GREEN + + GT_Utility.formatNumbers(mVoltage) + + " (" + + GT_Utility.getColoredTierNameFromVoltage(mVoltage) + + EnumChatFormatting.GREEN + + ")" + + EnumChatFormatting.GRAY, + StatCollector.translateToLocal("GT5U.item.cable.max_amperage") + ": %%%" + + EnumChatFormatting.YELLOW + + GT_Utility.formatNumbers(mAmperage) + + EnumChatFormatting.GRAY, + StatCollector.translateToLocal("GT5U.item.cable.loss") + ": %%%" + + EnumChatFormatting.RED + + GT_Utility.formatNumbers(mCableLossPerMeter) + + EnumChatFormatting.GRAY + + "%%% " + + StatCollector.translateToLocal("GT5U.item.cable.eu_volt") }; } @Override @@ -491,21 +466,38 @@ public class GT_MetaPipeEntity_Cable extends MetaPipeEntity implements IMetaTile 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" - }; + // 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 @@ -557,19 +549,13 @@ public class GT_MetaPipeEntity_Cable extends MetaPipeEntity implements IMetaTile if ((tConn & (1 << ForgeDirection.WEST.ordinal())) != 0) tSide4 = 0f; if ((tConn & (1 << ForgeDirection.EAST.ordinal())) != 0) tSide5 = 1f; - return AxisAlignedBB.getBoundingBox( - aX + tSide4, aY + tSide0, aZ + tSide2, aX + tSide5, aY + tSide1, aZ + tSide3); + return AxisAlignedBB + .getBoundingBox(aX + tSide4, aY + tSide0, aZ + tSide2, aX + tSide5, aY + tSide1, aZ + tSide3); } @Override - 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) { final AxisAlignedBB aabb = getActualCollisionBoundingBoxFromPool(aWorld, aX, aY, aZ); @@ -583,20 +569,19 @@ 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; } 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 61d55bfd9b..29237218a1 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 @@ -3,6 +3,25 @@ package gregtech.api.metatileentity.implementations; import static gregtech.api.enums.GT_Values.D1; import static gregtech.api.objects.XSTR.XSTR_INSTANCE; +import java.util.ArrayList; +import java.util.List; + +import net.minecraft.entity.Entity; +import net.minecraft.entity.EntityLivingBase; +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.AxisAlignedBB; +import net.minecraft.util.EnumChatFormatting; +import net.minecraft.world.World; +import net.minecraftforge.common.util.ForgeDirection; +import net.minecraftforge.fluids.FluidStack; +import net.minecraftforge.fluids.FluidTankInfo; +import net.minecraftforge.fluids.IFluidHandler; + +import org.apache.commons.lang3.tuple.MutableTriple; + import cpw.mods.fml.common.Optional; import gregtech.GT_Mod; import gregtech.api.GregTech_API; @@ -21,24 +40,9 @@ import gregtech.common.GT_Client; import gregtech.common.covers.CoverInfo; 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; -import net.minecraft.item.ItemStack; -import net.minecraft.nbt.NBTTagCompound; -import net.minecraft.tileentity.TileEntity; -import net.minecraft.util.AxisAlignedBB; -import net.minecraft.util.EnumChatFormatting; -import net.minecraft.world.World; -import net.minecraftforge.common.util.ForgeDirection; -import net.minecraftforge.fluids.FluidStack; -import net.minecraftforge.fluids.FluidTankInfo; -import net.minecraftforge.fluids.IFluidHandler; -import org.apache.commons.lang3.tuple.MutableTriple; public class GT_MetaPipeEntity_Fluid extends MetaPipeEntity { + public final float mThickNess; public final Materials mMaterial; public final int mCapacity, mHeatResistance, mPipeAmount; @@ -50,28 +54,13 @@ 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; @@ -84,24 +73,13 @@ 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; @@ -120,79 +98,61 @@ 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); + 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) { final 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; - final byte[][] sRestrictionArray = { - {2, 3, 5, 4}, - {2, 3, 4, 5}, - {1, 0, 4, 5}, - {1, 0, 4, 5}, - {1, 0, 2, 3}, - {1, 0, 2, 3} - }; + final byte[][] sRestrictionArray = { { 2, 3, 5, 4 }, { 2, 3, 4, 5 }, { 1, 0, 4, 5 }, { 1, 0, 4, 5 }, + { 1, 0, 2, 3 }, { 1, 0, 2, 3 } }; 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 + // 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) - }; + 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)); - if (aPipeAmount >= 4) - 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)); - if (aThickNess < 0.374F) - 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)); - if (aThickNess < 0.749F) - 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)); + if (aPipeAmount >= 9) 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)); + if (aThickNess < 0.124F) 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)); + if (aThickNess < 0.499F) 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)); + 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)); @@ -277,9 +237,8 @@ public class GT_MetaPipeEntity_Fluid extends MetaPipeEntity { @Override public void saveNBTData(NBTTagCompound aNBT) { - for (int i = 0; i < mPipeAmount; i++) - if (mFluids[i] != null) - aNBT.setTag("mFluid" + (i == 0 ? "" : i), mFluids[i].writeToNBT(new NBTTagCompound())); + for (int i = 0; i < mPipeAmount; i++) if (mFluids[i] != null) + aNBT.setTag("mFluid" + (i == 0 ? "" : i), mFluids[i].writeToNBT(new NBTTagCompound())); aNBT.setByte("mLastReceivedFrom", mLastReceivedFrom); if (GT_Mod.gregtechproxy.gt6Pipe) { aNBT.setByte("mConnections", mConnections); @@ -305,17 +264,17 @@ public class GT_MetaPipeEntity_Fluid extends MetaPipeEntity { for (FluidStack tFluid : mFluids) { if (tFluid != null) { final 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)) { - GT_Utility.applyFrostDamage((EntityLivingBase) aEntity, (270 - tTemperature) / 25.0F); - break; - } + } else if (tTemperature < 260 && !isCoverOnSide( + (BaseMetaPipeEntity) getBaseMetaTileEntity(), + (EntityLivingBase) aEntity)) { + GT_Utility.applyFrostDamage((EntityLivingBase) aEntity, (270 - tTemperature) / 25.0F); + break; + } } } } @@ -361,25 +320,33 @@ public class GT_MetaPipeEntity_Fluid extends MetaPipeEntity { // 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); + + " | " + + 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() + for (EntityLivingBase tLiving : (ArrayList<EntityLivingBase>) getBaseMetaTileEntity().getWorld() .getEntitiesWithinAABB( EntityLivingBase.class, AxisAlignedBB.getBoundingBox( @@ -396,8 +363,7 @@ public class GT_MetaPipeEntity_Fluid extends MetaPipeEntity { } } else if (tTemperature < 260) { try { - for (EntityLivingBase tLiving : (ArrayList<EntityLivingBase>) getBaseMetaTileEntity() - .getWorld() + for (EntityLivingBase tLiving : (ArrayList<EntityLivingBase>) getBaseMetaTileEntity().getWorld() .getEntitiesWithinAABB( EntityLivingBase.class, AxisAlignedBB.getBoundingBox( @@ -434,8 +400,7 @@ 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 + if (isConnectedAtSide(aSide) && tTank != null && (mLastReceivedFrom & (1 << aSide)) == 0 && getBaseMetaTileEntity().getCoverInfoAtSide(aSide).letsFluidOut(tFluid.getFluid()) && (gTank == null || gTank.getCoverInfoAtSide(tSide).letsFluidIn(tFluid.getFluid()))) { @@ -470,8 +435,8 @@ public class GT_MetaPipeEntity_Fluid extends MetaPipeEntity { if (tEntry.right <= 0) continue; - final int tFilledAmount = - tEntry.left.fill(tEntry.middle, drainFromIndex(tEntry.right, false, index), false); + final int tFilledAmount = tEntry.left + .fill(tEntry.middle, drainFromIndex(tEntry.right, false, index), false); if (tFilledAmount > 0) tEntry.left.fill(tEntry.middle, drainFromIndex(tFilledAmount, true, index), true); @@ -480,8 +445,8 @@ public class GT_MetaPipeEntity_Fluid extends MetaPipeEntity { } @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) { final byte tSide = GT_Utility.determineWrenchingSide(aSide, aX, aY, aZ); final byte tMask = (byte) (1 << tSide); @@ -508,34 +473,26 @@ 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); } @@ -553,14 +510,14 @@ public class GT_MetaPipeEntity_Fluid extends MetaPipeEntity { public boolean canConnect(byte aSide, TileEntity tTileEntity) { if (tTileEntity == null) return false; - final byte tSide = - (byte) ForgeDirection.getOrientation(aSide).getOpposite().ordinal(); + final byte tSide = (byte) ForgeDirection.getOrientation(aSide).getOpposite().ordinal(); final IGregTechTileEntity baseMetaTile = getBaseMetaTileEntity(); if (baseMetaTile == null) return false; 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; @@ -570,8 +527,7 @@ public class GT_MetaPipeEntity_Fluid extends MetaPipeEntity { if (fTileEntity != null) { final FluidTankInfo[] tInfo = fTileEntity.getTankInfo(ForgeDirection.getOrientation(tSide)); if (tInfo != null) { - return tInfo.length > 0 - || (GregTech_API.mTranslocator && isTranslocator(tTileEntity)) + return tInfo.length > 0 || (GregTech_API.mTranslocator && isTranslocator(tTileEntity)) || gTileEntity != null && gTileEntity.getCoverBehaviorAtSideNew(tSide) instanceof GT_Cover_FluidRegulator; } @@ -603,18 +559,19 @@ public class GT_MetaPipeEntity_Fluid extends MetaPipeEntity { if (aIndex == 9) { GT_Utility.doSoundAtClient(SoundResource.RANDOM_FIZZ, 5, 1.0F, aX, aY, aZ); - new ParticleEventBuilder() - .setIdentifier(ParticleFX.CLOUD) - .setWorld(getBaseMetaTileEntity().getWorld()) - .<ParticleEventBuilder>times(6, (x, i) -> x.setMotion( - ForgeDirection.getOrientation(i).offsetX / 5.0, - ForgeDirection.getOrientation(i).offsetY / 5.0, - ForgeDirection.getOrientation(i).offsetZ / 5.0) - .setPosition( - aX - 0.5 + XSTR_INSTANCE.nextFloat(), - aY - 0.5 + XSTR_INSTANCE.nextFloat(), - aZ - 0.5 + XSTR_INSTANCE.nextFloat()) - .run()); + new ParticleEventBuilder().setIdentifier(ParticleFX.CLOUD).setWorld(getBaseMetaTileEntity().getWorld()) + .<ParticleEventBuilder>times( + 6, + (x, i) -> x + .setMotion( + ForgeDirection.getOrientation(i).offsetX / 5.0, + ForgeDirection.getOrientation(i).offsetY / 5.0, + ForgeDirection.getOrientation(i).offsetZ / 5.0) + .setPosition( + aX - 0.5 + XSTR_INSTANCE.nextFloat(), + aY - 0.5 + XSTR_INSTANCE.nextFloat(), + aZ - 0.5 + XSTR_INSTANCE.nextFloat()) + .run()); } } @@ -763,19 +720,25 @@ public class GT_MetaPipeEntity_Fluid extends MetaPipeEntity { 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 - }; + 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, - EnumChatFormatting.AQUA + "Pipe Amount: %%%" + mPipeAmount + EnumChatFormatting.GRAY - }; + 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 }; } } @@ -848,19 +811,13 @@ public class GT_MetaPipeEntity_Fluid extends MetaPipeEntity { if ((tConn & (1 << ForgeDirection.WEST.ordinal())) != 0) tSide4 = 0f; if ((tConn & (1 << ForgeDirection.EAST.ordinal())) != 0) tSide5 = 1f; - return AxisAlignedBB.getBoundingBox( - aX + tSide4, aY + tSide0, aZ + tSide2, aX + tSide5, aY + tSide1, aZ + tSide3); + return AxisAlignedBB + .getBoundingBox(aX + tSide4, aY + tSide0, aZ + tSide2, aX + tSide5, aY + tSide1, aZ + tSide3); } @Override - 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) { final AxisAlignedBB aabb = getActualCollisionBoundingBoxFromPool(aWorld, aX, aY, aZ); 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 d50c4fc165..e449921d1d 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 @@ -3,6 +3,9 @@ package gregtech.api.metatileentity.implementations; import static gregtech.api.enums.GT_Values.RA; import static gregtech.api.util.GT_Utility.calculateRecipeEU; +import net.minecraft.item.ItemStack; +import net.minecraft.nbt.NBTTagCompound; + import gregtech.api.enums.*; import gregtech.api.interfaces.ITexture; import gregtech.api.interfaces.metatileentity.IMetaTileEntity; @@ -13,12 +16,11 @@ import gregtech.api.util.GT_LanguageManager; import gregtech.api.util.GT_ModHandler; import gregtech.api.util.GT_ModHandler.RecipeBits; import gregtech.api.util.GT_OreDictUnificator; -import net.minecraft.item.ItemStack; -import net.minecraft.nbt.NBTTagCompound; public class GT_MetaPipeEntity_Frame extends MetaPipeEntity { - private static final String localizedDescFormat = GT_LanguageManager.addStringLocalization( - "gt.blockmachines.gt_frame.desc.format", "Just something you can put covers on."); + + private static final String localizedDescFormat = GT_LanguageManager + .addStringLocalization("gt.blockmachines.gt_frame.desc.format", "Just something you can put covers on."); public final Materials mMaterial; public GT_MetaPipeEntity_Frame(int aID, String aName, String aNameRegional, Materials aMaterial) { @@ -30,7 +32,7 @@ public class GT_MetaPipeEntity_Frame extends MetaPipeEntity { GT_ModHandler.addCraftingRecipe( getStackForm(2), RecipeBits.NOT_REMOVABLE | GT_ModHandler.RecipeBits.BUFFERED, - new Object[] {"SSS", "SwS", "SSS", 'S', OrePrefixes.stick.get(mMaterial)}); + new Object[] { "SSS", "SwS", "SSS", 'S', OrePrefixes.stick.get(mMaterial) }); } if (!aMaterial.contains(SubTag.NO_RECIPES)) { @@ -60,18 +62,11 @@ 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 @@ -106,23 +101,23 @@ public class GT_MetaPipeEntity_Frame extends MetaPipeEntity { @Override public final void saveNBTData(NBTTagCompound aNBT) { - /*Do nothing*/ + /* Do nothing */ } @Override public final void loadNBTData(NBTTagCompound aNBT) { - /*Do nothing*/ + /* 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; } @@ -133,7 +128,7 @@ public class GT_MetaPipeEntity_Frame extends MetaPipeEntity { @Override public void disconnect(byte aSide) { - /* Do nothing*/ + /* Do nothing */ } @Override 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 5ae9150a58..5d2211528b 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 @@ -3,6 +3,23 @@ package gregtech.api.metatileentity.implementations; import static gregtech.api.enums.GT_Values.ALL_VALID_SIDES; import static gregtech.api.enums.Textures.BlockIcons.PIPE_RESTRICTOR; +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; +import net.minecraft.inventory.ISidedInventory; +import net.minecraft.item.ItemStack; +import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.tileentity.TileEntity; +import net.minecraft.tileentity.TileEntityDispenser; +import net.minecraft.tileentity.TileEntityHopper; +import net.minecraft.util.AxisAlignedBB; +import net.minecraft.world.World; +import net.minecraftforge.common.util.ForgeDirection; + import gregtech.GT_Mod; import gregtech.api.enums.Dyes; import gregtech.api.enums.GT_Values; @@ -22,23 +39,9 @@ import gregtech.api.util.GT_Utility; import gregtech.api.util.ISerializableObject; import gregtech.common.GT_Client; import gregtech.common.covers.CoverInfo; -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; -import net.minecraft.inventory.ISidedInventory; -import net.minecraft.item.ItemStack; -import net.minecraft.nbt.NBTTagCompound; -import net.minecraft.tileentity.TileEntity; -import net.minecraft.tileentity.TileEntityDispenser; -import net.minecraft.tileentity.TileEntityHopper; -import net.minecraft.util.AxisAlignedBB; -import net.minecraft.world.World; -import net.minecraftforge.common.util.ForgeDirection; public class GT_MetaPipeEntity_Item extends MetaPipeEntity implements IMetaTileEntityItemPipe { + public final float mThickNess; public final Materials mMaterial; public final int mStepSize; @@ -48,16 +51,8 @@ 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; @@ -67,26 +62,13 @@ 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; @@ -103,112 +85,87 @@ 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); + 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) - }; + 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) - }; + 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) - }; + 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) - }; + 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.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.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)) - }; + 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)) - }; + 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)) - }; + 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.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 @@ -268,10 +225,11 @@ public class GT_MetaPipeEntity_Item extends MetaPipeEntity implements IMetaTileE final ArrayList<IMetaTileEntityItemPipe> tPipeList = new ArrayList<>(); - for (boolean temp = true; temp && !isInventoryEmpty() && pipeCapacityCheck(); ) { + for (boolean temp = true; temp && !isInventoryEmpty() && pipeCapacityCheck();) { temp = false; tPipeList.clear(); - for (IMetaTileEntityItemPipe tTileEntity : GT_Utility.sortMapByValuesAcending( + for (IMetaTileEntityItemPipe tTileEntity : GT_Utility + .sortMapByValuesAcending( IMetaTileEntityItemPipe.Util.scanPipes(this, new HashMap<>(), 0, false, false)) .keySet()) { if (temp) break; @@ -289,8 +247,8 @@ 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) { final byte tSide = GT_Utility.determineWrenchingSide(aSide, aX, aY, aZ); if (isConnectedAtSide(tSide)) { @@ -305,34 +263,26 @@ 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); } @@ -353,8 +303,9 @@ 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; @@ -410,18 +361,17 @@ public class GT_MetaPipeEntity_Item extends MetaPipeEntity implements IMetaTileE 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; + aSender, + tInventory, + (byte) 6, + GT_Utility.getOppositeSide(aSide), + null, + false, + (byte) 64, + (byte) 1, + (byte) 64, + (byte) 1, + 1) > 0; } } } @@ -490,21 +440,14 @@ 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) - }; - else if (mTickTime % 20 == 0) - return new String[] { + if (mTickTime == 20) 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) - }; - else - return new String[] { + "Routing Value: %%%" + GT_Utility.formatNumbers(mStepSize) }; + else return new String[] { "Item Capacity: %%%" + getMaxPipeCapacity() + "%%% Stacks/%%%" + mTickTime + "%%% ticks", - "Routing Value: %%%" + GT_Utility.formatNumbers(mStepSize) - }; + "Routing Value: %%%" + GT_Utility.formatNumbers(mStepSize) }; } private boolean isInventoryEmpty() { @@ -567,19 +510,13 @@ public class GT_MetaPipeEntity_Item extends MetaPipeEntity implements IMetaTileE if ((tConn & (1 << ForgeDirection.WEST.ordinal())) != 0) tSide4 = 0f; if ((tConn & (1 << ForgeDirection.EAST.ordinal())) != 0) tSide5 = 1f; - return AxisAlignedBB.getBoundingBox( - aX + tSide4, aY + tSide0, aZ + tSide2, aX + tSide5, aY + tSide1, aZ + tSide3); + return AxisAlignedBB + .getBoundingBox(aX + tSide4, aY + tSide0, aZ + tSide2, aX + tSide5, aY + tSide1, aZ + tSide3); } @Override - 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) { final 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 c46dbe0bae..7eb396a293 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 @@ -2,10 +2,25 @@ package gregtech.api.metatileentity.implementations; import static gregtech.api.enums.GT_Values.V; +import java.util.List; + +import mcp.mobius.waila.api.IWailaConfigHandler; +import mcp.mobius.waila.api.IWailaDataAccessor; + +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.entity.player.EntityPlayerMP; +import net.minecraft.item.ItemStack; +import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.tileentity.TileEntity; +import net.minecraft.util.EnumChatFormatting; +import net.minecraft.util.StatCollector; +import net.minecraft.world.World; + import com.gtnewhorizons.modularui.api.screen.ModularWindow; import com.gtnewhorizons.modularui.api.screen.UIBuildContext; import com.gtnewhorizons.modularui.common.internal.wrapper.BaseSlot; import com.gtnewhorizons.modularui.common.widget.SlotGroup; + import gregtech.api.enums.Textures; import gregtech.api.gui.modularui.GT_UIInfos; import gregtech.api.interfaces.ITexture; @@ -16,44 +31,34 @@ import gregtech.api.items.GT_MetaBase_Item; import gregtech.api.util.GT_ModHandler; import gregtech.api.util.GT_Utility; import ic2.api.item.IElectricItem; -import java.util.List; -import mcp.mobius.waila.api.IWailaConfigHandler; -import mcp.mobius.waila.api.IWailaDataAccessor; -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.entity.player.EntityPlayerMP; -import net.minecraft.item.ItemStack; -import net.minecraft.nbt.NBTTagCompound; -import net.minecraft.tileentity.TileEntity; -import net.minecraft.util.EnumChatFormatting; -import net.minecraft.util.StatCollector; -import net.minecraft.world.World; /** * 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 + * This is the main construct for my Basic Machines such as the Automatic Extractor Extend this class to make a simple + * Machine */ public class GT_MetaTileEntity_BasicBatteryBuffer extends GT_MetaTileEntity_TieredMachineBlock implements IAddUIWidgets { + public boolean mCharge = false, mDecharge = false; public int mBatteryCount = 0, mChargeableCount = 0; private long count = 0; 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); } @@ -69,27 +74,18 @@ public class GT_MetaTileEntity_BasicBatteryBuffer extends GT_MetaTileEntity_Tier 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]; } @@ -231,11 +227,10 @@ public class GT_MetaTileEntity_BasicBatteryBuffer extends GT_MetaTileEntity_Tier mDecharge = aBaseMetaTileEntity.getStoredEU() < aBaseMetaTileEntity.getEUCapacity() / 3; mBatteryCount = 0; mChargeableCount = 0; - for (ItemStack tStack : mInventory) - if (GT_ModHandler.isElectricItem(tStack, mTier)) { - if (GT_ModHandler.isChargerItem(tStack)) mBatteryCount++; - mChargeableCount++; - } + for (ItemStack tStack : mInventory) if (GT_ModHandler.isElectricItem(tStack, mTier)) { + if (GT_ModHandler.isChargerItem(tStack)) mBatteryCount++; + mChargeableCount++; + } } count++; } @@ -244,8 +239,7 @@ 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") + 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") @@ -310,23 +304,24 @@ public class GT_MetaTileEntity_BasicBatteryBuffer extends GT_MetaTileEntity_Tier if (storedOverflow) { tStored = Long.MAX_VALUE; } - return new long[] {tStored, tScale}; + return new long[] { tStored, tScale }; } @Override public String[] getInfoData() { updateStorageInfo(); - 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" }; } private void updateStorageInfo() { @@ -339,29 +334,32 @@ public class GT_MetaTileEntity_BasicBatteryBuffer extends GT_MetaTileEntity_Tier } @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) { NBTTagCompound tag = accessor.getNBTData(); - currenttip.add(StatCollector.translateToLocalFormatted( - "GT5U.waila.energy.stored", - GT_Utility.formatNumbers(tag.getLong("mStored")), - GT_Utility.formatNumbers(tag.getLong("mMax")))); + currenttip.add( + StatCollector.translateToLocalFormatted( + "GT5U.waila.energy.stored", + GT_Utility.formatNumbers(tag.getLong("mStored")), + GT_Utility.formatNumbers(tag.getLong("mMax")))); long avgIn = tag.getLong("AvgIn"); long avgOut = tag.getLong("AvgOut"); - currenttip.add(StatCollector.translateToLocalFormatted( - "GT5U.waila.energy.avg_in", - GT_Utility.formatNumbers(avgIn), - GT_Utility.getColoredTierNameFromVoltage(avgIn))); - currenttip.add(StatCollector.translateToLocalFormatted( - "GT5U.waila.energy.avg_out", - GT_Utility.formatNumbers(avgOut), - GT_Utility.getColoredTierNameFromVoltage(avgOut))); + currenttip.add( + StatCollector.translateToLocalFormatted( + "GT5U.waila.energy.avg_in", + GT_Utility.formatNumbers(avgIn), + GT_Utility.getColoredTierNameFromVoltage(avgIn))); + currenttip.add( + StatCollector.translateToLocalFormatted( + "GT5U.waila.energy.avg_out", + GT_Utility.formatNumbers(avgOut), + GT_Utility.getColoredTierNameFromVoltage(avgOut))); 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) { updateStorageInfo(); super.getWailaNBTData(player, tile, tag, world, x, y, z); tag.setLong("mStored", mStored); @@ -384,60 +382,48 @@ public class GT_MetaTileEntity_BasicBatteryBuffer extends GT_MetaTileEntity_Tier public void addUIWidgets(ModularWindow.Builder builder, UIBuildContext buildContext) { switch (mInventory.length) { case 4: - builder.widget(SlotGroup.ofItemHandler(inventoryHandler, 2) - .startFromSlot(0) - .endAtSlot(3) - .slotCreator(index -> new BaseSlot(inventoryHandler, index) { - @Override - public int getSlotStackLimit() { - return 1; - } - }) - .background(getGUITextureSet().getItemSlot()) - .build() - .setPos(70, 25)); + builder.widget( + SlotGroup.ofItemHandler(inventoryHandler, 2).startFromSlot(0).endAtSlot(3) + .slotCreator(index -> new BaseSlot(inventoryHandler, index) { + + @Override + public int getSlotStackLimit() { + return 1; + } + }).background(getGUITextureSet().getItemSlot()).build().setPos(70, 25)); break; case 9: - builder.widget(SlotGroup.ofItemHandler(inventoryHandler, 3) - .startFromSlot(0) - .endAtSlot(8) - .slotCreator(index -> new BaseSlot(inventoryHandler, index) { - @Override - public int getSlotStackLimit() { - return 1; - } - }) - .background(getGUITextureSet().getItemSlot()) - .build() - .setPos(61, 16)); + builder.widget( + SlotGroup.ofItemHandler(inventoryHandler, 3).startFromSlot(0).endAtSlot(8) + .slotCreator(index -> new BaseSlot(inventoryHandler, index) { + + @Override + public int getSlotStackLimit() { + return 1; + } + }).background(getGUITextureSet().getItemSlot()).build().setPos(61, 16)); break; case 16: - builder.widget(SlotGroup.ofItemHandler(inventoryHandler, 4) - .startFromSlot(0) - .endAtSlot(15) - .slotCreator(index -> new BaseSlot(inventoryHandler, index) { - @Override - public int getSlotStackLimit() { - return 1; - } - }) - .background(getGUITextureSet().getItemSlot()) - .build() - .setPos(52, 7)); + builder.widget( + SlotGroup.ofItemHandler(inventoryHandler, 4).startFromSlot(0).endAtSlot(15) + .slotCreator(index -> new BaseSlot(inventoryHandler, index) { + + @Override + public int getSlotStackLimit() { + return 1; + } + }).background(getGUITextureSet().getItemSlot()).build().setPos(52, 7)); break; default: - builder.widget(SlotGroup.ofItemHandler(inventoryHandler, 1) - .startFromSlot(0) - .endAtSlot(0) - .slotCreator(index -> new BaseSlot(inventoryHandler, index) { - @Override - public int getSlotStackLimit() { - return 1; - } - }) - .background(getGUITextureSet().getItemSlot()) - .build() - .setPos(79, 34)); + builder.widget( + SlotGroup.ofItemHandler(inventoryHandler, 1).startFromSlot(0).endAtSlot(0) + .slotCreator(index -> new BaseSlot(inventoryHandler, index) { + + @Override + public int getSlotStackLimit() { + return 1; + } + }).background(getGUITextureSet().getItemSlot()).build().setPos(79, 34)); break; } } diff --git a/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_BasicGenerator.java b/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_BasicGenerator.java index ca5f255302..669b3c9495 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 @@ -2,6 +2,13 @@ package gregtech.api.metatileentity.implementations; import static gregtech.api.enums.GT_Values.V; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.init.Blocks; +import net.minecraft.item.ItemStack; +import net.minecraftforge.fluids.FluidStack; +import net.minecraftforge.fluids.IFluidContainerItem; +import net.minecraftforge.fluids.IFluidHandler; + import gregtech.api.enums.ItemList; import gregtech.api.enums.OrePrefixes; import gregtech.api.enums.Textures; @@ -14,21 +21,16 @@ import gregtech.api.util.GT_Recipe; import gregtech.api.util.GT_Recipe.GT_Recipe_Map; import gregtech.api.util.GT_Utility; import gregtech.common.GT_Pollution; -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.init.Blocks; -import net.minecraft.item.ItemStack; -import net.minecraftforge.fluids.FluidStack; -import net.minecraftforge.fluids.IFluidContainerItem; -import net.minecraftforge.fluids.IFluidHandler; 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); } @@ -59,21 +61,11 @@ 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 @@ -91,23 +83,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) { @@ -221,10 +213,11 @@ 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); @@ -262,9 +255,9 @@ public abstract class GT_MetaTileEntity_BasicGenerator extends GT_MetaTileEntity } } - if (aBaseMetaTileEntity.isServerSide()) - aBaseMetaTileEntity.setActive(aBaseMetaTileEntity.isAllowedToWork() - && aBaseMetaTileEntity.getUniversalEnergyStored() >= maxEUOutput() + getMinimumStoredEU()); + if (aBaseMetaTileEntity.isServerSide()) aBaseMetaTileEntity.setActive( + aBaseMetaTileEntity.isAllowedToWork() + && aBaseMetaTileEntity.getUniversalEnergyStored() >= maxEUOutput() + getMinimumStoredEU()); } /** @@ -279,17 +272,14 @@ public abstract class GT_MetaTileEntity_BasicGenerator extends GT_MetaTileEntity 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... } } @@ -341,9 +331,8 @@ 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 31420386ee..cb9c670f05 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 @@ -2,37 +2,33 @@ package gregtech.api.metatileentity.implementations; import static gregtech.api.enums.GT_Values.V; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.item.ItemStack; + import gregtech.api.enums.Textures; import gregtech.api.interfaces.ITexture; import gregtech.api.interfaces.metatileentity.IMetaTileEntity; import gregtech.api.interfaces.tileentity.IGregTechTileEntity; -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.item.ItemStack; 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); } @@ -117,13 +113,8 @@ 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]; } @@ -131,18 +122,15 @@ 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 716d9d2c12..1296d846af 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,29 +4,25 @@ 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 632b8cca8b..501e78ccec 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 @@ -19,6 +19,29 @@ import static gregtech.api.metatileentity.BaseTileEntity.TOOLTIP_DELAY; import static gregtech.api.metatileentity.BaseTileEntity.UNUSED_SLOT_TOOLTIP; import static gregtech.api.util.GT_Utility.moveMultipleItemStacks; +import java.util.Arrays; +import java.util.Collections; +import java.util.List; + +import mcp.mobius.waila.api.IWailaConfigHandler; +import mcp.mobius.waila.api.IWailaDataAccessor; + +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.entity.player.EntityPlayerMP; +import net.minecraft.entity.player.InventoryPlayer; +import net.minecraft.item.ItemStack; +import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.tileentity.TileEntity; +import net.minecraft.util.EnumChatFormatting; +import net.minecraft.util.StatCollector; +import net.minecraft.world.World; +import net.minecraftforge.common.DimensionManager; +import net.minecraftforge.common.util.ForgeDirection; +import net.minecraftforge.fluids.FluidStack; +import net.minecraftforge.fluids.IFluidHandler; + +import org.apache.commons.lang3.tuple.Pair; + import com.gtnewhorizons.modularui.api.drawable.IDrawable; import com.gtnewhorizons.modularui.api.drawable.UITexture; import com.gtnewhorizons.modularui.api.math.Pos2d; @@ -32,6 +55,7 @@ import com.gtnewhorizons.modularui.common.widget.DrawableWidget; import com.gtnewhorizons.modularui.common.widget.FakeSyncWidget; import com.gtnewhorizons.modularui.common.widget.ProgressBar; import com.gtnewhorizons.modularui.common.widget.SlotWidget; + import gregtech.GT_Mod; import gregtech.api.GregTech_API; import gregtech.api.enums.ItemList; @@ -55,31 +79,12 @@ import gregtech.common.gui.modularui.widget.FluidDisplaySlotWidget; 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.Collections; -import java.util.List; -import mcp.mobius.waila.api.IWailaConfigHandler; -import mcp.mobius.waila.api.IWailaDataAccessor; -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.entity.player.EntityPlayerMP; -import net.minecraft.entity.player.InventoryPlayer; -import net.minecraft.item.ItemStack; -import net.minecraft.nbt.NBTTagCompound; -import net.minecraft.tileentity.TileEntity; -import net.minecraft.util.EnumChatFormatting; -import net.minecraft.util.StatCollector; -import net.minecraft.world.World; -import net.minecraftforge.common.DimensionManager; -import net.minecraftforge.common.util.ForgeDirection; -import net.minecraftforge.fluids.FluidStack; -import net.minecraftforge.fluids.IFluidHandler; -import org.apache.commons.lang3.tuple.Pair; /** * 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 + * 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, IAddGregtechLogo, IAddUIWidgets { @@ -87,20 +92,14 @@ public abstract class GT_MetaTileEntity_BasicMachine extends GT_MetaTileEntity_B /** * return values for checkRecipe() */ - protected static final int DID_NOT_FIND_RECIPE = 0, - FOUND_RECIPE_BUT_DID_NOT_MEET_REQUIREMENTS = 1, + 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; @@ -109,40 +108,23 @@ public abstract class GT_MetaTileEntity_BasicMachine extends GT_MetaTileEntity_B protected final Power mPower; /** - * Contains the Recipe which has been previously used, or null if there was no previous Recipe, which could have been buffered + * 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; /** - * @param aOverlays 0 = SideFacingActive - * 1 = SideFacingInactive - * 2 = FrontFacingActive - * 3 = FrontFacingInactive - * 4 = TopFacingActive - * 5 = TopFacingInactive - * 6 = BottomFacingActive - * 7 = BottomFacingInactive - * ----- Not all Array Elements have to be initialised, you can also just use 8 Parameters for the Default Pipe Texture Overlays ----- - * 8 = BottomFacingPipeActive - * 9 = BottomFacingPipeInactive - * 10 = TopFacingPipeActive - * 11 = TopFacingPipeInactive - * 12 = SideFacingPipeActive - * 13 = SideFacingPipeInactive + * @param aOverlays 0 = SideFacingActive 1 = SideFacingInactive 2 = FrontFacingActive 3 = FrontFacingInactive 4 = + * TopFacingActive 5 = TopFacingInactive 6 = BottomFacingActive 7 = BottomFacingInactive ----- Not + * all Array Elements have to be initialised, you can also just use 8 Parameters for the Default + * Pipe Texture Overlays ----- 8 = BottomFacingPipeActive 9 = BottomFacingPipeInactive 10 = + * TopFacingPipeActive 11 = TopFacingPipeInactive 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, + 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, @@ -160,17 +142,8 @@ 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, + 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, @@ -188,16 +161,8 @@ 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)]; @@ -207,16 +172,8 @@ 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)]; @@ -253,12 +210,10 @@ public abstract class GT_MetaTileEntity_BasicMachine extends GT_MetaTileEntity_B ITexture[][][] rTextures = new ITexture[14][17][]; 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]}; - } + 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] }; + } for (byte c = -1; c < 16; c++) { if (rTextures[0][c + 1] == null) rTextures[0][c + 1] = getSideFacingActive(c); @@ -280,28 +235,16 @@ 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 @@ -326,8 +269,7 @@ public abstract class GT_MetaTileEntity_BasicMachine extends GT_MetaTileEntity_B @Override public boolean isValidSlot(int aIndex) { - return aIndex > 0 - && super.isValidSlot(aIndex) + return aIndex > 0 && super.isValidSlot(aIndex) && aIndex != getCircuitSlot() && aIndex != OTHER_SLOT_COUNT + mInputSlotCount + mOutputItems.length; } @@ -359,9 +301,7 @@ 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 @@ -456,8 +396,7 @@ 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 @@ -556,8 +495,7 @@ public abstract class GT_MetaTileEntity_BasicMachine extends GT_MetaTileEntity_B aBaseMetaTileEntity, getLocalName(), mGUIName, - GT_Utility.isStringValid(mNEIName) - ? mNEIName + GT_Utility.isStringValid(mNEIName) ? mNEIName : getRecipeList() != null ? getRecipeList().mUnlocalizedName : ""); } @@ -565,8 +503,8 @@ public abstract class GT_MetaTileEntity_BasicMachine extends GT_MetaTileEntity_B public void initDefaultModes(NBTTagCompound aNBT) { mMainFacing = -1; if (!getBaseMetaTileEntity().getWorld().isRemote) { - GT_ClientPreference tPreference = GT_Mod.gregtechproxy.getClientPreference( - getBaseMetaTileEntity().getOwnerUuid()); + GT_ClientPreference tPreference = GT_Mod.gregtechproxy + .getClientPreference(getBaseMetaTileEntity().getOwnerUuid()); if (tPreference != null) { mDisableFilter = !tPreference.isSingleBlockInitialFilterEnabled(); mDisableMultiStack = !tPreference.isSingleBlockInitialMultiStackEnabled(); @@ -631,9 +569,9 @@ public abstract class GT_MetaTileEntity_BasicMachine extends GT_MetaTileEntity_B if (mProgresstime < 0 || drainEnergyForProcess(mEUt)) { if (++mProgresstime >= mMaxProgresstime) { for (int i = 0; i < mOutputItems.length; i++) - for (int j = 0; j < mOutputItems.length; j++) - if (aBaseMetaTileEntity.addStackToSlot( - getOutputSlot() + ((j + i) % mOutputItems.length), mOutputItems[i])) break; + for (int j = 0; j < mOutputItems.length; j++) if (aBaseMetaTileEntity + .addStackToSlot(getOutputSlot() + ((j + i) % mOutputItems.length), mOutputItems[i])) + break; if (mOutputFluid != null) if (getDrainableStack() == null) setDrainableStack(mOutputFluid.copy()); else if (mOutputFluid.isFluidEqual(getDrainableStack())) @@ -666,8 +604,7 @@ public abstract class GT_MetaTileEntity_BasicMachine extends GT_MetaTileEntity_B boolean tRemovedOutputFluid = false; - if (doesAutoOutputFluids() - && getDrainableStack() != null + if (doesAutoOutputFluids() && getDrainableStack() != null && aBaseMetaTileEntity.getFrontFacing() != mMainFacing && (tSucceeded || aTick % 20 == 0)) { IFluidHandler tTank = aBaseMetaTileEntity.getITankContainerAtSide(aBaseMetaTileEntity.getFrontFacing()); @@ -675,22 +612,21 @@ public abstract class GT_MetaTileEntity_BasicMachine extends GT_MetaTileEntity_B FluidStack tDrained = drain(1000, false); if (tDrained != null) { int tFilledAmount = tTank.fill( - ForgeDirection.getOrientation(aBaseMetaTileEntity.getBackFacing()), tDrained, false); - if (tFilledAmount > 0) - tTank.fill( - ForgeDirection.getOrientation(aBaseMetaTileEntity.getBackFacing()), - drain(tFilledAmount, true), - true); + ForgeDirection.getOrientation(aBaseMetaTileEntity.getBackFacing()), + tDrained, + false); + if (tFilledAmount > 0) tTank.fill( + ForgeDirection.getOrientation(aBaseMetaTileEntity.getBackFacing()), + drain(tFilledAmount, true), + true); } } if (getDrainableStack() == null) tRemovedOutputFluid = true; } - if (doesAutoOutput() - && !isOutputEmpty() + if (doesAutoOutput() && !isOutputEmpty() && aBaseMetaTileEntity.getFrontFacing() != mMainFacing - && (tSucceeded - || mOutputBlocked % 300 == 1 + && (tSucceeded || mOutputBlocked % 300 == 1 || aBaseMetaTileEntity.hasInventoryBeenModified() || aTick % 600 == 0)) { TileEntity tTileEntity2 = aBaseMetaTileEntity.getTileEntityAtSide(aBaseMetaTileEntity.getFrontFacing()); @@ -710,24 +646,21 @@ public abstract class GT_MetaTileEntity_BasicMachine extends GT_MetaTileEntity_B (byte) 64, (byte) 1, tMaxStacks); - // for (int i = 0, tCosts = 1; i < mOutputItems.length && tCosts > 0 && + // for (int i = 0, tCosts = 1; i < mOutputItems.length && tCosts > 0 && // aBaseMetaTileEntity.isUniversalEnergyStored(128); i++) { - // tCosts = GT_Utility.moveOneItemStack(aBaseMetaTileEntity, tTileEntity2, + // 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 (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 + if (mMaxProgresstime <= 0 && aBaseMetaTileEntity.isAllowedToWork() + && (tRemovedOutputFluid || tSucceeded || aBaseMetaTileEntity.hasInventoryBeenModified() || aTick % 600 == 0 || aBaseMetaTileEntity.hasWorkJustBeenEnabled()) @@ -764,11 +697,11 @@ public abstract class GT_MetaTileEntity_BasicMachine extends GT_MetaTileEntity_B } // Only using mNeedsSteamVenting right now and assigning it to 64 to space in the range for more single block // machine problems. - // Value | Class | Field - // 1 | GT_MetaTileEntity_BasicMachine | mStuttering - // 64 | GT_MetaTileEntity_BasicMachine_Bronze | mNeedsSteamVenting - aBaseMetaTileEntity.setErrorDisplayID( - (aBaseMetaTileEntity.getErrorDisplayID() & ~127)); // | (mStuttering ? 1 : 0)); + // Value | Class | Field + // 1 | GT_MetaTileEntity_BasicMachine | mStuttering + // 64 | GT_MetaTileEntity_BasicMachine_Bronze | mNeedsSteamVenting + aBaseMetaTileEntity.setErrorDisplayID((aBaseMetaTileEntity.getErrorDisplayID() & ~127)); // | (mStuttering ? 1 : + // 0)); } protected void doDisplayThings() { @@ -798,8 +731,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()); } } } @@ -818,8 +751,9 @@ public abstract class GT_MetaTileEntity_BasicMachine extends GT_MetaTileEntity_B /** * Calcualtes overclocked ness using long integers - * @param aEUt - recipe EUt - * @param aDuration - recipe Duration + * + * @param aEUt - recipe EUt + * @param aDuration - recipe Duration */ protected void calculateOverclockedNess(int aEUt, int aDuration) { mPower.computePowerUsageAndDuration(aEUt, aDuration); @@ -842,32 +776,27 @@ 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 + 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; - } + mOutputBlocked++; + return false; + } return true; } 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) { @@ -884,11 +813,10 @@ public abstract class GT_MetaTileEntity_BasicMachine extends GT_MetaTileEntity_B protected boolean isOutputEmpty() { boolean rIsEmpty = true; - for (ItemStack tOutputSlotContent : getAllOutputs()) - if (tOutputSlotContent != null) { - rIsEmpty = false; - break; - } + for (ItemStack tOutputSlotContent : getAllOutputs()) if (tOutputSlotContent != null) { + rIsEmpty = false; + break; + } return rIsEmpty; } @@ -973,22 +901,30 @@ 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" }; } @Override @@ -1002,28 +938,29 @@ public abstract class GT_MetaTileEntity_BasicMachine extends GT_MetaTileEntity_B if (aPlayer.isSneaking()) { mDisableFilter = !mDisableFilter; GT_Utility.sendChatToPlayer( - aPlayer, StatCollector.translateToLocal("GT5U.hatch.disableFilter." + mDisableFilter)); + aPlayer, + StatCollector.translateToLocal("GT5U.hatch.disableFilter." + mDisableFilter)); } else { mAllowInputFromOutputSide = !mAllowInputFromOutputSide; GT_Utility.sendChatToPlayer( aPlayer, - mAllowInputFromOutputSide - ? GT_Utility.trans("095", "Input from Output Side allowed") + 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) { + 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)); + aPlayer, + StatCollector.translateToLocal("GT5U.hatch.disableMultiStack." + mDisableMultiStack)); return true; } @@ -1045,10 +982,10 @@ 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() + if (aSide == mMainFacing || aIndex < getInputSlot() || aIndex >= getInputSlot() + mInputSlotCount - || (!mAllowInputFromOutputSide && aSide == aBaseMetaTileEntity.getFrontFacing())) return false; + || (!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; @@ -1056,12 +993,12 @@ public abstract class GT_MetaTileEntity_BasicMachine extends GT_MetaTileEntity_B } /** - * Test if given stack can be inserted into specified slot. - * 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. + * Test if given stack can be inserted into specified slot. 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; } @@ -1105,7 +1042,8 @@ public abstract class GT_MetaTileEntity_BasicMachine extends GT_MetaTileEntity_B } /** - * Override this to check the Recipes yourself, super calls to this could be useful if you just want to add a special case + * Override this to check the Recipes yourself, super calls to this could be useful if you just want to add a + * special case * <p/> * I thought about Enum too, but Enum doesn't add support for people adding other return Systems. * <p/> @@ -1129,8 +1067,7 @@ public abstract class GT_MetaTileEntity_BasicMachine extends GT_MetaTileEntity_B /** * * @param skipOC disables OverclockedNess calculation and check - if you do you must implement your own method... - * @return DID_NOT_FIND_RECIPE = 0, - * FOUND_RECIPE_BUT_DID_NOT_MEET_REQUIREMENTS = 1, + * @return DID_NOT_FIND_RECIPE = 0, FOUND_RECIPE_BUT_DID_NOT_MEET_REQUIREMENTS = 1, * FOUND_AND_SUCCESSFULLY_USED_RECIPE = 2; */ public int checkRecipe(boolean skipOC) { @@ -1141,13 +1078,12 @@ public abstract class GT_MetaTileEntity_BasicMachine extends GT_MetaTileEntity_B mLastRecipe, false, V[mTier], - new FluidStack[] {getFillableStack()}, + new FluidStack[] { getFillableStack() }, getSpecialSlot(), getAllInputs()); if (tRecipe == null) return DID_NOT_FIND_RECIPE; - if (GT_Mod.gregtechproxy.mLowGravProcessing - && (tRecipe.mSpecialValue == -100 || tRecipe.mSpecialValue == -300) + 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; @@ -1156,26 +1092,25 @@ public abstract class GT_MetaTileEntity_BasicMachine extends GT_MetaTileEntity_B return FOUND_RECIPE_BUT_DID_NOT_MEET_REQUIREMENTS; } if (tRecipe.mSpecialValue == -200 - && (getCallbackBase() == null - || !(getCallbackBase() instanceof GT_MetaTileEntity_Cleanroom) + && (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); - } - mOutputItems[i] = null; - } + 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) { calculateOverclockedNess(tRecipe); @@ -1187,64 +1122,64 @@ 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(); if (tag.getBoolean("stutteringSingleBlock")) { @@ -1254,35 +1189,40 @@ public abstract class GT_MetaTileEntity_BasicMachine extends GT_MetaTileEntity_B if (isActive) { int mEUt = tag.getInteger("eut"); if (mEUt > 0) { - currenttip.add(StatCollector.translateToLocalFormatted( - "GT5U.waila.energy.use", - GT_Utility.formatNumbers(mEUt), - GT_Utility.getColoredTierNameFromVoltage(mEUt))); + currenttip.add( + StatCollector.translateToLocalFormatted( + "GT5U.waila.energy.use", + GT_Utility.formatNumbers(mEUt), + GT_Utility.getColoredTierNameFromVoltage(mEUt))); } else if (mEUt < 0) { - currenttip.add(StatCollector.translateToLocalFormatted( - "GT5U.waila.energy.produce", - GT_Utility.formatNumbers(-mEUt), - GT_Utility.getColoredTierNameFromVoltage(-mEUt))); + currenttip.add( + StatCollector.translateToLocalFormatted( + "GT5U.waila.energy.produce", + GT_Utility.formatNumbers(-mEUt), + GT_Utility.getColoredTierNameFromVoltage(-mEUt))); } } - currenttip.add(GT_Waila.getMachineProgressString( - isActive, tag.getInteger("maxProgressSingleBlock"), tag.getInteger("progressSingleBlock"))); + currenttip.add( + GT_Waila.getMachineProgressString( + isActive, + tag.getInteger("maxProgressSingleBlock"), + tag.getInteger("progressSingleBlock"))); } - currenttip.add(String.format( - "Machine Facing: %s", - ForgeDirection.getOrientation(tag.getInteger("mainFacingSingleBlock")) - .name())); + currenttip.add( + String.format( + "Machine Facing: %s", + ForgeDirection.getOrientation(tag.getInteger("mainFacingSingleBlock")).name())); - currenttip.add(String.format( - "Output Facing: %s", - ForgeDirection.getOrientation(tag.getInteger("outputFacingSingleBlock")) - .name())); + currenttip.add( + String.format( + "Output Facing: %s", + ForgeDirection.getOrientation(tag.getInteger("outputFacingSingleBlock")).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); tag.setInteger("progressSingleBlock", mProgresstime); @@ -1324,10 +1264,9 @@ public abstract class GT_MetaTileEntity_BasicMachine extends GT_MetaTileEntity_B if (getRecipeList() != null) { getRecipeList().addGregTechLogoUI(builder, new Pos2d(0, 0)); } else { - builder.widget(new DrawableWidget() - .setDrawable(getGUITextureSet().getGregTechLogo()) - .setSize(17, 17) - .setPos(152, 63)); + builder.widget( + new DrawableWidget().setDrawable(getGUITextureSet().getGregTechLogo()).setSize(17, 17) + .setPos(152, 63)); } } @@ -1342,31 +1281,32 @@ public abstract class GT_MetaTileEntity_BasicMachine extends GT_MetaTileEntity_B builder.widget(createChargerSlot(79, 62)); if (getRecipeList() != null) { - builder.widget(setNEITransferRect( - createProgressBar( - isSteampowered() - ? getRecipeList().getProgressBarTextureSteam(getSteamVariant()) - : getRecipeList().getProgressBarTexture(), - getRecipeList().getProgressBarImageSize(), - getRecipeList().progressBarDirection, - getRecipeList().progressBarPos, - getRecipeList().progressBarSize), - getRecipeList().mNEIName)); + builder.widget( + setNEITransferRect( + createProgressBar( + isSteampowered() ? getRecipeList().getProgressBarTextureSteam(getSteamVariant()) + : getRecipeList().getProgressBarTexture(), + getRecipeList().getProgressBarImageSize(), + getRecipeList().progressBarDirection, + getRecipeList().progressBarPos, + getRecipeList().progressBarSize), + getRecipeList().mNEIName)); addProgressBarSpecialTextures(builder); } - builder.widget(createErrorStatusArea( - builder, - isSteampowered() ? GT_UITextures.PICTURE_STALLED_STEAM : GT_UITextures.PICTURE_STALLED_ELECTRICITY)); + builder.widget( + createErrorStatusArea( + builder, + isSteampowered() ? GT_UITextures.PICTURE_STALLED_STEAM + : GT_UITextures.PICTURE_STALLED_ELECTRICITY)); } /** * Adds item I/O, special item, and fluid I/O slots. */ protected void addIOSlots(ModularWindow.Builder builder) { - final boolean hasFluidInput = - getRecipeList() != null ? (getRecipeList().hasFluidInputs()) : (getCapacity() != 0); - final boolean hasFluidOutput = - getRecipeList() != null && getRecipeList().hasFluidOutputs(); + final boolean hasFluidInput = getRecipeList() != null ? (getRecipeList().hasFluidInputs()) + : (getCapacity() != 0); + final boolean hasFluidOutput = getRecipeList() != null && getRecipeList().hasFluidOutputs(); UIHelper.forEachSlots( (i, backgrounds, pos) -> builder.widget(createItemInputSlot(i, backgrounds, pos)), (i, backgrounds, pos) -> builder.widget(createItemOutputSlot(i, backgrounds, pos)), @@ -1388,59 +1328,48 @@ public abstract class GT_MetaTileEntity_BasicMachine extends GT_MetaTileEntity_B * Override this as needed instead of calling. */ protected SlotWidget createItemInputSlot(int index, IDrawable[] backgrounds, Pos2d pos) { - return (SlotWidget) new SlotWidget(inventoryHandler, getInputSlot() + index) - .setAccess(true, true) - .setBackground(backgrounds) - .setPos(pos); + return (SlotWidget) new SlotWidget(inventoryHandler, getInputSlot() + index).setAccess(true, true) + .setBackground(backgrounds).setPos(pos); } /** * Override this as needed instead of calling. */ protected SlotWidget createItemOutputSlot(int index, IDrawable[] backgrounds, Pos2d pos) { - return (SlotWidget) new SlotWidget(inventoryHandler, getOutputSlot() + index) - .setAccess(true, false) - .setBackground(backgrounds) - .setPos(pos); + return (SlotWidget) new SlotWidget(inventoryHandler, getOutputSlot() + index).setAccess(true, false) + .setBackground(backgrounds).setPos(pos); } /** * Override this as needed instead of calling. */ protected SlotWidget createSpecialSlot(IDrawable[] backgrounds, Pos2d pos) { - return (SlotWidget) new SlotWidget(inventoryHandler, getSpecialSlotIndex()) - .setAccess(true, true) + return (SlotWidget) new SlotWidget(inventoryHandler, getSpecialSlotIndex()).setAccess(true, true) .disableShiftInsert() - .setGTTooltip(() -> mTooltipCache.getData( - getRecipeList() != null && getRecipeList().usesSpecialSlot() - ? SPECIAL_SLOT_TOOLTIP - : UNUSED_SLOT_TOOLTIP)) - .setTooltipShowUpDelay(TOOLTIP_DELAY) - .setBackground(backgrounds) - .setPos(pos); + .setGTTooltip( + () -> mTooltipCache.getData( + getRecipeList() != null && getRecipeList().usesSpecialSlot() ? SPECIAL_SLOT_TOOLTIP + : UNUSED_SLOT_TOOLTIP)) + .setTooltipShowUpDelay(TOOLTIP_DELAY).setBackground(backgrounds).setPos(pos); } protected FluidDisplaySlotWidget createFluidInputSlot(IDrawable[] backgrounds, Pos2d pos) { return (FluidDisplaySlotWidget) new FluidDisplaySlotWidget( - inventoryHandler, OTHER_SLOT_COUNT + mInputSlotCount + mOutputItems.length) - .setFluidAccessConstructor(() -> constructFluidAccess(true)) - .setIHasFluidDisplay(this) - .setCanDrain(true) - .setCanFill(true) - .setActionRealClick(FluidDisplaySlotWidget.Action.TRANSFER) - .setBeforeRealClick((clickData, widget) -> { - if (NetworkUtils.isClient()) { - // propagate display item content to actual fluid stored in this tank - setFillableStack(GT_Utility.getFluidFromDisplayStack( - widget.getMcSlot().getStack())); - } - return true; - }) - .setUpdateFluidDisplayItem(this::updateFluidInputDisplayItem) - .setGTTooltip(() -> mTooltipCache.getData(FLUID_INPUT_TOOLTIP, GT_Utility.formatNumbers(getCapacity()))) - .setTooltipShowUpDelay(TOOLTIP_DELAY) - .setBackground(backgrounds) - .setPos(pos); + inventoryHandler, + OTHER_SLOT_COUNT + mInputSlotCount + mOutputItems.length) + .setFluidAccessConstructor(() -> constructFluidAccess(true)).setIHasFluidDisplay(this) + .setCanDrain(true).setCanFill(true).setActionRealClick(FluidDisplaySlotWidget.Action.TRANSFER) + .setBeforeRealClick((clickData, widget) -> { + if (NetworkUtils.isClient()) { + // propagate display item content to actual fluid stored in this tank + setFillableStack(GT_Utility.getFluidFromDisplayStack(widget.getMcSlot().getStack())); + } + return true; + }).setUpdateFluidDisplayItem(this::updateFluidInputDisplayItem) + .setGTTooltip( + () -> mTooltipCache + .getData(FLUID_INPUT_TOOLTIP, GT_Utility.formatNumbers(getCapacity()))) + .setTooltipShowUpDelay(TOOLTIP_DELAY).setBackground(backgrounds).setPos(pos); } protected FluidDisplaySlotWidget createFluidOutputSlot(IDrawable[] backgrounds, Pos2d pos) { @@ -1448,9 +1377,7 @@ public abstract class GT_MetaTileEntity_BasicMachine extends GT_MetaTileEntity_B .setUpdateFluidDisplayItem(this::updateFluidOutputDisplayItem) .setGTTooltip( () -> mTooltipCache.getData(FLUID_OUTPUT_TOOLTIP, GT_Utility.formatNumbers(getCapacity()))) - .setTooltipShowUpDelay(TOOLTIP_DELAY) - .setBackground(backgrounds) - .setPos(pos); + .setTooltipShowUpDelay(TOOLTIP_DELAY).setBackground(backgrounds).setPos(pos); } @Override @@ -1464,35 +1391,26 @@ public abstract class GT_MetaTileEntity_BasicMachine extends GT_MetaTileEntity_B } protected CycleButtonWidget createItemAutoOutputButton() { - return (CycleButtonWidget) new CycleButtonWidget() - .setToggle(() -> mItemTransfer, val -> mItemTransfer = val) + return (CycleButtonWidget) new CycleButtonWidget().setToggle(() -> mItemTransfer, val -> mItemTransfer = val) .setStaticTexture(GT_UITextures.OVERLAY_BUTTON_AUTOOUTPUT_ITEM) .setVariableBackground(GT_UITextures.BUTTON_STANDARD_TOGGLE) - .setGTTooltip(() -> mTooltipCache.getData(ITEM_TRANSFER_TOOLTIP)) - .setTooltipShowUpDelay(TOOLTIP_DELAY) - .setPos(25, 62) - .setSize(18, 18); + .setGTTooltip(() -> mTooltipCache.getData(ITEM_TRANSFER_TOOLTIP)).setTooltipShowUpDelay(TOOLTIP_DELAY) + .setPos(25, 62).setSize(18, 18); } protected CycleButtonWidget createFluidAutoOutputButton() { - return (CycleButtonWidget) new CycleButtonWidget() - .setToggle(() -> mFluidTransfer, val -> mFluidTransfer = val) + return (CycleButtonWidget) new CycleButtonWidget().setToggle(() -> mFluidTransfer, val -> mFluidTransfer = val) .setStaticTexture(GT_UITextures.OVERLAY_BUTTON_AUTOOUTPUT_FLUID) .setVariableBackground(GT_UITextures.BUTTON_STANDARD_TOGGLE) - .setGTTooltip(() -> mTooltipCache.getData(FLUID_TRANSFER_TOOLTIP)) - .setTooltipShowUpDelay(TOOLTIP_DELAY) - .setPos(7, 62) - .setSize(18, 18); + .setGTTooltip(() -> mTooltipCache.getData(FLUID_TRANSFER_TOOLTIP)).setTooltipShowUpDelay(TOOLTIP_DELAY) + .setPos(7, 62).setSize(18, 18); } - protected ProgressBar createProgressBar( - UITexture texture, int imageSize, ProgressBar.Direction direction, Pos2d pos, Size size) { + protected ProgressBar createProgressBar(UITexture texture, int imageSize, ProgressBar.Direction direction, + Pos2d pos, Size size) { final ProgressBar ret = new ProgressBar(); ret.setProgress(() -> maxProgresstime() != 0 ? (float) getProgresstime() / maxProgresstime() : 0) - .setTexture(texture, imageSize) - .setDirection(direction) - .setPos(pos) - .setSize(size); + .setTexture(texture, imageSize).setDirection(direction).setPos(pos).setSize(size); return ret; } @@ -1505,13 +1423,13 @@ public abstract class GT_MetaTileEntity_BasicMachine extends GT_MetaTileEntity_B final Power powerInfo = getPower(); final String transferRectTooltip; if (isSteampowered()) { - transferRectTooltip = - StatCollector.translateToLocalFormatted(NEI_TRANSFER_STEAM_TOOLTIP, powerInfo.getTierString()); + transferRectTooltip = StatCollector + .translateToLocalFormatted(NEI_TRANSFER_STEAM_TOOLTIP, powerInfo.getTierString()); } else { - transferRectTooltip = StatCollector.translateToLocalFormatted( - NEI_TRANSFER_VOLTAGE_TOOLTIP, powerInfo.getTierString()); + transferRectTooltip = StatCollector + .translateToLocalFormatted(NEI_TRANSFER_VOLTAGE_TOOLTIP, powerInfo.getTierString()); } - widget.setNEITransferRect(transferRectID, new Object[] {powerInfo}, transferRectTooltip); + widget.setNEITransferRect(transferRectID, new Object[] { powerInfo }, transferRectTooltip); } return widget; } @@ -1519,30 +1437,25 @@ public abstract class GT_MetaTileEntity_BasicMachine extends GT_MetaTileEntity_B protected void addProgressBarSpecialTextures(ModularWindow.Builder builder) { if (isSteampowered()) { for (Pair<SteamTexture, Pair<Size, Pos2d>> specialTexture : getRecipeList().specialTexturesSteam) { - builder.widget(new DrawableWidget() - .setDrawable(specialTexture.getLeft().get(getSteamVariant())) - .setSize(specialTexture.getRight().getLeft()) - .setPos(specialTexture.getRight().getRight())); + builder.widget( + new DrawableWidget().setDrawable(specialTexture.getLeft().get(getSteamVariant())) + .setSize(specialTexture.getRight().getLeft()) + .setPos(specialTexture.getRight().getRight())); } } else { for (Pair<IDrawable, Pair<Size, Pos2d>> specialTexture : getRecipeList().specialTextures) { - builder.widget(new DrawableWidget() - .setDrawable(specialTexture.getLeft()) - .setSize(specialTexture.getRight().getLeft()) - .setPos(specialTexture.getRight().getRight())); + builder.widget( + new DrawableWidget().setDrawable(specialTexture.getLeft()) + .setSize(specialTexture.getRight().getLeft()) + .setPos(specialTexture.getRight().getRight())); } } } protected DrawableWidget createErrorStatusArea(ModularWindow.Builder builder, IDrawable picture) { - return (DrawableWidget) new DrawableWidget() - .setDrawable(picture) - .setTooltipShowUpDelay(TOOLTIP_DELAY) - .setEnabled(widget -> !widget.getTooltip().isEmpty()) - .dynamicTooltip(this::getErrorDescriptions) - .dynamicTooltipShift(this::getErrorDescriptionsShift) - .setPos(79, 44) - .setSize(18, 18) + return (DrawableWidget) new DrawableWidget().setDrawable(picture).setTooltipShowUpDelay(TOOLTIP_DELAY) + .setEnabled(widget -> !widget.getTooltip().isEmpty()).dynamicTooltip(this::getErrorDescriptions) + .dynamicTooltipShift(this::getErrorDescriptionsShift).setPos(79, 44).setSize(18, 18) .attachSyncer( new FakeSyncWidget.BooleanSyncer(() -> mStuttering, val -> mStuttering = val), builder, 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 468566e582..9bccd8f093 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 @@ -4,8 +4,16 @@ import static gregtech.api.enums.GT_Values.D1; import static gregtech.api.enums.Textures.BlockIcons.*; import static gregtech.api.objects.XSTR.XSTR_INSTANCE; +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 com.gtnewhorizons.modularui.api.screen.ModularWindow; import com.gtnewhorizons.modularui.common.widget.DrawableWidget; + import gregtech.api.GregTech_API; import gregtech.api.enums.Dyes; import gregtech.api.enums.ParticleFX; @@ -22,30 +30,20 @@ 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; /** * 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 + * 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_Bronze extends GT_MetaTileEntity_BasicMachine { + 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) { + public GT_MetaTileEntity_BasicMachine_Bronze(int aID, String aName, String aNameRegional, String aDescription, + int aInputSlotCount, int aOutputSlotCount, boolean aHighPressure) { super( aID, aName, @@ -59,23 +57,13 @@ public abstract class GT_MetaTileEntity_BasicMachine_Bronze extends GT_MetaTileE ""); } - 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, "", ""); } - 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, "", ""); } @@ -173,51 +161,27 @@ public abstract class GT_MetaTileEntity_BasicMachine_Bronze extends GT_MetaTileE @Override public boolean allowToCheckRecipe() { if (mNeedsSteamVenting - && getBaseMetaTileEntity() - .getCoverIDAtSide(getBaseMetaTileEntity().getFrontFacing()) - == 0 + && 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))) { + 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() + 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) + 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) + getBaseMetaTileEntity().getOffsetY(getBaseMetaTileEntity().getFrontFacing(), 1) + 1, - getBaseMetaTileEntity() - .getOffsetZ( - getBaseMetaTileEntity() - .getFrontFacing(), - 1) + getBaseMetaTileEntity().getOffsetZ(getBaseMetaTileEntity().getFrontFacing(), 1) + 1))) { GT_Utility.applyHeatDamage(tLiving, getSteamDamage()); } @@ -230,11 +194,13 @@ 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)) + 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); @@ -261,27 +227,17 @@ public abstract class GT_MetaTileEntity_BasicMachine_Bronze extends GT_MetaTileE if (aIndex == 9) { GT_Utility.doSoundAtClient(SoundResource.RANDOM_FIZZ, 5, 1.0F, aX, aY, aZ); - new ParticleEventBuilder() - .setIdentifier(ParticleFX.CLOUD) - .setWorld(getBaseMetaTileEntity().getWorld()) + 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( + 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()); + aZ - 0.5 + XSTR_INSTANCE.nextFloat()).run()); } } @@ -302,134 +258,100 @@ 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) }; } @Override @@ -444,9 +366,7 @@ public abstract class GT_MetaTileEntity_BasicMachine_Bronze extends GT_MetaTileE @Override public void addGregTechLogo(ModularWindow.Builder builder) { - builder.widget(new DrawableWidget() - .setDrawable(getGUITextureSet().getGregTechLogo()) - .setSize(17, 17) - .setPos(152, 63)); + builder.widget( + new DrawableWidget().setDrawable(getGUITextureSet().getGregTechLogo()).setSize(17, 17).setPos(152, 63)); } } 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 75b055324a..7976ea94c6 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 @@ -6,11 +6,23 @@ 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 java.util.Locale; + +import net.minecraft.block.Block; +import net.minecraft.entity.player.InventoryPlayer; +import net.minecraft.init.Blocks; +import net.minecraft.item.ItemStack; +import net.minecraft.util.ResourceLocation; +import net.minecraftforge.common.util.ForgeDirection; +import net.minecraftforge.fluids.FluidStack; +import net.minecraftforge.oredict.OreDictionary; + import com.gtnewhorizons.modularui.api.drawable.FallbackableUITexture; import com.gtnewhorizons.modularui.api.drawable.UITexture; import com.gtnewhorizons.modularui.api.math.Pos2d; import com.gtnewhorizons.modularui.api.math.Size; import com.gtnewhorizons.modularui.common.widget.ProgressBar; + import cpw.mods.fml.common.Loader; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; @@ -31,23 +43,15 @@ 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; -import net.minecraft.item.ItemStack; -import net.minecraft.util.ResourceLocation; -import net.minecraftforge.common.util.ForgeDirection; -import net.minecraftforge.fluids.FluidStack; -import net.minecraftforge.oredict.OreDictionary; /** * 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 + * This is the main construct for my Basic Machines such as the Automatic Extractor Extend this class to make a simple + * Machine */ public class GT_MetaTileEntity_BasicMachine_GT_Recipe extends GT_MetaTileEntity_BasicMachine { + private final GT_Recipe.GT_Recipe_Map mRecipes; private final int mTankCapacity; private final SpecialEffects mSpecialEffect; @@ -56,25 +60,10 @@ public class GT_MetaTileEntity_BasicMachine_GT_Recipe extends GT_MetaTileEntity_ private final byte mGUIParameterA, mGUIParameterB; private FallbackableUITexture progressBarTexture; - 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) { + 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, @@ -87,69 +76,89 @@ public class GT_MetaTileEntity_BasicMachine_GT_Recipe extends GT_MetaTileEntity_ aGUIName, aRecipes.mNEIName, TextureFactory.of( - TextureFactory.of(new CustomIcon( - "basicmachines/" + aOverlays.toLowerCase(Locale.ENGLISH) + "/OVERLAY_SIDE_ACTIVE")), + 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()), + .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.of( + new CustomIcon( + "basicmachines/" + aOverlays.toLowerCase(Locale.ENGLISH) + "/OVERLAY_SIDE")), TextureFactory.builder() - .addIcon((new CustomIcon("basicmachines/" + aOverlays.toLowerCase(Locale.ENGLISH) - + "/OVERLAY_SIDE_GLOW"))) - .glow() - .build()), + .addIcon( + (new CustomIcon( + "basicmachines/" + aOverlays.toLowerCase(Locale.ENGLISH) + + "/OVERLAY_SIDE_GLOW"))) + .glow().build()), TextureFactory.of( - TextureFactory.of(new CustomIcon( - "basicmachines/" + aOverlays.toLowerCase(Locale.ENGLISH) + "/OVERLAY_FRONT_ACTIVE")), + TextureFactory.of( + new CustomIcon( + "basicmachines/" + aOverlays.toLowerCase(Locale.ENGLISH) + + "/OVERLAY_FRONT_ACTIVE")), TextureFactory.builder() - .addIcon((new CustomIcon("basicmachines/" + aOverlays.toLowerCase(Locale.ENGLISH) - + "/OVERLAY_FRONT_ACTIVE_GLOW"))) - .glow() - .build()), + .addIcon( + (new CustomIcon( + "basicmachines/" + aOverlays.toLowerCase(Locale.ENGLISH) + + "/OVERLAY_FRONT_ACTIVE_GLOW"))) + .glow().build()), TextureFactory.of( - TextureFactory.of(new CustomIcon( - "basicmachines/" + aOverlays.toLowerCase(Locale.ENGLISH) + "/OVERLAY_FRONT")), + TextureFactory.of( + new CustomIcon( + "basicmachines/" + aOverlays.toLowerCase(Locale.ENGLISH) + "/OVERLAY_FRONT")), TextureFactory.builder() - .addIcon((new CustomIcon("basicmachines/" + aOverlays.toLowerCase(Locale.ENGLISH) - + "/OVERLAY_FRONT_GLOW"))) - .glow() - .build()), + .addIcon( + (new CustomIcon( + "basicmachines/" + aOverlays.toLowerCase(Locale.ENGLISH) + + "/OVERLAY_FRONT_GLOW"))) + .glow().build()), TextureFactory.of( - TextureFactory.of(new CustomIcon( - "basicmachines/" + aOverlays.toLowerCase(Locale.ENGLISH) + "/OVERLAY_TOP_ACTIVE")), + TextureFactory.of( + new CustomIcon( + "basicmachines/" + aOverlays.toLowerCase(Locale.ENGLISH) + + "/OVERLAY_TOP_ACTIVE")), TextureFactory.builder() - .addIcon((new CustomIcon("basicmachines/" + aOverlays.toLowerCase(Locale.ENGLISH) - + "/OVERLAY_TOP_ACTIVE_GLOW"))) - .glow() - .build()), + .addIcon( + (new CustomIcon( + "basicmachines/" + aOverlays.toLowerCase(Locale.ENGLISH) + + "/OVERLAY_TOP_ACTIVE_GLOW"))) + .glow().build()), TextureFactory.of( - TextureFactory.of(new CustomIcon( - "basicmachines/" + aOverlays.toLowerCase(Locale.ENGLISH) + "/OVERLAY_TOP")), + TextureFactory.of( + new CustomIcon( + "basicmachines/" + aOverlays.toLowerCase(Locale.ENGLISH) + "/OVERLAY_TOP")), TextureFactory.builder() - .addIcon((new CustomIcon("basicmachines/" + aOverlays.toLowerCase(Locale.ENGLISH) - + "/OVERLAY_TOP_GLOW"))) - .glow() - .build()), + .addIcon( + (new CustomIcon( + "basicmachines/" + aOverlays.toLowerCase(Locale.ENGLISH) + + "/OVERLAY_TOP_GLOW"))) + .glow().build()), TextureFactory.of( - TextureFactory.of(new CustomIcon( - "basicmachines/" + aOverlays.toLowerCase(Locale.ENGLISH) + "/OVERLAY_BOTTOM_ACTIVE")), + TextureFactory.of( + new CustomIcon( + "basicmachines/" + aOverlays.toLowerCase(Locale.ENGLISH) + + "/OVERLAY_BOTTOM_ACTIVE")), TextureFactory.builder() - .addIcon((new CustomIcon("basicmachines/" + aOverlays.toLowerCase(Locale.ENGLISH) - + "/OVERLAY_BOTTOM_ACTIVE_GLOW"))) - .glow() - .build()), + .addIcon( + (new CustomIcon( + "basicmachines/" + aOverlays.toLowerCase(Locale.ENGLISH) + + "/OVERLAY_BOTTOM_ACTIVE_GLOW"))) + .glow().build()), TextureFactory.of( - TextureFactory.of(new CustomIcon( - "basicmachines/" + aOverlays.toLowerCase(Locale.ENGLISH) + "/OVERLAY_BOTTOM")), + TextureFactory.of( + new CustomIcon( + "basicmachines/" + aOverlays.toLowerCase(Locale.ENGLISH) + "/OVERLAY_BOTTOM")), TextureFactory.builder() - .addIcon((new CustomIcon("basicmachines/" + aOverlays.toLowerCase(Locale.ENGLISH) - + "/OVERLAY_BOTTOM_GLOW"))) - .glow() - .build())); + .addIcon( + (new CustomIcon( + "basicmachines/" + aOverlays.toLowerCase(Locale.ENGLISH) + + "/OVERLAY_BOTTOM_GLOW"))) + .glow().build())); this.mSharedTank = aSharedTank; this.mTankCapacity = aTankCapacity; this.mSpecialEffect = aSpecialEffect; @@ -891,36 +900,19 @@ public class GT_MetaTileEntity_BasicMachine_GT_Recipe extends GT_MetaTileEntity_ if (!GT_ModHandler.addCraftingRecipe( getStackForm(1), - GT_ModHandler.RecipeBits.DISMANTLEABLE - | GT_ModHandler.RecipeBits.BUFFERED + 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()); + 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) { + 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) { this( aID, aName, @@ -944,31 +936,15 @@ public class GT_MetaTileEntity_BasicMachine_GT_Recipe extends GT_MetaTileEntity_ /** * @inheritDoc - * @deprecated Use {@link #GT_MetaTileEntity_BasicMachine_GT_Recipe( - * int aID, String, String, int, String, GT_Recipe.GT_Recipe_Map, - * int, int, int, int, int, String, ResourceLocation, boolean, - * boolean, SpecialEffects, String , Object[])} + * @deprecated Use {@link #GT_MetaTileEntity_BasicMachine_GT_Recipe( int aID, String, String, int, String, + * GT_Recipe.GT_Recipe_Map, int, int, int, int, int, String, ResourceLocation, boolean, boolean, + * SpecialEffects, String , Object[])} */ @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) { + 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, @@ -990,24 +966,10 @@ public class GT_MetaTileEntity_BasicMachine_GT_Recipe extends GT_MetaTileEntity_ 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) { + 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) { super(aName, aTier, aAmperage, aDescription, aTextures, aInputSlots, aOutputSlots, aGUIName, aNEIName); this.mSharedTank = aSharedTank; this.mTankCapacity = aTankCapacity; @@ -1019,24 +981,10 @@ public class GT_MetaTileEntity_BasicMachine_GT_Recipe extends GT_MetaTileEntity_ this.mGUIParameterB = (byte) aGUIParameterB; } - 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) { + 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) { super(aName, aTier, aAmperage, aDescription, aTextures, aInputSlots, aOutputSlots, aGUIName, aNEIName); this.mSharedTank = aSharedTank; this.mTankCapacity = aTankCapacity; @@ -1051,24 +999,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()) - .setProgressBarTexture(this.progressBarTexture); + 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()).setProgressBarTexture(this.progressBarTexture); } public GT_MetaTileEntity_BasicMachine_GT_Recipe setProgressBarTexture(FallbackableUITexture progressBarTexture) { @@ -1097,67 +1044,61 @@ public class GT_MetaTileEntity_BasicMachine_GT_Recipe extends GT_MetaTileEntity_ aBaseMetaTileEntity, this.getLocalName(), this.mGUIName, - GT_Utility.isStringValid(this.mNEIName) - ? this.mNEIName + 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); - 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.mRequiresFluidForFiltering && this.getRecipeList().containsInput(aStack); + else return this.getRecipeList().findRecipe( + this.getBaseMetaTileEntity(), + this.mLastRecipe, + true, + true, + V[this.mTier], + new FluidStack[] { this.getFillableStack() }, + this.getSpecialSlot(), + appendSelectedCircuit(aStack)) != null; case 2: - return (!this.mRequiresFluidForFiltering || this.getFillableStack() != null) - && (((this.getInputAt(0) != null && this.getInputAt(1) != null) - || (this.getInputAt(0) == null && this.getInputAt(1) == null - ? this.getRecipeList().containsInput(aStack) - : (this.getRecipeList().containsInput(aStack) - && this.getRecipeList() - .findRecipe( - 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 (GT_Utility.isStackValid(aStack)) - for (int oreID : OreDictionary.getOreIDs(aStack)) { - if (OreDictionary.getOreName(oreID).startsWith("circuit")) return true; - } + 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; + } } return this.getRecipeList().containsInput(aStack); } @@ -1173,7 +1114,7 @@ public class GT_MetaTileEntity_BasicMachine_GT_Recipe extends GT_MetaTileEntity_ public void onPreTick(IGregTechTileEntity aBaseMetaTileEntity, long aTick) { super.onPreTick(aBaseMetaTileEntity, aTick); if (aBaseMetaTileEntity.isClientSide() && aBaseMetaTileEntity.isActive()) { - //noinspection SwitchStatementWithTooFewBranches + // noinspection SwitchStatementWithTooFewBranches switch (this.mSpecialEffect) { case TOP_SMOKE: final byte topFacing = (byte) ForgeDirection.UP.ordinal(); @@ -1182,15 +1123,13 @@ public class GT_MetaTileEntity_BasicMachine_GT_Recipe extends GT_MetaTileEntity_ && aBaseMetaTileEntity.getCoverIDAtSide(topFacing) == 0 && !aBaseMetaTileEntity.getOpacityAtSide(topFacing)) { - new WorldSpawnedEventBuilder.ParticleEventBuilder() - .setMotion(0.0D, 0.0D, 0.0D) + 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(); + .setWorld(aBaseMetaTileEntity.getWorld()).run(); } break; default: @@ -1208,7 +1147,7 @@ public class GT_MetaTileEntity_BasicMachine_GT_Recipe extends GT_MetaTileEntity_ @Override public void onRandomDisplayTick(IGregTechTileEntity aBaseMetaTileEntity) { - //noinspection SwitchStatementWithTooFewBranches + // noinspection SwitchStatementWithTooFewBranches switch (this.mSpecialEffect) { case MAIN_RANDOM_SPARKS: // Random Sparkles at main face @@ -1216,8 +1155,7 @@ public class GT_MetaTileEntity_BasicMachine_GT_Recipe extends GT_MetaTileEntity_ final byte mainFacing = (byte) this.mMainFacing; - if (mainFacing > 1 - && aBaseMetaTileEntity.getCoverIDAtSide(mainFacing) == 0 + if (mainFacing > 1 && aBaseMetaTileEntity.getCoverIDAtSide(mainFacing) == 0 && !aBaseMetaTileEntity.getOpacityAtSide(mainFacing)) { final double oX = aBaseMetaTileEntity.getXCoord(); @@ -1253,10 +1191,8 @@ public class GT_MetaTileEntity_BasicMachine_GT_Recipe extends GT_MetaTileEntity_ mZ = .05D; } - ParticleEventBuilder particleEventBuilder = (new ParticleEventBuilder()) - .setMotion(mX, 0, mZ) - .setPosition(x, y, z) - .setWorld(getBaseMetaTileEntity().getWorld()); + ParticleEventBuilder particleEventBuilder = (new ParticleEventBuilder()).setMotion(mX, 0, mZ) + .setPosition(x, y, z).setWorld(getBaseMetaTileEntity().getWorld()); particleEventBuilder.setIdentifier(ParticleFX.LAVA).run(); } } @@ -1279,8 +1215,7 @@ public class GT_MetaTileEntity_BasicMachine_GT_Recipe extends GT_MetaTileEntity_ @Override public void startSoundLoop(byte aIndex, double aX, double aY, double aZ) { super.startSoundLoop(aIndex, aX, aY, aZ); - if (aIndex == 1 - && this.mSoundResourceLocation != null + if (aIndex == 1 && this.mSoundResourceLocation != null && GT_Utility.isStringValid(this.mSoundResourceLocation.getResourceDomain()) && GT_Utility.isStringValid(this.mSoundResourceLocation.getResourcePath())) GT_Utility.doSoundAtClient(this.mSoundResourceLocation, 100, 1.0F, aX, aY, aZ); @@ -1316,8 +1251,8 @@ public class GT_MetaTileEntity_BasicMachine_GT_Recipe extends GT_MetaTileEntity_ } @Override - protected ProgressBar createProgressBar( - UITexture texture, int imageSize, ProgressBar.Direction direction, Pos2d pos, Size size) { + protected ProgressBar createProgressBar(UITexture texture, int imageSize, ProgressBar.Direction direction, + Pos2d pos, Size size) { return super.createProgressBar(texture, imageSize, direction, pos, size) .setTexture(progressBarTexture.get(), mRecipes.getProgressBarImageSize()); } @@ -1352,11 +1287,12 @@ public class GT_MetaTileEntity_BasicMachine_GT_Recipe extends GT_MetaTileEntity_ * Special Effects */ public enum SpecialEffects { + NONE, 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 592d27f74f..3488ab25c1 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 @@ -19,39 +19,24 @@ import gregtech.common.power.SteamPower; /** * 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 + * 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_Steel extends GT_MetaTileEntity_BasicMachine_Bronze implements IGetTitleColor { - 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); } @@ -62,134 +47,100 @@ 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) }; } @Override 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 0207178559..1286c84c9b 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 @@ -1,11 +1,19 @@ package gregtech.api.metatileentity.implementations; +import net.minecraft.entity.player.InventoryPlayer; +import net.minecraft.item.ItemStack; +import net.minecraft.nbt.NBTTagCompound; +import net.minecraftforge.common.util.ForgeDirection; +import net.minecraftforge.fluids.FluidStack; +import net.minecraftforge.fluids.FluidTankInfo; + import com.gtnewhorizons.modularui.api.screen.ModularWindow; import com.gtnewhorizons.modularui.api.screen.UIBuildContext; import com.gtnewhorizons.modularui.common.internal.network.NetworkUtils; import com.gtnewhorizons.modularui.common.widget.DrawableWidget; import com.gtnewhorizons.modularui.common.widget.SlotWidget; import com.gtnewhorizons.modularui.common.widget.TextWidget; + import gregtech.api.enums.ItemList; import gregtech.api.gui.GT_Container_BasicTank; import gregtech.api.gui.GT_GUIContainer_BasicTank; @@ -17,12 +25,6 @@ import gregtech.api.interfaces.modularui.IAddUIWidgets; import gregtech.api.interfaces.tileentity.IGregTechTileEntity; import gregtech.api.util.GT_Utility; import gregtech.common.gui.modularui.widget.FluidDisplaySlotWidget; -import net.minecraft.entity.player.InventoryPlayer; -import net.minecraft.item.ItemStack; -import net.minecraft.nbt.NBTTagCompound; -import net.minecraftforge.common.util.ForgeDirection; -import net.minecraftforge.fluids.FluidStack; -import net.minecraftforge.fluids.FluidTankInfo; /** * NEVER INCLUDE THIS FILE IN YOUR MOD!!! @@ -38,35 +40,23 @@ 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); } @@ -135,7 +125,8 @@ public abstract class GT_MetaTileEntity_BasicTank extends GT_MetaTileEntity_Tier } /** - * If you override this and change the field returned, be sure to override {@link #isDrainableStackSeparate()} as well! + * If you override this and change the field returned, be sure to override {@link #isDrainableStackSeparate()} as + * well! */ public FluidStack getDrainableStack() { return mFluid; @@ -217,8 +208,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); @@ -236,8 +227,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()); } } } @@ -254,11 +245,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 + if (aFluid == null || aFluid.getFluid().getID() <= 0 || aFluid.amount <= 0 || !canTankBeFilled() - || !isFluidInputAllowed(aFluid)) return 0; + || !isFluidInputAllowed(aFluid)) + return 0; if (getFillableStack() == null || getFillableStack().getFluid().getID() <= 0) { if (aFluid.amount <= getCapacity()) { @@ -322,12 +313,10 @@ public abstract class GT_MetaTileEntity_BasicTank extends GT_MetaTileEntity_Tier public FluidTankInfo[] getTankInfo(ForgeDirection aSide) { 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) }; } } @@ -347,44 +336,32 @@ public abstract class GT_MetaTileEntity_BasicTank extends GT_MetaTileEntity_Tier @Override public void addUIWidgets(ModularWindow.Builder builder, UIBuildContext buildContext) { - builder.widget(new DrawableWidget() - .setDrawable(GT_UITextures.PICTURE_SCREEN_BLACK) - .setPos(7, 16) - .setSize(71, 45)) - .widget(new DrawableWidget() - .setDrawable(GT_UITextures.PICTURE_GAUGE) - .setPos(79, 34) - .setSize(18, 18)) - .widget(new SlotWidget(inventoryHandler, getInputSlot()) - .setBackground(getGUITextureSet().getItemSlot(), GT_UITextures.OVERLAY_SLOT_IN) - .setPos(79, 16)) - .widget(new SlotWidget(inventoryHandler, getOutputSlot()) - .setBackground(getGUITextureSet().getItemSlot(), GT_UITextures.OVERLAY_SLOT_OUT) - .setPos(79, 52)) - .widget(createDrainableFluidSlot() - .setBackground(GT_UITextures.TRANSPARENT) - .setPos(58, 41)) - .widget(new TextWidget("Liquid Amount") - .setDefaultColor(COLOR_TEXT_WHITE.get()) - .setPos(10, 20)) - .widget(TextWidget.dynamicString( - () -> GT_Utility.parseNumberToString(mFluid != null ? mFluid.amount : 0)) - .setDefaultColor(COLOR_TEXT_WHITE.get()) - .setPos(10, 30)); + builder.widget( + new DrawableWidget().setDrawable(GT_UITextures.PICTURE_SCREEN_BLACK).setPos(7, 16).setSize(71, 45)) + .widget(new DrawableWidget().setDrawable(GT_UITextures.PICTURE_GAUGE).setPos(79, 34).setSize(18, 18)) + .widget( + new SlotWidget(inventoryHandler, getInputSlot()) + .setBackground(getGUITextureSet().getItemSlot(), GT_UITextures.OVERLAY_SLOT_IN) + .setPos(79, 16)) + .widget( + new SlotWidget(inventoryHandler, getOutputSlot()) + .setBackground(getGUITextureSet().getItemSlot(), GT_UITextures.OVERLAY_SLOT_OUT) + .setPos(79, 52)) + .widget(createDrainableFluidSlot().setBackground(GT_UITextures.TRANSPARENT).setPos(58, 41)) + .widget(new TextWidget("Liquid Amount").setDefaultColor(COLOR_TEXT_WHITE.get()).setPos(10, 20)).widget( + TextWidget + .dynamicString(() -> GT_Utility.parseNumberToString(mFluid != null ? mFluid.amount : 0)) + .setDefaultColor(COLOR_TEXT_WHITE.get()).setPos(10, 30)); } protected FluidDisplaySlotWidget createDrainableFluidSlot() { return new FluidDisplaySlotWidget(inventoryHandler, getStackDisplaySlot()) - .setFluidAccessConstructor(() -> constructFluidAccess(false)) - .setIHasFluidDisplay(this) - .setCanDrain(true) - .setCanFill(!isDrainableStackSeparate()) - .setActionRealClick(FluidDisplaySlotWidget.Action.TRANSFER) - .setBeforeRealClick((clickData, widget) -> { + .setFluidAccessConstructor(() -> constructFluidAccess(false)).setIHasFluidDisplay(this) + .setCanDrain(true).setCanFill(!isDrainableStackSeparate()) + .setActionRealClick(FluidDisplaySlotWidget.Action.TRANSFER).setBeforeRealClick((clickData, widget) -> { if (NetworkUtils.isClient()) { // propagate display item content to actual fluid stored in this tank - setDrainableStack(GT_Utility.getFluidFromDisplayStack( - widget.getMcSlot().getStack())); + setDrainableStack(GT_Utility.getFluidFromDisplayStack(widget.getMcSlot().getStack())); } return true; }); @@ -395,6 +372,7 @@ public abstract class GT_MetaTileEntity_BasicTank extends GT_MetaTileEntity_Tier } protected static class BasicTankFluidAccess implements IFluidAccess { + protected final GT_MetaTileEntity_BasicTank mTank; protected final boolean mIsFillableStack; 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 6d327646fe..827f2b2ec9 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 @@ -3,22 +3,26 @@ package gregtech.api.metatileentity.implementations; import static gregtech.api.enums.GT_Values.V; import static gregtech.api.enums.Textures.BlockIcons.*; +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 com.gtnewhorizons.modularui.api.screen.ModularWindow; import com.gtnewhorizons.modularui.common.widget.ButtonWidget; import com.gtnewhorizons.modularui.common.widget.SlotGroup; + import gregtech.api.gui.modularui.GT_UIInfos; import gregtech.api.gui.modularui.GT_UITextures; 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; 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; private static final int ARROW_DOWN_INDEX = 2; @@ -28,30 +32,27 @@ 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, + 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) { + 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); } @@ -60,37 +61,28 @@ public abstract class GT_MetaTileEntity_Buffer extends GT_MetaTileEntity_TieredM ITexture[][][] rTextures = new ITexture[ForgeDirection.VALID_DIRECTIONS.length][17][]; ITexture tIcon = getOverlayIcon(); ITexture tOut = TextureFactory.of(OVERLAY_PIPE_OUT); - ITexture tUp = TextureFactory.of( - TextureFactory.of(ARROW_UP), - TextureFactory.builder().addIcon(ARROW_UP_GLOW).glow().build()); - ITexture tDown = TextureFactory.of( - TextureFactory.of(ARROW_DOWN), - TextureFactory.builder().addIcon(ARROW_DOWN_GLOW).glow().build()); - ITexture tLeft = TextureFactory.of( - TextureFactory.of(ARROW_LEFT), - TextureFactory.builder().addIcon(ARROW_LEFT_GLOW).glow().build()); - ITexture tRight = TextureFactory.of( - TextureFactory.of(ARROW_RIGHT), - TextureFactory.builder().addIcon(ARROW_RIGHT_GLOW).glow().build()); + ITexture tUp = TextureFactory + .of(TextureFactory.of(ARROW_UP), TextureFactory.builder().addIcon(ARROW_UP_GLOW).glow().build()); + ITexture tDown = TextureFactory + .of(TextureFactory.of(ARROW_DOWN), TextureFactory.builder().addIcon(ARROW_DOWN_GLOW).glow().build()); + ITexture tLeft = TextureFactory + .of(TextureFactory.of(ARROW_LEFT), TextureFactory.builder().addIcon(ARROW_LEFT_GLOW).glow().build()); + ITexture tRight = TextureFactory + .of(TextureFactory.of(ARROW_RIGHT), TextureFactory.builder().addIcon(ARROW_RIGHT_GLOW).glow().build()); for (int i = 0; i < rTextures[0].length; i++) { - rTextures[OUTPUT_INDEX][i] = new ITexture[] {MACHINE_CASINGS[mTier][i], tOut}; - rTextures[ARROW_RIGHT_INDEX][i] = new ITexture[] {MACHINE_CASINGS[mTier][i], tRight, tIcon}; - 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]; @@ -278,14 +270,15 @@ public abstract class GT_MetaTileEntity_Buffer extends GT_MetaTileEntity_TieredM 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); + 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); @@ -313,10 +306,8 @@ public abstract class GT_MetaTileEntity_Buffer extends GT_MetaTileEntity_TieredM @Override public void onPostTick(IGregTechTileEntity aBaseMetaTileEntity, long aTimer) { - if (aBaseMetaTileEntity.isAllowedToWork() - && aBaseMetaTileEntity.isServerSide() - && (aBaseMetaTileEntity.hasWorkJustBeenEnabled() - || aBaseMetaTileEntity.hasInventoryBeenModified() + if (aBaseMetaTileEntity.isAllowedToWork() && aBaseMetaTileEntity.isServerSide() + && (aBaseMetaTileEntity.hasWorkJustBeenEnabled() || aBaseMetaTileEntity.hasInventoryBeenModified() || aTimer % 200 == 0 || mSuccess > 0)) { mSuccess--; @@ -337,32 +328,30 @@ 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 (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; @@ -420,8 +409,8 @@ 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; @@ -440,84 +429,73 @@ public abstract class GT_MetaTileEntity_Buffer extends GT_MetaTileEntity_TieredM } protected void addEmitEnergyButton(ModularWindow.Builder builder) { - builder.widget(new ButtonWidget() - .setOnClick((clickData, widget) -> { - bOutput = !bOutput; - if (bOutput) { - GT_Utility.sendChatToPlayer( - widget.getContext().getPlayer(), GT_Utility.trans("116", "Emit Energy to Outputside")); - } else { - GT_Utility.sendChatToPlayer( - widget.getContext().getPlayer(), GT_Utility.trans("117", "Don't emit Energy")); - } - }) - .setBackground(GT_UITextures.BUTTON_STANDARD, GT_UITextures.OVERLAY_BUTTON_EMIT_ENERGY) - .setPos(7, 62) + builder.widget(new ButtonWidget().setOnClick((clickData, widget) -> { + bOutput = !bOutput; + if (bOutput) { + GT_Utility.sendChatToPlayer( + widget.getContext().getPlayer(), + GT_Utility.trans("116", "Emit Energy to Outputside")); + } else { + GT_Utility.sendChatToPlayer( + widget.getContext().getPlayer(), + GT_Utility.trans("117", "Don't emit Energy")); + } + }).setBackground(GT_UITextures.BUTTON_STANDARD, GT_UITextures.OVERLAY_BUTTON_EMIT_ENERGY).setPos(7, 62) .setSize(18, 18)); } protected void addEmitRedstoneButton(ModularWindow.Builder builder) { - builder.widget(new ButtonWidget() - .setOnClick((clickData, widget) -> { - bRedstoneIfFull = !bRedstoneIfFull; - if (bRedstoneIfFull) { - GT_Utility.sendChatToPlayer( - widget.getContext().getPlayer(), - GT_Utility.trans("118", "Emit Redstone if no Slot is free")); - } else { - GT_Utility.sendChatToPlayer( - widget.getContext().getPlayer(), GT_Utility.trans("119", "Don't emit Redstone")); - } - }) - .setBackground(GT_UITextures.BUTTON_STANDARD, GT_UITextures.OVERLAY_BUTTON_EMIT_REDSTONE) - .setPos(25, 62) + builder.widget(new ButtonWidget().setOnClick((clickData, widget) -> { + bRedstoneIfFull = !bRedstoneIfFull; + if (bRedstoneIfFull) { + GT_Utility.sendChatToPlayer( + widget.getContext().getPlayer(), + GT_Utility.trans("118", "Emit Redstone if no Slot is free")); + } else { + GT_Utility.sendChatToPlayer( + widget.getContext().getPlayer(), + GT_Utility.trans("119", "Don't emit Redstone")); + } + }).setBackground(GT_UITextures.BUTTON_STANDARD, GT_UITextures.OVERLAY_BUTTON_EMIT_REDSTONE).setPos(25, 62) .setSize(18, 18)); } protected void addInvertRedstoneButton(ModularWindow.Builder builder) { - builder.widget(new ButtonWidget() - .setOnClick((clickData, widget) -> { - bInvert = !bInvert; - if (bInvert) { - GT_Utility.sendChatToPlayer( - widget.getContext().getPlayer(), GT_Utility.trans("120", "Invert Redstone")); - } else { - GT_Utility.sendChatToPlayer( - widget.getContext().getPlayer(), GT_Utility.trans("121", "Don't invert Redstone")); - } - }) - .setBackground(GT_UITextures.BUTTON_STANDARD, GT_UITextures.OVERLAY_BUTTON_INVERT_REDSTONE) - .setPos(43, 62) + builder.widget(new ButtonWidget().setOnClick((clickData, widget) -> { + bInvert = !bInvert; + if (bInvert) { + GT_Utility + .sendChatToPlayer(widget.getContext().getPlayer(), GT_Utility.trans("120", "Invert Redstone")); + } else { + GT_Utility.sendChatToPlayer( + widget.getContext().getPlayer(), + GT_Utility.trans("121", "Don't invert Redstone")); + } + }).setBackground(GT_UITextures.BUTTON_STANDARD, GT_UITextures.OVERLAY_BUTTON_INVERT_REDSTONE).setPos(43, 62) .setSize(18, 18)); } protected void addStockingModeButton(ModularWindow.Builder builder) { - builder.widget(new ButtonWidget() - .setOnClick((clickData, widget) -> { - bStockingMode = !bStockingMode; - if (bStockingMode) { - GT_Utility.sendChatToPlayer( - widget.getContext().getPlayer(), - GT_Utility.trans( - "217", - "Stocking mode. Keeps this many items in destination input slots. This mode can be server unfriendly.")); - } else { - GT_Utility.sendChatToPlayer( - widget.getContext().getPlayer(), - GT_Utility.trans( - "218", - "Transfer size mode. Add exactly this many items in destination input slots as long as there is room.")); - } - }) - .setBackground(GT_UITextures.BUTTON_STANDARD, GT_UITextures.OVERLAY_BUTTON_STOCKING_MODE) - .setPos(61, 62) + builder.widget(new ButtonWidget().setOnClick((clickData, widget) -> { + bStockingMode = !bStockingMode; + if (bStockingMode) { + GT_Utility.sendChatToPlayer( + widget.getContext().getPlayer(), + GT_Utility.trans( + "217", + "Stocking mode. Keeps this many items in destination input slots. This mode can be server unfriendly.")); + } else { + GT_Utility.sendChatToPlayer( + widget.getContext().getPlayer(), + GT_Utility.trans( + "218", + "Transfer size mode. Add exactly this many items in destination input slots as long as there is room.")); + } + }).setBackground(GT_UITextures.BUTTON_STANDARD, GT_UITextures.OVERLAY_BUTTON_STOCKING_MODE).setPos(61, 62) .setSize(18, 18)); } protected void addInventorySlots(ModularWindow.Builder builder) { - builder.widget(SlotGroup.ofItemHandler(inventoryHandler, 9) - .endAtSlot(26) - .build() - .setPos(7, 4)); + builder.widget(SlotGroup.ofItemHandler(inventoryHandler, 9).endAtSlot(26).build().setPos(7, 4)); } } diff --git a/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_CubicMultiBlockBase.java b/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_CubicMultiBlockBase.java index 3e3433e52c..830706f8fe 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 @@ -6,62 +6,63 @@ import static com.gtnewhorizon.structurelib.structure.StructureUtility.onElement import static com.gtnewhorizon.structurelib.structure.StructureUtility.transpose; import static gregtech.api.enums.GT_HatchElement.*; +import java.util.List; + +import net.minecraft.item.ItemStack; + import com.google.common.collect.ImmutableList; import com.gtnewhorizon.structurelib.alignment.constructable.ISurvivalConstructable; import com.gtnewhorizon.structurelib.structure.IStructureDefinition; import com.gtnewhorizon.structurelib.structure.IStructureElement; import com.gtnewhorizon.structurelib.structure.ISurvivalBuildEnvironment; 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.item.ItemStack; /** - * 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. + * 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. * <p> - * Note: You cannot use different casing for the same Class. Make a new subclass for it. You also should not change the casing - * dynamically, i.e. it should be a dumb method returning some sort of constant. + * Note: You cannot use different casing for the same Class. Make a new subclass for it. You also should not change the + * casing dynamically, i.e. it should be a dumb method returning some sort of constant. * <p> - * Implementation tips: - * 1. To restrict hatches, override {@link #addDynamoToMachineList(IGregTechTileEntity, int)} and its cousins instead of overriding the whole - * {@link #getStructureDefinition()} or change {@link #checkHatches(IGregTechTileEntity, ItemStack)}. The former is a total overkill, while the later cannot - * stop the structure check early. - * 2. To limit rotation, override {@link #getInitialAlignmentLimits()} + * Implementation tips: 1. To restrict hatches, override {@link #addDynamoToMachineList(IGregTechTileEntity, int)} and + * its cousins instead of overriding the whole {@link #getStructureDefinition()} or change + * {@link #checkHatches(IGregTechTileEntity, ItemStack)}. The former is a total overkill, while the later cannot stop + * the structure check early. 2. To limit rotation, override {@link #getInitialAlignmentLimits()} * * @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(); - } - }; + 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) { @@ -73,7 +74,8 @@ public abstract class GT_MetaTileEntity_CubicMultiBlockBase<T extends GT_MetaTil } /** - * Create a simple 3x3x3 hollow cubic structure made of a single type of machine casing and accepts hatches everywhere. + * 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}. */ @@ -97,8 +99,7 @@ public abstract class GT_MetaTileEntity_CubicMultiBlockBase<T extends GT_MetaTil @Override public boolean checkMachine(IGregTechTileEntity aBaseMetaTileEntity, ItemStack aStack) { mCasingAmount = 0; - return checkPiece(STRUCTURE_PIECE_MAIN, 1, 1, 0) - && mCasingAmount >= getRequiredCasingCount() + return checkPiece(STRUCTURE_PIECE_MAIN, 1, 1, 0) && mCasingAmount >= getRequiredCasingCount() && checkHatches(aBaseMetaTileEntity, aStack); } 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 32f607c0a7..0b1827bcdb 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 @@ -1,5 +1,11 @@ package gregtech.api.metatileentity.implementations; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.entity.player.EntityPlayerMP; +import net.minecraft.item.ItemStack; +import net.minecraft.nbt.NBTTagCompound; +import net.minecraftforge.common.util.ForgeDirection; + import com.gtnewhorizon.structurelib.StructureLibAPI; import com.gtnewhorizon.structurelib.alignment.IAlignment; import com.gtnewhorizon.structurelib.alignment.IAlignmentLimits; @@ -11,25 +17,22 @@ import com.gtnewhorizon.structurelib.alignment.enumerable.Rotation; import com.gtnewhorizon.structurelib.structure.IItemSource; import com.gtnewhorizon.structurelib.structure.IStructureDefinition; import com.gtnewhorizon.structurelib.structure.ISurvivalBuildEnvironment; + import cpw.mods.fml.common.network.NetworkRegistry; import gregtech.api.interfaces.tileentity.IGregTechTileEntity; import gregtech.api.util.GT_Multiblock_Tooltip_Builder; -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.entity.player.EntityPlayerMP; -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> - * 1. TecTech style declarative structure check utilizing StructureLib. - * 2. Arbitrarily rotating the whole structure, if allowed to. + * 1. TecTech style declarative structure check utilizing StructureLib. 2. Arbitrarily rotating the whole structure, if + * allowed to. * * @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(); @@ -76,8 +79,8 @@ public abstract class GT_MetaTileEntity_EnhancedMultiBlockBase<T extends GT_Meta } @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 (aWrenchingSide != getBaseMetaTileEntity().getFrontFacing()) return super.onWrenchRightClick(aSide, aWrenchingSide, aPlayer, aX, aY, aZ); if (aPlayer.isSneaking()) { @@ -106,9 +109,9 @@ public abstract class GT_MetaTileEntity_EnhancedMultiBlockBase<T extends GT_Meta } /** - * 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. + * 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(); @@ -149,142 +152,118 @@ public abstract class GT_MetaTileEntity_EnhancedMultiBlockBase<T extends GT_Meta * * 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. + * 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); + 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) { + protected final boolean buildPiece(String piece, ItemStack trigger, boolean hintOnly, 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().buildOrHints( + this, + trigger, + piece, + tTile.getWorld(), + getExtendedFacing(), + tTile.getXCoord(), + tTile.getYCoord(), + tTile.getZCoord(), + horizontalOffset, + verticalOffset, + depthOffset, + hintOnly); } @Deprecated - protected final int survivialBuildPiece( - String piece, - ItemStack trigger, - int horizontalOffset, - int verticalOffset, - int depthOffset, - int elementsBudget, - IItemSource source, - EntityPlayerMP actor, - boolean 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); + 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, - ISurvivalBuildEnvironment env, - boolean check) { + protected final int survivialBuildPiece(String piece, ItemStack trigger, int horizontalOffset, int verticalOffset, + int depthOffset, int elementsBudget, ISurvivalBuildEnvironment env, 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, - env, - check); + return getCastedStructureDefinition().survivalBuild( + this, + trigger, + piece, + tTile.getWorld(), + getExtendedFacing(), + tTile.getXCoord(), + tTile.getYCoord(), + tTile.getZCoord(), + horizontalOffset, + verticalOffset, + depthOffset, + elementsBudget, + env, + check); } @Deprecated - protected final int survivialBuildPiece( - String piece, - ItemStack trigger, - int horizontalOffset, - int verticalOffset, - int depthOffset, - int elementsBudget, - IItemSource source, - EntityPlayerMP actor, - boolean 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); + piece, + trigger, + horizontalOffset, + verticalOffset, + depthOffset, + elementsBudget, + source, + actor, + check); if (checkIfPlaced && built > 0) checkStructure(true, getBaseMetaTileEntity()); return built; } - protected final int survivialBuildPiece( - String piece, - ItemStack trigger, - int horizontalOffset, - int verticalOffset, - int depthOffset, - int elementsBudget, - ISurvivalBuildEnvironment env, - boolean check, - boolean checkIfPlaced) { + protected final int survivialBuildPiece(String piece, ItemStack trigger, int horizontalOffset, int verticalOffset, + int depthOffset, int elementsBudget, ISurvivalBuildEnvironment env, boolean check, boolean checkIfPlaced) { int built = survivialBuildPiece( - piece, trigger, horizontalOffset, verticalOffset, depthOffset, elementsBudget, env, check); + piece, + trigger, + horizontalOffset, + verticalOffset, + depthOffset, + elementsBudget, + env, + check); if (checkIfPlaced && built > 0) checkStructure(true, getBaseMetaTileEntity()); return built; } diff --git a/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_ExtendedPowerMultiBlockBase.java b/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_ExtendedPowerMultiBlockBase.java index 329ba45df5..11f3eeb9cc 100644 --- a/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_ExtendedPowerMultiBlockBase.java +++ b/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_ExtendedPowerMultiBlockBase.java @@ -2,11 +2,9 @@ package gregtech.api.metatileentity.implementations; import static gregtech.api.enums.GT_Values.*; -import gregtech.api.interfaces.tileentity.IGregTechTileEntity; -import gregtech.api.util.GT_ExoticEnergyInputHelper; -import gregtech.api.util.GT_Utility; import java.util.ArrayList; import java.util.List; + import net.minecraft.entity.player.EntityPlayerMP; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; @@ -15,11 +13,14 @@ import net.minecraft.util.EnumChatFormatting; import net.minecraft.util.StatCollector; import net.minecraft.world.World; +import gregtech.api.interfaces.tileentity.IGregTechTileEntity; +import gregtech.api.util.GT_ExoticEnergyInputHelper; +import gregtech.api.util.GT_Utility; + /** * Multiblock base class that allows machine to use power over int. */ -public abstract class GT_MetaTileEntity_ExtendedPowerMultiBlockBase< - T extends GT_MetaTileEntity_EnhancedMultiBlockBase<T>> +public abstract class GT_MetaTileEntity_ExtendedPowerMultiBlockBase<T extends GT_MetaTileEntity_EnhancedMultiBlockBase<T>> extends GT_MetaTileEntity_EnhancedMultiBlockBase<T> { public long lEUt; @@ -46,8 +47,8 @@ public abstract class GT_MetaTileEntity_ExtendedPowerMultiBlockBase< } @Override - protected void calculateOverclockedNessMultiInternal( - long aEUt, int aDuration, int mAmperage, long maxInputVoltage, boolean perfectOC) { + protected void calculateOverclockedNessMultiInternal(long aEUt, int aDuration, int mAmperage, long maxInputVoltage, + boolean perfectOC) { // 5% space for cable loss long zMaxInputVoltage = maxInputVoltage / 100L * 95L; long zTime = aDuration; @@ -112,8 +113,8 @@ public abstract class GT_MetaTileEntity_ExtendedPowerMultiBlockBase< } @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); final IGregTechTileEntity tileEntity = getBaseMetaTileEntity(); @@ -145,29 +146,57 @@ public abstract class GT_MetaTileEntity_ExtendedPowerMultiBlockBase< long amps = getMaxInputAmps(); 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(getActualEnergyUsage()) + EnumChatFormatting.RESET + " EU/t", - /* 4*/ StatCollector.translateToLocal("GT5U.multiblock.mei") + ": " + EnumChatFormatting.YELLOW - + GT_Utility.formatNumbers(voltage) + EnumChatFormatting.RESET + " EU/t(*" + amps + " A)" - + StatCollector.translateToLocal("GT5U.machines.tier") - + ": " + EnumChatFormatting.YELLOW - + VN[GT_Utility.getTier(voltage)] + 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 + " %" - }; + /* 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(getActualEnergyUsage()) + + EnumChatFormatting.RESET + + " EU/t", + /* 4 */ StatCollector.translateToLocal("GT5U.multiblock.mei") + ": " + + EnumChatFormatting.YELLOW + + GT_Utility.formatNumbers(voltage) + + EnumChatFormatting.RESET + + " EU/t(*" + + amps + + " A)" + + StatCollector.translateToLocal("GT5U.machines.tier") + + ": " + + EnumChatFormatting.YELLOW + + VN[GT_Utility.getTier(voltage)] + + 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 + + " %" }; } @Override 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 f1ccdd04e4..a8e505b806 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 @@ -1,10 +1,11 @@ package gregtech.api.metatileentity.implementations; +import net.minecraft.nbt.NBTTagCompound; + import gregtech.api.enums.GT_Values; import gregtech.api.enums.Textures; import gregtech.api.interfaces.ITexture; import gregtech.api.interfaces.tileentity.IGregTechTileEntity; -import net.minecraft.nbt.NBTTagCompound; /** * Handles texture changes internally. No special calls are necessary other than updateTexture in add***ToMachineList. @@ -26,35 +27,23 @@ public abstract class GT_MetaTileEntity_Hatch extends GT_MetaTileEntity_BasicTan 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); } @@ -72,35 +61,29 @@ 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 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 texturePointer = (byte) (actualTexture & 0x7F); // just to be sure, from my testing the 8th bit cannot be + // set clientside int textureIndex = texturePointer | (mTexturePage << 7); // Shift seven since one page is 128 textures! 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]); + else 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]); } } } catch (NullPointerException npe) { - return new ITexture[] {Textures.BlockIcons.MACHINE_CASINGS[0][0]}; + return new ITexture[] { Textures.BlockIcons.MACHINE_CASINGS[0][0] }; } } @@ -117,13 +100,15 @@ public abstract class GT_MetaTileEntity_Hatch extends GT_MetaTileEntity_BasicTan 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 + 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) { @@ -133,7 +118,8 @@ public abstract class GT_MetaTileEntity_Hatch extends GT_MetaTileEntity_BasicTan /** * Sets texture with page and index, rather unusable, but kept FFS - * @param page page of texure + * + * @param page page of texure * @param index index of texure */ @Deprecated @@ -149,7 +135,8 @@ public abstract class GT_MetaTileEntity_Hatch extends GT_MetaTileEntity_BasicTan mTexturePage = 0; } - /** Get the maximum amount of amperes to work with, which excludes the additional amps in for loss + /** + * Get the maximum amount of amperes to work with, which excludes the additional amps in for loss * * @return Working amps */ @@ -157,7 +144,8 @@ public abstract class GT_MetaTileEntity_Hatch extends GT_MetaTileEntity_BasicTan return maxAmperesIn(); } - /** Get the type of connection this hatch allows + /** + * Get the type of connection this hatch allows * * @return Connection type */ @@ -215,13 +203,13 @@ 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. + 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 + 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 } 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 e60ffe0f58..fc25a15beb 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 @@ -2,8 +2,13 @@ package gregtech.api.metatileentity.implementations; import static gregtech.api.enums.Textures.BlockIcons.OVERLAY_DATA_ACCESS; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.item.ItemStack; +import net.minecraft.nbt.NBTTagCompound; + import com.gtnewhorizons.modularui.api.screen.ModularWindow; import com.gtnewhorizons.modularui.api.screen.UIBuildContext; + import gregtech.api.gui.modularui.GT_UIInfos; import gregtech.api.gui.modularui.GT_UITextures; import gregtech.api.interfaces.ITexture; @@ -12,36 +17,39 @@ import gregtech.api.interfaces.tileentity.IGregTechTileEntity; import gregtech.api.metatileentity.MetaTileEntity; import gregtech.api.render.TextureFactory; import gregtech.api.util.GT_AssemblyLineUtils; -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.item.ItemStack; -import net.minecraft.nbt.NBTTagCompound; public class GT_MetaTileEntity_Hatch_DataAccess extends GT_MetaTileEntity_Hatch implements IAddUIWidgets { + 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 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 e9ba5ec512..84c1327a91 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 @@ -2,22 +2,28 @@ package gregtech.api.metatileentity.implementations; import static gregtech.api.enums.GT_Values.V; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.item.ItemStack; + import gregtech.api.enums.Textures; import gregtech.api.interfaces.ITexture; import gregtech.api.interfaces.tileentity.IGregTechTileEntity; import gregtech.api.metatileentity.MetaTileEntity; -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.item.ItemStack; 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); } @@ -31,12 +37,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 1b4def6dc3..dda6fb5716 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 @@ -2,34 +2,33 @@ package gregtech.api.metatileentity.implementations; import static gregtech.api.enums.GT_Values.V; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.item.ItemStack; + import gregtech.api.enums.Textures; import gregtech.api.interfaces.ITexture; import gregtech.api.interfaces.tileentity.IGregTechTileEntity; import gregtech.api.metatileentity.MetaTileEntity; -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.item.ItemStack; 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" - }); - } - - public GT_MetaTileEntity_Hatch_Energy( - int aID, - String aName, - String aNameRegional, - int aTier, - int aInvSlotCount, - String[] aDescription, - ITexture... aTextures) { + super( + aID, + aName, + aNameRegional, + aTier, + 0, + new String[] { "Energy Injector for Multiblocks", "Accepts up to 2 Amps" }); + } + + public GT_MetaTileEntity_Hatch_Energy(int aID, String aName, String aNameRegional, int aTier, int aInvSlotCount, + String[] aDescription, ITexture... aTextures) { super(aID, aName, aNameRegional, aTier, aInvSlotCount, aDescription, aTextures); } @@ -41,19 +40,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, aInvSlotCount, 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 ead36c10ab..4b53946e7a 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 @@ -3,6 +3,11 @@ 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 net.minecraft.entity.player.EntityPlayer; +import net.minecraft.item.ItemStack; +import net.minecraft.nbt.NBTTagCompound; +import net.minecraftforge.fluids.FluidStack; + import gregtech.GT_Mod; import gregtech.api.gui.modularui.GT_UIInfos; import gregtech.api.interfaces.ITexture; @@ -11,26 +16,32 @@ import gregtech.api.metatileentity.MetaTileEntity; import gregtech.api.render.TextureFactory; import gregtech.api.util.GT_Recipe.GT_Recipe_Map; import gregtech.api.util.GT_Utility; -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.item.ItemStack; -import net.minecraft.nbt.NBTTagCompound; -import net.minecraftforge.fluids.FluidStack; 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[] { - "Fluid Input for Multiblocks", - "Capacity: " + GT_Utility.formatNumbers(8000 * (1 << aTier) / aSlot) + "L", - "Can hold " + aSlot + " types of fluid." - }); + 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." }); } public GT_MetaTileEntity_Hatch_Input(String aName, int aTier, String aDescription, ITexture[][][] aTextures) { @@ -41,23 +52,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)}; + ? 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)}; + ? new ITexture[] { aBaseTexture, TextureFactory.of(OVERLAY_PIPE_IN), TextureFactory.of(FLUID_IN_SIGN) } + : new ITexture[] { aBaseTexture, TextureFactory.of(OVERLAY_PIPE_IN) }; } @Override @@ -146,10 +157,8 @@ 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) + return aSide == aBaseMetaTileEntity.getFrontFacing() && aIndex == 0 + && (mRecipeMap == null || mRecipeMap.containsInput(aStack) || mRecipeMap.containsInput(GT_Utility.getFluidForFilledItem(aStack, true))); } 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 fdedbad86a..959bcda530 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 @@ -2,8 +2,18 @@ package gregtech.api.metatileentity.implementations; import static gregtech.api.enums.Textures.BlockIcons.*; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; + +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.item.ItemStack; +import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.util.StatCollector; + import com.gtnewhorizons.modularui.api.screen.ModularWindow; import com.gtnewhorizons.modularui.api.screen.UIBuildContext; + import gregtech.GT_Mod; import gregtech.api.gui.modularui.GT_UIInfos; import gregtech.api.interfaces.IConfigurationCircuitSupport; @@ -17,16 +27,10 @@ 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.item.ItemStack; -import net.minecraft.nbt.NBTTagCompound; -import net.minecraft.util.StatCollector; public class GT_MetaTileEntity_Hatch_InputBus extends GT_MetaTileEntity_Hatch implements IConfigurationCircuitSupport, IAddUIWidgets { + public GT_Recipe_Map mRecipeMap = null; public boolean disableSort; public boolean disableFilter = true; @@ -36,8 +40,8 @@ public class GT_MetaTileEntity_Hatch_InputBus extends GT_MetaTileEntity_Hatch 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); } @@ -65,23 +69,23 @@ public class GT_MetaTileEntity_Hatch_InputBus extends GT_MetaTileEntity_Hatch 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)}; + ? 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)}; + ? new ITexture[] { aBaseTexture, TextureFactory.of(OVERLAY_PIPE_IN), TextureFactory.of(ITEM_IN_SIGN) } + : new ITexture[] { aBaseTexture, TextureFactory.of(OVERLAY_PIPE_IN) }; } @Override @@ -128,8 +132,8 @@ public class GT_MetaTileEntity_Hatch_InputBus extends GT_MetaTileEntity_Hatch @Override public void initDefaultModes(NBTTagCompound aNBT) { if (!getBaseMetaTileEntity().getWorld().isRemote) { - GT_ClientPreference tPreference = GT_Mod.gregtechproxy.getClientPreference( - getBaseMetaTileEntity().getOwnerUuid()); + GT_ClientPreference tPreference = GT_Mod.gregtechproxy + .getClientPreference(getBaseMetaTileEntity().getOwnerUuid()); if (tPreference != null) disableFilter = !tPreference.isInputBusInitialFilterEnabled(); } } @@ -216,7 +220,8 @@ public class GT_MetaTileEntity_Hatch_InputBus extends GT_MetaTileEntity_Hatch } else { disableFilter = !disableFilter; GT_Utility.sendChatToPlayer( - aPlayer, StatCollector.translateToLocal("GT5U.hatch.disableFilter." + disableFilter)); + aPlayer, + StatCollector.translateToLocal("GT5U.hatch.disableFilter." + disableFilter)); } } @@ -228,8 +233,7 @@ public class GT_MetaTileEntity_Hatch_InputBus extends GT_MetaTileEntity_Hatch @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)); } 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 963aa5a0d7..bcc260fd2e 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 @@ -7,12 +7,21 @@ import static gregtech.api.enums.Textures.BlockIcons.OVERLAY_AUTOMAINTENANCE_IDL import static gregtech.api.enums.Textures.BlockIcons.OVERLAY_DUCTTAPE; import static gregtech.api.enums.Textures.BlockIcons.OVERLAY_MAINTENANCE; +import net.minecraft.entity.EntityLivingBase; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.entity.player.EntityPlayerMP; +import net.minecraft.inventory.IInventory; +import net.minecraft.item.ItemStack; +import net.minecraft.nbt.NBTTagCompound; +import net.minecraftforge.common.util.FakePlayer; + import com.gtnewhorizons.modularui.api.screen.ModularWindow; import com.gtnewhorizons.modularui.api.screen.UIBuildContext; import com.gtnewhorizons.modularui.common.internal.wrapper.BaseSlot; import com.gtnewhorizons.modularui.common.widget.DrawableWidget; import com.gtnewhorizons.modularui.common.widget.SlotWidget; import com.gtnewhorizons.modularui.common.widget.TextWidget; + import gregtech.GT_Mod; import gregtech.api.GregTech_API; import gregtech.api.enums.ItemList; @@ -30,23 +39,12 @@ import gregtech.api.util.GT_OreDictUnificator; import gregtech.api.util.GT_Utility; import ic2.core.IHasGui; import ic2.core.item.ItemToolbox; -import net.minecraft.entity.EntityLivingBase; -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.entity.player.EntityPlayerMP; -import net.minecraft.inventory.IInventory; -import net.minecraft.item.ItemStack; -import net.minecraft.nbt.NBTTagCompound; -import net.minecraftforge.common.util.FakePlayer; public class GT_MetaTileEntity_Hatch_Maintenance extends GT_MetaTileEntity_Hatch implements IAddUIWidgets { + 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"); @@ -58,26 +56,23 @@ 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), + 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) - }; + GT_OreDictUnificator.get(OrePrefixes.circuit, Materials.Advanced, 2) }; return sAutoMaintenanceInputs; } @@ -100,31 +95,17 @@ public class GT_MetaTileEntity_Hatch_Maintenance extends GT_MetaTileEntity_Hatch @Override public ITexture[] getTexturesActive(ITexture aBaseTexture) { - if (mAuto) - return new ITexture[] { - aBaseTexture, - TextureFactory.of(OVERLAY_AUTOMAINTENANCE_IDLE), - TextureFactory.builder() - .addIcon(OVERLAY_AUTOMAINTENANCE_IDLE_GLOW) - .glow() - .build() - }; - return new ITexture[] {aBaseTexture, TextureFactory.of(OVERLAY_MAINTENANCE)}; + 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) }; } @Override public ITexture[] getTexturesInactive(ITexture aBaseTexture) { - 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) - }; + 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) }; } @Override @@ -160,13 +141,12 @@ 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) { + 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 instanceof FakePlayer && !aPlayer.getGameProfile().getName().endsWith(".robot")) return false; ItemStack tStack = aPlayer.getCurrentEquippedItem(); if (tStack != null) { if (tStack.getItem() instanceof ItemToolbox) { @@ -213,9 +193,8 @@ 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; @@ -232,9 +211,8 @@ 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; @@ -267,21 +245,21 @@ public class GT_MetaTileEntity_Hatch_Maintenance extends GT_MetaTileEntity_Hatch 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")) { @@ -293,8 +271,7 @@ public class GT_MetaTileEntity_Hatch_Maintenance extends GT_MetaTileEntity_Hatch EntityPlayerMP tPlayer = (EntityPlayerMP) aPlayer; try { GT_Mod.achievements.issueAchievement(tPlayer, "maintainance"); - } catch (Exception ignored) { - } + } catch (Exception ignored) {} } } @@ -322,10 +299,10 @@ public class GT_MetaTileEntity_Hatch_Maintenance extends GT_MetaTileEntity_Hatch @Override 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)))) - return i == aIndex; + for (int i = 0; i < getSizeInventory(); 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)) @@ -344,34 +321,29 @@ public class GT_MetaTileEntity_Hatch_Maintenance extends GT_MetaTileEntity_Hatch if (mAuto) { getBaseMetaTileEntity().add2by2Slots(builder); } else { - builder.widget(new DrawableWidget() - .setDrawable(GT_UITextures.SLOT_MAINTENANCE) - .setPos(78, 33) - .setSize(20, 20)) - .widget( - new SlotWidget(BaseSlot.empty()) { - @Override - public boolean handleDragAndDrop(ItemStack draggedStack, int button) { - return false; - } - - @Override - protected void phantomClick(ClickData clickData, ItemStack cursorStack) { - if (cursorStack == null) return; - onToolClick(cursorStack, getContext().getPlayer()); - if (cursorStack.stackSize < 1) { - getContext().getPlayer().inventory.setItemStack(null); - } - if (getContext().getPlayer() instanceof EntityPlayerMP) { - ((EntityPlayerMP) getContext().getPlayer()).updateHeldItem(); - } - } - }.disableShiftInsert() - .setBackground(GT_UITextures.TRANSPARENT) - .setPos(79, 34)) - .widget(new TextWidget("Click with Tool to repair.") - .setDefaultColor(COLOR_TEXT_GRAY.get()) - .setPos(8, 12)); + builder.widget( + new DrawableWidget().setDrawable(GT_UITextures.SLOT_MAINTENANCE).setPos(78, 33).setSize(20, 20)) + .widget(new SlotWidget(BaseSlot.empty()) { + + @Override + public boolean handleDragAndDrop(ItemStack draggedStack, int button) { + return false; + } + + @Override + protected void phantomClick(ClickData clickData, ItemStack cursorStack) { + if (cursorStack == null) return; + onToolClick(cursorStack, getContext().getPlayer()); + if (cursorStack.stackSize < 1) { + getContext().getPlayer().inventory.setItemStack(null); + } + if (getContext().getPlayer() instanceof EntityPlayerMP) { + ((EntityPlayerMP) getContext().getPlayer()).updateHeldItem(); + } + } + }.disableShiftInsert().setBackground(GT_UITextures.TRANSPARENT).setPos(79, 34)).widget( + new TextWidget("Click with Tool to repair.").setDefaultColor(COLOR_TEXT_GRAY.get()) + .setPos(8, 12)); } } } 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 3e1b39c1fd..b41f45e6d2 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 @@ -3,6 +3,13 @@ package gregtech.api.metatileentity.implementations; import static gregtech.api.enums.Textures.BlockIcons.OVERLAY_MUFFLER; import static gregtech.api.objects.XSTR.XSTR_INSTANCE; +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 cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; import gregtech.GT_Mod; @@ -15,14 +22,10 @@ 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; @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" @@ -38,27 +41,21 @@ public class GT_MetaTileEntity_Hatch_Muffler extends GT_MetaTileEntity_Hatch { super(aID, aName, aNameRegional, aTier, 0, ""); } - public GT_MetaTileEntity_Hatch_Muffler( - int aID, - String aName, - String aNameRegional, - int aTier, - int aInvSlotCount, - String[] aDescription, - ITexture... aTextures) { + public GT_MetaTileEntity_Hatch_Muffler(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_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) { this(aName, aTier, 0, aDescription, aTextures); } - public GT_MetaTileEntity_Hatch_Muffler( - String aName, int aTier, int aInvSlotCount, String[] aDescription, ITexture[][][] aTextures) { + public GT_MetaTileEntity_Hatch_Muffler(String aName, int aTier, int aInvSlotCount, String[] aDescription, + ITexture[][][] aTextures) { super(aName, aTier, aInvSlotCount, aDescription, aTextures); setInValidFacings(ForgeDirection.DOWN); } @@ -70,12 +67,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 @@ -163,30 +160,25 @@ public class GT_MetaTileEntity_Hatch_Muffler extends GT_MetaTileEntity_Hatch { } WorldSpawnedEventBuilder.ParticleEventBuilder events = new WorldSpawnedEventBuilder.ParticleEventBuilder() - .setIdentifier(name) - .setWorld(aWorld) - .setMotion(xSpd, ySpd, zSpd); + .setIdentifier(name).setWorld(aWorld).setMotion(xSpd, ySpd, zSpd); if (chk1) { events.setPosition( - xPos + ran1 * 0.5F, - yPos + XSTR_INSTANCE.nextFloat() * 0.5F, - zPos + XSTR_INSTANCE.nextFloat() * 0.5F) - .run(); + 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(); + 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(); + xPos + ran3 * 0.5F, + yPos + XSTR_INSTANCE.nextFloat() * 0.5F, + zPos + XSTR_INSTANCE.nextFloat() * 0.5F).run(); } } @@ -207,8 +199,8 @@ public class GT_MetaTileEntity_Hatch_Muffler extends GT_MetaTileEntity_Hatch { } /** - * @param mte The multi-block controller's {@link MetaTileEntity} - * MetaTileEntity is passed so newer muffler hatches can do wacky things with the multis + * @param mte The multi-block controller's {@link MetaTileEntity} MetaTileEntity is passed so newer muffler hatches + * can do wacky things with the multis * @return pollution success */ public boolean polluteEnvironment(MetaTileEntity mte) { 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 66c5401bd7..7d95e0b17c 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 @@ -2,11 +2,18 @@ package gregtech.api.metatileentity.implementations; import static gregtech.api.enums.Textures.BlockIcons.OVERLAY_INPUT_HATCH_2x2; +import net.minecraft.item.ItemStack; +import net.minecraft.nbt.NBTTagCompound; +import net.minecraftforge.common.util.ForgeDirection; +import net.minecraftforge.fluids.FluidStack; +import net.minecraftforge.fluids.FluidTankInfo; + import com.gtnewhorizons.modularui.api.ModularUITextures; import com.gtnewhorizons.modularui.api.math.Pos2d; import com.gtnewhorizons.modularui.api.screen.ModularWindow; import com.gtnewhorizons.modularui.api.screen.UIBuildContext; import com.gtnewhorizons.modularui.common.internal.network.NetworkUtils; + import gregtech.api.enums.ItemList; import gregtech.api.interfaces.IFluidAccess; import gregtech.api.interfaces.ITexture; @@ -16,11 +23,6 @@ import gregtech.api.metatileentity.MetaTileEntity; import gregtech.api.render.TextureFactory; import gregtech.api.util.GT_Utility; import gregtech.common.gui.modularui.widget.FluidDisplaySlotWidget; -import net.minecraft.item.ItemStack; -import net.minecraft.nbt.NBTTagCompound; -import net.minecraftforge.common.util.ForgeDirection; -import net.minecraftforge.fluids.FluidStack; -import net.minecraftforge.fluids.FluidTankInfo; public class GT_MetaTileEntity_Hatch_MultiInput extends GT_MetaTileEntity_Hatch_Input implements IAddUIWidgets { @@ -33,8 +35,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; @@ -79,12 +81,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() { @@ -169,11 +171,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 + if (aFluid == null || aFluid.getFluid().getID() <= 0 || aFluid.amount <= 0 || !canTankBeFilled() - || !isFluidInputAllowed(aFluid)) return 0; + || !isFluidInputAllowed(aFluid)) + return 0; if (!hasFluid(aFluid) && getFirstEmptySlot() != -1) { int tFilled = Math.min(aFluid.amount, mCapacityPer); if (doFill) { @@ -295,34 +297,28 @@ public class GT_MetaTileEntity_Hatch_MultiInput extends GT_MetaTileEntity_Hatch_ @Override public void addUIWidgets(ModularWindow.Builder builder, UIBuildContext buildContext) { final int SLOT_NUMBER = 4; - final Pos2d[] positions = new Pos2d[] { - new Pos2d(70, 25), new Pos2d(88, 25), new Pos2d(70, 43), new Pos2d(88, 43), - }; + final Pos2d[] positions = new Pos2d[] { new Pos2d(70, 25), new Pos2d(88, 25), new Pos2d(70, 43), + new Pos2d(88, 43), }; for (int i = 0; i < SLOT_NUMBER; i++) { final int slotId = i; - builder.widget(new FluidDisplaySlotWidget(inventoryHandler, slotId) - .setFluidAccessConstructor(() -> constructFluidAccess(slotId)) - .setIHasFluidDisplay(this) - .setCanDrain(true) - .setCanFill(!isDrainableStackSeparate()) - .setActionRealClick(FluidDisplaySlotWidget.Action.TRANSFER) - .setBeforeRealClick((clickData, widget) -> { - if (NetworkUtils.isClient()) { - // propagate display item content to actual fluid stored in this tank - setFluid( - GT_Utility.getFluidFromDisplayStack( - widget.getMcSlot().getStack()), - slotId); - } - ItemStack tStackHeld = - widget.getContext().getPlayer().inventory.getItemStack(); - FluidStack tFluidHeld = GT_Utility.getFluidForFilledItem(tStackHeld, true); - return constructFluidAccess(slotId).isMatch(tFluidHeld, slotId); - }) - .setUpdateFluidDisplayItem(() -> updateFluidDisplayItem(slotId)) - .setBackground(ModularUITextures.FLUID_SLOT) - .setPos(positions[slotId])); + builder.widget( + new FluidDisplaySlotWidget(inventoryHandler, slotId) + .setFluidAccessConstructor(() -> constructFluidAccess(slotId)).setIHasFluidDisplay(this) + .setCanDrain(true).setCanFill(!isDrainableStackSeparate()) + .setActionRealClick(FluidDisplaySlotWidget.Action.TRANSFER) + .setBeforeRealClick((clickData, widget) -> { + if (NetworkUtils.isClient()) { + // propagate display item content to actual fluid stored in this tank + setFluid( + GT_Utility.getFluidFromDisplayStack(widget.getMcSlot().getStack()), + slotId); + } + ItemStack tStackHeld = widget.getContext().getPlayer().inventory.getItemStack(); + FluidStack tFluidHeld = GT_Utility.getFluidForFilledItem(tStackHeld, true); + return constructFluidAccess(slotId).isMatch(tFluidHeld, slotId); + }).setUpdateFluidDisplayItem(() -> updateFluidDisplayItem(slotId)) + .setBackground(ModularUITextures.FLUID_SLOT).setPos(positions[slotId])); } } @@ -331,6 +327,7 @@ public class GT_MetaTileEntity_Hatch_MultiInput extends GT_MetaTileEntity_Hatch_ } protected static class MultiFluidAccess implements IFluidAccess { + private final GT_MetaTileEntity_Hatch_MultiInput mTank; private final int mSlot; 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 2809ab3815..ed29f8fe08 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 @@ -3,6 +3,16 @@ 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 java.lang.ref.WeakReference; + +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 net.minecraftforge.common.util.ForgeDirection; +import net.minecraftforge.fluids.*; + import com.gtnewhorizons.modularui.api.math.Alignment; import com.gtnewhorizons.modularui.api.screen.ModularWindow; import com.gtnewhorizons.modularui.api.screen.UIBuildContext; @@ -10,6 +20,7 @@ import com.gtnewhorizons.modularui.common.internal.network.NetworkUtils; import com.gtnewhorizons.modularui.common.widget.DrawableWidget; import com.gtnewhorizons.modularui.common.widget.FakeSyncWidget; import com.gtnewhorizons.modularui.common.widget.TextWidget; + import gregtech.GT_Mod; import gregtech.api.gui.modularui.GT_UIInfos; import gregtech.api.gui.modularui.GT_UITextures; @@ -22,28 +33,25 @@ import gregtech.api.render.TextureFactory; import gregtech.api.util.GT_ModHandler; import gregtech.api.util.GT_Utility; import gregtech.common.gui.modularui.widget.FluidDisplaySlotWidget; -import java.lang.ref.WeakReference; -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 net.minecraftforge.common.util.ForgeDirection; -import net.minecraftforge.fluids.*; public class GT_MetaTileEntity_Hatch_Output extends GT_MetaTileEntity_Hatch implements IFluidLockable, IAddUIWidgets { + private String lockedFluidName = null; private WeakReference<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) { @@ -54,28 +62,30 @@ public class GT_MetaTileEntity_Hatch_Output extends GT_MetaTileEntity_Hatch impl super(aName, aTier, 4, aDescription, aTextures); } - public GT_MetaTileEntity_Hatch_Output( - int aID, String aName, String aNameRegional, int aTier, String[] aDescription, int inventorySize) { + public GT_MetaTileEntity_Hatch_Output(int aID, String aName, String aNameRegional, int aTier, String[] aDescription, + int inventorySize) { super(aID, aName, aNameRegional, aTier, inventorySize, aDescription); } - public GT_MetaTileEntity_Hatch_Output( - String name, int tier, int slots, String[] description, ITexture[][][] textures) { + public GT_MetaTileEntity_Hatch_Output(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(FLUID_OUT_SIGN)} - : new ITexture[] {aBaseTexture, TextureFactory.of(OVERLAY_PIPE_OUT)}; + ? 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)}; + ? new ITexture[] { aBaseTexture, TextureFactory.of(OVERLAY_PIPE_OUT), + TextureFactory.of(FLUID_OUT_SIGN) } + : new ITexture[] { aBaseTexture, TextureFactory.of(OVERLAY_PIPE_OUT) }; } @Override @@ -113,16 +123,16 @@ public class GT_MetaTileEntity_Hatch_Output extends GT_MetaTileEntity_Hatch impl public void onPostTick(IGregTechTileEntity aBaseMetaTileEntity, long aTick) { super.onPostTick(aBaseMetaTileEntity, aTick); if (aBaseMetaTileEntity.isServerSide() && aBaseMetaTileEntity.isAllowedToWork() && mFluid != null) { - IFluidHandler tTileEntity = - aBaseMetaTileEntity.getITankContainerAtSide(aBaseMetaTileEntity.getFrontFacing()); + IFluidHandler tTileEntity = aBaseMetaTileEntity + .getITankContainerAtSide(aBaseMetaTileEntity.getFrontFacing()); if (tTileEntity != null) { FluidStack tDrained = aBaseMetaTileEntity.drain( ForgeDirection.getOrientation(aBaseMetaTileEntity.getFrontFacing()), Math.max(1, mFluid.amount), false); if (tDrained != null) { - int tFilledAmount = tTileEntity.fill( - ForgeDirection.getOrientation(aBaseMetaTileEntity.getBackFacing()), tDrained, false); + int tFilledAmount = tTileEntity + .fill(ForgeDirection.getOrientation(aBaseMetaTileEntity.getBackFacing()), tDrained, false); if (tFilledAmount > 0) { tTileEntity.fill( ForgeDirection.getOrientation(aBaseMetaTileEntity.getBackFacing()), @@ -153,8 +163,7 @@ public class GT_MetaTileEntity_Hatch_Output extends GT_MetaTileEntity_Hatch impl lockedFluidName = aNBT.getString("lockedFluidName"); lockedFluidName = lockedFluidName.length() == 0 ? null : lockedFluidName; if (GT_Utility.getFluidFromUnlocalizedName(lockedFluidName) != null) { - lockedFluidName = - GT_Utility.getFluidFromUnlocalizedName(lockedFluidName).getName(); + lockedFluidName = GT_Utility.getFluidFromUnlocalizedName(lockedFluidName).getName(); } } @@ -285,7 +294,8 @@ public class GT_MetaTileEntity_Hatch_Output extends GT_MetaTileEntity_Hatch impl aPlayer, String.format( "%s (%s)", - GT_Utility.trans("151.1", "Outputs items and 1 specific Fluid"), inBrackets)); + GT_Utility.trans("151.1", "Outputs items and 1 specific Fluid"), + inBrackets)); break; case 9: playerThatLockedfluid = new WeakReference<>(aPlayer); @@ -314,8 +324,7 @@ public class GT_MetaTileEntity_Hatch_Output extends GT_MetaTileEntity_Hatch impl if (tFluid == null && tCurrentItem.getItem() instanceof IFluidContainerItem) tFluid = ((IFluidContainerItem) tCurrentItem.getItem()).getFluid(tCurrentItem); if (tFluid != null) { - if (getLockedFluidName() != null - && !getLockedFluidName().equals(tFluid.getFluid().getName())) { + if (getLockedFluidName() != null && !getLockedFluidName().equals(tFluid.getFluid().getName())) { GT_Utility.sendChatToPlayer( aPlayer, String.format( @@ -326,19 +335,18 @@ public class GT_MetaTileEntity_Hatch_Output extends GT_MetaTileEntity_Hatch impl 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())); - else - GT_Utility.sendChatToPlayer( - aPlayer, - String.format( - "%s (%s)", - GT_Utility.trans("151.2", "Outputs 1 specific Fluid"), tFluid.getLocalizedName())); + if (mMode == 8) 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())); } return true; } @@ -350,8 +358,8 @@ public class GT_MetaTileEntity_Hatch_Output extends GT_MetaTileEntity_Hatch impl } @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) { if (tryToLockHatch(aPlayer, aSide)) return true; return super.onRightclick(aBaseMetaTileEntity, aPlayer, aSide, aX, aY, aZ); } @@ -425,7 +433,8 @@ public class GT_MetaTileEntity_Hatch_Output extends GT_MetaTileEntity_Hatch impl GT_Utility.sendChatToPlayer( player, String.format( - GT_Utility.trans("151.4", "Successfully locked Fluid to %s"), mFluid.getLocalizedName())); + GT_Utility.trans("151.4", "Successfully locked Fluid to %s"), + mFluid.getLocalizedName())); playerThatLockedfluid = null; } } @@ -437,21 +446,20 @@ public class GT_MetaTileEntity_Hatch_Output extends GT_MetaTileEntity_Hatch impl @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())) }; } @Override @@ -462,36 +470,26 @@ public class GT_MetaTileEntity_Hatch_Output extends GT_MetaTileEntity_Hatch impl @Override public void addUIWidgets(ModularWindow.Builder builder, UIBuildContext buildContext) { super.addUIWidgets(builder, buildContext); - builder.widget(new DrawableWidget() - .setDrawable(GT_UITextures.PICTURE_SCREEN_BLACK) - .setPos(98, 16) - .setSize(71, 45)) - .widget(new FluidDisplaySlotWidget(inventoryHandler, getLockedDisplaySlot()) - .setIHasFluidDisplay(this) - .setActionRealClick(FluidDisplaySlotWidget.Action.LOCK) - .setActionDragAndDrop(FluidDisplaySlotWidget.Action.LOCK) - .setBeforeClick((clickData, widget) -> { - if (NetworkUtils.isClient()) { - // propagate display item content to actual fluid stored in this tank - setDrainableStack( - GT_Utility.getFluidFromDisplayStack(mInventory[getStackDisplaySlot()])); - } - return true; - }) - .setBackground(GT_UITextures.TRANSPARENT) - .setPos(149, 41)) - .widget(new TextWidget("Locked Fluid") - .setDefaultColor(COLOR_TEXT_WHITE.get()) - .setPos(101, 20)) + builder.widget( + new DrawableWidget().setDrawable(GT_UITextures.PICTURE_SCREEN_BLACK).setPos(98, 16).setSize(71, 45)) + .widget( + new FluidDisplaySlotWidget(inventoryHandler, getLockedDisplaySlot()).setIHasFluidDisplay(this) + .setActionRealClick(FluidDisplaySlotWidget.Action.LOCK) + .setActionDragAndDrop(FluidDisplaySlotWidget.Action.LOCK) + .setBeforeClick((clickData, widget) -> { + if (NetworkUtils.isClient()) { + // propagate display item content to actual fluid stored in this tank + setDrainableStack( + GT_Utility.getFluidFromDisplayStack(mInventory[getStackDisplaySlot()])); + } + return true; + }).setBackground(GT_UITextures.TRANSPARENT).setPos(149, 41)) + .widget(new TextWidget("Locked Fluid").setDefaultColor(COLOR_TEXT_WHITE.get()).setPos(101, 20)) .widget(TextWidget.dynamicString(() -> { - final ItemStack lockedDisplayStack = mInventory[getLockedDisplaySlot()]; - return lockedDisplayStack == null ? "None" : lockedDisplayStack.getDisplayName(); - }) - .setSynced(false) - .setDefaultColor(COLOR_TEXT_WHITE.get()) - .setTextAlignment(Alignment.CenterLeft) - .setMaxWidth(65) - .setPos(101, 30)) + final ItemStack lockedDisplayStack = mInventory[getLockedDisplaySlot()]; + return lockedDisplayStack == null ? "None" : lockedDisplayStack.getDisplayName(); + }).setSynced(false).setDefaultColor(COLOR_TEXT_WHITE.get()).setTextAlignment(Alignment.CenterLeft) + .setMaxWidth(65).setPos(101, 30)) // #updateFluidDisplayItem invalidates locked fluid slot // if lockedFluidName == null or mMode is incorrect .widget(new FakeSyncWidget.StringSyncer(() -> lockedFluidName, val -> lockedFluidName = val)) 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 ad1c799708..094ad29471 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 @@ -4,8 +4,13 @@ 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 net.minecraft.entity.player.EntityPlayer; +import net.minecraft.inventory.IInventory; +import net.minecraft.item.ItemStack; + import com.gtnewhorizons.modularui.api.screen.ModularWindow; import com.gtnewhorizons.modularui.api.screen.UIBuildContext; + import gregtech.GT_Mod; import gregtech.api.gui.modularui.GT_UIInfos; import gregtech.api.interfaces.ITexture; @@ -15,11 +20,9 @@ import gregtech.api.metatileentity.MetaTileEntity; import gregtech.api.render.TextureFactory; import gregtech.api.util.GT_Utility; import gregtech.api.util.extensions.ArrayExt; -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.inventory.IInventory; -import net.minecraft.item.ItemStack; public class GT_MetaTileEntity_Hatch_OutputBus extends GT_MetaTileEntity_Hatch implements IAddUIWidgets { + public GT_MetaTileEntity_Hatch_OutputBus(int aID, String aName, String aNameRegional, int aTier) { this(aID, aName, aNameRegional, aTier, getSlots(aTier)); } @@ -36,13 +39,13 @@ public class GT_MetaTileEntity_Hatch_OutputBus extends GT_MetaTileEntity_Hatch i "Capacity: " + getSlots(tier) + " stack" + (getSlots(tier) >= 2 ? "s" : ""))); } - public GT_MetaTileEntity_Hatch_OutputBus( - int aID, String aName, String aNameRegional, int aTier, String[] aDescription) { + 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); } @@ -57,23 +60,23 @@ public class GT_MetaTileEntity_Hatch_OutputBus extends GT_MetaTileEntity_Hatch i 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)}; + ? 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)}; + ? new ITexture[] { aBaseTexture, TextureFactory.of(OVERLAY_PIPE_OUT), TextureFactory.of(ITEM_OUT_SIGN) } + : new ITexture[] { aBaseTexture, TextureFactory.of(OVERLAY_PIPE_OUT) }; } @Override @@ -108,11 +111,11 @@ public class GT_MetaTileEntity_Hatch_OutputBus extends GT_MetaTileEntity_Hatch i } /** - * Attempt to store as many items as possible into the internal inventory of this output bus. - * If you need atomicity you should use {@link gregtech.api.interfaces.tileentity.IHasInventory#addStackToSlot(int, ItemStack)} - * @param aStack Assume valid. - * Will be mutated. - * Take over the ownership. Caller should not retain a reference to this stack if the call returns true. + * Attempt to store as many items as possible into the internal inventory of this output bus. If you need atomicity + * you should use {@link gregtech.api.interfaces.tileentity.IHasInventory#addStackToSlot(int, ItemStack)} + * + * @param aStack Assume valid. Will be mutated. Take over the ownership. Caller should not retain a reference to + * this stack if the call returns true. * @return true if stack is fully accepted. false is stack is partially accepted or nothing is accepted */ public boolean storeAll(ItemStack aStack) { @@ -127,8 +130,7 @@ public class GT_MetaTileEntity_Hatch_OutputBus extends GT_MetaTileEntity_Hatch i mInventory[i] = aStack.splitStack(getInventoryStackLimit()); } else { int tRealStackLimit = Math.min(getInventoryStackLimit(), tSlot.getMaxStackSize()); - if (tSlot.stackSize < tRealStackLimit - && tSlot.isItemEqual(aStack) + if (tSlot.stackSize < tRealStackLimit && tSlot.isItemEqual(aStack) && ItemStack.areItemStackTagsEqual(tSlot, aStack)) { if (aStack.stackSize + tSlot.stackSize <= tRealStackLimit) { mInventory[i].stackSize += aStack.stackSize; @@ -158,8 +160,8 @@ public class GT_MetaTileEntity_Hatch_OutputBus extends GT_MetaTileEntity_Hatch i public void onPostTick(IGregTechTileEntity aBaseMetaTileEntity, long aTick) { super.onPostTick(aBaseMetaTileEntity, aTick); if (aBaseMetaTileEntity.isServerSide() && aBaseMetaTileEntity.isAllowedToWork() && (aTick & 0x7) == 0) { - final IInventory tTileEntity = - aBaseMetaTileEntity.getIInventoryAtSide(aBaseMetaTileEntity.getFrontFacing()); + final IInventory tTileEntity = aBaseMetaTileEntity + .getIInventoryAtSide(aBaseMetaTileEntity.getFrontFacing()); if (tTileEntity != null) { moveMultipleItemStacks( aBaseMetaTileEntity, @@ -175,9 +177,9 @@ public class GT_MetaTileEntity_Hatch_OutputBus extends GT_MetaTileEntity_Hatch i 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 * + // 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 ae08a5eb02..e6ea51c59d 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 @@ -5,6 +5,25 @@ 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 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; +import net.minecraft.entity.player.EntityPlayerMP; +import net.minecraft.item.ItemStack; +import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.tileentity.TileEntity; +import net.minecraft.util.EnumChatFormatting; +import net.minecraft.util.StatCollector; +import net.minecraft.world.World; +import net.minecraftforge.common.util.ForgeDirection; +import net.minecraftforge.fluids.FluidStack; + +import org.lwjgl.input.Keyboard; + import com.google.common.collect.Iterables; import com.gtnewhorizons.modularui.api.screen.ModularWindow; import com.gtnewhorizons.modularui.api.screen.UIBuildContext; @@ -13,6 +32,7 @@ import com.gtnewhorizons.modularui.common.widget.DynamicPositionedColumn; import com.gtnewhorizons.modularui.common.widget.FakeSyncWidget; import com.gtnewhorizons.modularui.common.widget.SlotWidget; import com.gtnewhorizons.modularui.common.widget.TextWidget; + import gregtech.GT_Mod; import gregtech.api.GregTech_API; import gregtech.api.enums.ConfigCategories; @@ -31,43 +51,16 @@ import gregtech.common.GT_Pollution; import gregtech.common.items.GT_MetaGenerated_Tool_01; import gregtech.common.tileentities.machines.multi.GT_MetaTileEntity_DrillerBase; import gregtech.common.tileentities.machines.multi.GT_MetaTileEntity_LargeTurbine; -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; -import net.minecraft.entity.player.EntityPlayerMP; -import net.minecraft.item.ItemStack; -import net.minecraft.nbt.NBTTagCompound; -import net.minecraft.tileentity.TileEntity; -import net.minecraft.util.EnumChatFormatting; -import net.minecraft.util.StatCollector; -import net.minecraft.world.World; -import net.minecraftforge.common.util.ForgeDirection; -import net.minecraftforge.fluids.FluidStack; -import org.lwjgl.input.Keyboard; public abstract class GT_MetaTileEntity_MultiBlockBase extends MetaTileEntity implements IAddGregtechLogo, IAddUIWidgets { 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; @@ -91,23 +84,23 @@ 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) { @@ -137,7 +130,8 @@ public abstract class GT_MetaTileEntity_MultiBlockBase extends MetaTileEntity mLockedToSingleRecipe = !mLockedToSingleRecipe; if (mLockedToSingleRecipe) { GT_Utility.sendChatToPlayer( - aPlayer, GT_Utility.trans("223", "Single recipe locking enabled. Will lock to next recipe.")); + 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; @@ -193,19 +187,17 @@ public abstract class GT_MetaTileEntity_MultiBlockBase extends MetaTileEntity if (mOutputItems != null) { aNBT.setInteger("mOutputItemsLength", mOutputItems.length); - for (int i = 0; i < mOutputItems.length; i++) - if (mOutputItems[i] != null) { - GT_Utility.saveItem(aNBT, "mOutputItem" + i, mOutputItems[i]); - } + for (int i = 0; i < mOutputItems.length; i++) if (mOutputItems[i] != null) { + GT_Utility.saveItem(aNBT, "mOutputItem" + i, mOutputItems[i]); + } } if (mOutputFluids != null) { aNBT.setInteger("mOutputFluidsLength", mOutputFluids.length); - for (int i = 0; i < mOutputFluids.length; i++) - if (mOutputFluids[i] != null) { - NBTTagCompound tNBT = new NBTTagCompound(); - mOutputFluids[i].writeToNBT(tNBT); - aNBT.setTag("mOutputFluids" + i, tNBT); - } + for (int i = 0; i < mOutputFluids.length; i++) if (mOutputFluids[i] != null) { + NBTTagCompound tNBT = new NBTTagCompound(); + mOutputFluids[i].writeToNBT(tNBT); + aNBT.setTag("mOutputFluids" + i, tNBT); + } } aNBT.setBoolean("mWrench", mWrench); aNBT.setBoolean("mScrewdriver", mScrewdriver); @@ -273,8 +265,8 @@ public abstract class GT_MetaTileEntity_MultiBlockBase extends MetaTileEntity } /** - * ClearHatches as a part of structure check. - * If your multiblock has any hatches that need clearing override this method, call super, and clear your own hatches + * ClearHatches as a part of structure check. If your multiblock has any hatches that need clearing override this + * method, call super, and clear your own hatches */ public void clearHatches() { mInputHatches.clear(); @@ -327,14 +319,14 @@ 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; setMufflers(active); @@ -389,19 +381,15 @@ 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) { - } - addOutput(tStack); - } + 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); + } if (mOutputFluids != null) { addFluidOutputs(mOutputFluids); } @@ -421,19 +409,16 @@ public abstract class GT_MetaTileEntity_MultiBlockBase extends MetaTileEntity if (mOutputFluids.length > 1) { try { GT_Mod.achievements.issueAchievement( - aBaseMetaTileEntity - .getWorld() + aBaseMetaTileEntity.getWorld() .getPlayerEntityByName(aBaseMetaTileEntity.getOwnerName()), "oilplant"); - } catch (Exception ignored) { - } + } catch (Exception ignored) {} } } } } } else { - if (aTick % 100 == 0 - || aBaseMetaTileEntity.hasWorkJustBeenEnabled() + if (aTick % 100 == 0 || aBaseMetaTileEntity.hasWorkJustBeenEnabled() || aBaseMetaTileEntity.hasInventoryBeenModified()) { if (aBaseMetaTileEntity.isAllowedToWork()) { @@ -511,8 +496,8 @@ public abstract class GT_MetaTileEntity_MultiBlockBase extends MetaTileEntity } /** - * Gets the pollution produced per second by this multiblock, default to 0. Override this with - * its actual value in the code of the multiblock. + * 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) { return 0; @@ -544,8 +529,7 @@ public abstract class GT_MetaTileEntity_MultiBlockBase extends MetaTileEntity } public int getRepairStatus() { - return (mWrench ? 1 : 0) - + (mScrewdriver ? 1 : 0) + return (mWrench ? 1 : 0) + (mScrewdriver ? 1 : 0) + (mSoftHammer ? 1 : 0) + (mHardHammer ? 1 : 0) + (mSolderingTool ? 1 : 0) @@ -590,18 +574,14 @@ public abstract class GT_MetaTileEntity_MultiBlockBase extends MetaTileEntity break; } } - if (mInventory[1] != null - && getBaseMetaTileEntity().getRandomNumber(2) == 0 + 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; } } @@ -612,10 +592,14 @@ 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 + "."); + "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; @@ -703,21 +687,21 @@ 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; } /** * Calcualtes the overclockedness using long integers - * @param aEUt - recipe EUt - * @param aDuration - recipe Duration - * @param mAmperage - should be 1 ? - * @param maxInputVoltage - Multiblock Max input voltage - * @param perfectOC - If the Multiblock OCs perfectly, i.e. the large Chemical Reactor + * + * @param aEUt - recipe EUt + * @param aDuration - recipe Duration + * @param mAmperage - should be 1 ? + * @param maxInputVoltage - Multiblock Max input voltage + * @param perfectOC - If the Multiblock OCs perfectly, i.e. the large Chemical Reactor */ - protected void calculateOverclockedNessMultiInternal( - long aEUt, int aDuration, int mAmperage, long maxInputVoltage, boolean perfectOC) { + protected void calculateOverclockedNessMultiInternal(long 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 @@ -784,16 +768,13 @@ public abstract class GT_MetaTileEntity_MultiBlockBase extends MetaTileEntity public boolean drainEnergyInput(long aEU) { if (aEU <= 0) return true; - for (GT_MetaTileEntity_Hatch_Energy tHatch : mEnergyHatches) - if (isValidMetaTileEntity(tHatch)) { - if (tHatch.getBaseMetaTileEntity().decreaseStoredEnergyUnits(aEU, false)) return true; - } + for (GT_MetaTileEntity_Hatch_Energy tHatch : mEnergyHatches) if (isValidMetaTileEntity(tHatch)) { + if (tHatch.getBaseMetaTileEntity().decreaseStoredEnergyUnits(aEU, false)) return true; + } return false; } - protected static boolean dumpFluid( - List<GT_MetaTileEntity_Hatch_Output> aOutputHatches, - FluidStack copiedFluidStack, + 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)) { @@ -871,8 +852,7 @@ 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; @@ -884,8 +864,7 @@ 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; @@ -899,11 +878,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--) { @@ -974,8 +953,8 @@ public abstract class GT_MetaTileEntity_MultiBlockBase extends MetaTileEntity 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; @@ -1148,29 +1127,55 @@ public abstract class GT_MetaTileEntity_MultiBlockBase extends MetaTileEntity } 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(getActualEnergyUsage()) + 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 + " %" - }; + /* 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(getActualEnergyUsage()) + + 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 + + " %" }; } @Override @@ -1230,29 +1235,34 @@ 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")) { currentTip.add(RED + "** INCOMPLETE STRUCTURE **" + RESET); } - currentTip.add((tag.getBoolean("hasProblems") ? (RED + "** HAS PROBLEMS **") : GREEN + "Running Fine") + RESET - + " Efficiency: " + tag.getFloat("efficiency") + "%"); + currentTip.add( + (tag.getBoolean("hasProblems") ? (RED + "** HAS PROBLEMS **") : GREEN + "Running Fine") + RESET + + " Efficiency: " + + tag.getFloat("efficiency") + + "%"); boolean isActive = tag.getBoolean("isActive"); if (isActive) { long actualEnergyUsage = tag.getLong("energyUsage"); if (actualEnergyUsage > 0) { - currentTip.add(StatCollector.translateToLocalFormatted( - "GT5U.waila.energy.use", - GT_Utility.formatNumbers(actualEnergyUsage), - GT_Utility.getColoredTierNameFromVoltage(actualEnergyUsage))); + currentTip.add( + StatCollector.translateToLocalFormatted( + "GT5U.waila.energy.use", + GT_Utility.formatNumbers(actualEnergyUsage), + GT_Utility.getColoredTierNameFromVoltage(actualEnergyUsage))); } else if (actualEnergyUsage < 0) { - currentTip.add(StatCollector.translateToLocalFormatted( - "GT5U.waila.energy.produce", - GT_Utility.formatNumbers(-actualEnergyUsage), - GT_Utility.getColoredTierNameFromVoltage(-actualEnergyUsage))); + currentTip.add( + StatCollector.translateToLocalFormatted( + "GT5U.waila.energy.produce", + GT_Utility.formatNumbers(-actualEnergyUsage), + GT_Utility.getColoredTierNameFromVoltage(-actualEnergyUsage))); } } currentTip.add( @@ -1262,8 +1272,8 @@ public abstract class GT_MetaTileEntity_MultiBlockBase extends MetaTileEntity } @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); @@ -1334,10 +1344,8 @@ public abstract class GT_MetaTileEntity_MultiBlockBase extends MetaTileEntity @Override public void addUIWidgets(ModularWindow.Builder builder, UIBuildContext buildContext) { - builder.widget(new DrawableWidget() - .setDrawable(GT_UITextures.PICTURE_SCREEN_BLACK) - .setPos(7, 4) - .setSize(143, 75)); + builder.widget( + new DrawableWidget().setDrawable(GT_UITextures.PICTURE_SCREEN_BLACK).setPos(7, 4).setSize(143, 75)); final SlotWidget inventorySlot = new SlotWidget(inventoryHandler, 1); builder.widget(inventorySlot.setPos(151, 4)); @@ -1353,94 +1361,99 @@ public abstract class GT_MetaTileEntity_MultiBlockBase extends MetaTileEntity screenElements.setSynced(false).setSpace(0).setPos(10, 7); screenElements - .widget(new TextWidget(GT_Utility.trans("132", "Pipe is loose.")) - .setDefaultColor(COLOR_TEXT_WHITE.get()) - .setEnabled(widget -> !mWrench)) + .widget( + new TextWidget(GT_Utility.trans("132", "Pipe is loose.")) + .setDefaultColor(COLOR_TEXT_WHITE.get()).setEnabled(widget -> !mWrench)) .widget(new FakeSyncWidget.BooleanSyncer(() -> mWrench, val -> mWrench = val)); screenElements - .widget(new TextWidget(GT_Utility.trans("133", "Screws are loose.")) - .setDefaultColor(COLOR_TEXT_WHITE.get()) - .setEnabled(widget -> !mScrewdriver)) + .widget( + new TextWidget(GT_Utility.trans("133", "Screws are loose.")) + .setDefaultColor(COLOR_TEXT_WHITE.get()).setEnabled(widget -> !mScrewdriver)) .widget(new FakeSyncWidget.BooleanSyncer(() -> mScrewdriver, val -> mScrewdriver = val)); screenElements - .widget(new TextWidget(GT_Utility.trans("134", "Something is stuck.")) - .setDefaultColor(COLOR_TEXT_WHITE.get()) - .setEnabled(widget -> !mSoftHammer)) + .widget( + new TextWidget(GT_Utility.trans("134", "Something is stuck.")) + .setDefaultColor(COLOR_TEXT_WHITE.get()).setEnabled(widget -> !mSoftHammer)) .widget(new FakeSyncWidget.BooleanSyncer(() -> mSoftHammer, val -> mSoftHammer = val)); screenElements - .widget(new TextWidget(GT_Utility.trans("135", "Platings are dented.")) - .setDefaultColor(COLOR_TEXT_WHITE.get()) - .setEnabled(widget -> !mHardHammer)) + .widget( + new TextWidget(GT_Utility.trans("135", "Platings are dented.")) + .setDefaultColor(COLOR_TEXT_WHITE.get()).setEnabled(widget -> !mHardHammer)) .widget(new FakeSyncWidget.BooleanSyncer(() -> mHardHammer, val -> mHardHammer = val)); screenElements - .widget(new TextWidget(GT_Utility.trans("136", "Circuitry burned out.")) - .setDefaultColor(COLOR_TEXT_WHITE.get()) - .setEnabled(widget -> !mSolderingTool)) + .widget( + new TextWidget(GT_Utility.trans("136", "Circuitry burned out.")) + .setDefaultColor(COLOR_TEXT_WHITE.get()).setEnabled(widget -> !mSolderingTool)) .widget(new FakeSyncWidget.BooleanSyncer(() -> mSolderingTool, val -> mSolderingTool = val)); screenElements - .widget(new TextWidget(GT_Utility.trans("137", "That doesn't belong there.")) - .setDefaultColor(COLOR_TEXT_WHITE.get()) - .setEnabled(widget -> !mCrowbar)) + .widget( + new TextWidget(GT_Utility.trans("137", "That doesn't belong there.")) + .setDefaultColor(COLOR_TEXT_WHITE.get()).setEnabled(widget -> !mCrowbar)) .widget(new FakeSyncWidget.BooleanSyncer(() -> mCrowbar, val -> mCrowbar = val)); screenElements - .widget(new TextWidget(GT_Utility.trans("138", "Incomplete Structure.")) - .setDefaultColor(COLOR_TEXT_WHITE.get()) - .setEnabled(widget -> !mMachine)) + .widget( + new TextWidget(GT_Utility.trans("138", "Incomplete Structure.")) + .setDefaultColor(COLOR_TEXT_WHITE.get()).setEnabled(widget -> !mMachine)) .widget(new FakeSyncWidget.BooleanSyncer(() -> mMachine, val -> mMachine = val)); - screenElements.widget(new TextWidget("Too Uncertain.") - .setDefaultColor(COLOR_TEXT_WHITE.get()) - .setEnabled(widget -> (getBaseMetaTileEntity().getErrorDisplayID() & 128) != 0)); - screenElements.widget(new TextWidget("Invalid Parameters.") - .setDefaultColor(COLOR_TEXT_WHITE.get()) - .setEnabled(widget -> (getBaseMetaTileEntity().getErrorDisplayID() & 256) != 0)); + screenElements.widget( + new TextWidget("Too Uncertain.").setDefaultColor(COLOR_TEXT_WHITE.get()) + .setEnabled(widget -> (getBaseMetaTileEntity().getErrorDisplayID() & 128) != 0)); + screenElements.widget( + new TextWidget("Invalid Parameters.").setDefaultColor(COLOR_TEXT_WHITE.get()) + .setEnabled(widget -> (getBaseMetaTileEntity().getErrorDisplayID() & 256) != 0)); screenElements - .widget(new TextWidget(GT_Utility.trans("139", "Hit with Soft Mallet")) - .setDefaultColor(COLOR_TEXT_WHITE.get()) - .setEnabled(widget -> getBaseMetaTileEntity().getErrorDisplayID() == 0 - && !getBaseMetaTileEntity().isActive())) - .widget(new FakeSyncWidget.IntegerSyncer( - () -> getBaseMetaTileEntity().getErrorDisplayID(), - val -> getBaseMetaTileEntity().setErrorDisplayID(val))) - .widget(new FakeSyncWidget.BooleanSyncer( - () -> getBaseMetaTileEntity().isActive(), - val -> getBaseMetaTileEntity().setActive(val))); - screenElements.widget(new TextWidget(GT_Utility.trans("140", "to (re-)start the Machine")) - .setDefaultColor(COLOR_TEXT_WHITE.get()) - .setEnabled(widget -> getBaseMetaTileEntity().getErrorDisplayID() == 0 - && !getBaseMetaTileEntity().isActive())); - screenElements.widget(new TextWidget(GT_Utility.trans("141", "if it doesn't start.")) - .setDefaultColor(COLOR_TEXT_WHITE.get()) - .setEnabled(widget -> getBaseMetaTileEntity().getErrorDisplayID() == 0 - && !getBaseMetaTileEntity().isActive())); - screenElements.widget(new TextWidget(GT_Utility.trans("142", "Running perfectly.")) - .setDefaultColor(COLOR_TEXT_WHITE.get()) - .setEnabled(widget -> getBaseMetaTileEntity().getErrorDisplayID() == 0 - && getBaseMetaTileEntity().isActive())); - - screenElements.widget(new TextWidget(GT_Utility.trans("143", "Missing Mining Pipe")) - .setDefaultColor(COLOR_TEXT_WHITE.get()) - .setEnabled(widget -> { - if (getBaseMetaTileEntity().getErrorDisplayID() == 0 - && this instanceof GT_MetaTileEntity_DrillerBase) { - final ItemStack tItem = inventorySlot.getMcSlot().getStack(); - return tItem == null - || !GT_Utility.areStacksEqual(tItem, GT_ModHandler.getIC2Item("miningPipe", 1L)); - } - return false; - })); - screenElements.widget(new TextWidget(GT_Utility.trans("144", "Missing Turbine Rotor")) - .setDefaultColor(COLOR_TEXT_WHITE.get()) - .setEnabled(widget -> { - if (getBaseMetaTileEntity().getErrorDisplayID() == 0 - && this instanceof GT_MetaTileEntity_LargeTurbine) { - final ItemStack tItem = inventorySlot.getMcSlot().getStack(); - return tItem == null - || !(tItem.getItem() == GT_MetaGenerated_Tool_01.INSTANCE + .widget( + new TextWidget(GT_Utility.trans("139", "Hit with Soft Mallet")) + .setDefaultColor(COLOR_TEXT_WHITE.get()).setEnabled( + widget -> getBaseMetaTileEntity().getErrorDisplayID() == 0 + && !getBaseMetaTileEntity().isActive())) + .widget( + new FakeSyncWidget.IntegerSyncer( + () -> getBaseMetaTileEntity().getErrorDisplayID(), + val -> getBaseMetaTileEntity().setErrorDisplayID(val))) + .widget( + new FakeSyncWidget.BooleanSyncer( + () -> getBaseMetaTileEntity().isActive(), + val -> getBaseMetaTileEntity().setActive(val))); + screenElements.widget( + new TextWidget(GT_Utility.trans("140", "to (re-)start the Machine")) + .setDefaultColor(COLOR_TEXT_WHITE.get()).setEnabled( + widget -> getBaseMetaTileEntity().getErrorDisplayID() == 0 + && !getBaseMetaTileEntity().isActive())); + screenElements.widget( + new TextWidget(GT_Utility.trans("141", "if it doesn't start.")).setDefaultColor(COLOR_TEXT_WHITE.get()) + .setEnabled( + widget -> getBaseMetaTileEntity().getErrorDisplayID() == 0 + && !getBaseMetaTileEntity().isActive())); + screenElements.widget( + new TextWidget(GT_Utility.trans("142", "Running perfectly.")).setDefaultColor(COLOR_TEXT_WHITE.get()) + .setEnabled( + widget -> getBaseMetaTileEntity().getErrorDisplayID() == 0 + && getBaseMetaTileEntity().isActive())); + + screenElements.widget( + new TextWidget(GT_Utility.trans("143", "Missing Mining Pipe")).setDefaultColor(COLOR_TEXT_WHITE.get()) + .setEnabled(widget -> { + if (getBaseMetaTileEntity().getErrorDisplayID() == 0 + && this instanceof GT_MetaTileEntity_DrillerBase) { + final ItemStack tItem = inventorySlot.getMcSlot().getStack(); + return tItem == null || !GT_Utility + .areStacksEqual(tItem, GT_ModHandler.getIC2Item("miningPipe", 1L)); + } + return false; + })); + screenElements.widget( + new TextWidget(GT_Utility.trans("144", "Missing Turbine Rotor")).setDefaultColor(COLOR_TEXT_WHITE.get()) + .setEnabled(widget -> { + if (getBaseMetaTileEntity().getErrorDisplayID() == 0 + && this instanceof GT_MetaTileEntity_LargeTurbine) { + final ItemStack tItem = inventorySlot.getMcSlot().getStack(); + return tItem == null || !(tItem.getItem() == GT_MetaGenerated_Tool_01.INSTANCE && tItem.getItemDamage() >= 170 && tItem.getItemDamage() <= 177); - } - return false; - })); + } + return false; + })); } } 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 f146b39635..6becb5e806 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 @@ -1,5 +1,11 @@ package gregtech.api.metatileentity.implementations; +import java.util.Collections; +import java.util.List; + +import net.minecraft.item.ItemStack; +import net.minecraft.nbt.NBTTagCompound; + import com.gtnewhorizons.modularui.api.drawable.Text; import com.gtnewhorizons.modularui.api.screen.ModularWindow; import com.gtnewhorizons.modularui.api.screen.UIBuildContext; @@ -8,35 +14,33 @@ import com.gtnewhorizons.modularui.common.widget.ButtonWidget; import com.gtnewhorizons.modularui.common.widget.DrawableWidget; import com.gtnewhorizons.modularui.common.widget.SlotGroup; import com.gtnewhorizons.modularui.common.widget.SlotWidget; + import gregtech.api.gui.modularui.GT_UITextures; import gregtech.api.interfaces.ITexture; import gregtech.api.interfaces.modularui.IAddUIWidgets; import gregtech.api.interfaces.tileentity.IGregTechTileEntity; import gregtech.api.util.GT_Utility; -import java.util.Collections; -import java.util.List; -import net.minecraft.item.ItemStack; -import net.minecraft.nbt.NBTTagCompound; public abstract class GT_MetaTileEntity_SpecialFilter extends GT_MetaTileEntity_Buffer implements IAddUIWidgets { + public static final int BUFFER_SLOT_COUNT = 9; public static final int SPECIAL_SLOT_INDEX = 9; 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); } @@ -83,73 +87,61 @@ public abstract class GT_MetaTileEntity_SpecialFilter extends GT_MetaTileEntity_ addEmitEnergyButton(builder); addEmitRedstoneButton(builder); addInvertRedstoneButton(builder); - builder.widget(new ButtonWidget() - .setOnClick((clickData, widget) -> { - bInvertFilter = !bInvertFilter; - if (bInvertFilter) { - GT_Utility.sendChatToPlayer( - widget.getContext().getPlayer(), GT_Utility.trans("124", "Invert Filter")); - } else { - GT_Utility.sendChatToPlayer( - widget.getContext().getPlayer(), - GT_Utility.trans("125", "Don't invert Filter")); - } - }) - .setBackground(GT_UITextures.BUTTON_STANDARD, GT_UITextures.OVERLAY_BUTTON_INVERT_FILTER) - .setPos(61, 62) + builder.widget(new ButtonWidget().setOnClick((clickData, widget) -> { + bInvertFilter = !bInvertFilter; + if (bInvertFilter) { + GT_Utility.sendChatToPlayer(widget.getContext().getPlayer(), GT_Utility.trans("124", "Invert Filter")); + } else { + GT_Utility.sendChatToPlayer( + widget.getContext().getPlayer(), + GT_Utility.trans("125", "Don't invert Filter")); + } + }).setBackground(GT_UITextures.BUTTON_STANDARD, GT_UITextures.OVERLAY_BUTTON_INVERT_FILTER).setPos(61, 62) + .setSize(18, 18)).widget(new ButtonWidget().setOnClick((clickData, widget) -> { + bNBTAllowed = !bNBTAllowed; + if (bNBTAllowed) { + GT_Utility.sendChatToPlayer( + widget.getContext().getPlayer(), + GT_Utility.trans("126", "Ignore NBT")); + } else { + GT_Utility.sendChatToPlayer( + widget.getContext().getPlayer(), + GT_Utility.trans("127", "NBT has to match")); + } + }).setBackground(GT_UITextures.BUTTON_STANDARD, GT_UITextures.OVERLAY_BUTTON_NBT).setPos(79, 62) .setSize(18, 18)) - .widget(new ButtonWidget() - .setOnClick((clickData, widget) -> { - bNBTAllowed = !bNBTAllowed; - if (bNBTAllowed) { - GT_Utility.sendChatToPlayer( - widget.getContext().getPlayer(), GT_Utility.trans("126", "Ignore NBT")); - } else { - GT_Utility.sendChatToPlayer( - widget.getContext().getPlayer(), GT_Utility.trans("127", "NBT has to match")); - } - }) - .setBackground(GT_UITextures.BUTTON_STANDARD, GT_UITextures.OVERLAY_BUTTON_NBT) - .setPos(79, 62) - .setSize(18, 18)) - .widget(new DrawableWidget() - .setDrawable(GT_UITextures.PICTURE_ARROW_24_WHITE.apply(27, false)) - .setPos(6, 19) - .setSize(27, 24)) - .widget(new DrawableWidget() - .setDrawable(GT_UITextures.PICTURE_ARROW_24_BLUE.apply(42, true)) - .setPos(53, 19) - .setSize(42, 24)) - .widget(new DrawableWidget() - .setDrawable(GT_UITextures.PICTURE_ARROW_24_RED.apply(19, true)) - .setPos(152, 19) - .setSize(19, 24)) .widget( - new SlotWidget(BaseSlot.phantom(inventoryHandler, 9)) { - @Override - protected void phantomClick(ClickData clickData, ItemStack cursorStack) { - clickTypeIcon(clickData.mouseButton != 0, cursorStack); - } - - @Override - public void buildTooltip(List<Text> tooltip) { - if (getEmptySlotTooltip() != null) { - tooltip.addAll(getEmptySlotTooltip()); - } - super.buildTooltip(tooltip); - } - - @Override - public List<String> getExtraTooltip() { - if (getItemExtraTooltip() != null) { - return getItemExtraTooltip(); - } - return Collections.emptyList(); - } - }.disableShiftInsert().setPos(34, 22).setBackground(GT_UITextures.BUTTON_STANDARD)) - .widget(SlotGroup.ofItemHandler(inventoryHandler, 3) - .endAtSlot(8) - .build() - .setPos(97, 4)); + new DrawableWidget().setDrawable(GT_UITextures.PICTURE_ARROW_24_WHITE.apply(27, false)) + .setPos(6, 19).setSize(27, 24)) + .widget( + new DrawableWidget().setDrawable(GT_UITextures.PICTURE_ARROW_24_BLUE.apply(42, true)) + .setPos(53, 19).setSize(42, 24)) + .widget( + new DrawableWidget().setDrawable(GT_UITextures.PICTURE_ARROW_24_RED.apply(19, true)) + .setPos(152, 19).setSize(19, 24)) + .widget(new SlotWidget(BaseSlot.phantom(inventoryHandler, 9)) { + + @Override + protected void phantomClick(ClickData clickData, ItemStack cursorStack) { + clickTypeIcon(clickData.mouseButton != 0, cursorStack); + } + + @Override + public void buildTooltip(List<Text> tooltip) { + if (getEmptySlotTooltip() != null) { + tooltip.addAll(getEmptySlotTooltip()); + } + super.buildTooltip(tooltip); + } + + @Override + public List<String> getExtraTooltip() { + if (getItemExtraTooltip() != null) { + return getItemExtraTooltip(); + } + return Collections.emptyList(); + } + }.disableShiftInsert().setPos(34, 22).setBackground(GT_UITextures.BUTTON_STANDARD)) + .widget(SlotGroup.ofItemHandler(inventoryHandler, 3).endAtSlot(8).build().setPos(97, 4)); } } diff --git a/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_TieredMachineBlock.java b/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_TieredMachineBlock.java index 21267f983e..9c069bbd5f 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 @@ -6,6 +6,7 @@ import static gregtech.api.metatileentity.BaseTileEntity.BATTERY_SLOT_TOOLTIP_AL import static gregtech.api.metatileentity.BaseTileEntity.TOOLTIP_DELAY; import com.gtnewhorizons.modularui.common.widget.SlotWidget; + import gregtech.api.enums.GT_Values; import gregtech.api.gui.modularui.GT_UITextures; import gregtech.api.interfaces.ITexture; @@ -14,9 +15,9 @@ import gregtech.api.util.GT_Utility; import gregtech.common.tileentities.machines.multi.GT_MetaTileEntity_Cleanroom; public abstract class GT_MetaTileEntity_TieredMachineBlock extends MetaTileEntity { + /** - * Value between [0 - 9] to describe the Tier of this Machine. - * PLZ [0-15] works - READ! GT_Values class. + * Value between [0 - 9] to describe the Tier of this Machine. PLZ [0-15] works - READ! GT_Values class. */ public final byte mTier; @@ -33,31 +34,19 @@ 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; @@ -73,17 +62,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; @@ -112,8 +101,8 @@ public abstract class GT_MetaTileEntity_TieredMachineBlock extends MetaTileEntit } /** - * Used Client Side to get a Texture Set for this Block. - * Called after setting the Tier and the Description so that those two are accessible. + * Used Client Side to get a Texture Set for this Block. Called after setting the Tier and the Description so that + * those two are accessible. * * @param aTextures is the optional Array you can give to the Constructor. */ @@ -125,20 +114,17 @@ public abstract class GT_MetaTileEntity_TieredMachineBlock extends MetaTileEntit final String pTier1 = GT_Utility.getColoredTierNameFromTier(mTier); if (mTier == GT_Values.VN.length - 1) { batterySlotTooltipKey = BATTERY_SLOT_TOOLTIP_ALT; - batterySlotTooltipArgs = new String[] {pTier1}; + batterySlotTooltipArgs = new String[] { pTier1 }; } else { batterySlotTooltipKey = BATTERY_SLOT_TOOLTIP; - batterySlotTooltipArgs = new String[] {pTier1, GT_Utility.getColoredTierNameFromTier((byte) (mTier + 1))}; + batterySlotTooltipArgs = new String[] { pTier1, GT_Utility.getColoredTierNameFromTier((byte) (mTier + 1)) }; } return createChargerSlot(x, y, batterySlotTooltipKey, batterySlotTooltipArgs); } protected SlotWidget createChargerSlot(int x, int y, String tooltipKey, Object[] tooltipArgs) { - return (SlotWidget) new SlotWidget(inventoryHandler, rechargerSlotStartIndex()) - .disableShiftInsert() - .setGTTooltip(() -> mTooltipCache.getData(tooltipKey, tooltipArgs)) - .setTooltipShowUpDelay(TOOLTIP_DELAY) - .setBackground(getGUITextureSet().getItemSlot(), GT_UITextures.OVERLAY_SLOT_CHARGER) - .setPos(x, y); + return (SlotWidget) new SlotWidget(inventoryHandler, rechargerSlotStartIndex()).disableShiftInsert() + .setGTTooltip(() -> mTooltipCache.getData(tooltipKey, tooltipArgs)).setTooltipShowUpDelay(TOOLTIP_DELAY) + .setBackground(getGUITextureSet().getItemSlot(), GT_UITextures.OVERLAY_SLOT_CHARGER).setPos(x, y); } } 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 e564c65d21..a4c42dd14d 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 @@ -1,18 +1,21 @@ package gregtech.api.metatileentity.implementations; +import java.util.concurrent.atomic.AtomicReferenceArray; + +import org.lwjgl.input.Keyboard; + import gregtech.api.GregTech_API; import gregtech.api.interfaces.ISecondaryDescribable; import gregtech.api.util.GT_Multiblock_Tooltip_Builder; -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); + + 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 0f6f6249a5..a70ee0d5e7 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 @@ -7,6 +7,19 @@ 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 java.util.List; + +import mcp.mobius.waila.api.IWailaConfigHandler; +import mcp.mobius.waila.api.IWailaDataAccessor; + +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.entity.player.EntityPlayerMP; +import net.minecraft.item.ItemStack; +import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.tileentity.TileEntity; +import net.minecraft.world.World; +import net.minecraftforge.common.util.ForgeDirection; + import cofh.api.energy.IEnergyProvider; import cofh.api.energy.IEnergyStorage; import crazypants.enderio.machine.capbank.TileCapBank; @@ -19,24 +32,15 @@ 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; -import net.minecraft.entity.player.EntityPlayerMP; -import net.minecraft.item.ItemStack; -import net.minecraft.nbt.NBTTagCompound; -import net.minecraft.tileentity.TileEntity; -import net.minecraft.world.World; -import net.minecraftforge.common.util.ForgeDirection; /** * 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 + * This is the main construct for my Basic Machines such as the Automatic Extractor Extend this class to make a simple + * Machine */ public class GT_MetaTileEntity_Transformer extends GT_MetaTileEntity_TieredMachineBlock { + public GT_MetaTileEntity_Transformer(int aID, String aName, String aNameRegional, int aTier, String aDescription) { super(aID, aName, aNameRegional, aTier, 0, aDescription); } @@ -53,57 +57,39 @@ 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 @@ -138,8 +124,7 @@ public class GT_MetaTileEntity_Transformer extends GT_MetaTileEntity_TieredMachi @Override public boolean isInputFacing(byte aSide) { - return getBaseMetaTileEntity().isAllowedToWork() - ? aSide == getBaseMetaTileEntity().getFrontFacing() + return getBaseMetaTileEntity().isAllowedToWork() ? aSide == getBaseMetaTileEntity().getFrontFacing() : aSide != getBaseMetaTileEntity().getFrontFacing(); } @@ -190,55 +175,50 @@ 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); - 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) { - int storedRF = ((IPowerContainer) tTileEntity).getEnergyStored(); - 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()); - network.addEnergy(GT_Utility.safeInt(-(tEU * 100 / GregTech_API.mRFtoEU))); - } - } else { - if (storedRF > extractRF) { - ((IPowerContainer) tTileEntity).setEnergyStored(storedRF - extractRF); - tEU = maxEUInput(); - } else { - ((IPowerContainer) tTileEntity).setEnergyStored(0); - tEU = storedRF * (long) GregTech_API.mRFtoEU / 100L; - } - } - aBaseMetaTileEntity.injectEnergyUnits((byte) 6, Math.min(tEU, maxEUInput()), 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) { + int storedRF = ((IPowerContainer) tTileEntity).getEnergyStored(); + 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()); + network.addEnergy(GT_Utility.safeInt(-(tEU * 100 / GregTech_API.mRFtoEU))); + } + } else { + if (storedRF > extractRF) { + ((IPowerContainer) tTileEntity).setEnergyStored(storedRF - extractRF); + tEU = maxEUInput(); + } else { + ((IPowerContainer) tTileEntity).setEnergyStored(0); + tEU = storedRF * (long) GregTech_API.mRFtoEU / 100L; + } + } + aBaseMetaTileEntity.injectEnergyUnits((byte) 6, Math.min(tEU, maxEUInput()), 1); + } } } } @@ -270,10 +250,8 @@ public class GT_MetaTileEntity_Transformer extends GT_MetaTileEntity_TieredMachi @Override public String getAlternativeModeText() { - return (getBaseMetaTileEntity().isAllowedToWork() - ? GT_Utility.trans("145", "Step Down, In: ") - : GT_Utility.trans("146", "Step Up, In: ")) - + maxEUInput() + 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: ") @@ -289,8 +267,8 @@ 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(); @@ -299,40 +277,43 @@ public class GT_MetaTileEntity_Transformer extends GT_MetaTileEntity_TieredMachi final byte inputTier = GT_Utility.getTier(tag.getLong("maxEUInput")); final byte outputTier = GT_Utility.getTier(tag.getLong("maxEUOutput")); - currenttip.add(String.format( - "%s %s(%dA) -> %s(%dA)", - (allowedToWork ? (GREEN + "Step Down") : (RED + "Step Up")) + RESET, - GT_Mod.gregtechproxy.mWailaTransformerVoltageTier - ? GT_Utility.getColoredTierNameFromTier(inputTier) - : tag.getLong("maxEUInput"), - tag.getLong("maxAmperesIn"), - GT_Mod.gregtechproxy.mWailaTransformerVoltageTier - ? GT_Utility.getColoredTierNameFromTier(outputTier) - : tag.getLong("maxEUOutput"), - tag.getLong("maxAmperesOut"))); + currenttip.add( + String.format( + "%s %s(%dA) -> %s(%dA)", + (allowedToWork ? (GREEN + "Step Down") : (RED + "Step Up")) + RESET, + GT_Mod.gregtechproxy.mWailaTransformerVoltageTier + ? GT_Utility.getColoredTierNameFromTier(inputTier) + : tag.getLong("maxEUInput"), + tag.getLong("maxAmperesIn"), + GT_Mod.gregtechproxy.mWailaTransformerVoltageTier + ? GT_Utility.getColoredTierNameFromTier(outputTier) + : tag.getLong("maxEUOutput"), + tag.getLong("maxAmperesOut"))); if ((side == facing && allowedToWork) || (side != facing && !allowedToWork)) { - currenttip.add(String.format( - GOLD + "Input:" + RESET + " %s(%dA)", - GT_Mod.gregtechproxy.mWailaTransformerVoltageTier - ? GT_Utility.getColoredTierNameFromTier(inputTier) - : tag.getLong("maxEUInput"), - tag.getLong("maxAmperesIn"))); + currenttip.add( + String.format( + GOLD + "Input:" + RESET + " %s(%dA)", + GT_Mod.gregtechproxy.mWailaTransformerVoltageTier + ? GT_Utility.getColoredTierNameFromTier(inputTier) + : tag.getLong("maxEUInput"), + tag.getLong("maxAmperesIn"))); } else { - currenttip.add(String.format( - BLUE + "Output:" + RESET + " %s(%dA)", - GT_Mod.gregtechproxy.mWailaTransformerVoltageTier - ? GT_Utility.getColoredTierNameFromTier(outputTier) - : tag.getLong("maxEUOutput"), - tag.getLong("maxAmperesOut"))); + currenttip.add( + String.format( + BLUE + "Output:" + RESET + " %s(%dA)", + GT_Mod.gregtechproxy.mWailaTransformerVoltageTier + ? GT_Utility.getColoredTierNameFromTier(outputTier) + : 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()); 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 41b898b582..997898a34e 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 @@ -2,15 +2,16 @@ package gregtech.api.metatileentity.implementations; import static gregtech.api.enums.GT_Values.*; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.item.ItemStack; +import net.minecraft.util.EnumChatFormatting; + 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 net.minecraft.entity.player.EntityPlayer; -import net.minecraft.item.ItemStack; -import net.minecraft.util.EnumChatFormatting; public class GT_MetaTileEntity_Wireless_Dynamo extends GT_MetaTileEntity_Hatch_Dynamo implements IGlobalWirelessEnergy, IWirelessEnergyHatchInformation { @@ -18,23 +19,23 @@ public class GT_MetaTileEntity_Wireless_Dynamo extends GT_MetaTileEntity_Hatch_D 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); } public GT_MetaTileEntity_Wireless_Dynamo(int aID, String aName, String aNameRegional, int aTier) { - super(aID, aName, aNameRegional, aTier, new String[] {""}); + super(aID, aName, aNameRegional, aTier, new String[] { "" }); } @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 @@ -84,11 +85,9 @@ public class GT_MetaTileEntity_Wireless_Dynamo extends GT_MetaTileEntity_Hatch_D @Override public String[] getDescription() { - return new String[] { - EnumChatFormatting.GRAY + "Stores energy globally in a network, up to 2^(2^31) EU.", - EnumChatFormatting.GRAY + "Does not connect to wires. This block accepts EU into the network.", - AuthorColen - }; + return new String[] { EnumChatFormatting.GRAY + "Stores energy globally in a network, up to 2^(2^31) EU.", + EnumChatFormatting.GRAY + "Does not connect to wires. This block accepts EU into the network.", + AuthorColen }; } @Override @@ -103,7 +102,7 @@ public class GT_MetaTileEntity_Wireless_Dynamo extends GT_MetaTileEntity_Hatch_D @Override public MetaTileEntity newMetaEntity(IGregTechTileEntity aTileEntity) { - return new GT_MetaTileEntity_Wireless_Dynamo(mName, mTier, new String[] {""}, mTextures); + return new GT_MetaTileEntity_Wireless_Dynamo(mName, mTier, new String[] { "" }, mTextures); } @Override 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 218f15c8c0..756a1b138a 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 @@ -2,22 +2,24 @@ package gregtech.api.metatileentity.implementations; import static gregtech.api.enums.GT_Values.*; +import java.math.BigInteger; + +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.item.ItemStack; +import net.minecraft.util.EnumChatFormatting; + 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 java.math.BigInteger; -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.item.ItemStack; -import net.minecraft.util.EnumChatFormatting; 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; @@ -28,26 +30,24 @@ public class GT_MetaTileEntity_Wireless_Hatch extends GT_MetaTileEntity_Hatch_En } public GT_MetaTileEntity_Wireless_Hatch(int aID, String aName, String aNameRegional, int aTier) { - super(aID, aName, aNameRegional, aTier, new String[] {""}); + super(aID, aName, aNameRegional, aTier, new String[] { "" }); } @Override public String[] getDescription() { - return new String[] { - EnumChatFormatting.GRAY + "Stores energy globally in a network, up to 2^(2^31) EU.", - EnumChatFormatting.GRAY + "Does not connect to wires. This block withdraws EU from the network.", - AuthorColen - }; + return new String[] { EnumChatFormatting.GRAY + "Stores energy globally in a network, up to 2^(2^31) EU.", + EnumChatFormatting.GRAY + "Does not connect to wires. This block withdraws EU from the network.", + AuthorColen }; } @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 @@ -107,7 +107,7 @@ public class GT_MetaTileEntity_Wireless_Hatch extends GT_MetaTileEntity_Hatch_En @Override public MetaTileEntity newMetaEntity(IGregTechTileEntity aTileEntity) { - return new GT_MetaTileEntity_Wireless_Hatch(mName, mTier, new String[] {""}, mTextures); + return new GT_MetaTileEntity_Wireless_Hatch(mName, mTier, new String[] { "" }, mTextures); } @Override diff --git a/src/main/java/gregtech/api/multitileentity/MultiTileEntityBlock.java b/src/main/java/gregtech/api/multitileentity/MultiTileEntityBlock.java index dc9a9fd529..99dd459fb8 100644 --- a/src/main/java/gregtech/api/multitileentity/MultiTileEntityBlock.java +++ b/src/main/java/gregtech/api/multitileentity/MultiTileEntityBlock.java @@ -8,7 +8,39 @@ 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 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; +import net.minecraft.client.renderer.texture.IIconRegister; +import net.minecraft.creativetab.CreativeTabs; +import net.minecraft.enchantment.EnchantmentHelper; +import net.minecraft.entity.Entity; +import net.minecraft.entity.EnumCreatureType; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.init.Blocks; +import net.minecraft.item.Item; +import net.minecraft.item.ItemBlock; +import net.minecraft.item.ItemStack; +import net.minecraft.stats.StatList; +import net.minecraft.tileentity.TileEntity; +import net.minecraft.util.AxisAlignedBB; +import net.minecraft.util.IIcon; +import net.minecraft.util.MovingObjectPosition; +import net.minecraft.util.StatCollector; +import net.minecraft.world.Explosion; +import net.minecraft.world.IBlockAccess; +import net.minecraft.world.World; +import net.minecraftforge.common.util.ForgeDirection; +import net.minecraftforge.event.ForgeEventFactory; + import com.cricketcraft.chisel.api.IFacade; + import cpw.mods.fml.common.registry.GameRegistry; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; @@ -38,41 +70,13 @@ import gregtech.api.util.GT_Utility; import gregtech.common.covers.CoverInfo; 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; -import net.minecraft.client.renderer.texture.IIconRegister; -import net.minecraft.creativetab.CreativeTabs; -import net.minecraft.enchantment.EnchantmentHelper; -import net.minecraft.entity.Entity; -import net.minecraft.entity.EnumCreatureType; -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.init.Blocks; -import net.minecraft.item.Item; -import net.minecraft.item.ItemBlock; -import net.minecraft.item.ItemStack; -import net.minecraft.stats.StatList; -import net.minecraft.tileentity.TileEntity; -import net.minecraft.util.AxisAlignedBB; -import net.minecraft.util.IIcon; -import net.minecraft.util.MovingObjectPosition; -import net.minecraft.util.StatCollector; -import net.minecraft.world.Explosion; -import net.minecraft.world.IBlockAccess; -import net.minecraft.world.World; -import net.minecraftforge.common.util.ForgeDirection; -import net.minecraftforge.event.ForgeEventFactory; /* * MultiTileEntityBlock ported from GT6 */ 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; @@ -80,51 +84,51 @@ public class MultiTileEntityBlock extends Block 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 + "." + 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. - * @param aMaterial the Material used to determine the Block. - * @param aSoundType the Sound Type of the Block. - * @param aTool the Tool used to harvest this Block. - * @param aHarvestLevelOffset obvious + * @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. + * @param aMaterial the Material used to determine the Block. + * @param aSoundType the Sound Type of the Block. + * @param aTool the Tool used to harvest this Block. + * @param aHarvestLevelOffset obvious * @param aHarvestLevelMinimum obvious * @param aHarvestLevelMaximum obvious - * @param aOpaque if this Block is Opaque. - * @param aNormalCube if this Block is a normal Cube (for Redstone Stuff). + * @param aOpaque if this Block is Opaque. + * @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)); + 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, @@ -140,16 +144,8 @@ public class MultiTileEntityBlock extends Block : rBlock; } - protected MultiTileEntityBlock( - String aModID, - String aMaterialName, - Material aMaterial, - SoundType aSoundType, - String aTool, - int aHarvestLevelOffset, - int aHarvestLevelMinimum, - int aHarvestLevelMaximum, - boolean aOpaque, + 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) @@ -205,7 +201,7 @@ public class MultiTileEntityBlock extends Block } @Override - public final boolean func_149730_j /*isFullBlock*/() { + public final boolean func_149730_j /* isFullBlock */() { return mOpaque; } @@ -227,8 +223,7 @@ public class MultiTileEntityBlock extends Block @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() + return aTileEntity instanceof IMTE_GetBlockHardness ? ((IMTE_GetBlockHardness) aTileEntity).getBlockHardness() : 1.0F; } @@ -246,8 +241,8 @@ public class MultiTileEntityBlock extends Block @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); @@ -286,8 +281,8 @@ public class MultiTileEntityBlock extends Block } @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; @@ -319,11 +314,9 @@ public class MultiTileEntityBlock extends Block @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 @@ -334,16 +327,8 @@ public class MultiTileEntityBlock extends Block } @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 @@ -377,8 +362,7 @@ public class MultiTileEntityBlock extends Block @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() + return aTileEntity instanceof IMTE_GetWeakChanges ? ((IMTE_GetWeakChanges) aTileEntity).getWeakChanges() : super.getWeakChanges(aWorld, aX, aY, aZ); } @@ -394,7 +378,17 @@ public class MultiTileEntityBlock extends Block 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); + 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); } @@ -582,8 +576,8 @@ public class MultiTileEntityBlock extends Block } @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<>(); @@ -595,15 +589,8 @@ public class MultiTileEntityBlock extends Block } @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) @@ -619,7 +606,10 @@ public class MultiTileEntityBlock extends Block 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); + aX, + aY, + aZ, + aWorld.provider.dimensionId); ((IMultiTileEntity) aTileEntity).onExploded(aExplosion); } else aWorld.setBlockToAir(aX, aY, aZ); } @@ -652,8 +642,8 @@ public class MultiTileEntityBlock extends Block } @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; } @@ -664,8 +654,8 @@ public class MultiTileEntityBlock extends Block return aTileEntity instanceof IMultiTileEntity ? ((IMultiTileEntity) aTileEntity).getPickBlock(aTarget) : null; } - public final IMultiTileEntity receiveMultiTileEntityData( - IBlockAccess aWorld, int aX, short aY, int aZ, short aRID, short aID) { + public final IMultiTileEntity receiveMultiTileEntityData(IBlockAccess aWorld, int aX, short aY, int aZ, short aRID, + short aID) { if (!(aWorld instanceof World)) return null; TileEntity aTileEntity = aWorld.getTileEntity(aX, aY, aZ); @@ -683,8 +673,8 @@ public class MultiTileEntityBlock extends Block return ((IMultiTileEntity) aTileEntity); } - public void receiveCoverData( - IMultiTileEntity mte, int aCover0, int aCover1, int aCover2, int aCover3, int aCover4, int aCover5) { + public void receiveCoverData(IMultiTileEntity mte, int aCover0, int aCover1, int aCover2, int aCover3, int aCover4, + int aCover5) { boolean updated; updated = mte.setCoverIDAtSideNoUpdate((byte) 0, aCover0); updated |= mte.setCoverIDAtSideNoUpdate((byte) 1, aCover1); @@ -698,13 +688,13 @@ public class MultiTileEntityBlock extends Block } } // - // te.receiveClientEvent(GregTechTileClientEvents.CHANGE_COMMON_DATA, aTextureData); + // te.receiveClientEvent(GregTechTileClientEvents.CHANGE_COMMON_DATA, aTextureData); // - // te.receiveClientEvent(GregTechTileClientEvents.CHANGE_CUSTOM_DATA, aUpdateData & 0x7F); - // te.receiveClientEvent(GregTechTileClientEvents.CHANGE_CUSTOM_DATA, aTexturePage | 0x80); + // te.receiveClientEvent(GregTechTileClientEvents.CHANGE_CUSTOM_DATA, aUpdateData & 0x7F); + // te.receiveClientEvent(GregTechTileClientEvents.CHANGE_CUSTOM_DATA, aTexturePage | 0x80); // - // te.receiveClientEvent(GregTechTileClientEvents.CHANGE_COLOR, aColorData); - // te.receiveClientEvent(GregTechTileClientEvents.CHANGE_REDSTONE_OUTPUT, aRedstoneData); + // te.receiveClientEvent(GregTechTileClientEvents.CHANGE_COLOR, aColorData); + // te.receiveClientEvent(GregTechTileClientEvents.CHANGE_REDSTONE_OUTPUT, aRedstoneData); @Override public final TileEntity createTileEntity(World aWorld, int aMeta) { diff --git a/src/main/java/gregtech/api/multitileentity/MultiTileEntityBlockInternal.java b/src/main/java/gregtech/api/multitileentity/MultiTileEntityBlockInternal.java index f388944bb4..3dcf5eded3 100644 --- a/src/main/java/gregtech/api/multitileentity/MultiTileEntityBlockInternal.java +++ b/src/main/java/gregtech/api/multitileentity/MultiTileEntityBlockInternal.java @@ -3,12 +3,6 @@ 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; -import gregtech.api.multitileentity.interfaces.IMultiTileEntity.IMTE_HasMultiBlockMachineRelevantData; -import gregtech.common.render.GT_Renderer_Block; -import gregtech.common.render.IRenderedBlock; import net.minecraft.block.Block; import net.minecraft.block.material.Material; import net.minecraft.client.renderer.texture.IIconRegister; @@ -20,7 +14,15 @@ import net.minecraft.util.StatCollector; import net.minecraft.world.IBlockAccess; import net.minecraft.world.World; +import gregtech.api.GregTech_API; +import gregtech.api.interfaces.ITexture; +import gregtech.api.multitileentity.interfaces.IMultiTileEntity; +import gregtech.api.multitileentity.interfaces.IMultiTileEntity.IMTE_HasMultiBlockMachineRelevantData; +import gregtech.common.render.GT_Renderer_Block; +import gregtech.common.render.IRenderedBlock; + public class MultiTileEntityBlockInternal extends Block implements IRenderedBlock { + public MultiTileEntityRegistry mMultiTileEntityRegistry; public MultiTileEntityBlockInternal() { @@ -47,18 +49,10 @@ public class MultiTileEntityBlockInternal extends Block implements IRenderedBloc 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); + 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); @@ -92,7 +86,8 @@ public class MultiTileEntityBlockInternal extends Block implements IRenderedBloc try { if (aMTEContainer.mTileEntity instanceof IMTE_HasMultiBlockMachineRelevantData) { if (((IMTE_HasMultiBlockMachineRelevantData) aMTEContainer.mTileEntity) - .hasMultiBlockMachineRelevantData()) GregTech_API.causeMachineUpdate(aWorld, aX, aY, aZ); + .hasMultiBlockMachineRelevantData()) + GregTech_API.causeMachineUpdate(aWorld, aX, aY, aZ); } } catch (Throwable e) { GT_FML_LOGGER.error("causeMachineUpdate", e); @@ -114,7 +109,7 @@ public class MultiTileEntityBlockInternal extends Block implements IRenderedBloc } 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); } diff --git a/src/main/java/gregtech/api/multitileentity/MultiTileEntityClassContainer.java b/src/main/java/gregtech/api/multitileentity/MultiTileEntityClassContainer.java index c66ec30481..00f06d2deb 100644 --- a/src/main/java/gregtech/api/multitileentity/MultiTileEntityClassContainer.java +++ b/src/main/java/gregtech/api/multitileentity/MultiTileEntityClassContainer.java @@ -2,14 +2,17 @@ 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 java.lang.ref.WeakReference; + import net.minecraft.nbt.NBTTagCompound; import net.minecraft.util.Tuple; +import gregtech.api.enums.Materials; +import gregtech.api.multitileentity.base.BaseMultiTileEntity; +import gregtech.api.util.GT_Util; + public class MultiTileEntityClassContainer { + private final WeakReference<MultiTileEntityRegistry> mRegistry; private String mLocalized; private String mCategoryName; @@ -25,8 +28,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; @@ -38,11 +41,8 @@ public class MultiTileEntityClassContainer { /* End and register the Builder with the registry */ final MultiTileEntityRegistry registry = mRegistry.get(); - if (mParameters.hasKey(NBT.MATERIAL) && !mParameters.hasKey(NBT.COLOR)) - mParameters.setInteger( - NBT.COLOR, - GT_Util.getRGBInt( - Materials.get(mParameters.getString(NBT.MATERIAL)).getRGBA())); + if (mParameters.hasKey(NBT.MATERIAL) && !mParameters.hasKey(NBT.COLOR)) mParameters + .setInteger(NBT.COLOR, GT_Util.getRGBInt(Materials.get(mParameters.getString(NBT.MATERIAL)).getRGBA())); try { mCanonicalTileEntity = mClass.newInstance(); @@ -116,7 +116,10 @@ public class MultiTileEntityClassContainer { } public MultiTileEntityClassContainer setNBT(Tuple... aTags) { - /* Merge in arbitrary NBT tuples of (key, value). Useful for anything for which a custom method has not yet been exposed */ + /* + * Merge in arbitrary NBT tuples of (key, value). Useful for anything for which a custom method has not yet been + * exposed + */ 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 b209c95990..3510140c12 100644 --- a/src/main/java/gregtech/api/multitileentity/MultiTileEntityContainer.java +++ b/src/main/java/gregtech/api/multitileentity/MultiTileEntityContainer.java @@ -2,11 +2,13 @@ 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 gregtech.api.multitileentity.interfaces.IMultiTileEntity; + public class MultiTileEntityContainer { + public final TileEntity mTileEntity; public final MultiTileEntityBlock mBlock; public final byte mBlockMetaData; diff --git a/src/main/java/gregtech/api/multitileentity/MultiTileEntityItemInternal.java b/src/main/java/gregtech/api/multitileentity/MultiTileEntityItemInternal.java index 4d7c6be262..aad842c68b 100644 --- a/src/main/java/gregtech/api/multitileentity/MultiTileEntityItemInternal.java +++ b/src/main/java/gregtech/api/multitileentity/MultiTileEntityItemInternal.java @@ -3,20 +3,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; -import gregtech.api.enums.GT_Values; -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_IgnoreEntityCollisionWhenPlacing; -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; @@ -34,7 +22,22 @@ import net.minecraft.world.World; import net.minecraftforge.fluids.FluidStack; import net.minecraftforge.fluids.IFluidContainerItem; +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; +import gregtech.api.GregTech_API; +import gregtech.api.enums.GT_Values; +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_IgnoreEntityCollisionWhenPlacing; +import gregtech.api.multitileentity.interfaces.IMultiTileEntity.IMTE_OnlyPlaceableWhenSneaking; + public class MultiTileEntityItemInternal extends ItemBlock implements IFluidContainerItem, IItemUpdatable { + public final MultiTileEntityBlockInternal mBlock; public MultiTileEntityItemInternal(Block aBlock) { @@ -47,8 +50,8 @@ public class MultiTileEntityItemInternal extends ItemBlock implements IFluidCont @Override @SuppressWarnings("unchecked") public void addInformation(ItemStack aStack, EntityPlayer aPlayer, List aList, boolean aF3_H) { - final MultiTileEntityContainer tTileEntityContainer = - mBlock.mMultiTileEntityRegistry.getNewTileEntityContainer(aStack); + final MultiTileEntityContainer tTileEntityContainer = mBlock.mMultiTileEntityRegistry + .getNewTileEntityContainer(aStack); if (tTileEntityContainer == null) { aList.add("INVALID ITEM!"); return; @@ -80,43 +83,33 @@ 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 + } 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]; - } + 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; + || !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() + && (aPlayer == null || aPlayer.isSneaking() || !(aMTEContainer.mTileEntity instanceof IMTE_OnlyPlaceableWhenSneaking) || !((IMTE_OnlyPlaceableWhenSneaking) aMTEContainer.mTileEntity) .onlyPlaceableWhenSneaking()) @@ -166,7 +159,7 @@ 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); @@ -177,7 +170,7 @@ public class MultiTileEntityItemInternal extends ItemBlock implements IFluidCont 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); } @@ -195,8 +188,8 @@ public class MultiTileEntityItemInternal extends ItemBlock implements IFluidCont public void updateItemStack(ItemStack aStack) { final MultiTileEntityClassContainer tContainer = mBlock.mMultiTileEntityRegistry.getClassContainer(aStack); if (tContainer == null) return; - final MultiTileEntityContainer tTileEntityContainer = - mBlock.mMultiTileEntityRegistry.getNewTileEntityContainer(aStack); + final MultiTileEntityContainer tTileEntityContainer = mBlock.mMultiTileEntityRegistry + .getNewTileEntityContainer(aStack); if (tTileEntityContainer != null && tTileEntityContainer.mTileEntity instanceof IItemUpdatable) { ((IItemUpdatable) tTileEntityContainer.mTileEntity).updateItemStack(aStack); } @@ -206,8 +199,8 @@ public class MultiTileEntityItemInternal extends ItemBlock implements IFluidCont public void updateItemStack(ItemStack aStack, World aWorld, int aX, int aY, int aZ) { final MultiTileEntityClassContainer tContainer = mBlock.mMultiTileEntityRegistry.getClassContainer(aStack); if (tContainer == null) return; - final MultiTileEntityContainer tTileEntityContainer = - mBlock.mMultiTileEntityRegistry.getNewTileEntityContainer(aStack); + final MultiTileEntityContainer tTileEntityContainer = mBlock.mMultiTileEntityRegistry + .getNewTileEntityContainer(aStack); if (tTileEntityContainer != null && tTileEntityContainer.mTileEntity instanceof IItemUpdatable) { ((IItemUpdatable) tTileEntityContainer.mTileEntity).updateItemStack(aStack, aWorld, aX, aY, aZ); } @@ -217,8 +210,8 @@ 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); @@ -233,8 +226,8 @@ public class MultiTileEntityItemInternal extends ItemBlock implements IFluidCont @Override public FluidStack getFluid(ItemStack aStack) { - final MultiTileEntityContainer tTileEntityContainer = - mBlock.mMultiTileEntityRegistry.getNewTileEntityContainer(aStack); + final MultiTileEntityContainer tTileEntityContainer = mBlock.mMultiTileEntityRegistry + .getNewTileEntityContainer(aStack); if (tTileEntityContainer != null && tTileEntityContainer.mTileEntity instanceof IFluidContainerItem) { final FluidStack rFluid = ((IFluidContainerItem) tTileEntityContainer.mTileEntity).getFluid(aStack); updateItemStack(aStack); @@ -245,8 +238,8 @@ public class MultiTileEntityItemInternal extends ItemBlock implements IFluidCont @Override public int getCapacity(ItemStack aStack) { - final MultiTileEntityContainer tTileEntityContainer = - mBlock.mMultiTileEntityRegistry.getNewTileEntityContainer(aStack); + final MultiTileEntityContainer tTileEntityContainer = mBlock.mMultiTileEntityRegistry + .getNewTileEntityContainer(aStack); if (tTileEntityContainer != null && tTileEntityContainer.mTileEntity instanceof IFluidContainerItem) { final int rCapacity = ((IFluidContainerItem) tTileEntityContainer.mTileEntity).getCapacity(aStack); updateItemStack(aStack); @@ -257,8 +250,8 @@ public class MultiTileEntityItemInternal extends ItemBlock implements IFluidCont @Override public int fill(ItemStack aStack, FluidStack aFluid, boolean aDoFill) { - final MultiTileEntityContainer tTileEntityContainer = - mBlock.mMultiTileEntityRegistry.getNewTileEntityContainer(aStack); + final MultiTileEntityContainer tTileEntityContainer = mBlock.mMultiTileEntityRegistry + .getNewTileEntityContainer(aStack); if (tTileEntityContainer != null && tTileEntityContainer.mTileEntity instanceof IFluidContainerItem) { final int tFilled = ((IFluidContainerItem) tTileEntityContainer.mTileEntity).fill(aStack, aFluid, aDoFill); updateItemStack(aStack); @@ -269,11 +262,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; } @@ -281,8 +274,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; } diff --git a/src/main/java/gregtech/api/multitileentity/MultiTileEntityRegistry.java b/src/main/java/gregtech/api/multitileentity/MultiTileEntityRegistry.java index b212a51384..589f7ef8a6 100644 --- a/src/main/java/gregtech/api/multitileentity/MultiTileEntityRegistry.java +++ b/src/main/java/gregtech/api/multitileentity/MultiTileEntityRegistry.java @@ -2,21 +2,12 @@ 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; -import gregtech.api.GregTech_API; -import gregtech.api.enums.GT_Values; -import gregtech.api.multitileentity.base.BaseMultiTileEntity; -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; @@ -27,10 +18,24 @@ import net.minecraft.tileentity.TileEntity; import net.minecraft.util.StatCollector; import net.minecraft.world.World; +import appeng.core.CreativeTab; + +import com.gtnewhorizon.gtnhlib.util.map.ItemStackMap; + +import cpw.mods.fml.common.registry.GameRegistry; +import gregtech.api.GregTech_API; +import gregtech.api.enums.GT_Values; +import gregtech.api.multitileentity.base.BaseMultiTileEntity; +import gregtech.api.multitileentity.interfaces.IMultiTileEntity; +import gregtech.api.util.GT_LanguageManager; +import gregtech.api.util.GT_Util; +import gregtech.api.util.GT_Utility; + public class MultiTileEntityRegistry { + private static final HashMap<String, MultiTileEntityRegistry> NAMED_REGISTRIES = new HashMap<>(); - // TODO: NBT sensitive or not? Starting with not for now + // TODO: NBT sensitive or not? Starting with not for now private static final ItemStackMap<MultiTileEntityRegistry> REGISTRIES = new ItemStackMap<>(false); private static final HashSet<Class<?>> sRegisteredTileEntities = new HashSet<>(); @@ -41,8 +46,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,8 +62,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)); } @@ -66,9 +71,8 @@ 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; @@ -96,7 +100,10 @@ public class MultiTileEntityRegistry { return new MultiTileEntityClassContainer(this, aID, aClass); } - /** Adds a new MultiTileEntity. It is highly recommended to do this in either the PreInit or the Init Phase. PostInit might not work well.*/ + /** + * Adds a new MultiTileEntity. It is highly recommended to do this in either the PreInit or the Init Phase. PostInit + * might not work well. + */ public ItemStack add(String aLocalised, String aCategoricalName, MultiTileEntityClassContainer aClassContainer) { boolean tFailed = false; if (GT_Utility.isStringInvalid(aLocalised)) { @@ -120,8 +127,9 @@ 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; } } @@ -135,8 +143,8 @@ public class MultiTileEntityRegistry { 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); @@ -144,19 +152,19 @@ 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 + // // 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 = + // 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 = + // 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));} // @@ -209,8 +217,8 @@ 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( @@ -222,13 +230,10 @@ public class MultiTileEntityRegistry { 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; } @@ -238,14 +243,24 @@ 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; } diff --git a/src/main/java/gregtech/api/multitileentity/base/BaseMultiTileEntity.java b/src/main/java/gregtech/api/multitileentity/base/BaseMultiTileEntity.java index 2ab1f8c7d6..1e7a5cb236 100644 --- a/src/main/java/gregtech/api/multitileentity/base/BaseMultiTileEntity.java +++ b/src/main/java/gregtech/api/multitileentity/base/BaseMultiTileEntity.java @@ -7,6 +7,38 @@ 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 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; +import net.minecraft.client.renderer.RenderBlocks; +import net.minecraft.creativetab.CreativeTabs; +import net.minecraft.entity.Entity; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.entity.player.EntityPlayerMP; +import net.minecraft.init.Items; +import net.minecraft.item.Item; +import net.minecraft.item.ItemStack; +import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.network.Packet; +import net.minecraft.tileentity.TileEntity; +import net.minecraft.util.AxisAlignedBB; +import net.minecraft.util.ChunkCoordinates; +import net.minecraft.util.EnumChatFormatting; +import net.minecraft.util.MovingObjectPosition; +import net.minecraft.world.Explosion; +import net.minecraft.world.IBlockAccess; +import net.minecraft.world.World; +import net.minecraftforge.common.util.ForgeDirection; +import net.minecraftforge.fluids.Fluid; +import net.minecraftforge.fluids.FluidStack; +import net.minecraftforge.fluids.FluidTankInfo; +import net.minecraftforge.fluids.IFluidTank; + import cpw.mods.fml.common.registry.GameRegistry; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; @@ -38,44 +70,15 @@ import gregtech.api.util.GT_Util; import gregtech.api.util.GT_Utility; import gregtech.common.render.GT_MultiTexture; 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; -import net.minecraft.client.renderer.RenderBlocks; -import net.minecraft.creativetab.CreativeTabs; -import net.minecraft.entity.Entity; -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.entity.player.EntityPlayerMP; -import net.minecraft.init.Items; -import net.minecraft.item.Item; -import net.minecraft.item.ItemStack; -import net.minecraft.nbt.NBTTagCompound; -import net.minecraft.network.Packet; -import net.minecraft.tileentity.TileEntity; -import net.minecraft.util.AxisAlignedBB; -import net.minecraft.util.ChunkCoordinates; -import net.minecraft.util.EnumChatFormatting; -import net.minecraft.util.MovingObjectPosition; -import net.minecraft.world.Explosion; -import net.minecraft.world.IBlockAccess; -import net.minecraft.world.World; -import net.minecraftforge.common.util.ForgeDirection; -import net.minecraftforge.fluids.Fluid; -import net.minecraftforge.fluids.FluidStack; -import net.minecraftforge.fluids.FluidTankInfo; -import net.minecraftforge.fluids.IFluidTank; 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}; + 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 @@ -131,17 +134,16 @@ public abstract class BaseMultiTileEntity extends CoverableTileEntity // 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()); + final TileEntity tCanonicalTileEntity = MultiTileEntityRegistry + .getCanonicalTileEntity(getMultiTileEntityRegistryID(), getMultiTileEntityID()); if (tCanonicalTileEntity instanceof BaseMultiTileEntity) mTextures = ((BaseMultiTileEntity) tCanonicalTileEntity).mTextures; } @@ -158,7 +160,7 @@ public abstract class BaseMultiTileEntity extends CoverableTileEntity 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 + // Add the Default Parameters. Useful for things that differ between different tiers/types of the // same machine aNBT = GT_Util.fuseNBT(aNBT, tClass.mParameters); } @@ -169,8 +171,7 @@ public abstract class BaseMultiTileEntity extends CoverableTileEntity 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 { @@ -195,7 +196,7 @@ public abstract class BaseMultiTileEntity extends CoverableTileEntity copyTextures(); } - if (mSidedRedstone.length != 6) mSidedRedstone = new byte[] {15, 15, 15, 15, 15, 15}; + if (mSidedRedstone.length != 6) mSidedRedstone = new byte[] { 15, 15, 15, 15, 15, 15 }; updateCoverBehavior(); @@ -280,8 +281,8 @@ public abstract class BaseMultiTileEntity extends CoverableTileEntity } @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; } @@ -294,22 +295,20 @@ public abstract class BaseMultiTileEntity extends CoverableTileEntity 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; } @@ -318,8 +317,7 @@ public abstract class BaseMultiTileEntity extends CoverableTileEntity 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]) + return tTileEntity instanceof IMultiTileEntity ? !((IMultiTileEntity) tTileEntity).isSurfaceOpaque(OPOS[aSide]) : !getBlockAtSide(aSide).isOpaqueCube(); } @@ -378,7 +376,7 @@ public abstract class BaseMultiTileEntity extends CoverableTileEntity 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; } @@ -388,7 +386,7 @@ public abstract class BaseMultiTileEntity extends CoverableTileEntity 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))}; + return new ITexture[] { TextureFactory.of(mTextures[aSide], GT_Util.getRGBaArray(mRGBa)) }; } @Override @@ -440,6 +438,7 @@ public abstract class BaseMultiTileEntity extends CoverableTileEntity /** * Sets the main facing to {aSide} and update as appropriately + * * @return Whether the facing was changed */ @Override @@ -499,27 +498,25 @@ public abstract class BaseMultiTileEntity extends CoverableTileEntity zCoord + aBox[5]); } - public boolean box( - AxisAlignedBB aAABB, - List<AxisAlignedBB> aList, - double aMinX, - double aMinY, - double aMinZ, - double aMaxX, - double aMaxY, - double aMaxZ) { + 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*/ + /* 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); + xCoord + aMinX, + yCoord + aMinY, + zCoord + aMinZ, + xCoord + aMaxX, + yCoord + aMaxY, + zCoord + aMaxZ); } @Override @@ -534,7 +531,7 @@ public abstract class BaseMultiTileEntity extends CoverableTileEntity @Override public void onMachineBlockUpdate() { - /*Do nothing*/ + /* Do nothing */ } public boolean box(AxisAlignedBB aAABB, List<AxisAlignedBB> aList, float[] aBox) { @@ -578,7 +575,12 @@ public abstract class BaseMultiTileEntity extends CoverableTileEntity 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]); + (float) aBox[0], + (float) aBox[1], + (float) aBox[2], + (float) aBox[3], + (float) aBox[4], + (float) aBox[5]); return true; } @@ -598,8 +600,8 @@ public abstract class BaseMultiTileEntity extends CoverableTileEntity /* 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; } @@ -701,17 +703,8 @@ public abstract class BaseMultiTileEntity extends CoverableTileEntity } @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; @@ -742,8 +735,8 @@ public abstract class BaseMultiTileEntity extends CoverableTileEntity if (isClientSide()) { // 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; @@ -779,12 +772,18 @@ public abstract class BaseMultiTileEntity extends CoverableTileEntity if (getCoverIDAtSide(coverSide) == 0) { if (GT_Utility.isStackInList(tCurrentItem, GregTech_API.sCovers.keySet())) { if (GregTech_API.getCoverBehaviorNew(tCurrentItem) - .isCoverPlaceable(coverSide, tCurrentItem, this) + .isCoverPlaceable(coverSide, tCurrentItem, this) && allowCoverOnSide(coverSide, new GT_ItemStack(tCurrentItem))) { setCoverItemAtSide(coverSide, tCurrentItem); if (!aPlayer.capabilities.isCreativeMode) tCurrentItem.stackSize--; GT_Utility.sendSoundToPlayers( - worldObj, SoundResource.IC2_TOOLS_WRENCH, 1.0F, -1, xCoord, yCoord, zCoord); + worldObj, + SoundResource.IC2_TOOLS_WRENCH, + 1.0F, + -1, + xCoord, + yCoord, + zCoord); issueClientUpdate(); } sendCoverDataIfNeeded(); @@ -794,7 +793,13 @@ public abstract class BaseMultiTileEntity extends CoverableTileEntity 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); + worldObj, + SoundResource.RANDOM_BREAK, + 1.0F, + -1, + xCoord, + yCoord, + zCoord); dropCover(coverSide, aSide, false); } sendCoverDataIfNeeded(); @@ -802,29 +807,26 @@ public abstract class BaseMultiTileEntity extends CoverableTileEntity } } } 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 = (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 (!getCoverInfoAtSide(aSide).isGUIClickable()) return false; @@ -849,8 +851,8 @@ public abstract class BaseMultiTileEntity extends CoverableTileEntity return true; } - 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 (setMainFacing(wrenchSide)) { GT_ModHandler.damageOrDechargeItem(tCurrentItem, 1, 1000, aPlayer); GT_Utility.sendSoundToPlayers(worldObj, SoundResource.IC2_TOOLS_WRENCH, 1.0F, -1, xCoord, yCoord, zCoord); @@ -858,47 +860,46 @@ public abstract class BaseMultiTileEntity extends CoverableTileEntity 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)); + 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; } @@ -932,22 +933,22 @@ public abstract class BaseMultiTileEntity extends CoverableTileEntity } @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; } @@ -957,11 +958,9 @@ public abstract class BaseMultiTileEntity extends CoverableTileEntity if ((mOwnerName.length() == 0) && isServerSide()) { setOwnerName(aPlayer.getDisplayName()); setOwnerUuid(aPlayer.getUniqueID()); - } else - return !privateAccess() - || aPlayer.getDisplayName().equals("Player") - || mOwnerName.equals("Player") - || mOwnerName.equals(aPlayer.getDisplayName()); + } else return !privateAccess() || aPlayer.getDisplayName().equals("Player") + || mOwnerName.equals("Player") + || mOwnerName.equals(aPlayer.getDisplayName()); return true; } @@ -993,12 +992,12 @@ public abstract class BaseMultiTileEntity extends CoverableTileEntity getCoverInfoAtSide((byte) 4).getCoverID(), getCoverInfoAtSide((byte) 5).getCoverID()); - packet.setRedstoneData((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))); + packet.setRedstoneData( + (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 (this instanceof IMTE_HasModes) { final IMTE_HasModes mteModes = (IMTE_HasModes) this; @@ -1037,8 +1036,8 @@ public abstract class BaseMultiTileEntity extends CoverableTileEntity mFacing = (byte) (aValue & 7); // 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: // Nothing here, currently @@ -1055,21 +1054,21 @@ public abstract class BaseMultiTileEntity extends CoverableTileEntity 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; @@ -1082,16 +1081,15 @@ public abstract class BaseMultiTileEntity extends CoverableTileEntity } @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); } @@ -1104,8 +1102,14 @@ public abstract class BaseMultiTileEntity extends CoverableTileEntity 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"); @@ -1119,7 +1123,8 @@ public abstract class BaseMultiTileEntity extends CoverableTileEntity } /** - * Fluid - A Default implementation of the Fluid Tank behaviour, so that every TileEntity can use this to simplify its Code. + * 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; @@ -1152,10 +1157,10 @@ public abstract class BaseMultiTileEntity extends CoverableTileEntity 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 + if (tTank == null || tTank.getFluid() == null || tTank.getFluidAmount() == 0 - || !tTank.getFluid().isFluidEqual(aFluid)) return null; + || !tTank.getFluid().isFluidEqual(aFluid)) + return null; return tTank.drain(aFluid.amount, aDoDrain); } diff --git a/src/main/java/gregtech/api/multitileentity/base/BaseNontickableMultiTileEntity.java b/src/main/java/gregtech/api/multitileentity/base/BaseNontickableMultiTileEntity.java index 9b3deb9d69..29a24f9715 100644 --- a/src/main/java/gregtech/api/multitileentity/base/BaseNontickableMultiTileEntity.java +++ b/src/main/java/gregtech/api/multitileentity/base/BaseNontickableMultiTileEntity.java @@ -2,13 +2,15 @@ package gregtech.api.multitileentity.base; import static gregtech.api.enums.GT_Values.NW; +import net.minecraft.entity.player.EntityPlayerMP; +import net.minecraft.network.Packet; + import gregtech.api.net.GT_Packet_SendCoverData; import gregtech.api.util.ISerializableObject; import gregtech.common.covers.CoverInfo; -import net.minecraft.entity.player.EntityPlayerMP; -import net.minecraft.network.Packet; 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() { @@ -47,8 +49,8 @@ public abstract class BaseNontickableMultiTileEntity extends BaseMultiTileEntity } @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 4945fbc62e..0f124ae36e 100644 --- a/src/main/java/gregtech/api/multitileentity/base/BaseTickableMultiTileEntity.java +++ b/src/main/java/gregtech/api/multitileentity/base/BaseTickableMultiTileEntity.java @@ -2,14 +2,16 @@ 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; import net.minecraft.block.Block; import net.minecraft.entity.player.EntityPlayerMP; import net.minecraft.world.World; +import gregtech.api.multitileentity.interfaces.IMultiTileEntity.IMTE_OnNeighborBlockChange; +import gregtech.api.util.GT_Log; +import gregtech.api.util.GT_Util; + public abstract class BaseTickableMultiTileEntity extends BaseMultiTileEntity implements IMTE_OnNeighborBlockChange { + /** Variable for seeing if the Tick Function is called right now. */ public boolean mIsRunningTick = false; /** Gets set to true when the Block received a Block Update. */ @@ -84,22 +86,22 @@ public abstract class BaseTickableMultiTileEntity extends BaseMultiTileEntity im /** The first part of the Tick. */ public void onPreTick(long aTick, boolean isServerSide) { - /*Do nothing*/ + /* Do nothing */ } /** The regular Tick. */ public void onTick(long aTimer, boolean isServerSide) { - /*Do nothing*/ + /* Do nothing */ } /** The absolute last part of the Tick. */ public void onPostTick(long aTick, boolean isServerSide) { - /*Do nothing*/ + /* 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*/ + /* Do nothing */ } @Override diff --git a/src/main/java/gregtech/api/multitileentity/interfaces/IItemUpdatable.java b/src/main/java/gregtech/api/multitileentity/interfaces/IItemUpdatable.java index 77def5e8fd..89d281eb27 100644 --- a/src/main/java/gregtech/api/multitileentity/interfaces/IItemUpdatable.java +++ b/src/main/java/gregtech/api/multitileentity/interfaces/IItemUpdatable.java @@ -4,12 +4,16 @@ import net.minecraft.item.ItemStack; import net.minecraft.world.World; public interface IItemUpdatable { + /** - * Updates the Data of the ItemStack. Not called every tick but instead called whenever something important happens to the Stack. + * Updates the Data of the ItemStack. Not called every tick but instead called whenever something important happens + * to the Stack. */ void updateItemStack(ItemStack aStack); + /** - * Updates the Data of the ItemStack. Not called every tick but instead called whenever something important happens to the Stack. + * Updates the Data of the ItemStack. Not called every tick but instead called whenever something important happens + * to the Stack. */ void updateItemStack(ItemStack aStack, World aWorld, int aX, int aY, int aZ); } diff --git a/src/main/java/gregtech/api/multitileentity/interfaces/IMultiBlockController.java b/src/main/java/gregtech/api/multitileentity/interfaces/IMultiBlockController.java index 414ba24948..c299868b1d 100644 --- a/src/main/java/gregtech/api/multitileentity/interfaces/IMultiBlockController.java +++ b/src/main/java/gregtech/api/multitileentity/interfaces/IMultiBlockController.java @@ -5,6 +5,7 @@ import net.minecraftforge.fluids.FluidStack; public interface IMultiBlockController extends IMultiTileEntity, IMultiBlockFluidHandler, IMultiBlockInventory, IMultiBlockEnergy { + boolean checkStructure(boolean aForceReset); /** Set the structure as having changed, and trigger an update */ diff --git a/src/main/java/gregtech/api/multitileentity/interfaces/IMultiBlockEnergy.java b/src/main/java/gregtech/api/multitileentity/interfaces/IMultiBlockEnergy.java index 4ffd725df5..598c057882 100644 --- a/src/main/java/gregtech/api/multitileentity/interfaces/IMultiBlockEnergy.java +++ b/src/main/java/gregtech/api/multitileentity/interfaces/IMultiBlockEnergy.java @@ -3,6 +3,7 @@ package gregtech.api.multitileentity.interfaces; import gregtech.api.multitileentity.multiblock.base.MultiBlockPart; interface IMultiBlockEnergy { + boolean isUniversalEnergyStored(MultiBlockPart aPart, long aEnergyAmount); long getUniversalEnergyStored(MultiBlockPart aPart); diff --git a/src/main/java/gregtech/api/multitileentity/interfaces/IMultiBlockFluidHandler.java b/src/main/java/gregtech/api/multitileentity/interfaces/IMultiBlockFluidHandler.java index 528c153e05..045a173e94 100644 --- a/src/main/java/gregtech/api/multitileentity/interfaces/IMultiBlockFluidHandler.java +++ b/src/main/java/gregtech/api/multitileentity/interfaces/IMultiBlockFluidHandler.java @@ -1,13 +1,15 @@ package gregtech.api.multitileentity.interfaces; -import gregtech.api.multitileentity.multiblock.base.MultiBlockPart; import net.minecraftforge.common.util.ForgeDirection; import net.minecraftforge.fluids.Fluid; import net.minecraftforge.fluids.FluidStack; import net.minecraftforge.fluids.FluidTankInfo; import net.minecraftforge.fluids.IFluidTank; +import gregtech.api.multitileentity.multiblock.base.MultiBlockPart; + public interface IMultiBlockFluidHandler { + int fill(MultiBlockPart aPart, ForgeDirection aDirection, FluidStack aFluid, boolean aDoFill); FluidStack drain(MultiBlockPart aPart, ForgeDirection aDirection, FluidStack aFluid, boolean aDoDrain); diff --git a/src/main/java/gregtech/api/multitileentity/interfaces/IMultiBlockInventory.java b/src/main/java/gregtech/api/multitileentity/interfaces/IMultiBlockInventory.java index c50addbe67..281e1c7745 100644 --- a/src/main/java/gregtech/api/multitileentity/interfaces/IMultiBlockInventory.java +++ b/src/main/java/gregtech/api/multitileentity/interfaces/IMultiBlockInventory.java @@ -1,12 +1,15 @@ package gregtech.api.multitileentity.interfaces; -import com.gtnewhorizons.modularui.api.forge.IItemHandlerModifiable; -import gregtech.api.multitileentity.multiblock.base.MultiBlockPart; import java.util.List; + import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.ItemStack; +import com.gtnewhorizons.modularui.api.forge.IItemHandlerModifiable; +import gregtech.api.multitileentity.multiblock.base.MultiBlockPart; + public interface IMultiBlockInventory { + boolean hasInventoryBeenModified(MultiBlockPart aPart); boolean isValidSlot(MultiBlockPart aPart, int aIndex); diff --git a/src/main/java/gregtech/api/multitileentity/interfaces/IMultiBlockPart.java b/src/main/java/gregtech/api/multitileentity/interfaces/IMultiBlockPart.java index 027b49ca17..78d6573ebd 100644 --- a/src/main/java/gregtech/api/multitileentity/interfaces/IMultiBlockPart.java +++ b/src/main/java/gregtech/api/multitileentity/interfaces/IMultiBlockPart.java @@ -3,6 +3,7 @@ package gregtech.api.multitileentity.interfaces; import net.minecraft.util.ChunkCoordinates; public interface IMultiBlockPart extends IMultiTileEntity { + ChunkCoordinates getTargetPos(); void setTargetPos(ChunkCoordinates aTargetPos); diff --git a/src/main/java/gregtech/api/multitileentity/interfaces/IMultiTileEntity.java b/src/main/java/gregtech/api/multitileentity/interfaces/IMultiTileEntity.java index 8b900ad61c..eee5d71ce9 100644 --- a/src/main/java/gregtech/api/multitileentity/interfaces/IMultiTileEntity.java +++ b/src/main/java/gregtech/api/multitileentity/interfaces/IMultiTileEntity.java @@ -2,21 +2,10 @@ 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; -import gregtech.api.interfaces.tileentity.IDebugableTileEntity; -import gregtech.api.interfaces.tileentity.IEnergyConnected; -import gregtech.api.interfaces.tileentity.IHasInventory; -import gregtech.api.interfaces.tileentity.IHasWorldObjectAndCoords; -import gregtech.api.interfaces.tileentity.ITexturedTileEntity; -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; @@ -31,27 +20,43 @@ import net.minecraft.world.Explosion; import net.minecraft.world.World; import net.minecraftforge.fluids.IFluidHandler; +import cpw.mods.fml.common.Optional; +import gregtech.api.interfaces.tileentity.IBasicEnergyContainer; +import gregtech.api.interfaces.tileentity.ICoverable; +import gregtech.api.interfaces.tileentity.IDebugableTileEntity; +import gregtech.api.interfaces.tileentity.IEnergyConnected; +import gregtech.api.interfaces.tileentity.IHasInventory; +import gregtech.api.interfaces.tileentity.IHasWorldObjectAndCoords; +import gregtech.api.interfaces.tileentity.ITexturedTileEntity; +import gregtech.api.interfaces.tileentity.ITurnable; +import gregtech.api.multitileentity.MultiTileEntityBlockInternal; +import gregtech.api.multitileentity.MultiTileEntityItemInternal; +import gregtech.api.multitileentity.MultiTileEntityRegistry; + /* * Heavily inspired by GT6 */ -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. */ +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. */ + + /** + * 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); + /** Writes Item Data to the NBT. */ NBTTagCompound writeItemNBT(NBTTagCompound aNBT); + /** Sets the Item Display Name. Use null to reset it. */ void setCustomName(String aName); @@ -60,7 +65,10 @@ public interface IMultiTileEntity /** return the internal Name of this TileEntity to be registered. */ String getTileEntityName(); - /** Called when a TileEntity of this particular Class is being registered first at any MultiTileEntity Registry. So basically one call per Class. */ + /** + * Called when a TileEntity of this particular Class is being registered first at any MultiTileEntity Registry. So + * basically one call per Class. + */ void onRegistrationFirst(MultiTileEntityRegistry aRegistry, short aID); /** Called after the TileEntity has been placed and set up. */ @@ -113,13 +121,12 @@ public interface IMultiTileEntity void setOwnerUuid(UUID uuid); /** - * Causes a general Texture update. - * Only used Client Side to mark Blocks dirty. + * Causes a general Texture update. Only used Client Side to mark Blocks dirty. */ void issueTextureUpdate(); /** - * Paintable Support + * Paintable Support */ boolean unpaint(); @@ -131,6 +138,7 @@ public interface IMultiTileEntity /** * Sets the main facing to {aSide} and update as appropriately + * * @return Whether the facing was changed */ boolean setMainFacing(byte aSide); @@ -171,8 +179,8 @@ public interface IMultiTileEntity 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); @@ -180,115 +188,107 @@ public interface IMultiTileEntity 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 */ interface IMTE_OnNeighborBlockChange extends IMultiTileEntity { + void onNeighborBlockChange(World aWorld, Block aBlock); } interface IMTE_IsProvidingWeakPower extends IMultiTileEntity { + /** Remember that it passes the opposite Side due to the way vanilla works! */ int isProvidingWeakPower(byte aOppositeSide); } interface IMTE_IsProvidingStrongPower extends IMultiTileEntity { + /** Remember that it passes the opposite Side due to the way vanilla works! */ int isProvidingStrongPower(byte aOppositeSide); } interface IMTE_ShouldCheckWeakPower extends IMultiTileEntity { + boolean shouldCheckWeakPower(byte aSide); } interface IMTE_GetWeakChanges extends IMultiTileEntity { + boolean getWeakChanges(); } interface IMTE_GetComparatorInputOverride extends IMultiTileEntity { + int getComparatorInputOverride(byte aSide); } interface IMTE_BreakBlock extends IMultiTileEntity { + /** return true to prevent the TileEntity from being removed. */ boolean breakBlock(); } interface IMTE_HasMultiBlockMachineRelevantData extends IMultiTileEntity { + /** Return true to mark this Block as a Machine Block for Multiblocks. (Triggers machine update thread) */ boolean hasMultiBlockMachineRelevantData(); } interface IMTE_GetBlockHardness extends IMultiTileEntity { + float getBlockHardness(); } interface IMTE_GetFoodValues extends IMultiTileEntity { + @Optional.Method(modid = MOD_ID_APC) squeek.applecore.api.food.FoodValues getFoodValues(MultiTileEntityItemInternal aItem, ItemStack aStack); } interface IMTE_OnlyPlaceableWhenSneaking extends IMultiTileEntity { + /** Return true to prevent placing this Block without Sneaking. */ boolean onlyPlaceableWhenSneaking(); } 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); + + /** + * 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); } 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); } interface IMTE_AddToolTips extends IMultiTileEntity { + /** Adds ToolTips to the Item. */ void addToolTips(List<String> aList, ItemStack aStack, boolean aF3_H); } interface IMTE_HasModes extends IMultiTileEntity { + byte getMode(); void setMode(byte aMode); diff --git a/src/main/java/gregtech/api/multitileentity/machine/MultiTileBasicMachine.java b/src/main/java/gregtech/api/multitileentity/machine/MultiTileBasicMachine.java index 17bf44c386..b3605d579b 100644 --- a/src/main/java/gregtech/api/multitileentity/machine/MultiTileBasicMachine.java +++ b/src/main/java/gregtech/api/multitileentity/machine/MultiTileBasicMachine.java @@ -3,8 +3,18 @@ package gregtech.api.multitileentity.machine; import static com.google.common.primitives.Ints.saturatedCast; import static gregtech.api.enums.GT_Values.emptyIconContainerArray; +import net.minecraft.block.Block; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.item.ItemStack; +import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.nbt.NBTTagList; +import net.minecraft.tileentity.TileEntity; +import net.minecraftforge.fluids.FluidStack; +import net.minecraftforge.fluids.IFluidTank; + import com.gtnewhorizons.modularui.api.forge.IItemHandlerModifiable; import com.gtnewhorizons.modularui.api.forge.ItemStackHandler; + import gregtech.api.enums.GT_Values; import gregtech.api.enums.GT_Values.NBT; import gregtech.api.enums.Textures; @@ -16,16 +26,9 @@ import gregtech.api.multitileentity.base.BaseTickableMultiTileEntity; import gregtech.api.render.TextureFactory; import gregtech.api.util.GT_Util; import gregtech.api.util.GT_Utility; -import net.minecraft.block.Block; -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.item.ItemStack; -import net.minecraft.nbt.NBTTagCompound; -import net.minecraft.nbt.NBTTagList; -import net.minecraft.tileentity.TileEntity; -import net.minecraftforge.fluids.FluidStack; -import net.minecraftforge.fluids.IFluidTank; public class MultiTileBasicMachine extends BaseTickableMultiTileEntity { + private static final String TEXTURE_LOCATION = "multitileentity/machines/"; public IIconContainer[] mTexturesInactive = emptyIconContainerArray; public IIconContainer[] mTexturesActive = emptyIconContainerArray; @@ -109,10 +112,8 @@ public class MultiTileBasicMachine extends BaseTickableMultiTileEntity { // 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 < 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++) @@ -136,36 +137,33 @@ public class MultiTileBasicMachine extends BaseTickableMultiTileEntity { // Loading the registry final String textureName = aNBT.getString(NBT.TEXTURE); 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"), - new Textures.BlockIcons.CustomIcon(TEXTURE_LOCATION + textureName + "/front"), - new Textures.BlockIcons.CustomIcon(TEXTURE_LOCATION + textureName + "/right"), - new Textures.BlockIcons.CustomIcon(TEXTURE_LOCATION + textureName + "/side") - }; + new Textures.BlockIcons.CustomIcon(TEXTURE_LOCATION + textureName + "/bottom"), + new Textures.BlockIcons.CustomIcon(TEXTURE_LOCATION + textureName + "/top"), + new Textures.BlockIcons.CustomIcon(TEXTURE_LOCATION + textureName + "/left"), + new Textures.BlockIcons.CustomIcon(TEXTURE_LOCATION + textureName + "/front"), + new Textures.BlockIcons.CustomIcon(TEXTURE_LOCATION + textureName + "/right"), + new Textures.BlockIcons.CustomIcon(TEXTURE_LOCATION + textureName + "/side") }; 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"), - new Textures.BlockIcons.CustomIcon(TEXTURE_LOCATION + textureName + "/overlay/inactive/front"), - new Textures.BlockIcons.CustomIcon(TEXTURE_LOCATION + textureName + "/overlay/inactive/right"), - new Textures.BlockIcons.CustomIcon(TEXTURE_LOCATION + textureName + "/overlay/inactive/back") - }; + 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"), + new Textures.BlockIcons.CustomIcon(TEXTURE_LOCATION + textureName + "/overlay/inactive/front"), + new Textures.BlockIcons.CustomIcon(TEXTURE_LOCATION + textureName + "/overlay/inactive/right"), + new Textures.BlockIcons.CustomIcon(TEXTURE_LOCATION + textureName + "/overlay/inactive/back") }; 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"), - new Textures.BlockIcons.CustomIcon(TEXTURE_LOCATION + textureName + "/overlay/active/front"), - new Textures.BlockIcons.CustomIcon(TEXTURE_LOCATION + textureName + "/overlay/active/right"), - new Textures.BlockIcons.CustomIcon(TEXTURE_LOCATION + textureName + "/overlay/active/back") - }; + 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"), + new Textures.BlockIcons.CustomIcon(TEXTURE_LOCATION + textureName + "/overlay/active/front"), + 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()); + final TileEntity tCanonicalTileEntity = MultiTileEntityRegistry + .getCanonicalTileEntity(getMultiTileEntityRegistryID(), getMultiTileEntityID()); if (tCanonicalTileEntity instanceof MultiTileBasicMachine) { mTextures = ((MultiTileBasicMachine) tCanonicalTileEntity).mTextures; mTexturesInactive = ((MultiTileBasicMachine) tCanonicalTileEntity).mTexturesInactive; @@ -178,10 +176,9 @@ public class MultiTileBasicMachine extends BaseTickableMultiTileEntity { @Override public ITexture[] getTexture(Block aBlock, byte aSide, boolean isActive, int aRenderPass) { 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(mTextures[GT_Values.FACING_ROTATIONS[mFacing][aSide]], GT_Util.getRGBaArray(mRGBa)), + TextureFactory.of( + (mActive ? mTexturesActive : mTexturesInactive)[GT_Values.FACING_ROTATIONS[mFacing][aSide]]) }; } /* @@ -215,8 +212,7 @@ public class MultiTileBasicMachine extends BaseTickableMultiTileEntity { @Override public boolean isUseableByPlayer(EntityPlayer aPlayer) { - return playerOwnsThis(aPlayer, false) - && mTickTimer > 40 + 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); @@ -254,7 +250,7 @@ public class MultiTileBasicMachine extends BaseTickableMultiTileEntity { public IFluidTank getFluidTankFillable(byte aSide, FluidStack aFluidToFill) { if (!isLiquidInput(aSide)) return null; for (FluidTankGT tankGT : mTanksInput) if (tankGT.contains(aFluidToFill)) return tankGT; - // if (!mRecipes.containsInput(aFluidToFill, this, slot(mRecipes.mInputItemsCount + + // if (!mRecipes.containsInput(aFluidToFill, this, slot(mRecipes.mInputItemsCount + // mRecipes.mOutputItemsCount))) return null; for (FluidTankGT fluidTankGT : mTanksInput) if (fluidTankGT.isEmpty()) return fluidTankGT; return null; diff --git a/src/main/java/gregtech/api/multitileentity/multiblock/base/MultiBlockController.java b/src/main/java/gregtech/api/multitileentity/multiblock/base/MultiBlockController.java index 49f2adcd40..5c6576a392 100644 --- a/src/main/java/gregtech/api/multitileentity/multiblock/base/MultiBlockController.java +++ b/src/main/java/gregtech/api/multitileentity/multiblock/base/MultiBlockController.java @@ -4,6 +4,32 @@ import static gregtech.GT_Mod.GT_FML_LOGGER; import static gregtech.api.enums.GT_Values.ALL_VALID_SIDES; import static gregtech.api.enums.GT_Values.NBT; +import java.lang.ref.WeakReference; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.Iterator; +import java.util.LinkedHashMap; +import java.util.LinkedList; +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.world.World; +import net.minecraftforge.common.util.ForgeDirection; +import net.minecraftforge.fluids.Fluid; +import net.minecraftforge.fluids.FluidStack; +import net.minecraftforge.fluids.FluidTankInfo; +import net.minecraftforge.fluids.IFluidTank; + +import org.apache.commons.lang3.tuple.ImmutablePair; +import org.apache.commons.lang3.tuple.Pair; +import org.lwjgl.input.Keyboard; + import com.gtnewhorizon.structurelib.StructureLibAPI; import com.gtnewhorizon.structurelib.alignment.IAlignment; import com.gtnewhorizon.structurelib.alignment.IAlignmentLimits; @@ -27,6 +53,7 @@ import com.gtnewhorizons.modularui.common.widget.Scrollable; import com.gtnewhorizons.modularui.common.widget.SlotWidget; import com.gtnewhorizons.modularui.common.widget.TabButton; import com.gtnewhorizons.modularui.common.widget.TabContainer; + import cpw.mods.fml.common.network.NetworkRegistry; import gnu.trove.list.TIntList; import gnu.trove.list.array.TIntArrayList; @@ -48,39 +75,11 @@ 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.lang.ref.WeakReference; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.Iterator; -import java.util.LinkedHashMap; -import java.util.LinkedList; -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.world.World; -import net.minecraftforge.common.util.ForgeDirection; -import net.minecraftforge.fluids.Fluid; -import net.minecraftforge.fluids.FluidStack; -import net.minecraftforge.fluids.FluidTankInfo; -import net.minecraftforge.fluids.IFluidTank; -import org.apache.commons.lang3.tuple.ImmutablePair; -import org.apache.commons.lang3.tuple.Pair; -import org.lwjgl.input.Keyboard; 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(); @@ -95,7 +94,7 @@ public abstract class MultiBlockController<T extends MultiBlockController<T>> ex private IAlignmentLimits mLimits = getInitialAlignmentLimits(); // A list of sides - // Each side has a list of parts that have a cover that need to be ticked + // Each side has a list of parts that have a cover that need to be ticked protected List<LinkedList<WeakReference<IMultiBlockPart>>> registeredCoveredParts = Arrays.asList( new LinkedList<>(), new LinkedList<>(), @@ -106,6 +105,7 @@ public abstract class MultiBlockController<T extends MultiBlockController<T>> ex /** Registry ID of the required casing */ public abstract short getCasingRegistryID(); + /** Meta ID of the required casing */ public abstract short getCasingMeta(); @@ -120,9 +120,9 @@ public abstract class MultiBlockController<T extends MultiBlockController<T>> ex public abstract Vec3Impl getStartingStructureOffset(); /** - * 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. + * 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(); @@ -151,7 +151,7 @@ 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 + // 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 (mInputInventory != null) multiBlockInputInventory.put("controller", mInputInventory); @@ -217,53 +217,47 @@ public abstract class MultiBlockController<T extends MultiBlockController<T>> ex * <p> * Imagine you stand in front of the controller, with controller facing towards you not rotated or flipped. * <p> - * 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. + * 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. * <p> * 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") @@ -287,7 +281,11 @@ public abstract class MultiBlockController<T extends MultiBlockController<T>> ex StructureLibAPI.sendAlignment( this, new NetworkRegistry.TargetPoint( - getWorld().provider.dimensionId, getXCoord(), getYCoord(), getZCoord(), 512)); + getWorld().provider.dimensionId, + getXCoord(), + getYCoord(), + getZCoord(), + 512)); } else { issueTextureUpdate(); } @@ -295,8 +293,8 @@ 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()) { @@ -486,6 +484,7 @@ public abstract class MultiBlockController<T extends MultiBlockController<T>> ex } public static class BuildState { + /** * Utility class to keep track of the build state of a multiblock */ @@ -535,7 +534,8 @@ 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 @@ -559,22 +559,22 @@ 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 (byte i : ALL_VALID_SIDES) { - // mIcons[i] = aCasing.getIcon(i, aMeta); - // } + // Arrays.fill(mIcons, getTexture(aCasing); + // for (byte i : ALL_VALID_SIDES) { + // 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); + final MultiTileEntityContainer tContainer = tRegistry + .getNewTileEntityContainer(world, x, y, z, aBlockMeta, null); if (tContainer == null) { GT_FML_LOGGER.error("NULL CONTAINER"); return false; @@ -627,10 +627,10 @@ public abstract class MultiBlockController<T extends MultiBlockController<T>> ex 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 + if (tTank == null || tTank.getFluid() == null || tTank.getFluidAmount() == 0 - || !tTank.getFluid().isFluidEqual(aFluid)) return null; + || !tTank.getFluid().isFluidEqual(aFluid)) + return null; final FluidStack rDrained = tTank.drain(aFluid.amount, aDoDrain); if (rDrained != null && aDoDrain) markInventoryBeenModified(); return rDrained; @@ -873,14 +873,14 @@ public abstract class MultiBlockController<T extends MultiBlockController<T>> ex if (tInv == null) return false; final int tSlot = tInv.getRight(); - final IItemHandlerModifiable inv = tInv.getLeft(); - ; + final IItemHandlerModifiable inv = tInv.getLeft();; - return inv.getStackInSlot(tSlot) == null - || GT_Utility.areStacksEqual( - aStack, - inv.getStackInSlot( - tSlot)); // && allowPutStack(getBaseMetaTileEntity(), aIndex, (byte) aSide, aStack) + return inv.getStackInSlot(tSlot) == null || GT_Utility.areStacksEqual(aStack, inv.getStackInSlot(tSlot)); // && + // allowPutStack(getBaseMetaTileEntity(), + // aIndex, + // (byte) + // aSide, + // aStack) } @Override @@ -889,11 +889,10 @@ public abstract class MultiBlockController<T extends MultiBlockController<T>> ex if (tInv == null) return false; final int tSlot = tInv.getRight(); - final IItemHandlerModifiable inv = tInv.getLeft(); - ; + final IItemHandlerModifiable inv = tInv.getLeft();; - return inv.getStackInSlot(tSlot) - != null; // && allowPullStack(getBaseMetaTileEntity(), aIndex, (byte) aSide, aStack); + return inv.getStackInSlot(tSlot) != null; // && allowPullStack(getBaseMetaTileEntity(), aIndex, (byte) aSide, + // aStack); } @Override @@ -1054,76 +1053,81 @@ public abstract class MultiBlockController<T extends MultiBlockController<T>> ex @Override public void addGregTechLogo(ModularWindow.Builder builder) { - builder.widget(new DrawableWidget() - .setDrawable(getGUITextureSet().getGregTechLogo()) - .setSize(17, 17) - .setPos(148, 60)); + builder.widget( + new DrawableWidget().setDrawable(getGUITextureSet().getGregTechLogo()).setSize(17, 17).setPos(148, 60)); } @Override public void addUIWidgets(ModularWindow.Builder builder, UIBuildContext buildContext) { - builder.widget(new TabContainer() - .setButtonSize(20, 24) - .addTabButton(new TabButton(0) - .setBackground( - false, ModularUITextures.VANILLA_TAB_TOP_START.getSubArea(0, 0, 1f, 0.5f)) - .setBackground( - true, ModularUITextures.VANILLA_TAB_TOP_START.getSubArea(0, 0.5f, 1f, 1f)) - .addTooltip(getLocalName()) - .setPos(0, -20)) - .addTabButton(new TabButton(1) - .setBackground( - false, ModularUITextures.VANILLA_TAB_TOP_START.getSubArea(0, 0, 1f, 0.5f)) - .setBackground( - true, ModularUITextures.VANILLA_TAB_TOP_START.getSubArea(0, 0.5f, 1f, 1f)) - .setPos(20, -20)) - .addTabButton(new TabButton(2) - .setBackground( - false, ModularUITextures.VANILLA_TAB_TOP_START.getSubArea(0, 0, 1f, 0.5f)) - .setBackground( - true, ModularUITextures.VANILLA_TAB_TOP_START.getSubArea(0, 0.5f, 1f, 1f)) - .setPos(40, -20)) - .addTabButton(new TabButton(3) - .setBackground( - false, ModularUITextures.VANILLA_TAB_TOP_START.getSubArea(0, 0, 1f, 0.5f)) - .setBackground( - true, ModularUITextures.VANILLA_TAB_TOP_START.getSubArea(0, 0.5f, 1f, 1f)) - .setPos(60, -20)) - .addTabButton(new TabButton(4) - .setBackground( - false, ModularUITextures.VANILLA_TAB_TOP_START.getSubArea(0, 0, 1f, 0.5f)) - .setBackground( - true, ModularUITextures.VANILLA_TAB_TOP_START.getSubArea(0, 0.5f, 1f, 1f)) - .setPos(80, -20)) - .addPage(new MultiChildWidget() - .addChild(new DrawableWidget() - .setDrawable(GT_UITextures.PICTURE_SCREEN_BLACK) - .setPos(7, 4) - .setSize(160, 75))) + builder.widget( + new TabContainer() + .setButtonSize( + 20, + 24) + .addTabButton( + new TabButton(0) + .setBackground( + false, + ModularUITextures.VANILLA_TAB_TOP_START.getSubArea(0, 0, 1f, 0.5f)) + .setBackground( + true, + ModularUITextures.VANILLA_TAB_TOP_START.getSubArea(0, 0.5f, 1f, 1f)) + .addTooltip(getLocalName()).setPos(0, -20)) + .addTabButton( + new TabButton(1) + .setBackground( + false, + ModularUITextures.VANILLA_TAB_TOP_START.getSubArea(0, 0, 1f, 0.5f)) + .setBackground( + true, + ModularUITextures.VANILLA_TAB_TOP_START.getSubArea(0, 0.5f, 1f, 1f)) + .setPos(20, -20)) + .addTabButton( + new TabButton(2) + .setBackground( + false, + ModularUITextures.VANILLA_TAB_TOP_START.getSubArea(0, 0, 1f, 0.5f)) + .setBackground( + true, + ModularUITextures.VANILLA_TAB_TOP_START.getSubArea(0, 0.5f, 1f, 1f)) + .setPos(40, -20)) + .addTabButton( + new TabButton(3) + .setBackground( + false, + ModularUITextures.VANILLA_TAB_TOP_START.getSubArea(0, 0, 1f, 0.5f)) + .setBackground( + true, + ModularUITextures.VANILLA_TAB_TOP_START.getSubArea(0, 0.5f, 1f, 1f)) + .setPos(60, -20)) + .addTabButton( + new TabButton(4) + .setBackground( + false, + ModularUITextures.VANILLA_TAB_TOP_START.getSubArea(0, 0, 1f, 0.5f)) + .setBackground( + true, + ModularUITextures.VANILLA_TAB_TOP_START.getSubArea(0, 0.5f, 1f, 1f)) + .setPos(80, -20)) + .addPage( + new MultiChildWidget().addChild( + new DrawableWidget().setDrawable(GT_UITextures.PICTURE_SCREEN_BLACK) + .setPos(7, 4).setSize(160, 75))) .addPage(new MultiChildWidget().addChild(getItemInventoryInputGUI())) .addPage(new MultiChildWidget().addChild(getItemInventoryOutputGUI())) .addPage(new MultiChildWidget().addChild(getFluidInventoryInputGUI())) .addPage(new MultiChildWidget().addChild(getFluidInventoryOutputGUI()))) - .widget(new ItemDrawable(getStackForm(1)) - .asWidget() - .setSize(16, 16) - .setPos(2, -16)) - .widget(new DrawableWidget() - .setDrawable(GT_UITextures.PICTURE_ITEM_IN) - .setSize(16, 16) - .setPos(22, -16)) - .widget(new DrawableWidget() - .setDrawable(GT_UITextures.PICTURE_ITEM_OUT) - .setSize(16, 16) - .setPos(42, -16)) - .widget(new DrawableWidget() - .setDrawable(GT_UITextures.PICTURE_FLUID_IN) - .setSize(16, 16) - .setPos(62, -16)) - .widget(new DrawableWidget() - .setDrawable(GT_UITextures.PICTURE_FLUID_OUT) - .setSize(16, 16) - .setPos(82, -16)); + .widget(new ItemDrawable(getStackForm(1)).asWidget().setSize(16, 16).setPos(2, -16)) + .widget(new DrawableWidget().setDrawable(GT_UITextures.PICTURE_ITEM_IN).setSize(16, 16).setPos(22, -16)) + .widget( + new DrawableWidget().setDrawable(GT_UITextures.PICTURE_ITEM_OUT).setSize(16, 16) + .setPos(42, -16)) + .widget( + new DrawableWidget().setDrawable(GT_UITextures.PICTURE_FLUID_IN).setSize(16, 16) + .setPos(62, -16)) + .widget( + new DrawableWidget().setDrawable(GT_UITextures.PICTURE_FLUID_OUT).setSize(16, 16) + .setPos(82, -16)); } protected Widget getItemInventoryInputGUI() { @@ -1132,9 +1136,8 @@ public abstract class MultiBlockController<T extends MultiBlockController<T>> ex for (int rows = 0; rows * 4 < Math.min(inv.getSlots(), 128); rows++) { final int columnsToMake = Math.min(Math.min(inv.getSlots(), 128) - rows * 4, 4); for (int column = 0; column < columnsToMake; column++) { - scrollable.widget(new SlotWidget(inv, rows * 4 + column) - .setPos(column * 18, rows * 18) - .setSize(18, 18)); + scrollable + .widget(new SlotWidget(inv, rows * 4 + column).setPos(column * 18, rows * 18).setSize(18, 18)); } } return scrollable.setSize(18 * 4 + 4, 18 * 4).setPos(52, 7); @@ -1146,9 +1149,8 @@ public abstract class MultiBlockController<T extends MultiBlockController<T>> ex for (int rows = 0; rows * 4 < Math.min(inv.getSlots(), 128); rows++) { final int columnsToMake = Math.min(Math.min(inv.getSlots(), 128) - rows * 4, 4); for (int column = 0; column < columnsToMake; column++) { - scrollable.widget(new SlotWidget(inv, rows * 4 + column) - .setPos(column * 18, rows * 18) - .setSize(18, 18)); + scrollable + .widget(new SlotWidget(inv, rows * 4 + column).setPos(column * 18, rows * 18).setSize(18, 18)); } } return scrollable.setSize(18 * 4 + 4, 18 * 4).setPos(52, 7); 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 36fbf35961..43522dcf02 100644 --- a/src/main/java/gregtech/api/multitileentity/multiblock/base/MultiBlockPart.java +++ b/src/main/java/gregtech/api/multitileentity/multiblock/base/MultiBlockPart.java @@ -15,6 +15,27 @@ 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 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; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.entity.player.EntityPlayerMP; +import net.minecraft.item.ItemStack; +import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.tileentity.TileEntity; +import net.minecraft.util.ChunkCoordinates; +import net.minecraftforge.common.util.ForgeDirection; +import net.minecraftforge.fluids.Fluid; +import net.minecraftforge.fluids.FluidStack; +import net.minecraftforge.fluids.FluidTankInfo; +import net.minecraftforge.fluids.IFluidTank; + import com.gtnewhorizons.modularui.api.forge.IItemHandlerModifiable; import com.gtnewhorizons.modularui.api.screen.ModularWindow; import com.gtnewhorizons.modularui.api.screen.ModularWindow.Builder; @@ -24,6 +45,7 @@ import com.gtnewhorizons.modularui.common.widget.DropDownWidget; import com.gtnewhorizons.modularui.common.widget.FluidSlotWidget; import com.gtnewhorizons.modularui.common.widget.Scrollable; import com.gtnewhorizons.modularui.common.widget.SlotWidget; + import gregtech.api.enums.GT_Values; import gregtech.api.enums.Textures; import gregtech.api.interfaces.IIconContainer; @@ -37,37 +59,15 @@ import gregtech.api.multitileentity.interfaces.IMultiTileEntity.IMTE_HasModes; import gregtech.api.render.TextureFactory; import gregtech.api.util.GT_Utility; import gregtech.common.covers.CoverInfo; -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; -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.entity.player.EntityPlayerMP; -import net.minecraft.item.ItemStack; -import net.minecraft.nbt.NBTTagCompound; -import net.minecraft.tileentity.TileEntity; -import net.minecraft.util.ChunkCoordinates; -import net.minecraftforge.common.util.ForgeDirection; -import net.minecraftforge.fluids.Fluid; -import net.minecraftforge.fluids.FluidStack; -import net.minecraftforge.fluids.FluidTankInfo; -import net.minecraftforge.fluids.IFluidTank; public class MultiBlockPart extends BaseNontickableMultiTileEntity implements IMultiBlockPart, IMTE_BreakBlock, IMTE_HasModes { - 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)); + 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 ChunkCoordinates mTargetPos = null; protected IMultiBlockController mTarget = null; @@ -79,8 +79,8 @@ public class MultiBlockPart extends BaseNontickableMultiTileEntity protected int mLockedInventoryIndex = 0; /** - * What Part Tier is this part? All Basic Casings are Tier 1, and will allow: - * Energy, Item, Fluid input/output. Some of the more advanced modes can be set to require a higher tier part. + * What Part Tier is this part? All Basic Casings are Tier 1, and will allow: Energy, Item, Fluid input/output. Some + * of the more advanced modes can be set to require a higher tier part. */ public int getPartTier() { return 1; @@ -109,8 +109,8 @@ public class MultiBlockPart extends BaseNontickableMultiTileEntity } @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))); } @@ -180,7 +180,9 @@ public class MultiBlockPart extends BaseNontickableMultiTileEntity 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)); + aNBT.getInteger(NBT.TARGET_X), + aNBT.getShort(NBT.TARGET_Y), + aNBT.getInteger(NBT.TARGET_Z)); } if (aNBT.hasKey(NBT.LOCKED_INVENTORY)) { mLockedInventory = aNBT.getString(NBT.LOCKED_INVENTORY); @@ -284,20 +286,21 @@ public class MultiBlockPart extends BaseNontickableMultiTileEntity // 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()); + final TileEntity tCanonicalTileEntity = MultiTileEntityRegistry + .getCanonicalTileEntity(getMultiTileEntityRegistryID(), getMultiTileEntityID()); if (tCanonicalTileEntity instanceof MultiBlockPart) mTextures = ((MultiBlockPart) tCanonicalTileEntity).mTextures; } @@ -308,26 +311,20 @@ public class MultiBlockPart extends BaseNontickableMultiTileEntity // 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(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)}; + 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, TextureFactory.of(OVERLAY_ENERGY_OUT_MULTI) }; } - return new ITexture[] {baseTexture}; + return new ITexture[] { baseTexture }; } @Override @@ -365,8 +362,8 @@ public class MultiBlockPart extends BaseNontickableMultiTileEntity } @Override - 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) { if (mAllowedModes == NOTHING) return true; mMode = getNextAllowedMode(BASIC_MODES); @@ -389,8 +386,8 @@ public class MultiBlockPart extends BaseNontickableMultiTileEntity } /** - * TODO: Make sure the energy/item/fluid hatch is facing that way! or has that mode enabled on that side - * Check SIDE_UNKNOWN for or coverbehavior + * TODO: Make sure the energy/item/fluid hatch is facing that way! or has that mode enabled on that side Check + * SIDE_UNKNOWN for or coverbehavior */ /** @@ -534,8 +531,7 @@ public class MultiBlockPart extends BaseNontickableMultiTileEntity public boolean decreaseStoredEnergyUnits(long aEnergy, boolean aIgnoreTooLittleEnergy) { if (!modeSelected(ENERGY_OUT)) return false; final IMultiBlockController controller = getTarget(true); - return controller != null - && hasMode(ENERGY_OUT) + return controller != null && hasMode(ENERGY_OUT) && controller.decreaseStoredEnergyUnits(this, aEnergy, aIgnoreTooLittleEnergy); } @@ -543,8 +539,7 @@ public class MultiBlockPart extends BaseNontickableMultiTileEntity public boolean increaseStoredEnergyUnits(long aEnergy, boolean aIgnoreTooMuchEnergy) { if (!modeSelected(ENERGY_IN)) return false; final IMultiBlockController controller = getTarget(true); - return controller != null - && hasMode(ENERGY_IN) + return controller != null && hasMode(ENERGY_IN) && controller.increaseStoredEnergyUnits(this, aEnergy, aIgnoreTooMuchEnergy); } @@ -753,14 +748,14 @@ public class MultiBlockPart extends BaseNontickableMultiTileEntity for (int rows = 0; rows * 4 < Math.min(inv.getSlots(), 128); rows++) { int columnsToMake = Math.min(Math.min(inv.getSlots(), 128) - rows * 4, 4); for (int column = 0; column < columnsToMake; column++) { - scrollable.widget(new SlotWidget(inv, rows * 4 + column) - .setPos(column * 18, rows * 18) - .setSize(18, 18)); + scrollable + .widget(new SlotWidget(inv, rows * 4 + column).setPos(column * 18, rows * 18).setSize(18, 18)); } } builder.widget(scrollable.setSize(18 * 4 + 4, 18 * 4).setPos(52, 18)); DropDownWidget dropDown = new DropDownWidget(); - builder.widget(dropDown.addDropDownItemsSimple( + builder.widget( + dropDown.addDropDownItemsSimple( controller.getInventoryNames(this), (buttonWidget, index, label, setSelected) -> buttonWidget.setOnClick((clickData, widget) -> { if (getNameOfInventoryFromIndex(controller, index).equals("all")) { @@ -772,12 +767,8 @@ public class MultiBlockPart extends BaseNontickableMultiTileEntity } setSelected.run(); }), - true) - .setSelected(mLockedInventoryIndex) - .setExpandedMaxHeight(60) - .setDirection(DropDownWidget.Direction.DOWN) - .setPos(53, 5) - .setSize(70, 11)); + true).setSelected(mLockedInventoryIndex).setExpandedMaxHeight(60) + .setDirection(DropDownWidget.Direction.DOWN).setPos(53, 5).setSize(70, 11)); } protected String getNameOfInventoryFromIndex(final IMultiBlockController controller, int index) { @@ -838,10 +829,9 @@ public class MultiBlockPart extends BaseNontickableMultiTileEntity @Override public void addGregTechLogo(Builder builder) { if (modeSelected(ITEM_IN, ITEM_OUT)) { - builder.widget(new DrawableWidget() - .setDrawable(getGUITextureSet().getGregTechLogo()) - .setSize(17, 17) - .setPos(152, 74)); + builder.widget( + new DrawableWidget().setDrawable(getGUITextureSet().getGregTechLogo()).setSize(17, 17) + .setPos(152, 74)); } else { super.addGregTechLogo(builder); } 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 92931bc4db..9dfd4c0cc6 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,9 +1,11 @@ package gregtech.api.multitileentity.multiblock.base; -import com.gtnewhorizon.structurelib.util.Vec3Impl; import net.minecraft.item.ItemStack; +import com.gtnewhorizon.structurelib.util.Vec3Impl; + public abstract class MultiBlock_Stackable<T extends MultiBlock_Stackable<T>> extends MultiBlockController<T> { + protected static String STACKABLE_TOP = "STACKABLE_TOP"; protected static String STACKABLE_MIDDLE = "STACKABLE_MIDDLE"; protected static String STACKABLE_BOTTOM = "STACKABLE_BOTTOM"; @@ -31,6 +33,7 @@ public abstract class MultiBlock_Stackable<T extends MultiBlock_Stackable<T>> ex buildState.stopBuilding(); } } + /** * Stackable * @@ -62,7 +65,7 @@ public abstract class MultiBlock_Stackable<T extends MultiBlock_Stackable<T>> ex /** * Stackable * - * @return Whether this structure has a Top/Cap. Defaults to true. + * @return Whether this structure has a Top/Cap. Defaults to true. */ public boolean hasTop() { return true; 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 b4b69e0b21..9f0d9bd2d1 100644 --- a/src/main/java/gregtech/api/multitileentity/multiblock/casing/CasingBehaviorBase.java +++ b/src/main/java/gregtech/api/multitileentity/multiblock/casing/CasingBehaviorBase.java @@ -1,16 +1,10 @@ package gregtech.api.multitileentity.multiblock.casing; /** - * Allows for functional casings that influence the multiblock structure's behavior - * Examples include: - * - Extra Byproducts - * - Extra Speed - * - More parallels - * - Upgraded internal item/energy/fluid storage - * - Faster output - * - Voiding/Anti-Voiding upgrade - * - Ender Upgrades - * - etc, etc. + * Allows for functional casings that influence the multiblock structure's behavior Examples include: - Extra Byproducts + * - Extra Speed - More parallels - Upgraded internal item/energy/fluid storage - Faster output - Voiding/Anti-Voiding + * upgrade - Ender Upgrades - etc, etc. * */ -public class CasingBehaviorBase {} +public class CasingBehaviorBase { +} diff --git a/src/main/java/gregtech/api/net/GT_Packet.java b/src/main/java/gregtech/api/net/GT_Packet.java index 48cc171d61..fe2ac22ed3 100644 --- a/src/main/java/gregtech/api/net/GT_Packet.java +++ b/src/main/java/gregtech/api/net/GT_Packet.java @@ -1,15 +1,17 @@ package gregtech.api.net; -import com.google.common.io.ByteArrayDataInput; -import io.netty.buffer.ByteBuf; import net.minecraft.network.INetHandler; import net.minecraft.world.IBlockAccess; +import com.google.common.io.ByteArrayDataInput; +import io.netty.buffer.ByteBuf; + /** * @deprecated Use {@link GT_Packet_New} instead */ @Deprecated public abstract class GT_Packet { + public GT_Packet(boolean aIsReference) { // } @@ -29,8 +31,8 @@ public abstract class GT_Packet { public abstract byte[] encode(); /** - * Encode the data into given byte buffer without creating an intermediate byte array. - * Default implementation just throw {@link UnsupportedOperationException}. + * Encode the data into given byte buffer without creating an intermediate byte array. Default implementation just + * throw {@link UnsupportedOperationException}. */ public void encode(ByteBuf aOut) { throw new UnsupportedOperationException(); @@ -49,7 +51,8 @@ public abstract class GT_Packet { public abstract void process(IBlockAccess aWorld); /** - * This will be called just before {@link #process(IBlockAccess)} to inform the handler about the source and type of connection + * This will be called just before {@link #process(IBlockAccess)} to inform the handler about the source and type of + * connection */ public void setINetHandler(INetHandler aHandler) {} } 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 ebc69cd540..74876ef2bc 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 @@ -1,14 +1,16 @@ package gregtech.api.net; -import com.google.common.io.ByteArrayDataInput; -import io.netty.buffer.ByteBuf; import net.minecraft.tileentity.TileEntity; import net.minecraft.world.IBlockAccess; +import com.google.common.io.ByteArrayDataInput; +import io.netty.buffer.ByteBuf; + /** * Used to transfer Block Events in a much better fashion */ public class GT_Packet_Block_Event extends GT_Packet_New { + private int mX, mZ; private short mY; private byte mID, mValue; @@ -38,7 +40,11 @@ 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()); + 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 f692a4c88a..7322339167 100644 --- a/src/main/java/gregtech/api/net/GT_Packet_ClientPreference.java +++ b/src/main/java/gregtech/api/net/GT_Packet_ClientPreference.java @@ -1,15 +1,18 @@ package gregtech.api.net; -import com.google.common.io.ByteArrayDataInput; -import gregtech.GT_Mod; -import gregtech.api.util.GT_ClientPreference; -import io.netty.buffer.ByteBuf; import net.minecraft.entity.player.EntityPlayerMP; import net.minecraft.network.INetHandler; import net.minecraft.network.NetHandlerPlayServer; import net.minecraft.world.IBlockAccess; +import com.google.common.io.ByteArrayDataInput; + +import gregtech.GT_Mod; +import gregtech.api.util.GT_ClientPreference; +import io.netty.buffer.ByteBuf; + public class GT_Packet_ClientPreference extends GT_Packet_New { + private GT_ClientPreference mPreference; private EntityPlayerMP mPlayer; 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 e2df15cb33..dbc72042a3 100644 --- a/src/main/java/gregtech/api/net/GT_Packet_GtTileEntityGuiRequest.java +++ b/src/main/java/gregtech/api/net/GT_Packet_GtTileEntityGuiRequest.java @@ -1,17 +1,19 @@ package gregtech.api.net; +import net.minecraft.entity.player.EntityPlayerMP; +import net.minecraft.tileentity.TileEntity; +import net.minecraft.world.IBlockAccess; +import net.minecraft.world.World; +import net.minecraftforge.common.DimensionManager; + import com.google.common.io.ByteArrayDataInput; + import gregtech.api.enums.GT_Values; import gregtech.api.gui.modularui.GT_UIInfos; import gregtech.api.metatileentity.BaseTileEntity; import gregtech.api.metatileentity.CoverableTileEntity; import gregtech.common.GT_Proxy; import io.netty.buffer.ByteBuf; -import net.minecraft.entity.player.EntityPlayerMP; -import net.minecraft.tileentity.TileEntity; -import net.minecraft.world.IBlockAccess; -import net.minecraft.world.World; -import net.minecraftforge.common.DimensionManager; /** * Client -> Server: Request that the server opens a Gregtech GUI for us after providing us with the required data. @@ -31,8 +33,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; @@ -90,11 +92,11 @@ public class GT_Packet_GtTileEntityGuiRequest extends GT_Packet_New { final BaseTileEntity baseTile = ((BaseTileEntity) tile); final EntityPlayerMP player = (EntityPlayerMP) world.getEntityByID(playerId); - final CoverableTileEntity coverableTile = - (baseTile instanceof CoverableTileEntity) ? (CoverableTileEntity) baseTile : null; - // 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 + final CoverableTileEntity coverableTile = (baseTile instanceof CoverableTileEntity) + ? (CoverableTileEntity) baseTile + : null; + // 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 && coverableTile != null) { final byte coverSide = (byte) (guiId - GT_Proxy.GUI_ID_COVER_SIDE_BASE); final GT_Packet_TileEntityCoverGUI packet = new GT_Packet_TileEntityCoverGUI( diff --git a/src/main/java/gregtech/api/net/GT_Packet_MultiTileEntity.java b/src/main/java/gregtech/api/net/GT_Packet_MultiTileEntity.java index 5263549264..9f83cc4eda 100644 --- a/src/main/java/gregtech/api/net/GT_Packet_MultiTileEntity.java +++ b/src/main/java/gregtech/api/net/GT_Packet_MultiTileEntity.java @@ -2,19 +2,22 @@ package gregtech.api.net; import static gregtech.api.enums.GT_Values.B; +import net.minecraft.block.Block; +import net.minecraft.tileentity.TileEntity; +import net.minecraft.util.ChunkCoordinates; +import net.minecraft.world.IBlockAccess; + import com.google.common.io.ByteArrayDataInput; + import gregtech.GT_Mod; import gregtech.api.metatileentity.GregTechTileClientEvents; import gregtech.api.multitileentity.MultiTileEntityBlock; import gregtech.api.multitileentity.interfaces.IMultiBlockPart; import gregtech.api.multitileentity.interfaces.IMultiTileEntity; import io.netty.buffer.ByteBuf; -import net.minecraft.block.Block; -import net.minecraft.tileentity.TileEntity; -import net.minecraft.util.ChunkCoordinates; -import net.minecraft.world.IBlockAccess; public class GT_Packet_MultiTileEntity extends GT_Packet_New { + public static final int COVERS = B[0], REDSTONE = B[1], MODES = B[2], CONTROLLER = B[3]; private int features = 0; @@ -34,8 +37,8 @@ public class GT_Packet_MultiTileEntity extends GT_Packet_New { } // For multi tiles - public GT_Packet_MultiTileEntity( - int aFeatures, int aX, short aY, int aZ, short aRID, short aID, byte aCommonData, byte aColor) { + public GT_Packet_MultiTileEntity(int aFeatures, int aX, short aY, int aZ, short aRID, short aID, byte aCommonData, + byte aColor) { super(false); features = aFeatures; @@ -189,7 +192,11 @@ public class GT_Packet_MultiTileEntity extends GT_Packet_New { } } catch (Exception e) { GT_Mod.GT_FML_LOGGER.error( - "Exception setting tile entity data for tile entity {} at ({}, {}, {})", tTileEntity, mX, mY, mZ); + "Exception setting tile entity data for tile entity {} at ({}, {}, {})", + tTileEntity, + mX, + mY, + mZ); } } 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 f987ebe24b..41eb1740b3 100644 --- a/src/main/java/gregtech/api/net/GT_Packet_New.java +++ b/src/main/java/gregtech/api/net/GT_Packet_New.java @@ -1,11 +1,13 @@ package gregtech.api.net; import com.google.common.io.ByteArrayDataInput; + 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); } 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 b79ce20e39..b095dd6238 100644 --- a/src/main/java/gregtech/api/net/GT_Packet_Pollution.java +++ b/src/main/java/gregtech/api/net/GT_Packet_Pollution.java @@ -1,12 +1,15 @@ package gregtech.api.net; +import net.minecraft.world.ChunkCoordIntPair; +import net.minecraft.world.IBlockAccess; + import com.google.common.io.ByteArrayDataInput; + import gregtech.common.GT_Client; import io.netty.buffer.ByteBuf; -import net.minecraft.world.ChunkCoordIntPair; -import net.minecraft.world.IBlockAccess; public class GT_Packet_Pollution extends GT_Packet_New { + private ChunkCoordIntPair chunk; private int pollution; 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 c330514144..e997c8feb9 100644 --- a/src/main/java/gregtech/api/net/GT_Packet_RequestCoverData.java +++ b/src/main/java/gregtech/api/net/GT_Packet_RequestCoverData.java @@ -1,10 +1,5 @@ package gregtech.api.net; -import com.google.common.io.ByteArrayDataInput; -import gregtech.api.interfaces.tileentity.ICoverable; -import gregtech.api.metatileentity.CoverableTileEntity; -import gregtech.common.covers.CoverInfo; -import io.netty.buffer.ByteBuf; import net.minecraft.entity.player.EntityPlayerMP; import net.minecraft.network.INetHandler; import net.minecraft.network.NetHandlerPlayServer; @@ -13,10 +8,18 @@ import net.minecraft.world.IBlockAccess; import net.minecraft.world.World; import net.minecraftforge.common.DimensionManager; +import com.google.common.io.ByteArrayDataInput; + +import gregtech.api.interfaces.tileentity.ICoverable; +import gregtech.api.metatileentity.CoverableTileEntity; +import gregtech.common.covers.CoverInfo; +import io.netty.buffer.ByteBuf; + /** * Client -> Server : ask for cover data */ public class GT_Packet_RequestCoverData extends GT_Packet_New { + protected int mX; protected short mY; protected int mZ; @@ -78,7 +81,11 @@ 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 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 86ecb8b468..66faa2c7d7 100644 --- a/src/main/java/gregtech/api/net/GT_Packet_SendCoverData.java +++ b/src/main/java/gregtech/api/net/GT_Packet_SendCoverData.java @@ -1,19 +1,22 @@ package gregtech.api.net; +import net.minecraft.tileentity.TileEntity; +import net.minecraft.world.IBlockAccess; + import com.google.common.io.ByteArrayDataInput; + import gregtech.api.GregTech_API; import gregtech.api.interfaces.tileentity.ICoverable; import gregtech.api.metatileentity.CoverableTileEntity; import gregtech.api.util.ISerializableObject; import gregtech.common.covers.CoverInfo; import io.netty.buffer.ByteBuf; -import net.minecraft.tileentity.TileEntity; -import net.minecraft.world.IBlockAccess; /** * Server -> Client : Update cover data */ public class GT_Packet_SendCoverData extends GT_Packet_New { + protected int mX; protected short mY; protected int mZ; @@ -26,8 +29,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; 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 eff095b0fc..917e0865da 100644 --- a/src/main/java/gregtech/api/net/GT_Packet_SetConfigurationCircuit.java +++ b/src/main/java/gregtech/api/net/GT_Packet_SetConfigurationCircuit.java @@ -1,6 +1,15 @@ package gregtech.api.net; +import net.minecraft.item.ItemStack; +import net.minecraft.network.INetHandler; +import net.minecraft.network.NetHandlerPlayServer; +import net.minecraft.tileentity.TileEntity; +import net.minecraft.world.IBlockAccess; +import net.minecraft.world.World; +import net.minecraftforge.common.DimensionManager; + import com.google.common.io.ByteArrayDataInput; + import cpw.mods.fml.common.network.ByteBufUtils; import gregtech.api.interfaces.IConfigurationCircuitSupport; import gregtech.api.interfaces.tileentity.IGregTechTileEntity; @@ -9,18 +18,12 @@ import gregtech.api.metatileentity.BaseTileEntity; import gregtech.api.util.GT_Utility; import gregtech.api.util.ISerializableObject; import io.netty.buffer.ByteBuf; -import net.minecraft.item.ItemStack; -import net.minecraft.network.INetHandler; -import net.minecraft.network.NetHandlerPlayServer; -import net.minecraft.tileentity.TileEntity; -import net.minecraft.world.IBlockAccess; -import net.minecraft.world.World; -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; protected int mZ; @@ -98,8 +101,7 @@ public class GT_Packet_SetConfigurationCircuit extends GT_Packet_New { final IConfigurationCircuitSupport machine = ((BaseTileEntity) tile).getConfigurationCircuitSupport(); if (machine == null) return; if (!machine.allowSelectCircuit()) return; - machine.getConfigurationCircuits().stream() - .filter(stack -> GT_Utility.areStacksEqual(stack, circuit)) + machine.getConfigurationCircuits().stream().filter(stack -> GT_Utility.areStacksEqual(stack, circuit)) .findFirst() .ifPresent(stack -> ((IHasInventory) tile).setInventorySlotContents(machine.getCircuitSlot(), stack)); } diff --git a/src/main/java/gregtech/api/net/GT_Packet_SetLockedFluid.java b/src/main/java/gregtech/api/net/GT_Packet_SetLockedFluid.java index 9342248a7a..a96d33bda6 100644 --- a/src/main/java/gregtech/api/net/GT_Packet_SetLockedFluid.java +++ b/src/main/java/gregtech/api/net/GT_Packet_SetLockedFluid.java @@ -1,12 +1,5 @@ package gregtech.api.net; -import com.google.common.io.ByteArrayDataInput; -import gregtech.api.interfaces.metatileentity.IFluidLockable; -import gregtech.api.interfaces.metatileentity.IMetaTileEntity; -import gregtech.api.interfaces.tileentity.IGregTechTileEntity; -import gregtech.api.util.GT_LanguageManager; -import gregtech.api.util.GT_Utility; -import io.netty.buffer.ByteBuf; import net.minecraft.entity.player.EntityPlayerMP; import net.minecraft.network.INetHandler; import net.minecraft.network.NetHandlerPlayServer; @@ -17,7 +10,17 @@ import net.minecraftforge.fluids.Fluid; import net.minecraftforge.fluids.FluidRegistry; import net.minecraftforge.fluids.FluidStack; +import com.google.common.io.ByteArrayDataInput; + +import gregtech.api.interfaces.metatileentity.IFluidLockable; +import gregtech.api.interfaces.metatileentity.IMetaTileEntity; +import gregtech.api.interfaces.tileentity.IGregTechTileEntity; +import gregtech.api.util.GT_LanguageManager; +import gregtech.api.util.GT_Utility; +import io.netty.buffer.ByteBuf; + public class GT_Packet_SetLockedFluid extends GT_Packet_New { + protected int mX; protected short mY; protected int mZ; @@ -89,7 +92,9 @@ public class GT_Packet_SetLockedFluid extends GT_Packet_New { mPlayer, String.format( GT_LanguageManager.addStringLocalization( - "Interaction_DESCRIPTION_Index_151.4", "Successfully locked Fluid to %s", false), + "Interaction_DESCRIPTION_Index_151.4", + "Successfully locked Fluid to %s", + false), new FluidStack(tFluid, 1).getLocalizedName())); mteToLock.onFluidLockPacketReceived(tFluid.getName()); 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 ae779efc75..808ddc218c 100644 --- a/src/main/java/gregtech/api/net/GT_Packet_Sound.java +++ b/src/main/java/gregtech/api/net/GT_Packet_Sound.java @@ -1,15 +1,19 @@ package gregtech.api.net; +import java.io.DataOutput; +import java.io.IOException; + +import net.minecraft.world.IBlockAccess; + import com.google.common.io.ByteArrayDataInput; + import gregtech.api.util.GT_Log; import gregtech.api.util.GT_Utility; import io.netty.buffer.ByteBuf; import io.netty.buffer.ByteBufOutputStream; -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; private short mY; private String mSoundName; 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 3f1425272a..cb38ca5d32 100644 --- a/src/main/java/gregtech/api/net/GT_Packet_TileEntity.java +++ b/src/main/java/gregtech/api/net/GT_Packet_TileEntity.java @@ -1,15 +1,18 @@ package gregtech.api.net; +import net.minecraft.block.Block; +import net.minecraft.tileentity.TileEntity; +import net.minecraft.world.IBlockAccess; + import com.google.common.io.ByteArrayDataInput; + import gregtech.GT_Mod; import gregtech.api.metatileentity.BaseMetaPipeEntity; import gregtech.api.metatileentity.BaseMetaTileEntity; import io.netty.buffer.ByteBuf; -import net.minecraft.block.Block; -import net.minecraft.tileentity.TileEntity; -import net.minecraft.world.IBlockAccess; public class GT_Packet_TileEntity extends GT_Packet_New { + private int mX, mZ, mC0, mC1, mC2, mC3, mC4, mC5; private short mY, mID, mRID; private byte mTexture, mTexturePage, mUpdate, mRedstone, mColor; @@ -19,23 +22,8 @@ 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; @@ -56,22 +44,8 @@ public class GT_Packet_TileEntity extends GT_Packet_New { } // 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) { + 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, @@ -92,21 +66,8 @@ public class GT_Packet_TileEntity extends GT_Packet_New { } // 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); } @@ -164,17 +125,28 @@ public class GT_Packet_TileEntity extends GT_Packet_New { final TileEntity tTileEntity = aWorld.getTileEntity(mX, mY, mZ); try { final Block tBlock; - if (tTileEntity instanceof BaseMetaTileEntity) - ((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); + if (tTileEntity instanceof BaseMetaTileEntity) ((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); } catch (Exception e) { GT_Mod.GT_FML_LOGGER.error( - "Exception setting tile entity data for tile entity {} at ({}, {}, {})", tTileEntity, mX, mY, mZ); + "Exception setting tile entity data for tile entity {} at ({}, {}, {})", + tTileEntity, + mX, + mY, + mZ); } } 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 6989acca9e..07d99a3896 100644 --- a/src/main/java/gregtech/api/net/GT_Packet_TileEntityCover.java +++ b/src/main/java/gregtech/api/net/GT_Packet_TileEntityCover.java @@ -1,18 +1,21 @@ package gregtech.api.net; -import com.google.common.io.ByteArrayDataInput; -import gregtech.api.interfaces.tileentity.ICoverable; -import gregtech.api.interfaces.tileentity.IGregTechTileEntity; -import io.netty.buffer.ByteBuf; import net.minecraft.tileentity.TileEntity; import net.minecraft.world.IBlockAccess; import net.minecraft.world.World; import net.minecraftforge.common.DimensionManager; +import com.google.common.io.ByteArrayDataInput; + +import gregtech.api.interfaces.tileentity.ICoverable; +import gregtech.api.interfaces.tileentity.IGregTechTileEntity; +import io.netty.buffer.ByteBuf; + /** * Client -> Server: Update cover data. use this only if you are using the legacy data storage */ public class GT_Packet_TileEntityCover extends GT_Packet_New { + protected int mX; protected short mY; protected int mZ; 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 6fbaf81b53..f14e000a3b 100644 --- a/src/main/java/gregtech/api/net/GT_Packet_TileEntityCoverGUI.java +++ b/src/main/java/gregtech/api/net/GT_Packet_TileEntityCoverGUI.java @@ -1,6 +1,15 @@ package gregtech.api.net; +import net.minecraft.client.Minecraft; +import net.minecraft.client.gui.GuiScreen; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.entity.player.EntityPlayerMP; +import net.minecraft.tileentity.TileEntity; +import net.minecraft.world.IBlockAccess; +import net.minecraft.world.World; + import com.google.common.io.ByteArrayDataInput; + import gregtech.api.GregTech_API; import gregtech.api.gui.GT_GUICover; import gregtech.api.interfaces.tileentity.ICoverable; @@ -9,18 +18,12 @@ import gregtech.api.util.GT_CoverBehaviorBase; import gregtech.api.util.ISerializableObject; import gregtech.common.covers.CoverInfo; import io.netty.buffer.ByteBuf; -import net.minecraft.client.Minecraft; -import net.minecraft.client.gui.GuiScreen; -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.entity.player.EntityPlayerMP; -import net.minecraft.tileentity.TileEntity; -import net.minecraft.world.IBlockAccess; -import net.minecraft.world.World; /** * Server -> Client: Show GUI */ public class GT_Packet_TileEntityCoverGUI extends GT_Packet_New { + protected int mX; protected short mY; protected int mZ; @@ -35,8 +38,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; @@ -51,15 +54,8 @@ 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; @@ -89,16 +85,8 @@ public class GT_Packet_TileEntityCoverGUI extends GT_Packet_New { this.parentGuiId = parentGuiId; } - 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; @@ -112,8 +100,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(); @@ -143,8 +131,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(); 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 2b2338d4ce..562edc9770 100644 --- a/src/main/java/gregtech/api/net/GT_Packet_TileEntityCoverNew.java +++ b/src/main/java/gregtech/api/net/GT_Packet_TileEntityCoverNew.java @@ -1,11 +1,5 @@ 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.util.ISerializableObject; -import io.netty.buffer.ByteBuf; import net.minecraft.entity.player.EntityPlayerMP; import net.minecraft.network.INetHandler; import net.minecraft.network.NetHandlerPlayServer; @@ -14,10 +8,19 @@ import net.minecraft.world.IBlockAccess; import net.minecraft.world.World; import net.minecraftforge.common.DimensionManager; +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.util.ISerializableObject; +import io.netty.buffer.ByteBuf; + /** * Client -> Server: Update cover data */ public class GT_Packet_TileEntityCoverNew extends GT_Packet_New { + protected int mX; protected short mY; protected int mZ; @@ -32,8 +35,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; @@ -100,7 +103,7 @@ public class GT_Packet_TileEntityCoverNew extends GT_Packet_New { @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 db94051946..e8ec9be80b 100644 --- a/src/main/java/gregtech/api/net/GT_Packet_UpdateItem.java +++ b/src/main/java/gregtech/api/net/GT_Packet_UpdateItem.java @@ -1,10 +1,5 @@ package gregtech.api.net; -import com.google.common.io.ByteArrayDataInput; -import cpw.mods.fml.common.network.ByteBufUtils; -import gregtech.api.interfaces.INetworkUpdatableItem; -import gregtech.api.util.ISerializableObject; -import io.netty.buffer.ByteBuf; import net.minecraft.entity.player.EntityPlayerMP; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; @@ -12,10 +7,18 @@ import net.minecraft.network.INetHandler; import net.minecraft.network.NetHandlerPlayServer; import net.minecraft.world.IBlockAccess; +import com.google.common.io.ByteArrayDataInput; + +import cpw.mods.fml.common.network.ByteBufUtils; +import gregtech.api.interfaces.INetworkUpdatableItem; +import gregtech.api.util.ISerializableObject; +import io.netty.buffer.ByteBuf; + /** * 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; 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 3d18c9d204..cac5405eec 100644 --- a/src/main/java/gregtech/api/net/GT_Packet_WirelessRedstoneCover.java +++ b/src/main/java/gregtech/api/net/GT_Packet_WirelessRedstoneCover.java @@ -1,9 +1,5 @@ package gregtech.api.net; -import com.google.common.io.ByteArrayDataInput; -import gregtech.api.interfaces.tileentity.ICoverable; -import gregtech.api.interfaces.tileentity.IGregTechTileEntity; -import io.netty.buffer.ByteBuf; import net.minecraft.entity.player.EntityPlayerMP; import net.minecraft.network.INetHandler; import net.minecraft.network.NetHandlerPlayServer; @@ -12,7 +8,14 @@ import net.minecraft.world.IBlockAccess; import net.minecraft.world.World; import net.minecraftforge.common.DimensionManager; +import com.google.common.io.ByteArrayDataInput; + +import gregtech.api.interfaces.tileentity.ICoverable; +import gregtech.api.interfaces.tileentity.IGregTechTileEntity; +import io.netty.buffer.ByteBuf; + public class GT_Packet_WirelessRedstoneCover extends GT_Packet_TileEntityCover { + private static final int PRIVATE_MASK = 0xFFFE0000; private static final int PUBLIC_MASK = 0x0000FFFF; private static final int CHECKBOX_MASK = 0x00010000; @@ -25,15 +28,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; @@ -85,8 +88,7 @@ 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/net/IGT_NetworkHandler.java b/src/main/java/gregtech/api/net/IGT_NetworkHandler.java index 2949ec6791..07c4a37030 100644 --- a/src/main/java/gregtech/api/net/IGT_NetworkHandler.java +++ b/src/main/java/gregtech/api/net/IGT_NetworkHandler.java @@ -1,11 +1,13 @@ package gregtech.api.net; -import cpw.mods.fml.common.network.NetworkRegistry.TargetPoint; import net.minecraft.entity.player.EntityPlayerMP; import net.minecraft.world.World; +import cpw.mods.fml.common.network.NetworkRegistry.TargetPoint; + @SuppressWarnings("deprecation") public interface IGT_NetworkHandler { + void sendToPlayer(GT_Packet aPacket, EntityPlayerMP aPlayer); void sendToAllAround(GT_Packet aPacket, TargetPoint aPosition); diff --git a/src/main/java/gregtech/api/objects/AE2DigitalChestHandler.java b/src/main/java/gregtech/api/objects/AE2DigitalChestHandler.java index 1fe4536085..3294af2fd0 100644 --- a/src/main/java/gregtech/api/objects/AE2DigitalChestHandler.java +++ b/src/main/java/gregtech/api/objects/AE2DigitalChestHandler.java @@ -1,10 +1,11 @@ package gregtech.api.objects; +import net.minecraft.tileentity.TileEntity; +import net.minecraftforge.common.util.ForgeDirection; + import cpw.mods.fml.common.Optional; import gregtech.api.metatileentity.BaseMetaTileEntity; 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", @@ -14,23 +15,16 @@ public class AE2DigitalChestHandler implements appeng.api.storage.IExternalStora @Override @Optional.Method(modid = "appliedenergistics2") - public boolean canHandle( - final TileEntity te, - final ForgeDirection d, - final appeng.api.storage.StorageChannel chan, + 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 + 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 41ca5e1e05..178ea0d5e8 100644 --- a/src/main/java/gregtech/api/objects/CollectorUtils.java +++ b/src/main/java/gregtech/api/objects/CollectorUtils.java @@ -9,20 +9,18 @@ import java.util.stream.Collector; import java.util.stream.Collectors; public class CollectorUtils { + /** - * Returns a merge function, suitable for use in - * {@link Map#merge(Object, Object, BiFunction) Map.merge()} or - * {@link Collectors#toMap(Function, Function, BinaryOperator) toMap()}, which always - * throws {@code IllegalStateException}. This can be used to enforce the - * assumption that the elements being collected are distinct. + * Returns a merge function, suitable for use in {@link Map#merge(Object, Object, BiFunction) Map.merge()} or + * {@link Collectors#toMap(Function, Function, BinaryOperator) toMap()}, which always throws + * {@code IllegalStateException}. This can be used to enforce the assumption that the elements being collected are + * distinct. * * @param <T> the type of input arguments to the merge function * @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( diff --git a/src/main/java/gregtech/api/objects/ElementStack.java b/src/main/java/gregtech/api/objects/ElementStack.java index 29f043188c..4f71c6efee 100644 --- a/src/main/java/gregtech/api/objects/ElementStack.java +++ b/src/main/java/gregtech/api/objects/ElementStack.java @@ -3,6 +3,7 @@ package gregtech.api.objects; import gregtech.api.enums.Element; public class ElementStack implements Cloneable { + public int mAmount; public Element mElement; @@ -29,11 +30,8 @@ public class ElementStack implements Cloneable { if (aObject == this) return true; 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); + if (aObject instanceof ElementStack) 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 fe6bd4a214..50eb3ebcc1 100644 --- a/src/main/java/gregtech/api/objects/GT_ArrayList.java +++ b/src/main/java/gregtech/api/objects/GT_ArrayList.java @@ -1,12 +1,14 @@ package gregtech.api.objects; -import com.google.common.collect.Collections2; import java.util.ArrayList; import java.util.Arrays; import java.util.Collection; import java.util.Objects; +import com.google.common.collect.Collections2; + public class GT_ArrayList<E> extends ArrayList<E> { + private static final long serialVersionUID = 1L; private int size_sS; @@ -22,11 +24,10 @@ public class GT_ArrayList<E> extends ArrayList<E> { mAllowNulls = aAllowNulls; if (!mAllowNulls) { size_sS = size(); - for (int i = 0; i < size_sS; i++) - if (get(i) == null) { - remove(i--); - size_sS = size(); - } + for (int i = 0; i < size_sS; i++) if (get(i) == null) { + remove(i--); + size_sS = size(); + } } } @@ -35,11 +36,10 @@ public class GT_ArrayList<E> extends ArrayList<E> { mAllowNulls = aAllowNulls; if (!mAllowNulls) { size_sS = size(); - for (int i = 0; i < size_sS; i++) - if (get(i) == null) { - remove(i--); - size_sS = size(); - } + for (int i = 0; i < size_sS; i++) if (get(i) == null) { + remove(i--); + size_sS = size(); + } } } diff --git a/src/main/java/gregtech/api/objects/GT_ChunkManager.java b/src/main/java/gregtech/api/objects/GT_ChunkManager.java index e06834fe1f..291e669741 100644 --- a/src/main/java/gregtech/api/objects/GT_ChunkManager.java +++ b/src/main/java/gregtech/api/objects/GT_ChunkManager.java @@ -1,16 +1,10 @@ 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 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; @@ -18,9 +12,19 @@ import net.minecraft.world.World; import net.minecraftforge.common.ForgeChunkManager; import net.minecraftforge.common.ForgeChunkManager.Ticket; +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; + // This class handles re-initializing chunks after a server restart public class GT_ChunkManager implements ForgeChunkManager.OrderedLoadingCallback, ForgeChunkManager.PlayerOrderedLoadingCallback { + private Map<TileEntity, Ticket> registeredTickets = new HashMap<>(); public static GT_ChunkManager instance = new GT_ChunkManager(); @@ -32,9 +36,9 @@ public class GT_ChunkManager @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 + // 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 + // 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 @@ -47,8 +51,7 @@ public class GT_ChunkManager int z = ticket.getModData().getInteger("OwnerZ"); if (y > 0) { TileEntity tile = world.getTileEntity(x, y, z); - if (tile != null - && tile instanceof IGregTechTileEntity + if (tile != null && tile instanceof IGregTechTileEntity && ((IGregTechTileEntity) tile).isAllowedToWork()) { ForgeChunkManager.forceChunk(ticket, new ChunkCoordIntPair(x >> 4, z >> 4)); if (!registeredTickets.containsKey(tile)) { @@ -67,7 +70,7 @@ public class GT_ChunkManager return validTickets; } - // Determine if player tickets should be kept. This is where a ticket list per player would be created and + // 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. @@ -83,27 +86,28 @@ public class GT_ChunkManager public static boolean requestPlayerChunkLoad(TileEntity owner, ChunkCoordIntPair chunkXZ, String player) { if (!GT_Values.enableChunkloaders) return false; if (!GT_Values.alwaysReloadChunkloaders && chunkXZ == null) return false; - if (GT_Values.debugChunkloaders && chunkXZ != null) - GT_Log.out.println( - "GT_ChunkManager: Chunk request: (" + chunkXZ.chunkXPos + ", " + chunkXZ.chunkZPos + ")"); + if (GT_Values.debugChunkloaders && chunkXZ != null) GT_Log.out + .println("GT_ChunkManager: Chunk request: (" + chunkXZ.chunkXPos + ", " + chunkXZ.chunkZPos + ")"); if (instance.registeredTickets.containsKey(owner)) { ForgeChunkManager.forceChunk(instance.registeredTickets.get(owner), chunkXZ); } else { Ticket ticket; - if (player.equals("")) - ticket = ForgeChunkManager.requestTicket( - GT_Mod.instance, owner.getWorldObj(), ForgeChunkManager.Type.NORMAL); - else - ticket = ForgeChunkManager.requestPlayerTicket( - GT_Mod.instance, player, owner.getWorldObj(), ForgeChunkManager.Type.NORMAL); + if (player.equals("")) ticket = ForgeChunkManager + .requestTicket(GT_Mod.instance, owner.getWorldObj(), ForgeChunkManager.Type.NORMAL); + else ticket = ForgeChunkManager + .requestPlayerTicket(GT_Mod.instance, player, owner.getWorldObj(), ForgeChunkManager.Type.NORMAL); if (ticket == null) { if (GT_Values.debugChunkloaders) GT_Log.out.println("GT_ChunkManager: ForgeChunkManager.requestTicket failed"); return false; } - if (GT_Values.debugChunkloaders) - GT_Log.out.println("GT_ChunkManager: ticket issued for machine at: (" + owner.xCoord + ", " - + owner.yCoord + ", " + owner.zCoord + ")"); + if (GT_Values.debugChunkloaders) 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); @@ -124,9 +128,8 @@ public class GT_ChunkManager if (!GT_Values.enableChunkloaders) return; Ticket ticket = instance.registeredTickets.get(owner); if (ticket != null) { - if (GT_Values.debugChunkloaders) - GT_Log.out.println( - "GT_ChunkManager: Chunk release: (" + chunkXZ.chunkXPos + ", " + chunkXZ.chunkZPos + ")"); + if (GT_Values.debugChunkloaders) GT_Log.out + .println("GT_ChunkManager: Chunk release: (" + chunkXZ.chunkXPos + ", " + chunkXZ.chunkZPos + ")"); ForgeChunkManager.unforceChunk(ticket, chunkXZ); } } @@ -136,11 +139,15 @@ public class GT_ChunkManager 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 + ")"); - for (ChunkCoordIntPair chunk : ticket.getChunkList()) - GT_Log.out.println( - "GT_ChunkManager: Chunk release: (" + chunk.chunkXPos + ", " + chunk.chunkZPos + ")"); + 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 + ")"); } ForgeChunkManager.releaseTicket(ticket); instance.registeredTickets.remove(owner); @@ -150,8 +157,13 @@ public class GT_ChunkManager 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 + ")"); + 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()) { diff --git a/src/main/java/gregtech/api/objects/GT_CopiedBlockTexture.java b/src/main/java/gregtech/api/objects/GT_CopiedBlockTexture.java index cfecc9d736..8ea4ce008d 100644 --- a/src/main/java/gregtech/api/objects/GT_CopiedBlockTexture.java +++ b/src/main/java/gregtech/api/objects/GT_CopiedBlockTexture.java @@ -1,14 +1,16 @@ package gregtech.api.objects; +import net.minecraft.block.Block; + 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; 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 4f5eca5b24..04659d584f 100644 --- a/src/main/java/gregtech/api/objects/GT_Cover_Default.java +++ b/src/main/java/gregtech/api/objects/GT_Cover_Default.java @@ -1,12 +1,14 @@ package gregtech.api.objects; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraftforge.fluids.Fluid; + import gregtech.api.interfaces.tileentity.ICoverable; import gregtech.api.util.GT_CoverBehavior; import gregtech.api.util.GT_Utility; -import net.minecraft.entity.player.EntityPlayer; -import net.minecraftforge.fluids.Fluid; public class GT_Cover_Default extends GT_CoverBehavior { + /** * This is the Dummy, if there is a generic Cover without behavior */ @@ -20,15 +22,8 @@ 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, 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 e0cd5aa061..58d43476ef 100644 --- a/src/main/java/gregtech/api/objects/GT_Cover_None.java +++ b/src/main/java/gregtech/api/objects/GT_Cover_None.java @@ -2,13 +2,14 @@ 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; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.ItemStack; import net.minecraftforge.fluids.Fluid; +import gregtech.api.interfaces.tileentity.ICoverable; +import gregtech.api.util.GT_CoverBehavior; +import gregtech.api.util.ISerializableObject; + public class GT_Cover_None extends GT_CoverBehavior { /** @@ -67,33 +68,26 @@ 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; } @@ -103,203 +97,154 @@ 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 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 91c5eac092..db240479de 100644 --- a/src/main/java/gregtech/api/objects/GT_Fluid.java +++ b/src/main/java/gregtech/api/objects/GT_Fluid.java @@ -2,15 +2,17 @@ package gregtech.api.objects; import static gregtech.api.enums.GT_Values.RES_PATH_BLOCK; +import net.minecraftforge.fluids.Fluid; + import gregtech.api.GregTech_API; import gregtech.api.fluid.GT_FluidFactory; -import net.minecraftforge.fluids.Fluid; /** * @deprecated use {@link GT_FluidFactory#builder} */ @Deprecated public class GT_Fluid extends Fluid implements Runnable { + public final String mTextureName; private final short[] mRGBa; @@ -23,8 +25,7 @@ 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) + 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])); } diff --git a/src/main/java/gregtech/api/objects/GT_FluidStack.java b/src/main/java/gregtech/api/objects/GT_FluidStack.java index 8f796430e5..55bbf712fa 100644 --- a/src/main/java/gregtech/api/objects/GT_FluidStack.java +++ b/src/main/java/gregtech/api/objects/GT_FluidStack.java @@ -1,22 +1,25 @@ package gregtech.api.objects; -import gregtech.api.GregTech_API; -import gregtech.api.util.GT_Log; -import gregtech.api.util.GT_Utility; 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; +import gregtech.api.GregTech_API; +import gregtech.api.util.GT_Log; +import gregtech.api.util.GT_Utility; + /** * 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; @@ -38,8 +41,7 @@ public class GT_FluidStack extends FluidStack { while (lock) { Thread.sleep(1); } - } catch (InterruptedException e) { - } + } catch (InterruptedException e) {} lock = true; for (GT_FluidStack tFluid : sAllFluidStacks) tFluid.fixFluidIDForFucksSake(); try { @@ -77,7 +79,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 01c4b00995..578d22a4a3 100644 --- a/src/main/java/gregtech/api/objects/GT_HashSet.java +++ b/src/main/java/gregtech/api/objects/GT_HashSet.java @@ -1,11 +1,14 @@ package gregtech.api.objects; -import gregtech.api.GregTech_API; -import gregtech.api.util.GT_Utility; import java.util.*; + import net.minecraft.item.ItemStack; +import gregtech.api.GregTech_API; +import gregtech.api.util.GT_Utility; + public class GT_HashSet<E extends GT_ItemStack> extends AbstractSet<E> { + private static final Object OBJECT = new Object(); private final transient HashMap<GT_ItemStack, Object> map; diff --git a/src/main/java/gregtech/api/objects/GT_ItemStack.java b/src/main/java/gregtech/api/objects/GT_ItemStack.java index a6c892c4f9..21dffd1945 100644 --- a/src/main/java/gregtech/api/objects/GT_ItemStack.java +++ b/src/main/java/gregtech/api/objects/GT_ItemStack.java @@ -1,12 +1,14 @@ package gregtech.api.objects; -import gregtech.api.enums.GT_Values; -import gregtech.api.util.GT_Utility; import net.minecraft.init.Items; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; +import gregtech.api.enums.GT_Values; +import gregtech.api.util.GT_Utility; + public class GT_ItemStack { + public final Item mItem; public final byte mStackSize; public final short mMetaData; diff --git a/src/main/java/gregtech/api/objects/GT_ItemStack2.java b/src/main/java/gregtech/api/objects/GT_ItemStack2.java index 93f2da6d6b..b137e78829 100644 --- a/src/main/java/gregtech/api/objects/GT_ItemStack2.java +++ b/src/main/java/gregtech/api/objects/GT_ItemStack2.java @@ -4,8 +4,8 @@ import net.minecraft.item.Item; import net.minecraft.item.ItemStack; /** - * GT_ItemStack, but with a better hashCode(). Due to this change, it should not be placed in the same hash based - * data structure with GT_ItemStack. It also shouldn't be used to construct search query into a hash based data structure + * GT_ItemStack, but with a better hashCode(). Due to this change, it should not be placed in the same hash based data + * structure with GT_ItemStack. It also shouldn't be used to construct search query into a hash based data structure * that contains GT_ItemStack. */ public class GT_ItemStack2 extends GT_ItemStack { diff --git a/src/main/java/gregtech/api/objects/GT_MultiTexture.java b/src/main/java/gregtech/api/objects/GT_MultiTexture.java index 82df899135..9748ecb934 100644 --- a/src/main/java/gregtech/api/objects/GT_MultiTexture.java +++ b/src/main/java/gregtech/api/objects/GT_MultiTexture.java @@ -3,12 +3,18 @@ package gregtech.api.objects; import gregtech.api.interfaces.ITexture; /** - * <p>Lets Multiple ITextures Render overlay over each other.<</p> - * <p>I should have done this much earlier...</p> + * <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 public class GT_MultiTexture extends gregtech.common.render.GT_MultiTexture implements ITexture { + public GT_MultiTexture(ITexture... aTextures) { super(aTextures); } diff --git a/src/main/java/gregtech/api/objects/GT_RenderedTexture.java b/src/main/java/gregtech/api/objects/GT_RenderedTexture.java index 4c17afde17..330d72b88a 100644 --- a/src/main/java/gregtech/api/objects/GT_RenderedTexture.java +++ b/src/main/java/gregtech/api/objects/GT_RenderedTexture.java @@ -8,6 +8,7 @@ import gregtech.api.interfaces.ITexture; @Deprecated public class GT_RenderedTexture extends gregtech.common.render.GT_RenderedTexture implements ITexture, IColorModulationContainer { + @Deprecated public short[] mRGBa; diff --git a/src/main/java/gregtech/api/objects/GT_SidedTexture.java b/src/main/java/gregtech/api/objects/GT_SidedTexture.java index 25b941e968..8ceb6a9a6d 100644 --- a/src/main/java/gregtech/api/objects/GT_SidedTexture.java +++ b/src/main/java/gregtech/api/objects/GT_SidedTexture.java @@ -11,42 +11,25 @@ import gregtech.api.interfaces.ITexture; @Deprecated 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 3966b060a3..079260c7dc 100644 --- a/src/main/java/gregtech/api/objects/GT_StdRenderedTexture.java +++ b/src/main/java/gregtech/api/objects/GT_StdRenderedTexture.java @@ -1,17 +1,18 @@ package gregtech.api.objects; -import gregtech.api.enums.Dyes; -import gregtech.api.interfaces.IIconContainer; -import gregtech.api.util.LightingHelper; import net.minecraft.block.Block; import net.minecraft.client.renderer.RenderBlocks; import net.minecraftforge.common.util.ForgeDirection; +import gregtech.api.enums.Dyes; +import gregtech.api.interfaces.IIconContainer; +import gregtech.api.util.LightingHelper; + /** - * This ITexture implementation extends the GT_RenderedTexture class - * to render with bottom side flipped as with dumb blocks rendering. - * It is used in Ore blocks rendering so they better blends with dumb block ores - * from vanilla or other mods, when seen from bottom. + * This ITexture implementation extends the GT_RenderedTexture class to render with bottom side flipped as with dumb + * blocks rendering. It is used in Ore blocks rendering so they better blends with dumb block ores from vanilla or other + * mods, when seen from bottom. + * * @deprecated Replaced by the {@link gregtech.api.render.TextureFactory} API. */ @Deprecated 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 f449478860..fffa68fadf 100644 --- a/src/main/java/gregtech/api/objects/GT_UO_Dimension.java +++ b/src/main/java/gregtech/api/objects/GT_UO_Dimension.java @@ -1,10 +1,12 @@ package gregtech.api.objects; -import com.google.common.collect.BiMap; -import com.google.common.collect.HashBiMap; import java.util.Random; + import net.minecraftforge.common.config.ConfigCategory; +import com.google.common.collect.BiMap; +import com.google.common.collect.HashBiMap; + public class GT_UO_Dimension { private BiMap<String, GT_UO_Fluid> fFluids; @@ -20,8 +22,7 @@ public class GT_UO_Dimension { 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]); + GT_UO_Fluid fluid = new GT_UO_Fluid((ConfigCategory) aConfigCategory.getChildren().toArray()[i]); fFluids.put(fluid.Registry, fluid); maxChance += fluid.Chance; } 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 44b56938b4..e717f857d5 100644 --- a/src/main/java/gregtech/api/objects/GT_UO_DimensionList.java +++ b/src/main/java/gregtech/api/objects/GT_UO_DimensionList.java @@ -1,11 +1,12 @@ package gregtech.api.objects; -import com.google.common.collect.BiMap; -import com.google.common.collect.HashBiMap; import net.minecraftforge.common.DimensionManager; import net.minecraftforge.common.config.ConfigCategory; import net.minecraftforge.common.config.Configuration; +import com.google.common.collect.BiMap; +import com.google.common.collect.HashBiMap; + public class GT_UO_DimensionList { private Configuration fConfig; @@ -37,15 +38,8 @@ public class GT_UO_DimensionList { } } - public void SetConfigValues( - String aDimensionName, - String aDimension, - String aName, - String aRegistry, - int aMinAmount, - int aMaxAmount, - int aChance, - int aDecreasePerOperationAmount) { + 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; @@ -74,18 +68,18 @@ public class GT_UO_DimensionList { fConfig.setCategoryComment(fCategory, "Config Underground Fluids (Delete this Category for regenerate)"); fConfig.setCategoryComment( - fCategory + ".Default", "Set Default Generating (Use this Category for Default settings)"); + 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(); + 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]); + 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 e43f80913e..7916131b63 100644 --- a/src/main/java/gregtech/api/objects/GT_UO_Fluid.java +++ b/src/main/java/gregtech/api/objects/GT_UO_Fluid.java @@ -3,11 +3,13 @@ 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; public class GT_UO_Fluid { + public String Registry = "null"; public int MaxAmount = 0; public int MinAmount = 0; @@ -20,8 +22,8 @@ public class GT_UO_Fluid { Registry = aConfigCategory.get("Registry").getString(); } if (aConfigCategory.containsKey("MaxAmount")) { - aConfigCategory.get("MaxAmount").comment = - "Max amount generation (per operation, sets the VeinData) 80000 MAX"; + aConfigCategory + .get("MaxAmount").comment = "Max amount generation (per operation, sets the VeinData) 80000 MAX"; MaxAmount = aConfigCategory.get("MaxAmount").getInt(0); } if (aConfigCategory.containsKey("MinAmount")) { @@ -29,15 +31,14 @@ public class GT_UO_Fluid { 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!)"; + 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); + 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); @@ -51,11 +52,11 @@ public class GT_UO_Fluid { } } - public int getRandomAmount( - Random aRandom) { // generates some random ass number that correlates to extraction speeds - int smax = (int) Math.floor(Math.pow( - MaxAmount * 100.d * DIVIDER, - 0.2d)); // use scaled max and min values for the randomness to make high values more rare. + public int getRandomAmount(Random aRandom) { // generates some random ass number that correlates to extraction + // speeds + int smax = (int) Math.floor(Math.pow(MaxAmount * 100.d * DIVIDER, 0.2d)); // use scaled max and min values for + // the randomness to make high values + // more rare. double smin = Math.pow(MinAmount * 100.d * DIVIDER, 0.2d); double samount = Math.max(smin, aRandom.nextInt(smax) + aRandom.nextDouble()); return (int) (Math.pow(samount, 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 cf3c2b5c14..52abab19cb 100644 --- a/src/main/java/gregtech/api/objects/ItemData.java +++ b/src/main/java/gregtech/api/objects/ItemData.java @@ -1,11 +1,14 @@ package gregtech.api.objects; -import gregtech.api.enums.Materials; -import gregtech.api.enums.OrePrefixes; import java.util.*; + import net.minecraft.item.ItemStack; +import gregtech.api.enums.Materials; +import gregtech.api.enums.OrePrefixes; + public class ItemData { + private static final MaterialStack[] EMPTY_MATERIALSTACK_ARRAY = new MaterialStack[0]; public final List<Object> mExtraData = new GT_ArrayList<Object>(false, 1); @@ -21,7 +24,7 @@ public class ItemData { mBlackListed = aBlackListed; mByProducts = aPrefix.mSecondaryMaterial == null || aPrefix.mSecondaryMaterial.mMaterial == null ? EMPTY_MATERIALSTACK_ARRAY - : new MaterialStack[] {aPrefix.mSecondaryMaterial.clone()}; + : new MaterialStack[] { aPrefix.mSecondaryMaterial.clone() }; } public ItemData(OrePrefixes aPrefix, Materials aMaterial) { @@ -35,12 +38,11 @@ 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) - tByProducts[j++] = aByProducts[i].clone(); + for (int i = 0; i < aByProducts.length; i++) if (aByProducts[i] != null && aByProducts[i].mMaterial != null) + tByProducts[j++] = aByProducts[i].clone(); mByProducts = j > 0 ? new MaterialStack[j] : EMPTY_MATERIALSTACK_ARRAY; for (int i = 0; i < mByProducts.length; i++) mByProducts[i] = tByProducts[i]; } @@ -60,25 +62,23 @@ public class ItemData { ArrayList<MaterialStack> aList = new ArrayList<MaterialStack>(), rList = new ArrayList<MaterialStack>(); - for (ItemData tData : aData) - if (tData != null) { - if (tData.hasValidMaterialData() && tData.mMaterial.mAmount > 0) aList.add(tData.mMaterial.clone()); - for (MaterialStack tMaterial : tData.mByProducts) - if (tMaterial.mAmount > 0) aList.add(tMaterial.clone()); - } + for (ItemData tData : aData) if (tData != null) { + if (tData.hasValidMaterialData() && tData.mMaterial.mAmount > 0) aList.add(tData.mMaterial.clone()); + for (MaterialStack tMaterial : tData.mByProducts) if (tMaterial.mAmount > 0) aList.add(tMaterial.clone()); + } for (MaterialStack aMaterial : aList) { boolean temp = true; - for (MaterialStack tMaterial : rList) - if (aMaterial.mMaterial == tMaterial.mMaterial) { - tMaterial.mAmount += aMaterial.mAmount; - temp = false; - break; - } + for (MaterialStack tMaterial : rList) if (aMaterial.mMaterial == tMaterial.mMaterial) { + tMaterial.mAmount += aMaterial.mAmount; + temp = false; + break; + } if (temp) rList.add(aMaterial.clone()); } Collections.sort(rList, new Comparator<MaterialStack>() { + @Override public int compare(MaterialStack a, MaterialStack b) { return a.mAmount == b.mAmount ? 0 : a.mAmount > b.mAmount ? -1 : +1; diff --git a/src/main/java/gregtech/api/objects/MaterialStack.java b/src/main/java/gregtech/api/objects/MaterialStack.java index 21fee36b17..c2ce2f951a 100644 --- a/src/main/java/gregtech/api/objects/MaterialStack.java +++ b/src/main/java/gregtech/api/objects/MaterialStack.java @@ -4,6 +4,7 @@ import gregtech.api.enums.Materials; import gregtech.api.util.GT_Utility; public class MaterialStack implements Cloneable { + public long mAmount; public Materials mMaterial; @@ -30,11 +31,9 @@ public class MaterialStack implements Cloneable { if (aObject == this) return true; 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); + if (aObject instanceof MaterialStack) return ((MaterialStack) aObject).mMaterial == mMaterial + && (mAmount < 0 || ((MaterialStack) aObject).mAmount < 0 + || ((MaterialStack) aObject).mAmount == mAmount); return false; } diff --git a/src/main/java/gregtech/api/objects/ObjMap.java b/src/main/java/gregtech/api/objects/ObjMap.java index 0a3b3a8fbe..05205b92c4 100644 --- a/src/main/java/gregtech/api/objects/ObjMap.java +++ b/src/main/java/gregtech/api/objects/ObjMap.java @@ -6,6 +6,7 @@ import java.util.Arrays; * Object-2-object map based on IntIntMap4a */ public class ObjMap<K, V> { + private static final Object FREE_KEY = new Object(); private static final Object REMOVED_KEY = new Object(); @@ -51,7 +52,7 @@ public class ObjMap<K, V> { 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]; + return (V) m_data[ptr + 1]; while (true) { ptr = (ptr + 2) & m_mask2; // that's next index k = m_data[ptr]; @@ -72,7 +73,7 @@ public class ObjMap<K, V> { 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; + else++m_size; return null; } else if (k.equals(key)) // we check FREE and REMOVED prior to this call { @@ -92,7 +93,7 @@ public class ObjMap<K, V> { 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; + else++m_size; return null; } else if (k.equals(key)) { final Object ret = m_data[ptr + 1]; @@ -192,9 +193,11 @@ public class ObjMap<K, V> { /** Taken from FastUtil implementation */ - /** Return the least power of two greater than or equal to the specified value. + /** + * 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. + * <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. @@ -210,18 +213,19 @@ public class ObjMap<K, V> { 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>. + /** + * 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. + * @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 + ")"); + if (s > (1 << 30)) throw new IllegalArgumentException( + "Too large (" + expected + " expected elements with load factor " + f + ")"); return (int) s; } diff --git a/src/main/java/gregtech/api/objects/ReverseShapedRecipe.java b/src/main/java/gregtech/api/objects/ReverseShapedRecipe.java index 60a5c13d74..5dd14186e1 100644 --- a/src/main/java/gregtech/api/objects/ReverseShapedRecipe.java +++ b/src/main/java/gregtech/api/objects/ReverseShapedRecipe.java @@ -2,16 +2,19 @@ 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 java.util.Collections; import java.util.LinkedList; import java.util.Optional; import java.util.Queue; + import net.minecraft.item.ItemStack; +import gregtech.api.util.GT_Recipe; +import gregtech.api.util.GT_Utility; +import gregtech.common.tileentities.machines.basic.GT_MetaTileEntity_Disassembler; + public class ReverseShapedRecipe { + private static Queue<ReverseShapedRecipe> reverseRecipes = new LinkedList<>(); private ItemStack aResult; private Object[] aRecipe; @@ -32,8 +35,8 @@ public class ReverseShapedRecipe { if (!recipeOptional.isPresent()) continue; GT_Recipe recipe = recipeOptional.get(); ItemStack[] replacement = new ItemStack[recipe.mOutputs.length]; - GT_MetaTileEntity_Disassembler.handleRecipeTransformation( - recipe.mOutputs, replacement, Collections.singleton(recipe.mOutputs)); + GT_MetaTileEntity_Disassembler + .handleRecipeTransformation(recipe.mOutputs, replacement, Collections.singleton(recipe.mOutputs)); recipe.mOutputs = replacement; sDisassemblerRecipes.add(recipe); diff --git a/src/main/java/gregtech/api/objects/ReverseShapelessRecipe.java b/src/main/java/gregtech/api/objects/ReverseShapelessRecipe.java index 6593dc60d8..656f7728c5 100644 --- a/src/main/java/gregtech/api/objects/ReverseShapelessRecipe.java +++ b/src/main/java/gregtech/api/objects/ReverseShapelessRecipe.java @@ -2,16 +2,19 @@ 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 java.util.Collections; import java.util.LinkedList; import java.util.Optional; import java.util.Queue; + import net.minecraft.item.ItemStack; +import gregtech.api.util.GT_Recipe; +import gregtech.api.util.GT_Utility; +import gregtech.common.tileentities.machines.basic.GT_MetaTileEntity_Disassembler; + public class ReverseShapelessRecipe { + private static Queue<ReverseShapelessRecipe> reverseRecipes = new LinkedList<>(); private ItemStack aResult; private Object[] aRecipe; @@ -32,8 +35,8 @@ public class ReverseShapelessRecipe { if (!recipeOptional.isPresent()) continue; GT_Recipe recipe = recipeOptional.get(); ItemStack[] replacement = new ItemStack[recipe.mOutputs.length]; - GT_MetaTileEntity_Disassembler.handleRecipeTransformation( - recipe.mOutputs, replacement, Collections.singleton(recipe.mOutputs)); + GT_MetaTileEntity_Disassembler + .handleRecipeTransformation(recipe.mOutputs, replacement, Collections.singleton(recipe.mOutputs)); recipe.mOutputs = replacement; sDisassemblerRecipes.add(recipe); diff --git a/src/main/java/gregtech/api/objects/XSTR.java b/src/main/java/gregtech/api/objects/XSTR.java index b5ed4a00b4..cd4f0e6bb4 100644 --- a/src/main/java/gregtech/api/objects/XSTR.java +++ b/src/main/java/gregtech/api/objects/XSTR.java @@ -1,36 +1,28 @@ package gregtech.api.objects; + /** - * A subclass of java.util.random that implements the Xorshift random number - * generator + * A subclass of java.util.random that implements the Xorshift random number generator * - * - it is 30% faster than the generator from Java's library - it produces - * random sequences of higher quality than java.util.Random - this class also - * provides a clone() function + * - it is 30% faster than the generator from Java's library - it produces random sequences of higher quality than + * java.util.Random - this class also provides a clone() function * - * Usage: XSRandom rand = new XSRandom(); //Instantiation x = rand.nextInt(); - * //pull a random number + * Usage: XSRandom rand = new XSRandom(); //Instantiation x = rand.nextInt(); //pull a random number * - * To use the class in legacy code, you may also instantiate an XSRandom object - * and assign it to a java.util.Random object: java.util.Random rand = new - * XSRandom(); + * To use the class in legacy code, you may also instantiate an XSRandom object and assign it to a java.util.Random + * object: java.util.Random rand = new XSRandom(); * - * for an explanation of the algorithm, see - * http://demesos.blogspot.com/2011/09/pseudo-random-number-generators.html + * for an explanation of the algorithm, see http://demesos.blogspot.com/2011/09/pseudo-random-number-generators.html * - * @author Wilfried Elmenreich University of Klagenfurt/Lakeside Labs - * http://www.elmenreich.tk + * @author Wilfried Elmenreich University of Klagenfurt/Lakeside Labs http://www.elmenreich.tk * - * This code is released under the GNU Lesser General Public License Version 3 - * http://www.gnu.org/licenses/lgpl-3.0.txt + * 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; /** - * XSTR - Xorshift ThermiteRandom - * Modified by Bogdan-G - * 03.06.2016 - * version 0.0.4 + * XSTR - Xorshift ThermiteRandom Modified by Bogdan-G 03.06.2016 version 0.0.4 */ public class XSTR extends Random { @@ -40,10 +32,11 @@ 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 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() { + @Override public synchronized void setSeed(long seed) { if (!Thread.currentThread().getStackTrace()[2].getClassName().equals(Random.class.getName())) @@ -52,12 +45,10 @@ public class XSTR extends Random { }; /* - 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 + * Creates a new pseudo random number generator. The seed is initialized to the current time, as if by * <code>setSeed(System.currentTimeMillis());</code>. */ public XSTR() { @@ -67,7 +58,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)) { @@ -77,8 +68,8 @@ public class XSTR extends Random { } /** - * Creates a new pseudo random number generator, starting with the specified - * seed, using <code>setSeed(seed);</code>. + * Creates a new pseudo random number generator, starting with the specified seed, using + * <code>setSeed(seed);</code>. * * @param seed the initial seed */ @@ -95,6 +86,7 @@ public class XSTR extends Random { public double nextDouble() { return (((long) (next(26)) << 27) + next(27)) * DOUBLE_UNIT; } + /** * Returns the current state of the seed, can be used to clone the object * @@ -105,9 +97,8 @@ public class XSTR extends Random { } /** - * Sets the seed for this pseudo random number generator. As described - * above, two instances of the same random class, starting with the same - * seed, produce the same results, if the same methods are called. + * Sets the seed for this pseudo random number generator. As described above, two instances of the same random + * class, starting with the same seed, produce the same results, if the same methods are called. * * @param seed the new seed */ @@ -125,9 +116,8 @@ public class XSTR extends Random { } /** - * Implementation of George Marsaglia's elegant Xorshift random generator - * 30% faster and better quality than the built-in java.util.random see also - * see http://www.javamex.com/tutorials/random_numbers/xorshift.shtml + * Implementation of George Marsaglia's elegant Xorshift random generator 30% faster and better quality than the + * built-in java.util.random see also see http://www.javamex.com/tutorials/random_numbers/xorshift.shtml * * @param nbits * @return @@ -165,16 +155,16 @@ public class XSTR extends Random { return v1 * multiplier; } } + /** - * Returns a pseudorandom, uniformly distributed {@code int} value between 0 - * (inclusive) and the specified value (exclusive), drawn from this random - * number generator's sequence. The general contract of {@code nextInt} is - * that one {@code int} value in the specified range is pseudorandomly - * generated and returned. All {@code bound} possible {@code int} values are - * produced with (approximately) equal probability. The method - * {@code nextInt(int bound)} is implemented by class {@code Random} as if - * by: - * <pre> {@code + * Returns a pseudorandom, uniformly distributed {@code int} value between 0 (inclusive) and the specified value + * (exclusive), drawn from this random number generator's sequence. The general contract of {@code nextInt} is that + * one {@code int} value in the specified range is pseudorandomly generated and returned. All {@code bound} possible + * {@code int} values are produced with (approximately) equal probability. The method {@code nextInt(int bound)} is + * implemented by class {@code Random} as if by: + * + * <pre> + * {@code * public int nextInt(int bound) { * if (bound <= 0) * throw new IllegalArgumentException("bound must be positive"); @@ -188,35 +178,29 @@ public class XSTR extends Random { * val = bits % bound; * } while (bits - val + (bound-1) < 0); * return val; - * }}</pre> + * }} + * </pre> * - * <p>The hedge "approx - * imately" is used in the foregoing description only because the next - * method is only approximately an unbiased source of independently chosen - * bits. If it were a perfect source of randomly chosen bits, then the - * algorithm shown would choose {@code int} values from the stated range - * with perfect uniformity. * <p> - * The algorithm is slightly tricky. It rejects values that would result in - * an uneven distribution (due to the fact that 2^31 is not divisible by n). - * The probability of a value being rejected depends on n. The worst case is - * n=2^30+1, for which the probability of a reject is 1/2, and the expected - * number of iterations before the loop terminates is 2. + * The hedge "approx imately" is used in the foregoing description only because the next method is only + * approximately an unbiased source of independently chosen bits. If it were a perfect source of randomly chosen + * bits, then the algorithm shown would choose {@code int} values from the stated range with perfect uniformity. + * <p> + * The algorithm is slightly tricky. It rejects values that would result in an uneven distribution (due to the fact + * that 2^31 is not divisible by n). The probability of a value being rejected depends on n. The worst case is + * n=2^30+1, for which the probability of a reject is 1/2, and the expected number of iterations before the loop + * terminates is 2. * <p> - * The algorithm treats the case where n is a power of two specially: it - * returns the correct number of high-order bits from the underlying - * pseudo-random number generator. In the absence of special treatment, the - * correct number of <i>low-order</i> bits would be returned. Linear - * congruential pseudo-random number generators such as the one implemented - * by this class are known to have short periods in the sequence of values - * of their low-order bits. Thus, this special case greatly increases the - * length of the sequence of values returned by successive calls to this - * method if n is a small power of two. + * The algorithm treats the case where n is a power of two specially: it returns the correct number of high-order + * bits from the underlying pseudo-random number generator. In the absence of special treatment, the correct number + * of <i>low-order</i> bits would be returned. Linear congruential pseudo-random number generators such as the one + * implemented by this class are known to have short periods in the sequence of values of their low-order bits. + * Thus, this special case greatly increases the length of the sequence of values returned by successive calls to + * this method if n is a small power of two. * * @param bound the upper bound (exclusive). Must be positive. - * @return the next pseudorandom, uniformly distributed {@code int} value - * between zero (inclusive) and {@code bound} (exclusive) from this random - * number generator's sequence + * @return the next pseudorandom, uniformly distributed {@code int} value between zero (inclusive) and {@code bound} + * (exclusive) from this random number generator's sequence * @throws IllegalArgumentException if bound is not positive * @since 1.2 */ @@ -226,18 +210,10 @@ public class XSTR extends Random { // throw new RuntimeException("BadBound"); // } - /*int r = next(31); - int m = bound - 1; - if ((bound & m) == 0) // i.e., bound is a power of 2 - { - r = (int) ((bound * (long) r) >> 31); - } else { - for (int u = r; - u - (r = u % bound) + m < 0; - u = next(31)) - ; - } - return r;*/ + /* + * int r = next(31); int m = bound - 1; if ((bound & m) == 0) // i.e., bound is a power of 2 { r = (int) ((bound + * * (long) r) >> 31); } else { for (int u = r; u - (r = u % bound) + m < 0; u = next(31)) ; } return r; + */ // speedup, new nextInt ~+40% last = seed ^ (seed << 21); last ^= (last >>> 35); @@ -265,9 +241,9 @@ public class XSTR extends Random { @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 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; } } diff --git a/src/main/java/gregtech/api/objects/iterators/MergedIterator.java b/src/main/java/gregtech/api/objects/iterators/MergedIterator.java index 77fac8d22f..961c98e81a 100644 --- a/src/main/java/gregtech/api/objects/iterators/MergedIterator.java +++ b/src/main/java/gregtech/api/objects/iterators/MergedIterator.java @@ -3,6 +3,7 @@ package gregtech.api.objects.iterators; import java.util.Iterator; public class MergedIterator<T> implements Iterator<T> { + private final Iterator<T>[] inners; private int current; diff --git a/src/main/java/gregtech/api/render/TextureFactory.java b/src/main/java/gregtech/api/render/TextureFactory.java index 4ff1a05707..1cc5b51717 100644 --- a/src/main/java/gregtech/api/render/TextureFactory.java +++ b/src/main/java/gregtech/api/render/TextureFactory.java @@ -1,28 +1,42 @@ package gregtech.api.render; +import net.minecraft.block.Block; +import net.minecraftforge.common.util.ForgeDirection; + import gregtech.api.interfaces.IIconContainer; import gregtech.api.interfaces.ITexture; import gregtech.api.interfaces.ITextureBuilder; import gregtech.common.render.GT_TextureBuilder; -import net.minecraft.block.Block; -import net.minecraftforge.common.util.ForgeDirection; /** - * <p>This class contains a collection of static factory methods to access the New Texture API.</p> - * <p>The {@link #of} methods directly returns ready-to-use instances of {@link ITexture} implementations.</p> - * <p>To get more specific implementations of {@link ITexture} instances, use the {@link #builder()} method.</p> - * <p>Example of the {@link #builder()}:</p> - * <pre>{@code + * <p> + * This class contains a collection of static factory methods to access the New Texture API. + * </p> + * <p> + * The {@link #of} methods directly returns ready-to-use instances of {@link ITexture} implementations. + * </p> + * <p> + * To get more specific implementations of {@link ITexture} instances, use the {@link #builder()} method. + * </p> + * <p> + * Example of the {@link #builder()}: + * </p> + * + * <pre> + * {@code * // Texture that glows in the dark * TextureFactory.builder().addIcon(OVERLAY_FUSION1_GLOW).glow().build()); * * // Texture with same bottom flipped orientation as vanilla * TextureFactory.builder().addIcon(GRANITE_RED_STONE).stdOrient().build(); - * }</pre> + * } + * </pre> + * * See: the {@link ITextureBuilder} interface */ @SuppressWarnings("unused") public final class TextureFactory { + private TextureFactory() { throw new AssertionError("Non-instantiable class"); } @@ -49,19 +63,9 @@ 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(); } /** @@ -73,13 +77,9 @@ 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(); } /** @@ -91,11 +91,7 @@ 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) { @@ -107,8 +103,7 @@ public final class TextureFactory { } /** - * Copied-Block {@link ITexture} factory - * that will render a texture copied from the side of a {@link Block}. + * Copied-Block {@link ITexture} factory that will render a texture copied from the side of a {@link Block}. * * @param block The {@link Block} that will provide the texture * @param meta The meta value for the Block @@ -117,11 +112,7 @@ 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 3a2406dfde..ee555c2492 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 @@ -2,17 +2,19 @@ package gregtech.api.threads; import static gregtech.api.enums.GT_Values.ALL_VALID_SIDES; +import net.minecraft.tileentity.TileEntity; +import net.minecraft.util.ChunkCoordinates; +import net.minecraft.world.World; +import net.minecraftforge.common.util.ForgeDirection; + import gregtech.GT_Mod; import gregtech.api.interfaces.tileentity.IMachineBlockUpdateable; import gregtech.api.metatileentity.BaseMetaPipeEntity; import gregtech.api.metatileentity.implementations.GT_MetaPipeEntity_Cable; import gregtech.common.GT_Proxy; -import net.minecraft.tileentity.TileEntity; -import net.minecraft.util.ChunkCoordinates; -import net.minecraft.world.World; -import net.minecraftforge.common.util.ForgeDirection; public class GT_Runnable_Cable_Update extends GT_Runnable_MachineBlockUpdate { + protected GT_Runnable_Cable_Update(World aWorld, ChunkCoordinates aCoords) { super(aWorld, aCoords); } @@ -60,15 +62,20 @@ public class GT_Runnable_Cable_Update extends GT_Runnable_MachineBlockUpdate { tCoords = new ChunkCoordinates( aCoords.posX + offset.offsetX, aCoords.posY + offset.offsetY, - aCoords.posZ + offset.offsetZ))) tQueue.add(tCoords); + 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 + "}", + "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 5e2cc08475..06553730da 100644 --- a/src/main/java/gregtech/api/threads/GT_Runnable_MachineBlockUpdate.java +++ b/src/main/java/gregtech/api/threads/GT_Runnable_MachineBlockUpdate.java @@ -1,9 +1,5 @@ package gregtech.api.threads; -import gregtech.GT_Mod; -import gregtech.api.GregTech_API; -import gregtech.api.interfaces.tileentity.IMachineBlockUpdateable; -import gregtech.common.GT_Proxy; import java.util.HashSet; import java.util.LinkedList; import java.util.Queue; @@ -12,11 +8,18 @@ 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; +import gregtech.GT_Mod; +import gregtech.api.GregTech_API; +import gregtech.api.interfaces.tileentity.IMachineBlockUpdateable; +import gregtech.common.GT_Proxy; + public class GT_Runnable_MachineBlockUpdate implements Runnable { + // used by runner thread protected final ChunkCoordinates mCoords; protected final World world; @@ -73,8 +76,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() { @@ -116,7 +119,7 @@ public class GT_Runnable_MachineBlockUpdate implements Runnable { // 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. + // ConcurrentModificationException. So, lock that shit. GT_Proxy.TICK_LOCK.lock(); try { tTileEntity = world.getTileEntity(aCoords.posX, aCoords.posY, aCoords.posZ); @@ -157,8 +160,12 @@ public class GT_Runnable_MachineBlockUpdate implements Runnable { } } catch (Exception e) { GT_Mod.GT_FML_LOGGER.error( - "Well this update was broken... " + mCoords + ", mWorld={" + world.getProviderName() + " @dimId " - + world.provider.dimensionId + "}", + "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 99aa638f87..9d6de7df83 100644 --- a/src/main/java/gregtech/api/threads/GT_Runnable_Sound.java +++ b/src/main/java/gregtech/api/threads/GT_Runnable_Sound.java @@ -1,25 +1,20 @@ package gregtech.api.threads; -import gregtech.api.util.GT_PlayedSound; -import gregtech.api.util.GT_Utility; import net.minecraft.util.ResourceLocation; import net.minecraft.world.World; +import gregtech.api.util.GT_PlayedSound; +import gregtech.api.util.GT_Utility; + public class GT_Runnable_Sound implements Runnable { + private final int mX, mY, mZ, mTimeUntilNextSound; private final World mWorld; 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; @@ -34,15 +29,8 @@ 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) { + public GT_Runnable_Sound(World aWorld, int aX, int aY, int aZ, int aTimeUntilNextSound, String aSoundName, + float aSoundStrength, float aSoundModulation) { this( aWorld, aX, diff --git a/src/main/java/gregtech/api/util/ColorsMetadataSection.java b/src/main/java/gregtech/api/util/ColorsMetadataSection.java index c7ec2c8aa3..d8ce59f42c 100644 --- a/src/main/java/gregtech/api/util/ColorsMetadataSection.java +++ b/src/main/java/gregtech/api/util/ColorsMetadataSection.java @@ -1,21 +1,24 @@ package gregtech.api.util; -import cpw.mods.fml.relauncher.Side; -import cpw.mods.fml.relauncher.SideOnly; import java.util.HashMap; import java.util.Map; + import net.minecraft.client.resources.data.IMetadataSection; +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; + @SideOnly(Side.CLIENT) public class ColorsMetadataSection implements IMetadataSection { + private final Map<String, Integer> textColors; private final Map<String, String> hexTextColors; private final Map<String, Integer> guiTints; 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); diff --git a/src/main/java/gregtech/api/util/ColorsMetadataSectionSerializer.java b/src/main/java/gregtech/api/util/ColorsMetadataSectionSerializer.java index b58c00db88..cab41e0d3b 100644 --- a/src/main/java/gregtech/api/util/ColorsMetadataSectionSerializer.java +++ b/src/main/java/gregtech/api/util/ColorsMetadataSectionSerializer.java @@ -1,25 +1,29 @@ package gregtech.api.util; +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; + import com.google.gson.JsonDeserializationContext; import com.google.gson.JsonElement; import com.google.gson.JsonObject; import com.google.gson.JsonSerializationContext; import com.google.gson.JsonSerializer; + import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; import gregtech.GT_Mod; import gregtech.api.GregTech_API; import gregtech.api.enums.Dyes; -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<>(); @@ -39,8 +43,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())); diff --git a/src/main/java/gregtech/api/util/GT_ApiaryModifier.java b/src/main/java/gregtech/api/util/GT_ApiaryModifier.java index eee97a4458..bb5c760556 100644 --- a/src/main/java/gregtech/api/util/GT_ApiaryModifier.java +++ b/src/main/java/gregtech/api/util/GT_ApiaryModifier.java @@ -3,6 +3,7 @@ package gregtech.api.util; import net.minecraft.world.biome.BiomeGenBase; public class GT_ApiaryModifier { + public float territory = 1f; public float mutation = 1f; public float lifespan = 1f; diff --git a/src/main/java/gregtech/api/util/GT_ApiaryUpgrade.java b/src/main/java/gregtech/api/util/GT_ApiaryUpgrade.java index d4b00d99b2..b54697fdfc 100644 --- a/src/main/java/gregtech/api/util/GT_ApiaryUpgrade.java +++ b/src/main/java/gregtech/api/util/GT_ApiaryUpgrade.java @@ -1,14 +1,17 @@ package gregtech.api.util; -import gregtech.api.enums.OrePrefixes; -import gregtech.common.items.GT_MetaGenerated_Item_03; import java.util.*; import java.util.function.BiConsumer; import java.util.function.Consumer; + import net.minecraft.item.ItemStack; import net.minecraft.world.biome.BiomeGenBase; +import gregtech.api.enums.OrePrefixes; +import gregtech.common.items.GT_MetaGenerated_Item_03; + public enum GT_ApiaryUpgrade { + speed1(UNIQUE_INDEX.SPEED_UPGRADE, 32200, 1, (mods, n) -> mods.maxSpeed = 1), speed2(UNIQUE_INDEX.SPEED_UPGRADE, 32201, 1, (mods, n) -> mods.maxSpeed = 2), speed3(UNIQUE_INDEX.SPEED_UPGRADE, 32202, 1, (mods, n) -> mods.maxSpeed = 3), @@ -105,10 +108,10 @@ public enum GT_ApiaryUpgrade { sieve(UNIQUE_INDEX.SIEVE_UPGRADE, 32229, 1, (mods, n) -> { mods.isCollectingPollen = true; mods.energy *= 1.05f; - }), - ; + }),; private enum UNIQUE_INDEX { + SPEED_UPGRADE, PRODUCTION_UPGRADE, PLAINS_UPGRADE, @@ -130,16 +133,15 @@ public enum GT_ApiaryUpgrade { OCEAN_UPGRADE, SKY_UPGRADE, HEATER_UPGRADE, - SIEVE_UPGRADE, - ; + SIEVE_UPGRADE,; 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; @@ -150,8 +152,8 @@ public enum GT_ApiaryUpgrade { private final HashSet<GT_Utility.ItemId> blacklistedUpgrades = new HashSet<>(); - GT_ApiaryUpgrade( - UNIQUE_INDEX unique_index, int meta, int maxnumber, BiConsumer<GT_ApiaryModifier, Integer> applier) { + GT_ApiaryUpgrade(UNIQUE_INDEX unique_index, int meta, int maxnumber, + BiConsumer<GT_ApiaryModifier, Integer> applier) { this.unique_index = unique_index; this.meta = meta; this.maxnumber = maxnumber; @@ -162,11 +164,10 @@ public enum GT_ApiaryUpgrade { 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); diff --git a/src/main/java/gregtech/api/util/GT_AssemblyLineUtils.java b/src/main/java/gregtech/api/util/GT_AssemblyLineUtils.java index f20a78d494..218e5bffdc 100644 --- a/src/main/java/gregtech/api/util/GT_AssemblyLineUtils.java +++ b/src/main/java/gregtech/api/util/GT_AssemblyLineUtils.java @@ -2,17 +2,14 @@ package gregtech.api.util; import static gregtech.GT_Mod.GT_FML_LOGGER; -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,21 +17,26 @@ import net.minecraft.nbt.NBTTagString; import net.minecraftforge.common.util.Constants.NBT; import net.minecraftforge.fluids.FluidStack; +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; + 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>(); + 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>(); + 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? */ @@ -55,6 +57,7 @@ public class GT_AssemblyLineUtils { /** * 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. */ @@ -64,8 +67,10 @@ public class GT_AssemblyLineUtils { /** * 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? + * + * @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 @@ -131,8 +136,7 @@ public class GT_AssemblyLineUtils { GT_FML_LOGGER.info("Fluid " + i + " " + tLoaded.getUnlocalizedName()); } } - if (!aTag.hasKey("output") - || !aTag.hasKey("time") + if (!aTag.hasKey("output") || !aTag.hasKey("time") || aTag.getInteger("time") <= 0 || !aTag.hasKey("eu") || !GT_Utility.isStackValid(aOutput)) { @@ -147,14 +151,15 @@ public class GT_AssemblyLineUtils { // 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)); + 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) { @@ -186,13 +191,13 @@ public class GT_AssemblyLineUtils { } private static boolean areStacksEqual(ItemStack[] lhs, List<ItemStack> rhs) { - return lhs == null - ? rhs.isEmpty() + 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. */ @@ -273,8 +278,7 @@ public class GT_AssemblyLineUtils { * @return Does this Data Stick have a valid output ItemStack? */ public static boolean doesDataStickHaveOutput(ItemStack aDataStick) { - if (isItemDataStick(aDataStick) - && aDataStick.hasTagCompound() + if (isItemDataStick(aDataStick) && aDataStick.hasTagCompound() && aDataStick.getTagCompound().hasKey("output")) { return true; } @@ -306,8 +310,7 @@ public class GT_AssemblyLineUtils { public static boolean doesDataStickHaveRecipeHash(ItemStack aDataStick) { if (isItemDataStick(aDataStick) && aDataStick.hasTagCompound()) { NBTTagCompound aNBT = aDataStick.getTagCompound(); - if (aNBT.hasKey("Data.Recipe.Hash") - && !aNBT.getString("Data.Recipe.Hash").equals("Hash.0")) { + if (aNBT.hasKey("Data.Recipe.Hash") && !aNBT.getString("Data.Recipe.Hash").equals("Hash.0")) { return true; } } @@ -316,6 +319,7 @@ public class GT_AssemblyLineUtils { /** * Get the Output ItemStack from a Data Stick. + * * @param aDataStick - The Data Stick to check. * @return Output ItemStack contained on the Data Stick. */ @@ -329,9 +333,11 @@ public class GT_AssemblyLineUtils { /** * @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. + * @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()) { @@ -346,7 +352,7 @@ public class GT_AssemblyLineUtils { /** * - * @param aDataStick - The Data Stick to update. + * @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? */ @@ -379,8 +385,12 @@ public class GT_AssemblyLineUtils { 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); + GT_FML_LOGGER.info( + "Updating data stick: " + aDataStick.getDisplayName() + + " | Old Recipe Hash: " + + generateRecipeHash(aOldRecipe) + + ", New Recipe Hash: " + + aHash); } String author = "Assembling Line Recipe Generator"; @@ -434,8 +444,15 @@ public class GT_AssemblyLineUtils { 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))); + 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; @@ -448,10 +465,7 @@ public class GT_AssemblyLineUtils { if (s == null) s = tStack.getDisplayName(); } - tBuilder.append(count == 0 ? "" : "\nOr ") - .append(tStack.stackSize) - .append(" ") - .append(s); + tBuilder.append(count == 0 ? "" : "\nOr ").append(tStack.stackSize).append(" ").append(s); count++; } } @@ -462,8 +476,9 @@ public class GT_AssemblyLineUtils { 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)); + tNBTList.appendTag( + new NBTTagString( + "Input Bus " + (i + 1) + ": " + aNewRecipe.mInputs[i].stackSize + " " + s)); } } for (int i = 0; i < aNewRecipe.mFluidInputs.length; i++) { @@ -473,8 +488,9 @@ public class GT_AssemblyLineUtils { 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)); + tNBTList.appendTag( + new NBTTagString( + "Input Hatch " + (i + 1) + ": " + aNewRecipe.mFluidInputs[i].amount + "L " + s)); } } tNBT.setTag("pages", tNBTList); @@ -488,6 +504,7 @@ public class GT_AssemblyLineUtils { } public enum LookupResultType { + INVALID_STICK(true), VALID_STACK_BUT_INVALID_RECIPE(true), VALID_STACK_AND_VALID_RECIPE(false), @@ -514,6 +531,7 @@ public class GT_AssemblyLineUtils { } public static class LookupResult { + private final GT_Recipe_AssemblyLine recipe; private final LookupResultType 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 15d11cda63..a455fcf916 100644 --- a/src/main/java/gregtech/api/util/GT_Assemblyline_Server.java +++ b/src/main/java/gregtech/api/util/GT_Assemblyline_Server.java @@ -1,30 +1,30 @@ package gregtech.api.util; -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; +import cpw.mods.fml.common.event.FMLPreInitializationEvent; +import gregtech.api.GregTech_API; +import gregtech.api.enums.Materials; +import gregtech.api.enums.MaterialsBotania; + 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>(); + 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) { String s = new String(aEvent.getModConfigurationDirectory().getAbsolutePath()); - s = s.substring( - 0, aEvent.getModConfigurationDirectory().getAbsolutePath().length() - 6); + s = s.substring(0, aEvent.getModConfigurationDirectory().getAbsolutePath().length() - 6); s = s + "GregTech.lang"; File f = new File(s); s = ""; @@ -40,131 +40,103 @@ public class GT_Assemblyline_Server { 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); + || (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) { - } + } 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())); + 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())); + 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) { - } + } 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()))); + 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") + 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.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.wire.".length(), - entry.getKey().length() - ".01.name".length()))); + 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) { - } + } 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())); + 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())); + 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; @@ -173,168 +145,64 @@ public class GT_Assemblyline_Server { 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 - }; + 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 - }; + 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 - }; + 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 - }; + 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 - }; + 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 - }; + 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 - }; + 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 - }; + 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()); + .substring("gt.blockmetal1.".length(), entry.getKey().length() - ".name".length()); i = Integer.parseInt(t); lServerNames.put(entry.getKey(), "Block of " + mMats[i].toString()); mMats = null; @@ -345,66 +213,31 @@ public class GT_Assemblyline_Server { 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 - }; + 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 - }; + 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 - }; + 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()); + 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) { - } + } catch (Exception ignored) {} } internal = null; diff --git a/src/main/java/gregtech/api/util/GT_BaseCrop.java b/src/main/java/gregtech/api/util/GT_BaseCrop.java index 930badfdba..65d2900176 100644 --- a/src/main/java/gregtech/api/util/GT_BaseCrop.java +++ b/src/main/java/gregtech/api/util/GT_BaseCrop.java @@ -2,6 +2,16 @@ package gregtech.api.util; import static gregtech.api.enums.GT_Values.E; +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; +import net.minecraft.item.ItemStack; +import net.minecraft.tileentity.TileEntity; + +import speiger.src.crops.api.ICropCardInfo; import cpw.mods.fml.common.Loader; import gregtech.GT_Mod; import gregtech.api.GregTech_API; @@ -14,23 +24,12 @@ 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; -import net.minecraft.item.ItemStack; -import net.minecraft.tileentity.TileEntity; -import speiger.src.crops.api.ICropCardInfo; 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], + 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; @@ -49,23 +48,9 @@ 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, + 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, @@ -102,24 +87,9 @@ 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, + 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); @@ -149,10 +119,7 @@ public class GT_BaseCrop extends CropCard implements ICropCardInfo { 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); + .invoke(Class.forName("speiger.src.crops.api.CropPluginAPI").getField("instance"), this); } catch (IllegalAccessException ex) { bIc2NeiLoaded = false; } catch (IllegalArgumentException ex) { @@ -267,12 +234,13 @@ public class GT_BaseCrop extends CropCard implements ICropCardInfo { 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; @@ -282,33 +250,32 @@ public class GT_BaseCrop extends CropCard implements ICropCardInfo { } } } else { - int tMetaID = aCrop.getWorld() - .getBlockMetadata( - aCrop.getLocation().posX, aCrop.getLocation().posY - i, aCrop.getLocation().posZ); + int tMetaID = aCrop.getWorld().getBlockMetadata( + aCrop.getLocation().posX, + aCrop.getLocation().posY - i, + aCrop.getLocation().posZ); ItemData tAssotiation = GT_OreDictUnificator.getAssociation(new ItemStack(tBlock, 1, tMetaID)); - if ((tAssotiation != null) - && (tAssotiation.mPrefix.toString().startsWith("ore")) + if ((tAssotiation != null) && (tAssotiation.mPrefix.toString().startsWith("ore")) && (tAssotiation.mMaterial.mMaterial == mBlock)) { return true; } - if ((tAssotiation != null) - && (tAssotiation.mPrefix == OrePrefixes.block) + 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, + // 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, + // 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 - + // 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;} - // } + // if(mMeta < 0 || tMeta == mMeta){ + // return true;} + // } } return false; } @@ -317,8 +284,11 @@ 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; diff --git a/src/main/java/gregtech/api/util/GT_BlockMap.java b/src/main/java/gregtech/api/util/GT_BlockMap.java index 9b71abbdc3..40e11e41a0 100644 --- a/src/main/java/gregtech/api/util/GT_BlockMap.java +++ b/src/main/java/gregtech/api/util/GT_BlockMap.java @@ -1,13 +1,16 @@ package gregtech.api.util; -import gnu.trove.map.TByteObjectMap; -import gnu.trove.map.hash.TByteObjectHashMap; import java.util.HashMap; import java.util.Map; import java.util.function.BiFunction; + import net.minecraft.block.Block; +import gnu.trove.map.TByteObjectMap; +import gnu.trove.map.hash.TByteObjectHashMap; + public class GT_BlockMap<V> { + public static final byte WILDCARD = -1; private final Map<Block, TByteObjectMap<V>> backing = new HashMap<>(); private int size = 0; diff --git a/src/main/java/gregtech/api/util/GT_BlockSet.java b/src/main/java/gregtech/api/util/GT_BlockSet.java index 94f3c3944a..1d13afd056 100644 --- a/src/main/java/gregtech/api/util/GT_BlockSet.java +++ b/src/main/java/gregtech/api/util/GT_BlockSet.java @@ -3,6 +3,7 @@ package gregtech.api.util; import net.minecraft.block.Block; public class GT_BlockSet { + private final GT_BlockMap<Object> backing = new GT_BlockMap<>(); public boolean add(Block block, byte meta) { 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 fd01ccd00e..7e3b7c424c 100644 --- a/src/main/java/gregtech/api/util/GT_CLS_Compat.java +++ b/src/main/java/gregtech/api/util/GT_CLS_Compat.java @@ -1,10 +1,5 @@ package gregtech.api.util; -import cpw.mods.fml.common.ProgressManager; -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; @@ -14,6 +9,12 @@ import java.util.Set; import java.util.function.Consumer; import java.util.function.Function; +import cpw.mods.fml.common.ProgressManager; +import gregtech.GT_Mod; +import gregtech.api.enums.Materials; +import gregtech.common.GT_Proxy; +import gregtech.loaders.postload.GT_PostLoad; + @SuppressWarnings("rawtypes, unchecked, deprecation") public class GT_CLS_Compat { @@ -71,12 +72,8 @@ public class 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; @@ -109,8 +106,7 @@ public class GT_CLS_Compat { } action.accept(m); currentStep += 1; - } - ; + } ; GT_Mod.GT_FML_LOGGER.info(String.format("%s - Baking: Done", materialsType)); try { progressBarStep.set(progressBar, currentStep); @@ -119,23 +115,25 @@ 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)); + "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) { diff --git a/src/main/java/gregtech/api/util/GT_ChunkAssociatedData.java b/src/main/java/gregtech/api/util/GT_ChunkAssociatedData.java index ac04ecfd46..ea1ac73621 100644 --- a/src/main/java/gregtech/api/util/GT_ChunkAssociatedData.java +++ b/src/main/java/gregtech/api/util/GT_ChunkAssociatedData.java @@ -1,8 +1,5 @@ package gregtech.api.util; -import cpw.mods.fml.common.eventhandler.SubscribeEvent; -import gregtech.api.enums.GT_Values; -import gregtech.api.interfaces.tileentity.IGregTechTileEntity; import java.io.DataInput; import java.io.DataInputStream; import java.io.DataOutput; @@ -30,19 +27,26 @@ 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; +import cpw.mods.fml.common.eventhandler.SubscribeEvent; +import gregtech.api.enums.GT_Values; +import gregtech.api.interfaces.tileentity.IGregTechTileEntity; + /** * A utility to save all kinds of data that is a function of any chunk. * <p> - * GregTech takes care of saving and loading the data from disk, and an efficient mechanism to locate it. - * Subclass only need to define the exact scheme of each element data (by overriding the three protected abstract method) + * GregTech takes care of saving and loading the data from disk, and an efficient mechanism to locate it. Subclass only + * need to define the exact scheme of each element data (by overriding the three protected abstract method) * <p> * Oh, there is no limit on how large your data is, though you'd not have the familiar NBT interface, but DataOutput * should be reasonably common anyway. @@ -58,9 +62,10 @@ import org.apache.commons.io.FileUtils; */ @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 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"); @@ -75,9 +80,8 @@ public abstract class GT_ChunkAssociatedData<T extends GT_ChunkAssociatedData.ID 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. + * 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<>(); @@ -85,12 +89,14 @@ public abstract class GT_ChunkAssociatedData<T extends GT_ChunkAssociatedData.ID * 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. + * @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) { + 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"); @@ -109,8 +115,7 @@ public abstract class GT_ChunkAssociatedData<T extends GT_ChunkAssociatedData.ID } /** - * Get a reference to data of the chunk that tile entity is in. - * The returned reference should be mutable. + * 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); @@ -125,15 +130,13 @@ public abstract class GT_ChunkAssociatedData<T extends GT_ChunkAssociatedData.ID } public final T get(World world, int chunkX, int chunkZ) { - SuperRegion region = masterMap - .computeIfAbsent(world.provider.dimensionId, ignored -> new ConcurrentHashMap<>()) + 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<>()) + 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); } @@ -150,13 +153,11 @@ public abstract class GT_ChunkAssociatedData<T extends GT_ChunkAssociatedData.ID public void clear() { if (GT_Values.debugWorldData) { - long dirtyRegionCount = masterMap.values().stream() - .flatMap(m -> m.values().stream()) - .filter(SuperRegion::isDirty) - .count(); - if (dirtyRegionCount > 0) - GT_Log.out.println("Clearing ChunkAssociatedData with " + dirtyRegionCount - + " regions dirty. Data might have been lost!"); + 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(); } @@ -171,11 +172,8 @@ public abstract class GT_ChunkAssociatedData<T extends GT_ChunkAssociatedData.ID } 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 -> { + 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) { @@ -208,26 +206,26 @@ public abstract class GT_ChunkAssociatedData<T extends GT_ChunkAssociatedData.ID } /** - * 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. + * 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 (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 (Stream<Path> stream = Files.list(getSaveDirectory(w).toPath())) { Map<ChunkCoordIntPair, SuperRegion> worldData = stream.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( + 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 -> { @@ -238,9 +236,7 @@ public abstract class GT_ChunkAssociatedData<T extends GT_ChunkAssociatedData.ID e.printStackTrace(GT_Log.err); return null; } - }) - .filter(Objects::nonNull) - .collect(Collectors.toMap(SuperRegion::getCoord, Function.identity())); + }).filter(Objects::nonNull).collect(Collectors.toMap(SuperRegion::getCoord, Function.identity())); masterMap.put(w.provider.dimensionId, worldData); } catch (IOException | UncheckedIOException e) { GT_Log.err.println("Error loading all region"); @@ -256,6 +252,7 @@ public abstract class GT_ChunkAssociatedData<T extends GT_ChunkAssociatedData.ID } public interface IData { + /** * @return Whether the data is different from chunk default */ @@ -263,6 +260,7 @@ public abstract class GT_ChunkAssociatedData<T extends GT_ChunkAssociatedData.ID } protected final class SuperRegion { + private final T[] data = createData(); private final File backingStorage; private final WeakReference<World> world; @@ -348,7 +346,7 @@ public abstract class GT_ChunkAssociatedData<T extends GT_ChunkAssociatedData.ID } private void save0() throws IOException { - //noinspection ResultOfMethodCallIgnored + // noinspection ResultOfMethodCallIgnored backingStorage.getParentFile().mkdirs(); File tmpFile = getTmpFile(); World world = Objects.requireNonNull(this.world.get(), "Attempting to save region of another world!"); @@ -445,6 +443,7 @@ public abstract class GT_ChunkAssociatedData<T extends GT_ChunkAssociatedData.ID } public static class EventHandler { + private EventHandler() { MinecraftForge.EVENT_BUS.register(this); } diff --git a/src/main/java/gregtech/api/util/GT_CircuitryBehavior.java b/src/main/java/gregtech/api/util/GT_CircuitryBehavior.java index 2813df0973..809c66d5d0 100644 --- a/src/main/java/gregtech/api/util/GT_CircuitryBehavior.java +++ b/src/main/java/gregtech/api/util/GT_CircuitryBehavior.java @@ -10,19 +10,20 @@ import gregtech.api.interfaces.IRedstoneCircuitBlock; /** * Redstone Circuit Control Code * <p/> - * This should make everything possible what a Redstone Computer or BuildCraft Gate could do. - * It is intended to use this similar to BC-Gates (for acquiring Data) and RP Logic Gates. - * You could write an extremely specified and complex Logic Gate, which works only for you Setup, like - * with ComputerCraft, but you would have to write an extra Mod to add that, as it doesn't work Ingame. + * This should make everything possible what a Redstone Computer or BuildCraft Gate could do. It is intended to use this + * similar to BC-Gates (for acquiring Data) and RP Logic Gates. You could write an extremely specified and complex Logic + * Gate, which works only for you Setup, like with ComputerCraft, but you would have to write an extra Mod to add that, + * as it doesn't work Ingame. * <p/> - * One can make use of the fact, that ItemStacks can be stored as Integer, so that you can scan - * Inventories for specific Items using that. Luckily the Buttons in the GUI enable Copy/Paste of - * ItemID+MetaData to Integer, including the WildCard Damage Value when you use rightclick to place it. - * You just need to use @GT_Utility.stackToInt(ItemStack aStack) to get it. + * One can make use of the fact, that ItemStacks can be stored as Integer, so that you can scan Inventories for specific + * Items using that. Luckily the Buttons in the GUI enable Copy/Paste of ItemID+MetaData to Integer, including the + * WildCard Damage Value when you use rightclick to place it. You just need to use @GT_Utility.stackToInt(ItemStack + * aStack) to get it. * <p/> * All Functions run usually in a seperate try/catch Block, so that failed Logic won't crash the TileEntity. */ public abstract class GT_CircuitryBehavior { + /** * @param aIndex 0 - 1023 are my own Indices, so use other Numbers! */ @@ -36,13 +37,11 @@ public abstract class GT_CircuitryBehavior { public static boolean getAnyRedstone(IRedstoneCircuitBlock aRedstoneCircuitBlock) { for (byte side : ALL_VALID_SIDES) { if (side != aRedstoneCircuitBlock.getOutputFacing() - && aRedstoneCircuitBlock - .getCover(side) - .letsRedstoneGoIn( - side, - aRedstoneCircuitBlock.getCoverID(side), - aRedstoneCircuitBlock.getCoverVariable(side), - aRedstoneCircuitBlock.getOwnTileEntity())) { + && aRedstoneCircuitBlock.getCover(side).letsRedstoneGoIn( + side, + aRedstoneCircuitBlock.getCoverID(side), + aRedstoneCircuitBlock.getCoverVariable(side), + aRedstoneCircuitBlock.getOwnTileEntity())) { if (aRedstoneCircuitBlock.getInputRedstone(side) > 0) { return true; } @@ -57,13 +56,11 @@ public abstract class GT_CircuitryBehavior { public static boolean getAllRedstone(IRedstoneCircuitBlock aRedstoneCircuitBlock) { for (byte side : ALL_VALID_SIDES) { if (side != aRedstoneCircuitBlock.getOutputFacing() - && aRedstoneCircuitBlock - .getCover(side) - .letsRedstoneGoIn( - side, - aRedstoneCircuitBlock.getCoverID(side), - aRedstoneCircuitBlock.getCoverVariable(side), - aRedstoneCircuitBlock.getOwnTileEntity())) { + && aRedstoneCircuitBlock.getCover(side).letsRedstoneGoIn( + side, + aRedstoneCircuitBlock.getCoverID(side), + aRedstoneCircuitBlock.getCoverVariable(side), + aRedstoneCircuitBlock.getOwnTileEntity())) { if (aRedstoneCircuitBlock.getInputRedstone(side) == 0) { return false; } @@ -79,13 +76,11 @@ public abstract class GT_CircuitryBehavior { int tRedstoneAmount = 0; for (byte side : ALL_VALID_SIDES) { if (side != aRedstoneCircuitBlock.getOutputFacing() - && aRedstoneCircuitBlock - .getCover(side) - .letsRedstoneGoIn( - side, - aRedstoneCircuitBlock.getCoverID(side), - aRedstoneCircuitBlock.getCoverVariable(side), - aRedstoneCircuitBlock.getOwnTileEntity())) { + && aRedstoneCircuitBlock.getCover(side).letsRedstoneGoIn( + side, + aRedstoneCircuitBlock.getCoverID(side), + aRedstoneCircuitBlock.getCoverVariable(side), + aRedstoneCircuitBlock.getOwnTileEntity())) { if (aRedstoneCircuitBlock.getInputRedstone(side) > 0) { tRedstoneAmount++; } @@ -101,13 +96,11 @@ public abstract class GT_CircuitryBehavior { byte tRedstoneAmount = 0; for (byte side : ALL_VALID_SIDES) { if (side != aRedstoneCircuitBlock.getOutputFacing() - && aRedstoneCircuitBlock - .getCover(side) - .letsRedstoneGoIn( - side, - aRedstoneCircuitBlock.getCoverID(side), - aRedstoneCircuitBlock.getCoverVariable(side), - aRedstoneCircuitBlock.getOwnTileEntity())) { + && aRedstoneCircuitBlock.getCover(side).letsRedstoneGoIn( + side, + aRedstoneCircuitBlock.getCoverID(side), + aRedstoneCircuitBlock.getCoverVariable(side), + aRedstoneCircuitBlock.getOwnTileEntity())) { tRedstoneAmount = (byte) Math.max(tRedstoneAmount, aRedstoneCircuitBlock.getInputRedstone(side)); } } @@ -126,13 +119,11 @@ public abstract class GT_CircuitryBehavior { byte tRedstoneAmount = 15; for (byte side : ALL_VALID_SIDES) { if (side != aRedstoneCircuitBlock.getOutputFacing() - && aRedstoneCircuitBlock - .getCover(side) - .letsRedstoneGoIn( - side, - aRedstoneCircuitBlock.getCoverID(side), - aRedstoneCircuitBlock.getCoverVariable(side), - aRedstoneCircuitBlock.getOwnTileEntity())) { + && aRedstoneCircuitBlock.getCover(side).letsRedstoneGoIn( + side, + aRedstoneCircuitBlock.getCoverID(side), + aRedstoneCircuitBlock.getCoverVariable(side), + aRedstoneCircuitBlock.getOwnTileEntity())) { if (aRedstoneCircuitBlock.getInputRedstone(side) > 0) tRedstoneAmount = (byte) Math.min(tRedstoneAmount, aRedstoneCircuitBlock.getInputRedstone(side)); } @@ -148,13 +139,11 @@ public abstract class GT_CircuitryBehavior { byte tRedstoneAmount = 15; for (byte side : ALL_VALID_SIDES) { if (side != aRedstoneCircuitBlock.getOutputFacing() - && aRedstoneCircuitBlock - .getCover(side) - .letsRedstoneGoIn( - side, - aRedstoneCircuitBlock.getCoverID(side), - aRedstoneCircuitBlock.getCoverVariable(side), - aRedstoneCircuitBlock.getOwnTileEntity())) { + && aRedstoneCircuitBlock.getCover(side).letsRedstoneGoIn( + side, + aRedstoneCircuitBlock.getCoverID(side), + aRedstoneCircuitBlock.getCoverVariable(side), + aRedstoneCircuitBlock.getOwnTileEntity())) { tRedstoneAmount = (byte) Math.min(tRedstoneAmount, aRedstoneCircuitBlock.getInputRedstone(side)); } } @@ -170,8 +159,8 @@ public abstract class GT_CircuitryBehavior { public abstract void initParameters(int[] aCircuitData, IRedstoneCircuitBlock aRedstoneCircuitBlock); /** - * Validates the Parameters of this Circuit when a value has been changed by the GUI - * Also called right after @initParameters and when the Chunk reloads + * Validates the Parameters of this Circuit when a value has been changed by the GUI Also called right + * after @initParameters and when the Chunk reloads * * @param aCircuitData, The Data Storage you can use (8 Slots and only the first 4 are User definable) * @param aRedstoneCircuitBlock, The Circuit Block MetaTileEntity itself @@ -193,8 +182,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 @@ -215,8 +204,7 @@ public abstract class GT_CircuitryBehavior { public abstract String getDataDescription(int[] aCircuitData, int aCircuitDataIndex); /** - * How the Integer should be displayed in the GUI. - * null means, that it just displays as regular Number. + * How the Integer should be displayed in the GUI. null means, that it just displays as regular Number. */ @SideOnly(Side.CLIENT) public String getDataDisplay(int[] aCircuitData, int aCircuitDataIndex) { diff --git a/src/main/java/gregtech/api/util/GT_ClientPreference.java b/src/main/java/gregtech/api/util/GT_ClientPreference.java index de3051fd37..34db521bd4 100644 --- a/src/main/java/gregtech/api/util/GT_ClientPreference.java +++ b/src/main/java/gregtech/api/util/GT_ClientPreference.java @@ -1,12 +1,13 @@ package gregtech.api.util; public class GT_ClientPreference { + private final boolean mSingleBlockInitialFilter; 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; @@ -14,8 +15,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 362be0fe01..337b3b7f68 100644 --- a/src/main/java/gregtech/api/util/GT_Config.java +++ b/src/main/java/gregtech/api/util/GT_Config.java @@ -2,13 +2,15 @@ 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 gregtech.api.GregTech_API; +import gregtech.api.enums.GT_Values; + public class GT_Config implements Runnable { + public static boolean troll = false; public static Configuration sConfigFileIDs; @@ -30,8 +32,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; @@ -44,7 +46,7 @@ public class GT_Config implements Runnable { try { if (GT_Utility.isStringValid(rName = aStack.getUnlocalizedName())) return rName.toString(); } catch (Throwable e) { - /*Do nothing*/ + /* Do nothing */ } String sName = aStack.getItem().toString(); String[] tmp = sName.split("@"); @@ -60,7 +62,9 @@ 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); + aCategory.toString().replaceAll("\\|", "_"), + (aName + "_" + aDefault).replaceAll("\\|", "_"), + aDefault); boolean rResult = tProperty.getBoolean(aDefault); if (!tProperty.wasRead() && shouldSave()) mConfig.save(); return rResult; @@ -73,7 +77,9 @@ 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); + aCategory.toString().replaceAll("\\|", "_"), + (aName + "_" + aDefault).replaceAll("\\|", "_"), + aDefault); int rResult = tProperty.getInt(aDefault); if (!tProperty.wasRead() && shouldSave()) mConfig.save(); return rResult; @@ -86,7 +92,9 @@ 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); + aCategory.toString().replaceAll("\\|", "_"), + (aName + "_" + aDefault).replaceAll("\\|", "_"), + aDefault); double rResult = tProperty.getDouble(aDefault); if (!tProperty.wasRead() && shouldSave()) mConfig.save(); return rResult; @@ -99,7 +107,9 @@ 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); + aCategory.toString().replaceAll("\\|", "_"), + (aName + "_" + aDefault).replaceAll("\\|", "_"), + aDefault); String rResult = tProperty.getString(); if (!tProperty.wasRead() && shouldSave()) mConfig.save(); return rResult; @@ -111,8 +121,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.replaceAll("\\|", "_"), aDefault); + Property tProperty = mConfig + .get(aCategory.toString().replaceAll("\\|", "_"), aName.replaceAll("\\|", "_"), aDefault); String[] rResult = tProperty.getStringList(); if (!tProperty.wasRead() && GregTech_API.sPostloadFinished) mConfig.save(); return rResult; diff --git a/src/main/java/gregtech/api/util/GT_CoverBehavior.java b/src/main/java/gregtech/api/util/GT_CoverBehavior.java index f3b8f7a9fb..f12da42700 100644 --- a/src/main/java/gregtech/api/util/GT_CoverBehavior.java +++ b/src/main/java/gregtech/api/util/GT_CoverBehavior.java @@ -2,17 +2,18 @@ package gregtech.api.util; import static gregtech.api.enums.GT_Values.E; -import gregtech.api.enums.GT_Values; -import gregtech.api.gui.modularui.GT_UIInfos; -import gregtech.api.interfaces.ITexture; -import gregtech.api.interfaces.tileentity.ICoverable; -import gregtech.api.net.GT_Packet_TileEntityCoverGUI; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.player.EntityPlayerMP; import net.minecraft.item.ItemStack; import net.minecraft.world.World; import net.minecraftforge.fluids.Fluid; +import gregtech.api.enums.GT_Values; +import gregtech.api.gui.modularui.GT_UIInfos; +import gregtech.api.interfaces.ITexture; +import gregtech.api.interfaces.tileentity.ICoverable; +import gregtech.api.net.GT_Packet_TileEntityCoverGUI; + /** * For Covers with a special behavior. Has fixed storage format of 4 byte. Not very convenient... */ @@ -46,51 +47,30 @@ 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) { + 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) { + 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)); @@ -98,183 +78,150 @@ public abstract class GT_CoverBehavior extends GT_CoverBehaviorBase<ISerializabl } @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); } @Deprecated @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; } @@ -283,15 +230,8 @@ 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; } @@ -300,23 +240,16 @@ 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) { + public boolean onCoverShiftRightclick(byte aSide, int aCoverID, int aCoverVariable, ICoverable aTileEntity, + EntityPlayer aPlayer) { if (hasCoverGUI() && aPlayer instanceof EntityPlayerMP) { lastPlayer = aPlayer; mPlayerNotified = false; @@ -325,7 +258,11 @@ public abstract class GT_CoverBehavior extends GT_CoverBehaviorBase<ISerializabl } else { GT_Values.NW.sendToPlayer( new GT_Packet_TileEntityCoverGUI( - aSide, aCoverID, aCoverVariable, aTileEntity, (EntityPlayerMP) aPlayer), + aSide, + aCoverID, + aCoverVariable, + aTileEntity, + (EntityPlayerMP) aPlayer), (EntityPlayerMP) aPlayer); } return true; @@ -339,11 +276,11 @@ 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. + * 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; } @@ -422,14 +359,18 @@ public abstract class GT_CoverBehavior extends GT_CoverBehaviorBase<ISerializabl } /** - * If it lets Items into the Block, aSlot = -1 means if it is generally accepting Items (return false for no Interaction at all), aSlot = -2 means if it would accept for all Slots (return true to skip the Checks for each Slot). + * If it lets Items into the Block, aSlot = -1 means if it is generally accepting Items (return false for no + * Interaction at all), aSlot = -2 means if it would accept for all Slots (return true to skip the Checks for each + * Slot). */ public boolean letsItemsIn(byte aSide, int aCoverID, int aCoverVariable, int aSlot, ICoverable aTileEntity) { return false; } /** - * If it lets Items out of the Block, aSlot = -1 means if it is generally accepting Items (return false for no Interaction at all), aSlot = -2 means if it would accept for all Slots (return true to skip the Checks for each Slot). + * If it lets Items out of the Block, aSlot = -1 means if it is generally accepting Items (return false for no + * Interaction at all), aSlot = -2 means if it would accept for all Slots (return true to skip the Checks for each + * Slot). */ public boolean letsItemsOut(byte aSide, int aCoverID, int aCoverVariable, int aSlot, ICoverable aTileEntity) { return false; @@ -445,8 +386,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; } @@ -458,12 +399,11 @@ public abstract class GT_CoverBehavior extends GT_CoverBehaviorBase<ISerializabl } /** - * Called to determine the incoming Redstone Signal of a Machine. - * Returns the original Redstone per default. - * The Cover should @letsRedstoneGoIn or the aInputRedstone Parameter is always 0. + * Called to determine the incoming Redstone Signal of a Machine. 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 12505dff31..fed28825f3 100644 --- a/src/main/java/gregtech/api/util/GT_CoverBehaviorBase.java +++ b/src/main/java/gregtech/api/util/GT_CoverBehaviorBase.java @@ -2,11 +2,25 @@ package gregtech.api.util; import static gregtech.api.enums.GT_Values.E; +import java.util.function.Supplier; + +import javax.annotation.Nullable; + +import net.minecraft.block.Block; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.entity.player.EntityPlayerMP; +import net.minecraft.item.ItemStack; +import net.minecraft.nbt.NBTBase; +import net.minecraft.nbt.NBTTagInt; +import net.minecraft.world.World; +import net.minecraftforge.fluids.Fluid; + import com.gtnewhorizons.modularui.api.ModularUITextures; import com.gtnewhorizons.modularui.api.drawable.ItemDrawable; import com.gtnewhorizons.modularui.api.screen.ModularWindow; import com.gtnewhorizons.modularui.common.widget.ButtonWidget; import com.gtnewhorizons.modularui.common.widget.TextWidget; + import gregtech.api.GregTech_API; import gregtech.api.enums.GT_Values; import gregtech.api.gui.GT_GUIColorOverride; @@ -16,16 +30,6 @@ import gregtech.api.interfaces.ITexture; import gregtech.api.interfaces.tileentity.ICoverable; import gregtech.api.net.GT_Packet_TileEntityCoverGUI; import gregtech.api.objects.GT_ItemStack; -import java.util.function.Supplier; -import javax.annotation.Nullable; -import net.minecraft.block.Block; -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.entity.player.EntityPlayerMP; -import net.minecraft.item.ItemStack; -import net.minecraft.nbt.NBTBase; -import net.minecraft.nbt.NBTTagInt; -import net.minecraft.world.World; -import net.minecraftforge.fluids.Fluid; /** * For Covers with a special behavior. @@ -85,20 +89,22 @@ public abstract class GT_CoverBehaviorBase<T extends ISerializableObject> { /** * Get target facade block. Does not affect rendering of **this** block. It is only used as a hint for other block * 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); } /** * Get target facade block. Does not affect rendering of **this** block. It is only used as a hint for other block * 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); } @@ -110,11 +116,12 @@ public abstract class GT_CoverBehaviorBase<T extends ISerializableObject> { } /** - * Get the special foreground 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. + * Get the special foreground 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 getSpecialCoverFGTexture( - byte aSide, int aCoverID, ISerializableObject aCoverVariable, ICoverable aTileEntity) { + public final ITexture getSpecialCoverFGTexture(byte aSide, int aCoverID, ISerializableObject aCoverVariable, + ICoverable aTileEntity) { return getSpecialCoverFGTextureImpl(aSide, aCoverID, forceCast(aCoverVariable), aTileEntity); } @@ -122,42 +129,42 @@ public abstract class GT_CoverBehaviorBase<T extends ISerializableObject> { * 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); } /** * Return whether cover data needs to be synced to client upon tile entity creation or cover placement. * - * 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. + * 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); } /** * Called before receiving data from network. Use {@link ICoverable#isClientSide()} to determine the side. */ - public final void preDataChanged( - byte aSide, - int aCoverID, - int aNewCoverId, - ISerializableObject aCoverVariable, - ISerializableObject aNewCoverVariable, - ICoverable aTileEntity) { + public final void preDataChanged(byte aSide, int aCoverID, int aNewCoverId, ISerializableObject aCoverVariable, + ISerializableObject aNewCoverVariable, ICoverable aTileEntity) { preDataChangedImpl( - aSide, aCoverID, aNewCoverId, forceCast(aCoverVariable), forceCast(aNewCoverVariable), aTileEntity); + aSide, + aCoverID, + aNewCoverId, + forceCast(aCoverVariable), + forceCast(aNewCoverVariable), + aTileEntity); } /** @@ -167,21 +174,16 @@ 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); } @@ -190,15 +192,8 @@ 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); } @@ -207,73 +202,64 @@ 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) { + 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); + 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); } @Deprecated - 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); } /** - * 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. + * 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); } /** - * Called upon Base TE being destroyed (once getDrops is called), - * thus getting called only when destroyed in survival. + * Called upon Base TE being destroyed (once getDrops is called), thus getting called only when destroyed in + * survival. */ - public final void onBaseTEDestroyed( - byte aSide, int aCoverID, ISerializableObject aCoverVariable, ICoverable aTileEntity) { + public final void onBaseTEDestroyed(byte aSide, int aCoverID, ISerializableObject aCoverVariable, + ICoverable aTileEntity) { onBaseTEDestroyedImpl(aSide, aCoverID, forceCast(aCoverVariable), aTileEntity); } /** * 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); } @@ -282,16 +268,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); } @@ -300,98 +286,101 @@ 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). + * 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). + * 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); } /** - * Called to determine the incoming Redstone Signal of a Machine. - * Returns the original Redstone per default. - * The Cover should @letsRedstoneGoIn or the aInputRedstone Parameter is always 0. + * Called to determine the incoming Redstone Signal of a Machine. 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); } @@ -407,16 +396,16 @@ public abstract class GT_CoverBehaviorBase<T extends ISerializableObject> { /** * 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 @@ -439,9 +428,8 @@ public abstract class GT_CoverBehaviorBase<T extends ISerializableObject> { } /** - * Creates {@link ModularWindow} for this cover. - * This is separated from base class, as attaching the same covers in different sides of the same tile - * needs different UI with different context. + * Creates {@link ModularWindow} for this cover. This is separated from base class, as attaching the same covers in + * different sides of the same tile needs different UI with different context. */ protected class UIFactory { @@ -481,9 +469,8 @@ public abstract class GT_CoverBehaviorBase<T extends ISerializableObject> { @Nullable public T getCoverData() { if (isCoverValid()) { - return forceCast(getUIBuildContext() - .getTile() - .getComplexCoverDataAtSide(getUIBuildContext().getCoverSide())); + return forceCast( + getUIBuildContext().getTile().getComplexCoverDataAtSide(getUIBuildContext().getCoverSide())); } else { return null; } @@ -491,15 +478,13 @@ public abstract class GT_CoverBehaviorBase<T extends ISerializableObject> { public boolean setCoverData(T data) { if (isCoverValid()) { - getUIBuildContext() - .getTile() - .receiveCoverData( - getUIBuildContext().getCoverSide(), - getUIBuildContext().getCoverID(), - data, - getUIBuildContext().getPlayer() instanceof EntityPlayerMP - ? (EntityPlayerMP) getUIBuildContext().getPlayer() - : null); + getUIBuildContext().getTile().receiveCoverData( + getUIBuildContext().getCoverSide(), + getUIBuildContext().getCoverID(), + data, + getUIBuildContext().getPlayer() instanceof EntityPlayerMP + ? (EntityPlayerMP) getUIBuildContext().getPlayer() + : null); return true; } else { return false; @@ -508,23 +493,15 @@ public abstract class GT_CoverBehaviorBase<T extends ISerializableObject> { public boolean isCoverValid() { return !getUIBuildContext().getTile().isDead() - && getUIBuildContext() - .getTile() - .getCoverBehaviorAtSideNew( - getUIBuildContext().getCoverSide()) + && getUIBuildContext().getTile().getCoverBehaviorAtSideNew(getUIBuildContext().getCoverSide()) != GregTech_API.sNoBehavior; } protected void addTitleToUI(ModularWindow.Builder builder) { ItemStack coverItem = GT_Utility.intToStack(getUIBuildContext().getCoverID()); if (coverItem != null) { - builder.widget(new ItemDrawable(coverItem) - .asWidget() - .setPos(5, 5) - .setSize(16, 16)) - .widget(new TextWidget(coverItem.getDisplayName()) - .setDefaultColor(COLOR_TITLE.get()) - .setPos(25, 9)); + builder.widget(new ItemDrawable(coverItem).asWidget().setPos(5, 5).setSize(16, 16)).widget( + new TextWidget(coverItem.getDisplayName()).setDefaultColor(COLOR_TITLE.get()).setPos(25, 9)); } } @@ -565,8 +542,8 @@ public abstract class GT_CoverBehaviorBase<T extends ISerializableObject> { return GT_Utility.intToStack(aCoverID); } - protected ITexture getSpecialCoverFGTextureImpl( - byte aSide, int aCoverID, T aCoverVariable, ICoverable aTileEntity) { + protected ITexture getSpecialCoverFGTextureImpl(byte aSide, int aCoverID, T aCoverVariable, + ICoverable aTileEntity) { return coverFGTexture; } @@ -580,23 +557,23 @@ public abstract class GT_CoverBehaviorBase<T extends ISerializableObject> { protected void onDataChangedImpl(byte aSide, int aCoverID, T aCoverVariable, ICoverable aTileEntity) {} - protected void preDataChangedImpl( - byte aSide, int aCoverID, int aNewCoverId, T aCoverVariable, T aNewCoverVariable, ICoverable aTileEntity) {} + protected void preDataChangedImpl(byte aSide, int aCoverID, int aNewCoverId, T aCoverVariable, T aNewCoverVariable, + ICoverable aTileEntity) {} protected void onDroppedImpl(byte aSide, int aCoverID, T aCoverVariable, ICoverable aTileEntity) {} protected void onBaseTEDestroyedImpl(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 false; } /** * 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; } @@ -605,15 +582,8 @@ 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; } @@ -622,23 +592,16 @@ 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; if (useModularUI()) { @@ -646,7 +609,11 @@ public abstract class GT_CoverBehaviorBase<T extends ISerializableObject> { } else { GT_Values.NW.sendToPlayer( new GT_Packet_TileEntityCoverGUI( - aSide, aCoverID, aCoverVariable, aTileEntity, (EntityPlayerMP) aPlayer), + aSide, + aCoverID, + aCoverVariable, + aTileEntity, + (EntityPlayerMP) aPlayer), (EntityPlayerMP) aPlayer); } return true; @@ -655,17 +622,17 @@ public abstract class GT_CoverBehaviorBase<T extends ISerializableObject> { } @Deprecated - 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; } /** - * 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. + * 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; } @@ -732,28 +699,32 @@ 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; } /** - * If it lets Items into the Block, aSlot = -1 means if it is generally accepting Items (return false for no Interaction at all), aSlot = -2 means if it would accept for all Slots (return true to skip the Checks for each Slot). + * If it lets Items into the Block, aSlot = -1 means if it is generally accepting Items (return false for no + * Interaction at all), aSlot = -2 means if it would accept for all Slots (return true to skip the Checks for each + * Slot). */ protected boolean letsItemsInImpl(byte aSide, int aCoverID, T aCoverVariable, int aSlot, ICoverable aTileEntity) { return false; } /** - * If it lets Items out of the Block, aSlot = -1 means if it is generally accepting Items (return false for no Interaction at all), aSlot = -2 means if it would accept for all Slots (return true to skip the Checks for each Slot). + * If it lets Items out of the Block, aSlot = -1 means if it is generally accepting Items (return false for no + * Interaction at all), aSlot = -2 means if it would accept for all Slots (return true to skip the Checks for each + * Slot). */ protected boolean letsItemsOutImpl(byte aSide, int aCoverID, T aCoverVariable, int aSlot, ICoverable aTileEntity) { return false; @@ -769,8 +740,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; } @@ -782,12 +753,11 @@ public abstract class GT_CoverBehaviorBase<T extends ISerializableObject> { } /** - * Called to determine the incoming Redstone Signal of a Machine. - * Returns the original Redstone per default. - * The Cover should @letsRedstoneGoIn or the aInputRedstone Parameter is always 0. + * Called to determine the incoming Redstone Signal of a Machine. 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; } @@ -826,7 +796,8 @@ public abstract class GT_CoverBehaviorBase<T extends ISerializableObject> { } /** - * Checks if the Cover can be placed on this. You will probably want to call {@link #isCoverPlaceable(byte, ItemStack, ICoverable)} instead. + * Checks if the Cover can be placed on this. You will probably want to call + * {@link #isCoverPlaceable(byte, ItemStack, ICoverable)} instead. */ @Deprecated public boolean isCoverPlaceable(byte aSide, GT_ItemStack aStack, ICoverable aTileEntity) { @@ -842,8 +813,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_CreativeTab.java b/src/main/java/gregtech/api/util/GT_CreativeTab.java index ccebd9d4a9..1049f40278 100644 --- a/src/main/java/gregtech/api/util/GT_CreativeTab.java +++ b/src/main/java/gregtech/api/util/GT_CreativeTab.java @@ -1,12 +1,14 @@ package gregtech.api.util; -import gregtech.api.enums.ItemList; import net.minecraft.creativetab.CreativeTabs; import net.minecraft.init.Blocks; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; +import gregtech.api.enums.ItemList; + public class GT_CreativeTab extends CreativeTabs { + public GT_CreativeTab(String aName, String aLocalName) { super("GregTech." + aName); GT_LanguageManager.addStringLocalization("itemGroup.GregTech." + aName, aLocalName); diff --git a/src/main/java/gregtech/api/util/GT_ExoticEnergyInputHelper.java b/src/main/java/gregtech/api/util/GT_ExoticEnergyInputHelper.java index 3f57cf758b..90430c9bcb 100644 --- a/src/main/java/gregtech/api/util/GT_ExoticEnergyInputHelper.java +++ b/src/main/java/gregtech/api/util/GT_ExoticEnergyInputHelper.java @@ -2,14 +2,16 @@ 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 gregtech.api.interfaces.metatileentity.IMetaTileEntity; +import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch; + public class GT_ExoticEnergyInputHelper { + /** * The Valid Types of TecTech Hatch List. */ @@ -21,9 +23,8 @@ public class GT_ExoticEnergyInputHelper { } 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()); + 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); } @@ -35,9 +36,8 @@ public class GT_ExoticEnergyInputHelper { } 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()); + 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); } @@ -59,17 +59,15 @@ public class GT_ExoticEnergyInputHelper { public static long getTotalEuMulti(Collection<? extends GT_MetaTileEntity_Hatch> hatches) { long rEU = 0L; - for (GT_MetaTileEntity_Hatch tHatch : hatches) - if (isValidMetaTileEntity(tHatch)) - rEU += tHatch.getBaseMetaTileEntity().getInputVoltage() * tHatch.maxWorkingAmperesIn(); + for (GT_MetaTileEntity_Hatch tHatch : hatches) if (isValidMetaTileEntity(tHatch)) + rEU += tHatch.getBaseMetaTileEntity().getInputVoltage() * tHatch.maxWorkingAmperesIn(); return rEU; } public static long getMaxInputVoltageMulti(Collection<? extends GT_MetaTileEntity_Hatch> hatches) { long rVoltage = 0; for (GT_MetaTileEntity_Hatch tHatch : hatches) - if (isValidMetaTileEntity(tHatch)) - rVoltage += tHatch.getBaseMetaTileEntity().getInputVoltage(); + if (isValidMetaTileEntity(tHatch)) rVoltage += tHatch.getBaseMetaTileEntity().getInputVoltage(); return rVoltage; } @@ -79,25 +77,22 @@ public class GT_ExoticEnergyInputHelper { return rVoltage; } for (GT_MetaTileEntity_Hatch tHatch : hatches) - if (isValidMetaTileEntity(tHatch)) - rVoltage += tHatch.getBaseMetaTileEntity().getInputVoltage(); + if (isValidMetaTileEntity(tHatch)) rVoltage += tHatch.getBaseMetaTileEntity().getInputVoltage(); return rVoltage / hatches.size(); } public static long getMaxInputAmpsMulti(Collection<? extends GT_MetaTileEntity_Hatch> hatches) { long rAmp = 0; for (GT_MetaTileEntity_Hatch tHatch : hatches) - if (isValidMetaTileEntity(tHatch)) - rAmp += tHatch.getBaseMetaTileEntity().getInputAmperage(); + if (isValidMetaTileEntity(tHatch)) rAmp += tHatch.getBaseMetaTileEntity().getInputAmperage(); return rAmp; } public static long getMaxWorkingInputAmpsMulti(Collection<? extends GT_MetaTileEntity_Hatch> hatches) { long rAmp = 0; - for (GT_MetaTileEntity_Hatch tHatch : hatches) - if (isValidMetaTileEntity(tHatch)) { - rAmp += tHatch.maxWorkingAmperesIn(); - } + for (GT_MetaTileEntity_Hatch tHatch : hatches) if (isValidMetaTileEntity(tHatch)) { + rAmp += tHatch.maxWorkingAmperesIn(); + } return rAmp; } diff --git a/src/main/java/gregtech/api/util/GT_FoodStat.java b/src/main/java/gregtech/api/util/GT_FoodStat.java index f9a0f50c5f..cc1616f866 100644 --- a/src/main/java/gregtech/api/util/GT_FoodStat.java +++ b/src/main/java/gregtech/api/util/GT_FoodStat.java @@ -1,16 +1,18 @@ package gregtech.api.util; -import gregtech.api.damagesources.GT_DamageSources; -import gregtech.api.enums.SoundResource; -import gregtech.api.interfaces.IFoodStat; -import gregtech.api.items.GT_MetaBase_Item; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.init.Items; import net.minecraft.item.EnumAction; import net.minecraft.item.ItemStack; import net.minecraft.potion.PotionEffect; +import gregtech.api.damagesources.GT_DamageSources; +import gregtech.api.enums.SoundResource; +import gregtech.api.interfaces.IFoodStat; +import gregtech.api.items.GT_MetaBase_Item; + public class GT_FoodStat implements IFoodStat { + private final int mFoodLevel; private final int[] mPotionEffects; private final float mSaturation; @@ -26,21 +28,12 @@ public class GT_FoodStat implements IFoodStat { * @param aEmptyContainer An empty Container (Optional) * @param aAlwaysEdible If this Item is always edible, like Golden Apples or Potions * @param aInvisibleParticles If the Particles of the Potion Effects are invisible - * @param aPotionEffects An Array of Potion Effects with %4==0 Elements as follows - * ID of a Potion Effect. 0 for none - * Duration of the Potion in Ticks - * 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] + * @param aPotionEffects An Array of Potion Effects with %4==0 Elements as follows ID of a Potion Effect. 0 for + * none Duration of the Potion in Ticks 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; @@ -78,13 +71,9 @@ public class GT_FoodStat implements IFoodStat { if (tStack != null && !aPlayer.inventory.addItemStackToInventory(tStack)) aPlayer.dropPlayerItemWithRandomChoice(tStack, true); - new WorldSpawnedEventBuilder.SoundAtEntityEventBuilder() - .setIdentifier(SoundResource.RANDOM_BURP) - .setVolume(0.5F) - .setPitch(aPlayer.worldObj.rand.nextFloat() * 0.1F + 0.9F) - .setEntity(aPlayer) - .setWorld(aPlayer.worldObj) - .run(); + new WorldSpawnedEventBuilder.SoundAtEntityEventBuilder().setIdentifier(SoundResource.RANDOM_BURP) + .setVolume(0.5F).setPitch(aPlayer.worldObj.rand.nextFloat() * 0.1F + 0.9F).setEntity(aPlayer) + .setWorld(aPlayer.worldObj).run(); if (!aPlayer.worldObj.isRemote) { if (mMilk) { @@ -92,19 +81,18 @@ 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) { - new WorldSpawnedEventBuilder.ExplosionEffectEventBuilder() - .setSmoking(true) - .setFlaming(true) - .setStrength(4f) - .setPosition(aPlayer.posX, aPlayer.posY, aPlayer.posZ) - .setEntity(aPlayer) - .setWorld(aPlayer.worldObj) - .run(); + new WorldSpawnedEventBuilder.ExplosionEffectEventBuilder().setSmoking(true).setFlaming(true) + .setStrength(4f).setPosition(aPlayer.posX, aPlayer.posY, aPlayer.posZ).setEntity(aPlayer) + .setWorld(aPlayer.worldObj).run(); aPlayer.attackEntityFrom(GT_DamageSources.getExplodingDamage(), Float.MAX_VALUE); } } diff --git a/src/main/java/gregtech/api/util/GT_Forestry_Compat.java b/src/main/java/gregtech/api/util/GT_Forestry_Compat.java index 1edfd836f3..68c20f7fa1 100644 --- a/src/main/java/gregtech/api/util/GT_Forestry_Compat.java +++ b/src/main/java/gregtech/api/util/GT_Forestry_Compat.java @@ -1,14 +1,16 @@ package gregtech.api.util; +import java.util.Map; + +import net.minecraft.item.ItemStack; +import net.minecraftforge.fluids.FluidStack; + import forestry.api.recipes.ICentrifugeRecipe; import forestry.api.recipes.ISqueezerRecipe; 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; public class GT_Forestry_Compat { @@ -16,10 +18,10 @@ public class GT_Forestry_Compat { 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")}, + 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)}, + new FluidStack[] { Materials.Honey.getFluid(100L) }, null, 500, 2, @@ -28,10 +30,10 @@ public class GT_Forestry_Compat { 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")}, + 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)}, + new FluidStack[] { Materials.Honey.getFluid(100L) }, null, 500, 2, @@ -40,10 +42,10 @@ public class GT_Forestry_Compat { 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")}, + 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)}, + new FluidStack[] { Materials.Honey.getFluid(100L) }, null, 500, 2, @@ -52,10 +54,10 @@ public class GT_Forestry_Compat { 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")}, + 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)}, + new FluidStack[] { Materials.Honey.getFluid(100L) }, null, 500, 2, @@ -64,10 +66,10 @@ public class GT_Forestry_Compat { 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")}, + new ItemStack[] { ItemList.FR_Butterfly.getWildcard(1L) }, + new ItemStack[] { ItemList.FR_Butterfly.getWithName(1L, "Scanned Butterfly") }, null, - new FluidStack[] {Materials.Honey.getFluid(100L)}, + new FluidStack[] { Materials.Honey.getFluid(100L) }, null, 500, 2, @@ -76,10 +78,10 @@ public class GT_Forestry_Compat { 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")}, + new ItemStack[] { ItemList.FR_Larvae.getWildcard(1L) }, + new ItemStack[] { ItemList.FR_Larvae.getWithName(1L, "Scanned Larvae") }, null, - new FluidStack[] {Materials.Honey.getFluid(100L)}, + new FluidStack[] { Materials.Honey.getFluid(100L) }, null, 500, 2, @@ -88,10 +90,10 @@ public class GT_Forestry_Compat { 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")}, + new ItemStack[] { ItemList.FR_Serum.getWildcard(1L) }, + new ItemStack[] { ItemList.FR_Serum.getWithName(1L, "Scanned Serum") }, null, - new FluidStack[] {Materials.Honey.getFluid(100L)}, + new FluidStack[] { Materials.Honey.getFluid(100L) }, null, 500, 2, @@ -100,10 +102,10 @@ public class GT_Forestry_Compat { 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")}, + new ItemStack[] { ItemList.FR_Caterpillar.getWildcard(1L) }, + new ItemStack[] { ItemList.FR_Caterpillar.getWithName(1L, "Scanned Caterpillar") }, null, - new FluidStack[] {Materials.Honey.getFluid(100L)}, + new FluidStack[] { Materials.Honey.getFluid(100L) }, null, 500, 2, @@ -112,10 +114,10 @@ public class GT_Forestry_Compat { 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")}, + new ItemStack[] { ItemList.FR_PollenFertile.getWildcard(1L) }, + new ItemStack[] { ItemList.FR_PollenFertile.getWithName(1L, "Scanned Pollen") }, null, - new FluidStack[] {Materials.Honey.getFluid(100L)}, + new FluidStack[] { Materials.Honey.getFluid(100L) }, null, 500, 2, @@ -136,9 +138,27 @@ public class GT_Forestry_Compat { i++; } GT_Recipe.GT_Recipe_Map.sCentrifugeRecipes.addRecipe( - true, new ItemStack[] {tRecipe.getInput()}, tOutputs, null, tChances, null, null, 128, 5, 0); + true, + new ItemStack[] { tRecipe.getInput() }, + tOutputs, + null, + tChances, + null, + null, + 128, + 5, + 0); GT_Recipe.GT_Recipe_Map.sMultiblockCentrifugeRecipes.addRecipe( - true, new ItemStack[] {tRecipe.getInput()}, tOutputs, null, tChances, null, null, 128, 5, 0); + true, + new ItemStack[] { tRecipe.getInput() }, + tOutputs, + null, + tChances, + null, + null, + 128, + 5, + 0); } } catch (Throwable e) { if (GT_Values.D1) { @@ -153,12 +173,12 @@ public class GT_Forestry_Compat { 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()}, + new ItemStack[] { tRecipe.getResources()[0] }, + new ItemStack[] { tRecipe.getRemnants() }, null, - new int[] {(int) (tRecipe.getRemnantsChance() * 10000)}, + new int[] { (int) (tRecipe.getRemnantsChance() * 10000) }, null, - new FluidStack[] {tRecipe.getFluidOutput()}, + new FluidStack[] { tRecipe.getFluidOutput() }, 32, 8, 0); 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 60e0e2649d..93c7f35746 100644 --- a/src/main/java/gregtech/api/util/GT_GC_Compat.java +++ b/src/main/java/gregtech/api/util/GT_GC_Compat.java @@ -1,15 +1,17 @@ package gregtech.api.util; -import gregtech.api.GregTech_API; import micdoodle8.mods.galacticraft.api.power.EnergySource; import micdoodle8.mods.galacticraft.api.power.EnergySource.EnergySourceAdjacent; import micdoodle8.mods.galacticraft.api.power.IEnergyHandlerGC; import micdoodle8.mods.galacticraft.api.transmission.NetworkType; import micdoodle8.mods.galacticraft.api.transmission.tile.IConnector; import micdoodle8.mods.galacticraft.core.energy.EnergyConfigHandler; + import net.minecraft.tileentity.TileEntity; import net.minecraftforge.common.util.ForgeDirection; +import gregtech.api.GregTech_API; + public class GT_GC_Compat { public static long insertEnergyInto(TileEntity tTileEntity, long aVoltage, ForgeDirection tDirection) { @@ -27,8 +29,8 @@ public class GT_GC_Compat { if (tReceived > 0) { tSizeToReceive -= tReceived; while (tSizeToReceive > 0) { - tReceived = - ((IEnergyHandlerGC) tTileEntity).receiveEnergyGC(eSource, tSizeToReceive, false); + tReceived = ((IEnergyHandlerGC) tTileEntity) + .receiveEnergyGC(eSource, tSizeToReceive, false); if (tReceived < 1) break; tSizeToReceive -= tReceived; } @@ -43,10 +45,10 @@ public class GT_GC_Compat { public static boolean canConnect(TileEntity tTileEntity, ForgeDirection tDirection) { // GC Compat - if (GregTech_API.mGalacticraft - && tTileEntity instanceof IEnergyHandlerGC + if (GregTech_API.mGalacticraft && tTileEntity instanceof IEnergyHandlerGC && (!(tTileEntity instanceof IConnector) - || ((IConnector) tTileEntity).canConnect(tDirection, NetworkType.POWER))) return true; + || ((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 d8e9289f54..96e721e9be 100644 --- a/src/main/java/gregtech/api/util/GT_HatchElementBuilder.java +++ b/src/main/java/gregtech/api/util/GT_HatchElementBuilder.java @@ -2,19 +2,10 @@ 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; -import gnu.trove.TIntCollection; -import gnu.trove.list.array.TIntArrayList; -import gnu.trove.set.hash.TIntHashSet; -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; @@ -24,8 +15,22 @@ import net.minecraft.util.IChatComponent; import net.minecraft.world.World; import net.minecraftforge.common.util.ForgeDirection; +import com.gtnewhorizon.structurelib.StructureLibAPI; +import com.gtnewhorizon.structurelib.structure.*; +import com.gtnewhorizon.structurelib.util.ItemStackPredicate; + +import gnu.trove.TIntCollection; +import gnu.trove.list.array.TIntArrayList; +import gnu.trove.set.hash.TIntHashSet; +import gregtech.api.interfaces.IHatchElement; +import gregtech.api.interfaces.metatileentity.IMetaTileEntity; +import gregtech.api.interfaces.tileentity.IGregTechTileEntity; +import gregtech.common.blocks.GT_Item_Machines; + public class GT_HatchElementBuilder<T> { - private interface Builtin {} + + private interface Builtin { + } private IGT_HatchAdder<? super T> mAdder; private int mCasingIndex = -1; @@ -47,80 +52,72 @@ public class GT_HatchElementBuilder<T> { // region composite /** - * Set all of adder, hint and hatchItemFilter. Provide a reasonable default for shouldSkip. - * TODO add doc + * Set all of adder, hint and hatchItemFilter. Provide a reasonable default for shouldSkip. TODO add doc */ @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 ", ""))); } /** * Set all of adder, hint and hatchItemFilter. Provide a reasonable default for shouldSkip. * <p> - * Will rotate through all elements - * TODO add doc + * Will rotate through all elements TODO add doc */ @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()))); } /** * Set all of adder, hint and hatchItemFilter. Provide a reasonable default for shouldSkip. * <p> - * Will rotate through all elements - * TODO add doc + * Will rotate through all elements TODO add doc */ 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()))); } /** - * Set all of adder, hint and hatchItemFilter. Provide a reasonable default for shouldSkip. - * TODO add doc + * Set all of adder, hint and hatchItemFilter. Provide a reasonable default for shouldSkip. TODO add doc */ 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 @@ -228,6 +225,7 @@ public class GT_HatchElementBuilder<T> { * This will clear the sides set by previous call to this or {@link #allowOnly(ForgeDirection...)} * <p> * Usually mandatory for multis with multiple slices, and otherwise not needed if it contains a single slice only. + * * @param facings disallowed direction in ABC coordinate system */ public GT_HatchElementBuilder<T> disallowOnly(ForgeDirection... facings) { @@ -243,6 +241,7 @@ public class GT_HatchElementBuilder<T> { * This will clear the sides set by previous call to this or {@link #disallowOnly(ForgeDirection...)} * <p> * Usually mandatory for multis with multiple slices, and otherwise not needed if it contains a single slice only. + * * @param facings allowed direction in ABC coordinate system */ public GT_HatchElementBuilder<T> allowOnly(ForgeDirection... facings) { @@ -256,9 +255,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 @@ -269,36 +268,35 @@ 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 + 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())); + .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 @@ -324,6 +322,7 @@ public class GT_HatchElementBuilder<T> { if (mHatchItemFilter == null) { // no item filter -> no placement return new IStructureElementNoPlacement<T>() { + @Override public boolean check(T t, World world, int x, int y, int z) { TileEntity tileEntity = world.getTileEntity(x, y, z); @@ -339,6 +338,7 @@ public class GT_HatchElementBuilder<T> { }; } return new IStructureElement<T>() { + private String mHint = mHatchItemType == null ? "unspecified GT hatch" : mHatchItemType.get(); @Override @@ -376,34 +376,33 @@ public class GT_HatchElementBuilder<T> { } @Override - public BlocksToPlace getBlocksToPlace( - T t, World world, int x, int y, int z, ItemStack trigger, AutoPlaceEnvironment env) { + public BlocksToPlace getBlocksToPlace(T t, World world, int x, int y, int z, ItemStack trigger, + AutoPlaceEnvironment env) { return BlocksToPlace.create(mHatchItemFilter.apply(t, trigger)); } @Deprecated @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) { return survivalPlaceBlock( - t, world, x, y, z, trigger, AutoPlaceEnvironment.fromLegacy(s, actor, chatter)); + t, + world, + x, + y, + z, + trigger, + AutoPlaceEnvironment.fromLegacy(s, actor, chatter)); } @Override - public PlaceResult survivalPlaceBlock( - T t, World world, int x, int y, int z, ItemStack trigger, AutoPlaceEnvironment env) { + public PlaceResult survivalPlaceBlock(T t, World world, int x, int y, int z, ItemStack trigger, + AutoPlaceEnvironment env) { if (mShouldSkip != null) { TileEntity tileEntity = world.getTileEntity(x, y, z); if (tileEntity instanceof IGregTechTileEntity - && mShouldSkip.test(t, (IGregTechTileEntity) tileEntity)) return PlaceResult.SKIP; + && mShouldSkip.test(t, (IGregTechTileEntity) tileEntity)) + return PlaceResult.SKIP; } if (!StructureLibAPI.isBlockTriviallyReplaceable(world, x, y, z, env.getActor())) return PlaceResult.REJECT; @@ -415,17 +414,16 @@ public class GT_HatchElementBuilder<T> { return PlaceResult.REJECT; } if (StructureUtility.survivalPlaceBlock( - taken, - ItemStackPredicate.NBTMode.IGNORE, - null, - true, - world, - x, - y, - z, - env.getSource(), - env.getActor()) - != PlaceResult.ACCEPT) { + taken, + ItemStackPredicate.NBTMode.IGNORE, + null, + true, + world, + x, + y, + z, + env.getSource(), + env.getActor()) != PlaceResult.ACCEPT) { return PlaceResult.REJECT; } // try to infer facing diff --git a/src/main/java/gregtech/api/util/GT_IBoxableWrapper.java b/src/main/java/gregtech/api/util/GT_IBoxableWrapper.java index 747ca15249..796699c261 100644 --- a/src/main/java/gregtech/api/util/GT_IBoxableWrapper.java +++ b/src/main/java/gregtech/api/util/GT_IBoxableWrapper.java @@ -1,9 +1,11 @@ package gregtech.api.util; -import ic2.api.item.IBoxable; import net.minecraft.item.ItemStack; +import ic2.api.item.IBoxable; + public class GT_IBoxableWrapper implements IBoxable { + @Override public boolean canBeStoredInToolbox(ItemStack itemstack) { return GT_Utility.isStackInList(itemstack, GT_ModHandler.sBoxableItems); diff --git a/src/main/java/gregtech/api/util/GT_ItsNotMyFaultException.java b/src/main/java/gregtech/api/util/GT_ItsNotMyFaultException.java index 174b4618e8..7097e877bd 100644 --- a/src/main/java/gregtech/api/util/GT_ItsNotMyFaultException.java +++ b/src/main/java/gregtech/api/util/GT_ItsNotMyFaultException.java @@ -1,6 +1,7 @@ package gregtech.api.util; public class GT_ItsNotMyFaultException extends RuntimeException { + private static final long serialVersionUID = -8752778866486460495L; private String mError; diff --git a/src/main/java/gregtech/api/util/GT_LanguageManager.java b/src/main/java/gregtech/api/util/GT_LanguageManager.java index a40f154035..ab077ff946 100644 --- a/src/main/java/gregtech/api/util/GT_LanguageManager.java +++ b/src/main/java/gregtech/api/util/GT_LanguageManager.java @@ -2,50 +2,47 @@ 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 cpw.mods.fml.common.registry.LanguageRegistry; +import cpw.mods.fml.relauncher.ReflectionHelper; +import gregtech.api.GregTech_API; + public class GT_LanguageManager { - public static final HashMap<String, String> TEMPMAP = new HashMap<>(), - BUFFERMAP = 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 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"); - //noinspection unchecked - stringTranslateLanguageList = - (Map<String, String>) fieldStringTranslateLanguageList.get(fieldStringTranslateInstance.get(null)); + 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)); } catch (Exception e) { e.printStackTrace(); } @@ -92,9 +89,7 @@ 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; } @@ -216,11 +211,13 @@ public class GT_LanguageManager { addStringLocalization("Interaction_DESCRIPTION_Index_065", "Emit if 5 Maintenance Needed(inverted)"); addStringLocalization("Interaction_DESCRIPTION_Index_066", "Emit if rotor needs maintenance low accuracy mod"); addStringLocalization( - "Interaction_DESCRIPTION_Index_067", "Emit if rotor needs maintenance low accuracy mod(inverted)"); + "Interaction_DESCRIPTION_Index_067", + "Emit if rotor needs maintenance low accuracy mod(inverted)"); addStringLocalization("Interaction_DESCRIPTION_Index_068", "Emit if rotor needs maintenance high accuracy mod"); addStringLocalization("Interaction_DESCRIPTION_Index_068.1", "Emit if any Player is close"); addStringLocalization( - "Interaction_DESCRIPTION_Index_069", "Emit if rotor needs maintenance high accuracy mod(inverted)"); + "Interaction_DESCRIPTION_Index_069", + "Emit if rotor needs maintenance high accuracy mod(inverted)"); addStringLocalization("Interaction_DESCRIPTION_Index_069.1", "Emit if other Player is close"); addStringLocalization("Interaction_DESCRIPTION_Index_070", "Emit if you are close"); addStringLocalization("Interaction_DESCRIPTION_Index_071", "Conducts strongest Input"); @@ -368,7 +365,8 @@ public class GT_LanguageManager { addStringLocalization("Interaction_DESCRIPTION_Index_204", "No Pollution in Chunk! HAYO!"); addStringLocalization("Interaction_DESCRIPTION_Index_206", "Scan for Assembly Line"); addStringLocalization( - "Interaction_DESCRIPTION_Index_207", "Pump speed: %dL every %d ticks, %.2f L/sec on average"); + "Interaction_DESCRIPTION_Index_207", + "Pump speed: %dL every %d ticks, %.2f L/sec on average"); addStringLocalization("Interaction_DESCRIPTION_Index_208", " L"); addStringLocalization("Interaction_DESCRIPTION_Index_209", " ticks"); addStringLocalization("Interaction_DESCRIPTION_Index_209.1", " tick"); @@ -385,7 +383,8 @@ public class GT_LanguageManager { addStringLocalization("Interaction_DESCRIPTION_Index_222", "Fluid threshold"); addStringLocalization("Interaction_DESCRIPTION_Index_222.1", "Energy threshold"); addStringLocalization( - "Interaction_DESCRIPTION_Index_223", "Single recipe locking enabled. Will lock to next recipe."); + "Interaction_DESCRIPTION_Index_223", + "Single recipe locking enabled. Will lock to next recipe."); addStringLocalization("Interaction_DESCRIPTION_Index_224", "Always On"); addStringLocalization("Interaction_DESCRIPTION_Index_225", "Active with Redstone Signal"); addStringLocalization("Interaction_DESCRIPTION_Index_226", "Inactive with Redstone Signal"); @@ -429,7 +428,8 @@ public class GT_LanguageManager { addStringLocalization("Interaction_DESCRIPTION_Index_262", "Fluid Auto Output Disabled"); addStringLocalization("Interaction_DESCRIPTION_Index_263", "Fluid Auto Output Enabled"); addStringLocalization( - "Interaction_DESCRIPTION_Index_264", "currently none, will be locked to the next that is put in"); + "Interaction_DESCRIPTION_Index_264", + "currently none, will be locked to the next that is put in"); addStringLocalization("Interaction_DESCRIPTION_Index_265", "1 specific Fluid"); addStringLocalization("Interaction_DESCRIPTION_Index_266", "Lock Fluid Mode Disabled"); addStringLocalization("Interaction_DESCRIPTION_Index_267", "Overflow Voiding Mode Disabled"); diff --git a/src/main/java/gregtech/api/util/GT_Log.java b/src/main/java/gregtech/api/util/GT_Log.java index 49f44b968b..db7edf7779 100644 --- a/src/main/java/gregtech/api/util/GT_Log.java +++ b/src/main/java/gregtech/api/util/GT_Log.java @@ -12,6 +12,7 @@ import java.util.List; * Just a simple Logging Function. If on Server, then this will point to System.out and System.err */ public class GT_Log { + public static PrintStream out = System.out; public static PrintStream err = System.err; public static PrintStream ore = new LogBuffer(); @@ -23,13 +24,15 @@ public class GT_Log { public static File mExplosionLog; public static class LogBuffer extends PrintStream { + public final List<String> mBufferedOreDictLog = new ArrayList<String>(); public LogBuffer() { super(new OutputStream() { + @Override public void write(int arg0) { - /*Do nothing*/ + /* 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 f7bfb13cb2..c5060ff93f 100644 --- a/src/main/java/gregtech/api/util/GT_ModHandler.java +++ b/src/main/java/gregtech/api/util/GT_ModHandler.java @@ -10,28 +10,6 @@ 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; -import gregtech.api.enums.GT_Values; -import gregtech.api.enums.ItemList; -import gregtech.api.enums.Materials; -import gregtech.api.enums.OreDictNames; -import gregtech.api.enums.OrePrefixes; -import gregtech.api.enums.ToolDictNames; -import gregtech.api.interfaces.IDamagableItem; -import gregtech.api.interfaces.IItemContainer; -import gregtech.api.interfaces.internal.IGT_CraftingRecipe; -import gregtech.api.objects.GT_HashSet; -import gregtech.api.objects.GT_ItemStack; -import gregtech.api.objects.ItemData; -import ic2.api.item.IBoxable; -import ic2.api.item.IC2Items; -import ic2.api.item.IElectricItem; -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; @@ -44,6 +22,7 @@ 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; @@ -69,6 +48,29 @@ import net.minecraftforge.fluids.FluidStack; import net.minecraftforge.oredict.ShapedOreRecipe; import net.minecraftforge.oredict.ShapelessOreRecipe; +import cpw.mods.fml.common.registry.GameRegistry; +import gregtech.api.GregTech_API; +import gregtech.api.enums.ConfigCategories; +import gregtech.api.enums.GT_Values; +import gregtech.api.enums.ItemList; +import gregtech.api.enums.Materials; +import gregtech.api.enums.OreDictNames; +import gregtech.api.enums.OrePrefixes; +import gregtech.api.enums.ToolDictNames; +import gregtech.api.interfaces.IDamagableItem; +import gregtech.api.interfaces.IItemContainer; +import gregtech.api.interfaces.internal.IGT_CraftingRecipe; +import gregtech.api.objects.GT_HashSet; +import gregtech.api.objects.GT_ItemStack; +import gregtech.api.objects.ItemData; +import ic2.api.item.IBoxable; +import ic2.api.item.IC2Items; +import ic2.api.item.IElectricItem; +import ic2.api.reactor.IReactorComponent; +import ic2.api.recipe.IRecipeInput; +import ic2.api.recipe.RecipeInputItemStack; +import ic2.api.recipe.RecipeOutput; + /** * NEVER INCLUDE THIS FILE IN YOUR MOD!!! * <p/> @@ -77,6 +79,7 @@ import net.minecraftforge.oredict.ShapelessOreRecipe; * Due to the many imports, this File can cause compile Problems if not all the APIs are installed */ public class GT_ModHandler { + public static final List<IRecipe> sSingleNonBlockDamagableRecipeList = new ArrayList<>(1000); private static final Map<String, ItemStack> sIC2ItemMap = new HashMap<>(); @@ -103,51 +106,50 @@ public class GT_ModHandler { 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} - }; + { 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; public static List<Integer> sSingleNonBlockDamagableRecipeList_warntOutput = new ArrayList<>(50); @@ -304,7 +306,9 @@ public class GT_ModHandler { } /** - * @param aValue the Value of this Stack, when burning inside a Furnace (200 = 1 Burn Process = 500 EU, max = 32767 (that is 81917.5 EU)), limited to Short because the vanilla Furnace otherwise can't handle it properly, stupid Mojang... + * @param aValue the Value of this Stack, when burning inside a Furnace (200 = 1 Burn Process = 500 EU, max = 32767 + * (that is 81917.5 EU)), limited to Short because the vanilla Furnace otherwise can't handle it + * properly, stupid Mojang... */ public static ItemStack setFuelValue(ItemStack aStack, short aValue) { aStack.setTagCompound(GT_Utility.getNBTContainingShort(aStack.getTagCompound(), "GT.ItemFuelValue", aValue)); @@ -312,7 +316,9 @@ public class GT_ModHandler { } /** - * @return the Value of this Stack, when burning inside a Furnace (200 = 1 Burn Process = 500 EU, max = 32767 (that is 81917.5 EU)), limited to Short because the vanilla Furnace otherwise can't handle it properly, stupid Mojang... + * @return the Value of this Stack, when burning inside a Furnace (200 = 1 Burn Process = 500 EU, max = 32767 (that + * is 81917.5 EU)), limited to Short because the vanilla Furnace otherwise can't handle it properly, stupid + * Mojang... */ public static int getFuelValue(ItemStack aStack) { return TileEntityFurnace.getItemBurnTime(aStack); @@ -341,19 +347,19 @@ 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 (!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); } /** - * Gets an Item from IndustrialCraft, but the Damage Value can be specified, and returns a Replacement Item with the same Damage if not possible + * Gets an Item from IndustrialCraft, but the Damage Value can be specified, and returns a Replacement Item with the + * same Damage if not possible */ public static ItemStack getIC2Item(String aItem, long aAmount, int aMeta, ItemStack aReplacement) { ItemStack rStack = getIC2Item(aItem, aAmount, aReplacement); @@ -402,7 +408,8 @@ public class GT_ModHandler { } /** - * Gets an Item from the specified mod, but the Damage Value can be specified, and returns a Replacement Item with the same Damage if not possible + * Gets an Item from the specified mod, but the Damage Value can be specified, and returns a Replacement Item with + * the same Damage if not possible */ public static ItemStack getModItem(String aModID, String aItem, long aAmount, int aMeta, ItemStack aReplacement) { ItemStack rStack = getModItem(aModID, aItem, aAmount, aReplacement); @@ -438,11 +445,10 @@ 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) + 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*/ + /* Do nothing */ } return true; } @@ -475,7 +481,7 @@ public class GT_ModHandler { GT_Utility.copyOrNull(aOutput), aChance); } catch (Throwable e) { - /*Do nothing*/ + /* Do nothing */ } return true; } @@ -488,7 +494,7 @@ public class GT_ModHandler { try { ic2.api.recipe.Recipes.recyclerBlacklist.add(new RecipeInputItemStack(aRecycledStack)); } catch (Throwable e) { - /*Do nothing*/ + /* Do nothing */ } return true; } @@ -513,10 +519,8 @@ public class GT_ModHandler { 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.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, @@ -527,24 +531,24 @@ public class GT_ModHandler { /** * 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; } @@ -575,8 +579,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); } @@ -584,27 +588,21 @@ 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; @@ -612,16 +610,16 @@ public class GT_ModHandler { 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}, + 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; @@ -636,13 +634,13 @@ public class GT_ModHandler { return true; } - public static boolean addImmersiveEngineeringRecipe( - ItemStack aInput, ItemStack aOutput1, ItemStack aOutput2, int aChance2, ItemStack aOutput3, int aChance3) { + 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; } @@ -656,13 +654,8 @@ 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); @@ -671,8 +664,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; } @@ -689,11 +682,8 @@ 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, + 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()) { @@ -703,11 +693,10 @@ public class GT_ModHandler { if (aAddGTRecipe && (aGTRecipeMap.findRecipe(null, false, Long.MAX_VALUE, null, tStack) == null)) { try { - if (aExcludeGTIC2Items - && ((tStack.getUnlocalizedName().contains("gt.metaitem.01") - || tStack.getUnlocalizedName().contains("gt.blockores") - || tStack.getUnlocalizedName().contains("ic2.itemCrushed") - || tStack.getUnlocalizedName().contains("ic2.itemPurifiedCrushed")))) + if (aExcludeGTIC2Items && ((tStack.getUnlocalizedName().contains("gt.metaitem.01") + || tStack.getUnlocalizedName().contains("gt.blockores") + || tStack.getUnlocalizedName().contains("ic2.itemCrushed") + || tStack.getUnlocalizedName().contains("ic2.itemPurifiedCrushed")))) continue; switch (aGTRecipeMap.mUnlocalizedName) { case "gt.recipe.macerator": @@ -715,16 +704,10 @@ public class GT_ModHandler { case "gt.recipe.compressor": aGTRecipeMap.addRecipe( true, - new ItemStack[] { - GT_Utility.copyAmount( - iRecipeInputRecipeOutputEntry - .getKey() - .getAmount(), - tStack) - }, - iRecipeInputRecipeOutputEntry - .getValue() - .items + new ItemStack[] { GT_Utility.copyAmount( + iRecipeInputRecipeOutputEntry.getKey().getAmount(), + tStack) }, + iRecipeInputRecipeOutputEntry.getValue().items .toArray(new ItemStack[0]), null, null, @@ -737,16 +720,10 @@ public class GT_ModHandler { case "gt.recipe.thermalcentrifuge": aGTRecipeMap.addRecipe( true, - new ItemStack[] { - GT_Utility.copyAmount( - iRecipeInputRecipeOutputEntry - .getKey() - .getAmount(), - tStack) - }, - iRecipeInputRecipeOutputEntry - .getValue() - .items + new ItemStack[] { GT_Utility.copyAmount( + iRecipeInputRecipeOutputEntry.getKey().getAmount(), + tStack) }, + iRecipeInputRecipeOutputEntry.getValue().items .toArray(new ItemStack[0]), null, null, @@ -762,12 +739,7 @@ public class GT_ModHandler { } } if (aRemoveIC2Recipe) - aRecipesToRemove.put( - tStack, - iRecipeInputRecipeOutputEntry - .getValue() - .items - .get(0)); + aRecipesToRemove.put(tStack, iRecipeInputRecipeOutputEntry.getValue().items.get(0)); } } } @@ -779,7 +751,7 @@ public class GT_ModHandler { try { return ic2.api.recipe.Recipes.extractor.getRecipes(); } catch (Throwable e) { - /*Do nothing*/ + /* Do nothing */ } return sExtractorRecipes; } @@ -788,7 +760,7 @@ public class GT_ModHandler { try { return ic2.api.recipe.Recipes.compressor.getRecipes(); } catch (Throwable e) { - /*Do nothing*/ + /* Do nothing */ } return sCompressorRecipes; } @@ -797,7 +769,7 @@ public class GT_ModHandler { try { return ic2.api.recipe.Recipes.macerator.getRecipes(); } catch (Throwable e) { - /*Do nothing*/ + /* Do nothing */ } return sMaceratorRecipes; } @@ -806,7 +778,7 @@ public class GT_ModHandler { try { return ic2.api.recipe.Recipes.centrifuge.getRecipes(); } catch (Throwable e) { - /*Do nothing*/ + /* Do nothing */ } return sThermalCentrifugeRecipes; } @@ -815,7 +787,7 @@ public class GT_ModHandler { try { return ic2.api.recipe.Recipes.oreWashing.getRecipes(); } catch (Throwable e) { - /*Do nothing*/ + /* Do nothing */ } return sOreWashingRecipes; } @@ -824,7 +796,7 @@ public class GT_ModHandler { try { return ic2.api.recipe.Recipes.matterAmplifier.getRecipes(); } catch (Throwable e) { - /*Do nothing*/ + /* Do nothing */ } return sMassfabRecipes; } @@ -936,9 +908,15 @@ public class GT_ModHandler { NBTTagCompound tNBT = new NBTTagCompound(); tNBT.setInteger("amplification", aValue); GT_Utility.callMethod( - ic2.api.recipe.Recipes.matterAmplifier, "addRecipe", false, false, false, aAmplifier, tNBT); + ic2.api.recipe.Recipes.matterAmplifier, + "addRecipe", + false, + false, + false, + aAmplifier, + tNBT); } catch (Throwable e) { - /*Do nothing*/ + /* Do nothing */ } return true; } @@ -950,8 +928,7 @@ 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() + 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); @@ -974,8 +951,8 @@ public class GT_ModHandler { /** * Shapeless Crafting Recipes. Deletes conflicting Recipes too. */ - public static boolean addCraftingRecipe( - ItemStack aResult, Enchantment[] aEnchantmentsAdded, int[] aEnchantmentLevelsAdded, Object[] aRecipe) { + public static boolean addCraftingRecipe(ItemStack aResult, Enchantment[] aEnchantmentsAdded, + int[] aEnchantmentLevelsAdded, Object[] aRecipe) { return addCraftingRecipe( aResult, aEnchantmentsAdded, @@ -999,25 +976,19 @@ public class GT_ModHandler { /** * Regular Crafting Recipes. Deletes conflicting Recipes too. * <p/> - * You can insert instances of IItemContainer into the Recipe Input Array directly without having to call "get(1)" on them. + * You can insert instances of IItemContainer into the Recipe Input Array directly without having to call "get(1)" + * on them. * <p/> * Enums are automatically getting their "name()"-Method called in order to deliver an OreDict String. * <p/> * Lowercase Letters are reserved for Tools. They are as follows: * <p/> - * 'b' ToolDictNames.craftingToolBlade - * 'c' ToolDictNames.craftingToolCrowbar, - * 'd' ToolDictNames.craftingToolScrewdriver, - * 'f' ToolDictNames.craftingToolFile, - * 'h' ToolDictNames.craftingToolHardHammer, - * 'i' ToolDictNames.craftingToolSolderingIron, - * 'j' ToolDictNames.craftingToolSolderingMetal, - * 'k' ToolDictNames.craftingToolKnive - * 'm' ToolDictNames.craftingToolMortar, - * 'p' ToolDictNames.craftingToolDrawplate, - * 'r' ToolDictNames.craftingToolSoftHammer, - * 's' ToolDictNames.craftingToolSaw, - * 'w' ToolDictNames.craftingToolWrench, + * 'b' ToolDictNames.craftingToolBlade 'c' ToolDictNames.craftingToolCrowbar, 'd' + * ToolDictNames.craftingToolScrewdriver, 'f' ToolDictNames.craftingToolFile, 'h' + * ToolDictNames.craftingToolHardHammer, 'i' ToolDictNames.craftingToolSolderingIron, 'j' + * ToolDictNames.craftingToolSolderingMetal, 'k' ToolDictNames.craftingToolKnive 'm' + * ToolDictNames.craftingToolMortar, 'p' ToolDictNames.craftingToolDrawplate, 'r' + * ToolDictNames.craftingToolSoftHammer, 's' ToolDictNames.craftingToolSaw, 'w' ToolDictNames.craftingToolWrench, * 'x' ToolDictNames.craftingToolWireCutter, */ public static boolean addCraftingRecipe(ItemStack aResult, Object[] aRecipe) { @@ -1027,25 +998,19 @@ public class GT_ModHandler { /** * Regular Crafting Recipes. Deletes conflicting Recipes too. * <p/> - * You can insert instances of IItemContainer into the Recipe Input Array directly without having to call "get(1)" on them. + * You can insert instances of IItemContainer into the Recipe Input Array directly without having to call "get(1)" + * on them. * <p/> * Enums are automatically getting their "name()"-Method called in order to deliver an OreDict String. * <p/> * Lowercase Letters are reserved for Tools. They are as follows: * <p/> - * 'b' ToolDictNames.craftingToolBlade - * 'c' ToolDictNames.craftingToolCrowbar, - * 'd' ToolDictNames.craftingToolScrewdriver, - * 'f' ToolDictNames.craftingToolFile, - * 'h' ToolDictNames.craftingToolHardHammer, - * 'i' ToolDictNames.craftingToolSolderingIron, - * 'j' ToolDictNames.craftingToolSolderingMetal, - * 'k' ToolDictNames.craftingToolKnive - * 'm' ToolDictNames.craftingToolMortar, - * 'p' ToolDictNames.craftingToolDrawplate, - * 'r' ToolDictNames.craftingToolSoftHammer, - * 's' ToolDictNames.craftingToolSaw, - * 'w' ToolDictNames.craftingToolWrench, + * 'b' ToolDictNames.craftingToolBlade 'c' ToolDictNames.craftingToolCrowbar, 'd' + * ToolDictNames.craftingToolScrewdriver, 'f' ToolDictNames.craftingToolFile, 'h' + * ToolDictNames.craftingToolHardHammer, 'i' ToolDictNames.craftingToolSolderingIron, 'j' + * ToolDictNames.craftingToolSolderingMetal, 'k' ToolDictNames.craftingToolKnive 'm' + * ToolDictNames.craftingToolMortar, 'p' ToolDictNames.craftingToolDrawplate, 'r' + * ToolDictNames.craftingToolSoftHammer, 's' ToolDictNames.craftingToolSaw, 'w' ToolDictNames.craftingToolWrench, * 'x' ToolDictNames.craftingToolWireCutter, */ public static boolean addCraftingRecipe(ItemStack aResult, long aBitMask, Object[] aRecipe) { @@ -1072,24 +1037,12 @@ public class GT_ModHandler { /** * 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) { + 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) { 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); @@ -1101,11 +1054,11 @@ public class GT_ModHandler { 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 + 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(); + || aRecipe[i] instanceof Character)) + aRecipe[i] = aRecipe[i].toString(); } try { @@ -1199,8 +1152,9 @@ 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; @@ -1281,23 +1235,19 @@ public class GT_ModHandler { if (aResult == null || aResult.stackSize <= 0) return false; - if (aRemoveAllOthersWithSameOutput - || aRemoveAllOthersWithSameOutputIfTheyHaveSameNBT + if (aRemoveAllOthersWithSameOutput || aRemoveAllOthersWithSameOutputIfTheyHaveSameNBT || aRemoveAllOtherShapedsWithSameOutput || aRemoveAllOtherNativeRecipes) { - if (tDoWeCareIfThereWasARecipe || !aBuffered) - tThereWasARecipe = removeRecipeByOutput( - aResult, - !aRemoveAllOthersWithSameOutputIfTheyHaveSameNBT, - aRemoveAllOtherShapedsWithSameOutput, - aRemoveAllOtherNativeRecipes) - || tThereWasARecipe; + 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(); + 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); @@ -1316,26 +1266,24 @@ public class GT_ModHandler { GT_Utility.updateItemStack(aResult); if (tThereWasARecipe || !aOnlyAddIfThereIsAnyRecipeOutputtingThis) { - if (sBufferCraftingRecipes && aBuffered) - 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)); + if (sBufferCraftingRecipes && aBuffered) 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)); } return true; } @@ -1343,10 +1291,17 @@ public class GT_ModHandler { /** * Shapeless Crafting Recipes. Deletes conflicting Recipes too. */ - public static boolean addShapelessEnchantingRecipe( - ItemStack aResult, Enchantment[] aEnchantmentsAdded, int[] aEnchantmentLevelsAdded, Object[] aRecipe) { + public static boolean addShapelessEnchantingRecipe(ItemStack aResult, Enchantment[] aEnchantmentsAdded, + int[] aEnchantmentLevelsAdded, Object[] aRecipe) { return addShapelessCraftingRecipe( - aResult, aEnchantmentsAdded, aEnchantmentLevelsAdded, true, false, false, false, aRecipe); + aResult, + aEnchantmentsAdded, + aEnchantmentLevelsAdded, + true, + false, + false, + false, + aRecipe); } /** @@ -1354,7 +1309,9 @@ public class GT_ModHandler { */ public static boolean addShapelessCraftingRecipe(ItemStack aResult, Object[] aRecipe) { return addShapelessCraftingRecipe( - aResult, RecipeBits.DO_NOT_CHECK_FOR_COLLISIONS | RecipeBits.BUFFERED, aRecipe); + aResult, + RecipeBits.DO_NOT_CHECK_FOR_COLLISIONS | RecipeBits.BUFFERED, + aRecipe); } /** @@ -1375,33 +1332,27 @@ public class GT_ModHandler { /** * 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 + else if (!(aRecipe[i] == null || aRecipe[i] instanceof ItemStack || aRecipe[i] instanceof String - || aRecipe[i] instanceof Character)) aRecipe[i] = aRecipe[i].toString(); + || aRecipe[i] instanceof Character)) + aRecipe[i] = aRecipe[i].toString(); } try { ItemStack[] tRecipe = new ItemStack[9]; int i = 0; for (Object tObject : aRecipe) { if (tObject == null) { - if (D1) - GT_Log.err.println("WARNING: Missing Item for shapeless Recipe: " - + (aResult == null ? "null" : aResult.getDisplayName())); + if (D1) 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; } @@ -1426,24 +1377,24 @@ 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)); - else - GameRegistry.addRecipe(new GT_Shapeless_Recipe( - GT_Utility.copyOrNull(aResult), - aDismantleable, - aRemovable, - aKeepNBT, - aEnchantmentsAdded, - aEnchantmentLevelsAdded, - aRecipe)); + if (sBufferCraftingRecipes && aBuffered) 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)); return true; } @@ -1467,10 +1418,8 @@ public class GT_ModHandler { */ public static boolean removeFurnaceSmeltingByOutput(ItemStack aOutput) { if (aOutput != null) { - return FurnaceRecipes.smelting() - .getSmeltingList() - .values() - .removeIf(tOutput -> GT_Utility.isStackValid(tOutput) + return FurnaceRecipes.smelting().getSmeltingList().values().removeIf( + tOutput -> GT_Utility.isStackValid(tOutput) && GT_Utility.areStacksEqual(aOutput, (ItemStack) tOutput, true)); } return false; @@ -1487,24 +1436,21 @@ 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(); + 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()) + || ((IGT_CraftingRecipe) tList.get(i)).isRemovable()) && tList.get(i).matches(aCrafting, DW)) { rReturn = tList.get(i).getCraftingResult(aCrafting); if (rReturn != null) tList.remove(i--); @@ -1527,32 +1473,26 @@ 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(); + 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); } @@ -1562,11 +1502,8 @@ public class GT_ModHandler { 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); @@ -1583,21 +1520,18 @@ 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(); for (int i = 0; i < tList_sS; i++) { IRecipe tRecipe = tList.get(i); if (aNotRemoveShapelessRecipes - && (tRecipe instanceof ShapelessRecipes || tRecipe instanceof ShapelessOreRecipe)) continue; + && (tRecipe instanceof ShapelessRecipes || tRecipe instanceof ShapelessOreRecipe)) + continue; if (aOnlyRemoveNativeHandlers) { if (!sNativeRecipeClasses.contains(tRecipe.getClass().getName())) continue; } else { @@ -1615,31 +1549,26 @@ public class GT_ModHandler { } public static boolean bulkRemoveRecipeByOutput(List<ItemStack> toRemove) { - ArrayList<IRecipe> tList = - (ArrayList<IRecipe>) CraftingManager.getInstance().getRecipeList(); + ArrayList<IRecipe> tList = (ArrayList<IRecipe>) CraftingManager.getInstance().getRecipeList(); - Set<ItemStack> setToRemove = - toRemove.parallelStream().map(GT_OreDictUnificator::get_nocopy).collect(Collectors.toSet()); + Set<ItemStack> setToRemove = toRemove.parallelStream().map(GT_OreDictUnificator::get_nocopy) + .collect(Collectors.toSet()); GT_FML_LOGGER.info("BulkRemoveRecipeByOutput: tList: " + tList.size() + " setToRemove: " + setToRemove.size()); - Set<IRecipe> tListToRemove = tList.parallelStream() - .filter(tRecipe -> { - if ((tRecipe instanceof IGT_CraftingRecipe) && !((IGT_CraftingRecipe) tRecipe).isRemovable()) - return false; - if (sSpecialRecipeClasses.contains(tRecipe.getClass().getName())) return false; - final ItemStack tStack = GT_OreDictUnificator.get_nocopy(tRecipe.getRecipeOutput()); - return setToRemove.stream().anyMatch(aOutput -> GT_Utility.areStacksEqual(tStack, aOutput, true)); - }) - .collect(Collectors.toSet()); + Set<IRecipe> tListToRemove = tList.parallelStream().filter(tRecipe -> { + if ((tRecipe instanceof IGT_CraftingRecipe) && !((IGT_CraftingRecipe) tRecipe).isRemovable()) return false; + if (sSpecialRecipeClasses.contains(tRecipe.getClass().getName())) return false; + final ItemStack tStack = GT_OreDictUnificator.get_nocopy(tRecipe.getRecipeOutput()); + return setToRemove.stream().anyMatch(aOutput -> GT_Utility.areStacksEqual(tStack, aOutput, true)); + }).collect(Collectors.toSet()); tList.removeIf(tListToRemove::contains); return true; } /** - * Checks all Crafting Handlers for Recipe Output - * Used for the Autocrafting Table + * Checks all Crafting Handlers for Recipe Output Used for the Autocrafting Table */ public static ItemStack getAllRecipeOutput(World aWorld, ItemStack... aRecipe) { if (aRecipe == null || aRecipe.length == 0) return null; @@ -1654,15 +1583,13 @@ 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) { @@ -1695,12 +1622,10 @@ public class GT_ModHandler { if (tIndex == 2) { assert tStack1 != null && tStack2 != null; - if (tStack1.getItem() == tStack2.getItem() - && tStack1.stackSize == 1 + if (tStack1.getItem() == tStack2.getItem() && tStack1.stackSize == 1 && tStack2.stackSize == 1 && tStack1.getItem().isRepairable()) { - int tNewDamage = tStack1.getMaxDamage() - + tStack1.getItemDamage() + int tNewDamage = tStack1.getMaxDamage() + tStack1.getItemDamage() - tStack2.getItemDamage() + tStack1.getMaxDamage() / 20; return new ItemStack(tStack1.getItem(), 1, tNewDamage < 0 ? 0 : tNewDamage); @@ -1711,8 +1636,7 @@ public class GT_ModHandler { } /** - * Gives you a copy of the Output from a Crafting Recipe - * Used for Recipe Detection. + * Gives you a copy of the Output from a Crafting Recipe Used for Recipe Detection. */ public static ItemStack getRecipeOutput(ItemStack... aRecipe) { return getRecipeOutput(false, true, aRecipe); @@ -1727,25 +1651,21 @@ public class GT_ModHandler { } /** - * Gives you a copy of the Output from a Crafting Recipe - * Used for Recipe Detection. + * Gives you a copy of the Output from a Crafting Recipe Used for Recipe Detection. */ @SuppressWarnings("unchecked") 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) { @@ -1761,9 +1681,8 @@ public class GT_ModHandler { ItemStack tOutput = aUncopiedStack ? iRecipe.getRecipeOutput() : iRecipe.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."); + 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."); } else { if (aUncopiedStack) return tOutput; return GT_Utility.copyOrNull(tOutput); @@ -1774,19 +1693,16 @@ public class GT_ModHandler { } /** - * Gives you a list of the Outputs from a Crafting Recipe - * If you have multiple Mods, which add Bronze Armor for example - * This also removes old Recipes from the List. + * Gives you a list of the Outputs from a Crafting Recipe If you have multiple Mods, which add Bronze Armor for + * example This also removes old Recipes from the List. */ public static List<ItemStack> getVanillyToolRecipeOutputs(ItemStack... aRecipe) { 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 + if (GT_Utility.isStackValid(tStack) && tStack.getMaxStackSize() == 1 && tStack.getMaxDamage() > 0 && !(tStack.getItem() instanceof ItemBlock) && !(tStack.getItem() instanceof IReactorComponent) @@ -1795,30 +1711,26 @@ public class GT_ModHandler { 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)) { - temp = false; - break; - } - if (tObject instanceof List && ((List) tObject).isEmpty()) { - temp = false; - break; - } + 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)) { + temp = false; + break; + } + if (tObject instanceof List && ((List) tObject).isEmpty()) { + temp = false; + break; } + } if (temp) sSingleNonBlockDamagableRecipeList.add(tRecipe); } 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; } @@ -1830,11 +1742,12 @@ 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) @@ -1843,8 +1756,8 @@ public class GT_ModHandler { } /** - * Gives you a list of the Outputs from a Crafting Recipe - * If you have multiple Mods, which add Bronze Armor for example + * Gives you a list of the Outputs from a Crafting Recipe If you have multiple Mods, which add Bronze Armor for + * example */ public static List<ItemStack> getRecipeOutputs(ItemStack... aRecipe) { return getRecipeOutputs(CraftingManager.getInstance().getRecipeList(), false, aRecipe); @@ -1853,99 +1766,87 @@ public class GT_ModHandler { private static List<IRecipe> bufferedRecipes = null; /** - * Gives you a list of the Outputs from a Crafting Recipe - * If you have multiple Mods, which add Bronze Armor for example - * Buffers a List which only has armor-alike crafting in it + * Gives you a list of the Outputs from a Crafting Recipe If you have multiple Mods, which add Bronze Armor for + * example Buffers a List which only has armor-alike crafting in it */ 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) { + 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; } - return false; - }) - .collect(Collectors.toList()); + } catch (Exception ignored) {} + return false; + }).collect(Collectors.toList()); return getRecipeOutputs(bufferedRecipes, false, aRecipe); } /** - * Gives you a list of the Outputs from a Crafting Recipe - * If you have multiple Mods, which add Bronze Armor for example + * Gives you a list of the Outputs from a Crafting Recipe If you have multiple Mods, which add Bronze Armor for + * example */ 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); + 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; - 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; - + aList.stream().filter(tRecipe -> { + if (tRecipe instanceof ShapelessRecipes || tRecipe instanceof ShapelessOreRecipe + || tRecipe instanceof IGT_CraftingRecipe) + return false; try { - matched = tRecipe.matches(aCrafting, DW); + return tRecipe.matches(aCrafting, DW); } catch (Throwable e) { e.printStackTrace(GT_Log.err); + return false; } - 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(); + }).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); + + 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(); } + } return rList; } @@ -1972,8 +1873,13 @@ 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]); } /** @@ -1983,10 +1889,8 @@ public class GT_ModHandler { 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; } @@ -1998,12 +1902,8 @@ 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 { @@ -2016,10 +1916,9 @@ 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]; @@ -2042,8 +1941,8 @@ public class GT_ModHandler { /** * Used in my own Recycler. * <p/> - * Only produces Scrap if aScrapChance == 0. aScrapChance is usually the random Number I give to the Function - * If you directly insert 0 as aScrapChance then you can check if its Recycler-Blacklisted or similar + * Only produces Scrap if aScrapChance == 0. aScrapChance is usually the random Number I give to the Function If you + * directly insert 0 as aScrapChance then you can check if its Recycler-Blacklisted or similar */ public static ItemStack getRecyclerOutput(ItemStack aInput, int aScrapChance) { if (aInput == null || aScrapChance != 0) return null; @@ -2052,12 +1951,12 @@ public class GT_ModHandler { 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*/ + /* Do nothing */ } try { return ic2.api.recipe.Recipes.recyclerBlacklist.contains(aInput) ? null : ItemList.IC2_Scrap.get(1); } catch (Throwable e) { - /*Do nothing*/ + /* Do nothing */ } return null; } @@ -2070,14 +1969,14 @@ public class GT_ModHandler { } /** - * Charges an Electric Item. Only if it's a valid Electric Item of course. - * This forces the Usage of proper Voltages (so not the transfer limits defined by the Items) unless you ignore the Transfer Limit. - * If aTier is Integer.MAX_VALUE it will ignore Tier based Limitations. + * Charges an Electric Item. Only if it's a valid Electric Item of course. This forces the Usage of proper Voltages + * (so not the transfer limits defined by the Items) unless you ignore the Transfer Limit. If aTier is + * Integer.MAX_VALUE it will ignore Tier based Limitations. * * @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); @@ -2086,44 +1985,39 @@ public class GT_ModHandler { 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)); + 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*/ + /* Do nothing */ } return 0; } /** - * Discharges an Electric Item. Only if it's a valid Electric Item for that of course. - * This forces the Usage of proper Voltages (so not the transfer limits defined by the Items) unless you ignore the Transfer Limit. - * If aTier is Integer.MAX_VALUE it will ignore Tier based Limitations. + * Discharges an Electric Item. Only if it's a valid Electric Item for that of course. This forces the Usage of + * proper Voltages (so not the transfer limits defined by the Items) unless you ignore the Transfer Limit. If aTier + * is Integer.MAX_VALUE it will ignore Tier based Limitations. * * @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 || + // 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))]); + 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))]); if (aCharge > 0) { - // int rCharge = Math.max(0, ic2.api.item.ElectricItem.manager.discharge(aStack, aCharge + + // 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, @@ -2139,7 +2033,7 @@ public class GT_ModHandler { } } } catch (Throwable e) { - /*Do nothing*/ + /* Do nothing */ } return 0; } @@ -2155,7 +2049,7 @@ public class GT_ModHandler { return ic2.api.item.ElectricItem.manager.canUse(aStack, aCharge); } } catch (Throwable e) { - /*Do nothing*/ + /* Do nothing */ } return false; } @@ -2174,7 +2068,7 @@ public class GT_ModHandler { } } } catch (Throwable e) { - /*Do nothing*/ + /* Do nothing */ } return false; } @@ -2233,8 +2127,9 @@ public class GT_ModHandler { return GT_ModHandler.useElectricItem(aStack, 10000, (EntityPlayer) aPlayer); } GT_ModHandler.useElectricItem( - aStack, (int) ic2.api.item.ElectricItem.manager.getCharge(aStack), (EntityPlayer) - aPlayer); + aStack, + (int) ic2.api.item.ElectricItem.manager.getCharge(aStack), + (EntityPlayer) aPlayer); return false; } } @@ -2291,7 +2186,7 @@ public class GT_ModHandler { return ((ic2.api.item.IElectricItem) aStack.getItem()).canProvideEnergy(aStack); } } catch (Throwable e) { - /*Do nothing*/ + /* Do nothing */ } return false; } @@ -2301,22 +2196,20 @@ public class GT_ModHandler { */ public static boolean isElectricItem(ItemStack aStack) { try { - return aStack != null - && aStack.getItem() instanceof ic2.api.item.IElectricItem + return aStack != null && aStack.getItem() instanceof ic2.api.item.IElectricItem && ((IElectricItem) aStack.getItem()).getTier(aStack) < Integer.MAX_VALUE; } catch (Throwable e) { - /*Do nothing*/ + /* Do nothing */ } return false; } public static boolean isElectricItem(ItemStack aStack, byte aTier) { try { - return aStack != null - && aStack.getItem() instanceof ic2.api.item.IElectricItem + return aStack != null && aStack.getItem() instanceof ic2.api.item.IElectricItem && ((IElectricItem) aStack.getItem()).getTier(aStack) == aTier; } catch (Throwable e) { - /*Do nothing*/ + /* Do nothing */ } return false; } @@ -2329,7 +2222,7 @@ public class GT_ModHandler { try { ic2.api.item.ItemWrapper.registerBoxable(aStack.getItem(), (IBoxable) sBoxableWrapper); } catch (Throwable ignored) { - /*Do nothing*/ + /* Do nothing */ } sBoxableItems.add(new GT_ItemStack(aStack)); } @@ -2368,6 +2261,7 @@ public class GT_ModHandler { } public static class RecipeBits { + /** * Mirrors the Recipe */ @@ -2393,7 +2287,8 @@ public class GT_ModHandler { */ public static long REVERSIBLE = B[5]; /** - * Removes all Recipes with the same Output Item regardless of NBT, unless another Recipe Deletion Bit is added too. + * Removes all Recipes with the same Output Item regardless of NBT, unless another Recipe Deletion Bit is added + * too. */ public static long DELETE_ALL_OTHER_RECIPES = B[6]; /** @@ -2427,54 +2322,47 @@ 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 + * 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 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, + ItemStack secondaryOutput) {} - 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, int secondaryChance) {} public static void addSawmillRecipe(int energy, ItemStack input, ItemStack primaryOutput) {} - public static void addSawmillRecipe( - int energy, ItemStack input, ItemStack primaryOutput, ItemStack secondaryOutput) {} + public static void addSawmillRecipe(int energy, ItemStack input, ItemStack primaryOutput, + ItemStack secondaryOutput) {} - 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, int secondaryChance) {} - public static void addSmelterRecipe( - int energy, ItemStack primaryInput, ItemStack secondaryInput, ItemStack primaryOutput) {} + 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) {} + 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 addSmelterRecipe(int energy, ItemStack primaryInput, ItemStack secondaryInput, + ItemStack primaryOutput, ItemStack secondaryOutput, int secondaryChance) {} public static void addSmelterBlastOre(Materials aMaterial) {} 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) {} 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 bd69f33a8a..e428c10c70 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 @@ -1,17 +1,19 @@ package gregtech.api.util; -import com.google.common.collect.Multimaps; -import com.google.common.collect.SetMultimap; -import com.gtnewhorizon.structurelib.StructureLibAPI; 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; +import com.google.common.collect.Multimaps; +import com.google.common.collect.SetMultimap; +import com.gtnewhorizon.structurelib.StructureLibAPI; + /** * This makes it easier to build multi tooltips, with a standardized format. <br> * Info section order should be:<br> @@ -29,13 +31,13 @@ import net.minecraft.util.StatCollector; * addMaintenanceHatch<br> * addMufflerHatch<br> * addInputBus/addInputHatch/addOutputBus/addOutputHatch, in that order<br> - * Use addStructureInfo for any comments on nonstandard structure info wherever needed - * <br> + * Use addStructureInfo for any comments on nonstandard structure info wherever needed <br> * toolTipFinisher goes at the very end<br> * <br> * 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 = ", "; @@ -87,8 +89,7 @@ public class GT_Multiblock_Tooltip_Builder { * 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 + * @param machine Name of the machine type * * @return Instance this method was called on. */ @@ -100,8 +101,7 @@ public class GT_Multiblock_Tooltip_Builder { /** * Add a basic line of information about this structure * - * @param info - * The line to be added. + * @param info The line to be added. * @return Instance this method was called on. */ public GT_Multiblock_Tooltip_Builder addInfo(String info) { @@ -123,29 +123,29 @@ public class GT_Multiblock_Tooltip_Builder { /** * Add a line telling how much this machine pollutes. * - * @param pollution - * Amount of pollution per second when active + * @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); + 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. + * 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 + * @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) { @@ -162,30 +162,48 @@ public class GT_Multiblock_Tooltip_Builder { * 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 + * @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) { + 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); + 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_dimensions + COLON + + wmin + + "-" + + wmax + + "x" + + hmin + + "-" + + hmax + + "x" + + lmin + + "-" + + lmax + + " (WxHxL)"); } sLines.add(TT_structure + COLON); return this; @@ -193,9 +211,9 @@ public class GT_Multiblock_Tooltip_Builder { /** * Add a line of information about the structure:<br> - * (indent)Controller: info - * @param info - * Positional information. + * (indent)Controller: info + * + * @param info Positional information. * @return Instance this method was called on. */ public GT_Multiblock_Tooltip_Builder addController(String info) { @@ -205,11 +223,10 @@ public class GT_Multiblock_Tooltip_Builder { /** * 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. + * (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) { @@ -220,10 +237,9 @@ public class GT_Multiblock_Tooltip_Builder { /** * 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 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) { @@ -233,9 +249,9 @@ public class GT_Multiblock_Tooltip_Builder { /** * Add a line of information about the structure:<br> - * (indent)Maintenance Hatch: info - * @param info - * Positional information. + * (indent)Maintenance Hatch: info + * + * @param info Positional information. * @return Instance this method was called on. */ public GT_Multiblock_Tooltip_Builder addMaintenanceHatch(String info) { @@ -245,9 +261,9 @@ public class GT_Multiblock_Tooltip_Builder { /** * Add a line of information about the structure:<br> - * (indent)Muffler Hatch: info - * @param info - * Location where the hatch goes + * (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) { @@ -257,9 +273,9 @@ public class GT_Multiblock_Tooltip_Builder { /** * Add a line of information about the structure:<br> - * (indent)Energy Hatch: info - * @param info - * Positional information. + * (indent)Energy Hatch: info + * + * @param info Positional information. * @return Instance this method was called on. */ public GT_Multiblock_Tooltip_Builder addEnergyHatch(String info) { @@ -269,9 +285,9 @@ public class GT_Multiblock_Tooltip_Builder { /** * Add a line of information about the structure:<br> - * (indent)Dynamo Hatch: info - * @param info - * Positional information. + * (indent)Dynamo Hatch: info + * + * @param info Positional information. * @return Instance this method was called on. */ public GT_Multiblock_Tooltip_Builder addDynamoHatch(String info) { @@ -281,9 +297,9 @@ public class GT_Multiblock_Tooltip_Builder { /** * Add a line of information about the structure:<br> - * (indent)Input Bus: info - * @param info - * Location where the bus goes + * (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) { @@ -293,9 +309,9 @@ public class GT_Multiblock_Tooltip_Builder { /** * Add a line of information about the structure:<br> - * (indent)Input Hatch: info - * @param info - * Location where the hatch goes + * (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) { @@ -305,9 +321,9 @@ public class GT_Multiblock_Tooltip_Builder { /** * Add a line of information about the structure:<br> - * (indent)Output Bus: info - * @param info - * Location where the bus goes + * (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) { @@ -317,9 +333,9 @@ public class GT_Multiblock_Tooltip_Builder { /** * Add a line of information about the structure:<br> - * (indent)Output Hatch: info - * @param info - * Location where the bus goes + * (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) { @@ -330,12 +346,10 @@ public class GT_Multiblock_Tooltip_Builder { /** * 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 + * + * @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) { @@ -459,8 +473,8 @@ public class GT_Multiblock_Tooltip_Builder { /** * Use this method to add non-standard structural info.<br> * (indent)info - * @param info - * The line to be added. + * + * @param info The line to be added. * @return Instance this method was called on. */ public GT_Multiblock_Tooltip_Builder addStructureInfo(String info) { @@ -471,6 +485,7 @@ public class GT_Multiblock_Tooltip_Builder { /** * Use this method to add non-standard structural info.<br> * (indent)info + * * @param channel the name of subchannel * @param purpose the purpose of subchannel * @return Instance this method was called on. @@ -482,8 +497,8 @@ public class GT_Multiblock_Tooltip_Builder { /** * 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. + * + * @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) { @@ -492,11 +507,11 @@ public class GT_Multiblock_Tooltip_Builder { } /** - * 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 + * 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) { @@ -509,18 +524,24 @@ public class GT_Multiblock_Tooltip_Builder { * 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 + * @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_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( + hArray = Stream + .concat( hLines.stream(), hBlocks.asMap().entrySet().stream() .map(e -> TT_dots[e.getKey() - 1] + COLON + String.join(SEPARATOR, e.getValue()))) diff --git a/src/main/java/gregtech/api/util/GT_OreDictUnificator.java b/src/main/java/gregtech/api/util/GT_OreDictUnificator.java index 959707c18f..7719b52fed 100644 --- a/src/main/java/gregtech/api/util/GT_OreDictUnificator.java +++ b/src/main/java/gregtech/api/util/GT_OreDictUnificator.java @@ -4,15 +4,6 @@ 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; -import gregtech.api.enums.OrePrefixes; -import gregtech.api.enums.SubTag; -import gregtech.api.objects.GT_ItemStack; -import gregtech.api.objects.GT_ItemStack2; -import gregtech.api.objects.ItemData; -import gregtech.api.objects.MaterialStack; import java.util.ArrayList; import java.util.Collections; import java.util.HashMap; @@ -21,11 +12,23 @@ import java.util.List; import java.util.Map; import java.util.Map.Entry; import java.util.Set; + import javax.annotation.Nullable; + import net.minecraft.init.Items; import net.minecraft.item.ItemStack; import net.minecraftforge.oredict.OreDictionary; +import gregtech.api.GregTech_API; +import gregtech.api.enums.Dyes; +import gregtech.api.enums.Materials; +import gregtech.api.enums.OrePrefixes; +import gregtech.api.enums.SubTag; +import gregtech.api.objects.GT_ItemStack; +import gregtech.api.objects.GT_ItemStack2; +import gregtech.api.objects.ItemData; +import gregtech.api.objects.MaterialStack; + /** * NEVER INCLUDE THIS FILE IN YOUR MOD!!! * <p/> @@ -36,6 +39,7 @@ import net.minecraftforge.oredict.OreDictionary; * P.S. It is intended to be named "Unificator" and not "Unifier", because that sounds more awesome. */ public class GT_OreDictUnificator { + private static final Map<String, ItemStack> sName2StackMap = new HashMap<>(); private static final Map<GT_ItemStack2, ItemData> sItemStack2DataMap = new HashMap<>(); private static final Map<GT_ItemStack2, List<ItemStack>> sUnificationTable = new HashMap<>(); @@ -50,8 +54,8 @@ public class GT_OreDictUnificator { } /** - * The Blacklist just prevents the Item from being unificated into something else. - * Useful if you have things like the Industrial Diamond, which is better than regular Diamond, but also usable in absolutely all Diamond Recipes. + * The Blacklist just prevents the Item from being unificated into something else. Useful if you have things like + * the Industrial Diamond, which is better than regular Diamond, but also usable in absolutely all Diamond Recipes. */ public static void addToBlacklist(ItemStack aStack) { if (GT_Utility.isStackValid(aStack) && !GT_Utility.isStackInList(aStack, sNoUnificationList)) @@ -70,23 +74,17 @@ public class GT_OreDictUnificator { set(aPrefix, aMaterial, aStack, true, false); } - public static void set( - OrePrefixes aPrefix, - Materials aMaterial, - ItemStack aStack, - boolean aOverwrite, + public static void set(OrePrefixes aPrefix, Materials aMaterial, ItemStack aStack, boolean aOverwrite, boolean aAlreadyRegistered) { - if (aMaterial == null - || aPrefix == null + if (aMaterial == null || aPrefix == null || GT_Utility.isStackInvalid(aStack) - || Items.feather.getDamage(aStack) == W) return; + || 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--; } @@ -126,11 +124,7 @@ public class GT_OreDictUnificator { return get(aPrefix.get(aMaterial), null, aAmount, false, aNoInvalidAmounts); } - public static ItemStack get( - Object aName, - ItemStack aReplacement, - long aAmount, - boolean aMentionPossibleTypos, + 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()); @@ -182,9 +176,9 @@ public class GT_OreDictUnificator { public static ItemStack get(boolean aUseBlackList, ItemStack aStack, boolean unsafe) { if (GT_Utility.isStackInvalid(aStack)) return null; ItemData tPrefixMaterial = getAssociation(aStack); - 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); @@ -201,21 +195,25 @@ public class GT_OreDictUnificator { } } - /** Doesn't copy the returned stack or set quantity. Be careful and do not mutate it; - * intended only to optimize comparisons */ + /** + * Doesn't copy the returned stack or set quantity. Be careful and do not mutate it; intended only to optimize + * comparisons + */ 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 */ + /** + * 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; @@ -229,8 +227,10 @@ public class GT_OreDictUnificator { return rStack; } - /** Compares the first argument against an already-unificated second argument as if - * aUseBlackList was both true and false. */ + /** + * Compares the first argument against an already-unificated second argument as if aUseBlackList was both true and + * false. + */ public static boolean isInputStackEqual(ItemStack aStack, ItemStack unified_tStack) { boolean alreadyCompared = false; if (GT_Utility.isStackInvalid(aStack)) return false; @@ -277,7 +277,7 @@ public class GT_OreDictUnificator { } } ItemStack[] aStacks = {}; - if (obj instanceof ItemStack) aStacks = new ItemStack[] {(ItemStack) obj}; + 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<>(); @@ -303,9 +303,8 @@ 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; @@ -313,12 +312,10 @@ public class GT_OreDictUnificator { } sItemStack2DataMap.put(new GT_ItemStack2(aStack), aData); if (aData.hasValidMaterialData()) { - long tValidMaterialAmount = aData.mMaterial.mMaterial.contains(SubTag.NO_RECYCLING) - ? 0 + 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 + tValidMaterialAmount += tMaterial.mMaterial.contains(SubTag.NO_RECYCLING) ? 0 : tMaterial.mAmount >= 0 ? tMaterial.mAmount : M; if (tValidMaterialAmount < M) GT_ModHandler.addToRecyclerBlackList(aStack); } @@ -327,8 +324,8 @@ public class GT_OreDictUnificator { mRunThroughTheList = false; for (Entry<GT_ItemStack2, ItemData> tEntry : sItemStack2DataMap.entrySet()) if (!tEntry.getValue().hasValidPrefixData() || tEntry.getValue().mPrefix.mAllowNormalRecycling) - GT_RecipeRegistrator.registerMaterialRecycling( - tEntry.getKey().toStack(), tEntry.getValue()); + GT_RecipeRegistrator + .registerMaterialRecycling(tEntry.getKey().toStack(), tEntry.getValue()); } } else { if (!aData.hasValidPrefixData() || aData.mPrefix.mAllowNormalRecycling) @@ -340,13 +337,11 @@ public class GT_OreDictUnificator { } } - public static void addAssociation( - OrePrefixes aPrefix, Materials aMaterial, ItemStack aStack, boolean 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)); + 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)); } @@ -513,14 +508,13 @@ public class GT_OreDictUnificator { } /** - * Fast version of {@link #getOres(Object)}, - * which doesn't call {@link System#arraycopy(Object, int, Object, int, int)} in {@link ArrayList#addAll} + * Fast version of {@link #getOres(Object)}, which doesn't call + * {@link System#arraycopy(Object, int, Object, int, int)} in {@link ArrayList#addAll} */ 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)) + return GT_Utility.isStringValid(aName) ? Collections.unmodifiableList(OreDictionary.getOres(aName)) : Collections.emptyList(); } } diff --git a/src/main/java/gregtech/api/util/GT_OverclockCalculator.java b/src/main/java/gregtech/api/util/GT_OverclockCalculator.java index 6ea873e6b4..e19c8c904b 100644 --- a/src/main/java/gregtech/api/util/GT_OverclockCalculator.java +++ b/src/main/java/gregtech/api/util/GT_OverclockCalculator.java @@ -1,6 +1,7 @@ package gregtech.api.util; public class GT_OverclockCalculator { + /** * @mAmps - Amperage of the multiblock * @mEUt - Voltage of the multiblock @@ -10,26 +11,25 @@ public class GT_OverclockCalculator { private long mAmps = 1, mEUt = 0, mRecipeEUt = 0, mRecipeAmps = 1; /** * @mEUtDiscount - Discount for EUt at the beginning of calculating overclocks, like GT++ machines - * @mSpeedBoost - Speeding/Slowing up/down the duration of a recipe at the beginning of calculating overclocks, like GT++ machines + * @mSpeedBoost - Speeding/Slowing up/down the duration of a recipe at the beginning of calculating overclocks, like + * GT++ machines * @mHeatDiscountAmont - The value used for discount final eut per 900 heat */ private float mEUtDiscount = 1, mSpeedBoost = 1, mHeatDiscountAmount = 0.95f; /** - * @mEUtIncreasePerOC - How much the bits should be moved to the left when it is overclocking (Going up, 2 meaning it is multiplied with 4x) - * @mDurationDecreasePerOC - How much the bits should be moved to the right when its overclocking (Going down, 1 meaning it is halved) + * @mEUtIncreasePerOC - How much the bits should be moved to the left when it is overclocking (Going up, 2 meaning + * it is multiplied with 4x) + * @mDurationDecreasePerOC - How much the bits should be moved to the right when its overclocking (Going down, 1 + * meaning it is halved) * @mDuration - Duration of the recipe * @mParallel - The parallel the multi has when trying to overclock * @mRecipeHeat - The min heat required for the recipe * @mMultiHeat - The heat the multi has when starting the recipe - * @mHeatPerfectOC - How much the bits should be moved to the right for each 1800 above recipe heat (Used for duration) + * @mHeatPerfectOC - How much the bits should be moved to the right for each 1800 above recipe heat (Used for + * duration) */ - private int mEUtIncreasePerOC = 2, - mDurationDecreasePerOC = 1, - mDuration = 0, - mParallel = 1, - mRecipeHeat = 0, - mMultiHeat = 0, - mHeatPerfectOC = 2; + private int mEUtIncreasePerOC = 2, mDurationDecreasePerOC = 1, mDuration = 0, mParallel = 1, mRecipeHeat = 0, + mMultiHeat = 0, mHeatPerfectOC = 2; /** * @mHeatOC - Whether to enable overclocking with heat like the EBF every 1800 heat difference * @mOneTickDiscount - Whether to give EUt Discount when the duration goes below one tick @@ -40,6 +40,7 @@ public class GT_OverclockCalculator { private static final int HEAT_DISCOUNT_THRESHOLD = 900; private static final int HEAT_PERFECT_OVERCLOCK_THRESHOLD = 1800; + /** * An Overclock helper for calculating overclocks in many different situations */ @@ -150,8 +151,8 @@ public class GT_OverclockCalculator { } /** - * Sets the heat discount during OC calculation if HeatOC is used. Default: 0.95 = 5% discount - * Used like a EU/t Discount + * Sets the heat discount during OC calculation if HeatOC is used. Default: 0.95 = 5% discount Used like a EU/t + * Discount */ public GT_OverclockCalculator setHeatDiscount(float aHeatDiscount) { mHeatDiscountAmount = aHeatDiscount; @@ -159,7 +160,8 @@ public class GT_OverclockCalculator { } /** - * Sets the Overclock that should be calculated when one. This uses BitShifting! Default is 2, which is a 4x decrease + * Sets the Overclock that should be calculated when one. This uses BitShifting! Default is 2, which is a 4x + * decrease */ public GT_OverclockCalculator setHeatPerfectOC(int aHeatPerfectOC) { mHeatPerfectOC = aHeatPerfectOC; @@ -167,7 +169,7 @@ public class GT_OverclockCalculator { } /** - * Sets the amount that the EUt increases per overclock. This uses BitShifting! Default is 2, which is a 4x increase + * Sets the amount that the EUt increases per overclock. This uses BitShifting! Default is 2, which is a 4x increase */ public GT_OverclockCalculator setEUtIncreasePerOC(int aEUtIncreasePerOC) { mEUtIncreasePerOC = aEUtIncreasePerOC; @@ -175,7 +177,8 @@ public class GT_OverclockCalculator { } /** - * Sets the amount that the duration decreases per overclock. This uses BitShifting! Default is 1, which halves the duration + * Sets the amount that the duration decreases per overclock. This uses BitShifting! Default is 1, which halves the + * duration */ public GT_OverclockCalculator setDurationDecreasePerOC(int aDurationDecreasePerOC) { mDurationDecreasePerOC = aDurationDecreasePerOC; @@ -183,7 +186,8 @@ public class GT_OverclockCalculator { } /** - * Enables One Tick Discount on EUt based on Duration Decrease Per Overclock. This functions the same as single blocks. + * Enables One Tick Discount on EUt based on Duration Decrease Per Overclock. This functions the same as single + * blocks. */ public GT_OverclockCalculator enableOneTickDiscount() { mOneTickDiscount = true; @@ -223,8 +227,8 @@ public class GT_OverclockCalculator { if (tRecipeTier == 0) { int tTier = GT_Utility.getTier(mEUt); int tTierDifference = tTier - 1; - long tNextConsumption = - ((long) Math.ceil(mRecipeEUt * mParallel * mRecipeAmps * mEUtDiscount)) << mEUtIncreasePerOC; + long tNextConsumption = ((long) Math.ceil(mRecipeEUt * mParallel * mRecipeAmps * mEUtDiscount)) + << mEUtIncreasePerOC; while (tTierDifference > 0 && tNextConsumption < mEUt * mAmps) { mRecipeEUt <<= mEUtIncreasePerOC; mDuration >>= mDurationDecreasePerOC; @@ -232,8 +236,8 @@ public class GT_OverclockCalculator { tTierDifference--; } } else { - long tNextConsumption = - ((long) Math.ceil(mRecipeEUt * mParallel * mRecipeAmps * mEUtDiscount)) << mEUtIncreasePerOC; + long tNextConsumption = ((long) Math.ceil(mRecipeEUt * mParallel * mRecipeAmps * mEUtDiscount)) + << mEUtIncreasePerOC; while (tNextConsumption < mEUt * mAmps) { if (mDuration <= 1) { break; diff --git a/src/main/java/gregtech/api/util/GT_PCBFactoryManager.java b/src/main/java/gregtech/api/util/GT_PCBFactoryManager.java index 1543a9d2a6..dfc2af49ff 100644 --- a/src/main/java/gregtech/api/util/GT_PCBFactoryManager.java +++ b/src/main/java/gregtech/api/util/GT_PCBFactoryManager.java @@ -4,6 +4,7 @@ import com.google.common.collect.HashBiMap; import gregtech.api.enums.Materials; public class GT_PCBFactoryManager { + private static final HashBiMap<Materials, Integer> mPlasticTiers = HashBiMap.create(); public static int mTiersOfPlastics = 0; diff --git a/src/main/java/gregtech/api/util/GT_ParallelHelper.java b/src/main/java/gregtech/api/util/GT_ParallelHelper.java index 7f32d95d1e..c493184424 100644 --- a/src/main/java/gregtech/api/util/GT_ParallelHelper.java +++ b/src/main/java/gregtech/api/util/GT_ParallelHelper.java @@ -1,25 +1,30 @@ package gregtech.api.util; -import com.gtnewhorizon.gtnhlib.util.map.ItemStackMap; -import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch; -import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch_Output; -import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_MultiBlockBase; -import gregtech.api.multitileentity.multiblock.base.MultiBlockController; -import gregtech.api.objects.XSTR; -import gregtech.common.tileentities.machines.GT_MetaTileEntity_Hatch_OutputBus_ME; -import gregtech.common.tileentities.machines.GT_MetaTileEntity_Hatch_Output_ME; import java.util.Comparator; import java.util.HashMap; import java.util.Map; import java.util.Map.Entry; import java.util.PriorityQueue; + import net.minecraft.inventory.IInventory; import net.minecraft.item.ItemStack; import net.minecraftforge.fluids.FluidStack; + import org.apache.commons.lang3.tuple.MutablePair; import org.apache.commons.lang3.tuple.MutableTriple; +import com.gtnewhorizon.gtnhlib.util.map.ItemStackMap; + +import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch; +import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch_Output; +import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_MultiBlockBase; +import gregtech.api.multitileentity.multiblock.base.MultiBlockController; +import gregtech.api.objects.XSTR; +import gregtech.common.tileentities.machines.GT_MetaTileEntity_Hatch_OutputBus_ME; +import gregtech.common.tileentities.machines.GT_MetaTileEntity_Hatch_Output_ME; + public class GT_ParallelHelper { + /** * @mMachineMeta a MetaTileEntity Controller */ @@ -39,7 +44,8 @@ public class GT_ParallelHelper { /** * @mCurrentParallel The current parallel possible for the multiblock * @mMaxParallel The maximum possible parallel possible for the multiblock - * @mBatchModifier The Batch Modifier applied when batch mode is enabled. 1 does nothing. 2 doubles max possible parallel, but also duration + * @mBatchModifier The Batch Modifier applied when batch mode is enabled. 1 does nothing. 2 doubles max possible + * parallel, but also duration */ private int mCurrentParallel = 0, mMaxParallel = 1, mBatchModifier = 1; /** @@ -56,7 +62,8 @@ public class GT_ParallelHelper { * @mVoidProtection Does the multi have void protection enabled * @mConsume Should the Parallel Helper automatically consume for the multi * @mBatchMode Is batch mode turned on? - * @mCalculateOutputs Should the Parallel Helper automatically calculate the outputs of the recipe with current parallel + * @mCalculateOutputs Should the Parallel Helper automatically calculate the outputs of the recipe with current + * parallel * @mBuilt Has the Parallel Helper been built? */ private boolean mVoidProtection, mConsume, mBatchMode, mCalculateOutputs, mBuilt; @@ -143,8 +150,8 @@ public class GT_ParallelHelper { } /** - * Enables Batch mode. Can do up to an additional processed recipes of mCurrentParallel * mBatchModifier - * A batch modifier of 1 does nothing + * Enables Batch mode. Can do up to an additional processed recipes of mCurrentParallel * mBatchModifier A batch + * modifier of 1 does nothing */ public GT_ParallelHelper enableBatchMode(int aBatchModifier) { mBatchMode = true; @@ -153,7 +160,8 @@ public class GT_ParallelHelper { } /** - * Enables the outputs to be calculated with its current Parallels, useful if one isn't doing anything special with outputs + * Enables the outputs to be calculated with its current Parallels, useful if one isn't doing anything special with + * outputs */ public GT_ParallelHelper enableOutputCalculation() { mCalculateOutputs = true; @@ -278,9 +286,8 @@ public class GT_ParallelHelper { float tRecipeEUt = mRecipe.mEUt * mEUtModifier; // Consume inputs to determine normal parallel - for (; - mCurrentParallel < mMaxParallel / mBatchModifier && tCurrentUsage < (mAvailableEUt - tRecipeEUt); - mCurrentParallel++) { + for (; mCurrentParallel < mMaxParallel / mBatchModifier + && tCurrentUsage < (mAvailableEUt - tRecipeEUt); mCurrentParallel++) { if (mRecipe.isRecipeInputEqual(true, false, tFluidInputs, tItemInputs)) { tCurrentUsage += tRecipeEUt; } else { @@ -373,10 +380,8 @@ public class GT_ParallelHelper { if (!tHatch.outputsLiquids()) { continue; } - if (tHatch.isFluidLocked() - && tLockedFluidName != null - && !tLockedFluidName.equals( - tFluidOutput.getFluid().getName())) { + if (tHatch.isFluidLocked() && tLockedFluidName != null + && !tLockedFluidName.equals(tFluidOutput.getFluid().getName())) { continue; } } @@ -391,8 +396,8 @@ public class GT_ParallelHelper { } // now that all partial/restricted hatches have been counted, create a priority queue for our outputs // the lowest priority fluid is the number of complete parallel crafts we can support - PriorityQueue<MutableTriple<Integer, Integer, FluidStack>> aParallelQueue = - new PriorityQueue<>(Comparator.comparing(MutableTriple::getLeft)); + PriorityQueue<MutableTriple<Integer, Integer, FluidStack>> aParallelQueue = new PriorityQueue<>( + Comparator.comparing(MutableTriple::getLeft)); for (Entry<FluidStack, MutablePair<Integer, Integer>> entry : tParallels.entrySet()) { aParallelQueue.add(new MutableTriple<>(entry.getValue().left, entry.getValue().right, entry.getKey())); } @@ -470,8 +475,8 @@ public class GT_ParallelHelper { } // now that all partial stacks have been counted, create a priority queue for our outputs // the lowest priority item is the number of complete parallel crafts we can support - PriorityQueue<MutableTriple<Integer, Integer, ItemStack>> aParallelQueue = - new PriorityQueue<>(Comparator.comparing(MutableTriple::getLeft)); + PriorityQueue<MutableTriple<Integer, Integer, ItemStack>> aParallelQueue = new PriorityQueue<>( + Comparator.comparing(MutableTriple::getLeft)); for (Entry<ItemStack, MutablePair<Integer, Integer>> entry : tParallels.entrySet()) { aParallelQueue.add(new MutableTriple<>(entry.getValue().left, entry.getValue().right, entry.getKey())); } diff --git a/src/main/java/gregtech/api/util/GT_PlayedSound.java b/src/main/java/gregtech/api/util/GT_PlayedSound.java index 87743517d0..cdafc010d7 100644 --- a/src/main/java/gregtech/api/util/GT_PlayedSound.java +++ b/src/main/java/gregtech/api/util/GT_PlayedSound.java @@ -5,6 +5,7 @@ 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,8 +28,7 @@ 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 + return ((GT_PlayedSound) aObject).mX == mX && ((GT_PlayedSound) aObject).mY == mY && ((GT_PlayedSound) aObject).mZ == mZ && ((GT_PlayedSound) aObject).mSoundName.equals(mSoundName); } 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 548795cc49..923402c5d9 100644 --- a/src/main/java/gregtech/api/util/GT_ProcessingArray_Manager.java +++ b/src/main/java/gregtech/api/util/GT_ProcessingArray_Manager.java @@ -1,18 +1,21 @@ package gregtech.api.util; -import gregtech.api.util.GT_Recipe.GT_Recipe_Map; import java.util.HashMap; +import gregtech.api.util.GT_Recipe.GT_Recipe_Map; + 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 + // 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. public static GT_Recipe_Map giveRecipeMap(String aMachineName) { if (aMachineName != null) { diff --git a/src/main/java/gregtech/api/util/GT_Recipe.java b/src/main/java/gregtech/api/util/GT_Recipe.java index c538028770..895dbf5ac3 100644 --- a/src/main/java/gregtech/api/util/GT_Recipe.java +++ b/src/main/java/gregtech/api/util/GT_Recipe.java @@ -3,7 +3,33 @@ package gregtech.api.util; import static gregtech.api.enums.GT_Values.*; import static net.minecraft.util.EnumChatFormatting.GRAY; +import java.awt.*; +import java.util.*; +import java.util.List; +import java.util.concurrent.atomic.AtomicInteger; +import java.util.function.Supplier; + +import javax.annotation.Nullable; + +import net.minecraft.client.Minecraft; +import net.minecraft.client.gui.FontRenderer; +import net.minecraft.init.Blocks; +import net.minecraft.init.Items; +import net.minecraft.item.Item; +import net.minecraft.item.ItemStack; +import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.tileentity.TileEntityFurnace; +import net.minecraft.util.EnumChatFormatting; +import net.minecraftforge.fluids.Fluid; +import net.minecraftforge.fluids.FluidContainerRegistry; +import net.minecraftforge.fluids.FluidStack; +import net.minecraftforge.fluids.IFluidContainerItem; + +import org.apache.commons.lang3.tuple.ImmutablePair; +import org.apache.commons.lang3.tuple.Pair; + import codechicken.nei.PositionedStack; + import com.gtnewhorizons.modularui.api.GlStateManager; import com.gtnewhorizons.modularui.api.ModularUITextures; import com.gtnewhorizons.modularui.api.drawable.FallbackableUITexture; @@ -17,6 +43,7 @@ import com.gtnewhorizons.modularui.api.screen.ModularWindow; import com.gtnewhorizons.modularui.common.widget.DrawableWidget; import com.gtnewhorizons.modularui.common.widget.ProgressBar; import com.gtnewhorizons.modularui.common.widget.SlotWidget; + import cpw.mods.fml.common.Loader; import cpw.mods.fml.common.ModContainer; import gnu.trove.map.TByteObjectMap; @@ -47,53 +74,40 @@ import gregtech.nei.HeatingCoilSpecialValueFormatter; import gregtech.nei.INEISpecialInfoFormatter; import gregtech.nei.NEIRecipeInfo; import ic2.core.Ic2Items; -import java.awt.*; -import java.util.*; -import java.util.List; -import java.util.concurrent.atomic.AtomicInteger; -import java.util.function.Supplier; -import javax.annotation.Nullable; -import net.minecraft.client.Minecraft; -import net.minecraft.client.gui.FontRenderer; -import net.minecraft.init.Blocks; -import net.minecraft.init.Items; -import net.minecraft.item.Item; -import net.minecraft.item.ItemStack; -import net.minecraft.nbt.NBTTagCompound; -import net.minecraft.tileentity.TileEntityFurnace; -import net.minecraft.util.EnumChatFormatting; -import net.minecraftforge.fluids.Fluid; -import net.minecraftforge.fluids.FluidContainerRegistry; -import net.minecraftforge.fluids.FluidStack; -import net.minecraftforge.fluids.IFluidContainerItem; -import org.apache.commons.lang3.tuple.ImmutablePair; -import org.apache.commons.lang3.tuple.Pair; /** * NEVER INCLUDE THIS FILE IN YOUR MOD!!! * <p/> - * This File contains the functions used for Recipes. Please do not include this File AT ALL in your Moddownload as it ruins compatibility - * This is just the Core of my Recipe System, if you just want to GET the Recipes I add, then you can access this File. - * Do NOT add Recipes using the Constructors inside this Class, The GregTech_API File calls the correct Functions for these Constructors. + * This File contains the functions used for Recipes. Please do not include this File AT ALL in your Moddownload as it + * ruins compatibility This is just the Core of my Recipe System, if you just want to GET the Recipes I add, then you + * can access this File. Do NOT add Recipes using the Constructors inside this Class, The GregTech_API File calls the + * correct Functions for these Constructors. * <p/> - * I know this File causes some Errors, because of missing Main Functions, but if you just need to compile Stuff, then remove said erroreous Functions. + * I know this File causes some Errors, because of missing Main Functions, but if you just need to compile Stuff, then + * remove said erroreous Functions. */ public class GT_Recipe implements Comparable<GT_Recipe> { + public static volatile int VERSION = 509; /** - * If you want to change the Output, feel free to modify or even replace the whole ItemStack Array, for Inputs, please add a new Recipe, because of the HashMaps. + * If you want to change the Output, feel free to modify or even replace the whole ItemStack Array, for Inputs, + * please add a new Recipe, because of the HashMaps. */ public ItemStack[] mInputs, mOutputs; /** - * If you want to change the Output, feel free to modify or even replace the whole ItemStack Array, for Inputs, please add a new Recipe, because of the HashMaps. + * If you want to change the Output, feel free to modify or even replace the whole ItemStack Array, for Inputs, + * please add a new Recipe, because of the HashMaps. */ public FluidStack[] mFluidInputs, mFluidOutputs; /** - * If you changed the amount of Array-Items inside the Output Array then the length of this Array must be larger or equal to the Output Array. A chance of 10000 equals 100% + * If you changed the amount of Array-Items inside the Output Array then the length of this Array must be larger or + * equal to the Output Array. A chance of 10000 equals 100% */ public int[] mChances; /** - * 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. + * 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; @@ -107,11 +121,14 @@ public class GT_Recipe implements Comparable<GT_Recipe> { */ public boolean mHidden = false; /** - * If this Recipe is Fake and therefore doesn't get found by the findRecipe Function (It is still in the HashMaps, so that containsInput does return T on those fake Inputs) + * If this Recipe is Fake and therefore doesn't get found by the findRecipe Function (It is still in the HashMaps, + * so that containsInput does return T on those fake Inputs) */ public boolean mFakeRecipe = false; /** - * If this Recipe can be stored inside a Machine in order to make Recipe searching more Efficient by trying the previously used Recipe first. In case you have a Recipe Map overriding things and returning one time use Recipes, you have to set this to F. + * If this Recipe can be stored inside a Machine in order to make Recipe searching more Efficient by trying the + * previously used Recipe first. In case you have a Recipe Map overriding things and returning one time use Recipes, + * you have to set this to F. */ public boolean mCanBeBuffered = true; /** @@ -150,17 +167,8 @@ 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) { + 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]; @@ -183,17 +191,16 @@ public class GT_Recipe implements Comparable<GT_Recipe> { 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) - for (int j = 0; j < aOutputs.length; j++) { - if (GT_Utility.areStacksEqual(aInput, aOutputs[j]) && aChances[j] >= 10000) { - if (aInput.stackSize >= aOutputs[j].stackSize) { - aInput.stackSize -= aOutputs[j].stackSize; - aOutputs[j] = null; - } else { - aOutputs[j].stackSize -= aInput.stackSize; - } + if (aInput != null && Items.feather.getDamage(aInput) != W) for (int j = 0; j < aOutputs.length; j++) { + if (GT_Utility.areStacksEqual(aInput, aOutputs[j]) && aChances[j] >= 10000) { + if (aInput.stackSize >= aOutputs[j].stackSize) { + aInput.stackSize -= aOutputs[j].stackSize; + aOutputs[j] = null; + } else { + aOutputs[j].stackSize -= aInput.stackSize; } } + } if (aOptimize && aDuration >= 32) { ArrayList<ItemStack> tList = new ArrayList<>(); @@ -201,33 +208,27 @@ public class GT_Recipe implements Comparable<GT_Recipe> { tList.addAll(Arrays.asList(aOutputs)); for (int i = 0; i < tList.size(); i++) if (tList.get(i) == null) tList.remove(i--); - for (byte i = (byte) Math.min(64, aDuration / 16); i > 1; i--) - if (aDuration / i >= 16) { - boolean temp = true; - for (ItemStack stack : tList) - if (stack.stackSize % i != 0) { - temp = false; - break; - } - if (temp) - for (FluidStack aFluidInput : aFluidInputs) - if (aFluidInput.amount % i != 0) { - temp = false; - break; - } - if (temp) - for (FluidStack aFluidOutput : aFluidOutputs) - if (aFluidOutput.amount % i != 0) { - temp = false; - break; - } - if (temp) { - for (ItemStack itemStack : tList) itemStack.stackSize /= i; - for (FluidStack aFluidInput : aFluidInputs) aFluidInput.amount /= i; - for (FluidStack aFluidOutput : aFluidOutputs) aFluidOutput.amount /= i; - aDuration /= i; - } + for (byte i = (byte) Math.min(64, aDuration / 16); i > 1; i--) if (aDuration / i >= 16) { + boolean temp = true; + for (ItemStack stack : tList) if (stack.stackSize % i != 0) { + temp = false; + break; + } + if (temp) for (FluidStack aFluidInput : aFluidInputs) if (aFluidInput.amount % i != 0) { + temp = false; + break; + } + if (temp) for (FluidStack aFluidOutput : aFluidOutputs) if (aFluidOutput.amount % i != 0) { + temp = false; + break; + } + if (temp) { + for (ItemStack itemStack : tList) itemStack.stackSize /= i; + for (FluidStack aFluidInput : aFluidInputs) aFluidInput.amount /= i; + for (FluidStack aFluidOutput : aFluidOutputs) aFluidOutput.amount /= i; + aDuration /= i; } + } } mInputs = aInputs; @@ -239,7 +240,7 @@ public class GT_Recipe implements Comparable<GT_Recipe> { mDuration = aDuration; mSpecialValue = aSpecialValue; mEUt = aEUt; - // checkCellBalance(); + // checkCellBalance(); reloadOwner(); } @@ -249,22 +250,16 @@ public class GT_Recipe implements Comparable<GT_Recipe> { private static FluidStack[] tryGetFluidInputsFromCells(ItemStack aInput) { FluidStack tFluid = GT_Utility.getFluidForFilledItem(aInput, true); - return tFluid == null ? null : new FluidStack[] {tFluid}; + return tFluid == null ? null : new FluidStack[] { tFluid }; } // 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) { + 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}, + new ItemStack[] { aInput1 }, + new ItemStack[] { aOutput1, aOutput2, aOutput3, aOutput4 }, null, null, null, @@ -275,28 +270,28 @@ public class GT_Recipe implements Comparable<GT_Recipe> { 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); @@ -305,16 +300,16 @@ public class GT_Recipe implements Comparable<GT_Recipe> { } } - public GT_Recipe( - FluidStack aInput1, FluidStack aInput2, FluidStack aOutput1, int aDuration, int aEUt, int aSpecialValue) { + 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}, + new FluidStack[] { aInput1, aInput2 }, + new FluidStack[] { aOutput1 }, Math.max(aDuration, 1), aEUt, Math.max(Math.min(aSpecialValue, 160000000), 0)); @@ -326,8 +321,8 @@ public class GT_Recipe implements Comparable<GT_Recipe> { public GT_Recipe(ItemStack aInput1, ItemStack aOutput1, ItemStack aOutput2, int aDuration, int aEUt) { this( true, - new ItemStack[] {aInput1}, - new ItemStack[] {aOutput1, aOutput2}, + new ItemStack[] { aInput1 }, + new ItemStack[] { aOutput1, aOutput2 }, null, null, null, @@ -340,21 +335,13 @@ public class GT_Recipe implements Comparable<GT_Recipe> { } } - public GT_Recipe( - ItemStack aInput1, - int aCellAmount, - ItemStack aOutput1, - ItemStack aOutput2, - ItemStack aOutput3, - ItemStack aOutput4, - int aDuration, - int aEUt) { + 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}, + 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, @@ -370,14 +357,12 @@ public class GT_Recipe implements Comparable<GT_Recipe> { 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}, + 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, @@ -393,8 +378,8 @@ public class GT_Recipe implements Comparable<GT_Recipe> { 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}, + new ItemStack[] { aInput1, ItemList.Circuit_Integrated.getWithDamage(0, aInput1.stackSize) }, + new ItemStack[] { aOutput1 }, null, null, null, @@ -410,8 +395,8 @@ public class GT_Recipe implements Comparable<GT_Recipe> { 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}, + aInput2 == null ? new ItemStack[] { aInput1 } : new ItemStack[] { aInput1, aInput2 }, + new ItemStack[] { aOutput1 }, null, null, null, @@ -424,12 +409,12 @@ public class GT_Recipe implements Comparable<GT_Recipe> { } } - public GT_Recipe( - ItemStack aInput1, int aEUt, ItemStack aInput2, int aDuration, ItemStack aOutput1, ItemStack aOutput2) { + 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}, + aInput2 == null ? new ItemStack[] { aInput1 } : new ItemStack[] { aInput1, aInput2 }, + new ItemStack[] { aOutput1, aOutput2 }, null, null, null, @@ -445,8 +430,8 @@ public class GT_Recipe implements Comparable<GT_Recipe> { public GT_Recipe(ItemStack aInput1, ItemStack aOutput1, int aDuration) { this( true, - new ItemStack[] {aInput1}, - new ItemStack[] {aOutput1}, + new ItemStack[] { aInput1 }, + new ItemStack[] { aOutput1 }, null, null, null, @@ -462,8 +447,8 @@ public class GT_Recipe implements Comparable<GT_Recipe> { public GT_Recipe(ItemStack aInput1, ItemStack aOutput1, int aDuration, int aEUt, int VACUUM) { this( true, - new ItemStack[] {aInput1}, - new ItemStack[] {aOutput1}, + new ItemStack[] { aInput1 }, + new ItemStack[] { aOutput1 }, null, null, null, @@ -483,8 +468,8 @@ public class GT_Recipe implements Comparable<GT_Recipe> { null, null, null, - new FluidStack[] {aInput1}, - new FluidStack[] {aOutput1}, + new FluidStack[] { aInput1 }, + new FluidStack[] { aOutput1 }, Math.max(aDuration, 1), aEUt, 0); @@ -494,16 +479,8 @@ public class GT_Recipe implements Comparable<GT_Recipe> { } // 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) { + public GT_Recipe(ItemStack[] aInputs, ItemStack[] aOutputs, Object aSpecialItems, int[] aChances, + FluidStack[] aFluidInputs, FluidStack[] aFluidOutputs, int aDuration, int aEUt, int aSpecialValue) { this( true, aInputs, @@ -575,45 +552,40 @@ 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, 1, aFluidInputs, aInputs); } // For non-multiplied recipe amount values - public boolean isRecipeInputEqual( - boolean aDecreaseStacksizeBySuccess, - boolean aDontCheckStackSizes, - FluidStack[] aFluidInputs, - ItemStack... aInputs) { + public boolean isRecipeInputEqual(boolean aDecreaseStacksizeBySuccess, boolean aDontCheckStackSizes, + FluidStack[] aFluidInputs, ItemStack... aInputs) { return isRecipeInputEqual(aDecreaseStacksizeBySuccess, aDontCheckStackSizes, 1, aFluidInputs, aInputs); } /** * Okay, did some code archeology to figure out what's going on here. * - * <p>This variable was added in - * <a href=https://github.com/GTNewHorizons/GT5-Unofficial/commit/9959ab7443982a19ad329bca424ab515493432e9>this commit,</a> - * in order to fix the issues mentioned in - * <a href=https://github.com/GTNewHorizons/GT5-Unofficial/pull/183>the PR</a>. + * <p> + * This variable was added in <a + * href=https://github.com/GTNewHorizons/GT5-Unofficial/commit/9959ab7443982a19ad329bca424ab515493432e9>this + * commit,</a> in order to fix the issues mentioned in <a + * href=https://github.com/GTNewHorizons/GT5-Unofficial/pull/183>the PR</a>. * - * <p>It looks like it controls checking NBT. At this point, since we are still using universal - * fluid cells which store their fluids in NBT, it probably will not be safe to disable the NBT - * checks in the near future. Data sticks may be another case. Anyway, we probably can't get rid - * of this without some significant changes to clean up recipe inputs. + * <p> + * It looks like it controls checking NBT. At this point, since we are still using universal fluid cells which store + * their fluids in NBT, it probably will not be safe to disable the NBT checks in the near future. Data sticks may + * be another case. Anyway, we probably can't get rid of this without some significant changes to clean up recipe + * inputs. */ public static boolean GTppRecipeHelper; /** - * WARNING: Do not call this method with both {@code aDecreaseStacksizeBySuccess} and {@code aDontCheckStackSizes} set to {@code true}! - * You'll get weird behavior. + * 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, - int amountMultiplier, - FluidStack[] aFluidInputs, - ItemStack... aInputs) { + public boolean isRecipeInputEqual(boolean aDecreaseStacksizeBySuccess, boolean aDontCheckStackSizes, + int amountMultiplier, FluidStack[] aFluidInputs, ItemStack... aInputs) { if (mInputs.length > 0 && aInputs == null) return false; if (mFluidInputs.length > 0 && aFluidInputs == null) return false; @@ -676,10 +648,10 @@ public class GT_Recipe implements Comparable<GT_Recipe> { if (GT_OreDictUnificator.isInputStackEqual(providedItem, unifiedItemCost)) { if (GTppRecipeHelper) { // Please see JavaDoc on GTppRecipeHelper for why this is here. if (GT_Utility.areStacksEqual(providedItem, Ic2Items.FluidCell.copy(), true) - || GT_Utility.areStacksEqual( - providedItem, ItemList.Tool_DataStick.get(1L), true) - || GT_Utility.areStacksEqual( - providedItem, ItemList.Tool_DataOrb.get(1L), true)) { + || GT_Utility + .areStacksEqual(providedItem, ItemList.Tool_DataStick.get(1L), true) + || GT_Utility + .areStacksEqual(providedItem, ItemList.Tool_DataOrb.get(1L), true)) { if (!GT_Utility.areStacksEqual(providedItem, recipeItemCost, false)) continue; } } @@ -756,16 +728,17 @@ public class GT_Recipe implements Comparable<GT_Recipe> { } /** - * Sets description shown on NEI. - * <br>If you have a large number of recipes for the recipemap, - * this is not efficient memory wise, so use {@link GT_Recipe_Map#setNEISpecialInfoFormatter} instead. + * Sets description shown on NEI. <br> + * If you have a large number of recipes for the recipemap, this is not efficient memory wise, so use + * {@link GT_Recipe_Map#setNEISpecialInfoFormatter} instead. */ protected void setNeiDesc(String... neiDesc) { this.neiDesc = neiDesc; } /** - * Use {@link GT_Recipe_Map#getItemInputPositions} or {@link GT_Recipe_Map#getSpecialItemPosition} or {@link GT_Recipe_Map#getFluidInputPositions} instead + * Use {@link GT_Recipe_Map#getItemInputPositions} or {@link GT_Recipe_Map#getSpecialItemPosition} or + * {@link GT_Recipe_Map#getFluidInputPositions} instead */ @SuppressWarnings("DeprecatedIsStillUsed") @Deprecated @@ -793,8 +766,7 @@ public class GT_Recipe implements Comparable<GT_Recipe> { if (GT_Mod.gregtechproxy.mNEIRecipeOwnerStackTrace) { List<StackTraceElement> toAdd = new ArrayList<>(); for (StackTraceElement stackTrace : Thread.currentThread().getStackTrace()) { - if (excludedClasses.stream() - .noneMatch(c -> stackTrace.getClassName().equals(c))) { + if (excludedClasses.stream().noneMatch(c -> stackTrace.getClassName().equals(c))) { toAdd.add(stackTrace); } } @@ -822,8 +794,8 @@ 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 final ArrayList<GT_Recipe_AssemblyLine> sAssemblylineRecipes = new ArrayList<GT_Recipe_AssemblyLine>(); static { if (!Boolean.getBoolean("com.gtnh.gt5u.ignore-invalid-assline-recipe")) @@ -840,9 +812,8 @@ public class GT_Recipe implements Comparable<GT_Recipe> { GT_Log.err.printf("Invalid recipe: %s%n", recipe); } } - if (invalidCount > 0) - throw new RuntimeException("There are " + invalidCount - + " invalid assembly line recipe(s)! Check GregTech.log for details!"); + if (invalidCount > 0) throw new RuntimeException( + "There are " + invalidCount + " invalid assembly line recipe(s)! Check GregTech.log for details!"); } public ItemStack mResearchItem; @@ -860,14 +831,8 @@ 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) { + public GT_Recipe_AssemblyLine(ItemStack aResearchItem, int aResearchTime, ItemStack[] aInputs, + FluidStack[] aFluidInputs, ItemStack aOutput, int aDuration, int aEUt) { this( aResearchItem, aResearchTime, @@ -895,15 +860,8 @@ 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) { + 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; @@ -929,7 +887,7 @@ public class GT_Recipe implements Comparable<GT_Recipe> { 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}); + new Object[] { totalInputStackSize, mDuration, mEUt, thisOutput, thisResearch, mResearchTime }); result = prime * result + inputFluidHash; result = prime * result + inputHash; result = prime * result + miscRecipeDataHash; @@ -982,8 +940,7 @@ public class GT_Recipe implements Comparable<GT_Recipe> { } } - return this.mDuration == other.mDuration - && this.mEUt == other.mEUt + return this.mDuration == other.mDuration && this.mEUt == other.mEUt && this.mResearchTime == other.mResearchTime; } @@ -996,19 +953,28 @@ 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) + '}'; + + mResearchItem + + ", mResearchTime=" + + mResearchTime + + ", mInputs=" + + Arrays.toString(mInputs) + + ", mFluidInputs=" + + Arrays.toString(mFluidInputs) + + ", mOutput=" + + mOutput + + ", mDuration=" + + mDuration + + ", mEUt=" + + mEUt + + ", mOreDictAlt=" + + Arrays.toString(mOreDictAlt) + + '}'; } /** - * @param aPersistentHash the persistent hash. it should reflect the exact input used to generate this recipe - * If 0 is passed in, the actual persistent hash will be automatically remapped to 1 instead. + * @param aPersistentHash the persistent hash. it should reflect the exact input used to generate this recipe If + * 0 is passed in, the actual persistent hash will be automatically remapped to 1 + * instead. * @throws IllegalStateException if the persistent hash has been set already */ public void setPersistentHash(int aPersistentHash) { @@ -1020,6 +986,7 @@ public class GT_Recipe implements Comparable<GT_Recipe> { @SuppressWarnings("StaticInitializerReferencesSubClass") public static class GT_Recipe_Map { + /** * Contains all Recipe Maps */ @@ -1030,139 +997,132 @@ 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) - .setSlotOverlay(false, false, GT_UITextures.OVERLAY_SLOT_CRUSHED_ORE) - .setSlotOverlay(false, true, GT_UITextures.OVERLAY_SLOT_DUST) - .setProgressBar(GT_UITextures.PROGRESSBAR_BATH, ProgressBar.Direction.CIRCULAR_CW); + 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).setSlotOverlay(false, false, GT_UITextures.OVERLAY_SLOT_CRUSHED_ORE) + .setSlotOverlay(false, true, GT_UITextures.OVERLAY_SLOT_DUST) + .setProgressBar(GT_UITextures.PROGRESSBAR_BATH, ProgressBar.Direction.CIRCULAR_CW); public static final GT_Recipe_Map sThermalCentrifugeRecipes = new GT_Recipe_Map( - new HashSet<>(1000), - "gt.recipe.thermalcentrifuge", - "Thermal Centrifuge", - null, - RES_PATH_GUI + "basicmachines/ThermalCentrifuge", - 1, - 3, - 1, - 0, - 2, - E, - 1, - E, - true, - true) - .setSlotOverlay(false, false, GT_UITextures.OVERLAY_SLOT_CRUSHED_ORE) - .setSlotOverlay(false, true, GT_UITextures.OVERLAY_SLOT_DUST) - .setProgressBar(GT_UITextures.PROGRESSBAR_ARROW, ProgressBar.Direction.RIGHT); + new HashSet<>(1000), + "gt.recipe.thermalcentrifuge", + "Thermal Centrifuge", + null, + RES_PATH_GUI + "basicmachines/ThermalCentrifuge", + 1, + 3, + 1, + 0, + 2, + E, + 1, + E, + true, + true).setSlotOverlay(false, false, GT_UITextures.OVERLAY_SLOT_CRUSHED_ORE) + .setSlotOverlay(false, true, GT_UITextures.OVERLAY_SLOT_DUST) + .setProgressBar(GT_UITextures.PROGRESSBAR_ARROW, ProgressBar.Direction.RIGHT); public static final GT_Recipe_Map sCompressorRecipes = new GT_Recipe_Map( - new HashSet<>(750), - "gt.recipe.compressor", - "Compressor", - null, - RES_PATH_GUI + "basicmachines/Compressor", - 1, - 1, - 1, - 0, - 1, - E, - 1, - E, - true, - true) - .setSlotOverlay(false, false, GT_UITextures.OVERLAY_SLOT_COMPRESSOR) - .setProgressBar(GT_UITextures.PROGRESSBAR_COMPRESS, ProgressBar.Direction.RIGHT) - .setSlotOverlaySteam(false, GT_UITextures.OVERLAY_SLOT_COMPRESSOR_STEAM) - .setProgressBarSteam(GT_UITextures.PROGRESSBAR_COMPRESS_STEAM); + new HashSet<>(750), + "gt.recipe.compressor", + "Compressor", + null, + RES_PATH_GUI + "basicmachines/Compressor", + 1, + 1, + 1, + 0, + 1, + E, + 1, + E, + true, + true).setSlotOverlay(false, false, GT_UITextures.OVERLAY_SLOT_COMPRESSOR) + .setProgressBar(GT_UITextures.PROGRESSBAR_COMPRESS, ProgressBar.Direction.RIGHT) + .setSlotOverlaySteam(false, GT_UITextures.OVERLAY_SLOT_COMPRESSOR_STEAM) + .setProgressBarSteam(GT_UITextures.PROGRESSBAR_COMPRESS_STEAM); public static final GT_Recipe_Map sExtractorRecipes = new GT_Recipe_Map( - new HashSet<>(250), - "gt.recipe.extractor", - "Extractor", - null, - RES_PATH_GUI + "basicmachines/Extractor", - 1, - 1, - 1, - 0, - 1, - E, - 1, - E, - true, - true) - .setSlotOverlay(false, false, GT_UITextures.OVERLAY_SLOT_CENTRIFUGE) - .setProgressBar(GT_UITextures.PROGRESSBAR_EXTRACT, ProgressBar.Direction.RIGHT) - .setSlotOverlaySteam(false, GT_UITextures.OVERLAY_SLOT_CENTRIFUGE_STEAM) - .setProgressBarSteam(GT_UITextures.PROGRESSBAR_EXTRACT_STEAM); + new HashSet<>(250), + "gt.recipe.extractor", + "Extractor", + null, + RES_PATH_GUI + "basicmachines/Extractor", + 1, + 1, + 1, + 0, + 1, + E, + 1, + E, + true, + true).setSlotOverlay(false, false, GT_UITextures.OVERLAY_SLOT_CENTRIFUGE) + .setProgressBar(GT_UITextures.PROGRESSBAR_EXTRACT, ProgressBar.Direction.RIGHT) + .setSlotOverlaySteam(false, GT_UITextures.OVERLAY_SLOT_CENTRIFUGE_STEAM) + .setProgressBarSteam(GT_UITextures.PROGRESSBAR_EXTRACT_STEAM); public static final GT_Recipe_Map sRecyclerRecipes = new GT_Recipe_Map_Recycler( - new HashSet<>(0), - "ic.recipe.recycler", - "Recycler", - "ic2.recycler", - RES_PATH_GUI + "basicmachines/Recycler", - 1, - 1, - 1, - 0, - 1, - E, - 1, - E, - true, - false) - .setSlotOverlay(false, false, GT_UITextures.OVERLAY_SLOT_RECYCLE) - .setProgressBar(GT_UITextures.PROGRESSBAR_RECYCLE, ProgressBar.Direction.CIRCULAR_CW); + new HashSet<>(0), + "ic.recipe.recycler", + "Recycler", + "ic2.recycler", + RES_PATH_GUI + "basicmachines/Recycler", + 1, + 1, + 1, + 0, + 1, + E, + 1, + E, + true, + false).setSlotOverlay(false, false, GT_UITextures.OVERLAY_SLOT_RECYCLE) + .setProgressBar(GT_UITextures.PROGRESSBAR_RECYCLE, ProgressBar.Direction.CIRCULAR_CW); public static final GT_Recipe_Map sFurnaceRecipes = new GT_Recipe_Map_Furnace( - new HashSet<>(0), - "mc.recipe.furnace", - "Furnace", - "smelting", - RES_PATH_GUI + "basicmachines/E_Furnace", - 1, - 1, - 1, - 0, - 1, - E, - 1, - E, - true, - false) - .setSlotOverlay(false, false, GT_UITextures.OVERLAY_SLOT_FURNACE) - .setProgressBar(GT_UITextures.PROGRESSBAR_ARROW, ProgressBar.Direction.RIGHT) - .setSlotOverlaySteam(false, GT_UITextures.OVERLAY_SLOT_FURNACE_STEAM) - .setProgressBarSteam(GT_UITextures.PROGRESSBAR_ARROW_STEAM); + new HashSet<>(0), + "mc.recipe.furnace", + "Furnace", + "smelting", + RES_PATH_GUI + "basicmachines/E_Furnace", + 1, + 1, + 1, + 0, + 1, + E, + 1, + E, + true, + false).setSlotOverlay(false, false, GT_UITextures.OVERLAY_SLOT_FURNACE) + .setProgressBar(GT_UITextures.PROGRESSBAR_ARROW, ProgressBar.Direction.RIGHT) + .setSlotOverlaySteam(false, GT_UITextures.OVERLAY_SLOT_FURNACE_STEAM) + .setProgressBarSteam(GT_UITextures.PROGRESSBAR_ARROW_STEAM); 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) - .setSlotOverlay(false, false, GT_UITextures.OVERLAY_SLOT_FURNACE) - .setProgressBar(GT_UITextures.PROGRESSBAR_ARROW, ProgressBar.Direction.RIGHT); + new HashSet<>(0), + "gt.recipe.microwave", + "Microwave", + "smelting", + RES_PATH_GUI + "basicmachines/E_Furnace", + 1, + 1, + 1, + 0, + 1, + E, + 1, + E, + true, + false).setSlotOverlay(false, false, GT_UITextures.OVERLAY_SLOT_FURNACE) + .setProgressBar(GT_UITextures.PROGRESSBAR_ARROW, ProgressBar.Direction.RIGHT); /** Set {@code aSpecialValue = -100} to bypass the disassembler tier check and default recipe duration. */ public static final GT_Recipe_Map sDisassemblerRecipes = new GT_Recipe_Map( @@ -1181,6 +1141,7 @@ public class GT_Recipe implements Comparable<GT_Recipe> { E, true, false) { + @Override public IDrawable getOverlayForSlot(boolean isFluid, boolean isOutput, int index, boolean isSpecial) { if (isOutput) { @@ -1200,697 +1161,654 @@ public class GT_Recipe implements Comparable<GT_Recipe> { .setProgressBar(GT_UITextures.PROGRESSBAR_ASSEMBLE, ProgressBar.Direction.RIGHT); 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) - .setSlotOverlay(false, false, GT_UITextures.OVERLAY_SLOT_MICROSCOPE) - .setSlotOverlay(false, false, true, true, GT_UITextures.OVERLAY_SLOT_DATA_ORB) - .setProgressBar(GT_UITextures.PROGRESSBAR_ARROW, ProgressBar.Direction.RIGHT); + new HashSet<>(300), + "gt.recipe.scanner", + "Scanner", + null, + RES_PATH_GUI + "basicmachines/Scanner", + 1, + 1, + 1, + 0, + 1, + E, + 1, + E, + true, + true).setSlotOverlay(false, false, GT_UITextures.OVERLAY_SLOT_MICROSCOPE) + .setSlotOverlay(false, false, true, true, GT_UITextures.OVERLAY_SLOT_DATA_ORB) + .setProgressBar(GT_UITextures.PROGRESSBAR_ARROW, ProgressBar.Direction.RIGHT); 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", - 2, - 1, - 0, - 0, - 1, - E, - 1, - E, - true, - true) - .setSlotOverlay(false, false, GT_UITextures.OVERLAY_SLOT_DUST) - .setSlotOverlay(false, true, GT_UITextures.OVERLAY_SLOT_CRUSHED_ORE) - .setProgressBar(GT_UITextures.PROGRESSBAR_MACERATE, ProgressBar.Direction.RIGHT); + new HashSet<>(200), + "gt.recipe.rockbreaker", + "Rock Breaker", + null, + RES_PATH_GUI + "basicmachines/RockBreaker", + 2, + 1, + 0, + 0, + 1, + E, + 1, + E, + true, + true).setSlotOverlay(false, false, GT_UITextures.OVERLAY_SLOT_DUST) + .setSlotOverlay(false, true, GT_UITextures.OVERLAY_SLOT_CRUSHED_ORE) + .setProgressBar(GT_UITextures.PROGRESSBAR_MACERATE, ProgressBar.Direction.RIGHT); 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) - .setProgressBar(GT_UITextures.PROGRESSBAR_ARROW, ProgressBar.Direction.RIGHT); + 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).setProgressBar(GT_UITextures.PROGRESSBAR_ARROW, ProgressBar.Direction.RIGHT); 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) - .setSlotOverlay(false, false, GT_UITextures.OVERLAY_SLOT_CANISTER) - .setSlotOverlay(true, false, GT_UITextures.OVERLAY_SLOT_UUM) - .setSlotOverlay(false, false, true, true, GT_UITextures.OVERLAY_SLOT_DATA_ORB) - .setProgressBar(GT_UITextures.PROGRESSBAR_ARROW, ProgressBar.Direction.RIGHT); + new HashSet<>(100), + "gt.recipe.replicator", + "Replicator", + null, + RES_PATH_GUI + "basicmachines/Replicator", + 0, + 1, + 0, + 1, + 1, + E, + 1, + E, + true, + true).setSlotOverlay(false, false, GT_UITextures.OVERLAY_SLOT_CANISTER) + .setSlotOverlay(true, false, GT_UITextures.OVERLAY_SLOT_UUM) + .setSlotOverlay(false, false, true, true, GT_UITextures.OVERLAY_SLOT_DATA_ORB) + .setProgressBar(GT_UITextures.PROGRESSBAR_ARROW, ProgressBar.Direction.RIGHT); // 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_AssemblyLineFake( - new HashSet<>(110), - "gt.recipe.fakeAssemblylineProcess", - "Assemblyline Process", - null, - RES_PATH_GUI + "FakeAssemblyline", - 16, - 1, - 1, - 0, - 1, - E, - 1, - E, - true, - true) - .setSlotOverlay(false, false, true, true, GT_UITextures.OVERLAY_SLOT_DATA_ORB) - .setUsualFluidInputCount(4); + new HashSet<>(110), + "gt.recipe.fakeAssemblylineProcess", + "Assemblyline Process", + null, + RES_PATH_GUI + "FakeAssemblyline", + 16, + 1, + 1, + 0, + 1, + E, + 1, + E, + true, + true).setSlotOverlay(false, false, true, true, GT_UITextures.OVERLAY_SLOT_DATA_ORB) + .setUsualFluidInputCount(4); 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) - .setProgressBar(GT_UITextures.PROGRESSBAR_ARROW, ProgressBar.Direction.RIGHT); + 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).setProgressBar(GT_UITextures.PROGRESSBAR_ARROW, ProgressBar.Direction.RIGHT); 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) - .setProgressBar(GT_UITextures.PROGRESSBAR_ARROW, ProgressBar.Direction.RIGHT); + new HashSet<>(20000), + "gt.recipe.arcfurnace", + "Arc Furnace", + null, + RES_PATH_GUI + "basicmachines/ArcFurnace", + 1, + 4, + 1, + 1, + 3, + E, + 1, + E, + true, + true).setProgressBar(GT_UITextures.PROGRESSBAR_ARROW, ProgressBar.Direction.RIGHT); 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) - .setSlotOverlay(false, false, GT_UITextures.OVERLAY_SLOT_PAGE_BLANK) - .setSlotOverlay(false, true, GT_UITextures.OVERLAY_SLOT_PAGE_PRINTED) - .setSlotOverlay(false, false, true, true, GT_UITextures.OVERLAY_SLOT_DATA_STICK) - .setProgressBar(GT_UITextures.PROGRESSBAR_ARROW, ProgressBar.Direction.RIGHT); + new HashSet<>(5), + "gt.recipe.printer", + "Printer", + null, + RES_PATH_GUI + "basicmachines/Printer", + 1, + 1, + 1, + 1, + 1, + E, + 1, + E, + true, + true).setSlotOverlay(false, false, GT_UITextures.OVERLAY_SLOT_PAGE_BLANK) + .setSlotOverlay(false, true, GT_UITextures.OVERLAY_SLOT_PAGE_PRINTED) + .setSlotOverlay(false, false, true, true, GT_UITextures.OVERLAY_SLOT_DATA_STICK) + .setProgressBar(GT_UITextures.PROGRESSBAR_ARROW, ProgressBar.Direction.RIGHT); public static final GT_Recipe_Map sSifterRecipes = new GT_Recipe_Map( - new HashSet<>(105), - "gt.recipe.sifter", - "Sifter", - null, - RES_PATH_GUI + "basicmachines/Sifter", - 1, - 9, - 0, - 0, - 1, - E, - 1, - E, - true, - true) - .setProgressBar(GT_UITextures.PROGRESSBAR_SIFT, ProgressBar.Direction.DOWN); + new HashSet<>(105), + "gt.recipe.sifter", + "Sifter", + null, + RES_PATH_GUI + "basicmachines/Sifter", + 1, + 9, + 0, + 0, + 1, + E, + 1, + E, + true, + true).setProgressBar(GT_UITextures.PROGRESSBAR_SIFT, ProgressBar.Direction.DOWN); 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/Press3", - 6, - 1, - 2, - 0, - 1, - E, - 1, - E, - true, - true) - .setSlotOverlay(false, false, true, GT_UITextures.OVERLAY_SLOT_PRESS_1) - .setSlotOverlay(false, false, false, GT_UITextures.OVERLAY_SLOT_PRESS_2) - .setSlotOverlay(false, true, GT_UITextures.OVERLAY_SLOT_PRESS_3) - .setProgressBar(GT_UITextures.PROGRESSBAR_COMPRESS, ProgressBar.Direction.RIGHT); + new HashSet<>(300), + "gt.recipe.press", + "Forming Press", + null, + RES_PATH_GUI + "basicmachines/Press3", + 6, + 1, + 2, + 0, + 1, + E, + 1, + E, + true, + true).setSlotOverlay(false, false, true, GT_UITextures.OVERLAY_SLOT_PRESS_1) + .setSlotOverlay(false, false, false, GT_UITextures.OVERLAY_SLOT_PRESS_2) + .setSlotOverlay(false, true, GT_UITextures.OVERLAY_SLOT_PRESS_3) + .setProgressBar(GT_UITextures.PROGRESSBAR_COMPRESS, ProgressBar.Direction.RIGHT); public static final GT_Recipe_Map sLaserEngraverRecipes = new GT_Recipe_Map( - new HashSet<>(810), - "gt.recipe.laserengraver", - "Precision Laser Engraver", - null, - RES_PATH_GUI + "basicmachines/LaserEngraver2", - 4, - 4, - 0, - 0, - 1, - E, - 1, - E, - true, - true) - .setSlotOverlay(false, false, false, GT_UITextures.OVERLAY_SLOT_LENS) - .setProgressBar(GT_UITextures.PROGRESSBAR_ARROW, ProgressBar.Direction.RIGHT) - .setUsualFluidInputCount(2) - .setUsualFluidOutputCount(2); + new HashSet<>(810), + "gt.recipe.laserengraver", + "Precision Laser Engraver", + null, + RES_PATH_GUI + "basicmachines/LaserEngraver2", + 4, + 4, + 0, + 0, + 1, + E, + 1, + E, + true, + true).setSlotOverlay(false, false, false, GT_UITextures.OVERLAY_SLOT_LENS) + .setProgressBar(GT_UITextures.PROGRESSBAR_ARROW, ProgressBar.Direction.RIGHT) + .setUsualFluidInputCount(2).setUsualFluidOutputCount(2); 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) - .setSlotOverlay(false, false, GT_UITextures.OVERLAY_SLOT_DUST) - .setSlotOverlay(false, true, GT_UITextures.OVERLAY_SLOT_DUST) - .setProgressBar(GT_UITextures.PROGRESSBAR_MIXER, ProgressBar.Direction.CIRCULAR_CW); + new HashSet<>(900), + "gt.recipe.mixer", + "Mixer", + null, + RES_PATH_GUI + "basicmachines/Mixer6", + 9, + 4, + 1, + 0, + 1, + E, + 1, + E, + true, + true).setSlotOverlay(false, false, GT_UITextures.OVERLAY_SLOT_DUST) + .setSlotOverlay(false, true, GT_UITextures.OVERLAY_SLOT_DUST) + .setProgressBar(GT_UITextures.PROGRESSBAR_MIXER, ProgressBar.Direction.CIRCULAR_CW); public static final GT_Recipe_Map sAutoclaveRecipes = new GT_Recipe_Map( - new HashSet<>(300), - "gt.recipe.autoclave", - "Autoclave", - null, - RES_PATH_GUI + "basicmachines/Autoclave4", - 2, - 4, - 1, - 1, - 1, - E, - 1, - E, - true, - true) - .setSlotOverlay(false, false, GT_UITextures.OVERLAY_SLOT_DUST) - .setSlotOverlay(false, true, true, GT_UITextures.OVERLAY_SLOT_GEM) - .setSlotOverlay(false, true, false, GT_UITextures.OVERLAY_SLOT_DUST) - .setProgressBar(GT_UITextures.PROGRESSBAR_ARROW, ProgressBar.Direction.RIGHT); + new HashSet<>(300), + "gt.recipe.autoclave", + "Autoclave", + null, + RES_PATH_GUI + "basicmachines/Autoclave4", + 2, + 4, + 1, + 1, + 1, + E, + 1, + E, + true, + true).setSlotOverlay(false, false, GT_UITextures.OVERLAY_SLOT_DUST) + .setSlotOverlay(false, true, true, GT_UITextures.OVERLAY_SLOT_GEM) + .setSlotOverlay(false, true, false, GT_UITextures.OVERLAY_SLOT_DUST) + .setProgressBar(GT_UITextures.PROGRESSBAR_ARROW, ProgressBar.Direction.RIGHT); public static final GT_Recipe_Map sElectroMagneticSeparatorRecipes = new GT_Recipe_Map( - new HashSet<>(50), - "gt.recipe.electromagneticseparator", - "Electromagnetic Separator", - null, - RES_PATH_GUI + "basicmachines/ElectromagneticSeparator", - 1, - 3, - 1, - 0, - 1, - E, - 1, - E, - true, - true) - .setSlotOverlay(false, false, GT_UITextures.OVERLAY_SLOT_CRUSHED_ORE) - .setSlotOverlay(false, true, GT_UITextures.OVERLAY_SLOT_DUST) - .setProgressBar(GT_UITextures.PROGRESSBAR_MAGNET, ProgressBar.Direction.RIGHT); + new HashSet<>(50), + "gt.recipe.electromagneticseparator", + "Electromagnetic Separator", + null, + RES_PATH_GUI + "basicmachines/ElectromagneticSeparator", + 1, + 3, + 1, + 0, + 1, + E, + 1, + E, + true, + true).setSlotOverlay(false, false, GT_UITextures.OVERLAY_SLOT_CRUSHED_ORE) + .setSlotOverlay(false, true, GT_UITextures.OVERLAY_SLOT_DUST) + .setProgressBar(GT_UITextures.PROGRESSBAR_MAGNET, ProgressBar.Direction.RIGHT); public static final GT_Recipe_Map sPolarizerRecipes = new GT_Recipe_Map( - new HashSet<>(300), - "gt.recipe.polarizer", - "Electromagnetic Polarizer", - null, - RES_PATH_GUI + "basicmachines/Polarizer", - 1, - 1, - 1, - 0, - 1, - E, - 1, - E, - true, - true) - .setProgressBar(GT_UITextures.PROGRESSBAR_MAGNET, ProgressBar.Direction.RIGHT); + new HashSet<>(300), + "gt.recipe.polarizer", + "Electromagnetic Polarizer", + null, + RES_PATH_GUI + "basicmachines/Polarizer", + 1, + 1, + 1, + 0, + 1, + E, + 1, + E, + true, + true).setProgressBar(GT_UITextures.PROGRESSBAR_MAGNET, ProgressBar.Direction.RIGHT); 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) - .setSlotOverlay(false, false, GT_UITextures.OVERLAY_SLOT_CRUSHED_ORE) - .setSlotOverlay(false, true, GT_UITextures.OVERLAY_SLOT_DUST) - .setProgressBar(GT_UITextures.PROGRESSBAR_MACERATE, ProgressBar.Direction.RIGHT) - .setSlotOverlaySteam(false, GT_UITextures.OVERLAY_SLOT_CRUSHED_ORE_STEAM) - .setSlotOverlaySteam(true, GT_UITextures.OVERLAY_SLOT_DUST_STEAM) - .setProgressBarSteam(GT_UITextures.PROGRESSBAR_MACERATE_STEAM); + new HashSet<>(16600), + "gt.recipe.macerator", + "Pulverization", + null, + RES_PATH_GUI + "basicmachines/Macerator4", + 1, + 4, + 1, + 0, + 1, + E, + 1, + E, + true, + true).setSlotOverlay(false, false, GT_UITextures.OVERLAY_SLOT_CRUSHED_ORE) + .setSlotOverlay(false, true, GT_UITextures.OVERLAY_SLOT_DUST) + .setProgressBar(GT_UITextures.PROGRESSBAR_MACERATE, ProgressBar.Direction.RIGHT) + .setSlotOverlaySteam(false, GT_UITextures.OVERLAY_SLOT_CRUSHED_ORE_STEAM) + .setSlotOverlaySteam(true, GT_UITextures.OVERLAY_SLOT_DUST_STEAM) + .setProgressBarSteam(GT_UITextures.PROGRESSBAR_MACERATE_STEAM); public static final GT_Recipe_Map sChemicalBathRecipes = new GT_Recipe_Map( - new HashSet<>(2550), - "gt.recipe.chemicalbath", - "Chemical Bath", - null, - RES_PATH_GUI + "basicmachines/ChemicalBath", - 1, - 3, - 1, - 1, - 1, - E, - 1, - E, - true, - true) - .setProgressBar(GT_UITextures.PROGRESSBAR_BATH, ProgressBar.Direction.CIRCULAR_CW); + new HashSet<>(2550), + "gt.recipe.chemicalbath", + "Chemical Bath", + null, + RES_PATH_GUI + "basicmachines/ChemicalBath", + 1, + 3, + 1, + 1, + 1, + E, + 1, + E, + true, + true).setProgressBar(GT_UITextures.PROGRESSBAR_BATH, ProgressBar.Direction.CIRCULAR_CW); 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) - .setSlotOverlay(false, false, GT_UITextures.OVERLAY_SLOT_CANISTER) - .setSlotOverlay(false, true, GT_UITextures.OVERLAY_SLOT_CANISTER) - .setProgressBar(GT_UITextures.PROGRESSBAR_CANNER, ProgressBar.Direction.RIGHT); + 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).setSlotOverlay(false, false, GT_UITextures.OVERLAY_SLOT_CANISTER) + .setSlotOverlay(false, true, GT_UITextures.OVERLAY_SLOT_CANISTER) + .setProgressBar(GT_UITextures.PROGRESSBAR_CANNER, ProgressBar.Direction.RIGHT); public static final GT_Recipe_Map sBrewingRecipes = new GT_Recipe_Map( - new HashSet<>(450), - "gt.recipe.brewer", - "Brewing Machine", - null, - RES_PATH_GUI + "basicmachines/PotionBrewer", - 1, - 0, - 1, - 1, - 1, - E, - 1, - E, - true, - true) - .setSlotOverlay(false, false, GT_UITextures.OVERLAY_SLOT_CAULDRON) - .setProgressBar(GT_UITextures.PROGRESSBAR_ARROW_MULTIPLE, ProgressBar.Direction.RIGHT); + new HashSet<>(450), + "gt.recipe.brewer", + "Brewing Machine", + null, + RES_PATH_GUI + "basicmachines/PotionBrewer", + 1, + 0, + 1, + 1, + 1, + E, + 1, + E, + true, + true).setSlotOverlay(false, false, GT_UITextures.OVERLAY_SLOT_CAULDRON) + .setProgressBar(GT_UITextures.PROGRESSBAR_ARROW_MULTIPLE, ProgressBar.Direction.RIGHT); public static final GT_Recipe_Map sFluidHeaterRecipes = new GT_Recipe_Map( - new HashSet<>(10), - "gt.recipe.fluidheater", - "Fluid Heater", - null, - RES_PATH_GUI + "basicmachines/FluidHeater", - 1, - 0, - 1, - 0, - 1, - E, - 1, - E, - true, - true) - .setSlotOverlay(true, false, GT_UITextures.OVERLAY_SLOT_HEATER_1) - .setSlotOverlay(true, true, GT_UITextures.OVERLAY_SLOT_HEATER_2) - .setProgressBar(GT_UITextures.PROGRESSBAR_ARROW_MULTIPLE, ProgressBar.Direction.RIGHT); + new HashSet<>(10), + "gt.recipe.fluidheater", + "Fluid Heater", + null, + RES_PATH_GUI + "basicmachines/FluidHeater", + 1, + 0, + 1, + 0, + 1, + E, + 1, + E, + true, + true).setSlotOverlay(true, false, GT_UITextures.OVERLAY_SLOT_HEATER_1) + .setSlotOverlay(true, true, GT_UITextures.OVERLAY_SLOT_HEATER_2) + .setProgressBar(GT_UITextures.PROGRESSBAR_ARROW_MULTIPLE, ProgressBar.Direction.RIGHT); public static final GT_Recipe_Map sDistilleryRecipes = new GT_Recipe_Map( - new HashSet<>(400), - "gt.recipe.distillery", - "Distillery", - null, - RES_PATH_GUI + "basicmachines/Distillery", - 1, - 1, - 1, - 1, - 1, - E, - 1, - E, - true, - true) - .setSlotOverlay(true, false, GT_UITextures.OVERLAY_SLOT_BEAKER_1) - .setSlotOverlay(true, true, GT_UITextures.OVERLAY_SLOT_BEAKER_2) - .setProgressBar(GT_UITextures.PROGRESSBAR_ARROW_MULTIPLE, ProgressBar.Direction.RIGHT); + new HashSet<>(400), + "gt.recipe.distillery", + "Distillery", + null, + RES_PATH_GUI + "basicmachines/Distillery", + 1, + 1, + 1, + 1, + 1, + E, + 1, + E, + true, + true).setSlotOverlay(true, false, GT_UITextures.OVERLAY_SLOT_BEAKER_1) + .setSlotOverlay(true, true, GT_UITextures.OVERLAY_SLOT_BEAKER_2) + .setProgressBar(GT_UITextures.PROGRESSBAR_ARROW_MULTIPLE, ProgressBar.Direction.RIGHT); public static final GT_Recipe_Map sFermentingRecipes = new GT_Recipe_Map( - new HashSet<>(50), - "gt.recipe.fermenter", - "Fermenter", - null, - RES_PATH_GUI + "basicmachines/Fermenter", - 0, - 0, - 0, - 1, - 1, - E, - 1, - E, - true, - true) - .setProgressBar(GT_UITextures.PROGRESSBAR_ARROW_MULTIPLE, ProgressBar.Direction.RIGHT); + new HashSet<>(50), + "gt.recipe.fermenter", + "Fermenter", + null, + RES_PATH_GUI + "basicmachines/Fermenter", + 0, + 0, + 0, + 1, + 1, + E, + 1, + E, + true, + true).setProgressBar(GT_UITextures.PROGRESSBAR_ARROW_MULTIPLE, ProgressBar.Direction.RIGHT); 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) - .setSlotOverlay(false, false, GT_UITextures.OVERLAY_SLOT_MOLD) - .setProgressBar(GT_UITextures.PROGRESSBAR_ARROW, ProgressBar.Direction.RIGHT); + new HashSet<>(35000), + "gt.recipe.fluidsolidifier", + "Fluid Solidifier", + null, + RES_PATH_GUI + "basicmachines/FluidSolidifier", + 1, + 1, + 1, + 1, + 1, + E, + 1, + E, + true, + true).setSlotOverlay(false, false, GT_UITextures.OVERLAY_SLOT_MOLD) + .setProgressBar(GT_UITextures.PROGRESSBAR_ARROW, ProgressBar.Direction.RIGHT); public static final GT_Recipe_Map sFluidExtractionRecipes = new GT_Recipe_Map( - new HashSet<>(15000), - "gt.recipe.fluidextractor", - "Fluid Extractor", - null, - RES_PATH_GUI + "basicmachines/FluidExtractor", - 1, - 1, - 1, - 0, - 1, - E, - 1, - E, - true, - true) - .setSlotOverlay(false, false, GT_UITextures.OVERLAY_SLOT_CENTRIFUGE) - .setProgressBar(GT_UITextures.PROGRESSBAR_EXTRACT, ProgressBar.Direction.RIGHT); + new HashSet<>(15000), + "gt.recipe.fluidextractor", + "Fluid Extractor", + null, + RES_PATH_GUI + "basicmachines/FluidExtractor", + 1, + 1, + 1, + 0, + 1, + E, + 1, + E, + true, + true).setSlotOverlay(false, false, GT_UITextures.OVERLAY_SLOT_CENTRIFUGE) + .setProgressBar(GT_UITextures.PROGRESSBAR_EXTRACT, ProgressBar.Direction.RIGHT); public static final GT_Recipe_Map sBoxinatorRecipes = new GT_Recipe_Map( - new HashSet<>(2500), - "gt.recipe.packager", - "Packager", - null, - RES_PATH_GUI + "basicmachines/Packager", - 2, - 1, - 2, - 0, - 1, - E, - 1, - E, - true, - true) - .setSlotOverlay(false, false, false, GT_UITextures.OVERLAY_SLOT_BOX) - .setSlotOverlay(false, true, GT_UITextures.OVERLAY_SLOT_BOXED) - .setProgressBar(GT_UITextures.PROGRESSBAR_ARROW, ProgressBar.Direction.RIGHT); + new HashSet<>(2500), + "gt.recipe.packager", + "Packager", + null, + RES_PATH_GUI + "basicmachines/Packager", + 2, + 1, + 2, + 0, + 1, + E, + 1, + E, + true, + true).setSlotOverlay(false, false, false, GT_UITextures.OVERLAY_SLOT_BOX) + .setSlotOverlay(false, true, GT_UITextures.OVERLAY_SLOT_BOXED) + .setProgressBar(GT_UITextures.PROGRESSBAR_ARROW, ProgressBar.Direction.RIGHT); public static final GT_Recipe_Map sUnboxinatorRecipes = new GT_Recipe_Map_Unboxinator( - new HashSet<>(2500), - "gt.recipe.unpackager", - "Unpackager", - null, - RES_PATH_GUI + "basicmachines/Unpackager", - 1, - 2, - 1, - 0, - 1, - E, - 1, - E, - true, - true) - .setSlotOverlay(false, false, GT_UITextures.OVERLAY_SLOT_BOXED) - .setProgressBar(GT_UITextures.PROGRESSBAR_ARROW, ProgressBar.Direction.RIGHT); + new HashSet<>(2500), + "gt.recipe.unpackager", + "Unpackager", + null, + RES_PATH_GUI + "basicmachines/Unpackager", + 1, + 2, + 1, + 0, + 1, + E, + 1, + E, + true, + true).setSlotOverlay(false, false, GT_UITextures.OVERLAY_SLOT_BOXED) + .setProgressBar(GT_UITextures.PROGRESSBAR_ARROW, ProgressBar.Direction.RIGHT); public static final GT_Recipe_Map sFusionRecipes = new GT_Recipe_Map_FluidOnly( - new HashSet<>(50), - "gt.recipe.fusionreactor", - "Fusion Reactor", - null, - RES_PATH_GUI + "basicmachines/FusionReactor", - 0, - 0, - 0, - 2, - 1, - "Start: ", - 1, - " EU", - true, - true) - .setProgressBar(GT_UITextures.PROGRESSBAR_ARROW, ProgressBar.Direction.RIGHT) - .setUsualFluidInputCount(2) - .setNEISpecialInfoFormatter(FusionSpecialValueFormatter.INSTANCE); + new HashSet<>(50), + "gt.recipe.fusionreactor", + "Fusion Reactor", + null, + RES_PATH_GUI + "basicmachines/FusionReactor", + 0, + 0, + 0, + 2, + 1, + "Start: ", + 1, + " EU", + true, + true).setProgressBar(GT_UITextures.PROGRESSBAR_ARROW, ProgressBar.Direction.RIGHT) + .setUsualFluidInputCount(2).setNEISpecialInfoFormatter(FusionSpecialValueFormatter.INSTANCE); 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) - .setProgressBar(GT_UITextures.PROGRESSBAR_ARROW, ProgressBar.Direction.RIGHT) - .setUsualFluidInputCount(16) - .setUsualFluidOutputCount(16) - .setNEITransferRect(new Rectangle(79, 34, 18, 18)) - .setLogoPos(80, 61) - .setNEISpecialInfoFormatter(FusionSpecialValueFormatter.INSTANCE); + 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).setProgressBar(GT_UITextures.PROGRESSBAR_ARROW, ProgressBar.Direction.RIGHT) + .setUsualFluidInputCount(16).setUsualFluidOutputCount(16) + .setNEITransferRect(new Rectangle(79, 34, 18, 18)).setLogoPos(80, 61) + .setNEISpecialInfoFormatter(FusionSpecialValueFormatter.INSTANCE); 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) - .setSlotOverlay(false, false, true, GT_UITextures.OVERLAY_SLOT_CENTRIFUGE) - .setSlotOverlay(false, false, false, GT_UITextures.OVERLAY_SLOT_CANISTER) - .setSlotOverlay(true, false, GT_UITextures.OVERLAY_SLOT_CENTRIFUGE_FLUID) - .setProgressBar(GT_UITextures.PROGRESSBAR_EXTRACT, ProgressBar.Direction.RIGHT); + new HashSet<>(1200), + "gt.recipe.centrifuge", + "Centrifuge", + null, + RES_PATH_GUI + "basicmachines/Centrifuge", + 2, + 6, + 0, + 0, + 1, + E, + 1, + E, + true, + true).setSlotOverlay(false, false, true, GT_UITextures.OVERLAY_SLOT_CENTRIFUGE) + .setSlotOverlay(false, false, false, GT_UITextures.OVERLAY_SLOT_CANISTER) + .setSlotOverlay(true, false, GT_UITextures.OVERLAY_SLOT_CENTRIFUGE_FLUID) + .setProgressBar(GT_UITextures.PROGRESSBAR_EXTRACT, ProgressBar.Direction.RIGHT); public static final GT_Recipe_Map sElectrolyzerRecipes = new GT_Recipe_Map( - new HashSet<>(300), - "gt.recipe.electrolyzer", - "Electrolyzer", - null, - RES_PATH_GUI + "basicmachines/Electrolyzer", - 2, - 6, - 0, - 0, - 1, - E, - 1, - E, - true, - true) - .setSlotOverlay(false, false, true, GT_UITextures.OVERLAY_SLOT_CHARGER) - .setSlotOverlay(false, false, false, GT_UITextures.OVERLAY_SLOT_CANISTER) - .setSlotOverlay(true, false, GT_UITextures.OVERLAY_SLOT_CHARGER_FLUID) - .setProgressBar(GT_UITextures.PROGRESSBAR_EXTRACT, ProgressBar.Direction.RIGHT); + new HashSet<>(300), + "gt.recipe.electrolyzer", + "Electrolyzer", + null, + RES_PATH_GUI + "basicmachines/Electrolyzer", + 2, + 6, + 0, + 0, + 1, + E, + 1, + E, + true, + true).setSlotOverlay(false, false, true, GT_UITextures.OVERLAY_SLOT_CHARGER) + .setSlotOverlay(false, false, false, GT_UITextures.OVERLAY_SLOT_CANISTER) + .setSlotOverlay(true, false, GT_UITextures.OVERLAY_SLOT_CHARGER_FLUID) + .setProgressBar(GT_UITextures.PROGRESSBAR_EXTRACT, ProgressBar.Direction.RIGHT); 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) - .setProgressBar(GT_UITextures.PROGRESSBAR_ARROW, ProgressBar.Direction.RIGHT) - .setNEISpecialInfoFormatter(HeatingCoilSpecialValueFormatter.INSTANCE); + 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).setProgressBar(GT_UITextures.PROGRESSBAR_ARROW, ProgressBar.Direction.RIGHT) + .setNEISpecialInfoFormatter(HeatingCoilSpecialValueFormatter.INSTANCE); public static final GT_Recipe_Map sPlasmaForgeRecipes = new GT_Recipe_Map_LargeNEI( - new HashSet<>(20), - "gt.recipe.plasmaforge", - "DTPF", - null, - RES_PATH_GUI + "basicmachines/PlasmaForge", - 9, - 9, - 0, - 0, - 1, - "Heat Capacity: ", - 1, - " K", - false, - true) - .setProgressBar(GT_UITextures.PROGRESSBAR_ARROW, ProgressBar.Direction.RIGHT) - .setUsualFluidInputCount(9) - .setUsualFluidOutputCount(9) - .setNEISpecialInfoFormatter(HeatingCoilSpecialValueFormatter.INSTANCE); + new HashSet<>(20), + "gt.recipe.plasmaforge", + "DTPF", + null, + RES_PATH_GUI + "basicmachines/PlasmaForge", + 9, + 9, + 0, + 0, + 1, + "Heat Capacity: ", + 1, + " K", + false, + true).setProgressBar(GT_UITextures.PROGRESSBAR_ARROW, ProgressBar.Direction.RIGHT) + .setUsualFluidInputCount(9).setUsualFluidOutputCount(9) + .setNEISpecialInfoFormatter(HeatingCoilSpecialValueFormatter.INSTANCE); 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) - .setProgressBar(GT_UITextures.PROGRESSBAR_ARROW, ProgressBar.Direction.RIGHT); + 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).setProgressBar(GT_UITextures.PROGRESSBAR_ARROW, ProgressBar.Direction.RIGHT); 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) - .setSlotOverlay(false, false, true, GT_UITextures.OVERLAY_SLOT_IMPLOSION) - .setSlotOverlay(false, false, false, GT_UITextures.OVERLAY_SLOT_EXPLOSIVE) - .setProgressBar(GT_UITextures.PROGRESSBAR_COMPRESS, ProgressBar.Direction.RIGHT); + new HashSet<>(900), + "gt.recipe.implosioncompressor", + "Implosion Compressor", + null, + RES_PATH_GUI + "basicmachines/Default", + 2, + 2, + 2, + 0, + 1, + E, + 1, + E, + true, + true).setSlotOverlay(false, false, true, GT_UITextures.OVERLAY_SLOT_IMPLOSION) + .setSlotOverlay(false, false, false, GT_UITextures.OVERLAY_SLOT_EXPLOSIVE) + .setProgressBar(GT_UITextures.PROGRESSBAR_COMPRESS, ProgressBar.Direction.RIGHT); public static final GT_Recipe_Map sVacuumRecipes = new GT_Recipe_Map( - new HashSet<>(305), - "gt.recipe.vacuumfreezer", - "Vacuum Freezer", - null, - RES_PATH_GUI + "basicmachines/Default", - 1, - 1, - 0, - 0, - 1, - E, - 1, - E, - false, - true) - .setProgressBar(GT_UITextures.PROGRESSBAR_ARROW, ProgressBar.Direction.RIGHT) - .setUsualFluidInputCount(2); + new HashSet<>(305), + "gt.recipe.vacuumfreezer", + "Vacuum Freezer", + null, + RES_PATH_GUI + "basicmachines/Default", + 1, + 1, + 0, + 0, + 1, + E, + 1, + E, + false, + true).setProgressBar(GT_UITextures.PROGRESSBAR_ARROW, ProgressBar.Direction.RIGHT) + .setUsualFluidInputCount(2); 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) - .setSlotOverlay(false, false, true, GT_UITextures.OVERLAY_SLOT_MOLECULAR_1) - .setSlotOverlay(false, false, false, GT_UITextures.OVERLAY_SLOT_MOLECULAR_2) - .setSlotOverlay(true, false, GT_UITextures.OVERLAY_SLOT_MOLECULAR_3) - .setSlotOverlay(false, true, GT_UITextures.OVERLAY_SLOT_VIAL_1) - .setSlotOverlay(true, true, GT_UITextures.OVERLAY_SLOT_VIAL_2) - .setProgressBar(GT_UITextures.PROGRESSBAR_ARROW_MULTIPLE, ProgressBar.Direction.RIGHT); + new HashSet<>(1170), + "gt.recipe.chemicalreactor", + "Chemical Reactor", + null, + RES_PATH_GUI + "basicmachines/ChemicalReactor", + 2, + 2, + 1, + 0, + 1, + E, + 1, + E, + true, + true).setSlotOverlay(false, false, true, GT_UITextures.OVERLAY_SLOT_MOLECULAR_1) + .setSlotOverlay(false, false, false, GT_UITextures.OVERLAY_SLOT_MOLECULAR_2) + .setSlotOverlay(true, false, GT_UITextures.OVERLAY_SLOT_MOLECULAR_3) + .setSlotOverlay(false, true, GT_UITextures.OVERLAY_SLOT_VIAL_1) + .setSlotOverlay(true, true, GT_UITextures.OVERLAY_SLOT_VIAL_2) + .setProgressBar(GT_UITextures.PROGRESSBAR_ARROW_MULTIPLE, ProgressBar.Direction.RIGHT); public static final GT_Recipe_Map sMultiblockChemicalRecipes = new GT_Recipe_Map_LargeChemicalReactor() .setProgressBar(GT_UITextures.PROGRESSBAR_ARROW_MULTIPLE, ProgressBar.Direction.RIGHT) - .setUsualFluidInputCount(6) - .setUsualFluidOutputCount(6); + .setUsualFluidInputCount(6).setUsualFluidOutputCount(6); public static final GT_Recipe_Map sDistillationRecipes = new GT_Recipe_Map_DistillationTower() .setProgressBar(GT_UITextures.PROGRESSBAR_ARROW_MULTIPLE, ProgressBar.Direction.RIGHT) .setUsualFluidOutputCount(11); - public static final GT_Recipe_Map_OilCracker sCrackingRecipes = - (GT_Recipe_Map_OilCracker) new GT_Recipe_Map_OilCracker() - .setProgressBar(GT_UITextures.PROGRESSBAR_ARROW_MULTIPLE, ProgressBar.Direction.RIGHT) - .setUsualFluidInputCount(2); + public static final GT_Recipe_Map_OilCracker sCrackingRecipes = (GT_Recipe_Map_OilCracker) new GT_Recipe_Map_OilCracker() + .setProgressBar(GT_UITextures.PROGRESSBAR_ARROW_MULTIPLE, ProgressBar.Direction.RIGHT) + .setUsualFluidInputCount(2); /** * Use sCrackingRecipes instead */ @@ -1898,344 +1816,325 @@ public class GT_Recipe implements Comparable<GT_Recipe> { 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) - .setProgressBar(GT_UITextures.PROGRESSBAR_ARROW, ProgressBar.Direction.RIGHT); + new HashSet<>(150), + "gt.recipe.pyro", + "Pyrolyse Oven", + null, + RES_PATH_GUI + "basicmachines/Default", + 2, + 1, + 1, + 0, + 1, + E, + 1, + E, + true, + true).setProgressBar(GT_UITextures.PROGRESSBAR_ARROW, ProgressBar.Direction.RIGHT); public static final GT_Recipe_Map sWiremillRecipes = new GT_Recipe_Map( - new HashSet<>(450), - "gt.recipe.wiremill", - "Wiremill", - null, - RES_PATH_GUI + "basicmachines/Wiremill", - 2, - 1, - 1, - 0, - 1, - E, - 1, - E, - true, - true) - .setSlotOverlay(false, false, GT_UITextures.OVERLAY_SLOT_WIREMILL) - .setProgressBar(GT_UITextures.PROGRESSBAR_WIREMILL, ProgressBar.Direction.RIGHT); + new HashSet<>(450), + "gt.recipe.wiremill", + "Wiremill", + null, + RES_PATH_GUI + "basicmachines/Wiremill", + 2, + 1, + 1, + 0, + 1, + E, + 1, + E, + true, + true).setSlotOverlay(false, false, GT_UITextures.OVERLAY_SLOT_WIREMILL) + .setProgressBar(GT_UITextures.PROGRESSBAR_WIREMILL, ProgressBar.Direction.RIGHT); public static final GT_Recipe_Map sBenderRecipes = new GT_Recipe_Map( - new HashSet<>(5000), - "gt.recipe.metalbender", - "Bending Machine", - null, - RES_PATH_GUI + "basicmachines/Bender", - 2, - 1, - 2, - 0, - 1, - E, - 1, - E, - true, - true) - .setSlotOverlay(false, false, GT_UITextures.OVERLAY_SLOT_BENDER) - .setProgressBar(GT_UITextures.PROGRESSBAR_BENDING, ProgressBar.Direction.RIGHT); + new HashSet<>(5000), + "gt.recipe.metalbender", + "Bending Machine", + null, + RES_PATH_GUI + "basicmachines/Bender", + 2, + 1, + 2, + 0, + 1, + E, + 1, + E, + true, + true).setSlotOverlay(false, false, GT_UITextures.OVERLAY_SLOT_BENDER) + .setProgressBar(GT_UITextures.PROGRESSBAR_BENDING, ProgressBar.Direction.RIGHT); public static final GT_Recipe_Map sAlloySmelterRecipes = new GT_Recipe_Map( - new HashSet<>(12000), - "gt.recipe.alloysmelter", - "Alloy Smelter", - null, - RES_PATH_GUI + "basicmachines/AlloySmelter", - 2, - 1, - 2, - 0, - 1, - E, - 1, - E, - true, - true) - .setSlotOverlay(false, false, GT_UITextures.OVERLAY_SLOT_FURNACE) - .setProgressBar(GT_UITextures.PROGRESSBAR_ARROW, ProgressBar.Direction.RIGHT) - .setSlotOverlaySteam(false, GT_UITextures.OVERLAY_SLOT_FURNACE_STEAM) - .setProgressBarSteam(GT_UITextures.PROGRESSBAR_ARROW_STEAM); + new HashSet<>(12000), + "gt.recipe.alloysmelter", + "Alloy Smelter", + null, + RES_PATH_GUI + "basicmachines/AlloySmelter", + 2, + 1, + 2, + 0, + 1, + E, + 1, + E, + true, + true).setSlotOverlay(false, false, GT_UITextures.OVERLAY_SLOT_FURNACE) + .setProgressBar(GT_UITextures.PROGRESSBAR_ARROW, ProgressBar.Direction.RIGHT) + .setSlotOverlaySteam(false, GT_UITextures.OVERLAY_SLOT_FURNACE_STEAM) + .setProgressBarSteam(GT_UITextures.PROGRESSBAR_ARROW_STEAM); 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) - .setSlotOverlay(false, false, GT_UITextures.OVERLAY_SLOT_CIRCUIT) - .setProgressBar(GT_UITextures.PROGRESSBAR_ASSEMBLE, ProgressBar.Direction.RIGHT); + new HashSet<>(8200), + "gt.recipe.assembler", + "Assembler", + null, + RES_PATH_GUI + "basicmachines/Assembler2", + 9, + 1, + 1, + 0, + 1, + E, + 1, + E, + true, + true).setSlotOverlay(false, false, GT_UITextures.OVERLAY_SLOT_CIRCUIT) + .setProgressBar(GT_UITextures.PROGRESSBAR_ASSEMBLE, ProgressBar.Direction.RIGHT); public static final GT_Recipe_Map sCircuitAssemblerRecipes = new GT_Recipe_Map_Assembler( - new HashSet<>(605), - "gt.recipe.circuitassembler", - "Circuit Assembler", - null, - RES_PATH_GUI + "basicmachines/CircuitAssembler", - 6, - 1, - 1, - 0, - 1, - E, - 1, - E, - true, - true) - .setNEIUnificateOutput(!Loader.isModLoaded("neicustomdiagram")) - .setSlotOverlay(false, false, GT_UITextures.OVERLAY_SLOT_CIRCUIT) - .setProgressBar(GT_UITextures.PROGRESSBAR_CIRCUIT_ASSEMBLER, ProgressBar.Direction.RIGHT); + new HashSet<>(605), + "gt.recipe.circuitassembler", + "Circuit Assembler", + null, + RES_PATH_GUI + "basicmachines/CircuitAssembler", + 6, + 1, + 1, + 0, + 1, + E, + 1, + E, + true, + true).setNEIUnificateOutput(!Loader.isModLoaded("neicustomdiagram")) + .setSlotOverlay(false, false, GT_UITextures.OVERLAY_SLOT_CIRCUIT) + .setProgressBar(GT_UITextures.PROGRESSBAR_CIRCUIT_ASSEMBLER, ProgressBar.Direction.RIGHT); public static final GT_Recipe_Map sCannerRecipes = new GT_Recipe_Map( - new HashSet<>(900), - "gt.recipe.canner", - "Canning Machine", - null, - RES_PATH_GUI + "basicmachines/Canner", - 2, - 2, - 1, - 0, - 1, - E, - 1, - E, - true, - true) - .setSlotOverlay(false, false, true, GT_UITextures.OVERLAY_SLOT_CANNER) - .setSlotOverlay(false, false, false, GT_UITextures.OVERLAY_SLOT_CANISTER) - .setProgressBar(GT_UITextures.PROGRESSBAR_CANNER, ProgressBar.Direction.RIGHT); + new HashSet<>(900), + "gt.recipe.canner", + "Canning Machine", + null, + RES_PATH_GUI + "basicmachines/Canner", + 2, + 2, + 1, + 0, + 1, + E, + 1, + E, + true, + true).setSlotOverlay(false, false, true, GT_UITextures.OVERLAY_SLOT_CANNER) + .setSlotOverlay(false, false, false, GT_UITextures.OVERLAY_SLOT_CANISTER) + .setProgressBar(GT_UITextures.PROGRESSBAR_CANNER, ProgressBar.Direction.RIGHT); 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) - .setProgressBar(GT_UITextures.PROGRESSBAR_ARROW, ProgressBar.Direction.RIGHT); + new HashSet<>(100), + "gt.recipe.cncmachine", + "CNC Machine", + null, + RES_PATH_GUI + "basicmachines/Default", + 2, + 1, + 2, + 1, + 1, + E, + 1, + E, + true, + true).setProgressBar(GT_UITextures.PROGRESSBAR_ARROW, ProgressBar.Direction.RIGHT); 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) - .setSlotOverlay(false, false, GT_UITextures.OVERLAY_SLOT_ROD_1) - .setSlotOverlay(false, true, true, GT_UITextures.OVERLAY_SLOT_ROD_2) - .setSlotOverlay(false, true, false, GT_UITextures.OVERLAY_SLOT_DUST) - .setProgressBar(GT_UITextures.PROGRESSBAR_LATHE, ProgressBar.Direction.RIGHT) - .addSpecialTexture(5, 18, 98, 24, GT_UITextures.PROGRESSBAR_LATHE_BASE); + new HashSet<>(1150), + "gt.recipe.lathe", + "Lathe", + null, + RES_PATH_GUI + "basicmachines/Lathe", + 1, + 2, + 1, + 0, + 1, + E, + 1, + E, + true, + true).setSlotOverlay(false, false, GT_UITextures.OVERLAY_SLOT_ROD_1) + .setSlotOverlay(false, true, true, GT_UITextures.OVERLAY_SLOT_ROD_2) + .setSlotOverlay(false, true, false, GT_UITextures.OVERLAY_SLOT_DUST) + .setProgressBar(GT_UITextures.PROGRESSBAR_LATHE, ProgressBar.Direction.RIGHT) + .addSpecialTexture(5, 18, 98, 24, GT_UITextures.PROGRESSBAR_LATHE_BASE); public static final GT_Recipe_Map sCutterRecipes = new GT_Recipe_Map( - new HashSet<>(5125), - "gt.recipe.cuttingsaw", - "Cutting Machine", - null, - RES_PATH_GUI + "basicmachines/Cutter4", - 2, - 4, - 1, - 1, - 1, - E, - 1, - E, - true, - true) - .setSlotOverlay(false, false, GT_UITextures.OVERLAY_SLOT_BOX) - .setSlotOverlay(false, true, true, GT_UITextures.OVERLAY_SLOT_CUTTER_SLICED) - .setSlotOverlay(false, true, false, GT_UITextures.OVERLAY_SLOT_DUST) - .setProgressBar(GT_UITextures.PROGRESSBAR_CUT, ProgressBar.Direction.RIGHT); + new HashSet<>(5125), + "gt.recipe.cuttingsaw", + "Cutting Machine", + null, + RES_PATH_GUI + "basicmachines/Cutter4", + 2, + 4, + 1, + 1, + 1, + E, + 1, + E, + true, + true).setSlotOverlay(false, false, GT_UITextures.OVERLAY_SLOT_BOX) + .setSlotOverlay(false, true, true, GT_UITextures.OVERLAY_SLOT_CUTTER_SLICED) + .setSlotOverlay(false, true, false, GT_UITextures.OVERLAY_SLOT_DUST) + .setProgressBar(GT_UITextures.PROGRESSBAR_CUT, ProgressBar.Direction.RIGHT); public static final GT_Recipe_Map sSlicerRecipes = new GT_Recipe_Map( - new HashSet<>(20), - "gt.recipe.slicer", - "Slicing Machine", - null, - RES_PATH_GUI + "basicmachines/Slicer", - 2, - 1, - 2, - 0, - 1, - E, - 1, - E, - true, - true) - .setSlotOverlay(false, false, true, GT_UITextures.OVERLAY_SLOT_SQUARE) - .setSlotOverlay(false, false, false, GT_UITextures.OVERLAY_SLOT_SLICE_SHAPE) - .setSlotOverlay(false, true, GT_UITextures.OVERLAY_SLOT_SLICER_SLICED) - .setProgressBar(GT_UITextures.PROGRESSBAR_SLICE, ProgressBar.Direction.RIGHT); + new HashSet<>(20), + "gt.recipe.slicer", + "Slicing Machine", + null, + RES_PATH_GUI + "basicmachines/Slicer", + 2, + 1, + 2, + 0, + 1, + E, + 1, + E, + true, + true).setSlotOverlay(false, false, true, GT_UITextures.OVERLAY_SLOT_SQUARE) + .setSlotOverlay(false, false, false, GT_UITextures.OVERLAY_SLOT_SLICE_SHAPE) + .setSlotOverlay(false, true, GT_UITextures.OVERLAY_SLOT_SLICER_SLICED) + .setProgressBar(GT_UITextures.PROGRESSBAR_SLICE, ProgressBar.Direction.RIGHT); public static final GT_Recipe_Map sExtruderRecipes = new GT_Recipe_Map( - new HashSet<>(13000), - "gt.recipe.extruder", - "Extruder", - null, - RES_PATH_GUI + "basicmachines/Extruder", - 2, - 1, - 2, - 0, - 1, - E, - 1, - E, - true, - true) - .setSlotOverlay(false, false, false, GT_UITextures.OVERLAY_SLOT_EXTRUDER_SHAPE) - .setProgressBar(GT_UITextures.PROGRESSBAR_EXTRUDE, ProgressBar.Direction.RIGHT); + new HashSet<>(13000), + "gt.recipe.extruder", + "Extruder", + null, + RES_PATH_GUI + "basicmachines/Extruder", + 2, + 1, + 2, + 0, + 1, + E, + 1, + E, + true, + true).setSlotOverlay(false, false, false, GT_UITextures.OVERLAY_SLOT_EXTRUDER_SHAPE) + .setProgressBar(GT_UITextures.PROGRESSBAR_EXTRUDE, ProgressBar.Direction.RIGHT); 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", - 2, - 2, - 1, - 0, - 1, - E, - 1, - E, - true, - true) - .setUsualFluidInputCount(2) - .setUsualFluidOutputCount(2) - .setSlotOverlay(false, false, GT_UITextures.OVERLAY_SLOT_HAMMER) - .setProgressBar(GT_UITextures.PROGRESSBAR_HAMMER, ProgressBar.Direction.DOWN) - .addSpecialTexture(20, 6, 78, 42, GT_UITextures.PROGRESSBAR_HAMMER_BASE) - .setSlotOverlaySteam(false, GT_UITextures.OVERLAY_SLOT_HAMMER_STEAM) - .setProgressBarSteam(GT_UITextures.PROGRESSBAR_HAMMER_STEAM) - .addSpecialTextureSteam(20, 6, 78, 42, GT_UITextures.PROGRESSBAR_HAMMER_BASE_STEAM); + new HashSet<>(3800), + "gt.recipe.hammer", + "Forge Hammer", + null, + RES_PATH_GUI + "basicmachines/Hammer", + 2, + 2, + 1, + 0, + 1, + E, + 1, + E, + true, + true).setUsualFluidInputCount(2).setUsualFluidOutputCount(2) + .setSlotOverlay(false, false, GT_UITextures.OVERLAY_SLOT_HAMMER) + .setProgressBar(GT_UITextures.PROGRESSBAR_HAMMER, ProgressBar.Direction.DOWN) + .addSpecialTexture(20, 6, 78, 42, GT_UITextures.PROGRESSBAR_HAMMER_BASE) + .setSlotOverlaySteam(false, GT_UITextures.OVERLAY_SLOT_HAMMER_STEAM) + .setProgressBarSteam(GT_UITextures.PROGRESSBAR_HAMMER_STEAM) + .addSpecialTextureSteam(20, 6, 78, 42, GT_UITextures.PROGRESSBAR_HAMMER_BASE_STEAM); public static final GT_Recipe_Map sAmplifiers = new GT_Recipe_Map( - new HashSet<>(2), - "gt.recipe.uuamplifier", - "Amplifabricator", - null, - RES_PATH_GUI + "basicmachines/Amplifabricator", - 1, - 0, - 1, - 0, - 1, - E, - 1, - E, - true, - true) - .setSlotOverlay(false, false, GT_UITextures.OVERLAY_SLOT_CENTRIFUGE) - .setSlotOverlay(true, true, GT_UITextures.OVERLAY_SLOT_UUA) - .setProgressBar(GT_UITextures.PROGRESSBAR_EXTRACT, ProgressBar.Direction.RIGHT); + new HashSet<>(2), + "gt.recipe.uuamplifier", + "Amplifabricator", + null, + RES_PATH_GUI + "basicmachines/Amplifabricator", + 1, + 0, + 1, + 0, + 1, + E, + 1, + E, + true, + true).setSlotOverlay(false, false, GT_UITextures.OVERLAY_SLOT_CENTRIFUGE) + .setSlotOverlay(true, true, GT_UITextures.OVERLAY_SLOT_UUA) + .setProgressBar(GT_UITextures.PROGRESSBAR_EXTRACT, ProgressBar.Direction.RIGHT); public static final GT_Recipe_Map sMassFabFakeRecipes = new GT_Recipe_Map( - new HashSet<>(2), - "gt.recipe.massfab", - "Mass Fabrication", - null, - RES_PATH_GUI + "basicmachines/Massfabricator", - 1, - 0, - 1, - 0, - 8, - E, - 1, - E, - true, - true) - .setSlotOverlay(true, false, GT_UITextures.OVERLAY_SLOT_UUA) - .setSlotOverlay(true, true, GT_UITextures.OVERLAY_SLOT_UUM) - .setProgressBar(GT_UITextures.PROGRESSBAR_ARROW, ProgressBar.Direction.RIGHT); + new HashSet<>(2), + "gt.recipe.massfab", + "Mass Fabrication", + null, + RES_PATH_GUI + "basicmachines/Massfabricator", + 1, + 0, + 1, + 0, + 8, + E, + 1, + E, + true, + true).setSlotOverlay(true, false, GT_UITextures.OVERLAY_SLOT_UUA) + .setSlotOverlay(true, true, GT_UITextures.OVERLAY_SLOT_UUM) + .setProgressBar(GT_UITextures.PROGRESSBAR_ARROW, ProgressBar.Direction.RIGHT); public static final GT_Recipe_Map_Fuel sDieselFuels = (GT_Recipe_Map_Fuel) 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) - .setProgressBar(GT_UITextures.PROGRESSBAR_ARROW, ProgressBar.Direction.RIGHT); + 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).setProgressBar(GT_UITextures.PROGRESSBAR_ARROW, ProgressBar.Direction.RIGHT); public static final GT_Recipe_Map_Fuel sExtremeDieselFuels = (GT_Recipe_Map_Fuel) 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) - .setProgressBar(GT_UITextures.PROGRESSBAR_ARROW, ProgressBar.Direction.RIGHT); + 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).setProgressBar(GT_UITextures.PROGRESSBAR_ARROW, ProgressBar.Direction.RIGHT); public static final GT_Recipe_Map_Fuel sTurbineFuels = (GT_Recipe_Map_Fuel) 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) - .setProgressBar(GT_UITextures.PROGRESSBAR_ARROW, ProgressBar.Direction.RIGHT); + 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).setProgressBar(GT_UITextures.PROGRESSBAR_ARROW, ProgressBar.Direction.RIGHT); public static final GT_Recipe_Map_Fuel sHotFuels = new GT_Recipe_Map_Fuel( new HashSet<>(10), "gt.recipe.thermalgeneratorfuel", @@ -2253,160 +2152,149 @@ public class GT_Recipe implements Comparable<GT_Recipe> { true, false); public static final GT_Recipe_Map_Fuel sDenseLiquidFuels = (GT_Recipe_Map_Fuel) 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) - .setProgressBar(GT_UITextures.PROGRESSBAR_ARROW, ProgressBar.Direction.RIGHT); + 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).setProgressBar(GT_UITextures.PROGRESSBAR_ARROW, ProgressBar.Direction.RIGHT); public static final GT_Recipe_Map_Fuel sPlasmaFuels = (GT_Recipe_Map_Fuel) 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) - .setProgressBar(GT_UITextures.PROGRESSBAR_ARROW, ProgressBar.Direction.RIGHT); + 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).setProgressBar(GT_UITextures.PROGRESSBAR_ARROW, ProgressBar.Direction.RIGHT); public static final GT_Recipe_Map_Fuel sMagicFuels = (GT_Recipe_Map_Fuel) 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) - .setProgressBar(GT_UITextures.PROGRESSBAR_ARROW, ProgressBar.Direction.RIGHT); + 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).setProgressBar(GT_UITextures.PROGRESSBAR_ARROW, ProgressBar.Direction.RIGHT); public static final GT_Recipe_Map_Fuel sSmallNaquadahReactorFuels = (GT_Recipe_Map_Fuel) 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) - .setProgressBar(GT_UITextures.PROGRESSBAR_ARROW, ProgressBar.Direction.RIGHT); + 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).setProgressBar(GT_UITextures.PROGRESSBAR_ARROW, ProgressBar.Direction.RIGHT); public static final GT_Recipe_Map_Fuel sLargeNaquadahReactorFuels = (GT_Recipe_Map_Fuel) 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) - .setProgressBar(GT_UITextures.PROGRESSBAR_ARROW, ProgressBar.Direction.RIGHT); + 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).setProgressBar(GT_UITextures.PROGRESSBAR_ARROW, ProgressBar.Direction.RIGHT); public static final GT_Recipe_Map_Fuel sHugeNaquadahReactorFuels = (GT_Recipe_Map_Fuel) 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) - .setProgressBar(GT_UITextures.PROGRESSBAR_ARROW, ProgressBar.Direction.RIGHT); - public static final GT_Recipe_Map_Fuel sExtremeNaquadahReactorFuels = - (GT_Recipe_Map_Fuel) 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) - .setProgressBar(GT_UITextures.PROGRESSBAR_ARROW, ProgressBar.Direction.RIGHT); - public static final GT_Recipe_Map_Fuel sUltraHugeNaquadahReactorFuels = - (GT_Recipe_Map_Fuel) 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) - .setProgressBar(GT_UITextures.PROGRESSBAR_ARROW, ProgressBar.Direction.RIGHT); + 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).setProgressBar(GT_UITextures.PROGRESSBAR_ARROW, ProgressBar.Direction.RIGHT); + public static final GT_Recipe_Map_Fuel sExtremeNaquadahReactorFuels = (GT_Recipe_Map_Fuel) 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).setProgressBar(GT_UITextures.PROGRESSBAR_ARROW, ProgressBar.Direction.RIGHT); + public static final GT_Recipe_Map_Fuel sUltraHugeNaquadahReactorFuels = (GT_Recipe_Map_Fuel) 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).setProgressBar(GT_UITextures.PROGRESSBAR_ARROW, ProgressBar.Direction.RIGHT); public static final GT_Recipe_Map_Fuel sFluidNaquadahReactorFuels = (GT_Recipe_Map_Fuel) 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) - .setProgressBar(GT_UITextures.PROGRESSBAR_ARROW, ProgressBar.Direction.RIGHT); + 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).setProgressBar(GT_UITextures.PROGRESSBAR_ARROW, ProgressBar.Direction.RIGHT); public static final GT_Recipe_Map sMultiblockElectrolyzerRecipes = new GT_Recipe_Map( new HashSet<>(300), "gt.recipe.largeelectrolyzer", @@ -2455,77 +2343,72 @@ public class GT_Recipe implements Comparable<GT_Recipe> { "", true, false); - public static final GT_Recipe_Map_LargeBoilerFakeFuels sLargeBoilerFakeFuels = - (GT_Recipe_Map_LargeBoilerFakeFuels) new GT_Recipe_Map_LargeBoilerFakeFuels() - .setProgressBar(GT_UITextures.PROGRESSBAR_ARROW, ProgressBar.Direction.RIGHT); + public static final GT_Recipe_Map_LargeBoilerFakeFuels sLargeBoilerFakeFuels = (GT_Recipe_Map_LargeBoilerFakeFuels) new GT_Recipe_Map_LargeBoilerFakeFuels() + .setProgressBar(GT_UITextures.PROGRESSBAR_ARROW, ProgressBar.Direction.RIGHT); public static final GT_Recipe_Map sNanoForge = new GT_Recipe_Map( - new HashSet<>(10), - "gt.recipe.nanoforge", - "Nano Forge", - null, - RES_PATH_GUI + "basicmachines/LCRNEI", - 6, - 2, - 2, - 1, - 1, - "Tier: ", - 1, - "", - false, - true) - .useModularUI(true) - .setUsualFluidInputCount(3) - .setSlotOverlay(false, false, true, GT_UITextures.OVERLAY_SLOT_LENS) - .setProgressBar(GT_UITextures.PROGRESSBAR_ASSEMBLE, ProgressBar.Direction.RIGHT); + new HashSet<>(10), + "gt.recipe.nanoforge", + "Nano Forge", + null, + RES_PATH_GUI + "basicmachines/LCRNEI", + 6, + 2, + 2, + 1, + 1, + "Tier: ", + 1, + "", + false, + true).useModularUI(true).setUsualFluidInputCount(3) + .setSlotOverlay(false, false, true, GT_UITextures.OVERLAY_SLOT_LENS) + .setProgressBar(GT_UITextures.PROGRESSBAR_ASSEMBLE, ProgressBar.Direction.RIGHT); public static final GT_Recipe_Map sPCBFactory = new GT_Recipe_Map( - new HashSet<>(10), - "gt.recipe.pcbfactory", - "PCB Factory", - null, - RES_PATH_GUI + "basicmachines/LCRNEI", - 6, - 9, - 3, - 1, - 1, - E, - 0, - E, - true, - true) - .useModularUI(true) - .setUsualFluidInputCount(3) - .setUsualFluidOutputCount(0) - .setProgressBar(GT_UITextures.PROGRESSBAR_ASSEMBLE, ProgressBar.Direction.RIGHT) - .setNEISpecialInfoFormatter((recipeInfo, applyPrefixAndSuffix) -> { - List<String> result = new ArrayList<>(); - int bitmap = recipeInfo.recipe.mSpecialValue; - if ((bitmap & 0b1) > 0) { - result.add(GT_Utility.trans("336", "PCB Factory Tier: ") + 1); - } else if ((bitmap & 0b10) > 0) { - result.add(GT_Utility.trans("336", "PCB Factory Tier: ") + 2); - } else if ((bitmap & 0b100) > 0) { - result.add(GT_Utility.trans("336", "PCB Factory Tier: ") + 3); - } - if ((bitmap & 0b1000) > 0) { - result.add(GT_Utility.trans("337", "Upgrade Required: ") + GT_Utility.trans("338", "Bio")); - } - return result; - }); + new HashSet<>(10), + "gt.recipe.pcbfactory", + "PCB Factory", + null, + RES_PATH_GUI + "basicmachines/LCRNEI", + 6, + 9, + 3, + 1, + 1, + E, + 0, + E, + true, + true).useModularUI(true).setUsualFluidInputCount(3).setUsualFluidOutputCount(0) + .setProgressBar(GT_UITextures.PROGRESSBAR_ASSEMBLE, ProgressBar.Direction.RIGHT) + .setNEISpecialInfoFormatter((recipeInfo, applyPrefixAndSuffix) -> { + List<String> result = new ArrayList<>(); + int bitmap = recipeInfo.recipe.mSpecialValue; + if ((bitmap & 0b1) > 0) { + result.add(GT_Utility.trans("336", "PCB Factory Tier: ") + 1); + } else if ((bitmap & 0b10) > 0) { + result.add(GT_Utility.trans("336", "PCB Factory Tier: ") + 2); + } else if ((bitmap & 0b100) > 0) { + result.add(GT_Utility.trans("336", "PCB Factory Tier: ") + 3); + } + if ((bitmap & 0b1000) > 0) { + result.add( + GT_Utility.trans("337", "Upgrade Required: ") + GT_Utility.trans("338", "Bio")); + } + return result; + }); public static final GT_Recipe_Map_IC2NuclearFake sIC2NuclearFakeRecipe = new GT_Recipe_Map_IC2NuclearFake(); /** * 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<>(); /** @@ -2546,12 +2429,8 @@ public class GT_Recipe implements Comparable<GT_Recipe> { 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; /** @@ -2560,8 +2439,8 @@ public class GT_Recipe implements Comparable<GT_Recipe> { public boolean mNEIUnificateOutput = true; /** - * Unique identifier for this recipe map. Generated from aUnlocalizedName and a few other parameters. - * See constructor for details. + * Unique identifier for this recipe map. Generated from aUnlocalizedName and a few other parameters. See + * constructor for details. */ public final String mUniqueIdentifier; @@ -2576,14 +2455,14 @@ public class GT_Recipe implements Comparable<GT_Recipe> { private boolean mUsesSpecialSlot = false; /** - * How many fluid inputs does this recipemap has at most. Currently used only for NEI slot placements - * and does not actually restrict number of fluids used in the recipe. + * How many fluid inputs does this recipemap has at most. Currently used only for NEI slot placements and does + * not actually restrict number of fluids used in the recipe. */ private int usualFluidInputCount; /** - * How many fluid outputs does this recipemap has at most. Currently used only for NEI slot placements - * and does not actually restrict number of fluids used in the recipe. + * How many fluid outputs does this recipemap has at most. Currently used only for NEI slot placements and does + * not actually restrict number of fluids used in the recipe. */ private int usualFluidOutputCount; @@ -2593,36 +2472,28 @@ public class GT_Recipe implements Comparable<GT_Recipe> { public boolean useModularUI = false; /** - * Overlays used for GUI. - * 1 = If it's fluid slot. - * 2 = If it's output slot. - * 4 = If it's first slot in the same section, e.g. first slot in the item output slots - * 8 = If it's special item slot. + * Overlays used for GUI. 1 = If it's fluid slot. 2 = If it's output slot. 4 = If it's first slot in the same + * section, e.g. first slot in the item output slots 8 = If it's special item slot. */ private final TByteObjectMap<IDrawable> slotOverlays = new TByteObjectHashMap<>(); /** - * Overlays used for GUI on steam machine. - * 1 = If it's fluid slot. - * 2 = If it's output slot. - * 4 = If it's first slot in the same section, e.g. first slot in the item output slots - * 8 = If it's special item slot. + * Overlays used for GUI on steam machine. 1 = If it's fluid slot. 2 = If it's output slot. 4 = If it's first + * slot in the same section, e.g. first slot in the item output slots 8 = If it's special item slot. */ private final TByteObjectMap<SteamTexture> slotOverlaysSteam = new TByteObjectHashMap<>(); /** - * Progressbar used for BasicMachine GUI and/or NEI. - * Unless specified, size should be (20, 36), consisting of two parts; - * First is (20, 18) size of "empty" image at the top, - * Second is (20, 18) size of "filled" image at the bottom. + * Progressbar used for BasicMachine GUI and/or NEI. Unless specified, size should be (20, 36), consisting of + * two parts; First is (20, 18) size of "empty" image at the top, Second is (20, 18) size of "filled" image at + * the bottom. */ private FallbackableUITexture progressBarTexture; /** - * Progressbar used for steam machine GUI and/or NEI. - * Unless specified, size should be (20, 36), consisting of two parts; - * First is (20, 18) size of "empty" image at the top, - * Second is (20, 18) size of "filled" image at the bottom. + * Progressbar used for steam machine GUI and/or NEI. Unless specified, size should be (20, 36), consisting of + * two parts; First is (20, 18) size of "empty" image at the top, Second is (20, 18) size of "filled" image at + * the bottom. */ private FallbackableSteamTexture progressBarTextureSteam; @@ -2633,7 +2504,10 @@ public class GT_Recipe implements Comparable<GT_Recipe> { public Pos2d progressBarPos = new Pos2d(78, 24); public Rectangle neiTransferRect = new Rectangle( - progressBarPos.x - (16 / 2), progressBarPos.y, progressBarSize.width + 16, progressBarSize.height); + progressBarPos.x - (16 / 2), + progressBarPos.y, + progressBarSize.width + 16, + progressBarSize.height); /** * Image size in direction of progress. Used for non-smooth rendering. @@ -2668,10 +2542,12 @@ public class GT_Recipe implements Comparable<GT_Recipe> { /** * Initialises a new type of Recipe Handler. * - * @param aRecipeList a List you specify as Recipe List. Usually just an ArrayList with a pre-initialised Size. + * @param aRecipeList a List you specify as Recipe List. Usually just an ArrayList with a + * pre-initialised Size. * @param aUnlocalizedName the unlocalised Name of this Recipe Handler, used mainly for NEI. * @param aLocalName the displayed Name inside the NEI Recipe GUI. - * @param aNEIGUIPath the displayed GUI Texture, usually just a Machine GUI. Auto-Attaches ".png" if forgotten. + * @param aNEIGUIPath the displayed GUI Texture, usually just a Machine GUI. Auto-Attaches ".png" + * if forgotten. * @param aUsualInputCount the usual amount of Input Slots this Recipe Class has. * @param aUsualOutputCount the usual amount of Output Slots this Recipe Class has. * @param aNEISpecialValuePre the String in front of the Special Value in NEI. @@ -2679,21 +2555,10 @@ public class GT_Recipe implements Comparable<GT_Recipe> { * @param aNEISpecialValuePost the String after the Special Value. Usually for a Unit or something. * @param aNEIAllowed if NEI is allowed to display this Recipe Handler in general. */ - 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, + 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) { sMappings.add(this); mNEIAllowed = aNEIAllowed; @@ -2729,23 +2594,11 @@ public class GT_Recipe implements Comparable<GT_Recipe> { } @Deprecated - 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) { this( aRecipeList, aUnlocalizedName, @@ -2775,8 +2628,8 @@ public class GT_Recipe implements Comparable<GT_Recipe> { return this; } - public GT_Recipe_Map setSlotOverlay( - boolean isFluid, boolean isOutput, boolean isFirst, boolean isSpecial, IDrawable slotOverlay) { + public GT_Recipe_Map setSlotOverlay(boolean isFluid, boolean isOutput, boolean isFirst, boolean isSpecial, + IDrawable slotOverlay) { useModularUI(true); this.slotOverlays.put( (byte) ((isFluid ? 1 : 0) + (isOutput ? 2 : 0) + (isFirst ? 4 : 0) + (isSpecial ? 8 : 0)), @@ -2793,8 +2646,8 @@ public class GT_Recipe implements Comparable<GT_Recipe> { .setSlotOverlay(isFluid, isOutput, false, slotOverlay); } - public GT_Recipe_Map setSlotOverlaySteam( - boolean isFluid, boolean isOutput, boolean isFirst, boolean isSpecial, SteamTexture slotOverlay) { + public GT_Recipe_Map setSlotOverlaySteam(boolean isFluid, boolean isOutput, boolean isFirst, boolean isSpecial, + SteamTexture slotOverlay) { useModularUI(true); this.slotOverlaysSteam.put( (byte) ((isFluid ? 1 : 0) + (isOutput ? 2 : 0) + (isFirst ? 4 : 0) + (isSpecial ? 8 : 0)), @@ -2814,7 +2667,8 @@ public class GT_Recipe implements Comparable<GT_Recipe> { public GT_Recipe_Map setProgressBar(UITexture progressBarTexture, ProgressBar.Direction progressBarDirection) { return setProgressBarWithFallback( new FallbackableUITexture( - UITexture.fullImage("gregtech", "gui/progressbar/" + mUnlocalizedName), progressBarTexture), + UITexture.fullImage("gregtech", "gui/progressbar/" + mUnlocalizedName), + progressBarTexture), progressBarDirection); } @@ -2823,12 +2677,11 @@ public class GT_Recipe implements Comparable<GT_Recipe> { } /** - * Some resource packs want to use custom progress bar textures even for plain arrow. - * This method allows them to add unique textures, yet other packs don't need to make textures - * for every recipemap. + * Some resource packs want to use custom progress bar textures even for plain arrow. This method allows them to + * add unique textures, yet other packs don't need to make textures for every recipemap. */ - public GT_Recipe_Map setProgressBarWithFallback( - FallbackableUITexture progressBarTexture, ProgressBar.Direction progressBarDirection) { + public GT_Recipe_Map setProgressBarWithFallback(FallbackableUITexture progressBarTexture, + ProgressBar.Direction progressBarDirection) { useModularUI(true); this.progressBarTexture = progressBarTexture; this.progressBarDirection = progressBarDirection; @@ -2836,9 +2689,10 @@ public class GT_Recipe implements Comparable<GT_Recipe> { } public GT_Recipe_Map setProgressBarSteam(SteamTexture progressBarTexture) { - return setProgressBarSteamWithFallback(new FallbackableSteamTexture( - SteamTexture.fullImage("gregtech", "gui/progressbar/" + mUnlocalizedName + "_%s"), - progressBarTexture)); + return setProgressBarSteamWithFallback( + new FallbackableSteamTexture( + SteamTexture.fullImage("gregtech", "gui/progressbar/" + mUnlocalizedName + "_%s"), + progressBarTexture)); } public GT_Recipe_Map setProgressBarSteamWithFallback(FallbackableSteamTexture progressBarTexture) { @@ -2872,15 +2726,15 @@ public class GT_Recipe implements Comparable<GT_Recipe> { public GT_Recipe_Map addSpecialTexture(int width, int height, int x, int y, IDrawable texture) { useModularUI(true); - specialTextures.add( - new ImmutablePair<>(texture, new ImmutablePair<>(new Size(width, height), new Pos2d(x, y)))); + specialTextures + .add(new ImmutablePair<>(texture, new ImmutablePair<>(new Size(width, height), new Pos2d(x, y)))); return this; } public GT_Recipe_Map addSpecialTextureSteam(int width, int height, int x, int y, SteamTexture texture) { useModularUI(true); - specialTexturesSteam.add( - new ImmutablePair<>(texture, new ImmutablePair<>(new Size(width, height), new Pos2d(x, y)))); + specialTexturesSteam + .add(new ImmutablePair<>(texture, new ImmutablePair<>(new Size(width, height), new Pos2d(x, y)))); return this; } @@ -2931,37 +2785,25 @@ public class GT_Recipe implements Comparable<GT_Recipe> { return this; } - public GT_Recipe addRecipe( - boolean aOptimize, - ItemStack[] aInputs, - ItemStack[] aOutputs, - Object aSpecial, - int[] aOutputChances, - FluidStack[] aFluidInputs, - FluidStack[] aFluidOutputs, - int aDuration, - int aEUt, + 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)); + 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) { + public GT_Recipe addRecipe(int[] aOutputChances, FluidStack[] aFluidInputs, FluidStack[] aFluidOutputs, + int aDuration, int aEUt, int aSpecialValue) { return addRecipe( new GT_Recipe( false, @@ -2979,35 +2821,28 @@ public class GT_Recipe implements Comparable<GT_Recipe> { 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(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) @@ -3019,19 +2854,12 @@ 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 + * 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) { + 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( @@ -3048,17 +2876,11 @@ 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 + * 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, + 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, @@ -3075,17 +2897,9 @@ public class GT_Recipe implements Comparable<GT_Recipe> { 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) { + 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( @@ -3102,18 +2916,9 @@ public class GT_Recipe implements Comparable<GT_Recipe> { 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) { + 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( @@ -3132,7 +2937,8 @@ 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 + * 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, GT_Recipe aRecipe) { return addRecipe(aRecipe, aCheckForCollisions, true, false); @@ -3146,8 +2952,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()); } @@ -3174,9 +2980,8 @@ 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))); } /** @@ -3193,79 +2998,66 @@ public class GT_Recipe implements Comparable<GT_Recipe> { 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) { + 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); + 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, 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) { + 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); + 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) { + 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. * - * @param aTileEntity an Object representing the current coordinates of the executing Block/Entity/Whatever. This may be null, especially during Startup. - * @param aRecipe in case this is != null it will try to use this Recipe first when looking things up. - * @param aNotUnificated if this is T the Recipe searcher will unificate the ItemStack Inputs - * @param aDontCheckStackSizes if set to false will only return recipes that can be executed at least once with the provided input - * @param aVoltage Voltage of the Machine or Long.MAX_VALUE if it has no Voltage - * @param aFluids the Fluid Inputs - * @param aSpecialSlot the content of the Special Slot, the regular Manager doesn't do anything with this, but some custom ones do. - * @param aInputs the Item Inputs + * @param aTileEntity an Object representing the current coordinates of the executing + * Block/Entity/Whatever. This may be null, especially during Startup. + * @param aRecipe in case this is != null it will try to use this Recipe first when looking things + * up. + * @param aNotUnificated if this is T the Recipe searcher will unificate the ItemStack Inputs + * @param aDontCheckStackSizes if set to false will only return recipes that can be executed at least once with + * the provided input + * @param aVoltage Voltage of the Machine or Long.MAX_VALUE if it has no Voltage + * @param aFluids the Fluid Inputs + * @param aSpecialSlot the content of the Special Slot, the regular Manager doesn't do anything with + * this, but some custom ones do. + * @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, + 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; @@ -3293,54 +3085,41 @@ public class GT_Recipe implements Comparable<GT_Recipe> { if (aNotUnificated) aInputs = GT_OreDictUnificator.getStackArray(true, (Object[]) aInputs); // 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)) - return aRecipe.mEnabled && aVoltage * mAmperage >= aRecipe.mEUt ? aRecipe : null; + if (aRecipe != null) 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 (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; } protected GT_Recipe addToItemMap(GT_Recipe aRecipe) { - for (ItemStack aStack : aRecipe.mInputs) - if (aStack != null) { - GT_ItemStack tStack = new GT_ItemStack(aStack); - Collection<GT_Recipe> tList = mRecipeItemMap.computeIfAbsent(tStack, k -> new HashSet<>(1)); - tList.add(aRecipe); - } + for (ItemStack aStack : aRecipe.mInputs) if (aStack != null) { + GT_ItemStack tStack = new GT_ItemStack(aStack); + Collection<GT_Recipe> tList = mRecipeItemMap.computeIfAbsent(tStack, k -> new HashSet<>(1)); + tList.add(aRecipe); + } return aRecipe; } @@ -3375,8 +3154,9 @@ public class GT_Recipe implements Comparable<GT_Recipe> { @Nullable public IDrawable getOverlayForSlot(boolean isFluid, boolean isOutput, int index, boolean isSpecial) { - byte overlayKey = - (byte) ((isFluid ? 1 : 0) + (isOutput ? 2 : 0) + (index == 0 ? 4 : 0) + (isSpecial ? 8 : 0)); + byte overlayKey = (byte) ((isFluid ? 1 : 0) + (isOutput ? 2 : 0) + + (index == 0 ? 4 : 0) + + (isSpecial ? 8 : 0)); if (slotOverlays.containsKey(overlayKey)) { return slotOverlays.get(overlayKey); } @@ -3385,8 +3165,9 @@ public class GT_Recipe implements Comparable<GT_Recipe> { @Nullable public SteamTexture getOverlayForSlotSteam(boolean isFluid, boolean isOutput, int index, boolean isSpecial) { - byte overlayKey = - (byte) ((isFluid ? 1 : 0) + (isOutput ? 2 : 0) + (index == 0 ? 4 : 0) + (isSpecial ? 8 : 0)); + byte overlayKey = (byte) ((isFluid ? 1 : 0) + (isOutput ? 2 : 0) + + (index == 0 ? 4 : 0) + + (isSpecial ? 8 : 0)); if (slotOverlaysSteam.containsKey(overlayKey)) { return slotOverlaysSteam.get(overlayKey); } @@ -3432,41 +3213,31 @@ public class GT_Recipe implements Comparable<GT_Recipe> { /** * Adds slot backgrounds, progressBar, etc. */ - public ModularWindow.Builder createNEITemplate( - IItemHandlerModifiable itemInputsInventory, - IItemHandlerModifiable itemOutputsInventory, - IItemHandlerModifiable specialSlotInventory, - IItemHandlerModifiable fluidInputsInventory, - IItemHandlerModifiable fluidOutputsInventory, - Supplier<Float> progressSupplier, - Pos2d windowOffset) { - ModularWindow.Builder builder = - ModularWindow.builder(neiBackgroundSize).setBackground(ModularUITextures.VANILLA_BACKGROUND); + public ModularWindow.Builder createNEITemplate(IItemHandlerModifiable itemInputsInventory, + IItemHandlerModifiable itemOutputsInventory, IItemHandlerModifiable specialSlotInventory, + IItemHandlerModifiable fluidInputsInventory, IItemHandlerModifiable fluidOutputsInventory, + Supplier<Float> progressSupplier, Pos2d windowOffset) { + ModularWindow.Builder builder = ModularWindow.builder(neiBackgroundSize) + .setBackground(ModularUITextures.VANILLA_BACKGROUND); UIHelper.forEachSlots( - (i, backgrounds, pos) -> builder.widget(SlotWidget.phantom(itemInputsInventory, i) - .setBackground(backgrounds) - .setPos(pos) - .setSize(18, 18)), - (i, backgrounds, pos) -> builder.widget(SlotWidget.phantom(itemOutputsInventory, i) - .setBackground(backgrounds) - .setPos(pos) - .setSize(18, 18)), + (i, backgrounds, pos) -> builder.widget( + SlotWidget.phantom(itemInputsInventory, i).setBackground(backgrounds).setPos(pos) + .setSize(18, 18)), + (i, backgrounds, pos) -> builder.widget( + SlotWidget.phantom(itemOutputsInventory, i).setBackground(backgrounds).setPos(pos) + .setSize(18, 18)), (i, backgrounds, pos) -> { - if (usesSpecialSlot()) - builder.widget(SlotWidget.phantom(specialSlotInventory, 0) - .setBackground(backgrounds) - .setPos(pos) - .setSize(18, 18)); + if (usesSpecialSlot()) builder.widget( + SlotWidget.phantom(specialSlotInventory, 0).setBackground(backgrounds).setPos(pos) + .setSize(18, 18)); }, - (i, backgrounds, pos) -> builder.widget(SlotWidget.phantom(fluidInputsInventory, i) - .setBackground(backgrounds) - .setPos(pos) - .setSize(18, 18)), - (i, backgrounds, pos) -> builder.widget(SlotWidget.phantom(fluidOutputsInventory, i) - .setBackground(backgrounds) - .setPos(pos) - .setSize(18, 18)), + (i, backgrounds, pos) -> builder.widget( + SlotWidget.phantom(fluidInputsInventory, i).setBackground(backgrounds).setPos(pos) + .setSize(18, 18)), + (i, backgrounds, pos) -> builder.widget( + SlotWidget.phantom(fluidOutputsInventory, i).setBackground(backgrounds).setPos(pos) + .setSize(18, 18)), ModularUITextures.ITEM_SLOT, ModularUITextures.FLUID_SLOT, this, @@ -3481,29 +3252,25 @@ public class GT_Recipe implements Comparable<GT_Recipe> { addGregTechLogoUI(builder, windowOffset); for (Pair<IDrawable, Pair<Size, Pos2d>> specialTexture : specialTextures) { - builder.widget(new DrawableWidget() - .setDrawable(specialTexture.getLeft()) - .setSize(specialTexture.getRight().getLeft()) - .setPos(specialTexture.getRight().getRight().add(windowOffset))); + builder.widget( + new DrawableWidget().setDrawable(specialTexture.getLeft()) + .setSize(specialTexture.getRight().getLeft()) + .setPos(specialTexture.getRight().getRight().add(windowOffset))); } return builder; } - public void addProgressBarUI( - ModularWindow.Builder builder, Supplier<Float> progressSupplier, Pos2d windowOffset) { - builder.widget(new ProgressBar() - .setTexture(getProgressBarTexture(), 20) - .setDirection(progressBarDirection) - .setProgress(progressSupplier) - .setSynced(false, false) - .setPos(progressBarPos.add(windowOffset)) - .setSize(progressBarSize)); + public void addProgressBarUI(ModularWindow.Builder builder, Supplier<Float> progressSupplier, + Pos2d windowOffset) { + builder.widget( + new ProgressBar().setTexture(getProgressBarTexture(), 20).setDirection(progressBarDirection) + .setProgress(progressSupplier).setSynced(false, false) + .setPos(progressBarPos.add(windowOffset)).setSize(progressBarSize)); } public void addGregTechLogoUI(ModularWindow.Builder builder, Pos2d windowOffset) { - builder.widget( - new DrawableWidget().setDrawable(logo).setSize(logoSize).setPos(logoPos.add(windowOffset))); + builder.widget(new DrawableWidget().setDrawable(logo).setSize(logoSize).setPos(logoPos.add(windowOffset))); } /** @@ -3604,7 +3371,8 @@ public class GT_Recipe implements Comparable<GT_Recipe> { } } else if (neiSpecialInfoFormatter != null) { drawNEITextMultipleLines( - recipeInfo, neiSpecialInfoFormatter.format(recipeInfo, this::formatSpecialValue)); + recipeInfo, + neiSpecialInfoFormatter.format(recipeInfo, this::formatSpecialValue)); } else { drawOptionalNEIText(recipeInfo, getNEISpecialInfo(recipeInfo.recipe.mSpecialValue)); } @@ -3632,8 +3400,7 @@ public class GT_Recipe implements Comparable<GT_Recipe> { } protected String formatSpecialValue(int specialValue) { - return mNEISpecialValuePre - + GT_Utility.formatNumbers((long) specialValue * mNEISpecialValueMultiplier) + return mNEISpecialValuePre + GT_Utility.formatNumbers((long) specialValue * mNEISpecialValueMultiplier) + mNEISpecialValuePost; } @@ -3643,26 +3410,22 @@ public class GT_Recipe implements Comparable<GT_Recipe> { if (recipe.owners.size() > 1) { drawNEIText( recipeInfo, - EnumChatFormatting.ITALIC - + GT_Utility.trans("273", "Original Recipe by: ") + EnumChatFormatting.ITALIC + GT_Utility.trans("273", "Original Recipe by: ") + recipe.owners.get(0).getName()); for (int i = 1; i < recipe.owners.size(); i++) { drawNEIText( recipeInfo, - EnumChatFormatting.ITALIC - + GT_Utility.trans("274", "Modified by: ") + EnumChatFormatting.ITALIC + GT_Utility.trans("274", "Modified by: ") + recipe.owners.get(i).getName()); } } else if (recipe.owners.size() > 0) { drawNEIText( recipeInfo, - EnumChatFormatting.ITALIC - + GT_Utility.trans("272", "Recipe by: ") + EnumChatFormatting.ITALIC + GT_Utility.trans("272", "Recipe by: ") + recipe.owners.get(0).getName()); } } - if (GT_Mod.gregtechproxy.mNEIRecipeOwnerStackTrace - && recipe.stackTraces != null + if (GT_Mod.gregtechproxy.mNEIRecipeOwnerStackTrace && recipe.stackTraces != null && !recipe.stackTraces.isEmpty()) { drawNEIText(recipeInfo, "stackTrace:"); // todo: good way to show all stacktraces @@ -3678,6 +3441,7 @@ public class GT_Recipe implements Comparable<GT_Recipe> { /** * Draws text on NEI recipe. + * * @param yShift y position to shift after this text */ @SuppressWarnings("SameParameterValue") @@ -3687,18 +3451,17 @@ public class GT_Recipe implements Comparable<GT_Recipe> { /** * Draws text on NEI recipe. + * * @param xStart x position to start drawing * @param yShift y position to shift after this text */ @SuppressWarnings("SameParameterValue") protected void drawNEIText(NEIRecipeInfo recipeInfo, String text, int xStart, int yShift) { - Minecraft.getMinecraft() - .fontRenderer - .drawString( - text, - xStart, - recipeInfo.yPos, - neiTextColorOverride != -1 ? neiTextColorOverride : 0x000000); + Minecraft.getMinecraft().fontRenderer.drawString( + text, + xStart, + recipeInfo.yPos, + neiTextColorOverride != -1 ? neiTextColorOverride : 0x000000); recipeInfo.yPos += yShift; } @@ -3714,13 +3477,14 @@ public class GT_Recipe implements Comparable<GT_Recipe> { } } - public List<String> handleNEIItemTooltip( - ItemStack stack, List<String> currentTip, GT_NEI_DefaultHandler.CachedDefaultRecipe neiCachedRecipe) { + public List<String> handleNEIItemTooltip(ItemStack stack, List<String> currentTip, + GT_NEI_DefaultHandler.CachedDefaultRecipe neiCachedRecipe) { for (PositionedStack pStack : neiCachedRecipe.mInputs) { if (stack == pStack.item) { if (pStack instanceof GT_NEI_DefaultHandler.FixedPositionedStack) { currentTip = handleNEIItemInputTooltip( - currentTip, (GT_NEI_DefaultHandler.FixedPositionedStack) pStack); + currentTip, + (GT_NEI_DefaultHandler.FixedPositionedStack) pStack); } break; } @@ -3729,7 +3493,8 @@ public class GT_Recipe implements Comparable<GT_Recipe> { if (stack == pStack.item) { if (pStack instanceof GT_NEI_DefaultHandler.FixedPositionedStack) { currentTip = handleNEIItemOutputTooltip( - currentTip, (GT_NEI_DefaultHandler.FixedPositionedStack) pStack); + currentTip, + (GT_NEI_DefaultHandler.FixedPositionedStack) pStack); } break; } @@ -3737,16 +3502,16 @@ public class GT_Recipe implements Comparable<GT_Recipe> { return currentTip; } - protected List<String> handleNEIItemInputTooltip( - List<String> currentTip, GT_NEI_DefaultHandler.FixedPositionedStack pStack) { + protected List<String> handleNEIItemInputTooltip(List<String> currentTip, + GT_NEI_DefaultHandler.FixedPositionedStack pStack) { if (pStack.isNotConsumed()) { currentTip.add(GRAY + GT_Utility.trans("151", "Does not get consumed in the process")); } return currentTip; } - protected List<String> handleNEIItemOutputTooltip( - List<String> currentTip, GT_NEI_DefaultHandler.FixedPositionedStack pStack) { + protected List<String> handleNEIItemOutputTooltip(List<String> currentTip, + GT_NEI_DefaultHandler.FixedPositionedStack pStack) { if (pStack.isChanceBased()) { currentTip.add(GRAY + GT_Utility.trans("150", "Chance: ") + pStack.getChanceText()); } @@ -3779,8 +3544,8 @@ public class GT_Recipe implements Comparable<GT_Recipe> { } @SuppressWarnings("SameParameterValue") - protected void drawNEIOverlayText( - String text, PositionedStack stack, int color, float scale, boolean shadow, Alignment alignment) { + protected void drawNEIOverlayText(String text, PositionedStack stack, int color, float scale, boolean shadow, + Alignment alignment) { FontRenderer fontRenderer = Minecraft.getMinecraft().fontRenderer; int width = fontRenderer.getStringWidth(text); int x = (int) ((stack.relx + 8 + 8 * alignment.x) / scale) - (width / 2 * (alignment.x + 1)); @@ -3820,7 +3585,8 @@ public class GT_Recipe implements Comparable<GT_Recipe> { } /** - * Use {@link #getItemInputPositions} or {@link #getSpecialItemPosition} or {@link #getFluidInputPositions} instead + * Use {@link #getItemInputPositions} or {@link #getSpecialItemPosition} or {@link #getFluidInputPositions} + * instead */ @Deprecated public ArrayList<PositionedStack> getInputPositionedStacks(GT_Recipe recipe) { @@ -3843,30 +3609,19 @@ public class GT_Recipe implements Comparable<GT_Recipe> { // ----------------------------------------------------------------------------------------------------------------- /** - * Nicely display NEI with many items and fluids. - * Remember to call {@link GT_Recipe_Map#setUsualFluidInputCount} and {@link GT_Recipe_Map#setUsualFluidOutputCount}. - * If row count >= 6, it doesn't fit in 2 recipes per page, so change it via IMC. + * Nicely display NEI with many items and fluids. Remember to call {@link GT_Recipe_Map#setUsualFluidInputCount} and + * {@link GT_Recipe_Map#setUsualFluidOutputCount}. If row count >= 6, it doesn't fit in 2 recipes per page, so + * change it via IMC. */ public static class GT_Recipe_Map_LargeNEI extends GT_Recipe_Map { private static final int xDirMaxCount = 3; private static final int yOrigin = 8; - public GT_Recipe_Map_LargeNEI( - 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, + public GT_Recipe_Map_LargeNEI(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, @@ -3909,14 +3664,10 @@ public class GT_Recipe implements Comparable<GT_Recipe> { } @Override - public ModularWindow.Builder createNEITemplate( - IItemHandlerModifiable itemInputsInventory, - IItemHandlerModifiable itemOutputsInventory, - IItemHandlerModifiable specialSlotInventory, - IItemHandlerModifiable fluidInputsInventory, - IItemHandlerModifiable fluidOutputsInventory, - Supplier<Float> progressSupplier, - Pos2d windowOffset) { + public ModularWindow.Builder createNEITemplate(IItemHandlerModifiable itemInputsInventory, + IItemHandlerModifiable itemOutputsInventory, IItemHandlerModifiable specialSlotInventory, + IItemHandlerModifiable fluidInputsInventory, IItemHandlerModifiable fluidOutputsInventory, + Supplier<Float> progressSupplier, Pos2d windowOffset) { // Delay setter so that calls to #setUsualFluidInputCount and #setUsualFluidOutputCount are considered setNEIBackgroundSize(172, 82 + (Math.max(getItemRowCount() + getFluidRowCount() - 4, 0)) * 18); return super.createNEITemplate( @@ -3943,21 +3694,10 @@ public class GT_Recipe implements Comparable<GT_Recipe> { */ public static class GT_Recipe_Map_FluidOnly extends GT_Recipe_Map { - public GT_Recipe_Map_FluidOnly( - 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, + public GT_Recipe_Map_FluidOnly(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, @@ -3993,21 +3733,11 @@ 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, + + 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, @@ -4043,31 +3773,15 @@ 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, + 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; } @@ -4077,46 +3791,23 @@ 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, + 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; } @@ -4145,23 +3836,13 @@ public class GT_Recipe implements Comparable<GT_Recipe> { * Just a Recipe Map with Utility specifically for Fuels. */ 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, + 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, @@ -4193,30 +3874,21 @@ 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, + 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) { + 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}, + new ItemStack[] { aInput }, + new ItemStack[] { aOutput }, null, - new int[] {aChance}, - new FluidStack[] {aFluidInput}, - new FluidStack[] {aFluidOutput}, + new int[] { aChance }, + new FluidStack[] { aFluidInput }, + new FluidStack[] { aFluidOutput }, 0, 0, aFuelValueInEU); @@ -4225,8 +3897,7 @@ public class GT_Recipe implements Comparable<GT_Recipe> { @Override public GT_Recipe add(GT_Recipe aRecipe) { aRecipe = super.add(aRecipe); - if (aRecipe.mInputs != null - && GT_Utility.getNonnullElementCount(aRecipe.mInputs) == 1 + 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) { @@ -4237,8 +3908,8 @@ public class GT_Recipe implements Comparable<GT_Recipe> { && aRecipe.mFluidInputs != null && GT_Utility.getNonnullElementCount(aRecipe.mFluidInputs) == 1 && aRecipe.mFluidInputs[0] != null) { - mRecipesByFluidInput.put(aRecipe.mFluidInputs[0].getUnlocalizedName(), aRecipe); - } + mRecipesByFluidInput.put(aRecipe.mFluidInputs[0].getUnlocalizedName(), aRecipe); + } return aRecipe; } @@ -4251,21 +3922,11 @@ 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, + + 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, @@ -4286,23 +3947,16 @@ public class GT_Recipe implements Comparable<GT_Recipe> { } @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 + return tOutput == null ? null : new GT_Recipe( false, - new ItemStack[] {GT_Utility.copyAmount(1, aInputs[0])}, - new ItemStack[] {tOutput}, + new ItemStack[] { GT_Utility.copyAmount(1, aInputs[0]) }, + new ItemStack[] { tOutput }, null, null, null, @@ -4322,21 +3976,11 @@ 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, + + 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, @@ -4357,14 +4001,8 @@ public class GT_Recipe implements Comparable<GT_Recipe> { } @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); @@ -4372,9 +4010,9 @@ public class GT_Recipe implements Comparable<GT_Recipe> { 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)) - }, + new ItemStack[] { GT_Utility.copyAmount(1, aInputs[0]) }, + new ItemStack[] { + GT_Utility.getWrittenBook("Manual_Microwave", ItemList.Book_Written_03.get(1)) }, null, null, null, @@ -4386,12 +4024,8 @@ public class GT_Recipe implements Comparable<GT_Recipe> { // 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 - }) + 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) @@ -4426,24 +4060,23 @@ public class GT_Recipe implements Comparable<GT_Recipe> { return null; } } - for (MaterialStack tMaterial : tData.mByProducts) - if (tMaterial != null) { - 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); - } - return null; + for (MaterialStack tMaterial : tData.mByProducts) if (tMaterial != null) { + 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); } - if (tMaterial.mMaterial.contains(SubTag.FLAMMABLE)) { - if (aTileEntity instanceof IGregTechTileEntity) { - ((IGregTechTileEntity) aTileEntity).setOnFire(); - GT_Log.exp.println("Microwave INFLAMMATION due to FLAMMABLE insertion"); - } - return null; + return null; + } + if (tMaterial.mMaterial.contains(SubTag.FLAMMABLE)) { + if (aTileEntity instanceof IGregTechTileEntity) { + ((IGregTechTileEntity) aTileEntity).setOnFire(); + GT_Log.exp.println("Microwave INFLAMMATION due to FLAMMABLE insertion"); } + return null; } + } } if (TileEntityFurnace.getItemBurnTime(tStack) > 0) { if (aTileEntity instanceof IGregTechTileEntity) { @@ -4454,12 +4087,11 @@ public class GT_Recipe implements Comparable<GT_Recipe> { } } - return tOutput == null - ? null + return tOutput == null ? null : new GT_Recipe( false, - new ItemStack[] {GT_Utility.copyAmount(1, aInputs[0])}, - new ItemStack[] {tOutput}, + new ItemStack[] { GT_Utility.copyAmount(1, aInputs[0]) }, + new ItemStack[] { tOutput }, null, null, null, @@ -4479,21 +4111,11 @@ 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, + + 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, @@ -4514,14 +4136,8 @@ public class GT_Recipe implements Comparable<GT_Recipe> { } @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(); @@ -4529,8 +4145,8 @@ public class GT_Recipe implements Comparable<GT_Recipe> { 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}, + new ItemStack[] { ItemList.IC2_Scrapbox.get(1) }, + new ItemStack[] { tOutput }, null, null, null, @@ -4556,21 +4172,11 @@ 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, + + 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, @@ -4591,51 +4197,49 @@ public class GT_Recipe implements Comparable<GT_Recipe> { } @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 + 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; + || !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); + 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); } 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); + 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); } if (rRecipe != null) rRecipe.mCanBeBuffered = false; return rRecipe; @@ -4643,10 +4247,8 @@ 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 @@ -4664,21 +4266,11 @@ 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, + + 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, @@ -4699,24 +4291,17 @@ public class GT_Recipe implements Comparable<GT_Recipe> { } @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)}, + 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}, + new int[] { 1250 }, null, null, 45, @@ -4734,21 +4319,11 @@ 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, + + 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, @@ -4769,14 +4344,8 @@ public class GT_Recipe implements Comparable<GT_Recipe> { } @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]); @@ -4791,9 +4360,8 @@ public class GT_Recipe implements Comparable<GT_Recipe> { return GT_Utility.arrayContainsNonNull(tOutputItems) ? new GT_Recipe( false, - new ItemStack[] { - GT_Utility.copyAmount(aInputs[0].stackSize - tComparedInput.stackSize, aInputs[0]) - }, + new ItemStack[] { GT_Utility + .copyAmount(aInputs[0].stackSize - tComparedInput.stackSize, aInputs[0]) }, tOutputItems, null, null, @@ -4807,14 +4375,15 @@ public class GT_Recipe implements Comparable<GT_Recipe> { @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)); } } @@ -4822,21 +4391,11 @@ 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, + + 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, @@ -4857,14 +4416,8 @@ public class GT_Recipe implements Comparable<GT_Recipe> { } @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]); @@ -4879,9 +4432,8 @@ public class GT_Recipe implements Comparable<GT_Recipe> { return GT_Utility.arrayContainsNonNull(tOutputItems) ? new GT_Recipe( false, - new ItemStack[] { - GT_Utility.copyAmount(aInputs[0].stackSize - tComparedInput.stackSize, aInputs[0]) - }, + new ItemStack[] { GT_Utility + .copyAmount(aInputs[0].stackSize - tComparedInput.stackSize, aInputs[0]) }, tOutputItems, null, null, @@ -4895,14 +4447,15 @@ public class GT_Recipe implements Comparable<GT_Recipe> { @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)); } } @@ -4910,21 +4463,11 @@ 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, + + 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, @@ -4945,14 +4488,8 @@ public class GT_Recipe implements Comparable<GT_Recipe> { } @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]); @@ -4967,9 +4504,8 @@ public class GT_Recipe implements Comparable<GT_Recipe> { return GT_Utility.arrayContainsNonNull(tOutputItems) ? new GT_Recipe( false, - new ItemStack[] { - GT_Utility.copyAmount(aInputs[0].stackSize - tComparedInput.stackSize, aInputs[0]) - }, + new ItemStack[] { GT_Utility + .copyAmount(aInputs[0].stackSize - tComparedInput.stackSize, aInputs[0]) }, tOutputItems, null, null, @@ -4983,14 +4519,15 @@ public class GT_Recipe implements Comparable<GT_Recipe> { @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)); } } @@ -4998,21 +4535,11 @@ 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, + + 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, @@ -5033,20 +4560,14 @@ public class GT_Recipe implements Comparable<GT_Recipe> { } @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 + 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; + || !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(); @@ -5061,17 +4582,14 @@ public class GT_Recipe implements Comparable<GT_Recipe> { return GT_Utility.arrayContainsNonNull(tOutputItems) ? new GT_Recipe( false, - new ItemStack[] { - GT_Utility.copyAmount(aInputs[0].stackSize - tComparedInput.stackSize, aInputs[0]) - }, + 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")) - }, + new FluidStack[] { new FluidStack( + aFluids[0].getFluid(), + ((NBTTagCompound) aRecipeMetaData.getTag("return")).getInteger("amount")) }, null, 400, 16, @@ -5081,14 +4599,15 @@ public class GT_Recipe implements Comparable<GT_Recipe> { @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 @@ -5106,21 +4625,11 @@ 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, + + 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, @@ -5141,14 +4650,8 @@ public class GT_Recipe implements Comparable<GT_Recipe> { } @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); @@ -5156,12 +4659,11 @@ public class GT_Recipe implements Comparable<GT_Recipe> { try { List<ItemStack> tRecipeOutputs = mods.railcraft.api.crafting.RailcraftCraftingManager.rockCrusher - .getRecipe(GT_Utility.copyAmount(1, aInputs[0])) - .getRandomizedOuputs(); + .getRecipe(GT_Utility.copyAmount(1, aInputs[0])).getRandomizedOuputs(); if (tRecipeOutputs != null) { aRecipe = new GT_Recipe( false, - new ItemStack[] {GT_Utility.copyAmount(1, aInputs[0])}, + new ItemStack[] { GT_Utility.copyAmount(1, aInputs[0]) }, tRecipeOutputs.toArray(new ItemStack[0]), null, null, @@ -5192,9 +4694,8 @@ public class GT_Recipe implements Comparable<GT_Recipe> { return GT_Utility.arrayContainsNonNull(tOutputItems) ? new GT_Recipe( false, - new ItemStack[] { - GT_Utility.copyAmount(aInputs[0].stackSize - tComparedInput.stackSize, aInputs[0]) - }, + new ItemStack[] { GT_Utility + .copyAmount(aInputs[0].stackSize - tComparedInput.stackSize, aInputs[0]) }, tOutputItems, null, null, @@ -5208,8 +4709,8 @@ public class GT_Recipe implements Comparable<GT_Recipe> { @Override public boolean containsInput(ItemStack aStack) { - return super.containsInput(aStack) - || GT_Utility.arrayContainsNonNull(GT_ModHandler.getMachineOutput( + return super.containsInput(aStack) || GT_Utility.arrayContainsNonNull( + GT_ModHandler.getMachineOutput( GT_Utility.copyAmount(64, aStack), ic2.api.recipe.Recipes.macerator.getRecipes(), false, @@ -5225,21 +4726,10 @@ 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, + 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) { super( aRecipeList, @@ -5260,63 +4750,26 @@ public class GT_Recipe implements Comparable<GT_Recipe> { } @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 - - 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; - } - else { - aInputs2.remove(IS); - } - } - if(rRecipe!= null) - break; - } - } - if(rRecipe!= null) - break; - }else - aInputs2.add(aInput); - if(rRecipe!= null) - break; - } - } - */ - if (aInputs == null - || aInputs.length <= 0 + * Doesnt work, keep it as a reminder tho 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; } else { aInputs2.remove(IS); } } if(rRecipe!= null) + * 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; + || !GregTech_API.sPostloadFinished) + return rRecipe; for (ItemStack aInput : aInputs) { if (ItemList.Paper_Printed_Pages.isStackEqual(aInput, false, true)) { @@ -5333,21 +4786,11 @@ public class GT_Recipe implements Comparable<GT_Recipe> { * 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, + + 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, @@ -5368,14 +4811,8 @@ public class GT_Recipe implements Comparable<GT_Recipe> { } @Override - public GT_Recipe findRecipe( - IHasWorldObjectAndCoords aTileEntity, - GT_Recipe aRecipe, - boolean aNotUnificated, - boolean aDontCheckStackSizes, - long aVoltage, - FluidStack[] aFluids, - ItemStack aSpecialSlot, + 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, @@ -5386,11 +4823,11 @@ public class GT_Recipe implements Comparable<GT_Recipe> { aFluids, aSpecialSlot, aInputs); - if (aInputs == null - || aInputs.length < 2 + if (aInputs == null || aInputs.length < 2 || aInputs[0] == null || aInputs[1] == null - || !GregTech_API.sPostloadFinished) return rRecipe; + || !GregTech_API.sPostloadFinished) + return rRecipe; if (rRecipe == null) return findRenamingRecipe(aInputs); for (ItemStack aMold : aInputs) { if (ItemList.Shape_Mold_Credit.isStackEqual(aMold, false, true)) { @@ -5432,8 +4869,8 @@ public class GT_Recipe implements Comparable<GT_Recipe> { 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}, + new ItemStack[] { ItemList.Shape_Mold_Name.get(0), GT_Utility.copyAmount(1, input) }, + new ItemStack[] { output }, null, null, null, @@ -5450,21 +4887,11 @@ 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, + + 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, @@ -5485,30 +4912,29 @@ public class GT_Recipe implements Comparable<GT_Recipe> { } @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 + 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; + || !GregTech_API.sPostloadFinished) + return rRecipe; Dyes aDye = null; - for (Dyes tDye : Dyes.VALUES) - if (tDye.isFluidDye(aFluids[0])) { - aDye = tDye; - break; - } + for (Dyes tDye : Dyes.VALUES) if (tDye.isFluidDye(aFluids[0])) { + aDye = tDye; + break; + } if (aDye == null) return rRecipe; @@ -5524,50 +4950,48 @@ public class GT_Recipe implements Comparable<GT_Recipe> { 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); + 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)); - 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); + 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); } 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; @@ -5591,8 +5015,11 @@ 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; } } @@ -5617,11 +5044,11 @@ 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( + 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"}, + 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() { @@ -5641,8 +5068,17 @@ public class GT_Recipe implements Comparable<GT_Recipe> { E, true, true); - GT_Recipe explanatoryRecipe = - new GT_Recipe(true, new ItemStack[] {}, new ItemStack[] {}, null, null, null, null, 1, 1, 1); + 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", @@ -5690,7 +5126,7 @@ public class GT_Recipe implements Comparable<GT_Recipe> { return addRecipe( new GT_Recipe( true, - new ItemStack[] {fuelItemStack}, + new ItemStack[] { fuelItemStack }, new ItemStack[] {}, null, null, @@ -5758,6 +5194,7 @@ public class GT_Recipe implements Comparable<GT_Recipe> { } public static class GT_Recipe_Map_IC2NuclearFake extends GT_Recipe_Map { + public GT_Recipe_Map_IC2NuclearFake() { super( new HashSet<>(10), @@ -5783,21 +5220,17 @@ public class GT_Recipe implements Comparable<GT_Recipe> { /** * Add a breeder cell. - * @param input raw stack. should be undamaged. - * @param output breed output + * + * @param input raw stack. should be undamaged. + * @param output breed output * @param heatMultiplier bonus progress per neutron pulse per heat step - * @param heatStep divisor for hull heat - * @param reflector true if also acts as a neutron reflector, false otherwise. + * @param heatStep divisor for hull heat + * @param reflector true if also acts as a neutron reflector, false otherwise. * @param requiredPulses progress required to complete breeding * @return added fake recipe */ - public GT_Recipe addBreederCell( - ItemStack input, - ItemStack output, - boolean reflector, - int heatStep, - int heatMultiplier, - int requiredPulses) { + public GT_Recipe addBreederCell(ItemStack input, ItemStack output, boolean reflector, int heatStep, + int heatMultiplier, int requiredPulses) { return addFakeRecipe( input, output, @@ -5809,13 +5242,22 @@ public class GT_Recipe implements Comparable<GT_Recipe> { public GT_Recipe addFakeRecipe(ItemStack input, ItemStack output, String... neiDesc) { GT_Recipe r = new GT_Recipe( - new ItemStack[] {input}, new ItemStack[] {output}, null, new int[] {10000}, null, null, 0, 0, 0); + new ItemStack[] { input }, + new ItemStack[] { output }, + null, + new int[] { 10000 }, + null, + null, + 0, + 0, + 0); r.setNeiDesc(neiDesc); return addRecipe(r, true, true, false); } } public static class GT_Recipe_Map_LargeChemicalReactor extends GT_Recipe_Map_LargeNEI { + private static final int TOTAL_INPUT_COUNT = 6; private static final int OUTPUT_COUNT = 6; @@ -5839,16 +5281,8 @@ 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, + 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<>(); @@ -5872,13 +5306,11 @@ public class GT_Recipe implements Comparable<GT_Recipe> { adjustedFluidInputs.add(inputFluidContent); } else { ItemData itemData = GT_OreDictUnificator.getItemData(input); - if (itemData != null - && itemData.hasValidPrefixMaterialData() + if (itemData != null && itemData.hasValidPrefixMaterialData() && itemData.mMaterial.mMaterial == Materials.Empty) { continue; } else { - if (itemData != null - && itemData.hasValidPrefixMaterialData() + if (itemData != null && itemData.hasValidPrefixMaterialData() && itemData.mPrefix == OrePrefixes.cell) { ItemStack dustStack = itemData.mMaterial.mMaterial.getDust(input.stackSize); if (dustStack != null) { @@ -5916,8 +5348,7 @@ public class GT_Recipe implements Comparable<GT_Recipe> { adjustedFluidOutputs.add(outputFluidContent); } else { ItemData itemData = GT_OreDictUnificator.getItemData(output); - if (!(itemData != null - && itemData.hasValidPrefixMaterialData() + if (!(itemData != null && itemData.hasValidPrefixMaterialData() && itemData.mMaterial.mMaterial == Materials.Empty)) { adjustedOutputs.add(output); } @@ -5994,6 +5425,7 @@ 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() { @@ -6033,18 +5465,9 @@ public class GT_Recipe implements Comparable<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) { + 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, @@ -6077,21 +5500,10 @@ public class GT_Recipe implements Comparable<GT_Recipe> { 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, + 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, @@ -6112,23 +5524,13 @@ public class GT_Recipe implements Comparable<GT_Recipe> { } @Override - public GT_Recipe addFakeRecipe( - boolean aCheckForCollisions, - ItemStack[] aInputs, - ItemStack[] aOutputs, - Object aSpecial, - FluidStack[] aFluidInputs, - FluidStack[] aFluidOutputs, - int aDuration, - int aEUt, + 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 -> { + 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)); }); @@ -6150,21 +5552,10 @@ 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, + 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, @@ -6185,13 +5576,8 @@ public class GT_Recipe implements Comparable<GT_Recipe> { } @Override - public GT_Recipe addRecipe( - int[] aOutputChances, - FluidStack[] aFluidInputs, - FluidStack[] aFluidOutputs, - int aDuration, - int aEUt, - int aSpecialValue) { + public GT_Recipe addRecipe(int[] aOutputChances, FluidStack[] aFluidInputs, FluidStack[] aFluidOutputs, + int aDuration, int aEUt, int aSpecialValue) { return addRecipe( new GT_Recipe( false, @@ -6222,21 +5608,10 @@ public class GT_Recipe implements Comparable<GT_Recipe> { public static class GT_Recipe_Map_AssemblyLineFake extends GT_Recipe_Map { - public GT_Recipe_Map_AssemblyLineFake( - 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, + public GT_Recipe_Map_AssemblyLineFake(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, @@ -6278,32 +5653,27 @@ public class GT_Recipe implements Comparable<GT_Recipe> { } @Override - public void addProgressBarUI( - ModularWindow.Builder builder, Supplier<Float> progressSupplier, Pos2d windowOffset) { + public void addProgressBarUI(ModularWindow.Builder builder, Supplier<Float> progressSupplier, + Pos2d windowOffset) { int bar1Width = 17; int bar2Width = 18; - builder.widget(new ProgressBar() - .setTexture(GT_UITextures.PROGRESSBAR_ASSEMBLY_LINE_1, 17) - .setDirection(ProgressBar.Direction.RIGHT) - .setProgress(() -> progressSupplier.get() * ((float) (bar1Width + bar2Width) / bar1Width)) - .setSynced(false, false) - .setPos(new Pos2d(88, 8).add(windowOffset)) - .setSize(bar1Width, 72)); - builder.widget(new ProgressBar() - .setTexture(GT_UITextures.PROGRESSBAR_ASSEMBLY_LINE_2, 18) - .setDirection(ProgressBar.Direction.RIGHT) - .setProgress(() -> (progressSupplier.get() - ((float) bar1Width / (bar1Width + bar2Width))) - * ((float) (bar1Width + bar2Width) / bar2Width)) - .setSynced(false, false) - .setPos(new Pos2d(124, 8).add(windowOffset)) - .setSize(bar2Width, 72)); - builder.widget(new ProgressBar() - .setTexture(GT_UITextures.PROGRESSBAR_ASSEMBLY_LINE_3, 18) - .setDirection(ProgressBar.Direction.UP) - .setProgress(progressSupplier) - .setSynced(false, false) - .setPos(new Pos2d(146, 26).add(windowOffset)) - .setSize(10, 18)); + builder.widget( + new ProgressBar().setTexture(GT_UITextures.PROGRESSBAR_ASSEMBLY_LINE_1, 17) + .setDirection(ProgressBar.Direction.RIGHT) + .setProgress(() -> progressSupplier.get() * ((float) (bar1Width + bar2Width) / bar1Width)) + .setSynced(false, false).setPos(new Pos2d(88, 8).add(windowOffset)).setSize(bar1Width, 72)); + builder.widget( + new ProgressBar().setTexture(GT_UITextures.PROGRESSBAR_ASSEMBLY_LINE_2, 18) + .setDirection(ProgressBar.Direction.RIGHT) + .setProgress( + () -> (progressSupplier.get() - ((float) bar1Width / (bar1Width + bar2Width))) + * ((float) (bar1Width + bar2Width) / bar2Width)) + .setSynced(false, false).setPos(new Pos2d(124, 8).add(windowOffset)) + .setSize(bar2Width, 72)); + builder.widget( + new ProgressBar().setTexture(GT_UITextures.PROGRESSBAR_ASSEMBLY_LINE_3, 18) + .setDirection(ProgressBar.Direction.UP).setProgress(progressSupplier) + .setSynced(false, false).setPos(new Pos2d(146, 26).add(windowOffset)).setSize(10, 18)); } } } diff --git a/src/main/java/gregtech/api/util/GT_RecipeRegistrator.java b/src/main/java/gregtech/api/util/GT_RecipeRegistrator.java index a353eff44d..81d11ad7f2 100644 --- a/src/main/java/gregtech/api/util/GT_RecipeRegistrator.java +++ b/src/main/java/gregtech/api/util/GT_RecipeRegistrator.java @@ -5,18 +5,9 @@ import static gregtech.api.enums.Materials.*; import static gregtech.api.enums.Materials.Void; import static gregtech.api.util.GT_Utility.calculateRecipeEU; -import com.google.common.collect.HashMultimap; -import com.google.common.collect.ImmutableList; -import com.google.common.collect.SetMultimap; -import cpw.mods.fml.relauncher.ReflectionHelper; -import gregtech.GT_Mod; -import gregtech.api.GregTech_API; -import gregtech.api.enums.*; -import gregtech.api.objects.ItemData; -import gregtech.api.objects.MaterialStack; -import ic2.api.reactor.IReactorComponent; import java.lang.reflect.Field; import java.util.*; + import net.minecraft.init.Blocks; import net.minecraft.init.Items; import net.minecraft.item.ItemBlock; @@ -28,112 +19,110 @@ import net.minecraft.item.crafting.ShapelessRecipes; import net.minecraftforge.oredict.ShapedOreRecipe; import net.minecraftforge.oredict.ShapelessOreRecipe; +import com.google.common.collect.HashMultimap; +import com.google.common.collect.ImmutableList; +import com.google.common.collect.SetMultimap; + +import cpw.mods.fml.relauncher.ReflectionHelper; +import gregtech.GT_Mod; +import gregtech.api.GregTech_API; +import gregtech.api.enums.*; +import gregtech.api.objects.ItemData; +import gregtech.api.objects.MaterialStack; +import ic2.api.reactor.IReactorComponent; + /** * Class for Automatic Recipe registering. */ public class GT_RecipeRegistrator { + /** - * List of Materials, which are used in the Creation of Sticks. All Rod Materials are automatically added to this List. + * 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) - }; + 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) }; public static final Field SHAPED_ORE_RECIPE_WIDTH = ReflectionHelper.findField(ShapedOreRecipe.class, "width"); public static final Field SHAPED_ORE_RECIPE_HEIGHT = ReflectionHelper.findField(ShapedOreRecipe.class, "height"); private static volatile Map<RecipeShape, List<IRecipe>> indexedRecipeListCache; - 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; static { @@ -141,8 +130,8 @@ public class GT_RecipeRegistrator { GregTech_API.sAfterGTPostload.add(() -> indexedRecipeListCache = null); } - 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(); @@ -154,17 +143,20 @@ public class GT_RecipeRegistrator { } public static void registerMaterialRecycling(ItemStack aStack, ItemData aData) { - if (GT_Utility.isStackInvalid(aStack) - || GT_Utility.areStacksEqual(new ItemStack(Items.blaze_rod), aStack) + if (GT_Utility.isStackInvalid(aStack) || GT_Utility.areStacksEqual(new ItemStack(Items.blaze_rod), aStack) || aData == null || !aData.hasValidMaterialData() || !aData.mMaterial.mMaterial.mAutoGenerateRecycleRecipes || aData.mMaterial.mAmount <= 0 || GT_Utility.getFluidForFilledItem(aStack, false) != null - || aData.mMaterial.mMaterial.mSubTags.contains(SubTag.NO_RECIPES)) return; + || aData.mMaterial.mMaterial.mSubTags.contains(SubTag.NO_RECIPES)) + return; registerReverseMacerating(GT_Utility.copyAmount(1, aStack), aData, aData.mPrefix == null); registerReverseSmelting( - GT_Utility.copyAmount(1, aStack), aData.mMaterial.mMaterial, aData.mMaterial.mAmount, true); + GT_Utility.copyAmount(1, aStack), + aData.mMaterial.mMaterial, + aData.mMaterial.mAmount, + true); registerReverseFluidSmelting( GT_Utility.copyAmount(1, aStack), aData.mMaterial.mMaterial, @@ -178,43 +170,41 @@ 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 + 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; + || (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 + if (GT_Mod.gregtechproxy.mHideRecyclingRecipes && tData != null && tData.hasValidPrefixData() - && !(tData.mPrefix == OrePrefixes.dust - || tData.mPrefix == OrePrefixes.ingot + && !(tData.mPrefix == OrePrefixes.dust || tData.mPrefix == OrePrefixes.ingot || tData.mPrefix == OrePrefixes.block | tData.mPrefix == OrePrefixes.plate)) { tHide = true; } - // boolean tHide = (aMaterial != Materials.Iron && aMaterial!= + // boolean tHide = (aMaterial != Materials.Iron && aMaterial!= // Materials.Redstone)&&(GT_Mod.gregtechproxy.mHideRecyclingRecipes); - // if(tHide && tData!=null&&tData.hasValidPrefixData()&&tData.mPrefix==OrePrefixes.ingot){ - // tHide=false; - // } + // if(tHide && tData!=null&&tData.hasValidPrefixData()&&tData.mPrefix==OrePrefixes.ingot){ + // tHide=false; + // } RA.addFluidSmelterRecipe( GT_Utility.copyAmount(1, aStack), - aByproduct == null - ? null + 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), + || !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), @@ -228,37 +218,30 @@ 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 + 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)) - || (aMaterial.getProcessingMaterialTierEU() > TierEU.IV)) return; + || (aMaterial.getProcessingMaterialTierEU() > TierEU.IV)) + return; if (aMaterial == Materials.Naquadah || aMaterial == Materials.NaquadahEnriched) return; aMaterialAmount /= aStack.stackSize; 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); - else - GT_ModHandler.addSmeltingRecipe( - GT_Utility.copyAmount(1, aStack), - GT_OreDictUnificator.getIngot(aMaterial.mSmeltInto, aMaterialAmount)); + if (aAllowAlloySmelter) 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)); } - public static void registerReverseArcSmelting( - ItemStack aStack, - Materials aMaterial, - long aMaterialAmount, - MaterialStack aByProduct01, - MaterialStack aByProduct02, - MaterialStack aByProduct03) { + public static void registerReverseArcSmelting(ItemStack aStack, Materials aMaterial, long aMaterialAmount, + MaterialStack aByProduct01, MaterialStack aByProduct02, MaterialStack aByProduct03) { registerReverseArcSmelting( aStack, new ItemData( @@ -276,10 +259,10 @@ public class GT_RecipeRegistrator { boolean tIron = false; for (MaterialStack tMaterial : aData.getAllMaterialStacks()) { - if (tMaterial.mMaterial == Materials.Iron - || tMaterial.mMaterial == Materials.Copper + if (tMaterial.mMaterial == Materials.Iron || tMaterial.mMaterial == Materials.Copper || tMaterial.mMaterial == Materials.WroughtIron - || tMaterial.mMaterial == Materials.AnnealedCopper) tIron = true; + || tMaterial.mMaterial == Materials.AnnealedCopper) + tIron = true; if (tMaterial.mMaterial.contains(SubTag.UNBURNABLE)) { tMaterial.mMaterial = tMaterial.mMaterial.mSmeltInto.mArcSmeltInto; @@ -311,10 +294,9 @@ public class GT_RecipeRegistrator { } 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); @@ -327,26 +309,18 @@ public class GT_RecipeRegistrator { 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)) - }, + 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) { + public static void registerReverseMacerating(ItemStack aStack, Materials aMaterial, long aMaterialAmount, + MaterialStack aByProduct01, MaterialStack aByProduct02, MaterialStack aByProduct03, boolean aAllowHammer) { registerReverseMacerating( aStack, new ItemData( @@ -376,59 +350,43 @@ public class GT_RecipeRegistrator { 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)) - }, + 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; - } + 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; + } } /** * 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, - }; + private static final Materials[] VANILLA_MATS = { Cobalt, Gold, Iron, Lead, FierySteel, Void, Bronze, Diamond, Ruby, + Sapphire, Steel, IronWood, Steeleaf, Knightmetal, Thaumium, DarkSteel, }; /** - * You give this Function a Material and it will scan almost everything for adding recycling Recipes and replacing Ingots, Gems etc. + * You give this Function a Material and it will scan almost everything for adding recycling Recipes and replacing + * Ingots, Gems etc. * * @param aMats Materials, for example an Ingot or a Gem. * @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); @@ -452,13 +410,14 @@ public class GT_RecipeRegistrator { GT_OreDictUnificator.addItemData( tCrafted, new ItemData( - aItemData.mMaterial.mMaterial, aItemData.mMaterial.mAmount * tRecipe.amount1)); + 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: + // GT_Log.out.println("registerUsagesForMaterials used aPlate: "+aPlate); + // GT_Log.out.println("registerUsagesForMaterials used aPlate: // "+aMat.getUnlocalizedName()); - // GT_Log.out.println("registerUsagesForMaterials used aPlate: + // GT_Log.out.println("registerUsagesForMaterials used aPlate: // "+aMat.getDisplayName()); // // GT_Log.out.println("###################################################################################"); @@ -484,8 +443,7 @@ public class GT_RecipeRegistrator { private static Map<RecipeShape, List<IRecipe>> createIndexedRecipeListCache() { Map<RecipeShape, List<IRecipe>> result = new IdentityHashMap<>(); @SuppressWarnings("unchecked") - ArrayList<IRecipe> allRecipeList = - (ArrayList<IRecipe>) CraftingManager.getInstance().getRecipeList(); + ArrayList<IRecipe> allRecipeList = (ArrayList<IRecipe>) CraftingManager.getInstance().getRecipeList(); // filter using the empty slots in the shape. // if the empty slots doesn't match, the recipe will definitely fail SetMultimap<List<Integer>, RecipeShape> filter = HashMultimap.create(); @@ -502,8 +460,7 @@ public class GT_RecipeRegistrator { } buffer.clear(); ItemStack tStack = tRecipe.getRecipeOutput(); - if (GT_Utility.isStackValid(tStack) - && tStack.getMaxStackSize() == 1 + if (GT_Utility.isStackValid(tStack) && tStack.getMaxStackSize() == 1 && tStack.getMaxDamage() > 0 && !(tStack.getItem() instanceof ItemBlock) && !(tStack.getItem() instanceof IReactorComponent) @@ -543,8 +500,8 @@ public class GT_RecipeRegistrator { return result; } - private static boolean checkRecipeShape( - List<Integer> emptySlotIndexesBuffer, Object[] input, int tRecipeWidth, int tRecipeHeight) { + private static boolean checkRecipeShape(List<Integer> emptySlotIndexesBuffer, Object[] input, int tRecipeWidth, + int tRecipeHeight) { for (int y = 0; y < 3; y++) { for (int x = 0; x < 3; x++) { if (x >= tRecipeWidth || y >= tRecipeHeight) { @@ -557,8 +514,7 @@ public class GT_RecipeRegistrator { continue; } if (tObject instanceof ItemStack - && (((ItemStack) tObject).getItem() == null - || ((ItemStack) tObject).getMaxStackSize() < 2 + && (((ItemStack) tObject).getItem() == null || ((ItemStack) tObject).getMaxStackSize() < 2 || ((ItemStack) tObject).getMaxDamage() > 0 || ((ItemStack) tObject).getItem() instanceof ItemBlock)) { return false; @@ -583,8 +539,8 @@ public class GT_RecipeRegistrator { for (int i = 0; i < sShapes.length; i++) { RecipeShape tRecipe = sShapes[i]; - for (ItemStack tCrafted : - GT_ModHandler.getRecipeOutputs(getRecipeList(tRecipe), true, tRecipe.shape)) { + for (ItemStack tCrafted : GT_ModHandler + .getRecipeOutputs(getRecipeList(tRecipe), true, tRecipe.shape)) { if (aItemData != null && aItemData.hasValidPrefixMaterialData()) GT_OreDictUnificator.addItemData( tCrafted, @@ -592,7 +548,8 @@ public class GT_RecipeRegistrator { aItemData.mMaterial.mMaterial, aItemData.mMaterial.mAmount * tRecipe.amount1, new MaterialStack( - tMaterial, OrePrefixes.stick.mMaterialAmount * tRecipe.amount2))); + tMaterial, + OrePrefixes.stick.mMaterialAmount * tRecipe.amount2))); if (aRecipeReplacing && aPlate != null && sShapesA[i] != null && sShapesA[i].length > 1) { assert aItemData != null; @@ -604,42 +561,28 @@ public class GT_RecipeRegistrator { 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 - }); + 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 - }); + 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 - }); + 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; } } @@ -653,27 +596,34 @@ public class GT_RecipeRegistrator { /** * Registers wiremill recipes for given material using integrated circuits. - * @param aMaterial material to register + * + * @param aMaterial material to register * @param baseDuration base duration ticks for ingot -> 1x wire recipe - * @param aEUt EU/t for recipe - * If you provide a proper EU tier for recipe processing then aEUt will be overriden with it. + * @param aEUt EU/t for recipe If you provide a proper EU tier for recipe processing then aEUt will be + * overriden with it. */ public static void registerWiremillRecipes(Materials aMaterial, int baseDuration, int aEUt) { registerWiremillRecipes( - aMaterial, baseDuration, calculateRecipeEU(aMaterial, aEUt), OrePrefixes.ingot, OrePrefixes.stick, 2); + aMaterial, + baseDuration, + calculateRecipeEU(aMaterial, aEUt), + OrePrefixes.ingot, + OrePrefixes.stick, + 2); } /** * Registers wiremill recipes for given material using integrated circuits. - * @param aMaterial material to register + * + * @param aMaterial material to register * @param baseDuration base duration ticks for ingot -> 1x wire recipe - * @param aEUt EU/t for recipe - * @param prefix1 prefix corresponds to ingot - * @param prefix2 prefix corresponds to stick - * @param multiplier amount of wires created from 1 ingot + * @param aEUt EU/t for recipe + * @param prefix1 prefix corresponds to ingot + * @param prefix2 prefix corresponds to stick + * @param multiplier amount of wires created from 1 ingot */ - public static void registerWiremillRecipes( - Materials aMaterial, int baseDuration, int aEUt, OrePrefixes prefix1, OrePrefixes prefix2, int multiplier) { + public static void registerWiremillRecipes(Materials aMaterial, int baseDuration, int aEUt, OrePrefixes prefix1, + OrePrefixes prefix2, int multiplier) { GT_Values.RA.addWiremillRecipe( GT_OreDictUnificator.get(prefix1, aMaterial, 1L), GT_Utility.getIntegratedCircuit(1), @@ -789,6 +739,7 @@ public class GT_RecipeRegistrator { } private static class RecipeShape { + private final ItemStack[] shape; private int amount1; private int amount2; diff --git a/src/main/java/gregtech/api/util/GT_RenderingWorld.java b/src/main/java/gregtech/api/util/GT_RenderingWorld.java index 173631e99c..bab2a30505 100644 --- a/src/main/java/gregtech/api/util/GT_RenderingWorld.java +++ b/src/main/java/gregtech/api/util/GT_RenderingWorld.java @@ -1,13 +1,10 @@ package gregtech.api.util; -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; @@ -20,10 +17,16 @@ import net.minecraftforge.common.util.ForgeDirection; import net.minecraftforge.event.world.ChunkEvent; import net.minecraftforge.event.world.WorldEvent; +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; + /** * 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 @@ -56,8 +59,7 @@ public class GT_RenderingWorld implements IBlockAccess { public void register(int x, int y, int z, Block block, int meta) { ChunkPosition key = new ChunkPosition(x, y, z); infos.put(key, new BlockInfo(block, meta)); - index.computeIfAbsent(new ChunkCoordIntPair(x >> 4, z >> 4), p -> new HashSet<>()) - .add(key); + index.computeIfAbsent(new ChunkCoordIntPair(x >> 4, z >> 4), p -> new HashSet<>()).add(key); } public void unregister(int x, int y, int z, Block block, int meta) { @@ -123,6 +125,7 @@ public class GT_RenderingWorld implements IBlockAccess { } public class FMLEventHandler { + public FMLEventHandler() { FMLCommonHandler.instance().bus().register(this); } @@ -134,6 +137,7 @@ public class GT_RenderingWorld implements IBlockAccess { } public class ForgeEventHandler { + private ForgeEventHandler() { MinecraftForge.EVENT_BUS.register(this); } @@ -154,6 +158,7 @@ public class GT_RenderingWorld implements IBlockAccess { } private static class BlockInfo { + private final Block block; private final int meta; 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 ae8d804ee9..62096c1ebd 100644 --- a/src/main/java/gregtech/api/util/GT_Shaped_Recipe.java +++ b/src/main/java/gregtech/api/util/GT_Shaped_Recipe.java @@ -1,7 +1,5 @@ package gregtech.api.util; -import gregtech.api.interfaces.internal.IGT_CraftingRecipe; -import gregtech.api.objects.ReverseShapedRecipe; import net.minecraft.enchantment.Enchantment; import net.minecraft.enchantment.EnchantmentHelper; import net.minecraft.inventory.InventoryCrafting; @@ -10,19 +8,17 @@ import net.minecraft.nbt.NBTTagCompound; import net.minecraft.world.World; import net.minecraftforge.oredict.ShapedOreRecipe; +import gregtech.api.interfaces.internal.IGT_CraftingRecipe; +import gregtech.api.objects.ReverseShapedRecipe; + public class GT_Shaped_Recipe extends ShapedOreRecipe implements IGT_CraftingRecipe { + public final boolean mRemovableByGT, mKeepingNBT; 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; @@ -42,8 +38,8 @@ public class GT_Shaped_Recipe extends ShapedOreRecipe implements IGT_CraftingRec if (tStack != null) { if ((tStack.hasTagCompound() != aGrid.getStackInSlot(i).hasTagCompound()) || (tStack.hasTagCompound() - && !tStack.getTagCompound() - .equals(aGrid.getStackInSlot(i).getTagCompound()))) return false; + && !tStack.getTagCompound().equals(aGrid.getStackInSlot(i).getTagCompound()))) + return false; } tStack = aGrid.getStackInSlot(i); } @@ -60,33 +56,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); + for (int i = 0; i < aGrid.getSizeInventory(); i++) 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]); + for (int i = 0; i < mEnchantmentsAdded.length; 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 09d8730df5..02c479cc94 100644 --- a/src/main/java/gregtech/api/util/GT_Shapeless_Recipe.java +++ b/src/main/java/gregtech/api/util/GT_Shapeless_Recipe.java @@ -1,7 +1,5 @@ package gregtech.api.util; -import gregtech.api.interfaces.internal.IGT_CraftingRecipe; -import gregtech.api.objects.ReverseShapelessRecipe; import net.minecraft.enchantment.Enchantment; import net.minecraft.enchantment.EnchantmentHelper; import net.minecraft.inventory.InventoryCrafting; @@ -10,19 +8,17 @@ import net.minecraft.nbt.NBTTagCompound; import net.minecraft.world.World; import net.minecraftforge.oredict.ShapelessOreRecipe; +import gregtech.api.interfaces.internal.IGT_CraftingRecipe; +import gregtech.api.objects.ReverseShapelessRecipe; + public class GT_Shapeless_Recipe extends ShapelessOreRecipe implements IGT_CraftingRecipe { - public final boolean /*mDismantleable,*/ mRemovableByGT, mKeepingNBT; + + public final boolean /* mDismantleable, */ mRemovableByGT, mKeepingNBT; 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; @@ -42,8 +38,8 @@ public class GT_Shapeless_Recipe extends ShapelessOreRecipe implements IGT_Craft if (tStack != null) { if ((tStack.hasTagCompound() != aGrid.getStackInSlot(i).hasTagCompound()) || (tStack.hasTagCompound() - && !tStack.getTagCompound() - .equals(aGrid.getStackInSlot(i).getTagCompound()))) return false; + && !tStack.getTagCompound().equals(aGrid.getStackInSlot(i).getTagCompound()))) + return false; } tStack = aGrid.getStackInSlot(i); } @@ -60,51 +56,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); + for (int i = 0; i < aGrid.getSizeInventory(); i++) 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 && + // 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, + // 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); - // } + // 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]); + for (int i = 0; i < mEnchantmentsAdded.length; 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 5ff631fad6..fae02badf2 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 @@ -1,17 +1,20 @@ 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 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; +import com.google.common.collect.ImmutableMap; +import com.google.common.collect.Maps; +import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_MultiBlockBase; + /** Used by machines that are locked to a single recipe, for fast computation. */ public class GT_Single_Recipe_Check { + protected final GT_MetaTileEntity_MultiBlockBase multiBlockBase; protected final GT_Recipe recipe; protected final ImmutableMap<GT_Utility.ItemId, Integer> itemCost; @@ -20,20 +23,15 @@ public class GT_Single_Recipe_Check { protected final int totalItemCost; protected final int totalFluidCost; - protected GT_Single_Recipe_Check( - GT_MetaTileEntity_MultiBlockBase multiBlockBase, - GT_Recipe recipe, - ImmutableMap<GT_Utility.ItemId, Integer> itemCost, - ImmutableMap<Fluid, Integer> fluidCost) { + protected GT_Single_Recipe_Check(GT_MetaTileEntity_MultiBlockBase multiBlockBase, GT_Recipe recipe, + ImmutableMap<GT_Utility.ItemId, Integer> itemCost, ImmutableMap<Fluid, Integer> fluidCost) { this.multiBlockBase = multiBlockBase; this.recipe = recipe; 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() { @@ -41,10 +39,10 @@ public class GT_Single_Recipe_Check { } /** - * Use this method if recipes cannot require more than a single stack of any item or fluid. - * In particular, {@link GT_MetaTileEntity_MultiBlockBase#getCompactedInputs()} and - * {@link GT_MetaTileEntity_MultiBlockBase#getCompactedFluids()} both enforce this single-stack - * restriction, so any multi-block that calls those can use this method. + * Use this method if recipes cannot require more than a single stack of any item or fluid. In particular, + * {@link GT_MetaTileEntity_MultiBlockBase#getCompactedInputs()} and + * {@link GT_MetaTileEntity_MultiBlockBase#getCompactedFluids()} both enforce this single-stack restriction, so any + * multi-block that calls those can use this method. */ public boolean checkRecipeInputsSingleStack(boolean consumeInputs) { Map<GT_Utility.ItemId, ItemStack> itemMap = null; @@ -98,8 +96,8 @@ public class GT_Single_Recipe_Check { } /** - * Use this method if recipes can require more than a single stack of any item or fluid. - * It is less efficient, though. + * Use this method if recipes can require more than a single stack of any item or fluid. It is less efficient, + * though. */ public boolean checkRecipeInputs(boolean consumeInputs) { List<ItemStack> items = null; @@ -194,6 +192,7 @@ public class GT_Single_Recipe_Check { } public static final class Builder { + private final GT_MetaTileEntity_MultiBlockBase multiBlockBase; // In order to compute which items and fluids are consumed by the recipe, we compare the @@ -246,7 +245,10 @@ public class GT_Single_Recipe_Check { } return new GT_Single_Recipe_Check( - multiBlockBase, recipe, itemCostBuilder.build(), fluidCostBuilder.build()); + 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 e15ae792a1..c102d63f48 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 @@ -1,32 +1,30 @@ package gregtech.api.util; -import com.google.common.collect.ImmutableMap; -import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_MultiBlockBase; 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; +import com.google.common.collect.ImmutableMap; +import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_MultiBlockBase; + /** 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 { + protected final int recipeAmperage; /** - * The machine type that the locked recipe is for. - * We will not allow running with other machines. + * The machine type that the locked recipe is for. We will not allow running with other machines. */ protected final ItemStack machineStack; - protected GT_Single_Recipe_Check_Processing_Array( - GT_MetaTileEntity_MultiBlockBase multiBlockBase, - GT_Recipe recipe, - ImmutableMap<GT_Utility.ItemId, Integer> itemCost, - ImmutableMap<Fluid, Integer> fluidCost, - int recipeAmperage, - ItemStack machineStack) { + protected GT_Single_Recipe_Check_Processing_Array(GT_MetaTileEntity_MultiBlockBase multiBlockBase, GT_Recipe recipe, + ImmutableMap<GT_Utility.ItemId, Integer> itemCost, ImmutableMap<Fluid, Integer> fluidCost, + int recipeAmperage, ItemStack machineStack) { super(multiBlockBase, recipe, itemCost, fluidCost); this.recipeAmperage = recipeAmperage; @@ -138,6 +136,7 @@ public class GT_Single_Recipe_Check_Processing_Array extends GT_Single_Recipe_Ch } public static final class Builder { + private final GT_MetaTileEntity_MultiBlockBase multiBlockBase; // In order to compute which items and fluids are consumed by the recipe, we compare the diff --git a/src/main/java/gregtech/api/util/GT_SpawnEventHandler.java b/src/main/java/gregtech/api/util/GT_SpawnEventHandler.java index 0661ea56b7..7b03dd8884 100644 --- a/src/main/java/gregtech/api/util/GT_SpawnEventHandler.java +++ b/src/main/java/gregtech/api/util/GT_SpawnEventHandler.java @@ -1,18 +1,20 @@ package gregtech.api.util; -import cpw.mods.fml.common.eventhandler.Event; -import cpw.mods.fml.common.eventhandler.SubscribeEvent; -import gregtech.api.enums.GT_Values; -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 cpw.mods.fml.common.eventhandler.Event; +import cpw.mods.fml.common.eventhandler.SubscribeEvent; +import gregtech.api.enums.GT_Values; +import gregtech.api.metatileentity.BaseMetaTileEntity; +import gregtech.common.tileentities.machines.basic.GT_MetaTileEntity_MonsterRepellent; + public class GT_SpawnEventHandler { public static volatile List<int[]> mobReps = new CopyOnWriteArrayList<>(); @@ -62,17 +64,15 @@ public class GT_SpawnEventHandler { if (check > maxRangeCheck) continue; final TileEntity tTile = event.entity.worldObj.getTileEntity(rep[0], rep[1], rep[2]); - if (tTile instanceof BaseMetaTileEntity - && ((BaseMetaTileEntity) tTile).getMetaTileEntity() - instanceof GT_MetaTileEntity_MonsterRepellent) { - final int r = ((GT_MetaTileEntity_MonsterRepellent) - ((BaseMetaTileEntity) tTile).getMetaTileEntity()) - .mRange; + if (tTile instanceof BaseMetaTileEntity && ((BaseMetaTileEntity) tTile) + .getMetaTileEntity() instanceof GT_MetaTileEntity_MonsterRepellent) { + final int r = ((GT_MetaTileEntity_MonsterRepellent) ((BaseMetaTileEntity) tTile) + .getMetaTileEntity()).mRange; if (check <= Math.pow(r, 2)) { if (event.entityLiving instanceof EntitySlime) ((EntitySlime) event.entityLiving).setCustomNameTag("DoNotSpawnSlimes"); event.setResult(Event.Result.DENY); - // We're already DENYing it. No reason to keep checking + // We're already DENYing it. No reason to keep checking return; } } diff --git a/src/main/java/gregtech/api/util/GT_StructureUtility.java b/src/main/java/gregtech/api/util/GT_StructureUtility.java index 756a1c3afa..25ba192794 100644 --- a/src/main/java/gregtech/api/util/GT_StructureUtility.java +++ b/src/main/java/gregtech/api/util/GT_StructureUtility.java @@ -6,25 +6,12 @@ import static com.gtnewhorizon.structurelib.structure.IStructureElement.PlaceRes import static com.gtnewhorizon.structurelib.structure.IStructureElement.PlaceResult.SKIP; import static com.gtnewhorizon.structurelib.util.ItemStackPredicate.NBTMode.EXACT; -import com.gtnewhorizon.structurelib.StructureLibAPI; -import com.gtnewhorizon.structurelib.structure.*; -import com.gtnewhorizon.structurelib.util.ItemStackPredicate; -import gregtech.api.GregTech_API; -import gregtech.api.enums.HeatingCoilLevel; -import gregtech.api.enums.Materials; -import gregtech.api.enums.OrePrefixes; -import gregtech.api.interfaces.IHeatingCoil; -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_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; @@ -37,8 +24,26 @@ import net.minecraft.util.IChatComponent; import net.minecraft.util.IIcon; import net.minecraft.world.World; +import com.gtnewhorizon.structurelib.StructureLibAPI; +import com.gtnewhorizon.structurelib.structure.*; +import com.gtnewhorizon.structurelib.util.ItemStackPredicate; + +import gregtech.api.GregTech_API; +import gregtech.api.enums.HeatingCoilLevel; +import gregtech.api.enums.Materials; +import gregtech.api.enums.OrePrefixes; +import gregtech.api.interfaces.IHeatingCoil; +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_TieredMachineBlock; +import gregtech.common.blocks.GT_Block_Casings5; +import gregtech.common.blocks.GT_Item_Machines; + public class GT_StructureUtility { - // private static final Map<Class<?>, String> customNames = new HashMap<>(); + + // private static final Map<Class<?>, String> customNames = new HashMap<>(); private GT_StructureUtility() { throw new AssertionError("Not instantiable"); } @@ -47,8 +52,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); } @@ -87,7 +92,17 @@ public class GT_StructureUtility { return false; ItemBlock tFrameStackItem = (ItemBlock) tFrameStack.getItem(); return tFrameStackItem.placeBlockAt( - tFrameStack, null, world, x, y, z, 6, 0, 0, 0, Items.feather.getDamage(tFrameStack)); + tFrameStack, + null, + world, + x, + y, + z, + 6, + 0, + 0, + 0, + Items.feather.getDamage(tFrameStack)); } private ItemStack getFrameStack() { @@ -95,8 +110,8 @@ public class GT_StructureUtility { } @Override - public BlocksToPlace getBlocksToPlace( - T t, World world, int x, int y, int z, ItemStack trigger, AutoPlaceEnvironment env) { + public BlocksToPlace getBlocksToPlace(T t, World world, int x, int y, int z, ItemStack trigger, + AutoPlaceEnvironment env) { ItemStack tFrameStack = getFrameStack(); if (!GT_Utility.isStackValid(tFrameStack) || !(tFrameStack.getItem() instanceof ItemBlock)) return BlocksToPlace.errored; @@ -104,23 +119,21 @@ 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) { return survivalPlaceBlock( - t, world, x, y, z, trigger, AutoPlaceEnvironment.fromLegacy(s, actor, chatter)); + t, + world, + x, + y, + z, + trigger, + AutoPlaceEnvironment.fromLegacy(s, actor, chatter)); } @Override - public PlaceResult survivalPlaceBlock( - T t, World world, int x, int y, int z, ItemStack trigger, AutoPlaceEnvironment env) { + public PlaceResult survivalPlaceBlock(T t, World world, int x, int y, int z, ItemStack trigger, + AutoPlaceEnvironment env) { if (check(t, world, x, y, z)) return SKIP; ItemStack tFrameStack = getFrameStack(); if (!GT_Utility.isStackValid(tFrameStack) || !(tFrameStack.getItem() instanceof ItemBlock)) @@ -146,18 +159,20 @@ public class GT_StructureUtility { } /** - * Completely equivalent to {@link #buildHatchAdder()}, except it plays nicer with type inference when statically imported + * Completely equivalent to {@link #buildHatchAdder()}, except it plays nicer with type inference when statically + * imported */ public static <T> GT_HatchElementBuilder<T> buildHatchAdder(Class<T> typeToken) { 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(); } return new IStructureElementNoPlacement<T>() { + @Override public boolean check(T t, World world, int x, int y, int z) { TileEntity tileEntity = world.getTileEntity(x, y, z); @@ -173,18 +188,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(); } return new IStructureElement<T>() { + @Override public boolean check(T t, World world, int x, int y, int z) { TileEntity tileEntity = world.getTileEntity(x, y, z); @@ -205,66 +216,63 @@ public class GT_StructureUtility { } @Override - public BlocksToPlace getBlocksToPlace( - T t, World world, int x, int y, int z, ItemStack trigger, AutoPlaceEnvironment env) { + public BlocksToPlace getBlocksToPlace(T t, World world, int x, int y, int z, ItemStack trigger, + AutoPlaceEnvironment env) { Class<? extends IMetaTileEntity> clazz = aMetaId.apply(t); if (clazz == null) return BlocksToPlace.createEmpty(); return BlocksToPlace.create(is -> clazz.isInstance(GT_Item_Machines.getMetaTileEntity(is))); } @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) { return survivalPlaceBlock( - t, world, x, y, z, trigger, AutoPlaceEnvironment.fromLegacy(s, actor, chatter)); + t, + world, + x, + y, + z, + trigger, + AutoPlaceEnvironment.fromLegacy(s, actor, chatter)); } @Override - public PlaceResult survivalPlaceBlock( - T t, World world, int x, int y, int z, ItemStack trigger, AutoPlaceEnvironment env) { + public PlaceResult survivalPlaceBlock(T t, World world, int x, int y, int z, ItemStack trigger, + AutoPlaceEnvironment env) { if (shouldSkip != null) { TileEntity tileEntity = world.getTileEntity(x, y, z); if (tileEntity instanceof IGregTechTileEntity - && shouldSkip.test(t, (IGregTechTileEntity) tileEntity)) return SKIP; + && shouldSkip.test(t, (IGregTechTileEntity) tileEntity)) + return SKIP; } if (!StructureLibAPI.isBlockTriviallyReplaceable(world, x, y, z, env.getActor())) return REJECT; Class<? extends IMetaTileEntity> clazz = aMetaId.apply(t); if (clazz == null) return REJECT; - ItemStack taken = - env.getSource().takeOne(is -> clazz.isInstance(GT_Item_Machines.getMetaTileEntity(is)), true); + ItemStack taken = env.getSource() + .takeOne(is -> clazz.isInstance(GT_Item_Machines.getMetaTileEntity(is)), true); if (GT_Utility.isStackInvalid(taken)) { - env.getChatter() - .accept(new ChatComponentTranslation( - "GT5U.autoplace.error.no_mte.class_name", clazz.getSimpleName())); + env.getChatter().accept( + new ChatComponentTranslation( + "GT5U.autoplace.error.no_mte.class_name", + clazz.getSimpleName())); return REJECT; } - if (StructureUtility.survivalPlaceBlock( - taken, EXACT, null, true, world, x, y, z, env.getSource(), env.getActor()) - == ACCEPT) return acceptType; + if (StructureUtility + .survivalPlaceBlock(taken, EXACT, null, true, world, x, y, z, env.getSource(), env.getActor()) + == ACCEPT) + return acceptType; return 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(); } return new IStructureElement<T>() { + @Override public boolean check(T t, World world, int x, int y, int z) { TileEntity tileEntity = world.getTileEntity(x, y, z); @@ -285,8 +293,8 @@ public class GT_StructureUtility { } @Override - public BlocksToPlace getBlocksToPlace( - T t, World world, int x, int y, int z, ItemStack trigger, AutoPlaceEnvironment env) { + public BlocksToPlace getBlocksToPlace(T t, World world, int x, int y, int z, ItemStack trigger, + AutoPlaceEnvironment env) { GT_Item_Machines item = (GT_Item_Machines) Item.getItemFromBlock(GregTech_API.sBlockMachines); int meta = aMetaId.applyAsInt(t); if (meta < 0) return BlocksToPlace.createEmpty(); @@ -294,70 +302,67 @@ 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) { return survivalPlaceBlock( - t, world, x, y, z, trigger, AutoPlaceEnvironment.fromLegacy(s, actor, chatter)); + t, + world, + x, + y, + z, + trigger, + AutoPlaceEnvironment.fromLegacy(s, actor, chatter)); } @Override - public PlaceResult survivalPlaceBlock( - T t, World world, int x, int y, int z, ItemStack trigger, AutoPlaceEnvironment env) { + public PlaceResult survivalPlaceBlock(T t, World world, int x, int y, int z, ItemStack trigger, + AutoPlaceEnvironment env) { if (shouldSkip != null) { TileEntity tileEntity = world.getTileEntity(x, y, z); if (tileEntity instanceof IGregTechTileEntity - && shouldSkip.test(t, (IGregTechTileEntity) tileEntity)) return SKIP; + && shouldSkip.test(t, (IGregTechTileEntity) tileEntity)) + return SKIP; } if (!StructureLibAPI.isBlockTriviallyReplaceable(world, x, y, z, env.getActor())) return REJECT; GT_Item_Machines item = (GT_Item_Machines) Item.getItemFromBlock(GregTech_API.sBlockMachines); int meta = aMetaId.applyAsInt(t); if (meta < 0) return REJECT; - ItemStack taken = - env.getSource().takeOne(ItemStackPredicate.from(item).setMeta(meta), true); + ItemStack taken = env.getSource().takeOne(ItemStackPredicate.from(item).setMeta(meta), true); if (GT_Utility.isStackInvalid(taken)) { env.getChatter().accept(new ChatComponentTranslation("GT5U.autoplace.error.no_mte.id", meta)); return REJECT; } - return StructureUtility.survivalPlaceBlock( - taken, EXACT, null, true, world, x, y, z, env.getSource(), env.getActor()) - == ACCEPT - ? ACCEPT_STOP - : REJECT; + return StructureUtility + .survivalPlaceBlock(taken, EXACT, null, true, world, x, y, z, env.getSource(), env.getActor()) + == ACCEPT ? ACCEPT_STOP : REJECT; } }; } - public static <T> IStructureElement<T> ofHatchAdderOptional( - IGT_HatchAdder<T> aHatchAdder, int textureIndex, int dots, Block placeCasing, int 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); + 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(); } return new IStructureElement<T>() { + @Override 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)) + && aHatchAdder.apply(t, (IGregTechTileEntity) tileEntity, (short) aTextureIndex)) || (worldBlock == placeCasing && worldBlock.getDamageValue(world, x, y, z) == placeCasingMeta); } @@ -374,19 +379,11 @@ 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 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); } }; } @@ -396,31 +393,29 @@ 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); } /** * Heating coil structure element. * - * @param aHeatingCoilSetter Notify the controller of this new coil. - * Got called exactly once per coil. - * Might be called less times if structure test fails. - * If the setter returns false then it assumes the coil is rejected. + * @param aHeatingCoilSetter Notify the controller of this new coil. Got called exactly once per coil. Might be + * called less times if structure test fails. 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(); } return new IStructureElement<T>() { + @Override public boolean check(T t, World world, int x, int y, int z) { Block block = world.getBlock(x, y, z); @@ -455,29 +450,27 @@ public class GT_StructureUtility { } @Override - public BlocksToPlace getBlocksToPlace( - T t, World world, int x, int y, int z, ItemStack trigger, AutoPlaceEnvironment env) { + public BlocksToPlace getBlocksToPlace(T t, World world, int x, int y, int z, ItemStack trigger, + AutoPlaceEnvironment env) { return BlocksToPlace.create(GregTech_API.sBlockCasings5, getMetaFromHint(trigger)); } @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) { return survivalPlaceBlock( - t, world, x, y, z, trigger, AutoPlaceEnvironment.fromLegacy(s, actor, chatter)); + t, + world, + x, + y, + z, + trigger, + AutoPlaceEnvironment.fromLegacy(s, actor, chatter)); } @Override - public PlaceResult survivalPlaceBlock( - T t, World world, int x, int y, int z, ItemStack trigger, AutoPlaceEnvironment env) { + public PlaceResult survivalPlaceBlock(T t, World world, int x, int y, int z, ItemStack trigger, + AutoPlaceEnvironment env) { Block block = world.getBlock(x, y, z); boolean isCoil = block instanceof IHeatingCoil && ((IHeatingCoil) block).getCoilHeat(world.getBlockMetadata(x, y, z)) diff --git a/src/main/java/gregtech/api/util/GT_TooltipDataCache.java b/src/main/java/gregtech/api/util/GT_TooltipDataCache.java index 15f7b69248..699517d288 100644 --- a/src/main/java/gregtech/api/util/GT_TooltipDataCache.java +++ b/src/main/java/gregtech/api/util/GT_TooltipDataCache.java @@ -1,15 +1,18 @@ 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 net.minecraft.util.StatCollector; +import gregtech.GT_Mod; + public class GT_TooltipDataCache { public static class TooltipData { + public List<String> text; public List<String> shiftText; @@ -24,7 +27,7 @@ public class GT_TooltipDataCache { /** * Returns tooltip data respecting the user's configured verbosity levels, applying any formatting arguments. * - * @param key the key to lookup + * @param key the key to lookup * @param args arguments for string formatting (prefer using positional arguments) * @return The tooltip data the user asked for */ @@ -40,7 +43,7 @@ public class GT_TooltipDataCache { /** * Builds tooltip data respecting the user's configured verbosity levels, applying any formatting arguments. * - * @param key the key to lookup + * @param key the key to lookup * @param args arguments for string formatting (prefer using positional arguments) * @return The tooltip data the user asked for */ @@ -48,8 +51,8 @@ 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 @@ -57,13 +60,14 @@ public class GT_TooltipDataCache { 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()))); + 0, + getVerbosityIndex(GT_Mod.gregtechproxy.mTooltipShiftVerbosity, normalLines, lines.size()))); } /** * Gets all the lines for the given key and every other subsequent consecutive key with a .n suffix, n in {1,2,3...} * - * @param key the key to lookup + * @param key the key to lookup * @param args arguments for string formatting (prefer using positional arguments) * @return The lines for the key and all of it's subkeys */ @@ -82,8 +86,8 @@ public class GT_TooltipDataCache { * Determines how many lines from a tooltip to include from the full line list to respect a given verbosity level. * * @param tooltipVerbosity the verbosity level we're applying - * @param defaultIndex return if tooltipVerbosity is 2 - * @param maxIndex return if tooltipVerbosity is greater than 2 + * @param defaultIndex return if tooltipVerbosity is 2 + * @param maxIndex return if tooltipVerbosity is greater than 2 * @return verbosity appropriate index */ private static int getVerbosityIndex(int tooltipVerbosity, int defaultIndex, int maxIndex) { diff --git a/src/main/java/gregtech/api/util/GT_Util.java b/src/main/java/gregtech/api/util/GT_Util.java index 9de1726162..6e203a2682 100644 --- a/src/main/java/gregtech/api/util/GT_Util.java +++ b/src/main/java/gregtech/api/util/GT_Util.java @@ -1,6 +1,5 @@ package gregtech.api.util; -import gregtech.api.multitileentity.interfaces.IMultiTileEntity; import net.minecraft.block.Block; import net.minecraft.init.Blocks; import net.minecraft.nbt.NBTBase; @@ -11,7 +10,10 @@ import net.minecraft.util.Tuple; import net.minecraft.world.World; import net.minecraft.world.chunk.Chunk; +import gregtech.api.multitileentity.interfaces.IMultiTileEntity; + public class GT_Util { + // Last broken tile entity public static final ThreadLocal<TileEntity> LAST_BROKEN_TILEENTITY = new ThreadLocal<>(); @@ -23,13 +25,13 @@ public class GT_Util { 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*/()) + for (Object tKey : aNBT2.func_150296_c /* getKeySet */()) if (!rNBT.hasKey(tKey.toString())) rNBT.setTag(tKey.toString(), aNBT2.getTag(tKey.toString())); return rNBT; } /** - * Construct a NBTTagCompound from a series of key, value pairs. Inspired from GT6. + * Construct a NBTTagCompound from a series of key, value pairs. Inspired from GT6. */ public static NBTTagCompound makeNBT(Tuple... aTags) { final NBTTagCompound rNBT = new NBTTagCompound(); @@ -43,10 +45,8 @@ public class GT_Util { rNBT.setInteger(t.getFirst().toString(), (Integer) t.getSecond()); else if (t.getSecond() instanceof Long) rNBT.setLong(t.getFirst().toString(), (Long) t.getSecond()); else if (t.getSecond() instanceof Float) rNBT.setFloat(t.getFirst().toString(), (Float) t.getSecond()); - else if (t.getSecond() instanceof Double) - rNBT.setDouble(t.getFirst().toString(), (Double) t.getSecond()); - else if (t.getSecond() instanceof String) - rNBT.setString(t.getFirst().toString(), (String) t.getSecond()); + else if (t.getSecond() instanceof 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()); } @@ -70,22 +70,22 @@ public class GT_Util { } /** 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) { + 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) @@ -106,29 +106,29 @@ 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; } } aChunk.setChunkModified(); return true; } + /** 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) { @@ -152,12 +152,8 @@ 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) { diff --git a/src/main/java/gregtech/api/util/GT_Utility.java b/src/main/java/gregtech/api/util/GT_Utility.java index f1cdde1d48..2134d94253 100644 --- a/src/main/java/gregtech/api/util/GT_Utility.java +++ b/src/main/java/gregtech/api/util/GT_Utility.java @@ -12,50 +12,6 @@ import static gregtech.api.enums.GT_Values.W; import static gregtech.api.enums.Materials.FLUID_MAP; import static gregtech.common.GT_UndergroundOil.undergroundOilReadInformation; -import cofh.api.transport.IItemDuct; -import com.google.auto.value.AutoValue; -import com.google.common.base.Suppliers; -import com.google.common.collect.ImmutableSet; -import com.google.common.collect.Maps; -import com.gtnewhorizon.structurelib.alignment.IAlignment; -import com.gtnewhorizon.structurelib.alignment.IAlignmentProvider; -import com.mojang.authlib.GameProfile; -import cpw.mods.fml.common.FMLCommonHandler; -import cpw.mods.fml.common.registry.GameRegistry; -import gregtech.api.GregTech_API; -import gregtech.api.damagesources.GT_DamageSources; -import gregtech.api.damagesources.GT_DamageSources.DamageSourceHotItem; -import gregtech.api.enchants.Enchantment_Hazmat; -import gregtech.api.enchants.Enchantment_Radioactivity; -import gregtech.api.enums.*; -import gregtech.api.events.BlockScanningEvent; -import gregtech.api.interfaces.IBlockContainer; -import gregtech.api.interfaces.IDebugableBlock; -import gregtech.api.interfaces.IHasIndexedTexture; -import gregtech.api.interfaces.IProjectileItem; -import gregtech.api.interfaces.ITexture; -import gregtech.api.interfaces.tileentity.IBasicEnergyContainer; -import gregtech.api.interfaces.tileentity.ICoverable; -import gregtech.api.interfaces.tileentity.IGregTechDeviceInformation; -import gregtech.api.interfaces.tileentity.IGregTechTileEntity; -import gregtech.api.interfaces.tileentity.IMachineProgress; -import gregtech.api.interfaces.tileentity.IUpgradableMachine; -import gregtech.api.items.GT_EnergyArmor_Item; -import gregtech.api.items.GT_Generic_Item; -import gregtech.api.items.GT_MetaGenerated_Tool; -import gregtech.api.net.GT_Packet_Sound; -import gregtech.api.objects.CollectorUtils; -import gregtech.api.objects.GT_ItemStack; -import gregtech.api.objects.GT_ItemStack2; -import gregtech.api.objects.ItemData; -import gregtech.api.threads.GT_Runnable_Sound; -import gregtech.api.util.extensions.ArrayExt; -import gregtech.common.GT_Pollution; -import gregtech.common.blocks.GT_Block_Ores_Abstract; -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; @@ -68,7 +24,9 @@ import java.util.Map.Entry; 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; @@ -120,23 +78,73 @@ import net.minecraftforge.fluids.IFluidContainerItem; import net.minecraftforge.fluids.IFluidHandler; import net.minecraftforge.oredict.OreDictionary; +import cofh.api.transport.IItemDuct; + +import com.google.auto.value.AutoValue; +import com.google.common.base.Suppliers; +import com.google.common.collect.ImmutableSet; +import com.google.common.collect.Maps; +import com.gtnewhorizon.structurelib.alignment.IAlignment; +import com.gtnewhorizon.structurelib.alignment.IAlignmentProvider; +import com.mojang.authlib.GameProfile; + +import cpw.mods.fml.common.FMLCommonHandler; +import cpw.mods.fml.common.registry.GameRegistry; +import gregtech.api.GregTech_API; +import gregtech.api.damagesources.GT_DamageSources; +import gregtech.api.damagesources.GT_DamageSources.DamageSourceHotItem; +import gregtech.api.enchants.Enchantment_Hazmat; +import gregtech.api.enchants.Enchantment_Radioactivity; +import gregtech.api.enums.*; +import gregtech.api.events.BlockScanningEvent; +import gregtech.api.interfaces.IBlockContainer; +import gregtech.api.interfaces.IDebugableBlock; +import gregtech.api.interfaces.IHasIndexedTexture; +import gregtech.api.interfaces.IProjectileItem; +import gregtech.api.interfaces.ITexture; +import gregtech.api.interfaces.tileentity.IBasicEnergyContainer; +import gregtech.api.interfaces.tileentity.ICoverable; +import gregtech.api.interfaces.tileentity.IGregTechDeviceInformation; +import gregtech.api.interfaces.tileentity.IGregTechTileEntity; +import gregtech.api.interfaces.tileentity.IMachineProgress; +import gregtech.api.interfaces.tileentity.IUpgradableMachine; +import gregtech.api.items.GT_EnergyArmor_Item; +import gregtech.api.items.GT_Generic_Item; +import gregtech.api.items.GT_MetaGenerated_Tool; +import gregtech.api.net.GT_Packet_Sound; +import gregtech.api.objects.CollectorUtils; +import gregtech.api.objects.GT_ItemStack; +import gregtech.api.objects.GT_ItemStack2; +import gregtech.api.objects.ItemData; +import gregtech.api.threads.GT_Runnable_Sound; +import gregtech.api.util.extensions.ArrayExt; +import gregtech.common.GT_Pollution; +import gregtech.common.blocks.GT_Block_Ores_Abstract; +import ic2.api.recipe.IRecipeInput; +import ic2.api.recipe.RecipeInputItemStack; +import ic2.api.recipe.RecipeInputOreDict; +import ic2.api.recipe.RecipeOutput; + /** * NEVER INCLUDE THIS FILE IN YOUR MOD!!! * <p/> * Just a few Utility Functions I use. */ 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<>(); /** - * Forge screwed the Fluid Registry up again, so I make my own, which is also much more efficient than the stupid Stuff over there. + * 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. */ @@ -145,10 +153,10 @@ public class GT_Utility { 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); @@ -156,8 +164,8 @@ public class GT_Utility { // 1 is the magic index to get the cobblestone block. // See: GT_Block_Stones.java, GT_Block_Granites.java - Function<Materials, Supplier<ItemStack>> materialToCobble = m -> Suppliers.memoize( - () -> GT_OreDictUnificator.getOres(OrePrefixes.stone, m).get(1))::get; + Function<Materials, Supplier<ItemStack>> materialToCobble = m -> Suppliers + .memoize(() -> GT_OreDictUnificator.getOres(OrePrefixes.stone, m).get(1))::get; sOreToCobble.put(OrePrefixes.oreBlackgranite, materialToCobble.apply(Materials.GraniteBlack)); sOreToCobble.put(OrePrefixes.oreRedgranite, materialToCobble.apply(Materials.GraniteRed)); sOreToCobble.put(OrePrefixes.oreMarble, materialToCobble.apply(Materials.Marble)); @@ -171,8 +179,7 @@ public class GT_Utility { } public static int safeInt(long number) { - return number > V[V.length - 1] - ? safeInt(V[V.length - 1], 1) + return number > V[V.length - 1] ? safeInt(V[V.length - 1], 1) : number < Integer.MIN_VALUE ? Integer.MIN_VALUE : (int) number; } @@ -181,7 +188,7 @@ public class GT_Utility { try { rField = aObject.getClass().getDeclaredField(aField); } catch (Throwable e) { - /*Do nothing*/ + /* Do nothing */ } return rField; } @@ -192,7 +199,7 @@ public class GT_Utility { rField = aObject.getClass().getDeclaredField(aField); rField.setAccessible(true); } catch (Throwable e) { - /*Do nothing*/ + /* Do nothing */ } return rField; } @@ -203,7 +210,7 @@ public class GT_Utility { rField = aObject.getDeclaredField(aField); rField.setAccessible(true); } catch (Throwable e) { - /*Do nothing*/ + /* Do nothing */ } return rField; } @@ -214,7 +221,7 @@ public class GT_Utility { rMethod = aObject.getMethod(aMethod, aParameterTypes); rMethod.setAccessible(true); } catch (Throwable e) { - /*Do nothing*/ + /* Do nothing */ } return rMethod; } @@ -225,17 +232,15 @@ public class GT_Utility { rMethod = aObject.getClass().getMethod(aMethod, aParameterTypes); rMethod.setAccessible(true); } catch (Throwable e) { - /*Do nothing*/ + /* 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) + 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; @@ -247,10 +252,8 @@ 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) + 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); @@ -268,13 +271,8 @@ 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++) { @@ -295,8 +293,7 @@ public class GT_Utility { } } - Method tMethod = (aObject instanceof Class) - ? ((Class) aObject).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); @@ -306,34 +303,29 @@ 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); + 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); @@ -377,9 +369,7 @@ 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) { @@ -424,10 +414,11 @@ public class GT_Utility { return false; } - public static ItemStack suckOneItemStackAt( - World aWorld, double aX, double aY, double aZ, double aL, double aH, double 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))) { + EntityItem.class, + AxisAlignedBB.getBoundingBox(aX, aY, aZ, aX + aL, aY + aH, aZ + aW))) { if (!tItem.isDead) { aWorld.removeEntity(tItem); tItem.setDead(); @@ -497,23 +488,15 @@ public class GT_Utility { .isPipeConnected(ForgeDirection.getOrientation(aSide)); return GregTech_API.mTranslocator && aTileEntity instanceof codechicken.translocator.TileItemTranslocator; } + /** * Moves Stack from Inv-Slot to Inv-Slot, without checking if its even allowed. * * @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) { + 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, @@ -534,32 +517,25 @@ 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 + 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; + || 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))) { + aTileEntity1, + aGrabSlot, + (byte) aGrabFrom, + aTileEntity1.getStackInSlot(aGrabSlot))) { if (Math.max(aMinMoveAtOnce, aMinTargetStackSize) <= aTileEntity1.getStackInSlot(aGrabSlot).stackSize) { ItemStack tStack = copyAmount( @@ -569,10 +545,11 @@ public class GT_Utility { 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); + 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; @@ -587,7 +564,10 @@ public class GT_Utility { for (int aGrabSlot : aGrabSlots) { if (listContainsItem(aFilter, aTileEntity1.getStackInSlot(aGrabSlot), true, aInvertFilter)) { if (isAllowedToTakeFromSlot( - aTileEntity1, aGrabSlot, (byte) aGrabFrom, aTileEntity1.getStackInSlot(aGrabSlot))) { + aTileEntity1, + aGrabSlot, + (byte) aGrabFrom, + aTileEntity1.getStackInSlot(aGrabSlot))) { if (Math.max(aMinMoveAtOnce, aMinTargetStackSize) <= aTileEntity1.getStackInSlot(aGrabSlot).stackSize) { ItemStack tStack = copyAmount( @@ -616,8 +596,7 @@ public class GT_Utility { } ForgeDirection tDirection = ForgeDirection.getOrientation(aGrabFrom); - if (aTileEntity1 instanceof TileEntity - && tDirection != ForgeDirection.UNKNOWN + 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, @@ -626,7 +605,10 @@ public class GT_Utility { for (int aGrabSlot : aGrabSlots) { if (listContainsItem(aFilter, aTileEntity1.getStackInSlot(aGrabSlot), true, aInvertFilter)) { if (isAllowedToTakeFromSlot( - aTileEntity1, aGrabSlot, (byte) aGrabFrom, aTileEntity1.getStackInSlot(aGrabSlot))) { + aTileEntity1, + aGrabSlot, + (byte) aGrabFrom, + aTileEntity1.getStackInSlot(aGrabSlot))) { if (Math.max(aMinMoveAtOnce, aMinTargetStackSize) <= aTileEntity1.getStackInSlot(aGrabSlot).stackSize) { ItemStack tStack = copyAmount( @@ -655,29 +637,22 @@ public class GT_Utility { } /** - * Moves Stack from Inv-Slot to Inv-Slot, without checking if its even allowed. (useful for internal Inventory Operations) + * Moves Stack from Inv-Slot to Inv-Slot, without checking if its even allowed. (useful for internal Inventory + * Operations) * * @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 + 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; + || aMinMoveAtOnce > aMaxMoveAtOnce) + return 0; - ItemStack tStack1 = aTileEntity1.getStackInSlot(aGrabFrom), - tStack2 = aTileEntity2.getStackInSlot(aPutTo), + ItemStack tStack1 = aTileEntity1.getStackInSlot(aGrabFrom), tStack2 = aTileEntity2.getStackInSlot(aPutTo), tStack3 = null; if (tStack1 != null) { if (tStack2 != null && !areStacksEqual(tStack1, tStack2)) return 0; @@ -689,11 +664,11 @@ public class GT_Utility { Math.min( tStack2 == null ? Integer.MAX_VALUE : tStack2.getMaxStackSize(), aTileEntity2.getInventoryStackLimit()))); - tStack3.stackSize = - Math.min(tStack3.stackSize, aMaxTargetStackSize - (tStack2 == null ? 0 : tStack2.stackSize)); + tStack3.stackSize = Math + .min(tStack3.stackSize, aMaxTargetStackSize - (tStack2 == null ? 0 : tStack2.stackSize)); if (tStack3.stackSize > aMaxMoveAtOnce) tStack3.stackSize = aMaxMoveAtOnce; if (tStack3.stackSize + (tStack2 == null ? 0 : tStack2.stackSize) - >= Math.min(tStack3.getMaxStackSize(), aMinTargetStackSize) + >= Math.min(tStack3.getMaxStackSize(), aMinTargetStackSize) && tStack3.stackSize >= aMinMoveAtOnce) { tStack3 = aTileEntity1.decrStackSize(aGrabFrom, tStack3.stackSize); aTileEntity1.markDirty(); @@ -725,8 +700,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; @@ -739,7 +714,8 @@ public class GT_Utility { || isAllowedToPutIntoSlot(aTileEntity, aSlot, (byte) 5, aStack, aMaxStackSize); } if (aTileEntity instanceof ISidedInventory - && !((ISidedInventory) aTileEntity).canInsertItem(aSlot, aStack, aSide)) return false; + && !((ISidedInventory) aTileEntity).canInsertItem(aSlot, aStack, aSide)) + return false; return aSlot < aTileEntity.getSizeInventory() && aTileEntity.isItemValidForSlot(aSlot, aStack); } @@ -748,55 +724,35 @@ 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 + 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; + || aMaxStackTransfer == 0) + return 0; // find where to take from final int[] tGrabSlots = new int[aTileEntity1.getSizeInventory()]; @@ -804,10 +760,10 @@ public class GT_Utility { if (aTileEntity1 instanceof ISidedInventory) { for (int i : ((ISidedInventory) aTileEntity1).getAccessibleSlotsFromSide(aGrabFrom)) { final ItemStack s = aTileEntity1.getStackInSlot(i); - if (s == null - || !isAllowedToTakeFromSlot(aTileEntity1, i, aGrabFrom, s) + if (s == null || !isAllowedToTakeFromSlot(aTileEntity1, i, aGrabFrom, s) || s.stackSize < aMinMoveAtOnce - || !listContainsItem(aFilter, s, true, aInvertFilter)) continue; + || !listContainsItem(aFilter, s, true, aInvertFilter)) + continue; tGrabSlots[tGrabSlotsSize++] = i; } } else { @@ -822,19 +778,18 @@ public class GT_Utility { // no source, bail out 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); + if (aDoCheckChests && aTileEntity1 instanceof TileEntityChest) return moveFromAdjacentChests( + (TileEntityChest) aTileEntity1, + aTileEntity2, + aGrabFrom, + aPutTo, + aFilter, + aInvertFilter, + aMaxTargetStackSize, + aMinTargetStackSize, + aMaxMoveAtOnce, + aMinMoveAtOnce, + aMaxStackTransfer); return 0; } @@ -865,31 +820,31 @@ public class GT_Utility { tPutFreeSlots.add(slot); } 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); - tPutItemStacks.computeIfAbsent(sID, k -> new ArrayList<>()).add(s); - } + ItemId sID = ItemId.createNoCopy(s); + 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()) { // 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); + if (aDoCheckChests && aTileEntity2 instanceof TileEntityChest) return moveToAdjacentChests( + aTileEntity1, + (TileEntityChest) aTileEntity2, + aGrabFrom, + aPutTo, + aFilter, + aInvertFilter, + aMaxTargetStackSize, + aMinTargetStackSize, + aMaxMoveAtOnce, + aMinMoveAtOnce, + aMaxStackTransfer); return 0; } @@ -971,17 +926,15 @@ public class GT_Utility { if (s != null) { // s might be null if tPutInventory is very special, e.g. infinity chest // if s is null, we will not mark this slot as target candidate for anything - final int spare = - Math.min(s.getMaxStackSize(), tPutInventory.getInventoryStackLimit()) - - s.stackSize; + final int spare = Math + .min(s.getMaxStackSize(), tPutInventory.getInventoryStackLimit()) + - s.stackSize; if (spare > 0) { final ItemId ssID = ItemId.createNoCopy(s); // add back to spare space count tPutItems.merge(ssID, spare, Integer::sum); // add to partially filled slot list - tPutItemStacks - .computeIfAbsent(ssID, k -> new ArrayList<>()) - .add(s); + tPutItemStacks.computeIfAbsent(ssID, k -> new ArrayList<>()).add(s); } // this is no longer free tPutFreeSlots.remove(i); @@ -1002,8 +955,8 @@ public class GT_Utility { // check if we have moved enough stacks 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 @@ -1066,18 +1019,9 @@ public class GT_Utility { 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( @@ -1140,18 +1084,9 @@ public class GT_Utility { 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, @@ -1217,54 +1152,36 @@ public class GT_Utility { * * @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) { - if (aTileEntity1 instanceof IInventory) - return moveOneItemStack( - (IInventory) aTileEntity1, - aTileEntity2, - aGrabFrom, - aPutTo, - aFilter, - aInvertFilter, - aMaxTargetStackSize, - aMinTargetStackSize, - aMaxMoveAtOnce, - aMinMoveAtOnce, - true); + 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 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 + 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; + || aMinMoveAtOnce > aMaxMoveAtOnce) + return 0; int[] tGrabSlots = null; if (aTileEntity1 instanceof ISidedInventory) @@ -1292,7 +1209,11 @@ public class GT_Utility { && isAllowedToTakeFromSlot(aTileEntity1, tGrabSlot, aGrabFrom, tGrabStack)) { for (int tPutSlot : tPutSlots) { if (isAllowedToPutIntoSlot( - (IInventory) aTileEntity2, tPutSlot, aPutTo, tGrabStack, aMaxTargetStackSize)) { + (IInventory) aTileEntity2, + tPutSlot, + aPutTo, + tGrabStack, + aMaxTargetStackSize)) { tMovedItemCount += moveStackFromSlotAToSlotB( aTileEntity1, (IInventory) aTileEntity2, @@ -1303,7 +1224,8 @@ public class GT_Utility { (byte) (aMaxMoveAtOnce - tMovedItemCount), aMinMoveAtOnce); if (tMovedItemCount >= aMaxMoveAtOnce - || (tMovedItemCount > 0 && aMaxTargetStackSize < 64)) return tMovedItemCount; + || (tMovedItemCount > 0 && aMaxTargetStackSize < 64)) + return tMovedItemCount; } } } @@ -1453,25 +1375,17 @@ 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) + 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; + || aMinMoveAtOnce > aMaxMoveAtOnce) + return 0; int[] tGrabSlots = null; if (aTileEntity1 instanceof ISidedInventory) @@ -1484,7 +1398,10 @@ public class GT_Utility { if (aTileEntity2 instanceof IInventory) { for (int tGrabSlot : tGrabSlots) { if (listContainsItem( - aFilter, ((IInventory) aTileEntity1).getStackInSlot(tGrabSlot), true, aInvertFilter)) { + aFilter, + ((IInventory) aTileEntity1).getStackInSlot(tGrabSlot), + true, + aInvertFilter)) { if (isAllowedToTakeFromSlot( (IInventory) aTileEntity1, tGrabSlot, @@ -1532,30 +1449,26 @@ 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 + 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; + || 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)) { + aTileEntity2, + aPutTo, + (byte) 6, + aTileEntity1.getStackInSlot(aGrabFrom), + aMaxTargetStackSize)) { byte tMovedItemCount = moveStackFromSlotAToSlotB( aTileEntity1, aTileEntity2, @@ -1577,24 +1490,15 @@ 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 + 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; + || aMinMoveAtOnce > aMaxMoveAtOnce) + return 0; if (!listContainsItem(aFilter, fromTile.getStackInSlot(aGrabFrom), true, aInvertFilter) || !isAllowedToTakeFromSlot(fromTile, aGrabFrom, (byte) 6, fromTile.getStackInSlot(aGrabFrom))) @@ -1697,7 +1601,7 @@ public class GT_Utility { return moveStackIntoPipe( fromTile, toTile, - new int[] {aGrabFrom}, + new int[] { aGrabFrom }, (byte) 6, aPutTo, aFilter, @@ -1709,17 +1613,9 @@ public class GT_Utility { 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) { + 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, @@ -1734,8 +1630,8 @@ public class GT_Utility { true); } - public static boolean listContainsItem( - Collection<ItemStack> aList, ItemStack aStack, boolean aTIfListEmpty, boolean aInvertFilter) { + 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; @@ -1754,8 +1650,7 @@ public class GT_Utility { 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())) + && (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); @@ -1768,12 +1663,10 @@ public class GT_Utility { } public static boolean areFluidsEqual(FluidStack aFluid1, FluidStack aFluid2, boolean aIgnoreNBT) { - return aFluid1 != null - && aFluid2 != null + return aFluid1 != null && aFluid2 != null && aFluid1.getFluid() == aFluid2.getFluid() - && (aIgnoreNBT - || ((aFluid1.tag == null) == (aFluid2.tag == null)) - && (aFluid1.tag == null || aFluid1.tag.equals(aFluid2.tag))); + && (aIgnoreNBT || ((aFluid1.tag == null) == (aFluid2.tag == null)) + && (aFluid1.tag == null || aFluid1.tag.equals(aFluid2.tag))); } public static boolean areStacksEqual(ItemStack aStack1, ItemStack aStack2) { @@ -1781,13 +1674,11 @@ public class GT_Utility { } public static boolean areStacksEqual(ItemStack aStack1, ItemStack aStack2, boolean aIgnoreNBT) { - return aStack1 != null - && aStack2 != null + return aStack1 != null && aStack2 != null && aStack1.getItem() == aStack2.getItem() - && (aIgnoreNBT - || (((aStack1.getTagCompound() == null) == (aStack2.getTagCompound() == null)) - && (aStack1.getTagCompound() == null - || aStack1.getTagCompound().equals(aStack2.getTagCompound())))) + && (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); @@ -1798,19 +1689,19 @@ 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(); ) { + for (Iterator<ItemStack> it1 = lhs.iterator(), it2 = rhs.iterator(); it1.hasNext() && it2.hasNext();) { 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() @@ -1824,7 +1715,9 @@ 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); + GT_OreDictUnificator.get_nocopy(aStack1), + GT_OreDictUnificator.get_nocopy(aStack2), + aIgnoreNBT); } public static String getFluidName(Fluid aFluid, boolean aLocalized) { @@ -1847,12 +1740,13 @@ 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<>()); + new GT_ItemStack(tData.emptyContainer), + tFluidToContainer = new /* Concurrent */ HashMap<>()); GregTech_API.sFluidMappings.add(tFluidToContainer); } tFluidToContainer.put(tData.fluid.getFluid(), tData); @@ -1874,12 +1768,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); @@ -1899,8 +1793,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) { @@ -1909,14 +1803,12 @@ public class GT_Utility { } return null; } - if (aCheckIFluidContainerItems - && aStack.getItem() instanceof IFluidContainerItem + 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); + if (aRemoveFluidDirectly) aFluid.amount -= ((IFluidContainerItem) aStack.getItem()) + .fill(aStack = copyAmount(1, aStack), aFluid, true); + else((IFluidContainerItem) aStack.getItem()).fill(aStack = copyAmount(1, aStack), aFluid, true); return aStack; } Map<Fluid, FluidContainerData> tFluidToContainer = sEmptyContainerToFluidToData.get(new GT_ItemStack(aStack)); @@ -1928,8 +1820,7 @@ public class GT_Utility { } public static int calculateRecipeEU(Materials aMaterial, int defaultRecipeEUPerTick) { - return aMaterial.getProcessingMaterialTierEU() == 0 - ? defaultRecipeEUPerTick + return aMaterial.getProcessingMaterialTierEU() == 0 ? defaultRecipeEUPerTick : aMaterial.getProcessingMaterialTierEU(); } @@ -1957,35 +1848,32 @@ public class GT_Utility { tNBT.setBoolean("mHideStackSize", aHideStackSize); try { tNBT.setString("mFluidMaterialName", FLUID_MAP.get(aFluid.getFluid()).mName); - } catch (Exception ignored) { - } + } catch (Exception ignored) {} rStack.setTagCompound(tNBT); return rStack; } 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 + if (aCheckIFluidContainerItems && aStack.getItem() instanceof IFluidContainerItem && ((IFluidContainerItem) aStack.getItem()).getCapacity(aStack) > 0) - return aFluid.isFluidEqual( - ((IFluidContainerItem) aStack.getItem()).getFluid(aStack = copyAmount(1, aStack))); + return aFluid + .isFluidEqual(((IFluidContainerItem) aStack.getItem()).getFluid(aStack = copyAmount(1, aStack))); FluidContainerData tData = sFilledContainerToData.get(new GT_ItemStack(aStack)); return tData != null && tData.fluid.isFluidEqual(aFluid); } public static FluidStack getFluidForFilledItem(ItemStack aStack, boolean aCheckIFluidContainerItems) { if (isStackInvalid(aStack)) return null; - if (aCheckIFluidContainerItems - && aStack.getItem() instanceof IFluidContainerItem + 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)); @@ -1999,8 +1887,7 @@ 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 + 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; @@ -2015,15 +1902,16 @@ public class GT_Utility { public static ItemStack getContainerItem(ItemStack aStack, boolean aCheckIFluidContainerItems) { if (isStackInvalid(aStack)) return null; if (aStack.getItem().hasContainerItem(aStack)) return aStack.getItem().getContainerItem(aStack); - /** These are all special Cases, in which it is intended to have only GT Blocks outputting those Container Items */ + /** + * 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 (aStack.getItem() == Items.potionitem - || aStack.getItem() == Items.experience_bottle + 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); + || ItemList.TF_Vial_FieryTears.isStackEqual(aStack)) + return ItemList.Bottle_Empty.get(1); - if (aCheckIFluidContainerItems - && aStack.getItem() instanceof IFluidContainerItem + 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); @@ -2047,79 +1935,71 @@ public class GT_Utility { return fluidStack; } - public static synchronized boolean removeIC2BottleRecipe( - ItemStack aContainer, - ItemStack aInput, - Map<ic2.api.recipe.ICannerBottleRecipeManager.Input, RecipeOutput> aRecipeList, - ItemStack aOutput) { + 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) { @@ -2131,13 +2011,14 @@ public class GT_Utility { ItemStack[] tStack = GT_OreDictUnificator.getStackArray(true, aOutput); if (tStack.length > 0 && areStacksEqual(aInput, tStack[0])) return false; if (tOreName != null) { - if (tOreName.toString().equals("dustAsh") - && tStack[0].getUnlocalizedName().equals("tile.volcanicAsh")) 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)); + new RecipeInputItemStack(copyOrNull(aInput), aInput.stackSize), + new RecipeOutput(aNBT, tStack)); } return true; } @@ -2165,8 +2046,8 @@ 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]); @@ -2175,12 +2056,21 @@ public class GT_Utility { 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); } @@ -2194,20 +2084,25 @@ 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); + 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(), @@ -2218,13 +2113,8 @@ public class GT_Utility { 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); } @@ -2233,65 +2123,61 @@ 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); + 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) { + 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); + 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) { - if (!FMLCommonHandler.instance().getEffectiveSide().isClient() - || 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(); - 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(); + public static boolean doSoundAtClient(ResourceLocation aSoundResourceLocation, int aTimeUntilNextSound, + float aSoundStrength, float aSoundModulation, double aX, double aY, double aZ) { + if (!FMLCommonHandler.instance().getEffectiveSide().isClient() || GT.getThePlayer() == null + || !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(); + 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(); return true; } @@ -2300,34 +2186,42 @@ 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); + 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); + 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), + sound.resourceLocation.toString(), + aSoundStrength, + aSoundModulation, + aX, + (short) aY, + aZ), aX, aZ); return true; @@ -2400,7 +2294,7 @@ public class GT_Utility { public static <T> ArrayList<T> getArrayListWithoutTrailingNulls(T... aArray) { if (aArray == null) return new ArrayList<>(); ArrayList<T> rList = new ArrayList<>(Arrays.asList(aArray)); - for (int i = rList.size() - 1; i >= 0 && rList.get(i) == null; ) rList.remove(i--); + for (int i = rList.size() - 1; i >= 0 && rList.get(i) == null;) rList.remove(i--); return rList; } @@ -2437,21 +2331,21 @@ public class GT_Utility { } public static boolean isStackValid(Object aStack) { - return (aStack instanceof ItemStack) - && ((ItemStack) aStack).getItem() != null + return (aStack instanceof ItemStack) && ((ItemStack) aStack).getItem() != null && ((ItemStack) aStack).stackSize >= 0; } public static boolean isStackInvalid(Object aStack) { - return aStack == null - || !(aStack instanceof ItemStack) + 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) { @@ -2473,9 +2367,8 @@ public class GT_Utility { } public static void setCoordsOnFire(World aWorld, int aX, int aY, int aZ, boolean aReplaceCenter) { - if (aReplaceCenter) - if (aWorld.getBlock(aX, aY, aZ).getCollisionBoundingBoxFromPool(aWorld, aX, aY, aZ) == null) - aWorld.setBlock(aX, aY, aZ, Blocks.fire); + if (aReplaceCenter) if (aWorld.getBlock(aX, aY, aZ).getCollisionBoundingBoxFromPool(aWorld, aX, aY, aZ) == null) + aWorld.setBlock(aX, aY, aZ, Blocks.fire); if (aWorld.getBlock(aX + 1, aY, aZ).getCollisionBoundingBoxFromPool(aWorld, aX + 1, aY, aZ) == null) aWorld.setBlock(aX + 1, aY, aZ, Blocks.fire); if (aWorld.getBlock(aX - 1, aY, aZ).getCollisionBoundingBoxFromPool(aWorld, aX - 1, aY, aZ) == null) @@ -2491,34 +2384,28 @@ 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); + } } /** - * Initializes new empty texture page for casings - * page 0 is old CASING_BLOCKS + * Initializes new empty texture page for casings page 0 is old CASING_BLOCKS * - * Then casings should be registered like this: - * for (byte i = MIN_USED_META; i < MAX_USED_META; i = (byte) (i + 1)) { - * Textures.BlockIcons.casingTexturePages[PAGE][i+START_INDEX] = new GT_CopiedBlockTexture(this, 6, i); - * } + * Then casings should be registered like this: for (byte i = MIN_USED_META; i < MAX_USED_META; i = (byte) (i + 1)) + * { Textures.BlockIcons.casingTexturePages[PAGE][i+START_INDEX] = new GT_CopiedBlockTexture(this, 6, i); } * * @param page 0 to 127 * @return true if it made empty page, false if one already existed... @@ -2534,7 +2421,8 @@ public class GT_Utility { /** * Return texture id from page and index, for use when determining hatches, but can also be precomputed from: * (page<<7)+index - * @param page 0 to 127 page + * + * @param page 0 to 127 page * @param index 0 to 127 texture index * @return casing texture 0 to 16383 */ @@ -2548,21 +2436,30 @@ public class GT_Utility { /** * Return texture id from page and index, for use when determining hatches, but can also be precomputed from: * (page<<7)+index - * @param page 0 to 127 page + * + * @param page 0 to 127 page * @param startIndex 0 to 127 start texture index - * @param blockMeta meta of the block + * @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); } - throw new RuntimeException("Index out of range: [" + page + "][" + startIndex + "+" + blockMeta + "=" - + (startIndex + blockMeta) + "]"); + throw new RuntimeException( + "Index out of range: [" + page + + "][" + + startIndex + + "+" + + blockMeta + + "=" + + (startIndex + blockMeta) + + "]"); } /** * Return texture id from item stack, unoptimized but readable? + * * @return casing texture 0 to 16383 */ @Deprecated @@ -2572,6 +2469,7 @@ public class GT_Utility { /** * Return texture id from item stack, unoptimized but readable? + * * @return casing texture 0 to 16383 */ public static int getTextureId(Block blockFromBlock, byte metaFromBlock) { @@ -2590,8 +2488,10 @@ 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); } /** @@ -2745,8 +2645,7 @@ public class GT_Utility { public static float getHeatDamageFromItem(ItemStack aStack) { ItemData tData = GT_OreDictUnificator.getItemData(aStack); - return tData == null - ? 0 + return tData == null ? 0 : (tData.mPrefix == null ? 0 : tData.mPrefix.mHeatDamage) + (tData.hasValidMaterialData() ? tData.mMaterial.mMaterial.mHeatDamage : 0); } @@ -2775,8 +2674,7 @@ public class GT_Utility { } private static boolean applyHeatDamage(EntityLivingBase aEntity, float aDamage, DamageSource source) { - if (aDamage > 0 - && aEntity != null + if (aDamage > 0 && aEntity != null && aEntity.getActivePotionEffect(Potion.fireResistance) == null && !isWearingFullHeatHazmat(aEntity)) { aEntity.attackEntityFrom(source, aDamage); @@ -2803,66 +2701,59 @@ public class GT_Utility { } public static boolean applyRadioactivity(EntityLivingBase aEntity, int aLevel, int aAmountOfItems) { - if (aLevel > 0 - && aEntity != null + 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( + aEntity.addPotionEffect( + new PotionEffect( + Potion.moveSlowdown.id, + aLevel * 140 * aAmountOfItems + Math.max( 0, - ((tEffect = aEntity.getActivePotionEffect(Potion.moveSlowdown)) == null - ? 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( + 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 = 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( + 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 = 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( + 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 = 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( + 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 = 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( + 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 = aEntity.getActivePotionEffect(Potion.potionTypes[24])) == null ? 0 : tEffect.getDuration())), - Math.max(0, (5 * aLevel) / 7))); + Math.max(0, (5 * aLevel) / 7))); return true; } return false; @@ -3041,8 +2932,7 @@ 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()) + return map.entrySet().stream().sorted(Entry.comparingByValue()) .collect(CollectorUtils.entriesToMap(LinkedHashMap::new)); } @@ -3067,7 +2957,8 @@ public class GT_Utility { } /** - * Translates a Material Amount into an Amount of Fluid. Second Parameter for things like Bucket Amounts (1000) and similar + * 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( @@ -3077,8 +2968,7 @@ public class GT_Utility { } /** - * This checks if the Dimension is really a Dimension and not another Planet or something. - * Used for my Teleporter. + * This checks if the Dimension is really a Dimension and not another Planet or something. Used for my Teleporter. */ public static boolean isRealDimension(int aDimensionID) { if (aDimensionID <= 1 && aDimensionID >= -1 && !GregTech_API.sDimensionalList.contains(aDimensionID)) @@ -3087,8 +2977,8 @@ public class GT_Utility { && DimensionManager.isDimensionRegistered(aDimensionID); } - public static boolean moveEntityToDimensionAtCoords( - Entity entity, int aDimension, double aX, double aY, double aZ) { + 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; @@ -3096,8 +2986,8 @@ public class GT_Utility { if (entity.riddenByEntity != null) entity.riddenByEntity.mountEntity(null); World startWorld = entity.worldObj; - World destinationWorld = - FMLCommonHandler.instance().getMinecraftServerInstance().worldServerForDimension(aDimension); + World destinationWorld = FMLCommonHandler.instance().getMinecraftServerInstance() + .worldServerForDimension(aDimension); if (destinationWorld == null) { return false; @@ -3111,11 +3001,12 @@ public class GT_Utility { EntityPlayerMP player = (EntityPlayerMP) entity; 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); @@ -3169,8 +3060,8 @@ 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()) { @@ -3179,9 +3070,10 @@ public class GT_Utility { player.playerNetServerHandler.sendPacket( new S1FPacketSetExperience(player.experience, player.experienceTotal, player.experienceLevel)); - FMLCommonHandler.instance() - .firePlayerChangedDimensionEvent( - player, startWorld.provider.dimensionId, destinationWorld.provider.dimensionId); + FMLCommonHandler.instance().firePlayerChangedDimensionEvent( + player, + startWorld.provider.dimensionId, + destinationWorld.provider.dimensionId); } entity.setLocationAndAngles(aX, aY, aZ, entity.rotationYaw, entity.rotationPitch); @@ -3194,18 +3086,8 @@ public class GT_Utility { 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) { + 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<>(); @@ -3215,43 +3097,60 @@ 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 + " -----"); - try { - if (tTileEntity instanceof IInventory) - tList.add(GT_Utility.trans("162", "Name: ") - + EnumChatFormatting.BLUE - + ((IInventory) tTileEntity).getInventoryName() + tList.add( + "----- X: " + EnumChatFormatting.AQUA + + formatNumbers(aX) + + EnumChatFormatting.RESET + + " Y: " + + EnumChatFormatting.AQUA + + formatNumbers(aY) + EnumChatFormatting.RESET - + GT_Utility.trans("163", " MetaData: ") + + " Z: " + EnumChatFormatting.AQUA - + aWorld.getBlockMetadata(aX, aY, aZ) - + EnumChatFormatting.RESET); - else - tList.add(GT_Utility.trans("162", "Name: ") - + EnumChatFormatting.BLUE - + tBlock.getUnlocalizedName() + + formatNumbers(aZ) + EnumChatFormatting.RESET - + GT_Utility.trans("163", " MetaData: ") + + " D: " + 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); + + 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); + 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); } catch (Throwable e) { if (D1) e.printStackTrace(GT_Log.err); } @@ -3259,17 +3158,24 @@ 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); @@ -3285,17 +3191,22 @@ 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("169", "HEM: ") + 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("170"," Base EU Output: ")/* + + * ((ic2.api.reactor.IReactor)tTileEntity).getOutput() + */ ); } } catch (Throwable e) { if (D1) e.printStackTrace(GT_Log.err); @@ -3305,10 +3216,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) { @@ -3317,11 +3228,15 @@ 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( + 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 @@ -3337,10 +3252,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); @@ -3348,11 +3263,15 @@ 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); @@ -3360,10 +3279,9 @@ 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); @@ -3378,11 +3296,14 @@ 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); + 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); } } catch (Throwable e) { if (D1) e.printStackTrace(GT_Log.err); @@ -3390,8 +3311,7 @@ public class GT_Utility { try { if (tTileEntity instanceof ICoverable) { rEUAmount += 300; - final String tString = ((ICoverable) tTileEntity) - .getCoverInfoAtSide((byte) aSide) + final String tString = ((ICoverable) tTileEntity).getCoverInfoAtSide((byte) aSide) .getBehaviorDescription(); if (tString != null && !tString.equals(E)) tList.add(tString); } @@ -3401,33 +3321,49 @@ public class GT_Utility { 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"); + 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); @@ -3446,29 +3382,29 @@ public class GT_Utility { final ic2.api.crops.ICropTile crop = (ic2.api.crops.ICropTile) tTileEntity; 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()) { @@ -3476,8 +3412,7 @@ public class GT_Utility { } final String tString = tStringB.toString(); tList.add(GT_Utility.trans("198", "Attributes:") + tString.replaceFirst(",", E)); - tList.add(GT_Utility.trans("199", "Discovered by: ") - + crop.getCrop().discoveredBy()); + tList.add(GT_Utility.trans("199", "Discovered by: ") + crop.getCrop().discoveredBy()); } } } catch (Throwable e) { @@ -3486,8 +3421,7 @@ 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) { rEUAmount += 1000; @@ -3503,24 +3437,34 @@ public class GT_Utility { 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"); - else - tList.add(EnumChatFormatting.GOLD + GT_Utility.trans("201", "Nothing") + EnumChatFormatting.RESET + ": " - + EnumChatFormatting.YELLOW + '0' + EnumChatFormatting.RESET + " L"); - } - // if(aPlayer.capabilities.isCreativeMode){ + 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"); + } + // 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 { @@ -3562,30 +3506,31 @@ public class GT_Utility { } /** - * @return an Array containing the X and the Y Coordinate of the clicked Point, with the top left Corner as Origin, like on the Texture Sheet. return values should always be between [0.0F and 0.99F]. + * @return an Array containing the X and the Y Coordinate of the clicked Point, with the top left Corner as Origin, + * like on the Texture Sheet. return values should always be between [0.0F and 0.99F]. */ 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 }; } } /** - * This Function determines the direction a Block gets when being Wrenched. - * returns -1 if invalid. Even though that could never happen. + * This Function determines the direction a Block gets when being Wrenched. returns -1 if invalid. Even though that + * could never happen. */ public static byte determineWrenchingSide(byte aSide, float aX, float aY, float aZ) { byte tBack = getOppositeSide(aSide); @@ -3676,13 +3621,12 @@ public class GT_Utility { } /* - * 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. + * 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) { - if (stack != null - && GT_OreDictUnificator.getItemData(stack).mMaterial.mMaterial == mat + 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; return true; @@ -3726,7 +3670,13 @@ public class GT_Utility { 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); + 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); @@ -3735,12 +3685,14 @@ 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); + 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; @@ -3758,6 +3710,7 @@ public class GT_Utility { } public static class ItemNBT { + public static void setNBT(ItemStack aStack, NBTTagCompound aNBT) { if (aNBT == null) { aStack.setTagCompound(null); @@ -3766,8 +3719,7 @@ 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) + 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); @@ -3837,15 +3789,19 @@ 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(","); } @@ -3853,16 +3809,8 @@ public class GT_Utility { setNBT(aStack, tNBT); } - public static void setAdvancedProspectionData( - byte aTier, - ItemStack aStack, - int aX, - short aY, - int aZ, - int aDim, - ArrayList<String> aOils, - ArrayList<String> aOres, - int aRadius) { + public static void setAdvancedProspectionData(byte aTier, ItemStack aStack, int aX, short aY, int aZ, int aDim, + ArrayList<String> aOils, ArrayList<String> aOres, int aRadius) { setBookTitle(aStack, "Raw Prospection Data"); @@ -3884,8 +3832,10 @@ public class GT_Utility { 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"; + 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; @@ -3910,8 +3860,10 @@ public class GT_Utility { 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); @@ -3930,16 +3882,33 @@ public class GT_Utility { if (tDataArray.length > 6) { tNBT.setString( "author", - " Dim: " + tDataArray[3] + "X: " + tDataArray[0] + " Y: " + tDataArray[1] + " Z: " + " 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 @@ -3955,10 +3924,14 @@ 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" + 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"; tNBTList.appendTag(new NBTTagString(tPageText)); @@ -3967,12 +3940,15 @@ public class GT_Utility { if (tOils != null) fillBookWithList(tNBTList, "Oils%s\n\n", "\n", 9, tOils); - tPageText = "Oil notes\n\n" - + "Prospects from NW to SE 576 chunks" - + "(9 8x8 oilfields)\n around and gives min-max amount" + "\n\n" - + "[1][2][3]" + "\n" - + "[4][5][6]" + "\n" - + "[7][8][9]" + "\n" + tPageText = "Oil notes\n\n" + "Prospects from NW to SE 576 chunks" + + "(9 8x8 oilfields)\n around and gives min-max amount" + + "\n\n" + + "[1][2][3]" + + "\n" + + "[4][5][6]" + + "\n" + + "[7][8][9]" + + "\n" + "\n" + "[5] - Prospector in this 8x8 area"; tNBTList.appendTag(new NBTTagString(tPageText)); @@ -3986,8 +3962,8 @@ public class GT_Utility { 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; @@ -3995,9 +3971,7 @@ public class GT_Utility { do { tPageText = new StringBuilder(); for (int i = tPage * aItemsPerPage; i < (tPage + 1) * aItemsPerPage && i < list.length; i += 1) - tPageText - .append((tPageText.length() == 0) ? "" : aListDelimiter) - .append(list[i]); + tPageText.append((tPageText.length() == 0) ? "" : aListDelimiter).append(list[i]); if (tPageText.length() > 0) { String tPageCounter = tTotalPages > 1 ? String.format(aPageFormatter, tPage + 1, tTotalPages) : ""; @@ -4040,6 +4014,7 @@ public class GT_Utility { * THIS IS BULLSHIT!!! WHY DO I HAVE TO DO THIS SHIT JUST TO HAVE ENCHANTS PROPERLY!?! */ public static class GT_EnchantmentHelper { + private static final BullshitIteratorA mBullshitIteratorA = new BullshitIteratorA(); private static final BullshitIteratorB mBullshitIteratorB = new BullshitIteratorB(); @@ -4085,10 +4060,12 @@ public class GT_Utility { } interface IBullshit { + void calculateModifier(Enchantment aEnchantment, int aLevel); } static final class BullshitIteratorA implements IBullshit { + public EntityLivingBase mPlayer; public Entity mEntity; @@ -4101,6 +4078,7 @@ public class GT_Utility { } static final class BullshitIteratorB implements IBullshit { + public EntityLivingBase mPlayer; public Entity mEntity; @@ -4123,10 +4101,7 @@ public class GT_Utility { public static boolean isPartOfMaterials(ItemStack aStack, Materials aMaterials) { return GT_OreDictUnificator.getAssociation(aStack) != null - && GT_OreDictUnificator.getAssociation(aStack) - .mMaterial - .mMaterial - .equals(aMaterials); + && GT_OreDictUnificator.getAssociation(aStack).mMaterial.mMaterial.equals(aMaterials); } public static boolean isPartOfOrePrefix(ItemStack aStack, OrePrefixes aPrefix) { @@ -4140,8 +4115,7 @@ public class GT_Utility { "gtPlusPlus.core.block.base.BlockBaseOre"); public static boolean isOre(Block aBlock, int aMeta) { - return (aBlock instanceof GT_Block_Ores_Abstract) - || isOre(new ItemStack(aBlock, 1, aMeta)) + return (aBlock instanceof GT_Block_Ores_Abstract) || isOre(new ItemStack(aBlock, 1, aMeta)) || ORE_BLOCK_CLASSES.contains(aBlock.getClass().getName()); } @@ -4161,16 +4135,16 @@ public class GT_Utility { } /** - * Do <b>NOT</b> mutate the returned {@code ItemStack}! - * We return {@code ItemStack} instead of {@code Block} so that we can include metadata. + * Do <b>NOT</b> mutate the returned {@code ItemStack}! We return {@code ItemStack} instead of {@code Block} so that + * we can include metadata. */ 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. // 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) { @@ -4194,8 +4168,7 @@ 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); @@ -4211,8 +4184,18 @@ public class GT_Utility { 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) { @@ -4252,8 +4235,7 @@ 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; @@ -4272,13 +4254,23 @@ public class GT_Utility { // 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)); } /** - * Add an itemstack to player inventory, or drop on ground if full. - * Can be called on client but it probably won't work very well. + * Add an itemstack to player inventory, or drop on ground if full. Can be called on client but it probably won't + * work very well. */ public static void addItemToPlayerInventory(EntityPlayer aPlayer, ItemStack aStack) { if (isStackInvalid(aStack)) return; @@ -4389,6 +4381,7 @@ public class GT_Utility { @AutoValue public abstract static class ItemId { + /** This method copies NBT, as it is mutable. */ public static ItemId create(ItemStack itemStack) { NBTTagCompound nbt = itemStack.getTagCompound(); @@ -4402,7 +4395,9 @@ public class GT_Utility { /** 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(); diff --git a/src/main/java/gregtech/api/util/GT_UtilityClient.java b/src/main/java/gregtech/api/util/GT_UtilityClient.java index 8cbf6bf4ad..22bf2b746e 100644 --- a/src/main/java/gregtech/api/util/GT_UtilityClient.java +++ b/src/main/java/gregtech/api/util/GT_UtilityClient.java @@ -1,18 +1,21 @@ 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 com.google.common.collect.Lists; +import cpw.mods.fml.relauncher.ReflectionHelper; + public class GT_UtilityClient { - private static final Field isDrawingField = - ReflectionHelper.findField(Tessellator.class, "isDrawing", "field_78415_z"); + + private static final Field isDrawingField = ReflectionHelper + .findField(Tessellator.class, "isDrawing", "field_78415_z"); public static boolean isDrawing(Tessellator tess) { try { @@ -27,7 +30,8 @@ public class GT_UtilityClient { public static List<String> getTooltip(ItemStack aStack, boolean aGuiStyle) { try { List<String> tooltip = aStack.getTooltip( - Minecraft.getMinecraft().thePlayer, Minecraft.getMinecraft().gameSettings.advancedItemTooltips); + Minecraft.getMinecraft().thePlayer, + Minecraft.getMinecraft().gameSettings.advancedItemTooltips); if (aGuiStyle) { tooltip.set( 0, @@ -40,10 +44,9 @@ public class GT_UtilityClient { 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()); + 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 ecf2921d36..dee0ac36ad 100644 --- a/src/main/java/gregtech/api/util/IGT_HatchAdder.java +++ b/src/main/java/gregtech/api/util/IGT_HatchAdder.java @@ -3,6 +3,7 @@ package gregtech.api.util; import gregtech.api.interfaces.tileentity.IGregTechTileEntity; public interface IGT_HatchAdder<T> { + /** * Callback to add hatch, needs to check if hatch is valid (and add it) * diff --git a/src/main/java/gregtech/api/util/ISerializableObject.java b/src/main/java/gregtech/api/util/ISerializableObject.java index b8014860f8..3895e277ad 100644 --- a/src/main/java/gregtech/api/util/ISerializableObject.java +++ b/src/main/java/gregtech/api/util/ISerializableObject.java @@ -1,10 +1,10 @@ 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; @@ -14,6 +14,9 @@ import net.minecraft.nbt.NBTSizeTracker; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.nbt.NBTTagInt; +import com.google.common.io.ByteArrayDataInput; +import io.netty.buffer.ByteBuf; + /** * We could well have used {@link java.io.Serializable}, but that's too slow and should generally be avoided * @@ -25,17 +28,16 @@ public interface ISerializableObject { ISerializableObject copy(); /** - * If you are overriding this, you must <b>NOT</b> return {@link NBTTagInt} here! That return - * type is how we tell that we are loading legacy data, and only {@link LegacyCoverData} is - * allowed to return it. You probably want to return {@link NBTTagCompound} anyway. + * If you are overriding this, you must <b>NOT</b> return {@link NBTTagInt} here! That return type is how we tell + * that we are loading legacy data, and only {@link LegacyCoverData} is allowed to return it. You probably want to + * return {@link NBTTagCompound} anyway. */ @Nonnull NBTBase saveDataToNBT(); /** - * Write data to given ByteBuf - * The data saved this way is intended to be stored for short amount of time over network. - * DO NOT store it to disks. + * Write data to given ByteBuf The data saved this way is intended to be stored for short amount of time over + * network. DO NOT store it to disks. */ // the NBT is an unfortunate piece of tech. everything uses it but its API is not as efficient as could be void writeToByteBuf(ByteBuf aBuf); @@ -43,8 +45,9 @@ public interface ISerializableObject { void loadDataFromNBT(NBTBase aNBT); /** - * Read data from given parameter and return this. - * The data read this way is intended to be stored for short amount of time over network. + * Read data from given parameter and return this. The data read this way is intended to be stored for short amount + * of time over network. + * * @param aPlayer the player who is sending this packet to server. null if it's client reading data. */ // the NBT is an unfortunate piece of tech. everything uses it but its API is not as efficient as could be @@ -52,8 +55,8 @@ public interface ISerializableObject { ISerializableObject readFromPacket(ByteArrayDataInput aBuf, @Nullable EntityPlayerMP aPlayer); /** - * Reverse engineered and adapted {@link cpw.mods.fml.common.network.ByteBufUtils#readTag(ByteBuf)} - * Given buffer must contain a serialized NBTTagCompound in minecraft encoding + * Reverse engineered and adapted {@link cpw.mods.fml.common.network.ByteBufUtils#readTag(ByteBuf)} Given buffer + * must contain a serialized NBTTagCompound in minecraft encoding */ static NBTTagCompound readCompoundTagFromGreggyByteBuf(ByteArrayDataInput aBuf) { short size = aBuf.readShort(); @@ -70,8 +73,8 @@ public interface ISerializableObject { } /** - * Reverse engineered and adapted {@link cpw.mods.fml.common.network.ByteBufUtils#readItemStack(ByteBuf)} - * Given buffer must contain a serialized ItemStack in minecraft encoding + * Reverse engineered and adapted {@link cpw.mods.fml.common.network.ByteBufUtils#readItemStack(ByteBuf)} Given + * buffer must contain a serialized ItemStack in minecraft encoding */ static ItemStack readItemStackFromGreggyByteBuf(ByteArrayDataInput aBuf) { ItemStack stack = null; @@ -86,6 +89,7 @@ public interface ISerializableObject { } final class LegacyCoverData implements ISerializableObject { + private int mData; public LegacyCoverData() {} diff --git a/src/main/java/gregtech/api/util/LightingHelper.java b/src/main/java/gregtech/api/util/LightingHelper.java index 5aa9000bf2..36d8f4cda3 100644 --- a/src/main/java/gregtech/api/util/LightingHelper.java +++ b/src/main/java/gregtech/api/util/LightingHelper.java @@ -1,38 +1,31 @@ /* - * LightingHelper - Derived and adapted from @Mineshopper / carpentersblocks - * Copyright (c) 2013-2021. - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation version 2.1 - * of the License. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * LightingHelper - Derived and adapted from @Mineshopper / carpentersblocks Copyright (c) 2013-2021. This library is + * free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as + * published by the Free Software Foundation version 2.1 of the License. This library is distributed in the hope that it + * will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A + * PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of + * the GNU Lesser General Public License along with this library; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */ package gregtech.api.util; -import cpw.mods.fml.relauncher.Side; -import cpw.mods.fml.relauncher.SideOnly; import net.minecraft.block.Block; import net.minecraft.client.renderer.EntityRenderer; import net.minecraft.client.renderer.RenderBlocks; import net.minecraft.client.renderer.Tessellator; +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; + @SuppressWarnings("unused") @SideOnly(Side.CLIENT) public class LightingHelper { + public static final int NORMAL_BRIGHTNESS = 0xff00ff; public static final int MAX_BRIGHTNESS = 0xf000f0; public static final float NO_Z_FIGHT_OFFSET = 1.0F / 1024.0F; - protected static final float[] LIGHTNESS = {0.5F, 1.0F, 0.8F, 0.8F, 0.6F, 0.6F}; + protected static final float[] LIGHTNESS = { 0.5F, 1.0F, 0.8F, 0.8F, 0.6F, 0.6F }; private final RenderBlocks renderBlocks; /** * Brightness for side. @@ -94,7 +87,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 }; } /** @@ -197,8 +190,7 @@ public class LightingHelper { } /** - * Sets up the color using lightness, brightness, and the primary color - * value (usually the dye color) for the side. + * Sets up the color using lightness, brightness, and the primary color value (usually the dye color) for the side. * * @param side the side * @param rgba the primary short[] RGBA color array @@ -208,8 +200,7 @@ public class LightingHelper { } /** - * Sets up the color using lightness, brightness, and the primary color - * value (usually the dye color) for the side. + * Sets up the color using lightness, brightness, and the primary color value (usually the dye color) for the side. * * @param side the side * @param hexColor the primary color @@ -230,21 +221,18 @@ 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; @@ -278,14 +266,13 @@ 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 }; } /** * Will apply anaglyph color multipliers to RGB float array. * <p> - * If {@link EntityRenderer#anaglyphEnable} is false, - * will do nothing. + * If {@link EntityRenderer#anaglyphEnable} is false, will do nothing. * * @param rgb array containing red, green and blue float values */ @@ -298,8 +285,7 @@ public class LightingHelper { } /** - * Gets mixed ambient occlusion value from two inputs, with a - * ratio applied to the final result. + * Gets mixed ambient occlusion value from two inputs, with a ratio applied to the final result. * * @param ao1 the first ambient occlusion value * @param ao2 the second ambient occlusion value @@ -342,12 +328,11 @@ public class LightingHelper { /** * Sets up lighting for the West face and returns the {@link LightingHelper}. * <p> - * This is a consolidated <code>method</code> that sets side shading - * with respect to the following attributes: + * This is a consolidated <code>method</code> that sets side shading with respect to the following attributes: * <p> * <ul> - * <li>{@link RenderBlocks#enableAO}</li> - * <li>{@link RenderBlocks#partialRenderBounds}</li> + * <li>{@link RenderBlocks#enableAO}</li> + * <li>{@link RenderBlocks#partialRenderBounds}</li> * </ul> * * @param block the block {@link Block} @@ -368,22 +353,22 @@ 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.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(), @@ -438,26 +423,18 @@ public class LightingHelper { 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; + 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) @@ -520,12 +497,11 @@ public class LightingHelper { /** * Sets up lighting for the East face and returns the {@link LightingHelper}. * <p> - * This is a consolidated <code>method</code> that sets side shading - * with respect to the following attributes: + * This is a consolidated <code>method</code> that sets side shading with respect to the following attributes: * <p> * <ul> - * <li>{@link RenderBlocks#enableAO}</li> - * <li>{@link RenderBlocks#partialRenderBounds}</li> + * <li>{@link RenderBlocks#enableAO}</li> + * <li>{@link RenderBlocks#partialRenderBounds}</li> * </ul> * * @param block the block {@link Block} @@ -545,22 +521,22 @@ 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.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(), @@ -615,26 +591,18 @@ public class LightingHelper { 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; + 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) @@ -697,12 +665,11 @@ public class LightingHelper { /** * Sets up lighting for the bottom face and returns the {@link LightingHelper}. * <p> - * This is a consolidated <code>method</code> that sets side shading - * with respect to the following attributes: + * This is a consolidated <code>method</code> that sets side shading with respect to the following attributes: * <p> * <ul> - * <li>{@link RenderBlocks#enableAO}</li> - * <li>{@link RenderBlocks#partialRenderBounds}</li> + * <li>{@link RenderBlocks#enableAO}</li> + * <li>{@link RenderBlocks#partialRenderBounds}</li> * </ul> * * @param block the block {@link Block} @@ -723,22 +690,22 @@ 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.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(), @@ -793,26 +760,18 @@ public class LightingHelper { 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; + 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 @@ -875,12 +834,11 @@ public class LightingHelper { /** * Sets up lighting for the top face and returns the {@link LightingHelper}. * <p> - * This is a consolidated <code>method</code> that sets side shading - * with respect to the following attributes: + * This is a consolidated <code>method</code> that sets side shading with respect to the following attributes: * <p> * <ul> - * <li>{@link RenderBlocks#enableAO}</li> - * <li>{@link RenderBlocks#partialRenderBounds}</li> + * <li>{@link RenderBlocks#enableAO}</li> + * <li>{@link RenderBlocks#partialRenderBounds}</li> * </ul> * * @param block the block {@link Block} @@ -900,22 +858,22 @@ 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.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(), @@ -970,40 +928,32 @@ public class LightingHelper { 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) + 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) + 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) + 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) + 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)); @@ -1052,12 +1002,11 @@ public class LightingHelper { /** * Sets up lighting for the North face and returns the {@link LightingHelper}. * <p> - * This is a consolidated <code>method</code> that sets side shading - * with respect to the following attributes: + * This is a consolidated <code>method</code> that sets side shading with respect to the following attributes: * <p> * <ul> - * <li>{@link RenderBlocks#enableAO}</li> - * <li>{@link RenderBlocks#partialRenderBounds}</li> + * <li>{@link RenderBlocks#enableAO}</li> + * <li>{@link RenderBlocks#partialRenderBounds}</li> * </ul> * * @param block the block {@link Block} @@ -1078,22 +1027,22 @@ 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.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(), @@ -1148,26 +1097,18 @@ public class LightingHelper { 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; + 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 @@ -1230,12 +1171,11 @@ public class LightingHelper { /** * Sets up lighting for the South face and returns the {@link LightingHelper}. * <p> - * This is a consolidated <code>method</code> that sets side shading - * with respect to the following attributes: + * This is a consolidated <code>method</code> that sets side shading with respect to the following attributes: * <p> * <ul> - * <li>{@link RenderBlocks#enableAO}</li> - * <li>{@link RenderBlocks#partialRenderBounds}</li> + * <li>{@link RenderBlocks#enableAO}</li> + * <li>{@link RenderBlocks#partialRenderBounds}</li> * </ul> * * @param block the block {@link Block} @@ -1255,22 +1195,22 @@ 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.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(), @@ -1325,26 +1265,18 @@ public class LightingHelper { 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; + 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 diff --git a/src/main/java/gregtech/api/util/WorldSpawnedEventBuilder.java b/src/main/java/gregtech/api/util/WorldSpawnedEventBuilder.java index 50566f79a3..112fcd93cb 100644 --- a/src/main/java/gregtech/api/util/WorldSpawnedEventBuilder.java +++ b/src/main/java/gregtech/api/util/WorldSpawnedEventBuilder.java @@ -3,6 +3,7 @@ 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; @@ -10,6 +11,7 @@ import net.minecraft.world.World; @SuppressWarnings("unused") public abstract class WorldSpawnedEventBuilder implements Runnable { + private static final String ILLEGAL_STATE_STR1 = "Position, identifier and world must be set"; /* Variables */ @@ -47,6 +49,7 @@ public abstract class WorldSpawnedEventBuilder implements Runnable { /* Interfaces */ private interface IPositionedWorldSpawnedEvent { + Vec3 getPosition(); IPositionedWorldSpawnedEvent setPosition(Vec3 position); @@ -55,18 +58,21 @@ public abstract class WorldSpawnedEventBuilder implements Runnable { } 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); @@ -75,6 +81,7 @@ public abstract class WorldSpawnedEventBuilder implements Runnable { } private interface ISoundWorldSpawnedEvent { + float getPitch(); float getVolume(); @@ -128,6 +135,7 @@ public abstract class WorldSpawnedEventBuilder implements Runnable { private abstract static class PositionedWorldSpawnedEventBuilder extends WorldSpawnedEventBuilder implements IPositionedWorldSpawnedEvent { + private Vec3 position; @Override @@ -150,6 +158,7 @@ public abstract class WorldSpawnedEventBuilder implements Runnable { private abstract static class StringIdentifierPositionedWorldSpawnedEventBuilder extends PositionedWorldSpawnedEventBuilder implements IStringIdentifierWorldSpawnedEvent { + private String identifier; @Override @@ -249,15 +258,14 @@ 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); } } @@ -303,14 +311,13 @@ 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()); } } @@ -362,15 +369,14 @@ 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()); } } @@ -404,12 +410,16 @@ 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); } } public static final class ExplosionEffectEventBuilder extends PositionedEntityWorldSpawnedEventBuilder { + private boolean isFlaming, isSmoking; private float strength; @@ -460,15 +470,14 @@ 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); } } @@ -521,13 +530,12 @@ 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); } } diff --git a/src/main/java/gregtech/api/util/extensions/ArrayExt.java b/src/main/java/gregtech/api/util/extensions/ArrayExt.java index 51486bc036..b6ebb07d38 100644 --- a/src/main/java/gregtech/api/util/extensions/ArrayExt.java +++ b/src/main/java/gregtech/api/util/extensions/ArrayExt.java @@ -3,6 +3,7 @@ package gregtech.api.util.extensions; import java.util.function.IntFunction; public class ArrayExt { + public static int[] of(int... objects) { return objects; } diff --git a/src/main/java/gregtech/api/util/extensions/IteratorExt.java b/src/main/java/gregtech/api/util/extensions/IteratorExt.java index 8662870921..3cbae1c598 100644 --- a/src/main/java/gregtech/api/util/extensions/IteratorExt.java +++ b/src/main/java/gregtech/api/util/extensions/IteratorExt.java @@ -1,9 +1,11 @@ package gregtech.api.util.extensions; -import gregtech.api.objects.iterators.MergedIterator; import java.util.Iterator; +import gregtech.api.objects.iterators.MergedIterator; + public class IteratorExt { + @SafeVarargs public static <T> Iterator<T> merge(Iterator<T>... iterators) { return new MergedIterator<>(iterators); diff --git a/src/main/java/gregtech/api/world/GT_Worldgen.java b/src/main/java/gregtech/api/world/GT_Worldgen.java index 698ed0d1c9..3d2fe466c2 100644 --- a/src/main/java/gregtech/api/world/GT_Worldgen.java +++ b/src/main/java/gregtech/api/world/GT_Worldgen.java @@ -1,13 +1,15 @@ package gregtech.api.world; -import gregtech.api.GregTech_API; 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; +import gregtech.api.GregTech_API; + public abstract class GT_Worldgen { public final String mWorldGenName; @@ -29,29 +31,13 @@ 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) { + 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 } @@ -64,24 +50,18 @@ 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) + * @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) { @@ -89,13 +69,14 @@ public abstract class GT_Worldgen { || (aWorld.provider.getDimensionName().equalsIgnoreCase("Nether")) || (aWorld.provider.getDimensionName().equalsIgnoreCase("The End")) || (aWorld.provider.getDimensionName().equalsIgnoreCase("Twilight Forest")) - || (aWorld.provider.getDimensionName().equalsIgnoreCase("Underdark")))) return false; + || (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 c9d1325529..d3aa6b0e10 100644 --- a/src/main/java/gregtech/api/world/GT_Worldgen_Ore.java +++ b/src/main/java/gregtech/api/world/GT_Worldgen_Ore.java @@ -1,29 +1,22 @@ package gregtech.api.world; -import gregtech.api.GregTech_API; import java.util.ArrayList; import java.util.Collection; + import net.minecraft.block.Block; +import gregtech.api.GregTech_API; + public abstract class GT_Worldgen_Ore extends GT_Worldgen { + public final int mBlockMeta, mAmount, mSize, mMinY, mMaxY, mProbability, mDimensionType; public final Block mBlock; public final Collection<String> mBiomeList; 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, + 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; 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 92c00bc455..5916d04a49 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 @@ -2,24 +2,16 @@ 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; 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, + + 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, @@ -37,28 +29,19 @@ public class GT_Worldgen_Ore_SingleBlock extends GT_Worldgen_Ore { } @Override - 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) { 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), + 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))))) { + || (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 940f923815..a1bd913ace 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 @@ -2,25 +2,17 @@ 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; 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) { + + 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, @@ -37,28 +29,19 @@ public class GT_Worldgen_Ore_SingleBlock_UnderLava extends GT_Worldgen_Ore { } @Override - 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) { 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), + 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))))) { + || (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); |