worldstate

package
v1.37.0 Latest Latest
Warning

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

Go to latest
Published: Apr 30, 2024 License: GPL-3.0 Imports: 29 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type DummyBlock

type DummyBlock struct {
	ID  string
	NBT map[string]any
}

func (*DummyBlock) BaseHash added in v1.33.1

func (d *DummyBlock) BaseHash() uint64

func (*DummyBlock) Color

func (d *DummyBlock) Color() color.RGBA

func (*DummyBlock) DecodeNBT

func (d *DummyBlock) DecodeNBT(data map[string]any) any

func (*DummyBlock) EncodeBlock

func (d *DummyBlock) EncodeBlock() (string, map[string]any)

func (*DummyBlock) EncodeNBT

func (d *DummyBlock) EncodeNBT() map[string]any

func (*DummyBlock) Hash

func (d *DummyBlock) Hash() uint64

func (*DummyBlock) Model

func (d *DummyBlock) Model() world.BlockModel

type EntityRuntimeID

type EntityRuntimeID = uint64

type EntityState

type EntityState struct {
	RuntimeID  EntityRuntimeID
	UniqueID   EntityUniqueID
	EntityType string

	Position            mgl32.Vec3
	Pitch, Yaw, HeadYaw float32
	Velocity            mgl32.Vec3
	HasMoved            bool

	Metadata  protocol.EntityMetadata
	Inventory map[byte]map[byte]protocol.ItemInstance

	Helmet     *protocol.ItemInstance
	Chestplate *protocol.ItemInstance
	Leggings   *protocol.ItemInstance
	Boots      *protocol.ItemInstance
}

func (*EntityState) ToServerEntity

func (s *EntityState) ToServerEntity(links []int64) serverEntity

type EntityUniqueID

type EntityUniqueID = int64

type Map added in v1.37.0

type Map struct {
	Decorations       []any            `nbt:"decorations"`
	Dimension         uint8            `nbt:"dimension"`
	Height            int16            `nbt:"height"`
	Width             int16            `nbt:"width"`
	MapID             int64            `nbt:"mapId"`
	Scale             uint8            `nbt:"scale"`
	UnlimitedTracking bool             `nbt:"unlimitedTracking"`
	ZCenter           int32            `nbt:"zCenter"`
	XCenter           int32            `nbt:"xCenter"`
	FullyExplored     bool             `nbt:"fullyExplored"`
	ParentMapId       int64            `nbt:"parentMapId"`
	Colors            [0xffff + 1]byte `nbt:"colors"`
	MapLocked         bool             `nbt:"mapLocked"`
}

type World

type World struct {
	// called when a chunk is added
	ChunkFunc func(world.ChunkPos, *chunk.Chunk)

	StoredChunks map[world.ChunkPos]bool

	VoidGen bool

	Name   string
	Folder string
	// contains filtered or unexported fields
}

func New

func New(cf func(world.ChunkPos, *chunk.Chunk), dimensionDefinitions map[int]protocol.DimensionDefinition) (*World, error)
func (w *World) AddEntityLink(el protocol.EntityLink)

func (*World) AddPlayer added in v1.33.0

func (w *World) AddPlayer(pk *packet.AddPlayer)

func (*World) Dimension

func (w *World) Dimension() world.Dimension

func (*World) EntityCount added in v1.33.0

func (w *World) EntityCount() int

func (*World) Finish

func (w *World) Finish(playerData map[string]any, excludedMobs []string, withPlayers bool, spawn cube.Pos, gd minecraft.GameData, bp *behaviourpack.Pack) error

func (*World) GetEntity

func (w *World) GetEntity(id EntityRuntimeID) *EntityState

func (*World) IsPaused added in v1.33.1

func (w *World) IsPaused() bool

func (*World) LoadChunk

func (w *World) LoadChunk(pos world.ChunkPos) (*chunk.Chunk, bool, error)

func (*World) Open

func (w *World) Open(name string, folder string, deferred bool)

func (*World) PauseCapture

func (w *World) PauseCapture()

func (*World) ProcessAddActor

func (w *World) ProcessAddActor(pk *packet.AddActor, ignoreCB func(*EntityState) bool, bpCB func(behaviourpack.EntityIn))

func (*World) Range added in v1.33.1

func (w *World) Range() cube.Range

func (*World) Rename

func (w *World) Rename(name, folder string) error

Rename moves the folder and reopens it

func (*World) SetBlockNBT

func (w *World) SetBlockNBT(pos cube.Pos, nbt map[string]any, merge bool)

func (*World) SetDimension

func (w *World) SetDimension(dim world.Dimension)

func (*World) SetTime

func (w *World) SetTime(real time.Time, ingame int)

func (*World) StoreChunk

func (w *World) StoreChunk(pos world.ChunkPos, ch *chunk.Chunk, blockNBT map[cube.Pos]DummyBlock) (err error)

func (*World) StoreEntity

func (w *World) StoreEntity(id EntityRuntimeID, es *EntityState)

func (*World) StoreMap added in v1.37.0

func (w *World) StoreMap(m *packet.ClientBoundMapItemData)

func (*World) UnpauseCapture

func (w *World) UnpauseCapture(around cube.Pos, radius int32, cf func(world.ChunkPos, *chunk.Chunk))

Jump to

Keyboard shortcuts

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