Problème texture plante cultivable et lang
-
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.briqueCrueBlocC’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? -
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
-
Oui j’avais lu. Mais bon c’est pas grave.
Mes remerciements à tous, sujet clos!