コード例 #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;
  }
コード例 #2
0
 @Override
 public IBlockState getStateFromMeta(int meta) {
   return meta == 0 || meta >= EnumVariant.values().length
       ? this.getDefaultState()
       : this.getDefaultState().withProperty(VARIANT, EnumVariant.values()[meta]);
 }