ValhelsiaTeam/Valhelsia-Furniture

Chair and Table recipes interfering with MineColonies automation

Opened this issue · 7 comments

An issue I noticed that is preventing full utilization of Valhelsia 6: The recipe for the wooden chair and table is the same as wooden slabs, and the furniture recipes are taking priority over slabs. This is preventing full automation with MineColonies, as you can only teach them to make chairs, not slabs.

We wouldn't make identical recipes to that of any vanilla items. The chairs and tables both have sticks in the recipes (the chairs are 3 sticks and 3 planks, for example), but the recipes are broken due to an interaction with the KubeJS mod when it is present (like it is in Valhelsia 6). I don't currently know why it breaks the recipes - we didn't get a reply from them after the last message we sent.

I'm not familiar with the ins and outs of the coding of minecraft mods so I was a little lost, but I did see a thread on KubeJS about this issue where they seemed to find a solution, potentially with the tags system? I'm not 100%, but here's the thread, hopefully it's of some use! Love the Valhelsia series, have hosted servers for all of the editions so far. https://kubejs.com/support/tickets/DA71A5F2

There's no solution in that thread. That's where we were talking to the KubeJS developer about it. You can see that Khytwel (Valhelsia founder), Stal (Valhelsia Furniture dev) and I were all talking in that thread. We didn't hear back from Lat after the latest messages.

My apologies, I misunderstood. I hope a solution is found, so far this is the only issue I've personally experienced in the modpack. Otherwise, it's been stellar!

I got tired of waiting, so I decided to write a workaround using KubeJS (ironically):

ServerEvents.recipes(e => {
    e.forEachRecipe({ output: /valhelsia_furniture:\S+/ }, r => {
        const recipeId = r.getId();
        const jIngredients = r.json.get('key');
        const keys = jIngredients.keySet();
        const ingredients = {};
        keys.forEach(key => {
            let value = jIngredients.get(key);
            const forge = value.get('forge_value');

            if (`${forge}` !== 'null') value = forge;

            const x = `${value.get('item')}`.replace(/"/g, '');
            const y = `${value.get('tag')}`.replace(/"/g, '');
            const input = (x === 'null') ? `#${y}` : x;
            ingredients[key] = input;
        });
        e.remove({ id: recipeId });
        e.shaped(r.originalRecipeResult, r.json.get('pattern'), ingredients).id(recipeId);
    })
})

Thanks for the workaround. If anyone finds it and wonders how to use it, you create a .js file with a random name in the \kubejs\server_scripts folder and put the code into this file. Works perfectly for me.

I got tired of waiting, so I decided to write a workaround using KubeJS (ironically):

ServerEvents.recipes(e => {
    e.forEachRecipe({ output: /valhelsia_furniture:\S+/ }, r => {
        const recipeId = r.getId();
        const jIngredients = r.json.get('key');
        const keys = jIngredients.keySet();
        const ingredients = {};
        keys.forEach(key => {
            let value = jIngredients.get(key);
            const forge = value.get('forge_value');

            if (`${forge}` !== 'null') value = forge;

            const x = `${value.get('item')}`.replace(/"/g, '');
            const y = `${value.get('tag')}`.replace(/"/g, '');
            const input = (x === 'null') ? `#${y}` : x;
            ingredients[key] = input;
        });
        e.remove({ id: recipeId });
        e.shaped(r.originalRecipeResult, r.json.get('pattern'), ingredients).id(recipeId);
    })
})

Funnily enough, this ends up causing problems with Blue Skies Simply Swords recipes, as well as Shield Expansion. Any way I could fix this issue with more code?