Code Patterns

Copy-paste examples for common plugin tasks. Commands, events, ECS, GUI, and more.

← Back to Patterns
util

Recipe Data Asset

Define crafting recipes as JSON data assets. Place in src/main/resources/Server/Item/Recipes/

Example Code

java
{
  "Input": [
    {
      "ItemId": "Ingredient_Iron_Ingot",
      "Quantity": 3
    },
    {
      "ItemId": "Resource_Wood_Oak",
      "Quantity": 2
    }
  ],
  "PrimaryOutput": {
    "ItemId": "Tool_Pickaxe_Iron",
    "Quantity": 1
  },
  "SecondaryOutput": null,
  "BenchRequirement": [
    {
      "Id": "Anvil",
      "Type": "Crafting",
      "Categories": ["Tools", "Weapons"]
    }
  ],
  "Seconds": 3
}

Common Mistakes

Wrong ItemId names. Missing BenchRequirement. Forgetting to set IncludesAssetPack: true in manifest.