2020-05-06 09:48:49 +00:00
|
|
|
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
2019-04-26 01:24:00 +00: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
|
2020-05-06 09:48:49 +00:00
|
|
|
index 62e793b71b313146b86b466421e7a5f894bef9df..cd47a4ca069df26969de3051c2aac80540093818 100644
|
2019-04-26 01:24:00 +00:00
|
|
|
--- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
|
|
|
|
+++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
|
2020-01-18 17:28:32 +00:00
|
|
|
@@ -191,4 +191,11 @@ public class PaperWorldConfig {
|
2019-04-26 01:24:00 +00:00
|
|
|
private void allChunksAreSlimeChunks() {
|
|
|
|
allChunksAreSlimeChunks = getBoolean("all-chunks-are-slime-chunks", false);
|
|
|
|
}
|
|
|
|
+
|
|
|
|
+ public int portalSearchRadius;
|
2020-01-18 17:28:32 +00:00
|
|
|
+ public int portalCreateRadius;
|
2019-04-26 01:24:00 +00:00
|
|
|
+ private void portalSearchRadius() {
|
|
|
|
+ portalSearchRadius = getInt("portal-search-radius", 128);
|
2020-01-18 17:28:32 +00:00
|
|
|
+ portalCreateRadius = getInt("portal-create-radius", 16);
|
2019-04-26 01:24:00 +00:00
|
|
|
+ }
|
|
|
|
}
|
2020-01-13 22:12:54 +00:00
|
|
|
diff --git a/src/main/java/net/minecraft/server/Entity.java b/src/main/java/net/minecraft/server/Entity.java
|
2020-09-19 11:29:53 +00:00
|
|
|
index e9725b99fd0ce9a104bce07425b9c049cb4b3be6..7cdb5c74ef3260917618fc0bfc393bcf933ffb7a 100644
|
2020-01-13 22:12:54 +00:00
|
|
|
--- a/src/main/java/net/minecraft/server/Entity.java
|
|
|
|
+++ b/src/main/java/net/minecraft/server/Entity.java
|
2020-09-19 11:29:53 +00:00
|
|
|
@@ -2527,7 +2527,7 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, Ke
|
2020-08-25 02:22:08 +00:00
|
|
|
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));
|
2020-01-14 21:43:50 +00:00
|
|
|
// CraftBukkit start
|
2020-08-25 02:22:08 +00:00
|
|
|
- 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
|
2020-01-14 21:43:50 +00:00
|
|
|
if (event == null) {
|
|
|
|
return null;
|
|
|
|
}
|
2020-01-18 17:28:32 +00:00
|
|
|
diff --git a/src/main/java/net/minecraft/server/EntityPlayer.java b/src/main/java/net/minecraft/server/EntityPlayer.java
|
2020-09-10 23:47:58 +00:00
|
|
|
index 95434c741b246ff5698e41babef9f2c1471f76a2..863f779453bb028d6452292663fd1e41ab434165 100644
|
2020-01-18 17:28:32 +00:00
|
|
|
--- a/src/main/java/net/minecraft/server/EntityPlayer.java
|
|
|
|
+++ b/src/main/java/net/minecraft/server/EntityPlayer.java
|
2020-08-26 08:22:13 +00:00
|
|
|
@@ -872,7 +872,7 @@ public class EntityPlayer extends EntityHuman implements ICrafting {
|
2020-08-25 02:22:08 +00:00
|
|
|
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;
|
2019-04-26 01:24:00 +00:00
|
|
|
diff --git a/src/main/java/net/minecraft/server/PortalTravelAgent.java b/src/main/java/net/minecraft/server/PortalTravelAgent.java
|
2020-08-25 02:22:08 +00:00
|
|
|
index dc972bf0abc87c2b2fb84d8fffc368a947b2d9a3..205f3f697e9c31674a4ac8db38467bb2e61cfe6b 100644
|
2019-04-26 01:24:00 +00:00
|
|
|
--- a/src/main/java/net/minecraft/server/PortalTravelAgent.java
|
|
|
|
+++ b/src/main/java/net/minecraft/server/PortalTravelAgent.java
|
2020-08-25 02:22:08 +00:00
|
|
|
@@ -14,7 +14,7 @@ public class PortalTravelAgent {
|
|
|
|
|
|
|
|
public Optional<BlockUtil.Rectangle> findPortal(BlockPosition blockposition, boolean flag) {
|
2020-01-13 22:12:54 +00:00
|
|
|
// CraftBukkit start
|
2020-08-25 02:22:08 +00:00
|
|
|
- return findPortal(blockposition, flag ? 16 : 128); // Search Radius
|
|
|
|
+ return findPortal(blockposition, flag ? world.paperConfig.portalCreateRadius : world.paperConfig.portalSearchRadius); // Paper - search Radius
|
2020-01-13 22:12:54 +00:00
|
|
|
}
|
|
|
|
|
2020-08-25 02:22:08 +00:00
|
|
|
public Optional<BlockUtil.Rectangle> findPortal(BlockPosition blockposition, int i) {
|