#Tag-Based Recipes Not Working on First Launch

1 messages · Page 1 of 1 (latest)

languid quiver
#

Hi, so I have this script:

    event.remove({output: '#forge:plates'});
    var done = [];
    var sortedTypes = [];
    function contains(a, b){
        for(var i = 0; i < done.length; i++){
            if(done[i] == a){
                sortedTypes[i].push(b);
                return;
            }
        }
        done.push(a);
        sortedTypes.push([b]);
        return;
    }
    Ingredient.of('#forge:plates').stacks.forEach(item =>{
        item.getTags().toArray().forEach(tag => {
        if(tag.location().path.length() > 'plates/'.length && tag.location().path.substring(0, 'plates/'.length) == 'plates/'){
            contains(tag.location().path.substring('plates/'.length), item);
        }
        })
    });
    for(var i = 0; i < sortedTypes.length; i++){
        sortedTypes[i].sort();
        event.shapeless(Item.of(sortedTypes[i][0], 1),  [ '#forge:ingots/'+done[i], 'ad_astra:hammer'])
    }
});```
And none of the recipes seem to appear on first launch, but all appear upon using /reload. I have a similar problem in a client script in which I am running the exact same code but using it to hide copies of plates from jei instead. I'm assuming it has something to do with when the items are actually given tags or something, but have no idea how to fix it.
proud quiverBOT
#

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

ashen mantle
#

What are you even trying to do? This seems way to complicated and there probably IS a easier way.

languid quiver
#

Yeah, there probably is, I'm trying to remove and replace all plate recipes and hide duplicate plates (plates made of the same material) using the forge:plates tag, my pack has quite a few plates, so I'm trying to make it easier/less annoying using a script, while also learning a bit more about kubejs and javascript (the current shapeless recipe is just one of around 5-10 I'm going to implement)

plucky forge
#

tags are a known issue and are fixed in an upcoming release

#

in the short run people have had success running /reload on first launch

pliant hatchBOT
#

Tags can bug out on the current 1.19 version.
A fix will come, but as a temporary workaround you can add this anywhere in your server scripts:

ServerEvents.loaded(e => e.server.runCommandSilent('reload'))

This will run the /reload command one time when the server starts, which will load the tags properly.

languid quiver
#

Ok, thanks, yeah, I noticed that it does work after reload, that helps a lot