world

package
v0.0.0-...-18e7427 Latest Latest
Warning

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

Go to latest
Published: Dec 10, 2023 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Dimension

type Dimension struct {
	FixedTime          int64   `nbt:"fixed_time,omitempty"`
	HasSkylight        bool    `nbt:"has_skylight"`
	HasCeiling         bool    `nbt:"has_ceiling"`
	Ultrawarm          bool    `nbt:"ultrawarm"`
	Natural            bool    `nbt:"natural"`
	CoordinateScale    float64 `nbt:"coordinate_scale"`
	BedWorks           bool    `nbt:"bed_works"`
	RespawnAnchorWorks byte    `nbt:"respawn_anchor_works"`
	MinY               int32   `nbt:"min_y"`
	Height             int32   `nbt:"height"`
	LogicalHeight      int32   `nbt:"logical_height"`
	InfiniteBurn       string  `nbt:"infiniburn"`
	Effects            string  `nbt:"effects"`
	AmbientLight       float64 `nbt:"ambient_light"`

	PiglinSafe                  byte           `nbt:"piglin_safe"`
	HasRaids                    byte           `nbt:"has_raids"`
	MonsterSpawnLightLevel      nbt.RawMessage `nbt:"monster_spawn_light_level"` // Tag_Int or {type:"minecraft:uniform", value:{min_inclusive: Tag_Int, max_inclusive: Tag_Int}}
	MonsterSpawnBlockLightLimit int32          `nbt:"monster_spawn_block_light_limit"`
}

type DimensionCodec

type DimensionCodec struct {
	// What is Below? (wiki.vg)
	DimensionType Registry[Dimension]      `nbt:"minecraft:dimension_type"`
	WorldGenBiome Registry[nbt.RawMessage] `nbt:"minecraft:worldgen/biome"`
	ChatType      Registry[nbt.RawMessage] `nbt:"minecraft:chat_type"`
}

type Map

type Map struct {
	MapID       int64
	Scale       int8
	Locked      bool
	TrackingPos bool
	IconCount   int32
	Icons       []MapIcon
	Columns     uint8
	Rows        uint8
	X           int8
	Z           int8
	Length      int32
	Data        []byte
}

func (*Map) ReadFrom

func (m *Map) ReadFrom(r io.Reader) (int64, error)

type MapIcon

type MapIcon struct {
	Type      int32
	X, Z      int8
	Direction int8
	Name      pk.Optional[chat.Message, *chat.Message]
}

func (*MapIcon) ReadFrom

func (m *MapIcon) ReadFrom(r io.Reader) (n int64, err error)

type Node

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

type PlayerInfo

type PlayerInfo struct {
	EID          int32 // The player's UnaliveEntity ID (EID).
	Hardcore     bool  // Is hardcore
	Gamemode     uint8 // Gamemode. 0: Survival, 1: Creative, 2: Adventure, 3: Spectator.
	PrevGamemode int8  // Previous Gamemode
}

type Registry

type Registry[E any] struct {
	Type  string `nbt:"type"`
	Value []struct {
		Name    string `nbt:"name"`
		ID      int32  `nbt:"id"`
		Element E      `nbt:"element"`
	} `nbt:"value"`
}

func (*Registry[E]) Find

func (r *Registry[E]) Find(name string) *E

type ServInfo

type ServInfo struct {
	Brand string
}

ServInfo contains information about the server implementation.

type World

type World struct {
	Columns  map[ChunkPos]*Chunk
	Entities map[int32]core.Entity
	Loaded   bool
	// contains filtered or unexported fields
}

func NewWorld

func NewWorld() *World

func (*World) Add

func (w *World) Add(e core.Entity)

func (*World) ClosestEntity

func (w *World) ClosestEntity(pos maths.Vec3d) core.Entity

func (*World) Collides

func (w *World) Collides(bb maths.AxisAlignedBB) bool

func (*World) CollidesHorizontally

func (w *World) CollidesHorizontally(bb maths.AxisAlignedBB) (bool, bool, bool)

func (*World) CollidesVertically

func (w *World) CollidesVertically(bb maths.AxisAlignedBB) bool

func (*World) CollidesWithAnyBlock

func (w *World) CollidesWithAnyBlock(bb maths.AxisAlignedBB) bool

func (*World) CollidesWithAnyEntity

func (w *World) CollidesWithAnyEntity(bb maths.AxisAlignedBB) bool

func (*World) Delete

func (w *World) Delete(e core.Entity)

func (*World) GetBlock

func (w *World) GetBlock(pos maths.Vec3d) (*block.Block, error)

func (*World) GetBlockDensity

func (w *World) GetBlockDensity(pos maths.Vec3d, bb maths.AxisAlignedBB) float64

func (*World) GetBlockOnSide

func (w *World) GetBlockOnSide(pos maths.Vec3d, side maths.Facing) (*block.Block, error)

func (*World) GetEntitiesInAABB

func (w *World) GetEntitiesInAABB(bb maths.AxisAlignedBB) []core.Entity

func (*World) GetEntitiesInAABBExcludingEntity

func (w *World) GetEntitiesInAABBExcludingEntity(bb maths.AxisAlignedBB, entity core.Entity) []core.Entity

func (*World) GetEntitiesInRange

func (w *World) GetEntitiesInRange(pos maths.Vec3d, distance float64) []core.Entity

func (*World) GetEntitiesNotInAABB

func (w *World) GetEntitiesNotInAABB(bb maths.AxisAlignedBB) []core.Entity

func (*World) GetEntity

func (w *World) GetEntity(id int32) core.Entity

func (*World) GetNeighbors

func (w *World) GetNeighbors(block maths.Vec3d) []maths.Vec3d

func (*World) IsBlockLoaded

func (w *World) IsBlockLoaded(pos maths.Vec3d) bool

func (*World) IsChunkLoaded

func (w *World) IsChunkLoaded(pos ChunkPos) bool

func (*World) MustGetBlock

func (w *World) MustGetBlock(pos maths.Vec3d) *block.Block

func (*World) MustGetBlockOnSide

func (w *World) MustGetBlockOnSide(pos maths.Vec3d, side maths.Facing) *block.Block

func (*World) PathFind

func (w *World) PathFind(start, end maths.Vec3d) []maths.Vec3d

func (*World) RayTrace

func (w *World) RayTrace(start, end maths.Vec3d) (maths.RayTraceResult, error)

func (*World) SearchEntity

func (w *World) SearchEntity(f func(entity core.Entity) bool) core.Entity

func (*World) SetBlock

func (w *World) SetBlock(d maths.Vec3d, i int)

type WorldInfo

type WorldInfo struct {
	DimensionCodec      DimensionCodec
	DimensionType       string
	DimensionNames      []string    // Identifiers for all worlds on the server.
	DimensionName       string      // Name of the world being spawned into.
	HashedSeed          int64       // First 8 bytes of the SHA-256 hash of the world's seed. Used client side for biome noise
	MaxPlayers          int32       // Was once used by the client to draw the player list, but now is ignored.
	ViewDistance        int32       // Render distance (2-32).
	SimulationDistance  int32       // The distance that the client will process specific things, such as entities.
	ReducedDebugInfo    bool        // If true, a Notchian client shows reduced information on the debug screen. For servers in development, this should almost always be false.
	EnableRespawnScreen bool        // Set to false when the doImmediateRespawn gamerule is true.
	IsDebug             bool        // True if the world is a debug mode world; debug mode worlds cannot be modified and have predefined blocks.
	IsFlat              bool        // True if the world is a superflat world; flat worlds have different void fog and a horizon at y=0 instead of y=63.
	HasDeathLocation    bool        // If true, then the next two fields are present.
	DeathDimensionName  string      // The name of the dimension the player died in.
	DeathPosition       maths.Vec3d // The position the player died at.
	PortalCooldown      int32       // The number of ticks until the player can use a portal again.
}

WorldInfo content player info in server.

Jump to

Keyboard shortcuts

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