public void Set(BlockType type) { if (BlockDictionary.Get(type).Opaque) { solids++; } }
void TryAddFace(MeshBuilder activeBuilder, Vector3 pos, int dir, ChunkSection c, Vector3[][] vertices) { if (c == null) { activeBuilder.AddQuad(vertices, pos, dir, UVs); return; } Vector3Int adj = (pos - BlockMesh.Offset[dir]).ToIntVec(); BlockType adjBlock = c.GetBlock(adj.x, adj.y, adj.z); if (Type != adjBlock && !BlockDictionary.Get(adjBlock).Opaque) { activeBuilder.AddQuad(vertices, pos, dir, UVs); } }
bool ShouldMakeFace(Vector3Int pos, int dir, ChunkSection c) { Vector3Int adj = pos - BlockMesh.Offset[dir]; BlockType adjBlock = BlockType.Air; if (c != null) { adjBlock = c.GetBlock(adj.x, adj.y, adj.z); } if (Order == MeshOrder.Fluid && Type == adjBlock) { return(false); } if (!BlockDictionary.Get(adjBlock).Opaque) { return(true); } return(false); }
public void Update(BlockType type) { solids += BlockDictionary.Get(type).Opaque ? 1 : -1; solids = Math.Max(solids, 0); }