mirror of
https://github.com/PaperMC/Paper.git
synced 2024-11-27 04:55:47 +01:00
57dd397155
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: b999860d SPIGOT-2304: Add LootGenerateEvent CraftBukkit Changes:77fd87e4
SPIGOT-2304: Implement LootGenerateEventa1a705ee
SPIGOT-5566: Doused campfires & fires should call EntityChangeBlockEvent41712edd
SPIGOT-5707: PersistentDataHolder not Persistent on API dropped Item
51 lines
2.7 KiB
Diff
51 lines
2.7 KiB
Diff
From 00ace7e06a151758f29a76ccb6a96735d94f1ced 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 0f248b6de3..e8ce2ecf23 100644
|
|
--- a/src/main/java/net/minecraft/server/StructureGenerator.java
|
|
+++ b/src/main/java/net/minecraft/server/StructureGenerator.java
|
|
@@ -108,6 +108,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 = world.getChunkAt(chunkcoordintpair.x, chunkcoordintpair.z, ChunkStatus.STRUCTURE_STARTS).a(this.b());
|
|
|
|
if (structurestart != null && structurestart.e()) {
|
|
diff --git a/src/main/java/net/minecraft/server/WorldBorder.java b/src/main/java/net/minecraft/server/WorldBorder.java
|
|
index 4ee13ac454..5f10c4338e 100644
|
|
--- a/src/main/java/net/minecraft/server/WorldBorder.java
|
|
+++ b/src/main/java/net/minecraft/server/WorldBorder.java
|
|
@@ -24,6 +24,18 @@ public class WorldBorder {
|
|
return (double) (blockposition.getX() + 1) > this.c() && (double) blockposition.getX() < this.e() && (double) (blockposition.getZ() + 1) > this.d() && (double) blockposition.getZ() < this.f();
|
|
}
|
|
|
|
+ // Paper start
|
|
+ private final BlockPosition.MutableBlockPosition mutPos = new BlockPosition.MutableBlockPosition();
|
|
+ public boolean isBlockInBounds(int chunkX, int chunkZ) {
|
|
+ this.mutPos.setValues(chunkX, 64, chunkZ);
|
|
+ return this.isInBounds(this.mutPos);
|
|
+ }
|
|
+ public boolean isChunkInBounds(int chunkX, int chunkZ) {
|
|
+ this.mutPos.setValues(((chunkX << 4) + 15), 64, (chunkZ << 4) + 15);
|
|
+ return this.isInBounds(this.mutPos);
|
|
+ }
|
|
+ // Paper end
|
|
+
|
|
public boolean isInBounds(ChunkCoordIntPair chunkcoordintpair) {
|
|
return (double) chunkcoordintpair.f() > this.c() && (double) chunkcoordintpair.d() < this.e() && (double) chunkcoordintpair.g() > this.d() && (double) chunkcoordintpair.e() < this.f();
|
|
}
|
|
--
|
|
2.26.2
|
|
|