2020-04-02 23:07:06 +02:00
|
|
|
From 547ba9b126ab6998513ee8909dc9c4c71f97bfb7 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
|
2020-02-21 18:52:20 +01:00
|
|
|
index 62e793b71b..cd47a4ca06 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
|
2020-01-18 18:28:32 +01:00
|
|
|
@@ -191,4 +191,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;
|
2020-01-18 18:28:32 +01:00
|
|
|
+ public int portalCreateRadius;
|
2019-04-26 03:24:00 +02:00
|
|
|
+ private void portalSearchRadius() {
|
|
|
|
+ portalSearchRadius = getInt("portal-search-radius", 128);
|
2020-01-18 18:28:32 +01:00
|
|
|
+ portalCreateRadius = getInt("portal-create-radius", 16);
|
2019-04-26 03:24:00 +02:00
|
|
|
+ }
|
|
|
|
}
|
2020-01-13 23:12:54 +01:00
|
|
|
diff --git a/src/main/java/net/minecraft/server/Entity.java b/src/main/java/net/minecraft/server/Entity.java
|
2020-04-02 06:43:11 +02:00
|
|
|
index 826202f437..fd708f2f6c 100644
|
2020-01-13 23:12:54 +01:00
|
|
|
--- a/src/main/java/net/minecraft/server/Entity.java
|
|
|
|
+++ b/src/main/java/net/minecraft/server/Entity.java
|
2020-04-02 06:43:11 +02:00
|
|
|
@@ -2578,7 +2578,7 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, Ke
|
2020-01-13 23:12:54 +01:00
|
|
|
|
2020-01-14 22:43:50 +01:00
|
|
|
blockposition = new BlockPosition(d0, this.locY(), d1);
|
|
|
|
// CraftBukkit start
|
|
|
|
- EntityPortalEvent event = CraftEventFactory.callEntityPortalEvent(this, worldserver1, blockposition, 128);
|
|
|
|
+ EntityPortalEvent event = CraftEventFactory.callEntityPortalEvent(this, worldserver1, blockposition, world.paperConfig.portalSearchRadius); // Paper - use portal search radius
|
|
|
|
if (event == null) {
|
|
|
|
return null;
|
|
|
|
}
|
2020-01-18 18:28:32 +01:00
|
|
|
diff --git a/src/main/java/net/minecraft/server/EntityPlayer.java b/src/main/java/net/minecraft/server/EntityPlayer.java
|
2020-02-21 18:52:20 +01:00
|
|
|
index f0f456983f..b5101af011 100644
|
2020-01-18 18:28:32 +01:00
|
|
|
--- a/src/main/java/net/minecraft/server/EntityPlayer.java
|
|
|
|
+++ b/src/main/java/net/minecraft/server/EntityPlayer.java
|
2020-01-28 01:16:53 +01:00
|
|
|
@@ -755,7 +755,9 @@ public class EntityPlayer extends EntityHuman implements ICrafting {
|
2020-01-18 18:28:32 +01:00
|
|
|
// CraftBukkit start
|
|
|
|
Location enter = this.getBukkitEntity().getLocation();
|
|
|
|
Location exit = (worldserver1 == null) ? null : new Location(worldserver1.getWorld(), d0, d1, d2, f1, f);
|
|
|
|
- PlayerPortalEvent event = new PlayerPortalEvent(this.getBukkitEntity(), enter, exit, cause, 128, true, dimensionmanager.getType() == DimensionManager.THE_END ? 0 : 16);
|
|
|
|
+ int configuredSearchRadius = (worldserver1 == null ? worldserver : worldserver1).paperConfig.portalSearchRadius;
|
|
|
|
+ int configuredCreateRadius = (worldserver1 == null ? worldserver : worldserver1).paperConfig.portalCreateRadius;
|
|
|
|
+ PlayerPortalEvent event = new PlayerPortalEvent(this.getBukkitEntity(), enter, exit, cause, configuredSearchRadius, true, dimensionmanager.getType() == DimensionManager.THE_END ? 0 : configuredCreateRadius); // Paper - configurable portal search radius
|
|
|
|
Bukkit.getServer().getPluginManager().callEvent(event);
|
|
|
|
if (event.isCancelled() || event.getTo() == 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
|
2020-02-21 18:52:20 +01:00
|
|
|
index 19c54f1dde..f84dd6d9be 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
|
2020-01-13 23:12:54 +01:00
|
|
|
@@ -45,7 +45,7 @@ public class PortalTravelAgent {
|
|
|
|
@Nullable
|
|
|
|
public ShapeDetector.Shape a(BlockPosition blockposition, Vec3D vec3d, EnumDirection enumdirection, double d0, double d1, boolean flag) { // PAIL: rename to findPortal, d0 = portal offset x, d1 = portal offset z, flag = instanceof EntityHuman
|
|
|
|
// CraftBukkit start
|
|
|
|
- return findPortal(blockposition, vec3d, enumdirection, d0, d1, flag, 128);
|
|
|
|
+ return findPortal(blockposition, vec3d, enumdirection, d0, d1, flag, world.paperConfig.portalSearchRadius); // Paper
|
|
|
|
}
|
|
|
|
|
|
|
|
@Nullable
|
|
|
|
@@ -53,7 +53,7 @@ public class PortalTravelAgent {
|
|
|
|
// CraftBukkit end
|
2019-12-11 01:56:03 +01:00
|
|
|
VillagePlace villageplace = this.world.B();
|
2019-04-26 03:24:00 +02:00
|
|
|
|
2019-12-11 01:56:03 +01:00
|
|
|
- villageplace.a(this.world, blockposition, 128);
|
2020-01-13 23:12:54 +01:00
|
|
|
+ villageplace.a(this.world, blockposition, searchRadius); // Paper - This impacts the # of chunks searched for entries
|
2019-12-11 01:56:03 +01:00
|
|
|
List<VillagePlaceRecord> list = (List) villageplace.b((villageplacetype) -> {
|
|
|
|
return villageplacetype == VillagePlaceType.u;
|
2020-01-13 23:12:54 +01:00
|
|
|
}, blockposition, searchRadius, VillagePlace.Occupancy.ANY).collect(Collectors.toList()); // CraftBukkit - searchRadius
|
2019-04-26 03:24:00 +02:00
|
|
|
--
|
2020-04-02 06:43:11 +02:00
|
|
|
2.25.1
|
2019-04-26 03:24:00 +02:00
|
|
|
|