Skip to content

LoreSchaeffer/NBTRecipes

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

NBTRecipes

modrinth spigotmc hangar curseforge

Plugin designed to simplify creation of custom recipes, without the need writing any code or touching data-packs. You can attach common metadata (amount, name, lore) as well as NBT tags to items processed by the recipes. Format is very similar to the one used by data-packs.


Usage

You can place your recipes inside the recipes folder, or any sub-folder within this directory. Plugin automatically search them recursively and add their relative path to the recipe key.

To add a new recipe just create a text file with the .json extension and edit it using a text editor of your choice. Functional examples can be found in the Examples section.

1.1. Config

In the config you can change the namespace of your recipes and all the messages of the plugin. The namespace can only contain the following characters: a-z, 0-9, _, -, /.

Legacy formatting (&, §) is deprecated and planned to be removed in the future. Please use MiniMessage instead.

1.2. Commands

  • /nbtrecipes reload - Reloads the recipes and the config file.
    • nbtr.command Permission needed to use the command.
  • /nbtrecipes list - Lists all the recipes added by this plugin.
    • nbtr.command Permission needed to use the command.

Plugin Components

Description of recipe components and their capabilities.

2.1. Item

Item is an object that represents an item in the recipes. It can be used as an ingredient, input or as a result. Majority of fields are optional; in fact, the only one required is the material.

2.2. Tag

Tags, specifically material tags, may be described as groups of materials. They're an actual vanilla feature and are commonly referenced in various parts of the game.

They can be used in all ingredient or input slots, but cannot be mixed together with different choice types. When the input field of a smelting recipe is set to tag mincraft:boats and result is set to coal_block, this allows all types of boats to be smelted into a block of coal.

Please note that some tags, including those added or modified by datapacks, may not work due to API limitations.

2.3. Choice

Choice represents set of items or a tag, which can be used in a specific ingredient or input slot.

Most ingredient or input slots are expected to consist of exactly one choice, which, if not tag, can be an array with multiple elements but keep in mind some recipe types may accept an array of choices.

Please refer to Examples section below for more details.

2.3.1. Item(s) Choice

Can be used to select individual items, or multiple items defined as an array. If no elements have metadata specified (nbt, name, lore), the recipe will compare items based on their material.

"input": { "material": "minecraft:iron_axe", "nbt": "{Damage:157}" }
"input": [
  { "material": "minecraft:stone" },
  { "material": "minecraft:cobblestone" }
]

2.3.2. Tag Choice

Can be used to select individual group of items. Recipe will compare items based on their material.

"input": { "tag": "minecraft:boats" }

2.4. Discover Trigger

Recipe discover trigger can make any recipe discoverable by players when they pick up an item. This feature is optional and if left unspecified, the recipe will be automatically discovered and visible by default.

Please refer to Examples section below for more details.


Examples

Collection of JSON examples for each supported recipe type.

3.1. Shaped Recipe

Shaped recipe applies to crafting table and inventory crafting.

JSON EXAMPLE
{
  "type": "crafting_shaped",
  // Crafting pattern. Array must consist of either:
  // - two, two-character elements reflecting an inventory crafting grid.
  // - three, three-character elements reflecting a crafting table grid.
  "pattern": [
    "  D",
    " D ",
    "S  "
  ],
  // Key to the pattern.
  // Each character must be mapped to exactly one recipe choice, which can be an array with multiple elements.
  "key": {
    "S": [
      { "material": "stick" },
      { "material": "blaze_rod" }
    ],
    "D": { "material": "diamond" }
  },
  // Recipe result.
  "result": {
    "material": "diamond_sword",
    "amount": 1,
    "name": "Diagonally Crafted Diamond Sword",
    "lore": [
      "As the name suggests..."
    ],
    "nbt": "{CustomModelData: 2}"
  },
  // Recipe discover trigger. Optional.
  "discover": {
    // Items that discovers the recipe. List of recipe choices. Each choice can be an array with multiple elements.
    "items": [
      { "material": "diamond" }
    ]
  }
}

3.2. Shapeless Recipe

Shapeless recipe applies to crafting table and inventory crafting.

JSON EXAMPLE
{
  "type": "crafting_shapeless",
  // Crafting ingredients. List of recipe choices. Each choice can be an array with multiple elements.
  "ingredients": [
    { "tag": "minecraft:logs" },
    { "material": "flint_and_steel" }
  ],
  // Recipe result.
  "result": { "material": "charcoal" },
  // Recipe discover trigger. Optional.
  "discover": {
    // Items that discovers the recipe. List of recipe choices. Each choice can be an array with multiple elements.
    "items": [
      { "tag": "minecraft:logs" },
      { "material": "flint_and_steel" },
    ]
  }
}

3.3. Smelting Recipes

Smelting recipes can be applied to regular furnace, blast furnace, smoker or campfire.

JSON EXAMPLE
{
  // Recipe type. For furnace recipes you can use one of: [SMELTING, BLASTING, SMOKING, CAMPFIRE_COOKING]
  "type": "smelting",
  // Furnace input. Exactly one recipe choice, which can be an array with multiple elements.
  "input": [
    { "material": "diamond_helmet" },
    { "material": "diamond_chestplate" },
    { "material": "diamond_leggings" },
    { "material": "diamond_boots" }
  ],
  // Recipe result.
  "result": { "material": "diamond" },
  // Experience to award player after taking smelting result. Optional.
  "experience": 0.7,
  // Time it takes to cook this recipe. Measured in ticks. Optional.
  "cooking_time": 200,
  // Recipe discover trigger. Optional.
  "discover": {
    // Items that discovers the recipe. List of recipe choices. Each choice can be an array with multiple elements.
    "items": [
      { "material": "diamond_helmet" },
      { "material": "diamond_chestplate" },
      { "material": "diamond_leggings" },
      { "material": "diamond_boots" }
    ]
  }
}

All furnace recipe types follow the same schema.

3.4. Smithing Recipe

Smithing recipe applies to smithing table.

JSON EXAMPLE
{
  "type": "smithing",
  // Base item, you can think of it as an item which upgrades (could) be applied to.
  // Exactly one recipe choice. Can be an array with multiple elements.
  "base": { "material": "iron_pickaxe" },
  // Template item, you can think of it as an upgrade which is applied to the base item. Requires 1.20 or higher.
  // Exactly one recipe choice. Can be an array with multiple elements.
  "template": { "material": "air" },
  // Addition item. For vanilla recipes, it's usually a trim material.
  // Exactly one recipe choice. Can be an array with multiple elements.
  "addition": { "material": "diamond" },
  // Recipe result. Metadata is not supported as it's copied directly from the base item.
  "result": { "material": "diamond_pickaxe" },
  // Recipe discover trigger. Optional.
  "discover": {
    // Items that discovers the recipe. List of recipe choices. Each choice can be an array with multiple elements.
    "items": [
      { "material": "iron_pickaxe" }
    ]
  }
}

Metadata (name, lore, nbt) is not supported for result items, as it's copied directly from the base item.

3.5. Stonecutting Recipe

Stonecutting recipe applies to stonecutter.

JSON EXAMPLE
{
  "type": "stonecutting",
  // Recipe input. Exactly one recipe choice, which can be an array with multiple elements.
  "input": { "material": "oak_planks" },
  // Recipe result.
  "result": { "material": "oak_stairs" },
  // Recipe discover trigger. Optional.
  "discover": {
    // Items that discovers the recipe. List of recipe choices. Each choice can be an array with multiple elements.
    "items": [
      { "material": "oak_planks" }
    ]
  }
}

Contributing

To contribute to this repository just fork this repository make your changes or add your code and make a pull request. If you find an error or a bug you can open an issue here.


License

NBTRecipes is released under "The 3-Clause BSD License". You can find a copy here.

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages