summaryrefslogtreecommitdiff
path: root/mcmap/examples/replace
diff options
context:
space:
mode:
Diffstat (limited to 'mcmap/examples/replace')
-rw-r--r--mcmap/examples/replace/main.go15
1 files changed, 5 insertions, 10 deletions
diff --git a/mcmap/examples/replace/main.go b/mcmap/examples/replace/main.go
index 87dd677..d289522 100644
--- a/mcmap/examples/replace/main.go
+++ b/mcmap/examples/replace/main.go
@@ -37,17 +37,12 @@ chunkLoop:
}
modified := false
- for y := 0; y < mcmap.ChunkSizeY; y++ {
- for x := 0; x < mcmap.ChunkSizeXZ; x++ {
- for z := 0; z < mcmap.ChunkSizeXZ; z++ {
- blk := chunk.Block(x, y, z)
- if blk.ID == mcmap.BlkBlockOfIron {
- blk.ID = mcmap.BlkBlockOfDiamond
- modified = true
- }
- }
+ chunk.Iter(func(x, y, z int, blk *mcmap.Block) {
+ if blk.ID == mcmap.BlkBlockOfIron {
+ blk.ID = mcmap.BlkBlockOfDiamond
+ modified = true
}
- }
+ })
if modified {
fmt.Printf("Modified chunk %d, %d.\n", cx, cz)