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-06-30 05:20:29 +00:00
|
|
|
index 9e132052e1a9b997300e3f5d88473fc5f9ebdd73..1a8fc714f6e4663fc02c1df6a67aaa37d48f743d 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-06-30 05:20:29 +00:00
|
|
|
@@ -2508,7 +2508,7 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, Ke
|
2020-01-13 22:12:54 +00:00
|
|
|
|
2020-01-14 21:43:50 +00:00
|
|
|
blockposition = new BlockPosition(d0, this.locY(), d1);
|
|
|
|
// CraftBukkit start
|
2020-06-25 11:00:35 +00:00
|
|
|
- EntityPortalEvent event = CraftEventFactory.callEntityPortalEvent(this, worldserver, blockposition, 128);
|
|
|
|
+ EntityPortalEvent event = CraftEventFactory.callEntityPortalEvent(this, worldserver, blockposition, worldserver.paperConfig.portalSearchRadius); // Paper - use portal search 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-07-22 23:35:44 +00:00
|
|
|
index 5dce27334541d55c7a7d494cd92370570615dc05..2cdb999dd78611e6f72ef06d9128f21a251cb061 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-06-30 05:20:29 +00:00
|
|
|
@@ -815,7 +815,8 @@ public class EntityPlayer extends EntityHuman implements ICrafting {
|
2020-01-18 17:28:32 +00:00
|
|
|
// CraftBukkit start
|
|
|
|
Location enter = this.getBukkitEntity().getLocation();
|
2020-06-25 11:00:35 +00:00
|
|
|
Location exit = (worldserver == null) ? null : new Location(worldserver.getWorld(), d0, d1, d2, f1, f);
|
2020-06-26 01:58:00 +00:00
|
|
|
- PlayerPortalEvent event = new PlayerPortalEvent(this.getBukkitEntity(), enter, exit, cause, 128, true, resourcekey == DimensionManager.THE_END ? 0 : 16);
|
2020-06-28 08:21:40 +00:00
|
|
|
+ com.destroystokyo.paper.PaperWorldConfig config = worldserver != null ? worldserver.paperConfig : worldserver1.paperConfig; // Paper - portal radius
|
|
|
|
+ PlayerPortalEvent event = new PlayerPortalEvent(this.getBukkitEntity(), enter, exit, cause, config.portalSearchRadius, true, resourcekey == DimensionManager.THE_END ? 0 : config.portalCreateRadius); // Paper - portal radius
|
2020-01-18 17:28:32 +00:00
|
|
|
Bukkit.getServer().getPluginManager().callEvent(event);
|
|
|
|
if (event.isCancelled() || event.getTo() == 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-06-25 11:00:35 +00:00
|
|
|
index 8eacfc66dc04bba89c8e1c03746c67068e07718b..f6ec165f9c7d83698100c85b1d4bf6b4cea0f458 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-01-13 22:12:54 +00: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
|
2020-06-25 11:00:35 +00:00
|
|
|
VillagePlace villageplace = this.world.x();
|
2019-04-26 01:24:00 +00:00
|
|
|
|
2019-12-11 00:56:03 +00:00
|
|
|
- villageplace.a(this.world, blockposition, 128);
|
2020-01-13 22:12:54 +00:00
|
|
|
+ villageplace.a(this.world, blockposition, searchRadius); // Paper - This impacts the # of chunks searched for entries
|
2019-12-11 00:56:03 +00:00
|
|
|
List<VillagePlaceRecord> list = (List) villageplace.b((villageplacetype) -> {
|
2020-06-25 11:00:35 +00:00
|
|
|
return villageplacetype == VillagePlaceType.v;
|
2020-01-13 22:12:54 +00:00
|
|
|
}, blockposition, searchRadius, VillagePlace.Occupancy.ANY).collect(Collectors.toList()); // CraftBukkit - searchRadius
|