// priority: 1000
ServerEvents.recipes((e) => {
// Perform this operation here to check if
const server = Utils.getServer()
global.WORLD_SEED =
server === null ? -1 : server.worldData.worldGenOptions().seed()
})
ServerEvents.loaded((e) => {
// Reloads the server on the first world load to ensure the world seed is
// available for recipe registration.
if (global.WORLD_SEED === -1) {
e.server.runCommandSilent('reload')
}
})
Pretty straightforward. This script tries to load the world seed into a global, in case you want to use it to seed a PRNG for recipe generation. It does a reload if the server was not loaded yet. This won't double reload when you do /reload though because the server is accessible from that point forward.


