diff options
Diffstat (limited to 'patches/server')
3 files changed, 93 insertions, 5 deletions
diff --git a/patches/server/0969-Fix-removing-recipes-from-RecipeIterator.patch b/patches/server/0969-Fix-removing-recipes-from-RecipeIterator.patch index 636f3d2440..a8f124b458 100644 --- a/patches/server/0969-Fix-removing-recipes-from-RecipeIterator.patch +++ b/patches/server/0969-Fix-removing-recipes-from-RecipeIterator.patch @@ -7,7 +7,7 @@ Subject: [PATCH] Fix removing recipes from RecipeIterator public net.minecraft.world.item.crafting.RecipeManager byName diff --git a/src/main/java/org/bukkit/craftbukkit/inventory/RecipeIterator.java b/src/main/java/org/bukkit/craftbukkit/inventory/RecipeIterator.java -index 4e0f7564f04d5d566660a2623fb1b325e3b4e67c..39d2d67bf478beb4c72e41e6f59337893cf47e69 100644 +index 4e0f7564f04d5d566660a2623fb1b325e3b4e67c..ca0c82fdd7bd1c2055e84253d90b17857c51b771 100644 --- a/src/main/java/org/bukkit/craftbukkit/inventory/RecipeIterator.java +++ b/src/main/java/org/bukkit/craftbukkit/inventory/RecipeIterator.java @@ -9,6 +9,7 @@ import org.bukkit.inventory.Recipe; @@ -18,7 +18,7 @@ index 4e0f7564f04d5d566660a2623fb1b325e3b4e67c..39d2d67bf478beb4c72e41e6f5933789 public RecipeIterator() { this.recipes = MinecraftServer.getServer().getRecipeManager().recipes.byType.entries().iterator(); -@@ -21,11 +22,19 @@ public class RecipeIterator implements Iterator<Recipe> { +@@ -21,11 +22,17 @@ public class RecipeIterator implements Iterator<Recipe> { @Override public Recipe next() { @@ -32,9 +32,7 @@ index 4e0f7564f04d5d566660a2623fb1b325e3b4e67c..39d2d67bf478beb4c72e41e6f5933789 @Override public void remove() { + // Paper start - fix removing recipes from RecipeIterator -+ if (this.currentRecipe instanceof org.bukkit.Keyed keyed) { -+ MinecraftServer.getServer().getRecipeManager().byName.remove(org.bukkit.craftbukkit.util.CraftNamespacedKey.toMinecraft(keyed.getKey())); -+ } ++ if (true) throw new UnsupportedOperationException(); + // Paper end - fix removing recipes from RecipeIterator this.recipes.remove(); } diff --git a/patches/server/1039-API-for-checking-sent-chunks.patch b/patches/server/1039-API-for-checking-sent-chunks.patch new file mode 100644 index 0000000000..7f0201844b --- /dev/null +++ b/patches/server/1039-API-for-checking-sent-chunks.patch @@ -0,0 +1,46 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Flo0 <[email protected]> +Date: Mon, 8 Apr 2024 16:43:16 +0200 +Subject: [PATCH] API for checking sent chunks + + +diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java +index ed29e06422aa5e73adfaf9578cda3dfc5777f64c..550e175c7fec97818644933a4e4f7805e54d7d5f 100644 +--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java ++++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java +@@ -3518,6 +3518,35 @@ public class CraftPlayer extends CraftHumanEntity implements Player { + } + // Paper end + ++ // Paper start - Add chunk view API ++ @Override ++ public Set<java.lang.Long> getSentChunkKeys() { ++ org.spigotmc.AsyncCatcher.catchOp("accessing sent chunks"); ++ return it.unimi.dsi.fastutil.longs.LongSets.unmodifiable( ++ this.getHandle().moonrise$getChunkLoader().getSentChunksRaw().clone() ++ ); ++ } ++ ++ @Override ++ public Set<org.bukkit.Chunk> getSentChunks() { ++ org.spigotmc.AsyncCatcher.catchOp("accessing sent chunks"); ++ final it.unimi.dsi.fastutil.longs.LongOpenHashSet rawChunkKeys = this.getHandle().moonrise$getChunkLoader().getSentChunksRaw(); ++ final it.unimi.dsi.fastutil.objects.ObjectOpenHashSet<org.bukkit.Chunk> chunks = new it.unimi.dsi.fastutil.objects.ObjectOpenHashSet<>(rawChunkKeys.size()); ++ final org.bukkit.World world = this.getWorld(); ++ ++ final it.unimi.dsi.fastutil.longs.LongIterator iter = this.getHandle().moonrise$getChunkLoader().getSentChunksRaw().longIterator(); ++ while (iter.hasNext()) chunks.add(world.getChunkAt(iter.nextLong(), false)); ++ ++ return it.unimi.dsi.fastutil.objects.ObjectSets.unmodifiable(chunks); ++ } ++ ++ @Override ++ public boolean isChunkSent(final long chunkKey) { ++ org.spigotmc.AsyncCatcher.catchOp("accessing sent chunks"); ++ return this.getHandle().moonrise$getChunkLoader().getSentChunksRaw().contains(chunkKey); ++ } ++ // Paper end ++ + public Player.Spigot spigot() + { + return this.spigot; diff --git a/patches/server/1040-Fix-CraftWorld-isChunkGenerated.patch b/patches/server/1040-Fix-CraftWorld-isChunkGenerated.patch new file mode 100644 index 0000000000..a1a60d71b0 --- /dev/null +++ b/patches/server/1040-Fix-CraftWorld-isChunkGenerated.patch @@ -0,0 +1,44 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Jason Penilla <[email protected]> +Date: Tue, 18 Jun 2024 12:43:06 -0700 +Subject: [PATCH] Fix CraftWorld#isChunkGenerated + +The upstream implementation is returning true for non-full chunks. + +diff --git a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java +index 2058671a77cac4cfa6494461a5142abae14402b6..d41c81158c00931e6b11093cce141f6a3085ba05 100644 +--- a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java ++++ b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java +@@ -417,11 +417,28 @@ public class CraftWorld extends CraftRegionAccessor implements World { + + @Override + public boolean isChunkGenerated(int x, int z) { +- try { +- return this.isChunkLoaded(x, z) || this.world.getChunkSource().chunkMap.read(new ChunkPos(x, z)).get().isPresent(); +- } catch (InterruptedException | ExecutionException ex) { +- throw new RuntimeException(ex); ++ // Paper start - Fix this method ++ if (!Bukkit.isPrimaryThread()) { ++ return java.util.concurrent.CompletableFuture.supplyAsync(() -> { ++ return CraftWorld.this.isChunkGenerated(x, z); ++ }, world.getChunkSource().mainThreadProcessor).join(); ++ } ++ ChunkAccess chunk = world.getChunkSource().getChunkAtImmediately(x, z); ++ if (chunk != null) { ++ return chunk instanceof ImposterProtoChunk || chunk instanceof net.minecraft.world.level.chunk.LevelChunk; + } ++ final java.util.concurrent.CompletableFuture<ChunkAccess> future = new java.util.concurrent.CompletableFuture<>(); ++ ca.spottedleaf.moonrise.common.util.ChunkSystem.scheduleChunkLoad( ++ this.world, x, z, false, ChunkStatus.EMPTY, true, ca.spottedleaf.concurrentutil.util.Priority.NORMAL, future::complete ++ ); ++ world.getChunkSource().mainThreadProcessor.managedBlock(future::isDone); ++ return future.thenApply(c -> { ++ if (c != null) { ++ return c.getPersistedStatus() == ChunkStatus.FULL; ++ } ++ return false; ++ }).join(); ++ // Paper end - Fix this method + } + + @Override |