Custom Items: Crafting Recipes (Premium) - BoBoBalloon/InnovativeItemsDOCS GitHub Wiki

Intro

Please keep in mind this section goes over a feature that is only available for the premium version of the plugin...

When creating custom items, you may want your players to obtain custom items in a way that feels more natural, in which case you can create crafting recipes for your items.

Custom items can have as many crafting recipes as you want, however, there are some restrictions.

The first restriction is that if recipes overlap, meaning that multiple recipes share the same input, this can lead to undesired behavior, the plugin does not detect this so it is highly suggested that you remain diligent. The second restriction is that your recipes must not contain the very custom item that would be the result of said recipe and your custom items must not have recipes where two custom items contain each other as their ingredients. This behavior is known as a cycle and if the plugin detects a cycle all items will be parsed without their custom recipes.

Example

blood-blade:
  material: 'DIAMOND_SWORD'
  display-name: '&4&lBlood Blade'
  ability: 'lifesteal' # would only work if you have an ability with the identifier of "lifesteal"
  custom-model-data: 987
  unbreakable: true
  soulbound: true
  max-durability: 10
  lore:
    - ''
    - '&7&oA blade made of the blood of the &4&ogod of war&7&o...'
    - '&7&oLegend says that it was from a paper cut'
  enchantments:
    DAMAGE_ALL: 150
  flags:
    - 'HIDE_ENCHANTS'
    - 'HIDE_ATTRIBUTES'
  attributes:
    ANY:
      GENERIC_MAX_HEALTH: 20
    HAND:
      GENERIC_MAX_HEALTH: 500
      GENERIC_MOVEMENT_SPEED: 50
  recipes: # LOOK HERE
    ThisRecipeNameCouldBeAnything:
      type: 'SHAPED'
      keys:
        - '~S:STICK'
        - 'B:blood-block'
      shape:
        - 'B'
        - 'B'
        - 'S'

blood-block:
  material: 'REDSTONE_BLOCK'
  display-name: '&rBlood Block'
  recipes: # LOOK HERE
    ThisRecipeNameCouldBeAnything:
      type: 'SHAPED'
      keys:
        - '~R:REDSTONE_BLOCK'
        - '~S:NETHER_STAR'
      shape:
        - 'RRR'
        - 'RSR'
        - 'RRR'

Types of Recipes

When we think of crafting recipes we first think of shaped recipes. These are recipes in a crafting grid that have a specific order in which items must be placed to craft the item. However, this is not the only type of recipe. The plugin also supports: furnace recipes, blast furnace recipes, smoker recipes, and campfire recipes. Every time you create a recipe, you must specify the type of recipe as shown in the example above, each type represents these recipes. The names of the types are as shown below:

SHAPED: represents a shaped crafting recipe that either takes place in a crafting table or the survival player inventory
FURNACE: represents a cooking recipe that takes place inside a furnace
BLAST_FURNACE: represents a cooking recipe that takes place inside a blast furnace
SMOKER: represents a cooking recipe that takes place inside a smoker
CAMPFIRE: represents a cooking recipe that is done by placing an item inside a campfire or soul campfire

Shaped Recipes

There are a few requirements for a valid SHAPED recipe, your recipe must contain a keys section. The keys section allows you to create one character variables that represent an ingredient to be used inside your crafting recipe. When writing a key, the name of a custom item will be prioritized over the name of a type of material, if you have a custom item with the same name as a type of material and you wish to use the vanilla material, you can assert that the item you specified was a material by using a tilde (~) at the start of the key. After you specify the name of the variable, you must use a semicolon to separate that from the name of the custom item or material that you wish to use. An example of each are as follows:

keys:
  - 'A:blood-blade' # only works if you have registered a custom item with the name of 'blood-blade'
  - 'B:dirt' # would either be a custom item registered by the name of 'dirt' or if no custom item has that name would be the material dirt
  - '~C:dirt' # the material dirt

You are required to use all keys you register in your recipe, if you have any extra, an error will occur.

Another requirement to create a valid SHAPED recipe includes a shape section that describes the shape of the keys you just registered. The shape must contain all of the keys you registered and must have more than one row but no more than three rows. It must also be rectangular shaped and if a row exists it must at least have one character and no more than three characters. If you could not already tell, this shape represents the crafting grid. If a character is a whitespace character, that represents air, while no character represents nothing, and all the keys you registered represent the items you specified in the keys section. An example of a SHAPED recipe with the keys above are as follows:

ThisRecipeNameCouldBeAnything:
  type: 'SHAPED'
  keys:
    - 'A:blood-blade' # only works if you have registered a custom item with the name of 'blood-blade'
    - 'B:dirt' # would either be a custom item registered by the name of 'dirt' or if no custom item has that name would be the material dirt
    - '~C:dirt' # the material dirt
  shape:
    - '  A'
    - ' B '
    - 'C  '

Cooking Recipes

All cooking recipes have been grouped together in this one section as their requirements are identical. Cooking recipes include: FURNACE, BLAST_FURNACE, SMOKER, CAMPFIRE.

Cooking recipes do not require a keys or shape section however they do require the type section where you provide the type of recipe you would like.

All of the fields of a SHAPED recipe are required but excluding the type field, cooking recipes only have one required field, and that is the key field. Similarly to the keys section, the key field represents what item should be used in the cooking recipe. This field is one item instead of a maximum of nine items, as a result, variable names are not required and the semi-colon is not present either. However, you can still use a tilde to assert that the item you would like is a vanilla material. An example is as follows:

key: '~dirt' # the material dirt

The next two fields we are about to cover are optional, however they are very useful. The first field is the cooking-time field, this represents the amount of time the item will cook for before the result is crafted. The cook-time field is measured in ticks, remember that there are 20 ticks every second. The cooking-time field has a default value of 60. The next field is called experience, this represents the experience the player gains after cooking the item, this field is a floating point value so keep that in mind. This value defaults to zero. An example of a furnace recipe is as follows:

ThisRecipeNameCouldBeAnything:
  type: 'FURNACE'
  key: '~dirt'
  cooking-time: 1200 # this is equal to one minute
  experience: 50.5