2021-06-11 14:02:28 +02:00
|
|
|
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
|
2022-06-06 02:17:27 +02:00
|
|
|
index 567bad50508870001c3337bf109a407b6b4cde0e..66dd2ebda5692157e397f7ddafd96a492e53c9e9 100644
|
2021-06-11 14:02:28 +02:00
|
|
|
--- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
|
|
|
|
+++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
|
2022-06-06 02:17:27 +02:00
|
|
|
@@ -252,4 +252,13 @@ public class PaperWorldConfig {
|
2021-06-11 14:02:28 +02:00
|
|
|
private void allChunksAreSlimeChunks() {
|
|
|
|
allChunksAreSlimeChunks = getBoolean("all-chunks-are-slime-chunks", false);
|
|
|
|
}
|
|
|
|
+
|
|
|
|
+ public int portalSearchRadius;
|
|
|
|
+ public int portalCreateRadius;
|
|
|
|
+ public boolean portalSearchVanillaDimensionScaling;
|
|
|
|
+ private void portalSearchRadius() {
|
|
|
|
+ portalSearchRadius = getInt("portal-search-radius", 128);
|
|
|
|
+ portalCreateRadius = getInt("portal-create-radius", 16);
|
|
|
|
+ portalSearchVanillaDimensionScaling = getBoolean("portal-search-vanilla-dimension-scaling", true);
|
|
|
|
+ }
|
|
|
|
}
|
|
|
|
diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java
|
2022-06-07 21:15:06 +02:00
|
|
|
index 51475d726004b857e0fbaffa9df2c777c2942071..d6bf1d3356a8894cdeacac270d96d7ea07c79879 100644
|
2021-06-11 14:02:28 +02:00
|
|
|
--- a/src/main/java/net/minecraft/world/entity/Entity.java
|
|
|
|
+++ b/src/main/java/net/minecraft/world/entity/Entity.java
|
2022-06-07 21:15:06 +02:00
|
|
|
@@ -2940,7 +2940,13 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource {
|
2021-11-23 13:15:10 +01:00
|
|
|
double d0 = DimensionType.getTeleportationScale(this.level.dimensionType(), destination.dimensionType());
|
|
|
|
BlockPos blockposition = worldborder.clampToBounds(this.getX() * d0, this.getY(), this.getZ() * d0);
|
2021-06-11 14:02:28 +02:00
|
|
|
// CraftBukkit start
|
2021-06-12 02:57:04 +02:00
|
|
|
- CraftPortalEvent event = this.callPortalEvent(this, destination, blockposition, PlayerTeleportEvent.TeleportCause.NETHER_PORTAL, flag2 ? 16 : 128, 16);
|
2021-06-11 14:02:28 +02:00
|
|
|
+ // Paper start
|
|
|
|
+ int portalSearchRadius = destination.paperConfig.portalSearchRadius;
|
|
|
|
+ if (level.paperConfig.portalSearchVanillaDimensionScaling && flag2) { // == THE_NETHER
|
|
|
|
+ portalSearchRadius = (int) (portalSearchRadius / destination.dimensionType().coordinateScale());
|
|
|
|
+ }
|
|
|
|
+ // Paper end
|
2021-06-12 02:57:04 +02:00
|
|
|
+ CraftPortalEvent event = this.callPortalEvent(this, destination, blockposition, PlayerTeleportEvent.TeleportCause.NETHER_PORTAL, portalSearchRadius, destination.paperConfig.portalCreateRadius); // Paper start - configurable portal radius
|
2021-06-11 14:02:28 +02:00
|
|
|
if (event == null) {
|
|
|
|
return null;
|
|
|
|
}
|
|
|
|
diff --git a/src/main/java/net/minecraft/world/level/portal/PortalForcer.java b/src/main/java/net/minecraft/world/level/portal/PortalForcer.java
|
2022-06-07 21:15:06 +02:00
|
|
|
index bb05ea288432ece497957c3503c3435655ce8997..8672545ba07205ef362442e1342f2ee5281f62cb 100644
|
2021-06-11 14:02:28 +02:00
|
|
|
--- a/src/main/java/net/minecraft/world/level/portal/PortalForcer.java
|
|
|
|
+++ b/src/main/java/net/minecraft/world/level/portal/PortalForcer.java
|
2021-11-23 13:15:10 +01:00
|
|
|
@@ -43,7 +43,7 @@ public class PortalForcer {
|
2021-06-11 14:02:28 +02:00
|
|
|
|
2021-11-24 23:26:32 +01:00
|
|
|
public Optional<BlockUtil.FoundRectangle> findPortalAround(BlockPos pos, boolean destIsNether, WorldBorder worldBorder) {
|
2021-06-11 14:02:28 +02:00
|
|
|
// CraftBukkit start
|
2021-11-24 23:26:32 +01:00
|
|
|
- return this.findPortalAround(pos, worldBorder, destIsNether ? 16 : 128); // Search Radius
|
|
|
|
+ return this.findPortalAround(pos, worldBorder, destIsNether ? level.paperConfig.portalCreateRadius : level.paperConfig.portalSearchRadius); // Search Radius // Paper - search Radius
|
2021-06-11 14:02:28 +02:00
|
|
|
}
|
|
|
|
|
2021-11-23 13:15:10 +01:00
|
|
|
public Optional<BlockUtil.FoundRectangle> findPortalAround(BlockPos blockposition, WorldBorder worldborder, int i) {
|