Jump to content

Recommended Posts

Posted

Hi,

I want to perform an action for each tick while the player is right clicking. I also want the animation not to be repeated, juste like the shield. I saw that ItemBow and ItemShield had property like

this.addPropertyOverride(new ResourceLocation("pull"), new IItemPropertyGetter()
        {
            @SideOnly(Side.CLIENT)
            public float apply(ItemStack stack, @Nullable World worldIn, @Nullable EntityLivingBase entityIn)
            {
                if (entityIn == null)
                {
                    return 0.0F;
                }
                else
                {
                    return !(entityIn.getActiveItemStack().getItem() instanceof ItemBow) ? 0.0F : (float)(stack.getMaxItemUseDuration() - entityIn.getItemInUseCount()) / 20.0F;
                }
            }
        });

 

I also overrided Item#getMaxItemUseDuration and Item#getItemUseAction but I don't know more. This video uses the same system.

 

Thank you for your help !

Guest
This topic is now closed to further replies.

Announcements



×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.