56 lines
3.7 KiB
Diff
56 lines
3.7 KiB
Diff
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
|
|
index 567bad50508870001c3337bf109a407b6b4cde0e..66dd2ebda5692157e397f7ddafd96a492e53c9e9 100644
|
|
--- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
|
|
+++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
|
|
@@ -252,4 +252,13 @@ public class PaperWorldConfig {
|
|
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
|
|
index 51475d726004b857e0fbaffa9df2c777c2942071..d6bf1d3356a8894cdeacac270d96d7ea07c79879 100644
|
|
--- a/src/main/java/net/minecraft/world/entity/Entity.java
|
|
+++ b/src/main/java/net/minecraft/world/entity/Entity.java
|
|
@@ -2940,7 +2940,13 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource {
|
|
double d0 = DimensionType.getTeleportationScale(this.level.dimensionType(), destination.dimensionType());
|
|
BlockPos blockposition = worldborder.clampToBounds(this.getX() * d0, this.getY(), this.getZ() * d0);
|
|
// CraftBukkit start
|
|
- CraftPortalEvent event = this.callPortalEvent(this, destination, blockposition, PlayerTeleportEvent.TeleportCause.NETHER_PORTAL, flag2 ? 16 : 128, 16);
|
|
+ // Paper start
|
|
+ int portalSearchRadius = destination.paperConfig.portalSearchRadius;
|
|
+ if (level.paperConfig.portalSearchVanillaDimensionScaling && flag2) { // == THE_NETHER
|
|
+ portalSearchRadius = (int) (portalSearchRadius / destination.dimensionType().coordinateScale());
|
|
+ }
|
|
+ // Paper end
|
|
+ CraftPortalEvent event = this.callPortalEvent(this, destination, blockposition, PlayerTeleportEvent.TeleportCause.NETHER_PORTAL, portalSearchRadius, destination.paperConfig.portalCreateRadius); // Paper start - configurable portal radius
|
|
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
|
|
index bb05ea288432ece497957c3503c3435655ce8997..8672545ba07205ef362442e1342f2ee5281f62cb 100644
|
|
--- a/src/main/java/net/minecraft/world/level/portal/PortalForcer.java
|
|
+++ b/src/main/java/net/minecraft/world/level/portal/PortalForcer.java
|
|
@@ -43,7 +43,7 @@ public class PortalForcer {
|
|
|
|
public Optional<BlockUtil.FoundRectangle> findPortalAround(BlockPos pos, boolean destIsNether, WorldBorder worldBorder) {
|
|
// CraftBukkit start
|
|
- 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
|
|
}
|
|
|
|
public Optional<BlockUtil.FoundRectangle> findPortalAround(BlockPos blockposition, WorldBorder worldborder, int i) {
|