Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package phnxflms.unidye;
- import java.util.List;
- import net.minecraft.block.Block;
- import net.minecraft.client.renderer.texture.IconRegister;
- import net.minecraft.creativetab.CreativeTabs;
- import net.minecraft.item.Item;
- import net.minecraft.item.ItemStack;
- import net.minecraft.util.Icon;
- import net.minecraft.util.MathHelper;
- import cpw.mods.fml.relauncher.Side;
- import cpw.mods.fml.relauncher.SideOnly;
- public class ItemWoolPart extends Item {
- public ItemWoolPart(int id) { // Builds the Item and the Metadata, assigns them to a CreativeTab
- super(id); //!!!Line with the Error!!!
- this.setHasSubtypes(true);
- this.setCreativeTab(CreativeTabs.tabMaterials);
- }
- @SideOnly(Side.CLIENT) //Array containing the Item Textures
- private Icon[] icons;
- @SideOnly(Side.CLIENT)
- public void registerIcons(IconRegister par1IconRegister) // Assigns the Item Textures to each color of Wool Part
- {
- icons = new Icon[16];
- for (int i = 0; i < icons.length; i++)
- {
- icons[i] = par1IconRegister.registerIcon(Unidye.modid + ":" + (this.getUnlocalizedName().substring(5)) + i);
- }
- }
- //Array containing the colored Wool Parts' name prefixes
- 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"};
- //Assigns each color of Wool Part an unique UnlocalizedName
- public String getUnlocalizedName(ItemStack par1ItemStack)
- {
- int i = MathHelper.clamp_int(par1ItemStack.getItemDamage(), 0, 15);
- return super.getUnlocalizedName() + "." + names[i];
- }
- //Assigns the Icon based on the 'Damage'/Metadata
- public Icon getIconFromDamage(int par1)
- {
- return icons[par1];
- }
- //Lists all of the various colors of Wool Part in the CreativeTabs
- @SideOnly(Side.CLIENT)
- public void getSubItems(int par1, CreativeTabs par2CreativeTabs, List par3List)
- {
- for (int x = 0; x < icons.length; x++)
- {
- par3List.add(new ItemStack(this, 1, x));
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement