Add configurable portal search radius

This commit is contained in:
Joseph Hirschfeld 2016-02-21 01:33:37 -05:00
parent ef8b3744c9
commit f119608227

View file

@ -0,0 +1,61 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Joseph Hirschfeld <joe@ibj.io>
Date: Sat, 20 Feb 2016 23:38:24 -0500
Subject: [PATCH] Add configurable portal search radius
diff --git a/src/main/java/net/minecraft/server/PortalTravelAgent.java b/src/main/java/net/minecraft/server/PortalTravelAgent.java
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/net/minecraft/server/PortalTravelAgent.java
+++ b/src/main/java/net/minecraft/server/PortalTravelAgent.java
@@ -0,0 +0,0 @@ public class PortalTravelAgent {
return true;
}
- public BlockPosition findPortal(double x, double y, double z, int short1) {
+ public BlockPosition findPortal(double x, double y, double z, int searchRadius) { // Paper - actually use search radius
if (this.a.getWorld().getEnvironment() == org.bukkit.World.Environment.THE_END) {
return this.findEndPortal(this.a.worldProvider.h());
}
@@ -0,0 +0,0 @@ public class PortalTravelAgent {
} else {
BlockPosition blockposition = new BlockPosition(x, y, z);
- for (int l = -128; l <= 128; ++l) {
+ for (int l = -searchRadius; l <= searchRadius; ++l) { // Paper - actually use search radius
BlockPosition blockposition1;
- for (int i1 = -128; i1 <= 128; ++i1) {
+ for (int i1 = -searchRadius; i1 <= searchRadius; ++i1) { // Paper - actually use search radius
for (BlockPosition blockposition2 = blockposition.a(l, this.a.V() - 1 - blockposition.getY(), i1); blockposition2.getY() >= 0; blockposition2 = blockposition1) {
blockposition1 = blockposition2.down();
if (this.a.getType(blockposition2).getBlock() == Blocks.PORTAL) {
diff --git a/src/main/java/net/minecraft/server/WorldServer.java b/src/main/java/net/minecraft/server/WorldServer.java
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/net/minecraft/server/WorldServer.java
+++ b/src/main/java/net/minecraft/server/WorldServer.java
@@ -0,0 +0,0 @@ public class WorldServer extends World implements IAsyncTaskHandler {
this.manager = new PlayerChunkMap(this, spigotConfig.viewDistance); // Spigot
this.worldProvider.a(this);
this.chunkProvider = this.k();
- this.Q = new org.bukkit.craftbukkit.CraftTravelAgent(this); // CraftBukkit
+ this.Q = ((org.bukkit.craftbukkit.CraftTravelAgent) new org.bukkit.craftbukkit.CraftTravelAgent(this).setSearchRadius(paperSpigotConfig.portalSearchRadius)); // CraftBukkit // Paper - configurable search radius
this.B();
this.C();
this.getWorldBorder().a(minecraftserver.aI());
diff --git a/src/main/java/org/github/paperspigot/PaperSpigotWorldConfig.java b/src/main/java/org/github/paperspigot/PaperSpigotWorldConfig.java
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/org/github/paperspigot/PaperSpigotWorldConfig.java
+++ b/src/main/java/org/github/paperspigot/PaperSpigotWorldConfig.java
@@ -0,0 +0,0 @@ public class PaperSpigotWorldConfig
{
allowBlockLocationTabCompletion = getBoolean( "allow-block-location-tab-completion", true );
}
+
+ public int portalSearchRadius;
+ private void portalSearchRadius()
+ {
+ portalSearchRadius = getInt("portal-search-radius", 128);
+ }
}
--