#ExtendedCrafting shaped recipe JSON function

16 messages · Page 1 of 1 (latest)

blissful kelp
#

Native KubeJS integration for ExtendedCrafting is no longer needed.

Place inside kubejs/server_scripts in a .js file.

ServerEvents.recipes(event => {}) or any callback, as usual.

/**
 * Generates a custom shaped recipe for the ExtendedCrafting mod.
 * @license Unlicense
 * @author tizu69 <https://github.com/tizu69>
 * @author CelestialAbyss <https://github.com/CelestialAbyss>
 * @param {Internal.Callable} event - The event object
 * @param {string} output - The output, as an item ID string
 * @param {number} outputQuantity - The quantity of the output
 * @param {string[]} arrangement - The arrangement of the ingredients on the table
 * @param {object} ingredientKeys - The keys representing the ingredients on the table, like a crafting table recipe
 * @param {string} recipeId - The ID of the recipe
 * @param {boolean} lock - Whether the recipe should require a specified tier
 * @param {number?} tierNumber - Tier number 1-4
 */
function extendedTable(event, output, outputQuantity, arrangement, ingredientKeys, recipeId, lock, tierNumber) {
    event.custom({
        type: "extendedcrafting:shaped_table",
        tier: lock ? tierNumber : 0,
        pattern: arrangement,
        key: ingredientKeys,
        result: Item.of(output, outputQuantity).toJson(),
    }).id(recipeId)
}
honest moss
#

why...

#

as you said there is native support in kjs

blissful kelp
#

But, it doesn't support tier

honest moss
#

ah

blissful kelp
#
    extendedTable(event, 'extendedcrafting:crystaltine_ingot', 4, [
        'RRRRRRR',
        'RRNRNRR',
        'RNRNRNR',
        'RRNRNRR',
        'RRRRRRR'
    ], {
        R: 'create:refined_radiance',
        N: 'minecraft:nether_star'
    }, 'finality:extendedcrafting/crystaltine_ingot_alt')

This is how it looks like though, so it's very close

rustic flower
blissful kelp
#

Might as well make KubeJS ExtendedCrafting to reduce bloat

rustic flower
#

how is that currently?

blissful kelp
#

But I don't have any Java knowledge sooo 🤷‍♀️

rustic flower
#

what kind of bloat are you talking about?

blissful kelp
#

Isn't it the same reason why KubeJS Create, Mekanism, etc are all not part of the core KubeJS code?

rustic flower
#

@blissful kelp Do you know if when it is a tier 0 it should fall back to vanilla recipe or not?

blissful kelp
#

It does not revert back to vanilla recipe

rough axle
#
event.recipes.extendedcrafting.shaped_table("16x powah:lens_of_ender", [
        "LSSSL",
        "NTETN",
        "NEPEN",
        "NTETN",
        "LSSSL"
    ], {L: "thermal:lumium_plate", S: "powah:solar_panel_niotic", N: "powah:capacitor_niotic", T: "powah:thermoelectric_plate", E: "powah:ender_core", P: "powah:photoelectric_pane"}).merge({tier: 2})