Add Configuration for finding Structures outside World Border (#10437)

This commit is contained in:
Tamion 2024-04-20 21:29:32 +02:00 committed by GitHub
parent c5f68ff9be
commit fc53ff5a71
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 5 additions and 4 deletions

View File

@ -1394,10 +1394,10 @@ index 0000000000000000000000000000000000000000..351fbbc577556ebbd62222615801a96b
+}
diff --git a/src/main/java/io/papermc/paper/configuration/WorldConfiguration.java b/src/main/java/io/papermc/paper/configuration/WorldConfiguration.java
new file mode 100644
index 0000000000000000000000000000000000000000..dc7950f9a52a718317e5f41de9d396cd7b846bf3
index 0000000000000000000000000000000000000000..d3fdf62912d190f8b468b77230a927023c361074
--- /dev/null
+++ b/src/main/java/io/papermc/paper/configuration/WorldConfiguration.java
@@ -0,0 +1,553 @@
@@ -0,0 +1,554 @@
+package io.papermc.paper.configuration;
+
+import com.google.common.collect.HashBasedTable;
@ -1816,6 +1816,7 @@ index 0000000000000000000000000000000000000000..dc7950f9a52a718317e5f41de9d396cd
+ public IntOr.Disabled netherCeilingVoidDamageHeight = IntOr.Disabled.DISABLED;
+ public int maxFluidTicks = 65536;
+ public int maxBlockTicks = 65536;
+ public boolean locateStructuresOutsideWorldBorder = false;
+ }
+
+ public Spawn spawn;

View File

@ -34,14 +34,14 @@ index 52325a99ea38530ad69a39ac0215233139f35268..bf5ac907507bf3b5bfcef45b566c0bc1
return (double) pos.getMaxBlockX() > this.getMinX() && (double) pos.getMinBlockX() < this.getMaxX() && (double) pos.getMaxBlockZ() > this.getMinZ() && (double) pos.getMinBlockZ() < this.getMaxZ();
}
diff --git a/src/main/java/net/minecraft/world/level/chunk/ChunkGenerator.java b/src/main/java/net/minecraft/world/level/chunk/ChunkGenerator.java
index b2f9429e0d437cf70bf56410e163e957b80ebdf1..3e57142dd9cb23d43857d5a4cb30962e4b696b74 100644
index b2f9429e0d437cf70bf56410e163e957b80ebdf1..4a731b9170222a5a2b0089ef5e9527dbd46a9ad5 100644
--- a/src/main/java/net/minecraft/world/level/chunk/ChunkGenerator.java
+++ b/src/main/java/net/minecraft/world/level/chunk/ChunkGenerator.java
@@ -217,6 +217,7 @@ public abstract class ChunkGenerator {
while (iterator.hasNext()) {
ChunkPos chunkcoordintpair = (ChunkPos) iterator.next();
+ if (!world.getWorldBorder().isChunkInBounds(chunkcoordintpair.x, chunkcoordintpair.z)) { continue; } // Paper - Bound treasure maps to world border
+ 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);