57 lines
3.8 KiB
Diff
57 lines
3.8 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 84df54523eada327033bb8821a7009df62dc7bca..304883dc18bab3bf4740006a5e6d7c58bab12348 100644
|
|
--- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
|
|
+++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
|
|
@@ -237,4 +237,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 6bc8c8e15e66cd54cbb6ebc6d09a6fe8652b5d18..8161cbd3cfed89bee74209c718d0ceff2b401890 100644
|
|
--- a/src/main/java/net/minecraft/world/entity/Entity.java
|
|
+++ b/src/main/java/net/minecraft/world/entity/Entity.java
|
|
@@ -2939,7 +2939,13 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, i
|
|
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 194465751c351a921100e621a0ef1616c7e5f3fb..80811386c1006d56824ff4d43830f2a140aaee30 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 blockposition, boolean destIsNether, WorldBorder worldborder) {
|
|
// CraftBukkit start
|
|
- return this.findPortalAround(blockposition, worldborder, destIsNether ? 16 : 128); // Search Radius
|
|
+ return this.findPortalAround(blockposition, worldborder, destIsNether ? level.paperConfig.portalCreateRadius : level.paperConfig.portalSearchRadius); // Search Radius // Paper - search Radius
|
|
}
|
|
|
|
public Optional<BlockUtil.FoundRectangle> findPortalAround(BlockPos blockposition, WorldBorder worldborder, int i) {
|