Jump to content

[1.16.2] Apply an effect right after another finish


KiiNGz8
 Share

Recommended Posts

So I was trying to make an ability for my weapon and I want it to apply the slowness effect right after the other ones finish is there any way of doing so?

I´ll put my code if it helps

   @Override
    public ActionResult<ItemStack> onItemRightClick(World worldIn, PlayerEntity playerIn, Hand handIn) {
        playerIn.getCooldownTracker().setCooldown(RegistryHandler.FOREST_STRIKER.get(), 40 * 20);
        playerIn.addPotionEffect(new EffectInstance(Effects.SPEED, 15 * 20));
        playerIn.addPotionEffect(new EffectInstance(Effects.RESISTANCE, 15 * 20));
        playerIn.addPotionEffect(new EffectInstance(Effects.JUMP_BOOST, 15 * 20));
        playerIn.getItemStackFromSlot(EquipmentSlotType.MAINHAND).damageItem(900, playerIn, e -> e.sendBreakAnimation(EquipmentSlotType.MAINHAND));
        return super.onItemRightClick(worldIn, playerIn, handIn);
        }
}

 

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share



×
×
  • Create New...

Important Information

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