Advertisement
Guest User

Untitled

a guest
Feb 1st, 2016
70
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.44 KB | None | 0 0
  1. public class ExampleItemBlock extends ItemBlockWithMetadata
  2. {
  3.     public static final String[] SUBNAMES = new String[] {"blue", "green", "yellow", "red"};
  4.    
  5.     public ExampleItemBlock(Block block)
  6.     {
  7.         super(block, block);
  8.     }
  9.    
  10.     @Override
  11.     public String getUnlocalizedName(ItemStack itemStack)
  12.     {
  13.         int i = itemStack.getItemDamage();
  14.         if (i < 0 || i >= SUBNAMES.length) i = 0;
  15.      
  16.         return getUnlocalizedName() + "." + SUBNAMES[i];
  17.     }
  18.  
  19. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement