Créer un item simple
-
Il manque le screenshot de src/main/resources (prends-le depuis ton ide, avec le contenu visible sur le screenshot).
Vu l’erreur, tes fichiers sont mal placés.
-
Je l’avais mal envoyé tout à l’heure
-
Ah si, le fichier est bien là où il faut. Étrange qu’il ne le trouve pas …
Essaies de nettoyer l’espace de travail (project -> clean …) -
@robin4002 Ca donne toujours ça
-
Tu peux vérifier que le fichier est bien présent dans les dossiers des objets compilés ? (c’est le dossier bin du dossier de la workspace)
-
Tout est présent
-
Ahhh, mais c’est parce que tu as mis test_item or il cherche item_test.
-
@robin4002 MEEEEEERCI mais ca résoud pas le problème du nom délocalisé
-
J’ai le même problême pour les fichier lang
-
Je go sur le discord
-
Renommes
fr_FR.lang
enfr_fr.lang
.
Idem pour le fichier en_US, retires les majuscules. -
@robin4002 Fonctionne pas
-
Tu peux envoyer le contenu du fichier en_us.lang ?
-
@robin4002 item.name not located.name=Localized Name
item.test.name=Test Item -
Bonjour, il y a une erreur dans votre code :
ModelLoader.setCustomModelResourceLocation(item, metadata, new ModelResourceLocation(resourceName, "inventory");
Il manque une parenthèse derrière “inventory” comme ceci :
ModelLoader.setCustomModelResourceLocation(item, metadata, new ModelResourceLocation(resourceName, "inventory"));
-
Effectivement. J’ai ajouté les fermetures de parenthèse manquante, merci pour le signalement !
-
J’ai le même probléme que Gollum1er (la texture ne s’affiche pas et le nom non plus) :
Ma console:[09:18:42] [main/INFO] [GradleStart]: Extra: [] [09:18:42] [main/INFO] [GradleStart]: Password found, attempting login [09:18:42] [main/INFO] [mojang/YggdrasilUserAuthentication]: Logging in with username & password [09:18:43] [main/INFO] [GradleStart]: Login Succesful! [09:18:43] [main/INFO] [GradleStart]: Running with arguments: [--userProperties, [], --assetsDir, C:/Users/tuxca/.gradle/caches/minecraft/assets, --assetIndex, 1.12, --userType, mojang, --accessToken{REDACTED}, --version, 1.12.2, --uuid, 2d6a396a3b1542998df960ffe8750f54, --username, Le_Vrai_GG, --tweakClass, net.minecraftforge.fml.common.launcher.FMLTweaker, --tweakClass, net.minecraftforge.gradle.tweakers.CoremodTweaker] [09:18:43] [main/INFO] [LaunchWrapper]: Loading tweak class name net.minecraftforge.fml.common.launcher.FMLTweaker [09:18:43] [main/INFO] [LaunchWrapper]: Using primary tweak class name net.minecraftforge.fml.common.launcher.FMLTweaker [09:18:43] [main/INFO] [LaunchWrapper]: Loading tweak class name net.minecraftforge.gradle.tweakers.CoremodTweaker [09:18:43] [main/INFO] [LaunchWrapper]: Calling tweak class net.minecraftforge.fml.common.launcher.FMLTweaker [09:18:43] [main/INFO] [FML]: Forge Mod Loader version 14.23.5.2768 for Minecraft 1.12.2 loading [09:18:43] [main/INFO] [FML]: Java is Java HotSpot(TM) 64-Bit Server VM, version 1.8.0_241, running on Windows 10:amd64:10.0, installed at C:\Program Files\Java\jre1.8.0_241 [09:18:43] [main/ERROR] [FML]: Apache Maven library folder was not in the format expected. Using default libraries directory. [09:18:43] [main/ERROR] [FML]: Full: C:\Users\tuxca\.gradle\caches\modules-2\files-2.1\org.apache.maven\maven-artifact\3.5.3\7dc72b6d6d8a6dced3d294ed54c2cc3515ade9f4\maven-artifact-3.5.3.jar [09:18:43] [main/ERROR] [FML]: Trimmed: c:/users/tuxca/.gradle/caches/modules-2/files-2.1/org.apache.maven/maven-artifact/3.5.3/ [09:18:43] [main/INFO] [FML]: Managed to load a deobfuscated Minecraft name- we are in a deobfuscated environment. Skipping runtime deobfuscation [09:18:43] [main/INFO] [FML]: Detected deobfuscated environment, loading log configs for colored console logs. 2020-02-04 09:18:44,475 main WARN Disabling terminal, you're running in an unsupported environment. [09:18:44] [main/INFO] [FML]: Ignoring missing certificate for coremod FMLCorePlugin (net.minecraftforge.fml.relauncher.FMLCorePlugin), we are in deobf and it's a forge core plugin [09:18:44] [main/INFO] [FML]: Ignoring missing certificate for coremod FMLForgePlugin (net.minecraftforge.classloading.FMLForgePlugin), we are in deobf and it's a forge core plugin [09:18:44] [main/INFO] [FML]: Searching C:\Users\tuxca\Desktop\ZombieCubeFree\run\.\mods for mods [09:18:44] [main/INFO] [LaunchWrapper]: Calling tweak class net.minecraftforge.gradle.tweakers.CoremodTweaker [09:18:44] [main/INFO] [GradleStart]: Injecting location in coremod net.minecraftforge.fml.relauncher.FMLCorePlugin [09:18:44] [main/INFO] [GradleStart]: Injecting location in coremod net.minecraftforge.classloading.FMLForgePlugin [09:18:44] [main/INFO] [LaunchWrapper]: Loading tweak class name net.minecraftforge.fml.common.launcher.FMLInjectionAndSortingTweaker [09:18:44] [main/INFO] [LaunchWrapper]: Loading tweak class name net.minecraftforge.fml.common.launcher.FMLDeobfTweaker [09:18:44] [main/INFO] [LaunchWrapper]: Loading tweak class name net.minecraftforge.gradle.tweakers.AccessTransformerTweaker [09:18:44] [main/INFO] [LaunchWrapper]: Calling tweak class net.minecraftforge.fml.common.launcher.FMLInjectionAndSortingTweaker [09:18:44] [main/INFO] [LaunchWrapper]: Calling tweak class net.minecraftforge.fml.common.launcher.FMLInjectionAndSortingTweaker [09:18:44] [main/INFO] [LaunchWrapper]: Calling tweak class net.minecraftforge.fml.relauncher.CoreModManager$FMLPluginWrapper [09:18:46] [main/ERROR] [FML]: FML appears to be missing any signature data. This is not a good thing [09:18:46] [main/INFO] [LaunchWrapper]: Calling tweak class net.minecraftforge.fml.relauncher.CoreModManager$FMLPluginWrapper [09:18:46] [main/INFO] [LaunchWrapper]: Calling tweak class net.minecraftforge.fml.common.launcher.FMLDeobfTweaker [09:18:46] [main/INFO] [LaunchWrapper]: Calling tweak class net.minecraftforge.gradle.tweakers.AccessTransformerTweaker [09:18:46] [main/INFO] [LaunchWrapper]: Loading tweak class name net.minecraftforge.fml.common.launcher.TerminalTweaker [09:18:46] [main/INFO] [LaunchWrapper]: Calling tweak class net.minecraftforge.fml.common.launcher.TerminalTweaker [09:18:46] [main/INFO] [LaunchWrapper]: Launching wrapped minecraft {net.minecraft.client.main.Main} [09:18:47] [main/INFO] [minecraft/Minecraft]: Setting user: Le_Vrai_GG [09:18:50] [main/WARN] [minecraft/GameSettings]: Skipping bad option: lastServer: [09:18:50] [main/INFO] [minecraft/Minecraft]: LWJGL Version: 2.9.4 [09:18:51] [main/INFO] [FML]: -- System Details -- Details: Minecraft Version: 1.12.2 Operating System: Windows 10 (amd64) version 10.0 Java Version: 1.8.0_241, Oracle Corporation Java VM Version: Java HotSpot(TM) 64-Bit Server VM (mixed mode), Oracle Corporation Memory: 868269728 bytes (828 MB) / 1038876672 bytes (990 MB) up to 1038876672 bytes (990 MB) JVM Flags: 3 total; -Xincgc -Xmx1024M -Xms1024M IntCache: cache: 0, tcache: 0, allocated: 0, tallocated: 0 FML: Loaded coremods (and transformers): GL info: ' Vendor: 'VMware, Inc.' Version: '3.0 Mesa 18.0.0 (git-6949e96035)' Renderer: 'SVGA3D; build: RELEASE; LLVM;' [09:18:51] [main/INFO] [FML]: MinecraftForge v14.23.5.2768 Initialized [09:18:51] [main/INFO] [FML]: Starts to replace vanilla recipe ingredients with ore ingredients. [09:18:51] [main/INFO] [FML]: Replaced 1036 ore ingredients [09:18:51] [main/INFO] [FML]: Searching C:\Users\tuxca\Desktop\ZombieCubeFree\run\.\mods for mods [09:18:51] [main/INFO] [FML]: Mod examplemod is missing the required element 'name'. Substituting examplemod [09:18:53] [Thread-3/INFO] [FML]: Using sync timing. 200 frames of Display.update took 972806000 nanos [09:18:53] [main/INFO] [FML]: Forge Mod Loader has identified 7 mods to load [09:18:54] [main/INFO] [FML]: Attempting connection with missing mods [minecraft, mcp, FML, forge, examplemod, mod test2, zombiecubefree] at CLIENT [09:18:54] [main/INFO] [FML]: Attempting connection with missing mods [minecraft, mcp, FML, forge, examplemod, mod test2, zombiecubefree] at SERVER [09:18:54] [main/INFO] [minecraft/SimpleReloadableResourceManager]: Reloading ResourceManager: Default, FMLFileResourcePack:Forge Mod Loader, FMLFileResourcePack:Minecraft Forge, FMLFileResourcePack:examplemod, FMLFileResourcePack: deuxième mod, FMLFileResourcePack:Zombie Cube Free [09:18:54] [main/INFO] [FML]: Processing ObjectHolder annotations [09:18:54] [main/INFO] [FML]: Found 1168 ObjectHolder annotations [09:18:54] [main/INFO] [FML]: Identifying ItemStackHolder annotations [09:18:54] [main/INFO] [FML]: Found 0 ItemStackHolder annotations [09:18:54] [main/INFO] [FML]: Configured a dormant chunk cache size of 0 [09:18:54] [main/INFO] [STDOUT]: [zombieCubeFree.proxy.CommonProxy:preInit:12]: pre init côté commun [09:18:54] [main/INFO] [STDOUT]: [zombieCubeFree.proxy.ClientProxy:preInit:17]: pre init côté client [09:18:54] [main/INFO] [FML]: Applying holder lookups [09:18:54] [main/INFO] [FML]: Holder lookups applied [09:18:54] [main/INFO] [FML]: Applying holder lookups [09:18:54] [main/INFO] [FML]: Holder lookups applied [09:18:54] [main/INFO] [FML]: Applying holder lookups [09:18:54] [main/INFO] [FML]: Holder lookups applied [09:18:55] [Forge Version Check/INFO] [forge.VersionCheck]: [forge] Starting version check at http://files.minecraftforge.net/maven/net/minecraftforge/forge/promotions_slim.json [09:18:55] [main/INFO] [FML]: Applying holder lookups [09:18:55] [main/INFO] [FML]: Holder lookups applied [09:18:55] [main/INFO] [FML]: Injecting itemstacks [09:18:55] [main/INFO] [FML]: Itemstack injection complete [09:18:55] [Forge Version Check/INFO] [forge.VersionCheck]: [forge] Found status: UP_TO_DATE Target: null [09:19:05] [Sound Library Loader/INFO] [minecraft/SoundManager]: Starting up SoundSystem... [09:19:05] [Thread-5/INFO] [minecraft/SoundManager]: Initializing LWJGL OpenAL [09:19:05] [Thread-5/INFO] [minecraft/SoundManager]: (The LWJGL binding of OpenAL. For more information, see http://www.lwjgl.org) [09:19:06] [Thread-5/INFO] [minecraft/SoundManager]: OpenAL initialized. [09:19:06] [Sound Library Loader/INFO] [minecraft/SoundManager]: Sound engine started [09:19:11] [main/INFO] [FML]: Max texture size: 4096 [09:19:11] [main/INFO] [minecraft/TextureMap]: Created: 512x512 textures-atlas [09:19:12] [main/ERROR] [FML]: Exception loading model for variant zombiecubefree:tutorial#inventory for item "zombiecubefree:tutorial", normal location exception: net.minecraftforge.client.model.ModelLoaderRegistry$LoaderException: Exception loading model zombiecubefree:item/tutorial with loader VanillaLoader.INSTANCE, skipping at net.minecraftforge.client.model.ModelLoaderRegistry.getModel(ModelLoaderRegistry.java:161) ~[ModelLoaderRegistry.class:?] at net.minecraftforge.client.model.ModelLoader.loadItemModels(ModelLoader.java:302) ~[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:151) ~[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:121) [SimpleReloadableResourceManager.class:?] at net.minecraft.client.Minecraft.init(Minecraft.java:559) [Minecraft.class:?] at net.minecraft.client.Minecraft.run(Minecraft.java:421) [Minecraft.class:?] at net.minecraft.client.main.Main.main(Main.java:118) [Main.class:?] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.8.0_241] at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) ~[?:1.8.0_241] at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) ~[?:1.8.0_241] at java.lang.reflect.Method.invoke(Unknown Source) ~[?:1.8.0_241] 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_241] at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) ~[?:1.8.0_241] at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) ~[?:1.8.0_241] at java.lang.reflect.Method.invoke(Unknown Source) ~[?:1.8.0_241] at net.minecraftforge.gradle.GradleStartCommon.launch(GradleStartCommon.java:97) [start/:?] at GradleStart.main(GradleStart.java:25) [start/:?] Caused by: java.io.FileNotFoundException: zombiecubefree:models/item/tutorial.json at net.minecraft.client.resources.FallbackResourceManager.getResource(FallbackResourceManager.java:69) ~[FallbackResourceManager.class:?] at net.minecraft.client.resources.SimpleReloadableResourceManager.getResource(SimpleReloadableResourceManager.java:65) ~[SimpleReloadableResourceManager.class:?] at net.minecraft.client.renderer.block.model.ModelBakery.loadModel(ModelBakery.java:334) ~[ModelBakery.class:?] at net.minecraftforge.client.model.ModelLoader.access$1400(ModelLoader.java:115) ~[ModelLoader.class:?] at net.minecraftforge.client.model.ModelLoader$VanillaLoader.loadModel(ModelLoader.java:861) ~[ModelLoader$VanillaLoader.class:?] at net.minecraftforge.client.model.ModelLoaderRegistry.getModel(ModelLoaderRegistry.java:157) ~[ModelLoaderRegistry.class:?] ... 20 more [09:19:12] [main/ERROR] [FML]: Exception loading model for variant zombiecubefree:tutorial#inventory for item "zombiecubefree:tutorial", blockstate location exception: net.minecraftforge.client.model.ModelLoaderRegistry$LoaderException: Exception loading model zombiecubefree:tutorial#inventory with loader VariantLoader.INSTANCE, skipping at net.minecraftforge.client.model.ModelLoaderRegistry.getModel(ModelLoaderRegistry.java:161) ~[ModelLoaderRegistry.class:?] at net.minecraftforge.client.model.ModelLoader.loadItemModels(ModelLoader.java:296) ~[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:151) ~[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:121) [SimpleReloadableResourceManager.class:?] at net.minecraft.client.Minecraft.init(Minecraft.java:559) [Minecraft.class:?] at net.minecraft.client.Minecraft.run(Minecraft.java:421) [Minecraft.class:?] at net.minecraft.client.main.Main.main(Main.java:118) [Main.class:?] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.8.0_241] at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) ~[?:1.8.0_241] at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) ~[?:1.8.0_241] at java.lang.reflect.Method.invoke(Unknown Source) ~[?:1.8.0_241] 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_241] at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) ~[?:1.8.0_241] at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) ~[?:1.8.0_241] at java.lang.reflect.Method.invoke(Unknown Source) ~[?:1.8.0_241] at net.minecraftforge.gradle.GradleStartCommon.launch(GradleStartCommon.java:97) [start/:?] at GradleStart.main(GradleStart.java:25) [start/:?] Caused by: net.minecraft.client.renderer.block.model.ModelBlockDefinition$MissingVariantException at net.minecraft.client.renderer.block.model.ModelBlockDefinition.getVariant(ModelBlockDefinition.java:83) ~[ModelBlockDefinition.class:?] at net.minecraftforge.client.model.ModelLoader$VariantLoader.loadModel(ModelLoader.java:1175) ~[ModelLoader$VariantLoader.class:?] at net.minecraftforge.client.model.ModelLoaderRegistry.getModel(ModelLoaderRegistry.java:157) ~[ModelLoaderRegistry.class:?] ... 20 more [09:19:13] [main/INFO] [FML]: Applying holder lookups [09:19:13] [main/INFO] [FML]: Holder lookups applied [09:19:13] [main/INFO] [STDOUT]: [com.example.examplemod.ExampleMod:init:18]: DIRT BLOCK >> tile.dirt [09:19:13] [main/INFO] [FML]: Injecting itemstacks [09:19:13] [main/INFO] [FML]: Itemstack injection complete [09:19:13] [main/INFO] [FML]: Forge Mod Loader has successfully loaded 7 mods [09:19:13] [main/WARN] [minecraft/GameSettings]: Skipping bad option: lastServer: [09:19:13] [main/INFO] [mojang/NarratorWindows]: Narrator library for x64 successfully loaded [09:19:33] [Server thread/INFO] [minecraft/IntegratedServer]: Starting integrated minecraft server version 1.12.2 [09:19:33] [Server thread/INFO] [minecraft/IntegratedServer]: Generating keypair [09:19:33] [Server thread/INFO] [FML]: Injecting existing registry data into this server instance [09:19:34] [Server thread/INFO] [FML]: Applying holder lookups [09:19:34] [Server thread/INFO] [FML]: Holder lookups applied [09:19:34] [Server thread/INFO] [FML]: Loading dimension 0 (Monde de test) (net.minecraft.server.integrated.IntegratedServer@1b702efa) [09:19:34] [Server thread/INFO] [minecraft/AdvancementList]: Loaded 488 advancements [09:19:34] [Server thread/INFO] [FML]: Loading dimension -1 (Monde de test) (net.minecraft.server.integrated.IntegratedServer@1b702efa) [09:19:34] [Server thread/INFO] [FML]: Loading dimension 1 (Monde de test) (net.minecraft.server.integrated.IntegratedServer@1b702efa) [09:19:34] [Server thread/INFO] [minecraft/MinecraftServer]: Preparing start region for level 0 [09:19:35] [Server thread/INFO] [minecraft/MinecraftServer]: Preparing spawn area: 25% [09:19:37] [Server thread/INFO] [FML]: Unloading dimension -1 [09:19:37] [Server thread/INFO] [FML]: Unloading dimension 1 [09:19:37] [Server thread/INFO] [minecraft/IntegratedServer]: Changing view distance to 12, from 10 [09:19:38] [Netty Local Client IO #0/INFO] [FML]: Server protocol version 2 [09:19:38] [Netty Server IO #1/INFO] [FML]: Client protocol version 2 [09:19:38] [Netty Server IO #1/INFO] [FML]: Client attempting to join with 7 mods : minecraft@1.12.2,mod test2@1.0,FML@8.0.99.99,forge@14.23.5.2768,mcp@9.42,examplemod@1.0,zombiecubefree@1.0.0 [09:19:38] [Netty Local Client IO #0/INFO] [FML]: [Netty Local Client IO #0] Client side modded connection established [09:19:38] [Server thread/INFO] [FML]: [Server thread] Server side modded connection established [09:19:38] [Server thread/INFO] [minecraft/PlayerList]: Le_Vrai_GG[local:E:97f8fcea] logged in with entity id 306 at (-1.070961505098084, 87.0, 241.7182042461335) [09:19:38] [Server thread/INFO] [minecraft/MinecraftServer]: Le_Vrai_GG joined the game [09:19:40] [Server thread/INFO] [minecraft/IntegratedServer]: Saving and pausing game... [09:19:40] [Server thread/INFO] [minecraft/MinecraftServer]: Saving chunks for level 'Monde de test'/overworld [09:19:52] [Server thread/INFO] [minecraft/IntegratedServer]: Saving and pausing game... [09:19:52] [Server thread/INFO] [minecraft/MinecraftServer]: Saving chunks for level 'Monde de test'/overworld [09:19:53] [Server thread/INFO] [minecraft/MinecraftServer]: Stopping server [09:19:53] [Server thread/INFO] [minecraft/MinecraftServer]: Saving players [09:19:53] [Server thread/INFO] [minecraft/NetHandlerPlayServer]: Le_Vrai_GG lost connection: Disconnected [09:19:53] [Server thread/INFO] [minecraft/MinecraftServer]: Le_Vrai_GG left the game [09:19:53] [Server thread/INFO] [minecraft/NetHandlerPlayServer]: Stopping singleplayer server as player logged out [09:19:53] [Server thread/INFO] [minecraft/MinecraftServer]: Saving worlds [09:19:53] [Server thread/INFO] [minecraft/MinecraftServer]: Saving chunks for level 'Monde de test'/overworld [09:19:53] [Server thread/INFO] [FML]: Unloading dimension 0 [09:19:53] [Server thread/INFO] [FML]: Applying holder lookups [09:19:53] [Server thread/INFO] [FML]: Holder lookups applied [09:19:54] [main/INFO] [minecraft/Minecraft]: Stopping! [09:19:54] [main/INFO] [minecraft/SoundManager]: SoundSystem shutting down... [09:19:54] [main/WARN] [minecraft/SoundManager]: Author: Paul Lamb, www.paulscode.com Java HotSpot(TM) 64-Bit Server VM warning: Using incremental CMS is deprecated and will likely be removed in a future release
Mon item:
package zombieCubeFree.items; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; import net.minecraft.util.ActionResult; import net.minecraft.util.EnumActionResult; import net.minecraft.util.EnumHand; import net.minecraft.util.text.TextComponentString; import net.minecraft.world.World; import zombieCubeFree.ZombieCubeFree; public class ItemTutorial extends Item { public static final String NAME = "tutorial"; public ItemTutorial() { super(); ZombieCubeFreeItems.setItemName(this, NAME); setCreativeTab(ZombieCubeFree.zombieCubeFreeCreativeTabs); setMaxStackSize(1); } @Override public ActionResult<ItemStack> onItemRightClick(World worldIn, EntityPlayer playerIn, EnumHand handIn) { if (!worldIn.isRemote) { playerIn.sendMessage(new TextComponentString("bonjour " + playerIn.getName())); } return new ActionResult(EnumActionResult.PASS, playerIn.getHeldItem(handIn)); } }
Mon modidItems:
package zombieCubeFree.items; import net.minecraft.client.renderer.block.model.ModelResourceLocation; import net.minecraft.item.Item; import net.minecraftforge.client.event.ModelRegistryEvent; import net.minecraftforge.client.model.ModelLoader; import net.minecraftforge.fml.common.Mod.EventBusSubscriber; import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; import net.minecraftforge.fml.common.registry.GameRegistry; import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; import zombieCubeFree.ZombieCubeFree; import zombieCubeFree.utils.References; /** * EventBusSubscriber ne doit être utilisé qu'à partir de la 1.12\. L'annotation * n'est pas nécessaire en 1.11. N'oubliez pas d'importer * net.minecraftforge.fml.common.Mod.EventBusSubscriber. value contient le côté * que nous souhaitons utiliser. Ici, nous voulons uniquement le côté Client, * puisque nous utiliserons seulement l'event pour enregistrer les modèles. * modid est votre modid. */ @EventBusSubscriber(value = Side.CLIENT, modid = References.MODID) public class ZombieCubeFreeItems { public static final Item ITEM_TUTORIAL = new ItemTutorial(); public static void setItemName(Item item, String name) { item.setRegistryName(References.MODID, name).setUnlocalizedName(References.MODID + "." + name); } /* * Cette version de la fonction ne doit être utilisée qu'à partir de la 1.12. * Pensez à inclure net.minecraftforge.client.event.ModelRegistryEvent. */ @SideOnly(Side.CLIENT) @SubscribeEvent public static void registerItemModels(ModelRegistryEvent event) { registerModel(ITEM_TUTORIAL, 0); } @SideOnly(Side.CLIENT) public static void registerModel(Item item, int metadata) { 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")); } }
Le json
{ "parent": "item/generated", "textures": { "layer0": "zombicubefree:items/item_tutorial" } }
Les lang:
FR:item.tutorial.name=Item Tutoriel
EN:
item.tutorial.name=Tutorial Item
le screenshot de src/main/resources:
-
Ce message a été supprimé ! -
Le fichier
item_tutorial.json
devrait être nommétutorial.json
-
@robin4002 Le problème persiste