Interface RecipeEvents.CraftResult

Record Components:
player - who is crafting (null only for a crafter block, on the versions that have one)
recipe - the recipe, as the game knows it (recipe.getId() is its id)
input - the crafting grid
result - what the recipe makes (don't change it; interrupt with another stack instead)
Enclosing class:
RecipeEvents
Functional Interface:
This is a functional interface and can therefore be used as the assignment target for a lambda expression or method reference.

@FunctionalInterface public static interface RecipeEvents.CraftResult
A crafting recipe's result was worked out for the result slot of a crafting grid (the crafting table's, a player's inventory, or another menu built the same way), whenever its ingredients change. Interrupting with another stack shows and crafts that instead; with ItemStack.EMPTY, nothing can be crafted.

 RecipeEvents.CRAFT_RESULT.register((player, recipe, input, result) ->
         isLocked(player, recipe) ? EventResultHolder.interrupt(ItemStack.EMPTY) : EventResultHolder.pass());
 
This version has no crafter block, so the player is always there (the versions that have one pass null for it), and recipes and crafting grids are this version's own Recipe and CraftingContainer.
  • Method Summary

    Modifier and Type
    Method
    Description
    EventResultHolder<net.minecraft.world.item.ItemStack>
    onCraftResult(@Nullable net.minecraft.world.entity.player.Player player, net.minecraft.world.item.crafting.Recipe<?> recipe, net.minecraft.world.inventory.CraftingContainer input, net.minecraft.world.item.ItemStack result)
     
  • Method Details

    • onCraftResult

      EventResultHolder<net.minecraft.world.item.ItemStack> onCraftResult(@Nullable @Nullable net.minecraft.world.entity.player.Player player, net.minecraft.world.item.crafting.Recipe<?> recipe, net.minecraft.world.inventory.CraftingContainer input, net.minecraft.world.item.ItemStack result)