Jump to content

Mod problems


Trooox

Recommended Posts

Hello guys ! I have some problems with my mod...

Can you tell how I can repair my armor, items and tools please...

 

That is my itemsMods.java

package fr.troox.nezylia.init;

import cpw.mods.fml.common.registry.GameRegistry;
import fr.troox.nezylia.Main;
import fr.troox.nezylia.Reference;
import fr.troox.nezylia.items.ItemArmors;
import fr.troox.nezylia.items.ItemDrink;
import fr.troox.nezylia.items.ItemFoodMod;
import fr.troox.nezylia.items.ItemsAxes;
import fr.troox.nezylia.items.ItemsHoes;
import fr.troox.nezylia.items.ItemsPickaxes;
import fr.troox.nezylia.items.ItemsShovels;
import fr.troox.nezylia.items.ItemsSwords;
import fr.troox.nezylia.tems.AmorsEnchant;
import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.item.Item;
import net.minecraft.item.Item.ToolMaterial;
import net.minecraft.item.ItemArmor.ArmorMaterial;
import net.minecraft.item.ItemStack;
import net.minecraftforge.client.event.sound.SoundEvent;
import net.minecraftforge.common.util.EnumHelper;
import net.minecraftforge.oredict.OreDictionary;

public class itemsMods extends Item
{
    
    public static Item gem_nezylium, epee_nezylium, pickaxe_nezylium,axe_nezylium, helmetArmornezy, chestPlateArmornezy, legginArmornezy, bootsArmornezy,shovel_nezylium,hoe_nezylium;
    public static Item stick_osmium, pickaxe_osmium, sword_osmium,axe_osmium, helmetArmorosmium, chestPlateArmorosmium, legginArmorosmium,bootsArmorosmium, shovel_osmium,hoe_osmium;
    public static Item gem_iridium, sword_iridium, pickaxe_iridium,axe_iridium, helmetArmoriri, chestPlateArmoriri, legginArmoriri, bootsArmoriri, shovel_iridium,hoe_iridium;
    public static Item specialHelmet;
    public static Item hamburger, sodat, sodat_empty,apple_frozen,nezypsy,nezycoca,nezyice,nezydka;
    //Material 
    
   /*
    HarvestLevel = niveau des Pioches pour dire que les blocs pourront être cassé par n'importe quel pioche si = 0
    maxUses = Maximum d'utilisations en cassant un bloc
    efficiency = Vitesse
    damage = épée = +4 ; Pioche = +2 ; Hache = +3 ; 
    */
    public static ToolMaterial nezylium = EnumHelper.addToolMaterial("nezylium", 3, 3000, 10, 5, 30);
    public static ToolMaterial osmium = EnumHelper.addToolMaterial("osmium", 3, 2500, 10, 4, 27);
    public static ToolMaterial iridium = EnumHelper.addToolMaterial("iridium", 3, 2000, 10, 3, 24);
    
    
    /*
    durabilité = 33 c'est le diamant donc aller ++
    Resistance = helmet, plastron, jambières, shoes.
    enchantements = 50
    */
    public static ArmorMaterial armornezylium = EnumHelper.addArmorMaterial("armornezylium", 53, new int[] {4, 10, 6, 3}, 10);
    public static ArmorMaterial armorplo = EnumHelper.addArmorMaterial("armorplo", 63, new int[] {3, 0, 0, 0}, 10);
    public static ArmorMaterial armorosmium = EnumHelper.addArmorMaterial("armorosmium", 43, new int[] {4, 10, 7, 4}, 10);
    public static ArmorMaterial armoriridium = EnumHelper.addArmorMaterial("armoriridium", 33, new int[] {3, 8, 6, 3}, 10);
            
    
    public static void init() // on initialise nos nouveaux items
    {    
        
     
        
     //Nourriture
     hamburger = new ItemFoodMod(10, 0.0F, false).setAlwaysEdible().setCreativeTab(CreativeTabs.tabFood).setTextureName(Reference.MOD_ID + ":hamburger").setUnlocalizedName("hamburger") ;
     sodat = new ItemDrink().setCreativeTab(CreativeTabs.tabFood).setTextureName(Reference.MOD_ID + ":nebubule").setUnlocalizedName("sodat");
     sodat_empty = new Item().setCreativeTab(CreativeTabs.tabFood).setTextureName(Reference.MOD_ID + ":sodat_empty").setUnlocalizedName("sodat_empty");
     nezypsy = new ItemDrink().setCreativeTab(CreativeTabs.tabFood).setTextureName(Reference.MOD_ID + ":nezypsy").setUnlocalizedName("nezypsy");
     nezycoca = new ItemDrink().setCreativeTab(CreativeTabs.tabFood).setTextureName(Reference.MOD_ID + ":nezycoca").setUnlocalizedName("nezycoca");
     nezyice = new ItemDrink().setCreativeTab(CreativeTabs.tabFood).setTextureName(Reference.MOD_ID + ":nezyice").setUnlocalizedName("nezyice");
     nezydka = new ItemDrink().setCreativeTab(CreativeTabs.tabFood).setTextureName(Reference.MOD_ID + ":nezydka").setUnlocalizedName("nezydka");
     
     
     apple_frozen = new ItemFoodMod(4, 0.0F, true).setAlwaysEdible().setCreativeTab(CreativeTabs.tabFood).setTextureName(Reference.MOD_ID + ":iceapple").setUnlocalizedName("apple_frozen");
     
     
     
     //Helmet spécial
     specialHelmet = new AmorsEnchant(armorplo, 0).setCreativeTab(Main.tabNezylia).setUnlocalizedName("specialHelmet").setTextureName(Reference.MOD_ID + ":nezycasque");
 
        
        
     //Les outils en nezylium
     epee_nezylium = new ItemsSwords(nezylium).setCreativeTab(Main.tabNezylia).setUnlocalizedName("epee_nezylium").setTextureName(Reference.MOD_ID + ":epee_nezylium");  // création de l'item
     pickaxe_nezylium = new ItemsPickaxes(nezylium).setCreativeTab(Main.tabNezylia).setUnlocalizedName("pickaxe_nezylium").setTextureName(Reference.MOD_ID + ":pickaxe_nezylium");
     axe_nezylium = new ItemsAxes(nezylium).setCreativeTab(Main.tabNezylia).setUnlocalizedName("axe_nezylium").setTextureName(Reference.MOD_ID + ":axe_nezylium");
     shovel_nezylium = new ItemsShovels(nezylium).setCreativeTab(Main.tabNezylia).setUnlocalizedName("shovel_nezylium").setTextureName(Reference.MOD_ID + ":pellenezylium");
     hoe_nezylium = new ItemsHoes(nezylium).setCreativeTab(Main.tabNezylia).setUnlocalizedName("hoe_nezylium").setTextureName(Reference.MOD_ID + ":hoenezylium");
     
     
     
     //Les outils en osmium
     sword_osmium = new ItemsSwords(osmium).setCreativeTab(Main.tabNezylia).setUnlocalizedName("sword_osmium").setTextureName(Reference.MOD_ID + ":modswordiri");  // création de l'item
     pickaxe_osmium = new ItemsPickaxes(osmium).setCreativeTab(Main.tabNezylia).setUnlocalizedName("pickaxe_osmium").setTextureName(Reference.MOD_ID + ":pickaxe_osmium");
     axe_osmium = new ItemsAxes(osmium).setCreativeTab(Main.tabNezylia).setUnlocalizedName("axe_osmium").setTextureName(Reference.MOD_ID + ":axe_osmium");
     shovel_osmium = new ItemsShovels(osmium).setCreativeTab(Main.tabNezylia).setUnlocalizedName("shovel_osmium").setTextureName(Reference.MOD_ID + ":pelleosmium");
     hoe_osmium = new ItemsHoes(osmium).setCreativeTab(Main.tabNezylia).setUnlocalizedName("hoe_osmium").setTextureName(Reference.MOD_ID + ":hoeosmium");
     
     
     
     //Les outils en iridium
     sword_iridium = new ItemsSwords(iridium).setCreativeTab(Main.tabNezylia).setUnlocalizedName("sword_iridium").setTextureName(Reference.MOD_ID + ":sword_iridium");  // création de l'item
     pickaxe_iridium = new ItemsPickaxes(iridium).setCreativeTab(Main.tabNezylia).setUnlocalizedName("pickaxe_iridium").setTextureName(Reference.MOD_ID + ":pickaxe_iridium");
     axe_iridium = new ItemsAxes(iridium).setCreativeTab(Main.tabNezylia).setUnlocalizedName("axe_iridium").setTextureName(Reference.MOD_ID + ":axe_iridium");
     shovel_iridium = new ItemsShovels(iridium).setCreativeTab(Main.tabNezylia).setUnlocalizedName("shovel_iridium").setTextureName(Reference.MOD_ID + ":pelleiridium");
     hoe_iridium = new ItemsHoes(nezylium).setCreativeTab(Main.tabNezylia).setUnlocalizedName("hoe_iridium").setTextureName(Reference.MOD_ID + ":hoeiridium");
     
     
     //Les ressources
     gem_nezylium = new Item().setCreativeTab(Main.tabNezylia).setUnlocalizedName("gem_nezylium").setTextureName(Reference.MOD_ID + ":gem_nezylium");
     stick_osmium = new Item().setCreativeTab(Main.tabNezylia).setUnlocalizedName("stick_osmium").setTextureName(Reference.MOD_ID + ":stick_osmium");
     gem_iridium = new Item().setCreativeTab(Main.tabNezylia).setUnlocalizedName("gem_iridium").setTextureName(Reference.MOD_ID+ ":gems_iridium");
     
     
     //L'armure en nezylium
     helmetArmornezy = new ItemArmors(armornezylium, 0).setCreativeTab(Main.tabNezylia).setUnlocalizedName("helmetArmornezy").setTextureName(Reference.MOD_ID + ":helmetnezy");
     chestPlateArmornezy = new ItemArmors(armornezylium,1).setCreativeTab(Main.tabNezylia).setUnlocalizedName("chestPlateArmornezy").setTextureName(Reference.MOD_ID + ":chestPlateArmornezy");
     legginArmornezy = new ItemArmors(armornezylium,2).setCreativeTab(Main.tabNezylia).setUnlocalizedName("legginArmornezy").setTextureName(Reference.MOD_ID + ":leggingnezy");
     bootsArmornezy = new ItemArmors(armornezylium,3).setCreativeTab(Main.tabNezylia).setUnlocalizedName("bootsArmornezy").setTextureName(Reference.MOD_ID + ":bootsnezy");
     
     
     //L'armure en Osmium
     helmetArmorosmium = new ItemArmors(armorosmium, 0).setCreativeTab(Main.tabNezylia).setUnlocalizedName("helmetArmorosmium").setTextureName(Reference.MOD_ID + ":helmetArmorosmi");
     chestPlateArmorosmium = new ItemArmors(armorosmium, 1).setCreativeTab(Main.tabNezylia).setUnlocalizedName("chestPlateArmorosmium").setTextureName(Reference.MOD_ID + ":chestPlateArmorosmi");
     legginArmorosmium = new ItemArmors(armorosmium, 2).setCreativeTab(Main.tabNezylia).setUnlocalizedName("legginArmorosmium").setTextureName(Reference.MOD_ID + ":legginArmorosmi");
     bootsArmorosmium = new ItemArmors(armorosmium, 3).setCreativeTab(Main.tabNezylia).setUnlocalizedName("bootsArmorosmium").setTextureName(Reference.MOD_ID + ":bootsosmi");
     
     
     //L'armure en iridium
     helmetArmoriri = new ItemArmors(armoriridium, 0).setCreativeTab(Main.tabNezylia).setUnlocalizedName("helmetArmoriri").setTextureName(Reference.MOD_ID + ":helmetArmoriri");
     chestPlateArmoriri = new ItemArmors(armoriridium, 1).setCreativeTab(Main.tabNezylia).setUnlocalizedName("chestPlateArmoriri").setTextureName(Reference.MOD_ID + ":chestPlateArmoriri");
     legginArmoriri = new ItemArmors(armoriridium, 2).setCreativeTab(Main.tabNezylia).setUnlocalizedName("legginArmoriri").setTextureName(Reference.MOD_ID + ":legginArmoriri");
     bootsArmoriri = new ItemArmors(armoriridium, 3).setCreativeTab(Main.tabNezylia).setUnlocalizedName("bootsArmoriri").setTextureName(Reference.MOD_ID + ":bootsArmoriri");
     
     
     
    }
    
    public static void register() //Enregistrement de l'item
    {
        
        //Food
        GameRegistry.registerItem(hamburger, "hamburger");  
        GameRegistry.registerItem(sodat, "sodat");
        GameRegistry.registerItem(nezypsy, "nezypsy");
        GameRegistry.registerItem(nezycoca, "nezycoca");
        GameRegistry.registerItem(nezyice, "nezyice");
        GameRegistry.registerItem(nezydka, "nezydka");
        GameRegistry.registerItem(sodat_empty, "sodat_empty");
        GameRegistry.registerItem(apple_frozen, "apple_frozen");
        
        
      //Spécial item
        GameRegistry.registerItem(specialHelmet, "specialHelmet");
      
      //Les outils en nezylium
        GameRegistry.registerItem(epee_nezylium, "epee_nezylia"); // L'item est en registé avec les infos donné
        GameRegistry.registerItem(pickaxe_nezylium, "pickaxe_nezylium");
        GameRegistry.registerItem(axe_nezylium, "axe_nezylium");
        GameRegistry.registerItem(shovel_nezylium, "shovel_nezylium");
        GameRegistry.registerItem(hoe_nezylium, "hoe_nezylium");
        
        
      //Les outils en osmium
        GameRegistry.registerItem(sword_osmium, "sword_osmium");
        GameRegistry.registerItem(pickaxe_osmium, "pickaxe_osmium");
        GameRegistry.registerItem(axe_osmium, "axe_osmium");
        GameRegistry.registerItem(shovel_osmium, "shovel_osmium");
        GameRegistry.registerItem(hoe_osmium, "hoe_osmium");
        
        
      //Les outils en iridium
        GameRegistry.registerItem(sword_iridium, "sword_iridium");
        GameRegistry.registerItem(pickaxe_iridium, "pickaxe_iridium");
        GameRegistry.registerItem(axe_iridium, "axe_iridium");
        GameRegistry.registerItem(shovel_iridium, "shovel_iridium");
        GameRegistry.registerItem(hoe_iridium, "hoe_iridium");
        
      //Les ressources
        GameRegistry.registerItem(gem_nezylium, "gem_nezylium");
        GameRegistry.registerItem(stick_osmium, "stick_osmium");
        GameRegistry.registerItem(gem_iridium, "gem_iridium");
        
      //L'armure en nezylium
        GameRegistry.registerItem(helmetArmornezy, "helmetArmornezy");
        GameRegistry.registerItem(chestPlateArmornezy, "chestPlateArmornezy");
        GameRegistry.registerItem(legginArmornezy, "legginArmornezy");
        GameRegistry.registerItem(bootsArmornezy, "bootsArmornezy");
        
      //L'armure en osmium
        GameRegistry.registerItem(helmetArmorosmium, "helmetArmorosmium");
        GameRegistry.registerItem(chestPlateArmorosmium, "chestPlateArmorosmium");
        GameRegistry.registerItem(legginArmorosmium, "legginArmorosmium");
        GameRegistry.registerItem(bootsArmorosmium, "bootsArmorosmium");
        
      //L'armure en iridium
        GameRegistry.registerItem(helmetArmoriri, "helmetArmoriri");
        GameRegistry.registerItem(chestPlateArmoriri, "chestPlateArmoriri");
        GameRegistry.registerItem(legginArmoriri, "legginArmoriri");
        GameRegistry.registerItem(bootsArmoriri, "bootsArmoriri");
        
        
    }
    
    @Override
    public boolean doesContainerItemLeaveCraftingGrid(ItemStack itemStack)
    {
    return false;
    }
    
    
    @Override
    public ItemStack getContainerItem(ItemStack itemstack) {
    return itemstack;
    }

    @Override
    public boolean hasContainerItem(ItemStack itemstack) {
        return true;
    }
    
}

 

 

The second question is, my armor have 600 durability so I didn't take damages but when my durability is 130 I lose life points but my armor is not destroyed.... I don't know why, help me plz

 

package fr.troox.nezylia.items;

import fr.troox.nezylia.Reference;
import fr.troox.nezylia.init.itemsMods;
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;

public class ItemArmors extends ItemArmor
{


    public ItemArmors(ArmorMaterial material, int metaData)
    {
        super(material, 0, metaData);//faire la différence chaque parties de l'armure
    }

    public String getArmorTexture(ItemStack stack, Entity entity, int slot, String type) 
    {
        if(stack.getItem() == itemsMods.legginArmornezy)
        {
            return Reference.MOD_ID + ":textures/models/armor/armorModnezy_layer_2.png";
        }
        
        else if (stack.getItem() == itemsMods.helmetArmornezy || stack.getItem() == itemsMods.chestPlateArmornezy || stack.getItem() == itemsMods.bootsArmornezy)
        {
            return Reference.MOD_ID + ":textures/models/armor/armorModnezy_layer_1.png";
        }
        
        
        
        
        if(stack.getItem() == itemsMods.legginArmorosmium)
        {
         
            return Reference.MOD_ID + ":textures/models/armor/armorModosmi_layer_2.png";
            
        }
        
        else if (stack.getItem() == itemsMods.helmetArmorosmium || stack.getItem() == itemsMods.chestPlateArmorosmium || stack.getItem() == itemsMods.bootsArmorosmium)
        {
            return Reference.MOD_ID + ":textures/models/armor/armorModosmi_layer_1.png";
        }
        
        
        
        if(stack.getItem() == itemsMods.legginArmoriri)
        {
            return Reference.MOD_ID + ":textures/models/armor/armorModiri_layer_2.png";
        }
        
        else if (stack.getItem() == itemsMods.helmetArmoriri || stack.getItem() == itemsMods.chestPlateArmoriri || stack.getItem() == itemsMods.bootsArmoriri)
        {
            return Reference.MOD_ID + ":textures/models/armor/armorModiri_layer_1.png";
        }
        
        if(stack.getItem() == itemsMods.specialHelmet)
        {
            
            return Reference.MOD_ID + ":textures/models/armor/specialHelmet_layer.png";
        }
            return null;
        
    }
    


}

 

 

Thank you in advance for your help !

Link to comment
Share on other sites

  • Guest locked this topic
Guest
This topic is now closed to further replies.


×
×
  • Create New...

Important Information

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