| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
| Name | Name | Last commit date | ||
|---|---|---|---|---|
Load JavaScript packages from books in chests on a Minecraft server.
This will create a headless Minecraft client, join the configured server, and open a chest to look for signed books.
Huge shoutout to the authors of minecraft-protocol and Prismarine. Their work lets this simply stitch together some packages and patch a resolution quirk. 💙
in-game: Login to an offline mode Minecraft server (any version supported by minecraft-data)
in-game: Write your code in a book and quill
Note The first line of the first page should be a semver string
Note > imported packages will be loaded relative to the last on-disk module
e.g. if example.mjs imports minecraft:helloer, any import in helloer will be loaded as if you were in example.mjs.
This could look something like:
in-game: Sign your book and quill with the package name as the title
in-game: Place your book, with any others, in a chest
Configure your shell's environment with the correct variables following .env.example.
Put together a consuming script locally (see example.mjs)
// example.mjs
import * as helloer from 'minecraft:helloer';
console.log(helloer);
console.log(helloer.getWelcome('Cooper'));
console.log(helloer.getDatedWelcome('Cooper'));Run script with the --loader flag
$ node --loader ./dist/loader.mjs example.mjs
[Module: null prototype] {
getDatedWelcome: [Function: getDatedWelcome],
getWelcome: [Function: getWelcome]
}
Hi, Cooper
Welcome to 2023, Cooper!| Back | FazBrowse Home | New Git URL |