Skip to content

Barrel Crafting

MattiDragon edited this page Jul 19, 2023 · 1 revision

The fabricaeexnihilo:barrel recipe type is responsible for almost all crafting recipes in barrels, with the only exception being milking recipes. Barrel recipes consist of three main parts: a trigger, a list of conditions, and a list of actions.

Recipes also have to contain an icon field with an item id for a recipe icon. This is usually the result of the recipe or some other significant item. Can also be air if no fitting item exists.

Optionally recipes can contain a duration. It's expressed in barrel ticks in the duration field. All conditions and action conditions are checked each barrel tick while the recipe is active.

Barrel States

The previous barrel mode system has been replaced with barrel states. There are currently four states:

  • EMPTY: The barrel is empty. Recipes can begin in this state.
  • ITEM: The barrel is currently storing an item. In this state no recipe can begin or run before the item is removed.
  • FLUID: The barrel is storing a fluid. Recipes can begin in this state.
  • COMPOST: The barrel is currently composing. While in the filling substage recipe can begin. After the barrel is filled it will stay in this state for a while, while the composing finishes.

During crafting of a recipe the barrel stays in the previous state, but doesn't accept any interactions. If a recipe conditions stops being valid during a recipe the barrel reverts to the previous state.

Triggers

The trigger controls when the recipe can happen.

  • tick is triggered every tick in the EMPTY and FLUID barrel states.
    {
      "type": "tick",
      "chance": 0.1   // Optional chance to trigger, defaults to 1
    }
  • item_inserted is triggered when something tries to add an item to a barrel in the EMPTY, FLUID or COMPOST states.
    • The barrel will consume one of the inserted item if the recipe can begin.
    {
      "type": "insert_item",
      "item": { // The accepted item type, a standard vanilla ingredient
        "item": "minecraft:stone"
      }
    }

Conditions

Conditions filter when a recipe can happen. They can for example require that the barrel contains a certain amount of fluid or that there is a specific block below.

  • fluid_above checks for a fluid placed above the barrel block.
    {
      "type": "fluid_above",
      "fluid": "minecraft:water" // The fluid to check for. Standard fluid ingredient
    }
  • fluid_in checks the fluid inside the barrel. The barrel has to be filled with a full bucket of fluid. It's recommended that every recipe has either this condition or an action that checks for the fluid inside.
    {
      "type": "fluid_in",
      "fluid": "minecraft:lava" // The fluid to check for. Standard fluid ingredient
    }
  • block_above checks for a block above the barrel, currently unused.
    {
      "type": "block_above",
      "block": "minecraft:ice" // The block to check for. Standard block ingredient
    }
  • block_below checks for a block below the barrel.
    {
      "type": "block_below",
      "block": "minecraft:mycelium" // The block to check for. Standard block ingredient
    }

Actions

Actions are applied when a recipe completes. Some also act as conditions for the recipe when it makes sense.

  • spawn_entity spawns an entity stack above the barrel. Does not act as a condition.
    {
      "type": "spawn_entity",
      "entities": { // A standard entity stack
        "type": "minecraft:blaze",
        "data": {},
        "size": 1
      }
    }
  • store_item places an item inside the barrel. It will delete anything already stored inside. Does not act as a condition.
    {
      "type": "store_item",
      "stack": { // A standard FEN item stack
        "count": 1,
        "item": "minecraft:chiseled_red_sandstone"
      }
    }
  • store_fluid stores a certain amount of fluid in the barrel. It will replace existing contents. Does not act as a condition.
    {
      "type": "store_fluid",
      "amount": 81000, // The amount of fluid to store, in droplets
      "fluid": {       // The type of fluid as a standard FEN fluid type
        "type": "fabricaeexnihilo:brine"
      }
    }
  • consume_fluid consumes a certain amount of fluid from the barrel. Checks that enough matching fluid is available as a condition.
    {
      "type": "consume_fluid",
      "amount": 8100,                         // The amount of fluid to consume, in droplets
      "fluid": "#fabricaeexnihilo:witchwater" // The fluid required, as a standard FEN fluid ingredient
    }
  • convert_block converts nearby blocks. It's used in leaking recipes by the base mod but could be used in other circumstances. This action checks that there are nearby convertible blocks as a condition.
    {
      "type": "convert_block",
      "filter": "minecraft:gravel", // The block to convert, as a block ingredient
      "result": {                   // The result, as a standard minecraft block state
        "Name": "fabricaeexnihilo:crushed_netherrack"
      }
    }
  • drop_item drops an item above the barrel. store_item should be preferred for the primary output, this action is only intended for secondary outputs or byproducts. Does not act as a condition.
    {
      "type": "drop_item",
      "stack": { // Dropped item, as a standard FEN item stack
        "count": 1,
        "item": "minecraft:glass_bottle"
      }
    }
  • fill_compost adds fills the compost counter of the barrel. It makes sure the barrel is empty or composing as its condition and if it is composting further checks that the result matches.
    {
      "type": "fill_compost",
      "increment": 0.0625, // The amount to fill the compost by, out of 1
      "result": {          // The composing result as a standard FEN item stack
        "count": 1,
        "item": "minecraft:dirt"
      }
    }
Clone this wiki locally