Pulcedocs

World

Read and mutate world state through WorldHandle and server-owned services.

On this page

Blocks

WorldHandle exposes block reads, block placement, block breaking, and property updates without direct runtime mutation.

blocks-worlds.go
worldHandle, ok := ctx.Gameplay().Worlds().ByName("Overworld")
if !ok {
	return fmt.Errorf("world not found")
}

pos := world.Pos{X: 10, Y: 64, Z: 10}
blockState := block.New("chest").
	String("minecraft:cardinal_direction", "north").
	Block()

current, exists, err := worldHandle.Block(pos)
err = worldHandle.SetBlock(pos, blockState)
err = worldHandle.UpdateProperties(pos, map[string]any{
	"open_bit": true,
})

_ = current
_ = exists

Queries And Effects

World handles can query nearby players/entities and emit server-owned sound, particle, and level events.

world-effects.go
entities := worldHandle.NearbyEntities(entity.Position{X: 0, Y: 64, Z: 0}, 12, 10)
players := worldHandle.PlayersNear(entity.Position{X: 0, Y: 64, Z: 0}, 12, 5)

err := worldHandle.AddSound(entity.Position{X: 0, Y: 64, Z: 0}, gameplay.SoundEffect{Type: 1})
err = worldHandle.AddParticle(entity.Position{X: 0, Y: 64, Z: 0}, gameplay.ParticleEffect{Type: 2001})
err = worldHandle.LevelEvent(entity.Position{X: 0, Y: 64, Z: 0}, gameplay.LevelEvent{Type: 2001})
_ = entities
_ = players