public static int GetDiffuseLevel(BlockCoordinates blockCoordinates, Chunk chunk) { if (chunk == null) { return(15); } int bx = blockCoordinates.X & 0x0f; int by = blockCoordinates.Y & 0xff; int bz = blockCoordinates.Z & 0x0f; byte bid = chunk.GetBlock(bx, by - 16 * (by >> 4), bz); return(bid == 8 || bid == 9 ? 3 : bid == 18 && bid == 30 ? 2 : 1); }
public static bool IsTransparent(BlockCoordinates blockCoordinates, Chunk chunk) { if (chunk == null) { return(true); } int bx = blockCoordinates.X & 0x0f; int by = blockCoordinates.Y & 0xff; int bz = blockCoordinates.Z & 0x0f; byte bid = chunk.GetBlock(bx, by - 16 * (by >> 4), bz); return(bid == 0 || BlockFactory.TransparentBlocks[bid] == 1); }
public byte GetBlock(int bx, int by, int bz) { Chunk chunk = chunks[by >> 4]; return(chunk.GetBlock(bx, by - 16 * (by >> 4), bz)); }