Ejemplo n.º 1
0
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]++
				}
			}
		}
	}
}
Ejemplo n.º 2
0
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
}