Jump to content

[UNSOLVED] ArmorItems have same texture and are not equipable.


Lumberstock

Recommended Posts

This is wierd.

 

So I created a new armor.

It's a Tinfoil hat, a tie, underpants and some socks.

Although they have their own texture, they appear like this ingame.

 

Only the Tinfoil hat is wearable.

 

Main class (Armorcode is marked Green):

 

package net.lumberstock.mod;

 

import net.lumberstock.mod.armor.MagicArmor;

import net.lumberstock.mod.armor.MiscArmor;

import net.lumberstock.mod.blocks.BluestoneBlock;

import net.lumberstock.mod.blocks.BluestoneOre;

import net.lumberstock.mod.blocks.CasseriteOre;

import net.lumberstock.mod.blocks.Crate;

import net.lumberstock.mod.blocks.MagicBush;

import net.lumberstock.mod.blocks.Mud;

import net.lumberstock.mod.blocks.PaloozaBlock;

import net.lumberstock.mod.blocks.PaloozaOre;

import net.lumberstock.mod.blocks.Piss;

import net.lumberstock.mod.blocks.TinBlock;

import net.lumberstock.mod.handlers.BucketHandler;

import net.lumberstock.mod.items.BucketMud;

import net.lumberstock.mod.items.BucketPiss;

import net.lumberstock.mod.items.NCItems;

import net.lumberstock.mod.worldgen.LumberstockWorldGen;

import net.minecraft.block.material.Material;

import net.minecraft.creativetab.CreativeTabs;

import net.minecraft.init.Blocks;

import net.minecraft.init.Items;

import net.minecraft.item.Item;

import net.minecraft.item.ItemArmor.ArmorMaterial;

import net.minecraft.item.ItemFood;

import net.minecraft.item.ItemStack;

import net.minecraftforge.common.MinecraftForge;

import net.minecraftforge.common.util.EnumHelper;

import net.minecraftforge.fluids.Fluid;

import net.minecraftforge.fluids.FluidContainerRegistry;

import net.minecraftforge.fluids.FluidRegistry;

import cpw.mods.fml.common.Mod;

import cpw.mods.fml.common.Mod.EventHandler;

import cpw.mods.fml.common.event.FMLInitializationEvent;

import cpw.mods.fml.common.event.FMLPostInitializationEvent;

import cpw.mods.fml.common.event.FMLPreInitializationEvent;

import cpw.mods.fml.common.registry.GameRegistry;

import cpw.mods.fml.relauncher.Side;

import cpw.mods.fml.relauncher.SideOnly;

 

@Mod(modid = Lumberstock.modid, version = Lumberstock.version, name = Lumberstock.name)

public class Lumberstock {

 

 

//Modinformation

public static final String modid = "lumberstock";

public static final String version = "Alpha v0.8";

    public static final String name = "Lumberstock's Wonderful Book of Horrors";

 

    LumberstockWorldGen eventWorldGen = new LumberstockWorldGen();

    public static ArmorMaterial MagicArmorMaterial = EnumHelper.addArmorMaterial("MagicArmorMaterial", 6, new int[] {1, 4, 3, 2}, 10);

    public static ArmorMaterial MiscArmorMaterial = EnumHelper.addArmorMaterial("MiscArmorMaterial", 8, new int[] {2, 6, 4, 2}, 4);

   

    //Items

    public static Item itemMagicLeaf;

    public static Item itemBattery;

    public static Item itemBucketMud;

    public static Item itemBucketPiss;

    public static Item itemTinIngot;

    public static Item itemTinfoil;

    public static Item itemPaloozaGem;

    public static Item itemBluestoneGem;

    public static Item itemPaperclip;

    public static Item itemClippy;

   

    //Food

 

    public static Item foodDonut;

    public static Item foodNiceDonut;

    public static Item foodChocDonut; 

    public static Item foodLemon;

    public static Item foodLime;

    public static Item foodIceCubes;

   

    //Blocks

    public static net.minecraft.block.Block blockMagicBush;

    public static net.minecraft.block.Block blockCrate;

    public static net.minecraft.block.Block blockMud;

    public static net.minecraft.block.Block blockPiss;

    public static net.minecraft.block.Block oreCasseriteOre;

    public static net.minecraft.block.Block blockTinBlock;

    public static net.minecraft.block.Block orePaloozaOre;

    public static net.minecraft.block.Block blockPaloozaBlock;

    public static net.minecraft.block.Block oreBluestoneOre;

    public static net.minecraft.block.Block blockBluestoneBlock;

 

    //Fluids

    public static Fluid fluidMud;

    public static Fluid fluidPiss;

 

   

    //Creative Tab

    public static CreativeTabs lumberstockTab; 

 

    //Armor

    public static int armorMagicHelmID;

    public static int armorMagicChestID;

    public static int armorMagicLegsID;

    public static int armorMagicBootsID;

   

    public static Item armorMagicHelm;

    public static Item armorMagicChest;

    public static Item armorMagicLegs;

    public static Item armorMagicBoots;

   

    public static int armorTinfoilHelmID;

    public static int armorTieID;

    public static int armorUnderpantsID;

    public static int armorSocksID;

   

    public static Item armorTinfoilHelm;

    public static Item armorTie;

    public static Item armorUnderpants;

    public static Item armorSocks;

   

    @EventHandler

    public void PreInit(FMLPreInitializationEvent preEvent){

 

   

    //Creative tab

    lumberstockTab = new CreativeTabs("lumberstock"){

    @SideOnly(Side.CLIENT)

    public Item getTabIconItem() {

    return Item.getItemFromBlock(Lumberstock.blockCrate);

 

    }

    };

   

   

    //Items

    itemMagicLeaf = new NCItems().setUnlocalizedName("MagicLeaf");

        GameRegistry.registerItem(itemMagicLeaf, "MagicLeaf");

       

        itemBattery = new NCItems().setUnlocalizedName("Battery");

        GameRegistry.registerItem(itemBattery, "Battery");

       

        itemTinIngot = new NCItems().setUnlocalizedName("TinIngot");

        GameRegistry.registerItem(itemTinIngot, "TinIngot");

       

        itemTinfoil = new NCItems().setUnlocalizedName("Tinfoil");

        GameRegistry.registerItem(itemTinfoil, "Tinfoil");

       

        itemPaloozaGem = new NCItems().setUnlocalizedName("PaloozaGem");

        GameRegistry.registerItem(itemPaloozaGem, "PaloozaGem");

       

        itemBluestoneGem = new NCItems().setUnlocalizedName("BluestoneGem");

        GameRegistry.registerItem(itemBluestoneGem, "BluestoneGem");

       

        itemPaperclip = new NCItems().setUnlocalizedName("Paperclip");

        GameRegistry.registerItem(itemPaperclip, "Paperclip");

       

        itemClippy = new NCItems().setUnlocalizedName("Clippy");

        GameRegistry.registerItem(itemClippy, "Clippy");

       

        //Armor

        armorMagicHelm = new MagicArmor(MagicArmorMaterial, armorMagicHelmID, 0).setUnlocalizedName("MagicHelm");

        armorMagicChest = new MagicArmor(MagicArmorMaterial, armorMagicChestID, 1).setUnlocalizedName("MagicChest");

        armorMagicLegs = new MagicArmor(MagicArmorMaterial, armorMagicLegsID, 2).setUnlocalizedName("MagicLegs");

        armorMagicBoots = new MagicArmor(MagicArmorMaterial, armorMagicBootsID, 3).setUnlocalizedName("MagicBoots");

       

        GameRegistry.registerItem(armorMagicHelm, "MagicHelm");

        GameRegistry.registerItem(armorMagicChest, "MagicChest");

        GameRegistry.registerItem(armorMagicLegs, "MagicLegs");

        GameRegistry.registerItem(armorMagicBoots, "MagicBoots");

       

        armorTinfoilHelm = new MiscArmor(MiscArmorMaterial, armorTinfoilHelmID, 0).setUnlocalizedName("TinfoilHelm");

        armorTie = new MiscArmor(MiscArmorMaterial, armorTieID, 0).setUnlocalizedName("Tie");

        armorUnderpants = new MiscArmor(MiscArmorMaterial, armorUnderpantsID, 0).setUnlocalizedName("Underpants");

        armorSocks = new MiscArmor(MiscArmorMaterial, armorSocksID, 0).setUnlocalizedName("Socks");

       

        GameRegistry.registerItem(armorTinfoilHelm, "TinfoilHelm");

        GameRegistry.registerItem(armorTie, "Tie");

        GameRegistry.registerItem(armorUnderpants, "Underpants");

        GameRegistry.registerItem(armorSocks, "Socks");

       

        //Blocks

        blockMagicBush = new MagicBush(Material.grass).setBlockName("MagicBush");

        GameRegistry.registerBlock(blockMagicBush, "MagicBush");

       

        blockCrate = new Crate(Material.wood).setBlockName("Crate");

        GameRegistry.registerBlock(blockCrate, "Crate");

       

        oreCasseriteOre = new CasseriteOre(Material.rock).setBlockName("CasseriteOre");

        GameRegistry.registerBlock(oreCasseriteOre, "CasseriteOre");

     

        blockTinBlock = new TinBlock(Material.iron).setBlockName("TinBlock");

        GameRegistry.registerBlock(blockTinBlock, "TinBlock");

       

        orePaloozaOre = new PaloozaOre(Material.rock).setBlockName("PaloozaOre");

        GameRegistry.registerBlock(orePaloozaOre, "PaloozaOre");

       

        blockPaloozaBlock = new PaloozaBlock(Material.iron).setBlockName("PaloozaBlock");

        GameRegistry.registerBlock(blockPaloozaBlock, "PaloozaBlock");

       

        oreBluestoneOre = new BluestoneOre(Material.rock).setBlockName("BluestoneOre");

        GameRegistry.registerBlock(oreBluestoneOre, "BluestoneOre");

       

        blockBluestoneBlock = new BluestoneBlock(Material.rock).setBlockName("BluestoneBlock");

        GameRegistry.registerBlock(blockBluestoneBlock, "BluestoneBlock");

       

        //Foods

        foodDonut = new ItemFood(4, 0.6F, true).setUnlocalizedName("Donut").setCreativeTab(lumberstockTab).setTextureName(Lumberstock.modid + ":Donut");

        GameRegistry.registerItem(foodDonut, "Donut");

       

        foodNiceDonut = new ItemFood(8, 0.7F, false).setUnlocalizedName("NiceDonut").setCreativeTab(lumberstockTab).setTextureName(Lumberstock.modid + ":NiceDonut");

        GameRegistry.registerItem(foodNiceDonut, "NiceDonut"); 

   

        foodChocDonut = new ItemFood(6, 0.6F, false).setUnlocalizedName("ChocDonut").setCreativeTab(lumberstockTab).setTextureName(Lumberstock.modid + ":ChocDonut");

        GameRegistry.registerItem(foodChocDonut, "ChocDonut");

 

        foodLemon = new ItemFood(2, 0.1F, false).setUnlocalizedName("Lemon").setCreativeTab(lumberstockTab).setTextureName(Lumberstock.modid + ":Lemon");

        GameRegistry.registerItem(foodLemon, "Lemon");

       

        foodLime = new ItemFood(3, 0.3F, false).setUnlocalizedName("Lime").setCreativeTab(lumberstockTab).setTextureName(Lumberstock.modid + ":Lime");

        GameRegistry.registerItem(foodLime, "Lime");

       

        foodIceCubes = new ItemFood(1, 0.1F, false).setUnlocalizedName("IceCubes").setCreativeTab(lumberstockTab).setTextureName(Lumberstock.modid + ":IceCubes");

        GameRegistry.registerItem(foodIceCubes, "IceCubes");

       

      //Fluids

    Fluid fluidMud = new Fluid("Mud");

    FluidRegistry.registerFluid(fluidMud);

    blockMud = new Mud(fluidMud, Material.water).setBlockName("Mud");

    GameRegistry.registerBlock(blockMud, Lumberstock.modid + "_" + blockMud.getUnlocalizedName().substring(5));

    fluidMud.setUnlocalizedName(blockMud.getUnlocalizedName());

    fluidMud.setViscosity(3000).setDensity(1200).setTemperature(300);

 

    itemBucketMud = new BucketMud(blockMud);

    itemBucketMud.setUnlocalizedName("BucketOfMud").setTextureName(Lumberstock.modid + ":BucketOfMud");

    GameRegistry.registerItem(itemBucketMud, "BucketOfMud");

    FluidContainerRegistry.registerFluidContainer(fluidMud, new ItemStack(itemBucketMud), new ItemStack(Items.bucket));

    BucketHandler.INSTANCE.buckets.put(blockMud, itemBucketMud);

    MinecraftForge.EVENT_BUS.register(BucketHandler.INSTANCE);

   

    Fluid fluidPiss = new Fluid("Piss");

    FluidRegistry.registerFluid(fluidPiss);

    blockPiss = new Piss(fluidPiss, Material.water).setBlockName("Piss");

    GameRegistry.registerBlock(blockPiss, Lumberstock.modid + "_" + blockPiss.getUnlocalizedName().substring(5));

    fluidPiss.setUnlocalizedName(blockPiss.getUnlocalizedName());

    fluidPiss.setViscosity(200).setDensity(200).setTemperature(400);

 

    itemBucketPiss = new BucketPiss(blockPiss);

    itemBucketPiss.setUnlocalizedName("BucketOfPiss").setTextureName(Lumberstock.modid + ":BucketOfPiss");

    GameRegistry.registerItem(itemBucketPiss, "BucketOfPiss");

    FluidContainerRegistry.registerFluidContainer(fluidPiss, new ItemStack(itemBucketPiss), new ItemStack(Items.bucket));

    BucketHandler.INSTANCE.buckets.put(blockPiss, itemBucketPiss);

    MinecraftForge.EVENT_BUS.register(BucketHandler.INSTANCE);

    }

   

@EventHandler

    public void Init(FMLInitializationEvent event){

 

 

//Smelting

GameRegistry.addSmelting(oreCasseriteOre, new ItemStack(itemTinIngot), 5);

 

//Crafting

    GameRegistry.addRecipe(new ItemStack(armorMagicHelm), new Object[]{"CCC", "C C", "  ",'C', itemMagicLeaf});

    GameRegistry.addRecipe(new ItemStack(armorMagicHelm), new Object[]{"  ", "CCC", "C C",'C', itemMagicLeaf});

   

    GameRegistry.addRecipe(new ItemStack(armorMagicChest), new Object[]{"C C", "CCC", "CCC",'C', itemMagicLeaf});

   

    GameRegistry.addRecipe(new ItemStack(armorMagicLegs), new Object[]{"CCC", "C C", "C C",'C', itemMagicLeaf});

   

    GameRegistry.addRecipe(new ItemStack(armorMagicBoots), new Object[]{"  ", "C C", "C C",'C', itemMagicLeaf});

    GameRegistry.addRecipe(new ItemStack(armorMagicBoots), new Object[]{"C C", "C C", "  ",'C', itemMagicLeaf});

 

   

    GameRegistry.addRecipe(new ItemStack(blockTinBlock), new Object[]{"CCC", "CCC", "CCC", 'C', itemTinIngot});

 

GameRegistry.addRecipe(new ItemStack(foodDonut), new Object[]{"AAA", "A A", "AAA", 'A', Items.wheat});

 

GameRegistry.addRecipe(new ItemStack(itemPaperclip), new Object[]{"AA ", "A A", "AA ", 'A', itemTinIngot});

 

GameRegistry.addRecipe(new ItemStack(itemTinfoil, 3), new Object[]{"AAA", "  ", "  ", 'A', itemTinIngot});

GameRegistry.addRecipe(new ItemStack(itemTinfoil, 3), new Object[]{"  ", "  ", "AAA", 'A', itemTinIngot});

GameRegistry.addRecipe(new ItemStack(itemTinfoil, 3), new Object[]{"  ", "AAA", "  ", 'A', itemTinIngot});

 

//Schapeless Crafting

    GameRegistry.addShapelessRecipe(new ItemStack(foodNiceDonut), new Object[]

    {

        new ItemStack(Items.dye, 1, 9), new ItemStack(Items.dye, 1, 12), new ItemStack(Items.dye, 1, 11), new ItemStack(Items.dye, 1, 1), new ItemStack(Items.dye, 1, 10), foodDonut, Items.sugar

    });

   

    GameRegistry.addShapelessRecipe(new ItemStack(foodIceCubes, 4), new Object[]

    {

        new ItemStack(Blocks.ice)

    });

   

    GameRegistry.addShapelessRecipe(new ItemStack(foodChocDonut), new Object[]

    {

        new ItemStack(Items.dye, 1, 3), foodDonut

    });

    }

 

    @EventHandler

    public void PostInit(FMLPostInitializationEvent postEvent){

   

    }

}

 

 

 

Armorclass:

 

package net.lumberstock.mod.armor;

 

import net.lumberstock.mod.Lumberstock;

import net.minecraft.entity.Entity;

import net.minecraft.entity.player.EntityPlayer;

import net.minecraft.item.ItemArmor;

import net.minecraft.item.ItemStack;

import net.minecraft.potion.Potion;

import net.minecraft.potion.PotionEffect;

import net.minecraft.world.World;

 

public class MiscArmor extends ItemArmor {

 

        public MiscArmor(ArmorMaterial material, int id,

                        int slot) {

                super(material, id, slot);

                this.setCreativeTab(Lumberstock.lumberstockTab);

                this.isRepairable();

             

                if(slot == 0){

                this.setTextureName(Lumberstock.modid + ":TinfoilHelm");

             

                }else if (slot == 1){

                        this.setTextureName(Lumberstock.modid + ":Tie"); 

                }else if(slot == 2){

                        this.setTextureName(Lumberstock.modid + ":Underpants");

                }else if(slot == 3){

                        this.setTextureName(Lumberstock.modid + ":Socks");

                     

                }

        }

        public String getArmorTexture(ItemStack itemstack, Entity entity, int slot, String type) {

                if (itemstack.getItem() == Lumberstock.armorTinfoilHelm || itemstack.getItem() == Lumberstock.armorTie || itemstack.getItem() == Lumberstock.armorSocks){

                return Lumberstock.modid + ":textures/model/armor/misc_layer_1.png";

                }else if (itemstack.getItem() == Lumberstock.armorSocks) {

                return Lumberstock.modid + ":textures/model/armor/misc_layer_2.png";

                }else{

                return null;

                }

}

}

 

 

 

Help would be really nice.

This is this.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Announcements



×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.