#Unifying Recipes in Stead of it showing 7 pages of recipes for one item

17 messages · Page 1 of 1 (latest)

radiant elk
#

So im trying to figure out how to make 7 pages to craft a chest to only one page which shows whats needed to craft 1 chest from 8 planks and 4 chest from 8 logs, basicly im trying to unify the recipes but im not sure on how to do this with out it having a error

This is the current code i have for it

    // List of all wooden planks
    const planks = [
        'minecraft:oak_planks',
        'minecraft:spruce_planks',
        'minecraft:birch_planks',
        'minecraft:jungle_planks',
        'minecraft:acacia_planks',
        'minecraft:dark_oak_planks',
        'minecraft:mangrove_planks',
        'minecraft:crimson_planks',
        'minecraft:warped_planks',
        'minecraft:cherry_planks'
    ];

    // Loop through all planks and create a recipe to turn 2 planks into 2 sticks
    planks.forEach(plank => {
        event.shaped('2x minecraft:stick', [  
            'A',
            'A'
        ], {
            A: plank
        });  // Set the output to 2 sticks
    });

    planks.forEach(plank => {
        event.shaped('minecraft:chest', [ 
            'AAA',
            'A A',
            'AAA'
        ], {
            A: plank
        });  // Set the output to 1 chest
    });
});

ServerEvents.recipes(event => {  
    // List of all wooden logs
    const logs = [
        'minecraft:oak_log',
        'minecraft:spruce_log',
        'minecraft:birch_log',
        'minecraft:jungle_log',
        'minecraft:acacia_log',
        'minecraft:dark_oak_log',
        'minecraft:mangrove_log',
        'minecraft:crimson_stem',
        'minecraft:warped_stem',
        'minecraft:cherry_log'
    ];

    logs.forEach(log => {
        event.shaped('4x minecraft:chest', [
            'AAA',
            'A A',
            'AAA'   
        ], {
            A: log
        }); //Set out put to 4 chest
    });
});

lime zealotBOT
#

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

radiant elk
#

i also having to recreate recipes since i removed all recipes from the planks inorder to customize it for my modpack

tacit stirrup
#

why not just use tags?

#
ServerEvents.recipes(event => {
  event.shaped('2x minecraft:stick', ['A', 'A'], { A: '#minecraft:planks' })
  event.shaped('minecraft:chest', ['AAA', 'A A', 'AAA'], { A: '#minecraft:planks' })
  event.shaped('4x minecraft:chest', ['AAA', 'A A', 'AAA'], { A: '#minecraft:logs' })
})
radiant elk
#

um cause i didnt know how to use them XD

#

but thanks for pointing that out

tacit stirrup
#

:p

radiant elk
#

would that work the same way to remove lets say from logs making 4 planks to logs making only 2 planks?

cinder sparrowBOT
#

This is an example of how to use .forEachRecipe() for changing or adding new recipes using existing ones.

ServerEvents.recipes(e => {
  // 2x slabs -> 1x plank through shaped crafting
  e.forEachRecipe({ type: 'minecraft:crafting_shaped', output: '#minecraft:slabs' }, r => {
    let ingredients = r.originalRecipeIngredients // returns a List<Ingredient>
    let output = r.originalRecipeResult           // returns an ItemStack
    e.shaped(ingredients[0], ['S', 'S'], { S: output })
  })

  // 1x stair -> 1x plank through stonecutting
  e.forEachRecipe({ type: 'minecraft:stonecutting', output: '#minecraft:stairs' }, r => {
    let ingredients = r.originalRecipeIngredients
    let output = r.originalRecipeResult
    e.stonecutting(ingredients[0], output)
  })

  // change the output from logs to planks from 4x to 2x (this will replace old recipe)
  e.forEachRecipe({ type: 'minecraft:crafting_shapeless', input: '#minecraft:logs', output: '#minecraft:planks' }, r => {
    let ingredients = r.originalRecipeIngredients
    let output = r.originalRecipeResult
    e.shapeless(Item.of(output.id, 2), ingredients[0]).id(r.getOrCreateId())
  })
})
tacit stirrup
#

last one

radiant elk
#

okay so ive done something and now all logs produce only oak planks XD

tacit stirrup
#

show me what you have

radiant elk
#

im not sure what i did but it gave me a laugh cause i thought it was funny but idk how to fix it XD

#

um suprisingly i fixed it cause i deleted a important code line which was

    // List of all wooden planks
    const planks = [
        'minecraft:oak_planks',
        'minecraft:spruce_planks',
        'minecraft:birch_planks',
        'minecraft:jungle_planks',
        'minecraft:acacia_planks',
        'minecraft:dark_oak_planks',
        'minecraft:mangrove_planks',
        'minecraft:crimson_planks',
        'minecraft:warped_planks',
        'minecraft:cherry_planks'
    ];

});
cinder sparrowBOT
#

Please close your ticket (with </ticket close:1054771505520717835> or the button atop this thread) once you resolved your issue!
This also helps others that would like to help out, as they don't have to look into this thread to check if it has been resolved by now.

Do you have any other questions regarding your issue? Feel free to ask!
Note: You should create a new post for unrelated issues.