MFF

    Minecraft Forge France
    • Récent
    • Mots-clés
    • Populaire
    • Utilisateurs
    • Groupes
    • Forge Events
      • Automatique
      • Foncé
      • Clair
    • S'inscrire
    • Se connecter

    Problème texture plante cultivable et lang

    Planifier Épinglé Verrouillé Déplacé Résolu 1.8.x
    1.8.9
    22 Messages 6 Publieurs 4.3k Vues 1 Watching
    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.
    • AymericRedA Hors-ligne
      AymericRed
      dernière édition par

      Les étapes au clair :

      • Déclarer ta variable pour ton Block.
      • Initialiser ta variable dans ta méthode preInit.
      • Créer la classe du block (sans oublier le extends Block).
      • Rajouter les .setCreativeTabs, .setUnlocalizedName dans le constructeur du block (avec un this devant l’appel des fonctions) ou dans ta méthode preInt, comme ça : new BlockQuelqueChose().uneFonction().uneAutreFonction();

      Si je vous ai aidé, n'oubliez pas d’être heureux, j'aiderai encore +

      AymericRed, moddeur expérimenté qui aide sur ce forum et qui peut accepter de faire un mod Forge rémunéré de temps en temps.

      Mes tutos : Table de craft, plugin NEI, plugin JEI, modifier l'overlay
      Je suis un membre apprécié et joueur, j'ai déjà obtenu 6 points de réputation.

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

        [font=Ubuntu, sans-serifLes étapes réalisées sont les suivantes:]

        J’ai essayé de suivre tout ça du mieux que j’ai pu, mais ça ne va pas, j’ai peut-être compris de travers (et je l’espère, je veux que ça marche, mieux vaut que je bugue plutôt que la machine!)…

        La classe ‘BlockBarley.java’ qui existait déjà, non modifiée:

        package fr.vorax.egypte.common;
        
        import net.minecraft.block.BlockCrops;
        import net.minecraft.item.Item;
        
        public class BlockBarley extends BlockCrops
        {
        
            @Override
            protected Item getSeed()
            {
            return ModEgypte.BarleySeeds;
            }    
        
            @Override
            protected Item getCrop()
            {
                return ModEgypte.barleyy;
            }
        
        }
        

        Le constructeur, je n’aime pas trop y toucher, donc je l’ai laissé tranquille. Je n’ai modifié que la 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.init.Blocks;
        import net.minecraft.init.Items;
        import net.minecraft.item.Item;
        import net.minecraft.item.Item.ToolMaterial;
        import net.minecraft.item.ItemArmor.ArmorMaterial;
        import net.minecraft.item.ItemSeeds;
        import net.minecraft.item.ItemStack;
        import net.minecraft.util.EnumChatFormatting;
        import net.minecraftforge.client.gui.ForgeGuiFactory.ForgeConfigGui.AddModOverrideEntry;
        import net.minecraftforge.common.MinecraftForge;
        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.ModMetadata;
        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;
        
            //DECLARATIONS
            public static Item cuivreLingot, copperHelmet, copperChestPlate, copperLeggings, copperBoots, copperSword, copperAxe, copperPickaxe, copperShovel, copperHoe, fig, barleyy;
        
            public static Block cuivreBloc, limonBloc, limonMouilleBloc, briqueCrueBloc, copperOreBlock, hieroglyphBlock, blockBarley;
        
            public static BlockBarley Barley = new BlockBarley();
            public static ItemSeeds BarleySeeds = new ItemSeeds(Barley, null);
        
            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
                //Armors Items
                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");
                //Materials Items
                cuivreLingot = new CuivreLingot().setUnlocalizedName("cuivreLingot").setCreativeTab(CreativeTabs.tabMaterials);
                barleyy = new Barleyy().setUnlocalizedName("barleyy").setCreativeTab(CreativeTabs.tabMaterials);
        
                //Tools Items
                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");
        
                //Food Items
                fig = new Fig(5, false).setUnlocalizedName("fig").setCreativeTab(CreativeTabs.tabFood);
        
           //ItemsRegistry
                //Itemsregistry Armor
                GameRegistry.registerItem(copperHelmet, "copper_Helmet");
                GameRegistry.registerItem(copperChestPlate, "copper_ChestPlate");
                GameRegistry.registerItem(copperLeggings, "copper_Leggings");
                GameRegistry.registerItem(copperBoots, "copper_Boots");
                //Itemsregistry Tools
                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");
                //Itemsregistry Food   
                GameRegistry.registerItem(fig, "fig");
                //Itemsregistry Material
                GameRegistry.registerItem(cuivreLingot, "cuivre_Lingot");
                GameRegistry.registerItem(barleyy, "barleyy");
        
                GameRegistry.registerItem(BarleySeeds, "barley_seeds");
        
                //BLOCS
                cuivreBloc = new CuivreBloc(Material.iron).setUnlocalizedName("cuivrebloc").setHardness(5.0F).setResistance(10.0F).setCreativeTab(CreativeTabs.tabBlock);
                limonBloc = new LimonBloc(Material.ground).setUnlocalizedName("limonbloc").setHardness(0.5F).setCreativeTab(CreativeTabs.tabBlock);
                limonMouilleBloc = new LimonMouilleBloc(Material.ground).setUnlocalizedName("limonmouillebloc").setHardness(0.6F).setCreativeTab(CreativeTabs.tabBlock);
                briqueCrueBloc = new BriqueCrueBloc(Material.ground).setUnlocalizedName("briquecruebloc").setHardness(1.5F).setResistance(10.0F).setCreativeTab(CreativeTabs.tabBlock);
                copperOreBlock = new CopperOreBlock(Material.rock).setUnlocalizedName("copperoreblock").setHardness(3.0F).setResistance(5.0F).setCreativeTab(CreativeTabs.tabBlock);
                hieroglyphBlock = new HieroglyphBlock().setUnlocalizedName("hieroglyphblock").setHardness(1.5F).setResistance(10.0F).setCreativeTab(CreativeTabs.tabBlock);
                blockBarley = new BlockBarley().setUnlocalizedName("blockbarley").setCreativeTab(tabMaterials);
        
                //BlocsRegistry
                GameRegistry.registerBlock(cuivreBloc, "cuivre_bloc");
                GameRegistry.registerBlock(limonBloc, "limon_bloc");
                GameRegistry.registerBlock(limonMouilleBloc, "limon_mouille_bloc");
                GameRegistry.registerBlock(briqueCrueBloc, "brique_crue_bloc");
                GameRegistry.registerBlock(copperOreBlock, "copper_ore_block");
                GameRegistry.registerBlock(hieroglyphBlock, "hieroglyph_block");
                GameRegistry.registerBlock(Barley, "barley_block");
        
            }
        
            @EventHandler
            public void Init(FMLInitializationEvent event)
            {
                proxy.registerRender();
        
                if(event.getSide().isClient())
                        {
        
                    MinecraftForge.EVENT_BUS.register(new LivingEventHandler());
                    proxy.registerRender();
        
                  //Textures
                            //Items Enregistrés
                            //Items Armor
                            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"));   
                            //Items Tools
                            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"));
                            //Items Food
                            Minecraft.getMinecraft().getRenderItem().getItemModelMesher().register(fig, 0, new ModelResourceLocation("modegypte:fig", "inventory"));
                            //Items Material
                            Minecraft.getMinecraft().getRenderItem().getItemModelMesher().register(cuivreLingot, 0, new ModelResourceLocation("modegypte:cuivre_Lingot", "inventory"));
                            Minecraft.getMinecraft().getRenderItem().getItemModelMesher().register(barleyy, 0, new ModelResourceLocation("modegypte:barleyy", "inventory"));
        
                            Minecraft.getMinecraft().getRenderItem().getItemModelMesher().register(BarleySeeds, 0, new ModelResourceLocation("modegypte:barley_seeds", "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"));
                            Minecraft.getMinecraft().getRenderItem().getItemModelMesher().register(Item.getItemFromBlock(copperOreBlock), 0, new ModelResourceLocation("modegypte:copper_ore_block", "inventory"));
                            Minecraft.getMinecraft().getRenderItem().getItemModelMesher().register(Item.getItemFromBlock(hieroglyphBlock), 0, new ModelResourceLocation("modegypte:hieroglyph_block", "inventory"));
                            Minecraft.getMinecraft().getRenderItem().getItemModelMesher().register(Item.getItemFromBlock(Barley), 0, new ModelResourceLocation("modegypte:Barley", "inventory"));
        
                    //CRAFTS
                       //Crafting Table
                         //Recipes Blocks
                            GameRegistry.addRecipe(new ItemStack(cuivreBloc), new Object[]{"XXX", "XXX", "XXX", 'X', new ItemStack(cuivreLingot)});
                         //Recipes Tools
                            GameRegistry.addRecipe(new ItemStack(copperSword), new Object[]{"X", "X", "S", 'X', new ItemStack(cuivreLingot), 'S' , Items.stick});
                            GameRegistry.addRecipe(new ItemStack(copperAxe), new Object[]{"XX ", "XS ", " S ", 'X', new ItemStack(cuivreLingot), 'S' , Items.stick});
                            GameRegistry.addRecipe(new ItemStack(copperAxe), new Object[]{" XX", " XS", "  S", 'X', new ItemStack(cuivreLingot), 'S' , Items.stick});
                            GameRegistry.addRecipe(new ItemStack(copperPickaxe), new Object[]{"XXX", " S ", " S ", 'X', new ItemStack(cuivreLingot), 'S' , Items.stick});
                            GameRegistry.addRecipe(new ItemStack(copperShovel), new Object[]{"X", "S", "S", 'X', new ItemStack(cuivreLingot), 'S' , Items.stick});
                            GameRegistry.addRecipe(new ItemStack(copperHoe), new Object[]{"XX ", " S ", " S ", 'X', new ItemStack(cuivreLingot), 'S' , Items.stick});
                            GameRegistry.addRecipe(new ItemStack(copperHoe), new Object[]{" XX", "  S", "  S", 'X', new ItemStack(cuivreLingot), 'S' , Items.stick});
                         // Recipes Armors
                            GameRegistry.addRecipe(new ItemStack(copperHelmet, 1), new Object[]{"XXX", "X X", 'X', new ItemStack(cuivreLingot)});
                            GameRegistry.addRecipe(new ItemStack(copperChestPlate, 1), new Object[]{"X X", "XXX", "XXX", 'X', new ItemStack(cuivreLingot)});
                            GameRegistry.addRecipe(new ItemStack(copperLeggings, 1), new Object[]{"XXX", "X X", "X X", 'X', new ItemStack(cuivreLingot)});
                            GameRegistry.addRecipe(new ItemStack(copperBoots, 1), new Object[]{"X X", "X X", 'X', new ItemStack(cuivreLingot)});                   
                         //Recipes Materials
                         //Recipes Decorations
                  //Furnace
                            GameRegistry.addSmelting(copperOreBlock, new ItemStack(cuivreLingot), 0.6F);
        
                            MinecraftForge.addGrassSeed(new ItemStack(BarleySeeds), 10);
        
                 //GenerationRegistry
                            GameRegistry.registerWorldGenerator(new OreGenerator(copperOreBlock), 0);
        
                        }
            }
        
            @EventHandler
            public void postInit(FMLPostInitializationEvent event)
            {
        
            }
        }
        

        J’ai donc une erreur sur cette ligne, sur le mot en rouge ici. Dans Eclipse, il devrait être en bleu:
        blockBarley = new BlockBarley().setUnlocalizedName(“blockbarley”).setCreativeTab(tabMaterials);

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

        1 réponse Dernière réponse Répondre Citer 0
        • BrokenSwingB Hors-ligne
          BrokenSwing Moddeurs confirmés Rédacteurs
          dernière édition par

          Si je comprend bien le blockBarkey représente la plante en elle même donc ne t’embête pas avec les onglets créatifs pour ce bloc, normalement personne n’est sensé le tenir dans ses mains

          Et ici :

          public static ItemSeeds BarleySeeds = new ItemSeeds(Barley, null);
          

          Premièrement c’est un item comme les autres, donc il faut pas l’intancier ici -> preInit
          Ensuite BarleySeeds -> devient barleySeeds c’est une variable
          Et pour qu’il n’y est plus le nom item.null.name if faut que tu l’instancie avec la fonction à la fin, comme ça :

          barleySeeds = new ItemSeeds(Barley, null).setUnlocalizedName("barleySeed");
          
          1 réponse Dernière réponse Répondre Citer 0
          • LeBossMax2L Hors-ligne
            LeBossMax2
            dernière édition par

            @‘VoraX’:

            Dans le dossier blockstates, j’ai renommé le fichier json ‘barley’ en ‘[font=Ubuntu, sans-serifbarley_block’.]
            [font=Ubuntu, sans-serifCa a suffit pour que la texture, s’affiche, ça fait donc un problème de résolu.]
            [font=Ubuntu, sans-serifC’est vrai que c’est une erreur bête, mais vu le nombre de json qu’il y avait, j’étais un peu déboussolé et ne trouvais pas l’erreur parmi tout ce beau monde.]

            [font=Ubuntu, sans-serifJe ne sais pas où mettre le .set][font=Ubuntu, sans-serifUnlocalizedName(“nomàspécfier”) …]

            [font=Ubuntu, sans-serifSi c’est à la suite de ça:]

            [font=Ubuntu, sans-serif//Materials Items
            ]
                    cuivreLingot = new CuivreLingot().setUnlocalizedName(“cuivreLingot”).setCreativeTab(CreativeTabs.tabMaterials);
            [font=Ubuntu, sans-serif        barleyy = new Barleyy().setUnlocalizedName(“barleyy”).setCreativeTab(CreativeTabs.tabMaterials);]
            [font=Ubuntu, sans-serif- A écrire sur cette ligne -]

            [font=Ubuntu, sans-serifCa me demande de créer une classe, et je n’ai que des erreurs…]
            [font=Ubuntu, sans-serifC’est bien ici?]

            Tout simplement, au lieux de mettre public static ItemSeeds BarleySeeds = new ItemSeeds(Barley, null), tu met BarleySeeds avec les autre items ( tu ajoute ,BarleySeeds à “public static Item cuivreLingot, copperHelmet, ….”)
            ensuite dans la fonction preInit, à coté des autres items (après Barleyy, si tu veux) tu met Barley = new BlockBarley().set[font=Ubuntu, sans-serifUnlocalizedName(“nomàspécfier”)];

            EDIT : Oups, je n’ai pas vu que BokenSwing vient de dire le même chose.

            1 réponse Dernière réponse Répondre Citer 1
            • VoraXV Hors-ligne
              VoraX
              dernière édition par

              C’est vrai que tenir un bloc d’orge serait lolesque, mais bon, c’est inutile, même si c’est drôle (oui, j’avais testé…).

              Il ne faut pas s’inquiéter si la classe a un poil changé, j’ai créé un bloc entre temps.

              Je n’ai touché à rien d’autre que la classe, désolé si VoraX a de la fumée noire qui ressort des oreilles, mais il fait ce qu’il peut:

              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.init.Blocks;
              import net.minecraft.init.Items;
              import net.minecraft.item.Item;
              import net.minecraft.item.Item.ToolMaterial;
              import net.minecraft.item.ItemArmor.ArmorMaterial;
              import net.minecraft.item.ItemSeeds;
              import net.minecraft.item.ItemStack;
              import net.minecraft.util.EnumChatFormatting;
              import net.minecraftforge.client.gui.ForgeGuiFactory.ForgeConfigGui.AddModOverrideEntry;
              import net.minecraftforge.common.MinecraftForge;
              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.ModMetadata;
              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;
              
                  //DECLARATIONS
                  public static Item cuivreLingot, copperHelmet, copperChestPlate, copperLeggings, copperBoots, copperSword, copperAxe, copperPickaxe, copperShovel, copperHoe, fig, barleyy;
              
                  public static Block cuivreBloc, limonBloc, limonMouilleBloc, briqueCrueBloc, copperOreBlock, hieroglyphBlock, hieroglyphBlock2, blockBarley;
              
                  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
                      //Armors Items
                      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");
                      //Materials Items
                      cuivreLingot = new CuivreLingot().setUnlocalizedName("cuivreLingot").setCreativeTab(CreativeTabs.tabMaterials);
                      barleyy = new Barleyy().setUnlocalizedName("barleyy").setCreativeTab(CreativeTabs.tabMaterials);
                      barleySeeds = new ItemSeeds(Barley, null).setUnlocalizedName("barleySeed");
              
                      //Tools Items
                      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");
              
                      //Food Items
                      fig = new Fig(5, false).setUnlocalizedName("fig").setCreativeTab(CreativeTabs.tabFood);
              
                 //ItemsRegistry
                      //Itemsregistry Armor
                      GameRegistry.registerItem(copperHelmet, "copper_Helmet");
                      GameRegistry.registerItem(copperChestPlate, "copper_ChestPlate");
                      GameRegistry.registerItem(copperLeggings, "copper_Leggings");
                      GameRegistry.registerItem(copperBoots, "copper_Boots");
                      //Itemsregistry Tools
                      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");
                      //Itemsregistry Food   
                      GameRegistry.registerItem(fig, "fig");
                      //Itemsregistry Material
                      GameRegistry.registerItem(cuivreLingot, "cuivre_Lingot");
                      GameRegistry.registerItem(barleyy, "barleyy");
              
                      GameRegistry.registerItem(BarleySeeds, "barley_seeds");
              
                      //BLOCS
                      cuivreBloc = new CuivreBloc(Material.iron).setUnlocalizedName("cuivrebloc").setHardness(5.0F).setResistance(10.0F).setCreativeTab(CreativeTabs.tabBlock);
                      limonBloc = new LimonBloc(Material.ground).setUnlocalizedName("limonbloc").setHardness(0.5F).setCreativeTab(CreativeTabs.tabBlock);
                      limonMouilleBloc = new LimonMouilleBloc(Material.ground).setUnlocalizedName("limonmouillebloc").setHardness(0.6F).setCreativeTab(CreativeTabs.tabBlock);
                      briqueCrueBloc = new BriqueCrueBloc(Material.ground).setUnlocalizedName("briquecruebloc").setHardness(1.5F).setResistance(10.0F).setCreativeTab(CreativeTabs.tabBlock);
                      copperOreBlock = new CopperOreBlock(Material.rock).setUnlocalizedName("copperoreblock").setHardness(3.0F).setResistance(5.0F).setCreativeTab(CreativeTabs.tabBlock);
                      hieroglyphBlock = new HieroglyphBlock().setUnlocalizedName("hieroglyphblock").setHardness(1.5F).setResistance(10.0F).setCreativeTab(CreativeTabs.tabBlock);
                      hieroglyphBlock2 = new HieroglyphBlock2().setUnlocalizedName("hieroglyphblock2").setHardness(1.5F).setResistance(10.0F).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");
                      GameRegistry.registerBlock(copperOreBlock, "copper_ore_block");
                      GameRegistry.registerBlock(hieroglyphBlock, "hieroglyph_block");
                      GameRegistry.registerBlock(hieroglyphBlock2, "hieroglyph_block2");
                      GameRegistry.registerBlock(Barley, "barley_block");
              
                  }
              
                  @EventHandler
                  public void Init(FMLInitializationEvent event)
                  {
                      proxy.registerRender();
              
                      if(event.getSide().isClient())
                              {
              
                          MinecraftForge.EVENT_BUS.register(new LivingEventHandler());
                          proxy.registerRender();
              
                        //Textures
                                  //Items Enregistrés
                                  //Items Armor
                                  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"));   
                                  //Items Tools
                                  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"));
                                  //Items Food
                                  Minecraft.getMinecraft().getRenderItem().getItemModelMesher().register(fig, 0, new ModelResourceLocation("modegypte:fig", "inventory"));
                                  //Items Material
                                  Minecraft.getMinecraft().getRenderItem().getItemModelMesher().register(cuivreLingot, 0, new ModelResourceLocation("modegypte:cuivre_Lingot", "inventory"));
                                  Minecraft.getMinecraft().getRenderItem().getItemModelMesher().register(barleyy, 0, new ModelResourceLocation("modegypte:barleyy", "inventory"));
              
                                  Minecraft.getMinecraft().getRenderItem().getItemModelMesher().register(BarleySeeds, 0, new ModelResourceLocation("modegypte:barley_seeds", "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"));
                                  Minecraft.getMinecraft().getRenderItem().getItemModelMesher().register(Item.getItemFromBlock(copperOreBlock), 0, new ModelResourceLocation("modegypte:copper_ore_block", "inventory"));
                                  Minecraft.getMinecraft().getRenderItem().getItemModelMesher().register(Item.getItemFromBlock(hieroglyphBlock), 0, new ModelResourceLocation("modegypte:hieroglyph_block", "inventory"));
                                  Minecraft.getMinecraft().getRenderItem().getItemModelMesher().register(Item.getItemFromBlock(hieroglyphBlock2), 0, new ModelResourceLocation("modegypte:hieroglyph_block2", "inventory"));
                                  Minecraft.getMinecraft().getRenderItem().getItemModelMesher().register(Item.getItemFromBlock(Barley), 0, new ModelResourceLocation("modegypte:Barley", "inventory"));
              
                          //CRAFTS
                             //Crafting Table
                               //Recipes Blocks
                                  GameRegistry.addRecipe(new ItemStack(cuivreBloc), new Object[]{"XXX", "XXX", "XXX", 'X', new ItemStack(cuivreLingot)});
                               //Recipes Tools
                                  GameRegistry.addRecipe(new ItemStack(copperSword), new Object[]{"X", "X", "S", 'X', new ItemStack(cuivreLingot), 'S' , Items.stick});
                                  GameRegistry.addRecipe(new ItemStack(copperAxe), new Object[]{"XX ", "XS ", " S ", 'X', new ItemStack(cuivreLingot), 'S' , Items.stick});
                                  GameRegistry.addRecipe(new ItemStack(copperAxe), new Object[]{" XX", " XS", "  S", 'X', new ItemStack(cuivreLingot), 'S' , Items.stick});
                                  GameRegistry.addRecipe(new ItemStack(copperPickaxe), new Object[]{"XXX", " S ", " S ", 'X', new ItemStack(cuivreLingot), 'S' , Items.stick});
                                  GameRegistry.addRecipe(new ItemStack(copperShovel), new Object[]{"X", "S", "S", 'X', new ItemStack(cuivreLingot), 'S' , Items.stick});
                                  GameRegistry.addRecipe(new ItemStack(copperHoe), new Object[]{"XX ", " S ", " S ", 'X', new ItemStack(cuivreLingot), 'S' , Items.stick});
                                  GameRegistry.addRecipe(new ItemStack(copperHoe), new Object[]{" XX", "  S", "  S", 'X', new ItemStack(cuivreLingot), 'S' , Items.stick});
                               // Recipes Armors
                                  GameRegistry.addRecipe(new ItemStack(copperHelmet, 1), new Object[]{"XXX", "X X", 'X', new ItemStack(cuivreLingot)});
                                  GameRegistry.addRecipe(new ItemStack(copperChestPlate, 1), new Object[]{"X X", "XXX", "XXX", 'X', new ItemStack(cuivreLingot)});
                                  GameRegistry.addRecipe(new ItemStack(copperLeggings, 1), new Object[]{"XXX", "X X", "X X", 'X', new ItemStack(cuivreLingot)});
                                  GameRegistry.addRecipe(new ItemStack(copperBoots, 1), new Object[]{"X X", "X X", 'X', new ItemStack(cuivreLingot)});                   
                               //Recipes Materials
                               //Recipes Decorations
                        //Furnace
                                  GameRegistry.addSmelting(copperOreBlock, new ItemStack(cuivreLingot), 0.6F);
              
                                  MinecraftForge.addGrassSeed(new ItemStack(BarleySeeds), 10);
              
                       //GenerationRegistry
                                  GameRegistry.registerWorldGenerator(new OreGenerator(copperOreBlock), 0);
              
                              }
                  }
              
                  @EventHandler
                  public void postInit(FMLPostInitializationEvent event)
                  {
              
                  }
              }
              

              J’ai donc 2 erreurs sur cette ligne:

              barleySeeds = new ItemSeeds(Barley, null).setUnlocalizedName(“barleySeed”);

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

              1 réponse Dernière réponse Répondre Citer 0
              • AymericRedA Hors-ligne
                AymericRed
                dernière édition par

                Il faut que tu rajoute barleySeeds a la liste de tes autres items dans le public static Item …; Et remplace Barley par blockBarley

                Envoyé de mon RAINBOW LITE 4G en utilisant Tapatalk

                Si je vous ai aidé, n'oubliez pas d’être heureux, j'aiderai encore +

                AymericRed, moddeur expérimenté qui aide sur ce forum et qui peut accepter de faire un mod Forge rémunéré de temps en temps.

                Mes tutos : Table de craft, plugin NEI, plugin JEI, modifier l'overlay
                Je suis un membre apprécié et joueur, j'ai déjà obtenu 6 points de réputation.

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

                  Le jeu refusait de se lancer quand je retirais je ne sais plus quelle ligne, donc je l’ai laissée, et maintenant, quand je lance le jeu, tout se passe à peu près normalement, sauf que quand je plante le barley seeds, ça crashe.

                  %(#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.init.Blocks;
                  import net.minecraft.init.Items;
                  import net.minecraft.item.Item;
                  import net.minecraft.item.Item.ToolMaterial;
                  import net.minecraft.item.ItemArmor.ArmorMaterial;
                  import net.minecraft.item.ItemSeeds;
                  import net.minecraft.item.ItemStack;
                  import net.minecraft.util.EnumChatFormatting;
                  import net.minecraftforge.client.gui.ForgeGuiFactory.ForgeConfigGui.AddModOverrideEntry;
                  import net.minecraftforge.common.MinecraftForge;
                  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.ModMetadata;
                  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;

                  //DECLARATIONS
                      public static Item cuivreLingot, copperHelmet, copperChestPlate, copperLeggings, copperBoots, copperSword, copperAxe, copperPickaxe, copperShovel, copperHoe, fig, barleyy,  barleySeeds;

                  public static Block cuivreBloc, limonBloc, limonMouilleBloc, briqueCrueBloc, copperOreBlock, hieroglyphBlock, hieroglyphBlock2, blockBarley;

                  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
                          //Armors Items
                          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”);
                          //Materials Items
                          cuivreLingot = new CuivreLingot().setUnlocalizedName(“cuivreLingot”).setCreativeTab(CreativeTabs.tabMaterials);
                          barleyy = new Barleyy().setUnlocalizedName(“barleyy”).setCreativeTab(CreativeTabs.tabMaterials);
                          barleySeeds = new ItemSeeds(blockBarley, null).setUnlocalizedName(“barleySeed”);

                  //Tools Items
                          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”);

                  //Food Items
                          fig = new Fig(5, false).setUnlocalizedName(“fig”).setCreativeTab(CreativeTabs.tabFood);

                  //ItemsRegistry
                          //Itemsregistry Armor
                          GameRegistry.registerItem(copperHelmet, “copper_Helmet”);
                          GameRegistry.registerItem(copperChestPlate, “copper_ChestPlate”);
                          GameRegistry.registerItem(copperLeggings, “copper_Leggings”);
                          GameRegistry.registerItem(copperBoots, “copper_Boots”);
                          //Itemsregistry Tools
                          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”);
                          //Itemsregistry Food   
                          GameRegistry.registerItem(fig, “fig”);
                          //Itemsregistry Material
                          GameRegistry.registerItem(cuivreLingot, “cuivre_Lingot”);
                          GameRegistry.registerItem(barleyy, “barleyy”);

                  GameRegistry.registerItem(barleySeeds, “barley_seeds”);

                  //BLOCS
                          cuivreBloc = new CuivreBloc(Material.iron).setUnlocalizedName(“cuivrebloc”).setHardness(5.0F).setResistance(10.0F).setCreativeTab(CreativeTabs.tabBlock);
                          limonBloc = new LimonBloc(Material.ground).setUnlocalizedName(“limonbloc”).setHardness(0.5F).setCreativeTab(CreativeTabs.tabBlock);
                          limonMouilleBloc = new LimonMouilleBloc(Material.ground).setUnlocalizedName(“limonmouillebloc”).setHardness(0.6F).setCreativeTab(CreativeTabs.tabBlock);
                          briqueCrueBloc = new BriqueCrueBloc(Material.ground).setUnlocalizedName(“briquecruebloc”).setHardness(1.5F).setResistance(10.0F).setCreativeTab(CreativeTabs.tabBlock);
                          copperOreBlock = new CopperOreBlock(Material.rock).setUnlocalizedName(“copperoreblock”).setHardness(3.0F).setResistance(5.0F).setCreativeTab(CreativeTabs.tabBlock);
                          hieroglyphBlock = new HieroglyphBlock().setUnlocalizedName(“hieroglyphblock”).setHardness(1.5F).setResistance(10.0F).setCreativeTab(CreativeTabs.tabBlock);
                          hieroglyphBlock2 = new HieroglyphBlock2().setUnlocalizedName(“hieroglyphblock2”).setHardness(1.5F).setResistance(10.0F).setCreativeTab(CreativeTabs.tabBlock);
                          blockBarley = new BlockBarley().setUnlocalizedName(“blockBarley”);

                  //BlocsRegistry
                          GameRegistry.registerBlock(cuivreBloc, “cuivre_bloc”);
                          GameRegistry.registerBlock(limonBloc, “limon_bloc”);
                          GameRegistry.registerBlock(limonMouilleBloc, “limon_mouille_bloc”);
                          GameRegistry.registerBlock(briqueCrueBloc, “brique_crue_bloc”);
                          GameRegistry.registerBlock(copperOreBlock, “copper_ore_block”);
                          GameRegistry.registerBlock(hieroglyphBlock, “hieroglyph_block”);
                          GameRegistry.registerBlock(hieroglyphBlock2, “hieroglyph_block2”);
                          GameRegistry.registerBlock(blockBarley, “barley_block”);

                  }

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

                  if(event.getSide().isClient())
                                  {

                  MinecraftForge.EVENT_BUS.register(new LivingEventHandler());
                              proxy.registerRender();

                  //Textures
                                      //Items Enregistrés
                                      //Items Armor
                                      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”));   
                                      //Items Tools
                                      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”));
                                      //Items Food
                                      Minecraft.getMinecraft().getRenderItem().getItemModelMesher().register(fig, 0, new ModelResourceLocation(“modegypte:fig”, “inventory”));
                                      //Items Material
                                      Minecraft.getMinecraft().getRenderItem().getItemModelMesher().register(cuivreLingot, 0, new ModelResourceLocation(“modegypte:cuivre_Lingot”, “inventory”));
                                      Minecraft.getMinecraft().getRenderItem().getItemModelMesher().register(barleyy, 0, new ModelResourceLocation(“modegypte:barleyy”, “inventory”));

                  Minecraft.getMinecraft().getRenderItem().getItemModelMesher().register(barleySeeds, 0, new ModelResourceLocation(“modegypte:barley_seeds”, “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”));
                                      Minecraft.getMinecraft().getRenderItem().getItemModelMesher().register(Item.getItemFromBlock(copperOreBlock), 0, new ModelResourceLocation(“modegypte:copper_ore_block”, “inventory”));
                                      Minecraft.getMinecraft().getRenderItem().getItemModelMesher().register(Item.getItemFromBlock(hieroglyphBlock), 0, new ModelResourceLocation(“modegypte:hieroglyph_block”, “inventory”));
                                      Minecraft.getMinecraft().getRenderItem().getItemModelMesher().register(Item.getItemFromBlock(hieroglyphBlock2), 0, new ModelResourceLocation(“modegypte:hieroglyph_block2”, “inventory”));
                                      Minecraft.getMinecraft().getRenderItem().getItemModelMesher().register(Item.getItemFromBlock(blockBarley), 0, new ModelResourceLocation(“modegypte:Barley”, “inventory”));

                  //CRAFTS
                                 //Crafting Table
                                   //Recipes Blocks
                                      GameRegistry.addRecipe(new ItemStack(cuivreBloc), new Object[]{“XXX”, “XXX”, “XXX”, ‘X’, new ItemStack(cuivreLingot)});
                                   //Recipes Tools
                                      GameRegistry.addRecipe(new ItemStack(copperSword), new Object[]{“X”, “X”, “S”, ‘X’, new ItemStack(cuivreLingot), ‘S’ , Items.stick});
                                      GameRegistry.addRecipe(new ItemStack(copperAxe), new Object[]{"XX “, “XS “, " S “, ‘X’, new ItemStack(cuivreLingot), ‘S’ , Items.stick});
                                      GameRegistry.addRecipe(new ItemStack(copperAxe), new Object[]{” XX”, " XS”, "  S”, ‘X’, new ItemStack(cuivreLingot), ‘S’ , Items.stick});
                                      GameRegistry.addRecipe(new ItemStack(copperPickaxe), new Object[]{“XXX”, " S ", " S ", ‘X’, new ItemStack(cuivreLingot), ‘S’ , Items.stick});
                                      GameRegistry.addRecipe(new ItemStack(copperShovel), new Object[]{“X”, “S”, “S”, ‘X’, new ItemStack(cuivreLingot), ‘S’ , Items.stick});
                                      GameRegistry.addRecipe(new ItemStack(copperHoe), new Object[]{“XX “, " S “, " S “, ‘X’, new ItemStack(cuivreLingot), ‘S’ , Items.stick});
                                      GameRegistry.addRecipe(new ItemStack(copperHoe), new Object[]{” XX”, "  S”, "  S”, ‘X’, new ItemStack(cuivreLingot), ‘S’ , Items.stick});
                                   // Recipes Armors
                                      GameRegistry.addRecipe(new ItemStack(copperHelmet, 1), new Object[]{“XXX”, “X X”, ‘X’, new ItemStack(cuivreLingot)});
                                      GameRegistry.addRecipe(new ItemStack(copperChestPlate, 1), new Object[]{“X X”, “XXX”, “XXX”, ‘X’, new ItemStack(cuivreLingot)});
                                      GameRegistry.addRecipe(new ItemStack(copperLeggings, 1), new Object[]{“XXX”, “X X”, “X X”, ‘X’, new ItemStack(cuivreLingot)});
                                      GameRegistry.addRecipe(new ItemStack(copperBoots, 1), new Object[]{“X X”, “X X”, ‘X’, new ItemStack(cuivreLingot)});                   
                                   //Recipes Materials
                                   //Recipes Decorations
                            //Furnace
                                      GameRegistry.addSmelting(copperOreBlock, new ItemStack(cuivreLingot), 0.6F);

                  MinecraftForge.addGrassSeed(new ItemStack(barleySeeds), 10);

                  //GenerationRegistry
                                      GameRegistry.registerWorldGenerator(new OreGenerator(copperOreBlock), 0);

                  }
                      }

                  @EventHandler
                      public void postInit(FMLPostInitializationEvent event)
                      {

                  }
                  %(#333333)[}

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

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

                  1 réponse Dernière réponse Répondre Citer 0
                  • AymericRedA Hors-ligne
                    AymericRed
                    dernière édition par

                    Apparemment il plante quand il essaye de prendre le bloc à poser.
                    Là je peux pas regarder donc je demande, le null correspond à quoi ici ? 
                    [size=xx-largebarleySeeds ][size=xx-large=] [size=xx-largenew] [size=xx-largeItemSeeds][size=xx-large(][size=xx-largeblockBarley][size=xx-large,] [size=xx-largenull][size=xx-large)]

                    Si je vous ai aidé, n'oubliez pas d’être heureux, j'aiderai encore +

                    AymericRed, moddeur expérimenté qui aide sur ce forum et qui peut accepter de faire un mod Forge rémunéré de temps en temps.

                    Mes tutos : Table de craft, plugin NEI, plugin JEI, modifier l'overlay
                    Je suis un membre apprécié et joueur, j'ai déjà obtenu 6 points de réputation.

                    1 réponse Dernière réponse Répondre Citer 1
                    • BrokenSwingB Hors-ligne
                      BrokenSwing Moddeurs confirmés Rédacteurs
                      dernière édition par

                      java.lang.NullPointerException: Unexpected error
                      at net.minecraft.item.ItemSeeds.getPlant(ItemSeeds.java:57)
                      

                      Donc c’est bien à cause du null dont AymericRed parle, il faut que tu remplacce null par le bloc sur lequel tu veux que ta plante pousse (par exemple Blocks.farmland)

                      Regarde ici pour mieux comprendre : https://www.minecraftforgefrance.fr/showthread.php?tid=3048#classeprincipale

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

                        Ah, je pensais que dans la fonction suivante,  ‘barleySeeds’ était considéré comme une graine avec les propriétés de base du jeu, donc que cet item se plantait dans la terre labourée sans problème:

                         @Override
                            protected Item getSeed()
                            {
                            return ModEgypte.barleySeeds;
                            }    
                        
                        

                        Ce qui me semble plutôt logique en fait, puisque ça veut dire que si je veux que les graines poussent sur mon bloc de brique crue par exemple, je mets:

                        Blocks.briqueCrueBloc
                        

                        C’est bien ça?

                        Pour rappel, ma classe ‘BlockBarley.java’ :

                        package fr.vorax.egypte.common;
                        
                        import net.minecraft.block.BlockCrops;
                        import net.minecraft.item.Item;
                        
                        public class BlockBarley extends BlockCrops
                        {
                        
                            @Override
                            protected Item getSeed()
                            {
                            return ModEgypte.barleySeeds;
                            }    
                        
                            @Override
                            protected Item getCrop()
                            {
                                return ModEgypte.barleyy;
                            }
                        
                        }
                        

                        Ma classe principale ‘ModEgypte.java’:

                        %(#33cc33)[```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.init.Blocks;
                        import net.minecraft.init.Items;
                        import net.minecraft.item.Item;
                        import net.minecraft.item.Item.ToolMaterial;
                        import net.minecraft.item.ItemArmor.ArmorMaterial;
                        import net.minecraft.item.ItemSeeds;
                        import net.minecraft.item.ItemStack;
                        import net.minecraft.util.EnumChatFormatting;
                        import net.minecraftforge.client.gui.ForgeGuiFactory.ForgeConfigGui.AddModOverrideEntry;
                        import net.minecraftforge.common.MinecraftForge;
                        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.ModMetadata;
                        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;

                        //DECLARATIONS
                            public static Item cuivreLingot, copperHelmet, copperChestPlate, copperLeggings, copperBoots, copperSword, copperAxe, copperPickaxe, copperShovel, copperHoe, fig, barleyy,  barleySeeds;

                        public static Block cuivreBloc, limonBloc, limonMouilleBloc, briqueCrueBloc, copperOreBlock, hieroglyphBlock, hieroglyphBlock2, blockBarley;

                        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
                                //Armors Items
                                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”);
                                //Materials Items
                                cuivreLingot = new CuivreLingot().setUnlocalizedName(“cuivreLingot”).setCreativeTab(CreativeTabs.tabMaterials);
                                barleyy = new Barleyy().setUnlocalizedName(“barleyy”).setCreativeTab(CreativeTabs.tabMaterials);
                                barleySeeds = new ItemSeeds(blockBarley, Blocks.farmland).setUnlocalizedName(“barleySeed”);

                        //Tools Items
                                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”);

                        //Food Items
                                fig = new Fig(5, false).setUnlocalizedName(“fig”).setCreativeTab(CreativeTabs.tabFood);

                        //ItemsRegistry
                                //Itemsregistry Armor
                                GameRegistry.registerItem(copperHelmet, “copper_Helmet”);
                                GameRegistry.registerItem(copperChestPlate, “copper_ChestPlate”);
                                GameRegistry.registerItem(copperLeggings, “copper_Leggings”);
                                GameRegistry.registerItem(copperBoots, “copper_Boots”);
                                //Itemsregistry Tools
                                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”);
                                //Itemsregistry Food   
                                GameRegistry.registerItem(fig, “fig”);
                                //Itemsregistry Material
                                GameRegistry.registerItem(cuivreLingot, “cuivre_Lingot”);
                                GameRegistry.registerItem(barleyy, “barleyy”);

                        GameRegistry.registerItem(barleySeeds, “barley_seeds”);

                        //BLOCS
                                cuivreBloc = new CuivreBloc(Material.iron).setUnlocalizedName(“cuivrebloc”).setHardness(5.0F).setResistance(10.0F).setCreativeTab(CreativeTabs.tabBlock);
                                limonBloc = new LimonBloc(Material.ground).setUnlocalizedName(“limonbloc”).setHardness(0.5F).setCreativeTab(CreativeTabs.tabBlock);
                                limonMouilleBloc = new LimonMouilleBloc(Material.ground).setUnlocalizedName(“limonmouillebloc”).setHardness(0.6F).setCreativeTab(CreativeTabs.tabBlock);
                                briqueCrueBloc = new BriqueCrueBloc(Material.ground).setUnlocalizedName(“briquecruebloc”).setHardness(1.5F).setResistance(10.0F).setCreativeTab(CreativeTabs.tabBlock);
                                copperOreBlock = new CopperOreBlock(Material.rock).setUnlocalizedName(“copperoreblock”).setHardness(3.0F).setResistance(5.0F).setCreativeTab(CreativeTabs.tabBlock);
                                hieroglyphBlock = new HieroglyphBlock().setUnlocalizedName(“hieroglyphblock”).setHardness(1.5F).setResistance(10.0F).setCreativeTab(CreativeTabs.tabBlock);
                                hieroglyphBlock2 = new HieroglyphBlock2().setUnlocalizedName(“hieroglyphblock2”).setHardness(1.5F).setResistance(10.0F).setCreativeTab(CreativeTabs.tabBlock);
                                blockBarley = new BlockBarley().setUnlocalizedName(“blockBarley”);

                        //BlocsRegistry
                                GameRegistry.registerBlock(cuivreBloc, “cuivre_bloc”);
                                GameRegistry.registerBlock(limonBloc, “limon_bloc”);
                                GameRegistry.registerBlock(limonMouilleBloc, “limon_mouille_bloc”);
                                GameRegistry.registerBlock(briqueCrueBloc, “brique_crue_bloc”);
                                GameRegistry.registerBlock(copperOreBlock, “copper_ore_block”);
                                GameRegistry.registerBlock(hieroglyphBlock, “hieroglyph_block”);
                                GameRegistry.registerBlock(hieroglyphBlock2, “hieroglyph_block2”);
                                GameRegistry.registerBlock(blockBarley, “barley_block”);

                        }

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

                        if(event.getSide().isClient())
                                        {

                        MinecraftForge.EVENT_BUS.register(new LivingEventHandler());
                                    proxy.registerRender();

                        //Textures
                                            //Items Enregistrés
                                            //Items Armor
                                            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”));   
                                            //Items Tools
                                            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”));
                                            //Items Food
                                            Minecraft.getMinecraft().getRenderItem().getItemModelMesher().register(fig, 0, new ModelResourceLocation(“modegypte:fig”, “inventory”));
                                            //Items Material
                                            Minecraft.getMinecraft().getRenderItem().getItemModelMesher().register(cuivreLingot, 0, new ModelResourceLocation(“modegypte:cuivre_Lingot”, “inventory”));
                                            Minecraft.getMinecraft().getRenderItem().getItemModelMesher().register(barleyy, 0, new ModelResourceLocation(“modegypte:barleyy”, “inventory”));

                        Minecraft.getMinecraft().getRenderItem().getItemModelMesher().register(barleySeeds, 0, new ModelResourceLocation(“modegypte:barley_seeds”, “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”));
                                            Minecraft.getMinecraft().getRenderItem().getItemModelMesher().register(Item.getItemFromBlock(copperOreBlock), 0, new ModelResourceLocation(“modegypte:copper_ore_block”, “inventory”));
                                            Minecraft.getMinecraft().getRenderItem().getItemModelMesher().register(Item.getItemFromBlock(hieroglyphBlock), 0, new ModelResourceLocation(“modegypte:hieroglyph_block”, “inventory”));
                                            Minecraft.getMinecraft().getRenderItem().getItemModelMesher().register(Item.getItemFromBlock(hieroglyphBlock2), 0, new ModelResourceLocation(“modegypte:hieroglyph_block2”, “inventory”));
                                            Minecraft.getMinecraft().getRenderItem().getItemModelMesher().register(Item.getItemFromBlock(blockBarley), 0, new ModelResourceLocation(“modegypte:Barley”, “inventory”));

                        //CRAFTS
                                       //Crafting Table
                                         //Recipes Blocks
                                            GameRegistry.addRecipe(new ItemStack(cuivreBloc), new Object[]{“XXX”, “XXX”, “XXX”, ‘X’, new ItemStack(cuivreLingot)});
                                         //Recipes Tools
                                            GameRegistry.addRecipe(new ItemStack(copperSword), new Object[]{“X”, “X”, “S”, ‘X’, new ItemStack(cuivreLingot), ‘S’ , Items.stick});
                                            GameRegistry.addRecipe(new ItemStack(copperAxe), new Object[]{"XX “, “XS “, " S “, ‘X’, new ItemStack(cuivreLingot), ‘S’ , Items.stick});
                                            GameRegistry.addRecipe(new ItemStack(copperAxe), new Object[]{” XX”, " XS”, "  S”, ‘X’, new ItemStack(cuivreLingot), ‘S’ , Items.stick});
                                            GameRegistry.addRecipe(new ItemStack(copperPickaxe), new Object[]{“XXX”, " S ", " S ", ‘X’, new ItemStack(cuivreLingot), ‘S’ , Items.stick});
                                            GameRegistry.addRecipe(new ItemStack(copperShovel), new Object[]{“X”, “S”, “S”, ‘X’, new ItemStack(cuivreLingot), ‘S’ , Items.stick});
                                            GameRegistry.addRecipe(new ItemStack(copperHoe), new Object[]{“XX “, " S “, " S “, ‘X’, new ItemStack(cuivreLingot), ‘S’ , Items.stick});
                                            GameRegistry.addRecipe(new ItemStack(copperHoe), new Object[]{” XX”, "  S”, "  S”, ‘X’, new ItemStack(cuivreLingot), ‘S’ , Items.stick});
                                         // Recipes Armors
                                            GameRegistry.addRecipe(new ItemStack(copperHelmet, 1), new Object[]{“XXX”, “X X”, ‘X’, new ItemStack(cuivreLingot)});
                                            GameRegistry.addRecipe(new ItemStack(copperChestPlate, 1), new Object[]{“X X”, “XXX”, “XXX”, ‘X’, new ItemStack(cuivreLingot)});
                                            GameRegistry.addRecipe(new ItemStack(copperLeggings, 1), new Object[]{“XXX”, “X X”, “X X”, ‘X’, new ItemStack(cuivreLingot)});
                                            GameRegistry.addRecipe(new ItemStack(copperBoots, 1), new Object[]{“X X”, “X X”, ‘X’, new ItemStack(cuivreLingot)});                   
                                         //Recipes Materials
                                         //Recipes Decorations
                                  //Furnace
                                            GameRegistry.addSmelting(copperOreBlock, new ItemStack(cuivreLingot), 0.6F);

                        MinecraftForge.addGrassSeed(new ItemStack(barleySeeds), 10);

                        //GenerationRegistry
                                            GameRegistry.registerWorldGenerator(new OreGenerator(copperOreBlock), 0);

                        }
                            }

                        @EventHandler
                            public void postInit(FMLPostInitializationEvent event)
                            {

                        }
                        %(#33cc33)[}

                        
                        J'ai donc mis:
                        barleySeeds = new ItemSeeds(blockBarley, Blocks.farmland).setUnlocalizedName("barleySeed");
                        
                        Mais rien n'y fait!
                        
                        Voici le log:
                        http://www.cjoint.com/c/FEpniqgDaRk

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

                        1 réponse Dernière réponse Répondre Citer 0
                        • robin4002R Hors-ligne
                          robin4002 Moddeurs confirmés Rédacteurs Administrateurs
                          dernière édition par

                          Le problème est que ton item est initialisé avant ton bloc.
                          Du-coup le bloc est encore null lors de l’initialisation de l’item.

                          1 réponse Dernière réponse Répondre Citer 1
                          • BrokenSwingB Hors-ligne
                            BrokenSwing Moddeurs confirmés Rédacteurs
                            dernière édition par

                            Essaie d’instancier blocBarley avant la graine
                            EDIT : Ah, bah j’ai mis trop de temps à vérifier ce que j’avançais 😛

                            1 réponse Dernière réponse Répondre Citer 1
                            • VoraXV Hors-ligne
                              VoraX
                              dernière édition par

                              HEIN?!! Je suis étonné que ça marche dis-donc. Ah je ne dis pas que je ne suis pas content, au contraire!
                              Même si le problème est résolu, expliquez moi:
                              Pourquoi juste le simple fait d’initialiser le bloc avant la graine est si crucial à leur bon fonctionnement?

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

                              1 réponse Dernière réponse Répondre Citer 0
                              • robin4002R Hors-ligne
                                robin4002 Moddeurs confirmés Rédacteurs Administrateurs
                                dernière édition par

                                Je t’ai déjà expliqué pourquoi :
                                @‘robin4002’:

                                Le problème est que ton item est initialisé avant ton bloc.
                                Du-coup le bloc est encore null lors de l’initialisation de l’item.

                                Le bloc est null donc -> NullPointerException

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

                                  Oui j’avais lu. Mais bon c’est pas grave.
                                  Mes remerciements à tous, sujet clos!

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

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

                                  MINECRAFT FORGE FRANCE © 2024

                                  Powered by NodeBB