#1362: Include Creeper igniter in causing entity for damage events

By: Doc <nachito94@msn.com>
This commit is contained in:
CraftBukkit/Spigot
2024-04-07 11:49:28 +10:00
parent 779b5137f8
commit 84d43ef379
3 changed files with 24 additions and 13 deletions

View File

@@ -1,6 +1,6 @@
--- a/net/minecraft/world/damagesource/DamageSource.java
+++ b/net/minecraft/world/damagesource/DamageSource.java
@@ -20,6 +20,81 @@
@@ -20,6 +20,86 @@
private final Entity directEntity;
@Nullable
private final Vec3D damageSourcePosition;
@@ -44,6 +44,11 @@
+ }
+
+ public DamageSource customCausingEntity(Entity entity) {
+ // This method is not intended for change the causing entity if is already set
+ // also is only necessary if the entity passed is not the direct entity or different from the current causingEntity
+ if (this.customCausingEntity != null || this.directEntity == entity || this.causingEntity == entity) {
+ return this;
+ }
+ DamageSource damageSource = this.cloneInstance();
+ damageSource.customCausingEntity = entity;
+ return damageSource;
@@ -82,7 +87,7 @@
public String toString() {
return "DamageSource (" + this.type().msgId() + ")";
@@ -33,7 +108,7 @@
@@ -33,7 +113,7 @@
return this.causingEntity != this.directEntity;
}