Jump to content

MC 1.10+ Custom drink with effect


winnetrie

Recommended Posts

I made a custom drink that should remove potion effects just like the milk bucket.

Somehow this isn't working.

Just for the info i made a class that extends milkbucket, i also want to add some extra effects to it.

The extra effect is working, just not the potioneffect removing thing.

 

here is the code:

 

public class ItemCustomDrink extends ItemBucketMilk{

public int duration;
public int value;
public ItemCustomDrink(int duration, int value){
	this.duration=duration;
	this.value=value;



}
@Override
@Nullable
    public ItemStack onItemUseFinish(ItemStack stack, World worldIn, EntityLivingBase entityLiving)
    {
        if (entityLiving instanceof EntityPlayer && !((EntityPlayer)entityLiving).capabilities.isCreativeMode)
        {
            --stack.stackSize;
            
        }

        if (!worldIn.isRemote)
        {
        	//entityLiving.addPotionEffect(new PotionEffect(MobEffects.INSTANT_HEALTH, duration,value));
            entityLiving.curePotionEffects(stack);
            
        }

        if (entityLiving instanceof EntityPlayer)
        {
            ((EntityPlayer)entityLiving).addStat(StatList.getObjectUseStats(this));
        }

        return stack.stackSize <= 0 ? new ItemStack(Items.GLASS_BOTTLE) : stack;
    }

}

 

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.