entities

package
v0.0.0-...-b730334 Latest Latest
Warning

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

Go to latest
Published: Jun 23, 2021 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 BasicEntity

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

func NewEntity

func NewEntity(entityType int32) BasicEntity

func (BasicEntity) ID

func (s BasicEntity) ID() uint64

func (BasicEntity) Type

func (s BasicEntity) Type() int32

type ChunkSet

type ChunkSet map[int]map[int]struct{} // x,z map

func (ChunkSet) Add

func (s ChunkSet) Add(x int, z int)

func (ChunkSet) Contains

func (s ChunkSet) Contains(x int, z int) bool

func (ChunkSet) Remove

func (s ChunkSet) Remove(x int, z int)

type ClientSettingsComponent

type ClientSettingsComponent struct {
	ViewDistance byte
	ChatMode     uint8
}

type ConnectionComponent

type ConnectionComponent struct {
	Connection net.Conn
	Online     bool
}

type Entity

type Entity interface {
	ID() uint64
	Type() int32
}

type FoodComponent

type FoodComponent struct {
	Food       uint8
	Saturation uint8
}

type HealthComponent

type HealthComponent struct {
	Health uint8
}

type InventoryComponent

type InventoryComponent struct {
	InventoryLock sync.RWMutex
	Inventory     []pk.Slot
}

type Item

func NewItem

func NewItem() *Item

type Player

type Player struct {
	BasicEntity
	PositionComponent
	SpawnPosition PositionComponent
	VelocityComponent
	RotationComponent
	HealthComponent
	FoodComponent
	InventoryComponent
	ClientSettingsComponent

	UUID uuid.UUID
	Name string

	GameMode uint8

	HeldSlotLock sync.Mutex
	HeldSlot     pk.Slot // item held on the cursor
	HeldItem     uint8   // hot bar slot which is selected

	PaintingLock  sync.RWMutex
	PaintingSlots []uint8

	// per connection data
	ConnectionComponent
	KnownChunks ChunkSet
}

func NewPlayer

func NewPlayer() *Player

type PositionComponent

type PositionComponent struct {
	X float64
	Y float64
	Z float64
}

type RotationComponent

type RotationComponent struct {
	Pitch float32
	Yaw   float32
}

type VelocityComponent

type VelocityComponent struct {
	DeltaX int16 // In units of 1/8000 of a block per tick (50 ms)
	DeltaY int16
	DeltaZ int16
}

Jump to

Keyboard shortcuts

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