Paper/Spigot-Server-Patches/0154-Bound-Treasure-Maps-to-World-Border.patch
Aikar b62dfa0bf9
Updated Upstream (Bukkit/CraftBukkit)
Upstream has released updates that appears to apply and compile correctly.
This update has not been tested by PaperMC and as with ANY update, please do your own testing

Bukkit Changes:
39ce5d3a SPIGOT-4399: ItemMeta.equals broken with AttributeModifiers

CraftBukkit Changes:
1cf8b5dc SPIGOT-4400: Populators running on existing chunks
116cb9a1 SPIGOT-4399: Add attribute modifier equality test
5ee1c18a SPIGOT-4398: Set ASM7_EXPERIMENTAL flag
2018-09-28 19:31:59 -04:00

51 lines
2.7 KiB
Diff

From 53f9973a0970135fccddac14441c6ab2c3aee2a4 Mon Sep 17 00:00:00 2001
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
index aa640e27d4..44c742e643 100644
--- a/src/main/java/net/minecraft/server/StructureGenerator.java
+++ b/src/main/java/net/minecraft/server/StructureGenerator.java
@@ -124,6 +124,7 @@ public abstract class StructureGenerator<C extends WorldGenFeatureConfiguration>
if (flag1 || flag2) {
ChunkCoordIntPair chunkcoordintpair = this.a(chunkgenerator, seededrandom, j, k, i1, j1);
+ if (!world.getWorldBorder().isChunkInBounds(chunkcoordintpair.x, chunkcoordintpair.z)) { continue; } // Paper
StructureStart structurestart = this.a(world, chunkgenerator, seededrandom, chunkcoordintpair.a());
if (structurestart != StructureGenerator.a) {
diff --git a/src/main/java/net/minecraft/server/WorldBorder.java b/src/main/java/net/minecraft/server/WorldBorder.java
index 1a87480f09..057ea1c5ac 100644
--- a/src/main/java/net/minecraft/server/WorldBorder.java
+++ b/src/main/java/net/minecraft/server/WorldBorder.java
@@ -23,6 +23,18 @@ public class WorldBorder {
return (double) (blockposition.getX() + 1) > this.b() && (double) blockposition.getX() < this.d() && (double) (blockposition.getZ() + 1) > this.c() && (double) blockposition.getZ() < this.e();
}
+ // Paper start
+ private final BlockPosition.MutableBlockPosition mutPos = new BlockPosition.MutableBlockPosition();
+ public boolean isBlockInBounds(int chunkX, int chunkZ) {
+ mutPos.setValues(chunkX, 64, chunkZ);
+ return isInBounds(mutPos);
+ }
+ public boolean isChunkInBounds(int chunkX, int chunkZ) {
+ mutPos.setValues(((chunkX << 4) + 15), 64, (chunkZ << 4) + 15);
+ return isInBounds(mutPos);
+ }
+ // Paper end
+
public boolean isInBounds(ChunkCoordIntPair chunkcoordintpair) {
return (double) chunkcoordintpair.f() > this.b() && (double) chunkcoordintpair.d() < this.d() && (double) chunkcoordintpair.g() > this.c() && (double) chunkcoordintpair.e() < this.e();
}
--
2.19.0