inv

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Apr 29, 2024 License: Apache-2.0 Imports: 19 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CloseContainer

func CloseContainer(p *player.Player)

CloseContainer closes the container that the session passed is currently viewing.

func PlaceFakeContainer

func PlaceFakeContainer(w *world.World, pos cube.Pos)

PlaceFakeContainer places a fake container at the position and world passed.

func RedirectPlayerPackets

func RedirectPlayerPackets(p *player.Player)

func SendMenu

func SendMenu(p *player.Player, m Menu)

SendMenu sends a menu to a player. The menu passed will be displayed to the player

func UpdateMenu

func UpdateMenu(p *player.Player, m Menu)

UpdateMenu updates the menu that the player passed is currently viewing to the menu passed.

Types

type Closer

type Closer interface {
	Close(p *player.Player)
}

Closer is a type that can be implemented by a Submittable to be called when a menu is closed.

type Container

type Container interface {
	Block() world.Block
	Type() int
	Size() int
}

Container represents a container that can be opened by a player. Containers are blocks that can store items

type ContainerBarrel

type ContainerBarrel struct{}

ContainerBarrel represents a barrel container.

func (ContainerBarrel) Block

func (ContainerBarrel) Block() world.Block

func (ContainerBarrel) Size

func (ContainerBarrel) Size() int

func (ContainerBarrel) Type

func (ContainerBarrel) Type() int

type ContainerChest

type ContainerChest struct{ DoubleChest bool }

ContainerChest represents a chest container. It can be a single chest or a double chest.

func (ContainerChest) Block

func (ContainerChest) Block() world.Block

Block ...

func (ContainerChest) Size

func (c ContainerChest) Size() int

Size ...

func (ContainerChest) Type

func (ContainerChest) Type() int

Type ...

type ContainerDropper

type ContainerDropper struct{}

ContainerDropper represents a dispenser container.

func (ContainerDropper) Block

func (ContainerDropper) Block() world.Block

func (ContainerDropper) Size

func (ContainerDropper) Size() int

func (ContainerDropper) Type

func (ContainerDropper) Type() int

type ContainerHopper

type ContainerHopper struct{}

ContainerHopper represents a hopper container.

func (ContainerHopper) Block

func (ContainerHopper) Block() world.Block

func (ContainerHopper) Size

func (ContainerHopper) Size() int

func (ContainerHopper) Type

func (ContainerHopper) Type() int
type Menu struct {
	// contains filtered or unexported fields
}

Menu is a menu that can be sent to a player. It can be used to display a custom inventory to a player.

func NewMenu

func NewMenu(submittable Submittable, name string, container Container) Menu

NewMenu creates a new menu with the submittable passed, the name passed and the container passed.

func (m Menu) WithStacks(stacks ...item.Stack) Menu

WithStacks sets the stacks of the menu to the stacks passed.

type Submittable

type Submittable interface {
	Submit(p *player.Player, it item.Stack)
}

Submittable is a type that can be implemented by a Menu to be called when a menu is submitted.

Jump to

Keyboard shortcuts

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