theme:

Projects archive

This page contains a list of abandoned projects that I worked on in the past.

Giup#

Since I develop my Minecraft mods for multiple Minecraft versions in parallel, I have a lot of different Git branches. When releasing a new version, I have to consecutively merge and build all these branches, handling all issues that arise.

Originally I did this manually, but it became so time-consuming, that I decided to create a custom tool for it.

Giup is a Python script, that consumes a config file and then iteratively merges the branches and performs the correct sequence of commands on the branches. When encountering errors, it allows you to examine the situation and e.g. launch a shell to fix potential issues.

Nbt Crafting and a custom DSL#

One of my biggest Minecraft modding projects was probably bringing so-called NBT data into Minecraft crafting recipes.

Generally Minecraft crafting recipes use a pretty simple JSON format that specifies what items or resources in a certain pattern yield a certain output item.

{
  "type": "mincraft:crafting_shaped",
  "pattern": [" I ", "ISI", " I "],
  "key": {
    "I": { "item":  "minecraft:iron" },
    "S": { "item":  "minecraft:stone_sword" }
  },
  "result": { "item": "minecraft:iron_sword" }
}

A simple crafting recipe in Minecraft's recipe format

While this is mostly enough for the recipes in the base game, in game extensions such as mods or datapacks you often want to create more sophisticated crafting recipes. For example, you may want to upgrade a weapon and still keep its name and existing enchantments.

For the longest time, the base system didn't allow you to define such recipes.

So, in early 2019 I created the mod "Nbt Crafting" which originally just allowed you to define static data to apply to recipe outputs.

The scope of the mod quickly extended to dynamic data, ultimately yielding to a custom DSL (domain specific language) that allowed to define pretty complex crafting behavior.

{
  "type": "crafting_shapeless",
  "ingredients": [
    { "item": "minecraft:diamond_sword" },
    { "item": "minecraft:blaze_rod" }
  ],
  "result": {
    "item": "minecraft:diamond_sword",
    "data": {
      "$": {
        "value": "i0",
        "paths": { "/Enchantments\\[\\d+\\]/": "append" }
      },
      "Enchantments": [
        { "id": "minecraft:fire_aspect", "lvl": 1 }
      ]
    }
  }
}

A more complex crafting recipe using Nbt Crafting.

The DSL underwent several iterations (released and unreleased) which used various approaches for lexing, parsing and evaluating the expressions. In one of these iterations, I played around with using parser generators such as ANTLR. While in most of them I used handwritten parsers.

Because of the big maintenance burden that this mod/ecosystem caused me, I stopped maintaining the mod around the end of 2022.

It still taught me a lot about creating DSLs.