Esempio n. 1
0
 /**
  * Gets the meta value for a variation
  *
  * @param blocks The Block it is
  * @param v The Variation it is
  * @return The Variation
  */
 public static int metaFromVariation(CarvableBlocks blocks, Variation v) {
   for (int i = 0; i < blocks.getVariants().length; i++) {
     Variation l = blocks.getVariants()[i];
     if (l.equals(v)) {
       if (i >= 16) {
         return i % 16;
       }
       return i;
     }
   }
   return 0;
 }
Esempio n. 2
0
 @Override
 public int getMetaFromState(IBlockState state) {
   //        if (state.getBlock() instanceof BlockCarvable){
   //            BlockCarvable b = (BlockCarvable)state.getBlock();
   //            return Variation.metaFromVariation(b.getType(), (Variation)
   // state.getValue(VARIATION));
   //        }
   return Variation.metaFromVariation(type, (Variation) state.getValue(VARIATION));
 }
Esempio n. 3
0
 /**
  * Get the sub block from the variation
  *
  * @param v the variation
  * @return The sub block
  */
 public ISubBlock getSubBlock(Variation v) {
   // Chisel.logger.info("meta: "+Variation.metaFromVariation(type, v));
   ISubBlock block = subBlocks[Variation.metaFromVariation(type, v)];
   // Chisel.logger.info("Returning sub block "+block.getName());
   return block;
 }
Esempio n. 4
0
 @Override
 public IBlockState getStateFromMeta(int meta) {
   Variation v = Variation.fromMeta(type, meta, getIndex());
   return getBlockState().getBaseState().withProperty(VARIATION, v);
 }