From fe264b978f7e6a486034c7da239712287789babd Mon Sep 17 00:00:00 2001 From: Doc Date: Mon, 29 Jun 2026 09:02:23 -0400 Subject: [PATCH 1/4] Add missing values for EntityPotionEffectEvent.Cause Co-authored-by: Lulu13022002 <41980282+Lulu13022002@users.noreply.github.com> --- .../event/entity/EntityPotionEffectEvent.java | 122 +++++++++++++----- .../server/commands/RaidCommand.java.patch | 11 ++ .../world/effect/BadOmenMobEffect.java.patch | 11 ++ .../world/entity/AreaEffectCloud.java.patch | 2 +- .../world/entity/ConversionType.java.patch | 9 ++ .../entity/animal/axolotl/Axolotl.java.patch | 4 +- .../entity/animal/axolotl/PlayDead.java.patch | 10 ++ .../world/entity/animal/bee/Bee.java.patch | 2 +- .../entity/animal/dolphin/Dolphin.java.patch | 4 +- .../entity/animal/parrot/Parrot.java.patch | 2 +- .../entity/monster/hoglin/Hoglin.java.patch | 2 +- .../monster/piglin/AbstractPiglin.java.patch | 2 +- .../world/entity/raid/Raid.java.patch | 5 +- .../world/entity/raid/Raids.java.patch | 2 +- .../item/alchemy/PotionContents.java.patch | 2 +- .../item/component/Consumable.java.patch | 15 +-- .../item/component/DeathProtection.java.patch | 11 -- .../OminousBottleAmplifier.java.patch | 2 +- .../SuspiciousStewEffects.java.patch | 18 ++- ...ApplyStatusEffectsConsumeEffect.java.patch | 11 +- ...arAllStatusEffectsConsumeEffect.java.patch | 10 +- .../consume_effects/ConsumeEffect.java.patch | 19 --- ...emoveStatusEffectsConsumeEffect.java.patch | 9 +- .../level/block/EyeblossomBlock.java.patch | 9 +- .../block/entity/BellBlockEntity.java.patch | 6 +- .../entity/PotentSulfurBlockEntity.java.patch | 11 ++ .../TrialSpawnerStateData.java.patch | 11 ++ 27 files changed, 201 insertions(+), 121 deletions(-) create mode 100644 paper-server/patches/sources/net/minecraft/server/commands/RaidCommand.java.patch create mode 100644 paper-server/patches/sources/net/minecraft/world/effect/BadOmenMobEffect.java.patch create mode 100644 paper-server/patches/sources/net/minecraft/world/entity/animal/axolotl/PlayDead.java.patch delete mode 100644 paper-server/patches/sources/net/minecraft/world/item/component/DeathProtection.java.patch delete mode 100644 paper-server/patches/sources/net/minecraft/world/item/consume_effects/ConsumeEffect.java.patch create mode 100644 paper-server/patches/sources/net/minecraft/world/level/block/entity/PotentSulfurBlockEntity.java.patch diff --git a/paper-api/src/main/java/org/bukkit/event/entity/EntityPotionEffectEvent.java b/paper-api/src/main/java/org/bukkit/event/entity/EntityPotionEffectEvent.java index bd071ee390e7..ad36a408212e 100644 --- a/paper-api/src/main/java/org/bukkit/event/entity/EntityPotionEffectEvent.java +++ b/paper-api/src/main/java/org/bukkit/event/entity/EntityPotionEffectEvent.java @@ -147,17 +147,17 @@ public static HandlerList getHandlerList() { public enum Action { /** - * When the potion effect is added because the entity didn't have its + * When the potion effect is added because an entity didn't have its * type. */ ADDED, /** - * When the entity already had the potion effect type, but the effect is + * When an entity already had the potion effect type, but the effect is * changed. */ CHANGED, /** - * When the effect is removed due to all effects being removed. + * When the potion effect is removed due to all them being removed. */ CLEARED, /** @@ -172,37 +172,64 @@ public enum Action { public enum Cause { /** - * When the entity stands inside an area effect cloud. + * When an entity stands inside an effect cloud. */ - AREA_EFFECT_CLOUD, + EFFECT_CLOUD, /** - * When the entity is hit by a spectral or tipped arrow. + * When an entity is hit by a spectral or tipped arrow. */ ARROW, /** - * When the entity is inflicted with a potion effect due to an entity + * When an entity is inflicted with a potion effect due to an entity * attack (e.g. a cave spider or a shulker bullet). */ ATTACK, + /** + * When an entity gets a positive effect or a negative effect is removed as a gift made by another entity (like a dolphin or an axolotl) + */ + ENTITY_GIFT, /** * When an entity gets the effect from an axolotl. + * + * @deprecated use {@link #ENTITY_GIFT} and check the source with {@link #getSource()} */ + @Deprecated(since = "26.2") AXOLOTL, /** - * When beacon effects get applied due to the entity being nearby. + * When an entity plays dead (currently only for the axolotl). + */ + FAKE_DEATH, + /** + * When an entity self consume an item. + */ + SELF_CONSUME, + /** + * When an entity consume an item from another entity. + */ + CONSUME_OTHER, + /** + * When beacon effects get applied due to an entity being nearby. */ BEACON, /** - * When a potion effect is changed due to the /effect command. + * When an entity gets the effect from a bell. */ - COMMAND, + BELL, + /** + * When an entity comes in contact with a wither rose. + */ + WITHER_ROSE, + /** + * When an entity comes in contact with an eye blossom. + */ + EYE_BLOSSOM, /** - * When the entity gets the effect from a conduit. + * When an entity gets the effect from a conduit. */ CONDUIT, /** - * When a conversion from a villager zombie to a villager is started or - * finished. + * When a conversion started or finished (e.g. a villager zombie to a villager) or a cube mob + * is split. */ CONVERSION, /** @@ -210,8 +237,11 @@ public enum Cause { */ DEATH, /** - * When the entity gets the effect from a dolphin. + * When an entity gets the effect from a dolphin. + * + * @deprecated use {@link #ENTITY_GIFT} and check the source with {@link #getSource()} */ + @Deprecated(since = "26.2") DOLPHIN, /** * When the effect was removed due to expiration. @@ -220,7 +250,10 @@ public enum Cause { /** * When an effect is inflicted due to food (e.g. when a player eats or a * cookie is given to a parrot). + * + * @deprecated use {@link #SELF_CONSUME} and check the item in hand if needed or {@link #CONSUME_OTHER} */ + @Deprecated(since = "26.2") FOOD, /** * When an illusion illager makes himself disappear. @@ -228,12 +261,15 @@ public enum Cause { ILLUSION, /** * When all effects are removed due to a bucket of milk. + * + * @deprecated use {@link #SELF_CONSUME} and check the item in hand if needed */ + @Deprecated(since = "26.2") MILK, /** - * When the entity gets the effect from a nautilus. + * When an entity gets the effect from a nautilus. */ - NAUTILUS, + NAUTILUS, // TODO: should be ENTITY_GIFT but for now the source is not set (see MC-309103) /** * When a player gets bad omen after killing a patrol captain. * @@ -242,33 +278,41 @@ public enum Cause { @Deprecated(since = "1.21", forRemoval = true) PATROL_CAPTAIN, /** - * When a potion effect is modified through the plugin methods. - */ - PLUGIN, - /** - * When the entity drinks a potion. + * When an entity drinks a potion. + * + * @deprecated use {@link #SELF_CONSUME} and check the item in hand if needed */ + @Deprecated(since = "26.2") POTION_DRINK, /** - * When the entity is inflicted with an effect due to a splash potion. + * When an entity is inflicted with an effect due to a splash potion. */ POTION_SPLASH, + /** + * When the effect is caused by a raid. + * For example when a player gets close to a village with {@link PotionEffectType#BAD_OMEN} and gets {@link PotionEffectType#RAID_OMEN} + * or the raid start or finish with a hero. + */ + RAID, + /** + * When a player gets close to a trial spawner with {@link PotionEffectType#BAD_OMEN} and gets {@link PotionEffectType#TRIAL_OMEN}. + */ + TRIAL_STARTED, /** * When a spider gets effects when spawning on hard difficulty. */ - SPIDER_SPAWN, + SPIDER_SPAWN, // possibly move to a more generic ENTITY_SPAWN later /** - * When the entity gets effects from a totem item saving its life. + * When an entity gets effects from a totem item saving its life. + * + * @deprecated use {@link #SELF_CONSUME} and check the used item in {@link EntityResurrectEvent} */ + @Deprecated(since = "26.2") TOTEM, /** - * When the entity gets water breathing by wearing a turtle helmet. + * When an entity gets water breathing by wearing a turtle helmet. */ TURTLE_HELMET, - /** - * When the Cause is missing. - */ - UNKNOWN, /** * When a villager gets regeneration after a trade. */ @@ -278,8 +322,24 @@ public enum Cause { */ WARDEN, /** - * When an entity comes in contact with a wither rose. + * When a potion effect is changed due to the /effect or /raid command. + */ + COMMAND, + /** + * When a potion effect is modified through the plugin methods. + */ + PLUGIN, + /** + * When the Cause is missing. + */ + UNKNOWN; + + /** + * When an entity stands inside an area effect cloud. + * + * @deprecated use {@link #EFFECT_CLOUD} and check the source with {@link #getSource()} */ - WITHER_ROSE + @Deprecated(since = "26.2") + public static final Cause AREA_EFFECT_CLOUD = EFFECT_CLOUD; } } diff --git a/paper-server/patches/sources/net/minecraft/server/commands/RaidCommand.java.patch b/paper-server/patches/sources/net/minecraft/server/commands/RaidCommand.java.patch new file mode 100644 index 000000000000..3b6df71359e7 --- /dev/null +++ b/paper-server/patches/sources/net/minecraft/server/commands/RaidCommand.java.patch @@ -0,0 +1,11 @@ +--- a/net/minecraft/server/commands/RaidCommand.java ++++ b/net/minecraft/server/commands/RaidCommand.java +@@ -63,7 +_,7 @@ + Raid raid = getRaid(source.getPlayerOrException()); + if (raid != null) { + for (Raider raider : raid.getAllRaiders()) { +- raider.addEffect(new MobEffectInstance(MobEffects.GLOWING, 1000, 1)); ++ raider.addEffect(new MobEffectInstance(MobEffects.GLOWING, 1000, 1), org.bukkit.event.entity.EntityPotionEffectEvent.Cause.COMMAND); // Paper - Add effect cause + } + } + diff --git a/paper-server/patches/sources/net/minecraft/world/effect/BadOmenMobEffect.java.patch b/paper-server/patches/sources/net/minecraft/world/effect/BadOmenMobEffect.java.patch new file mode 100644 index 000000000000..fa883b2cc4c3 --- /dev/null +++ b/paper-server/patches/sources/net/minecraft/world/effect/BadOmenMobEffect.java.patch @@ -0,0 +1,11 @@ +--- a/net/minecraft/world/effect/BadOmenMobEffect.java ++++ b/net/minecraft/world/effect/BadOmenMobEffect.java +@@ -24,7 +_,7 @@ + && level.isVillage(player.blockPosition())) { + Raid raid = level.getRaidAt(player.blockPosition()); + if (raid == null || raid.getRaidOmenLevel() < raid.getMaxRaidOmenLevel()) { +- player.addEffect(new MobEffectInstance(MobEffects.RAID_OMEN, 600, amplification)); ++ player.addEffect(new MobEffectInstance(MobEffects.RAID_OMEN, 600, amplification), org.bukkit.event.entity.EntityPotionEffectEvent.Cause.RAID); // Paper - Add effect cause + player.setRaidOmenPosition(player.blockPosition()); + return false; + } diff --git a/paper-server/patches/sources/net/minecraft/world/entity/AreaEffectCloud.java.patch b/paper-server/patches/sources/net/minecraft/world/entity/AreaEffectCloud.java.patch index f16decf017cd..3a4bf497cfec 100644 --- a/paper-server/patches/sources/net/minecraft/world/entity/AreaEffectCloud.java.patch +++ b/paper-server/patches/sources/net/minecraft/world/entity/AreaEffectCloud.java.patch @@ -48,7 +48,7 @@ .applyInstantaneousEffect(serverLevel, this, this.getOwner(), entity, effect.getAmplifier(), 0.5); } else { - entity.addEffect(new MobEffectInstance(effect), this); -+ entity.addEffect(new MobEffectInstance(effect), this, org.bukkit.event.entity.EntityPotionEffectEvent.Cause.AREA_EFFECT_CLOUD); // CraftBukkit ++ entity.addEffect(new MobEffectInstance(effect), this, org.bukkit.event.entity.EntityPotionEffectEvent.Cause.EFFECT_CLOUD); // CraftBukkit } } diff --git a/paper-server/patches/sources/net/minecraft/world/entity/ConversionType.java.patch b/paper-server/patches/sources/net/minecraft/world/entity/ConversionType.java.patch index 8adac637c9c9..e2990a16b043 100644 --- a/paper-server/patches/sources/net/minecraft/world/entity/ConversionType.java.patch +++ b/paper-server/patches/sources/net/minecraft/world/entity/ConversionType.java.patch @@ -17,3 +17,12 @@ ConversionType.convertCommon(from, to, params); } +@@ -95,7 +_,7 @@ + to.setAbsorptionAmount(from.getAbsorptionAmount()); + + for (MobEffectInstance effect : from.getActiveEffects()) { +- to.addEffect(new MobEffectInstance(effect)); ++ to.addEffect(new MobEffectInstance(effect), from, org.bukkit.event.entity.EntityPotionEffectEvent.Cause.CONVERSION); // Paper - Add effect cause and pass Source + } + + if (from.isBaby()) { diff --git a/paper-server/patches/sources/net/minecraft/world/entity/animal/axolotl/Axolotl.java.patch b/paper-server/patches/sources/net/minecraft/world/entity/animal/axolotl/Axolotl.java.patch index 4e259c9c0ccd..7d045d851acd 100644 --- a/paper-server/patches/sources/net/minecraft/world/entity/animal/axolotl/Axolotl.java.patch +++ b/paper-server/patches/sources/net/minecraft/world/entity/animal/axolotl/Axolotl.java.patch @@ -14,11 +14,11 @@ int previousDuration = regenEffect != null ? regenEffect.getDuration() : 0; int regenDuration = Math.min(2400, 100 + previousDuration); - player.addEffect(new MobEffectInstance(MobEffects.REGENERATION, regenDuration, 0), this); -+ player.addEffect(new MobEffectInstance(MobEffects.REGENERATION, regenDuration, 0), this, org.bukkit.event.entity.EntityPotionEffectEvent.Cause.AXOLOTL); // CraftBukkit ++ player.addEffect(new MobEffectInstance(MobEffects.REGENERATION, regenDuration, 0), this, org.bukkit.event.entity.EntityPotionEffectEvent.Cause.ENTITY_GIFT); // CraftBukkit } - player.removeEffect(MobEffects.MINING_FATIGUE); -+ player.removeEffect(MobEffects.MINING_FATIGUE, org.bukkit.event.entity.EntityPotionEffectEvent.Cause.AXOLOTL); // Paper - Add missing effect cause ++ player.removeEffect(MobEffects.MINING_FATIGUE, org.bukkit.event.entity.EntityPotionEffectEvent.Cause.ENTITY_GIFT); // Paper - Add missing effect cause - TODO might pass the source later } @Override diff --git a/paper-server/patches/sources/net/minecraft/world/entity/animal/axolotl/PlayDead.java.patch b/paper-server/patches/sources/net/minecraft/world/entity/animal/axolotl/PlayDead.java.patch new file mode 100644 index 000000000000..d32f75422422 --- /dev/null +++ b/paper-server/patches/sources/net/minecraft/world/entity/animal/axolotl/PlayDead.java.patch @@ -0,0 +1,10 @@ +--- a/net/minecraft/world/entity/animal/axolotl/PlayDead.java ++++ b/net/minecraft/world/entity/animal/axolotl/PlayDead.java +@@ -29,6 +_,6 @@ + Brain brain = body.getBrain(); + brain.eraseMemory(MemoryModuleType.WALK_TARGET); + brain.eraseMemory(MemoryModuleType.LOOK_TARGET); +- body.addEffect(new MobEffectInstance(MobEffects.REGENERATION, 200, 0)); ++ body.addEffect(new MobEffectInstance(MobEffects.REGENERATION, 200, 0), org.bukkit.event.entity.EntityPotionEffectEvent.Cause.FAKE_DEATH); // Paper - Add effect cause + } + } diff --git a/paper-server/patches/sources/net/minecraft/world/entity/animal/bee/Bee.java.patch b/paper-server/patches/sources/net/minecraft/world/entity/animal/bee/Bee.java.patch index e773cff624cb..fba09155d5fb 100644 --- a/paper-server/patches/sources/net/minecraft/world/entity/animal/bee/Bee.java.patch +++ b/paper-server/patches/sources/net/minecraft/world/entity/animal/bee/Bee.java.patch @@ -84,7 +84,7 @@ this.usePlayerItem(player, hand, heldItem); if (!this.level().isClientSide()) { - this.addEffect(effect); -+ this.addEffect(effect, org.bukkit.event.entity.EntityPotionEffectEvent.Cause.FOOD); // Paper - Add missing effect cause ++ this.addEffect(effect, org.bukkit.event.entity.EntityPotionEffectEvent.Cause.CONSUME_OTHER); // Paper - Add missing effect cause } return InteractionResult.SUCCESS; diff --git a/paper-server/patches/sources/net/minecraft/world/entity/animal/dolphin/Dolphin.java.patch b/paper-server/patches/sources/net/minecraft/world/entity/animal/dolphin/Dolphin.java.patch index 695cbbb92268..ea7b50934402 100644 --- a/paper-server/patches/sources/net/minecraft/world/entity/animal/dolphin/Dolphin.java.patch +++ b/paper-server/patches/sources/net/minecraft/world/entity/animal/dolphin/Dolphin.java.patch @@ -45,7 +45,7 @@ @Override public void start() { - this.player.addEffect(new MobEffectInstance(MobEffects.DOLPHINS_GRACE, 100), this.dolphin); -+ this.player.addEffect(new MobEffectInstance(MobEffects.DOLPHINS_GRACE, 100), this.dolphin, org.bukkit.event.entity.EntityPotionEffectEvent.Cause.DOLPHIN); // CraftBukkit ++ this.player.addEffect(new MobEffectInstance(MobEffects.DOLPHINS_GRACE, 100), this.dolphin, org.bukkit.event.entity.EntityPotionEffectEvent.Cause.ENTITY_GIFT); // CraftBukkit } @Override @@ -54,7 +54,7 @@ if (this.player.isSwimming() && this.player.level().getRandom().nextInt(6) == 0) { - this.player.addEffect(new MobEffectInstance(MobEffects.DOLPHINS_GRACE, 100), this.dolphin); -+ this.player.addEffect(new MobEffectInstance(MobEffects.DOLPHINS_GRACE, 100), this.dolphin, org.bukkit.event.entity.EntityPotionEffectEvent.Cause.DOLPHIN); // CraftBukkit ++ this.player.addEffect(new MobEffectInstance(MobEffects.DOLPHINS_GRACE, 100), this.dolphin, org.bukkit.event.entity.EntityPotionEffectEvent.Cause.ENTITY_GIFT); // CraftBukkit } } } diff --git a/paper-server/patches/sources/net/minecraft/world/entity/animal/parrot/Parrot.java.patch b/paper-server/patches/sources/net/minecraft/world/entity/animal/parrot/Parrot.java.patch index 8eb4f36a6677..2820103913ea 100644 --- a/paper-server/patches/sources/net/minecraft/world/entity/animal/parrot/Parrot.java.patch +++ b/paper-server/patches/sources/net/minecraft/world/entity/animal/parrot/Parrot.java.patch @@ -14,7 +14,7 @@ } else { this.usePlayerItem(player, hand, itemStack); - this.addEffect(new MobEffectInstance(MobEffects.POISON, 900)); -+ this.addEffect(new MobEffectInstance(MobEffects.POISON, 900), org.bukkit.event.entity.EntityPotionEffectEvent.Cause.FOOD); // CraftBukkit ++ this.addEffect(new MobEffectInstance(MobEffects.POISON, 900), org.bukkit.event.entity.EntityPotionEffectEvent.Cause.CONSUME_OTHER); // CraftBukkit if (player.isCreative() || !this.isInvulnerable()) { this.hurt(this.damageSources().playerAttack(player), Float.MAX_VALUE); } diff --git a/paper-server/patches/sources/net/minecraft/world/entity/monster/hoglin/Hoglin.java.patch b/paper-server/patches/sources/net/minecraft/world/entity/monster/hoglin/Hoglin.java.patch index 5b5c4895e654..120a8e95a040 100644 --- a/paper-server/patches/sources/net/minecraft/world/entity/monster/hoglin/Hoglin.java.patch +++ b/paper-server/patches/sources/net/minecraft/world/entity/monster/hoglin/Hoglin.java.patch @@ -7,7 +7,7 @@ - this.convertTo( - EntityTypes.ZOGLIN, ConversionParams.single(this, true, false), zoglin -> zoglin.addEffect(new MobEffectInstance(MobEffects.NAUSEA, 200, 0)) + final Entity converted = this.convertTo( // Paper - Fix issues with mob conversion; reset to prevent event spam -+ EntityTypes.ZOGLIN, ConversionParams.single(this, true, false), zoglin -> {zoglin.addEffect(new MobEffectInstance(MobEffects.NAUSEA, 200, 0));}, org.bukkit.event.entity.EntityTransformEvent.TransformReason.PIGLIN_ZOMBIFIED, org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason.PIGLIN_ZOMBIFIED // CraftBukkit - add spawn and transform reasons ++ EntityTypes.ZOGLIN, ConversionParams.single(this, true, false), zoglin -> {zoglin.addEffect(new MobEffectInstance(MobEffects.NAUSEA, 200, 0), org.bukkit.event.entity.EntityPotionEffectEvent.Cause.CONVERSION);}, org.bukkit.event.entity.EntityTransformEvent.TransformReason.PIGLIN_ZOMBIFIED, org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason.PIGLIN_ZOMBIFIED // CraftBukkit - add spawn and transform reasons // Paper - Add effect cause ); + // Paper start - Fix issues with mob conversion; reset to prevent event spam + if (converted == null) { diff --git a/paper-server/patches/sources/net/minecraft/world/entity/monster/piglin/AbstractPiglin.java.patch b/paper-server/patches/sources/net/minecraft/world/entity/monster/piglin/AbstractPiglin.java.patch index 1d67f9ca65a0..c315c2bb6dd0 100644 --- a/paper-server/patches/sources/net/minecraft/world/entity/monster/piglin/AbstractPiglin.java.patch +++ b/paper-server/patches/sources/net/minecraft/world/entity/monster/piglin/AbstractPiglin.java.patch @@ -9,7 +9,7 @@ EntityTypes.ZOMBIFIED_PIGLIN, ConversionParams.single(this, true, true), - zombified -> zombified.addEffect(new MobEffectInstance(MobEffects.NAUSEA, 200, 0)) -+ zombified -> {zombified.addEffect(new MobEffectInstance(MobEffects.NAUSEA, 200, 0));}, org.bukkit.event.entity.EntityTransformEvent.TransformReason.PIGLIN_ZOMBIFIED, org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason.PIGLIN_ZOMBIFIED // CraftBukkit - add spawn and transform reasons ++ zombified -> {zombified.addEffect(new MobEffectInstance(MobEffects.NAUSEA, 200, 0), org.bukkit.event.entity.EntityPotionEffectEvent.Cause.CONVERSION);}, org.bukkit.event.entity.EntityTransformEvent.TransformReason.PIGLIN_ZOMBIFIED, org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason.PIGLIN_ZOMBIFIED // CraftBukkit - add spawn and transform reasons // Paper - Add effect cause ); + // Paper start - Fix issues with mob conversion; reset to prevent event spam + if (converted == null) { diff --git a/paper-server/patches/sources/net/minecraft/world/entity/raid/Raid.java.patch b/paper-server/patches/sources/net/minecraft/world/entity/raid/Raid.java.patch index 2f8a2a467d5b..f58f44bb2473 100644 --- a/paper-server/patches/sources/net/minecraft/world/entity/raid/Raid.java.patch +++ b/paper-server/patches/sources/net/minecraft/world/entity/raid/Raid.java.patch @@ -92,7 +92,7 @@ this.stop(); break; } -@@ -397,6 +_,7 @@ +@@ -397,16 +_,19 @@ } else { this.status = Raid.RaidStatus.VICTORY; @@ -100,7 +100,8 @@ for (UUID heroUUID : this.heroesOfTheVillage) { Entity entity = level.getEntity(heroUUID); if (entity instanceof LivingEntity hero && !entity.isSpectator()) { -@@ -404,9 +_,11 @@ +- hero.addEffect(new MobEffectInstance(MobEffects.HERO_OF_THE_VILLAGE, 48000, this.raidOmenLevel - 1, false, false, true)); ++ hero.addEffect(new MobEffectInstance(MobEffects.HERO_OF_THE_VILLAGE, 48000, this.raidOmenLevel - 1, false, false, true), org.bukkit.event.entity.EntityPotionEffectEvent.Cause.RAID); // Paper - Add effect cause if (hero instanceof ServerPlayer playerHero) { playerHero.awardStat(Stats.RAID_WIN); CriteriaTriggers.RAID_WIN.trigger(playerHero); diff --git a/paper-server/patches/sources/net/minecraft/world/entity/raid/Raids.java.patch b/paper-server/patches/sources/net/minecraft/world/entity/raid/Raids.java.patch index 74239c4658d8..ab0b8a781271 100644 --- a/paper-server/patches/sources/net/minecraft/world/entity/raid/Raids.java.patch +++ b/paper-server/patches/sources/net/minecraft/world/entity/raid/Raids.java.patch @@ -25,7 +25,7 @@ + if (!raid.isStarted() || (raid.isInProgress() && raid.getRaidOmenLevel() < raid.getMaxRaidOmenLevel())) { // CraftBukkit - fixed a bug with raid: players could add up Bad Omen level even when the raid had finished + // CraftBukkit start + if (!org.bukkit.craftbukkit.event.CraftEventFactory.callRaidTriggerEvent(level, raid, player)) { -+ player.removeEffect(net.minecraft.world.effect.MobEffects.RAID_OMEN); ++ player.removeEffect(net.minecraft.world.effect.MobEffects.RAID_OMEN, org.bukkit.event.entity.EntityPotionEffectEvent.Cause.RAID); // Paper - Add effect cause + return null; + } + diff --git a/paper-server/patches/sources/net/minecraft/world/item/alchemy/PotionContents.java.patch b/paper-server/patches/sources/net/minecraft/world/item/alchemy/PotionContents.java.patch index 5fd6ed9569b2..a701e89a7255 100644 --- a/paper-server/patches/sources/net/minecraft/world/item/alchemy/PotionContents.java.patch +++ b/paper-server/patches/sources/net/minecraft/world/item/alchemy/PotionContents.java.patch @@ -5,7 +5,7 @@ effect.getEffect().value().applyInstantaneousEffect(serverLevel, player, player, entity, effect.getAmplifier(), 1.0); } else { - entity.addEffect(effect); -+ entity.addEffect(effect, org.bukkit.event.entity.EntityPotionEffectEvent.Cause.POTION_DRINK); // CraftBukkit ++ entity.addEffect(effect, org.bukkit.event.entity.EntityPotionEffectEvent.Cause.SELF_CONSUME); // CraftBukkit } }, durationScale); } diff --git a/paper-server/patches/sources/net/minecraft/world/item/component/Consumable.java.patch b/paper-server/patches/sources/net/minecraft/world/item/component/Consumable.java.patch index 74f0fe8217b3..7ee9046fe7e6 100644 --- a/paper-server/patches/sources/net/minecraft/world/item/component/Consumable.java.patch +++ b/paper-server/patches/sources/net/minecraft/world/item/component/Consumable.java.patch @@ -1,22 +1,11 @@ --- a/net/minecraft/world/item/component/Consumable.java +++ b/net/minecraft/world/item/component/Consumable.java -@@ -84,13 +_,35 @@ +@@ -84,13 +_,24 @@ stack.getAllOfType(ConsumableListener.class).forEach(component -> component.onConsume(level, user, stack, this)); if (!level.isClientSide()) { - this.onConsumeEffects.forEach(action -> action.apply(level, stack, user)); -+ // CraftBukkit start -+ org.bukkit.event.entity.EntityPotionEffectEvent.Cause cause; -+ if (stack.is(net.minecraft.world.item.Items.MILK_BUCKET)) { -+ cause = org.bukkit.event.entity.EntityPotionEffectEvent.Cause.MILK; -+ } else if (stack.is(net.minecraft.world.item.Items.POTION)) { -+ cause = org.bukkit.event.entity.EntityPotionEffectEvent.Cause.POTION_DRINK; -+ } else { -+ cause = org.bukkit.event.entity.EntityPotionEffectEvent.Cause.FOOD; -+ } -+ -+ this.onConsumeEffects.forEach(consumeEffect -> consumeEffect.apply(level, stack, user, cause)); -+ // CraftBukkit end ++ this.onConsumeEffects.forEach(consumeEffect -> consumeEffect.apply(level, stack, user)); // CraftBukkit } user.gameEvent(this.animation == ItemUseAnimation.DRINK ? GameEvent.DRINK : GameEvent.EAT); diff --git a/paper-server/patches/sources/net/minecraft/world/item/component/DeathProtection.java.patch b/paper-server/patches/sources/net/minecraft/world/item/component/DeathProtection.java.patch deleted file mode 100644 index a00b90d9d64c..000000000000 --- a/paper-server/patches/sources/net/minecraft/world/item/component/DeathProtection.java.patch +++ /dev/null @@ -1,11 +0,0 @@ ---- a/net/minecraft/world/item/component/DeathProtection.java -+++ b/net/minecraft/world/item/component/DeathProtection.java -@@ -37,7 +_,7 @@ - - public void applyEffects(final ItemStack itemStack, final LivingEntity entity) { - for (ConsumeEffect effect : this.deathEffects) { -- effect.apply(entity.level(), itemStack, entity); -+ effect.apply(entity.level(), itemStack, entity, org.bukkit.event.entity.EntityPotionEffectEvent.Cause.TOTEM); // CraftBukkit - } - } - } diff --git a/paper-server/patches/sources/net/minecraft/world/item/component/OminousBottleAmplifier.java.patch b/paper-server/patches/sources/net/minecraft/world/item/component/OminousBottleAmplifier.java.patch index 2b7a1666f906..c4dcbf2d4306 100644 --- a/paper-server/patches/sources/net/minecraft/world/item/component/OminousBottleAmplifier.java.patch +++ b/paper-server/patches/sources/net/minecraft/world/item/component/OminousBottleAmplifier.java.patch @@ -6,7 +6,7 @@ public void onConsume(final Level level, final LivingEntity user, final ItemStack stack, final Consumable consumable) { - user.addEffect(new MobEffectInstance(MobEffects.BAD_OMEN, EFFECT_DURATION, this.value, false, false, true)); - } -+ user.addEffect(new MobEffectInstance(MobEffects.BAD_OMEN, EFFECT_DURATION, this.value, false, false, true)); // Paper - properly resend entities - diff on change for below ++ user.addEffect(new MobEffectInstance(MobEffects.BAD_OMEN, EFFECT_DURATION, this.value, false, false, true), org.bukkit.event.entity.EntityPotionEffectEvent.Cause.SELF_CONSUME); // Paper - properly resend entities - add effect cause - diff on change for below + } + + // Paper start - properly resend entities - collect packets for bundle diff --git a/paper-server/patches/sources/net/minecraft/world/item/component/SuspiciousStewEffects.java.patch b/paper-server/patches/sources/net/minecraft/world/item/component/SuspiciousStewEffects.java.patch index d2a2de9725b6..cb6115569f5c 100644 --- a/paper-server/patches/sources/net/minecraft/world/item/component/SuspiciousStewEffects.java.patch +++ b/paper-server/patches/sources/net/minecraft/world/item/component/SuspiciousStewEffects.java.patch @@ -1,9 +1,16 @@ --- a/net/minecraft/world/item/component/SuspiciousStewEffects.java +++ b/net/minecraft/world/item/component/SuspiciousStewEffects.java -@@ -42,6 +_,15 @@ - } - } - +@@ -38,9 +_,18 @@ + @Override + public void onConsume(final Level level, final LivingEntity user, final ItemStack stack, final Consumable consumable) { + for (SuspiciousStewEffects.Entry effect : this.effects) { +- user.addEffect(effect.createEffectInstance()); +- } +- } ++ user.addEffect(effect.createEffectInstance(), org.bukkit.event.entity.EntityPotionEffectEvent.Cause.SELF_CONSUME); // Paper - Add effect cause ++ } ++ } ++ + // CraftBukkit start + @Override + public void cancelUsingItem(net.minecraft.server.level.ServerPlayer player, ItemStack stack, List> collectedPackets) { // Paper - properly resend entities - collect packets for bundle @@ -12,7 +19,6 @@ + } + } + // CraftBukkit end -+ + @Override public void addToTooltip( - final Item.TooltipContext context, final Consumer consumer, final TooltipFlag flag, final DataComponentGetter components diff --git a/paper-server/patches/sources/net/minecraft/world/item/consume_effects/ApplyStatusEffectsConsumeEffect.java.patch b/paper-server/patches/sources/net/minecraft/world/item/consume_effects/ApplyStatusEffectsConsumeEffect.java.patch index b6adac3ac829..1e6b743ef863 100644 --- a/paper-server/patches/sources/net/minecraft/world/item/consume_effects/ApplyStatusEffectsConsumeEffect.java.patch +++ b/paper-server/patches/sources/net/minecraft/world/item/consume_effects/ApplyStatusEffectsConsumeEffect.java.patch @@ -1,20 +1,11 @@ --- a/net/minecraft/world/item/consume_effects/ApplyStatusEffectsConsumeEffect.java +++ b/net/minecraft/world/item/consume_effects/ApplyStatusEffectsConsumeEffect.java -@@ -46,7 +_,7 @@ - } - - @Override -- public boolean apply(final Level level, final ItemStack stack, final LivingEntity user) { -+ public boolean apply(final Level level, final ItemStack stack, final LivingEntity user, final org.bukkit.event.entity.EntityPotionEffectEvent.Cause cause) { // CraftBukkit - if (user.getRandom().nextFloat() >= this.probability) { - return false; - } @@ -54,7 +_,7 @@ boolean anyApplied = false; for (MobEffectInstance effect : this.effects) { - if (user.addEffect(new MobEffectInstance(effect))) { -+ if (user.addEffect(new MobEffectInstance(effect), cause)) { // CraftBukkit ++ if (user.addEffect(new MobEffectInstance(effect), org.bukkit.event.entity.EntityPotionEffectEvent.Cause.SELF_CONSUME)) { // CraftBukkit anyApplied = true; } } diff --git a/paper-server/patches/sources/net/minecraft/world/item/consume_effects/ClearAllStatusEffectsConsumeEffect.java.patch b/paper-server/patches/sources/net/minecraft/world/item/consume_effects/ClearAllStatusEffectsConsumeEffect.java.patch index 5cec4d4735c9..10fa6f570351 100644 --- a/paper-server/patches/sources/net/minecraft/world/item/consume_effects/ClearAllStatusEffectsConsumeEffect.java.patch +++ b/paper-server/patches/sources/net/minecraft/world/item/consume_effects/ClearAllStatusEffectsConsumeEffect.java.patch @@ -1,14 +1,10 @@ --- a/net/minecraft/world/item/consume_effects/ClearAllStatusEffectsConsumeEffect.java +++ b/net/minecraft/world/item/consume_effects/ClearAllStatusEffectsConsumeEffect.java -@@ -18,7 +_,9 @@ - } +@@ -19,6 +_,6 @@ @Override -- public boolean apply(final Level level, final ItemStack stack, final LivingEntity user) { + public boolean apply(final Level level, final ItemStack stack, final LivingEntity user) { - return user.removeAllEffects(); -+ // CraftBukkit start -+ public boolean apply(final Level level, final ItemStack stack, final LivingEntity user, org.bukkit.event.entity.EntityPotionEffectEvent.Cause cause) { -+ return user.removeAllEffects(cause); -+ // CraftBukkit end ++ return user.removeAllEffects(org.bukkit.event.entity.EntityPotionEffectEvent.Cause.SELF_CONSUME); // CraftBukkit } } diff --git a/paper-server/patches/sources/net/minecraft/world/item/consume_effects/ConsumeEffect.java.patch b/paper-server/patches/sources/net/minecraft/world/item/consume_effects/ConsumeEffect.java.patch deleted file mode 100644 index 08fabd6c26a0..000000000000 --- a/paper-server/patches/sources/net/minecraft/world/item/consume_effects/ConsumeEffect.java.patch +++ /dev/null @@ -1,19 +0,0 @@ ---- a/net/minecraft/world/item/consume_effects/ConsumeEffect.java -+++ b/net/minecraft/world/item/consume_effects/ConsumeEffect.java -@@ -19,7 +_,15 @@ - - ConsumeEffect.Type getType(); - -- boolean apply(final Level level, final ItemStack stack, final LivingEntity user); -+ // CraftBukkit start -+ default boolean apply(final Level level, final ItemStack stack, final LivingEntity user) { -+ return this.apply(level, stack, user, org.bukkit.event.entity.EntityPotionEffectEvent.Cause.UNKNOWN); -+ } -+ -+ default boolean apply(Level level, ItemStack stack, LivingEntity user, org.bukkit.event.entity.EntityPotionEffectEvent.Cause cause) { -+ return this.apply(level, stack, user); -+ } -+ // CraftBukkit end - - record Type(MapCodec codec, StreamCodec streamCodec) { - public static final ConsumeEffect.Type APPLY_EFFECTS = register( diff --git a/paper-server/patches/sources/net/minecraft/world/item/consume_effects/RemoveStatusEffectsConsumeEffect.java.patch b/paper-server/patches/sources/net/minecraft/world/item/consume_effects/RemoveStatusEffectsConsumeEffect.java.patch index 90f417806e9e..c8195f2558d7 100644 --- a/paper-server/patches/sources/net/minecraft/world/item/consume_effects/RemoveStatusEffectsConsumeEffect.java.patch +++ b/paper-server/patches/sources/net/minecraft/world/item/consume_effects/RemoveStatusEffectsConsumeEffect.java.patch @@ -1,16 +1,11 @@ --- a/net/minecraft/world/item/consume_effects/RemoveStatusEffectsConsumeEffect.java +++ b/net/minecraft/world/item/consume_effects/RemoveStatusEffectsConsumeEffect.java -@@ -33,11 +_,11 @@ - } - - @Override -- public boolean apply(final Level level, final ItemStack stack, final LivingEntity user) { -+ public boolean apply(final Level level, final ItemStack stack, final LivingEntity user, org.bukkit.event.entity.EntityPotionEffectEvent.Cause cause) { // CraftBukkit +@@ -37,7 +_,7 @@ boolean hasRemovedAny = false; for (Holder effect : this.effects) { - if (user.removeEffect(effect)) { -+ if (user.removeEffect(effect, cause)) { // CraftBukkit ++ if (user.removeEffect(effect, org.bukkit.event.entity.EntityPotionEffectEvent.Cause.SELF_CONSUME)) { // CraftBukkit hasRemovedAny = true; } } diff --git a/paper-server/patches/sources/net/minecraft/world/level/block/EyeblossomBlock.java.patch b/paper-server/patches/sources/net/minecraft/world/level/block/EyeblossomBlock.java.patch index 163dc5621cb9..b899c26b57dc 100644 --- a/paper-server/patches/sources/net/minecraft/world/level/block/EyeblossomBlock.java.patch +++ b/paper-server/patches/sources/net/minecraft/world/level/block/EyeblossomBlock.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/world/level/block/EyeblossomBlock.java +++ b/net/minecraft/world/level/block/EyeblossomBlock.java -@@ -106,6 +_,7 @@ +@@ -106,12 +_,13 @@ final InsideBlockEffectApplier effectApplier, final boolean isPrecise ) { @@ -8,3 +8,10 @@ if (!level.isClientSide() && level.getDifficulty() != Difficulty.PEACEFUL && entity instanceof Bee bee + && Bee.attractsBees(state) + && !bee.hasEffect(MobEffects.POISON)) { +- bee.addEffect(this.getBeeInteractionEffect()); ++ bee.addEffect(this.getBeeInteractionEffect(), org.bukkit.event.entity.EntityPotionEffectEvent.Cause.EYE_BLOSSOM); // Paper - Add effect cause + } + } + diff --git a/paper-server/patches/sources/net/minecraft/world/level/block/entity/BellBlockEntity.java.patch b/paper-server/patches/sources/net/minecraft/world/level/block/entity/BellBlockEntity.java.patch index ffe24b191114..92b807281f4d 100644 --- a/paper-server/patches/sources/net/minecraft/world/level/block/entity/BellBlockEntity.java.patch +++ b/paper-server/patches/sources/net/minecraft/world/level/block/entity/BellBlockEntity.java.patch @@ -41,12 +41,13 @@ } private static void showBellParticles(final Level level, final BlockPos bellPos, final List nearbyEntities) { -@@ -160,7 +_,16 @@ +@@ -160,8 +_,17 @@ return entity.isAlive() && !entity.isRemoved() && blockPos.closerToCenterThan(entity.position(), 48.0) && entity.is(EntityTypeTags.RAIDERS); } + @Deprecated @io.papermc.paper.annotation.DoNotUse // Paper - Add BellRevealRaiderEvent private static void glow(final LivingEntity raider) { +- raider.addEffect(new MobEffectInstance(MobEffects.GLOWING, 60)); + // Paper start - Add BellRevealRaiderEvent + glow(raider, null); + } @@ -55,6 +56,7 @@ + if (pos != null && !new io.papermc.paper.event.block.BellRevealRaiderEvent(org.bukkit.craftbukkit.block.CraftBlock.at(raider.level(), pos), (org.bukkit.entity.Raider) raider.getBukkitEntity()).callEvent()) + return; + // Paper end - Add BellRevealRaiderEvent - raider.addEffect(new MobEffectInstance(MobEffects.GLOWING, 60)); ++ raider.addEffect(new MobEffectInstance(MobEffects.GLOWING, 60), org.bukkit.event.entity.EntityPotionEffectEvent.Cause.BELL); // Paper - Add effect cause } + @FunctionalInterface diff --git a/paper-server/patches/sources/net/minecraft/world/level/block/entity/PotentSulfurBlockEntity.java.patch b/paper-server/patches/sources/net/minecraft/world/level/block/entity/PotentSulfurBlockEntity.java.patch new file mode 100644 index 000000000000..eb9be1a785bb --- /dev/null +++ b/paper-server/patches/sources/net/minecraft/world/level/block/entity/PotentSulfurBlockEntity.java.patch @@ -0,0 +1,11 @@ +--- a/net/minecraft/world/level/block/entity/PotentSulfurBlockEntity.java ++++ b/net/minecraft/world/level/block/entity/PotentSulfurBlockEntity.java +@@ -164,7 +_,7 @@ + } + + private static void applyNauseaEffect(final LivingEntity entity) { +- entity.addEffect(new MobEffectInstance(MobEffects.NAUSEA, 80, 0, true, true)); ++ entity.addEffect(new MobEffectInstance(MobEffects.NAUSEA, 80, 0, true, true), org.bukkit.event.entity.EntityPotionEffectEvent.Cause.EFFECT_CLOUD); // Paper - Add effect cause + } + + private static List getNearbyLivingEntities(final Level level, final BlockPos pos) { diff --git a/paper-server/patches/sources/net/minecraft/world/level/block/entity/trialspawner/TrialSpawnerStateData.java.patch b/paper-server/patches/sources/net/minecraft/world/level/block/entity/trialspawner/TrialSpawnerStateData.java.patch index 9ea2285b2328..97510df85d6d 100644 --- a/paper-server/patches/sources/net/minecraft/world/level/block/entity/trialspawner/TrialSpawnerStateData.java.patch +++ b/paper-server/patches/sources/net/minecraft/world/level/block/entity/trialspawner/TrialSpawnerStateData.java.patch @@ -9,3 +9,14 @@ } }); if (!trialSpawner.ominousConfig().spawnPotentialsDefinition().isEmpty()) { +@@ -207,8 +_,8 @@ + if (badOmen != null) { + int amplifier = badOmen.getAmplifier() + 1; + int duration = 18000 * amplifier; +- player.removeEffect(MobEffects.BAD_OMEN); +- player.addEffect(new MobEffectInstance(MobEffects.TRIAL_OMEN, duration, 0)); ++ player.removeEffect(MobEffects.BAD_OMEN, org.bukkit.event.entity.EntityPotionEffectEvent.Cause.TRIAL_STARTED); // Paper - Add effect cause ++ player.addEffect(new MobEffectInstance(MobEffects.TRIAL_OMEN, duration, 0), org.bukkit.event.entity.EntityPotionEffectEvent.Cause.TRIAL_STARTED); // Paper - Add effect cause + } + } + From 44543f4c253424279d314dbfc241310b7ee49521 Mon Sep 17 00:00:00 2001 From: Lulu13022002 <41980282+Lulu13022002@users.noreply.github.com> Date: Thu, 2 Jul 2026 23:48:40 +0200 Subject: [PATCH 2/4] [ci skip] tweaks --- .../event/entity/EntityPotionEffectEvent.java | 6 +++--- .../world/entity/ConversionType.java.patch | 2 +- .../world/item/component/Consumable.java.patch | 16 ++++------------ .../component/OminousBottleAmplifier.java.patch | 2 +- 4 files changed, 9 insertions(+), 17 deletions(-) diff --git a/paper-api/src/main/java/org/bukkit/event/entity/EntityPotionEffectEvent.java b/paper-api/src/main/java/org/bukkit/event/entity/EntityPotionEffectEvent.java index ad36a408212e..b0ea84aa33ed 100644 --- a/paper-api/src/main/java/org/bukkit/event/entity/EntityPotionEffectEvent.java +++ b/paper-api/src/main/java/org/bukkit/event/entity/EntityPotionEffectEvent.java @@ -157,7 +157,7 @@ public enum Action { */ CHANGED, /** - * When the potion effect is removed due to all them being removed. + * When the potion effect is removed as part of the removal of all effects. */ CLEARED, /** @@ -185,7 +185,7 @@ public enum Cause { */ ATTACK, /** - * When an entity gets a positive effect or a negative effect is removed as a gift made by another entity (like a dolphin or an axolotl) + * When an entity gets a positive effect or a negative effect is removed as a gift made by another entity (like a dolphin or an axolotl). */ ENTITY_GIFT, /** @@ -212,7 +212,7 @@ public enum Cause { */ BEACON, /** - * When an entity gets the effect from a bell. + * When an entity gets revealed because of a bell. */ BELL, /** diff --git a/paper-server/patches/sources/net/minecraft/world/entity/ConversionType.java.patch b/paper-server/patches/sources/net/minecraft/world/entity/ConversionType.java.patch index e2990a16b043..a1373644b12a 100644 --- a/paper-server/patches/sources/net/minecraft/world/entity/ConversionType.java.patch +++ b/paper-server/patches/sources/net/minecraft/world/entity/ConversionType.java.patch @@ -22,7 +22,7 @@ for (MobEffectInstance effect : from.getActiveEffects()) { - to.addEffect(new MobEffectInstance(effect)); -+ to.addEffect(new MobEffectInstance(effect), from, org.bukkit.event.entity.EntityPotionEffectEvent.Cause.CONVERSION); // Paper - Add effect cause and pass Source ++ to.addEffect(new MobEffectInstance(effect), org.bukkit.event.entity.EntityPotionEffectEvent.Cause.CONVERSION); // Paper - Add effect cause and pass Source } if (from.isBaby()) { diff --git a/paper-server/patches/sources/net/minecraft/world/item/component/Consumable.java.patch b/paper-server/patches/sources/net/minecraft/world/item/component/Consumable.java.patch index 7ee9046fe7e6..979079ade8f2 100644 --- a/paper-server/patches/sources/net/minecraft/world/item/component/Consumable.java.patch +++ b/paper-server/patches/sources/net/minecraft/world/item/component/Consumable.java.patch @@ -1,18 +1,9 @@ --- a/net/minecraft/world/item/component/Consumable.java +++ b/net/minecraft/world/item/component/Consumable.java -@@ -84,13 +_,24 @@ - - stack.getAllOfType(ConsumableListener.class).forEach(component -> component.onConsume(level, user, stack, this)); - if (!level.isClientSide()) { -- this.onConsumeEffects.forEach(action -> action.apply(level, stack, user)); -+ this.onConsumeEffects.forEach(consumeEffect -> consumeEffect.apply(level, stack, user)); // CraftBukkit - } - - user.gameEvent(this.animation == ItemUseAnimation.DRINK ? GameEvent.DRINK : GameEvent.EAT); - stack.consume(1, user); +@@ -92,6 +_,17 @@ return stack; } -+ + + // CraftBukkit start + public void cancelUsingItem(ServerPlayer player, ItemStack stack) { + final java.util.List> packets = new it.unimi.dsi.fastutil.objects.ObjectArrayList<>(); // Paper - properly resend entities - collect packets for bundle @@ -23,6 +14,7 @@ + player.connection.send(new net.minecraft.network.protocol.game.ClientboundBundlePacket(packets)); + } + // CraftBukkit end - ++ public boolean canConsume(final LivingEntity user, final ItemStack stack) { FoodProperties foodProperties = stack.get(DataComponents.FOOD); + return !(foodProperties != null && user instanceof Player player) || player.canEat(foodProperties.canAlwaysEat()); diff --git a/paper-server/patches/sources/net/minecraft/world/item/component/OminousBottleAmplifier.java.patch b/paper-server/patches/sources/net/minecraft/world/item/component/OminousBottleAmplifier.java.patch index c4dcbf2d4306..686662723d0b 100644 --- a/paper-server/patches/sources/net/minecraft/world/item/component/OminousBottleAmplifier.java.patch +++ b/paper-server/patches/sources/net/minecraft/world/item/component/OminousBottleAmplifier.java.patch @@ -6,7 +6,7 @@ public void onConsume(final Level level, final LivingEntity user, final ItemStack stack, final Consumable consumable) { - user.addEffect(new MobEffectInstance(MobEffects.BAD_OMEN, EFFECT_DURATION, this.value, false, false, true)); - } -+ user.addEffect(new MobEffectInstance(MobEffects.BAD_OMEN, EFFECT_DURATION, this.value, false, false, true), org.bukkit.event.entity.EntityPotionEffectEvent.Cause.SELF_CONSUME); // Paper - properly resend entities - add effect cause - diff on change for below ++ user.addEffect(new MobEffectInstance(MobEffects.BAD_OMEN, EFFECT_DURATION, this.value, false, false, true), org.bukkit.event.entity.EntityPotionEffectEvent.Cause.SELF_CONSUME); // Paper - properly resend entities - diff on change for below + } + + // Paper start - properly resend entities - collect packets for bundle From 2e99d0faebf8b43b85fe44070920cf8ad311fd91 Mon Sep 17 00:00:00 2001 From: Doc Date: Fri, 3 Jul 2026 09:08:52 -0400 Subject: [PATCH 3/4] lulu forgot to remove this part in the comment for ConversionType [ci skip] --- .../net/minecraft/world/entity/ConversionType.java.patch | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/paper-server/patches/sources/net/minecraft/world/entity/ConversionType.java.patch b/paper-server/patches/sources/net/minecraft/world/entity/ConversionType.java.patch index a1373644b12a..cfaf85338487 100644 --- a/paper-server/patches/sources/net/minecraft/world/entity/ConversionType.java.patch +++ b/paper-server/patches/sources/net/minecraft/world/entity/ConversionType.java.patch @@ -22,7 +22,7 @@ for (MobEffectInstance effect : from.getActiveEffects()) { - to.addEffect(new MobEffectInstance(effect)); -+ to.addEffect(new MobEffectInstance(effect), org.bukkit.event.entity.EntityPotionEffectEvent.Cause.CONVERSION); // Paper - Add effect cause and pass Source ++ to.addEffect(new MobEffectInstance(effect), org.bukkit.event.entity.EntityPotionEffectEvent.Cause.CONVERSION); // Paper - Add effect cause } if (from.isBaby()) { From 1619c3912e34af5eb3987245bea2b9042e795cba Mon Sep 17 00:00:00 2001 From: Doc Date: Fri, 3 Jul 2026 09:13:34 -0400 Subject: [PATCH 4/4] Mark for removal unused EntityPotionEffectEvent.Cause --- .../event/entity/EntityPotionEffectEvent.java | 24 +++++++++---------- 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/paper-api/src/main/java/org/bukkit/event/entity/EntityPotionEffectEvent.java b/paper-api/src/main/java/org/bukkit/event/entity/EntityPotionEffectEvent.java index b0ea84aa33ed..6500c018ec81 100644 --- a/paper-api/src/main/java/org/bukkit/event/entity/EntityPotionEffectEvent.java +++ b/paper-api/src/main/java/org/bukkit/event/entity/EntityPotionEffectEvent.java @@ -191,9 +191,9 @@ public enum Cause { /** * When an entity gets the effect from an axolotl. * - * @deprecated use {@link #ENTITY_GIFT} and check the source with {@link #getSource()} + * @deprecated no longer used, use {@link #ENTITY_GIFT} and check the source with {@link #getSource()} */ - @Deprecated(since = "26.2") + @Deprecated(since = "26.2", forRemoval = true) AXOLOTL, /** * When an entity plays dead (currently only for the axolotl). @@ -239,9 +239,9 @@ public enum Cause { /** * When an entity gets the effect from a dolphin. * - * @deprecated use {@link #ENTITY_GIFT} and check the source with {@link #getSource()} + * @deprecated no longer used, use {@link #ENTITY_GIFT} and check the source with {@link #getSource()} */ - @Deprecated(since = "26.2") + @Deprecated(since = "26.2", forRemoval = true) DOLPHIN, /** * When the effect was removed due to expiration. @@ -251,9 +251,9 @@ public enum Cause { * When an effect is inflicted due to food (e.g. when a player eats or a * cookie is given to a parrot). * - * @deprecated use {@link #SELF_CONSUME} and check the item in hand if needed or {@link #CONSUME_OTHER} + * @deprecated no longer used, use {@link #SELF_CONSUME} and check the item in hand if needed or {@link #CONSUME_OTHER} */ - @Deprecated(since = "26.2") + @Deprecated(since = "26.2", forRemoval = true) FOOD, /** * When an illusion illager makes himself disappear. @@ -262,9 +262,9 @@ public enum Cause { /** * When all effects are removed due to a bucket of milk. * - * @deprecated use {@link #SELF_CONSUME} and check the item in hand if needed + * @deprecated no longer used, use {@link #SELF_CONSUME} and check the item in hand if needed */ - @Deprecated(since = "26.2") + @Deprecated(since = "26.2", forRemoval = true) MILK, /** * When an entity gets the effect from a nautilus. @@ -280,9 +280,9 @@ public enum Cause { /** * When an entity drinks a potion. * - * @deprecated use {@link #SELF_CONSUME} and check the item in hand if needed + * @deprecated no longer used,use {@link #SELF_CONSUME} and check the item in hand if needed */ - @Deprecated(since = "26.2") + @Deprecated(since = "26.2", forRemoval = true) POTION_DRINK, /** * When an entity is inflicted with an effect due to a splash potion. @@ -305,9 +305,9 @@ public enum Cause { /** * When an entity gets effects from a totem item saving its life. * - * @deprecated use {@link #SELF_CONSUME} and check the used item in {@link EntityResurrectEvent} + * @deprecated no longer used, use {@link #SELF_CONSUME} and check the used item in {@link EntityResurrectEvent} */ - @Deprecated(since = "26.2") + @Deprecated(since = "26.2", forRemoval = true) TOTEM, /** * When an entity gets water breathing by wearing a turtle helmet.