More more more more more more more more patches

This commit is contained in:
Nassim Jahnke 2022-06-08 12:40:44 +02:00
parent f0e575f445
commit 82f712c096
No known key found for this signature in database
GPG Key ID: 6BE3B555EBC5982B
17 changed files with 88 additions and 91 deletions

View File

@ -6,7 +6,7 @@ Subject: [PATCH] Optimise chunk tick iteration
Use a dedicated list of entity ticking chunks to reduce the cost
diff --git a/src/main/java/net/minecraft/server/level/ChunkHolder.java b/src/main/java/net/minecraft/server/level/ChunkHolder.java
index b9d3535dd4e0af771bb74c85f18265e38f383e0e..469b921cceabc3f42961e8aa5314bdc849ad41b9 100644
index 77c7fe4d39f09499274ac34fd6c3f3a99cfbdd1d..020617ec8e5e77920d36380f019e430286006f89 100644
--- a/src/main/java/net/minecraft/server/level/ChunkHolder.java
+++ b/src/main/java/net/minecraft/server/level/ChunkHolder.java
@@ -86,11 +86,21 @@ public class ChunkHolder {
@ -40,7 +40,7 @@ index b9d3535dd4e0af771bb74c85f18265e38f383e0e..469b921cceabc3f42961e8aa5314bdc8
this.changedBlocksPerSection[i] = new ShortOpenHashSet();
}
@@ -273,6 +283,7 @@ public class ChunkHolder {
@@ -276,6 +286,7 @@ public class ChunkHolder {
int k = this.lightEngine.getMaxLightSection();
if (y >= j && y <= k) {
@ -48,7 +48,7 @@ index b9d3535dd4e0af771bb74c85f18265e38f383e0e..469b921cceabc3f42961e8aa5314bdc8
int l = y - j;
if (lightType == LightLayer.SKY) {
@@ -286,8 +297,19 @@ public class ChunkHolder {
@@ -290,8 +301,19 @@ public class ChunkHolder {
}
}
@ -70,10 +70,10 @@ index b9d3535dd4e0af771bb74c85f18265e38f383e0e..469b921cceabc3f42961e8aa5314bdc8
int i = 0;
diff --git a/src/main/java/net/minecraft/server/level/ChunkMap.java b/src/main/java/net/minecraft/server/level/ChunkMap.java
index 5d60fa26e9f5d3c9c57a61c509d5b924bbed3281..ef28e0f57ba593265a3eca4d3f21d0b1b51e8740 100644
index 30fbb3df9b91697cca0f0fc7982dced758bdd778..bb9f0614b9a2945c78f1b45a70adcb6a22bfda2b 100644
--- a/src/main/java/net/minecraft/server/level/ChunkMap.java
+++ b/src/main/java/net/minecraft/server/level/ChunkMap.java
@@ -159,6 +159,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
@@ -163,6 +163,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
private final Queue<Runnable> unloadQueue;
int viewDistance;
public final com.destroystokyo.paper.util.misc.PlayerAreaMap playerMobDistanceMap; // Paper
@ -82,10 +82,10 @@ index 5d60fa26e9f5d3c9c57a61c509d5b924bbed3281..ef28e0f57ba593265a3eca4d3f21d0b1
// CraftBukkit start - recursion-safe executor for Chunk loadCallback() and unloadCallback()
public final CallbackExecutor callbackExecutor = new CallbackExecutor();
diff --git a/src/main/java/net/minecraft/server/level/ServerChunkCache.java b/src/main/java/net/minecraft/server/level/ServerChunkCache.java
index eca75916c5e476db280e58522e5540def4f4de68..d06ad4f2c76eebd3b8191f3de6c0199fa3bb5f22 100644
index ad36cf0788044d2249d71223d85d9a43c0d16067..108164945f2aa088834585d9d80274ea551608d9 100644
--- a/src/main/java/net/minecraft/server/level/ServerChunkCache.java
+++ b/src/main/java/net/minecraft/server/level/ServerChunkCache.java
@@ -46,6 +46,7 @@ import net.minecraft.world.level.levelgen.structure.templatesystem.StructureMana
@@ -47,6 +47,7 @@ import net.minecraft.world.level.levelgen.structure.templatesystem.StructureTemp
import net.minecraft.world.level.storage.DimensionDataStorage;
import net.minecraft.world.level.storage.LevelData;
import net.minecraft.world.level.storage.LevelStorageSource;
@ -93,7 +93,7 @@ index eca75916c5e476db280e58522e5540def4f4de68..d06ad4f2c76eebd3b8191f3de6c0199f
public class ServerChunkCache extends ChunkSource {
@@ -986,34 +987,42 @@ public class ServerChunkCache extends ChunkSource {
@@ -987,34 +988,42 @@ public class ServerChunkCache extends ChunkSource {
this.lastSpawnState = spawnercreature_d;
gameprofilerfiller.popPush("filteringLoadedChunks");
@ -152,7 +152,7 @@ index eca75916c5e476db280e58522e5540def4f4de68..d06ad4f2c76eebd3b8191f3de6c0199f
NaturalSpawner.spawnForChunk(this.level, chunk1, spawnercreature_d, this.spawnFriendlies, this.spawnEnemies, flag1);
}
@@ -1021,7 +1030,16 @@ public class ServerChunkCache extends ChunkSource {
@@ -1022,7 +1031,16 @@ public class ServerChunkCache extends ChunkSource {
this.level.tickChunk(chunk1, k);
}
}
@ -169,7 +169,7 @@ index eca75916c5e476db280e58522e5540def4f4de68..d06ad4f2c76eebd3b8191f3de6c0199f
this.level.timings.chunkTicks.stopTiming(); // Paper
gameprofilerfiller.popPush("customSpawners");
if (flag2) {
@@ -1029,15 +1047,24 @@ public class ServerChunkCache extends ChunkSource {
@@ -1030,15 +1048,24 @@ public class ServerChunkCache extends ChunkSource {
this.level.tickCustomSpawners(this.spawnEnemies, this.spawnFriendlies);
} // Paper - timings
}

View File

@ -19,10 +19,10 @@ 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 8aaf73d24ddff65c45eeb18d573e20fb8a1439a5..fddb279d161b30d6944495f0de9f6b7e21761a80 100644
index 939170ade7c24bcf1c358f00931f867599cf9d54..786eafffa9bc51399c7fdf0012dfdaa9c92e71b0 100644
--- a/src/main/java/net/minecraft/server/MinecraftServer.java
+++ b/src/main/java/net/minecraft/server/MinecraftServer.java
@@ -1344,6 +1344,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
@@ -1302,6 +1302,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
private boolean pollTaskInternal() {
if (super.pollTask()) {
@ -30,7 +30,7 @@ index 8aaf73d24ddff65c45eeb18d573e20fb8a1439a5..fddb279d161b30d6944495f0de9f6b7e
return true;
} else {
if (this.haveTime()) {
@@ -2665,4 +2666,74 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
@@ -2624,4 +2625,74 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
}
}
// Paper end
@ -106,10 +106,10 @@ index 8aaf73d24ddff65c45eeb18d573e20fb8a1439a5..fddb279d161b30d6944495f0de9f6b7e
+ // Paper end - execute chunk tasks mid tick
}
diff --git a/src/main/java/net/minecraft/server/level/ServerChunkCache.java b/src/main/java/net/minecraft/server/level/ServerChunkCache.java
index d06ad4f2c76eebd3b8191f3de6c0199fa3bb5f22..e14215d538d19838041e3e21a84396c2f31ecd8e 100644
index 108164945f2aa088834585d9d80274ea551608d9..6058a6d30880f789244e4054cadd43941b7778bd 100644
--- a/src/main/java/net/minecraft/server/level/ServerChunkCache.java
+++ b/src/main/java/net/minecraft/server/level/ServerChunkCache.java
@@ -1011,6 +1011,7 @@ public class ServerChunkCache extends ChunkSource {
@@ -1012,6 +1012,7 @@ public class ServerChunkCache extends ChunkSource {
iterator1 = shuffled.iterator();
}
@ -117,7 +117,7 @@ index d06ad4f2c76eebd3b8191f3de6c0199fa3bb5f22..e14215d538d19838041e3e21a84396c2
try {
while (iterator1.hasNext()) {
LevelChunk chunk1 = iterator1.next();
@@ -1028,6 +1029,7 @@ public class ServerChunkCache extends ChunkSource {
@@ -1029,6 +1030,7 @@ public class ServerChunkCache extends ChunkSource {
if (this.level.shouldTickBlocksAt(chunkcoordintpair.toLong())) {
this.level.tickChunk(chunk1, k);
@ -126,21 +126,18 @@ index d06ad4f2c76eebd3b8191f3de6c0199fa3bb5f22..e14215d538d19838041e3e21a84396c2
}
// Paper start - optimise chunk tick iteration
diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java
index 848601bf0a5af305a0eef48d5870afc0fcce3af0..8fc78a0405359e6031e66e988f3ddbf913ca59bd 100644
index 18f28b5ea2919fb12fd1e76555026c2161564372..07f5c61fc3da270215133d2d0240e96f701a6216 100644
--- a/src/main/java/net/minecraft/server/level/ServerLevel.java
+++ b/src/main/java/net/minecraft/server/level/ServerLevel.java
@@ -202,7 +202,9 @@ public class ServerLevel extends Level implements WorldGenLevel {
private final StructureFeatureManager structureFeatureManager;
@@ -209,6 +209,7 @@ public class ServerLevel extends Level implements WorldGenLevel {
private final StructureManager structureManager;
private final StructureCheck structureCheck;
private final boolean tickTime;
-
+ // Paper start - execute chunk tasks mid tick
+ public long lastMidTickExecuteFailure;
+ // Paper end - execute chunk tasks mid tick
+ public long lastMidTickExecuteFailure; // Paper - execute chunk tasks mid tick
// CraftBukkit start
private int tickPosition;
@@ -965,6 +967,7 @@ public class ServerLevel extends Level implements WorldGenLevel {
public final LevelStorageSource.LevelStorageAccess convertable;
@@ -983,6 +984,7 @@ public class ServerLevel extends Level implements WorldGenLevel {
if (fluid1.is(fluid)) {
fluid1.tick(this, pos);
}
@ -148,7 +145,7 @@ index 848601bf0a5af305a0eef48d5870afc0fcce3af0..8fc78a0405359e6031e66e988f3ddbf9
}
@@ -974,6 +977,7 @@ public class ServerLevel extends Level implements WorldGenLevel {
@@ -992,6 +994,7 @@ public class ServerLevel extends Level implements WorldGenLevel {
if (iblockdata.is(block)) {
iblockdata.tick(this, pos, this.random);
}
@ -157,12 +154,12 @@ index 848601bf0a5af305a0eef48d5870afc0fcce3af0..8fc78a0405359e6031e66e988f3ddbf9
}
diff --git a/src/main/java/net/minecraft/world/level/Level.java b/src/main/java/net/minecraft/world/level/Level.java
index 944519c4433710610ac5015d3d3de380d9ec39c9..06035b728a66a63582c34c85096bada1588bfaa6 100644
index e613d3171200dc436a45bd1980a106d936e351cd..f9ffdeb250e472180616d5b7e944b69e17a217dd 100644
--- a/src/main/java/net/minecraft/world/level/Level.java
+++ b/src/main/java/net/minecraft/world/level/Level.java
@@ -838,6 +838,11 @@ public abstract class Level implements LevelAccessor, AutoCloseable {
@@ -795,6 +795,11 @@ public abstract class Level implements LevelAccessor, AutoCloseable {
// Spigot end
} else if (this.shouldTickBlocksAt(ChunkPos.asLong(tickingblockentity.getPos()))) {
} else if (this.shouldTickBlocksAt(tickingblockentity.getPos())) {
tickingblockentity.tick();
+ // Paper start - execute chunk tasks during tick
+ if ((this.tileTickPosition & 7) == 0) {
@ -172,7 +169,7 @@ index 944519c4433710610ac5015d3d3de380d9ec39c9..06035b728a66a63582c34c85096bada1
}
}
this.blockEntityTickers.removeAll(toRemove);
@@ -852,6 +857,7 @@ public abstract class Level implements LevelAccessor, AutoCloseable {
@@ -809,6 +814,7 @@ public abstract class Level implements LevelAccessor, AutoCloseable {
public <T extends Entity> void guardEntityTick(Consumer<T> tickConsumer, T entity) {
try {
tickConsumer.accept(entity);

View File

@ -35,10 +35,10 @@ index a6bcf936747720202857ba586fa35c46c9c91caf..63294b95ec062e32c87e52560353374d
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 ef28e0f57ba593265a3eca4d3f21d0b1b51e8740..f4c1316ae1cadc1a7a7fed16e0e99704662c41e8 100644
index bb9f0614b9a2945c78f1b45a70adcb6a22bfda2b..66a627a6b58ef5b420aceb0a3a1bcf90aec13198 100644
--- a/src/main/java/net/minecraft/server/level/ChunkMap.java
+++ b/src/main/java/net/minecraft/server/level/ChunkMap.java
@@ -123,9 +123,11 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
@@ -126,9 +126,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,16 +52,16 @@ index ef28e0f57ba593265a3eca4d3f21d0b1b51e8740..f4c1316ae1cadc1a7a7fed16e0e99704
private final Long2ObjectLinkedOpenHashMap<ChunkHolder> pendingUnloads;
public final LongSet entitiesInLevel;
public final ServerLevel level;
@@ -317,7 +319,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
@@ -321,7 +323,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) {
public ChunkMap(ServerLevel world, LevelStorageSource.LevelStorageAccess session, DataFixer dataFixer, StructureTemplateManager structureTemplateManager, 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();
+ // Paper - don't copy
this.pendingUnloads = new Long2ObjectLinkedOpenHashMap();
this.entitiesInLevel = new LongOpenHashSet();
this.toDrop = new LongOpenHashSet();
@@ -541,12 +543,17 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
@@ -557,12 +559,17 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
@Nullable
public ChunkHolder getUpdatingChunkIfPresent(long pos) {
@ -81,7 +81,7 @@ index ef28e0f57ba593265a3eca4d3f21d0b1b51e8740..f4c1316ae1cadc1a7a7fed16e0e99704
}
protected IntSupplier getChunkQueueLevel(long pos) {
@@ -686,9 +693,9 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
@@ -702,9 +709,9 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
};
stringbuilder.append("Updating:").append(System.lineSeparator());
@ -93,7 +93,7 @@ index ef28e0f57ba593265a3eca4d3f21d0b1b51e8740..f4c1316ae1cadc1a7a7fed16e0e99704
CrashReport crashreport = CrashReport.forThrowable(exception, "Chunk loading");
CrashReportCategory crashreportsystemdetails = crashreport.addCategory("Chunk loading");
@@ -739,7 +746,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
@@ -755,7 +762,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
// Paper end
}
@ -102,7 +102,7 @@ index ef28e0f57ba593265a3eca4d3f21d0b1b51e8740..f4c1316ae1cadc1a7a7fed16e0e99704
this.modified = true;
}
@@ -819,7 +826,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
@@ -835,7 +842,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
protected void saveAllChunks(boolean flush) {
if (flush) {
@ -111,7 +111,7 @@ index ef28e0f57ba593265a3eca4d3f21d0b1b51e8740..f4c1316ae1cadc1a7a7fed16e0e99704
MutableBoolean mutableboolean = new MutableBoolean();
do {
@@ -850,7 +857,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
@@ -866,7 +873,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 {
@ -120,7 +120,7 @@ index ef28e0f57ba593265a3eca4d3f21d0b1b51e8740..f4c1316ae1cadc1a7a7fed16e0e99704
}
}
@@ -873,14 +880,14 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
@@ -889,14 +896,14 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
}
public boolean hasWork() {
@ -137,7 +137,7 @@ index ef28e0f57ba593265a3eca4d3f21d0b1b51e8740..f4c1316ae1cadc1a7a7fed16e0e99704
if (playerchunk != null) {
playerchunk.onChunkRemove(); // Paper
@@ -975,7 +982,12 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
@@ -991,7 +998,12 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
if (!this.modified) {
return false;
} else {
@ -151,7 +151,7 @@ index ef28e0f57ba593265a3eca4d3f21d0b1b51e8740..f4c1316ae1cadc1a7a7fed16e0e99704
this.modified = false;
return true;
}
@@ -1465,7 +1477,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
@@ -1491,7 +1503,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
this.viewDistance = j;
this.distanceManager.updatePlayerTickets(this.viewDistance + 1);
@ -160,7 +160,7 @@ index ef28e0f57ba593265a3eca4d3f21d0b1b51e8740..f4c1316ae1cadc1a7a7fed16e0e99704
while (objectiterator.hasNext()) {
ChunkHolder playerchunk = (ChunkHolder) objectiterator.next();
@@ -1508,7 +1520,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
@@ -1534,7 +1546,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
}
public int size() {
@ -169,7 +169,7 @@ index ef28e0f57ba593265a3eca4d3f21d0b1b51e8740..f4c1316ae1cadc1a7a7fed16e0e99704
}
public DistanceManager getDistanceManager() {
@@ -1516,13 +1528,13 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
@@ -1542,13 +1554,13 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
}
protected Iterable<ChunkHolder> getChunks() {
@ -186,7 +186,7 @@ index ef28e0f57ba593265a3eca4d3f21d0b1b51e8740..f4c1316ae1cadc1a7a7fed16e0e99704
while (objectbidirectionaliterator.hasNext()) {
Entry<ChunkHolder> entry = (Entry) objectbidirectionaliterator.next();
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
index 42434152c79f8318009b02e9a39326fd9d4ff466..f05ff9891d59cd7ae4e37c05c690dda0c75962fe 100644
index fdc4879ff05616dfe89b78bfae5c1d9aad87577d..24d2a9b4a1c602b8ac5960ed9668ab70f34d6620 100644
--- a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
+++ b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
@@ -161,7 +161,7 @@ public class CraftWorld extends CraftRegionAccessor implements World {

View File

@ -10,7 +10,7 @@ hoping that at least then we don't swap chunks, and maybe recover
them all.
diff --git a/src/main/java/net/minecraft/world/level/chunk/storage/ChunkSerializer.java b/src/main/java/net/minecraft/world/level/chunk/storage/ChunkSerializer.java
index 7de66cec1eeaf797d61c815a34267c3dc85f0719..61b26c2cb332afd7215c013fbdf144b4a023d898 100644
index 12e3831324abdc1112cbe65cab0f0c75ce77a9ef..be9c15fe141ede1132dbe07ba4bfcf22036ab194 100644
--- a/src/main/java/net/minecraft/world/level/chunk/storage/ChunkSerializer.java
+++ b/src/main/java/net/minecraft/world/level/chunk/storage/ChunkSerializer.java
@@ -68,6 +68,18 @@ import net.minecraft.world.ticks.ProtoChunkTicks;
@ -30,9 +30,9 @@ index 7de66cec1eeaf797d61c815a34267c3dc85f0719..61b26c2cb332afd7215c013fbdf144b4
+ }
+ // Paper end
public static final Codec<PalettedContainer<BlockState>> BLOCK_STATE_CODEC = PalettedContainer.codec(Block.BLOCK_STATE_REGISTRY, BlockState.CODEC, PalettedContainer.Strategy.SECTION_STATES, Blocks.AIR.defaultBlockState(), null); // Paper - Anti-Xray - Add preset block states
public static final Codec<PalettedContainer<BlockState>> BLOCK_STATE_CODEC = PalettedContainer.codecRW(Block.BLOCK_STATE_REGISTRY, BlockState.CODEC, PalettedContainer.Strategy.SECTION_STATES, Blocks.AIR.defaultBlockState(), null); // Paper - Anti-Xray - Add preset block states
private static final Logger LOGGER = LogUtils.getLogger();
@@ -456,7 +468,7 @@ public class ChunkSerializer {
@@ -473,7 +485,7 @@ public class ChunkSerializer {
nbttagcompound.putInt("xPos", chunkcoordintpair.x);
nbttagcompound.putInt("yPos", chunk.getMinSection());
nbttagcompound.putInt("zPos", chunkcoordintpair.z);
@ -42,10 +42,10 @@ index 7de66cec1eeaf797d61c815a34267c3dc85f0719..61b26c2cb332afd7215c013fbdf144b4
nbttagcompound.putString("Status", chunk.getStatus().getName());
BlendingData blendingdata = chunk.getBlendingData();
diff --git a/src/main/java/net/minecraft/world/level/chunk/storage/ChunkStorage.java b/src/main/java/net/minecraft/world/level/chunk/storage/ChunkStorage.java
index 392fd2f5919d6a8f37c9f2b0421831d6ce381e0c..f706058877dc3f88aab4e7028665ca53376beac1 100644
index 315be30daf0be84efbb4d634dc01e1bf9e6e696e..3010e092bd1337e5a6b99636bbd312d90e470acf 100644
--- a/src/main/java/net/minecraft/world/level/chunk/storage/ChunkStorage.java
+++ b/src/main/java/net/minecraft/world/level/chunk/storage/ChunkStorage.java
@@ -38,7 +38,7 @@ public class ChunkStorage implements AutoCloseable {
@@ -41,7 +41,7 @@ public class ChunkStorage implements AutoCloseable {
this.fixerUpper = dataFixer;
// Paper start - async chunk io
// remove IO worker

View File

@ -299,10 +299,10 @@ index 0bca0f971dac994bd8b6ecd87e8b33e26c0f18f9..edd3c745efb40ee79a1393199c7a27dd
@Override
diff --git a/src/main/java/net/minecraft/world/level/block/state/properties/IntegerProperty.java b/src/main/java/net/minecraft/world/level/block/state/properties/IntegerProperty.java
index 72f508321ebffcca31240fbdd068b4d185454cbc..d16156f8a4a2507e114dc651fd0af9cdffb3c8e0 100644
index bdbe0362e49e73c05237f9f3143230e0b03e494e..8eb20ea852a8e89c431fea55a7b60833a6c8104f 100644
--- a/src/main/java/net/minecraft/world/level/block/state/properties/IntegerProperty.java
+++ b/src/main/java/net/minecraft/world/level/block/state/properties/IntegerProperty.java
@@ -13,6 +13,16 @@ public class IntegerProperty extends Property<Integer> {
@@ -11,6 +11,16 @@ public class IntegerProperty extends Property<Integer> {
public final int min;
public final int max;
@ -318,7 +318,7 @@ index 72f508321ebffcca31240fbdd068b4d185454cbc..d16156f8a4a2507e114dc651fd0af9cd
+
protected IntegerProperty(String name, int min, int max) {
super(name, Integer.class);
this.min = min;
if (min < 0) {
diff --git a/src/main/java/net/minecraft/world/level/block/state/properties/Property.java b/src/main/java/net/minecraft/world/level/block/state/properties/Property.java
index a37424bbc6bee02354abaa793aa0865c556c6bbe..f923593bd336dd1a950ba61603d53edb3c9703eb 100644
--- a/src/main/java/net/minecraft/world/level/block/state/properties/Property.java

View File

@ -7,10 +7,10 @@ Subject: [PATCH] Detail more information in watchdog dumps
- Dump player name, player uuid, position, and world for packet handling
diff --git a/src/main/java/net/minecraft/network/Connection.java b/src/main/java/net/minecraft/network/Connection.java
index 2717252c8c87abeb90c9a0ee82e574276e9d01cf..47eadb4a08953a45300d769518af22b1463f4d11 100644
index 47d4a22577f583acad44c1124a39ede6c33d03fa..2c298b11dee7df7733bdd9539a96a63739940f7d 100644
--- a/src/main/java/net/minecraft/network/Connection.java
+++ b/src/main/java/net/minecraft/network/Connection.java
@@ -464,7 +464,14 @@ public class Connection extends SimpleChannelInboundHandler<Packet<?>> {
@@ -466,7 +466,14 @@ public class Connection extends SimpleChannelInboundHandler<Packet<?>> {
}
if (this.packetListener instanceof ServerGamePacketListenerImpl) {
@ -26,7 +26,7 @@ index 2717252c8c87abeb90c9a0ee82e574276e9d01cf..47eadb4a08953a45300d769518af22b1
if (!this.isConnected() && !this.disconnectionHandled) {
diff --git a/src/main/java/net/minecraft/network/protocol/PacketUtils.java b/src/main/java/net/minecraft/network/protocol/PacketUtils.java
index 97b05b7145c6a3a379de31b8988c909da9b21139..f7bb26e8b7a74a9ae5b469351b2fccc6fc80ab6a 100644
index a34f22cadc09e53ea4de787b04d050b99dddbcac..c8012de68b997d6270ba4a5d79bc93c09ff4354f 100644
--- a/src/main/java/net/minecraft/network/protocol/PacketUtils.java
+++ b/src/main/java/net/minecraft/network/protocol/PacketUtils.java
@@ -15,6 +15,24 @@ public class PacketUtils {
@ -77,10 +77,10 @@ index 97b05b7145c6a3a379de31b8988c909da9b21139..f7bb26e8b7a74a9ae5b469351b2fccc6
});
throw RunningOnDifferentThreadException.RUNNING_ON_DIFFERENT_THREAD;
diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java
index 8fc78a0405359e6031e66e988f3ddbf913ca59bd..32446e874fdad36f9f80d22481a4d990967f38e3 100644
index 07f5c61fc3da270215133d2d0240e96f701a6216..4566c7b0cd5551f2e348e532911e77c62d3de2f2 100644
--- a/src/main/java/net/minecraft/server/level/ServerLevel.java
+++ b/src/main/java/net/minecraft/server/level/ServerLevel.java
@@ -981,7 +981,26 @@ public class ServerLevel extends Level implements WorldGenLevel {
@@ -998,7 +998,26 @@ public class ServerLevel extends Level implements WorldGenLevel {
}
@ -107,7 +107,7 @@ index 8fc78a0405359e6031e66e988f3ddbf913ca59bd..32446e874fdad36f9f80d22481a4d990
++TimingHistory.entityTicks; // Paper - timings
// Spigot start
co.aikar.timings.Timing timer; // Paper
@@ -1021,7 +1040,13 @@ public class ServerLevel extends Level implements WorldGenLevel {
@@ -1038,7 +1057,13 @@ public class ServerLevel extends Level implements WorldGenLevel {
this.tickPassenger(entity, entity1);
}
// } finally { timer.stopTiming(); } // Paper - timings - move up
@ -123,10 +123,10 @@ index 8fc78a0405359e6031e66e988f3ddbf913ca59bd..32446e874fdad36f9f80d22481a4d990
private void tickPassenger(Entity vehicle, Entity passenger) {
diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java
index 9a91de63420e5b910e37773362376d500c78ce97..d3b78f536806246d0474a00bd482b69651455ccf 100644
index 3f163aac6d5074e8952f48176481403834f20ae0..406cf22d8b8ad4f3a19ce8091c290f22be05e6bb 100644
--- a/src/main/java/net/minecraft/world/entity/Entity.java
+++ b/src/main/java/net/minecraft/world/entity/Entity.java
@@ -908,7 +908,42 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource {
@@ -930,7 +930,42 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource {
return this.onGround;
}
@ -169,7 +169,7 @@ index 9a91de63420e5b910e37773362376d500c78ce97..d3b78f536806246d0474a00bd482b696
if (this.noPhysics) {
this.setPos(this.getX() + movement.x, this.getY() + movement.y, this.getZ() + movement.z);
} else {
@@ -1079,6 +1114,13 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource {
@@ -1103,6 +1138,13 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource {
this.level.getProfiler().pop();
}
}
@ -183,7 +183,7 @@ index 9a91de63420e5b910e37773362376d500c78ce97..d3b78f536806246d0474a00bd482b696
}
protected boolean isHorizontalCollisionMinor(Vec3 adjustedMovement) {
@@ -3860,7 +3902,9 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource {
@@ -3911,7 +3953,9 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource {
}
public void setDeltaMovement(Vec3 velocity) {
@ -193,9 +193,9 @@ index 9a91de63420e5b910e37773362376d500c78ce97..d3b78f536806246d0474a00bd482b696
}
public void setDeltaMovement(double x, double y, double z) {
@@ -3936,7 +3980,9 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource {
}
// Paper end - fix MC-4
@@ -3977,7 +4021,9 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource {
public final void setPosRaw(double x, double y, double z, boolean forceBoundingBoxUpdate) {
// Paper end
if (this.position.x != x || this.position.y != y || this.position.z != z) {
+ synchronized (this.posLock) { // Paper
this.position = new Vec3(x, y, z);

View File

@ -5,7 +5,7 @@ Subject: [PATCH] Manually inline methods in BlockPosition
diff --git a/src/main/java/net/minecraft/core/BlockPos.java b/src/main/java/net/minecraft/core/BlockPos.java
index 11745a71e5b2f00417b4e7f9cbc516071bd45ed9..2808acafaa0e3b448e75c40c04ba932ef9723da9 100644
index e68cd32a7db88f29d3224b0908119232ab3cf71a..153451ecd5b3c8e8ecb2d5ec91ccd582d4300899 100644
--- a/src/main/java/net/minecraft/core/BlockPos.java
+++ b/src/main/java/net/minecraft/core/BlockPos.java
@@ -484,9 +484,9 @@ public class BlockPos extends Vec3i {

View File

@ -19,10 +19,10 @@ index eada966d7f108a6081be7a848f5c1dfcb1eed676..a977f7483f37df473096b2234dc1308b
public static final Timing midTickChunkTasks = Timings.ofSafe("Mid Tick Chunk Tasks");
diff --git a/src/main/java/net/minecraft/server/level/ServerChunkCache.java b/src/main/java/net/minecraft/server/level/ServerChunkCache.java
index e14215d538d19838041e3e21a84396c2f31ecd8e..84f386e5f15d956cfd279baecd01558dcf9af88d 100644
index 6058a6d30880f789244e4054cadd43941b7778bd..cc57efc087268d7639544dd12765082909db827a 100644
--- a/src/main/java/net/minecraft/server/level/ServerChunkCache.java
+++ b/src/main/java/net/minecraft/server/level/ServerChunkCache.java
@@ -823,6 +823,7 @@ public class ServerChunkCache extends ChunkSource {
@@ -824,6 +824,7 @@ public class ServerChunkCache extends ChunkSource {
public boolean runDistanceManagerUpdates() {
if (distanceManager.delayDistanceManagerTick) return false; // Paper - Chunk priority
if (this.chunkMap.unloadingPlayerChunk) { LOGGER.error("Cannot tick distance manager while unloading playerchunks", new Throwable()); throw new IllegalStateException("Cannot tick distance manager while unloading playerchunks"); } // Paper
@ -30,7 +30,7 @@ index e14215d538d19838041e3e21a84396c2f31ecd8e..84f386e5f15d956cfd279baecd01558d
boolean flag = this.distanceManager.runAllUpdates(this.chunkMap);
boolean flag1 = this.chunkMap.promoteChunkMap();
@@ -832,6 +833,7 @@ public class ServerChunkCache extends ChunkSource {
@@ -833,6 +834,7 @@ public class ServerChunkCache extends ChunkSource {
this.clearCache();
return true;
}

View File

@ -13,10 +13,10 @@ Paper recently reverted this optimisation, so it's been reintroduced
here.
diff --git a/src/main/java/net/minecraft/world/level/Level.java b/src/main/java/net/minecraft/world/level/Level.java
index 06035b728a66a63582c34c85096bada1588bfaa6..843c36a8272ea5affe0a4f3baa9e15823ad74059 100644
index f9ffdeb250e472180616d5b7e944b69e17a217dd..f0721f2311769cff31ffb83a6c1cfeb9927f32a4 100644
--- a/src/main/java/net/minecraft/world/level/Level.java
+++ b/src/main/java/net/minecraft/world/level/Level.java
@@ -353,6 +353,15 @@ public abstract class Level implements LevelAccessor, AutoCloseable {
@@ -364,6 +364,15 @@ public abstract class Level implements LevelAccessor, AutoCloseable {
@Override
public final LevelChunk getChunk(int chunkX, int chunkZ) { // Paper - final to help inline

View File

@ -24,10 +24,10 @@ and an action can be defined: DROP or KICK
If interval or rate are less-than 0, the limit is ignored
diff --git a/src/main/java/com/destroystokyo/paper/PaperConfig.java b/src/main/java/com/destroystokyo/paper/PaperConfig.java
index 5c1062f1f9578f2c728b0674eb3a1785b9c345b5..919ce4ee6aafe925e520424dc0529999b536ecc7 100644
index 1978f4bc9cf3ac5f24e6a558c50fd772b4ca2685..96d5b89d67f0904c0a6f68a7bbffc48457e850de 100644
--- a/src/main/java/com/destroystokyo/paper/PaperConfig.java
+++ b/src/main/java/com/destroystokyo/paper/PaperConfig.java
@@ -521,4 +521,102 @@ public class PaperConfig {
@@ -517,4 +517,102 @@ public class PaperConfig {
itemValidationBookAuthorLength = getInt("settings.item-validation.book.author", itemValidationBookAuthorLength);
itemValidationBookPageLength = getInt("settings.item-validation.book.page", itemValidationBookPageLength);
}
@ -131,7 +131,7 @@ index 5c1062f1f9578f2c728b0674eb3a1785b9c345b5..919ce4ee6aafe925e520424dc0529999
+ }
}
diff --git a/src/main/java/net/minecraft/network/Connection.java b/src/main/java/net/minecraft/network/Connection.java
index 47eadb4a08953a45300d769518af22b1463f4d11..b27610cde8eaa7ff35c777039a0ca9d8eab748fe 100644
index 2c298b11dee7df7733bdd9539a96a63739940f7d..094366b2c44992cbd41dceb5d71eb9f4edf3dd05 100644
--- a/src/main/java/net/minecraft/network/Connection.java
+++ b/src/main/java/net/minecraft/network/Connection.java
@@ -136,6 +136,22 @@ public class Connection extends SimpleChannelInboundHandler<Packet<?>> {

View File

@ -7,10 +7,10 @@ Subject: [PATCH] Use correct LevelStem registry when loading default
Co-authored-by: Jake Potrebic <jake.m.potrebic@gmail.com>
diff --git a/src/main/java/net/minecraft/resources/RegistryLoader.java b/src/main/java/net/minecraft/resources/RegistryLoader.java
index 0d28a3a7f52174e70e044957b37361043b153e42..cdd2556e0401be0411563b89c6b7456a4778376a 100644
index 8da1226a6c293abb038d10c7921a77ed71ad06cc..f958f0ae738a6fb26400e17e54c8d69e95268cdd 100644
--- a/src/main/java/net/minecraft/resources/RegistryLoader.java
+++ b/src/main/java/net/minecraft/resources/RegistryLoader.java
@@ -42,6 +42,12 @@ public class RegistryLoader {
@@ -46,6 +46,12 @@ public class RegistryLoader {
RegistryLoader.ReadCache<E> readCache = this.readCache(registryRef);
DataResult<Holder<E>> dataResult = readCache.values.get(entryKey);
if (dataResult != null) {
@ -22,12 +22,12 @@ index 0d28a3a7f52174e70e044957b37361043b153e42..cdd2556e0401be0411563b89c6b7456a
+ // Paper end
return dataResult;
} else {
Holder<E> holder = registry.getOrCreateHolder(entryKey);
Holder<E> holder = registry.getOrCreateHolderOrThrow(entryKey);
diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java
index fddb279d161b30d6944495f0de9f6b7e21761a80..df955666723a8cb1e612311f0b8e77fb577d6be5 100644
index 786eafffa9bc51399c7fdf0012dfdaa9c92e71b0..6279b843ad04769b202b74913e328c86f256ee13 100644
--- a/src/main/java/net/minecraft/server/MinecraftServer.java
+++ b/src/main/java/net/minecraft/server/MinecraftServer.java
@@ -563,7 +563,14 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
@@ -549,7 +549,14 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
long i = generatorsettings.seed();
long j = BiomeManager.obfuscateSeed(i);
List<CustomSpawner> list = ImmutableList.of(new PhantomSpawner(), new PatrolSpawner(), new CatSpawner(), new VillageSiege(), new WanderingTraderSpawner(iworlddataserver));
@ -40,6 +40,6 @@ index fddb279d161b30d6944495f0de9f6b7e21761a80..df955666723a8cb1e612311f0b8e77fb
+ worlddimension = iregistry.get(dimensionKey);
+ }
+ // Paper end
Holder<DimensionType> holder;
ChunkGenerator chunkgenerator;
org.bukkit.generator.WorldInfo worldInfo = new org.bukkit.craftbukkit.generator.CraftWorldInfo(iworlddataserver, worldSession, org.bukkit.World.Environment.getEnvironment(dimension), worlddimension.typeHolder().value());
if (biomeProvider == null && gen != null) {

View File

@ -8,13 +8,13 @@ Lighting is purged on update anyways, so let's not add more
into the conversion process
diff --git a/src/main/java/net/minecraft/world/level/chunk/storage/ChunkStorage.java b/src/main/java/net/minecraft/world/level/chunk/storage/ChunkStorage.java
index f706058877dc3f88aab4e7028665ca53376beac1..a5a45118644fc1bc8caeefa59b5f897ed590e7ae 100644
index 3010e092bd1337e5a6b99636bbd312d90e470acf..fee9a8e74bfcc94942991b56799debf67b551f43 100644
--- a/src/main/java/net/minecraft/world/level/chunk/storage/ChunkStorage.java
+++ b/src/main/java/net/minecraft/world/level/chunk/storage/ChunkStorage.java
@@ -44,6 +44,7 @@ public class ChunkStorage implements AutoCloseable {
@@ -51,6 +51,7 @@ public class ChunkStorage implements AutoCloseable {
// CraftBukkit start
private boolean check(ServerChunkCache cps, int x, int z) throws IOException {
private boolean check(ServerChunkCache cps, int x, int z) {
+ if (true) return true; // Paper - this isn't even needed anymore, light is purged updating to 1.14+, why are we holding up the conversion process reading chunk data off disk - return true, we need to set light populated to true so the converter recognizes the chunk as being "full"
ChunkPos pos = new ChunkPos(x, z);
if (cps != null) {

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 84f386e5f15d956cfd279baecd01558dcf9af88d..78538e3d3468f5c682cf4123ac930796c20af60c 100644
index cc57efc087268d7639544dd12765082909db827a..87334390b65e996d2366519442286d9880174d2b 100644
--- a/src/main/java/net/minecraft/server/level/ServerChunkCache.java
+++ b/src/main/java/net/minecraft/server/level/ServerChunkCache.java
@@ -1069,7 +1069,24 @@ public class ServerChunkCache extends ChunkSource {
@@ -1070,7 +1070,24 @@ public class ServerChunkCache extends ChunkSource {
this.level.timings.broadcastChunkUpdates.stopTiming(); // Paper - timing
gameprofilerfiller.pop();
// Paper end - use set of chunks requiring updates, rather than iterating every single one loaded