Résolu Problème texture plante cultivable et lang
-
[font=Ubuntu, sans-serifJe suis sur Eclipse avec forge-1.8.9-11.15.1.1722-mdk .]
[font=Ubuntu, sans-serifBonjour, j’essaie de faire pousser ma première plante cultivable, l’orge (barley en Anglais).]
[font=Ubuntu, sans-serifAlors voilà, en survie, je casse des blocs d’herbe qui dropent les graines de barley avec la texture de l’item.]
[font=Ubuntu, sans-serifEnsuite, je laboure la terre près de l’eau à la houe.][font=Ubuntu, sans-serifC’est là que les problèmes commencent:]
[font=Ubuntu, sans-serif- Quand je plante une graine de barley, un bloc noir et violet apparaît. Il n’y a donc pas de texture. Pourtant, utiliser la poudre d’os fait des étoiles vertes sur le bloc qui est donc reconnu en tant que plante (je suppose).]
[font=Ubuntu, sans-serif- Les graines de barley sont nommées ‘item.null.name’ dans l’inventaire. Etrange, ça devrait être barleyseeds ou quelque chose du genre.]Heureusement, quand je teste un avec un item à droper, le “fruit” une fois la plante à maturité cassée se drope bien.
[font=Ubuntu, sans-serifComme il y a 7 formes de croissance, je ne vais mettre que 2 jsons parmis les 7.]
[font=Ubuntu, sans-serifLe schéma est le suivant Dossier-> Dossier->Fichier.]
[font=Ubuntu, sans-serifVoici tout ce qui est relatif à l’orge, items comme blocs:]Classe Principale:
[font=Ubuntu, sans-serif```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.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.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;public static Block cuivreBloc, limonBloc, limonMouilleBloc, briqueCrueBloc, copperOreBlock, hieroglyphBlock;
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
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”);
//Materials 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);//GenerationRegistry
//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(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);//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(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);
}
}@EventHandler
public void postInit(FMLPostInitializationEvent event)
{}
}[font=Ubuntu, sans-serifClasse BlockBarley: [font=Ubuntu, sans-serif```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.BarleySeeds; } [font=Ubuntu, sans-serif} ```] Les json: [font=Ubuntu, sans-serifmodegypte->blockstates->barley] [font=Ubuntu, sans-serif```java { ] "variants": { "age=0": { "model": "modegypte:barley_0" }, "age=1": { "model": "modegypte:barley_1" }, "age=2": { "model": "modegypte:barley_2" }, "age=3": { "model": "modegypte:barley_3" }, "age=4": { "model": "modegypte:barley_4" }, "age=5": { "model": "modegypte:barley_5" }, "age=6": { "model": "modegypte:barley_6" }, "age=7": { "model": "modegypte:barley_7" } } [font=Ubuntu, sans-serif} ```] [font=Ubuntu, sans-serifmodegypte->][font=Ubuntu, sans-serifmodels->item->barley] [font=Ubuntu, sans-serif```java { ] "parent": "block/crop", "display": { "thirdperson": { "rotation": [ 10, -45, 170 ], "translation": [ 0, 1.5, -2.75 ], "scale": [ 0.375, 0.375, 0.375 ] } } [font=Ubuntu, sans-serif} ```] [font=Ubuntu, sans-serifmodegypte->][color=#333333models->item->barley_seeds] [font=Ubuntu, sans-serif```java { ] "parent": "builtin/generated", "textures": { "layer0": "modegypte:items/barley_seeds" }, "display": { "thirdperson": { "rotation": [ -90, 0, 0 ], "translation": [ 0, 1, -3 ], "scale": [ 0.55, 0.55, 0.55 ] }, "firstperson": { "rotation": [ 0, -135, 25 ], "translation": [ 0, 4, 2 ], "scale": [ 1.7, 1.7, 1.7 ] } } [font=Ubuntu, sans-serif} ```] [font=Ubuntu, sans-serifmodegypte->models->block->barley_0] [font=Ubuntu, sans-serif```java { ] "parent": "block/crop", "textures": { "crop": "modegypte:blocks/barley_0" } [font=Ubuntu, sans-serif} ```] [font=Ubuntu, sans-serifmodegypte->][font=Ubuntu, sans-serifmodels->][font=Ubuntu, sans-serifblock->]barley_1 (Jusqu'à 7…) [font=Ubuntu, sans-serif```java { ] "parent": "block/crop", "textures": { "crop": "modegypte:blocks/barley_1" } [font=Ubuntu, sans-serif} ```] [font=Ubuntu, sans-serifLes png:] [font=Ubuntu, sans-serifmodegypte->textures->items->barley_seeds.png] [font=Ubuntu, sans-serifmodegypte->textures->blocks->barley_0] [font=Ubuntu, sans-serifmodegypte->][font=Ubuntu, sans-seriftextures->][font=Ubuntu, sans-serifblocks->][font=Ubuntu, sans-serifbarley_1 (Jusqu'à 7…)] [font=Ubuntu, sans-serifLog:] [font=Ubuntu, sans-serifhttp://www.cjoint.com/c/FEnxsuz4Dkk] [font=Ubuntu, sans-serifMerci d'avance à ce qui voudront bien remédier à tous ces problèmes.]
-
Il semblerait que tu as fait des erreurs dans les noms:
Tu enregistres ton nom avec le nom ‘barley_block’ alors que ton fichier .json pour le modèle est juste nommé ‘barley’
-
Pour le nom de l’item avec null, c’est normal, tu n’a pas fais .setUnlocalizedName(“Quelque chose”) donc de base, ça met null.
Ensuite, je ne comprend pas pourquoi tu n’a pas preinitialisé cet item avec les autres dans la fonction preInit. -
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?] -
Lors de l’instanciation de la graine de barley il faut que tu mette dans le contructeur :
this.setUnlocalizedName("leNom");
-
@‘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?]Normal, ta classe se nomme “BlockBarley”, pas “[font=Ubuntu, sans-serifBarleyy” (tu as mis deux “y”).]
[font=Ubuntu, sans-serifSinon cette méthode marche et celle de BrokenSwing aussi (perso je préfère celle que t’a utilisée, car au moins on a tous les noms de tous les blocks au même endroit).] -
Oulala je suis complètement perdu… Je n’y comprends rien à rien…
Il faut savoir que barleyy représente le “fruit” de la récolte de la plante une fois mature.Il faudrait me dire les étapes en clair, parce que j’ai beau créer une classe pour les graines de barley et y mettre un constructeur dedans qui me met tout et n’importe quoi, rien ne fonctionne.
J’essaie de mettre ‘this.setUnlocalizedName(“leNom”);’ dans le constructeur de la classe des graines de barley (créée via clic droit->nouvelle classe dans l’arborescence), mais c’est carrément n’importe quoi.Il faudrait m’énoncer les étapes au clair, car je suis dur de compréhension, ça serait mieux. J’ai bien envie de chercher un peu (quoique, j’ai énormément recherché ces derniers temps pour en arriver à ce que je sais faire), mais là, je n’y arrive pas du tout.
-
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();
-
[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); -
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");
-
@‘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.
-
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”);
-
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
-
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
-
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)] -
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
-
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
-
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. -
Essaie d’instancier blocBarley avant la graine
EDIT : Ah, bah j’ai mis trop de temps à vérifier ce que j’avançais -
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?