|
|
|
@ -67,10 +67,10 @@ determined by the number of players on the server multiplied by the
|
|
|
|
|
whatever `global-max-concurrent-loads` is configured to.
|
|
|
|
|
|
|
|
|
|
diff --git a/src/main/java/co/aikar/timings/TimingsExport.java b/src/main/java/co/aikar/timings/TimingsExport.java
|
|
|
|
|
index e2f60115370f19e935eb3b14d5de99aa4126c6b0..f3bf9df8c0bd56cad461210ce8551ade3a220b6b 100644
|
|
|
|
|
index 78280fb3bcd8d792a58ece6d735e0824ea4be536..06bff37e4c1fddd3be6343049a66787c63fb420c 100644
|
|
|
|
|
--- a/src/main/java/co/aikar/timings/TimingsExport.java
|
|
|
|
|
+++ b/src/main/java/co/aikar/timings/TimingsExport.java
|
|
|
|
|
@@ -161,7 +161,11 @@ public class TimingsExport extends Thread {
|
|
|
|
|
@@ -162,7 +162,11 @@ public class TimingsExport extends Thread {
|
|
|
|
|
pair("gamerules", toObjectMapper(world.getWorld().getGameRules(), rule -> {
|
|
|
|
|
return pair(rule, world.getWorld().getGameRuleValue(rule));
|
|
|
|
|
})),
|
|
|
|
@ -83,57 +83,17 @@ index e2f60115370f19e935eb3b14d5de99aa4126c6b0..f3bf9df8c0bd56cad461210ce8551ade
|
|
|
|
|
));
|
|
|
|
|
}));
|
|
|
|
|
|
|
|
|
|
diff --git a/src/main/java/com/destroystokyo/paper/PaperConfig.java b/src/main/java/com/destroystokyo/paper/PaperConfig.java
|
|
|
|
|
index 318e28b5e93b6842d48745ec53bcc25dbfeaff72..66d360b2c4ae9e380ec6c452a263c04bd3aef4ff 100644
|
|
|
|
|
--- a/src/main/java/com/destroystokyo/paper/PaperConfig.java
|
|
|
|
|
+++ b/src/main/java/com/destroystokyo/paper/PaperConfig.java
|
|
|
|
|
@@ -652,4 +652,35 @@ public class PaperConfig {
|
|
|
|
|
private static void timeCommandAffectsAllWorlds() {
|
|
|
|
|
timeCommandAffectsAllWorlds = getBoolean("settings.time-command-affects-all-worlds", timeCommandAffectsAllWorlds);
|
|
|
|
|
}
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
|
|
+ public static int playerMinChunkLoadRadius;
|
|
|
|
|
+ public static boolean playerAutoConfigureSendViewDistance;
|
|
|
|
|
+ public static int playerMaxConcurrentChunkSends;
|
|
|
|
|
+ public static double playerTargetChunkSendRate;
|
|
|
|
|
+ public static double globalMaxChunkSendRate;
|
|
|
|
|
+ public static boolean playerFrustumPrioritisation;
|
|
|
|
|
+ public static double globalMaxChunkLoadRate;
|
|
|
|
|
+ public static double playerMaxConcurrentChunkLoads;
|
|
|
|
|
+ public static double globalMaxConcurrentChunkLoads;
|
|
|
|
|
+ public static double playerMaxChunkLoadRate;
|
|
|
|
|
+
|
|
|
|
|
+ private static void newPlayerChunkManagement() {
|
|
|
|
|
+ playerMinChunkLoadRadius = getInt("settings.chunk-loading.min-load-radius", 2);
|
|
|
|
|
+ playerMaxConcurrentChunkSends = getInt("settings.chunk-loading.max-concurrent-sends", 2);
|
|
|
|
|
+ playerAutoConfigureSendViewDistance = getBoolean("settings.chunk-loading.autoconfig-send-distance", true);
|
|
|
|
|
+ playerTargetChunkSendRate = getDouble("settings.chunk-loading.target-player-chunk-send-rate", 100.0);
|
|
|
|
|
+ globalMaxChunkSendRate = getDouble("settings.chunk-loading.global-max-chunk-send-rate", -1.0);
|
|
|
|
|
+ playerFrustumPrioritisation = getBoolean("settings.chunk-loading.enable-frustum-priority", false);
|
|
|
|
|
+ globalMaxChunkLoadRate = getDouble("settings.chunk-loading.global-max-chunk-load-rate", -1.0);
|
|
|
|
|
+ if (version < 23 && globalMaxChunkLoadRate == 300.0) {
|
|
|
|
|
+ set("settings.chunk-loading.global-max-chunk-load-rate", globalMaxChunkLoadRate = -1.0);
|
|
|
|
|
+ }
|
|
|
|
|
+ playerMaxConcurrentChunkLoads = getDouble("settings.chunk-loading.player-max-concurrent-loads", 20.0);
|
|
|
|
|
+ if (version < 25 && playerMaxConcurrentChunkLoads == 4.0) {
|
|
|
|
|
+ set("settings.chunk-loading.player-max-concurrent-loads", playerMaxConcurrentChunkLoads = 20.0);
|
|
|
|
|
+ }
|
|
|
|
|
+ globalMaxConcurrentChunkLoads = getDouble("settings.chunk-loading.global-max-concurrent-loads", 500.0);
|
|
|
|
|
+ playerMaxChunkLoadRate = getDouble("settings.chunk-loading.player-max-chunk-load-rate", -1.0);
|
|
|
|
|
+ }
|
|
|
|
|
}
|
|
|
|
|
diff --git a/src/main/java/io/papermc/paper/chunk/PlayerChunkLoader.java b/src/main/java/io/papermc/paper/chunk/PlayerChunkLoader.java
|
|
|
|
|
new file mode 100644
|
|
|
|
|
index 0000000000000000000000000000000000000000..12bcf96ec1ba4314c7ea2eab9f3d140559f1dc08
|
|
|
|
|
index 0000000000000000000000000000000000000000..b53402903eb6845df361daf6b05a668608ad7b63
|
|
|
|
|
--- /dev/null
|
|
|
|
|
+++ b/src/main/java/io/papermc/paper/chunk/PlayerChunkLoader.java
|
|
|
|
|
@@ -0,0 +1,1128 @@
|
|
|
|
|
+package io.papermc.paper.chunk;
|
|
|
|
|
+
|
|
|
|
|
+import com.destroystokyo.paper.PaperConfig;
|
|
|
|
|
+import com.destroystokyo.paper.util.misc.PlayerAreaMap;
|
|
|
|
|
+import com.destroystokyo.paper.util.misc.PooledLinkedHashSets;
|
|
|
|
|
+import io.papermc.paper.configuration.GlobalConfiguration;
|
|
|
|
|
+import io.papermc.paper.util.CoordinateUtils;
|
|
|
|
|
+import io.papermc.paper.util.IntervalledCounter;
|
|
|
|
|
+import io.papermc.paper.util.TickThread;
|
|
|
|
@ -508,21 +468,21 @@ index 0000000000000000000000000000000000000000..12bcf96ec1ba4314c7ea2eab9f3d1405
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ protected int getMaxConcurrentChunkSends() {
|
|
|
|
|
+ return PaperConfig.playerMaxConcurrentChunkSends;
|
|
|
|
|
+ return GlobalConfiguration.get().chunkLoading.maxConcurrentSends;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ protected int getMaxChunkLoads() {
|
|
|
|
|
+ double config = PaperConfig.playerMaxConcurrentChunkLoads;
|
|
|
|
|
+ double max = PaperConfig.globalMaxConcurrentChunkLoads;
|
|
|
|
|
+ double config = GlobalConfiguration.get().chunkLoading.playerMaxConcurrentLoads;
|
|
|
|
|
+ double max = GlobalConfiguration.get().chunkLoading.globalMaxConcurrentLoads;
|
|
|
|
|
+ return (int)Math.ceil(Math.min(config * MinecraftServer.getServer().getPlayerCount(), max <= 1.0 ? Double.MAX_VALUE : max));
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ protected long getTargetSendPerPlayerAddend() {
|
|
|
|
|
+ return PaperConfig.playerTargetChunkSendRate <= 1.0 ? 0L : (long)Math.round(1.0e9 / PaperConfig.playerTargetChunkSendRate);
|
|
|
|
|
+ return GlobalConfiguration.get().chunkLoading.targetPlayerChunkSendRate <= 1.0 ? 0L : (long)Math.round(1.0e9 / GlobalConfiguration.get().chunkLoading.targetPlayerChunkSendRate);
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ protected long getMaxSendAddend() {
|
|
|
|
|
+ return PaperConfig.globalMaxChunkSendRate <= 1.0 ? 0L : (long)Math.round(1.0e9 / PaperConfig.globalMaxChunkSendRate);
|
|
|
|
|
+ return GlobalConfiguration.get().chunkLoading.globalMaxChunkSendRate <= 1.0 ? 0L : (long)Math.round(1.0e9 / GlobalConfiguration.get().chunkLoading.globalMaxChunkSendRate);
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ public void onChunkPlayerTickReady(final int chunkX, final int chunkZ) {
|
|
|
|
@ -803,8 +763,8 @@ index 0000000000000000000000000000000000000000..12bcf96ec1ba4314c7ea2eab9f3d1405
|
|
|
|
|
+ // priority >= 0.0 implies rate limited chunks
|
|
|
|
|
+
|
|
|
|
|
+ final int currentChunkLoads = this.concurrentChunkLoads;
|
|
|
|
|
+ if (currentChunkLoads >= maxLoads || (PaperConfig.globalMaxChunkLoadRate > 0 && (TICKET_ADDITION_COUNTER_SHORT.getRate() >= PaperConfig.globalMaxChunkLoadRate || TICKET_ADDITION_COUNTER_LONG.getRate() >= PaperConfig.globalMaxChunkLoadRate))
|
|
|
|
|
+ || (PaperConfig.playerMaxChunkLoadRate > 0.0 && (data.ticketAdditionCounterShort.getRate() >= PaperConfig.playerMaxChunkLoadRate || data.ticketAdditionCounterLong.getRate() >= PaperConfig.playerMaxChunkLoadRate))) {
|
|
|
|
|
+ if (currentChunkLoads >= maxLoads || (GlobalConfiguration.get().chunkLoading.globalMaxChunkLoadRate > 0 && (TICKET_ADDITION_COUNTER_SHORT.getRate() >= GlobalConfiguration.get().chunkLoading.globalMaxChunkLoadRate || TICKET_ADDITION_COUNTER_LONG.getRate() >= GlobalConfiguration.get().chunkLoading.globalMaxChunkLoadRate))
|
|
|
|
|
+ || (GlobalConfiguration.get().chunkLoading.playerMaxChunkLoadRate > 0.0 && (data.ticketAdditionCounterShort.getRate() >= GlobalConfiguration.get().chunkLoading.playerMaxChunkLoadRate || data.ticketAdditionCounterLong.getRate() >= GlobalConfiguration.get().chunkLoading.playerMaxChunkLoadRate))) {
|
|
|
|
|
+ // don't poll, we didn't load it
|
|
|
|
|
+ this.chunkLoadQueue.add(data);
|
|
|
|
|
+ break;
|
|
|
|
@ -958,7 +918,7 @@ index 0000000000000000000000000000000000000000..12bcf96ec1ba4314c7ea2eab9f3d1405
|
|
|
|
|
+ final int tickViewDistance = this.tickViewDistance == -1 ? this.loader.getTickDistance() : this.tickViewDistance;
|
|
|
|
|
+ final int loadViewDistance = Math.max(tickViewDistance + 1, this.loadViewDistance == -1 ? this.loader.getLoadDistance() : this.loadViewDistance);
|
|
|
|
|
+ final int clientViewDistance = this.getClientViewDistance();
|
|
|
|
|
+ final int sendViewDistance = Math.min(loadViewDistance, this.sendViewDistance == -1 ? (!PaperConfig.playerAutoConfigureSendViewDistance || clientViewDistance == -1 ? this.loader.getSendDistance() : clientViewDistance + 1) : this.sendViewDistance);
|
|
|
|
|
+ final int sendViewDistance = Math.min(loadViewDistance, this.sendViewDistance == -1 ? (!GlobalConfiguration.get().chunkLoading.autoconfigSendDistance || clientViewDistance == -1 ? this.loader.getSendDistance() : clientViewDistance + 1) : this.sendViewDistance);
|
|
|
|
|
+ return sendViewDistance;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
@ -1075,14 +1035,14 @@ index 0000000000000000000000000000000000000000..12bcf96ec1ba4314c7ea2eab9f3d1405
|
|
|
|
|
+ final int loadViewDistance = Math.max(tickViewDistance + 1, this.loadViewDistance == -1 ? this.loader.getLoadDistance() : this.loadViewDistance);
|
|
|
|
|
+ // send view cannot be greater-than load view
|
|
|
|
|
+ final int clientViewDistance = this.getClientViewDistance();
|
|
|
|
|
+ final int sendViewDistance = Math.min(loadViewDistance, this.sendViewDistance == -1 ? (!PaperConfig.playerAutoConfigureSendViewDistance || clientViewDistance == -1 ? this.loader.getSendDistance() : clientViewDistance + 1) : this.sendViewDistance);
|
|
|
|
|
+ final int sendViewDistance = Math.min(loadViewDistance, this.sendViewDistance == -1 ? (!GlobalConfiguration.get().chunkLoading.autoconfigSendDistance || clientViewDistance == -1 ? this.loader.getSendDistance() : clientViewDistance + 1) : this.sendViewDistance);
|
|
|
|
|
+
|
|
|
|
|
+ final double posX = this.player.getX();
|
|
|
|
|
+ final double posZ = this.player.getZ();
|
|
|
|
|
+ final float yaw = MCUtil.normalizeYaw(this.player.yRot + 90.0f); // mc yaw 0 is along the positive z axis, but obviously this is really dumb - offset so we are at positive x-axis
|
|
|
|
|
+
|
|
|
|
|
+ // in general, we really only want to prioritise chunks in front if we know we're moving pretty fast into them.
|
|
|
|
|
+ final boolean useLookPriority = PaperConfig.playerFrustumPrioritisation && (this.player.getDeltaMovement().horizontalDistanceSqr() > LOOK_PRIORITY_SPEED_THRESHOLD ||
|
|
|
|
|
+ final boolean useLookPriority = GlobalConfiguration.get().chunkLoading.enableFrustumPriority && (this.player.getDeltaMovement().horizontalDistanceSqr() > LOOK_PRIORITY_SPEED_THRESHOLD ||
|
|
|
|
|
+ this.player.getAbilities().flying);
|
|
|
|
|
+
|
|
|
|
|
+ // make sure we're in the send queue
|
|
|
|
@ -1204,10 +1164,10 @@ index 0000000000000000000000000000000000000000..12bcf96ec1ba4314c7ea2eab9f3d1405
|
|
|
|
|
+
|
|
|
|
|
+ final double priority;
|
|
|
|
|
+
|
|
|
|
|
+ if (squareDistance <= PaperConfig.playerMinChunkLoadRadius) {
|
|
|
|
|
+ if (squareDistance <= GlobalConfiguration.get().chunkLoading.minLoadRadius) {
|
|
|
|
|
+ // priority should be negative, and we also want to order it from center outwards
|
|
|
|
|
+ // so we want (0,0) to be the smallest, and (minLoadedRadius,minLoadedRadius) to be the greatest
|
|
|
|
|
+ priority = -((2 * PaperConfig.playerMinChunkLoadRadius + 1) - manhattanDistance);
|
|
|
|
|
+ priority = -((2 * GlobalConfiguration.get().chunkLoading.minLoadRadius + 1) - manhattanDistance);
|
|
|
|
|
+ } else {
|
|
|
|
|
+ if (prioritised) {
|
|
|
|
|
+ // we don't prioritise these chunks above others because we also want to make sure some chunks
|
|
|
|
@ -1258,10 +1218,10 @@ index 0000000000000000000000000000000000000000..12bcf96ec1ba4314c7ea2eab9f3d1405
|
|
|
|
|
+ }
|
|
|
|
|
+}
|
|
|
|
|
diff --git a/src/main/java/net/minecraft/network/Connection.java b/src/main/java/net/minecraft/network/Connection.java
|
|
|
|
|
index 42400b6f0b693dd0ec4a2303a82bd131753a24ba..9bbf990212ee55a267d0eb1e863618c50fa706da 100644
|
|
|
|
|
index 0e5f05d091710da9078021eb6e1a26a22e2d63dd..c1e8d8674738eebaaf7bd918eacb5227a1331b67 100644
|
|
|
|
|
--- a/src/main/java/net/minecraft/network/Connection.java
|
|
|
|
|
+++ b/src/main/java/net/minecraft/network/Connection.java
|
|
|
|
|
@@ -105,6 +105,28 @@ public class Connection extends SimpleChannelInboundHandler<Packet<?>> {
|
|
|
|
|
@@ -104,6 +104,28 @@ public class Connection extends SimpleChannelInboundHandler<Packet<?>> {
|
|
|
|
|
public boolean queueImmunity = false;
|
|
|
|
|
public ConnectionProtocol protocol;
|
|
|
|
|
// Paper end
|
|
|
|
@ -1290,7 +1250,7 @@ index 42400b6f0b693dd0ec4a2303a82bd131753a24ba..9bbf990212ee55a267d0eb1e863618c5
|
|
|
|
|
|
|
|
|
|
// Paper start - allow controlled flushing
|
|
|
|
|
volatile boolean canFlush = true;
|
|
|
|
|
@@ -478,6 +500,7 @@ public class Connection extends SimpleChannelInboundHandler<Packet<?>> {
|
|
|
|
|
@@ -479,6 +501,7 @@ public class Connection extends SimpleChannelInboundHandler<Packet<?>> {
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
private boolean processQueue() {
|
|
|
|
@ -1298,7 +1258,7 @@ index 42400b6f0b693dd0ec4a2303a82bd131753a24ba..9bbf990212ee55a267d0eb1e863618c5
|
|
|
|
|
if (this.queue.isEmpty()) return true;
|
|
|
|
|
// Paper start - make only one flush call per sendPacketQueue() call
|
|
|
|
|
final boolean needsFlush = this.canFlush;
|
|
|
|
|
@@ -509,6 +532,12 @@ public class Connection extends SimpleChannelInboundHandler<Packet<?>> {
|
|
|
|
|
@@ -510,6 +533,12 @@ public class Connection extends SimpleChannelInboundHandler<Packet<?>> {
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
return true;
|
|
|
|
@ -1312,7 +1272,7 @@ index 42400b6f0b693dd0ec4a2303a82bd131753a24ba..9bbf990212ee55a267d0eb1e863618c5
|
|
|
|
|
// Paper end
|
|
|
|
|
|
|
|
|
|
diff --git a/src/main/java/net/minecraft/server/MCUtil.java b/src/main/java/net/minecraft/server/MCUtil.java
|
|
|
|
|
index 63294b95ec062e32c87e52560353374db430cbe5..6aec679e75aa6655b47a552db011924ea3a6c922 100644
|
|
|
|
|
index 48ec2f7a3813f8ce2baf32667a09f377e2764710..33ccab88b93f93993b6e17d5e0a2539b08235f78 100644
|
|
|
|
|
--- a/src/main/java/net/minecraft/server/MCUtil.java
|
|
|
|
|
+++ b/src/main/java/net/minecraft/server/MCUtil.java
|
|
|
|
|
@@ -647,7 +647,8 @@ public final class MCUtil {
|
|
|
|
@ -1323,10 +1283,10 @@ index 63294b95ec062e32c87e52560353374db430cbe5..6aec679e75aa6655b47a552db011924e
|
|
|
|
|
+ worldData.addProperty("view-distance", world.getChunkSource().chunkMap.playerChunkManager.getTargetNoTickViewDistance()); // Paper - replace chunk loader system
|
|
|
|
|
+ worldData.addProperty("tick-view-distance", world.getChunkSource().chunkMap.playerChunkManager.getTargetTickViewDistance()); // Paper - replace chunk loader system
|
|
|
|
|
worldData.addProperty("keep-spawn-loaded", world.keepSpawnInMemory);
|
|
|
|
|
worldData.addProperty("keep-spawn-loaded-range", world.paperConfig.keepLoadedRange);
|
|
|
|
|
worldData.addProperty("keep-spawn-loaded-range", world.paperConfig().spawn.keepSpawnLoadedRange);
|
|
|
|
|
worldData.addProperty("visible-chunk-count", visibleChunks.size());
|
|
|
|
|
diff --git a/src/main/java/net/minecraft/server/level/ChunkHolder.java b/src/main/java/net/minecraft/server/level/ChunkHolder.java
|
|
|
|
|
index d061dc4b5de6b629d6ddcdbfe9ca652dfcec8952..2ebaff03052d800d3dad05bbf67729b02bd3262a 100644
|
|
|
|
|
index 5482be03a667939ff009b6810d5cc90c8601e983..11cd31691307749e925930c4b6e10e3f3b4fad25 100644
|
|
|
|
|
--- a/src/main/java/net/minecraft/server/level/ChunkHolder.java
|
|
|
|
|
+++ b/src/main/java/net/minecraft/server/level/ChunkHolder.java
|
|
|
|
|
@@ -76,6 +76,17 @@ public class ChunkHolder {
|
|
|
|
@ -1356,21 +1316,27 @@ index d061dc4b5de6b629d6ddcdbfe9ca652dfcec8952..2ebaff03052d800d3dad05bbf67729b0
|
|
|
|
|
|
|
|
|
|
if (chunk != null) {
|
|
|
|
|
int i = this.levelHeightAccessor.getSectionIndex(pos.getY());
|
|
|
|
|
@@ -284,11 +295,11 @@ public class ChunkHolder {
|
|
|
|
|
@@ -284,14 +295,15 @@ public class ChunkHolder {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public void sectionLightChanged(LightLayer lightType, int y) {
|
|
|
|
|
- LevelChunk chunk = this.getFullChunk();
|
|
|
|
|
+ ChunkAccess chunk = this.getAvailableChunkNow(); // Paper - no-tick view distance
|
|
|
|
|
- Either<ChunkAccess, ChunkHolder.ChunkLoadingFailure> either = (Either) this.getFutureIfPresent(ChunkStatus.FEATURES).getNow(null); // CraftBukkit - decompile error
|
|
|
|
|
+ // Paper start - no-tick view distance
|
|
|
|
|
|
|
|
|
|
if (chunk != null) {
|
|
|
|
|
chunk.setUnsaved(true);
|
|
|
|
|
- LevelChunk chunk1 = this.getTickingChunk();
|
|
|
|
|
+ LevelChunk chunk1 = this.getSendingChunk(); // Paper - no-tick view distance
|
|
|
|
|
- if (either != null) {
|
|
|
|
|
- ChunkAccess ichunkaccess = (ChunkAccess) either.left().orElse(null); // CraftBukkit - decompile error
|
|
|
|
|
+ if (true) {
|
|
|
|
|
+ ChunkAccess ichunkaccess = this.getAvailableChunkNow();
|
|
|
|
|
|
|
|
|
|
if (chunk1 != null) {
|
|
|
|
|
int j = this.lightEngine.getMinLightSection();
|
|
|
|
|
@@ -390,9 +401,28 @@ public class ChunkHolder {
|
|
|
|
|
if (ichunkaccess != null) {
|
|
|
|
|
ichunkaccess.setUnsaved(true);
|
|
|
|
|
- LevelChunk chunk = this.getTickingChunk();
|
|
|
|
|
+ LevelChunk chunk = this.getSendingChunk();
|
|
|
|
|
+ // Paper end - no-tick view distance
|
|
|
|
|
|
|
|
|
|
if (chunk != null) {
|
|
|
|
|
int j = this.lightEngine.getMinLightSection();
|
|
|
|
|
@@ -394,9 +406,28 @@ public class ChunkHolder {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public void broadcast(Packet<?> packet, boolean onlyOnWatchDistanceEdge) {
|
|
|
|
@ -1403,10 +1369,10 @@ index d061dc4b5de6b629d6ddcdbfe9ca652dfcec8952..2ebaff03052d800d3dad05bbf67729b0
|
|
|
|
|
|
|
|
|
|
public CompletableFuture<Either<ChunkAccess, ChunkHolder.ChunkLoadingFailure>> getOrScheduleFuture(ChunkStatus targetStatus, ChunkMap chunkStorage) {
|
|
|
|
|
diff --git a/src/main/java/net/minecraft/server/level/ChunkMap.java b/src/main/java/net/minecraft/server/level/ChunkMap.java
|
|
|
|
|
index 0e6bc8f7b31581fe0e7adb13119b30295aeac48d..6ce27675103d4b691216c6b701b6ceb821af528f 100644
|
|
|
|
|
index e25423b46ced54dd6b270d45a3c4502a01b2e227..a78cc85ba2acca982097317d56e7074c6042effd 100644
|
|
|
|
|
--- a/src/main/java/net/minecraft/server/level/ChunkMap.java
|
|
|
|
|
+++ b/src/main/java/net/minecraft/server/level/ChunkMap.java
|
|
|
|
|
@@ -217,6 +217,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
|
|
|
|
|
@@ -220,6 +220,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
|
|
|
|
|
public final com.destroystokyo.paper.util.misc.PlayerAreaMap playerMobSpawnMap; // this map is absent from updateMaps since it's controlled at the start of the chunkproviderserver tick
|
|
|
|
|
public final com.destroystokyo.paper.util.misc.PlayerAreaMap playerChunkTickRangeMap;
|
|
|
|
|
// Paper end - optimise ChunkMap#anyPlayerCloseEnoughForSpawning
|
|
|
|
@ -1414,7 +1380,7 @@ index 0e6bc8f7b31581fe0e7adb13119b30295aeac48d..6ce27675103d4b691216c6b701b6ceb8
|
|
|
|
|
// Paper start - use distance map to optimise tracker
|
|
|
|
|
public static boolean isLegacyTrackingEntity(Entity entity) {
|
|
|
|
|
return entity.isLegacyTrackingEntity;
|
|
|
|
|
@@ -236,6 +237,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
|
|
|
|
|
@@ -239,6 +240,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
|
|
|
|
|
// Paper end - use distance map to optimise tracker
|
|
|
|
|
|
|
|
|
|
void addPlayerToDistanceMaps(ServerPlayer player) {
|
|
|
|
@ -1422,7 +1388,7 @@ index 0e6bc8f7b31581fe0e7adb13119b30295aeac48d..6ce27675103d4b691216c6b701b6ceb8
|
|
|
|
|
int chunkX = MCUtil.getChunkCoordinate(player.getX());
|
|
|
|
|
int chunkZ = MCUtil.getChunkCoordinate(player.getZ());
|
|
|
|
|
// Paper start - use distance map to optimise entity tracker
|
|
|
|
|
@@ -243,7 +245,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
|
|
|
|
|
@@ -246,7 +248,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
|
|
|
|
|
com.destroystokyo.paper.util.misc.PlayerAreaMap trackMap = this.playerEntityTrackerTrackMaps[i];
|
|
|
|
|
int trackRange = this.entityTrackerTrackRanges[i];
|
|
|
|
|
|
|
|
|
@ -1431,7 +1397,7 @@ index 0e6bc8f7b31581fe0e7adb13119b30295aeac48d..6ce27675103d4b691216c6b701b6ceb8
|
|
|
|
|
}
|
|
|
|
|
// Paper end - use distance map to optimise entity tracker
|
|
|
|
|
// Note: players need to be explicitly added to distance maps before they can be updated
|
|
|
|
|
@@ -273,6 +275,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
|
|
|
|
|
@@ -276,6 +278,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
|
|
|
|
|
this.playerMobDistanceMap.remove(player);
|
|
|
|
|
}
|
|
|
|
|
// Paper end - per player mob spawning
|
|
|
|
@ -1439,7 +1405,7 @@ index 0e6bc8f7b31581fe0e7adb13119b30295aeac48d..6ce27675103d4b691216c6b701b6ceb8
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void updateMaps(ServerPlayer player) {
|
|
|
|
|
@@ -284,7 +287,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
|
|
|
|
|
@@ -287,7 +290,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
|
|
|
|
|
com.destroystokyo.paper.util.misc.PlayerAreaMap trackMap = this.playerEntityTrackerTrackMaps[i];
|
|
|
|
|
int trackRange = this.entityTrackerTrackRanges[i];
|
|
|
|
|
|
|
|
|
@ -1448,7 +1414,7 @@ index 0e6bc8f7b31581fe0e7adb13119b30295aeac48d..6ce27675103d4b691216c6b701b6ceb8
|
|
|
|
|
}
|
|
|
|
|
// Paper end - use distance map to optimise entity tracker
|
|
|
|
|
this.playerChunkTickRangeMap.update(player, chunkX, chunkZ, DistanceManager.MOB_SPAWN_RANGE); // Paper - optimise ChunkMap#anyPlayerCloseEnoughForSpawning
|
|
|
|
|
@@ -294,6 +297,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
|
|
|
|
|
@@ -297,6 +300,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
|
|
|
|
|
this.playerMobDistanceMap.update(player, chunkX, chunkZ, this.distanceManager.getSimulationDistance());
|
|
|
|
|
}
|
|
|
|
|
// Paper end - per player mob spawning
|
|
|
|
@ -1456,7 +1422,7 @@ index 0e6bc8f7b31581fe0e7adb13119b30295aeac48d..6ce27675103d4b691216c6b701b6ceb8
|
|
|
|
|
}
|
|
|
|
|
// Paper end
|
|
|
|
|
// Paper start
|
|
|
|
|
@@ -1421,11 +1425,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
|
|
|
|
|
@@ -1446,11 +1450,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
|
|
|
|
|
completablefuture1.thenAcceptAsync((either) -> {
|
|
|
|
|
either.ifLeft((chunk) -> {
|
|
|
|
|
this.tickingGenerated.getAndIncrement();
|
|
|
|
@ -1469,7 +1435,7 @@ index 0e6bc8f7b31581fe0e7adb13119b30295aeac48d..6ce27675103d4b691216c6b701b6ceb8
|
|
|
|
|
});
|
|
|
|
|
}, (runnable) -> {
|
|
|
|
|
this.mainThreadMailbox.tell(ChunkTaskPriorityQueueSorter.message(holder, runnable));
|
|
|
|
|
@@ -1594,33 +1594,24 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
|
|
|
|
|
@@ -1619,33 +1619,24 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
|
|
|
|
|
int k = this.viewDistance;
|
|
|
|
|
|
|
|
|
|
this.viewDistance = j;
|
|
|
|
@ -1512,7 +1478,7 @@ index 0e6bc8f7b31581fe0e7adb13119b30295aeac48d..6ce27675103d4b691216c6b701b6ceb8
|
|
|
|
|
|
|
|
|
|
if (chunk != null) {
|
|
|
|
|
this.playerLoadedChunk(player, packet, chunk);
|
|
|
|
|
@@ -1651,7 +1642,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
|
|
|
|
|
@@ -1676,7 +1667,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
|
|
|
|
|
|
|
|
|
|
void dumpChunks(Writer writer) throws IOException {
|
|
|
|
|
CsvOutput csvwriter = CsvOutput.builder().addColumn("x").addColumn("z").addColumn("level").addColumn("in_memory").addColumn("status").addColumn("full_status").addColumn("accessible_ready").addColumn("ticking_ready").addColumn("entity_ticking_ready").addColumn("ticket").addColumn("spawning").addColumn("block_entity_count").addColumn("ticking_ticket").addColumn("ticking_level").addColumn("block_ticks").addColumn("fluid_ticks").build(writer);
|
|
|
|
@ -1521,7 +1487,7 @@ index 0e6bc8f7b31581fe0e7adb13119b30295aeac48d..6ce27675103d4b691216c6b701b6ceb8
|
|
|
|
|
ObjectBidirectionalIterator objectbidirectionaliterator = this.updatingChunks.getVisibleMap().clone().long2ObjectEntrySet().fastIterator(); // Paper
|
|
|
|
|
|
|
|
|
|
while (objectbidirectionaliterator.hasNext()) {
|
|
|
|
|
@@ -1667,7 +1658,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
|
|
|
|
|
@@ -1692,7 +1683,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
|
|
|
|
|
// CraftBukkit - decompile error
|
|
|
|
|
csvwriter.writeRow(chunkcoordintpair.x, chunkcoordintpair.z, playerchunk.getTicketLevel(), optional.isPresent(), optional.map(ChunkAccess::getStatus).orElse(null), optional1.map(LevelChunk::getFullStatus).orElse(null), ChunkMap.printFuture(playerchunk.getFullChunkFuture()), ChunkMap.printFuture(playerchunk.getTickingChunkFuture()), ChunkMap.printFuture(playerchunk.getEntityTickingChunkFuture()), this.distanceManager.getTicketDebugString(i), this.anyPlayerCloseEnoughForSpawning(chunkcoordintpair), optional1.map((chunk) -> {
|
|
|
|
|
return chunk.getBlockEntities().size();
|
|
|
|
@ -1530,7 +1496,7 @@ index 0e6bc8f7b31581fe0e7adb13119b30295aeac48d..6ce27675103d4b691216c6b701b6ceb8
|
|
|
|
|
return chunk.getBlockTicks().count();
|
|
|
|
|
}).orElse(0), optional1.map((chunk) -> {
|
|
|
|
|
return chunk.getFluidTicks().count();
|
|
|
|
|
@@ -1884,15 +1875,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
|
|
|
|
|
@@ -1926,15 +1917,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
|
|
|
|
|
this.removePlayerFromDistanceMaps(player); // Paper - distance maps
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -1547,8 +1513,8 @@ index 0e6bc8f7b31581fe0e7adb13119b30295aeac48d..6ce27675103d4b691216c6b701b6ceb8
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@@ -1900,7 +1883,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
|
|
|
|
|
SectionPos sectionposition = SectionPos.of((Entity) player);
|
|
|
|
|
@@ -1942,7 +1925,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
|
|
|
|
|
SectionPos sectionposition = SectionPos.of((EntityAccess) player);
|
|
|
|
|
|
|
|
|
|
player.setLastSectionPos(sectionposition);
|
|
|
|
|
- player.connection.send(new ClientboundSetChunkCacheCenterPacket(sectionposition.x(), sectionposition.z()));
|
|
|
|
@ -1556,7 +1522,7 @@ index 0e6bc8f7b31581fe0e7adb13119b30295aeac48d..6ce27675103d4b691216c6b701b6ceb8
|
|
|
|
|
return sectionposition;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@@ -1945,65 +1928,40 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
|
|
|
|
|
@@ -1987,65 +1970,40 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
|
|
|
|
|
int k1;
|
|
|
|
|
int l1;
|
|
|
|
|
|
|
|
|
@ -1644,7 +1610,7 @@ index 0e6bc8f7b31581fe0e7adb13119b30295aeac48d..6ce27675103d4b691216c6b701b6ceb8
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public void addEntity(Entity entity) {
|
|
|
|
|
@@ -2372,7 +2330,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
|
|
|
|
|
@@ -2414,7 +2372,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
|
|
|
|
|
double vec3d_dx = player.getX() - this.entity.getX();
|
|
|
|
|
double vec3d_dz = player.getZ() - this.entity.getZ();
|
|
|
|
|
// Paper end - remove allocation of Vec3D here
|
|
|
|
@ -1654,12 +1620,12 @@ index 0e6bc8f7b31581fe0e7adb13119b30295aeac48d..6ce27675103d4b691216c6b701b6ceb8
|
|
|
|
|
double d2 = d0 * d0;
|
|
|
|
|
boolean flag = d1 <= d2 && this.entity.broadcastToPlayer(player);
|
|
|
|
|
diff --git a/src/main/java/net/minecraft/server/level/DistanceManager.java b/src/main/java/net/minecraft/server/level/DistanceManager.java
|
|
|
|
|
index b22c771ca35466574d5a73f2da3fc8762cb29487..3542b8b347b9a142c53f300251a05a11e421c36f 100644
|
|
|
|
|
index f581a9f79b2357118d912a15344ff94df3b0c50e..d1b5c25b7455174e908cd6ed66789fa700190604 100644
|
|
|
|
|
--- a/src/main/java/net/minecraft/server/level/DistanceManager.java
|
|
|
|
|
+++ b/src/main/java/net/minecraft/server/level/DistanceManager.java
|
|
|
|
|
@@ -50,8 +50,8 @@ public abstract class DistanceManager {
|
|
|
|
|
@@ -51,8 +51,8 @@ public abstract class DistanceManager {
|
|
|
|
|
public final Long2ObjectOpenHashMap<SortedArraySet<Ticket<?>>> tickets = new Long2ObjectOpenHashMap();
|
|
|
|
|
private final DistanceManager.ChunkTicketTracker ticketTracker = new DistanceManager.ChunkTicketTracker();
|
|
|
|
|
//private final DistanceManager.ChunkTicketTracker ticketTracker = new DistanceManager.ChunkTicketTracker(); // Paper - replace ticket level propagator
|
|
|
|
|
public static final int MOB_SPAWN_RANGE = 8; // private final ChunkMapDistance.b f = new ChunkMapDistance.b(8); // Paper - no longer used
|
|
|
|
|
- private final TickingTracker tickingTicketsTracker = new TickingTracker();
|
|
|
|
|
- private final DistanceManager.PlayerTicketTracker playerTicketManager = new DistanceManager.PlayerTicketTracker(33);
|
|
|
|
@ -1668,7 +1634,7 @@ index b22c771ca35466574d5a73f2da3fc8762cb29487..3542b8b347b9a142c53f300251a05a11
|
|
|
|
|
// Paper start use a queue, but still keep unique requirement
|
|
|
|
|
public final java.util.Queue<ChunkHolder> pendingChunkUpdates = new java.util.ArrayDeque<ChunkHolder>() {
|
|
|
|
|
@Override
|
|
|
|
|
@@ -92,7 +92,7 @@ public abstract class DistanceManager {
|
|
|
|
|
@@ -133,7 +133,7 @@ public abstract class DistanceManager {
|
|
|
|
|
java.util.function.Predicate<Ticket<?>> removeIf = (ticket) -> {
|
|
|
|
|
final boolean ret = ticket.timedOut(ticketCounter);
|
|
|
|
|
if (ret) {
|
|
|
|
@ -1677,7 +1643,7 @@ index b22c771ca35466574d5a73f2da3fc8762cb29487..3542b8b347b9a142c53f300251a05a11
|
|
|
|
|
}
|
|
|
|
|
return ret;
|
|
|
|
|
};
|
|
|
|
|
@@ -112,7 +112,7 @@ public abstract class DistanceManager {
|
|
|
|
|
@@ -153,7 +153,7 @@ public abstract class DistanceManager {
|
|
|
|
|
if (ticket.timedOut(this.ticketTickCounter)) {
|
|
|
|
|
iterator.remove();
|
|
|
|
|
flag = true;
|
|
|
|
@ -1686,19 +1652,19 @@ index b22c771ca35466574d5a73f2da3fc8762cb29487..3542b8b347b9a142c53f300251a05a11
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@@ -142,9 +142,9 @@ public abstract class DistanceManager {
|
|
|
|
|
|
|
|
|
|
@@ -184,9 +184,9 @@ public abstract class DistanceManager {
|
|
|
|
|
protected long ticketLevelUpdateCount; // Paper - replace ticket level propagator
|
|
|
|
|
public boolean runAllUpdates(ChunkMap chunkStorage) {
|
|
|
|
|
//this.f.a(); // Paper - no longer used
|
|
|
|
|
- this.tickingTicketsTracker.runAllUpdates();
|
|
|
|
|
+ //this.tickingTicketsTracker.runAllUpdates(); // Paper - no longer used
|
|
|
|
|
org.spigotmc.AsyncCatcher.catchOp("DistanceManagerTick"); // Paper
|
|
|
|
|
- this.playerTicketManager.runAllUpdates();
|
|
|
|
|
+ //this.playerTicketManager.runAllUpdates(); // Paper - no longer used
|
|
|
|
|
int i = Integer.MAX_VALUE - this.ticketTracker.runDistanceUpdates(Integer.MAX_VALUE);
|
|
|
|
|
boolean flag = i != 0;
|
|
|
|
|
+ // this.playerTicketManager.runAllUpdates(); // Paper - no longer used
|
|
|
|
|
boolean flag = this.ticketLevelPropagator.propagateUpdates(); // Paper - replace ticket level propagator
|
|
|
|
|
|
|
|
|
|
@@ -277,7 +277,7 @@ public abstract class DistanceManager {
|
|
|
|
|
if (flag) {
|
|
|
|
|
@@ -351,7 +351,7 @@ public abstract class DistanceManager {
|
|
|
|
|
long j = chunkcoordintpair.toLong();
|
|
|
|
|
|
|
|
|
|
boolean added = this.addTicket(j, ticket); // CraftBukkit
|
|
|
|
@ -1707,7 +1673,7 @@ index b22c771ca35466574d5a73f2da3fc8762cb29487..3542b8b347b9a142c53f300251a05a11
|
|
|
|
|
return added; // CraftBukkit
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@@ -292,7 +292,7 @@ public abstract class DistanceManager {
|
|
|
|
|
@@ -366,7 +366,7 @@ public abstract class DistanceManager {
|
|
|
|
|
long j = chunkcoordintpair.toLong();
|
|
|
|
|
|
|
|
|
|
boolean removed = this.removeTicket(j, ticket); // CraftBukkit
|
|
|
|
@ -1716,7 +1682,7 @@ index b22c771ca35466574d5a73f2da3fc8762cb29487..3542b8b347b9a142c53f300251a05a11
|
|
|
|
|
return removed; // CraftBukkit
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@@ -414,10 +414,10 @@ public abstract class DistanceManager {
|
|
|
|
|
@@ -488,10 +488,10 @@ public abstract class DistanceManager {
|
|
|
|
|
|
|
|
|
|
if (forced) {
|
|
|
|
|
this.addTicket(i, ticket);
|
|
|
|
@ -1729,7 +1695,7 @@ index b22c771ca35466574d5a73f2da3fc8762cb29487..3542b8b347b9a142c53f300251a05a11
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
@@ -430,8 +430,8 @@ public abstract class DistanceManager {
|
|
|
|
|
@@ -504,8 +504,8 @@ public abstract class DistanceManager {
|
|
|
|
|
return new ObjectOpenHashSet();
|
|
|
|
|
})).add(player);
|
|
|
|
|
//this.f.update(i, 0, true); // Paper - no longer used
|
|
|
|
@ -1740,7 +1706,7 @@ index b22c771ca35466574d5a73f2da3fc8762cb29487..3542b8b347b9a142c53f300251a05a11
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public void removePlayer(SectionPos pos, ServerPlayer player) {
|
|
|
|
|
@@ -444,8 +444,8 @@ public abstract class DistanceManager {
|
|
|
|
|
@@ -518,8 +518,8 @@ public abstract class DistanceManager {
|
|
|
|
|
if (objectset == null || objectset.isEmpty()) { // Paper
|
|
|
|
|
this.playersPerChunk.remove(i);
|
|
|
|
|
//this.f.update(i, Integer.MAX_VALUE, false); // Paper - no longer used
|
|
|
|
@ -1751,7 +1717,7 @@ index b22c771ca35466574d5a73f2da3fc8762cb29487..3542b8b347b9a142c53f300251a05a11
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
@@ -455,11 +455,17 @@ public abstract class DistanceManager {
|
|
|
|
|
@@ -529,11 +529,17 @@ public abstract class DistanceManager {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public boolean inEntityTickingRange(long chunkPos) {
|
|
|
|
@ -1771,7 +1737,7 @@ index b22c771ca35466574d5a73f2da3fc8762cb29487..3542b8b347b9a142c53f300251a05a11
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
protected String getTicketDebugString(long pos) {
|
|
|
|
|
@@ -469,20 +475,16 @@ public abstract class DistanceManager {
|
|
|
|
|
@@ -543,20 +549,16 @@ public abstract class DistanceManager {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
protected void updatePlayerTickets(int viewDistance) {
|
|
|
|
@ -1795,7 +1761,7 @@ index b22c771ca35466574d5a73f2da3fc8762cb29487..3542b8b347b9a142c53f300251a05a11
|
|
|
|
|
}
|
|
|
|
|
// Paper end
|
|
|
|
|
|
|
|
|
|
@@ -539,10 +541,7 @@ public abstract class DistanceManager {
|
|
|
|
|
@@ -613,10 +615,7 @@ public abstract class DistanceManager {
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -1807,7 +1773,7 @@ index b22c771ca35466574d5a73f2da3fc8762cb29487..3542b8b347b9a142c53f300251a05a11
|
|
|
|
|
|
|
|
|
|
public void removeTicketsOnClosing() {
|
|
|
|
|
ImmutableSet<TicketType<?>> immutableset = ImmutableSet.of(TicketType.UNKNOWN, TicketType.POST_TELEPORT, TicketType.LIGHT, TicketType.FUTURE_AWAIT, TicketType.ASYNC_LOAD, TicketType.REQUIRED_LOAD, TicketType.CHUNK_RELIGHT, ca.spottedleaf.starlight.common.light.StarLightInterface.CHUNK_WORK_TICKET); // Paper - add additional tickets to preserve
|
|
|
|
|
@@ -559,12 +558,13 @@ public abstract class DistanceManager {
|
|
|
|
|
@@ -633,7 +632,7 @@ public abstract class DistanceManager {
|
|
|
|
|
if (!immutableset.contains(ticket.getType())) {
|
|
|
|
|
iterator.remove();
|
|
|
|
|
flag = true;
|
|
|
|
@ -1816,14 +1782,7 @@ index b22c771ca35466574d5a73f2da3fc8762cb29487..3542b8b347b9a142c53f300251a05a11
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (flag) {
|
|
|
|
|
- this.ticketTracker.update(entry.getLongKey(), DistanceManager.getTicketLevelAt((SortedArraySet) entry.getValue()), false);
|
|
|
|
|
+ this.updateTicketLevel(entry.getLongKey(), getTicketLevelAt(entry.getValue())); // Paper - replace ticket level propagator
|
|
|
|
|
+ // this.ticketTracker.update(entry.getLongKey(), DistanceManager.getTicketLevelAt((SortedArraySet) entry.getValue()), false); // Paper - no longer used
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (((SortedArraySet) entry.getValue()).isEmpty()) {
|
|
|
|
|
@@ -598,6 +598,7 @@ public abstract class DistanceManager {
|
|
|
|
|
@@ -672,6 +671,7 @@ public abstract class DistanceManager {
|
|
|
|
|
}
|
|
|
|
|
// CraftBukkit end
|
|
|
|
|
|
|
|
|
@ -1831,17 +1790,17 @@ index b22c771ca35466574d5a73f2da3fc8762cb29487..3542b8b347b9a142c53f300251a05a11
|
|
|
|
|
private class ChunkTicketTracker extends ChunkTracker {
|
|
|
|
|
|
|
|
|
|
public ChunkTicketTracker() {
|
|
|
|
|
@@ -816,4 +817,5 @@ public abstract class DistanceManager {
|
|
|
|
|
@@ -890,4 +890,5 @@ public abstract class DistanceManager {
|
|
|
|
|
return distance <= this.viewDistance - 2;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
+ */ // Paper - replace old loader system
|
|
|
|
|
}
|
|
|
|
|
diff --git a/src/main/java/net/minecraft/server/level/ServerChunkCache.java b/src/main/java/net/minecraft/server/level/ServerChunkCache.java
|
|
|
|
|
index 78538e3d3468f5c682cf4123ac930796c20af60c..fb0757d4bb32123641535a88a22bc074b8d2623f 100644
|
|
|
|
|
index 96a232f22b1c270b91635ce9c7c6cacc63b026cc..59acbf6249f8f5285504c0ddea448a3433d1d68d 100644
|
|
|
|
|
--- a/src/main/java/net/minecraft/server/level/ServerChunkCache.java
|
|
|
|
|
+++ b/src/main/java/net/minecraft/server/level/ServerChunkCache.java
|
|
|
|
|
@@ -843,17 +843,10 @@ public class ServerChunkCache extends ChunkSource {
|
|
|
|
|
@@ -844,17 +844,10 @@ public class ServerChunkCache extends ChunkSource {
|
|
|
|
|
// Paper end
|
|
|
|
|
|
|
|
|
|
public boolean isPositionTicking(long pos) {
|
|
|
|
@ -1863,7 +1822,7 @@ index 78538e3d3468f5c682cf4123ac930796c20af60c..fb0757d4bb32123641535a88a22bc074
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public void save(boolean flush) {
|
|
|
|
|
@@ -910,6 +903,7 @@ public class ServerChunkCache extends ChunkSource {
|
|
|
|
|
@@ -911,6 +904,7 @@ public class ServerChunkCache extends ChunkSource {
|
|
|
|
|
this.level.getProfiler().popPush("chunks");
|
|
|
|
|
if (tickChunks) {
|
|
|
|
|
this.level.timings.chunks.startTiming(); // Paper - timings
|
|
|
|
@ -1871,7 +1830,7 @@ index 78538e3d3468f5c682cf4123ac930796c20af60c..fb0757d4bb32123641535a88a22bc074
|
|
|
|
|
this.tickChunks();
|
|
|
|
|
this.level.timings.chunks.stopTiming(); // Paper - timings
|
|
|
|
|
}
|
|
|
|
|
@@ -1023,13 +1017,13 @@ public class ServerChunkCache extends ChunkSource {
|
|
|
|
|
@@ -1024,13 +1018,13 @@ public class ServerChunkCache extends ChunkSource {
|
|
|
|
|
// Paper end - optimise chunk tick iteration
|
|
|
|
|
ChunkPos chunkcoordintpair = chunk1.getPos();
|
|
|
|
|
|
|
|
|
@ -1887,7 +1846,7 @@ index 78538e3d3468f5c682cf4123ac930796c20af60c..fb0757d4bb32123641535a88a22bc074
|
|
|
|
|
this.level.tickChunk(chunk1, k);
|
|
|
|
|
if ((chunksTicked++ & 1) == 0) net.minecraft.server.MinecraftServer.getServer().executeMidTickTasks(); // Paper
|
|
|
|
|
}
|
|
|
|
|
@@ -1254,6 +1248,7 @@ public class ServerChunkCache extends ChunkSource {
|
|
|
|
|
@@ -1259,6 +1253,7 @@ public class ServerChunkCache extends ChunkSource {
|
|
|
|
|
public boolean pollTask() {
|
|
|
|
|
try {
|
|
|
|
|
boolean execChunkTask = com.destroystokyo.paper.io.chunk.ChunkTaskManager.pollChunkWaitQueue() || ServerChunkCache.this.level.asyncChunkTaskManager.pollNextChunkTask(); // Paper
|
|
|
|
@ -1896,10 +1855,10 @@ index 78538e3d3468f5c682cf4123ac930796c20af60c..fb0757d4bb32123641535a88a22bc074
|
|
|
|
|
return true;
|
|
|
|
|
} else {
|
|
|
|
|
diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java
|
|
|
|
|
index 4c9832ccede082a468e97870b5f6b07bbed652f3..344c5bafe291a2542c4940e4d80232644de7b877 100644
|
|
|
|
|
index 52a86efcfc82621e1783bfb8dc42ae995f0755ad..4210d4b3c9d6f8bb3501b3592a6c1317c45ff3cd 100644
|
|
|
|
|
--- a/src/main/java/net/minecraft/server/level/ServerLevel.java
|
|
|
|
|
+++ b/src/main/java/net/minecraft/server/level/ServerLevel.java
|
|
|
|
|
@@ -658,7 +658,7 @@ public class ServerLevel extends Level implements WorldGenLevel {
|
|
|
|
|
@@ -673,7 +673,7 @@ public class ServerLevel extends Level implements WorldGenLevel {
|
|
|
|
|
gameprofilerfiller.push("checkDespawn");
|
|
|
|
|
entity.checkDespawn();
|
|
|
|
|
gameprofilerfiller.pop();
|
|
|
|
@ -1908,7 +1867,7 @@ index 4c9832ccede082a468e97870b5f6b07bbed652f3..344c5bafe291a2542c4940e4d8023264
|
|
|
|
|
Entity entity1 = entity.getVehicle();
|
|
|
|
|
|
|
|
|
|
if (entity1 != null) {
|
|
|
|
|
@@ -689,7 +689,10 @@ public class ServerLevel extends Level implements WorldGenLevel {
|
|
|
|
|
@@ -706,7 +706,10 @@ public class ServerLevel extends Level implements WorldGenLevel {
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public boolean shouldTickBlocksAt(long chunkPos) {
|
|
|
|
@ -1920,7 +1879,7 @@ index 4c9832ccede082a468e97870b5f6b07bbed652f3..344c5bafe291a2542c4940e4d8023264
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
protected void tickTime() {
|
|
|
|
|
@@ -2373,7 +2376,7 @@ public class ServerLevel extends Level implements WorldGenLevel {
|
|
|
|
|
@@ -2450,7 +2453,7 @@ public class ServerLevel extends Level implements WorldGenLevel {
|
|
|
|
|
private boolean isPositionTickingWithEntitiesLoaded(long chunkPos) {
|
|
|
|
|
// Paper start - optimize is ticking ready type functions
|
|
|
|
|
ChunkHolder chunkHolder = this.chunkSource.chunkMap.getVisibleChunkIfPresent(chunkPos);
|
|
|
|
@ -1930,10 +1889,10 @@ index 4c9832ccede082a468e97870b5f6b07bbed652f3..344c5bafe291a2542c4940e4d8023264
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
diff --git a/src/main/java/net/minecraft/server/level/ServerPlayer.java b/src/main/java/net/minecraft/server/level/ServerPlayer.java
|
|
|
|
|
index 3c13862e7ec96e7ee57c942bb2a7084f4553ae20..5e10a22c19ca1d5208dcfbe93436f5fdc3172c69 100644
|
|
|
|
|
index b0213404e1fb78dccfd3735f128032c0ac4988c8..da302fbaad018eb51ab6df4389942a5b47860e63 100644
|
|
|
|
|
--- a/src/main/java/net/minecraft/server/level/ServerPlayer.java
|
|
|
|
|
+++ b/src/main/java/net/minecraft/server/level/ServerPlayer.java
|
|
|
|
|
@@ -2443,5 +2443,5 @@ public class ServerPlayer extends Player {
|
|
|
|
|
@@ -2480,5 +2480,5 @@ public class ServerPlayer extends Player {
|
|
|
|
|
}
|
|
|
|
|
// CraftBukkit end
|
|
|
|
|
|
|
|
|
@ -1941,22 +1900,22 @@ index 3c13862e7ec96e7ee57c942bb2a7084f4553ae20..5e10a22c19ca1d5208dcfbe93436f5fd
|
|
|
|
|
+ public final int getViewDistance() { throw new UnsupportedOperationException("Use PlayerChunkLoader"); } // Paper - placeholder
|
|
|
|
|
}
|
|
|
|
|
diff --git a/src/main/java/net/minecraft/server/players/PlayerList.java b/src/main/java/net/minecraft/server/players/PlayerList.java
|
|
|
|
|
index 32f710e52da781ed9a0df8249a9ca79f1804b24a..3ffb0ae65ed530464462ec3b8cdb2db43c4d1b69 100644
|
|
|
|
|
index c0ed1103e649e619c58f59c7bedd6a18a58f71ea..e57636efacedf1c6f1ccd4f01f7e94d6fda2ff4f 100644
|
|
|
|
|
--- a/src/main/java/net/minecraft/server/players/PlayerList.java
|
|
|
|
|
+++ b/src/main/java/net/minecraft/server/players/PlayerList.java
|
|
|
|
|
@@ -271,7 +271,7 @@ public abstract class PlayerList {
|
|
|
|
|
@@ -273,7 +273,7 @@ public abstract class PlayerList {
|
|
|
|
|
boolean flag1 = gamerules.getBoolean(GameRules.RULE_REDUCEDDEBUGINFO);
|
|
|
|
|
|
|
|
|
|
// Spigot - view distance
|
|
|
|
|
- playerconnection.send(new ClientboundLoginPacket(player.getId(), worlddata.isHardcore(), player.gameMode.getGameModeForPlayer(), player.gameMode.getPreviousGameModeForPlayer(), this.server.levelKeys(), this.registryHolder, worldserver1.dimensionTypeRegistration(), worldserver1.dimension(), BiomeManager.obfuscateSeed(worldserver1.getSeed()), this.getMaxPlayers(), worldserver1.spigotConfig.viewDistance, worldserver1.spigotConfig.simulationDistance, flag1, !flag, worldserver1.isDebug(), worldserver1.isFlat()));
|
|
|
|
|
+ playerconnection.send(new ClientboundLoginPacket(player.getId(), worlddata.isHardcore(), player.gameMode.getGameModeForPlayer(), player.gameMode.getPreviousGameModeForPlayer(), this.server.levelKeys(), this.registryHolder, worldserver1.dimensionTypeRegistration(), worldserver1.dimension(), BiomeManager.obfuscateSeed(worldserver1.getSeed()), this.getMaxPlayers(), worldserver1.getChunkSource().chunkMap.playerChunkManager.getTargetSendDistance(), worldserver1.getChunkSource().chunkMap.playerChunkManager.getTargetTickViewDistance(), flag1, !flag, worldserver1.isDebug(), worldserver1.isFlat())); // Paper - replace old player chunk management
|
|
|
|
|
- playerconnection.send(new ClientboundLoginPacket(player.getId(), worlddata.isHardcore(), player.gameMode.getGameModeForPlayer(), player.gameMode.getPreviousGameModeForPlayer(), this.server.levelKeys(), this.registryHolder, worldserver1.dimensionTypeId(), worldserver1.dimension(), BiomeManager.obfuscateSeed(worldserver1.getSeed()), this.getMaxPlayers(), worldserver1.spigotConfig.viewDistance, worldserver1.spigotConfig.simulationDistance, flag1, !flag, worldserver1.isDebug(), worldserver1.isFlat(), player.getLastDeathLocation()));
|
|
|
|
|
+ playerconnection.send(new ClientboundLoginPacket(player.getId(), worlddata.isHardcore(), player.gameMode.getGameModeForPlayer(), player.gameMode.getPreviousGameModeForPlayer(), this.server.levelKeys(), this.registryHolder, worldserver1.dimensionTypeId(), worldserver1.dimension(), BiomeManager.obfuscateSeed(worldserver1.getSeed()), this.getMaxPlayers(), worldserver1.getChunkSource().chunkMap.playerChunkManager.getTargetSendDistance(), worldserver1.getChunkSource().chunkMap.playerChunkManager.getTargetTickViewDistance(), flag1, !flag, worldserver1.isDebug(), worldserver1.isFlat(), player.getLastDeathLocation())); // Paper - replace old player chunk management
|
|
|
|
|
player.getBukkitEntity().sendSupportedChannels(); // CraftBukkit
|
|
|
|
|
playerconnection.send(new ClientboundCustomPayloadPacket(ClientboundCustomPayloadPacket.BRAND, (new FriendlyByteBuf(Unpooled.buffer())).writeUtf(this.getServer().getServerModName())));
|
|
|
|
|
playerconnection.send(new ClientboundChangeDifficultyPacket(worlddata.getDifficulty(), worlddata.isDifficultyLocked()));
|
|
|
|
|
@@ -942,8 +942,8 @@ public abstract class PlayerList {
|
|
|
|
|
// CraftBukkit start
|
|
|
|
|
LevelData worlddata = worldserver1.getLevelData();
|
|
|
|
|
entityplayer1.connection.send(new ClientboundRespawnPacket(worldserver1.dimensionTypeRegistration(), worldserver1.dimension(), BiomeManager.obfuscateSeed(worldserver1.getSeed()), entityplayer1.gameMode.getGameModeForPlayer(), entityplayer1.gameMode.getPreviousGameModeForPlayer(), worldserver1.isDebug(), worldserver1.isFlat(), flag));
|
|
|
|
|
entityplayer1.connection.send(new ClientboundRespawnPacket(worldserver1.dimensionTypeId(), worldserver1.dimension(), BiomeManager.obfuscateSeed(worldserver1.getSeed()), entityplayer1.gameMode.getGameModeForPlayer(), entityplayer1.gameMode.getPreviousGameModeForPlayer(), worldserver1.isDebug(), worldserver1.isFlat(), flag, entityplayer1.getLastDeathLocation()));
|
|
|
|
|
- entityplayer1.connection.send(new ClientboundSetChunkCacheRadiusPacket(worldserver1.spigotConfig.viewDistance)); // Spigot
|
|
|
|
|
- entityplayer1.connection.send(new ClientboundSetSimulationDistancePacket(worldserver1.spigotConfig.simulationDistance)); // Spigot
|
|
|
|
|
+ entityplayer1.connection.send(new ClientboundSetChunkCacheRadiusPacket(worldserver1.getChunkSource().chunkMap.playerChunkManager.getTargetSendDistance())); // Spigot // Paper - replace old player chunk management
|
|
|
|
@ -1964,7 +1923,7 @@ index 32f710e52da781ed9a0df8249a9ca79f1804b24a..3ffb0ae65ed530464462ec3b8cdb2db4
|
|
|
|
|
entityplayer1.spawnIn(worldserver1);
|
|
|
|
|
entityplayer1.unsetRemoved();
|
|
|
|
|
entityplayer1.connection.teleport(new Location(worldserver1.getWorld(), entityplayer1.getX(), entityplayer1.getY(), entityplayer1.getZ(), entityplayer1.getYRot(), entityplayer1.getXRot()));
|
|
|
|
|
@@ -1453,7 +1453,7 @@ public abstract class PlayerList {
|
|
|
|
|
@@ -1485,7 +1485,7 @@ public abstract class PlayerList {
|
|
|
|
|
|
|
|
|
|
public void setViewDistance(int viewDistance) {
|
|
|
|
|
this.viewDistance = viewDistance;
|
|
|
|
@ -1973,7 +1932,7 @@ index 32f710e52da781ed9a0df8249a9ca79f1804b24a..3ffb0ae65ed530464462ec3b8cdb2db4
|
|
|
|
|
Iterator iterator = this.server.getAllLevels().iterator();
|
|
|
|
|
|
|
|
|
|
while (iterator.hasNext()) {
|
|
|
|
|
@@ -1468,7 +1468,7 @@ public abstract class PlayerList {
|
|
|
|
|
@@ -1500,7 +1500,7 @@ public abstract class PlayerList {
|
|
|
|
|
|
|
|
|
|
public void setSimulationDistance(int simulationDistance) {
|
|
|
|
|
this.simulationDistance = simulationDistance;
|
|
|
|
@ -1983,10 +1942,10 @@ index 32f710e52da781ed9a0df8249a9ca79f1804b24a..3ffb0ae65ed530464462ec3b8cdb2db4
|
|
|
|
|
|
|
|
|
|
while (iterator.hasNext()) {
|
|
|
|
|
diff --git a/src/main/java/net/minecraft/world/entity/boss/enderdragon/EnderDragon.java b/src/main/java/net/minecraft/world/entity/boss/enderdragon/EnderDragon.java
|
|
|
|
|
index 7eebecf836d21fc4ee901d23d7061db64486c0d5..1eb76c456790b81b657090377dd5ea547898f9a5 100644
|
|
|
|
|
index 21d26be5edbc05ac78c2f4a092594d772d98c982..266bce9339253df972062fe85ba7e5b4f289a2c5 100644
|
|
|
|
|
--- a/src/main/java/net/minecraft/world/entity/boss/enderdragon/EnderDragon.java
|
|
|
|
|
+++ b/src/main/java/net/minecraft/world/entity/boss/enderdragon/EnderDragon.java
|
|
|
|
|
@@ -644,7 +644,7 @@ public class EnderDragon extends Mob implements Enemy {
|
|
|
|
|
@@ -640,7 +640,7 @@ public class EnderDragon extends Mob implements Enemy {
|
|
|
|
|
// this.world.b(1028, this.getChunkCoordinates(), 0);
|
|
|
|
|
//int viewDistance = ((WorldServer) this.world).getServer().getViewDistance() * 16; // Paper - updated to use worlds actual view distance incase we have to uncomment this due to removal of player view distance API
|
|
|
|
|
for (net.minecraft.server.level.ServerPlayer player : (List<net.minecraft.server.level.ServerPlayer>) ((ServerLevel)level).players()) {
|
|
|
|
@ -1996,7 +1955,7 @@ index 7eebecf836d21fc4ee901d23d7061db64486c0d5..1eb76c456790b81b657090377dd5ea54
|
|
|
|
|
double deltaZ = this.getZ() - player.getZ();
|
|
|
|
|
double distanceSquared = deltaX * deltaX + deltaZ * deltaZ;
|
|
|
|
|
diff --git a/src/main/java/net/minecraft/world/entity/boss/wither/WitherBoss.java b/src/main/java/net/minecraft/world/entity/boss/wither/WitherBoss.java
|
|
|
|
|
index d347ab0a638a972ea53a982f29af40423919870c..563a028018421cbafdeff398175a32d6830134af 100644
|
|
|
|
|
index b3e2e834f4f151497bf842796dd8e3a8b5143f1b..4fb40aa91e0961f1974c74c88fa68359e4ad6b16 100644
|
|
|
|
|
--- a/src/main/java/net/minecraft/world/entity/boss/wither/WitherBoss.java
|
|
|
|
|
+++ b/src/main/java/net/minecraft/world/entity/boss/wither/WitherBoss.java
|
|
|
|
|
@@ -278,7 +278,7 @@ public class WitherBoss extends Monster implements PowerableMob, RangedAttackMob
|
|
|
|
@ -2009,10 +1968,10 @@ index d347ab0a638a972ea53a982f29af40423919870c..563a028018421cbafdeff398175a32d6
|
|
|
|
|
double deltaZ = this.getZ() - player.getZ();
|
|
|
|
|
double distanceSquared = deltaX * deltaX + deltaZ * deltaZ;
|
|
|
|
|
diff --git a/src/main/java/net/minecraft/world/item/EnderEyeItem.java b/src/main/java/net/minecraft/world/item/EnderEyeItem.java
|
|
|
|
|
index d9c20eca27382e89ddb13f1c8e84348242ca6ceb..c624a2cb0f4c9d7e12387ece574c1f9f74528b0c 100644
|
|
|
|
|
index 0b3e9e4ed162a6d9e1f3f55b9522b75c94d13254..fa1ff2e79954089552974cefedfcbff2225738ec 100644
|
|
|
|
|
--- a/src/main/java/net/minecraft/world/item/EnderEyeItem.java
|
|
|
|
|
+++ b/src/main/java/net/minecraft/world/item/EnderEyeItem.java
|
|
|
|
|
@@ -60,9 +60,10 @@ public class EnderEyeItem extends Item {
|
|
|
|
|
@@ -62,9 +62,10 @@ public class EnderEyeItem extends Item {
|
|
|
|
|
|
|
|
|
|
// CraftBukkit start - Use relative location for far away sounds
|
|
|
|
|
// world.b(1038, blockposition1.c(1, 0, 1), 0);
|
|
|
|
@ -2025,10 +1984,10 @@ index d9c20eca27382e89ddb13f1c8e84348242ca6ceb..c624a2cb0f4c9d7e12387ece574c1f9f
|
|
|
|
|
double deltaZ = soundPos.getZ() - player.getZ();
|
|
|
|
|
double distanceSquared = deltaX * deltaX + deltaZ * deltaZ;
|
|
|
|
|
diff --git a/src/main/java/net/minecraft/world/level/Level.java b/src/main/java/net/minecraft/world/level/Level.java
|
|
|
|
|
index 03824f73ecbac8ef6da586feb82f851557f82b6a..160c0f37aa3aaf7598f852acf9bd444f79444c97 100644
|
|
|
|
|
index 13c4b7aee9b9802edbaf7e4df9e9355667e727bb..9c036f7be422fd8447726478eee15a77637fdb9c 100644
|
|
|
|
|
--- a/src/main/java/net/minecraft/world/level/Level.java
|
|
|
|
|
+++ b/src/main/java/net/minecraft/world/level/Level.java
|
|
|
|
|
@@ -612,6 +612,11 @@ public abstract class Level implements LevelAccessor, AutoCloseable {
|
|
|
|
|
@@ -628,6 +628,11 @@ public abstract class Level implements LevelAccessor, AutoCloseable {
|
|
|
|
|
|
|
|
|
|
if ((i & 2) != 0 && (!this.isClientSide || (i & 4) == 0) && (this.isClientSide || chunk == null || (chunk.getFullStatus() != null && chunk.getFullStatus().isOrAfter(ChunkHolder.FullChunkStatus.TICKING)))) { // allow chunk to be null here as chunk.isReady() is false when we send our notification during block placement
|
|
|
|
|
this.sendBlockUpdated(blockposition, iblockdata1, iblockdata, i);
|
|
|
|
@ -2041,7 +2000,7 @@ index 03824f73ecbac8ef6da586feb82f851557f82b6a..160c0f37aa3aaf7598f852acf9bd444f
|
|
|
|
|
|
|
|
|
|
if ((i & 1) != 0) {
|
|
|
|
|
diff --git a/src/main/java/net/minecraft/world/level/chunk/LevelChunk.java b/src/main/java/net/minecraft/world/level/chunk/LevelChunk.java
|
|
|
|
|
index 72b5d63127fbcd2913309f2c3c438b88728b4673..f667dafd44b6652788d3367cbbc76eef3bead23b 100644
|
|
|
|
|
index 0de0519c01886a39399233b275db44b95e2f3d96..c46cbbf9ac4c5661933b03bc0b2559f7ade8c798 100644
|
|
|
|
|
--- a/src/main/java/net/minecraft/world/level/chunk/LevelChunk.java
|
|
|
|
|
+++ b/src/main/java/net/minecraft/world/level/chunk/LevelChunk.java
|
|
|
|
|
@@ -191,6 +191,43 @@ public class LevelChunk extends ChunkAccess {
|
|
|
|
@ -2088,7 +2047,7 @@ index 72b5d63127fbcd2913309f2c3c438b88728b4673..f667dafd44b6652788d3367cbbc76eef
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public final boolean isAnyNeighborsLoaded() {
|
|
|
|
|
@@ -795,6 +832,7 @@ public class LevelChunk extends ChunkAccess {
|
|
|
|
|
@@ -815,6 +852,7 @@ public class LevelChunk extends ChunkAccess {
|
|
|
|
|
// Paper end - neighbour cache
|
|
|
|
|
org.bukkit.Server server = this.level.getCraftServer();
|
|
|
|
|
this.level.getChunkSource().addLoadedChunk(this); // Paper
|
|
|
|
@ -2096,7 +2055,7 @@ index 72b5d63127fbcd2913309f2c3c438b88728b4673..f667dafd44b6652788d3367cbbc76eef
|
|
|
|
|
if (server != null) {
|
|
|
|
|
/*
|
|
|
|
|
* If it's a new world, the first few chunks are generated inside
|
|
|
|
|
@@ -919,7 +957,10 @@ public class LevelChunk extends ChunkAccess {
|
|
|
|
|
@@ -939,7 +977,10 @@ public class LevelChunk extends ChunkAccess {
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -2107,7 +2066,7 @@ index 72b5d63127fbcd2913309f2c3c438b88728b4673..f667dafd44b6652788d3367cbbc76eef
|
|
|
|
|
ChunkPos chunkcoordintpair = this.getPos();
|
|
|
|
|
|
|
|
|
|
for (int i = 0; i < this.postProcessing.length; ++i) {
|
|
|
|
|
@@ -957,6 +998,11 @@ public class LevelChunk extends ChunkAccess {
|
|
|
|
|
@@ -977,6 +1018,11 @@ public class LevelChunk extends ChunkAccess {
|
|
|
|
|
|
|
|
|
|
this.pendingBlockEntities.clear();
|
|
|
|
|
this.upgradeData.upgrade(this);
|
|
|
|
@ -2120,10 +2079,10 @@ index 72b5d63127fbcd2913309f2c3c438b88728b4673..f667dafd44b6652788d3367cbbc76eef
|
|
|
|
|
|
|
|
|
|
@Nullable
|
|
|
|
|
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
|
|
|
|
|
index 7414bb0ba5754b4e3be468d3986a2a979de7c983..dd3aac2b8058f09fdd6dce9c1c683725b3594cfd 100644
|
|
|
|
|
index d908eb6b1208cf69f2f1282ddf1c20dc04d092d1..bc387765a9d96f3901dd2e1db751262b1fdd4829 100644
|
|
|
|
|
--- a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
|
|
|
|
|
+++ b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
|
|
|
|
|
@@ -2202,43 +2202,56 @@ public class CraftWorld extends CraftRegionAccessor implements World {
|
|
|
|
|
@@ -2201,43 +2201,56 @@ public class CraftWorld extends CraftRegionAccessor implements World {
|
|
|
|
|
// Spigot start
|
|
|
|
|
@Override
|
|
|
|
|
public int getViewDistance() {
|
|
|
|
@ -2189,17 +2148,17 @@ index 7414bb0ba5754b4e3be468d3986a2a979de7c983..dd3aac2b8058f09fdd6dce9c1c683725
|
|
|
|
|
// Paper end - view distance api
|
|
|
|
|
|
|
|
|
|
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
|
|
|
|
|
index f8039c0e62b8fa8f0491edb296054299e7e28bdf..ce78e024244c14530270b8276e5b0fd853f0a110 100644
|
|
|
|
|
index 04b991ec6a808839df1d2b5037ad386bda5094fe..abcce6bd0b32d0188751393a6f56f2e82530912c 100644
|
|
|
|
|
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
|
|
|
|
|
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
|
|
|
|
|
@@ -544,45 +544,80 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
|
|
|
|
|
@@ -541,45 +541,80 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
+ // Paper start - implement view distances
|
|
|
|
|
@Override
|
|
|
|
|
public int getViewDistance() {
|
|
|
|
|
- throw new NotImplementedException("Per-Player View Distance APIs need further understanding to properly implement (There are per world view distances though!)"); // TODO
|
|
|
|
|
- throw new UnsupportedOperationException("Per-Player View Distance APIs need further understanding to properly implement (There are per world view distances though!)"); // TODO
|
|
|
|
|
+ net.minecraft.server.level.ChunkMap chunkMap = this.getHandle().getLevel().getChunkSource().chunkMap;
|
|
|
|
|
+ io.papermc.paper.chunk.PlayerChunkLoader.PlayerLoaderData data = chunkMap.playerChunkManager.getData(this.getHandle());
|
|
|
|
|
+ if (data == null) {
|
|
|
|
@ -2210,7 +2169,7 @@ index f8039c0e62b8fa8f0491edb296054299e7e28bdf..ce78e024244c14530270b8276e5b0fd8
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public void setViewDistance(int viewDistance) {
|
|
|
|
|
- throw new NotImplementedException("Per-Player View Distance APIs need further understanding to properly implement (There are per world view distances though!)"); // TODO
|
|
|
|
|
- throw new UnsupportedOperationException("Per-Player View Distance APIs need further understanding to properly implement (There are per world view distances though!)"); // TODO
|
|
|
|
|
+ net.minecraft.server.level.ChunkMap chunkMap = this.getHandle().getLevel().getChunkSource().chunkMap;
|
|
|
|
|
+ io.papermc.paper.chunk.PlayerChunkLoader.PlayerLoaderData data = chunkMap.playerChunkManager.getData(this.getHandle());
|
|
|
|
|
+ if (data == null) {
|
|
|
|
@ -2222,7 +2181,7 @@ index f8039c0e62b8fa8f0491edb296054299e7e28bdf..ce78e024244c14530270b8276e5b0fd8
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public int getSimulationDistance() {
|
|
|
|
|
- throw new NotImplementedException("Per-Player View Distance APIs need further understanding to properly implement (There are per world view distances though!)"); // TODO
|
|
|
|
|
- throw new UnsupportedOperationException("Per-Player View Distance APIs need further understanding to properly implement (There are per world view distances though!)"); // TODO
|
|
|
|
|
+ net.minecraft.server.level.ChunkMap chunkMap = this.getHandle().getLevel().getChunkSource().chunkMap;
|
|
|
|
|
+ io.papermc.paper.chunk.PlayerChunkLoader.PlayerLoaderData data = chunkMap.playerChunkManager.getData(this.getHandle());
|
|
|
|
|
+ if (data == null) {
|
|
|
|
@ -2233,7 +2192,7 @@ index f8039c0e62b8fa8f0491edb296054299e7e28bdf..ce78e024244c14530270b8276e5b0fd8
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public void setSimulationDistance(int simulationDistance) {
|
|
|
|
|
- throw new NotImplementedException("Per-Player View Distance APIs need further understanding to properly implement (There are per world view distances though!)"); // TODO
|
|
|
|
|
- throw new UnsupportedOperationException("Per-Player View Distance APIs need further understanding to properly implement (There are per world view distances though!)"); // TODO
|
|
|
|
|
+ net.minecraft.server.level.ChunkMap chunkMap = this.getHandle().getLevel().getChunkSource().chunkMap;
|
|
|
|
|
+ io.papermc.paper.chunk.PlayerChunkLoader.PlayerLoaderData data = chunkMap.playerChunkManager.getData(this.getHandle());
|
|
|
|
|
+ if (data == null) {
|
|
|
|
@ -2245,19 +2204,19 @@ index f8039c0e62b8fa8f0491edb296054299e7e28bdf..ce78e024244c14530270b8276e5b0fd8
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public int getNoTickViewDistance() {
|
|
|
|
|
- throw new NotImplementedException("Per-Player View Distance APIs need further understanding to properly implement (There are per world view distances though!)"); // TODO
|
|
|
|
|
- throw new UnsupportedOperationException("Per-Player View Distance APIs need further understanding to properly implement (There are per world view distances though!)"); // TODO
|
|
|
|
|
+ return this.getViewDistance();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public void setNoTickViewDistance(int viewDistance) {
|
|
|
|
|
- throw new NotImplementedException("Per-Player View Distance APIs need further understanding to properly implement (There are per world view distances though!)"); // TODO
|
|
|
|
|
- throw new UnsupportedOperationException("Per-Player View Distance APIs need further understanding to properly implement (There are per world view distances though!)"); // TODO
|
|
|
|
|
+ this.setViewDistance(viewDistance);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public int getSendViewDistance() {
|
|
|
|
|
- throw new NotImplementedException("Per-Player View Distance APIs need further understanding to properly implement (There are per world view distances though!)"); // TODO
|
|
|
|
|
- throw new UnsupportedOperationException("Per-Player View Distance APIs need further understanding to properly implement (There are per world view distances though!)"); // TODO
|
|
|
|
|
+ net.minecraft.server.level.ChunkMap chunkMap = this.getHandle().getLevel().getChunkSource().chunkMap;
|
|
|
|
|
+ io.papermc.paper.chunk.PlayerChunkLoader.PlayerLoaderData data = chunkMap.playerChunkManager.getData(this.getHandle());
|
|
|
|
|
+ if (data == null) {
|
|
|
|
@ -2268,7 +2227,7 @@ index f8039c0e62b8fa8f0491edb296054299e7e28bdf..ce78e024244c14530270b8276e5b0fd8
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public void setSendViewDistance(int viewDistance) {
|
|
|
|
|
- throw new NotImplementedException("Per-Player View Distance APIs need further understanding to properly implement (There are per world view distances though!)"); // TODO
|
|
|
|
|
- throw new UnsupportedOperationException("Per-Player View Distance APIs need further understanding to properly implement (There are per world view distances though!)"); // TODO
|
|
|
|
|
+ net.minecraft.server.level.ChunkMap chunkMap = this.getHandle().getLevel().getChunkSource().chunkMap;
|
|
|
|
|
+ io.papermc.paper.chunk.PlayerChunkLoader.PlayerLoaderData data = chunkMap.playerChunkManager.getData(this.getHandle());
|
|
|
|
|
+ if (data == null) {
|