• S'inscrire
    • Se connecter
    • Recherche
    • Récent
    • Mots-clés
    • Populaire
    • Utilisateurs
    • Groupes

    Résolu Problème création d'armure

    1.8.x
    1.8.9
    2
    4
    905
    Charger plus de messages
    • Du plus ancien au plus récent
    • Du plus récent au plus ancien
    • Les plus votés
    Répondre
    • Répondre à l'aide d'un nouveau sujet
    Se connecter pour répondre
    Ce sujet a été supprimé. Seuls les utilisateurs avec les droits d'administration peuvent le voir.
    • VoraX
      VoraX dernière édition par

      [font=Ubuntu, sans-serifJe suis sur Eclipse avec forge-1.8.9-11.15.1.1722-mdk .]

      [font=Ubuntu, sans-serifJ’ai suivi ce tutoriel: https://www.minecraftforgefrance.fr/showthread.php?tid=674 -  ][font=Ubuntu, sans-serifhttps://www.youtube.com/watch?v=tzM3TkbpdVs]

      Suite à mes autres problèmes résolus, je crée donc mon armure en cuivre.
      Seulement, le jeu ne se lance pas, faute d’erreurs.

      Classe principale:

      package fr.vorax.egypte.common;
      
      import fr.vorax.egypte.proxy.CommonProxy;
      import net.minecraft.block.Block;
      import net.minecraft.block.material.Material;
      import net.minecraft.client.Minecraft;
      import net.minecraft.client.resources.model.ModelResourceLocation;
      import net.minecraft.creativetab.CreativeTabs;
      import net.minecraft.item.Item;
      import net.minecraft.item.ItemArmor.ArmorMaterial;
      import net.minecraftforge.common.util.EnumHelper;
      import net.minecraftforge.fml.common.Mod;
      import net.minecraftforge.fml.common.Mod.EventHandler;
      import net.minecraftforge.fml.common.Mod.Instance;
      import net.minecraftforge.fml.common.SidedProxy;
      import net.minecraftforge.fml.common.event.FMLInitializationEvent;
      import net.minecraftforge.fml.common.event.FMLPostInitializationEvent;
      import net.minecraftforge.fml.common.event.FMLPreInitializationEvent;
      import net.minecraftforge.fml.common.registry.GameRegistry;
      
      @Mod(modid = "modegypte", name = "Mod Egypte", version = "1.0.0")
      
      public class ModEgypte
      {
          @Instance("modegypte")
          public static ModEgypte instance;
      
          @SidedProxy(clientSide = "fr.vorax.egypte.proxy.ClientProxy", serverSide = "fr.vorax.egypte.proxy.CommonProxy")
         public static CommonProxy proxy;
      
          public static Item cuivreLingot, helmetCopper, chestPlateCopper, leggingsCopper, bootsCopper;
          public static Block cuivreBloc, limonBloc, limonMouilleBloc, briqueCrueBloc;
      
          public static ArmorMaterial copperArmor = EnumHelper.addArmorMaterial("copperArmor", 10, new int[]{2, 6, 5, 2}, 20);
      
          @EventHandler
          public void preInit(FMLPreInitializationEvent event)
          {
              //ITEMS
              cuivreLingot = new CuivreLingot().setUnlocalizedName("cuivreLingot").setCreativeTab(CreativeTabs.tabMaterials);
              helmetCopper = new CopperArmor(copperArmor, 0).setUnlocalizedName("helmetCopper");
              chestPlateCopper = new CopperArmor(copperArmor, 1).setUnlocalizedName("chestPlateCopper");
              leggingsCopper = new CopperArmor(copperArmor, 2).setUnlocalizedName("leggingsCopper");
              bootsCopper = new CopperArmor(copperArmor, 3).setUnlocalizedName("bootsCopper");
      
              //ItemsRegistry
              GameRegistry.registerItem(cuivreLingot, "cuivre_Lingot");
              GameRegistry.registerItem(helmetCopper, helmet_copper);
              GameRegistry.registerItem(chestPlateCopper, chestplate_copper);
              GameRegistry.registerItem(leggingsCopper, leggings_copper);
              GameRegistry.registerItem(bootsCopper, boots_copper);
      
              //BLOCS
              cuivreBloc = new CuivreBloc(Material.iron).setUnlocalizedName("cuivrebloc").setCreativeTab(CreativeTabs.tabBlock);
              limonBloc = new LimonBloc(Material.ground).setUnlocalizedName("limonbloc").setCreativeTab(CreativeTabs.tabBlock);
              limonMouilleBloc = new LimonMouilleBloc(Material.ground).setUnlocalizedName("limonmouillebloc").setCreativeTab(CreativeTabs.tabBlock);
              briqueCrueBloc = new BriqueCrueBloc(Material.ground).setUnlocalizedName("briquecruebloc").setCreativeTab(CreativeTabs.tabBlock);
              //BlocsRegistry
              GameRegistry.registerBlock(cuivreBloc, "cuivre_bloc");
              GameRegistry.registerBlock(limonBloc, "limon_bloc");
              GameRegistry.registerBlock(limonMouilleBloc, "limon_mouille_bloc");
              GameRegistry.registerBlock(briqueCrueBloc, "brique_crue_bloc");
          }
      
          @EventHandler
          public void Init(FMLInitializationEvent event)
          {
              proxy.registerRender();
      
              if(event.getSide().isClient())
                      {
                          //Items Enregistrés
                          Minecraft.getMinecraft().getRenderItem().getItemModelMesher().register(cuivreLingot, 0, new ModelResourceLocation("modegypte:cuivre_Lingot", "inventory"));
                          //Blocs Enregistrés en Items
                          Minecraft.getMinecraft().getRenderItem().getItemModelMesher().register(Item.getItemFromBlock(cuivreBloc), 0, new ModelResourceLocation("modegypte:cuivre_bloc", "inventory"));
                          Minecraft.getMinecraft().getRenderItem().getItemModelMesher().register(Item.getItemFromBlock(limonBloc), 0, new ModelResourceLocation("modegypte:limon_bloc", "inventory"));
                          Minecraft.getMinecraft().getRenderItem().getItemModelMesher().register(Item.getItemFromBlock(limonMouilleBloc), 0, new ModelResourceLocation("modegypte:limon_mouille_bloc", "inventory"));
                          Minecraft.getMinecraft().getRenderItem().getItemModelMesher().register(Item.getItemFromBlock(briqueCrueBloc), 0, new ModelResourceLocation("modegypte:brique_crue_bloc", "inventory"));
                      }
          }
      
          @EventHandler
          public void postInit(FMLPostInitializationEvent event)
          {
      
          }
      }
      

      La classe de mon armure ‘CopperArmor.java’ :

      package fr.vorax.egypte.common;
      
      import net.minecraft.item.ItemArmor;
      
      public class CopperArmor extends ItemArmor
      {
          public CopperArmor(ArmorMaterial material, int armorType)
          {
              super(material, 0, armorType);
          }
      
      }
      
      

      Log: http://www.cjoint.com/c/FEksyigXUFk

      Les erreurs sont les suivantes dans la classe principale:

      public static ArmorMaterial copperArmor = EnumHelper.addArmorMaterial(“copperArmor”, 10, new int[{2, 6, 5, 2}, 20);]

       //ItemsRegistry
              GameRegistry.registerItem(cuivreLingot, “cuivre_Lingot”);
              GameRegistry.registerItem(helmetCopper, helmet_copper);
              GameRegistry.registerItem(chestPlateCopper, chestplate_copper);
              GameRegistry.registerItem(leggingsCopper, leggings_copper);
              GameRegistry.registerItem(bootsCopper, boots_copper);

      Je tiens à dire que je suis dur de compréhension mais force est de s’apercevoir qu’une fois qu’on m’explique tout, je retiens bien (cf mes nouveaux blocs).
      J’espère que vous pourrez y faire quelque chose, merci d’avance.

      Je suis la terreur un quart née!
      #Diablo #HOTS

      1 réponse Dernière réponse Répondre Citer 0
      • Superloup10
        Superloup10 Modérateurs dernière édition par

        GameRegistry.registerItem(cuivreLingot, "cuivre_Lingot");
               GameRegistry.registerItem(helmetCopper, helmet_copper);
               GameRegistry.registerItem(chestPlateCopper, chestplate_copper);
               GameRegistry.registerItem(leggingsCopper, leggings_copper);
               GameRegistry.registerItem(bootsCopper, boots_copper);
        

        Compare la première ligne avec les autres.

        public static ArmorMaterial copperArmor = EnumHelper.addArmorMaterial("copperArmor", 10, new int[]{2, 6, 5, 2}, 20);
        

        Il te manque un argument de type String.
        Exemple:

        public static ArmorMaterial silverArmor = EnumHelper.addArmorMaterial("SilverArmor", "silver_armor", 35, new int[] {4, 9, 7, 4}, 15);
        

        Si vous souhaitez me faire un don, il vous suffit de cliquer sur le bouton situé en dessous.

        Je suis un membre apprécié et joueur, j'ai déjà obtenu 17 points de réputation.

        1 réponse Dernière réponse Répondre Citer 0
        • VoraX
          VoraX dernière édition par

          Merci, les items sont donc en jeu avec chacun une texture, mais il est à noter que l’armure n’a pas un skin décoloré comme dans la vidéo que je suis, mais elle est noire et violette sur ses 4 parties une fois portées.
          Il est normal qu’il n’y ai pas de texture, car je ne connais pas le code qui est spécifique à ces textures, ni où il faut l’insérer en 1.8.

          Classe principale:

          %(#333333)[```java
          ]
          package fr.vorax.egypte.common;

          import fr.vorax.egypte.proxy.CommonProxy;
          import net.minecraft.block.Block;
          import net.minecraft.block.material.Material;
          import net.minecraft.client.Minecraft;
          import net.minecraft.client.resources.model.ModelResourceLocation;
          import net.minecraft.creativetab.CreativeTabs;
          import net.minecraft.item.Item;
          import net.minecraft.item.Item.ToolMaterial;
          import net.minecraft.item.ItemArmor.ArmorMaterial;
          import net.minecraftforge.common.util.EnumHelper;
          import net.minecraftforge.fml.common.Mod;
          import net.minecraftforge.fml.common.Mod.EventHandler;
          import net.minecraftforge.fml.common.Mod.Instance;
          import net.minecraftforge.fml.common.SidedProxy;
          import net.minecraftforge.fml.common.event.FMLInitializationEvent;
          import net.minecraftforge.fml.common.event.FMLPostInitializationEvent;
          import net.minecraftforge.fml.common.event.FMLPreInitializationEvent;
          import net.minecraftforge.fml.common.registry.GameRegistry;

          @Mod(modid = “modegypte”, name = “Mod Egypte”, version = “1.0.0”)

          public class ModEgypte
          {
              @Instance(“modegypte”)
              public static ModEgypte instance;

          @SidedProxy(clientSide = “fr.vorax.egypte.proxy.ClientProxy”, serverSide = “fr.vorax.egypte.proxy.CommonProxy”)
             public static CommonProxy proxy;

          public static Item cuivreLingot, copperHelmet, copperChestPlate, copperLeggings, copperBoots, copperSword, copperAxe, copperPickaxe, copperShovel, copperHoe;
              public static Block cuivreBloc, limonBloc, limonMouilleBloc, briqueCrueBloc;

          public static ArmorMaterial armorCopper = EnumHelper.addArmorMaterial(“armorCopper”, “armorCopper”, 10, new int[]{2, 6, 5, 2}, 20);
              public static ToolMaterial toolCopper = EnumHelper.addToolMaterial(“toolCopper”, 2, 200, 5.0F, 2.0F, 17);

          @EventHandler
              public void preInit(FMLPreInitializationEvent event)
              {
                  //ITEMS
                  cuivreLingot = new CuivreLingot().setUnlocalizedName(“cuivreLingot”).setCreativeTab(CreativeTabs.tabMaterials);
                  copperHelmet = new ArmorCopper(armorCopper, 0).setUnlocalizedName(“copperHelmet”);
                  copperChestPlate = new ArmorCopper(armorCopper, 1).setUnlocalizedName(“copperChestPlate”);
                  copperLeggings = new ArmorCopper(armorCopper, 2).setUnlocalizedName(“copperLeggings”);
                  copperBoots = new ArmorCopper(armorCopper, 3).setUnlocalizedName(“copperBoots”);

          copperSword = new SwordCopper(toolCopper).setUnlocalizedName(“copperSword”);
                  copperAxe = new AxeCopper(toolCopper).setUnlocalizedName(“copperAxe”);
                  copperPickaxe = new PickaxeCopper(toolCopper).setUnlocalizedName(“copperPickaxe”);
                  copperShovel = new ShovelCopper(toolCopper).setUnlocalizedName(“copperShovel”);
                  copperHoe = new HoeCopper(toolCopper).setUnlocalizedName(“copperHoe”);

          //ItemsRegistry
                  GameRegistry.registerItem(cuivreLingot, “cuivre_Lingot”);
                  GameRegistry.registerItem(copperHelmet, “copper_Helmet”);
                  GameRegistry.registerItem(copperChestPlate, “copper_ChestPlate”);
                  GameRegistry.registerItem(copperLeggings, “copper_Leggings”);
                  GameRegistry.registerItem(copperBoots, “copper_Boots”);

          GameRegistry.registerItem(copperSword, “copper_Sword”);
                  GameRegistry.registerItem(copperAxe, “copper_Axe”);
                  GameRegistry.registerItem(copperPickaxe, “copper_Pickaxe”);
                  GameRegistry.registerItem(copperShovel, “copper_Shovel”);
                  GameRegistry.registerItem(copperHoe, “copper_Hoe”);

          //BLOCS
                  cuivreBloc = new CuivreBloc(Material.iron).setUnlocalizedName(“cuivrebloc”).setCreativeTab(CreativeTabs.tabBlock);
                  limonBloc = new LimonBloc(Material.ground).setUnlocalizedName(“limonbloc”).setCreativeTab(CreativeTabs.tabBlock);
                  limonMouilleBloc = new LimonMouilleBloc(Material.ground).setUnlocalizedName(“limonmouillebloc”).setCreativeTab(CreativeTabs.tabBlock);
                  briqueCrueBloc = new BriqueCrueBloc(Material.ground).setUnlocalizedName(“briquecruebloc”).setCreativeTab(CreativeTabs.tabBlock);
                  //BlocsRegistry
                  GameRegistry.registerBlock(cuivreBloc, “cuivre_bloc”);
                  GameRegistry.registerBlock(limonBloc, “limon_bloc”);
                  GameRegistry.registerBlock(limonMouilleBloc, “limon_mouille_bloc”);
                  GameRegistry.registerBlock(briqueCrueBloc, “brique_crue_bloc”);
              }

          @EventHandler
              public void Init(FMLInitializationEvent event)
              {
                  proxy.registerRender();

          if(event.getSide().isClient())
                          {
                         //Textures
                              //Items Enregistrés
                              Minecraft.getMinecraft().getRenderItem().getItemModelMesher().register(cuivreLingot, 0, new ModelResourceLocation(“modegypte:cuivre_Lingot”, “inventory”));
                              Minecraft.getMinecraft().getRenderItem().getItemModelMesher().register(copperHelmet, 0, new ModelResourceLocation(“modegypte:copper_Helmet”, “inventory”));
                              Minecraft.getMinecraft().getRenderItem().getItemModelMesher().register(copperChestPlate, 0, new ModelResourceLocation(“modegypte:copper_ChestPlate”, “inventory”));
                              Minecraft.getMinecraft().getRenderItem().getItemModelMesher().register(copperLeggings, 0, new ModelResourceLocation(“modegypte:copper_Leggings”, “inventory”));
                              Minecraft.getMinecraft().getRenderItem().getItemModelMesher().register(copperBoots, 0, new ModelResourceLocation(“modegypte:copper_Boots”, “inventory”));

          Minecraft.getMinecraft().getRenderItem().getItemModelMesher().register(copperSword, 0, new ModelResourceLocation(“modegypte:copper_Sword”, “inventory”));
                              Minecraft.getMinecraft().getRenderItem().getItemModelMesher().register(copperAxe, 0, new ModelResourceLocation(“modegypte:copper_Axe”, “inventory”));
                              Minecraft.getMinecraft().getRenderItem().getItemModelMesher().register(copperPickaxe, 0, new ModelResourceLocation(“modegypte:copper_Pickaxe”, “inventory”));
                              Minecraft.getMinecraft().getRenderItem().getItemModelMesher().register(copperShovel, 0, new ModelResourceLocation(“modegypte:copper_Shovel”, “inventory”));
                              Minecraft.getMinecraft().getRenderItem().getItemModelMesher().register(copperHoe, 0, new ModelResourceLocation(“modegypte:copper_Hoe”, “inventory”));

          //Blocs Enregistrés en Items
                              Minecraft.getMinecraft().getRenderItem().getItemModelMesher().register(Item.getItemFromBlock(cuivreBloc), 0, new ModelResourceLocation(“modegypte:cuivre_bloc”, “inventory”));
                              Minecraft.getMinecraft().getRenderItem().getItemModelMesher().register(Item.getItemFromBlock(limonBloc), 0, new ModelResourceLocation(“modegypte:limon_bloc”, “inventory”));
                              Minecraft.getMinecraft().getRenderItem().getItemModelMesher().register(Item.getItemFromBlock(limonMouilleBloc), 0, new ModelResourceLocation(“modegypte:limon_mouille_bloc”, “inventory”));
                              Minecraft.getMinecraft().getRenderItem().getItemModelMesher().register(Item.getItemFromBlock(briqueCrueBloc), 0, new ModelResourceLocation(“modegypte:brique_crue_bloc”, “inventory”));
                          }
              }

          @EventHandler
              public void postInit(FMLPostInitializationEvent event)
              {

          }
          }
          %(#333333)[

          
          La classe 'Armor[color=#cc99ffCopper].java' :
          
          %(#333333)[```java
          ]
          
          package fr.vorax.egypte.common;
          
          import net.minecraft.item.ItemArmor;
          import net.minecraft.item.ItemStack;
          
          public class ArmorCopper extends ItemArmor
          {
              public ArmorCopper(ArmorMaterial material, int type)
              {
                  super(material, 0, type);
              }
          
              public boolean getIsRepairable(ItemStack input, ItemStack repair)
          
              {
          
                  if(repair.getItem() == ModEgypte.cuivreLingot)
          
                  {
          
                      return true;
          
                  }
          
                  return false;
          
              }
          
          }
          %(#333333)[
          ```]
          
          Chemin des dossiers avec les textures en .png en rapport avec les 4 items formant l'armure :
          
          [color=#333333modegypte->textures->models->armor->CuivreArmure_layer_1]
          [color=#333333modegypte->]textures->models->armor->CuivreArmure_layer_2
          
          log: http://www.cjoint.com/c/FElou6zO3gk

          Je suis la terreur un quart née!
          #Diablo #HOTS

          1 réponse Dernière réponse Répondre Citer 0
          • VoraX
            VoraX dernière édition par

            Après avoir très très très longuement recherché d’autres choses pour mon mod (il suffit de regarder l’heure de ce post pour comprendre la force de ces 3 “très”), je suis tombé par hasard sur la réponse à ma question, elle est ici, dans la classe de mon armure ‘ArmorCopper.java’ :

            package fr.vorax.egypte.common;
            
            import net.minecraft.entity.Entity;
            import net.minecraft.item.ItemArmor;
            import net.minecraft.item.ItemStack;
            
            public class ArmorCopper extends ItemArmor
            {
                public ArmorCopper(ArmorMaterial material, int type)
                {
                    super(material, 0, type);
                }
            
                public boolean getIsRepairable(ItemStack input, ItemStack repair)
            
                {
            
                    if(repair.getItem() == ModEgypte.cuivreLingot)
            
                    {
            
                        return true;
            
                    }
            
                    return false;
            
                }
            
                @Override
                public String getArmorTexture(ItemStack stack, Entity entity, int slot, String type)
                {
                    if(slot == 0 || slot == 1 || slot == 3)
                    {
                        return "modegypte:textures/models/armor/CuivreArmure_layer_1.png";
                    } 
                    else if (slot == 2)
                    {    return "modegypte:textures/models/armor/CuivreArmure_layer_2.png";
                    }
                    else 
                    {
                        return null;
                    }
            
                    }
                }
            
            

            N’oubliez pas le petit + si je vous ai aidé, j’en serai ravi, et cela me poussera encore plus à aider!
            En espérant aider mon prochain, je vous dis à la prochaine!

            Je suis la terreur un quart née!
            #Diablo #HOTS

            1 réponse Dernière réponse Répondre Citer 0
            • 1 / 1
            • Premier message
              Dernier message
            Design by Woryk
            Contact / Mentions Légales

            MINECRAFT FORGE FRANCE © 2018

            Powered by NodeBB