2020-01-22 03:02:07 +01:00
|
|
|
From f210484a8d88355c4669f3100af808e178633995 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-01-22 03:02:07 +01:00
|
|
|
index 0f248b6de..e8ce2ecf2 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
|
2019-12-12 00:43:22 +01:00
|
|
|
@@ -108,6 +108,7 @@ public abstract class StructureGenerator<C extends WorldGenFeatureConfiguration>
|
2016-12-20 21:17:18 +01:00
|
|
|
|
2018-08-26 20:11:49 +02:00
|
|
|
if (flag1 || flag2) {
|
2018-07-17 22:32:05 +02:00
|
|
|
ChunkCoordIntPair chunkcoordintpair = this.a(chunkgenerator, seededrandom, j, k, i1, j1);
|
|
|
|
+ if (!world.getWorldBorder().isChunkInBounds(chunkcoordintpair.x, chunkcoordintpair.z)) { continue; } // Paper
|
2019-04-27 08:26:04 +02:00
|
|
|
StructureStart structurestart = world.getChunkAt(chunkcoordintpair.x, chunkcoordintpair.z, ChunkStatus.STRUCTURE_STARTS).a(this.b());
|
2018-07-17 22:32:05 +02:00
|
|
|
|
2019-04-27 08:26:04 +02:00
|
|
|
if (structurestart != null && structurestart.e()) {
|
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-01-22 03:02:07 +01:00
|
|
|
index 4ee13ac45..5f10c4338 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
|
2019-05-06 01:24:37 +02:00
|
|
|
@@ -24,6 +24,18 @@ public class WorldBorder {
|
2019-04-27 08:26:04 +02:00
|
|
|
return (double) (blockposition.getX() + 1) > this.c() && (double) blockposition.getX() < this.e() && (double) (blockposition.getZ() + 1) > this.d() && (double) blockposition.getZ() < this.f();
|
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) {
|
2019-04-27 08:26:04 +02:00
|
|
|
return (double) chunkcoordintpair.f() > this.c() && (double) chunkcoordintpair.d() < this.e() && (double) chunkcoordintpair.g() > this.d() && (double) chunkcoordintpair.e() < this.f();
|
2016-12-20 21:17:18 +01:00
|
|
|
}
|
|
|
|
--
|
2020-01-22 03:02:07 +01:00
|
|
|
2.25.0.windows.1
|
2016-12-20 21:17:18 +01:00
|
|
|
|