Tool with damage can't make recipe run even after ignore its NBT with kubejs
Malnormala opened this issue ยท 10 comments
I tried to use kubejs to add recipes
What I wanted to do is to damage this diamond sword to make an andesite alloy.
Here are two way I came up with to achieve this, but neither of them worked.
the recipe run only when the sword do not have any damaged, what bothered me is that 'ignoreNBT' truly worked
because if I delete it, enchanted sword can't be used.
I also tested many conditions, even I used tag it still the same.
and another question, I can't find the way to set the mode of Durability Requirement using kubejs
`onEvent('recipes', event => {
event.recipes.custommachinery.custom_machine("custommachinery:seal_engraving_table_hand", 200)
.requireItem(Item.of("kubejs:lapis_glue",2),"input1")
.requireItem(Item.of("minecraft:andesite",1),"input2")
.damageItemTag(Item.of("minecraft:diamond_sword").ignoreNBT(),1,"input3")
.requireItem(Item.of("kubejs:concept_orientation_strength_1",1),"input4").chance(0)
.produceItem(Item.of("create:andesite_alloy",1), "output1")
})
onEvent('recipes', event => {
event.recipes.custommachinery.custom_machine("custommachinery:seal_engraving_table_hand", 200)
.requireItem(Item.of("kubejs:lapis_glue",2),"input1")
.requireItem(Item.of("minecraft:andesite",1),"input2")
.damageItemTag("#forge:swords",1,"input3")
.requireItem(Item.of("kubejs:concept_orientation_strength_1",1),"input4").chance(0)
.produceItem(Item.of("create:andesite_alloy",1), "output1")
Instead, I found that once I used /reroad, the recipe could run correctly once, but only once.
Using kubeJS integration you don't need to specify the mode for durability requirement, basically .damageItem
is input mode and .repairItem
is output mode.
.damageItemTag(Item.of("minecraft:diamond_sword").ignoreNBT(),1,"input3")
This shouldn't even work, as .damageItemTag
need a tag as first parameter and not an item.
I also don't think #forge:swords
is a valid item tag (except if you add it yourself, in that case nevermind), as I can't see it in the forge tags folder.
Simply using .damageItem(Item.of("minecraft:diamond_sword"), 1, "input3")
should work, if you don't specify any nbt the recipe won't care, so even if the sword is enchanted the requirement should run.
I don't know what .ignoreNBT
does (probably some KubeJS dark magic), but I advise you not to use it with CM recipes, in most cases it will just be ignored anyway.
I'm sorry that in fact exactly did so but I copied wrong code on the issue because I tried to change my code to solve the question and I forget to change it back
now I tried my code again but the problem still exist
Sword with damage can't make the recipe run
`onEvent('recipes', event => {
event.recipes.custommachinery.custom_machine("custommachinery:seal_engraving_table_hand", 200)
.requireItem(Item.of("kubejs:lapis_glue",2),"input1")
.requireItem(Item.of("minecraft:andesite",1),"input2")
.damageItem(Item.of("minecraft:diamond_sword"),1,"input3")
.requireItem(Item.of("kubejs:concept_orientation_strength_1",1),"input4").chance(0)
.produceItem(Item.of("create:andesite_alloy",1), "output1")
There was actually an bug in the durability requirement, thanks for reporting it.
I just pushed an update that should fix it (1.16.5-0.5.8d).
Ok I used a very old kubejs version in my workspace, that's why it worked here be not in a modpack with latest kubejs version.
I updated kubejs and fixed the issue (hopefully) and pushed an update (1.16.5-0.5.8f).