Probleme mods 1.12.2
-
Ton code a clairement bougé depuis le premier rapport de crash, puis que maintenant le NPE est sur la ligne 46 :
Caused by: java.lang.NullPointerException
at fr.atomez.noz43.ModsatomezMod.preInit(ModsatomezMod.java:46)Le problème c’est que ta variable proxy n’est jamais initialisé, donc forcement la ligne
proxy.preInit(event);cause un NPE. -
@robin4002 donc quesque je peux faire pour ça
-
Ajouter l’annotation SidedProxy qui te manque au dessus de ta déclaration de variable proxy.
Voir le tutoriel ici : https://www.minecraftforgefrance.fr/topic/2906/créer-la-base-de-son-mod#la-classe-client -
@robin4002 meci je vous direz si il aura un autre probleme
-
@robin4002 j’ai rajouter comme le mods en créen les class mais tjr pas la meem erreur et tjr la
@SidedProxy(clientSide = "fr.atomez.noz43.AtomezClient", serverSide = "fr.atomez.noz43.AtomezServer") public static AtomezCommon proxy1;j’ai rajouter ça de plus dans le code
strikethrough text -
Pourquoi tu l’as appelé proxy1 ? Vires l’autre ligne qui fait doublon …
-
@robin4002 ça marche mais j’ai un probleme avec mon item mais je ne comprend pas pk
-
@robin4002
l’error---- Minecraft Crash Report ---- // Don't be sad, have a hug! <3 Time: 2/27/22 7:51 PM Description: Initializing game java.lang.NullPointerException: Initializing game at net.minecraftforge.client.model.ModelLoader.setCustomModelResourceLocation(ModelLoader.java:1091) at fr.atomez.noz43.item.ItemLOGOATOMEZ.registerModels(ItemLOGOATOMEZ.java:34) at fr.atomez.noz43.ModsatomezMod.lambda$13(ModsatomezMod.java:100) at java.util.ArrayList.forEach(ArrayList.java:1259) at fr.atomez.noz43.ModsatomezMod.registerModels(ModsatomezMod.java:100) at net.minecraftforge.fml.common.eventhandler.ASMEventHandler_19_ModsatomezMod_registerModels_ModelRegistryEvent.invoke(.dynamic) at net.minecraftforge.fml.common.eventhandler.ASMEventHandler.invoke(ASMEventHandler.java:90) at net.minecraftforge.fml.common.eventhandler.EventBus$1.invoke(EventBus.java:144) at net.minecraftforge.fml.common.eventhandler.EventBus.post(EventBus.java:182) at net.minecraftforge.fml.client.FMLClientHandler.fireSidedRegistryEvents(FMLClientHandler.java:1062) at net.minecraftforge.fml.common.FMLCommonHandler.fireSidedRegistryEvents(FMLCommonHandler.java:764) at net.minecraftforge.fml.common.Loader.preinitializeMods(Loader.java:631) at net.minecraftforge.fml.client.FMLClientHandler.beginMinecraftLoading(FMLClientHandler.java:252) at net.minecraft.client.Minecraft.init(Minecraft.java:514) at net.minecraft.client.Minecraft.run(Minecraft.java:422) at net.minecraft.client.main.Main.main(Main.java:118) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:498) at net.minecraft.launchwrapper.Launch.launch(Launch.java:135) at net.minecraft.launchwrapper.Launch.main(Launch.java:28) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:498) at net.minecraftforge.gradle.GradleStartCommon.launch(GradleStartCommon.java:97) at GradleStart.main(GradleStart.java:25) A detailed walkthrough of the error, its code path and all known details is as follows: --------------------------------------------------------------------------------------- -- Head -- Thread: Client thread Stacktrace: at net.minecraftforge.client.model.ModelLoader.setCustomModelResourceLocation(ModelLoader.java:1091) at fr.atomez.noz43.item.ItemLOGOATOMEZ.registerModels(ItemLOGOATOMEZ.java:34) at fr.atomez.noz43.ModsatomezMod.lambda$13(ModsatomezMod.java:100) at java.util.ArrayList.forEach(ArrayList.java:1259) at fr.atomez.noz43.ModsatomezMod.registerModels(ModsatomezMod.java:100) at net.minecraftforge.fml.common.eventhandler.ASMEventHandler_19_ModsatomezMod_registerModels_ModelRegistryEvent.invoke(.dynamic) at net.minecraftforge.fml.common.eventhandler.ASMEventHandler.invoke(ASMEventHandler.java:90) at net.minecraftforge.fml.common.eventhandler.EventBus$1.invoke(EventBus.java:144) at net.minecraftforge.fml.common.eventhandler.EventBus.post(EventBus.java:182) at net.minecraftforge.fml.client.FMLClientHandler.fireSidedRegistryEvents(FMLClientHandler.java:1062) at net.minecraftforge.fml.common.FMLCommonHandler.fireSidedRegistryEvents(FMLCommonHandler.java:764) at net.minecraftforge.fml.common.Loader.preinitializeMods(Loader.java:631) at net.minecraftforge.fml.client.FMLClientHandler.beginMinecraftLoading(FMLClientHandler.java:252) at net.minecraft.client.Minecraft.init(Minecraft.java:514) -- Initialization -- Details: Stacktrace: at net.minecraft.client.Minecraft.run(Minecraft.java:422) at net.minecraft.client.main.Main.main(Main.java:118) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:498) at net.minecraft.launchwrapper.Launch.launch(Launch.java:135) at net.minecraft.launchwrapper.Launch.main(Launch.java:28) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:498) at net.minecraftforge.gradle.GradleStartCommon.launch(GradleStartCommon.java:97) at GradleStart.main(GradleStart.java:25) -- System Details -- Details: Minecraft Version: 1.12.2 Operating System: Windows 10 (amd64) version 10.0 Java Version: 1.8.0_292, AdoptOpenJDK Java VM Version: OpenJDK 64-Bit Server VM (mixed mode), AdoptOpenJDK Memory: 856706248 bytes (817 MB) / 1037959168 bytes (989 MB) up to 1037959168 bytes (989 MB) JVM Flags: 3 total; -Xincgc -Xmx1024M -Xms1024M IntCache: cache: 0, tcache: 0, allocated: 0, tallocated: 0 FML: MCP 9.42 Powered by Forge 14.23.5.2847 5 mods loaded, 5 mods active States: 'U' = Unloaded 'L' = Loaded 'C' = Constructed 'H' = Pre-initialized 'I' = Initialized 'J' = Post-initialized 'A' = Available 'D' = Disabled 'E' = Errored | State | ID | Version | Source | Signature | |:----- |:---------- |:------------ |:-------------------------------- |:--------- | | LCH | minecraft | 1.12.2 | minecraft.jar | None | | LCH | mcp | 9.42 | minecraft.jar | None | | LCH | FML | 8.0.99.99 | forgeSrc-1.12.2-14.23.5.2847.jar | None | | LCH | forge | 14.23.5.2847 | forgeSrc-1.12.2-14.23.5.2847.jar | None | | LCH | modsatomez | 1.0.0 | bin | None | Loaded coremods (and transformers): GL info: ' Vendor: 'NVIDIA Corporation' Version: '4.6.0 NVIDIA 456.71' Renderer: 'GeForce GTX 1050/PCIe/SSE2' Launched Version: 1.12.2 LWJGL: 2.9.4 OpenGL: GeForce GTX 1050/PCIe/SSE2 GL version 4.6.0 NVIDIA 456.71, NVIDIA Corporation GL Caps: Using GL 1.3 multitexturing. Using GL 1.3 texture combiners. Using framebuffer objects because OpenGL 3.0 is supported and separate blending is supported. Shaders are available because OpenGL 2.1 is supported. VBOs are available because OpenGL 1.5 is supported. Using VBOs: Yes Is Modded: Definitely; Client brand changed to 'fml,forge' Type: Client (map_client.txt) Resource Packs: Current Language: English (US) Profiler Position: N/A (disabled) CPU: 6x AMD FX(tm)-6300 Six-Core Processorest dans mon logoatomez.json voia le contenue
{ "parent": "item/generated", "textures": { "layer0": "noz43:items/logoatomez" } }voila le contenue de l’item
package fr.atomez.noz43.item; import net.minecraftforge.fml.relauncher.SideOnly; import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.common.registry.GameRegistry; import net.minecraftforge.client.model.ModelLoader; import net.minecraftforge.client.event.ModelRegistryEvent; import net.minecraft.item.ItemStack; import net.minecraft.item.Item; import net.minecraft.client.renderer.block.model.ModelResourceLocation; import net.minecraft.block.state.IBlockState; import fr.atomez.noz43.creativetab.TabAtomez; import fr.atomez.noz43.ElementsModsatomezMod; @ElementsModsatomezMod.ModElement.Tag public class ItemLOGOATOMEZ extends ElementsModsatomezMod.ModElement { @GameRegistry.ObjectHolder("noz43:logoatomez") public static final Item block = null; public ItemLOGOATOMEZ(ElementsModsatomezMod instance) { super(instance, 42); } @Override public void initElements() { elements.items.add(() -> new ItemCustom()); } @SideOnly(Side.CLIENT) @Override public void registerModels(ModelRegistryEvent event) { ModelLoader.setCustomModelResourceLocation(block, 0, new ModelResourceLocation("noz43:logoatomez", "inventory")); } public static class ItemCustom extends Item { public ItemCustom() { setMaxDamage(0); maxStackSize = 64; setUnlocalizedName("logoatomez"); setRegistryName("logoatomez"); setCreativeTab(TabAtomez.tab); } @Override public int getItemEnchantability() { return 0; } @Override public int getMaxItemUseDuration(ItemStack itemstack) { return 0; } @Override public float getDestroySpeed(ItemStack par1ItemStack, IBlockState par2Block) { return 1F; } } } -
Ton item n’est probablement pas enregistré vu que tu as à nouveau un NPE
-
@robin4002 d’ou cette fois si
-
Il suffit de lire les deux premières lignes de ton stack trace :
java.lang.NullPointerException: Initializing game
at net.minecraftforge.client.model.ModelLoader.setCustomModelResourceLocation(ModelLoader.java:1091)
at fr.atomez.noz43.item.ItemLOGOATOMEZ.registerModels(ItemLOGOATOMEZ.java:34)C’est probablement ta variable nommé “block” à la ligne 21 qui reste null.