Vellum GUI

A small web engine for Minecraft GUIs; write them HTML, CSS and JS

Vellum is a small web engine inside Minecraft. Screens, inventories, HUD and map can be expressed as HTML page, and Vellum lays it out, animates it, runs its scripts and draws it with the normal GUI renderer.

You don't need to install this on its own. It's a library: mods that use it list it as a dependency, and launchers install it with them, or bundle it.

The inspiration for Vellum was three-fold:

  1. I'm a web developer and my Minecraft GUIs have always looked bad
  2. LLMs are better at web development than Minecraft GUI development
  3. Updating GUIs across Minecraft versions has always been a pain. With Vellum, your GUIs stay the same and just the library needs to be updated.

Vellum helps in all three cases.

What you get

  • Most of CSS: block, inline, flexbox, grid and positioning, plus transitions and @keyframes. It's a 90-10 solution, not a browser.
  • The game's own look by default. Buttons, text fields, panels, slots and tooltips use vanilla sprites and the game font, so an unstyled page already fits in.
  • Vanilla mechanics where helpful. Put <slot index="0"> wherever you want a slot and it will Just Work(tm) as expected
  • Minecraft specific elements: <item>, <slot>, 3D <scene>, <entity> and <model>, sprites, and translations.
  • JavaScript with Vue-style templates (v-for, v-if, v-model, @click). 
  • HUD overlays, Create-like Ponder scene creation, narration/accessibility support, and a standalone previewer with hot reload, so you (or your agent) can build a page without launching the game.

For mod developers

<div class="mc-panel chest">
  <div class="mc-label">{{ title }}</div>
  <div class="grid"><slot v-for="i in 27" :index="i - 1"></slot></div>
</div>
<style>
  .grid { display: grid; grid-template-columns: repeat(9, 18px); }
</style>

VellumScreens.registerContainer(MyMenus.CHEST, "mymod:vellum/chest.html");
VellumScreens.open("mymod:vellum/journal.html", data).driver()
        .onMessage("save", value -> Journal.save(value.getAsJsonObject()));

It's available from maven.maxleiter.com. Feel free to mark it as a dependency or bundle it with your mod, but bundling is not recommended due to Vellum becoming outdated. 

Docs: API, scripting, porting an existing screen.

Servers

A server mod can open a page on a player's client, push data to it and get messages back. Since a server might be hostile, scripts run in a sandbox with no Java access, no network access, no file access, and sensible resource caps. Players can always close a page with Shift+Esc or block server pages entirely.

 

LLMs were used in the development of Vellum.

Vellum is MIT licensed. It bundles Mozilla Rhino (MPL-2.0) with a few patches, which are in the repo under rhino/patches/.

Vellum GUI Team

profile avatar
  • 3
    Projects
  • 10.2K
    Downloads

More from giraffestock