2020-05-06 11:48:49 +02:00
|
|
|
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
|
2021-01-11 02:44:06 +01:00
|
|
|
index 416a6760883cb40367535c7c5acd779742bb8af5..670efbe53241a0ae32d618c83da601ccc1f26e37 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
|
2021-01-11 02:44:06 +01:00
|
|
|
@@ -196,4 +196,13 @@ 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;
|
2021-01-11 02:44:06 +01:00
|
|
|
+ public boolean portalSearchVanillaDimensionScaling;
|
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);
|
2021-01-11 02:44:06 +01:00
|
|
|
+ portalSearchVanillaDimensionScaling = getBoolean("portal-search-vanilla-dimension-scaling", true);
|
2019-04-26 03:24:00 +02:00
|
|
|
+ }
|
|
|
|
}
|
2021-03-16 08:19:45 +01:00
|
|
|
diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java
|
|
|
|
index 10cbf66f06b31c9a4cae2359b3fbb9988abb9278..40eb6bae8ca4e2b57d4f91547808eb00ac1fd455 100644
|
|
|
|
--- a/src/main/java/net/minecraft/world/entity/Entity.java
|
|
|
|
+++ b/src/main/java/net/minecraft/world/entity/Entity.java
|
|
|
|
@@ -2613,7 +2613,13 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, ne
|
2020-08-25 04:22:08 +02: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 22:43:50 +01:00
|
|
|
// CraftBukkit start
|
2020-08-25 04:22:08 +02:00
|
|
|
- CraftPortalEvent event = callPortalEvent(this, worldserver, blockposition, PlayerTeleportEvent.TeleportCause.NETHER_PORTAL, flag2 ? 16 : 128, 16);
|
2021-01-11 02:44:06 +01:00
|
|
|
+ // Paper start
|
|
|
|
+ int portalSearchRadius = worldserver.paperConfig.portalSearchRadius;
|
|
|
|
+ if (world.paperConfig.portalSearchVanillaDimensionScaling && flag2) { // == THE_NETHER
|
|
|
|
+ portalSearchRadius = (int) (portalSearchRadius / worldserver.getDimensionManager().getCoordinateScale());
|
|
|
|
+ }
|
|
|
|
+ // Paper end
|
|
|
|
+ CraftPortalEvent event = callPortalEvent(this, worldserver, blockposition, PlayerTeleportEvent.TeleportCause.NETHER_PORTAL, portalSearchRadius, worldserver.paperConfig.portalCreateRadius); // Paper start - configurable portal radius
|
2020-01-14 22:43:50 +01:00
|
|
|
if (event == null) {
|
|
|
|
return null;
|
|
|
|
}
|
2021-03-16 08:19:45 +01:00
|
|
|
diff --git a/src/main/java/net/minecraft/world/level/portal/PortalTravelAgent.java b/src/main/java/net/minecraft/world/level/portal/PortalTravelAgent.java
|
|
|
|
index 7b8e8a7dae47ecc42a57e3f9444caa2ee5b1ef3b..77dfa7eaf178baa55041a829c9dec4851efeedfc 100644
|
|
|
|
--- a/src/main/java/net/minecraft/world/level/portal/PortalTravelAgent.java
|
|
|
|
+++ b/src/main/java/net/minecraft/world/level/portal/PortalTravelAgent.java
|
|
|
|
@@ -31,7 +31,7 @@ public class PortalTravelAgent {
|
2020-08-25 04:22:08 +02:00
|
|
|
|
|
|
|
public Optional<BlockUtil.Rectangle> findPortal(BlockPosition blockposition, boolean flag) {
|
2020-01-13 23:12:54 +01:00
|
|
|
// CraftBukkit start
|
2020-08-25 04:22:08 +02: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 23:12:54 +01:00
|
|
|
}
|
|
|
|
|
2020-08-25 04:22:08 +02:00
|
|
|
public Optional<BlockUtil.Rectangle> findPortal(BlockPosition blockposition, int i) {
|