From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 From: Joseph Hirschfeld 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 21b1430b9565e87ac052bc75ba013cf94176d6c9..d05dd815900dbdc78d1315eb13212d4e7cdf04d9 100644 --- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java +++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java @@ -247,4 +247,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 e9b8d4add28a8ba11eae057740c0cf057e414da2..d10ae40d5999e3ea24df55465248004a1b98a287 100644 --- a/src/main/java/net/minecraft/world/entity/Entity.java +++ b/src/main/java/net/minecraft/world/entity/Entity.java @@ -2917,7 +2917,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 2f9ce2a5d187bbaf55f2599998aad357dac72ecc..05150fbade1d5a9b3b6de8ad1f5e825f34d1037e 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 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 findPortalAround(BlockPos blockposition, WorldBorder worldborder, int i) {