#Unable to load virtual datapacks for recipes

18 messages · Page 1 of 1 (latest)

shut flower
#

Trying to load virtual recipe datapacks in ServerEvents.highPriorityData doesn't seem to have any effect. I'm still able to load jsons over default datapacks in the case for advancements but recipes, even ones that aren't loaded over existing namespaces, don't seem to work. Even though exporting them does show that they are being loaded, and moving them to kubejs/data and reloading lets them work as expected. I've also tried moving only recipe data to be passed through lowPriorityData but that doesn't seem to work either.

this is the code I tested with.


ServerEvents.highPriorityData(event => {
    event.addJson("hexcasting:advancements/grant_patchi_book", 
        {
            criteria: {
                tick: {
                    trigger: "minecraft:tick"
                }
            },
            rewards: {
                loot: []
            }
        }
    )

    event.addJson("test:thermal",
        {
            "type": "thermal:press",
            "ingredients": [
                {
                    "item": "minecraft:bone_block"
                },
                {
                    "item": "thermal:press_unpacking_die"
                }
            ],
            "result": [
                {
                    "item": "minecraft:bone_meal",
                    "count": 9
                }
            ],
            "energy": 400
        }
    )

    event.addJson("test:vanilla",
        {
            "type": "minecraft:crafting_shapeless",
            "ingredients": [
                {
                    "item": "minecraft:blaze_rod"
                }
            ],
            "result": {
                "item": "minecrart:sugar"
            }
        }
    )
})
rich heartBOT
#

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

gleaming kiln
#

This is not really my area of expertise, but I can tell you there is a much better way of custom json recipes

solar viperBOT
#

You can add, remove, and modify recipes with KubeJS. The wiki has a page on that!
If you want to learn how to add recipes to any mod, click the Custom button.

gleaming kiln
#

Click the Custom button there ^

#

Other than that, check the log.

solar viperBOT
#

You can find your KubeJS server log in /minecraft/logs/kubejs/server.log.
If you are on 1.18 or below it will be called server.txt.
Please send it if asked, as it contains helpful information.

shut flower
#

I'm doing it like this because I might potentially have hundreds of recipes to add, so I'm using a script elsewhere to generate them. I've been trying to programmatically add compression and uncompression recipes through thermal's pneumatic press, because the mod doesn't do it automatically

#

and I've checked the log file for it, no indication of anything out of place, weirdly enough

#

I could technically just go ahead with the way it is now, then export the pack and dump the files into the data folder but that means the pack size will be huge

#

I'll have a look at .custom(), didn't see that because I've been using the older docs without realising

#

seems other than the fact recipe ids are generated, which I can live with, it looks like it'll work. Gotta sleep though, if using .custom() works out when I wake up I'll close the issue

sour mantle
#

Yeah Just use event.custom in the recipes event it Just easier to use If you want to specify an exact ID you can use .id(id) after the closing bracket to apply it

#

Also your Problem why the recipes aren't being added is because you aren't adding them virtually to the recipes folder

shut flower
gleaming kiln
#

You get extra methods with .custom, like setting the recipe ID, making ingredients damage instead of consume, etc

sour mantle
#

that's also correct, you have extra features like modifyResult damageIngredient and also keepIngredient

shut flower
#

neat, I'll keep that in mind