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(ItemStackJS input)
.transformItem(ItemStackJS input, ItemStackJS output)
.transformItem(ItemStackJS input, ItemStackJS output, String inputSlot, String outputSlot)
.transformItem(ItemStackJS input, ItemStackJS output, String inputSlot, String outputSlot, nbt => {return nbt;})
.transformItemTag(String tag)
.transformItemTag(String tag, int inputAmount, CompoundTag inputNBT)
.transformItemTag(String tag, int inputAmount, CompoundTag inputNBT, ItemStackJS output)
.transformItemTag(String tag, int inputAmount, CompoundTag inputNBT, ItemStackJS output, String inputSlot, String outputSlot)
.transformItemTag(String tag, int inputAmount, CompoundTag inputNBT, ItemStackJS output, String inputSlot, String outputSlot, nbt => {return nbt;})
The
input and output
params must be an ItemStackJS, created usingItem.of()
KubeJS method. Example :Item.of("minecraft:diamond", 42)
The
inputSlot
andoutputSlot
params must be a string corresponding to a slot id defined in a custom machine json Item Componentslot
property. It is optional and the default value is""
(no specific slot required).The
tag
param must be a string starting with # defining a valid tag id. Example :"#forge:stone"
The
inputAmount
param must be a positive integer.The
inputNBT
param must be a map. Example:{nbt1: 1, nbt2: "something"}
.The last param can be a function that takes a map which is the nbt of the input item (the map will be empty if the item doesn't have nbt data), and must return a map which will be set as the nbt of the output item.
Example
onEvent('recipes', event => {
event.recipes.custommachinery.custom_machine("custommachinery:power_crusher", 100)
.transformItem(Item.of("minecraft:stone"))
})
Last updated