2024-06-13 19:12:48 +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/net/minecraft/world/level/block/NetherPortalBlock.java b/src/main/java/net/minecraft/world/level/block/NetherPortalBlock.java
|
2024-12-03 18:27:11 +01:00
|
|
|
index 6bdee85d11b86e618172089c8f9390b6071511ef..a8cb0d5019d06de64b2cc30e6830bbd6ad43a155 100644
|
2024-06-13 19:12:48 +02:00
|
|
|
--- a/src/main/java/net/minecraft/world/level/block/NetherPortalBlock.java
|
|
|
|
+++ b/src/main/java/net/minecraft/world/level/block/NetherPortalBlock.java
|
2024-10-22 20:04:31 +02:00
|
|
|
@@ -145,8 +145,14 @@ public class NetherPortalBlock extends Block implements Portal {
|
2024-06-13 19:12:48 +02:00
|
|
|
WorldBorder worldborder = worldserver1.getWorldBorder();
|
|
|
|
double d0 = DimensionType.getTeleportationScale(world.dimensionType(), worldserver1.dimensionType());
|
|
|
|
BlockPos blockposition1 = worldborder.clampToBounds(entity.getX() * d0, entity.getY(), entity.getZ() * d0);
|
|
|
|
+ // Paper start - Configurable portal search radius
|
|
|
|
+ int portalSearchRadius = worldserver1.paperConfig().environment.portalSearchRadius;
|
|
|
|
+ if (entity.level().paperConfig().environment.portalSearchVanillaDimensionScaling && flag) { // flag = is going to nether
|
|
|
|
+ portalSearchRadius = (int) (portalSearchRadius / worldserver1.dimensionType().coordinateScale());
|
|
|
|
+ }
|
|
|
|
+ // Paper end - Configurable portal search radius
|
|
|
|
// CraftBukkit start
|
|
|
|
- CraftPortalEvent event = entity.callPortalEvent(entity, CraftLocation.toBukkit(blockposition1, worldserver1.getWorld()), PlayerTeleportEvent.TeleportCause.NETHER_PORTAL, flag ? 16 : 128, 16);
|
2024-08-16 22:59:46 +02:00
|
|
|
+ CraftPortalEvent event = entity.callPortalEvent(entity, CraftLocation.toBukkit(blockposition1, worldserver1.getWorld()), PlayerTeleportEvent.TeleportCause.NETHER_PORTAL, portalSearchRadius, worldserver1.paperConfig().environment.portalCreateRadius); // Paper - use custom portal search radius
|
2024-06-13 19:12:48 +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
|
2024-10-22 20:04:31 +02:00
|
|
|
index 355f1ce10f9564c7c0be505a5af849e0428fec17..eb409fb5e673d2a343813946cc59cb5da2328eec 100644
|
2024-06-13 19:12:48 +02:00
|
|
|
--- a/src/main/java/net/minecraft/world/level/portal/PortalForcer.java
|
|
|
|
+++ b/src/main/java/net/minecraft/world/level/portal/PortalForcer.java
|
|
|
|
@@ -42,6 +42,7 @@ public class PortalForcer {
|
|
|
|
this.level = world;
|
|
|
|
}
|
|
|
|
|
|
|
|
+ @io.papermc.paper.annotation.DoNotUse // Paper
|
|
|
|
public Optional<BlockPos> findClosestPortalPosition(BlockPos pos, boolean destIsNether, WorldBorder worldBorder) {
|
|
|
|
// CraftBukkit start
|
|
|
|
return this.findClosestPortalPosition(pos, worldBorder, destIsNether ? 16 : 128); // Search Radius
|