From 68aea4352695b2d0895a8ac19239678c40dd7436 Mon Sep 17 00:00:00 2001 From: Nassim Jahnke Date: Thu, 25 Apr 2024 23:28:56 +0200 Subject: [PATCH] Fixup damage source change --- patches/server/0973-Fix-DamageSource-API.patch | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/patches/server/0973-Fix-DamageSource-API.patch b/patches/server/0973-Fix-DamageSource-API.patch index 809c54cab5..0e5c644bc1 100644 --- a/patches/server/0973-Fix-DamageSource-API.patch +++ b/patches/server/0973-Fix-DamageSource-API.patch @@ -87,7 +87,7 @@ index 0ffff5329fa2c7833f9ec71528cb7f951cf78109..bf2d91bbb4bf401696f5f5d14a67e392 if (damager != null) { event = new HangingBreakByEntityEvent((Hanging) this.getBukkitEntity(), damager.getBukkitEntity(), source.is(DamageTypeTags.IS_EXPLOSION) ? HangingBreakEvent.RemoveCause.EXPLOSION : HangingBreakEvent.RemoveCause.ENTITY); diff --git a/src/main/java/net/minecraft/world/entity/monster/Creeper.java b/src/main/java/net/minecraft/world/entity/monster/Creeper.java -index 4b94e21d05d6deae75f0c2fb711e43a4c7d06f90..662b55f69fb4284cbeb0e08b4b63353d498e0217 100644 +index 4b94e21d05d6deae75f0c2fb711e43a4c7d06f90..cbcb2bfa8f91099e5c374f590f48885390bdf7a7 100644 --- a/src/main/java/net/minecraft/world/entity/monster/Creeper.java +++ b/src/main/java/net/minecraft/world/entity/monster/Creeper.java @@ -271,7 +271,7 @@ public class Creeper extends Monster implements PowerableMob { @@ -95,7 +95,7 @@ index 4b94e21d05d6deae75f0c2fb711e43a4c7d06f90..662b55f69fb4284cbeb0e08b4b63353d // CraftBukkit end this.dead = true; - this.level().explode(this, net.minecraft.world.level.Explosion.getDefaultDamageSource(this.level(), this).customCausingEntity(this.entityIgniter), null, this.getX(), this.getY(), this.getZ(), event.getRadius(), event.getFire(), Level.ExplosionInteraction.MOB); // CraftBukkit -+ this.level().explode(this, net.minecraft.world.level.Explosion.getDefaultDamageSource(this.level(), this).customEventDamager(this.entityIgniter), null, this.getX(), this.getY(), this.getZ(), event.getRadius(), event.getFire(), Level.ExplosionInteraction.MOB); // CraftBukkit // Paper - fix DamageSource API ++ this.level().explode(this, this.getX(), this.getY(), this.getZ(), event.getRadius(), event.getFire(), Level.ExplosionInteraction.MOB); // CraftBukkit // Paper - fix DamageSource API this.discard(EntityRemoveEvent.Cause.EXPLODE); // CraftBukkit - add Bukkit remove cause this.spawnLingeringCloud(); // CraftBukkit start @@ -190,7 +190,7 @@ index 4c6e15535fa40aad8cf1920f392589404f9ba79c..35eb95ef6fb6a0f7ea63351e90741c48 } } diff --git a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java -index 444287fea080182df533198f5c659533de86c5dc..0a06b9f9691896dc9d5b67361e41d9f049422020 100644 +index 444287fea080182df533198f5c659533de86c5dc..544567e576023709f86abf57963c37a5490ab9f0 100644 --- a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java +++ b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java @@ -1082,7 +1082,7 @@ public class CraftEventFactory { @@ -198,7 +198,7 @@ index 444287fea080182df533198f5c659533de86c5dc..0a06b9f9691896dc9d5b67361e41d9f0 private static EntityDamageEvent handleEntityDamageEvent(Entity entity, DamageSource source, Map modifiers, Map> modifierFunctions, boolean cancelled) { CraftDamageSource bukkitDamageSource = new CraftDamageSource(source); - Entity damager = (bukkitDamageSource.isIndirect() && source.getDirectEntity() != null) ? source.getDirectEntity() : source.getCausingEntity(); -+ Entity damager = (bukkitDamageSource.isIndirect() && source.getDirectEntity() != null) ? source.getDirectEntity() : source.getCustomEventDamager(); // Paper - fix DamageSource API ++ final Entity damager = source.getCustomEventDamager(); // Paper - fix DamageSource API if (source.is(DamageTypeTags.IS_EXPLOSION)) { if (damager == null) { return CraftEventFactory.callEntityDamageEvent(source.getDirectBlock(), entity, DamageCause.BLOCK_EXPLOSION, bukkitDamageSource, modifiers, modifierFunctions, cancelled, source.explodedBlockState); // Paper - Include BlockState for damage