features

package
v0.0.0-...-2b27d95 Latest Latest
Warning

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

Go to latest
Published: Sep 8, 2024 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var FeatureRuleTable []FeatureRule
View Source
var FeatureTable map[string]Feature

Functions

func ChunkBBox

func ChunkBBox(c *chunk.Chunk) cube.BBox

func Compare

func Compare(Op Operator, X, Y any) bool

func EvalConditions

func EvalConditions(ChunkPos world.ChunkPos, Origin FeaturePos, Conditions []FeatureCondition, WGRandom *wgrandom.WGRandom) bool

func EvalPlacementPass

func EvalPlacementPass(fr FeatureRule, Origin FeaturePos, ChunkPos world.ChunkPos, r *wgrandom.WGRandom) bool

func FeatureRandom

func FeatureRandom(x, z int64, ft FeatureType, seed int64) rand.Source

func PopulateChunk

func PopulateChunk(
	chunkPos world.ChunkPos,
	chunk *chunk.Chunk,
	WGRand *wgrandom.WGRandom,
)

func TryAndReplace

func TryAndReplace(allR []ReplaceRule, Pos cube.Pos, c *chunk.Chunk)

Types

type CoordRange

type CoordRange struct {
	DistributionType DistributionType
	Min, Max         int
}

func ConstCoordRange

func ConstCoordRange(Val int) CoordRange

type CoordinateEvalOrder

type CoordinateEvalOrder int
const (
	XYZ CoordinateEvalOrder = iota
	XZY
	YXZ
	YZX
	ZXY
	ZYX
)

type DistributionType

type DistributionType int
const (
	UNIFORM DistributionType = iota
	GAUSSIAN
	INVERSE_GAUSSIAN
	TRIANGLE
	FIXED_GRID
	JITTERED_GRID
)

type Feature

type Feature interface {
	Identifier() string
	Type() FeatureType
	Build(*chunk.Chunk, FeaturePos, *rand.Rand)
}

type FeatureCondition

type FeatureCondition struct {
	Type     FeatureConditionType
	Test     string
	Operator Operator
	Value    string
}

type FeatureConditionType

type FeatureConditionType int
const (
	TYPE_BIOME_FILTER FeatureConditionType = iota
)

type FeatureDistribution

type FeatureDistribution struct {
	Iterations          int
	ScatterChance       wgrandom.Chance
	CoordinateEvalOrder CoordinateEvalOrder
	X,
	Y,
	Z CoordRange
}

type FeaturePos

type FeaturePos cube.Pos

func (FeaturePos) X

func (f FeaturePos) X() int

func (FeaturePos) Y

func (f FeaturePos) Y() int

func (FeaturePos) Z

func (f FeaturePos) Z() int

type FeatureRule

type FeatureRule struct {
	Identifier,
	Places string
	Conditions    []FeatureCondition
	Distribution  FeatureDistribution
	PlacementPass PlacementPassType
}

func (FeatureRule) PopulateChunk

func (fr FeatureRule) PopulateChunk(
	chunkPos world.ChunkPos,
	chunk *chunk.Chunk,
	WGRand *wgrandom.WGRandom,
)

type FeatureType

type FeatureType int
const (
	TYPE_ORE FeatureType = iota
	TYPE_AGGREGATE
	TYPE_SCATTER
	TYPE_SINGLE_BLOCK
	TYPE_SEARCH
	TYPE_TREE
	TYPE_FOSSIL
	TYPE_SEQUENCE
	TYPE_WEIGHED_RANDOM
	TYPE_NETHER_CARVER
	TYPE_CAVE_CARVER
	TYPE_UNDERWATER_CARVER
	TYPE_NOOP
)

type NopFeature

type NopFeature struct {
	ID string
}

func (NopFeature) Build

func (f NopFeature) Build(c *chunk.Chunk, fp FeaturePos, _ *rand.Rand)

func (NopFeature) Identifier

func (f NopFeature) Identifier() string

func (NopFeature) Type

func (f NopFeature) Type() FeatureType

type Operator

type Operator int
const (
	OP_EQ Operator = iota
	OP_NOT_EQ
)

type OreFeature

type OreFeature struct {
	ID          string
	ReplaceRule []ReplaceRule
	Count       int
}

func (OreFeature) Build

func (ore OreFeature) Build(c *chunk.Chunk, f FeaturePos, r *rand.Rand)

func (OreFeature) Identifier

func (ore OreFeature) Identifier() string

func (OreFeature) Type

func (ore OreFeature) Type() FeatureType

type PlacementPassType

type PlacementPassType int
const (
	SURFACE_PASS PlacementPassType = iota
	UNDERGROUND_PASS
)

type ReplaceRule

type ReplaceRule struct {
	PlacesBlock uint32
	MayReplace  []uint32
}

type TreeFeature

type TreeFeature struct {
	ID          string
	TrunkHeight [2]int
	TrunkBlock  uint32
}

func (TreeFeature) Build

func (tree TreeFeature) Build(c *chunk.Chunk, f FeaturePos, _ *rand.Rand)

func (TreeFeature) Identifier

func (tree TreeFeature) Identifier() string

func (TreeFeature) Type

func (tree TreeFeature) Type() FeatureType

Jump to

Keyboard shortcuts

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