Package net.minecraft.item.crafting
Class ShapedRecipe
- java.lang.Object
-
- net.minecraft.item.crafting.ShapedRecipe
-
- All Implemented Interfaces:
ICraftingRecipe,IRecipe<CraftingInventory>,IShapedRecipe<CraftingInventory>
- Direct Known Subclasses:
MapExtendingRecipe
public class ShapedRecipe extends java.lang.Object implements ICraftingRecipe, IShapedRecipe<CraftingInventory>
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classShapedRecipe.Serializer
-
Field Summary
Fields Modifier and Type Field Description private java.lang.Stringgroupprivate intheightprivate ResourceLocationid(package private) static intMAX_HEIGHT(package private) static intMAX_WIDTHprivate NonNullList<Ingredient>recipeItemsprivate ItemStackresultprivate intwidth
-
Constructor Summary
Constructors Constructor Description ShapedRecipe(ResourceLocation p_i48162_1_, java.lang.String p_i48162_2_, int p_i48162_3_, int p_i48162_4_, NonNullList<Ingredient> p_i48162_5_, ItemStack p_i48162_6_)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description ItemStackassemble(CraftingInventory p_77572_1_)booleancanCraftInDimensions(int p_194133_1_, int p_194133_2_)private static NonNullList<Ingredient>dissolvePattern(java.lang.String[] p_192402_0_, java.util.Map<java.lang.String,Ingredient> p_192402_1_, int p_192402_2_, int p_192402_3_)private static intfirstNonSpace(java.lang.String p_194135_0_)java.lang.StringgetGroup()intgetHeight()ResourceLocationgetId()NonNullList<Ingredient>getIngredients()intgetRecipeHeight()intgetRecipeWidth()ItemStackgetResultItem()IRecipeSerializer<?>getSerializer()intgetWidth()static ItemStackitemFromJson(com.google.gson.JsonObject p_199798_0_)private static java.util.Map<java.lang.String,Ingredient>keyFromJson(com.google.gson.JsonObject p_192408_0_)private static intlastNonSpace(java.lang.String p_194136_0_)private booleanmatches(CraftingInventory p_77573_1_, int p_77573_2_, int p_77573_3_, boolean p_77573_4_)booleanmatches(CraftingInventory p_77569_1_, World p_77569_2_)private static java.lang.String[]patternFromJson(com.google.gson.JsonArray p_192407_0_)static voidsetCraftingSize(int width, int height)Expand the max width and height allowed in the deserializer.(package private) static java.lang.String[]shrink(java.lang.String... p_194134_0_)-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface net.minecraft.item.crafting.ICraftingRecipe
getType
-
Methods inherited from interface net.minecraft.item.crafting.IRecipe
getRemainingItems, getToastSymbol, isSpecial
-
-
-
-
Field Detail
-
MAX_WIDTH
static int MAX_WIDTH
-
MAX_HEIGHT
static int MAX_HEIGHT
-
width
private final int width
-
height
private final int height
-
recipeItems
private final NonNullList<Ingredient> recipeItems
-
result
private final ItemStack result
-
id
private final ResourceLocation id
-
group
private final java.lang.String group
-
-
Constructor Detail
-
ShapedRecipe
public ShapedRecipe(ResourceLocation p_i48162_1_, java.lang.String p_i48162_2_, int p_i48162_3_, int p_i48162_4_, NonNullList<Ingredient> p_i48162_5_, ItemStack p_i48162_6_)
-
-
Method Detail
-
setCraftingSize
public static void setCraftingSize(int width, int height)Expand the max width and height allowed in the deserializer. This should be called by modders who add custom crafting tables that are larger than the vanilla 3x3.- Parameters:
width- your max recipe widthheight- your max recipe height
-
getId
public ResourceLocation getId()
- Specified by:
getIdin interfaceIRecipe<CraftingInventory>
-
getSerializer
public IRecipeSerializer<?> getSerializer()
- Specified by:
getSerializerin interfaceIRecipe<CraftingInventory>
-
getGroup
public java.lang.String getGroup()
- Specified by:
getGroupin interfaceIRecipe<CraftingInventory>
-
getResultItem
public ItemStack getResultItem()
- Specified by:
getResultItemin interfaceIRecipe<CraftingInventory>
-
getIngredients
public NonNullList<Ingredient> getIngredients()
- Specified by:
getIngredientsin interfaceIRecipe<CraftingInventory>
-
canCraftInDimensions
public boolean canCraftInDimensions(int p_194133_1_, int p_194133_2_)- Specified by:
canCraftInDimensionsin interfaceIRecipe<CraftingInventory>
-
matches
public boolean matches(CraftingInventory p_77569_1_, World p_77569_2_)
- Specified by:
matchesin interfaceIRecipe<CraftingInventory>
-
matches
private boolean matches(CraftingInventory p_77573_1_, int p_77573_2_, int p_77573_3_, boolean p_77573_4_)
-
assemble
public ItemStack assemble(CraftingInventory p_77572_1_)
- Specified by:
assemblein interfaceIRecipe<CraftingInventory>
-
getWidth
public int getWidth()
-
getRecipeWidth
public int getRecipeWidth()
- Specified by:
getRecipeWidthin interfaceIShapedRecipe<CraftingInventory>
-
getHeight
public int getHeight()
-
getRecipeHeight
public int getRecipeHeight()
- Specified by:
getRecipeHeightin interfaceIShapedRecipe<CraftingInventory>
-
dissolvePattern
private static NonNullList<Ingredient> dissolvePattern(java.lang.String[] p_192402_0_, java.util.Map<java.lang.String,Ingredient> p_192402_1_, int p_192402_2_, int p_192402_3_)
-
shrink
static java.lang.String[] shrink(java.lang.String... p_194134_0_)
-
firstNonSpace
private static int firstNonSpace(java.lang.String p_194135_0_)
-
lastNonSpace
private static int lastNonSpace(java.lang.String p_194136_0_)
-
patternFromJson
private static java.lang.String[] patternFromJson(com.google.gson.JsonArray p_192407_0_)
-
keyFromJson
private static java.util.Map<java.lang.String,Ingredient> keyFromJson(com.google.gson.JsonObject p_192408_0_)
-
itemFromJson
public static ItemStack itemFromJson(com.google.gson.JsonObject p_199798_0_)
-
-