Beispiel #1
0
  @Override
  public int getMetaFromState(IBlockState state) {
    Comparable comp = state.getValue(VARIANT);

    for (byte m = 0; m < 16; m++) {
      if (m >= EnumVariant.values().length) return 0;
      if (EnumVariant.values()[m] == comp) return m;
    }

    return 0;
  }
Beispiel #2
0
 @Override
 public IBlockState getStateFromMeta(int meta) {
   return meta == 0 || meta >= EnumVariant.values().length
       ? this.getDefaultState()
       : this.getDefaultState().withProperty(VARIANT, EnumVariant.values()[meta]);
 }