diff options
| author | Draknyte1 <Draknyte1@hotmail.com> | 2016-11-06 19:32:27 +1000 |
|---|---|---|
| committer | Draknyte1 <Draknyte1@hotmail.com> | 2016-11-06 19:32:27 +1000 |
| commit | cbe0e497be8e466c380a5b4fa781b314ede9ada3 (patch) | |
| tree | b85848b432adf458e3abda466ee46d9dfc3e454b /src/Java/gtPlusPlus/xmod/gregtech/api/items | |
| parent | c40416b036c0e89451e1558253ccf07bbee028d0 (diff) | |
| download | GT5-Unofficial-cbe0e497be8e466c380a5b4fa781b314ede9ada3.tar.gz GT5-Unofficial-cbe0e497be8e466c380a5b4fa781b314ede9ada3.tar.bz2 GT5-Unofficial-cbe0e497be8e466c380a5b4fa781b314ede9ada3.zip | |
Revert "$ Cleaned up the entire project."
This reverts commit 0669f5eb9d5029a8b94ec552171b0837605f7747.
# Conflicts:
# src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/GregtechMTE_NuclearReactor.java
# src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/GregtechMetaTileEntity_MassFabricator.java
Revert "% Cleaned up Imports."
This reverts commit 3654052fb63a571c5eaca7f20714b87c17f7e966.
Diffstat (limited to 'src/Java/gtPlusPlus/xmod/gregtech/api/items')
9 files changed, 1967 insertions, 2629 deletions
diff --git a/src/Java/gtPlusPlus/xmod/gregtech/api/items/Gregtech_Generic_Item.java b/src/Java/gtPlusPlus/xmod/gregtech/api/items/Gregtech_Generic_Item.java index 91af8e3297..1c135a7f92 100644 --- a/src/Java/gtPlusPlus/xmod/gregtech/api/items/Gregtech_Generic_Item.java +++ b/src/Java/gtPlusPlus/xmod/gregtech/api/items/Gregtech_Generic_Item.java @@ -1,19 +1,22 @@ package gtPlusPlus.xmod.gregtech.api.items; -import java.util.List; - -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.*; +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.*; +import net.minecraft.dispenser.BehaviorDefaultDispenseItem; +import net.minecraft.dispenser.BehaviorProjectileDispense; +import net.minecraft.dispenser.IBlockSource; +import net.minecraft.dispenser.IPosition; import net.minecraft.entity.EntityLivingBase; import net.minecraft.entity.IProjectile; import net.minecraft.entity.player.EntityPlayer; @@ -23,173 +26,161 @@ import net.minecraft.item.ItemStack; 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; /** - * Extended by most Items, also used as a fallback Item, to prevent the - * accidental deletion when Errors occur. + * 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 { - 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); - } - - @Override - protected IProjectile getProjectileEntity(final World aWorld, final IPosition aPosition) { - return null; - } - } - private final String mName, mTooltip; - - protected IIcon mIcon; - - public Gregtech_Generic_Item(final String aUnlocalized, final String aEnglish, final String aEnglishTooltip) { - this(aUnlocalized, aEnglish, aEnglishTooltip, true); - } - - 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); - } - else { - this.mTooltip = null; - } - this.setCreativeTab(AddToCreativeTab.tabMachines); - GameRegistry.registerItem(this, this.mName, CORE.MODID); - BlockDispenser.dispenseBehaviorRegistry.putObject(this, new GT_Item_Dispense()); - } - - protected void addAdditionalToolTips(final List aList, final ItemStack aStack) { - // - } - - @Override - 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()); - } - if (this.mTooltip != null) { - aList.add(GT_LanguageManager.getTranslation(this.mTooltip)); - } - if (GT_ModHandler.isElectricItem(aStack)) { - aList.add("Tier: " + this.getTier(aStack)); - } - this.addAdditionalToolTips(aList, aStack); - } - - @Override - public boolean doesSneakBypassUse(final World aWorld, final int aX, final int aY, final int aZ, - final EntityPlayer aPlayer) { - return true; - } - - @Override - public int getColorFromItemStack(final ItemStack stack, int HEX_OxFFFFFF) { - if (stack.getDisplayName().contains("LuV")) { - HEX_OxFFFFFF = 0xffffcc; - } - else if (stack.getDisplayName().contains("ZPM")) { + private final String mName, mTooltip; + protected IIcon mIcon; + + public Gregtech_Generic_Item(String aUnlocalized, String aEnglish, String aEnglishTooltip) { + this(aUnlocalized, aEnglish, aEnglishTooltip, true); + } + + public Gregtech_Generic_Item(String aUnlocalized, String aEnglish, String aEnglishTooltip, boolean aWriteToolTipIntoLangFile) { + super(); + mName = aUnlocalized; + GT_LanguageManager.addStringLocalization(mName + ".name", aEnglish); + if (GT_Utility.isStringValid(aEnglishTooltip)) + GT_LanguageManager.addStringLocalization(mTooltip = mName + ".tooltip_main", aEnglishTooltip, aWriteToolTipIntoLangFile); + else mTooltip = null; + setCreativeTab(AddToCreativeTab.tabMachines); + GameRegistry.registerItem(this, mName, CORE.MODID); + BlockDispenser.dispenseBehaviorRegistry.putObject(this, new GT_Item_Dispense()); + } + + @Override + public final Item setUnlocalizedName(String aName) { + return this; + } + + @Override + public final String getUnlocalizedName() { + return mName; + } + + @Override + public String getUnlocalizedName(ItemStack aStack) { + return getHasSubtypes() ? mName + "." + getDamage(aStack) : mName; + } + + @Override + @SideOnly(Side.CLIENT) + public void registerIcons(IIconRegister aIconRegister) { + mIcon = aIconRegister.registerIcon(CORE.MODID+":"+mName); + } + + @Override + public boolean doesSneakBypassUse(World aWorld, int aX, int aY, int aZ, EntityPlayer aPlayer) { + return true; + } + + @Override + public IIcon getIconFromDamage(int par1) { + return mIcon; + } + + public int getTier(ItemStack aStack) { + return 0; + } + + @Override + public void addInformation(ItemStack aStack, EntityPlayer aPlayer, List aList, boolean aF3_H) { + if (getMaxDamage() > 0 && !getHasSubtypes()) + aList.add((aStack.getMaxDamage() - getDamage(aStack)) + " / " + aStack.getMaxDamage()); + if (mTooltip != null) aList.add(GT_LanguageManager.getTranslation(mTooltip)); + if (GT_ModHandler.isElectricItem(aStack)) aList.add("Tier: " + getTier(aStack)); + addAdditionalToolTips(aList, aStack); + } + + protected void addAdditionalToolTips(List aList, ItemStack aStack) { + // + } + + @Override + public void onCreated(ItemStack aStack, World aWorld, EntityPlayer aPlayer) { + isItemStackUsable(aStack); + } + + public boolean isItemStackUsable(ItemStack aStack) { + return true; + } + + public ItemStack onDispense(IBlockSource aSource, ItemStack aStack) { + EnumFacing enumfacing = BlockDispenser.func_149937_b(aSource.getBlockMetadata()); + IPosition iposition = BlockDispenser.func_149939_a(aSource); + ItemStack itemstack1 = aStack.splitStack(1); + BehaviorDefaultDispenseItem.doDispense(aSource.getWorld(), itemstack1, 6, enumfacing, iposition); + return aStack; + } + + @Override + public EntityArrow getProjectile(SubTag aProjectileType, ItemStack aStack, World aWorld, double aX, double aY, double aZ) { + return null; + } + + @Override + public EntityArrow getProjectile(SubTag aProjectileType, ItemStack aStack, World aWorld, EntityLivingBase aEntity, float aSpeed) { + return null; + } + + @Override + public boolean hasProjectile(SubTag aProjectileType, ItemStack aStack) { + return false; + } + + @Override + public ItemStack getContainerItem(ItemStack aStack) { + return null; + } + + @Override + public boolean hasContainerItem(ItemStack aStack) { + return getContainerItem(aStack) != null; + } + + public static class GT_Item_Dispense extends BehaviorProjectileDispense { + @Override + public ItemStack dispenseStack(IBlockSource aSource, ItemStack aStack) { + return ((Gregtech_Generic_Item) aStack.getItem()).onDispense(aSource, aStack); + } + + @Override + protected IProjectile getProjectileEntity(World aWorld, IPosition aPosition) { + return null; + } + } + + @Override + public int getColorFromItemStack(ItemStack stack, int HEX_OxFFFFFF) { + if (stack.getDisplayName().contains("LuV")){ + HEX_OxFFFFFF = 0xffffcc; + } + else if (stack.getDisplayName().contains("ZPM")){ HEX_OxFFFFFF = 0xace600; } - else if (stack.getDisplayName().contains("UV")) { + else if (stack.getDisplayName().contains("UV")){ HEX_OxFFFFFF = 0xffff00; } - else if (stack.getDisplayName().contains("MAX")) { + else if (stack.getDisplayName().contains("MAX")){ HEX_OxFFFFFF = 0xff0000; } - else if (stack.getDisplayName().contains("Sodium")) { + else if (stack.getDisplayName().contains("Sodium")){ HEX_OxFFFFFF = Utils.rgbtoHexValue(0, 0, 150); } - else if (stack.getDisplayName().contains("Cadmium")) { + else if (stack.getDisplayName().contains("Cadmium")){ HEX_OxFFFFFF = Utils.rgbtoHexValue(50, 50, 60); } - else if (stack.getDisplayName().contains("Lithium")) { + else if (stack.getDisplayName().contains("Lithium")){ HEX_OxFFFFFF = Utils.rgbtoHexValue(225, 220, 255); } else { HEX_OxFFFFFF = 0xffffff; - } + } return HEX_OxFFFFFF; } - - @Override - public ItemStack getContainerItem(final ItemStack aStack) { - return null; - } - - @Override - public IIcon getIconFromDamage(final int par1) { - return this.mIcon; - } - - @Override - 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) { - return null; - } - - public int getTier(final ItemStack aStack) { - return 0; - } - - @Override - public final String getUnlocalizedName() { - return this.mName; - } - - @Override - public String getUnlocalizedName(final ItemStack aStack) { - return this.getHasSubtypes() ? this.mName + "." + this.getDamage(aStack) : this.mName; - } - - @Override - public boolean hasContainerItem(final ItemStack aStack) { - return this.getContainerItem(aStack) != null; - } - - @Override - public boolean hasProjectile(final SubTag aProjectileType, final ItemStack aStack) { - return false; - } - - public boolean isItemStackUsable(final ItemStack aStack) { - return true; - } - - @Override - public void onCreated(final ItemStack aStack, final World aWorld, final EntityPlayer aPlayer) { - this.isItemStackUsable(aStack); - } - - public ItemStack onDispense(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); - BehaviorDefaultDispenseItem.doDispense(aSource.getWorld(), itemstack1, 6, enumfacing, iposition); - return aStack; - } - - @Override - @SideOnly(Side.CLIENT) - public void registerIcons(final IIconRegister aIconRegister) { - this.mIcon = aIconRegister.registerIcon(CORE.MODID + ":" + this.mName); - } - - @Override - public final Item setUnlocalizedName(final String aName) { - return this; - } }
\ No newline at end of file diff --git a/src/Java/gtPlusPlus/xmod/gregtech/api/items/Gregtech_MetaItem.java b/src/Java/gtPlusPlus/xmod/gregtech/api/items/Gregtech_MetaItem.java index 1161badfdc..484cc19ea7 100644 --- a/src/Java/gtPlusPlus/xmod/gregtech/api/items/Gregtech_MetaItem.java +++ b/src/Java/gtPlusPlus/xmod/gregtech/api/items/Gregtech_MetaItem.java @@ -1,376 +1,323 @@ package gtPlusPlus.xmod.gregtech.api.items; -import java.util.*; - -import cpw.mods.fml.relauncher.Side; -import cpw.mods.fml.relauncher.SideOnly; +import static gregtech.api.enums.GT_Values.D1; import gregtech.api.GregTech_API; -import gregtech.api.enums.*; +import gregtech.api.enums.Materials; +import gregtech.api.enums.SubTag; import gregtech.api.enums.TC_Aspects.TC_AspectStack; -import gregtech.api.interfaces.*; +import gregtech.api.interfaces.IFoodStat; +import gregtech.api.interfaces.IIconContainer; +import gregtech.api.interfaces.IItemContainer; import gregtech.api.objects.ItemData; -import gregtech.api.util.*; +import gregtech.api.util.GT_LanguageManager; +import gregtech.api.util.GT_OreDictUnificator; +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.ArrayList; +import java.util.Arrays; +import java.util.BitSet; +import java.util.HashMap; +import java.util.List; + import net.minecraft.client.renderer.texture.IIconRegister; import net.minecraft.creativetab.CreativeTabs; import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.item.*; +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; 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. - * <p/> - * You can also use the unlocalized Name gotten from getUnlocalizedName() as - * Key if you want to get a specific Item. - */ - public static final HashMap<String, Gregtech_MetaItem> sInstances = new HashMap<String, Gregtech_MetaItem>(); + /** + * All instances of this Item Class are listed here. + * This gets used to register the Renderer to all Items of this Type, if useStandardMetaItemRenderer() returns true. + * <p/> + * You can also use the unlocalized Name gotten from getUnlocalizedName() as Key if you want to get a specific Item. + */ + public static final HashMap<String, Gregtech_MetaItem> sInstances = new HashMap<String, Gregtech_MetaItem>(); /* ---------- CONSTRUCTOR AND MEMBER VARIABLES ---------- */ - public final short mOffset, mItemAmount; - public final BitSet mEnabledItems; - public final BitSet mVisibleItems; - public final IIcon[][] mIconList; + public final short mOffset, mItemAmount; + public final BitSet mEnabledItems; + public final BitSet mVisibleItems; + public final IIcon[][] mIconList; - public final HashMap<Short, IFoodStat> mFoodStats = new HashMap<Short, IFoodStat>(); - public final HashMap<Short, Long[]> mElectricStats = new HashMap<Short, Long[]>(); - public final HashMap<Short, Long[]> mFluidContainerStats = new HashMap<Short, Long[]>(); - public final HashMap<Short, Short> mBurnValues = new HashMap<Short, Short>(); + public final HashMap<Short, IFoodStat> mFoodStats = new HashMap<Short, IFoodStat>(); + public final HashMap<Short, Long[]> mElectricStats = new HashMap<Short, Long[]>(); + public final HashMap<Short, Long[]> mFluidContainerStats = new HashMap<Short, Long[]>(); + public final HashMap<Short, Short> mBurnValues = new HashMap<Short, Short>(); - /** - * Creates the Item using these Parameters. - * - * @param aUnlocalized - * The Unlocalized Name of this Item. - */ - public Gregtech_MetaItem(final String aUnlocalized, final short aOffset, final short aItemAmount) { - super(aUnlocalized); - this.setCreativeTab(AddToCreativeTab.tabMachines); - this.setHasSubtypes(true); - this.setMaxDamage(0); - this.mEnabledItems = new BitSet(aItemAmount); - this.mVisibleItems = new BitSet(aItemAmount); + /** + * Creates the Item using these Parameters. + * + * @param aUnlocalized The Unlocalized Name of this Item. + */ + public Gregtech_MetaItem(String aUnlocalized, short aOffset, short aItemAmount) { + super(aUnlocalized); + setCreativeTab(AddToCreativeTab.tabMachines); + setHasSubtypes(true); + setMaxDamage(0); + mEnabledItems = new BitSet(aItemAmount); + mVisibleItems = new BitSet(aItemAmount); - this.mOffset = (short) Math.min(32766, aOffset); - this.mItemAmount = (short) Math.min(aItemAmount, 32766 - this.mOffset); - this.mIconList = new IIcon[aItemAmount][1]; + mOffset = (short) Math.min(32766, aOffset); + mItemAmount = (short) Math.min(aItemAmount, 32766 - mOffset); + mIconList = new IIcon[aItemAmount][1]; - Gregtech_MetaItem.sInstances.put(this.getUnlocalizedName(), this); - } + sInstances.put(getUnlocalizedName(), this); + } - /** - * This adds a Custom Item to the ending Range. - * - * @param aID - * The Id of the assigned Item [0 - mItemAmount] (The MetaData - * gets auto-shifted by +mOffset) - * @param aEnglish - * The Default Localized Name of the created Item - * @param aToolTip - * The Default ToolTip of the created Item, you can also insert - * null for having no ToolTip - * @param aFoodBehavior - * The Food Value of this Item. Can be null aswell. Just a - * convenience thing. - * @param aRandomData - * The OreDict Names you want to give the Item. Also used for TC - * Aspects and some other things. - * @return An ItemStack containing the newly created Item. - */ - public final ItemStack addItem(final int aID, final String aEnglish, String aToolTip, final Object... aRandomData) { - if (aToolTip == null) { - aToolTip = ""; - } - if (aID >= 0 && aID < this.mItemAmount) { - final ItemStack rStack = new ItemStack(this, 1, this.mOffset + aID); - this.mEnabledItems.set(aID); - this.mVisibleItems.set(aID); - GT_LanguageManager.addStringLocalization(this.getUnlocalizedName(rStack) + ".name", aEnglish); - GT_LanguageManager.addStringLocalization(this.getUnlocalizedName(rStack) + ".tooltip", aToolTip); - final List<TC_AspectStack> tAspects = new ArrayList<TC_AspectStack>(); - // Important Stuff to do first - for (final Object tRandomData : aRandomData) { - if (tRandomData instanceof SubTag) { - if (tRandomData == SubTag.INVISIBLE) { - this.mVisibleItems.set(aID, false); - continue; - } - if (tRandomData == SubTag.NO_UNIFICATION) { - GT_OreDictUnificator.addToBlacklist(rStack); - continue; - } - } - } - // now check for the rest - for (final Object tRandomData : aRandomData) { - if (tRandomData != null) { - boolean tUseOreDict = true; - - if (tRandomData instanceof Interface_ItemBehaviour) { - this.addItemBehavior(this.mOffset + aID, - (Interface_ItemBehaviour<Gregtech_MetaItem_Base>) tRandomData); - tUseOreDict = false; - } - if (tRandomData instanceof IItemContainer) { - ((IItemContainer) tRandomData).set(rStack); - tUseOreDict = false; - } - if (tRandomData instanceof SubTag) { - continue; - } - if (tRandomData instanceof TC_AspectStack) { - ((TC_AspectStack) tRandomData).addToAspectList(tAspects); - continue; - } - if (tRandomData instanceof ItemData) { - if (GT_Utility.isStringValid(tRandomData)) { - GT_OreDictUnificator.registerOre(tRandomData, rStack); - } - else { - GT_OreDictUnificator.addItemData(rStack, (ItemData) tRandomData); - } - continue; - } - if (tUseOreDict) { - GT_OreDictUnificator.registerOre(tRandomData, rStack); - continue; - } - } - } - if (GregTech_API.sThaumcraftCompat != null) { - GregTech_API.sThaumcraftCompat.registerThaumcraftAspectsToItem(rStack, tAspects, false); - } - return rStack; - } - return null; - } - - @Override - public int getColorFromItemStack(final ItemStack stack, int HEX_OxFFFFFF) { - if (stack.getDisplayName().contains("LuV")) { - HEX_OxFFFFFF = 0xffffcc; - } - else if (stack.getDisplayName().contains("ZPM")) { - HEX_OxFFFFFF = 0xace600; - } - else if (stack.getDisplayName().contains("UV")) { - HEX_OxFFFFFF = 0xffff00; - } - else if (stack.getDisplayName().contains("MAX")) { - HEX_OxFFFFFF = 0xff0000; - } - else { - HEX_OxFFFFFF = 0xffffff; - } - return HEX_OxFFFFFF; - } + /** + * This adds a Custom Item to the ending Range. + * + * @param aID The Id of the assigned Item [0 - mItemAmount] (The MetaData gets auto-shifted by +mOffset) + * @param aEnglish The Default Localized Name of the created Item + * @param aToolTip The Default ToolTip of the created Item, you can also insert null for having no ToolTip + * @param aFoodBehavior The Food Value of this Item. Can be null aswell. Just a convenience thing. + * @param aRandomData The OreDict Names you want to give the Item. Also used for TC Aspects and some other things. + * @return An ItemStack containing the newly created Item. + */ + public final ItemStack addItem(int aID, String aEnglish, String aToolTip, Object... aRandomData) { + if (aToolTip == null) aToolTip = ""; + if (aID >= 0 && aID < mItemAmount) { + ItemStack rStack = new ItemStack(this, 1, mOffset + aID); + mEnabledItems.set(aID); + mVisibleItems.set(aID); + GT_LanguageManager.addStringLocalization(getUnlocalizedName(rStack) + ".name", aEnglish); + GT_LanguageManager.addStringLocalization(getUnlocalizedName(rStack) + ".tooltip", aToolTip); + List<TC_AspectStack> tAspects = new ArrayList<TC_AspectStack>(); + // Important Stuff to do first + for (Object tRandomData : aRandomData) + if (tRandomData instanceof SubTag) { + if (tRandomData == SubTag.INVISIBLE) { + mVisibleItems.set(aID, false); + continue; + } + if (tRandomData == SubTag.NO_UNIFICATION) { + GT_OreDictUnificator.addToBlacklist(rStack); + continue; + } + } + // now check for the rest + for (Object tRandomData : aRandomData) + if (tRandomData != null) { + boolean tUseOreDict = true; + + if (tRandomData instanceof Interface_ItemBehaviour) { + addItemBehavior(mOffset + aID, (Interface_ItemBehaviour<Gregtech_MetaItem_Base>) tRandomData); + tUseOreDict = false; + } + if (tRandomData instanceof IItemContainer) { + ((IItemContainer) tRandomData).set(rStack); + tUseOreDict = false; + } + if (tRandomData instanceof SubTag) { + continue; + } + if (tRandomData instanceof TC_AspectStack) { + ((TC_AspectStack) tRandomData).addToAspectList(tAspects); + continue; + } + if (tRandomData instanceof ItemData) { + if (GT_Utility.isStringValid(tRandomData)) + GT_OreDictUnificator.registerOre(tRandomData, rStack); + else GT_OreDictUnificator.addItemData(rStack, (ItemData) tRandomData); + continue; + } + if (tUseOreDict) { + GT_OreDictUnificator.registerOre(tRandomData, rStack); + continue; + } + } + if (GregTech_API.sThaumcraftCompat != null) + GregTech_API.sThaumcraftCompat.registerThaumcraftAspectsToItem(rStack, tAspects, false); + return rStack; + } + return null; + } - @Override - public final Long[] getElectricStats(final ItemStack aStack) { - return this.mElectricStats.get((short) aStack.getItemDamage()); - } + /** + * Sets the Furnace Burn Value for the Item. + * + * @param aMetaValue the Meta Value of the Item you want to set it to. [0 - 32765] + * @param aValue 200 = 1 Burn Process = 500 EU, max = 32767 (that is 81917.5 EU) + * @return the Item itself for convenience in constructing. + */ + public final Gregtech_MetaItem setBurnValue(int aMetaValue, int aValue) { + if (aMetaValue < 0 || aMetaValue >= mOffset + mEnabledItems.length() || aValue < 0) return this; + if (aValue == 0) mBurnValues.remove((short) aMetaValue); + else mBurnValues.put((short) aMetaValue, aValue > Short.MAX_VALUE ? Short.MAX_VALUE : (short) aValue); + return this; + } - @Override - public final Long[] getFluidContainerStats(final ItemStack aStack) { - return this.mFluidContainerStats.get((short) aStack.getItemDamage()); - } + /** + * @param aMetaValue the Meta Value of the Item you want to set it to. [0 - 32765] + * @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. + * @return the Item itself for convenience in constructing. + */ + public final Gregtech_MetaItem setElectricStats(int aMetaValue, long aMaxCharge, long aTransferLimit, long aTier, long aSpecialData, boolean aUseAnimations) { + if (aMetaValue < 0 || aMetaValue >= mOffset + mEnabledItems.length()) return this; + if (aMaxCharge == 0) mElectricStats.remove((short) aMetaValue); + else { + mElectricStats.put((short) aMetaValue, new Long[]{aMaxCharge, Math.max(0, aTransferLimit), Math.max(-1, aTier), aSpecialData}); + if (aMetaValue >= mOffset && aUseAnimations) + mIconList[aMetaValue - mOffset] = Arrays.copyOf(mIconList[aMetaValue - mOffset], Math.max(9, mIconList[aMetaValue - mOffset].length)); + } + return this; + } - /** - * @return the Icon the Material is going to be rendered with. - */ - public IIconContainer getIconContainer(final int aMetaData) { - return null; - } + /** + * @param aMetaValue the Meta Value of the Item you want to set it to. [0 - 32765] + * @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. + * @return the Item itself for convenience in constructing. + */ + public final Gregtech_MetaItem setFluidContainerStats(int aMetaValue, long aCapacity, long aStacksize) { + if (aMetaValue < 0 || aMetaValue >= mOffset + mEnabledItems.length()) return this; + if (aCapacity < 0) mElectricStats.remove((short) aMetaValue); + else mFluidContainerStats.put((short) aMetaValue, new Long[]{aCapacity, Math.max(1, aStacksize)}); + return this; + } - @Override - public boolean getIsRepairable(final ItemStack aStack, final ItemStack aMaterial) { - return false; - } + /** + * @return if this MetaGenerated Item should use my Default Renderer System. + */ + public boolean useStandardMetaItemRenderer() { + return true; + } - @Override - public int getItemEnchantability() { - return 0; - } + /** + * @return the Color Modulation the Material is going to be rendered with. + */ + public short[] getRGBa(ItemStack aStack) { + return Materials._NULL.getRGBA(); + } + /** + * @return the Icon the Material is going to be rendered with. + */ + public IIconContainer getIconContainer(int aMetaData) { + return null; + } + /* ---------- INTERNAL OVERRIDES ---------- */ - @Override - public EnumAction getItemUseAction(final ItemStack aStack) { - return EnumAction.none; - } + @Override + public ItemStack onItemRightClick(ItemStack aStack, World aWorld, EntityPlayer aPlayer) { + return super.onItemRightClick(aStack, aWorld, aPlayer); + } - @Override - public int getMaxItemUseDuration(final ItemStack aStack) { - return this.mFoodStats.get((short) this.getDamage(aStack)) == null ? 0 : 32; - } + @Override + public int getMaxItemUseDuration(ItemStack aStack) { + return mFoodStats.get((short) getDamage(aStack)) == null ? 0 : 32; + } - /** - * @return the Color Modulation the Material is going to be rendered with. - */ - public short[] getRGBa(final ItemStack aStack) { - return Materials._NULL.getRGBA(); - } + @Override + public EnumAction getItemUseAction(ItemStack aStack) { + return EnumAction.none; + } - @Override - @SideOnly(Side.CLIENT) - public void getSubItems(final Item var1, final CreativeTabs aCreativeTab, final List aList) { - for (int i = 0, j = this.mEnabledItems.length(); i < j; i++) { - if (this.mVisibleItems.get(i) || GT_Values.D1 && this.mEnabledItems.get(i)) { - final Long[] tStats = this.mElectricStats.get((short) (this.mOffset + i)); - if (tStats != null && tStats[3] < 0) { - final ItemStack tStack = new ItemStack(this, 1, this.mOffset + i); - this.setCharge(tStack, Math.abs(tStats[0])); - this.isItemStackUsable(tStack); - aList.add(tStack); - } - if (tStats == null || tStats[3] != -2) { - final ItemStack tStack = new ItemStack(this, 1, this.mOffset + i); - this.isItemStackUsable(tStack); - aList.add(tStack); - } - } - } - } + @Override + public final ItemStack onEaten(ItemStack aStack, World aWorld, EntityPlayer aPlayer) { + IFoodStat tStat = mFoodStats.get((short) getDamage(aStack)); + if (tStat != null) { + + } + return aStack; + } - @Override - public boolean isBookEnchantable(final ItemStack aStack, final ItemStack aBook) { - return false; - } + @Override + @SideOnly(Side.CLIENT) + public void getSubItems(Item var1, CreativeTabs aCreativeTab, List aList) { + for (int i = 0, j = mEnabledItems.length(); i < j; i++) + if (mVisibleItems.get(i) || (D1 && mEnabledItems.get(i))) { + Long[] tStats = mElectricStats.get((short) (mOffset + i)); + if (tStats != null && tStats[3] < 0) { + ItemStack tStack = new ItemStack(this, 1, mOffset + i); + setCharge(tStack, Math.abs(tStats[0])); + isItemStackUsable(tStack); + aList.add(tStack); + } + if (tStats == null || tStats[3] != -2) { + ItemStack tStack = new ItemStack(this, 1, mOffset + i); + isItemStackUsable(tStack); + aList.add(tStack); + } + } + } - @Override - public final ItemStack onEaten(final ItemStack aStack, final World aWorld, final EntityPlayer aPlayer) { - final IFoodStat tStat = this.mFoodStats.get((short) this.getDamage(aStack)); - if (tStat != null) { + @Override + @SideOnly(Side.CLIENT) + public final void registerIcons(IIconRegister aIconRegister) { + for (short i = 0, j = (short) mEnabledItems.length(); i < j; i++) + if (mEnabledItems.get(i)) { + for (byte k = 1; k < mIconList[i].length; k++) { + mIconList[i][k] = aIconRegister.registerIcon(CORE.MODID+":"+getUnlocalizedName() + "/" + i + "/" + k); + } + mIconList[i][0] = aIconRegister.registerIcon(CORE.MODID+":"+getUnlocalizedName() + "/" + i); + } + } - } - return aStack; - } + @Override + public final Long[] getElectricStats(ItemStack aStack) { + return mElectricStats.get((short) aS |
