player

package
v0.0.0-...-93088af Latest Latest
Warning

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

Go to latest
Published: Apr 5, 2013 License: MIT Imports: 16 Imported by: 0

Documentation

Index

Constants

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

	PingTimeout  = 60 * time.Second // Player connection times out after 60 seconds.
	PingInterval = 20 * time.Second // 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 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) Position

func (player *Player) Position() AbsXyz

func (*Player) Run

func (player *Player) Run()

func (*Player) SendPacket

func (player *Player) SendPacket(packet proto.IPacket)

SendPacket sends the given packet to the player's client. This must be called from the player main loop.

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)

TransmitPacket sends the given bytes to the player's client. This may be called from any goroutine.

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.ItemSlotSlice) *RemoteInventory

func (*RemoteInventory) Click

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

func (*RemoteInventory) Close

func (inv *RemoteInventory) Close()

func (*RemoteInventory) GetProtoSlots

func (inv *RemoteInventory) GetProtoSlots(slots proto.ItemSlotSlice)

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)

Jump to

Keyboard shortcuts

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