diff --git a/paper-server/patches/sources/net/minecraft/world/level/border/WorldBorder.java.patch b/paper-server/patches/sources/net/minecraft/world/level/border/WorldBorder.java.patch index 6dab41ad82..83f3585ce8 100644 --- a/paper-server/patches/sources/net/minecraft/world/level/border/WorldBorder.java.patch +++ b/paper-server/patches/sources/net/minecraft/world/level/border/WorldBorder.java.patch @@ -8,7 +8,27 @@ public WorldBorder() {} -@@ -189,6 +190,7 @@ +@@ -43,7 +44,19 @@ + + public boolean isWithinBounds(ChunkPos chunkPos) { + return this.isWithinBounds((double) chunkPos.getMinBlockX(), (double) chunkPos.getMinBlockZ()) && this.isWithinBounds((double) chunkPos.getMaxBlockX(), (double) chunkPos.getMaxBlockZ()); ++ } ++ ++ // Paper start - Bound treasure maps to world border ++ private final BlockPos.MutableBlockPos mutPos = new BlockPos.MutableBlockPos(); ++ public boolean isBlockInBounds(int chunkX, int chunkZ) { ++ this.mutPos.set(chunkX, 64, chunkZ); ++ return this.isWithinBounds(this.mutPos); ++ } ++ public boolean isChunkInBounds(int chunkX, int chunkZ) { ++ this.mutPos.set(((chunkX << 4) + 15), 64, (chunkZ << 4) + 15); ++ return this.isWithinBounds(this.mutPos); + } ++ // Paper end - Bound treasure maps to world border + + public boolean isWithinBounds(AABB box) { + return this.isWithinBounds(box.minX, box.minZ, box.maxX - 9.999999747378752E-6D, box.maxZ - 9.999999747378752E-6D); +@@ -189,6 +202,7 @@ } public void addListener(BorderChangeListener listener) { diff --git a/paper-server/patches/sources/net/minecraft/world/level/chunk/ChunkGenerator.java.patch b/paper-server/patches/sources/net/minecraft/world/level/chunk/ChunkGenerator.java.patch index b32d5dad2d..48e778619f 100644 --- a/paper-server/patches/sources/net/minecraft/world/level/chunk/ChunkGenerator.java.patch +++ b/paper-server/patches/sources/net/minecraft/world/level/chunk/ChunkGenerator.java.patch @@ -11,7 +11,15 @@ } public Optional>> getTypeNameForDataFixer() { -@@ -312,29 +312,29 @@ +@@ -223,6 +223,7 @@ + + while (iterator.hasNext()) { + ChunkPos chunkcoordintpair = (ChunkPos) iterator.next(); ++ if (!world.paperConfig().environment.locateStructuresOutsideWorldBorder && !world.getWorldBorder().isChunkInBounds(chunkcoordintpair.x, chunkcoordintpair.z)) { continue; } // Paper - Bound treasure maps to world border + + blockposition_mutableblockposition.set(SectionPos.sectionToBlockCoord(chunkcoordintpair.x, 8), 32, SectionPos.sectionToBlockCoord(chunkcoordintpair.z, 8)); + double d1 = blockposition_mutableblockposition.distSqr(center); +@@ -312,29 +313,29 @@ } } @@ -48,7 +56,7 @@ Objects.requireNonNull(set); palettedcontainerro.getAll(set::add); -@@ -345,7 +345,7 @@ +@@ -345,7 +346,7 @@ int j = list.size(); try { @@ -57,7 +65,7 @@ int k = Math.max(GenerationStep.Decoration.values().length, j); for (int l = 0; l < k; ++l) { -@@ -353,7 +353,7 @@ +@@ -353,7 +354,7 @@ Iterator iterator; CrashReportCategory crashreportsystemdetails; @@ -66,7 +74,7 @@ List list1 = (List) map.getOrDefault(l, Collections.emptyList()); for (iterator = list1.iterator(); iterator.hasNext(); ++i1) { -@@ -368,9 +368,9 @@ +@@ -368,9 +369,9 @@ }; try { @@ -79,7 +87,7 @@ }); } catch (Exception exception) { CrashReport crashreport = CrashReport.forThrowable(exception, "Feature placement"); -@@ -421,8 +421,8 @@ +@@ -421,8 +422,8 @@ seededrandom.setFeatureSeed(i, l1, l); try { @@ -90,7 +98,7 @@ } catch (Exception exception1) { CrashReport crashreport1 = CrashReport.forThrowable(exception1, "Feature placement"); -@@ -435,7 +435,7 @@ +@@ -435,7 +436,7 @@ } } @@ -99,7 +107,7 @@ } catch (Exception exception2) { CrashReport crashreport2 = CrashReport.forThrowable(exception2, "Biome decoration"); -@@ -445,6 +445,33 @@ +@@ -445,6 +446,33 @@ } } @@ -133,7 +141,7 @@ private static BoundingBox getWritableArea(ChunkAccess chunk) { ChunkPos chunkcoordintpair = chunk.getPos(); int i = chunkcoordintpair.getMinBlockX(); -@@ -582,6 +609,14 @@ +@@ -582,6 +610,14 @@ StructureStart structurestart = structure.generate(weightedEntry.structure(), dimension, dynamicRegistryManager, this, this.biomeSource, noiseConfig, structureManager, seed, pos, j, chunk, predicate); if (structurestart.isValid()) {