Zones
A ZoneDef is a named AABB in a dimension that fires a callback when a player enters it. ZoneManager ticks the registered zones, tracking each player’s current zone so callbacks fire on entry (the first frame inside) and not every tick while they’re standing inside. Both the hub-pad walk-in and arena-side lobby zones route through this — anything that needs “player walked into this region” is a ZoneDef.
(Historically LobbyZoneDef / LobbyZoneManager; renamed in v2 Phase B because the type is fundamentally a prefab-level concern, not arena-specific.)
When to use it
Section titled “When to use it”- You want a callback the first frame a player enters a region.
- You’re building a teleport pad or trigger plate.
- You want a scene to auto-register / unregister its zones on tear-down.
package me.zlex.conduit.prefab;
public record ZoneDef( ResourceKey<Level> dimension, AABB aabb, Consumer<ServerPlayer> onEntry) {}
public final class ZoneManager { public static void init(); // call once from your ModInitializer
public static void register(ZoneDef zone); public static boolean unregister(ZoneDef zone);}Example
Section titled “Example”import me.zlex.conduit.prefab.ZoneDef;import me.zlex.conduit.prefab.ZoneManager;import me.zlex.conduit.teleport.SafeTeleport;import net.minecraft.core.registries.Registries;import net.minecraft.resources.Identifier;import net.minecraft.resources.ResourceKey;import net.minecraft.server.level.ServerLevel;import net.minecraft.world.level.Level;import net.minecraft.world.phys.AABB;import net.minecraft.world.phys.Vec3;
public final class HubReturnPad {
public static void register(ServerLevel arena) { AABB pad = new AABB(-1, 100, -1, 1, 102, 1); ResourceKey<Level> dim = arena.dimension();
ZoneManager.register(new ZoneDef(dim, pad, p -> { ServerLevel hub = p.server.getLevel( me.zlex.conduit.instance.HubManager.HUB); SafeTeleport.teleport(p, hub, new Vec3(0.5, 101, 0.5)); })); }}- Callbacks fire only on the first tick a player enters the zone, not every tick they’re inside. Tracking is per-player, per-zone.
unregisterreturns whether the zone was present. Players currently inside are not re-evaluated until they cross any zone boundary.- Players that disconnect get their tracking entry dropped automatically — no leaks.