public void ChangeBlockType(Vector3 blockPosition, BlockType blockType) { if (blockPosition.x >= World.chunkSize || blockPosition.x < 0 || blockPosition.y >= World.chunkSize || blockPosition.y < 0 || blockPosition.z >= World.chunkSize || blockPosition.z < 0) { return; } Block block = chunkBlocks[(int)blockPosition.x, (int)blockPosition.y, (int)blockPosition.z]; if (block.GetBlockType() == World.blockTypes[BlockType.Type.BEDROCK] || block.GetBlockType() == World.blockTypes[BlockType.Type.WATER]) { return; } _sounds.DestroyBlockSound(block.GetBlockType().name.ToString()); block.SetBlockType(blockType); RedrawChunk(World.chunkSize); if (blockPosition.x == 0) { RedrawNeighbourChunk(new Vector3(-16, 0)); } if (blockPosition.x == World.chunkSize - 1) { RedrawNeighbourChunk(new Vector3(16, 0)); } if (blockPosition.y == 0) { RedrawNeighbourChunk(new Vector3(0, -16)); } if (blockPosition.y == World.chunkSize - 1) { RedrawNeighbourChunk(new Vector3(0, 16)); } if (blockPosition.z == 0) { RedrawNeighbourChunk(new Vector3(0, 0, -16)); } if (blockPosition.z == World.chunkSize - 1) { RedrawNeighbourChunk(new Vector3(0, 0, 16)); } }