public byte GetMetaFromState(IBlockState state) { byte i = 0; if (state.GetTypedValue(UPPER)) { i = (byte) (i | 8); if (state.GetTypedValue(RIGHTHINCHED)) { i |= 1; } if (state.GetTypedValue(POWERED)) { i |= 2; } } else { var facingValue = Correct(state.GetTypedValue(FACING)); i = (byte) ((i & 245) + facingValue); if (state.GetTypedValue(OPEN)) { i |= 4; } } return i; }
private int GetLevel(IBlockState state) { return(7 - (state.GetTypedValue(LEVEL) & 0x7)); }