recipe

package
v0.5.16 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 23, 2022 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Register

func Register(recipe Recipe)

Register registers a new recipe.

Types

type Dimensions

type Dimensions [2]int

Dimensions make up the size of a shaped recipe.

func DimensionsFrom

func DimensionsFrom(shape []string) (Dimensions, error)

DimensionsFrom returns Dimensions from a shape.

type InputItem

type InputItem struct {
	item.Stack
	// Variants is true if the item applies to all of its possible variants. This is so it can be rendered in the recipe book
	// for alternative types.
	Variants bool
}

InputItem is a recipe item. It is an item stack inherently, but it also has an extra value for if it applies to all types.

type Recipe

type Recipe interface {
	// Input returns the items required to craft the recipe.
	Input() []InputItem
	// Output returns the item that is produced when the recipe is crafted.
	Output() item.Stack
	// Block returns the block the recipe is for.
	Block() string
}

Recipe is implemented by all recipe types.

func Recipes

func Recipes() []Recipe

Recipes returns each recipe in a slice.

type ShapedRecipe

type ShapedRecipe struct {

	// Dimensions are the dimensions for the shaped recipe.
	Dimensions Dimensions
	// contains filtered or unexported fields
}

ShapedRecipe is a recipe that has a specific shape that must be used to craft the output of the recipe.

func (*ShapedRecipe) Block

func (r *ShapedRecipe) Block() string

Block ...

func (*ShapedRecipe) Input

func (r *ShapedRecipe) Input() []InputItem

Input ...

func (*ShapedRecipe) Output

func (r *ShapedRecipe) Output() item.Stack

Output ...

type ShapelessRecipe

type ShapelessRecipe struct {
	// contains filtered or unexported fields
}

ShapelessRecipe is a recipe that has no particular shape.

func (*ShapelessRecipe) Block

func (r *ShapelessRecipe) Block() string

Block ...

func (*ShapelessRecipe) Input

func (r *ShapelessRecipe) Input() []InputItem

Input ...

func (*ShapelessRecipe) Output

func (r *ShapelessRecipe) Output() item.Stack

Output ...

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL