1.18.2 compiles successfuly now

This commit is contained in:
Jake Potrebic 2022-02-28 14:02:20 -08:00 committed by Jason Penilla
parent 60af9b0cb3
commit 19f9520b3a
No known key found for this signature in database
GPG Key ID: 0E75A301420E48F8
10 changed files with 45 additions and 46 deletions

View File

@ -72,7 +72,7 @@ index b2a4fd52eeead4dd2e20cfab47acc9d3fcabab98..7e2e7ce7ba9b23c813e1a4197ac06d0f
return false;
} else {
diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java
index 9041feeeb0e2d43abebaa136dc739b3525f48e16..c819bd3db7dfab1181288683f2a47bb71a52953d 100644
index 919b66c88f21606348b20f02cc420d0ff1fa0f8b..ad2341ce26f976b4c45d91e8040bea5aef130f02 100644
--- a/src/main/java/net/minecraft/world/entity/Entity.java
+++ b/src/main/java/net/minecraft/world/entity/Entity.java
@@ -173,6 +173,8 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, i
@ -80,7 +80,7 @@ index 9041feeeb0e2d43abebaa136dc739b3525f48e16..c819bd3db7dfab1181288683f2a47bb7
private CraftEntity bukkitEntity;
+ 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() {
if (this.bukkitEntity == null) {
this.bukkitEntity = CraftEntity.getEntity(this.level.getCraftServer(), this);
@ -97,7 +97,7 @@ index 67566e5f95f7452d31bea485bdb91a4e1a32e5d5..dc2235824853a0d7ccbff51dd26a71e9
public boolean preventPoiUpdated = false; // CraftBukkit - SPIGOT-5710
public boolean captureBlockStates = false;
diff --git a/src/main/java/net/minecraft/world/level/entity/EntityLookup.java b/src/main/java/net/minecraft/world/level/entity/EntityLookup.java
index 3864da01056970ae05cc3ca094f923178b4ffc97..ab6be988a8714d57ee73ce80b9101a1e9917fbbe 100644
index 3864da01056970ae05cc3ca094f923178b4ffc97..f4731d69946871768ecf16149a47d2ef1cb3e910 100644
--- a/src/main/java/net/minecraft/world/level/entity/EntityLookup.java
+++ b/src/main/java/net/minecraft/world/level/entity/EntityLookup.java
@@ -20,7 +20,7 @@ public class EntityLookup<T extends EntityAccess> {
@ -109,27 +109,26 @@ index 3864da01056970ae05cc3ca094f923178b4ffc97..ab6be988a8714d57ee73ce80b9101a1e
}
}
@@ -34,6 +34,27 @@ public class EntityLookup<T extends EntityAccess> {
@@ -34,6 +34,26 @@ public class EntityLookup<T extends EntityAccess> {
UUID uUID = entity.getUUID();
if (this.byUuid.containsKey(uUID)) {
LOGGER.warn("Duplicate entity UUID {}: {}", uUID, entity);
+ // 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) {
+ ((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());
+ if (old instanceof net.minecraft.world.entity.Entity && old != null && old.getId() != entity.getId() && ((net.minecraft.world.entity.Entity) old).valid) {
+ Logger logger = LogManager.getLogger();
+ logger.error("Overwrote an existing entity " + old + " with " + entity);
+ if (old instanceof net.minecraft.world.entity.Entity oldCast && old != null && oldCast.getId() != entity.getId() && oldCast.valid) {
+ LOGGER.error("Overwrote an existing entity " + oldCast + " with " + entity);
+ if (net.minecraft.server.level.ServerLevel.DEBUG_ENTITIES) {
+ if (((net.minecraft.world.entity.Entity) old).addedToWorldStack != null) {
+ ((net.minecraft.world.entity.Entity) old).addedToWorldStack.printStackTrace();
+ if (oldCast.addedToWorldStack != null) {
+ oldCast.addedToWorldStack.printStackTrace();
+ } 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

@ -1620,7 +1620,7 @@ index 0000000000000000000000000000000000000000..79082639d9238c62c896dfc025ede92c
+}
diff --git a/src/main/java/com/destroystokyo/paper/io/chunk/ChunkSaveTask.java b/src/main/java/com/destroystokyo/paper/io/chunk/ChunkSaveTask.java
new file mode 100644
index 0000000000000000000000000000000000000000..69ebbfa171385c46a84d1a0d241d168a8c2af145
index 0000000000000000000000000000000000000000..0d245ad7d19b11e946e0b5b43bf2181292297210
--- /dev/null
+++ b/src/main/java/com/destroystokyo/paper/io/chunk/ChunkSaveTask.java
@@ -0,0 +1,111 @@
@ -1676,7 +1676,7 @@ index 0000000000000000000000000000000000000000..69ebbfa171385c46a84d1a0d241d168a
+ data = ChunkSerializer.saveChunk(this.world, this.chunk, this.asyncSaveData);
+ PaperFileIOThread.LOGGER.info("Successfully serialized chunk data for task: " + this.toString() + " synchronously");
+ } 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);
@ -1783,7 +1783,7 @@ index 0000000000000000000000000000000000000000..058fb5a41565e6ce2acbd1f4d071a1b8
+}
diff --git a/src/main/java/com/destroystokyo/paper/io/chunk/ChunkTaskManager.java b/src/main/java/com/destroystokyo/paper/io/chunk/ChunkTaskManager.java
new file mode 100644
index 0000000000000000000000000000000000000000..abf62796cfbfa61392b0776b28eb6bfc284053c1
index 0000000000000000000000000000000000000000..80c785eb503dc36d381f114a4eccffc1a81071f7
--- /dev/null
+++ b/src/main/java/com/destroystokyo/paper/io/chunk/ChunkTaskManager.java
@@ -0,0 +1,505 @@
@ -1933,7 +1933,7 @@ index 0000000000000000000000000000000000000000..abf62796cfbfa61392b0776b28eb6bfc
+ globalWorkers[i].setName("Paper Async Chunk Task Thread #" + i);
+ globalWorkers[i].setPriority(Thread.NORM_PRIORITY - 1);
+ 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();
@ -1943,7 +1943,7 @@ index 0000000000000000000000000000000000000000..abf62796cfbfa61392b0776b28eb6bfc
+ globalWorkers[threads - 1].setName("Paper Async Chunk Urgent Task Thread");
+ globalWorkers[threads - 1].setPriority(Thread.NORM_PRIORITY+1);
+ 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].start();
@ -1967,7 +1967,7 @@ index 0000000000000000000000000000000000000000..abf62796cfbfa61392b0776b28eb6bfc
+ 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].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();

View File

@ -258,10 +258,10 @@ index 0000000000000000000000000000000000000000..aabad39d13ead83042ec2e4dd7f4ed49
+}
diff --git a/src/main/java/com/destroystokyo/paper/antixray/ChunkPacketBlockControllerAntiXray.java b/src/main/java/com/destroystokyo/paper/antixray/ChunkPacketBlockControllerAntiXray.java
new file mode 100644
index 0000000000000000000000000000000000000000..ca9ecf27da22a79c588308db2401230391e7b729
index 0000000000000000000000000000000000000000..539fff5387d9e4fcf31a5e242d7275b66e0ade88
--- /dev/null
+++ b/src/main/java/com/destroystokyo/paper/antixray/ChunkPacketBlockControllerAntiXray.java
@@ -0,0 +1,659 @@
@@ -0,0 +1,660 @@
+package com.destroystokyo.paper.antixray;
+
+import com.destroystokyo.paper.PaperWorldConfig;
@ -277,6 +277,7 @@ index 0000000000000000000000000000000000000000..ca9ecf27da22a79c588308db24012303
+import net.minecraft.server.level.ServerPlayerGameMode;
+import net.minecraft.world.level.ChunkPos;
+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.Blocks;
+import net.minecraft.world.level.block.EntityBlock;
@ -377,7 +378,7 @@ index 0000000000000000000000000000000000000000..ca9ecf27da22a79c588308db24012303
+ }
+ }
+
+ 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);
+
+ for (int i = 0; i < solidGlobal.length; i++) {

View File

@ -25,7 +25,7 @@ This successfully fixed a reoccurring and highly reproduceable crash
for heightmaps.
diff --git a/src/main/java/net/minecraft/server/level/ChunkMap.java b/src/main/java/net/minecraft/server/level/ChunkMap.java
index 7e3f7b69fc7a608dd82b471d832cc401a77f0738..a603e74d6bc936db997f9230fff1100946fa8075 100644
index 7e3f7b69fc7a608dd82b471d832cc401a77f0738..86a06c7ee3b92fbff1e21ad36b6034d892cd0c01 100644
--- a/src/main/java/net/minecraft/server/level/ChunkMap.java
+++ b/src/main/java/net/minecraft/server/level/ChunkMap.java
@@ -178,6 +178,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
@ -36,15 +36,15 @@ index 7e3f7b69fc7a608dd82b471d832cc401a77f0738..a603e74d6bc936db997f9230fff11009
// Paper start - distance maps
private final com.destroystokyo.paper.util.misc.PooledLinkedHashSets<ServerPlayer> pooledLinkedPlayerHashSets = new com.destroystokyo.paper.util.misc.PooledLinkedHashSets<>();
@@ -1043,7 +1044,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
return chunk;
@@ -1030,7 +1031,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
});
});
}, (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.
});
return completablefuture1;
}
diff --git a/src/main/java/net/minecraft/server/level/ServerChunkCache.java b/src/main/java/net/minecraft/server/level/ServerChunkCache.java
index cf56b2ed508352205ef6ec71519b0626aa698987..1b6fb81079d3ad5d3c33be67a1c05111f9dd5f2d 100644
--- a/src/main/java/net/minecraft/server/level/ServerChunkCache.java

View File

@ -10,17 +10,17 @@ 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 a93a971dd7e2fbe5e6d9196ca1e95f5f8c3c660e..be8303e64e481e37a6ab25ee99c4008037670303 100644
index 5261c7a44200e2cc191b67900c7771ca31fb33df..16350310a235c321e48c29fbace2969b43778bf5 100644
--- a/src/main/java/net/minecraft/server/level/ChunkMap.java
+++ b/src/main/java/net/minecraft/server/level/ChunkMap.java
@@ -1315,9 +1315,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
return chunk;
@@ -1302,9 +1302,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
this.playerLoadedChunk(entityplayer, mutableobject, chunk);
});
});
- }, (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.mainThreadExecutor); // Paper - queue to execute immediately so this doesn't delay chunk unloading
return completablefuture1;
}
public int getTickingGenerated() {

View File

@ -10,7 +10,7 @@ out due to a sync load, as the worldgen threads will be
stalling on profile lookups.
diff --git a/src/main/java/net/minecraft/Util.java b/src/main/java/net/minecraft/Util.java
index c072819c1ebc772f524649c6c2f8b48d919bf805..0a92ef3a1470b1944d0d912f9c2d9641d5464c98 100644
index c072819c1ebc772f524649c6c2f8b48d919bf805..bbe69b5b2b1b7ccd3358325c9a65e7e197dfa7f2 100644
--- a/src/main/java/net/minecraft/Util.java
+++ b/src/main/java/net/minecraft/Util.java
@@ -71,6 +71,22 @@ public class Util {
@ -27,7 +27,7 @@ index c072819c1ebc772f524649c6c2f8b48d919bf805..0a92ef3a1470b1944d0d912f9c2d9641
+ Thread ret = new Thread(run);
+ ret.setName("Profile Lookup Executor #" + this.count.getAndIncrement());
+ 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;
+ }

View File

@ -7,14 +7,14 @@ The chunk system can swallow the exception given it's all
built with completablefuture, so ensure it is at least printed.
diff --git a/src/main/java/org/spigotmc/AsyncCatcher.java b/src/main/java/org/spigotmc/AsyncCatcher.java
index 7585a30e8f063ac2656b5de519b1e9edaceffbc7..41ddd9e0517571c7bffb494766f7097198b50842 100644
index 7585a30e8f063ac2656b5de519b1e9edaceffbc7..0c41413ad32f8f6a094462fcd637dd3229abda45 100644
--- a/src/main/java/org/spigotmc/AsyncCatcher.java
+++ b/src/main/java/org/spigotmc/AsyncCatcher.java
@@ -12,6 +12,7 @@ public class AsyncCatcher
{
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 + "!" );
}
}

View File

@ -685,7 +685,7 @@ index 861a25a15f1aab20e3245b6d5cdad5d23bdfd6d0..8ff8855c5267379b3a5f5d8baa4a275f
return bytebuffer;
}
diff --git a/src/main/java/net/minecraft/world/level/chunk/storage/RegionFileStorage.java b/src/main/java/net/minecraft/world/level/chunk/storage/RegionFileStorage.java
index 089e8414c7bdc102ba0d914af576df1a05af7519..9f6c1de59ca011bd1203499f325fdfa305e215ce 100644
index 089e8414c7bdc102ba0d914af576df1a05af7519..e5b444c6f2e45c50b4f7ab49c0dad801938f6cd9 100644
--- a/src/main/java/net/minecraft/world/level/chunk/storage/RegionFileStorage.java
+++ b/src/main/java/net/minecraft/world/level/chunk/storage/RegionFileStorage.java
@@ -26,7 +26,15 @@ public class RegionFileStorage implements AutoCloseable {
@ -743,7 +743,7 @@ index 089e8414c7bdc102ba0d914af576df1a05af7519..9f6c1de59ca011bd1203499f325fdfa3
+ regionfile.fileLock.lock(); // otherwise we will unlock twice and only lock once.
+ 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;
+ }
+ }

View File

@ -6,16 +6,15 @@ Subject: [PATCH] Fix ChunkSnapshot#isSectionEmpty(int) and optimize
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftChunk.java b/src/main/java/org/bukkit/craftbukkit/CraftChunk.java
index 034b66ad8e75907836d421d0aa42a70cad38ad33..716a76c599d83c85ade72f29d6e6d8f6a03f90c1 100644
index 034b66ad8e75907836d421d0aa42a70cad38ad33..403aba29347c779da75337531c3723632120e7c9 100644
--- a/src/main/java/org/bukkit/craftbukkit/CraftChunk.java
+++ b/src/main/java/org/bukkit/craftbukkit/CraftChunk.java
@@ -281,14 +281,16 @@ public class CraftChunk implements Chunk {
boolean[] sectionEmpty = new boolean[cs.length];
@@ -282,13 +282,17 @@ public class CraftChunk implements Chunk {
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
-
for (int i = 0; i < cs.length; i++) {
- CompoundTag data = new CompoundTag();
@ -32,7 +31,7 @@ index 034b66ad8e75907836d421d0aa42a70cad38ad33..716a76c599d83c85ade72f29d6e6d8f6
LevelLightEngine lightengine = chunk.level.getLightEngine();
DataLayer skyLightArray = lightengine.getLayerListener(LightLayer.SKY).getDataLayerData(SectionPos.of(x, i, z));
@@ -307,8 +309,7 @@ public class CraftChunk implements Chunk {
@@ -307,8 +311,7 @@ public class CraftChunk implements Chunk {
}
if (biome != null) {

View File

@ -1381,7 +1381,7 @@ index 36b6e7295cf7484675c8c2b9624c1f6fea7aed1d..38db3905f47fefb5c958fa24aef2313e
public CompletableFuture<Either<ChunkAccess, ChunkHolder.ChunkLoadingFailure>> getOrScheduleFuture(ChunkStatus targetStatus, ChunkMap chunkStorage) {
diff --git a/src/main/java/net/minecraft/server/level/ChunkMap.java b/src/main/java/net/minecraft/server/level/ChunkMap.java
index b75b218733fd5f171bb0290d5fb0248c17737030..bac41c30a0405815465edb81c7552d61defc9c6a 100644
index b2efa5f24d20cb16218a0e7522866ee2faaef244..e6c6432f35add7f4c27375e4420179a8ec9355a0 100644
--- a/src/main/java/net/minecraft/server/level/ChunkMap.java
+++ b/src/main/java/net/minecraft/server/level/ChunkMap.java
@@ -217,6 +217,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
@ -1445,8 +1445,8 @@ index b75b218733fd5f171bb0290d5fb0248c17737030..bac41c30a0405815465edb81c7552d61
- });
+ // Paper - no-tick view distance - moved to Chunk neighbour update
});
}, (runnable) -> {
this.mainThreadMailbox.tell(ChunkTaskPriorityQueueSorter.message(holder, runnable));
}, this.mainThreadExecutor); // Paper - queue to execute immediately so this doesn't delay chunk unloading
return completablefuture1;
@@ -1609,33 +1609,24 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
int k = this.viewDistance;