--- a/net/minecraft/world/item/consume_effects/ApplyStatusEffectsConsumeEffect.java +++ b/net/minecraft/world/item/consume_effects/ApplyStatusEffectsConsumeEffect.java @@ -13,6 +13,10 @@ import net.minecraft.world.item.ItemStack; import net.minecraft.world.level.World; +// CraftBukkit start +import org.bukkit.event.entity.EntityPotionEffectEvent; +// CraftBukkit end + public record ApplyStatusEffectsConsumeEffect(List effects, float probability) implements ConsumeEffect { public static final MapCodec CODEC = RecordCodecBuilder.mapCodec((instance) -> { @@ -38,7 +42,7 @@ } @Override - public boolean apply(World world, ItemStack itemstack, EntityLiving entityliving) { + public boolean apply(World world, ItemStack itemstack, EntityLiving entityliving, EntityPotionEffectEvent.Cause cause) { // CraftBukkit if (entityliving.getRandom().nextFloat() >= this.probability) { return false; } else { @@ -48,7 +52,7 @@ while (iterator.hasNext()) { MobEffect mobeffect = (MobEffect) iterator.next(); - if (entityliving.addEffect(new MobEffect(mobeffect))) { + if (entityliving.addEffect(new MobEffect(mobeffect), cause)) { // CraftBukkit flag = true; } }