#Incorrect fluid quantity when using event.replaceOutput

7 messages · Page 1 of 1 (latest)

stray jewel
#
event.replaceOutput(
    { output: Fluid.of("northstar:carbon", 100) },
    Fluid.of("northstar:carbon", 100),
    Fluid.of("tfmg:carbon_dioxide", 100), // This is shown as 500mb in actual recipe, WHY
  );
heady kiteBOT
#

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

steep rose
#

replace only works for changing the ID, doesnt for amounts or quantities

safe osprey
#

Instead, use event.forEachRecipe and delete the old recipe and make a new one with modified output

cursive geodeBOT
#

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())
  })
})
safe osprey
#

e is event, r is recipe

stray jewel
#

Ok thanks 👍