Résolu Armure problème texture
-
Bonjour désolé de vous importuner à nouveau j’ai un problème que je n’arrive pas à résoudre, quand je créer mon armure je n’arrive pas a avoir les textures des différentes pièces quand je les droppes et quand je les ai dans mon inventaire
Voici les logs d’erreurs pour le plastron j’ai les mêmes erreurs pour les 3 autres pièces de l’armure
Exception loading model for variant minecraft:copper_chestplate#inventory for item "simpleores:copper_chesplate", normal location exception: net.minecraftforge.client.model.ModelLoaderRegistry$LoaderException: Exception loading model minecraft:item/copper_chestplate with loader VanillaLoader.INSTANCE, skipping at net.minecraftforge.client.model.ModelLoaderRegistry.getModel(ModelLoaderRegistry.java:153) ~[ModelLoaderRegistry.class:?] at net.minecraftforge.client.model.ModelLoader.loadItemModels(ModelLoader.java:317) ~[ModelLoader.class:?] at net.minecraft.client.renderer.block.model.ModelBakery.loadVariantItemModels(ModelBakery.java:175) ~[ModelBakery.class:?] at net.minecraftforge.client.model.ModelLoader.setupModelRegistry(ModelLoader.java:147) ~[ModelLoader.class:?] at net.minecraft.client.renderer.block.model.ModelManager.onResourceManagerReload(ModelManager.java:28) [ModelManager.class:?] at net.minecraft.client.resources.SimpleReloadableResourceManager.registerReloadListener(SimpleReloadableResourceManager.java:122) [SimpleReloadableResourceManager.class:?] at net.minecraft.client.Minecraft.startGame(Minecraft.java:539) [Minecraft.class:?] at net.minecraft.client.Minecraft.run(Minecraft.java:385) [Minecraft.class:?] at net.minecraft.client.main.Main.main(Main.java:118) [Main.class:?] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.8.0_131] at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) ~[?:1.8.0_131] at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) ~[?:1.8.0_131] at java.lang.reflect.Method.invoke(Unknown Source) ~[?:1.8.0_131] at net.minecraft.launchwrapper.Launch.launch(Launch.java:135) [launchwrapper-1.12.jar:?] at net.minecraft.launchwrapper.Launch.main(Launch.java:28) [launchwrapper-1.12.jar:?] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.8.0_131] at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) ~[?:1.8.0_131] at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) ~[?:1.8.0_131] at java.lang.reflect.Method.invoke(Unknown Source) ~[?:1.8.0_131] at net.minecraftforge.gradle.GradleStartCommon.launch(GradleStartCommon.java:97) [start/:?] at GradleStart.main(GradleStart.java:26) [start/:?]
voici ma classe Items
package fr.priya.simpleores.items; import fr.priya.simpleores.ModSimpleores; import fr.priya.simpleores.blocks.SimpleoresBlocks; import net.minecraft.client.renderer.block.model.ModelResourceLocation; import net.minecraft.inventory.EntityEquipmentSlot; import net.minecraft.item.Item; import net.minecraft.item.ItemArmor; import net.minecraft.item.ItemBlock; import net.minecraftforge.client.model.ModelLoader; import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; public class SimpleoresItems { // ici on va d�clarer les items public static final Item COPPER_INGOT = new Ingot("copper_ingot"); public static final Item AMNETHYSTE = new Ingot("amnethyste"); public static final Item TIN_INGOT = new Ingot ("tin"); public static final Item RUBIS = new Ingot ("rubis"); public static final Item SAPHIR = new Ingot ("saphir"); public static final Item BLOCK_COPPER_ORE_ITEM = new ItemBlock(SimpleoresBlocks.COPPER_ORE).setRegistryName(SimpleoresBlocks.COPPER_ORE.getRegistryName()); public static final Item BLOCK_RUBIS_ORE_ITEM = new ItemBlock(SimpleoresBlocks.RUBIS_ORE).setRegistryName(SimpleoresBlocks.RUBIS_ORE.getRegistryName()); public static final Item BLOCK_AMNETHYSTE_ORE_ITEM = new ItemBlock(SimpleoresBlocks.AMNETHYSTE_ORE).setRegistryName(SimpleoresBlocks.AMNETHYSTE_ORE.getRegistryName()); public static final Item BLOCK_SAPHIR_ORE_ITEM = new ItemBlock(SimpleoresBlocks.SAPHIR_ORE).setRegistryName(SimpleoresBlocks.SAPHIR_ORE.getRegistryName()); public static final Item BLOCK_TIN_ORE_ITEM = new ItemBlock(SimpleoresBlocks.TIN_ORE).setRegistryName(SimpleoresBlocks.TIN_ORE.getRegistryName()); public static final Item COPPER_HELMET = new CopperArmor(EntityEquipmentSlot.HEAD).setRegistryName("copper_helmet").setUnlocalizedName("copper_helmet"); public static final Item COPPER_CHESPLATE = new CopperArmor(EntityEquipmentSlot.CHEST).setRegistryName("copper_chesplate").setUnlocalizedName("copper_chestplate"); public static final Item COPPER_LEGGINGS = new CopperArmor(EntityEquipmentSlot.LEGS).setRegistryName("copper_leggings").setUnlocalizedName("copper_leggings"); public static final Item COPPER_BOOTS = new CopperArmor(EntityEquipmentSlot.FEET).setRegistryName("copper_boots").setUnlocalizedName("copper_boots"); public static void setItemName(Item item, String name) { // ici on va attribuer un nom � nos objets item.setRegistryName(ModSimpleores.MODID, name).setUnlocalizedName(ModSimpleores.MODID + "." + name); } @SideOnly(Side.CLIENT) public static void registerItemsModels() { // ici on va appeler la fonction registerModel pour chaque item. registerModel(COPPER_INGOT, 0); registerModel(AMNETHYSTE, 0); registerModel(TIN_INGOT, 0); registerModel(RUBIS, 0); registerModel(SAPHIR, 0); registerModel(BLOCK_COPPER_ORE_ITEM, 0); registerModel(BLOCK_RUBIS_ORE_ITEM, 0); registerModel(BLOCK_AMNETHYSTE_ORE_ITEM, 0); registerModel(BLOCK_TIN_ORE_ITEM, 0); registerModel(BLOCK_SAPHIR_ORE_ITEM, 0); registerModel(COPPER_HELMET, 0); registerModel(COPPER_CHESPLATE, 0); registerModel(COPPER_LEGGINGS, 0); registerModel(COPPER_BOOTS, 0); } @SideOnly(Side.CLIENT) public static void registerModel(Item item, int metadata) { // et ici on va enregistrer les mod�les (fichiers json) if (metadata < 0) metadata = 0; String resourceName = item.getUnlocalizedName().substring(5).replace('.', ':'); if (metadata > 0) resourceName += "_m" + String.valueOf(metadata); ModelLoader.setCustomModelResourceLocation(item, metadata, new ModelResourceLocation(resourceName, "inventory")); } }
et ma classe Register
package fr.priya.simpleores.items; import fr.priya.simpleores.blocks.SimpleoresBlocks; import net.minecraft.block.Block; import net.minecraft.item.Item; import net.minecraftforge.event.RegistryEvent; import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; public class RegisteringHandler { @SubscribeEvent public void registerBlocks(RegistryEvent.Register <block>event) { event.getRegistry().registerAll(SimpleoresBlocks.COPPER_ORE, SimpleoresBlocks.RUBIS_ORE, SimpleoresBlocks.SAPHIR_ORE, SimpleoresBlocks.TIN_ORE, SimpleoresBlocks.AMNETHYSTE_ORE); } @SubscribeEvent public void registerItems(RegistryEvent.Register event) { event.getRegistry().registerAll(SimpleoresItems.COPPER_INGOT, SimpleoresItems.AMNETHYSTE, SimpleoresItems.TIN_INGOT, SimpleoresItems.RUBIS, SimpleoresItems.SAPHIR, SimpleoresItems.BLOCK_COPPER_ORE_ITEM, SimpleoresItems.BLOCK_RUBIS_ORE_ITEM, SimpleoresItems.BLOCK_AMNETHYSTE_ORE_ITEM, SimpleoresItems.BLOCK_SAPHIR_ORE_ITEM, SimpleoresItems.BLOCK_TIN_ORE_ITEM, SimpleoresItems.COPPER_HELMET, SimpleoresItems.COPPER_BOOTS, SimpleoresItems.COPPER_CHESPLATE, SimpleoresItems.COPPER_LEGGINGS); } }
si il y a besoin d’autre fichier n’hésitez pas</block>
-
kjydkhgckgv
-
Dans ta classe d’item, tout en bas tu as la méthode
ModelLoader.setCustomModelResourceLocation(item, metadata, new ModelResourceLocation(resourceName, "inventory"));
c’est cette méthode qui te permet de donner une texture à item
Pour l’item tu mets celui que tu veux.
Le metadata de base est 0 sauf si tu as des metadata d’item.
resourceName tu dois mettre TaClassePrincipale.tonModid + “:nomDeLItemCommeDansSetRegistryName”
“inventory” laisse comme çaPour toi ça sera donc
ModelLoader.setCustomModelResourceLocation(COPPER_HELMET, 0, new ModelResourceLocation(TaClassePrincipale.tonModid, "inventory"));
Fait ça pour tout tes items, et n’oublie pas le fichier json.
Il y a un tuto pour ce que je viens de t’expliquer : https://www.minecraftforgefrance.fr/showthread.php?tid=1901
-
merci ça à fonctionner !