Paper/Spigot-Server-Patches/0051-Add-configurable-portal-search-radius.patch
Daniel Ennis e792da723a
Updated Upstream (Bukkit/CraftBukkit/Spigot) (#4728)
Upstream has released updates that appears to apply and compile correctly.
This update has not been tested by PaperMC and as with ANY update, please do your own testing

Bukkit Changes:
30885166 Update to Minecraft 1.16.4

CraftBukkit Changes:
3af81c71 Update to Minecraft 1.16.4

Spigot Changes:
f011ca24 Update to Minecraft 1.16.4

Co-authored-by: Mariell Hoversholm <proximyst@proximyst.com>
2020-11-02 20:22:15 -06:00

62 Zeilen
4.3 KiB
Diff

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/com/destroystokyo/paper/PaperWorldConfig.java b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
index 62e793b71b313146b86b466421e7a5f894bef9df..cd47a4ca069df26969de3051c2aac80540093818 100644
--- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
+++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
@@ -191,4 +191,11 @@ public class PaperWorldConfig {
private void allChunksAreSlimeChunks() {
allChunksAreSlimeChunks = getBoolean("all-chunks-are-slime-chunks", false);
}
+
+ public int portalSearchRadius;
+ public int portalCreateRadius;
+ private void portalSearchRadius() {
+ portalSearchRadius = getInt("portal-search-radius", 128);
+ portalCreateRadius = getInt("portal-create-radius", 16);
+ }
}
diff --git a/src/main/java/net/minecraft/server/Entity.java b/src/main/java/net/minecraft/server/Entity.java
index 52595b6534e2798b36b3a7c2d97451bd0ea2f3a0..716ea2fced5dc9e9a790f25e68252d5bd445b9ce 100644
--- a/src/main/java/net/minecraft/server/Entity.java
+++ b/src/main/java/net/minecraft/server/Entity.java
@@ -2528,7 +2528,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;
}
diff --git a/src/main/java/net/minecraft/server/EntityPlayer.java b/src/main/java/net/minecraft/server/EntityPlayer.java
index d0cc45637e8bb57c3d6ede6e4e49e492671f4292..64b310347db500a0b89b3c520a2a6fd795133deb 100644
--- a/src/main/java/net/minecraft/server/EntityPlayer.java
+++ b/src/main/java/net/minecraft/server/EntityPlayer.java
@@ -875,7 +875,7 @@ public class EntityPlayer extends EntityHuman implements ICrafting {
protected CraftPortalEvent callPortalEvent(Entity entity, WorldServer exitWorldServer, BlockPosition exitPosition, TeleportCause cause, int searchRadius, int creationRadius) {
Location enter = this.getBukkitEntity().getLocation();
Location exit = new Location(exitWorldServer.getWorld(), exitPosition.getX(), exitPosition.getY(), exitPosition.getZ(), yaw, pitch);
- PlayerPortalEvent event = new PlayerPortalEvent(this.getBukkitEntity(), enter, exit, cause, 128, true, creationRadius);
+ PlayerPortalEvent event = new PlayerPortalEvent(this.getBukkitEntity(), enter, exit, cause, searchRadius, true, creationRadius); // Paper - use searchRadius
Bukkit.getServer().getPluginManager().callEvent(event);
if (event.isCancelled() || event.getTo() == null || event.getTo().getWorld() == null) {
return null;
diff --git a/src/main/java/net/minecraft/server/PortalTravelAgent.java b/src/main/java/net/minecraft/server/PortalTravelAgent.java
index 150c688262e79b3b675685dbd1754b9e01cb4d75..e10995ec30dd9a10d781b3c1709fd2db5a9becdd 100644
--- 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) {