public class ShapedRecipe extends java.lang.Object implements ICraftingRecipe, IShapedRecipe<CraftingInventory>
Modifier and Type | Class and Description |
---|---|
static class |
ShapedRecipe.Serializer |
Modifier and Type | Field and Description |
---|---|
private java.lang.String |
group |
private ResourceLocation |
id |
(package private) static int |
MAX_HEIGHT |
(package private) static int |
MAX_WIDTH |
private int |
recipeHeight |
private NonNullList<Ingredient> |
recipeItems |
private ItemStack |
recipeOutput |
private int |
recipeWidth |
Constructor and Description |
---|
ShapedRecipe(ResourceLocation idIn,
java.lang.String groupIn,
int recipeWidthIn,
int recipeHeightIn,
NonNullList<Ingredient> recipeItemsIn,
ItemStack recipeOutputIn) |
Modifier and Type | Method and Description |
---|---|
boolean |
canFit(int width,
int height) |
private boolean |
checkMatch(CraftingInventory craftingInventory,
int p_77573_2_,
int p_77573_3_,
boolean p_77573_4_) |
private static NonNullList<Ingredient> |
deserializeIngredients(java.lang.String[] pattern,
java.util.Map<java.lang.String,Ingredient> keys,
int patternWidth,
int patternHeight) |
static ItemStack |
deserializeItem(com.google.gson.JsonObject p_199798_0_) |
private static java.util.Map<java.lang.String,Ingredient> |
deserializeKey(com.google.gson.JsonObject json) |
private static int |
firstNonSpace(java.lang.String str) |
ItemStack |
getCraftingResult(CraftingInventory inv) |
java.lang.String |
getGroup() |
int |
getHeight() |
ResourceLocation |
getId() |
NonNullList<Ingredient> |
getIngredients() |
int |
getRecipeHeight() |
ItemStack |
getRecipeOutput() |
int |
getRecipeWidth() |
IRecipeSerializer<?> |
getSerializer() |
int |
getWidth() |
private static int |
lastNonSpace(java.lang.String str) |
boolean |
matches(CraftingInventory inv,
World worldIn) |
private static java.lang.String[] |
patternFromJson(com.google.gson.JsonArray jsonArr) |
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... toShrink) |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
getType
getIcon, getRemainingItems, isDynamic
static int MAX_WIDTH
static int MAX_HEIGHT
private final int recipeWidth
private final int recipeHeight
private final NonNullList<Ingredient> recipeItems
private final ItemStack recipeOutput
private final ResourceLocation id
private final java.lang.String group
public ShapedRecipe(ResourceLocation idIn, java.lang.String groupIn, int recipeWidthIn, int recipeHeightIn, NonNullList<Ingredient> recipeItemsIn, ItemStack recipeOutputIn)
public static void setCraftingSize(int width, int height)
width
- your max recipe widthheight
- your max recipe heightpublic ResourceLocation getId()
getId
in interface IRecipe<CraftingInventory>
public IRecipeSerializer<?> getSerializer()
getSerializer
in interface IRecipe<CraftingInventory>
public java.lang.String getGroup()
getGroup
in interface IRecipe<CraftingInventory>
public ItemStack getRecipeOutput()
getRecipeOutput
in interface IRecipe<CraftingInventory>
public NonNullList<Ingredient> getIngredients()
getIngredients
in interface IRecipe<CraftingInventory>
public boolean canFit(int width, int height)
canFit
in interface IRecipe<CraftingInventory>
public boolean matches(CraftingInventory inv, World worldIn)
matches
in interface IRecipe<CraftingInventory>
private boolean checkMatch(CraftingInventory craftingInventory, int p_77573_2_, int p_77573_3_, boolean p_77573_4_)
public ItemStack getCraftingResult(CraftingInventory inv)
getCraftingResult
in interface IRecipe<CraftingInventory>
public int getWidth()
public int getRecipeWidth()
getRecipeWidth
in interface IShapedRecipe<CraftingInventory>
public int getHeight()
public int getRecipeHeight()
getRecipeHeight
in interface IShapedRecipe<CraftingInventory>
private static NonNullList<Ingredient> deserializeIngredients(java.lang.String[] pattern, java.util.Map<java.lang.String,Ingredient> keys, int patternWidth, int patternHeight)
static java.lang.String[] shrink(java.lang.String... toShrink)
private static int firstNonSpace(java.lang.String str)
private static int lastNonSpace(java.lang.String str)
private static java.lang.String[] patternFromJson(com.google.gson.JsonArray jsonArr)
private static java.util.Map<java.lang.String,Ingredient> deserializeKey(com.google.gson.JsonObject json)
public static ItemStack deserializeItem(com.google.gson.JsonObject p_199798_0_)