recipes#

ingredients#

recipe#

class RecipeBase(
*,
type: str = '',
result_count: int = 1,
category: str | None = None,
group: str | None = None,
result: Ingr | None = None,
manual_priority: int | None = None,
smithed_crafter_command: str | None = None,
)[source]#

Bases: StMapping

Base class for all recipe types.

type: str = ''[source]#

The type of the recipe, e.g. ‘crafting_shaped’, ‘smelting’, etc.

result_count: int = 1[source]#

(Optional) The number of items produced by the recipe. Default is 1.

category: str | None = None[source]#

(Optional) The category of the recipe for organizing in the crafting book.

group: str | None = None[source]#

(Optional) The group of the recipe for recipe book grouping.

result: Ingr | None = None[source]#

(Optional) The result item of the recipe. If None, defaults to the item being defined.

manual_priority: int | None = None[source]#

(Optional) Manual priority for recipe button sorting in the ingame-manual. Used to remove buttons when too many are present.

smithed_crafter_command: str | None = None[source]#

(Optional) Custom command to be used with Smithed Crafter recipes. If None, defaults to giving the loot table.

classmethod from_dict(
data: JsonDict | StMapping,
item_id: str = '',
) → Self[source]#

Create an object based on a dictionary.

static validate_ingredient(
ingredient: Ingr,
name: str = 'Ingredient',
) → None[source]#

Validate a single ingredient dictionary.

static validate_ingredients_list(
ingredients: list[Ingr],
) → None[source]#

Validate a list of ingredients.

static validate_numeric_fields(
experience: Any,
cookingtime: Any,
) → None[source]#

Validate experience and cookingtime fields for furnace recipes.

static validate_string_field(
value: Any,
field_name: str,
) → None[source]#

Validate that a field is a string.

class CraftingShapedRecipe(
shape: list[str],
ingredients: dict[str, Ingr],
*,
type: str = '',
result_count: int = 1,
category: str | None = None,
group: str | None = None,
result: Ingr | None = None,
manual_priority: int | None = None,
smithed_crafter_command: str | None = None,
)[source]#

Bases: RecipeBase

Recipe for shaped crafting.

>>> from stewbeet import *
>>> recipe = CraftingShapedRecipe(
...     shape=["II", "CC", "CC"],
...     ingredients={"I":Ingr("minecraft:iron_ingot"), "C": Ingr("simplunium_ingot")}
... )
>>> recipe.shape
['II', 'CC', 'CC']
>>> recipe.ingredients['I']
{'item': 'minecraft:iron_ingot'}
>>> recipe.ingredients['C']
{'components': {'minecraft:custom_data': {'your_namespace': {'simplunium_ingot': True}}}}

Shape exceeding 3 rows raises ValueError:

>>> try:
...     CraftingShapedRecipe(shape=["I", "I", "I", "I"], ingredients={"I": Ingr("minecraft:iron_ingot")})
... except ValueError as e:
...     "3 rows" in str(e)
True

Symbol defined in ingredients but absent from shape raises ValueError:

>>> try:
...     CraftingShapedRecipe(shape=["II"], ingredients={"I": Ingr("minecraft:iron_ingot"), "X": Ingr("minecraft:gold_ingot")})
... except ValueError as e:
...     "must appear in the shape" in str(e)
True

Rows with inconsistent lengths raise ValueError:

>>> try:
...     CraftingShapedRecipe(shape=["II", "I"], ingredients={"I": Ingr("minecraft:iron_ingot")})
... except ValueError as e:
...     "same number of columns" in str(e)
True
shape: list[str][source]#

The shape pattern for the crafting recipe.

ingredients: dict[str, Ingr][source]#

Dictionary mapping shape symbols to ingredient specifications.

type: str = 'crafting_shaped'[source]#

The type of the recipe, e.g. ‘crafting_shaped’, ‘smelting’, etc.

class CraftingShapelessRecipe(
ingredients: list[Ingr],
*,
type: str = '',
result_count: int = 1,
category: str | None = None,
group: str | None = None,
result: Ingr | None = None,
manual_priority: int | None = None,
smithed_crafter_command: str | None = None,
)[source]#

Bases: RecipeBase

Recipe for shapeless crafting.

>>> from stewbeet import *
>>> recipe = CraftingShapelessRecipe(ingredients=[Ingr("minecraft:iron_ingot"), Ingr("minecraft:copper_ingot")])
>>> len(recipe.ingredients)
2
>>> recipe.type
'crafting_shapeless'

Non-list ingredients raises ValueError:

>>> try:
...     CraftingShapelessRecipe(ingredients=Ingr("minecraft:iron_ingot"))  # type: ignore[arg-type]
... except ValueError as e:
...     "must be a list" in str(e)
True
ingredients: list[Ingr][source]#

List of ingredient specifications for shapeless crafting.

type: str = 'crafting_shapeless'[source]#

The type of the recipe, e.g. ‘crafting_shaped’, ‘smelting’, etc.

class SmeltingRecipe(
ingredient: Ingr,
experience: float = 0.0,
cookingtime: int = 200,
*,
type: str = '',
result_count: int = 1,
category: str | None = None,
group: str | None = None,
result: Ingr | None = None,
manual_priority: int | None = None,
smithed_crafter_command: str | None = None,
)[source]#

Bases: RecipeBase

Recipe for smelting in a furnace.

>>> from stewbeet import *
>>> recipe = SmeltingRecipe(ingredient=Ingr("minecraft:iron_ore"), experience=0.7, cookingtime=200)
>>> recipe.experience
0.7
>>> recipe.cookingtime
200

Non-numeric experience raises ValueError:

>>> try:
...     SmeltingRecipe(ingredient=Ingr("minecraft:iron_ore"), experience="high", cookingtime=200)  # type: ignore[arg-type]
... except ValueError as e:
...     "Experience must be a float or int" in str(e)
True

Non-integer cookingtime raises ValueError:

>>> try:
...     SmeltingRecipe(ingredient=Ingr("minecraft:iron_ore"), experience=0.7, cookingtime=1.5)  # type: ignore[arg-type]
... except ValueError as e:
...     "Cookingtime must be an int" in str(e)
True
ingredient: Ingr[source]#

The ingredient to be smelted.

experience: float = 0.0[source]#

Experience points awarded when the recipe is used.

cookingtime: int = 200[source]#

Cooking time in ticks (200 ticks = 10 seconds by default).

type: str = 'smelting'[source]#

The type of the recipe, e.g. ‘crafting_shaped’, ‘smelting’, etc.

class BlastingRecipe(
ingredient: Ingr,
experience: float = 0.0,
cookingtime: int = 100,
*,
type: str = '',
result_count: int = 1,
category: str | None = None,
group: str | None = None,
result: Ingr | None = None,
manual_priority: int | None = None,
smithed_crafter_command: str | None = None,
)[source]#

Bases: RecipeBase

Recipe for blasting in a blast furnace.

>>> from stewbeet import *
>>> recipe = BlastingRecipe(ingredient=Ingr("minecraft:iron_ore"), experience=0.7, cookingtime=100)
>>> recipe.experience
0.7
>>> recipe.cookingtime
100
ingredient: Ingr[source]#

The ingredient to be blasted.

experience: float = 0.0[source]#

Experience points awarded when the recipe is used.

cookingtime: int = 100[source]#

Cooking time in ticks (100 ticks = 5 seconds by default).

type: str = 'blasting'[source]#

The type of the recipe, e.g. ‘crafting_shaped’, ‘smelting’, etc.

class SmokingRecipe(
ingredient: Ingr,
experience: float = 0.0,
cookingtime: int = 100,
*,
type: str = '',
result_count: int = 1,
category: str | None = None,
group: str | None = None,
result: Ingr | None = None,
manual_priority: int | None = None,
smithed_crafter_command: str | None = None,
)[source]#

Bases: RecipeBase

Recipe for smoking in a smoker.

>>> from stewbeet import *
>>> recipe = SmokingRecipe(ingredient=Ingr("minecraft:chicken"), experience=0.35, cookingtime=100)
>>> recipe.experience
0.35
>>> recipe.cookingtime
100
ingredient: Ingr[source]#

The ingredient to be smoked.

experience: float = 0.0[source]#

Experience points awarded when the recipe is used.

cookingtime: int = 100[source]#

Cooking time in ticks (100 ticks = 5 seconds by default).

type: str = 'smoking'[source]#

The type of the recipe, e.g. ‘crafting_shaped’, ‘smelting’, etc.

class CampfireCookingRecipe(
ingredient: Ingr,
experience: float,
cookingtime: int,
*,
type: str = '',
result_count: int = 1,
category: str | None = None,
group: str | None = None,
result: Ingr | None = None,
manual_priority: int | None = None,
smithed_crafter_command: str | None = None,
)[source]#

Bases: RecipeBase

Recipe for cooking on a campfire.

>>> from stewbeet import *
>>> recipe = CampfireCookingRecipe(ingredient=Ingr("minecraft:chicken"), experience=0.35, cookingtime=600)
>>> recipe.experience
0.35
>>> recipe.cookingtime
600
ingredient: Ingr[source]#

The ingredient to be cooked.

experience: float[source]#

Experience points awarded when the recipe is used.

cookingtime: int[source]#

Cooking time in ticks (600 ticks = 30 seconds by default).

type: str = 'campfire_cooking'[source]#

The type of the recipe, e.g. ‘crafting_shaped’, ‘smelting’, etc.

written_cooking_time(
recipe: SmeltingRecipe | BlastingRecipe | SmokingRecipe | CampfireCookingRecipe,
) → int[source]#

The “cookingtime” to write so the recipe takes recipe.cookingtime ticks in its own block.

Since 26.3, blast furnaces and smokers get their double speed from their fuel, so their recipes store the furnace duration.

>>> written_cooking_time(BlastingRecipe(ingredient=Ingr("minecraft:iron_ore"), cookingtime=100))
200
class SmithingTransformRecipe(
template: Ingr,
base: Ingr,
addition: Ingr,
*,
type: str = '',
result_count: int = 1,
category: str | None = None,
group: str | None = None,
result: Ingr | None = None,
manual_priority: int | None = None,
smithed_crafter_command: str | None = None,
)[source]#

Bases: RecipeBase

Recipe for smithing table transformation.

>>> from stewbeet import *
>>> recipe = SmithingTransformRecipe(
...     template=Ingr("minecraft:netherite_upgrade_smithing_template"),
...     base=Ingr("minecraft:diamond_sword"),
...     addition=Ingr("minecraft:netherite_ingot")
... )
>>> recipe.template['item']
'minecraft:netherite_upgrade_smithing_template'
template: Ingr[source]#

The template item (e.g., upgrade template).

base: Ingr[source]#

The base item to be transformed.

addition: Ingr[source]#

The addition item (e.g., material).

type: str = 'smithing_transform'[source]#

The type of the recipe, e.g. ‘crafting_shaped’, ‘smelting’, etc.

class SmithingTrimRecipe(
template: Ingr,
base: Ingr,
addition: Ingr,
pattern: str,
*,
type: str = '',
result_count: int = 1,
category: str | None = None,
group: str | None = None,
result: Ingr | None = None,
manual_priority: int | None = None,
smithed_crafter_command: str | None = None,
)[source]#

Bases: RecipeBase

Recipe for applying armor trims.

>>> from stewbeet import *
>>> recipe = SmithingTrimRecipe(
...     template=Ingr("minecraft:spire_armor_trim_smithing_template"),
...     base=Ingr("minecraft:netherite_chestplate"),
...     addition=Ingr("minecraft:diamond"),
...     pattern="minecraft:spire_armor_trim_smithing_template"
... )
>>> recipe.addition['item']
'minecraft:diamond'
template: Ingr[source]#

The trim template.

base: Ingr[source]#

The armor piece.

addition: Ingr[source]#

The material for the trim.

pattern: str[source]#

The trim pattern.

type: str = 'smithing_trim'[source]#

The type of the recipe, e.g. ‘crafting_shaped’, ‘smelting’, etc.

class StonecuttingRecipe(
ingredient: Ingr,
*,
type: str = '',
result_count: int = 1,
category: str | None = None,
group: str | None = None,
result: Ingr | None = None,
manual_priority: int | None = None,
smithed_crafter_command: str | None = None,
)[source]#

Bases: RecipeBase

Recipe for stonecutting.

>>> from stewbeet import *
>>> recipe = StonecuttingRecipe(ingredient=Ingr("minecraft:stone"))
>>> recipe.ingredient['item']
'minecraft:stone'
ingredient: Ingr[source]#

The ingredient to be cut.

type: str = 'stonecutting'[source]#

The type of the recipe, e.g. ‘crafting_shaped’, ‘smelting’, etc.

class PulverizingRecipe(
ingredient: Ingr,
*,
type: str = '',
result_count: int = 1,
category: str | None = None,
group: str | None = None,
result: Ingr | None = None,
manual_priority: int | None = None,
smithed_crafter_command: str | None = None,
)[source]#

Bases: RecipeBase

Custom recipe for SimplEnergy pulverizing.

>>> from stewbeet import *
>>> recipe = PulverizingRecipe(ingredient=Ingr("minecraft:iron_ore"))
>>> recipe.ingredient['item']
'minecraft:iron_ore'
ingredient: Ingr[source]#

The ingredient to be pulverized.

type: str = 'simplenergy_pulverizing'[source]#

The type of the recipe, e.g. ‘crafting_shaped’, ‘smelting’, etc.

class AwakenedForgeRecipe(
ingredients: list[Ingr],
particle: str | None = None,
*,
type: str = '',
result_count: int = 1,
category: str | None = None,
group: str | None = None,
result: Ingr | None = None,
manual_priority: int | None = None,
smithed_crafter_command: str | None = None,
)[source]#

Bases: RecipeBase

Custom recipe for Stardust awakened forge.

>>> from stewbeet import *
>>> recipe = AwakenedForgeRecipe(ingredients=[Ingr("stardust_fragment"), Ingr("minecraft:iron_ingot")])
>>> len(recipe.ingredients)
2
ingredients: list[Ingr][source]#

List of ingredients for the awakened forge.

particle: str | None = None[source]#

(Optional) Particle effect for the recipe.

type: str = 'stardust_awakened_forge'[source]#

The type of the recipe, e.g. ‘crafting_shaped’, ‘smelting’, etc.

class HardcodedRecipe(
type: Literal['crafting_decorated_pot', 'crafting_special_armordye', 'crafting_special_bannerduplicate', 'crafting_special_bookcloning', 'crafting_special_firework_rocket', 'crafting_special_firework_star', 'crafting_special_firework_star_fade', 'crafting_special_mapcloning', 'crafting_special_mapextending', 'crafting_special_repairitem', 'crafting_special_shielddecoration', 'crafting_special_tippedarrow', 'crafting_transmute'] = '',
*,
result_count: int = 1,
category: str | None = None,
group: str | None = None,
result: Ingr | None = None,
manual_priority: int | None = None,
smithed_crafter_command: str | None = None,
)[source]#

Bases: RecipeBase

Recipe for special/hardcoded crafting types.

>>> recipe = HardcodedRecipe(type="crafting_special_armordye")
>>> recipe.type
'crafting_special_armordye'
Recipe = stewbeet.core.cls.recipes.recipe.CraftingShapedRecipe | stewbeet.core.cls.recipes.recipe.CraftingShapelessRecipe | stewbeet.core.cls.recipes.recipe.SmeltingRecipe | stewbeet.core.cls.recipes.recipe.BlastingRecipe | stewbeet.core.cls.recipes.recipe.SmokingRecipe | stewbeet.core.cls.recipes.recipe.CampfireCookingRecipe | stewbeet.core.cls.recipes.recipe.SmithingTransformRecipe | stewbeet.core.cls.recipes.recipe.SmithingTrimRecipe | stewbeet.core.cls.recipes.recipe.StonecuttingRecipe | stewbeet.core.cls.recipes.recipe.PulverizingRecipe | stewbeet.core.cls.recipes.recipe.AwakenedForgeRecipe | stewbeet.core.cls.recipes.recipe.HardcodedRecipe[source]#

Type alias for all recipe types (CraftingShapedRecipe | CraftingShapelessRecipe | …)