Jump to content

1.6.2 addPotionEffect not working


Shalashalska

Recommended Posts

For some reason, I cannot get addPotionEffect to work correctly.

 

The method that I had working in 1.5.2:

[/code

    public boolean onLeftClickEntity(ItemStack stack, EntityPlayer player,

            Entity entity) {

        if (entity instanceof EntityLiving) {

            EntityLiving entityLiving = (EntityLiving) entity;

            entityLiving.addPotionEffect(potionEffect);

        }

        return false;

    }

And this is the code for the item.
[code]
        thoriumSword = new ItemPotionSword(ItemIds.THORIUM_SWORD_ID, TOOL_THORIUM, Strings.THORIUM_SWORD_NAME, new PotionEffect(Potion.wither.id, 1000, 1, true), Strings.TEXTURE_FOLDER + ":" + Strings.THORIUM_SWORD_NAME);

 

Note:

I stepped through it and nothing went wrong, it just didn't work for some reason.  Also, it will occasionally work, but other times it won't work.

Source:

https://github.com/Shalashalska/Melior-Metallum/blob/master/metallum_common/metallum/item/ItemPotionSword.java

 

Edit: Now it started working properly again.

 

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.

Announcements



×
×
  • Create New...

Important Information

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