1.18.2 compiles successfuly now

This commit is contained in:
Jake Potrebic
2022-02-28 14:02:20 -08:00
parent d8d13a67c4
commit f1dee4ff69
10 changed files with 27 additions and 28 deletions

View File

@@ -80,7 +80,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
private CraftEntity bukkitEntity; private CraftEntity bukkitEntity;
+ public @org.jetbrains.annotations.Nullable net.minecraft.server.level.ChunkMap.TrackedEntity tracker; // Paper + public @org.jetbrains.annotations.Nullable net.minecraft.server.level.ChunkMap.TrackedEntity tracker; // Paper
+ public Throwable addedToWorldStack; // Paper - entity debug + public @Nullable Throwable addedToWorldStack; // Paper - entity debug
public CraftEntity getBukkitEntity() { public CraftEntity getBukkitEntity() {
if (this.bukkitEntity == null) { if (this.bukkitEntity == null) {
this.bukkitEntity = CraftEntity.getEntity(this.level.getCraftServer(), this); this.bukkitEntity = CraftEntity.getEntity(this.level.getCraftServer(), this);
@@ -114,22 +114,21 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
if (this.byUuid.containsKey(uUID)) { if (this.byUuid.containsKey(uUID)) {
LOGGER.warn("Duplicate entity UUID {}: {}", uUID, entity); LOGGER.warn("Duplicate entity UUID {}: {}", uUID, entity);
+ // Paper start - extra debug info + // Paper start - extra debug info
+ if (entity instanceof net.minecraft.world.entity.Entity) { + if (entity instanceof net.minecraft.world.entity.Entity entityCast) {
+ if (net.minecraft.server.level.ServerLevel.DEBUG_ENTITIES) { + if (net.minecraft.server.level.ServerLevel.DEBUG_ENTITIES) {
+ ((net.minecraft.world.entity.Entity) entity).addedToWorldStack = net.minecraft.server.level.ServerLevel.getAddToWorldStackTrace((net.minecraft.world.entity.Entity) entity); + entityCast.addedToWorldStack = net.minecraft.server.level.ServerLevel.getAddToWorldStackTrace(entityCast);
+ } + }
+ +
+ T old = this.byUuid.get(entity.getUUID()); + T old = this.byUuid.get(entity.getUUID());
+ if (old instanceof net.minecraft.world.entity.Entity && old != null && old.getId() != entity.getId() && ((net.minecraft.world.entity.Entity) old).valid) { + if (old instanceof net.minecraft.world.entity.Entity oldCast && old != null && oldCast.getId() != entity.getId() && oldCast.valid) {
+ Logger logger = LogManager.getLogger(); + LOGGER.error("Overwrote an existing entity " + oldCast + " with " + entity);
+ logger.error("Overwrote an existing entity " + old + " with " + entity);
+ if (net.minecraft.server.level.ServerLevel.DEBUG_ENTITIES) { + if (net.minecraft.server.level.ServerLevel.DEBUG_ENTITIES) {
+ if (((net.minecraft.world.entity.Entity) old).addedToWorldStack != null) { + if (oldCast.addedToWorldStack != null) {
+ ((net.minecraft.world.entity.Entity) old).addedToWorldStack.printStackTrace(); + oldCast.addedToWorldStack.printStackTrace();
+ } else { + } else {
+ logger.error("Oddly, the old entity was not added to the world in the normal way. Plugins?"); + LOGGER.error("Oddly, the old entity was not added to the world in the normal way. Plugins?");
+ } + }
+ ((net.minecraft.world.entity.Entity) entity).addedToWorldStack.printStackTrace(); + entityCast.addedToWorldStack.printStackTrace();
+ } + }
+ } + }
+ } + }

View File

@@ -277,6 +277,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+import net.minecraft.server.level.ServerPlayerGameMode; +import net.minecraft.server.level.ServerPlayerGameMode;
+import net.minecraft.world.level.ChunkPos; +import net.minecraft.world.level.ChunkPos;
+import net.minecraft.world.level.Level; +import net.minecraft.world.level.Level;
+import net.minecraft.world.level.biome.Biomes;
+import net.minecraft.world.level.block.Block; +import net.minecraft.world.level.block.Block;
+import net.minecraft.world.level.block.Blocks; +import net.minecraft.world.level.block.Blocks;
+import net.minecraft.world.level.block.EntityBlock; +import net.minecraft.world.level.block.EntityBlock;
@@ -377,7 +378,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ } + }
+ } + }
+ +
+ EmptyLevelChunk emptyChunk = new EmptyLevelChunk(level, new ChunkPos(0, 0)); + EmptyLevelChunk emptyChunk = new EmptyLevelChunk(level, new ChunkPos(0, 0), level.registryAccess().registryOrThrow(Registry.BIOME_REGISTRY).getHolderOrThrow(Biomes.PLAINS));
+ BlockPos zeroPos = new BlockPos(0, 0, 0); + BlockPos zeroPos = new BlockPos(0, 0, 0);
+ +
+ for (int i = 0; i < solidGlobal.length; i++) { + for (int i = 0; i < solidGlobal.length; i++) {

View File

@@ -1676,7 +1676,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ data = ChunkSerializer.saveChunk(this.world, this.chunk, this.asyncSaveData); + data = ChunkSerializer.saveChunk(this.world, this.chunk, this.asyncSaveData);
+ PaperFileIOThread.LOGGER.info("Successfully serialized chunk data for task: " + this.toString() + " synchronously"); + PaperFileIOThread.LOGGER.info("Successfully serialized chunk data for task: " + this.toString() + " synchronously");
+ } catch (final Throwable ex1) { + } catch (final Throwable ex1) {
+ PaperFileIOThread.LOGGER.fatal("Failed to synchronously serialize unloading chunk data for task: " + this.toString() + "! Chunk data will be lost", ex1); + PaperFileIOThread.LOGGER.error("Failed to synchronously serialize unloading chunk data for task: " + this.toString() + "! Chunk data will be lost", ex1);
+ } + }
+ +
+ ChunkSaveTask.this.complete(data); + ChunkSaveTask.this.complete(data);
@@ -1933,7 +1933,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ globalWorkers[i].setName("Paper Async Chunk Task Thread #" + i); + globalWorkers[i].setName("Paper Async Chunk Task Thread #" + i);
+ globalWorkers[i].setPriority(Thread.NORM_PRIORITY - 1); + globalWorkers[i].setPriority(Thread.NORM_PRIORITY - 1);
+ globalWorkers[i].setUncaughtExceptionHandler((final Thread thread, final Throwable throwable) -> { + globalWorkers[i].setUncaughtExceptionHandler((final Thread thread, final Throwable throwable) -> {
+ PaperFileIOThread.LOGGER.fatal("Thread '" + thread.getName() + "' threw an uncaught exception!", throwable); + PaperFileIOThread.LOGGER.error("Thread '" + thread.getName() + "' threw an uncaught exception!", throwable);
+ }); + });
+ +
+ globalWorkers[i].start(); + globalWorkers[i].start();
@@ -1943,7 +1943,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ globalWorkers[threads - 1].setName("Paper Async Chunk Urgent Task Thread"); + globalWorkers[threads - 1].setName("Paper Async Chunk Urgent Task Thread");
+ globalWorkers[threads - 1].setPriority(Thread.NORM_PRIORITY+1); + globalWorkers[threads - 1].setPriority(Thread.NORM_PRIORITY+1);
+ globalWorkers[threads - 1].setUncaughtExceptionHandler((final Thread thread, final Throwable throwable) -> { + globalWorkers[threads - 1].setUncaughtExceptionHandler((final Thread thread, final Throwable throwable) -> {
+ PaperFileIOThread.LOGGER.fatal("Thread '" + thread.getName() + "' threw an uncaught exception!", throwable); + PaperFileIOThread.LOGGER.error("Thread '" + thread.getName() + "' threw an uncaught exception!", throwable);
+ }); + });
+ globalWorkers[threads - 1].setLowestPriorityToPoll(PrioritizedTaskQueue.HIGHEST_PRIORITY); + globalWorkers[threads - 1].setLowestPriorityToPoll(PrioritizedTaskQueue.HIGHEST_PRIORITY);
+ globalWorkers[threads - 1].start(); + globalWorkers[threads - 1].start();
@@ -1967,7 +1967,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ this.workers[i].setName("Async chunk loader thread #" + i + " for world: " + world.getWorld().getName()); + this.workers[i].setName("Async chunk loader thread #" + i + " for world: " + world.getWorld().getName());
+ this.workers[i].setPriority(Thread.NORM_PRIORITY - 1); + this.workers[i].setPriority(Thread.NORM_PRIORITY - 1);
+ this.workers[i].setUncaughtExceptionHandler((final Thread thread, final Throwable throwable) -> { + this.workers[i].setUncaughtExceptionHandler((final Thread thread, final Throwable throwable) -> {
+ PaperFileIOThread.LOGGER.fatal("Thread '" + thread.getName() + "' threw an uncaught exception!", throwable); + PaperFileIOThread.LOGGER.error("Thread '" + thread.getName() + "' threw an uncaught exception!", throwable);
+ }); + });
+ +
+ this.workers[i].start(); + this.workers[i].start();

View File

@@ -743,7 +743,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ regionfile.fileLock.lock(); // otherwise we will unlock twice and only lock once. + regionfile.fileLock.lock(); // otherwise we will unlock twice and only lock once.
+ return this.read(pos, regionfile); + return this.read(pos, regionfile);
+ } + }
+ net.minecraft.server.MinecraftServer.LOGGER.fatal("Can't recalculate regionfile header, regenerating chunk " + pos + " for " + regionfile.regionFile.toAbsolutePath()); + net.minecraft.server.MinecraftServer.LOGGER.error("Can't recalculate regionfile header, regenerating chunk " + pos + " for " + regionfile.regionFile.toAbsolutePath());
+ return null; + return null;
+ } + }
+ } + }

View File

@@ -27,7 +27,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ Thread ret = new Thread(run); + Thread ret = new Thread(run);
+ ret.setName("Profile Lookup Executor #" + this.count.getAndIncrement()); + ret.setName("Profile Lookup Executor #" + this.count.getAndIncrement());
+ ret.setUncaughtExceptionHandler((Thread thread, Throwable throwable) -> { + ret.setUncaughtExceptionHandler((Thread thread, Throwable throwable) -> {
+ LOGGER.fatal("Uncaught exception in thread " + thread.getName(), throwable); + LOGGER.error("Uncaught exception in thread " + thread.getName(), throwable);
+ }); + });
+ return ret; + return ret;
+ } + }

View File

@@ -37,14 +37,14 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
private final com.destroystokyo.paper.util.misc.PooledLinkedHashSets<ServerPlayer> pooledLinkedPlayerHashSets = new com.destroystokyo.paper.util.misc.PooledLinkedHashSets<>(); private final com.destroystokyo.paper.util.misc.PooledLinkedHashSets<ServerPlayer> pooledLinkedPlayerHashSets = new com.destroystokyo.paper.util.misc.PooledLinkedHashSets<>();
@@ -0,0 +0,0 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider @@ -0,0 +0,0 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
return chunk; });
}); });
}, (runnable) -> { }, (runnable) -> {
- this.mainThreadMailbox.tell(ChunkTaskPriorityQueueSorter.message(holder, runnable)); - this.mainThreadMailbox.tell(ChunkTaskPriorityQueueSorter.message(holder, runnable));
+ this.mainThreadMailbox.tell(ChunkTaskPriorityQueueSorter.message(holder, () -> ChunkMap.this.chunkLoadConversionCallbackExecutor.execute(runnable))); // Paper - delay running Chunk post processing until outside of the sorter to prevent a deadlock scenario when post processing causes another chunk request. + this.mainThreadMailbox.tell(ChunkTaskPriorityQueueSorter.message(holder, () -> ChunkMap.this.chunkLoadConversionCallbackExecutor.execute(runnable))); // Paper - delay running Chunk post processing until outside of the sorter to prevent a deadlock scenario when post processing causes another chunk request.
}); });
return completablefuture1;
} }
diff --git a/src/main/java/net/minecraft/server/level/ServerChunkCache.java b/src/main/java/net/minecraft/server/level/ServerChunkCache.java diff --git a/src/main/java/net/minecraft/server/level/ServerChunkCache.java b/src/main/java/net/minecraft/server/level/ServerChunkCache.java
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/net/minecraft/server/level/ServerChunkCache.java --- a/src/main/java/net/minecraft/server/level/ServerChunkCache.java

View File

@@ -10,12 +10,11 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
--- a/src/main/java/org/bukkit/craftbukkit/CraftChunk.java --- a/src/main/java/org/bukkit/craftbukkit/CraftChunk.java
+++ b/src/main/java/org/bukkit/craftbukkit/CraftChunk.java +++ b/src/main/java/org/bukkit/craftbukkit/CraftChunk.java
@@ -0,0 +0,0 @@ public class CraftChunk implements Chunk { @@ -0,0 +0,0 @@ public class CraftChunk implements Chunk {
boolean[] sectionEmpty = new boolean[cs.length];
PalettedContainer<Holder<Biome>>[] biome = (includeBiome || includeBiomeTempRain) ? new PalettedContainer[cs.length] : null; PalettedContainer<Holder<Biome>>[] biome = (includeBiome || includeBiomeTempRain) ? new PalettedContainer[cs.length] : null;
- Registry<Biome> iregistry = this.worldServer.registryAccess().registryOrThrow(Registry.BIOME_REGISTRY); Registry<Biome> iregistry = this.worldServer.registryAccess().registryOrThrow(Registry.BIOME_REGISTRY);
- Codec<PalettedContainer<Biome>> biomeCodec = PalettedContainer.codec(iregistry, iregistry.byNameCodec(), PalettedContainer.Strategy.SECTION_BIOMES, iregistry.getOrThrow(Biomes.PLAINS), null); // Paper - Anti-Xray - Add preset biomes - Codec<PalettedContainer<Biome>> biomeCodec = PalettedContainer.codec(iregistry, iregistry.byNameCodec(), PalettedContainer.Strategy.SECTION_BIOMES, iregistry.getOrThrow(Biomes.PLAINS), null); // Paper - Anti-Xray - Add preset biomes
-
for (int i = 0; i < cs.length; i++) { for (int i = 0; i < cs.length; i++) {
- CompoundTag data = new CompoundTag(); - CompoundTag data = new CompoundTag();

View File

@@ -14,13 +14,13 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
--- a/src/main/java/net/minecraft/server/level/ChunkMap.java --- a/src/main/java/net/minecraft/server/level/ChunkMap.java
+++ b/src/main/java/net/minecraft/server/level/ChunkMap.java +++ b/src/main/java/net/minecraft/server/level/ChunkMap.java
@@ -0,0 +0,0 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider @@ -0,0 +0,0 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
this.playerLoadedChunk(entityplayer, mutableobject, chunk);
return chunk; });
}); });
- }, (runnable) -> { - }, (runnable) -> {
- this.mainThreadMailbox.tell(ChunkTaskPriorityQueueSorter.message(holder, () -> ChunkMap.this.chunkLoadConversionCallbackExecutor.execute(runnable))); // Paper - delay running Chunk post processing until outside of the sorter to prevent a deadlock scenario when post processing causes another chunk request. - this.mainThreadMailbox.tell(ChunkTaskPriorityQueueSorter.message(holder, () -> ChunkMap.this.chunkLoadConversionCallbackExecutor.execute(runnable))); // Paper - delay running Chunk post processing until outside of the sorter to prevent a deadlock scenario when post processing causes another chunk request.
- }); - });
+ }, this.mainThreadExecutor); // Paper - queue to execute immediately so this doesn't delay chunk unloading + }, this.mainThreadExecutor); // Paper - queue to execute immediately so this doesn't delay chunk unloading
return completablefuture1;
} }
public int getTickingGenerated() {

View File

@@ -14,7 +14,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
{ {
if ( (AsyncCatcher.enabled || io.papermc.paper.util.TickThread.STRICT_THREAD_CHECKS) && Thread.currentThread() != MinecraftServer.getServer().serverThread ) // Paper if ( (AsyncCatcher.enabled || io.papermc.paper.util.TickThread.STRICT_THREAD_CHECKS) && Thread.currentThread() != MinecraftServer.getServer().serverThread ) // Paper
{ {
+ MinecraftServer.LOGGER.fatal("Thread " + Thread.currentThread().getName() + " failed main thread check: " + reason, new Throwable()); // Paper + MinecraftServer.LOGGER.error("Thread " + Thread.currentThread().getName() + " failed main thread check: " + reason, new Throwable()); // Paper
throw new IllegalStateException( "Asynchronous " + reason + "!" ); throw new IllegalStateException( "Asynchronous " + reason + "!" );
} }
} }

View File

@@ -1445,8 +1445,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
- }); - });
+ // Paper - no-tick view distance - moved to Chunk neighbour update + // Paper - no-tick view distance - moved to Chunk neighbour update
}); });
}, (runnable) -> { }, this.mainThreadExecutor); // Paper - queue to execute immediately so this doesn't delay chunk unloading
this.mainThreadMailbox.tell(ChunkTaskPriorityQueueSorter.message(holder, runnable)); return completablefuture1;
@@ -0,0 +0,0 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider @@ -0,0 +0,0 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
int k = this.viewDistance; int k = this.viewDistance;