Class ShapedRecipe

java.lang.Object
net.minecraft.recipe.ShapedRecipe
All Implemented Interfaces:
CraftingRecipe, Recipe<CraftingInventory>
Direct Known Subclasses:
MapExtendingRecipe

public class ShapedRecipe extends Object implements CraftingRecipe
Mappings:
Namespace Name
official cgt
intermediary net/minecraft/class_1869
named net/minecraft/recipe/ShapedRecipe
  • Field Details

    • width

      final int width
      Mappings:
      Namespace Name Mixin selector
      official a Lcgt;a:I
      intermediary field_9055 Lnet/minecraft/class_1869;field_9055:I
      named width Lnet/minecraft/recipe/ShapedRecipe;width:I
    • height

      final int height
      Mappings:
      Namespace Name Mixin selector
      official b Lcgt;b:I
      intermediary field_9054 Lnet/minecraft/class_1869;field_9054:I
      named height Lnet/minecraft/recipe/ShapedRecipe;height:I
    • input

      final DefaultedList<Ingredient> input
      Mappings:
      Namespace Name Mixin selector
      official c Lcgt;c:Lhi;
      intermediary field_9052 Lnet/minecraft/class_1869;field_9052:Lnet/minecraft/class_2371;
      named input Lnet/minecraft/recipe/ShapedRecipe;input:Lnet/minecraft/util/collection/DefaultedList;
    • output

      final ItemStack output
      Mappings:
      Namespace Name Mixin selector
      official d Lcgt;d:Lcdt;
      intermediary field_9053 Lnet/minecraft/class_1869;field_9053:Lnet/minecraft/class_1799;
      named output Lnet/minecraft/recipe/ShapedRecipe;output:Lnet/minecraft/item/ItemStack;
    • id

      private final Identifier id
      Mappings:
      Namespace Name Mixin selector
      official e Lcgt;e:Lacf;
      intermediary field_9051 Lnet/minecraft/class_1869;field_9051:Lnet/minecraft/class_2960;
      named id Lnet/minecraft/recipe/ShapedRecipe;id:Lnet/minecraft/util/Identifier;
    • group

      final String group
      Mappings:
      Namespace Name Mixin selector
      official f Lcgt;f:Ljava/lang/String;
      intermediary field_9056 Lnet/minecraft/class_1869;field_9056:Ljava/lang/String;
      named group Lnet/minecraft/recipe/ShapedRecipe;group:Ljava/lang/String;
    • category

      final CraftingRecipeCategory category
      Mappings:
      Namespace Name Mixin selector
      official g Lcgt;g:Lcgf;
      intermediary field_40256 Lnet/minecraft/class_1869;field_40256:Lnet/minecraft/class_7710;
      named category Lnet/minecraft/recipe/ShapedRecipe;category:Lnet/minecraft/recipe/book/CraftingRecipeCategory;
  • Constructor Details

    • ShapedRecipe

      public ShapedRecipe(Identifier id, String group, CraftingRecipeCategory category, int width, int height, DefaultedList<Ingredient> input, ItemStack output)
      Mappings:
      Namespace Name Mixin selector
      official <init> Lcgt;<init>(Lacf;Ljava/lang/String;Lcgf;IILhi;Lcdt;)V
      intermediary <init> Lnet/minecraft/class_1869;<init>(Lnet/minecraft/class_2960;Ljava/lang/String;Lnet/minecraft/class_7710;IILnet/minecraft/class_2371;Lnet/minecraft/class_1799;)V
      named <init> Lnet/minecraft/recipe/ShapedRecipe;<init>(Lnet/minecraft/util/Identifier;Ljava/lang/String;Lnet/minecraft/recipe/book/CraftingRecipeCategory;IILnet/minecraft/util/collection/DefaultedList;Lnet/minecraft/item/ItemStack;)V
  • Method Details

    • getId

      public Identifier getId()
      Returns the ID of this recipe.
      Specified by:
      getId in interface Recipe<CraftingInventory>
      Returns:
      the ID of this recipe
      Mappings:
      Namespace Name Mixin selector
      official f Lcgo;f()Lacf;
      intermediary method_8114 Lnet/minecraft/class_1860;method_8114()Lnet/minecraft/class_2960;
      named getId Lnet/minecraft/recipe/Recipe;getId()Lnet/minecraft/util/Identifier;
    • getSerializer

      public RecipeSerializer<?> getSerializer()
      Returns the serializer associated with this recipe.
      Specified by:
      getSerializer in interface Recipe<CraftingInventory>
      Returns:
      the serializer associated with this recipe
      Mappings:
      Namespace Name Mixin selector
      official X_ Lcgo;X_()Lcgq;
      intermediary method_8119 Lnet/minecraft/class_1860;method_8119()Lnet/minecraft/class_1865;
      named getSerializer Lnet/minecraft/recipe/Recipe;getSerializer()Lnet/minecraft/recipe/RecipeSerializer;
    • getGroup

      public String getGroup()
      Returns a group this recipe belongs in, or an empty string. This is only used by the recipe book.

      The group string is arbitrary, and is not rendered anywhere; in the recipe book, recipes with the same group will belong to the same cell in the grid of recipes. If the string is empty, this recipe will belong to its own cell.

      Specified by:
      getGroup in interface Recipe<CraftingInventory>
      Returns:
      a group this recipe belongs in, or an empty string
      Mappings:
      Namespace Name Mixin selector
      official d Lcgo;d()Ljava/lang/String;
      intermediary method_8112 Lnet/minecraft/class_1860;method_8112()Ljava/lang/String;
      named getGroup Lnet/minecraft/recipe/Recipe;getGroup()Ljava/lang/String;
    • getCategory

      public CraftingRecipeCategory getCategory()
      Specified by:
      getCategory in interface CraftingRecipe
      Mappings:
      Namespace Name Mixin selector
      official e Lcgg;e()Lcgf;
      intermediary method_45441 Lnet/minecraft/class_3955;method_45441()Lnet/minecraft/class_7710;
      named getCategory Lnet/minecraft/recipe/CraftingRecipe;getCategory()Lnet/minecraft/recipe/book/CraftingRecipeCategory;
    • getOutput

      public ItemStack getOutput()
      Returns a preview of the recipe's output.

      The returned stack should not be modified. To obtain the actual output, call Recipe.craft(Inventory).

      Specified by:
      getOutput in interface Recipe<CraftingInventory>
      Returns:
      a preview of the recipe's output
      Mappings:
      Namespace Name Mixin selector
      official c Lcgo;c()Lcdt;
      intermediary method_8110 Lnet/minecraft/class_1860;method_8110()Lnet/minecraft/class_1799;
      named getOutput Lnet/minecraft/recipe/Recipe;getOutput()Lnet/minecraft/item/ItemStack;
    • getIngredients

      public DefaultedList<Ingredient> getIngredients()
      Returns the ingredients accepted as inputs for this recipe. Used by the recipe book when displaying a ghost form of this recipe on the crafting grid as well as for previewing the possible inputs in the book itself.
      Specified by:
      getIngredients in interface Recipe<CraftingInventory>
      Returns:
      the ingredients accepted as inputs for this recipe
      Mappings:
      Namespace Name Mixin selector
      official a Lcgo;a()Lhi;
      intermediary method_8117 Lnet/minecraft/class_1860;method_8117()Lnet/minecraft/class_2371;
      named getIngredients Lnet/minecraft/recipe/Recipe;getIngredients()Lnet/minecraft/util/collection/DefaultedList;
    • fits

      public boolean fits(int width, int height)
      Returns whether this recipe will fit into the given grid size.

      This is currently only used by recipe book.

      Specified by:
      fits in interface Recipe<CraftingInventory>
      Parameters:
      width - the width of the input inventory
      height - the height of the input inventory
      Returns:
      whether this recipe will fit into the given grid size
      Mappings:
      Namespace Name Mixin selector
      official a Lcgo;a(II)Z
      intermediary method_8113 Lnet/minecraft/class_1860;method_8113(II)Z
      named fits Lnet/minecraft/recipe/Recipe;fits(II)Z
    • matches

      public boolean matches(CraftingInventory craftingInventory, World world)
      Description copied from interface: Recipe
      Returns whether this recipe matches the contents inside the inventory in the given world.

      The world currently is only used by the map cloning recipe to prevent duplication of explorer maps.

      Specified by:
      matches in interface Recipe<CraftingInventory>
      Parameters:
      craftingInventory - the input inventory
      world - the input world
      Returns:
      whether this recipe matches the contents inside the inventory in the given world
      Mappings:
      Namespace Name Mixin selector
      official a Lcgt;a(Lbzu;Lcjw;)Z
      intermediary method_17728 Lnet/minecraft/class_1869;method_17728(Lnet/minecraft/class_1715;Lnet/minecraft/class_1937;)Z
      named matches Lnet/minecraft/recipe/ShapedRecipe;matches(Lnet/minecraft/inventory/CraftingInventory;Lnet/minecraft/world/World;)Z
    • matchesPattern

      private boolean matchesPattern(CraftingInventory inv, int offsetX, int offsetY, boolean flipped)
      Mappings:
      Namespace Name Mixin selector
      official a Lcgt;a(Lbzu;IIZ)Z
      intermediary method_8161 Lnet/minecraft/class_1869;method_8161(Lnet/minecraft/class_1715;IIZ)Z
      named matchesPattern Lnet/minecraft/recipe/ShapedRecipe;matchesPattern(Lnet/minecraft/inventory/CraftingInventory;IIZ)Z
    • craft

      public ItemStack craft(CraftingInventory craftingInventory)
      Description copied from interface: Recipe
      Crafts this recipe.

      This method does not perform side effects on the inventory.

      This method should return a new item stack on each call.

      Specified by:
      craft in interface Recipe<CraftingInventory>
      Parameters:
      craftingInventory - the input inventory
      Returns:
      the resulting item stack
      Mappings:
      Namespace Name Mixin selector
      official a Lcgt;a(Lbzu;)Lcdt;
      intermediary method_17727 Lnet/minecraft/class_1869;method_17727(Lnet/minecraft/class_1715;)Lnet/minecraft/class_1799;
      named craft Lnet/minecraft/recipe/ShapedRecipe;craft(Lnet/minecraft/inventory/CraftingInventory;)Lnet/minecraft/item/ItemStack;
    • getWidth

      public int getWidth()
      Mappings:
      Namespace Name Mixin selector
      official k Lcgt;k()I
      intermediary method_8150 Lnet/minecraft/class_1869;method_8150()I
      named getWidth Lnet/minecraft/recipe/ShapedRecipe;getWidth()I
    • getHeight

      public int getHeight()
      Mappings:
      Namespace Name Mixin selector
      official l Lcgt;l()I
      intermediary method_8158 Lnet/minecraft/class_1869;method_8158()I
      named getHeight Lnet/minecraft/recipe/ShapedRecipe;getHeight()I
    • createPatternMatrix

      static DefaultedList<Ingredient> createPatternMatrix(String[] pattern, Map<String,Ingredient> symbols, int width, int height)
      Compiles a pattern and series of symbols into a list of ingredients (the matrix) suitable for matching against a crafting grid.
      Mappings:
      Namespace Name Mixin selector
      official a Lcgt;a([Ljava/lang/String;Ljava/util/Map;II)Lhi;
      intermediary method_8148 Lnet/minecraft/class_1869;method_8148([Ljava/lang/String;Ljava/util/Map;II)Lnet/minecraft/class_2371;
      named createPatternMatrix Lnet/minecraft/recipe/ShapedRecipe;createPatternMatrix([Ljava/lang/String;Ljava/util/Map;II)Lnet/minecraft/util/collection/DefaultedList;
    • removePadding

      static String[] removePadding(String[] pattern)
      Removes empty space from around the recipe pattern.

      Turns patterns such as:

       
       "   o"
       "   a"
       "    "
       
       
      Into:
       
       "o"
       "a"
       
       
      Returns:
      a new recipe pattern with all leading and trailing empty rows/columns removed
      Mappings:
      Namespace Name Mixin selector
      official a Lcgt;a([Ljava/lang/String;)[Ljava/lang/String;
      intermediary method_8146 Lnet/minecraft/class_1869;method_8146([Ljava/lang/String;)[Ljava/lang/String;
      named removePadding Lnet/minecraft/recipe/ShapedRecipe;removePadding([Ljava/lang/String;)[Ljava/lang/String;
    • isEmpty

      public boolean isEmpty()
      Returns whether this recipe has no ingredient or has any empty ingredient. The recipe book uses this to ignore recipes for display.
      Specified by:
      isEmpty in interface Recipe<CraftingInventory>
      Returns:
      whether this recipe has no ingredient or has any empty ingredient
      Mappings:
      Namespace Name Mixin selector
      official j Lcgo;j()Z
      intermediary method_31584 Lnet/minecraft/class_1860;method_31584()Z
      named isEmpty Lnet/minecraft/recipe/Recipe;isEmpty()Z
    • findFirstSymbol

      private static int findFirstSymbol(String line)
      Mappings:
      Namespace Name Mixin selector
      official a Lcgt;a(Ljava/lang/String;)I
      intermediary method_8151 Lnet/minecraft/class_1869;method_8151(Ljava/lang/String;)I
      named findFirstSymbol Lnet/minecraft/recipe/ShapedRecipe;findFirstSymbol(Ljava/lang/String;)I
    • findLastSymbol

      private static int findLastSymbol(String pattern)
      Mappings:
      Namespace Name Mixin selector
      official b Lcgt;b(Ljava/lang/String;)I
      intermediary method_8153 Lnet/minecraft/class_1869;method_8153(Ljava/lang/String;)I
      named findLastSymbol Lnet/minecraft/recipe/ShapedRecipe;findLastSymbol(Ljava/lang/String;)I
    • getPattern

      static String[] getPattern(JsonArray json)
      Mappings:
      Namespace Name Mixin selector
      official a Lcgt;a(Lcom/google/gson/JsonArray;)[Ljava/lang/String;
      intermediary method_8145 Lnet/minecraft/class_1869;method_8145(Lcom/google/gson/JsonArray;)[Ljava/lang/String;
      named getPattern Lnet/minecraft/recipe/ShapedRecipe;getPattern(Lcom/google/gson/JsonArray;)[Ljava/lang/String;
    • readSymbols

      static Map<String,Ingredient> readSymbols(JsonObject json)
      Reads the pattern symbols.
      Returns:
      a mapping from a symbol to the ingredient it represents
      Mappings:
      Namespace Name Mixin selector
      official c Lcgt;c(Lcom/google/gson/JsonObject;)Ljava/util/Map;
      intermediary method_8157 Lnet/minecraft/class_1869;method_8157(Lcom/google/gson/JsonObject;)Ljava/util/Map;
      named readSymbols Lnet/minecraft/recipe/ShapedRecipe;readSymbols(Lcom/google/gson/JsonObject;)Ljava/util/Map;
    • outputFromJson

      public static ItemStack outputFromJson(JsonObject json)
      Mappings:
      Namespace Name Mixin selector
      official a Lcgt;a(Lcom/google/gson/JsonObject;)Lcdt;
      intermediary method_35228 Lnet/minecraft/class_1869;method_35228(Lcom/google/gson/JsonObject;)Lnet/minecraft/class_1799;
      named outputFromJson Lnet/minecraft/recipe/ShapedRecipe;outputFromJson(Lcom/google/gson/JsonObject;)Lnet/minecraft/item/ItemStack;
    • getItem

      public static Item getItem(JsonObject json)
      Mappings:
      Namespace Name Mixin selector
      official b Lcgt;b(Lcom/google/gson/JsonObject;)Lcdp;
      intermediary method_8155 Lnet/minecraft/class_1869;method_8155(Lcom/google/gson/JsonObject;)Lnet/minecraft/class_1792;
      named getItem Lnet/minecraft/recipe/ShapedRecipe;getItem(Lcom/google/gson/JsonObject;)Lnet/minecraft/item/Item;