Item transform

Use the item transform requirement in a KubeJS recipe

Use one of these methods to add an Item transform requirement to the recipe.

.transformItem(input, output)
.transformItem(input, output, inputSlot, outputSlot)
.transformItem(input, output, inputSlot, outputSlot, transformer)
  • The input` and `output param must be a SizedIngredient created using one of the following syntax:

    • String syntax : "diamond" or "botania:pure_daisy" or "4x mekanism:osmium_ingot"

    • Tag string syntax : "#c:stones" or "3x #c:stones

    • Item.of() KubeJS method : Item.of("minecraft:diamond", 42)

  • The inputSlot and outputSlot params must be a string corresponding to a slot id defined in a custom machine json Item Component slot property. It is optional and the default value is "" (no specific slot required).

  • The transformer param can be a function that takes an ItemStack which will the input item, and must return an ItemStack which will be set as the output item.

    • This can be used to manipulate the components (previously known as nbt) of the output item based on these of the input item.

Example

Transform any stone in 2 gravels.

ServerEvents.recipes(event => {

  event.recipes.custommachinery.custom_machine("custommachinery:power_crusher", 100)
  .transformItem("#c:stones", "2x gravel"))
  
})

Last updated