Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public class Shield extends ItemShield {
- public String name;
- public CreativeTabs tab;
- public Shield(int durability, String name, CreativeTabs tab) {
- this.setMaxDamage(durability);
- this.name = name;
- this.tab = tab;
- this.addPropertyOverride(new ResourceLocation("blocking"), new IItemPropertyGetter() {
- @SideOnly(Side.CLIENT)
- public float apply(ItemStack stack, World worldIn, EntityLivingBase entityIn) {
- return entityIn != null && entityIn.isHandActive() && entityIn.getActiveItemStack() == stack ? 1.0F
- : 0.0F;
- }
- });
- this.setCreativeTab(tab);
- }
- @Override
- public String getItemStackDisplayName(ItemStack stack) {
- return I18n.translateToLocal("item." + name + ".name");
- }
- @Override
- @SideOnly(Side.CLIENT)
- public CreativeTabs getCreativeTab() {
- return tab;
- }
- @Override
- public ActionResult<ItemStack> onItemRightClick(ItemStack itemStackIn, World worldIn, EntityPlayer playerIn,
- EnumHand hand) {
- playerIn.setActiveHand(hand);
- if (playerIn.isCollided) {
- itemStackIn.damageItem(1, playerIn);
- }
- return new ActionResult(EnumActionResult.SUCCESS, itemStackIn);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement