Remove sync loading of spawn chunks

Adding the tickets is sufficient
This commit is contained in:
Jason Penilla 2021-06-15 03:13:30 -07:00
parent 8291fff4ac
commit df2247b2ed
No known key found for this signature in database
GPG Key ID: 0E75A301420E48F8
4 changed files with 9 additions and 13 deletions

View File

@ -85,7 +85,7 @@ index c8a59de4673d430fc8ec2e53315f107293122e7e..40e48c3f1199b127066732e3c8a6d40c
// CraftBukkit start // CraftBukkit start
// this.updateSpawnFlags(); // this.updateSpawnFlags();
diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java
index c64557c70122bff6ea0c8d0b34f62daf680e4334..c778ce951c1ca648faa5d6c02b331d34ffc71156 100644 index c64557c70122bff6ea0c8d0b34f62daf680e4334..6631a2b8cf99993d727d65a67af2bc7febb685b4 100644
--- a/src/main/java/net/minecraft/server/level/ServerLevel.java --- a/src/main/java/net/minecraft/server/level/ServerLevel.java
+++ b/src/main/java/net/minecraft/server/level/ServerLevel.java +++ b/src/main/java/net/minecraft/server/level/ServerLevel.java
@@ -61,6 +61,7 @@ import net.minecraft.network.protocol.game.ClientboundSoundEntityPacket; @@ -61,6 +61,7 @@ import net.minecraft.network.protocol.game.ClientboundSoundEntityPacket;
@ -96,7 +96,7 @@ index c64557c70122bff6ea0c8d0b34f62daf680e4334..c778ce951c1ca648faa5d6c02b331d34
import net.minecraft.server.MinecraftServer; import net.minecraft.server.MinecraftServer;
import net.minecraft.server.ServerScoreboard; import net.minecraft.server.ServerScoreboard;
import net.minecraft.server.level.progress.ChunkProgressListener; import net.minecraft.server.level.progress.ChunkProgressListener;
@@ -1510,12 +1511,88 @@ public class ServerLevel extends net.minecraft.world.level.Level implements Worl @@ -1510,12 +1511,84 @@ public class ServerLevel extends net.minecraft.world.level.Level implements Worl
return ((MapIndex) this.getServer().overworld().getDataStorage().computeIfAbsent(MapIndex::load, MapIndex::new, "idcounts")).getFreeAuxValueForMap(); return ((MapIndex) this.getServer().overworld().getDataStorage().computeIfAbsent(MapIndex::load, MapIndex::new, "idcounts")).getFreeAuxValueForMap();
} }
@ -132,10 +132,6 @@ index c64557c70122bff6ea0c8d0b34f62daf680e4334..c778ce951c1ca648faa5d6c02b331d34
+ // left + // left
+ chunkproviderserver.addRegionTicket(TicketType.START, new ChunkPos(spawn.add(-radiusInBlocks, 0, z)), 1, Unit.INSTANCE); // level 32 + chunkproviderserver.addRegionTicket(TicketType.START, new ChunkPos(spawn.add(-radiusInBlocks, 0, z)), 1, Unit.INSTANCE); // level 32
+ } + }
+
+ MCUtil.getSpiralOutChunks(spawn, radiusInBlocks >> 4).forEach(pair -> {
+ getChunkSource().getChunkAtMainThread(pair.x, pair.z);
+ });
+ } + }
+ public void removeTicketsForSpawn(int radiusInBlocks, BlockPos spawn) { + public void removeTicketsForSpawn(int radiusInBlocks, BlockPos spawn) {
+ // In order to respect vanilla behavior, which is ensuring everything but the spawn border can tick, we added tickets + // In order to respect vanilla behavior, which is ensuring everything but the spawn border can tick, we added tickets

View File

@ -26,10 +26,10 @@ index e1498a5a8e664b922c77a8524ed2ea38c91834ce..71d5c298e14869d9d44226aeb6ffe3f0
EntityType<?> entitytypes = entity.getType(); EntityType<?> entitytypes = entity.getType();
int i = entitytypes.clientTrackingRange() * 16; int i = entitytypes.clientTrackingRange() * 16;
diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java
index a43839ddd468d7b61d5609f22fb1e9fcd873590a..da85bfe5de9dcd6d51605ce9b023265b5a5f2936 100644 index 03939f43ade3859a53ccf90e7fc221555ce6e97f..7340a25e49af30ecbb4b212365b9941e24e221d2 100644
--- a/src/main/java/net/minecraft/server/level/ServerLevel.java --- a/src/main/java/net/minecraft/server/level/ServerLevel.java
+++ b/src/main/java/net/minecraft/server/level/ServerLevel.java +++ b/src/main/java/net/minecraft/server/level/ServerLevel.java
@@ -2124,7 +2124,7 @@ public class ServerLevel extends net.minecraft.world.level.Level implements Worl @@ -2120,7 +2120,7 @@ public class ServerLevel extends net.minecraft.world.level.Level implements Worl
public void onTrackingStart(Entity entity) { public void onTrackingStart(Entity entity) {
org.spigotmc.AsyncCatcher.catchOp("entity register"); // Spigot org.spigotmc.AsyncCatcher.catchOp("entity register"); // Spigot
@ -38,7 +38,7 @@ index a43839ddd468d7b61d5609f22fb1e9fcd873590a..da85bfe5de9dcd6d51605ce9b023265b
if (entity instanceof ServerPlayer) { if (entity instanceof ServerPlayer) {
ServerLevel.this.players.add((ServerPlayer) entity); ServerLevel.this.players.add((ServerPlayer) entity);
ServerLevel.this.updateSleepingPlayerList(); ServerLevel.this.updateSleepingPlayerList();
@@ -2146,6 +2146,7 @@ public class ServerLevel extends net.minecraft.world.level.Level implements Worl @@ -2142,6 +2142,7 @@ public class ServerLevel extends net.minecraft.world.level.Level implements Worl
} }
entity.valid = true; // CraftBukkit entity.valid = true; // CraftBukkit

View File

@ -5,10 +5,10 @@ Subject: [PATCH] Fix SpawnChangeEvent not firing for all use-cases
diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java
index bdabcdb60dbfb803ead13c42c8dd5e100b37dc00..4ae56444d258cdf44a02256315d6aae84e2f53be 100644 index 23f9bb0f3202b418bf4fb59a46c624477f4dfae3..8d3d76ff942baf129f9845b945bd1537a058833a 100644
--- a/src/main/java/net/minecraft/server/level/ServerLevel.java --- a/src/main/java/net/minecraft/server/level/ServerLevel.java
+++ b/src/main/java/net/minecraft/server/level/ServerLevel.java +++ b/src/main/java/net/minecraft/server/level/ServerLevel.java
@@ -1679,12 +1679,14 @@ public class ServerLevel extends net.minecraft.world.level.Level implements Worl @@ -1675,12 +1675,14 @@ public class ServerLevel extends net.minecraft.world.level.Level implements Worl
} }
// Paper end // Paper end

View File

@ -5,10 +5,10 @@ Subject: [PATCH] Remove stale POIs
diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java
index f1c02ae301da2a3b582d2ec1215c1a981e26ac47..0e14946284738b751790b2763bfe197c0148a54a 100644 index 908708900a9160d95dea3a392d96a40a17489280..a883677719b408edf0b81cdc885e65759a03936e 100644
--- a/src/main/java/net/minecraft/server/level/ServerLevel.java --- a/src/main/java/net/minecraft/server/level/ServerLevel.java
+++ b/src/main/java/net/minecraft/server/level/ServerLevel.java +++ b/src/main/java/net/minecraft/server/level/ServerLevel.java
@@ -1768,6 +1768,11 @@ public class ServerLevel extends net.minecraft.world.level.Level implements Worl @@ -1764,6 +1764,11 @@ public class ServerLevel extends net.minecraft.world.level.Level implements Worl
}); });
optional1.ifPresent((villageplacetype) -> { optional1.ifPresent((villageplacetype) -> {
this.getServer().execute(() -> { this.getServer().execute(() -> {