Recipe mappings (#1325)

* Recipe mappings

Co-authored-by: Joseph Burton <burtonjae@hotmail.co.uk>

* Update mappings/net/minecraft/recipe/Recipe.mapping

Co-authored-by: haykam821 <24855774+haykam821@users.noreply.github.com>

* Update mappings/net/minecraft/recipe/Recipe.mapping

Co-authored-by: haykam821 <24855774+haykam821@users.noreply.github.com>

* Apply suggestions from code review

Co-authored-by: haykam821 <24855774+haykam821@users.noreply.github.com>

* Apply suggestions from code review

Co-authored-by: YanisBft <doublecraft.official@gmail.com>

* Apply suggestions from code review

Co-authored-by: Juuxel <6596629+Juuxel@users.noreply.github.com>
Co-authored-by: liach <7806504+liach@users.noreply.github.com>
Co-authored-by: YanisBft <doublecraft.official@gmail.com>

* Update mappings/net/minecraft/recipe/ShapedRecipe.mapping

Co-authored-by: liach <7806504+liach@users.noreply.github.com>

* Update mappings/net/minecraft/entity/player/PlayerInventory.mapping

Co-authored-by: liach <7806504+liach@users.noreply.github.com>

* Update mappings/net/minecraft/recipe/Recipe.mapping

Co-authored-by: liach <7806504+liach@users.noreply.github.com>

* Update mappings/net/minecraft/recipe/RecipeMatcher.mapping

Co-authored-by: liach <7806504+liach@users.noreply.github.com>

* Update mappings/net/minecraft/recipe/RecipeMatcher.mapping

Co-authored-by: enbrain <69905075+enbrain@users.noreply.github.com>

* Update mappings/net/minecraft/recipe/RecipeMatcher.mapping

Co-authored-by: enbrain <69905075+enbrain@users.noreply.github.com>

Co-authored-by: Joseph Burton <burtonjae@hotmail.co.uk>
Co-authored-by: haykam821 <24855774+haykam821@users.noreply.github.com>
Co-authored-by: YanisBft <doublecraft.official@gmail.com>
Co-authored-by: Juuxel <6596629+Juuxel@users.noreply.github.com>
Co-authored-by: liach <7806504+liach@users.noreply.github.com>
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: enbrain <69905075+enbrain@users.noreply.github.com>
This commit is contained in:
­Sollace 2021-04-12 14:13:07 +02:00 committed by GitHub
parent 00d516c67e
commit d5b7231967
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
7 changed files with 190 additions and 68 deletions

View File

@ -43,6 +43,10 @@ CLASS net/minecraft/class_1661 net/minecraft/entity/player/PlayerInventory
METHOD method_7370 getBlockBreakingSpeed (Lnet/minecraft/class_2680;)F METHOD method_7370 getBlockBreakingSpeed (Lnet/minecraft/class_2680;)F
ARG 1 block ARG 1 block
METHOD method_7371 indexOf (Lnet/minecraft/class_1799;)I METHOD method_7371 indexOf (Lnet/minecraft/class_1799;)I
COMMENT Given the item stack to search for, returns the equivalent slot index with a matching stack that is all of:
COMMENT not damaged, not enchanted, and not renamed.
COMMENT
COMMENT @return the index where a matching stack was found, or {@value #NOT_FOUND}
ARG 1 stack ARG 1 stack
METHOD method_7372 getArmorStack (I)Lnet/minecraft/class_1799; METHOD method_7372 getArmorStack (I)Lnet/minecraft/class_1799;
ARG 1 slot ARG 1 slot

View File

@ -24,7 +24,7 @@ CLASS net/minecraft/class_1856 net/minecraft/recipe/Ingredient
METHOD method_8094 (Lnet/minecraft/class_1799;)Lnet/minecraft/class_1856$class_1857; METHOD method_8094 (Lnet/minecraft/class_1799;)Lnet/minecraft/class_1856$class_1857;
ARG 0 stack ARG 0 stack
METHOD method_8096 cacheMatchingStacks ()V METHOD method_8096 cacheMatchingStacks ()V
METHOD method_8100 getIds ()Lit/unimi/dsi/fastutil/ints/IntList; METHOD method_8100 getMatchingItemIds ()Lit/unimi/dsi/fastutil/ints/IntList;
METHOD method_8101 ofStacks ([Lnet/minecraft/class_1799;)Lnet/minecraft/class_1856; METHOD method_8101 ofStacks ([Lnet/minecraft/class_1799;)Lnet/minecraft/class_1856;
ARG 0 stacks ARG 0 stacks
METHOD method_8102 fromJson (Lcom/google/gson/JsonElement;)Lnet/minecraft/class_1856; METHOD method_8102 fromJson (Lcom/google/gson/JsonElement;)Lnet/minecraft/class_1856;

View File

@ -1,10 +1,10 @@
CLASS net/minecraft/class_2955 net/minecraft/recipe/InputSlotFiller CLASS net/minecraft/class_2955 net/minecraft/recipe/InputSlotFiller
FIELD field_13347 recipeFinder Lnet/minecraft/class_1662; FIELD field_13347 matcher Lnet/minecraft/class_1662;
FIELD field_13348 craftingScreenHandler Lnet/minecraft/class_1729; FIELD field_13348 handler Lnet/minecraft/class_1729;
FIELD field_13349 LOGGER Lorg/apache/logging/log4j/Logger; FIELD field_13349 LOGGER Lorg/apache/logging/log4j/Logger;
FIELD field_13350 inventory Lnet/minecraft/class_1661; FIELD field_13350 inventory Lnet/minecraft/class_1661;
METHOD <init> (Lnet/minecraft/class_1729;)V METHOD <init> (Lnet/minecraft/class_1729;)V
ARG 1 craftingScreenHandler ARG 1 handler
METHOD method_12819 getAmountToFill (ZIZ)I METHOD method_12819 getAmountToFill (ZIZ)I
ARG 1 craftAll ARG 1 craftAll
ARG 2 limit ARG 2 limit

View File

@ -1,22 +1,43 @@
CLASS net/minecraft/class_1860 net/minecraft/recipe/Recipe CLASS net/minecraft/class_1860 net/minecraft/recipe/Recipe
METHOD method_17447 getRecipeKindIcon ()Lnet/minecraft/class_1799; METHOD method_17447 createIcon ()Lnet/minecraft/class_1799;
COMMENT Creates the stack that is displayed on the recipe book tab containing this recipe, and on a toast when a recipe of this type is unlocked.
COMMENT Used in conjunction with {@link #getGroup()}.
METHOD method_17716 getType ()Lnet/minecraft/class_3956; METHOD method_17716 getType ()Lnet/minecraft/class_3956;
METHOD method_31583 (Lnet/minecraft/class_1856;)Z METHOD method_31583 (Lnet/minecraft/class_1856;)Z
ARG 0 ingredient ARG 0 ingredient
METHOD method_31584 isEmpty ()Z METHOD method_31584 isEmpty ()Z
METHOD method_8110 getOutput ()Lnet/minecraft/class_1799; METHOD method_8110 getOutput ()Lnet/minecraft/class_1799;
METHOD method_8111 getRemainingStacks (Lnet/minecraft/class_1263;)Lnet/minecraft/class_2371; METHOD method_8111 getRemainder (Lnet/minecraft/class_1263;)Lnet/minecraft/class_2371;
COMMENT Returns the remaining stacks to be left in the crafting grid after crafting is complete.
COMMENT Should return the same number of items as the input grid contains in the same order they're expected
COMMENT to appear in that grid.
COMMENT
COMMENT @implSpec Default implementation simply returns a grid of all empty stacks where all stacks from the
COMMENT input grid have been replaced with the result of calling {@link Item#getRecipeRemainder()} on them.
ARG 1 inventory ARG 1 inventory
METHOD method_8112 getGroup ()Ljava/lang/String; METHOD method_8112 getGroup ()Ljava/lang/String;
COMMENT Optional group this recipe belongs in. Used to group recipes into different categories by the recipe book.
METHOD method_8113 fits (II)Z METHOD method_8113 fits (II)Z
COMMENT Determines whether this recipe's pattern will fit into the available crafting area.
ARG 1 width ARG 1 width
ARG 2 height ARG 2 height
METHOD method_8114 getId ()Lnet/minecraft/class_2960; METHOD method_8114 getId ()Lnet/minecraft/class_2960;
METHOD method_8115 matches (Lnet/minecraft/class_1263;Lnet/minecraft/class_1937;)Z METHOD method_8115 matches (Lnet/minecraft/class_1263;Lnet/minecraft/class_1937;)Z
ARG 1 inv COMMENT Determines whether this recipe matches the contents currently placed inside the available crafting grid.
ARG 1 inventory
ARG 2 world ARG 2 world
METHOD method_8116 craft (Lnet/minecraft/class_1263;)Lnet/minecraft/class_1799; METHOD method_8116 craft (Lnet/minecraft/class_1263;)Lnet/minecraft/class_1799;
ARG 1 inv COMMENT Crafts this recipe.
METHOD method_8117 getPreviewInputs ()Lnet/minecraft/class_2371; COMMENT
COMMENT <p>This method may perform side effects on the {@code inventory} argument.</p>
COMMENT
COMMENT <p>This method should return a new item stack on each call.</p>
COMMENT
COMMENT @return the resulting item stack
ARG 1 inventory
METHOD method_8117 getIngredients ()Lnet/minecraft/class_2371;
COMMENT The ingredients accepted as inputs for this recipe. Used by the recipe book
COMMENT when displaying a ghost form of this recipe on the crafting grid as well as for
COMMENT previewing the possible inputs in the book itself.
METHOD method_8118 isIgnoredInRecipeBook ()Z METHOD method_8118 isIgnoredInRecipeBook ()Z
METHOD method_8119 getSerializer ()Lnet/minecraft/class_1865; METHOD method_8119 getSerializer ()Lnet/minecraft/class_1865;

View File

@ -1,48 +0,0 @@
CLASS net/minecraft/class_1662 net/minecraft/recipe/RecipeFinder
FIELD field_7550 idToAmountMap Lit/unimi/dsi/fastutil/ints/Int2IntMap;
METHOD method_20478 addItem (Lnet/minecraft/class_1799;I)V
ARG 1 stack
ARG 2 count
METHOD method_7400 addItem (Lnet/minecraft/class_1799;)V
ARG 1 stack
METHOD method_7401 addItem (II)V
ARG 1 id
ARG 2 amount
METHOD method_7402 findRecipe (Lnet/minecraft/class_1860;Lit/unimi/dsi/fastutil/ints/IntList;)Z
ARG 1 recipe
ARG 2 outMatchingInputIds
METHOD method_7403 countRecipeCrafts (Lnet/minecraft/class_1860;ILit/unimi/dsi/fastutil/ints/IntList;)I
ARG 1 recipe
ARG 2 limit
ARG 3 outMatchingInputIds
METHOD method_7404 addNormalItem (Lnet/minecraft/class_1799;)V
ARG 1 stack
METHOD method_7405 getStackFromId (I)Lnet/minecraft/class_1799;
ARG 0 id
METHOD method_7406 findRecipe (Lnet/minecraft/class_1860;Lit/unimi/dsi/fastutil/ints/IntList;I)Z
ARG 1 recipe
ARG 2 outMatchingInputIds
ARG 3 amount
METHOD method_7407 countRecipeCrafts (Lnet/minecraft/class_1860;Lit/unimi/dsi/fastutil/ints/IntList;)I
ARG 1 recipe
ARG 2 outMatchingInputIds
METHOD method_7408 getItemId (Lnet/minecraft/class_1799;)I
ARG 0 stack
METHOD method_7409 clear ()V
METHOD method_7410 contains (I)Z
ARG 1 id
METHOD method_7411 take (II)I
ARG 1 id
ARG 2 amount
CLASS class_1663 Filter
FIELD field_7552 ingredients Ljava/util/List;
FIELD field_7555 recipe Lnet/minecraft/class_1860;
FIELD field_7556 ingredientCount I
METHOD <init> (Lnet/minecraft/class_1662;Lnet/minecraft/class_1860;)V
ARG 2 recipe
METHOD method_7417 find (ILit/unimi/dsi/fastutil/ints/IntList;)Z
ARG 1 amount
ARG 2 outMatchingInputIds
METHOD method_7427 countCrafts (ILit/unimi/dsi/fastutil/ints/IntList;)I
ARG 1 limit
ARG 2 outMatchingInputIds

View File

@ -0,0 +1,120 @@
CLASS net/minecraft/class_1662 net/minecraft/recipe/RecipeMatcher
COMMENT Matching class that matches a recipe to its required resources.
COMMENT This specifically does not check patterns (See {@link ShapedRecipe} for that).
FIELD field_7550 inputs Lit/unimi/dsi/fastutil/ints/Int2IntMap;
METHOD method_20478 addInput (Lnet/minecraft/class_1799;I)V
COMMENT Adds an item stack to the pool of available resources.
ARG 1 stack
ARG 2 maxCount
METHOD method_7400 addInput (Lnet/minecraft/class_1799;)V
COMMENT Adds a full item stack to the pool of available resources.
COMMENT
COMMENT <p>This is equivalent to calling {@code addInput(stack, Item.DEFAULT_MAX_COUNT)}.</p>
ARG 1 stack
METHOD method_7401 addInput (II)V
COMMENT Adds an input to be used for recipe matching.
ARG 1 itemId
COMMENT the raw ID of the item to match
ARG 2 count
COMMENT the item's count
METHOD method_7402 match (Lnet/minecraft/class_1860;Lit/unimi/dsi/fastutil/ints/IntList;)Z
COMMENT Attempts to match the recipe against the collected inputs.
COMMENT Assumes only one output is required.
ARG 1 recipe
COMMENT the recipe to match against
ARG 2 output
COMMENT optional output list of item ids that were matched whilst evaluating the recipe conditions
METHOD method_7403 countCrafts (Lnet/minecraft/class_1860;ILit/unimi/dsi/fastutil/ints/IntList;)I
COMMENT Determines the number of crafts that can be produced for a recipe using the
COMMENT collected resources available to this crafter.
ARG 1 recipe
COMMENT the recipe to match against
ARG 2 limit
ARG 3 output
COMMENT optional output list of item ids that were matched whilst evaluating the recipe conditions
METHOD method_7404 addUnenchantedInput (Lnet/minecraft/class_1799;)V
COMMENT Adds a full item stack to the pool of available resources.
COMMENT
COMMENT <p>This is equivalent to calling {@code addInput(stack, Item.DEFAULT_MAX_COUNT)}.</p>
ARG 1 stack
METHOD method_7405 getStackFromId (I)Lnet/minecraft/class_1799;
ARG 0 itemId
METHOD method_7406 match (Lnet/minecraft/class_1860;Lit/unimi/dsi/fastutil/ints/IntList;I)Z
COMMENT Attempts to match the recipe against the collected inputs. Will only succeed if there has been enough
COMMENT resources gathered to produce the requested number of outputs.
ARG 1 recipe
COMMENT the recipe to match against
ARG 2 output
COMMENT optional output list of item ids that were matched whilst evaluating the recipe conditions
ARG 3 multiplier
COMMENT the number of expected outputs
METHOD method_7407 countCrafts (Lnet/minecraft/class_1860;Lit/unimi/dsi/fastutil/ints/IntList;)I
COMMENT Determines the number of crafts that can be produced for a recipe using the
COMMENT collected resources available to this crafter.
ARG 1 recipe
COMMENT the recipe to match against
ARG 2 output
COMMENT optional output list of item ids that were matched whilst evaluating the recipe conditions
METHOD method_7408 getItemId (Lnet/minecraft/class_1799;)I
ARG 0 stack
METHOD method_7409 clear ()V
METHOD method_7410 contains (I)Z
COMMENT Determines whether a raw item id is present in the pool of crafting resources.
ARG 1 itemId
METHOD method_7411 consume (II)I
COMMENT Consumes a resource from the pool of available items.
ARG 1 itemId
COMMENT the raw id of the item being consumed
ARG 2 count
COMMENT the number of times that item must be consumed
CLASS class_1663 Matcher
FIELD field_7551 requiredItems [I
FIELD field_7552 ingredients Ljava/util/List;
FIELD field_7553 totalRequiredItems I
FIELD field_7555 recipe Lnet/minecraft/class_1860;
FIELD field_7556 totalIngredients I
FIELD field_7557 ingredientItemLookup Lit/unimi/dsi/fastutil/ints/IntList;
FIELD field_7558 requirementsMatrix Ljava/util/BitSet;
METHOD <init> (Lnet/minecraft/class_1662;Lnet/minecraft/class_1860;)V
ARG 1 recipe
METHOD method_7413 addRequirement (ZI)V
ARG 1 reversed
ARG 2 itemId
METHOD method_7414 flipRequirement (ZII)V
ARG 1 reversed
ARG 2 itemIndex
ARG 3 ingredientIndex
METHOD method_7415 getMaximumCrafts ()I
METHOD method_7416 getRequirement (I)Z
ARG 1 itemId
METHOD method_7417 match (ILit/unimi/dsi/fastutil/ints/IntList;)Z
ARG 1 multiplier
ARG 2 output
METHOD method_7418 needsRequirement (ZII)Z
ARG 1 reversed
ARG 2 itemIndex
ARG 3 ingredientIndex
METHOD method_7419 getRequirementIndex (I)I
ARG 1 itemId
METHOD method_7420 getRequirementIndex (ZII)I
ARG 1 reversed
ARG 2 itemIndex
ARG 3 ingredientIndex
METHOD method_7421 unfulfillRequirement (I)V
ARG 1 itemId
METHOD method_7422 createItemRequirementList ()[I
METHOD method_7423 checkRequirements (I)Z
ARG 1 multiplier
METHOD method_7424 getRequirementIndex (ZI)I
ARG 1 reversed
ARG 2 itemId
METHOD method_7425 checkRequirement (ZII)Z
ARG 1 reversed
ARG 2 itemIndex
ARG 3 ingredientIndex
METHOD method_7426 isRequirementUnfulfilled (ZI)Z
ARG 1 reversed
ARG 2 itemId
METHOD method_7427 countCrafts (ILit/unimi/dsi/fastutil/ints/IntList;)I
ARG 1 minimum
ARG 2 output

View File

@ -1,6 +1,6 @@
CLASS net/minecraft/class_1869 net/minecraft/recipe/ShapedRecipe CLASS net/minecraft/class_1869 net/minecraft/recipe/ShapedRecipe
FIELD field_9051 id Lnet/minecraft/class_2960; FIELD field_9051 id Lnet/minecraft/class_2960;
FIELD field_9052 inputs Lnet/minecraft/class_2371; FIELD field_9052 input Lnet/minecraft/class_2371;
FIELD field_9053 output Lnet/minecraft/class_1799; FIELD field_9053 output Lnet/minecraft/class_1799;
FIELD field_9054 height I FIELD field_9054 height I
FIELD field_9055 width I FIELD field_9055 width I
@ -10,7 +10,7 @@ CLASS net/minecraft/class_1869 net/minecraft/recipe/ShapedRecipe
ARG 2 group ARG 2 group
ARG 3 width ARG 3 width
ARG 4 height ARG 4 height
ARG 5 ingredients ARG 5 input
ARG 6 output ARG 6 output
METHOD method_31585 (Lnet/minecraft/class_1856;)Z METHOD method_31585 (Lnet/minecraft/class_1856;)Z
ARG 0 ingredient ARG 0 ingredient
@ -20,25 +20,50 @@ CLASS net/minecraft/class_1869 net/minecraft/recipe/ShapedRecipe
ARG 0 json ARG 0 json
METHOD method_8145 getPattern (Lcom/google/gson/JsonArray;)[Ljava/lang/String; METHOD method_8145 getPattern (Lcom/google/gson/JsonArray;)[Ljava/lang/String;
ARG 0 json ARG 0 json
METHOD method_8146 combinePattern ([Ljava/lang/String;)[Ljava/lang/String; METHOD method_8146 removePadding ([Ljava/lang/String;)[Ljava/lang/String;
ARG 0 lines COMMENT Removes empty space from around the recipe pattern.
METHOD method_8148 getIngredients ([Ljava/lang/String;Ljava/util/Map;II)Lnet/minecraft/class_2371; COMMENT
COMMENT <p>Turns patterns such as:</p>
COMMENT <pre>
COMMENT {@code
COMMENT " o"
COMMENT " a"
COMMENT " "
COMMENT }
COMMENT </pre>
COMMENT Into:
COMMENT <pre>
COMMENT {@code
COMMENT "o"
COMMENT "a"
COMMENT }
COMMENT </pre>
COMMENT
COMMENT @return a new recipe pattern with all leading and trailing empty rows/columns removed
ARG 0 pattern ARG 0 pattern
ARG 1 key METHOD method_8148 createPatternMatrix ([Ljava/lang/String;Ljava/util/Map;II)Lnet/minecraft/class_2371;
COMMENT Compiles a pattern and series of symbols into a list of ingredients (the matrix) suitable for matching
COMMENT against a crafting grid.
ARG 0 pattern
ARG 1 symbols
ARG 2 width ARG 2 width
ARG 3 height ARG 3 height
METHOD method_8150 getWidth ()I METHOD method_8150 getWidth ()I
METHOD method_8151 findNextIngredient (Ljava/lang/String;)I METHOD method_8151 findFirstSymbol (Ljava/lang/String;)I
ARG 0 pattern ARG 0 line
METHOD method_8153 findNextIngredientReverse (Ljava/lang/String;)I METHOD method_8153 findLastSymbol (Ljava/lang/String;)I
ARG 0 pattern ARG 0 pattern
METHOD method_8155 getItemStack (Lcom/google/gson/JsonObject;)Lnet/minecraft/class_1792; METHOD method_8155 getItemStack (Lcom/google/gson/JsonObject;)Lnet/minecraft/class_1792;
ARG 0 json ARG 0 json
METHOD method_8157 getComponents (Lcom/google/gson/JsonObject;)Ljava/util/Map; METHOD method_8157 readSymbols (Lcom/google/gson/JsonObject;)Ljava/util/Map;
COMMENT Reads the pattern symbols.
COMMENT
COMMENT @return a mapping from a symbol to the ingredient it represents
ARG 0 json ARG 0 json
METHOD method_8158 getHeight ()I METHOD method_8158 getHeight ()I
METHOD method_8161 matchesSmall (Lnet/minecraft/class_1715;IIZ)Z METHOD method_8161 matchesPattern (Lnet/minecraft/class_1715;IIZ)Z
ARG 1 inv ARG 1 inv
ARG 2 offsetX ARG 2 offsetX
ARG 3 offsetY ARG 3 offsetY
ARG 4 flipped
CLASS class_1870 Serializer CLASS class_1870 Serializer