Try even harder to get an origin world and avoid NPEs (Fixes #5931)

This commit is contained in:
Shane Freeder 2021-06-22 11:54:49 +01:00
parent aed4433aca
commit a9394b8c1a
No known key found for this signature in database
GPG key ID: A3F61EA5A085289C
21 changed files with 69 additions and 62 deletions

View file

@ -5,7 +5,7 @@ Subject: [PATCH] Entity#fromMobSpawner()
diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java
index 5f43d3d2742bffe743ce02da58059e3b6f17f160..855e48c9a1d9632bef831aa2fca519c782fb09c5 100644
index 7c8df6781ffe142b6d1c4fd7b18f9a2f280194e7..2aa6c6b4a5a431b6860e91684cf20514fbb52676 100644
--- a/src/main/java/net/minecraft/world/entity/Entity.java
+++ b/src/main/java/net/minecraft/world/entity/Entity.java
@@ -321,6 +321,7 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, n
@ -16,8 +16,8 @@ index 5f43d3d2742bffe743ce02da58059e3b6f17f160..855e48c9a1d9632bef831aa2fca519c7
protected int numCollisions = 0; // Paper
public void inactiveTick() { }
// Spigot end
@@ -1859,6 +1860,10 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, n
nbt.putUUID("Paper.OriginWorld", originWorld);
@@ -1862,6 +1863,10 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, n
}
nbt.put("Paper.Origin", this.newDoubleList(origin.getX(), origin.getY(), origin.getZ()));
}
+ // Save entity's from mob spawner status
@ -27,7 +27,7 @@ index 5f43d3d2742bffe743ce02da58059e3b6f17f160..855e48c9a1d9632bef831aa2fca519c7
// Paper end
return nbt;
} catch (Throwable throwable) {
@@ -1998,6 +2003,8 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, n
@@ -2001,6 +2006,8 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, n
this.originWorld = originWorld;
origin = new org.bukkit.util.Vector(originTag.getDouble(0), originTag.getDouble(1), originTag.getDouble(2));
}