You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I have decided to make many recipes using keepIngredient() so i have started with a thing like that just to test how it work
[it work perfectly]
// all items are custom using kubejsServerEvents.recipes((event)=>{event.recipes.kubejs.shapeless("kubejs:"+2,["kubejs:"+1,"kubejs:"+'plus',"kubejs:"+1,]).keepIngredient("kubejs:"+'plus');})
so on next i have try to make it inside a function
ServerEvents.recipes((event)=>{// same code but inside a functionfunctionshapeless(operator,inputs,output){event.recipes.kubejs.shapeless("kubejs:"+output,["kubejs:"+inputs[0],"kubejs:"+operator,"kubejs:"+inputs[1],]).keepIngredient("kubejs:"+operator);};shapeless("plus",[1,2],3);})
but i have found this (it keep all ingredients ignoring the filter)
also i have tested and persist as same on this
ServerEvents.recipes((event)=>{// same code but using variablesletn2=2letn1=1letplus='plus'event.recipes.kubejs.shapeless("kubejs:"+n2,["kubejs:"+n1,"kubejs:"+plus,"kubejs:"+n1,]).keepIngredient("kubejs:"+plus);})
ServerEvents.recipes((event)=>{// same code using *arrow function*letshapeless=(operator,inputs,output)=>{event.recipes.kubejs.shapeless("kubejs:"+output,["kubejs:"+inputs[0],"kubejs:"+operator,"kubejs:"+inputs[1],]).keepIngredient("kubejs:"+operator);};shapeless("plus",[1,2],3);})
Crash report/logs
No response
The text was updated successfully, but these errors were encountered:
Edit.
I have found what cause that issue:
it was caused by using variables or dynamic values inside .keepIngredient() like
ServerEvents.recipes((event)=>{//it dont want work properly but persist all itemsletoperator="plus";event.recipes.kubejs.shapeless("kubejs:"+2,["kubejs:"+1,"kubejs:"+"plus","kubejs:"+1,]).keepIngredient("kubejs:"+operator);//it work perfectly persisting only the specific itemevent.recipes.kubejs.shapeless("kubejs:"+3,["kubejs:"+2,"kubejs:"+"plus","kubejs:"+1,]).keepIngredient("kubejs:"+"plus");});
DevDyna
changed the title
keepIngredient() dont work properly on specific situations
keepIngredient() dont work properly when used variables or dynamic values as parameters
Nov 5, 2024
Minecraft Version
1.20.1
KubeJS Version
kubejs-forge-2001.6.5-build.14
Rhino Version
rhino-forge-2001.2.3-build.6
Architectury Version
architectury-9.2.14-forge
Forge/Fabric Version
Forge - 47.3.11
Describe your issue
I have decided to make many recipes using keepIngredient() so i have started with a thing like that just to test how it work
[it work perfectly]
so on next i have try to make it inside a function
but i have found this (it keep all ingredients ignoring the filter)
also i have tested and persist as same on this
Crash report/logs
No response
The text was updated successfully, but these errors were encountered: