Guest User

Untitled

a guest
Feb 10th, 2017
109
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.76 KB | None | 0 0
  1. package com.mightydanp.rodrcore.common.item;
  2.  
  3. import cpw.mods.fml.relauncher.Side;
  4. import cpw.mods.fml.relauncher.SideOnly;
  5. import net.minecraft.block.Block;
  6. import net.minecraft.item.ItemBlock;
  7. import net.minecraft.item.ItemStack;
  8.  
  9. public class ItemOreSand extends ItemBlock{
  10.  
  11. public static String[] subBlocks = new String[] {"copper", "tin"};
  12.  
  13. public ItemOreSand(Block block) {
  14. super(block);
  15. this.setHasSubtypes(true);
  16. }
  17.  
  18. @SideOnly(Side.CLIENT)
  19. public String getUnlocalizedName(ItemStack itemStack){
  20. int i = itemStack.getItemDamage();
  21. if(i < 0 || i >= subBlocks.length){
  22. i = 0;
  23. }
  24.  
  25. return super.getUnlocalizedName() + "_" + subBlocks[i];
  26. }
  27.  
  28. @Override
  29. public int getMetadata(int meta)
  30. {
  31. return meta;
  32. }
  33.  
  34. }
Add Comment
Please, Sign In to add comment