Posted November 4, 20168 yr 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; } } Try out my new Modpack for MC 1.15.2 https://www.curseforge.com/minecraft/modpacks/terran-civilization
November 4, 20168 yr Look at what EntityLiving#curePotionEffects actually does. VANILLA MINECRAFT CLASSES ARE THE BEST RESOURCES WHEN MODDING I will be posting 1.15.2 modding tutorials on this channel. If you want to be notified of it do the normal YouTube stuff like subscribing, ect. Forge and vanilla BlockState generator.
November 4, 20168 yr Author Yeah i already figured it out by myself. You people are answering very fast hehe. I replaced it with this: entityLiving.curePotionEffects(new ItemStack(Items.MILK_BUCKET)); Thank you anyway! Try out my new Modpack for MC 1.15.2 https://www.curseforge.com/minecraft/modpacks/terran-civilization
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.