Shared teleport deadline

- Give primary world routing and Iris Vision teleports the 120 second first-chunk deadline /iris tp uses
This commit is contained in:
Brian Neumann-Fopiano committed 2026-09-29 07:13:27 -04:00
1 parent 96a400b585
commit f55fde17d4
6 files changed
+145 -9

No files matched your search

@@ -29,7 +29,6 @@ import java.util.ArrayList;
import java.util.List;
import java.util.Set;
import java.util.UUID;
import java.util.concurrent.TimeUnit;
import java.util.concurrent.CompletableFuture;
import java.util.concurrent.ConcurrentHashMap;
@@ -124,7 +123,7 @@ public final class ModdedPrimaryWorldRouter {
try {
CompletableFuture<Boolean> teleport = NativeWorldTeleport.teleport(player,
new NativeWorldTeleport.Destination(server, target, player.x(), Double.MIN_VALUE, player.z(),
System.nanoTime() + TimeUnit.SECONDS.toNanos(10)));
ModdedTeleportDeadline.fromNow()));
teleport.whenComplete((success, failure) -> {
inFlight.remove(id);
if (Boolean.TRUE.equals(success) && failure == null) {
@@ -0,0 +1,37 @@
/*
* Iris is a World Generator for Minecraft Servers
* Copyright (c) 2026 Arcane Arts (Volmit Software)
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
package art.arcane.iris.modded;
import java.util.concurrent.TimeUnit;
/**
* Deadline for a teleport that waits on its destination chunk. The first chunk of a cold dimension also loads the
* pack and binds the engine; the deadline only bounds a destination whose chunk never completes (a refusing
* generator or a removed dimension).
*/
public final class ModdedTeleportDeadline {
private static final long DEADLINE_SECONDS = 120L;
private ModdedTeleportDeadline() {
}
public static long fromNow() {
return System.nanoTime() + TimeUnit.SECONDS.toNanos(DEADLINE_SECONDS);
}
}
@@ -36,6 +36,7 @@ import art.arcane.iris.modded.ModdedEngineBootstrap;
import art.arcane.iris.modded.ModdedForcedDatapack;
import art.arcane.volmlib.nativelib.minecraft26_2.modded.NativeModdedLoader;
import art.arcane.iris.modded.ModdedScheduler;
import art.arcane.iris.modded.ModdedTeleportDeadline;
import art.arcane.iris.modded.ModdedWorldgenIds;
import art.arcane.iris.spi.IrisLogging;
import art.arcane.volmlib.util.collection.KMap;
@@ -67,9 +68,6 @@ import art.arcane.volmlib.util.localization.MessageArgument;
public final class IrisModdedCommands {
private static final long DOWNLOAD_SHUTDOWN_POLL_SECONDS = 15L;
// The first chunk of a cold dimension also loads the pack and binds the engine; the deadline only bounds a
// destination whose chunk never completes (a refusing generator or a removed dimension).
private static final long TELEPORT_DEADLINE_SECONDS = 120L;
private static final Object DOWNLOAD_MONITOR = new Object();
static final SuggestionProvider<NativeCommandSource> PACK_NAMES = ModdedCommandSuggestions.PACK_NAMES;
@@ -137,7 +135,7 @@ public final class IrisModdedCommands {
NativeModdedServer server = source.server();
CompletableFuture<Boolean> teleport = NativeWorldTeleport.teleport(player, new NativeWorldTeleport.Destination(
server, ModdedDimensionManager.level(server, dimensionId), 8.5D, Double.MIN_VALUE, 8.5D,
System.nanoTime() + TimeUnit.SECONDS.toNanos(TELEPORT_DEADLINE_SECONDS)));
ModdedTeleportDeadline.fromNow()));
teleport.whenComplete((success, failure) -> {
if (Boolean.TRUE.equals(success) && failure == null) {
return;
@@ -25,6 +25,7 @@ import art.arcane.iris.generation.runtime.IrisComplex;
import art.arcane.iris.generation.runtime.Engine;
import art.arcane.iris.studio.render.RenderType;
import art.arcane.iris.modded.ModdedIrisLog;
import art.arcane.iris.modded.ModdedTeleportDeadline;
import java.awt.Desktop;
import java.io.File;
@@ -32,7 +33,6 @@ import java.util.List;
import java.util.Optional;
import art.arcane.volmlib.nativelib.view.WorldView;
import java.util.UUID;
import java.util.concurrent.TimeUnit;
import java.util.function.Consumer;
public final class ModdedVisionOverlay implements GuiOverlay {
@@ -63,8 +63,7 @@ public final class ModdedVisionOverlay implements GuiOverlay {
world.execute(() -> {
int surfaceY = engine.getMinHeight() + engine.getHeight(blockX, blockZ, false) + 2;
Optional<WorldView.TeleportOperation> operation = world.teleport(opener,
new WorldView.Destination(blockX + 0.5D, surfaceY, blockZ + 0.5D,
System.nanoTime() + TimeUnit.SECONDS.toNanos(10L)));
new WorldView.Destination(blockX + 0.5D, surfaceY, blockZ + 0.5D, ModdedTeleportDeadline.fromNow()));
if (operation.isEmpty()) {
return;
}