aboutsummaryrefslogtreecommitdiffhomepage
path: root/patches/server/0060-Add-configurable-portal-search-radius.patch
blob: 9ba19afb3eed635a39e47e3fffba8dfea9457127 (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
From 0000000000000000000000000000000000000000 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/net/minecraft/world/level/block/NetherPortalBlock.java b/src/main/java/net/minecraft/world/level/block/NetherPortalBlock.java
index 462afb22cce2376789e44283032e63a6264cf851..8072e67f7b2f5944670159d3de1b01090bd1019d 100644
--- a/src/main/java/net/minecraft/world/level/block/NetherPortalBlock.java
+++ b/src/main/java/net/minecraft/world/level/block/NetherPortalBlock.java
@@ -139,8 +139,14 @@ public class NetherPortalBlock extends Block implements Portal {
             WorldBorder worldborder = worldserver1.getWorldBorder();
             double d0 = DimensionType.getTeleportationScale(world.dimensionType(), worldserver1.dimensionType());
             BlockPos blockposition1 = worldborder.clampToBounds(entity.getX() * d0, entity.getY(), entity.getZ() * d0);
+            // Paper start - Configurable portal search radius
+            int portalSearchRadius = worldserver1.paperConfig().environment.portalSearchRadius;
+            if (entity.level().paperConfig().environment.portalSearchVanillaDimensionScaling && flag) { // flag = is going to nether
+                portalSearchRadius = (int) (portalSearchRadius / worldserver1.dimensionType().coordinateScale());
+            }
+            // Paper end - Configurable portal search radius
             // CraftBukkit start
-            CraftPortalEvent event = entity.callPortalEvent(entity, CraftLocation.toBukkit(blockposition1, worldserver1.getWorld()), PlayerTeleportEvent.TeleportCause.NETHER_PORTAL, flag ? 16 : 128, 16);
+            CraftPortalEvent event = entity.callPortalEvent(entity, CraftLocation.toBukkit(blockposition1, worldserver1.getWorld()), PlayerTeleportEvent.TeleportCause.NETHER_PORTAL, portalSearchRadius, worldserver1.paperConfig().environment.portalCreateRadius); // Paper - use custom portal search radius
             if (event == null) {
                 return null;
             }
diff --git a/src/main/java/net/minecraft/world/level/portal/PortalForcer.java b/src/main/java/net/minecraft/world/level/portal/PortalForcer.java
index aef1dd28da7e0c0a13a0a7a5b52daa27635c48ea..5c4b2a33d4007c36aef68604bca40a4eba510b4e 100644
--- a/src/main/java/net/minecraft/world/level/portal/PortalForcer.java
+++ b/src/main/java/net/minecraft/world/level/portal/PortalForcer.java
@@ -42,6 +42,7 @@ public class PortalForcer {
         this.level = world;
     }
 
+    @io.papermc.paper.annotation.DoNotUse // Paper
     public Optional<BlockPos> findClosestPortalPosition(BlockPos pos, boolean destIsNether, WorldBorder worldBorder) {
         // CraftBukkit start
         return this.findClosestPortalPosition(pos, worldBorder, destIsNether ? 16 : 128); // Search Radius