MeshData GetMesh(NBTChunk chunk, Vector3Int pos) { byte eastType = chunk.GetBlockByte(pos + Vector3Int.right); bool eastConnect = !NBTGeneratorManager.IsTransparent(eastType) || NBTGeneratorManager.IsFence(eastType); byte southType = chunk.GetBlockByte(pos + Vector3Int.back); bool southConnect = !NBTGeneratorManager.IsTransparent(southType) || NBTGeneratorManager.IsFence(southType); byte westType = chunk.GetBlockByte(pos + Vector3Int.left); bool westConnect = !NBTGeneratorManager.IsTransparent(westType) || NBTGeneratorManager.IsFence(westType); byte northType = chunk.GetBlockByte(pos + Vector3Int.forward); bool northConnect = !NBTGeneratorManager.IsTransparent(northType) || NBTGeneratorManager.IsFence(northType); int index = 0; if (westConnect) { index += 8; } if (northConnect) { index += 4; } if (eastConnect) { index += 2; } if (southConnect) { index += 1; } return(meshes[index]); }