diff --git a/sparklypaper-server/minecraft-patches/features/0001-Parallel-World-Ticking.patch b/sparklypaper-server/minecraft-patches/features/0001-Parallel-World-Ticking.patch index 4910e61..2016d00 100644 --- a/sparklypaper-server/minecraft-patches/features/0001-Parallel-World-Ticking.patch +++ b/sparklypaper-server/minecraft-patches/features/0001-Parallel-World-Ticking.patch @@ -178,7 +178,7 @@ index 2882cd829d4d8e1f8615f085f6908efcdf68ac62..7b058fed0ca52b2f74f5cf4534df7b24 } } diff --git a/net/minecraft/server/level/ServerLevel.java b/net/minecraft/server/level/ServerLevel.java -index ecfe237fbecde610d095647a1f2a10f7d426d786..7c178bd28880a8fea2bbae7cd0c81fa59448f439 100644 +index ecfe237fbecde610d095647a1f2a10f7d426d786..4211816c3b21a2ee66297a8f58b51de378bfd36c 100644 --- a/net/minecraft/server/level/ServerLevel.java +++ b/net/minecraft/server/level/ServerLevel.java @@ -182,7 +182,7 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe @@ -198,6 +198,15 @@ index ecfe237fbecde610d095647a1f2a10f7d426d786..7c178bd28880a8fea2bbae7cd0c81fa5 // CraftBukkit start public final LevelStorageSource.LevelStorageAccess levelStorageAccess; +@@ -665,7 +666,7 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe + this.sleepStatus = new SleepStatus(); + this.gameEventDispatcher = new GameEventDispatcher(this); + this.randomSequences = Objects.requireNonNullElseGet(randomSequences, () -> this.getDataStorage().computeIfAbsent(RandomSequences.TYPE)); +- this.waypointManager = new ServerWaypointManager(); ++ this.waypointManager = new ServerWaypointManager(this); // SparklyPaper - parallel world ticking + // Paper start - rewrite chunk system + this.moonrise$setEntityLookup(new ca.spottedleaf.moonrise.patches.chunk_system.level.entity.server.ServerEntityLookup((ServerLevel)(Object)this, ((ServerLevel)(Object)this).new EntityCallbacks())); + this.chunkTaskScheduler = new ca.spottedleaf.moonrise.patches.chunk_system.scheduling.ChunkTaskScheduler((ServerLevel)(Object)this); @@ -681,6 +682,7 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe this.chunkDataController = new ca.spottedleaf.moonrise.patches.chunk_system.io.datacontroller.ChunkDataController((ServerLevel)(Object)this, this.chunkTaskScheduler); // Paper end - rewrite chunk system @@ -345,6 +354,90 @@ index b1524279c02cd3be82338a6bd0320cb125a134d5..9b291998bb5a5dcb94e2e6f8f1813a08 // CraftBukkit end serverPlayer.connection = player.connection; serverPlayer.restoreFrom(player, keepInventory); +diff --git a/net/minecraft/server/waypoints/ServerWaypointManager.java b/net/minecraft/server/waypoints/ServerWaypointManager.java +index f9e7532f86122a379692561a639a209a126e8bba..2709dfae53c1a210f36c45fa0df0d49536341a38 100644 +--- a/net/minecraft/server/waypoints/ServerWaypointManager.java ++++ b/net/minecraft/server/waypoints/ServerWaypointManager.java +@@ -20,8 +20,16 @@ public class ServerWaypointManager implements WaypointManager players = new HashSet<>(); + private final Table connections = HashBasedTable.create(); + ++ // SparklyPaper start - parallel world ticking ++ private final net.minecraft.server.level.ServerLevel level; ++ public ServerWaypointManager(net.minecraft.server.level.ServerLevel level) { ++ this.level = level; ++ } ++ // SparklyPaper end ++ + @Override + public void trackWaypoint(WaypointTransmitter waypoint) { ++ ca.spottedleaf.moonrise.common.util.TickThread.ensureTickThread(this.level, "Cannot track waypoints off-main"); // SparklyPaper - parallel world ticking + this.waypoints.add(waypoint); + + for (ServerPlayer serverPlayer : this.players) { +@@ -31,6 +39,7 @@ public class ServerWaypointManager implements WaypointManager map = Tables.transpose(this.connections).row(waypoint); + SetView set = Sets.difference(this.players, map.keySet()); +@@ -47,12 +56,14 @@ public class ServerWaypointManager implements WaypointManager connection.disconnect()); + Tables.transpose(this.connections).row(waypoint).clear(); + this.waypoints.remove(waypoint); + } + + public void addPlayer(ServerPlayer player) { ++ ca.spottedleaf.moonrise.common.util.TickThread.ensureTickThread(this.level, "Cannot add player to waypoints off-main"); // SparklyPaper - parallel world ticking + this.players.add(player); + + for (WaypointTransmitter waypointTransmitter : this.waypoints) { +@@ -65,6 +76,7 @@ public class ServerWaypointManager implements WaypointManager map = this.connections.row(player); + SetView set = Sets.difference(this.waypoints, map.keySet()); + +@@ -78,6 +90,7 @@ public class ServerWaypointManager implements WaypointManager { + connection.disconnect(); + return true; +@@ -87,6 +100,7 @@ public class ServerWaypointManager implements WaypointManager { +@@ -122,6 +137,7 @@ public class ServerWaypointManager implements WaypointManager