MCPcopy Create free account
hub / github.com/GregTech6/gregtech6 / ItemArmorBase

Class ItemArmorBase

src/main/java/gregapi/item/ItemArmorBase.java:65–170  ·  view source on GitHub ↗

@author Gregorius Techneticies

Source from the content-addressed store, hash-verified

63 * @author Gregorius Techneticies
64 */
65@Optional.InterfaceList(value = {
66 @Optional.Interface(iface = "ic2.api.item.IMetalArmor", modid = ModIDs.IC2),
67 @Optional.Interface(iface = "forestry.api.apiculture.IArmorApiarist", modid = ModIDs.FR)
68})
69public class ItemArmorBase extends ItemArmor implements IItemUpdatable, IItemGT, IItemNoGTOverride, ISpecialArmor, IMetalArmor, IArmorApiarist {
70 protected IIcon mIcon;
71 protected final String mModID;
72 protected final String mName, mTooltip;
73
74 public int mEnchantability;
75 public boolean mMetalArmor = F, mBeeArmor = F;
76 public String mArmorTexture, mArmorName;
77
78 /**
79 * @param aUnlocalized The unlocalised Name of this Item. DO NOT START YOUR UNLOCALISED NAME WITH "gt."!!!
80 */
81 public ItemArmorBase(String aModID, String aUnlocalized, String aEnglish, String aEnglishTooltip, String aArmorName, int aSlot, int[] aShields, int aDurability, int aDamageReduction, int aEnchantability, boolean aMetalArmor, boolean aBeeArmor, Object... aRecipe) {
82 super(EnumHelper.addArmorMaterial("armor."+aUnlocalized, aDurability, aShields, aEnchantability), GT_API.api_proxy.addArmor(TEX_DIR_ARMOR+aArmorName), aSlot);
83 if (GAPI.mStartedInit) throw new IllegalStateException("Items can only be initialised within preInit!");
84 mName = aUnlocalized;
85 mModID = aModID;
86 mArmorTexture = mModID+":"+TEX_DIR_ARMOR+aArmorName+"/"+armorType+".png";
87 mArmorName = aArmorName;
88 mEnchantability = aEnchantability;
89 mMetalArmor = aMetalArmor;
90 mBeeArmor = aBeeArmor;
91 LH.add(mName, aEnglish);
92 setMaxDamage(aDurability);
93 setCreativeTab(CreativeTabs.tabCombat);
94 if (UT.Code.stringValid(aEnglishTooltip)) LH.add(mTooltip = mName + ".tooltip_main", aEnglishTooltip); else mTooltip = null;
95 ST.register(this, mName);
96 if (aRecipe != null && aRecipe.length > 0) {
97 CR.shaped(ST.make(this, 1, 0), CR.DEF_REV_NCC, aRecipe);
98 OreDictItemData tData = OM.data(ST.make(this, 1, 0));
99 if (tData != null) tData.setUseVanillaDamage();
100 }
101 }
102
103 @Override
104 @SuppressWarnings("unchecked")
105 public void addInformation(ItemStack aStack, EntityPlayer aPlayer, @SuppressWarnings("rawtypes") List aList, boolean aF3_H) {
106 if (getMaxDamage() > 0 && !getHasSubtypes()) aList.add((aStack.getMaxDamage() - getDamage(aStack)) + " / " + aStack.getMaxDamage());
107 if (mTooltip != null) aList.add(LanguageHandler.translate(mTooltip, mTooltip));
108 addAdditionalToolTips(aList, aStack, aF3_H);
109 while (aList.remove(null));
110 }
111
112 protected void addAdditionalToolTips(List<String> aList, ItemStack aStack, boolean aF3_H) {
113 //
114 }
115
116 public ItemStack onDispense(IBlockSource aSource, ItemStack aStack) {
117 EnumFacing enumfacing = BlockDispenser.func_149937_b(aSource.getBlockMetadata());
118 IPosition iposition = BlockDispenser.func_149939_a(aSource);
119 ItemStack itemstack1 = aStack.splitStack(1);
120 BehaviorDefaultDispenseItem.doDispense(aSource.getWorld(), itemstack1, 6, enumfacing, iposition);
121 return aStack;
122 }

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected