#1420: Fix DirectEntity and CausingEntity Damager for Creepers ignited by Player
By: Doc <nachito94@msn.com>
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
--- a/net/minecraft/world/damagesource/DamageSource.java
|
||||
+++ b/net/minecraft/world/damagesource/DamageSource.java
|
||||
@@ -21,6 +21,103 @@
|
||||
@@ -21,6 +21,119 @@
|
||||
private final Entity directEntity;
|
||||
@Nullable
|
||||
private final Vec3D damageSourcePosition;
|
||||
@@ -12,7 +12,8 @@
|
||||
+ private boolean sweep = false;
|
||||
+ private boolean melting = false;
|
||||
+ private boolean poison = false;
|
||||
+ private Entity customEntityDamager = null; // This field is a helper for when causing entity damage is not set by vanilla
|
||||
+ private Entity customEntityDamager = null; // This field is a helper for when direct entity damage is not set by vanilla
|
||||
+ private Entity customCausingEntityDamager = null; // This field is a helper for when causing entity damage is not set by vanilla
|
||||
+
|
||||
+ public DamageSource sweep() {
|
||||
+ this.sweep = true;
|
||||
@@ -45,6 +46,10 @@
|
||||
+ return (this.customEntityDamager != null) ? this.customEntityDamager : this.directEntity;
|
||||
+ }
|
||||
+
|
||||
+ public Entity getCausingDamager() {
|
||||
+ return (this.customCausingEntityDamager != null) ? this.customCausingEntityDamager : this.causingEntity;
|
||||
+ }
|
||||
+
|
||||
+ public DamageSource customEntityDamager(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
|
||||
@@ -56,6 +61,17 @@
|
||||
+ return damageSource;
|
||||
+ }
|
||||
+
|
||||
+ public DamageSource customCausingEntityDamager(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.customCausingEntityDamager != null || this.directEntity == entity || this.causingEntity == entity) {
|
||||
+ return this;
|
||||
+ }
|
||||
+ DamageSource damageSource = this.cloneInstance();
|
||||
+ damageSource.customCausingEntityDamager = entity;
|
||||
+ return damageSource;
|
||||
+ }
|
||||
+
|
||||
+ public org.bukkit.block.Block getDirectBlock() {
|
||||
+ return this.directBlock;
|
||||
+ }
|
||||
|
||||
Reference in New Issue
Block a user