game

package
v0.0.0-...-889dc37 Latest Latest
Warning

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

Go to latest
Published: May 17, 2022 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ConnectionState

type ConnectionState int32

ConnectionState is the state of a Minecraft connection

const (
	HandshakeState ConnectionState = 0x00 // Handshake
	StatusState    ConnectionState = 0x01 // Status
	LoginState     ConnectionState = 0x02 // Login
	PlayState      ConnectionState = 0x03 // Play
)

func (*ConnectionState) Read

func (c *ConnectionState) Read(r io.Reader) error

func (ConnectionState) String

func (i ConnectionState) String() string

func (*ConnectionState) Write

func (c *ConnectionState) Write(w io.Writer) error

type Dimension

type Dimension int32

Dimension is a Minecraft dimension

const (
	DimensionNether    Dimension = -1 // Nether
	DimensionOverworld Dimension = 0  // Overworld
	DimensionEnd       Dimension = 1  // End
)

func (*Dimension) Read

func (d *Dimension) Read(r io.Reader) error

func (Dimension) String

func (i Dimension) String() string

func (*Dimension) Write

func (d *Dimension) Write(w io.Writer) error

type Hand

type Hand int32

Hand represents the side of a player hand

const (
	HandLeft  Hand = 0 // Left
	HandRight Hand = 1 // Right
)

func (*Hand) Read

func (h *Hand) Read(r io.Reader) error

func (Hand) String

func (i Hand) String() string

func (*Hand) Write

func (h *Hand) Write(w io.Writer) error

type Identifier

type Identifier struct {
	Namespace string
	Path      string
}

Identifier is a Minecraft resource identifier

func NewIdentifier

func NewIdentifier(namespace string, path string) Identifier

func NewIdentifierFromString

func NewIdentifierFromString(resourceName string) Identifier

func (*Identifier) Read

func (i *Identifier) Read(r io.Reader) error

func (Identifier) String

func (i Identifier) String() string

func (*Identifier) Write

func (i *Identifier) Write(w io.Writer) error

type Mode

type Mode enc.UnsignedByte

Mode is a Minecraft gamemode

const (
	Survival  Mode = 0 // Survival
	Creative  Mode = 1 // Creative
	Adventure Mode = 2 // Adventure
	Spectator Mode = 3 // Spectator
)

func (Mode) Is

func (m Mode) Is(other Mode) bool

Is check if Mode is equal to other Mode, ignoring the hardcore bit

func (Mode) IsHardcore

func (m Mode) IsHardcore() bool

IsHardcore checks if the Mode is hardcore

func (*Mode) Read

func (m *Mode) Read(r io.Reader) error

func (Mode) String

func (i Mode) String() string

func (*Mode) Write

func (m *Mode) Write(w io.Writer) error

type ServerDescription

type ServerDescription TextComponent

ServerDescription can be both a string (legacy) or TextComponent JSON structure

func (*ServerDescription) UnmarshalJSON

func (c *ServerDescription) UnmarshalJSON(data []byte) error

UnmarshalJSON implementation for ServerDescription which accepts both a TextComponent or a string (legacy format)

type ServerInfo

type ServerInfo struct {
	Version     ServerInfoVersion `json:"version"`           // Server version info
	Players     ServerInfoPlayers `json:"players"`           // Server player info
	Description ServerDescription `json:"description"`       // Server description
	Favicon     string            `json:"favicon,omitempty"` // Server favicon
}

ServerInfo is the JSON datastructure returned by the Server List Ping response https://wiki.vg/Server_List_Ping#Response

func (*ServerInfo) Read

func (s *ServerInfo) Read(r io.Reader) error

func (*ServerInfo) Write

func (s *ServerInfo) Write(w io.Writer) error

type ServerInfoPlayer

type ServerInfoPlayer struct {
	Name string `json:"name"` // Player name
	ID   string `json:"id"`   // Player UUID
}

type ServerInfoPlayers

type ServerInfoPlayers struct {
	Max    int32              `json:"max"`    // Max amount of players allowed
	Online int32              `json:"online"` // Amount of players online
	Sample []ServerInfoPlayer `json:"sample"` // Sample of online players
}

type ServerInfoVersion

type ServerInfoVersion struct {
	Name     string `json:"name"`     // Version name
	Protocol int32  `json:"protocol"` // Version protocol number
}

type TextComponent

type TextComponent struct {
	Text          string          `json:"text"`                    // Text content
	Bold          *bool           `json:"bold,omitempty"`          // Component is emboldened
	Italic        *bool           `json:"italic,omitempty"`        // Component is italicized
	Underlined    *bool           `json:"underlined,omitempty"`    // Component is underlined
	Strikethrough *bool           `json:"strikethrough,omitempty"` // Component is struck out
	Obfuscated    *bool           `json:"obfuscated,omitempty"`    // Component randomly switches between characters of the same width
	Color         string          `json:"color,omitempty"`         // Contains the color for the component
	Extra         []TextComponent `json:"extra,omitempty"`         // TextComponent siblings
}

TextComponent is the JSON format used for most text data in Minecraft See: https://wiki.vg/Chat#Current_system_.28JSON_Chat.29

func (*TextComponent) Read

func (t *TextComponent) Read(r io.Reader) error

func (*TextComponent) Write

func (t *TextComponent) Write(w io.Writer) error

Jump to

Keyboard shortcuts

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