// core/events.js; central place/break dispatch. import { world } from "./mc.js"; const placeHandlers = []; const breakHandlers = []; export function onPlace(fn) { placeHandlers.push(fn); } export function onBreak(fn) { breakHandlers.push(fn); } world.afterEvents.playerPlaceBlock?.subscribe((ev) => { for (const fn of placeHandlers) { try { fn(ev); } catch {} } }); world.afterEvents.playerBreakBlock?.subscribe((ev) => { for (const fn of breakHandlers) { try { fn(ev); } catch {} } });