diff --git a/paper-server/patches/sources/net/minecraft/world/effect/HealOrHarmMobEffect.java.patch b/paper-server/patches/sources/net/minecraft/world/effect/HealOrHarmMobEffect.java.patch new file mode 100644 index 0000000000..040430b443 --- /dev/null +++ b/paper-server/patches/sources/net/minecraft/world/effect/HealOrHarmMobEffect.java.patch @@ -0,0 +1,20 @@ +--- a/net/minecraft/world/effect/HealOrHarmMobEffect.java ++++ b/net/minecraft/world/effect/HealOrHarmMobEffect.java +@@ -16,7 +_,7 @@ + @Override + public boolean applyEffectTick(ServerLevel level, LivingEntity entity, int amplifier) { + if (this.isHarm == entity.isInvertedHealAndHarm()) { +- entity.heal(Math.max(4 << amplifier, 0)); ++ entity.heal(Math.max(4 << amplifier, 0), org.bukkit.event.entity.EntityRegainHealthEvent.RegainReason.MAGIC); // CraftBukkit + } else { + entity.hurtServer(level, entity.damageSources().magic(), 6 << amplifier); + } +@@ -30,7 +_,7 @@ + ) { + if (this.isHarm == entity.isInvertedHealAndHarm()) { + int i = (int)(health * (4 << amplifier) + 0.5); +- entity.heal(i); ++ entity.heal(i, org.bukkit.event.entity.EntityRegainHealthEvent.RegainReason.MAGIC); // CraftBukkit + } else { + int i = (int)(health * (6 << amplifier) + 0.5); + if (source == null) { diff --git a/paper-server/patches/sources/net/minecraft/world/effect/HungerMobEffect.java.patch b/paper-server/patches/sources/net/minecraft/world/effect/HungerMobEffect.java.patch new file mode 100644 index 0000000000..0328a5b344 --- /dev/null +++ b/paper-server/patches/sources/net/minecraft/world/effect/HungerMobEffect.java.patch @@ -0,0 +1,11 @@ +--- a/net/minecraft/world/effect/HungerMobEffect.java ++++ b/net/minecraft/world/effect/HungerMobEffect.java +@@ -12,7 +_,7 @@ + @Override + public boolean applyEffectTick(ServerLevel level, LivingEntity entity, int amplifier) { + if (entity instanceof Player player) { +- player.causeFoodExhaustion(0.005F * (amplifier + 1)); ++ player.causeFoodExhaustion(0.005F * (amplifier + 1), org.bukkit.event.entity.EntityExhaustionEvent.ExhaustionReason.HUNGER_EFFECT); // CraftBukkit - EntityExhaustionEvent + } + + return true; diff --git a/paper-server/patches/sources/net/minecraft/world/effect/InfestedMobEffect.java.patch b/paper-server/patches/sources/net/minecraft/world/effect/InfestedMobEffect.java.patch new file mode 100644 index 0000000000..05442e7403 --- /dev/null +++ b/paper-server/patches/sources/net/minecraft/world/effect/InfestedMobEffect.java.patch @@ -0,0 +1,15 @@ +--- a/net/minecraft/world/effect/InfestedMobEffect.java ++++ b/net/minecraft/world/effect/InfestedMobEffect.java +@@ -44,7 +_,11 @@ + Vector3f vector3f = entity.getLookAngle().toVector3f().mul(0.3F).mul(1.0F, 1.5F, 1.0F).rotateY(f1); + silverfish.moveTo(x, y, z, level.getRandom().nextFloat() * 360.0F, 0.0F); + silverfish.setDeltaMovement(new Vec3(vector3f)); +- level.addFreshEntity(silverfish); ++ // CraftBukkit start ++ if (!level.addFreshEntity(silverfish, org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason.POTION_EFFECT)) { ++ return; ++ } ++ // CraftBukkit end + silverfish.playSound(SoundEvents.SILVERFISH_HURT); + } + } diff --git a/paper-server/patches/sources/net/minecraft/world/effect/MobEffectUtil.java.patch b/paper-server/patches/sources/net/minecraft/world/effect/MobEffectUtil.java.patch new file mode 100644 index 0000000000..eeeb7fd665 --- /dev/null +++ b/paper-server/patches/sources/net/minecraft/world/effect/MobEffectUtil.java.patch @@ -0,0 +1,45 @@ +--- a/net/minecraft/world/effect/MobEffectUtil.java ++++ b/net/minecraft/world/effect/MobEffectUtil.java +@@ -47,18 +_,31 @@ + public static List addEffectToPlayersAround( + ServerLevel level, @Nullable Entity source, Vec3 pos, double radius, MobEffectInstance effect, int duration + ) { ++ // CraftBukkit start ++ return MobEffectUtil.addEffectToPlayersAround(level, source, pos, radius, effect, duration, org.bukkit.event.entity.EntityPotionEffectEvent.Cause.UNKNOWN); ++ } ++ ++ public static List addEffectToPlayersAround(ServerLevel level, @Nullable Entity source, Vec3 pos, double radius, MobEffectInstance effect, int duration, org.bukkit.event.entity.EntityPotionEffectEvent.Cause cause) { ++ // Paper start - Add ElderGuardianAppearanceEvent ++ return addEffectToPlayersAround(level, source, pos, radius, effect, duration, cause, null); ++ } ++ ++ public static List addEffectToPlayersAround(ServerLevel level, @Nullable Entity source, Vec3 pos, double radius, MobEffectInstance effect, int duration, org.bukkit.event.entity.EntityPotionEffectEvent.Cause cause, @Nullable java.util.function.Predicate playerPredicate) { ++ // Paper end - Add ElderGuardianAppearanceEvent ++ // CraftBukkit end + Holder effect1 = effect.getEffect(); +- List players = level.getPlayers( +- serverPlayer -> serverPlayer.gameMode.isSurvival() +- && (source == null || !source.isAlliedTo(serverPlayer)) +- && pos.closerThan(serverPlayer.position(), radius) +- && ( +- !serverPlayer.hasEffect(effect1) +- || serverPlayer.getEffect(effect1).getAmplifier() < effect.getAmplifier() +- || serverPlayer.getEffect(effect1).endsWithin(duration - 1) +- ) +- ); +- players.forEach(serverPlayer -> serverPlayer.addEffect(new MobEffectInstance(effect), source)); ++ List players = level.getPlayers((entityplayer) -> { ++ // Paper start - Add ElderGuardianAppearanceEvent ++ boolean condition = entityplayer.gameMode.isSurvival() && (source == null || !source.isAlliedTo((Entity) entityplayer)) && pos.closerThan(entityplayer.position(), radius) && (!entityplayer.hasEffect(effect1) || entityplayer.getEffect(effect1).getAmplifier() < effect.getAmplifier() || entityplayer.getEffect(effect1).endsWithin(duration - 1)); ++ if (condition) { ++ return playerPredicate == null || playerPredicate.test(entityplayer); // Only test the player AFTER it is true ++ } else { ++ return false; ++ } ++ // Paper end - Add ElderGuardianAppearanceEvent ++ }); ++ ++ players.forEach(serverPlayer -> serverPlayer.addEffect(new MobEffectInstance(effect), source, cause)); // CraftBukkit + return players; + } + } diff --git a/paper-server/patches/sources/net/minecraft/world/effect/OozingMobEffect.java.patch b/paper-server/patches/sources/net/minecraft/world/effect/OozingMobEffect.java.patch new file mode 100644 index 0000000000..33ed7473ee --- /dev/null +++ b/paper-server/patches/sources/net/minecraft/world/effect/OozingMobEffect.java.patch @@ -0,0 +1,11 @@ +--- a/net/minecraft/world/effect/OozingMobEffect.java ++++ b/net/minecraft/world/effect/OozingMobEffect.java +@@ -49,7 +_,7 @@ + if (slime != null) { + slime.setSize(2, true); + slime.moveTo(x, y, z, level.getRandom().nextFloat() * 360.0F, 0.0F); +- level.addFreshEntity(slime); ++ level.addFreshEntity(slime, org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason.POTION_EFFECT); // CraftBukkit + } + } + diff --git a/paper-server/patches/sources/net/minecraft/world/effect/PoisonMobEffect.java.patch b/paper-server/patches/sources/net/minecraft/world/effect/PoisonMobEffect.java.patch new file mode 100644 index 0000000000..66061ffa2d --- /dev/null +++ b/paper-server/patches/sources/net/minecraft/world/effect/PoisonMobEffect.java.patch @@ -0,0 +1,11 @@ +--- a/net/minecraft/world/effect/PoisonMobEffect.java ++++ b/net/minecraft/world/effect/PoisonMobEffect.java +@@ -13,7 +_,7 @@ + @Override + public boolean applyEffectTick(ServerLevel level, LivingEntity entity, int amplifier) { + if (entity.getHealth() > 1.0F) { +- entity.hurtServer(level, entity.damageSources().magic(), 1.0F); ++ entity.hurtServer(level, entity.damageSources().poison(), 1.0F); // CraftBukkit - DamageSource.MAGIC -> CraftEventFactory.POISON + } + + return true; diff --git a/paper-server/patches/unapplied/net/minecraft/world/effect/RegenerationMobEffect.java.patch b/paper-server/patches/sources/net/minecraft/world/effect/RegenerationMobEffect.java.patch similarity index 83% rename from paper-server/patches/unapplied/net/minecraft/world/effect/RegenerationMobEffect.java.patch rename to paper-server/patches/sources/net/minecraft/world/effect/RegenerationMobEffect.java.patch index 9a24fc0330..c7b4805bbb 100644 --- a/paper-server/patches/unapplied/net/minecraft/world/effect/RegenerationMobEffect.java.patch +++ b/paper-server/patches/sources/net/minecraft/world/effect/RegenerationMobEffect.java.patch @@ -1,8 +1,8 @@ --- a/net/minecraft/world/effect/RegenerationMobEffect.java +++ b/net/minecraft/world/effect/RegenerationMobEffect.java -@@ -12,7 +12,7 @@ +@@ -11,7 +_,7 @@ @Override - public boolean applyEffectTick(ServerLevel world, LivingEntity entity, int amplifier) { + public boolean applyEffectTick(ServerLevel level, LivingEntity entity, int amplifier) { if (entity.getHealth() < entity.getMaxHealth()) { - entity.heal(1.0F); + entity.heal(1.0F, org.bukkit.event.entity.EntityRegainHealthEvent.RegainReason.MAGIC_REGEN); // CraftBukkit diff --git a/paper-server/patches/sources/net/minecraft/world/effect/SaturationMobEffect.java.patch b/paper-server/patches/sources/net/minecraft/world/effect/SaturationMobEffect.java.patch new file mode 100644 index 0000000000..d9dff00176 --- /dev/null +++ b/paper-server/patches/sources/net/minecraft/world/effect/SaturationMobEffect.java.patch @@ -0,0 +1,19 @@ +--- a/net/minecraft/world/effect/SaturationMobEffect.java ++++ b/net/minecraft/world/effect/SaturationMobEffect.java +@@ -12,7 +_,15 @@ + @Override + public boolean applyEffectTick(ServerLevel level, LivingEntity entity, int amplifier) { + if (entity instanceof Player player) { +- player.getFoodData().eat(amplifier + 1, 1.0F); ++ // CraftBukkit start ++ int oldFoodLevel = player.getFoodData().foodLevel; ++ org.bukkit.event.entity.FoodLevelChangeEvent event = org.bukkit.craftbukkit.event.CraftEventFactory.callFoodLevelChangeEvent(player, amplifier + 1 + oldFoodLevel); ++ if (!event.isCancelled()) { ++ player.getFoodData().eat(event.getFoodLevel() - oldFoodLevel, 1.0F); ++ } ++ ++ ((org.bukkit.craftbukkit.entity.CraftPlayer) player.getBukkitEntity()).sendHealthUpdate(); ++ // CraftBukkit end + } + + return true; diff --git a/paper-server/patches/unapplied/net/minecraft/world/effect/WeavingMobEffect.java.patch b/paper-server/patches/sources/net/minecraft/world/effect/WeavingMobEffect.java.patch similarity index 56% rename from paper-server/patches/unapplied/net/minecraft/world/effect/WeavingMobEffect.java.patch rename to paper-server/patches/sources/net/minecraft/world/effect/WeavingMobEffect.java.patch index 8beb585d3f..66fd20e36b 100644 --- a/paper-server/patches/unapplied/net/minecraft/world/effect/WeavingMobEffect.java.patch +++ b/paper-server/patches/sources/net/minecraft/world/effect/WeavingMobEffect.java.patch @@ -1,24 +1,24 @@ --- a/net/minecraft/world/effect/WeavingMobEffect.java +++ b/net/minecraft/world/effect/WeavingMobEffect.java -@@ -25,11 +25,11 @@ +@@ -25,11 +_,11 @@ @Override - public void onMobRemoved(ServerLevel world, LivingEntity entity, int amplifier, Entity.RemovalReason reason) { - if (reason == Entity.RemovalReason.KILLED && (entity instanceof Player || world.getGameRules().getBoolean(GameRules.RULE_MOBGRIEFING))) { -- this.spawnCobwebsRandomlyAround(world, entity.getRandom(), entity.blockPosition()); -+ this.spawnCobwebsRandomlyAround(world, entity.getRandom(), entity.blockPosition(), entity); // Paper - Fire EntityChangeBlockEvent in more places + public void onMobRemoved(ServerLevel level, LivingEntity entity, int amplifier, Entity.RemovalReason reason) { + if (reason == Entity.RemovalReason.KILLED && (entity instanceof Player || level.getGameRules().getBoolean(GameRules.RULE_MOBGRIEFING))) { +- this.spawnCobwebsRandomlyAround(level, entity.getRandom(), entity.blockPosition()); ++ this.spawnCobwebsRandomlyAround(level, entity.getRandom(), entity.blockPosition(), entity); // Paper - Fire EntityChangeBlockEvent in more places } } -- private void spawnCobwebsRandomlyAround(ServerLevel world, RandomSource random, BlockPos pos) { -+ private void spawnCobwebsRandomlyAround(ServerLevel world, RandomSource random, BlockPos pos, LivingEntity entity) { // Paper - Fire EntityChangeBlockEvent in more places +- private void spawnCobwebsRandomlyAround(ServerLevel level, RandomSource random, BlockPos pos) { ++ private void spawnCobwebsRandomlyAround(ServerLevel level, RandomSource random, BlockPos pos, LivingEntity entity) { // Paper - Fire EntityChangeBlockEvent in more places Set set = Sets.newHashSet(); int i = this.maxCobwebs.applyAsInt(random); -@@ -46,6 +46,7 @@ +@@ -46,6 +_,7 @@ } - for (BlockPos blockPos3 : set) { -+ if (!org.bukkit.craftbukkit.event.CraftEventFactory.callEntityChangeBlockEvent(entity, blockPos3, Blocks.COBWEB.defaultBlockState())) continue; // Paper - Fire EntityChangeBlockEvent in more places - world.setBlock(blockPos3, Blocks.COBWEB.defaultBlockState(), 3); - world.levelEvent(3018, blockPos3, 0); + for (BlockPos blockPosx : set) { ++ if (!org.bukkit.craftbukkit.event.CraftEventFactory.callEntityChangeBlockEvent(entity, blockPosx, Blocks.COBWEB.defaultBlockState())) continue; // Paper - Fire EntityChangeBlockEvent in more places + level.setBlock(blockPosx, Blocks.COBWEB.defaultBlockState(), 3); + level.levelEvent(3018, blockPosx, 0); } diff --git a/paper-server/patches/sources/net/minecraft/world/level/block/grower/TreeGrower.java.patch b/paper-server/patches/sources/net/minecraft/world/level/block/grower/TreeGrower.java.patch index 432b04d350..c4316b4d6e 100644 --- a/paper-server/patches/sources/net/minecraft/world/level/block/grower/TreeGrower.java.patch +++ b/paper-server/patches/sources/net/minecraft/world/level/block/grower/TreeGrower.java.patch @@ -1,5 +1,13 @@ --- a/net/minecraft/world/level/block/grower/TreeGrower.java +++ b/net/minecraft/world/level/block/grower/TreeGrower.java +@@ -132,6 +_,7 @@ + .get(configuredMegaFeature) + .orElse(null); + if (holder != null) { ++ this.setTreeType(holder); // CraftBukkit + for (int i = 0; i >= -1; i--) { + for (int i1 = 0; i1 >= -1; i1--) { + if (isTwoByTwoSapling(state, level, pos, i, i1)) { @@ -164,6 +_,7 @@ if (holder1 == null) { return false; diff --git a/paper-server/patches/unapplied/net/minecraft/world/effect/HealOrHarmMobEffect.java.patch b/paper-server/patches/unapplied/net/minecraft/world/effect/HealOrHarmMobEffect.java.patch deleted file mode 100644 index d8a62a429d..0000000000 --- a/paper-server/patches/unapplied/net/minecraft/world/effect/HealOrHarmMobEffect.java.patch +++ /dev/null @@ -1,20 +0,0 @@ ---- a/net/minecraft/world/effect/HealOrHarmMobEffect.java -+++ b/net/minecraft/world/effect/HealOrHarmMobEffect.java -@@ -17,7 +17,7 @@ - @Override - public boolean applyEffectTick(ServerLevel world, LivingEntity entity, int amplifier) { - if (this.isHarm == entity.isInvertedHealAndHarm()) { -- entity.heal((float) Math.max(4 << amplifier, 0)); -+ entity.heal((float) Math.max(4 << amplifier, 0), org.bukkit.event.entity.EntityRegainHealthEvent.RegainReason.MAGIC); // CraftBukkit - } else { - entity.hurtServer(world, entity.damageSources().magic(), (float) (6 << amplifier)); - } -@@ -31,7 +31,7 @@ - - if (this.isHarm == target.isInvertedHealAndHarm()) { - j = (int) (proximity * (double) (4 << amplifier) + 0.5D); -- target.heal((float) j); -+ target.heal((float) j, org.bukkit.event.entity.EntityRegainHealthEvent.RegainReason.MAGIC); // CraftBukkit - } else { - j = (int) (proximity * (double) (6 << amplifier) + 0.5D); - if (effectEntity == null) { diff --git a/paper-server/patches/unapplied/net/minecraft/world/effect/HungerMobEffect.java.patch b/paper-server/patches/unapplied/net/minecraft/world/effect/HungerMobEffect.java.patch deleted file mode 100644 index 9757b68e1a..0000000000 --- a/paper-server/patches/unapplied/net/minecraft/world/effect/HungerMobEffect.java.patch +++ /dev/null @@ -1,11 +0,0 @@ ---- a/net/minecraft/world/effect/HungerMobEffect.java -+++ b/net/minecraft/world/effect/HungerMobEffect.java -@@ -13,7 +13,7 @@ - @Override - public boolean applyEffectTick(ServerLevel world, LivingEntity entity, int amplifier) { - if (entity instanceof Player entityhuman) { -- entityhuman.causeFoodExhaustion(0.005F * (float) (amplifier + 1)); -+ entityhuman.causeFoodExhaustion(0.005F * (float) (amplifier + 1), org.bukkit.event.entity.EntityExhaustionEvent.ExhaustionReason.HUNGER_EFFECT); // CraftBukkit - EntityExhaustionEvent - } - - return true; diff --git a/paper-server/patches/unapplied/net/minecraft/world/effect/InfestedMobEffect.java.patch b/paper-server/patches/unapplied/net/minecraft/world/effect/InfestedMobEffect.java.patch deleted file mode 100644 index 98497613dc..0000000000 --- a/paper-server/patches/unapplied/net/minecraft/world/effect/InfestedMobEffect.java.patch +++ /dev/null @@ -1,15 +0,0 @@ ---- a/net/minecraft/world/effect/InfestedMobEffect.java -+++ b/net/minecraft/world/effect/InfestedMobEffect.java -@@ -48,7 +48,11 @@ - - entitysilverfish.moveTo(x, y, z, world.getRandom().nextFloat() * 360.0F, 0.0F); - entitysilverfish.setDeltaMovement(new Vec3(vector3f)); -- world.addFreshEntity(entitysilverfish); -+ // CraftBukkit start -+ if (!world.addFreshEntity(entitysilverfish, org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason.POTION_EFFECT)) { -+ return; -+ } -+ // CraftBukkit end - entitysilverfish.playSound(SoundEvents.SILVERFISH_HURT); - } - } diff --git a/paper-server/patches/unapplied/net/minecraft/world/effect/MobEffectUtil.java.patch b/paper-server/patches/unapplied/net/minecraft/world/effect/MobEffectUtil.java.patch deleted file mode 100644 index 6c259deb9b..0000000000 --- a/paper-server/patches/unapplied/net/minecraft/world/effect/MobEffectUtil.java.patch +++ /dev/null @@ -1,39 +0,0 @@ ---- a/net/minecraft/world/effect/MobEffectUtil.java -+++ b/net/minecraft/world/effect/MobEffectUtil.java -@@ -50,13 +50,32 @@ - } - - public static List addEffectToPlayersAround(ServerLevel world, @Nullable Entity entity, Vec3 origin, double range, MobEffectInstance statusEffectInstance, int duration) { -- Holder holder = statusEffectInstance.getEffect(); -- List list = world.getPlayers((entityplayer) -> { -- return entityplayer.gameMode.isSurvival() && (entity == null || !entity.isAlliedTo((Entity) entityplayer)) && origin.closerThan(entityplayer.position(), range) && (!entityplayer.hasEffect(holder) || entityplayer.getEffect(holder).getAmplifier() < statusEffectInstance.getAmplifier() || entityplayer.getEffect(holder).endsWithin(duration - 1)); -+ // CraftBukkit start -+ return MobEffectUtil.addEffectToPlayersAround(world, entity, origin, range, statusEffectInstance, duration, org.bukkit.event.entity.EntityPotionEffectEvent.Cause.UNKNOWN); -+ } -+ -+ public static List addEffectToPlayersAround(ServerLevel worldserver, @Nullable Entity entity, Vec3 vec3d, double d0, MobEffectInstance mobeffect, int i, org.bukkit.event.entity.EntityPotionEffectEvent.Cause cause) { -+ // Paper start - Add ElderGuardianAppearanceEvent -+ return addEffectToPlayersAround(worldserver, entity, vec3d, d0, mobeffect, i, cause, null); -+ } -+ -+ public static List addEffectToPlayersAround(ServerLevel worldserver, @Nullable Entity entity, Vec3 vec3d, double d0, MobEffectInstance mobeffect, int i, org.bukkit.event.entity.EntityPotionEffectEvent.Cause cause, @Nullable java.util.function.Predicate playerPredicate) { -+ // Paper end - Add ElderGuardianAppearanceEvent -+ // CraftBukkit end -+ Holder holder = mobeffect.getEffect(); -+ List list = worldserver.getPlayers((entityplayer) -> { -+ // Paper start - Add ElderGuardianAppearanceEvent -+ boolean condition = entityplayer.gameMode.isSurvival() && (entity == null || !entity.isAlliedTo((Entity) entityplayer)) && vec3d.closerThan(entityplayer.position(), d0) && (!entityplayer.hasEffect(holder) || entityplayer.getEffect(holder).getAmplifier() < mobeffect.getAmplifier() || entityplayer.getEffect(holder).endsWithin(i - 1)); -+ if (condition) { -+ return playerPredicate == null || playerPredicate.test(entityplayer); // Only test the player AFTER it is true -+ } else { -+ return false; -+ } -+ // Paper ned - Add ElderGuardianAppearanceEvent - }); - - list.forEach((entityplayer) -> { -- entityplayer.addEffect(new MobEffectInstance(statusEffectInstance), entity); -+ entityplayer.addEffect(new MobEffectInstance(mobeffect), entity, cause); // CraftBukkit - }); - return list; - } diff --git a/paper-server/patches/unapplied/net/minecraft/world/effect/OozingMobEffect.java.patch b/paper-server/patches/unapplied/net/minecraft/world/effect/OozingMobEffect.java.patch deleted file mode 100644 index 4a2bef9952..0000000000 --- a/paper-server/patches/unapplied/net/minecraft/world/effect/OozingMobEffect.java.patch +++ /dev/null @@ -1,11 +0,0 @@ ---- a/net/minecraft/world/effect/OozingMobEffect.java -+++ b/net/minecraft/world/effect/OozingMobEffect.java -@@ -52,7 +52,7 @@ - if (entityslime != null) { - entityslime.setSize(2, true); - entityslime.moveTo(x, y, z, world.getRandom().nextFloat() * 360.0F, 0.0F); -- world.addFreshEntity(entityslime); -+ world.addFreshEntity(entityslime, org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason.POTION_EFFECT); // CraftBukkit - } - } - diff --git a/paper-server/patches/unapplied/net/minecraft/world/effect/PoisonMobEffect.java.patch b/paper-server/patches/unapplied/net/minecraft/world/effect/PoisonMobEffect.java.patch deleted file mode 100644 index 367358c2d8..0000000000 --- a/paper-server/patches/unapplied/net/minecraft/world/effect/PoisonMobEffect.java.patch +++ /dev/null @@ -1,11 +0,0 @@ ---- a/net/minecraft/world/effect/PoisonMobEffect.java -+++ b/net/minecraft/world/effect/PoisonMobEffect.java -@@ -14,7 +14,7 @@ - @Override - public boolean applyEffectTick(ServerLevel world, LivingEntity entity, int amplifier) { - if (entity.getHealth() > 1.0F) { -- entity.hurtServer(world, entity.damageSources().magic(), 1.0F); -+ entity.hurtServer(world, entity.damageSources().poison(), 1.0F); // CraftBukkit - DamageSource.MAGIC -> CraftEventFactory.POISON - } - - return true; diff --git a/paper-server/patches/unapplied/net/minecraft/world/effect/SaturationMobEffect.java.patch b/paper-server/patches/unapplied/net/minecraft/world/effect/SaturationMobEffect.java.patch deleted file mode 100644 index 5d38f090c8..0000000000 --- a/paper-server/patches/unapplied/net/minecraft/world/effect/SaturationMobEffect.java.patch +++ /dev/null @@ -1,30 +0,0 @@ ---- a/net/minecraft/world/effect/SaturationMobEffect.java -+++ b/net/minecraft/world/effect/SaturationMobEffect.java -@@ -3,6 +3,10 @@ - import net.minecraft.server.level.ServerLevel; - import net.minecraft.world.entity.LivingEntity; - import net.minecraft.world.entity.player.Player; -+// CraftBukkit start -+import org.bukkit.craftbukkit.entity.CraftPlayer; -+import org.bukkit.craftbukkit.event.CraftEventFactory; -+// CraftBukkit end - - class SaturationMobEffect extends InstantenousMobEffect { - -@@ -13,7 +17,15 @@ - @Override - public boolean applyEffectTick(ServerLevel world, LivingEntity entity, int amplifier) { - if (entity instanceof Player entityhuman) { -- entityhuman.getFoodData().eat(amplifier + 1, 1.0F); -+ // CraftBukkit start -+ int oldFoodLevel = entityhuman.getFoodData().foodLevel; -+ org.bukkit.event.entity.FoodLevelChangeEvent event = CraftEventFactory.callFoodLevelChangeEvent(entityhuman, amplifier + 1 + oldFoodLevel); -+ if (!event.isCancelled()) { -+ entityhuman.getFoodData().eat(event.getFoodLevel() - oldFoodLevel, 1.0F); -+ } -+ -+ ((CraftPlayer) entityhuman.getBukkitEntity()).sendHealthUpdate(); -+ // CraftBukkit end - } - - return true;