world

package
v0.0.0-...-f33b5a6 Latest Latest
Warning

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

Go to latest
Published: Oct 17, 2020 License: BSD-3-Clause Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ProcessLightUpdates

func ProcessLightUpdates()

process a light update

func QueueLightUpdate

func QueueLightUpdate(w *World, c *chunk.Chunk, x, y, z int)

queue a light update to happen later on

Types

type ChunkPos

type ChunkPos struct {
	X, Z int
}

type Generator

type Generator interface {
	//
	// Return the world's spawn location
	//
	GetSpawn() minecraft.Position

	//
	// Generate a new chunk at the given
	// coordinates
	//
	GenerateChunk(x, z int) *chunk.Chunk
}

type Provider

type Provider interface {
	//
	// Save the chunk to persistent storage
	//
	SaveChunk(chunk *chunk.Chunk)

	//
	// Load the chunk from persistent storage
	// if does not exists then will return nil
	//
	LoadChunk(x, z int) *chunk.Chunk
}

type World

type World struct {
	Provider  Provider
	Generator Generator
	// contains filtered or unexported fields
}

func NewWorld

func NewWorld(provider Provider, generator Generator) *World

func (*World) GetBlockLight

func (w *World) GetBlockLight(x, y, z int) int

func (*World) GetBlockState

func (w *World) GetBlockState(x, y, z int) uint16

func (*World) GetChunk

func (w *World) GetChunk(x, z int) *chunk.Chunk

get a chunk that is already loaded in memory

func (*World) GetSkyLight

func (w *World) GetSkyLight(x, y, z int) int

func (*World) LoadChunk

func (w *World) LoadChunk(x, z int) *chunk.Chunk

will load a new channel if not loaded already or generate a new one if does not exist at all

func (*World) SetBlockLight

func (w *World) SetBlockLight(x, y, z int, light int)

func (*World) SetBlockState

func (w *World) SetBlockState(x, y, z int, state uint16)

func (*World) SetSkyLight

func (w *World) SetSkyLight(x, y, z int, light int)

Directories

Path Synopsis
generator
provider

Jump to

Keyboard shortcuts

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