Check that phantom spawned uuid is set for save/load

Fixes #1408

Spawn eggs wont have a player set
This commit is contained in:
Aikar 2018-09-03 15:22:41 -04:00
parent bc78ff210a
commit 62c2210d6c

View file

@ -5,14 +5,18 @@ Subject: [PATCH] Add PhantomPreSpawnEvent
diff --git a/src/main/java/net/minecraft/server/EntityPhantom.java b/src/main/java/net/minecraft/server/EntityPhantom.java
index 2429644e99..2778660acd 100644
index 2429644e9..e27600109 100644
--- a/src/main/java/net/minecraft/server/EntityPhantom.java
+++ b/src/main/java/net/minecraft/server/EntityPhantom.java
@@ -0,0 +0,0 @@ public class EntityPhantom extends EntityFlying implements IMonster {
}
this.setSize(nbttagcompound.getInt("Size"));
+ this.spawningEntity = nbttagcompound.getUUID("Paper.SpawningEntity"); // Paper
+ // Paper start
+ if (nbttagcompound.hasUUID("Paper.SpawningEntity")) {
+ this.spawningEntity = nbttagcompound.getUUID("Paper.SpawningEntity");
+ }
+ // Paper end
}
public void b(NBTTagCompound nbttagcompound) {
@ -20,7 +24,11 @@ index 2429644e99..2778660acd 100644
nbttagcompound.setInt("AY", this.c.getY());
nbttagcompound.setInt("AZ", this.c.getZ());
nbttagcompound.setInt("Size", this.getSize());
+ nbttagcompound.setUUID("Paper.SpawningEntity", this.spawningEntity); // Paper
+ // Paper start
+ if (this.spawningEntity != null) {
+ nbttagcompound.setUUID("Paper.SpawningEntity", this.spawningEntity);
+ }
+ // Paper end
}
public SoundCategory bV() {
@ -40,7 +48,7 @@ index 2429644e99..2778660acd 100644
private int b;
diff --git a/src/main/java/net/minecraft/server/MobSpawnerPhantom.java b/src/main/java/net/minecraft/server/MobSpawnerPhantom.java
index 0626b77904..413188e970 100644
index 0626b7790..413188e97 100644
--- a/src/main/java/net/minecraft/server/MobSpawnerPhantom.java
+++ b/src/main/java/net/minecraft/server/MobSpawnerPhantom.java
@@ -0,0 +0,0 @@ public class MobSpawnerPhantom {
@ -63,7 +71,7 @@ index 0626b77904..413188e970 100644
groupdataentity = entityphantom.prepare(difficultydamagescaler, groupdataentity, (NBTTagCompound) null);
world.addEntity(entityphantom, org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason.NATURAL); // CraftBukkit
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPhantom.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPhantom.java
index 9f9ee92390..2b97313694 100644
index 9f9ee9239..2b9731369 100644
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPhantom.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPhantom.java
@@ -0,0 +0,0 @@ public class CraftPhantom extends CraftFlying implements Phantom {