minecraft

package
v0.0.0-...-93368d4 Latest Latest
Warning

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

Go to latest
Published: Jan 10, 2015 License: MIT Imports: 8 Imported by: 6

Documentation

Overview

Minecraft Protocol custom types.

Many thanks to #mcdevs from Freenode and it's great documentation: http://wiki.vg/Data_Types

Index

Constants

View Source
const (
	TypeByte   byte = iota // 0: 000
	TypeShort              // 1: 001
	TypeInt                // 2: 010
	TypeFloat              // 3: 011
	TypeString             // 4: 100
	TypeSlot               // 5: 101
	TypeVector             // 6: 110
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Bool

type Bool bool

func (*Bool) ReadFrom

func (b *Bool) ReadFrom(r io.Reader) (n int64, err error)

func (*Bool) WriteTo

func (b *Bool) WriteTo(w io.Writer) (n int64, err error)

type Entry

type Entry interface {
	Type() byte
	io.ReaderFrom
	io.WriterTo
}

func EntryFrom

func EntryFrom(e byte) (r Entry)

type EntryByte

type EntryByte struct{ types.Int8 }

func (EntryByte) Type

func (e EntryByte) Type() byte

type EntryFloat

type EntryFloat struct{ types.Float32 }

func (EntryFloat) Type

func (e EntryFloat) Type() byte

type EntryInt

type EntryInt struct{ types.Int32 }

func (EntryInt) Type

func (e EntryInt) Type() byte

type EntryShort

type EntryShort struct{ types.Int16 }

func (EntryShort) Type

func (e EntryShort) Type() byte

type EntrySlot

type EntrySlot struct{ Slot }

func (EntrySlot) Type

func (e EntrySlot) Type() byte

type EntryString

type EntryString struct{ String }

func (EntryString) Type

func (e EntryString) Type() byte

type EntryVector

type EntryVector struct{ Data [3]types.Int32 }

func (*EntryVector) ReadFrom

func (e *EntryVector) ReadFrom(r io.Reader) (n int64, err error)

func (EntryVector) Type

func (e EntryVector) Type() byte

func (*EntryVector) WriteTo

func (e *EntryVector) WriteTo(w io.Writer) (n int64, err error)

type Metadata

type Metadata struct {
	Entries map[byte]Entry
}

func MetadataFrom

func MetadataFrom(s []byte) (m Metadata, err error)

func NewMetadata

func NewMetadata() Metadata

func (Metadata) ReadFrom

func (m Metadata) ReadFrom(r io.Reader) (n int64, err error)

func (Metadata) WriteTo

func (m Metadata) WriteTo(w io.Writer) (n int64, err error)

type ObjectData

type ObjectData struct {
	Data                   int32
	SpeedX, SpeedY, SpeedZ int16
}

ObjectData is a special data type for packet 0x17.

Length and contents depend on the value of Data.

Meaning of Data: - Item Frame (id 71); Orientation, 0~3: South, West, North, East - Falling Block (id 70); BlockType, BlockID | (Metadata << 0xC) - Projectiles; EntityId of thrower. - Splash Potions; PotionValue

func (*ObjectData) ReadFrom

func (o *ObjectData) ReadFrom(r io.Reader) (n int64, err error)

func (*ObjectData) WriteTo

func (o *ObjectData) WriteTo(w io.Writer) (n int64, err error)

type Slot

type Slot struct {
	BlockId      int16
	Amount       byte
	Damage       int16
	Enchantments *nbt.Compound
}

Slot http://wiki.vg/Slot_Data

func NewSlot

func NewSlot() *Slot

func (*Slot) ReadFrom

func (s *Slot) ReadFrom(r io.Reader) (n int64, err error)

func (*Slot) WriteTo

func (s *Slot) WriteTo(w io.Writer) (n int64, err error)

type String

type String string

func (*String) ReadFrom

func (m *String) ReadFrom(r io.Reader) (n int64, err error)

func (String) String

func (m String) String() string

func (*String) WriteTo

func (m *String) WriteTo(w io.Writer) (n int64, err error)

Jump to

Keyboard shortcuts

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