-
- All Implemented Interfaces:
public final class RecipeExtensionsKt
-
-
Method Summary
Modifier and Type Method Description final static Ingredient
coerceIngredient(Object ingredient)
Coerce the given ingredient to an Ingredient object. final static ShapedRecipe
shapedRecipe(Identifier id, String group, String pattern, ItemStack result, Pair<Character, Object> ingredients)
Create a new ShapedRecipe with the given information. final static ShapelessRecipe
shapelessRecipe(Identifier id, String group, ItemStack result, Object ingredients)
Create a new ShapelessRecipe with the given information. final static Array<AbstractCookingRecipe>
foodCookingRecipe(Identifier baseId, String group, Object input, ItemStack result, Float experience, Integer cookTime, Integer smokerCookTime, Integer campfireCookTime)
A more general recipe builder creating three recipes for the primary ways of cooking. final static Unit
registerStaticRecipes(Recipe<?> recipes)
final static <C extends Inventory, R extends Recipe<C>> R
registerStaticRecipe(R recipe)
-
-
Method Detail
-
coerceIngredient
final static Ingredient coerceIngredient(Object ingredient)
Coerce the given ingredient to an Ingredient object.
-
shapedRecipe
final static ShapedRecipe shapedRecipe(Identifier id, String group, String pattern, ItemStack result, Pair<Character, Object> ingredients)
Create a new ShapedRecipe with the given information. The group string is used for finding the recipe in the recipe book. The pattern is a newline-separated string of rows. The result is the resulting ItemStack of the recipe. Any ingredients can be listed in the form
char to ingredient
Example representing the hopper recipe:
shapedRecipe( Identifier("minecraft", "hopper"), "", // group is defaulted to empty string """ I I ICI IZ """.trimIndent(), ItemStack(Item.HOPPER, 1), 'I' to Items.IRON_INGOT, 'C' to Items.CHEST, 'Z' to Items.EMPTY // Prevent trailing whitespace )
-
shapelessRecipe
final static ShapelessRecipe shapelessRecipe(Identifier id, String group, ItemStack result, Object ingredients)
Create a new ShapelessRecipe with the given information. The group string is used for finding the recipe in the recipe book. The result is the resulting ItemStack of the recipe. The ingredients are any number of IngredientLike objects.
Example representing flint and steel:
shapelessRecipe( Identifier("minecraft", "flint_and_steel"), "", // group is defaulted to empty string ItemStack(Item.FLINT_AND_STEEL, 1), Items.IRON_INGOT, Items.FLINT )
-
foodCookingRecipe
final static Array<AbstractCookingRecipe> foodCookingRecipe(Identifier baseId, String group, Object input, ItemStack result, Float experience, Integer cookTime, Integer smokerCookTime, Integer campfireCookTime)
A more general recipe builder creating three recipes for the primary ways of cooking. These three are returned in an array, in the order of:
SmeltingRecipe
SmokingRecipe
CampfireCookingRecipe
The baseId is a base identifier for the recipe, with
smelting
,smoking
, andcampfire
appended to it to create the three recipe identifiers. The group string is used for finding the recipe in the recipe book. The input is the input ingredient of the recipe. The result is the resulting ItemStack of the recipe. The experience is the amount of experience gained when cooking the recipe.The cook time parameters are calculated in a special way:
cookTime is the time in ticks it takes to cook the item in a furnace. It defaults to 200, Minecraft's default of 10 seconds.
smokerCookTime is the time in ticks it takes to cook the item in a smoker. It defaults to half the cookTime, rounded down.
campfireCookTime is the time in ticks it takes to cook the item in a campfire. It defaults to triple the cookTime.
-
registerStaticRecipes
final static Unit registerStaticRecipes(Recipe<?> recipes)
-
registerStaticRecipe
final static <C extends Inventory, R extends Recipe<C>> R registerStaticRecipe(R recipe)
-
-
-
-