Class ShapedRecipe
java.lang.Object
net.minecraft.world.item.crafting.ShapedRecipe
- All Implemented Interfaces:
CraftingRecipe
,Recipe<CraftingContainer>
,IShapedRecipe<CraftingContainer>
- Direct Known Subclasses:
MapExtendingRecipe
public class ShapedRecipe
extends Object
implements CraftingRecipe, IShapedRecipe<CraftingContainer>
-
Nested Class Summary
-
Field Summary
Modifier and TypeFieldDescription(package private) final CraftingBookCategory
(package private) final String
(package private) final int
private final ResourceLocation
(package private) static int
(package private) static int
(package private) final NonNullList<Ingredient>
(package private) final ItemStack
(package private) final boolean
(package private) final int
-
Constructor Summary
ConstructorDescriptionShapedRecipe
(ResourceLocation p_250963_, String p_250221_, CraftingBookCategory p_250716_, int p_251480_, int p_251980_, NonNullList<Ingredient> p_252150_, ItemStack p_248581_) ShapedRecipe
(ResourceLocation p_273203_, String p_272759_, CraftingBookCategory p_273506_, int p_272952_, int p_272920_, NonNullList<Ingredient> p_273650_, ItemStack p_272852_, boolean p_273122_) -
Method Summary
Modifier and TypeMethodDescriptionassemble
(CraftingContainer p_266686_, RegistryAccess p_266725_) boolean
canCraftInDimensions
(int p_44161_, int p_44162_) category()
(package private) static NonNullList<Ingredient>
dissolvePattern
(String[] p_44203_, Map<String, Ingredient> p_44204_, int p_44205_, int p_44206_) private static int
firstNonSpace
(String p_44185_) getGroup()
int
getId()
int
int
getResultItem
(RegistryAccess p_266881_) int
getWidth()
boolean
static Item
itemFromJson
(com.google.gson.JsonObject p_151279_) static ItemStack
itemStackFromJson
(com.google.gson.JsonObject p_151275_) (package private) static Map<String,
Ingredient> keyFromJson
(com.google.gson.JsonObject p_44211_) private static int
lastNonSpace
(String p_44201_) private boolean
matches
(CraftingContainer p_44171_, int p_44172_, int p_44173_, boolean p_44174_) boolean
matches
(CraftingContainer p_44176_, Level p_44177_) (package private) static String[]
patternFromJson
(com.google.gson.JsonArray p_44197_) static void
setCraftingSize
(int width, int height) Expand the max width and height allowed in the deserializer.boolean
(package private) static String[]
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface net.minecraft.world.item.crafting.CraftingRecipe
getType
Methods inherited from interface net.minecraft.world.item.crafting.Recipe
getRemainingItems, getToastSymbol, isSpecial
-
Field Details
-
MAX_WIDTH
static int MAX_WIDTH -
MAX_HEIGHT
static int MAX_HEIGHT -
width
final int width -
height
final int height -
recipeItems
-
result
-
id
-
group
-
category
-
showNotification
final boolean showNotification
-
-
Constructor Details
-
ShapedRecipe
public ShapedRecipe(ResourceLocation p_273203_, String p_272759_, CraftingBookCategory p_273506_, int p_272952_, int p_272920_, NonNullList<Ingredient> p_273650_, ItemStack p_272852_, boolean p_273122_) -
ShapedRecipe
public ShapedRecipe(ResourceLocation p_250963_, String p_250221_, CraftingBookCategory p_250716_, int p_251480_, int p_251980_, NonNullList<Ingredient> p_252150_, ItemStack p_248581_)
-
-
Method Details
-
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
- Specified by:
getId
in interfaceRecipe<CraftingContainer>
-
getSerializer
- Specified by:
getSerializer
in interfaceRecipe<CraftingContainer>
-
getGroup
- Specified by:
getGroup
in interfaceRecipe<CraftingContainer>
-
category
- Specified by:
category
in interfaceCraftingRecipe
-
getResultItem
- Specified by:
getResultItem
in interfaceRecipe<CraftingContainer>
-
getIngredients
- Specified by:
getIngredients
in interfaceRecipe<CraftingContainer>
-
showNotification
public boolean showNotification()- Specified by:
showNotification
in interfaceRecipe<CraftingContainer>
-
canCraftInDimensions
public boolean canCraftInDimensions(int p_44161_, int p_44162_) - Specified by:
canCraftInDimensions
in interfaceRecipe<CraftingContainer>
-
matches
- Specified by:
matches
in interfaceRecipe<CraftingContainer>
-
matches
-
assemble
- Specified by:
assemble
in interfaceRecipe<CraftingContainer>
-
getWidth
public int getWidth() -
getRecipeWidth
public int getRecipeWidth()- Specified by:
getRecipeWidth
in interfaceIShapedRecipe<CraftingContainer>
-
getHeight
public int getHeight() -
getRecipeHeight
public int getRecipeHeight()- Specified by:
getRecipeHeight
in interfaceIShapedRecipe<CraftingContainer>
-
dissolvePattern
static NonNullList<Ingredient> dissolvePattern(String[] p_44203_, Map<String, Ingredient> p_44204_, int p_44205_, int p_44206_) -
shrink
-
isIncomplete
public boolean isIncomplete()- Specified by:
isIncomplete
in interfaceRecipe<CraftingContainer>
-
firstNonSpace
-
lastNonSpace
-
patternFromJson
-
keyFromJson
-
itemStackFromJson
-
itemFromJson
-