protocol

package
v0.0.0-...-caa64cb Latest Latest
Warning

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

Go to latest
Published: Dec 9, 2013 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

View Source
const PktInvalid uint = ^uint(0)

Variables

View Source
var (
	ErrBufferExhausted = errors.New("Coder buffer exhausted")
)
View Source
var (
	PacketData [4][2]*HostState
)

Functions

func CxnStateString

func CxnStateString(s CxnState) string

func HostTypeString

func HostTypeString(h HostType) string

Types

type AttachEntity

type AttachEntity struct {
	EntityID  int32 // Entity's ID
	VehicleID int32 // Vechicle's Entity ID
	Leash     bool  // If true leashes the entity to the vehicle
}

0x1B = Attach Entity

type BlockAction

type BlockAction struct {
	X         int32 // Block X Coordinate
	Y         int16 // Block Y Coordinate
	Z         int32 // Block Z Coordinate
	Byte1     uint8 // Varies depending on block - see [[Block_Actions]]
	Byte2     uint8 // Varies depending on block - see [[Block_Actions]]
	BlockType uint  // The block type for the block
}

0x24 = Block Action

type BlockBreakAnimation

type BlockBreakAnimation struct {
	EntityID     uint  // Entity's ID
	X            int32 // Block Position
	Y            int32 // Block Position
	Z            int32 // Block Position
	DestroyStage int8  // 0 - 9
}

0x25 = Block Break Animation

type BlockChange

type BlockChange struct {
	X         int32 // Block X Coordinate
	Y         uint8 // Block Y Coordinate
	Z         int32 // Block Z Coordinate
	BlockType uint  // The new block type for the block
	BlockData uint8 // The new data for the block
}

0x23 = Block Change

type ChangeGameState

type ChangeGameState struct {
	Reason uint8
	Value  float32 // Depends on reason
}

0x2B = Change Game State

type ChunkData

type ChunkData struct {
	ChunkX             int32  // Chunk X coordinate
	ChunkZ             int32  // Chunk Z coordinate
	GroundUpContinuous bool   // This is True if the packet represents all sections in this vertical column, where the primary bit map specifies exactly which sections are included, and which are air
	PrimaryBitMap      int16  // Bitmask with 1 for every 16x16x16 section which data follows in the compressed data.
	AddBitMap          int16  // Same as above, but this is used exclusively for the 'add' portion of the payload
	CompressedData     []byte `mc:"len=int"` // The chunk data is compressed using Zlib Deflate
}

0x21 = Chunk Data

type ClickWindow

type ClickWindow struct {
	WindowID     int8  // The id of the window which was clicked. 0 for player inventory.
	Slot         int16 // The clicked slot. See below.
	Button       int8  // The button used in the click. See below.
	ActionNumber int16 // A unique number for the action, used for transaction handling (See the Transaction packet).
	Mode         int8  // Inventory operation mode. See below.
	ClickedItem  Slot
}

0x0E = Click Window

type ClientAnimation

type ClientAnimation struct {
	EntityID  int32 // Player ID
	Animation int8  // Animation ID
}

0x0A = Animation

type ClientChatMessage

type ClientChatMessage struct {
	Message string
}

0x01 = Chat Message

type ClientHeldItemChange

type ClientHeldItemChange struct {
	Slot int16 // The slot which the player has selected (0-8)
}

0x09 = Held Item Change

type ClientPlayerPositionAndLook

type ClientPlayerPositionAndLook struct {
	X        float64 // Absolute position
	Y        float64 // Absolute position
	Stance   float64 // Used to modify the players bounding box when going up stairs, crouching, etc…
	Z        float64 // Absolute position
	Yaw      float32 // Absolute rotation on the X Axis, in degrees
	Pitch    float32 // Absolute rotation on the Y Axis, in degrees
	OnGround bool    // True if the client is on the ground, False otherwise
}

0x06 = Player Position And Look

type ClientSettings

type ClientSettings struct {
	Locale       string // en_GB
	ViewDistance int8   // 0-3 for 'far', 'normal', 'short', 'tiny'.
	ChatFlags    int8   // Chat settings. See notes below.
	Unused       bool   // Only observed as true
	Difficulty   int8   // Client-side difficulty from options.txt
	ShowCape     bool   // Client-side "show cape" option
}

0x15 = Client Settings

type ClientStatus

type ClientStatus struct {
	ActionID int8 // See below
}

0x16 = Client Status

type CloseWindow

type CloseWindow struct {
	WindowID uint8 // This is the id of the window that was closed. 0 for inventory.
}

0x2E = Close Window (Clientbound) 0x0D = Close Window (Serverbound)

type Coder

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

Coder is a helper class to read and write integral types for packets. It panics on a buffer under/overrun situation.

func MakeCoder

func MakeCoder(packet []byte) Coder

func (*Coder) Bool

func (c *Coder) Bool() bool

func (*Coder) Bytes

func (c *Coder) Bytes() []byte

func (*Coder) Float32

func (c *Coder) Float32() float32

func (*Coder) Float64

func (c *Coder) Float64() float64

func (*Coder) Get

func (c *Coder) Get(size int) []byte

func (*Coder) Int16

func (c *Coder) Int16() int16

func (*Coder) Int32

func (c *Coder) Int32() int32

func (*Coder) Int64

func (c *Coder) Int64() int64

func (*Coder) Int8

func (c *Coder) Int8() int8

func (*Coder) Len

func (c *Coder) Len() int

func (*Coder) Pos

func (c *Coder) Pos() int

func (*Coder) PutBool

func (c *Coder) PutBool(b bool)

func (*Coder) PutFloat32

func (c *Coder) PutFloat32(v float32)

func (*Coder) PutFloat64

func (c *Coder) PutFloat64(v float64)

func (*Coder) PutInt16

func (c *Coder) PutInt16(i int16)

func (*Coder) PutInt32

func (c *Coder) PutInt32(i int32)

func (*Coder) PutInt64

func (c *Coder) PutInt64(i int64)

func (*Coder) PutInt8

func (c *Coder) PutInt8(i int8)

func (*Coder) PutString

func (c *Coder) PutString(s string)

func (*Coder) PutUint16

func (c *Coder) PutUint16(i uint16)

func (*Coder) PutUint32

func (c *Coder) PutUint32(i uint32)

func (*Coder) PutUint64

func (c *Coder) PutUint64(i uint64)

func (*Coder) PutUint8

func (c *Coder) PutUint8(i uint8)

func (*Coder) PutVarint

func (c *Coder) PutVarint(i int)

func (*Coder) String

func (c *Coder) String() string

func (*Coder) Uint16

func (c *Coder) Uint16() uint16

func (*Coder) Uint32

func (c *Coder) Uint32() uint32

func (*Coder) Uint64

func (c *Coder) Uint64() uint64

func (*Coder) Uint8

func (c *Coder) Uint8() uint8

func (*Coder) Varint

func (c *Coder) Varint() int

Varints are unsigned in Minecraft protocol

type CollectItem

type CollectItem struct {
	CollectedEntityID int32
	CollectorEntityID int32
}

0x0D = Collect Item

type ConfirmTransaction

type ConfirmTransaction struct {
	WindowID     uint8 // The id of the window that the action occurred in.
	ActionNumber int16 // Every action that is to be accepted has a unique number. This field corresponds to that number.
	Accepted     bool  // Whether the action was accepted.
}

0x32 = Confirm Transaction (Clientbound) 0x0F = Confirm Transaction (Serverbound)

type CreativeInventoryAction

type CreativeInventoryAction struct {
	Slot        int16 // Inventory slot
	ClickedItem Slot
}

0x10 = Creative Inventory Action

type CxnState

type CxnState byte
const (
	StateHandshake CxnState = 0
	StateStatus    CxnState = 1
	StateLogin     CxnState = 2
	StatePlay      CxnState = 3
)

type DestroyEntities

type DestroyEntities struct {
	EntityIDs []uint32 `mc:"len=byte"` // The list of entities of destroy
}

0x13 = Destroy Entities

type Disconnect

type Disconnect struct {
	Reason string // Displayed to the client when the connection terminates. Must be valid JSON.
}

0x40 = Disconnect

type DisplayScoreboard

type DisplayScoreboard struct {
	Position  int8   // The position of the scoreboard. 0 = list, 1 = sidebar, 2 = belowName.
	ScoreName string // The unique name for the scoreboard to be displayed.
}

0x3D = Display Scoreboard

type Effect

type Effect struct {
	EffectID              int32 // The ID of the effect, see below.
	X                     int32 // The X location of the effect
	Y                     int8  // The Y location of the effect
	Z                     int32 // The Z location of the effect
	Data                  int32 // Extra data for certain effects, see below.
	DisableRelativeVolume bool  // See above
}

0x28 = Effect

type EnchantItem

type EnchantItem struct {
	WindowID    int8 // The ID sent by [[#0x64|Open Window]]
	Enchantment int8 // The position of the enchantment on the enchantment table window, starting with 0 as the topmost one.
}

0x11 = Enchant Item

type EncryptionRequest

type EncryptionRequest struct {
	ServerId    string
	PublicKey   []byte `mc:"len=short"`
	VerifyToken []byte `mc:"len=short"`
}

0x01 ->Client

type EncryptionResponse

type EncryptionResponse struct {
	// 0x01 ->Client
	SharedSecret []byte `mc:"len=short"`
	VerifyToken  []byte `mc:"len=short"`
}

0x01 ->Server

type Entity

type Entity struct {
	EntityID int32 // Entity's ID
}

0x14 = Entity

type EntityAction

type EntityAction struct {
	EntityID  int32 // Player ID
	ActionID  int8  // The ID of the action, see below.
	JumpBoost int32 // Horse jump boost. Ranged from 0 -> 100.
}

0x0B = Entity Action

type EntityEffect

type EntityEffect struct {
	EntityID  int32 // Entity's ID
	EffectID  int8  // See [[http://www.minecraftwiki.net/wiki/Potion_effect#Parameters]]
	Amplifier int8
	Duration  int16
}

0x1D = Entity Effect

type EntityEquipment

type EntityEquipment struct {
	EntityID int32 // Entity's ID
	Slot     int16 // Equipment slot: 0=held, 1-4=armor slot (1 - boots, 2 - leggings, 3 - chestplate, 4 - helmet)
	Item     Slot  // Item in slot format
}

0x04 = Entity Equipment

type EntityHeadLook

type EntityHeadLook struct {
	EntityID int32 // Entity's ID
	HeadYaw  int8  // Head yaw in steps of 2p/256
}

0x19 = Entity Head Look

type EntityLook

type EntityLook struct {
	EntityID int32 // Entity's ID
	Yaw      int8  // The X Axis rotation as a fraction of 360
	Pitch    int8  // The Y Axis rotation as a fraction of 360
}

0x16 = Entity Look

type EntityLookAndRelativeMove

type EntityLookAndRelativeMove struct {
	EntityID int32 // Entity's ID
	DX       int8  // Change in X position as a [[Data_Types#Fixed-point_numbers|Fixed-Point number]]
	DY       int8  // Change in Y position as a [[Data_Types#Fixed-point_numbers|Fixed-Point number]]
	DZ       int8  // Change in Z position as a [[Data_Types#Fixed-point_numbers|Fixed-Point number]]
	Yaw      int8  // The X Axis rotation as a fraction of 360
	Pitch    int8  // The Y Axis rotation as a fraction of 360
}

0x17 = Entity Look and Relative Move

type EntityMetadata

type EntityMetadata struct {
	EntityID int32 // Entity's ID
	Values   Metadata
}

0x1C = Entity Metadata

type EntityProperties

type EntityProperties struct {
	EntityID   int32          // Entity's ID
	Properties []PropertyData `mc:"len=int"`
}

0x20 = Entity Properties

type EntityRelativeMove

type EntityRelativeMove struct {
	EntityID int32 // Entity's ID
	DX       int8  // Change in X position as a [[Data_Types#Fixed-point_numbers|Fixed-Point number]]
	DY       int8  // Change in Y position as a [[Data_Types#Fixed-point_numbers|Fixed-Point number]]
	DZ       int8  // Change in Z position as a [[Data_Types#Fixed-point_numbers|Fixed-Point number]]
}

0x15 = Entity Relative Move

type EntityStatus

type EntityStatus struct {
	EntityID     int32 // Entity's ID
	EntityStatus int8  // See below
}

0x1A = Entity Status

type EntityTeleport

type EntityTeleport struct {
	EntityID int32 // Entity's ID
	X        int32 // X position as a [[Data_Types#Fixed-point_numbers|Fixed-Point number]]
	Y        int32 // Y position as a [[Data_Types#Fixed-point_numbers|Fixed-Point number]]
	Z        int32 // Z position as a [[Data_Types#Fixed-point_numbers|Fixed-Point number]]
	Yaw      int8  // The X Axis rotation as a fraction of 360
	Pitch    int8  // The Y Axis rotation as a fraction of 360
}

0x18 = Entity Teleport

type EntityVelocity

type EntityVelocity struct {
	EntityID  int32 // Entity's ID
	VelocityX int16 // Velocity on the X axis
	VelocityY int16 // Velocity on the Y axis
	VelocityZ int16 // Velocity on the Z axis
}

0x12 = Entity Velocity

type ErrInvalidPacketId

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

func (*ErrInvalidPacketId) Error

func (e *ErrInvalidPacketId) Error() string

type Explosion

type Explosion struct {
	X             float32
	Y             float32
	Z             float32
	Radius        float32 // Currently unused in the client
	Records       []XYZ8  `mc:"len=int"` // Each record is 3 signed bytes long, each bytes are the XYZ (respectively) offsets of affected blocks.
	PlayerMotionX float32 // X velocity of the player being pushed by the explosion
	PlayerMotionY float32 // Y velocity of the player being pushed by the explosion
	PlayerMotionZ float32 // Z velocity of the player being pushed by the explosion
}

0x27 = Explosion

type Handshake

type Handshake struct {
	// 0x00 ->Server
	ProtocolVersion uint
	ServerAddress   string
	ServerPort      uint16
	NextState       uint
}

func (*Handshake) StateUpdate

func (h *Handshake) StateUpdate() CxnState

type HostState

type HostState struct {
	Send map[reflect.Type]PacketInfo
	Recv []*PacketInfo
	// contains filtered or unexported fields
}

HostState implements packet encoding and decoding

func GetHostState

func GetHostState(ht HostType, c CxnState) *HostState

GetHostState returns the HostState for the HostType and CxnState specified

func (*HostState) Decode

func (hs *HostState) Decode(buf []byte) (p interface{}, err error)

Decode returns the packet encoded in buf.

func (*HostState) Encode

func (hs *HostState) Encode(buf []byte, packet interface{}) (n int, err error)

Encode encodes the packet into buf and returns the number of bytes used.

type HostType

type HostType int
const (
	Server HostType = iota
	Client
)

type JoinGame

type JoinGame struct {
	EntityID   int32  // The player's Entity ID
	Gamemode   uint8  // 0: survival, 1: creative, 2: adventure. Bit 3 (0x8) is the hardcore flag
	Dimension  int8   // -1: nether, 0: overworld, 1: end
	Difficulty uint8  // 0 thru 3 for Peaceful, Easy, Normal, Hard
	MaxPlayers uint8  // Used by the client to draw the player list
	LevelType  string // default, flat, largeBiomes, amplified, default_1_1
}

0x01 = Join Game

type KeepAlive

type KeepAlive struct {
	KeepAliveID int32
}

0x00 ->Server ->Client

type LoginDisconnect

type LoginDisconnect struct {
	Reason string
}

0x00 ->Client

type LoginStart

type LoginStart struct {
	Name string
}

0x00 ->Server

type LoginSuccess

type LoginSuccess struct {
	// 0x02 ->Client
	UUID     string
	Username string
}

0x02 ->Client

func (*LoginSuccess) StateUpdate

func (*LoginSuccess) StateUpdate() CxnState

type MapChunkBulk

type MapChunkBulk struct {
	ChunkColumnCount int16 // The number of chunk in this packet
	//DataLength            int32      // The size of the data field
	SkyLightSent bool   // Whether or not the chunk data contains a light nibble array. This is true in the main world, false in the end + nether
	Data         []byte // Compressed chunk data
	Meta         MapChunkBulkMeta
}

0x26 = Map Chunk Bulk

func (*MapChunkBulk) MarshalPacket

func (p *MapChunkBulk) MarshalPacket(k *Coder)

func (*MapChunkBulk) UnmarshalPacket

func (p *MapChunkBulk) UnmarshalPacket(k *Coder)

type MapChunkBulkMeta

type MapChunkBulkMeta struct {
	ChunkX        int32  // The X Coordinate of the chunk
	ChunkZ        int32  // The Z Coordinate of the chunk
	PrimaryBitmap uint16 // A bitmap which specifies which sections are not empty in this chunk
	AddBitmap     uint16 // A bitmap which specifies which sections need add information because of very high block ids. not yet used
}

type Maps

type Maps struct {
	ItemDamage uint   // The damage value of the map being modified
	Data       []byte `mc:"len=short"`
}

0x34 = Maps

type Metadata

type Metadata map[int]interface{}

func (Metadata) MarshalPacket

func (d Metadata) MarshalPacket(k *Coder)

func (Metadata) UnmarshalPacket

func (d Metadata) UnmarshalPacket(k *Coder)

type MultiBlockChange

type MultiBlockChange struct {
	ChunkX      int32    // Chunk X coordinate
	ChunkZ      int32    // Chunk Z Coordinate
	RecordCount int16    // The number of blocks affected
	Records     []Record `mc:"len=int,div=4"` // The total size of the data is in bytes. Should always be 4*record count
}

0x22 = Multi Block Change

type ObjectData

type ObjectData struct {
	Data     uint32
	HasSpeed bool
	SpeedX   int16
	SpeedY   int16
	SpeedZ   int16
}

func (*ObjectData) MarshalPacket

func (o *ObjectData) MarshalPacket(k *Coder)

func (*ObjectData) UnmarshalPacket

func (o *ObjectData) UnmarshalPacket(k *Coder)

type OpenWindow

type OpenWindow struct {
	WindowId               uint8  // A unique id number for the window to be displayed.  Notchian server implementation is a counter, starting at 1.
	InventoryType          uint8  // The window type to use for display.  Check below
	WindowTitle            string // The title of the window.
	NumberOfSlots          uint8  // Number of slots in the window (excluding the number of slots in the player inventory).
	UseProvidedWindowTitle bool   // If false, the client will look up a string like "window.minecart". If true, the client uses what the server provides.
	EntityID               int32  // EntityHorse's entityId. Only sent when window type is equal to 11 (AnimalChest).
}

0x2D = Open Window

type PacketInfo

type PacketInfo struct {
	Id    int
	Rt    reflect.Type
	Read  ReadFunc
	Write WriteFunc
}

PacketInfo describes a packet

type PacketMarshaler

type PacketMarshaler interface {
	MarshalPacket(k *Coder)
}

type PacketUnmarshaler

type PacketUnmarshaler interface {
	UnmarshalPacket(k *Coder)
}

type Particle

type Particle struct {
	ParticleName      string  // The name of the particle to create. A list can be found [https://gist.github.com/thinkofdeath/5110835 here]
	X                 float32 // X position of the particle
	Y                 float32 // Y position of the particle
	Z                 float32 // Z position of the particle
	OffsetX           float32 // This is added to the X position after being multiplied by random.nextGaussian()
	OffsetY           float32 // This is added to the Y position after being multiplied by random.nextGaussian()
	OffsetZ           float32 // This is added to the Z position after being multiplied by random.nextGaussian()
	ParticleData      float32 // The data of each particle
	NumberOfParticles int32   // The number of particles to create
}

0x2A = Particle

type Player

type Player struct {
	OnGround bool // True if the client is on the ground, False otherwise
}

0x03 = Player

type PlayerAbilities

type PlayerAbilities struct {
	Flags        int8
	FlyingSpeed  float32 // previous integer value divided by 250
	WalkingSpeed float32 // previous integer value divided by 250
}

0x39 = Player Abilities (Clientbound) 0x13 = Player Abilities (Serverbound)

type PlayerBlockPlacement

type PlayerBlockPlacement struct {
	X               int32 // Block position
	Y               uint8 // Block position
	Z               int32 // Block position
	Direction       int8  // The offset to use for block/item placement (see below)
	HeldItem        Slot
	CursorPositionX int8 // The position of the crosshair on the block
	CursorPositionY int8
	CursorPositionZ int8
}

0x08 = Player Block Placement

type PlayerDigging

type PlayerDigging struct {
	Status int8  // The action the player is taking against the block (see below)
	X      int32 // Block position
	Y      uint8 // Block position
	Z      int32 // Block position
	Face   int8  // The face being hit (see below)
}

0x07 = Player Digging

type PlayerListItem

type PlayerListItem struct {
	PlayerName string // Supports chat colouring, limited to 16 characters.
	Online     bool   // The client will remove the user from the list if false.
	Ping       int16  // Ping, presumably in ms.
}

0x38 = Player List Item

type PlayerLook

type PlayerLook struct {
	Yaw      float32 // Absolute rotation on the X Axis, in degrees
	Pitch    float32 // Absolute rotation on the Y Axis, in degrees
	OnGround bool    // True if the client is on the ground, False otherwise
}

0x05 = Player Look

type PlayerPosition

type PlayerPosition struct {
	X        float64 // Absolute position
	Y        float64 // Absolute position
	Stance   float64 // Used to modify the players bounding box when going up stairs, crouching, etc…
	Z        float64 // Absolute position
	OnGround bool    // True if the client is on the ground, False otherwise
}

0x04 = Player Position

type PluginMessage

type PluginMessage struct {
	Channel string // Name of the "channel" used to send the data.
	Data    []byte `mc:"len=short"` // Any data.
}

0x3F = Plugin Message 0x17 = Plugin Message

type PropertyData

type PropertyData struct {
	Key          string
	Value        float64
	ModifierData []PropertyModifier `mc:"len=short"` // http://www.minecraftwiki.net/wiki/Attribute#Modifiers
}

type PropertyModifier

type PropertyModifier struct {
	UUID      [16]byte
	Amount    float64
	Operation byte
}

type ReadFunc

type ReadFunc func(v reflect.Value, c *Coder)

type Record

type Record uint32 // Bitmask

type RemoveEntityEffect

type RemoveEntityEffect struct {
	EntityID int32 // Entity's ID
	EffectID int8
}

0x1E = Remove Entity Effect

type Respawn

type Respawn struct {
	Dimension  int32  // -1: The Nether, 0: The Overworld, 1: The End
	Difficulty uint8  // 0 thru 3 for Peaceful, Easy, Normal, Hard.
	Gamemode   uint8  // 0: survival, 1: creative, 2: adventure. The hardcore flag is not included
	LevelType  string // Same as [[Protocol#Join_Game|Join Game]]
}

0x07 = Respawn

type ScoreboardObjective

type ScoreboardObjective struct {
	ObjectiveName  string // An unique name for the objective
	ObjectiveValue string // The text to be displayed for the score.
	CreateRemove   int8   // 0 to create the scoreboard. 1 to remove the scoreboard. 2 to update the display text.
}

0x3B = Scoreboard Objective

type ServerAnimation

type ServerAnimation struct {
	EntityID  uint  // Player ID
	Animation uint8 // Animation ID
}

0x0B = Animation

type ServerChatMessage

type ServerChatMessage struct {
	JSONData string // https://gist.github.com/thinkofdeath/e882ce057ed83bac0a1c , Limited to 32767 bytes
}

0x02 = Chat Message

type ServerHeldItemChange

type ServerHeldItemChange struct {
	Slot int8 // The slot which the player has selected (0-8)
}

0x09 = Held Item Change

type ServerPlayerPositionAndLook

type ServerPlayerPositionAndLook struct {
	X        float64 // Absolute position
	Y        float64 // Absolute position
	Z        float64 // Absolute position
	Yaw      float32 // Absolute rotation on the X Axis, in degrees
	Pitch    float32 // Absolute rotation on the Y Axis, in degrees
	OnGround bool    // True if the client is on the ground, False otherwise
}

0x08 = Player Position And Look (Clientbound)

type SetExperience

type SetExperience struct {
	ExperienceBar   float32 // Between 0 and 1
	Level           int16
	TotalExperience int16
}

0x1F = Set Experience

type SetSlot

type SetSlot struct {
	WindowID uint8 // The window which is being updated. 0 for player inventory. Note that all known window types include the player inventory. This packet will only be sent for the currently opened window while the player is performing actions, even if it affects the player inventory. After the window is closed, a number of these packets are sent to update the player's inventory window (0).
	Slot     int16 // The slot that should be updated
	SlotData Slot
}

0x2F = Set Slot

type SignEditorOpen

type SignEditorOpen struct {
	X int32 // X in block coordinates
	Y int32 // Y in block coordinates
	Z int32 // Z in block coordinates
}

0x36 = Sign Editor Open

type Slot

type Slot struct {
	Id     uint16
	Count  byte
	Damage uint16
	Tag    []byte // optional gzip'd NBT data
}

func (*Slot) MarshalPacket

func (s *Slot) MarshalPacket(k *Coder)

func (*Slot) UnmarshalPacket

func (s *Slot) UnmarshalPacket(k *Coder)

type SoundEffect

type SoundEffect struct {
	SoundName       string
	EffectPositionX int32   // Effect X multiplied by 8
	EffectPositionY int32   // Effect Y multiplied by 8
	EffectPositionZ int32   // Effect Z multiplied by 8
	Volume          float32 // 1 is 100%, can be more
	Pitch           uint8   // 63 is 100%, can be more
}

0x29 = Sound Effect

type SpawnExperienceOrb

type SpawnExperienceOrb struct {
	EntityID uint  // Entity's ID
	X        int32 // X position as a [[Data_Types#Fixed-point_numbers|Fixed-Point number]]
	Y        int32 // Y position as a [[Data_Types#Fixed-point_numbers|Fixed-Point number]]
	Z        int32 // Z position as a [[Data_Types#Fixed-point_numbers|Fixed-Point number]]
	Count    int16 // The amount of experience this orb will reward once collected
}

0x11 = Spawn Experience Orb

type SpawnGlobalEntity

type SpawnGlobalEntity struct {
	EntityID uint  // The entity ID of the thunderbolt
	Type     int8  // The global entity type, currently always 1 for thunderbolt.
	X        int32 // Thunderbolt X a [[Data_Types#Fixed-point_numbers|fixed-point number]]
	Y        int32 // Thunderbolt Y a [[Data_Types#Fixed-point_numbers|fixed-point number]]
	Z        int32 // Thunderbolt Z a [[Data_Types#Fixed-point_numbers|fixed-point number]]
}

0x2C = Spawn Global Entity

type SpawnMob

type SpawnMob struct {
	EntityID  uint  // Entity's ID
	Type      uint8 // The type of mob. See [[Entities#Mobs|Mobs]]
	X         int32 // X position as a [[Data_Types#Fixed-point_numbers|Fixed-Point number]]
	Y         int32 // Y position as a [[Data_Types#Fixed-point_numbers|Fixed-Point number]]
	Z         int32 // Z position as a [[Data_Types#Fixed-point_numbers|Fixed-Point number]]
	Pitch     int8  // The pitch in steps of 2p/256
	HeadPitch int8  // The pitch in steps of 2p/256
	Yaw       int8  // The yaw in steps of 2p/256
	VelocityX int16
	VelocityY int16
	VelocityZ int16
	Values    Metadata
}

0x0F = Spawn Mob

type SpawnObject

type SpawnObject struct {
	EntityID uint  // Entity ID of the object
	Type     int8  // The type of object (See [[Entities#Objects|Objects]])
	X        int32 // X position as a [[Data_Types#Fixed-point_numbers|Fixed-Point number]]
	Y        int32 // Y position as a [[Data_Types#Fixed-point_numbers|Fixed-Point number]]
	Z        int32 // Z position as a [[Data_Types#Fixed-point_numbers|Fixed-Point number]]
	Pitch    int8  // The pitch in steps of 2p/256
	Yaw      int8  // The yaw in steps of 2p/256
	Data     ObjectData
}

0x0E = Spawn Object

type SpawnPainting

type SpawnPainting struct {
	EntityID  uint   // Entity's ID
	Title     string // Name of the painting. Max length 13
	X         int32  // Center X coordinate
	Y         int32  // Center Y coordinate
	Z         int32  // Center Z coordinate
	Direction int32  // Direction the painting faces (0 -z, 1 -x, 2 +z, 3 +x)
}

0x10 = Spawn Painting

type SpawnPlayer

type SpawnPlayer struct {
	EntityID    uint   // Player's Entity ID
	PlayerUUID  string // Player's UUID
	PlayerName  string // Player's Name
	X           int32  // Player X as a [[Data_Types#Fixed-point_numbers|Fixed-Point number]]
	Y           int32  // Player X as a [[Data_Types#Fixed-point_numbers|Fixed-Point number]]
	Z           int32  // Player X as a [[Data_Types#Fixed-point_numbers|Fixed-Point number]]
	Yaw         int8   // Player rotation as a packed byte
	Pitch       int8   // Player rotation as a packet byte
	CurrentItem int16  // The item the player is currently holding. Note that this should be 0 for "no item", unlike -1 used in other packets. A negative value crashes clients.
	Values      Metadata
}

0x0C = Spawn Player

type SpawnPosition

type SpawnPosition struct {
	X int32 // Spawn X in block coordinates
	Y int32 // Spawn Y in block coordinates
	Z int32 // in block coordinates
}

0x05 = Spawn Position

type Statistics

type Statistics struct {
	Values []StatisticsEntry
}

0x37 = Statistics

type StatisticsEntry

type StatisticsEntry struct {
	Name  string // https://gist.github.com/thinkofdeath/a1842c21a0cf2e1fb5e0
	Value int    // The amount to set it to
}

type StatusPing

type StatusPing struct {
	Time int64
}

0x01 ->Server ->Client

type StatusRequest

type StatusRequest struct{}

0x00 ->Server

type StatusResponse

type StatusResponse struct {
	JSON string
}

0x00 ->Client

type SteerVehicle

type SteerVehicle struct {
	Sideways float32 // Positive to the left of the player
	Forward  float32 // Positive forward
	Jump     bool
	Unmount  bool // True when leaving the vehicle
}

0x0C = Steer Vehicle

type TabCompleteRequest

type TabCompleteRequest struct {
	Text string
}

0x14 = Tab-Complete

type TabCompleteResponse

type TabCompleteResponse struct {
	Match []string // Possible Tab-Complete
}

0x3A = Tab-Complete

type Teams

type Teams struct {
	TeamName        string   // A unique name for the team. (Shared with scoreboard).
	Mode            int8     // If 0 then the team is created.
	TeamDisplayName string   // Only if Mode = 0 or 2.
	TeamPrefix      string   // Only if Mode = 0 or 2. Displayed before the players' name that are part of this team.
	TeamSuffix      string   // Only if Mode = 0 or 2. Displayed after the players' name that are part of this team.
	FriendlyFire    int8     // Only if Mode = 0 or 2; 0 for off, 1 for on, 3 for seeing friendly invisibles
	Players         []string `mc:"len=short"` // Only if Mode = 0 or 3 or 4. Players to be added/remove from the team.
}

0x3E = Teams

type TimeUpdate

type TimeUpdate struct {
	AgeOfTheWorld int64 // In ticks; not changed by server commands
	TimeOfDay     int64 // The world (or region) time, in ticks. If negative the sun will stop moving at the Math.abs of the time
}

0x03 = Time Update

type UpdateBlockEntity

type UpdateBlockEntity struct {
	X       int32
	Y       int16
	Z       int32
	Action  uint8  // The type of update to perform
	NBTData []byte `mc:"len=short"` // Present if data length > 0. Compressed with [[wikipedia:Gzip|gzip]]. Varies
}

0x35 = Update Block Entity

type UpdateHealth

type UpdateHealth struct {
	Health         float32 // 0 or less = dead, 20 = full HP
	Food           int16   // 0 - 20
	FoodSaturation float32 // Seems to vary from 0.0 to 5.0 in integer increments
}

0x06 = Update Health

type UpdateScore

type UpdateScore struct {
	ItemName     string // An unique name to be displayed in the list.
	UpdateRemove int8   // 0 to create/update an item. 1 to remove an item.
	ScoreName    string // The unique name for the scoreboard to be updated. Only sent when Update/Remove does not equal 1.
	Value        int32  // The score to be displayed next to the entry. Only sent when Update/Remove does not equal 1.
}

0x3C = Update Score

type UpdateSign

type UpdateSign struct {
	X     int32  // Block X Coordinate
	Y     int16  // Block Y Coordinate
	Z     int32  // Block Z Coordinate
	Line1 string // First line of text in the sign
	Line2 string // Second line of text in the sign
	Line3 string // Third line of text in the sign
	Line4 string // Fourth line of text in the sign
}

0x33 = Update Sign (Clientbound) 0x12 = Update Sign (Serverbound)

type UseBed

type UseBed struct {
	EntityID int32 // Player ID
	X        int32 // Bed headboard X as block coordinate
	Y        uint8 // Bed headboard Y as block coordinate
	Z        int32 // Bed headboard Z as block coordinate
}

0x0A = Use Bed

type UseEntity

type UseEntity struct {
	Target int32
	Mouse  int8 // 0 = Left-click, 1 = Right-click
}

0x02 = Use Entity

type WindowItems

type WindowItems struct {
	WindowID uint8  // The id of window which items are being sent for. 0 for player inventory.
	SlotData []Slot `mc:"len=short"`
}

0x30 = Window Items

type WindowProperty

type WindowProperty struct {
	WindowID uint8 // The id of the window.
	Property int16 // Which property should be updated.
	Value    int16 // The new value for the property.
}

0x31 = Window Property

type WriteFunc

type WriteFunc func(c *Coder, v reflect.Value)

type XYZ8

type XYZ8 struct {
	X, Y, Z int8
}

type XYZint

type XYZint struct {
	X, Y, Z int
}

Jump to

Keyboard shortcuts

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