Advertisement
LinusPhoenix

Untitled

Oct 10th, 2013
176
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.01 KB | None | 0 0
  1. package phnxflms.unidye;
  2.  
  3. import java.util.List;
  4.  
  5. import net.minecraft.block.Block;
  6. import net.minecraft.client.renderer.texture.IconRegister;
  7. import net.minecraft.creativetab.CreativeTabs;
  8. import net.minecraft.item.Item;
  9. import net.minecraft.item.ItemStack;
  10. import net.minecraft.util.Icon;
  11. import net.minecraft.util.MathHelper;
  12. import cpw.mods.fml.relauncher.Side;
  13. import cpw.mods.fml.relauncher.SideOnly;
  14.  
  15. public class ItemWoolPart extends Item {
  16.  
  17.  
  18. public ItemWoolPart(int id) { // Builds the Item and the Metadata, assigns them to a CreativeTab
  19. super(id); //!!!Line with the Error!!!
  20. this.setHasSubtypes(true);
  21. this.setCreativeTab(CreativeTabs.tabMaterials);
  22. }
  23.  
  24. @SideOnly(Side.CLIENT) //Array containing the Item Textures
  25. private Icon[] icons;
  26.  
  27. @SideOnly(Side.CLIENT)
  28. public void registerIcons(IconRegister par1IconRegister) // Assigns the Item Textures to each color of Wool Part
  29. {
  30. icons = new Icon[16];
  31.  
  32. for (int i = 0; i < icons.length; i++)
  33. {
  34. icons[i] = par1IconRegister.registerIcon(Unidye.modid + ":" + (this.getUnlocalizedName().substring(5)) + i);
  35. }
  36. }
  37. //Array containing the colored Wool Parts' name prefixes
  38. public static final String[] names = new String[] {"white", "orange", "magenta", "light blue", "yellow", "lime", "pink", "gray", "light gray", "cyan", "purple", "blue", "brown", "green", "red", "black"};
  39. //Assigns each color of Wool Part an unique UnlocalizedName
  40. public String getUnlocalizedName(ItemStack par1ItemStack)
  41. {
  42. int i = MathHelper.clamp_int(par1ItemStack.getItemDamage(), 0, 15);
  43. return super.getUnlocalizedName() + "." + names[i];
  44. }
  45.  
  46. //Assigns the Icon based on the 'Damage'/Metadata
  47. public Icon getIconFromDamage(int par1)
  48. {
  49. return icons[par1];
  50. }
  51. //Lists all of the various colors of Wool Part in the CreativeTabs
  52. @SideOnly(Side.CLIENT)
  53. public void getSubItems(int par1, CreativeTabs par2CreativeTabs, List par3List)
  54. {
  55. for (int x = 0; x < icons.length; x++)
  56. {
  57. par3List.add(new ItemStack(this, 1, x));
  58. }
  59. }
  60.  
  61. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement