From f194b131e0cac55d1937e75c98edf62ba04e1df4 Mon Sep 17 00:00:00 2001 From: Kevin Chabowski Date: Mon, 12 Aug 2013 15:44:06 +0200 Subject: Added Iter function to Chunk --- mcmap/examples/emeraldfinder/main.go | 15 +++++---------- 1 file changed, 5 insertions(+), 10 deletions(-) (limited to 'mcmap/examples/emeraldfinder') diff --git a/mcmap/examples/emeraldfinder/main.go b/mcmap/examples/emeraldfinder/main.go index 3249a35..ea22624 100644 --- a/mcmap/examples/emeraldfinder/main.go +++ b/mcmap/examples/emeraldfinder/main.go @@ -36,17 +36,12 @@ chunkLoop: os.Exit(1) } - 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.BlkEmeraldOre { - absx, absz := mcmap.ChunkToBlock(cx, cz, x, z) - fmt.Printf("%d, %d, %d\n", absx, y, absz) - } - } + chunk.Iter(func(x, y, z int, blk *mcmap.Block) { + if blk.ID == mcmap.BlkEmeraldOre { + absx, absz := mcmap.ChunkToBlock(cx, cz, x, z) + fmt.Printf("%d, %d, %d\n", absx, y, absz) } - } + }) chunk.MarkUnused() } -- cgit v1.2.3-70-g09d2