3
0
Mirror von https://github.com/PaperMC/Paper.git synchronisiert 2024-12-17 12:00:07 +01:00

Update player chunk loader patch, re-add ticket level propagator patch

Dieser Commit ist enthalten in:
Jason Penilla 2022-06-09 16:01:48 -07:00
Ursprung 181a8479b5
Commit 0a21166a8b
60 geänderte Dateien mit 147 neuen und 188 gelöschten Zeilen

Datei anzeigen

@ -17,7 +17,7 @@ to actually processing chunk tasks vs the ticket level updates.
TODO: Causes super funky chunk loading issues
diff --git a/src/main/java/net/minecraft/server/level/DistanceManager.java b/src/main/java/net/minecraft/server/level/DistanceManager.java
index b22c771ca35466574d5a73f2da3fc8762cb29487..65a76e76cd101298a8cad4d23e0928ef3e08289a 100644
index 06e4d3a02e0d1326b7029157856476db4ef3575e..f581a9f79b2357118d912a15344ff94df3b0c50e 100644
--- a/src/main/java/net/minecraft/server/level/DistanceManager.java
+++ b/src/main/java/net/minecraft/server/level/DistanceManager.java
@@ -38,6 +38,7 @@ import net.minecraft.world.level.chunk.ChunkStatus;

Datei anzeigen

@ -10,7 +10,7 @@ just looking at the LevelStem key, look at the DimensionType key which
is one level below that. Defaults to off to keep vanilla behavior.
diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java
index 8b6b0c3998e57551b1fc6e2918edfde0abea8f35..bde42c164acaf823e1de658b16eb4c999de65b2d 100644
index 9c215a77ca24ab2c75709c867c1d92ad7c97f1ea..38e41238cb8629fb511f7d4ba35665c1c41c3c5d 100644
--- a/src/main/java/net/minecraft/server/MinecraftServer.java
+++ b/src/main/java/net/minecraft/server/MinecraftServer.java
@@ -586,7 +586,15 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa

Datei anzeigen

@ -7,7 +7,7 @@ Some parts of legacy conversion will need the overworld
to get the legacy structure data storage
diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java
index bde42c164acaf823e1de658b16eb4c999de65b2d..c91d6458bba97ae35c4c1ddc641f48e969986d39 100644
index 38e41238cb8629fb511f7d4ba35665c1c41c3c5d..0ab7cf2b3b3fcb76a0f2eea300da7a29c258cd48 100644
--- a/src/main/java/net/minecraft/server/MinecraftServer.java
+++ b/src/main/java/net/minecraft/server/MinecraftServer.java
@@ -598,9 +598,10 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
@ -23,7 +23,7 @@ index bde42c164acaf823e1de658b16eb4c999de65b2d..c91d6458bba97ae35c4c1ddc641f48e9
if (worlddata.getCustomBossEvents() != null) {
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
index cf0cb900b71eb2369795b51350be828b219613f5..c62af511153b104ae3fdf45c899cec5de5c0de53 100644
index 9035189f4640ecd7c642410824b61b0cbd309358..9dc43d848aacd6c5855652ef193d980307a0adc4 100644
--- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java
+++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
@@ -1230,10 +1230,11 @@ public final class CraftServer implements Server {

Datei anzeigen

@ -24,7 +24,7 @@ index 0000000000000000000000000000000000000000..6b0bed550763f34e18c9e92f9a47ec0c
+ }
+}
diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java
index c91d6458bba97ae35c4c1ddc641f48e969986d39..6911c2bee078532255faa791d34a6c4e621b055f 100644
index 0ab7cf2b3b3fcb76a0f2eea300da7a29c258cd48..05e8e1cc33c0c4509ec157608e73989b423647ad 100644
--- a/src/main/java/net/minecraft/server/MinecraftServer.java
+++ b/src/main/java/net/minecraft/server/MinecraftServer.java
@@ -2021,6 +2021,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
@ -164,7 +164,7 @@ index 3d688e334c7287f41460bd866bfd1155e8bb55d2..55006724ccec9f3de828ec18693728e9
@Override
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
index 8d94fd23b85bf6bbe8486f3548dfd12360926f5d..781bc5ee94bdd33bfd31c3234c5a75132be5468a 100644
index 9dc43d848aacd6c5855652ef193d980307a0adc4..0e5b0c53f7540655dd9b5d9af67161233ef6df65 100644
--- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java
+++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
@@ -279,6 +279,7 @@ public final class CraftServer implements Server {

Datei anzeigen

@ -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) {

Datei anzeigen

@ -7,7 +7,7 @@ Subject: [PATCH] Fix World#locateNearestStructure
impl needs to be changed to reflect that
diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java
index 6911c2bee078532255faa791d34a6c4e621b055f..26d912a96e8e614865b03dbcc166d38bdd097faf 100644
index 05e8e1cc33c0c4509ec157608e73989b423647ad..1bc400cf245ba3110e8874a4f2837a91d0f70916 100644
--- a/src/main/java/net/minecraft/server/MinecraftServer.java
+++ b/src/main/java/net/minecraft/server/MinecraftServer.java
@@ -2022,6 +2022,11 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
@ -23,10 +23,10 @@ index 6911c2bee078532255faa791d34a6c4e621b055f..26d912a96e8e614865b03dbcc166d38b
if (Thread.currentThread() != this.serverThread) return; // Paper
//this.getPlayerList().saveAll(); // Paper - we don't need to do this
diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java
index edeafd4c671d686c96bffc095fa81b9a4a6723a6..240281d99ccd5e1f5c463e0ed8296bebb84e31e1 100644
index 4210d4b3c9d6f8bb3501b3592a6c1317c45ff3cd..6b8f888741f1715bbcc0a8f4d080bf91d6c1a547 100644
--- a/src/main/java/net/minecraft/server/level/ServerLevel.java
+++ b/src/main/java/net/minecraft/server/level/ServerLevel.java
@@ -1881,7 +1881,16 @@ public class ServerLevel extends Level implements WorldGenLevel {
@@ -1884,7 +1884,16 @@ public class ServerLevel extends Level implements WorldGenLevel {
if (optional.isEmpty()) {
return null;
} else {
@ -45,7 +45,7 @@ index edeafd4c671d686c96bffc095fa81b9a4a6723a6..240281d99ccd5e1f5c463e0ed8296beb
return pair != null ? (BlockPos) pair.getFirst() : null;
}
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
index d908eb6b1208cf69f2f1282ddf1c20dc04d092d1..9755342e62a4632297bf8ae7e9df5cdf89f24f31 100644
index bc387765a9d96f3901dd2e1db751262b1fdd4829..6f09519695a7268e4749a6c36b463f5b33bb645f 100644
--- a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
+++ b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
@@ -2059,10 +2059,22 @@ public class CraftWorld extends CraftRegionAccessor implements World {

Datei anzeigen

@ -10,7 +10,7 @@ so we do not need that. The client only needs the chunk it is currently in to
be loaded to close the loading screen, so we just send an empty one.
diff --git a/src/main/java/net/minecraft/server/players/PlayerList.java b/src/main/java/net/minecraft/server/players/PlayerList.java
index c0ed1103e649e619c58f59c7bedd6a18a58f71ea..f6335e2f7dd6517dc3dfce4f076deab22c543ec6 100644
index e57636efacedf1c6f1ccd4f01f7e94d6fda2ff4f..c247d27e516d1d7c5dc1e4b50ff6c81cbc54b0cc 100644
--- a/src/main/java/net/minecraft/server/players/PlayerList.java
+++ b/src/main/java/net/minecraft/server/players/PlayerList.java
@@ -422,6 +422,16 @@ public abstract class PlayerList {

Datei anzeigen

@ -21,7 +21,7 @@ index d1fca0e3227b5f37c11367548be362f5a49b6a71..5628940cd3c3566c5db2beda506d4f20
if (Snowball.class.isAssignableFrom(clazz)) {
entity = new net.minecraft.world.entity.projectile.Snowball(world, x, y, z);
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
index 9755342e62a4632297bf8ae7e9df5cdf89f24f31..393befeacc2ae63d7030d6f595e5ae381c01db57 100644
index 6f09519695a7268e4749a6c36b463f5b33bb645f..998ad03f4daa9f3b6d3dd70c5c912bc935ffd12f 100644
--- a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
+++ b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
@@ -1410,7 +1410,12 @@ public class CraftWorld extends CraftRegionAccessor implements World {

Datei anzeigen

@ -12,7 +12,7 @@ Subject: [PATCH] Fix save problems on shutdown
processed so that the main process queue can be drained
diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java
index 26d912a96e8e614865b03dbcc166d38bdd097faf..7afc45a9dd0bdf343f5a9703027772017b716d8c 100644
index 1bc400cf245ba3110e8874a4f2837a91d0f70916..60de49a9888b6dfe17dcb0d9dd0dd3d2e7d829aa 100644
--- a/src/main/java/net/minecraft/server/MinecraftServer.java
+++ b/src/main/java/net/minecraft/server/MinecraftServer.java
@@ -953,6 +953,13 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
@ -55,10 +55,10 @@ index 26d912a96e8e614865b03dbcc166d38bdd097faf..7afc45a9dd0bdf343f5a970302777201
if (isOversleep) return canOversleep();// Paper - because of our changes, this logic is broken
return this.forceTicks || this.runningTask() || Util.getMillis() < (this.mayHaveDelayedTasks ? this.delayedTasksMaxNextTickTime : this.nextTickTime);
diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java
index 240281d99ccd5e1f5c463e0ed8296bebb84e31e1..c4fb20953a6b21759c50bf8fdbc24dc71bc42e54 100644
index 6b8f888741f1715bbcc0a8f4d080bf91d6c1a547..230d2aed0bb4eb19259f33ba7536b3ee1809500e 100644
--- a/src/main/java/net/minecraft/server/level/ServerLevel.java
+++ b/src/main/java/net/minecraft/server/level/ServerLevel.java
@@ -1272,7 +1272,13 @@ public class ServerLevel extends Level implements WorldGenLevel {
@@ -1275,7 +1275,13 @@ public class ServerLevel extends Level implements WorldGenLevel {
}
}

Datei anzeigen

@ -6,7 +6,7 @@ Subject: [PATCH] Fix saving in unloadWorld
Change savingDisabled to false to ensure ServerLevel's saving logic gets called when unloadWorld is called with save = true
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
index bf45b635cb5397dc30ac9cf2d7c37fa1cfc1b32b..9bb7890a04d1af04ae68bc2bc9cebc81414620d3 100644
index 0e5b0c53f7540655dd9b5d9af67161233ef6df65..74b19b0fa6a0f8e5c75338930e75a40618d135c8 100644
--- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java
+++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
@@ -1278,7 +1278,7 @@ public final class CraftServer implements Server {

Datei anzeigen

@ -5,7 +5,7 @@ Subject: [PATCH] fix player loottables running when mob loot gamerule is false
diff --git a/src/main/java/net/minecraft/server/level/ServerPlayer.java b/src/main/java/net/minecraft/server/level/ServerPlayer.java
index b0213404e1fb78dccfd3735f128032c0ac4988c8..c816bae0227d0a1d38d9d20343e727ef2f30a8c0 100644
index da302fbaad018eb51ab6df4389942a5b47860e63..c8057f98e16ba6e19640e0b250e5201e0f4f57db 100644
--- a/src/main/java/net/minecraft/server/level/ServerPlayer.java
+++ b/src/main/java/net/minecraft/server/level/ServerPlayer.java
@@ -859,12 +859,14 @@ public class ServerPlayer extends Player {

Datei anzeigen

@ -5,7 +5,7 @@ Subject: [PATCH] Allow to change the podium for the EnderDragon
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 21d26be5edbc05ac78c2f4a092594d772d98c982..69c6a0c64ef5371dc57da1fdb60a8ac295bf327a 100644
index 266bce9339253df972062fe85ba7e5b4f289a2c5..219877901fb5fc6401646253d6e5d7bd8416ffe1 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
@@ -99,6 +99,10 @@ public class EnderDragon extends Mob implements Enemy {

Datei anzeigen

@ -6,7 +6,7 @@ Subject: [PATCH] Use username instead of display name in
diff --git a/src/main/java/net/minecraft/server/players/PlayerList.java b/src/main/java/net/minecraft/server/players/PlayerList.java
index f6335e2f7dd6517dc3dfce4f076deab22c543ec6..755fbc6213096de1e5c071d4268115f46e364d40 100644
index c247d27e516d1d7c5dc1e4b50ff6c81cbc54b0cc..20cdfdb3b9351f74e89bc45b3ab972384165659a 100644
--- a/src/main/java/net/minecraft/server/players/PlayerList.java
+++ b/src/main/java/net/minecraft/server/players/PlayerList.java
@@ -1449,7 +1449,7 @@ public abstract class PlayerList {

Datei anzeigen

@ -158,7 +158,7 @@ index 3c93bfeb94168f832904a8462ae23b06e81e080d..468c635d31cfa8051666bbefce8df4b4
this.onChanged(server);
}
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
index 393befeacc2ae63d7030d6f595e5ae381c01db57..53918694230deb291a601226175baf6bc7df125f 100644
index 998ad03f4daa9f3b6d3dd70c5c912bc935ffd12f..9175fa06419ac726c4508f38ae3d454451fbb380 100644
--- a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
+++ b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
@@ -1914,7 +1914,7 @@ public class CraftWorld extends CraftRegionAccessor implements World {

Datei anzeigen

@ -5,7 +5,7 @@ Subject: [PATCH] WorldCreator#keepSpawnLoaded
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
index 9bb7890a04d1af04ae68bc2bc9cebc81414620d3..cdcbc94bad295bc28a93506e8c3f91919a49df4b 100644
index 74b19b0fa6a0f8e5c75338930e75a40618d135c8..4ac6b213b5fd3b5da2f084472fac853cd360ac45 100644
--- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java
+++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
@@ -1237,6 +1237,7 @@ public final class CraftServer implements Server {

Datei anzeigen

@ -5,7 +5,7 @@ Subject: [PATCH] Fix NPE for BlockDataMeta#getBlockData
diff --git a/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaItem.java b/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaItem.java
index c098003d5801b132d71adbaa9f85c41854c684e4..3a99b9a1b06e92675ea7d18c6dde77da29901c22 100644
index a8294bf057e03c5d866f6da31e6cdfa9edd3f146..3c4dadd0012c11191c873fe25a7625193563915d 100644
--- a/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaItem.java
+++ b/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaItem.java
@@ -1093,7 +1093,10 @@ class CraftMetaItem implements ItemMeta, Damageable, Repairable, BlockDataMeta {

Datei anzeigen

@ -22,10 +22,10 @@ index e3aa9ca50e743590c1c0c994588597d47052b7c0..b1592bd75bb273622680a1d5c5fef7a7
}
});
diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java
index f1f95c857691c5ef37347d46a8eb5fde965402fc..f1e7ab0de35135b69b5f93836c1da33f286f401e 100644
index 230d2aed0bb4eb19259f33ba7536b3ee1809500e..8f0b4179eb7982f130be04c98c962c701c181238 100644
--- a/src/main/java/net/minecraft/server/level/ServerLevel.java
+++ b/src/main/java/net/minecraft/server/level/ServerLevel.java
@@ -2492,6 +2492,7 @@ public class ServerLevel extends Level implements WorldGenLevel {
@@ -2495,6 +2495,7 @@ public class ServerLevel extends Level implements WorldGenLevel {
}
public void onTickingStart(Entity entity) {

Datei anzeigen

@ -7,7 +7,7 @@ There are no plans to support creating worlds while worlds are
being ticked themselvess.
diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java
index 7afc45a9dd0bdf343f5a9703027772017b716d8c..c3ca919ed60f027d6116a85cb79e3b6cd3bf1619 100644
index 60de49a9888b6dfe17dcb0d9dd0dd3d2e7d829aa..9e1d3a22ed7e34e4968b5fb34cc77b661eb4747d 100644
--- a/src/main/java/net/minecraft/server/MinecraftServer.java
+++ b/src/main/java/net/minecraft/server/MinecraftServer.java
@@ -294,6 +294,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
@ -35,7 +35,7 @@ index 7afc45a9dd0bdf343f5a9703027772017b716d8c..c3ca919ed60f027d6116a85cb79e3b6c
this.profiler.popPush("connection");
MinecraftTimings.connectionTimer.startTiming(); // Spigot
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
index cdcbc94bad295bc28a93506e8c3f91919a49df4b..a7a038835579c599368e409b86cc5eecf0013952 100644
index 4ac6b213b5fd3b5da2f084472fac853cd360ac45..f1e5ccfbcd08a73ac3aba9a1cb7b414faef81f9e 100644
--- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java
+++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
@@ -1128,6 +1128,7 @@ public final class CraftServer implements Server {

Datei anzeigen

@ -1921,7 +1921,7 @@ index 0000000000000000000000000000000000000000..dde98a49b0f4db023386f8e4b98c9934
+ }
+}
diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java
index c8294d999cdce92b4747f1e6fbbed7fcb90ce8df..50f0fa0ebfe5b34af6ce8162d18bd0f7b1a57fb1 100644
index 8f0b4179eb7982f130be04c98c962c701c181238..3f1d0b2cad36b26389755ee098465b78acf228d3 100644
--- a/src/main/java/net/minecraft/server/level/ServerLevel.java
+++ b/src/main/java/net/minecraft/server/level/ServerLevel.java
@@ -216,6 +216,7 @@ public class ServerLevel extends Level implements WorldGenLevel {
@ -1932,7 +1932,7 @@ index c8294d999cdce92b4747f1e6fbbed7fcb90ce8df..50f0fa0ebfe5b34af6ce8162d18bd0f7
public static Throwable getAddToWorldStackTrace(Entity entity) {
return new Throwable(entity + " Added to world at " + new java.util.Date());
}
@@ -2481,6 +2482,13 @@ public class ServerLevel extends Level implements WorldGenLevel {
@@ -2484,6 +2485,13 @@ public class ServerLevel extends Level implements WorldGenLevel {
return this.entityManager.canPositionTick(pos.toLong()); // Paper
}
@ -1947,10 +1947,10 @@ index c8294d999cdce92b4747f1e6fbbed7fcb90ce8df..50f0fa0ebfe5b34af6ce8162d18bd0f7
EntityCallbacks() {}
diff --git a/src/main/java/net/minecraft/world/level/Level.java b/src/main/java/net/minecraft/world/level/Level.java
index 13c4b7aee9b9802edbaf7e4df9e9355667e727bb..76aa5d1bcb2ccb554966dcb5916ae527d73f042e 100644
index 9c036f7be422fd8447726478eee15a77637fdb9c..d59dea221ba0f1b9c14f403d3c6ea61b2c454316 100644
--- a/src/main/java/net/minecraft/world/level/Level.java
+++ b/src/main/java/net/minecraft/world/level/Level.java
@@ -1448,4 +1448,15 @@ public abstract class Level implements LevelAccessor, AutoCloseable {
@@ -1453,4 +1453,15 @@ public abstract class Level implements LevelAccessor, AutoCloseable {
return ret;
}
// Paper end