Readd incremental chunk saving, merge with player saving

This commit is contained in:
Nassim Jahnke 2021-11-26 17:25:35 +01:00 committed by MiniDigger | Martin
parent 738788079b
commit 134a61c111
88 changed files with 334 additions and 378 deletions

View File

@ -4,11 +4,30 @@ Date: Sun, 9 Jun 2019 03:53:22 +0100
Subject: [PATCH] incremental chunk saving
diff --git a/src/main/java/com/destroystokyo/paper/PaperConfig.java b/src/main/java/com/destroystokyo/paper/PaperConfig.java
index ebbbffd209c6796bc608992e293035141a122d1f..4fb6b2153117f54a2b0ca940de4c0ee2fa85e20e 100644
--- a/src/main/java/com/destroystokyo/paper/PaperConfig.java
+++ b/src/main/java/com/destroystokyo/paper/PaperConfig.java
@@ -458,4 +458,14 @@ public class PaperConfig {
set("settings.unsupported-settings.allow-tnt-duplication", null);
}
+ public static int playerAutoSaveRate = -1;
+ public static int maxPlayerAutoSavePerTick = 10;
+ private static void playerAutoSaveRate() {
+ playerAutoSaveRate = getInt("settings.player-auto-save-rate", -1);
+ maxPlayerAutoSavePerTick = getInt("settings.max-player-auto-save-per-tick", -1);
+ if (maxPlayerAutoSavePerTick == -1) { // -1 Automatic / "Recommended"
+ // 10 should be safe for everyone unless you mass spamming player auto save
+ maxPlayerAutoSavePerTick = (playerAutoSaveRate == -1 || playerAutoSaveRate > 100) ? 10 : 20;
+ }
+ }
}
diff --git a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
index 22a04bfddccd5a118d6297ca88a5e396b6a884f9..f9caed53ffc10300511b576cf822864b101df83d 100644
index 845f105457d659a4bd88d4a8ce91b20d6abb7865..bf0c6e1b2b1934bc3fa5c17c414b3730c5ac0833 100644
--- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
+++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
@@ -63,6 +63,21 @@ public class PaperWorldConfig {
@@ -62,6 +62,21 @@ public class PaperWorldConfig {
log( "Keep Spawn Loaded Range: " + (keepLoadedRange/16));
}
@ -31,51 +50,57 @@ index 22a04bfddccd5a118d6297ca88a5e396b6a884f9..f9caed53ffc10300511b576cf822864b
config.addDefault("world-settings.default." + path, def);
return config.getBoolean("world-settings." + worldName + "." + path, config.getBoolean("world-settings.default." + path));
diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java
index 4d9326099bdff037e5fe9a6ee14f8610c482ac7a..f07dd72d2ba1b3e1d30dab5973ca3785ea517471 100644
index 4351dd9c293d1db48c87c5df28bcb2b9a59583f7..8a3583bcf2d2a694b30718062bc7f2e1158c9b4f 100644
--- a/src/main/java/net/minecraft/server/MinecraftServer.java
+++ b/src/main/java/net/minecraft/server/MinecraftServer.java
@@ -298,6 +298,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
public static int currentTick = 0; // Paper - Further improve tick loop
public java.util.Queue<Runnable> processQueue = new java.util.concurrent.ConcurrentLinkedQueue<Runnable>();
public int autosavePeriod;
+ public boolean serverAutoSave = false; // Paper
public Commands vanillaCommandDispatcher;
public boolean forceTicks; // Paper
// CraftBukkit end
@@ -1416,14 +1417,23 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
this.status.getPlayers().setSample(agameprofile);
@@ -901,7 +901,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
try {
this.isSaving = true;
- this.getPlayerList().saveAll();
+ this.getPlayerList().saveAll(); // Diff on change
flag3 = this.saveAllChunks(suppressLogs, flush, force);
} finally {
this.isSaving = false;
@@ -1408,13 +1408,27 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
}
}
- if (this.autosavePeriod > 0 && this.tickCount % this.autosavePeriod == 0) { // CraftBukkit
- MinecraftServer.LOGGER.debug("Autosave started");
+ // if (this.autosavePeriod > 0 && this.tickCount % this.autosavePeriod == 0) { // CraftBukkit // Paper - move down
+ // MinecraftServer.LOGGER.debug("Autosave started"); // Paper
+ serverAutoSave = (autosavePeriod > 0 && this.tickCount % autosavePeriod == 0); // Paper
this.profiler.push("save");
+ if (this.autosavePeriod > 0 && this.tickCount % this.autosavePeriod == 0) { // Paper - moved from above
this.playerList.saveAll();
- this.saveAllChunks(true, false, false);
- this.profiler.push("save");
- this.saveEverything(true, false, false);
- this.profiler.pop();
- MinecraftServer.LOGGER.debug("Autosave finished");
+ // this.saveAllChunks(true, false, false); // Paper - saved incrementally below
+ } // Paper start
+ for (ServerLevel level : this.getAllLevels()) {
+ if (level.paperConfig.autoSavePeriod > 0) {
+ level.saveIncrementally(this.serverAutoSave);
+ }
+ // Paper start - incremental chunk and player saving
+ int playerSaveInterval = com.destroystokyo.paper.PaperConfig.playerAutoSaveRate;
+ if (playerSaveInterval < 0) {
+ playerSaveInterval = autosavePeriod;
}
+ this.profiler.push("save");
+ try {
+ this.isSaving = true;
+ if (playerSaveInterval > 0) {
+ this.playerList.saveAll(playerSaveInterval);
+ }
+ for (ServerLevel level : this.getAllLevels()) {
+ if (level.paperConfig.autoSavePeriod > 0) {
+ level.saveIncrementally(autosavePeriod > 0 && this.tickCount % autosavePeriod == 0);
+ }
+ }
+ } finally {
+ this.isSaving = false;
+ }
+ this.profiler.pop();
+ // Paper end
+ this.profiler.pop();
+ // MinecraftServer.LOGGER.debug("Autosave finished"); // Paper
+ //} // Paper
this.profiler.push("snooper");
if (((DedicatedServer) this).getProperties().snooperEnabled && !this.snooper.isStarted() && this.tickCount > 100) { // Spigot
io.papermc.paper.util.CachedLists.reset(); // Paper
// Paper start - move executeAll() into full server tick timing
try (co.aikar.timings.Timing ignored = MinecraftTimings.processTasksTimer.startTiming()) {
diff --git a/src/main/java/net/minecraft/server/level/ChunkHolder.java b/src/main/java/net/minecraft/server/level/ChunkHolder.java
index b9e9bfb6c73cfb309c5d9399817546399b333a12..467449049359c721c27b7cd249b03acc5fb8f3cc 100644
index 347cf5d00d986ae8ad60af7f6eabde9fbfd78561..bab59dc2747a24ce6b48c8f962f81c50a316d89e 100644
--- a/src/main/java/net/minecraft/server/level/ChunkHolder.java
+++ b/src/main/java/net/minecraft/server/level/ChunkHolder.java
@@ -111,6 +111,8 @@ public class ChunkHolder {
@@ -84,6 +84,8 @@ public class ChunkHolder {
this.playersInChunkTickRange = this.chunkMap.playerChunkTickRangeMap.getObjectsInRange(key);
}
// Paper end - optimise isOutsideOfRange
@ -84,7 +109,7 @@ index b9e9bfb6c73cfb309c5d9399817546399b333a12..467449049359c721c27b7cd249b03acc
public ChunkHolder(ChunkPos pos, int level, LevelHeightAccessor world, LevelLightEngine lightingProvider, ChunkHolder.LevelChangeListener levelUpdateListener, ChunkHolder.PlayerProvider playersWatchingChunkProvider) {
this.futures = new AtomicReferenceArray(ChunkHolder.CHUNK_STATUSES.size());
@@ -524,7 +526,19 @@ public class ChunkHolder {
@@ -463,7 +465,19 @@ public class ChunkHolder {
boolean flag2 = playerchunk_state.isOrAfter(ChunkHolder.FullChunkStatus.BORDER);
boolean flag3 = playerchunk_state1.isOrAfter(ChunkHolder.FullChunkStatus.BORDER);
@ -104,7 +129,7 @@ index b9e9bfb6c73cfb309c5d9399817546399b333a12..467449049359c721c27b7cd249b03acc
if (!flag2 && flag3) {
int expectCreateCount = ++this.fullChunkCreateCount; // Paper
this.fullChunkFuture = chunkStorage.prepareAccessibleChunk(this);
@@ -664,9 +678,33 @@ public class ChunkHolder {
@@ -594,9 +608,33 @@ public class ChunkHolder {
}
public void refreshAccessibility() {
@ -139,18 +164,18 @@ index b9e9bfb6c73cfb309c5d9399817546399b333a12..467449049359c721c27b7cd249b03acc
for (int i = 0; i < this.futures.length(); ++i) {
CompletableFuture<Either<ChunkAccess, ChunkHolder.ChunkLoadingFailure>> completablefuture = (CompletableFuture) this.futures.get(i);
diff --git a/src/main/java/net/minecraft/server/level/ChunkMap.java b/src/main/java/net/minecraft/server/level/ChunkMap.java
index d372fb640e34cd451cf79f5b4e03b47c5cb034ab..d70d977290b07fca61fea965a907c9f60a393ba7 100644
index 4ceeec4bc9faad457c2a3389cbe0ce3353bb54cb..7b5c49f17c2a69a45a77423f89bf7c31cbd26c23 100644
--- a/src/main/java/net/minecraft/server/level/ChunkMap.java
+++ b/src/main/java/net/minecraft/server/level/ChunkMap.java
@@ -97,6 +97,7 @@ import net.minecraft.world.level.levelgen.structure.templatesystem.StructureMana
@@ -100,6 +100,7 @@ import net.minecraft.world.level.levelgen.structure.templatesystem.StructureMana
import net.minecraft.world.level.storage.DimensionDataStorage;
import net.minecraft.world.level.storage.LevelStorageSource;
import net.minecraft.world.phys.Vec3;
+import it.unimi.dsi.fastutil.objects.ObjectRBTreeSet; // Paper
import org.apache.commons.lang3.mutable.MutableBoolean;
import org.apache.commons.lang3.mutable.MutableObject;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
@@ -710,6 +711,64 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
@@ -666,6 +667,64 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
}
@ -215,15 +240,16 @@ index d372fb640e34cd451cf79f5b4e03b47c5cb034ab..d70d977290b07fca61fea965a907c9f6
protected void saveAllChunks(boolean flush) {
if (flush) {
List<ChunkHolder> list = (List) this.visibleChunkMap.values().stream().filter(ChunkHolder::wasAccessibleSinceLastSave).peek(ChunkHolder::refreshAccessibility).collect(Collectors.toList());
@@ -847,6 +906,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
asyncSaveData, chunk);
@@ -761,7 +820,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
int l = 0;
ObjectIterator objectiterator = this.visibleChunkMap.values().iterator();
chunk.setUnsaved(false);
+ chunk.setLastSaved(this.level.getGameTime()); // Paper - track last saved time
}
// Paper end
@@ -884,6 +944,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
- while (l < 20 && shouldKeepTicking.getAsBoolean() && objectiterator.hasNext()) {
+ while (false && l < 20 && shouldKeepTicking.getAsBoolean() && objectiterator.hasNext()) { // Paper - incremental chunk and player saving
if (this.saveChunkIfNeeded((ChunkHolder) objectiterator.next())) {
++l;
}
@@ -803,6 +862,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
this.level.unload(chunk);
}
@ -231,7 +257,15 @@ index d372fb640e34cd451cf79f5b4e03b47c5cb034ab..d70d977290b07fca61fea965a907c9f6
this.lightEngine.updateChunkStatus(ichunkaccess.getPos());
this.lightEngine.tryScheduleUpdate();
@@ -1228,6 +1289,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
@@ -1206,6 +1266,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
asyncSaveData, chunk);
chunk.setUnsaved(false);
+ chunk.setLastSaved(this.level.getGameTime()); // Paper - track last saved time
}
// Paper end
@@ -1215,6 +1276,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
if (!chunk.isUnsaved()) {
return false;
} else {
@ -240,10 +274,10 @@ index d372fb640e34cd451cf79f5b4e03b47c5cb034ab..d70d977290b07fca61fea965a907c9f6
ChunkPos chunkcoordintpair = chunk.getPos();
diff --git a/src/main/java/net/minecraft/server/level/ServerChunkCache.java b/src/main/java/net/minecraft/server/level/ServerChunkCache.java
index 0ce86c72cb829b816ec7bfb8f0d19396e1b12eb6..e5317a994cb9b30293ad54b8fc537f703ef994dc 100644
index c3875acfad91c50a7fec4b1f8e06e8a32e2ea037..3f9366019d19f8fb5f636f1b301c2824a54865cd 100644
--- a/src/main/java/net/minecraft/server/level/ServerChunkCache.java
+++ b/src/main/java/net/minecraft/server/level/ServerChunkCache.java
@@ -836,6 +836,15 @@ public class ServerChunkCache extends ChunkSource {
@@ -825,6 +825,15 @@ public class ServerChunkCache extends ChunkSource {
} // Paper - Timings
}
@ -260,10 +294,10 @@ index 0ce86c72cb829b816ec7bfb8f0d19396e1b12eb6..e5317a994cb9b30293ad54b8fc537f70
public void close() throws IOException {
// CraftBukkit start
diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java
index 320cd209ab725a9ad4d5dff70987d7efabae5798..012ac1089205411a56576b26c90ff9122146725e 100644
index a5f0fe87bd5d75bf9a12ef284b0d635d8f6dd3a1..d55d2627b7e0c847250c551989d438280bef9ab8 100644
--- a/src/main/java/net/minecraft/server/level/ServerLevel.java
+++ b/src/main/java/net/minecraft/server/level/ServerLevel.java
@@ -1050,6 +1050,37 @@ public class ServerLevel extends Level implements WorldGenLevel {
@@ -1055,6 +1055,37 @@ public class ServerLevel extends Level implements WorldGenLevel {
return !this.server.isUnderSpawnProtection(this, pos, player) && this.getWorldBorder().isWithinBounds(pos);
}
@ -298,36 +332,83 @@ index 320cd209ab725a9ad4d5dff70987d7efabae5798..012ac1089205411a56576b26c90ff912
+ }
+ // Paper end
+
public void save(@Nullable ProgressListener progressListener, boolean flush, boolean flag1) {
public void save(@Nullable ProgressListener progressListener, boolean flush, boolean savingDisabled) {
ServerChunkCache chunkproviderserver = this.getChunkSource();
diff --git a/src/main/java/net/minecraft/world/level/chunk/ChunkAccess.java b/src/main/java/net/minecraft/world/level/chunk/ChunkAccess.java
index 12d11a249c759e99568a76c791cc0d65adfcfe94..8393950a0b38ec7897d7643803d5accdb1f983f3 100644
--- a/src/main/java/net/minecraft/world/level/chunk/ChunkAccess.java
+++ b/src/main/java/net/minecraft/world/level/chunk/ChunkAccess.java
@@ -29,6 +29,7 @@ public interface ChunkAccess extends BlockGetter, FeatureAccess {
return GameEventDispatcher.NOOP;
diff --git a/src/main/java/net/minecraft/server/level/ServerPlayer.java b/src/main/java/net/minecraft/server/level/ServerPlayer.java
index 2f13055a39c26fe12d2c1094103186635e536166..4b83617a81db1749faaf49fc3ee77e44846dce1a 100644
--- a/src/main/java/net/minecraft/server/level/ServerPlayer.java
+++ b/src/main/java/net/minecraft/server/level/ServerPlayer.java
@@ -171,6 +171,7 @@ public class ServerPlayer extends Player {
public final int getViewDistance() { return this.getLevel().getChunkSource().chunkMap.viewDistance - 1; } // Paper - placeholder
private static final Logger LOGGER = LogManager.getLogger();
+ public long lastSave = MinecraftServer.currentTick; // Paper
private static final int NEUTRAL_MOB_DEATH_NOTIFICATION_RADII_XZ = 32;
private static final int NEUTRAL_MOB_DEATH_NOTIFICATION_RADII_Y = 10;
public ServerGamePacketListenerImpl connection;
diff --git a/src/main/java/net/minecraft/server/players/PlayerList.java b/src/main/java/net/minecraft/server/players/PlayerList.java
index 30fa9ac91be2ecc55efeee9222835cbedc53acff..a40ca089d92df8f3ea0a444e3293531e787b196b 100644
--- a/src/main/java/net/minecraft/server/players/PlayerList.java
+++ b/src/main/java/net/minecraft/server/players/PlayerList.java
@@ -556,6 +556,7 @@ public abstract class PlayerList {
protected void save(ServerPlayer player) {
if (!player.getBukkitEntity().isPersistent()) return; // CraftBukkit
if (!player.didPlayerJoinEvent) return; // Paper - If we never fired PJE, we disconnected during login. Data has not changed, and additionally, our saved vehicle is not loaded! If we save now, we will lose our vehicle (CraftBukkit bug)
+ player.lastSave = MinecraftServer.currentTick; // Paper
this.playerIo.save(player);
ServerStatsCounter serverstatisticmanager = (ServerStatsCounter) player.getStats(); // CraftBukkit
@@ -1158,10 +1159,22 @@ public abstract class PlayerList {
}
+ default void setLastSaved(long ticks) {}
// Paper start
default boolean generateFlatBedrock() {
if (this.getLevel() != null) {
public void saveAll() {
+ // Paper start - incremental player saving
+ this.saveAll(-1);
+ }
+
+ public void saveAll(int interval) {
net.minecraft.server.MCUtil.ensureMain("Save Players" , () -> { // Paper - Ensure main
MinecraftTimings.savePlayers.startTiming(); // Paper
+ int numSaved = 0;
+ long now = MinecraftServer.currentTick;
for (int i = 0; i < this.players.size(); ++i) {
- this.save(this.players.get(i));
+ ServerPlayer entityplayer = this.players.get(i);
+ if (interval == -1 || now - entityplayer.lastSave >= interval) {
+ this.save(entityplayer);
+ if (interval != -1 && ++numSaved <= com.destroystokyo.paper.PaperConfig.maxPlayerAutoSavePerTick) { break; }
+ }
+ // Paper end
}
MinecraftTimings.savePlayers.stopTiming(); // Paper
return null; }); // Paper - ensure main
diff --git a/src/main/java/net/minecraft/world/level/chunk/ChunkAccess.java b/src/main/java/net/minecraft/world/level/chunk/ChunkAccess.java
index 04b58d6aec04cc98777f88c2bcc9a820c5fd2f57..a44901edc49259ebbbb4367b0d10b8daa76b07cd 100644
--- a/src/main/java/net/minecraft/world/level/chunk/ChunkAccess.java
+++ b/src/main/java/net/minecraft/world/level/chunk/ChunkAccess.java
@@ -451,6 +451,7 @@ public abstract class ChunkAccess implements BlockGetter, BiomeManager.NoiseBiom
public LevelHeightAccessor getHeightAccessorForGeneration() {
return this;
}
+ public void setLastSaved(long ticks) {} // Paper
// CraftBukkit start - decompile error
public static record TicksToSave(SerializableTickContainer<Block> blocks, SerializableTickContainer<Fluid> fluids) {
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 1de1566b76c73ddfaf7e022296068db02044d5f3..a84b75a53a0324fab9aeb9b80bf74eb0a84ecd2e 100644
index b92da719a5d35a60a2e13ccb0f55c41b242f9b50..6a881c2abdbc23366a1b0ac69e363b196b99197b 100644
--- a/src/main/java/net/minecraft/world/level/chunk/LevelChunk.java
+++ b/src/main/java/net/minecraft/world/level/chunk/LevelChunk.java
@@ -108,6 +108,13 @@ public class LevelChunk implements ChunkAccess {
private final ShortList[] postProcessing;
private TickList<Block> blockTicks;
private TickList<Fluid> liquidTicks;
@@ -87,6 +87,12 @@ public class LevelChunk extends ChunkAccess {
private final Int2ObjectMap<GameEventDispatcher> gameEventDispatcherSections;
private final LevelChunkTicks<Block> blockTicks;
private final LevelChunkTicks<Fluid> fluidTicks;
+ // Paper start - track last save time
+ public long lastSaveTime;
+ @Override
+ public void setLastSaved(long ticks) {
+ this.lastSaveTime = ticks;
+ }
+ // Paper end
private volatile boolean unsaved;
private long inhabitedTime;
@Nullable
public LevelChunk(Level world, ChunkPos pos) {
this(world, pos, UpgradeData.EMPTY, new LevelChunkTicks<>(), new LevelChunkTicks<>(), 0L, (LevelChunkSection[]) null, (LevelChunk.PostLoadProcessor) null, (BlendingData) null);

View File

@ -5,7 +5,7 @@ Subject: [PATCH] Spawn player in correct world on login
diff --git a/src/main/java/net/minecraft/server/players/PlayerList.java b/src/main/java/net/minecraft/server/players/PlayerList.java
index 30fa9ac91be2ecc55efeee9222835cbedc53acff..4710c9d12feb12b75c497373c172ce0d4f4ab96e 100644
index a40ca089d92df8f3ea0a444e3293531e787b196b..ed4e13528cf0fe48384efcb3f55cb5149f4cf681 100644
--- a/src/main/java/net/minecraft/server/players/PlayerList.java
+++ b/src/main/java/net/minecraft/server/players/PlayerList.java
@@ -196,7 +196,18 @@ public abstract class PlayerList {

View File

@ -80,7 +80,7 @@ index 2fe519d4059fac06781c30e140895b604e13104f..35949e9c15eb998aa89842d34d0999cd
chunkData.addProperty("queued-for-unload", chunkMap.toDrop.contains(playerChunk.pos.longKey));
chunkData.addProperty("status", status == null ? "unloaded" : status.toString());
diff --git a/src/main/java/net/minecraft/server/level/ChunkHolder.java b/src/main/java/net/minecraft/server/level/ChunkHolder.java
index 347cf5d00d986ae8ad60af7f6eabde9fbfd78561..64fa9affc32057f09268a6f92dbc88c9decd6ed8 100644
index bab59dc2747a24ce6b48c8f962f81c50a316d89e..05814028d205f7a1e468bdaaae9e9916047ff4ce 100644
--- a/src/main/java/net/minecraft/server/level/ChunkHolder.java
+++ b/src/main/java/net/minecraft/server/level/ChunkHolder.java
@@ -57,7 +57,7 @@ public class ChunkHolder {
@ -100,7 +100,7 @@ index 347cf5d00d986ae8ad60af7f6eabde9fbfd78561..64fa9affc32057f09268a6f92dbc88c9
boolean isUpdateQueued = false; // Paper
private final ChunkMap chunkMap; // Paper
@@ -407,12 +408,18 @@ public class ChunkHolder {
@@ -409,12 +410,18 @@ public class ChunkHolder {
});
}
@ -119,7 +119,7 @@ index 347cf5d00d986ae8ad60af7f6eabde9fbfd78561..64fa9affc32057f09268a6f92dbc88c9
ChunkStatus chunkstatus = ChunkHolder.getStatus(this.oldTicketLevel);
ChunkStatus chunkstatus1 = ChunkHolder.getStatus(this.ticketLevel);
boolean flag = this.oldTicketLevel <= ChunkMap.MAX_CHUNK_DISTANCE;
@@ -423,9 +430,22 @@ public class ChunkHolder {
@@ -425,9 +432,22 @@ public class ChunkHolder {
// ChunkUnloadEvent: Called before the chunk is unloaded: isChunkLoaded is still true and chunk can still be modified by plugins.
if (playerchunk_state.isOrAfter(ChunkHolder.FullChunkStatus.BORDER) && !playerchunk_state1.isOrAfter(ChunkHolder.FullChunkStatus.BORDER)) {
this.getFutureIfPresentUnchecked(ChunkStatus.FULL).thenAccept((either) -> {
@ -143,7 +143,7 @@ index 347cf5d00d986ae8ad60af7f6eabde9fbfd78561..64fa9affc32057f09268a6f92dbc88c9
// Minecraft will apply the chunks tick lists to the world once the chunk got loaded, and then store the tick
// lists again inside the chunk once the chunk becomes inaccessible and set the chunk's needsSaving flag.
// These actions may however happen deferred, so we manually set the needsSaving flag already here.
@@ -470,12 +490,14 @@ public class ChunkHolder {
@@ -484,12 +504,14 @@ public class ChunkHolder {
this.scheduleFullChunkPromotion(chunkStorage, this.fullChunkFuture, executor, ChunkHolder.FullChunkStatus.BORDER);
// Paper start - cache ticking ready status
this.fullChunkFuture.thenAccept(either -> {
@ -158,7 +158,7 @@ index 347cf5d00d986ae8ad60af7f6eabde9fbfd78561..64fa9affc32057f09268a6f92dbc88c9
}
});
this.updateChunkToSave(this.fullChunkFuture, "full");
@@ -496,6 +518,7 @@ public class ChunkHolder {
@@ -510,6 +532,7 @@ public class ChunkHolder {
this.scheduleFullChunkPromotion(chunkStorage, this.tickingChunkFuture, executor, ChunkHolder.FullChunkStatus.TICKING);
// Paper start - cache ticking ready status
this.tickingChunkFuture.thenAccept(either -> {
@ -166,7 +166,7 @@ index 347cf5d00d986ae8ad60af7f6eabde9fbfd78561..64fa9affc32057f09268a6f92dbc88c9
either.ifLeft(chunk -> {
// note: Here is a very good place to add callbacks to logic waiting on this.
ChunkHolder.this.isTickingReady = true;
@@ -531,6 +554,7 @@ public class ChunkHolder {
@@ -545,6 +568,7 @@ public class ChunkHolder {
this.scheduleFullChunkPromotion(chunkStorage, this.entityTickingChunkFuture, executor, ChunkHolder.FullChunkStatus.ENTITY_TICKING);
// Paper start - cache ticking ready status
this.entityTickingChunkFuture.thenAccept(either -> {
@ -174,7 +174,7 @@ index 347cf5d00d986ae8ad60af7f6eabde9fbfd78561..64fa9affc32057f09268a6f92dbc88c9
either.ifLeft(chunk -> {
ChunkHolder.this.isEntityTickingReady = true;
// Paper start - entity ticking chunk set
@@ -557,16 +581,45 @@ public class ChunkHolder {
@@ -571,16 +595,45 @@ public class ChunkHolder {
this.demoteFullChunk(chunkStorage, playerchunk_state1);
}
@ -223,7 +223,7 @@ index 347cf5d00d986ae8ad60af7f6eabde9fbfd78561..64fa9affc32057f09268a6f92dbc88c9
});
}
}).exceptionally((throwable) -> {
@@ -657,7 +710,134 @@ public class ChunkHolder {
@@ -695,7 +748,134 @@ public class ChunkHolder {
};
}
@ -360,10 +360,10 @@ index 347cf5d00d986ae8ad60af7f6eabde9fbfd78561..64fa9affc32057f09268a6f92dbc88c9
return this.isEntityTickingReady;
}
diff --git a/src/main/java/net/minecraft/server/level/ChunkMap.java b/src/main/java/net/minecraft/server/level/ChunkMap.java
index 0bd55c5a43bfed7d5c80f6859b2827b7da3d0804..373ac9909666302fd6b9c6891866a9baf3977316 100644
index 771f34b8a8b4d46343264be59da47ed4bb4cfdf5..d3d5041bddafd03e053c1bc04883c67d7d98556f 100644
--- a/src/main/java/net/minecraft/server/level/ChunkMap.java
+++ b/src/main/java/net/minecraft/server/level/ChunkMap.java
@@ -126,6 +126,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
@@ -127,6 +127,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
public final ServerLevel level;
private final ThreadedLevelLightEngine lightEngine;
private final BlockableEventLoop<Runnable> mainThreadExecutor;
@ -371,7 +371,7 @@ index 0bd55c5a43bfed7d5c80f6859b2827b7da3d0804..373ac9909666302fd6b9c6891866a9ba
public ChunkGenerator generator;
public final Supplier<DimensionDataStorage> overworldDataStorage;
private final PoiManager poiManager;
@@ -300,6 +301,15 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
@@ -301,6 +302,15 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
this.level = world;
this.generator = chunkGenerator;
this.mainThreadExecutor = mainThreadExecutor;
@ -387,7 +387,7 @@ index 0bd55c5a43bfed7d5c80f6859b2827b7da3d0804..373ac9909666302fd6b9c6891866a9ba
ProcessorMailbox<Runnable> threadedmailbox = ProcessorMailbox.create(executor, "worldgen");
Objects.requireNonNull(mainThreadExecutor);
@@ -411,6 +421,37 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
@@ -412,6 +422,37 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
});
}
@ -425,7 +425,7 @@ index 0bd55c5a43bfed7d5c80f6859b2827b7da3d0804..373ac9909666302fd6b9c6891866a9ba
// Paper start
public void updatePlayerMobTypeMap(Entity entity) {
if (!this.level.paperConfig.perPlayerMobSpawns) {
@@ -552,6 +593,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
@@ -553,6 +594,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
List<CompletableFuture<Either<ChunkAccess, ChunkHolder.ChunkLoadingFailure>>> list = Lists.newArrayList();
int j = centerChunk.x;
int k = centerChunk.z;
@ -433,7 +433,7 @@ index 0bd55c5a43bfed7d5c80f6859b2827b7da3d0804..373ac9909666302fd6b9c6891866a9ba
for (int l = -margin; l <= margin; ++l) {
for (int i1 = -margin; i1 <= margin; ++i1) {
@@ -570,6 +612,14 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
@@ -571,6 +613,14 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
ChunkStatus chunkstatus = (ChunkStatus) distanceToStatus.apply(j1);
CompletableFuture<Either<ChunkAccess, ChunkHolder.ChunkLoadingFailure>> completablefuture = playerchunk.getOrScheduleFuture(chunkstatus, this);
@ -448,7 +448,7 @@ index 0bd55c5a43bfed7d5c80f6859b2827b7da3d0804..373ac9909666302fd6b9c6891866a9ba
list.add(completablefuture);
}
@@ -842,11 +892,19 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
@@ -902,11 +952,19 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
if (requiredStatus == ChunkStatus.EMPTY) {
return this.scheduleChunkLoad(chunkcoordintpair);
} else {
@ -469,7 +469,7 @@ index 0bd55c5a43bfed7d5c80f6859b2827b7da3d0804..373ac9909666302fd6b9c6891866a9ba
if (optional.isPresent() && ((ChunkAccess) optional.get()).getStatus().isOrAfter(requiredStatus)) {
CompletableFuture<Either<ChunkAccess, ChunkHolder.ChunkLoadingFailure>> completablefuture = requiredStatus.load(this.level, this.structureManager, this.lightEngine, (ichunkaccess) -> {
@@ -858,6 +916,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
@@ -918,6 +976,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
} else {
return this.scheduleChunkGeneration(holder, requiredStatus);
}
@ -477,7 +477,7 @@ index 0bd55c5a43bfed7d5c80f6859b2827b7da3d0804..373ac9909666302fd6b9c6891866a9ba
}
}
@@ -914,14 +973,24 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
@@ -974,14 +1033,24 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
};
CompletableFuture<CompoundTag> chunkSaveFuture = this.level.asyncChunkTaskManager.getChunkSaveFuture(pos.x, pos.z);
@ -507,7 +507,7 @@ index 0bd55c5a43bfed7d5c80f6859b2827b7da3d0804..373ac9909666302fd6b9c6891866a9ba
return ret;
// Paper end
}
@@ -973,7 +1042,10 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
@@ -1033,7 +1102,10 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
this.releaseLightTicket(chunkcoordintpair);
return CompletableFuture.completedFuture(Either.right(playerchunk_failure));
});
@ -519,7 +519,7 @@ index 0bd55c5a43bfed7d5c80f6859b2827b7da3d0804..373ac9909666302fd6b9c6891866a9ba
}
protected void releaseLightTicket(ChunkPos pos) {
@@ -1057,7 +1129,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
@@ -1117,7 +1189,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
long i = chunkHolder.getPos().toLong();
Objects.requireNonNull(chunkHolder);
@ -711,7 +711,7 @@ index 84dc1e94b4f7b8315d8422634dd49b1f85044d18..451d5e9b5906e662a0c2e04b407068ea
Ticket<ChunkPos> ticket = new Ticket<>(TicketType.FORCED, 31, pos);
long i = pos.toLong();
diff --git a/src/main/java/net/minecraft/server/level/ServerChunkCache.java b/src/main/java/net/minecraft/server/level/ServerChunkCache.java
index c3875acfad91c50a7fec4b1f8e06e8a32e2ea037..ca3ccf2631587a896f6b909d63889708e6f72f27 100644
index 3f9366019d19f8fb5f636f1b301c2824a54865cd..58c22ed8e37b22b3b304139b1746b5bc8ba6f45a 100644
--- a/src/main/java/net/minecraft/server/level/ServerChunkCache.java
+++ b/src/main/java/net/minecraft/server/level/ServerChunkCache.java
@@ -601,6 +601,26 @@ public class ServerChunkCache extends ChunkSource {
@ -796,10 +796,10 @@ index c3875acfad91c50a7fec4b1f8e06e8a32e2ea037..ca3ccf2631587a896f6b909d63889708
boolean flag1 = this.chunkMap.promoteChunkMap();
diff --git a/src/main/java/net/minecraft/server/level/ServerPlayer.java b/src/main/java/net/minecraft/server/level/ServerPlayer.java
index 2f13055a39c26fe12d2c1094103186635e536166..84f78e2b3bf51eae1d486852464df032861c5a0b 100644
index 4b83617a81db1749faaf49fc3ee77e44846dce1a..968b8180f92066a43f06bff8dd1d49b03bd08f5b 100644
--- a/src/main/java/net/minecraft/server/level/ServerPlayer.java
+++ b/src/main/java/net/minecraft/server/level/ServerPlayer.java
@@ -185,6 +185,7 @@ public class ServerPlayer extends Player {
@@ -186,6 +186,7 @@ public class ServerPlayer extends Player {
private int lastRecordedArmor = Integer.MIN_VALUE;
private int lastRecordedLevel = Integer.MIN_VALUE;
private int lastRecordedExperience = Integer.MIN_VALUE;
@ -807,7 +807,7 @@ index 2f13055a39c26fe12d2c1094103186635e536166..84f78e2b3bf51eae1d486852464df032
private float lastSentHealth = -1.0E8F;
private int lastSentFood = -99999999;
private boolean lastFoodSaturationZero = true;
@@ -328,6 +329,21 @@ public class ServerPlayer extends Player {
@@ -329,6 +330,21 @@ public class ServerPlayer extends Player {
this.maxHealthCache = this.getMaxHealth();
this.cachedSingleMobDistanceMap = new com.destroystokyo.paper.util.PooledHashSets.PooledObjectLinkedOpenHashSet<>(this); // Paper
}
@ -1128,7 +1128,7 @@ index 8770fe0db46b01e8b608637df4f1a669a3f4cdde..3c1698ba0d3bc412ab957777d9b5211d
private final String name;
private final Comparator<T> comparator;
diff --git a/src/main/java/net/minecraft/server/players/PlayerList.java b/src/main/java/net/minecraft/server/players/PlayerList.java
index 4710c9d12feb12b75c497373c172ce0d4f4ab96e..338e89a2951f6f79d4dd7abf0b378b6e2ddf1f58 100644
index ed4e13528cf0fe48384efcb3f55cb5149f4cf681..55b7036a7b7fe45f2b8694bf8ab039d92de1c3bb 100644
--- a/src/main/java/net/minecraft/server/players/PlayerList.java
+++ b/src/main/java/net/minecraft/server/players/PlayerList.java
@@ -175,6 +175,7 @@ public abstract class PlayerList {
@ -1164,10 +1164,10 @@ index fb2d5c768b7dc5255db7dc7199ed750809a8fb94..9b254d00eb0cf0c4d4fe73e7a955b0b6
public float yRotO;
public float xRotO;
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 b92da719a5d35a60a2e13ccb0f55c41b242f9b50..875977f11678b34465abac30463675f57cf9fc4e 100644
index 6a881c2abdbc23366a1b0ac69e363b196b99197b..ddf362fc14fcf83b22536b76cfc6ac1387b4c57a 100644
--- a/src/main/java/net/minecraft/world/level/chunk/LevelChunk.java
+++ b/src/main/java/net/minecraft/world/level/chunk/LevelChunk.java
@@ -137,7 +137,7 @@ public class LevelChunk extends ChunkAccess {
@@ -143,7 +143,7 @@ public class LevelChunk extends ChunkAccess {
return NEIGHBOUR_CACHE_RADIUS;
}
@ -1176,7 +1176,7 @@ index b92da719a5d35a60a2e13ccb0f55c41b242f9b50..875977f11678b34465abac30463675f5
private long neighbourChunksLoadedBitset;
private final LevelChunk[] loadedNeighbourChunks = new LevelChunk[(NEIGHBOUR_CACHE_RADIUS * 2 + 1) * (NEIGHBOUR_CACHE_RADIUS * 2 + 1)];
@@ -675,6 +675,7 @@ public class LevelChunk extends ChunkAccess {
@@ -681,6 +681,7 @@ public class LevelChunk extends ChunkAccess {
// CraftBukkit start
public void loadCallback() {
@ -1184,7 +1184,7 @@ index b92da719a5d35a60a2e13ccb0f55c41b242f9b50..875977f11678b34465abac30463675f5
// Paper start - neighbour cache
int chunkX = this.chunkPos.x;
int chunkZ = this.chunkPos.z;
@@ -729,6 +730,7 @@ public class LevelChunk extends ChunkAccess {
@@ -735,6 +736,7 @@ public class LevelChunk extends ChunkAccess {
}
public void unloadCallback() {

View File

@ -10,7 +10,7 @@ This fixes that by checking if the modified spawn location is
still at a respawn anchor.
diff --git a/src/main/java/net/minecraft/server/players/PlayerList.java b/src/main/java/net/minecraft/server/players/PlayerList.java
index 338e89a2951f6f79d4dd7abf0b378b6e2ddf1f58..2320731041fdef4eb29888a55e11126fb345d9ea 100644
index 55b7036a7b7fe45f2b8694bf8ab039d92de1c3bb..e655c806504d6e127e15dca479271d9b211975a3 100644
--- a/src/main/java/net/minecraft/server/players/PlayerList.java
+++ b/src/main/java/net/minecraft/server/players/PlayerList.java
@@ -78,6 +78,7 @@ import net.minecraft.world.level.GameRules;
@ -21,7 +21,7 @@ index 338e89a2951f6f79d4dd7abf0b378b6e2ddf1f58..2320731041fdef4eb29888a55e11126f
import net.minecraft.world.level.block.state.BlockState;
import net.minecraft.world.level.border.BorderChangeListener;
import net.minecraft.world.level.border.WorldBorder;
@@ -829,6 +830,7 @@ public abstract class PlayerList {
@@ -830,6 +831,7 @@ public abstract class PlayerList {
// Paper start
boolean isBedSpawn = false;
boolean isRespawn = false;
@ -29,7 +29,7 @@ index 338e89a2951f6f79d4dd7abf0b378b6e2ddf1f58..2320731041fdef4eb29888a55e11126f
// Paper end
// CraftBukkit start - fire PlayerRespawnEvent
@@ -839,7 +841,7 @@ public abstract class PlayerList {
@@ -840,7 +842,7 @@ public abstract class PlayerList {
Optional optional;
if (blockposition != null) {
@ -38,7 +38,7 @@ index 338e89a2951f6f79d4dd7abf0b378b6e2ddf1f58..2320731041fdef4eb29888a55e11126f
} else {
optional = Optional.empty();
}
@@ -883,7 +885,12 @@ public abstract class PlayerList {
@@ -884,7 +886,12 @@ public abstract class PlayerList {
}
// Spigot End
@ -52,7 +52,7 @@ index 338e89a2951f6f79d4dd7abf0b378b6e2ddf1f58..2320731041fdef4eb29888a55e11126f
if (!flag) entityplayer.reset(); // SPIGOT-4785
isRespawn = true; // Paper
} else {
@@ -921,8 +928,12 @@ public abstract class PlayerList {
@@ -922,8 +929,12 @@ public abstract class PlayerList {
}
// entityplayer1.initInventoryMenu();
entityplayer1.setHealth(entityplayer1.getHealth());

View File

@ -5,7 +5,7 @@ Subject: [PATCH] Add #setMaxPlayers API
diff --git a/src/main/java/net/minecraft/server/players/PlayerList.java b/src/main/java/net/minecraft/server/players/PlayerList.java
index 2320731041fdef4eb29888a55e11126fb345d9ea..310bed27c04ef812aa8607c9dca789db13341d25 100644
index e655c806504d6e127e15dca479271d9b211975a3..5c829538a008f1a737380627f7b88c7a0914050f 100644
--- a/src/main/java/net/minecraft/server/players/PlayerList.java
+++ b/src/main/java/net/minecraft/server/players/PlayerList.java
@@ -144,7 +144,7 @@ public abstract class PlayerList {

View File

@ -5,10 +5,10 @@ Subject: [PATCH] Fix SpawnChangeEvent not firing for all use-cases
diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java
index a5f0fe87bd5d75bf9a12ef284b0d635d8f6dd3a1..64f5901049258c327e3fef8723da58756ce05cc6 100644
index d55d2627b7e0c847250c551989d438280bef9ab8..5c98b61c08464cc78be34d1567eff7005f6ab2df 100644
--- a/src/main/java/net/minecraft/server/level/ServerLevel.java
+++ b/src/main/java/net/minecraft/server/level/ServerLevel.java
@@ -1689,6 +1689,7 @@ public class ServerLevel extends Level implements WorldGenLevel {
@@ -1720,6 +1720,7 @@ public class ServerLevel extends Level implements WorldGenLevel {
//ChunkCoordIntPair chunkcoordintpair = new ChunkCoordIntPair(new BlockPosition(this.worldData.a(), 0, this.worldData.c()));
this.levelData.setSpawn(pos, angle);

View File

@ -36,13 +36,13 @@ scenario / path:
Previously would have hopped to SERVER around 12+ times there extra.
diff --git a/src/main/java/net/minecraft/server/level/ChunkHolder.java b/src/main/java/net/minecraft/server/level/ChunkHolder.java
index 64fa9affc32057f09268a6f92dbc88c9decd6ed8..6782e2b100b1619016c637a9e71f9e880ff974e1 100644
index 05814028d205f7a1e468bdaaae9e9916047ff4ce..8950470bbaa57ac0ef6ca4d6e3796a712e0b6cd6 100644
--- a/src/main/java/net/minecraft/server/level/ChunkHolder.java
+++ b/src/main/java/net/minecraft/server/level/ChunkHolder.java
@@ -85,6 +85,13 @@ public class ChunkHolder {
this.playersInChunkTickRange = this.chunkMap.playerChunkTickRangeMap.getObjectsInRange(key);
}
@@ -87,6 +87,13 @@ public class ChunkHolder {
// Paper end - optimise isOutsideOfRange
long lastAutoSaveTime; // Paper - incremental autosave
long inactiveTimeStart; // Paper - incremental autosave
+ // Paper start - optimize chunk status progression without jumping through thread pool
+ public boolean canAdvanceStatus() {
+ ChunkStatus status = getChunkHolderStatus();
@ -54,10 +54,10 @@ index 64fa9affc32057f09268a6f92dbc88c9decd6ed8..6782e2b100b1619016c637a9e71f9e88
public ChunkHolder(ChunkPos pos, int level, LevelHeightAccessor world, LevelLightEngine lightingProvider, ChunkHolder.LevelChangeListener levelUpdateListener, ChunkHolder.PlayerProvider playersWatchingChunkProvider) {
this.futures = new AtomicReferenceArray(ChunkHolder.CHUNK_STATUSES.size());
diff --git a/src/main/java/net/minecraft/server/level/ChunkMap.java b/src/main/java/net/minecraft/server/level/ChunkMap.java
index 373ac9909666302fd6b9c6891866a9baf3977316..c637a9b0a978700a0cd941be22208ae3c01f6eb2 100644
index d3d5041bddafd03e053c1bc04883c67d7d98556f..b75ad5ee074489e3c66ef6524106241c6d577916 100644
--- a/src/main/java/net/minecraft/server/level/ChunkMap.java
+++ b/src/main/java/net/minecraft/server/level/ChunkMap.java
@@ -662,7 +662,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
@@ -663,7 +663,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
return either.mapLeft((list) -> {
return (LevelChunk) list.get(list.size() / 2);
});
@ -66,7 +66,7 @@ index 373ac9909666302fd6b9c6891866a9baf3977316..c637a9b0a978700a0cd941be22208ae3
}
@Nullable
@@ -1013,6 +1013,12 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
@@ -1073,6 +1073,12 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
return "chunkGenerate " + requiredStatus.getName();
});
Executor executor = (runnable) -> {

View File

@ -6,13 +6,14 @@ Subject: [PATCH] Prevent headless pistons from being created
Prevent headless pistons from being created by explosions or tree/mushroom growth.
diff --git a/src/main/java/com/destroystokyo/paper/PaperConfig.java b/src/main/java/com/destroystokyo/paper/PaperConfig.java
index ebbbffd209c6796bc608992e293035141a122d1f..fdd8bf9eb44829c41483cf2de4c977a32face97f 100644
index 4fb6b2153117f54a2b0ca940de4c0ee2fa85e20e..09755771f8a3b2f696dc9c33916546fc1d5ac4ba 100644
--- a/src/main/java/com/destroystokyo/paper/PaperConfig.java
+++ b/src/main/java/com/destroystokyo/paper/PaperConfig.java
@@ -458,4 +458,9 @@ public class PaperConfig {
set("settings.unsupported-settings.allow-tnt-duplication", null);
@@ -468,4 +468,10 @@ public class PaperConfig {
maxPlayerAutoSavePerTick = (playerAutoSaveRate == -1 || playerAutoSaveRate > 100) ? 10 : 20;
}
}
+
+ public static boolean allowHeadlessPistons;
+ private static void allowHeadlessPistons() {
+ config.set("settings.unsupported-settings.allow-headless-pistons-readme", "This setting controls if players should be able to create headless pistons.");

View File

@ -5,7 +5,7 @@ Subject: [PATCH] Add zombie targets turtle egg config
diff --git a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
index 845f105457d659a4bd88d4a8ce91b20d6abb7865..0521d5f9eba13ade77b578dd4eb5addd267dd4b9 100644
index bf0c6e1b2b1934bc3fa5c17c414b3730c5ac0833..fc788071f01310647a227d12c81dc62a43e64ef5 100644
--- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
+++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
@@ -56,6 +56,11 @@ public class PaperWorldConfig {

View File

@ -8,7 +8,7 @@ the world per tick, this attempts to reduce the impact that join floods
has on the server
diff --git a/src/main/java/com/destroystokyo/paper/PaperConfig.java b/src/main/java/com/destroystokyo/paper/PaperConfig.java
index fdd8bf9eb44829c41483cf2de4c977a32face97f..9a66cddbf9863aa6ff566a337153883c07c08e41 100644
index 09755771f8a3b2f696dc9c33916546fc1d5ac4ba..16d6ce24031590ff9dfba5c938aeb9755704798d 100644
--- a/src/main/java/com/destroystokyo/paper/PaperConfig.java
+++ b/src/main/java/com/destroystokyo/paper/PaperConfig.java
@@ -91,6 +91,11 @@ public class PaperConfig {

View File

@ -19,7 +19,7 @@ Aside from making the obvious class/function renames and obfhelpers I didn't nee
Just added Bukkit's event system and took a few liberties with dead code and comment misspellings.
diff --git a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
index 0521d5f9eba13ade77b578dd4eb5addd267dd4b9..bc93318246eab1da5462aa3fa0cde4c100622f4e 100644
index fc788071f01310647a227d12c81dc62a43e64ef5..aee981e967bfb32a531d5d79213c5d165bb64ad0 100644
--- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
+++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
@@ -61,6 +61,16 @@ public class PaperWorldConfig {

View File

@ -1,126 +0,0 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Aikar <aikar@aikar.co>
Date: Sun, 9 Aug 2020 08:59:25 +0300
Subject: [PATCH] Incremental player saving
diff --git a/src/main/java/com/destroystokyo/paper/PaperConfig.java b/src/main/java/com/destroystokyo/paper/PaperConfig.java
index 9a66cddbf9863aa6ff566a337153883c07c08e41..b6c7aec1516a4db4fde8c9ec2772cd982ed5e304 100644
--- a/src/main/java/com/destroystokyo/paper/PaperConfig.java
+++ b/src/main/java/com/destroystokyo/paper/PaperConfig.java
@@ -468,4 +468,15 @@ public class PaperConfig {
config.set("settings.unsupported-settings.allow-headless-pistons-readme", "This setting controls if players should be able to create headless pistons.");
allowHeadlessPistons = getBoolean("settings.unsupported-settings.allow-headless-pistons", false);
}
+
+ public static int playerAutoSaveRate = -1;
+ public static int maxPlayerAutoSavePerTick = 10;
+ private static void playerAutoSaveRate() {
+ playerAutoSaveRate = getInt("settings.player-auto-save-rate", -1);
+ maxPlayerAutoSavePerTick = getInt("settings.max-player-auto-save-per-tick", -1);
+ if (maxPlayerAutoSavePerTick == -1) { // -1 Automatic / "Recommended"
+ // 10 should be safe for everyone unless you mass spamming player auto save
+ maxPlayerAutoSavePerTick = (playerAutoSaveRate == -1 || playerAutoSaveRate > 100) ? 10 : 20;
+ }
+ }
}
diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java
index 4351dd9c293d1db48c87c5df28bcb2b9a59583f7..7f733bd666e42f8ba80bfda233f662564bfc0e24 100644
--- a/src/main/java/net/minecraft/server/MinecraftServer.java
+++ b/src/main/java/net/minecraft/server/MinecraftServer.java
@@ -896,12 +896,17 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
return flag3;
}
+ // Paper start
public boolean saveEverything(boolean suppressLogs, boolean flush, boolean force) {
+ return saveEverything(suppressLogs, flush, force, -1);
+ }
+ public boolean saveEverything(boolean suppressLogs, boolean flush, boolean force, int playerSaveInterval) {
+ // Paper end
boolean flag3;
try {
this.isSaving = true;
- this.getPlayerList().saveAll();
+ this.getPlayerList().saveAll(playerSaveInterval); // Paper
flag3 = this.saveAllChunks(suppressLogs, flush, force);
} finally {
this.isSaving = false;
@@ -963,7 +968,6 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
this.isSaving = true;
if (this.playerList != null) {
MinecraftServer.LOGGER.info("Saving players");
- this.playerList.saveAll();
this.playerList.removeAll(this.isRestarting); // Paper
try { Thread.sleep(100); } catch (InterruptedException ex) {} // CraftBukkit - SPIGOT-625 - give server at least a chance to send packets
}
@@ -1408,13 +1412,19 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
}
}
+ // Paper start
+ int playerSaveInterval = com.destroystokyo.paper.PaperConfig.playerAutoSaveRate;
+ if (playerSaveInterval < 0) {
+ playerSaveInterval = autosavePeriod;
+ }
+ // Paper end
if (this.autosavePeriod > 0 && this.tickCount % this.autosavePeriod == 0) { // CraftBukkit
MinecraftServer.LOGGER.debug("Autosave started");
this.profiler.push("save");
- this.saveEverything(true, false, false);
+ this.saveEverything(true, false, false, playerSaveInterval); // Paper
this.profiler.pop();
MinecraftServer.LOGGER.debug("Autosave finished");
- }
+ } else this.getPlayerList().saveAll(playerSaveInterval); // Paper
io.papermc.paper.util.CachedLists.reset(); // Paper
// Paper start - move executeAll() into full server tick timing
try (co.aikar.timings.Timing ignored = MinecraftTimings.processTasksTimer.startTiming()) {
diff --git a/src/main/java/net/minecraft/server/level/ServerPlayer.java b/src/main/java/net/minecraft/server/level/ServerPlayer.java
index 84f78e2b3bf51eae1d486852464df032861c5a0b..968b8180f92066a43f06bff8dd1d49b03bd08f5b 100644
--- a/src/main/java/net/minecraft/server/level/ServerPlayer.java
+++ b/src/main/java/net/minecraft/server/level/ServerPlayer.java
@@ -171,6 +171,7 @@ public class ServerPlayer extends Player {
public final int getViewDistance() { return this.getLevel().getChunkSource().chunkMap.viewDistance - 1; } // Paper - placeholder
private static final Logger LOGGER = LogManager.getLogger();
+ public long lastSave = MinecraftServer.currentTick; // Paper
private static final int NEUTRAL_MOB_DEATH_NOTIFICATION_RADII_XZ = 32;
private static final int NEUTRAL_MOB_DEATH_NOTIFICATION_RADII_Y = 10;
public ServerGamePacketListenerImpl connection;
diff --git a/src/main/java/net/minecraft/server/players/PlayerList.java b/src/main/java/net/minecraft/server/players/PlayerList.java
index 310bed27c04ef812aa8607c9dca789db13341d25..2cd1dace84b6e821df69d28aa7cdb7ff41c8f076 100644
--- a/src/main/java/net/minecraft/server/players/PlayerList.java
+++ b/src/main/java/net/minecraft/server/players/PlayerList.java
@@ -569,6 +569,7 @@ public abstract class PlayerList {
protected void save(ServerPlayer player) {
if (!player.getBukkitEntity().isPersistent()) return; // CraftBukkit
if (!player.didPlayerJoinEvent) return; // Paper - If we never fired PJE, we disconnected during login. Data has not changed, and additionally, our saved vehicle is not loaded! If we save now, we will lose our vehicle (CraftBukkit bug)
+ player.lastSave = MinecraftServer.currentTick; // Paper
this.playerIo.save(player);
ServerStatsCounter serverstatisticmanager = (ServerStatsCounter) player.getStats(); // CraftBukkit
@@ -1181,10 +1182,21 @@ public abstract class PlayerList {
}
public void saveAll() {
+ // Paper start - incremental player saving
+ saveAll(-1);
+ }
+ public void saveAll(int interval) {
net.minecraft.server.MCUtil.ensureMain("Save Players" , () -> { // Paper - Ensure main
MinecraftTimings.savePlayers.startTiming(); // Paper
+ int numSaved = 0;
+ long now = MinecraftServer.currentTick;
for (int i = 0; i < this.players.size(); ++i) {
- this.save(this.players.get(i));
+ ServerPlayer entityplayer = this.players.get(i);
+ if (interval == -1 || now - entityplayer.lastSave >= interval) {
+ this.save(entityplayer);
+ if (interval != -1 && ++numSaved <= com.destroystokyo.paper.PaperConfig.maxPlayerAutoSavePerTick) { break; }
+ }
+ // Paper end
}
MinecraftTimings.savePlayers.stopTiming(); // Paper
return null; }); // Paper - ensure main

View File

@ -5,10 +5,10 @@ Subject: [PATCH] Cache block data strings
diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java
index 7f733bd666e42f8ba80bfda233f662564bfc0e24..4d90ebf13e8ad2dd77175fcdc15a0e84a58ff081 100644
index 8a3583bcf2d2a694b30718062bc7f2e1158c9b4f..807fd27bc1fa0ddb7b6bde63b15c331944d51ded 100644
--- a/src/main/java/net/minecraft/server/MinecraftServer.java
+++ b/src/main/java/net/minecraft/server/MinecraftServer.java
@@ -1973,6 +1973,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
@@ -1977,6 +1977,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
this.getPlayerList().reloadResources();
this.functionManager.replaceLibrary(this.resources.getFunctionLibrary());
this.structureManager.onResourceManagerReload(this.resources.getResourceManager());

View File

@ -6,10 +6,10 @@ Subject: [PATCH] Extend block drop capture to capture all items added to the
diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java
index 64f5901049258c327e3fef8723da58756ce05cc6..22e8a349254bcf6ba39fcede60bc59d5b7190cf2 100644
index 5c98b61c08464cc78be34d1567eff7005f6ab2df..313a368eb5d09b0c4d45b5da34d72390d86332c5 100644
--- a/src/main/java/net/minecraft/server/level/ServerLevel.java
+++ b/src/main/java/net/minecraft/server/level/ServerLevel.java
@@ -1226,6 +1226,13 @@ public class ServerLevel extends Level implements WorldGenLevel {
@@ -1257,6 +1257,13 @@ public class ServerLevel extends Level implements WorldGenLevel {
// WorldServer.LOGGER.warn("Tried to add entity {} but it was marked as removed already", EntityTypes.getKey(entity.getType())); // CraftBukkit
return false;
} else {

View File

@ -5,10 +5,10 @@ Subject: [PATCH] Don't mark dirty in invalid locations (SPIGOT-6086)
diff --git a/src/main/java/net/minecraft/server/level/ChunkHolder.java b/src/main/java/net/minecraft/server/level/ChunkHolder.java
index 6782e2b100b1619016c637a9e71f9e880ff974e1..41333234cdda8127a239f591d8d2cd304e341852 100644
index 8950470bbaa57ac0ef6ca4d6e3796a712e0b6cd6..b493769dd420f0dd93fdf8184c452c53cb63e95b 100644
--- a/src/main/java/net/minecraft/server/level/ChunkHolder.java
+++ b/src/main/java/net/minecraft/server/level/ChunkHolder.java
@@ -227,6 +227,7 @@ public class ChunkHolder {
@@ -229,6 +229,7 @@ public class ChunkHolder {
}
public void blockChanged(BlockPos pos) {

View File

@ -6,10 +6,10 @@ Subject: [PATCH] Fix deop kicking non-whitelisted player when white list is
diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java
index 4d90ebf13e8ad2dd77175fcdc15a0e84a58ff081..d8c1bb347608eaea3741525602613bebd5f54c6b 100644
index 807fd27bc1fa0ddb7b6bde63b15c331944d51ded..ff1bbd57c6a3e7a3ab78b9c0c0106230a9d13d35 100644
--- a/src/main/java/net/minecraft/server/MinecraftServer.java
+++ b/src/main/java/net/minecraft/server/MinecraftServer.java
@@ -2039,13 +2039,14 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
@@ -2043,13 +2043,14 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
if (this.isEnforceWhitelist()) {
PlayerList playerlist = source.getServer().getPlayerList();
UserWhiteList whitelist = playerlist.getWhiteList();

View File

@ -5,10 +5,10 @@ Subject: [PATCH] Added ServerResourcesReloadedEvent
diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java
index d8c1bb347608eaea3741525602613bebd5f54c6b..0a09dbbd062df44062c19b8e6898a858f94377ac 100644
index ff1bbd57c6a3e7a3ab78b9c0c0106230a9d13d35..b9edcaf7aecd73e3fea605088b8577126f03f380 100644
--- a/src/main/java/net/minecraft/server/MinecraftServer.java
+++ b/src/main/java/net/minecraft/server/MinecraftServer.java
@@ -1952,7 +1952,13 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
@@ -1956,7 +1956,13 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
return this.functionManager;
}
@ -22,7 +22,7 @@ index d8c1bb347608eaea3741525602613bebd5f54c6b..0a09dbbd062df44062c19b8e6898a858
CompletableFuture<Void> completablefuture = CompletableFuture.supplyAsync(() -> {
Stream<String> stream = datapacks.stream(); // CraftBukkit - decompile error
PackRepository resourcepackrepository = this.packRepository;
@@ -1968,6 +1974,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
@@ -1972,6 +1978,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
this.packRepository.setSelected(datapacks);
this.worldData.setDataPackConfig(MinecraftServer.getSelectedPacks(this.packRepository));
datapackresources.updateGlobals();

View File

@ -5,10 +5,10 @@ Subject: [PATCH] Added world settings for mobs picking up loot
diff --git a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
index 98e7bd4c85ed9f6bb063dfc3b0e4b80150a86835..53681d342935feb4d0f0428df751a4f8004e783e 100644
index 3ad93abb830d307a0d2cf8cb4554bf3fa37cb91d..556bf08491466a061119338a05d6165d041e6668 100644
--- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
+++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
@@ -673,6 +673,14 @@ public class PaperWorldConfig {
@@ -688,6 +688,14 @@ public class PaperWorldConfig {
phantomOnlyAttackInsomniacs = getBoolean("phantoms-only-attack-insomniacs", phantomOnlyAttackInsomniacs);
}

View File

@ -5,10 +5,10 @@ Subject: [PATCH] Remove stale POIs
diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java
index 22e8a349254bcf6ba39fcede60bc59d5b7190cf2..e50d5850f02a8217c3ff56b3ff1627ade8546980 100644
index 313a368eb5d09b0c4d45b5da34d72390d86332c5..2dddc0160c758decc257aeada11adeeaaad59629 100644
--- a/src/main/java/net/minecraft/server/level/ServerLevel.java
+++ b/src/main/java/net/minecraft/server/level/ServerLevel.java
@@ -1769,6 +1769,11 @@ public class ServerLevel extends Level implements WorldGenLevel {
@@ -1800,6 +1800,11 @@ public class ServerLevel extends Level implements WorldGenLevel {
});
optional1.ifPresent((villageplacetype) -> {
this.getServer().execute(() -> {

View File

@ -5,10 +5,10 @@ Subject: [PATCH] Configurable max leash distance
diff --git a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
index 44319f7ebd5e97435b4a4068d638946b74159cf1..64109ad34919f851d112df5f39aba31bfc386957 100644
index a1c0b9770f4f9b84778db9b42c097af146485420..e1bb630f2352a30e351c7e1535ff82fd93849609 100644
--- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
+++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
@@ -287,6 +287,12 @@ public class PaperWorldConfig {
@@ -302,6 +302,12 @@ public class PaperWorldConfig {
}
}

View File

@ -5,10 +5,10 @@ Subject: [PATCH] Add toggle for always placing the dragon egg
diff --git a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
index 64109ad34919f851d112df5f39aba31bfc386957..686a649b23e81c36ae392c79c736eafe22be0c54 100644
index e1bb630f2352a30e351c7e1535ff82fd93849609..d891a7d54688a10fe4fe16f2f5037a57a9c58e86 100644
--- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
+++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
@@ -706,6 +706,11 @@ public class PaperWorldConfig {
@@ -721,6 +721,11 @@ public class PaperWorldConfig {
perPlayerMobSpawns = getBoolean("per-player-mob-spawns", true);
}

View File

@ -5,10 +5,10 @@ Subject: [PATCH] Skip distance map update when spawning disabled.
diff --git a/src/main/java/net/minecraft/server/level/ServerChunkCache.java b/src/main/java/net/minecraft/server/level/ServerChunkCache.java
index ca3ccf2631587a896f6b909d63889708e6f72f27..930291a0844acbd0491e641008727223b0010a60 100644
index 58c22ed8e37b22b3b304139b1746b5bc8ba6f45a..59d7f93c9364571edf2e7b613a57f8f28989cb56 100644
--- a/src/main/java/net/minecraft/server/level/ServerChunkCache.java
+++ b/src/main/java/net/minecraft/server/level/ServerChunkCache.java
@@ -957,7 +957,7 @@ public class ServerChunkCache extends ChunkSource {
@@ -966,7 +966,7 @@ public class ServerChunkCache extends ChunkSource {
int l = this.distanceManager.getNaturalSpawnChunkCount();
// Paper start - per player mob spawning
NaturalSpawner.SpawnState spawnercreature_d; // moved down

View File

@ -5,10 +5,10 @@ Subject: [PATCH] EntityMoveEvent
diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java
index 0a09dbbd062df44062c19b8e6898a858f94377ac..6fcd166096ad94954ec0868e5d26dc0b76cfd3d2 100644
index b9edcaf7aecd73e3fea605088b8577126f03f380..643b4901b854d48275cbc8e8d5ff7a28d9b0aa00 100644
--- a/src/main/java/net/minecraft/server/MinecraftServer.java
+++ b/src/main/java/net/minecraft/server/MinecraftServer.java
@@ -1499,6 +1499,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
@@ -1503,6 +1503,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
while (iterator.hasNext()) {
ServerLevel worldserver = (ServerLevel) iterator.next();
worldserver.hasPhysicsEvent = org.bukkit.event.block.BlockPhysicsEvent.getHandlerList().getRegisteredListeners().length > 0; // Paper
@ -17,7 +17,7 @@ index 0a09dbbd062df44062c19b8e6898a858f94377ac..6fcd166096ad94954ec0868e5d26dc0b
this.profiler.push(() -> {
diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java
index e50d5850f02a8217c3ff56b3ff1627ade8546980..bfedc4aab1a991d0cffca8e7a816c87c81c6f8d9 100644
index 2dddc0160c758decc257aeada11adeeaaad59629..f7bccad8b029133377f0e3ae81619ec72055d265 100644
--- a/src/main/java/net/minecraft/server/level/ServerLevel.java
+++ b/src/main/java/net/minecraft/server/level/ServerLevel.java
@@ -205,6 +205,7 @@ public class ServerLevel extends Level implements WorldGenLevel {

View File

@ -5,10 +5,10 @@ Subject: [PATCH] added option to disable pathfinding updates on block changes
diff --git a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
index 686a649b23e81c36ae392c79c736eafe22be0c54..168dd88fd1fabff8e63e6429e989dabe2c40cbfa 100644
index d891a7d54688a10fe4fe16f2f5037a57a9c58e86..84a3d8ee365d05fb2ab7c8550e4880fd5d332846 100644
--- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
+++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
@@ -711,6 +711,11 @@ public class PaperWorldConfig {
@@ -726,6 +726,11 @@ public class PaperWorldConfig {
enderDragonsDeathAlwaysPlacesDragonEgg = getBoolean("ender-dragons-death-always-places-dragon-egg", enderDragonsDeathAlwaysPlacesDragonEgg);
}
@ -21,10 +21,10 @@ index 686a649b23e81c36ae392c79c736eafe22be0c54..168dd88fd1fabff8e63e6429e989dabe
public boolean phantomOnlyAttackInsomniacs = true;
private void phantomSettings() {
diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java
index bfedc4aab1a991d0cffca8e7a816c87c81c6f8d9..3a776dc937d5ea08f5f7343799b00a67af197d2f 100644
index f7bccad8b029133377f0e3ae81619ec72055d265..955f1f14ba7dca04d928a35db83c9b55133caa85 100644
--- a/src/main/java/net/minecraft/server/level/ServerLevel.java
+++ b/src/main/java/net/minecraft/server/level/ServerLevel.java
@@ -1360,6 +1360,7 @@ public class ServerLevel extends Level implements WorldGenLevel {
@@ -1391,6 +1391,7 @@ public class ServerLevel extends Level implements WorldGenLevel {
@Override
public void sendBlockUpdated(BlockPos pos, BlockState oldState, BlockState newState, int flags) {
this.getChunkSource().blockChanged(pos);
@ -32,7 +32,7 @@ index bfedc4aab1a991d0cffca8e7a816c87c81c6f8d9..3a776dc937d5ea08f5f7343799b00a67
VoxelShape voxelshape = oldState.getCollisionShape(this, pos);
VoxelShape voxelshape1 = newState.getCollisionShape(this, pos);
@@ -1387,6 +1388,7 @@ public class ServerLevel extends Level implements WorldGenLevel {
@@ -1418,6 +1419,7 @@ public class ServerLevel extends Level implements WorldGenLevel {
}
}

View File

@ -5,10 +5,10 @@ Subject: [PATCH] Allow using signs inside spawn protection
diff --git a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
index 168dd88fd1fabff8e63e6429e989dabe2c40cbfa..85203627790204cf899f955781b4e876e23e0809 100644
index 84a3d8ee365d05fb2ab7c8550e4880fd5d332846..9fc14f3102e2ceb10b80974fabb5c4513e17e63f 100644
--- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
+++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
@@ -736,4 +736,9 @@ public class PaperWorldConfig {
@@ -751,4 +751,9 @@ public class PaperWorldConfig {
expMergeMaxValue = getInt("experience-merge-max-value", -1);
log("Experience Merge Max Value: " + expMergeMaxValue);
}

View File

@ -5,7 +5,7 @@ Subject: [PATCH] forced whitelist: use configurable kick message
diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java
index 6fcd166096ad94954ec0868e5d26dc0b76cfd3d2..f1713ceace84ecbe2e4a0dcde050c43a636e3595 100644
index 643b4901b854d48275cbc8e8d5ff7a28d9b0aa00..80e101301f148520a04dfc914caa58ea3a6653d2 100644
--- a/src/main/java/net/minecraft/server/MinecraftServer.java
+++ b/src/main/java/net/minecraft/server/MinecraftServer.java
@@ -73,7 +73,6 @@ import net.minecraft.nbt.NbtOps;
@ -16,7 +16,7 @@ index 6fcd166096ad94954ec0868e5d26dc0b76cfd3d2..f1713ceace84ecbe2e4a0dcde050c43a
import net.minecraft.network.protocol.game.ClientboundChangeDifficultyPacket;
import net.minecraft.network.protocol.game.ClientboundSetTimePacket;
import net.minecraft.network.protocol.status.ServerStatus;
@@ -2055,7 +2054,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
@@ -2059,7 +2058,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
ServerPlayer entityplayer = (ServerPlayer) iterator.next();
if (!whitelist.isWhiteListed(entityplayer.getGameProfile()) && !this.getPlayerList().isOp(entityplayer.getGameProfile())) { // Paper - Fix kicking ops when whitelist is reloaded (MC-171420)

View File

@ -5,10 +5,10 @@ Subject: [PATCH] Limit item frame cursors on maps
diff --git a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
index f754ca5e10cc7709fc2a67eb48861da01300292f..6a09852bcc4466c4e182153c04107ce20a9dafce 100644
index cc4c067ad70375f76ddede403b88e76f3c8f37da..7d79d4caa299961fd5c54ae924d7658ad37d464b 100644
--- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
+++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
@@ -776,4 +776,9 @@ public class PaperWorldConfig {
@@ -791,4 +791,9 @@ public class PaperWorldConfig {
private void allowUsingSignsInsideSpawnProtection() {
allowUsingSignsInsideSpawnProtection = getBoolean("allow-using-signs-inside-spawn-protection", allowUsingSignsInsideSpawnProtection);
}

View File

@ -5,10 +5,10 @@ Subject: [PATCH] Add PlayerKickEvent causes
diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java
index fcdae82ecaaa86854a5cddcb652ed3bc388e33c3..f4b7488963a6f16016d6ede80072bd3722c0caa3 100644
index 6715920dcbc7cd895f8662d9c7b9dbb8b8790323..ad92755203d62bb76d259d4c1eba960c04d90a1e 100644
--- a/src/main/java/net/minecraft/server/MinecraftServer.java
+++ b/src/main/java/net/minecraft/server/MinecraftServer.java
@@ -2058,7 +2058,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
@@ -2062,7 +2062,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
ServerPlayer entityplayer = (ServerPlayer) iterator.next();
if (!whitelist.isWhiteListed(entityplayer.getGameProfile()) && !this.getPlayerList().isOp(entityplayer.getGameProfile())) { // Paper - Fix kicking ops when whitelist is reloaded (MC-171420)
@ -318,7 +318,7 @@ index 311df240858d4416306a795d893bdf7da403e90b..85e24920e774e84f9fa63a4fb088c07c
}
diff --git a/src/main/java/net/minecraft/server/players/PlayerList.java b/src/main/java/net/minecraft/server/players/PlayerList.java
index 53fa2fbaeacc333ab28392df4613819719a55d2e..8679eb594c6f001de19788e3b08c3c979dfeffe3 100644
index f61c31a028c286399f0921c516b5d94ad52f88b5..13f68b8d241a0b2532a1bd9d9554d2e615780383 100644
--- a/src/main/java/net/minecraft/server/players/PlayerList.java
+++ b/src/main/java/net/minecraft/server/players/PlayerList.java
@@ -715,7 +715,7 @@ public abstract class PlayerList {
@ -330,7 +330,7 @@ index 53fa2fbaeacc333ab28392df4613819719a55d2e..8679eb594c6f001de19788e3b08c3c97
}
// Instead of kicking then returning, we need to store the kick reason
@@ -1345,8 +1345,8 @@ public abstract class PlayerList {
@@ -1346,8 +1346,8 @@ public abstract class PlayerList {
// Paper end
// CraftBukkit start - disconnect safely
for (ServerPlayer player : this.players) {

View File

@ -5,10 +5,10 @@ Subject: [PATCH] Add option to fix items merging through walls
diff --git a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
index 6a09852bcc4466c4e182153c04107ce20a9dafce..e28fd9f75b4dba55f5c9d765c368c1ad0c43a960 100644
index 7d79d4caa299961fd5c54ae924d7658ad37d464b..8494e3147295f997e826025f13a6da29684f3c38 100644
--- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
+++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
@@ -781,4 +781,9 @@ public class PaperWorldConfig {
@@ -796,4 +796,9 @@ public class PaperWorldConfig {
private void mapItemFrameCursorLimit() {
mapItemFrameCursorLimit = getInt("map-item-frame-cursor-limit", mapItemFrameCursorLimit);
}

View File

@ -6,10 +6,10 @@ Subject: [PATCH] Fix invulnerable end crystals
MC-108513
diff --git a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
index e28fd9f75b4dba55f5c9d765c368c1ad0c43a960..12f8e5abab4a1f3ab1e1f71746b5bf0b3bf1506c 100644
index 8494e3147295f997e826025f13a6da29684f3c38..83674565d280f5aa2504cdaee027386f3f377291 100644
--- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
+++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
@@ -786,4 +786,9 @@ public class PaperWorldConfig {
@@ -801,4 +801,9 @@ public class PaperWorldConfig {
private void fixItemsMergingThroughWalls() {
fixItemsMergingThroughWalls = getBoolean("fix-items-merging-through-walls", fixItemsMergingThroughWalls);
}

View File

@ -5,12 +5,12 @@ Subject: [PATCH] Make item validations configurable
diff --git a/src/main/java/com/destroystokyo/paper/PaperConfig.java b/src/main/java/com/destroystokyo/paper/PaperConfig.java
index bf256ffaf9311d04712fdba38d529283a5330b09..90e29dd8452c052dfd32fb065094721be0a750f3 100644
index ae7ca7fbed3a1a4532a78bb8a029bb7fc642bcb3..0460fe8700ee09543263045edaea7a09bd5be035 100644
--- a/src/main/java/com/destroystokyo/paper/PaperConfig.java
+++ b/src/main/java/com/destroystokyo/paper/PaperConfig.java
@@ -503,4 +503,19 @@ public class PaperConfig {
maxPlayerAutoSavePerTick = (playerAutoSaveRate == -1 || playerAutoSaveRate > 100) ? 10 : 20;
}
config.set("settings.unsupported-settings.allow-headless-pistons-readme", "This setting controls if players should be able to create headless pistons.");
allowHeadlessPistons = getBoolean("settings.unsupported-settings.allow-headless-pistons", false);
}
+
+ public static int itemValidationDisplayNameLength = 8192;

View File

@ -6,7 +6,7 @@ Subject: [PATCH] add per world spawn limits
Taken from #2982. Credit to Chasewhip8
diff --git a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
index 12f8e5abab4a1f3ab1e1f71746b5bf0b3bf1506c..5d1d042cb2214951025512fa6751ee5899bdd7d7 100644
index 83674565d280f5aa2504cdaee027386f3f377291..24f784209109f599fab11ba8c905f16c304dba3c 100644
--- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
+++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
@@ -12,6 +12,7 @@ import net.minecraft.world.Difficulty;
@ -29,7 +29,7 @@ index 12f8e5abab4a1f3ab1e1f71746b5bf0b3bf1506c..5d1d042cb2214951025512fa6751ee58
}
if (needsSave) {
@@ -671,6 +677,21 @@ public class PaperWorldConfig {
@@ -686,6 +692,21 @@ public class PaperWorldConfig {
zombieVillagerInfectionChance = getDouble("zombie-villager-infection-chance", zombieVillagerInfectionChance);
}

View File

@ -10,10 +10,10 @@ This patch changes sign command logic so that `run_command` click events:
- sends failure messages to the player who clicked the sign
diff --git a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
index 5d1d042cb2214951025512fa6751ee5899bdd7d7..496d1669718c405b441d9280df755ab44aec69f4 100644
index 24f784209109f599fab11ba8c905f16c304dba3c..c4ee757e4c8e796b402a56803d4031e90a85d916 100644
--- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
+++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
@@ -812,4 +812,9 @@ public class PaperWorldConfig {
@@ -827,4 +827,9 @@ public class PaperWorldConfig {
private void fixInvulnerableEndCrystalExploit() {
fixInvulnerableEndCrystalExploit = getBoolean("unsupported-settings.fix-invulnerable-end-crystal-exploit", fixInvulnerableEndCrystalExploit);
}

View File

@ -5,10 +5,10 @@ Subject: [PATCH] Add config for mobs immune to default effects
diff --git a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
index 496d1669718c405b441d9280df755ab44aec69f4..ad51b56279c723538ba71c47f22b96f45f82204e 100644
index c4ee757e4c8e796b402a56803d4031e90a85d916..ed2b33afffdf975513c07ba8db6439810e444852 100644
--- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
+++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
@@ -667,6 +667,21 @@ public class PaperWorldConfig {
@@ -682,6 +682,21 @@ public class PaperWorldConfig {
log("Hopper Ignore Occluding Blocks: " + (hoppersIgnoreOccludingBlocks ? "enabled" : "disabled"));
}

View File

@ -11,10 +11,10 @@ It does not make a lot of sense to damage players if they get crammed,
For those who really want it a config option is provided.
diff --git a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
index ad51b56279c723538ba71c47f22b96f45f82204e..c6d9b4368446c4e97ab746e0b4d067dfd646edf4 100644
index ed2b33afffdf975513c07ba8db6439810e444852..24a14b9f2d6e070fe9220bfb6e709f58368390f6 100644
--- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
+++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
@@ -832,4 +832,9 @@ public class PaperWorldConfig {
@@ -847,4 +847,9 @@ public class PaperWorldConfig {
private void showSignClickCommandFailureMessagesToPlayer() {
showSignClickCommandFailureMessagesToPlayer = getBoolean("show-sign-click-command-failure-msgs-to-player", showSignClickCommandFailureMessagesToPlayer);
}

View File

@ -28,7 +28,7 @@ index b47b7dce26805badd422c1867733ff4bfd00e9f4..b27021a42cbed3f0648a8d0903d00d03
* Get a named timer for the specified tile entity type to track type specific timings.
* @param entity
diff --git a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
index c6d9b4368446c4e97ab746e0b4d067dfd646edf4..b27b25b22d062e32b56b3fd1b28c2d3597e9023a 100644
index 24a14b9f2d6e070fe9220bfb6e709f58368390f6..9a866ab0b887f2db1cf0e6802a44c2e8b0912b74 100644
--- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
+++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
@@ -7,13 +7,18 @@ import it.unimi.dsi.fastutil.objects.Reference2IntMap;
@ -50,7 +50,7 @@ index c6d9b4368446c4e97ab746e0b4d067dfd646edf4..b27b25b22d062e32b56b3fd1b28c2d35
import org.bukkit.configuration.file.YamlConfiguration;
import org.spigotmc.SpigotWorldConfig;
@@ -837,4 +842,57 @@ public class PaperWorldConfig {
@@ -852,4 +857,57 @@ public class PaperWorldConfig {
private void playerCrammingDamage() {
allowPlayerCrammingDamage = getBoolean("allow-player-cramming-damage", allowPlayerCrammingDamage);
}

View File

@ -5,10 +5,10 @@ Subject: [PATCH] Configurable item frame map cursor update interval
diff --git a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
index 0c430c1ef426bf2127e94063c966ba0935b3a39f..8cb3767551d36cc2c7c07548182d817f9843bf50 100644
index 10a52ee6177d5eb463a9a08302099b5dbc7b1a18..4d85af9d021291e813daa3a44e8bae340fc568fb 100644
--- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
+++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
@@ -828,6 +828,11 @@ public class PaperWorldConfig {
@@ -843,6 +843,11 @@ public class PaperWorldConfig {
mapItemFrameCursorLimit = getInt("map-item-frame-cursor-limit", mapItemFrameCursorLimit);
}

View File

@ -10,10 +10,10 @@ schedules. Effectively, use the callback executor as a tool of
finding issues rather than hiding these issues.
diff --git a/src/main/java/net/minecraft/server/level/ChunkMap.java b/src/main/java/net/minecraft/server/level/ChunkMap.java
index c637a9b0a978700a0cd941be22208ae3c01f6eb2..e4005ead8dafb4ae02ad5bbfb8e7721dbc734758 100644
index b75ad5ee074489e3c66ef6524106241c6d577916..75de80747ecd26c5cb91e6be25cada16aa206b8b 100644
--- a/src/main/java/net/minecraft/server/level/ChunkMap.java
+++ b/src/main/java/net/minecraft/server/level/ChunkMap.java
@@ -158,17 +158,28 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
@@ -159,17 +159,28 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
public final CallbackExecutor callbackExecutor = new CallbackExecutor();
public static final class CallbackExecutor implements java.util.concurrent.Executor, Runnable {

View File

@ -10,10 +10,10 @@ to be unloaded will simply be unloaded next tick, rather than
immediately.
diff --git a/src/main/java/net/minecraft/server/level/ServerChunkCache.java b/src/main/java/net/minecraft/server/level/ServerChunkCache.java
index 930291a0844acbd0491e641008727223b0010a60..1a27a694fde340082c9ab60a63abce39bab22739 100644
index 59d7f93c9364571edf2e7b613a57f8f28989cb56..804aaa62d9c39bc4340a83a9ed88ab7d04c47059 100644
--- a/src/main/java/net/minecraft/server/level/ServerChunkCache.java
+++ b/src/main/java/net/minecraft/server/level/ServerChunkCache.java
@@ -875,6 +875,7 @@ public class ServerChunkCache extends ChunkSource {
@@ -884,6 +884,7 @@ public class ServerChunkCache extends ChunkSource {
// CraftBukkit start - modelled on below
public void purgeUnload() {

View File

@ -9,10 +9,10 @@ chunk through it. This should also be OK from a leak prevention/
state desync POV because the TE is getting unloaded anyways.
diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java
index 5fd96595d44a47b43c5787c9dd1f4f5cfe6943fa..5d57431a369207a2f207f89682f0861027906370 100644
index 2b3c54737a203401c6f03bba9c9d969e95102298..3748dae9bbb80e70bb9a0547868e02d91d9c85c6 100644
--- a/src/main/java/net/minecraft/server/level/ServerLevel.java
+++ b/src/main/java/net/minecraft/server/level/ServerLevel.java
@@ -1272,9 +1272,13 @@ public class ServerLevel extends Level implements WorldGenLevel {
@@ -1303,9 +1303,13 @@ public class ServerLevel extends Level implements WorldGenLevel {
// Spigot Start
for (net.minecraft.world.level.block.entity.BlockEntity tileentity : chunk.getBlockEntities().values()) {
if (tileentity instanceof net.minecraft.world.Container) {

View File

@ -8,10 +8,10 @@ cause a recursive call which would handle the increase but then
the caller would think the chunk would be unloaded.
diff --git a/src/main/java/net/minecraft/server/level/ChunkHolder.java b/src/main/java/net/minecraft/server/level/ChunkHolder.java
index 41333234cdda8127a239f591d8d2cd304e341852..0b4c10b71d29d01408cafb38cdc7e48e6f90d8a8 100644
index b493769dd420f0dd93fdf8184c452c53cb63e95b..75166c2db7e86c54787a085c6a58762b30bc2863 100644
--- a/src/main/java/net/minecraft/server/level/ChunkHolder.java
+++ b/src/main/java/net/minecraft/server/level/ChunkHolder.java
@@ -426,8 +426,10 @@ public class ChunkHolder {
@@ -428,8 +428,10 @@ public class ChunkHolder {
playerchunkmap.onFullChunkStatusChange(this.pos, playerchunk_state);
}
@ -22,7 +22,7 @@ index 41333234cdda8127a239f591d8d2cd304e341852..0b4c10b71d29d01408cafb38cdc7e48e
ChunkStatus chunkstatus = ChunkHolder.getStatus(this.oldTicketLevel);
ChunkStatus chunkstatus1 = ChunkHolder.getStatus(this.ticketLevel);
boolean flag = this.oldTicketLevel <= ChunkMap.MAX_CHUNK_DISTANCE;
@@ -469,6 +471,12 @@ public class ChunkHolder {
@@ -471,6 +473,12 @@ public class ChunkHolder {
// Run callback right away if the future was already done
chunkStorage.callbackExecutor.run();

View File

@ -10,10 +10,10 @@ chunk future to complete. We can simply schedule to the immediate
executor to get this effect, rather than the main mailbox.
diff --git a/src/main/java/net/minecraft/server/level/ChunkMap.java b/src/main/java/net/minecraft/server/level/ChunkMap.java
index e4005ead8dafb4ae02ad5bbfb8e7721dbc734758..cda41112ce58f4572c36c5d33e16cf13bc10b1ec 100644
index 75de80747ecd26c5cb91e6be25cada16aa206b8b..1667e1074294cc3d1d286066917555289234a33d 100644
--- a/src/main/java/net/minecraft/server/level/ChunkMap.java
+++ b/src/main/java/net/minecraft/server/level/ChunkMap.java
@@ -1226,9 +1226,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
@@ -1286,9 +1286,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
return chunk;
});

View File

@ -8,10 +8,10 @@ Sync loading the chunk at this stage would cause it to load
older data, as well as screwing our region state.
diff --git a/src/main/java/net/minecraft/server/level/ChunkMap.java b/src/main/java/net/minecraft/server/level/ChunkMap.java
index cda41112ce58f4572c36c5d33e16cf13bc10b1ec..f67a7ba5e95a3ba4d3589c6df1012bdc98559747 100644
index 1667e1074294cc3d1d286066917555289234a33d..8a890c17521049a79295e180538451ba4f2b7fc1 100644
--- a/src/main/java/net/minecraft/server/level/ChunkMap.java
+++ b/src/main/java/net/minecraft/server/level/ChunkMap.java
@@ -294,6 +294,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
@@ -295,6 +295,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
}
// Paper end
@ -19,7 +19,7 @@ index cda41112ce58f4572c36c5d33e16cf13bc10b1ec..f67a7ba5e95a3ba4d3589c6df1012bdc
public ChunkMap(ServerLevel world, LevelStorageSource.LevelStorageAccess session, DataFixer dataFixer, StructureManager structureManager, Executor executor, BlockableEventLoop<Runnable> mainThreadExecutor, LightChunkGetter chunkProvider, ChunkGenerator chunkGenerator, ChunkProgressListener worldGenerationProgressListener, ChunkStatusUpdateListener chunkStatusChangeListener, Supplier<DimensionDataStorage> persistentStateManagerFactory, int viewDistance, boolean dsync) {
super(session.getDimensionPath(world.dimension()).resolve("region"), dataFixer, dsync);
this.visibleChunkMap = this.updatingChunkMap.clone();
@@ -678,6 +679,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
@@ -679,6 +680,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
@Nullable
ChunkHolder updateChunkScheduling(long pos, int level, @Nullable ChunkHolder holder, int k) {
@ -27,7 +27,7 @@ index cda41112ce58f4572c36c5d33e16cf13bc10b1ec..f67a7ba5e95a3ba4d3589c6df1012bdc
if (k > ChunkMap.MAX_CHUNK_DISTANCE && level > ChunkMap.MAX_CHUNK_DISTANCE) {
return holder;
} else {
@@ -838,6 +840,12 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
@@ -897,6 +899,12 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
if (completablefuture1 != completablefuture) {
this.scheduleUnload(pos, holder);
} else {
@ -40,7 +40,7 @@ index cda41112ce58f4572c36c5d33e16cf13bc10b1ec..f67a7ba5e95a3ba4d3589c6df1012bdc
// Paper start
boolean removed;
if ((removed = this.pendingUnloads.remove(pos, holder)) && ichunkaccess != null) {
@@ -873,6 +881,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
@@ -933,6 +941,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
this.regionManagers.get(index).removeChunk(holder.pos.x, holder.pos.z);
}
} // Paper end
@ -49,7 +49,7 @@ index cda41112ce58f4572c36c5d33e16cf13bc10b1ec..f67a7ba5e95a3ba4d3589c6df1012bdc
}
};
diff --git a/src/main/java/net/minecraft/server/level/ServerChunkCache.java b/src/main/java/net/minecraft/server/level/ServerChunkCache.java
index 1a27a694fde340082c9ab60a63abce39bab22739..a2f7f3a153b512bf1cd96ec4bbe3173aa467825a 100644
index 804aaa62d9c39bc4340a83a9ed88ab7d04c47059..7dfccd2e72ac5ec8b03b3439b034975ddadd759e 100644
--- a/src/main/java/net/minecraft/server/level/ServerChunkCache.java
+++ b/src/main/java/net/minecraft/server/level/ServerChunkCache.java
@@ -820,6 +820,7 @@ public class ServerChunkCache extends ChunkSource {

View File

@ -8,10 +8,10 @@ This WILL cause state corruption if it happens. So, don't
allow it.
diff --git a/src/main/java/net/minecraft/server/level/ChunkHolder.java b/src/main/java/net/minecraft/server/level/ChunkHolder.java
index 0b4c10b71d29d01408cafb38cdc7e48e6f90d8a8..dcd95e4cb169fa5eefc34b6fff8f21893052576b 100644
index 75166c2db7e86c54787a085c6a58762b30bc2863..223f6e0dd7df135f0d15fc8a9e78cb426cda911d 100644
--- a/src/main/java/net/minecraft/server/level/ChunkHolder.java
+++ b/src/main/java/net/minecraft/server/level/ChunkHolder.java
@@ -406,7 +406,13 @@ public class ChunkHolder {
@@ -408,7 +408,13 @@ public class ChunkHolder {
CompletableFuture<Void> completablefuture1 = new CompletableFuture();
completablefuture1.thenRunAsync(() -> {
@ -25,7 +25,7 @@ index 0b4c10b71d29d01408cafb38cdc7e48e6f90d8a8..dcd95e4cb169fa5eefc34b6fff8f2189
}, executor);
this.pendingFullStateConfirmation = completablefuture1;
completablefuture.thenAccept((either) -> {
@@ -423,7 +429,12 @@ public class ChunkHolder {
@@ -425,7 +431,12 @@ public class ChunkHolder {
private void demoteFullChunk(ChunkMap playerchunkmap, ChunkHolder.FullChunkStatus playerchunk_state) {
this.pendingFullStateConfirmation.cancel(false);

View File

@ -19,7 +19,7 @@ index b27021a42cbed3f0648a8d0903d00d03922ae221..eada966d7f108a6081be7a848f5c1dfc
private MinecraftTimings() {}
diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java
index f4b7488963a6f16016d6ede80072bd3722c0caa3..7e15aa7c156096decdaa8596f242a4b2e5ea97b4 100644
index ad92755203d62bb76d259d4c1eba960c04d90a1e..743dd0253e9dffddee28c142d8b5ebdc2a8e670a 100644
--- a/src/main/java/net/minecraft/server/MinecraftServer.java
+++ b/src/main/java/net/minecraft/server/MinecraftServer.java
@@ -331,6 +331,76 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
@ -99,7 +99,7 @@ index f4b7488963a6f16016d6ede80072bd3722c0caa3..7e15aa7c156096decdaa8596f242a4b2
public MinecraftServer(OptionSet options, DataPackConfig datapackconfiguration, Thread thread, RegistryAccess.RegistryHolder iregistrycustom_dimension, LevelStorageSource.LevelStorageAccess convertable_conversionsession, WorldData savedata, PackRepository resourcepackrepository, Proxy proxy, DataFixer datafixer, ServerResources datapackresources, @Nullable MinecraftSessionService minecraftsessionservice, @Nullable GameProfileRepository gameprofilerepository, @Nullable GameProfileCache usercache, ChunkProgressListenerFactory worldloadlistenerfactory) {
super("Server");
SERVER = this; // Paper - better singleton
@@ -1315,6 +1385,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
@@ -1311,6 +1381,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
private boolean pollTaskInternal() {
if (super.pollTask()) {
@ -108,7 +108,7 @@ index f4b7488963a6f16016d6ede80072bd3722c0caa3..7e15aa7c156096decdaa8596f242a4b2
} else {
if (this.haveTime()) {
diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java
index 7ae0065139e19c900812c0332cd69a516aa0e36c..cd2e3de1709d9c5c278b5cb616462daad2167f77 100644
index 7a5b6bd84f1a7becdebe03b0bd07f8481eb27ecd..f9f1e2f9eb1a682b3c4c50b5ab4839bf595b0a73 100644
--- a/src/main/java/net/minecraft/server/level/ServerLevel.java
+++ b/src/main/java/net/minecraft/server/level/ServerLevel.java
@@ -198,7 +198,9 @@ public class ServerLevel extends Level implements WorldGenLevel {

View File

@ -35,10 +35,10 @@ index 35949e9c15eb998aa89842d34d0999cd973590e0..15f0c85ba9f4f9666e94e67dde43eb2e
List<ChunkHolder> allChunks = new ArrayList<>(visibleChunks.values());
List<ServerPlayer> players = world.players;
diff --git a/src/main/java/net/minecraft/server/level/ChunkMap.java b/src/main/java/net/minecraft/server/level/ChunkMap.java
index f67a7ba5e95a3ba4d3589c6df1012bdc98559747..0c629a4f835c735f9ff9e5f687c8376dbadd447d 100644
index 6ade79dba07435f3ccc19554e48574bb3bcb2f9c..594f5f3303c21439707f70426baa900af6d94a04 100644
--- a/src/main/java/net/minecraft/server/level/ChunkMap.java
+++ b/src/main/java/net/minecraft/server/level/ChunkMap.java
@@ -118,9 +118,11 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
@@ -119,9 +119,11 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
private static final int MIN_VIEW_DISTANCE = 3;
public static final int MAX_VIEW_DISTANCE = 33;
public static final int MAX_CHUNK_DISTANCE = 33 + ChunkStatus.maxDistance();
@ -52,7 +52,7 @@ index f67a7ba5e95a3ba4d3589c6df1012bdc98559747..0c629a4f835c735f9ff9e5f687c8376d
private final Long2ObjectLinkedOpenHashMap<ChunkHolder> pendingUnloads;
public final LongSet entitiesInLevel;
public final ServerLevel level;
@@ -297,7 +299,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
@@ -298,7 +300,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
boolean unloadingPlayerChunk = false; // Paper - do not allow ticket level changes while unloading chunks
public ChunkMap(ServerLevel world, LevelStorageSource.LevelStorageAccess session, DataFixer dataFixer, StructureManager structureManager, Executor executor, BlockableEventLoop<Runnable> mainThreadExecutor, LightChunkGetter chunkProvider, ChunkGenerator chunkGenerator, ChunkProgressListener worldGenerationProgressListener, ChunkStatusUpdateListener chunkStatusChangeListener, Supplier<DimensionDataStorage> persistentStateManagerFactory, int viewDistance, boolean dsync) {
super(session.getDimensionPath(world.dimension()).resolve("region"), dataFixer, dsync);
@ -61,7 +61,7 @@ index f67a7ba5e95a3ba4d3589c6df1012bdc98559747..0c629a4f835c735f9ff9e5f687c8376d
this.pendingUnloads = new Long2ObjectLinkedOpenHashMap();
this.entitiesInLevel = new LongOpenHashSet();
this.toDrop = new LongOpenHashSet();
@@ -552,12 +554,17 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
@@ -553,12 +555,17 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
@Nullable
public ChunkHolder getUpdatingChunkIfPresent(long pos) {
@ -81,7 +81,7 @@ index f67a7ba5e95a3ba4d3589c6df1012bdc98559747..0c629a4f835c735f9ff9e5f687c8376d
}
protected IntSupplier getChunkQueueLevel(long pos) {
@@ -709,7 +716,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
@@ -710,7 +717,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
// Paper end
}
@ -90,7 +90,7 @@ index f67a7ba5e95a3ba4d3589c6df1012bdc98559747..0c629a4f835c735f9ff9e5f687c8376d
this.modified = true;
}
@@ -731,7 +738,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
@@ -790,7 +797,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
protected void saveAllChunks(boolean flush) {
if (flush) {
@ -99,7 +99,7 @@ index f67a7ba5e95a3ba4d3589c6df1012bdc98559747..0c629a4f835c735f9ff9e5f687c8376d
MutableBoolean mutableboolean = new MutableBoolean();
do {
@@ -762,7 +769,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
@@ -821,7 +828,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
//this.flushWorker(); // Paper - nuke IOWorker
this.level.asyncChunkTaskManager.flush(); // Paper - flush to preserve behavior compat with pre-async behaviour
} else {
@ -108,7 +108,7 @@ index f67a7ba5e95a3ba4d3589c6df1012bdc98559747..0c629a4f835c735f9ff9e5f687c8376d
}
}
@@ -796,7 +803,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
@@ -855,7 +862,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
while (longiterator.hasNext()) { // Spigot
long j = longiterator.nextLong();
longiterator.remove(); // Spigot
@ -117,16 +117,16 @@ index f67a7ba5e95a3ba4d3589c6df1012bdc98559747..0c629a4f835c735f9ff9e5f687c8376d
if (playerchunk != null) {
this.pendingUnloads.put(j, playerchunk);
@@ -822,7 +829,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
@@ -881,7 +888,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
}
int l = 0;
- ObjectIterator objectiterator = this.visibleChunkMap.values().iterator();
+ Iterator objectiterator = this.updatingChunks.getVisibleValuesCopy().iterator(); // Paper
while (l < 20 && shouldKeepTicking.getAsBoolean() && objectiterator.hasNext()) {
while (false && l < 20 && shouldKeepTicking.getAsBoolean() && objectiterator.hasNext()) { // Paper - incremental chunk and player saving
if (this.saveChunkIfNeeded((ChunkHolder) objectiterator.next())) {
@@ -900,7 +907,12 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
@@ -960,7 +967,12 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
if (!this.modified) {
return false;
} else {
@ -140,7 +140,7 @@ index f67a7ba5e95a3ba4d3589c6df1012bdc98559747..0c629a4f835c735f9ff9e5f687c8376d
this.modified = false;
return true;
}
@@ -1382,7 +1394,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
@@ -1444,7 +1456,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
this.viewDistance = j;
this.distanceManager.updatePlayerTickets(this.viewDistance);
@ -149,7 +149,7 @@ index f67a7ba5e95a3ba4d3589c6df1012bdc98559747..0c629a4f835c735f9ff9e5f687c8376d
while (objectiterator.hasNext()) {
ChunkHolder playerchunk = (ChunkHolder) objectiterator.next();
@@ -1424,7 +1436,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
@@ -1486,7 +1498,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
}
public int size() {
@ -158,7 +158,7 @@ index f67a7ba5e95a3ba4d3589c6df1012bdc98559747..0c629a4f835c735f9ff9e5f687c8376d
}
public DistanceManager getDistanceManager() {
@@ -1432,13 +1444,13 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
@@ -1494,13 +1506,13 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
}
protected Iterable<ChunkHolder> getChunks() {

View File

@ -22,10 +22,10 @@ With this change I could get all 200 on at 0ms ping.
So in general this patch should reduce Netty I/O thread load.
diff --git a/src/main/java/net/minecraft/server/level/ServerChunkCache.java b/src/main/java/net/minecraft/server/level/ServerChunkCache.java
index 204fc634fdbcff8ff9f4b570c50a76401dcc8bd6..573a7fc1543f4dbdbc6d83d1dc123ab952840c88 100644
index c3dc87998400bf57ddd31a29a3a4e506407adcb8..f46aa97e00c9238daeeb9730551949959c750a0b 100644
--- a/src/main/java/net/minecraft/server/level/ServerChunkCache.java
+++ b/src/main/java/net/minecraft/server/level/ServerChunkCache.java
@@ -1031,7 +1031,24 @@ public class ServerChunkCache extends ChunkSource {
@@ -1040,7 +1040,24 @@ public class ServerChunkCache extends ChunkSource {
});
gameprofilerfiller.pop();
gameprofilerfiller.pop();

View File

@ -7,10 +7,10 @@ Reference2BooleanOpenHashMap is going to have
better lookups than HashMap.
diff --git a/src/main/java/net/minecraft/server/level/ChunkMap.java b/src/main/java/net/minecraft/server/level/ChunkMap.java
index 0c629a4f835c735f9ff9e5f687c8376dbadd447d..cde82f240924640575d4261d862052af03f31849 100644
index 82c46feffefb9b27c793625e392472bcf8e1b54d..edb94ce747afae854fcfa63e08467b18982f6db7 100644
--- a/src/main/java/net/minecraft/server/level/ChunkMap.java
+++ b/src/main/java/net/minecraft/server/level/ChunkMap.java
@@ -106,6 +106,7 @@ import org.apache.logging.log4j.LogManager;
@@ -107,6 +107,7 @@ import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.bukkit.entity.Player;
// CraftBukkit end
@ -18,7 +18,7 @@ index 0c629a4f835c735f9ff9e5f687c8376dbadd447d..cde82f240924640575d4261d862052af
public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider {
@@ -2069,7 +2070,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
@@ -2131,7 +2132,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
final Entity entity;
private final int range;
SectionPos lastSectionPos;

View File

@ -9,7 +9,7 @@ since the penalty of a map lookup could outweigh the benefits of
searching less players (as it basically did in the outside range patch).
diff --git a/src/main/java/net/minecraft/server/level/ChunkHolder.java b/src/main/java/net/minecraft/server/level/ChunkHolder.java
index dcd95e4cb169fa5eefc34b6fff8f21893052576b..380f8f133cc38fa005548bad23e12fa873e7349f 100644
index 223f6e0dd7df135f0d15fc8a9e78cb426cda911d..c3d1adaf7abfafa8e4c5d173c0d2ec40ca655cfb 100644
--- a/src/main/java/net/minecraft/server/level/ChunkHolder.java
+++ b/src/main/java/net/minecraft/server/level/ChunkHolder.java
@@ -83,6 +83,12 @@ public class ChunkHolder {
@ -24,12 +24,12 @@ index dcd95e4cb169fa5eefc34b6fff8f21893052576b..380f8f133cc38fa005548bad23e12fa8
+ // Paper end - optimise checkDespawn
}
// Paper end - optimise isOutsideOfRange
// Paper start - optimize chunk status progression without jumping through thread pool
long lastAutoSaveTime; // Paper - incremental autosave
diff --git a/src/main/java/net/minecraft/server/level/ChunkMap.java b/src/main/java/net/minecraft/server/level/ChunkMap.java
index cde82f240924640575d4261d862052af03f31849..3d6d68b1f52d507a1f4db9a0c5da09072624046e 100644
index edb94ce747afae854fcfa63e08467b18982f6db7..399a98437ea632b8768a7c153dee7723c8499317 100644
--- a/src/main/java/net/minecraft/server/level/ChunkMap.java
+++ b/src/main/java/net/minecraft/server/level/ChunkMap.java
@@ -157,6 +157,13 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
@@ -158,6 +158,13 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
int viewDistance;
public final com.destroystokyo.paper.util.PlayerMobDistanceMap playerMobDistanceMap; // Paper
@ -43,7 +43,7 @@ index cde82f240924640575d4261d862052af03f31849..3d6d68b1f52d507a1f4db9a0c5da0907
// CraftBukkit start - recursion-safe executor for Chunk loadCallback() and unloadCallback()
public final CallbackExecutor callbackExecutor = new CallbackExecutor();
public static final class CallbackExecutor implements java.util.concurrent.Executor, Runnable {
@@ -237,6 +244,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
@@ -238,6 +245,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
this.playerChunkTickRangeMap.update(player, chunkX, chunkZ, DistanceManager.MOB_SPAWN_RANGE);
this.playerChunkTickRangeMap.add(player, chunkX, chunkZ, DistanceManager.MOB_SPAWN_RANGE);
// Paper end - optimise PlayerChunkMap#isOutsideRange
@ -51,7 +51,7 @@ index cde82f240924640575d4261d862052af03f31849..3d6d68b1f52d507a1f4db9a0c5da0907
}
void removePlayerFromDistanceMaps(ServerPlayer player) {
@@ -249,6 +257,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
@@ -250,6 +258,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
this.playerMobSpawnMap.remove(player);
this.playerChunkTickRangeMap.remove(player);
// Paper end - optimise PlayerChunkMap#isOutsideRange
@ -59,7 +59,7 @@ index cde82f240924640575d4261d862052af03f31849..3d6d68b1f52d507a1f4db9a0c5da0907
}
void updateMaps(ServerPlayer player) {
@@ -264,6 +273,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
@@ -265,6 +274,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
}
// Paper end - use distance map to optimise entity tracker
this.playerChunkTickRangeMap.update(player, chunkX, chunkZ, DistanceManager.MOB_SPAWN_RANGE); // Paper - optimise PlayerChunkMap#isOutsideRange
@ -67,7 +67,7 @@ index cde82f240924640575d4261d862052af03f31849..3d6d68b1f52d507a1f4db9a0c5da0907
}
// Paper end
// Paper start
@@ -419,6 +429,23 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
@@ -420,6 +430,23 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
}
});
// Paper end - optimise PlayerChunkMap#isOutsideRange
@ -92,7 +92,7 @@ index cde82f240924640575d4261d862052af03f31849..3d6d68b1f52d507a1f4db9a0c5da0907
protected ChunkGenerator generator() {
diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java
index 1c92416c3dc07d2348f092eee663e0226d43c8ba..dec294b771966ac42fd89fe5788af503c1f2ba8b 100644
index 94ba82b4c7d4a308eec0475d3fe790f0498dbe29..d47b21b5edc2734cdd45ed3282df98babe0045c0 100644
--- a/src/main/java/net/minecraft/server/level/ServerLevel.java
+++ b/src/main/java/net/minecraft/server/level/ServerLevel.java
@@ -396,6 +396,83 @@ public class ServerLevel extends Level implements WorldGenLevel {
@ -309,10 +309,10 @@ index 63ba93538d990fdd4c9e8c491bb715adc8d57986..e9a37fc6791366ea421f2766a36dc2e0
private static Boolean isValidSpawnPostitionForType(ServerLevel world, MobCategory group, StructureFeatureManager structureAccessor, ChunkGenerator chunkGenerator, MobSpawnSettings.SpawnerData spawnEntry, BlockPos.MutableBlockPos pos, double squaredDistance) { // Paper
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 875977f11678b34465abac30463675f57cf9fc4e..65541807d19cb3e14d86f72bed843b0d2d2d4511 100644
index ddf362fc14fcf83b22536b76cfc6ac1387b4c57a..0435c750ec03f65bad3f904070960d56c2ed4832 100644
--- a/src/main/java/net/minecraft/world/level/chunk/LevelChunk.java
+++ b/src/main/java/net/minecraft/world/level/chunk/LevelChunk.java
@@ -231,6 +231,93 @@ public class LevelChunk extends ChunkAccess {
@@ -237,6 +237,93 @@ public class LevelChunk extends ChunkAccess {
}
}
// Paper end

View File

@ -8,10 +8,10 @@ Instead, only iterate over navigators in the current region that are
eligible for repathing.
diff --git a/src/main/java/net/minecraft/server/level/ChunkMap.java b/src/main/java/net/minecraft/server/level/ChunkMap.java
index 3d6d68b1f52d507a1f4db9a0c5da09072624046e..3c5210e8454e3a482b2f4973c88349899f00f3a0 100644
index 399a98437ea632b8768a7c153dee7723c8499317..0b8a222e88794a4c54fc0010842b46a5df800068 100644
--- a/src/main/java/net/minecraft/server/level/ChunkMap.java
+++ b/src/main/java/net/minecraft/server/level/ChunkMap.java
@@ -281,15 +281,81 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
@@ -282,15 +282,81 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
public final io.papermc.paper.chunk.SingleThreadChunkRegionManager dataRegionManager;
public static final class DataRegionData implements io.papermc.paper.chunk.SingleThreadChunkRegionManager.RegionData {
@ -93,7 +93,7 @@ index 3d6d68b1f52d507a1f4db9a0c5da09072624046e..3c5210e8454e3a482b2f4973c8834989
}
@Override
@@ -299,6 +365,15 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
@@ -300,6 +366,15 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
final DataRegionSectionData sectionData = (DataRegionSectionData)section.sectionData;
final DataRegionData oldRegionData = oldRegion == null ? null : (DataRegionData)oldRegion.regionData;
final DataRegionData newRegionData = (DataRegionData)newRegion.regionData;
@ -110,7 +110,7 @@ index 3d6d68b1f52d507a1f4db9a0c5da09072624046e..3c5210e8454e3a482b2f4973c8834989
}
diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java
index dec294b771966ac42fd89fe5788af503c1f2ba8b..ac7fe0d08b1d44303d6578bb45c83a9cb7925b6e 100644
index d47b21b5edc2734cdd45ed3282df98babe0045c0..3b5dd838bc8759bd849f5dd2ee0f260a65d17adb 100644
--- a/src/main/java/net/minecraft/server/level/ServerLevel.java
+++ b/src/main/java/net/minecraft/server/level/ServerLevel.java
@@ -1090,6 +1090,7 @@ public class ServerLevel extends Level implements WorldGenLevel {
@ -121,7 +121,7 @@ index dec294b771966ac42fd89fe5788af503c1f2ba8b..ac7fe0d08b1d44303d6578bb45c83a9c
try {
if (currentlyTickingEntity.get() == null) {
currentlyTickingEntity.lazySet(entity);
@@ -1504,9 +1505,19 @@ public class ServerLevel extends Level implements WorldGenLevel {
@@ -1535,9 +1536,19 @@ public class ServerLevel extends Level implements WorldGenLevel {
VoxelShape voxelshape1 = newState.getCollisionShape(this, pos);
if (Shapes.joinIsNotEmpty(voxelshape, voxelshape1, BooleanOp.NOT_SAME)) {
@ -143,7 +143,7 @@ index dec294b771966ac42fd89fe5788af503c1f2ba8b..ac7fe0d08b1d44303d6578bb45c83a9c
// CraftBukkit start - fix SPIGOT-6362
Mob entityinsentient;
try {
@@ -1525,6 +1536,11 @@ public class ServerLevel extends Level implements WorldGenLevel {
@@ -1556,6 +1567,11 @@ public class ServerLevel extends Level implements WorldGenLevel {
navigationabstract.recomputePath(pos);
}
}
@ -155,7 +155,7 @@ index dec294b771966ac42fd89fe5788af503c1f2ba8b..ac7fe0d08b1d44303d6578bb45c83a9c
}
} // Paper
@@ -2320,10 +2336,12 @@ public class ServerLevel extends Level implements WorldGenLevel {
@@ -2351,10 +2367,12 @@ public class ServerLevel extends Level implements WorldGenLevel {
public void onTickingStart(Entity entity) {
ServerLevel.this.entityTickList.add(entity);

View File

@ -5,10 +5,10 @@ Subject: [PATCH] Fix merchant inventory not closing on entity removal
diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java
index ac7fe0d08b1d44303d6578bb45c83a9cb7925b6e..1cf809480d9ad7dd24c697d79621106544d32146 100644
index 3b5dd838bc8759bd849f5dd2ee0f260a65d17adb..53c3b1abc1acf0b847fa2e52b9941bd003971342 100644
--- a/src/main/java/net/minecraft/server/level/ServerLevel.java
+++ b/src/main/java/net/minecraft/server/level/ServerLevel.java
@@ -2409,6 +2409,11 @@ public class ServerLevel extends Level implements WorldGenLevel {
@@ -2440,6 +2440,11 @@ public class ServerLevel extends Level implements WorldGenLevel {
// Spigot end
// Spigot Start
if (entity.getBukkitEntity() instanceof org.bukkit.inventory.InventoryHolder) {

View File

@ -12,11 +12,11 @@ time to save, as flush saving performs a full flush at
the end anyways.
diff --git a/src/main/java/net/minecraft/server/level/ChunkMap.java b/src/main/java/net/minecraft/server/level/ChunkMap.java
index 3c5210e8454e3a482b2f4973c88349899f00f3a0..3947e1f2823e8d077350b7e781c04a4b46a83939 100644
index 0b8a222e88794a4c54fc0010842b46a5df800068..8dbbb09cac61da0d252974f2df85ce6aa655a853 100644
--- a/src/main/java/net/minecraft/server/level/ChunkMap.java
+++ b/src/main/java/net/minecraft/server/level/ChunkMap.java
@@ -840,6 +840,16 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
}
@@ -899,6 +899,16 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
// Paper end
protected void saveAllChunks(boolean flush) {
+ // Paper start - do not overload I/O threads with too much work when saving
@ -32,7 +32,7 @@ index 3c5210e8454e3a482b2f4973c88349899f00f3a0..3947e1f2823e8d077350b7e781c04a4b
if (flush) {
List<ChunkHolder> list = (List) this.updatingChunks.getVisibleValuesCopy().stream().filter(ChunkHolder::wasAccessibleSinceLastSave).peek(ChunkHolder::refreshAccessibility).collect(Collectors.toList()); // Paper
MutableBoolean mutableboolean = new MutableBoolean();
@@ -862,6 +872,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
@@ -921,6 +931,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
}).filter((ichunkaccess) -> {
return ichunkaccess instanceof ImposterProtoChunk || ichunkaccess instanceof LevelChunk;
}).filter(this::save).forEach((ichunkaccess) -> {

View File

@ -10,10 +10,10 @@ chunk bans via the large amount of NBT created by unstacking the items.
Fixes GH-5140 and GH-4748.
diff --git a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
index 8cb3767551d36cc2c7c07548182d817f9843bf50..e5543b3a261f80bd9b0346d595a62b5458d9b229 100644
index 4d85af9d021291e813daa3a44e8bae340fc568fb..dd3a0903f9a26986edca4d1d6a78d0404069e990 100644
--- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
+++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
@@ -853,6 +853,11 @@ public class PaperWorldConfig {
@@ -868,6 +868,11 @@ public class PaperWorldConfig {
allowPlayerCrammingDamage = getBoolean("allow-player-cramming-damage", allowPlayerCrammingDamage);
}

View File

@ -19,10 +19,10 @@ index ee53453440177537fc653ea156785d7591498614..5e3b7fb2e0b7608610555cd23e7ad25a
}
final Object val = config.get(key);
diff --git a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
index e5543b3a261f80bd9b0346d595a62b5458d9b229..45abadeb2568566b3646004d03e7ba8c1766c18a 100644
index dd3a0903f9a26986edca4d1d6a78d0404069e990..82a6b481c745cc6f70e2afa922b6c362161069fa 100644
--- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
+++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
@@ -898,6 +898,55 @@ public class PaperWorldConfig {
@@ -913,6 +913,55 @@ public class PaperWorldConfig {
return table;
}