示例#1
0
文件: tally.go 项目: trichner/mctools
func tallyInSection(s *anvil.Section, items []item.Id, out TallyResult) {
	var x, y, z int
	var block anvil.Block

	for y = 0; y < 16; y++ {
		for x = 0; x < anvil.BlocksPerChunk; x++ {
			for z = 0; z < anvil.BlocksPerChunk; z++ {
				if s.Read(x, y, z, &block) && hasItem(items, block.Id) {
					out[block.Id]++
				}
			}
		}
	}
}
示例#2
0
文件: find.go 项目: trichner/mctools
func findInSection(s *anvil.Section, q Query, loc Block, out *BlockList) {
	var x, y, z int
	var block anvil.Block

	sy := loc.BY
	slice := *out

	for y = 0; y < 16; y++ {
		for x = 0; x < anvil.BlocksPerChunk; x++ {
			for z = 0; z < anvil.BlocksPerChunk; z++ {
				loc.BX = uint8(x)
				loc.BY = sy + uint8(y)
				loc.BZ = uint8(z)
				loc.Id = block.Id

				if s.Read(x, y, z, &block) && q.IsTarget(loc) {
					slice = append(slice, loc)
				}
			}
		}
	}

	*out = slice
}