diff options
Diffstat (limited to 'src/main/java/gtPlusPlus/xmod/gregtech/api')
99 files changed, 4332 insertions, 6861 deletions
diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/api/energy/IC2ElectricItem.java b/src/main/java/gtPlusPlus/xmod/gregtech/api/energy/IC2ElectricItem.java index d4a7f97051..78b5cced08 100644 --- a/src/main/java/gtPlusPlus/xmod/gregtech/api/energy/IC2ElectricItem.java +++ b/src/main/java/gtPlusPlus/xmod/gregtech/api/energy/IC2ElectricItem.java @@ -9,6 +9,7 @@ import net.minecraft.item.ItemStack; * The item should have a maximum damage of 13. */ public interface IC2ElectricItem { + /** * Determine if the item can be used in a machine or as an armor part to supply energy. * @@ -38,8 +39,8 @@ public interface IC2ElectricItem { double getMaxCharge(ItemStack itemStack); /** - * Get the item's tier, lower tiers can't send energy to higher ones. - * Batteries are Tier 1, Energy Crystals are Tier 2, Lapotron Crystals are Tier 3. + * Get the item's tier, lower tiers can't send energy to higher ones. Batteries are Tier 1, Energy Crystals are Tier + * 2, Lapotron Crystals are Tier 3. * * @return Item's tier */ diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/api/energy/IC2ElectricItemManager.java b/src/main/java/gtPlusPlus/xmod/gregtech/api/energy/IC2ElectricItemManager.java index 4ec01ce63c..007d66de66 100644 --- a/src/main/java/gtPlusPlus/xmod/gregtech/api/energy/IC2ElectricItemManager.java +++ b/src/main/java/gtPlusPlus/xmod/gregtech/api/energy/IC2ElectricItemManager.java @@ -6,26 +6,24 @@ import net.minecraft.item.ItemStack; /** * This interface specifies a manager to handle the various tasks for electric items. * - * The default implementation does the following: - * - store and retrieve the charge - * - handle charging, taking amount, tier, transfer limit, canProvideEnergy and simulate into account - * - replace item IDs if appropriate (getChargedItemId() and getEmptyItemId()) - * - update and manage the damage value for the visual charge indicator + * The default implementation does the following: - store and retrieve the charge - handle charging, taking amount, + * tier, transfer limit, canProvideEnergy and simulate into account - replace item IDs if appropriate + * (getChargedItemId() and getEmptyItemId()) - update and manage the damage value for the visual charge indicator * - * @note If you're implementing your own variant (ISpecialElectricItem), you can delegate to the - * default implementations through ElectricItem.rawManager. The default implementation is designed - * to minimize its dependency on its own constraints/structure and delegates most work back to the - * more atomic features in the gateway manager. + * @note If you're implementing your own variant (ISpecialElectricItem), you can delegate to the default implementations + * through ElectricItem.rawManager. The default implementation is designed to minimize its dependency on its own + * constraints/structure and delegates most work back to the more atomic features in the gateway manager. */ public interface IC2ElectricItemManager { + /** * Charge an item with a specified amount of energy. * - * @param itemStack electric item's stack - * @param amount amount of energy to charge in EU - * @param tier tier of the charging device, has to be at least as high as the item to charge + * @param itemStack electric item's stack + * @param amount amount of energy to charge in EU + * @param tier tier of the charging device, has to be at least as high as the item to charge * @param ignoreTransferLimit ignore the transfer limit specified by getTransferLimit() - * @param simulate don't actually change the item, just determine the return value + * @param simulate don't actually change the item, just determine the return value * @return Energy transferred into the electric item */ double charge(ItemStack stack, double amount, int tier, boolean ignoreTransferLimit, boolean simulate); @@ -33,20 +31,15 @@ public interface IC2ElectricItemManager { /** * Discharge an item by a specified amount of energy * - * @param itemStack electric item's stack - * @param amount amount of energy to discharge in EU - * @param tier tier of the discharging device, has to be at least as high as the item to discharge + * @param itemStack electric item's stack + * @param amount amount of energy to discharge in EU + * @param tier tier of the discharging device, has to be at least as high as the item to discharge * @param ignoreTransferLimit ignore the transfer limit specified by getTransferLimit() - * @param externally use the supplied item externally, i.e. to power something else as if it was a battery - * @param simulate don't actually discharge the item, just determine the return value + * @param externally use the supplied item externally, i.e. to power something else as if it was a battery + * @param simulate don't actually discharge the item, just determine the return value * @return Energy retrieved from the electric item */ - double discharge( - ItemStack stack, - double amount, - int tier, - boolean ignoreTransferLimit, - boolean externally, + double discharge(ItemStack stack, double amount, int tier, boolean ignoreTransferLimit, boolean externally, boolean simulate); /** @@ -58,34 +51,34 @@ public interface IC2ElectricItemManager { double getCharge(ItemStack stack); /** - * Determine if the specified electric item has at least a specific amount of EU. - * This is supposed to be used in the item code during operation, for example if you want to implement your own electric item. - * BatPacks are not taken into account. + * Determine if the specified electric item has at least a specific amount of EU. This is supposed to be used in the + * item code during operation, for example if you want to implement your own electric item. BatPacks are not taken + * into account. * * @param itemStack electric item's stack - * @param amount minimum amount of energy required + * @param amount minimum amount of energy required * @return true if there's enough energy */ boolean canUse(ItemStack stack, double amount); /** - * Try to retrieve a specific amount of energy from an Item, and if applicable, a BatPack. - * This is supposed to be used in the item code during operation, for example if you want to implement your own electric item. + * Try to retrieve a specific amount of energy from an Item, and if applicable, a BatPack. This is supposed to be + * used in the item code during operation, for example if you want to implement your own electric item. * * @param itemStack electric item's stack - * @param amount amount of energy to discharge in EU - * @param entity entity holding the item + * @param amount amount of energy to discharge in EU + * @param entity entity holding the item * @return true if the operation succeeded */ boolean use(ItemStack stack, double amount, EntityLivingBase entity); /** - * Charge an item from the BatPack a player is wearing. - * This is supposed to be used in the item code during operation, for example if you want to implement your own electric item. - * use() already contains this functionality. + * Charge an item from the BatPack a player is wearing. This is supposed to be used in the item code during + * operation, for example if you want to implement your own electric item. use() already contains this + * functionality. * * @param itemStack electric item's stack - * @param entity entity holding the item + * @param entity entity holding the item */ void chargeFromArmor(ItemStack stack, EntityLivingBase entity); diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/api/enums/CustomGtTextures.java b/src/main/java/gtPlusPlus/xmod/gregtech/api/enums/CustomGtTextures.java index a31e728e23..74c9d9ee5b 100644 --- a/src/main/java/gtPlusPlus/xmod/gregtech/api/enums/CustomGtTextures.java +++ b/src/main/java/gtPlusPlus/xmod/gregtech/api/enums/CustomGtTextures.java @@ -1,22 +1,25 @@ package gtPlusPlus.xmod.gregtech.api.enums; +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.objects.GT_RenderedTexture; import gtPlusPlus.core.lib.CORE; -import net.minecraft.client.renderer.texture.TextureMap; -import net.minecraft.util.IIcon; -import net.minecraft.util.ResourceLocation; public class CustomGtTextures { + public enum ItemIcons implements IIconContainer, Runnable { + VOID, // The Empty Texture RENDERING_ERROR, PUMP, SKOOKUMCHOOCHER; - public static final ITexture[] ERROR_RENDERING = new ITexture[] {new GT_RenderedTexture(RENDERING_ERROR)}; + public static final ITexture[] ERROR_RENDERING = new ITexture[] { new GT_RenderedTexture(RENDERING_ERROR) }; protected IIcon mIcon, mOverlay; @@ -46,6 +49,7 @@ public class CustomGtTextures { } public static class CustomIcon implements IIconContainer, Runnable { + protected IIcon mIcon, mOverlay; protected String mIconName; diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/api/enums/CustomOrePrefix.java b/src/main/java/gtPlusPlus/xmod/gregtech/api/enums/CustomOrePrefix.java index c0c4e6a5c8..fcbbd019a9 100644 --- a/src/main/java/gtPlusPlus/xmod/gregtech/api/enums/CustomOrePrefix.java +++ b/src/main/java/gtPlusPlus/xmod/gregtech/api/enums/CustomOrePrefix.java @@ -2,28 +2,14 @@ package gtPlusPlus.xmod.gregtech.api.enums; import static gregtech.api.enums.GT_Values.B; -import gregtech.api.enums.OrePrefixes; import net.minecraftforge.common.util.EnumHelper; +import gregtech.api.enums.OrePrefixes; + public enum CustomOrePrefix { - milled( - "Milled Ores", - "Milled ", - " Ore", - true, - true, - false, - false, - false, - false, - false, - false, - false, - true, - B[3], - -1, - 64, - -1); + + milled("Milled Ores", "Milled ", " Ore", true, true, false, false, false, false, false, false, false, true, B[3], + -1, 64, -1); private final String mRegularLocalName; private final String mLocalizedMaterialPre; @@ -45,24 +31,11 @@ public enum CustomOrePrefix { private OrePrefixes mSelfReference; - private CustomOrePrefix( - 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) { + private CustomOrePrefix(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) { mRegularLocalName = aRegularLocalName; mLocalizedMaterialPre = aLocalizedMaterialPre; @@ -88,44 +61,13 @@ public enum CustomOrePrefix { mSelfReference = EnumHelper.addEnum( OrePrefixes.class, this.name(), - new Class[] { - String.class, - String.class, - String.class, - boolean.class, - boolean.class, - boolean.class, - boolean.class, - boolean.class, - boolean.class, - boolean.class, - boolean.class, - boolean.class, - boolean.class, - int.class, - long.class, - int.class, - int.class - }, - new Object[] { - mRegularLocalName, - mLocalizedMaterialPre, - mLocalizedMaterialPost, - mIsUnificatable, - mIsMaterialBased, - mIsSelfReferencing, - mIsContainer, - mDontUnificateActively, - mIsUsedForBlocks, - mAllowNormalRecycling, - mGenerateDefaultItem, - mIsEnchantable, - mIsUsedForOreProcessing, - mMaterialGenerationBits, - mMaterialAmount, - mDefaultStackSize, - mTextureindex - }); + new Class[] { String.class, String.class, String.class, boolean.class, boolean.class, boolean.class, + boolean.class, boolean.class, boolean.class, boolean.class, boolean.class, boolean.class, + boolean.class, int.class, long.class, int.class, int.class }, + new Object[] { mRegularLocalName, mLocalizedMaterialPre, mLocalizedMaterialPost, mIsUnificatable, + mIsMaterialBased, mIsSelfReferencing, mIsContainer, mDontUnificateActively, mIsUsedForBlocks, + mAllowNormalRecycling, mGenerateDefaultItem, mIsEnchantable, mIsUsedForOreProcessing, + mMaterialGenerationBits, mMaterialAmount, mDefaultStackSize, mTextureindex }); return mSelfReference != null; } diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/api/enums/GregtechItemList.java b/src/main/java/gtPlusPlus/xmod/gregtech/api/enums/GregtechItemList.java index 355b1c7477..2506af7af5 100644 --- a/src/main/java/gtPlusPlus/xmod/gregtech/api/enums/GregtechItemList.java +++ b/src/main/java/gtPlusPlus/xmod/gregtech/api/enums/GregtechItemList.java @@ -2,15 +2,16 @@ package gtPlusPlus.xmod.gregtech.api.enums; import static gregtech.api.enums.GT_Values.W; -import gregtech.api.util.GT_ModHandler; -import gregtech.api.util.GT_OreDictUnificator; -import gregtech.api.util.GT_Utility; -import gtPlusPlus.xmod.gregtech.api.interfaces.GregtechItemContainer; import net.minecraft.block.Block; import net.minecraft.init.Blocks; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; +import gregtech.api.util.GT_ModHandler; +import gregtech.api.util.GT_OreDictUnificator; +import gregtech.api.util.GT_Utility; +import gtPlusPlus.xmod.gregtech.api.interfaces.GregtechItemContainer; + /** * Class containing all non-OreDict Items of GregTech. */ @@ -308,7 +309,7 @@ public enum GregtechItemList implements GregtechItemContainer { Casing_Reactor_II, // Multitank - /*Industrial_MultiTank,*/ + /* Industrial_MultiTank, */ Industrial_MultiTankDense, Casing_MultitankExterior, @@ -379,9 +380,9 @@ public enum GregtechItemList implements GregtechItemContainer { Casing_Multi_Use, // Bedrock Mining Platforms - /*BedrockMiner_MKI, */ - /*BedrockMiner_MKII, */ - /*BedrockMiner_MKIII, */ + /* BedrockMiner_MKI, */ + /* BedrockMiner_MKII, */ + /* BedrockMiner_MKIII, */ Casing_BedrockMiner, // Large Packager @@ -413,7 +414,7 @@ public enum GregtechItemList implements GregtechItemContainer { Casing_Naq_Reactor_A, Casing_Naq_Reactor_B, Casing_Naq_Reactor_C, - /*Controller_Naq_Reactor, */ + /* Controller_Naq_Reactor, */ Casing_Containment, // Arc Furnace @@ -757,7 +758,7 @@ public enum GregtechItemList implements GregtechItemContainer { Charger_MAX, // Tiny Fusion - /*Miniature_Fusion, */ + /* Miniature_Fusion, */ // Component Makers Machine_LV_Component_Maker, @@ -932,7 +933,7 @@ public enum GregtechItemList implements GregtechItemContainer { GT_Chisel_HV, // Plasma Tank - /*Plasma_Tank,*/ + /* Plasma_Tank, */ // ---------------------------------------------------------------------------- @@ -968,11 +969,11 @@ public enum GregtechItemList implements GregtechItemContainer { FakeMachineCasingPlate_UV, FakeMachineCasingPlate_MAX, -// ---------------------------------------------------------------------------- + // ---------------------------------------------------------------------------- -; + ; - public static final GregtechItemList[] DYE_ONLY_ITEMS = {Energy_Buffer_1by1_EV, Energy_Buffer_1by1_EV}; + public static final GregtechItemList[] DYE_ONLY_ITEMS = { Energy_Buffer_1by1_EV, Energy_Buffer_1by1_EV }; private ItemStack mStack; private boolean mHasNotBeenSet = true; @@ -1028,8 +1029,8 @@ public enum GregtechItemList implements GregtechItemContainer { if (GT_Utility.isStackInvalid(aStack)) { return false; } - return GT_Utility.areUnificationsEqual( - (ItemStack) aStack, aWildcard ? this.getWildcard(1) : this.get(1), aIgnoreNBT); + return GT_Utility + .areUnificationsEqual((ItemStack) aStack, aWildcard ? this.getWildcard(1) : this.get(1), aIgnoreNBT); } public static Block getBlockFromStack(Object aStack) { @@ -1078,8 +1079,8 @@ public enum GregtechItemList implements GregtechItemContainer { if (GT_Utility.isStackInvalid(this.mStack)) { return GT_Utility.copyAmount(aAmount, aReplacements); } - return GT_Utility.copyAmountAndMetaData( - aAmount, this.mStack.getMaxDamage() - 1, GT_OreDictUnificator.get(this.mStack)); + return GT_Utility + .copyAmountAndMetaData(aAmount, this.mStack.getMaxDamage() - 1, GT_OreDictUnificator.get(this.mStack)); } @Override diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/api/enums/GregtechOreDictNames.java b/src/main/java/gtPlusPlus/xmod/gregtech/api/enums/GregtechOreDictNames.java index b535236575..4bd8831098 100644 --- a/src/main/java/gtPlusPlus/xmod/gregtech/api/enums/GregtechOreDictNames.java +++ b/src/main/java/gtPlusPlus/xmod/gregtech/api/enums/GregtechOreDictNames.java @@ -1,29 +1,18 @@ package gtPlusPlus.xmod.gregtech.api.enums; -/* 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) - * -Circuits - Circuit_Primitive, Circuit_Basic, Circuit_Good, Circuit_Advanced, - Circuit_Data, Circuit_Elite, Circuit_Master, Tool_DataOrb, Circuit_Ultimate, Tool_DataStick, - Circuit_IV, Circuit_LuV, Circuit_ZPM, -Circuit Parts - Circuit_Board_IV, Circuit_Board_LuV, Circuit_Board_ZPM, - Circuit_Parts_Crystal_Chip_IV, Circuit_Parts_Crystal_Chip_LuV, Circuit_Parts_Crystal_Chip_ZPM, - Circuit_Parts_IV, Circuit_Parts_LuV, Circuit_Parts_ZPM, - Circuit_Parts_Wiring_IV, Circuit_Parts_Wiring_LuV, Circuit_Parts_Wiring_ZPM; +/* + * 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) Circuits Circuit_Primitive, Circuit_Basic, Circuit_Good, Circuit_Advanced, + * Circuit_Data, Circuit_Elite, Circuit_Master, Tool_DataOrb, Circuit_Ultimate, Tool_DataStick, Circuit_IV, Circuit_LuV, + * Circuit_ZPM, Circuit Parts Circuit_Board_IV, Circuit_Board_LuV, Circuit_Board_ZPM, Circuit_Parts_Crystal_Chip_IV, + * Circuit_Parts_Crystal_Chip_LuV, Circuit_Parts_Crystal_Chip_ZPM, Circuit_Parts_IV, Circuit_Parts_LuV, + * Circuit_Parts_ZPM, Circuit_Parts_Wiring_IV, Circuit_Parts_Wiring_LuV, Circuit_Parts_Wiring_ZPM; */ public enum GregtechOreDictNames { + buffer_core, itemGregConduit, Circuit_IV, diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/api/enums/GregtechOrePrefixes.java b/src/main/java/gtPlusPlus/xmod/gregtech/api/enums/GregtechOrePrefixes.java index 03d2741fe3..f71e07f0a3 100644 --- a/src/main/java/gtPlusPlus/xmod/gregtech/api/enums/GregtechOrePrefixes.java +++ b/src/main/java/gtPlusPlus/xmod/gregtech/api/enums/GregtechOrePrefixes.java @@ -3,6 +3,13 @@ package gtPlusPlus.xmod.gregtech.api.enums; import static gregtech.api.enums.GT_Values.*; import static gtPlusPlus.core.util.Utils.getTcAspectStack; +import java.util.*; + +import net.minecraft.enchantment.Enchantment; +import net.minecraft.item.ItemStack; +import net.minecraftforge.fluids.Fluid; +import net.minecraftforge.fluids.FluidStack; + import gregtech.api.enums.*; import gregtech.api.enums.TC_Aspects.TC_AspectStack; import gregtech.api.interfaces.*; @@ -13,486 +20,88 @@ import gtPlusPlus.core.lib.CORE; import gtPlusPlus.xmod.gregtech.api.interfaces.internal.Interface_OreRecipeRegistrator; import gtPlusPlus.xmod.gregtech.api.objects.GregtechItemData; import gtPlusPlus.xmod.gregtech.api.objects.GregtechMaterialStack; -import java.util.*; -import net.minecraft.enchantment.Enchantment; -import net.minecraft.item.ItemStack; -import net.minecraftforge.fluids.Fluid; -import net.minecraftforge.fluids.FluidStack; public enum GregtechOrePrefixes { - /* 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) + + /* + * 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) */ - ingotHot( - "Hot Ingots", - "Hot ", - " Ingot", - true, - true, - false, - false, - false, - false, - false, - true, - false, - false, - B[1], - M * 1, - 16, - 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, + ingotHot("Hot Ingots", "Hot ", " Ingot", true, true, false, false, false, false, false, true, false, false, B[1], + M * 1, 16, 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 - 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 - 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 - 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 - 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, - 32, - 61), // A regular Gem worth two Dusts. Introduced by TerraFirmaCraft - gemExquisite( - "Exquisite Gemstones", - "Exquisite ", - "", - true, - true, - true, - false, - false, - false, - true, - true, - false, - false, - B[2], - M * 4, - 16, - 62), // A regular Gem worth four Dusts. Introduced by TerraFirmaCraft - 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 - type2( - "16x Wires", - "16x ", - " Wire", - true, - true, - false, - false, - false, - false, - true, - false, - false, - false, - 0, - M * 8, - 64, + 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 + 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 + 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 + 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, 32, 61), // A regular Gem worth two Dusts. Introduced by TerraFirmaCraft + gemExquisite("Exquisite Gemstones", "Exquisite ", "", true, true, true, false, false, false, true, true, false, + false, B[2], M * 4, 16, 62), // A regular Gem worth four Dusts. Introduced by TerraFirmaCraft + 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 + type2("16x Wires", "16x ", " Wire", true, true, false, false, false, false, true, false, false, false, 0, M * 8, 64, -1), - toolSkookumChoocher( - "Skookum Choocher", - "", - " Skookum Choocher", - true, - true, - false, - false, - false, - false, - true, - true, - false, - false, - B[6], - M * 6, - 16, - 37), // consisting out of 6 Ingots. - toolAngleGrinder( - "Angle Grinder", - "", - "Angle Grinder", - true, - true, - false, - false, - false, - false, - true, - true, - false, - false, - B[6], - M * 6, - 16, - 37), // consisting out of 6 Ingots. - toolElectricSnips( - "Electric Snips", - "", - "Electric Snips", - true, - true, - false, - false, - false, - false, - true, - true, - false, - false, - B[6], - M * 6, - 16, - 37), // consisting out of 6 Ingots. - toolElectricLighter( - "Electric Lighter", - "", - "Electric Lighter", - true, - true, - false, - false, - false, - false, - true, - true, - false, - false, - B[6], - M * 6, - 16, - 37), // consisting out of 6 Ingots. - toolElectricButcherKnife( - "Electric Butcher Knife", - "", - "Electric Butcher Knife", - true, - true, - false, - false, - false, - false, - true, - true, - false, - false, - B[6], - M * 6, - 16, - 37), // consisting out of 6 Ingots. - - 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 + toolSkookumChoocher("Skookum Choocher", "", " Skookum Choocher", true, true, false, false, false, false, true, true, + false, false, B[6], M * 6, 16, 37), // consisting out of 6 Ingots. + toolAngleGrinder("Angle Grinder", "", "Angle Grinder", true, true, false, false, false, false, true, true, false, + false, B[6], M * 6, 16, 37), // consisting out of 6 Ingots. + toolElectricSnips("Electric Snips", "", "Electric Snips", true, true, false, false, false, false, true, true, false, + false, B[6], M * 6, 16, 37), // consisting out of 6 Ingots. + toolElectricLighter("Electric Lighter", "", "Electric Lighter", true, true, false, false, false, false, true, true, + false, false, B[6], M * 6, 16, 37), // consisting out of 6 Ingots. + toolElectricButcherKnife("Electric Butcher Knife", "", "Electric Butcher Knife", true, true, false, false, false, + false, true, true, false, false, B[6], M * 6, 16, 37), // consisting out of 6 Ingots. + + 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 public static volatile int VERSION = 508; @@ -503,28 +112,17 @@ public enum GregtechOrePrefixes { public final ArrayList<ItemStack> mPrefixedItems = new ArrayList<>(); 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<>(); public final Collection<GregtechOrePrefixes> mFamiliarPrefixes = new HashSet<>(); /** - * 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; - private final Collection<Materials> mNotGeneratedItems = new HashSet<>(), - mIgnoredMaterials = new HashSet<>(), + private final Collection<Materials> mNotGeneratedItems = new HashSet<>(), mIgnoredMaterials = new HashSet<>(), mGeneratedItems = new HashSet<>(); private final ArrayList<Interface_OreRecipeRegistrator> mOreProcessing = new ArrayList<>(); private final ArrayList<Interface_OreRecipeRegistrator> mOreProcessingFake = new ArrayList<>(); @@ -539,24 +137,12 @@ public enum GregtechOrePrefixes { */ public int mMaterialGenerationBits = 0; - private GregtechOrePrefixes( - final String aRegularLocalName, - final String aLocalizedMaterialPre, - final String aLocalizedMaterialPost, - final boolean aIsUnificatable, - final boolean aIsMaterialBased, - final boolean aIsSelfReferencing, - final boolean aIsContainer, - final boolean aDontUnificateActively, - final boolean aIsUsedForBlocks, - final boolean aAllowNormalRecycling, - final boolean aGenerateDefaultItem, - final boolean aIsEnchantable, - final boolean aIsUsedForOreProcessing, - final int aMaterialGenerationBits, - final long aMaterialAmount, - final int aDefaultStackSize, - final int aTextureindex) { + private GregtechOrePrefixes(final String aRegularLocalName, final String aLocalizedMaterialPre, + final String aLocalizedMaterialPost, final boolean aIsUnificatable, final boolean aIsMaterialBased, + final boolean aIsSelfReferencing, final boolean aIsContainer, final boolean aDontUnificateActively, + final boolean aIsUsedForBlocks, final boolean aAllowNormalRecycling, final boolean aGenerateDefaultItem, + final boolean aIsEnchantable, final boolean aIsUsedForOreProcessing, final int aMaterialGenerationBits, + final long aMaterialAmount, final int aDefaultStackSize, final int aTextureindex) { this.mIsUnificatable = aIsUnificatable; this.mIsMaterialBased = aIsMaterialBased; this.mIsSelfReferencing = aIsSelfReferencing; @@ -599,19 +185,18 @@ public enum GregtechOrePrefixes { getTcAspectStack(TC_Aspects.FABRICO.name(), 1).addToAspectList(this.mAspects); } else if (this.name().startsWith("tool")) { getTcAspectStack(TC_Aspects.INSTRUMENTUM.name(), 2).addToAspectList(this.mAspects); - } else if (this.name().startsWith("gem") - || this.name().startsWith("crystal") - || this.name().startsWith("lens")) { - getTcAspectStack(TC_Aspects.VITREUS.name(), 1).addToAspectList(this.mAspects); - } else if (this.name().startsWith("crate")) { - getTcAspectStack(TC_Aspects.ITER.name(), 2).addToAspectList(this.mAspects); - } else if (this.name().startsWith("circuit")) { - getTcAspectStack("COGNITIO", 1); - } else if (this.name().startsWith("computer")) { - getTcAspectStack("COGNITIO", 4).addToAspectList(this.mAspects); - } else if (this.name().startsWith("battery")) { - getTcAspectStack(TC_Aspects.ELECTRUM.name(), 1).addToAspectList(this.mAspects); - } + } else + if (this.name().startsWith("gem") || this.name().startsWith("crystal") || this.name().startsWith("lens")) { + getTcAspectStack(TC_Aspects.VITREUS.name(), 1).addToAspectList(this.mAspects); + } else if (this.name().startsWith("crate")) { + getTcAspectStack(TC_Aspects.ITER.name(), 2).addToAspectList(this.mAspects); + } else if (this.name().startsWith("circuit")) { + getTcAspectStack("COGNITIO", 1); + } else if (this.name().startsWith("computer")) { + getTcAspectStack("COGNITIO", 4).addToAspectList(this.mAspects); + } else if (this.name().startsWith("battery")) { + getTcAspectStack(TC_Aspects.ELECTRUM.name(), 1).addToAspectList(this.mAspects); + } } public static GregtechOrePrefixes getOrePrefix(final String aOre) { @@ -695,8 +280,7 @@ public enum GregtechOrePrefixes { } public boolean doGenerateItem(final Materials aMaterial) { - return (aMaterial != null) - && (aMaterial != Materials._NULL) + return (aMaterial != null) && (aMaterial != Materials._NULL) && (((aMaterial.mTypes & this.mMaterialGenerationBits) != 0) || this.mGeneratedItems.contains(aMaterial)) && !this.mNotGeneratedItems.contains(aMaterial) @@ -726,16 +310,21 @@ public enum GregtechOrePrefixes { return this.mOreProcessing.add(aRegistrator); } - public void processOre( - final GT_Materials aMaterial, final String aOreDictName, final String aModName, final ItemStack aStack) { + public void processOre(final GT_Materials aMaterial, final String aOreDictName, final String aModName, + final ItemStack aStack) { if ((aMaterial != null) && ((aMaterial != GT_Materials._NULL) || this.mIsSelfReferencing || !this.mIsMaterialBased) && GT_Utility.isStackValid(aStack)) { for (final Interface_OreRecipeRegistrator tRegistrator : this.mOreProcessing) { if (D2) { GT_Log.ore.println( - "Processing '" + aOreDictName + "' with the Prefix '" + this.name() + "' and the Material '" - + aMaterial.name() + "' at " + GT_Utility.getClassName(tRegistrator)); + "Processing '" + aOreDictName + + "' with the Prefix '" + + this.name() + + "' and the Material '" + + aMaterial.name() + + "' at " + + GT_Utility.getClassName(tRegistrator)); } tRegistrator.registerOre(this, aMaterial, aOreDictName, aModName, GT_Utility.copyAmount(1, aStack)); } @@ -743,16 +332,20 @@ public enum GregtechOrePrefixes { } // TODO - public void processOre( - final Materials aMaterial, final String aOreDictName, final String aModName, final ItemStack aStack) { - if ((aMaterial != null) - && ((aMaterial != Materials._NULL) || this.mIsSelfReferencing || !this.mIsMaterialBased) + public void processOre(final Materials aMaterial, final String aOreDictName, final String aModName, + final ItemStack aStack) { + if ((aMaterial != null) && ((aMaterial != Materials._NULL) || this.mIsSelfReferencing || !this.mIsMaterialBased) && GT_Utility.isStackValid(aStack)) { for (final Interface_OreRecipeRegistrator tRegistrator : this.mOreProcessingFake) { if (D2) { GT_Log.ore.println( - "Processing '" + aOreDictName + "' with the Prefix '" + this.name() + "' and the Material '" - + aMaterial.name() + "' at " + GT_Utility.getClassName(tRegistrator)); + "Processing '" + aOreDictName + + "' with the Prefix '" + + this.name() + + "' and the Material '" + + aMaterial.name() + + "' at " + + GT_Utility.getClassName(tRegistrator)); } tRegistrator.registerOre(this, aMaterial, aOreDictName, aModName, GT_Utility.copyAmount(1, aStack)); } @@ -775,727 +368,166 @@ public enum GregtechOrePrefixes { public enum GT_Materials implements IColorModulationContainer, ISubTagContainer { /** - * This is the Default Material returned in case no Material has been found or a NullPointer has been inserted at a location where it shouldn't happen. + * 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. * <p/> * Mainly for preventing NullPointer Exceptions and providing Default Values. * * Unknown Material Components. Dead End Section. * - * Alkalus Range 730-799 & 970-998 - * (aMetaItemSubID, TextureSet, aToolSpeed, aToolDurability, aToolQuality, aTypes, R, G, B, Alpha, aLocalName, - * aFuelType, aFuelPower, aMeltingPoint, aBlastFurnaceTemp, aBlastFurnaceRequired, aTransparent, aOreValue, aDensityMultiplier, aDensityDivider, aColor - * this(aMetaItemSubID, aIconSet, aToolSpeed, aToolDurability, aToolQuality, true); + * Alkalus Range 730-799 & 970-998 (aMetaItemSubID, TextureSet, aToolSpeed, aToolDurability, aToolQuality, + * aTypes, R, G, B, Alpha, aLocalName, aFuelType, aFuelPower, aMeltingPoint, aBlastFurnaceTemp, + * aBlastFurnaceRequired, aTransparent, aOreValue, aDensityMultiplier, aDensityDivider, aColor + * this(aMetaItemSubID, aIconSet, aToolSpeed, aToolDurability, aToolQuality, true); * */ - _NULL( - -1, - TextureSet.SET_NONE, - 1.0F, - 0, - 0, - 0, - 255, - 255, - 255, - 0, - "NULL", - 0, - 0, - 0, - 0, - false, - false, - 1, - 1, - 1, - Dyes._NULL, - Element._NULL, - Arrays.asList(getTcAspectStack(TC_Aspects.VACUOS.name(), 1))), + _NULL(-1, TextureSet.SET_NONE, 1.0F, 0, 0, 0, 255, 255, 255, 0, "NULL", 0, 0, 0, 0, false, false, 1, 1, 1, + Dyes._NULL, Element._NULL, Arrays.asList(getTcAspectStack(TC_Aspects.VACUOS.name(), 1))), // Lapis(526, TextureSet.SET_LAPIS, 1.0F, 0, 1, 1 | 4 | 8, 70, 70, 220, 0, "Lapis", 0, 0, -1, 0, false, false, // 3, 1, 1, Dyes.dyeBlue, 2, Arrays.asList(new MaterialStack(Materials.Lazurite, 12), new // MaterialStack(Materials.Sodalite, 2), new MaterialStack(Materials.Pyrite, 1), new // MaterialStack(Materials.Calcite, 1)), Arrays.asList(getTcAspectStack(TC_Aspects.SENSUS, 1))), - Pyrotheum( - 20, - TextureSet.SET_FLUID, - 1.0F, - 0, - 1, - 2 | 16 | 32, - 255, - 128, - 0, - 0, - "Pyrotheum", - 0, - 0, - -1, - 0, - false, - false, - 2, - 3, - 1, - Dyes.dyeYellow, - 2, + Pyrotheum(20, TextureSet.SET_FLUID, 1.0F, 0, 1, 2 | 16 | 32, 255, 128, 0, 0, "Pyrotheum", 0, 0, -1, 0, false, + false, 2, 3, 1, Dyes.dyeYellow, 2, Arrays.asList( new MaterialStack(Materials.Coal, 1), new MaterialStack(Materials.Redstone, 1), new MaterialStack(Materials.Blaze, 1), new MaterialStack(Materials.Sulfur, 1)), Arrays.asList(getTcAspectStack("PRAECANTATIO", 2), getTcAspectStack(TC_Aspects.IGNIS, 1))), - Cryotheum( - 21, - TextureSet.SET_FLUID, - 1.0F, - 0, - 1, - 2 | 16 | 32, - 102, - 178, - 255, - 0, - "Cryotheum", - 0, - 0, - -1, - 0, - false, - false, - 2, - 3, - 1, - Dyes.dyeLightBlue, - 2, + Cryotheum(21, TextureSet.SET_FLUID, 1.0F, 0, 1, 2 | 16 | 32, 102, 178, 255, 0, "Cryotheum", 0, 0, -1, 0, false, + false, 2, 3, 1, Dyes.dyeLightBlue, 2, Arrays.asList( new MaterialStack(Materials.Blizz, 1), new MaterialStack(Materials.Redstone, 1), new MaterialStack(Materials.Snow, 1), new MaterialStack(Materials.Niter, 1)), Arrays.asList(getTcAspectStack("PRAECANTATIO", 2), getTcAspectStack(TC_Aspects.GELUM, 1))), - Ender( - 22, - TextureSet.SET_FLUID, - 1.0F, - 0, - 2, - 1, - 255, - 255, - 255, - 0, - "Ender", - 0, - 0, - -1, - 0, - false, - false, - 3, - 1, - 1, + Ender(22, TextureSet.SET_FLUID, 1.0F, 0, 2, 1, 255, 255, 255, 0, "Ender", 0, 0, -1, 0, false, false, 3, 1, 1, Dyes.dyeGreen), /** * Circuitry, Batteries and other Technical things */ - Symbiotic( - -1, - TextureSet.SET_NONE, - 1.0F, - 0, - 0, - 0, - 255, - 255, - 255, - 0, - "IV Tier", - 0, - 0, - -1, - 0, - false, - false, - 1, - 1, - 1, - Dyes.dyeLightGray, + Symbiotic(-1, TextureSet.SET_NONE, 1.0F, 0, 0, 0, 255, 255, 255, 0, "IV Tier", 0, 0, -1, 0, false, false, 1, 1, + 1, Dyes.dyeLightGray, Arrays.asList(getTcAspectStack(TC_Aspects.ELECTRUM, 4), getTcAspectStack(TC_Aspects.MACHINA, 4))), - Neutronic( - -1, - TextureSet.SET_NONE, - 1.0F, - 0, - 0, - 0, - 255, - 255, - 255, - 0, - "LuV Tier", - 0, - 0, - -1, - 0, - false, - false, - 1, - 1, - 1, - Dyes.dyeLightGray, + Neutronic(-1, TextureSet.SET_NONE, 1.0F, 0, 0, 0, 255, 255, 255, 0, "LuV Tier", 0, 0, -1, 0, false, false, 1, 1, + 1, Dyes.dyeLightGray, Arrays.asList(getTcAspectStack(TC_Aspects.ELECTRUM, 6), getTcAspectStack(TC_Aspects.MACHINA, 6))), - Quantum( - -1, - TextureSet.SET_NONE, - 1.0F, - 0, - 0, - 0, - 255, - 255, - 255, - 0, - "ZPM Tier", - 0, - 0, - -1, - 0, - false, - false, - 1, - 1, - 1, - Dyes.dyeLightGray, + Quantum(-1, TextureSet.SET_NONE, 1.0F, 0, 0, 0, 255, 255, 255, 0, "ZPM Tier", 0, 0, -1, 0, false, false, 1, 1, + 1, Dyes.dyeLightGray, Arrays.asList(getTcAspectStack(TC_Aspects.ELECTRUM, 8), getTcAspectStack(TC_Aspects.MACHINA, 8))), - Superconductor( - -1, - TextureSet.SET_NONE, - 1.0F, - 0, - 0, - 0, - 190, - 240, - 190, - 0, - "Superconductor", - 0, - 0, - -1, - 0, - false, - false, - 1, - 1, - 1, - Dyes.dyeGreen, - Arrays.asList(getTcAspectStack(TC_Aspects.ELECTRUM, 8))), - - Staballoy( - 30, - TextureSet.SET_ROUGH, - 10.0F, - 5120, - 4, - 1 | 2 | 16 | 32 | 64 | 128, - 68, - 75, - 66, - 0, - "Staballoy", - 0, - 0, - 1500, - 2800, - true, - false, - 1, - 3, - 1, - Dyes.dyeGreen, - 2, + Superconductor(-1, TextureSet.SET_NONE, 1.0F, 0, 0, 0, 190, 240, 190, 0, "Superconductor", 0, 0, -1, 0, false, + false, 1, 1, 1, Dyes.dyeGreen, Arrays.asList(getTcAspectStack(TC_Aspects.ELECTRUM, 8))), + + Staballoy(30, TextureSet.SET_ROUGH, 10.0F, 5120, 4, 1 | 2 | 16 | 32 | 64 | 128, 68, 75, 66, 0, "Staballoy", 0, + 0, 1500, 2800, true, false, 1, 3, 1, Dyes.dyeGreen, 2, Arrays.asList(new MaterialStack(Materials.Titanium, 1), new MaterialStack(Materials.Uranium, 9)), Arrays.asList(getTcAspectStack(TC_Aspects.METALLUM, 8), getTcAspectStack(TC_Aspects.STRONTIO, 3))), - Bedrockium( - 31, - TextureSet.SET_FINE, - 8.0F, - 8196, - 3, - 1 | 2 | 16 | 32 | 64 | 128, - 39, - 39, - 39, - 0, - "Bedrockium", - 0, - 0, - -1, - 0, - false, - false, - 1, - 5, - 1, - Dyes.dyeLightGray, - 2, + Bedrockium(31, TextureSet.SET_FINE, 8.0F, 8196, 3, 1 | 2 | 16 | 32 | 64 | 128, 39, 39, 39, 0, "Bedrockium", 0, + 0, -1, 0, false, false, 1, 5, 1, Dyes.dyeLightGray, 2, Arrays.asList(new MaterialStack(Materials.Carbon, 63), new MaterialStack(Materials.Carbon, 56)), Arrays.asList(getTcAspectStack(TC_Aspects.VACUOS, 8), getTcAspectStack(TC_Aspects.TUTAMEN, 3))), - BloodSteel( - 32, - TextureSet.SET_METALLIC, - 11.0F, - 768, - 4, - 1 | 2 | 16 | 32 | 64 | 128, - 142, - 28, - 0, - 0, - "Blood Steel", - 0, - 0, - -1, - 0, - false, - false, - 1, - 1, - 1, - Dyes.dyeRed, - 2, + BloodSteel(32, TextureSet.SET_METALLIC, 11.0F, 768, 4, 1 | 2 | 16 | 32 | 64 | 128, 142, 28, 0, 0, "Blood Steel", + 0, 0, -1, 0, false, false, 1, 1, 1, Dyes.dyeRed, 2, Arrays.asList(new MaterialStack(Materials.Steel, 3)), Arrays.asList(getTcAspectStack(TC_Aspects.VICTUS, 8), getTcAspectStack(TC_Aspects.IGNIS, 3))), - Void( - 33, - TextureSet.SET_METALLIC, - 6.0F, - 1280, - 3, - 1 | 2 | 16 | 32 | 64 | 128, - 82, - 17, - 82, - 0, - "Void Metal", - 0, - 0, - -1, - 0, - false, - false, - 3, - 1, - 1, - Dyes.dyeBlack, + Void(33, TextureSet.SET_METALLIC, 6.0F, 1280, 3, 1 | 2 | 16 | 32 | 64 | 128, 82, 17, 82, 0, "Void Metal", 0, 0, + -1, 0, false, false, 3, 1, 1, Dyes.dyeBlack, Arrays.asList(getTcAspectStack("PRAECANTATIO", 5), getTcAspectStack(TC_Aspects.VACUOS, 7))), - ConductiveIron( - 34, - TextureSet.SET_METALLIC, - 5.0F, - 256, - 2, - 1 | 2, - 164, - 109, - 100, - 0, - "Conductive Iron", - 0, - 0, - -1, - 0, - false, - false, - 3, - 1, - 1, - Dyes.dyeRed, - 2, + ConductiveIron(34, TextureSet.SET_METALLIC, 5.0F, 256, 2, 1 | 2, 164, 109, 100, 0, "Conductive Iron", 0, 0, -1, + 0, false, false, 3, 1, 1, Dyes.dyeRed, 2, Arrays.asList(new MaterialStack(Materials.Iron, 6), new MaterialStack(Materials.Redstone, 2)), Arrays.asList(getTcAspectStack(TC_Aspects.POTENTIA, 2), getTcAspectStack(TC_Aspects.METALLUM, 2))), - ElectricalSteel( - 35, - TextureSet.SET_METALLIC, - 7.0F, - 768, - 3, - 1 | 2 | 64 | 128, - 194, - 194, - 194, - 0, - "Electrical Steel", - 0, - 0, - 1811, - 1000, - true, - false, - 3, - 1, - 1, - Dyes.dyeLightGray, - 2, + ElectricalSteel(35, TextureSet.SET_METALLIC, 7.0F, 768, 3, 1 | 2 | 64 | 128, 194, 194, 194, 0, + "Electrical Steel", 0, 0, 1811, 1000, true, false, 3, 1, 1, Dyes.dyeLightGray, 2, Arrays.asList( new MaterialStack(Materials.Iron, 3), new MaterialStack(Materials.Coal, 2), new MaterialStack(Materials.Silicon, 2)), Arrays.asList(getTcAspectStack(TC_Aspects.MAGNETO, 2), getTcAspectStack(TC_Aspects.ELECTRUM, 5))), - EnergeticAlloy( - 36, - TextureSet.SET_SHINY, - 5.0F, - 512, - 3, - 1 | 2 | 64 | 128, - 252, - 152, - 45, - 0, - "Energetic Alloy", - 0, - 0, - -1, - 0, - false, - false, - 3, - 1, - 1, - Dyes.dyeOrange, - 2, + EnergeticAlloy(36, TextureSet.SET_SHINY, 5.0F, 512, 3, 1 | 2 | 64 | 128, 252, 152, 45, 0, "Energetic Alloy", 0, + 0, -1, 0, false, false, 3, 1, 1, Dyes.dyeOrange, 2, Arrays.asList( new MaterialStack(Materials.Gold, 3), new MaterialStack(Materials.Glowstone, 2), new MaterialStack(Materials.Redstone, 2)), Arrays.asList(getTcAspectStack(TC_Aspects.POTENTIA, 4), getTcAspectStack(TC_Aspects.LUX, 3))), - VibrantAlloy( - 37, - TextureSet.SET_SHINY, - 7.0F, - 1280, - 4, - 1 | 2 | 64 | 128, - 204, - 242, - 142, - 0, - "Vibrant Alloy", - 0, - 0, - -1, - 0, - false, - false, - 3, - 1, - 1, - Dyes.dyeLime, - 2, + VibrantAlloy(37, TextureSet.SET_SHINY, 7.0F, 1280, 4, 1 | 2 | 64 | 128, 204, 242, 142, 0, "Vibrant Alloy", 0, 0, + -1, 0, false, false, 3, 1, 1, Dyes.dyeLime, 2, Arrays.asList( - new MaterialStack(Materials.EnergeticAlloy, 1), new MaterialStack(Materials.EnderPearl, 3)), + new MaterialStack(Materials.EnergeticAlloy, 1), + new MaterialStack(Materials.EnderPearl, 3)), Arrays.asList(getTcAspectStack(TC_Aspects.MACHINA, 5), getTcAspectStack(TC_Aspects.TELUM, 4))), - PulsatingIron( - 38, - TextureSet.SET_SHINY, - 5.0F, - 256, - 2, - 1 | 2 | 64 | 128, - 50, - 91, - 21, - 0, - "Pulsating Iron", - 0, - 0, - -1, - 0, - false, - false, - 3, - 1, - 1, - Dyes.dyeGreen, - 2, + PulsatingIron(38, TextureSet.SET_SHINY, 5.0F, 256, 2, 1 | 2 | 64 | 128, 50, 91, 21, 0, "Pulsating Iron", 0, 0, + -1, 0, false, false, 3, 1, 1, Dyes.dyeGreen, 2, Arrays.asList(new MaterialStack(Materials.Iron, 2), new MaterialStack(Materials.EnderPearl, 2)), Arrays.asList(getTcAspectStack(TC_Aspects.ALIENIS, 3), getTcAspectStack(TC_Aspects.METALLUM, 3))), - /* TODO*/ RedstoneAlloy( - 39, - TextureSet.SET_METALLIC, - 1.0F, - 256, - 2, - 1 | 2 | 16 | 32 | 64, - 178, - 34, - 34, - 0, - "Redstone Alloy", - 0, - 0, - -1, - 0, - false, - false, - 3, - 1, - 1, - Dyes.dyeRed, - 2, + /* TODO */ RedstoneAlloy(39, TextureSet.SET_METALLIC, 1.0F, 256, 2, 1 | 2 | 16 | 32 | 64, 178, 34, 34, 0, + "Redstone Alloy", 0, 0, -1, 0, false, false, 3, 1, 1, Dyes.dyeRed, 2, Arrays.asList(new MaterialStack(Materials.Iron, 2), new MaterialStack(Materials.Redstone, 4))), // Needs more Use, I think. - Tantalloy60( - 40, - TextureSet.SET_DULL, - 8.0F, - 5120, - 3, - 1 | 2 | 16 | 32 | 64 | 128, - 68, - 75, - 166, - 0, - "Tantalloy-60", - 0, - 0, - 3035, - 2200, - true, - false, - 1, - 2, - 1, - Dyes.dyeLightBlue, - 2, + Tantalloy60(40, TextureSet.SET_DULL, 8.0F, 5120, 3, 1 | 2 | 16 | 32 | 64 | 128, 68, 75, 166, 0, "Tantalloy-60", + 0, 0, 3035, 2200, true, false, 1, 2, 1, Dyes.dyeLightBlue, 2, Arrays.asList(new MaterialStack(Materials.Tungsten, 1), new MaterialStack(Materials.Tantalum, 9)), Arrays.asList(getTcAspectStack(TC_Aspects.METALLUM, 8), getTcAspectStack(TC_Aspects.STRONTIO, 3))), - Tantalloy61( - 41, - TextureSet.SET_DULL, - 7.0F, - 5120, - 2, - 1 | 2 | 16 | 32 | 64 | 128, - 122, - 135, - 196, - 0, - "Tantalloy-61", - 0, - 0, - 3015, - 2150, - true, - false, - 1, - 2, - 1, - Dyes.dyeLightBlue, - 2, + Tantalloy61(41, TextureSet.SET_DULL, 7.0F, 5120, 2, 1 | 2 | 16 | 32 | 64 | 128, 122, 135, 196, 0, + "Tantalloy-61", 0, 0, 3015, 2150, true, false, 1, 2, 1, Dyes.dyeLightBlue, 2, Arrays.asList( new MaterialStack(Materials.Tungsten, 1), new MaterialStack(Materials.Tantalum, 9), new MaterialStack(Materials.Titanium, 1)), Arrays.asList(getTcAspectStack(TC_Aspects.METALLUM, 8), getTcAspectStack(TC_Aspects.STRONTIO, 3))), - Potin( - 42, - TextureSet.SET_METALLIC, - 7.0F, - 5120, - 2, - 1 | 2 | 16 | 32 | 64 | 128, - 201, - 151, - 129, - 0, - "Potin", - 0, - 0, - 3015, - 2150, - true, - false, - 1, - 2, - 1, - Dyes.dyeLightBlue, - 2, + Potin(42, TextureSet.SET_METALLIC, 7.0F, 5120, 2, 1 | 2 | 16 | 32 | 64 | 128, 201, 151, 129, 0, "Potin", 0, 0, + 3015, 2150, true, false, 1, 2, 1, Dyes.dyeLightBlue, 2, Arrays.asList( new MaterialStack(Materials.Tungsten, 1), new MaterialStack(Materials.Tantalum, 9), new MaterialStack(Materials.Titanium, 1)), Arrays.asList(getTcAspectStack(TC_Aspects.METALLUM, 8), getTcAspectStack(TC_Aspects.STRONTIO, 3))), - Inconel792( - 43, - TextureSet.SET_METALLIC, - 7.0F, - 5120, - 2, - 1 | 2 | 16 | 32 | 64 | 128, - 108, - 240, - 118, - 0, - "Inconel-792", - 0, - 0, - 3015, - 2150, - true, - false, - 1, - 2, - 1, - Dyes.dyeLightBlue, - 2, + Inconel792(43, TextureSet.SET_METALLIC, 7.0F, 5120, 2, 1 | 2 | 16 | 32 | 64 | 128, 108, 240, 118, 0, + "Inconel-792", 0, 0, 3015, 2150, true, false, 1, 2, 1, Dyes.dyeLightBlue, 2, Arrays.asList( new MaterialStack(Materials.Tungsten, 1), new MaterialStack(Materials.Tantalum, 9), new MaterialStack(Materials.Titanium, 1)), Arrays.asList(getTcAspectStack(TC_Aspects.METALLUM, 8), getTcAspectStack(TC_Aspects.STRONTIO, 3))), - Inconel690( - 44, - TextureSet.SET_DULL, - 7.0F, - 5120, - 2, - 1 | 2 | 16 | 32 | 64 | 128, - 118, - 220, - 138, - 0, - "Inconel-690", - 0, - 0, - 3015, - 2150, - true, - false, - 1, - 2, - 1, - Dyes.dyeLightBlue, - 2, + Inconel690(44, TextureSet.SET_DULL, 7.0F, 5120, 2, 1 | 2 | 16 | 32 | 64 | 128, 118, 220, 138, 0, "Inconel-690", + 0, 0, 3015, 2150, true, false, 1, 2, 1, Dyes.dyeLightBlue, 2, Arrays.asList( new MaterialStack(Materials.Tungsten, 1), new MaterialStack(Materials.Tantalum, 9), new MaterialStack(Materials.Titanium, 1)), Arrays.asList(getTcAspectStack(TC_Aspects.METALLUM, 8), getTcAspectStack(TC_Aspects.STRONTIO, 3))), - MaragingSteel300( - 45, - TextureSet.SET_METALLIC, - 7.0F, - 5120, - 2, - 1 | 2 | 16 | 32 | 64 | 128, - 150, - 150, - 150, - 0, - "Maraging Steel 300", - 0, - 0, - 3015, - 2150, - true, - false, - 1, - 2, - 1, - Dyes.dyeLightBlue, - 2, + MaragingSteel300(45, TextureSet.SET_METALLIC, 7.0F, 5120, 2, 1 | 2 | 16 | 32 | 64 | 128, 150, 150, 150, 0, + "Maraging Steel 300", 0, 0, 3015, 2150, true, false, 1, 2, 1, Dyes.dyeLightBlue, 2, Arrays.asList( new MaterialStack(Materials.Tungsten, 1), new MaterialStack(Materials.Tantalum, 9), new MaterialStack(Materials.Titanium, 1)), Arrays.asList(getTcAspectStack(TC_Aspects.METALLUM, 8), getTcAspectStack(TC_Aspects.STRONTIO, 3))), - MaragingSteel350( - 46, - TextureSet.SET_METALLIC, - 7.0F, - 5120, - 2, - 1 | 2 | 16 | 32 | 64 | 128, - 160, - 160, - 160, - 0, - "Maraging Steel 350", - 0, - 0, - 3015, - 2150, - true, - false, - 1, - 2, - 1, - Dyes.dyeLightBlue, - 2, + MaragingSteel350(46, TextureSet.SET_METALLIC, 7.0F, 5120, 2, 1 | 2 | 16 | 32 | 64 | 128, 160, 160, 160, 0, + "Maraging Steel 350", 0, 0, 3015, 2150, true, false, 1, 2, 1, Dyes.dyeLightBlue, 2, Arrays.asList( new MaterialStack(Materials.Tungsten, 1), new MaterialStack(Materials.Tantalum, 9), new MaterialStack(Materials.Titanium, 1)), Arrays.asList(getTcAspectStack(TC_Aspects.METALLUM, 8), getTcAspectStack(TC_Aspects.STRONTIO, 3))), - HastelloyX( - 47, - TextureSet.SET_SHINY, - 7.0F, - 5120, - 2, - 1 | 2 | 16 | 32 | 64 | 128, - 255, - 193, - 37, - 0, - "Hastelloy-X", - 0, - 0, - 3015, - 2150, - true, - false, - 1, - 2, - 1, - Dyes.dyeLightBlue, - 2, + HastelloyX(47, TextureSet.SET_SHINY, 7.0F, 5120, 2, 1 | 2 | 16 | 32 | 64 | 128, 255, 193, 37, 0, "Hastelloy-X", + 0, 0, 3015, 2150, true, false, 1, 2, 1, Dyes.dyeLightBlue, 2, Arrays.asList( new MaterialStack(Materials.Tungsten, 1), new MaterialStack(Materials.Tantalum, 9), new MaterialStack(Materials.Titanium, 1)), Arrays.asList(getTcAspectStack(TC_Aspects.METALLUM, 8), getTcAspectStack(TC_Aspects.STRONTIO, 3))), - TriniumNaquadahCarbonite( - 48, - TextureSet.SET_SHINY, - 7.0F, - 5120, - 2, - 1 | 2 | 16 | 32 | 64 | 128, - 255, - 233, - 0, - 0, - "Trinium Naquadah Carbonite", - 0, - 0, - 3015, - 2150, - true, - false, - 1, - 2, - 1, - Dyes.dyeLightBlue, - 2, + TriniumNaquadahCarbonite(48, TextureSet.SET_SHINY, 7.0F, 5120, 2, 1 | 2 | 16 | 32 | 64 | 128, 255, 233, 0, 0, + "Trinium Naquadah Carbonite", 0, 0, 3015, 2150, true, false, 1, 2, 1, Dyes.dyeLightBlue, 2, Arrays.asList( new MaterialStack(Materials.Tungsten, 1), new MaterialStack(Materials.Tantalum, 9), @@ -1503,289 +535,78 @@ public enum GregtechOrePrefixes { Arrays.asList(getTcAspectStack(TC_Aspects.METALLUM, 8), getTcAspectStack(TC_Aspects.STRONTIO, 3))), // Radioactive Materials - HydrofluoricAcid( - -1, - TextureSet.SET_FLUID, - 1.0F, - 0, - 1, - 2 | 16 | 32, - 200, - 200, - 200, - 0, - "Hydrofluoric Acid", - 0, - 0, - -1, - 0, - false, - false, - 2, - 3, - 1, - Dyes.dyeWhite, - 2, + HydrofluoricAcid(-1, TextureSet.SET_FLUID, 1.0F, 0, 1, 2 | 16 | 32, 200, 200, 200, 0, "Hydrofluoric Acid", 0, 0, + -1, 0, false, false, 2, 3, 1, Dyes.dyeWhite, 2, Arrays.asList( new MaterialStack(Materials.Coal, 1), new MaterialStack(Materials.Redstone, 1), new MaterialStack(Materials.Blaze, 1), new MaterialStack(Materials.Sulfur, 1))), - UraniumHexaFluoride( - -1, - TextureSet.SET_FLUID, - 1.0F, - 0, - 1, - 2 | 16 | 32, - 73, - 220, - 83, - 0, - "Uranium Hexafluoride", - 0, - 0, - -1, - 0, - false, - false, - 2, - 3, - 1, - Dyes.dyeLime, - 2, + UraniumHexaFluoride(-1, TextureSet.SET_FLUID, 1.0F, 0, 1, 2 | 16 | 32, 73, 220, 83, 0, "Uranium Hexafluoride", + 0, 0, -1, 0, false, false, 2, 3, 1, Dyes.dyeLime, 2, Arrays.asList( new MaterialStack(Materials.Coal, 1), new MaterialStack(Materials.Redstone, 1), new MaterialStack(Materials.Blaze, 1), new MaterialStack(Materials.Sulfur, 1))), - UraniumTetraFluoride( - -1, - TextureSet.SET_FLUID, - 1.0F, - 0, - 1, - 2 | 16 | 32, - 73, - 220, - 83, - 0, - "Uranium Tetrafluoride", - 0, - 0, - -1, - 0, - false, - false, - 2, - 3, - 1, - Dyes.dyeLime, - 2, + UraniumTetraFluoride(-1, TextureSet.SET_FLUID, 1.0F, 0, 1, 2 | 16 | 32, 73, 220, 83, 0, "Uranium Tetrafluoride", + 0, 0, -1, 0, false, false, 2, 3, 1, Dyes.dyeLime, 2, Arrays.asList( new MaterialStack(Materials.Coal, 1), new MaterialStack(Materials.Redstone, 1), new MaterialStack(Materials.Blaze, 1), new MaterialStack(Materials.Sulfur, 1))), - ThoriumTetraFluoride( - -1, - TextureSet.SET_FLUID, - 1.0F, - 0, - 1, - 2 | 16 | 32, - 15, - 120, - 15, - 0, - "Thorium Tetrafluoride", - 0, - 0, - -1, - 0, - false, - false, - 2, - 3, - 1, - Dyes.dyeGreen, - 2, + ThoriumTetraFluoride(-1, TextureSet.SET_FLUID, 1.0F, 0, 1, 2 | 16 | 32, 15, 120, 15, 0, "Thorium Tetrafluoride", + 0, 0, -1, 0, false, false, 2, 3, 1, Dyes.dyeGreen, 2, Arrays.asList( new MaterialStack(Materials.Coal, 1), new MaterialStack(Materials.Redstone, 1), new MaterialStack(Materials.Blaze, 1), new MaterialStack(Materials.Sulfur, 1))), - SulfurousAcid( - -1, - TextureSet.SET_FLUID, - 1.0F, - 0, - 1, - 2 | 16 | 32, - 110, - 220, - 30, - 0, - "Sulfurous Acid", - 0, - 0, - -1, - 0, - false, - false, - 2, - 3, - 1, - Dyes.dyeWhite, - 2, + SulfurousAcid(-1, TextureSet.SET_FLUID, 1.0F, 0, 1, 2 | 16 | 32, 110, 220, 30, 0, "Sulfurous Acid", 0, 0, -1, 0, + false, false, 2, 3, 1, Dyes.dyeWhite, 2, Arrays.asList( new MaterialStack(Materials.Coal, 1), new MaterialStack(Materials.Redstone, 1), new MaterialStack(Materials.Blaze, 1), new MaterialStack(Materials.Sulfur, 1))), - SulfurDioxide( - -1, - TextureSet.SET_FLUID, - 1.0F, - 0, - 1, - 2 | 16 | 32, - 150, - 200, - 50, - 0, - "Sulfur Dioxide", - 0, - 0, - -1, - 0, - false, - false, - 2, - 3, - 1, - Dyes.dyeWhite, - 2, + SulfurDioxide(-1, TextureSet.SET_FLUID, 1.0F, 0, 1, 2 | 16 | 32, 150, 200, 50, 0, "Sulfur Dioxide", 0, 0, -1, 0, + false, false, 2, 3, 1, Dyes.dyeWhite, 2, Arrays.asList( new MaterialStack(Materials.Coal, 1), new MaterialStack(Materials.Redstone, 1), new MaterialStack(Materials.Blaze, 1), new MaterialStack(Materials.Sulfur, 1))), - HydrogenChloride( - -1, - TextureSet.SET_FLUID, - 1.0F, - 0, - 1, - 2 | 16 | 32, - 150, - 240, - 90, - 0, - "Hydrogen Chloride", - 0, - 0, - -1, - 0, - false, - false, - 2, - 3, - 1, - Dyes.dyeWhite, - 2, + HydrogenChloride(-1, TextureSet.SET_FLUID, 1.0F, 0, 1, 2 | 16 | 32, 150, 240, 90, 0, "Hydrogen Chloride", 0, 0, + -1, 0, false, false, 2, 3, 1, Dyes.dyeWhite, 2, Arrays.asList( new MaterialStack(Materials.Coal, 1), new MaterialStack(Materials.Redstone, 1), new MaterialStack(Materials.Blaze, 1), new MaterialStack(Materials.Sulfur, 1))), - SulfuricApatite( - -1, - TextureSet.SET_FLUID, - 1.0F, - 0, - 1, - 2 | 16 | 32, - 0, - 105, - 105, - 0, - "Sulfuric Apatite Solution", - 0, - 0, - -1, - 0, - false, - false, - 2, - 3, - 1, - Dyes.dyeWhite, - 2, + SulfuricApatite(-1, TextureSet.SET_FLUID, 1.0F, 0, 1, 2 | 16 | 32, 0, 105, 105, 0, "Sulfuric Apatite Solution", + 0, 0, -1, 0, false, false, 2, 3, 1, Dyes.dyeWhite, 2, Arrays.asList( new MaterialStack(Materials.Coal, 1), new MaterialStack(Materials.Redstone, 1), new MaterialStack(Materials.Blaze, 1), new MaterialStack(Materials.Sulfur, 1))), - SulfuricLithium( - -1, - TextureSet.SET_FLUID, - 1.0F, - 0, - 1, - 2 | 16 | 32, - 0, - 105, - 105, - 0, - "Sulfuric Lithium Solution", - 0, - 0, - -1, - 0, - false, - false, - 2, - 3, - 1, - Dyes.dyeWhite, - 2, + SulfuricLithium(-1, TextureSet.SET_FLUID, 1.0F, 0, 1, 2 | 16 | 32, 0, 105, 105, 0, "Sulfuric Lithium Solution", + 0, 0, -1, 0, false, false, 2, 3, 1, Dyes.dyeWhite, 2, Arrays.asList( new MaterialStack(Materials.Coal, 1), new MaterialStack(Materials.Redstone, 1), new MaterialStack(Materials.Blaze, 1), new MaterialStack(Materials.Sulfur, 1))), - LithiumHydroxide( - -1, - TextureSet.SET_FLUID, - 1.0F, - 0, - 1, - 2 | 16 | 32, - 0, - 105, - 105, - 0, - "Lithium Hydroxide", - 0, - 0, - -1, - 0, - false, - false, - 2, - 3, - 1, - Dyes.dyeWhite, - 2, + LithiumHydroxide(-1, TextureSet.SET_FLUID, 1.0F, 0, 1, 2 | 16 | 32, 0, 105, 105, 0, "Lithium Hydroxide", 0, 0, + -1, 0, false, false, 2, 3, 1, Dyes.dyeWhite, 2, Arrays.asList( new MaterialStack(Materials.Coal, 1), new MaterialStack(Materials.Redstone, 1), new MaterialStack(Materials.Blaze, 1), - new MaterialStack(Materials.Sulfur, 1))), - ; + new MaterialStack(Materials.Sulfur, 1))),; /** * List of all Materials. @@ -1793,25 +614,24 @@ public enum GregtechOrePrefixes { public static final Collection<GT_Materials> VALUES = new HashSet<>(Arrays.asList(values())); static { - /*Primitive.add(SubTag.NO_SMASHING, SubTag.NO_SMELTING); - Basic.add(SubTag.NO_SMASHING, SubTag.NO_SMELTING); - Good.add(SubTag.NO_SMASHING, SubTag.NO_SMELTING); - Advanced.add(SubTag.NO_SMASHING, SubTag.NO_SMELTING); - Data.add(SubTag.NO_SMASHING, SubTag.NO_SMELTING); - Elite.add(SubTag.NO_SMASHING, SubTag.NO_SMELTING); - Master.add(SubTag.NO_SMASHING, SubTag.NO_SMELTING); - Ultimate.add(SubTag.NO_SMASHING, SubTag.NO_SMELTING); - Superconductor.add(SubTag.NO_SMASHING, SubTag.NO_SMELTING); - Infinite.add(SubTag.NO_SMASHING, SubTag.NO_SMELTING);*/ + /* + * Primitive.add(SubTag.NO_SMASHING, SubTag.NO_SMELTING); Basic.add(SubTag.NO_SMASHING, SubTag.NO_SMELTING); + * Good.add(SubTag.NO_SMASHING, SubTag.NO_SMELTING); Advanced.add(SubTag.NO_SMASHING, SubTag.NO_SMELTING); + * Data.add(SubTag.NO_SMASHING, SubTag.NO_SMELTING); Elite.add(SubTag.NO_SMASHING, SubTag.NO_SMELTING); + * Master.add(SubTag.NO_SMASHING, SubTag.NO_SMELTING); Ultimate.add(SubTag.NO_SMASHING, SubTag.NO_SMELTING); + * Superconductor.add(SubTag.NO_SMASHING, SubTag.NO_SMELTING); Infinite.add(SubTag.NO_SMASHING, + * SubTag.NO_SMELTING); + */ Symbiotic.add(SubTag.NO_SMASHING, SubTag.NO_SMELTING); Neutronic.add(SubTag.NO_SMASHING, SubTag.NO_SMELTING); Quantum.add(SubTag.NO_SMASHING, SubTag.NO_SMELTING); } /** - * This Array can be changed dynamically by a Tick Handler in order to get a glowing Effect on all GT Meta Items out of this Material. + * This Array can be changed dynamically by a Tick Handler in order to get a glowing Effect on all GT Meta Items + * out of this Material. */ - 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 final TextureSet mIconSet; public final int mMetaItemSubID; @@ -1829,37 +649,22 @@ public enum GregtechOrePrefixes { public String mChemicalFormula = "?", mDefaultLocalName = "null"; public Dyes mColor = Dyes._NULL; public short mMeltingPoint = 0, mBlastFurnaceTemp = 0; - public int mTypes = 0, - mDurability = 16, - mFuelPower = 0, - mFuelType = 0, - mExtraData = 0, - mOreValue = 0, - mOreMultiplier = 1, - mByProductMultiplier = 1, - mSmeltingMultiplier = 1; + public int mTypes = 0, mDurability = 16, mFuelPower = 0, mFuelType = 0, mExtraData = 0, mOreValue = 0, + mOreMultiplier = 1, mByProductMultiplier = 1, mSmeltingMultiplier = 1; public long mDensity = M; public Element mElement = null; - public GT_Materials mDirectSmelting = this, - mOreReplacement = this, - mMacerateInto = this, - mSmeltInto = this, - mArcSmeltInto = this, - mHandleMaterial = this; + public GT_Materials mDirectSmelting = this, mOreReplacement = this, mMacerateInto = this, mSmeltInto = this, + mArcSmeltInto = this, mHandleMaterial = this; public byte mToolQuality = 0; 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, what means 144 is one Material Unit worth + * This Fluid is used as standard Unit for Molten Materials. 1296 is a Molten Block, what means 144 is one + * Material Unit worth */ public Fluid mStandardMoltenFluid = null; - private GT_Materials( - final int aMetaItemSubID, - final TextureSet aIconSet, - final float aToolSpeed, - final int aToolDurability, - final int aToolQuality, - final boolean aUnificatable) { + private GT_Materials(final int aMetaItemSubID, final TextureSet aIconSet, final float aToolSpeed, + final int aToolDurability, final int aToolQuality, final boolean aUnificatable) { this.mUnificatable = aUnificatable; this.mMaterialInto = this; this.mMetaItemSubID = aMetaItemSubID; @@ -1890,20 +695,17 @@ public enum GregtechOrePrefixes { /** * @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 + * @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 * @param aR, aG, aB Color of the Material 0-255 each. * @param aA transparency of the Material Texture. 0 = fully visible, 255 = Invisible. * @param aLocalName 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 aFuelPower EU generated. Will be multiplied by 1000, also additionally multiplied by 2 for + * Gems. * @param aAmplificationValue Amount of UUM amplifier gotten from this. * @param aUUMEnergy Amount of EU needed to shape the UUM into this Material. * @param aMeltingPoint Used to determine the smelting Costs in Furnii. @@ -1911,28 +713,12 @@ public enum GregtechOrePrefixes { * @param aBlastFurnaceRequired If this requires a Blast Furnace. * @param aColor Vanilla MC Wool Color which comes the closest to this. */ - private GT_Materials( - final int aMetaItemSubID, - final TextureSet aIconSet, - final float aToolSpeed, - final int aToolDurability, - final int aToolQuality, - final int aTypes, - final int aR, - final int aG, - final int aB, - final int aA, - final String aLocalName, - final int aFuelType, - final int aFuelPower, - final int aMeltingPoint, - final int aBlastFurnaceTemp, - final boolean aBlastFurnaceRequired, - final boolean aTransparent, - final int aOreValue, - final int aDensityMultiplier, - final int aDensityDivider, - final Dyes aColor) { + private GT_Materials(final int aMetaItemSubID, final TextureSet aIconSet, final float aToolSpeed, + final int aToolDurability, final int aToolQuality, final int aTypes, final int aR, final int aG, + final int aB, final int aA, final String aLocalName, final int aFuelType, final int aFuelPower, + final int aMeltingPoint, final int aBlastFurnaceTemp, final boolean aBlastFurnaceRequired, + final boolean aTransparent, final int aOreValue, final int aDensityMultiplier, + final int aDensityDivider, final Dyes aColor) { this(aMetaItemSubID, aIconSet, aToolSpeed, aToolDurability, aToolQuality, true); this.mDefaultLocalName = aLocalName; this.mMeltingPoint = (short) aMeltingPoint; @@ -1959,29 +745,12 @@ public enum GregtechOrePrefixes { } } - private GT_Materials( - final int aMetaItemSubID, - final TextureSet aIconSet, - final float aToolSpeed, - final int aToolDurability, - final int aToolQuality, - final int aTypes, - final int aR, - final int aG, - final int aB, - final int aA, - final String aLocalName, - final int aFuelType, - final int aFuelPower, - final int aMeltingPoint, - final int aBlastFurnaceTemp, - final boolean aBlastFurnaceRequired, - final boolean aTransparent, - final int aOreValue, - final int aDensityMultiplier, - final int aDensityDivider, - final Dyes aColor, - final List<TC_AspectStack> aAspects) { + private GT_Materials(final int aMetaItemSubID, final TextureSet aIconSet, final float aToolSpeed, + final int aToolDurability, final int aToolQuality, final int aTypes, final int aR, final int aG, + final int aB, final int aA, final String aLocalName, final int aFuelType, final int aFuelPower, + final int aMeltingPoint, final int aBlastFurnaceTemp, final boolean aBlastFurnaceRequired, + final boolean aTransparent, final int aOreValue, final int aDensityMultiplier, + final int aDensityDivider, final Dyes aColor, final List<TC_AspectStack> aAspects) { this( aMetaItemSubID, aIconSet, @@ -2010,29 +779,12 @@ public enum GregtechOrePrefixes { /** * @param aElement The Element Enum represented by this Material */ - private GT_Materials( - final int aMetaItemSubID, - final TextureSet aIconSet, - final float aToolSpeed, - final int aToolDurability, - final int aToolQuality, - final int aTypes, - final int aR, - final int aG, - final int aB, - final int aA, - final String aLocalName, - final int aFuelType, - final int aFuelPower, - final int aMeltingPoint, - final int aBlastFurnaceTemp, - final boolean aBlastFurnaceRequired, - final boolean aTransparent, - final int aOreValue, - final int aDensityMultiplier, - final int aDensityDivider, - final Dyes aColor, - final Element aElement, + private GT_Materials(final int aMetaItemSubID, final TextureSet aIconSet, final float aToolSpeed, + final int aToolDurability, final int aToolQuality, final int aTypes, final int aR, final int aG, + final int aB, final int aA, final String aLocalName, final int aFuelType, final int aFuelPower, + final int aMeltingPoint, final int aBlastFurnaceTemp, final boolean aBlastFurnaceRequired, + final boolean aTransparent, final int aOreValue, final int aDensityMultiplier, + final int aDensityDivider, final Dyes aColor, final Element aElement, final List<TC_AspectStack> aAspects) { this( aMetaItemSubID, @@ -2067,29 +819,12 @@ public enum GregtechOrePrefixes { this.mAspects.addAll(aAspects); } - private GT_Materials( - final int aMetaItemSubID, - final TextureSet aIconSet, - final float aToolSpeed, - final int aToolDurability, - final int aToolQuality, - final int aTypes, - final int aR, - final int aG, - final int aB, - final int aA, - final String aLocalName, - final int aFuelType, - final int aFuelPower, - final int aMeltingPoint, - final int aBlastFurnaceTemp, - final boolean aBlastFurnaceRequired, - final boolean aTransparent, - final int aOreValue, - final int aDensityMultiplier, - final int aDensityDivider, - final Dyes aColor, - final int aExtraData, + private GT_Materials(final int aMetaItemSubID, final TextureSet aIconSet, final float aToolSpeed, + final int aToolDurability, final int aToolQuality, final int aTypes, final int aR, final int aG, + final int aB, final int aA, final String aLocalName, final int aFuelType, final int aFuelPower, + final int aMeltingPoint, final int aBlastFurnaceTemp, final boolean aBlastFurnaceRequired, + final boolean aTransparent, final int aOreValue, final int aDensityMultiplier, + final int aDensityDivider, final Dyes aColor, final int aExtraData, final List<MaterialStack> aMaterialList) { this( aMetaItemSubID, @@ -2118,31 +853,13 @@ public enum GregtechOrePrefixes { null); } - private GT_Materials( - final int aMetaItemSubID, - final TextureSet aIconSet, - final float aToolSpeed, - final int aToolDurability, - final int aToolQuality, - final int aTypes, - final int aR, - final int aG, - final int aB, - final int aA, - final String aLocalName, - final int aFuelType, - final int aFuelPower, - final int aMeltingPoint, - final int aBlastFurnaceTemp, - final boolean aBlastFurnaceRequired, - final boolean aTransparent, - final int aOreValue, - final int aDensityMultiplier, - final int aDensityDivider, - final Dyes aColor, - final int aExtraData, - final List<MaterialStack> aMaterialList, - final List<TC_AspectStack> aAspects) { + private GT_Materials(final int aMetaItemSubID, final TextureSet aIconSet, final float aToolSpeed, + final int aToolDurability, final int aToolQuality, final int aTypes, final int aR, final int aG, + final int aB, final int aA, final String aLocalName, final int aFuelType, final int aFuelPower, + final int aMeltingPoint, final int aBlastFurnaceTemp, final boolean aBlastFurnaceRequired, + final boolean aTransparent, final int aOreValue, final int aDensityMultiplier, + final int aDensityDivider, final Dyes aColor, final int aExtraData, + final List<MaterialStack> aMaterialList, final List<TC_AspectStack> aAspects) { this( aMetaItemSubID, aIconSet, @@ -2221,17 +938,16 @@ public enum GregtechOrePrefixes { public static void init(final GT_Config aConfiguration) { for (final GT_Materials tMaterial : VALUES) { final String tString = tMaterial.toString().toLowerCase(); - tMaterial.mHeatDamage = (float) - aConfiguration.get(ConfigCategories.Materials.heatdamage, tString, tMaterial.mHeatDamage); + tMaterial.mHeatDamage = (float) aConfiguration + .get(ConfigCategories.Materials.heatdamage, tString, tMaterial.mHeatDamage); if (tMaterial.mBlastFurnaceRequired) { - tMaterial.mBlastFurnaceRequired = - aConfiguration.get(ConfigCategories.Materials.blastfurnacerequirements, tString, true); + tMaterial.mBlastFurnaceRequired = aConfiguration + .get(ConfigCategories.Materials.blastfurnacerequirements, tString, true); } - if (tMaterial.mBlastFurnaceRequired - && aConfiguration.get( - ConfigCategories.Materials.blastinductionsmelter, - tString, - tMaterial.mBlastFurnaceTemp < 1500)) {} + if (tMaterial.mBlastFurnaceRequired && aConfiguration.get( + ConfigCategories.Materials.blastinductionsmelter, + tString, + tMaterial.mBlastFurnaceTemp < 1500)) {} // GT_ModHandler.ThermalExpansion.addSmelterBlastOre(tMaterial); // tMaterial.mHandleMaterial = (tMaterial == Desh ? tMaterial.mHandleMaterial : tMaterial == Diamond || // tMaterial == Thaumium ? Wood : tMaterial.contains(SubTag.BURNING) ? Blaze : @@ -2320,8 +1036,7 @@ public enum GregtechOrePrefixes { } if ((aMultiplier >= (M * 2)) && !this.mMaterialList.isEmpty()) { return (((this.mElement != null) - || ((this.mMaterialList.size() < 2) - && (this.mMaterialList.get(0).mAmount == 1))) + || ((this.mMaterialList.size() < 2) && (this.mMaterialList.get(0).mAmount == 1))) ? this.mChemicalFormula : "(" + this.mChemicalFormula + ")") + aMultiplier; @@ -2414,8 +1129,8 @@ public enum GregtechOrePrefixes { } /** - * 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. */ public GT_Materials addOreByProduct(final GT_Materials aMaterial) { if (!this.mOreByProducts.contains(aMaterial.mMaterialInto)) { @@ -2425,8 +1140,8 @@ public enum GregtechOrePrefixes { } /** - * 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 GT_Materials addOreByProducts(final GT_Materials... aMaterials) { for (final GT_Materials tMaterial : aMaterials) { @@ -2438,8 +1153,7 @@ public enum GregtechOrePrefixes { } /** - * 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 GT_Materials setOreMultiplier(final int aOreMultiplier) { if (aOreMultiplier > 0) { @@ -2459,8 +1173,7 @@ public enum GregtechOrePrefixes { } /** - * 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 GT_Materials setSmeltingMultiplier(final int aSmeltingMultiplier) { if (aSmeltingMultiplier > 0) { @@ -2480,8 +1193,8 @@ public enum GregtechOrePrefixes { } /** - * 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. */ public GT_Materials setOreReplacement(final GT_Materials aMaterial) { if (aMaterial != null) { diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/api/enums/GregtechTextureSet.java b/src/main/java/gtPlusPlus/xmod/gregtech/api/enums/GregtechTextureSet.java index 4874e84b7b..87d85a578e 100644 --- a/src/main/java/gtPlusPlus/xmod/gregtech/api/enums/GregtechTextureSet.java +++ b/src/main/java/gtPlusPlus/xmod/gregtech/api/enums/GregtechTextureSet.java @@ -4,31 +4,20 @@ import gregtech.api.enums.Textures; import gregtech.api.interfaces.IIconContainer; public class GregtechTextureSet { + public static final GregtechTextureSet SET_NONE = new GregtechTextureSet("NONE"), - SET_DULL = new GregtechTextureSet("DULL"), - SET_RUBY = new GregtechTextureSet("RUBY"), - SET_OPAL = new GregtechTextureSet("OPAL"), - SET_LEAF = new GregtechTextureSet("LEAF"), - SET_WOOD = new GregtechTextureSet("WOOD"), - SET_SAND = new GregtechTextureSet("SAND"), - SET_FINE = new GregtechTextureSet("FINE"), - SET_FIERY = new GregtechTextureSet("FIERY"), - SET_FLUID = new GregtechTextureSet("FLUID"), - SET_ROUGH = new GregtechTextureSet("ROUGH"), - SET_PAPER = new GregtechTextureSet("PAPER"), - SET_GLASS = new GregtechTextureSet("GLASS"), - SET_FLINT = new GregtechTextureSet("FLINT"), - SET_LAPIS = new GregtechTextureSet("LAPIS"), - SET_SHINY = new GregtechTextureSet("SHINY"), - SET_SHARDS = new GregtechTextureSet("SHARDS"), - SET_POWDER = new GregtechTextureSet("POWDER"), - SET_QUARTZ = new GregtechTextureSet("QUARTZ"), - SET_EMERALD = new GregtechTextureSet("EMERALD"), - SET_DIAMOND = new GregtechTextureSet("DIAMOND"), - SET_LIGNITE = new GregtechTextureSet("LIGNITE"), - SET_MAGNETIC = new GregtechTextureSet("MAGNETIC"), - SET_METALLIC = new GregtechTextureSet("METALLIC"), - SET_NETHERSTAR = new GregtechTextureSet("NETHERSTAR"), + SET_DULL = new GregtechTextureSet("DULL"), SET_RUBY = new GregtechTextureSet("RUBY"), + SET_OPAL = new GregtechTextureSet("OPAL"), SET_LEAF = new GregtechTextureSet("LEAF"), + SET_WOOD = new GregtechTextureSet("WOOD"), SET_SAND = new GregtechTextureSet("SAND"), + SET_FINE = new GregtechTextureSet("FINE"), SET_FIERY = new GregtechTextureSet("FIERY"), + SET_FLUID = new GregtechTextureSet("FLUID"), SET_ROUGH = new GregtechTextureSet("ROUGH"), + SET_PAPER = new GregtechTextureSet("PAPER"), SET_GLASS = new GregtechTextureSet("GLASS"), + SET_FLINT = new GregtechTextureSet("FLINT"), SET_LAPIS = new GregtechTextureSet("LAPIS"), + SET_SHINY = new GregtechTextureSet("SHINY"), SET_SHARDS = new GregtechTextureSet("SHARDS"), + SET_POWDER = new GregtechTextureSet("POWDER"), SET_QUARTZ = new GregtechTextureSet("QUARTZ"), + SET_EMERALD = new GregtechTextureSet("EMERALD"), SET_DIAMOND = new GregtechTextureSet("DIAMOND"), + SET_LIGNITE = new GregtechTextureSet("LIGNITE"), SET_MAGNETIC = new GregtechTextureSet("MAGNETIC"), + SET_METALLIC = new GregtechTextureSet("METALLIC"), SET_NETHERSTAR = new GregtechTextureSet("NETHERSTAR"), SET_GEM_VERTICAL = new GregtechTextureSet("GEM_VERTICAL"), SET_GEM_HORIZONTAL = new GregtechTextureSet("GEM_HORIZONTAL"); @@ -38,8 +27,8 @@ public class GregtechTextureSet { public GregtechTextureSet(final String aSetName) { this.mSetName = aSetName; this.mTextures[0] = new Textures.ItemIcons.CustomIcon("materialicons/" + this.mSetName + "/turbineBlade"); - this.mTextures[1] = - new Textures.ItemIcons.CustomIcon("materialicons/" + this.mSetName + "/toolHeadSkookumChoocher"); + this.mTextures[1] = new Textures.ItemIcons.CustomIcon( + "materialicons/" + this.mSetName + "/toolHeadSkookumChoocher"); this.mTextures[2] = new Textures.ItemIcons.CustomIcon("materialicons/" + this.mSetName + "/void"); this.mTextures[3] = new Textures.ItemIcons.CustomIcon("materialicons/" + this.mSetName + "/void"); this.mTextures[4] = new Textures.ItemIcons.CustomIcon("materialicons/" + this.mSetName + "/void"); diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/api/enums/GregtechTextures.java b/src/main/java/gtPlusPlus/xmod/gregtech/api/enums/GregtechTextures.java index b4251bd646..dee662ac20 100644 --- a/src/main/java/gtPlusPlus/xmod/gregtech/api/enums/GregtechTextures.java +++ b/src/main/java/gtPlusPlus/xmod/gregtech/api/enums/GregtechTextures.java @@ -1,15 +1,18 @@ package gtPlusPlus.xmod.gregtech.api.enums; +import net.minecraft.client.renderer.texture.TextureMap; +import net.minecraft.util.IIcon; +import net.minecraft.util.ResourceLocation; + import gtPlusPlus.core.lib.CORE; import gtPlusPlus.xmod.gregtech.api.interfaces.internal.Interface_IconContainer; import gtPlusPlus.xmod.gregtech.api.interfaces.internal.Interface_Texture; import gtPlusPlus.xmod.gregtech.common.Meta_GT_Proxy; -import net.minecraft.client.renderer.texture.TextureMap; -import net.minecraft.util.IIcon; -import net.minecraft.util.ResourceLocation; public class GregtechTextures { + public enum BlockIcons implements Interface_IconContainer, Runnable { + VOID, LARGECENTRIFUGE1, @@ -30,31 +33,14 @@ public class GregtechTextures { LARGECENTRIFUGE_ACTIVE7, LARGECENTRIFUGE_ACTIVE8, LARGECENTRIFUGE_ACTIVE9; - public static final Interface_IconContainer[] - CENTRIFUGE = - new Interface_IconContainer[] { - LARGECENTRIFUGE1, - LARGECENTRIFUGE2, - LARGECENTRIFUGE3, - LARGECENTRIFUGE4, - LARGECENTRIFUGE5, - LARGECENTRIFUGE6, - LARGECENTRIFUGE7, - LARGECENTRIFUGE8, - LARGECENTRIFUGE9 - }, - CENTRIFUGE_ACTIVE = - new Interface_IconContainer[] { - LARGECENTRIFUGE_ACTIVE1, - LARGECENTRIFUGE_ACTIVE2, - LARGECENTRIFUGE_ACTIVE3, - LARGECENTRIFUGE_ACTIVE4, - LARGECENTRIFUGE_ACTIVE5, - LARGECENTRIFUGE_ACTIVE6, - LARGECENTRIFUGE_ACTIVE7, - LARGECENTRIFUGE_ACTIVE8, - LARGECENTRIFUGE_ACTIVE9 - }; + + public static final Interface_IconContainer[] CENTRIFUGE = new Interface_IconContainer[] { LARGECENTRIFUGE1, + LARGECENTRIFUGE2, LARGECENTRIFUGE3, LARGECENTRIFUGE4, LARGECENTRIFUGE5, LARGECENTRIFUGE6, + LARGECENTRIFUGE7, LARGECENTRIFUGE8, LARGECENTRIFUGE9 }, + CENTRIFUGE_ACTIVE = new Interface_IconContainer[] { LARGECENTRIFUGE_ACTIVE1, LARGECENTRIFUGE_ACTIVE2, + LARGECENTRIFUGE_ACTIVE3, LARGECENTRIFUGE_ACTIVE4, LARGECENTRIFUGE_ACTIVE5, + LARGECENTRIFUGE_ACTIVE6, LARGECENTRIFUGE_ACTIVE7, LARGECENTRIFUGE_ACTIVE8, + LARGECENTRIFUGE_ACTIVE9 }; public static Interface_Texture[] GT_CASING_BLOCKS = new Interface_Texture[64]; @@ -85,6 +71,7 @@ public class GregtechTextures { } public static class CustomIcon implements Interface_IconContainer, Runnable { + protected IIcon mIcon; protected String mIconName; @@ -116,6 +103,7 @@ public class GregtechTextures { } public enum ItemIcons implements Interface_IconContainer, Runnable { + VOID, // The Empty Texture RENDERING_ERROR, // The Purple/Black Texture SKOOKUMCHOOCHER, // The Skookum Tool Texture @@ -124,29 +112,13 @@ public class GregtechTextures { TURBINE_LARGE, TURBINE_HUGE; - /* public static final Interface_IconContainer[] - DURABILITY_BAR = new Interface_IconContainer[]{ - 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 = new Interface_IconContainer[]{ - 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 Interface_IconContainer[] DURABILITY_BAR = new Interface_IconContainer[]{ + * 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 = new Interface_IconContainer[]{ + * 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 Interface_Texture[] ERROR_RENDERING = new Interface_Texture[]{new // GregtechRenderedTexture(RENDERING_ERROR)}; @@ -179,6 +151,7 @@ public class GregtechTextures { } public static class CustomIcon implements Interface_IconContainer, Runnable { + protected IIcon mIcon, mOverlay; protected String mIconName; diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/api/gui/GTPP_UITextures.java b/src/main/java/gtPlusPlus/xmod/gregtech/api/gui/GTPP_UITextures.java index bd649fea76..26de142e22 100644 --- a/src/main/java/gtPlusPlus/xmod/gregtech/api/gui/GTPP_UITextures.java +++ b/src/main/java/gtPlusPlus/xmod/gregtech/api/gui/GTPP_UITextures.java @@ -2,47 +2,47 @@ package gtPlusPlus.xmod.gregtech.api.gui; import static gtPlusPlus.core.lib.CORE.MODID; -import com.gtnewhorizons.modularui.api.drawable.AdaptableUITexture; -import com.gtnewhorizons.modularui.api.drawable.UITexture; 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 GTPP_UITextures { public static final UITexture OVERLAY_SLOT_COAL = UITexture.fullImage(MODID, "gui/overlay_slot/coal"); - public static final UITexture OVERLAY_SLOT_CANISTER_DARK = - UITexture.fullImage(MODID, "gui/overlay_slot/canister_dark"); + public static final UITexture OVERLAY_SLOT_CANISTER_DARK = UITexture + .fullImage(MODID, "gui/overlay_slot/canister_dark"); - public static final AdaptableUITexture BACKGROUND_YELLOW = - AdaptableUITexture.of(MODID, "gui/background/yellow", 176, 166, 4); + public static final AdaptableUITexture BACKGROUND_YELLOW = AdaptableUITexture + .of(MODID, "gui/background/yellow", 176, 166, 4); - public static final AdaptableUITexture SLOT_ITEM_YELLOW = - AdaptableUITexture.of(MODID, "gui/slot/item_yellow", 18, 18, 1); + public static final AdaptableUITexture SLOT_ITEM_YELLOW = AdaptableUITexture + .of(MODID, "gui/slot/item_yellow", 18, 18, 1); public static final AdaptableUITexture[] SLOT_INVENTORY_MANAGER = new AdaptableUITexture[] { - AdaptableUITexture.of(MODID, "gui/slot/red", 18, 18, 1), - AdaptableUITexture.of(MODID, "gui/slot/green", 18, 18, 1), - AdaptableUITexture.of(MODID, "gui/slot/blue", 18, 18, 1), - AdaptableUITexture.of(MODID, "gui/slot/cyan", 18, 18, 1), - AdaptableUITexture.of(MODID, "gui/slot/magenta", 18, 18, 1), - AdaptableUITexture.of(MODID, "gui/slot/yellow", 18, 18, 1), - }; + AdaptableUITexture.of(MODID, "gui/slot/red", 18, 18, 1), + AdaptableUITexture.of(MODID, "gui/slot/green", 18, 18, 1), + AdaptableUITexture.of(MODID, "gui/slot/blue", 18, 18, 1), + AdaptableUITexture.of(MODID, "gui/slot/cyan", 18, 18, 1), + AdaptableUITexture.of(MODID, "gui/slot/magenta", 18, 18, 1), + AdaptableUITexture.of(MODID, "gui/slot/yellow", 18, 18, 1), }; public static final UITexture BUTTON_STANDARD_BRONZE = UITexture.fullImage(MODID, "gui/button/standard_bronze"); public static final UITexture BUTTON_STANDARD_16x16 = UITexture.fullImage(MODID, "gui/button/standard_16x16"); public static final UITexture OVERLAY_SLOT_WEED_EX = UITexture.fullImage(MODID, "gui/overlay_slot/weed_ex"); public static final UITexture OVERLAY_SLOT_FERTILIZER = UITexture.fullImage(MODID, "gui/overlay_slot/fertilizer"); - public static final UITexture OVERLAY_SLOT_ELECTRIC_TOOL = - UITexture.fullImage(MODID, "gui/overlay_slot/electric_tool"); - public static final UITexture OVERLAY_SLOT_PAGE_PRINTED_BRONZE = - UITexture.fullImage(MODID, "gui/overlay_slot/page_printed_bronze"); + public static final UITexture OVERLAY_SLOT_ELECTRIC_TOOL = UITexture + .fullImage(MODID, "gui/overlay_slot/electric_tool"); + public static final UITexture OVERLAY_SLOT_PAGE_PRINTED_BRONZE = UITexture + .fullImage(MODID, "gui/overlay_slot/page_printed_bronze"); public static final UITexture OVERLAY_SLOT_ARROW = UITexture.fullImage(MODID, "gui/overlay_slot/arrow"); - public static final UITexture OVERLAY_SLOT_ARROW_BRONZE = - UITexture.fullImage(MODID, "gui/overlay_slot/arrow_bronze"); - public static final UITexture OVERLAY_SLOT_CRAFT_OUTPUT = - UITexture.fullImage(MODID, "gui/overlay_slot/craft_output"); - public static final UITexture OVERLAY_SLOT_CRAFT_OUTPUT_BRONZE = - UITexture.fullImage(MODID, "gui/overlay_slot/craft_output_bronze"); + public static final UITexture OVERLAY_SLOT_ARROW_BRONZE = UITexture + .fullImage(MODID, "gui/overlay_slot/arrow_bronze"); + public static final UITexture OVERLAY_SLOT_CRAFT_OUTPUT = UITexture + .fullImage(MODID, "gui/overlay_slot/craft_output"); + public static final UITexture OVERLAY_SLOT_CRAFT_OUTPUT_BRONZE = UITexture + .fullImage(MODID, "gui/overlay_slot/craft_output_bronze"); public static final UITexture OVERLAY_SLOT_PARK = UITexture.fullImage(MODID, "gui/overlay_slot/park"); public static final UITexture OVERLAY_SLOT_PARK_BRONZE = UITexture.fullImage(MODID, "gui/overlay_slot/park_bronze"); public static final UITexture OVERLAY_SLOT_INGOT = UITexture.fullImage(MODID, "gui/overlay_slot/ingot"); @@ -50,90 +50,80 @@ public class GTPP_UITextures { public static final UITexture OVERLAY_SLOT_TURBINE = UITexture.fullImage(MODID, "gui/overlay_slot/turbine"); public static final UITexture OVERLAY_SLOT_CHEST = UITexture.fullImage(MODID, "gui/overlay_slot/chest"); public static final UITexture[] OVERLAY_SLOT_INVENTORY_MANAGER_COLOR = new UITexture[] { - UITexture.fullImage(MODID, "gui/overlay_slot/red"), - UITexture.fullImage(MODID, "gui/overlay_slot/green"), - UITexture.fullImage(MODID, "gui/overlay_slot/blue"), - UITexture.fullImage(MODID, "gui/overlay_slot/cyan"), - UITexture.fullImage(MODID, "gui/overlay_slot/magenta"), - UITexture.fullImage(MODID, "gui/overlay_slot/yellow"), - }; + UITexture.fullImage(MODID, "gui/overlay_slot/red"), UITexture.fullImage(MODID, "gui/overlay_slot/green"), + UITexture.fullImage(MODID, "gui/overlay_slot/blue"), UITexture.fullImage(MODID, "gui/overlay_slot/cyan"), + UITexture.fullImage(MODID, "gui/overlay_slot/magenta"), + UITexture.fullImage(MODID, "gui/overlay_slot/yellow"), }; public static final UITexture[] OVERLAY_SLOT_INVENTORY_MANAGER_ARROW = new UITexture[] { - UITexture.fullImage(MODID, "gui/overlay_slot/arrow_red"), - UITexture.fullImage(MODID, "gui/overlay_slot/arrow_green"), - UITexture.fullImage(MODID, "gui/overlay_slot/arrow_blue"), - UITexture.fullImage(MODID, "gui/overlay_slot/arrow_cyan"), - UITexture.fullImage(MODID, "gui/overlay_slot/arrow_magenta"), - UITexture.fullImage(MODID, "gui/overlay_slot/arrow_yellow"), - }; + UITexture.fullImage(MODID, "gui/overlay_slot/arrow_red"), + UITexture.fullImage(MODID, "gui/overlay_slot/arrow_green"), + UITexture.fullImage(MODID, "gui/overlay_slot/arrow_blue"), + UITexture.fullImage(MODID, "gui/overlay_slot/arrow_cyan"), + UITexture.fullImage(MODID, "gui/overlay_slot/arrow_magenta"), + UITexture.fullImage(MODID, "gui/overlay_slot/arrow_yellow"), }; - public static final UITexture PROGRESSBAR_FLUID_REACTOR = - UITexture.fullImage(MODID, "gui/progressbar/fluid_reactor"); + public static final UITexture PROGRESSBAR_FLUID_REACTOR = UITexture + .fullImage(MODID, "gui/progressbar/fluid_reactor"); public static final UITexture PROGRESSBAR_BOILER_EMPTY = UITexture.fullImage(MODID, "gui/progressbar/boiler_empty"); public static final UITexture PROGRESSBAR_FUEL = UITexture.fullImage(MODID, "gui/progressbar/fuel"); public static final UITexture PROGRESSBAR_ARROW_2 = UITexture.fullImage(MODID, "gui/progressbar/arrow_2"); - public static final UITexture PROGRESSBAR_COMPUTER_ENERGY = - UITexture.fullImage(MODID, "gui/progressbar/computer_energy"); + public static final UITexture PROGRESSBAR_COMPUTER_ENERGY = UITexture + .fullImage(MODID, "gui/progressbar/computer_energy"); public static final UITexture PROGRESSBAR_PSS_ENERGY = UITexture.fullImage(MODID, "gui/progressbar/pss_energy"); - public static final AdaptableUITexture TAB_TITLE_YELLOW = - AdaptableUITexture.of(MODID, "gui/tab/title_yellow", 28, 28, 4); - public static final AdaptableUITexture TAB_TITLE_ANGULAR_YELLOW = - AdaptableUITexture.of(MODID, "gui/tab/title_angular_yellow", 28, 28, 4); - public static final AdaptableUITexture TAB_TITLE_DARK_YELLOW = - AdaptableUITexture.of(MODID, "gui/tab/title_dark_yellow", 28, 28, 4); + public static final AdaptableUITexture TAB_TITLE_YELLOW = AdaptableUITexture + .of(MODID, "gui/tab/title_yellow", 28, 28, 4); + public static final AdaptableUITexture TAB_TITLE_ANGULAR_YELLOW = AdaptableUITexture + .of(MODID, "gui/tab/title_angular_yellow", 28, 28, 4); + public static final AdaptableUITexture TAB_TITLE_DARK_YELLOW = AdaptableUITexture + .of(MODID, "gui/tab/title_dark_yellow", 28, 28, 4); - public static final UITexture OVERLAY_BUTTON_HARVESTER_MODE = - UITexture.fullImage(MODID, "gui/overlay_button/harvester_mode"); + public static final UITexture OVERLAY_BUTTON_HARVESTER_MODE = UITexture + .fullImage(MODID, "gui/overlay_button/harvester_mode"); public static final UITexture OVERLAY_BUTTON_FLUSH = UITexture.fullImage(MODID, "gui/overlay_button/flush"); - public static final UITexture OVERLAY_BUTTON_FLUSH_BRONZE = - UITexture.fullImage(MODID, "gui/overlay_button/flush_bronze"); - public static final UITexture OVERLAY_BUTTON_AUTOMATION = - UITexture.fullImage(MODID, "gui/overlay_button/automation"); + public static final UITexture OVERLAY_BUTTON_FLUSH_BRONZE = UITexture + .fullImage(MODID, "gui/overlay_button/flush_bronze"); + public static final UITexture OVERLAY_BUTTON_AUTOMATION = UITexture + .fullImage(MODID, "gui/overlay_button/automation"); public static final UITexture OVERLAY_BUTTON_LOCK = UITexture.fullImage(MODID, "gui/overlay_button/lock"); - public static final UITexture[] OVERLAY_BUTTON_THROUGHPUT = IntStream.range( - 0, 4) // GT_MetaTileEntity_ElectricAutoWorkbench#MAX_THROUGHPUT + public static final UITexture[] OVERLAY_BUTTON_THROUGHPUT = IntStream.range(0, 4) // GT_MetaTileEntity_ElectricAutoWorkbench#MAX_THROUGHPUT .mapToObj(i -> UITexture.fullImage(MODID, "gui/overlay_button/throughput_" + i)) - .collect(Collectors.toList()) - .toArray(new UITexture[0]); - public static final UITexture[] OVERLAY_BUTTON_MODE = IntStream.range( - 0, 10) // GT_MetaTileEntity_ElectricAutoWorkbench#MAX_MODES - .mapToObj(i -> UITexture.fullImage(MODID, "gui/overlay_button/mode_" + i)) - .collect(Collectors.toList()) + .collect(Collectors.toList()).toArray(new UITexture[0]); + public static final UITexture[] OVERLAY_BUTTON_MODE = IntStream.range(0, 10) // GT_MetaTileEntity_ElectricAutoWorkbench#MAX_MODES + .mapToObj(i -> UITexture.fullImage(MODID, "gui/overlay_button/mode_" + i)).collect(Collectors.toList()) .toArray(new UITexture[0]); - public static final UITexture OVERLAY_BUTTON_COMPUTER_MODE = - UITexture.fullImage(MODID, "gui/overlay_button/computer_mode"); + public static final UITexture OVERLAY_BUTTON_COMPUTER_MODE = UITexture + .fullImage(MODID, "gui/overlay_button/computer_mode"); public static final UITexture OVERLAY_BUTTON_SAVE = UITexture.fullImage(MODID, "gui/overlay_button/save"); public static final UITexture OVERLAY_BUTTON_LOAD = UITexture.fullImage(MODID, "gui/overlay_button/load"); - public static final UITexture OVERLAY_BUTTON_NUCLEAR_SWITCH = - UITexture.fullImage(MODID, "gui/overlay_button/nuclear_switch"); - public static final UITexture OVERLAY_BUTTON_ARROW_LEFT = - UITexture.fullImage(MODID, "gui/overlay_button/arrow_left"); - public static final UITexture OVERLAY_BUTTON_ARROW_RIGHT = - UITexture.fullImage(MODID, "gui/overlay_button/arrow_right"); + public static final UITexture OVERLAY_BUTTON_NUCLEAR_SWITCH = UITexture + .fullImage(MODID, "gui/overlay_button/nuclear_switch"); + public static final UITexture OVERLAY_BUTTON_ARROW_LEFT = UITexture + .fullImage(MODID, "gui/overlay_button/arrow_left"); + public static final UITexture OVERLAY_BUTTON_ARROW_RIGHT = UITexture + .fullImage(MODID, "gui/overlay_button/arrow_right"); public static final UITexture[] OVERLAY_BUTTON_DIRECTION = new UITexture[] { - UITexture.fullImage(MODID, "gui/overlay_button/bottom"), - UITexture.fullImage(MODID, "gui/overlay_button/top"), - UITexture.fullImage(MODID, "gui/overlay_button/north"), - UITexture.fullImage(MODID, "gui/overlay_button/south"), - UITexture.fullImage(MODID, "gui/overlay_button/west"), - UITexture.fullImage(MODID, "gui/overlay_button/east"), - }; + UITexture.fullImage(MODID, "gui/overlay_button/bottom"), + UITexture.fullImage(MODID, "gui/overlay_button/top"), + UITexture.fullImage(MODID, "gui/overlay_button/north"), + UITexture.fullImage(MODID, "gui/overlay_button/south"), + UITexture.fullImage(MODID, "gui/overlay_button/west"), + UITexture.fullImage(MODID, "gui/overlay_button/east"), }; public static final UITexture[] OVERLAY_BUTTON_DIRECTION_GRAY = new UITexture[] { - UITexture.fullImage(MODID, "gui/overlay_button/bottom_gray"), - UITexture.fullImage(MODID, "gui/overlay_button/top_gray"), - UITexture.fullImage(MODID, "gui/overlay_button/north_gray"), - UITexture.fullImage(MODID, "gui/overlay_button/south_gray"), - UITexture.fullImage(MODID, "gui/overlay_button/west_gray"), - UITexture.fullImage(MODID, "gui/overlay_button/east_gray"), - }; + UITexture.fullImage(MODID, "gui/overlay_button/bottom_gray"), + UITexture.fullImage(MODID, "gui/overlay_button/top_gray"), + UITexture.fullImage(MODID, "gui/overlay_button/north_gray"), + UITexture.fullImage(MODID, "gui/overlay_button/south_gray"), + UITexture.fullImage(MODID, "gui/overlay_button/west_gray"), + UITexture.fullImage(MODID, "gui/overlay_button/east_gray"), }; public static final UITexture OVERLAY_BUTTON_TIP_GREEN = UITexture.fullImage(MODID, "gui/overlay_button/tip_green"); public static final UITexture OVERLAY_BUTTON_TIP_RED = UITexture.fullImage(MODID, "gui/overlay_button/tip_red"); - public static final UITexture OVERLAY_BUTTON_ACTIVE_STATE = - UITexture.fullImage(MODID, "gui/overlay_button/active_state"); - public static final UITexture OVERLAY_BUTTON_CHANGE_MODE = - UITexture.fullImage(MODID, "gui/overlay_button/change_mode"); - public static final UITexture OVERLAY_BUTTON_PLUS_MINUS = - UITexture.fullImage(MODID, "gui/overlay_button/plus_minus"); + public static final UITexture OVERLAY_BUTTON_ACTIVE_STATE = UITexture + .fullImage(MODID, "gui/overlay_button/active_state"); + public static final UITexture OVERLAY_BUTTON_CHANGE_MODE = UITexture + .fullImage(MODID, "gui/overlay_button/change_mode"); + public static final UITexture OVERLAY_BUTTON_PLUS_MINUS = UITexture + .fullImage(MODID, "gui/overlay_button/plus_minus"); public static final UITexture PICTURE_WORKBENCH_CIRCLE = UITexture.fullImage(MODID, "gui/picture/workbench_circle"); public static final UITexture PICTURE_ARROW_WHITE_DOWN = UITexture.fullImage(MODID, "gui/picture/arrow_white_down"); @@ -142,10 +132,10 @@ public class GTPP_UITextures { public static final UITexture PICTURE_COMPUTER_GRID = UITexture.fullImage(MODID, "gui/picture/computer_grid"); public static final UITexture PICTURE_ARROWS_SEPARATE = UITexture.fullImage(MODID, "gui/picture/arrows_separate"); public static final UITexture PICTURE_ARROWS_FUSION = UITexture.fullImage(MODID, "gui/picture/arrows_fusion"); - public static final UITexture PICTURE_REDSTONE_CIRCUIT_SCREEN = - UITexture.fullImage(MODID, "gui/picture/redstone_circuit_screen"); - public static final UITexture PICTURE_ELECTRICITY_ERROR = - UITexture.fullImage(MODID, "gui/picture/electricity_error"); + public static final UITexture PICTURE_REDSTONE_CIRCUIT_SCREEN = UITexture + .fullImage(MODID, "gui/picture/redstone_circuit_screen"); + public static final UITexture PICTURE_ELECTRICITY_ERROR = UITexture + .fullImage(MODID, "gui/picture/electricity_error"); public static final UITexture PICTURE_ELECTRICITY_FINE = UITexture.fullImage(MODID, "gui/picture/electricity_fine"); public static final UITexture PICTURE_ENERGY_FRAME = UITexture.fullImage(MODID, "gui/picture/energy_frame"); } diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/api/gui/widget/DataStickSlotWidget.java b/src/main/java/gtPlusPlus/xmod/gregtech/api/gui/widget/DataStickSlotWidget.java index dbda217c27..7070fe5c8d 100644 --- a/src/main/java/gtPlusPlus/xmod/gregtech/api/gui/widget/DataStickSlotWidget.java +++ b/src/main/java/gtPlusPlus/xmod/gregtech/api/gui/widget/DataStickSlotWidget.java @@ -4,6 +4,7 @@ import com.gtnewhorizons.modularui.api.ModularUITextures; import com.gtnewhorizons.modularui.api.forge.IItemHandlerModifiable; import com.gtnewhorizons.modularui.common.internal.wrapper.BaseSlot; import com.gtnewhorizons.modularui.common.widget.SlotWidget; + import gregtech.api.enums.ItemList; import gregtech.api.gui.modularui.GT_UITextures; import gregtech.api.util.GT_Utility; @@ -12,6 +13,7 @@ public class DataStickSlotWidget extends SlotWidget { public DataStickSlotWidget(IItemHandlerModifiable handler, int index) { this(new BaseSlot(handler, index) { + @Override public int getSlotStackLimit() { return 1; @@ -21,8 +23,9 @@ public class DataStickSlotWidget extends SlotWidget { private DataStickSlotWidget(BaseSlot slot) { super(slot); - setFilter(stack -> GT_Utility.areStacksEqual(stack, ItemList.Tool_DataStick.get(1), true) - || GT_Utility.areStacksEqual(stack, ItemList.Tool_DataOrb.get(1), true)); + setFilter( + stack -> GT_Utility.areStacksEqual(stack, ItemList.Tool_DataStick.get(1), true) + || GT_Utility.areStacksEqual(stack, ItemList.Tool_DataOrb.get(1), true)); setBackground(ModularUITextures.ITEM_SLOT, GT_UITextures.OVERLAY_SLOT_DATA_ORB); } } diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/api/gui/widget/ElectricSlotWidget.java b/src/main/java/gtPlusPlus/xmod/gregtech/api/gui/widget/ElectricSlotWidget.java index b575c3c4bd..d555317717 100644 --- a/src/main/java/gtPlusPlus/xmod/gregtech/api/gui/widget/ElectricSlotWidget.java +++ b/src/main/java/gtPlusPlus/xmod/gregtech/api/gui/widget/ElectricSlotWidget.java @@ -1,18 +1,21 @@ package gtPlusPlus.xmod.gregtech.api.gui.widget; +import net.minecraft.item.ItemStack; + import com.gtnewhorizons.modularui.api.forge.IItemHandlerModifiable; import com.gtnewhorizons.modularui.common.internal.wrapper.BaseSlot; import com.gtnewhorizons.modularui.common.widget.SlotWidget; + import gregtech.api.items.GT_MetaGenerated_Tool; import ic2.api.info.Info; import ic2.api.item.ElectricItem; import ic2.api.item.IElectricItem; -import net.minecraft.item.ItemStack; public class ElectricSlotWidget extends SlotWidget { public ElectricSlotWidget(IItemHandlerModifiable handler, int index) { this(new BaseSlot(handler, index, false) { + @Override public int getSlotStackLimit() { return 1; @@ -22,9 +25,9 @@ public class ElectricSlotWidget extends SlotWidget { private ElectricSlotWidget(BaseSlot slot) { super(slot); - setFilter(stack -> (accepts(stack)) - || (stack.getItem() instanceof GT_MetaGenerated_Tool) - || (stack.getItem() instanceof IElectricItem)); + setFilter( + stack -> (accepts(stack)) || (stack.getItem() instanceof GT_MetaGenerated_Tool) + || (stack.getItem() instanceof IElectricItem)); } private boolean accepts(final ItemStack stack) { diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/api/interfaces/GregtechItemContainer.java b/src/main/java/gtPlusPlus/xmod/gregtech/api/interfaces/GregtechItemContainer.java index d49f1e9ed0..9431739c45 100644 --- a/src/main/java/gtPlusPlus/xmod/gregtech/api/interfaces/GregtechItemContainer.java +++ b/src/main/java/gtPlusPlus/xmod/gregtech/api/interfaces/GregtechItemContainer.java @@ -5,6 +5,7 @@ import net.minecraft.item.Item; import net.minecraft.item.ItemStack; public interface GregtechItemContainer { + public Item getItem(); public Block getBlock(); diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/api/interfaces/IHeatEntity.java b/src/main/java/gtPlusPlus/xmod/gregtech/api/interfaces/IHeatEntity.java index cf1f137e0d..00265fc893 100644 --- a/src/main/java/gtPlusPlus/xmod/gregtech/api/interfaces/IHeatEntity.java +++ b/src/main/java/gtPlusPlus/xmod/gregtech/api/interfaces/IHeatEntity.java @@ -1,8 +1,9 @@ package gtPlusPlus.xmod.gregtech.api.interfaces; -import ic2.api.energy.tile.IHeatSource; import net.minecraftforge.common.util.ForgeDirection; +import ic2.api.energy.tile.IHeatSource; + public interface IHeatEntity extends IHeatSource, IHeatSink { public int getHeatBuffer(); diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/api/interfaces/IMetaTileEntityHeatPipe.java b/src/main/java/gtPlusPlus/xmod/gregtech/api/interfaces/IMetaTileEntityHeatPipe.java index 60477c9f31..cb5d875071 100644 --- a/src/main/java/gtPlusPlus/xmod/gregtech/api/interfaces/IMetaTileEntityHeatPipe.java +++ b/src/main/java/gtPlusPlus/xmod/gregtech/api/interfaces/IMetaTileEntityHeatPipe.java @@ -1,9 +1,11 @@ package gtPlusPlus.xmod.gregtech.api.interfaces; -import gregtech.api.interfaces.metatileentity.IMetaTileEntity; import java.util.ArrayList; + import net.minecraft.tileentity.TileEntity; +import gregtech.api.interfaces.metatileentity.IMetaTileEntity; + public interface IMetaTileEntityHeatPipe extends IMetaTileEntity { long transferHeat(byte var1, long var2, long var4, ArrayList<TileEntity> var6); diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/api/interfaces/internal/IGregtech_RecipeAdder.java b/src/main/java/gtPlusPlus/xmod/gregtech/api/interfaces/internal/IGregtech_RecipeAdder.java index 8d1e9d597e..094e151fc8 100644 --- a/src/main/java/gtPlusPlus/xmod/gregtech/api/interfaces/internal/IGregtech_RecipeAdder.java +++ b/src/main/java/gtPlusPlus/xmod/gregtech/api/interfaces/internal/IGregtech_RecipeAdder.java @@ -1,61 +1,45 @@ package gtPlusPlus.xmod.gregtech.api.interfaces.internal; -import gregtech.api.enums.Materials; -import gtPlusPlus.core.material.Material; import net.minecraft.item.ItemStack; import net.minecraftforge.fluids.FluidStack; +import gregtech.api.enums.Materials; +import gtPlusPlus.core.material.Material; + public interface IGregtech_RecipeAdder { + /** * Adds a Coke Oven Recipe * - * @param aInput1 = first Input (not null, and respects StackSize) - * @param aInputb = second Input (can be null, and respects StackSize) - * @param aFluidOutput = Output of the Creosote (not null, and respects StackSize) - * @param aFluidInput = fluid Input (can be null, and respects StackSize) - * @param aOutput = Output of the Coal/coke (can be null, and respects StackSize) - * @param aDuration = Duration (must be >= 0) - * @param aEUt = EU needed for heating up (must be >= 0) + * @param aInput1 = first Input (not null, and respects StackSize) + * @param aInputb = second Input (can be null, and respects StackSize) + * @param aFluidOutput = Output of the Creosote (not null, and respects StackSize) + * @param aFluidInput = fluid Input (can be null, and respects StackSize) + * @param aOutput = Output of the Coal/coke (can be null, and respects StackSize) + * @param aDuration = Duration (must be >= 0) + * @param aEUt = EU needed for heating up (must be >= 0) * @return true if the Recipe got added, otherwise false. */ // public boolean addCokeOvenRecipe(boolean aOptimize, ItemStack[] aInputs, ItemStack[] aOutputs, Object aSpecial, // FluidStack[] aFluidInputs, FluidStack[] aFluidOutputs, int aDuration, int aEUt, int aSpecialValue); - public boolean addCokeOvenRecipe( - ItemStack aInput1, - ItemStack aInput2, - FluidStack aFluidInput, - FluidStack aFluidOutput, - ItemStack aOutput, - int aDuration, - int aEUt); + public boolean addCokeOvenRecipe(ItemStack aInput1, ItemStack aInput2, FluidStack aFluidInput, + FluidStack aFluidOutput, ItemStack aOutput, int aDuration, int aEUt); - public boolean addCokeOvenRecipe( - int aCircuit, - ItemStack aInput2, - FluidStack[] aFluidInputs, - FluidStack[] aFluidOutputs, - ItemStack[] aOutputs, - int aDuration, - int aEUt); + public boolean addCokeOvenRecipe(int aCircuit, ItemStack aInput2, FluidStack[] aFluidInputs, + FluidStack[] aFluidOutputs, ItemStack[] aOutputs, int aDuration, int aEUt); - public boolean addCokeOvenRecipe( - ItemStack aInput1, - ItemStack aInput2, - FluidStack[] aFluidInputs, - FluidStack[] aFluidOutputs, - ItemStack[] aOutputs, - int aDuration, - int aEUt); + public boolean addCokeOvenRecipe(ItemStack aInput1, ItemStack aInput2, FluidStack[] aFluidInputs, + FluidStack[] aFluidOutputs, ItemStack[] aOutputs, int aDuration, int aEUt); public boolean addFuel(ItemStack aInput1, ItemStack aOutput1, int aEU, int aType); /** * Adds a Matter Fabricator Recipe * - * @param aFluidOutput = Output of the UU-Matter (not null, and respects StackSize) - * @param aFluidInput = fluid Input (can be UU_Amp or null, and respects StackSize) - * @param aDuration = Duration (must be >= 0) - * @param aEUt = EU needed for heating up (must be >= 0) + * @param aFluidOutput = Output of the UU-Matter (not null, and respects StackSize) + * @param aFluidInput = fluid Input (can be UU_Amp or null, and respects StackSize) + * @param aDuration = Duration (must be >= 0) + * @param aEUt = EU needed for heating up (must be >= 0) * @return true if the Recipe got added, otherwise false. */ public boolean addMatterFabricatorRecipe(FluidStack aFluidInput, FluidStack aFluidOutput, int aDuration, int aEUt); @@ -63,62 +47,62 @@ public interface IGregtech_RecipeAdder { /** * Adds a Matter Fabricator Recipe * - * @param aItemInput = ItemStack Input, can be null I assume. - * @param aFluidInput = fluid Input (can be UU_Amp or null, and respects StackSize) - * @param aFluidOutput = Output of the UU-Matter (not null, and respects StackSize) - * @param aDuration = Duration (must be >= 0) - * @param aEUt = EU needed for heating up (must be >= 0) + * @param aItemInput = ItemStack Input, can be null I assume. + * @param aFluidInput = fluid Input (can be UU_Amp or null, and respects StackSize) + * @param aFluidOutput = Output of the UU-Matter (not null, and respects StackSize) + * @param aDuration = Duration (must be >= 0) + * @param aEUt = EU needed for heating up (must be >= 0) * @return true if the Recipe got added, otherwise false. */ - public boolean addMatterFabricatorRecipe( - ItemStack aItemInput, FluidStack aFluidInput, FluidStack aFluidOutput, int aDuration, int aEUt); + public boolean addMatterFabricatorRecipe(ItemStack aItemInput, FluidStack aFluidInput, FluidStack aFluidOutput, + int aDuration, int aEUt); /** * Adds a Recipe for the Dehydrator. (up to 9 Outputs) * - * @param aInput = Input itemstack (not null, and respects StackSize) - * @param aFluidInput = fluid Input (can be UU_Amp or null, and respects StackSize) - * @param aOutputItems = Itemstack[] (not null, and respects StackSize) - * @param aDuration = Duration (must be >= 0) - * @param aEUt = EU needed for heating up (must be >= 0) + * @param aInput = Input itemstack (not null, and respects StackSize) + * @param aFluidInput = fluid Input (can be UU_Amp or null, and respects StackSize) + * @param aOutputItems = Itemstack[] (not null, and respects StackSize) + * @param aDuration = Duration (must be >= 0) + * @param aEUt = EU needed for heating up (must be >= 0) * @return true if the Recipe got added, otherwise false. */ // public boolean addDehydratorRecipe(ItemStack aInput, FluidStack aFluid, ItemStack[] aOutputItems, int aDuration, // int aEUt); - /*public boolean addDehydratorRecipe(FluidStack aFluid, FluidStack aOutputFluid, ItemStack[] aOutputItems, int aDuration, int aEUt);*/ - /*public boolean addDehydratorRecipe(ItemStack aItemA, ItemStack aItemB, ItemStack[] aOutputItems, int aDuration, int aEUt); - public boolean addDehydratorRecipe(ItemStack aItemA, ItemStack aItemB, FluidStack aFluid, ItemStack[] aOutputItems, FluidStack aOutputFluid, int aDuration, int aEUt);*/ + /* + * public boolean addDehydratorRecipe(FluidStack aFluid, FluidStack aOutputFluid, ItemStack[] aOutputItems, int + * aDuration, int aEUt); + */ + /* + * public boolean addDehydratorRecipe(ItemStack aItemA, ItemStack aItemB, ItemStack[] aOutputItems, int aDuration, + * int aEUt); public boolean addDehydratorRecipe(ItemStack aItemA, ItemStack aItemB, FluidStack aFluid, ItemStack[] + * aOutputItems, FluidStack aOutputFluid, int aDuration, int aEUt); + */ /** * Adds a Recipe for the Dehydrator. (up to 9 Outputs) * - * @param aInput = ItemStack[] (not null, and respects StackSize) - * @param aFluidInput = fluid Input (can be UU_Amp or null, and respects StackSize) - * @param aFluidOutput = Output of the UU-Matter (not null, and respects StackSize) - * @param aOutputItems = ItemStack[] (not null, and respects StackSize) - * @param aChances = Output Change (can be == 0) - * @param aDuration = Duration (must be >= 0) - * @param aEUt = EU needed for heating up (must be >= 0) + * @param aInput = ItemStack[] (not null, and respects StackSize) + * @param aFluidInput = fluid Input (can be UU_Amp or null, and respects StackSize) + * @param aFluidOutput = Output of the UU-Matter (not null, and respects StackSize) + * @param aOutputItems = ItemStack[] (not null, and respects StackSize) + * @param aChances = Output Change (can be == 0) + * @param aDuration = Duration (must be >= 0) + * @param aEUt = EU needed for heating up (must be >= 0) * @return true if the Recipe got added, otherwise false. */ - public boolean addDehydratorRecipe( - ItemStack[] aInput, - FluidStack aFluidInput, - FluidStack aFluidOutput, - ItemStack[] aOutputItems, - int[] aChances, - int aDuration, - int aEUt); + public boolean addDehydratorRecipe(ItemStack[] aInput, FluidStack aFluidInput, FluidStack aFluidOutput, + ItemStack[] aOutputItems, int[] aChances, int aDuration, int aEUt); /** * Adds a Recipe for the Alloy Blast Smelter. (up to 9 Inputs) * - * @param aInput = ItemStack[] (not null, and respects StackSize) - * @param aFluidOutput = Output of the Molten Metal (not null, and respects StackSize) - * @param aChances = Output Chance (can be == 0) - * @param aDuration = Duration (must be >= 0) - * @param aEUt = EU per tick needed for heating up (must be >= 0) + * @param aInput = ItemStack[] (not null, and respects StackSize) + * @param aFluidOutput = Output of the Molten Metal (not null, and respects StackSize) + * @param aChances = Output Chance (can be == 0) + * @param aDuration = Duration (must be >= 0) + * @param aEUt = EU per tick needed for heating up (must be >= 0) * @return true if the Recipe got added, otherwise false. */ public boolean addBlastSmelterRecipe(ItemStack[] aInput, FluidStack aOutput, int aChance, int aDuration, int aEUt); @@ -126,183 +110,126 @@ public interface IGregtech_RecipeAdder { /** * Adds a Recipe for the Alloy Blast Smelter. (up to 9 Inputs) * - * @param aInput = ItemStack[] (not null, and respects StackSize) - * @param aFluidInput = Input of a fluid (can be null, and respects StackSize) - * @param aFluidOutput = Output of the Molten Metal (not null, and respects StackSize) - * @param aChances = Output Chance (can be == 0) - * @param aDuration = Duration (must be >= 0) - * @param aEUt = EU per tick needed for heating up (must be >= 0) + * @param aInput = ItemStack[] (not null, and respects StackSize) + * @param aFluidInput = Input of a fluid (can be null, and respects StackSize) + * @param aFluidOutput = Output of the Molten Metal (not null, and respects StackSize) + * @param aChances = Output Chance (can be == 0) + * @param aDuration = Duration (must be >= 0) + * @param aEUt = EU per tick needed for heating up (must be >= 0) * @return true if the Recipe got added, otherwise false. */ - public boolean addBlastSmelterRecipe( - ItemStack[] aInput, FluidStack aInputFluid, FluidStack aOutput, int aChance, int aDuration, int aEUt); + public boolean addBlastSmelterRecipe(ItemStack[] aInput, FluidStack aInputFluid, FluidStack aOutput, int aChance, + int aDuration, int aEUt); /** * Adds a Recipe for the Alloy Blast Smelter. (up to 9 Inputs, More than 1 Fluids) * - * @param aInput = ItemStack[] (not null, and respects StackSize) - * @param aFluidInput = FluidStack[] (can be null, and respects StackSize) - * @param aFluidOutput = Output of the Molten Metal (not null, and respects StackSize) - * @param aChances = Output Chance (can be == 0) - * @param aDuration = Duration (must be >= 0) - * @param aEUt = EU per tick needed for heating up (must be >= 0) + * @param aInput = ItemStack[] (not null, and respects StackSize) + * @param aFluidInput = FluidStack[] (can be null, and respects StackSize) + * @param aFluidOutput = Output of the Molten Metal (not null, and respects StackSize) + * @param aChances = Output Chance (can be == 0) + * @param aDuration = Duration (must be >= 0) + * @param aEUt = EU per tick needed for heating up (must be >= 0) * @return true if the Recipe got added, otherwise false. */ - public boolean addBlastSmelterRecipe( - ItemStack[] aInput, FluidStack[] aInputFluid, FluidStack aOutput, int aChance, int aDuration, int aEUt); + public boolean addBlastSmelterRecipe(ItemStack[] aInput, FluidStack[] aInputFluid, FluidStack aOutput, int aChance, + int aDuration, int aEUt); /** * Adds a Recipe for the Alloy Blast Smelter. (up to 9 Inputs) * - * @param aInput = ItemStack[] (not null, and respects StackSize) - * @param aFluidInput = Input of a fluid (can be null, and respects StackSize) - * @param aFluidOutput = Output of the Molten Metal (not null, and respects StackSize) - * @param aOutputStack = Item Output (Can be null) - * @param aChances = Output Chance (can be == 0) - * @param aDuration = Duration (must be >= 0) - * @param aEUt = EU per tick needed for heating up (must be >= 0) + * @param aInput = ItemStack[] (not null, and respects StackSize) + * @param aFluidInput = Input of a fluid (can be null, and respects StackSize) + * @param aFluidOutput = Output of the Molten Metal (not null, and respects StackSize) + * @param aOutputStack = Item Output (Can be null) + * @param aChances = Output Chance (can be == 0) + * @param aDuration = Duration (must be >= 0) + * @param aEUt = EU per tick needed for heating up (must be >= 0) * @return true if the Recipe got added, otherwise false. */ - public boolean addBlastSmelterRecipe( - ItemStack[] aInput, - FluidStack aInputFluid, - FluidStack aOutput, - ItemStack[] aOutputStack, - int[] aChance, - int aDuration, - int aEUt); + public boolean addBlastSmelterRecipe(ItemStack[] aInput, FluidStack aInputFluid, FluidStack aOutput, + ItemStack[] aOutputStack, int[] aChance, int aDuration, int aEUt); - public boolean addBlastSmelterRecipe( - ItemStack[] aInput, - FluidStack aInputFluid, - FluidStack aOutput, - int aChance, - int aDuration, - int aEUt, - int aSpecialValue); - - public boolean addBlastSmelterRecipe( - ItemStack[] aInput, - FluidStack aInputFluid, - FluidStack aOutput, - ItemStack[] aOutputStack, - int[] aChance, - int aDuration, - int aEUt, - int aSpecialValue, + public boolean addBlastSmelterRecipe(ItemStack[] aInput, FluidStack aInputFluid, FluidStack aOutput, int aChance, + int aDuration, int aEUt, int aSpecialValue); + + public boolean addBlastSmelterRecipe(ItemStack[] aInput, FluidStack aInputFluid, FluidStack aOutput, + ItemStack[] aOutputStack, int[] aChance, int aDuration, int aEUt, int aSpecialValue, boolean aOptimizeRecipe); /** * Adds a Recipe for the Alloy Blast Smelter. (up to 9 Inputs, More than 1 fluids) * - * @param aInput = ItemStack[] (not null, and respects StackSize) - * @param aFluidInput = FluidStack[] (can be null, and respects StackSize) - * @param aFluidOutput = Output of the Molten Metal (not null, and respects StackSize) - * @param aOutputStack = Item Output (Can be null) - * @param aChances = Output Chance (can be == 0) - * @param aDuration = Duration (must be >= 0) - * @param aEUt = EU per tick needed for heating up (must be >= 0) + * @param aInput = ItemStack[] (not null, and respects StackSize) + * @param aFluidInput = FluidStack[] (can be null, and respects StackSize) + * @param aFluidOutput = Output of the Molten Metal (not null, and respects StackSize) + * @param aOutputStack = Item Output (Can be null) + * @param aChances = Output Chance (can be == 0) + * @param aDuration = Duration (must be >= 0) + * @param aEUt = EU per tick needed for heating up (must be >= 0) * @return true if the Recipe got added, otherwise false. */ - public boolean addBlastSmelterRecipe( - ItemStack[] aInput, - FluidStack[] aInputFluid, - FluidStack aOutput, - ItemStack[] aOutputStack, - int[] aChance, - int aDuration, - int aEUt); + public boolean addBlastSmelterRecipe(ItemStack[] aInput, FluidStack[] aInputFluid, FluidStack aOutput, + ItemStack[] aOutputStack, int[] aChance, int aDuration, int aEUt); - public boolean addBlastSmelterRecipe( - ItemStack[] aInput, - FluidStack[] aInputFluid, - FluidStack aOutput, - int aChance, - int aDuration, - int aEUt, - int aSpecialValue); - - public boolean addBlastSmelterRecipe( - ItemStack[] aInput, - FluidStack[] aInputFluid, - FluidStack aOutput, - ItemStack[] aOutputStack, - int[] aChance, - int aDuration, - int aEUt, - int aSpecialValue, + public boolean addBlastSmelterRecipe(ItemStack[] aInput, FluidStack[] aInputFluid, FluidStack aOutput, int aChance, + int aDuration, int aEUt, int aSpecialValue); + + public boolean addBlastSmelterRecipe(ItemStack[] aInput, FluidStack[] aInputFluid, FluidStack aOutput, + ItemStack[] aOutputStack, int[] aChance, int aDuration, int aEUt, int aSpecialValue, boolean aOptimizeRecipe); /** * Adds a Recipe for the LFTRr. (up to 9 Inputs) * - * @param aInput = ItemStack[] (not null, and respects StackSize) + * @param aInput = ItemStack[] (not null, and respects StackSize) * @param aFluidInput = Input of a fluid (can be null, and respects StackSize) - * @param aFluidOutput = Output of the Molten Salts (not null, and respects StackSize) + * @param aFluidOutput = Output of the Molten Salts (not null, and respects StackSize) * @param aOutputStack = Item Output (Can be null) - * @param aChances = Output Chance (can be == 0) - * @param aDuration = Duration (must be >= 0) - * @param aEUt = EU per tick needed for heating up (must be >= 0) - * @param aSpecialValue = Power produced in EU/t per dynamo + * @param aChances = Output Chance (can be == 0) + * @param aDuration = Duration (must be >= 0) + * @param aEUt = EU per tick needed for heating up (must be >= 0) + * @param aSpecialValue = Power produced in EU/t per dynamo * @return true if the Recipe got added, otherwise false. */ - public boolean addBlastSmelterRecipe( - ItemStack[] aInput, - FluidStack aInputFluid, - FluidStack aOutput, - ItemStack[] aOutputStack, - int[] aChance, - int aDuration, - int aEUt, - int aSpecialValue); + public boolean addBlastSmelterRecipe(ItemStack[] aInput, FluidStack aInputFluid, FluidStack aOutput, + ItemStack[] aOutputStack, int[] aChance, int aDuration, int aEUt, int aSpecialValue); /** * Adds a Recipe for the Quantum Force Smelter (up to 9 Inputs) * * **/ - public boolean addQuantumTransformerRecipe( - ItemStack[] aInput, - FluidStack[] aFluidInput, - FluidStack[] aFluidOutput, - ItemStack[] aOutputStack, - int[] aChances, - int aDuration, - int aEUt, - int aSpecialValue); - - /** Adds a Recipe for the LFTRr. (up to 9 Inputs, More than 1 fluids) + public boolean addQuantumTransformerRecipe(ItemStack[] aInput, FluidStack[] aFluidInput, FluidStack[] aFluidOutput, + ItemStack[] aOutputStack, int[] aChances, int aDuration, int aEUt, int aSpecialValue); + + /** + * Adds a Recipe for the LFTRr. (up to 9 Inputs, More than 1 fluids) * - * @param aInput = ItemStack[] (not null, and respects StackSize) + * @param aInput = ItemStack[] (not null, and respects StackSize) * @param aFluidInput = FluidStack[] (can be null, and respects StackSize) - * @param aFluidOutput = Output of the Molten Salts (not null, and respects StackSize) + * @param aFluidOutput = Output of the Molten Salts (not null, and respects StackSize) * @param aOutputStack = Item Output (Can be null) - * @param aChances = Output Chance (can be == 0) - * @param aDuration = Duration (must be >= 0) - * @param aEUt = EU per tick needed for heating up (must be >= 0) - * @param aSpecialValue = Power produced in EU/t per dynamo + * @param aChances = Output Chance (can be == 0) + * @param aDuration = Duration (must be >= 0) + * @param aEUt = EU per tick needed for heating up (must be >= 0) + * @param aSpecialValue = Power produced in EU/t per dynamo * @return true if the Recipe got added, otherwise false. */ - public boolean addBlastSmelterRecipe( - ItemStack[] aInput, - FluidStack[] aInputFluid, - FluidStack aOutput, - ItemStack[] aOutputStack, - int[] aChance, - int aDuration, - int aEUt, - int aSpecialValue); + public boolean addBlastSmelterRecipe(ItemStack[] aInput, FluidStack[] aInputFluid, FluidStack aOutput, + ItemStack[] aOutputStack, int[] aChance, int aDuration, int aEUt, int aSpecialValue); public boolean addLFTRRecipe(ItemStack aInput1, ItemStack aInput2, ItemStack aOutput1, int aDuration, int aEUt); - public boolean addLFTRRecipe( - ItemStack aInput1, FluidStack aInput2, ItemStack aOutput1, FluidStack aOutput2, int aDuration, int aEUt); + public boolean addLFTRRecipe(ItemStack aInput1, FluidStack aInput2, ItemStack aOutput1, FluidStack aOutput2, + int aDuration, int aEUt); public boolean addLFTRRecipe(FluidStack aInput1, FluidStack aInput2, FluidStack aOutput1, int aDuration, int aEUt); /** * Adds a custom Semifluid fuel for the GT++ SemiFluid Generators. - * @param aFuelItem - A Fluidstack to be consumed. + * + * @param aFuelItem - A Fluidstack to be consumed. * @param aFuelValue - Fuel value in thousands (1 = 1000) * @return - Was the Fuel added? */ @@ -310,135 +237,62 @@ public interface IGregtech_RecipeAdder { /** * Adds a custom Semifluid fuel for the GT++ SemiFluid Generators. - * @param aFuelItem - A Fluidstack to be consumed. + * + * @param aFuelItem - A Fluidstack to be consumed. * @param aFuelValue - Fuel value in thousands (1 = 1000) * @return - Was the Fuel added? */ public boolean addSemifluidFuel(ItemStack aFuelItem, int aFuelValue); - public boolean addFissionFuel( - FluidStack aInput1, - FluidStack aInput2, - FluidStack aInput3, - FluidStack aInput4, - FluidStack aInput5, - FluidStack aInput6, - FluidStack aInput7, - FluidStack aInput8, - FluidStack aInput9, - FluidStack aOutput1, - FluidStack aOutput2, - int aDuration, - int aEUt); + public boolean addFissionFuel(FluidStack aInput1, FluidStack aInput2, FluidStack aInput3, FluidStack aInput4, + FluidStack aInput5, FluidStack aInput6, FluidStack aInput7, FluidStack aInput8, FluidStack aInput9, + FluidStack aOutput1, FluidStack aOutput2, int aDuration, int aEUt); - public boolean addFissionFuel( - boolean aOptimise, - FluidStack aInput1, - FluidStack aInput2, - FluidStack aInput3, - FluidStack aInput4, - FluidStack aInput5, - FluidStack aInput6, - FluidStack aInput7, - FluidStack aInput8, - FluidStack aInput9, - FluidStack aOutput1, - FluidStack aOutput2, - int aDuration, - int aEUt); + public boolean addFissionFuel(boolean aOptimise, FluidStack aInput1, FluidStack aInput2, FluidStack aInput3, + FluidStack aInput4, FluidStack aInput5, FluidStack aInput6, FluidStack aInput7, FluidStack aInput8, + FluidStack aInput9, FluidStack aOutput1, FluidStack aOutput2, int aDuration, int aEUt); - public boolean addCyclotronRecipe( - ItemStack aInput, - FluidStack aFluidInput, - ItemStack[] aOutputs, - FluidStack aFluidOutput, - int[] aChances, - int aDuration, - int aEUt, - int aSpecialValue); - - boolean addCyclotronRecipe( - ItemStack[] aInputs, - FluidStack aFluidInput, - ItemStack[] aOutput, - FluidStack aFluidOutput, - int[] aChances, - int aDuration, - int aEUt, - int aSpecialValue); - - public boolean addMixerRecipe( - ItemStack aInput1, - ItemStack aInput2, - ItemStack aInput3, - ItemStack aInput4, - FluidStack aFluidInput, - FluidStack aFluidOutput, - ItemStack aOutput1, - ItemStack aOutput2, - ItemStack aOutput3, - ItemStack aOutput4, - int aDuration, - int aEUt); + public boolean addCyclotronRecipe(ItemStack aInput, FluidStack aFluidInput, ItemStack[] aOutputs, + FluidStack aFluidOutput, int[] aChances, int aDuration, int aEUt, int aSpecialValue); + + boolean addCyclotronRecipe(ItemStack[] aInputs, FluidStack aFluidInput, ItemStack[] aOutput, + FluidStack aFluidOutput, int[] aChances, int aDuration, int aEUt, int aSpecialValue); + + public boolean addMixerRecipe(ItemStack aInput1, ItemStack aInput2, ItemStack aInput3, ItemStack aInput4, + FluidStack aFluidInput, FluidStack aFluidOutput, ItemStack aOutput1, ItemStack aOutput2, ItemStack aOutput3, + ItemStack aOutput4, int aDuration, int aEUt); /** * Adds a Recipe for the Machine Component Assembler. (up to 6 Inputs) * - * @param aInputs = ItemStack[] (not null, and respects StackSize) - * @param aFluidInput = Input of a fluid (can be null, and respects StackSize) - * @param aOutput1 = Output ItemStack (not null, and respects StackSize) - * @param aDuration = Duration (must be >= 0) - * @param aEUt = EU per tick needed for heating up (must be >= 0) + * @param aInputs = ItemStack[] (not null, and respects StackSize) + * @param aFluidInput = Input of a fluid (can be null, and respects StackSize) + * @param aOutput1 = Output ItemStack (not null, and respects StackSize) + * @param aDuration = Duration (must be >= 0) + * @param aEUt = EU per tick needed for heating up (must be >= 0) * @return true if the Recipe got added, otherwise false. */ - public boolean addComponentMakerRecipe( - ItemStack[] aInputs, FluidStack aFluidInput, ItemStack aOutput1, int aDuration, int aEUt); - - public boolean addMultiblockCentrifugeRecipe( - ItemStack[] aInputs, - FluidStack[] aFluidInputs, - FluidStack[] aFluidOutputs, - ItemStack[] aOutputs, - int[] aChances, - int aDuration, - int aEUtick, - int aSpecial); - - public boolean addMultiblockElectrolyzerRecipe( - ItemStack[] aInputs, - FluidStack[] aFluidInputs, - FluidStack[] aFluidOutputs, - ItemStack[] aOutputs, - int[] aChances, - int aDuration, - int aEUtick, - int aSpecial); - - public boolean addAdvancedFreezerRecipe( - ItemStack[] aInputs, - FluidStack[] aFluidInputs, - FluidStack[] aFluidOutputs, - ItemStack[] aOutputs, - int[] aChances, - int aDuration, - int aEUtick, - int aSpecial); - - public boolean addAssemblerRecipeWithOreDict( - Object aInput1, int aAmount1, Object aInput2, int aAmount2, ItemStack aOutput, int a1, int a2); - - public boolean addAssemblerRecipeWithOreDict( - Object aInput1, - int aAmount1, - Object aInput2, - int aAmount2, - FluidStack aInputFluid, - ItemStack aOutput, - int a1, - int a2); - - public boolean addSixSlotAssemblingRecipe( - ItemStack[] aInputs, FluidStack aInputFluid, ItemStack aOutput1, int aDuration, int aEUt); + public boolean addComponentMakerRecipe(ItemStack[] aInputs, FluidStack aFluidInput, ItemStack aOutput1, + int aDuration, int aEUt); + + public boolean addMultiblockCentrifugeRecipe(ItemStack[] aInputs, FluidStack[] aFluidInputs, + FluidStack[] aFluidOutputs, ItemStack[] aOutputs, int[] aChances, int aDuration, int aEUtick, int aSpecial); + + public boolean addMultiblockElectrolyzerRecipe(ItemStack[] aInputs, FluidStack[] aFluidInputs, + FluidStack[] aFluidOutputs, ItemStack[] aOutputs, int[] aChances, int aDuration, int aEUtick, int aSpecial); + + public boolean addAdvancedFreezerRecipe(ItemStack[] aInputs, FluidStack[] aFluidInputs, FluidStack[] aFluidOutputs, + ItemStack[] aOutputs, int[] aChances, int aDuration, int aEUtick, int aSpecial); + + public boolean addAssemblerRecipeWithOreDict(Object aInput1, int aAmount1, Object aInput2, int aAmount2, + ItemStack aOutput, int a1, int a2); + + public boolean addAssemblerRecipeWithOreDict(Object aInput1, int aAmount1, Object aInput2, int aAmount2, + FluidStack aInputFluid, ItemStack aOutput, int a1, int a2); + + public boolean addSixSlotAssemblingRecipe(ItemStack[] aInputs, FluidStack aInputFluid, ItemStack aOutput1, + int aDuration, int aEUt); + /** * Adds an Assemblyline Recipe * @@ -448,291 +302,157 @@ public interface IGregtech_RecipeAdder { * @param aDuration must be > 0 * @param aEUt should be > 0 */ - public boolean addAssemblylineRecipe( - ItemStack aResearchItem, - int aResearchTime, - ItemStack[] aInputs, - FluidStack[] aFluidInputs, - ItemStack aOutput, - int aDuration, - int aEUt); + public boolean addAssemblylineRecipe(ItemStack aResearchItem, int aResearchTime, ItemStack[] aInputs, + FluidStack[] aFluidInputs, ItemStack aOutput, 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); + + public boolean addChemicalRecipe(ItemStack input1, ItemStack input2, FluidStack inputFluid, FluidStack outputFluid, + ItemStack output, int time, int eu); + + public boolean addChemicalRecipe(ItemStack input1, ItemStack input2, FluidStack inputFluid, FluidStack outputFluid, + ItemStack output, Object object, int time, int eu); + + public boolean addChemicalRecipe(ItemStack input1, ItemStack input2, FluidStack inputFluid, FluidStack outputFluid, + ItemStack output, ItemStack object, int time); - public boolean addChemicalRecipe( - ItemStack input1, - ItemStack input2, - FluidStack inputFluid, - FluidStack outputFluid, - ItemStack output, - int time, - int eu); - - public boolean addChemicalRecipe( - ItemStack input1, - ItemStack input2, - FluidStack inputFluid, - FluidStack outputFluid, - ItemStack output, - Object object, - int time, - int eu); - - public boolean addChemicalRecipe( - ItemStack input1, - ItemStack input2, - FluidStack inputFluid, - FluidStack outputFluid, - ItemStack output, - ItemStack object, - int time); - - public boolean addChemicalRecipe( - ItemStack input1, - ItemStack input2, - int aCircuit, - FluidStack inputFluid, - FluidStack outputFluid, - ItemStack output, - ItemStack output2, - int time, - int eu); - - public boolean addMultiblockChemicalRecipe( - ItemStack[] itemStacks, - FluidStack[] fluidStacks, - FluidStack[] fluidStacks2, - ItemStack[] outputs, - int time, - int eu); + public boolean addChemicalRecipe(ItemStack input1, ItemStack input2, int aCircuit, FluidStack inputFluid, + FluidStack outputFluid, ItemStack output, ItemStack output2, int time, int eu); + + public boolean addMultiblockChemicalRecipe(ItemStack[] itemStacks, FluidStack[] fluidStacks, + FluidStack[] fluidStacks2, ItemStack[] outputs, int time, int eu); public boolean addCompressorRecipe(ItemStack aInput1, ItemStack aOutput1, int aDuration, int aEUt); - public boolean addBrewingRecipe( - ItemStack aIngredient, FluidStack aInput, FluidStack aOutput, int aTime, int aEu, boolean aHidden); + public boolean addBrewingRecipe(ItemStack aIngredient, FluidStack aInput, FluidStack aOutput, int aTime, int aEu, + boolean aHidden); - public boolean addBrewingRecipe( - int aCircuit, FluidStack aInput, FluidStack aOutput, int aTime, int aEu, boolean aHidden); + public boolean addBrewingRecipe(int aCircuit, FluidStack aInput, FluidStack aOutput, int aTime, int aEu, + boolean aHidden); public boolean addSmeltingAndAlloySmeltingRecipe(ItemStack aDust, ItemStack aOutput); public boolean addFluidExtractionRecipe(ItemStack input, FluidStack output, int aTime, int aEu); - public boolean addFluidExtractionRecipe( - ItemStack aContainer, ItemStack aFullContainer, FluidStack rFluidOut, int aTime, int aEu); + public boolean addFluidExtractionRecipe(ItemStack aContainer, ItemStack aFullContainer, FluidStack rFluidOut, + int aTime, int aEu); public boolean addFluidCannerRecipe(ItemStack aContainer, ItemStack aFullContainer, FluidStack rFluidIn); - public boolean addFluidCannerRecipe( - ItemStack aContainer, ItemStack aFullContainer, FluidStack rFluidIn, FluidStack rFluidOut); + public boolean addFluidCannerRecipe(ItemStack aContainer, ItemStack aFullContainer, FluidStack rFluidIn, + FluidStack rFluidOut); - public boolean addFluidCannerRecipe( - ItemStack aContainer, - ItemStack aFullContainer, - FluidStack rFluidIn, - FluidStack rFluidOut, - int aTime, - int aEu); + public boolean addFluidCannerRecipe(ItemStack aContainer, ItemStack aFullContainer, FluidStack rFluidIn, + FluidStack rFluidOut, int aTime, int aEu); /** * Adds a Fusion reactor Recipe * - * @param aInput1 = first Input (not null, and respects StackSize) - * @param aInput2 = second Input (not null, and respects StackSize) - * @param plasma = Output of the Fusion (can be null, and respects StackSize) - * @param aFusionDurationInTicks = How many ticks the Fusion lasts (must be > 0) - * @param aEu = The EU generated per Tick (can even be negative!) - * @param aSpecial = EU needed for heating the Reactor up (must be >= 0) + * @param aInput1 = first Input (not null, and respects StackSize) + * @param aInput2 = second Input (not null, and respects StackSize) + * @param plasma = Output of the Fusion (can be null, and respects StackSize) + * @param aFusionDurationInTicks = How many ticks the Fusion lasts (must be > 0) + * @param aEu = The EU generated per Tick (can even be negative!) + * @param aSpecial = EU needed for heating the Reactor up (must be >= 0) */ - public boolean addFusionReactorRecipe( - ItemStack aInputStackA, - ItemStack aInputStackB, - FluidStack plasma, - int aFusionDurationInTicks, - int aEu, - int aSpecial); + public boolean addFusionReactorRecipe(ItemStack aInputStackA, ItemStack aInputStackB, FluidStack plasma, + int aFusionDurationInTicks, int aEu, int aSpecial); + /** * Adds a Fusion reactor Recipe * - * @param aInput1 = first Input (not null, and respects StackSize) - * @param aInput2 = second Input (not null, and respects StackSize) - * @param plasma = Output of the Fusion (can be null, and respects StackSize) - * @param aOutputChance = chance to output plasma (can be 0) - * @param aFusionDurationInTicks = How many ticks the Fusion lasts (must be > 0) - * @param aEu = The EU generated per Tick (can even be negative!) - * @param aSpecial = EU needed for heating the Reactor up (must be >= 0) + * @param aInput1 = first Input (not null, and respects StackSize) + * @param aInput2 = second Input (not null, and respects StackSize) + * @param plasma = Output of the Fusion (can be null, and respects StackSize) + * @param aOutputChance = chance to output plasma (can be 0) + * @param aFusionDurationInTicks = How many ticks the Fusion lasts (must be > 0) + * @param aEu = The EU generated per Tick (can even be negative!) + * @param aSpecial = EU needed for heating the Reactor up (must be >= 0) */ - public boolean addFusionReactorRecipe( - FluidStack aInputStackA, - FluidStack aInputStackB, - FluidStack plasma, - int aOutputChance, - int aFusionDurationInTicks, - int aEu, - int aSpecial); + public boolean addFusionReactorRecipe(FluidStack aInputStackA, FluidStack aInputStackB, FluidStack plasma, + int aOutputChance, int aFusionDurationInTicks, int aEu, int aSpecial); + /** * Adds a Fusion reactor Recipe * - * @param aInput1 = first Input (not null, and respects StackSize) - * @param aInput2 = second Input (not null, and respects StackSize) - * @param plasma = Output of the Fusion (can be null, and respects StackSize) - * @param aOutputChance = chance to output plasma (can be 0) - * @param aFusionDurationInTicks = How many ticks the Fusion lasts (must be > 0) - * @param aEu = The EU generated per Tick (can even be negative!) - * @param aSpecial = EU needed for heating the Reactor up (must be >= 0) + * @param aInput1 = first Input (not null, and respects StackSize) + * @param aInput2 = second Input (not null, and respects StackSize) + * @param plasma = Output of the Fusion (can be null, and respects StackSize) + * @param aOutputChance = chance to output plasma (can be 0) + * @param aFusionDurationInTicks = How many ticks the Fusion lasts (must be > 0) + * @param aEu = The EU generated per Tick (can even be negative!) + * @param aSpecial = EU needed for heating the Reactor up (must be >= 0) */ - public boolean addFusionReactorRecipe( - ItemStack aInputStackA, - ItemStack aInputStackB, - FluidStack plasma, - int aOutputChance, - int aFusionDurationInTicks, - int aEu, - int aSpecial); - - public boolean addVacuumFurnaceRecipe( - ItemStack aInput1, - ItemStack aInput2, - FluidStack aFluidInput, - FluidStack aFluidOutput, - ItemStack aOutput1, - ItemStack aOutput2, - int aDuration, - int aEUt, - int aLevel); - - public boolean addVacuumFurnaceRecipe( - ItemStack[] aInputs, - FluidStack[] aFluidInputs, - ItemStack[] aOutputs, - FluidStack[] aFluidOutputs, - int aDuration, - int aEUt, - int aLevel); + public boolean addFusionReactorRecipe(ItemStack aInputStackA, ItemStack aInputStackB, FluidStack plasma, + int aOutputChance, int aFusionDurationInTicks, int aEu, int aSpecial); + + public boolean addVacuumFurnaceRecipe(ItemStack aInput1, ItemStack aInput2, FluidStack aFluidInput, + FluidStack aFluidOutput, ItemStack aOutput1, ItemStack aOutput2, int aDuration, int aEUt, int aLevel); + + public boolean addVacuumFurnaceRecipe(ItemStack[] aInputs, FluidStack[] aFluidInputs, ItemStack[] aOutputs, + FluidStack[] aFluidOutputs, int aDuration, int aEUt, int aLevel); public boolean addUvLaserRecipe(ItemStack aInput1, ItemStack aOutput, int time, long eu); public boolean addIrLaserRecipe(ItemStack aInput1, ItemStack aOutput, int time, long eu); - public boolean addChemicalPlantRecipe( - ItemStack[] aInputs, - FluidStack[] aInputFluids, - ItemStack[] aOutputs, - FluidStack[] aFluidOutputs, - int time, - long eu, - int aTier); - - public boolean addChemicalPlantRecipe( - ItemStack[] aInputs, - FluidStack[] aInputFluids, - ItemStack[] aOutputs, - FluidStack[] aFluidOutputs, - int[] aChances, - int time, - long eu, - int aTier); - - public boolean addBlastRecipe( - ItemStack[] aInputs, - FluidStack[] aInputFluids, - ItemStack[] aOutputs, - FluidStack[] aFluidOutputs, - int time, - long eu, - int aHeat); - - public boolean addPyrolyseRecipe( - ItemStack aInput, - FluidStack aFluidInput, - int intCircuit, - ItemStack aOutput, - FluidStack aFluidOutput, - int aDuration, - int aEUt); + public boolean addChemicalPlantRecipe(ItemStack[] aInputs, FluidStack[] aInputFluids, ItemStack[] aOutputs, + FluidStack[] aFluidOutputs, int time, long eu, int aTier); + + public boolean addChemicalPlantRecipe(ItemStack[] aInputs, FluidStack[] aInputFluids, ItemStack[] aOutputs, + FluidStack[] aFluidOutputs, int[] aChances, int time, long eu, int aTier); + + public boolean addBlastRecipe(ItemStack[] aInputs, FluidStack[] aInputFluids, ItemStack[] aOutputs, + FluidStack[] aFluidOutputs, int time, long eu, int aHeat); + + public boolean addPyrolyseRecipe(ItemStack aInput, FluidStack aFluidInput, int intCircuit, ItemStack aOutput, + FluidStack aFluidOutput, int aDuration, int aEUt); public boolean addExtractorRecipe(ItemStack aInput, ItemStack aOutput, int aDuration, int aEUt); public boolean addExtractorRecipe(ItemStack aInput, ItemStack aOutput, int aChance, int aDuration, int aEUt); - public boolean addDistilleryRecipe( - ItemStack aCircuit, - FluidStack aInput, - FluidStack aOutput, - ItemStack aSolidOutput, - int aDuration, - int aEUt, - boolean aHidden); + public boolean addDistilleryRecipe(ItemStack aCircuit, FluidStack aInput, FluidStack aOutput, + ItemStack aSolidOutput, int aDuration, int aEUt, boolean aHidden); - public boolean addPulverisationRecipe( - final ItemStack aInput, ItemStack aOutput1, ItemStack aOutput2, final ItemStack aOutput3); + public boolean addPulverisationRecipe(final ItemStack aInput, ItemStack aOutput1, ItemStack aOutput2, + final ItemStack aOutput3); public boolean addMillingRecipe(Materials aMat, int aEU); public boolean addMillingRecipe(Material aMat, int aEU); - public boolean addFlotationRecipe( - Materials aMat, - ItemStack aXanthate, - FluidStack[] aInputFluids, - FluidStack[] aOutputFluids, - int aTime, - int aEU); - - public boolean addFlotationRecipe( - Material aMat, - ItemStack aXanthate, - FluidStack[] aInputFluids, - FluidStack[] aOutputFluids, - int aTime, - int aEU); - - public boolean addpackagerRecipe( - ItemStack aRecipeType, ItemStack aInput1, ItemStack aInput2, ItemStack aOutputStack1); + public boolean addFlotationRecipe(Materials aMat, ItemStack aXanthate, FluidStack[] aInputFluids, + FluidStack[] aOutputFluids, int aTime, int aEU); + + public boolean addFlotationRecipe(Material aMat, ItemStack aXanthate, FluidStack[] aInputFluids, + FluidStack[] aOutputFluids, int aTime, int aEU); + + public boolean addpackagerRecipe(ItemStack aRecipeType, ItemStack aInput1, ItemStack aInput2, + ItemStack aOutputStack1); public boolean addFuelForRTG(ItemStack aFuelPellet, int aFuelDays, int aVoltage); - public boolean addColdTrapRecipe( - int aCircuit, - ItemStack aInput, - FluidStack aFluidInput, - ItemStack[] aOutputs, - int[] aChances, - FluidStack aFluidOutput, - int aTime, - int aEU); - - public boolean addReactorProcessingUnitRecipe( - ItemStack aInput1, - ItemStack aInput2, - FluidStack aFluidInput, - ItemStack[] aOutputs, - int[] aChances, - FluidStack aFluidOutput, - int aTime, - int aEU); - - public boolean addFluidHeaterRecipe( - ItemStack aCircuit, FluidStack aInput, FluidStack aOutput, int aDuration, int aEUt); + public boolean addColdTrapRecipe(int aCircuit, ItemStack aInput, FluidStack aFluidInput, ItemStack[] aOutputs, + int[] aChances, FluidStack aFluidOutput, int aTime, int aEU); + + public boolean addReactorProcessingUnitRecipe(ItemStack aInput1, ItemStack aInput2, FluidStack aFluidInput, + ItemStack[] aOutputs, int[] aChances, FluidStack aFluidOutput, int aTime, int aEU); + + public boolean addFluidHeaterRecipe(ItemStack aCircuit, FluidStack aInput, FluidStack aOutput, int aDuration, + int aEUt); public boolean addVacuumFreezerRecipe(ItemStack aInput, ItemStack aOutput, int aDuration, int aEU); public boolean addMolecularTransformerRecipe(ItemStack aInput, ItemStack aOutput, int aDuration, int aEU); - public boolean addMolecularTransformerRecipe( - ItemStack aInput, ItemStack aOutput, int aDuration, int aEU, int aAmps); + public boolean addMolecularTransformerRecipe(ItemStack aInput, ItemStack aOutput, int aDuration, int aEU, + int aAmps); } diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/api/interfaces/internal/Interface_IconContainer.java b/src/main/java/gtPlusPlus/xmod/gregtech/api/interfaces/internal/Interface_IconContainer.java index b597c221f5..2f4eaf4293 100644 --- a/src/main/java/gtPlusPlus/xmod/gregtech/api/interfaces/internal/Interface_IconContainer.java +++ b/src/main/java/gtPlusPlus/xmod/gregtech/api/interfaces/internal/Interface_IconContainer.java @@ -4,6 +4,7 @@ import net.minecraft.util.IIcon; import net.minecraft.util.ResourceLocation; public interface Interface_IconContainer { + /** * @return A regular Icon. */ diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/api/interfaces/internal/Interface_ItemBehaviour.java b/src/main/java/gtPlusPlus/xmod/gregtech/api/interfaces/internal/Interface_ItemBehaviour.java index 85ebb53217..6896d6ffb1 100644 --- a/src/main/java/gtPlusPlus/xmod/gregtech/api/interfaces/internal/Interface_ItemBehaviour.java +++ b/src/main/java/gtPlusPlus/xmod/gregtech/api/interfaces/internal/Interface_ItemBehaviour.java @@ -1,8 +1,7 @@ package gtPlusPlus.xmod.gregtech.api.interfaces.internal; -import gregtech.api.enums.SubTag; -import gtPlusPlus.xmod.gregtech.api.items.Gregtech_MetaItem_Base; 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 gtPlusPlus.xmod.gregtech.api.items.Gregtech_MetaItem_Base; + public interface Interface_ItemBehaviour<E extends Item> { + public boolean onLeftClickEntity(E aItem, ItemStack aStack, EntityPlayer aPlayer, Entity aEntity); - public boolean onItemUse( - E aItem, - ItemStack aStack, - EntityPlayer aPlayer, - World aWorld, - int aX, - int aY, - int aZ, - int aSide, - float hitX, - float hitY, - float hitZ); - - public boolean onItemUseFirst( - E aItem, - ItemStack aStack, - EntityPlayer aPlayer, - World aWorld, - int aX, - int aY, - int aZ, - int aSide, - float hitX, - float hitY, - float hitZ); + public boolean onItemUse(E aItem, ItemStack aStack, EntityPlayer aPlayer, World aWorld, int aX, int aY, int aZ, + int aSide, float hitX, float hitY, float hitZ); + + public boolean onItemUseFirst(E aItem, ItemStack aStack, EntityPlayer aPlayer, World aWorld, int aX, int aY, int aZ, + int aSide, float hitX, float hitY, float hitZ); public ItemStack onItemRightClick(E aItem, ItemStack aStack, World aWorld, EntityPlayer aPlayer); @@ -55,9 +38,9 @@ public interface Interface_ItemBehaviour<E extends Item> { public boolean hasProjectile(Gregtech_MetaItem_Base aItem, SubTag aProjectileType, ItemStack aStack); - public EntityArrow getProjectile( - E aItem, SubTag aProjectileType, ItemStack aStack, World aWorld, double aX, double aY, double aZ); + public EntityArrow getProjectile(E aItem, SubTag aProjectileType, ItemStack aStack, World aWorld, double aX, + double aY, double aZ); - public EntityArrow getProjectile( - E aItem, SubTag aProjectileType, ItemStack aStack, World aWorld, EntityLivingBase aEntity, float aSpeed); + public EntityArrow getProjectile(E aItem, SubTag aProjectileType, ItemStack aStack, World aWorld, + EntityLivingBase aEntity, float aSpeed); } diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/api/interfaces/internal/Interface_OreRecipeRegistrator.java b/src/main/java/gtPlusPlus/xmod/gregtech/api/interfaces/internal/Interface_OreRecipeRegistrator.java index ec6bcae20c..1a8fdc175c 100644 --- a/src/main/java/gtPlusPlus/xmod/gregtech/api/interfaces/internal/Interface_OreRecipeRegistrator.java +++ b/src/main/java/gtPlusPlus/xmod/gregtech/api/interfaces/internal/Interface_OreRecipeRegistrator.java @@ -1,29 +1,24 @@ package gtPlusPlus.xmod.gregtech.api.interfaces.internal; +import net.minecraft.item.ItemStack; + import gregtech.api.enums.Materials; import gtPlusPlus.xmod.gregtech.api.enums.GregtechOrePrefixes; import gtPlusPlus.xmod.gregtech.api.enums.GregtechOrePrefixes.GT_Materials; -import net.minecraft.item.ItemStack; public interface Interface_OreRecipeRegistrator { + /** - * 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! * @param aStack always != null */ - public void registerOre( - GregtechOrePrefixes aPrefix, - GT_Materials aMaterial, - String aOreDictName, - String aModName, + public void registerOre(GregtechOrePrefixes aPrefix, GT_Materials aMaterial, String aOreDictName, String aModName, ItemStack aStack); - public void registerOre( - GregtechOrePrefixes aPrefix, - Materials aMaterial, - String aOreDictName, - String aModName, + public void registerOre(GregtechOrePrefixes aPrefix, Materials aMaterial, String aOreDictName, String aModName, ItemStack copyAmount); } diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/api/interfaces/internal/Interface_OreRecipeRegistrator_GT.java b/src/main/java/gtPlusPlus/xmod/gregtech/api/interfaces/internal/Interface_OreRecipeRegistrator_GT.java index 616fdfdebf..230dc6ab8d 100644 --- a/src/main/java/gtPlusPlus/xmod/gregtech/api/interfaces/internal/Interface_OreRecipeRegistrator_GT.java +++ b/src/main/java/gtPlusPlus/xmod/gregtech/api/interfaces/internal/Interface_OreRecipeRegistrator_GT.java @@ -1,17 +1,20 @@ package gtPlusPlus.xmod.gregtech.api.interfaces.internal; +import net.minecraft.item.ItemStack; + import gregtech.api.enums.OrePrefixes; import gtPlusPlus.xmod.gregtech.api.enums.GregtechOrePrefixes.GT_Materials; -import net.minecraft.item.ItemStack; public interface Interface_OreRecipeRegistrator_GT { + /** - * 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! * @param aStack always != null */ - public void registerOre( - OrePrefixes aPrefix, GT_Materials aMaterial, String aOreDictName, String aModName, ItemStack aStack); + public void registerOre(OrePrefixes aPrefix, GT_Materials aMaterial, String aOreDictName, String aModName, + ItemStack aStack); } diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/api/interfaces/internal/Interface_Texture.java b/src/main/java/gtPlusPlus/xmod/gregtech/api/interfaces/internal/Interface_Texture.java index 5780109a7b..53d3055213 100644 --- a/src/main/java/gtPlusPlus/xmod/gregtech/api/interfaces/internal/Interface_Texture.java +++ b/src/main/java/gtPlusPlus/xmod/gregtech/api/interfaces/internal/Interface_Texture.java @@ -4,6 +4,7 @@ import net.minecraft.block.Block; import net.minecraft.client.renderer.RenderBlocks; public interface Interface_Texture { + public void renderXPos(RenderBlocks aRenderer, Block aBlock, int aX, int aY, int aZ); public void renderXNeg(RenderBlocks aRenderer, Block aBlock, int aX, int aY, int aZ); diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/api/interfaces/internal/Interface_ToolStats.java b/src/main/java/gtPlusPlus/xmod/gregtech/api/interfaces/internal/Interface_ToolStats.java index 6578ddeb0b..b8bb160cf7 100644 --- a/src/main/java/gtPlusPlus/xmod/gregtech/api/interfaces/internal/Interface_ToolStats.java +++ b/src/main/java/gtPlusPlus/xmod/gregtech/api/interfaces/internal/Interface_ToolStats.java @@ -1,10 +1,7 @@ package gtPlusPlus.xmod.gregtech.api.interfaces.internal; -import gregtech.api.interfaces.IIconContainer; -import gregtech.api.interfaces.IToolStats; -import gregtech.api.items.GT_MetaGenerated_Tool; -import gtPlusPlus.xmod.gregtech.api.items.Gregtech_MetaTool; import java.util.List; + import net.minecraft.block.Block; import net.minecraft.enchantment.Enchantment; import net.minecraft.entity.Entity; @@ -14,12 +11,18 @@ import net.minecraft.item.ItemStack; import net.minecraft.util.DamageSource; import net.minecraftforge.event.world.BlockEvent; +import gregtech.api.interfaces.IIconContainer; +import gregtech.api.interfaces.IToolStats; +import gregtech.api.items.GT_MetaGenerated_Tool; +import gtPlusPlus.xmod.gregtech.api.items.Gregtech_MetaTool; + /** * 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 Interface_ToolStats extends IToolStats { + /** * Called when aPlayer crafts this Tool */ @@ -44,7 +47,8 @@ public interface Interface_ToolStats extends IToolStats { public 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. */ @Override public int getToolDamagePerContainerCraft(); @@ -56,7 +60,8 @@ public interface Interface_ToolStats extends IToolStats { public 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. */ @Override public int getBaseQuality(); @@ -130,7 +135,8 @@ public interface Interface_ToolStats extends IToolStats { public 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 */ @Override public boolean isRangedWeapon(); @@ -142,10 +148,12 @@ public interface Interface_ToolStats extends IToolStats { public 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. */ @Override public boolean isMinableBlock(Block aBlock, byte aMetaData); @@ -156,18 +164,8 @@ public interface Interface_ToolStats extends IToolStats { * @return the Amount of modified Items. */ @Override - public 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); + public 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. @@ -179,15 +177,15 @@ public interface Interface_ToolStats extends IToolStats { * @return the Damage actually done to the Mob. */ @Override - public float getNormalDamageAgainstEntity( - float aOriginalDamage, Entity aEntity, ItemStack aStack, EntityPlayer aPlayer); + public float getNormalDamageAgainstEntity(float aOriginalDamage, Entity aEntity, ItemStack aStack, + EntityPlayer aPlayer); /** * @return the Damage actually done to the Mob. */ @Override - public float getMagicDamageAgainstEntity( - float aOriginalDamage, Entity aEntity, ItemStack aStack, EntityPlayer aPlayer); + public float getMagicDamageAgainstEntity(float aOriginalDamage, Entity aEntity, ItemStack aStack, + EntityPlayer aPlayer); @Override public IIconContainer getIcon(boolean aIsToolHead, ItemStack aStack); diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/api/items/Gregtech_Generic_Item.java b/src/main/java/gtPlusPlus/xmod/gregtech/api/items/Gregtech_Generic_Item.java index b9e402a2f6..3eefd1c314 100644 --- a/src/main/java/gtPlusPlus/xmod/gregtech/api/items/Gregtech_Generic_Item.java +++ b/src/main/java/gtPlusPlus/xmod/gregtech/api/items/Gregtech_Generic_Item.java @@ -1,17 +1,7 @@ package gtPlusPlus.xmod.gregtech.api.items; -import cpw.mods.fml.common.registry.GameRegistry; -import cpw.mods.fml.relauncher.Side; -import cpw.mods.fml.relauncher.SideOnly; -import gregtech.api.enums.SubTag; -import gregtech.api.interfaces.IProjectileItem; -import gregtech.api.util.GT_LanguageManager; -import gregtech.api.util.GT_ModHandler; -import gregtech.api.util.GT_Utility; -import gtPlusPlus.core.creative.AddToCreativeTab; -import gtPlusPlus.core.lib.CORE; -import gtPlusPlus.core.util.Utils; import java.util.List; + import net.minecraft.block.BlockDispenser; import net.minecraft.client.renderer.texture.IIconRegister; import net.minecraft.dispenser.*; @@ -25,10 +15,23 @@ 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.enums.SubTag; +import gregtech.api.interfaces.IProjectileItem; +import gregtech.api.util.GT_LanguageManager; +import gregtech.api.util.GT_ModHandler; +import gregtech.api.util.GT_Utility; +import gtPlusPlus.core.creative.AddToCreativeTab; +import gtPlusPlus.core.lib.CORE; +import gtPlusPlus.core.util.Utils; + /** * Extended by most Items, also used as a fallback Item, to prevent the accidental deletion when Errors occur. */ public class Gregtech_Generic_Item extends Item implements IProjectileItem { + private final String mName, mTooltip; protected IIcon mIcon; @@ -36,17 +39,16 @@ public class Gregtech_Generic_Item extends Item implements IProjectileItem { this(aUnlocalized, aEnglish, aEnglishTooltip, true); } - public Gregtech_Generic_Item( - final String aUnlocalized, - final String aEnglish, - final String aEnglishTooltip, + public Gregtech_Generic_Item(final String aUnlocalized, final String aEnglish, final String aEnglishTooltip, final boolean aWriteToolTipIntoLangFile) { super(); this.mName = aUnlocalized; GT_LanguageManager.addStringLocalization(this.mName + ".name", aEnglish); if (GT_Utility.isStringValid(aEnglishTooltip)) { GT_LanguageManager.addStringLocalization( - this.mTooltip = this.mName + ".tooltip_main", aEnglishTooltip, aWriteToolTipIntoLangFile); + this.mTooltip = this.mName + ".tooltip_main", + aEnglishTooltip, + aWriteToolTipIntoLangFile); } else { this.mTooltip = null; } @@ -77,8 +79,8 @@ public class Gregtech_Generic_Item extends Item implements IProjectileItem { } @Override - public boolean doesSneakBypassUse( - final World aWorld, final int aX, final int aY, final int aZ, final EntityPlayer aPlayer) { + public boolean doesSneakBypassUse(final World aWorld, final int aX, final int aY, final int aZ, + final EntityPlayer aPlayer) { return true; } @@ -92,8 +94,8 @@ public class Gregtech_Generic_Item extends Item implements IProjectileItem { } @Override - public void addInformation( - final ItemStack aStack, final EntityPlayer aPlayer, final List aList, final boolean aF3_H) { + public void addInformation(final ItemStack aStack, final EntityPlayer aPlayer, final List aList, + final boolean aF3_H) { if ((this.getMaxDamage() > 0) && !this.getHasSubtypes()) { aList.add((aStack.getMaxDamage() - this.getDamage(aStack)) + " / " + aStack.getMaxDamage()); } @@ -128,23 +130,14 @@ public class Gregtech_Generic_Item extends Item implements IProjectileItem { } @Override - public EntityArrow getProjectile( - final SubTag aProjectileType, - final ItemStack aStack, - final World aWorld, - final double aX, - final double aY, - final double aZ) { + public EntityArrow getProjectile(final SubTag aProjectileType, final ItemStack aStack, final World aWorld, + final double aX, final double aY, final double aZ) { return null; } @Override - public EntityArrow getProjectile( - final SubTag aProjectileType, - final ItemStack aStack, - final World aWorld, - final EntityLivingBase aEntity, - final float aSpeed) { + public EntityArrow getProjectile(final SubTag aProjectileType, final ItemStack aStack, final World aWorld, + final EntityLivingBase aEntity, final float aSpeed) { return null; } @@ -164,6 +157,7 @@ public class Gregtech_Generic_Item extends Item implements IProjectileItem { } public static class GT_Item_Dispense extends BehaviorProjectileDispense { + @Override public ItemStack dispenseStack(final IBlockSource aSource, final ItemStack aStack) { return ((Gregtech_Generic_Item) aStack.getItem()).onDispense(aSource, aStack); diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/api/items/Gregtech_MetaItem.java b/src/main/java/gtPlusPlus/xmod/gregtech/api/items/Gregtech_MetaItem.java index 3daf2d3f31..aa4f6fb45f 100644 --- a/src/main/java/gtPlusPlus/xmod/gregtech/api/items/Gregtech_MetaItem.java +++ b/src/main/java/gtPlusPlus/xmod/gregtech/api/items/Gregtech_MetaItem.java @@ -2,6 +2,17 @@ package gtPlusPlus.xmod.gregtech.api.items; import static gregtech.api.enums.GT_Values.D1; +import java.util.*; + +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.ItemStack; +import net.minecraft.util.IIcon; +import net.minecraft.world.World; + import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; import gregtech.api.GregTech_API; @@ -18,20 +29,12 @@ import gregtech.api.util.GT_Utility; import gtPlusPlus.core.creative.AddToCreativeTab; import gtPlusPlus.core.lib.CORE; import gtPlusPlus.xmod.gregtech.api.interfaces.internal.Interface_ItemBehaviour; -import java.util.*; -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.ItemStack; -import net.minecraft.util.IIcon; -import net.minecraft.world.World; public abstract class Gregtech_MetaItem extends Gregtech_MetaItem_Base { + /** - * 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. */ @@ -110,7 +113,8 @@ public abstract class Gregtech_MetaItem extends Gregtech_MetaItem_Base { if (tRandomData instanceof Interface_ItemBehaviour) { this.addItemBehavior( - this.mOffset + aID, (Interface_ItemBehaviour<Gregtech_MetaItem_Base>) tRandomData); + this.mOffset + aID, + (Interface_ItemBehaviour<Gregtech_MetaItem_Base>) tRandomData); tUseOreDict = false; } if (tRandomData instanceof IItemContainer) { @@ -170,19 +174,14 @@ public abstract class Gregtech_MetaItem extends Gregtech_MetaItem_Base { * @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 Gregtech_MetaItem setElectricStats( - final int aMetaValue, - final long aMaxCharge, - final long aTransferLimit, - final long aTier, - final long aSpecialData, - final boolean aUseAnimations) { + public final Gregtech_MetaItem setElectricStats(final int aMetaValue, final long aMaxCharge, + final long aTransferLimit, final long aTier, final long aSpecialData, final boolean aUseAnimations) { if ((aMetaValue < 0) || (aMetaValue >= (this.mOffset + this.mEnabledItems.length()))) { return this; } @@ -191,7 +190,7 @@ public abstract class Gregtech_MetaItem extends Gregtech_MetaItem_Base { } else { this.mElectricStats.put( (short) aMetaValue, - new Long[] {aMaxCharge, Math.max(0, aTransferLimit), Math.max(-1, aTier), aSpecialData}); + new Long[] { aMaxCharge, Math.max(0, aTransferLimit), Math.max(-1, aTier), aSpecialData }); if ((aMetaValue >= this.mOffset) && aUseAnimations) { this.mIconList[aMetaValue - this.mOffset] = Arrays.copyOf( this.mIconList[aMetaValue - this.mOffset], @@ -206,21 +205,21 @@ public abstract class Gregtech_MetaItem extends Gregtech_MetaItem_Base { * @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 Gregtech_MetaItem setFluidContainerStats( - final int aMetaValue, final long aCapacity, final long aStacksize) { + public final Gregtech_MetaItem setFluidContainerStats(final int aMetaValue, final long aCapacity, + final long aStacksize) { if ((aMetaValue < 0) || (aMetaValue >= (this.mOffset + this.mEnabledItems.length()))) { return this; } if (aCapacity < 0) { this.mElectricStats.remove((short) aMetaValue); } else { - this.mFluidContainerStats.put((short) aMetaValue, new Long[] {aCapacity, Math.max(1, aStacksize)}); + this.mFluidContainerStats.put((short) aMetaValue, new Long[] { aCapacity, Math.max(1, aStacksize) }); } return this; } @@ -298,11 +297,11 @@ public abstract class Gregtech_MetaItem extends Gregtech_MetaItem_Base { for (short i = 0, j = (short) this.mEnabledItems.length(); i < j; i++) { if (this.mEnabledItems.get(i)) { for (byte k = 1; k < this.mIconList[i].length; k++) { - this.mIconList[i][k] = aIconRegister.registerIcon( - CORE.MODID + ":" + this.getUnlocalizedName() + "/" + i + "/" + k); + this.mIconList[i][k] = aIconRegister + .registerIcon(CORE.MODID + ":" + this.getUnlocalizedName() + "/" + i + "/" + k); } - this.mIconList[i][0] = - aIconRegister.registerIcon(CORE.MODID + ":" + this.getUnlocalizedName() + "/" + i); + this.mIconList[i][0] = aIconRegister + .registerIcon(CORE.MODID + ":" + this.getUnlocalizedName() + "/" + i); } } } diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/api/items/Gregtech_MetaItem_Base.java b/src/main/java/gtPlusPlus/xmod/gregtech/api/items/Gregtech_MetaItem_Base.java index a961b28cf7..6ed72a8803 100644 --- a/src/main/java/gtPlusPlus/xmod/gregtech/api/items/Gregtech_MetaItem_Base.java +++ b/src/main/java/gtPlusPlus/xmod/gregtech/api/items/Gregtech_MetaItem_Base.java @@ -2,14 +2,10 @@ package gtPlusPlus.xmod.gregtech.api.items; import static gregtech.api.enums.GT_Values.*; -import gregtech.api.enums.SubTag; -import gregtech.api.util.*; -import gtPlusPlus.core.util.Utils; -import gtPlusPlus.xmod.gregtech.api.interfaces.internal.Interface_ItemBehaviour; -import ic2.api.item.*; import java.util.ArrayList; import java.util.HashMap; import java.util.List; + import net.minecraft.dispenser.IBlockSource; import net.minecraft.entity.Entity; import net.minecraft.entity.EntityLivingBase; @@ -24,11 +20,17 @@ import net.minecraft.world.World; import net.minecraftforge.fluids.FluidStack; import net.minecraftforge.fluids.IFluidContainerItem; +import gregtech.api.enums.SubTag; +import gregtech.api.util.*; +import gtPlusPlus.core.util.Utils; +import gtPlusPlus.xmod.gregtech.api.interfaces.internal.Interface_ItemBehaviour; +import ic2.api.item.*; + public abstract class Gregtech_MetaItem_Base extends Gregtech_Generic_Item implements ISpecialElectricItem, IElectricItemManager, IFluidContainerItem { + /* ---------- CONSTRUCTOR AND MEMBER VARIABLES ---------- */ - private final HashMap<Short, ArrayList<Interface_ItemBehaviour<Gregtech_MetaItem_Base>>> mItemBehaviors = - new HashMap<>(); + private final HashMap<Short, ArrayList<Interface_ItemBehaviour<Gregtech_MetaItem_Base>>> mItemBehaviors = new HashMap<>(); /** * Creates the Item using these Parameters. @@ -51,8 +53,8 @@ public abstract class Gregtech_MetaItem_Base extends Gregtech_Generic_Item * @param aBehavior the Click Behavior you want to add. * @return the Item itself for convenience in constructing. */ - public final Gregtech_MetaItem_Base addItemBehavior( - final int aMetaValue, final Interface_ItemBehaviour<Gregtech_MetaItem_Base> aBehavior) { + public final Gregtech_MetaItem_Base addItemBehavior(final int aMetaValue, + final Interface_ItemBehaviour<Gregtech_MetaItem_Base> aBehavior) { if ((aMetaValue < 0) || (aMetaValue >= 32766) || (aBehavior == null)) { return this; } @@ -71,8 +73,8 @@ public abstract class Gregtech_MetaItem_Base extends Gregtech_Generic_Item @Override public boolean hasProjectile(final SubTag aProjectileType, final ItemStack aStack) { - final ArrayList<Interface_ItemBehaviour<Gregtech_MetaItem_Base>> tList = - this.mItemBehaviors.get((short) this.getDamage(aStack)); + final ArrayList<Interface_ItemBehaviour<Gregtech_MetaItem_Base>> tList = this.mItemBehaviors + .get((short) this.getDamage(aStack)); if (tList != null) { for (final Interface_ItemBehaviour<Gregtech_MetaItem_Base> tBehavior : tList) { if (tBehavior.hasProjectile(this, aProjectileType, aStack)) { @@ -84,15 +86,10 @@ public abstract class Gregtech_MetaItem_Base extends Gregtech_Generic_Item } @Override - public EntityArrow getProjectile( - final SubTag aProjectileType, - final ItemStack aStack, - final World aWorld, - final double aX, - final double aY, - final double aZ) { - final ArrayList<Interface_ItemBehaviour<Gregtech_MetaItem_Base>> tList = - this.mItemBehaviors.get((short) this.getDamage(aStack)); + public EntityArrow getProjectile(final SubTag aProjectileType, final ItemStack aStack, final World aWorld, + final double aX, final double aY, final double aZ) { + final ArrayList<Interface_ItemBehaviour<Gregtech_MetaItem_Base>> tList = this.mItemBehaviors + .get((short) this.getDamage(aStack)); if (tList != null) { for (final Interface_ItemBehaviour<Gregtech_MetaItem_Base> tBehavior : tList) { final EntityArrow rArrow = tBehavior.getProjectile(this, aProjectileType, aStack, aWorld, aX, aY, aZ); @@ -105,18 +102,14 @@ public abstract class Gregtech_MetaItem_Base extends Gregtech_Generic_Item } @Override - public EntityArrow getProjectile( - final SubTag aProjectileType, - final ItemStack aStack, - final World aWorld, - final EntityLivingBase aEntity, - final float aSpeed) { - final ArrayList<Interface_ItemBehaviour<Gregtech_MetaItem_Base>> tList = - this.mItemBehaviors.get((short) this.getDamage(aStack)); + public EntityArrow getProjectile(final SubTag aProjectileType, final ItemStack aStack, final World aWorld, + final EntityLivingBase aEntity, final float aSpeed) { + final ArrayList<Interface_ItemBehaviour<Gregtech_MetaItem_Base>> tList = this.mItemBehaviors + .get((short) this.getDamage(aStack)); if (tList != null) { for (final Interface_ItemBehaviour<Gregtech_MetaItem_Base> tBehavior : tList) { - final EntityArrow rArrow = - tBehavior.getProjectile(this, aProjectileType, aStack, aWorld, aEntity, aSpeed); + final EntityArrow rArrow = tBehavior + .getProjectile(this, aProjectileType, aStack, aWorld, aEntity, aSpeed); if (rArrow != null) { return rArrow; } @@ -127,8 +120,8 @@ public abstract class Gregtech_MetaItem_Base extends Gregtech_Generic_Item @Override public ItemStack onDispense(final IBlockSource aSource, final ItemStack aStack) { - final ArrayList<Interface_ItemBehaviour<Gregtech_MetaItem_Base>> tList = - this.mItemBehaviors.get((short) this.getDamage(aStack)); + final ArrayList<Interface_ItemBehaviour<Gregtech_MetaItem_Base>> tList = this.mItemBehaviors + .get((short) this.getDamage(aStack)); if (tList != null) { for (final Interface_ItemBehaviour<Gregtech_MetaItem_Base> tBehavior : tList) { if (tBehavior.canDispense(this, aSource, aStack)) { @@ -141,8 +134,8 @@ public abstract class Gregtech_MetaItem_Base extends Gregtech_Generic_Item @Override public boolean isItemStackUsable(final ItemStack aStack) { - final ArrayList<Interface_ItemBehaviour<Gregtech_MetaItem_Base>> tList = - this.mItemBehaviors.get((short) this.getDamage(aStack)); + final ArrayList<Interface_ItemBehaviour<Gregtech_MetaItem_Base>> tList = this.mItemBehaviors + .get((short) this.getDamage(aStack)); if (tList != null) { for (final Interface_ItemBehaviour<Gregtech_MetaItem_Base> tBehavior : tList) { if (!tBehavior.isItemStackUsable(this, aStack)) { @@ -157,8 +150,8 @@ public abstract class Gregtech_MetaItem_Base extends Gregtech_Generic_Item public boolean onLeftClickEntity(final ItemStack aStack, final EntityPlayer aPlayer, final Entity aEntity) { this.use(aStack, 0, aPlayer); this.isItemStackUsable(aStack); - final ArrayList<Interface_ItemBehaviour<Gregtech_MetaItem_Base>> tList = - this.mItemBehaviors.get((short) this.getDamage(aStack)); + final ArrayList<Interface_ItemBehaviour<Gregtech_MetaItem_Base>> tList = this.mItemBehaviors + .get((short) this.getDamage(aStack)); if (tList != null) { for (final Interface_ItemBehaviour<Gregtech_MetaItem_Base> tBehavior : tList) { try { @@ -183,21 +176,12 @@ public abstract class Gregtech_MetaItem_Base extends Gregtech_Generic_Item } @Override - public boolean onItemUse( - final ItemStack aStack, - final EntityPlayer aPlayer, - final World aWorld, - final int aX, - final int aY, - final int aZ, - final int aSide, - final float hitX, - final float hitY, - final float hitZ) { + public boolean onItemUse(final ItemStack aStack, final EntityPlayer aPlayer, final World aWorld, final int aX, + final int aY, final int aZ, final int aSide, final float hitX, final float hitY, final float hitZ) { this.use(aStack, 0, aPlayer); this.isItemStackUsable(aStack); - final ArrayList<Interface_ItemBehaviour<Gregtech_MetaItem_Base>> tList = - this.mItemBehaviors.get((short) this.getDamage(aStack)); + final ArrayList<Interface_ItemBehaviour<Gregtech_MetaItem_Base>> tList = this.mItemBehaviors + .get((short) this.getDamage(aStack)); if (tList != null) { for (final Interface_ItemBehaviour<Gregtech_MetaItem_Base> tBehavior : tList) { try { @@ -222,21 +206,12 @@ public abstract class Gregtech_MetaItem_Base extends Gregtech_Generic_Item } @Override - public boolean onItemUseFirst( - final ItemStack aStack, - final EntityPlayer aPlayer, - final World aWorld, - final int aX, - final int aY, - final int aZ, - final int aSide, - final float hitX, - final float hitY, - final float hitZ) { + public boolean onItemUseFirst(final ItemStack aStack, final EntityPlayer aPlayer, final World aWorld, final int aX, + final int aY, final int aZ, final int aSide, final float hitX, final float hitY, final float hitZ) { this.use(aStack, 0, aPlayer); this.isItemStackUsable(aStack); - final ArrayList<Interface_ItemBehaviour<Gregtech_MetaItem_Base>> tList = - this.mItemBehaviors.get((short) this.getDamage(aStack)); + final ArrayList<Interface_ItemBehaviour<Gregtech_MetaItem_Base>> tList = this.mItemBehaviors + .get((short) this.getDamage(aStack)); if (tList != null) { for (final Interface_ItemBehaviour<Gregtech_MetaItem_Base> tBehavior : tList) { try { @@ -264,8 +239,8 @@ public abstract class Gregtech_MetaItem_Base extends Gregtech_Generic_Item public ItemStack onItemRightClick(ItemStack aStack, final World aWorld, final EntityPlayer aPlayer) { this.use(aStack, 0, aPlayer); this.isItemStackUsable(aStack); - final ArrayList<Interface_ItemBehaviour<Gregtech_MetaItem_Base>> tList = - this.mItemBehaviors.get((short) this.getDamage(aStack)); + final ArrayList<Interface_ItemBehaviour<Gregtech_MetaItem_Base>> tList = this.mItemBehaviors + .get((short) this.getDamage(aStack)); if (tList != null) { for (final Interface_ItemBehaviour<Gregtech_MetaItem_Base> tBehavior : tList) { try { @@ -281,8 +256,8 @@ public abstract class Gregtech_MetaItem_Base extends Gregtech_Generic_Item } @Override - public final void addInformation( - final ItemStack aStack, final EntityPlayer aPlayer, List aList, final boolean aF3_H) { + public final void addInformation(final ItemStack aStack, final EntityPlayer aPlayer, List aList, + final boolean aF3_H) { final String tKey = this.getUnlocalizedName(aStack) + ".tooltip", tString = GT_LanguageManager.getTranslation(tKey); if (GT_Utility.isStringValid(tString) && !tKey.equals(tString)) { @@ -292,18 +267,27 @@ public abstract class Gregtech_MetaItem_Base extends Gregtech_Generic_Item Long[] tStats = this.getElectricStats(aStack); if (tStats != null) { if (tStats[3] > 0) { - aList.add(EnumChatFormatting.AQUA + "Contains " + GT_Utility.formatNumbers(tStats[3]) + " EU Tier: " - + (tStats[2] >= 0 ? tStats[2] : 0) + EnumChatFormatting.GRAY); + aList.add( + EnumChatFormatting.AQUA + "Contains " + + GT_Utility.formatNumbers(tStats[3]) + + " EU Tier: " + + (tStats[2] >= 0 ? tStats[2] : 0) + + EnumChatFormatting.GRAY); } else { final long tCharge = this.getRealCharge(aStack); if ((tStats[3] == -2) && (tCharge <= 0)) { - aList.add(EnumChatFormatting.AQUA + "Empty. You should recycle it properly." - + EnumChatFormatting.GRAY); + aList.add( + EnumChatFormatting.AQUA + "Empty. You should recycle it properly." + + EnumChatFormatting.GRAY); } else { - aList.add(EnumChatFormatting.AQUA + "" + GT_Utility.formatNumbers(tCharge) + " / " - + GT_Utility.formatNumbers(Math.abs(tStats[0])) + " EU - Voltage: " - + V[(int) (tStats[2] >= 0 ? tStats[2] < V.length ? tStats[2] : V.length - 1 : 1)] - + EnumChatFormatting.GRAY); + aList.add( + EnumChatFormatting.AQUA + "" + + GT_Utility.formatNumbers(tCharge) + + " / " + + GT_Utility.formatNumbers(Math.abs(tStats[0])) + + " EU - Voltage: " + + V[(int) (tStats[2] >= 0 ? tStats[2] < V.length ? tStats[2] : V.length - 1 : 1)] + + EnumChatFormatting.GRAY); } } } @@ -311,16 +295,17 @@ public abstract class Gregtech_MetaItem_Base extends Gregtech_Generic_Item tStats = this.getFluidContainerStats(aStack); if ((tStats != null) && (tStats[0] > 0)) { final FluidStack tFluid = this.getFluidContent(aStack); - aList.add(EnumChatFormatting.BLUE - + ((tFluid == null ? "No Fluids Contained" : GT_Utility.getFluidName(tFluid, true))) - + EnumChatFormatting.GRAY); - aList.add(EnumChatFormatting.BLUE - + ((tFluid == null ? 0 : tFluid.amount) + "L / " + tStats[0] + "L") - + EnumChatFormatting.GRAY); + aList.add( + EnumChatFormatting.BLUE + + ((tFluid == null ? "No Fluids Contained" : GT_Utility.getFluidName(tFluid, true))) + + EnumChatFormatting.GRAY); + aList.add( + EnumChatFormatting.BLUE + ((tFluid == null ? 0 : tFluid.amount) + "L / " + tStats[0] + "L") + + EnumChatFormatting.GRAY); } - final ArrayList<Interface_ItemBehaviour<Gregtech_MetaItem_Base>> tList = - this.mItemBehaviors.get((short) this.getDamage(aStack)); + final ArrayList<Interface_ItemBehaviour<Gregtech_MetaItem_Base>> tList = this.mItemBehaviors + .get((short) this.getDamage(aStack)); if (tList != null) { for (final Interface_ItemBehaviour<Gregtech_MetaItem_Base> tBehavior : tList) { aList = tBehavior.getAdditionalToolTips(this, aList, aStack); @@ -331,14 +316,10 @@ public abstract class Gregtech_MetaItem_Base extends Gregtech_Generic_Item } @Override - public void onUpdate( - final ItemStack aStack, - final World aWorld, - final Entity aPlayer, - final int aTimer, + public void onUpdate(final ItemStack aStack, final World aWorld, final Entity aPlayer, final int aTimer, final boolean aIsInHand) { - final ArrayList<Interface_ItemBehaviour<Gregtech_MetaItem_Base>> tList = - this.mItemBehaviors.get((short) this.getDamage(aStack)); + final ArrayList<Interface_ItemBehaviour<Gregtech_MetaItem_Base>> tList = this.mItemBehaviors + .get((short) this.getDamage(aStack)); if (tList != null) { for (final Interface_ItemBehaviour<Gregtech_MetaItem_Base> tBehavior : tList) { tBehavior.onUpdate(this, aStack, aWorld, aPlayer, aTimer, aIsInHand); @@ -374,29 +355,19 @@ public abstract class Gregtech_MetaItem_Base extends Gregtech_Generic_Item } @Override - public final double charge( - final ItemStack aStack, - final double aCharge, - final int aTier, - final boolean aIgnoreTransferLimit, - final boolean aSimulate) { + public final double charge(final ItemStack aStack, final double aCharge, final int aTier, + final boolean aIgnoreTransferLimit, final boolean aSimulate) { final Long[] tStats = this.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; } - final long tChargeBefore = this.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))); + final long tChargeBefore = this.getRealCharge(aStack), tNewCharge = aCharge == Integer.MAX_VALUE + ? Long.MAX_VALUE + : Math.min( + Math.abs(tStats[0]), + tChargeBefore + (aIgnoreTransferLimit ? (long) aCharge : Math.min(tStats[1], (long) aCharge))); if (!aSimulate) { this.setCharge(aStack, tNewCharge); } @@ -404,13 +375,8 @@ public abstract class Gregtech_MetaItem_Base extends Gregtech_Generic_Item } @Override - public final double discharge( - final ItemStack aStack, - final double aCharge, - final int aTier, - final boolean aIgnoreTransferLimit, - final boolean aBatteryAlike, - final boolean aSimulate) { + public final double discharge(final ItemStack aStack, final double aCharge, final int aTier, + final boolean aIgnoreTransferLimit, final boolean aBatteryAlike, final boolean aSimulate) { final Long[] tStats = this.getElectricStats(aStack); if ((tStats == null) || (tStats[2] > aTier)) { return 0; @@ -427,14 +393,8 @@ public abstract class Gregtech_MetaItem_Base extends Gregtech_Generic_Item } return tStats[3]; } - final long tChargeBefore = this.getRealCharge(aStack), - tNewCharge = - Math.max( - 0, - tChargeBefore - - (aIgnoreTransferLimit - ? (long) aCharge - : Math.min(tStats[1], (long) aCharge))); + final long tChargeBefore = this.getRealCharge(aStack), tNewCharge = Math + .max(0, tChargeBefore - (aIgnoreTransferLimit ? (long) aCharge : Math.min(tStats[1], (long) aCharge))); if (!aSimulate) { this.setCharge(aStack, tNewCharge); } @@ -570,8 +530,7 @@ public abstract class Gregtech_MetaItem_Base extends Gregtech_Generic_Item } final Long[] tStats = this.getFluidContainerStats(aStack); - if ((tStats == null) - || (tStats[0] <= 0) + if ((tStats == null) || (tStats[0] <= 0) || (aFluid == null) || (aFluid.getFluid().getID() <= 0) || (aFluid.amount <= 0)) { diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/api/items/Gregtech_MetaItem_X32.java b/src/main/java/gtPlusPlus/xmod/gregtech/api/items/Gregtech_MetaItem_X32.java index a7f7cae271..c87b46e696 100644 --- a/src/main/java/gtPlusPlus/xmod/gregtech/api/items/Gregtech_MetaItem_X32.java +++ b/src/main/java/gtPlusPlus/xmod/gregtech/api/items/Gregtech_MetaItem_X32.java @@ -1,5 +1,13 @@ package gtPlusPlus.xmod.gregtech.api.items; +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; @@ -12,24 +20,21 @@ import gregtech.api.util.GT_OreDictUnificator; import gregtech.api.util.GT_Utility; import gtPlusPlus.core.util.Utils; import gtPlusPlus.core.util.math.MathUtils; -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 Gregtech_MetaItem_X32 extends Gregtech_MetaItem { @@ -57,7 +62,8 @@ public abstract class Gregtech_MetaItem_X32 extends Gregtech_MetaItem { if (this.doesMaterialAllowGeneration(tPrefix, tMaterial)) { final ItemStack tStack = new ItemStack(this, 1, i); GT_LanguageManager.addStringLocalization( - this.getUnlocalizedName(tStack) + ".name", this.getDefaultLocalization(tPrefix, tMaterial, i)); + this.getUnlocalizedName(tStack) + ".name", + this.getDefaultLocalization(tPrefix, tMaterial, i)); GT_LanguageManager.addStringLocalization( this.getUnlocalizedName(tStack) + ".tooltip", tMaterial.getToolTip(tPrefix.mMaterialAmount / GT_Values.M)); @@ -67,8 +73,7 @@ public abstract class Gregtech_MetaItem_X32 extends Gregtech_MetaItem { GT_OreDictUnificator.registerOre(tPrefix.get(tMaterial), tStack); } if (((tPrefix == OrePrefixes.stick) || (tPrefix == OrePrefixes.wireFine)) - && ((tMaterial == Materials.Lead) - || (tMaterial == Materials.Tin) + && ((tMaterial == Materials.Lead) || (tMaterial == Materials.Tin) || (tMaterial == Materials.SolderingAlloy))) { GregTech_API.sSolderingMetalList.add(tStack); } @@ -118,19 +123,20 @@ public abstract class Gregtech_MetaItem_X32 extends Gregtech_MetaItem { */ public final IIconContainer getIconContainer(final int aMetaData, final Materials aMaterial) { return (this.mGeneratedPrefixList[aMetaData / 1000] != null) - && (this.mGeneratedPrefixList[aMetaData / 1000].mTextureIndex >= 0) - ? aMaterial.mIconSet.mTextures[this.mGeneratedPrefixList[aMetaData / 1000].mTextureIndex] - : null; + && (this.mGeneratedPrefixList[aMetaData / 1000].mTextureIndex >= 0) + ? aMaterial.mIconSet.mTextures[this.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( - final OrePrefixes aPrefix, final Materials aMaterial, final boolean aDoShowAllItems) { + public boolean doesShowInCreative(final OrePrefixes aPrefix, final Materials aMaterial, + final boolean aDoShowAllItems) { return true; } @@ -153,8 +159,7 @@ public abstract class Gregtech_MetaItem_X32 extends Gregtech_MetaItem { @Override public final IIconContainer getIconContainer(final int aMetaData) { - return GregTech_API.sGeneratedMaterials[aMetaData % 1000] == null - ? null + return GregTech_API.sGeneratedMaterials[aMetaData % 1000] == null ? null : this.getIconContainer(aMetaData, GregTech_API.sGeneratedMaterials[aMetaData % 1000]); } @@ -163,7 +168,8 @@ public abstract class Gregtech_MetaItem_X32 extends Gregtech_MetaItem { public final void getSubItems(final Item var1, final CreativeTabs aCreativeTab, final List aList) { for (int i = 0; i < 32000; i++) { if (this.doesMaterialAllowGeneration( - this.mGeneratedPrefixList[i / 1000], GregTech_API.sGeneratedMaterials[i % 1000]) + this.mGeneratedPrefixList[i / 1000], + GregTech_API.sGeneratedMaterials[i % 1000]) && this.doesShowInCreative( this.mGeneratedPrefixList[i / 1000], GregTech_API.sGeneratedMaterials[i % 1000], @@ -199,8 +205,8 @@ public abstract class Gregtech_MetaItem_X32 extends Gregtech_MetaItem { public int getItemStackLimit(final ItemStack aStack) { final int tDamage = this.getDamage(aStack); if ((tDamage < 32000) && (this.mGeneratedPrefixList[tDamage / 1000] != null)) { - return Math.min( - super.getItemStackLimit(aStack), this.mGeneratedPrefixList[tDamage / 1000].mDefaultStackSize); + return Math + .min(super.getItemStackLimit(aStack), this.mGeneratedPrefixList[tDamage / 1000].mDefaultStackSize); } return super.getItemStackLimit(aStack); } @@ -236,7 +242,9 @@ public abstract class Gregtech_MetaItem_X32 extends Gregtech_MetaItem { HEX_OxFFFFFF = 0xffb300; } else if (stack.getDisplayName().contains("MAX")) { HEX_OxFFFFFF = Utils.rgbtoHexValue( - MathUtils.randInt(220, 250), MathUtils.randInt(221, 251), MathUtils.randInt(220, 250)); + MathUtils.randInt(220, 250), + MathUtils.randInt(221, 251), + MathUtils.randInt(220, 250)); } else { HEX_OxFFFFFF = 0xffffff; } diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/api/items/Gregtech_MetaTool.java b/src/main/java/gtPlusPlus/xmod/gregtech/api/items/Gregtech_MetaTool.java index 7cb79a4ad6..11a4c02fbb 100644 --- a/src/main/java/gtPlusPlus/xmod/gregtech/api/items/Gregtech_MetaTool.java +++ b/src/main/java/gtPlusPlus/xmod/gregtech/api/items/Gregtech_MetaTool.java @@ -1,21 +1,12 @@ package gtPlusPlus.xmod.gregtech.api.items; -import buildcraft.api.tools.IToolWrench; -import cpw.mods.fml.common.Optional; -import gregtech.api.enchants.Enchantment_Radioactivity; -import gregtech.api.enums.Materials; -import gregtech.api.interfaces.IDamagableItem; -import gregtech.api.interfaces.IToolStats; -import gregtech.api.items.GT_MetaGenerated_Tool; -import gregtech.api.util.GT_ModHandler; -import gregtech.api.util.GT_Utility; -import gtPlusPlus.core.creative.AddToCreativeTab; -import gtPlusPlus.xmod.gregtech.api.interfaces.internal.Interface_ToolStats; import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.Map.Entry; + import mods.railcraft.api.core.items.IToolCrowbar; + import net.minecraft.block.Block; import net.minecraft.enchantment.Enchantment; import net.minecraft.enchantment.EnchantmentHelper; @@ -34,21 +25,33 @@ import net.minecraft.util.MathHelper; import net.minecraft.world.World; import net.minecraftforge.event.world.BlockEvent; +import buildcraft.api.tools.IToolWrench; +import cpw.mods.fml.common.Optional; +import gregtech.api.enchants.Enchantment_Radioactivity; +import gregtech.api.enums.Materials; +import gregtech.api.interfaces.IDamagableItem; +import gregtech.api.interfaces.IToolStats; +import gregtech.api.items.GT_MetaGenerated_Tool; +import gregtech.api.util.GT_ModHandler; +import gregtech.api.util.GT_Utility; +import gtPlusPlus.core.creative.AddToCreativeTab; +import gtPlusPlus.xmod.gregtech.api.interfaces.internal.Interface_ToolStats; + /** * 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(16, 1, Materials.Bismuth, Materials.Bismuth, null); + * GT_MetaGenerated_Tool.sInstances.get("gt.metatool.01").getToolWithStats(16, 1, Materials.Bismuth, Materials.Bismuth, + * null); */ -@Optional.InterfaceList({ - @Optional.Interface(iface = "forestry.api.arboriculture.IToolGrafter", modid = "Forestry"), - @Optional.Interface(iface = "mods.railcraft.api.core.items.IToolCrowbar", modid = "Railcraft"), - @Optional.Interface(iface = "buildcraft.api.tools.IToolWrench", modid = "BuildCraft"), - @Optional.Interface(iface = "crazypants.enderio.api.tool.ITool", modid = "EnderIO") -}) +@Optional.InterfaceList({ @Optional.Interface(iface = "forestry.api.arboriculture.IToolGrafter", modid = "Forestry"), + @Optional.Interface(iface = "mods.railcraft.api.core.items.IToolCrowbar", modid = "Railcraft"), + @Optional.Interface(iface = "buildcraft.api.tools.IToolWrench", modid = "BuildCraft"), + @Optional.Interface(iface = "crazypants.enderio.api.tool.ITool", modid = "EnderIO") }) public abstract class Gregtech_MetaTool extends GT_MetaGenerated_Tool implements IDamagableItem, IToolCrowbar, IToolWrench { + /** - * 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. */ @@ -75,35 +78,26 @@ public abstract class Gregtech_MetaTool extends GT_MetaGenerated_Tool * Called by the Block Harvesting Event within the GT_Proxy */ @Override - public void onHarvestBlockEvent( - final ArrayList<ItemStack> aDrops, - final ItemStack aStack, - final EntityPlayer aPlayer, - final Block aBlock, - final int aX, - final int aY, - final int aZ, - final byte aMetaData, - final int aFortune, - final boolean aSilkTouch, + public void onHarvestBlockEvent(final ArrayList<ItemStack> aDrops, final ItemStack aStack, + final EntityPlayer aPlayer, final Block aBlock, final int aX, final int aY, final int aZ, + final byte aMetaData, final int aFortune, final boolean aSilkTouch, final BlockEvent.HarvestDropsEvent aEvent) { final IToolStats tStats = this.getToolStats(aStack); if (this.isItemStackUsable(aStack) && (this.getDigSpeed(aStack, aBlock, aMetaData) > 0.0F)) { this.doDamage( aStack, tStats.convertBlockDrops( - aDrops, - aStack, - aPlayer, - aBlock, - aX, - aY, - aZ, - aMetaData, - aFortune, - aSilkTouch, - aEvent) - * tStats.getToolDamagePerDropConversion()); + aDrops, + aStack, + aPlayer, + aBlock, + aX, + aY, + aZ, + aMetaData, + aFortune, + aSilkTouch, + aEvent) * tStats.getToolDamagePerDropConversion()); } } @@ -118,23 +112,23 @@ public abstract class Gregtech_MetaTool extends GT_MetaGenerated_Tool return true; } if (aEntity.canAttackWithItem() && !aEntity.hitByEntity(aPlayer)) { - final float tMagicDamage = tStats.getMagicDamageAgainstEntity( - aEntity instanceof EntityLivingBase - ? EnchantmentHelper.getEnchantmentModifierLiving(aPlayer, (EntityLivingBase) aEntity) - : 0.0F, - aEntity, - aStack, - aPlayer); + final float tMagicDamage = tStats + .getMagicDamageAgainstEntity( + aEntity instanceof EntityLivingBase + ? EnchantmentHelper + .getEnchantmentModifierLiving(aPlayer, (EntityLivingBase) aEntity) + : 0.0F, + aEntity, + aStack, + aPlayer); float tDamage = tStats.getNormalDamageAgainstEntity( - (float) aPlayer.getEntityAttribute(SharedMonsterAttributes.attackDamage) - .getAttributeValue() + (float) aPlayer.getEntityAttribute(SharedMonsterAttributes.attackDamage).getAttributeValue() + this.getToolCombatDamage(aStack), aEntity, aStack, aPlayer); if ((tDamage + tMagicDamage) > 0.0F) { - final boolean tCriticalHit = (aPlayer.fallDistance > 0.0F) - && !aPlayer.onGround + final boolean tCriticalHit = (aPlayer.fallDistance > 0.0F) && !aPlayer.onGround && !aPlayer.isOnLadder() && !aPlayer.isInWater() && !aPlayer.isPotionActive(Potion.blindness) @@ -148,10 +142,9 @@ public abstract class Gregtech_MetaTool extends GT_MetaGenerated_Tool if (aEntity instanceof EntityLivingBase) { aEntity.setFire(EnchantmentHelper.getFireAspectModifier(aPlayer) * 4); } - final int tKnockcack = (aPlayer.isSprinting() ? 1 : 0) - + (aEntity instanceof EntityLivingBase - ? EnchantmentHelper.getKnockbackModifier(aPlayer, (EntityLivingBase) aEntity) - : 0); + final 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, @@ -178,8 +171,8 @@ public abstract class Gregtech_MetaTool extends GT_MetaGenerated_Tool 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); this.doDamage(aStack, tStats.getToolDamagePerEntityAttack()); } @@ -208,29 +201,39 @@ public abstract class Gregtech_MetaTool extends GT_MetaGenerated_Tool final int tOffset = this.getElectricStats(aStack) != null ? 2 : 1; if (tStats != null) { final String name = aStack.getUnlocalizedName(); - if (name.equals("gt.metatool.01.170") - || name.equals("gt.metatool.01.172") + if (name.equals("gt.metatool.01.170") || name.equals("gt.metatool.01.172") || name.equals("gt.metatool.01.174") || name.equals("gt.metatool.01.176")) { aList.add( tOffset + 0, - EnumChatFormatting.WHITE + "Durability: " + EnumChatFormatting.GREEN - + (tMaxDamage - getToolDamage(aStack)) + " / " + tMaxDamage + EnumChatFormatting.GRAY); + EnumChatFormatting.WHITE + "Durability: " + + EnumChatFormatting.GREEN + + (tMaxDamage - getToolDamage(aStack)) + + " / " + + tMaxDamage + + EnumChatFormatting.GRAY); aList.add( tOffset + 1, - EnumChatFormatting.WHITE + tMaterial.mDefaultLocalName + EnumChatFormatting.YELLOW + " lvl " - + this.getHarvestLevel(aStack, "") + EnumChatFormatting.GRAY); + EnumChatFormatting.WHITE + tMaterial.mDefaultLocalName + + EnumChatFormatting.YELLOW + + " lvl " + + this.getHarvestLevel(aStack, "") + + EnumChatFormatting.GRAY); aList.add( tOffset + 2, - EnumChatFormatting.WHITE + "Turbine Efficency: " + EnumChatFormatting.BLUE - + (50.0F + (10.0F * this.getToolCombatDamage(aStack))) + EnumChatFormatting.GRAY); + EnumChatFormatting.WHITE + "Turbine Efficency: " + + EnumChatFormatting.BLUE + + (50.0F + (10.0F * this.getToolCombatDamage(aStack))) + + EnumChatFormatting.GRAY); aList.add( tOffset + 3, - EnumChatFormatting.WHITE + "Optimal Steam flow: " + EnumChatFormatting.LIGHT_PURPLE + EnumChatFormatting.WHITE + "Optimal Steam flow: " + + EnumChatFormatting.LIGHT_PURPLE + Math.max( Float.MIN_NORMAL, tStats.getSpeedMultiplier() * getPrimaryMaterial(aStack).mToolSpeed * 1000) - + EnumChatFormatting.GRAY + "L/sec"); + + EnumChatFormatting.GRAY + + "L/sec"); aList.add( tOffset + 3, EnumChatFormatting.WHITE + "Optimal Gas flow(EU burnvalue per tick): " @@ -238,7 +241,8 @@ public abstract class Gregtech_MetaTool extends GT_MetaGenerated_Tool + Math.max( Float.MIN_NORMAL, tStats.getSpeedMultiplier() * getPrimaryMaterial(aStack).mToolSpeed * 25) - + EnumChatFormatting.GRAY + "EU/t"); + + EnumChatFormatting.GRAY + + "EU/t"); aList.add( tOffset + 3, EnumChatFormatting.WHITE + "Optimal Plasma flow(Plasma energyvalue per tick): " @@ -246,24 +250,35 @@ public abstract class Gregtech_MetaTool extends GT_MetaGenerated_Tool + Math.max( Float.MIN_NORMAL, tStats.getSpeedMultiplier() * getPrimaryMaterial(aStack).mToolSpeed * 1000) - + EnumChatFormatting.GRAY + "EU/t"); + + EnumChatFormatting.GRAY + + "EU/t"); } else { aList.add( tOffset + 0, - EnumChatFormatting.WHITE + "Durability: " + EnumChatFormatting.GREEN - + (tMaxDamage - getToolDamage(aStack)) + " / " + tMaxDamage + EnumChatFormatting.GRAY); + EnumChatFormatting.WHITE + "Durability: " + + EnumChatFormatting.GREEN + + (tMaxDamage - getToolDamage(aStack)) + + " / " + + tMaxDamage + + EnumChatFormatting.GRAY); aList.add( tOffset + 1, - EnumChatFormatting.WHITE + tMaterial.mDefaultLocalName + EnumChatFormatting.YELLOW + " lvl " - + this.getHarvestLevel(aStack, "") + EnumChatFormatting.GRAY); + EnumChatFormatting.WHITE + tMaterial.mDefaultLocalName + + EnumChatFormatting.YELLOW + + " lvl " + + this.getHarvestLevel(aStack, "") + + EnumChatFormatting.GRAY); aList.add( tOffset + 2, - EnumChatFormatting.WHITE + "Attack Damage: " + EnumChatFormatting.BLUE - + this.getToolCombatDamage(aStack) + EnumChatFormatting.GRAY); + EnumChatFormatting.WHITE + "Attack Damage: " + + EnumChatFormatting.BLUE + + this.getToolCombatDamage(aStack) + + EnumChatFormatting.GRAY); aList.add( tOffset + 3, - EnumChatFormatting.WHITE + "Mining Speed: " + EnumChatFormatting.LIGHT_PURPLE + EnumChatFormatting.WHITE + "Mining Speed: " + + EnumChatFormatting.LIGHT_PURPLE + Math.max( Float.MIN_NORMAL, tStats.getSpeedMultiplier() * getPrimaryMaterial(aStack).mToolSpeed) @@ -280,29 +295,39 @@ public abstract class Gregtech_MetaTool extends GT_MetaGenerated_Tool final int tOffset = this.getElectricStats(aStack) != null ? 2 : 1; if (tStats != null) { final String name = aStack.getUnlocalizedName(); - if (name.equals("gt.metatool.01.170") - || name.equals("gt.metatool.01.172") + if (name.equals("gt.metatool.01.170") || name.equals("gt.metatool.01.172") || name.equals("gt.metatool.01.174") || name.equals("gt.metatool.01.176")) { aList.add( tOffset + 0, - EnumChatFormatting.WHITE + "Durability: " + EnumChatFormatting.GREEN - + (tMaxDamage - getToolDamage(aStack)) + " / " + tMaxDamage + EnumChatFormatting.GRAY); + EnumChatFormatting.WHITE + "Durability: " + + EnumChatFormatting.GREEN + + (tMaxDamage - getToolDamage(aStack)) + + " / " + + tMaxDamage + + EnumChatFormatting.GRAY); aList.add( tOffset + 1, - EnumChatFormatting.WHITE + tMaterial.mDefaultLocalName + EnumChatFormatting.YELLOW + " lvl " - + this.getHarvestLevel(aStack, "") + EnumChatFormatting.GRAY); + EnumChatFormatting.WHITE + tMaterial.mDefaultLocalName + + EnumChatFormatting.YELLOW + + " lvl " + + this.getHarvestLevel(aStack, "") + + EnumChatFormatting.GRAY); aList.add( tOffset + 2, - EnumChatFormatting.WHITE + "Turbine Efficency: " + EnumChatFormatting.BLUE - + (50.0F + (10.0F * this.getToolCombatDamage(aStack))) + EnumChatFormatting.GRAY); + EnumChatFormatting.WHITE + "Turbine Efficency: " + + EnumChatFormatting.BLUE + + (50.0F + (10.0F * this.getToolCombatDamage(aStack))) + + EnumChatFormatting.GRAY); aList.add( tOffset + 3, - EnumChatFormatting.WHITE + "Optimal Steam flow: " + EnumChatFormatting.LIGHT_PURPLE + EnumChatFormatting.WHITE + "Optimal Steam flow: " + + EnumChatFormatting.LIGHT_PURPLE + Math.max( Float.MIN_NORMAL, tStats.getSpeedMultiplier() * getPrimaryMaterial(aStack).mToolSpeed * 1000) - + EnumChatFormatting.GRAY + "L/sec"); + + EnumChatFormatting.GRAY + + "L/sec"); aList.add( tOffset + 3, EnumChatFormatting.WHITE + "Optimal Gas flow(EU burnvalue per tick): " @@ -310,7 +335,8 @@ public abstract class Gregtech_MetaTool extends GT_MetaGenerated_Tool + Math.max( Float.MIN_NORMAL, tStats.getSpeedMultiplier() * getPrimaryMaterial(aStack).mToolSpeed * 50) - + EnumChatFormatting.GRAY + "EU/t"); + + EnumChatFormatting.GRAY + + "EU/t"); aList.add( tOffset + 3, EnumChatFormatting.WHITE + "Optimal Plasma flow(Plasma energyvalue per tick): " @@ -318,24 +344,35 @@ public abstract class Gregtech_MetaTool extends GT_MetaGenerated_Tool + Math.max( Float.MIN_NORMAL, tStats.getSpeedMultiplier() * getPrimaryMaterial(aStack).mToolSpeed * 1000) - + EnumChatFormatting.GRAY + "EU/t"); + + EnumChatFormatting.GRAY + + "EU/t"); } else { aList.add( tOffset + 0, - EnumChatFormatting.WHITE + "Durability: " + EnumChatFormatting.GREEN - + (tMaxDamage - getToolDamage(aStack)) + " / " + tMaxDamage + EnumChatFormatting.GRAY); + EnumChatFormatting.WHITE + "Durability: " + + EnumChatFormatting.GREEN + + (tMaxDamage - getToolDamage(aStack)) + + " / " + + tMaxDamage + + EnumChatFormatting.GRAY); aList.add( tOffset + 1, - EnumChatFormatting.WHITE + tMaterial.mDefaultLocalName + EnumChatFormatting.YELLOW + " lvl " - + this.getHarvestLevel(aStack, "") + EnumChatFormatting.GRAY); + EnumChatFormatting.WHITE + tMaterial.mDefaultLocalName + + EnumChatFormatting.YELLOW + + " lvl " + + this.getHarvestLevel(aStack, "") + + EnumChatFormatting.GRAY); aList.add( tOffset + 2, - EnumChatFormatting.WHITE + "Attack Damage: " + EnumChatFormatting.BLUE - + this.getToolCombatDamage(aStack) + EnumChatFormatting.GRAY); + EnumChatFormatting.WHITE + "Attack Damage: " + + EnumChatFormatting.BLUE + + this.getToolCombatDamage(aStack) + + EnumChatFormatting.GRAY); aList.add( tOffset + 3, - EnumChatFormatting.WHITE + "Mining Speed: " + EnumChatFormatting.LIGHT_PURPLE + EnumChatFormatting.WHITE + "Mining Speed: " + + EnumChatFormatting.LIGHT_PURPLE + Math.max( Float.MIN_NORMAL, tStats.getSpeedMultiplier() * getPrimaryMaterial(aStack).mToolSpeed) @@ -362,7 +399,9 @@ public abstract class Gregtech_MetaTool extends GT_MetaGenerated_Tool aList.add( tOffset + 3, - EnumChatFormatting.RED + "Heat: " + aNBT.getInteger("Heat") + " K" + EnumChatFormatting.RED + "Heat: " + + aNBT.getInteger("Heat") + + " K" + EnumChatFormatting.GRAY); } } @@ -381,12 +420,8 @@ public abstract class Gregtech_MetaTool extends GT_MetaGenerated_Tool if (aNBT != null) { aNBT = aNBT.getCompoundTag("GT.ToolStats"); if ((aNBT != null) && aNBT.getBoolean("Electric")) { - return new Long[] { - aNBT.getLong("MaxCharge"), - aNBT.getLong("Voltage"), - aNBT.getLong("Tier"), - aNBT.getLong("SpecialData") - }; + return new Long[] { aNBT.getLong("MaxCharge"), aNBT.getLong("Voltage"), aNBT.getLong("Tier"), + aNBT.getLong("SpecialData") }; } } return new Long[] {}; @@ -416,14 +451,8 @@ public abstract class Gregtech_MetaTool extends GT_MetaGenerated_Tool } @Override - public boolean onBlockDestroyed( - final ItemStack aStack, - final World aWorld, - final Block aBlock, - final int aX, - final int aY, - final int aZ, - final EntityLivingBase aPlayer) { + public boolean onBlockDestroyed(final ItemStack aStack, final World aWorld, final Block aBlock, final int aX, + final int aY, final int aZ, final EntityLivingBase aPlayer) { if (!this.isItemStackUsable(aStack)) { return false; } @@ -432,8 +461,9 @@ public abstract class Gregtech_MetaTool extends GT_MetaGenerated_Tool return false; } GT_Utility.doSoundAtClient(tStats.getMiningSound(), 1, 1.0F); - this.doDamage(aStack, (int) - Math.max(1, aBlock.getBlockHardness(aWorld, aX, aY, aZ) * tStats.getToolDamagePerBlockBreak())); + this.doDamage( + aStack, + (int) Math.max(1, aBlock.getBlockHardness(aWorld, aX, aY, aZ) * tStats.getToolDamagePerBlockBreak())); return this.getDigSpeed(aStack, aBlock, aWorld.getBlockMetadata(aX, aY, aZ)) > 0.0F; } @@ -466,8 +496,8 @@ public abstract class Gregtech_MetaTool extends GT_MetaGenerated_Tool } @Override - public boolean canWhack( - final EntityPlayer aPlayer, final ItemStack aStack, final int aX, final int aY, final int aZ) { + public boolean canWhack(final EntityPlayer aPlayer, final ItemStack aStack, final int aX, final int aY, + final int aZ) { if (!this.isItemStackUsable(aStack)) { return false; } @@ -596,8 +626,7 @@ public abstract class Gregtech_MetaTool extends GT_MetaGenerated_Tool } } for (final 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 { diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/api/items/tools/GT_MetaGenTool.java b/src/main/java/gtPlusPlus/xmod/gregtech/api/items/tools/GT_MetaGenTool.java index c9f337d47b..77b407109e 100644 --- a/src/main/java/gtPlusPlus/xmod/gregtech/api/items/tools/GT_MetaGenTool.java +++ b/src/main/java/gtPlusPlus/xmod/gregtech/api/items/tools/GT_MetaGenTool.java @@ -1,17 +1,10 @@ package gtPlusPlus.xmod.gregtech.api.items.tools; -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.IToolStats; -import gregtech.api.items.GT_MetaGenerated_Tool; -import gregtech.api.util.*; -import gtPlusPlus.xmod.gregtech.api.interfaces.internal.Interface_ToolStats; import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.Map.Entry; + import net.minecraft.block.Block; import net.minecraft.enchantment.Enchantment; import net.minecraft.enchantment.EnchantmentHelper; @@ -29,14 +22,25 @@ import net.minecraft.util.MathHelper; import net.minecraft.world.World; import net.minecraftforge.event.world.BlockEvent; +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.IToolStats; +import gregtech.api.items.GT_MetaGenerated_Tool; +import gregtech.api.util.*; +import gtPlusPlus.xmod.gregtech.api.interfaces.internal.Interface_ToolStats; + /** * 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(16, 1, Materials.Bismuth, Materials.Bismuth, null); + * GT_MetaGenerated_Tool.sInstances.get("gt.metatool.01").getToolWithStats(16, 1, Materials.Bismuth, Materials.Bismuth, + * null); */ public abstract class GT_MetaGenTool extends GT_MetaGenerated_Tool { + /** - * 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. */ @@ -86,18 +90,17 @@ public abstract class GT_MetaGenTool extends GT_MetaGenerated_Tool { /** * 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 addToolEx( - final int aID, - final String aEnglish, - String aToolTip, - final IToolStats aToolStats, + public final ItemStack addToolEx(final int aID, final String aEnglish, String aToolTip, final IToolStats aToolStats, final Object... aOreDictNamesAndAspects) { if (aToolTip == null) { aToolTip = ""; @@ -106,9 +109,11 @@ public abstract class GT_MetaGenTool extends GT_MetaGenerated_Tool { GT_LanguageManager.addStringLocalization(this.getUnlocalizedName() + "." + aID + ".name", aEnglish); GT_LanguageManager.addStringLocalization(this.getUnlocalizedName() + "." + aID + ".tooltip", aToolTip); GT_LanguageManager.addStringLocalization( - this.getUnlocalizedName() + "." + (aID + 1) + ".name", aEnglish + " (Empty)"); + this.getUnlocalizedName() + "." + (aID + 1) + ".name", + aEnglish + " (Empty)"); GT_LanguageManager.addStringLocalization( - this.getUnlocalizedName() + "." + (aID + 1) + ".tooltip", "You need to recharge it"); + this.getUnlocalizedName() + "." + (aID + 1) + ".tooltip", + "You need to recharge it"); this.mToolStats.put((short) aID, aToolStats); this.mToolStats.put((short) (aID + 1), aToolStats); aToolStats.onStatsAddedToTool(this, aID); @@ -138,12 +143,8 @@ public abstract class GT_MetaGenTool extends GT_MetaGenerated_Tool { * @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 getToolWithStatsEx( - final int aToolID, - final int aAmount, - final Materials aPrimaryMaterial, - final Materials aSecondaryMaterial, - final long[] aElectricArray) { + public final ItemStack getToolWithStatsEx(final int aToolID, final int aAmount, final Materials aPrimaryMaterial, + final Materials aSecondaryMaterial, final long[] aElectricArray) { final ItemStack rStack = new ItemStack(this, aAmount, aToolID); final IToolStats tToolStats = this.getToolStats(rStack); if (tToolStats != null) { @@ -177,35 +178,26 @@ public abstract class GT_MetaGenTool extends GT_MetaGenerated_Tool { * Called by the Block Harvesting Event within the GT_Proxy */ @Override - public void onHarvestBlockEvent( - final ArrayList<ItemStack> aDrops, - final ItemStack aStack, - final EntityPlayer aPlayer, - final Block aBlock, - final int aX, - final int aY, - final int aZ, - final byte aMetaData, - final int aFortune, - final boolean aSilkTouch, + public void onHarvestBlockEvent(final ArrayList<ItemStack> aDrops, final ItemStack aStack, + final EntityPlayer aPlayer, final Block aBlock, final int aX, final int aY, final int aZ, + final byte aMetaData, final int aFortune, final boolean aSilkTouch, final BlockEvent.HarvestDropsEvent aEvent) { final IToolStats tStats = this.getToolStats(aStack); if (this.isItemStackUsable(aStack) && (this.getDigSpeed(aStack, aBlock, aMetaData) > 0.0F)) { this.doDamage( aStack, tStats.convertBlockDrops( - aDrops, - aStack, - aPlayer, - aBlock, - aX, - aY, - aZ, - aMetaData, - aFortune, - aSilkTouch, - aEvent) - * tStats.getToolDamagePerDropConversion()); + aDrops, + aStack, + aPlayer, + aBlock, + aX, + aY, + aZ, + aMetaData, + aFortune, + aSilkTouch, + aEvent) * tStats.getToolDamagePerDropConversion()); } } @@ -220,23 +212,23 @@ public abstract class GT_MetaGenTool extends GT_MetaGenerated_Tool { return true; } if (aEntity.canAttackWithItem() && !aEntity.hitByEntity(aPlayer)) { - final float tMagicDamage = tStats.getMagicDamageAgainstEntity( - aEntity instanceof EntityLivingBase - ? EnchantmentHelper.getEnchantmentModifierLiving(aPlayer, (EntityLivingBase) aEntity) - : 0.0F, - aEntity, - aStack, - aPlayer); + final float tMagicDamage = tStats + .getMagicDamageAgainstEntity( + aEntity instanceof EntityLivingBase + ? EnchantmentHelper + .getEnchantmentModifierLiving(aPlayer, (EntityLivingBase) aEntity) + : 0.0F, + aEntity, + aStack, + aPlayer); float tDamage = tStats.getNormalDamageAgainstEntity( - (float) aPlayer.getEntityAttribute(SharedMonsterAttributes.attackDamage) - .getAttributeValue() + (float) aPlayer.getEntityAttribute(SharedMonsterAttributes.attackDamage).getAttributeValue() + this.getToolCombatDamage(aStack), aEntity, aStack, aPlayer); if ((tDamage + tMagicDamage) > 0.0F) { - final boolean tCriticalHit = (aPlayer.fallDistance > 0.0F) - && !aPlayer.onGround + final boolean tCriticalHit = (aPlayer.fallDistance > 0.0F) && !aPlayer.onGround && !aPlayer.isOnLadder() && !aPlayer.isInWater() && !aPlayer.isPotionActive(Potion.blindness) @@ -250,10 +242,9 @@ public abstract class GT_MetaGenTool extends GT_MetaGenerated_Tool { if (aEntity instanceof EntityLivingBase) { aEntity.setFire(EnchantmentHelper.getFireAspectModifier(aPlayer) * 4); } - final int tKnockcack = (aPlayer.isSprinting() ? 1 : 0) - + (aEntity instanceof EntityLivingBase - ? EnchantmentHelper.getKnockbackModifier(aPlayer, (EntityLivingBase) aEntity) - : 0); + final 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, @@ -280,8 +271,8 @@ public abstract class GT_MetaGenTool extends GT_MetaGenerated_Tool { 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); this.doDamage(aStack, tStats.getToolDamagePerEntityAttack()); } @@ -313,12 +304,8 @@ public abstract class GT_MetaGenTool extends GT_MetaGenerated_Tool { if (aNBT != null) { aNBT = aNBT.getCompoundTag("GT.ToolStats"); if ((aNBT != null) && aNBT.getBoolean("Electric")) { - return new Long[] { - aNBT.getLong("MaxCharge"), - aNBT.getLong("Voltage"), - aNBT.getLong("Tier"), - aNBT.getLong("SpecialData") - }; + return new Long[] { aNBT.getLong("MaxCharge"), aNBT.getLong("Voltage"), aNBT.getLong("Tier"), + aNBT.getLong("SpecialData") }; } } return null; @@ -348,14 +335,8 @@ public abstract class GT_MetaGenTool extends GT_MetaGenerated_Tool { } @Override - public boolean onBlockDestroyed( - final ItemStack aStack, - final World aWorld, - final Block aBlock, - final int aX, - final int aY, - final int aZ, - final EntityLivingBase aPlayer) { + public boolean onBlockDestroyed(final ItemStack aStack, final World aWorld, final Block aBlock, final int aX, + final int aY, final int aZ, final EntityLivingBase aPlayer) { if (!this.isItemStackUsable(aStack)) { return false; } @@ -364,8 +345,9 @@ public abstract class GT_MetaGenTool extends GT_MetaGenerated_Tool { return false; } GT_Utility.doSoundAtClient(tStats.getMiningSound(), 1, 1.0F); - this.doDamage(aStack, (int) - Math.max(1, aBlock.getBlockHardness(aWorld, aX, aY, aZ) * tStats.getToolDamagePerBlockBreak())); + this.doDamage( + aStack, + (int) Math.max(1, aBlock.getBlockHardness(aWorld, aX, aY, aZ) * tStats.getToolDamagePerBlockBreak())); return this.getDigSpeed(aStack, aBlock, aWorld.getBlockMetadata(aX, aY, aZ)) > 0.0F; } @@ -398,22 +380,16 @@ public abstract class GT_MetaGenTool extends GT_MetaGenerated_Tool { } @Override - public float getSaplingModifier( - final ItemStack aStack, - final World aWorld, - final EntityPlayer aPlayer, - final int aX, - final int aY, - final int aZ) { + public float getSaplingModifier(final ItemStack aStack, final World aWorld, final EntityPlayer aPlayer, + final int aX, final int aY, final int aZ) { final IToolStats tStats = this.getToolStats(aStack); - return (tStats != null) && tStats.isGrafter() - ? Math.min(100.0F, (1 + this.getHarvestLevel(aStack, "")) * 20.0F) + return (tStats != null) && tStats.isGrafter() ? Math.min(100.0F, (1 + this.getHarvestLevel(aStack, "")) * 20.0F) : 0.0F; } @Override - public boolean canWhack( - final EntityPlayer aPlayer, final ItemStack aStack, final int aX, final int aY, final int aZ) { + public boolean canWhack(final EntityPlayer aPlayer, final ItemStack aStack, final int aX, final int aY, + final int aZ) { if (!this.isItemStackUsable(aStack)) { return false; } @@ -562,8 +538,7 @@ public abstract class GT_MetaGenTool extends GT_MetaGenerated_Tool { } } for (final 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 { diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/api/items/types/ToolType_Base.java b/src/main/java/gtPlusPlus/xmod/gregtech/api/items/types/ToolType_Base.java index e57f2009e7..463b6d9f7f 100644 --- a/src/main/java/gtPlusPlus/xmod/gregtech/api/items/types/ToolType_Base.java +++ b/src/main/java/gtPlusPlus/xmod/gregtech/api/items/types/ToolType_Base.java @@ -1,9 +1,7 @@ package gtPlusPlus.xmod.gregtech.api.items.types; -import gregtech.api.enums.SubTag; -import gtPlusPlus.xmod.gregtech.api.interfaces.internal.Interface_ItemBehaviour; -import gtPlusPlus.xmod.gregtech.api.items.Gregtech_MetaItem_Base; import java.util.List; + import net.minecraft.block.BlockDispenser; import net.minecraft.dispenser.BehaviorDefaultDispenseItem; import net.minecraft.dispenser.IBlockSource; @@ -16,71 +14,47 @@ import net.minecraft.item.ItemStack; import net.minecraft.util.EnumFacing; import net.minecraft.world.World; +import gregtech.api.enums.SubTag; +import gtPlusPlus.xmod.gregtech.api.interfaces.internal.Interface_ItemBehaviour; +import gtPlusPlus.xmod.gregtech.api.items.Gregtech_MetaItem_Base; + public class ToolType_Base implements Interface_ItemBehaviour<Gregtech_MetaItem_Base> { + @Override - public boolean onLeftClickEntity( - final Gregtech_MetaItem_Base aItem, - final ItemStack aStack, - final EntityPlayer aPlayer, - final Entity aEntity) { + public boolean onLeftClickEntity(final Gregtech_MetaItem_Base aItem, final ItemStack aStack, + final EntityPlayer aPlayer, final Entity aEntity) { return false; } @Override - public boolean onItemUse( - final Gregtech_MetaItem_Base aItem, - final ItemStack aStack, - final EntityPlayer aPlayer, - final World aWorld, - final int aX, - final int aY, - final int aZ, - final int aSide, - final float hitX, - final float hitY, - final float hitZ) { + public boolean onItemUse(final Gregtech_MetaItem_Base aItem, final ItemStack aStack, final EntityPlayer aPlayer, + final World aWorld, final int aX, final int aY, final int aZ, final int aSide, final float hitX, + final float hitY, final float hitZ) { return false; } @Override - public boolean onItemUseFirst( - final Gregtech_MetaItem_Base aItem, - final ItemStack aStack, - final EntityPlayer aPlayer, - final World aWorld, - final int aX, - final int aY, - final int aZ, - final int aSide, - final float hitX, - final float hitY, - final float hitZ) { + public boolean onItemUseFirst(final Gregtech_MetaItem_Base aItem, final ItemStack aStack, + final EntityPlayer aPlayer, final World aWorld, final int aX, final int aY, final int aZ, final int aSide, + final float hitX, final float hitY, final float hitZ) { return false; } @Override - public ItemStack onItemRightClick( - final Gregtech_MetaItem_Base aItem, - final ItemStack aStack, - final World aWorld, + public ItemStack onItemRightClick(final Gregtech_MetaItem_Base aItem, final ItemStack aStack, final World aWorld, final EntityPlayer aPlayer) { return aStack; } @Override - public List<String> getAdditionalToolTips( - final Gregtech_MetaItem_Base aItem, final List<String> aList, final ItemStack aStack) { + public List<String> getAdditionalToolTips(final Gregtech_MetaItem_Base aItem, final List<String> aList, + final ItemStack aStack) { return aList; } @Override - public void onUpdate( - final Gregtech_MetaItem_Base aItem, - final ItemStack aStack, - final World aWorld, - final Entity aPlayer, - final int aTimer, - final boolean aIsInHand) {} + public void onUpdate(final Gregtech_MetaItem_Base aItem, final ItemStack aStack, final World aWorld, + final Entity aPlayer, final int aTimer, final boolean aIsInHand) {} @Override public boolean isItemStackUsable(final Gregtech_MetaItem_Base aItem, final ItemStack aStack) { @@ -93,8 +67,8 @@ public class ToolType_Base implements Interface_ItemBehaviour<Gregtech_MetaItem_ } @Override - public ItemStack onDispense( - final Gregtech_MetaItem_Base aItem, final IBlockSource aSource, final ItemStack aStack) { + public ItemStack onDispense(final Gregtech_MetaItem_Base aItem, final IBlockSource aSource, + final ItemStack aStack) { final EnumFacing enumfacing = BlockDispenser.func_149937_b(aSource.getBlockMetadata()); final IPosition iposition = BlockDispenser.func_149939_a(aSource); final ItemStack itemstack1 = aStack.splitStack(1); @@ -103,31 +77,20 @@ public class ToolType_Base implements Interface_ItemBehaviour<Gregtech_MetaItem_ } @Override - public boolean hasProjectile( - final Gregtech_MetaItem_Base aItem, final SubTag aProjectileType, final ItemStack aStack) { + public boolean hasProjectile(final Gregtech_MetaItem_Base aItem, final SubTag aProjectileType, + final ItemStack aStack) { return false; } @Override - public EntityArrow getProjectile( - final Gregtech_MetaItem_Base aItem, - final SubTag aProjectileType, - final ItemStack aStack, - final World aWorld, - final double aX, - final double aY, - final double aZ) { + public EntityArrow getProjectile(final Gregtech_MetaItem_Base aItem, final SubTag aProjectileType, + final ItemStack aStack, final World aWorld, final double aX, final double aY, final double aZ) { return null; } @Override - public EntityArrow getProjectile( - final Gregtech_MetaItem_Base aItem, - final SubTag aProjectileType, - final ItemStack aStack, - final World aWorld, - final EntityLivingBase aEntity, - final float aSpeed) { + public EntityArrow getProjectile(final Gregtech_MetaItem_Base aItem, final SubTag aProjectileType, + final ItemStack aStack, final World aWorld, final EntityLivingBase aEntity, final float aSpeed) { return null; } } diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/api/items/types/ToolType_HardHammer.java b/src/main/java/gtPlusPlus/xmod/gregtech/api/items/types/ToolType_HardHammer.java index 49063c43c2..6ed462d31f 100644 --- a/src/main/java/gtPlusPlus/xmod/gregtech/api/items/types/ToolType_HardHammer.java +++ b/src/main/java/gtPlusPlus/xmod/gregtech/api/items/types/ToolType_HardHammer.java @@ -1,15 +1,8 @@ package gtPlusPlus.xmod.gregtech.api.items.types; -import gregtech.api.GregTech_API; -import gregtech.api.enums.Materials; -import gregtech.api.items.GT_MetaBase_Item; -import gregtech.api.items.GT_MetaGenerated_Tool; -import gregtech.api.objects.ItemData; -import gregtech.api.util.*; -import gregtech.common.blocks.GT_Block_Ores; -import gregtech.common.blocks.GT_TileEntity_Ores; import java.util.List; import java.util.Random; + import net.minecraft.block.Block; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.init.Blocks; @@ -19,29 +12,30 @@ import net.minecraft.world.World; import net.minecraftforge.common.util.ForgeDirection; import net.minecraftforge.fluids.IFluidBlock; +import gregtech.api.GregTech_API; +import gregtech.api.enums.Materials; +import gregtech.api.items.GT_MetaBase_Item; +import gregtech.api.items.GT_MetaGenerated_Tool; +import gregtech.api.objects.ItemData; +import gregtech.api.util.*; +import gregtech.common.blocks.GT_Block_Ores; +import gregtech.common.blocks.GT_TileEntity_Ores; + public class ToolType_HardHammer extends ToolType_Base { + private final int mVanillaCosts; private final int mEUCosts; - private final String mTooltip = - GT_LanguageManager.addStringLocalization("gt.behaviour.prospecting", "Usable for Prospecting"); + private final String mTooltip = GT_LanguageManager + .addStringLocalization("gt.behaviour.prospecting", "Usable for Prospecting"); public ToolType_HardHammer(final int aVanillaCosts, final int aEUCosts) { this.mVanillaCosts = aVanillaCosts; this.mEUCosts = aEUCosts; } - public boolean onItemUseFirst( - final GT_MetaBase_Item aItem, - final ItemStack aStack, - final EntityPlayer aPlayer, - final World aWorld, - final int aX, - final int aY, - final int aZ, - final int aSide, - final float hitX, - final float hitY, - final float hitZ) { + public boolean onItemUseFirst(final GT_MetaBase_Item aItem, final ItemStack aStack, final EntityPlayer aPlayer, + final World aWorld, final int aX, final int aY, final int aZ, final int aSide, final float hitX, + final float hitY, final float hitZ) { if (aWorld.isRemote) { return false; } @@ -54,9 +48,16 @@ public class ToolType_HardHammer extends ToolType_Base { ItemData tAssotiation = GT_OreDictUnificator.getAssociation(new ItemStack(aBlock, 1, aMeta)); if ((tAssotiation != null) && (tAssotiation.mPrefix.toString().startsWith("ore"))) { GT_Utility.sendChatToPlayer( - aPlayer, "This is " + tAssotiation.mMaterial.mMaterial.mDefaultLocalName + " Ore."); + aPlayer, + "This is " + tAssotiation.mMaterial.mMaterial.mDefaultLocalName + " Ore."); GT_Utility.sendSoundToPlayers( - aWorld, GregTech_API.sSoundList.get(Integer.valueOf(1)), 1.0F, -1.0F, aX, aY, aZ); + aWorld, + GregTech_API.sSoundList.get(Integer.valueOf(1)), + 1.0F, + -1.0F, + aX, + aY, + aZ); return true; } if ((aBlock.isReplaceableOreGen(aWorld, aX, aY, aZ, Blocks.stone)) @@ -65,7 +66,13 @@ public class ToolType_HardHammer extends ToolType_Base { || (aBlock.isReplaceableOreGen(aWorld, aX, aY, aZ, Blocks.end_stone))) { if (GT_ModHandler.damageOrDechargeItem(aStack, this.mVanillaCosts, this.mEUCosts, aPlayer)) { GT_Utility.sendSoundToPlayers( - aWorld, GregTech_API.sSoundList.get(Integer.valueOf(1)), 1.0F, -1.0F, aX, aY, aZ); + aWorld, + GregTech_API.sSoundList.get(Integer.valueOf(1)), + 1.0F, + -1.0F, + aX, + aY, + aZ); int tX = aX; int tY = aY; int tZ = aZ; @@ -85,8 +92,7 @@ public class ToolType_HardHammer extends ToolType_Base { GT_Utility.sendChatToPlayer(aPlayer, "There is Lava behind this Rock."); break; } - if ((tBlock == Blocks.water) - || (tBlock == Blocks.flowing_water) + if ((tBlock == Blocks.water) || (tBlock == Blocks.flowing_water) || ((tBlock instanceof IFluidBlock))) { GT_Utility.sendChatToPlayer(aPlayer, "There is a Liquid behind this Rock."); break; @@ -113,19 +119,19 @@ public class ToolType_HardHammer extends ToolType_Base { if ((tBlock instanceof GT_Block_Ores)) { final TileEntity tTileEntity = aWorld.getTileEntity(tX, tY, tZ); if ((tTileEntity instanceof GT_TileEntity_Ores)) { - final Materials tMaterial = GregTech_API.sGeneratedMaterials[ - (((GT_TileEntity_Ores) tTileEntity).mMetaData % 1000)]; + final Materials tMaterial = GregTech_API.sGeneratedMaterials[(((GT_TileEntity_Ores) tTileEntity).mMetaData + % 1000)]; if ((tMaterial != null) && (tMaterial != Materials._NULL)) { GT_Utility.sendChatToPlayer( - aPlayer, "Found traces of " + tMaterial.mDefaultLocalName + " Ore."); + aPlayer, + "Found traces of " + tMaterial.mDefaultLocalName + " Ore."); return true; } } } else { tMetaID = aWorld.getBlockMetadata(tX, tY, tZ); 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"))) { GT_Utility.sendChatToPlayer( aPlayer, "Found traces of " + tAssotiation.mMaterial.mMaterial.mDefaultLocalName + " Ore."); @@ -140,8 +146,8 @@ public class ToolType_HardHammer extends ToolType_Base { return false; } - public List<String> getAdditionalToolTips( - final GT_MetaBase_Item aItem, final List<String> aList, final ItemStack aStack) { + public List<String> getAdditionalToolTips(final GT_MetaBase_Item aItem, final List<String> aList, + final ItemStack aStack) { aList.add(this.mTooltip); return aList; } diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/api/items/types/ToolType_Pump.java b/src/main/java/gtPlusPlus/xmod/gregtech/api/items/types/ToolType_Pump.java index f1dd3b391d..1504b45d8e 100644 --- a/src/main/java/gtPlusPlus/xmod/gregtech/api/items/types/ToolType_Pump.java +++ b/src/main/java/gtPlusPlus/xmod/gregtech/api/items/types/ToolType_Pump.java @@ -1,36 +1,30 @@ package gtPlusPlus.xmod.gregtech.api.items.types; -import gregtech.api.items.GT_MetaBase_Item; -import gregtech.api.util.GT_LanguageManager; -import gregtech.api.util.GT_Utility; import java.util.List; + 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.items.GT_MetaBase_Item; +import gregtech.api.util.GT_LanguageManager; +import gregtech.api.util.GT_Utility; + public class ToolType_Pump extends ToolType_Base { + private final int mCosts; - private final String mTooltip = GT_LanguageManager.addStringLocalization( - "gt.behaviour.pump", "Sucks in Machine Input Fluid tank contents on Rightclick"); + private final String mTooltip = GT_LanguageManager + .addStringLocalization("gt.behaviour.pump", "Sucks in Machine Input Fluid tank contents on Rightclick"); public ToolType_Pump(final int aCosts) { this.mCosts = aCosts; } - public boolean onItemUseFirst( - final GT_MetaBase_Item aItem, - final ItemStack aStack, - final EntityPlayer aPlayer, - final World aWorld, - final int aX, - final int aY, - final int aZ, - final int aSide, - final float hitX, - final float hitY, - final float hitZ) { + public boolean onItemUseFirst(final GT_MetaBase_Item aItem, final ItemStack aStack, final EntityPlayer aPlayer, + final World aWorld, final int aX, final int aY, final int aZ, final int aSide, final float hitX, + final float hitY, final float hitZ) { if (aWorld.isRemote) { return false; } @@ -41,110 +35,72 @@ public class ToolType_Pump extends ToolType_Base { final byte aMeta = (byte) aWorld.getBlockMetadata(aX, aY, aZ); final byte aTargetSide = GT_Utility.determineWrenchingSide((byte) aSide, hitX, hitY, hitZ); final TileEntity aTileEntity = aWorld.getTileEntity(aX, aY, aZ); - /*try { - if ((aTileEntity != null) && ((aTileEntity instanceof IWrenchable))) { - if (((IWrenchable) aTileEntity).wrenchCanSetFacing(aPlayer, aTargetSide)) { - if ((aPlayer.capabilities.isCreativeMode) || (((GT_MetaGenerated_Tool) aItem).doDamage(aStack, this.mCosts))) { - ((IWrenchable) aTileEntity).setFacing(aTargetSide); - GT_Utility.sendSoundToPlayers(aWorld, GregTech_API.sSoundList.get(Integer.valueOf(100)), 1.0F, -1.0F, aX, aY, aZ); - } - return true; - } - if (((IWrenchable) aTileEntity).wrenchCanRemove(aPlayer)) { - final int tDamage = ((IWrenchable) aTileEntity).getWrenchDropRate() < 1.0F ? 10 : 3; - if ((aPlayer.capabilities.isCreativeMode) || (((GT_MetaGenerated_Tool) aItem).doDamage(aStack, tDamage * this.mCosts))) { - ItemStack tOutput = ((IWrenchable) aTileEntity).getWrenchDrop(aPlayer); - for (final ItemStack tStack : aBlock.getDrops(aWorld, aX, aY, aZ, aMeta, 0)) { - if (tOutput == null) { - aWorld.spawnEntityInWorld(new EntityItem(aWorld, aX + 0.5D, aY + 0.5D, aZ + 0.5D, tStack)); - } else { - aWorld.spawnEntityInWorld(new EntityItem(aWorld, aX + 0.5D, aY + 0.5D, aZ + 0.5D, tOutput)); - tOutput = null; - } - } - aWorld.setBlockToAir(aX, aY, aZ); - GT_Utility.sendSoundToPlayers(aWorld, GregTech_API.sSoundList.get(Integer.valueOf(100)), 1.0F, -1.0F, aX, aY, aZ); - } - return true; - } - return true; - } - } catch (final Throwable e) { - } - if ((aBlock == Blocks.log) || (aBlock == Blocks.log2) || (aBlock == Blocks.hay_block)) { - if ((aPlayer.capabilities.isCreativeMode) || (((GT_MetaGenerated_Tool) aItem).doDamage(aStack, this.mCosts))) { - aWorld.setBlockMetadataWithNotify(aX, aY, aZ, (aMeta + 4) % 12, 3); - GT_Utility.sendSoundToPlayers(aWorld, GregTech_API.sSoundList.get(Integer.valueOf(100)), 1.0F, -1.0F, aX, aY, aZ); - } - return true; - } - if ((aBlock == Blocks.powered_repeater) || (aBlock == Blocks.unpowered_repeater)) { - if ((aPlayer.capabilities.isCreativeMode) || (((GT_MetaGenerated_Tool) aItem).doDamage(aStack, this.mCosts))) { - aWorld.setBlockMetadataWithNotify(aX, aY, aZ, ((aMeta / 4) * 4) + (((aMeta % 4) + 1) % 4), 3); - GT_Utility.sendSoundToPlayers(aWorld, GregTech_API.sSoundList.get(Integer.valueOf(100)), 1.0F, -1.0F, aX, aY, aZ); - } - return true; - } - if ((aBlock == Blocks.powered_comparator) || (aBlock == Blocks.unpowered_comparator)) { - if ((aPlayer.capabilities.isCreativeMode) || (((GT_MetaGenerated_Tool) aItem).doDamage(aStack, this.mCosts))) { - aWorld.setBlockMetadataWithNotify(aX, aY, aZ, ((aMeta / 4) * 4) + (((aMeta % 4) + 1) % 4), 3); - GT_Utility.sendSoundToPlayers(aWorld, GregTech_API.sSoundList.get(Integer.valueOf(100)), 1.0F, -1.0F, aX, aY, aZ); - } - return true; - } - if ((aBlock == Blocks.crafting_table) || (aBlock == Blocks.bookshelf)) { - if ((aPlayer.capabilities.isCreativeMode) || (((GT_MetaGenerated_Tool) aItem).doDamage(aStack, this.mCosts))) { - aWorld.spawnEntityInWorld(new EntityItem(aWorld, aX + 0.5D, aY + 0.5D, aZ + 0.5D, new ItemStack(aBlock, 1, aMeta))); - aWorld.setBlockToAir(aX, aY, aZ); - GT_Utility.sendSoundToPlayers(aWorld, GregTech_API.sSoundList.get(Integer.valueOf(100)), 1.0F, -1.0F, aX, aY, aZ); - } - return true; - } - if (aMeta == aTargetSide) { - if ((aBlock == Blocks.pumpkin) || (aBlock == Blocks.lit_pumpkin) || (aBlock == Blocks.piston) || (aBlock == Blocks.sticky_piston) || (aBlock == Blocks.dispenser) || (aBlock == Blocks.dropper) || (aBlock == Blocks.furnace) || (aBlock == Blocks.lit_furnace) || (aBlock == Blocks.chest) || (aBlock == Blocks.trapped_chest) || (aBlock == Blocks.ender_chest) || (aBlock == Blocks.hopper)) { - if ((aPlayer.capabilities.isCreativeMode) || (((GT_MetaGenerated_Tool) aItem).doDamage(aStack, this.mCosts))) { - aWorld.spawnEntityInWorld(new EntityItem(aWorld, aX + 0.5D, aY + 0.5D, aZ + 0.5D, new ItemStack(aBlock, 1, 0))); - aWorld.setBlockToAir(aX, aY, aZ); - GT_Utility.sendSoundToPlayers(aWorld, GregTech_API.sSoundList.get(Integer.valueOf(100)), 1.0F, -1.0F, aX, aY, aZ); - } - return true; - } - } else { - if ((aBlock == Blocks.piston) || (aBlock == Blocks.sticky_piston) || (aBlock == Blocks.dispenser) || (aBlock == Blocks.dropper)) { - if ((aMeta < 6) && ((aPlayer.capabilities.isCreativeMode) || (((GT_MetaGenerated_Tool) aItem).doDamage(aStack, this.mCosts)))) { - aWorld.setBlockMetadataWithNotify(aX, aY, aZ, aTargetSide, 3); - GT_Utility.sendSoundToPlayers(aWorld, GregTech_API.sSoundList.get(Integer.valueOf(100)), 1.0F, -1.0F, aX, aY, aZ); - } - return true; - } - if ((aBlock == Blocks.pumpkin) || (aBlock == Blocks.lit_pumpkin) || (aBlock == Blocks.furnace) || (aBlock == Blocks.lit_furnace) || (aBlock == Blocks.chest) || (aBlock == Blocks.ender_chest) || (aBlock == Blocks.trapped_chest)) { - if ((aTargetSide > 1) && ((aPlayer.capabilities.isCreativeMode) || (((GT_MetaGenerated_Tool) aItem).doDamage(aStack, this.mCosts)))) { - aWorld.setBlockMetadataWithNotify(aX, aY, aZ, aTargetSide, 3); - GT_Utility.sendSoundToPlayers(aWorld, GregTech_API.sSoundList.get(Integer.valueOf(100)), 1.0F, -1.0F, aX, aY, aZ); - } - return true; - } - if (aBlock == Blocks.hopper) { - if ((aTargetSide != 1) && ((aPlayer.capabilities.isCreativeMode) || (((GT_MetaGenerated_Tool) aItem).doDamage(aStack, this.mCosts)))) { - aWorld.setBlockMetadataWithNotify(aX, aY, aZ, aTargetSide, 3); - GT_Utility.sendSoundToPlayers(aWorld, GregTech_API.sSoundList.get(Integer.valueOf(100)), 1.0F, -1.0F, aX, aY, aZ); - } - return true; - } - } - if ((Arrays.asList(aBlock.getValidRotations(aWorld, aX, aY, aZ)).contains(ForgeDirection.getOrientation(aTargetSide))) && - ((aPlayer.capabilities.isCreativeMode) || (!GT_ModHandler.isElectricItem(aStack)) || (GT_ModHandler.canUseElectricItem(aStack, this.mCosts))) && - (aBlock.rotateBlock(aWorld, aX, aY, aZ, ForgeDirection.getOrientation(aTargetSide)))) { - if (!aPlayer.capabilities.isCreativeMode) { - ((GT_MetaGenerated_Tool) aItem).doDamage(aStack, this.mCosts); - } - GT_Utility.sendSoundToPlayers(aWorld, GregTech_API.sSoundList.get(Integer.valueOf(100)), 1.0F, -1.0F, aX, aY, aZ); - }*/ + /* + * try { if ((aTileEntity != null) && ((aTileEntity instanceof IWrenchable))) { if (((IWrenchable) + * aTileEntity).wrenchCanSetFacing(aPlayer, aTargetSide)) { if ((aPlayer.capabilities.isCreativeMode) || + * (((GT_MetaGenerated_Tool) aItem).doDamage(aStack, this.mCosts))) { ((IWrenchable) + * aTileEntity).setFacing(aTargetSide); GT_Utility.sendSoundToPlayers(aWorld, + * GregTech_API.sSoundList.get(Integer.valueOf(100)), 1.0F, -1.0F, aX, aY, aZ); } return true; } if + * (((IWrenchable) aTileEntity).wrenchCanRemove(aPlayer)) { final int tDamage = ((IWrenchable) + * aTileEntity).getWrenchDropRate() < 1.0F ? 10 : 3; if ((aPlayer.capabilities.isCreativeMode) || + * (((GT_MetaGenerated_Tool) aItem).doDamage(aStack, tDamage * this.mCosts))) { ItemStack tOutput = + * ((IWrenchable) aTileEntity).getWrenchDrop(aPlayer); for (final ItemStack tStack : aBlock.getDrops(aWorld, aX, + * aY, aZ, aMeta, 0)) { if (tOutput == null) { aWorld.spawnEntityInWorld(new EntityItem(aWorld, aX + 0.5D, aY + + * 0.5D, aZ + 0.5D, tStack)); } else { aWorld.spawnEntityInWorld(new EntityItem(aWorld, aX + 0.5D, aY + 0.5D, aZ + * + 0.5D, tOutput)); tOutput = null; } } aWorld.setBlockToAir(aX, aY, aZ); + * GT_Utility.sendSoundToPlayers(aWorld, GregTech_API.sSoundList.get(Integer.valueOf(100)), 1.0F, -1.0F, aX, aY, + * aZ); } return true; } return true; } } catch (final Throwable e) { } if ((aBlock == Blocks.log) || (aBlock == + * Blocks.log2) || (aBlock == Blocks.hay_block)) { if ((aPlayer.capabilities.isCreativeMode) || + * (((GT_MetaGenerated_Tool) aItem).doDamage(aStack, this.mCosts))) { aWorld.setBlockMetadataWithNotify(aX, aY, + * aZ, (aMeta + 4) % 12, 3); GT_Utility.sendSoundToPlayers(aWorld, + * GregTech_API.sSoundList.get(Integer.valueOf(100)), 1.0F, -1.0F, aX, aY, aZ); } return true; } if ((aBlock == + * Blocks.powered_repeater) || (aBlock == Blocks.unpowered_repeater)) { if + * ((aPlayer.capabilities.isCreativeMode) || (((GT_MetaGenerated_Tool) aItem).doDamage(aStack, this.mCosts))) { + * aWorld.setBlockMetadataWithNotify(aX, aY, aZ, ((aMeta / 4) * 4) + (((aMeta % 4) + 1) % 4), 3); + * GT_Utility.sendSoundToPlayers(aWorld, GregTech_API.sSoundList.get(Integer.valueOf(100)), 1.0F, -1.0F, aX, aY, + * aZ); } return true; } if ((aBlock == Blocks.powered_comparator) || (aBlock == Blocks.unpowered_comparator)) { + * if ((aPlayer.capabilities.isCreativeMode) || (((GT_MetaGenerated_Tool) aItem).doDamage(aStack, this.mCosts))) + * { aWorld.setBlockMetadataWithNotify(aX, aY, aZ, ((aMeta / 4) * 4) + (((aMeta % 4) + 1) % 4), 3); + * GT_Utility.sendSoundToPlayers(aWorld, GregTech_API.sSoundList.get(Integer.valueOf(100)), 1.0F, -1.0F, aX, aY, + * aZ); } return true; } if ((aBlock == Blocks.crafting_table) || (aBlock == Blocks.bookshelf)) { if + * ((aPlayer.capabilities.isCreativeMode) || (((GT_MetaGenerated_Tool) aItem).doDamage(aStack, this.mCosts))) { + * aWorld.spawnEntityInWorld(new EntityItem(aWorld, aX + 0.5D, aY + 0.5D, aZ + 0.5D, new ItemStack(aBlock, 1, + * aMeta))); aWorld.setBlockToAir(aX, aY, aZ); GT_Utility.sendSoundToPlayers(aWorld, + * GregTech_API.sSoundList.get(Integer.valueOf(100)), 1.0F, -1.0F, aX, aY, aZ); } return true; } if (aMeta == + * aTargetSide) { if ((aBlock == Blocks.pumpkin) || (aBlock == Blocks.lit_pumpkin) || (aBlock == Blocks.piston) + * || (aBlock == Blocks.sticky_piston) || (aBlock == Blocks.dispenser) || (aBlock == Blocks.dropper) || (aBlock + * == Blocks.furnace) || (aBlock == Blocks.lit_furnace) || (aBlock == Blocks.chest) || (aBlock == + * Blocks.trapped_chest) || (aBlock == Blocks.ender_chest) || (aBlock == Blocks.hopper)) { if + * ((aPlayer.capabilities.isCreativeMode) || (((GT_MetaGenerated_Tool) aItem).doDamage(aStack, this.mCosts))) { + * aWorld.spawnEntityInWorld(new EntityItem(aWorld, aX + 0.5D, aY + 0.5D, aZ + 0.5D, new ItemStack(aBlock, 1, + * 0))); aWorld.setBlockToAir(aX, aY, aZ); GT_Utility.sendSoundToPlayers(aWorld, + * GregTech_API.sSoundList.get(Integer.valueOf(100)), 1.0F, -1.0F, aX, aY, aZ); } return true; } } else { if + * ((aBlock == Blocks.piston) || (aBlock == Blocks.sticky_piston) || (aBlock == Blocks.dispenser) || (aBlock == + * Blocks.dropper)) { if ((aMeta < 6) && ((aPlayer.capabilities.isCreativeMode) || (((GT_MetaGenerated_Tool) + * aItem).doDamage(aStack, this.mCosts)))) { aWorld.setBlockMetadataWithNotify(aX, aY, aZ, aTargetSide, 3); + * GT_Utility.sendSoundToPlayers(aWorld, GregTech_API.sSoundList.get(Integer.valueOf(100)), 1.0F, -1.0F, aX, aY, + * aZ); } return true; } if ((aBlock == Blocks.pumpkin) || (aBlock == Blocks.lit_pumpkin) || (aBlock == + * Blocks.furnace) || (aBlock == Blocks.lit_furnace) || (aBlock == Blocks.chest) || (aBlock == + * Blocks.ender_chest) || (aBlock == Blocks.trapped_chest)) { if ((aTargetSide > 1) && + * ((aPlayer.capabilities.isCreativeMode) || (((GT_MetaGenerated_Tool) aItem).doDamage(aStack, this.mCosts)))) { + * aWorld.setBlockMetadataWithNotify(aX, aY, aZ, aTargetSide, 3); GT_Utility.sendSoundToPlayers(aWorld, + * GregTech_API.sSoundList.get(Integer.valueOf(100)), 1.0F, -1.0F, aX, aY, aZ); } return true; } if (aBlock == + * Blocks.hopper) { if ((aTargetSide != 1) && ((aPlayer.capabilities.isCreativeMode) || + * (((GT_MetaGenerated_Tool) aItem).doDamage(aStack, this.mCosts)))) { aWorld.setBlockMetadataWithNotify(aX, aY, + * aZ, aTargetSide, 3); GT_Utility.sendSoundToPlayers(aWorld, GregTech_API.sSoundList.get(Integer.valueOf(100)), + * 1.0F, -1.0F, aX, aY, aZ); } return true; } } if ((Arrays.asList(aBlock.getValidRotations(aWorld, aX, aY, + * aZ)).contains(ForgeDirection.getOrientation(aTargetSide))) && ((aPlayer.capabilities.isCreativeMode) || + * (!GT_ModHandler.isElectricItem(aStack)) || (GT_ModHandler.canUseElectricItem(aStack, this.mCosts))) && + * (aBlock.rotateBlock(aWorld, aX, aY, aZ, ForgeDirection.getOrientation(aTargetSide)))) { if + * (!aPlayer.capabilities.isCreativeMode) { ((GT_MetaGenerated_Tool) aItem).doDamage(aStack, this.mCosts); } + * GT_Utility.sendSoundToPlayers(aWorld, GregTech_API.sSoundList.get(Integer.valueOf(100)), 1.0F, -1.0F, aX, aY, + * aZ); } + */ return false; } - public List<String> getAdditionalToolTips( - final GT_MetaBase_Item aItem, final List<String> aList, final ItemStack aStack) { + public List<String> getAdditionalToolTips(final GT_MetaBase_Item aItem, final List<String> aList, + final ItemStack aStack) { aList.add(this.mTooltip); return aList; } diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/api/items/types/ToolType_Wrench.java b/src/main/java/gtPlusPlus/xmod/gregtech/api/items/types/ToolType_Wrench.java index 6c12663bb6..acd48785f4 100644 --- a/src/main/java/gtPlusPlus/xmod/gregtech/api/items/types/ToolType_Wrench.java +++ b/src/main/java/gtPlusPlus/xmod/gregtech/api/items/types/ToolType_Wrench.java @@ -1,14 +1,8 @@ package gtPlusPlus.xmod.gregtech.api.items.types; -import gregtech.api.GregTech_API; -import gregtech.api.items.GT_MetaBase_Item; -import gregtech.api.items.GT_MetaGenerated_Tool; -import gregtech.api.util.GT_LanguageManager; -import gregtech.api.util.GT_ModHandler; -import gregtech.api.util.GT_Utility; -import ic2.api.tile.IWrenchable; import java.util.Arrays; import java.util.List; + import net.minecraft.block.Block; import net.minecraft.entity.item.EntityItem; import net.minecraft.entity.player.EntityPlayer; @@ -18,27 +12,27 @@ import net.minecraft.tileentity.TileEntity; import net.minecraft.world.World; import net.minecraftforge.common.util.ForgeDirection; +import gregtech.api.GregTech_API; +import gregtech.api.items.GT_MetaBase_Item; +import gregtech.api.items.GT_MetaGenerated_Tool; +import gregtech.api.util.GT_LanguageManager; +import gregtech.api.util.GT_ModHandler; +import gregtech.api.util.GT_Utility; +import ic2.api.tile.IWrenchable; + public class ToolType_Wrench extends ToolType_Base { + private final int mCosts; - private final String mTooltip = - GT_LanguageManager.addStringLocalization("gt.behaviour.wrench", "Rotates Blocks on Rightclick"); + private final String mTooltip = GT_LanguageManager + .addStringLocalization("gt.behaviour.wrench", "Rotates Blocks on Rightclick"); public ToolType_Wrench(final int aCosts) { this.mCosts = aCosts; } - public boolean onItemUseFirst( - final GT_MetaBase_Item aItem, - final ItemStack aStack, - final EntityPlayer aPlayer, - final World aWorld, - final int aX, - final int aY, - final int aZ, - final int aSide, - final float hitX, - final float hitY, - final float hitZ) { + public boolean onItemUseFirst(final GT_MetaBase_Item aItem, final ItemStack aStack, final EntityPlayer aPlayer, + final World aWorld, final int aX, final int aY, final int aZ, final int aSide, final float hitX, + final float hitY, final float hitZ) { if (aWorld.isRemote) { return false; } @@ -56,7 +50,13 @@ public class ToolType_Wrench extends ToolType_Base { || (((GT_MetaGenerated_Tool) aItem).doDamage(aStack, this.mCosts))) { ((IWrenchable) aTileEntity).setFacing(aTargetSide); GT_Utility.sendSoundToPlayers( - aWorld, GregTech_API.sSoundList.get(Integer.valueOf(100)), 1.0F, -1.0F, aX, aY, aZ); + aWorld, + GregTech_API.sSoundList.get(Integer.valueOf(100)), + 1.0F, + -1.0F, + aX, + aY, + aZ); } return true; } @@ -77,20 +77,31 @@ public class ToolType_Wrench extends ToolType_Base { } aWorld.setBlockToAir(aX, aY, aZ); GT_Utility.sendSoundToPlayers( - aWorld, GregTech_API.sSoundList.get(Integer.valueOf(100)), 1.0F, -1.0F, aX, aY, aZ); + aWorld, + GregTech_API.sSoundList.get(Integer.valueOf(100)), + 1.0F, + -1.0F, + aX, + aY, + aZ); } return true; } return true; } - } catch (final Throwable e) { - } + } catch (final Throwable e) {} if ((aBlock == Blocks.log) || (aBlock == Blocks.log2) || (aBlock == Blocks.hay_block)) { if ((aPlayer.capabilities.isCreativeMode) || (((GT_MetaGenerated_Tool) aItem).doDamage(aStack, this.mCosts))) { aWorld.setBlockMetadataWithNotify(aX, aY, aZ, (aMeta + 4) % 12, 3); GT_Utility.sendSoundToPlayers( - aWorld, GregTech_API.sSoundList.get(Integer.valueOf(100)), 1.0F, -1.0F, aX, aY, aZ); + aWorld, + GregTech_API.sSoundList.get(Integer.valueOf(100)), + 1.0F, + -1.0F, + aX, + aY, + aZ); } return true; } @@ -99,7 +110,13 @@ public class ToolType_Wrench extends ToolType_Base { || (((GT_MetaGenerated_Tool) aItem).doDamage(aStack, this.mCosts))) { aWorld.setBlockMetadataWithNotify(aX, aY, aZ, ((aMeta / 4) * 4) + (((aMeta % 4) + 1) % 4), 3); GT_Utility.sendSoundToPlayers( - aWorld, GregTech_API.sSoundList.get(Integer.valueOf(100)), 1.0F, -1.0F, aX, aY, aZ); + aWorld, + GregTech_API.sSoundList.get(Integer.valueOf(100)), + 1.0F, + -1.0F, + aX, + aY, + aZ); } return true; } @@ -108,7 +125,13 @@ public class ToolType_Wrench extends ToolType_Base { || (((GT_MetaGenerated_Tool) aItem).doDamage(aStack, this.mCosts))) { aWorld.setBlockMetadataWithNotify(aX, aY, aZ, ((aMeta / 4) * 4) + (((aMeta % 4) + 1) % 4), 3); GT_Utility.sendSoundToPlayers( - aWorld, GregTech_API.sSoundList.get(Integer.valueOf(100)), 1.0F, -1.0F, aX, aY, aZ); + aWorld, + GregTech_API.sSoundList.get(Integer.valueOf(100)), + 1.0F, + -1.0F, + aX, + aY, + aZ); } return true; } @@ -119,13 +142,18 @@ public class ToolType_Wrench extends ToolType_Base { new EntityItem(aWorld, aX + 0.5D, aY + 0.5D, aZ + 0.5D, new ItemStack(aBlock, 1, aMeta))); aWorld.setBlockToAir(aX, aY, aZ); GT_Utility.sendSoundToPlayers( - aWorld, GregTech_API.sSoundList.get(Integer.valueOf(100)), 1.0F, -1.0F, aX, aY, aZ); + aWorld, + GregTech_API.sSoundList.get(Integer.valueOf(100)), + 1.0F, + -1.0F, + aX, + aY, + aZ); } return true; } if (aMeta == aTargetSide) { - if ((aBlock == Blocks.pumpkin) - || (aBlock == Blocks.lit_pumpkin) + if ((aBlock == Blocks.pumpkin) || (aBlock == Blocks.lit_pumpkin) || (aBlock == Blocks.piston) || (aBlock == Blocks.sticky_piston) || (aBlock == Blocks.dispenser) @@ -142,68 +170,92 @@ public class ToolType_Wrench extends ToolType_Base { new EntityItem(aWorld, aX + 0.5D, aY + 0.5D, aZ + 0.5D, new ItemStack(aBlock, 1, 0))); aWorld.setBlockToAir(aX, aY, aZ); GT_Utility.sendSoundToPlayers( - aWorld, GregTech_API.sSoundList.get(Integer.valueOf(100)), 1.0F, -1.0F, aX, aY, aZ); + aWorld, + GregTech_API.sSoundList.get(Integer.valueOf(100)), + 1.0F, + -1.0F, + aX, + aY, + aZ); } return true; } } else { - if ((aBlock == Blocks.piston) - || (aBlock == Blocks.sticky_piston) + if ((aBlock == Blocks.piston) || (aBlock == Blocks.sticky_piston) || (aBlock == Blocks.dispenser) || (aBlock == Blocks.dropper)) { - if ((aMeta < 6) - && ((aPlayer.capabilities.isCreativeMode) - || (((GT_MetaGenerated_Tool) aItem).doDamage(aStack, this.mCosts)))) { + if ((aMeta < 6) && ((aPlayer.capabilities.isCreativeMode) + || (((GT_MetaGenerated_Tool) aItem).doDamage(aStack, this.mCosts)))) { aWorld.setBlockMetadataWithNotify(aX, aY, aZ, aTargetSide, 3); GT_Utility.sendSoundToPlayers( - aWorld, GregTech_API.sSoundList.get(Integer.valueOf(100)), 1.0F, -1.0F, aX, aY, aZ); + aWorld, + GregTech_API.sSoundList.get(Integer.valueOf(100)), + 1.0F, + -1.0F, + aX, + aY, + aZ); } return true; } - if ((aBlock == Blocks.pumpkin) - || (aBlock == Blocks.lit_pumpkin) + if ((aBlock == Blocks.pumpkin) || (aBlock == Blocks.lit_pumpkin) || (aBlock == Blocks.furnace) || (aBlock == Blocks.lit_furnace) || (aBlock == Blocks.chest) || (aBlock == Blocks.ender_chest) || (aBlock == Blocks.trapped_chest)) { - if ((aTargetSide > 1) - && ((aPlayer.capabilities.isCreativeMode) - || (((GT_MetaGenerated_Tool) aItem).doDamage(aStack, this.mCosts)))) { + if ((aTargetSide > 1) && ((aPlayer.capabilities.isCreativeMode) + || (((GT_MetaGenerated_Tool) aItem).doDamage(aStack, this.mCosts)))) { aWorld.setBlockMetadataWithNotify(aX, aY, aZ, aTargetSide, 3); GT_Utility.sendSoundToPlayers( - aWorld, GregTech_API.sSoundList.get(Integer.valueOf(100)), 1.0F, -1.0F, aX, aY, aZ); + aWorld, + GregTech_API.sSoundList.get(Integer.valueOf(100)), + 1.0F, + -1.0F, + aX, + aY, + aZ); } return true; } if (aBlock == Blocks.hopper) { - if ((aTargetSide != 1) - && ((aPlayer.capabilities.isCreativeMode) - || (((GT_MetaGenerated_Tool) aItem).doDamage(aStack, this.mCosts)))) { + if ((aTargetSide != 1) && ((aPlayer.capabilities.isCreativeMode) + || (((GT_MetaGenerated_Tool) aItem).doDamage(aStack, this.mCosts)))) { aWorld.setBlockMetadataWithNotify(aX, aY, aZ, aTargetSide, 3); GT_Utility.sendSoundToPlayers( - aWorld, GregTech_API.sSoundList.get(Integer.valueOf(100)), 1.0F, -1.0F, aX, aY, aZ); + aWorld, + GregTech_API.sSoundList.get(Integer.valueOf(100)), + 1.0F, + -1.0F, + aX, + aY, + aZ); } return true; } } if ((Arrays.asList(aBlock.getValidRotations(aWorld, aX, aY, aZ)) - .contains(ForgeDirection.getOrientation(aTargetSide))) - && ((aPlayer.capabilities.isCreativeMode) - || (!GT_ModHandler.isElectricItem(aStack)) + .contains(ForgeDirection.getOrientation(aTargetSide))) + && ((aPlayer.capabilities.isCreativeMode) || (!GT_ModHandler.isElectricItem(aStack)) || (GT_ModHandler.canUseElectricItem(aStack, this.mCosts))) && (aBlock.rotateBlock(aWorld, aX, aY, aZ, ForgeDirection.getOrientation(aTargetSide)))) { if (!aPlayer.capabilities.isCreativeMode) { ((GT_MetaGenerated_Tool) aItem).doDamage(aStack, this.mCosts); } GT_Utility.sendSoundToPlayers( - aWorld, GregTech_API.sSoundList.get(Integer.valueOf(100)), 1.0F, -1.0F, aX, aY, aZ); + aWorld, + GregTech_API.sSoundList.get(Integer.valueOf(100)), + 1.0F, + -1.0F, + aX, + aY, + aZ); } return false; } - public List<String> getAdditionalToolTips( - final GT_MetaBase_Item aItem, final List<String> aList, final ItemStack aStack) { + public List<String> getAdditionalToolTips(final GT_MetaBase_Item aItem, final List<String> aList, + final ItemStack aStack) { aList.add(this.mTooltip); return aList; } diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/api/metatileentity/BaseCustomTileEntity.java b/src/main/java/gtPlusPlus/xmod/gregtech/api/metatileentity/BaseCustomTileEntity.java index a88105f7f6..aae4494f88 100644 --- a/src/main/java/gtPlusPlus/xmod/gregtech/api/metatileentity/BaseCustomTileEntity.java +++ b/src/main/java/gtPlusPlus/xmod/gregtech/api/metatileentity/BaseCustomTileEntity.java @@ -1,5 +1,13 @@ package gtPlusPlus.xmod.gregtech.api.metatileentity; +import java.lang.reflect.Field; +import java.util.ArrayList; +import java.util.Random; + +import net.minecraft.entity.item.EntityItem; +import net.minecraft.item.ItemStack; +import net.minecraft.nbt.NBTTagCompound; + import gregtech.GT_Mod; import gregtech.api.GregTech_API; import gregtech.api.enums.GT_Values; @@ -12,12 +20,6 @@ import gtPlusPlus.core.util.minecraft.gregtech.PollutionUtils; import gtPlusPlus.xmod.gregtech.api.interfaces.IBaseCustomMetaTileEntity; import gtPlusPlus.xmod.gregtech.common.StaticFields59; import ic2.api.Direction; -import java.lang.reflect.Field; -import java.util.ArrayList; -import java.util.Random; -import net.minecraft.entity.item.EntityItem; -import net.minecraft.item.ItemStack; -import net.minecraft.nbt.NBTTagCompound; public class BaseCustomTileEntity extends BaseMetaTileEntity implements IBaseCustomMetaTileEntity { @@ -76,16 +78,13 @@ public class BaseCustomTileEntity extends BaseMetaTileEntity implements IBaseCus } if (this.getUniversalEnergyCapacity() > 0L && this.getUniversalEnergyStored() >= this.getUniversalEnergyCapacity() / 5L) { - this.doExplosion(this.getOutput() - * (long) - (this.getUniversalEnergyStored() >= this.getUniversalEnergyCapacity() - ? 4 - : (this.getUniversalEnergyStored() >= this.getUniversalEnergyCapacity() / 2L - ? 2 - : 1))); + this.doExplosion( + this.getOutput() * (long) (this.getUniversalEnergyStored() >= this.getUniversalEnergyCapacity() ? 4 + : (this.getUniversalEnergyStored() >= this.getUniversalEnergyCapacity() / 2L ? 2 : 1))); GT_Mod arg9999 = GT_Mod.instance; GT_Mod.achievements.issueAchievement( - this.getWorldObj().getPlayerEntityByName(this.getOwnerName()), "electricproblems"); + this.getWorldObj().getPlayerEntityByName(this.getOwnerName()), + "electricproblems"); } } @@ -147,8 +146,7 @@ public class BaseCustomTileEntity extends BaseMetaTileEntity implements IBaseCus (double) ((float) this.zCoord + tRandom.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 = tRandom.nextGaussian() * 0.0500000007450581D; diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/api/metatileentity/custom/power/BaseCustomPower_MTE.java b/src/main/java/gtPlusPlus/xmod/gregtech/api/metatileentity/custom/power/BaseCustomPower_MTE.java index b3d8b8aa8c..ba67ba6466 100644 --- a/src/main/java/gtPlusPlus/xmod/gregtech/api/metatileentity/custom/power/BaseCustomPower_MTE.java +++ b/src/main/java/gtPlusPlus/xmod/gregtech/api/metatileentity/custom/power/BaseCustomPower_MTE.java @@ -1,10 +1,11 @@ package gtPlusPlus.xmod.gregtech.api.metatileentity.custom.power; +import net.minecraft.tileentity.TileEntity; +import net.minecraftforge.common.util.ForgeDirection; + import gtPlusPlus.api.objects.Logger; import gtPlusPlus.xmod.gregtech.api.metatileentity.BaseCustomTileEntity; import ic2.api.Direction; -import net.minecraft.tileentity.TileEntity; -import net.minecraftforge.common.util.ForgeDirection; public class BaseCustomPower_MTE extends BaseCustomTileEntity { @@ -21,8 +22,7 @@ public class BaseCustomPower_MTE extends BaseCustomTileEntity { if (mMetaTileEntity == null) { Logger.INFO("Bad Tile"); } - if (this.canAccessData() - && this.mMetaTileEntity.isElectric() + if (this.canAccessData() && this.mMetaTileEntity.isElectric() && this.inputEnergyFrom(aSide) && aAmperage > 0L && aVoltage > 0L @@ -37,8 +37,9 @@ public class BaseCustomPower_MTE extends BaseCustomTileEntity { Logger.INFO("aAmperage: " + aAmperage); Logger.INFO("aVoltage: " + aVoltage); Logger.INFO("this.getStoredEU() < this.getEUCapacity(): " + (this.getStoredEU() < this.getEUCapacity())); - Logger.INFO("this.mMetaTileEntity.maxAmperesIn() >= this.mAcceptedAmperes: " - + (this.mMetaTileEntity.maxAmperesIn() >= this.getInputAmperage())); + Logger.INFO( + "this.mMetaTileEntity.maxAmperesIn() >= this.mAcceptedAmperes: " + + (this.mMetaTileEntity.maxAmperesIn() >= this.getInputAmperage())); Logger.INFO("this.mMetaTileEntity.maxAmperesIn(): " + (this.mMetaTileEntity.maxAmperesIn())); Logger.INFO("this.mAcceptedAmperes: " + (this.getInputAmperage())); return 0L; @@ -47,13 +48,12 @@ public class BaseCustomPower_MTE extends BaseCustomTileEntity { public boolean drainEnergyUnits(byte aSide, long aVoltage, long aAmperage) { Logger.INFO("Draining Energy Units 4"); - if (this.canAccessData() - && this.mMetaTileEntity.isElectric() + if (this.canAccessData() && this.mMetaTileEntity.isElectric() && this.outputsEnergyTo(aSide) && this.getStoredEU() - aVoltage * aAmperage >= this.mMetaTileEntity.getMinimumStoredEU()) { if (this.decreaseStoredEU(aVoltage * aAmperage, false)) { - this.mAverageEUOutput[this.mAverageEUOutputIndex] = - (int) ((long) this.mAverageEUOutput[this.mAverageEUOutputIndex] + aVoltage * aAmperage); + this.mAverageEUOutput[this.mAverageEUOutputIndex] = (int) ((long) this.mAverageEUOutput[this.mAverageEUOutputIndex] + + aVoltage * aAmperage); return true; } else { return false; diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/api/metatileentity/custom/power/GTPP_MTE_BasicLosslessGenerator.java b/src/main/java/gtPlusPlus/xmod/gregtech/api/metatileentity/custom/power/GTPP_MTE_BasicLosslessGenerator.java index 841359c0b2..0060cba12c 100644 --- a/src/main/java/gtPlusPlus/xmod/gregtech/api/metatileentity/custom/power/GTPP_MTE_BasicLosslessGenerator.java +++ b/src/main/java/gtPlusPlus/xmod/gregtech/api/metatileentity/custom/power/GTPP_MTE_BasicLosslessGenerator.java @@ -1,5 +1,13 @@ package gtPlusPlus.xmod.gregtech.api.metatileentity.custom.power; +import java.util.Collection; +import java.util.Iterator; + +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.init.Blocks; +import net.minecraft.item.ItemStack; +import net.minecraftforge.fluids.FluidStack; + import gregtech.api.enums.GT_Values; import gregtech.api.enums.Textures.BlockIcons; import gregtech.api.gui.modularui.GT_UIInfos; @@ -10,21 +18,16 @@ import gregtech.api.util.GT_Recipe.GT_Recipe_Map; import gregtech.api.util.GT_Utility; import gtPlusPlus.api.objects.Logger; import gtPlusPlus.core.util.minecraft.gregtech.PollutionUtils; -import java.util.Collection; -import java.util.Iterator; -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.init.Blocks; -import net.minecraft.item.ItemStack; -import net.minecraftforge.fluids.FluidStack; public abstract class GTPP_MTE_BasicLosslessGenerator extends GTPP_MTE_BasicTank { - public GTPP_MTE_BasicLosslessGenerator( - int aID, String aName, String aNameRegional, int aTier, String aDescription, ITexture... aTextures) { + + public GTPP_MTE_BasicLosslessGenerator(int aID, String aName, String aNameRegional, int aTier, String aDescription, + ITexture... aTextures) { super(aID, aName, aNameRegional, aTier, 3, aDescription, aTextures); } - public GTPP_MTE_BasicLosslessGenerator( - int aID, String aName, String aNameRegional, int aTier, String[] aDescription, ITexture... aTextures) { + public GTPP_MTE_BasicLosslessGenerator(int aID, String aName, String aNameRegional, int aTier, + String[] aDescription, ITexture... aTextures) { super(aID, aName, aNameRegional, aTier, 3, aDescription, aTextures); } @@ -55,21 +58,11 @@ public abstract class GTPP_MTE_BasicLosslessGenerator extends GTPP_MTE_BasicTank return rTextures; } - public ITexture[] getTexture( - IGregTechTileEntity aBaseMetaTileEntity, - byte aSide, - byte aFacing, - byte aColorIndex, - boolean aActive, - boolean aRedstone) { - return this.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 this.mTextures[(aActive ? 5 : 0) + (aSide == aFacing ? 0 + : (aSide == GT_Utility.getOppositeSide(aFacing) ? 1 + : (aSide == 0 ? 2 : (aSide == 1 ? 3 : 4))))][aColorIndex + 1]; } public String[] getDescription() { @@ -86,23 +79,23 @@ public abstract class GTPP_MTE_BasicLosslessGenerator extends GTPP_MTE_BasicTank } public ITexture[] getFront(byte aColor) { - return new ITexture[] {BlockIcons.MACHINE_CASINGS[this.mTier][aColor + 1]}; + return new ITexture[] { BlockIcons.MACHINE_CASINGS[this.mTier][aColor + 1] }; } public ITexture[] getBack(byte aColor) { - return new ITexture[] {BlockIcons.MACHINE_CASINGS[this.mTier][aColor + 1]}; + return new ITexture[] { BlockIcons.MACHINE_CASINGS[this.mTier][aColor + 1] }; } public ITexture[] getBottom(byte aColor) { - return new ITexture[] {BlockIcons.MACHINE_CASINGS[this.mTier][aColor + 1]}; + return new ITexture[] { BlockIcons.MACHINE_CASINGS[this.mTier][aColor + 1] }; } public ITexture[] getTop(byte aColor) { - return new ITexture[] {BlockIcons.MACHINE_CASINGS[this.mTier][aColor + 1]}; + return new ITexture[] { BlockIcons.MACHINE_CASINGS[this.mTier][aColor + 1] }; } public ITexture[] getSides(byte aColor) { - return new ITexture[] {BlockIcons.MACHINE_CASINGS[this.mTier][aColor + 1]}; + return new ITexture[] { BlockIcons.MACHINE_CASINGS[this.mTier][aColor + 1] }; } public ITexture[] getFrontActive(byte aColor) { @@ -198,8 +191,10 @@ public abstract class GTPP_MTE_BasicLosslessGenerator extends GTPP_MTE_BasicTank this.mInventory[this.getStackDisplaySlot()] = new ItemStack(Blocks.fire, 1); } - this.mInventory[this.getStackDisplaySlot()].setStackDisplayName("Generating: " - + (aBaseMetaTileEntity.getUniversalEnergyStored() - this.getMinimumStoredEU()) + " EU"); + this.mInventory[this.getStackDisplaySlot()].setStackDisplayName( + "Generating: " + + (aBaseMetaTileEntity.getUniversalEnergyStored() - this.getMinimumStoredEU()) + + " EU"); } } else { tFuelValue = this.getFuelValue(this.mFluid); @@ -208,9 +203,8 @@ public abstract class GTPP_MTE_BasicLosslessGenerator extends GTPP_MTE_BasicTank long tFluidAmountToUse = Math.min( (long) (this.mFluid.amount / tConsumed), (this.maxEUStore() - aBaseMetaTileEntity.getUniversalEnergyStored()) / (long) tFuelValue); - if (tFluidAmountToUse > 0L - && aBaseMetaTileEntity.increaseStoredEnergyUnits( - tFluidAmountToUse * (long) tFuelValue, true)) { + if (tFluidAmountToUse > 0L && aBaseMetaTileEntity + .increaseStoredEnergyUnits(tFluidAmountToUse * (long) tFuelValue, true)) { PollutionUtils.addPollution(this.getBaseMetaTileEntity(), 10 * this.getPollution()); this.mFluid.amount = (int) ((long) this.mFluid.amount - tFluidAmountToUse * (long) tConsumed); } @@ -235,8 +229,8 @@ public abstract class GTPP_MTE_BasicLosslessGenerator extends GTPP_MTE_BasicTank if (aBaseMetaTileEntity.isServerSide()) { Logger.WARNING("Ticking Servside"); - aBaseMetaTileEntity.setActive(aBaseMetaTileEntity.isAllowedToWork() - && aBaseMetaTileEntity.getUniversalEnergyStored() + aBaseMetaTileEntity.setActive( + aBaseMetaTileEntity.isAllowedToWork() && aBaseMetaTileEntity.getUniversalEnergyStored() >= this.maxEUOutput() + this.getMinimumStoredEU()); } } @@ -264,15 +258,13 @@ public abstract class GTPP_MTE_BasicLosslessGenerator extends GTPP_MTE_BasicTank if ((tLiquid = GT_Utility.getFluidForFilledItem(tFuel.getRepresentativeInput(0), true)) != null && aLiquid.isFluidEqual(tLiquid)) { Logger.WARNING("Fuel Ok"); - return (int) ((long) tFuel.mSpecialValue - * (long) this.getEfficiency() + return (int) ((long) tFuel.mSpecialValue * (long) this.getEfficiency() * (long) this.consumedFluidPerOperation(tLiquid) / 100L); } if ((tLiquid = tFuel.getRepresentativeFluidInput(0)) != null && aLiquid.isFluidEqual(tLiquid)) { Logger.WARNING("Fuel Ok"); - return (int) ((long) tFuel.mSpecialValue - * (long) this.getEfficiency() + return (int) ((long) tFuel.mSpecialValue * (long) this.getEfficiency() * (long) this.consumedFluidPerOperation(tLiquid) / 100L); } @@ -288,11 +280,12 @@ public abstract class GTPP_MTE_BasicLosslessGenerator extends GTPP_MTE_BasicTank public int getFuelValue(ItemStack aStack) { if (!GT_Utility.isStackInvalid(aStack) && this.getRecipes() != null) { Logger.WARNING("Fuel Item OK"); - GT_Recipe tFuel = this.getRecipes() - .findRecipe( - this.getBaseMetaTileEntity(), false, Long.MAX_VALUE, (FluidStack[]) null, new ItemStack[] { - aStack - }); + GT_Recipe tFuel = this.getRecipes().findRecipe( + this.getBaseMetaTileEntity(), + false, + Long.MAX_VALUE, + (FluidStack[]) null, + new ItemStack[] { aStack }); return tFuel != null ? (int) ((long) tFuel.mSpecialValue * 1000L * (long) this.getEfficiency() / 100L) : 0; } else { return 0; @@ -301,13 +294,13 @@ public abstract class GTPP_MTE_BasicLosslessGenerator extends GTPP_MTE_BasicTank public ItemStack getEmptyContainer(ItemStack aStack) { if (!GT_Utility.isStackInvalid(aStack) && this.getRecipes() != null) { - GT_Recipe tFuel = this.getRecipes() - .findRecipe( - this.getBaseMetaTileEntity(), false, Long.MAX_VALUE, (FluidStack[]) null, new ItemStack[] { - aStack - }); - return tFuel != null - ? GT_Utility.copy(new Object[] {tFuel.getOutput(0)}) + GT_Recipe tFuel = this.getRecipes().findRecipe( + this.getBaseMetaTileEntity(), + false, + Long.MAX_VALUE, + (FluidStack[]) null, + new ItemStack[] { aStack }); + return tFuel != null ? GT_Utility.copy(new Object[] { tFuel.getOutput(0) }) : GT_Utility.getContainerItem(aStack, true); } else { return null; @@ -315,9 +308,8 @@ public abstract class GTPP_MTE_BasicLosslessGenerator extends GTPP_MTE_BasicTank } public boolean allowPutStack(IGregTechTileEntity aBaseMetaTileEntity, int aIndex, byte aSide, ItemStack aStack) { - return super.allowPutStack(aBaseMetaTileEntity, aIndex, aSide, aStack) - && (this.getFuelValue(aStack) > 0 - || this.getFuelValue(GT_Utility.getFluidForFilledItem(aStack, true)) > 0); + return super.allowPutStack(aBaseMetaTileEntity, aIndex, aSide, aStack) && (this.getFuelValue(aStack) > 0 + || this.getFuelValue(GT_Utility.getFluidForFilledItem(aStack, true)) > 0); } public int getCapacity() { diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/api/metatileentity/custom/power/GTPP_MTE_BasicMachine.java b/src/main/java/gtPlusPlus/xmod/gregtech/api/metatileentity/custom/power/GTPP_MTE_BasicMachine.java index cb3f42b6f6..2721dc437e 100644 --- a/src/main/java/gtPlusPlus/xmod/gregtech/api/metatileentity/custom/power/GTPP_MTE_BasicMachine.java +++ b/src/main/java/gtPlusPlus/xmod/gregtech/api/metatileentity/custom/power/GTPP_MTE_BasicMachine.java @@ -2,6 +2,17 @@ package gtPlusPlus.xmod.gregtech.api.metatileentity.custom.power; import static gregtech.api.enums.GT_Values.V; +import java.util.Arrays; + +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.item.ItemStack; +import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.tileentity.TileEntity; +import net.minecraftforge.common.DimensionManager; +import net.minecraftforge.common.util.ForgeDirection; +import net.minecraftforge.fluids.FluidStack; +import net.minecraftforge.fluids.IFluidHandler; + import gregtech.api.GregTech_API; import gregtech.api.enums.ItemList; import gregtech.api.enums.Textures; @@ -16,79 +27,48 @@ import gregtech.api.util.GT_Recipe; import gregtech.api.util.GT_Recipe.GT_Recipe_Map; import gregtech.api.util.GT_Utility; import gtPlusPlus.api.objects.random.XSTR; -import java.util.Arrays; -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.item.ItemStack; -import net.minecraft.nbt.NBTTagCompound; -import net.minecraft.tileentity.TileEntity; -import net.minecraftforge.common.DimensionManager; -import net.minecraftforge.common.util.ForgeDirection; -import net.minecraftforge.fluids.FluidStack; -import net.minecraftforge.fluids.IFluidHandler; /** * 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 GTPP_MTE_BasicMachine extends GTPP_MTE_BasicTank { + /** * 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 = 4; 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 int mMainFacing = -1, mProgresstime = 0, mMaxProgresstime = 0, mEUt = 0, mOutputBlocked = 0; public FluidStack mOutputFluid; public String mGUIName = "", mNEIName = ""; public GT_MetaTileEntity_MultiBlockBase mCleanroom; /** - * 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 GTPP_MTE_BasicMachine( - int aID, - String aName, - String aNameRegional, - int aTier, - int aAmperage, - String aDescription, - int aInputSlotCount, - int aOutputSlotCount, - String aGUIName, - String aNEIName, + public GTPP_MTE_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, @@ -105,17 +85,8 @@ public abstract class GTPP_MTE_BasicMachine extends GTPP_MTE_BasicTank { mNEIName = aNEIName; } - public GTPP_MTE_BasicMachine( - int aID, - String aName, - String aNameRegional, - int aTier, - int aAmperage, - String[] aDescription, - int aInputSlotCount, - int aOutputSlotCount, - String aGUIName, - String aNEIName, + public GTPP_MTE_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, @@ -132,16 +103,8 @@ public abstract class GTPP_MTE_BasicMachine extends GTPP_MTE_BasicTank { mNEIName = aNEIName; } - public GTPP_MTE_BasicMachine( - String aName, - int aTier, - int aAmperage, - String aDescription, - ITexture[][][] aTextures, - int aInputSlotCount, - int aOutputSlotCount, - String aGUIName, - String aNEIName) { + public GTPP_MTE_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)]; @@ -150,16 +113,8 @@ public abstract class GTPP_MTE_BasicMachine extends GTPP_MTE_BasicTank { mNEIName = aNEIName; } - public GTPP_MTE_BasicMachine( - String aName, - int aTier, - int aAmperage, - String[] aDescription, - ITexture[][][] aTextures, - int aInputSlotCount, - int aOutputSlotCount, - String aGUIName, - String aNEIName) { + public GTPP_MTE_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)]; @@ -188,13 +143,10 @@ public abstract class GTPP_MTE_BasicMachine extends GTPP_MTE_BasicTank { 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[] {Textures.BlockIcons.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[] { + Textures.BlockIcons.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); @@ -216,28 +168,16 @@ public abstract class GTPP_MTE_BasicMachine extends GTPP_MTE_BasicTank { } @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 @@ -262,8 +202,7 @@ public abstract class GTPP_MTE_BasicMachine extends GTPP_MTE_BasicTank { @Override public boolean isValidSlot(int aIndex) { - return aIndex > 0 - && super.isValidSlot(aIndex) + return aIndex > 0 && super.isValidSlot(aIndex) && aIndex != OTHER_SLOT_COUNT + mInputSlotCount + mOutputItems.length; } @@ -294,9 +233,7 @@ public abstract class GTPP_MTE_BasicMachine extends GTPP_MTE_BasicTank { @Override public boolean isLiquidInput(byte aSide) { - return aSide != mMainFacing - && (mAllowInputFromOutputSide - || aSide != getBaseMetaTileEntity().getFrontFacing()); + return aSide != mMainFacing && (mAllowInputFromOutputSide || aSide != getBaseMetaTileEntity().getFrontFacing()); } @Override @@ -387,8 +324,7 @@ public abstract class GTPP_MTE_BasicMachine extends GTPP_MTE_BasicTank { @Override public boolean isFluidInputAllowed(FluidStack aFluid) { - return getFillableStack() != null - || (getRecipeList() != null && getRecipeList().containsInput(aFluid)); + return getFillableStack() != null || (getRecipeList() != null && getRecipeList().containsInput(aFluid)); } @Override @@ -467,9 +403,8 @@ public abstract class GTPP_MTE_BasicMachine extends GTPP_MTE_BasicTank { if (mOutputFluid != null) aNBT.setTag("mOutputFluid", mOutputFluid.writeToNBT(new NBTTagCompound())); if (mFluidOut != null) aNBT.setTag("mFluidOut", mFluidOut.writeToNBT(new NBTTagCompound())); - for (int i = 0; i < mOutputItems.length; i++) - if (mOutputItems[i] != null) - aNBT.setTag("mOutputItem" + i, mOutputItems[i].writeToNBT(new NBTTagCompound())); + for (int i = 0; i < mOutputItems.length; i++) if (mOutputItems[i] != null) + aNBT.setTag("mOutputItem" + i, mOutputItems[i].writeToNBT(new NBTTagCompound())); } @Override @@ -506,9 +441,9 @@ public abstract class GTPP_MTE_BasicMachine extends GTPP_MTE_BasicTank { 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())) @@ -542,8 +477,7 @@ public abstract class GTPP_MTE_BasicMachine extends GTPP_MTE_BasicTank { boolean tRemovedOutputFluid = false; - if (doesAutoOutputFluids() - && getDrainableStack() != null + if (doesAutoOutputFluids() && getDrainableStack() != null && aBaseMetaTileEntity.getFrontFacing() != mMainFacing && (tSucceeded || aTick % 20 == 0)) { IFluidHandler tTank = aBaseMetaTileEntity.getITankContainerAtSide(aBaseMetaTileEntity.getFrontFacing()); @@ -551,28 +485,26 @@ public abstract class GTPP_MTE_BasicMachine extends GTPP_MTE_BasicTank { 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()); - for (int i = 0, tCosts = 1; - i < mOutputItems.length && tCosts > 0 && aBaseMetaTileEntity.isUniversalEnergyStored(128); - i++) { + for (int i = 0, tCosts = 1; i < mOutputItems.length && tCosts > 0 + && aBaseMetaTileEntity.isUniversalEnergyStored(128); i++) { tCosts = GT_Utility.moveOneItemStack( aBaseMetaTileEntity, tTileEntity2, @@ -588,15 +520,12 @@ public abstract class GTPP_MTE_BasicMachine extends GTPP_MTE_BasicTank { } } - 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()) @@ -647,8 +576,8 @@ public abstract class GTPP_MTE_BasicMachine extends GTPP_MTE_BasicTank { if (ItemList.Display_Fluid.isStackEqual(mInventory[tDisplayStackSlot], true, true)) mInventory[tDisplayStackSlot] = null; } else { - mInventory[tDisplayStackSlot] = - GT_Utility.getFluidDisplayStack(getFillableStack(), displaysStackSize()); + mInventory[tDisplayStackSlot] = GT_Utility + .getFluidDisplayStack(getFillableStack(), displaysStackSize()); } } } @@ -694,32 +623,27 @@ public abstract class GTPP_MTE_BasicMachine extends GTPP_MTE_BasicTank { } 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) { @@ -819,15 +743,9 @@ public abstract class GTPP_MTE_BasicMachine extends GTPP_MTE_BasicTank { @Override public String[] getInfoData() { - return new String[] { - mNEIName, - "Progress:", - (mProgresstime / 20) + " secs", - (mMaxProgresstime / 20) + " secs", - "Stored Energy:", - getBaseMetaTileEntity().getStoredEU() + "EU", - getBaseMetaTileEntity().getEUCapacity() + "EU" - }; + return new String[] { mNEIName, "Progress:", (mProgresstime / 20) + " secs", (mMaxProgresstime / 20) + " secs", + "Stored Energy:", getBaseMetaTileEntity().getStoredEU() + "EU", + getBaseMetaTileEntity().getEUCapacity() + "EU" }; } @Override @@ -847,9 +765,8 @@ public abstract class GTPP_MTE_BasicMachine extends GTPP_MTE_BasicTank { @Override public boolean allowCoverOnSide(byte aSide, GT_ItemStack aCoverID) { - return (aSide != mMainFacing - || GregTech_API.getCoverBehavior(aCoverID.toStack()) - .isGUIClickable(aSide, GT_Utility.stackToInt(aCoverID.toStack()), 0, getBaseMetaTileEntity())); + return (aSide != mMainFacing || GregTech_API.getCoverBehavior(aCoverID.toStack()) + .isGUIClickable(aSide, GT_Utility.stackToInt(aCoverID.toStack()), 0, getBaseMetaTileEntity())); } @Override @@ -859,10 +776,10 @@ public abstract class GTPP_MTE_BasicMachine extends GTPP_MTE_BasicTank { @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])) return i == aIndex; return true; @@ -876,7 +793,8 @@ public abstract class GTPP_MTE_BasicMachine extends GTPP_MTE_BasicTank { } /** - * 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/> @@ -910,7 +828,7 @@ public abstract class GTPP_MTE_BasicMachine extends GTPP_MTE_BasicTank { mLastRecipe, false, V[mTier], - new FluidStack[] {getFillableStack()}, + new FluidStack[] { getFillableStack() }, getSpecialSlot(), getAllInputs()); if (tRecipe == null) return DID_NOT_FIND_RECIPE; @@ -922,91 +840,78 @@ public abstract class GTPP_MTE_BasicMachine extends GTPP_MTE_BasicTank { } if (tRecipe.mSpecialValue == -200 && (mCleanroom == null || mCleanroom.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) - for (int i = 0; i < mOutputItems.length; i++) - if (mOutputItems[i] != null && getBaseMetaTileEntity().getRandomNumber(10000) > mCleanroom.mEfficiency) - mOutputItems[i] = null; + if (tRecipe.mSpecialValue == -200) for (int i = 0; i < mOutputItems.length; i++) + if (mOutputItems[i] != null && getBaseMetaTileEntity().getRandomNumber(10000) > mCleanroom.mEfficiency) + mOutputItems[i] = null; mOutputFluid = tRecipe.getFluidOutput(0); calculateOverclockedNess(tRecipe); return FOUND_AND_SUCCESSFULLY_USED_RECIPE; } public ITexture[] getSideFacingActive(byte aColor) { - return new ITexture[] {Textures.BlockIcons.MACHINE_CASINGS[mTier][aColor + 1]}; + return new ITexture[] { Textures.BlockIcons.MACHINE_CASINGS[mTier][aColor + 1] }; } public ITexture[] getSideFacingInactive(byte aColor) { - return new ITexture[] {Textures.BlockIcons.MACHINE_CASINGS[mTier][aColor + 1]}; + return new ITexture[] { Textures.BlockIcons.MACHINE_CASINGS[mTier][aColor + 1] }; } public ITexture[] getFrontFacingActive(byte aColor) { - return new ITexture[] {Textures.BlockIcons.MACHINE_CASINGS[mTier][aColor + 1]}; + return new ITexture[] { Textures.BlockIcons.MACHINE_CASINGS[mTier][aColor + 1] }; } public ITexture[] getFrontFacingInactive(byte aColor) { - return new ITexture[] {Textures.BlockIcons.MACHINE_CASINGS[mTier][aColor + 1]}; + return new ITexture[] { Textures.BlockIcons.MACHINE_CASINGS[mTier][aColor + 1] }; } public ITexture[] getTopFacingActive(byte aColor) { - return new ITexture[] {Textures.BlockIcons.MACHINE_CASINGS[mTier][aColor + 1]}; + return new ITexture[] { Textures.BlockIcons.MACHINE_CASINGS[mTier][aColor + 1] }; } public ITexture[] getTopFacingInactive(byte aColor) { - return new ITexture[] {Textures.BlockIcons.MACHINE_CASINGS[mTier][aColor + 1]}; + return new ITexture[] { Textures.BlockIcons.MACHINE_CASINGS[mTier][aColor + 1] }; } public ITexture[] getBottomFacingActive(byte aColor) { - return new ITexture[] {Textures.BlockIcons.MACHINE_CASINGS[mTier][aColor + 1]}; + return new ITexture[] { Textures.BlockIcons.MACHINE_CASINGS[mTier][aColor + 1] }; } public ITexture[] getBottomFacingInactive(byte aColor) { - return new ITexture[] {Textures.BlockIcons.MACHINE_CASINGS[mTier][aColor + 1]}; + return new ITexture[] { Textures.BlockIcons.MACHINE_CASINGS[mTier][aColor + 1] }; } public ITexture[] getBottomFacingPipeActive(byte aColor) { - return new ITexture[] { - Textures.BlockIcons.MACHINE_CASINGS[mTier][aColor + 1], - new GT_RenderedTexture(Textures.BlockIcons.OVERLAY_PIPE_OUT) - }; + return new ITexture[] { Textures.BlockIcons.MACHINE_CASINGS[mTier][aColor + 1], + new GT_RenderedTexture(Textures.BlockIcons.OVERLAY_PIPE_OUT) }; } public ITexture[] getBottomFacingPipeInactive(byte aColor) { - return new ITexture[] { - Textures.BlockIcons.MACHINE_CASINGS[mTier][aColor + 1], - new GT_RenderedTexture(Textures.BlockIcons.OVERLAY_PIPE_OUT) - }; + return new ITexture[] { Textures.BlockIcons.MACHINE_CASINGS[mTier][aColor + 1], + new GT_RenderedTexture(Textures.BlockIcons.OVERLAY_PIPE_OUT) }; } public ITexture[] getTopFacingPipeActive(byte aColor) { - return new ITexture[] { - Textures.BlockIcons.MACHINE_CASINGS[mTier][aColor + 1], - new GT_RenderedTexture(Textures.BlockIcons.OVERLAY_PIPE_OUT) - }; + return new ITexture[] { Textures.BlockIcons.MACHINE_CASINGS[mTier][aColor + 1], + new GT_RenderedTexture(Textures.BlockIcons.OVERLAY_PIPE_OUT) }; } public ITexture[] getTopFacingPipeInactive(byte aColor) { - return new ITexture[] { - Textures.BlockIcons.MACHINE_CASINGS[mTier][aColor + 1], - new GT_RenderedTexture(Textures.BlockIcons.OVERLAY_PIPE_OUT) - }; + return new ITexture[] { Textures.BlockIcons.MACHINE_CASINGS[mTier][aColor + 1], + new GT_RenderedTexture(Textures.BlockIcons.OVERLAY_PIPE_OUT) }; } public ITexture[] getSideFacingPipeActive(byte aColor) { - return new ITexture[] { - Textures.BlockIcons.MACHINE_CASINGS[mTier][aColor + 1], - new GT_RenderedTexture(Textures.BlockIcons.OVERLAY_PIPE_OUT) - }; + return new ITexture[] { Textures.BlockIcons.MACHINE_CASINGS[mTier][aColor + 1], + new GT_RenderedTexture(Textures.BlockIcons.OVERLAY_PIPE_OUT) }; } public ITexture[] getSideFacingPipeInactive(byte aColor) { - return new ITexture[] { - Textures.BlockIcons.MACHINE_CASINGS[mTier][aColor + 1], - new GT_RenderedTexture(Textures.BlockIcons.OVERLAY_PIPE_OUT) - }; + return new ITexture[] { Textures.BlockIcons.MACHINE_CASINGS[mTier][aColor + 1], + new GT_RenderedTexture(Textures.BlockIcons.OVERLAY_PIPE_OUT) }; } } diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/api/metatileentity/custom/power/GTPP_MTE_BasicTank.java b/src/main/java/gtPlusPlus/xmod/gregtech/api/metatileentity/custom/power/GTPP_MTE_BasicTank.java index 7e2cfaa94a..679b007111 100644 --- a/src/main/java/gtPlusPlus/xmod/gregtech/api/metatileentity/custom/power/GTPP_MTE_BasicTank.java +++ b/src/main/java/gtPlusPlus/xmod/gregtech/api/metatileentity/custom/power/GTPP_MTE_BasicTank.java @@ -1,12 +1,13 @@ package gtPlusPlus.xmod.gregtech.api.metatileentity.custom.power; +import net.minecraft.item.ItemStack; +import net.minecraft.nbt.NBTTagCompound; +import net.minecraftforge.fluids.FluidStack; + import gregtech.api.enums.ItemList; import gregtech.api.interfaces.ITexture; import gregtech.api.interfaces.tileentity.IGregTechTileEntity; import gregtech.api.util.GT_Utility; -import net.minecraft.item.ItemStack; -import net.minecraft.nbt.NBTTagCompound; -import net.minecraftforge.fluids.FluidStack; /** * NEVER INCLUDE THIS FILE IN YOUR MOD!!! @@ -20,35 +21,23 @@ public abstract class GTPP_MTE_BasicTank extends GTPP_MTE_TieredMachineBlock { /** * @param aInvSlotCount should be 3 */ - public GTPP_MTE_BasicTank( - int aID, - String aName, - String aNameRegional, - int aTier, - int aInvSlotCount, - String aDescription, - ITexture... aTextures) { + public GTPP_MTE_BasicTank(int aID, String aName, String aNameRegional, int aTier, int aInvSlotCount, + String aDescription, ITexture... aTextures) { super(aID, aName, aNameRegional, aTier, aInvSlotCount, aDescription, aTextures); } - public GTPP_MTE_BasicTank( - int aID, - String aName, - String aNameRegional, - int aTier, - int aInvSlotCount, - String[] aDescription, - ITexture... aTextures) { + public GTPP_MTE_BasicTank(int aID, String aName, String aNameRegional, int aTier, int aInvSlotCount, + String[] aDescription, ITexture... aTextures) { super(aID, aName, aNameRegional, aTier, aInvSlotCount, aDescription, aTextures); } - public GTPP_MTE_BasicTank( - String aName, int aTier, int aInvSlotCount, String aDescription, ITexture[][][] aTextures) { + public GTPP_MTE_BasicTank(String aName, int aTier, int aInvSlotCount, String aDescription, + ITexture[][][] aTextures) { super(aName, aTier, aInvSlotCount, aDescription, aTextures); } - public GTPP_MTE_BasicTank( - String aName, int aTier, int aInvSlotCount, String[] aDescription, ITexture[][][] aTextures) { + public GTPP_MTE_BasicTank(String aName, int aTier, int aInvSlotCount, String[] aDescription, + ITexture[][][] aTextures) { super(aName, aTier, aInvSlotCount, aDescription, aTextures); } @@ -137,8 +126,8 @@ public abstract class GTPP_MTE_BasicTank extends GTPP_MTE_TieredMachineBlock { if (ItemList.Display_Fluid.isStackEqual(mInventory[getStackDisplaySlot()], true, true)) mInventory[getStackDisplaySlot()] = null; } else { - mInventory[getStackDisplaySlot()] = - GT_Utility.getFluidDisplayStack(getDisplayedFluid(), displaysStackSize()); + mInventory[getStackDisplaySlot()] = GT_Utility + .getFluidDisplayStack(getDisplayedFluid(), displaysStackSize()); } } @@ -172,8 +161,8 @@ public abstract class GTPP_MTE_BasicTank extends GTPP_MTE_TieredMachineBlock { } 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); @@ -196,11 +185,11 @@ public abstract class GTPP_MTE_BasicTank extends GTPP_MTE_TieredMachineBlock { @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()) { diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/api/metatileentity/custom/power/GTPP_MTE_TieredMachineBlock.java b/src/main/java/gtPlusPlus/xmod/gregtech/api/metatileentity/custom/power/GTPP_MTE_TieredMachineBlock.java index e45588e126..51596dd8cd 100644 --- a/src/main/java/gtPlusPlus/xmod/gregtech/api/metatileentity/custom/power/GTPP_MTE_TieredMachineBlock.java +++ b/src/main/java/gtPlusPlus/xmod/gregtech/api/metatileentity/custom/power/GTPP_MTE_TieredMachineBlock.java @@ -6,6 +6,7 @@ import gregtech.api.interfaces.ITexture; import gtPlusPlus.api.objects.data.AutoMap; public abstract class GTPP_MTE_TieredMachineBlock extends MetaTileEntityCustomPower { + /** * Value between [0 - 9] to describe the Tier of this Machine. */ @@ -24,31 +25,19 @@ public abstract class GTPP_MTE_TieredMachineBlock extends MetaTileEntityCustomPo */ public final ITexture[][][] mTextures; - public GTPP_MTE_TieredMachineBlock( - int aID, - String aName, - String aNameRegional, - int aTier, - int aInvSlotCount, - String aDescription, - ITexture... aTextures) { + public GTPP_MTE_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, 9)); - 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 GTPP_MTE_TieredMachineBlock( - int aID, - String aName, - String aNameRegional, - int aTier, - int aInvSlotCount, - String[] aDescription, - ITexture... aTextures) { + public GTPP_MTE_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, 9)); mDescriptionArray = aDescription == null ? new String[0] : aDescription; @@ -59,17 +48,17 @@ public abstract class GTPP_MTE_TieredMachineBlock extends MetaTileEntityCustomPo else mTextures = null; } - public GTPP_MTE_TieredMachineBlock( - String aName, int aTier, int aInvSlotCount, String aDescription, ITexture[][][] aTextures) { + public GTPP_MTE_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 GTPP_MTE_TieredMachineBlock( - String aName, int aTier, int aInvSlotCount, String[] aDescription, ITexture[][][] aTextures) { + public GTPP_MTE_TieredMachineBlock(String aName, int aTier, int aInvSlotCount, String[] aDescription, + ITexture[][][] aTextures) { super(aName, aInvSlotCount); mTier = (byte) aTier; mDescriptionArray = aDescription == null ? new String[0] : aDescription; @@ -105,8 +94,8 @@ public abstract class GTPP_MTE_TieredMachineBlock extends MetaTileEntityCustomPo } /** - * 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. */ diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/api/metatileentity/custom/power/MetaTileEntityCustomPower.java b/src/main/java/gtPlusPlus/xmod/gregtech/api/metatileentity/custom/power/MetaTileEntityCustomPower.java index 36185b638b..e2b5d1eafc 100644 --- a/src/main/java/gtPlusPlus/xmod/gregtech/api/metatileentity/custom/power/MetaTileEntityCustomPower.java +++ b/src/main/java/gtPlusPlus/xmod/gregtech/api/metatileentity/custom/power/MetaTileEntityCustomPower.java @@ -1,14 +1,15 @@ package gtPlusPlus.xmod.gregtech.api.metatileentity.custom.power; +import net.minecraft.entity.Entity; +import net.minecraft.init.Blocks; +import net.minecraft.world.World; + import gregtech.api.GregTech_API; import gregtech.api.enums.GT_Values; import gregtech.api.util.GT_Utility; import gtPlusPlus.api.objects.Logger; import gtPlusPlus.xmod.gregtech.api.metatileentity.implementations.base.CustomMetaTileBase; import gtPlusPlus.xmod.gregtech.common.Meta_GT_Proxy; -import net.minecraft.entity.Entity; -import net.minecraft.init.Blocks; -import net.minecraft.world.World; public abstract class MetaTileEntityCustomPower extends CustomMetaTileBase { @@ -37,35 +38,40 @@ public abstract class MetaTileEntityCustomPower extends CustomMetaTileBase { return; } - float tStrength = aExplosionPower < GT_Values.V[0] - ? 1.0F - : (aExplosionPower < GT_Values.V[1] - ? 2.0F - : (aExplosionPower < GT_Values.V[2] - ? 3.0F - : (aExplosionPower < GT_Values.V[3] - ? 4.0F - : (aExplosionPower < GT_Values.V[4] - ? 5.0F - : (aExplosionPower < GT_Values.V[4] * 2L - ? 6.0F - : (aExplosionPower < GT_Values.V[5] - ? 7.0F - : (aExplosionPower < GT_Values.V[6] - ? 8.0F - : (aExplosionPower < GT_Values.V[7] - ? 9.0F - : 10.0F)))))))); + float tStrength = aExplosionPower + < GT_Values.V[0] + ? 1.0F + : (aExplosionPower < GT_Values.V[1] ? 2.0F + : (aExplosionPower < GT_Values.V[2] ? 3.0F + : (aExplosionPower < GT_Values.V[3] ? 4.0F + : (aExplosionPower < GT_Values.V[4] ? 5.0F + : (aExplosionPower < GT_Values.V[4] * 2L ? 6.0F + : (aExplosionPower < GT_Values.V[5] ? 7.0F + : (aExplosionPower < GT_Values.V[6] ? 8.0F + : (aExplosionPower < GT_Values.V[7] + ? 9.0F + : 10.0F)))))))); int tX = this.getBaseMetaTileEntity().getXCoord(); short tY = this.getBaseMetaTileEntity().getYCoord(); int tZ = this.getBaseMetaTileEntity().getZCoord(); World tWorld = this.getBaseMetaTileEntity().getWorld(); GT_Utility.sendSoundToPlayers( - tWorld, (String) GregTech_API.sSoundList.get(Integer.valueOf(209)), 1.0F, -1.0F, tX, tY, tZ); + tWorld, + (String) GregTech_API.sSoundList.get(Integer.valueOf(209)), + 1.0F, + -1.0F, + tX, + tY, + tZ); tWorld.setBlock(tX, tY, tZ, Blocks.air); if (GregTech_API.sMachineExplosions) { tWorld.createExplosion( - (Entity) null, (double) tX + 0.5D, (double) tY + 0.5D, (double) tZ + 0.5D, tStrength, true); + (Entity) null, + (double) tX + 0.5D, + (double) tY + 0.5D, + (double) tZ + 0.5D, + tStrength, + true); } } diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_BasicBreaker.java b/src/main/java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_BasicBreaker.java index b9ffc8740a..8d8ec9b1be 100644 --- a/src/main/java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_BasicBreaker.java +++ b/src/main/java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_BasicBreaker.java @@ -1,7 +1,13 @@ package gtPlusPlus.xmod.gregtech.api.metatileentity.implementations; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.item.ItemStack; +import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.util.EnumChatFormatting; + import com.gtnewhorizons.modularui.api.screen.ModularWindow; import com.gtnewhorizons.modularui.api.screen.UIBuildContext; + import gregtech.api.enums.GT_Values; import gregtech.api.enums.Textures.BlockIcons; import gregtech.api.gui.modularui.GT_UIInfos; @@ -15,10 +21,6 @@ import gtPlusPlus.core.lib.CORE; import gtPlusPlus.xmod.gregtech.api.metatileentity.custom.power.GTPP_MTE_TieredMachineBlock; import ic2.api.item.ElectricItem; import ic2.api.item.IElectricItem; -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.item.ItemStack; -import net.minecraft.nbt.NBTTagCompound; -import net.minecraft.util.EnumChatFormatting; public class GT_MetaTileEntity_BasicBreaker extends GTPP_MTE_TieredMachineBlock implements IAddUIWidgets { @@ -30,18 +32,18 @@ public class GT_MetaTileEntity_BasicBreaker extends GTPP_MTE_TieredMachineBlock private long mStored = 0L; private long mMax = 0L; - public GT_MetaTileEntity_BasicBreaker( - int aID, String aName, String aNameRegional, int aTier, String aDescription, int aSlotCount) { + public GT_MetaTileEntity_BasicBreaker(int aID, String aName, String aNameRegional, int aTier, String aDescription, + int aSlotCount) { super(aID, aName, aNameRegional, aTier, aSlotCount, aDescription, new ITexture[0]); } - public GT_MetaTileEntity_BasicBreaker( - String aName, int aTier, String aDescription, ITexture[][][] aTextures, int aSlotCount) { + public GT_MetaTileEntity_BasicBreaker(String aName, int aTier, String aDescription, ITexture[][][] aTextures, + int aSlotCount) { super(aName, aTier, aSlotCount, aDescription, aTextures); } - public GT_MetaTileEntity_BasicBreaker( - String aName, int aTier, String[] aDescription, ITexture[][][] aTextures, int aSlotCount) { + public GT_MetaTileEntity_BasicBreaker(String aName, int aTier, String[] aDescription, ITexture[][][] aTextures, + int aSlotCount) { super(aName, aTier, aSlotCount, aDescription, aTextures); } @@ -49,13 +51,21 @@ public class GT_MetaTileEntity_BasicBreaker extends GTPP_MTE_TieredMachineBlock final String[] desc = new String[6]; int tTier = this.mTier; desc[0] = "" + EnumChatFormatting.BOLD + "16 Fuse Slots"; - desc[1] = "Per each fuse, you may insert " + EnumChatFormatting.YELLOW + (GT_Values.V[tTier]) - + EnumChatFormatting.GRAY + " EU/t"; - desc[2] = "However this " + EnumChatFormatting.ITALIC + EnumChatFormatting.RED + "MUST" - + EnumChatFormatting.GRAY + " be in a single Amp"; + desc[1] = "Per each fuse, you may insert " + EnumChatFormatting.YELLOW + + (GT_Values.V[tTier]) + + EnumChatFormatting.GRAY + + " EU/t"; + desc[2] = "However this " + EnumChatFormatting.ITALIC + + EnumChatFormatting.RED + + "MUST" + + EnumChatFormatting.GRAY + + " be in a single Amp"; desc[3] = "This machine can accept upto a single amp of " + GT_Values.VN[Math.min(tTier + 2, 15)] + " as a result"; - desc[4] = "Breaker Loss: " + EnumChatFormatting.RED + "" + (GT_Values.V[tTier] / 16) + EnumChatFormatting.GRAY + desc[4] = "Breaker Loss: " + EnumChatFormatting.RED + + "" + + (GT_Values.V[tTier] / 16) + + EnumChatFormatting.GRAY + " EU/t"; desc[5] = CORE.GT_Tooltip; return desc; @@ -65,37 +75,30 @@ public class GT_MetaTileEntity_BasicBreaker extends GTPP_MTE_TieredMachineBlock ITexture[][][] rTextures = new ITexture[2][17][]; for (byte i = -1; i < 16; ++i) { - rTextures[0][i + 1] = new ITexture[] { - BlockIcons.MACHINE_CASINGS[this.mTier][i + 1], - this.mInventory.length > 4 - ? BlockIcons.OVERLAYS_ENERGY_IN_MULTI[Math.min(12, mTier)] - : BlockIcons.OVERLAYS_ENERGY_IN[Math.min(12, mTier)] - }; - - rTextures[1][i + 1] = new ITexture[] { - BlockIcons.MACHINE_CASINGS[this.mTier][i + 1], - this.mInventory.length > 4 - ? BlockIcons.OVERLAYS_ENERGY_OUT_MULTI[this.mTier] - : BlockIcons.OVERLAYS_ENERGY_OUT[this.mTier] - }; + rTextures[0][i + 1] = new ITexture[] { BlockIcons.MACHINE_CASINGS[this.mTier][i + 1], + this.mInventory.length > 4 ? BlockIcons.OVERLAYS_ENERGY_IN_MULTI[Math.min(12, mTier)] + : BlockIcons.OVERLAYS_ENERGY_IN[Math.min(12, mTier)] }; + + rTextures[1][i + 1] = new ITexture[] { BlockIcons.MACHINE_CASINGS[this.mTier][i + 1], + this.mInventory.length > 4 ? BlockIcons.OVERLAYS_ENERGY_OUT_MULTI[this.mTier] + : BlockIcons.OVERLAYS_ENERGY_OUT[this.mTier] }; } return rTextures; } - 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 this.mTextures[aSide == aFacing ? 1 : 0][aColorIndex + 1]; } public IMetaTileEntity newMetaEntity(IGregTechTileEntity aTileEntity) { return new GT_MetaTileEntity_BasicBreaker( - this.mName, this.mTier, this.mDescriptionArray, this.mTextures, this.mInventory.length); + this.mName, + this.mTier, + this.mDescriptionArray, + this.mTextures, + this.mInventory.length); } public boolean isSimpleMachine() { @@ -198,23 +201,14 @@ public class GT_MetaTileEntity_BasicBreaker extends GTPP_MTE_TieredMachineBlock public void onPostTick(IGregTechTileEntity aBaseMetaTileEntity, long aTick) { super.onPostTick(aBaseMetaTileEntity, aTick); if (aBaseMetaTileEntity.isServerSide()) { - /*this.mCharge = aBaseMetaTileEntity.getStoredEU() / 2L > aBaseMetaTileEntity.getEUCapacity() / 3L; - this.mDecharge = aBaseMetaTileEntity.getStoredEU() < aBaseMetaTileEntity.getEUCapacity() / 3L; - this.mBatteryCount = 0; - this.mChargeableCount = 0; - ItemStack[] arg3 = this.mInventory; - int arg4 = arg3.length; - - for (int arg5 = 0; arg5 < arg4; ++arg5) { - ItemStack tStack = arg3[arg5]; - if (GT_ModHandler.isElectricItem(tStack, this.mTier)) { - if (GT_ModHandler.isChargerItem(tStack)) { - ++this.mBatteryCount; - } - - ++this.mChargeableCount; - } - }*/ + /* + * this.mCharge = aBaseMetaTileEntity.getStoredEU() / 2L > aBaseMetaTileEntity.getEUCapacity() / 3L; + * this.mDecharge = aBaseMetaTileEntity.getStoredEU() < aBaseMetaTileEntity.getEUCapacity() / 3L; + * this.mBatteryCount = 0; this.mChargeableCount = 0; ItemStack[] arg3 = this.mInventory; int arg4 = + * arg3.length; for (int arg5 = 0; arg5 < arg4; ++arg5) { ItemStack tStack = arg3[arg5]; if + * (GT_ModHandler.isElectricItem(tStack, this.mTier)) { if (GT_ModHandler.isChargerItem(tStack)) { + * ++this.mBatteryCount; } ++this.mChargeableCount; } } + */ } } @@ -274,11 +268,11 @@ public class GT_MetaTileEntity_BasicBreaker extends GTPP_MTE_TieredMachineBlock tStored = Long.MAX_VALUE; } - return new long[] {tStored, tScale}; + return new long[] { tStored, tScale }; } public String[] getInfoData() { - return new String[] {"Tile Type: " + this.getTileEntityBaseType()}; + return new String[] { "Tile Type: " + this.getTileEntityBaseType() }; } public boolean isGivingInformation() { diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_BasicMachine_GTPP_Recipe.java b/src/main/java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_BasicMachine_GTPP_Recipe.java index cf92bdc0ba..a47ed592c4 100644 --- a/src/main/java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_BasicMachine_GTPP_Recipe.java +++ b/src/main/java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_BasicMachine_GTPP_Recipe.java @@ -6,25 +6,10 @@ import gregtech.api.util.GT_Recipe.GT_Recipe_Map; public class GT_MetaTileEntity_BasicMachine_GTPP_Recipe extends GT_MetaTileEntity_BasicMachine_GT_Recipe { - public GT_MetaTileEntity_BasicMachine_GTPP_Recipe( - int aID, - String aName, - String aNameRegional, - int aTier, - String aDescription, - 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_GTPP_Recipe(int aID, String aName, String aNameRegional, int aTier, + String aDescription, 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) { super( aID, aName, @@ -46,24 +31,10 @@ public class GT_MetaTileEntity_BasicMachine_GTPP_Recipe extends GT_MetaTileEntit aRecipe); } - public GT_MetaTileEntity_BasicMachine_GTPP_Recipe( - String aName, - int aTier, - String aDescription, - 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_GTPP_Recipe(String aName, int aTier, String aDescription, + 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, @@ -84,24 +55,10 @@ public class GT_MetaTileEntity_BasicMachine_GTPP_Recipe extends GT_MetaTileEntit aSpecialEffect); } - public GT_MetaTileEntity_BasicMachine_GTPP_Recipe( - String aName, - int aTier, - String[] aDescription, - 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_GTPP_Recipe(String aName, int aTier, String[] aDescription, + 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, diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_Dehydrator.java b/src/main/java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_Dehydrator.java index 7273977101..6852d7be5f 100644 --- a/src/main/java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_Dehydrator.java +++ b/src/main/java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_Dehydrator.java @@ -31,8 +31,8 @@ public class GT_MetaTileEntity_Dehydrator extends GT_MetaTileEntity_BasicMachine // 3 8 } - public GT_MetaTileEntity_Dehydrator( - int aID, String aName, String aNameRegional, int aTier, String aDescription, int aTankCapacity) { + public GT_MetaTileEntity_Dehydrator(int aID, String aName, String aNameRegional, int aTier, String aDescription, + int aTankCapacity) { super( aID, aName, @@ -54,16 +54,9 @@ public class GT_MetaTileEntity_Dehydrator extends GT_MetaTileEntity_BasicMachine null); } - public GT_MetaTileEntity_Dehydrator( - String aName, - int aTier, - String[] aDescription, - GT_Recipe.GT_Recipe_Map aRecipes, - int aTankCapacity, - int aAmperage, - ITexture[][][] aTextures, - String aGUIName, - String aNEIName) { + public GT_MetaTileEntity_Dehydrator(String aName, int aTier, String[] aDescription, + GT_Recipe.GT_Recipe_Map aRecipes, int aTankCapacity, int aAmperage, ITexture[][][] aTextures, + String aGUIName, String aNEIName) { super( aName, aTier, @@ -116,13 +109,8 @@ public class GT_MetaTileEntity_Dehydrator extends GT_MetaTileEntity_BasicMachine } @Override - public ITexture[] getTexture( - final IGregTechTileEntity aBaseMetaTileEntity, - final byte aSide, - final byte aFacing, - final byte aColorIndex, - final boolean aActive, - final boolean aRedstone) { + public ITexture[] getTexture(final IGregTechTileEntity aBaseMetaTileEntity, final byte aSide, final byte aFacing, + final byte aColorIndex, final boolean aActive, final boolean aRedstone) { return super.getTexture(aBaseMetaTileEntity, aSide, aFacing, aColorIndex, aActive, aRedstone); // return this.mTextures[(aActive ? 5 : 0) + (aSide == aFacing ? 0 : aSide == // GT_Utility.getOppositeSide(aFacing) ? 1 : aSide == 0 ? 2 : aSide == 1 ? 3 : 4)][aColorIndex + 1]; @@ -130,87 +118,79 @@ public class GT_MetaTileEntity_Dehydrator extends GT_MetaTileEntity_BasicMachine @Override public ITexture[] getFrontFacingInactive(final byte aColor) { - return new ITexture[] { - Textures.BlockIcons.MACHINE_CASINGS[this.mTier][aColor + 1], new GT_RenderedTexture(sDehydratorOverlays[0]) - }; + return new ITexture[] { Textures.BlockIcons.MACHINE_CASINGS[this.mTier][aColor + 1], + new GT_RenderedTexture(sDehydratorOverlays[0]) }; } @Override public ITexture[] getBottomFacingInactive(final byte aColor) { - return new ITexture[] { - Textures.BlockIcons.MACHINE_CASINGS[this.mTier][aColor + 1], new GT_RenderedTexture(sDehydratorOverlays[2]) - }; + return new ITexture[] { Textures.BlockIcons.MACHINE_CASINGS[this.mTier][aColor + 1], + new GT_RenderedTexture(sDehydratorOverlays[2]) }; } @Override public ITexture[] getTopFacingInactive(final byte aColor) { - return new ITexture[] { - Textures.BlockIcons.MACHINE_CASINGS[this.mTier][aColor + 1], new GT_RenderedTexture(sDehydratorOverlays[3]) - }; + return new ITexture[] { Textures.BlockIcons.MACHINE_CASINGS[this.mTier][aColor + 1], + new GT_RenderedTexture(sDehydratorOverlays[3]) }; } @Override public ITexture[] getSideFacingInactive(final byte aColor) { - return new ITexture[] { - Textures.BlockIcons.MACHINE_CASINGS[this.mTier][aColor + 1], new GT_RenderedTexture(sDehydratorOverlays[4]) - }; + return new ITexture[] { Textures.BlockIcons.MACHINE_CASINGS[this.mTier][aColor + 1], + new GT_RenderedTexture(sDehydratorOverlays[4]) }; } @Override public ITexture[] getFrontFacingActive(final byte aColor) { - return new ITexture[] { - Textures.BlockIcons.MACHINE_CASINGS[this.mTier][aColor + 1], new GT_RenderedTexture(sDehydratorOverlays[5]) - }; + return new ITexture[] { Textures.BlockIcons.MACHINE_CASINGS[this.mTier][aColor + 1], + new GT_RenderedTexture(sDehydratorOverlays[5]) }; } @Override public ITexture[] getBottomFacingActive(final byte aColor) { - return new ITexture[] { - Textures.BlockIcons.MACHINE_CASINGS[this.mTier][aColor + 1], new GT_RenderedTexture(sDehydratorOverlays[7]) - }; + return new ITexture[] { Textures.BlockIcons.MACHINE_CASINGS[this.mTier][aColor + 1], + new GT_RenderedTexture(sDehydratorOverlays[7]) }; } @Override public ITexture[] getTopFacingActive(final byte aColor) { - return new ITexture[] { - Textures.BlockIcons.MACHINE_CASINGS[this.mTier][aColor + 1], new GT_RenderedTexture(sDehydratorOverlays[8]) - }; + return new ITexture[] { Textures.BlockIcons.MACHINE_CASINGS[this.mTier][aColor + 1], + new GT_RenderedTexture(sDehydratorOverlays[8]) }; } @Override public ITexture[] getSideFacingActive(final byte aColor) { - return new ITexture[] { - Textures.BlockIcons.MACHINE_CASINGS[this.mTier][aColor + 1], new GT_RenderedTexture(sDehydratorOverlays[9]) - }; + return new ITexture[] { Textures.BlockIcons.MACHINE_CASINGS[this.mTier][aColor + 1], + new GT_RenderedTexture(sDehydratorOverlays[9]) }; } @Override 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) }; } @Override 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) }; } @Override 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) }; } @Override 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) }; } @Override 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) }; } @Override 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) }; } } diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_DeluxeMachine.java b/src/main/java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_DeluxeMachine.java index 299580391a..8b39d1da32 100644 --- a/src/main/java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_DeluxeMachine.java +++ b/src/main/java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_DeluxeMachine.java @@ -2,6 +2,17 @@ package gtPlusPlus.xmod.gregtech.api.metatileentity.implementations; import static gregtech.api.enums.GT_Values.V; +import java.util.Arrays; + +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.item.ItemStack; +import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.tileentity.TileEntity; +import net.minecraftforge.common.DimensionManager; +import net.minecraftforge.common.util.ForgeDirection; +import net.minecraftforge.fluids.FluidStack; +import net.minecraftforge.fluids.IFluidHandler; + import gregtech.api.GregTech_API; import gregtech.api.enums.ItemList; import gregtech.api.enums.Textures; @@ -16,78 +27,47 @@ import gregtech.api.util.GT_Recipe.GT_Recipe_Map; import gregtech.api.util.GT_Utility; import gtPlusPlus.api.objects.Logger; import gtPlusPlus.api.objects.random.XSTR; -import java.util.Arrays; -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.item.ItemStack; -import net.minecraft.nbt.NBTTagCompound; -import net.minecraft.tileentity.TileEntity; -import net.minecraftforge.common.DimensionManager; -import net.minecraftforge.common.util.ForgeDirection; -import net.minecraftforge.fluids.FluidStack; -import net.minecraftforge.fluids.IFluidHandler; /** * 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_DeluxeMachine extends GT_MetaTileEntity_DeluxeTank { + /** * 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 = 4; 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 int mMainFacing = -1, mProgresstime = 0, mMaxProgresstime = 0, mEUt = 0, mOutputBlocked = 0; public FluidStack mOutputFluid; public String mGUIName = "", mNEIName = ""; /** - * 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_DeluxeMachine( - int aID, - String aName, - String aNameRegional, - int aTier, - int aAmperage, - String aDescription, - int aInputSlotCount, - int aOutputSlotCount, - String aGUIName, - String aNEIName, + public GT_MetaTileEntity_DeluxeMachine(int aID, String aName, String aNameRegional, int aTier, int aAmperage, + String aDescription, int aInputSlotCount, int aOutputSlotCount, String aGUIName, String aNEIName, ITexture... aOverlays) { super( aID, @@ -104,16 +84,8 @@ public abstract class GT_MetaTileEntity_DeluxeMachine extends GT_MetaTileEntity_ mNEIName = aNEIName; } - public GT_MetaTileEntity_DeluxeMachine( - String aName, - int aTier, - int aAmperage, - String aDescription, - ITexture[][][] aTextures, - int aInputSlotCount, - int aOutputSlotCount, - String aGUIName, - String aNEIName) { + public GT_MetaTileEntity_DeluxeMachine(String aName, int aTier, int aAmperage, String aDescription, + ITexture[][][] aTextures, int aInputSlotCount, int aOutputSlotCount, String aGUIName, String aNEIName) { super(aName, aTier, OTHER_SLOT_COUNT + aInputSlotCount + aOutputSlotCount + 1, aDescription, aTextures); mInputSlotCount = Math.max(0, aInputSlotCount); mOutputItems = new ItemStack[Math.max(0, aOutputSlotCount)]; @@ -137,13 +109,10 @@ public abstract class GT_MetaTileEntity_DeluxeMachine extends GT_MetaTileEntity_ 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[] {Textures.BlockIcons.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[] { + Textures.BlockIcons.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); @@ -165,28 +134,16 @@ public abstract class GT_MetaTileEntity_DeluxeMachine extends GT_MetaTileEntity_ } @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 @@ -211,8 +168,7 @@ public abstract class GT_MetaTileEntity_DeluxeMachine extends GT_MetaTileEntity_ @Override public boolean isValidSlot(int aIndex) { - return aIndex > 0 - && super.isValidSlot(aIndex) + return aIndex > 0 && super.isValidSlot(aIndex) && aIndex != OTHER_SLOT_COUNT + mInputSlotCount + mOutputItems.length; } @@ -243,9 +199,7 @@ public abstract class GT_MetaTileEntity_DeluxeMachine extends GT_MetaTileEntity_ @Override public boolean isLiquidInput(byte aSide) { - return aSide != mMainFacing - && (mAllowInputFromOutputSide - || aSide != getBaseMetaTileEntity().getFrontFacing()); + return aSide != mMainFacing && (mAllowInputFromOutputSide || aSide != getBaseMetaTileEntity().getFrontFacing()); } @Override @@ -336,8 +290,7 @@ public abstract class GT_MetaTileEntity_DeluxeMachine extends GT_MetaTileEntity_ @Override public boolean isFluidInputAllowed(FluidStack aFluid) { - return getFillableStack() != null - || (getRecipeList() != null && getRecipeList().containsInput(aFluid)); + return getFillableStack() != null || (getRecipeList() != null && getRecipeList().containsInput(aFluid)); } @Override @@ -416,9 +369,8 @@ public abstract class GT_MetaTileEntity_DeluxeMachine extends GT_MetaTileEntity_ if (mOutputFluid != null) aNBT.setTag("mOutputFluid", mOutputFluid.writeToNBT(new NBTTagCompound())); if (mFluidOut != null) aNBT.setTag("mFluidOut", mFluidOut.writeToNBT(new NBTTagCompound())); - for (int i = 0; i < mOutputItems.length; i++) - if (mOutputItems[i] != null) - aNBT.setTag("mOutputItem" + i, mOutputItems[i].writeToNBT(new NBTTagCompound())); + for (int i = 0; i < mOutputItems.length; i++) if (mOutputItems[i] != null) + aNBT.setTag("mOutputItem" + i, mOutputItems[i].writeToNBT(new NBTTagCompound())); } @Override @@ -457,9 +409,9 @@ public abstract class GT_MetaTileEntity_DeluxeMachine extends GT_MetaTileEntity_ 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())) @@ -475,15 +427,14 @@ public abstract class GT_MetaTileEntity_DeluxeMachine extends GT_MetaTileEntity_ } if (mProgresstime > 5) mStuttering = false; XSTR aXSTR = new XSTR(); - if (false && aXSTR.nextInt(5000) == 0) - GT_Utility.sendSoundToPlayers( - aBaseMetaTileEntity.getWorld(), - GregTech_API.sSoundList.get(5), - 10.0F, - -1.0F, - aBaseMetaTileEntity.getXCoord(), - aBaseMetaTileEntity.getYCoord(), - aBaseMetaTileEntity.getZCoord()); + if (false && aXSTR.nextInt(5000) == 0) GT_Utility.sendSoundToPlayers( + aBaseMetaTileEntity.getWorld(), + GregTech_API.sSoundList.get(5), + 10.0F, + -1.0F, + aBaseMetaTileEntity.getXCoord(), + aBaseMetaTileEntity.getYCoord(), + aBaseMetaTileEntity.getZCoord()); } else { if (!mStuttering) { stutterProcess(); @@ -498,8 +449,7 @@ public abstract class GT_MetaTileEntity_DeluxeMachine extends GT_MetaTileEntity_ boolean tRemovedOutputFluid = false; Logger.WARNING("R0"); - if (doesAutoOutputFluids() - && getDrainableStack() != null + if (doesAutoOutputFluids() && getDrainableStack() != null && aBaseMetaTileEntity.getFrontFacing() != mMainFacing && (tSucceeded || aTick % 20 == 0)) { IFluidHandler tTank = aBaseMetaTileEntity.getITankContainerAtSide(aBaseMetaTileEntity.getFrontFacing()); @@ -507,28 +457,26 @@ public abstract class GT_MetaTileEntity_DeluxeMachine extends GT_MetaTileEntity_ 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()); - for (int i = 0, tCosts = 1; - i < mOutputItems.length && tCosts > 0 && aBaseMetaTileEntity.isUniversalEnergyStored(128); - i++) { + for (int i = 0, tCosts = 1; i < mOutputItems.length && tCosts > 0 + && aBaseMetaTileEntity.isUniversalEnergyStored(128); i++) { tCosts = GT_Utility.moveOneItemStack( aBaseMetaTileEntity, tTileEntity2, @@ -544,9 +492,8 @@ public abstract class GT_MetaTileEntity_DeluxeMachine extends GT_MetaTileEntity_ } } - if (mOutputBlocked != 0) - if (isOutputEmpty()) mOutputBlocked = 0; - else mOutputBlocked++; + if (mOutputBlocked != 0) if (isOutputEmpty()) mOutputBlocked = 0; + else mOutputBlocked++; Logger.WARNING("R1"); if (allowToCheckRecipe()) { Logger.WARNING("R2--------------------------------------------------"); @@ -564,10 +511,8 @@ public abstract class GT_MetaTileEntity_DeluxeMachine extends GT_MetaTileEntity_ Logger.WARNING("R2--------------------------------------------------"); Logger.WARNING("R2-hasEnoughEnergyToCheckRecipe(): " + hasEnoughEnergyToCheckRecipe()); Logger.WARNING("R2--------------------------------------------------"); - if (mMaxProgresstime <= 0 - && aBaseMetaTileEntity.isAllowedToWork() - && (tRemovedOutputFluid - || tSucceeded + if (mMaxProgresstime <= 0 && aBaseMetaTileEntity.isAllowedToWork() + && (tRemovedOutputFluid || tSucceeded || aBaseMetaTileEntity.hasInventoryBeenModified() || aTick % 600 == 0 || aBaseMetaTileEntity.hasWorkJustBeenEnabled()) @@ -620,8 +565,8 @@ public abstract class GT_MetaTileEntity_DeluxeMachine extends GT_MetaTileEntity_ if (ItemList.Display_Fluid.isStackEqual(mInventory[tDisplayStackSlot], true, true)) mInventory[tDisplayStackSlot] = null; } else { - mInventory[tDisplayStackSlot] = - GT_Utility.getFluidDisplayStack(getFillableStack(), displaysStackSize()); + mInventory[tDisplayStackSlot] = GT_Utility + .getFluidDisplayStack(getFillableStack(), displaysStackSize()); } } } @@ -667,32 +612,27 @@ public abstract class GT_MetaTileEntity_DeluxeMachine extends GT_MetaTileEntity_ } 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) { @@ -792,15 +732,9 @@ public abstract class GT_MetaTileEntity_DeluxeMachine extends GT_MetaTileEntity_ @Override public String[] getInfoData() { - return new String[] { - mNEIName, - "Progress:", - (mProgresstime / 20) + " secs", - (mMaxProgresstime / 20) + " secs", - "Stored Energy:", - getBaseMetaTileEntity().getStoredEU() + "EU", - getBaseMetaTileEntity().getEUCapacity() + "EU" - }; + return new String[] { mNEIName, "Progress:", (mProgresstime / 20) + " secs", (mMaxProgresstime / 20) + " secs", + "Stored Energy:", getBaseMetaTileEntity().getStoredEU() + "EU", + getBaseMetaTileEntity().getEUCapacity() + "EU" }; } @Override @@ -814,17 +748,15 @@ public abstract class GT_MetaTileEntity_DeluxeMachine extends GT_MetaTileEntity_ mAllowInputFromOutputSide = !mAllowInputFromOutputSide; GT_Utility.sendChatToPlayer( aPlayer, - mAllowInputFromOutputSide - ? ("Input from Output Side allowed") + mAllowInputFromOutputSide ? ("Input from Output Side allowed") : ("Input from Output Side forbidden")); } } @Override public boolean allowCoverOnSide(byte aSide, GT_ItemStack aCoverID) { - return (aSide != mMainFacing - || GregTech_API.getCoverBehavior(aCoverID.toStack()) - .isGUIClickable(aSide, GT_Utility.stackToInt(aCoverID.toStack()), 0, getBaseMetaTileEntity())); + return (aSide != mMainFacing || GregTech_API.getCoverBehavior(aCoverID.toStack()) + .isGUIClickable(aSide, GT_Utility.stackToInt(aCoverID.toStack()), 0, getBaseMetaTileEntity())); } @Override @@ -834,10 +766,10 @@ public abstract class GT_MetaTileEntity_DeluxeMachine extends GT_MetaTileEntity_ @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])) return i == aIndex; return true; @@ -851,7 +783,8 @@ public abstract class GT_MetaTileEntity_DeluxeMachine extends GT_MetaTileEntity_ } /** - * 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/> @@ -885,13 +818,12 @@ public abstract class GT_MetaTileEntity_DeluxeMachine extends GT_MetaTileEntity_ mLastRecipe, false, V[mTier], - new FluidStack[] {getFillableStack()}, + new FluidStack[] { getFillableStack() }, getSpecialSlot(), getAllInputs()); if (tRecipe == null) return DID_NOT_FIND_RECIPE; - if (false - && tRecipe.mSpecialValue == -100 + if (false && tRecipe.mSpecialValue == -100 && !isValidForLowGravity(tRecipe, getBaseMetaTileEntity().getWorld().provider.dimensionId)) return FOUND_RECIPE_BUT_DID_NOT_MEET_REQUIREMENTS; if (tRecipe.mCanBeBuffered) mLastRecipe = tRecipe; @@ -899,7 +831,7 @@ public abstract class GT_MetaTileEntity_DeluxeMachine extends GT_MetaTileEntity_ mOutputBlocked++; 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)) @@ -910,76 +842,64 @@ public abstract class GT_MetaTileEntity_DeluxeMachine extends GT_MetaTileEntity_ } public ITexture[] getSideFacingActive(byte aColor) { - return new ITexture[] {Textures.BlockIcons.MACHINE_CASINGS[mTier][aColor + 1]}; + return new ITexture[] { Textures.BlockIcons.MACHINE_CASINGS[mTier][aColor + 1] }; } public ITexture[] getSideFacingInactive(byte aColor) { - return new ITexture[] {Textures.BlockIcons.MACHINE_CASINGS[mTier][aColor + 1]}; + return new ITexture[] { Textures.BlockIcons.MACHINE_CASINGS[mTier][aColor + 1] }; } public ITexture[] getFrontFacingActive(byte aColor) { - return new ITexture[] {Textures.BlockIcons.MACHINE_CASINGS[mTier][aColor + 1]}; + return new ITexture[] { Textures.BlockIcons.MACHINE_CASINGS[mTier][aColor + 1] }; } public ITexture[] getFrontFacingInactive(byte aColor) { - return new ITexture[] {Textures.BlockIcons.MACHINE_CASINGS[mTier][aColor + 1]}; + return new ITexture[] { Textures.BlockIcons.MACHINE_CASINGS[mTier][aColor + 1] }; } public ITexture[] getTopFacingActive(byte aColor) { - return new ITexture[] {Textures.BlockIcons.MACHINE_CASINGS[mTier][aColor + 1]}; + return new ITexture[] { Textures.BlockIcons.MACHINE_CASINGS[mTier][aColor + 1] }; } public ITexture[] getTopFacingInactive(byte aColor) { - return new ITexture[] {Textures.BlockIcons.MACHINE_CASINGS[mTier][aColor + 1]}; + return new ITexture[] { Textures.BlockIcons.MACHINE_CASINGS[mTier][aColor + 1] }; } public ITexture[] getBottomFacingActive(byte aColor) { - return new ITexture[] {Textures.BlockIcons.MACHINE_CASINGS[mTier][aColor + 1]}; + return new ITexture[] { Textures.BlockIcons.MACHINE_CASINGS[mTier][aColor + 1] }; } public ITexture[] getBottomFacingInactive(byte aColor) { - return new ITexture[] {Textures.BlockIcons.MACHINE_CASINGS[mTier][aColor + 1]}; + return new ITexture[] { Textures.BlockIcons.MACHINE_CASINGS[mTier][aColor + 1] }; } public ITexture[] getBottomFacingPipeActive(byte aColor) { - return new ITexture[] { - Textures.BlockIcons.MACHINE_CASINGS[mTier][aColor + 1], - new GT_RenderedTexture(Textures.BlockIcons.OVERLAY_PIPE_OUT) - }; + return new ITexture[] { Textures.BlockIcons.MACHINE_CASINGS[mTier][aColor + 1], + new GT_RenderedTexture(Textures.BlockIcons.OVERLAY_PIPE_OUT) }; } public ITexture[] getBottomFacingPipeInactive(byte aColor) { - return new ITexture[] { - Textures.BlockIcons.MACHINE_CASINGS[mTier][aColor + 1], - new GT_RenderedTexture(Textures.BlockIcons.OVERLAY_PIPE_OUT) - }; + return new ITexture[] { Textures.BlockIcons.MACHINE_CASINGS[mTier][aColor + 1], + new GT_RenderedTexture(Textures.BlockIcons.OVERLAY_PIPE_OUT) }; } public ITexture[] getTopFacingPipeActive(byte aColor) { - return new ITexture[] { - Textures.BlockIcons.MACHINE_CASINGS[mTier][aColor + 1], - new GT_RenderedTexture(Textures.BlockIcons.OVERLAY_PIPE_OUT) - }; + return new ITexture[] { Textures.BlockIcons.MACHINE_CASINGS[mTier][aColor + 1], + new GT_RenderedTexture(Textures.BlockIcons.OVERLAY_PIPE_OUT) }; } public ITexture[] getTopFacingPipeInactive(byte aColor) { - return new ITexture[] { - Textures.BlockIcons.MACHINE_CASINGS[mTier][aColor + 1], - new GT_RenderedTexture(Textures.BlockIcons.OVERLAY_PIPE_OUT) - }; + return new ITexture[] { Textures.BlockIcons.MACHINE_CASINGS[mTier][aColor + 1], + new GT_RenderedTexture(Textures.BlockIcons.OVERLAY_PIPE_OUT) }; } public ITexture[] getSideFacingPipeActive(byte aColor) { - return new ITexture[] { - Textures.BlockIcons.MACHINE_CASINGS[mTier][aColor + 1], - new GT_RenderedTexture(Textures.BlockIcons.OVERLAY_PIPE_OUT) - }; + return new ITexture[] { Textures.BlockIcons.MACHINE_CASINGS[mTier][aColor + 1], + new GT_RenderedTexture(Textures.BlockIcons.OVERLAY_PIPE_OUT) }; } public ITexture[] getSideFacingPipeInactive(byte aColor) { - return new ITexture[] { - Textures.BlockIcons.MACHINE_CASINGS[mTier][aColor + 1], - new GT_RenderedTexture(Textures.BlockIcons.OVERLAY_PIPE_OUT) - }; + return new ITexture[] { Textures.BlockIcons.MACHINE_CASINGS[mTier][aColor + 1], + new GT_RenderedTexture(Textures.BlockIcons.OVERLAY_PIPE_OUT) }; } } diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_DeluxeTank.java b/src/main/java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_DeluxeTank.java index 50c2237209..f57293f03c 100644 --- a/src/main/java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_DeluxeTank.java +++ b/src/main/java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_DeluxeTank.java @@ -1,14 +1,15 @@ package gtPlusPlus.xmod.gregtech.api.metatileentity.implementations; +import net.minecraft.item.ItemStack; +import net.minecraft.nbt.NBTTagCompound; +import net.minecraftforge.fluids.FluidStack; + import gregtech.api.enums.ItemList; import gregtech.api.interfaces.ITexture; import gregtech.api.interfaces.tileentity.IGregTechTileEntity; import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_BasicTank; import gregtech.api.util.GT_Utility; import gtPlusPlus.api.objects.Logger; -import net.minecraft.item.ItemStack; -import net.minecraft.nbt.NBTTagCompound; -import net.minecraftforge.fluids.FluidStack; /** * NEVER INCLUDE THIS FILE IN YOUR MOD!!! @@ -22,23 +23,13 @@ public abstract class GT_MetaTileEntity_DeluxeTank extends GT_MetaTileEntity_Bas /** * @param aInvSlotCount should be 3 */ - public GT_MetaTileEntity_DeluxeTank( - final int aID, - final String aName, - final String aNameRegional, - final int aTier, - final int aInvSlotCount, - final String aDescription, - final ITexture... aTextures) { + public GT_MetaTileEntity_DeluxeTank(final int aID, final String aName, final String aNameRegional, final int aTier, + final int aInvSlotCount, final String aDescription, final ITexture... aTextures) { super(aID, aName, aNameRegional, aTier, aInvSlotCount, aDescription, aTextures); } - public GT_MetaTileEntity_DeluxeTank( - final String aName, - final int aTier, - final int aInvSlotCount, - final String aDescription, - final ITexture[][][] aTextures) { + public GT_MetaTileEntity_DeluxeTank(final String aName, final int aTier, final int aInvSlotCount, + final String aDescription, final ITexture[][][] aTextures) { super(aName, aTier, aInvSlotCount, aDescription, aTextures); } @@ -164,35 +155,32 @@ public abstract class GT_MetaTileEntity_DeluxeTank extends GT_MetaTileEntity_Bas @Override public void onPreTick(final IGregTechTileEntity aBaseMetaTileEntity, final long aTick) { if (aBaseMetaTileEntity.isServerSide()) { - if (this.isFluidChangingAllowed() - && (this.getFillableStack() != null) + if (this.isFluidChangingAllowed() && (this.getFillableStack() != null) && (this.getFillableStack().amount <= 0)) { this.setFillableStack(null); } - if (this.displaysItemStack() - && (this.getStackDisplaySlot() >= 0) + if (this.displaysItemStack() && (this.getStackDisplaySlot() >= 0) && (this.getStackDisplaySlot() < this.mInventory.length)) { if (this.getDisplayedFluid() == null) { if (ItemList.Display_Fluid.isStackEqual(this.mInventory[this.getStackDisplaySlot()], true, true)) { this.mInventory[this.getStackDisplaySlot()] = null; } } else { - this.mInventory[this.getStackDisplaySlot()] = - GT_Utility.getFluidDisplayStack(this.getDisplayedFluid(), this.displaysStackSize()); + this.mInventory[this.getStackDisplaySlot()] = GT_Utility + .getFluidDisplayStack(this.getDisplayedFluid(), this.displaysStackSize()); } } - if (this.displaysItemStack() - && (this.getStackDisplaySlot2() >= 0) + if (this.displaysItemStack() && (this.getStackDisplaySlot2() >= 0) && (this.getStackDisplaySlot2() < this.mInventory.length)) { if (this.getDrainableStackEx(2) == null) { if (ItemList.Display_Fluid.isStackEqual(this.mInventory[this.getStackDisplaySlot2()], true, true)) { this.mInventory[this.getStackDisplaySlot2()] = null; } } else { - this.mInventory[this.getStackDisplaySlot2()] = - GT_Utility.getFluidDisplayStack(this.getDrainableStackEx(2), this.displaysStackSize()); + this.mInventory[this.getStackDisplaySlot2()] = GT_Utility + .getFluidDisplayStack(this.getDrainableStackEx(2), this.displaysStackSize()); } } @@ -223,39 +211,43 @@ public abstract class GT_MetaTileEntity_DeluxeTank extends GT_MetaTileEntity_Bas } } } - } else if (tFluid.isFluidEqual(this.getDrainableStackEx(2)) - || (this.getDrainableStackEx(2) == null)) { - if (this.getFillableStackEx(2) == null) { - if (this.isFluidInputAllowed(tFluid) && (tFluid.amount <= this.getCapacity())) { - if (aBaseMetaTileEntity.addStackToSlot( - this.getOutputSlot(), - GT_Utility.getContainerItem(this.mInventory[this.getInputSlot()], true), - 1)) { - this.setFillableStack2(tFluid.copy()); - aBaseMetaTileEntity.decrStackSize(this.getInputSlot(), 1); + } else + if (tFluid.isFluidEqual(this.getDrainableStackEx(2)) || (this.getDrainableStackEx(2) == null)) { + if (this.getFillableStackEx(2) == null) { + if (this.isFluidInputAllowed(tFluid) && (tFluid.amount <= this.getCapacity())) { + if (aBaseMetaTileEntity.addStackToSlot( + this.getOutputSlot(), + GT_Utility.getContainerItem(this.mInventory[this.getInputSlot()], true), + 1)) { + this.setFillableStack2(tFluid.copy()); + aBaseMetaTileEntity.decrStackSize(this.getInputSlot(), 1); + } } - } - } else { - if (tFluid.isFluidEqual(this.getFillableStackEx(2)) - && ((tFluid.amount + this.getFillableStackEx(2).amount) <= this.getCapacity())) { - if (aBaseMetaTileEntity.addStackToSlot( - this.getOutputSlot(), - GT_Utility.getContainerItem(this.mInventory[this.getInputSlot()], true), - 1)) { - this.getFillableStackEx(2).amount += tFluid.amount; - aBaseMetaTileEntity.decrStackSize(this.getInputSlot(), 1); + } else { + if (tFluid.isFluidEqual(this.getFillableStackEx(2)) + && ((tFluid.amount + this.getFillableStackEx(2).amount) + <= this.getCapacity())) { + if (aBaseMetaTileEntity.addStackToSlot( + this.getOutputSlot(), + GT_Utility.getContainerItem(this.mInventory[this.getInputSlot()], true), + 1)) { + this.getFillableStackEx(2).amount += tFluid.amount; + aBaseMetaTileEntity.decrStackSize(this.getInputSlot(), 1); + } } } + } else { + Logger.INFO("Something broke when trying to empty cells between two fluid tank areas."); } - } else { - Logger.INFO("Something broke when trying to empty cells between two fluid tank areas."); - } } } if (this.doesFillContainers()) { final ItemStack tOutput = GT_Utility.fillFluidContainer( - this.getDrainableStack(), this.mInventory[this.getInputSlot()], false, true); + this.getDrainableStack(), + this.mInventory[this.getInputSlot()], + false, + true); if ((tOutput != null) && aBaseMetaTileEntity.addStackToSlot(this.getOutputSlot(), tOutput, 1)) { final FluidStack tFluid = GT_Utility.getFluidForFilledItem(tOutput, true); aBaseMetaTileEntity.decrStackSize(this.getInputSlot(), 1); @@ -282,16 +274,14 @@ public abstract class GT_MetaTileEntity_DeluxeTank extends GT_MetaTileEntity_Bas @Override public int fill(final FluidStack aFluid, final boolean doFill) { - if ((aFluid == null) - || (aFluid.getFluid().getID() <= 0) + if ((aFluid == null) || (aFluid.getFluid().getID() <= 0) || (aFluid.amount <= 0) || !this.canTankBeFilled() || !this.isFluidInputAllowed(aFluid)) { return 0; } - if ((this.getFillableStack() == null) - || (this.getFillableStack().getFluid().getID() <= 0)) { + if ((this.getFillableStack() == null) || (this.getFillableStack().getFluid().getID() <= 0)) { if (aFluid.amount <= this.getCapacity()) { if (doFill) { this.setFillableStack(aFluid.copy()); @@ -358,14 +348,14 @@ public abstract class GT_MetaTileEntity_DeluxeTank extends GT_MetaTileEntity_Bas } @Override - public boolean allowPullStack( - final IGregTechTileEntity aBaseMetaTileEntity, final int aIndex, final byte aSide, final ItemStack aStack) { + public boolean allowPullStack(final IGregTechTileEntity aBaseMetaTileEntity, final int aIndex, final byte aSide, + final ItemStack aStack) { return aIndex == this.getOutputSlot(); } @Override - public boolean allowPutStack( - final IGregTechTileEntity aBaseMetaTileEntity, final int aIndex, final byte aSide, final ItemStack aStack) { + public boolean allowPutStack(final IGregTechTileEntity aBaseMetaTileEntity, final int aIndex, final byte aSide, + final ItemStack aStack) { return aIndex == this.getInputSlot(); } } diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_Hatch_AirIntake.java b/src/main/java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_Hatch_AirIntake.java index 6a49e9b84d..cc0bec1026 100644 --- a/src/main/java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_Hatch_AirIntake.java +++ b/src/main/java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_Hatch_AirIntake.java @@ -1,23 +1,24 @@ package gtPlusPlus.xmod.gregtech.api.metatileentity.implementations; +import net.minecraft.world.World; +import net.minecraftforge.common.util.ForgeDirection; +import net.minecraftforge.fluids.Fluid; + import gregtech.api.interfaces.ITexture; import gregtech.api.interfaces.tileentity.IGregTechTileEntity; import gregtech.api.metatileentity.MetaTileEntity; import gtPlusPlus.core.lib.CORE; import gtPlusPlus.core.util.minecraft.FluidUtils; -import net.minecraft.world.World; -import net.minecraftforge.common.util.ForgeDirection; -import net.minecraftforge.fluids.Fluid; public class GT_MetaTileEntity_Hatch_AirIntake extends GT_MetaTileEntity_Hatch_FluidGenerator { - public GT_MetaTileEntity_Hatch_AirIntake( - final int aID, final String aName, final String aNameRegional, final int aTier) { + public GT_MetaTileEntity_Hatch_AirIntake(final int aID, final String aName, final String aNameRegional, + final int aTier) { super(aID, aName, aNameRegional, aTier); } - public GT_MetaTileEntity_Hatch_AirIntake( - final String aName, final int aTier, final String aDescription, final ITexture[][][] aTextures) { + public GT_MetaTileEntity_Hatch_AirIntake(final String aName, final int aTier, final String aDescription, + final ITexture[][][] aTextures) { super(aName, aTier, aDescription, aTextures); } @@ -56,8 +57,7 @@ public class GT_MetaTileEntity_Hatch_AirIntake extends GT_MetaTileEntity_Hatch_F @Override public boolean doesHatchMeetConditionsToGenerate() { - return this.getBaseMetaTileEntity() - .getAirAtSide(this.getBaseMetaTileEntity().getFrontFacing()); + return this.getBaseMetaTileEntity().getAirAtSide(this.getBaseMetaTileEntity().getFrontFacing()); } @Override diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_Hatch_AirIntake_Extreme.java b/src/main/java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_Hatch_AirIntake_Extreme.java index ca640b7a1d..bfc9cc7fc6 100644 --- a/src/main/java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_Hatch_AirIntake_Extreme.java +++ b/src/main/java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_Hatch_AirIntake_Extreme.java @@ -6,13 +6,13 @@ import gregtech.api.metatileentity.MetaTileEntity; public class GT_MetaTileEntity_Hatch_AirIntake_Extreme extends GT_MetaTileEntity_Hatch_AirIntake { - public GT_MetaTileEntity_Hatch_AirIntake_Extreme( - final int aID, final String aName, final String aNameRegional, final int aTier) { + public GT_MetaTileEntity_Hatch_AirIntake_Extreme(final int aID, final String aName, final String aNameRegional, + final int aTier) { super(aID, aName, aNameRegional, aTier); } - public GT_MetaTileEntity_Hatch_AirIntake_Extreme( - final String aName, final int aTier, final String aDescription, final ITexture[][][] aTextures) { + public GT_MetaTileEntity_Hatch_AirIntake_Extreme(final String aName, final int aTier, final String aDescription, + final ITexture[][][] aTextures) { super(aName, aTier, aDescription, aTextures); } diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_Hatch_ControlCore.java b/src/main/java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_Hatch_ControlCore.java index 37037f7bbb..5fb855c572 100644 --- a/src/main/java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_Hatch_ControlCore.java +++ b/src/main/java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_Hatch_ControlCore.java @@ -1,7 +1,12 @@ package gtPlusPlus.xmod.gregtech.api.metatileentity.implementations; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.item.ItemStack; +import net.minecraft.tileentity.TileEntity; + import com.gtnewhorizons.modularui.api.screen.ModularWindow; import com.gtnewhorizons.modularui.api.screen.UIBuildContext; + import gregtech.api.gui.*; import gregtech.api.gui.modularui.GT_UIInfos; import gregtech.api.interfaces.ITexture; @@ -16,9 +21,6 @@ import gtPlusPlus.core.item.general.ItemControlCore; import gtPlusPlus.core.lib.CORE; import gtPlusPlus.xmod.gregtech.common.StaticFields59; import gtPlusPlus.xmod.gregtech.common.blocks.textures.TexturesGtBlock; -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.item.ItemStack; -import net.minecraft.tileentity.TileEntity; public class GT_MetaTileEntity_Hatch_ControlCore extends GT_MetaTileEntity_Hatch { @@ -40,24 +42,24 @@ public class GT_MetaTileEntity_Hatch_ControlCore extends GT_MetaTileEntity_Hatch super(aName, aTier, aTier < 1 ? 1 : aTier == 1 ? 4 : aTier == 2 ? 9 : 16, aDescription, aTextures); } - public GT_MetaTileEntity_Hatch_ControlCore( - String aName, int aTier, String[] aDescription, ITexture[][][] aTextures) { + public GT_MetaTileEntity_Hatch_ControlCore(String aName, int aTier, String[] aDescription, + ITexture[][][] aTextures) { super(aName, aTier, aTier < 1 ? 1 : aTier == 1 ? 4 : aTier == 2 ? 9 : 16, aDescription[0], aTextures); } @Override public String[] getDescription() { - return new String[] {this.mDescription, CORE.GT_Tooltip}; + return new String[] { this.mDescription, CORE.GT_Tooltip }; } @Override public ITexture[] getTexturesActive(ITexture aBaseTexture) { - return new ITexture[] {aBaseTexture, new GT_RenderedTexture(TexturesGtBlock.Overlay_Hatch_Control_Core)}; + return new ITexture[] { aBaseTexture, new GT_RenderedTexture(TexturesGtBlock.Overlay_Hatch_Control_Core) }; } @Override public ITexture[] getTexturesInactive(ITexture aBaseTexture) { - return new ITexture[] {aBaseTexture, new GT_RenderedTexture(TexturesGtBlock.Overlay_Hatch_Control_Core)}; + return new ITexture[] { aBaseTexture, new GT_RenderedTexture(TexturesGtBlock.Overlay_Hatch_Control_Core) }; } @Override @@ -83,7 +85,10 @@ public class GT_MetaTileEntity_Hatch_ControlCore extends GT_MetaTileEntity_Hatch @Override public MetaTileEntity newMetaEntity(IGregTechTileEntity aTileEntity) { return new GT_MetaTileEntity_Hatch_ControlCore( - mName, mTier, StaticFields59.getDescriptionArray(this), mTextures); + mName, + mTier, + StaticFields59.getDescriptionArray(this), + mTextures); } @Override @@ -107,19 +112,18 @@ public class GT_MetaTileEntity_Hatch_ControlCore extends GT_MetaTileEntity_Hatch protected void fillStacksIntoFirstSlots() { for (int i = 0; i < mInventory.length; i++) - for (int j = i + 1; j < mInventory.length; j++) - if (mInventory[j] != null - && (mInventory[i] == null || GT_Utility.areStacksEqual(mInventory[i], mInventory[j]))) { - GT_Utility.moveStackFromSlotAToSlotB( - getBaseMetaTileEntity(), - getBaseMetaTileEntity(), - j, - i, - (byte) 64, - (byte) 1, - (byte) 64, - (byte) 1); - } + for (int j = i + 1; j < mInventory.length; j++) if (mInventory[j] != null + && (mInventory[i] == null || GT_Utility.areStacksEqual(mInventory[i], mInventory[j]))) { + GT_Utility.moveStackFromSlotAToSlotB( + getBaseMetaTileEntity(), + getBaseMetaTileEntity(), + j, + i, + (byte) 64, + (byte) 1, + (byte) 64, + (byte) 1); + } } @Override diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_Hatch_DynamoBuffer.java b/src/main/java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_Hatch_DynamoBuffer.java index 8405e2b09c..c9ab1e48a0 100644 --- a/src/main/java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_Hatch_DynamoBuffer.java +++ b/src/main/java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_Hatch_DynamoBuffer.java @@ -10,27 +10,28 @@ import gtPlusPlus.core.util.Utils; import gtPlusPlus.xmod.gregtech.common.blocks.textures.TexturesGtBlock; public class GT_MetaTileEntity_Hatch_DynamoBuffer extends GT_MetaTileEntity_Hatch_Dynamo { - public GT_MetaTileEntity_Hatch_DynamoBuffer( - final int aID, final String aName, final String aNameRegional, final int aTier) { + + public GT_MetaTileEntity_Hatch_DynamoBuffer(final int aID, final String aName, final String aNameRegional, + final int aTier) { super(aID, aName, aNameRegional, aTier); } - public GT_MetaTileEntity_Hatch_DynamoBuffer( - final String aName, final int aTier, final String aDescription, final ITexture[][][] aTextures) { + public GT_MetaTileEntity_Hatch_DynamoBuffer(final String aName, final int aTier, final String aDescription, + final ITexture[][][] aTextures) { super(aName, aTier, aDescription, aTextures); } - /*public GT_MetaTileEntity_Hatch_DynamoBuffer(final String aName, final int aTier, final String[] aDescription, - final ITexture[][][] aTextures) { - super(aName, aTier, aDescription, aTextures); - }*/ + /* + * public GT_MetaTileEntity_Hatch_DynamoBuffer(final String aName, final int aTier, final String[] aDescription, + * final ITexture[][][] aTextures) { super(aName, aTier, aDescription, aTextures); } + */ public ITexture[] getTexturesActive(final ITexture aBaseTexture) { - return new ITexture[] {aBaseTexture, TexturesGtBlock.OVERLAYS_ENERGY_OUT_MULTI_BUFFER[this.mTier]}; + return new ITexture[] { aBaseTexture, TexturesGtBlock.OVERLAYS_ENERGY_OUT_MULTI_BUFFER[this.mTier] }; } public ITexture[] getTexturesInactive(final ITexture aBaseTexture) { - return new ITexture[] {aBaseTexture, TexturesGtBlock.OVERLAYS_ENERGY_OUT_MULTI_BUFFER[this.mTier]}; + return new ITexture[] { aBaseTexture, TexturesGtBlock.OVERLAYS_ENERGY_OUT_MULTI_BUFFER[this.mTier] }; } @Override @@ -45,30 +46,26 @@ public class GT_MetaTileEntity_Hatch_DynamoBuffer extends GT_MetaTileEntity_Hatc @Override public MetaTileEntity newMetaEntity(final IGregTechTileEntity aTileEntity) { - return (MetaTileEntity) - new GT_MetaTileEntity_Hatch_DynamoBuffer(this.mName, this.mTier, this.mDescription, this.mTextures); + return (MetaTileEntity) new GT_MetaTileEntity_Hatch_DynamoBuffer( + this.mName, + this.mTier, + this.mDescription, + this.mTextures); } @Override public String[] getDescription() { String[] g; if (CORE.GTNH || (CORE.MAIN_GREGTECH_5U_EXPERIMENTAL_FORK && Utils.getGregtechVersionAsInt() >= 50932)) { - g = new String[] { - "Dynamo with internal storage and additional Amp capacity", - "Does not accept more than " + (this.maxEUOutput() * this.maxAmperesIn()) + "EU/t as input", - CORE.GT_Tooltip - }; + g = new String[] { "Dynamo with internal storage and additional Amp capacity", + "Does not accept more than " + (this.maxEUOutput() * this.maxAmperesIn()) + "EU/t as input", + CORE.GT_Tooltip }; } else { - g = new String[] { - "Dynamo with internal storage and additional Amp capacity", - "Stores " + maxEUStore() + "EU", - "Amperage In: 4", - "Amperage Out: 4", - "Does not accept more than " + (this.maxEUOutput() * this.maxAmperesIn()) + "EU/t as input", - "Large Turbines only supply 1A to this, other Multiblocks can inject more amps", - CORE.GT_Tooltip - }; + g = new String[] { "Dynamo with internal storage and additional Amp capacity", + "Stores " + maxEUStore() + "EU", "Amperage In: 4", "Amperage Out: 4", + "Does not accept more than " + (this.maxEUOutput() * this.maxAmperesIn()) + "EU/t as input", + "Large Turbines only supply 1A to this, other Multiblocks can inject more amps", CORE.GT_Tooltip }; } return g; } diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_Hatch_ElementalDataOrbHolder.java b/src/main/java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_Hatch_ElementalDataOrbHolder.java index 964bc8adcf..fc80f604b3 100644 --- a/src/main/java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_Hatch_ElementalDataOrbHolder.java +++ b/src/main/java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_Hatch_ElementalDataOrbHolder.java @@ -1,8 +1,15 @@ package gtPlusPlus.xmod.gregtech.api.metatileentity.implementations; +import java.util.ArrayList; + +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 com.gtnewhorizons.modularui.common.widget.SlotGroup; + import gregtech.api.enums.ItemList; import gregtech.api.gui.modularui.GT_UIInfos; import gregtech.api.gui.modularui.GT_UITextures; @@ -18,42 +25,41 @@ import gtPlusPlus.api.objects.Logger; import gtPlusPlus.core.lib.CORE; import gtPlusPlus.core.util.minecraft.ItemUtils; import gtPlusPlus.xmod.gregtech.common.blocks.textures.TexturesGtBlock; -import java.util.ArrayList; -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.item.ItemStack; -import net.minecraft.nbt.NBTTagCompound; public class GT_MetaTileEntity_Hatch_ElementalDataOrbHolder extends GT_MetaTileEntity_Hatch implements IConfigurationCircuitSupport { + public GT_Recipe_Map mRecipeMap = null; public GT_MetaTileEntity_Hatch_ElementalDataOrbHolder(int aID, String aName, String aNameRegional, int aTier) { - super(aID, aName, aNameRegional, aTier, 17, new String[] { - "Holds Data Orbs for the Elemental Duplicator", - "Can insert/extract the circuit slot", - "Use Circuit to select a slot (1-16)", - CORE.GT_Tooltip - }); - } - - public GT_MetaTileEntity_Hatch_ElementalDataOrbHolder( - String aName, int aTier, String aDescription, ITexture[][][] aTextures) { + super( + aID, + aName, + aNameRegional, + aTier, + 17, + new String[] { "Holds Data Orbs for the Elemental Duplicator", "Can insert/extract the circuit slot", + "Use Circuit to select a slot (1-16)", CORE.GT_Tooltip }); + } + + public GT_MetaTileEntity_Hatch_ElementalDataOrbHolder(String aName, int aTier, String aDescription, + ITexture[][][] aTextures) { super(aName, aTier, 17, aDescription, aTextures); } - public GT_MetaTileEntity_Hatch_ElementalDataOrbHolder( - String aName, int aTier, String[] aDescription, ITexture[][][] aTextures) { + public GT_MetaTileEntity_Hatch_ElementalDataOrbHolder(String aName, int aTier, String[] aDescription, + ITexture[][][] aTextures) { super(aName, aTier, 17, aDescription, aTextures); } @Override public ITexture[] getTexturesActive(ITexture aBaseTexture) { - return new ITexture[] {aBaseTexture, new GT_RenderedTexture(TexturesGtBlock.Overlay_Hatch_Data_Orb)}; + return new ITexture[] { aBaseTexture, new GT_RenderedTexture(TexturesGtBlock.Overlay_Hatch_Data_Orb) }; } @Override public ITexture[] getTexturesInactive(ITexture aBaseTexture) { - return new ITexture[] {aBaseTexture, new GT_RenderedTexture(TexturesGtBlock.Overlay_Hatch_Data_Orb)}; + return new ITexture[] { aBaseTexture, new GT_RenderedTexture(TexturesGtBlock.Overlay_Hatch_Data_Orb) }; } @Override @@ -128,8 +134,7 @@ public class GT_MetaTileEntity_Hatch_ElementalDataOrbHolder extends GT_MetaTileE @Override public boolean allowPullStack(IGregTechTileEntity aBaseMetaTileEntity, int aIndex, byte aSide, ItemStack aStack) { Logger.INFO("Checking if we can pull " + aStack.getDisplayName() + " from slot " + aIndex); - if (aIndex == mInventory.length - 1 - && ItemUtils.isControlCircuit(aStack) + if (aIndex == mInventory.length - 1 && ItemUtils.isControlCircuit(aStack) && aSide == getBaseMetaTileEntity().getFrontFacing()) { return true; } @@ -139,8 +144,7 @@ public class GT_MetaTileEntity_Hatch_ElementalDataOrbHolder extends GT_MetaTileE @Override public boolean allowPutStack(IGregTechTileEntity aBaseMetaTileEntity, int aIndex, byte aSide, ItemStack aStack) { Logger.INFO("Checking if we can put " + aStack.getDisplayName() + " into slot " + aIndex); - if (aIndex == mInventory.length - 1 - && ItemUtils.isControlCircuit(aStack) + if (aIndex == mInventory.length - 1 && ItemUtils.isControlCircuit(aStack) && aSide == getBaseMetaTileEntity().getFrontFacing()) { return true; } @@ -158,8 +162,7 @@ public class GT_MetaTileEntity_Hatch_ElementalDataOrbHolder extends GT_MetaTileE @Override public boolean canInsertItem(int aIndex, ItemStack aStack, int aSide) { - if (aIndex == mInventory.length - 1 - && ItemUtils.isControlCircuit(aStack) + if (aIndex == mInventory.length - 1 && ItemUtils.isControlCircuit(aStack) && aSide == getBaseMetaTileEntity().getFrontFacing()) { Logger.INFO("Putting " + aStack.getDisplayName() + " into slot " + aIndex); return true; @@ -203,13 +206,12 @@ public class GT_MetaTileEntity_Hatch_ElementalDataOrbHolder extends GT_MetaTileE @Override public void addUIWidgets(ModularWindow.Builder builder, UIBuildContext buildContext) { - builder.widget(SlotGroup.ofItemHandler(inventoryHandler, 4) - .startFromSlot(0) - .endAtSlot(15) - .background(getGUITextureSet().getItemSlot(), GT_UITextures.OVERLAY_SLOT_DATA_ORB) - .applyForWidget( - widget -> widget.setFilter(stack -> ItemList.Tool_DataOrb.isStackEqual(stack, false, true))) - .build() - .setPos(52, 7)); + builder.widget( + SlotGroup.ofItemHandler(inventoryHandler, 4).startFromSlot(0).endAtSlot(15) + .background(getGUITextureSet().getItemSlot(), GT_UITextures.OVERLAY_SLOT_DATA_ORB) + .applyForWidget( + widget -> widget + .setFilter(stack -> ItemList.Tool_DataOrb.isStackEqual(stack, false, true))) + .build().setPos(52, 7)); } } diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_Hatch_Energy_RTG.java b/src/main/java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_Hatch_Energy_RTG.java index 7f291533a9..0d35795cb3 100644 --- a/src/main/java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_Hatch_Energy_RTG.java +++ b/src/main/java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_Hatch_Energy_RTG.java @@ -2,8 +2,16 @@ package gtPlusPlus.xmod.gregtech.api.metatileentity.implementations; import static gregtech.api.enums.GT_Values.V; +import java.util.HashMap; + +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.item.Item; +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.interfaces.ITexture; import gregtech.api.interfaces.tileentity.IGregTechTileEntity; @@ -14,23 +22,22 @@ import gtPlusPlus.core.lib.CORE; import gtPlusPlus.core.util.minecraft.InventoryUtils; import gtPlusPlus.core.util.minecraft.ItemUtils; import gtPlusPlus.xmod.gregtech.common.blocks.textures.TexturesGtBlock; -import java.util.HashMap; -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.item.Item; -import net.minecraft.item.ItemStack; -import net.minecraft.nbt.NBTTagCompound; public class GT_MetaTileEntity_Hatch_Energy_RTG extends GT_MetaTileEntity_Hatch_Energy { - public GT_MetaTileEntity_Hatch_Energy_RTG( - int aID, String aName, String aNameRegional, int aTier, int aInvSlotCount) { - super(aID, aName, aNameRegional, aTier, aInvSlotCount, new String[] { - "Energy Injector for Multiblocks", "Accepts up to 2 Amps" - }); + public GT_MetaTileEntity_Hatch_Energy_RTG(int aID, String aName, String aNameRegional, int aTier, + int aInvSlotCount) { + super( + aID, + aName, + aNameRegional, + aTier, + aInvSlotCount, + new String[] { "Energy Injector for Multiblocks", "Accepts up to 2 Amps" }); } - public GT_MetaTileEntity_Hatch_Energy_RTG( - String aName, int aTier, int aInvSlotCount, String[] aDescription, ITexture[][][] aTextures) { + public GT_MetaTileEntity_Hatch_Energy_RTG(String aName, int aTier, int aInvSlotCount, String[] aDescription, + ITexture[][][] aTextures) { super(aName, aTier, aInvSlotCount, aDescription, aTextures); } @@ -45,18 +52,14 @@ public class GT_MetaTileEntity_Hatch_Energy_RTG extends GT_MetaTileEntity_Hatch_ @Override public ITexture[] getTexturesActive(ITexture aBaseTexture) { - return new ITexture[] { - aBaseTexture, - TexturesGtBlock.getTextureFromIcon(TexturesGtBlock.Overlay_Hatch_RTG_On, new short[] {220, 220, 220, 0}) - }; + return new ITexture[] { aBaseTexture, TexturesGtBlock + .getTextureFromIcon(TexturesGtBlock.Overlay_Hatch_RTG_On, new short[] { 220, 220, 220, 0 }) }; } @Override public ITexture[] getTexturesInactive(ITexture aBaseTexture) { - return new ITexture[] { - aBaseTexture, - TexturesGtBlock.getTextureFromIcon(TexturesGtBlock.Overlay_Hatch_RTG_Off, new short[] {220, 220, 220, 0}) - }; + return new ITexture[] { aBaseTexture, TexturesGtBlock + .getTextureFromIcon(TexturesGtBlock.Overlay_Hatch_RTG_Off, new short[] { 220, 220, 220, 0 }) }; } @Override @@ -139,8 +142,8 @@ public class GT_MetaTileEntity_Hatch_Energy_RTG extends GT_MetaTileEntity_Hatch_ public Dat(ItemStack aStack) { mStack = aStack; mNBT = (aStack.getTagCompound() != null ? aStack.getTagCompound() : new NBTTagCompound()); - mUniqueDataTag = "" + Item.getIdFromItem(aStack.getItem()) + "" + aStack.getItemDamage() + "" + 1 + "" - + mNBT.getId(); + mUniqueDataTag = "" + Item + .getIdFromItem(aStack.getItem()) + "" + aStack.getItemDamage() + "" + 1 + "" + mNBT.getId(); } public int getKey() { @@ -165,8 +168,9 @@ public class GT_MetaTileEntity_Hatch_Energy_RTG extends GT_MetaTileEntity_Hatch_ mFuelValueMap.put(aKey, aFuelValue); mFuelTypeMap.put(aKey, aDat.getKey()); mFuelTypeMapReverse.put(aDat.getKey(), aKey); - Logger.INFO("RTG Hatch: Registered Fuel Pellet: " + ItemUtils.getItemName(aTemp) + ", Fuel Value: " + aFuelValue - + ", Key: " + aKey + ", Key2: " + aDat.getKey()); + Logger.INFO( + "RTG Hatch: Registered Fuel Pellet: " + ItemUtils.getItemName( + aTemp) + ", Fuel Value: " + aFuelValue + ", Key: " + aKey + ", Key2: " + aDat.getKey()); return true; } diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_Hatch_FluidGenerator.java b/src/main/java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_Hatch_FluidGenerator.java index b11b3bc78e..86cddb8220 100644 --- a/src/main/java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_Hatch_FluidGenerator.java +++ b/src/main/java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_Hatch_FluidGenerator.java @@ -1,5 +1,15 @@ package gtPlusPlus.xmod.gregtech.api.metatileentity.implementations; +import java.lang.reflect.Field; + +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.item.ItemStack; +import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.world.World; +import net.minecraftforge.common.util.ForgeDirection; +import net.minecraftforge.fluids.Fluid; +import net.minecraftforge.fluids.FluidStack; + import gregtech.api.enums.Textures; import gregtech.api.interfaces.IIconContainer; import gregtech.api.interfaces.ITexture; @@ -12,27 +22,19 @@ import gtPlusPlus.api.objects.random.XSTR; import gtPlusPlus.core.lib.CORE; import gtPlusPlus.core.util.minecraft.FluidUtils; import gtPlusPlus.core.util.reflect.ReflectionUtils; -import java.lang.reflect.Field; -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.item.ItemStack; -import net.minecraft.nbt.NBTTagCompound; -import net.minecraft.world.World; -import net.minecraftforge.common.util.ForgeDirection; -import net.minecraftforge.fluids.Fluid; -import net.minecraftforge.fluids.FluidStack; public abstract class GT_MetaTileEntity_Hatch_FluidGenerator extends GT_MetaTileEntity_Hatch_Input { protected static XSTR floatGen = new XSTR(); public int mProgresstime = 0, mMaxProgresstime = 0; - public GT_MetaTileEntity_Hatch_FluidGenerator( - final int aID, final String aName, final String aNameRegional, final int aTier) { + public GT_MetaTileEntity_Hatch_FluidGenerator(final int aID, final String aName, final String aNameRegional, + final int aTier) { super(aID, aName, aNameRegional, aTier); } - public GT_MetaTileEntity_Hatch_FluidGenerator( - final String aName, final int aTier, final String aDescription, final ITexture[][][] aTextures) { + public GT_MetaTileEntity_Hatch_FluidGenerator(final String aName, final int aTier, final String aDescription, + final ITexture[][][] aTextures) { super(aName, aTier, aDescription, aTextures); } @@ -61,7 +63,7 @@ public abstract class GT_MetaTileEntity_Hatch_FluidGenerator extends GT_MetaTile if (o instanceof String[]) { S = (String[]) o; } else if (o instanceof String) { - S = new String[] {(String) o}; + S = new String[] { (String) o }; } } } @@ -85,19 +87,17 @@ public abstract class GT_MetaTileEntity_Hatch_FluidGenerator extends GT_MetaTile t.printStackTrace(); } - return new String[] {"Broken Tooltip - Report on Github"}; + return new String[] { "Broken Tooltip - Report on Github" }; } public ITexture[] getTexturesActive(final ITexture aBaseTexture) { - return new ITexture[] { - aBaseTexture, new GT_RenderedTexture((IIconContainer) Textures.BlockIcons.OVERLAY_MUFFLER) - }; + return new ITexture[] { aBaseTexture, + new GT_RenderedTexture((IIconContainer) Textures.BlockIcons.OVERLAY_MUFFLER) }; } public ITexture[] getTexturesInactive(final ITexture aBaseTexture) { - return new ITexture[] { - aBaseTexture, new GT_RenderedTexture((IIconContainer) Textures.BlockIcons.OVERLAY_MUFFLER) - }; + return new ITexture[] { aBaseTexture, + new GT_RenderedTexture((IIconContainer) Textures.BlockIcons.OVERLAY_MUFFLER) }; } public boolean isSimpleMachine() { @@ -118,13 +118,13 @@ public abstract class GT_MetaTileEntity_Hatch_FluidGenerator extends GT_MetaTile public abstract MetaTileEntity newMetaEntity(final IGregTechTileEntity aTileEntity); - public boolean allowPullStack( - final IGregTechTileEntity aBaseMetaTileEntity, final int aIndex, final byte aSide, final ItemStack aStack) { + public boolean allowPullStack(final IGregTechTileEntity aBaseMetaTileEntity, final int aIndex, final byte aSide, + final ItemStack aStack) { return false; } - public boolean allowPutStack( - final IGregTechTileEntity aBaseMetaTileEntity, final int aIndex, final byte aSide, final ItemStack aStack) { + public boolean allowPutStack(final IGregTechTileEntity aBaseMetaTileEntity, final int aIndex, final byte aSide, + final ItemStack aStack) { return false; } @@ -198,9 +198,8 @@ public abstract class GT_MetaTileEntity_Hatch_FluidGenerator extends GT_MetaTile // Logger.INFO("To add: "+this.getAmountOfFluidToGenerate()); // Logger.INFO("Space Free: "+(this.getCapacity()-this.getFluidAmount())); } - if (this.mFluid == null - || (this.mFluid != null - && (this.getCapacity() - this.getFluidAmount() >= this.getAmountOfFluidToGenerate()))) { + if (this.mFluid == null || (this.mFluid != null + && (this.getCapacity() - this.getFluidAmount() >= this.getAmountOfFluidToGenerate()))) { return true; } return false; @@ -218,8 +217,7 @@ public abstract class GT_MetaTileEntity_Hatch_FluidGenerator extends GT_MetaTile @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 || aFluid.getFluid() != getFluidToGenerate() || !canTankBeFilled()) { diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_Hatch_InputBattery.java b/src/main/java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_Hatch_InputBattery.java index 03ba69a7cc..af9dab15ff 100644 --- a/src/main/java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_Hatch_InputBattery.java +++ b/src/main/java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_Hatch_InputBattery.java @@ -2,8 +2,12 @@ package gtPlusPlus.xmod.gregtech.api.metatileentity.implementations; import static gregtech.api.enums.GT_Values.V; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.item.ItemStack; + import com.gtnewhorizons.modularui.api.screen.ModularWindow; import com.gtnewhorizons.modularui.api.screen.UIBuildContext; + import gregtech.api.enums.GT_Values; import gregtech.api.gui.modularui.GT_UIInfos; import gregtech.api.interfaces.ITexture; @@ -17,18 +21,17 @@ import gregtech.api.util.GT_Utility; import gtPlusPlus.core.lib.CORE; import gtPlusPlus.xmod.gregtech.api.gui.widget.ElectricSlotWidget; import gtPlusPlus.xmod.gregtech.common.blocks.textures.TexturesGtBlock; -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.item.ItemStack; public class GT_MetaTileEntity_Hatch_InputBattery extends GT_MetaTileEntity_Hatch { + public final GT_Recipe_Map mRecipeMap = null; public GT_MetaTileEntity_Hatch_InputBattery(int aID, String aName, String aNameRegional, int aTier) { super(aID, aName, aNameRegional, aTier, getSlots(aTier), "Chargeable Item Bus for Multiblocks"); } - public GT_MetaTileEntity_Hatch_InputBattery( - String aName, int aTier, String aDescription, ITexture[][][] aTextures) { + public GT_MetaTileEntity_Hatch_InputBattery(String aName, int aTier, String aDescription, + ITexture[][][] aTextures) { super(aName, aTier, aTier < 1 ? 1 : aTier == 1 ? 4 : aTier == 2 ? 4 : 16, aDescription, aTextures); } @@ -42,7 +45,7 @@ public class GT_MetaTileEntity_Hatch_InputBattery extends GT_MetaTileEntity_Hatc } else { mSlots = 16; } - return new String[] {this.mDescription, "Capacity: " + mSlots + " slots", CORE.GT_Tooltip}; + return new String[] { this.mDescription, "Capacity: " + mSlots + " slots", CORE.GT_Tooltip }; } @Override @@ -77,12 +80,12 @@ public class GT_MetaTileEntity_Hatch_InputBattery extends GT_MetaTileEntity_Hatc @Override public ITexture[] getTexturesActive(ITexture aBaseTexture) { - return new ITexture[] {aBaseTexture, new GT_RenderedTexture(TexturesGtBlock.Overlay_Hatch_Charger)}; + return new ITexture[] { aBaseTexture, new GT_RenderedTexture(TexturesGtBlock.Overlay_Hatch_Charger) }; } @Override public ITexture[] getTexturesInactive(ITexture aBaseTexture) { - return new ITexture[] {aBaseTexture, new GT_RenderedTexture(TexturesGtBlock.Overlay_Hatch_Charger)}; + return new ITexture[] { aBaseTexture, new GT_RenderedTexture(TexturesGtBlock.Overlay_Hatch_Charger) }; } @Override @@ -126,9 +129,7 @@ public class GT_MetaTileEntity_Hatch_InputBattery extends GT_MetaTileEntity_Hatc MetaTileEntity mMetaTileEntity = (MetaTileEntity) aBaseMetaTileEntity.getMetaTileEntity(); if (mMetaTileEntity.rechargerSlotCount() > 0 && aBaseMetaTileEntity.getStoredEU() > 0) { for (int i = mMetaTileEntity.rechargerSlotStartIndex(), - k = mMetaTileEntity.rechargerSlotCount() + i; - i < k; - i++) { + k = mMetaTileEntity.rechargerSlotCount() + i; i < k; i++) { if (aBaseMetaTileEntity.getStoredEU() > 0 && mMetaTileEntity.mInventory[i] != null) { for (int u = 0; u < 10; u++) { aBaseMetaTileEntity.decreaseStoredEnergyUnits( @@ -163,19 +164,18 @@ public class GT_MetaTileEntity_Hatch_InputBattery extends GT_MetaTileEntity_Hatc protected void fillStacksIntoFirstSlots() { for (int i = 0; i < mInventory.length; i++) - for (int j = i + 1; j < mInventory.length; j++) - if (mInventory[j] != null - && (mInventory[i] == null || GT_Utility.areStacksEqual(mInventory[i], mInventory[j]))) { - GT_Utility.moveStackFromSlotAToSlotB( - getBaseMetaTileEntity(), - getBaseMetaTileEntity(), - j, - i, - (byte) 64, - (byte) 1, - (byte) 64, - (byte) 1); - } + for (int j = i + 1; j < mInventory.length; j++) if (mInventory[j] != null + && (mInventory[i] == null || GT_Utility.areStacksEqual(mInventory[i], mInventory[j]))) { + GT_Utility.moveStackFromSlotAToSlotB( + getBaseMetaTileEntity(), + getBaseMetaTileEntity(), + j, + i, + (byte) 64, + (byte) 1, + (byte) 64, + (byte) 1); + } } @Override diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_Hatch_Muffler_Adv.java b/src/main/java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_Hatch_Muffler_Adv.java index f62e0c27e0..4ece1a69f9 100644 --- a/src/main/java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_Hatch_Muffler_Adv.java +++ b/src/main/java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_Hatch_Muffler_Adv.java @@ -1,8 +1,14 @@ package gtPlusPlus.xmod.gregtech.api.metatileentity.implementations; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.item.ItemStack; +import net.minecraft.world.World; +import net.minecraftforge.common.util.ForgeDirection; + import com.gtnewhorizons.modularui.api.screen.ModularWindow; import com.gtnewhorizons.modularui.api.screen.UIBuildContext; import com.gtnewhorizons.modularui.common.widget.SlotWidget; + import gregtech.api.enums.GT_Values; import gregtech.api.gui.modularui.GT_UIInfos; import gregtech.api.gui.modularui.GUITextureSet; @@ -20,10 +26,6 @@ import gtPlusPlus.core.util.minecraft.gregtech.PollutionUtils; import gtPlusPlus.xmod.gregtech.api.gui.GTPP_UITextures; import gtPlusPlus.xmod.gregtech.common.StaticFields59; import gtPlusPlus.xmod.gregtech.common.blocks.textures.TexturesGtBlock; -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.item.ItemStack; -import net.minecraft.world.World; -import net.minecraftforge.common.util.ForgeDirection; public class GT_MetaTileEntity_Hatch_Muffler_Adv extends GT_MetaTileEntity_Hatch_Muffler implements IAddGregtechLogo { @@ -47,11 +49,11 @@ public class GT_MetaTileEntity_Hatch_Muffler_Adv extends GT_MetaTileEntity_Hatch private int mPollutionSmogLimit = 500000; public GT_MetaTileEntity_Hatch_Muffler_Adv(int aID, String aName, String aNameRegional, int aTier) { - super(aID, aName, aNameRegional, aTier, 1, new String[] {""}); + super(aID, aName, aNameRegional, aTier, 1, new String[] { "" }); } - public GT_MetaTileEntity_Hatch_Muffler_Adv( - String aName, int aTier, String[] aDescription, ITexture[][][] aTextures) { + public GT_MetaTileEntity_Hatch_Muffler_Adv(String aName, int aTier, String[] aDescription, + ITexture[][][] aTextures) { super(aName, aTier, 1, aDescription, aTextures); } @@ -64,10 +66,10 @@ public class GT_MetaTileEntity_Hatch_Muffler_Adv extends GT_MetaTileEntity_Hatch desc[mDescArray.length + 1] = "Requires 3 Air on the exhaust face"; desc[mDescArray.length + 2] = "Requires Air Filters"; desc[mDescArray.length + 3] = "Mufflers require T2 Filters from IV-" + GT_Values.VN[9]; - desc[mDescArray.length + 4] = - "Reduces Pollution to " + this.calculatePollutionReductionForTooltip(100) + "%"; - desc[mDescArray.length + 5] = - "Recovers " + (105 - this.calculatePollutionReductionForTooltip(100)) + "% of CO2/CO/SO2"; + desc[mDescArray.length + 4] = "Reduces Pollution to " + this.calculatePollutionReductionForTooltip(100) + + "%"; + desc[mDescArray.length + 5] = "Recovers " + (105 - this.calculatePollutionReductionForTooltip(100)) + + "% of CO2/CO/SO2"; desc[mDescArray.length + 6] = CORE.GT_Tooltip; return desc; } else { @@ -76,11 +78,11 @@ public class GT_MetaTileEntity_Hatch_Muffler_Adv extends GT_MetaTileEntity_Hatch } public ITexture[] getTexturesActive(ITexture aBaseTexture) { - return new ITexture[] {aBaseTexture, new GT_RenderedTexture(TexturesGtBlock.Overlay_Hatch_Muffler_Adv)}; + return new ITexture[] { aBaseTexture, new GT_RenderedTexture(TexturesGtBlock.Overlay_Hatch_Muffler_Adv) }; } public ITexture[] getTexturesInactive(ITexture aBaseTexture) { - return new ITexture[] {aBaseTexture, new GT_RenderedTexture(TexturesGtBlock.Overlay_Hatch_Muffler_Adv)}; + return new ITexture[] { aBaseTexture, new GT_RenderedTexture(TexturesGtBlock.Overlay_Hatch_Muffler_Adv) }; } public boolean isValidSlot(int aIndex) { @@ -89,7 +91,10 @@ public class GT_MetaTileEntity_Hatch_Muffler_Adv extends GT_MetaTileEntity_Hatch public MetaTileEntity newMetaEntity(IGregTechTileEntity aTileEntity) { return new GT_MetaTileEntity_Hatch_Muffler_Adv( - this.mName, this.mTier, StaticFields59.getDescriptionArray(this), this.mTextures); + this.mName, + this.mTier, + StaticFields59.getDescriptionArray(this), + this.mTextures); } @Override @@ -99,8 +104,7 @@ public class GT_MetaTileEntity_Hatch_Muffler_Adv extends GT_MetaTileEntity_Hatch } private boolean airCheck() { - if (this.getBaseMetaTileEntity() - .getAirAtSide(this.getBaseMetaTileEntity().getFrontFacing()) + if (this.getBaseMetaTileEntity().getAirAtSide(this.getBaseMetaTileEntity().getFrontFacing()) && this.getBaseMetaTileEntity() .getAirAtSideAndDistance(this.getBaseMetaTileEntity().getFrontFacing(), 1) && this.getBaseMetaTileEntity() @@ -130,8 +134,7 @@ public class GT_MetaTileEntity_Hatch_Muffler_Adv extends GT_MetaTileEntity_Hatch double aVal1 = aPollution * Math.pow(0.64D, (double) (this.mTier - 1)); int aVal2 = (int) aVal1; if (!hasValidFilter()) { - aVal2 = (int) ((double) aPollution * Math.pow(0.7D, (double) (this.mTier - 1))); - ; + aVal2 = (int) ((double) aPollution * Math.pow(0.7D, (double) (this.mTier - 1)));; } return aVal2; } @@ -331,10 +334,8 @@ public class GT_MetaTileEntity_Hatch_Muffler_Adv extends GT_MetaTileEntity_Hatch @Override public GUITextureSet getGUITextureSet() { - return new GUITextureSet() - .setMainBackground(GTPP_UITextures.BACKGROUND_YELLOW) - .setItemSlot(GTPP_UITextures.SLOT_ITEM_YELLOW) - .setTitleTab( + return new GUITextureSet().setMainBackground(GTPP_UITextures.BACKGROUND_YELLOW) + .setItemSlot(GTPP_UITextures.SLOT_ITEM_YELLOW).setTitleTab( GTPP_UITextures.TAB_TITLE_YELLOW, GTPP_UITextures.TAB_TITLE_DARK_YELLOW, GTPP_UITextures.TAB_TITLE_ANGULAR_YELLOW); @@ -342,9 +343,8 @@ public class GT_MetaTileEntity_Hatch_Muffler_Adv extends GT_MetaTileEntity_Hatch @Override public void addUIWidgets(ModularWindow.Builder builder, UIBuildContext buildContext) { - builder.widget(new SlotWidget(inventoryHandler, 0) - .setFilter(stack -> stack.getItem() instanceof ItemAirFilter) - .setBackground(getGUITextureSet().getItemSlot()) - .setPos(79, 34)); + builder.widget( + new SlotWidget(inventoryHandler, 0).setFilter(stack -> stack.getItem() instanceof ItemAirFilter) + .setBackground(getGUITextureSet().getItemSlot()).setPos(79, 34)); } } diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_Hatch_Naquadah.java b/src/main/java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_Hatch_Naquadah.java index 350b7a788a..54cf8f1366 100644 --- a/src/main/java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_Hatch_Naquadah.java +++ b/src/main/java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_Hatch_Naquadah.java @@ -1,5 +1,11 @@ package gtPlusPlus.xmod.gregtech.api.metatileentity.implementations; +import java.lang.reflect.Field; + +import net.minecraft.item.ItemStack; +import net.minecraft.util.EnumChatFormatting; +import net.minecraftforge.fluids.FluidStack; + import gregtech.api.enums.Materials; import gregtech.api.enums.Textures; import gregtech.api.enums.Textures.BlockIcons; @@ -13,10 +19,6 @@ import gregtech.api.util.GT_Utility; import gtPlusPlus.core.lib.CORE; import gtPlusPlus.core.util.reflect.ReflectionUtils; import gtPlusPlus.xmod.gregtech.common.StaticFields59; -import java.lang.reflect.Field; -import net.minecraft.item.ItemStack; -import net.minecraft.util.EnumChatFormatting; -import net.minecraftforge.fluids.FluidStack; public class GT_MetaTileEntity_Hatch_Naquadah extends GT_MetaTileEntity_Hatch_Input { @@ -29,15 +31,15 @@ public class GT_MetaTileEntity_Hatch_Naquadah extends GT_MetaTileEntity_Hatch_In initHatch(); } - public GT_MetaTileEntity_Hatch_Naquadah( - final String aName, final String aDescription, final ITexture[][][] aTextures) { + public GT_MetaTileEntity_Hatch_Naquadah(final String aName, final String aDescription, + final ITexture[][][] aTextures) { super(aName, 6, aDescription, aTextures); mFluidCapacity = 32000; initHatch(); } - public GT_MetaTileEntity_Hatch_Naquadah( - final String aName, final String[] aDescription, final ITexture[][][] aTextures) { + public GT_MetaTileEntity_Hatch_Naquadah(final String aName, final String[] aDescription, + final ITexture[][][] aTextures) { super(aName, 6, aDescription[0], aTextures); mFluidCapacity = 32000; initHatch(); @@ -56,20 +58,17 @@ public class GT_MetaTileEntity_Hatch_Naquadah extends GT_MetaTileEntity_Hatch_In } public ITexture[] getTexturesActive(final ITexture aBaseTexture) { - return new ITexture[] { - aBaseTexture, - new GT_RenderedTexture((IIconContainer) Textures.BlockIcons.NAQUADAH_REACTOR_FLUID_SIDE_ACTIVE) - }; + return new ITexture[] { aBaseTexture, + new GT_RenderedTexture((IIconContainer) Textures.BlockIcons.NAQUADAH_REACTOR_FLUID_SIDE_ACTIVE) }; } public ITexture[] getTexturesInactive(final ITexture aBaseTexture) { - return new ITexture[] { - aBaseTexture, new GT_RenderedTexture((IIconContainer) Textures.BlockIcons.NAQUADAH_REACTOR_FLUID_SIDE) - }; + return new ITexture[] { aBaseTexture, + new GT_RenderedTexture((IIconContainer) Textures.BlockIcons.NAQUADAH_REACTOR_FLUID_SIDE) }; } - public boolean allowPutStack( - final IGregTechTileEntity aBaseMetaTileEntity, final int aIndex, final byte aSide, final ItemStack aStack) { + public boolean allowPutStack(final IGregTechTileEntity aBaseMetaTileEntity, final int aIndex, final byte aSide, + final ItemStack aStack) { if (aSide == aBaseMetaTileEntity.getFrontFacing() && aIndex == 0) { for (FluidStack f : mFluidsToUse) { if (f != null) { @@ -115,14 +114,9 @@ public class GT_MetaTileEntity_Hatch_Naquadah extends GT_MetaTileEntity_Hatch_In String aNaq = aDescCache[0]; String aEnrNaq = aDescCache[1]; String aNaquad = aDescCache[2]; - String[] s2 = new String[] { - "Fluid Input for Multiblocks", - "Capacity: " + getCapacity() + "L", - "Accepted Fluid: " + aNaq, - "Accepted Fluid: " + aEnrNaq, - "Accepted Fluid: " + aNaquad, - CORE.GT_Tooltip - }; + String[] s2 = new String[] { "Fluid Input for Multiblocks", "Capacity: " + getCapacity() + "L", + "Accepted Fluid: " + aNaq, "Accepted Fluid: " + aEnrNaq, "Accepted Fluid: " + aNaquad, + CORE.GT_Tooltip }; return s2; } @@ -130,8 +124,7 @@ public class GT_MetaTileEntity_Hatch_Naquadah extends GT_MetaTileEntity_Hatch_In private String formatFluidString(FluidStack f) { FluidStack mLockedStack = f; - Integer mLockedTemp = 0; - ; + Integer mLockedTemp = 0;; String mTempMod = "" + EnumChatFormatting.RESET; mLockedTemp = mLockedStack.getFluid().getTemperature(); if (mLockedTemp != null) { @@ -168,13 +161,8 @@ public class GT_MetaTileEntity_Hatch_Naquadah extends GT_MetaTileEntity_Hatch_In private Field F1, F2; @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) { byte a1 = 0, a2 = 0; try { if (F1 == null) { @@ -190,32 +178,26 @@ public class GT_MetaTileEntity_Hatch_Naquadah extends GT_MetaTileEntity_Hatch_In if (F2 != null) { a2 = F2.getByte(this); } - } catch (IllegalArgumentException | IllegalAccessException n) { - } + } catch (IllegalArgumentException | IllegalAccessException n) {} int textureIndex = a1 | a2 << 7; byte texturePointer = (byte) (a1 & 127); if (aSide == 1 || aSide == 0) { - ITexture g = textureIndex > 0 - ? StaticFields59.getCasingTexturePages(a2, texturePointer) + ITexture g = textureIndex > 0 ? StaticFields59.getCasingTexturePages(a2, texturePointer) : BlockIcons.MACHINE_CASINGS[this.mTier][aColorIndex + 1]; - return new ITexture[] { - g, new GT_RenderedTexture((IIconContainer) Textures.BlockIcons.NAQUADAH_REACTOR_FLUID_TOP_ACTIVE) - }; + return new ITexture[] { g, + new GT_RenderedTexture((IIconContainer) Textures.BlockIcons.NAQUADAH_REACTOR_FLUID_TOP_ACTIVE) }; } return aSide != aFacing - ? (textureIndex > 0 - ? new ITexture[] {StaticFields59.getCasingTexturePages(a2, texturePointer)} - : new ITexture[] {BlockIcons.MACHINE_CASINGS[this.mTier][aColorIndex + 1]}) + ? (textureIndex > 0 ? new ITexture[] { StaticFields59.getCasingTexturePages(a2, texturePointer) } + : new ITexture[] { BlockIcons.MACHINE_CASINGS[this.mTier][aColorIndex + 1] }) : (textureIndex > 0 - ? (aActive - ? this.getTexturesActive(StaticFields59.getCasingTexturePages(a2, texturePointer)) + ? (aActive ? this.getTexturesActive(StaticFields59.getCasingTexturePages(a2, texturePointer)) : this.getTexturesInactive(StaticFields59.getCasingTexturePages(a2, texturePointer))) - : (aActive - ? this.getTexturesActive(BlockIcons.MACHINE_CASINGS[this.mTier][aColorIndex + 1]) + : (aActive ? this.getTexturesActive(BlockIcons.MACHINE_CASINGS[this.mTier][aColorIndex + 1]) : this.getTexturesInactive(BlockIcons.MACHINE_CASINGS[this.mTier][aColorIndex + 1]))); } } diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_Hatch_OutputBattery.java b/src/main/java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_Hatch_OutputBattery.java index 101a310506..10b9af5cc9 100644 --- a/src/main/java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_Hatch_OutputBattery.java +++ b/src/main/java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_Hatch_OutputBattery.java @@ -2,8 +2,12 @@ package gtPlusPlus.xmod.gregtech.api.metatileentity.implementations; import static gregtech.api.enums.GT_Values.V; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.item.ItemStack; + import com.gtnewhorizons.modularui.api.screen.ModularWindow; import com.gtnewhorizons.modularui.api.screen.UIBuildContext; + import gregtech.api.gui.modularui.GT_UIInfos; import gregtech.api.interfaces.ITexture; import gregtech.api.interfaces.tileentity.IGregTechTileEntity; @@ -15,16 +19,15 @@ import gregtech.api.util.GT_Utility; import gtPlusPlus.core.lib.CORE; import gtPlusPlus.xmod.gregtech.api.gui.widget.ElectricSlotWidget; import gtPlusPlus.xmod.gregtech.common.blocks.textures.TexturesGtBlock; -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.item.ItemStack; public class GT_MetaTileEntity_Hatch_OutputBattery extends GT_MetaTileEntity_Hatch { + public GT_MetaTileEntity_Hatch_OutputBattery(int aID, String aName, String aNameRegional, int aTier) { super(aID, aName, aNameRegional, aTier, getSlots(aTier), "Dischargeable Item Bus for Multiblocks"); } - public GT_MetaTileEntity_Hatch_OutputBattery( - String aName, int aTier, String aDescription, ITexture[][][] aTextures) { + public GT_MetaTileEntity_Hatch_OutputBattery(String aName, int aTier, String aDescription, + ITexture[][][] aTextures) { super(aName, aTier, aTier < 1 ? 1 : aTier == 1 ? 4 : aTier == 2 ? 9 : 16, aDescription, aTextures); } @@ -38,7 +41,7 @@ public class GT_MetaTileEntity_Hatch_OutputBattery extends GT_MetaTileEntity_Hat } else { mSlots = 16; } - return new String[] {this.mDescription, "Capacity: " + mSlots + " slots", CORE.GT_Tooltip}; + return new String[] { this.mDescription, "Capacity: " + mSlots + " slots", CORE.GT_Tooltip }; } @Override @@ -68,12 +71,12 @@ public class GT_MetaTileEntity_Hatch_OutputBattery extends GT_MetaTileEntity_Hat @Override public ITexture[] getTexturesActive(ITexture aBaseTexture) { - return new ITexture[] {aBaseTexture, new GT_RenderedTexture(TexturesGtBlock.Overlay_Hatch_Discharger)}; + return new ITexture[] { aBaseTexture, new GT_RenderedTexture(TexturesGtBlock.Overlay_Hatch_Discharger) }; } @Override public ITexture[] getTexturesInactive(ITexture aBaseTexture) { - return new ITexture[] {aBaseTexture, new GT_RenderedTexture(TexturesGtBlock.Overlay_Hatch_Discharger)}; + return new ITexture[] { aBaseTexture, new GT_RenderedTexture(TexturesGtBlock.Overlay_Hatch_Discharger) }; } @Override @@ -125,19 +128,18 @@ public class GT_MetaTileEntity_Hatch_OutputBattery extends GT_MetaTileEntity_Hat protected void fillStacksIntoFirstSlots() { for (int i = 0; i < mInventory.length; i++) - for (int j = i + 1; j < mInventory.length; j++) - if (mInventory[j] != null - && (mInventory[i] == null || GT_Utility.areStacksEqual(mInventory[i], mInventory[j]))) { - GT_Utility.moveStackFromSlotAToSlotB( - getBaseMetaTileEntity(), - getBaseMetaTileEntity(), - j, - i, - (byte) 64, - (byte) 1, - (byte) 64, - (byte) 1); - } + for (int j = i + 1; j < mInventory.length; j++) if (mInventory[j] != null + && (mInventory[i] == null || GT_Utility.areStacksEqual(mInventory[i], mInventory[j]))) { + GT_Utility.moveStackFromSlotAToSlotB( + getBaseMetaTileEntity(), + getBaseMetaTileEntity(), + j, + i, + (byte) 64, + (byte) 1, + (byte) 64, + (byte) 1); + } } @Override @@ -172,9 +174,7 @@ public class GT_MetaTileEntity_Hatch_OutputBattery extends GT_MetaTileEntity_Hat if (mMetaTileEntity.dechargerSlotCount() > 0 && mMetaTileEntity.getEUVar() < aBaseMetaTileEntity.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 && mMetaTileEntity.getEUVar() < aBaseMetaTileEntity.getEUCapacity()) { aBaseMetaTileEntity.increaseStoredEnergyUnits( diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_Hatch_Plasma.java b/src/main/java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_Hatch_Plasma.java index 7f09abf177..f7d769a285 100644 --- a/src/main/java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_Hatch_Plasma.java +++ b/src/main/java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_Hatch_Plasma.java @@ -1,6 +1,15 @@ package gtPlusPlus.xmod.gregtech.api.metatileentity.implementations; +import java.lang.reflect.Field; + +import net.minecraft.item.ItemStack; +import net.minecraft.util.EnumChatFormatting; +import net.minecraftforge.fluids.Fluid; +import net.minecraftforge.fluids.FluidRegistry; +import net.minecraftforge.fluids.FluidStack; + import com.google.common.collect.BiMap; + import gregtech.api.enums.Textures.BlockIcons; import gregtech.api.interfaces.ITexture; import gregtech.api.interfaces.tileentity.IGregTechTileEntity; @@ -11,12 +20,6 @@ import gtPlusPlus.api.objects.data.AutoMap; import gtPlusPlus.core.lib.CORE; import gtPlusPlus.core.util.reflect.ReflectionUtils; import gtPlusPlus.xmod.gregtech.common.StaticFields59; -import java.lang.reflect.Field; -import net.minecraft.item.ItemStack; -import net.minecraft.util.EnumChatFormatting; -import net.minecraftforge.fluids.Fluid; -import net.minecraftforge.fluids.FluidRegistry; -import net.minecraftforge.fluids.FluidStack; public class GT_MetaTileEntity_Hatch_Plasma extends GT_MetaTileEntity_Hatch_Output { @@ -30,15 +33,15 @@ public class GT_MetaTileEntity_Hatch_Plasma extends GT_MetaTileEntity_Hatch_Outp initHatch(); } - public GT_MetaTileEntity_Hatch_Plasma( - final String aName, final String aDescription, final ITexture[][][] aTextures) { + public GT_MetaTileEntity_Hatch_Plasma(final String aName, final String aDescription, + final ITexture[][][] aTextures) { super(aName, 6, aDescription, aTextures); mFluidCapacity = 256000; initHatch(); } - public GT_MetaTileEntity_Hatch_Plasma( - final String aName, final String[] aDescription, final ITexture[][][] aTextures) { + public GT_MetaTileEntity_Hatch_Plasma(final String aName, final String[] aDescription, + final ITexture[][][] aTextures) { super(aName, 6, aDescription[0], aTextures); mFluidCapacity = 256000; initHatch(); @@ -67,11 +70,9 @@ public class GT_MetaTileEntity_Hatch_Plasma extends GT_MetaTileEntity_Hatch_Outp } } } - } catch (ClassCastException e) { - } + } catch (ClassCastException e) {} } - } catch (IllegalArgumentException | IllegalAccessException e) { - } + } catch (IllegalArgumentException | IllegalAccessException e) {} } AutoMap<Fluid> mPlasmaCache = new AutoMap<Fluid>(); @@ -94,15 +95,15 @@ public class GT_MetaTileEntity_Hatch_Plasma extends GT_MetaTileEntity_Hatch_Outp } public ITexture[] getTexturesActive(final ITexture aBaseTexture) { - return new ITexture[] {aBaseTexture}; + return new ITexture[] { aBaseTexture }; } public ITexture[] getTexturesInactive(final ITexture aBaseTexture) { - return new ITexture[] {aBaseTexture}; + return new ITexture[] { aBaseTexture }; } - public boolean allowPutStack( - final IGregTechTileEntity aBaseMetaTileEntity, final int aIndex, final byte aSide, final ItemStack aStack) { + public boolean allowPutStack(final IGregTechTileEntity aBaseMetaTileEntity, final int aIndex, final byte aSide, + final ItemStack aStack) { if (aSide == aBaseMetaTileEntity.getFrontFacing() && aIndex == 0) { for (Fluid f : mFluidsToUse) { if (f != null) { @@ -148,10 +149,14 @@ public class GT_MetaTileEntity_Hatch_Plasma extends GT_MetaTileEntity_Hatch_Outp String aX = EnumChatFormatting.GRAY + ""; String a1 = EnumChatFormatting.GOLD + "Refined containment" + aX; String a2 = EnumChatFormatting.GOLD + "Capacity: " + EnumChatFormatting.DARK_AQUA + getCapacity() + "L" + aX; - String a3 = EnumChatFormatting.GOLD + "Supports " + EnumChatFormatting.DARK_RED + mTotalPlasmaSupported - + EnumChatFormatting.GOLD + " types of plasma" + aX; - - String[] s2 = new String[] {a1, a2, a3, CORE.GT_Tooltip}; + String a3 = EnumChatFormatting.GOLD + "Supports " + + EnumChatFormatting.DARK_RED + + mTotalPlasmaSupported + + EnumChatFormatting.GOLD + + " types of plasma" + + aX; + + String[] s2 = new String[] { a1, a2, a3, CORE.GT_Tooltip }; return s2; } @@ -169,13 +174,8 @@ public class GT_MetaTileEntity_Hatch_Plasma extends GT_MetaTileEntity_Hatch_Outp private Field F1, F2; @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) { byte a1 = 0, a2 = 0; try { if (F1 == null) { @@ -191,30 +191,25 @@ public class GT_MetaTileEntity_Hatch_Plasma extends GT_MetaTileEntity_Hatch_Outp if (F2 != null) { a2 = F2.getByte(this); } - } catch (IllegalArgumentException | IllegalAccessException n) { - } + } catch (IllegalArgumentException | IllegalAccessException n) {} int textureIndex = a1 | a2 << 7; byte texturePointer = (byte) (a1 & 127); if (aSide == 1 || aSide == 0) { - ITexture g = textureIndex > 0 - ? StaticFields59.getCasingTexturePages(a2, texturePointer) + ITexture g = textureIndex > 0 ? StaticFields59.getCasingTexturePages(a2, texturePointer) : BlockIcons.MACHINE_CASINGS[this.mTier][aColorIndex + 1]; - return new ITexture[] {g}; + return new ITexture[] { g }; } return aSide != aFacing - ? (textureIndex > 0 - ? new ITexture[] {StaticFields59.getCasingTexturePages(a2, texturePointer)} - : new ITexture[] {BlockIcons.MACHINE_CASINGS[this.mTier][aColorIndex + 1]}) + ? (textureIndex > 0 ? new ITexture[] { StaticFields59.getCasingTexturePages(a2, texturePointer) } + : new ITexture[] { BlockIcons.MACHINE_CASINGS[this.mTier][aColorIndex + 1] }) : (textureIndex > 0 - ? (aActive - ? this.getTexturesActive(StaticFields59.getCasingTexturePages(a2, texturePointer)) + ? (aActive ? this.getTexturesActive(StaticFields59.getCasingTexturePages(a2, texturePointer)) : this.getTexturesInactive(StaticFields59.getCasingTexturePages(a2, texturePointer))) - : (aActive - ? this.getTexturesActive(BlockIcons.MACHINE_CASINGS[this.mTier][aColorIndex + 1]) + : (aActive ? this.getTexturesActive(BlockIcons.MACHINE_CASINGS[this.mTier][aColorIndex + 1]) : this.getTexturesInactive(BlockIcons.MACHINE_CASINGS[this.mTier][aColorIndex + 1]))); } } diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_Hatch_Reservoir.java b/src/main/java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_Hatch_Reservoir.java index 0a2ccdb8e5..67827bcbf5 100644 --- a/src/main/java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_Hatch_Reservoir.java +++ b/src/main/java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_Hatch_Reservoir.java @@ -1,12 +1,5 @@ package gtPlusPlus.xmod.gregtech.api.metatileentity.implementations; -import cpw.mods.fml.common.registry.GameRegistry; -import gregtech.api.interfaces.ITexture; -import gregtech.api.interfaces.tileentity.IGregTechTileEntity; -import gregtech.api.metatileentity.MetaTileEntity; -import gregtech.api.objects.GT_RenderedTexture; -import gtPlusPlus.core.lib.LoadedMods; -import gtPlusPlus.xmod.gregtech.common.blocks.textures.TexturesGtBlock; import net.minecraft.block.Block; import net.minecraft.init.Blocks; import net.minecraft.tileentity.TileEntity; @@ -16,18 +9,26 @@ import net.minecraftforge.fluids.Fluid; import net.minecraftforge.fluids.FluidRegistry; import net.minecraftforge.fluids.IFluidHandler; +import cpw.mods.fml.common.registry.GameRegistry; +import gregtech.api.interfaces.ITexture; +import gregtech.api.interfaces.tileentity.IGregTechTileEntity; +import gregtech.api.metatileentity.MetaTileEntity; +import gregtech.api.objects.GT_RenderedTexture; +import gtPlusPlus.core.lib.LoadedMods; +import gtPlusPlus.xmod.gregtech.common.blocks.textures.TexturesGtBlock; + public class GT_MetaTileEntity_Hatch_Reservoir extends GT_MetaTileEntity_Hatch_FluidGenerator { private static Block sBlock_EIO; private static Block sBlock_RIO; - public GT_MetaTileEntity_Hatch_Reservoir( - final int aID, final String aName, final String aNameRegional, final int aTier) { + public GT_MetaTileEntity_Hatch_Reservoir(final int aID, final String aName, final String aNameRegional, + final int aTier) { super(aID, aName, aNameRegional, aTier); } - public GT_MetaTileEntity_Hatch_Reservoir( - final String aName, final int aTier, final String aDescription, final ITexture[][][] aTextures) { + public GT_MetaTileEntity_Hatch_Reservoir(final String aName, final int aTier, final String aDescription, + final ITexture[][][] aTextures) { super(aName, aTier, aDescription, aTextures); } @@ -85,8 +86,7 @@ public class GT_MetaTileEntity_Hatch_Reservoir extends GT_MetaTileEntity_Hatch_F @Override public boolean doesHatchMeetConditionsToGenerate() { - Block aWater = this.getBaseMetaTileEntity() - .getBlockAtSide(this.getBaseMetaTileEntity().getFrontFacing()); + Block aWater = this.getBaseMetaTileEntity().getBlockAtSide(this.getBaseMetaTileEntity().getFrontFacing()); if (aWater != null && aWater != Blocks.air) { if (!this.canTankBeFilled()) { return false; @@ -94,18 +94,18 @@ public class GT_MetaTileEntity_Hatch_Reservoir extends GT_MetaTileEntity_Hatch_F setCrossModData(); if (LoadedMods.EnderIO) { if (aWater == sBlock_EIO) { - return isTileValid(this.getBaseMetaTileEntity() - .getTileEntityAtSide(this.getBaseMetaTileEntity().getFrontFacing())); + return isTileValid( + this.getBaseMetaTileEntity() + .getTileEntityAtSide(this.getBaseMetaTileEntity().getFrontFacing())); } } if (LoadedMods.RemoteIO) { if (aWater == sBlock_RIO - && this.getBaseMetaTileEntity() - .getMetaIDAtSide( - this.getBaseMetaTileEntity().getFrontFacing()) + && this.getBaseMetaTileEntity().getMetaIDAtSide(this.getBaseMetaTileEntity().getFrontFacing()) == 0) { - return isTileValid(this.getBaseMetaTileEntity() - .getTileEntityAtSide(this.getBaseMetaTileEntity().getFrontFacing())); + return isTileValid( + this.getBaseMetaTileEntity() + .getTileEntityAtSide(this.getBaseMetaTileEntity().getFrontFacing())); } } return aWater == Blocks.water || aWater == Blocks.flowing_water; @@ -117,10 +117,10 @@ public class GT_MetaTileEntity_Hatch_Reservoir extends GT_MetaTileEntity_Hatch_F public void generateParticles(World aWorld, String name) {} public ITexture[] getTexturesActive(final ITexture aBaseTexture) { - return new ITexture[] {aBaseTexture, new GT_RenderedTexture(TexturesGtBlock.Overlay_Water)}; + return new ITexture[] { aBaseTexture, new GT_RenderedTexture(TexturesGtBlock.Overlay_Water) }; } public ITexture[] getTexturesInactive(final ITexture aBaseTexture) { - return new ITexture[] {aBaseTexture, new GT_RenderedTexture(TexturesGtBlock.Overlay_Water)}; + return new ITexture[] { aBaseTexture, new GT_RenderedTexture(TexturesGtBlock.Overlay_Water) }; } } diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_Hatch_Steam_BusInput.java b/src/main/java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_Hatch_Steam_BusInput.java index 4be947d68e..eecef35269 100644 --- a/src/main/java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_Hatch_Steam_BusInput.java +++ b/src/main/java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_Hatch_Steam_BusInput.java @@ -3,8 +3,13 @@ package gtPlusPlus.xmod.gregtech.api.metatileentity.implementations; import static gregtech.api.enums.Textures.BlockIcons.ITEM_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 com.gtnewhorizons.modularui.api.screen.ModularWindow; import com.gtnewhorizons.modularui.api.screen.UIBuildContext; + import gregtech.GT_Mod; import gregtech.api.enums.Textures; import gregtech.api.gui.modularui.GT_UIInfos; @@ -18,46 +23,46 @@ import gregtech.api.util.GT_LanguageManager; import gregtech.api.util.GT_Recipe.GT_Recipe_Map; import gregtech.api.util.GT_Utility; import gtPlusPlus.core.lib.CORE; -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.item.ItemStack; -import net.minecraft.nbt.NBTTagCompound; public class GT_MetaTileEntity_Hatch_Steam_BusInput extends GT_MetaTileEntity_Hatch { + public GT_Recipe_Map mRecipeMap = null; public boolean disableSort; public GT_MetaTileEntity_Hatch_Steam_BusInput(int aID, String aName, String aNameRegional, int aTier) { - super(aID, aName, aNameRegional, aTier, getSlots(aTier), new String[] { - "Item Input for Steam Multiblocks", - "Shift + right click with screwdriver to toggle automatic item shuffling", - "Capacity: 4 stacks", - "Does not work with non-steam multiblocks", - CORE.GT_Tooltip - }); - } - - public GT_MetaTileEntity_Hatch_Steam_BusInput( - String aName, int aTier, String aDescription, ITexture[][][] aTextures) { + super( + aID, + aName, + aNameRegional, + aTier, + getSlots(aTier), + new String[] { "Item Input for Steam Multiblocks", + "Shift + right click with screwdriver to toggle automatic item shuffling", "Capacity: 4 stacks", + "Does not work with non-steam multiblocks", CORE.GT_Tooltip }); + } + + public GT_MetaTileEntity_Hatch_Steam_BusInput(String aName, int aTier, String aDescription, + ITexture[][][] aTextures) { super(aName, aTier, 4, aDescription, aTextures); } - public GT_MetaTileEntity_Hatch_Steam_BusInput( - String aName, int aTier, String[] aDescription, ITexture[][][] aTextures) { + public GT_MetaTileEntity_Hatch_Steam_BusInput(String aName, int aTier, String[] aDescription, + ITexture[][][] aTextures) { super(aName, aTier, 4, 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 @@ -110,18 +115,17 @@ public class GT_MetaTileEntity_Hatch_Steam_BusInput extends GT_MetaTileEntity_Ha if (mInventory[i] != null && mInventory[i].stackSize <= 0) mInventory[i] = null; } else { for (int i = 0; i < mInventory.length; i++) - for (int j = i + 1; j < mInventory.length; j++) - if (mInventory[j] != null - && (mInventory[i] == null || GT_Utility.areStacksEqual(mInventory[i], mInventory[j]))) - GT_Utility.moveStackFromSlotAToSlotB( - getBaseMetaTileEntity(), - getBaseMetaTileEntity(), - j, - i, - (byte) 64, - (byte) 1, - (byte) 64, - (byte) 1); + for (int j = i + 1; j < mInventory.length; j++) if (mInventory[j] != null + && (mInventory[i] == null || GT_Utility.areStacksEqual(mInventory[i], mInventory[j]))) + GT_Utility.moveStackFromSlotAToSlotB( + getBaseMetaTileEntity(), + getBaseMetaTileEntity(), + j, + i, + (byte) 64, + (byte) 1, + (byte) 64, + (byte) 1); } } @@ -186,127 +190,85 @@ public class GT_MetaTileEntity_Hatch_Steam_BusInput extends GT_MetaTileEntity_Ha } public ITexture[] getSideFacingActive(byte aColor) { - return new ITexture[] { - new GT_RenderedTexture( - mTier == 1 - ? Textures.BlockIcons.MACHINE_BRONZEBRICKS_SIDE - : Textures.BlockIcons.MACHINE_BRONZE_SIDE) - }; + return new ITexture[] { new GT_RenderedTexture( + mTier == 1 ? Textures.BlockIcons.MACHINE_BRONZEBRICKS_SIDE : Textures.BlockIcons.MACHINE_BRONZE_SIDE) }; } public ITexture[] getSideFacingInactive(byte aColor) { - return new ITexture[] { - new GT_RenderedTexture( - mTier == 1 - ? Textures.BlockIcons.MACHINE_BRONZEBRICKS_SIDE - : Textures.BlockIcons.MACHINE_BRONZE_SIDE) - }; + return new ITexture[] { new GT_RenderedTexture( + mTier == 1 ? Textures.BlockIcons.MACHINE_BRONZEBRICKS_SIDE : Textures.BlockIcons.MACHINE_BRONZE_SIDE) }; } public ITexture[] getFrontFacingActive(byte aColor) { - return new ITexture[] { - new GT_RenderedTexture( - mTier == 1 - ? Textures.BlockIcons.MACHINE_BRONZEBRICKS_SIDE - : Textures.BlockIcons.MACHINE_BRONZE_SIDE) - }; + return new ITexture[] { new GT_RenderedTexture( + mTier == 1 ? Textures.BlockIcons.MACHINE_BRONZEBRICKS_SIDE : Textures.BlockIcons.MACHINE_BRONZE_SIDE) }; } public ITexture[] getFrontFacingInactive(byte aColor) { - return new ITexture[] { - new GT_RenderedTexture( - mTier == 1 - ? Textures.BlockIcons.MACHINE_BRONZEBRICKS_SIDE - : Textures.BlockIcons.MACHINE_BRONZE_SIDE) - }; + return new ITexture[] { new GT_RenderedTexture( + mTier == 1 ? Textures.BlockIcons.MACHINE_BRONZEBRICKS_SIDE : Textures.BlockIcons.MACHINE_BRONZE_SIDE) }; } public ITexture[] getTopFacingActive(byte aColor) { - return new ITexture[] { - new GT_RenderedTexture( - mTier == 1 ? Textures.BlockIcons.MACHINE_BRONZEBRICKS_TOP : Textures.BlockIcons.MACHINE_BRONZE_TOP) - }; + return new ITexture[] { new GT_RenderedTexture( + mTier == 1 ? Textures.BlockIcons.MACHINE_BRONZEBRICKS_TOP : Textures.BlockIcons.MACHINE_BRONZE_TOP) }; } public ITexture[] getTopFacingInactive(byte aColor) { - return new ITexture[] { - new GT_RenderedTexture( - mTier == 1 ? Textures.BlockIcons.MACHINE_BRONZEBRICKS_TOP : Textures.BlockIcons.MACHINE_BRONZE_TOP) - }; + return new ITexture[] { new GT_RenderedTexture( + mTier == 1 ? Textures.BlockIcons.MACHINE_BRONZEBRICKS_TOP : Textures.BlockIcons.MACHINE_BRONZE_TOP) }; } public ITexture[] getBottomFacingActive(byte aColor) { - return new ITexture[] { - new GT_RenderedTexture( - mTier == 1 - ? Textures.BlockIcons.MACHINE_BRONZEBRICKS_BOTTOM - : Textures.BlockIcons.MACHINE_BRONZE_BOTTOM) - }; + return new ITexture[] { new GT_RenderedTexture( + mTier == 1 ? Textures.BlockIcons.MACHINE_BRONZEBRICKS_BOTTOM + : Textures.BlockIcons.MACHINE_BRONZE_BOTTOM) }; } public ITexture[] getBottomFacingInactive(byte aColor) { - return new ITexture[] { - new GT_RenderedTexture( - mTier == 1 - ? Textures.BlockIcons.MACHINE_BRONZEBRICKS_BOTTOM - : Textures.BlockIcons.MACHINE_BRONZE_BOTTOM) - }; + return new ITexture[] { new GT_RenderedTexture( + mTier == 1 ? Textures.BlockIcons.MACHINE_BRONZEBRICKS_BOTTOM + : Textures.BlockIcons.MACHINE_BRONZE_BOTTOM) }; } public ITexture[] getBottomFacingPipeActive(byte aColor) { return new ITexture[] { - new GT_RenderedTexture( - mTier == 1 - ? Textures.BlockIcons.MACHINE_BRONZEBRICKS_BOTTOM - : Textures.BlockIcons.MACHINE_BRONZE_BOTTOM), - new GT_RenderedTexture(Textures.BlockIcons.OVERLAY_PIPE_OUT) - }; + new GT_RenderedTexture( + mTier == 1 ? Textures.BlockIcons.MACHINE_BRONZEBRICKS_BOTTOM + : Textures.BlockIcons.MACHINE_BRONZE_BOTTOM), + new GT_RenderedTexture(Textures.BlockIcons.OVERLAY_PIPE_OUT) }; } public ITexture[] getBottomFacingPipeInactive(byte aColor) { return new ITexture[] { - new GT_RenderedTexture( - mTier == 1 - ? Textures.BlockIcons.MACHINE_BRONZEBRICKS_BOTTOM - : Textures.BlockIcons.MACHINE_BRONZE_BOTTOM), - new GT_RenderedTexture(Textures.BlockIcons.OVERLAY_PIPE_OUT) - }; + new GT_RenderedTexture( + mTier == 1 ? Textures.BlockIcons.MACHINE_BRONZEBRICKS_BOTTOM + : Textures.BlockIcons.MACHINE_BRONZE_BOTTOM), + new GT_RenderedTexture(Textures.BlockIcons.OVERLAY_PIPE_OUT) }; } public ITexture[] getTopFacingPipeActive(byte aColor) { - return new ITexture[] { - new GT_RenderedTexture( - mTier == 1 ? Textures.BlockIcons.MACHINE_BRONZEBRICKS_TOP : Textures.BlockIcons.MACHINE_BRONZE_TOP), - new GT_RenderedTexture(Textures.BlockIcons.OVERLAY_PIPE_OUT) - }; + return new ITexture[] { new GT_RenderedTexture( + mTier == 1 ? Textures.BlockIcons.MACHINE_BRONZEBRICKS_TOP : Textures.BlockIcons.MACHINE_BRONZE_TOP), + new GT_RenderedTexture(Textures.BlockIcons.OVERLAY_PIPE_OUT) }; } public ITexture[] getTopFacingPipeInactive(byte aColor) { - return new ITexture[] { - new GT_RenderedTexture( - mTier == 1 ? Textures.BlockIcons.MACHINE_BRONZEBRICKS_TOP : Textures.BlockIcons.MACHINE_BRONZE_TOP), - new GT_RenderedTexture(Textures.BlockIcons.OVERLAY_PIPE_OUT) - }; + return new ITexture[] { new GT_RenderedTexture( + mTier == 1 ? Textures.BlockIcons.MACHINE_BRONZEBRICKS_TOP : Textures.BlockIcons.MACHINE_BRONZE_TOP), + new GT_RenderedTexture(Textures.BlockIcons.OVERLAY_PIPE_OUT) }; } public ITexture[] getSideFacingPipeActive(byte aColor) { - return new ITexture[] { - new GT_RenderedTexture( - mTier == 1 - ? Textures.BlockIcons.MACHINE_BRONZEBRICKS_SIDE - : Textures.BlockIcons.MACHINE_BRONZE_SIDE), - new GT_RenderedTexture(Textures.BlockIcons.OVERLAY_PIPE_OUT) - }; + return new ITexture[] { new GT_RenderedTexture( + mTier == 1 ? Textures.BlockIcons.MACHINE_BRONZEBRICKS_SIDE : Textures.BlockIcons.MACHINE_BRONZE_SIDE), + new GT_RenderedTexture(Textures.BlockIcons.OVERLAY_PIPE_OUT) }; } public ITexture[] getSideFacingPipeInactive(byte aColor) { - return new ITexture[] { - new GT_RenderedTexture( - mTier == 1 - ? Textures.BlockIcons.MACHINE_BRONZEBRICKS_SIDE - : Textures.BlockIcons.MACHINE_BRONZE_SIDE), - new GT_RenderedTexture(Textures.BlockIcons.OVERLAY_PIPE_OUT) - }; + return new ITexture[] { new GT_RenderedTexture( + mTier == 1 ? Textures.BlockIcons.MACHINE_BRONZEBRICKS_SIDE : Textures.BlockIcons.MACHINE_BRONZE_SIDE), + new GT_RenderedTexture(Textures.BlockIcons.OVERLAY_PIPE_OUT) }; } @Override diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_Hatch_Steam_BusOutput.java b/src/main/java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_Hatch_Steam_BusOutput.java index a6bfd65636..48e27f0729 100644 --- a/src/main/java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_Hatch_Steam_BusOutput.java +++ b/src/main/java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_Hatch_Steam_BusOutput.java @@ -3,8 +3,12 @@ package gtPlusPlus.xmod.gregtech.api.metatileentity.implementations; import static gregtech.api.enums.Textures.BlockIcons.ITEM_OUT_SIGN; import static gregtech.api.enums.Textures.BlockIcons.OVERLAY_PIPE_OUT; +import net.minecraft.entity.player.EntityPlayer; +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.enums.Textures; import gregtech.api.gui.modularui.GT_UIInfos; @@ -15,41 +19,42 @@ import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch; import gregtech.api.objects.GT_RenderedTexture; import gregtech.api.render.TextureFactory; import gtPlusPlus.core.lib.CORE; -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.item.ItemStack; public class GT_MetaTileEntity_Hatch_Steam_BusOutput extends GT_MetaTileEntity_Hatch { - public GT_MetaTileEntity_Hatch_Steam_BusOutput(int aID, String aName, String aNameRegional, int aTier) { - super(aID, aName, aNameRegional, aTier, 4, new String[] { - "Item Output for Steam Multiblocks", - "Capacity: 4 stacks", - "Does not work with non-steam multiblocks", - CORE.GT_Tooltip - }); - } - public GT_MetaTileEntity_Hatch_Steam_BusOutput( - String aName, int aTier, String aDescription, ITexture[][][] aTextures) { + public GT_MetaTileEntity_Hatch_Steam_BusOutput(int aID, String aName, String aNameRegional, int aTier) { + super( + aID, + aName, + aNameRegional, + aTier, + 4, + new String[] { "Item Output for Steam Multiblocks", "Capacity: 4 stacks", + "Does not work with non-steam multiblocks", CORE.GT_Tooltip }); + } + + public GT_MetaTileEntity_Hatch_Steam_BusOutput(String aName, int aTier, String aDescription, + ITexture[][][] aTextures) { super(aName, aTier, 4, aDescription, aTextures); } - public GT_MetaTileEntity_Hatch_Steam_BusOutput( - String aName, int aTier, String[] aDescription, ITexture[][][] aTextures) { + public GT_MetaTileEntity_Hatch_Steam_BusOutput(String aName, int aTier, String[] aDescription, + ITexture[][][] aTextures) { super(aName, aTier, 4, aDescription, aTextures); } @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 @@ -116,127 +121,85 @@ public class GT_MetaTileEntity_Hatch_Steam_BusOutput extends GT_MetaTileEntity_H } public ITexture[] getSideFacingActive(byte aColor) { - return new ITexture[] { - new GT_RenderedTexture( - mTier == 1 - ? Textures.BlockIcons.MACHINE_BRONZEBRICKS_SIDE - : Textures.BlockIcons.MACHINE_BRONZE_SIDE) - }; + return new ITexture[] { new GT_RenderedTexture( + mTier == 1 ? Textures.BlockIcons.MACHINE_BRONZEBRICKS_SIDE : Textures.BlockIcons.MACHINE_BRONZE_SIDE) }; } public ITexture[] getSideFacingInactive(byte aColor) { - return new ITexture[] { - new GT_RenderedTexture( - mTier == 1 - ? Textures.BlockIcons.MACHINE_BRONZEBRICKS_SIDE - : Textures.BlockIcons.MACHINE_BRONZE_SIDE) - }; + return new ITexture[] { new GT_RenderedTexture( + mTier == 1 ? Textures.BlockIcons.MACHINE_BRONZEBRICKS_SIDE : Textures.BlockIcons.MACHINE_BRONZE_SIDE) }; } public ITexture[] getFrontFacingActive(byte aColor) { - return new ITexture[] { - new GT_RenderedTexture( - mTier == 1 - ? Textures.BlockIcons.MACHINE_BRONZEBRICKS_SIDE - : Textures.BlockIcons.MACHINE_BRONZE_SIDE) - }; + return new ITexture[] { new GT_RenderedTexture( + mTier == 1 ? Textures.BlockIcons.MACHINE_BRONZEBRICKS_SIDE : Textures.BlockIcons.MACHINE_BRONZE_SIDE) }; } public ITexture[] getFrontFacingInactive(byte aColor) { - return new ITexture[] { - new GT_RenderedTexture( - mTier == 1 - ? Textures.BlockIcons.MACHINE_BRONZEBRICKS_SIDE - : Textures.BlockIcons.MACHINE_BRONZE_SIDE) - }; + return new ITexture[] { new GT_RenderedTexture( + mTier == 1 ? Textures.BlockIcons.MACHINE_BRONZEBRICKS_SIDE : Textures.BlockIcons.MACHINE_BRONZE_SIDE) }; } public ITexture[] getTopFacingActive(byte aColor) { - return new ITexture[] { - new GT_RenderedTexture( - mTier == 1 ? Textures.BlockIcons.MACHINE_BRONZEBRICKS_TOP : Textures.BlockIcons.MACHINE_BRONZE_TOP) - }; + return new ITexture[] { new GT_RenderedTexture( + mTier == 1 ? Textures.BlockIcons.MACHINE_BRONZEBRICKS_TOP : Textures.BlockIcons.MACHINE_BRONZE_TOP) }; } public ITexture[] getTopFacingInactive(byte aColor) { - return new ITexture[] { - new GT_RenderedTexture( - mTier == 1 ? Textures.BlockIcons.MACHINE_BRONZEBRICKS_TOP : Textures.BlockIcons.MACHINE_BRONZE_TOP) - }; + return new ITexture[] { new GT_RenderedTexture( + mTier == 1 ? Textures.BlockIcons.MACHINE_BRONZEBRICKS_TOP : Textures.BlockIcons.MACHINE_BRONZE_TOP) }; } public ITexture[] getBottomFacingActive(byte aColor) { - return new ITexture[] { - new GT_RenderedTexture( - mTier == 1 - ? Textures.BlockIcons.MACHINE_BRONZEBRICKS_BOTTOM - : Textures.BlockIcons.MACHINE_BRONZE_BOTTOM) - }; + return new ITexture[] { new GT_RenderedTexture( + mTier == 1 ? Textures.BlockIcons.MACHINE_BRONZEBRICKS_BOTTOM + : Textures.BlockIcons.MACHINE_BRONZE_BOTTOM) }; } public ITexture[] getBottomFacingInactive(byte aColor) { - return new ITexture[] { - new GT_RenderedTexture( - mTier == 1 - ? Textures.BlockIcons.MACHINE_BRONZEBRICKS_BOTTOM - : Textures.BlockIcons.MACHINE_BRONZE_BOTTOM) - }; + return new ITexture[] { new GT_RenderedTexture( + mTier == 1 ? Textures.BlockIcons.MACHINE_BRONZEBRICKS_BOTTOM + : Textures.BlockIcons.MACHINE_BRONZE_BOTTOM) }; } public ITexture[] getBottomFacingPipeActive(byte aColor) { return new ITexture[] { - new GT_RenderedTexture( - mTier == 1 - ? Textures.BlockIcons.MACHINE_BRONZEBRICKS_BOTTOM - : Textures.BlockIcons.MACHINE_BRONZE_BOTTOM), - new GT_RenderedTexture(Textures.BlockIcons.OVERLAY_PIPE_OUT) - }; + new GT_RenderedTexture( + mTier == 1 ? Textures.BlockIcons.MACHINE_BRONZEBRICKS_BOTTOM + : Textures.BlockIcons.MACHINE_BRONZE_BOTTOM), + new GT_RenderedTexture(Textures.BlockIcons.OVERLAY_PIPE_OUT) }; } public ITexture[] getBottomFacingPipeInactive(byte aColor) { return new ITexture[] { - new GT_RenderedTexture( - mTier == 1 - ? Textures.BlockIcons.MACHINE_BRONZEBRICKS_BOTTOM - : Textures.BlockIcons.MACHINE_BRONZE_BOTTOM), - new GT_RenderedTexture(Textures.BlockIcons.OVERLAY_PIPE_OUT) - }; + new GT_RenderedTexture( + mTier == 1 ? Textures.BlockIcons.MACHINE_BRONZEBRICKS_BOTTOM + : Textures.BlockIcons.MACHINE_BRONZE_BOTTOM), + new GT_RenderedTexture(Textures.BlockIcons.OVERLAY_PIPE_OUT) }; } public ITexture[] getTopFacingPipeActive(byte aColor) { - return new ITexture[] { - new GT_RenderedTexture( - mTier == 1 ? Textures.BlockIcons.MACHINE_BRONZEBRICKS_TOP : Textures.BlockIcons.MACHINE_BRONZE_TOP), - new GT_RenderedTexture(Textures.BlockIcons.OVERLAY_PIPE_OUT) - }; + return new ITexture[] { new GT_RenderedTexture( + mTier == 1 ? Textures.BlockIcons.MACHINE_BRONZEBRICKS_TOP : Textures.BlockIcons.MACHINE_BRONZE_TOP), + new GT_RenderedTexture(Textures.BlockIcons.OVERLAY_PIPE_OUT) }; } public ITexture[] getTopFacingPipeInactive(byte aColor) { - return new ITexture[] { - new GT_RenderedTexture( - mTier == 1 ? Textures.BlockIcons.MACHINE_BRONZEBRICKS_TOP : Textures.BlockIcons.MACHINE_BRONZE_TOP), - new GT_RenderedTexture(Textures.BlockIcons.OVERLAY_PIPE_OUT) - }; + return new ITexture[] { new GT_RenderedTexture( + mTier == 1 ? Textures.BlockIcons.MACHINE_BRONZEBRICKS_TOP : Textures.BlockIcons.MACHINE_BRONZE_TOP), + new GT_RenderedTexture(Textures.BlockIcons.OVERLAY_PIPE_OUT) }; } public ITexture[] getSideFacingPipeActive(byte aColor) { - return new ITexture[] { - new GT_RenderedTexture( - mTier == 1 - ? Textures.BlockIcons.MACHINE_BRONZEBRICKS_SIDE - : Textures.BlockIcons.MACHINE_BRONZE_SIDE), - new GT_RenderedTexture(Textures.BlockIcons.OVERLAY_PIPE_OUT) - }; + return new ITexture[] { new GT_RenderedTexture( + mTier == 1 ? Textures.BlockIcons.MACHINE_BRONZEBRICKS_SIDE : Textures.BlockIcons.MACHINE_BRONZE_SIDE), + new GT_RenderedTexture(Textures.BlockIcons.OVERLAY_PIPE_OUT) }; } public ITexture[] getSideFacingPipeInactive(byte aColor) { - return new ITexture[] { - new GT_RenderedTexture( - mTier == 1 - ? Textures.BlockIcons.MACHINE_BRONZEBRICKS_SIDE - : Textures.BlockIcons.MACHINE_BRONZE_SIDE), - new GT_RenderedTexture(Textures.BlockIcons.OVERLAY_PIPE_OUT) - }; + return new ITexture[] { new GT_RenderedTexture( + mTier == 1 ? Textures.BlockIcons.MACHINE_BRONZEBRICKS_SIDE : Textures.BlockIcons.MACHINE_BRONZE_SIDE), + new GT_RenderedTexture(Textures.BlockIcons.OVERLAY_PIPE_OUT) }; } @Override diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_Hatch_Turbine.java b/src/main/java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_Hatch_Turbine.java index 2c04c75fe3..00f7c97a01 100644 --- a/src/main/java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_Hatch_Turbine.java +++ b/src/main/java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_Hatch_Turbine.java @@ -3,9 +3,14 @@ package gtPlusPlus.xmod.gregtech.api.metatileentity.implementations; import static gregtech.api.enums.Textures.BlockIcons.LARGETURBINE_ST5; import static gregtech.api.enums.Textures.BlockIcons.LARGETURBINE_ST_ACTIVE5; +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 com.gtnewhorizons.modularui.common.widget.SlotWidget; + import gregtech.api.GregTech_API; import gregtech.api.enums.Materials; import gregtech.api.gui.modularui.GT_UIInfos; @@ -26,9 +31,6 @@ import gtPlusPlus.core.util.math.MathUtils; import gtPlusPlus.core.util.minecraft.PlayerUtils; import gtPlusPlus.xmod.gregtech.common.StaticFields59; import gtPlusPlus.xmod.gregtech.common.tileentities.machines.multi.production.turbines.GregtechMetaTileEntity_LargerTurbineBase; -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.item.ItemStack; -import net.minecraft.nbt.NBTTagCompound; @SuppressWarnings("deprecation") public class GT_MetaTileEntity_Hatch_Turbine extends GT_MetaTileEntity_Hatch { @@ -52,25 +54,21 @@ public class GT_MetaTileEntity_Hatch_Turbine extends GT_MetaTileEntity_Hatch { @Override public String[] getDescription() { - return new String[] { - this.mDescription, - "Right Click with a soldering iron to reset controller link", - "Right Click with a wrench to remove turbine", - "Right Click with a screwdriver for technical information", - "Sneak + Right Click with a wrench to rotate", - "Sneak + Right Click with a screwdriver to disable animations", - CORE.GT_Tooltip - }; + return new String[] { this.mDescription, "Right Click with a soldering iron to reset controller link", + "Right Click with a wrench to remove turbine", + "Right Click with a screwdriver for technical information", + "Sneak + Right Click with a wrench to rotate", + "Sneak + Right Click with a screwdriver to disable animations", CORE.GT_Tooltip }; } @Override public ITexture[] getTexturesActive(ITexture aBaseTexture) { - return new ITexture[] {aBaseTexture, getFrontFacingTurbineTexture()}; + return new ITexture[] { aBaseTexture, getFrontFacingTurbineTexture() }; } @Override public ITexture[] getTexturesInactive(ITexture aBaseTexture) { - return new ITexture[] {aBaseTexture, getFrontFacingTurbineTexture()}; + return new ITexture[] { aBaseTexture, getFrontFacingTurbineTexture() }; } public int getEU() { @@ -159,12 +157,10 @@ public class GT_MetaTileEntity_Hatch_Turbine extends GT_MetaTileEntity_Hatch { public void damageTurbine(long aEUt, int damageFactorLow, float damageFactorHigh) { if (hasTurbine() && MathUtils.randInt(0, 1) == 0) { ItemStack aTurbine = getTurbine(); - ((GT_MetaGenerated_Tool) aTurbine.getItem()) - .doDamage( - aTurbine, - (long) getDamageToComponent(aTurbine) - * (long) Math.min( - (float) aEUt / (float) damageFactorLow, Math.pow(aEUt, damageFactorHigh))); + ((GT_MetaGenerated_Tool) aTurbine.getItem()).doDamage( + aTurbine, + (long) getDamageToComponent(aTurbine) * (long) Math + .min((float) aEUt / (float) damageFactorLow, Math.pow(aEUt, damageFactorHigh))); } } @@ -223,8 +219,8 @@ public class GT_MetaTileEntity_Hatch_Turbine extends GT_MetaTileEntity_Hatch { BlockPos p = BlockPos.generateBlockPos(mControllerLocation); if (p != null) { // Logger.INFO(p.getLocationString()); - IGregTechTileEntity tTileEntity = - getBaseMetaTileEntity().getIGregTechTileEntity(p.xPos, p.yPos, p.zPos); + IGregTechTileEntity tTileEntity = getBaseMetaTileEntity() + .getIGregTechTileEntity(p.xPos, p.yPos, p.zPos); if (tTileEntity != null && tTileEntity.getMetaTileEntity() instanceof GregtechMetaTileEntity_LargerTurbineBase) { return (GregtechMetaTileEntity_LargerTurbineBase) tTileEntity.getMetaTileEntity(); @@ -269,8 +265,7 @@ public class GT_MetaTileEntity_Hatch_Turbine extends GT_MetaTileEntity_Hatch { private ITexture getFrontFacingTurbineTexture() { if (!mHasController) { - return this.getBaseMetaTileEntity().isActive() - ? new GT_RenderedTexture(LARGETURBINE_ST_ACTIVE5) + return this.getBaseMetaTileEntity().isActive() ? new GT_RenderedTexture(LARGETURBINE_ST_ACTIVE5) : new GT_RenderedTexture(LARGETURBINE_ST5); } else { if (usingAnimations()) { @@ -319,17 +314,15 @@ public class GT_MetaTileEntity_Hatch_Turbine extends GT_MetaTileEntity_Hatch { if (mHasController) { PlayerUtils.messagePlayer( aPlayer, - "Controller Location: " - + BlockPos.generateBlockPos(mControllerLocation).getLocationString()); + "Controller Location: " + BlockPos.generateBlockPos(mControllerLocation).getLocationString()); PlayerUtils.messagePlayer(aPlayer, "Controller Active? " + this.isControllerActive()); } - PlayerUtils.messagePlayer( - aPlayer, "Active? " + this.getBaseMetaTileEntity().isActive()); + PlayerUtils.messagePlayer(aPlayer, "Active? " + this.getBaseMetaTileEntity().isActive()); PlayerUtils.messagePlayer(aPlayer, "Has Turbine inserted? " + this.hasTurbine()); if (this.hasTurbine()) { Materials aMat = GT_MetaGenerated_Tool.getPrimaryMaterial(getTurbine()); - String aSize = GregtechMetaTileEntity_LargerTurbineBase.getTurbineSizeString( - GregtechMetaTileEntity_LargerTurbineBase.getTurbineSize(getTurbine())); + String aSize = GregtechMetaTileEntity_LargerTurbineBase + .getTurbineSizeString(GregtechMetaTileEntity_LargerTurbineBase.getTurbineSize(getTurbine())); PlayerUtils.messagePlayer(aPlayer, "Using: " + aMat.mLocalizedName + " " + aSize); } } else { @@ -343,8 +336,8 @@ public class GT_MetaTileEntity_Hatch_Turbine extends GT_MetaTileEntity_Hatch { } @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 (this.getBaseMetaTileEntity().isServerSide() && !aPlayer.isSneaking()) { ItemStack tCurrentItem = aPlayer.inventory.getCurrentItem(); if (tCurrentItem != null) { @@ -357,8 +350,8 @@ public class GT_MetaTileEntity_Hatch_Turbine extends GT_MetaTileEntity_Hatch { } @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 (this.getBaseMetaTileEntity().isServerSide()) { ItemStack tCurrentItem = aPlayer.inventory.getCurrentItem(); if (tCurrentItem != null) { @@ -417,9 +410,8 @@ public class GT_MetaTileEntity_Hatch_Turbine extends GT_MetaTileEntity_Hatch { @Override public void addUIWidgets(ModularWindow.Builder builder, UIBuildContext buildContext) { - builder.widget(new SlotWidget(inventoryHandler, 0) - .setFilter(GregtechMetaTileEntity_LargerTurbineBase::isValidTurbine) - .setAccess(false, true) - .setPos(79, 34)); + builder.widget( + new SlotWidget(inventoryHandler, 0).setFilter(GregtechMetaTileEntity_LargerTurbineBase::isValidTurbine) + .setAccess(false, true).setPos(79, 34)); } } diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_Hatch_TurbineProvider.java b/src/main/java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_Hatch_TurbineProvider.java index 63937d42ce..a15a11f34a 100644 --- a/src/main/java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_Hatch_TurbineProvider.java +++ b/src/main/java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_Hatch_TurbineProvider.java @@ -1,8 +1,15 @@ package gtPlusPlus.xmod.gregtech.api.metatileentity.implementations; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.item.ItemStack; +import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.world.World; +import net.minecraft.world.chunk.Chunk; + import com.gtnewhorizons.modularui.api.screen.ModularWindow; import com.gtnewhorizons.modularui.api.screen.UIBuildContext; import com.gtnewhorizons.modularui.common.widget.SlotWidget; + import gregtech.api.interfaces.ITexture; import gregtech.api.interfaces.metatileentity.IMetaTileEntity; import gregtech.api.interfaces.tileentity.IGregTechTileEntity; @@ -16,11 +23,6 @@ import gtPlusPlus.core.util.Utils; import gtPlusPlus.core.util.minecraft.PlayerUtils; import gtPlusPlus.core.util.sys.KeyboardUtils; import gtPlusPlus.xmod.gregtech.common.tileentities.machines.multi.production.turbines.GregtechMetaTileEntity_LargerTurbineBase; -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.item.ItemStack; -import net.minecraft.nbt.NBTTagCompound; -import net.minecraft.world.World; -import net.minecraft.world.chunk.Chunk; public class GT_MetaTileEntity_Hatch_TurbineProvider extends GT_MetaTileEntity_Hatch_InputBus { @@ -28,13 +30,13 @@ public class GT_MetaTileEntity_Hatch_TurbineProvider extends GT_MetaTileEntity_H super(aID, aName, aNameRegional, aTier); } - public GT_MetaTileEntity_Hatch_TurbineProvider( - String aName, int aTier, String aDescription, ITexture[][][] aTextures) { + public GT_MetaTileEntity_Hatch_TurbineProvider(String aName, int aTier, String aDescription, + ITexture[][][] aTextures) { super(aName, aTier, aDescription, aTextures); } - public GT_MetaTileEntity_Hatch_TurbineProvider( - String aName, int aTier, String[] aDescription, ITexture[][][] aTextures) { + public GT_MetaTileEntity_Hatch_TurbineProvider(String aName, int aTier, String[] aDescription, + ITexture[][][] aTextures) { super(aName, aTier, aDescription[0], aTextures); } @@ -44,16 +46,11 @@ public class GT_MetaTileEntity_Hatch_TurbineProvider extends GT_MetaTileEntity_H @Override public String[] getDescription() { - return new String[] { - "An automation port for Large Turbines", - "Will attempt once per 1200 ticks to fill the turbine slot of it's parent turbine", - "You may adjust this with a screwdriver", - "Hold shift to adjust in finer amounts", - "Hold control to adjust direction", - "Left Click with Screwdriver to reset", - "This module assumes the entire turbine is in the same Chunk", - CORE.GT_Tooltip - }; + return new String[] { "An automation port for Large Turbines", + "Will attempt once per 1200 ticks to fill the turbine slot of it's parent turbine", + "You may adjust this with a screwdriver", "Hold shift to adjust in finer amounts", + "Hold control to adjust direction", "Left Click with Screwdriver to reset", + "This module assumes the entire turbine is in the same Chunk", CORE.GT_Tooltip }; } private GT_MetaTileEntity_LargeTurbine mParent = null; @@ -214,9 +211,8 @@ public class GT_MetaTileEntity_Hatch_TurbineProvider extends GT_MetaTileEntity_H @Override public void addUIWidgets(ModularWindow.Builder builder, UIBuildContext buildContext) { - builder.widget(new SlotWidget(inventoryHandler, 0) - .setFilter(GregtechMetaTileEntity_LargerTurbineBase::isValidTurbine) - .setAccess(false, true) - .setPos(79, 34)); + builder.widget( + new SlotWidget(inventoryHandler, 0).setFilter(GregtechMetaTileEntity_LargerTurbineBase::isValidTurbine) + .setAccess(false, true).setPos(79, 34)); } } diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_SuperBus_Input.java b/src/main/java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_SuperBus_Input.java index 8854818cac..f3d2d79e19 100644 --- a/src/main/java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_SuperBus_Input.java +++ b/src/main/java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_SuperBus_Input.java @@ -4,6 +4,7 @@ import com.gtnewhorizons.modularui.api.screen.ModularWindow.Builder; import com.gtnewhorizons.modularui.api.screen.UIBuildContext; import com.gtnewhorizons.modularui.common.widget.Scrollable; import com.gtnewhorizons.modularui.common.widget.SlotWidget; + import gregtech.api.interfaces.ITexture; import gregtech.api.interfaces.tileentity.IGregTechTileEntity; import gregtech.api.metatileentity.MetaTileEntity; @@ -12,6 +13,7 @@ import gregtech.api.util.extensions.ArrayExt; import gtPlusPlus.core.lib.CORE; public class GT_MetaTileEntity_SuperBus_Input extends GT_MetaTileEntity_Hatch_InputBus { + public GT_MetaTileEntity_SuperBus_Input(int aID, String aName, String aNameRegional, int aTier) { super(aID, aName, aNameRegional, aTier, getSlots(aTier) + 1); } @@ -32,12 +34,15 @@ public class GT_MetaTileEntity_SuperBus_Input extends GT_MetaTileEntity_Hatch_In public MetaTileEntity newMetaEntity(IGregTechTileEntity aTileEntity) { return new GT_MetaTileEntity_SuperBus_Input( - this.mName, this.mTier, ArrayExt.of(this.mDescription), this.mTextures); + this.mName, + this.mTier, + ArrayExt.of(this.mDescription), + this.mTextures); } @Override public String[] getDescription() { - return new String[] {"Item Input for Multiblocks", "" + getSlots(this.mTier) + " Slots", CORE.GT_Tooltip}; + return new String[] { "Item Input for Multiblocks", "" + getSlots(this.mTier) + " Slots", CORE.GT_Tooltip }; } @Override @@ -51,9 +56,9 @@ public class GT_MetaTileEntity_SuperBus_Input extends GT_MetaTileEntity_Hatch_In for (int row = 0; row * 4 < inventoryHandler.getSlots() - 1; row++) { int columnsToMake = Math.min(inventoryHandler.getSlots() - row * 4, 4); for (int column = 0; column < columnsToMake; column++) { - scrollable.widget(new SlotWidget(inventoryHandler, row * 4 + column) - .setPos(column * 18, row * 18) - .setSize(18, 18)); + scrollable.widget( + new SlotWidget(inventoryHandler, row * 4 + column).setPos(column * 18, row * 18) + .setSize(18, 18)); } } builder.widget(scrollable.setSize(18 * 4 + 4, 18 * 4).setPos(52, 7)); diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_SuperBus_Output.java b/src/main/java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_SuperBus_Output.java index 26fbf7cdd8..418717b1c8 100644 --- a/src/main/java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_SuperBus_Output.java +++ b/src/main/java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_SuperBus_Output.java @@ -1,9 +1,12 @@ package gtPlusPlus.xmod.gregtech.api.metatileentity.implementations; +import net.minecraft.inventory.IInventory; + import com.gtnewhorizons.modularui.api.screen.ModularWindow.Builder; import com.gtnewhorizons.modularui.api.screen.UIBuildContext; import com.gtnewhorizons.modularui.common.widget.Scrollable; import com.gtnewhorizons.modularui.common.widget.SlotWidget; + import gregtech.api.interfaces.ITexture; import gregtech.api.interfaces.tileentity.IGregTechTileEntity; import gregtech.api.metatileentity.MetaTileEntity; @@ -11,7 +14,6 @@ import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch_Outpu import gregtech.api.util.GT_Utility; import gregtech.api.util.extensions.ArrayExt; import gtPlusPlus.core.lib.CORE; -import net.minecraft.inventory.IInventory; public class GT_MetaTileEntity_SuperBus_Output extends GT_MetaTileEntity_Hatch_OutputBus { @@ -39,7 +41,10 @@ public class GT_MetaTileEntity_SuperBus_Output extends GT_MetaTileEntity_Hatch_O public MetaTileEntity newMetaEntity(IGregTechTileEntity aTileEntity) { return new GT_MetaTileEntity_SuperBus_Output( - this.mName, this.mTier, ArrayExt.of(this.mDescription), this.mTextures); + this.mName, + this.mTier, + ArrayExt.of(this.mDescription), + this.mTextures); } public void onPostTick(IGregTechTileEntity aBaseMetaTileEntity, long aTimer) { @@ -61,9 +66,8 @@ public class GT_MetaTileEntity_SuperBus_Output extends GT_MetaTileEntity_Hatch_O protected void fillStacksIntoFirstSlots() { for (int i = 0; i < this.mInventory.length; ++i) { for (int j = i + 1; j < this.mInventory.length; ++j) { - if (this.mInventory[j] != null - && (this.mInventory[i] == null - || GT_Utility.areStacksEqual(this.mInventory[i], this.mInventory[j]))) { + if (this.mInventory[j] != null && (this.mInventory[i] == null + || GT_Utility.areStacksEqual(this.mInventory[i], this.mInventory[j]))) { GT_Utility.moveStackFromSlotAToSlotB( (IInventory) this.getBaseMetaTileEntity(), (IInventory) this.getBaseMetaTileEntity(), @@ -80,8 +84,8 @@ public class GT_MetaTileEntity_SuperBus_Output extends GT_MetaTileEntity_Hatch_O @Override public String[] getDescription() { - String[] aDesc = - new String[] {"Item Output for Multiblocks", "" + getSlots(this.mTier) + " Slots", CORE.GT_Tooltip}; + String[] aDesc = new String[] { "Item Output for Multiblocks", "" + getSlots(this.mTier) + " Slots", + CORE.GT_Tooltip }; return aDesc; } @@ -91,9 +95,9 @@ public class GT_MetaTileEntity_SuperBus_Output extends GT_MetaTileEntity_Hatch_O for (int row = 0; row * 4 < inventoryHandler.getSlots() - 1; row++) { int columnsToMake = Math.min(inventoryHandler.getSlots() - row * 4, 4); for (int column = 0; column < columnsToMake; column++) { - scrollable.widget(new SlotWidget(inventoryHandler, row * 4 + column) - .setPos(column * 18, row * 18) - .setSize(18, 18)); + scrollable.widget( + new SlotWidget(inventoryHandler, row * 4 + column).setPos(column * 18, row * 18) + .setSize(18, 18)); } } builder.widget(scrollable.setSize(18 * 4 + 4, 18 * 4).setPos(52, 7)); diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/GregtechMetaPipeEntityFluid.java b/src/main/java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/GregtechMetaPipeEntityFluid.java index 8f7fd8d4d3..26ed6b2bcd 100644 --- a/src/main/java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/GregtechMetaPipeEntityFluid.java +++ b/src/main/java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/GregtechMetaPipeEntityFluid.java @@ -1,5 +1,7 @@ package gtPlusPlus.xmod.gregtech.api.metatileentity.implementations; +import net.minecraft.util.EnumChatFormatting; + import gregtech.api.enums.Dyes; import gregtech.api.enums.OrePrefixes; import gregtech.api.enums.SubTag; @@ -10,7 +12,6 @@ import gregtech.api.metatileentity.implementations.GT_MetaPipeEntity_Fluid; import gregtech.api.render.TextureFactory; import gtPlusPlus.xmod.gregtech.api.enums.GregtechOrePrefixes.GT_Materials; import gtPlusPlus.xmod.gregtech.common.StaticFields59; -import net.minecraft.util.EnumChatFormatting; public class GregtechMetaPipeEntityFluid extends GT_MetaPipeEntity_Fluid { @@ -23,38 +24,18 @@ public class GregtechMetaPipeEntityFluid extends GT_MetaPipeEntity_Fluid { public final GT_Materials mMaterial; private boolean mCheckConnections; - public GregtechMetaPipeEntityFluid( - int aID, - String aName, - String aNameRegional, - float aThickNess, - GT_Materials aMaterial, - int aCapacity, - int aHeatResistance, - boolean aGasProof) { + public GregtechMetaPipeEntityFluid(int aID, String aName, String aNameRegional, float aThickNess, + GT_Materials aMaterial, int aCapacity, int aHeatResistance, boolean aGasProof) { this(aID, aName, aNameRegional, aThickNess, aMaterial, aCapacity, aHeatResistance, aGasProof, 1); } - public GregtechMetaPipeEntityFluid( - final String aName, - final float aThickNess, - final GT_Materials aMaterial, - final int aCapacity, - final int aHeatResistance, - final boolean aGasProof) { + public GregtechMetaPipeEntityFluid(final String aName, final float aThickNess, final GT_Materials aMaterial, + final int aCapacity, final int aHeatResistance, final boolean aGasProof) { this(aName, aThickNess, aMaterial, aCapacity, aHeatResistance, aGasProof, 1); } - public GregtechMetaPipeEntityFluid( - int aID, - String aName, - String aNameRegional, - float aThickNess, - GT_Materials aMaterial, - int aCapacity, - int aHeatResistance, - boolean aGasProof, - int aFluidTypes) { + public GregtechMetaPipeEntityFluid(int aID, String aName, String aNameRegional, float aThickNess, + GT_Materials aMaterial, int aCapacity, int aHeatResistance, boolean aGasProof, int aFluidTypes) { super(aID, aName, aNameRegional, aThickNess, null, aCapacity, aHeatResistance, aGasProof); this.mLastReceivedFrom = 0; this.oLastReceivedFrom = 0; @@ -62,14 +43,8 @@ public class GregtechMetaPipeEntityFluid extends GT_MetaPipeEntity_Fluid { this.mMaterial = aMaterial; } - public GregtechMetaPipeEntityFluid( - String aName, - float aThickNess, - GT_Materials aMaterial, - int aCapacity, - int aHeatResistance, - boolean aGasProof, - int aFluidTypes) { + public GregtechMetaPipeEntityFluid(String aName, float aThickNess, GT_Materials aMaterial, int aCapacity, + int aHeatResistance, boolean aGasProof, int aFluidTypes) { super(aName, aThickNess, null, aCapacity, aHeatResistance, aGasProof); this.mLastReceivedFrom = 0; this.oLastReceivedFrom = 0; @@ -79,8 +54,7 @@ public class GregtechMetaPipeEntityFluid extends GT_MetaPipeEntity_Fluid { @Override public byte getTileEntityBaseType() { - return this.mMaterial == null - ? 4 + return this.mMaterial == null ? 4 : (byte) ((this.mMaterial.contains(SubTag.WOOD) ? 12 : 4) + Math.max(0, Math.min(3, this.mMaterial.mToolQuality))); } @@ -88,80 +62,61 @@ public class GregtechMetaPipeEntityFluid extends GT_MetaPipeEntity_Fluid { @Override public IMetaTileEntity newMetaEntity(final IGregTechTileEntity aTileEntity) { return new GregtechMetaPipeEntityFluid( - this.mName, this.mThickNess, this.mMaterial, this.mCapacity, this.mHeatResistance, this.mGasProof); + this.mName, + this.mThickNess, + this.mMaterial, + this.mCapacity, + this.mHeatResistance, + this.mGasProof); } @Override - public ITexture[] getTexture( - IGregTechTileEntity aBaseMetaTileEntity, - byte aSide, - byte aConnections, - byte aColorIndex, - boolean aConnected, - boolean aRedstone) { + public ITexture[] getTexture(IGregTechTileEntity aBaseMetaTileEntity, byte aSide, byte aConnections, + byte aColorIndex, boolean aConnected, boolean aRedstone) { float tThickNess = getThickNess(); if (mDisableInput == 0) - return new ITexture[] { - aConnected - ? getBaseTexture(tThickNess, mPipeAmount, mMaterial, aColorIndex) - : TextureFactory.of( - mMaterial.mIconSet.mTextures[OrePrefixes.pipe.mTextureIndex], - Dyes.getModulation(aColorIndex, mMaterial.mRGBa)) - }; + return new ITexture[] { aConnected ? getBaseTexture(tThickNess, mPipeAmount, mMaterial, aColorIndex) + : TextureFactory.of( + mMaterial.mIconSet.mTextures[OrePrefixes.pipe.mTextureIndex], + Dyes.getModulation(aColorIndex, mMaterial.mRGBa)) }; byte tMask = 0; - byte[][] sRestrictionArray = { - {2, 3, 5, 4}, - {2, 3, 4, 5}, - {1, 0, 4, 5}, - {1, 0, 4, 5}, - {1, 0, 2, 3}, - {1, 0, 2, 3} - }; + 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, GT_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)); + protected static ITexture getBaseTexture(float aThickNess, int aPipeAmount, GT_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)); return TextureFactory.of( aMaterial.mIconSet.mTextures[OrePrefixes.pipeHuge.mTextureIndex], Dyes.getModulation(aColorIndex, aMaterial.mRGBa)); @@ -170,10 +125,13 @@ public class GregtechMetaPipeEntityFluid extends GT_MetaPipeEntity_Fluid { @Override public String[] getDescription() { return new String[] { - EnumChatFormatting.BLUE + "Fluid Capacity: %%%" + (mCapacity * 20) + "%%% L/sec" + EnumChatFormatting.GRAY, - EnumChatFormatting.RED + "Heat Limit: %%%" + mHeatResistance + "%%% K" + EnumChatFormatting.GRAY, - EnumChatFormatting.DARK_GREEN + "Gas Proof: " + (this.mGasProof) + EnumChatFormatting.GRAY, - // CORE.GT_Tooltip + EnumChatFormatting.BLUE + "Fluid Capacity: %%%" + + (mCapacity * 20) + + "%%% L/sec" + + EnumChatFormatting.GRAY, + EnumChatFormatting.RED + "Heat Limit: %%%" + mHeatResistance + "%%% K" + EnumChatFormatting.GRAY, + EnumChatFormatting.DARK_GREEN + "Gas Proof: " + (this.mGasProof) + EnumChatFormatting.GRAY, + // CORE.GT_Tooltip }; } } diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/GregtechMetaPipeEntity_Cable.java b/src/main/java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/GregtechMetaPipeEntity_Cable.java index eff2413102..1605448cfb 100644 --- a/src/main/java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/GregtechMetaPipeEntity_Cable.java +++ b/src/main/java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/GregtechMetaPipeEntity_Cable.java @@ -12,14 +12,14 @@ import gregtech.api.objects.GT_RenderedTexture; import gregtech.api.util.GT_Utility; public class GregtechMetaPipeEntity_Cable extends GT_MetaPipeEntity_Cable implements IMetaTileEntityCable { + private static Textures.BlockIcons INSULATION_MEDIUM_PLUS; static { if (GTNH) { try { - INSULATION_MEDIUM_PLUS = - (Textures.BlockIcons) GT_Utility.getField(Textures.BlockIcons.class, "INSULATION_MEDIUM_PLUS") - .get(null); + INSULATION_MEDIUM_PLUS = (Textures.BlockIcons) GT_Utility + .getField(Textures.BlockIcons.class, "INSULATION_MEDIUM_PLUS").get(null); } catch (IllegalAccessException | NullPointerException e) { throw new Error(e); } @@ -28,18 +28,9 @@ public class GregtechMetaPipeEntity_Cable extends GT_MetaPipeEntity_Cable implem private short[] vRGB = null; - public GregtechMetaPipeEntity_Cable( - final int aID, - final String aName, - final String aNameRegional, - final float aThickNess, - final Materials aMaterial, - final long aCableLossPerMeter, - final long aAmperage, - final long aVoltage, - final boolean aInsulated, - final boolean aCanShock, - final short[] aRGB) { + public GregtechMetaPipeEntity_Cable(final int aID, final String aName, final String aNameRegional, + final float aThickNess, final Materials aMaterial, final long aCableLossPerMeter, final long aAmperage, + final long aVoltage, final boolean aInsulated, final boolean aCanShock, final short[] aRGB) { super( aID, aName, @@ -54,31 +45,16 @@ public class GregtechMetaPipeEntity_Cable extends GT_MetaPipeEntity_Cable implem this.vRGB = aRGB == null || aRGB.length != 4 ? Materials.Iron.mRGBa : aRGB; } - public GregtechMetaPipeEntity_Cable( - final String aName, - final float aThickNess, - final Materials aMaterial, - final long aCableLossPerMeter, - final long aAmperage, - final long aVoltage, - final boolean aInsulated, - final boolean aCanShock, - final short[] aRGB) { + public GregtechMetaPipeEntity_Cable(final String aName, final float aThickNess, final Materials aMaterial, + final long aCableLossPerMeter, final long aAmperage, final long aVoltage, final boolean aInsulated, + final boolean aCanShock, final short[] aRGB) { super(aName, aThickNess, aMaterial, aCableLossPerMeter, aAmperage, aVoltage, aInsulated, aCanShock); this.vRGB = aRGB == null || aRGB.length != 4 ? Materials.Iron.mRGBa : aRGB; } - public GregtechMetaPipeEntity_Cable( - final int aID, - final String aName, - final String aNameRegional, - final float aThickNess, - final long aCableLossPerMeter, - final long aAmperage, - final long aVoltage, - final boolean aInsulated, - final boolean aCanShock, - final short[] aRGB) { + public GregtechMetaPipeEntity_Cable(final int aID, final String aName, final String aNameRegional, + final float aThickNess, final long aCableLossPerMeter, final long aAmperage, final long aVoltage, + final boolean aInsulated, final boolean aCanShock, final short[] aRGB) { this( aID, aName, @@ -93,14 +69,8 @@ public class GregtechMetaPipeEntity_Cable extends GT_MetaPipeEntity_Cable implem aRGB); } - public GregtechMetaPipeEntity_Cable( - final String aName, - final float aThickNess, - final long aCableLossPerMeter, - final long aAmperage, - final long aVoltage, - final boolean aInsulated, - final boolean aCanShock, + public GregtechMetaPipeEntity_Cable(final String aName, final float aThickNess, final long aCableLossPerMeter, + final long aAmperage, final long aVoltage, final boolean aInsulated, final boolean aCanShock, final short[] aRGB) { this(aName, aThickNess, null, aCableLossPerMeter, aAmperage, aVoltage, aInsulated, aCanShock, aRGB); } @@ -120,111 +90,84 @@ public class GregtechMetaPipeEntity_Cable extends GT_MetaPipeEntity_Cable implem } @Override - public ITexture[] getTexture( - IGregTechTileEntity aBaseMetaTileEntity, - byte aSide, - byte aConnections, - byte aColorIndex, - boolean aConnected, - boolean aRedstone) { - return GTNH - ? getTextureGTNH(aBaseMetaTileEntity, aSide, aConnections, aColorIndex, aConnected, aRedstone) + public ITexture[] getTexture(IGregTechTileEntity aBaseMetaTileEntity, byte aSide, byte aConnections, + byte aColorIndex, boolean aConnected, boolean aRedstone) { + return GTNH ? getTextureGTNH(aBaseMetaTileEntity, aSide, aConnections, aColorIndex, aConnected, aRedstone) : getTexturePure(aBaseMetaTileEntity, aSide, aConnections, aColorIndex, aConnected, aRedstone); } - private ITexture[] getTextureGTNH( - IGregTechTileEntity aBaseMetaTileEntity, - byte aSide, - byte aConnections, - byte aColorIndex, - boolean aConnected, - boolean aRedstone) { + private ITexture[] getTextureGTNH(IGregTechTileEntity aBaseMetaTileEntity, byte aSide, byte aConnections, + byte aColorIndex, boolean aConnected, boolean aRedstone) { Materials wireMaterial = mMaterial; if (wireMaterial == null) { wireMaterial = Materials.Iron; } - if (!mInsulated) - return new ITexture[] { - new GT_RenderedTexture( - wireMaterial.mIconSet.mTextures[TextureSet.INDEX_wire], Dyes.getModulation(aColorIndex, vRGB)) - }; + if (!mInsulated) return new ITexture[] { new GT_RenderedTexture( + wireMaterial.mIconSet.mTextures[TextureSet.INDEX_wire], + Dyes.getModulation(aColorIndex, vRGB)) }; if (aConnected) { float tThickNess = getThickNess(); - if (tThickNess < 0.124F) - return new ITexture[] { - new GT_RenderedTexture( - Textures.BlockIcons.INSULATION_FULL, - Dyes.getModulation(aColorIndex, Dyes.CABLE_INSULATION.mRGBa)) - }; + if (tThickNess < 0.124F) return new ITexture[] { new GT_RenderedTexture( + Textures.BlockIcons.INSULATION_FULL, + Dyes.getModulation(aColorIndex, Dyes.CABLE_INSULATION.mRGBa)) }; if (tThickNess < 0.374F) // 0.375 x1 - return new ITexture[] { - new GT_RenderedTexture(wireMaterial.mIconSet.mTextures[TextureSet.INDEX_wire], vRGB), - new GT_RenderedTexture( - Textures.BlockIcons.INSULATION_TINY, - Dyes.getModulation(aColorIndex, Dyes.CABLE_INSULATION.mRGBa)) - }; + return new ITexture[] { + new GT_RenderedTexture(wireMaterial.mIconSet.mTextures[TextureSet.INDEX_wire], vRGB), + new GT_RenderedTexture( + Textures.BlockIcons.INSULATION_TINY, + Dyes.getModulation(aColorIndex, Dyes.CABLE_INSULATION.mRGBa)) }; if (tThickNess < 0.499F) // 0.500 x2 - return new ITexture[] { - new GT_RenderedTexture(wireMaterial.mIconSet.mTextures[TextureSet.INDEX_wire], vRGB), - new GT_RenderedTexture( - Textures.BlockIcons.INSULATION_SMALL, - Dyes.getModulation(aColorIndex, Dyes.CABLE_INSULATION.mRGBa)) - }; + return new ITexture[] { + new GT_RenderedTexture(wireMaterial.mIconSet.mTextures[TextureSet.INDEX_wire], vRGB), + new GT_RenderedTexture( + Textures.BlockIcons.INSULATION_SMALL, + Dyes.getModulation(aColorIndex, Dyes.CABLE_INSULATION.mRGBa)) }; if (tThickNess < 0.624F) // 0.625 x4 - return new ITexture[] { - new GT_RenderedTexture(wireMaterial.mIconSet.mTextures[TextureSet.INDEX_wire], vRGB), - new GT_RenderedTexture( - Textures.BlockIcons.INSULATION_MEDIUM, - Dyes.getModulation(aColorIndex, Dyes.CABLE_INSULATION.mRGBa)) - }; + return new ITexture[] { + new GT_RenderedTexture(wireMaterial.mIconSet.mTextures[TextureSet.INDEX_wire], vRGB), + new GT_RenderedTexture( + Textures.BlockIcons.INSULATION_MEDIUM, + Dyes.getModulation(aColorIndex, Dyes.CABLE_INSULATION.mRGBa)) }; if (tThickNess < 0.749F) // 0.750 x8 - return new ITexture[] { - new GT_RenderedTexture(wireMaterial.mIconSet.mTextures[TextureSet.INDEX_wire], vRGB), - new GT_RenderedTexture( - INSULATION_MEDIUM_PLUS, Dyes.getModulation(aColorIndex, Dyes.CABLE_INSULATION.mRGBa)) - }; + return new ITexture[] { + new GT_RenderedTexture(wireMaterial.mIconSet.mTextures[TextureSet.INDEX_wire], vRGB), + new GT_RenderedTexture( + INSULATION_MEDIUM_PLUS, + Dyes.getModulation(aColorIndex, Dyes.CABLE_INSULATION.mRGBa)) }; if (tThickNess < 0.874F) // 0.825 x12 + return new ITexture[] { + new GT_RenderedTexture(wireMaterial.mIconSet.mTextures[TextureSet.INDEX_wire], vRGB), + new GT_RenderedTexture( + Textures.BlockIcons.INSULATION_LARGE, + Dyes.getModulation(aColorIndex, Dyes.CABLE_INSULATION.mRGBa)) }; return new ITexture[] { new GT_RenderedTexture(wireMaterial.mIconSet.mTextures[TextureSet.INDEX_wire], vRGB), new GT_RenderedTexture( - Textures.BlockIcons.INSULATION_LARGE, - Dyes.getModulation(aColorIndex, Dyes.CABLE_INSULATION.mRGBa)) - }; - return new ITexture[] { - new GT_RenderedTexture(wireMaterial.mIconSet.mTextures[TextureSet.INDEX_wire], vRGB), - new GT_RenderedTexture( - 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[] { - new GT_RenderedTexture( - Textures.BlockIcons.INSULATION_FULL, Dyes.getModulation(aColorIndex, Dyes.CABLE_INSULATION.mRGBa)) - }; + return new ITexture[] { new GT_RenderedTexture( + Textures.BlockIcons.INSULATION_FULL, + Dyes.getModulation(aColorIndex, Dyes.CABLE_INSULATION.mRGBa)) }; } - private ITexture[] getTexturePure( - IGregTechTileEntity aBaseMetaTileEntity, - byte aSide, - byte aConnections, - byte aColorIndex, - boolean aConnected, - boolean aRedstone) { + private ITexture[] getTexturePure(IGregTechTileEntity aBaseMetaTileEntity, byte aSide, byte aConnections, + byte aColorIndex, boolean aConnected, boolean aRedstone) { // if (this.vRGB == null || this.vRGB.length < 3 || this.vRGB.length > 4){ - // this.vRGB = new short[]{200, 0, 200, 0}; + // this.vRGB = new short[]{200, 0, 200, 0}; // } // if (this.vRGB.length != 4){ - // short[] tempRGB = this.vRGB; - // this.vRGB = new short[]{tempRGB[0], tempRGB[1], tempRGB[2], 0}; + // short[] tempRGB = this.vRGB; + // this.vRGB = new short[]{tempRGB[0], tempRGB[1], tempRGB[2], 0}; // } // // Materials wireMaterial = this.mMaterial; // // if (wireMaterial == null){ - // wireMaterial = Materials.Iron; + // wireMaterial = Materials.Iron; // } // With the code in constructors it should work @@ -233,63 +176,46 @@ public class GregtechMetaPipeEntity_Cable extends GT_MetaPipeEntity_Cable implem wireMaterial = Materials.Iron; } - if (!(this.mInsulated)) - return new ITexture[] { - new GT_RenderedTexture(wireMaterial.mIconSet.mTextures[69], Dyes.getModulation(aColorIndex, this.vRGB)) - }; + if (!(this.mInsulated)) return new ITexture[] { new GT_RenderedTexture( + wireMaterial.mIconSet.mTextures[69], + Dyes.getModulation(aColorIndex, this.vRGB)) }; if (aConnected) { float tThickNess = getThickNess(); - if (tThickNess < 0.124F) - return new ITexture[] { - new GT_RenderedTexture( - Textures.BlockIcons.INSULATION_FULL, - Dyes.getModulation(aColorIndex, Dyes.CABLE_INSULATION.mRGBa)) - }; + if (tThickNess < 0.124F) return new ITexture[] { new GT_RenderedTexture( + Textures.BlockIcons.INSULATION_FULL, + Dyes.getModulation(aColorIndex, Dyes.CABLE_INSULATION.mRGBa)) }; if (tThickNess < 0.374F) - return new ITexture[] { - new GT_RenderedTexture(wireMaterial.mIconSet.mTextures[69], this.vRGB), - new GT_RenderedTexture( - Textures.BlockIcons.INSULATION_TINY, - Dyes.getModulation(aColorIndex, Dyes.CABLE_INSULATION.mRGBa)) - }; + return new ITexture[] { new GT_RenderedTexture(wireMaterial.mIconSet.mTextures[69], this.vRGB), + new GT_RenderedTexture( + Textures.BlockIcons.INSULATION_TINY, + Dyes.getModulation(aColorIndex, Dyes.CABLE_INSULATION.mRGBa)) }; if (tThickNess < 0.499F) - return new ITexture[] { - new GT_RenderedTexture(wireMaterial.mIconSet.mTextures[69], this.vRGB), - new GT_RenderedTexture( - Textures.BlockIcons.INSULATION_SMALL, - Dyes.getModulation(aColorIndex, Dyes.CABLE_INSULATION.mRGBa)) - }; + return new ITexture[] { new GT_RenderedTexture(wireMaterial.mIconSet.mTextures[69], this.vRGB), + new GT_RenderedTexture( + Textures.BlockIcons.INSULATION_SMALL, + Dyes.getModulation(aColorIndex, Dyes.CABLE_INSULATION.mRGBa)) }; if (tThickNess < 0.624F) - return new ITexture[] { - new GT_RenderedTexture(wireMaterial.mIconSet.mTextures[69], this.vRGB), - new GT_RenderedTexture( - Textures.BlockIcons.INSULATION_MEDIUM, - Dyes.getModulation(aColorIndex, Dyes.CABLE_INSULATION.mRGBa)) - }; + return new ITexture[] { new GT_RenderedTexture(wireMaterial.mIconSet.mTextures[69], this.vRGB), + new GT_RenderedTexture( + Textures.BlockIcons.INSULATION_MEDIUM, + Dyes.getModulation(aColorIndex, Dyes.CABLE_INSULATION.mRGBa)) }; if (tThickNess < 0.749F) - return new ITexture[] { - new GT_RenderedTexture(wireMaterial.mIconSet.mTextures[69], this.vRGB), - new GT_RenderedTexture( - Textures.BlockIcons.INSULATION_LARGE, - Dyes.getModulation(aColorIndex, Dyes.CABLE_INSULATION.mRGBa)) - }; + return new ITexture[] { new GT_RenderedTexture(wireMaterial.mIconSet.mTextures[69], this.vRGB), + new GT_RenderedTexture( + Textures.BlockIcons.INSULATION_LARGE, + Dyes.getModulation(aColorIndex, Dyes.CABLE_INSULATION.mRGBa)) }; if (tThickNess < 0.874F) - return new ITexture[] { - new GT_RenderedTexture(wireMaterial.mIconSet.mTextures[69], this.vRGB), + return new ITexture[] { new GT_RenderedTexture(wireMaterial.mIconSet.mTextures[69], this.vRGB), + new GT_RenderedTexture( + Textures.BlockIcons.INSULATION_HUGE, + Dyes.getModulation(aColorIndex, Dyes.CABLE_INSULATION.mRGBa)) }; + return new ITexture[] { new GT_RenderedTexture(wireMaterial.mIconSet.mTextures[69], this.vRGB), new GT_RenderedTexture( - Textures.BlockIcons.INSULATION_HUGE, - Dyes.getModulation(aColorIndex, Dyes.CABLE_INSULATION.mRGBa)) - }; - return new ITexture[] { - new GT_RenderedTexture(wireMaterial.mIconSet.mTextures[69], this.vRGB), - new GT_RenderedTexture( - Textures.BlockIcons.INSULATION_FULL, - Dyes.getModulation(aColorIndex, Dyes.CABLE_INSULATION.mRGBa)) - }; + Textures.BlockIcons.INSULATION_FULL, + Dyes.getModulation(aColorIndex, Dyes.CABLE_INSULATION.mRGBa)) }; } - return new ITexture[] { - new GT_RenderedTexture( - Textures.BlockIcons.INSULATION_FULL, Dyes.getModulation(aColorIndex, Dyes.CABLE_INSULATION.mRGBa)) - }; + return new ITexture[] { new GT_RenderedTexture( + Textures.BlockIcons.INSULATION_FULL, + Dyes.getModulation(aColorIndex, Dyes.CABLE_INSULATION.mRGBa)) }; } } diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/GregtechMetaTreeFarmerStructural.java b/src/main/java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/GregtechMetaTreeFarmerStructural.java index 14399e525d..acd2e316aa 100644 --- a/src/main/java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/GregtechMetaTreeFarmerStructural.java +++ b/src/main/java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/GregtechMetaTreeFarmerStructural.java @@ -1,48 +1,44 @@ package gtPlusPlus.xmod.gregtech.api.metatileentity.implementations; +import net.minecraft.nbt.NBTTagCompound; + import gregtech.api.enums.Textures; import gregtech.api.interfaces.ITexture; import gregtech.api.interfaces.metatileentity.IMetaTileEntity; import gregtech.api.interfaces.tileentity.IGregTechTileEntity; import gregtech.api.objects.GT_RenderedTexture; import gtPlusPlus.xmod.gregtech.api.metatileentity.implementations.base.machines.GregtechMetaTreeFarmerBase; -import net.minecraft.nbt.NBTTagCompound; public class GregtechMetaTreeFarmerStructural extends GregtechMetaTreeFarmerBase { @Override public String[] getDescription() { - return new String[] {this.mDescription}; + return new String[] { this.mDescription }; } - public GregtechMetaTreeFarmerStructural( - final int aID, final String aName, final String aNameRegional, final int aTier) { + public GregtechMetaTreeFarmerStructural(final int aID, final String aName, final String aNameRegional, + final int aTier) { super(aID, aName, aNameRegional, aTier, 0, "Structural Blocks for the Tree Farmer."); } - public GregtechMetaTreeFarmerStructural( - final int aID, - final String aName, - final String aNameRegional, - final int aTier, - final int aInvSlotCount, - final String aDescription) { + public GregtechMetaTreeFarmerStructural(final int aID, final String aName, final String aNameRegional, + final int aTier, final int aInvSlotCount, final String aDescription) { super(aID, aName, aNameRegional, aTier, aInvSlotCount, aDescription); } - public GregtechMetaTreeFarmerStructural( - final String aName, - final int aTier, - final int aInvSlotCount, - final String aDescription, - final ITexture[][][] aTextures) { + public GregtechMetaTreeFarmerStructural(final String aName, final int aTier, final int aInvSlotCount, + final String aDescription, final ITexture[][][] aTextures) { super(aName, aTier, aInvSlotCount, aDescription, aTextures); } @Override public IMetaTileEntity newMetaEntity(final IGregTechTileEntity aTileEntity) { return new GregtechMetaTreeFarmerStructural( - this.mName, this.mTier, this.mInventory.length, this.mDescription, this.mTextures); + this.mName, + this.mTier, + this.mInventory.length, + this.mDescription, + this.mTextures); } @Override diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/base/CustomMetaTileBase.java b/src/main/java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/base/CustomMetaTileBase.java index 89bbe99771..ca4b938718 100644 --- a/src/main/java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/base/CustomMetaTileBase.java +++ b/src/main/java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/base/CustomMetaTileBase.java @@ -1,12 +1,14 @@ package gtPlusPlus.xmod.gregtech.api.metatileentity.implementations.base; +import java.util.Locale; + +import net.minecraft.item.ItemStack; + import gregtech.api.interfaces.tileentity.IGregTechTileEntity; import gregtech.api.metatileentity.MetaTileEntity; import gregtech.api.util.GT_LanguageManager; import gtPlusPlus.xmod.gregtech.api.interfaces.IBaseCustomMetaTileEntity; import gtPlusPlus.xmod.gregtech.common.Meta_GT_Proxy; -import java.util.Locale; -import net.minecraft.item.ItemStack; public abstract class CustomMetaTileBase extends MetaTileEntity { @@ -39,8 +41,7 @@ public abstract class CustomMetaTileBase extends MetaTileEntity { @Override public void setBaseMetaTileEntity(IGregTechTileEntity aBaseMetaTileEntity) { super.setBaseMetaTileEntity(aBaseMetaTileEntity); - if (mBaseCustomMetaTileEntity != null - && aBaseMetaTileEntity == null + if (mBaseCustomMetaTileEntity != null && aBaseMetaTileEntity == null && mBaseCustomMetaTileEntity.getMetaTileEntity() != null) { mBaseCustomMetaTileEntity.getMetaTileEntity().inValidate(); mBaseCustomMetaTileEntity.setMetaTileEntity(null); @@ -56,10 +57,7 @@ public abstract class CustomMetaTileBase extends MetaTileEntity { } public ItemStack getStackForm(long aAmount) { - return new ItemStack( - Meta_GT_Proxy.sBlockMachines, - (int) aAmount, - this.getBaseMetaTileEntity().getMetaTileID()); + return new ItemStack(Meta_GT_Proxy.sBlockMachines, (int) aAmount, this.getBaseMetaTileEntity().getMetaTileID()); } public String getLocalName() { @@ -69,25 +67,17 @@ public abstract class CustomMetaTileBase extends MetaTileEntity { /** * This determines the BaseMetaTileEntity belonging to this MetaTileEntity by using the Meta ID of the Block itself. * <p/> - * 0 = BaseMetaTileEntity, Wrench lvl 0 to dismantlee - * 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 + * 0 = BaseMetaTileEntity, Wrench lvl 0 to dismantlee 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 * * == Reserved for Alk now * - * 12 = BaseMetaPipeEntity, Wrench lvl 0 to dismantle - * 13 = BaseMetaPipeEntity, Wrench lvl 1 to dismantle - * 14 = BaseMetaPipeEntity, Wrench lvl 2 to dismantle - * 15 = BaseMetaPipeEntity, Wrench lvl 3 to dismantle + * 12 = BaseMetaPipeEntity, Wrench lvl 0 to dismantle 13 = BaseMetaPipeEntity, Wrench lvl 1 to dismantle 14 = + * BaseMetaPipeEntity, Wrench lvl 2 to dismantle 15 = BaseMetaPipeEntity, Wrench lvl 3 to dismantle */ @Override public byte getTileEntityBaseType() { diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/base/GT_MetaTileEntity_Hatch_CustomFluidBase.java b/src/main/java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/base/GT_MetaTileEntity_Hatch_CustomFluidBase.java index 16a4184c9d..7eb7eb22f2 100644 --- a/src/main/java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/base/GT_MetaTileEntity_Hatch_CustomFluidBase.java +++ b/src/main/java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/base/GT_MetaTileEntity_Hatch_CustomFluidBase.java @@ -3,6 +3,12 @@ package gtPlusPlus.xmod.gregtech.api.metatileentity.implementations.base; 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.util.EnumChatFormatting; +import net.minecraftforge.fluids.Fluid; +import net.minecraftforge.fluids.FluidStack; + import gregtech.GT_Mod; import gregtech.api.gui.modularui.GT_UIInfos; import gregtech.api.interfaces.ITexture; @@ -14,11 +20,6 @@ import gregtech.api.util.GT_Utility; import gregtech.common.gui.modularui.widget.FluidDisplaySlotWidget; import gtPlusPlus.core.lib.CORE; import gtPlusPlus.core.util.minecraft.FluidUtils; -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.item.ItemStack; -import net.minecraft.util.EnumChatFormatting; -import net.minecraftforge.fluids.Fluid; -import net.minecraftforge.fluids.FluidStack; public class GT_MetaTileEntity_Hatch_CustomFluidBase extends GT_MetaTileEntity_Hatch { @@ -27,35 +28,35 @@ public class GT_MetaTileEntity_Hatch_CustomFluidBase extends GT_MetaTileEntity_H protected FluidStack mLockedStack = null; protected String mTempMod = null; - public GT_MetaTileEntity_Hatch_CustomFluidBase( - Fluid aFluid, int aAmount, final int aID, final String aName, final String aNameRegional) { - super(aID, aName, aNameRegional, 6, 3, new String[] { - "Fluid Input for Multiblocks", "Capacity: " + GT_Utility.formatNumbers(aAmount) + "L" - }); + public GT_MetaTileEntity_Hatch_CustomFluidBase(Fluid aFluid, int aAmount, final int aID, final String aName, + final String aNameRegional) { + super( + aID, + aName, + aNameRegional, + 6, + 3, + new String[] { "Fluid Input for Multiblocks", "Capacity: " + GT_Utility.formatNumbers(aAmount) + "L" }); this.mLockedFluid = aFluid; this.mFluidCapacity = aAmount; } - public GT_MetaTileEntity_Hatch_CustomFluidBase( - Fluid aFluid, int aAmount, final String aName, final String aDescription, final ITexture[][][] aTextures) { + public GT_MetaTileEntity_Hatch_CustomFluidBase(Fluid aFluid, int aAmount, final String aName, + final String aDescription, final ITexture[][][] aTextures) { super(aName, 6, 3, aDescription, aTextures); this.mLockedFluid = aFluid; this.mFluidCapacity = aAmount; } - public GT_MetaTileEntity_Hatch_CustomFluidBase( - Fluid aFluid, - int aAmount, - final String aName, - final String[] aDescription, - final ITexture[][][] aTextures) { + public GT_MetaTileEntity_Hatch_CustomFluidBase(Fluid aFluid, int aAmount, final String aName, + final String[] aDescription, final ITexture[][][] aTextures) { super(aName, 6, 3, aDescription[0], aTextures); this.mLockedFluid = aFluid; this.mFluidCapacity = aAmount; } - public boolean allowPutStack( - final IGregTechTileEntity aBaseMetaTileEntity, final int aIndex, final byte aSide, final ItemStack aStack) { + public boolean allowPutStack(final IGregTechTileEntity aBaseMetaTileEntity, final int aIndex, final byte aSide, + final ItemStack aStack) { if (aSide == aBaseMetaTileEntity.getFrontFacing() && aIndex == 0) { FluidStack fs = GT_Utility.getFluidForFilledItem(aStack, true); return fs != null && fs.getFluid() == this.mLockedFluid; @@ -71,15 +72,15 @@ public class GT_MetaTileEntity_Hatch_CustomFluidBase extends GT_MetaTileEntity_H @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 @@ -180,13 +181,10 @@ public class GT_MetaTileEntity_Hatch_CustomFluidBase extends GT_MetaTileEntity_H aColour = EnumChatFormatting.RED; } String aFluidName = "Accepted Fluid: " + aColour - + (mLockedStack != null ? mLockedStack.getLocalizedName() : "Empty") + EnumChatFormatting.RESET; - return new String[] { - "Fluid Input for " + (isSteam ? "Steam " : "") + "Multiblocks", - "Capacity: " + getCapacity() + "L", - aFluidName, - CORE.GT_Tooltip - }; + + (mLockedStack != null ? mLockedStack.getLocalizedName() : "Empty") + + EnumChatFormatting.RESET; + return new String[] { "Fluid Input for " + (isSteam ? "Steam " : "") + "Multiblocks", + "Capacity: " + getCapacity() + "L", aFluidName, CORE.GT_Tooltip }; } public boolean isFluidInputAllowed(final FluidStack aFluid) { @@ -195,7 +193,11 @@ public class GT_MetaTileEntity_Hatch_CustomFluidBase extends GT_MetaTileEntity_H public MetaTileEntity newMetaEntity(final IGregTechTileEntity aTileEntity) { return new GT_MetaTileEntity_Hatch_CustomFluidBase( - this.mLockedFluid, this.mFluidCapacity, this.mName, this.mDescription, this.mTextures); + this.mLockedFluid, + this.mFluidCapacity, + this.mName, + this.mDescription, + this.mTextures); } @Override diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/base/GregtechMetaPipeEntityBase_Cable.java b/src/main/java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/base/GregtechMetaPipeEntityBase_Cable.java index efc2d008bb..6a5fb9d4d2 100644 --- a/src/main/java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/base/GregtechMetaPipeEntityBase_Cable.java +++ b/src/main/java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/base/GregtechMetaPipeEntityBase_Cable.java @@ -2,6 +2,21 @@ package gtPlusPlus.xmod.gregtech.api.metatileentity.implementations.base; import static gregtech.api.enums.GT_Values.VN; +import java.lang.reflect.Field; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.HashSet; + +import net.minecraft.entity.Entity; +import net.minecraft.entity.EntityLivingBase; +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 cofh.api.energy.IEnergyReceiver; import gregtech.GT_Mod; import gregtech.api.GregTech_API; @@ -23,21 +38,9 @@ import gtPlusPlus.api.objects.Logger; import gtPlusPlus.core.lib.CORE; import gtPlusPlus.xmod.gregtech.api.enums.GregtechOrePrefixes.GT_Materials; import ic2.api.energy.tile.IEnergySink; -import java.lang.reflect.Field; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.HashSet; -import net.minecraft.entity.Entity; -import net.minecraft.entity.EntityLivingBase; -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; public class GregtechMetaPipeEntityBase_Cable extends MetaPipeEntity implements IMetaTileEntityCable { + public final float mThickNess; public final GT_Materials mMaterial; public final long mCableLossPerMeter, mAmperage, mVoltage; @@ -47,17 +50,9 @@ public class GregtechMetaPipeEntityBase_Cable extends MetaPipeEntity implements public short mOverheat; public final int mWireHeatingTicks; - public GregtechMetaPipeEntityBase_Cable( - final int aID, - final String aName, - final String aNameRegional, - final float aThickNess, - final GT_Materials aMaterial, - final long aCableLossPerMeter, - final long aAmperage, - final long aVoltage, - final boolean aInsulated, - final boolean aCanShock) { + public GregtechMetaPipeEntityBase_Cable(final int aID, final String aName, final String aNameRegional, + final float aThickNess, final GT_Materials aMaterial, final long aCableLossPerMeter, final long aAmperage, + final long aVoltage, final boolean aInsulated, final boolean aCanShock) { super(aID, aName, aNameRegional, 0); this.mThickNess = aThickNess; this.mMaterial = aMaterial; @@ -69,14 +64,8 @@ public class GregtechMetaPipeEntityBase_Cable extends MetaPipeEntity implements this.mWireHeatingTicks = this.getGT5Var(); } - public GregtechMetaPipeEntityBase_Cable( - final String aName, - final float aThickNess, - final GT_Materials aMaterial, - final long aCableLossPerMeter, - final long aAmperage, - final long aVoltage, - final boolean aInsulated, + public GregtechMetaPipeEntityBase_Cable(final String aName, final float aThickNess, final GT_Materials aMaterial, + final long aCableLossPerMeter, final long aAmperage, final long aVoltage, final boolean aInsulated, final boolean aCanShock) { super(aName, 0); this.mThickNess = aThickNess; @@ -133,77 +122,73 @@ public class GregtechMetaPipeEntityBase_Cable extends MetaPipeEntity implements } @Override - public ITexture[] getTexture( - final IGregTechTileEntity aBaseMetaTileEntity, - final byte aSide, - final byte aConnections, - final byte aColorIndex, - final boolean aConnected, - final boolean aRedstone) { + public ITexture[] getTexture(final IGregTechTileEntity aBaseMetaTileEntity, final byte aSide, + final byte aConnections, final byte aColorIndex, final boolean aConnected, final boolean aRedstone) { if (!this.mInsulated) { - return new ITexture[] { - new GT_RenderedTexture(this.mMaterial.mIconSet.mTextures[TextureSet.INDEX_wire], this.mMaterial.mRGBa) - }; + return new ITexture[] { new GT_RenderedTexture( + this.mMaterial.mIconSet.mTextures[TextureSet.INDEX_wire], + this.mMaterial.mRGBa) }; } if (aConnected) { final float tThickNess = this.getThickNess(); if (tThickNess < 0.37F) { return new ITexture[] { - new GT_RenderedTexture( - this.mMaterial.mIconSet.mTextures[TextureSet.INDEX_wire], this.mMaterial.mRGBa), - new GT_RenderedTexture( - Textures.BlockIcons.INSULATION_TINY, - Dyes.getModulation(aColorIndex, Dyes.CABLE_INSULATION.mRGBa)) - }; + new GT_RenderedTexture( + this.mMaterial.mIconSet.mTextures[TextureSet.INDEX_wire], + this.mMaterial.mRGBa), + new GT_RenderedTexture( + Textures.BlockIcons.INSULATION_TINY, + Dyes.getModulation(aColorIndex, Dyes.CABLE_INSULATION.mRGBa)) }; } if (tThickNess < 0.49F) { return new ITexture[] { - new GT_RenderedTexture( - this.mMaterial.mIconSet.mTextures[TextureSet.INDEX_wire], this.mMaterial.mRGBa), - new GT_RenderedTexture( - Textures.BlockIcons.INSULATION_SMALL, - Dyes.getModulation(aColorIndex, Dyes.CABLE_INSULATION.mRGBa)) - }; + new GT_RenderedTexture( + this.mMaterial.mIconSet.mTextures[TextureSet.INDEX_wire], + this.mMaterial.mRGBa), + new GT_RenderedTexture( + Textures.BlockIcons.INSULATION_SMALL, + Dyes.getModulation(aColorIndex, Dyes.CABLE_INSULATION.mRGBa)) }; } if (tThickNess < 0.74F) { return new ITexture[] { - new GT_RenderedTexture( - this.mMaterial.mIconSet.mTextures[TextureSet.INDEX_wire], this.mMaterial.mRGBa), - new GT_RenderedTexture( - Textures.BlockIcons.INSULATION_MEDIUM, - Dyes.getModulation(aColorIndex, Dyes.CABLE_INSULATION.mRGBa)) - }; + new GT_RenderedTexture( + this.mMaterial.mIconSet.mTextures[TextureSet.INDEX_wire], + this.mMaterial.mRGBa), + new GT_RenderedTexture( + Textures.BlockIcons.INSULATION_MEDIUM, + Dyes.getModulation(aColorIndex, Dyes.CABLE_INSULATION.mRGBa)) }; } if (tThickNess < 0.99F) { return new ITexture[] { - new GT_RenderedTexture( - this.mMaterial.mIconSet.mTextures[TextureSet.INDEX_wire], this.mMaterial.mRGBa), - new GT_RenderedTexture( - Textures.BlockIcons.INSULATION_LARGE, - Dyes.getModulation(aColorIndex, Dyes.CABLE_INSULATION.mRGBa)) - }; + new GT_RenderedTexture( + this.mMaterial.mIconSet.mTextures[TextureSet.INDEX_wire], + this.mMaterial.mRGBa), + new GT_RenderedTexture( + Textures.BlockIcons.INSULATION_LARGE, + Dyes.getModulation(aColorIndex, Dyes.CABLE_INSULATION.mRGBa)) }; } return new ITexture[] { - new GT_RenderedTexture(this.mMaterial.mIconSet.mTextures[TextureSet.INDEX_wire], this.mMaterial.mRGBa), - new GT_RenderedTexture( - Textures.BlockIcons.INSULATION_HUGE, - Dyes.getModulation(aColorIndex, Dyes.CABLE_INSULATION.mRGBa)) - }; + new GT_RenderedTexture( + this.mMaterial.mIconSet.mTextures[TextureSet.INDEX_wire], + this.mMaterial.mRGBa), + new GT_RenderedTexture( + Textures.BlockIcons.INSULATION_HUGE, + Dyes.getModulation(aColorIndex, Dyes.CABLE_INSULATION.mRGBa)) }; } - return new ITexture[] { - new GT_RenderedTexture( - Textures.BlockIcons.INSULATION_FULL, Dyes.getModulation(aColorIndex, Dyes.CABLE_INSULATION.mRGBa)) - }; + return new ITexture[] { new GT_RenderedTexture( + Textures.BlockIcons.INSULATION_FULL, + Dyes.getModulation(aColorIndex, Dyes.CABLE_INSULATION.mRGBa)) }; } @Override - public void onEntityCollidedWithBlock( - final World aWorld, final int aX, final int aY, final int aZ, final Entity aEntity) { - if (this.mCanShock - && ((((BaseMetaPipeEntity) this.getBaseMetaTileEntity()).mConnections & -128) == 0) + public void onEntityCollidedWithBlock(final World aWorld, final int aX, final int aY, final int aZ, + final Entity aEntity) { + if (this.mCanShock && ((((BaseMetaPipeEntity) this.getBaseMetaTileEntity()).mConnections & -128) == 0) && (aEntity instanceof EntityLivingBase)) { GT_Utility.applyElectricityDamage( - (EntityLivingBase) aEntity, this.mTransferredVoltageLast20, this.mTransferredAmperageLast20); + (EntityLivingBase) aEntity, + this.mTransferredVoltageLast20, + this.mTransferredAmperageLast20); } } @@ -212,8 +197,8 @@ public class GregtechMetaPipeEntityBase_Cable extends MetaPipeEntity implements if (!this.mCanShock) { return super.getCollisionBoundingBoxFromPool(aWorld, aX, aY, aZ); } - return AxisAlignedBB.getBoundingBox( - aX + 0.125D, aY + 0.125D, aZ + 0.125D, aX + 0.875D, aY + 0.875D, aZ + 0.875D); + return AxisAlignedBB + .getBoundingBox(aX + 0.125D, aY + 0.125D, aZ + 0.125D, aX + 0.875D, aY + 0.875D, aZ + 0.875D); } @Override @@ -248,21 +233,23 @@ public class GregtechMetaPipeEntityBase_Cable extends MetaPipeEntity implements @Override public long injectEnergyUnits(final byte aSide, final long aVoltage, final long aAmperage) { - if (!this.getBaseMetaTileEntity() - .getCoverBehaviorAtSide(aSide) - .letsEnergyIn( - aSide, - this.getBaseMetaTileEntity().getCoverIDAtSide(aSide), - this.getBaseMetaTileEntity().getCoverDataAtSide(aSide), - this.getBaseMetaTileEntity())) { + if (!this.getBaseMetaTileEntity().getCoverBehaviorAtSide(aSide).letsEnergyIn( + aSide, + this.getBaseMetaTileEntity().getCoverIDAtSide(aSide), + this.getBaseMetaTileEntity().getCoverDataAtSide(aSide), + this.getBaseMetaTileEntity())) { return 0; } return this.transferElectricity( - aSide, aVoltage, aAmperage, new ArrayList<>(Arrays.asList((TileEntity) this.getBaseMetaTileEntity()))); + aSide, + aVoltage, + aAmperage, + new ArrayList<>(Arrays.asList((TileEntity) this.getBaseMetaTileEntity()))); } /** - * Adds support for the newer function added by https://github.com/Blood-Asp/GT5-Unofficial/commit/73ee102b63efd92c0f164a7ed7a79ebcd2619617#diff-3051838621d8ae87aa5ccd1345e1f07d + * Adds support for the newer function added by + * https://github.com/Blood-Asp/GT5-Unofficial/commit/73ee102b63efd92c0f164a7ed7a79ebcd2619617#diff-3051838621d8ae87aa5ccd1345e1f07d */ public long transferElectricity(byte arg0, long arg1, long arg2, HashSet<TileEntity> arg3) { ArrayList<TileEntity> aTiles = new ArrayList<TileEntity>(); @@ -273,42 +260,33 @@ public class GregtechMetaPipeEntityBase_Cable extends MetaPipeEntity implements } @Override - public long transferElectricity( - final byte aSide, - long aVoltage, - final long aAmperage, + public long transferElectricity(final byte aSide, long aVoltage, final long aAmperage, final ArrayList<TileEntity> aAlreadyPassedTileEntityList) { long rUsedAmperes = 0; aVoltage -= this.mCableLossPerMeter; if (aVoltage > 0) { for (byte i = 0; (i < 6) && (aAmperage > rUsedAmperes); i++) { - if ((i != aSide) - && ((this.mConnections & (1 << i)) != 0) - && this.getBaseMetaTileEntity() - .getCoverBehaviorAtSide(i) - .letsEnergyOut( - i, - this.getBaseMetaTileEntity().getCoverIDAtSide(i), - this.getBaseMetaTileEntity().getCoverDataAtSide(i), - this.getBaseMetaTileEntity())) { + if ((i != aSide) && ((this.mConnections & (1 << i)) != 0) + && this.getBaseMetaTileEntity().getCoverBehaviorAtSide(i).letsEnergyOut( + i, + this.getBaseMetaTileEntity().getCoverIDAtSide(i), + this.getBaseMetaTileEntity().getCoverDataAtSide(i), + this.getBaseMetaTileEntity())) { final TileEntity tTileEntity = this.getBaseMetaTileEntity().getTileEntityAtSide(i); if (!aAlreadyPassedTileEntityList.contains(tTileEntity)) { aAlreadyPassedTileEntityList.add(tTileEntity); if (tTileEntity instanceof IEnergyConnected) { if (this.getBaseMetaTileEntity().getColorization() >= 0) { final byte tColor = ((IEnergyConnected) tTileEntity).getColorization(); - if ((tColor >= 0) - && (tColor - != this.getBaseMetaTileEntity().getColorization())) { + if ((tColor >= 0) && (tColor != this.getBaseMetaTileEntity().getColorization())) { continue; } } if ((tTileEntity instanceof IGregTechTileEntity) - && (((IGregTechTileEntity) tTileEntity).getMetaTileEntity() - instanceof IMetaTileEntityCable) + && (((IGregTechTileEntity) tTileEntity) + .getMetaTileEntity() instanceof IMetaTileEntityCable) && ((IGregTechTileEntity) tTileEntity) - .getCoverBehaviorAtSide(GT_Utility.getOppositeSide(i)) - .letsEnergyIn( + .getCoverBehaviorAtSide(GT_Utility.getOppositeSide(i)).letsEnergyIn( GT_Utility.getOppositeSide(i), ((IGregTechTileEntity) tTileEntity) .getCoverIDAtSide(GT_Utility.getOppositeSide(i)), @@ -316,18 +294,18 @@ public class GregtechMetaPipeEntityBase_Cable extends MetaPipeEntity implements .getCoverDataAtSide(GT_Utility.getOppositeSide(i)), ((IGregTechTileEntity) tTileEntity))) { if (((IGregTechTileEntity) tTileEntity).getTimer() > 50) { - rUsedAmperes += ((IMetaTileEntityCable) - ((IGregTechTileEntity) tTileEntity).getMetaTileEntity()) - .transferElectricity( + rUsedAmperes += ((IMetaTileEntityCable) ((IGregTechTileEntity) tTileEntity) + .getMetaTileEntity()).transferElectricity( GT_Utility.getOppositeSide(i), aVoltage, aAmperage - rUsedAmperes, aAlreadyPassedTileEntityList); } } else { - rUsedAmperes += ((IEnergyConnected) tTileEntity) - .injectEnergyUnits( - GT_Utility.getOppositeSide(i), aVoltage, aAmperage - rUsedAmperes); + rUsedAmperes += ((IEnergyConnected) tTileEntity).injectEnergyUnits( + GT_Utility.getOppositeSide(i), + aVoltage, + aAmperage - rUsedAmperes); } // } else if (tTileEntity instanceof IEnergySink) { // ForgeDirection tDirection = @@ -342,8 +320,7 @@ public class GregtechMetaPipeEntityBase_Cable extends MetaPipeEntity implements // aVoltage) < aVoltage) rUsedAmperes++; // } } else if (tTileEntity instanceof IEnergySink) { - final ForgeDirection tDirection = - ForgeDirection.getOrientation(i).getOpposite(); + final ForgeDirection tDirection = ForgeDirection.getOrientation(i).getOpposite(); if (((IEnergySink) tTileEntity) .acceptsEnergyFrom((TileEntity) this.getBaseMetaTileEntity(), tDirection)) { if ((((IEnergySink) tTileEntity).getDemandedEnergy() > 0) @@ -353,16 +330,15 @@ public class GregtechMetaPipeEntityBase_Cable extends MetaPipeEntity implements } } } 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 = (int) ((aVoltage * GregTech_API.mEUtoRF) / 100); if (((IEnergyReceiver) tTileEntity).receiveEnergy(tDirection, rfOut, true) == rfOut) { ((IEnergyReceiver) tTileEntity).receiveEnergy(tDirection, rfOut, false); rUsedAmperes++; } else if (((IEnergyReceiver) tTileEntity).receiveEnergy(tDirection, rfOut, true) > 0) { if (this.mRestRF == 0) { - final int RFtrans = - ((IEnergyReceiver) tTileEntity).receiveEnergy(tDirection, rfOut, false); + final int RFtrans = ((IEnergyReceiver) tTileEntity) + .receiveEnergy(tDirection, rfOut, false); rUsedAmperes++; this.mRestRF = rfOut - RFtrans; } else { @@ -422,27 +398,21 @@ public class GregtechMetaPipeEntityBase_Cable extends MetaPipeEntity implements this.mConnections = 0; for (byte i = 0, j = 0; i < 6; i++) { j = GT_Utility.getOppositeSide(i); - if (aBaseMetaTileEntity - .getCoverBehaviorAtSide(i) - .alwaysLookConnected( - i, - aBaseMetaTileEntity.getCoverIDAtSide(i), - aBaseMetaTileEntity.getCoverDataAtSide(i), - aBaseMetaTileEntity) - || aBaseMetaTileEntity - .getCoverBehaviorAtSide(i) - .letsEnergyIn( - i, - aBaseMetaTileEntity.getCoverIDAtSide(i), - aBaseMetaTileEntity.getCoverDataAtSide(i), - aBaseMetaTileEntity) - || aBaseMetaTileEntity - .getCoverBehaviorAtSide(i) - .letsEnergyOut( - i, - aBaseMetaTileEntity.getCoverIDAtSide(i), - aBaseMetaTileEntity.getCoverDataAtSide(i), - aBaseMetaTileEntity)) { + if (aBaseMetaTileEntity.getCoverBehaviorAtSide(i).alwaysLookConnected( + i, + aBaseMetaTileEntity.getCoverIDAtSide(i), + aBaseMetaTileEntity.getCoverDataAtSide(i), + aBaseMetaTileEntity) + || aBaseMetaTileEntity.getCoverBehaviorAtSide(i).letsEnergyIn( + i, + aBaseMetaTileEntity.getCoverIDAtSide(i), + aBaseMetaTileEntity.getCoverDataAtSide(i), + aBaseMetaTileEntity) + || aBaseMetaTileEntity.getCoverBehaviorAtSide(i).letsEnergyOut( + i, + aBaseMetaTileEntity.getCoverIDAtSide(i), + aBaseMetaTileEntity.getCoverDataAtSide(i), + aBaseMetaTileEntity)) { final TileEntity tTileEntity = aBaseMetaTileEntity.getTileEntityAtSide(i); if (tTileEntity instanceof IColoredTileEntity) { if (aBaseMetaTileEntity.getColorization() >= 0) { @@ -458,53 +428,42 @@ public class GregtechMetaPipeEntityBase_Cable extends MetaPipeEntity implements this.mConnections |= (1 << i); continue; } - if ((tTileEntity instanceof IGregTechTileEntity) - && (((IGregTechTileEntity) tTileEntity).getMetaTileEntity() - instanceof IMetaTileEntityCable)) { - if (((IGregTechTileEntity) tTileEntity) - .getCoverBehaviorAtSide(j) - .alwaysLookConnected( - j, - ((IGregTechTileEntity) tTileEntity).getCoverIDAtSide(j), - ((IGregTechTileEntity) tTileEntity).getCoverDataAtSide(j), - ((IGregTechTileEntity) tTileEntity)) - || ((IGregTechTileEntity) tTileEntity) - .getCoverBehaviorAtSide(j) - .letsEnergyIn( - j, - ((IGregTechTileEntity) tTileEntity).getCoverIDAtSide(j), - ((IGregTechTileEntity) tTileEntity).getCoverDataAtSide(j), - ((IGregTechTileEntity) tTileEntity)) - || ((IGregTechTileEntity) tTileEntity) - .getCoverBehaviorAtSide(j) - .letsEnergyOut( - j, - ((IGregTechTileEntity) tTileEntity).getCoverIDAtSide(j), - ((IGregTechTileEntity) tTileEntity).getCoverDataAtSide(j), - ((IGregTechTileEntity) tTileEntity))) { + if ((tTileEntity instanceof IGregTechTileEntity) && (((IGregTechTileEntity) tTileEntity) + .getMetaTileEntity() instanceof IMetaTileEntityCable)) { + if (((IGregTechTileEntity) tTileEntity).getCoverBehaviorAtSide(j).alwaysLookConnected( + j, + ((IGregTechTileEntity) tTileEntity).getCoverIDAtSide(j), + ((IGregTechTileEntity) tTileEntity).getCoverDataAtSide(j), + ((IGregTechTileEntity) tTileEntity)) + || ((IGregTechTileEntity) tTileEntity).getCoverBehaviorAtSide(j).letsEnergyIn( + j, + ((IGregTechTileEntity) tTileEntity).getCoverIDAtSide(j), + ((IGregTechTileEntity) tTileEntity).getCoverDataAtSide(j), + ((IGregTechTileEntity) tTileEntity)) + || ((IGregTechTileEntity) tTileEntity).getCoverBehaviorAtSide(j).letsEnergyOut( + j, + ((IGregTechTileEntity) tTileEntity).getCoverIDAtSide(j), + ((IGregTechTileEntity) tTileEntity).getCoverDataAtSide(j), + ((IGregTechTileEntity) tTileEntity))) { this.mConnections |= (1 << i); continue; } } - if ((tTileEntity instanceof IEnergySink) - && ((IEnergySink) tTileEntity) - .acceptsEnergyFrom( - (TileEntity) aBaseMetaTileEntity, ForgeDirection.getOrientation(j))) { + if ((tTileEntity instanceof IEnergySink) && ((IEnergySink) tTileEntity).acceptsEnergyFrom( + (TileEntity) aBaseMetaTileEntity, + ForgeDirection.getOrientation(j))) { this.mConnections |= (1 << i); continue; } - if (GregTech_API.mOutputRF - && (tTileEntity instanceof IEnergyReceiver) + if (GregTech_API.mOutputRF && (tTileEntity instanceof IEnergyReceiver) && ((IEnergyReceiver) tTileEntity).canConnectEnergy(ForgeDirection.getOrientation(j))) { this.mConnections |= (1 << i); continue; } /* - * if (tTileEntity instanceof IEnergyEmitter && - * ((IEnergyEmitter)tTileEntity).emitsEnergyTo(( - * TileEntity)aBaseMetaTileEntity, - * ForgeDirection.getOrientation(j))) { mConnections |= - * (1<<i); continue; } + * if (tTileEntity instanceof IEnergyEmitter && ((IEnergyEmitter)tTileEntity).emitsEnergyTo(( + * TileEntity)aBaseMetaTileEntity, ForgeDirection.getOrientation(j))) { mConnections |= (1<<i); + * continue; } */ } } @@ -513,26 +472,31 @@ public class GregtechMetaPipeEntityBase_Cable extends MetaPipeEntity implements } @Override - public boolean allowPullStack( - final IGregTechTileEntity aBaseMetaTileEntity, final int aIndex, final byte aSide, final ItemStack aStack) { + public boolean allowPullStack(final IGregTechTileEntity aBaseMetaTileEntity, final int aIndex, final byte aSide, + final ItemStack aStack) { return false; } @Override - public boolean allowPutStack( - final IGregTechTileEntity aBaseMetaTileEntity, final int aIndex, final byte aSide, final ItemStack aStack) { + public boolean allowPutStack(final IGregTechTileEntity aBaseMetaTileEntity, final int aIndex, final byte aSide, + final ItemStack aStack) { return false; } @Override public String[] getDescription() { return new String[] { - "Max Voltage: " + EnumChatFormatting.GREEN + this.mVoltage + " (" + VN[GT_Utility.getTier(this.mVoltage)] - + ")" + EnumChatFormatting.GRAY, - "Max Amperage: " + EnumChatFormatting.YELLOW + this.mAmperage + EnumChatFormatting.GRAY, - "Loss/Meter/Ampere: " + EnumChatFormatting.RED + this.mCableLossPerMeter + EnumChatFormatting.GRAY - + " EU-Volt" - }; + "Max Voltage: " + EnumChatFormatting.GREEN + + this.mVoltage + + " (" + + VN[GT_Utility.getTier(this.mVoltage)] + + ")" + + EnumChatFormatting.GRAY, + "Max Amperage: " + EnumChatFormatting.YELLOW + this.mAmperage + EnumChatFormatting.GRAY, + "Loss/Meter/Ampere: " + EnumChatFormatting.RED + + this.mCableLossPerMeter + + EnumChatFormatting.GRAY + + " EU-Volt" }; } @Override diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/base/GregtechMetaTileEntity.java b/src/main/java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/base/GregtechMetaTileEntity.java index 41f434f7e6..b727c0d84a 100644 --- a/src/main/java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/base/GregtechMetaTileEntity.java +++ b/src/main/java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/base/GregtechMetaTileEntity.java @@ -6,6 +6,7 @@ import gregtech.api.interfaces.ITexture; import gregtech.api.metatileentity.MetaTileEntity; public abstract class GregtechMetaTileEntity extends MetaTileEntity { + /** * Value between [0 - 9] to describe the Tier of this Machine. */ @@ -21,14 +22,8 @@ public abstract class GregtechMetaTileEntity extends MetaTileEntity { */ public final ITexture[][][] mTextures; - public GregtechMetaTileEntity( - final int aID, - final String aName, - final String aNameRegional, - final int aTier, - final int aInvSlotCount, - final String aDescription, - final ITexture... aTextures) { + public GregtechMetaTileEntity(final int aID, final String aName, final String aNameRegional, final int aTier, + final int aInvSlotCount, final String aDescription, final ITexture... aTextures) { super(aID, aName, aNameRegional, aInvSlotCount); this.mTier = (byte) Math.max(0, Math.min(aTier, 9)); this.mDescription = aDescription; @@ -41,12 +36,8 @@ public abstract class GregtechMetaTileEntity extends MetaTileEntity { } } - public GregtechMetaTileEntity( - final String aName, - final int aTier, - final int aInvSlotCount, - final String aDescription, - final ITexture[][][] aTextures) { + public GregtechMetaTileEntity(final String aName, final int aTier, final int aInvSlotCount, + final String aDescription, final ITexture[][][] aTextures) { super(aName, aInvSlotCount); this.mTier = (byte) aTier; this.mDescription = aDescription; @@ -70,15 +61,14 @@ public abstract class GregtechMetaTileEntity extends MetaTileEntity { @Override public String[] getDescription() { - return new String[] {this.mDescription}; + return new String[] { this.mDescription }; } /** - * 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. + * @param aTextures is the optional Array you can give to the Constructor. */ public abstract ITexture[][][] getTextureSet(ITexture[] aTextures); } diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/base/GregtechMetaTransformerHiAmp.java b/src/main/java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/base/GregtechMetaTransformerHiAmp.java index e900aac944..f881f6f5f2 100644 --- a/src/main/java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/base/GregtechMetaTransformerHiAmp.java +++ b/src/main/java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/base/GregtechMetaTransformerHiAmp.java @@ -1,5 +1,8 @@ package gtPlusPlus.xmod.gregtech.api.metatileentity.implementations.base; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.nbt.NBTTagCompound; + import gregtech.api.enums.Textures; import gregtech.api.interfaces.ITexture; import gregtech.api.interfaces.metatileentity.IMetaTileEntity; @@ -8,8 +11,6 @@ import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Transformer import gtPlusPlus.core.lib.CORE; import gtPlusPlus.core.util.Utils; import gtPlusPlus.core.util.minecraft.PlayerUtils; -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.nbt.NBTTagCompound; public class GregtechMetaTransformerHiAmp extends GT_MetaTileEntity_Transformer { @@ -48,48 +49,30 @@ public class GregtechMetaTransformerHiAmp extends GT_MetaTileEntity_Transformer 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 + 1] - }; - rTextures[4][i + 1] = new ITexture[] { - Textures.BlockIcons.MACHINE_CASINGS[mTier][i + 1], - Textures.BlockIcons.OVERLAYS_ENERGY_IN_MULTI[mTier + 1] - }; - rTextures[5][i + 1] = new ITexture[] { - Textures.BlockIcons.MACHINE_CASINGS[mTier][i + 1], - Textures.BlockIcons.OVERLAYS_ENERGY_IN_MULTI[mTier + 1] - }; - 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 + 1] - }; - rTextures[10][i + 1] = new ITexture[] { - Textures.BlockIcons.MACHINE_CASINGS[mTier][i + 1], - Textures.BlockIcons.OVERLAYS_ENERGY_OUT_MULTI[mTier + 1] - }; - rTextures[11][i + 1] = new ITexture[] { - Textures.BlockIcons.MACHINE_CASINGS[mTier][i + 1], - Textures.BlockIcons.OVERLAYS_ENERGY_OUT_MULTI[mTier + 1] - }; + 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 + 1] }; + rTextures[4][i + 1] = new ITexture[] { Textures.BlockIcons.MACHINE_CASINGS[mTier][i + 1], + Textures.BlockIcons.OVERLAYS_ENERGY_IN_MULTI[mTier + 1] }; + rTextures[5][i + 1] = new ITexture[] { Textures.BlockIcons.MACHINE_CASINGS[mTier][i + 1], + Textures.BlockIcons.OVERLAYS_ENERGY_IN_MULTI[mTier + 1] }; + 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 + 1] }; + rTextures[10][i + 1] = new ITexture[] { Textures.BlockIcons.MACHINE_CASINGS[mTier][i + 1], + Textures.BlockIcons.OVERLAYS_ENERGY_OUT_MULTI[mTier + 1] }; + rTextures[11][i + 1] = new ITexture[] { Textures.BlockIcons.MACHINE_CASINGS[mTier][i + 1], + Textures.BlockIcons.OVERLAYS_ENERGY_OUT_MULTI[mTier + 1] }; } return rTextures; } @@ -101,9 +84,8 @@ public class GregtechMetaTransformerHiAmp extends GT_MetaTileEntity_Transformer @Override public String[] getDescription() { - return new String[] { - this.mDescription, "Accepts 4A and outputs 16A", "Toggle 2A/8A half-mode with Screwdriver", CORE.GT_Tooltip - }; + return new String[] { this.mDescription, "Accepts 4A and outputs 16A", + "Toggle 2A/8A half-mode with Screwdriver", CORE.GT_Tooltip }; } @Override diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/base/GregtechMeta_MultiBlockBase.java b/src/main/java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/base/GregtechMeta_MultiBlockBase.java index 5f13bbaf09..84641bd357 100644 --- a/src/main/java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/base/GregtechMeta_MultiBlockBase.java +++ b/src/main/java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/base/GregtechMeta_MultiBlockBase.java @@ -1,5 +1,30 @@ package gtPlusPlus.xmod.gregtech.api.metatileentity.implementations.base; +import java.lang.reflect.InvocationTargetException; +import java.lang.reflect.Method; +import java.util.*; +import java.util.Map.Entry; +import java.util.concurrent.ConcurrentHashMap; +import java.util.concurrent.TimeUnit; +import java.util.function.BiConsumer; +import java.util.function.BiPredicate; +import java.util.function.Function; +import java.util.stream.Collectors; + +import javax.annotation.Nullable; + +import net.minecraft.block.Block; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.item.Item; +import net.minecraft.item.ItemStack; +import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.util.ChatComponentTranslation; +import net.minecraft.util.EnumChatFormatting; +import net.minecraft.util.StatCollector; +import net.minecraft.world.World; +import net.minecraftforge.fluids.FluidStack; +import net.minecraftforge.oredict.OreDictionary; + import com.gtnewhorizon.structurelib.StructureLibAPI; import com.gtnewhorizon.structurelib.structure.AutoPlaceEnvironment; import com.gtnewhorizon.structurelib.structure.IStructureElement; @@ -11,6 +36,7 @@ import com.gtnewhorizons.modularui.common.widget.DrawableWidget; import com.gtnewhorizons.modularui.common.widget.DynamicPositionedColumn; import com.gtnewhorizons.modularui.common.widget.FakeSyncWidget; import com.gtnewhorizons.modularui.common.widget.TextWidget; + import gregtech.api.GregTech_API; import gregtech.api.enums.GT_Values; import gregtech.api.enums.Materials; @@ -52,28 +78,6 @@ import gtPlusPlus.core.util.reflect.ReflectionUtils; import gtPlusPlus.preloader.CORE_Preloader; import gtPlusPlus.preloader.asm.AsmConfig; import gtPlusPlus.xmod.gregtech.api.metatileentity.implementations.*; -import java.lang.reflect.InvocationTargetException; -import java.lang.reflect.Method; -import java.util.*; -import java.util.Map.Entry; -import java.util.concurrent.ConcurrentHashMap; -import java.util.concurrent.TimeUnit; -import java.util.function.BiConsumer; -import java.util.function.BiPredicate; -import java.util.function.Function; -import java.util.stream.Collectors; -import javax.annotation.Nullable; -import net.minecraft.block.Block; -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.item.Item; -import net.minecraft.item.ItemStack; -import net.minecraft.nbt.NBTTagCompound; -import net.minecraft.util.ChatComponentTranslation; -import net.minecraft.util.EnumChatFormatting; -import net.minecraft.util.StatCollector; -import net.minecraft.world.World; -import net.minecraftforge.fluids.FluidStack; -import net.minecraftforge.oredict.OreDictionary; // Glee8e - 11/12/21 - 2:15pm // Yeah, now I see what's wrong. Someone inherited from GregtechMeta_MultiBlockBase instead of @@ -112,10 +116,9 @@ public abstract class GregtechMeta_MultiBlockBase<T extends GT_MetaTileEntity_Ex Logger.MACHINE_INFO("Found .09 findRecipe method? " + (a09 != null)); try { - calculatePollutionReduction = - GT_MetaTileEntity_Hatch_Muffler.class.getDeclaredMethod("calculatePollutionReduction", int.class); - } catch (NoSuchMethodException | SecurityException e) { - } + calculatePollutionReduction = GT_MetaTileEntity_Hatch_Muffler.class + .getDeclaredMethod("calculatePollutionReduction", int.class); + } catch (NoSuchMethodException | SecurityException e) {} } // Find Recipe Methods @@ -207,76 +210,145 @@ public abstract class GregtechMeta_MultiBlockBase<T extends GT_MetaTileEntity_Ex // Lets borrow the GTNH handling - mInfo.add(StatCollector.translateToLocal("GTPP.multiblock.progress") + ": " + EnumChatFormatting.GREEN - + Integer.toString(mProgresstime / 20) + EnumChatFormatting.RESET + " s / " - + EnumChatFormatting.YELLOW - + Integer.toString(mMaxProgresstime / 20) + EnumChatFormatting.RESET + " s"); + mInfo.add( + StatCollector.translateToLocal("GTPP.multiblock.progress") + ": " + + EnumChatFormatting.GREEN + + Integer.toString(mProgresstime / 20) + + EnumChatFormatting.RESET + + " s / " + + EnumChatFormatting.YELLOW + + Integer.toString(mMaxProgresstime / 20) + + EnumChatFormatting.RESET + + " s"); if (!this.mAllEnergyHatches.isEmpty()) { long storedEnergy = getStoredEnergyInAllEnergyHatches(); long maxEnergy = getMaxEnergyStorageOfAllEnergyHatches(); mInfo.add(StatCollector.translateToLocal("GTPP.multiblock.energy") + ":"); - mInfo.add(StatCollector.translateToLocal("" + EnumChatFormatting.GREEN + Long.toString(storedEnergy) - + EnumChatFormatting.RESET + " EU / " + EnumChatFormatting.YELLOW + Long.toString(maxEnergy) - + EnumChatFormatting.RESET + " EU")); + mInfo.add( + StatCollector.translateToLocal( + "" + EnumChatFormatting.GREEN + + Long.toString(storedEnergy) + + EnumChatFormatting.RESET + + " EU / " + + EnumChatFormatting.YELLOW + + Long.toString(maxEnergy) + + EnumChatFormatting.RESET + + " EU")); mInfo.add(StatCollector.translateToLocal("GTPP.multiblock.mei") + ":"); - mInfo.add(StatCollector.translateToLocal("" + EnumChatFormatting.YELLOW - + Long.toString(getMaxInputVoltage()) + EnumChatFormatting.RESET + " EU/t(*2A) " - + StatCollector.translateToLocal("GTPP.machines.tier") + ": " + EnumChatFormatting.YELLOW - + GT_Values.VN[GT_Utility.getTier(getMaxInputVoltage())] + EnumChatFormatting.RESET)); - ; + mInfo.add( + StatCollector.translateToLocal( + "" + EnumChatFormatting.YELLOW + + Long.toString(getMaxInputVoltage()) + + EnumChatFormatting.RESET + + " EU/t(*2A) " + + StatCollector.translateToLocal("GTPP.machines.tier") + + ": " + + EnumChatFormatting.YELLOW + + GT_Values.VN[GT_Utility.getTier(getMaxInputVoltage())] + + EnumChatFormatting.RESET));; } if (!this.mAllDynamoHatches.isEmpty()) { long storedEnergy = getStoredEnergyInAllDynamoHatches(); long maxEnergy = getMaxEnergyStorageOfAllDynamoHatches(); mInfo.add(StatCollector.translateToLocal("GTPP.multiblock.energy") + " In Dynamos:"); - mInfo.add(StatCollector.translateToLocal("" + EnumChatFormatting.GREEN + Long.toString(storedEnergy) - + EnumChatFormatting.RESET + " EU / " + EnumChatFormatting.YELLOW + Long.toString(maxEnergy) - + EnumChatFormatting.RESET + " EU")); + mInfo.add( + StatCollector.translateToLocal( + "" + EnumChatFormatting.GREEN + + Long.toString(storedEnergy) + + EnumChatFormatting.RESET + + " EU / " + + EnumChatFormatting.YELLOW + + Long.toString(maxEnergy) + + EnumChatFormatting.RESET + + " EU")); } if (-lEUt > 0) { mInfo.add(StatCollector.translateToLocal("GTPP.multiblock.usage") + ":"); - mInfo.add(StatCollector.translateToLocal( - "" + EnumChatFormatting.RED + (-lEUt) + EnumChatFormatting.RESET + " EU/t")); + mInfo.add( + StatCollector.translateToLocal( + "" + EnumChatFormatting.RED + (-lEUt) + EnumChatFormatting.RESET + " EU/t")); } else { mInfo.add(StatCollector.translateToLocal("GTPP.multiblock.generation") + ":"); - mInfo.add(StatCollector.translateToLocal( - "" + EnumChatFormatting.GREEN + lEUt + EnumChatFormatting.RESET + " EU/t")); - } - - mInfo.add(StatCollector.translateToLocal("GTPP.multiblock.problems") + ": " + EnumChatFormatting.RED - + (getIdealStatus() - getRepairStatus()) + EnumChatFormatting.RESET + " " - + StatCollector.translateToLocal("GTPP.multiblock.efficiency") + ": " + EnumChatFormatting.YELLOW - + Float.toString(mEfficiency / 100.0F) + EnumChatFormatting.RESET + " %"); + mInfo.add( + StatCollector.translateToLocal( + "" + EnumChatFormatting.GREEN + lEUt + EnumChatFormatting.RESET + " EU/t")); + } + + mInfo.add( + StatCollector.translateToLocal("GTPP.multiblock.problems") + ": " + + EnumChatFormatting.RED + + (getIdealStatus() - getRepairStatus()) + + EnumChatFormatting.RESET + + " " + + StatCollector.translateToLocal("GTPP.multiblock.efficiency") + + ": " + + EnumChatFormatting.YELLOW + + Float.toString(mEfficiency / 100.0F) + + EnumChatFormatting.RESET + + " %"); if (this.getPollutionPerSecond(null) > 0) { int mPollutionReduction = getPollutionReductionForAllMufflers(); - mInfo.add(StatCollector.translateToLocal("GTPP.multiblock.pollution") + ": " + EnumChatFormatting.RED - + this.getPollutionPerSecond(null) + EnumChatFormatting.RESET + "/sec"); - mInfo.add(StatCollector.translateToLocal("GTPP.multiblock.pollutionreduced") + ": " - + EnumChatFormatting.GREEN + mPollutionReduction + EnumChatFormatting.RESET + " %"); + mInfo.add( + StatCollector.translateToLocal("GTPP.multiblock.pollution") + ": " + + EnumChatFormatting.RED + + this.getPollutionPerSecond(null) + + EnumChatFormatting.RESET + + "/sec"); + mInfo.add( + StatCollector.translateToLocal("GTPP.multiblock.pollutionreduced") + ": " + + EnumChatFormatting.GREEN + + mPollutionReduction + + EnumChatFormatting.RESET + + " %"); } if (this.mControlCoreBus.size() > 0) { int tTier = this.getControlCoreTier(); - mInfo.add(StatCollector.translateToLocal("GTPP.CC.machinetier") + ": " + EnumChatFormatting.GREEN + tTier - + EnumChatFormatting.RESET); - } - - mInfo.add(StatCollector.translateToLocal("GTPP.CC.discount") + ": " + EnumChatFormatting.GREEN - + (getEuDiscountForParallelism()) + EnumChatFormatting.RESET + "%"); - - mInfo.add(StatCollector.translateToLocal("GTPP.CC.parallel") + ": " + EnumChatFormatting.GREEN - + (getMaxParallelRecipes()) + EnumChatFormatting.RESET); - - mInfo.add("Total Time Since Built: " + EnumChatFormatting.DARK_GREEN + Integer.toString(weeks) - + EnumChatFormatting.RESET + " Weeks, " + EnumChatFormatting.DARK_GREEN + Integer.toString(days) - + EnumChatFormatting.RESET + " Days, "); - mInfo.add(EnumChatFormatting.DARK_GREEN + Long.toString(hours) + EnumChatFormatting.RESET + " Hours, " - + EnumChatFormatting.DARK_GREEN + Long.toString(minutes) + EnumChatFormatting.RESET + " Minutes, " - + EnumChatFormatting.DARK_GREEN + Long.toString(second) + EnumChatFormatting.RESET + " Seconds."); + mInfo.add( + StatCollector.translateToLocal("GTPP.CC.machinetier") + ": " + + EnumChatFormatting.GREEN + + tTier + + EnumChatFormatting.RESET); + } + + mInfo.add( + StatCollector.translateToLocal("GTPP.CC.discount") + ": " + + EnumChatFormatting.GREEN + + (getEuDiscountForParallelism()) + + EnumChatFormatting.RESET + + "%"); + + mInfo.add( + StatCollector.translateToLocal("GTPP.CC.parallel") + ": " + + EnumChatFormatting.GREEN + + (getMaxParallelRecipes()) + + EnumChatFormatting.RESET); + + mInfo.add( + "Total Time Since Built: " + EnumChatFormatting.DARK_GREEN + + Integer.toString(weeks) + + EnumChatFormatting.RESET + + " Weeks, " + + EnumChatFormatting.DARK_GREEN + + Integer.toString(days) + + EnumChatFormatting.RESET + + " Days, "); + mInfo.add( + EnumChatFormatting.DARK_GREEN + Long.toString(hours) + + EnumChatFormatting.RESET + + " Hours, " + + EnumChatFormatting.DARK_GREEN + + Long.toString(minutes) + + EnumChatFormatting.RESET + + " Minutes, " + + EnumChatFormatting.DARK_GREEN + + Long.toString(second) + + EnumChatFormatting.RESET + + " Seconds."); mInfo.add("Total Time in ticks: " + EnumChatFormatting.DARK_GREEN + Long.toString(this.mTotalRunTime)); String[] mInfo2 = mInfo.toArray(new String[mInfo.size()]); @@ -340,9 +412,10 @@ public abstract class GregtechMeta_MultiBlockBase<T extends GT_MetaTileEntity_Ex private String[] aCachedToolTip; - /*private final String aRequiresMuffler = "1x Muffler Hatch"; - private final String aRequiresCoreModule = "1x Core Module"; - private final String aRequiresMaint = "1x Maintanence Hatch";*/ + /* + * private final String aRequiresMuffler = "1x Muffler Hatch"; private final String aRequiresCoreModule = + * "1x Core Module"; private final String aRequiresMaint = "1x Maintanence Hatch"; + */ public static final String TAG_HIDE_HATCHES = "TAG_HIDE_HATCHES"; public static final String TAG_HIDE_MAINT = "TAG_HIDE_MAINT"; @@ -411,22 +484,23 @@ public abstract class GregtechMeta_MultiBlockBase<T extends GT_MetaTileEntity_Ex return checkRecipeGeneric(aMaxParallelRecipes, aEUPercent, aSpeedBonusPercent, 10000); } - public boolean checkRecipeGeneric( - int aMaxParallelRecipes, long aEUPercent, int aSpeedBonusPercent, int aOutputChanceRoll) { + public boolean checkRecipeGeneric(int aMaxParallelRecipes, long aEUPercent, int aSpeedBonusPercent, + int aOutputChanceRoll) { ArrayList<ItemStack> tItems = getStoredInputs(); ArrayList<FluidStack> tFluids = getStoredFluids(); ItemStack[] tItemInputs = tItems.toArray(new ItemStack[tItems.size()]); FluidStack[] tFluidInputs = tFluids.toArray(new FluidStack[tFluids.size()]); return checkRecipeGeneric( - tItemInputs, tFluidInputs, aMaxParallelRecipes, aEUPercent, aSpeedBonusPercent, aOutputChanceRoll); + tItemInputs, + tFluidInputs, + aMaxParallelRecipes, + aEUPercent, + aSpeedBonusPercent, + aOutputChanceRoll); } - public boolean checkRecipeGeneric( - GT_Recipe aRecipe, - int aMaxParallelRecipes, - long aEUPercent, - int aSpeedBonusPercent, - int aOutputChanceRoll) { + public boolean checkRecipeGeneric(GT_Recipe aRecipe, int aMaxParallelRecipes, long aEUPercent, + int aSpeedBonusPercent, int aOutputChanceRoll) { if (aRecipe == null) { return false; } @@ -444,13 +518,8 @@ public abstract class GregtechMeta_MultiBlockBase<T extends GT_MetaTileEntity_Ex aRecipe); } - public boolean checkRecipeGeneric( - ItemStack[] aItemInputs, - FluidStack[] aFluidInputs, - int aMaxParallelRecipes, - long aEUPercent, - int aSpeedBonusPercent, - int aOutputChanceRoll) { + public boolean checkRecipeGeneric(ItemStack[] aItemInputs, FluidStack[] aFluidInputs, int aMaxParallelRecipes, + long aEUPercent, int aSpeedBonusPercent, int aOutputChanceRoll) { return checkRecipeGeneric( aItemInputs, aFluidInputs, @@ -462,152 +531,69 @@ public abstract class GregtechMeta_MultiBlockBase<T extends GT_MetaTileEntity_Ex } /* - * public boolean checkRecipeGeneric( ItemStack[] aItemInputs, FluidStack[] - * aFluidInputs, int aMaxParallelRecipes, int aEUPercent, int - * aSpeedBonusPercent, int aOutputChanceRoll, GT_Recipe aRecipe) { // Based on - * the Processing Array. A bit overkill, but very flexible. - * - * - * if (this.doesMachineBoostOutput()) { log("Boosting."); return - * checkRecipeBoostedOutputs(aItemInputs, aFluidInputs, aMaxParallelRecipes, - * aEUPercent, aSpeedBonusPercent, aOutputChanceRoll, aRecipe); } - * - * - * //Control Core to control the Multiblocks behaviour. int aControlCoreTier = - * getControlCoreTier(); - * - * //If no core, return false; if (aControlCoreTier > 0) { - * log("Control core found."); } - * - * - * // Reset outputs and progress stats this.lEUt = 0; this.mMaxProgresstime = 0; - * this.mOutputItems = new ItemStack[]{}; this.mOutputFluids = new - * FluidStack[]{}; - * - * long tVoltage = getMaxInputVoltage(); byte tTier = (byte) Math.max(1, - * GT_Utility.getTier(tVoltage)); log("Running checkRecipeGeneric(0)"); - * - * //Check to see if Voltage Tier > Control Core Tier if (tTier > - * aControlCoreTier) { - * log("Control core found is lower tier than power tier. OK"); tTier = (byte) - * aControlCoreTier; } - * - * tTier = (byte) MathUtils.getValueWithinRange(tTier, 0, 9); - * - * GT_Recipe tRecipe = aRecipe != null ? aRecipe : findRecipe( - * getBaseMetaTileEntity(), mLastRecipe, false, - * gregtech.api.enums.GT_Values.V[tTier], aFluidInputs, aItemInputs); - * - * log("Running checkRecipeGeneric(1)"); // Remember last recipe - an - * optimization for findRecipe() this.mLastRecipe = tRecipe; - * - * if (tRecipe == null) { log("BAD RETURN - 1"); return false; } - * - * if (!this.canBufferOutputs(tRecipe, aMaxParallelRecipes)) { - * log("BAD RETURN - 2"); return false; } - * - * // EU discount float tRecipeEUt = (tRecipe.mEUt * aEUPercent) / 100.0f; float - * tTotalEUt = 0.0f; - * - * int parallelRecipes = 0; - * - * log("parallelRecipes: "+parallelRecipes); - * log("aMaxParallelRecipes: "+aMaxParallelRecipes); - * log("tTotalEUt: "+tTotalEUt); log("tVoltage: "+tVoltage); - * log("tRecipeEUt: "+tRecipeEUt); log("EU1: "+tRecipeEUt); // Count - * recipes to do in parallel, consuming input items and fluids and considering - * input voltage limits for (; parallelRecipes < aMaxParallelRecipes && - * tTotalEUt < (tVoltage - tRecipeEUt); parallelRecipes++) { if - * (!tRecipe.isRecipeInputEqual(true, aFluidInputs, aItemInputs)) { + * public boolean checkRecipeGeneric( ItemStack[] aItemInputs, FluidStack[] aFluidInputs, int aMaxParallelRecipes, + * int aEUPercent, int aSpeedBonusPercent, int aOutputChanceRoll, GT_Recipe aRecipe) { // Based on the Processing + * Array. A bit overkill, but very flexible. if (this.doesMachineBoostOutput()) { log("Boosting."); return + * checkRecipeBoostedOutputs(aItemInputs, aFluidInputs, aMaxParallelRecipes, aEUPercent, aSpeedBonusPercent, + * aOutputChanceRoll, aRecipe); } //Control Core to control the Multiblocks behaviour. int aControlCoreTier = + * getControlCoreTier(); //If no core, return false; if (aControlCoreTier > 0) { log("Control core found."); } // + * Reset outputs and progress stats this.lEUt = 0; this.mMaxProgresstime = 0; this.mOutputItems = new ItemStack[]{}; + * this.mOutputFluids = new FluidStack[]{}; long tVoltage = getMaxInputVoltage(); byte tTier = (byte) Math.max(1, + * GT_Utility.getTier(tVoltage)); log("Running checkRecipeGeneric(0)"); //Check to see if Voltage Tier > Control + * Core Tier if (tTier > aControlCoreTier) { log("Control core found is lower tier than power tier. OK"); tTier = + * (byte) aControlCoreTier; } tTier = (byte) MathUtils.getValueWithinRange(tTier, 0, 9); GT_Recipe tRecipe = aRecipe + * != null ? aRecipe : findRecipe( getBaseMetaTileEntity(), mLastRecipe, false, + * gregtech.api.enums.GT_Values.V[tTier], aFluidInputs, aItemInputs); log("Running checkRecipeGeneric(1)"); // + * Remember last recipe - an optimization for findRecipe() this.mLastRecipe = tRecipe; if (tRecipe == null) { + * log("BAD RETURN - 1"); return false; } if (!this.canBufferOutputs(tRecipe, aMaxParallelRecipes)) { + * log("BAD RETURN - 2"); return false; } // EU discount float tRecipeEUt = (tRecipe.mEUt * aEUPercent) / 100.0f; + * float tTotalEUt = 0.0f; int parallelRecipes = 0; log("parallelRecipes: "+parallelRecipes); + * log("aMaxParallelRecipes: "+aMaxParallelRecipes); log("tTotalEUt: "+tTotalEUt); log("tVoltage: "+tVoltage); + * log("tRecipeEUt: "+tRecipeEUt); log("EU1: "+tRecipeEUt); // Count recipes to do in parallel, consuming input + * items and fluids and considering input voltage limits for (; parallelRecipes < aMaxParallelRecipes && tTotalEUt < + * (tVoltage - tRecipeEUt); parallelRecipes++) { if (!tRecipe.isRecipeInputEqual(true, aFluidInputs, aItemInputs)) { * log("Broke at "+parallelRecipes+"."); break; } - * log("Bumped EU from "+tTotalEUt+" to "+(tTotalEUt+tRecipeEUt)+"."); tTotalEUt - * += tRecipeEUt; log("EU2: "+tTotalEUt); } - * - * if (parallelRecipes == 0) { log("BAD RETURN - 3"); return false; } - * - * log("EU3: "+tTotalEUt); - * - * // -- Try not to fail after this point - inputs have already been consumed! - * -- - * - * - * // Convert speed bonus to duration multiplier // e.g. 100% speed bonus = 200% - * speed = 100%/200% = 50% recipe duration. aSpeedBonusPercent = Math.max(-99, - * aSpeedBonusPercent); float tTimeFactor = 100.0f / (100.0f + - * aSpeedBonusPercent); this.mMaxProgresstime = (int)(tRecipe.mDuration * - * tTimeFactor * 10000); - * - * int aTempEu = (int) Math.floor(tTotalEUt); log("EU4: "+aTempEu); - * this.lEUt = (long) aTempEu; - * - * - * this.mEfficiency = (10000 - (getIdealStatus() - getRepairStatus()) * 1000); - * this.mEfficiencyIncrease = 10000; - * - * // Overclock if (this.lEUt <= 16) { this.lEUt = (this.lEUt * (1 << tTier - 1) - * * (1 << tTier - 1)); this.mMaxProgresstime = (this.mMaxProgresstime / (1 << - * tTier - 1)); } else { while (this.lEUt <= - * gregtech.api.enums.GT_Values.V[(tTier - 1)]) { this.lEUt *= 4; - * this.mMaxProgresstime /= 2; } } - * - * if (this.lEUt > 0) { this.lEUt = (-this.lEUt); } - * - * this.mMaxProgresstime = Math.max(1, this.mMaxProgresstime); - * - * // Collect fluid outputs FluidStack[] tOutputFluids = new - * FluidStack[tRecipe.mFluidOutputs.length]; for (int h = 0; h < - * tRecipe.mFluidOutputs.length; h++) { if (tRecipe.getFluidOutput(h) != null) { - * tOutputFluids[h] = tRecipe.getFluidOutput(h).copy(); tOutputFluids[h].amount - * *= parallelRecipes; } } - * - * // Collect output item types ItemStack[] tOutputItems = new - * ItemStack[tRecipe.mOutputs.length]; for (int h = 0; h < - * tRecipe.mOutputs.length; h++) { if (tRecipe.getOutput(h) != null) { - * tOutputItems[h] = tRecipe.getOutput(h).copy(); tOutputItems[h].stackSize = 0; - * } } - * - * // Set output item stack sizes (taking output chance into account) for (int f - * = 0; f < tOutputItems.length; f++) { if (tRecipe.mOutputs[f] != null && - * tOutputItems[f] != null) { for (int g = 0; g < parallelRecipes; g++) { if - * (getBaseMetaTileEntity().getRandomNumber(aOutputChanceRoll) < - * tRecipe.getOutputChance(f)) tOutputItems[f].stackSize += - * tRecipe.mOutputs[f].stackSize; } } } - * - * tOutputItems = removeNulls(tOutputItems); - * - * // Sanitize item stack size, splitting any stacks greater than max stack size - * List<ItemStack> splitStacks = new ArrayList<ItemStack>(); for (ItemStack - * tItem : tOutputItems) { while (tItem.getMaxStackSize() < tItem.stackSize) { - * ItemStack tmp = tItem.copy(); tmp.stackSize = tmp.getMaxStackSize(); - * tItem.stackSize = tItem.stackSize - tItem.getMaxStackSize(); - * splitStacks.add(tmp); } } - * - * if (splitStacks.size() > 0) { ItemStack[] tmp = new - * ItemStack[splitStacks.size()]; tmp = splitStacks.toArray(tmp); tOutputItems = - * ArrayUtils.addAll(tOutputItems, tmp); } - * - * // Strip empty stacks List<ItemStack> tSList = new ArrayList<ItemStack>(); - * for (ItemStack tS : tOutputItems) { if (tS.stackSize > 0) tSList.add(tS); } - * tOutputItems = tSList.toArray(new ItemStack[tSList.size()]); - * - * // Commit outputs this.mOutputItems = tOutputItems; this.mOutputFluids = - * tOutputFluids; updateSlots(); - * - * // Play sounds (GT++ addition - GT multiblocks play no sounds) - * startProcess(); - * + * log("Bumped EU from "+tTotalEUt+" to "+(tTotalEUt+tRecipeEUt)+"."); tTotalEUt += tRecipeEUt; + * log("EU2: "+tTotalEUt); } if (parallelRecipes == 0) { log("BAD RETURN - 3"); return false; } + * log("EU3: "+tTotalEUt); // -- Try not to fail after this point - inputs have already been consumed! -- // Convert + * speed bonus to duration multiplier // e.g. 100% speed bonus = 200% speed = 100%/200% = 50% recipe duration. + * aSpeedBonusPercent = Math.max(-99, aSpeedBonusPercent); float tTimeFactor = 100.0f / (100.0f + + * aSpeedBonusPercent); this.mMaxProgresstime = (int)(tRecipe.mDuration * tTimeFactor * 10000); int aTempEu = (int) + * Math.floor(tTotalEUt); log("EU4: "+aTempEu); this.lEUt = (long) aTempEu; this.mEfficiency = (10000 - + * (getIdealStatus() - getRepairStatus()) * 1000); this.mEfficiencyIncrease = 10000; // Overclock if (this.lEUt <= + * 16) { this.lEUt = (this.lEUt * (1 << tTier - 1) * (1 << tTier - 1)); this.mMaxProgresstime = + * (this.mMaxProgresstime / (1 << tTier - 1)); } else { while (this.lEUt <= gregtech.api.enums.GT_Values.V[(tTier - + * 1)]) { this.lEUt *= 4; this.mMaxProgresstime /= 2; } } if (this.lEUt > 0) { this.lEUt = (-this.lEUt); } + * this.mMaxProgresstime = Math.max(1, this.mMaxProgresstime); // Collect fluid outputs FluidStack[] tOutputFluids = + * new FluidStack[tRecipe.mFluidOutputs.length]; for (int h = 0; h < tRecipe.mFluidOutputs.length; h++) { if + * (tRecipe.getFluidOutput(h) != null) { tOutputFluids[h] = tRecipe.getFluidOutput(h).copy(); + * tOutputFluids[h].amount *= parallelRecipes; } } // Collect output item types ItemStack[] tOutputItems = new + * ItemStack[tRecipe.mOutputs.length]; for (int h = 0; h < tRecipe.mOutputs.length; h++) { if (tRecipe.getOutput(h) + * != null) { tOutputItems[h] = tRecipe.getOutput(h).copy(); tOutputItems[h].stackSize = 0; } } // Set output item + * stack sizes (taking output chance into account) for (int f = 0; f < tOutputItems.length; f++) { if + * (tRecipe.mOutputs[f] != null && tOutputItems[f] != null) { for (int g = 0; g < parallelRecipes; g++) { if + * (getBaseMetaTileEntity().getRandomNumber(aOutputChanceRoll) < tRecipe.getOutputChance(f)) + * tOutputItems[f].stackSize += tRecipe.mOutputs[f].stackSize; } } } tOutputItems = removeNulls(tOutputItems); // + * Sanitize item stack size, splitting any stacks greater than max stack size List<ItemStack> splitStacks = new + * ArrayList<ItemStack>(); for (ItemStack tItem : tOutputItems) { while (tItem.getMaxStackSize() < tItem.stackSize) + * { ItemStack tmp = tItem.copy(); tmp.stackSize = tmp.getMaxStackSize(); tItem.stackSize = tItem.stackSize - + * tItem.getMaxStackSize(); splitStacks.add(tmp); } } if (splitStacks.size() > 0) { ItemStack[] tmp = new + * ItemStack[splitStacks.size()]; tmp = splitStacks.toArray(tmp); tOutputItems = ArrayUtils.addAll(tOutputItems, + * tmp); } // Strip empty stacks List<ItemStack> tSList = new ArrayList<ItemStack>(); for (ItemStack tS : + * tOutputItems) { if (tS.stackSize > 0) tSList.add(tS); } tOutputItems = tSList.toArray(new + * ItemStack[tSList.size()]); // Commit outputs this.mOutputItems = tOutputItems; this.mOutputFluids = + * tOutputFluids; updateSlots(); // Play sounds (GT++ addition - GT multiblocks play no sounds) startProcess(); * log("GOOD RETURN - 1"); return true; } */ public long getMaxInputEnergy() { long rEnergy = 0; - if (mEnergyHatches.size() - == 1) // so it only takes 1 amp is only 1 hatch is present so it works like most gt multies - return mEnergyHatches.get(0).getBaseMetaTileEntity().getInputVoltage(); + if (mEnergyHatches.size() == 1) // so it only takes 1 amp is only 1 hatch is present so it works like most gt + // multies + return mEnergyHatches.get(0).getBaseMetaTileEntity().getInputVoltage(); for (GT_MetaTileEntity_Hatch_Energy tHatch : mEnergyHatches) - if (isValidMetaTileEntity(tHatch)) - rEnergy += tHatch.getBaseMetaTileEntity().getInputVoltage() - * tHatch.getBaseMetaTileEntity().getInputAmperage(); + if (isValidMetaTileEntity(tHatch)) rEnergy += tHatch.getBaseMetaTileEntity().getInputVoltage() + * tHatch.getBaseMetaTileEntity().getInputAmperage(); return rEnergy; } @@ -615,14 +601,8 @@ public abstract class GregtechMeta_MultiBlockBase<T extends GT_MetaTileEntity_Ex return false; } - public boolean checkRecipeGeneric( - ItemStack[] aItemInputs, - FluidStack[] aFluidInputs, - int aMaxParallelRecipes, - long aEUPercent, - int aSpeedBonusPercent, - int aOutputChanceRoll, - GT_Recipe aRecipe) { + public boolean checkRecipeGeneric(ItemStack[] aItemInputs, FluidStack[] aFluidInputs, int aMaxParallelRecipes, + long aEUPercent, int aSpeedBonusPercent, int aOutputChanceRoll, GT_Recipe aRecipe) { // Based on the Processing Array. A bit overkill, but very flexible. // Reset outputs and progress stats @@ -652,7 +632,7 @@ public abstract class GregtechMeta_MultiBlockBase<T extends GT_MetaTileEntity_Ex } /* - * Check for Special Behaviours + * Check for Special Behaviours */ // First populate the map if we need to. @@ -694,14 +674,9 @@ public abstract class GregtechMeta_MultiBlockBase<T extends GT_MetaTileEntity_Ex } } - GT_ParallelHelper helper = new GT_ParallelHelper() - .setRecipe(tRecipe) - .setItemInputs(aItemInputs) - .setFluidInputs(aFluidInputs) - .setAvailableEUt(tEnergy) - .setMaxParallel(aMaxParallelRecipes) - .enableConsumption() - .enableOutputCalculation(); + GT_ParallelHelper helper = new GT_ParallelHelper().setRecipe(tRecipe).setItemInputs(aItemInputs) + .setFluidInputs(aFluidInputs).setAvailableEUt(tEnergy).setMaxParallel(aMaxParallelRecipes) + .enableConsumption().enableOutputCalculation(); if (!mVoidExcess) { helper.enableVoidProtection(this); } @@ -719,13 +694,9 @@ public abstract class GregtechMeta_MultiBlockBase<T extends GT_MetaTileEntity_Ex this.mEfficiency = (10000 - (getIdealStatus() - getRepairStatus()) * 1000); this.mEfficiencyIncrease = 10000; - GT_OverclockCalculator calculator = new GT_OverclockCalculator() - .setRecipeEUt(tRecipe.mEUt) - .setEUt(tEnergy) - .setDuration(tRecipe.mDuration) - .setEUtDiscount(aEUPercent / 100.0f) - .setSpeedBoost(100.0f / (100.0f + aSpeedBonusPercent)) - .setParallel(helper.getCurrentParallel()) + GT_OverclockCalculator calculator = new GT_OverclockCalculator().setRecipeEUt(tRecipe.mEUt).setEUt(tEnergy) + .setDuration(tRecipe.mDuration).setEUtDiscount(aEUPercent / 100.0f) + .setSpeedBoost(100.0f / (100.0f + aSpeedBonusPercent)).setParallel(helper.getCurrentParallel()) .calculate(); lEUt = -calculator.getConsumption(); mMaxProgresstime = (int) Math.ceil(calculator.getDuration() * helper.getDurationMultiplier()); @@ -749,6 +720,7 @@ public abstract class GregtechMeta_MultiBlockBase<T extends GT_MetaTileEntity_Ex /** * Does this machine boost it's output? + * * @return - if true, gives additional % to output chances. */ protected boolean doesMachineBoostOutput() { @@ -813,13 +785,8 @@ public abstract class GregtechMeta_MultiBlockBase<T extends GT_MetaTileEntity_Ex * @param aRecipe * @return */ - public boolean checkRecipeBoostedOutputs( - ItemStack[] aItemInputs, - FluidStack[] aFluidInputs, - int aMaxParallelRecipes, - long aEUPercent, - int aSpeedBonusPercent, - int aOutputChanceRoll, + public boolean checkRecipeBoostedOutputs(ItemStack[] aItemInputs, FluidStack[] aFluidInputs, + int aMaxParallelRecipes, long aEUPercent, int aSpeedBonusPercent, int aOutputChanceRoll, GT_Recipe aRecipe) { long tVoltage = getMaxInputVoltage(); @@ -827,8 +794,7 @@ public abstract class GregtechMeta_MultiBlockBase<T extends GT_MetaTileEntity_Ex long tEnergy = getMaxInputEnergy(); log("Running checkRecipeGeneric(0)"); - GT_Recipe tRecipe = aRecipe != null - ? aRecipe + GT_Recipe tRecipe = aRecipe != null ? aRecipe : findRecipe( getBaseMetaTileEntity(), mLastRecipe, @@ -897,8 +863,7 @@ public abstract class GregtechMeta_MultiBlockBase<T extends GT_MetaTileEntity_Ex // Bad modify, let's just use the original recipe. if (!mHasBoostedCurrentRecipe || mBoostedRecipe == null) { - tRecipe = aRecipe != null - ? aRecipe + tRecipe = aRecipe != null ? aRecipe : findRecipe( getBaseMetaTileEntity(), mLastRecipe, @@ -917,14 +882,9 @@ public abstract class GregtechMeta_MultiBlockBase<T extends GT_MetaTileEntity_Ex return false; } - GT_ParallelHelper helper = new GT_ParallelHelper() - .setRecipe(tRecipe) - .setItemInputs(aItemInputs) - .setFluidInputs(aFluidInputs) - .setAvailableEUt(tEnergy) - .setMaxParallel(aMaxParallelRecipes) - .enableConsumption() - .enableOutputCalculation(); + GT_ParallelHelper helper = new GT_ParallelHelper().setRecipe(tRecipe).setItemInputs(aItemInputs) + .setFluidInputs(aFluidInputs).setAvailableEUt(tEnergy).setMaxParallel(aMaxParallelRecipes) + .enableConsumption().enableOutputCalculation(); if (!mVoidExcess) { helper.enableVoidProtection(this); } @@ -940,14 +900,10 @@ public abstract class GregtechMeta_MultiBlockBase<T extends GT_MetaTileEntity_Ex return false; } - GT_OverclockCalculator calculator = new GT_OverclockCalculator() - .setRecipeEUt(tRecipe.mEUt) - .setEUt(tEnergy) - .setDuration(tRecipe.mDuration) - .setEUtDiscount(aEUPercent / 100.0f) + GT_OverclockCalculator calculator = new GT_OverclockCalculator().setRecipeEUt(tRecipe.mEUt).setEUt(tEnergy) + .setDuration(tRecipe.mDuration).setEUtDiscount(aEUPercent / 100.0f) .setSpeedBoost(100.0f / (100.0f + aSpeedBonusPercent)) - .setParallel(Math.min(aMaxParallelRecipes, helper.getCurrentParallel())) - .calculate(); + .setParallel(Math.min(aMaxParallelRecipes, helper.getCurrentParallel())).calculate(); lEUt = -calculator.getConsumption(); mMaxProgresstime = (int) Math.ceil(mMaxProgresstime * helper.getDurationMultiplier()); @@ -991,27 +947,27 @@ public abstract class GregtechMeta_MultiBlockBase<T extends GT_MetaTileEntity_Ex @Override public void explodeMultiblock() { MetaTileEntity tTileEntity; - for (final Iterator<GT_MetaTileEntity_Hatch_InputBattery> localIterator = this.mChargeHatches.iterator(); - localIterator.hasNext(); - tTileEntity.getBaseMetaTileEntity().doExplosion(gregtech.api.enums.GT_Values.V[8])) { + for (final Iterator<GT_MetaTileEntity_Hatch_InputBattery> localIterator = this.mChargeHatches + .iterator(); localIterator.hasNext(); tTileEntity.getBaseMetaTileEntity() + .doExplosion(gregtech.api.enums.GT_Values.V[8])) { tTileEntity = localIterator.next(); } tTileEntity = null; - for (final Iterator<GT_MetaTileEntity_Hatch_OutputBattery> localIterator = this.mDischargeHatches.iterator(); - localIterator.hasNext(); - tTileEntity.getBaseMetaTileEntity().doExplosion(gregtech.api.enums.GT_Values.V[8])) { + for (final Iterator<GT_MetaTileEntity_Hatch_OutputBattery> localIterator = this.mDischargeHatches + .iterator(); localIterator.hasNext(); tTileEntity.getBaseMetaTileEntity() + .doExplosion(gregtech.api.enums.GT_Values.V[8])) { tTileEntity = localIterator.next(); } tTileEntity = null; - for (final Iterator<GT_MetaTileEntity_Hatch> localIterator = this.mTecTechDynamoHatches.iterator(); - localIterator.hasNext(); - tTileEntity.getBaseMetaTileEntity().doExplosion(gregtech.api.enums.GT_Values.V[8])) { + for (final Iterator<GT_MetaTileEntity_Hatch> localIterator = this.mTecTechDynamoHatches + .iterator(); localIterator.hasNext(); tTileEntity.getBaseMetaTileEntity() + .doExplosion(gregtech.api.enums.GT_Values.V[8])) { tTileEntity = localIterator.next(); } tTileEntity = null; - for (final Iterator<GT_MetaTileEntity_Hatch> localIterator = this.mTecTechEnergyHatches.iterator(); - localIterator.hasNext(); - tTileEntity.getBaseMetaTileEntity().doExplosion(gregtech.api.enums.GT_Values.V[8])) { + for (final Iterator<GT_MetaTileEntity_Hatch> localIterator = this.mTecTechEnergyHatches + .iterator(); localIterator.hasNext(); tTileEntity.getBaseMetaTileEntity() + .doExplosion(gregtech.api.enums.GT_Values.V[8])) { tTileEntity = localIterator.next(); } @@ -1089,8 +1045,8 @@ public abstract class GregtechMeta_MultiBlockBase<T extends GT_MetaTileEntity_Ex * Deplete fluid input from a set of restricted hatches. This assumes these hatches can store nothing else but your * expected fluid */ - protected boolean depleteInputFromRestrictedHatches( - Collection<GT_MetaTileEntity_Hatch_CustomFluidBase> aHatches, int aAmount) { + protected boolean depleteInputFromRestrictedHatches(Collection<GT_MetaTileEntity_Hatch_CustomFluidBase> aHatches, + int aAmount) { for (final GT_MetaTileEntity_Hatch_CustomFluidBase tHatch : aHatches) { if (isValidMetaTileEntity(tHatch)) { FluidStack tLiquid = tHatch.getFluid(); @@ -1133,6 +1089,7 @@ public abstract class GregtechMeta_MultiBlockBase<T extends GT_MetaTileEntity_Ex /** * Causes a Random Maint. Issue. + * * @return {@link boolean} - Returns whether or not an issue was caused, should always be true. */ public boolean causeMaintenanceIssue() { @@ -1186,13 +1143,13 @@ public abstract class GregtechMeta_MultiBlockBase<T extends GT_MetaTileEntity_Ex && (this.getPollutionPerSecond(null) > 0 ? !mMufflerHatches.isEmpty() : true); } - public <E> boolean addToMachineListInternal( - ArrayList<E> aList, final IGregTechTileEntity aTileEntity, final int aBaseCasingIndex) { + public <E> boolean addToMachineListInternal(ArrayList<E> aList, final IGregTechTileEntity aTileEntity, + final int aBaseCasingIndex) { return addToMachineListInternal(aList, getMetaTileEntity(aTileEntity), aBaseCasingIndex); } - public <E> boolean addToMachineListInternal( - ArrayList<E> aList, final IMetaTileEntity aTileEntity, final int aBaseCasingIndex) { + public <E> boolean addToMachineListInternal(ArrayList<E> aList, final IMetaTileEntity aTileEntity, + final int aBaseCasingIndex) { if (aTileEntity == null) { return false; } @@ -1219,8 +1176,10 @@ public abstract class GregtechMeta_MultiBlockBase<T extends GT_MetaTileEntity_Ex if (aList.isEmpty()) { if (aTileEntity instanceof GT_MetaTileEntity_Hatch) { if (GTplusplus.CURRENT_LOAD_PHASE == INIT_PHASE.STARTED) { - log("Adding " + aTileEntity.getInventoryName() + " at " - + new BlockPos(aTileEntity.getBaseMetaTileEntity()).getLocationString()); + log( + "Adding " + aTileEntity.getInventoryName() + + " at " + + new BlockPos(aTileEntity.getBaseMetaTileEntity()).getLocationString()); } updateTexture(aTileEntity, aBaseCasingIndex); return aList.add((E) aTileEntity); @@ -1228,8 +1187,10 @@ public abstract class GregtechMeta_MultiBlockBase<T extends GT_MetaTileEntity_Ex } else { IGregTechTileEntity aCur = aTileEntity.getBaseMetaTileEntity(); if (aList.contains(aTileEntity)) { - log("Found Duplicate " + aTileEntity.getInventoryName() + " @ " - + new BlockPos(aCur).getLocationString()); + log( + "Found Duplicate " + aTileEntity.getInventoryName() + + " @ " + + new BlockPos(aCur).getLocationString()); return false; } BlockPos aCurPos = new BlockPos(aCur); @@ -1262,10 +1223,10 @@ public abstract class GregtechMeta_MultiBlockBase<T extends GT_MetaTileEntity_Ex public int getControlCoreTier() { // Always return best tier if config is off. - /*boolean aCoresConfig = gtPlusPlus.core.lib.CORE.ConfigSwitches.requireControlCores; - if (!aCoresConfig) { - return 10; - }*/ + /* + * boolean aCoresConfig = gtPlusPlus.core.lib.CORE.ConfigSwitches.requireControlCores; if (!aCoresConfig) { + * return 10; } + */ if (mControlCoreBus.isEmpty()) { log("No Control Core Modules Found."); @@ -1301,8 +1262,8 @@ public abstract class GregtechMeta_MultiBlockBase<T extends GT_MetaTileEntity_Ex log("Tried to add a secondary control core module."); return false; } - GT_MetaTileEntity_Hatch_ControlCore Module = - (GT_MetaTileEntity_Hatch_ControlCore) getMetaTileEntity(aTileEntity); + GT_MetaTileEntity_Hatch_ControlCore Module = (GT_MetaTileEntity_Hatch_ControlCore) getMetaTileEntity( + aTileEntity); if (Module != null) { if (Module.setOwner(aTileEntity)) { log("Adding control core module."); @@ -1607,7 +1568,8 @@ public abstract class GregtechMeta_MultiBlockBase<T extends GT_MetaTileEntity_Ex /** * TecTech Multi-Amp Dynamo Support - * @param aTileEntity - The Dynamo Hatch + * + * @param aTileEntity - The Dynamo Hatch * @param aBaseCasingIndex - Casing Texture * @return */ @@ -1628,8 +1590,8 @@ public abstract class GregtechMeta_MultiBlockBase<T extends GT_MetaTileEntity_Ex public boolean isThisHatchMultiDynamo(IMetaTileEntity aMetaTileEntity) { Class<?> mDynamoClass; - mDynamoClass = ReflectionUtils.getClass( - "com.github.technus.tectech.thing.metaTileEntity.hatch.GT_MetaTileEntity_Hatch_DynamoMulti"); + mDynamoClass = ReflectionUtils + .getClass("com.github.technus.tectech.thing.metaTileEntity.hatch.GT_MetaTileEntity_Hatch_DynamoMulti"); if (mDynamoClass != null) { if (mDynamoClass.isInstance(aMetaTileEntity)) { return true; @@ -1660,7 +1622,8 @@ public abstract class GregtechMeta_MultiBlockBase<T extends GT_MetaTileEntity_Ex /** * TecTech Multi-Amp Energy Hatch Support - * @param aTileEntity - The Energy Hatch + * + * @param aTileEntity - The Energy Hatch * @param aBaseCasingIndex - Casing Texture * @return */ @@ -1681,8 +1644,8 @@ public abstract class GregtechMeta_MultiBlockBase<T extends GT_MetaTileEntity_Ex public boolean isThisHatchMultiEnergy(IMetaTileEntity aMetaTileEntity) { Class<?> mDynamoClass; - mDynamoClass = ReflectionUtils.getClass( - "com.github.technus.tectech.thing.metaTileEntity.hatch.GT_MetaTileEntity_Hatch_EnergyMulti"); + mDynamoClass = ReflectionUtils + .getClass("com.github.technus.tectech.thing.metaTileEntity.hatch.GT_MetaTileEntity_Hatch_EnergyMulti"); if (mDynamoClass != null) { if (mDynamoClass.isInstance(aMetaTileEntity)) { return true; @@ -1746,34 +1709,28 @@ public abstract class GregtechMeta_MultiBlockBase<T extends GT_MetaTileEntity_Ex /** * Custom Find Recipe with Debugging */ - public GT_Recipe findRecipe( - final IHasWorldObjectAndCoords aTileEntity, - final boolean aNotUnificated, - final boolean aDontCheckStackSizes, - final long aVoltage, - final FluidStack[] aFluids, + public GT_Recipe findRecipe(final IHasWorldObjectAndCoords aTileEntity, final boolean aNotUnificated, + final boolean aDontCheckStackSizes, final long aVoltage, final FluidStack[] aFluids, final ItemStack... aInputs) { return this.findRecipe( - aTileEntity, null, aNotUnificated, aDontCheckStackSizes, aVoltage, aFluids, (ItemStack) null, aInputs); + aTileEntity, + null, + aNotUnificated, + aDontCheckStackSizes, + aVoltage, + aFluids, + (ItemStack) null, + aInputs); } - public GT_Recipe findRecipe( - final IHasWorldObjectAndCoords aTileEntity, - final boolean aNotUnificated, - final long aVoltage, - final FluidStack[] aFluids, - final ItemStack... aInputs) { + public GT_Recipe findRecipe(final IHasWorldObjectAndCoords aTileEntity, final boolean aNotUnificated, + final long aVoltage, final FluidStack[] aFluids, final ItemStack... aInputs) { return this.findRecipe(aTileEntity, null, aNotUnificated, aVoltage, aFluids, (ItemStack) null, aInputs); } - public GT_Recipe findRecipe( - final IHasWorldObjectAndCoords aTileEntity, - final GT_Recipe aRecipe, - final boolean aNotUnificated, - final boolean aDontCheckStackSizes, - final long aVoltage, - final FluidStack[] aFluids, - final ItemStack... aInputs) { + public GT_Recipe findRecipe(final IHasWorldObjectAndCoords aTileEntity, final GT_Recipe aRecipe, + final boolean aNotUnificated, final boolean aDontCheckStackSizes, final long aVoltage, + final FluidStack[] aFluids, final ItemStack... aInputs) { return this.findRecipe( aTileEntity, aRecipe, @@ -1785,36 +1742,20 @@ public abstract class GregtechMeta_MultiBlockBase<T extends GT_MetaTileEntity_Ex aInputs); } - public GT_Recipe findRecipe( - final IHasWorldObjectAndCoords aTileEntity, - final GT_Recipe aRecipe, - final boolean aNotUnificated, - final long aVoltage, - final FluidStack[] aFluids, - final ItemStack... aInputs) { + public GT_Recipe findRecipe(final IHasWorldObjectAndCoords aTileEntity, final GT_Recipe aRecipe, + final boolean aNotUnificated, final long aVoltage, final FluidStack[] aFluids, final ItemStack... aInputs) { return this.findRecipe(aTileEntity, aRecipe, aNotUnificated, aVoltage, aFluids, (ItemStack) null, aInputs); } - public GT_Recipe findRecipe( - final IHasWorldObjectAndCoords aTileEntity, - final GT_Recipe aRecipe, - final boolean aNotUnificated, - final long aVoltage, - final FluidStack[] aFluids, - final ItemStack aSpecialSlot, + public GT_Recipe findRecipe(final IHasWorldObjectAndCoords aTileEntity, final GT_Recipe aRecipe, + final boolean aNotUnificated, final long aVoltage, final FluidStack[] aFluids, final ItemStack aSpecialSlot, final ItemStack... aInputs) { return this.findRecipe(aTileEntity, aRecipe, aNotUnificated, true, aVoltage, aFluids, aSpecialSlot, aInputs); } - public GT_Recipe findRecipe( - final IHasWorldObjectAndCoords aTileEntity, - final GT_Recipe aRecipe, - final boolean aNotUnificated, - final boolean aDontCheckStackSizes, - final long aVoltage, - final FluidStack[] aFluids, - final ItemStack aSpecialSlot, - ItemStack... aInputs) { + public GT_Recipe findRecipe(final IHasWorldObjectAndCoords aTileEntity, final GT_Recipe aRecipe, + final boolean aNotUnificated, final boolean aDontCheckStackSizes, final long aVoltage, + final FluidStack[] aFluids, final ItemStack aSpecialSlot, ItemStack... aInputs) { if (this.getRecipeMap().mRecipeList.isEmpty()) { log("No Recipes in Map to search through."); return null; @@ -1860,11 +1801,10 @@ public abstract class GregtechMeta_MultiBlockBase<T extends GT_MetaTileEntity_Ex if (aNotUnificated) { aInputs = GT_OreDictUnificator.getStackArray(true, (Object[]) aInputs); } - if (aRecipe != null - && !aRecipe.mFakeRecipe + if (aRecipe != null && !aRecipe.mFakeRecipe && aRecipe.mCanBeBuffered && aRecipe.isRecipeInputEqual(false, aDontCheckStackSizes, aFluids, aInputs)) { - mRecipeResult = (aRecipe.mEnabled /* && aVoltage * this.getRecipeMap().mAmperage >= aRecipe.mEUt*/) + mRecipeResult = (aRecipe.mEnabled /* && aVoltage * this.getRecipeMap().mAmperage >= aRecipe.mEUt */) ? aRecipe : null; log("x) Found Recipe? " + (mRecipeResult != null ? "true" : "false")); @@ -1872,22 +1812,21 @@ public abstract class GregtechMeta_MultiBlockBase<T extends GT_MetaTileEntity_Ex return mRecipeResult; } } - if (mRecipeResult == null - && this.getRecipeMap().mUsualInputCount >= 0 + if (mRecipeResult == null && this.getRecipeMap().mUsualInputCount >= 0 && aInputs != null && aInputs.length > 0) { for (final ItemStack tStack : aInputs) { if (tStack != null) { - Collection<GT_Recipe> tRecipes = - this.getRecipeMap().mRecipeItemMap.get(new GT_ItemStack(tStack)); + Collection<GT_Recipe> tRecipes = this.getRecipeMap().mRecipeItemMap + .get(new GT_ItemStack(tStack)); if (tRecipes != null) { for (final GT_Recipe tRecipe : tRecipes) { if (!tRecipe.mFakeRecipe && tRecipe.isRecipeInputEqual(false, aDontCheckStackSizes, aFluids, aInputs)) { - mRecipeResult = - (tRecipe.mEnabled /* && aVoltage * this.getRecipeMap().mAmperage >= tRecipe.mEUt*/) - ? tRecipe - : null; + mRecipeResult = (tRecipe.mEnabled /* + * && aVoltage * this.getRecipeMap().mAmperage >= + * tRecipe.mEUt + */) ? tRecipe : null; log("1) Found Recipe? " + (mRecipeResult != null ? "true" : "false")); // return mRecipeResult; } @@ -1895,17 +1834,16 @@ public abstract class GregtechMeta_MultiBlockBase<T extends GT_MetaTileEntity_Ex } // TODO - Investigate if this requires to be in it's own block - tRecipes = this.getRecipeMap() - .mRecipeItemMap - .get(new GT_ItemStack(GT_Utility.copyMetaData(32767L, new Object[] {tStack}))); + tRecipes = this.getRecipeMap().mRecipeItemMap + .get(new GT_ItemStack(GT_Utility.copyMetaData(32767L, new Object[] { tStack }))); if (tRecipes != null) { for (final GT_Recipe tRecipe : tRecipes) { if (!tRecipe.mFakeRecipe && tRecipe.isRecipeInputEqual(false, aDontCheckStackSizes, aFluids, aInputs)) { - mRecipeResult = - (tRecipe.mEnabled /*&& aVoltage * this.getRecipeMap().mAmperage >= tRecipe.mEUt*/) - ? tRecipe - : null; + mRecipeResult = (tRecipe.mEnabled /* + * && aVoltage * this.getRecipeMap().mAmperage >= + * tRecipe.mEUt + */) ? tRecipe : null; log("2) Found Recipe? " + (mRecipeResult != null ? "true" : "false")); // return mRecipeResult; } @@ -1914,22 +1852,21 @@ public abstract class GregtechMeta_MultiBlockBase<T extends GT_MetaTileEntity_Ex } } } - if (mRecipeResult == null - && this.getRecipeMap().mMinimalInputItems == 0 + if (mRecipeResult == null && this.getRecipeMap().mMinimalInputItems == 0 && aFluids != null && aFluids.length > 0) { for (final FluidStack aFluid2 : aFluids) { if (aFluid2 != null) { - final Collection<GT_Recipe> tRecipes = - this.getRecipeMap().mRecipeFluidMap.get(aFluid2.getFluid()); + final Collection<GT_Recipe> tRecipes = this.getRecipeMap().mRecipeFluidMap + .get(aFluid2.getFluid()); if (tRecipes != null) { for (final GT_Recipe tRecipe : tRecipes) { if (!tRecipe.mFakeRecipe && tRecipe.isRecipeInputEqual(false, aDontCheckStackSizes, aFluids, aInputs)) { - mRecipeResult = - (tRecipe.mEnabled /* && aVoltage * this.getRecipeMap().mAmperage >= tRecipe.mEUt*/) - ? tRecipe - : null; + mRecipeResult = (tRecipe.mEnabled /* + * && aVoltage * this.getRecipeMap().mAmperage >= + * tRecipe.mEUt + */) ? tRecipe : null; log("3) Found Recipe? " + (mRecipeResult != null ? "true" : "false")); // return mRecipeResult; } @@ -1943,8 +1880,10 @@ public abstract class GregtechMeta_MultiBlockBase<T extends GT_MetaTileEntity_Ex } if (mRecipeResult == null) { - log("Invalid recipe, Fallback lookup. " - + this.getRecipeMap().mRecipeList.size() + " | " + this.getRecipeMap().mNEIName); + log( + "Invalid recipe, Fallback lookup. " + this.getRecipeMap().mRecipeList.size() + + " | " + + this.getRecipeMap().mNEIName); if (!CORE.MAIN_GREGTECH_5U_EXPERIMENTAL_FORK) { try { return (GT_Recipe) findRecipe08.invoke( @@ -1986,8 +1925,8 @@ public abstract class GregtechMeta_MultiBlockBase<T extends GT_MetaTileEntity_Ex * Custom Tool Handling */ @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) { // Do Things if (this.getBaseMetaTileEntity().isServerSide()) { // Logger.INFO("Right Clicked Controller."); @@ -2019,8 +1958,12 @@ public abstract class GregtechMeta_MultiBlockBase<T extends GT_MetaTileEntity_Ex if (hatch.mFluid != null) { PlayerUtils.messagePlayer( aPlayer, - "Clearing " + hatch.mFluid.amount + "L of " + hatch.mFluid.getLocalizedName() + " from hatch " - + aHatchIndex + "."); + "Clearing " + hatch.mFluid.amount + + "L of " + + hatch.mFluid.getLocalizedName() + + " from hatch " + + aHatchIndex + + "."); hatch.mFluid = null; } aHatchIndex++; @@ -2029,21 +1972,22 @@ public abstract class GregtechMeta_MultiBlockBase<T extends GT_MetaTileEntity_Ex } @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) { boolean tSuper = super.onSolderingToolRightClick(aSide, aWrenchingSide, aPlayer, aX, aY, aZ); if (aPlayer.isSneaking()) return tSuper; mVoidExcess = !mVoidExcess; - aPlayer.addChatMessage(new ChatComponentTranslation( - mVoidExcess ? "interaction.voidexcess.enabled" : "interaction.voidexcess.disabled")); + aPlayer.addChatMessage( + new ChatComponentTranslation( + mVoidExcess ? "interaction.voidexcess.enabled" : "interaction.voidexcess.disabled")); return true; } protected boolean mUseMultiparallelMode = 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) { if (aPlayer.isSneaking()) { mUseMultiparallelMode = !mUseMultiparallelMode; if (mUseMultiparallelMode) { @@ -2056,21 +2000,15 @@ public abstract class GregtechMeta_MultiBlockBase<T extends GT_MetaTileEntity_Ex return false; } - public boolean isValidBlockForStructure( - IGregTechTileEntity aBaseMetaTileEntity, - int aCasingID, - boolean canBeHatch, - Block aFoundBlock, - int aFoundMeta, - Block aExpectedBlock, - int aExpectedMeta) { + public boolean isValidBlockForStructure(IGregTechTileEntity aBaseMetaTileEntity, int aCasingID, boolean canBeHatch, + Block aFoundBlock, int aFoundMeta, Block aExpectedBlock, int aExpectedMeta) { boolean isHatch = false; if (aBaseMetaTileEntity != null) { // Unsure why this check exists? - /*if (aCasingID < 64) { - aCasingID = TAE.GTPP_INDEX(aCasingID); - }*/ + /* + * if (aCasingID < 64) { aCasingID = TAE.GTPP_INDEX(aCasingID); } + */ isHatch = this.addToMachineList(aBaseMetaTileEntity, aCasingID); if (isHatch) { @@ -2110,8 +2048,14 @@ public abstract class GregtechMeta_MultiBlockBase<T extends GT_MetaTileEntity_Ex return true; } else if (aFoundBlock != aExpectedBlock) { if (GTplusplus.CURRENT_LOAD_PHASE == INIT_PHASE.STARTED) { - log("A1 - Found: " + aFoundBlock.getLocalizedName() + ":" + aFoundMeta + ", Expected: " - + aExpectedBlock.getLocalizedName() + ":" + aExpectedMeta); + log( + "A1 - Found: " + aFoundBlock.getLocalizedName() + + ":" + + aFoundMeta + + ", Expected: " + + aExpectedBlock.getLocalizedName() + + ":" + + aExpectedMeta); // log("Loc: "+(new BlockPos(aBaseMetaTileEntity).getLocationString())); } return false; @@ -2149,31 +2093,24 @@ public abstract class GregtechMeta_MultiBlockBase<T extends GT_MetaTileEntity_Ex } private final void tryTickWaitTimerDown() { - /*if (mStartUpCheck > 10) { - mStartUpCheck = 10; - }*/ + /* + * if (mStartUpCheck > 10) { mStartUpCheck = 10; } + */ } // Only support to use meta to tier /** * accept meta [0, maxMeta) + * * @param maxMeta exclusive */ - public static <T> IStructureElement<T> addTieredBlock( - Block aBlock, - BiConsumer<T, Integer> aSetTheFuckingMeta, - Function<T, Integer> aGetTheFuckingMeta, - int maxMeta) { - return addTieredBlock( - aBlock, - (t, i) -> { - aSetTheFuckingMeta.accept(t, i); - return true; - }, - aGetTheFuckingMeta, - 0, - maxMeta); + public static <T> IStructureElement<T> addTieredBlock(Block aBlock, BiConsumer<T, Integer> aSetTheFuckingMeta, + Function<T, Integer> aGetTheFuckingMeta, int maxMeta) { + return addTieredBlock(aBlock, (t, i) -> { + aSetTheFuckingMeta.accept(t, i); + return true; + }, aGetTheFuckingMeta, 0, maxMeta); } /** @@ -2181,21 +2118,12 @@ public abstract class GregtechMeta_MultiBlockBase<T extends GT_MetaTileEntity_Ex * @param minMeta inclusive * @param maxMeta exclusive */ - public static <T> IStructureElement<T> addTieredBlock( - Block aBlock, - BiConsumer<T, Integer> aSetTheFuckingMeta, - Function<T, Integer> aGetTheFuckingMeta, - int minMeta, - int maxMeta) { - return addTieredBlock( - aBlock, - (t, i) -> { - aSetTheFuckingMeta.accept(t, i); - return true; - }, - aGetTheFuckingMeta, - minMeta, - maxMeta); + public static <T> IStructureElement<T> addTieredBlock(Block aBlock, BiConsumer<T, Integer> aSetTheFuckingMeta, + Function<T, Integer> aGetTheFuckingMeta, int minMeta, int maxMeta) { + return addTieredBlock(aBlock, (t, i) -> { + aSetTheFuckingMeta.accept(t, i); + return true; + }, aGetTheFuckingMeta, minMeta, maxMeta); } /** @@ -2203,14 +2131,11 @@ public abstract class GregtechMeta_MultiBlockBase<T extends GT_MetaTileEntity_Ex * @param minMeta inclusive * @param maxMeta exclusive */ - public static <T> IStructureElement<T> addTieredBlock( - Block aBlock, - BiPredicate<T, Integer> aSetTheFuckingMeta, - Function<T, Integer> aGetTheFuckingMeta, - int minMeta, - int maxMeta) { + public static <T> IStructureElement<T> addTieredBlock(Block aBlock, BiPredicate<T, Integer> aSetTheFuckingMeta, + Function<T, Integer> aGetTheFuckingMeta, int minMeta, int maxMeta) { return new IStructureElement<T>() { + @Override public boolean check(T t, World world, int x, int y, int z) { Block tBlock = world.getBlock(x, y, z); @@ -2247,14 +2172,14 @@ public abstract class GregtechMeta_MultiBlockBase<T extends GT_MetaTileEntity_Ex @Nullable @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(aBlock, getMeta(trigger)); } @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 (world.getBlock(x, y, z) == aBlock) { if (world.getBlockMetadata(x, y, z) == getMeta(trigger)) { return PlaceResult.SKIP; @@ -2262,37 +2187,29 @@ public abstract class GregtechMeta_MultiBlockBase<T extends GT_MetaTileEntity_Ex return PlaceResult.REJECT; } return StructureUtility.survivalPlaceBlock( - aBlock, getMeta(trigger), world, x, y, z, env.getSource(), env.getActor(), env.getChatter()); + aBlock, + getMeta(trigger), + world, + x, + y, + z, + env.getSource(), + env.getActor(), + env.getChatter()); } }; } @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) { if (aSide == aFacing) { - if (aActive) - return new ITexture[] { - getCasingTexture(), - TextureFactory.builder() - .addIcon(getActiveOverlay()) - .extFacing() - .build() - }; - return new ITexture[] { - getCasingTexture(), - TextureFactory.builder() - .addIcon(getInactiveOverlay()) - .extFacing() - .build() - }; - } - return new ITexture[] {getCasingTexture()}; + if (aActive) return new ITexture[] { getCasingTexture(), + TextureFactory.builder().addIcon(getActiveOverlay()).extFacing().build() }; + return new ITexture[] { getCasingTexture(), + TextureFactory.builder().addIcon(getInactiveOverlay()).extFacing().build() }; + } + return new ITexture[] { getCasingTexture() }; } protected IIconContainer getActiveOverlay() { @@ -2325,15 +2242,12 @@ public abstract class GregtechMeta_MultiBlockBase<T extends GT_MetaTileEntity_Ex private static final ConcurrentHashMap<String, ItemStack> mToolStacks = new ConcurrentHashMap<>(); protected void addNoPlayerInventoryUI(ModularWindow.Builder builder, UIBuildContext buildContext) { - builder.widget(new DrawableWidget() - .setDrawable(GT_UITextures.PICTURE_SCREEN_BLACK) - .setPos(3, 4) - .setSize(152, 159)); + builder.widget( + new DrawableWidget().setDrawable(GT_UITextures.PICTURE_SCREEN_BLACK).setPos(3, 4).setSize(152, 159)); for (int i = 0; i < 9; i++) { - builder.widget(new DrawableWidget() - .setDrawable(GT_UITextures.BUTTON_STANDARD) - .setPos(155, 3 + i * 18) - .setSize(18, 18)); + builder.widget( + new DrawableWidget().setDrawable(GT_UITextures.BUTTON_STANDARD).setPos(155, 3 + i * 18) + .setSize(18, 18)); } DynamicPositionedColumn screenElements = new DynamicPositionedColumn(); @@ -2342,163 +2256,229 @@ public abstract class GregtechMeta_MultiBlockBase<T extends GT_MetaTileEntity_Ex setupToolDisplay(); - builder.widget(new ItemDrawable(() -> mToolStacks.get(mWrench + "WRENCH")) - .asWidget() - .setPos(156, 58)) + builder.widget(new ItemDrawable(() -> mToolStacks.get(mWrench + "WRENCH")).asWidget().setPos(156, 58)) .widget(new FakeSyncWidget.BooleanSyncer(() -> mWrench, val -> mWrench = val)); - builder.widget(new ItemDrawable(() -> mToolStacks.get(mCrowbar + "CROWBAR")) - .asWidget() - .setPos(156, 76)) + builder.widget(new ItemDrawable(() -> mToolStacks.get(mCrowbar + "CROWBAR")).asWidget().setPos(156, 76)) .widget(new FakeSyncWidget.BooleanSyncer(() -> mCrowbar, val -> mCrowbar = val)); - builder.widget(new ItemDrawable(() -> mToolStacks.get(mHardHammer + "HARDHAMMER")) - .asWidget() - .setPos(156, 94)) - .widget(new TextWidget("H") - .setDefaultColor(COLOR_TEXT_WHITE.get()) - .setPos(167, 103)) + builder.widget(new ItemDrawable(() -> mToolStacks.get(mHardHammer + "HARDHAMMER")).asWidget().setPos(156, 94)) + .widget(new TextWidget("H").setDefaultColor(COLOR_TEXT_WHITE.get()).setPos(167, 103)) .widget(new FakeSyncWidget.BooleanSyncer(() -> mHardHammer, val -> mHardHammer = val)); - builder.widget(new ItemDrawable(() -> mToolStacks.get(mSoftHammer + "SOFTHAMMER")) - .asWidget() - .setPos(156, 112)) - .widget(new TextWidget("M") - .setDefaultColor(COLOR_TEXT_WHITE.get()) - .setPos(167, 121)) + builder.widget(new ItemDrawable(() -> mToolStacks.get(mSoftHammer + "SOFTHAMMER")).asWidget().setPos(156, 112)) + .widget(new TextWidget("M").setDefaultColor(COLOR_TEXT_WHITE.get()).setPos(167, 121)) .widget(new FakeSyncWidget.BooleanSyncer(() -> mSoftHammer, val -> mSoftHammer = val)); - builder.widget(new ItemDrawable(() -> mToolStacks.get(mScrewdriver + "SCREWDRIVER")) - .asWidget() - .setPos(156, 130)) + builder.widget( + new ItemDrawable(() -> mToolStacks.get(mScrewdriver + "SCREWDRIVER")).asWidget().setPos(156, 130)) .widget(new FakeSyncWidget.BooleanSyncer(() -> mScrewdriver, val -> mScrewdriver = val)); - builder.widget(new ItemDrawable(() -> mToolStacks.get(mSolderingTool + "SOLDERING_IRON_LV")) - .asWidget() + builder.widget( + new ItemDrawable(() -> mToolStacks.get(mSolderingTool + "SOLDERING_IRON_LV")).asWidget() .setPos(156, 148)) .widget(new FakeSyncWidget.BooleanSyncer(() -> mSolderingTool, val -> mSolderingTool = val)); - builder.widget(new ItemDrawable( - () -> mToolStacks.get(getBaseMetaTileEntity().isActive() + "GLASS")) - .asWidget() + builder.widget( + new ItemDrawable(() -> mToolStacks.get(getBaseMetaTileEntity().isActive() + "GLASS")).asWidget() .setPos(156, 22)) - .widget(TextWidget.dynamicString(() -> getBaseMetaTileEntity().isActive() ? "On" : "Off") - .setSynced(false) - .setDefaultColor(COLOR_TEXT_WHITE.get()) - .setPos(157, 31)) - .widget(new FakeSyncWidget.BooleanSyncer( - () -> getBaseMetaTileEntity().isActive(), - val -> getBaseMetaTileEntity().setActive(val))); + .widget( + TextWidget.dynamicString(() -> getBaseMetaTileEntity().isActive() ? "On" : "Off") + .setSynced(false).setDefaultColor(COLOR_TEXT_WHITE.get()).setPos(157, 31)) + .widget( + new FakeSyncWidget.BooleanSyncer( + () -> getBaseMetaTileEntity().isActive(), + val -> getBaseMetaTileEntity().setActive(val))); } protected void drawTextsNoPlayerInventory(DynamicPositionedColumn screenElements) { screenElements.setSynced(false).setSpace(0).setPos(6, 7); 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)) - .widget(TextWidget.dynamicString(() -> StatCollector.translateToLocal("GTPP.machines.input") + " " - + StatCollector.translateToLocal("GTPP.machines.tier") + ": " + EnumChatFormatting.GREEN - + GT_Values.VOLTAGE_NAMES[(int) getInputTier()]) - .setDefaultColor(COLOR_TEXT_WHITE.get()) - .setEnabled(widget -> mMachine && getInputTier() > 0)) - .widget(TextWidget.dynamicString(() -> StatCollector.translateToLocal("GTPP.machines.output") + " " - + StatCollector.translateToLocal("GTPP.machines.tier") + ": " + EnumChatFormatting.GREEN - + GT_Values.VOLTAGE_NAMES[(int) getOutputTier()]) - .setDefaultColor(COLOR_TEXT_WHITE.get()) - .setEnabled(widget -> mMachine && getOutputTier() > 0)) - .widget(TextWidget.dynamicString(() -> StatCollector.translateToLocal("GTPP.multiblock.progress") + ": " - + EnumChatFormatting.GREEN - + getBaseMetaTileEntity().getProgress() / 20 - + EnumChatFormatting.RESET + " s / " + EnumChatFormatting.YELLOW - + getBaseMetaTileEntity().getMaxProgress() / 20 - + EnumChatFormatting.RESET + " s") - .setDefaultColor(COLOR_TEXT_WHITE.get()) - .setEnabled(widget -> mMachine)) - .widget(new TextWidget(StatCollector.translateToLocal("GTPP.multiblock.energy") + ":") - .setDefaultColor(COLOR_TEXT_WHITE.get()) - .setEnabled(widget -> mMachine)) - .widget(TextWidget.dynamicString(() -> StatCollector.translateToLocal( - "" + EnumChatFormatting.GREEN + getStoredEnergyInAllEnergyHatches() - + EnumChatFormatting.RESET + " EU / " + EnumChatFormatting.YELLOW - + getMaxEnergyStorageOfAllEnergyHatches() - + EnumChatFormatting.RESET + " EU")) - .setDefaultColor(COLOR_TEXT_WHITE.get()) - .setEnabled(widget -> mMachine)) - .widget(new TextWidget(StatCollector.translateToLocal("GTPP.multiblock.usage") + ":") - .setDefaultColor(COLOR_TEXT_WHITE.get()) - .setEnabled(widget -> mMachine && getLastRecipeEU() > 0 && getLastRecipeDuration() > 0)) - .widget(TextWidget.dynamicString(() -> StatCollector.translateToLocal("" + EnumChatFormatting.RED - + -getLastRecipeEU() + EnumChatFormatting.RESET + " EU/t/parallel")) - .setDefaultColor(COLOR_TEXT_WHITE.get()) - .setEnabled(widget -> mMachine && getLastRecipeEU() > 0 && getLastRecipeDuration() > 0)) - .widget(TextWidget.dynamicString( - () -> StatCollector.translateToLocal("GTPP.multiblock.generation") + ":") - .setDefaultColor(COLOR_TEXT_WHITE.get()) - .setEnabled(widget -> mMachine && getLastRecipeEU() < 0 && getLastRecipeDuration() > 0)) - .widget(TextWidget.dynamicString(() -> StatCollector.translateToLocal("" + EnumChatFormatting.GREEN - + getLastRecipeEU() + EnumChatFormatting.RESET + " EU/t/parallel")) - .setDefaultColor(COLOR_TEXT_WHITE.get()) - .setEnabled(widget -> mMachine && getLastRecipeEU() < 0 && getLastRecipeDuration() > 0)) - .widget(TextWidget.dynamicString(() -> StatCollector.translateToLocal("GTPP.multiblock.duration") + ": " - + EnumChatFormatting.RED + getLastRecipeDuration() + EnumChatFormatting.RESET - + " ticks") - .setDefaultColor(COLOR_TEXT_WHITE.get()) - .setEnabled(widget -> mMachine && getLastRecipeEU() != 0 && getLastRecipeDuration() > 0)) - .widget(TextWidget.dynamicString(() -> StatCollector.translateToLocal("GTPP.multiblock.specialvalue") - + ": " + EnumChatFormatting.RED + getLastRecipeEU() + EnumChatFormatting.RESET + "") - .setDefaultColor(COLOR_TEXT_WHITE.get()) - .setEnabled(widget -> mMachine - && getLastRecipeEU() != 0 - && getLastRecipeDuration() > 0 - && (mLastRecipe != null ? mLastRecipe.mSpecialValue : 0) > 0)) - .widget(new TextWidget(StatCollector.translateToLocal("GTPP.multiblock.mei") + ":") - .setDefaultColor(COLOR_TEXT_WHITE.get()) - .setEnabled(widget -> mMachine)) - .widget(TextWidget.dynamicString(() -> - StatCollector.translateToLocal("" + EnumChatFormatting.YELLOW + getMaxInputVoltage() - + EnumChatFormatting.RESET + " EU/t(*2A) " + .widget( + TextWidget + .dynamicString( + () -> StatCollector.translateToLocal("GTPP.machines.input") + " " + + StatCollector.translateToLocal("GTPP.machines.tier") + + ": " + + EnumChatFormatting.GREEN + + GT_Values.VOLTAGE_NAMES[(int) getInputTier()]) + .setDefaultColor(COLOR_TEXT_WHITE.get()) + .setEnabled(widget -> mMachine && getInputTier() > 0)) + .widget( + TextWidget.dynamicString( + () -> StatCollector.translateToLocal("GTPP.machines.output") + " " + StatCollector.translateToLocal("GTPP.machines.tier") - + ": " + EnumChatFormatting.YELLOW - + GT_Values.VN[GT_Utility.getTier(getMaxInputVoltage())] - + EnumChatFormatting.RESET)) - .setDefaultColor(COLOR_TEXT_WHITE.get()) - .setEnabled(widget -> mMachine)) - .widget(TextWidget.dynamicString(() -> StatCollector.translateToLocal("GTPP.multiblock.efficiency") - + ": " + EnumChatFormatting.YELLOW + (mEfficiency / 100.0F) + EnumChatFormatting.RESET - + " %") - .setDefaultColor(COLOR_TEXT_WHITE.get()) - .setEnabled(widget -> mMachine)) - .widget(TextWidget.dynamicString(() -> StatCollector.translateToLocal("GTPP.multiblock.pollution") - + ": " + EnumChatFormatting.RED + (getPollutionPerTick(null) * 20) - + EnumChatFormatting.RESET + "/sec") - .setDefaultColor(COLOR_TEXT_WHITE.get()) - .setEnabled(widget -> mMachine)) - .widget(TextWidget.dynamicString( - () -> StatCollector.translateToLocal("GTPP.multiblock.pollutionreduced") + ": " - + EnumChatFormatting.GREEN + getPollutionReductionForAllMufflers() - + EnumChatFormatting.RESET + " %") - .setDefaultColor(COLOR_TEXT_WHITE.get()) - .setEnabled(widget -> mMachine)) - .widget(new TextWidget("Total Time Since Built: ") - .setDefaultColor(COLOR_TEXT_WHITE.get()) - .setEnabled(widget -> mMachine)) - .widget(TextWidget.dynamicString(() -> "" + EnumChatFormatting.DARK_GREEN + getRuntimeWeeksDisplay() - + EnumChatFormatting.RESET + " Weeks,") - .setDefaultColor(COLOR_TEXT_WHITE.get()) - .setEnabled(widget -> mMachine)) - .widget(TextWidget.dynamicString(() -> "" + EnumChatFormatting.DARK_GREEN + getRuntimeDaysDisplay() - + EnumChatFormatting.RESET + " Days,") - .setDefaultColor(COLOR_TEXT_WHITE.get()) - .setEnabled(widget -> mMachine)) - .widget(TextWidget.dynamicString(() -> "" + EnumChatFormatting.DARK_GREEN + getRuntimeHoursDisplay() - + EnumChatFormatting.RESET + " Hours,") - .setDefaultColor(COLOR_TEXT_WHITE.get()) - .setEnabled(widget -> mMachine)) - .widget(TextWidget.dynamicString(() -> "" + EnumChatFormatting.DARK_GREEN + getRuntimeMinutesDisplay() - + EnumChatFormatting.RESET + " Minutes,") - .setDefaultColor(COLOR_TEXT_WHITE.get()) - .setEnabled(widget -> mMachine)) - .widget(TextWidget.dynamicString(() -> "" + EnumChatFormatting.DARK_GREEN + getRuntimeSecondsDisplay() - + EnumChatFormatting.RESET + " Seconds") - .setDefaultColor(COLOR_TEXT_WHITE.get()) - .setEnabled(widget -> mMachine)); + + ": " + + EnumChatFormatting.GREEN + + GT_Values.VOLTAGE_NAMES[(int) getOutputTier()]) + .setDefaultColor(COLOR_TEXT_WHITE.get()) + .setEnabled(widget -> mMachine && getOutputTier() > 0)) + .widget( + TextWidget + .dynamicString( + () -> StatCollector.translateToLocal("GTPP.multiblock.progress") + ": " + + EnumChatFormatting.GREEN + + getBaseMetaTileEntity().getProgress() / 20 + + EnumChatFormatting.RESET + + " s / " + + EnumChatFormatting.YELLOW + + getBaseMetaTileEntity().getMaxProgress() / 20 + + EnumChatFormatting.RESET + + " s") + .setDefaultColor(COLOR_TEXT_WHITE.get()).setEnabled(widget -> mMachine)) + .widget( + new TextWidget(StatCollector.translateToLocal("GTPP.multiblock.energy") + ":") + .setDefaultColor(COLOR_TEXT_WHITE.get()).setEnabled(widget -> mMachine)) + .widget( + TextWidget + .dynamicString( + () -> StatCollector.translateToLocal( + "" + EnumChatFormatting.GREEN + + getStoredEnergyInAllEnergyHatches() + + EnumChatFormatting.RESET + + " EU / " + + EnumChatFormatting.YELLOW + + getMaxEnergyStorageOfAllEnergyHatches() + + EnumChatFormatting.RESET + + " EU")) + .setDefaultColor(COLOR_TEXT_WHITE.get()).setEnabled(widget -> mMachine)) + .widget( + new TextWidget(StatCollector.translateToLocal("GTPP.multiblock.usage") + ":") + .setDefaultColor(COLOR_TEXT_WHITE.get()) + .setEnabled(widget -> mMachine && getLastRecipeEU() > 0 && getLastRecipeDuration() > 0)) + .widget( + TextWidget + .dynamicString( + () -> StatCollector.translateToLocal( + "" + EnumChatFormatting.RED + + -getLastRecipeEU() + + EnumChatFormatting.RESET + + " EU/t/parallel")) + .setDefaultColor(COLOR_TEXT_WHITE.get()) + .setEnabled(widget -> mMachine && getLastRecipeEU() > 0 && getLastRecipeDuration() > 0)) + .widget( + TextWidget + .dynamicString(() -> StatCollector.translateToLocal("GTPP.multiblock.generation") + ":") + .setDefaultColor(COLOR_TEXT_WHITE.get()) + .setEnabled(widget -> mMachine && getLastRecipeEU() < 0 && getLastRecipeDuration() > 0)) + .widget( + TextWidget + .dynamicString( + () -> StatCollector.translateToLocal( + "" + EnumChatFormatting.GREEN + + getLastRecipeEU() + + EnumChatFormatting.RESET + + " EU/t/parallel")) + .setDefaultColor(COLOR_TEXT_WHITE.get()) + .setEnabled(widget -> mMachine && getLastRecipeEU() < 0 && getLastRecipeDuration() > 0)) + .widget( + TextWidget + .dynamicString( + () -> StatCollector.translateToLocal("GTPP.multiblock.duration") + ": " + + EnumChatFormatting.RED + + getLastRecipeDuration() + + EnumChatFormatting.RESET + + " ticks") + .setDefaultColor(COLOR_TEXT_WHITE.get()).setEnabled( + widget -> mMachine && getLastRecipeEU() != 0 && getLastRecipeDuration() > 0)) + .widget( + TextWidget + .dynamicString( + () -> StatCollector.translateToLocal("GTPP.multiblock.specialvalue") + ": " + + EnumChatFormatting.RED + + getLastRecipeEU() + + EnumChatFormatting.RESET + + "") + .setDefaultColor(COLOR_TEXT_WHITE.get()).setEnabled( + widget -> mMachine && getLastRecipeEU() != 0 + && getLastRecipeDuration() > 0 + && (mLastRecipe != null ? mLastRecipe.mSpecialValue : 0) > 0)) + .widget( + new TextWidget(StatCollector.translateToLocal("GTPP.multiblock.mei") + ":") + .setDefaultColor(COLOR_TEXT_WHITE.get()).setEnabled(widget -> mMachine)) + .widget( + TextWidget + .dynamicString( + () -> StatCollector.translateToLocal( + "" + EnumChatFormatting.YELLOW + + getMaxInputVoltage() + + EnumChatFormatting.RESET + + " EU/t(*2A) " + + StatCollector.translateToLocal("GTPP.machines.tier") + + ": " + + EnumChatFormatting.YELLOW + + GT_Values.VN[GT_Utility.getTier(getMaxInputVoltage())] + + EnumChatFormatting.RESET)) + .setDefaultColor(COLOR_TEXT_WHITE.get()).setEnabled(widget -> mMachine)) + .widget( + TextWidget + .dynamicString( + () -> StatCollector.translateToLocal("GTPP.multiblock.efficiency") + ": " + + EnumChatFormatting.YELLOW + + (mEfficiency / 100.0F) + + EnumChatFormatting.RESET + + " %") + .setDefaultColor(COLOR_TEXT_WHITE.get()).setEnabled(widget -> mMachine)) + .widget( + TextWidget + .dynamicString( + () -> StatCollector.translateToLocal("GTPP.multiblock.pollution") + ": " + + EnumChatFormatting.RED + + (getPollutionPerTick(null) * 20) + + EnumChatFormatting.RESET + + "/sec") + .setDefaultColor(COLOR_TEXT_WHITE.get()).setEnabled(widget -> mMachine)) + .widget( + TextWidget + .dynamicString( + () -> StatCollector.translateToLocal("GTPP.multiblock.pollutionreduced") + ": " + + EnumChatFormatting.GREEN + + getPollutionReductionForAllMufflers() + + EnumChatFormatting.RESET + + " %") + .setDefaultColor(COLOR_TEXT_WHITE.get()).setEnabled(widget -> mMachine)) + .widget( + new TextWidget("Total Time Since Built: ").setDefaultColor(COLOR_TEXT_WHITE.get()) + .setEnabled(widget -> mMachine)) + .widget( + TextWidget + .dynamicString( + () -> "" + EnumChatFormatting.DARK_GREEN + + getRuntimeWeeksDisplay() + + EnumChatFormatting.RESET + + " Weeks,") + .setDefaultColor(COLOR_TEXT_WHITE.get()).setEnabled(widget -> mMachine)) + .widget( + TextWidget + .dynamicString( + () -> "" + EnumChatFormatting.DARK_GREEN + + getRuntimeDaysDisplay() + + EnumChatFormatting.RESET + + " Days,") + .setDefaultColor(COLOR_TEXT_WHITE.get()).setEnabled(widget -> mMachine)) + .widget( + TextWidget + .dynamicString( + () -> "" + EnumChatFormatting.DARK_GREEN + + getRuntimeHoursDisplay() + + EnumChatFormatting.RESET + + " Hours,") + .setDefaultColor(COLOR_TEXT_WHITE.get()).setEnabled(widget -> mMachine)) + .widget( + TextWidget + .dynamicString( + () -> "" + EnumChatFormatting.DARK_GREEN + + getRuntimeMinutesDisplay() + + EnumChatFormatting.RESET + + " Minutes,") + .setDefaultColor(COLOR_TEXT_WHITE.get()).setEnabled(widget -> mMachine)) + .widget( + TextWidget + .dynamicString( + () -> "" + EnumChatFormatting.DARK_GREEN + + getRuntimeSecondsDisplay() + + EnumChatFormatting.RESET + + " Seconds") + .setDefaultColor(COLOR_TEXT_WHITE.get()).setEnabled(widget -> mMachine)); } protected int getLastRecipeEU() { @@ -2522,8 +2502,7 @@ public abstract class GregtechMeta_MultiBlockBase<T extends GT_MetaTileEntity_Ex } protected long getRuntimeHoursDisplay() { - return TimeUnit.SECONDS.toHours(getRuntimeSeconds()) - - TimeUnit.DAYS.toHours(getRuntimeDaysDisplay()) + return TimeUnit.SECONDS.toHours(getRuntimeSeconds()) - TimeUnit.DAYS.toHours(getRuntimeDaysDisplay()) - TimeUnit.DAYS.toHours(7 * getRuntimeWeeksDisplay()); } @@ -2540,53 +2519,61 @@ public abstract class GregtechMeta_MultiBlockBase<T extends GT_MetaTileEntity_Ex mToolStacks.put( true + "WRENCH", - GT_MetaGenerated_Tool_01.INSTANCE.getToolWithStats( - GT_MetaGenerated_Tool_01.WRENCH, 1, GOOD, Materials.Tungsten, null)); + GT_MetaGenerated_Tool_01.INSTANCE + .getToolWithStats(GT_MetaGenerated_Tool_01.WRENCH, 1, GOOD, Materials.Tungsten, null)); mToolStacks.put( true + "CROWBAR", - GT_MetaGenerated_Tool_01.INSTANCE.getToolWithStats( - GT_MetaGenerated_Tool_01.CROWBAR, 1, GOOD, Materials.Tungsten, null)); + GT_MetaGenerated_Tool_01.INSTANCE + .getToolWithStats(GT_MetaGenerated_Tool_01.CROWBAR, 1, GOOD, Materials.Tungsten, null)); mToolStacks.put( true + "HARDHAMMER", - GT_MetaGenerated_Tool_01.INSTANCE.getToolWithStats( - GT_MetaGenerated_Tool_01.HARDHAMMER, 1, GOOD, Materials.Tungsten, null)); + GT_MetaGenerated_Tool_01.INSTANCE + .getToolWithStats(GT_MetaGenerated_Tool_01.HARDHAMMER, 1, GOOD, Materials.Tungsten, null)); mToolStacks.put( true + "SOFTHAMMER", - GT_MetaGenerated_Tool_01.INSTANCE.getToolWithStats( - GT_MetaGenerated_Tool_01.SOFTHAMMER, 1, GOOD, Materials.Tungsten, null)); + GT_MetaGenerated_Tool_01.INSTANCE + .getToolWithStats(GT_MetaGenerated_Tool_01.SOFTHAMMER, 1, GOOD, Materials.Tungsten, null)); mToolStacks.put( true + "SCREWDRIVER", - GT_MetaGenerated_Tool_01.INSTANCE.getToolWithStats( - GT_MetaGenerated_Tool_01.SCREWDRIVER, 1, GOOD, Materials.Tungsten, null)); + GT_MetaGenerated_Tool_01.INSTANCE + .getToolWithStats(GT_MetaGenerated_Tool_01.SCREWDRIVER, 1, GOOD, Materials.Tungsten, null)); mToolStacks.put( true + "SOLDERING_IRON_LV", GT_MetaGenerated_Tool_01.INSTANCE.getToolWithStats( - GT_MetaGenerated_Tool_01.SOLDERING_IRON_LV, 1, GOOD, Materials.Tungsten, null)); + GT_MetaGenerated_Tool_01.SOLDERING_IRON_LV, + 1, + GOOD, + Materials.Tungsten, + null)); mToolStacks.put( false + "WRENCH", - GT_MetaGenerated_Tool_01.INSTANCE.getToolWithStats( - GT_MetaGenerated_Tool_01.WRENCH, 1, BAD, Materials.Tungsten, null)); + GT_MetaGenerated_Tool_01.INSTANCE + .getToolWithStats(GT_MetaGenerated_Tool_01.WRENCH, 1, BAD, Materials.Tungsten, null)); mToolStacks.put( false + "CROWBAR", - GT_MetaGenerated_Tool_01.INSTANCE.getToolWithStats( - GT_MetaGenerated_Tool_01.CROWBAR, 1, BAD, Materials.Tungsten, null)); + GT_MetaGenerated_Tool_01.INSTANCE + .getToolWithStats(GT_MetaGenerated_Tool_01.CROWBAR, 1, BAD, Materials.Tungsten, null)); mToolStacks.put( false + "HARDHAMMER", - GT_MetaGenerated_Tool_01.INSTANCE.getToolWithStats( - GT_MetaGenerated_Tool_01.HARDHAMMER, 1, BAD, Materials.Tungsten, null)); + GT_MetaGenerated_Tool_01.INSTANCE + .getToolWithStats(GT_MetaGenerated_Tool_01.HARDHAMMER, 1, BAD, Materials.Tungsten, null)); mToolStacks.put( false + "SOFTHAMMER", - GT_MetaGenerated_Tool_01.INSTANCE.getToolWithStats( - GT_MetaGenerated_Tool_01.SOFTHAMMER, 1, BAD, Materials.Tungsten, null)); + GT_MetaGenerated_Tool_01.INSTANCE + .getToolWithStats(GT_MetaGenerated_Tool_01.SOFTHAMMER, 1, BAD, Materials.Tungsten, null)); mToolStacks.put( false + "SCREWDRIVER", - GT_MetaGenerated_Tool_01.INSTANCE.getToolWithStats( - GT_MetaGenerated_Tool_01.SCREWDRIVER, 1, BAD, Materials.Tungsten, null)); + GT_MetaGenerated_Tool_01.INSTANCE + .getToolWithStats(GT_MetaGenerated_Tool_01.SCREWDRIVER, 1, BAD, Materials.Tungsten, null)); mToolStacks.put( false + "SOLDERING_IRON_LV", GT_MetaGenerated_Tool_01.INSTANCE.getToolWithStats( - GT_MetaGenerated_Tool_01.SOLDERING_IRON_LV, 1, BAD, Materials.Tungsten, null)); + GT_MetaGenerated_Tool_01.SOLDERING_IRON_LV, + 1, + BAD, + Materials.Tungsten, + null)); ItemStack aGlassPane1 = ItemUtils.getItemStackOfAmountFromOreDict("paneGlassRed", 1); ItemStack aGlassPane2 = ItemUtils.getItemStackOfAmountFromOreDict("paneGlassLime", 1); @@ -2595,36 +2582,38 @@ public abstract class GregtechMeta_MultiBlockBase<T extends GT_MetaTileEntity_Ex } public enum GTPPHatchElement implements IHatchElement<GregtechMeta_MultiBlockBase<?>> { + AirIntake(GregtechMeta_MultiBlockBase::addAirIntakeToMachineList, GT_MetaTileEntity_Hatch_AirIntake.class) { + @Override public long count(GregtechMeta_MultiBlockBase<?> t) { return t.mAirIntakes.size(); } }, - ControlCore( - GregtechMeta_MultiBlockBase::addControlCoreToMachineList, GT_MetaTileEntity_Hatch_ControlCore.class) { + ControlCore(GregtechMeta_MultiBlockBase::addControlCoreToMachineList, + GT_MetaTileEntity_Hatch_ControlCore.class) { + @Override public long count(GregtechMeta_MultiBlockBase<?> t) { return t.mControlCoreBus.size(); } }, - TTDynamo( - GregtechMeta_MultiBlockBase::addMultiAmpDynamoToMachineList, + TTDynamo(GregtechMeta_MultiBlockBase::addMultiAmpDynamoToMachineList, "com.github.technus.tectech.thing.metaTileEntity.hatch.GT_MetaTileEntity_Hatch_DynamoMulti") { + @Override public long count(GregtechMeta_MultiBlockBase<?> t) { return t.mTecTechDynamoHatches.size(); } }, - TTEnergy( - GregtechMeta_MultiBlockBase::addMultiAmpEnergyToMachineList, + TTEnergy(GregtechMeta_MultiBlockBase::addMultiAmpEnergyToMachineList, "com.github.technus.tectech.thing.metaTileEntity.hatch.GT_MetaTileEntity_Hatch_EnergyMulti") { + @Override public long count(GregtechMeta_MultiBlockBase<?> t) { return t.mTecTechEnergyHatches.size(); } - }, - ; + },; @SuppressWarnings("unchecked") private static <T> Class<T> retype(Class<?> clazz) { @@ -2635,19 +2624,15 @@ public abstract class GregtechMeta_MultiBlockBase<T extends GT_MetaTileEntity_Ex private final IGT_HatchAdder<? super GregtechMeta_MultiBlockBase<?>> mAdder; @SafeVarargs - GTPPHatchElement( - IGT_HatchAdder<? super GregtechMeta_MultiBlockBase<?>> aAdder, + GTPPHatchElement(IGT_HatchAdder<? super GregtechMeta_MultiBlockBase<?>> aAdder, Class<? extends IMetaTileEntity>... aMteClasses) { this.mMteClasses = Arrays.asList(aMteClasses); this.mAdder = aAdder; } GTPPHatchElement(IGT_HatchAdder<? super GregtechMeta_MultiBlockBase<?>> aAdder, String... aClassNames) { - this.mMteClasses = Arrays.stream(aClassNames) - .map(ReflectionUtils::getClass) - .filter(Objects::nonNull) - .<Class<? extends IMetaTileEntity>>map(GTPPHatchElement::retype) - .collect(Collectors.toList()); + this.mMteClasses = Arrays.stream(aClassNames).map(ReflectionUtils::getClass).filter(Objects::nonNull) + .<Class<? extends IMetaTileEntity>>map(GTPPHatchElement::retype).collect(Collectors.toList()); this.mAdder = aAdder; } diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/base/GregtechMeta_SteamMultiBase.java b/src/main/java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/base/GregtechMeta_SteamMultiBase.java index 6aaa37f4ac..d1b4b5d951 100644 --- a/src/main/java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/base/GregtechMeta_SteamMultiBase.java +++ b/src/main/java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/base/GregtechMeta_SteamMultiBase.java @@ -4,6 +4,17 @@ import static gregtech.api.enums.GT_Values.V; import static gregtech.api.util.GT_StructureUtility.buildHatchAdder; import static gtPlusPlus.core.util.data.ArrayUtils.removeNulls; +import java.util.ArrayList; +import java.util.Collections; +import java.util.List; + +import net.minecraft.inventory.IInventory; +import net.minecraft.item.ItemStack; +import net.minecraft.util.StatCollector; +import net.minecraftforge.fluids.FluidStack; + +import org.apache.commons.lang3.ArrayUtils; + import gregtech.api.enums.Textures; import gregtech.api.interfaces.IHatchElement; import gregtech.api.interfaces.ITexture; @@ -17,24 +28,13 @@ import gtPlusPlus.api.objects.data.*; import gtPlusPlus.core.util.minecraft.FluidUtils; import gtPlusPlus.xmod.gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch_Steam_BusInput; import gtPlusPlus.xmod.gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch_Steam_BusOutput; -import java.util.ArrayList; -import java.util.Collections; -import java.util.List; -import net.minecraft.inventory.IInventory; -import net.minecraft.item.ItemStack; -import net.minecraft.util.StatCollector; -import net.minecraftforge.fluids.FluidStack; -import org.apache.commons.lang3.ArrayUtils; public abstract class GregtechMeta_SteamMultiBase<T extends GregtechMeta_SteamMultiBase<T>> extends GregtechMeta_MultiBlockBase<T> { - public ArrayList<GT_MetaTileEntity_Hatch_Steam_BusInput> mSteamInputs = - new ArrayList<GT_MetaTileEntity_Hatch_Steam_BusInput>(); - public ArrayList<GT_MetaTileEntity_Hatch_Steam_BusOutput> mSteamOutputs = - new ArrayList<GT_MetaTileEntity_Hatch_Steam_BusOutput>(); - public ArrayList<GT_MetaTileEntity_Hatch_CustomFluidBase> mSteamInputFluids = - new ArrayList<GT_MetaTileEntity_Hatch_CustomFluidBase>(); + public ArrayList<GT_MetaTileEntity_Hatch_Steam_BusInput> mSteamInputs = new ArrayList<GT_MetaTileEntity_Hatch_Steam_BusInput>(); + public ArrayList<GT_MetaTileEntity_Hatch_Steam_BusOutput> mSteamOutputs = new ArrayList<GT_MetaTileEntity_Hatch_Steam_BusOutput>(); + public ArrayList<GT_MetaTileEntity_Hatch_CustomFluidBase> mSteamInputFluids = new ArrayList<GT_MetaTileEntity_Hatch_CustomFluidBase>(); protected static final String TT_steaminputbus = StatCollector.translateToLocal("GTPP.MBTT.SteamInputBus"); protected static final String TT_steamoutputbus = StatCollector.translateToLocal("GTPP.MBTT.SteamOutputBus"); @@ -49,20 +49,13 @@ public abstract class GregtechMeta_SteamMultiBase<T extends GregtechMeta_SteamMu } @Override - public ITexture[] getTexture( - final IGregTechTileEntity aBaseMetaTileEntity, - final byte aSide, - final byte aFacing, - final byte aColorIndex, - final boolean aActive, - final boolean aRedstone) { + public ITexture[] getTexture(final IGregTechTileEntity aBaseMetaTileEntity, final byte aSide, final byte aFacing, + final byte aColorIndex, final boolean aActive, final boolean aRedstone) { if (aSide == aFacing) { - return new ITexture[] { - Textures.BlockIcons.getCasingTextureForId(getCasingTextureIndex()), - aActive ? getFrontOverlayActive() : getFrontOverlay() - }; + return new ITexture[] { Textures.BlockIcons.getCasingTextureForId(getCasingTextureIndex()), + aActive ? getFrontOverlayActive() : getFrontOverlay() }; } - return new ITexture[] {Textures.BlockIcons.getCasingTextureForId(getCasingTextureIndex())}; + return new ITexture[] { Textures.BlockIcons.getCasingTextureForId(getCasingTextureIndex()) }; } protected abstract GT_RenderedTexture getFrontOverlay(); @@ -110,8 +103,10 @@ public abstract class GregtechMeta_SteamMultiBase<T extends GregtechMeta_SteamMu // Remember last recipe - an optimization for findRecipe() this.mLastRecipe = tRecipe; - int aMaxParallelRecipes = - canBufferOutputs(tRecipe.mOutputs, tRecipe.mFluidOutputs, this.getMaxParallelRecipes()); + int aMaxParallelRecipes = canBufferOutputs( + tRecipe.mOutputs, + tRecipe.mFluidOutputs, + this.getMaxParallelRecipes()); if (aMaxParallelRecipes == 0) { log("BAD RETURN - 2"); return false; @@ -366,9 +361,8 @@ public abstract class GregtechMeta_SteamMultiBase<T extends GregtechMeta_SteamMu return 0; } - /* ======================================== - * Item Management - * ======================================== + /* + * ======================================== Item Management ======================================== */ if (aDoesOutputItems) { @@ -407,8 +401,7 @@ public abstract class GregtechMeta_SteamMultiBase<T extends GregtechMeta_SteamMu // A map to hold the items we will be 'inputting' into the output buses. These itemstacks are actually the // recipe outputs. - ConcurrentSet<FlexiblePair<ItemStack, Integer>> aInputMap = - new ConcurrentHashSet<FlexiblePair<ItemStack, Integer>>(); + ConcurrentSet<FlexiblePair<ItemStack, Integer>> aInputMap = new ConcurrentHashSet<FlexiblePair<ItemStack, Integer>>(); // Iterate over the outputs, calculating require stack spacing they will require. for (int i = 0; i < getOutputCount(aOutputs); i++) { @@ -442,11 +435,9 @@ public abstract class GregtechMeta_SteamMultiBase<T extends GregtechMeta_SteamMu if (aInputMap.size() > 0) { // Iterate over the current stored items in the Output busses, if any match and are not full, we can try // account for merging. - busItems: - for (FlexiblePair<ItemStack, Integer> y : aItemMap) { + busItems: for (FlexiblePair<ItemStack, Integer> y : aItemMap) { // Iterate over the 'inputs', we can safely remove these as we go. - outputItems: - for (FlexiblePair<ItemStack, Integer> u : aInputMap) { + outputItems: for (FlexiblePair<ItemStack, Integer> u : aInputMap) { // Create local vars for readability. ItemStack aOutputBusStack = y.getKey(); ItemStack aOutputStack = u.getKey(); @@ -471,8 +462,9 @@ public abstract class GregtechMeta_SteamMultiBase<T extends GregtechMeta_SteamMu // Update the stack size in the bus storage map. y.setValue(64); // Create a new object to iterate over later, with the remainder data; - FlexiblePair<ItemStack, Integer> t = - new FlexiblePair<ItemStack, Integer>(u.getKey(), aRemainder); + FlexiblePair<ItemStack, Integer> t = new FlexiblePair<ItemStack, Integer>( + u.getKey(), + aRemainder); // Remove the 'input' stack from the recipe outputs, so we don't try count it again. aInputMap.remove(u); // Add the remainder stack. @@ -490,8 +482,8 @@ public abstract class GregtechMeta_SteamMultiBase<T extends GregtechMeta_SteamMu // We have stacks that did not merge, do we have space for them? if (aInputMap.size() > 0) { if (aInputMap.size() > aInputBusSlotsFree) { - aParallelRecipes = - (int) Math.floor((double) aInputBusSlotsFree / aInputMap.size() * aParallelRecipes); + aParallelRecipes = (int) Math + .floor((double) aInputBusSlotsFree / aInputMap.size() * aParallelRecipes); // We do not have enough free slots in total to accommodate the remaining managed stacks. log(" Free: " + aInputBusSlotsFree + ", Required: " + aInputMap.size()); if (aParallelRecipes == 0) { @@ -507,9 +499,8 @@ public abstract class GregtechMeta_SteamMultiBase<T extends GregtechMeta_SteamMu } - /* ======================================== - * Fluid Management - * ======================================== + /* + * ======================================== Fluid Management ======================================== */ if (aDoesOutputFluids) { @@ -519,8 +510,7 @@ public abstract class GregtechMeta_SteamMultiBase<T extends GregtechMeta_SteamMu int aEmptyFluidHatches = 0; int aFullFluidHatches = 0; // Create Map for Fluid Output - ArrayList<Triplet<GT_MetaTileEntity_Hatch_Output, FluidStack, Integer>> aOutputHatches = - new ArrayList<Triplet<GT_MetaTileEntity_Hatch_Output, FluidStack, Integer>>(); + ArrayList<Triplet<GT_MetaTileEntity_Hatch_Output, FluidStack, Integer>> aOutputHatches = new ArrayList<Triplet<GT_MetaTileEntity_Hatch_Output, FluidStack, Integer>>(); for (final GT_MetaTileEntity_Hatch_Output tBus : this.mOutputHatches) { if (!isValidMetaTileEntity(tBus)) { continue; @@ -528,12 +518,18 @@ public abstract class GregtechMeta_SteamMultiBase<T extends GregtechMeta_SteamMu aFluidHatches++; // Map the Hatch with the space left for easy checking later. if (tBus.getFluid() == null) { - aOutputHatches.add(new Triplet<GT_MetaTileEntity_Hatch_Output, FluidStack, Integer>( - tBus, null, tBus.getCapacity())); + aOutputHatches.add( + new Triplet<GT_MetaTileEntity_Hatch_Output, FluidStack, Integer>( + tBus, + null, + tBus.getCapacity())); } else { int aSpaceLeft = tBus.getCapacity() - tBus.getFluidAmount(); - aOutputHatches.add(new Triplet<GT_MetaTileEntity_Hatch_Output, FluidStack, Integer>( - tBus, tBus.getFluid(), aSpaceLeft)); + aOutputHatches.add( + new Triplet<GT_MetaTileEntity_Hatch_Output, FluidStack, Integer>( + tBus, + tBus.getFluid(), + aSpaceLeft)); } } // Create a map of all the fluids we would like to output, we can iterate over this and see how many we can @@ -609,9 +605,10 @@ public abstract class GregtechMeta_SteamMultiBase<T extends GregtechMeta_SteamMu aOutputHatches.remove(aOutputHatches.get(i)); i--; // Re-add hatch to hatch list, with new data. - Triplet<GT_MetaTileEntity_Hatch_Output, FluidStack, Integer> aNewHatchData = - new Triplet<GT_MetaTileEntity_Hatch_Output, FluidStack, Integer>( - aHatch, aNewHatchStack, aNewHatchStack.amount); + Triplet<GT_MetaTileEntity_Hatch_Output, FluidStack, Integer> aNewHatchData = new Triplet<GT_MetaTileEntity_Hatch_Output, FluidStack, Integer>( + aHatch, + aNewHatchStack, + aNewHatchStack.amount); aOutputHatches.add(aNewHatchData); break; } @@ -629,9 +626,10 @@ public abstract class GregtechMeta_SteamMultiBase<T extends GregtechMeta_SteamMu aOutputHatches.remove(aOutputHatches.get(i)); i--; // Re-add hatch to hatch list, with new data. - Triplet<GT_MetaTileEntity_Hatch_Output, FluidStack, Integer> aNewHatchData = - new Triplet<GT_MetaTileEntity_Hatch_Output, FluidStack, Integer>( - aHatch, aNewHatchStack, aNewHatchStack.amount); + Triplet<GT_MetaTileEntity_Hatch_Output, FluidStack, Integer> aNewHatchData = new Triplet<GT_MetaTileEntity_Hatch_Output, FluidStack, Integer>( + aHatch, + aNewHatchStack, + aNewHatchStack.amount); aOutputHatches.add(aNewHatchData); // Check next fluid continue; @@ -646,8 +644,7 @@ public abstract class GregtechMeta_SteamMultiBase<T extends GregtechMeta_SteamMu for (Triplet<GT_MetaTileEntity_Hatch_Output, FluidStack, Integer> aFreeHatchCheck : aOutputHatches) { // Free Hatch - if (aFreeHatchCheck.getValue_2() == null - || aFreeHatchCheck.getValue_3() == 0 + if (aFreeHatchCheck.getValue_2() == null || aFreeHatchCheck.getValue_3() == 0 || aFreeHatchCheck.getValue_1().getFluid() == null) { aEmptyFluidHatches++; } @@ -658,10 +655,12 @@ public abstract class GregtechMeta_SteamMultiBase<T extends GregtechMeta_SteamMu if (aOutputFluids.size() > 0) { // Not enough space to add fluids. if (aOutputFluids.size() > aEmptyFluidHatches) { - aParallelRecipes = - (int) Math.floor((double) aEmptyFluidHatches / aOutputFluids.size() * aParallelRecipes); - log("Failed to find enough space for all fluid outputs. Free: " + aEmptyFluidHatches - + ", Required: " + aOutputFluids.size()); + aParallelRecipes = (int) Math + .floor((double) aEmptyFluidHatches / aOutputFluids.size() * aParallelRecipes); + log( + "Failed to find enough space for all fluid outputs. Free: " + aEmptyFluidHatches + + ", Required: " + + aOutputFluids.size()); return 0; } } @@ -703,8 +702,7 @@ public abstract class GregtechMeta_SteamMultiBase<T extends GregtechMeta_SteamMu if (aLiquid != null) return depleteInput(aLiquid); for (GT_MetaTileEntity_Hatch_CustomFluidBase tHatch : mSteamInputFluids) { 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; @@ -716,8 +714,7 @@ public abstract class GregtechMeta_SteamMultiBase<T extends GregtechMeta_SteamMu 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(0).stackSize >= aStack.stackSize) { tHatch.getBaseMetaTileEntity().decrStackSize(0, aStack.stackSize); return true; @@ -803,14 +800,14 @@ public abstract class GregtechMeta_SteamMultiBase<T extends GregtechMeta_SteamMu protected static <T extends GregtechMeta_SteamMultiBase<T>> GT_HatchElementBuilder<T> buildSteamInput( Class<T> typeToken) { - return buildHatchAdder(typeToken) - .adder(GregtechMeta_SteamMultiBase::addToMachineList) - .hatchIds(31040) + return buildHatchAdder(typeToken).adder(GregtechMeta_SteamMultiBase::addToMachineList).hatchIds(31040) .shouldReject(t -> !t.mSteamInputFluids.isEmpty()); } protected enum SteamHatchElement implements IHatchElement<GregtechMeta_SteamMultiBase<?>> { + InputBus_Steam { + @Override public List<? extends Class<? extends IMetaTileEntity>> mteClasses() { return Collections.singletonList(GT_MetaTileEntity_Hatch_Steam_BusInput.class); @@ -822,6 +819,7 @@ public abstract class GregtechMeta_SteamMultiBase<T extends GregtechMeta_SteamMu } }, OutputBus_Steam { + @Override public List<? extends Class<? extends IMetaTileEntity>> mteClasses() { return Collections.singletonList(GT_MetaTileEntity_Hatch_Steam_BusOutput.class); @@ -831,8 +829,7 @@ public abstract class GregtechMeta_SteamMultiBase<T extends GregtechMeta_SteamMu public long count(GregtechMeta_SteamMultiBase<?> t) { return t.mSteamOutputs.size(); } - }, - ; + },; @Override public IGT_HatchAdder<? super GregtechMeta_SteamMultiBase<?>> adder() { diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/base/generators/GregtechDoubleFuelGeneratorBase.java b/src/main/java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/base/generators/GregtechDoubleFuelGeneratorBase.java index 440e59a272..482c9e9910 100644 --- a/src/main/java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/base/generators/GregtechDoubleFuelGeneratorBase.java +++ b/src/main/java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/base/generators/GregtechDoubleFuelGeneratorBase.java @@ -2,6 +2,13 @@ package gtPlusPlus.xmod.gregtech.api.metatileentity.implementations.base.generat import static gregtech.api.enums.GT_Values.V; +import java.util.Collection; + +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.init.Blocks; +import net.minecraft.item.ItemStack; +import net.minecraftforge.fluids.FluidStack; + import gregtech.api.enums.Textures; import gregtech.api.gui.modularui.GT_UIInfos; import gregtech.api.interfaces.ITexture; @@ -11,28 +18,18 @@ import gregtech.api.util.GT_Recipe.GT_Recipe_Map; import gregtech.api.util.GT_Utility; import gtPlusPlus.api.objects.Logger; import gtPlusPlus.xmod.gregtech.api.metatileentity.implementations.GT_MetaTileEntity_DeluxeTank; -import java.util.Collection; -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.init.Blocks; -import net.minecraft.item.ItemStack; -import net.minecraftforge.fluids.FluidStack; public abstract class GregtechDoubleFuelGeneratorBase extends GT_MetaTileEntity_DeluxeTank { private boolean useFuel = false; - public GregtechDoubleFuelGeneratorBase( - final int aID, - final String aName, - final String aNameRegional, - final int aTier, - final String aDescription, - final ITexture... aTextures) { + public GregtechDoubleFuelGeneratorBase(final int aID, final String aName, final String aNameRegional, + final int aTier, final String aDescription, final ITexture... aTextures) { super(aID, aName, aNameRegional, aTier, 4, aDescription, aTextures); } - public GregtechDoubleFuelGeneratorBase( - final String aName, final int aTier, final String aDescription, final ITexture[][][] aTextures) { + public GregtechDoubleFuelGeneratorBase(final String aName, final int aTier, final String aDescription, + final ITexture[][][] aTextures) { super(aName, aTier, 4, aDescription, aTextures); } @@ -55,34 +52,22 @@ public abstract class GregtechDoubleFuelGeneratorBase extends GT_MetaTileEntity_ } @Override - public ITexture[] getTexture( - final IGregTechTileEntity aBaseMetaTileEntity, - final byte aSide, - final byte aFacing, - final byte aColorIndex, - final boolean aActive, - final boolean aRedstone) { - return this.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(final IGregTechTileEntity aBaseMetaTileEntity, final byte aSide, final byte aFacing, + final byte aColorIndex, final boolean aActive, final boolean aRedstone) { + return this.mTextures[(aActive ? 5 : 0) + (aSide == aFacing ? 0 + : aSide == GT_Utility.getOppositeSide(aFacing) ? 1 : aSide == 0 ? 2 : aSide == 1 ? 3 : 4)][aColorIndex + + 1]; } @Override public String[] getDescription() { - return new String[] {this.mDescription, "Fuel Efficiency: " + this.getEfficiency() + "%"}; + return new String[] { this.mDescription, "Fuel Efficiency: " + this.getEfficiency() + "%" }; } - /* @Override - public boolean onRightclick(IGregTechTileEntity aBaseMetaTileEntity, EntityPlayer aPlayer) { - if (aBaseMetaTileEntity.isClientSide()) return true; - aBaseMetaTileEntity.openGUI(aPlayer); - return true; - }*/ + /* + * @Override public boolean onRightclick(IGregTechTileEntity aBaseMetaTileEntity, EntityPlayer aPlayer) { if + * (aBaseMetaTileEntity.isClientSide()) return true; aBaseMetaTileEntity.openGUI(aPlayer); return true; } + */ @Override public boolean onRightclick(final IGregTechTileEntity aBaseMetaTileEntity, final EntityPlayer aPlayer) { @@ -97,23 +82,23 @@ public abstract class GregtechDoubleFuelGeneratorBase extends GT_MetaTileEntity_ } public ITexture[] getFront(final byte aColor) { - return new ITexture[] {Textures.BlockIcons.MACHINE_CASINGS[this.mTier][aColor + 1]}; + return new ITexture[] { Textures.BlockIcons.MACHINE_CASINGS[this.mTier][aColor + 1] }; } public ITexture[] getBack(final byte aColor) { - return new ITexture[] {Textures.BlockIcons.MACHINE_CASINGS[this.mTier][aColor + 1]}; + return new ITexture[] { Textures.BlockIcons.MACHINE_CASINGS[this.mTier][aColor + 1] }; } public ITexture[] getBottom(final byte aColor) { - return new ITexture[] {Textures.BlockIcons.MACHINE_CASINGS[this.mTier][aColor + 1]}; + return new ITexture[] { Textures.BlockIcons.MACHINE_CASINGS[this.mTier][aColor + 1] }; } public ITexture[] getTop(final byte aColor) { - return new ITexture[] {Textures.BlockIcons.MACHINE_CASINGS[this.mTier][aColor + 1]}; + return new ITexture[] { Textures.BlockIcons.MACHINE_CASINGS[this.mTier][aColor + 1] }; } public ITexture[] getSides(final byte aColor) { - return new ITexture[] {Textures.BlockIcons.MACHINE_CASINGS[this.mTier][aColor + 1]}; + return new ITexture[] { Textures.BlockIcons.MACHINE_CASINGS[this.mTier][aColor + 1] }; } public ITexture[] getFrontActive(final byte aColor) { @@ -226,8 +211,10 @@ public abstract class GregtechDoubleFuelGeneratorBase extends GT_MetaTileEntity_ if (this.mInventory[this.getStackDisplaySlot()] == null) { this.mInventory[this.getStackDisplaySlot()] = new ItemStack(Blocks.fire, 1); } - this.mInventory[this.getStackDisplaySlot()].setStackDisplayName("Generating: " - + (aBaseMetaTileEntity.getUniversalEnergyStored() - this.getMinimumStoredEU()) + " EU"); + this.mInventory[this.getStackDisplaySlot()].setStackDisplayName( + "Generating: " + + (aBaseMetaTileEntity.getUniversalEnergyStored() - this.getMinimumStoredEU()) + + " EU"); } } else { if ((this.mFluid != null) && (this.mFluid2 != null)) { @@ -235,10 +222,11 @@ public abstract class GregtechDoubleFuelGeneratorBase extends GT_MetaTileEntity_ tConsumed = this.consumedFluidPerOperation(this.mFluid); final int tFuelValue2 = this.getFuelValue(this.mFluid2), tConsumed2 = this.consumedFluidPerOperation(this.mFluid2); - if (((tFuelValue > 0) - && (tConsumed > 0) - && (this.mFluid.amount - > tConsumed)) /* && (tFuelValue2 > 0 && tConsumed2 > 0 && mFluid2.amount > tConsumed2)*/) { + if (((tFuelValue > 0) && (tConsumed > 0) + && (this.mFluid.amount > tConsumed)) /* + * && (tFuelValue2 > 0 && tConsumed2 > 0 && + * mFluid2.amount > tConsumed2) + */) { Logger.WARNING("tFuelValue: " + tFuelValue); Logger.WARNING("tConsumed: " + tConsumed); @@ -250,29 +238,25 @@ public abstract class GregtechDoubleFuelGeneratorBase extends GT_MetaTileEntity_ Logger.WARNING("tFuelValue2: " + tFuelValue2); Logger.WARNING("tConsumed2: " + tConsumed2); - Logger.WARNING( - "mFluid2.name: " + this.mFluid2.getFluid().getName()); + Logger.WARNING("mFluid2.name: " + this.mFluid2.getFluid().getName()); Logger.WARNING("mFluid2.amount: " + this.mFluid2.amount); Logger.WARNING("mFluid2.amount > tConsumed2: " + (this.mFluid2.amount > tConsumed2)); long tFluidAmountToUse = Math.min( this.mFluid.amount / tConsumed, (((this.maxEUOutput() * 30) + this.getMinimumStoredEU()) - - aBaseMetaTileEntity.getUniversalEnergyStored()) - / tFuelValue); + - aBaseMetaTileEntity.getUniversalEnergyStored()) / tFuelValue); long tFluidAmountToUse2 = Math.min( this.mFluid2.amount / tConsumed2, (((this.maxEUOutput() * 30) + this.getMinimumStoredEU()) - - aBaseMetaTileEntity.getUniversalEnergyStored()) - / tFuelValue2); + - aBaseMetaTileEntity.getUniversalEnergyStored()) / tFuelValue2); if (tFluidAmountToUse <= 0) { - /*if ((mFluid.amount / tConsumed) == getCapacity()){ - tFluidAmountToUse = 1; - }*/ + /* + * if ((mFluid.amount / tConsumed) == getCapacity()){ tFluidAmountToUse = 1; } + */ - if (aBaseMetaTileEntity.getUniversalEnergyStored() - <= (aBaseMetaTileEntity.getEUCapacity() - - aBaseMetaTileEntity.getUniversalEnergyStored())) { + if (aBaseMetaTileEntity.getUniversalEnergyStored() <= (aBaseMetaTileEntity.getEUCapacity() + - aBaseMetaTileEntity.getUniversalEnergyStored())) { tFluidAmountToUse = 1; Logger.WARNING("========================================================="); Logger.WARNING("tFluidAmountToUse - Updated: " + tFluidAmountToUse); @@ -281,12 +265,11 @@ public abstract class GregtechDoubleFuelGeneratorBase extends GT_MetaTileEntity_ } if (tFluidAmountToUse2 <= 0) { - /*if ((mFluid2.amount / tConsumed) == getCapacity()){ - tFluidAmountToUse2 = 1; - }*/ - if (aBaseMetaTileEntity.getUniversalEnergyStored() - <= (aBaseMetaTileEntity.getEUCapacity() - - aBaseMetaTileEntity.getUniversalEnergyStored())) { + /* + * if ((mFluid2.amount / tConsumed) == getCapacity()){ tFluidAmountToUse2 = 1; } + */ + if (aBaseMetaTileEntity.getUniversalEnergyStored() <= (aBaseMetaTileEntity.getEUCapacity() + - aBaseMetaTileEntity.getUniversalEnergyStored())) { tFluidAmountToUse2 = 1; Logger.WARNING("========================================================="); Logger.WARNING("tFluidAmountToUse2 - Updated: " + tFluidAmountToUse2); @@ -298,42 +281,53 @@ public abstract class GregtechDoubleFuelGeneratorBase extends GT_MetaTileEntity_ Logger.WARNING("tFluidAmountToUse: " + tFluidAmountToUse); Logger.WARNING("========================================================="); - /*Utils.LOG_WARNING("mFluid.amount / tConsumed: "+("fluidAmount:"+mFluid.amount)+(" tConsumed:"+tConsumed)+" | "+(mFluid.amount / tConsumed)); - Utils.LOG_WARNING("maxEUOutput() * 20 + getMinimumStoredEU(): "+(maxEUOutput() * 30 + getMinimumStoredEU())); - Utils.LOG_WARNING("maxEUOutput(): "+maxEUOutput()); - Utils.LOG_WARNING("maxEUOutput() * 20: "+(maxEUOutput() * 30)); - Utils.LOG_WARNING("getMinimumStoredEU(): "+(getMinimumStoredEU())); - Utils.LOG_WARNING("aBaseMetaTileEntity.getUniversalEnergyStored(): "+(aBaseMetaTileEntity.getUniversalEnergyStored())); - Utils.LOG_WARNING("(maxEUOutput() * 20 + getMinimumStoredEU() - aBaseMetaTileEntity.getUniversalEnergyStored()): "+((maxEUOutput() * 30 + getMinimumStoredEU() - aBaseMetaTileEntity.getUniversalEnergyStored()))); - Utils.LOG_WARNING("tFuelValue: "+(tFuelValue)); - Utils.LOG_WARNING("(maxEUOutput() * 20 + getMinimumStoredEU() - aBaseMetaTileEntity.getUniversalEnergyStored()) / tFuelValue): "+((maxEUOutput() * 30 + getMinimumStoredEU() - aBaseMetaTileEntity.getUniversalEnergyStored()) / tFuelValue)); + /* + * Utils.LOG_WARNING("mFluid.amount / tConsumed: "+("fluidAmount:"+mFluid.amount)+(" tConsumed:" + * +tConsumed)+" | "+(mFluid.amount / tConsumed)); + * Utils.LOG_WARNING("maxEUOutput() * 20 + getMinimumStoredEU(): "+(maxEUOutput() * 30 + + * getMinimumStoredEU())); Utils.LOG_WARNING("maxEUOutput(): "+maxEUOutput()); + * Utils.LOG_WARNING("maxEUOutput() * 20: "+(maxEUOutput() * 30)); + * Utils.LOG_WARNING("getMinimumStoredEU(): "+(getMinimumStoredEU())); + * Utils.LOG_WARNING("aBaseMetaTileEntity.getUniversalEnergyStored(): "+(aBaseMetaTileEntity. + * getUniversalEnergyStored())); Utils. + * LOG_WARNING("(maxEUOutput() * 20 + getMinimumStoredEU() - aBaseMetaTileEntity.getUniversalEnergyStored()): " + * +((maxEUOutput() * 30 + getMinimumStoredEU() - + * aBaseMetaTileEntity.getUniversalEnergyStored()))); + * Utils.LOG_WARNING("tFuelValue: "+(tFuelValue)); Utils. + * LOG_WARNING("(maxEUOutput() * 20 + getMinimumStoredEU() - aBaseMetaTileEntity.getUniversalEnergyStored()) / tFuelValue): " + * +((maxEUOutput() * 30 + getMinimumStoredEU() - + * aBaseMetaTileEntity.getUniversalEnergyStored()) / tFuelValue)); */ Logger.WARNING("========================================================="); Logger.WARNING("tFluidAmountToUse2: " + tFluidAmountToUse2); Logger.WARNING("========================================================="); - /*Utils.LOG_WARNING("mFluid2.amount / tConsumed2: "+("fluidAmount2:"+mFluid2.amount)+(" tConsumed2:"+tConsumed2)+" | "+(mFluid2.amount / tConsumed2)); - Utils.LOG_WARNING("maxEUOutput() * 20 + getMinimumStoredEU(): "+(maxEUOutput() * 30 + getMinimumStoredEU())); - Utils.LOG_WARNING("maxEUOutput(): "+maxEUOutput()); - Utils.LOG_WARNING("maxEUOutput() * 20: "+(maxEUOutput() * 30)); - Utils.LOG_WARNING("getMinimumStoredEU(): "+(getMinimumStoredEU())); - Utils.LOG_WARNING("aBaseMetaTileEntity.getUniversalEnergyStored(): "+(aBaseMetaTileEntity.getUniversalEnergyStored())); - Utils.LOG_WARNING("(maxEUOutput() * 20 + getMinimumStoredEU() - aBaseMetaTileEntity.getUniversalEnergyStored()): "+((maxEUOutput() * 30 + getMinimumStoredEU() - aBaseMetaTileEntity.getUniversalEnergyStored()))); - Utils.LOG_WARNING("tFuelValue2: "+(tFuelValue2)); - Utils.LOG_WARNING("(maxEUOutput() * 20 + getMinimumStoredEU() - aBaseMetaTileEntity.getUniversalEnergyStored()) / tFuelValue2): "+((maxEUOutput() * 30 + getMinimumStoredEU() - aBaseMetaTileEntity.getUniversalEnergyStored()) / tFuelValue2)); + /* + * Utils.LOG_WARNING("mFluid2.amount / tConsumed2: "+("fluidAmount2:"+mFluid2.amount)+ + * (" tConsumed2:"+tConsumed2)+" | "+(mFluid2.amount / tConsumed2)); + * Utils.LOG_WARNING("maxEUOutput() * 20 + getMinimumStoredEU(): "+(maxEUOutput() * 30 + + * getMinimumStoredEU())); Utils.LOG_WARNING("maxEUOutput(): "+maxEUOutput()); + * Utils.LOG_WARNING("maxEUOutput() * 20: "+(maxEUOutput() * 30)); + * Utils.LOG_WARNING("getMinimumStoredEU(): "+(getMinimumStoredEU())); + * Utils.LOG_WARNING("aBaseMetaTileEntity.getUniversalEnergyStored(): "+(aBaseMetaTileEntity. + * getUniversalEnergyStored())); Utils. + * LOG_WARNING("(maxEUOutput() * 20 + getMinimumStoredEU() - aBaseMetaTileEntity.getUniversalEnergyStored()): " + * +((maxEUOutput() * 30 + getMinimumStoredEU() - + * aBaseMetaTileEntity.getUniversalEnergyStored()))); + * Utils.LOG_WARNING("tFuelValue2: "+(tFuelValue2)); Utils. + * LOG_WARNING("(maxEUOutput() * 20 + getMinimumStoredEU() - aBaseMetaTileEntity.getUniversalEnergyStored()) / tFuelValue2): " + * +((maxEUOutput() * 30 + getMinimumStoredEU() - + * aBaseMetaTileEntity.getUniversalEnergyStored()) / tFuelValue2)); */ if (((tFluidAmountToUse > 0) - && aBaseMetaTileEntity.increaseStoredEnergyUnits( - tFluidAmountToUse * tFuelValue, true)) - && ((tFluidAmountToUse2 > 0) - && aBaseMetaTileEntity.increaseStoredEnergyUnits( - tFluidAmountToUse2 * tFuelValue2, true))) { + && aBaseMetaTileEntity.increaseStoredEnergyUnits(tFluidAmountToUse * tFuelValue, true)) + && ((tFluidAmountToUse2 > 0) && aBaseMetaTileEntity + .increaseStoredEnergyUnits(tFluidAmountToUse2 * tFuelValue2, true))) { Logger.WARNING("tFuelValue: " + tFuelValue); Logger.WARNING("tConsumed: " + tConsumed); - Logger.WARNING( - "mFluid.name: " + this.mFluid.getFluid().getName()); + Logger.WARNING("mFluid.name: " + this.mFluid.getFluid().getName()); Logger.WARNING("mFluid.amount: " + this.mFluid.amount); Logger.WARNING("mFluid.amount > tConsumed: " + (this.mFluid.amount > tConsumed)); @@ -341,8 +335,7 @@ public abstract class GregtechDoubleFuelGeneratorBase extends GT_MetaTileEntity_ Logger.WARNING("tFuelValue2: " + tFuelValue2); Logger.WARNING("tConsumed2: " + tConsumed2); - Logger.WARNING( - "mFluid2.name: " + this.mFluid2.getFluid().getName()); + Logger.WARNING("mFluid2.name: " + this.mFluid2.getFluid().getName()); Logger.WARNING("mFluid2.amount: " + this.mFluid2.amount); Logger.WARNING("mFluid2.amount > tConsumed2: " + (this.mFluid2.amount > tConsumed2)); @@ -362,18 +355,17 @@ public abstract class GregtechDoubleFuelGeneratorBase extends GT_MetaTileEntity_ Logger.WARNING("tFluidAmountToUse2: " + tFluidAmountToUse2); } } else { - /*Utils.LOG_WARNING("(tFuelValue > 0 && tConsumed > 0 && mFluid.amount > tConsumed) && (tFuelValue2 > 0 && tConsumed2 > 0 && mFluid2.amount > tConsumed2)"); - Utils.LOG_WARNING("tFuelValue: "+tFuelValue); - Utils.LOG_WARNING("tConsumed: "+tConsumed); - Utils.LOG_WARNING("mFluid.amount: "+mFluid.amount); - Utils.LOG_WARNING("mFluid.amount > tConsumed: "+(mFluid.amount > tConsumed)); - - Utils.LOG_WARNING("========================================================="); - - Utils.LOG_WARNING("tFuelValue2: "+tFuelValue2); - Utils.LOG_WARNING("tConsumed2: "+tConsumed2); - Utils.LOG_WARNING("mFluid2.amount: "+mFluid2.amount); - Utils.LOG_WARNING("mFluid2.amount > tConsumed2: "+(mFluid2.amount > tConsumed2)); */ + /* + * Utils. + * LOG_WARNING("(tFuelValue > 0 && tConsumed > 0 && mFluid.amount > tConsumed) && (tFuelValue2 > 0 && tConsumed2 > 0 && mFluid2.amount > tConsumed2)" + * ); Utils.LOG_WARNING("tFuelValue: "+tFuelValue); Utils.LOG_WARNING("tConsumed: "+tConsumed); + * Utils.LOG_WARNING("mFluid.amount: "+mFluid.amount); + * Utils.LOG_WARNING("mFluid.amount > tConsumed: "+(mFluid.amount > tConsumed)); + * Utils.LOG_WARNING("========================================================="); + * Utils.LOG_WARNING("tFuelValue2: "+tFuelValue2); Utils.LOG_WARNING("tConsumed2: "+tConsumed2); + * Utils.LOG_WARNING("mFluid2.amount: "+mFluid2.amount); + * Utils.LOG_WARNING("mFluid2.amount > tConsumed2: "+(mFluid2.amount > tConsumed2)); + */ } } else { Logger.WARNING("One mFluid is null"); @@ -401,8 +393,8 @@ public abstract class GregtechDoubleFuelGeneratorBase extends GT_MetaTileEntity_ } if (aBaseMetaTileEntity.isServerSide()) { - aBaseMetaTileEntity.setActive(aBaseMetaTileEntity.isAllowedToWork() - && (aBaseMetaTileEntity.getUniversalEnergyStored() + aBaseMetaTileEntity.setActive( + aBaseMetaTileEntity.isAllowedToWork() && (aBaseMetaTileEntity.getUniversalEnergyStored() >= (this.maxEUOutput() + this.getMinimumStoredEU()))); } } @@ -425,10 +417,8 @@ public abstract class GregtechDoubleFuelGeneratorBase extends GT_MetaTileEntity_ for (final GT_Recipe tFuel : tRecipeList) { if ((tLiquid = GT_Utility.getFluidForFilledItem(tFuel.getRepresentativeInput(0), true)) != null) { if (aLiquid.isFluidEqual(tLiquid)) { - return (int) (((long) tFuel.mSpecialValue - * this.getEfficiency() - * this.consumedFluidPerOperation(tLiquid)) - / 100); + return (int) (((long) tFuel.mSpecialValue * this.getEfficiency() + * this.consumedFluidPerOperation(tLiquid)) / 100); } } } @@ -440,8 +430,8 @@ public abstract class GregtechDoubleFuelGeneratorBase extends GT_MetaTileEntity_ if (GT_Utility.isStackInvalid(aStack) || (this.getRecipes() == null)) { return 0; } - final GT_Recipe tFuel = - this.getRecipes().findRecipe(this.getBaseMetaTileEntity(), false, Long.MAX_VALUE, null, aStack); + final GT_Recipe tFuel = this.getRecipes() + .findRecipe(this.getBaseMetaTileEntity(), false, Long.MAX_VALUE, null, aStack); if (tFuel != null) { return (int) ((tFuel.mSpecialValue * 1000L * this.getEfficiency()) / 100); } @@ -452,8 +442,8 @@ public abstract class GregtechDoubleFuelGeneratorBase extends GT_MetaTileEntity_ if (GT_Utility.isStackInvalid(aStack) || (this.getRecipes() == null)) { return null; } - final GT_Recipe tFuel = - this.getRecipes().findRecipe(this.getBaseMetaTileEntity(), false, Long.MAX_VALUE, null, aStack); + final GT_Recipe tFuel = this.getRecipes() + .findRecipe(this.getBaseMetaTileEntity(), false, Long.MAX_VALUE, null, aStack); if (tFuel != null) { return GT_Utility.copy(tFuel.getOutput(0)); } @@ -461,11 +451,10 @@ public abstract class GregtechDoubleFuelGeneratorBase extends GT_MetaTileEntity_ } @Override - public boolean allowPutStack( - final IGregTechTileEntity aBaseMetaTileEntity, final int aIndex, final byte aSide, final ItemStack aStack) { - return super.allowPutStack(aBaseMetaTileEntity, aIndex, aSide, aStack) - && ((this.getFuelValue(aStack) > 0) - || (this.getFuelValue(GT_Utility.getFluidForFilledItem(aStack, true)) > 0)); + public boolean allowPutStack(final IGregTechTileEntity aBaseMetaTileEntity, final int aIndex, final byte aSide, + final ItemStack aStack) { + return super.allowPutStack(aBaseMetaTileEntity, aIndex, aSide, aStack) && ((this.getFuelValue(aStack) > 0) + || (this.getFuelValue(GT_Utility.getFluidForFilledItem(aStack, true)) > 0)); } @Override diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/base/generators/GregtechMetaBoilerBase.java b/src/main/java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/base/generators/GregtechMetaBoilerBase.java index 5d5c28e375..ddda79e51e 100644 --- a/src/main/java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/base/generators/GregtechMetaBoilerBase.java +++ b/src/main/java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/base/generators/GregtechMetaBoilerBase.java @@ -1,5 +1,14 @@ package gtPlusPlus.xmod.gregtech.api.metatileentity.implementations.base.generators; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.init.Items; +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 net.minecraftforge.fluids.IFluidHandler; + import gregtech.api.GregTech_API; import gregtech.api.enums.Materials; import gregtech.api.enums.OrePrefixes; @@ -12,16 +21,9 @@ import gregtech.api.util.GT_ModHandler; import gregtech.api.util.GT_OreDictUnificator; import gregtech.api.util.GT_Utility; import gtPlusPlus.core.util.math.MathUtils; -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.init.Items; -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 net.minecraftforge.fluids.IFluidHandler; public abstract class GregtechMetaBoilerBase extends GT_MetaTileEntity_BasicTank { + public int mTemperature = 20; public int mProcessingEnergy = 0; public int mLossTimer = 0; @@ -29,33 +31,24 @@ public abstract class GregtechMetaBoilerBase extends GT_MetaTileEntity_BasicTank public boolean mHadNoWater = false; public long RI = MathUtils.randLong(5L, 30L); - public GregtechMetaBoilerBase( - final int aID, - final String aName, - final String aNameRegional, - final String aDescription, - final ITexture... aTextures) { + public GregtechMetaBoilerBase(final int aID, final String aName, final String aNameRegional, + final String aDescription, final ITexture... aTextures) { super(aID, aName, aNameRegional, 0, 4, aDescription, aTextures); } - public GregtechMetaBoilerBase( - final String aName, final int aTier, final String aDescription, final ITexture[][][] aTextures) { + public GregtechMetaBoilerBase(final String aName, final int aTier, final String aDescription, + final ITexture[][][] aTextures) { super(aName, aTier, 4, aDescription, aTextures); } @Override - public ITexture[] getTexture( - final IGregTechTileEntity aBaseMetaTileEntity, - final byte aSide, - final byte aFacing, - final byte aColorIndex, - final boolean aActive, - final boolean aRedstone) { - ITexture[] tmp = - this.mTextures[aSide >= 2 ? aSide != aFacing ? 2 : ((byte) (aActive ? 4 : 3)) : aSide][aColorIndex + 1]; + public ITexture[] getTexture(final IGregTechTileEntity aBaseMetaTileEntity, final byte aSide, final byte aFacing, + final byte aColorIndex, final boolean aActive, final boolean aRedstone) { + ITexture[] tmp = this.mTextures[aSide >= 2 ? aSide != aFacing ? 2 : ((byte) (aActive ? 4 : 3)) + : aSide][aColorIndex + 1]; // mTextures[(aSide==aFacing?(aActive?4:3):aSide==GT_Utility.getOppositeSide(aFacing)?2:aSide==0?0:aSide==1?1:2)][aColorIndex+1]; if ((aSide != aFacing) && (tmp.length == 2)) { - tmp = new ITexture[] {tmp[0]}; + tmp = new ITexture[] { tmp[0] }; } return tmp; } @@ -186,8 +179,7 @@ public abstract class GregtechMetaBoilerBase extends GT_MetaTileEntity_BasicTank if (this.mSteam != null) { try { aNBT.setTag("mSteam", this.mSteam.writeToNBT(new NBTTagCompound())); - } catch (final Throwable e) { - } + } catch (final Throwable e) {} } } @@ -215,16 +207,16 @@ public abstract class GregtechMetaBoilerBase extends GT_MetaTileEntity_BasicTank if (i != aBaseMetaTileEntity.getFrontFacing()) { final IFluidHandler tTileEntity = aBaseMetaTileEntity.getITankContainerAtSide(i); if (tTileEntity != null) { - final FluidStack tDrained = aBaseMetaTileEntity.drain( - ForgeDirection.getOrientation(i), Math.max(1, this.mSteam.amount / 2), false); + final FluidStack tDrained = aBaseMetaTileEntity + .drain(ForgeDirection.getOrientation(i), Math.max(1, this.mSteam.amount / 2), false); if (tDrained != null) { - final int tFilledAmount = tTileEntity.fill( - ForgeDirection.getOrientation(i).getOpposite(), tDrained, false); + final int tFilledAmount = tTileEntity + .fill(ForgeDirection.getOrientation(i).getOpposite(), tDrained, false); if (tFilledAmount > 0) { tTileEntity.fill( ForgeDirection.getOrientation(i).getOpposite(), - aBaseMetaTileEntity.drain( - ForgeDirection.getOrientation(i), tFilledAmount, true), + aBaseMetaTileEntity + .drain(ForgeDirection.getOrientation(i), tFilledAmount, true), true); } } @@ -257,53 +249,60 @@ public abstract class GregtechMetaBoilerBase extends GT_MetaTileEntity_BasicTank this.sendSound((byte) 1); this.mSteam.amount = getSteamCapacity() * 3 / 4; } - if ((this.mProcessingEnergy <= 0) - && (aBaseMetaTileEntity.isAllowedToWork()) + if ((this.mProcessingEnergy <= 0) && (aBaseMetaTileEntity.isAllowedToWork()) && (this.mInventory[2] != null)) { - if ((GT_OreDictUnificator.isItemStackInstanceOf( - this.mInventory[2], OrePrefixes.gem.get(Materials.Coal))) - || (GT_OreDictUnificator.isItemStackInstanceOf( - this.mInventory[2], OrePrefixes.dust.get(Materials.Coal))) - || (GT_OreDictUnificator.isItemStackInstanceOf( - this.mInventory[2], OrePrefixes.dustImpure.get(Materials.Coal))) - || (GT_OreDictUnificator.isItemStackInstanceOf( - this.mInventory[2], OrePrefixes.crushed.get(Materials.Coal)))) { - this.mProcessingEnergy += 160; - aBaseMetaTileEntity.decrStackSize(2, 1); - if (aBaseMetaTileEntity.getRandomNumber(3) == 0) { - aBaseMetaTileEntity.addStackToSlot( - 3, GT_OreDictUnificator.get(OrePrefixes.dustTiny, Materials.DarkAsh, 1L)); - } - } else if (GT_OreDictUnificator.isItemStackInstanceOf( - this.mInventory[2], OrePrefixes.gem.get(Materials.Charcoal))) { + if ((GT_OreDictUnificator + .isItemStackInstanceOf(this.mInventory[2], OrePrefixes.gem.get(Materials.Coal))) + || (GT_OreDictUnificator + .isItemStackInstanceOf(this.mInventory[2], OrePrefixes.dust.get(Materials.Coal))) + || (GT_OreDictUnificator + .isItemStackInstanceOf(this.mInventory[2], OrePrefixes.dustImpure.get(Materials.Coal))) + || (GT_OreDictUnificator + .isItemStackInstanceOf(this.mInventory[2], OrePrefixes.crushed.get(Materials.Coal)))) { this.mProcessingEnergy += 160; aBaseMetaTileEntity.decrStackSize(2, 1); if (aBaseMetaTileEntity.getRandomNumber(3) == 0) { aBaseMetaTileEntity.addStackToSlot( - 3, GT_OreDictUnificator.get(OrePrefixes.dustTiny, Materials.Ash, 1L)); - } - } else if (GT_OreDictUnificator.isItemStackInstanceOf(this.mInventory[2], "fuelCoke")) { - this.mProcessingEnergy += 640; - aBaseMetaTileEntity.decrStackSize(2, 1); - if (aBaseMetaTileEntity.getRandomNumber(2) == 0) { - aBaseMetaTileEntity.addStackToSlot( - 3, GT_OreDictUnificator.get(OrePrefixes.dustTiny, Materials.Ash, 1L)); - } - } else if ((GT_OreDictUnificator.isItemStackInstanceOf( - this.mInventory[2], OrePrefixes.gem.get(Materials.Lignite))) - || (GT_OreDictUnificator.isItemStackInstanceOf( - this.mInventory[2], OrePrefixes.dust.get(Materials.Lignite))) - || (GT_OreDictUnificator.isItemStackInstanceOf( - this.mInventory[2], OrePrefixes.dustImpure.get(Materials.Lignite))) - || (GT_OreDictUnificator.isItemStackInstanceOf( - this.mInventory[2], OrePrefixes.crushed.get(Materials.Lignite)))) { - this.mProcessingEnergy += 40; - aBaseMetaTileEntity.decrStackSize(2, 1); - if (aBaseMetaTileEntity.getRandomNumber(8) == 0) { - aBaseMetaTileEntity.addStackToSlot( - 3, GT_OreDictUnificator.get(OrePrefixes.dustTiny, Materials.DarkAsh, 1L)); + 3, + GT_OreDictUnificator.get(OrePrefixes.dustTiny, Materials.DarkAsh, 1L)); } - } + } else if (GT_OreDictUnificator + .isItemStackInstanceOf(this.mInventory[2], OrePrefixes.gem.get(Materials.Charcoal))) { + this.mProcessingEnergy += 160; + aBaseMetaTileEntity.decrStackSize(2, 1); + if (aBaseMetaTileEntity.getRandomNumber(3) == 0) { + aBaseMetaTileEntity.addStackToSlot( + 3, + GT_OreDictUnificator.get(OrePrefixes.dustTiny, Materials.Ash, 1L)); + } + } else + if (GT_OreDictUnificator.isItemStackInstanceOf(this.mInventory[2], "fuelCoke")) { + this.mProcessingEnergy += 640; + aBaseMetaTileEntity.decrStackSize(2, 1); + if (aBaseMetaTileEntity.getRandomNumber(2) == 0) { + aBaseMetaTileEntity.addStackToSlot( + 3, + GT_OreDictUnificator.get(OrePrefixes.dustTiny, Materials.Ash, 1L)); + } + } else if ((GT_OreDictUnificator + .isItemStackInstanceOf(this.mInventory[2], OrePrefixes.gem.get(Materials.Lignite))) + || (GT_OreDictUnificator + .isItemStackInstanceOf(this.mInventory[2], OrePrefixes.dust.get(Materials.Lignite))) + || (GT_OreDictUnificator.isItemStackInstanceOf( + this.mInventory[2], + OrePrefixes.dustImpure.get(Materials.Lignite))) + || (GT_OreDictUnificator.isItemStackInstanceOf( + this.mInventory[2], + OrePrefixes.crushed.get(Materials.Lignite)))) { + this.mProcessingEnergy += 40; + aBaseMetaTileEntity.decrStackSize(2, 1); + if (aBaseMetaTileEntity.getRandomNumber(8) == 0) { + aBaseMetaTileEntity.addStackToSlot( + 3, + GT_OreDictUnificator + .get(OrePrefixes.dustTiny, Materials.DarkAsh, 1L)); + } + } } if ((this.mTemperature < 1000) && (this.mProcessingEnergy > 0) && ((aTick % 12L) == 0L)) { this.mProcessingEnergy -= 2; @@ -317,20 +316,19 @@ public abstract class GregtechMetaBoilerBase extends GT_MetaTileEntity_BasicTank // Since this type of machine can have different water and steam capacities, we need to override getTankInfo() to // support returning those different capacities. public FluidTankInfo[] getTankInfo(ForgeDirection aSide) { - return new FluidTankInfo[] { - new FluidTankInfo(this.mFluid, getCapacity()), new FluidTankInfo(this.mSteam, getSteamCapacity()) - }; + return new FluidTankInfo[] { new FluidTankInfo(this.mFluid, getCapacity()), + new FluidTankInfo(this.mSteam, getSteamCapacity()) }; } @Override - public boolean allowPullStack( - final IGregTechTileEntity aBaseMetaTileEntity, final int aIndex, final byte aSide, final ItemStack aStack) { + public boolean allowPullStack(final IGregTechTileEntity aBaseMetaTileEntity, final int aIndex, final byte aSide, + final ItemStack aStack) { return (aIndex == 1) || (aIndex == 3); } @Override - public boolean allowPutStack( - final IGregTechTileEntity aBaseMetaTileEntity, final int aIndex, final byte aSide, final ItemStack aStack) { + public boolean allowPutStack(final IGregTechTileEntity aBaseMetaTileEntity, final int aIndex, final byte aSide, + final ItemStack aStack) { return aIndex == 2; } @@ -339,16 +337,14 @@ public abstract class GregtechMetaBoilerBase extends GT_MetaTileEntity_BasicTank if (aIndex == 1) { GT_Utility.doSoundAtClient(GregTech_API.sSoundList.get(Integer.valueOf(4)), 2, 1.0F, aX, aY, aZ); for (int l = 0; l < 8; l++) { - this.getBaseMetaTileEntity() - .getWorld() - .spawnParticle( - "largesmoke", - (aX - 0.5D) + Math.random(), - aY, - (aZ - 0.5D) + Math.random(), - 0.0D, - 0.0D, - 0.0D); + this.getBaseMetaTileEntity().getWorld().spawnParticle( + "largesmoke", + (aX - 0.5D) + Math.random(), + aY, + (aZ - 0.5D) + Math.random(), + 0.0D, + 0.0D, + 0.0D); } } } diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/base/generators/GregtechMetaSolarGenerator.java b/src/main/java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/base/generators/GregtechMetaSolarGenerator.java index e4a6d4bd44..f76bb372ce 100644 --- a/src/main/java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/base/generators/GregtechMetaSolarGenerator.java +++ b/src/main/java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/base/generators/GregtechMetaSolarGenerator.java @@ -2,13 +2,14 @@ package gtPlusPlus.xmod.gregtech.api.metatileentity.implementations.base.generat import static gregtech.api.enums.GT_Values.V; +import net.minecraft.entity.player.EntityPlayer; + import gregtech.api.enums.Textures; import gregtech.api.gui.modularui.GT_UIInfos; import gregtech.api.interfaces.ITexture; 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; public abstract class GregtechMetaSolarGenerator extends GT_MetaTileEntity_BasicTank { @@ -18,18 +19,13 @@ public abstract class GregtechMetaSolarGenerator extends GT_MetaTileEntity_Basic public int mLossTimer = 0; public static int sEnergyPerTick = 16; - public GregtechMetaSolarGenerator( - final int aID, - final String aName, - final String aNameRegional, - final int aTier, - final String aDescription, - final ITexture... aTextures) { + public GregtechMetaSolarGenerator(final int aID, final String aName, final String aNameRegional, final int aTier, + final String aDescription, final ITexture... aTextures) { super(aID, aName, aNameRegional, aTier, 3, aDescription, aTextures); } - public GregtechMetaSolarGenerator( - final String aName, final int aTier, final String aDescription, final ITexture[][][] aTextures) { + public GregtechMetaSolarGenerator(final String aName, final int aTier, final String aDescription, + final ITexture[][][] aTextures) { super(aName, aTier, 3, aDescription, aTextures); } @@ -52,26 +48,16 @@ public abstract class GregtechMetaSolarGenerator extends GT_MetaTileEntity_Basic } @Override - public ITexture[] getTexture( - final IGregTechTileEntity aBaseMetaTileEntity, - final byte aSide, - final byte aFacing, - final byte aColorIndex, - final boolean aActive, - final boolean aRedstone) { - return this.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(final IGregTechTileEntity aBaseMetaTileEntity, final byte aSide, final byte aFacing, + final byte aColorIndex, final boolean aActive, final boolean aRedstone) { + return this.mTextures[(aActive ? 5 : 0) + (aSide == aFacing ? 0 + : aSide == GT_Utility.getOppositeSide(aFacing) ? 1 : aSide == 0 ? 2 : aSide == 1 ? 3 : 4)][aColorIndex + + 1]; } @Override public String[] getDescription() { - return new String[] {this.mDescription, "Efficiency: " + this.getEfficiency() + "%"}; + return new String[] { this.mDescription, "Efficiency: " + this.getEfficiency() + "%" }; } @Override @@ -84,23 +70,23 @@ public abstract class GregtechMetaSolarGenerator extends GT_MetaTileEntity_Basic } public ITexture[] getFront(final byte aColor) { - return new ITexture[] {Textures.BlockIcons.MACHINE_CASINGS[this.mTier][aColor + 1]}; + return new ITexture[] { Textures.BlockIcons.MACHINE_CASINGS[this.mTier][aColor + 1] }; } public ITexture[] getBack(final byte aColor) { - return new ITexture[] {Textures.BlockIcons.MACHINE_CASINGS[this.mTier][aColor + 1]}; + return new ITexture[] { Textures.BlockIcons.MACHINE_CASINGS[this.mTier][aColor + 1] }; } public ITexture[] getBottom(final byte aColor) { - return new ITexture[] {Textures.BlockIcons.MACHINE_CASINGS[this.mTier][aColor + 1]}; + return new ITexture[] { Textures.BlockIcons.MACHINE_CASINGS[this.mTier][aColor + 1] }; } public ITexture[] getTop(final byte aColor) { - return new ITexture[] {Textures.BlockIcons.MACHINE_CASINGS[this.mTier][aColor + 1]}; + return new ITexture[] { Textures.BlockIcons.MACHINE_CASINGS[this.mTier][aColor + 1] }; } public ITexture[] getSides(final byte aColor) { - return new ITexture[] {Textures.BlockIcons.MACHINE_CASINGS[this.mTier][aColor + 1]}; + return new ITexture[] { Textures.BlockIcons.MACHINE_CASINGS[this.mTier][aColor + 1] }; } public ITexture[] getFrontActive(final byte aColor) { @@ -165,8 +151,7 @@ public abstract class GregtechMetaSolarGenerator extends GT_MetaTileEntity_Basic @Override public void onPostTick(final IGregTechTileEntity aBaseMetaTileEntity, final long aTick) { - if (aBaseMetaTileEntity.isServerSide() - && aBaseMetaTileEntity.isAllowedToWork() + if (aBaseMetaTileEntity.isServerSide() && aBaseMetaTileEntity.isAllowedToWork() && (aTick > 20L) && (aBaseMetaTileEntity.getUniversalEnergyStored() < (this.maxEUOutput() + aBaseMetaTileEntity.getEUCapacity()))) { @@ -182,8 +167,7 @@ public abstract class GregtechMetaSolarGenerator extends GT_MetaTileEntity_Basic if ((aTick % 25L) == 0L) { if (this.mSolarCharge > 100) { - if ((this.mProcessingEnergy > 0) - && (aBaseMetaTileEntity.isAllowedToWork()) + if ((this.mProcessingEnergy > 0) && (aBaseMetaTileEntity.isAllowedToWork()) && ((aTick % 256L) == 0L) && (!aBaseMetaTileEntity.getWorld().isThundering() && (aBaseMetaTileEntity.getUniversalEnergyStored() @@ -199,21 +183,19 @@ public abstract class GregtechMetaSolarGenerator extends GT_MetaTileEntity_Basic this.mSolarCharge += 1; } - if ((this.mProcessingEnergy <= 0) - && (aBaseMetaTileEntity.isAllowedToWork()) + if ((this.mProcessingEnergy <= 0) && (aBaseMetaTileEntity.isAllowedToWork()) && ((aTick % 256L) == 0L) && (!aBaseMetaTileEntity.getWorld().isThundering())) { - final boolean bRain = - aBaseMetaTileEntity.getWorld().isRaining() && (aBaseMetaTileEntity.getBiome().rainfall > 0.0F); + final boolean bRain = aBaseMetaTileEntity.getWorld().isRaining() + && (aBaseMetaTileEntity.getBiome().rainfall > 0.0F); this.mProcessingEnergy += (bRain && (aBaseMetaTileEntity.getWorld().skylightSubtracted >= 4)) - || !aBaseMetaTileEntity.getSkyAtSide((byte) 1) - ? 0 - : !bRain && aBaseMetaTileEntity.getWorld().isDaytime() ? 8 : 1; + || !aBaseMetaTileEntity.getSkyAtSide((byte) 1) ? 0 + : !bRain && aBaseMetaTileEntity.getWorld().isDaytime() ? 8 : 1; } if (aBaseMetaTileEntity.isServerSide()) { - aBaseMetaTileEntity.setActive(aBaseMetaTileEntity.isAllowedToWork() - && (aBaseMetaTileEntity.getUniversalEnergyStored() + aBaseMetaTileEntity.setActive( + aBaseMetaTileEntity.isAllowedToWork() && (aBaseMetaTileEntity.getUniversalEnergyStored() >= (this.maxEUOutput() + this.getMinimumStoredEU()))); } } diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/base/generators/GregtechRocketFuelGeneratorBase.java b/src/main/java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/base/generators/GregtechRocketFuelGeneratorBase.java index db9527c144..bd88b5cb82 100644 --- a/src/main/java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/base/generators/GregtechRocketFuelGeneratorBase.java +++ b/src/main/java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/base/generators/GregtechRocketFuelGeneratorBase.java @@ -2,6 +2,13 @@ package gtPlusPlus.xmod.gregtech.api.metatileentity.implementations.base.generat import static gregtech.api.enums.GT_Values.V; +import java.util.Collection; + +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.init.Blocks; +import net.minecraft.item.ItemStack; +import net.minecraftforge.fluids.FluidStack; + import gregtech.api.enums.Textures; import gregtech.api.gui.modularui.GT_UIInfos; import gregtech.api.interfaces.ITexture; @@ -13,24 +20,14 @@ import gregtech.api.util.GT_Utility; import gtPlusPlus.core.lib.CORE; import gtPlusPlus.core.util.math.MathUtils; import gtPlusPlus.core.util.minecraft.gregtech.PollutionUtils; -import java.util.Collection; -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.init.Blocks; -import net.minecraft.item.ItemStack; -import net.minecraftforge.fluids.FluidStack; public abstract class GregtechRocketFuelGeneratorBase extends GT_MetaTileEntity_BasicTank { private boolean useFuel = false; protected int pollMin, pollMax; - public GregtechRocketFuelGeneratorBase( - final int aID, - final String aName, - final String aNameRegional, - final int aTier, - final String aDescription, - final ITexture... aTextures) { + public GregtechRocketFuelGeneratorBase(final int aID, final String aName, final String aNameRegional, + final int aTier, final String aDescription, final ITexture... aTextures) { super(aID, aName, aNameRegional, aTier, 3, aDescription, aTextures); pollMin = (int) (CORE.ConfigSwitches.baseMinPollutionPerSecondRocketFuelGenerator * CORE.ConfigSwitches.pollutionReleasedByTierRocketFuelGenerator[mTier]); @@ -38,8 +35,8 @@ public abstract class GregtechRocketFuelGeneratorBase extends GT_MetaTileEntity_ * CORE.ConfigSwitches.pollutionReleasedByTierRocketFuelGenerator[mTier]); } - public GregtechRocketFuelGeneratorBase( - final String aName, final int aTier, final String aDescription, final ITexture[][][] aTextures) { + public GregtechRocketFuelGeneratorBase(final String aName, final int aTier, final String aDescription, + final ITexture[][][] aTextures) { super(aName, aTier, 3, aDescription, aTextures); pollMin = (int) (CORE.ConfigSwitches.baseMinPollutionPerSecondRocketFuelGenerator * CORE.ConfigSwitches.pollutionReleasedByTierRocketFuelGenerator[mTier]); @@ -66,29 +63,18 @@ public abstract class GregtechRocketFuelGeneratorBase extends GT_MetaTileEntity_ } @Override - public ITexture[] getTexture( - final IGregTechTileEntity aBaseMetaTileEntity, - final byte aSide, - final byte aFacing, - final byte aColorIndex, - final boolean aActive, - final boolean aRedstone) { - return this.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(final IGregTechTileEntity aBaseMetaTileEntity, final byte aSide, final byte aFacing, + final byte aColorIndex, final boolean aActive, final boolean aRedstone) { + return this.mTextures[(aActive ? 5 : 0) + (aSide == aFacing ? 0 + : aSide == GT_Utility.getOppositeSide(aFacing) ? 1 : aSide == 0 ? 2 : aSide == 1 ? 3 : 4)][aColorIndex + + 1]; } @Override public String[] getDescription() { String aPollution = "Causes between " + pollMin + " and " + pollMax + " Pollution per second"; - return new String[] { - this.mDescription, "Fuel Efficiency: " + this.getEfficiency() + "%", aPollution, CORE.GT_Tooltip - }; + return new String[] { this.mDescription, "Fuel Efficiency: " + this.getEfficiency() + "%", aPollution, + CORE.GT_Tooltip }; } @Override @@ -98,23 +84,23 @@ public abstract class GregtechRocketFuelGeneratorBase extends GT_MetaTileEntity_ } public ITexture[] getFront(final byte aColor) { - return new ITexture[] {Textures.BlockIcons.MACHINE_CASINGS[this.mTier][aColor + 1]}; + return new ITexture[] { Textures.BlockIcons.MACHINE_CASINGS[this.mTier][aColor + 1] }; } public ITexture[] getBack(final byte aColor) { - return new ITexture[] {Textures.BlockIcons.MACHINE_CASINGS[this.mTier][aColor + 1]}; + return new ITexture[] { Textures.BlockIcons.MACHINE_CASINGS[this.mTier][aColor + 1] }; } public ITexture[] getBottom(final byte aColor) { - return new ITexture[] {Textures.BlockIcons.MACHINE_CASINGS[this.mTier][aColor + 1]}; + return new ITexture[] { Textures.BlockIcons.MACHINE_CASINGS[this.mTier][aColor + 1] }; } public ITexture[] getTop(final byte aColor) { - return new ITexture[] {Textures.BlockIcons.MACHINE_CASINGS[this.mTier][aColor + 1]}; + return new ITexture[] { Textures.BlockIcons.MACHINE_CASINGS[this.mTier][aColor + 1] }; } public ITexture[] getSides(final byte aColor) { - return new ITexture[] {Textures.BlockIcons.MACHINE_CASINGS[this.mTier][aColor + 1]}; + return new ITexture[] { Textures.BlockIcons.MACHINE_CASINGS[this.mTier][aColor + 1] }; } public ITexture[] getFrontActive(final byte aColor) { @@ -217,53 +203,33 @@ public abstract class GregtechRocketFuelGeneratorBase extends GT_MetaTileEntity_ // super.onPostTick(aBaseMetaTileEntity, aTick); - /*if (aBaseMetaTileEntity.isServerSide() && aBaseMetaTileEntity.isAllowedToWork() && aTick % 10L == 0L) { - int tFuelValue; - if (this.mFluid == null) { - if (aBaseMetaTileEntity.getUniversalEnergyStored() < this.maxEUOutput() + this.getMinimumStoredEU()) { - this.mInventory[this.getStackDisplaySlot()] = null; - } else { - if (this.mInventory[this.getStackDisplaySlot()] == null) { - this.mInventory[this.getStackDisplaySlot()] = new ItemStack(Blocks.fire, 1); - } - - this.mInventory[this.getStackDisplaySlot()].setStackDisplayName("Generating: " - + (aBaseMetaTileEntity.getUniversalEnergyStored() - this.getMinimumStoredEU()) + " EU"); - } - } else { - tFuelValue = this.getFuelValue(this.mFluid); - int tConsumed = this.consumedFluidPerOperation(this.mFluid); - if (tFuelValue > 0 && tConsumed > 0 && this.mFluid.amount > tConsumed) { - long tFluidAmountToUse = Math.min((long) (this.mFluid.amount / tConsumed), - (this.maxEUStore() - aBaseMetaTileEntity.getUniversalEnergyStored()) / (long) tFuelValue); - if (tFluidAmountToUse > 0L && aBaseMetaTileEntity - .increaseStoredEnergyUnits(tFluidAmountToUse * (long) tFuelValue, true)) { - PollutionUtils.addPollution(this.getBaseMetaTileEntity(), 10 * this.getPollution()); - this.mFluid.amount = (int) ((long) this.mFluid.amount - tFluidAmountToUse * (long) tConsumed); - } - } - } - - if (this.mInventory[this.getInputSlot()] != null - && aBaseMetaTileEntity.getUniversalEnergyStored() < this.maxEUOutput() * 20L - + this.getMinimumStoredEU() - && GT_Utility.getFluidForFilledItem(this.mInventory[this.getInputSlot()], true) == null) { - tFuelValue = this.getFuelValue(this.mInventory[this.getInputSlot()]); - if (tFuelValue > 0) { - ItemStack tEmptyContainer = this.getEmptyContainer(this.mInventory[this.getInputSlot()]); - if (aBaseMetaTileEntity.addStackToSlot(this.getOutputSlot(), tEmptyContainer)) { - aBaseMetaTileEntity.increaseStoredEnergyUnits((long) tFuelValue, true); - aBaseMetaTileEntity.decrStackSize(this.getInputSlot(), 1); - PollutionUtils.addPollution(this.getBaseMetaTileEntity(), 10 * this.getPollution()); - } - } - } - } - - if (aBaseMetaTileEntity.isServerSide()) { - aBaseMetaTileEntity.setActive(aBaseMetaTileEntity.isAllowedToWork() && aBaseMetaTileEntity - .getUniversalEnergyStored() >= this.maxEUOutput() + this.getMinimumStoredEU()); - }*/ + /* + * if (aBaseMetaTileEntity.isServerSide() && aBaseMetaTileEntity.isAllowedToWork() && aTick % 10L == 0L) { int + * tFuelValue; if (this.mFluid == null) { if (aBaseMetaTileEntity.getUniversalEnergyStored() < + * this.maxEUOutput() + this.getMinimumStoredEU()) { this.mInventory[this.getStackDisplaySlot()] = null; } else + * { if (this.mInventory[this.getStackDisplaySlot()] == null) { this.mInventory[this.getStackDisplaySlot()] = + * new ItemStack(Blocks.fire, 1); } + * this.mInventory[this.getStackDisplaySlot()].setStackDisplayName("Generating: " + + * (aBaseMetaTileEntity.getUniversalEnergyStored() - this.getMinimumStoredEU()) + " EU"); } } else { tFuelValue + * = this.getFuelValue(this.mFluid); int tConsumed = this.consumedFluidPerOperation(this.mFluid); if (tFuelValue + * > 0 && tConsumed > 0 && this.mFluid.amount > tConsumed) { long tFluidAmountToUse = Math.min((long) + * (this.mFluid.amount / tConsumed), (this.maxEUStore() - aBaseMetaTileEntity.getUniversalEnergyStored()) / + * (long) tFuelValue); if (tFluidAmountToUse > 0L && aBaseMetaTileEntity + * .increaseStoredEnergyUnits(tFluidAmountToUse * (long) tFuelValue, true)) { + * PollutionUtils.addPollution(this.getBaseMetaTileEntity(), 10 * this.getPollution()); this.mFluid.amount = + * (int) ((long) this.mFluid.amount - tFluidAmountToUse * (long) tConsumed); } } } if + * (this.mInventory[this.getInputSlot()] != null && aBaseMetaTileEntity.getUniversalEnergyStored() < + * this.maxEUOutput() * 20L + this.getMinimumStoredEU() && + * GT_Utility.getFluidForFilledItem(this.mInventory[this.getInputSlot()], true) == null) { tFuelValue = + * this.getFuelValue(this.mInventory[this.getInputSlot()]); if (tFuelValue > 0) { ItemStack tEmptyContainer = + * this.getEmptyContainer(this.mInventory[this.getInputSlot()]); if + * (aBaseMetaTileEntity.addStackToSlot(this.getOutputSlot(), tEmptyContainer)) { + * aBaseMetaTileEntity.increaseStoredEnergyUnits((long) tFuelValue, true); + * aBaseMetaTileEntity.decrStackSize(this.getInputSlot(), 1); + * PollutionUtils.addPollution(this.getBaseMetaTileEntity(), 10 * this.getPollution()); } } } } if + * (aBaseMetaTileEntity.isServerSide()) { aBaseMetaTileEntity.setActive(aBaseMetaTileEntity.isAllowedToWork() && + * aBaseMetaTileEntity .getUniversalEnergyStored() >= this.maxEUOutput() + this.getMinimumStoredEU()); } + */ if (aBaseMetaTileEntity.isServerSide() && aBaseMetaTileEntity.isAllowedToWork() && ((aTick % 10) == 0)) { if (this.mFluid == null) { @@ -273,8 +239,10 @@ public abstract class GregtechRocketFuelGeneratorBase extends GT_MetaTileEntity_ if (this.mInventory[this.getStackDisplaySlot()] == null) { this.mInventory[this.getStackDisplaySlot()] = new ItemStack(Blocks.fire, 1); } - this.mInventory[this.getStackDisplaySlot()].setStackDisplayName("Generating: " - + (aBaseMetaTileEntity.getUniversalEnergyStored() - this.getMinimumStoredEU()) + " EU"); + this.mInventory[this.getStackDisplaySlot()].setStackDisplayName( + "Generating: " + + (aBaseMetaTileEntity.getUniversalEnergyStored() - this.getMinimumStoredEU()) + + " EU"); } } else { final int tFuelValue = this.getFuelValue(this.mFluid), @@ -283,8 +251,7 @@ public abstract class GregtechRocketFuelGeneratorBase extends GT_MetaTileEntity_ final long tFluidAmountToUse = Math.min( this.mFluid.amount / tConsumed, (((this.maxEUOutput() * 20) + this.getMinimumStoredEU()) - - aBaseMetaTileEntity.getUniversalEnergyStored()) - / tFuelValue); + - aBaseMetaTileEntity.getUniversalEnergyStored()) / tFuelValue); if ((tFluidAmountToUse > 0) && aBaseMetaTileEntity.increaseStoredEnergyUnits(tFluidAmountToUse * tFuelValue, true)) { int aSafeFloor = (int) Math.max(((tFluidAmountToUse * tConsumed) / 3), 1); @@ -310,8 +277,8 @@ public abstract class GregtechRocketFuelGeneratorBase extends GT_MetaTileEntity_ } if (aBaseMetaTileEntity.isServerSide()) { - aBaseMetaTileEntity.setActive(aBaseMetaTileEntity.isAllowedToWork() - && (aBaseMetaTileEntity.getUniversalEnergyStored() + aBaseMetaTileEntity.setActive( + aBaseMetaTileEntity.isAllowedToWork() && (aBaseMetaTileEntity.getUniversalEnergyStored() >= (this.maxEUOutput() + this.getMinimumStoredEU()))); } } @@ -361,8 +328,8 @@ public abstract class GregtechRocketFuelGeneratorBase extends GT_MetaTileEntity_ if (GT_Utility.isStackInvalid(aStack) || (this.getRecipes() == null)) { return 0; } - final GT_Recipe tFuel = - this.getRecipes().findRecipe(this.getBaseMetaTileEntity(), false, Long.MAX_VALUE, null, aStack); + final GT_Recipe tFuel = this.getRecipes() + .findRecipe(this.getBaseMetaTileEntity(), false, Long.MAX_VALUE, null, aStack); if (tFuel != null) { return (int) ((tFuel.mSpecialValue * 1000L * this.getEfficiency()) / 100); } @@ -373,8 +340,8 @@ public abstract class GregtechRocketFuelGeneratorBase extends GT_MetaTileEntity_ if (GT_Utility.isStackInvalid(aStack) || (this.getRecipes() == null)) { return null; } - final GT_Recipe tFuel = - this.getRecipes().findRecipe(this.getBaseMetaTileEntity(), false, Long.MAX_VALUE, null, aStack); + final GT_Recipe tFuel = this.getRecipes() + .findRecipe(this.getBaseMetaTileEntity(), false, Long.MAX_VALUE, null, aStack); if (tFuel != null) { return GT_Utility.copy(tFuel.getOutput(0)); } @@ -382,11 +349,10 @@ public abstract class GregtechRocketFuelGeneratorBase extends GT_MetaTileEntity_ } @Override - public boolean allowPutStack( - final IGregTechTileEntity aBaseMetaTileEntity, final int aIndex, final byte aSide, final ItemStack aStack) { - return super.allowPutStack(aBaseMetaTileEntity, aIndex, aSide, aStack) - && ((this.getFuelValue(aStack) > 0) - || (this.getFuelValue(GT_Utility.getFluidForFilledItem(aStack, true)) > 0)); + public boolean allowPutStack(final IGregTechTileEntity aBaseMetaTileEntity, final int aIndex, final byte aSide, + final ItemStack aStack) { + return super.allowPutStack(aBaseMetaTileEntity, aIndex, aSide, aStack) && ((this.getFuelValue(aStack) > 0) + || (this.getFuelValue(GT_Utility.getFluidForFilledItem(aStack, true)) > 0)); } @Override diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/base/machines/GregtechMetaSafeBlockBase.java b/src/main/java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/base/machines/GregtechMetaSafeBlockBase.java index 5ad0a611a5..efd2a123db 100644 --- a/src/main/java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/base/machines/GregtechMetaSafeBlockBase.java +++ b/src/main/java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/base/machines/GregtechMetaSafeBlockBase.java @@ -2,6 +2,12 @@ package gtPlusPlus.xmod.gregtech.api.metatileentity.implementations.base.machine import static gregtech.api.enums.GT_Values.V; +import java.util.UUID; + +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.item.ItemStack; +import net.minecraft.nbt.NBTTagCompound; + import gregtech.api.enums.Textures; import gregtech.api.gui.modularui.GT_UIInfos; import gregtech.api.interfaces.ITexture; @@ -12,68 +18,75 @@ import gregtech.api.util.GT_Utility; import gtPlusPlus.api.objects.Logger; import gtPlusPlus.core.util.minecraft.PlayerUtils; import gtPlusPlus.core.util.player.PlayerCache; -import java.util.UUID; -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.item.ItemStack; -import net.minecraft.nbt.NBTTagCompound; public abstract class GregtechMetaSafeBlockBase extends GT_MetaTileEntity_TieredMachineBlock { + public boolean bOutput = false, bRedstoneIfFull = false, bInvert = false, bUnbreakable = false; public int mSuccess = 0, mTargetStackSize = 0; public UUID ownerUUID; // UnbreakableBlockManager Xasda = new UnbreakableBlockManager(); private boolean value_last = false, value_current = false; - public GregtechMetaSafeBlockBase( - final int aID, - final String aName, - final String aNameRegional, - final int aTier, - final int aInvSlotCount, - final String aDescription) { + public GregtechMetaSafeBlockBase(final int aID, final String aName, final String aNameRegional, final int aTier, + final int aInvSlotCount, final String aDescription) { super(aID, aName, aNameRegional, aTier, aInvSlotCount, aDescription); } - public GregtechMetaSafeBlockBase( - final String aName, - final int aTier, - final int aInvSlotCount, - final String aDescription, - final ITexture[][][] aTextures) { + public GregtechMetaSafeBlockBase(final String aName, final int aTier, final int aInvSlotCount, + final String aDescription, final ITexture[][][] aTextures) { super(aName, aTier, aInvSlotCount, aDescription, aTextures); } @Override public ITexture[][][] getTextureSet(final ITexture[] aTextures) { final ITexture[][][] rTextures = new ITexture[6][17][]; - final ITexture tIcon = this.getOverlayIcon(), - tOut = new GT_RenderedTexture(Textures.BlockIcons.OVERLAY_QCHEST), + final ITexture tIcon = this.getOverlayIcon(), tOut = new GT_RenderedTexture(Textures.BlockIcons.OVERLAY_QCHEST), tUp = new GT_RenderedTexture(Textures.BlockIcons.MACHINE_CASING_VENT); for (byte i = -1; i < 16; i++) { - rTextures[0][i + 1] = - new ITexture[] {Textures.BlockIcons.MACHINE_CASINGS[this.mTier][i + 1], tUp, tIcon}; // Back - rTextures[1][i + 1] = new ITexture[] {Textures.BlockIcons.MACHINE_CASINGS[this.mTier][i + 1], tIcon - }; // Right, Strangely The top side as well when facing East? - rTextures[2][i + 1] = new ITexture[] {Textures.BlockIcons.MACHINE_CASINGS[this.mTier][i + 1], tIcon - }; // Top And Bottom, When Facing South (What the hell?) - rTextures[3][i + 1] = new ITexture[] {Textures.BlockIcons.MACHINE_CASINGS[this.mTier][i + 1], tIcon - }; // Left, Top if facing West and Bottom if facing east? - rTextures[4][i + 1] = new ITexture[] {Textures.BlockIcons.MACHINE_CASINGS[this.mTier][i + 1], tIcon - }; // Top and Bottom when Facing North.. - rTextures[5][i + 1] = - new ITexture[] {Textures.BlockIcons.MACHINE_CASINGS[this.mTier][i + 1], tOut}; // Front + rTextures[0][i + 1] = new ITexture[] { Textures.BlockIcons.MACHINE_CASINGS[this.mTier][i + 1], tUp, tIcon }; // Back + rTextures[1][i + 1] = new ITexture[] { Textures.BlockIcons.MACHINE_CASINGS[this.mTier][i + 1], tIcon }; // Right, + // Strangely + // The + // top + // side + // as + // well + // when + // facing + // East? + rTextures[2][i + 1] = new ITexture[] { Textures.BlockIcons.MACHINE_CASINGS[this.mTier][i + 1], tIcon }; // Top + // And + // Bottom, + // When + // Facing + // South + // (What + // the + // hell?) + rTextures[3][i + 1] = new ITexture[] { Textures.BlockIcons.MACHINE_CASINGS[this.mTier][i + 1], tIcon }; // Left, + // Top + // if + // facing + // West + // and + // Bottom + // if + // facing + // east? + rTextures[4][i + 1] = new ITexture[] { Textures.BlockIcons.MACHINE_CASINGS[this.mTier][i + 1], tIcon }; // Top + // and + // Bottom + // when + // Facing + // North.. + rTextures[5][i + 1] = new ITexture[] { Textures.BlockIcons.MACHINE_CASINGS[this.mTier][i + 1], tOut }; // Front } return rTextures; } @Override - public ITexture[] getTexture( - final IGregTechTileEntity aBaseMetaTileEntity, - final byte aSide, - final byte aFacing, - final byte aColorIndex, - final boolean aActive, - final boolean aRedstone) { + public ITexture[] getTexture(final IGregTechTileEntity aBaseMetaTileEntity, final byte aSide, final byte aFacing, + final byte aColorIndex, final boolean aActive, final boolean aRedstone) { if (aSide == aFacing) { return this.mTextures[5][aColorIndex + 1]; } @@ -219,16 +232,19 @@ public abstract class GregtechMetaSafeBlockBase extends GT_MetaTileEntity_Tiered } if (aPlayer != null) { final UUID tempUUID = aPlayer.getUniqueID(); - /*if (!aPlayer.worldObj.isRemote){ - //PlayerCache.appendParamChanges(aPlayer.getDisplayName(), aPlayer.getUniqueID().toString()); - }*/ + /* + * if (!aPlayer.worldObj.isRemote){ //PlayerCache.appendParamChanges(aPlayer.getDisplayName(), + * aPlayer.getUniqueID().toString()); } + */ // Utils.LOG_INFO("test"); if (this.ownerUUID == null) { Logger.INFO("No owner yet for this block."); } else { // Utils.LOG_INFO("test"); - Logger.INFO("Current Owner: " + PlayerCache.lookupPlayerByUUID(this.ownerUUID) + " - UUID: " - + this.ownerUUID); + Logger.INFO( + "Current Owner: " + PlayerCache.lookupPlayerByUUID(this.ownerUUID) + + " - UUID: " + + this.ownerUUID); } Logger.WARNING("Is ownerUUID Null"); if (this.ownerUUID == null) { @@ -250,19 +266,21 @@ public abstract class GregtechMetaSafeBlockBase extends GT_MetaTileEntity_Tiered } else { PlayerUtils.messagePlayer(aPlayer, "Access Denied, This does not belong to you."); PlayerUtils.messagePlayer( - aPlayer, "it is owned by: " + PlayerCache.lookupPlayerByUUID(this.ownerUUID)); + aPlayer, + "it is owned by: " + PlayerCache.lookupPlayerByUUID(this.ownerUUID)); Logger.WARNING("Expecting Player : " + PlayerCache.lookupPlayerByUUID(this.ownerUUID)); Logger.ERROR("Access Denied."); return true; } } - /*else { - Utils.LOG_ERROR("This is NOT good. Tell Draknyte1 your safe broke."); - }*/ - /*Utils.LOG_WARNING("Clicky Clicky."); - Utils.messagePlayer(aPlayer, "Owner of this safe, now set."); - aBaseMetaTileEntity.openGUI(aPlayer); */ + /* + * else { Utils.LOG_ERROR("This is NOT good. Tell Draknyte1 your safe broke."); } + */ + /* + * Utils.LOG_WARNING("Clicky Clicky."); Utils.messagePlayer(aPlayer, "Owner of this safe, now set."); + * aBaseMetaTileEntity.openGUI(aPlayer); + */ } return true; @@ -299,14 +317,14 @@ public abstract class GregtechMetaSafeBlockBase extends GT_MetaTileEntity_Tiered } @Override - public boolean allowPullStack( - final IGregTechTileEntity aBaseMetaTileEntity, final int aIndex, final byte aSide, final ItemStack aStack) { + public boolean allowPullStack(final IGregTechTileEntity aBaseMetaTileEntity, final int aIndex, final byte aSide, + final ItemStack aStack) { return false; } @Override - public boolean allowPutStack( - final IGregTechTileEntity aBaseMetaTileEntity, final int aIndex, final byte aSide, final ItemStack aStack) { + public boolean allowPutStack(final IGregTechTileEntity aBaseMetaTileEntity, final int aIndex, final byte aSide, + final ItemStack aStack) { return aSide != aBaseMetaTileEntity.getBackFacing(); } } diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/base/machines/GregtechMetaTreeFarmerBase.java b/src/main/java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/base/machines/GregtechMetaTreeFarmerBase.java index 39d61acebc..01a5c38aef 100644 --- a/src/main/java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/base/machines/GregtechMetaTreeFarmerBase.java +++ b/src/main/java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/base/machines/GregtechMetaTreeFarmerBase.java @@ -1,34 +1,27 @@ package gtPlusPlus.xmod.gregtech.api.metatileentity.implementations.base.machines; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.item.ItemStack; + import gregtech.api.interfaces.ITexture; import gregtech.api.interfaces.tileentity.IGregTechTileEntity; import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_TieredMachineBlock; import gregtech.api.objects.GT_RenderedTexture; import gregtech.api.util.GT_Utility; import gtPlusPlus.xmod.gregtech.common.blocks.textures.TexturesGtBlock; -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.item.ItemStack; public abstract class GregtechMetaTreeFarmerBase extends GT_MetaTileEntity_TieredMachineBlock { + public boolean bOutput = false, bRedstoneIfFull = false, bInvert = false, bUnbreakable = false; public int mSuccess = 0, mTargetStackSize = 0; - public GregtechMetaTreeFarmerBase( - final int aID, - final String aName, - final String aNameRegional, - final int aTier, - final int aInvSlotCount, - final String aDescription) { + public GregtechMetaTreeFarmerBase(final int aID, final String aName, final String aNameRegional, final int aTier, + final int aInvSlotCount, final String aDescription) { super(aID, aName, aNameRegional, aTier, aInvSlotCount, aDescription); } - public GregtechMetaTreeFarmerBase( - final String aName, - final int aTier, - final int aInvSlotCount, - final String aDescription, - final ITexture[][][] aTextures) { + public GregtechMetaTreeFarmerBase(final String aName, final int aTier, final int aInvSlotCount, + final String aDescription, final ITexture[][][] aTextures) { super(aName, aTier, aInvSlotCount, aDescription, aTextures); } @@ -51,21 +44,11 @@ public abstract class GregtechMetaTreeFarmerBase extends GT_MetaTileEntity_Tiere } @Override - public ITexture[] getTexture( - final IGregTechTileEntity aBaseMetaTileEntity, - final byte aSide, - final byte aFacing, - final byte aColorIndex, - final boolean aActive, - final boolean aRedstone) { - return this.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(final IGregTechTileEntity aBaseMetaTileEntity, final byte aSide, final byte aFacing, + final byte aColorIndex, final boolean aActive, final boolean aRedstone) { + return this.mTextures[(aActive ? 5 : 0) + (aSide == aFacing ? 0 + : aSide == GT_Utility.getOppositeSide(aFacing) ? 1 : aSide == 0 ? 2 : aSide == 1 ? 3 : 4)][aColorIndex + + 1]; } @Override @@ -146,35 +129,35 @@ public abstract class GregtechMetaTreeFarmerBase extends GT_MetaTileEntity_Tiere public abstract ITexture getOverlayIcon(); @Override - public boolean allowPullStack( - final IGregTechTileEntity aBaseMetaTileEntity, final int aIndex, final byte aSide, final ItemStack aStack) { + public boolean allowPullStack(final IGregTechTileEntity aBaseMetaTileEntity, final int aIndex, final byte aSide, + final ItemStack aStack) { return false; } @Override - public boolean allowPutStack( - final IGregTechTileEntity aBaseMetaTileEntity, final int aIndex, final byte aSide, final ItemStack aStack) { + public boolean allowPutStack(final IGregTechTileEntity aBaseMetaTileEntity, final int aIndex, final byte aSide, + final ItemStack aStack) { return false; } public ITexture[] getFront(final byte aColor) { - return new ITexture[] {new GT_RenderedTexture(TexturesGtBlock.Casing_Machine_Farm_Manager)}; + return new ITexture[] { new GT_RenderedTexture(TexturesGtBlock.Casing_Machine_Farm_Manager) }; } public ITexture[] getBack(final byte aColor) { - return new ITexture[] {new GT_RenderedTexture(TexturesGtBlock.Casing_Machine_Farm_Manager)}; + return new ITexture[] { new GT_RenderedTexture(TexturesGtBlock.Casing_Machine_Farm_Manager) }; } public ITexture[] getBottom(final byte aColor) { - return new ITexture[] {new GT_RenderedTexture(TexturesGtBlock.Casing_Machine_Acacia_Log)}; + return new ITexture[] { new GT_RenderedTexture(TexturesGtBlock.Casing_Machine_Acacia_Log) }; } public ITexture[] getTop(final byte aColor) { - return new ITexture[] {new GT_RenderedTexture(TexturesGtBlock.Casing_Machine_Podzol)}; + return new ITexture[] { new GT_RenderedTexture(TexturesGtBlock.Casing_Machine_Podzol) }; } public ITexture[] getSides(final byte aColor) { - return new ITexture[] {new GT_RenderedTexture(TexturesGtBlock.Casing_Machine_Farm_Manager)}; + return new ITexture[] { new GT_RenderedTexture(TexturesGtBlock.Casing_Machine_Farm_Manager) }; } public ITexture[] getFrontActive(final byte aColor) { diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/nbthandlers/GT_MetaTileEntity_Hatch_Catalysts.java b/src/main/java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/nbthandlers/GT_MetaTileEntity_Hatch_Catalysts.java index 46666114c1..77fc114b02 100644 --- a/src/main/java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/nbthandlers/GT_MetaTileEntity_Hatch_Catalysts.java +++ b/src/main/java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/nbthandlers/GT_MetaTileEntity_Hatch_Catalysts.java @@ -1,12 +1,13 @@ package gtPlusPlus.xmod.gregtech.api.metatileentity.implementations.nbthandlers; +import net.minecraft.item.ItemStack; + import gregtech.api.interfaces.ITexture; import gregtech.api.objects.GT_RenderedTexture; import gtPlusPlus.api.objects.data.AutoMap; import gtPlusPlus.core.lib.CORE; import gtPlusPlus.core.util.minecraft.ItemUtils; import gtPlusPlus.xmod.gregtech.common.blocks.textures.TexturesGtBlock; -import net.minecraft.item.ItemStack; public class GT_MetaTileEntity_Hatch_Catalysts extends GT_MetaTileEntity_Hatch_NbtConsumable { @@ -24,17 +25,17 @@ public class GT_MetaTileEntity_Hatch_Catalysts extends GT_MetaTileEntity_Hatch_N @Override public ITexture[] getTexturesActive(ITexture aBaseTexture) { - return new ITexture[] {aBaseTexture, new GT_RenderedTexture(TexturesGtBlock.Overlay_Bus_Catalyst)}; + return new ITexture[] { aBaseTexture, new GT_RenderedTexture(TexturesGtBlock.Overlay_Bus_Catalyst) }; } @Override public ITexture[] getTexturesInactive(ITexture aBaseTexture) { - return new ITexture[] {aBaseTexture, new GT_RenderedTexture(TexturesGtBlock.Overlay_Bus_Catalyst)}; + return new ITexture[] { aBaseTexture, new GT_RenderedTexture(TexturesGtBlock.Overlay_Bus_Catalyst) }; } @Override public String[] getDescription() { - return new String[] {this.mDescription, CORE.GT_Tooltip}; + return new String[] { this.mDescription, CORE.GT_Tooltip }; } @Override diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/nbthandlers/GT_MetaTileEntity_Hatch_MillingBalls.java b/src/main/java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/nbthandlers/GT_MetaTileEntity_Hatch_MillingBalls.java index 265088a9e0..e73a70d1eb 100644 --- a/src/main/java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/nbthandlers/GT_MetaTileEntity_Hatch_MillingBalls.java +++ b/src/main/java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/nbthandlers/GT_MetaTileEntity_Hatch_MillingBalls.java @@ -1,12 +1,13 @@ package gtPlusPlus.xmod.gregtech.api.metatileentity.implementations.nbthandlers; +import net.minecraft.item.ItemStack; + import gregtech.api.interfaces.ITexture; import gregtech.api.objects.GT_RenderedTexture; import gtPlusPlus.api.objects.data.AutoMap; import gtPlusPlus.core.lib.CORE; import gtPlusPlus.core.util.minecraft.ItemUtils; import gtPlusPlus.xmod.gregtech.common.blocks.textures.TexturesGtBlock; -import net.minecraft.item.ItemStack; public class GT_MetaTileEntity_Hatch_MillingBalls extends GT_MetaTileEntity_Hatch_NbtConsumable { @@ -24,17 +25,17 @@ public class GT_MetaTileEntity_Hatch_MillingBalls extends GT_MetaTileEntity_Hatc @Override public ITexture[] getTexturesActive(ITexture aBaseTexture) { - return new ITexture[] {aBaseTexture, new GT_RenderedTexture(TexturesGtBlock.Overlay_Bus_Milling_Balls)}; + return new ITexture[] { aBaseTexture, new GT_RenderedTexture(TexturesGtBlock.Overlay_Bus_Milling_Balls) }; } @Override public ITexture[] getTexturesInactive(ITexture aBaseTexture) { - return new ITexture[] {aBaseTexture, new GT_RenderedTexture(TexturesGtBlock.Overlay_Bus_Milling_Balls)}; + return new ITexture[] { aBaseTexture, new GT_RenderedTexture(TexturesGtBlock.Overlay_Bus_Milling_Balls) }; } @Override public String[] getDescription() { - return new String[] {this.mDescription, CORE.GT_Tooltip}; + return new String[] { this.mDescription, CORE.GT_Tooltip }; } @Override diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/nbthandlers/GT_MetaTileEntity_Hatch_NbtConsumable.java b/src/main/java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/nbthandlers/GT_MetaTileEntity_Hatch_NbtConsumable.java index 552386e72c..5bfe3f21f6 100644 --- a/src/main/java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/nbthandlers/GT_MetaTileEntity_Hatch_NbtConsumable.java +++ b/src/main/java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/nbthandlers/GT_MetaTileEntity_Hatch_NbtConsumable.java @@ -1,10 +1,16 @@ package gtPlusPlus.xmod.gregtech.api.metatileentity.implementations.nbthandlers; +import java.lang.reflect.Constructor; + +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.item.ItemStack; + import com.gtnewhorizons.modularui.api.screen.ModularWindow; import com.gtnewhorizons.modularui.api.screen.UIBuildContext; import com.gtnewhorizons.modularui.common.widget.DrawableWidget; import com.gtnewhorizons.modularui.common.widget.SlotGroup; import com.gtnewhorizons.modularui.common.widget.TextWidget; + import gregtech.api.gui.modularui.GT_UIInfos; import gregtech.api.interfaces.ITexture; import gregtech.api.interfaces.modularui.IAddGregtechLogo; @@ -18,9 +24,6 @@ import gtPlusPlus.api.objects.data.AutoMap; import gtPlusPlus.core.util.minecraft.ItemUtils; import gtPlusPlus.core.util.reflect.ReflectionUtils; import gtPlusPlus.xmod.gregtech.common.StaticFields59; -import java.lang.reflect.Constructor; -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.item.ItemStack; public abstract class GT_MetaTileEntity_Hatch_NbtConsumable extends GT_MetaTileEntity_Hatch implements IAddGregtechLogo { @@ -30,40 +33,24 @@ public abstract class GT_MetaTileEntity_Hatch_NbtConsumable extends GT_MetaTileE private final int mTotalSlotCount; private final boolean mAllowDuplicateUsageTypes; - public GT_MetaTileEntity_Hatch_NbtConsumable( - int aID, - String aName, - String aNameRegional, - int aTier, - int aInputSlots, - String aDescription, - boolean aAllowDuplicateTypes) { + public GT_MetaTileEntity_Hatch_NbtConsumable(int aID, String aName, String aNameRegional, int aTier, + int aInputSlots, String aDescription, boolean aAllowDuplicateTypes) { super(aID, aName, aNameRegional, aTier, aInputSlots * 2, aDescription); mInputslotCount = getInputSlotCount(); mTotalSlotCount = getInputSlotCount() * 2; mAllowDuplicateUsageTypes = aAllowDuplicateTypes; } - public GT_MetaTileEntity_Hatch_NbtConsumable( - String aName, - int aTier, - int aInputSlots, - String aDescription, - boolean aAllowDuplicateTypes, - ITexture[][][] aTextures) { + public GT_MetaTileEntity_Hatch_NbtConsumable(String aName, int aTier, int aInputSlots, String aDescription, + boolean aAllowDuplicateTypes, ITexture[][][] aTextures) { super(aName, aTier, aInputSlots * 2, aDescription, aTextures); mInputslotCount = getInputSlotCount(); mTotalSlotCount = getInputSlotCount() * 2; mAllowDuplicateUsageTypes = aAllowDuplicateTypes; } - public GT_MetaTileEntity_Hatch_NbtConsumable( - String aName, - int aTier, - int aInputSlots, - String[] aDescription, - boolean aAllowDuplicateTypes, - ITexture[][][] aTextures) { + public GT_MetaTileEntity_Hatch_NbtConsumable(String aName, int aTier, int aInputSlots, String[] aDescription, + boolean aAllowDuplicateTypes, ITexture[][][] aTextures) { super(aName, aTier, aInputSlots * 2, aDescription, aTextures); mInputslotCount = getInputSlotCount(); mTotalSlotCount = getInputSlotCount() * 2; @@ -101,9 +88,11 @@ public abstract class GT_MetaTileEntity_Hatch_NbtConsumable extends GT_MetaTileE @Override public final MetaTileEntity newMetaEntity(IGregTechTileEntity aTileEntity) { Constructor<?> aConstructor = ReflectionUtils.getConstructor( - getHatchEntityClass(), new Class[] {String.class, String[].class, ITexture[][][].class}); + getHatchEntityClass(), + new Class[] { String.class, String[].class, ITexture[][][].class }); GT_MetaTileEntity_Hatch_NbtConsumable aInstance = ReflectionUtils.createNewInstanceFromConstructor( - aConstructor, new Object[] {mName, StaticFields59.getDescriptionArray(this), mTextures}); + aConstructor, + new Object[] { mName, StaticFields59.getDescriptionArray(this), mTextures }); if (aInstance instanceof GT_MetaTileEntity_Hatch_NbtConsumable) { GT_MetaTileEntity_Hatch_NbtConsumable aMetaTile = (GT_MetaTileEntity_Hatch_NbtConsumable) aInstance; return aMetaTile; @@ -269,29 +258,30 @@ public abstract class GT_MetaTileEntity_Hatch_NbtConsumable extends GT_MetaTileE } @Override - public final boolean allowPullStack( - IGregTechTileEntity aBaseMetaTileEntity, int aIndex, byte aSide, ItemStack aStack) { + public final boolean allowPullStack(IGregTechTileEntity aBaseMetaTileEntity, int aIndex, byte aSide, + ItemStack aStack) { return false; } @Override - public final boolean allowPutStack( - IGregTechTileEntity aBaseMetaTileEntity, int aIndex, byte aSide, ItemStack aStack) { - return aSide == getBaseMetaTileEntity().getFrontFacing() - && isItemValidForUsageSlot(aStack) + public final boolean allowPutStack(IGregTechTileEntity aBaseMetaTileEntity, int aIndex, byte aSide, + ItemStack aStack) { + return aSide == getBaseMetaTileEntity().getFrontFacing() && isItemValidForUsageSlot(aStack) && aIndex < mInputslotCount; } /** - * Items that get compared when checking for Usage Slot validity. - * Can return an empty map if isItemValidForUsageSlot() is overridden. + * Items that get compared when checking for Usage Slot validity. Can return an empty map if + * isItemValidForUsageSlot() is overridden. + * * @return */ public abstract AutoMap<ItemStack> getItemsValidForUsageSlots(); /** - * Checks if the given item is valid for Usage Slots. - * Can be overridden for easier handling if you already have methods to check this. + * Checks if the given item is valid for Usage Slots. Can be overridden for easier handling if you already have + * methods to check this. + * * @param aStack * @return */ @@ -316,16 +306,14 @@ public abstract class GT_MetaTileEntity_Hatch_NbtConsumable extends GT_MetaTileE switch (mTotalSlotCount) { case 8: case 18: - 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)); break; case 32: - builder.widget(new DrawableWidget() - .setDrawable(getGUITextureSet().getGregTechLogo()) - .setSize(17, 17) - .setPos(79, 35)); + builder.widget( + new DrawableWidget().setDrawable(getGUITextureSet().getGregTechLogo()).setSize(17, 17) + .setPos(79, 35)); break; } } @@ -334,55 +322,32 @@ public abstract class GT_MetaTileEntity_Hatch_NbtConsumable extends GT_MetaTileE public void addUIWidgets(ModularWindow.Builder builder, UIBuildContext buildContext) { switch (mTotalSlotCount) { case 8: - builder.widget(SlotGroup.ofItemHandler(inventoryHandler, 2) - .startFromSlot(0) - .endAtSlot(3) - .build() - .setPos(25, 25)); - builder.widget(SlotGroup.ofItemHandler(inventoryHandler, 2) - .startFromSlot(4) - .endAtSlot(7) - .canInsert(false) - .build() - .setPos(115, 25)); - builder.widget(new TextWidget("Stock") - .setDefaultColor(COLOR_TEXT_GRAY.get()) - .setPos(25, 16)) - .widget(new TextWidget("Active") - .setDefaultColor(COLOR_TEXT_GRAY.get()) - .setPos(115, 16)); + builder.widget( + SlotGroup.ofItemHandler(inventoryHandler, 2).startFromSlot(0).endAtSlot(3).build() + .setPos(25, 25)); + builder.widget( + SlotGroup.ofItemHandler(inventoryHandler, 2).startFromSlot(4).endAtSlot(7).canInsert(false) + .build().setPos(115, 25)); + builder.widget(new TextWidget("Stock").setDefaultColor(COLOR_TEXT_GRAY.get()).setPos(25, 16)) + .widget(new TextWidget("Active").setDefaultColor(COLOR_TEXT_GRAY.get()).setPos(115, 16)); break; case 18: - builder.widget(SlotGroup.ofItemHandler(inventoryHandler, 3) - .startFromSlot(0) - .endAtSlot(8) - .build() - .setPos(25, 19)); - builder.widget(SlotGroup.ofItemHandler(inventoryHandler, 3) - .startFromSlot(9) - .endAtSlot(17) - .canInsert(false) - .build() - .setPos(97, 19)); - builder.widget(new TextWidget("Stock") - .setDefaultColor(COLOR_TEXT_GRAY.get()) - .setPos(25, 14)) - .widget(new TextWidget("Active") - .setDefaultColor(COLOR_TEXT_GRAY.get()) - .setPos(15, 14)); + builder.widget( + SlotGroup.ofItemHandler(inventoryHandler, 3).startFromSlot(0).endAtSlot(8).build() + .setPos(25, 19)); + builder.widget( + SlotGroup.ofItemHandler(inventoryHandler, 3).startFromSlot(9).endAtSlot(17).canInsert(false) + .build().setPos(97, 19)); + builder.widget(new TextWidget("Stock").setDefaultColor(COLOR_TEXT_GRAY.get()).setPos(25, 14)) + .widget(new TextWidget("Active").setDefaultColor(COLOR_TEXT_GRAY.get()).setPos(15, 14)); break; case 32: - builder.widget(SlotGroup.ofItemHandler(inventoryHandler, 4) - .startFromSlot(0) - .endAtSlot(15) - .build() - .setPos(7, 7)); - builder.widget(SlotGroup.ofItemHandler(inventoryHandler, 4) - .startFromSlot(16) - .endAtSlot(31) - .canInsert(false) - .build() - .setPos(96, 7)); + builder.widget( + SlotGroup.ofItemHandler(inventoryHandler, 4).startFromSlot(0).endAtSlot(15).build() + .setPos(7, 7)); + builder.widget( + SlotGroup.ofItemHandler(inventoryHandler, 4).startFromSlot(16).endAtSlot(31).canInsert(false) + .build().setPos(96, 7)); break; } } diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/api/objects/GTPP_CopiedBlockTexture.java b/src/main/java/gtPlusPlus/xmod/gregtech/api/objects/GTPP_CopiedBlockTexture.java index 5336b60fc7..6a780d227c 100644 --- a/src/main/java/gtPlusPlus/xmod/gregtech/api/objects/GTPP_CopiedBlockTexture.java +++ b/src/main/java/gtPlusPlus/xmod/gregtech/api/objects/GTPP_CopiedBlockTexture.java @@ -1,11 +1,13 @@ package gtPlusPlus.xmod.gregtech.api.objects; +import net.minecraft.block.Block; + import gregtech.api.enums.Dyes; import gregtech.api.objects.GT_CopiedBlockTexture; -import net.minecraft.block.Block; /** * Made this to get rid of deprecation warnings <i>everywhere</i>. + * * @author Alkalus * */ diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/api/objects/GTPP_RenderedTexture.java b/src/main/java/gtPlusPlus/xmod/gregtech/api/objects/GTPP_RenderedTexture.java index 6764a1e206..0da0136193 100644 --- a/src/main/java/gtPlusPlus/xmod/gregtech/api/objects/GTPP_RenderedTexture.java +++ b/src/main/java/gtPlusPlus/xmod/gregtech/api/objects/GTPP_RenderedTexture.java @@ -6,6 +6,7 @@ import gregtech.api.objects.GT_RenderedTexture; /** * Made this to get rid of deprecation warnings <i>everywhere</i>. + * * @author Alkalus * */ diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/api/objects/GregtechFluid.java b/src/main/java/gtPlusPlus/xmod/gregtech/api/objects/GregtechFluid.java index 40699aa108..32783ec437 100644 --- a/src/main/java/gtPlusPlus/xmod/gregtech/api/objects/GregtechFluid.java +++ b/src/main/java/gtPlusPlus/xmod/gregtech/api/objects/GregtechFluid.java @@ -1,10 +1,12 @@ package gtPlusPlus.xmod.gregtech.api.objects; +import net.minecraftforge.fluids.Fluid; + import gregtech.api.GregTech_API; import gtPlusPlus.core.lib.CORE; -import net.minecraftforge.fluids.Fluid; public class GregtechFluid extends Fluid implements Runnable { + public final String mTextureName; private final short[] mRGBa; @@ -17,8 +19,7 @@ public class GregtechFluid extends Fluid implements Runnable { @Override public int getColor() { - return (Math.max(0, Math.min(255, this.mRGBa[0])) << 16) - | (Math.max(0, Math.min(255, this.mRGBa[1])) << 8) + return (Math.max(0, Math.min(255, this.mRGBa[0])) << 16) | (Math.max(0, Math.min(255, this.mRGBa[1])) << 8) | Math.max(0, Math.min(255, this.mRGBa[2])); } diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/api/objects/GregtechItemData.java b/src/main/java/gtPlusPlus/xmod/gregtech/api/objects/GregtechItemData.java index a26cfbb192..787299ef6b 100644 --- a/src/main/java/gtPlusPlus/xmod/gregtech/api/objects/GregtechItemData.java +++ b/src/main/java/gtPlusPlus/xmod/gregtech/api/objects/GregtechItemData.java @@ -1,12 +1,15 @@ package gtPlusPlus.xmod.gregtech.api.objects; +import java.util.*; + +import net.minecraft.item.ItemStack; + import gregtech.api.objects.GT_ArrayList; import gtPlusPlus.xmod.gregtech.api.enums.GregtechOrePrefixes; import gtPlusPlus.xmod.gregtech.api.enums.GregtechOrePrefixes.GT_Materials; -import java.util.*; -import net.minecraft.item.ItemStack; public class GregtechItemData { + private static final GregtechMaterialStack[] EMPTY_GT_MaterialStack_ARRAY = new GregtechMaterialStack[0]; public final List<Object> mExtraData = new GT_ArrayList<>(false, 1); @@ -16,14 +19,14 @@ public class GregtechItemData { public boolean mBlackListed = false; public ItemStack mUnificationTarget = null; - public GregtechItemData( - final GregtechOrePrefixes aPrefix, final GT_Materials aMaterial, final boolean aBlackListed) { + public GregtechItemData(final GregtechOrePrefixes aPrefix, final GT_Materials aMaterial, + final boolean aBlackListed) { this.mPrefix = aPrefix; this.mMaterial = aMaterial == null ? null : new GregtechMaterialStack(aMaterial, aPrefix.mMaterialAmount); this.mBlackListed = aBlackListed; this.mByProducts = (aPrefix.mSecondaryMaterial == null) || (aPrefix.mSecondaryMaterial.mMaterial == null) ? EMPTY_GT_MaterialStack_ARRAY - : new GregtechMaterialStack[] {aPrefix.mSecondaryMaterial.clone()}; + : new GregtechMaterialStack[] { aPrefix.mSecondaryMaterial.clone() }; } public GregtechItemData(final GregtechOrePrefixes aPrefix, final GT_Materials aMaterial) { @@ -37,8 +40,7 @@ public class GregtechItemData { if (aByProducts == null) { this.mByProducts = EMPTY_GT_MaterialStack_ARRAY; } else { - final GregtechMaterialStack[] tByProducts = aByProducts.length < 1 - ? EMPTY_GT_MaterialStack_ARRAY + final GregtechMaterialStack[] tByProducts = aByProducts.length < 1 ? EMPTY_GT_MaterialStack_ARRAY : new GregtechMaterialStack[aByProducts.length]; int j = 0; for (int i = 0; i < aByProducts.length; i++) { @@ -53,15 +55,12 @@ public class GregtechItemData { } } - public GregtechItemData( - final GT_Materials aMaterial, final long aAmount, final GregtechMaterialStack... aByProducts) { + public GregtechItemData(final GT_Materials aMaterial, final long aAmount, + final GregtechMaterialStack... aByProducts) { this(new GregtechMaterialStack(aMaterial, aAmount), aByProducts); } - public GregtechItemData( - final GT_Materials aMaterial, - final long aAmount, - final GT_Materials aByProduct, + public GregtechItemData(final GT_Materials aMaterial, final long aAmount, final GT_Materials aByProduct, final long aByProductAmount) { this(new GregtechMaterialStack(aMaterial, aAmount), new GregtechMaterialStack(aByProduct, aByProductAmount)); } @@ -100,6 +99,7 @@ public class GregtechItemData { } Collections.sort(rList, new Comparator<GregtechMaterialStack>() { + @Override public int compare(final GregtechMaterialStack a, final GregtechMaterialStack b) { return a.mAmount == b.mAmount ? 0 : a.mAmount > b.mAmount ? -1 : +1; diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/api/objects/GregtechMaterialStack.java b/src/main/java/gtPlusPlus/xmod/gregtech/api/objects/GregtechMaterialStack.java index 107202a027..5ffdc4d20e 100644 --- a/src/main/java/gtPlusPlus/xmod/gregtech/api/objects/GregtechMaterialStack.java +++ b/src/main/java/gtPlusPlus/xmod/gregtech/api/objects/GregtechMaterialStack.java @@ -3,6 +3,7 @@ package gtPlusPlus.xmod.gregtech.api.objects; import gtPlusPlus.xmod.gregtech.api.enums.GregtechOrePrefixes.GT_Materials; public class GregtechMaterialStack implements Cloneable { + public long mAmount; public GT_Materials mMaterial; @@ -33,8 +34,7 @@ public class GregtechMaterialStack implements Cloneable { } if (aObject instanceof GregtechMaterialStack) { return (((GregtechMaterialStack) aObject).mMaterial == this.mMaterial) - && ((this.mAmount < 0) - || (((GregtechMaterialStack) aObject).mAmount < 0) + && ((this.mAmount < 0) || (((GregtechMaterialStack) aObject).mAmount < 0) || (((GregtechMaterialStack) aObject).mAmount == this.mAmount)); } return false; diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/api/recipe/ProcessingSkookumChoocherToolRecipes.java b/src/main/java/gtPlusPlus/xmod/gregtech/api/recipe/ProcessingSkookumChoocherToolRecipes.java index ce73d1495f..7f2fda6dd8 100644 --- a/src/main/java/gtPlusPlus/xmod/gregtech/api/recipe/ProcessingSkookumChoocherToolRecipes.java +++ b/src/main/java/gtPlusPlus/xmod/gregtech/api/recipe/ProcessingSkookumChoocherToolRecipes.java @@ -1,32 +1,26 @@ package gtPlusPlus.xmod.gregtech.api.recipe; +import net.minecraft.item.ItemStack; + import gregtech.api.enums.Materials; import gregtech.api.enums.OrePrefixes; import gregtech.api.enums.ToolDictNames; import gregtech.api.interfaces.IOreRecipeRegistrator; import gregtech.api.util.GT_ModHandler; import gtPlusPlus.xmod.gregtech.common.items.MetaGeneratedGregtechTools; -import net.minecraft.item.ItemStack; public class ProcessingSkookumChoocherToolRecipes implements IOreRecipeRegistrator { + public ProcessingSkookumChoocherToolRecipes() { // GregtechOrePrefixes.toolSkookumChoocher.add(this); } @Override - public void registerOre( - final OrePrefixes aPrefix, - final Materials aMaterial, - final String aOreDictName, - final String aModName, - final ItemStack aStack) { + public void registerOre(final OrePrefixes aPrefix, final Materials aMaterial, final String aOreDictName, + final String aModName, final ItemStack aStack) { GT_ModHandler.addShapelessCraftingRecipe( MetaGeneratedGregtechTools.INSTANCE.getToolWithStats(7734, 1, aMaterial, aMaterial, null), - new Object[] { - aOreDictName, - OrePrefixes.stick.get(aMaterial), - OrePrefixes.screw.get(aMaterial), - ToolDictNames.craftingToolScrewdriver - }); + new Object[] { aOreDictName, OrePrefixes.stick.get(aMaterial), OrePrefixes.screw.get(aMaterial), + ToolDictNames.craftingToolScrewdriver }); } } diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/api/util/GTPP_Config.java b/src/main/java/gtPlusPlus/xmod/gregtech/api/util/GTPP_Config.java index ee4892e11a..cffeb41776 100644 --- a/src/main/java/gtPlusPlus/xmod/gregtech/api/util/GTPP_Config.java +++ b/src/main/java/gtPlusPlus/xmod/gregtech/api/util/GTPP_Config.java @@ -2,14 +2,16 @@ package gtPlusPlus.xmod.gregtech.api.util; import static gregtech.api.enums.GT_Values.E; -import gregtech.api.GregTech_API; -import gregtech.api.util.GT_OreDictUnificator; -import gregtech.api.util.GT_Utility; 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.util.GT_OreDictUnificator; +import gregtech.api.util.GT_Utility; + public class GTPP_Config implements Runnable { + public static boolean troll = false; public static Configuration sConfigFileIDs; @@ -23,8 +25,8 @@ public class GTPP_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() && GregTech_API.sPostloadFinished) sConfigFileIDs.save(); return rResult; @@ -37,7 +39,7 @@ public class GTPP_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("@"); @@ -53,7 +55,9 @@ public class GTPP_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() && GregTech_API.sPostloadFinished) mConfig.save(); return rResult; @@ -66,7 +70,9 @@ public class GTPP_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() && GregTech_API.sPostloadFinished) mConfig.save(); return rResult; @@ -79,7 +85,9 @@ public class GTPP_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() && GregTech_API.sPostloadFinished) mConfig.save(); return rResult; @@ -92,7 +100,9 @@ public class GTPP_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() && GregTech_API.sPostloadFinished) mConfig.save(); return rResult; diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/api/util/GregtechOreDictUnificator.java b/src/main/java/gtPlusPlus/xmod/gregtech/api/util/GregtechOreDictUnificator.java index c5671b88b9..52950e1ae0 100644 --- a/src/main/java/gtPlusPlus/xmod/gregtech/api/util/GregtechOreDictUnificator.java +++ b/src/main/java/gtPlusPlus/xmod/gregtech/api/util/GregtechOreDictUnificator.java @@ -2,6 +2,16 @@ package gtPlusPlus.xmod.gregtech.api.util; import static gregtech.api.enums.GT_Values.*; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Map.Entry; + +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; @@ -14,21 +24,12 @@ import gregtech.api.objects.MaterialStack; import gregtech.api.util.*; import gtPlusPlus.core.util.reflect.ReflectionUtils; import gtPlusPlus.xmod.gregtech.common.StaticFields59; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import java.util.Map.Entry; -import net.minecraft.init.Items; -import net.minecraft.item.ItemStack; -import net.minecraftforge.oredict.OreDictionary; public class GregtechOreDictUnificator { private static final Map<String, ItemStack> sName2StackMap = new HashMap<String, ItemStack>(); private static final Map<GT_ItemStack, ItemData> sItemStack2DataMap = new HashMap<GT_ItemStack, ItemData>(); - private static final Map<GT_ItemStack, List<ItemStack>> sUnificationTable = - new HashMap<GT_ItemStack, List<ItemStack>>(); + private static final Map<GT_ItemStack, List<ItemStack>> sUnificationTable = new HashMap<GT_ItemStack, List<ItemStack>>(); private static final GT_HashSet<GT_ItemStack> sNoUnificationList = new GT_HashSet<GT_ItemStack>(); private static int isRegisteringOre = 0, isAddingOre = 0; @@ -41,8 +42,8 @@ public class GregtechOreDictUnificator { } /** - * 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)) @@ -61,23 +62,17 @@ public class GregtechOreDictUnificator { 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--; } @@ -105,21 +100,18 @@ public class GregtechOreDictUnificator { // if (Materials.mDefaultComponents.contains(aPrefix) && !aPrefix.mDynamicItems.contains((Materials)aMaterial)) // aPrefix.mDynamicItems.add((Materials) aMaterial); if (StaticFields59.geOrePrefixesBooleanPreventableComponents().contains(aPrefix) - && StaticFields59.getOrePrefixesBooleanDisabledItems().contains(aMaterial)) return aReplacement; + && StaticFields59.getOrePrefixesBooleanDisabledItems().contains(aMaterial)) + return aReplacement; return get(aPrefix.get(aMaterial), aReplacement, aAmount, false, true); } - public static ItemStack get( - Object aName, - ItemStack aReplacement, - long aAmount, - boolean aMentionPossibleTypos, + public static ItemStack get(Object aName, ItemStack aReplacement, long aAmount, boolean aMentionPossibleTypos, boolean aNoInvalidAmounts) { if (aNoInvalidAmounts && aAmount < 1) return null; if (!sName2StackMap.containsKey(aName.toString()) && aMentionPossibleTypos) GT_Log.err.println("Unknown Key for Unification, Typo? " + aName); - return GT_Utility.copyAmount( - aAmount, sName2StackMap.get(aName.toString()), getFirstOre(aName, aAmount), aReplacement); + return GT_Utility + .copyAmount(aAmount, sName2StackMap.get(aName.toString()), getFirstOre(aName, aAmount), aReplacement); } public static ItemStack[] setStackArray(boolean aUseBlackList, ItemStack... aStacks) { @@ -158,9 +150,9 @@ public class GregtechOreDictUnificator { if (GT_Utility.isStackInvalid(aStack)) return null; ItemData tPrefixMaterial = getAssociation(aStack); ItemStack rStack = null; - if (tPrefixMaterial == null - || !tPrefixMaterial.hasValidPrefixMaterialData() - || (aUseBlackList && tPrefixMaterial.mBlackListed)) return GT_Utility.copy(aStack); + if (tPrefixMaterial == null || !tPrefixMaterial.hasValidPrefixMaterialData() + || (aUseBlackList && tPrefixMaterial.mBlackListed)) + return GT_Utility.copy(aStack); if (aUseBlackList && !GregTech_API.sUnificationEntriesRegistered && isBlacklisted(aStack)) { tPrefixMaterial.mBlackListed = true; return GT_Utility.copy(aStack); @@ -192,7 +184,7 @@ public class GregtechOreDictUnificator { } } 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<ItemStack>(); @@ -218,9 +210,8 @@ public class GregtechOreDictUnificator { 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; @@ -228,12 +219,10 @@ public class GregtechOreDictUnificator { } sItemStack2DataMap.put(new GT_ItemStack(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); } @@ -242,8 +231,8 @@ public class GregtechOreDictUnificator { mRunThroughTheList = false; for (Entry<GT_ItemStack, ItemData> tEntry : sItemStack2DataMap.entrySet()) if (!tEntry.getValue().hasValidPrefixData() || tEntry.getValue().mPrefix.mAllowNormalRecycling) - GT_RecipeRegistrator.registerMaterialRecycling( - tEntry.getKey().toStack(), tEntry.getValue()); + GT_RecipeRegistrator + .registerMaterialRecycling(tEntry.getKey().toStack(), tEntry.getValue()); } } else { if (!aData.hasValidPrefixData() || aData.mPrefix.mAllowNormalRecycling) @@ -255,13 +244,11 @@ public class GregtechOreDictUnificator { } } - 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)); } @@ -388,8 +375,7 @@ public class GregtechOreDictUnificator { public static ItemStack getIngotOrDust(MaterialStack aMaterial) { ItemStack rStack = getIngot(aMaterial); - if (aMaterial != null - && aMaterial.mMaterial != null + if (aMaterial != null && aMaterial.mMaterial != null && (aMaterial.mMaterial == Materials.Naquadah || aMaterial.mMaterial == Materials.NaquadahEnriched)) rStack = getDust(aMaterial); if (rStack == null) rStack = getDust(aMaterial); diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/api/util/SpecialBehaviourTooltipHandler.java b/src/main/java/gtPlusPlus/xmod/gregtech/api/util/SpecialBehaviourTooltipHandler.java index d03d4da099..51987d84fd 100644 --- a/src/main/java/gtPlusPlus/xmod/gregtech/api/util/SpecialBehaviourTooltipHandler.java +++ b/src/main/java/gtPlusPlus/xmod/gregtech/api/util/SpecialBehaviourTooltipHandler.java @@ -1,12 +1,14 @@ package gtPlusPlus.xmod.gregtech.api.util; -import cpw.mods.fml.common.eventhandler.SubscribeEvent; -import gregtech.api.util.GT_Utility; import java.util.HashMap; + import net.minecraft.item.ItemStack; import net.minecraft.util.EnumChatFormatting; import net.minecraftforge.event.entity.player.ItemTooltipEvent; +import cpw.mods.fml.common.eventhandler.SubscribeEvent; +import gregtech.api.util.GT_Utility; + public class SpecialBehaviourTooltipHandler { private static final HashMap<ItemStack, String> mTooltipCache = new HashMap<ItemStack, String>(); diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/api/world/GTPP_Worldgen.java b/src/main/java/gtPlusPlus/xmod/gregtech/api/world/GTPP_Worldgen.java index 6f58823eb1..bfbd4e6da3 100644 --- a/src/main/java/gtPlusPlus/xmod/gregtech/api/world/GTPP_Worldgen.java +++ b/src/main/java/gtPlusPlus/xmod/gregtech/api/world/GTPP_Worldgen.java @@ -6,6 +6,7 @@ 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; @@ -30,15 +31,8 @@ public abstract class GTPP_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; } @@ -51,15 +45,8 @@ public abstract class GTPP_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; } @@ -67,8 +54,8 @@ public abstract class GTPP_Worldgen { String aDimName = aWorld.provider.getDimensionName(); Boolean tAllowed = mDimensionMap.get(aDimName); if (tAllowed == null) { - boolean tValue = sCustomWorldgenFile.get( - "worldgen.dimensions." + mWorldGenName, aDimName, aDimensionType == aAllowedDimensionType); + boolean tValue = sCustomWorldgenFile + .get("worldgen.dimensions." + mWorldGenName, aDimName, aDimensionType == aAllowedDimensionType); mDimensionMap.put(aDimName, tValue); return tValue; } diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/api/world/GTPP_Worldgen_Boulder.java b/src/main/java/gtPlusPlus/xmod/gregtech/api/world/GTPP_Worldgen_Boulder.java index 26f1b38084..ffb1baf9f0 100644 --- a/src/main/java/gtPlusPlus/xmod/gregtech/api/world/GTPP_Worldgen_Boulder.java +++ b/src/main/java/gtPlusPlus/xmod/gregtech/api/world/GTPP_Worldgen_Boulder.java @@ -1,27 +1,20 @@ package gtPlusPlus.xmod.gregtech.api.world; -import gtPlusPlus.core.lib.CORE; import java.util.Collection; import java.util.Random; + import net.minecraft.block.Block; import net.minecraft.block.BlockContainer; import net.minecraft.util.MathHelper; import net.minecraft.world.World; import net.minecraft.world.chunk.IChunkProvider; +import gtPlusPlus.core.lib.CORE; + public class GTPP_Worldgen_Boulder extends GTPP_Worldgen_Ore { - public GTPP_Worldgen_Boulder( - String aName, - boolean aDefault, - Block aBlock, - int aBlockMeta, - int aDimensionType, - int aAmount, - int aSize, - int aProbability, - int aMinY, - int aMaxY, - Collection<String> aBiomeList, + + public GTPP_Worldgen_Boulder(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, @@ -39,25 +32,16 @@ public class GTPP_Worldgen_Boulder extends GTPP_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 - 7, tZ); - if (tBlock != null - && tBlock.isOpaqueCube() + if (tBlock != null && tBlock.isOpaqueCube() && aWorld.getBlock(tX, tY - 6, tZ).isAir(aWorld, tX, tY - 6, tZ)) { float math_pi = CORE.PI; float var6 = aRandom.nextFloat() * math_pi; @@ -101,11 +85,9 @@ public class GTPP_Worldgen_Boulder extends GTPP_Worldgen_Ore { for (int var44 = var34; var44 <= var37; ++var44) { float var45 = (var44 + 0.5F - var24) / (var28); Block block = aWorld.getBlock(var38, var41, var44); - if (var14b + var45 * var45 < 1.0F - && ((mAllowToGenerateinVoid - && aWorld.getBlock(var38, var41, var44) - .isAir(aWorld, var38, var41, var44)) - || (block != null && !(block instanceof BlockContainer)))) { + if (var14b + var45 * var45 < 1.0F && ((mAllowToGenerateinVoid && aWorld + .getBlock(var38, var41, var44).isAir(aWorld, var38, var41, var44)) + || (block != null && !(block instanceof BlockContainer)))) { aWorld.setBlock(var38, var41, var44, mBlock, mBlockMeta, 0); } } diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/api/world/GTPP_Worldgen_GT_Ore_Layer.java b/src/main/java/gtPlusPlus/xmod/gregtech/api/world/GTPP_Worldgen_GT_Ore_Layer.java index 0dbd354547..e3f33f45e4 100644 --- a/src/main/java/gtPlusPlus/xmod/gregtech/api/world/GTPP_Worldgen_GT_Ore_Layer.java +++ b/src/main/java/gtPlusPlus/xmod/gregtech/api/world/GTPP_Worldgen_GT_Ore_Layer.java @@ -2,22 +2,25 @@ package gtPlusPlus.xmod.gregtech.api.world; import static gtPlusPlus.xmod.gregtech.HANDLER_GT.sCustomWorldgenFile; -import gregtech.api.GregTech_API; -import gregtech.api.enums.GT_Values; -import gregtech.api.enums.Materials; -import gregtech.common.blocks.GT_TileEntity_Ores; -import gregtech.loaders.misc.GT_Achievements; -import gtPlusPlus.core.lib.CORE; -import gtPlusPlus.core.material.Material; import java.lang.reflect.InvocationTargetException; import java.lang.reflect.Method; import java.util.ArrayList; import java.util.Random; + import net.minecraft.util.MathHelper; import net.minecraft.world.World; import net.minecraft.world.chunk.IChunkProvider; +import gregtech.api.GregTech_API; +import gregtech.api.enums.GT_Values; +import gregtech.api.enums.Materials; +import gregtech.common.blocks.GT_TileEntity_Ores; +import gregtech.loaders.misc.GT_Achievements; +import gtPlusPlus.core.lib.CORE; +import gtPlusPlus.core.material.Material; + public class GTPP_Worldgen_GT_Ore_Layer extends GTPP_Worldgen { + public static ArrayList<GTPP_Worldgen_GT_Ore_Layer> sList = new ArrayList<GTPP_Worldgen_GT_Ore_Layer>(); public static int sWeight = 0; public final short mMinY; @@ -33,37 +36,27 @@ public class GTPP_Worldgen_GT_Ore_Layer extends GTPP_Worldgen { public final boolean mDarkWorld; public final String aTextWorldgen = "worldgen.gtpp."; - public GTPP_Worldgen_GT_Ore_Layer( - String aName, - boolean aDefault, - int aMinY, - int aMaxY, - int aWeight, - int aDensity, - int aSize, - boolean aOverworld, - Materials aPrimary, - Materials aSecondary, - Materials aBetween, + public GTPP_Worldgen_GT_Ore_Layer(String aName, boolean aDefault, int aMinY, int aMaxY, int aWeight, int aDensity, + int aSize, boolean aOverworld, Materials aPrimary, Materials aSecondary, Materials aBetween, Materials aSporadic) { super(aName, sList, aDefault); this.mDarkWorld = sCustomWorldgenFile.get(aTextWorldgen + this.mWorldGenName, "Overworld", aOverworld); this.mMinY = ((short) sCustomWorldgenFile.get(aTextWorldgen + this.mWorldGenName, "MinHeight", aMinY)); - this.mMaxY = ((short) Math.max( - this.mMinY + 5, sCustomWorldgenFile.get(aTextWorldgen + this.mWorldGenName, "MaxHeight", aMaxY))); + this.mMaxY = ((short) Math + .max(this.mMinY + 5, sCustomWorldgenFile.get(aTextWorldgen + this.mWorldGenName, "MaxHeight", aMaxY))); this.mWeight = ((short) sCustomWorldgenFile.get(aTextWorldgen + this.mWorldGenName, "RandomWeight", aWeight)); this.mDensity = ((short) sCustomWorldgenFile.get(aTextWorldgen + this.mWorldGenName, "Density", aDensity)); this.mSize = ((short) Math.max(1, sCustomWorldgenFile.get(aTextWorldgen + this.mWorldGenName, "Size", aSize))); - this.mPrimaryMeta = ((short) sCustomWorldgenFile.get( - aTextWorldgen + this.mWorldGenName, "OrePrimaryLayer", aPrimary.mMetaItemSubID)); - this.mSecondaryMeta = ((short) sCustomWorldgenFile.get( - aTextWorldgen + this.mWorldGenName, "OreSecondaryLayer", aSecondary.mMetaItemSubID)); - this.mBetweenMeta = ((short) sCustomWorldgenFile.get( - aTextWorldgen + this.mWorldGenName, "OreSporadiclyInbetween", aBetween.mMetaItemSubID)); - this.mSporadicMeta = ((short) sCustomWorldgenFile.get( - aTextWorldgen + this.mWorldGenName, "OreSporaticlyAround", aSporadic.mMetaItemSubID)); - this.mRestrictBiome = - sCustomWorldgenFile.get(aTextWorldgen + this.mWorldGenName, "RestrictToBiomeName", "None"); + this.mPrimaryMeta = ((short) sCustomWorldgenFile + .get(aTextWorldgen + this.mWorldGenName, "OrePrimaryLayer", aPrimary.mMetaItemSubID)); + this.mSecondaryMeta = ((short) sCustomWorldgenFile + .get(aTextWorldgen + this.mWorldGenName, "OreSecondaryLayer", aSecondary.mMetaItemSubID)); + this.mBetweenMeta = ((short) sCustomWorldgenFile + .get(aTextWorldgen + this.mWorldGenName, "OreSporadiclyInbetween", aBetween.mMetaItemSubID)); + this.mSporadicMeta = ((short) sCustomWorldgenFile + .get(aTextWorldgen + this.mWorldGenName, "OreSporaticlyAround", aSporadic.mMetaItemSubID)); + this.mRestrictBiome = sCustomWorldgenFile + .get(aTextWorldgen + this.mWorldGenName, "RestrictToBiomeName", "None"); if (this.mEnabled) { GT_Achievements.registerOre( @@ -102,65 +95,53 @@ public class GTPP_Worldgen_GT_Ore_Layer extends GTPP_Worldgen { } } - public GTPP_Worldgen_GT_Ore_Layer( - String aName, - boolean aDefault, - int aMinY, - int aMaxY, - int aWeight, - int aDensity, - int aSize, - Material aPrimary, - Material aSecondary, - Material aBetween, - Material aSporadic) { + public GTPP_Worldgen_GT_Ore_Layer(String aName, boolean aDefault, int aMinY, int aMaxY, int aWeight, int aDensity, + int aSize, Material aPrimary, Material aSecondary, Material aBetween, Material aSporadic) { super(aName, sList, aDefault); this.mDarkWorld = sCustomWorldgenFile.get(aTextWorldgen + this.mWorldGenName, "Darkworld", true); this.mMinY = ((short) sCustomWorldgenFile.get(aTextWorldgen + this.mWorldGenName, "MinHeight", aMinY)); - this.mMaxY = ((short) Math.max( - this.mMinY + 5, sCustomWorldgenFile.get(aTextWorldgen + this.mWorldGenName, "MaxHeight", aMaxY))); + this.mMaxY = ((short) Math + .max(this.mMinY + 5, sCustomWorldgenFile.get(aTextWorldgen + this.mWorldGenName, "MaxHeight", aMaxY))); this.mWeight = ((short) sCustomWorldgenFile.get(aTextWorldgen + this.mWorldGenName, "RandomWeight", aWeight)); this.mDensity = ((short) sCustomWorldgenFile.get(aTextWorldgen + this.mWorldGenName, "Density", aDensity)); this.mSize = ((short) Math.max(1, sCustomWorldgenFile.get(aTextWorldgen + this.mWorldGenName, "Size", aSize))); - /*this.mPrimaryMeta = ((short) sCustomWorldgenFile.get(aTextWorldgen + this.mWorldGenName, "OrePrimaryLayer", aPrimary.mMetaItemSubID)); - this.mSecondaryMeta = ((short) sCustomWorldgenFile.get(aTextWorldgen + this.mWorldGenName, "OreSecondaryLayer", aSecondary.mMetaItemSubID)); - this.mBetweenMeta = ((short) sCustomWorldgenFile.get(aTextWorldgen + this.mWorldGenName, "OreSporadiclyInbetween", aBetween.mMetaItemSubID)); - this.mSporadicMeta = ((short) sCustomWorldgenFile.get(aTextWorldgen + this.mWorldGenName, "OreSporaticlyAround", aSporadic.mMetaItemSubID)); - */ this.mRestrictBiome = - sCustomWorldgenFile.get(aTextWorldgen + this.mWorldGenName, "RestrictToBiomeName", "None"); + /* + * this.mPrimaryMeta = ((short) sCustomWorldgenFile.get(aTextWorldgen + this.mWorldGenName, "OrePrimaryLayer", + * aPrimary.mMetaItemSubID)); this.mSecondaryMeta = ((short) sCustomWorldgenFile.get(aTextWorldgen + + * this.mWorldGenName, "OreSecondaryLayer", aSecondary.mMetaItemSubID)); this.mBetweenMeta = ((short) + * sCustomWorldgenFile.get(aTextWorldgen + this.mWorldGenName, "OreSporadiclyInbetween", + * aBetween.mMetaItemSubID)); this.mSporadicMeta = ((short) sCustomWorldgenFile.get(aTextWorldgen + + * this.mWorldGenName, "OreSporaticlyAround", aSporadic.mMetaItemSubID)); + */ this.mRestrictBiome = sCustomWorldgenFile + .get(aTextWorldgen + this.mWorldGenName, "RestrictToBiomeName", "None"); if (this.mEnabled) { - /* GT_Achievements.registerOre(GregTech_API.sGeneratedMaterials[(mPrimaryMeta % 1000)], aMinY, aMaxY, aWeight, false, false, false); - GT_Achievements.registerOre(GregTech_API.sGeneratedMaterials[(mSecondaryMeta % 1000)], aMinY, aMaxY, aWeight, false, false, false); - GT_Achievements.registerOre(GregTech_API.sGeneratedMaterials[(mBetweenMeta % 1000)], aMinY, aMaxY, aWeight, false, false, false); - GT_Achievements.registerOre(GregTech_API.sGeneratedMaterials[(mSporadicMeta % 1000)], aMinY, aMaxY, aWeight, false, false, false); + /* + * GT_Achievements.registerOre(GregTech_API.sGeneratedMaterials[(mPrimaryMeta % 1000)], aMinY, aMaxY, + * aWeight, false, false, false); + * GT_Achievements.registerOre(GregTech_API.sGeneratedMaterials[(mSecondaryMeta % 1000)], aMinY, aMaxY, + * aWeight, false, false, false); GT_Achievements.registerOre(GregTech_API.sGeneratedMaterials[(mBetweenMeta + * % 1000)], aMinY, aMaxY, aWeight, false, false, false); + * GT_Achievements.registerOre(GregTech_API.sGeneratedMaterials[(mSporadicMeta % 1000)], aMinY, aMaxY, + * aWeight, false, false, false); */ sWeight += this.mWeight; } } @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 (!this.mRestrictBiome.equals("None") && !(this.mRestrictBiome.equals(aBiome))) { return false; // Not the correct biome for ore mix } if (!isGenerationAllowed( aWorld, aDimensionType, - ((aDimensionType == -1) && (false)) - || ((aDimensionType == 0) && (this.mDarkWorld)) - || ((aDimensionType == 1) && (false)) - || ((aWorld.provider.getDimensionName().equals("Moon")) && (false)) - || ((aWorld.provider.getDimensionName().equals("Mars")) && (false)) - ? aDimensionType - : aDimensionType ^ 0xFFFFFFFF)) { + ((aDimensionType == -1) && (false)) || ((aDimensionType == 0) && (this.mDarkWorld)) + || ((aDimensionType == 1) && (false)) + || ((aWorld.provider.getDimensionName().equals("Moon")) && (false)) + || ((aWorld.provider.getDimensionName().equals("Mars")) && (false)) ? aDimensionType + : aDimensionType ^ 0xFFFFFFFF)) { return false; } int tMinY = this.mMinY + aRandom.nextInt(this.mMaxY - this.mMinY - 5); @@ -173,12 +154,14 @@ public class GTPP_Worldgen_GT_Ore_Layer extends GTPP_Worldgen { for (int tZ = cZ; tZ <= eZ; tZ++) { if (this.mSecondaryMeta > 0) { for (int i = tMinY - 1; i < tMinY + 2; i++) { - if ((aRandom.nextInt(Math.max( - 1, - Math.max(MathHelper.abs_int(cZ - tZ), MathHelper.abs_int(eZ - tZ)) - / this.mDensity)) - == 0) - || (aRandom.nextInt(Math.max( + if ((aRandom.nextInt( + Math.max( + 1, + Math.max(MathHelper.abs_int(cZ - tZ), MathHelper.abs_int(eZ - tZ)) + / this.mDensity)) + == 0) + || (aRandom.nextInt( + Math.max( 1, Math.max(MathHelper.abs_int(cX - tX), MathHelper.abs_int(eX - tX)) / this.mDensity)) @@ -187,27 +170,27 @@ public class GTPP_Worldgen_GT_Ore_Layer extends GTPP_Worldgen { } } } - if ((this.mBetweenMeta > 0) - && ((aRandom.nextInt(Math.max( - 1, - Math.max(MathHelper.abs_int(cZ - tZ), MathHelper.abs_int(eZ - tZ)) - / this.mDensity)) - == 0) - || (aRandom.nextInt(Math.max( - 1, - Math.max(MathHelper.abs_int(cX - tX), MathHelper.abs_int(eX - tX)) - / this.mDensity)) - == 0))) { + if ((this.mBetweenMeta > 0) && ((aRandom.nextInt( + Math.max(1, Math.max(MathHelper.abs_int(cZ - tZ), MathHelper.abs_int(eZ - tZ)) / this.mDensity)) + == 0) + || (aRandom.nextInt( + Math.max( + 1, + Math.max(MathHelper.abs_int(cX - tX), MathHelper.abs_int(eX - tX)) + / this.mDensity)) + == 0))) { setOreBlock(aWorld, tX, tMinY + 2 + aRandom.nextInt(2), tZ, this.mBetweenMeta, false); } if (this.mPrimaryMeta > 0) { for (int i = tMinY + 3; i < tMinY + 6; i++) { - if ((aRandom.nextInt(Math.max( - 1, - Math.max(MathHelper.abs_int(cZ - tZ), MathHelper.abs_int(eZ - tZ)) - / this.mDensity)) - == 0) - || (aRandom.nextInt(Math.max( + if ((aRandom.nextInt( + Math.max( + 1, + Math.max(MathHelper.abs_int(cZ - tZ), MathHelper.abs_int(eZ - tZ)) + / this.mDensity)) + == 0) + || (aRandom.nextInt( + Math.max( 1, Math.max(MathHelper.abs_int(cX - tX), MathHelper.abs_int(eX - tX)) / this.mDensity)) @@ -216,17 +199,15 @@ public class GTPP_Worldgen_GT_Ore_Layer extends GTPP_Worldgen { } } } - if ((this.mSporadicMeta > 0) - && ((aRandom.nextInt(Math.max( - 1, - Math.max(MathHelper.abs_int(cZ - tZ), MathHelper.abs_int(eZ - tZ)) - / this.mDensity)) - == 0) - || (aRandom.nextInt(Math.max( - 1, - Math.max(MathHelper.abs_int(cX - tX), MathHelper.abs_int(eX - tX)) - / this.mDensity)) - == 0))) { + if ((this.mSporadicMeta > 0) && ((aRandom.nextInt( + Math.max(1, Math.max(MathHelper.abs_int(cZ - tZ), MathHelper.abs_int(eZ - tZ)) / this.mDensity)) + == 0) + || (aRandom.nextInt( + Math.max( + 1, + Math.max(MathHelper.abs_int(cX - tX), MathHelper.abs_int(eX - tX)) + / this.mDensity)) + == 0))) { setOreBlock(aWorld, tX, tMinY - 1 + aRandom.nextInt(7), tZ, this.mSporadicMeta, false); } } @@ -244,13 +225,18 @@ public class GTPP_Worldgen_GT_Ore_Layer extends GTPP_Worldgen { if (mSetOre == null) { try { mSetOre = GT_TileEntity_Ores.class.getMethod( - "setOreBlock", World.class, int.class, int.class, int.class, int.class, boolean.class); + "setOreBlock", + World.class, + int.class, + int.class, + int.class, + int.class, + boolean.class); } catch (SecurityException | NoSuchMethodException e) { try { - mSetOre = GT_TileEntity_Ores.class.getMethod( - "setOreBlock", World.class, int.class, int.class, int.class, int.class); - } catch (SecurityException | NoSuchMethodException r) { - } + mSetOre = GT_TileEntity_Ores.class + .getMethod("setOreBlock", World.class, int.class, int.class, int.class, int.class); + } catch (SecurityException | NoSuchMethodException r) {} } } diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/api/world/GTPP_Worldgen_Handler.java b/src/main/java/gtPlusPlus/xmod/gregtech/api/world/GTPP_Worldgen_Handler.java index b295d5be82..8ed90b799f 100644 --- a/src/main/java/gtPlusPlus/xmod/gregtech/api/world/GTPP_Worldgen_Handler.java +++ b/src/main/java/gtPlusPlus/xmod/gregtech/api/world/GTPP_Worldgen_Handler.java @@ -28,17 +28,8 @@ public class GTPP_Worldgen_Handler implements Runnable { ore.aSporadic); } - private final GTPP_Worldgen_GT_Ore_Layer generateNewVein( - String mOreMixName, - int minY, - int maxY, - int weight, - int density, - int size, - Material aPrimary, - Material aSecondary, - Material aBetween, - Material aSporadic) { + private final GTPP_Worldgen_GT_Ore_Layer generateNewVein(String mOreMixName, int minY, int maxY, int weight, + int density, int size, Material aPrimary, Material aSecondary, Material aBetween, Material aSporadic) { return new GTPP_Worldgen_GT_Ore_Layer( "ore.mix." + mOreMixName, // String aName, true, // boolean aDefault, diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/api/world/GTPP_Worldgen_Ore.java b/src/main/java/gtPlusPlus/xmod/gregtech/api/world/GTPP_Worldgen_Ore.java index e93a6c6d38..22b64d6cfc 100644 --- a/src/main/java/gtPlusPlus/xmod/gregtech/api/world/GTPP_Worldgen_Ore.java +++ b/src/main/java/gtPlusPlus/xmod/gregtech/api/world/GTPP_Worldgen_Ore.java @@ -2,30 +2,23 @@ package gtPlusPlus.xmod.gregtech.api.world; import static gtPlusPlus.xmod.gregtech.HANDLER_GT.sCustomWorldgenFile; -import gtPlusPlus.xmod.gregtech.HANDLER_GT; import java.util.ArrayList; import java.util.Collection; + import net.minecraft.block.Block; +import gtPlusPlus.xmod.gregtech.HANDLER_GT; + public abstract class GTPP_Worldgen_Ore extends GTPP_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 GTPP_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 GTPP_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, HANDLER_GT.sCustomWorldgenList, aDefault); mDimensionType = aDimensionType; diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/api/world/GTPP_Worldgen_Ore_Normal.java b/src/main/java/gtPlusPlus/xmod/gregtech/api/world/GTPP_Worldgen_Ore_Normal.java index 3f0a6d48c9..b8113d5f86 100644 --- a/src/main/java/gtPlusPlus/xmod/gregtech/api/world/GTPP_Worldgen_Ore_Normal.java +++ b/src/main/java/gtPlusPlus/xmod/gregtech/api/world/GTPP_Worldgen_Ore_Normal.java @@ -1,27 +1,20 @@ package gtPlusPlus.xmod.gregtech.api.world; -import gtPlusPlus.core.lib.CORE; import java.util.Collection; import java.util.Random; + import net.minecraft.block.Block; import net.minecraft.init.Blocks; import net.minecraft.util.MathHelper; import net.minecraft.world.World; import net.minecraft.world.chunk.IChunkProvider; +import gtPlusPlus.core.lib.CORE; + public class GTPP_Worldgen_Ore_Normal extends GTPP_Worldgen_Ore { - public GTPP_Worldgen_Ore_Normal( - String aName, - boolean aDefault, - Block aBlock, - int aBlockMeta, - int aDimensionType, - int aAmount, - int aSize, - int aProbability, - int aMinY, - int aMaxY, - Collection<String> aBiomeList, + + public GTPP_Worldgen_Ore_Normal(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, @@ -39,21 +32,13 @@ public class GTPP_Worldgen_Ore_Normal extends GTPP_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); if (mAllowToGenerateinVoid || aWorld.getBlock(tX, tY, tZ).isAir(aWorld, tX, tY, tZ)) { float math_pi = CORE.PI; @@ -98,29 +83,26 @@ public class GTPP_Worldgen_Ore_Normal extends GTPP_Worldgen_Ore { for (int var44 = var34; var44 <= var37; ++var44) { float var45 = (var44 + 0.5F - var24) / (var28); Block block = aWorld.getBlock(var38, var41, var44); - if (var14b + var45 * var45 < 1.0F - && ((mAllowToGenerateinVoid - && aWorld.getBlock(var38, var41, var44) - .isAir(aWorld, var38, var41, var44)) - || (block != null - && (block.isReplaceableOreGen( - aWorld, - var38, - var41, - var44, - Blocks.stone) - || block.isReplaceableOreGen( - aWorld, - var38, - var41, - var44, - Blocks.end_stone) - || block.isReplaceableOreGen( - aWorld, - var38, - var41, - var44, - Blocks.netherrack))))) { + if (var14b + var45 * var45 < 1.0F && ((mAllowToGenerateinVoid && aWorld + .getBlock(var38, var41, var44).isAir(aWorld, var38, var41, var44)) + || (block != null && (block.isReplaceableOreGen( + aWorld, + var38, + var41, + var44, + Blocks.stone) + || block.isReplaceableOreGen( + aWorld, + var38, + var41, + var44, + Blocks.end_stone) + || block.isReplaceableOreGen( + aWorld, + var38, + var41, + var44, + Blocks.netherrack))))) { aWorld.setBlock(var38, var41, var44, mBlock, mBlockMeta, 0); } } diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/api/world/GT_OreVein_Object.java b/src/main/java/gtPlusPlus/xmod/gregtech/api/world/GT_OreVein_Object.java index c6e9e6c92a..65813693b3 100644 --- a/src/main/java/gtPlusPlus/xmod/gregtech/api/world/GT_OreVein_Object.java +++ b/src/main/java/gtPlusPlus/xmod/gregtech/api/world/GT_OreVein_Object.java @@ -14,17 +14,8 @@ public class GT_OreVein_Object { final Material aBetween; // Materials aBetween, final Material aSporadic; // Materials aSporadic - GT_OreVein_Object( - String mOreMixName, - int minY, - int maxY, - int weight, - int density, - int size, - Material aPrimary, - Material aSecondary, - Material aBetween, - Material aSporadic) { + GT_OreVein_Object(String mOreMixName, int minY, int maxY, int weight, int density, int size, Material aPrimary, + Material aSecondary, Material aBetween, Material aSporadic) { this.mOreMixName = mOreMixName; this.minY = minY; this.maxY = maxY; diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/api/world/WorldGenUtils.java b/src/main/java/gtPlusPlus/xmod/gregtech/api/world/WorldGenUtils.java index 78f04269cf..5ca61cf4d7 100644 --- a/src/main/java/gtPlusPlus/xmod/gregtech/api/world/WorldGenUtils.java +++ b/src/main/java/gtPlusPlus/xmod/gregtech/api/world/WorldGenUtils.java @@ -1,9 +1,10 @@ package gtPlusPlus.xmod.gregtech.api.world; -import gtPlusPlus.core.material.Material; import java.util.ArrayList; import java.util.List; +import gtPlusPlus.core.material.Material; + public class WorldGenUtils { static List<GT_OreVein_Object> mOresToRegister = new ArrayList<GT_OreVein_Object>(); @@ -12,19 +13,19 @@ public class WorldGenUtils { mOresToRegister.add(newVein); } - public static boolean generateNewOreVeinObject( - String mOreMixName, - int minY, - int maxY, - int weight, - int density, - int size, - Material aPrimary, - Material aSecondary, - Material aBetween, - Material aSporadic) { + public static boolean generateNewOreVeinObject(String mOreMixName, int minY, int maxY, int weight, int density, + int size, Material aPrimary, Material aSecondary, Material aBetween, Material aSporadic) { GT_OreVein_Object newVein = new GT_OreVein_Object( - mOreMixName, minY, maxY, weight, density, size, aPrimary, aSecondary, aBetween, aSporadic); + mOreMixName, + minY, + maxY, + weight, + density, + size, + aPrimary, + aSecondary, + aBetween, + aSporadic); addNewOreMixForWorldgen(newVein); return true; } |