Updated Upstream (Paper)

Upstream has released updates that appear to apply and compile correctly

Paper Changes:
PaperMC/Paper@046466f Re-arrange most chunk system patches to front (#8338)
PaperMC/Paper@e8c2c3b Fix World#refreshChunk not working for chunks in no-tick range
This commit is contained in:
BillyGalbreath
2022-09-01 21:51:05 -05:00
parent be681220d6
commit ff8e329e9d
29 changed files with 160 additions and 161 deletions

View File

@@ -371,10 +371,10 @@ index 30093cd8bd35f0bbc8f26eca370622ee12a046b6..2986f110348b376bcdc64fa39b688855
++j;
diff --git a/src/main/java/net/minecraft/server/level/ChunkMap.java b/src/main/java/net/minecraft/server/level/ChunkMap.java
index 01a6751f096eec3e7b2f854550fd812dabb52a90..4dac83e54c82272f0f73663e9367bdaf7a49355b 100644
index 56ec684bac1c29c99bac117e38d82db2b4dc20e8..e4cec79dc5911e1f000c63fe333eea04050aa542 100644
--- a/src/main/java/net/minecraft/server/level/ChunkMap.java
+++ b/src/main/java/net/minecraft/server/level/ChunkMap.java
@@ -1000,20 +1000,20 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
@@ -998,20 +998,20 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
}
protected void tick(BooleanSupplier shouldKeepTicking) {
@@ -399,7 +399,7 @@ index 01a6751f096eec3e7b2f854550fd812dabb52a90..4dac83e54c82272f0f73663e9367bdaf
}
public boolean hasWork() {
@@ -1170,7 +1170,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
@@ -1162,7 +1162,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
// Paper start - Async chunk io
final java.util.function.BiFunction<ChunkSerializer.InProgressChunkHolder, Throwable, Either<ChunkAccess, ChunkHolder.ChunkLoadingFailure>> syncLoadComplete = (chunkHolder, ioThrowable) -> {
try /*(Timing ignored = this.level.timings.chunkLoad.startTimingIfSync())*/ { // Paper // Purpur
@@ -408,7 +408,7 @@ index 01a6751f096eec3e7b2f854550fd812dabb52a90..4dac83e54c82272f0f73663e9367bdaf
if (ioThrowable != null) {
return this.handleChunkLoadFailure(ioThrowable, pos);
}
@@ -1266,9 +1266,9 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
@@ -1258,9 +1258,9 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
return this.getDependencyStatus(requiredStatus, i);
});
@@ -420,7 +420,7 @@ index 01a6751f096eec3e7b2f854550fd812dabb52a90..4dac83e54c82272f0f73663e9367bdaf
Executor executor = (runnable) -> {
// Paper start - optimize chunk status progression without jumping through thread pool
if (holder.canAdvanceStatus()) {
@@ -1568,7 +1568,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
@@ -1566,7 +1566,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
}
}
@@ -430,10 +430,10 @@ index 01a6751f096eec3e7b2f854550fd812dabb52a90..4dac83e54c82272f0f73663e9367bdaf
//try (co.aikar.timings.Timing ignored1 = this.level.timings.chunkSaveDataSerialization.startTiming()) { // Paper // Purpur
nbttagcompound = ChunkSerializer.write(this.level, chunk);
diff --git a/src/main/java/net/minecraft/server/level/ServerChunkCache.java b/src/main/java/net/minecraft/server/level/ServerChunkCache.java
index de4b8001ff0ddb1603fcca2b6829bb55289d651e..1c49aec79581c6bbeaeb87e42f98ed22fa13faee 100644
index 6b4c502cf549996411ac21251e22849be2ed7a23..25b9f739abba986264e9f59b5125c1cc9a5bf74c 100644
--- a/src/main/java/net/minecraft/server/level/ServerChunkCache.java
+++ b/src/main/java/net/minecraft/server/level/ServerChunkCache.java
@@ -631,9 +631,9 @@ public class ServerChunkCache extends ChunkSource {
@@ -452,9 +452,9 @@ public class ServerChunkCache extends ChunkSource {
return ifLoaded;
}
// Paper end
@@ -445,7 +445,7 @@ index de4b8001ff0ddb1603fcca2b6829bb55289d651e..1c49aec79581c6bbeaeb87e42f98ed22
long k = ChunkPos.asLong(x, z);
ChunkAccess ichunkaccess;
@@ -647,7 +647,7 @@ public class ServerChunkCache extends ChunkSource {
@@ -468,7 +468,7 @@ public class ServerChunkCache extends ChunkSource {
}
}
@@ -454,7 +454,7 @@ index de4b8001ff0ddb1603fcca2b6829bb55289d651e..1c49aec79581c6bbeaeb87e42f98ed22
CompletableFuture<Either<ChunkAccess, ChunkHolder.ChunkLoadingFailure>> completablefuture = this.getChunkFutureMainThread(x, z, leastStatus, create, true); // Paper
ServerChunkCache.MainThreadExecutor chunkproviderserver_b = this.mainThreadProcessor;
@@ -746,13 +746,13 @@ public class ServerChunkCache extends ChunkSource {
@@ -567,13 +567,13 @@ public class ServerChunkCache extends ChunkSource {
this.distanceManager.addTicket(TicketType.REQUIRED_LOAD, chunkcoordintpair, l, identifier); // Paper - prevent plugin unloads from removing our ticket
if (isUrgent) this.distanceManager.markUrgent(chunkcoordintpair); // Paper - Chunk priority
if (this.chunkAbsent(playerchunk, l)) {
@@ -471,7 +471,7 @@ index de4b8001ff0ddb1603fcca2b6829bb55289d651e..1c49aec79581c6bbeaeb87e42f98ed22
if (this.chunkAbsent(playerchunk, l)) {
this.distanceManager.removeTicket(TicketType.REQUIRED_LOAD, chunkcoordintpair, l, identifier); // Paper
throw (IllegalStateException) Util.pauseInIde(new IllegalStateException("No chunk holder after ticket has been added"));
@@ -887,24 +887,24 @@ public class ServerChunkCache extends ChunkSource {
@@ -708,24 +708,24 @@ public class ServerChunkCache extends ChunkSource {
// CraftBukkit start - modelled on below
public void purgeUnload() {
if (true) return; // Paper - tickets will be removed later, this behavior isn't really well accounted for by the chunk system
@@ -501,7 +501,7 @@ index de4b8001ff0ddb1603fcca2b6829bb55289d651e..1c49aec79581c6bbeaeb87e42f98ed22
if (tickChunks) {
//this.level.timings.chunks.startTiming(); // Paper - timings // Purpur
this.chunkMap.playerChunkManager.tick(); // Paper - this is mostly is to account for view distance changes
@@ -913,10 +913,10 @@ public class ServerChunkCache extends ChunkSource {
@@ -734,10 +734,10 @@ public class ServerChunkCache extends ChunkSource {
}
//this.level.timings.doChunkUnload.startTiming(); // Spigot // Purpur
@@ -514,7 +514,7 @@ index de4b8001ff0ddb1603fcca2b6829bb55289d651e..1c49aec79581c6bbeaeb87e42f98ed22
this.clearCache();
}
@@ -962,14 +962,14 @@ public class ServerChunkCache extends ChunkSource {
@@ -783,14 +783,14 @@ public class ServerChunkCache extends ChunkSource {
}
// Paper end - optimize isOutisdeRange
LevelData worlddata = this.level.getLevelData();
@@ -532,7 +532,7 @@ index de4b8001ff0ddb1603fcca2b6829bb55289d651e..1c49aec79581c6bbeaeb87e42f98ed22
//this.level.timings.countNaturalMobs.startTiming(); // Paper - timings // Purpur
int l = this.distanceManager.getNaturalSpawnChunkCount();
// Paper start - per player mob spawning
@@ -994,13 +994,13 @@ public class ServerChunkCache extends ChunkSource {
@@ -815,13 +815,13 @@ public class ServerChunkCache extends ChunkSource {
//this.level.timings.countNaturalMobs.stopTiming(); // Paper - timings // Purpur
//this.lastSpawnState = spawnercreature_d; // Pufferfish - this is managed asynchronously
@@ -548,7 +548,7 @@ index de4b8001ff0ddb1603fcca2b6829bb55289d651e..1c49aec79581c6bbeaeb87e42f98ed22
boolean flag2 = this.level.getGameRules().getBoolean(GameRules.RULE_DOMOBSPAWNING) && !this.level.players().isEmpty(); // CraftBukkit
// Paper - only shuffle if per-player mob spawning is disabled
@@ -1051,15 +1051,15 @@ public class ServerChunkCache extends ChunkSource {
@@ -872,15 +872,15 @@ public class ServerChunkCache extends ChunkSource {
}
// Paper end - optimise chunk tick iteration
//this.level.timings.chunkTicks.stopTiming(); // Paper // Purpur
@@ -567,7 +567,7 @@ index de4b8001ff0ddb1603fcca2b6829bb55289d651e..1c49aec79581c6bbeaeb87e42f98ed22
//this.level.timings.broadcastChunkUpdates.startTiming(); // Paper - timing // Purpur
if (!this.chunkMap.needsChangeBroadcasting.isEmpty()) {
ReferenceOpenHashSet<ChunkHolder> copy = this.chunkMap.needsChangeBroadcasting.clone();
@@ -1073,7 +1073,7 @@ public class ServerChunkCache extends ChunkSource {
@@ -894,7 +894,7 @@ public class ServerChunkCache extends ChunkSource {
}
}
//this.level.timings.broadcastChunkUpdates.stopTiming(); // Paper - timing // Purpur
@@ -576,7 +576,7 @@ index de4b8001ff0ddb1603fcca2b6829bb55289d651e..1c49aec79581c6bbeaeb87e42f98ed22
// Paper end - use set of chunks requiring updates, rather than iterating every single one loaded
// Paper start - controlled flush for entity tracker packets
List<net.minecraft.network.Connection> disabledFlushes = new java.util.ArrayList<>(this.level.players.size());
@@ -1279,7 +1279,7 @@ public class ServerChunkCache extends ChunkSource {
@@ -1100,7 +1100,7 @@ public class ServerChunkCache extends ChunkSource {
@Override
protected void doRunTask(Runnable task) {
@@ -586,10 +586,10 @@ index de4b8001ff0ddb1603fcca2b6829bb55289d651e..1c49aec79581c6bbeaeb87e42f98ed22
}
diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java
index 5a800731927ca20e95fbcd0e8b94999e52642a8e..f561fa1acfcfc78fc2a3a5fe1c12d43a9e708146 100644
index 207f07dfd0d2fd0ff5fdb3952966d069ca184123..6859e2054e8eb4fc8ac005e0bf646a30defa47a6 100644
--- a/src/main/java/net/minecraft/server/level/ServerLevel.java
+++ b/src/main/java/net/minecraft/server/level/ServerLevel.java
@@ -619,12 +619,12 @@ public class ServerLevel extends Level implements WorldGenLevel {
@@ -621,12 +621,12 @@ public class ServerLevel extends Level implements WorldGenLevel {
}
}
// Paper end - optimise checkDespawn
@@ -605,7 +605,7 @@ index 5a800731927ca20e95fbcd0e8b94999e52642a8e..f561fa1acfcfc78fc2a3a5fe1c12d43a
this.advanceWeatherCycle();
int i = this.getGameRules().getInt(GameRules.RULE_PLAYERS_SLEEPING_PERCENTAGE);
long j;
@@ -651,32 +651,32 @@ public class ServerLevel extends Level implements WorldGenLevel {
@@ -653,32 +653,32 @@ public class ServerLevel extends Level implements WorldGenLevel {
this.updateSkyBrightness();
this.tickTime();
@@ -646,7 +646,7 @@ index 5a800731927ca20e95fbcd0e8b94999e52642a8e..f561fa1acfcfc78fc2a3a5fe1c12d43a
boolean flag = true || !this.players.isEmpty() || !this.getForcedChunks().isEmpty(); // CraftBukkit - this prevents entity cleanup, other issues on servers with no players
if (flag) {
@@ -684,12 +684,12 @@ public class ServerLevel extends Level implements WorldGenLevel {
@@ -686,12 +686,12 @@ public class ServerLevel extends Level implements WorldGenLevel {
}
if (flag || this.emptyTime++ < 300) {
@@ -662,7 +662,7 @@ index 5a800731927ca20e95fbcd0e8b94999e52642a8e..f561fa1acfcfc78fc2a3a5fe1c12d43a
}
org.spigotmc.ActivationRange.activateEntities(this); // Spigot
@@ -699,9 +699,9 @@ public class ServerLevel extends Level implements WorldGenLevel {
@@ -701,9 +701,9 @@ public class ServerLevel extends Level implements WorldGenLevel {
if (false && this.shouldDiscardEntity(entity)) { // CraftBukkit - We prevent spawning in general, so this butchering is not needed
entity.discard();
} else {
@@ -674,7 +674,7 @@ index 5a800731927ca20e95fbcd0e8b94999e52642a8e..f561fa1acfcfc78fc2a3a5fe1c12d43a
if (true || this.chunkSource.chunkMap.getDistanceManager().inEntityTickingRange(entity.chunkPosition().toLong())) { // Paper - now always true if in the ticking list
Entity entity1 = entity.getVehicle();
@@ -713,7 +713,7 @@ public class ServerLevel extends Level implements WorldGenLevel {
@@ -715,7 +715,7 @@ public class ServerLevel extends Level implements WorldGenLevel {
entity.stopRiding();
}
@@ -683,7 +683,7 @@ index 5a800731927ca20e95fbcd0e8b94999e52642a8e..f561fa1acfcfc78fc2a3a5fe1c12d43a
// Pufferfish start - copied from this.guardEntityTick
try {
this.tickNonPassenger(entity); // Pufferfish - changed
@@ -728,22 +728,22 @@ public class ServerLevel extends Level implements WorldGenLevel {
@@ -730,22 +730,22 @@ public class ServerLevel extends Level implements WorldGenLevel {
// Paper end
}
// Pufferfish end
@@ -711,7 +711,7 @@ index 5a800731927ca20e95fbcd0e8b94999e52642a8e..f561fa1acfcfc78fc2a3a5fe1c12d43a
}
@Override
@@ -825,9 +825,9 @@ public class ServerLevel extends Level implements WorldGenLevel {
@@ -827,9 +827,9 @@ public class ServerLevel extends Level implements WorldGenLevel {
boolean flag = this.isRaining();
int j = chunkcoordintpair.getMinBlockX();
int k = chunkcoordintpair.getMinBlockZ();
@@ -723,7 +723,7 @@ index 5a800731927ca20e95fbcd0e8b94999e52642a8e..f561fa1acfcfc78fc2a3a5fe1c12d43a
final BlockPos.MutableBlockPos blockposition = this.chunkTickMutablePosition; // Paper - use mutable to reduce allocation rate, final to force compile fail on change
if (!this.paperConfig().environment.disableThunder && flag && this.isThundering() && this.spigotConfig.thunderChance > 0 && /*this.random.nextInt(this.spigotConfig.thunderChance) == 0 &&*/ chunk.shouldDoLightning(this.random)) { // Spigot // Paper - disable thunder // Pufferfish - replace random with shouldDoLightning
@@ -859,7 +859,7 @@ public class ServerLevel extends Level implements WorldGenLevel {
@@ -861,7 +861,7 @@ public class ServerLevel extends Level implements WorldGenLevel {
}
}
@@ -732,7 +732,7 @@ index 5a800731927ca20e95fbcd0e8b94999e52642a8e..f561fa1acfcfc78fc2a3a5fe1c12d43a
if (!this.paperConfig().environment.disableIceAndSnow && (this.currentIceAndSnowTick++ & 15) == 0) { // Paper - Disable ice and snow // Paper - optimise random ticking // Pufferfish - optimize further random ticking
// Paper start - optimise chunk ticking
this.getRandomBlockPosition(j, 0, k, 15, blockposition);
@@ -895,7 +895,7 @@ public class ServerLevel extends Level implements WorldGenLevel {
@@ -897,7 +897,7 @@ public class ServerLevel extends Level implements WorldGenLevel {
}
// Paper start - optimise random block ticking
@@ -741,7 +741,7 @@ index 5a800731927ca20e95fbcd0e8b94999e52642a8e..f561fa1acfcfc78fc2a3a5fe1c12d43a
//timings.chunkTicksBlocks.startTiming(); // Paper // Purpur
if (randomTickSpeed > 0) {
LevelChunkSection[] sections = chunk.getSections();
@@ -931,7 +931,7 @@ public class ServerLevel extends Level implements WorldGenLevel {
@@ -933,7 +933,7 @@ public class ServerLevel extends Level implements WorldGenLevel {
}
// Paper end - optimise random block ticking
//timings.chunkTicksBlocks.stopTiming(); // Paper // Purpur
@@ -750,7 +750,7 @@ index 5a800731927ca20e95fbcd0e8b94999e52642a8e..f561fa1acfcfc78fc2a3a5fe1c12d43a
}
public Optional<BlockPos> findLightningRod(BlockPos pos) {
@@ -1228,19 +1228,19 @@ public class ServerLevel extends Level implements WorldGenLevel {
@@ -1230,19 +1230,19 @@ public class ServerLevel extends Level implements WorldGenLevel {
//try { // Purpur
// Paper end - timings
entity.setOldPosAndRot();
@@ -775,7 +775,7 @@ index 5a800731927ca20e95fbcd0e8b94999e52642a8e..f561fa1acfcfc78fc2a3a5fe1c12d43a
//} finally { timer.stopTiming(); } // Paper - timings // Purpur
Iterator iterator = entity.getPassengers().iterator();
@@ -1269,12 +1269,12 @@ public class ServerLevel extends Level implements WorldGenLevel {
@@ -1271,12 +1271,12 @@ public class ServerLevel extends Level implements WorldGenLevel {
// Paper end
passenger.setOldPosAndRot();
++passenger.tickCount;
@@ -792,7 +792,7 @@ index 5a800731927ca20e95fbcd0e8b94999e52642a8e..f561fa1acfcfc78fc2a3a5fe1c12d43a
// Paper start - EAR 2
if (isActive) {
passenger.rideTick();
@@ -1286,7 +1286,7 @@ public class ServerLevel extends Level implements WorldGenLevel {
@@ -1288,7 +1288,7 @@ public class ServerLevel extends Level implements WorldGenLevel {
vehicle.positionRider(passenger);
}
// Paper end - EAR 2