2020-05-06 11:48:49 +02:00
|
|
|
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
2016-12-20 21:17:18 +01:00
|
|
|
From: Aikar <aikar@aikar.co>
|
|
|
|
Date: Tue, 20 Dec 2016 15:15:11 -0500
|
|
|
|
Subject: [PATCH] Bound Treasure Maps to World Border
|
|
|
|
|
|
|
|
Make it so a Treasure Map does not target a structure outside of the
|
|
|
|
World Border, where players are not even able to reach.
|
|
|
|
|
|
|
|
This also would help the case where a players close to the border, and one
|
|
|
|
that is outside happens to be closer, but unreachable, yet another reachable
|
|
|
|
one is in border that would of been missed.
|
|
|
|
|
|
|
|
diff --git a/src/main/java/net/minecraft/server/StructureGenerator.java b/src/main/java/net/minecraft/server/StructureGenerator.java
|
2020-08-25 04:22:08 +02:00
|
|
|
index a8e3bbd18e08678e55aa88b09a9f7feb37ab4761..c3bd58069d8dbdf36f70f1dafd7c24000f31708b 100644
|
2016-12-20 21:17:18 +01:00
|
|
|
--- a/src/main/java/net/minecraft/server/StructureGenerator.java
|
|
|
|
+++ b/src/main/java/net/minecraft/server/StructureGenerator.java
|
2020-08-25 04:22:08 +02:00
|
|
|
@@ -142,6 +142,7 @@ public abstract class StructureGenerator<C extends WorldGenFeatureConfiguration>
|
2020-06-25 14:04:34 +02:00
|
|
|
int i2 = l + k * k1;
|
|
|
|
int j2 = i1 + k * l1;
|
|
|
|
ChunkCoordIntPair chunkcoordintpair = this.a(structuresettingsfeature, j, seededrandom, i2, j2);
|
|
|
|
+ if (!iworldreader.getWorldBorder().isChunkInBounds(chunkcoordintpair.x, chunkcoordintpair.z)) { continue; } // Paper
|
|
|
|
IChunkAccess ichunkaccess = iworldreader.getChunkAt(chunkcoordintpair.x, chunkcoordintpair.z, ChunkStatus.STRUCTURE_STARTS);
|
|
|
|
StructureStart<?> structurestart = structuremanager.a(SectionPosition.a(ichunkaccess.getPos(), 0), this, ichunkaccess);
|
2016-12-20 21:17:18 +01:00
|
|
|
|
|
|
|
diff --git a/src/main/java/net/minecraft/server/WorldBorder.java b/src/main/java/net/minecraft/server/WorldBorder.java
|
2020-08-25 04:22:08 +02:00
|
|
|
index 717f495abd63218bb7ce9241e7cfeac809ef02de..adab2bd76e7e99140218ddbdb00aa9c27c0d0183 100644
|
2016-12-20 21:17:18 +01:00
|
|
|
--- a/src/main/java/net/minecraft/server/WorldBorder.java
|
|
|
|
+++ b/src/main/java/net/minecraft/server/WorldBorder.java
|
2020-06-25 14:04:34 +02:00
|
|
|
@@ -26,6 +26,18 @@ public class WorldBorder {
|
|
|
|
return (double) (blockposition.getX() + 1) > this.e() && (double) blockposition.getX() < this.g() && (double) (blockposition.getZ() + 1) > this.f() && (double) blockposition.getZ() < this.h();
|
2016-12-20 21:17:18 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
+ // Paper start
|
|
|
|
+ private final BlockPosition.MutableBlockPosition mutPos = new BlockPosition.MutableBlockPosition();
|
|
|
|
+ public boolean isBlockInBounds(int chunkX, int chunkZ) {
|
2019-04-27 08:26:04 +02:00
|
|
|
+ this.mutPos.setValues(chunkX, 64, chunkZ);
|
|
|
|
+ return this.isInBounds(this.mutPos);
|
2016-12-20 21:17:18 +01:00
|
|
|
+ }
|
|
|
|
+ public boolean isChunkInBounds(int chunkX, int chunkZ) {
|
2019-04-27 08:26:04 +02:00
|
|
|
+ this.mutPos.setValues(((chunkX << 4) + 15), 64, (chunkZ << 4) + 15);
|
|
|
|
+ return this.isInBounds(this.mutPos);
|
2016-12-20 21:17:18 +01:00
|
|
|
+ }
|
|
|
|
+ // Paper end
|
|
|
|
+
|
|
|
|
public boolean isInBounds(ChunkCoordIntPair chunkcoordintpair) {
|
2020-06-25 14:04:34 +02:00
|
|
|
return (double) chunkcoordintpair.f() > this.e() && (double) chunkcoordintpair.d() < this.g() && (double) chunkcoordintpair.g() > this.f() && (double) chunkcoordintpair.e() < this.h();
|
2016-12-20 21:17:18 +01:00
|
|
|
}
|