public void SetBlock(int x, int y, int z, Block block, bool chunkUpdate = true, bool updateNeighbors = true) { if (x < 0 || y < 0 || z < 0 || x >= VoxelWorld.Configuration.ChunkSegmentSize || z >= VoxelWorld.Configuration.ChunkSegmentSize) { return; } var segmentIndex = y / VoxelWorld.Configuration.ChunkSegmentSize; // Resize array if (_segments.Length <= segmentIndex) { SpawnSegments(segmentIndex + 1); } var rY = y % VoxelWorld.Configuration.ChunkSegmentSize; var segment = _segments[segmentIndex] ?? (_segments[segmentIndex] = new ChunkSegment(this, segmentIndex)); segment.SetBlock(x, rY, z, block, chunkUpdate, updateNeighbors); }
public ReMeshChunkSegment(ChunkSegment segment) => _segment = segment;