TheGoldCrayon

ItemBlockMeta

Jun 14th, 2016
131
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.74 KB | None | 0 0
  1. package com.TheGoldCrayon.Daemonology.blocks;
  2.  
  3. import net.minecraft.block.Block;
  4. import net.minecraft.item.ItemBlock;
  5. import net.minecraft.item.ItemStack;
  6.  
  7. public class ItemBlockMeta extends ItemBlock
  8. {
  9.  
  10.     public ItemBlockMeta(Block block)
  11.     {
  12.         super(block);
  13.         if(!(block instanceof IMetaBlockName))
  14.         {
  15.             throw new IllegalArgumentException(String.format("The given Block %s is not an instance of IMetaBlockName", block.getUnlocalizedName()));
  16.         }
  17.         this.setHasSubtypes(true);
  18.     }
  19.    
  20.     public int getMetaData(int damage)
  21.     {
  22.         return damage;
  23.     }
  24.    
  25.     @Override
  26.     public String getUnlocalizedName(ItemStack stack)
  27.     {
  28.         return super.getUnlocalizedName(stack) + "." + ((IMetaBlockName)this.block).getSpecialName(stack);
  29.     }
  30.    
  31.    
  32.    
  33.    
  34.  
  35. }
Advertisement
Add Comment
Please, Sign In to add comment