mirror of
https://github.com/PaperMC/Paper.git
synced 2024-12-28 15:30:19 +01:00
Fix Projectile#setOwner(null) not clearing owner (#9715)
* Fix Projectile#setOwner(null) not clearing owner * rebased and merged into mentioned patch --------- Co-authored-by: Jake Potrebic <jake.m.potrebic@gmail.com>
This commit is contained in:
parent
0c8e84c20d
commit
ede9c06814
1 changed files with 15 additions and 3 deletions
|
@ -8,6 +8,11 @@ the API matches the owner UUID specified in the entity nbt.
|
||||||
Previously, after the entity reloaded, Projectile#getShooter
|
Previously, after the entity reloaded, Projectile#getShooter
|
||||||
would return null, while the entity still had an owner.
|
would return null, while the entity still had an owner.
|
||||||
|
|
||||||
|
Also fixes setting the shooter/owner to null actually
|
||||||
|
clearing the owner.
|
||||||
|
|
||||||
|
Co-authored-by: Warrior <50800980+Warriorrrr@users.noreply.github.com>
|
||||||
|
|
||||||
diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java
|
diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java
|
||||||
index d9f6b0e0b20f4106ffead6b773b5489b71924c61..cf9393dd02565134a1ce428e84a9f26ac2d39a0d 100644
|
index d9f6b0e0b20f4106ffead6b773b5489b71924c61..cf9393dd02565134a1ce428e84a9f26ac2d39a0d 100644
|
||||||
--- a/src/main/java/net/minecraft/world/entity/Entity.java
|
--- a/src/main/java/net/minecraft/world/entity/Entity.java
|
||||||
|
@ -21,15 +26,22 @@ index d9f6b0e0b20f4106ffead6b773b5489b71924c61..cf9393dd02565134a1ce428e84a9f26a
|
||||||
public boolean lastDamageCancelled; // SPIGOT-5339, SPIGOT-6252, SPIGOT-6777: Keep track if the event was canceled
|
public boolean lastDamageCancelled; // SPIGOT-5339, SPIGOT-6252, SPIGOT-6777: Keep track if the event was canceled
|
||||||
public boolean persistentInvisibility = false;
|
public boolean persistentInvisibility = false;
|
||||||
diff --git a/src/main/java/net/minecraft/world/entity/projectile/Projectile.java b/src/main/java/net/minecraft/world/entity/projectile/Projectile.java
|
diff --git a/src/main/java/net/minecraft/world/entity/projectile/Projectile.java b/src/main/java/net/minecraft/world/entity/projectile/Projectile.java
|
||||||
index 6d7ac0c8c171834fa8da94f158258a4774d80ec4..1b7cf6d06bdf36f146656727511a461f2520762e 100644
|
index 6d7ac0c8c171834fa8da94f158258a4774d80ec4..a90317100d32974e481e14476843f66997a2cf3a 100644
|
||||||
--- a/src/main/java/net/minecraft/world/entity/projectile/Projectile.java
|
--- a/src/main/java/net/minecraft/world/entity/projectile/Projectile.java
|
||||||
+++ b/src/main/java/net/minecraft/world/entity/projectile/Projectile.java
|
+++ b/src/main/java/net/minecraft/world/entity/projectile/Projectile.java
|
||||||
@@ -49,14 +49,24 @@ public abstract class Projectile extends Entity implements TraceableEntity {
|
@@ -49,14 +49,31 @@ public abstract class Projectile extends Entity implements TraceableEntity {
|
||||||
this.ownerUUID = entity.getUUID();
|
this.ownerUUID = entity.getUUID();
|
||||||
this.cachedOwner = entity;
|
this.cachedOwner = entity;
|
||||||
}
|
}
|
||||||
- this.projectileSource = (entity != null && entity.getBukkitEntity() instanceof ProjectileSource) ? (ProjectileSource) entity.getBukkitEntity() : null; // CraftBukkit
|
- this.projectileSource = (entity != null && entity.getBukkitEntity() instanceof ProjectileSource) ? (ProjectileSource) entity.getBukkitEntity() : null; // CraftBukkit
|
||||||
-
|
-
|
||||||
|
+ // Paper start - Fix null owners not being handled
|
||||||
|
+ else {
|
||||||
|
+ this.ownerUUID = null;
|
||||||
|
+ this.cachedOwner = null;
|
||||||
|
+ this.projectileSource = null;
|
||||||
|
+ }
|
||||||
|
+ // Paper end
|
||||||
+ this.refreshProjectileSource(false); // Paper
|
+ this.refreshProjectileSource(false); // Paper
|
||||||
+ }
|
+ }
|
||||||
+ // Paper start
|
+ // Paper start
|
||||||
|
@ -51,7 +63,7 @@ index 6d7ac0c8c171834fa8da94f158258a4774d80ec4..1b7cf6d06bdf36f146656727511a461f
|
||||||
return this.cachedOwner;
|
return this.cachedOwner;
|
||||||
} else if (this.ownerUUID != null && this.level() instanceof ServerLevel) {
|
} else if (this.ownerUUID != null && this.level() instanceof ServerLevel) {
|
||||||
this.cachedOwner = ((ServerLevel) this.level()).getEntity(this.ownerUUID);
|
this.cachedOwner = ((ServerLevel) this.level()).getEntity(this.ownerUUID);
|
||||||
@@ -72,6 +82,7 @@ public abstract class Projectile extends Entity implements TraceableEntity {
|
@@ -72,6 +89,7 @@ public abstract class Projectile extends Entity implements TraceableEntity {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// Paper end
|
// Paper end
|
||||||
|
|
Loading…
Reference in a new issue