#Remove vanilla crafting recipes without removing autogenerated create mod equivalents

1 messages · Page 1 of 1 (latest)

gentle basalt
#

Problem: When removing recipes of type minecraft:crafting_shapedor minecraft:crafting_shapeless, it also removes the automatically created recipes create:automatic_[packing,shaped,shapeless]

How do I prevent that from happening? Is there a way to:

  • delay recipe removal until after create did its thing,
  • bulk re-add recipes (i.e. somehow export recipes and re-add them)
  • or bulk change recipe type (i.e. somehow change every create:automatic_shapeless to create:mixing)?
snow vortexBOT
#

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

unreal osprey
#

there isnt a clean way to do this, as those recipes are automatic and will updated based on the vanilla recipes
off the top of my head you have 2 options:

  • add the recipes yourself manually
  • partial automation

for option 2:

  • make a temp script that will export the recipe jsons for the Create recipes by using the appropriate recipe filters
  • remove the vanilla recipes
  • add the recipes back with the exported json recipes in the script
gentle basalt
#

How do I do those exports?

wild dust
#

There's also forEachRecipe

orchid rapidsBOT
#

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.getId())
  })
})
wild dust
#

Will the e in r in this example be changed?
e stands for "event", r stands for "recipe"

#

With that, you can add Mechanical Crafting recipes for all shaped recipes, and later remove all shaped recipes, leaving behind the Mechanical Crafting ones

wild dust
#

This removes ALL shaped crafting recipes and readds them as Mechanical Crafting recipes

ServerEvents.recipes(event => {
  event.forEachRecipe({ type: "minecraft:crafting_shaped" }, recipe => {
    // Annoyingly, `recipe.json` outputs a Java "JsonObject", not JS object, so stringify it and JSON.parse to turn it into JS object
    let obj = JSON.parse(recipe.json.toString())
    event.recipes.create.mechanical_crafting(obj.result, obj.pattern, obj.key)
  })
  event.remove({ type: "minecraft:crafting_shaped" })
})
#

Note that special recipe types and shapeless recipes are untouched by this, try making logic for those yourself

gentle basalt
#

Ah thank you, that's exactly what I need, just need to change a few filters.