Files

25 lines
685 B
JavaScript

import { log } from "./core/log.js";
import { load } from "./save/state.js";
import { getState } from "./save/state.js";
import "./core/commands.js"
import {world} from "@minecraft/server";
log("main.js loaded)");
/*
Dynamic properties have to exist post worldLoad
1.9 -> 2.0 scripts now load before world load
Grabbed data will throw an exception
if we don't do things after worldLoad
You can't serve a pizza if you don't have a pizza
Players, entities, blocks
Time of day, Gamemode, difficulty
*/
world.afterEvents.worldLoad.subscribe(() => {
load();
console.log(JSON.stringify(getState()));
});
//good for debugging gate values
//console.log(JSON.stringify(getState()));