Problème Mob
-
Ah oui effectivement, mais comme il est sur serveur, elle n’est appelée que la première fois, et en plus ça plante à la preinit.
-
Il y a aussi un autre soucis dans la fonction init de la classe principale.
Beaucoup de fonctions se trouvent à l’intérieur de la condition «if(event.getSide().isClient())» alors qu’il ne devrait pas y être. (les GameRegistry, le BiomeManager.addBiome, etc …). -
Bon, ça m’a l’air d’être une vraie prise de tête tout ça, mais je tiens à ce que ça marche en multi, alors j’ai essayé de fixer ça, j’ai mis:
Classe Principale ‘ModEgypte.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.entity.EntityLiving; import net.minecraft.entity.EntitySpawnPlacementRegistry; import net.minecraft.entity.EnumCreatureType; import net.minecraft.init.Blocks; import net.minecraft.init.Items; import net.minecraft.item.Item; import net.minecraft.item.ItemSeedFood; 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.minecraft.world.biome.BiomeGenBase; import net.minecraft.world.biome.BiomeGenDesert; import net.minecraft.world.biome.BiomeGenPlains; import net.minecraftforge.client.gui.ForgeGuiFactory.ForgeConfigGui.AddModOverrideEntry; import net.minecraftforge.common.BiomeManager; import net.minecraftforge.common.MinecraftForge; import net.minecraftforge.common.BiomeManager.BiomeEntry; import net.minecraftforge.common.BiomeManager.BiomeType; 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, barleyBread, onion; public static Block cuivreBloc, limonBloc, limonMouilleBloc, briqueCrueBloc, copperOreBlock, hieroglyphBlock, hieroglyphBlock2, blockBarley, blockOnion, datePalmBlock; 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) { ModMetadata data = event.getModMetadata(); data.autogenerated = false; data.name = EnumChatFormatting.GOLD + "EgyptMod"; data.description = EnumChatFormatting.YELLOW + "Who does not want to end up in Ancient Egypt? Immerse yourself in ancient Egypt! Quick! Go find a village, adventure awaits!"; data.credits = EnumChatFormatting.LIGHT_PURPLE + "Special thanks to Forge team and MFF," + EnumChatFormatting.DARK_RED + "Wilza," + EnumChatFormatting.LIGHT_PURPLE + "Sowelo, Anderov, and Fab1us."; data.logoFile = "assets/modegypte/textures/logo/logo.png"; data.url = EnumChatFormatting.AQUA + "Comming Soon (Really, this is not a joke!) !"; //BLOCS cuivreBloc = new CuivreBloc(Material.iron).setUnlocalizedName("cuivrebloc").setHardness(5.0F).setResistance(10.0F).setCreativeTab(CreativeTabs.tabBlock); limonBloc = new LimonBloc(Material.sand).setUnlocalizedName("limonbloc").setHardness(1.15F).setResistance(10.0F).setCreativeTab(CreativeTabs.tabBlock); limonMouilleBloc = new LimonMouilleBloc(Material.ground).setUnlocalizedName("limonmouillebloc").setHardness(0.6F).setCreativeTab(CreativeTabs.tabBlock); briqueCrueBloc = new BriqueCrueBloc(Material.rock).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"); blockOnion = new BlockOnion().setUnlocalizedName("blockOnion"); datePalmBlock = new DatePalmBlock(Material.wood).setUnlocalizedName("datepalmblock").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(blockBarley, "barley_block"); GameRegistry.registerBlock(blockOnion, "onion_block"); GameRegistry.registerBlock(datePalmBlock, "date_palm_block"); //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); barleyBread = new BarleyBread(5, false).setUnlocalizedName("barleyBread").setCreativeTab(CreativeTabs.tabFood); onion = new ItemSeedFood(6, 9, blockOnion, Blocks.farmland).setUnlocalizedName("onion").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"); GameRegistry.registerItem(barleyBread, "barley_Bread"); GameRegistry.registerItem(onion, "onion"); //Itemsregistry Material GameRegistry.registerItem(cuivreLingot, "cuivre_Lingot"); GameRegistry.registerItem(barleyy, "barleyy"); GameRegistry.registerItem(barleySeeds, "barley_seeds"); } @EventHandler public void Init(FMLInitializationEvent event) { proxy.registerRender(); //CHANGEMENT PROVISOIRE DEBUT–----------------------------------------- //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")); Minecraft.getMinecraft().getRenderItem().getItemModelMesher().register(barleyBread, 0, new ModelResourceLocation("modegypte:barley_Bread", "inventory")); Minecraft.getMinecraft().getRenderItem().getItemModelMesher().register(onion, 0, new ModelResourceLocation("modegypte:onion", "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")); Minecraft.getMinecraft().getRenderItem().getItemModelMesher().register(Item.getItemFromBlock(blockOnion), 0, new ModelResourceLocation("modegypte:block_onion", "inventory")); Minecraft.getMinecraft().getRenderItem().getItemModelMesher().register(Item.getItemFromBlock(datePalmBlock), 0, new ModelResourceLocation("modegypte:date_palm_block", "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); //WorldGeneratorRegistry GameRegistry.registerWorldGenerator(new OreGenerator(copperOreBlock), 0); //BiomeGeneratorRegistry BiomeManager.addBiome(BiomeType.DESERT, new BiomeEntry(new EgyptBiome(), 10)); // //EntityCreator.createEntity(EntityBeaf.class, new RenderBeaf(), "Beaf", EnumCreatureType.CREATURE, 10, 1, 5, new BiomeGenBase[] {BiomeGenBase.desert} , 0xBF6437, 0xF5E8D3, true); MinecraftForge.EVENT_BUS.register(new Events()); //CHANGEMENT PROVISOIRE FIN-------------------------------------------------- if(event.getSide().isClient()) { MinecraftForge.EVENT_BUS.register(new LivingEventHandler()); } } @EventHandler public void postInit(FMLPostInitializationEvent event) { } }
Les commentaires changements provisoires signifient juste que j’ai déplacé un gros pavé qui selon Robin, n’avait rien à faire dans ‘[font=Ubuntu, sans-serifif(event.getSide().isClient())’ .]
[font=Ubuntu, sans-serifJ’ai aussi viré un ‘proxy][font=monospace.][font=monospaceregisterRender’ dans la classe principale.]
J’ai donc essayé de lancer le serveur, et ça plante, alors que je n’ai pas “activé” le mob dans ma classe ‘ClientProxy’ :
package fr.vorax.egypte.proxy; import fr.vorax.egypte.common.EntityBeaf; import fr.vorax.egypte.common.RenderBeaf; import net.minecraft.client.Minecraft; import net.minecraft.client.model.ModelBiped; import net.minecraftforge.fml.client.registry.RenderingRegistry; public class ClientProxy extends CommonProxy { @Override public void registerRender() { System.out.println("Méthode côté client"); //RenderingRegistry.registerEntityRenderingHandler(EntityBeaf.class, new RenderBeaf()); } }
En ce qui concerne les ‘net.minecraft.client.renderer.entity.Render’ j’utilise ça dans:
‘RenderBeaf.java’
package fr.vorax.egypte.common; import net.minecraft.client.Minecraft; import net.minecraft.client.model.ModelBase; import net.minecraft.client.renderer.entity.RenderLiving; import net.minecraft.client.renderer.entity.RenderManager; import net.minecraft.entity.Entity; import net.minecraft.util.ResourceLocation; public class RenderBeaf extends RenderLiving { public RenderBeaf() { super(Minecraft.getMinecraft().getRenderManager(), new ModelBeaf(), 0); } @Override protected ResourceLocation getEntityTexture(Entity entity) { return new ResourceLocation("ModEgypte", "textures/entity/beaf.png"); } }
‘EntityCreator’
%(#9999ff)[```java
package fr.vorax.egypte.common;
]import net.minecraft.client.renderer.entity.Render;
import net.minecraft.entity.EntityList;
import net.minecraft.entity.EnumCreatureType;
import net.minecraft.world.biome.BiomeGenBase;
import net.minecraft.world.chunk.Chunk.EnumCreateEntityType;
import net.minecraftforge.fml.client.registry.RenderingRegistry;
import net.minecraftforge.fml.common.registry.EntityRegistry;public class EntityCreator
{
public static final void createEntity(Class entityClass, Render render, String entityName, EnumCreatureType type, int probability, int minSpawn, int maxSpawn, BiomeGenBase[] biomes, int solidColor, int spotColor, boolean hasSpawnEgg)
{
int id = EntityRegistry.findGlobalUniqueEntityId();EntityRegistry.registerGlobalEntityID(entityClass, entityName, id);
EntityRegistry.registerModEntity(entityClass, entityName, id, ModEgypte.instance, 64, 1, true);
EntityRegistry.addSpawn(entityName, probability, minSpawn, maxSpawn, type, biomes);
RenderingRegistry.registerEntityRenderingHandler(entityClass, render);if(hasSpawnEgg)
{
EntityList.entityEggs.put(Integer.valueOf(id), new EntityList.EntityEggInfo(id, solidColor, spotColor));
}
}
%(#9999ff)[}Voici donc le log du serveur: http://www.cjoint.com/c/FEtrijvsqGk Et mon arborescence: http://www.cjoint.com/c/FEtrg7maPGk Note: Le client fonctionne.
-
C’est la méthode createEntity de la class EntityCreator qui pose problème car tu enregistre déjà le rendu de ton entité dans ton ClientProxy.
-
registerGlobalEntityID n’est plus nécessaire en 1.8.
Le plus simple serait que tu envoies un zip de ton dossier src, je regarderai de mon côté.
-
Hm d’accord. C’est vrai que ça a l’air compliqué de régler tout ça avec ma jeune expérience. Je vais envoyer ça.
-
Le problème vient de l’enregistrement du mob.
Il faut faire comme ceci :EntityRegistry.registerModEntity(EntityBeaf.class, "Beaf", 0, ModEgypte.instance, 64, 1, true); EntityRegistry.addSpawn(EntityBeaf.class, 10, 1, 5, EnumCreatureType.CREATURE, new BiomeGenBase[] {BiomeGenBase.desert}); EntityRegistry.registerEgg(EntityBeaf.class, 0xBF6437, 0xF5E8D3);
Et dans le client proxy :
RenderingRegistry.registerEntityRenderingHandler(EntityBeaf.class, new RenderBeaf());
Et du-coup supprimes la classe EntityCreator.
J’ai bien galéré à trouver le problème, il a fallu que je commente le code par bloc et que je lance le jeu à chaque fois pour regarder si ça crashait toujours. -
Robin, t’es pas sérieux, là?
@‘Superloup10’:
C’est la méthode createEntity de la class EntityCreator qui pose problème car tu enregistre déjà le rendu de ton entité dans ton ClientProxy.
-
Ta justification n’est pas bonne.
C’est pas parce que le rendu était enregistré en double que ça crashait mais parce que le rendu était enregistré sur la partie commune du mod.
C’est pour ça que je n’avais pas fait attention à ton message. -
Ok
-
Je rajoute pour les oeufs, il suffit de rajouter les 2 couleurs à la suite des arguments de registerModEntity et on peut enlever la ligne registerEgg, c’est tt aussi bien et ça économise de la place.
Envoyé de mon RAINBOW LITE 4G en utilisant Tapatalk
-
Ma modification (déplacement du gros pavé) a-t’elle fait en sorte que tout soit bien placé?
Le mob fonctionne en solo, j’ai supprimé la classe EntityCreator. Mais en multijoueur, c’est toujours la même histoire.
J’ai suivi comme j’ai pu:Classe principale:
@EventHandler public void Init(FMLInitializationEvent event) { proxy.registerRender(); //CHANGEMENT PROVISOIRE DEBUT–----------------------------------------- //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")); Minecraft.getMinecraft().getRenderItem().getItemModelMesher().register(barleyBread, 0, new ModelResourceLocation("modegypte:barley_Bread", "inventory")); Minecraft.getMinecraft().getRenderItem().getItemModelMesher().register(onion, 0, new ModelResourceLocation("modegypte:onion", "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")); Minecraft.getMinecraft().getRenderItem().getItemModelMesher().register(Item.getItemFromBlock(blockOnion), 0, new ModelResourceLocation("modegypte:block_onion", "inventory")); Minecraft.getMinecraft().getRenderItem().getItemModelMesher().register(Item.getItemFromBlock(datePalmBlock), 0, new ModelResourceLocation("modegypte:date_palm_block", "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); //WorldGeneratorRegistry GameRegistry.registerWorldGenerator(new OreGenerator(copperOreBlock), 0); //BiomeGeneratorRegistry BiomeManager.addBiome(BiomeType.DESERT, new BiomeEntry(new EgyptBiome(), 10)); // EntityRegistry.registerModEntity(EntityBeaf.class, "Beaf", 0, ModEgypte.instance, 64, 1, true); EntityRegistry.addSpawn(EntityBeaf.class, 10, 1, 5, EnumCreatureType.CREATURE, new BiomeGenBase[] {BiomeGenBase.desert}); EntityRegistry.registerEgg(EntityBeaf.class, 0xBF6437, 0xF5E8D3); MinecraftForge.EVENT_BUS.register(new Events()); //CHANGEMENT PROVISOIRE FIN-------------------------------------------------- if(event.getSide().isClient()) { MinecraftForge.EVENT_BUS.register(new LivingEventHandler()); } } @EventHandler public void postInit(FMLPostInitializationEvent event) { } }
Classe ClientProxy:
package fr.vorax.egypte.proxy; import fr.vorax.egypte.common.EntityBeaf; import fr.vorax.egypte.common.RenderBeaf; import net.minecraft.client.Minecraft; import net.minecraft.client.model.ModelBiped; import net.minecraftforge.fml.client.registry.RenderingRegistry; public class ClientProxy extends CommonProxy { @Override public void registerRender() { System.out.println("Méthode côté client"); RenderingRegistry.registerEntityRenderingHandler(EntityBeaf.class, new RenderBeaf()); } }