Jump to content

[1.7.10] Adding a potion effect to armor


untamemadman

Recommended Posts

How do I add a potion effect to armor in 1.7.10

I found a tutorial for 1.7.2 that said I just have to add:

 

    @Override

    public void onArmorTick(World world, EntityPlayer player, ItemStack armor)

    {

        player.addPotionEffect(new PotionEffect(Potion.nightVision.id, 500, 1, true));

    }

 

to my Armor code but it doesn't give the player Night vision when he equip it. any help?

Link to comment
Share on other sites

I have this now:

 

    @Override

    public void onArmorTick(World world, EntityPlayer player, ItemStack armor)

    {

        if(world.isRemote == true)

        {

            player.addPotionEffect(new PotionEffect(Potion.nightVision.id, 2, 1, true));

        }

    }

 

Can you tell me if that is done correctly?

Link to comment
Share on other sites

if(!world.isRemote)

 

My code is:

 

    @Override

    public void onArmorTick(World world, EntityPlayer player, ItemStack armor)

    {

        if(!world.isRemote)

        {

            player.addPotionEffect(new PotionEffect(Potion.nightVision.id, 2, 1, true));

        }

    }

 

But the player still doesn't get night vision

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
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
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.



×
×
  • Create New...

Important Information

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