Накладывание дебафа при съедании предмета

Как можно сделать так, чтобы при съедании предмета накладывался дебаф на игрока?

Вот код с инициализацией пойза


PotionInit:
package cloudninja.packag.init;

import cloudninja.packag.potions.CustomPotion;
import cloudninja.packag.register.ItemRegistry;
import net.minecraft.entity.SharedMonsterAttributes;
import net.minecraft.init.Items;
import net.minecraft.init.PotionTypes;
import net.minecraft.potion.Potion;
import net.minecraft.potion.PotionEffect;
import net.minecraft.potion.PotionHelper;
import net.minecraft.potion.PotionType;
import net.minecraft.util.math.MathHelper;
import net.minecraftforge.fml.common.registry.ForgeRegistries;

public class PotionInit {
public static final Potion MY_POTION_EFFECT = new CustomPotion("my_potion", false,10514519,0,0).registerPotionAttributeModifier(SharedMonsterAttributes.KNOCKBACK_RESISTANCE, MathHelper.getRandomUUID().toString(), 3.0D, 2);
public static final PotionType MY_POTION = new PotionType("my_potion", new PotionEffect[] {new PotionEffect(MY_POTION_EFFECT,1200)}).setRegistryName("my_potion");
public static final PotionType LONG_MY_POTION = new PotionType("my_potion", new PotionEffect[] {new PotionEffect(MY_POTION_EFFECT,1200)}).setRegistryName("long_my_potion");

public static void registerPotions(){
    registerPotion(MY_POTION,LONG_MY_POTION,MY_POTION_EFFECT);
    registerPotionMixes();
}

private static void registerPotion(PotionType defaultPotion,PotionType longPotion,Potion effect)
{
    ForgeRegistries.POTIONS.register(effect);
    ForgeRegistries.POTION_TYPES.register(defaultPotion);
    ForgeRegistries.POTION_TYPES.register(longPotion);
    }

private static void registerPotionMixes ()
{
PotionHelper.addMix(MY_POTION, ItemRegistry.COCONUT,LONG_MY_POTION);
PotionHelper.addMix(PotionTypes.SLOWNESS, ItemRegistry.COCONUT, MY_POTION);
}
}
 
Можно ли в ItemFood добавить this.setPoisonEffect в 1.12?

Java:
package cloudninja.packag.items.food;

import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.init.MobEffects;
import net.minecraft.item.ItemFood;
import net.minecraft.potion.PotionEffect;


 
public class ItemCoconut extends ItemFood {
    public ItemCoconut(String name, int amount, float saturation, boolean isWolfFood) {
        
        super(amount, saturation, isWolfFood);
        this.setRegistryName(name);
        this.setUnlocalizedName(name);
        this.setAlwaysEdible();
        this.setCreativeTab(CreativeTabs.FOOD);
        this.setPotionEffect();
        
    }
    
    
 
}
 
я решил проблему. Вот код если кому надо.

Java:
package cloudninja.packag.items.food;

import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.init.MobEffects;
import net.minecraft.item.ItemFood;
import net.minecraft.potion.PotionEffect;


 
public class ItemCoconut extends ItemFood {
    public ItemCoconut(String name, int amount, float saturation, boolean isWolfFood) {
        
        super(amount, saturation, isWolfFood);
        this.setRegistryName(name);
        this.setUnlocalizedName(name);
        this.setAlwaysEdible();
        this.setCreativeTab(CreativeTabs.FOOD);
        this.setPotionEffect(new PotionEffect(MobEffects.POISON,100,5), 1.0f);
        
    }
    
    
 
}
 
Сверху