Fixup damage source change

This commit is contained in:
Nassim Jahnke 2024-04-25 23:28:56 +02:00
parent 2641c02193
commit 68aea43526
No known key found for this signature in database
GPG key ID: EF6771C01F6EF02F

View file

@ -87,7 +87,7 @@ index 0ffff5329fa2c7833f9ec71528cb7f951cf78109..bf2d91bbb4bf401696f5f5d14a67e392
if (damager != null) { if (damager != null) {
event = new HangingBreakByEntityEvent((Hanging) this.getBukkitEntity(), damager.getBukkitEntity(), source.is(DamageTypeTags.IS_EXPLOSION) ? HangingBreakEvent.RemoveCause.EXPLOSION : HangingBreakEvent.RemoveCause.ENTITY); 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 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 --- a/src/main/java/net/minecraft/world/entity/monster/Creeper.java
+++ b/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 { @@ -271,7 +271,7 @@ public class Creeper extends Monster implements PowerableMob {
@ -95,7 +95,7 @@ index 4b94e21d05d6deae75f0c2fb711e43a4c7d06f90..662b55f69fb4284cbeb0e08b4b63353d
// CraftBukkit end // CraftBukkit end
this.dead = true; 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).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.discard(EntityRemoveEvent.Cause.EXPLODE); // CraftBukkit - add Bukkit remove cause
this.spawnLingeringCloud(); this.spawnLingeringCloud();
// CraftBukkit start // 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 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 --- a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java
+++ b/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 { @@ -1082,7 +1082,7 @@ public class CraftEventFactory {
@ -198,7 +198,7 @@ index 444287fea080182df533198f5c659533de86c5dc..0a06b9f9691896dc9d5b67361e41d9f0
private static EntityDamageEvent handleEntityDamageEvent(Entity entity, DamageSource source, Map<DamageModifier, Double> modifiers, Map<DamageModifier, Function<? super Double, Double>> modifierFunctions, boolean cancelled) { private static EntityDamageEvent handleEntityDamageEvent(Entity entity, DamageSource source, Map<DamageModifier, Double> modifiers, Map<DamageModifier, Function<? super Double, Double>> modifierFunctions, boolean cancelled) {
CraftDamageSource bukkitDamageSource = new CraftDamageSource(source); 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.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 (source.is(DamageTypeTags.IS_EXPLOSION)) {
if (damager == null) { if (damager == null) {
return CraftEventFactory.callEntityDamageEvent(source.getDirectBlock(), entity, DamageCause.BLOCK_EXPLOSION, bukkitDamageSource, modifiers, modifierFunctions, cancelled, source.explodedBlockState); // Paper - Include BlockState for damage return CraftEventFactory.callEntityDamageEvent(source.getDirectBlock(), entity, DamageCause.BLOCK_EXPLOSION, bukkitDamageSource, modifiers, modifierFunctions, cancelled, source.explodedBlockState); // Paper - Include BlockState for damage