Gameplay
Script the world
Use sandboxed JavaScript and the minestom bridge to turn content into a game.
A minimal entrypoint
javascript
import { on, onServerStart } from "ae2/stdlib/events";
onServerStart(() => {
minestom.world.setTime(1000);
console.log("game ready");
});
on("playerJoin", ({ uuid, username }) => {
minestom.players.teleport(uuid, { x: 0, y: 42, z: 0 });
minestom.players.showTitle(uuid, "Welcome", username);
});Scripts run as ES modules in a GraalJS sandbox. The injected minestom bridge exposes deliberate game primitives without Node.js filesystem or network access.
Events and behaviors
Subscribe to player, entity, block, item, projectile, region, quest, UI, and world-time events. Put global orchestration in scripts and resource-specific rules in behaviors.
javascript
// behaviors/items/grappling_hook.js
import { events, on } from "ae2/stdlib/behavior";
on(events.ITEM_USE, ({ player }) => {
minestom.projectiles.shoot(player.uuid, "minecraft:arrow", {
speed: 2.4,
gravity: false,
});
});State and schedules
Use ordinary module state for one script context and minestom.store() for small scalar values shared across the main script and behavior contexts. Schedules use server ticks: 20 ticks is one second.