Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ( ErrNotFound = errors.New("could not load world") ErrOverwrite = errors.New("chunk already generated. not overwriting.") ErrNotLoaded = errors.New("chunk not loaded") ErrAlreadyLoaded = errors.New("chunk already loaded") )
View Source
var (
ErrOrphanChunk = errors.New("No world associated with chunk")
)
Functions ¶
This section is empty.
Types ¶
type BlockEntity ¶
type Chunk ¶
type Chunk struct { X int Z int Sections [16]ChunkSection Entities []Entity BlockEntities []BlockEntity // contains filtered or unexported fields }
A minecraft chunk
type ChunkSection ¶
type DefaultGenerator ¶
type DefaultGenerator struct {
// contains filtered or unexported fields
}
func (DefaultGenerator) Seed ¶
func (g DefaultGenerator) Seed() int64
func (DefaultGenerator) SetSeed ¶
func (g DefaultGenerator) SetSeed(seed int64)
type Generator ¶
type Generator interface { // Return the seed used by the generator Seed() int64 // Set the seed used by the generator SetSeed(seed int64) Generate(x int, z int) (Chunk, error) }
A generator is used to create an unknown chunk
type SuperflatGenerator ¶
type SuperflatGenerator struct { BlockType int32 Height int16 // contains filtered or unexported fields }
func (SuperflatGenerator) Seed ¶
func (g SuperflatGenerator) Seed() int64
func (SuperflatGenerator) SetSeed ¶
func (g SuperflatGenerator) SetSeed(seed int64)
type World ¶
type World struct { Name string Type Type Generator Generator // contains filtered or unexported fields }
An x-z grid of chunks and associated information. Minecrafts "Overworld" (or "Nether") are one world
func Load ¶
Load a new world from worlds/name/world.gob Returns ErrNotFound if the world has not been generated yet
func (*World) Chunk ¶
Returns a pointer to the chunk Returns ErrNotLoaded if the chunk is not loaded
func (*World) GenerateChunk ¶
Generates a chunk and saves it into worlds/w.Name/x-y.gob
Source Files
¶
Click to show internal directories.
Click to hide internal directories.