diff --git a/patches/server/Chunk-debug-command.patch b/patches/server/Chunk-debug-command.patch index e0583e74d..33319a737 100644 --- a/patches/server/Chunk-debug-command.patch +++ b/patches/server/Chunk-debug-command.patch @@ -132,7 +132,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + int entityTicking = 0; + + for (ChunkHolder chunk : world.getChunkSource().chunkMap.updatingChunkMap.values()) { -+ if (chunk.getFullChunkUnchecked() == null) { ++ if (chunk.getFullChunkNowUnchecked() == null) { + continue; + } + @@ -334,7 +334,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + int fullLoadedChunks = 0; + + for (ChunkHolder chunk : allChunks) { -+ if (chunk.getFullChunkUnchecked() != null) { ++ if (chunk.getFullChunkNowUnchecked() != null) { + ++fullLoadedChunks; + } + } diff --git a/patches/server/Do-not-copy-visible-chunks.patch b/patches/server/Do-not-copy-visible-chunks.patch index b7c5351d7..773bb5c97 100644 --- a/patches/server/Do-not-copy-visible-chunks.patch +++ b/patches/server/Do-not-copy-visible-chunks.patch @@ -18,7 +18,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 - for (ChunkHolder chunk : world.getChunkSource().chunkMap.updatingChunkMap.values()) { + for (ChunkHolder chunk : world.getChunkSource().chunkMap.updatingChunks.getUpdatingMap().values()) { // Paper - change updating chunks map - if (chunk.getFullChunkUnchecked() == null) { + if (chunk.getFullChunkNowUnchecked() == null) { continue; } diff --git a/src/main/java/net/minecraft/server/MCUtil.java b/src/main/java/net/minecraft/server/MCUtil.java @@ -219,12 +219,12 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + synchronized (world.getChunkSource().chunkMap.updatingChunks) { + chunks = world.getChunkSource().chunkMap.updatingChunks.getVisibleMap().clone(); + } -+ return chunks.values().stream().map(ChunkHolder::getFullChunk).filter(Objects::nonNull).map(net.minecraft.world.level.chunk.LevelChunk::getBukkitChunk).toArray(Chunk[]::new); ++ return chunks.values().stream().map(ChunkHolder::getFullChunkNow).filter(Objects::nonNull).map(net.minecraft.world.level.chunk.LevelChunk::getBukkitChunk).toArray(Chunk[]::new); + // Paper end - change updating chunks map + } + // Paper end -+ Long2ObjectLinkedOpenHashMap chunks = world.getChunkSource().chunkMap.updatingChunks.getVisibleMap(); // Paper - change updating chunks map - return chunks.values().stream().map(ChunkHolder::getFullChunk).filter(Objects::nonNull).map(net.minecraft.world.level.chunk.LevelChunk::getBukkitChunk).toArray(Chunk[]::new); ++ Long2ObjectLinkedOpenHashMap chunks = this.world.getChunkSource().chunkMap.updatingChunks.getVisibleMap(); // Paper - change updating chunks map + return chunks.values().stream().map(ChunkHolder::getFullChunkNow).filter(Objects::nonNull).map(net.minecraft.world.level.chunk.LevelChunk::getBukkitChunk).toArray(Chunk[]::new); } @@ -0,0 +0,0 @@ public class CraftWorld extends CraftRegionAccessor implements World { diff --git a/patches/server/Fix-generator-settings-string-for-flat-type-worlds.patch b/patches/server/Fix-generator-settings-string-for-flat-type-worlds.patch deleted file mode 100644 index 02e3e7e46..000000000 --- a/patches/server/Fix-generator-settings-string-for-flat-type-worlds.patch +++ /dev/null @@ -1,20 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Jake Potrebic -Date: Wed, 9 Mar 2022 12:51:29 -0800 -Subject: [PATCH] Fix generator settings string for flat-type worlds - -Fixes MC-195468 - -diff --git a/src/main/java/net/minecraft/world/level/levelgen/WorldGenSettings.java b/src/main/java/net/minecraft/world/level/levelgen/WorldGenSettings.java -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/world/level/levelgen/WorldGenSettings.java -+++ b/src/main/java/net/minecraft/world/level/levelgen/WorldGenSettings.java -@@ -0,0 +0,0 @@ public class WorldGenSettings { - String var8 = worldGenProperties.levelType(); - switch(var8) { - case "flat": -- Dynamic dynamic = new Dynamic<>(JsonOps.INSTANCE, worldGenProperties.generatorSettings()); -+ Dynamic dynamic = new Dynamic<>(net.minecraft.resources.RegistryOps.create(JsonOps.INSTANCE, registryManager), worldGenProperties.generatorSettings()); // Paper - needs RegistryOps to access biome registry inside FlatLevelGeneratorSettings's Codec, Fixes MC-195468 - return new WorldGenSettings(l, worldGenProperties.generateStructures(), false, withOverworld(registry, registry4, new FlatLevelSource(registry3, FlatLevelGeneratorSettings.CODEC.parse(dynamic).resultOrPartial(LOGGER::error).orElseGet(() -> { - return FlatLevelGeneratorSettings.getDefault(registry2, registry3); - })))); diff --git a/patches/server/MC-Dev-fixes.patch b/patches/server/MC-Dev-fixes.patch index 259786a76..e91450d1d 100644 --- a/patches/server/MC-Dev-fixes.patch +++ b/patches/server/MC-Dev-fixes.patch @@ -345,16 +345,3 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 } } -diff --git a/src/main/java/net/minecraft/world/level/levelgen/WorldGenSettings.java b/src/main/java/net/minecraft/world/level/levelgen/WorldGenSettings.java -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/world/level/levelgen/WorldGenSettings.java -+++ b/src/main/java/net/minecraft/world/level/levelgen/WorldGenSettings.java -@@ -0,0 +0,0 @@ import org.apache.commons.lang3.StringUtils; - import org.slf4j.Logger; - - public class WorldGenSettings { -- public static final Codec CODEC = RecordCodecBuilder.create((instance) -> { -+ public static final Codec CODEC = RecordCodecBuilder.create((instance) -> { // Paper - decompile fix - return instance.group(Codec.LONG.fieldOf("seed").stable().forGetter(WorldGenSettings::seed), Codec.BOOL.fieldOf("generate_features").orElse(true).stable().forGetter(WorldGenSettings::generateFeatures), Codec.BOOL.fieldOf("bonus_chest").orElse(false).stable().forGetter(WorldGenSettings::generateBonusChest), RegistryCodecs.dataPackAwareCodec(Registry.LEVEL_STEM_REGISTRY, Lifecycle.stable(), LevelStem.CODEC).xmap(LevelStem::sortMap, Function.identity()).fieldOf("dimensions").forGetter(WorldGenSettings::dimensions), Codec.STRING.optionalFieldOf("legacy_custom_options").stable().forGetter((worldGenSettings) -> { - return worldGenSettings.legacyCustomOptions; - })).apply(instance, instance.stable(WorldGenSettings::new)); diff --git a/patches/server/MC-Utils.patch b/patches/server/MC-Utils.patch index 6d459d54b..ca92ec1be 100644 --- a/patches/server/MC-Utils.patch +++ b/patches/server/MC-Utils.patch @@ -5082,21 +5082,15 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 this.setTicketLevel(level); this.changedBlocksPerSection = new ShortSet[world.getSectionsCount()]; + this.chunkMap = (ChunkMap)playersWatchingChunkProvider; // Paper -+ } -+ -+ // Paper start -+ public LevelChunk getFullChunkUnchecked() { -+ CompletableFuture> statusFuture = this.getFutureIfPresentUnchecked(ChunkStatus.FULL); -+ Either either = (Either) statusFuture.getNow(null); -+ return (either == null) ? null : (LevelChunk) either.left().orElse(null); } -+ public ChunkAccess getAvailableChunkNow() { ++ // Paper start ++ public @Nullable ChunkAccess getAvailableChunkNow() { + // TODO can we just getStatusFuture(EMPTY)? + for (ChunkStatus curr = ChunkStatus.FULL, next = curr.getParent(); curr != next; curr = next, next = next.getParent()) { + CompletableFuture> future = this.getFutureIfPresentUnchecked(curr); + Either either = future.getNow(null); -+ if (either == null || !either.left().isPresent()) { ++ if (either == null || either.left().isEmpty()) { + continue; + } + return either.left().get(); @@ -5104,10 +5098,9 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + return null; + } + // Paper end -+ - public CompletableFuture> getFutureIfPresentUnchecked(ChunkStatus leastStatus) { - CompletableFuture> completablefuture = (CompletableFuture) this.futures.get(leastStatus.getIndex()); - + // CraftBukkit start + public LevelChunk getFullChunkNow() { + // Note: We use the oldTicketLevel for isLoaded checks. @@ -0,0 +0,0 @@ public class ChunkHolder { return ChunkHolder.getStatus(this.ticketLevel).isOrAfter(leastStatus) ? this.getFutureIfPresentUnchecked(leastStatus) : ChunkHolder.UNLOADED_CHUNK_FUTURE; } @@ -5238,7 +5231,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + this.tickingChunkFuture.complete(ChunkHolder.UNLOADED_LEVEL_CHUNK); this.isTickingReady = false; // Paper - cache chunk ticking stage this.tickingChunkFuture = ChunkHolder.UNLOADED_LEVEL_CHUNK_FUTURE; + // Paper start - ticking chunk set -+ LevelChunk chunkIfCached = this.getFullChunkUnchecked(); ++ LevelChunk chunkIfCached = this.getFullChunkNowUnchecked(); + if (chunkIfCached != null) { + this.chunkMap.level.getChunkSource().tickingChunks.remove(chunkIfCached); + } @@ -5268,7 +5261,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + this.entityTickingChunkFuture.complete(ChunkHolder.UNLOADED_LEVEL_CHUNK); this.isEntityTickingReady = false; // Paper - cache chunk ticking stage this.entityTickingChunkFuture = ChunkHolder.UNLOADED_LEVEL_CHUNK_FUTURE; + // Paper start - entity ticking chunk set -+ LevelChunk chunkIfCached = this.getFullChunkUnchecked(); ++ LevelChunk chunkIfCached = this.getFullChunkNowUnchecked(); + if (chunkIfCached != null) { + this.chunkMap.level.getChunkSource().entityTickingChunks.remove(chunkIfCached); + } @@ -5859,7 +5852,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + return null; + } + -+ return playerChunk.getFullChunkUnchecked(); ++ return playerChunk.getFullChunkNowUnchecked(); + } + + @Nullable diff --git a/patches/server/Optimise-chunk-tick-iteration.patch b/patches/server/Optimise-chunk-tick-iteration.patch index ab1fa5c08..46b0b61ee 100644 --- a/patches/server/Optimise-chunk-tick-iteration.patch +++ b/patches/server/Optimise-chunk-tick-iteration.patch @@ -188,7 +188,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + ReferenceOpenHashSet copy = this.chunkMap.needsChangeBroadcasting.clone(); + this.chunkMap.needsChangeBroadcasting.clear(); + for (ChunkHolder holder : copy) { -+ holder.broadcastChanges(holder.getFullChunkUnchecked()); // LevelChunks are NEVER unloaded ++ holder.broadcastChanges(holder.getFullChunkNowUnchecked()); // LevelChunks are NEVER unloaded + if (holder.needsBroadcastChanges()) { + // I DON'T want to KNOW what DUMB plugins might be doing. + this.chunkMap.needsChangeBroadcasting.add(holder); diff --git a/patches/server/Optimise-nearby-player-lookups.patch b/patches/server/Optimise-nearby-player-lookups.patch index acabff470..8c2d4c98f 100644 --- a/patches/server/Optimise-nearby-player-lookups.patch +++ b/patches/server/Optimise-nearby-player-lookups.patch @@ -17,7 +17,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 } // Paper end - optimise chunk tick iteration + // Paper start - optimise checkDespawn -+ LevelChunk chunk = this.getFullChunkUnchecked(); ++ LevelChunk chunk = this.getFullChunkNowUnchecked(); + if (chunk != null) { + chunk.updateGeneralAreaCache(); + } @@ -30,7 +30,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 } // Paper end - optimise chunk tick iteration + // Paper start - optimise checkDespawn -+ LevelChunk chunk = this.getFullChunkUnchecked(); ++ LevelChunk chunk = this.getFullChunkNowUnchecked(); + if (chunk != null) { + chunk.removeGeneralAreaCache(); + } diff --git a/patches/server/Remove-garbage-Java-version-check.patch b/patches/server/Remove-garbage-Java-version-check.patch index d0eb1c9fd..94994e86f 100644 --- a/patches/server/Remove-garbage-Java-version-check.patch +++ b/patches/server/Remove-garbage-Java-version-check.patch @@ -12,8 +12,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 System.err.println("Unsupported Java detected (" + javaVersion + "). This version of Minecraft requires at least Java 17. Check your Java version with the command 'java -version'."); return; } -- if (javaVersion > 61.0) { -- System.err.println("Unsupported Java detected (" + javaVersion + "). Only up to Java 17 is supported."); +- if (javaVersion > 62.0) { +- System.err.println("Unsupported Java detected (" + javaVersion + "). Only up to Java 18 is supported."); - return; - } diff --git a/work/Bukkit b/work/Bukkit index 33a2b476b..7902647a6 160000 --- a/work/Bukkit +++ b/work/Bukkit @@ -1 +1 @@ -Subproject commit 33a2b476bbde7c2c0c45e644dc99b10d65736d40 +Subproject commit 7902647a668318b7e04f817e07ae9b955d7c0485 diff --git a/work/CraftBukkit b/work/CraftBukkit index e9f972d67..10922194f 160000 --- a/work/CraftBukkit +++ b/work/CraftBukkit @@ -1 +1 @@ -Subproject commit e9f972d6744d66460a78a868d298c7f543533073 +Subproject commit 10922194f43009dea660c8b5c9fe27f136e940a6