Beispiel #1
0
func startBlockUpdate(x, y, z int32) {
	for X := x - 1; X <= x+1; X++ {
		for Y := y - 1; Y <= y+1; Y++ {
			for Z := z - 1; Z <= z+1; Z++ {
				chunk := storage.GetChunkContaining(X, Z)

				switch chunk.GetBlock(X, Y, Z) {
				case block.Water, block.StationaryWater:
					stopTheFloodingOMG := chunk.GetData(X, Y, Z)
					chunk.SetBlock(X, Y, Z, block.Water)
					chunk.SetData(X, Y, Z, stopTheFloodingOMG)
					queueUpdate(X, Y, Z)

				case block.Sponge:
					queueUpdate(X, Y, Z)

				case block.Gravel, block.Sand, block.LongGrass, block.RedFlower, block.YellowFlower:
					queueUpdate(X, Y, Z)
				}

				storage.ReleaseChunkContaining(X, Z)
			}
		}
	}
}
Beispiel #2
0
func GetBlockDataAt(x, y, z int32) uint8 {
	if y < 0 || y > 255 {
		return 0
	}
	chunk := storage.GetChunkContaining(x, z)
	defer storage.ReleaseChunkContaining(x, z)

	return chunk.GetData(x, y, z)
}