#Is there a way to create an easy map for getting all Logs and their stripped variants?

16 messages · Page 1 of 1 (latest)

jade steeple
#

What the message says, in the moddpack we're playing i have Farmer's Delight, sadly this mod only supports in its cutting board the stripping of vanilla logs and not moddded.

i was thinking on somehow creating a map between all logs andd their stripped variants, then iterating thru the collection to add them as recipes, is there a way to do this?

lapis hornetBOT
#

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

jade steeple
#

For now i've decided to do some cursed string matching and now i basically have a way to map the log/wood with its stripped variant

#

the only issue now is that my custom recipe json isnt working properly

#

as in, nothing new appears in the cutting board's JEI entry

#
onEvent('recipes', event =>
{
    let cuttingBoard = (log, strippedLog) =>
    {
        event.custom(
            {
            "type": "farmersdelight:cutting",
            "ingredients": [
              {
                "item": log
              }
            ],
            "tool": {
              "type": "farmersdelight:tool_action",
              "action": "axe_strip"
            },
            "result": [
              {
                "item": strippedLog
              },
              {
                "item": "farmersdelight:tree_bark"
              }
            ],
            "sound": "minecraft:item.axe.strip"
          }
          )
    }

    var allItems = Item.getList()
    
    allItems.forEach(item => {
        if(item.hasTag("minecraft:logs"))
        {
            var itemAsString = item.toString()
            if(itemAsString.includes("stripped"))
            {
                var nonStripped = itemAsString.replace('stripped_', '')
                console.log(nonStripped + " = " + itemAsString)
                cuttingBoard(nonStripped, itemAsString)
            }
        }
    })
})```
#

here be cursed code

jade steeple
#

i have no idea why this isnt working

#

i tried rn to just use Item.of() and pass the string of resource locations, which at least on the log itself look OK, but ingame this error appears

#

so, i'm a bit stumped

#

If I manually use a regular string for the input and output, such as "quark:azalea_log" no issues arise and the recipe gets added

#

My only clue is that maybe for whatever reason there's an odd string character inside the resource location I'm giving it

jade steeple
#

this... aint right

jade steeple
# jade steeple

Unsure why exactly my string manipulation was making all strings encapsulateddd with ', nevertheless, ijust replaced the ' with empty strings and now its working