diff --git a/patches/server/Entity-AddTo-RemoveFrom-World-Events.patch b/patches/server/Entity-AddTo-RemoveFrom-World-Events.patch index 3640e92db3..44fb245154 100644 --- a/patches/server/Entity-AddTo-RemoveFrom-World-Events.patch +++ b/patches/server/Entity-AddTo-RemoveFrom-World-Events.patch @@ -9,7 +9,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 --- a/src/main/java/net/minecraft/server/level/ServerLevel.java +++ b/src/main/java/net/minecraft/server/level/ServerLevel.java @@ -0,0 +0,0 @@ public class ServerLevel extends net.minecraft.world.level.Level implements Worl - entity.setOrigin(entity.getBukkitEntity().getLocation()); + entity.setOrigin(entity.getOriginVector().toLocation(getWorld())); } // Paper end + new com.destroystokyo.paper.event.entity.EntityAddToWorldEvent(entity.getBukkitEntity()).callEvent(); // Paper - fire while valid diff --git a/patches/server/Entity-Origin-API.patch b/patches/server/Entity-Origin-API.patch index b5e28c84a4..67232d33ef 100644 --- a/patches/server/Entity-Origin-API.patch +++ b/patches/server/Entity-Origin-API.patch @@ -16,6 +16,10 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + if (entity.getOriginVector() == null) { + entity.setOrigin(entity.getBukkitEntity().getLocation()); + } ++ // Default to current world if unknown, gross assumption but entities rarely change world ++ if (entity.getOriginWorld() == null) { ++ entity.setOrigin(entity.getOriginVector().toLocation(getWorld())); ++ } + // Paper end } @@ -58,7 +62,10 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 // CraftBukkit end + // Paper start - Save the entity's origin location + if (this.origin != null) { -+ nbt.putUUID("Paper.OriginWorld", originWorld); ++ UUID originWorld = this.originWorld != null ? this.originWorld : this.level != null ? this.level.getWorld().getUID() : null; ++ if (originWorld != null) { ++ nbt.putUUID("Paper.OriginWorld", originWorld); ++ } + nbt.put("Paper.Origin", this.newDoubleList(origin.getX(), origin.getY(), origin.getZ())); + } + // Paper end diff --git a/patches/server/Entity-fromMobSpawner.patch b/patches/server/Entity-fromMobSpawner.patch index 4a19a8e0c3..10206b74b3 100644 --- a/patches/server/Entity-fromMobSpawner.patch +++ b/patches/server/Entity-fromMobSpawner.patch @@ -17,7 +17,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 public void inactiveTick() { } // Spigot end @@ -0,0 +0,0 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, n - nbt.putUUID("Paper.OriginWorld", originWorld); + } nbt.put("Paper.Origin", this.newDoubleList(origin.getX(), origin.getY(), origin.getZ())); } + // Save entity's from mob spawner status diff --git a/patches/server/Entity-getEntitySpawnReason.patch b/patches/server/Entity-getEntitySpawnReason.patch index d2e608bdd4..ba0f2d4ce5 100644 --- a/patches/server/Entity-getEntitySpawnReason.patch +++ b/patches/server/Entity-getEntitySpawnReason.patch @@ -56,7 +56,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 public com.destroystokyo.paper.loottable.PaperLootableInventoryData lootableData; // Paper @@ -0,0 +0,0 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, n - nbt.putUUID("Paper.OriginWorld", originWorld); + } nbt.put("Paper.Origin", this.newDoubleList(origin.getX(), origin.getY(), origin.getZ())); } + if (spawnReason != null) {