diff --git a/patches/removed/1.19/0865-Fix-World-locateNearestStructure.patch b/patches/server/0856-Fix-World-locateNearestStructure.patch similarity index 60% rename from patches/removed/1.19/0865-Fix-World-locateNearestStructure.patch rename to patches/server/0856-Fix-World-locateNearestStructure.patch index 61bc242b34..6add754c8e 100644 --- a/patches/removed/1.19/0865-Fix-World-locateNearestStructure.patch +++ b/patches/server/0856-Fix-World-locateNearestStructure.patch @@ -7,10 +7,10 @@ Subject: [PATCH] Fix World#locateNearestStructure impl needs to be changed to reflect that diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java -index b079677723ff65f64adec044e7d89656ecc49e4d..583d2deffa819c1aa25e1937a7f709d0d6bab294 100644 +index 33953cc7afc2616577b768a23a7d4ce0230cf480..b37c8c5801b87a24cd26675c3bf4bd2c83c9ba2c 100644 --- a/src/main/java/net/minecraft/server/MinecraftServer.java +++ b/src/main/java/net/minecraft/server/MinecraftServer.java -@@ -2056,6 +2056,11 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop>> pair = this.getChunkSource().getGenerator().findNearestMapFeature(this, (HolderSet) optional.get(), pos, radius, skipExistingChunks); +- Pair> pair = this.getChunkSource().getGenerator().findNearestMapStructure(this, (HolderSet) optional.get(), pos, radius, skipReferencedStructures); + // Paper start -+ return this.findNearestMapFeature(optional.get(), pos, radius, skipExistingChunks); ++ return this.findNearestMapFeature(optional.get(), pos, radius, skipReferencedStructures); + } + } + } -+ public @Nullable BlockPos findNearestMapFeature(HolderSet> holderSet, BlockPos pos, int radius, boolean skipExistingChunks) { ++ public @Nullable BlockPos findNearestMapFeature(HolderSet holderSet, BlockPos pos, int radius, boolean skipReferencedStructures) { + { + { -+ Pair>> pair = this.getChunkSource().getGenerator().findNearestMapFeature(this, holderSet, pos, radius, skipExistingChunks); ++ Pair> pair = this.getChunkSource().getGenerator().findNearestMapStructure(this, holderSet, pos, radius, skipReferencedStructures); + // Paper end return pair != null ? (BlockPos) pair.getFirst() : null; } diff --git a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java -index dd3aac2b8058f09fdd6dce9c1c683725b3594cfd..1a07887345f46582949090b685dae507aaba84f4 100644 +index 2e9b782e34ae25e982b45011a36c3b08ab298648..7cdeaeed4fa2d830ef03b26baf6d17ddc3d5e521 100644 --- a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java +++ b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java -@@ -2060,10 +2060,22 @@ public class CraftWorld extends CraftRegionAccessor implements World { +@@ -2059,10 +2059,22 @@ public class CraftWorld extends CraftRegionAccessor implements World { } -+ public final Map>>> structureCache = new java.util.HashMap<>(); // Paper ++ public final Map>> structureCache = new java.util.HashMap<>(); // Paper @Override public Location locateNearestStructure(Location origin, StructureType structureType, int radius, boolean findUnexplored) { BlockPos originPos = new BlockPos(origin.getX(), origin.getY(), origin.getZ()); -- BlockPos nearest = this.getHandle().findNearestMapFeature(TagKey.create(Registry.CONFIGURED_STRUCTURE_FEATURE_REGISTRY, CraftNamespacedKey.toMinecraft(structureType.getKey())), originPos, radius, findUnexplored); +- BlockPos nearest = this.getHandle().findNearestMapStructure(TagKey.create(Registry.STRUCTURE_REGISTRY, CraftNamespacedKey.toMinecraft(structureType.getKey())), originPos, radius, findUnexplored); + // Paper start - fix because you can't just create random TagKeys -+ if (!this.getHandle().serverLevelData.worldGenSettings().generateFeatures()) { // from ServerLevel#findNearestMapFeature ++ if (!this.getHandle().serverLevelData.worldGenSettings().generateStructures()) { // from ServerLevel#findNearestMapStructure + return null; + } -+ final List>> features = this.structureCache.computeIfAbsent(structureType, (type) -> { -+ final Registry> structureFeatureRegistry = this.getHandle().registryAccess().registryOrThrow(Registry.STRUCTURE_FEATURE_REGISTRY); -+ return this.getHandle().registryAccess().registryOrThrow(Registry.CONFIGURED_STRUCTURE_FEATURE_REGISTRY).holders().filter(holder -> { -+ return structureType.getKey().equals(org.bukkit.craftbukkit.util.CraftNamespacedKey.fromMinecraft(Objects.requireNonNull(structureFeatureRegistry.getKey(holder.value().feature)))); ++ final List> features = this.structureCache.computeIfAbsent(structureType, (type) -> { ++ final Registry> structureFeatureRegistry = this.getHandle().registryAccess().registryOrThrow(Registry.STRUCTURE_TYPE_REGISTRY); ++ return this.getHandle().registryAccess().registryOrThrow(Registry.STRUCTURE_REGISTRY).holders().filter(holder -> { ++ return structureType.getKey().equals(CraftNamespacedKey.fromMinecraft(Objects.requireNonNull(structureFeatureRegistry.getKey(holder.value().type())))); + }).toList(); + }); + BlockPos nearest = this.getHandle().findNearestMapFeature(net.minecraft.core.HolderSet.direct(features), originPos, radius, findUnexplored); diff --git a/patches/server/0856-Force-close-world-loading-screen.patch b/patches/server/0857-Force-close-world-loading-screen.patch similarity index 100% rename from patches/server/0856-Force-close-world-loading-screen.patch rename to patches/server/0857-Force-close-world-loading-screen.patch diff --git a/patches/server/0857-Fix-falling-block-spawn-methods.patch b/patches/server/0858-Fix-falling-block-spawn-methods.patch similarity index 97% rename from patches/server/0857-Fix-falling-block-spawn-methods.patch rename to patches/server/0858-Fix-falling-block-spawn-methods.patch index e0fa906c8a..ff73c72339 100644 --- a/patches/server/0857-Fix-falling-block-spawn-methods.patch +++ b/patches/server/0858-Fix-falling-block-spawn-methods.patch @@ -21,7 +21,7 @@ index d1fca0e3227b5f37c11367548be362f5a49b6a71..5628940cd3c3566c5db2beda506d4f20 if (Snowball.class.isAssignableFrom(clazz)) { entity = new net.minecraft.world.entity.projectile.Snowball(world, x, y, z); diff --git a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java -index 2e9b782e34ae25e982b45011a36c3b08ab298648..e30cd412f30e26aa4c59f367b3cc26ba47e1b21c 100644 +index 7cdeaeed4fa2d830ef03b26baf6d17ddc3d5e521..cd852fa92d2fec20966a9ebf56484ce94584d74a 100644 --- a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java +++ b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java @@ -1410,7 +1410,12 @@ public class CraftWorld extends CraftRegionAccessor implements World { diff --git a/patches/server/0858-Expose-furnace-minecart-push-values.patch b/patches/server/0859-Expose-furnace-minecart-push-values.patch similarity index 100% rename from patches/server/0858-Expose-furnace-minecart-push-values.patch rename to patches/server/0859-Expose-furnace-minecart-push-values.patch diff --git a/patches/server/0859-Fix-cancelling-ProjectileHitEvent-for-piercing-arrow.patch b/patches/server/0860-Fix-cancelling-ProjectileHitEvent-for-piercing-arrow.patch similarity index 100% rename from patches/server/0859-Fix-cancelling-ProjectileHitEvent-for-piercing-arrow.patch rename to patches/server/0860-Fix-cancelling-ProjectileHitEvent-for-piercing-arrow.patch diff --git a/patches/server/0860-Fix-save-problems-on-shutdown.patch b/patches/server/0861-Fix-save-problems-on-shutdown.patch similarity index 94% rename from patches/server/0860-Fix-save-problems-on-shutdown.patch rename to patches/server/0861-Fix-save-problems-on-shutdown.patch index 321e572a1b..99ab72022f 100644 --- a/patches/server/0860-Fix-save-problems-on-shutdown.patch +++ b/patches/server/0861-Fix-save-problems-on-shutdown.patch @@ -12,7 +12,7 @@ Subject: [PATCH] Fix save problems on shutdown processed so that the main process queue can be drained diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java -index 33953cc7afc2616577b768a23a7d4ce0230cf480..869e0b6c8588d751a9b38b713119f888778d3387 100644 +index b37c8c5801b87a24cd26675c3bf4bd2c83c9ba2c..19640c290eb16c9e5afc842ec8ccac5a6a2ea4c7 100644 --- a/src/main/java/net/minecraft/server/MinecraftServer.java +++ b/src/main/java/net/minecraft/server/MinecraftServer.java @@ -953,6 +953,13 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop