recipe

package
v0.9.18 Latest Latest
Warning

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

Go to latest
Published: Sep 18, 2024 License: MIT Imports: 8 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 Furnace added in v0.9.18

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

Furnace represents a recipe only craftable in a furnace.

func NewFurnace added in v0.9.18

func NewFurnace(input Item, output item.Stack, block string) Furnace

NewFurnace creates a new furnace recipe and returns it.

func (Furnace) Block added in v0.9.18

func (r Furnace) Block() string

Block ...

func (Furnace) Input added in v0.9.18

func (r Furnace) Input() []Item

Input ...

func (Furnace) Output added in v0.9.18

func (r Furnace) Output() []item.Stack

Output ...

func (Furnace) Priority added in v0.9.18

func (r Furnace) Priority() uint32

Priority ...

type Item added in v0.9.14

type Item interface {
	// Count returns the amount of items that is present on the stack. The count is guaranteed never to be
	// negative.
	Count() int
	// Empty checks if the stack is empty (has a count of 0).
	Empty() bool
}

Item represents an item that can be used as either the input or output of an item. These do not necessarily resolve to an actual item, but can be just as simple as a tag etc.

type ItemTag added in v0.9.14

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

ItemTag represents a recipe item that is identified by a tag, such as "minecraft:planks" or "minecraft:digger" and so on.

func NewItemTag added in v0.9.14

func NewItemTag(tag string, count int) ItemTag

NewItemTag creates a new item tag with the tag and count passed.

func (ItemTag) Contains added in v0.9.14

func (i ItemTag) Contains(name string) bool

Contains returns true if the item tag contains the item with the name passed.

func (ItemTag) Count added in v0.9.14

func (i ItemTag) Count() int

Count ...

func (ItemTag) Empty added in v0.9.14

func (i ItemTag) Empty() bool

Empty ...

func (ItemTag) Tag added in v0.9.14

func (i ItemTag) Tag() string

Tag returns the tag of the item.

type Recipe

type Recipe interface {
	// Input returns the items required to craft the recipe.
	Input() []Item
	// Output returns the items that are produced when the recipe is crafted.
	Output() []item.Stack
	// Block returns the block that is used to craft the recipe.
	Block() string
	// Priority returns the priority of the recipe. Recipes with lower priority are preferred compared to recipes with
	// higher priority.
	Priority() uint32
}

Recipe is implemented by all recipe types.

func Recipes

func Recipes() []Recipe

Recipes returns each recipe in a slice.

type Shape

type Shape [2]int

Shape make up the shape of a shaped recipe. It consists of a width and a height.

func NewShape

func NewShape(width, height int) Shape

NewShape creates a new shape using the provided width and height.

func (Shape) Height

func (s Shape) Height() int

Height returns the height of the shape.

func (Shape) Width

func (s Shape) Width() int

Width returns the width of the shape.

type Shaped

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

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

func NewShaped

func NewShaped(input []Item, output item.Stack, shape Shape, block string) Shaped

NewShaped creates a new shaped recipe and returns it. The recipe can only be crafted on the block passed in the parameters. If the block given a crafting table, the recipe can also be crafted in the 2x2 crafting grid in the player's inventory. If nil is passed, the block will be autofilled as a crafting table. The inputs must always match the width*height of the shape.

func (Shaped) Block

func (r Shaped) Block() string

Block ...

func (Shaped) Input

func (r Shaped) Input() []Item

Input ...

func (Shaped) Output

func (r Shaped) Output() []item.Stack

Output ...

func (Shaped) Priority

func (r Shaped) Priority() uint32

Priority ...

func (Shaped) Shape

func (r Shaped) Shape() Shape

Shape returns the shape of the recipe.

type Shapeless

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

Shapeless is a recipe that has no particular shape.

func NewShapeless

func NewShapeless(input []Item, output item.Stack, block string) Shapeless

NewShapeless creates a new shapeless recipe and returns it. The recipe can only be crafted on the block passed in the parameters. If the block given a crafting table, the recipe can also be crafted in the 2x2 crafting grid in the player's inventory.

func (Shapeless) Block

func (r Shapeless) Block() string

Block ...

func (Shapeless) Input

func (r Shapeless) Input() []Item

Input ...

func (Shapeless) Output

func (r Shapeless) Output() []item.Stack

Output ...

func (Shapeless) Priority

func (r Shapeless) Priority() uint32

Priority ...

type SmithingTransform added in v0.9.16

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

SmithingTransform represents a recipe only craftable on a smithing table.

func NewSmithingTransform added in v0.9.16

func NewSmithingTransform(base, addition, template Item, output item.Stack, block string) SmithingTransform

NewSmithingTransform creates a new smithing recipe and returns it.

func (SmithingTransform) Block added in v0.9.16

func (r SmithingTransform) Block() string

Block ...

func (SmithingTransform) Input added in v0.9.16

func (r SmithingTransform) Input() []Item

Input ...

func (SmithingTransform) Output added in v0.9.16

func (r SmithingTransform) Output() []item.Stack

Output ...

func (SmithingTransform) Priority added in v0.9.16

func (r SmithingTransform) Priority() uint32

Priority ...

type SmithingTrim added in v0.9.16

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

SmithingTrim represents a recipe only craftable on a smithing table using an armour trim.

func NewSmithingTrim added in v0.9.16

func NewSmithingTrim(base, addition, template Item, block string) SmithingTrim

NewSmithingTrim creates a new smithing trim recipe and returns it. This is almost identical to SmithingTransform except there is no output item.

func (SmithingTrim) Block added in v0.9.16

func (r SmithingTrim) Block() string

Block ...

func (SmithingTrim) Input added in v0.9.16

func (r SmithingTrim) Input() []Item

Input ...

func (SmithingTrim) Output added in v0.9.16

func (r SmithingTrim) Output() []item.Stack

Output ...

func (SmithingTrim) Priority added in v0.9.16

func (r SmithingTrim) Priority() uint32

Priority ...

Jump to

Keyboard shortcuts

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