From bf7ca9b8241e139e07cd65711082aa9001fad636 Mon Sep 17 00:00:00 2001 From: CraftBukkit/Spigot Date: Thu, 7 Dec 2023 08:24:27 +1100 Subject: [PATCH] SPIGOT-7532: Entity#isValid() returns false after server restart By: Jishuna --- .../net/minecraft/server/level/WorldServer.patch | 16 +++------------- 1 file changed, 3 insertions(+), 13 deletions(-) diff --git a/paper-server/nms-patches/net/minecraft/server/level/WorldServer.patch b/paper-server/nms-patches/net/minecraft/server/level/WorldServer.patch index ce82ee1a31..5b3139d0d6 100644 --- a/paper-server/nms-patches/net/minecraft/server/level/WorldServer.patch +++ b/paper-server/nms-patches/net/minecraft/server/level/WorldServer.patch @@ -593,26 +593,16 @@ } @Override -@@ -1737,7 +1953,9 @@ - - a() {} - -- public void onCreated(Entity entity) {} -+ public void onCreated(Entity entity) { -+ entity.inWorld = true; // CraftBukkit - Mark entity as in world -+ } - - public void onDestroyed(Entity entity) { - WorldServer.this.getScoreboard().entityRemoved(entity); -@@ -1785,6 +2003,7 @@ +@@ -1785,6 +2001,8 @@ } entity.updateDynamicGameEventListener(DynamicGameEventListener::add); ++ entity.inWorld = true; // CraftBukkit - Mark entity as in world + entity.valid = true; // CraftBukkit } public void onTrackingEnd(Entity entity) { -@@ -1821,6 +2040,14 @@ +@@ -1821,6 +2039,14 @@ } entity.updateDynamicGameEventListener(DynamicGameEventListener::remove);