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 class
ShapedRecipe.Serializer
-
Field Summary
Fields Modifier and Type Field Description private java.lang.String
group
private int
height
private ResourceLocation
id
(package private) static int
MAX_HEIGHT
(package private) static int
MAX_WIDTH
private NonNullList<Ingredient>
recipeItems
private ItemStack
result
private int
width
-
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 ItemStack
assemble(CraftingInventory p_77572_1_)
boolean
canCraftInDimensions(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 int
firstNonSpace(java.lang.String p_194135_0_)
java.lang.String
getGroup()
int
getHeight()
ResourceLocation
getId()
NonNullList<Ingredient>
getIngredients()
int
getRecipeHeight()
int
getRecipeWidth()
ItemStack
getResultItem()
IRecipeSerializer<?>
getSerializer()
int
getWidth()
static ItemStack
itemFromJson(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 int
lastNonSpace(java.lang.String p_194136_0_)
private boolean
matches(CraftingInventory p_77573_1_, int p_77573_2_, int p_77573_3_, boolean p_77573_4_)
boolean
matches(CraftingInventory p_77569_1_, World p_77569_2_)
private static java.lang.String[]
patternFromJson(com.google.gson.JsonArray p_192407_0_)
static void
setCraftingSize(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:
getId
in interfaceIRecipe<CraftingInventory>
-
getSerializer
public IRecipeSerializer<?> getSerializer()
- Specified by:
getSerializer
in interfaceIRecipe<CraftingInventory>
-
getGroup
public java.lang.String getGroup()
- Specified by:
getGroup
in interfaceIRecipe<CraftingInventory>
-
getResultItem
public ItemStack getResultItem()
- Specified by:
getResultItem
in interfaceIRecipe<CraftingInventory>
-
getIngredients
public NonNullList<Ingredient> getIngredients()
- Specified by:
getIngredients
in interfaceIRecipe<CraftingInventory>
-
canCraftInDimensions
public boolean canCraftInDimensions(int p_194133_1_, int p_194133_2_)
- Specified by:
canCraftInDimensions
in interfaceIRecipe<CraftingInventory>
-
matches
public boolean matches(CraftingInventory p_77569_1_, World p_77569_2_)
- Specified by:
matches
in 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:
assemble
in interfaceIRecipe<CraftingInventory>
-
getWidth
public int getWidth()
-
getRecipeWidth
public int getRecipeWidth()
- Specified by:
getRecipeWidth
in interfaceIShapedRecipe<CraftingInventory>
-
getHeight
public int getHeight()
-
getRecipeHeight
public int getRecipeHeight()
- Specified by:
getRecipeHeight
in 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_)
-
-