PaperMC/Spigot-Server-Patches/0452-Move-player-to-spawn-point-if-spawn-in-unloaded-worl.patch
Mariell Hoversholm 2db85c553f
fix: origin world can be unknown while knowing location
We will now store the world ID. It may not be used if the entity is
loaded before the world in question is, but it might be used later on,
should the entity come after the world.

Signed-off-by: Mariell Hoversholm <proximyst@proximyst.com>
2021-06-12 23:30:56 +01:00

27 lines
1.5 KiB
Diff

From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: 2277 <38501234+2277@users.noreply.github.com>
Date: Tue, 31 Mar 2020 10:33:55 +0100
Subject: [PATCH] Move player to spawn point if spawn in unloaded world
The code following this has better support for null worlds to move
them back to the world spawn.
diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java
index e02d349f4353f96318d858a1aa70dfc4fadb6c71..f78c79f34b4ee89a72fe5a57da0eb4010cfea07c 100644
--- a/src/main/java/net/minecraft/world/entity/Entity.java
+++ b/src/main/java/net/minecraft/world/entity/Entity.java
@@ -1813,9 +1813,11 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, ne
bworld = server.getWorld(worldName);
}
- if (bworld == null) {
- bworld = ((org.bukkit.craftbukkit.CraftServer) server).getServer().getWorldServer(World.OVERWORLD).getWorld();
- }
+ // Paper start - Move player to spawn point if spawn in unloaded world
+// if (bworld == null) {
+// bworld = ((org.bukkit.craftbukkit.CraftServer) server).getServer().getWorldServer(World.OVERWORLD).getWorld();
+// }
+ // Paper end - Move player to spawn point if spawn in unloaded world
spawnIn(bworld == null ? null : ((CraftWorld) bworld).getHandle());
}