aboutsummaryrefslogtreecommitdiffhomepage
path: root/Spigot-Server-Patches/0051-Add-configurable-portal-search-radius.patch
blob: 368a89fc067147ded1c1b5ada14656c33fd01ecd (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
From a09b0acbefadc0c24ef240451bee1984098a61f9 Mon Sep 17 00:00:00 2001
From: Joseph Hirschfeld <joe@ibj.io>
Date: Thu, 3 Mar 2016 02:46:17 -0600
Subject: [PATCH] Add configurable portal search radius


diff --git a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
index be91b11242..320fd07c62 100644
--- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
+++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
@@ -186,4 +186,9 @@ public class PaperWorldConfig {
     private void allChunksAreSlimeChunks() {
         allChunksAreSlimeChunks = getBoolean("all-chunks-are-slime-chunks", false);
     }
+
+    public int portalSearchRadius;
+    private void portalSearchRadius() {
+        portalSearchRadius = getInt("portal-search-radius", 128);
+    }
 }
diff --git a/src/main/java/net/minecraft/server/PortalTravelAgent.java b/src/main/java/net/minecraft/server/PortalTravelAgent.java
index 6552f9e25e..2f0a8e4bb6 100644
--- a/src/main/java/net/minecraft/server/PortalTravelAgent.java
+++ b/src/main/java/net/minecraft/server/PortalTravelAgent.java
@@ -70,10 +70,11 @@ public class PortalTravelAgent {
             } else {
                 double d2 = Double.MAX_VALUE;
 
-                for (int i = -128; i <= 128; ++i) {
+                int portalSearchRadius = world.paperConfig.portalSearchRadius; // Paper
+                for (int i = -portalSearchRadius; i <= portalSearchRadius; ++i) { // Paper
                     BlockPosition blockposition2;
 
-                    for (int j = -128; j <= 128; ++j) {
+                    for (int j = -world.paperConfig.portalSearchRadius; j <= world.paperConfig.portalSearchRadius; ++j) { // Paper
                         for (BlockPosition blockposition3 = blockposition.b(i, this.world.getHeight() - 1 - blockposition.getY(), j); blockposition3.getY() >= 0; blockposition3 = blockposition2) {
                             blockposition2 = blockposition3.down();
                             if (this.world.getType(blockposition3).getBlock() == PortalTravelAgent.b) {
-- 
2.22.0