Résolu Problème de json
-
Wouuuuuhou , j’aimais déjà pas les jsons mais alors la je les détèstes , je cherche a render mes items ( pour l’instant il sont enregistrer et apparaissent sous forme de cube rose/noir.
Cependant impossible de load les jsons
Voici mes classes :
ClientProxy :
package mod.client; import net.minecraft.block.Block; import net.minecraft.client.Minecraft; import net.minecraft.client.model.ModelBiped; import net.minecraft.client.renderer.ItemModelMesher; import net.minecraft.client.renderer.entity.RenderItem; import net.minecraft.client.resources.model.ModelResourceLocation; import net.minecraft.item.Item; import net.minecraft.tileentity.TileEntity; import net.minecraftforge.fml.client.registry.ClientRegistry; import net.minecraftforge.fml.client.registry.RenderingRegistry; import mod.DinoCraft; import mod.client.model.ModelBrachiosaurus; import mod.client.model.ModelCoelophysis; import mod.client.model.ModelFrog; import mod.client.model.ModelTriceratops; import mod.client.model.ModelVelociraptors; import mod.client.render.RenderBrachiosaurus; import mod.client.render.RenderCoelophysis; import mod.client.render.RenderFlechette; import mod.client.render.RenderFrog; import mod.client.render.RenderTriceratops; import mod.client.render.RenderVelociraptors; import mod.client.render.TESRInventoryRenderer; import mod.common.CommonProxy; import mod.common.block.BlockRegister; import mod.common.block.entity.TileEntityAnalyzer; import mod.common.block.entity.TileEntityBarriere; import mod.common.block.entity.TileEntityBarriereSpecialRenderer; import mod.common.block.entity.TileEntityCombiner; import mod.common.block.entity.TileEntityCombinerSpecialRenderer; import mod.common.block.entity.TileEntityCouveuse; import mod.common.block.entity.TileEntityCouveuseSpecialRenderer; import mod.common.block.entity.TileEntityEgg; import mod.common.block.entity.TileEntityEggSpecialRenderer; import mod.common.block.entity.TileEntityExtractor; import mod.common.block.entity.TileEntityExtractorSpecialRenderer; import mod.common.entity.EntityBrachiosaurus; import mod.common.entity.EntityCoelophysis; import mod.common.entity.EntityFlechette; import mod.common.entity.EntityFrog; import mod.common.entity.EntityTriceratops; import mod.common.entity.EntityVelociraptors; import mod.common.item.ItemRegister; public class ClientProxy extends CommonProxy { public static int tesrRenderId; @Override public void register() { ItemModelMesher mesher = Minecraft.getMinecraft().getRenderItem().getItemModelMesher(); System.out.println("Rendering Entity/TileEntity"); /*RenderingRegistry.registerEntityRenderingHandler(EntityFlechette.class, new RenderFlechette(null, 0.0F, null)); RenderingRegistry.registerEntityRenderingHandler(EntityFrog.class, new RenderFrog(new ModelFrog(), 0.5F, null)); RenderingRegistry.registerEntityRenderingHandler(EntityBrachiosaurus.class, new RenderBrachiosaurus(new ModelBrachiosaurus(), 3.5F, null)); RenderingRegistry.registerEntityRenderingHandler(EntityCoelophysis.class, new RenderCoelophysis(new ModelCoelophysis(), 3.5F, null)); RenderingRegistry.registerEntityRenderingHandler(EntityTriceratops.class, new RenderTriceratops(new ModelTriceratops(), 3.5F, null)); RenderingRegistry.registerEntityRenderingHandler(EntityVelociraptors.class, new RenderVelociraptors(new ModelVelociraptors(), 3.5F, null)); ClientRegistry.bindTileEntitySpecialRenderer(TileEntityBarriere.class, new TileEntityBarriereSpecialRenderer()); ClientRegistry.bindTileEntitySpecialRenderer(TileEntityEgg.class, new TileEntityEggSpecialRenderer()); ClientRegistry.bindTileEntitySpecialRenderer(TileEntityCouveuse.class, new TileEntityCouveuseSpecialRenderer()); ClientRegistry.bindTileEntitySpecialRenderer(TileEntityExtractor.class, new TileEntityExtractorSpecialRenderer()); ClientRegistry.bindTileEntitySpecialRenderer(TileEntityCombiner.class, new TileEntityCombinerSpecialRenderer()); /* tesrRenderId = RenderingRegistry.getNextAvailableRenderId(); RenderingRegistry.registerBlockHandler(new TESRInventoryRenderer()); */ System.out.println("Rendering Items"); mesher.register(ItemRegister.itemADNofFrog, 0, new ModelResourceLocation(DinoCraft.MODID + ":itemADNofFrog", "inventory")); mesher.register(ItemRegister.itemADNofmosquito, 0, new ModelResourceLocation(DinoCraft.MODID + ":itemADNofmosquito", "inventory")); mesher.register(ItemRegister.itemADNofvelociraptors, 0, new ModelResourceLocation(DinoCraft.MODID + ":itemADNofvelociraptors", "inventory")); mesher.register(ItemRegister.itemAmbre, 0, new ModelResourceLocation(DinoCraft.MODID + ":itemAmbre", "inventory")); mesher.register(ItemRegister.itemAmbrewithmosquito, 0, new ModelResourceLocation(DinoCraft.MODID + ":itemAmbrewithmosquito", "inventory")); mesher.register(ItemRegister.itemBloodofmosquito, 0, new ModelResourceLocation(DinoCraft.MODID + ":itemBloodofmosquito", "inventory")); mesher.register(ItemRegister.itemBlowGun, 0, new ModelResourceLocation(DinoCraft.MODID + ":itemBlowgun", "inventory")); mesher.register(ItemRegister.itemCPU, 0, new ModelResourceLocation(DinoCraft.MODID + ":itemCPU", "inventory")); mesher.register(ItemRegister.itemDart, 0, new ModelResourceLocation(DinoCraft.MODID + ":itemDart", "inventory")); mesher.register(ItemRegister.itemDartEmpty, 0, new ModelResourceLocation(DinoCraft.MODID + ":itemDartEmpty", "inventory")); mesher.register(ItemRegister.itemEnhancer, 0, new ModelResourceLocation(DinoCraft.MODID + ":itemEnhancer", "inventory")); mesher.register(ItemRegister.itemFrogLegs, 0, new ModelResourceLocation(DinoCraft.MODID + ":itemFrogLegs", "inventory")); mesher.register(ItemRegister.itemFrogLegsCooked, 0, new ModelResourceLocation(DinoCraft.MODID + ":itemFrogLegsCooked", "inventory")); mesher.register(ItemRegister.itemSap, 0, new ModelResourceLocation(DinoCraft.MODID + ":itemSap", "inventory")); mesher.register(ItemRegister.itemSapwithmosquito, 0, new ModelResourceLocation(DinoCraft.MODID + ":itemSapwithmosquito", "inventory")); mesher.register(ItemRegister.itemSuperAxe, 0, new ModelResourceLocation(DinoCraft.MODID + ":itemSuperAxe", "inventory")); mesher.register(ItemRegister.itemSyringe, 0, new ModelResourceLocation(DinoCraft.MODID + ":itemSyringe", "inventory")); mesher.register(ItemRegister.itemSyringewithblood, 0, new ModelResourceLocation(DinoCraft.MODID + ":itemSyringewithblood", "inventory")); mesher.register(ItemRegister.itemSyringewithraptorblood, 0, new ModelResourceLocation(DinoCraft.MODID + ":itemSyringewithraptorblood", "inventory")); mesher.register(ItemRegister.itemZoom, 0, new ModelResourceLocation(DinoCraft.MODID + ":itemZoom", "inventory")); } }
Classe principale :
package mod; import java.util.HashMap; import mod.client.TickClient.TickClientHandlerEvent; import mod.common.CommonProxy; import mod.common.block.BlockRegister; import mod.common.block.entity.RegisterTileEntity; import mod.common.block.gui.GuiHandler; import mod.common.block.recipe.RecipeRegisterBlock; import mod.common.entity.EntityRegister; import mod.common.item.ItemRegister; import mod.common.item.recipe.RecipeRegister; import mod.common.world.biome.BiomeRegister; import mod.common.world.structure.DimensionRegister; import net.minecraft.entity.EntityList; import net.minecraft.item.Item; import net.minecraftforge.common.MinecraftForge; import net.minecraftforge.fml.common.FMLCommonHandler; 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.ObfuscationReflectionHelper; 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.network.NetworkRegistry; @Mod(modid = DinoCraft.MODID, name = DinoCraft.Name, version = DinoCraft.Version) public class DinoCraft { public static HashMap <class, integer="">maptoid; public static final String MODID = "dinocraft"; public static final String Name = "DinoCraft"; public static final String Version = "1.0"; @Instance("dinocraft") public static DinoCraft instance; @SidedProxy(clientSide = "mod.client.ClientProxy", serverSide = "mod.common.CommonProxy") public static CommonProxy proxy; @EventHandler public void preInit(FMLPreInitializationEvent event) { BlockRegister.register(); ItemRegister.register(); if(event.getSide().isClient()) { FMLCommonHandler.instance().bus().register(new TickClientHandlerEvent()); MinecraftForge.EVENT_BUS.register(new TickClientHandlerEvent()); } } @EventHandler public void init(FMLInitializationEvent event) { RegisterTileEntity.register(); RecipeRegister.register(); RecipeRegisterBlock.register(); BiomeRegister.register(); EntityRegister.register(); proxy.register(); NetworkRegistry.INSTANCE.registerGuiHandler(instance, new GuiHandler()); } @EventHandler public void postInit(FMLPostInitializationEvent event) { /*DimensionRegister.register();*/ maptoid = ObfuscationReflectionHelper.getPrivateValue(EntityList.class, null, "classToIDMapping", "field_75624_e"); } }
Ma classe ItemRegister
package mod.common.item; import mod.DinoCraft; import net.minecraft.creativetab.CreativeTabs; import net.minecraft.item.Item; import net.minecraft.potion.Potion; import net.minecraft.potion.PotionEffect; import net.minecraftforge.common.util.EnumHelper; import net.minecraftforge.fml.common.registry.GameRegistry; public class ItemRegister { public static Item itemDart; public static Item itemBlowGun; public static Item itemSap; public static Item itemSapwithmosquito; public static Item itemFrogLegs; public static Item itemDartEmpty; public static Item itemFrogLegsCooked; public static Item itemSyringe; public static Item itemSyringewithblood; public static Item itemSyringewithraptorblood; public static Item itemADNofFrog; public static Item itemSuperAxe; public static Item itemCPU; public static Item itemAmbre; public static Item itemAmbrewithmosquito; public static Item itemBloodofmosquito; public static Item itemADNofmosquito; public static Item itemZoom; public static Item itemEnhancer; public static Item itemADNofvelociraptors; public static boolean zoom; public static Item.ToolMaterial toolAxe = EnumHelper.addToolMaterial("toolAxe", 2, 400, 12.0F, 4.0F, 18); public static void register() { itemDart = new ItemDart(); itemBlowGun = new ItemBlowGun(); itemSap = new ItemSap(); itemSapwithmosquito = new ItemSapWithMosquito(); itemFrogLegs = new ItemFrogLegs(); itemDartEmpty = new ItemDartEmpty(); itemFrogLegsCooked = new ItemFrogLegsCooked(8, 0.3F, false); itemSyringe = new ItemSyringe(); itemSyringewithblood = new ItemSyringeWithBlood(); itemSyringewithraptorblood = new ItemSyringeWithRaptorBlood(); itemADNofFrog = new ItemADNOfFrog(); itemSuperAxe = new ItemSuperAxe(toolAxe); itemCPU = new ItemCPU(); itemAmbre = new ItemAmber(); itemAmbrewithmosquito = new ItemAmberWithMosquito(); itemBloodofmosquito = new ItemBloodOfMosquito(); itemADNofmosquito = new ItemADNOfMosquito(); itemZoom = new ItemZoom(); itemEnhancer = new ItemEnhancer(); itemADNofvelociraptors = new ItemADNOfVelociraptors(); GameRegistry.registerItem(itemDart, "item_Dart"); GameRegistry.registerItem(itemBlowGun, "item_blowgun"); GameRegistry.registerItem(itemSap, "item_Sap"); GameRegistry.registerItem(itemSapwithmosquito, "item_Sapwithmosquito"); GameRegistry.registerItem(itemFrogLegs, "item_FrogLegs"); GameRegistry.registerItem(itemDartEmpty, "item_DartEmpty"); GameRegistry.registerItem(itemFrogLegsCooked, "item_FrogLegsCooked"); GameRegistry.registerItem(itemSyringe, "item_Syringe"); GameRegistry.registerItem(itemSyringewithblood, "item_SyringeWithBlood"); GameRegistry.registerItem(itemSyringewithraptorblood, "item_SyringeWithRaptorBlood"); GameRegistry.registerItem(itemADNofFrog, "item_ADNofFrog"); GameRegistry.registerItem(itemSuperAxe, "item_SuperAxe"); GameRegistry.registerItem(itemCPU, "item_CPU"); GameRegistry.registerItem(itemAmbre, "item_Ambre"); GameRegistry.registerItem(itemAmbrewithmosquito, "item_Ambrewithmmosquito"); GameRegistry.registerItem(itemBloodofmosquito, "item_Bloodofmosquito"); GameRegistry.registerItem(itemADNofmosquito, "item_ADNofmosquito"); GameRegistry.registerItem(itemZoom, "item_Zoom"); GameRegistry.registerItem(itemEnhancer, "item_Enhancer"); GameRegistry.registerItem(itemADNofvelociraptors, "item_ADNofvelociraptors"); } }
Voila dans la console
[23:05:54] [Client thread/ERROR] [FML]: Model definition for location dinocraft:item_Sap#inventory not found [23:05:54] [Client thread/ERROR] [FML]: Model definition for location dinocraft:item_Ambrewithmmosquito#inventory not found [23:05:54] [Client thread/ERROR] [FML]: Model definition for location dinocraft:block_tronc#normal not found [23:05:54] [Client thread/ERROR] [FML]: Model definition for location dinocraft:block_pousse#stage=1,type=jungle not found [23:05:54] [Client thread/ERROR] [FML]: Model definition for location dinocraft:block_extractor#normal not found [23:05:54] [Client thread/ERROR] [FML]: Model definition for location dinocraft:block_pousse#stage=1,type=dark_oak not found [23:05:54] [Client thread/ERROR] [FML]: Model definition for location dinocraft:block_ambre#inventory not found [23:05:54] [Client thread/ERROR] [FML]: Model definition for location dinocraft:block_pousse#stage=0,type=spruce not found [23:05:54] [Client thread/ERROR] [FML]: Model definition for location dinocraft:block_tronc#inventory not found [23:05:54] [Client thread/ERROR] [FML]: Model definition for location dinocraft:item_blowgun#inventory not found [23:05:54] [Client thread/ERROR] [FML]: Model definition for location dinocraft:block_pousse#stage=0,type=dark_oak not found [23:05:54] [Client thread/ERROR] [FML]: Model definition for location dinocraft:item_SyringeWithRaptorBlood#inventory not found [23:05:54] [Client thread/ERROR] [FML]: Model definition for location dinocraft:block_pousse#inventory not found [23:05:54] [Client thread/ERROR] [FML]: Model definition for location dinocraft:block_pousse#stage=0,type=birch not found [23:05:54] [Client thread/ERROR] [FML]: Model definition for location dinocraft:item_Sapwithmosquito#inventory not found [23:05:54] [Client thread/ERROR] [FML]: Model definition for location dinocraft:item_FrogLegs#inventory not found [23:05:54] [Client thread/ERROR] [FML]: Model definition for location dinocraft:block_eggindominus#normal not found [23:05:54] [Client thread/ERROR] [FML]: Model definition for location dinocraft:block_couveuse#inventory not found [23:05:54] [Client thread/ERROR] [FML]: Model definition for location dinocraft:block_pousse#stage=0,type=jungle not found [23:05:54] [Client thread/ERROR] [FML]: Model definition for location dinocraft:block_feuille#normal not found [23:05:54] [Client thread/ERROR] [FML]: Model definition for location dinocraft:block_combiner#inventory not found [23:05:54] [Client thread/ERROR] [FML]: Model definition for location dinocraft:item_Enhancer#inventory not found [23:05:54] [Client thread/ERROR] [FML]: Model definition for location dinocraft:block_analyzer#normal not found [23:05:54] [Client thread/ERROR] [FML]: Model definition for location dinocraft:block_egg#normal not found [23:05:54] [Client thread/ERROR] [FML]: Model definition for location dinocraft:item_ADNofmosquito#inventory not found [23:05:54] [Client thread/ERROR] [FML]: Model definition for location dinocraft:item_CPU#inventory not found [23:05:54] [Client thread/ERROR] [FML]: Model definition for location dinocraft:block_pousse#stage=1,type=acacia not found [23:05:54] [Client thread/ERROR] [FML]: Model definition for location dinocraft:item_ADNofFrog#inventory not found [23:05:54] [Client thread/ERROR] [FML]: Model definition for location dinocraft:item_Bloodofmosquito#inventory not found [23:05:54] [Client thread/ERROR] [FML]: Model definition for location dinocraft:block_pousse#stage=0,type=oak not found [23:05:54] [Client thread/ERROR] [FML]: Model definition for location dinocraft:block_portail#inventory not found [23:05:54] [Client thread/ERROR] [FML]: Model definition for location dinocraft:block_egg#inventory not found [23:05:54] [Client thread/ERROR] [FML]: Model definition for location dinocraft:block_fossiliser#inventory not found [23:05:54] [Client thread/ERROR] [FML]: Model definition for location dinocraft:item_FrogLegsCooked#inventory not found [23:05:54] [Client thread/ERROR] [FML]: Model definition for location dinocraft:item_Ambre#inventory not found [23:05:54] [Client thread/ERROR] [FML]: Model definition for location dinocraft:block_eggindominus#inventory not found [23:05:54] [Client thread/ERROR] [FML]: Model definition for location dinocraft:block_pousse#stage=1,type=oak not found [23:05:54] [Client thread/ERROR] [FML]: Model definition for location dinocraft:block_feuille#inventory not found [23:05:54] [Client thread/ERROR] [FML]: Model definition for location dinocraft:block_pousse#stage=1,type=spruce not found [23:05:54] [Client thread/ERROR] [FML]: Model definition for location dinocraft:item_Syringe#inventory not found [23:05:54] [Client thread/ERROR] [FML]: Model definition for location dinocraft:item_SuperAxe#inventory not found [23:05:54] [Client thread/ERROR] [FML]: Model definition for location dinocraft:block_ambre#normal not found [23:05:54] [Client thread/ERROR] [FML]: Model definition for location dinocraft:item_SyringeWithBlood#inventory not found [23:05:54] [Client thread/ERROR] [FML]: Model definition for location dinocraft:item_ADNofvelociraptors#inventory not found [23:05:54] [Client thread/ERROR] [FML]: Model definition for location dinocraft:block_portail#normal not found [23:05:54] [Client thread/ERROR] [FML]: Model definition for location dinocraft:block_pousse#stage=0,type=acacia not found [23:05:54] [Client thread/ERROR] [FML]: Model definition for location dinocraft:item_DartEmpty#inventory not found [23:05:54] [Client thread/ERROR] [FML]: Model definition for location dinocraft:block_analyzer#inventory not found [23:05:54] [Client thread/ERROR] [FML]: Model definition for location dinocraft:item_Zoom#inventory not found [23:05:54] [Client thread/ERROR] [FML]: Model definition for location dinocraft:block_pousse#stage=1,type=birch not found [23:05:54] [Client thread/ERROR] [FML]: Model definition for location dinocraft:block_combiner#normal not found [23:05:54] [Client thread/ERROR] [FML]: Model definition for location dinocraft:block_barriere#normal not found [23:05:54] [Client thread/ERROR] [FML]: Model definition for location dinocraft:block_extractor#inventory not found [23:05:54] [Client thread/ERROR] [FML]: Model definition for location dinocraft:item_Dart#inventory not found [23:05:54] [Client thread/ERROR] [FML]: Model definition for location dinocraft:block_couveuse#normal not found [23:05:54] [Client thread/ERROR] [FML]: Model definition for location dinocraft:block_fossiliser#normal not found [23:05:54] [Client thread/ERROR] [FML]: Model definition for location dinocraft:block_barriere#inventory not found
Pour les blocks c’est normal je ne m’y suis pas encore attaqué
Je place mes jsons dans \forge1.8\src\main\resources\assets\dinocraft\models\item
Et mes textures sont dans \forge1.8\src\main\resources\assets\dinocraft\textures\items
Voila j’attend votre aide , mais je peut vous dire que j’aime pas les jsons bourdel !
Merci :p</class,>
-
Je ne vois aucune erreur.
Envoie un zip de ton dossier src, je vais check de mon côté. -
Voila le ZIP :s En espérant que tu trouve
-
Faut utiliser les pièces jointes, pas des hébergeurs avec captcha et 400 pubs x)
-
Sorry voila robin4002.zip
-
Problème 1 : tu as dans certains json le modid écrit avec des majuscules.
Problème 2 : les fichier json doivent avoir le même nom que celui dans gameRegistry.registerItem.
Donc
mesher.register(ItemRegister.itemCPU, 0, new ModelResourceLocation(DinoCraft.MODID + “:itemCPU”, “inventory”));
->
mesher.register(ItemRegister.itemCPU, 0, new ModelResourceLocation(DinoCraft.MODID + “:item_CPU”, “inventory”));
Afin de correspondre à
GameRegistry.registerItem(itemCPU, “item_CPU”);
Le nom du json doit bien sûr aussi être changé.
Idem pour les autres items.
Je reconnais que la 1.8 est assez chiante. -
@‘robin4002’:
Problème 1 : tu as dans certains json le modid écrit avec des majuscules.
Problème 2 : les fichier json doivent avoir le même nom que celui dans gameRegistry.registerItem.
Donc
mesher.register(ItemRegister.itemCPU, 0, new ModelResourceLocation(DinoCraft.MODID + “:itemCPU”, “inventory”));
->
mesher.register(ItemRegister.itemCPU, 0, new ModelResourceLocation(DinoCraft.MODID + “:item_CPU”, “inventory”));
Afin de correspondre à
GameRegistry.registerItem(itemCPU, “item_CPU”);
Le nom du json doit bien sûr aussi être changé.
Idem pour les autres items.
Je reconnais que la 1.8 est assez chiante.Assez ? Merci je vais modifier tout ca et je te dis si ca marche On sait jamais ^^
EDIT : Ca ne marche pas cher moi , j’ai bien tout changer comme tu as dis …