item

package
v0.9.15 Latest Latest
Warning

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

Go to latest
Published: Apr 1, 2024 License: MIT Imports: 21 Imported by: 93

Documentation

Index

Constants

View Source
const DefaultConsumeDuration = (time.Second * 161) / 100

DefaultConsumeDuration is the default duration that consuming an item takes. Dried kelp takes half this time to be consumed.

Variables

View Source
var (
	// EnchantmentRarityCommon represents the common enchantment rarity.
	EnchantmentRarityCommon enchantmentRarityCommon
	// EnchantmentRarityUncommon represents the uncommon enchantment rarity.
	EnchantmentRarityUncommon enchantmentRarityUncommon
	// EnchantmentRarityRare represents the rare enchantment rarity.
	EnchantmentRarityRare enchantmentRarityRare
	// EnchantmentRarityVeryRare represents the very rare enchantment rarity.
	EnchantmentRarityVeryRare enchantmentRarityVeryRare
)
View Source
var (
	// TypeNone is the ToolType of items that are not tools.
	TypeNone = ToolType{-1}
	// TypePickaxe is the ToolType for pickaxes.
	TypePickaxe = ToolType{0}
	// TypeAxe is the ToolType for axes.
	TypeAxe = ToolType{1}
	// TypeHoe is the ToolType for hoes.
	TypeHoe = ToolType{2}
	// TypeShovel is the ToolType for shovels.
	TypeShovel = ToolType{3}
	// TypeShears is the ToolType for shears.
	TypeShears = ToolType{4}
	// TypeSword is the ToolType for swords.
	TypeSword = ToolType{5}

	// ToolTierWood is the ToolTier of wood tools. This is the lowest possible tier.
	ToolTierWood = ToolTier{HarvestLevel: 1, Durability: 59, BaseMiningEfficiency: 2, BaseAttackDamage: 1, EnchantmentValue: 15, Name: "wooden"}
	// ToolTierGold is the ToolTier of gold tools.
	ToolTierGold = ToolTier{HarvestLevel: 1, Durability: 32, BaseMiningEfficiency: 12, BaseAttackDamage: 1, EnchantmentValue: 22, Name: "golden"}
	// ToolTierStone is the ToolTier of stone tools.
	ToolTierStone = ToolTier{HarvestLevel: 2, Durability: 131, BaseMiningEfficiency: 4, BaseAttackDamage: 2, EnchantmentValue: 5, Name: "stone"}
	// ToolTierIron is the ToolTier of iron tools.
	ToolTierIron = ToolTier{HarvestLevel: 3, Durability: 250, BaseMiningEfficiency: 6, BaseAttackDamage: 3, EnchantmentValue: 14, Name: "iron"}
	// ToolTierDiamond is the ToolTier of diamond tools.
	ToolTierDiamond = ToolTier{HarvestLevel: 4, Durability: 1561, BaseMiningEfficiency: 8, BaseAttackDamage: 4, EnchantmentValue: 10, Name: "diamond"}
	// ToolTierNetherite is the ToolTier of netherite tools. This is the highest possible tier.
	ToolTierNetherite = ToolTier{HarvestLevel: 4, Durability: 2031, BaseMiningEfficiency: 9, BaseAttackDamage: 5, EnchantmentValue: 15, Name: "netherite"}
)

Functions

func DisplayName added in v0.7.3

func DisplayName(item world.Item, locale language.Tag) string

DisplayName returns the display name of the item as shown in game in the language passed. It panics if an unknown item is passed in.

func EnchantmentID

func EnchantmentID(e EnchantmentType) (int, bool)

EnchantmentID attempts to return the ID the enchantment was registered with. If found, the id is returned and the bool true.

func RegisterEnchantment

func RegisterEnchantment(id int, enchantment EnchantmentType)

RegisterEnchantment registers an enchantment with the ID passed. Once registered, enchantments may be received by instantiating an EnchantmentType struct (e.g. enchantment.Protection{})

Types

type AmethystShard added in v0.1.0

type AmethystShard struct{}

AmethystShard is a crystalline mineral obtained from mining a fully grown amethyst cluster.

func (AmethystShard) EncodeItem added in v0.1.0

func (AmethystShard) EncodeItem() (name string, meta int16)

EncodeItem ...

type Apple

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

Apple is a food item that can be eaten by the player.

func (Apple) AlwaysConsumable

func (Apple) AlwaysConsumable() bool

AlwaysConsumable ...

func (Apple) CompostChance added in v0.8.2

func (Apple) CompostChance() float64

CompostChance ...

func (Apple) Consume

func (a Apple) Consume(_ *world.World, c Consumer) Stack

Consume ...

func (Apple) ConsumeDuration

func (d Apple) ConsumeDuration() time.Duration

ConsumeDuration ...

func (Apple) EncodeItem

func (a Apple) EncodeItem() (name string, meta int16)

EncodeItem ...

type Armour added in v0.6.0

type Armour interface {
	// DefencePoints returns the defence points that the armour provides when worn.
	DefencePoints() float64
	// Toughness returns the toughness that the armor provides when worn. The toughness reduces defense reduction
	// caused by increased damage.
	Toughness() float64
	// KnockBackResistance returns a number from 0-1 that decides the amount of knock back force that is
	// resisted upon being attacked. 1 knock back resistance point client-side translates to 10% knock back
	// reduction.
	KnockBackResistance() float64
}

Armour represents an item that may be worn as armour. Generally, these items provide armour points, which reduce damage taken. Some pieces of armour also provide toughness, which negates damage proportional to the total damage dealt.

type ArmourTier added in v0.6.0

type ArmourTier interface {
	// BaseDurability is the base durability of armour with this tier. This is otherwise the durability of
	// the helmet with this tier.
	BaseDurability() float64
	// Toughness reduces the defense reduction caused by damage increases.
	Toughness() float64
	// KnockBackResistance is a number from 0-1 that decides the amount of knock back force that is resisted
	// upon being attacked. 1 knock back resistance point client-side translates to 10% knock back reduction.
	KnockBackResistance() float64
	// EnchantmentValue is the enchantment value of the armour used when selecting pseudo-random enchantments for
	// enchanting tables. When this value is high, the enchantments that are selected are more likely to be good.
	EnchantmentValue() int
	// Name is the name of the tier.
	Name() string
}

ArmourTier represents the tier, or material, that a piece of armour is made of.

func ArmourTiers added in v0.6.0

func ArmourTiers() []ArmourTier

ArmourTiers returns a list of all armour tiers.

type ArmourTierChain added in v0.6.0

type ArmourTierChain struct{}

ArmourTierChain is the ArmourTier of chain armour.

func (ArmourTierChain) BaseDurability added in v0.7.3

func (ArmourTierChain) BaseDurability() float64

func (ArmourTierChain) EnchantmentValue added in v0.8.0

func (ArmourTierChain) EnchantmentValue() int

func (ArmourTierChain) KnockBackResistance added in v0.7.3

func (ArmourTierChain) KnockBackResistance() float64

func (ArmourTierChain) Name added in v0.7.3

func (ArmourTierChain) Name() string

func (ArmourTierChain) Toughness added in v0.7.3

func (ArmourTierChain) Toughness() float64

type ArmourTierDiamond added in v0.6.0

type ArmourTierDiamond struct{}

ArmourTierDiamond is the ArmourTier of diamond armour.

func (ArmourTierDiamond) BaseDurability added in v0.7.3

func (ArmourTierDiamond) BaseDurability() float64

func (ArmourTierDiamond) EnchantmentValue added in v0.8.0

func (ArmourTierDiamond) EnchantmentValue() int

func (ArmourTierDiamond) KnockBackResistance added in v0.7.3

func (ArmourTierDiamond) KnockBackResistance() float64

func (ArmourTierDiamond) Name added in v0.7.3

func (ArmourTierDiamond) Name() string

func (ArmourTierDiamond) Toughness added in v0.7.3

func (ArmourTierDiamond) Toughness() float64

type ArmourTierGold added in v0.6.0

type ArmourTierGold struct{}

ArmourTierGold is the ArmourTier of gold armour.

func (ArmourTierGold) BaseDurability added in v0.7.3

func (ArmourTierGold) BaseDurability() float64

func (ArmourTierGold) EnchantmentValue added in v0.8.0

func (ArmourTierGold) EnchantmentValue() int

func (ArmourTierGold) KnockBackResistance added in v0.7.3

func (ArmourTierGold) KnockBackResistance() float64

func (ArmourTierGold) Name added in v0.7.3

func (ArmourTierGold) Name() string

func (ArmourTierGold) Toughness added in v0.7.3

func (ArmourTierGold) Toughness() float64

type ArmourTierIron added in v0.6.0

type ArmourTierIron struct{}

ArmourTierIron is the ArmourTier of iron armour.

func (ArmourTierIron) BaseDurability added in v0.7.3

func (ArmourTierIron) BaseDurability() float64

func (ArmourTierIron) EnchantmentValue added in v0.8.0

func (ArmourTierIron) EnchantmentValue() int

func (ArmourTierIron) KnockBackResistance added in v0.7.3

func (ArmourTierIron) KnockBackResistance() float64

func (ArmourTierIron) Name added in v0.7.3

func (ArmourTierIron) Name() string

func (ArmourTierIron) Toughness added in v0.7.3

func (ArmourTierIron) Toughness() float64

type ArmourTierLeather added in v0.6.0

type ArmourTierLeather struct {
	// Colour is the dyed colour of the armour.
	Colour color.RGBA
}

ArmourTierLeather is the ArmourTier of leather armour

func (ArmourTierLeather) BaseDurability added in v0.7.3

func (ArmourTierLeather) BaseDurability() float64

func (ArmourTierLeather) EnchantmentValue added in v0.8.0

func (ArmourTierLeather) EnchantmentValue() int

func (ArmourTierLeather) KnockBackResistance added in v0.7.3

func (ArmourTierLeather) KnockBackResistance() float64

func (ArmourTierLeather) Name added in v0.7.3

func (ArmourTierLeather) Name() string

func (ArmourTierLeather) Toughness added in v0.7.3

func (ArmourTierLeather) Toughness() float64

type ArmourTierNetherite added in v0.6.0

type ArmourTierNetherite struct{}

ArmourTierNetherite is the ArmourTier of netherite armour.

func (ArmourTierNetherite) BaseDurability added in v0.7.3

func (ArmourTierNetherite) BaseDurability() float64

func (ArmourTierNetherite) EnchantmentValue added in v0.8.0

func (ArmourTierNetherite) EnchantmentValue() int

func (ArmourTierNetherite) KnockBackResistance added in v0.7.3

func (ArmourTierNetherite) KnockBackResistance() float64

func (ArmourTierNetherite) Name added in v0.7.3

func (ArmourTierNetherite) Name() string

func (ArmourTierNetherite) Toughness added in v0.7.3

func (ArmourTierNetherite) Toughness() float64

type Arrow added in v0.6.0

type Arrow struct {
	// Tip is the potion effect that is tipped on the arrow.
	Tip potion.Potion
}

Arrow is used as ammunition for bows, crossbows, and dispensers. Arrows can be modified to imbue status effects on players and mobs.

func (Arrow) EncodeItem added in v0.6.0

func (a Arrow) EncodeItem() (name string, meta int16)

EncodeItem ...

type Axe

type Axe struct {
	// Tier is the tier of the axe.
	Tier ToolTier
}

Axe is a tool generally used for mining wood-like blocks. It may also be used to break some plant-like blocks at a faster pace such as pumpkins.

func (Axe) AttackDamage

func (a Axe) AttackDamage() float64

AttackDamage ...

func (Axe) BaseMiningEfficiency

func (a Axe) BaseMiningEfficiency(world.Block) float64

BaseMiningEfficiency ...

func (Axe) DurabilityInfo

func (a Axe) DurabilityInfo() DurabilityInfo

DurabilityInfo ...

func (Axe) EnchantmentValue added in v0.8.0

func (a Axe) EnchantmentValue() int

EnchantmentValue ...

func (Axe) EncodeItem

func (a Axe) EncodeItem() (name string, meta int16)

EncodeItem ...

func (Axe) FuelInfo added in v0.8.0

func (a Axe) FuelInfo() FuelInfo

FuelInfo ...

func (Axe) HarvestLevel

func (a Axe) HarvestLevel() int

HarvestLevel ...

func (Axe) MaxCount

func (a Axe) MaxCount() int

MaxCount always returns 1.

func (Axe) RepairableBy added in v0.7.3

func (a Axe) RepairableBy(i Stack) bool

RepairableBy ...

func (Axe) SmeltInfo added in v0.8.0

func (a Axe) SmeltInfo() SmeltInfo

SmeltInfo ...

func (Axe) ToolType

func (a Axe) ToolType() ToolType

ToolType ...

func (Axe) UseOnBlock

func (a Axe) UseOnBlock(pos cube.Pos, _ cube.Face, _ mgl64.Vec3, w *world.World, _ User, ctx *UseContext) bool

UseOnBlock handles the stripping of logs when a player clicks a log with an axe.

type BakedPotato added in v0.1.0

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

BakedPotato is a food item that can be eaten by the player.

func (BakedPotato) AlwaysConsumable added in v0.1.0

func (BakedPotato) AlwaysConsumable() bool

AlwaysConsumable ...

func (BakedPotato) CompostChance added in v0.8.2

func (BakedPotato) CompostChance() float64

CompostChance ...

func (BakedPotato) Consume added in v0.1.0

func (BakedPotato) Consume(_ *world.World, c Consumer) Stack

Consume ...

func (BakedPotato) ConsumeDuration added in v0.1.0

func (d BakedPotato) ConsumeDuration() time.Duration

ConsumeDuration ...

func (BakedPotato) EncodeItem added in v0.1.0

func (BakedPotato) EncodeItem() (name string, meta int16)

EncodeItem ...

type BannerPattern added in v0.8.0

type BannerPattern struct {
	// Type represents the type of banner pattern. These types do not include all patterns that can be applied to a
	// banner.
	Type BannerPatternType
}

BannerPattern is an item used to customize banners inside looms.

func (BannerPattern) EncodeItem added in v0.8.0

func (b BannerPattern) EncodeItem() (name string, meta int16)

EncodeItem ...

func (BannerPattern) MaxCount added in v0.8.0

func (b BannerPattern) MaxCount() int

MaxCount always returns 1.

type BannerPatternType added in v0.8.0

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

BannerPatternType represents a type of BannerPattern.

func BannerPatterns added in v0.8.0

func BannerPatterns() []BannerPatternType

BannerPatterns returns all possible banner patterns.

func BordureIndentedBannerPattern added in v0.8.0

func BordureIndentedBannerPattern() BannerPatternType

BordureIndentedBannerPattern represents the 'Bordure Indented' banner pattern type.

func CreeperBannerPattern added in v0.8.0

func CreeperBannerPattern() BannerPatternType

CreeperBannerPattern represents the 'Creeper' banner pattern type.

func FieldMasonedBannerPattern added in v0.8.0

func FieldMasonedBannerPattern() BannerPatternType

FieldMasonedBannerPattern represents the 'Field Masoned' banner pattern type.

func FlowerBannerPattern added in v0.8.0

func FlowerBannerPattern() BannerPatternType

FlowerBannerPattern represents the 'Flower' banner pattern type.

func GlobeBannerPattern added in v0.8.0

func GlobeBannerPattern() BannerPatternType

GlobeBannerPattern represents the 'Globe' banner pattern type.

func MojangBannerPattern added in v0.8.0

func MojangBannerPattern() BannerPatternType

MojangBannerPattern represents the 'Mojang' banner pattern type.

func PiglinBannerPattern added in v0.8.0

func PiglinBannerPattern() BannerPatternType

PiglinBannerPattern represents the 'Piglin' banner pattern type.

func SkullBannerPattern added in v0.8.0

func SkullBannerPattern() BannerPatternType

SkullBannerPattern represents the 'Skull' banner pattern type.

func (BannerPatternType) String added in v0.8.0

func (b BannerPatternType) String() string

String ...

func (BannerPatternType) Uint8 added in v0.8.0

func (b BannerPatternType) Uint8() uint8

Uint8 returns the uint8 value of the banner pattern type.

type BeaconPayment

type BeaconPayment interface {
	PayableForBeacon() bool
}

BeaconPayment represents an item that may be used as payment for a beacon to select effects to be broadcast to surrounding players.

type Beef added in v0.1.0

type Beef struct {

	// Cooked is whether the beef is cooked.
	Cooked bool
	// contains filtered or unexported fields
}

Beef is a food item obtained from cows. It can be cooked in a furnace, smoker, or campfire.

func (Beef) AlwaysConsumable added in v0.1.0

func (Beef) AlwaysConsumable() bool

AlwaysConsumable ...

func (Beef) Consume added in v0.1.0

func (b Beef) Consume(_ *world.World, c Consumer) Stack

Consume ...

func (Beef) ConsumeDuration added in v0.1.0

func (d Beef) ConsumeDuration() time.Duration

ConsumeDuration ...

func (Beef) EncodeItem added in v0.1.0

func (b Beef) EncodeItem() (name string, meta int16)

EncodeItem ...

func (Beef) SmeltInfo added in v0.8.0

func (b Beef) SmeltInfo() SmeltInfo

SmeltInfo ...

type Beetroot

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

Beetroot is a food and dye ingredient.

func (Beetroot) AlwaysConsumable

func (Beetroot) AlwaysConsumable() bool

AlwaysConsumable ...

func (Beetroot) CompostChance added in v0.8.2

func (Beetroot) CompostChance() float64

CompostChance ...

func (Beetroot) Consume

func (b Beetroot) Consume(_ *world.World, c Consumer) Stack

Consume ...

func (Beetroot) ConsumeDuration

func (d Beetroot) ConsumeDuration() time.Duration

ConsumeDuration ...

func (Beetroot) EncodeItem

func (b Beetroot) EncodeItem() (name string, meta int16)

EncodeItem ...

type BeetrootSoup added in v0.1.0

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

BeetrootSoup is an unstackable food item.

func (BeetrootSoup) AlwaysConsumable added in v0.1.0

func (BeetrootSoup) AlwaysConsumable() bool

AlwaysConsumable ...

func (BeetrootSoup) Consume added in v0.1.0

func (BeetrootSoup) Consume(_ *world.World, c Consumer) Stack

Consume ...

func (BeetrootSoup) ConsumeDuration added in v0.1.0

func (d BeetrootSoup) ConsumeDuration() time.Duration

ConsumeDuration ...

func (BeetrootSoup) EncodeItem added in v0.1.0

func (BeetrootSoup) EncodeItem() (name string, meta int16)

EncodeItem ...

func (BeetrootSoup) MaxCount added in v0.1.0

func (BeetrootSoup) MaxCount() int

MaxCount ...

type BlazePowder added in v0.1.0

type BlazePowder struct{}

BlazePowder is an item made from a blaze rod obtained from blazes.

func (BlazePowder) EncodeItem added in v0.1.0

func (BlazePowder) EncodeItem() (name string, meta int16)

EncodeItem ...

type BlazeRod added in v0.1.0

type BlazeRod struct{}

BlazeRod is an item exclusively obtained from blazes.

func (BlazeRod) EncodeItem added in v0.1.0

func (BlazeRod) EncodeItem() (name string, meta int16)

EncodeItem ...

func (BlazeRod) FuelInfo added in v0.8.0

func (BlazeRod) FuelInfo() FuelInfo

FuelInfo ...

type Bone added in v0.1.0

type Bone struct{}

Bone is an item primarily obtained as a drop from skeletons and their variants.

func (Bone) EncodeItem added in v0.1.0

func (Bone) EncodeItem() (name string, meta int16)

EncodeItem ...

type BoneMeal

type BoneMeal struct{}

BoneMeal is an item used to force growth in plants & crops.

func (BoneMeal) EncodeItem

func (b BoneMeal) EncodeItem() (name string, meta int16)

EncodeItem ...

func (BoneMeal) UseOnBlock

func (b BoneMeal) UseOnBlock(pos cube.Pos, _ cube.Face, _ mgl64.Vec3, w *world.World, _ User, ctx *UseContext) bool

UseOnBlock ...

type BoneMealAffected

type BoneMealAffected interface {
	// BoneMeal attempts to affect the block using a bone meal item.
	BoneMeal(pos cube.Pos, w *world.World) bool
}

BoneMealAffected represents a block that is affected when bone meal is used on it.

type Book added in v0.1.0

type Book struct{}

Book is an item used in enchanting and crafting.

func (Book) EnchantmentValue added in v0.8.0

func (b Book) EnchantmentValue() int

EnchantmentValue ...

func (Book) EncodeItem added in v0.1.0

func (Book) EncodeItem() (name string, meta int16)

EncodeItem ...

type BookAndQuill added in v0.8.3

type BookAndQuill struct {
	// Pages represents the pages within the book.
	Pages []string
}

BookAndQuill is an item used to write WrittenBook(s).

func (BookAndQuill) DecodeNBT added in v0.8.3

func (b BookAndQuill) DecodeNBT(data map[string]any) any

DecodeNBT ...

func (BookAndQuill) DeletePage added in v0.8.3

func (b BookAndQuill) DeletePage(page int) BookAndQuill

DeletePage attempts to delete a page from the book.

func (BookAndQuill) EncodeItem added in v0.8.3

func (BookAndQuill) EncodeItem() (name string, meta int16)

EncodeItem ...

func (BookAndQuill) EncodeNBT added in v0.8.3

func (b BookAndQuill) EncodeNBT() map[string]any

EncodeNBT ...

func (BookAndQuill) InsertPage added in v0.8.3

func (b BookAndQuill) InsertPage(page int, text string) BookAndQuill

InsertPage attempts to insert a page within the book

func (BookAndQuill) MaxCount added in v0.8.3

func (BookAndQuill) MaxCount() int

MaxCount always returns 1.

func (BookAndQuill) Page added in v0.8.3

func (b BookAndQuill) Page(page int) (string, bool)

Page returns a specific page from the book and true when the page exists. It will otherwise return an empty string and false.

func (BookAndQuill) SetPage added in v0.8.3

func (b BookAndQuill) SetPage(page int, text string) BookAndQuill

SetPage writes a page to the book, if the page doesn't exist it will be created. It will panic if the text is longer then 256 characters. It will return a new book representing this data.

func (BookAndQuill) SwapPages added in v0.8.3

func (b BookAndQuill) SwapPages(pageOne, pageTwo int) BookAndQuill

SwapPages swaps two different pages, it will panic if the largest of the two numbers doesn't exist. It will return the newly updated pages.

func (BookAndQuill) TotalPages added in v0.9.8

func (b BookAndQuill) TotalPages() int

TotalPages returns the total number of pages in the book.

type Boots

type Boots struct {
	// Tier is the tier of the boots.
	Tier ArmourTier
}

Boots are a defensive item that may be equipped in the boots armour slot. They come in several tiers, like leather, gold, chain, iron and diamond.

func (Boots) Boots

func (b Boots) Boots() bool

Boots ...

func (Boots) DecodeNBT added in v0.7.3

func (b Boots) DecodeNBT(data map[string]any) any

DecodeNBT ...

func (Boots) DefencePoints

func (b Boots) DefencePoints() float64

DefencePoints ...

func (Boots) DurabilityInfo

func (b Boots) DurabilityInfo() DurabilityInfo

DurabilityInfo ...

func (Boots) EnchantmentValue added in v0.8.0

func (b Boots) EnchantmentValue() int

EnchantmentValue ...

func (Boots) EncodeItem

func (b Boots) EncodeItem() (name string, meta int16)

EncodeItem ...

func (Boots) EncodeNBT added in v0.7.3

func (b Boots) EncodeNBT() map[string]any

EncodeNBT ...

func (Boots) KnockBackResistance

func (b Boots) KnockBackResistance() float64

KnockBackResistance ...

func (Boots) MaxCount

func (b Boots) MaxCount() int

MaxCount always returns 1.

func (Boots) RepairableBy added in v0.7.3

func (b Boots) RepairableBy(i Stack) bool

RepairableBy ...

func (Boots) SmeltInfo added in v0.8.0

func (b Boots) SmeltInfo() SmeltInfo

SmeltInfo ...

func (Boots) Toughness added in v0.7.0

func (b Boots) Toughness() float64

Toughness ...

func (Boots) Use

func (b Boots) Use(_ *world.World, _ User, ctx *UseContext) bool

Use handles the auto-equipping of boots in the armour slot when using it.

type BootsType added in v0.6.0

type BootsType interface {
	Armour
	Boots() bool
}

BootsType are an Armour item that can be worn in the boots slot.

type BottleOfEnchanting added in v0.8.0

type BottleOfEnchanting struct{}

BottleOfEnchanting is a bottle that releases experience orbs when thrown.

func (BottleOfEnchanting) EncodeItem added in v0.8.0

func (b BottleOfEnchanting) EncodeItem() (name string, meta int16)

EncodeItem ...

func (BottleOfEnchanting) Use added in v0.8.0

func (b BottleOfEnchanting) Use(w *world.World, user User, ctx *UseContext) bool

Use ...

type Bow added in v0.6.0

type Bow struct{}

Bow is a ranged weapon that fires arrows.

func (Bow) DurabilityInfo added in v0.6.0

func (Bow) DurabilityInfo() DurabilityInfo

DurabilityInfo ...

func (Bow) EnchantmentValue added in v0.8.0

func (Bow) EnchantmentValue() int

EnchantmentValue ...

func (Bow) EncodeItem added in v0.6.0

func (Bow) EncodeItem() (name string, meta int16)

EncodeItem ...

func (Bow) FuelInfo added in v0.8.0

func (Bow) FuelInfo() FuelInfo

FuelInfo ...

func (Bow) MaxCount added in v0.6.0

func (Bow) MaxCount() int

MaxCount always returns 1.

func (Bow) Release added in v0.6.0

func (Bow) Release(releaser Releaser, duration time.Duration, ctx *UseContext)

Release ...

func (Bow) Requirements added in v0.6.0

func (Bow) Requirements() []Stack

Requirements returns the required items to release this item.

type Bowl added in v0.1.0

type Bowl struct{}

Bowl is a container that can hold certain foods.

func (Bowl) EncodeItem added in v0.1.0

func (Bowl) EncodeItem() (name string, meta int16)

EncodeItem ...

func (Bowl) FuelInfo added in v0.8.0

func (Bowl) FuelInfo() FuelInfo

FuelInfo ...

type Bread added in v0.1.0

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

Bread is a food item that can be eaten by the player.

func (Bread) AlwaysConsumable added in v0.1.0

func (Bread) AlwaysConsumable() bool

AlwaysConsumable ...

func (Bread) CompostChance added in v0.8.2

func (Bread) CompostChance() float64

CompostChance ...

func (Bread) Consume added in v0.1.0

func (Bread) Consume(_ *world.World, c Consumer) Stack

Consume ...

func (Bread) ConsumeDuration added in v0.1.0

func (d Bread) ConsumeDuration() time.Duration

ConsumeDuration ...

func (Bread) EncodeItem added in v0.1.0

func (Bread) EncodeItem() (name string, meta int16)

EncodeItem ...

type Brick

type Brick struct{}

Brick is an item made from clay, and is used for making bricks and flower pots.

func (Brick) EncodeItem

func (b Brick) EncodeItem() (name string, meta int16)

EncodeItem ...

func (Brick) PotDecoration added in v0.9.7

func (Brick) PotDecoration() bool

PotDecoration ...

type Bucket

type Bucket struct {
	// Content is the content that the bucket has. By default, this value resolves to an empty bucket.
	Content BucketContent
}

Bucket is a tool used to carry water, lava and fish.

func (Bucket) AlwaysConsumable added in v0.8.0

func (b Bucket) AlwaysConsumable() bool

AlwaysConsumable ...

func (Bucket) CanConsume added in v0.8.0

func (b Bucket) CanConsume() bool

CanConsume ...

func (Bucket) Consume added in v0.8.0

func (b Bucket) Consume(_ *world.World, c Consumer) Stack

Consume ...

func (Bucket) ConsumeDuration added in v0.8.0

func (b Bucket) ConsumeDuration() time.Duration

ConsumeDuration ...

func (Bucket) Empty

func (b Bucket) Empty() bool

Empty returns true if the bucket is empty.

func (Bucket) EncodeItem

func (b Bucket) EncodeItem() (name string, meta int16)

EncodeItem ...

func (Bucket) FuelInfo added in v0.8.0

func (b Bucket) FuelInfo() FuelInfo

FuelInfo ...

func (Bucket) MaxCount

func (b Bucket) MaxCount() int

MaxCount returns 16.

func (Bucket) UseOnBlock

func (b Bucket) UseOnBlock(pos cube.Pos, face cube.Face, _ mgl64.Vec3, w *world.World, _ User, ctx *UseContext) bool

UseOnBlock handles the bucket filling and emptying logic.

type BucketContent added in v0.8.0

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

BucketContent is the content of a bucket.

func LiquidBucketContent added in v0.8.0

func LiquidBucketContent(l world.Liquid) BucketContent

LiquidBucketContent returns a new BucketContent with the liquid passed in.

func MilkBucketContent added in v0.8.0

func MilkBucketContent() BucketContent

MilkBucketContent returns a new BucketContent with the milk flag set.

func (BucketContent) Liquid added in v0.8.6

func (b BucketContent) Liquid() (world.Liquid, bool)

Liquid returns the world.Liquid that a Bucket with this BucketContent places. If this BucketContent does not place a liquid block, false is returned.

func (BucketContent) LiquidType added in v0.8.0

func (b BucketContent) LiquidType() string

LiquidType returns the type of liquid the bucket contains.

func (BucketContent) String added in v0.8.6

func (b BucketContent) String() string

String converts the BucketContent to a string.

type Carrier

type Carrier interface {
	world.Entity
	// HeldItems returns the items currently held by the entity. Viewers of the entity will be able to see
	// these items.
	HeldItems() (mainHand, offHand Stack)
}

Carrier represents an entity that is able to carry an item.

type CarrotOnAStick added in v0.1.0

type CarrotOnAStick struct{}

CarrotOnAStick is an item that can be used to control saddled pigs.

func (CarrotOnAStick) EncodeItem added in v0.1.0

func (CarrotOnAStick) EncodeItem() (name string, meta int16)

EncodeItem ...

func (CarrotOnAStick) MaxCount added in v0.1.0

func (CarrotOnAStick) MaxCount() int

MaxCount ...

type Charcoal added in v0.1.0

type Charcoal struct{}

Charcoal is an item obtained by smelting logs or wood.

func (Charcoal) EncodeItem added in v0.1.0

func (Charcoal) EncodeItem() (name string, meta int16)

EncodeItem ...

func (Charcoal) FuelInfo added in v0.8.0

func (Charcoal) FuelInfo() FuelInfo

FuelInfo ...

type Chestplate

type Chestplate struct {
	// Tier is the tier of the chestplate.
	Tier ArmourTier
}

Chestplate is a defensive item that may be equipped in the chestplate slot. Generally, chestplates provide the most defence of all armour items.

func (Chestplate) Chestplate

func (c Chestplate) Chestplate() bool

Chestplate ...

func (Chestplate) DecodeNBT added in v0.7.3

func (c Chestplate) DecodeNBT(data map[string]any) any

DecodeNBT ...

func (Chestplate) DefencePoints

func (c Chestplate) DefencePoints() float64

DefencePoints ...

func (Chestplate) DurabilityInfo

func (c Chestplate) DurabilityInfo() DurabilityInfo

DurabilityInfo ...

func (Chestplate) EnchantmentValue added in v0.8.0

func (c Chestplate) EnchantmentValue() int

EnchantmentValue ...

func (Chestplate) EncodeItem

func (c Chestplate) EncodeItem() (name string, meta int16)

EncodeItem ...

func (Chestplate) EncodeNBT added in v0.7.3

func (c Chestplate) EncodeNBT() map[string]any

EncodeNBT ...

func (Chestplate) KnockBackResistance

func (c Chestplate) KnockBackResistance() float64

KnockBackResistance ...

func (Chestplate) MaxCount

func (c Chestplate) MaxCount() int

MaxCount always returns 1.

func (Chestplate) RepairableBy added in v0.7.3

func (c Chestplate) RepairableBy(i Stack) bool

RepairableBy ...

func (Chestplate) SmeltInfo added in v0.8.0

func (c Chestplate) SmeltInfo() SmeltInfo

SmeltInfo ...

func (Chestplate) Toughness added in v0.7.0

func (c Chestplate) Toughness() float64

Toughness ...

func (Chestplate) Use

func (c Chestplate) Use(_ *world.World, _ User, ctx *UseContext) bool

Use handles the using of a chestplate to auto-equip it in the designated armour slot.

type ChestplateType added in v0.6.0

type ChestplateType interface {
	Armour
	Chestplate() bool
}

ChestplateType is an Armour item that can be worn in the chestplate slot.

type Chicken added in v0.1.0

type Chicken struct {

	// Cooked is whether the chicken is cooked.
	Cooked bool
	// contains filtered or unexported fields
}

Chicken is a food item obtained from chickens. It can be cooked in a furnace, smoker, or campfire.

func (Chicken) AlwaysConsumable added in v0.1.0

func (Chicken) AlwaysConsumable() bool

AlwaysConsumable ...

func (Chicken) Consume added in v0.1.0

func (c Chicken) Consume(_ *world.World, co Consumer) Stack

Consume ...

func (Chicken) ConsumeDuration added in v0.1.0

func (d Chicken) ConsumeDuration() time.Duration

ConsumeDuration ...

func (Chicken) EncodeItem added in v0.1.0

func (c Chicken) EncodeItem() (name string, meta int16)

EncodeItem ...

func (Chicken) SmeltInfo added in v0.8.0

func (c Chicken) SmeltInfo() SmeltInfo

SmeltInfo ...

type ClayBall

type ClayBall struct{}

ClayBall is obtained from mining clay blocks

func (ClayBall) EncodeItem

func (ClayBall) EncodeItem() (name string, meta int16)

EncodeItem ...

func (ClayBall) SmeltInfo added in v0.8.0

func (ClayBall) SmeltInfo() SmeltInfo

SmeltInfo ...

type Clock

type Clock struct{}

Clock is used to measure and display in-game time.

func (Clock) EncodeItem

func (w Clock) EncodeItem() (name string, meta int16)

EncodeItem ...

type Coal

type Coal struct{}

Coal is an item used as fuel & crafting torches.

func (Coal) EncodeItem

func (Coal) EncodeItem() (name string, meta int16)

EncodeItem ...

func (Coal) FuelInfo added in v0.8.0

func (Coal) FuelInfo() FuelInfo

FuelInfo ...

type Cod added in v0.1.0

type Cod struct {

	// Cooked is whether the cod is cooked.
	Cooked bool
	// contains filtered or unexported fields
}

Cod is a food item obtained from cod. It can be cooked in a furnace, smoker, or campfire.

func (Cod) AlwaysConsumable added in v0.1.0

func (Cod) AlwaysConsumable() bool

AlwaysConsumable ...

func (Cod) Consume added in v0.1.0

func (c Cod) Consume(_ *world.World, co Consumer) Stack

Consume ...

func (Cod) ConsumeDuration added in v0.1.0

func (d Cod) ConsumeDuration() time.Duration

ConsumeDuration ...

func (Cod) EncodeItem added in v0.1.0

func (c Cod) EncodeItem() (name string, meta int16)

EncodeItem ...

func (Cod) SmeltInfo added in v0.8.0

func (c Cod) SmeltInfo() SmeltInfo

SmeltInfo ...

type Colour added in v0.1.0

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

Colour represents the colour of a block. Typically, Minecraft blocks have a total of 16 different colours.

func ColourBlack added in v0.1.0

func ColourBlack() Colour

ColourBlack returns the black colour.

func ColourBlue added in v0.1.0

func ColourBlue() Colour

ColourBlue returns the blue colour.

func ColourBrown added in v0.1.0

func ColourBrown() Colour

ColourBrown returns the brown colour.

func ColourCyan added in v0.1.0

func ColourCyan() Colour

ColourCyan returns the cyan colour.

func ColourGreen added in v0.1.0

func ColourGreen() Colour

ColourGreen returns the green colour.

func ColourGrey added in v0.1.0

func ColourGrey() Colour

ColourGrey returns the grey colour.

func ColourLightBlue added in v0.1.0

func ColourLightBlue() Colour

ColourLightBlue returns the light blue colour.

func ColourLightGrey added in v0.1.0

func ColourLightGrey() Colour

ColourLightGrey returns the light grey colour.

func ColourLime added in v0.1.0

func ColourLime() Colour

ColourLime returns the lime colour.

func ColourMagenta added in v0.1.0

func ColourMagenta() Colour

ColourMagenta returns the magenta colour.

func ColourOrange added in v0.1.0

func ColourOrange() Colour

ColourOrange returns the orange colour.

func ColourPink added in v0.1.0

func ColourPink() Colour

ColourPink returns the pink colour.

func ColourPurple added in v0.1.0

func ColourPurple() Colour

ColourPurple returns the purple colour.

func ColourRed added in v0.1.0

func ColourRed() Colour

ColourRed returns the red colour.

func ColourWhite added in v0.1.0

func ColourWhite() Colour

ColourWhite returns the white colour.

func ColourYellow added in v0.1.0

func ColourYellow() Colour

ColourYellow returns the yellow colour.

func Colours added in v0.1.0

func Colours() []Colour

Colours returns a list of all existing colours.

func (Colour) RGBA added in v0.2.0

func (c Colour) RGBA() color.RGBA

RGBA returns the colour as RGBA. The alpha channel is always set to the maximum value. Colour values as returned here were obtained by placing signs in a world with all possible dyes used on them. The world was then loaded in Dragonfly to read their respective colours.

func (Colour) SilverString added in v0.9.6

func (c Colour) SilverString() string

SilverString returns the name of the colour, with light_gray being replaced by silver.

func (Colour) String added in v0.1.0

func (c Colour) String() string

String ...

func (Colour) Uint8 added in v0.1.0

func (c Colour) Uint8() uint8

Uint8 ...

type Compass added in v0.1.0

type Compass struct{}

Compass is an item used to find the spawn position of a world.

func (Compass) EncodeItem added in v0.1.0

func (Compass) EncodeItem() (name string, meta int16)

EncodeItem ...

type Compostable added in v0.8.2

type Compostable interface {
	// CompostChance returns the chance the item will produce a layer of compost in the range of 0-1.
	CompostChance() float64
}

Compostable represents an item that may be used to fill up a composter.

type Consumable

type Consumable interface {
	// AlwaysConsumable specifies if the item is always consumable. Normal food can generally only be consumed
	// when the food bar is not full or when in creative mode. Returning true here means the item can always
	// be consumed, like golden apples or potions.
	AlwaysConsumable() bool
	// ConsumeDuration is the duration consuming the item takes. If the player is using the item for at least
	// this duration, the item will be consumed and have its Consume method called.
	ConsumeDuration() time.Duration
	// Consume consumes one item of the Stack that the Consumable is in. The Stack returned is added back to
	// the inventory after consuming the item. For potions, for example, an empty bottle is returned.
	Consume(w *world.World, c Consumer) Stack
}

Consumable represents an item that may be consumed by a player. If an item implements this interface, a player may use and hold the item to consume it.

type Consumer

type Consumer interface {
	User
	// Saturate saturates the Consumer's food bar by the amount of food points passed and the saturation by
	// up to as many saturation points as passed. The final saturation will never exceed the final food level.
	Saturate(food int, saturation float64)
	// AddEffect adds an effect.Effect to the Consumer. If the effect is instant, it is applied to the Consumer
	// immediately. If not, the effect is applied to the consumer every time the Tick method is called.
	// AddEffect will overwrite any effects present if the level of the effect is higher than the existing one, or
	// if the effects' levels are equal and the new effect has a longer duration.
	AddEffect(e effect.Effect)
	// RemoveEffect removes any effect that might currently be active on the Consumer.
	RemoveEffect(e effect.Type)
	// Effects returns any effect currently applied to the Consumer. The returned effects are guaranteed not to have
	// expired when returned.
	Effects() []effect.Effect
}

Consumer represents a User that is able to consume Consumable items.

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

Cookie is a food item that can be obtained in large quantities, but do not restore hunger or saturation significantly.

func (Cookie) AlwaysConsumable added in v0.1.0

func (Cookie) AlwaysConsumable() bool

AlwaysConsumable ...

func (Cookie) CompostChance added in v0.8.2

func (Cookie) CompostChance() float64

CompostChance ...

func (Cookie) Consume added in v0.1.0

func (Cookie) Consume(_ *world.World, c Consumer) Stack

Consume ...

func (Cookie) ConsumeDuration added in v0.1.0

func (d Cookie) ConsumeDuration() time.Duration

ConsumeDuration ...

func (Cookie) EncodeItem added in v0.1.0

func (Cookie) EncodeItem() (name string, meta int16)

EncodeItem ...

type Cooldown added in v0.5.0

type Cooldown interface {
	// Cooldown is the duration of the cooldown.
	Cooldown() time.Duration
}

Cooldown represents an item that has a cooldown.

type CopperIngot added in v0.1.0

type CopperIngot struct{}

CopperIngot is a metal ingot melted from copper ore.

func (CopperIngot) EncodeItem added in v0.1.0

func (c CopperIngot) EncodeItem() (name string, meta int16)

EncodeItem ...

type Diamond

type Diamond struct{}

Diamond is a rare mineral obtained from diamond ore or loot chests.

func (Diamond) EncodeItem

func (Diamond) EncodeItem() (name string, meta int16)

EncodeItem ...

func (Diamond) PayableForBeacon

func (Diamond) PayableForBeacon() bool

PayableForBeacon ...

type DiscFragment added in v0.7.0

type DiscFragment struct{}

DiscFragment is a music disc fragment obtained from ancient city loot chests. They are extremely rare to find and nine of them in a crafting table makes a music disc named, "5".

func (DiscFragment) EncodeItem added in v0.7.0

func (DiscFragment) EncodeItem() (name string, meta int16)

EncodeItem ...

type DragonBreath added in v0.1.0

type DragonBreath struct{}

DragonBreath is a brewing item that is used solely to make lingering potions.

func (DragonBreath) EncodeItem added in v0.1.0

func (DragonBreath) EncodeItem() (name string, meta int16)

EncodeItem ...

type DriedKelp added in v0.1.0

type DriedKelp struct{}

DriedKelp is a food item that can be quickly eaten by the player.

func (DriedKelp) AlwaysConsumable added in v0.1.0

func (DriedKelp) AlwaysConsumable() bool

AlwaysConsumable ...

func (DriedKelp) CompostChance added in v0.8.2

func (DriedKelp) CompostChance() float64

CompostChance ...

func (DriedKelp) Consume added in v0.1.0

func (DriedKelp) Consume(_ *world.World, c Consumer) Stack

Consume ...

func (DriedKelp) ConsumeDuration added in v0.1.0

func (DriedKelp) ConsumeDuration() time.Duration

ConsumeDuration ...

func (DriedKelp) EncodeItem added in v0.1.0

func (DriedKelp) EncodeItem() (name string, meta int16)

EncodeItem ...

type Drinkable added in v0.6.0

type Drinkable interface {
	// Drinkable returns if the item can be drunk or not.
	Drinkable() bool
}

Drinkable represents a custom item that can be drunk. It is used to make the client show the correct drinking animation when a player is using an item. This will only have an effect on non-vanilla items.

type DurabilityInfo

type DurabilityInfo struct {
	// MaxDurability is the maximum durability that this item may have. This field must be positive for the
	// durability to function properly.
	MaxDurability int
	// BrokenItem is the item created when the item is broken. For most durable items, this is simply an
	// air item.
	BrokenItem func() Stack
	// AttackDurability and BreakDurability are the losses in durability that the item sustains when they are
	// used to do the respective actions.
	AttackDurability, BreakDurability int
	// Persistent is true if the item is persistent, i.e. it will not be destroyed when at its last durability stage.
	Persistent bool
}

DurabilityInfo is the info of a durable item. It includes fields that must be set in order to define durability related behaviour.

type Durable

type Durable interface {
	// DurabilityInfo returns info related to the durability of an item.
	DurabilityInfo() DurabilityInfo
}

Durable represents an item that has durability, and may therefore be broken. Some durable items, when broken, create a new item, such as an elytra.

type Dye added in v0.2.0

type Dye struct {
	// Colour is the colour of the dye.
	Colour Colour
}

Dye is an item that comes in 16 colours which allows you to colour blocks like concrete and sheep.

func (Dye) EncodeItem added in v0.2.0

func (d Dye) EncodeItem() (name string, meta int16)

EncodeItem ...

func (Dye) UseOnBlock added in v0.2.0

func (d Dye) UseOnBlock(pos cube.Pos, _ cube.Face, _ mgl64.Vec3, w *world.World, user User, ctx *UseContext) bool

UseOnBlock implements the colouring behaviour of signs.

type EchoShard added in v0.7.0

type EchoShard struct{}

EchoShard is an item found in ancient cities which can be used to craft recovery compasses.

func (EchoShard) EncodeItem added in v0.7.0

func (EchoShard) EncodeItem() (name string, meta int16)

EncodeItem ...

type Egg added in v0.8.1

type Egg struct{}

Egg is an item that can be used to craft food items, or as a throwable entity to spawn chicks.

func (Egg) EncodeItem added in v0.8.1

func (e Egg) EncodeItem() (name string, meta int16)

EncodeItem ...

func (Egg) MaxCount added in v0.8.1

func (e Egg) MaxCount() int

MaxCount ...

func (Egg) Use added in v0.8.1

func (e Egg) Use(w *world.World, user User, ctx *UseContext) bool

Use ...

type Elytra added in v0.8.0

type Elytra struct{}

Elytra is a pair of rare wings found in end ships that are the only single-item source of flight in Survival mode.

func (Elytra) Chestplate added in v0.8.0

func (Elytra) Chestplate() bool

Chestplate ...

func (Elytra) DefencePoints added in v0.8.0

func (Elytra) DefencePoints() float64

DefencePoints ...

func (Elytra) DurabilityInfo added in v0.8.0

func (Elytra) DurabilityInfo() DurabilityInfo

DurabilityInfo ...

func (Elytra) EncodeItem added in v0.8.0

func (Elytra) EncodeItem() (name string, meta int16)

EncodeItem ...

func (Elytra) KnockBackResistance added in v0.8.0

func (e Elytra) KnockBackResistance() float64

KnockBackResistance ...

func (Elytra) MaxCount added in v0.8.0

func (Elytra) MaxCount() int

MaxCount always returns 1.

func (Elytra) RepairableBy added in v0.8.0

func (Elytra) RepairableBy(i Stack) bool

RepairableBy ...

func (Elytra) Toughness added in v0.8.0

func (e Elytra) Toughness() float64

Toughness ...

func (Elytra) Use added in v0.8.0

func (Elytra) Use(_ *world.World, _ User, ctx *UseContext) bool

Use handles the using of an elytra to auto-equip it in an armour slot.

type Emerald

type Emerald struct{}

Emerald is a rare mineral obtained from emerald ore or from villagers.

func (Emerald) EncodeItem

func (Emerald) EncodeItem() (name string, meta int16)

EncodeItem ...

func (Emerald) PayableForBeacon

func (Emerald) PayableForBeacon() bool

PayableForBeacon ...

type Enchantable added in v0.8.0

type Enchantable interface {
	// EnchantmentValue returns the value the item may inhibit on possible enchantments.
	EnchantmentValue() int
}

Enchantable is an interface that can be implemented by items that can be enchanted through an enchanting table.

type EnchantedApple

type EnchantedApple struct{}

EnchantedApple is a rare variant of the golden apple that has stronger effects.

func (EnchantedApple) AlwaysConsumable

func (EnchantedApple) AlwaysConsumable() bool

AlwaysConsumable ...

func (EnchantedApple) Consume

func (EnchantedApple) Consume(_ *world.World, c Consumer) Stack

Consume ...

func (EnchantedApple) ConsumeDuration

func (EnchantedApple) ConsumeDuration() time.Duration

ConsumeDuration ...

func (EnchantedApple) EncodeItem

func (EnchantedApple) EncodeItem() (name string, meta int16)

EncodeItem ...

type EnchantedBook added in v0.7.0

type EnchantedBook struct{}

EnchantedBook is an item that lets players add enchantments to certain items using an anvil.

func (EnchantedBook) EncodeItem added in v0.7.0

func (EnchantedBook) EncodeItem() (name string, meta int16)

EncodeItem ...

func (EnchantedBook) MaxCount added in v0.7.0

func (b EnchantedBook) MaxCount() int

MaxCount ...

type Enchantment

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

Enchantment is an enchantment that can be applied to a Stack. It holds an EnchantmentType and level that influences the power of the enchantment.

func NewEnchantment added in v0.6.0

func NewEnchantment(t EnchantmentType, lvl int) Enchantment

NewEnchantment creates and returns an Enchantment with a specific EnchantmentType and level. If the level passed exceeds EnchantmentType.MaxLevel, NewEnchantment panics.

func (Enchantment) Level

func (e Enchantment) Level() int

Level returns the current level of the Enchantment as passed to NewEnchantment upon construction.

func (Enchantment) Type added in v0.6.0

func (e Enchantment) Type() EnchantmentType

Type returns the EnchantmentType of the Enchantment as passed to NewEnchantment upon construction.

type EnchantmentRarity added in v0.7.3

type EnchantmentRarity interface {
	// Name returns the name of the enchantment rarity.
	Name() string
	// Cost returns the cost of the enchantment rarity.
	Cost() int
	// Weight returns the weight of the enchantment rarity.
	Weight() int
}

EnchantmentRarity represents an enchantment rarity for enchantments. These rarities may inhibit certain properties, such as anvil costs or enchanting table weights.

type EnchantmentType added in v0.6.0

type EnchantmentType interface {
	// Name returns the name of the enchantment.
	Name() string
	// MaxLevel returns the maximum level the enchantment should be able to have.
	MaxLevel() int
	// Cost returns the minimum and maximum cost the enchantment may inhibit. The higher this range is, the more likely
	// better enchantments are to be selected.
	Cost(level int) (int, int)
	// Rarity returns the enchantment's rarity.
	Rarity() EnchantmentRarity
	// CompatibleWithEnchantment is called when an enchantment is added to an item. It can be used to check if
	// the enchantment is compatible with other enchantments.
	CompatibleWithEnchantment(t EnchantmentType) bool
	// CompatibleWithItem is also called when an enchantment is added to an item. It can be used to check if
	// the enchantment is compatible with the item type.
	CompatibleWithItem(i world.Item) bool
}

EnchantmentType represents an enchantment type that can be applied to a Stack, with specific behaviour that modifies the Stack's behaviour. An instance of an EnchantmentType may be created using NewEnchantment.

func EnchantmentByID

func EnchantmentByID(id int) (EnchantmentType, bool)

EnchantmentByID attempts to return an enchantment by the ID it was registered with. If found, the enchantment found is returned and the bool true.

func Enchantments added in v0.8.0

func Enchantments() []EnchantmentType

Enchantments returns a slice of all registered enchantments.

type EnderPearl added in v0.5.0

type EnderPearl struct{}

EnderPearl is a smooth, greenish-blue item used to teleport and to make an eye of ender.

func (EnderPearl) Cooldown added in v0.5.0

func (EnderPearl) Cooldown() time.Duration

Cooldown ...

func (EnderPearl) EncodeItem added in v0.5.0

func (EnderPearl) EncodeItem() (name string, meta int16)

EncodeItem ...

func (EnderPearl) MaxCount added in v0.5.0

func (EnderPearl) MaxCount() int

MaxCount ...

func (EnderPearl) Use added in v0.5.0

func (e EnderPearl) Use(w *world.World, user User, ctx *UseContext) bool

Use ...

type Feather added in v0.1.0

type Feather struct{}

Feather are items dropped by chickens and parrots, as well as tamed cats as morning gifts.

func (Feather) EncodeItem added in v0.1.0

func (Feather) EncodeItem() (name string, meta int16)

EncodeItem ...

type FermentedSpiderEye added in v0.1.0

type FermentedSpiderEye struct{}

FermentedSpiderEye is a brewing ingredient.

func (FermentedSpiderEye) EncodeItem added in v0.1.0

func (FermentedSpiderEye) EncodeItem() (name string, meta int16)

EncodeItem ...

type FireCharge added in v0.8.0

type FireCharge struct{}

FireCharge is an item that can be used to place fire when used on a block, or shot from a dispenser to create a small fireball.

func (FireCharge) EncodeItem added in v0.8.0

func (f FireCharge) EncodeItem() (name string, meta int16)

EncodeItem ...

func (FireCharge) UseOnBlock added in v0.8.0

func (f FireCharge) UseOnBlock(pos cube.Pos, face cube.Face, _ mgl64.Vec3, w *world.World, u User, ctx *UseContext) bool

UseOnBlock ...

type Firework added in v0.8.0

type Firework struct {
	// Duration is the flight duration of the firework.
	Duration time.Duration
	// Explosions is the list of explosions the firework should create when launched.
	Explosions []FireworkExplosion
}

Firework is an item (and entity) used for creating decorative explosions, boosting when flying with elytra, and loading into a crossbow as ammunition.

func (Firework) DecodeNBT added in v0.8.0

func (f Firework) DecodeNBT(data map[string]any) any

DecodeNBT ...

func (Firework) EncodeItem added in v0.8.0

func (Firework) EncodeItem() (name string, meta int16)

EncodeItem ...

func (Firework) EncodeNBT added in v0.8.0

func (f Firework) EncodeNBT() map[string]any

EncodeNBT ...

func (Firework) RandomisedDuration added in v0.8.0

func (f Firework) RandomisedDuration() time.Duration

RandomisedDuration returns the randomised flight duration of the firework.

func (Firework) Use added in v0.8.0

func (f Firework) Use(w *world.World, user User, ctx *UseContext) bool

Use ...

func (Firework) UseOnBlock added in v0.8.0

func (f Firework) UseOnBlock(blockPos cube.Pos, _ cube.Face, clickPos mgl64.Vec3, w *world.World, user User, ctx *UseContext) bool

UseOnBlock ...

type FireworkExplosion added in v0.8.0

type FireworkExplosion struct {
	// Shape represents the shape of the explosion.
	Shape FireworkShape
	// Colour is the colour of the explosion.
	Colour Colour
	// Fade is the colour the explosion should fade into. Fades must be set to true in order for this to function.
	Fade Colour
	// Fades is true if the explosion should fade into the fade colour.
	Fades bool
	// Twinkle is true if the explosion should twinkle on explode.
	Twinkle bool
	// Trail is true if the explosion should have a trail.
	Trail bool
}

FireworkExplosion represents an explosion of a firework.

func (FireworkExplosion) DecodeNBT added in v0.8.0

func (f FireworkExplosion) DecodeNBT(data map[string]any) any

DecodeNBT ...

func (FireworkExplosion) EncodeNBT added in v0.8.0

func (f FireworkExplosion) EncodeNBT() map[string]any

EncodeNBT ...

type FireworkShape added in v0.8.0

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

FireworkShape represents a shape of a firework.

func FireworkShapeBurst added in v0.8.0

func FireworkShapeBurst() FireworkShape

FireworkShapeBurst is a burst firework.

func FireworkShapeCreeperHead added in v0.8.0

func FireworkShapeCreeperHead() FireworkShape

FireworkShapeCreeperHead is a creeper head firework.

func FireworkShapeHugeSphere added in v0.8.0

func FireworkShapeHugeSphere() FireworkShape

FireworkShapeHugeSphere is a huge sphere firework.

func FireworkShapeSmallSphere added in v0.8.0

func FireworkShapeSmallSphere() FireworkShape

FireworkShapeSmallSphere is a small sphere firework.

func FireworkShapeStar added in v0.8.0

func FireworkShapeStar() FireworkShape

FireworkShapeStar is a star firework.

func FireworkShapes added in v0.8.0

func FireworkShapes() []FireworkShape

FireworkShapes ...

func (FireworkShape) Name added in v0.8.0

func (f FireworkShape) Name() string

Name ...

func (FireworkShape) String added in v0.8.0

func (f FireworkShape) String() string

String ...

func (FireworkShape) Uint8 added in v0.8.0

func (f FireworkShape) Uint8() uint8

Uint8 returns the firework as a uint8.

type FireworkStar added in v0.8.0

type FireworkStar struct {
	FireworkExplosion
}

FireworkStar is an item used to determine the color, effect, and shape of firework rockets.

func (FireworkStar) DecodeNBT added in v0.8.0

func (f FireworkStar) DecodeNBT(data map[string]any) any

DecodeNBT ...

func (FireworkStar) EncodeItem added in v0.8.0

func (f FireworkStar) EncodeItem() (name string, meta int16)

EncodeItem ...

func (FireworkStar) EncodeNBT added in v0.8.0

func (f FireworkStar) EncodeNBT() map[string]any

EncodeNBT ...

type Flint

type Flint struct{}

Flint is an item dropped rarely by gravel.

func (Flint) EncodeItem

func (Flint) EncodeItem() (name string, meta int16)

EncodeItem ...

type FlintAndSteel

type FlintAndSteel struct{}

FlintAndSteel is an item used to light blocks on fire.

func (FlintAndSteel) DurabilityInfo

func (f FlintAndSteel) DurabilityInfo() DurabilityInfo

DurabilityInfo ...

func (FlintAndSteel) EncodeItem

func (f FlintAndSteel) EncodeItem() (name string, meta int16)

EncodeItem ...

func (FlintAndSteel) MaxCount

func (f FlintAndSteel) MaxCount() int

MaxCount ...

func (FlintAndSteel) UseOnBlock

func (f FlintAndSteel) UseOnBlock(pos cube.Pos, face cube.Face, _ mgl64.Vec3, w *world.World, u User, ctx *UseContext) bool

UseOnBlock ...

type Fuel added in v0.8.0

type Fuel interface {
	// FuelInfo returns information of the item related to its fuel capabilities.
	FuelInfo() FuelInfo
}

Fuel represents an item that can be used as fuel in a smelter, such as a blast furnace, furnace, or smoker.

type FuelInfo added in v0.8.0

type FuelInfo struct {
	// Duration returns the amount of time the fuel can be used to burn an input in a smelter.
	Duration time.Duration
	// Residue is the resulting item from burning the fuel in a smelter.
	Residue Stack
}

FuelInfo is a struct returned by items that implement Fuel. It contains information about the amount of fuel time it gives, and the residue created from burning the fuel.

func (FuelInfo) WithResidue added in v0.8.0

func (f FuelInfo) WithResidue(residue Stack) FuelInfo

WithResidue returns a new FuelInfo with a residue.

type GhastTear added in v0.1.0

type GhastTear struct{}

GhastTear is a brewing item dropped by ghasts.

func (GhastTear) EncodeItem added in v0.1.0

func (GhastTear) EncodeItem() (name string, meta int16)

EncodeItem ...

type GlassBottle

type GlassBottle struct{}

GlassBottle is an item that can hold various liquids.

func (GlassBottle) EncodeItem

func (g GlassBottle) EncodeItem() (name string, meta int16)

EncodeItem ...

func (GlassBottle) UseOnBlock

func (g GlassBottle) UseOnBlock(pos cube.Pos, _ cube.Face, _ mgl64.Vec3, w *world.World, _ User, ctx *UseContext) bool

UseOnBlock ...

type Glinted added in v0.7.0

type Glinted interface {
	// Glinted returns whether the item has an enchantment glint.
	Glinted() bool
}

Glinted represents a custom item that can have a permanent enchantment glint, this glint is purely cosmetic and will show regardless of whether it is actually enchanted. An example of this is the enchanted golden apple.

type GlisteringMelonSlice added in v0.1.0

type GlisteringMelonSlice struct{}

GlisteringMelonSlice is an inedible item used for brewing potions of healing. It is also one of the many potion ingredients that can be used to make mundane potions.

func (GlisteringMelonSlice) EncodeItem added in v0.1.0

func (GlisteringMelonSlice) EncodeItem() (name string, meta int16)

EncodeItem ...

type GlowstoneDust

type GlowstoneDust struct{}

GlowstoneDust is dropped when breaking the glowstone block.

func (GlowstoneDust) EncodeItem

func (g GlowstoneDust) EncodeItem() (name string, meta int16)

EncodeItem ...

type GoatHorn added in v0.8.0

type GoatHorn struct {

	// Type is the type of the goat horn, determining the sound it plays.
	Type sound.Horn
	// contains filtered or unexported fields
}

GoatHorn is an item dropped by goats. It has eight variants, and each plays a unique sound when used which can be heard by players in a large radius.

func (GoatHorn) Cooldown added in v0.8.0

func (GoatHorn) Cooldown() time.Duration

Cooldown ...

func (GoatHorn) EncodeItem added in v0.8.0

func (g GoatHorn) EncodeItem() (name string, meta int16)

EncodeItem ...

func (GoatHorn) MaxCount added in v0.8.0

func (GoatHorn) MaxCount() int

MaxCount ...

func (GoatHorn) Release added in v0.8.0

func (GoatHorn) Release(Releaser, time.Duration, *UseContext)

func (GoatHorn) Requirements added in v0.8.0

func (GoatHorn) Requirements() []Stack

func (GoatHorn) Use added in v0.8.0

func (g GoatHorn) Use(w *world.World, u User, _ *UseContext) bool

Use ...

type GoldIngot

type GoldIngot struct{}

GoldIngot is a metal ingot melted from raw gold or obtained from loot chests.

func (GoldIngot) EncodeItem

func (GoldIngot) EncodeItem() (name string, meta int16)

EncodeItem ...

func (GoldIngot) PayableForBeacon

func (GoldIngot) PayableForBeacon() bool

PayableForBeacon ...

type GoldNugget

type GoldNugget struct{}

GoldNugget is an item used to craft gold ingots & other various gold items.

func (GoldNugget) EncodeItem

func (GoldNugget) EncodeItem() (name string, meta int16)

EncodeItem ...

type GoldenApple

type GoldenApple struct{}

GoldenApple is a special food item that bestows beneficial effects.

func (GoldenApple) AlwaysConsumable

func (e GoldenApple) AlwaysConsumable() bool

AlwaysConsumable ...

func (GoldenApple) Consume

func (e GoldenApple) Consume(_ *world.World, c Consumer) Stack

Consume ...

func (GoldenApple) ConsumeDuration

func (e GoldenApple) ConsumeDuration() time.Duration

ConsumeDuration ...

func (GoldenApple) EncodeItem

func (e GoldenApple) EncodeItem() (name string, meta int16)

EncodeItem ...

type GoldenCarrot added in v0.1.0

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

GoldenCarrot is a valuable food item and brewing ingredient. It provides the second most saturation in the game, behind Suspicious Stew crafted with either a Dandelion or Blue Orchid.

func (GoldenCarrot) AlwaysConsumable added in v0.1.0

func (GoldenCarrot) AlwaysConsumable() bool

AlwaysConsumable ...

func (GoldenCarrot) Consume added in v0.1.0

func (GoldenCarrot) Consume(_ *world.World, c Consumer) Stack

Consume ...

func (GoldenCarrot) ConsumeDuration added in v0.1.0

func (d GoldenCarrot) ConsumeDuration() time.Duration

ConsumeDuration ...

func (GoldenCarrot) EncodeItem added in v0.1.0

func (GoldenCarrot) EncodeItem() (name string, meta int16)

EncodeItem ...

type Gunpowder added in v0.1.0

type Gunpowder struct{}

Gunpowder is an item that is used for explosion-related recipes.

func (Gunpowder) EncodeItem added in v0.1.0

func (Gunpowder) EncodeItem() (name string, meta int16)

EncodeItem ...

type HandEquipped added in v0.7.0

type HandEquipped interface {
	// HandEquipped returns whether the item is hand equipped.
	HandEquipped() bool
}

HandEquipped represents an item that can be 'hand equipped'. This means the item will show up in third person like a tool, sword or stick would, giving them a different orientation in the hand and making them slightly bigger.

type HeartOfTheSea added in v0.1.0

type HeartOfTheSea struct{}

HeartOfTheSea is a rare item that can be crafted into a conduit.

func (HeartOfTheSea) EncodeItem added in v0.1.0

func (HeartOfTheSea) EncodeItem() (name string, meta int16)

EncodeItem ...

type Helmet

type Helmet struct {
	// Tier is the tier of the armour.
	Tier ArmourTier
}

Helmet is a defensive item that may be worn in the head slot. It comes in several tiers, each with different defence points and armour toughness.

func (Helmet) DecodeNBT added in v0.7.3

func (h Helmet) DecodeNBT(data map[string]any) any

DecodeNBT ...

func (Helmet) DefencePoints

func (h Helmet) DefencePoints() float64

DefencePoints ...

func (Helmet) DurabilityInfo

func (h Helmet) DurabilityInfo() DurabilityInfo

DurabilityInfo ...

func (Helmet) EnchantmentValue added in v0.8.0

func (h Helmet) EnchantmentValue() int

EnchantmentValue ...

func (Helmet) EncodeItem

func (h Helmet) EncodeItem() (name string, meta int16)

EncodeItem ...

func (Helmet) EncodeNBT added in v0.7.3

func (h Helmet) EncodeNBT() map[string]any

EncodeNBT ...

func (Helmet) Helmet

func (h Helmet) Helmet() bool

Helmet ...

func (Helmet) KnockBackResistance

func (h Helmet) KnockBackResistance() float64

KnockBackResistance ...

func (Helmet) MaxCount

func (h Helmet) MaxCount() int

MaxCount always returns 1.

func (Helmet) RepairableBy added in v0.7.3

func (h Helmet) RepairableBy(i Stack) bool

RepairableBy ...

func (Helmet) SmeltInfo added in v0.8.0

func (h Helmet) SmeltInfo() SmeltInfo

SmeltInfo ...

func (Helmet) Toughness added in v0.7.0

func (h Helmet) Toughness() float64

Toughness ...

func (Helmet) Use

func (h Helmet) Use(_ *world.World, _ User, ctx *UseContext) bool

Use handles the using of a helmet to auto-equip it in an armour slot.

type HelmetType added in v0.6.0

type HelmetType interface {
	Armour
	Helmet() bool
}

HelmetType is an Armour item that can be worn in the helmet slot.

type Hoe

type Hoe struct {
	Tier ToolTier
}

Hoe is a tool generally used to till dirt and grass blocks into farmland blocks for planting crops. Additionally, a Hoe can be used to break certain types of blocks such as Crimson and Hay Blocks.

func (Hoe) AttackDamage

func (h Hoe) AttackDamage() float64

AttackDamage ...

func (Hoe) BaseMiningEfficiency

func (h Hoe) BaseMiningEfficiency(world.Block) float64

BaseMiningEfficiency ...

func (Hoe) DurabilityInfo

func (h Hoe) DurabilityInfo() DurabilityInfo

DurabilityInfo ...

func (Hoe) EnchantmentValue added in v0.8.0

func (h Hoe) EnchantmentValue() int

EnchantmentValue ...

func (Hoe) EncodeItem

func (h Hoe) EncodeItem() (name string, meta int16)

EncodeItem ...

func (Hoe) FuelInfo added in v0.8.0

func (h Hoe) FuelInfo() FuelInfo

FuelInfo ...

func (Hoe) HarvestLevel added in v0.5.0

func (h Hoe) HarvestLevel() int

HarvestLevel returns the level that this hoe is able to harvest. If a block has a harvest level above this one, this hoe won't be able to harvest it.

func (Hoe) MaxCount

func (h Hoe) MaxCount() int

MaxCount ...

func (Hoe) RepairableBy added in v0.7.3

func (h Hoe) RepairableBy(i Stack) bool

RepairableBy ...

func (Hoe) SmeltInfo added in v0.8.0

func (h Hoe) SmeltInfo() SmeltInfo

SmeltInfo ...

func (Hoe) ToolType

func (h Hoe) ToolType() ToolType

ToolType ...

func (Hoe) UseOnBlock

func (h Hoe) UseOnBlock(pos cube.Pos, face cube.Face, _ mgl64.Vec3, w *world.World, _ User, ctx *UseContext) bool

UseOnBlock will turn a dirt or grass block into a farmland if the necessary properties are met.

type Honeycomb added in v0.1.0

type Honeycomb struct{}

Honeycomb is an item obtained from bee nests and beehives.

func (Honeycomb) EncodeItem added in v0.1.0

func (Honeycomb) EncodeItem() (name string, meta int16)

EncodeItem ...

func (Honeycomb) UseOnBlock added in v0.9.7

func (Honeycomb) UseOnBlock(pos cube.Pos, _ cube.Face, _ mgl64.Vec3, w *world.World, user User, ctx *UseContext) bool

UseOnBlock handles the logic of using an ink sac on a sign. Glowing ink sacs turn the text of these signs glowing, whereas normal ink sacs revert them back to non-glowing text.

type InkSac added in v0.1.0

type InkSac struct {
	// Glowing specifies if the ink sac is that of a glow squid. If true, it may be used on a sign to light up its text.
	Glowing bool
}

InkSac is an item dropped by a squid upon death used to create black dye, dark prismarine and book and quill. The glowing variant, obtained by killing a glow squid, may be used to cause sign text to light up.

func (InkSac) EncodeItem added in v0.1.0

func (i InkSac) EncodeItem() (name string, meta int16)

EncodeItem ...

func (InkSac) UseOnBlock added in v0.2.0

func (i InkSac) UseOnBlock(pos cube.Pos, _ cube.Face, _ mgl64.Vec3, w *world.World, user User, ctx *UseContext) bool

UseOnBlock handles the logic of using an ink sac on a sign. Glowing ink sacs turn the text of these signs glowing, whereas normal ink sacs revert them back to non-glowing text.

type IronIngot

type IronIngot struct{}

IronIngot is a metal ingot melted from raw iron or obtained from loot chests.

func (IronIngot) EncodeItem

func (IronIngot) EncodeItem() (name string, meta int16)

EncodeItem ...

func (IronIngot) PayableForBeacon

func (IronIngot) PayableForBeacon() bool

PayableForBeacon ...

type IronNugget added in v0.1.0

type IronNugget struct{}

IronNugget is a piece of iron that can be obtained by smelting iron tools/weapons or iron/chainmail armor.

func (IronNugget) EncodeItem added in v0.1.0

func (IronNugget) EncodeItem() (name string, meta int16)

EncodeItem ...

type LapisLazuli

type LapisLazuli struct{}

LapisLazuli is a mineral used for enchanting and decoration.

func (LapisLazuli) EncodeItem

func (LapisLazuli) EncodeItem() (name string, meta int16)

EncodeItem ...

type Leather

type Leather struct{}

Leather is an animal skin used to make item frames, armor and books.

func (Leather) EncodeItem

func (Leather) EncodeItem() (name string, meta int16)

EncodeItem ...

type Leggings

type Leggings struct {
	// Tier is the tier of the leggings.
	Tier ArmourTier
}

Leggings are a defensive item that may be equipped in the leggings armour slot. They come in several tiers, like leather, gold, chain, iron and diamond.

func (Leggings) DecodeNBT added in v0.7.3

func (l Leggings) DecodeNBT(data map[string]any) any

DecodeNBT ...

func (Leggings) DefencePoints

func (l Leggings) DefencePoints() float64

DefencePoints ...

func (Leggings) DurabilityInfo

func (l Leggings) DurabilityInfo() DurabilityInfo

DurabilityInfo ...

func (Leggings) EnchantmentValue added in v0.8.0

func (l Leggings) EnchantmentValue() int

EnchantmentValue ...

func (Leggings) EncodeItem

func (l Leggings) EncodeItem() (name string, meta int16)

EncodeItem ...

func (Leggings) EncodeNBT added in v0.7.3

func (l Leggings) EncodeNBT() map[string]any

EncodeNBT ...

func (Leggings) KnockBackResistance

func (l Leggings) KnockBackResistance() float64

KnockBackResistance ...

func (Leggings) Leggings

func (l Leggings) Leggings() bool

Leggings ...

func (Leggings) MaxCount

func (l Leggings) MaxCount() int

MaxCount always returns 1.

func (Leggings) RepairableBy added in v0.7.3

func (l Leggings) RepairableBy(i Stack) bool

RepairableBy ...

func (Leggings) SmeltInfo added in v0.8.0

func (l Leggings) SmeltInfo() SmeltInfo

SmeltInfo ...

func (Leggings) Toughness added in v0.7.0

func (l Leggings) Toughness() float64

Toughness ...

func (Leggings) Use

func (l Leggings) Use(_ *world.World, _ User, ctx *UseContext) bool

Use handles the auto-equipping of leggings in an armour slot by using the item.

type LeggingsType added in v0.6.0

type LeggingsType interface {
	Armour
	Leggings() bool
}

LeggingsType are an Armour item that can be worn in the leggings slot.

type LingeringPotion added in v0.8.0

type LingeringPotion struct {
	// Type is the type of lingering potion.
	Type potion.Potion
}

LingeringPotion is a variant of a splash potion that can be thrown to leave clouds with status effects that linger on the ground in an area.

func (LingeringPotion) EncodeItem added in v0.8.0

func (l LingeringPotion) EncodeItem() (name string, meta int16)

EncodeItem ...

func (LingeringPotion) MaxCount added in v0.8.0

func (l LingeringPotion) MaxCount() int

MaxCount ...

func (LingeringPotion) Use added in v0.8.0

func (l LingeringPotion) Use(w *world.World, user User, ctx *UseContext) bool

Use ...

type MagmaCream

type MagmaCream struct{}

MagmaCream is an item used in brewing to create potions of Fire Resistance, and to build magma blocks.

func (MagmaCream) EncodeItem

func (m MagmaCream) EncodeItem() (name string, meta int16)

EncodeItem ...

type MaxCounter

type MaxCounter interface {
	// MaxCount returns the maximum number of items that a stack may be composed of. The number returned must
	// be positive.
	MaxCount() int
}

MaxCounter represents an item that has a specific max count. By default, each item will be expected to have a maximum count of 64. MaxCounter may be implemented to change this behaviour.

type MelonSlice

type MelonSlice struct{}

MelonSlice is a food item dropped by melon blocks.

func (MelonSlice) AlwaysConsumable

func (m MelonSlice) AlwaysConsumable() bool

AlwaysConsumable ...

func (MelonSlice) CompostChance added in v0.8.2

func (MelonSlice) CompostChance() float64

CompostChance ...

func (MelonSlice) Consume

func (m MelonSlice) Consume(_ *world.World, c Consumer) Stack

Consume ...

func (MelonSlice) ConsumeDuration

func (m MelonSlice) ConsumeDuration() time.Duration

ConsumeDuration ...

func (MelonSlice) EncodeItem

func (m MelonSlice) EncodeItem() (name string, meta int16)

EncodeItem ...

type MushroomStew added in v0.1.0

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

MushroomStew is a food item.

func (MushroomStew) AlwaysConsumable added in v0.1.0

func (MushroomStew) AlwaysConsumable() bool

AlwaysConsumable ...

func (MushroomStew) Consume added in v0.1.0

func (MushroomStew) Consume(_ *world.World, c Consumer) Stack

Consume ...

func (MushroomStew) ConsumeDuration added in v0.1.0

func (d MushroomStew) ConsumeDuration() time.Duration

ConsumeDuration ...

func (MushroomStew) EncodeItem added in v0.1.0

func (MushroomStew) EncodeItem() (name string, meta int16)

EncodeItem ...

func (MushroomStew) MaxCount added in v0.1.0

func (MushroomStew) MaxCount() int

MaxCount ...

type MusicDisc added in v0.8.0

type MusicDisc struct {
	// DiscType is the disc type of the music disc.
	DiscType sound.DiscType
}

MusicDisc is an item that can be played in jukeboxes.

func (MusicDisc) EncodeItem added in v0.8.0

func (m MusicDisc) EncodeItem() (name string, meta int16)

EncodeItem ...

func (MusicDisc) MaxCount added in v0.8.0

func (MusicDisc) MaxCount() int

MaxCount always returns 1.

type Mutton added in v0.1.0

type Mutton struct {

	// Cooked is whether the mutton is cooked.
	Cooked bool
	// contains filtered or unexported fields
}

Mutton is a food item obtained from sheep. It can be cooked in a furnace, smoker, or campfire.

func (Mutton) AlwaysConsumable added in v0.1.0

func (Mutton) AlwaysConsumable() bool

AlwaysConsumable ...

func (Mutton) Consume added in v0.1.0

func (m Mutton) Consume(_ *world.World, c Consumer) Stack

Consume ...

func (Mutton) ConsumeDuration added in v0.1.0

func (d Mutton) ConsumeDuration() time.Duration

ConsumeDuration ...

func (Mutton) EncodeItem added in v0.1.0

func (m Mutton) EncodeItem() (name string, meta int16)

EncodeItem ...

func (Mutton) SmeltInfo added in v0.8.0

func (m Mutton) SmeltInfo() SmeltInfo

SmeltInfo ...

type NautilusShell added in v0.1.0

type NautilusShell struct{}

NautilusShell is an item that is used for crafting conduits.

func (NautilusShell) EncodeItem added in v0.1.0

func (NautilusShell) EncodeItem() (name string, meta int16)

EncodeItem ...

type NetherBrick added in v0.1.0

type NetherBrick struct{}

NetherBrick is an item made by smelting netherrack in a furnace.

func (NetherBrick) EncodeItem added in v0.1.0

func (NetherBrick) EncodeItem() (name string, meta int16)

EncodeItem ...

type NetherQuartz

type NetherQuartz struct{}

NetherQuartz is a smooth, white mineral found in the Nether.

func (NetherQuartz) EncodeItem

func (NetherQuartz) EncodeItem() (name string, meta int16)

EncodeItem ...

type NetherStar added in v0.1.0

type NetherStar struct{}

NetherStar is a rare item dropped by the wither that is used solely to craft beacons.

func (NetherStar) EncodeItem added in v0.1.0

func (NetherStar) EncodeItem() (name string, meta int16)

EncodeItem ...

type NetheriteIngot

type NetheriteIngot struct{}

NetheriteIngot is a rare mineral crafted with 4 pieces of netherite scrap and 4 gold ingots.

func (NetheriteIngot) EncodeItem

func (NetheriteIngot) EncodeItem() (name string, meta int16)

EncodeItem ...

func (NetheriteIngot) PayableForBeacon

func (NetheriteIngot) PayableForBeacon() bool

PayableForBeacon ...

type NetheriteScrap added in v0.1.0

type NetheriteScrap struct{}

NetheriteScrap is a material smelted from ancient debris, which is found in the Nether.

func (NetheriteScrap) EncodeItem added in v0.1.0

func (NetheriteScrap) EncodeItem() (name string, meta int16)

EncodeItem ...

type OffHand added in v0.6.0

type OffHand interface {
	// OffHand returns true if the item can be held in the off hand.
	OffHand() bool
}

OffHand represents an item that can be held in the off hand.

type Paper added in v0.1.0

type Paper struct{}

Paper is an item crafted from sugar cane.

func (Paper) EncodeItem added in v0.1.0

func (Paper) EncodeItem() (name string, meta int16)

EncodeItem ...

type PhantomMembrane added in v0.1.0

type PhantomMembrane struct{}

PhantomMembrane are leathery skins obtained from killing phantoms.

func (PhantomMembrane) EncodeItem added in v0.1.0

func (PhantomMembrane) EncodeItem() (name string, meta int16)

EncodeItem ...

type Pickaxe

type Pickaxe struct {
	// Tier is the tier of the pickaxe.
	Tier ToolTier
}

Pickaxe is a tool generally used for mining stone-like blocks and ores at a higher speed and to obtain their drops.

func (Pickaxe) AttackDamage

func (p Pickaxe) AttackDamage() float64

AttackDamage returns the attack damage to the pickaxe.

func (Pickaxe) BaseMiningEfficiency

func (p Pickaxe) BaseMiningEfficiency(world.Block) float64

BaseMiningEfficiency is the base efficiency of the pickaxe, when it comes to mining blocks. This decides the speed with which blocks can be mined.

func (Pickaxe) DurabilityInfo

func (p Pickaxe) DurabilityInfo() DurabilityInfo

DurabilityInfo ...

func (Pickaxe) EnchantmentValue added in v0.8.0

func (p Pickaxe) EnchantmentValue() int

EnchantmentValue ...

func (Pickaxe) EncodeItem

func (p Pickaxe) EncodeItem() (name string, meta int16)

EncodeItem ...

func (Pickaxe) FuelInfo added in v0.8.0

func (p Pickaxe) FuelInfo() FuelInfo

FuelInfo ...

func (Pickaxe) HarvestLevel

func (p Pickaxe) HarvestLevel() int

HarvestLevel returns the level that this pickaxe is able to harvest. If a block has a harvest level above this one, this pickaxe won't be able to harvest it.

func (Pickaxe) MaxCount

func (p Pickaxe) MaxCount() int

MaxCount returns 1.

func (Pickaxe) RepairableBy added in v0.7.3

func (p Pickaxe) RepairableBy(i Stack) bool

RepairableBy ...

func (Pickaxe) SmeltInfo added in v0.8.0

func (p Pickaxe) SmeltInfo() SmeltInfo

SmeltInfo ...

func (Pickaxe) ToolType

func (p Pickaxe) ToolType() ToolType

ToolType returns the type for pickaxes.

type PoisonousPotato

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

PoisonousPotato is a type of potato that can poison the player.

func (PoisonousPotato) AlwaysConsumable

func (PoisonousPotato) AlwaysConsumable() bool

AlwaysConsumable ...

func (PoisonousPotato) Consume

func (p PoisonousPotato) Consume(_ *world.World, c Consumer) Stack

Consume ...

func (PoisonousPotato) ConsumeDuration

func (d PoisonousPotato) ConsumeDuration() time.Duration

ConsumeDuration ...

func (PoisonousPotato) EncodeItem

func (p PoisonousPotato) EncodeItem() (name string, meta int16)

EncodeItem ...

type PoppedChorusFruit added in v0.1.0

type PoppedChorusFruit struct{}

PoppedChorusFruit is an item obtained by smelting chorus fruit, and used to craft end rods and purpur blocks. Unlike raw chorus fruit, the popped fruit is inedible.

func (PoppedChorusFruit) EncodeItem added in v0.1.0

func (PoppedChorusFruit) EncodeItem() (name string, meta int16)

EncodeItem ...

type Porkchop added in v0.1.0

type Porkchop struct {

	// Cooked is whether the porkchop is cooked.
	Cooked bool
	// contains filtered or unexported fields
}

Porkchop is a food item obtained from pigs. It can be cooked in a furnace, smoker, or campfire.

func (Porkchop) AlwaysConsumable added in v0.1.0

func (Porkchop) AlwaysConsumable() bool

AlwaysConsumable ...

func (Porkchop) Consume added in v0.1.0

func (p Porkchop) Consume(_ *world.World, c Consumer) Stack

Consume ...

func (Porkchop) ConsumeDuration added in v0.1.0

func (d Porkchop) ConsumeDuration() time.Duration

ConsumeDuration ...

func (Porkchop) EncodeItem added in v0.1.0

func (p Porkchop) EncodeItem() (name string, meta int16)

EncodeItem ...

func (Porkchop) SmeltInfo added in v0.8.0

func (p Porkchop) SmeltInfo() SmeltInfo

SmeltInfo ...

type Potion

type Potion struct {
	// Type is the type of potion.
	Type potion.Potion
}

Potion is an item that grants effects on consumption.

func (Potion) AlwaysConsumable

func (p Potion) AlwaysConsumable() bool

AlwaysConsumable ...

func (Potion) Consume

func (p Potion) Consume(_ *world.World, c Consumer) Stack

Consume ...

func (Potion) ConsumeDuration

func (p Potion) ConsumeDuration() time.Duration

ConsumeDuration ...

func (Potion) EncodeItem

func (p Potion) EncodeItem() (name string, meta int16)

EncodeItem ...

func (Potion) MaxCount

func (p Potion) MaxCount() int

MaxCount ...

type PotterySherd added in v0.9.7

type PotterySherd struct {
	Type SherdType
}

PotterySherd is an item that can be found from brushing suspicious sand or gravel.

func (PotterySherd) EncodeItem added in v0.9.7

func (s PotterySherd) EncodeItem() (name string, meta int16)

EncodeItem ...

func (PotterySherd) PotDecoration added in v0.9.7

func (PotterySherd) PotDecoration() bool

PotDecoration ...

type PrismarineCrystals

type PrismarineCrystals struct{}

PrismarineCrystals are items obtained by defeating guardians or elder guardians. They are used for crafting sea lanterns.

func (PrismarineCrystals) EncodeItem

func (p PrismarineCrystals) EncodeItem() (name string, meta int16)

EncodeItem ...

type PrismarineShard added in v0.1.0

type PrismarineShard struct{}

PrismarineShard is an item obtained by defeating guardians or elder guardians.

func (PrismarineShard) EncodeItem added in v0.1.0

func (PrismarineShard) EncodeItem() (name string, meta int16)

EncodeItem ...

type Pufferfish

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

Pufferfish is a poisonous type of fish that is used to brew water breathing potions.

func (Pufferfish) AlwaysConsumable

func (Pufferfish) AlwaysConsumable() bool

AlwaysConsumable ...

func (Pufferfish) Consume

func (p Pufferfish) Consume(_ *world.World, c Consumer) Stack

Consume ...

func (Pufferfish) ConsumeDuration

func (d Pufferfish) ConsumeDuration() time.Duration

ConsumeDuration ...

func (Pufferfish) EncodeItem

func (p Pufferfish) EncodeItem() (name string, meta int16)

EncodeItem ...

type PumpkinPie added in v0.1.0

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

PumpkinPie is a food item that can be eaten by the player.

func (PumpkinPie) AlwaysConsumable added in v0.1.0

func (PumpkinPie) AlwaysConsumable() bool

AlwaysConsumable ...

func (PumpkinPie) CompostChance added in v0.8.2

func (PumpkinPie) CompostChance() float64

CompostChance ...

func (PumpkinPie) Consume added in v0.1.0

func (PumpkinPie) Consume(_ *world.World, c Consumer) Stack

Consume ...

func (PumpkinPie) ConsumeDuration added in v0.1.0

func (d PumpkinPie) ConsumeDuration() time.Duration

ConsumeDuration ...

func (PumpkinPie) EncodeItem added in v0.1.0

func (PumpkinPie) EncodeItem() (name string, meta int16)

EncodeItem ...

type Rabbit added in v0.1.0

type Rabbit struct {

	// Cooked is whether the rabbit is cooked.
	Cooked bool
	// contains filtered or unexported fields
}

Rabbit is a food item obtained from rabbits. It can be cooked in a furnace, smoker, or campfire.

func (Rabbit) AlwaysConsumable added in v0.1.0

func (Rabbit) AlwaysConsumable() bool

AlwaysConsumable ...

func (Rabbit) Consume added in v0.1.0

func (r Rabbit) Consume(_ *world.World, c Consumer) Stack

Consume ...

func (Rabbit) ConsumeDuration added in v0.1.0

func (d Rabbit) ConsumeDuration() time.Duration

ConsumeDuration ...

func (Rabbit) EncodeItem added in v0.1.0

func (r Rabbit) EncodeItem() (name string, meta int16)

EncodeItem ...

func (Rabbit) SmeltInfo added in v0.8.0

func (r Rabbit) SmeltInfo() SmeltInfo

SmeltInfo ...

type RabbitFoot added in v0.1.0

type RabbitFoot struct{}

RabbitFoot is a brewing item obtained from rabbits.

func (RabbitFoot) EncodeItem added in v0.1.0

func (RabbitFoot) EncodeItem() (name string, meta int16)

EncodeItem ...

type RabbitHide added in v0.1.0

type RabbitHide struct{}

RabbitHide is an item dropped by rabbits.

func (RabbitHide) EncodeItem added in v0.1.0

func (RabbitHide) EncodeItem() (name string, meta int16)

EncodeItem ...

type RabbitStew added in v0.1.0

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

RabbitStew is a food item that can be eaten by the player.

func (RabbitStew) AlwaysConsumable added in v0.1.0

func (RabbitStew) AlwaysConsumable() bool

AlwaysConsumable ...

func (RabbitStew) Consume added in v0.1.0

func (RabbitStew) Consume(_ *world.World, c Consumer) Stack

Consume ...

func (RabbitStew) ConsumeDuration added in v0.1.0

func (d RabbitStew) ConsumeDuration() time.Duration

ConsumeDuration ...

func (RabbitStew) EncodeItem added in v0.1.0

func (RabbitStew) EncodeItem() (name string, meta int16)

EncodeItem ...

func (RabbitStew) MaxCount added in v0.1.0

func (RabbitStew) MaxCount() int

MaxCount ...

type RawCopper added in v0.1.0

type RawCopper struct{}

RawCopper is a raw metal resource obtained from mining copper ore.

func (RawCopper) EncodeItem added in v0.1.0

func (RawCopper) EncodeItem() (name string, meta int16)

EncodeItem ...

func (RawCopper) SmeltInfo added in v0.8.0

func (RawCopper) SmeltInfo() SmeltInfo

SmeltInfo ...

type RawGold added in v0.1.0

type RawGold struct{}

RawGold is a raw metal resource obtained from mining gold ore.

func (RawGold) EncodeItem added in v0.1.0

func (RawGold) EncodeItem() (name string, meta int16)

EncodeItem ...

func (RawGold) SmeltInfo added in v0.8.0

func (RawGold) SmeltInfo() SmeltInfo

SmeltInfo ...

type RawIron added in v0.1.0

type RawIron struct{}

RawIron is a raw metal resource obtained from mining iron ore.

func (RawIron) EncodeItem added in v0.1.0

func (RawIron) EncodeItem() (name string, meta int16)

EncodeItem ...

func (RawIron) SmeltInfo added in v0.8.0

func (RawIron) SmeltInfo() SmeltInfo

SmeltInfo ...

type RecoveryCompass added in v0.8.2

type RecoveryCompass struct{}

RecoveryCompass is an item used to point to the location of the player's last death.

func (RecoveryCompass) EncodeItem added in v0.8.2

func (RecoveryCompass) EncodeItem() (name string, meta int16)

EncodeItem ...

type Releasable added in v0.6.0

type Releasable interface {
	// Release is called when an item is released.
	Release(releaser Releaser, duration time.Duration, ctx *UseContext)
	// Requirements returns the required items to release this item.
	Requirements() []Stack
}

Releasable represents an item that can be released.

type Releaser added in v0.6.0

type Releaser interface {
	User
	// GameMode returns the gamemode of the releaser.
	GameMode() world.GameMode
	// PlaySound plays a world.Sound that only this Releaser can hear.
	PlaySound(sound world.Sound)
}

Releaser represents an entity that can release items, such as bows.

type Repairable added in v0.7.3

type Repairable interface {
	Durable
	RepairableBy(i Stack) bool
}

Repairable represents a durable item that can be repaired by other items.

type RottenFlesh added in v0.1.0

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

RottenFlesh is a food item that can be eaten by the player, at the high risk of inflicting Hunger.

func (RottenFlesh) AlwaysConsumable added in v0.1.0

func (RottenFlesh) AlwaysConsumable() bool

AlwaysConsumable ...

func (RottenFlesh) Consume added in v0.1.0

func (RottenFlesh) Consume(_ *world.World, c Consumer) Stack

Consume ...

func (RottenFlesh) ConsumeDuration added in v0.1.0

func (d RottenFlesh) ConsumeDuration() time.Duration

ConsumeDuration ...

func (RottenFlesh) EncodeItem added in v0.1.0

func (RottenFlesh) EncodeItem() (name string, meta int16)

EncodeItem ...

type Salmon added in v0.1.0

type Salmon struct {

	// Cooked is whether the salmon is cooked.
	Cooked bool
	// contains filtered or unexported fields
}

Salmon is a food item obtained from salmons. It can be cooked in a furnace, smoker, or campfire.

func (Salmon) AlwaysConsumable added in v0.1.0

func (Salmon) AlwaysConsumable() bool

AlwaysConsumable ...

func (Salmon) Consume added in v0.1.0

func (s Salmon) Consume(_ *world.World, c Consumer) Stack

Consume ...

func (Salmon) ConsumeDuration added in v0.1.0

func (d Salmon) ConsumeDuration() time.Duration

ConsumeDuration ...

func (Salmon) EncodeItem added in v0.1.0

func (s Salmon) EncodeItem() (name string, meta int16)

EncodeItem ...

func (Salmon) SmeltInfo added in v0.8.0

func (s Salmon) SmeltInfo() SmeltInfo

SmeltInfo ...

type Scute added in v0.1.0

type Scute struct{}

Scute is an item that baby turtles drop when they grow into adults.

func (Scute) EncodeItem added in v0.1.0

func (Scute) EncodeItem() (name string, meta int16)

EncodeItem ...

type Shears

type Shears struct{}

Shears is a tool used to shear sheep, mine a few types of blocks, and carve pumpkins.

func (Shears) BaseMiningEfficiency

func (s Shears) BaseMiningEfficiency(world.Block) float64

BaseMiningEfficiency ...

func (Shears) DurabilityInfo

func (s Shears) DurabilityInfo() DurabilityInfo

DurabilityInfo ...

func (Shears) EncodeItem

func (s Shears) EncodeItem() (name string, meta int16)

EncodeItem ...

func (Shears) HarvestLevel

func (s Shears) HarvestLevel() int

HarvestLevel ...

func (Shears) MaxCount

func (s Shears) MaxCount() int

MaxCount ...

func (Shears) ToolType

func (s Shears) ToolType() ToolType

ToolType ...

func (Shears) UseOnBlock

func (s Shears) UseOnBlock(pos cube.Pos, face cube.Face, _ mgl64.Vec3, w *world.World, _ User, ctx *UseContext) bool

UseOnBlock ...

type SherdType added in v0.9.7

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

SherdType represents the sherdType of a block.

func SherdTypeAngler added in v0.9.7

func SherdTypeAngler() SherdType

SherdTypeAngler returns the angler sherd type.

func SherdTypeArcher added in v0.9.7

func SherdTypeArcher() SherdType

SherdTypeArcher returns the archer sherd type.

func SherdTypeArmsUp added in v0.9.7

func SherdTypeArmsUp() SherdType

SherdTypeArmsUp returns the arms up sherd type.

func SherdTypeBlade added in v0.9.7

func SherdTypeBlade() SherdType

SherdTypeBlade returns the blade sherd type.

func SherdTypeBrewer added in v0.9.7

func SherdTypeBrewer() SherdType

SherdTypeBrewer returns the brewer sherd type.

func SherdTypeBurn added in v0.9.7

func SherdTypeBurn() SherdType

SherdTypeBurn returns the burn sherd type.

func SherdTypeDanger added in v0.9.7

func SherdTypeDanger() SherdType

SherdTypeDanger returns the danger sherd type.

func SherdTypeExplorer added in v0.9.7

func SherdTypeExplorer() SherdType

SherdTypeExplorer returns the explorer sherd type.

func SherdTypeFriend added in v0.9.7

func SherdTypeFriend() SherdType

SherdTypeFriend returns the friend sherd type.

func SherdTypeHeart added in v0.9.7

func SherdTypeHeart() SherdType

SherdTypeHeart returns the heart sherd type.

func SherdTypeHeartbreak added in v0.9.7

func SherdTypeHeartbreak() SherdType

SherdTypeHeartbreak returns the heartbreak sherd type.

func SherdTypeHowl added in v0.9.7

func SherdTypeHowl() SherdType

SherdTypeHowl returns the howl sherd type.

func SherdTypeMiner added in v0.9.7

func SherdTypeMiner() SherdType

SherdTypeMiner returns the miner sherd type.

func SherdTypeMourner added in v0.9.7

func SherdTypeMourner() SherdType

SherdTypeMourner returns the mourner sherd type.

func SherdTypePlenty added in v0.9.7

func SherdTypePlenty() SherdType

SherdTypePlenty returns the plenty sherd type.

func SherdTypePrize added in v0.9.7

func SherdTypePrize() SherdType

SherdTypePrize returns the prize sherd type.

func SherdTypeSheaf added in v0.9.7

func SherdTypeSheaf() SherdType

SherdTypeSheaf returns the sheaf sherd type.

func SherdTypeShelter added in v0.9.7

func SherdTypeShelter() SherdType

SherdTypeShelter returns the shelter sherd type.

func SherdTypeSkull added in v0.9.7

func SherdTypeSkull() SherdType

SherdTypeSkull returns the skull sherd type.

func SherdTypeSnort added in v0.9.7

func SherdTypeSnort() SherdType

SherdTypeSnort returns the snort sherd type.

func SherdTypes added in v0.9.7

func SherdTypes() []SherdType

SherdTypes returns a list of all existing sherd types.

func (SherdType) String added in v0.9.7

func (c SherdType) String() string

String ...

func (SherdType) Uint8 added in v0.9.7

func (c SherdType) Uint8() uint8

Uint8 ...

type Shovel

type Shovel struct {
	// Tier is the tier of the shovel.
	Tier ToolTier
}

Shovel is a tool generally used for mining ground-like blocks, such as sand, gravel and dirt. Additionally, shovels may be used to turn grass into dirt paths.

func (Shovel) AttackDamage

func (s Shovel) AttackDamage() float64

AttackDamage returns the attack damage to the shovel.

func (Shovel) BaseMiningEfficiency

func (s Shovel) BaseMiningEfficiency(world.Block) float64

BaseMiningEfficiency ...

func (Shovel) DurabilityInfo

func (s Shovel) DurabilityInfo() DurabilityInfo

DurabilityInfo ...

func (Shovel) EnchantmentValue added in v0.8.0

func (s Shovel) EnchantmentValue() int

EnchantmentValue ...

func (Shovel) EncodeItem

func (s Shovel) EncodeItem() (name string, meta int16)

EncodeItem ...

func (Shovel) FuelInfo added in v0.8.0

func (s Shovel) FuelInfo() FuelInfo

FuelInfo ...

func (Shovel) HarvestLevel

func (s Shovel) HarvestLevel() int

HarvestLevel ...

func (Shovel) MaxCount

func (s Shovel) MaxCount() int

MaxCount always returns 1.

func (Shovel) RepairableBy added in v0.7.3

func (s Shovel) RepairableBy(i Stack) bool

RepairableBy ...

func (Shovel) SmeltInfo added in v0.8.0

func (s Shovel) SmeltInfo() SmeltInfo

SmeltInfo ...

func (Shovel) ToolType

func (s Shovel) ToolType() ToolType

ToolType returns the tool type for shovels.

func (Shovel) UseOnBlock

func (s Shovel) UseOnBlock(pos cube.Pos, face cube.Face, _ mgl64.Vec3, w *world.World, _ User, ctx *UseContext) bool

UseOnBlock handles the creation of dirt path blocks from dirt or grass blocks.

type ShulkerShell added in v0.1.0

type ShulkerShell struct{}

ShulkerShell are items dropped by shulkers that are used solely to craft shulker boxes.

func (ShulkerShell) EncodeItem added in v0.1.0

func (ShulkerShell) EncodeItem() (name string, meta int16)

EncodeItem ...

type Slimeball added in v0.1.0

type Slimeball struct{}

Slimeball is a crafting ingredient commonly dropped by slimes, and can be sneezed out by pandas.

func (Slimeball) EncodeItem added in v0.1.0

func (Slimeball) EncodeItem() (name string, meta int16)

EncodeItem ...

type SmeltInfo added in v0.8.0

type SmeltInfo struct {
	// Product returns the resulting item stack from smelting the item.
	Product Stack
	// Experience returns the experience gained from performing the smelt, alongside the Product.
	Experience float64
	// Food returns true if the smelt is food, for smelters such as smokers or regular furnaces.
	Food bool
	// Ores returns true if the smelt is ores, for smelters such as blast furnaces or regular furnaces.
	Ores bool
}

SmeltInfo is a struct returned by items that implement Smeltable. It contains information about the product, experience gained, and more.

type Smeltable added in v0.8.0

type Smeltable interface {
	// SmeltInfo returns information of the item related to it's smelting capabilities.
	SmeltInfo() SmeltInfo
}

Smeltable represents an item that can be input into a smelter, such as a blast furnace, furnace, or smoker, to cook and transform it into a different item.

type Snowball added in v0.4.0

type Snowball struct{}

Snowball is a throwable combat item obtained through shovelling snow.

func (Snowball) EncodeItem added in v0.4.0

func (s Snowball) EncodeItem() (name string, meta int16)

EncodeItem ...

func (Snowball) MaxCount added in v0.4.0

func (s Snowball) MaxCount() int

MaxCount ...

func (Snowball) Use added in v0.4.0

func (s Snowball) Use(w *world.World, user User, ctx *UseContext) bool

Use ...

type SpiderEye added in v0.1.0

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

SpiderEye is a poisonous food and brewing item.

func (SpiderEye) AlwaysConsumable added in v0.1.0

func (SpiderEye) AlwaysConsumable() bool

AlwaysConsumable ...

func (SpiderEye) Consume added in v0.1.0

func (SpiderEye) Consume(_ *world.World, c Consumer) Stack

Consume ...

func (SpiderEye) ConsumeDuration added in v0.1.0

func (d SpiderEye) ConsumeDuration() time.Duration

ConsumeDuration ...

func (SpiderEye) EncodeItem added in v0.1.0

func (SpiderEye) EncodeItem() (name string, meta int16)

EncodeItem ...

type SplashPotion added in v0.5.0

type SplashPotion struct {
	// Type is the type of splash potion.
	Type potion.Potion
}

SplashPotion is an item that grants effects when thrown.

func (SplashPotion) EncodeItem added in v0.5.0

func (s SplashPotion) EncodeItem() (name string, meta int16)

EncodeItem ...

func (SplashPotion) MaxCount added in v0.5.0

func (s SplashPotion) MaxCount() int

MaxCount ...

func (SplashPotion) Use added in v0.5.0

func (s SplashPotion) Use(w *world.World, user User, ctx *UseContext) bool

Use ...

type Spyglass added in v0.6.0

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

Spyglass is an item that zooms in on an area the player is looking at, like a telescope.

func (Spyglass) EncodeItem added in v0.6.0

func (Spyglass) EncodeItem() (name string, meta int16)

EncodeItem ...

func (Spyglass) MaxCount added in v0.6.0

func (Spyglass) MaxCount() int

MaxCount always returns 1.

func (Spyglass) Release added in v0.6.0

func (Spyglass) Release(Releaser, time.Duration, *UseContext)

func (Spyglass) Requirements added in v0.6.0

func (Spyglass) Requirements() []Stack

type Stack

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

Stack represents a stack of items. The stack shares the same item type and has a count which specifies the size of the stack.

func NewStack

func NewStack(t world.Item, count int) Stack

NewStack returns a new stack using the item type and the count passed. NewStack panics if the count passed is negative or if the item type passed is nil.

func (Stack) AddStack

func (s Stack) AddStack(s2 Stack) (a, b Stack)

AddStack adds another stack to the stack and returns both stacks. The first stack returned will have as many items in it as possible to fit in the stack, according to a max count of either 64 or otherwise as returned by Item.MaxCount(). The second stack will have the leftover items: It may be empty if the count of both stacks together don't exceed the max count. If the two stacks are not comparable, AddStack will return both the original stack and the stack passed.

func (Stack) AnvilCost added in v0.7.3

func (s Stack) AnvilCost() int

AnvilCost returns the number of experience levels to add to the base level cost when repairing, combining, or renaming this item with an anvil.

func (Stack) AttackDamage

func (s Stack) AttackDamage() float64

AttackDamage returns the attack damage to the stack. By default, the value returned is 1.0. If the item held implements the item.Weapon interface, this damage may be different.

func (Stack) Comparable

func (s Stack) Comparable(s2 Stack) bool

Comparable checks if two stacks can be considered comparable. True is returned if the two stacks have an equal item type and have equal enchantments, lore and custom names, or if one of the stacks is empty. Comparable does not check if the two stacks have the same durability.

func (Stack) Count

func (s Stack) Count() int

Count returns the amount of items that is present on the stack. The count is guaranteed never to be negative.

func (Stack) CustomName

func (s Stack) CustomName() string

CustomName returns the custom name set for the Stack. An empty string is returned if the Stack has no custom name set.

func (Stack) Damage

func (s Stack) Damage(d int) Stack

Damage returns a new stack that is damaged by the amount passed. (Meaning, its durability lowered by the amount passed.) If the item does not implement the Durable interface, the original stack is returned. The damage passed may be negative to add durability. If the final durability reaches 0 or below, the item returned is the resulting item of the breaking of the item. If the final durability reaches a number higher than the maximum durability, the stack returned will get the maximum durability.

func (Stack) Durability

func (s Stack) Durability() int

Durability returns the current durability of the item stack. If the item is not one that implements the Durable interface, BaseDurability will always return -1. The closer the durability returned is to 0, the closer the item is to being broken.

func (Stack) Empty

func (s Stack) Empty() bool

Empty checks if the stack is empty (has a count of 0).

func (Stack) Enchantment

func (s Stack) Enchantment(enchant EnchantmentType) (Enchantment, bool)

Enchantment attempts to return an Enchantment set to the Stack using Stack.WithEnchantment(). If an Enchantment is found by the EnchantmentType, the enchantment and the bool true is returned.

func (Stack) Enchantments

func (s Stack) Enchantments() []Enchantment

Enchantments returns an array of all Enchantments on the item. Enchantments returns the enchantments of a Stack in a deterministic order.

func (Stack) Equal

func (s Stack) Equal(s2 Stack) bool

Equal checks if the two stacks are equal. Equal is equivalent to a Stack.Comparable check while also checking the count and durability.

func (Stack) Grow

func (s Stack) Grow(n int) Stack

Grow grows the Stack's count by n, returning the resulting Stack. If a positive number is passed, the stack is grown, whereas if a negative size is passed, the resulting Stack will have a lower count. The count of the returned Stack will never be negative.

func (Stack) Item

func (s Stack) Item() world.Item

Item returns the item that the stack holds. If the stack is considered empty (Stack.Empty()), Item will always return nil.

func (Stack) Lore

func (s Stack) Lore() []string

Lore returns the lore set for the Stack. If no lore is present, the slice returned has a len of 0.

func (Stack) MaxCount

func (s Stack) MaxCount() int

MaxCount returns the maximum count that the stack is able to hold when added to an inventory or when added to an item entity.

func (Stack) MaxDurability

func (s Stack) MaxDurability() int

MaxDurability returns the maximum durability that the item stack is able to have. If the item does not implement the Durable interface, MaxDurability will always return -1.

func (Stack) String

func (s Stack) String() string

String implements the fmt.Stringer interface.

func (Stack) Value

func (s Stack) Value(key string) (val any, ok bool)

Value attempts to return a value set to the Stack using Stack.WithValue(). If a value is found by the key passed, it is returned and ok is true. If not found, the value returned is nil and ok is false.

func (Stack) Values

func (s Stack) Values() map[string]any

Values returns all values associated with the stack by users. The map returned is a copy of the original: Modifying it will not modify the item stack.

func (Stack) WithAnvilCost added in v0.7.3

func (s Stack) WithAnvilCost(anvilCost int) Stack

WithAnvilCost returns the current Stack with the anvil cost set to the passed value.

func (Stack) WithCustomName

func (s Stack) WithCustomName(a ...any) Stack

WithCustomName returns a copy of the Stack with the custom name passed. The custom name is formatted according to the rules of fmt.Sprintln.

func (Stack) WithDurability

func (s Stack) WithDurability(d int) Stack

WithDurability returns a new item stack with the durability passed. If the item does not implement the Durable interface, WithDurability returns the original stack. The closer the durability d is to 0, the closer the item is to being broken. If a durability of 0 is passed, a stack with the item type of the BrokenItem is returned. If a durability is passed that exceeds the maximum durability, the stack returned will have the maximum durability.

func (Stack) WithEnchantments added in v0.6.0

func (s Stack) WithEnchantments(enchants ...Enchantment) Stack

WithEnchantments returns the current stack with the passed enchantments. If an enchantment is not compatible with the item stack, it will not be applied.

func (Stack) WithLore

func (s Stack) WithLore(lines ...string) Stack

WithLore returns a copy of the Stack with the lore passed. Each string passed is put on a different line, where the first string is at the top and the last at the bottom. The lore may be cleared by passing no lines into the Stack.

func (Stack) WithValue

func (s Stack) WithValue(key string, val any) Stack

WithValue returns the current Stack with a value set at a specific key. This method may be used to associate custom data with the item stack, which will persist through server restarts. The value stored may later be obtained by making a call to Stack.Value().

WithValue may be called with a nil value, in which case the value at the key will be cleared.

WithValue stores Values by encoding them using the encoding/gob package. Users of WithValue must ensure that their value is valid for encoding with this package.

func (Stack) WithoutEnchantments added in v0.6.0

func (s Stack) WithoutEnchantments(enchants ...EnchantmentType) Stack

WithoutEnchantments returns the current stack but with the passed enchantments removed.

type StewType added in v0.8.4

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

StewType represents a type of suspicious stew.

func BlindnessStew added in v0.8.4

func BlindnessStew() StewType

BlindnessStew returns suspicious stew blindness effect.

func FireResistanceStew added in v0.8.4

func FireResistanceStew() StewType

FireResistanceStew returns suspicious stew fire resistance effect.

func JumpBoostStew added in v0.8.4

func JumpBoostStew() StewType

JumpBoostStew returns suspicious stew jump boost effect.

func NightVisionStew added in v0.8.4

func NightVisionStew() StewType

NightVisionStew returns suspicious stew night vision effect.

func PoisonStew added in v0.8.4

func PoisonStew() StewType

PoisonStew returns suspicious stew poison effect.

func RegenerationStew added in v0.8.4

func RegenerationStew() StewType

RegenerationStew returns suspicious stew regeneration effect.

func SaturationDandelionStew added in v0.8.4

func SaturationDandelionStew() StewType

SaturationDandelionStew returns suspicious stew saturation effect.

func SaturationOrchidStew added in v0.8.4

func SaturationOrchidStew() StewType

SaturationOrchidStew returns suspicious stew saturation effect.

func StewTypes added in v0.8.4

func StewTypes() []StewType

StewTypes ...

func WeaknessStew added in v0.8.4

func WeaknessStew() StewType

WeaknessStew returns suspicious stew weakness effect.

func WitherStew added in v0.8.4

func WitherStew() StewType

WitherStew returns suspicious stew wither effect.

func (StewType) Effects added in v0.8.4

func (s StewType) Effects() []effect.Effect

Effects returns suspicious stew effects.

func (StewType) Uint8 added in v0.8.4

func (s StewType) Uint8() uint8

Uint8 returns the stew as a uint8.

type Stick

type Stick struct{}

Stick is one of the most abundant resources used for crafting many tools and items.

func (Stick) EncodeItem

func (s Stick) EncodeItem() (name string, meta int16)

EncodeItem ...

func (Stick) FuelInfo added in v0.8.0

func (Stick) FuelInfo() FuelInfo

FuelInfo ...

type Sugar added in v0.1.0

type Sugar struct{}

Sugar is a food ingredient and brewing ingredient made from sugar canes.

func (Sugar) EncodeItem added in v0.1.0

func (Sugar) EncodeItem() (name string, meta int16)

EncodeItem ...

type SuspiciousStew added in v0.8.4

type SuspiciousStew struct {

	// Type specifies the type of effect will be given to the player
	Type StewType
	// contains filtered or unexported fields
}

SuspiciousStew is a food item that can give the player a status effect that depends on the flower used to craft it.

func (SuspiciousStew) AlwaysConsumable added in v0.8.4

func (SuspiciousStew) AlwaysConsumable() bool

AlwaysConsumable ...

func (SuspiciousStew) Consume added in v0.8.4

func (s SuspiciousStew) Consume(_ *world.World, c Consumer) Stack

Consume ...

func (SuspiciousStew) ConsumeDuration added in v0.8.4

func (d SuspiciousStew) ConsumeDuration() time.Duration

ConsumeDuration ...

func (SuspiciousStew) EncodeItem added in v0.8.4

func (s SuspiciousStew) EncodeItem() (name string, meta int16)

EncodeItem ...

func (SuspiciousStew) MaxCount added in v0.8.4

func (SuspiciousStew) MaxCount() int

MaxCount ...

type Sword

type Sword struct {
	// Tier is the tier of the sword.
	Tier ToolTier
}

Sword is a tool generally used to attack enemies. In addition, it may be used to mine any block slightly faster than without tool and to break cobwebs rapidly.

func (Sword) AttackDamage

func (s Sword) AttackDamage() float64

AttackDamage returns the attack damage to the sword.

func (Sword) BaseMiningEfficiency

func (s Sword) BaseMiningEfficiency(world.Block) float64

BaseMiningEfficiency always returns 1.5, unless the block passed is cobweb, in which case 15 is returned.

func (Sword) DurabilityInfo

func (s Sword) DurabilityInfo() DurabilityInfo

DurabilityInfo ...

func (Sword) EnchantmentValue added in v0.8.0

func (s Sword) EnchantmentValue() int

EnchantmentValue ...

func (Sword) EncodeItem

func (s Sword) EncodeItem() (name string, meta int16)

EncodeItem ...

func (Sword) FuelInfo added in v0.8.0

func (s Sword) FuelInfo() FuelInfo

FuelInfo ...

func (Sword) HarvestLevel

func (s Sword) HarvestLevel() int

HarvestLevel returns the harvest level of the sword tier.

func (Sword) MaxCount

func (s Sword) MaxCount() int

MaxCount always returns 1.

func (Sword) RepairableBy added in v0.7.3

func (s Sword) RepairableBy(i Stack) bool

RepairableBy ...

func (Sword) SmeltInfo added in v0.8.0

func (s Sword) SmeltInfo() SmeltInfo

SmeltInfo ...

func (Sword) ToolType

func (s Sword) ToolType() ToolType

ToolType returns the tool type for swords.

type Throwable added in v0.6.0

type Throwable interface {
	// SwingAnimation returns true if the client should cause the player's arm to swing when the item is thrown.
	SwingAnimation() bool
}

Throwable represents a custom item that can be thrown such as a projectile. This will only have an effect on non-vanilla items.

type Tool added in v0.6.0

type Tool interface {
	// ToolType returns the type of the tool. The blocks that can be mined with this tool depend on this
	// tool type.
	ToolType() ToolType
	// HarvestLevel returns the level that this tool is able to harvest. If a block has a harvest level above
	// this one, this tool won't be able to harvest it.
	HarvestLevel() int
	// BaseMiningEfficiency is the base efficiency of the tool, when it comes to mining blocks. This decides
	// the speed with which blocks can be mined.
	// Some tools have a mining efficiency that depends on the block (swords, shears). The block mined is
	// passed for this behaviour.
	BaseMiningEfficiency(b world.Block) float64
}

Tool represents an item that may be used as a tool.

type ToolNone added in v0.6.0

type ToolNone struct{}

ToolNone is a ToolType typically used in functions for items that do not function as tools.

func (ToolNone) BaseMiningEfficiency added in v0.6.0

func (n ToolNone) BaseMiningEfficiency(world.Block) float64

BaseMiningEfficiency ...

func (ToolNone) HarvestLevel added in v0.6.0

func (n ToolNone) HarvestLevel() int

HarvestLevel ...

func (ToolNone) ToolType added in v0.6.0

func (n ToolNone) ToolType() ToolType

ToolType ...

type ToolTier added in v0.6.0

type ToolTier struct {
	// HarvestLevel is the level that this tier of tools is able to harvest. If a block has a harvest level
	// above this one, a tool with this tier won't be able to harvest it.
	HarvestLevel int
	// BaseMiningEfficiency is the base efficiency of the tier, when it comes to mining blocks. This is
	// specifically used for tools such as pickaxes.
	BaseMiningEfficiency float64
	// BaseAttackDamage is the base attack damage to tools with this tier. All tools have a constant value
	// that is added on top of this.
	BaseAttackDamage float64
	// EnchantmentValue is the enchantment value of the tool used when selecting pseudo-random enchantments for
	// enchanting tables.
	EnchantmentValue int
	// BaseDurability returns the maximum durability that a tool with this tier has.
	Durability int
	// Name is the name of the tier.
	Name string
}

ToolTier represents the tier, or material, that a Tool is made of.

func ToolTiers added in v0.6.0

func ToolTiers() []ToolTier

ToolTiers returns a ToolTier slice containing all available tiers.

type ToolType added in v0.6.0

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

ToolType represents the type of tool. This decides the type of blocks that the tool is used for.

type TropicalFish added in v0.1.0

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

TropicalFish is a food item that cannot be cooked.

func (TropicalFish) AlwaysConsumable added in v0.1.0

func (TropicalFish) AlwaysConsumable() bool

AlwaysConsumable ...

func (TropicalFish) Consume added in v0.1.0

func (TropicalFish) Consume(_ *world.World, c Consumer) Stack

Consume ...

func (TropicalFish) ConsumeDuration added in v0.1.0

func (d TropicalFish) ConsumeDuration() time.Duration

ConsumeDuration ...

func (TropicalFish) EncodeItem added in v0.1.0

func (TropicalFish) EncodeItem() (name string, meta int16)

EncodeItem ...

type TurtleShell added in v0.1.0

type TurtleShell struct{}

TurtleShell are items that are used for brewing or as a helmet to give the player the Water Breathing status effect.

func (TurtleShell) DefencePoints added in v0.1.0

func (TurtleShell) DefencePoints() float64

DefencePoints ...

func (TurtleShell) DurabilityInfo added in v0.1.0

func (TurtleShell) DurabilityInfo() DurabilityInfo

DurabilityInfo ...

func (TurtleShell) EnchantmentValue added in v0.8.0

func (TurtleShell) EnchantmentValue() int

EnchantmentValue ...

func (TurtleShell) EncodeItem added in v0.1.0

func (TurtleShell) EncodeItem() (name string, meta int16)

EncodeItem ...

func (TurtleShell) Helmet added in v0.1.0

func (TurtleShell) Helmet() bool

Helmet ...

func (TurtleShell) KnockBackResistance added in v0.1.0

func (TurtleShell) KnockBackResistance() float64

KnockBackResistance ...

func (TurtleShell) MaxCount added in v0.1.0

func (TurtleShell) MaxCount() int

MaxCount always returns 1.

func (TurtleShell) RepairableBy added in v0.7.3

func (TurtleShell) RepairableBy(i Stack) bool

RepairableBy ...

func (TurtleShell) Toughness added in v0.7.0

func (TurtleShell) Toughness() float64

Toughness ...

func (TurtleShell) Use added in v0.1.0

func (TurtleShell) Use(_ *world.World, _ User, ctx *UseContext) bool

Use handles the using of a turtle shell to auto-equip it in an armour slot.

type Usable

type Usable interface {
	// Use is called when the item is used in the air. The user that used the item and the world that the item
	// was used in are passed to the method.
	// Use returns a bool indicating if the item was used successfully.
	Use(w *world.World, user User, ctx *UseContext) bool
}

Usable represents an item that may be used 'in the air'. If an item implements this interface, the Use method is called whenever the item is used while pointing at the air. (For example, when throwing an egg.)

type UsableOnBlock

type UsableOnBlock interface {
	// UseOnBlock is called when an item is used on a block. The world passed is the world that the item was
	// used in. The user passed is the entity that used the item. Usually this entity is a player.
	// The position of the block that was clicked, along with the clicked face and the position clicked
	// relative to the corner of the block are passed.
	// UseOnBlock returns a bool indicating if the item was used successfully.
	UseOnBlock(pos cube.Pos, face cube.Face, clickPos mgl64.Vec3, w *world.World, user User, ctx *UseContext) bool
}

UsableOnBlock represents an item that may be used on a block. If an item implements this interface, the UseOnBlock method is called whenever the item is used on a block.

type UsableOnEntity

type UsableOnEntity interface {
	// UseOnEntity is called when an item is used on an entity. The world passed is the world that the item is
	// used in, and the entity clicked and the user of the item are also passed.
	// UseOnEntity returns a bool indicating if the item was used successfully.
	UseOnEntity(e world.Entity, w *world.World, user User, ctx *UseContext) bool
}

UsableOnEntity represents an item that may be used on an entity. If an item implements this interface, the UseOnEntity method is called whenever the item is used on an entity.

type UseContext

type UseContext struct {
	// Damage is the amount of damage that should be dealt to the item as a result of using it.
	Damage int
	// CountSub is how much of the count should be subtracted after using the item.
	CountSub int
	// IgnoreBBox specifies if placing the item should ignore the BBox of the player placing this. This is the case for
	// items such as cocoa beans.
	IgnoreBBox bool
	// NewItem is the item that is added after the item is used. If the player no longer has an item in the
	// hand, it'll be added there.
	NewItem Stack
	// ConsumedItems contains a list of items that were consumed in the process of using the item.
	ConsumedItems []Stack
	// NewItemSurvivalOnly will add any new items only in survival mode.
	NewItemSurvivalOnly bool

	// FirstFunc returns the first item in the context holder's inventory if found. The second return value describes
	// whether the item was found. The comparable function is used to compare the item to the given item.
	FirstFunc func(comparable func(Stack) bool) (Stack, bool)

	// SwapHeldWithArmour holds a function that swaps the item currently held by a User with armour slot i.
	SwapHeldWithArmour func(i int)
}

UseContext is passed to every item Use methods. It may be used to subtract items or to deal damage to them after the action is complete.

func (*UseContext) Consume added in v0.6.0

func (ctx *UseContext) Consume(s Stack)

Consume consumes the provided item when the context is handled.

func (*UseContext) DamageItem

func (ctx *UseContext) DamageItem(d int)

DamageItem damages the item used by d points.

func (*UseContext) SubtractFromCount

func (ctx *UseContext) SubtractFromCount(d int)

SubtractFromCount subtracts d from the count of the item stack used.

type User

type User interface {
	Carrier
	SetHeldItems(mainHand, offHand Stack)

	UsingItem() bool
	ReleaseItem()
	UseItem()
}

User represents an entity that is able to use an item in the world, typically entities such as players, which interact with the world using an item.

type WarpedFungusOnAStick added in v0.1.0

type WarpedFungusOnAStick struct{}

WarpedFungusOnAStick is an item that can be used to control saddled striders.

func (WarpedFungusOnAStick) EncodeItem added in v0.1.0

func (WarpedFungusOnAStick) EncodeItem() (name string, meta int16)

EncodeItem ...

func (WarpedFungusOnAStick) MaxCount added in v0.1.0

func (WarpedFungusOnAStick) MaxCount() int

MaxCount ...

type Weapon

type Weapon interface {
	// AttackDamage returns the custom attack damage to the weapon. The damage returned must not be negative.
	AttackDamage() float64
}

Weapon is an item that may be used as a weapon. It has an attack damage which may be different to the 2 damage that attacking with an empty hand deals.

type Wheat

type Wheat struct{}

Wheat is a crop used to craft bread, cake, & cookies.

func (Wheat) CompostChance added in v0.8.2

func (Wheat) CompostChance() float64

CompostChance ...

func (Wheat) EncodeItem

func (w Wheat) EncodeItem() (name string, meta int16)

EncodeItem ...

type WrittenBook added in v0.8.3

type WrittenBook struct {
	// Title is the title of the book.
	Title string
	// Author is the author of the book.
	Author string
	// Generation is the copy tier of the book. 0 = original, 1 = copy of original,
	// 2 = copy of copy.
	Generation WrittenBookGeneration
	// Pages represents the pages within the book.
	Pages []string
}

WrittenBook is the item created after a book and quill is signed. It appears the same as a regular book, but without the quill, and has an enchanted-looking glint.

func (WrittenBook) DecodeNBT added in v0.8.3

func (w WrittenBook) DecodeNBT(data map[string]any) any

DecodeNBT ...

func (WrittenBook) EncodeItem added in v0.8.3

func (WrittenBook) EncodeItem() (name string, meta int16)

EncodeItem ...

func (WrittenBook) EncodeNBT added in v0.8.3

func (w WrittenBook) EncodeNBT() map[string]any

EncodeNBT ...

func (WrittenBook) MaxCount added in v0.8.3

func (WrittenBook) MaxCount() int

MaxCount always returns 1.

func (WrittenBook) Page added in v0.8.3

func (w WrittenBook) Page(page int) (string, bool)

Page returns a specific page from the book and true when the page exists. It will otherwise return an empty string and false.

func (WrittenBook) TotalPages added in v0.9.8

func (w WrittenBook) TotalPages() int

TotalPages returns the total number of pages in the book.

type WrittenBookGeneration added in v0.8.3

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

WrittenBookGeneration represents a WrittenBook generation.

func CopyGeneration added in v0.8.3

func CopyGeneration() WrittenBookGeneration

CopyGeneration is a copy of the original WrittenBook.

func CopyOfCopyGeneration added in v0.8.3

func CopyOfCopyGeneration() WrittenBookGeneration

CopyOfCopyGeneration is a copy of a copy of the original WrittenBook.

func OriginalGeneration added in v0.8.3

func OriginalGeneration() WrittenBookGeneration

OriginalGeneration is the original WrittenBook.

func (WrittenBookGeneration) String added in v0.8.3

func (g WrittenBookGeneration) String() string

String ...

func (WrittenBookGeneration) Uint8 added in v0.8.3

func (g WrittenBookGeneration) Uint8() uint8

Uint8 returns the generation as a uint8.

Source Files

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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