#Recipe priority

12 messages · Page 1 of 1 (latest)

summer hazel
#

I am trying to make a recipe for vanilla chests that makes 4 chests when crafted with different log types. The problem is that it takes priority over the recipes for wood typed chests, that makes 4 chests from 8 of its respective logs of the same type.

How do I give priority to the wood typed chest recipes? Or, make the vanilla chest recipe craft with only mixed logs?
Apologies in advance, I'm very new to this.

ebon hemlockBOT
#

Once your ticket has been resolved, please close it with </ticket close:1054771505520717835> command!

sand crescent
summer hazel
sand crescent
#

wait what?

#

show me with screenshots

summer hazel
#

the entire thing is just the same for every wood type

abstract dagger
# summer hazel

replace the recipe using #minecraft:logs with this one

ServerEvents.recipes(event=>{
    event.recipes.kubejs.shaped(
        Item.of("chest", 4),
        ["AAA", "A A", "AAA"],
        {A: "#minecraft:logs"}
    )
    .modifyResult((grid, result) => {
        let woodregex = new RegExp("^([a-z]*):(stripped_|)([a-z_]*)_(log|wood|stem|hyphae)$")
        let logs = grid.findAll(Ingredient.of("#minecraft:logs"))
        let parsedLogs = logs.map(log => woodregex.exec(log.id))
        let firstLog = parsedLogs[0]
        let AllSameType = parsedLogs.every(([_, mod, stripped ,tree, suffix]) => mod == firstLog[1] &&tree == firstLog[3])
        if(AllSameType) {
            let [_, mod, stripped, tree, suffix] = firstLog
            return Item.of(`woodworks:${tree}_chest`, 4)
        }
        return result
    })
})
#

Oh wait, I think this might be better, in case of some logs having no special chest for them

    event.recipes.kubejs.shaped(
        Item.of("chest", 4),
        ["AAA", "A A", "AAA"],
        {A: "#minecraft:logs"}
    )
    .modifyResult((grid, result) => {
        let woodregex = new RegExp("^([a-z]*):(stripped_|)([a-z_]*)_(log|wood|stem|hyphae)$")
        let logs = grid.findAll(Ingredient.of("#minecraft:logs"))
        let parsedLogs = logs.map(log => woodregex.exec(log.id))
        let firstLog = parsedLogs[0]
        let AllSameType = parsedLogs.every(([_, mod, stripped ,tree, suffix]) => mod == firstLog[1] &&tree == firstLog[3])
        if(AllSameType) {
            let [_, mod, stripped, tree, suffix] = firstLog
            let specialChest = Item.of(`woodworks:${tree}_chest`)
            if(!specialChest.isEmpty()) return specialChest.withCount(4)
            return result
        }
        return result
    })

ebon hemlockBOT
#

Ticket closed!