Modify Result with Ingredient
OriginalNovember 10, 2024Less than 1 minute
Modify Result with Ingredient
ServerEvents.recipes((event) => {
const { kubejs } = event.recipes;
kubejs
.shapeless(
Item.of("wooden_axe").withName([
Text.red(
"Enchantments on axes will be removed, not replaced with wooden axes"
),
]),
[
Ingredient.of("#minecraft:axes").itemIds.map((id) =>
Item.of(id).enchant("flame", 2).weakNBT()
),
"sponge",
]
)
.keepIngredient("sponge")
.modifyResult((grid, result) => {
const item = grid.find(Ingredient.of("#minecraft:axes"));
item.nbt.remove("Enchantments");
return item;
});
});
Info
.modifyResult
can only be used with kubejs:shaped
and kubejs:shapeless
recipes.