feat(addons): update portal blocks, recipes, and transfer scripts
All checks were successful
Deploy Addons / deploy (push) Successful in 17s
All checks were successful
Deploy Addons / deploy (push) Successful in 17s
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -24,11 +24,33 @@ function doTransfer(player) {
|
||||
recentTransfers.set(player.name, now);
|
||||
world.sendMessage(`§a${player.name} is returning to the Hub...`);
|
||||
|
||||
try {
|
||||
transferPlayer(player, { hostname: LOBBY_HOST, port: LOBBY_PORT });
|
||||
} catch (e) {
|
||||
player.sendMessage(`§cTransfer failed: ${e.message}`);
|
||||
// Teleport player away from return portal before transfer so their saved
|
||||
// position is NOT on the portal (prevents re-transfer loop on lobby arrival)
|
||||
const portalJson = world.getDynamicProperty(PORTAL_PROP);
|
||||
if (portalJson) {
|
||||
try {
|
||||
const portal = JSON.parse(portalJson);
|
||||
const pos = player.location;
|
||||
const dx = Math.abs(pos.x - portal.x);
|
||||
const dz = Math.abs(pos.z - portal.z);
|
||||
// Only teleport if player is near the return portal
|
||||
if (dx <= PORTAL_RADIUS + 1 && dz <= PORTAL_RADIUS + 1) {
|
||||
const safePos = { x: pos.x, y: pos.y, z: pos.z + 4 };
|
||||
player.teleport(safePos);
|
||||
}
|
||||
} catch (e) {
|
||||
// Non-fatal — proceed with transfer anyway
|
||||
}
|
||||
}
|
||||
|
||||
// Wait 5 ticks for position to save, then transfer
|
||||
system.runTimeout(() => {
|
||||
try {
|
||||
transferPlayer(player, { hostname: LOBBY_HOST, port: LOBBY_PORT });
|
||||
} catch (e) {
|
||||
player.sendMessage(`§cTransfer failed: ${e.message}`);
|
||||
}
|
||||
}, 5);
|
||||
}
|
||||
|
||||
// ─── A. Compass Distribution ────────────────────────────────────
|
||||
|
||||
Reference in New Issue
Block a user