3
0
Mirror von https://github.com/PaperMC/Paper.git synchronisiert 2024-11-15 20:40:07 +01:00
Paper/Spigot-Server-Patches/0051-Add-configurable-portal-search-radius.patch

49 Zeilen
3.1 KiB
Diff

From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
2019-04-26 03:24:00 +02:00
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 e2cb804fd40e236337c37d89dfc85a02486c1bf4..cff769a0cffd81501f919fad0c6456e1268bd223 100644
2019-04-26 03:24:00 +02:00
--- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
+++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
@@ -192,4 +192,11 @@ public class PaperWorldConfig {
2019-04-26 03:24:00 +02:00
private void allChunksAreSlimeChunks() {
allChunksAreSlimeChunks = getBoolean("all-chunks-are-slime-chunks", false);
}
+
+ public int portalSearchRadius;
+ public int portalCreateRadius;
2019-04-26 03:24:00 +02:00
+ private void portalSearchRadius() {
+ portalSearchRadius = getInt("portal-search-radius", 128);
+ portalCreateRadius = getInt("portal-create-radius", 16);
2019-04-26 03:24:00 +02:00
+ }
}
diff --git a/src/main/java/net/minecraft/server/Entity.java b/src/main/java/net/minecraft/server/Entity.java
index d10b768ab1a308d366b5ad9a7d9e79a599fd31b4..42620e3d2e922e7884b052ea956bea4ec3b68589 100644
--- a/src/main/java/net/minecraft/server/Entity.java
+++ b/src/main/java/net/minecraft/server/Entity.java
@@ -2530,7 +2530,7 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, Ke
double d4 = DimensionManager.a(this.world.getDimensionManager(), worldserver.getDimensionManager());
BlockPosition blockposition = new BlockPosition(MathHelper.a(this.locX() * d4, d0, d2), this.locY(), MathHelper.a(this.locZ() * d4, d1, d3));
// CraftBukkit start
- CraftPortalEvent event = callPortalEvent(this, worldserver, blockposition, PlayerTeleportEvent.TeleportCause.NETHER_PORTAL, flag2 ? 16 : 128, 16);
+ CraftPortalEvent event = callPortalEvent(this, worldserver, blockposition, PlayerTeleportEvent.TeleportCause.NETHER_PORTAL, worldserver.paperConfig.portalSearchRadius, worldserver.paperConfig.portalCreateRadius); // Paper start - configurable portal radius
if (event == null) {
return null;
}
2019-04-26 03:24:00 +02:00
diff --git a/src/main/java/net/minecraft/server/PortalTravelAgent.java b/src/main/java/net/minecraft/server/PortalTravelAgent.java
index 150c688262e79b3b675685dbd1754b9e01cb4d75..e10995ec30dd9a10d781b3c1709fd2db5a9becdd 100644
2019-04-26 03:24:00 +02:00
--- a/src/main/java/net/minecraft/server/PortalTravelAgent.java
+++ b/src/main/java/net/minecraft/server/PortalTravelAgent.java
@@ -14,7 +14,7 @@ public class PortalTravelAgent {
public Optional<BlockUtil.Rectangle> findPortal(BlockPosition blockposition, boolean flag) {
// CraftBukkit start
- return findPortal(blockposition, flag ? 16 : 128); // Search Radius
+ return findPortal(blockposition, flag ? world.paperConfig.portalCreateRadius : world.paperConfig.portalSearchRadius); // Paper - search Radius
}
public Optional<BlockUtil.Rectangle> findPortal(BlockPosition blockposition, int i) {