Documentation
¶
Index ¶
- Constants
- Variables
- func BiomeDefinitions() ([]protocol.BiomeDefinition, []string)
- func BlockHash(b Block) uint64
- func BlockRuntimeID(b Block) uint32
- func Call[T any](ctx context.Context, w *World, f func(tx *Tx) (T, error)) (T, error)
- func CallEntity[T any](ctx context.Context, h *EntityHandle, f func(tx *Tx, e Entity) (T, error)) (T, error)
- func CallRef[T any, E Entity](ctx context.Context, ref EntityRef[E], f func(tx *Tx, e E) (T, error)) (T, error)
- func ClampRedstonePower(power int) int
- func CustomBlocks() map[string]CustomBlock
- func DifficultyID(diff Difficulty) (int, bool)
- func DimensionID(dim Dimension) (int, bool)
- func GameModeID(mode GameMode) (int, bool)
- func ItemRuntimeID(i Item) (rid int32, meta int16, ok bool)
- func RedstoneFullPowerConductor(pos cube.Pos, b Block, tx *Tx) bool
- func RegisterBiome(b Biome)
- func RegisterBlock(b Block)
- func RegisterItem(item Item)
- func RegisterSpawnEggHandler(name string, handler SpawnEggHandler)
- type ArrowSpawnConfig
- type BasicBlockRegistry
- func (br *BasicBlockRegistry) Air() Block
- func (br *BasicBlockRegistry) AirRuntimeID() uint32
- func (br *BasicBlockRegistry) BitSize() int
- func (br *BasicBlockRegistry) BlockByName(name string, properties map[string]any) (Block, bool)
- func (br *BasicBlockRegistry) BlockByRuntimeID(rid uint32) (Block, bool)
- func (br *BasicBlockRegistry) BlockByRuntimeIDOrAir(rid uint32) Block
- func (br *BasicBlockRegistry) BlockCount() int
- func (br *BasicBlockRegistry) BlockHash(b Block) uint64
- func (br *BasicBlockRegistry) BlockRuntimeID(b Block) uint32
- func (br *BasicBlockRegistry) Blocks() []Block
- func (br *BasicBlockRegistry) Clone() *BasicBlockRegistry
- func (br *BasicBlockRegistry) CustomBlocks() map[string]CustomBlock
- func (br *BasicBlockRegistry) FilteringBlock(rid uint32) uint8
- func (br *BasicBlockRegistry) Finalize()
- func (br *BasicBlockRegistry) HashToRuntimeID(hash uint32) (rid uint32, ok bool)
- func (br *BasicBlockRegistry) LightBlock(rid uint32) uint8
- func (br *BasicBlockRegistry) LiquidBlock(rid uint32) bool
- func (br *BasicBlockRegistry) LiquidDisplacingBlock(rid uint32) bool
- func (br *BasicBlockRegistry) NBTBlock(rid uint32) bool
- func (br *BasicBlockRegistry) RandomTickBlock(rid uint32) bool
- func (br *BasicBlockRegistry) RegisterBlock(b Block)
- func (br *BasicBlockRegistry) RegisterBlockState(s BlockState)
- func (br *BasicBlockRegistry) RuntimeIDToHash(runtimeID uint32) (hash uint32, ok bool)
- func (br *BasicBlockRegistry) RuntimeIDToState(runtimeID uint32) (name string, properties map[string]any, found bool)
- func (br *BasicBlockRegistry) StateToRuntimeID(name string, properties map[string]any) (runtimeID uint32, found bool)
- type Biome
- type Block
- type BlockAction
- type BlockModel
- type BlockRegistry
- type BlockSource
- type BlockState
- type ChunkPos
- type Column
- type Config
- type Context
- type CustomBlock
- type CustomBlockBuildable
- type CustomItem
- type DamageSource
- type Difficulty
- type Dimension
- type Entity
- type EntityAction
- type EntityAnimation
- func (a EntityAnimation) Controller() string
- func (a EntityAnimation) Name() string
- func (a EntityAnimation) NextState() string
- func (a EntityAnimation) StopCondition() string
- func (a EntityAnimation) WithController(controller string) EntityAnimation
- func (a EntityAnimation) WithNextState(state string) EntityAnimation
- func (a EntityAnimation) WithStopCondition(condition string) EntityAnimation
- type EntityConfig
- type EntityData
- type EntityHandle
- func (e *EntityHandle) Close() error
- func (e *EntityHandle) Closed() bool
- func (e *EntityHandle) Do(f func(tx *Tx, e Entity)) *Task
- func (e *EntityHandle) DoAfter(delay time.Duration, f func(tx *Tx, e Entity)) *Task
- func (e *EntityHandle) Entity(tx *Tx) (Entity, bool)
- func (e *EntityHandle) Type() EntityType
- func (e *EntityHandle) UUID() uuid.UUID
- type EntityRef
- type EntityRegistry
- type EntityRegistryConfig
- type EntitySpawnOpts
- type EntityType
- type GameMode
- type Generator
- type Handler
- type HealingSource
- type Item
- type Liquid
- type LiquidDisplacer
- type Loader
- type NBTer
- type NeighbourUpdateTicker
- type NopGenerator
- type NopHandler
- func (NopHandler) HandleBlockBurn(*Context, cube.Pos)
- func (NopHandler) HandleClose(*Tx)
- func (NopHandler) HandleCropTrample(*Context, cube.Pos)
- func (NopHandler) HandleEntityDespawn(*Tx, Entity)
- func (NopHandler) HandleEntitySpawn(*Tx, Entity)
- func (NopHandler) HandleExplosion(*Context, mgl64.Vec3, *[]Entity, *[]cube.Pos, *float64, *bool)
- func (NopHandler) HandleFireSpread(*Context, cube.Pos, cube.Pos)
- func (NopHandler) HandleLeavesDecay(*Context, cube.Pos)
- func (NopHandler) HandleLiquidDecay(*Context, cube.Pos, Liquid, Liquid)
- func (NopHandler) HandleLiquidFlow(*Context, cube.Pos, cube.Pos, Liquid, Block)
- func (NopHandler) HandleLiquidHarden(*Context, cube.Pos, Block, Block, Block)
- func (NopHandler) HandleRedstoneUpdate(*Context, RedstoneUpdate)
- func (NopHandler) HandleSound(*Context, Sound, mgl64.Vec3)
- type NopProvider
- func (NopProvider) Close() error
- func (NopProvider) LoadColumn(ChunkPos, Dimension) (*chunk.Column, error)
- func (NopProvider) LoadPlayerSpawnPosition(uuid.UUID) (cube.Pos, bool, error)
- func (NopProvider) SavePlayerSpawnPosition(uuid.UUID, cube.Pos) error
- func (NopProvider) SaveSettings(*Settings)
- func (n NopProvider) Settings() *Settings
- func (NopProvider) StoreColumn(ChunkPos, Dimension, *chunk.Column) error
- type NopViewer
- func (NopViewer) HideEntity(Entity)
- func (NopViewer) ViewBlockAction(cube.Pos, BlockAction)
- func (NopViewer) ViewBlockUpdate(cube.Pos, Block, int)
- func (NopViewer) ViewBrewingUpdate(time.Duration, time.Duration, int32, int32, int32, int32)
- func (NopViewer) ViewChunk(ChunkPos, Dimension, map[cube.Pos]Block, *chunk.Chunk)
- func (NopViewer) ViewEmote(Entity, uuid.UUID)
- func (NopViewer) ViewEntity(Entity)
- func (NopViewer) ViewEntityAction(Entity, EntityAction)
- func (NopViewer) ViewEntityAnimation(Entity, EntityAnimation)
- func (NopViewer) ViewEntityArmour(Entity)
- func (NopViewer) ViewEntityDisplacement(Entity, mgl64.Vec3, cube.Rotation, bool)
- func (NopViewer) ViewEntityGameMode(Entity)
- func (NopViewer) ViewEntityItems(Entity)
- func (NopViewer) ViewEntityMovement(Entity, mgl64.Vec3, cube.Rotation, bool)
- func (NopViewer) ViewEntityState(Entity)
- func (NopViewer) ViewEntityTeleport(Entity, mgl64.Vec3)
- func (NopViewer) ViewEntityVelocity(Entity, mgl64.Vec3)
- func (NopViewer) ViewEntityWake(Entity)
- func (NopViewer) ViewFurnaceUpdate(time.Duration, time.Duration, time.Duration, time.Duration, time.Duration, ...)
- func (NopViewer) ViewParticle(mgl64.Vec3, Particle)
- func (NopViewer) ViewSkin(Entity)
- func (NopViewer) ViewSound(mgl64.Vec3, Sound)
- func (NopViewer) ViewTime(int)
- func (NopViewer) ViewTimeCycle(bool)
- func (NopViewer) ViewWeather(bool, bool)
- func (NopViewer) ViewWorldSpawn(cube.Pos)
- type PanicError
- type Particle
- type Provider
- type RandomTicker
- type RedstoneNonConductive
- type RedstonePowerAction
- type RedstonePowerConsumer
- type RedstonePowerContextAction
- type RedstonePowerPostUpdater
- type RedstonePowerRelayer
- type RedstonePowerRelayerNeighbourer
- type RedstonePowerSource
- type RedstoneStrongPowerSource
- type RedstoneTorchTransaction
- func (t RedstoneTorchTransaction) BurnoutStatus() (burnedOut, recoverable bool)
- func (t RedstoneTorchTransaction) ClearBurnout()
- func (t RedstoneTorchTransaction) ConsumeSelfTriggered() bool
- func (t RedstoneTorchTransaction) MarkSelfTriggered()
- func (t RedstoneTorchTransaction) RecordTurnOff() (burnsOut bool)
- type RedstoneTransaction
- type RedstoneUpdate
- type RedstoneUpdateCause
- type RedstoneWeakBlockPowerer
- type ScheduledTicker
- type SetOpts
- type Settings
- type Sleeper
- type Sound
- type SpawnEggHandler
- type Structure
- type SubChunkPos
- type Task
- type TickerBlock
- type TickerEntity
- type Tx
- func (tx *Tx) AddEntity(e *EntityHandle) Entity
- func (tx *Tx) AddEntityAt(e *EntityHandle, pos mgl64.Vec3) Entity
- func (tx *Tx) AddParticle(pos mgl64.Vec3, p Particle)
- func (tx *Tx) Biome(pos cube.Pos) Biome
- func (tx *Tx) Block(pos cube.Pos) Block
- func (tx *Tx) BlockLoaded(pos cube.Pos) (Block, bool)
- func (tx *Tx) BlocksWithin(pos cube.Pos, radius int, blocks ...Block) iter.Seq[cube.Pos]
- func (tx *Tx) BroadcastSleepingIndicator()
- func (tx *Tx) BroadcastSleepingReminder(sleeper Sleeper)
- func (tx *Tx) BuildStructure(pos cube.Pos, s Structure)
- func (tx *Tx) CurrentTick() int64
- func (tx *Tx) Defer(f func(tx *Tx)) *Task
- func (tx *Tx) DeferErr(f func(tx *Tx) error) *Task
- func (tx *Tx) Entities() iter.Seq[Entity]
- func (tx *Tx) EntitiesWithin(box cube.BBox) iter.Seq[Entity]
- func (tx *Tx) Event() *Context
- func (tx *Tx) HighestBlock(x, z int) int
- func (tx *Tx) HighestLightBlocker(x, z int) int
- func (tx *Tx) Light(pos cube.Pos) uint8
- func (tx *Tx) Liquid(pos cube.Pos) (Liquid, bool)
- func (tx *Tx) PlayEntityAnimation(e Entity, a EntityAnimation)
- func (tx *Tx) PlaySound(pos mgl64.Vec3, s Sound)
- func (tx *Tx) Players() iter.Seq[Entity]
- func (tx *Tx) Raining() bool
- func (tx *Tx) RainingAt(pos cube.Pos) bool
- func (tx *Tx) Range() cube.Range
- func (tx *Tx) Redstone() RedstoneTransaction
- func (tx *Tx) RedstoneConductivePower(pos cube.Pos) int
- func (tx *Tx) RedstoneDirectPower(pos cube.Pos) int
- func (tx *Tx) RedstoneDirectPowerFrom(pos cube.Pos, face cube.Face) int
- func (tx *Tx) RedstonePower(pos cube.Pos) int
- func (tx *Tx) RedstonePowerFrom(pos cube.Pos, face cube.Face) int
- func (tx *Tx) RedstoneStrongPower(pos cube.Pos) int
- func (tx *Tx) RedstoneStrongPowerFrom(pos cube.Pos, face cube.Face) int
- func (tx *Tx) RemoveEntity(e Entity) *EntityHandle
- func (tx *Tx) ScheduleBlockUpdate(pos cube.Pos, b Block, delay time.Duration)
- func (tx *Tx) SetBiome(pos cube.Pos, b Biome)
- func (tx *Tx) SetBlock(pos cube.Pos, b Block, opts *SetOpts)
- func (tx *Tx) SetBlockEntity(pos cube.Pos, b Block)
- func (tx *Tx) SetLiquid(pos cube.Pos, b Liquid)
- func (tx *Tx) SkyLight(pos cube.Pos) uint8
- func (tx *Tx) Sleepers() iter.Seq[Sleeper]
- func (tx *Tx) SnowingAt(pos cube.Pos) bool
- func (tx *Tx) Temperature(pos cube.Pos) float64
- func (tx *Tx) Thundering() bool
- func (tx *Tx) ThunderingAt(pos cube.Pos) bool
- func (tx *Tx) Viewers(pos mgl64.Vec3) []Viewer
- func (tx *Tx) World() *World
- type ViewLayer
- func (v *ViewLayer) AlwaysShowNameTag(entity Entity) (bool, bool)
- func (v *ViewLayer) Close() error
- func (v *ViewLayer) Entities() []*EntityHandle
- func (v *ViewLayer) NameTag(entity Entity) (string, bool)
- func (v *ViewLayer) Remove(entity Entity)
- func (v *ViewLayer) ScoreTag(entity Entity) (string, bool)
- func (v *ViewLayer) ViewAlwaysShowNameTag(entity Entity, alwaysShow bool)
- func (v *ViewLayer) ViewNameTag(entity Entity, nameTag string)
- func (v *ViewLayer) ViewPublicAlwaysShowNameTag(entity Entity)
- func (v *ViewLayer) ViewPublicNameTag(entity Entity)
- func (v *ViewLayer) ViewPublicScoreTag(entity Entity)
- func (v *ViewLayer) ViewScoreTag(entity Entity, scoreTag string)
- func (v *ViewLayer) ViewVisibility(entity Entity, level VisibilityLevel)
- func (v *ViewLayer) Visibility(entity Entity) VisibilityLevel
- type ViewLayerUpdater
- type Viewer
- type VisibilityLevel
- type World
- func (w *World) AdvanceTick()
- func (w *World) BlockRegistry() BlockRegistry
- func (w *World) Close() error
- func (w *World) DefaultGameMode() GameMode
- func (w *World) Difficulty() Difficulty
- func (w *World) Dimension() Dimension
- func (w *World) Do(f func(tx *Tx)) *Task
- func (w *World) DoAfter(delay time.Duration, f func(tx *Tx)) *Task
- func (w *World) EntityRegistry() EntityRegistry
- func (w *World) Handle(h Handler)
- func (w *World) Handler() Handler
- func (w *World) HighestLightBlocker(x, z int) int
- func (w *World) Name() string
- func (w *World) PlayerSpawn(id uuid.UUID) cube.Pos
- func (w *World) PortalDestination(dim Dimension) *World
- func (w *World) Raining() bool
- func (w *World) Range() cube.Range
- func (w *World) Save()
- func (w *World) SetDefaultGameMode(mode GameMode)
- func (w *World) SetDifficulty(d Difficulty)
- func (w *World) SetPlayerSpawn(id uuid.UUID, pos cube.Pos)
- func (w *World) SetRequiredSleepDuration(duration time.Duration)
- func (w *World) SetSpawn(pos cube.Pos)
- func (w *World) SetTickRange(v int)
- func (w *World) SetTime(new int)
- func (w *World) Spawn() cube.Pos
- func (w World) StartRaining(dur time.Duration)
- func (w World) StartThundering(dur time.Duration)
- func (w *World) StartTime()
- func (w World) StartWeatherCycle()
- func (w World) StopRaining()
- func (w World) StopThundering()
- func (w *World) StopTime()
- func (w World) StopWeatherCycle()
- func (w *World) Thundering() bool
- func (w *World) Time() int
- func (w *World) TimeCycle() bool
Constants ¶
View Source
const ( TimeSleep = 12542 TimeWake = 23459 TimeSleepWithRain = 12010 TimeWakeWithRain = 23991 TimeFull = 24000 )
Variables ¶
View Source
var ( DifficultyPeaceful difficultyPeaceful DifficultyEasy difficultyEasy DifficultyNormal difficultyNormal DifficultyHard difficultyHard )
View Source
var ( Overworld overworld Nether nether End end )
View Source
var ( GameModeSurvival survival GameModeCreative creative GameModeAdventure adventure GameModeSpectator spectator )
View Source
var ( ErrWorldClosed = errors.New("world: world closed") ErrEntityClosed = errors.New("world: entity closed") ErrEntityNotInWorld = errors.New("world: entity not in this world") ErrTaskCancelled = errors.New("world: scheduled task cancelled") ErrTaskPanicked = errors.New("world: scheduled task panicked") ErrEntityType = errors.New("world: unexpected entity type") )
View Source
var DefaultBlockRegistry = &BasicBlockRegistry{ blockProperties: make(map[string]map[string]any), stateRuntimeIDs: make(map[stateHash]uint32), customBlocks: make(map[string]CustomBlock), }
Functions ¶
func BiomeDefinitions ¶
func BiomeDefinitions() ([]protocol.BiomeDefinition, []string)
func BlockRuntimeID ¶
func CallEntity ¶
func ClampRedstonePower ¶
func CustomBlocks ¶
func CustomBlocks() map[string]CustomBlock
func DifficultyID ¶
func DifficultyID(diff Difficulty) (int, bool)
func DimensionID ¶
func GameModeID ¶
func RegisterBiome ¶
func RegisterBiome(b Biome)
func RegisterBlock ¶
func RegisterBlock(b Block)
func RegisterItem ¶
func RegisterItem(item Item)
func RegisterSpawnEggHandler ¶
func RegisterSpawnEggHandler(name string, handler SpawnEggHandler)
Types ¶
type ArrowSpawnConfig ¶
type BasicBlockRegistry ¶
type BasicBlockRegistry struct {
// contains filtered or unexported fields
}
func (*BasicBlockRegistry) Air ¶
func (br *BasicBlockRegistry) Air() Block
func (*BasicBlockRegistry) AirRuntimeID ¶
func (br *BasicBlockRegistry) AirRuntimeID() uint32
func (*BasicBlockRegistry) BitSize ¶
func (br *BasicBlockRegistry) BitSize() int
func (*BasicBlockRegistry) BlockByName ¶
func (*BasicBlockRegistry) BlockByRuntimeID ¶
func (br *BasicBlockRegistry) BlockByRuntimeID(rid uint32) (Block, bool)
func (*BasicBlockRegistry) BlockByRuntimeIDOrAir ¶
func (br *BasicBlockRegistry) BlockByRuntimeIDOrAir(rid uint32) Block
func (*BasicBlockRegistry) BlockCount ¶
func (br *BasicBlockRegistry) BlockCount() int
func (*BasicBlockRegistry) BlockHash ¶
func (br *BasicBlockRegistry) BlockHash(b Block) uint64
func (*BasicBlockRegistry) BlockRuntimeID ¶
func (br *BasicBlockRegistry) BlockRuntimeID(b Block) uint32
func (*BasicBlockRegistry) Blocks ¶
func (br *BasicBlockRegistry) Blocks() []Block
func (*BasicBlockRegistry) Clone ¶
func (br *BasicBlockRegistry) Clone() *BasicBlockRegistry
func (*BasicBlockRegistry) CustomBlocks ¶
func (br *BasicBlockRegistry) CustomBlocks() map[string]CustomBlock
func (*BasicBlockRegistry) FilteringBlock ¶
func (br *BasicBlockRegistry) FilteringBlock(rid uint32) uint8
func (*BasicBlockRegistry) Finalize ¶
func (br *BasicBlockRegistry) Finalize()
func (*BasicBlockRegistry) HashToRuntimeID ¶
func (br *BasicBlockRegistry) HashToRuntimeID(hash uint32) (rid uint32, ok bool)
func (*BasicBlockRegistry) LightBlock ¶
func (br *BasicBlockRegistry) LightBlock(rid uint32) uint8
func (*BasicBlockRegistry) LiquidBlock ¶
func (br *BasicBlockRegistry) LiquidBlock(rid uint32) bool
func (*BasicBlockRegistry) LiquidDisplacingBlock ¶
func (br *BasicBlockRegistry) LiquidDisplacingBlock(rid uint32) bool
func (*BasicBlockRegistry) NBTBlock ¶
func (br *BasicBlockRegistry) NBTBlock(rid uint32) bool
func (*BasicBlockRegistry) RandomTickBlock ¶
func (br *BasicBlockRegistry) RandomTickBlock(rid uint32) bool
func (*BasicBlockRegistry) RegisterBlock ¶
func (br *BasicBlockRegistry) RegisterBlock(b Block)
func (*BasicBlockRegistry) RegisterBlockState ¶
func (br *BasicBlockRegistry) RegisterBlockState(s BlockState)
func (*BasicBlockRegistry) RuntimeIDToHash ¶
func (br *BasicBlockRegistry) RuntimeIDToHash(runtimeID uint32) (hash uint32, ok bool)
func (*BasicBlockRegistry) RuntimeIDToState ¶
func (*BasicBlockRegistry) StateToRuntimeID ¶
type Biome ¶
type Biome interface {
Temperature() float64
Rainfall() float64
Depth() float64
Scale() float64
WaterColour() color.RGBA
Tags() []string
String() string
EncodeBiome() int
}
func BiomeByName ¶
type Block ¶
type Block interface {
EncodeBlock() (string, map[string]any)
Hash() (uint64, uint64)
Model() BlockModel
}
func BlockByRuntimeID ¶
type BlockAction ¶
type BlockAction interface {
BlockAction()
}
type BlockModel ¶
type BlockRegistry ¶
type BlockRegistry interface {
chunk.BlockRegistry
BlockByRuntimeID(rid uint32) (Block, bool)
BlockByRuntimeIDOrAir(rid uint32) Block
BlockRuntimeID(block Block) (rid uint32)
RegisterBlock(block Block)
RegisterBlockState(blockState BlockState)
CustomBlocks() map[string]CustomBlock
BlockByName(name string, properties map[string]any) (Block, bool)
Blocks() []Block
Air() Block
Finalize()
BitSize() int
BlockHash(b Block) uint64
RuntimeIDToHash(runtimeID uint32) (hash uint32, ok bool)
}
func NewBlockRegistry ¶
func NewBlockRegistry() BlockRegistry
type BlockSource ¶
type BlockState ¶
type Config ¶
type Config struct {
Log *slog.Logger
Dim Dimension
PortalDestination func(dim Dimension) *World
Provider Provider
Generator Generator
ReadOnly bool
SaveInterval time.Duration
ChunkUnloadInterval time.Duration
ChunkLoadWorkers int
RandomTickSpeed int
RandSource rand.Source
Entities EntityRegistry
Blocks BlockRegistry
Synchronous bool
}
type CustomBlock ¶
type CustomBlock interface {
Block
Properties() customblock.Properties
}
type CustomBlockBuildable ¶
type CustomItem ¶
func CustomItems ¶
func CustomItems() []CustomItem
type DamageSource ¶
type Difficulty ¶
type Difficulty interface {
FoodRegenerates() bool
StarvationHealthLimit() float64
FireSpreadIncrease() int
}
func DifficultyByID ¶
func DifficultyByID(id int) (Difficulty, bool)
type Dimension ¶
type Dimension interface {
Range() cube.Range
WaterEvaporates() bool
LavaSpreadDuration() time.Duration
WeatherCycle() bool
TimeCycle() bool
}
func DimensionByID ¶
type EntityAction ¶
type EntityAction interface {
EntityAction()
}
type EntityAnimation ¶
type EntityAnimation struct {
// contains filtered or unexported fields
}
func NewEntityAnimation ¶
func NewEntityAnimation(name string) EntityAnimation
func (EntityAnimation) Controller ¶
func (a EntityAnimation) Controller() string
func (EntityAnimation) Name ¶
func (a EntityAnimation) Name() string
func (EntityAnimation) NextState ¶
func (a EntityAnimation) NextState() string
func (EntityAnimation) StopCondition ¶
func (a EntityAnimation) StopCondition() string
func (EntityAnimation) WithController ¶
func (a EntityAnimation) WithController(controller string) EntityAnimation
func (EntityAnimation) WithNextState ¶
func (a EntityAnimation) WithNextState(state string) EntityAnimation
func (EntityAnimation) WithStopCondition ¶
func (a EntityAnimation) WithStopCondition(condition string) EntityAnimation
type EntityConfig ¶
type EntityConfig interface {
Apply(data *EntityData)
}
type EntityData ¶
type EntityHandle ¶
type EntityHandle struct {
// contains filtered or unexported fields
}
func NewEntity ¶
func NewEntity(t EntityType, conf EntityConfig) *EntityHandle
func (*EntityHandle) Close ¶
func (e *EntityHandle) Close() error
func (*EntityHandle) Closed ¶
func (e *EntityHandle) Closed() bool
func (*EntityHandle) Type ¶
func (e *EntityHandle) Type() EntityType
func (*EntityHandle) UUID ¶
func (e *EntityHandle) UUID() uuid.UUID
type EntityRef ¶
type EntityRef[T Entity] struct { // contains filtered or unexported fields }
func NewEntityRef ¶
func NewEntityRef[T Entity](h *EntityHandle) EntityRef[T]
func (EntityRef[T]) Handle ¶
func (r EntityRef[T]) Handle() *EntityHandle
type EntityRegistry ¶
type EntityRegistry struct {
// contains filtered or unexported fields
}
func (EntityRegistry) Config ¶
func (reg EntityRegistry) Config() EntityRegistryConfig
func (EntityRegistry) Lookup ¶
func (reg EntityRegistry) Lookup(name string) (EntityType, bool)
func (EntityRegistry) Types ¶
func (reg EntityRegistry) Types() []EntityType
type EntityRegistryConfig ¶
type EntityRegistryConfig struct {
Item func(opts EntitySpawnOpts, it any) *EntityHandle
FallingBlock func(opts EntitySpawnOpts, bl Block) *EntityHandle
TNT func(opts EntitySpawnOpts, fuse time.Duration) *EntityHandle
BottleOfEnchanting func(opts EntitySpawnOpts, owner Entity) *EntityHandle
Arrow func(opts EntitySpawnOpts, conf ArrowSpawnConfig) *EntityHandle
Egg func(opts EntitySpawnOpts, owner Entity) *EntityHandle
EnderPearl func(opts EntitySpawnOpts, owner Entity) *EntityHandle
Firework func(opts EntitySpawnOpts, firework Item, owner Entity, sidewaysVelocityMultiplier, upwardsAcceleration float64, attached bool) *EntityHandle
LingeringPotion func(opts EntitySpawnOpts, t any, owner Entity) *EntityHandle
Snowball func(opts EntitySpawnOpts, owner Entity) *EntityHandle
SplashPotion func(opts EntitySpawnOpts, t any, owner Entity) *EntityHandle
Lightning func(opts EntitySpawnOpts) *EntityHandle
}
func (EntityRegistryConfig) New ¶
func (conf EntityRegistryConfig) New(ent []EntityType) EntityRegistry
type EntitySpawnOpts ¶
type EntitySpawnOpts struct {
Position mgl64.Vec3
Rotation cube.Rotation
Velocity mgl64.Vec3
ID uuid.UUID
NameTag string
}
func (EntitySpawnOpts) New ¶
func (opts EntitySpawnOpts) New(t EntityType, conf EntityConfig) *EntityHandle
type EntityType ¶
type EntityType interface {
Open(tx *Tx, handle *EntityHandle, data *EntityData) Entity
EncodeEntity() string
BBox(e Entity) cube.BBox
DecodeNBT(m map[string]any, data *EntityData)
EncodeNBT(data *EntityData) map[string]any
}
type GameMode ¶
type GameMode interface {
AllowsEditing() bool
AllowsTakingDamage() bool
CreativeInventory() bool
HasCollision() bool
AllowsFlying() bool
AllowsInteraction() bool
Visible() bool
InstantPortalTravel() bool
}
func GameModeByID ¶
type Handler ¶
type Handler interface {
HandleLiquidFlow(ctx *Context, from, into cube.Pos, liquid Liquid, replaced Block)
HandleLiquidDecay(ctx *Context, pos cube.Pos, before, after Liquid)
HandleLiquidHarden(ctx *Context, hardenedPos cube.Pos, liquidHardened, otherLiquid, newBlock Block)
HandleSound(ctx *Context, s Sound, pos mgl64.Vec3)
HandleFireSpread(ctx *Context, from, to cube.Pos)
HandleBlockBurn(ctx *Context, pos cube.Pos)
HandleCropTrample(ctx *Context, pos cube.Pos)
HandleLeavesDecay(ctx *Context, pos cube.Pos)
HandleEntitySpawn(tx *Tx, e Entity)
HandleEntityDespawn(tx *Tx, e Entity)
HandleExplosion(ctx *Context, position mgl64.Vec3, entities *[]Entity, blocks *[]cube.Pos, itemDropChance *float64, spawnFire *bool)
HandleRedstoneUpdate(ctx *Context, update RedstoneUpdate)
HandleClose(tx *Tx)
}
type HealingSource ¶
type HealingSource interface {
HealingSource()
}
type LiquidDisplacer ¶
type Loader ¶
type Loader struct {
// contains filtered or unexported fields
}
func (*Loader) ChangeRadius ¶
func (*Loader) ChangeWorld ¶
type NeighbourUpdateTicker ¶
type NopGenerator ¶
type NopGenerator struct{}
func (NopGenerator) DefaultSpawn ¶
func (NopGenerator) DefaultSpawn(Dimension) cube.Pos
func (NopGenerator) GenerateChunk ¶
func (NopGenerator) GenerateChunk(ChunkPos, *chunk.Chunk)
type NopHandler ¶
type NopHandler struct{}
func (NopHandler) HandleBlockBurn ¶
func (NopHandler) HandleBlockBurn(*Context, cube.Pos)
func (NopHandler) HandleClose ¶
func (NopHandler) HandleClose(*Tx)
func (NopHandler) HandleCropTrample ¶
func (NopHandler) HandleCropTrample(*Context, cube.Pos)
func (NopHandler) HandleEntityDespawn ¶
func (NopHandler) HandleEntityDespawn(*Tx, Entity)
func (NopHandler) HandleEntitySpawn ¶
func (NopHandler) HandleEntitySpawn(*Tx, Entity)
func (NopHandler) HandleExplosion ¶
func (NopHandler) HandleFireSpread ¶
func (NopHandler) HandleLeavesDecay ¶
func (NopHandler) HandleLeavesDecay(*Context, cube.Pos)
func (NopHandler) HandleLiquidDecay ¶
func (NopHandler) HandleLiquidFlow ¶
func (NopHandler) HandleLiquidHarden ¶
func (NopHandler) HandleRedstoneUpdate ¶
func (NopHandler) HandleRedstoneUpdate(*Context, RedstoneUpdate)
func (NopHandler) HandleSound ¶
func (NopHandler) HandleSound(*Context, Sound, mgl64.Vec3)
type NopProvider ¶
type NopProvider struct {
Set *Settings
}
func (NopProvider) Close ¶
func (NopProvider) Close() error
func (NopProvider) LoadColumn ¶
func (NopProvider) LoadPlayerSpawnPosition ¶
func (NopProvider) SavePlayerSpawnPosition ¶
func (NopProvider) SaveSettings ¶
func (NopProvider) SaveSettings(*Settings)
func (NopProvider) Settings ¶
func (n NopProvider) Settings() *Settings
func (NopProvider) StoreColumn ¶
type NopViewer ¶
type NopViewer struct{}
func (NopViewer) HideEntity ¶
func (NopViewer) ViewBlockAction ¶
func (NopViewer) ViewBlockAction(cube.Pos, BlockAction)
func (NopViewer) ViewBrewingUpdate ¶
func (NopViewer) ViewEntity ¶
func (NopViewer) ViewEntityAction ¶
func (NopViewer) ViewEntityAction(Entity, EntityAction)
func (NopViewer) ViewEntityAnimation ¶
func (NopViewer) ViewEntityAnimation(Entity, EntityAnimation)
func (NopViewer) ViewEntityArmour ¶
func (NopViewer) ViewEntityDisplacement ¶
func (NopViewer) ViewEntityGameMode ¶
func (NopViewer) ViewEntityItems ¶
func (NopViewer) ViewEntityMovement ¶
func (NopViewer) ViewEntityState ¶
func (NopViewer) ViewEntityWake ¶
func (NopViewer) ViewFurnaceUpdate ¶
func (NopViewer) ViewTimeCycle ¶
func (NopViewer) ViewWeather ¶
func (NopViewer) ViewWorldSpawn ¶
type PanicError ¶
func (*PanicError) Error ¶
func (e *PanicError) Error() string
func (*PanicError) Unwrap ¶
func (e *PanicError) Unwrap() error
type Provider ¶
type Provider interface {
io.Closer
Settings() *Settings
SaveSettings(*Settings)
LoadPlayerSpawnPosition(uuid uuid.UUID) (pos cube.Pos, exists bool, err error)
SavePlayerSpawnPosition(uuid uuid.UUID, pos cube.Pos) error
LoadColumn(pos ChunkPos, dim Dimension) (*chunk.Column, error)
StoreColumn(pos ChunkPos, dim Dimension, col *chunk.Column) error
}
type RedstoneNonConductive ¶
type RedstoneNonConductive interface {
RedstoneNonConductive()
}
type RedstonePowerAction ¶
type RedstonePowerConsumer ¶
type RedstonePowerContextAction ¶
type RedstonePowerContextAction interface {
RedstonePowerActionUpdate(pos cube.Pos, tx *Tx, update RedstoneUpdate)
}
type RedstonePowerRelayer ¶
type RedstonePowerSource ¶
type RedstoneTorchTransaction ¶
type RedstoneTorchTransaction struct {
// contains filtered or unexported fields
}
func (RedstoneTorchTransaction) BurnoutStatus ¶
func (t RedstoneTorchTransaction) BurnoutStatus() (burnedOut, recoverable bool)
func (RedstoneTorchTransaction) ClearBurnout ¶
func (t RedstoneTorchTransaction) ClearBurnout()
func (RedstoneTorchTransaction) ConsumeSelfTriggered ¶
func (t RedstoneTorchTransaction) ConsumeSelfTriggered() bool
func (RedstoneTorchTransaction) MarkSelfTriggered ¶
func (t RedstoneTorchTransaction) MarkSelfTriggered()
func (RedstoneTorchTransaction) RecordTurnOff ¶
func (t RedstoneTorchTransaction) RecordTurnOff() (burnsOut bool)
type RedstoneTransaction ¶
type RedstoneTransaction struct {
// contains filtered or unexported fields
}
func (RedstoneTransaction) ScheduleUpdate ¶
func (r RedstoneTransaction) ScheduleUpdate(pos cube.Pos)
func (RedstoneTransaction) Torch ¶
func (r RedstoneTransaction) Torch(pos cube.Pos) RedstoneTorchTransaction
type RedstoneUpdate ¶
type RedstoneUpdateCause ¶
type RedstoneUpdateCause uint8
const ( RedstoneUpdateCauseBlockUpdate RedstoneUpdateCause = iota RedstoneUpdateCauseScheduledTick RedstoneUpdateCauseCompilerRebuild )
type RedstoneWeakBlockPowerer ¶
type RedstoneWeakBlockPowerer interface {
RedstoneWeaklyPowersBlocks() bool
}
type ScheduledTicker ¶
type Settings ¶
type Settings struct {
sync.Mutex
Name string
Spawn cube.Pos
Time int64
TimeCycle bool
RainTime int64
Raining bool
ThunderTime int64
Thundering bool
WeatherCycle bool
RequiredSleepTicks int64
CurrentTick int64
DefaultGameMode GameMode
Difficulty Difficulty
TickRange int32
// contains filtered or unexported fields
}
type SpawnEggHandler ¶
func SpawnEggHandlerByName ¶
func SpawnEggHandlerByName(name string) (SpawnEggHandler, bool)
type SubChunkPos ¶
type SubChunkPos [3]int32
func (SubChunkPos) String ¶
func (p SubChunkPos) String() string
func (SubChunkPos) X ¶
func (p SubChunkPos) X() int32
func (SubChunkPos) Y ¶
func (p SubChunkPos) Y() int32
func (SubChunkPos) Z ¶
func (p SubChunkPos) Z() int32
type TickerBlock ¶
type TickerEntity ¶
type Tx ¶
type Tx struct {
// contains filtered or unexported fields
}
func (*Tx) AddEntity ¶
func (tx *Tx) AddEntity(e *EntityHandle) Entity
func (*Tx) AddEntityAt ¶
func (tx *Tx) AddEntityAt(e *EntityHandle, pos mgl64.Vec3) Entity
func (*Tx) BlocksWithin ¶
func (*Tx) BroadcastSleepingIndicator ¶
func (tx *Tx) BroadcastSleepingIndicator()
func (*Tx) BroadcastSleepingReminder ¶
func (*Tx) CurrentTick ¶
func (*Tx) HighestBlock ¶
func (*Tx) HighestLightBlocker ¶
func (*Tx) PlayEntityAnimation ¶
func (tx *Tx) PlayEntityAnimation(e Entity, a EntityAnimation)
func (*Tx) Redstone ¶
func (tx *Tx) Redstone() RedstoneTransaction
func (*Tx) RedstoneDirectPowerFrom ¶
func (*Tx) RedstoneStrongPowerFrom ¶
func (*Tx) RemoveEntity ¶
func (tx *Tx) RemoveEntity(e Entity) *EntityHandle
func (*Tx) ScheduleBlockUpdate ¶
func (*Tx) Thundering ¶
type ViewLayer ¶
type ViewLayer struct {
// contains filtered or unexported fields
}
func NewViewLayer ¶
func NewViewLayer(updater ViewLayerUpdater) *ViewLayer
func (*ViewLayer) AlwaysShowNameTag ¶
func (*ViewLayer) Entities ¶
func (v *ViewLayer) Entities() []*EntityHandle
func (*ViewLayer) ViewAlwaysShowNameTag ¶
func (*ViewLayer) ViewNameTag ¶
func (*ViewLayer) ViewPublicAlwaysShowNameTag ¶
func (*ViewLayer) ViewPublicNameTag ¶
func (*ViewLayer) ViewPublicScoreTag ¶
func (*ViewLayer) ViewScoreTag ¶
func (*ViewLayer) ViewVisibility ¶
func (v *ViewLayer) ViewVisibility(entity Entity, level VisibilityLevel)
func (*ViewLayer) Visibility ¶
func (v *ViewLayer) Visibility(entity Entity) VisibilityLevel
type ViewLayerUpdater ¶
type ViewLayerUpdater interface {
ViewLayerEntityChanged(entity Entity)
}
type Viewer ¶
type Viewer interface {
ViewEntity(e Entity)
HideEntity(e Entity)
ViewEntityGameMode(e Entity)
ViewEntityMovement(e Entity, pos mgl64.Vec3, rot cube.Rotation, onGround bool)
ViewEntityDisplacement(e Entity, pos mgl64.Vec3, rot cube.Rotation, onGround bool)
ViewEntityVelocity(e Entity, vel mgl64.Vec3)
ViewEntityTeleport(e Entity, pos mgl64.Vec3)
ViewFurnaceUpdate(prevCookTime, cookTime, prevRemainingFuelTime, remainingFuelTime, prevMaxFuelTime, maxFuelTime time.Duration)
ViewBrewingUpdate(prevBrewTime, brewTime time.Duration, prevFuelAmount, fuelAmount, prevFuelTotal, fuelTotal int32)
ViewChunk(pos ChunkPos, dim Dimension, blockEntities map[cube.Pos]Block, c *chunk.Chunk)
ViewTime(t int)
ViewTimeCycle(doDayLightCycle bool)
ViewEntityItems(e Entity)
ViewEntityArmour(e Entity)
ViewEntityAction(e Entity, a EntityAction)
ViewEntityState(e Entity)
ViewEntityAnimation(e Entity, a EntityAnimation)
ViewParticle(pos mgl64.Vec3, p Particle)
ViewSound(pos mgl64.Vec3, s Sound)
ViewBlockUpdate(pos cube.Pos, b Block, layer int)
ViewBlockAction(pos cube.Pos, a BlockAction)
ViewEmote(e Entity, emote uuid.UUID)
ViewSkin(e Entity)
ViewWorldSpawn(pos cube.Pos)
ViewWeather(raining, thunder bool)
ViewEntityWake(e Entity)
}
type VisibilityLevel ¶
type VisibilityLevel struct {
// contains filtered or unexported fields
}
func EnforceInvisible ¶
func EnforceInvisible() VisibilityLevel
func EnforceVisible ¶
func EnforceVisible() VisibilityLevel
func PublicVisibility ¶
func PublicVisibility() VisibilityLevel
func (VisibilityLevel) EnforceVisibility ¶
func (v VisibilityLevel) EnforceVisibility() bool
type World ¶
type World struct {
// contains filtered or unexported fields
}
func (*World) AdvanceTick ¶
func (w *World) AdvanceTick()
func (*World) BlockRegistry ¶
func (w *World) BlockRegistry() BlockRegistry
func (*World) DefaultGameMode ¶
func (*World) Difficulty ¶
func (w *World) Difficulty() Difficulty
func (*World) EntityRegistry ¶
func (w *World) EntityRegistry() EntityRegistry
func (*World) HighestLightBlocker ¶
func (*World) PortalDestination ¶
func (*World) SetDefaultGameMode ¶
func (*World) SetDifficulty ¶
func (w *World) SetDifficulty(d Difficulty)
func (*World) SetRequiredSleepDuration ¶
func (*World) SetTickRange ¶
func (World) StartRaining ¶
func (World) StartThundering ¶
func (World) StartWeatherCycle ¶
func (w World) StartWeatherCycle()
func (World) StopRaining ¶
func (w World) StopRaining()
func (World) StopThundering ¶
func (w World) StopThundering()
func (World) StopWeatherCycle ¶
func (w World) StopWeatherCycle()
func (*World) Thundering ¶
Source Files
¶
- biome.go
- biome_definition.go
- block.go
- block_model.go
- block_registry.go
- block_search.go
- block_source.go
- block_state.go
- chunk_request.go
- conf.go
- difficulty.go
- dimension.go
- entity.go
- entity_animation.go
- entity_ref.go
- entity_schedule.go
- game_mode.go
- generator.go
- handler.go
- item.go
- loader.go
- network_block_hash.go
- particle.go
- position.go
- provider.go
- redstone.go
- settings.go
- sleep.go
- sound.go
- spawn_egg_handler.go
- structure.go
- task.go
- tick.go
- tx.go
- tx_redstone.go
- view_layer.go
- viewer.go
- visibility_level.go
- weather.go
- world.go
Click to show internal directories.
Click to hide internal directories.