mirror of
https://github.com/PaperMC/Paper.git
synced 2024-11-23 11:06:29 +01:00
1cfd363d32
Upstream has released updates that appear 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: fc460d1b PR-735: Add Villager#zombify c8c8331e PR-690: Add method to read ItemStack input 62845f2f SPIGOT-6829: Add per-player world border API CraftBukkit Changes: a459f4d4 PR-1033: Add Villager#zombify d65d1430 PR-975: Add method to read ItemStack input b5559f8c SPIGOT-6990: Fix setRepairCost(0) in Anvil 6c308e1b SPIGOT-6829: Add per-player world border API Spigot Changes: 42b61526 SPIGOT-7000: Generation and /locate issues when using custom structure seeds
48 lines
2.8 KiB
Diff
48 lines
2.8 KiB
Diff
From 0000000000000000000000000000000000000000 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/world/level/border/WorldBorder.java b/src/main/java/net/minecraft/world/level/border/WorldBorder.java
|
|
index 6ec5a1525d0b8ced8fe78d3eab29c5eb82996844..2442c287a7f26cfee10a19e9015558cdebdcf3ac 100644
|
|
--- a/src/main/java/net/minecraft/world/level/border/WorldBorder.java
|
|
+++ b/src/main/java/net/minecraft/world/level/border/WorldBorder.java
|
|
@@ -37,6 +37,18 @@ public class WorldBorder {
|
|
return (double) (pos.getX() + 1) > this.getMinX() && (double) pos.getX() < this.getMaxX() && (double) (pos.getZ() + 1) > this.getMinZ() && (double) pos.getZ() < this.getMaxZ();
|
|
}
|
|
|
|
+ // Paper start
|
|
+ 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
|
|
+
|
|
public boolean isWithinBounds(ChunkPos pos) {
|
|
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 30ee07433cfee7c7911dcea6d8bfc58eacf5833a..fff5c9d40a0bab8642376db3ec25cc1e8d666fa6 100644
|
|
--- a/src/main/java/net/minecraft/world/level/chunk/ChunkGenerator.java
|
|
+++ b/src/main/java/net/minecraft/world/level/chunk/ChunkGenerator.java
|
|
@@ -440,6 +440,7 @@ public abstract class ChunkGenerator implements BiomeManager.NoiseBiomeSource {
|
|
int l1 = i + i1 * j1;
|
|
int i2 = j + i1 * k1;
|
|
ChunkPos chunkcoordintpair = randomspreadstructureplacement.getPotentialFeatureChunk(l, l1, i2);
|
|
+ if (!iworldreader.getWorldBorder().isChunkInBounds(chunkcoordintpair.x, chunkcoordintpair.z)) { continue; } // Paper
|
|
Iterator iterator = set.iterator();
|
|
|
|
while (iterator.hasNext()) {
|