player

package
v0.0.0-...-c982c26 Latest Latest
Warning

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

Go to latest
Published: Jun 3, 2014 License: MIT Imports: 17 Imported by: 0

Documentation

Index

Constants

View Source
const (
	StanceNormal = AbsCoord(1.62)
	MaxHealth    = Health(20)
	MaxFoodUnits = FoodUnits(20)

	PingTimeoutNs  = 1e9 * 60 // Player connection times out after 60 seconds.
	PingIntervalNs = 1e9 * 20 // Time between receiving keep alive response from client and sending new request.
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Player

type Player struct {
	EntityId
	// contains filtered or unexported fields
}

func NewPlayer

func NewPlayer(entityId EntityId, shardConnecter gamerules.IShardConnecter, conn net.Conn, name string, spawnBlock BlockXyz, onDisconnect chan<- EntityId, game gamerules.IGame) *Player

func (*Player) Client

func (player *Player) Client() gamerules.IPlayerClient

func (*Player) Enqueue

func (player *Player) Enqueue(f func(*Player))

Enqueue queues a function to run with the player lock within the player's mainloop.

func (*Player) Look

func (player *Player) Look() LookDegrees

func (*Player) MarshalNbt

func (player *Player) MarshalNbt(tag *nbt.Compound) (err error)

MarshalNbt packs the player data into a nbt.Compound so it can be written to persistant storage.

func (*Player) Name

func (player *Player) Name() string

func (*Player) PacketChatMessage

func (player *Player) PacketChatMessage(message string)

func (*Player) PacketDisconnect

func (player *Player) PacketDisconnect(reason string)

func (*Player) PacketEntityAction

func (player *Player) PacketEntityAction(entityId EntityId, action EntityAction)

func (*Player) PacketEntityAnimation

func (player *Player) PacketEntityAnimation(entityId EntityId, animation EntityAnimation)

func (*Player) PacketHoldingChange

func (player *Player) PacketHoldingChange(slotId SlotId)

func (*Player) PacketKeepAlive

func (player *Player) PacketKeepAlive(id int32)

func (*Player) PacketPlayer

func (player *Player) PacketPlayer(onGround bool)

func (*Player) PacketPlayerBlockHit

func (player *Player) PacketPlayerBlockHit(status DigStatus, target *BlockXyz, face Face)

func (*Player) PacketPlayerBlockInteract

func (player *Player) PacketPlayerBlockInteract(itemId ItemTypeId, target *BlockXyz, face Face, amount ItemCount, uses ItemData)

func (*Player) PacketPlayerLook

func (player *Player) PacketPlayerLook(look *LookDegrees, onGround bool)

func (*Player) PacketPlayerPosition

func (player *Player) PacketPlayerPosition(position *AbsXyz, stance AbsCoord, onGround bool)

func (*Player) PacketRespawn

func (player *Player) PacketRespawn(dimension DimensionId, unknown int8, gameType GameType, worldHeight int16, mapSeed RandomSeed)

func (*Player) PacketServerHandshake

func (player *Player) PacketServerHandshake(username string)

func (*Player) PacketServerListPing

func (player *Player) PacketServerListPing()

func (*Player) PacketServerLogin

func (player *Player) PacketServerLogin(username string)

func (*Player) PacketSignUpdate

func (player *Player) PacketSignUpdate(position *BlockXyz, lines [4]string)

func (*Player) PacketUseEntity

func (player *Player) PacketUseEntity(user EntityId, target EntityId, leftClick bool)

func (*Player) PacketWindowClick

func (player *Player) PacketWindowClick(windowId WindowId, slotId SlotId, rightClick bool, txId TxId, shiftClick bool, expectedSlot *proto.WindowSlot)

func (*Player) PacketWindowClose

func (player *Player) PacketWindowClose(windowId WindowId)

func (*Player) PacketWindowTransaction

func (player *Player) PacketWindowTransaction(windowId WindowId, txId TxId, accepted bool)

func (*Player) Position

func (player *Player) Position() AbsXyz

func (*Player) Run

func (player *Player) Run()

func (*Player) SetPosition

func (player *Player) SetPosition(pos AbsXyz)

func (*Player) Stop

func (player *Player) Stop()

func (*Player) String

func (player *Player) String() string

func (*Player) TransmitPacket

func (player *Player) TransmitPacket(packet []byte)

func (*Player) UnmarshalNbt

func (player *Player) UnmarshalNbt(tag *nbt.Compound) (err error)

UnmarshalNbt unpacks the player data from their persistantly stored NBT data. It must only be called before Player.Run().

type RemoteInventory

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

func NewRemoteInventory

func NewRemoteInventory(block *BlockXyz, chunkSubs *chunkSubscriptions, slots []proto.WindowSlot) *RemoteInventory

func (*RemoteInventory) Click

func (inv *RemoteInventory) Click(click *gamerules.Click) (txState TxState)

func (*RemoteInventory) Close

func (inv *RemoteInventory) Close()

func (*RemoteInventory) IsForBlock

func (inv *RemoteInventory) IsForBlock(block *BlockXyz) bool

func (*RemoteInventory) NumSlots

func (inv *RemoteInventory) NumSlots() SlotId

func (*RemoteInventory) SetSubscriber

func (inv *RemoteInventory) SetSubscriber(subscriber gamerules.IInventorySubscriber)

func (*RemoteInventory) WriteProtoSlots

func (inv *RemoteInventory) WriteProtoSlots(slots []proto.WindowSlot)

Jump to

Keyboard shortcuts

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