SPIGOT-1820: Fix custom travel agent search radius.

This commit is contained in:
md_5 2016-03-07 19:13:41 +11:00
parent 20d9f644a6
commit ab83272e2a

View File

@ -85,7 +85,7 @@
+ return true;
+ }
+
+ public BlockPosition findPortal(double x, double y, double z, int short1) {
+ public BlockPosition findPortal(double x, double y, double z, int radius) {
+ if (this.world.getWorld().getEnvironment() == org.bukkit.World.Environment.THE_END) {
+ return this.findEndPortal(this.world.worldProvider.h());
+ }
@ -100,15 +100,22 @@
boolean flag1 = true;
Object object = BlockPosition.ZERO;
long k = ChunkCoordIntPair.a(i, j);
@@ -65,7 +129,7 @@
@@ -65,12 +129,12 @@
portaltravelagent_chunkcoordinatesportal.c = this.world.getTime();
flag1 = false;
} else {
- BlockPosition blockposition = new BlockPosition(entity);
+ BlockPosition blockposition = new BlockPosition(x, y, z); // CraftBukkit
for (int l = -128; l <= 128; ++l) {
- for (int l = -128; l <= 128; ++l) {
+ for (int l = -radius; l <= radius; ++l) {
BlockPosition blockposition1;
- for (int i1 = -128; i1 <= 128; ++i1) {
+ for (int i1 = -radius; i1 <= radius; ++i1) {
for (BlockPosition blockposition2 = blockposition.a(l, this.world.Z() - 1 - blockposition.getY(), i1); blockposition2.getY() >= 0; blockposition2 = blockposition1) {
blockposition1 = blockposition2.down();
if (this.world.getType(blockposition2).getBlock() == Blocks.PORTAL) {
@@ -95,6 +159,29 @@
this.c.put(k, new PortalTravelAgent.ChunkCoordinatesPortal((BlockPosition) object, this.world.getTime()));
this.d.add(Long.valueOf(k));