Skip to content

KubeJS Example Library ​

Default version Minecraft 1.21.1 / MBD2 21.1.1

Copyable script files. Unless a snippet carries a legacy badge, it was executed against MBD2 21.1.1, KubeJS 2101.7.2-build.226 and LDLib2 2.2.39.a — not only read off the source.

ExampleWhat it teachesScript stage
Minimal complete machineRegister a recipe type, a base machine and a recipeStartup + Server
Recipe cookbookBuilt-in content, chance, per-tick IO, recipe dataServer
Conditions and routingConditions, slotName and uiNameServer
Machine eventsInteraction, states, multiblocks, lifecycle hooksServer / Client
Traits and custom dataItem, fluid and FE access, persistent NBT, runtime valuesServer
UI behaviourUIElement queries and server listenersServer / Client
Runtime recipe modificationUpgrades, duration and recipe copiesServer
Mod integrationsCreate, Mekanism, PNC, Nature's Aura, Ars NouveauServer
1.20.1 migrationMap legacy APIs to current onesMigration

Debugging order

  1. logs/kubejs/startup.log — registry scripts. A failure here means no recipe schema exists.
  2. Restart. /reload cannot recreate registries.
  3. logs/kubejs/server.log — recipe and event scripts. The line Added N recipes … with X failed recipes is the one to read.

Legacy Discord and old-wiki examples are treated as requirements input only. Methods absent from current source are listed on the migration page, never presented as runnable code.

Released under the MIT License.